From 87c6632b02d59874c3ff998dad24d9c5efcabfe5 Mon Sep 17 00:00:00 2001 From: saharan Date: Wed, 19 Feb 2020 21:41:20 +0900 Subject: [PATCH 01/13] adapting to Haxe 4.0.0 - fixed errors in Haxe 4.0.5 - added vscode-related files - added hxml files - officially support `GenericJoint` --- .vscode/tasks.json | 13 + LICENSE | 2 +- README.md | 17 +- bin/js/OimoPhysics.js | 26508 ++++----- bin/js/OimoPhysics.min.js | 2 +- bin/js/externs.js | 9 +- build-doc.hxml | 7 + build-js-demos.hxml | 5 + build-js.hxml | 5 + demos/bin/js/demos.js | 45972 ++++++++++++++++ demos/bin/js/index.html | 16 + demos/src/demo/js/WebGLDebugGraphics.hx | 15 +- demos/src/demo/js/minilib/OMain.hx | 54 +- docs/404.html | 1 + docs/doc.xml | 14308 +++++ docs/extra-styles.css | 1 + docs/highlighter.css | 38 +- docs/highlighter.js | 29 +- docs/index.html | 4 +- docs/index.js | 22 +- docs/nav.js | 2 +- .../oimo/collision/broadphase/BroadPhase.html | 20 +- .../broadphase/BroadPhaseProxyCallback.html | 4 +- .../collision/broadphase/BroadPhaseType.html | 6 +- docs/oimo/collision/broadphase/Proxy.html | 12 +- docs/oimo/collision/broadphase/ProxyPair.html | 6 +- .../bruteforce/BruteForceBroadPhase.html | 8 +- .../broadphase/bruteforce/index.html | 4 +- .../broadphase/bvh/BvhBroadPhase.html | 10 +- docs/oimo/collision/broadphase/bvh/index.html | 6 +- docs/oimo/collision/broadphase/index.html | 8 +- docs/oimo/collision/geometry/Aabb.html | 16 +- docs/oimo/collision/geometry/BoxGeometry.html | 6 +- .../collision/geometry/CapsuleGeometry.html | 6 +- .../oimo/collision/geometry/ConeGeometry.html | 6 +- .../collision/geometry/ConvexGeometry.html | 8 +- .../geometry/ConvexHullGeometry.html | 8 +- .../collision/geometry/CylinderGeometry.html | 6 +- docs/oimo/collision/geometry/Geometry.html | 8 +- .../oimo/collision/geometry/GeometryType.html | 16 +- docs/oimo/collision/geometry/RayCastHit.html | 4 +- .../collision/geometry/SphereGeometry.html | 6 +- docs/oimo/collision/geometry/index.html | 6 +- docs/oimo/collision/index.html | 4 +- .../narrowphase/CollisionMatrix.html | 8 +- .../collision/narrowphase/DetectorResult.html | 10 +- .../narrowphase/DetectorResultPoint.html | 8 +- .../narrowphase/detector/BoxBoxDetector.html | 6 +- .../detector/CapsuleCapsuleDetector.html | 6 +- .../narrowphase/detector/Detector.html | 6 +- .../narrowphase/detector/GjkEpaDetector.html | 6 +- .../detector/SphereBoxDetector.html | 8 +- .../detector/SphereCapsuleDetector.html | 8 +- .../detector/SphereSphereDetector.html | 6 +- .../narrowphase/detector/gjkepa/GjkEpa.html | 20 +- .../detector/gjkepa/GjkEpaResultState.html | 4 +- .../detector/gjkepa/SimplexUtil.html | 10 +- .../narrowphase/detector/gjkepa/index.html | 4 +- .../collision/narrowphase/detector/index.html | 4 +- docs/oimo/collision/narrowphase/index.html | 10 +- docs/oimo/common/Mat3.html | 42 +- docs/oimo/common/Mat4.html | 44 +- docs/oimo/common/MathUtil.html | 8 +- docs/oimo/common/Pool.html | 12 +- docs/oimo/common/Quat.html | 14 +- docs/oimo/common/Setting.html | 4 +- docs/oimo/common/Transform.html | 10 +- docs/oimo/common/Vec3.html | 8 +- docs/oimo/common/index.html | 4 +- docs/oimo/dynamics/Contact.html | 14 +- docs/oimo/dynamics/ContactLink.html | 14 +- docs/oimo/dynamics/ContactManager.html | 6 +- docs/oimo/dynamics/TimeStep.html | 6 +- docs/oimo/dynamics/World.html | 14 +- .../dynamics/callback/AabbTestCallback.html | 6 +- .../dynamics/callback/ContactCallback.html | 14 +- .../dynamics/callback/RayCastCallback.html | 6 +- .../dynamics/callback/RayCastClosest.html | 8 +- docs/oimo/dynamics/callback/index.html | 8 +- docs/oimo/dynamics/common/DebugDraw.html | 44 +- docs/oimo/dynamics/common/DebugDrawStyle.html | 4 +- docs/oimo/dynamics/common/Performance.html | 4 +- docs/oimo/dynamics/common/index.html | 6 +- .../dynamics/constraint/ConstraintSolver.html | 10 +- .../PositionCorrectionAlgorithm.html | 6 +- .../constraint/contact/ContactConstraint.html | 8 +- .../dynamics/constraint/contact/Manifold.html | 18 +- .../constraint/contact/ManifoldPoint.html | 12 +- .../dynamics/constraint/contact/index.html | 8 +- docs/oimo/dynamics/constraint/index.html | 4 +- .../constraint/joint/CylindricalJoint.html | 48 +- .../joint/CylindricalJointConfig.html | 14 +- .../constraint/joint/GenericJoint.html | 34 + .../constraint/joint/GenericJointConfig.html | 14 + .../oimo/dynamics/constraint/joint/Joint.html | 42 +- .../constraint/joint/JointConfig.html | 14 +- .../dynamics/constraint/joint/JointLink.html | 14 +- .../dynamics/constraint/joint/JointType.html | 17 +- .../constraint/joint/PrismaticJoint.html | 48 +- .../joint/PrismaticJointConfig.html | 14 +- .../constraint/joint/RagdollJoint.html | 52 +- .../constraint/joint/RagdollJointConfig.html | 20 +- .../constraint/joint/RevoluteJoint.html | 48 +- .../constraint/joint/RevoluteJointConfig.html | 14 +- .../joint/RotationalLimitMotor.html | 14 +- .../constraint/joint/SphericalJoint.html | 40 +- .../joint/SphericalJointConfig.html | 12 +- .../constraint/joint/SpringDamper.html | 12 +- .../joint/TranslationalLimitMotor.html | 14 +- .../constraint/joint/UniversalJoint.html | 48 +- .../joint/UniversalJointConfig.html | 14 +- .../oimo/dynamics/constraint/joint/index.html | 26 +- .../solver/ConstraintSolverType.html | 6 +- .../direct/DirectJointConstraintSolver.html | 6 +- .../constraint/solver/direct/index.html | 6 +- .../dynamics/constraint/solver/index.html | 4 +- .../pgs/PgsContactConstraintSolver.html | 6 +- .../solver/pgs/PgsJointConstraintSolver.html | 4 +- .../dynamics/constraint/solver/pgs/index.html | 4 +- docs/oimo/dynamics/index.html | 12 +- docs/oimo/dynamics/rigidbody/MassData.html | 4 +- docs/oimo/dynamics/rigidbody/RigidBody.html | 72 +- .../dynamics/rigidbody/RigidBodyConfig.html | 12 +- .../dynamics/rigidbody/RigidBodyType.html | 10 +- docs/oimo/dynamics/rigidbody/Shape.html | 26 +- docs/oimo/dynamics/rigidbody/ShapeConfig.html | 14 +- docs/oimo/dynamics/rigidbody/index.html | 14 +- docs/oimo/index.html | 4 +- docs/styles.css | 28 +- .../src/demo => exports/src/export}/Export.hx | 15 +- exports/src/export/js/Export.hx | 787 + src/oimo/collision/broadphase/BroadPhase.hx | 18 +- src/oimo/collision/broadphase/Proxy.hx | 3 +- .../bruteforce/BruteForceBroadPhase.hx | 3 +- .../collision/broadphase/bvh/BvhBroadPhase.hx | 6 +- src/oimo/collision/broadphase/bvh/BvhNode.hx | 15 +- .../collision/broadphase/bvh/BvhStrategy.hx | 9 +- src/oimo/collision/broadphase/bvh/BvhTree.hx | 36 +- .../narrowphase/detector/BoxBoxDetector.hx | 45 +- .../detector/gjkepa/EpaPolyhedron.hx | 30 +- .../detector/gjkepa/EpaTriangle.hx | 3 +- .../narrowphase/detector/gjkepa/GjkEpa.hx | 18 +- src/oimo/common/Mat3.hx | 3 +- src/oimo/common/Mat4.hx | 3 +- src/oimo/common/Quat.hx | 3 +- src/oimo/common/Vec3.hx | 3 +- src/oimo/dynamics/Contact.hx | 24 +- src/oimo/dynamics/ContactManager.hx | 6 +- src/oimo/dynamics/Island.hx | 12 +- src/oimo/dynamics/World.hx | 60 +- src/oimo/dynamics/common/DebugDraw.hx | 12 +- .../constraint/contact/ContactConstraint.hx | 6 +- .../constraint/contact/ContactImpulse.hx | 3 +- .../constraint/contact/ManifoldPoint.hx | 12 +- .../constraint/contact/ManifoldUpdater.hx | 12 +- .../dynamics/constraint/info/JacobianRow.hx | 9 +- .../info/contact/ContactSolverInfoRow.hx | 3 +- .../constraint/info/joint/JointSolverInfo.hx | 3 +- .../info/joint/JointSolverInfoRow.hx | 9 +- .../dynamics/constraint/joint/BasisTracker.hx | 12 +- .../constraint/joint/CylindricalJoint.hx | 3 +- .../dynamics/constraint/joint/GenericJoint.hx | 12 +- src/oimo/dynamics/constraint/joint/Joint.hx | 9 +- .../dynamics/constraint/joint/JointImpulse.hx | 3 +- .../constraint/joint/PrismaticJoint.hx | 3 +- .../dynamics/constraint/joint/RagdollJoint.hx | 3 +- .../constraint/joint/RevoluteJoint.hx | 3 +- .../constraint/joint/UniversalJoint.hx | 6 +- .../solver/direct/BoundaryBuildInfo.hx | 15 +- .../solver/direct/BoundaryBuilder.hx | 3 +- .../direct/DirectJointConstraintSolver.hx | 12 +- .../constraint/solver/direct/MassMatrix.hx | 12 +- .../solver/pgs/PgsContactConstraintSolver.hx | 3 +- .../solver/pgs/PgsJointConstraintSolver.hx | 3 +- src/oimo/dynamics/rigidbody/RigidBody.hx | 33 +- src/oimo/dynamics/rigidbody/Shape.hx | 3 +- src/oimo/m/B.hx | 3 +- src/oimo/m/M.hx | 5 +- 178 files changed, 73420 insertions(+), 16406 deletions(-) create mode 100644 .vscode/tasks.json create mode 100644 build-doc.hxml create mode 100644 build-js-demos.hxml create mode 100644 build-js.hxml create mode 100644 demos/bin/js/demos.js create mode 100644 demos/bin/js/index.html create mode 100644 docs/404.html create mode 100644 docs/doc.xml create mode 100644 docs/extra-styles.css create mode 100644 docs/oimo/dynamics/constraint/joint/GenericJoint.html create mode 100644 docs/oimo/dynamics/constraint/joint/GenericJointConfig.html rename {demos/src/demo => exports/src/export}/Export.hx (94%) create mode 100644 exports/src/export/js/Export.hx diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..23c0b2b --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,13 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "haxe", + "args": "active configuration", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index d9f8ca7..836e332 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 saharan +Copyright (c) 2020 saharan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1f44161..d93e9f6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -OimoPhysics +OimoPhysics 1.2.1 --- A lightweight 3D physics engine. @@ -13,7 +13,7 @@ A lightweight 3D physics engine. ## Features * Written in Haxe * Exported as JavaScript (see [bin/js/](./bin/js)) - * Public classes and methods will be exposed through `windwow.OIMO`. + * Public classes and methods will be exposed through `window.OIMO`. * e.g. `new OIMO.Vec3(1, 2, 3)` to create an instance of `Vec3` class. * Rigid body motion types * Dynamic @@ -35,7 +35,7 @@ A lightweight 3D physics engine. * Prismatic (a.k.a. slider) * Universal * Ragdoll (a.k.a. cone twist, character) - * Generic (a.k.a. generic 6DoF) *WIP, not applied to bin/js yet* + * Generic (a.k.a. 6-DoF joint) * Breakable joints * Constraint solvers * Direct block MLCP solver @@ -49,12 +49,11 @@ A lightweight 3D physics engine. * ray casting * convex casting -## Compile JavaScript demos in Haxe -* Use Haxe 4.0.0 or later -* main class: `demo.js.DemoJS` -* Try enabling compiler options if fails - * `-D analyzer` - * `-D eval-stack` +## Compilations +Haxe 4.0.0 or later is required. (recommended: Haxe 4.0.5 or later) +* Use `build-js.hxml` to compile for JavaScript library. +* Use `build-js-demos.hxml` to compile JavaScript demos. +* Use `build-doc.hxml` to generate API documentation. [dox](https://github.com/HaxeFoundation/dox) is required. ## License The MIT License diff --git a/bin/js/OimoPhysics.js b/bin/js/OimoPhysics.js index 9b6f20a..b2e8b06 100644 --- a/bin/js/OimoPhysics.js +++ b/bin/js/OimoPhysics.js @@ -1,13 +1,683 @@ /* - * OimoPhysics 1.2.0 (c) 2018 saharan, The MIT License + * OimoPhysics 1.2.1 (c) 2020 saharan, The MIT License */ -(function (window) { "use strict"; +(function ($global) { "use strict"; function $extend(from, fields) { - function Inherit() {} Inherit.prototype = from; var proto = new Inherit(); + var proto = Object.create(from); for (var name in fields) proto[name] = fields[name]; if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; return proto; } +var HxOverrides = function() { }; +HxOverrides.iter = function(a) { + return { cur : 0, arr : a, hasNext : function() { + return this.cur < this.arr.length; + }, next : function() { + return this.arr[this.cur++]; + }}; +}; +var export_js_Export = function() { }; +export_js_Export.main = function() { + + window["OIMO"] = {}; + window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; + window["OIMO"]["BroadPhase"] = oimo_collision_broadphase_BroadPhase; + oimo_collision_broadphase_BroadPhase.prototype["createProxy"] = oimo_collision_broadphase_BroadPhase.prototype.createProxy; + oimo_collision_broadphase_BroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_BroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_BroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_BroadPhase.prototype.moveProxy; + oimo_collision_broadphase_BroadPhase.prototype["isOverlapping"] = oimo_collision_broadphase_BroadPhase.prototype.isOverlapping; + oimo_collision_broadphase_BroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_BroadPhase.prototype.collectPairs; + oimo_collision_broadphase_BroadPhase.prototype["getProxyPairList"] = oimo_collision_broadphase_BroadPhase.prototype.getProxyPairList; + oimo_collision_broadphase_BroadPhase.prototype["isIncremental"] = oimo_collision_broadphase_BroadPhase.prototype.isIncremental; + oimo_collision_broadphase_BroadPhase.prototype["getTestCount"] = oimo_collision_broadphase_BroadPhase.prototype.getTestCount; + oimo_collision_broadphase_BroadPhase.prototype["rayCast"] = oimo_collision_broadphase_BroadPhase.prototype.rayCast; + oimo_collision_broadphase_BroadPhase.prototype["convexCast"] = oimo_collision_broadphase_BroadPhase.prototype.convexCast; + oimo_collision_broadphase_BroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_BroadPhase.prototype.aabbTest; + window["OIMO"]["Geometry"] = oimo_collision_geometry_Geometry; + oimo_collision_geometry_Geometry.prototype["getType"] = oimo_collision_geometry_Geometry.prototype.getType; + oimo_collision_geometry_Geometry.prototype["getVolume"] = oimo_collision_geometry_Geometry.prototype.getVolume; + oimo_collision_geometry_Geometry.prototype["rayCast"] = oimo_collision_geometry_Geometry.prototype.rayCast; + window["OIMO"]["ConvexGeometry"] = oimo_collision_geometry_ConvexGeometry; + oimo_collision_geometry_ConvexGeometry.prototype["getGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.getGjkMergin; + oimo_collision_geometry_ConvexGeometry.prototype["setGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.setGjkMergin; + oimo_collision_geometry_ConvexGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexGeometry.prototype.computeLocalSupportingVertex; + oimo_collision_geometry_ConvexGeometry.prototype["rayCast"] = oimo_collision_geometry_ConvexGeometry.prototype.rayCast; + window["OIMO"]["BroadPhaseProxyCallback"] = oimo_collision_broadphase_BroadPhaseProxyCallback; + oimo_collision_broadphase_BroadPhaseProxyCallback.prototype["process"] = oimo_collision_broadphase_BroadPhaseProxyCallback.prototype.process; + window["OIMO"]["BroadPhaseType"] = oimo_collision_broadphase_BroadPhaseType; + window["OIMO"]["Proxy"] = oimo_collision_broadphase_Proxy; + oimo_collision_broadphase_Proxy.prototype["getId"] = oimo_collision_broadphase_Proxy.prototype.getId; + oimo_collision_broadphase_Proxy.prototype["getFatAabb"] = oimo_collision_broadphase_Proxy.prototype.getFatAabb; + oimo_collision_broadphase_Proxy.prototype["getFatAabbTo"] = oimo_collision_broadphase_Proxy.prototype.getFatAabbTo; + window["OIMO"]["ProxyPair"] = oimo_collision_broadphase_ProxyPair; + oimo_collision_broadphase_ProxyPair.prototype["getProxy1"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy1; + oimo_collision_broadphase_ProxyPair.prototype["getProxy2"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy2; + oimo_collision_broadphase_ProxyPair.prototype["getNext"] = oimo_collision_broadphase_ProxyPair.prototype.getNext; + window["OIMO"]["BruteForceBroadPhase"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.createProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.moveProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.collectPairs; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.rayCast; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.convexCast; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.aabbTest; + window["OIMO"]["BvhBroadPhase"] = oimo_collision_broadphase_bvh_BvhBroadPhase; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.createProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.moveProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.collectPairs; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.rayCast; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.convexCast; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.aabbTest; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["getTreeBalance"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.getTreeBalance; + window["OIMO"]["Aabb"] = oimo_collision_geometry_Aabb; + oimo_collision_geometry_Aabb.prototype["init"] = oimo_collision_geometry_Aabb.prototype.init; + oimo_collision_geometry_Aabb.prototype["getMin"] = oimo_collision_geometry_Aabb.prototype.getMin; + oimo_collision_geometry_Aabb.prototype["getMinTo"] = oimo_collision_geometry_Aabb.prototype.getMinTo; + oimo_collision_geometry_Aabb.prototype["setMin"] = oimo_collision_geometry_Aabb.prototype.setMin; + oimo_collision_geometry_Aabb.prototype["getMax"] = oimo_collision_geometry_Aabb.prototype.getMax; + oimo_collision_geometry_Aabb.prototype["getMaxTo"] = oimo_collision_geometry_Aabb.prototype.getMaxTo; + oimo_collision_geometry_Aabb.prototype["setMax"] = oimo_collision_geometry_Aabb.prototype.setMax; + oimo_collision_geometry_Aabb.prototype["getCenter"] = oimo_collision_geometry_Aabb.prototype.getCenter; + oimo_collision_geometry_Aabb.prototype["getCenterTo"] = oimo_collision_geometry_Aabb.prototype.getCenterTo; + oimo_collision_geometry_Aabb.prototype["getExtents"] = oimo_collision_geometry_Aabb.prototype.getExtents; + oimo_collision_geometry_Aabb.prototype["getExtentsTo"] = oimo_collision_geometry_Aabb.prototype.getExtentsTo; + oimo_collision_geometry_Aabb.prototype["combine"] = oimo_collision_geometry_Aabb.prototype.combine; + oimo_collision_geometry_Aabb.prototype["combined"] = oimo_collision_geometry_Aabb.prototype.combined; + oimo_collision_geometry_Aabb.prototype["overlap"] = oimo_collision_geometry_Aabb.prototype.overlap; + oimo_collision_geometry_Aabb.prototype["getIntersection"] = oimo_collision_geometry_Aabb.prototype.getIntersection; + oimo_collision_geometry_Aabb.prototype["getIntersectionTo"] = oimo_collision_geometry_Aabb.prototype.getIntersectionTo; + oimo_collision_geometry_Aabb.prototype["copyFrom"] = oimo_collision_geometry_Aabb.prototype.copyFrom; + oimo_collision_geometry_Aabb.prototype["clone"] = oimo_collision_geometry_Aabb.prototype.clone; + window["OIMO"]["BoxGeometry"] = oimo_collision_geometry_BoxGeometry; + oimo_collision_geometry_BoxGeometry.prototype["getHalfExtents"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtents; + oimo_collision_geometry_BoxGeometry.prototype["getHalfExtentsTo"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtentsTo; + oimo_collision_geometry_BoxGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_BoxGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CapsuleGeometry"] = oimo_collision_geometry_CapsuleGeometry; + oimo_collision_geometry_CapsuleGeometry.prototype["getRadius"] = oimo_collision_geometry_CapsuleGeometry.prototype.getRadius; + oimo_collision_geometry_CapsuleGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CapsuleGeometry.prototype.getHalfHeight; + oimo_collision_geometry_CapsuleGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CapsuleGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["ConeGeometry"] = oimo_collision_geometry_ConeGeometry; + oimo_collision_geometry_ConeGeometry.prototype["getRadius"] = oimo_collision_geometry_ConeGeometry.prototype.getRadius; + oimo_collision_geometry_ConeGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_ConeGeometry.prototype.getHalfHeight; + oimo_collision_geometry_ConeGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConeGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["ConvexHullGeometry"] = oimo_collision_geometry_ConvexHullGeometry; + oimo_collision_geometry_ConvexHullGeometry.prototype["getVertices"] = oimo_collision_geometry_ConvexHullGeometry.prototype.getVertices; + oimo_collision_geometry_ConvexHullGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexHullGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CylinderGeometry"] = oimo_collision_geometry_CylinderGeometry; + oimo_collision_geometry_CylinderGeometry.prototype["getRadius"] = oimo_collision_geometry_CylinderGeometry.prototype.getRadius; + oimo_collision_geometry_CylinderGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CylinderGeometry.prototype.getHalfHeight; + oimo_collision_geometry_CylinderGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CylinderGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["GeometryType"] = oimo_collision_geometry_GeometryType; + window["OIMO"]["RayCastHit"] = oimo_collision_geometry_RayCastHit; + window["OIMO"]["SphereGeometry"] = oimo_collision_geometry_SphereGeometry; + oimo_collision_geometry_SphereGeometry.prototype["getRadius"] = oimo_collision_geometry_SphereGeometry.prototype.getRadius; + oimo_collision_geometry_SphereGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_SphereGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CollisionMatrix"] = oimo_collision_narrowphase_CollisionMatrix; + oimo_collision_narrowphase_CollisionMatrix.prototype["getDetector"] = oimo_collision_narrowphase_CollisionMatrix.prototype.getDetector; + window["OIMO"]["DetectorResult"] = oimo_collision_narrowphase_DetectorResult; + oimo_collision_narrowphase_DetectorResult.prototype["getMaxDepth"] = oimo_collision_narrowphase_DetectorResult.prototype.getMaxDepth; + oimo_collision_narrowphase_DetectorResult.prototype["clear"] = oimo_collision_narrowphase_DetectorResult.prototype.clear; + window["OIMO"]["DetectorResultPoint"] = oimo_collision_narrowphase_DetectorResultPoint; + window["OIMO"]["Detector"] = oimo_collision_narrowphase_detector_Detector; + oimo_collision_narrowphase_detector_Detector.prototype["detect"] = oimo_collision_narrowphase_detector_Detector.prototype.detect; + window["OIMO"]["BoxBoxDetector"] = oimo_collision_narrowphase_detector_BoxBoxDetector; + window["OIMO"]["CapsuleCapsuleDetector"] = oimo_collision_narrowphase_detector_CapsuleCapsuleDetector; + window["OIMO"]["GjkEpaDetector"] = oimo_collision_narrowphase_detector_GjkEpaDetector; + window["OIMO"]["SphereBoxDetector"] = oimo_collision_narrowphase_detector_SphereBoxDetector; + window["OIMO"]["SphereCapsuleDetector"] = oimo_collision_narrowphase_detector_SphereCapsuleDetector; + window["OIMO"]["SphereSphereDetector"] = oimo_collision_narrowphase_detector_SphereSphereDetector; + window["OIMO"]["Vec3"] = oimo_common_Vec3; + oimo_common_Vec3.prototype["init"] = oimo_common_Vec3.prototype.init; + oimo_common_Vec3.prototype["zero"] = oimo_common_Vec3.prototype.zero; + oimo_common_Vec3.prototype["add"] = oimo_common_Vec3.prototype.add; + oimo_common_Vec3.prototype["add3"] = oimo_common_Vec3.prototype.add3; + oimo_common_Vec3.prototype["addScaled"] = oimo_common_Vec3.prototype.addScaled; + oimo_common_Vec3.prototype["sub"] = oimo_common_Vec3.prototype.sub; + oimo_common_Vec3.prototype["sub3"] = oimo_common_Vec3.prototype.sub3; + oimo_common_Vec3.prototype["scale"] = oimo_common_Vec3.prototype.scale; + oimo_common_Vec3.prototype["scale3"] = oimo_common_Vec3.prototype.scale3; + oimo_common_Vec3.prototype["dot"] = oimo_common_Vec3.prototype.dot; + oimo_common_Vec3.prototype["cross"] = oimo_common_Vec3.prototype.cross; + oimo_common_Vec3.prototype["addEq"] = oimo_common_Vec3.prototype.addEq; + oimo_common_Vec3.prototype["add3Eq"] = oimo_common_Vec3.prototype.add3Eq; + oimo_common_Vec3.prototype["addScaledEq"] = oimo_common_Vec3.prototype.addScaledEq; + oimo_common_Vec3.prototype["subEq"] = oimo_common_Vec3.prototype.subEq; + oimo_common_Vec3.prototype["sub3Eq"] = oimo_common_Vec3.prototype.sub3Eq; + oimo_common_Vec3.prototype["scaleEq"] = oimo_common_Vec3.prototype.scaleEq; + oimo_common_Vec3.prototype["scale3Eq"] = oimo_common_Vec3.prototype.scale3Eq; + oimo_common_Vec3.prototype["crossEq"] = oimo_common_Vec3.prototype.crossEq; + oimo_common_Vec3.prototype["mulMat3"] = oimo_common_Vec3.prototype.mulMat3; + oimo_common_Vec3.prototype["mulMat4"] = oimo_common_Vec3.prototype.mulMat4; + oimo_common_Vec3.prototype["mulTransform"] = oimo_common_Vec3.prototype.mulTransform; + oimo_common_Vec3.prototype["mulMat3Eq"] = oimo_common_Vec3.prototype.mulMat3Eq; + oimo_common_Vec3.prototype["mulMat4Eq"] = oimo_common_Vec3.prototype.mulMat4Eq; + oimo_common_Vec3.prototype["mulTransformEq"] = oimo_common_Vec3.prototype.mulTransformEq; + oimo_common_Vec3.prototype["length"] = oimo_common_Vec3.prototype.length; + oimo_common_Vec3.prototype["lengthSq"] = oimo_common_Vec3.prototype.lengthSq; + oimo_common_Vec3.prototype["normalized"] = oimo_common_Vec3.prototype.normalized; + oimo_common_Vec3.prototype["normalize"] = oimo_common_Vec3.prototype.normalize; + oimo_common_Vec3.prototype["negate"] = oimo_common_Vec3.prototype.negate; + oimo_common_Vec3.prototype["negateEq"] = oimo_common_Vec3.prototype.negateEq; + oimo_common_Vec3.prototype["copyFrom"] = oimo_common_Vec3.prototype.copyFrom; + oimo_common_Vec3.prototype["clone"] = oimo_common_Vec3.prototype.clone; + oimo_common_Vec3.prototype["toString"] = oimo_common_Vec3.prototype.toString; + window["OIMO"]["Transform"] = oimo_common_Transform; + oimo_common_Transform.prototype["identity"] = oimo_common_Transform.prototype.identity; + oimo_common_Transform.prototype["getPosition"] = oimo_common_Transform.prototype.getPosition; + oimo_common_Transform.prototype["getPositionTo"] = oimo_common_Transform.prototype.getPositionTo; + oimo_common_Transform.prototype["setPosition"] = oimo_common_Transform.prototype.setPosition; + oimo_common_Transform.prototype["translate"] = oimo_common_Transform.prototype.translate; + oimo_common_Transform.prototype["getRotation"] = oimo_common_Transform.prototype.getRotation; + oimo_common_Transform.prototype["getRotationTo"] = oimo_common_Transform.prototype.getRotationTo; + oimo_common_Transform.prototype["setRotation"] = oimo_common_Transform.prototype.setRotation; + oimo_common_Transform.prototype["setRotationXyz"] = oimo_common_Transform.prototype.setRotationXyz; + oimo_common_Transform.prototype["rotate"] = oimo_common_Transform.prototype.rotate; + oimo_common_Transform.prototype["rotateXyz"] = oimo_common_Transform.prototype.rotateXyz; + oimo_common_Transform.prototype["getOrientation"] = oimo_common_Transform.prototype.getOrientation; + oimo_common_Transform.prototype["getOrientationTo"] = oimo_common_Transform.prototype.getOrientationTo; + oimo_common_Transform.prototype["setOrientation"] = oimo_common_Transform.prototype.setOrientation; + oimo_common_Transform.prototype["clone"] = oimo_common_Transform.prototype.clone; + oimo_common_Transform.prototype["copyFrom"] = oimo_common_Transform.prototype.copyFrom; + window["OIMO"]["Setting"] = oimo_common_Setting; + window["OIMO"]["GjkEpa"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeClosestPoints"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeClosestPoints; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeDistance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeDistance; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["convexCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.convexCast; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["rayCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.rayCast; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa["getInstance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.getInstance; + window["OIMO"]["GjkEpaResultState"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState; + window["OIMO"]["SimplexUtil"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin2"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin3"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin4"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4; + window["OIMO"]["Mat3"] = oimo_common_Mat3; + oimo_common_Mat3.prototype["init"] = oimo_common_Mat3.prototype.init; + oimo_common_Mat3.prototype["identity"] = oimo_common_Mat3.prototype.identity; + oimo_common_Mat3.prototype["add"] = oimo_common_Mat3.prototype.add; + oimo_common_Mat3.prototype["sub"] = oimo_common_Mat3.prototype.sub; + oimo_common_Mat3.prototype["scale"] = oimo_common_Mat3.prototype.scale; + oimo_common_Mat3.prototype["mul"] = oimo_common_Mat3.prototype.mul; + oimo_common_Mat3.prototype["addEq"] = oimo_common_Mat3.prototype.addEq; + oimo_common_Mat3.prototype["subEq"] = oimo_common_Mat3.prototype.subEq; + oimo_common_Mat3.prototype["scaleEq"] = oimo_common_Mat3.prototype.scaleEq; + oimo_common_Mat3.prototype["mulEq"] = oimo_common_Mat3.prototype.mulEq; + oimo_common_Mat3.prototype["prependScale"] = oimo_common_Mat3.prototype.prependScale; + oimo_common_Mat3.prototype["appendScale"] = oimo_common_Mat3.prototype.appendScale; + oimo_common_Mat3.prototype["prependRotation"] = oimo_common_Mat3.prototype.prependRotation; + oimo_common_Mat3.prototype["appendRotation"] = oimo_common_Mat3.prototype.appendRotation; + oimo_common_Mat3.prototype["prependScaleEq"] = oimo_common_Mat3.prototype.prependScaleEq; + oimo_common_Mat3.prototype["appendScaleEq"] = oimo_common_Mat3.prototype.appendScaleEq; + oimo_common_Mat3.prototype["prependRotationEq"] = oimo_common_Mat3.prototype.prependRotationEq; + oimo_common_Mat3.prototype["appendRotationEq"] = oimo_common_Mat3.prototype.appendRotationEq; + oimo_common_Mat3.prototype["transpose"] = oimo_common_Mat3.prototype.transpose; + oimo_common_Mat3.prototype["transposeEq"] = oimo_common_Mat3.prototype.transposeEq; + oimo_common_Mat3.prototype["determinant"] = oimo_common_Mat3.prototype.determinant; + oimo_common_Mat3.prototype["trace"] = oimo_common_Mat3.prototype.trace; + oimo_common_Mat3.prototype["inverse"] = oimo_common_Mat3.prototype.inverse; + oimo_common_Mat3.prototype["inverseEq"] = oimo_common_Mat3.prototype.inverseEq; + oimo_common_Mat3.prototype["toArray"] = oimo_common_Mat3.prototype.toArray; + oimo_common_Mat3.prototype["copyFrom"] = oimo_common_Mat3.prototype.copyFrom; + oimo_common_Mat3.prototype["clone"] = oimo_common_Mat3.prototype.clone; + oimo_common_Mat3.prototype["fromQuat"] = oimo_common_Mat3.prototype.fromQuat; + oimo_common_Mat3.prototype["toQuat"] = oimo_common_Mat3.prototype.toQuat; + oimo_common_Mat3.prototype["fromEulerXyz"] = oimo_common_Mat3.prototype.fromEulerXyz; + oimo_common_Mat3.prototype["toEulerXyz"] = oimo_common_Mat3.prototype.toEulerXyz; + oimo_common_Mat3.prototype["getRow"] = oimo_common_Mat3.prototype.getRow; + oimo_common_Mat3.prototype["getCol"] = oimo_common_Mat3.prototype.getCol; + oimo_common_Mat3.prototype["getRowTo"] = oimo_common_Mat3.prototype.getRowTo; + oimo_common_Mat3.prototype["getColTo"] = oimo_common_Mat3.prototype.getColTo; + oimo_common_Mat3.prototype["fromRows"] = oimo_common_Mat3.prototype.fromRows; + oimo_common_Mat3.prototype["fromCols"] = oimo_common_Mat3.prototype.fromCols; + oimo_common_Mat3.prototype["toString"] = oimo_common_Mat3.prototype.toString; + window["OIMO"]["Mat4"] = oimo_common_Mat4; + oimo_common_Mat4.prototype["init"] = oimo_common_Mat4.prototype.init; + oimo_common_Mat4.prototype["identity"] = oimo_common_Mat4.prototype.identity; + oimo_common_Mat4.prototype["add"] = oimo_common_Mat4.prototype.add; + oimo_common_Mat4.prototype["sub"] = oimo_common_Mat4.prototype.sub; + oimo_common_Mat4.prototype["scale"] = oimo_common_Mat4.prototype.scale; + oimo_common_Mat4.prototype["mul"] = oimo_common_Mat4.prototype.mul; + oimo_common_Mat4.prototype["addEq"] = oimo_common_Mat4.prototype.addEq; + oimo_common_Mat4.prototype["subEq"] = oimo_common_Mat4.prototype.subEq; + oimo_common_Mat4.prototype["scaleEq"] = oimo_common_Mat4.prototype.scaleEq; + oimo_common_Mat4.prototype["mulEq"] = oimo_common_Mat4.prototype.mulEq; + oimo_common_Mat4.prototype["prependScale"] = oimo_common_Mat4.prototype.prependScale; + oimo_common_Mat4.prototype["appendScale"] = oimo_common_Mat4.prototype.appendScale; + oimo_common_Mat4.prototype["prependRotation"] = oimo_common_Mat4.prototype.prependRotation; + oimo_common_Mat4.prototype["appendRotation"] = oimo_common_Mat4.prototype.appendRotation; + oimo_common_Mat4.prototype["prependTranslation"] = oimo_common_Mat4.prototype.prependTranslation; + oimo_common_Mat4.prototype["appendTranslation"] = oimo_common_Mat4.prototype.appendTranslation; + oimo_common_Mat4.prototype["prependScaleEq"] = oimo_common_Mat4.prototype.prependScaleEq; + oimo_common_Mat4.prototype["appendScaleEq"] = oimo_common_Mat4.prototype.appendScaleEq; + oimo_common_Mat4.prototype["prependRotationEq"] = oimo_common_Mat4.prototype.prependRotationEq; + oimo_common_Mat4.prototype["appendRotationEq"] = oimo_common_Mat4.prototype.appendRotationEq; + oimo_common_Mat4.prototype["prependTranslationEq"] = oimo_common_Mat4.prototype.prependTranslationEq; + oimo_common_Mat4.prototype["appendTranslationEq"] = oimo_common_Mat4.prototype.appendTranslationEq; + oimo_common_Mat4.prototype["transpose"] = oimo_common_Mat4.prototype.transpose; + oimo_common_Mat4.prototype["transposeEq"] = oimo_common_Mat4.prototype.transposeEq; + oimo_common_Mat4.prototype["determinant"] = oimo_common_Mat4.prototype.determinant; + oimo_common_Mat4.prototype["trace"] = oimo_common_Mat4.prototype.trace; + oimo_common_Mat4.prototype["inverse"] = oimo_common_Mat4.prototype.inverse; + oimo_common_Mat4.prototype["inverseEq"] = oimo_common_Mat4.prototype.inverseEq; + oimo_common_Mat4.prototype["lookAt"] = oimo_common_Mat4.prototype.lookAt; + oimo_common_Mat4.prototype["perspective"] = oimo_common_Mat4.prototype.perspective; + oimo_common_Mat4.prototype["ortho"] = oimo_common_Mat4.prototype.ortho; + oimo_common_Mat4.prototype["toArray"] = oimo_common_Mat4.prototype.toArray; + oimo_common_Mat4.prototype["copyFrom"] = oimo_common_Mat4.prototype.copyFrom; + oimo_common_Mat4.prototype["fromMat3"] = oimo_common_Mat4.prototype.fromMat3; + oimo_common_Mat4.prototype["fromTransform"] = oimo_common_Mat4.prototype.fromTransform; + oimo_common_Mat4.prototype["clone"] = oimo_common_Mat4.prototype.clone; + oimo_common_Mat4.prototype["toString"] = oimo_common_Mat4.prototype.toString; + window["OIMO"]["MathUtil"] = oimo_common_MathUtil; + oimo_common_MathUtil["abs"] = oimo_common_MathUtil.abs; + oimo_common_MathUtil["sin"] = oimo_common_MathUtil.sin; + oimo_common_MathUtil["cos"] = oimo_common_MathUtil.cos; + oimo_common_MathUtil["tan"] = oimo_common_MathUtil.tan; + oimo_common_MathUtil["asin"] = oimo_common_MathUtil.asin; + oimo_common_MathUtil["acos"] = oimo_common_MathUtil.acos; + oimo_common_MathUtil["atan"] = oimo_common_MathUtil.atan; + oimo_common_MathUtil["safeAsin"] = oimo_common_MathUtil.safeAsin; + oimo_common_MathUtil["safeAcos"] = oimo_common_MathUtil.safeAcos; + oimo_common_MathUtil["atan2"] = oimo_common_MathUtil.atan2; + oimo_common_MathUtil["sqrt"] = oimo_common_MathUtil.sqrt; + oimo_common_MathUtil["clamp"] = oimo_common_MathUtil.clamp; + oimo_common_MathUtil["rand"] = oimo_common_MathUtil.rand; + oimo_common_MathUtil["randIn"] = oimo_common_MathUtil.randIn; + oimo_common_MathUtil["randVec3In"] = oimo_common_MathUtil.randVec3In; + oimo_common_MathUtil["randVec3"] = oimo_common_MathUtil.randVec3; + window["OIMO"]["Pool"] = oimo_common_Pool; + oimo_common_Pool.prototype["vec3"] = oimo_common_Pool.prototype.vec3; + oimo_common_Pool.prototype["mat3"] = oimo_common_Pool.prototype.mat3; + oimo_common_Pool.prototype["mat4"] = oimo_common_Pool.prototype.mat4; + oimo_common_Pool.prototype["quat"] = oimo_common_Pool.prototype.quat; + oimo_common_Pool.prototype["dispose"] = oimo_common_Pool.prototype.dispose; + oimo_common_Pool.prototype["disposeVec3"] = oimo_common_Pool.prototype.disposeVec3; + oimo_common_Pool.prototype["disposeMat3"] = oimo_common_Pool.prototype.disposeMat3; + oimo_common_Pool.prototype["disposeMat4"] = oimo_common_Pool.prototype.disposeMat4; + oimo_common_Pool.prototype["disposeQuat"] = oimo_common_Pool.prototype.disposeQuat; + window["OIMO"]["Quat"] = oimo_common_Quat; + oimo_common_Quat.prototype["identity"] = oimo_common_Quat.prototype.identity; + oimo_common_Quat.prototype["init"] = oimo_common_Quat.prototype.init; + oimo_common_Quat.prototype["add"] = oimo_common_Quat.prototype.add; + oimo_common_Quat.prototype["sub"] = oimo_common_Quat.prototype.sub; + oimo_common_Quat.prototype["scale"] = oimo_common_Quat.prototype.scale; + oimo_common_Quat.prototype["addEq"] = oimo_common_Quat.prototype.addEq; + oimo_common_Quat.prototype["subEq"] = oimo_common_Quat.prototype.subEq; + oimo_common_Quat.prototype["scaleEq"] = oimo_common_Quat.prototype.scaleEq; + oimo_common_Quat.prototype["length"] = oimo_common_Quat.prototype.length; + oimo_common_Quat.prototype["lengthSq"] = oimo_common_Quat.prototype.lengthSq; + oimo_common_Quat.prototype["dot"] = oimo_common_Quat.prototype.dot; + oimo_common_Quat.prototype["normalized"] = oimo_common_Quat.prototype.normalized; + oimo_common_Quat.prototype["normalize"] = oimo_common_Quat.prototype.normalize; + oimo_common_Quat.prototype["setArc"] = oimo_common_Quat.prototype.setArc; + oimo_common_Quat.prototype["slerp"] = oimo_common_Quat.prototype.slerp; + oimo_common_Quat.prototype["copyFrom"] = oimo_common_Quat.prototype.copyFrom; + oimo_common_Quat.prototype["clone"] = oimo_common_Quat.prototype.clone; + oimo_common_Quat.prototype["fromMat3"] = oimo_common_Quat.prototype.fromMat3; + oimo_common_Quat.prototype["toMat3"] = oimo_common_Quat.prototype.toMat3; + oimo_common_Quat.prototype["toString"] = oimo_common_Quat.prototype.toString; + window["OIMO"]["Contact"] = oimo_dynamics_Contact; + oimo_dynamics_Contact.prototype["getShape1"] = oimo_dynamics_Contact.prototype.getShape1; + oimo_dynamics_Contact.prototype["getShape2"] = oimo_dynamics_Contact.prototype.getShape2; + oimo_dynamics_Contact.prototype["isTouching"] = oimo_dynamics_Contact.prototype.isTouching; + oimo_dynamics_Contact.prototype["getManifold"] = oimo_dynamics_Contact.prototype.getManifold; + oimo_dynamics_Contact.prototype["getContactConstraint"] = oimo_dynamics_Contact.prototype.getContactConstraint; + oimo_dynamics_Contact.prototype["getPrev"] = oimo_dynamics_Contact.prototype.getPrev; + oimo_dynamics_Contact.prototype["getNext"] = oimo_dynamics_Contact.prototype.getNext; + window["OIMO"]["ContactLink"] = oimo_dynamics_ContactLink; + oimo_dynamics_ContactLink.prototype["getContact"] = oimo_dynamics_ContactLink.prototype.getContact; + oimo_dynamics_ContactLink.prototype["getOther"] = oimo_dynamics_ContactLink.prototype.getOther; + oimo_dynamics_ContactLink.prototype["getPrev"] = oimo_dynamics_ContactLink.prototype.getPrev; + oimo_dynamics_ContactLink.prototype["getNext"] = oimo_dynamics_ContactLink.prototype.getNext; + window["OIMO"]["ContactManager"] = oimo_dynamics_ContactManager; + oimo_dynamics_ContactManager.prototype["getNumContacts"] = oimo_dynamics_ContactManager.prototype.getNumContacts; + oimo_dynamics_ContactManager.prototype["getContactList"] = oimo_dynamics_ContactManager.prototype.getContactList; + window["OIMO"]["TimeStep"] = oimo_dynamics_TimeStep; + window["OIMO"]["World"] = oimo_dynamics_World; + oimo_dynamics_World.prototype["step"] = oimo_dynamics_World.prototype.step; + oimo_dynamics_World.prototype["addRigidBody"] = oimo_dynamics_World.prototype.addRigidBody; + oimo_dynamics_World.prototype["removeRigidBody"] = oimo_dynamics_World.prototype.removeRigidBody; + oimo_dynamics_World.prototype["addJoint"] = oimo_dynamics_World.prototype.addJoint; + oimo_dynamics_World.prototype["removeJoint"] = oimo_dynamics_World.prototype.removeJoint; + oimo_dynamics_World.prototype["setDebugDraw"] = oimo_dynamics_World.prototype.setDebugDraw; + oimo_dynamics_World.prototype["getDebugDraw"] = oimo_dynamics_World.prototype.getDebugDraw; + oimo_dynamics_World.prototype["debugDraw"] = oimo_dynamics_World.prototype.debugDraw; + oimo_dynamics_World.prototype["rayCast"] = oimo_dynamics_World.prototype.rayCast; + oimo_dynamics_World.prototype["convexCast"] = oimo_dynamics_World.prototype.convexCast; + oimo_dynamics_World.prototype["aabbTest"] = oimo_dynamics_World.prototype.aabbTest; + oimo_dynamics_World.prototype["getRigidBodyList"] = oimo_dynamics_World.prototype.getRigidBodyList; + oimo_dynamics_World.prototype["getJointList"] = oimo_dynamics_World.prototype.getJointList; + oimo_dynamics_World.prototype["getBroadPhase"] = oimo_dynamics_World.prototype.getBroadPhase; + oimo_dynamics_World.prototype["getContactManager"] = oimo_dynamics_World.prototype.getContactManager; + oimo_dynamics_World.prototype["getNumRigidBodies"] = oimo_dynamics_World.prototype.getNumRigidBodies; + oimo_dynamics_World.prototype["getNumJoints"] = oimo_dynamics_World.prototype.getNumJoints; + oimo_dynamics_World.prototype["getNumShapes"] = oimo_dynamics_World.prototype.getNumShapes; + oimo_dynamics_World.prototype["getNumIslands"] = oimo_dynamics_World.prototype.getNumIslands; + oimo_dynamics_World.prototype["getNumVelocityIterations"] = oimo_dynamics_World.prototype.getNumVelocityIterations; + oimo_dynamics_World.prototype["setNumVelocityIterations"] = oimo_dynamics_World.prototype.setNumVelocityIterations; + oimo_dynamics_World.prototype["getNumPositionIterations"] = oimo_dynamics_World.prototype.getNumPositionIterations; + oimo_dynamics_World.prototype["setNumPositionIterations"] = oimo_dynamics_World.prototype.setNumPositionIterations; + oimo_dynamics_World.prototype["getGravity"] = oimo_dynamics_World.prototype.getGravity; + oimo_dynamics_World.prototype["setGravity"] = oimo_dynamics_World.prototype.setGravity; + window["OIMO"]["AabbTestCallback"] = oimo_dynamics_callback_AabbTestCallback; + window["OIMO"]["ContactCallback"] = oimo_dynamics_callback_ContactCallback; + window["OIMO"]["RayCastCallback"] = oimo_dynamics_callback_RayCastCallback; + window["OIMO"]["RayCastClosest"] = oimo_dynamics_callback_RayCastClosest; + oimo_dynamics_callback_RayCastClosest.prototype["clear"] = oimo_dynamics_callback_RayCastClosest.prototype.clear; + oimo_dynamics_callback_RayCastClosest.prototype["process"] = oimo_dynamics_callback_RayCastClosest.prototype.process; + window["OIMO"]["DebugDrawStyle"] = oimo_dynamics_common_DebugDrawStyle; + window["OIMO"]["Performance"] = oimo_dynamics_common_Performance; + window["OIMO"]["ConstraintSolver"] = oimo_dynamics_constraint_ConstraintSolver; + oimo_dynamics_constraint_ConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_ConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_ConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_ConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolve; + window["OIMO"]["PositionCorrectionAlgorithm"] = oimo_dynamics_constraint_PositionCorrectionAlgorithm; + window["OIMO"]["ContactConstraint"] = oimo_dynamics_constraint_contact_ContactConstraint; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape1"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape1; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape2"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape2; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getManifold"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getManifold; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["isTouching"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.isTouching; + window["OIMO"]["Manifold"] = oimo_dynamics_constraint_contact_Manifold; + oimo_dynamics_constraint_contact_Manifold.prototype["getNormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormal; + oimo_dynamics_constraint_contact_Manifold.prototype["getNormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormalTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getTangent"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangent; + oimo_dynamics_constraint_contact_Manifold.prototype["getTangentTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangentTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getBinormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormal; + oimo_dynamics_constraint_contact_Manifold.prototype["getBinormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormalTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getPoints; + oimo_dynamics_constraint_contact_Manifold.prototype["getNumPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNumPoints; + window["OIMO"]["ManifoldPoint"] = oimo_dynamics_constraint_contact_ManifoldPoint; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1To; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2To; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getDepth"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getDepth; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isWarmStarted"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isWarmStarted; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getNormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getNormalImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getTangentImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getTangentImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getBinormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getBinormalImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isEnabled"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isEnabled; + window["OIMO"]["Joint"] = oimo_dynamics_constraint_joint_Joint; + oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody1"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody1; + oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody2"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody2; + oimo_dynamics_constraint_joint_Joint.prototype["getType"] = oimo_dynamics_constraint_joint_Joint.prototype.getType; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1To; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2To; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1To; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2To; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis1"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis2"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1To; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2To; + oimo_dynamics_constraint_joint_Joint.prototype["getAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.getAllowCollision; + oimo_dynamics_constraint_joint_Joint.prototype["setAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.setAllowCollision; + oimo_dynamics_constraint_joint_Joint.prototype["getBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakForce; + oimo_dynamics_constraint_joint_Joint.prototype["setBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakForce; + oimo_dynamics_constraint_joint_Joint.prototype["getBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakTorque; + oimo_dynamics_constraint_joint_Joint.prototype["setBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakTorque; + oimo_dynamics_constraint_joint_Joint.prototype["getPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.getPositionCorrectionAlgorithm; + oimo_dynamics_constraint_joint_Joint.prototype["setPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.setPositionCorrectionAlgorithm; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForce; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForceTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForceTo; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorque; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorqueTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorqueTo; + oimo_dynamics_constraint_joint_Joint.prototype["getPrev"] = oimo_dynamics_constraint_joint_Joint.prototype.getPrev; + oimo_dynamics_constraint_joint_Joint.prototype["getNext"] = oimo_dynamics_constraint_joint_Joint.prototype.getNext; + window["OIMO"]["CylindricalJoint"] = oimo_dynamics_constraint_joint_CylindricalJoint; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalSpringDamper; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalSpringDamper; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalLimitMotor; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalLimitMotor; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAngle; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslation; + window["OIMO"]["JointConfig"] = oimo_dynamics_constraint_joint_JointConfig; + window["OIMO"]["CylindricalJointConfig"] = oimo_dynamics_constraint_joint_CylindricalJointConfig; + oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype.init; + window["OIMO"]["GenericJoint"] = oimo_dynamics_constraint_joint_GenericJoint; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisX"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisX; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisY"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisY; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisZ"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisZ; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslationalSpringDampers"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslationalSpringDampers; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getRotationalSpringDampers"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getRotationalSpringDampers; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslationalLimitMotors"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslationalLimitMotors; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getRotationalLimitMotors"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getRotationalLimitMotors; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAngles"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAngles; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslations"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslations; + window["OIMO"]["GenericJointConfig"] = oimo_dynamics_constraint_joint_GenericJointConfig; + oimo_dynamics_constraint_joint_GenericJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_GenericJointConfig.prototype.init; + window["OIMO"]["JointLink"] = oimo_dynamics_constraint_joint_JointLink; + oimo_dynamics_constraint_joint_JointLink.prototype["getContact"] = oimo_dynamics_constraint_joint_JointLink.prototype.getContact; + oimo_dynamics_constraint_joint_JointLink.prototype["getOther"] = oimo_dynamics_constraint_joint_JointLink.prototype.getOther; + oimo_dynamics_constraint_joint_JointLink.prototype["getPrev"] = oimo_dynamics_constraint_joint_JointLink.prototype.getPrev; + oimo_dynamics_constraint_joint_JointLink.prototype["getNext"] = oimo_dynamics_constraint_joint_JointLink.prototype.getNext; + window["OIMO"]["JointType"] = oimo_dynamics_constraint_joint_JointType; + window["OIMO"]["PrismaticJoint"] = oimo_dynamics_constraint_joint_PrismaticJoint; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getSpringDamper; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLimitMotor; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getTranslation; + window["OIMO"]["PrismaticJointConfig"] = oimo_dynamics_constraint_joint_PrismaticJointConfig; + oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype.init; + window["OIMO"]["RagdollJoint"] = oimo_dynamics_constraint_joint_RagdollJoint; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistSpringDamper; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistLimitMotor"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistLimitMotor; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingSpringDamper; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxis"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxis; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxisTo"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxisTo; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAngle; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistAngle; + window["OIMO"]["RagdollJointConfig"] = oimo_dynamics_constraint_joint_RagdollJointConfig; + oimo_dynamics_constraint_joint_RagdollJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RagdollJointConfig.prototype.init; + window["OIMO"]["RevoluteJoint"] = oimo_dynamics_constraint_joint_RevoluteJoint; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getSpringDamper; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLimitMotor; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAngle; + window["OIMO"]["RevoluteJointConfig"] = oimo_dynamics_constraint_joint_RevoluteJointConfig; + oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype.init; + window["OIMO"]["RotationalLimitMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setLimits; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setMotor; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.clone; + window["OIMO"]["SphericalJoint"] = oimo_dynamics_constraint_joint_SphericalJoint; + oimo_dynamics_constraint_joint_SphericalJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_SphericalJoint.prototype.getSpringDamper; + window["OIMO"]["SphericalJointConfig"] = oimo_dynamics_constraint_joint_SphericalJointConfig; + oimo_dynamics_constraint_joint_SphericalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_SphericalJointConfig.prototype.init; + window["OIMO"]["SpringDamper"] = oimo_dynamics_constraint_joint_SpringDamper; + oimo_dynamics_constraint_joint_SpringDamper.prototype["setSpring"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSpring; + oimo_dynamics_constraint_joint_SpringDamper.prototype["setSymplecticEuler"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSymplecticEuler; + oimo_dynamics_constraint_joint_SpringDamper.prototype["clone"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.clone; + window["OIMO"]["TranslationalLimitMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setLimits; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setMotor; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.clone; + window["OIMO"]["UniversalJoint"] = oimo_dynamics_constraint_joint_UniversalJoint; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle2; + window["OIMO"]["UniversalJointConfig"] = oimo_dynamics_constraint_joint_UniversalJointConfig; + oimo_dynamics_constraint_joint_UniversalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_UniversalJointConfig.prototype.init; + window["OIMO"]["ConstraintSolverType"] = oimo_dynamics_constraint_solver_ConstraintSolverType; + window["OIMO"]["DirectJointConstraintSolver"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolve; + window["OIMO"]["PgsContactConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.postSolve; + window["OIMO"]["PgsJointConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolve; + window["OIMO"]["MassData"] = oimo_dynamics_rigidbody_MassData; + window["OIMO"]["RigidBody"] = oimo_dynamics_rigidbody_RigidBody; + oimo_dynamics_rigidbody_RigidBody.prototype["getPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPosition; + oimo_dynamics_rigidbody_RigidBody.prototype["getPositionTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPositionTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.setPosition; + oimo_dynamics_rigidbody_RigidBody.prototype["translate"] = oimo_dynamics_rigidbody_RigidBody.prototype.translate; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotation; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotation; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotationXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationXyz; + oimo_dynamics_rigidbody_RigidBody.prototype["rotate"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotate; + oimo_dynamics_rigidbody_RigidBody.prototype["rotateXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotateXyz; + oimo_dynamics_rigidbody_RigidBody.prototype["getOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientation; + oimo_dynamics_rigidbody_RigidBody.prototype["getOrientationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientationTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setOrientation; + oimo_dynamics_rigidbody_RigidBody.prototype["getTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransform; + oimo_dynamics_rigidbody_RigidBody.prototype["getTransformTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransformTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.setTransform; + oimo_dynamics_rigidbody_RigidBody.prototype["getMass"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMass; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertia"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertia; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertiaTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertiaTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassData; + oimo_dynamics_rigidbody_RigidBody.prototype["getMassDataTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassDataTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.setMassData; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationFactor; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationFactor; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocityTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocityTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["addLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["addAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["applyImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyLinearImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyLinearImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyAngularImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyAngularImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyForce"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForce; + oimo_dynamics_rigidbody_RigidBody.prototype["applyForceToCenter"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForceToCenter; + oimo_dynamics_rigidbody_RigidBody.prototype["applyTorque"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyTorque; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearContactImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearContactImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearContactImpulseTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearContactImpulseTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularContactImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularContactImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularContactImpulseTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularContactImpulseTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.getGravityScale; + oimo_dynamics_rigidbody_RigidBody.prototype["setGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.setGravityScale; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPoint; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPointTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVector; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVectorTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPoint; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPointTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVector; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVectorTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumShapes"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumShapes; + oimo_dynamics_rigidbody_RigidBody.prototype["getShapeList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getShapeList; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumContectLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContectLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getContactLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getContactLinkList; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumJointLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumJointLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getJointLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getJointLinkList; + oimo_dynamics_rigidbody_RigidBody.prototype["addShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.addShape; + oimo_dynamics_rigidbody_RigidBody.prototype["removeShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.removeShape; + oimo_dynamics_rigidbody_RigidBody.prototype["getType"] = oimo_dynamics_rigidbody_RigidBody.prototype.getType; + oimo_dynamics_rigidbody_RigidBody.prototype["setType"] = oimo_dynamics_rigidbody_RigidBody.prototype.setType; + oimo_dynamics_rigidbody_RigidBody.prototype["wakeUp"] = oimo_dynamics_rigidbody_RigidBody.prototype.wakeUp; + oimo_dynamics_rigidbody_RigidBody.prototype["sleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.sleep; + oimo_dynamics_rigidbody_RigidBody.prototype["isSleeping"] = oimo_dynamics_rigidbody_RigidBody.prototype.isSleeping; + oimo_dynamics_rigidbody_RigidBody.prototype["getSleepTime"] = oimo_dynamics_rigidbody_RigidBody.prototype.getSleepTime; + oimo_dynamics_rigidbody_RigidBody.prototype["setAutoSleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAutoSleep; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["setLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["setAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["getPrev"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPrev; + oimo_dynamics_rigidbody_RigidBody.prototype["getNext"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNext; + window["OIMO"]["RigidBodyConfig"] = oimo_dynamics_rigidbody_RigidBodyConfig; + window["OIMO"]["RigidBodyType"] = oimo_dynamics_rigidbody_RigidBodyType; + window["OIMO"]["Shape"] = oimo_dynamics_rigidbody_Shape; + oimo_dynamics_rigidbody_Shape.prototype["getFriction"] = oimo_dynamics_rigidbody_Shape.prototype.getFriction; + oimo_dynamics_rigidbody_Shape.prototype["setFriction"] = oimo_dynamics_rigidbody_Shape.prototype.setFriction; + oimo_dynamics_rigidbody_Shape.prototype["getRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.getRestitution; + oimo_dynamics_rigidbody_Shape.prototype["setRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.setRestitution; + oimo_dynamics_rigidbody_Shape.prototype["getLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransform; + oimo_dynamics_rigidbody_Shape.prototype["getLocalTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransformTo; + oimo_dynamics_rigidbody_Shape.prototype["getTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getTransform; + oimo_dynamics_rigidbody_Shape.prototype["getTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getTransformTo; + oimo_dynamics_rigidbody_Shape.prototype["setLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.setLocalTransform; + oimo_dynamics_rigidbody_Shape.prototype["getDensity"] = oimo_dynamics_rigidbody_Shape.prototype.getDensity; + oimo_dynamics_rigidbody_Shape.prototype["setDensity"] = oimo_dynamics_rigidbody_Shape.prototype.setDensity; + oimo_dynamics_rigidbody_Shape.prototype["getAabb"] = oimo_dynamics_rigidbody_Shape.prototype.getAabb; + oimo_dynamics_rigidbody_Shape.prototype["getAabbTo"] = oimo_dynamics_rigidbody_Shape.prototype.getAabbTo; + oimo_dynamics_rigidbody_Shape.prototype["getGeometry"] = oimo_dynamics_rigidbody_Shape.prototype.getGeometry; + oimo_dynamics_rigidbody_Shape.prototype["getRigidBody"] = oimo_dynamics_rigidbody_Shape.prototype.getRigidBody; + oimo_dynamics_rigidbody_Shape.prototype["getCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionGroup; + oimo_dynamics_rigidbody_Shape.prototype["setCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionGroup; + oimo_dynamics_rigidbody_Shape.prototype["getCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionMask; + oimo_dynamics_rigidbody_Shape.prototype["setCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionMask; + oimo_dynamics_rigidbody_Shape.prototype["getContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.getContactCallback; + oimo_dynamics_rigidbody_Shape.prototype["setContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.setContactCallback; + oimo_dynamics_rigidbody_Shape.prototype["getPrev"] = oimo_dynamics_rigidbody_Shape.prototype.getPrev; + oimo_dynamics_rigidbody_Shape.prototype["getNext"] = oimo_dynamics_rigidbody_Shape.prototype.getNext; + window["OIMO"]["ShapeConfig"] = oimo_dynamics_rigidbody_ShapeConfig; + ; +}; var oimo_collision_broadphase_BroadPhase = function(type) { this._type = type; this._numProxies = 0; @@ -76,22 +746,18 @@ oimo_collision_geometry_Geometry.prototype = { return this._volume; } ,rayCast: function(begin,end,transform,hit) { - var beginLocal; var beginLocalX; var beginLocalY; var beginLocalZ; - var endLocal; var endLocalX; var endLocalY; var endLocalZ; - var v = begin; - beginLocalX = v.x; - beginLocalY = v.y; - beginLocalZ = v.z; - var v1 = end; - endLocalX = v1.x; - endLocalY = v1.y; - endLocalZ = v1.z; + beginLocalX = begin.x; + beginLocalY = begin.y; + beginLocalZ = begin.z; + endLocalX = end.x; + endLocalY = end.y; + endLocalZ = end.z; beginLocalX -= transform._positionX; beginLocalY -= transform._positionY; beginLocalZ -= transform._positionZ; @@ -117,22 +783,20 @@ oimo_collision_geometry_Geometry.prototype = { endLocalY = __tmp__Y1; endLocalZ = __tmp__Z1; if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { - var localPos; var localPosX; var localPosY; var localPosZ; - var localNormal; var localNormalX; var localNormalY; var localNormalZ; - var v2 = hit.position; - localPosX = v2.x; - localPosY = v2.y; - localPosZ = v2.z; - var v3 = hit.normal; - localNormalX = v3.x; - localNormalY = v3.y; - localNormalZ = v3.z; + var v = hit.position; + localPosX = v.x; + localPosY = v.y; + localPosZ = v.z; + var v1 = hit.normal; + localNormalX = v1.x; + localNormalY = v1.y; + localNormalZ = v1.z; var __tmp__X2; var __tmp__Y2; var __tmp__Z2; @@ -154,14 +818,14 @@ oimo_collision_geometry_Geometry.prototype = { localPosX += transform._positionX; localPosY += transform._positionY; localPosZ += transform._positionZ; - var v4 = hit.position; - v4.x = localPosX; - v4.y = localPosY; - v4.z = localPosZ; - var v5 = hit.normal; - v5.x = localNormalX; - v5.y = localNormalY; - v5.z = localNormalZ; + var v2 = hit.position; + v2.x = localPosX; + v2.y = localPosY; + v2.z = localPosZ; + var v3 = hit.normal; + v3.x = localNormalX; + v3.y = localNormalY; + v3.z = localNormalZ; return true; } return false; @@ -200,15 +864,12 @@ oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.__super__ = oimo_coll oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ init: function(c,transform,translation) { this.c = c; - var tr; var trX; var trY; var trZ; - var v = translation; - trX = v.x; - trY = v.y; - trZ = v.z; - var localTr; + trX = translation.x; + trY = translation.y; + trZ = translation.z; var localTrX; var localTrY; var localTrZ; @@ -222,10 +883,10 @@ oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(o localTrY = __tmp__Y; localTrZ = __tmp__Z; this.localTranslation = new oimo_common_Vec3(); - var v1 = this.localTranslation; - v1.x = localTrX; - v1.y = localTrY; - v1.z = localTrZ; + var v = this.localTranslation; + v.x = localTrX; + v.y = localTrY; + v.z = localTrZ; this._gjkMargin = c._gjkMargin; } ,computeLocalSupportingVertex: function(dir,out) { @@ -233,12 +894,9 @@ oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(o var v = this.localTranslation; if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { var v1 = this.localTranslation; - var tx = out.x + v1.x; - var ty = out.y + v1.y; - var tz = out.z + v1.z; - out.x = tx; - out.y = ty; - out.z = tz; + out.x += v1.x; + out.y += v1.y; + out.z += v1.z; } } }); @@ -412,43 +1070,18 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi } } ,rayCast: function(begin,end,callback) { - var p1; var p1X; var p1Y; var p1Z; - var p2; var p2X; var p2Y; var p2Z; - var dir; - var dirX; - var dirY; - var dirZ; - var v = begin; - p1X = v.x; - p1Y = v.y; - p1Z = v.z; - var v1 = end; - p2X = v1.x; - p2Y = v1.y; - p2Z = v1.z; - dirX = p2X - p1X; - dirY = p2Y - p1Y; - dirZ = p2Z - p1Z; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; - minX = p1X < p2X ? p1X : p2X; - minY = p1Y < p2Y ? p1Y : p2Y; - minZ = p1Z < p2Z ? p1Z : p2Z; - maxX = p1X > p2X ? p1X : p2X; - maxY = p1Y > p2Y ? p1Y : p2Y; - maxZ = p1Z > p2Z ? p1Z : p2Z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; var p = this._proxyList; while(p != null) { var n = p._next; @@ -458,12 +1091,6 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi var x2 = p2X; var y2 = p2Y; var z2 = p2Z; - var sminx = x1 < x2 ? x1 : x2; - var sminy = y1 < y2 ? y1 : y2; - var sminz = z1 < z2 ? z1 : z2; - var smaxx = x1 > x2 ? x1 : x2; - var smaxy = y1 > y2 ? y1 : y2; - var smaxz = z1 > z2 ? z1 : z2; var pminx = p._aabbMinX; var pminy = p._aabbMinY; var pminz = p._aabbMinZ; @@ -471,7 +1098,7 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi var pmaxy = p._aabbMaxY; var pmaxz = p._aabbMaxZ; var tmp; - if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { var dx = x2 - x1; @@ -483,12 +1110,9 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi var pextx = (pmaxx - pminx) * 0.5; var pexty = (pmaxy - pminy) * 0.5; var pextz = (pmaxz - pminz) * 0.5; - var pcntx = (pmaxx + pminx) * 0.5; - var pcnty = (pmaxy + pminy) * 0.5; - var pcntz = (pmaxz + pminz) * 0.5; - var cpx = x1 - pcntx; - var cpy = y1 - pcnty; - var cpz = z1 - pcntz; + var cpx = x1 - (pmaxx + pminx) * 0.5; + var cpy = y1 - (pmaxy + pminy) * 0.5; + var cpz = z1 - (pmaxz + pminz) * 0.5; var tmp1; var tmp2; var x = cpy * dz - cpz * dy; @@ -547,8 +1171,7 @@ var oimo_collision_broadphase_bvh_BvhBroadPhase = function() { oimo_collision_broadphase_BroadPhase.call(this,2); this._incremental = true; this._tree = new oimo_collision_broadphase_bvh_BvhTree(); - var this1 = new Array(1024); - this.movedProxies = this1; + this.movedProxies = new Array(1024); this.numMovedProxies = 0; }; oimo_collision_broadphase_bvh_BvhBroadPhase.__super__ = oimo_collision_broadphase_BroadPhase; @@ -569,8 +1192,6 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b return; } if(l1 && l2) { - var p1 = n1._proxy; - var p2 = n2._proxy; var first = this._proxyPairPool; if(first != null) { this._proxyPairPool = first._next; @@ -585,8 +1206,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b pp._next = this._proxyPairList; this._proxyPairList = pp; } - pp._p1 = p1; - pp._p2 = p2; + pp._p1 = n1._proxy; + pp._p2 = n2._proxy; return; } if(l2 || n1._height > n2._height) { @@ -598,32 +1219,12 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } ,rayCastRecursive: function(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { - var p1; - var p1X; - var p1Y; - var p1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - p1X = _p1X; - p1Y = _p1Y; - p1Z = _p1Z; - p2X = _p2X; - p2Y = _p2Y; - p2Z = _p2Z; - var x1 = p1X; - var y1 = p1Y; - var z1 = p1Z; - var x2 = p2X; - var y2 = p2Y; - var z2 = p2Z; - var sminx = x1 < x2 ? x1 : x2; - var sminy = y1 < y2 ? y1 : y2; - var sminz = z1 < z2 ? z1 : z2; - var smaxx = x1 > x2 ? x1 : x2; - var smaxy = y1 > y2 ? y1 : y2; - var smaxz = z1 > z2 ? z1 : z2; + var x1 = _p1X; + var y1 = _p1Y; + var z1 = _p1Z; + var x2 = _p2X; + var y2 = _p2Y; + var z2 = _p2Z; var pminx = node._aabbMinX; var pminy = node._aabbMinY; var pminz = node._aabbMinZ; @@ -631,7 +1232,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var pmaxy = node._aabbMaxY; var pmaxz = node._aabbMaxZ; var tmp; - if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { var dx = x2 - x1; @@ -643,12 +1244,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var pextx = (pmaxx - pminx) * 0.5; var pexty = (pmaxy - pminy) * 0.5; var pextz = (pmaxz - pminz) * 0.5; - var pcntx = (pmaxx + pminx) * 0.5; - var pcnty = (pmaxy + pminy) * 0.5; - var pcntz = (pmaxz + pminz) * 0.5; - var cpx = x1 - pcntx; - var cpy = y1 - pcnty; - var cpz = z1 - pcntz; + var cpx = x1 - (pmaxx + pminx) * 0.5; + var cpy = y1 - (pmaxy + pminy) * 0.5; + var cpz = z1 - (pmaxz + pminz) * 0.5; var tmp1; var tmp2; var x = cpy * dz - cpz * dy; @@ -673,8 +1271,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b callback.process(node._proxy); return; } - this.rayCastRecursive(node._children[0],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); - this.rayCastRecursive(node._children[1],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + this.rayCastRecursive(node._children[0],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); + this.rayCastRecursive(node._children[1],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); } ,convexCastRecursive: function(node,convex,begin,translation,callback) { var v = this._aabb.min; @@ -726,19 +1324,12 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; var padding = oimo_common_Setting.bvhProxyPadding; - var paddingVec; - var paddingVecX; - var paddingVecY; - var paddingVecZ; - paddingVecX = padding; - paddingVecY = padding; - paddingVecZ = padding; - p._aabbMinX -= paddingVecX; - p._aabbMinY -= paddingVecY; - p._aabbMinZ -= paddingVecZ; - p._aabbMaxX += paddingVecX; - p._aabbMaxY += paddingVecY; - p._aabbMaxZ += paddingVecZ; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; var _this = this._tree; var first = _this._nodePool; if(first != null) { @@ -804,23 +1395,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b leaf._childIndex = index2; while(node != null) { if(_this._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { + if(node._height < 2) { node = node; } else { var p1 = node._parent; var l = node._children[0]; var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; + var balance = l._height - r._height; var nodeIndex = node._childIndex; if(balance > 1) { var ll = l._children[0]; var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; @@ -891,9 +1477,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } else if(balance < -1) { var rl = r._children[0]; var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; @@ -983,13 +1567,11 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newLength = this.numMovedProxies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.numMovedProxies; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.numMovedProxies << 1); + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1076,23 +1658,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { + if(node._height < 2) { node = node; } else { var p = node._parent; var l = node._children[0]; var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; + var balance = l._height - r._height; var nodeIndex = node._childIndex; if(balance > 1) { var ll = l._children[0]; var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; @@ -1163,9 +1740,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } else if(balance < -1) { var rl = r._children[0]; var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; @@ -1283,43 +1858,31 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; var padding = oimo_common_Setting.bvhProxyPadding; - var paddingVec; - var paddingVecX; - var paddingVecY; - var paddingVecZ; - paddingVecX = padding; - paddingVecY = padding; - paddingVecZ = padding; - p._aabbMinX -= paddingVecX; - p._aabbMinY -= paddingVecY; - p._aabbMinZ -= paddingVecZ; - p._aabbMaxX += paddingVecX; - p._aabbMaxY += paddingVecY; - p._aabbMaxZ += paddingVecZ; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; if(displacement != null) { - var d; var dX; var dY; var dZ; - var zero; var zeroX; var zeroY; var zeroZ; - var addToMin; var addToMinX; var addToMinY; var addToMinZ; - var addToMax; var addToMaxX; var addToMaxY; var addToMaxZ; zeroX = 0; zeroY = 0; zeroZ = 0; - var v = displacement; - dX = v.x; - dY = v.y; - dZ = v.z; + dX = displacement.x; + dY = displacement.y; + dZ = displacement.z; addToMinX = zeroX < dX ? zeroX : dX; addToMinY = zeroY < dY ? zeroY : dY; addToMinZ = zeroZ < dZ ? zeroZ : dZ; @@ -1336,13 +1899,11 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newLength = this.numMovedProxies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.numMovedProxies; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.numMovedProxies << 1); + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1370,77 +1931,42 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(this._numProxies < 2) { return; } - var topDown = false; - if(topDown) { - while(this.numMovedProxies > 0) this.movedProxies[--this.numMovedProxies] = null; - var _this = this._tree; - if(_this._root != null) { - if(_this._root != null) { - _this.decomposeRecursive(_this._root); - _this._root = null; - } - while(_this.tmp.length < _this._numLeaves) { - var newLength = _this.tmp.length << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this.tmp.length; - while(_g1 < _g) { - var i = _g1++; - newArray[i] = _this.tmp[i]; - _this.tmp[i] = null; - } - _this.tmp = newArray; - } - var idx = 0; - var leaf = _this.leafList; - while(leaf != null) { - var n = leaf._nextLeaf; - _this.tmp[idx] = leaf; - ++idx; - leaf = n; - } - _this._root = _this.buildTopDownRecursive(_this.tmp,0,_this._numLeaves); - } - this.collide(this._tree._root,this._tree._root); - return; - } var incrementalCollision = this.numMovedProxies / this._numProxies < oimo_common_Setting.bvhIncrementalCollisionThreshold; - var _g11 = 0; - var _g2 = this.numMovedProxies; - while(_g11 < _g2) { - var i1 = _g11++; - var p1 = this.movedProxies[i1]; + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + var p1 = this.movedProxies[i]; if(p1._moved) { - var _this1 = this._tree; - var leaf1 = p1._leaf; - _this1._numLeaves--; - var prev = leaf1._prevLeaf; - var next = leaf1._nextLeaf; + var _this = this._tree; + var leaf = p1._leaf; + _this._numLeaves--; + var prev = leaf._prevLeaf; + var next = leaf._nextLeaf; if(prev != null) { prev._nextLeaf = next; } if(next != null) { next._prevLeaf = prev; } - if(leaf1 == _this1.leafList) { - _this1.leafList = _this1.leafList._nextLeaf; + if(leaf == _this.leafList) { + _this.leafList = _this.leafList._nextLeaf; } - if(leaf1 == _this1.leafListLast) { - _this1.leafListLast = _this1.leafListLast._prevLeaf; + if(leaf == _this.leafListLast) { + _this.leafListLast = _this.leafListLast._prevLeaf; } - leaf1._nextLeaf = null; - leaf1._prevLeaf = null; - if(_this1._root == leaf1) { - _this1._root = null; + leaf._nextLeaf = null; + leaf._prevLeaf = null; + if(_this._root == leaf) { + _this._root = null; } else { - var parent = leaf1._parent; - var sibling = parent._children[leaf1._childIndex ^ 1]; + var parent = leaf._parent; + var sibling = parent._children[leaf._childIndex ^ 1]; var grandParent = parent._parent; if(grandParent == null) { sibling._parent = null; sibling._childIndex = 0; - _this1._root = sibling; + _this._root = sibling; parent._next = null; parent._childIndex = 0; parent._children[0] = null; @@ -1449,8 +1975,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b parent._parent = null; parent._height = 0; parent._proxy = null; - parent._next = _this1._nodePool; - _this1._nodePool = parent; + parent._next = _this._nodePool; + _this._nodePool = parent; } else { sibling._parent = grandParent; var index = parent._childIndex; @@ -1465,28 +1991,23 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b parent._parent = null; parent._height = 0; parent._proxy = null; - parent._next = _this1._nodePool; - _this1._nodePool = parent; + parent._next = _this._nodePool; + _this._nodePool = parent; var node = grandParent; while(node != null) { - if(_this1._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { + if(_this._strategy._balancingEnabled) { + if(node._height < 2) { node = node; } else { var p2 = node._parent; var l = node._children[0]; var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; + var balance = l._height - r._height; var nodeIndex = node._childIndex; if(balance > 1) { var ll = l._children[0]; var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; @@ -1550,16 +2071,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b l._parent = p2; l._childIndex = nodeIndex; } else { - _this1._root = l; + _this._root = l; l._parent = null; } node = l; } else if(balance < -1) { var rl = r._children[0]; var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; @@ -1623,7 +2142,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b r._parent = p2; r._childIndex = nodeIndex; } else { - _this1._root = r; + _this._root = r; r._parent = null; } node = r; @@ -1648,48 +2167,48 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } p1._leaf = null; - leaf1._next = null; - leaf1._childIndex = 0; - leaf1._children[0] = null; - leaf1._children[1] = null; - leaf1._childIndex = 0; - leaf1._parent = null; - leaf1._height = 0; - leaf1._proxy = null; - leaf1._next = _this1._nodePool; - _this1._nodePool = leaf1; - var _this2 = this._tree; - var first = _this2._nodePool; + leaf._next = null; + leaf._childIndex = 0; + leaf._children[0] = null; + leaf._children[1] = null; + leaf._childIndex = 0; + leaf._parent = null; + leaf._height = 0; + leaf._proxy = null; + leaf._next = _this._nodePool; + _this._nodePool = leaf; + var _this1 = this._tree; + var first = _this1._nodePool; if(first != null) { - _this2._nodePool = first._next; + _this1._nodePool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_bvh_BvhNode(); } - var leaf2 = first; - leaf2._proxy = p1; - p1._leaf = leaf2; - leaf2._aabbMinX = p1._aabbMinX; - leaf2._aabbMinY = p1._aabbMinY; - leaf2._aabbMinZ = p1._aabbMinZ; - leaf2._aabbMaxX = p1._aabbMaxX; - leaf2._aabbMaxY = p1._aabbMaxY; - leaf2._aabbMaxZ = p1._aabbMaxZ; - _this2._numLeaves++; - if(_this2.leafList == null) { - _this2.leafList = leaf2; - _this2.leafListLast = leaf2; + var leaf1 = first; + leaf1._proxy = p1; + p1._leaf = leaf1; + leaf1._aabbMinX = p1._aabbMinX; + leaf1._aabbMinY = p1._aabbMinY; + leaf1._aabbMinZ = p1._aabbMinZ; + leaf1._aabbMaxX = p1._aabbMaxX; + leaf1._aabbMaxY = p1._aabbMaxY; + leaf1._aabbMaxZ = p1._aabbMaxZ; + _this1._numLeaves++; + if(_this1.leafList == null) { + _this1.leafList = leaf1; + _this1.leafListLast = leaf1; } else { - _this2.leafListLast._nextLeaf = leaf2; - leaf2._prevLeaf = _this2.leafListLast; - _this2.leafListLast = leaf2; + _this1.leafListLast._nextLeaf = leaf1; + leaf1._prevLeaf = _this1.leafListLast; + _this1.leafListLast = leaf1; } - if(_this2._root == null) { - _this2._root = leaf2; + if(_this1._root == null) { + _this1._root = leaf1; } else { - var sibling1 = _this2._root; + var sibling1 = _this1._root; while(sibling1._height > 0) { - var nextStep = _this2._strategy._decideInsertion(sibling1,leaf2); + var nextStep = _this1._strategy._decideInsertion(sibling1,leaf1); if(nextStep == -1) { break; } else { @@ -1697,16 +2216,16 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } var parent1 = sibling1._parent; - var first1 = _this2._nodePool; + var first1 = _this1._nodePool; if(first1 != null) { - _this2._nodePool = first1._next; + _this1._nodePool = first1._next; first1._next = null; } else { first1 = new oimo_collision_broadphase_bvh_BvhNode(); } var node1 = first1; if(parent1 == null) { - _this2._root = node1; + _this1._root = node1; } else { var index1 = sibling1._childIndex; parent1._children[index1] = node1; @@ -1718,28 +2237,23 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b sibling1._parent = node1; sibling1._childIndex = index2; var index3 = sibling1._childIndex ^ 1; - node1._children[index3] = leaf2; - leaf2._parent = node1; - leaf2._childIndex = index3; + node1._children[index3] = leaf1; + leaf1._parent = node1; + leaf1._childIndex = index3; while(node1 != null) { - if(_this2._strategy._balancingEnabled) { - var nh1 = node1._height; - if(nh1 < 2) { + if(_this1._strategy._balancingEnabled) { + if(node1._height < 2) { node1 = node1; } else { var p3 = node1._parent; var l1 = node1._children[0]; var r1 = node1._children[1]; - var lh1 = l1._height; - var rh1 = r1._height; - var balance1 = lh1 - rh1; + var balance1 = l1._height - r1._height; var nodeIndex1 = node1._childIndex; if(balance1 > 1) { var ll1 = l1._children[0]; var lr1 = l1._children[1]; - var llh1 = ll1._height; - var lrh1 = lr1._height; - if(llh1 > lrh1) { + if(ll1._height > lr1._height) { l1._children[1] = node1; node1._parent = l1; node1._childIndex = 1; @@ -1803,16 +2317,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b l1._parent = p3; l1._childIndex = nodeIndex1; } else { - _this2._root = l1; + _this1._root = l1; l1._parent = null; } node1 = l1; } else if(balance1 < -1) { var rl1 = r1._children[0]; var rr1 = r1._children[1]; - var rlh1 = rl1._height; - var rrh1 = rr1._height; - if(rlh1 > rrh1) { + if(rl1._height > rr1._height) { r1._children[1] = node1; node1._parent = r1; node1._childIndex = 1; @@ -1876,7 +2388,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b r1._parent = p3; r1._childIndex = nodeIndex1; } else { - _this2._root = r1; + _this1._root = r1; r1._parent = null; } node1 = r1; @@ -1904,7 +2416,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } p1._moved = false; } - this.movedProxies[i1] = null; + this.movedProxies[i] = null; } if(!incrementalCollision) { this.collide(this._tree._root,this._tree._root); @@ -1915,22 +2427,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(this._tree._root == null) { return; } - var p1; var p1X; var p1Y; var p1Z; - var p2; var p2X; var p2Y; var p2Z; - var v = begin; - p1X = v.x; - p1Y = v.y; - p1Z = v.z; - var v1 = end; - p2X = v1.x; - p2Y = v1.y; - p2Z = v1.z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; this.rayCastRecursive(this._tree._root,p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); } ,convexCast: function(convex,begin,translation,callback) { @@ -1954,8 +2462,7 @@ var oimo_collision_broadphase_bvh_BvhNode = function() { this._next = null; this._prevLeaf = null; this._nextLeaf = null; - var this1 = new Array(2); - this._children = this1; + this._children = new Array(2); this._childIndex = 0; this._parent = null; this._height = 0; @@ -1981,10 +2488,8 @@ var oimo_collision_broadphase_bvh_BvhStrategy = function() { }; oimo_collision_broadphase_bvh_BvhStrategy.prototype = { _decideInsertion: function(currentNode,leaf) { - var _g = this._insertionStrategy; - switch(_g) { + switch(this._insertionStrategy) { case 0: - var center; var centerX; var centerY; var centerZ; @@ -1993,11 +2498,9 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { centerZ = leaf._aabbMinZ + leaf._aabbMaxZ; var c1 = currentNode._children[0]; var c2 = currentNode._children[1]; - var diff1; var diff1X; var diff1Y; var diff1Z; - var diff2; var diff2X; var diff2Y; var diff2Z; @@ -2013,9 +2516,7 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { diff2X -= centerX; diff2Y -= centerY; diff2Z -= centerZ; - var dist1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; - var dist2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; - if(dist1 < dist2) { + if(diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z < diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z) { return 0; } else { return 1; @@ -2024,15 +2525,11 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { case 1: var c11 = currentNode._children[0]; var c21 = currentNode._children[1]; - var ex = currentNode._aabbMaxX - currentNode._aabbMinX; var ey = currentNode._aabbMaxY - currentNode._aabbMinY; var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; - var oldArea = (ex * (ey + ez) + ey * ez) * 2; - var combinedMin; var combinedMinX; var combinedMinY; var combinedMinZ; - var combinedMax; var combinedMaxX; var combinedMaxY; var combinedMaxZ; @@ -2042,12 +2539,11 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { combinedMaxX = currentNode._aabbMaxX > leaf._aabbMaxX ? currentNode._aabbMaxX : leaf._aabbMaxX; combinedMaxY = currentNode._aabbMaxY > leaf._aabbMaxY ? currentNode._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = currentNode._aabbMaxZ > leaf._aabbMaxZ ? currentNode._aabbMaxZ : leaf._aabbMaxZ; - var ex1 = combinedMaxX - combinedMinX; var ey1 = combinedMaxY - combinedMinY; var ez1 = combinedMaxZ - combinedMinZ; - var newArea = (ex1 * (ey1 + ez1) + ey1 * ez1) * 2; + var newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; var creatingCost = newArea * 2; - var incrementalCost = (newArea - oldArea) * 2; + var incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; var descendingCost1 = incrementalCost; combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; @@ -2056,18 +2552,15 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; if(c11._height == 0) { - var ex2 = combinedMaxX - combinedMinX; var ey2 = combinedMaxY - combinedMinY; var ez2 = combinedMaxZ - combinedMinZ; - descendingCost1 += (ex2 * (ey2 + ez2) + ey2 * ez2) * 2; + descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey2 + ez2) + ey2 * ez2) * 2; } else { - var ex3 = combinedMaxX - combinedMinX; var ey3 = combinedMaxY - combinedMinY; var ez3 = combinedMaxZ - combinedMinZ; - var ex4 = c11._aabbMaxX - c11._aabbMinX; var ey4 = c11._aabbMaxY - c11._aabbMinY; var ez4 = c11._aabbMaxZ - c11._aabbMinZ; - descendingCost1 += (ex3 * (ey3 + ez3) + ey3 * ez3) * 2 - (ex4 * (ey4 + ez4) + ey4 * ez4) * 2; + descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey3 + ez3) + ey3 * ez3) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey4 + ez4) + ey4 * ez4) * 2); } var descendingCost2 = incrementalCost; combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; @@ -2077,18 +2570,15 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; if(c21._height == 0) { - var ex5 = combinedMaxX - combinedMinX; var ey5 = combinedMaxY - combinedMinY; var ez5 = combinedMaxZ - combinedMinZ; - descendingCost2 += (ex5 * (ey5 + ez5) + ey5 * ez5) * 2; + descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey5 + ez5) + ey5 * ez5) * 2; } else { - var ex6 = combinedMaxX - combinedMinX; var ey6 = combinedMaxY - combinedMinY; var ez6 = combinedMaxZ - combinedMinZ; - var ex7 = c21._aabbMaxX - c21._aabbMinX; var ey7 = c21._aabbMaxY - c21._aabbMinY; var ez7 = c21._aabbMaxZ - c21._aabbMinZ; - descendingCost2 += (ex6 * (ey6 + ez6) + ey6 * ez6) * 2 - (ex7 * (ey7 + ez7) + ey7 * ez7) * 2; + descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey6 + ez6) + ey6 * ez6) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey7 + ez7) + ey7 * ez7) * 2); } if(creatingCost < descendingCost1) { if(creatingCost < descendingCost2) { @@ -2103,24 +2593,21 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } break; default: - console.log("BvhStrategy.hx:37:","invalid BVH insertion strategy: " + this._insertionStrategy); + console.log("src/oimo/collision/broadphase/bvh/BvhStrategy.hx:37:","invalid BVH insertion strategy: " + this._insertionStrategy); return -1; } } ,_splitLeaves: function(leaves,from,until) { var invN = 1.0 / (until - from); - var centerMean; var centerMeanX; var centerMeanY; var centerMeanZ; centerMeanX = 0; centerMeanY = 0; centerMeanZ = 0; - var _g1 = from; - var _g = until; - while(_g1 < _g) { - var i = _g1++; - var leaf = leaves[i]; + var _g = from; + while(_g < until) { + var leaf = leaves[_g++]; leaf._tmpX = leaf._aabbMaxX + leaf._aabbMinX; leaf._tmpY = leaf._aabbMaxY + leaf._aabbMinY; leaf._tmpZ = leaf._aabbMaxZ + leaf._aabbMinZ; @@ -2131,19 +2618,15 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { centerMeanX *= invN; centerMeanY *= invN; centerMeanZ *= invN; - var variance; var varianceX; var varianceY; var varianceZ; varianceX = 0; varianceY = 0; varianceZ = 0; - var _g11 = from; - var _g2 = until; - while(_g11 < _g2) { - var i1 = _g11++; - var leaf1 = leaves[i1]; - var diff; + var _g2 = from; + while(_g2 < until) { + var leaf1 = leaves[_g2++]; var diffX; var diffY; var diffZ; @@ -2166,20 +2649,8 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { if(varX > varZ) { var mean = centerMeanX; while(true) { - while(true) { - var leaf2 = leaves[l]; - if(leaf2._tmpX <= mean) { - break; - } - ++l; - } - while(true) { - var leaf3 = leaves[r]; - if(leaf3._tmpX >= mean) { - break; - } - --r; - } + while(!(leaves[l]._tmpX <= mean)) ++l; + while(!(leaves[r]._tmpX >= mean)) --r; if(l >= r) { break; } @@ -2192,20 +2663,8 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } else { var mean1 = centerMeanZ; while(true) { - while(true) { - var leaf4 = leaves[l]; - if(leaf4._tmpZ <= mean1) { - break; - } - ++l; - } - while(true) { - var leaf5 = leaves[r]; - if(leaf5._tmpZ >= mean1) { - break; - } - --r; - } + while(!(leaves[l]._tmpZ <= mean1)) ++l; + while(!(leaves[r]._tmpZ >= mean1)) --r; if(l >= r) { break; } @@ -2219,20 +2678,8 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } else if(varY > varZ) { var mean2 = centerMeanY; while(true) { - while(true) { - var leaf6 = leaves[l]; - if(leaf6._tmpY <= mean2) { - break; - } - ++l; - } - while(true) { - var leaf7 = leaves[r]; - if(leaf7._tmpY >= mean2) { - break; - } - --r; - } + while(!(leaves[l]._tmpY <= mean2)) ++l; + while(!(leaves[r]._tmpY >= mean2)) --r; if(l >= r) { break; } @@ -2245,20 +2692,8 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } else { var mean3 = centerMeanZ; while(true) { - while(true) { - var leaf8 = leaves[l]; - if(leaf8._tmpZ <= mean3) { - break; - } - ++l; - } - while(true) { - var leaf9 = leaves[r]; - if(leaf9._tmpZ >= mean3) { - break; - } - --r; - } + while(!(leaves[l]._tmpZ <= mean3)) ++l; + while(!(leaves[r]._tmpZ >= mean3)) --r; if(l >= r) { break; } @@ -2279,8 +2714,7 @@ var oimo_collision_broadphase_bvh_BvhTree = function() { this._nodePool = null; this.leafList = null; this.leafListLast = null; - var this1 = new Array(1024); - this.tmp = this1; + this.tmp = new Array(1024); }; oimo_collision_broadphase_bvh_BvhTree.prototype = { _print: function(root,indent) { @@ -2291,46 +2725,40 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { return; } if(root._height == 0) { - console.log("BvhTree.hx:39:",indent + root._proxy._id); + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:39:",indent + root._proxy._id); } else { this._print(root._children[0],indent + " "); var tmp; - var size; var sizeX; var sizeY; var sizeZ; sizeX = root._aabbMaxX - root._aabbMinX; sizeY = root._aabbMaxY - root._aabbMinY; sizeZ = root._aabbMaxZ - root._aabbMinZ; - var x = sizeX; var y = sizeY; var z = sizeZ; - if(x * (y + z) + y * z > 0) { - var size1; + if(sizeX * (y + z) + y * z > 0) { var sizeX1; var sizeY1; var sizeZ1; sizeX1 = root._aabbMaxX - root._aabbMinX; sizeY1 = root._aabbMaxY - root._aabbMinY; sizeZ1 = root._aabbMaxZ - root._aabbMinZ; - var x1 = sizeX1; var y1 = sizeY1; var z1 = sizeZ1; - tmp = ((x1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + tmp = ((sizeX1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; } else { - var size2; var sizeX2; var sizeY2; var sizeZ2; sizeX2 = root._aabbMaxX - root._aabbMinX; sizeY2 = root._aabbMaxY - root._aabbMinY; sizeZ2 = root._aabbMaxZ - root._aabbMinZ; - var x2 = sizeX2; var y2 = sizeY2; var z2 = sizeZ2; - tmp = ((x2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + tmp = ((sizeX2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; } - console.log("BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); this._print(root._children[1],indent + " "); } } @@ -2401,8 +2829,7 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { this._nodePool = root; } ,buildTopDownRecursive: function(leaves,from,until) { - var num = until - from; - if(num == 1) { + if(until - from == 1) { var leaf = leaves[from]; var proxy = leaf._proxy; leaf._aabbMinX = proxy._aabbMinX; @@ -2464,61 +2891,52 @@ var oimo_collision_geometry_Aabb = function() { }; oimo_collision_geometry_Aabb.prototype = { init: function(min,max) { - var v = min; - this._minX = v.x; - this._minY = v.y; - this._minZ = v.z; - var v1 = max; - this._maxX = v1.x; - this._maxY = v1.y; - this._maxZ = v1.z; + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; return this; } ,getMin: function() { var min = new oimo_common_Vec3(); - var v = min; - v.x = this._minX; - v.y = this._minY; - v.z = this._minZ; + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; return min; } ,getMinTo: function(min) { - var v = min; - v.x = this._minX; - v.y = this._minY; - v.z = this._minZ; + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; } ,setMin: function(min) { - var v = min; - this._minX = v.x; - this._minY = v.y; - this._minZ = v.z; + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; return this; } ,getMax: function() { var max = new oimo_common_Vec3(); - var v = max; - v.x = this._maxX; - v.y = this._maxY; - v.z = this._maxZ; + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; return max; } ,getMaxTo: function(max) { - var v = max; - v.x = this._maxX; - v.y = this._maxY; - v.z = this._maxZ; + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; } ,setMax: function(max) { - var v = max; - this._maxX = v.x; - this._maxY = v.y; - this._maxZ = v.z; + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; return this; } ,getCenter: function() { var v = new oimo_common_Vec3(); - var c; var cX; var cY; var cZ; @@ -2528,14 +2946,12 @@ oimo_collision_geometry_Aabb.prototype = { cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v1 = v; - v1.x = cX; - v1.y = cY; - v1.z = cZ; + v.x = cX; + v.y = cY; + v.z = cZ; return v; } ,getCenterTo: function(center) { - var c; var cX; var cY; var cZ; @@ -2545,14 +2961,12 @@ oimo_collision_geometry_Aabb.prototype = { cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v = center; - v.x = cX; - v.y = cY; - v.z = cZ; + center.x = cX; + center.y = cY; + center.z = cZ; } ,getExtents: function() { var v = new oimo_common_Vec3(); - var c; var cX; var cY; var cZ; @@ -2562,14 +2976,12 @@ oimo_collision_geometry_Aabb.prototype = { cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v1 = v; - v1.x = cX; - v1.y = cY; - v1.z = cZ; + v.x = cX; + v.y = cY; + v.z = cZ; return v; } ,getExtentsTo: function(halfExtents) { - var c; var cX; var cY; var cZ; @@ -2579,10 +2991,9 @@ oimo_collision_geometry_Aabb.prototype = { cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v = halfExtents; - v.x = cX; - v.y = cY; - v.z = cZ; + halfExtents.x = cX; + halfExtents.y = cY; + halfExtents.z = cZ; } ,combine: function(other) { this._minX = this._minX < other._minX ? this._minX : other._minX; @@ -2650,10 +3061,9 @@ oimo_collision_geometry_Aabb.prototype = { }; var oimo_collision_geometry_BoxGeometry = function(halfExtents) { oimo_collision_geometry_ConvexGeometry.call(this,1); - var v = halfExtents; - this._halfExtentsX = v.x; - this._halfExtentsY = v.y; - this._halfExtentsZ = v.z; + this._halfExtentsX = halfExtents.x; + this._halfExtentsY = halfExtents.y; + this._halfExtentsZ = halfExtents.z; this._halfAxisXX = halfExtents.x; this._halfAxisXY = 0; this._halfAxisXZ = 0; @@ -2673,21 +3083,18 @@ oimo_collision_geometry_BoxGeometry.__super__ = oimo_collision_geometry_ConvexGe oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ getHalfExtents: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._halfExtentsX; - v1.y = this._halfExtentsY; - v1.z = this._halfExtentsZ; - return v; - } - ,getHalfExtentsTo: function(halfExtents) { - var v = halfExtents; v.x = this._halfExtentsX; v.y = this._halfExtentsY; v.z = this._halfExtentsZ; + return v; + } + ,getHalfExtentsTo: function(halfExtents) { + halfExtents.x = this._halfExtentsX; + halfExtents.y = this._halfExtentsY; + halfExtents.z = this._halfExtentsZ; } ,_updateMass: function() { this._volume = 8 * (this._halfExtentsX * this._halfExtentsY * this._halfExtentsZ); - var sq; var sqX; var sqY; var sqZ; @@ -2705,15 +3112,12 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ this._inertiaCoeff22 = 0.33333333333333331 * (sqX + sqY); } ,_computeAabb: function(aabb,tf) { - var tfx; var tfxX; var tfxY; var tfxZ; - var tfy; var tfyX; var tfyY; var tfyZ; - var tfz; var tfzX; var tfzY; var tfzZ; @@ -2753,7 +3157,6 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ tfzX = tfzX < 0 ? -tfzX : tfzX; tfzY = tfzY < 0 ? -tfzY : tfzY; tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; - var tfs; var tfsX; var tfsY; var tfsZ; @@ -2771,11 +3174,9 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ aabb._maxZ = tf._positionZ + tfsZ; } ,computeLocalSupportingVertex: function(dir,out) { - var gjkMargins; var gjkMarginsX; var gjkMarginsY; var gjkMarginsZ; - var coreExtents; var coreExtentsX; var coreExtentsY; var coreExtentsZ; @@ -2793,18 +3194,12 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ out.z = dir.z > 0 ? coreExtentsZ : -coreExtentsZ; } ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; var halfW = this._halfExtentsX; var halfH = this._halfExtentsY; var halfD = this._halfExtentsZ; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; var tminx = 0; var tminy = 0; var tminz = 0; @@ -2812,13 +3207,13 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ var tmaxy = 1; var tmaxz = 1; if(dx > -1e-6 && dx < 1e-6) { - if(p1x <= -halfW || p1x >= halfW) { + if(beginX <= -halfW || beginX >= halfW) { return false; } } else { var invDx = 1 / dx; - var t1 = (-halfW - p1x) * invDx; - var t2 = (halfW - p1x) * invDx; + var t1 = (-halfW - beginX) * invDx; + var t2 = (halfW - beginX) * invDx; if(t1 > t2) { var tmp = t1; t1 = t2; @@ -2832,13 +3227,13 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ } } if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { var invDy = 1 / dy; - var t11 = (-halfH - p1y) * invDy; - var t21 = (halfH - p1y) * invDy; + var t11 = (-halfH - beginY) * invDy; + var t21 = (halfH - beginY) * invDy; if(t11 > t21) { var tmp1 = t11; t11 = t21; @@ -2852,13 +3247,13 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ } } if(dz > -1e-6 && dz < 1e-6) { - if(p1z <= -halfD || p1z >= halfD) { + if(beginZ <= -halfD || beginZ >= halfD) { return false; } } else { var invDz = 1 / dz; - var t12 = (-halfD - p1z) * invDz; - var t22 = (halfD - p1z) * invDz; + var t12 = (-halfD - beginZ) * invDz; + var t22 = (halfD - beginZ) * invDz; if(t12 > t22) { var tmp2 = t12; t12 = t22; @@ -2908,7 +3303,7 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ hit.normal.init(0,0,dz > 0 ? -1 : 1); break; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -2935,27 +3330,24 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome var sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; this._volume = cylinderVolume + sphereVolume; var invVolume = this._volume == 0 ? 0 : 1 / this._volume; - var inertiaY = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); var inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); this._inertiaCoeff00 = inertiaXZ; this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; this._inertiaCoeff10 = 0; - this._inertiaCoeff11 = inertiaY; + this._inertiaCoeff11 = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; this._inertiaCoeff22 = inertiaXZ; } ,_computeAabb: function(aabb,tf) { - var radVec; var radVecX; var radVecY; var radVecZ; radVecX = this._radius; radVecY = this._radius; radVecZ = this._radius; - var axis; var axisX; var axisY; var axisZ; @@ -2986,26 +3378,18 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome } } ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; + var dx = endX - beginX; + var dz = endZ - beginZ; var tminxz = 0; var tmaxxz = 1; var a = dx * dx + dz * dz; - var b = p1x * dx + p1z * dz; - var c = p1x * p1x + p1z * p1z - this._radius * this._radius; + var b = beginX * dx + beginZ * dz; + var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; var D = b * b - a * c; if(D < 0) { return false; } - var t; if(a > 0) { var sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; @@ -3020,44 +3404,37 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome tminxz = 0; tmaxxz = 1; } - var crossY = p1y + dy * tminxz; + var crossY = beginY + (endY - beginY) * tminxz; var min; if(crossY > -halfH && crossY < halfH) { if(tminxz > 0) { min = tminxz; - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - hit.position.init(p1x + min * dx,crossY,p1z + min * dz); + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + hit.position.init(beginX + min * dx,crossY,beginZ + min * dz); hit.fraction = min; return true; } return false; } - var sphereY = crossY < 0 ? -halfH : halfH; - var spherePos; var spherePosX; var spherePosY; var spherePosZ; - var sphereToBegin; var sphereToBeginX; var sphereToBeginY; var sphereToBeginZ; spherePosX = 0; - spherePosY = sphereY; + spherePosY = crossY < 0 ? -halfH : halfH; spherePosZ = 0; sphereToBeginX = beginX - spherePosX; sphereToBeginY = beginY - spherePosY; sphereToBeginZ = beginZ - spherePosZ; - var d; var dX; var dY; var dZ; @@ -3071,21 +3448,19 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome if(D < 0) { return false; } - var t1 = (-b - Math.sqrt(D)) / a; - if(t1 < 0 || t1 > 1) { + var t = (-b - Math.sqrt(D)) / a; + if(t < 0 || t > 1) { return false; } - var hitPos; var hitPosX; var hitPosY; var hitPosZ; - var hitNormal; var hitNormalX; var hitNormalY; var hitNormalZ; - hitPosX = sphereToBeginX + dX * t1; - hitPosY = sphereToBeginY + dY * t1; - hitPosZ = sphereToBeginZ + dZ * t1; + hitPosX = sphereToBeginX + dX * t; + hitPosY = sphereToBeginY + dY * t; + hitPosZ = sphereToBeginZ + dZ * t; var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; if(l > 0) { l = 1 / Math.sqrt(l); @@ -3104,7 +3479,7 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome v1.x = hitNormalX; v1.y = hitNormalY; v1.z = hitNormalZ; - hit.fraction = t1; + hit.fraction = t; return true; } }); @@ -3136,22 +3511,18 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; - this._inertiaCoeff22 = 0.083333333333333329 * (3 * r2 + 2 * h2); + this._inertiaCoeff22 = 0.05 * (3 * r2 + 2 * h2); } ,_computeAabb: function(aabb,tf) { - var axis; var axisX; var axisY; var axisZ; - var axis2; var axis2X; var axis2Y; var axis2Z; - var eh; var ehX; var ehY; var ehZ; - var er; var erX; var erY; var erZ; @@ -3161,23 +3532,18 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; - var axis2x = axis2X; - var axis2y = axis2Y; - var axis2z = axis2Z; - erX = Math.sqrt(1 - axis2x); - erY = Math.sqrt(1 - axis2y); - erZ = Math.sqrt(1 - axis2z); + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); erX *= this._radius; erY *= this._radius; erZ *= this._radius; ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var rmin; var rminX; var rminY; var rminZ; - var rmax; var rmaxX; var rmaxY; var rmaxZ; @@ -3193,11 +3559,9 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry rmaxX += erX; rmaxY += erY; rmaxZ += erZ; - var max; var maxX; var maxY; var maxZ; - var min; var minX; var minY; var minZ; @@ -3249,26 +3613,21 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry out.z = rz * invLen; } ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; var tminy = 0; var tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { var invDy = 1 / dy; - var t1 = (-halfH - p1y) * invDy; - var t2 = (halfH - p1y) * invDy; + var t1 = (-halfH - beginY) * invDy; + var t2 = (halfH - beginY) * invDy; if(t1 > t2) { var tmp = t1; t1 = t2; @@ -3286,11 +3645,11 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry } var tminxz = 0; var tmaxxz = 0; - p1y -= halfH; + p1y = beginY - halfH; var cos2 = this.cosTheta * this.cosTheta; var a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; - var b = cos2 * (p1x * dx + p1y * dy + p1z * dz) - p1y * dy; - var c = cos2 * (p1x * p1x + p1y * p1y + p1z * p1z) - p1y * p1y; + var b = cos2 * (beginX * dx + p1y * dy + beginZ * dz) - p1y * dy; + var c = cos2 * (beginX * beginX + p1y * p1y + beginZ * beginZ) - p1y * p1y; var D = b * b - a * c; if(a != 0) { if(D < 0) { @@ -3350,28 +3709,21 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry if(min == 0) { return false; } - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - var _this1 = _this; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; var s = this.cosTheta; - var tx1 = _this1.x * s; - var ty1 = _this1.y * s; - var tz1 = _this1.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; + _this.x *= s; + _this.y *= s; + _this.z *= s; hit.normal.y += this.sinTheta; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,p1y + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -3379,16 +3731,12 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry var oimo_collision_geometry_ConvexHullGeometry = function(vertices) { oimo_collision_geometry_ConvexGeometry.call(this,5); this._numVertices = vertices.length; - var length = this._numVertices; - var this1 = new Array(length); - this._vertices = this1; - var length1 = this._numVertices; - var this2 = new Array(length1); - this._tmpVertices = this2; - var _g1 = 0; - var _g = this._numVertices; - while(_g1 < _g) { - var i = _g1++; + this._vertices = new Array(this._numVertices); + this._tmpVertices = new Array(this._numVertices); + var _g = 0; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; this._vertices[i] = vertices[i]; this._tmpVertices[i] = new oimo_common_Vec3(); } @@ -3417,10 +3765,10 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge var maxx = this._vertices[0].x; var maxy = this._vertices[0].y; var maxz = this._vertices[0].z; - var _g1 = 1; - var _g = this._numVertices; - while(_g1 < _g) { - var i = _g1++; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; var vx = this._vertices[i].x; var vy = this._vertices[i].y; var vz = this._vertices[i].z; @@ -3459,22 +3807,18 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge this._inertiaCoeff22 = 0.33333333333333331 * (sizex + sizey) + diffCog; } ,_computeAabb: function(aabb,tf) { - var min; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; - var margin; var marginX; var marginY; var marginZ; marginX = this._gjkMargin; marginY = this._gjkMargin; marginZ = this._gjkMargin; - var localV; var localVX; var localVY; var localVZ; @@ -3482,7 +3826,6 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge localVX = v.x; localVY = v.y; localVZ = v.z; - var worldV; var worldVX; var worldVY; var worldVZ; @@ -3504,11 +3847,10 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge maxX = worldVX; maxY = worldVY; maxZ = worldVZ; - var _g1 = 1; - var _g = this._numVertices; - while(_g1 < _g) { - var i = _g1++; - var v1 = this._vertices[i]; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var v1 = this._vertices[_g++]; localVX = v1.x; localVY = v1.y; localVZ = v1.z; @@ -3542,10 +3884,10 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge var _this = this._vertices[0]; var maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; var maxIndex = 0; - var _g1 = 1; - var _g = this._numVertices; - while(_g1 < _g) { - var i = _g1++; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; var _this1 = this._vertices[i]; var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; if(dot > maxDot) { @@ -3588,19 +3930,15 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom this._inertiaCoeff22 = 0.083333333333333329 * (3 * r2 + h2); } ,_computeAabb: function(aabb,tf) { - var axis; var axisX; var axisY; var axisZ; - var axis2; var axis2X; var axis2Y; var axis2Z; - var eh; var ehX; var ehY; var ehZ; - var er; var erX; var erY; var erZ; @@ -3613,19 +3951,15 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; - var axis2x = axis2X; - var axis2y = axis2Y; - var axis2z = axis2Z; - erX = Math.sqrt(1 - axis2x); - erY = Math.sqrt(1 - axis2y); - erZ = Math.sqrt(1 - axis2z); + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); erX *= this._radius; erY *= this._radius; erZ *= this._radius; ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var max; var maxX; var maxY; var maxZ; @@ -3657,26 +3991,20 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom out.z = rz * invLen; } ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; var tminy = 0; var tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { var invDy = 1 / dy; - var t1 = (-halfH - p1y) * invDy; - var t2 = (halfH - p1y) * invDy; + var t1 = (-halfH - beginY) * invDy; + var t2 = (halfH - beginY) * invDy; if(t1 > t2) { var tmp = t1; t1 = t2; @@ -3695,13 +4023,12 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom var tminxz = 0; var tmaxxz = 1; var a = dx * dx + dz * dz; - var b = p1x * dx + p1z * dz; - var c = p1x * p1x + p1z * p1z - this._radius * this._radius; + var b = beginX * dx + beginZ * dz; + var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; var D = b * b - a * c; if(D < 0) { return false; } - var t; if(a > 0) { var sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; @@ -3731,19 +4058,16 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom if(min == 0) { return false; } - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -3778,7 +4102,6 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet this._inertiaCoeff22 = 0.4 * this._radius * this._radius; } ,_computeAabb: function(aabb,tf) { - var radVec; var radVecX; var radVecY; var radVecZ; @@ -3796,7 +4119,6 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet out.zero(); } ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var d; var dX; var dY; var dZ; @@ -3805,8 +4127,7 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet dZ = endZ - beginZ; var a = dX * dX + dY * dY + dZ * dZ; var b = beginX * dX + beginY * dY + beginZ * dZ; - var c = beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius; - var D = b * b - a * c; + var D = b * b - a * (beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius); if(D < 0) { return false; } @@ -3814,11 +4135,9 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet if(t < 0 || t > 1) { return false; } - var hitPos; var hitPosX; var hitPosY; var hitPosZ; - var hitNormal; var hitNormalX; var hitNormalY; var hitNormalZ; @@ -3845,58 +4164,50 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet } }); var oimo_collision_narrowphase_CollisionMatrix = function() { - var this1 = new Array(8); - this.detectors = this1; - var _g = 0; - while(_g < 6) { - var i = _g++; - var this2 = this.detectors; - var this3 = new Array(8); - this2[i] = this3; - } + this.detectors = new Array(8); + this.detectors[0] = new Array(8); + this.detectors[1] = new Array(8); + this.detectors[2] = new Array(8); + this.detectors[3] = new Array(8); + this.detectors[4] = new Array(8); + this.detectors[5] = new Array(8); var gjkEpaDetector = new oimo_collision_narrowphase_detector_GjkEpaDetector(); - var sp = 0; - var bo = 1; - var cy = 2; - var co = 3; - var ca = 4; - var ch = 5; - this.detectors[sp][sp] = new oimo_collision_narrowphase_detector_SphereSphereDetector(); - this.detectors[sp][bo] = new oimo_collision_narrowphase_detector_SphereBoxDetector(false); - this.detectors[sp][cy] = gjkEpaDetector; - this.detectors[sp][co] = gjkEpaDetector; - this.detectors[sp][ca] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(false); - this.detectors[sp][ch] = gjkEpaDetector; - this.detectors[bo][sp] = new oimo_collision_narrowphase_detector_SphereBoxDetector(true); - this.detectors[bo][bo] = new oimo_collision_narrowphase_detector_BoxBoxDetector(); - this.detectors[bo][cy] = gjkEpaDetector; - this.detectors[bo][co] = gjkEpaDetector; - this.detectors[bo][ca] = gjkEpaDetector; - this.detectors[bo][ch] = gjkEpaDetector; - this.detectors[cy][sp] = gjkEpaDetector; - this.detectors[cy][bo] = gjkEpaDetector; - this.detectors[cy][cy] = gjkEpaDetector; - this.detectors[cy][co] = gjkEpaDetector; - this.detectors[cy][ca] = gjkEpaDetector; - this.detectors[cy][ch] = gjkEpaDetector; - this.detectors[co][sp] = gjkEpaDetector; - this.detectors[co][bo] = gjkEpaDetector; - this.detectors[co][cy] = gjkEpaDetector; - this.detectors[co][co] = gjkEpaDetector; - this.detectors[co][ca] = gjkEpaDetector; - this.detectors[co][ch] = gjkEpaDetector; - this.detectors[ca][sp] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(true); - this.detectors[ca][bo] = gjkEpaDetector; - this.detectors[ca][cy] = gjkEpaDetector; - this.detectors[ca][co] = gjkEpaDetector; - this.detectors[ca][ca] = new oimo_collision_narrowphase_detector_CapsuleCapsuleDetector(); - this.detectors[ca][ch] = gjkEpaDetector; - this.detectors[ch][sp] = gjkEpaDetector; - this.detectors[ch][bo] = gjkEpaDetector; - this.detectors[ch][cy] = gjkEpaDetector; - this.detectors[ch][co] = gjkEpaDetector; - this.detectors[ch][ca] = gjkEpaDetector; - this.detectors[ch][ch] = gjkEpaDetector; + this.detectors[0][0] = new oimo_collision_narrowphase_detector_SphereSphereDetector(); + this.detectors[0][1] = new oimo_collision_narrowphase_detector_SphereBoxDetector(false); + this.detectors[0][2] = gjkEpaDetector; + this.detectors[0][3] = gjkEpaDetector; + this.detectors[0][4] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(false); + this.detectors[0][5] = gjkEpaDetector; + this.detectors[1][0] = new oimo_collision_narrowphase_detector_SphereBoxDetector(true); + this.detectors[1][1] = new oimo_collision_narrowphase_detector_BoxBoxDetector(); + this.detectors[1][2] = gjkEpaDetector; + this.detectors[1][3] = gjkEpaDetector; + this.detectors[1][4] = gjkEpaDetector; + this.detectors[1][5] = gjkEpaDetector; + this.detectors[2][0] = gjkEpaDetector; + this.detectors[2][1] = gjkEpaDetector; + this.detectors[2][2] = gjkEpaDetector; + this.detectors[2][3] = gjkEpaDetector; + this.detectors[2][4] = gjkEpaDetector; + this.detectors[2][5] = gjkEpaDetector; + this.detectors[3][0] = gjkEpaDetector; + this.detectors[3][1] = gjkEpaDetector; + this.detectors[3][2] = gjkEpaDetector; + this.detectors[3][3] = gjkEpaDetector; + this.detectors[3][4] = gjkEpaDetector; + this.detectors[3][5] = gjkEpaDetector; + this.detectors[4][0] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(true); + this.detectors[4][1] = gjkEpaDetector; + this.detectors[4][2] = gjkEpaDetector; + this.detectors[4][3] = gjkEpaDetector; + this.detectors[4][4] = new oimo_collision_narrowphase_detector_CapsuleCapsuleDetector(); + this.detectors[4][5] = gjkEpaDetector; + this.detectors[5][0] = gjkEpaDetector; + this.detectors[5][1] = gjkEpaDetector; + this.detectors[5][2] = gjkEpaDetector; + this.detectors[5][3] = gjkEpaDetector; + this.detectors[5][4] = gjkEpaDetector; + this.detectors[5][5] = gjkEpaDetector; }; oimo_collision_narrowphase_CollisionMatrix.prototype = { getDetector: function(geomType1,geomType2) { @@ -3906,24 +4217,19 @@ oimo_collision_narrowphase_CollisionMatrix.prototype = { var oimo_collision_narrowphase_DetectorResult = function() { this.numPoints = 0; this.normal = new oimo_common_Vec3(); - var length = oimo_common_Setting.maxManifoldPoints; - var this1 = new Array(length); - this.points = this1; + this.points = new Array(oimo_common_Setting.maxManifoldPoints); this.incremental = false; - var _g1 = 0; - var _g = oimo_common_Setting.maxManifoldPoints; - while(_g1 < _g) { - var i = _g1++; - this.points[i] = new oimo_collision_narrowphase_DetectorResultPoint(); - } + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.points[_g++] = new oimo_collision_narrowphase_DetectorResultPoint(); }; oimo_collision_narrowphase_DetectorResult.prototype = { getMaxDepth: function() { var max = 0; - var _g1 = 0; - var _g = this.numPoints; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.numPoints; + while(_g < _g1) { + var i = _g++; if(this.points[i].depth > max) { max = this.points[i].depth; } @@ -3962,12 +4268,9 @@ oimo_collision_narrowphase_detector_Detector.prototype = { v.z = nZ; if(this.swapped) { var _this = result.normal; - var tx = -_this.x; - var ty = -_this.y; - var tz = -_this.z; - _this.x = tx; - _this.y = ty; - _this.z = tz; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; } } ,addPoint: function(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { @@ -4026,15 +4329,12 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll var b1 = geom1; var b2 = geom2; result.incremental = false; - var c1; var c1X; var c1Y; var c1Z; - var c2; var c2X; var c2Y; var c2Z; - var c12; var c12X; var c12Y; var c12Z; @@ -4047,27 +4347,21 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll c12X = c2X - c1X; c12Y = c2Y - c1Y; c12Z = c2Z - c1Z; - var x1; var x1X; var x1Y; var x1Z; - var y1; var y1X; var y1Y; var y1Z; - var z1; var z1X; var z1Y; var z1Z; - var x2; var x2X; var x2Y; var x2Z; - var y2; var y2X; var y2Y; var y2Z; - var z2; var z2X; var z2Y; var z2Z; @@ -4095,27 +4389,21 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll var w2 = b2._halfExtentsX; var h2 = b2._halfExtentsY; var d2 = b2._halfExtentsZ; - var sx1; var sx1X; var sx1Y; var sx1Z; - var sy1; var sy1X; var sy1Y; var sy1Z; - var sz1; var sz1X; var sz1Y; var sz1Z; - var sx2; var sx2X; var sx2Y; var sx2Z; - var sy2; var sy2X; var sy2Y; var sy2Z; - var sz2; var sz2X; var sz2Y; var sz2Z; @@ -4137,12 +4425,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll sz2X = z2X * d2; sz2Y = z2Y * d2; sz2Z = z2Z * d2; - var projSum; - var projC12Abs; - var mDepth = 1.0 / 0.0; + var mDepth = 1e65536; var mId = -1; var mSign = 0; - var mAxis; var mAxisX; var mAxisY; var mAxisZ; @@ -4169,7 +4454,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll var abs = neg ? -projC12 : projC12; if(abs < sum) { var depth = sum - abs; - if(depth < mDepth) { + if(depth < 1e65536) { mDepth = depth; mId = 0; mAxisX = x1X; @@ -4345,7 +4630,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { mDepth = 0; } - var edgeAxis; var edgeAxisX; var edgeAxisY; var edgeAxisZ; @@ -4778,19 +5062,15 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll mAxisZ *= mSign; var id1 = (mId - 6) / 3 | 0; var id2 = mId - 6 - id1 * 3; - var p1; var p1X; var p1Y; var p1Z; - var p2; var p2X; var p2Y; var p2Z; - var d11; var d1X; var d1Y; var d1Z; - var d21; var d2X; var d2Y; var d2Z; @@ -4799,9 +5079,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = x1X; d1Y = x1Y; d1Z = x1Z; - var signX = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; - if(signX) { + if(sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0) { if(signY) { p1X = sy1X + sz1X; p1Y = sy1Y + sz1Y; @@ -4828,9 +5107,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = y1X; d1Y = y1Y; d1Z = y1Z; - var signX1 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; - if(signX1) { + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY1) { p1X = sx1X + sz1X; p1Y = sx1Y + sz1Y; @@ -4857,9 +5135,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = z1X; d1Y = z1Y; d1Z = z1Z; - var signX2 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; - if(signX2) { + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY2) { p1X = sx1X + sy1X; p1Y = sx1Y + sy1Y; @@ -4890,9 +5167,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = x2X; d2Y = x2Y; d2Z = x2Z; - var signX3 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; - if(signX3) { + if(sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0) { if(signY3) { p2X = sy2X + sz2X; p2Y = sy2Y + sz2Y; @@ -4919,9 +5195,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = y2X; d2Y = y2Y; d2Z = y2Z; - var signX4 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; - if(signX4) { + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY4) { p2X = sx2X + sz2X; p2Y = sx2Y + sz2Y; @@ -4948,9 +5223,8 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = z2X; d2Y = z2Y; d2Z = z2Z; - var signX5 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; - if(signX5) { + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY5) { p2X = sx2X + sy2X; p2Y = sx2Y + sy2Y; @@ -4976,7 +5250,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p2X = c2X - p2X; p2Y = c2Y - p2Y; p2Z = c2Z - p2Z; - var r; var rX; var rY; var rZ; @@ -4989,11 +5262,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll var invDet = 1 / (1 - dot12 * dot12); var t1 = (dot12 * dot2r - dot1r) * invDet; var t2 = (dot2r - dot12 * dot1r) * invDet; - var cp1; var cp1X; var cp1Y; var cp1Z; - var cp2; var cp2X; var cp2Y; var cp2Z; @@ -5003,7 +5274,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var normal; var normalX; var normalY; var normalZ; @@ -5014,7 +5284,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll this.addPoint(result,cp1X,cp1Y,cp1Z,cp2X,cp2Y,cp2Z,mDepth,4); return; } - var tmp; var tmpX; var tmpY; var tmpZ; @@ -5024,18 +5293,18 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll c12X = -c12X; c12Y = -c12Y; c12Z = -c12Z; - var tmp1 = b1; + var tmp = b1; b1 = b2; - b2 = tmp1; - var tmp2 = w1; + b2 = tmp; + var tmp1 = w1; w1 = w2; - w2 = tmp2; - var tmp3 = h1; + w2 = tmp1; + var tmp2 = h1; h1 = h2; - h2 = tmp3; - var tmp4 = d1; + h2 = tmp2; + var tmp3 = d1; d1 = d2; - d2 = tmp4; + d2 = tmp3; tmpX = c1X; tmpY = c1Y; tmpZ = c1Z; @@ -5104,19 +5373,15 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { swapped = false; } - var refCenter; var refCenterX; var refCenterY; var refCenterZ; - var refNormal; var refNormalX; var refNormalY; var refNormalZ; - var refX; var refXX; var refXY; var refXZ; - var refY; var refYX; var refYY; var refYZ; @@ -5187,9 +5452,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll refYX = tmpX; refYY = tmpY; refYZ = tmpZ; - var tmp5 = refW; + var tmp4 = refW; refW = refH; - refH = tmp5; + refH = tmp4; } refCenterX += c1X; refCenterY += c1Y; @@ -5223,19 +5488,15 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll minIncDot = -incDot; incId = 5; } - var incV1; var incV1X; var incV1Y; var incV1Z; - var incV2; var incV2X; var incV2Y; var incV2Z; - var incV3; var incV3X; var incV3Y; var incV3Z; - var incV4; var incV4X; var incV4Y; var incV4Z; @@ -5461,7 +5722,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll _this8.wz = incV4Z; this.clipper.clip(); this.clipper.reduce(); - var normal1; var normalX1; var normalY1; var normalZ1; @@ -5475,12 +5735,11 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll normalZ1 = -refNormalZ; } this.setNormal(result,normalX1,normalY1,normalZ1); - var _g1 = 0; - var _g = this.clipper.numVertices; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.clipper.numVertices; + while(_g < _g1) { + var i = _g++; var v = this.clipper.vertices[i]; - var clippedVertex; var clippedVertexX; var clippedVertexY; var clippedVertexZ; @@ -5490,7 +5749,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll clippedVertexX += c1X; clippedVertexY += c1Y; clippedVertexZ += c1Z; - var clippedVertexToRefCenter; var clippedVertexToRefCenterX; var clippedVertexToRefCenterY; var clippedVertexToRefCenterZ; @@ -5498,7 +5756,6 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll clippedVertexToRefCenterY = refCenterY - clippedVertexY; clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; - var clippedVertexOnRefFace; var clippedVertexOnRefFaceX; var clippedVertexOnRefFaceY; var clippedVertexOnRefFaceZ; @@ -5527,23 +5784,31 @@ var oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper = function( this.h = 0; this.numVertices = 0; this.numTmpVertices = 0; - var this1 = new Array(8); - this.vertices = this1; - var this2 = new Array(8); - this.tmpVertices = this2; - var _g = 0; - while(_g < 8) { - var i = _g++; - this.vertices[i] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[i] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - } + this.vertices = new Array(8); + this.tmpVertices = new Array(8); + this.vertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); }; oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { clip: function() { - var _g1 = 0; - var _g = this.numVertices; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; var v1 = this.vertices[i]; var v2 = this.vertices[(i + 1) % this.numVertices]; var s1 = this.w + v1.x; @@ -5584,10 +5849,10 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g11 = 0; - var _g2 = this.numVertices; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + var _g11 = this.numVertices; + while(_g2 < _g11) { + var i1 = _g2++; var v11 = this.vertices[i1]; var v21 = this.vertices[(i1 + 1) % this.numVertices]; var s11 = this.w - v11.x; @@ -5628,10 +5893,10 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { this.tmpVertices = tmp1; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g12 = 0; - var _g3 = this.numVertices; - while(_g12 < _g3) { - var i2 = _g12++; + var _g3 = 0; + var _g12 = this.numVertices; + while(_g3 < _g12) { + var i2 = _g3++; var v12 = this.vertices[i2]; var v22 = this.vertices[(i2 + 1) % this.numVertices]; var s12 = this.h + v12.y; @@ -5672,10 +5937,10 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { this.tmpVertices = tmp2; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g13 = 0; - var _g4 = this.numVertices; - while(_g13 < _g4) { - var i3 = _g13++; + var _g4 = 0; + var _g13 = this.numVertices; + while(_g4 < _g13) { + var i3 = _g4++; var v13 = this.vertices[i3]; var v23 = this.vertices[(i3 + 1) % this.numVertices]; var s13 = this.h - v13.y; @@ -5721,10 +5986,10 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { if(this.numVertices < 4) { return; } - var max1 = -1.0 / 0.0; - var min1 = 1.0 / 0.0; - var max2 = -1.0 / 0.0; - var min2 = 1.0 / 0.0; + var max1 = -1e65536; + var min1 = 1e65536; + var max2 = -1e65536; + var min2 = 1e65536; var max1V = null; var min1V = null; var max2V = null; @@ -5733,11 +5998,10 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { var e1y = 1; var e2x = -1; var e2y = 1; - var _g1 = 0; - var _g = this.numVertices; - while(_g1 < _g) { - var i = _g1++; - var v = this.vertices[i]; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var v = this.vertices[_g++]; var dot1 = v.x * e1x + v.y * e1y; var dot2 = v.x * e2x + v.y * e2y; if(dot1 > max1) { @@ -5807,11 +6071,9 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o var c1 = geom1; var c2 = geom2; result.incremental = false; - var axis1; var axis1X; var axis1Y; var axis1Z; - var axis2; var axis2X; var axis2Y; var axis2Z; @@ -5825,19 +6087,15 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o var hh2 = c2._halfHeight; var r1 = c1._radius; var r2 = c2._radius; - var p1; var p1X; var p1Y; var p1Z; - var q1; var q1X; var q1Y; var q1Z; - var p2; var p2X; var p2Y; var p2Z; - var q2; var q2X; var q2Y; var q2Z; @@ -5853,18 +6111,15 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12; var p12X; var p12Y; var p12Z; p12X = p1X - p2X; p12Y = p1Y - p2Y; p12Z = p1Z - p2Z; - var d1; var d1X; var d1Y; var d1Z; - var d2; var d2X; var d2Y; var d2Z; @@ -5887,22 +6142,22 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o } else if(d11 == 0) { t1 = 0; t2 = p12d2; - if(t2 < 0) { + if(p12d2 < 0) { t2 = 0; - } else if(t2 > d22) { + } else if(p12d2 > d22) { t2 = 1; } else { - t2 /= d22; + t2 = p12d2 / d22; } } else if(d22 == 0) { t2 = 0; t1 = p21d1; - if(t1 < 0) { + if(p21d1 < 0) { t1 = 0; - } else if(t1 > d11) { + } else if(p21d1 > d11) { t1 = 1; } else { - t1 /= d11; + t1 = p21d1 / d11; } } else { var det = d11 * d22 - d12 * d12; @@ -5922,12 +6177,12 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o if(t2 < 0) { t2 = 0; t1 = p21d1; - if(t1 < 0) { + if(p21d1 < 0) { t1 = 0; - } else if(t1 > d11) { + } else if(p21d1 > d11) { t1 = 1; } else { - t1 /= d11; + t1 = p21d1 / d11; } } else if(t2 > d22) { t2 = 1; @@ -5943,11 +6198,9 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o t2 /= d22; } } - var cp1; var cp1X; var cp1Y; var cp1Z; - var cp2; var cp2X; var cp2Y; var cp2Z; @@ -5957,7 +6210,6 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var d; var dX; var dY; var dZ; @@ -5969,7 +6221,6 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o return; } var len = Math.sqrt(len2); - var n; var nX; var nY; var nZ; @@ -5983,11 +6234,9 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; var pos1X; var pos1Y; var pos1Z; - var pos2; var pos2X; var pos2Y; var pos2Z; @@ -6012,19 +6261,15 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll var status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo_common_Setting.enableGJKCaching ? cachedData : null,true); result.incremental = true; if(status != oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED) { - console.log("GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); + console.log("src/oimo/collision/narrowphase/detector/GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); return; } - var margin1 = g1._gjkMargin; - var margin2 = g2._gjkMargin; - if(gjkEpa.distance > margin1 + margin2) { + if(gjkEpa.distance > g1._gjkMargin + g2._gjkMargin) { return; } - var pos1; var pos1X; var pos1Y; var pos1Z; - var pos2; var pos2X; var pos2Y; var pos2Z; @@ -6036,7 +6281,6 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll pos2X = v1.x; pos2Y = v1.y; pos2Z = v1.z; - var normal; var normalX; var normalY; var normalZ; @@ -6074,14 +6318,11 @@ var oimo_collision_narrowphase_detector_SphereBoxDetector = function(swapped) { oimo_collision_narrowphase_detector_SphereBoxDetector.__super__ = oimo_collision_narrowphase_detector_Detector; oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var s = geom1; var b = geom2; result.incremental = false; - var halfExt; var halfExtX; var halfExtY; var halfExtZ; - var negHalfExt; var negHalfExtX; var negHalfExtY; var negHalfExtZ; @@ -6091,15 +6332,13 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c negHalfExtX = -halfExtX; negHalfExtY = -halfExtY; negHalfExtZ = -halfExtZ; - var r = s._radius; - var boxToSphere; + var r = geom1._radius; var boxToSphereX; var boxToSphereY; var boxToSphereZ; boxToSphereX = tf1._positionX - tf2._positionX; boxToSphereY = tf1._positionY - tf2._positionY; boxToSphereZ = tf1._positionZ - tf2._positionZ; - var boxToSphereInBox; var boxToSphereInBoxX; var boxToSphereInBoxY; var boxToSphereInBoxZ; @@ -6112,9 +6351,7 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c boxToSphereInBoxX = __tmp__X; boxToSphereInBoxY = __tmp__Y; boxToSphereInBoxZ = __tmp__Z; - var insideBox = negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ; - if(insideBox) { - var sphereToBoxSurface; + if(negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ) { var sphereToBoxSurfaceX; var sphereToBoxSurfaceY; var sphereToBoxSurfaceZ; @@ -6124,7 +6361,6 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c sphereToBoxSurfaceX = halfExtX - sphereToBoxSurfaceX; sphereToBoxSurfaceY = halfExtY - sphereToBoxSurfaceY; sphereToBoxSurfaceZ = halfExtZ - sphereToBoxSurfaceZ; - var normalInBox; var normalInBoxX; var normalInBoxY; var normalInBoxZ; @@ -6132,7 +6368,6 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c var distY = sphereToBoxSurfaceY; var distZ = sphereToBoxSurfaceZ; var depth; - var projectionMask; var projectionMaskX; var projectionMaskY; var projectionMaskZ; @@ -6195,14 +6430,12 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c projectionMaskZ = 0; depth = distZ; } - var base; var baseX; var baseY; var baseZ; baseX = projectionMaskX * boxToSphereInBoxX; baseY = projectionMaskY * boxToSphereInBoxY; baseZ = projectionMaskZ * boxToSphereInBoxZ; - var boxToClosestPointInBox; var boxToClosestPointInBoxX; var boxToClosestPointInBoxY; var boxToClosestPointInBoxZ; @@ -6212,11 +6445,9 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c boxToClosestPointInBoxX += baseX; boxToClosestPointInBoxY += baseY; boxToClosestPointInBoxZ += baseZ; - var boxToClosestPoint; var boxToClosestPointX; var boxToClosestPointY; var boxToClosestPointZ; - var normal; var normalX; var normalY; var normalZ; @@ -6239,11 +6470,9 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c normalY = __tmp__Y2; normalZ = __tmp__Z2; this.setNormal(result,normalX,normalY,normalZ); - var pos1; var pos1X; var pos1Y; var pos1Z; - var pos2; var pos2X; var pos2Y; var pos2Z; @@ -6256,31 +6485,21 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); return; } - var boxToClosestPointInBox1; var boxToClosestPointInBoxX1; var boxToClosestPointInBoxY1; var boxToClosestPointInBoxZ1; - var eps = 1e-9; - var epsVec; - var epsVecX; - var epsVecY; - var epsVecZ; - epsVecX = eps; - epsVecY = eps; - epsVecZ = eps; - halfExtX -= epsVecX; - halfExtY -= epsVecY; - halfExtZ -= epsVecZ; - negHalfExtX += epsVecX; - negHalfExtY += epsVecY; - negHalfExtZ += epsVecZ; + halfExtX -= 1e-9; + halfExtY -= 1e-9; + halfExtZ -= 1e-9; + negHalfExtX += 1e-9; + negHalfExtY += 1e-9; + negHalfExtZ += 1e-9; boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; - var closestPointToSphereInBox; var closestPointToSphereInBoxX; var closestPointToSphereInBoxY; var closestPointToSphereInBoxZ; @@ -6292,11 +6511,9 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c return; } dist = Math.sqrt(dist); - var boxToClosestPoint1; var boxToClosestPointX1; var boxToClosestPointY1; var boxToClosestPointZ1; - var closestPointToSphere; var closestPointToSphereX; var closestPointToSphereY; var closestPointToSphereZ; @@ -6318,7 +6535,6 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c closestPointToSphereX = __tmp__X4; closestPointToSphereY = __tmp__Y4; closestPointToSphereZ = __tmp__Z4; - var normal1; var normalX1; var normalY1; var normalZ1; @@ -6330,11 +6546,9 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c normalY1 = closestPointToSphereY * l; normalZ1 = closestPointToSphereZ * l; this.setNormal(result,normalX1,normalY1,normalZ1); - var pos11; var pos1X1; var pos1Y1; var pos1Z1; - var pos21; var pos2X1; var pos2Y1; var pos2Z1; @@ -6353,31 +6567,26 @@ var oimo_collision_narrowphase_detector_SphereCapsuleDetector = function(swapped oimo_collision_narrowphase_detector_SphereCapsuleDetector.__super__ = oimo_collision_narrowphase_detector_Detector; oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var s1 = geom1; var c2 = geom2; result.incremental = false; var hh2 = c2._halfHeight; - var r1 = s1._radius; + var r1 = geom1._radius; var r2 = c2._radius; - var axis2; var axis2X; var axis2Y; var axis2Z; axis2X = tf2._rotation01; axis2Y = tf2._rotation11; axis2Z = tf2._rotation21; - var cp1; var cp1X; var cp1Y; var cp1Z; cp1X = tf1._positionX; cp1Y = tf1._positionY; cp1Z = tf1._positionZ; - var p2; var p2X; var p2Y; var p2Z; - var q2; var q2X; var q2Y; var q2Z; @@ -6387,14 +6596,12 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12; var p12X; var p12Y; var p12Z; p12X = cp1X - p2X; p12Y = cp1Y - p2Y; p12Z = cp1Z - p2Z; - var d2; var d2X; var d2Y; var d2Z; @@ -6410,14 +6617,12 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi } else { t /= d22; } - var cp2; var cp2X; var cp2Y; var cp2Z; cp2X = p2X + d2X * t; cp2Y = p2Y + d2Y * t; cp2Z = p2Z + d2Z * t; - var d; var dX; var dY; var dZ; @@ -6429,7 +6634,6 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi return; } var len = Math.sqrt(len2); - var n; var nX; var nY; var nZ; @@ -6443,11 +6647,9 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; var pos1X; var pos1Y; var pos1Z; - var pos2; var pos2X; var pos2Y; var pos2Z; @@ -6466,24 +6668,20 @@ var oimo_collision_narrowphase_detector_SphereSphereDetector = function() { oimo_collision_narrowphase_detector_SphereSphereDetector.__super__ = oimo_collision_narrowphase_detector_Detector; oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var s1 = geom1; - var s2 = geom2; result.incremental = false; - var d; var dX; var dY; var dZ; dX = tf1._positionX - tf2._positionX; dY = tf1._positionY - tf2._positionY; dZ = tf1._positionZ - tf2._positionZ; - var r1 = s1._radius; - var r2 = s2._radius; + var r1 = geom1._radius; + var r2 = geom2._radius; var len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } var len = Math.sqrt(len2); - var n; var nX; var nY; var nZ; @@ -6497,11 +6695,9 @@ oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oim nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; var pos1X; var pos1Y; var pos1Z; - var pos2; var pos2X; var pos2Y; var pos2Z; @@ -6515,9 +6711,7 @@ oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oim } }); var oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron = function() { - var length = oimo_common_Setting.maxEPAVertices; - var this1 = new Array(length); - this._vertices = this1; + this._vertices = new Array(oimo_common_Setting.maxEPAVertices); this._center = new oimo_common_Vec3(); this._numVertices = 0; this._triangleList = null; @@ -6532,22 +6726,37 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { ,validate: function() { var t = this._triangleList; while(t != null) { - var n = t._next; - var _g = 0; - while(_g < 3) { - var i = _g++; - t._vertices[i]._tmpEdgeLoopOuterTriangle = null; - t._vertices[i]._tmpEdgeLoopNext = null; - if(t._adjacentPairIndex[i] == -1) { - this._status = 2; - return false; - } - if(t._adjacentTriangles[i] == null) { - this._status = 3; - return false; - } + t._vertices[0]._tmpEdgeLoopOuterTriangle = null; + t._vertices[0]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[0] == -1) { + this._status = 2; + return false; } - t = n; + if(t._adjacentTriangles[0] == null) { + this._status = 3; + return false; + } + t._vertices[1]._tmpEdgeLoopOuterTriangle = null; + t._vertices[1]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[1] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[1] == null) { + this._status = 3; + return false; + } + t._vertices[2]._tmpEdgeLoopOuterTriangle = null; + t._vertices[2]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[2] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[2] == null) { + this._status = 3; + return false; + } + t = t._next; } return true; } @@ -6560,17 +6769,13 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { _this.x = from.x; _this.y = from.y; _this.z = from.z; - var _this1 = _this; var v = base._vertices[0].v; - var tx = _this1.x - v.x; - var ty = _this1.y - v.y; - var tz = _this1.z - v.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; - var _this2 = base.tmp; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + var _this1 = base.tmp; var v1 = base._normal; - base._tmpDfsVisible = _this2.x * v1.x + _this2.y * v1.y + _this2.z * v1.z > 0; + base._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(!base._tmpDfsVisible) { this._status = 6; return; @@ -6582,42 +6787,48 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { if(t == null) { continue; } - var _this3 = t.tmp; - _this3.x = from.x; - _this3.y = from.y; - _this3.z = from.z; - var _this4 = _this3; + var _this2 = t.tmp; + _this2.x = from.x; + _this2.y = from.y; + _this2.z = from.z; var v2 = t._vertices[0].v; - var tx1 = _this4.x - v2.x; - var ty1 = _this4.y - v2.y; - var tz1 = _this4.z - v2.z; - _this4.x = tx1; - _this4.y = ty1; - _this4.z = tz1; - var _this5 = t.tmp; + _this2.x -= v2.x; + _this2.y -= v2.y; + _this2.z -= v2.z; + var _this3 = t.tmp; var v3 = t._normal; - t._tmpDfsVisible = _this5.x * v3.x + _this5.y * v3.y + _this5.z * v3.z > 0; + t._tmpDfsVisible = _this3.x * v3.x + _this3.y * v3.y + _this3.z * v3.z > 0; if(t._tmpDfsVisible) { this.findEdgeLoop(id,t,from); } else { - var i2 = base._nextIndex[i]; var v11 = base._vertices[i]; - var v21 = base._vertices[i2]; - v11._tmpEdgeLoopNext = v21; + v11._tmpEdgeLoopNext = base._vertices[base._nextIndex[i]]; v11._tmpEdgeLoopOuterTriangle = t; } } - var _g1 = 0; - while(_g1 < 3) { - var i1 = _g1++; - var triangle = base._adjacentTriangles[i1]; - if(triangle != null) { - var pairIndex = base._adjacentPairIndex[i1]; - triangle._adjacentTriangles[pairIndex] = null; - triangle._adjacentPairIndex[pairIndex] = -1; - base._adjacentTriangles[i1] = null; - base._adjacentPairIndex[i1] = -1; - } + var triangle = base._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = base._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + base._adjacentTriangles[0] = null; + base._adjacentPairIndex[0] = -1; + } + var triangle1 = base._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = base._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + base._adjacentTriangles[1] = null; + base._adjacentPairIndex[1] = -1; + } + var triangle2 = base._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = base._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + base._adjacentTriangles[2] = null; + base._adjacentPairIndex[2] = -1; } this._numTriangles--; var prev = base._prev; @@ -6652,37 +6863,21 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = _this; var v5 = v2.v; - var tx = _this1.x + v5.x; - var ty = _this1.y + v5.y; - var tz = _this1.z + v5.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; - var _this2 = _this1; + _this.x += v5.x; + _this.y += v5.y; + _this.z += v5.z; var v6 = v3.v; - var tx1 = _this2.x + v6.x; - var ty1 = _this2.y + v6.y; - var tz1 = _this2.z + v6.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; - var _this3 = _this2; + _this.x += v6.x; + _this.y += v6.y; + _this.z += v6.z; var v7 = v4.v; - var tx2 = _this3.x + v7.x; - var ty2 = _this3.y + v7.y; - var tz2 = _this3.z + v7.z; - _this3.x = tx2; - _this3.y = ty2; - _this3.z = tz2; - var _this4 = _this3; - var tx3 = _this4.x * 0.25; - var ty3 = _this4.y * 0.25; - var tz3 = _this4.z * 0.25; - _this4.x = tx3; - _this4.y = ty3; - _this4.z = tz3; + _this.x += v7.x; + _this.y += v7.y; + _this.z += v7.z; + _this.x *= 0.25; + _this.y *= 0.25; + _this.z *= 0.25; var first = this._trianglePool; if(first != null) { this._trianglePool = first._next; @@ -6791,12 +6986,10 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { return false; } var v = v1; - var firstV = v1; var prevT = null; var firstT = null; while(true) { if(v._tmpEdgeLoopNext == null) { - this._dumpAsObjModel(); this._status = 4; return false; } @@ -6840,7 +7033,7 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { } prevT = t; v = v._tmpEdgeLoopNext; - if(!(v != firstV)) { + if(!(v != v1)) { break; } } @@ -6865,15 +7058,11 @@ var oimo_collision_narrowphase_detector_gjkepa_EpaTriangle = function() { this._distanceSq = 0; this._tmpDfsId = 0; this._tmpDfsVisible = false; - var this1 = new Array(3); - this._vertices = this1; - var this2 = new Array(3); - this._adjacentTriangles = this2; - var this3 = new Array(3); - this._adjacentPairIndex = this3; + this._vertices = new Array(3); + this._adjacentTriangles = new Array(3); + this._adjacentPairIndex = new Array(3); this.tmp = new oimo_common_Vec3(); - var this4 = new Array(3); - this._nextIndex = this4; + this._nextIndex = new Array(3); this._nextIndex[0] = 1; this._nextIndex[1] = 2; this._nextIndex[2] = 0; @@ -6883,19 +7072,15 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { if(autoCheck == null) { autoCheck = false; } - var v1; var v1X; var v1Y; var v1Z; - var v2; var v2X; var v2Y; var v2Z; - var v3; var v3X; var v3Y; var v3Z; - var vc; var vcX; var vcY; var vcZ; @@ -6903,27 +7088,23 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { v1X = v.x; v1Y = v.y; v1Z = v.z; - var v4 = vertex2.v; - v2X = v4.x; - v2Y = v4.y; - v2Z = v4.z; - var v5 = vertex3.v; - v3X = v5.x; - v3Y = v5.y; - v3Z = v5.z; - var v6 = center; - vcX = v6.x; - vcY = v6.y; - vcZ = v6.z; - var v12; + var v1 = vertex2.v; + v2X = v1.x; + v2Y = v1.y; + v2Z = v1.z; + var v2 = vertex3.v; + v3X = v2.x; + v3Y = v2.y; + v3Z = v2.z; + vcX = center.x; + vcY = center.y; + vcZ = center.z; var v12X; var v12Y; var v12Z; - var v13; var v13X; var v13Y; var v13Z; - var vc1; var vc1X; var vc1Y; var vc1Z; @@ -6936,7 +7117,6 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { vc1X = v1X - vcX; vc1Y = v1Y - vcY; vc1Z = v1Z - vcZ; - var inor; var inorX; var inorY; var inorZ; @@ -6944,8 +7124,7 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { inorY = v12Z * v13X - v12X * v13Z; inorZ = v12X * v13Y - v12Y * v13X; var inverted = false; - var d = vc1X * inorX + vc1Y * inorY + vc1Z * inorZ; - if(d < 0) { + if(vc1X * inorX + vc1Y * inorY + vc1Z * inorZ < 0) { if(autoCheck) { var tmp = vertex2; vertex2 = vertex3; @@ -6960,50 +7139,41 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._vertices[0] = vertex1; this._vertices[1] = vertex2; this._vertices[2] = vertex3; - var v7 = this._normal; - v7.x = inorX; - v7.y = inorY; - v7.z = inorZ; + var v3 = this._normal; + v3.x = inorX; + v3.y = inorY; + v3.z = inorZ; var vec1 = vertex1.v; var vec2 = vertex2.v; var vec3 = vertex3.v; var out = this.tmp; - var v11; var v1X1; var v1Y1; var v1Z1; - var v21; var v2X1; var v2Y1; var v2Z1; - var v31; var v3X1; var v3Y1; var v3Z1; - var v121; var v12X1; var v12Y1; var v12Z1; - var v23; var v23X; var v23Y; var v23Z; - var v311; var v31X; var v31Y; var v31Z; - var v8 = vec1; - v1X1 = v8.x; - v1Y1 = v8.y; - v1Z1 = v8.z; - var v9 = vec2; - v2X1 = v9.x; - v2Y1 = v9.y; - v2Z1 = v9.z; - var v10 = vec3; - v3X1 = v10.x; - v3Y1 = v10.y; - v3Z1 = v10.z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X1 = vec3.x; + v3Y1 = vec3.y; + v3Z1 = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -7013,22 +7183,18 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { v31X = v1X1 - v3X1; v31Y = v1Y1 - v3Y1; v31Z = v1Z1 - v3Z1; - var n; var nX; var nY; var nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; var n12X; var n12Y; var n12Z; - var n23; var n23X; var n23Y; var n23Z; - var n31; var n31X; var n31Y; var n31Z; @@ -7041,213 +7207,158 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; var mind = -1; - var minv; var minvX; var minvY; var minvZ; - var mini = 0; minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v14; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { var v1X2; var v1Y2; var v1Z2; - var v22; var v2X2; var v2Y2; var v2Z2; - var v15 = vec1; - v1X2 = v15.x; - v1Y2 = v15.y; - v1Z2 = v15.z; - var v16 = vec2; - v2X2 = v16.x; - v2Y2 = v16.y; - v2Z2 = v16.z; - var v122; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; var v12X2; var v12Y2; var v12Z2; v12X2 = v2X2 - v1X2; v12Y2 = v2Y2 - v1Y2; v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / d1; - var b; + t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); if(t < 0) { - var v17 = out; - v17.x = v1X2; - v17.y = v1Y2; - v17.z = v1Z2; - b = 1; + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; } else if(t > 1) { - var v18 = out; - v18.x = v2X2; - v18.y = v2Y2; - v18.z = v2Z2; - b = 2; + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; } else { - var p; var pX; var pY; var pZ; pX = v1X2 + v12X2 * t; pY = v1Y2 + v12Y2 * t; pZ = v1Z2 + v12Z2 * t; - var v19 = out; - v19.x = pX; - v19.y = pY; - v19.z = pZ; - b = 3; + out.x = pX; + out.y = pY; + out.z = pZ; } - var d2 = out.x * out.x + out.y * out.y + out.z * out.z; - mini = b; - mind = d2; - var v20 = out; - minvX = v20.x; - minvY = v20.y; - minvZ = v20.z; - } - if(d23 < 0) { - var v110; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { var v1X3; var v1Y3; var v1Z3; - var v24; var v2X3; var v2Y3; var v2Z3; - var v25 = vec2; - v1X3 = v25.x; - v1Y3 = v25.y; - v1Z3 = v25.z; - var v26 = vec3; - v2X3 = v26.x; - v2Y3 = v26.y; - v2Z3 = v26.z; - var v123; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; var v12X3; var v12Y3; var v12Z3; v12X3 = v2X3 - v1X3; v12Y3 = v2Y3 - v1Y3; v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / d3; - var b1; + t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); if(t1 < 0) { - var v27 = out; - v27.x = v1X3; - v27.y = v1Y3; - v27.z = v1Z3; - b1 = 1; + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; } else if(t1 > 1) { - var v28 = out; - v28.x = v2X3; - v28.y = v2Y3; - v28.z = v2Z3; - b1 = 2; + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; } else { - var p1; var pX1; var pY1; var pZ1; pX1 = v1X3 + v12X3 * t1; pY1 = v1Y3 + v12Y3 * t1; pZ1 = v1Z3 + v12Z3 * t1; - var v29 = out; - v29.x = pX1; - v29.y = pY1; - v29.z = pZ1; - b1 = 3; + out.x = pX1; + out.y = pY1; + out.z = pZ1; } - var d4 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d4 < mind) { - mini = b1 << 1; - mind = d4; - var v30 = out; - minvX = v30.x; - minvY = v30.y; - minvZ = v30.z; + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } - if(d31 < 0) { - var v111; + if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { var v1X4; var v1Y4; var v1Z4; - var v210; var v2X4; var v2Y4; var v2Z4; - var v32 = vec1; - v1X4 = v32.x; - v1Y4 = v32.y; - v1Z4 = v32.z; - var v33 = vec3; - v2X4 = v33.x; - v2Y4 = v33.y; - v2Z4 = v33.z; - var v124; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; var v12X4; var v12Y4; var v12Z4; v12X4 = v2X4 - v1X4; v12Y4 = v2Y4 - v1Y4; v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / d5; - var b2; + t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); if(t2 < 0) { - var v34 = out; - v34.x = v1X4; - v34.y = v1Y4; - v34.z = v1Z4; - b2 = 1; + out.x = v1X4; + out.y = v1Y4; + out.z = v1Z4; } else if(t2 > 1) { - var v35 = out; - v35.x = v2X4; - v35.y = v2Y4; - v35.z = v2Z4; - b2 = 2; + out.x = v2X4; + out.y = v2Y4; + out.z = v2Z4; } else { - var p2; var pX2; var pY2; var pZ2; pX2 = v1X4 + v12X4 * t2; pY2 = v1Y4 + v12Y4 * t2; pZ2 = v1Z4 + v12Z4 * t2; - var v36 = out; - v36.x = pX2; - v36.y = pY2; - v36.z = pZ2; - b2 = 3; + out.x = pX2; + out.y = pY2; + out.z = pZ2; } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d6 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v37 = out; - minvX = v37.x; - minvY = v37.y; - minvZ = v37.z; + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d1 < mind) { + mind = d1; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v38 = out; - v38.x = minvX; - v38.y = minvY; - v38.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -7256,16 +7367,14 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v39 = out; - v39.x = minvX; - v39.y = minvY; - v39.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; } var _this = this.tmp; this._distanceSq = _this.x * _this.x + _this.y * _this.y + _this.z * _this.z; @@ -7279,22 +7388,68 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { } ,setAdjacentTriangle: function(triangle) { var count = 0; - var _g = 0; - while(_g < 3) { - var i = _g++; - var _g1 = 0; - while(_g1 < 3) { - var j = _g1++; - var i2 = this._nextIndex[i]; - var j2 = this._nextIndex[j]; - if(this._vertices[i] == triangle._vertices[j2] && this._vertices[i2] == triangle._vertices[j]) { - this._adjacentTriangles[i] = triangle; - this._adjacentPairIndex[i] = j; - triangle._adjacentTriangles[j] = this; - triangle._adjacentPairIndex[j] = i; - ++count; - } - } + if(this._vertices[0] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[0]] == triangle._vertices[0]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 0; + count = 1; + } + if(this._vertices[0] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[0]] == triangle._vertices[1]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 0; + ++count; + } + if(this._vertices[0] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[0]] == triangle._vertices[2]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 0; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[1]] == triangle._vertices[0]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 1; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[1]] == triangle._vertices[1]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 1; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[1]] == triangle._vertices[2]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 1; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[2]] == triangle._vertices[0]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 2; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[2]] == triangle._vertices[1]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 2; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[2]] == triangle._vertices[2]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 2; + ++count; } if(count != 1) { return false; @@ -7302,17 +7457,29 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { return true; } ,removeAdjacentTriangles: function() { - var _g = 0; - while(_g < 3) { - var i = _g++; - var triangle = this._adjacentTriangles[i]; - if(triangle != null) { - var pairIndex = this._adjacentPairIndex[i]; - triangle._adjacentTriangles[pairIndex] = null; - triangle._adjacentPairIndex[pairIndex] = -1; - this._adjacentTriangles[i] = null; - this._adjacentPairIndex[i] = -1; - } + var triangle = this._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = this._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + this._adjacentTriangles[0] = null; + this._adjacentPairIndex[0] = -1; + } + var triangle1 = this._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = this._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + this._adjacentTriangles[1] = null; + this._adjacentPairIndex[1] = -1; + } + var triangle2 = this._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = this._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[2] = -1; } } ,removeReferences: function() { @@ -7396,23 +7563,26 @@ oimo_common_Vec3.prototype = { return this; } ,zero: function() { - var tx = 0; - var ty = 0; - var tz = 0; - this.x = tx; - this.y = ty; - this.z = tz; + this.x = 0; + this.y = 0; + this.z = 0; return this; } ,add: function(v) { return new oimo_common_Vec3(this.x + v.x,this.y + v.y,this.z + v.z); } + ,add3: function(vx,vy,vz) { + return new oimo_common_Vec3(this.x + vx,this.y + vy,this.z + vz); + } ,addScaled: function(v,s) { return new oimo_common_Vec3(this.x + v.x * s,this.y + v.y * s,this.z + v.z * s); } ,sub: function(v) { return new oimo_common_Vec3(this.x - v.x,this.y - v.y,this.z - v.z); } + ,sub3: function(vx,vy,vz) { + return new oimo_common_Vec3(this.x - vx,this.y - vy,this.z - vz); + } ,scale: function(s) { return new oimo_common_Vec3(this.x * s,this.y * s,this.z * s); } @@ -7426,57 +7596,53 @@ oimo_common_Vec3.prototype = { return new oimo_common_Vec3(this.y * v.z - this.z * v.y,this.z * v.x - this.x * v.z,this.x * v.y - this.y * v.x); } ,addEq: function(v) { - var tx = this.x + v.x; - var ty = this.y + v.y; - var tz = this.z + v.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x += v.x; + this.y += v.y; + this.z += v.z; + return this; + } + ,add3Eq: function(vx,vy,vz) { + this.x += vx; + this.y += vy; + this.z += vz; return this; } ,addScaledEq: function(v,s) { - var tx = this.x + v.x * s; - var ty = this.y + v.y * s; - var tz = this.z + v.z * s; - this.x = tx; - this.y = ty; - this.z = tz; + this.x += v.x * s; + this.y += v.y * s; + this.z += v.z * s; return this; } ,subEq: function(v) { - var tx = this.x - v.x; - var ty = this.y - v.y; - var tz = this.z - v.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + return this; + } + ,sub3Eq: function(vx,vy,vz) { + this.x -= vx; + this.y -= vy; + this.z -= vz; return this; } ,scaleEq: function(s) { - var tx = this.x * s; - var ty = this.y * s; - var tz = this.z * s; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= s; + this.y *= s; + this.z *= s; return this; } ,scale3Eq: function(sx,sy,sz) { - var tx = this.x * sx; - var ty = this.y * sy; - var tz = this.z * sz; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= sx; + this.y *= sy; + this.z *= sz; return this; } ,crossEq: function(v) { - var tx = this.y * v.z - this.z * v.y; - var ty = this.z * v.x - this.x * v.z; - var tz = this.x * v.y - this.y * v.x; - this.x = tx; - this.y = ty; - this.z = tz; + var y = this.z * v.x - this.x * v.z; + var z = this.x * v.y - this.y * v.x; + this.x = this.y * v.z - this.z * v.y; + this.y = y; + this.z = z; return this; } ,mulMat3: function(m) { @@ -7486,14 +7652,13 @@ oimo_common_Vec3.prototype = { return new oimo_common_Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03,this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13,this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23); } ,mulTransform: function(tf) { - var v; var vX; var vY; var vZ; - var v1 = this; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + var v = this; + vX = v.x; + vY = v.y; + vZ = v.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -7507,39 +7672,35 @@ oimo_common_Vec3.prototype = { vY += tf._positionY; vZ += tf._positionZ; var res = new oimo_common_Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + res.x = vX; + res.y = vY; + res.z = vZ; return res; } ,mulMat3Eq: function(m) { - var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; - var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; - var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; - this.x = tx; - this.y = ty; - this.z = tz; + var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; + var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; + this.y = y; + this.z = z; return this; } ,mulMat4Eq: function(m) { - var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; - var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; - var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; - this.x = tx; - this.y = ty; - this.z = tz; + var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; + var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; + this.y = y; + this.z = z; return this; } ,mulTransformEq: function(tf) { - var v; var vX; var vY; var vZ; - var v1 = this; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + var v = this; + vX = v.x; + vY = v.y; + vZ = v.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -7552,10 +7713,10 @@ oimo_common_Vec3.prototype = { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var v2 = this; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + var v1 = this; + v1.x = vX; + v1.y = vY; + v1.z = vZ; return this; } ,length: function() { @@ -7576,24 +7737,18 @@ oimo_common_Vec3.prototype = { if(invLen > 0) { invLen = 1 / invLen; } - var tx = this.x * invLen; - var ty = this.y * invLen; - var tz = this.z * invLen; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; return this; } ,negate: function() { return new oimo_common_Vec3(-this.x,-this.y,-this.z); } ,negateEq: function() { - var tx = -this.x; - var ty = -this.y; - var tz = -this.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; return this; } ,copyFrom: function(v) { @@ -7641,86 +7796,76 @@ oimo_common_Transform.prototype = { } ,getPosition: function() { var position = new oimo_common_Vec3(); - var v = position; - v.x = this._positionX; - v.y = this._positionY; - v.z = this._positionZ; + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; return position; } ,getPositionTo: function(position) { - var v = position; - v.x = this._positionX; - v.y = this._positionY; - v.z = this._positionZ; + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; } ,setPosition: function(position) { - var v = position; - this._positionX = v.x; - this._positionY = v.y; - this._positionZ = v.z; + this._positionX = position.x; + this._positionY = position.y; + this._positionZ = position.z; return this; } ,translate: function(translation) { - var diff; var diffX; var diffY; var diffZ; - var v = translation; - diffX = v.x; - diffY = v.y; - diffZ = v.z; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; this._positionX += diffX; this._positionY += diffY; this._positionZ += diffZ; } ,getRotation: function() { var rotation = new oimo_common_Mat3(); - var m = rotation; - m.e00 = this._rotation00; - m.e01 = this._rotation01; - m.e02 = this._rotation02; - m.e10 = this._rotation10; - m.e11 = this._rotation11; - m.e12 = this._rotation12; - m.e20 = this._rotation20; - m.e21 = this._rotation21; - m.e22 = this._rotation22; + rotation.e00 = this._rotation00; + rotation.e01 = this._rotation01; + rotation.e02 = this._rotation02; + rotation.e10 = this._rotation10; + rotation.e11 = this._rotation11; + rotation.e12 = this._rotation12; + rotation.e20 = this._rotation20; + rotation.e21 = this._rotation21; + rotation.e22 = this._rotation22; return rotation; } ,getRotationTo: function(out) { - var m = out; - m.e00 = this._rotation00; - m.e01 = this._rotation01; - m.e02 = this._rotation02; - m.e10 = this._rotation10; - m.e11 = this._rotation11; - m.e12 = this._rotation12; - m.e20 = this._rotation20; - m.e21 = this._rotation21; - m.e22 = this._rotation22; + out.e00 = this._rotation00; + out.e01 = this._rotation01; + out.e02 = this._rotation02; + out.e10 = this._rotation10; + out.e11 = this._rotation11; + out.e12 = this._rotation12; + out.e20 = this._rotation20; + out.e21 = this._rotation21; + out.e22 = this._rotation22; } ,setRotation: function(rotation) { - var m = rotation; - this._rotation00 = m.e00; - this._rotation01 = m.e01; - this._rotation02 = m.e02; - this._rotation10 = m.e10; - this._rotation11 = m.e11; - this._rotation12 = m.e12; - this._rotation20 = m.e20; - this._rotation21 = m.e21; - this._rotation22 = m.e22; + this._rotation00 = rotation.e00; + this._rotation01 = rotation.e01; + this._rotation02 = rotation.e02; + this._rotation10 = rotation.e10; + this._rotation11 = rotation.e11; + this._rotation12 = rotation.e12; + this._rotation20 = rotation.e20; + this._rotation21 = rotation.e21; + this._rotation22 = rotation.e22; return this; } ,setRotationXyz: function(eulerAngles) { - var xyz; var xyzX; var xyzY; var xyzZ; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; var sx = Math.sin(xyzX); var sy = Math.sin(xyzY); var sz = Math.sin(xyzZ); @@ -7738,7 +7883,6 @@ oimo_common_Transform.prototype = { this._rotation22 = cx * cy; } ,rotate: function(rotation) { - var rot; var rot00; var rot01; var rot02; @@ -7748,16 +7892,15 @@ oimo_common_Transform.prototype = { var rot20; var rot21; var rot22; - var m = rotation; - rot00 = m.e00; - rot01 = m.e01; - rot02 = m.e02; - rot10 = m.e10; - rot11 = m.e11; - rot12 = m.e12; - rot20 = m.e20; - rot21 = m.e21; - rot22 = m.e22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; var __tmp__00; var __tmp__01; var __tmp__02; @@ -7787,11 +7930,9 @@ oimo_common_Transform.prototype = { this._rotation22 = __tmp__22; } ,rotateXyz: function(eulerAngles) { - var xyz; var xyzX; var xyzY; var xyzZ; - var rot; var rot00; var rot01; var rot02; @@ -7801,10 +7942,9 @@ oimo_common_Transform.prototype = { var rot20; var rot21; var rot22; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; var sx = Math.sin(xyzX); var sy = Math.sin(xyzY); var sz = Math.sin(xyzZ); @@ -7850,7 +7990,6 @@ oimo_common_Transform.prototype = { } ,getOrientation: function() { var q = new oimo_common_Quat(); - var iq; var iqX; var iqY; var iqZ; @@ -7898,15 +8037,13 @@ oimo_common_Transform.prototype = { iqY = (this._rotation12 + this._rotation21) * s; iqW = (this._rotation10 - this._rotation01) * s; } - var q1 = q; - q1.x = iqX; - q1.y = iqY; - q1.z = iqZ; - q1.w = iqW; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; return q; } ,getOrientationTo: function(orientation) { - var iq; var iqX; var iqY; var iqZ; @@ -7954,23 +8091,20 @@ oimo_common_Transform.prototype = { iqY = (this._rotation12 + this._rotation21) * s; iqW = (this._rotation10 - this._rotation01) * s; } - var q = orientation; - q.x = iqX; - q.y = iqY; - q.z = iqZ; - q.w = iqW; + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; } ,setOrientation: function(quaternion) { - var q; var qX; var qY; var qZ; var qW; - var q1 = quaternion; - qX = q1.x; - qY = q1.y; - qZ = q1.z; - qW = q1.w; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; var x = qX; var y = qY; var z = qZ; @@ -8032,14 +8166,10 @@ oimo_common_Transform.prototype = { }; var oimo_common_Setting = function() { }; var oimo_collision_narrowphase_detector_gjkepa_GjkEpa = function() { - var this1 = new Array(4); - this.s = this1; - var this2 = new Array(4); - this.w1 = this2; - var this3 = new Array(4); - this.w2 = this3; - var this4 = new Array(3); - this.baseDirs = this4; + this.s = new Array(4); + this.w1 = new Array(4); + this.w2 = new Array(4); + this.baseDirs = new Array(3); this.baseDirs[0] = new oimo_common_Vec3(1,0,0); this.baseDirs[1] = new oimo_common_Vec3(0,1,0); this.baseDirs[2] = new oimo_common_Vec3(0,0,1); @@ -8048,13 +8178,18 @@ var oimo_collision_narrowphase_detector_gjkepa_GjkEpa = function() { this.rayX = new oimo_common_Vec3(); this.rayR = new oimo_common_Vec3(); this.tempTransform = new oimo_common_Transform(); - var _g = 0; - while(_g < 4) { - var i = _g++; - this.s[i] = new oimo_common_Vec3(); - this.w1[i] = new oimo_common_Vec3(); - this.w2[i] = new oimo_common_Vec3(); - } + this.s[0] = new oimo_common_Vec3(); + this.w1[0] = new oimo_common_Vec3(); + this.w2[0] = new oimo_common_Vec3(); + this.s[1] = new oimo_common_Vec3(); + this.w1[1] = new oimo_common_Vec3(); + this.w2[1] = new oimo_common_Vec3(); + this.s[2] = new oimo_common_Vec3(); + this.w1[2] = new oimo_common_Vec3(); + this.w2[2] = new oimo_common_Vec3(); + this.s[3] = new oimo_common_Vec3(); + this.w1[3] = new oimo_common_Vec3(); + this.w2[3] = new oimo_common_Vec3(); this.dir = new oimo_common_Vec3(); this.closest = new oimo_common_Vec3(); this.closestPoint1 = new oimo_common_Vec3(); @@ -8084,17 +8219,15 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { dir.zero(); } if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z == 0) { - var firstDir; var firstDirX; var firstDirY; var firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; - var v = dir; - v.x = firstDirX; - v.y = firstDirY; - v.z = firstDirZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { dir.init(1,0,0); } @@ -8103,128 +8236,103 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); var _this = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; - _this.x = v1.x; - _this.y = v1.y; - _this.z = v1.z; - var _this1 = _this; - var v2 = this.w2[this.simplexSize]; - var tx = _this1.x - v2.x; - var ty = _this1.y - v2.y; - var tz = _this1.z - v2.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + var v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var v1 = this.w2[this.simplexSize]; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; this.simplexSize = 1; var count = 0; - var max = 40; - var eps = 1e-4; - var eps2 = eps * eps; - while(count < max) { - var v3 = 0; - var _g = this.simplexSize; - switch(_g) { + while(count < 40) { + var v2 = 0; + switch(this.simplexSize) { case 1: - var v4 = s[0]; - closest.x = v4.x; - closest.y = v4.y; - closest.z = v4.z; - v3 = 1; + var v3 = s[0]; + closest.x = v3.x; + closest.y = v3.y; + closest.z = v3.z; + v2 = 1; break; case 2: - var v11; var v1X; var v1Y; var v1Z; - var v21; var v2X; var v2Y; var v2Z; - var v5 = s[0]; - v1X = v5.x; - v1Y = v5.y; - v1Z = v5.z; - var v6 = s[1]; - v2X = v6.x; - v2Y = v6.y; - v2Z = v6.z; - var v12; + var v4 = s[0]; + v1X = v4.x; + v1Y = v4.y; + v1Z = v4.z; + var v5 = s[1]; + v2X = v5.x; + v2Y = v5.y; + v2Z = v5.z; var v12X; var v12Y; var v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v7 = closest; - v7.x = v1X; - v7.y = v1Y; - v7.z = v1Z; - v3 = 1; + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v2 = 1; } else if(t > 1) { - var v8 = closest; - v8.x = v2X; - v8.y = v2Y; - v8.z = v2Z; - v3 = 2; + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v2 = 2; } else { - var p; var pX; var pY; var pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v9 = closest; - v9.x = pX; - v9.y = pY; - v9.z = pZ; - v3 = 3; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v2 = 3; } break; case 3: var vec1 = s[0]; var vec2 = s[1]; var vec3 = s[2]; - var v13; var v1X1; var v1Y1; var v1Z1; - var v22; var v2X1; var v2Y1; var v2Z1; - var v31; var v3X; var v3Y; var v3Z; - var v121; var v12X1; var v12Y1; var v12Z1; - var v23; var v23X; var v23Y; var v23Z; - var v311; var v31X; var v31Y; var v31Z; - var v10 = vec1; - v1X1 = v10.x; - v1Y1 = v10.y; - v1Z1 = v10.z; - var v14 = vec2; - v2X1 = v14.x; - v2Y1 = v14.y; - v2Z1 = v14.z; - var v15 = vec3; - v3X = v15.x; - v3Y = v15.y; - v3Z = v15.z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -8234,22 +8342,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var n; var nX; var nY; var nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; var n12X; var n12Y; var n12Z; - var n23; var n23X; var n23Y; var n23Z; - var n31; var n31X; var n31Y; var n31Z; @@ -8262,11 +8366,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; var mind = -1; - var minv; var minvX; var minvY; var minvZ; @@ -8274,202 +8374,167 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v16; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { var v1X2; var v1Y2; var v1Z2; - var v24; var v2X2; var v2Y2; var v2Z2; - var v17 = vec1; - v1X2 = v17.x; - v1Y2 = v17.y; - v1Z2 = v17.z; - var v18 = vec2; - v2X2 = v18.x; - v2Y2 = v18.y; - v2Z2 = v18.z; - var v122; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; var v12X2; var v12Y2; var v12Z2; v12X2 = v2X2 - v1X2; v12Y2 = v2Y2 - v1Y2; v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d1; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); var b; if(t1 < 0) { - var v19 = closest; - v19.x = v1X2; - v19.y = v1Y2; - v19.z = v1Z2; + closest.x = v1X2; + closest.y = v1Y2; + closest.z = v1Z2; b = 1; } else if(t1 > 1) { - var v20 = closest; - v20.x = v2X2; - v20.y = v2Y2; - v20.z = v2Z2; + closest.x = v2X2; + closest.y = v2Y2; + closest.z = v2Z2; b = 2; } else { - var p1; var pX1; var pY1; var pZ1; pX1 = v1X2 + v12X2 * t1; pY1 = v1Y2 + v12Y2 * t1; pZ1 = v1Z2 + v12Z2 * t1; - var v25 = closest; - v25.x = pX1; - v25.y = pY1; - v25.z = pZ1; + closest.x = pX1; + closest.y = pY1; + closest.z = pZ1; b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini = b; - mind = d2; - var v26 = closest; - minvX = v26.x; - minvY = v26.y; - minvZ = v26.z; - } - if(d23 < 0) { - var v110; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { var v1X3; var v1Y3; var v1Z3; - var v27; var v2X3; var v2Y3; var v2Z3; - var v28 = vec2; - v1X3 = v28.x; - v1Y3 = v28.y; - v1Z3 = v28.z; - var v29 = vec3; - v2X3 = v29.x; - v2Y3 = v29.y; - v2Z3 = v29.z; - var v123; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; var v12X3; var v12Y3; var v12Z3; v12X3 = v2X3 - v1X3; v12Y3 = v2Y3 - v1Y3; v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d3; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); var b1; if(t2 < 0) { - var v30 = closest; - v30.x = v1X3; - v30.y = v1Y3; - v30.z = v1Z3; + closest.x = v1X3; + closest.y = v1Y3; + closest.z = v1Z3; b1 = 1; } else if(t2 > 1) { - var v32 = closest; - v32.x = v2X3; - v32.y = v2Y3; - v32.z = v2Z3; + closest.x = v2X3; + closest.y = v2Y3; + closest.z = v2Z3; b1 = 2; } else { - var p2; var pX2; var pY2; var pZ2; pX2 = v1X3 + v12X3 * t2; pY2 = v1Y3 + v12Y3 * t2; pZ2 = v1Z3 + v12Z3 * t2; - var v33 = closest; - v33.x = pX2; - v33.y = pY2; - v33.z = pZ2; + closest.x = pX2; + closest.y = pY2; + closest.z = pZ2; b1 = 3; } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d4 < mind) { + var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { mini = b1 << 1; - mind = d4; - var v34 = closest; - minvX = v34.x; - minvY = v34.y; - minvZ = v34.z; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d31 < 0) { - var v111; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { var v1X4; var v1Y4; var v1Z4; - var v210; var v2X4; var v2Y4; var v2Z4; - var v35 = vec1; - v1X4 = v35.x; - v1Y4 = v35.y; - v1Z4 = v35.z; - var v36 = vec3; - v2X4 = v36.x; - v2Y4 = v36.y; - v2Z4 = v36.z; - var v124; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; var v12X4; var v12Y4; var v12Z4; v12X4 = v2X4 - v1X4; v12Y4 = v2Y4 - v1Y4; v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / d5; + t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); var b2; if(t3 < 0) { - var v37 = closest; - v37.x = v1X4; - v37.y = v1Y4; - v37.z = v1Z4; + closest.x = v1X4; + closest.y = v1Y4; + closest.z = v1Z4; b2 = 1; } else if(t3 > 1) { - var v38 = closest; - v38.x = v2X4; - v38.y = v2Y4; - v38.z = v2Z4; + closest.x = v2X4; + closest.y = v2Y4; + closest.z = v2Z4; b2 = 2; } else { - var p3; var pX3; var pY3; var pZ3; pX3 = v1X4 + v12X4 * t3; pY3 = v1Y4 + v12Y4 * t3; pZ3 = v1Z4 + v12Z4 * t3; - var v39 = closest; - v39.x = pX3; - v39.y = pY3; - v39.z = pZ3; + closest.x = pX3; + closest.y = pY3; + closest.z = pZ3; b2 = 3; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d6 < mind) { + var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d1 < mind) { mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v40 = closest; - minvX = v40.x; - minvY = v40.y; - minvZ = v40.z; + mind = d1; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } if(mind > 0) { - var v41 = closest; - v41.x = minvX; - v41.y = minvY; - v41.z = minvZ; - v3 = mini; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v2 = mini; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -8478,17 +8543,15 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v42 = closest; - v42.x = minvX; - v42.y = minvY; - v42.z = minvZ; - v3 = 7; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v2 = 7; } break; case 4: @@ -8496,62 +8559,45 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var vec21 = s[1]; var vec31 = s[2]; var vec4 = s[3]; - var v112; var v1X5; var v1Y5; var v1Z5; - var v211; var v2X5; var v2Y5; var v2Z5; - var v310; var v3X1; var v3Y1; var v3Z1; - var v43; var v4X; var v4Y; var v4Z; - var v125; var v12X5; var v12Y5; var v12Z5; - var v131; var v13X; var v13Y; var v13Z; - var v141; var v14X; var v14Y; var v14Z; - var v231; var v23X1; var v23Y1; var v23Z1; - var v241; var v24X; var v24Y; var v24Z; - var v341; - var v34X; - var v34Y; - var v34Z; - var v44 = vec11; - v1X5 = v44.x; - v1Y5 = v44.y; - v1Z5 = v44.z; - var v45 = vec21; - v2X5 = v45.x; - v2Y5 = v45.y; - v2Z5 = v45.z; - var v46 = vec31; - v3X1 = v46.x; - v3Y1 = v46.y; - v3Z1 = v46.z; - var v47 = vec4; - v4X = v47.x; - v4Y = v47.y; - v4Z = v47.z; + v1X5 = vec11.x; + v1Y5 = vec11.y; + v1Z5 = vec11.z; + v2X5 = vec21.x; + v2Y5 = vec21.y; + v2Z5 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; v12X5 = v2X5 - v1X5; v12Y5 = v2Y5 - v1Y5; v12Z5 = v2Z5 - v1Z5; @@ -8567,30 +8613,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v24X = v4X - v2X5; v24Y = v4Y - v2Y5; v24Z = v4Z - v2Z5; - v34X = v4X - v3X1; - v34Y = v4Y - v3Y1; - v34Z = v4Z - v3Z1; - var rev; - var n123; var n123X; var n123Y; var n123Z; - var n134; var n134X; var n134Y; var n134Z; - var n142; var n142X; var n142Y; var n142Z; - var n243; var n243X; var n243Y; var n243Z; - var n1; - var nX1; - var nY1; - var nZ1; n123X = v12Y5 * v13Z - v12Z5 * v13Y; n123Y = v12Z5 * v13X - v12X5 * v13Z; n123Z = v12X5 * v13Y - v12Y5 * v13X; @@ -8604,12 +8638,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; - var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; - var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; - var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; var mind1 = -1; - var minv1; var minvX1; var minvY1; var minvZ1; @@ -8617,43 +8646,34 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d123 * sign < 0) { - var v113; + if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { var v1X6; var v1Y6; var v1Z6; - var v212; var v2X6; var v2Y6; var v2Z6; - var v312; var v3X2; var v3Y2; var v3Z2; - var v126; var v12X6; var v12Y6; var v12Z6; - var v232; var v23X2; var v23Y2; var v23Z2; - var v313; var v31X1; var v31Y1; var v31Z1; - var v48 = vec11; - v1X6 = v48.x; - v1Y6 = v48.y; - v1Z6 = v48.z; - var v49 = vec21; - v2X6 = v49.x; - v2Y6 = v49.y; - v2Z6 = v49.z; - var v50 = vec31; - v3X2 = v50.x; - v3Y2 = v50.y; - v3Z2 = v50.z; + v1X6 = vec11.x; + v1Y6 = vec11.y; + v1Z6 = vec11.z; + v2X6 = vec21.x; + v2Y6 = vec21.y; + v2Z6 = vec21.z; + v3X2 = vec31.x; + v3Y2 = vec31.y; + v3Z2 = vec31.z; v12X6 = v2X6 - v1X6; v12Y6 = v2Y6 - v1Y6; v12Z6 = v2Z6 - v1Z6; @@ -8663,39 +8683,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X1 = v1X6 - v3X2; v31Y1 = v1Y6 - v3Y2; v31Z1 = v1Z6 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n121; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; var n12X1; var n12Y1; var n12Z1; - var n231; var n23X1; var n23Y1; var n23Z1; - var n311; var n31X1; var n31Y1; var n31Z1; - n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; - n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; - n12Z1 = v12X6 * nY2 - v12Y6 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; - var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; + n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; + n12Z1 = v12X6 * nY1 - v12Y6 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; var mind2 = -1; - var minv2; var minvX2; var minvY2; var minvZ2; @@ -8703,268 +8715,220 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX2 = 0; minvY2 = 0; minvZ2 = 0; - if(d121 < 0) { - var v114; + if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { var v1X7; var v1Y7; var v1Z7; - var v213; var v2X7; var v2Y7; var v2Z7; - var v51 = vec11; - v1X7 = v51.x; - v1Y7 = v51.y; - v1Z7 = v51.z; - var v52 = vec21; - v2X7 = v52.x; - v2Y7 = v52.y; - v2Z7 = v52.z; - var v127; + v1X7 = vec11.x; + v1Y7 = vec11.y; + v1Z7 = vec11.z; + v2X7 = vec21.x; + v2Y7 = vec21.y; + v2Z7 = vec21.z; var v12X7; var v12Y7; var v12Z7; v12X7 = v2X7 - v1X7; v12Y7 = v2Y7 - v1Y7; v12Z7 = v2Z7 - v1Z7; - var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d7; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); var b3; if(t4 < 0) { - var v53 = closest; - v53.x = v1X7; - v53.y = v1Y7; - v53.z = v1Z7; + closest.x = v1X7; + closest.y = v1Y7; + closest.z = v1Z7; b3 = 1; } else if(t4 > 1) { - var v54 = closest; - v54.x = v2X7; - v54.y = v2Y7; - v54.z = v2Z7; + closest.x = v2X7; + closest.y = v2Y7; + closest.z = v2Z7; b3 = 2; } else { - var p4; var pX4; var pY4; var pZ4; pX4 = v1X7 + v12X7 * t4; pY4 = v1Y7 + v12Y7 * t4; pZ4 = v1Z7 + v12Z7 * t4; - var v55 = closest; - v55.x = pX4; - v55.y = pY4; - v55.z = pZ4; + closest.x = pX4; + closest.y = pY4; + closest.z = pZ4; b3 = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini2 = b3; - mind2 = d8; - var v56 = closest; - minvX2 = v56.x; - minvY2 = v56.y; - minvZ2 = v56.z; + mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } - if(d231 < 0) { - var v115; + if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { var v1X8; var v1Y8; var v1Z8; - var v214; var v2X8; var v2Y8; var v2Z8; - var v57 = vec21; - v1X8 = v57.x; - v1Y8 = v57.y; - v1Z8 = v57.z; - var v58 = vec31; - v2X8 = v58.x; - v2Y8 = v58.y; - v2Z8 = v58.z; - var v128; + v1X8 = vec21.x; + v1Y8 = vec21.y; + v1Z8 = vec21.z; + v2X8 = vec31.x; + v2Y8 = vec31.y; + v2Z8 = vec31.z; var v12X8; var v12Y8; var v12Z8; v12X8 = v2X8 - v1X8; v12Y8 = v2Y8 - v1Y8; v12Z8 = v2Z8 - v1Z8; - var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d9; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); var b4; if(t5 < 0) { - var v59 = closest; - v59.x = v1X8; - v59.y = v1Y8; - v59.z = v1Z8; + closest.x = v1X8; + closest.y = v1Y8; + closest.z = v1Z8; b4 = 1; } else if(t5 > 1) { - var v60 = closest; - v60.x = v2X8; - v60.y = v2Y8; - v60.z = v2Z8; + closest.x = v2X8; + closest.y = v2Y8; + closest.z = v2Z8; b4 = 2; } else { - var p5; var pX5; var pY5; var pZ5; pX5 = v1X8 + v12X8 * t5; pY5 = v1Y8 + v12Y8 * t5; pZ5 = v1Z8 + v12Z8 * t5; - var v61 = closest; - v61.x = pX5; - v61.y = pY5; - v61.z = pZ5; + closest.x = pX5; + closest.y = pY5; + closest.z = pZ5; b4 = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d10 < mind2) { + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d2 < mind2) { mini2 = b4 << 1; - mind2 = d10; - var v62 = closest; - minvX2 = v62.x; - minvY2 = v62.y; - minvZ2 = v62.z; + mind2 = d2; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } } - if(d311 < 0) { - var v116; + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { var v1X9; var v1Y9; var v1Z9; - var v215; var v2X9; var v2Y9; var v2Z9; - var v63 = vec11; - v1X9 = v63.x; - v1Y9 = v63.y; - v1Z9 = v63.z; - var v64 = vec31; - v2X9 = v64.x; - v2Y9 = v64.y; - v2Z9 = v64.z; - var v129; + v1X9 = vec11.x; + v1Y9 = vec11.y; + v1Z9 = vec11.z; + v2X9 = vec31.x; + v2Y9 = vec31.y; + v2Z9 = vec31.z; var v12X9; var v12Y9; var v12Z9; v12X9 = v2X9 - v1X9; v12Y9 = v2Y9 - v1Y9; v12Z9 = v2Z9 - v1Z9; - var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / d11; + t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); var b5; if(t6 < 0) { - var v65 = closest; - v65.x = v1X9; - v65.y = v1Y9; - v65.z = v1Z9; + closest.x = v1X9; + closest.y = v1Y9; + closest.z = v1Z9; b5 = 1; } else if(t6 > 1) { - var v66 = closest; - v66.x = v2X9; - v66.y = v2Y9; - v66.z = v2Z9; + closest.x = v2X9; + closest.y = v2Y9; + closest.z = v2Z9; b5 = 2; } else { - var p6; var pX6; var pY6; var pZ6; pX6 = v1X9 + v12X9 * t6; pY6 = v1Y9 + v12Y9 * t6; pZ6 = v1Z9 + v12Z9 * t6; - var v67 = closest; - v67.x = pX6; - v67.y = pY6; - v67.z = pZ6; + closest.x = pX6; + closest.y = pY6; + closest.z = pZ6; b5 = 3; } - var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d13 < mind2) { + var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d3 < mind2) { mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d13; - var v68 = closest; - minvX2 = v68.x; - minvY2 = v68.y; - minvZ2 = v68.z; + mind2 = d3; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } } var b6; if(mind2 > 0) { - var v69 = closest; - v69.x = minvX2; - v69.y = minvY2; - v69.z = minvZ2; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; b6 = mini2; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v70 = closest; - v70.x = minvX2; - v70.y = minvY2; - v70.z = minvZ2; + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; b6 = 7; } - var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini1 = b6; - mind1 = d14; - var v71 = closest; - minvX1 = v71.x; - minvY1 = v71.y; - minvZ1 = v71.z; - } - if(d134 * sign < 0) { - var v117; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { var v1X10; var v1Y10; var v1Z10; - var v216; var v2X10; var v2Y10; var v2Z10; - var v314; var v3X3; var v3Y3; var v3Z3; - var v1210; var v12X10; var v12Y10; var v12Z10; - var v233; var v23X3; var v23Y3; var v23Z3; - var v315; var v31X2; var v31Y2; var v31Z2; - var v72 = vec11; - v1X10 = v72.x; - v1Y10 = v72.y; - v1Z10 = v72.z; - var v73 = vec31; - v2X10 = v73.x; - v2Y10 = v73.y; - v2Z10 = v73.z; - var v74 = vec4; - v3X3 = v74.x; - v3Y3 = v74.y; - v3Z3 = v74.z; + v1X10 = vec11.x; + v1Y10 = vec11.y; + v1Z10 = vec11.z; + v2X10 = vec31.x; + v2Y10 = vec31.y; + v2Z10 = vec31.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; v12X10 = v2X10 - v1X10; v12Y10 = v2Y10 - v1Y10; v12Z10 = v2Z10 - v1Z10; @@ -8974,39 +8938,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X2 = v1X10 - v3X3; v31Y2 = v1Y10 - v3Y3; v31Z2 = v1Z10 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n122; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; var n12X2; var n12Y2; var n12Z2; - var n232; var n23X2; var n23Y2; var n23Z2; - var n312; var n31X2; var n31Y2; var n31Z2; - n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; - n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; - n12Z2 = v12X10 * nY3 - v12Y10 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; - var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; + n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; + n12Z2 = v12X10 * nY2 - v12Y10 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; var mind3 = -1; - var minv3; var minvX3; var minvY3; var minvZ3; @@ -9014,270 +8970,223 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX3 = 0; minvY3 = 0; minvZ3 = 0; - if(d122 < 0) { - var v118; + if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { var v1X11; var v1Y11; var v1Z11; - var v217; var v2X11; var v2Y11; var v2Z11; - var v75 = vec11; - v1X11 = v75.x; - v1Y11 = v75.y; - v1Z11 = v75.z; - var v76 = vec31; - v2X11 = v76.x; - v2Y11 = v76.y; - v2Z11 = v76.z; - var v1211; + v1X11 = vec11.x; + v1Y11 = vec11.y; + v1Z11 = vec11.z; + v2X11 = vec31.x; + v2Y11 = vec31.y; + v2Z11 = vec31.z; var v12X11; var v12Y11; var v12Z11; v12X11 = v2X11 - v1X11; v12Y11 = v2Y11 - v1Y11; v12Z11 = v2Z11 - v1Z11; - var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d15; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); var b7; if(t7 < 0) { - var v77 = closest; - v77.x = v1X11; - v77.y = v1Y11; - v77.z = v1Z11; + closest.x = v1X11; + closest.y = v1Y11; + closest.z = v1Z11; b7 = 1; } else if(t7 > 1) { - var v78 = closest; - v78.x = v2X11; - v78.y = v2Y11; - v78.z = v2Z11; + closest.x = v2X11; + closest.y = v2Y11; + closest.z = v2Z11; b7 = 2; } else { - var p7; var pX7; var pY7; var pZ7; pX7 = v1X11 + v12X11 * t7; pY7 = v1Y11 + v12Y11 * t7; pZ7 = v1Z11 + v12Z11 * t7; - var v79 = closest; - v79.x = pX7; - v79.y = pY7; - v79.z = pZ7; + closest.x = pX7; + closest.y = pY7; + closest.z = pZ7; b7 = 3; } - var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini3 = b7; - mind3 = d16; - var v80 = closest; - minvX3 = v80.x; - minvY3 = v80.y; - minvZ3 = v80.z; + mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } - if(d232 < 0) { - var v119; + if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { var v1X12; var v1Y12; var v1Z12; - var v218; var v2X12; var v2Y12; var v2Z12; - var v81 = vec31; - v1X12 = v81.x; - v1Y12 = v81.y; - v1Z12 = v81.z; - var v82 = vec4; - v2X12 = v82.x; - v2Y12 = v82.y; - v2Z12 = v82.z; - var v1212; + v1X12 = vec31.x; + v1Y12 = vec31.y; + v1Z12 = vec31.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; var v12X12; var v12Y12; var v12Z12; v12X12 = v2X12 - v1X12; v12Y12 = v2Y12 - v1Y12; v12Z12 = v2Z12 - v1Z12; - var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d17; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); var b8; if(t8 < 0) { - var v83 = closest; - v83.x = v1X12; - v83.y = v1Y12; - v83.z = v1Z12; + closest.x = v1X12; + closest.y = v1Y12; + closest.z = v1Z12; b8 = 1; } else if(t8 > 1) { - var v84 = closest; - v84.x = v2X12; - v84.y = v2Y12; - v84.z = v2Z12; + closest.x = v2X12; + closest.y = v2Y12; + closest.z = v2Z12; b8 = 2; } else { - var p8; var pX8; var pY8; var pZ8; pX8 = v1X12 + v12X12 * t8; pY8 = v1Y12 + v12Y12 * t8; pZ8 = v1Z12 + v12Z12 * t8; - var v85 = closest; - v85.x = pX8; - v85.y = pY8; - v85.z = pZ8; + closest.x = pX8; + closest.y = pY8; + closest.z = pZ8; b8 = 3; } - var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d18 < mind3) { + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d4 < mind3) { mini3 = b8 << 1; - mind3 = d18; - var v86 = closest; - minvX3 = v86.x; - minvY3 = v86.y; - minvZ3 = v86.z; + mind3 = d4; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } } - if(d312 < 0) { - var v120; + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { var v1X13; var v1Y13; var v1Z13; - var v219; var v2X13; var v2Y13; var v2Z13; - var v87 = vec11; - v1X13 = v87.x; - v1Y13 = v87.y; - v1Z13 = v87.z; - var v88 = vec4; - v2X13 = v88.x; - v2Y13 = v88.y; - v2Z13 = v88.z; - var v1213; + v1X13 = vec11.x; + v1Y13 = vec11.y; + v1Z13 = vec11.z; + v2X13 = vec4.x; + v2Y13 = vec4.y; + v2Z13 = vec4.z; var v12X13; var v12Y13; var v12Z13; v12X13 = v2X13 - v1X13; v12Y13 = v2Y13 - v1Y13; v12Z13 = v2Z13 - v1Z13; - var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / d19; + t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); var b9; if(t9 < 0) { - var v89 = closest; - v89.x = v1X13; - v89.y = v1Y13; - v89.z = v1Z13; + closest.x = v1X13; + closest.y = v1Y13; + closest.z = v1Z13; b9 = 1; } else if(t9 > 1) { - var v90 = closest; - v90.x = v2X13; - v90.y = v2Y13; - v90.z = v2Z13; + closest.x = v2X13; + closest.y = v2Y13; + closest.z = v2Z13; b9 = 2; } else { - var p9; var pX9; var pY9; var pZ9; pX9 = v1X13 + v12X13 * t9; pY9 = v1Y13 + v12Y13 * t9; pZ9 = v1Z13 + v12Z13 * t9; - var v91 = closest; - v91.x = pX9; - v91.y = pY9; - v91.z = pZ9; + closest.x = pX9; + closest.y = pY9; + closest.z = pZ9; b9 = 3; } - var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d20 < mind3) { + var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d5 < mind3) { mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d20; - var v92 = closest; - minvX3 = v92.x; - minvY3 = v92.y; - minvZ3 = v92.z; + mind3 = d5; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } } var b10; if(mind3 > 0) { - var v93 = closest; - v93.x = minvX3; - v93.y = minvY3; - v93.z = minvZ3; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; b10 = mini3; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; if(l3 > 0) { l3 = 1 / Math.sqrt(l3); } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v94 = closest; - v94.x = minvX3; - v94.y = minvY3; - v94.z = minvZ3; + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; b10 = 7; } - var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d21 < mind1) { + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d6 < mind1) { mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d21; - var v95 = closest; - minvX1 = v95.x; - minvY1 = v95.y; - minvZ1 = v95.z; + mind1 = d6; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } - if(d142 * sign < 0) { - var v130; + if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { var v1X14; var v1Y14; var v1Z14; - var v220; var v2X14; var v2Y14; var v2Z14; - var v316; var v3X4; var v3Y4; var v3Z4; - var v1214; var v12X14; var v12Y14; var v12Z14; - var v234; var v23X4; var v23Y4; var v23Z4; - var v317; var v31X3; var v31Y3; var v31Z3; - var v96 = vec11; - v1X14 = v96.x; - v1Y14 = v96.y; - v1Z14 = v96.z; - var v97 = vec21; - v2X14 = v97.x; - v2Y14 = v97.y; - v2Z14 = v97.z; - var v98 = vec4; - v3X4 = v98.x; - v3Y4 = v98.y; - v3Z4 = v98.z; + v1X14 = vec11.x; + v1Y14 = vec11.y; + v1Z14 = vec11.z; + v2X14 = vec21.x; + v2Y14 = vec21.y; + v2Z14 = vec21.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; v12X14 = v2X14 - v1X14; v12Y14 = v2Y14 - v1Y14; v12Z14 = v2Z14 - v1Z14; @@ -9287,39 +9196,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X3 = v1X14 - v3X4; v31Y3 = v1Y14 - v3Y4; v31Z3 = v1Z14 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n124; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; var n12X3; var n12Y3; var n12Z3; - var n233; var n23X3; var n23Y3; var n23Z3; - var n313; var n31X3; var n31Y3; var n31Z3; - n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; - n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; - n12Z3 = v12X14 * nY4 - v12Y14 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; - var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; + n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; + n12Z3 = v12X14 * nY3 - v12Y14 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; var mind4 = -1; - var minv4; var minvX4; var minvY4; var minvZ4; @@ -9327,270 +9228,223 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX4 = 0; minvY4 = 0; minvZ4 = 0; - if(d124 < 0) { - var v132; + if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { var v1X15; var v1Y15; var v1Z15; - var v221; var v2X15; var v2Y15; var v2Z15; - var v99 = vec11; - v1X15 = v99.x; - v1Y15 = v99.y; - v1Z15 = v99.z; - var v100 = vec21; - v2X15 = v100.x; - v2Y15 = v100.y; - v2Z15 = v100.z; - var v1215; + v1X15 = vec11.x; + v1Y15 = vec11.y; + v1Z15 = vec11.z; + v2X15 = vec21.x; + v2Y15 = vec21.y; + v2Z15 = vec21.z; var v12X15; var v12Y15; var v12Z15; v12X15 = v2X15 - v1X15; v12Y15 = v2Y15 - v1Y15; v12Z15 = v2Z15 - v1Z15; - var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d22; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); var b11; if(t10 < 0) { - var v101 = closest; - v101.x = v1X15; - v101.y = v1Y15; - v101.z = v1Z15; + closest.x = v1X15; + closest.y = v1Y15; + closest.z = v1Z15; b11 = 1; } else if(t10 > 1) { - var v102 = closest; - v102.x = v2X15; - v102.y = v2Y15; - v102.z = v2Z15; + closest.x = v2X15; + closest.y = v2Y15; + closest.z = v2Z15; b11 = 2; } else { - var p10; var pX10; var pY10; var pZ10; pX10 = v1X15 + v12X15 * t10; pY10 = v1Y15 + v12Y15 * t10; pZ10 = v1Z15 + v12Z15 * t10; - var v103 = closest; - v103.x = pX10; - v103.y = pY10; - v103.z = pZ10; + closest.x = pX10; + closest.y = pY10; + closest.z = pZ10; b11 = 3; } - var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini4 = b11; - mind4 = d24; - var v104 = closest; - minvX4 = v104.x; - minvY4 = v104.y; - minvZ4 = v104.z; + mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } - if(d233 < 0) { - var v133; + if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { var v1X16; var v1Y16; var v1Z16; - var v222; var v2X16; var v2Y16; var v2Z16; - var v105 = vec21; - v1X16 = v105.x; - v1Y16 = v105.y; - v1Z16 = v105.z; - var v106 = vec4; - v2X16 = v106.x; - v2Y16 = v106.y; - v2Z16 = v106.z; - var v1216; + v1X16 = vec21.x; + v1Y16 = vec21.y; + v1Z16 = vec21.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; var v12X16; var v12Y16; var v12Z16; v12X16 = v2X16 - v1X16; v12Y16 = v2Y16 - v1Y16; v12Z16 = v2Z16 - v1Z16; - var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d25; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); var b12; if(t11 < 0) { - var v107 = closest; - v107.x = v1X16; - v107.y = v1Y16; - v107.z = v1Z16; + closest.x = v1X16; + closest.y = v1Y16; + closest.z = v1Z16; b12 = 1; } else if(t11 > 1) { - var v108 = closest; - v108.x = v2X16; - v108.y = v2Y16; - v108.z = v2Z16; + closest.x = v2X16; + closest.y = v2Y16; + closest.z = v2Z16; b12 = 2; } else { - var p11; var pX11; var pY11; var pZ11; pX11 = v1X16 + v12X16 * t11; pY11 = v1Y16 + v12Y16 * t11; pZ11 = v1Z16 + v12Z16 * t11; - var v109 = closest; - v109.x = pX11; - v109.y = pY11; - v109.z = pZ11; + closest.x = pX11; + closest.y = pY11; + closest.z = pZ11; b12 = 3; } - var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d26 < mind4) { + var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d7 < mind4) { mini4 = b12 << 1; - mind4 = d26; - var v134 = closest; - minvX4 = v134.x; - minvY4 = v134.y; - minvZ4 = v134.z; + mind4 = d7; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } } - if(d313 < 0) { - var v135; + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { var v1X17; var v1Y17; var v1Z17; - var v223; var v2X17; var v2Y17; var v2Z17; - var v136 = vec11; - v1X17 = v136.x; - v1Y17 = v136.y; - v1Z17 = v136.z; - var v137 = vec4; - v2X17 = v137.x; - v2Y17 = v137.y; - v2Z17 = v137.z; - var v1217; + v1X17 = vec11.x; + v1Y17 = vec11.y; + v1Z17 = vec11.z; + v2X17 = vec4.x; + v2Y17 = vec4.y; + v2Z17 = vec4.z; var v12X17; var v12Y17; var v12Z17; v12X17 = v2X17 - v1X17; v12Y17 = v2Y17 - v1Y17; v12Z17 = v2Z17 - v1Z17; - var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / d27; + t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); var b13; if(t12 < 0) { - var v138 = closest; - v138.x = v1X17; - v138.y = v1Y17; - v138.z = v1Z17; + closest.x = v1X17; + closest.y = v1Y17; + closest.z = v1Z17; b13 = 1; } else if(t12 > 1) { - var v139 = closest; - v139.x = v2X17; - v139.y = v2Y17; - v139.z = v2Z17; + closest.x = v2X17; + closest.y = v2Y17; + closest.z = v2Z17; b13 = 2; } else { - var p12; var pX12; var pY12; var pZ12; pX12 = v1X17 + v12X17 * t12; pY12 = v1Y17 + v12Y17 * t12; pZ12 = v1Z17 + v12Z17 * t12; - var v140 = closest; - v140.x = pX12; - v140.y = pY12; - v140.z = pZ12; + closest.x = pX12; + closest.y = pY12; + closest.z = pZ12; b13 = 3; } - var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d28 < mind4) { + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d8 < mind4) { mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d28; - var v142 = closest; - minvX4 = v142.x; - minvY4 = v142.y; - minvZ4 = v142.z; + mind4 = d8; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } } var b14; if(mind4 > 0) { - var v143 = closest; - v143.x = minvX4; - v143.y = minvY4; - v143.z = minvZ4; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; b14 = mini4; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; if(l4 > 0) { l4 = 1 / Math.sqrt(l4); } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v144 = closest; - v144.x = minvX4; - v144.y = minvY4; - v144.z = minvZ4; + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; b14 = 7; } - var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d29 < mind1) { + var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d9 < mind1) { mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d29; - var v145 = closest; - minvX1 = v145.x; - minvY1 = v145.y; - minvZ1 = v145.z; + mind1 = d9; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } - if(d243 * sign < 0) { - var v146; + if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { var v1X18; var v1Y18; var v1Z18; - var v224; var v2X18; var v2Y18; var v2Z18; - var v318; var v3X5; var v3Y5; var v3Z5; - var v1218; var v12X18; var v12Y18; var v12Z18; - var v235; var v23X5; var v23Y5; var v23Z5; - var v319; var v31X4; var v31Y4; var v31Z4; - var v147 = vec21; - v1X18 = v147.x; - v1Y18 = v147.y; - v1Z18 = v147.z; - var v148 = vec31; - v2X18 = v148.x; - v2Y18 = v148.y; - v2Z18 = v148.z; - var v149 = vec4; - v3X5 = v149.x; - v3Y5 = v149.y; - v3Z5 = v149.z; + v1X18 = vec21.x; + v1Y18 = vec21.y; + v1Z18 = vec21.z; + v2X18 = vec31.x; + v2Y18 = vec31.y; + v2Z18 = vec31.z; + v3X5 = vec4.x; + v3Y5 = vec4.y; + v3Z5 = vec4.z; v12X18 = v2X18 - v1X18; v12Y18 = v2Y18 - v1Y18; v12Z18 = v2Z18 - v1Z18; @@ -9600,39 +9454,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X4 = v1X18 - v3X5; v31Y4 = v1Y18 - v3Y5; v31Z4 = v1Z18 - v3Z5; - var n5; - var nX5; - var nY5; - var nZ5; - nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n125; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; var n12X4; var n12Y4; var n12Z4; - var n234; var n23X4; var n23Y4; var n23Z4; - var n314; var n31X4; var n31Y4; var n31Z4; - n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; - n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; - n12Z4 = v12X18 * nY5 - v12Y18 * nX5; - n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; - n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; - n23Z4 = v23X5 * nY5 - v23Y5 * nX5; - n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; - n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; - n31Z4 = v31X4 * nY5 - v31Y4 * nX5; - var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; - var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; - var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; + n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; + n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; + n12Z4 = v12X18 * nY4 - v12Y18 * nX4; + n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; + n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; + n23Z4 = v23X5 * nY4 - v23Y5 * nX4; + n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; + n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; + n31Z4 = v31X4 * nY4 - v31Y4 * nX4; var mind5 = -1; - var minv5; var minvX5; var minvY5; var minvZ5; @@ -9640,252 +9486,212 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX5 = 0; minvY5 = 0; minvZ5 = 0; - if(d125 < 0) { - var v150; + if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { var v1X19; var v1Y19; var v1Z19; - var v225; var v2X19; var v2Y19; var v2Z19; - var v151 = vec21; - v1X19 = v151.x; - v1Y19 = v151.y; - v1Z19 = v151.z; - var v152 = vec31; - v2X19 = v152.x; - v2Y19 = v152.y; - v2Z19 = v152.z; - var v1219; + v1X19 = vec21.x; + v1Y19 = vec21.y; + v1Z19 = vec21.z; + v2X19 = vec31.x; + v2Y19 = vec31.y; + v2Z19 = vec31.z; var v12X19; var v12Y19; var v12Z19; v12X19 = v2X19 - v1X19; v12Y19 = v2Y19 - v1Y19; v12Z19 = v2Z19 - v1Z19; - var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / d30; + t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); var b15; if(t13 < 0) { - var v153 = closest; - v153.x = v1X19; - v153.y = v1Y19; - v153.z = v1Z19; + closest.x = v1X19; + closest.y = v1Y19; + closest.z = v1Z19; b15 = 1; } else if(t13 > 1) { - var v154 = closest; - v154.x = v2X19; - v154.y = v2Y19; - v154.z = v2Z19; + closest.x = v2X19; + closest.y = v2Y19; + closest.z = v2Z19; b15 = 2; } else { - var p13; var pX13; var pY13; var pZ13; pX13 = v1X19 + v12X19 * t13; pY13 = v1Y19 + v12Y19 * t13; pZ13 = v1Z19 + v12Z19 * t13; - var v155 = closest; - v155.x = pX13; - v155.y = pY13; - v155.z = pZ13; + closest.x = pX13; + closest.y = pY13; + closest.z = pZ13; b15 = 3; } - var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini5 = b15; - mind5 = d32; - var v156 = closest; - minvX5 = v156.x; - minvY5 = v156.y; - minvZ5 = v156.z; + mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } - if(d234 < 0) { - var v157; + if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { var v1X20; var v1Y20; var v1Z20; - var v226; var v2X20; var v2Y20; var v2Z20; - var v158 = vec31; - v1X20 = v158.x; - v1Y20 = v158.y; - v1Z20 = v158.z; - var v159 = vec4; - v2X20 = v159.x; - v2Y20 = v159.y; - v2Z20 = v159.z; - var v1220; + v1X20 = vec31.x; + v1Y20 = vec31.y; + v1Z20 = vec31.z; + v2X20 = vec4.x; + v2Y20 = vec4.y; + v2Z20 = vec4.z; var v12X20; var v12Y20; var v12Z20; v12X20 = v2X20 - v1X20; v12Y20 = v2Y20 - v1Y20; v12Z20 = v2Z20 - v1Z20; - var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / d33; + t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); var b16; if(t14 < 0) { - var v160 = closest; - v160.x = v1X20; - v160.y = v1Y20; - v160.z = v1Z20; + closest.x = v1X20; + closest.y = v1Y20; + closest.z = v1Z20; b16 = 1; } else if(t14 > 1) { - var v161 = closest; - v161.x = v2X20; - v161.y = v2Y20; - v161.z = v2Z20; + closest.x = v2X20; + closest.y = v2Y20; + closest.z = v2Z20; b16 = 2; } else { - var p14; var pX14; var pY14; var pZ14; pX14 = v1X20 + v12X20 * t14; pY14 = v1Y20 + v12Y20 * t14; pZ14 = v1Z20 + v12Z20 * t14; - var v162 = closest; - v162.x = pX14; - v162.y = pY14; - v162.z = pZ14; + closest.x = pX14; + closest.y = pY14; + closest.z = pZ14; b16 = 3; } - var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d34 < mind5) { + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d10 < mind5) { mini5 = b16 << 1; - mind5 = d34; - var v163 = closest; - minvX5 = v163.x; - minvY5 = v163.y; - minvZ5 = v163.z; + mind5 = d10; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } } - if(d314 < 0) { - var v164; + if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { var v1X21; var v1Y21; var v1Z21; - var v227; var v2X21; var v2Y21; var v2Z21; - var v165 = vec21; - v1X21 = v165.x; - v1Y21 = v165.y; - v1Z21 = v165.z; - var v166 = vec4; - v2X21 = v166.x; - v2Y21 = v166.y; - v2Z21 = v166.z; - var v1221; + v1X21 = vec21.x; + v1Y21 = vec21.y; + v1Z21 = vec21.z; + v2X21 = vec4.x; + v2Y21 = vec4.y; + v2Z21 = vec4.z; var v12X21; var v12Y21; var v12Z21; v12X21 = v2X21 - v1X21; v12Y21 = v2Y21 - v1Y21; v12Z21 = v2Z21 - v1Z21; - var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / d35; + t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); var b17; if(t15 < 0) { - var v167 = closest; - v167.x = v1X21; - v167.y = v1Y21; - v167.z = v1Z21; + closest.x = v1X21; + closest.y = v1Y21; + closest.z = v1Z21; b17 = 1; } else if(t15 > 1) { - var v168 = closest; - v168.x = v2X21; - v168.y = v2Y21; - v168.z = v2Z21; + closest.x = v2X21; + closest.y = v2Y21; + closest.z = v2Z21; b17 = 2; } else { - var p15; var pX15; var pY15; var pZ15; pX15 = v1X21 + v12X21 * t15; pY15 = v1Y21 + v12Y21 * t15; pZ15 = v1Z21 + v12Z21 * t15; - var v169 = closest; - v169.x = pX15; - v169.y = pY15; - v169.z = pZ15; + closest.x = pX15; + closest.y = pY15; + closest.z = pZ15; b17 = 3; } - var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d36 < mind5) { + var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d11 < mind5) { mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d36; - var v170 = closest; - minvX5 = v170.x; - minvY5 = v170.y; - minvZ5 = v170.z; + mind5 = d11; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } } var b18; if(mind5 > 0) { - var v171 = closest; - v171.x = minvX5; - v171.y = minvY5; - v171.z = minvZ5; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; b18 = mini5; } else { - var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; if(l5 > 0) { l5 = 1 / Math.sqrt(l5); } - nX5 *= l5; - nY5 *= l5; - nZ5 *= l5; - var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; - var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - l24 = dn4 / l24; - minvX5 = nX5 * l24; - minvY5 = nY5 * l24; - minvZ5 = nZ5 * l24; - var v172 = closest; - v172.x = minvX5; - v172.y = minvY5; - v172.z = minvZ5; + nX4 *= l5; + nY4 *= l5; + nZ4 *= l5; + var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; + minvX5 = nX4 * l24; + minvY5 = nY4 * l24; + minvZ5 = nZ4 * l24; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; b18 = 7; } - var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d37 < mind1) { + var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d12 < mind1) { mini1 = b18 << 1; - mind1 = d37; - var v173 = closest; - minvX1 = v173.x; - minvY1 = v173.y; - minvZ1 = v173.z; + mind1 = d12; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } if(mind1 > 0) { - var v174 = closest; - v174.x = minvX1; - v174.y = minvY1; - v174.z = minvZ1; - v3 = mini1; + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v2 = mini1; } else { closest.zero(); - v3 = 15; + v2 = 15; } break; } - if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(!useEpa) { this.distance = 0; return 0; } - var _g1 = this.simplexSize; - switch(_g1) { + switch(this.simplexSize) { case 1: this.pointToTetrahedron(); break; @@ -9908,39 +9714,29 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.distance = 0; return 1; } - this.shrinkSimplex(v3); + this.shrinkSimplex(v2); dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; - var _this2 = dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; - var v175 = this.w1[this.simplexSize]; - _this3.x = v175.x; - _this3.y = v175.y; - _this3.z = v175.z; - var _this4 = _this3; - var v176 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v176.x; - var ty2 = _this4.y - v176.y; - var tz2 = _this4.z - v176.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; - if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + var _this1 = this.s[this.simplexSize]; + var v6 = this.w1[this.simplexSize]; + _this1.x = v6.x; + _this1.y = v6.y; + _this1.z = v6.z; + var v7 = this.w2[this.simplexSize]; + _this1.x -= v7.x; + _this1.y -= v7.y; + _this1.z -= v7.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var d110 = closest.x * dir.x + closest.y * dir.y + closest.z * dir.z; - var _this5 = s[this.simplexSize]; - var d210 = _this5.x * dir.x + _this5.y * dir.y + _this5.z * dir.z; - if(d210 - d110 < eps2) { + var _this2 = s[this.simplexSize]; + if(_this2.x * dir.x + _this2.y * dir.y + _this2.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { this.interpolateClosestPoints(); this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); if(cache != null && cache._gjkCache != null) { @@ -9959,21 +9755,17 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.tf1 = tf1; this.tf2 = tf2; var s = this.s; - var w1 = this.w1; - var w2 = this.w2; var closest = this.closest; var dir = this.dir; - var firstDir; var firstDirX; var firstDirY; var firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; - var v = dir; - v.x = firstDirX; - v.y = firstDirY; - v.z = firstDirZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { dir.init(1,0,0); } @@ -9981,28 +9773,23 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v1 = this.w1[this.simplexSize]; - v1.x = this.tf1._positionX; - v1.y = this.tf1._positionY; - v1.z = this.tf1._positionZ; + var v = this.w1[this.simplexSize]; + v.x = this.tf1._positionX; + v.y = this.tf1._positionY; + v.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); var _this = this.s[this.simplexSize]; - var v2 = this.w1[this.simplexSize]; - _this.x = v2.x; - _this.y = v2.y; - _this.z = v2.z; - var _this1 = _this; - var v3 = this.w2[this.simplexSize]; - var tx = _this1.x - v3.x; - var ty = _this1.y - v3.y; - var tz = _this1.z - v3.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + var v1 = this.w1[this.simplexSize]; + _this.x = v1.x; + _this.y = v1.y; + _this.z = v1.z; + var v2 = this.w2[this.simplexSize]; + _this.x -= v2.x; + _this.y -= v2.y; + _this.z -= v2.z; this.simplexSize = 1; var count = 0; - var max = 40; var lambda = 0.0; var rayX = this.rayX; var rayR = this.rayR; @@ -10010,120 +9797,96 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { rayR.x = tl2.x; rayR.y = tl2.y; rayR.z = tl2.z; - var _this2 = rayR; - var tx1 = _this2.x - tl1.x; - var ty1 = _this2.y - tl1.y; - var tz1 = _this2.z - tl1.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; - var eps = 1e-4; - var eps2 = eps * eps; - while(count < max) { - var v4 = 0; - var _g = this.simplexSize; - switch(_g) { + rayR.x -= tl1.x; + rayR.y -= tl1.y; + rayR.z -= tl1.z; + while(count < 40) { + var v3 = 0; + switch(this.simplexSize) { case 1: - var v5 = s[0]; - closest.x = v5.x; - closest.y = v5.y; - closest.z = v5.z; - v4 = 1; + var v4 = s[0]; + closest.x = v4.x; + closest.y = v4.y; + closest.z = v4.z; + v3 = 1; break; case 2: - var v11; var v1X; var v1Y; var v1Z; - var v21; var v2X; var v2Y; var v2Z; - var v6 = s[0]; - v1X = v6.x; - v1Y = v6.y; - v1Z = v6.z; - var v7 = s[1]; - v2X = v7.x; - v2Y = v7.y; - v2Z = v7.z; - var v12; + var v5 = s[0]; + v1X = v5.x; + v1Y = v5.y; + v1Z = v5.z; + var v6 = s[1]; + v2X = v6.x; + v2Y = v6.y; + v2Z = v6.z; var v12X; var v12Y; var v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v8 = closest; - v8.x = v1X; - v8.y = v1Y; - v8.z = v1Z; - v4 = 1; + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v3 = 1; } else if(t > 1) { - var v9 = closest; - v9.x = v2X; - v9.y = v2Y; - v9.z = v2Z; - v4 = 2; + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v3 = 2; } else { - var p; var pX; var pY; var pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v10 = closest; - v10.x = pX; - v10.y = pY; - v10.z = pZ; - v4 = 3; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v3 = 3; } break; case 3: var vec1 = s[0]; var vec2 = s[1]; var vec3 = s[2]; - var v13; var v1X1; var v1Y1; var v1Z1; - var v22; var v2X1; var v2Y1; var v2Z1; - var v31; var v3X; var v3Y; var v3Z; - var v121; var v12X1; var v12Y1; var v12Z1; - var v23; var v23X; var v23Y; var v23Z; - var v311; var v31X; var v31Y; var v31Z; - var v14 = vec1; - v1X1 = v14.x; - v1Y1 = v14.y; - v1Z1 = v14.z; - var v15 = vec2; - v2X1 = v15.x; - v2Y1 = v15.y; - v2Z1 = v15.z; - var v16 = vec3; - v3X = v16.x; - v3Y = v16.y; - v3Z = v16.z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -10133,22 +9896,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var n; var nX; var nY; var nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; var n12X; var n12Y; var n12Z; - var n23; var n23X; var n23Y; var n23Z; - var n31; var n31X; var n31Y; var n31Z; @@ -10161,11 +9920,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; var mind = -1; - var minv; var minvX; var minvY; var minvZ; @@ -10173,202 +9928,167 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v17; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { var v1X2; var v1Y2; var v1Z2; - var v24; var v2X2; var v2Y2; var v2Z2; - var v18 = vec1; - v1X2 = v18.x; - v1Y2 = v18.y; - v1Z2 = v18.z; - var v19 = vec2; - v2X2 = v19.x; - v2Y2 = v19.y; - v2Z2 = v19.z; - var v122; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; var v12X2; var v12Y2; var v12Z2; v12X2 = v2X2 - v1X2; v12Y2 = v2Y2 - v1Y2; v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d1; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); var b; if(t1 < 0) { - var v20 = closest; - v20.x = v1X2; - v20.y = v1Y2; - v20.z = v1Z2; + closest.x = v1X2; + closest.y = v1Y2; + closest.z = v1Z2; b = 1; } else if(t1 > 1) { - var v25 = closest; - v25.x = v2X2; - v25.y = v2Y2; - v25.z = v2Z2; + closest.x = v2X2; + closest.y = v2Y2; + closest.z = v2Z2; b = 2; } else { - var p1; var pX1; var pY1; var pZ1; pX1 = v1X2 + v12X2 * t1; pY1 = v1Y2 + v12Y2 * t1; pZ1 = v1Z2 + v12Z2 * t1; - var v26 = closest; - v26.x = pX1; - v26.y = pY1; - v26.z = pZ1; + closest.x = pX1; + closest.y = pY1; + closest.z = pZ1; b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini = b; - mind = d2; - var v27 = closest; - minvX = v27.x; - minvY = v27.y; - minvZ = v27.z; - } - if(d23 < 0) { - var v110; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { var v1X3; var v1Y3; var v1Z3; - var v28; var v2X3; var v2Y3; var v2Z3; - var v29 = vec2; - v1X3 = v29.x; - v1Y3 = v29.y; - v1Z3 = v29.z; - var v30 = vec3; - v2X3 = v30.x; - v2Y3 = v30.y; - v2Z3 = v30.z; - var v123; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; var v12X3; var v12Y3; var v12Z3; v12X3 = v2X3 - v1X3; v12Y3 = v2Y3 - v1Y3; v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d3; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); var b1; if(t2 < 0) { - var v32 = closest; - v32.x = v1X3; - v32.y = v1Y3; - v32.z = v1Z3; + closest.x = v1X3; + closest.y = v1Y3; + closest.z = v1Z3; b1 = 1; } else if(t2 > 1) { - var v33 = closest; - v33.x = v2X3; - v33.y = v2Y3; - v33.z = v2Z3; + closest.x = v2X3; + closest.y = v2Y3; + closest.z = v2Z3; b1 = 2; } else { - var p2; var pX2; var pY2; var pZ2; pX2 = v1X3 + v12X3 * t2; pY2 = v1Y3 + v12Y3 * t2; pZ2 = v1Z3 + v12Z3 * t2; - var v34 = closest; - v34.x = pX2; - v34.y = pY2; - v34.z = pZ2; + closest.x = pX2; + closest.y = pY2; + closest.z = pZ2; b1 = 3; } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d4 < mind) { + var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { mini = b1 << 1; - mind = d4; - var v35 = closest; - minvX = v35.x; - minvY = v35.y; - minvZ = v35.z; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d31 < 0) { - var v111; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { var v1X4; var v1Y4; var v1Z4; - var v210; var v2X4; var v2Y4; var v2Z4; - var v36 = vec1; - v1X4 = v36.x; - v1Y4 = v36.y; - v1Z4 = v36.z; - var v37 = vec3; - v2X4 = v37.x; - v2Y4 = v37.y; - v2Z4 = v37.z; - var v124; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; var v12X4; var v12Y4; var v12Z4; v12X4 = v2X4 - v1X4; v12Y4 = v2Y4 - v1Y4; v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / d5; + t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); var b2; if(t3 < 0) { - var v38 = closest; - v38.x = v1X4; - v38.y = v1Y4; - v38.z = v1Z4; + closest.x = v1X4; + closest.y = v1Y4; + closest.z = v1Z4; b2 = 1; } else if(t3 > 1) { - var v39 = closest; - v39.x = v2X4; - v39.y = v2Y4; - v39.z = v2Z4; + closest.x = v2X4; + closest.y = v2Y4; + closest.z = v2Z4; b2 = 2; } else { - var p3; var pX3; var pY3; var pZ3; pX3 = v1X4 + v12X4 * t3; pY3 = v1Y4 + v12Y4 * t3; pZ3 = v1Z4 + v12Z4 * t3; - var v40 = closest; - v40.x = pX3; - v40.y = pY3; - v40.z = pZ3; + closest.x = pX3; + closest.y = pY3; + closest.z = pZ3; b2 = 3; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d6 < mind) { + var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d1 < mind) { mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v41 = closest; - minvX = v41.x; - minvY = v41.y; - minvZ = v41.z; + mind = d1; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } if(mind > 0) { - var v42 = closest; - v42.x = minvX; - v42.y = minvY; - v42.z = minvZ; - v4 = mini; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v3 = mini; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -10377,17 +10097,15 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v43 = closest; - v43.x = minvX; - v43.y = minvY; - v43.z = minvZ; - v4 = 7; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v3 = 7; } break; case 4: @@ -10395,62 +10113,45 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var vec21 = s[1]; var vec31 = s[2]; var vec4 = s[3]; - var v112; var v1X5; var v1Y5; var v1Z5; - var v211; var v2X5; var v2Y5; var v2Z5; - var v310; var v3X1; var v3Y1; var v3Z1; - var v44; var v4X; var v4Y; var v4Z; - var v125; var v12X5; var v12Y5; var v12Z5; - var v131; var v13X; var v13Y; var v13Z; - var v141; var v14X; var v14Y; var v14Z; - var v231; var v23X1; var v23Y1; var v23Z1; - var v241; var v24X; var v24Y; var v24Z; - var v341; - var v34X; - var v34Y; - var v34Z; - var v45 = vec11; - v1X5 = v45.x; - v1Y5 = v45.y; - v1Z5 = v45.z; - var v46 = vec21; - v2X5 = v46.x; - v2Y5 = v46.y; - v2Z5 = v46.z; - var v47 = vec31; - v3X1 = v47.x; - v3Y1 = v47.y; - v3Z1 = v47.z; - var v48 = vec4; - v4X = v48.x; - v4Y = v48.y; - v4Z = v48.z; + v1X5 = vec11.x; + v1Y5 = vec11.y; + v1Z5 = vec11.z; + v2X5 = vec21.x; + v2Y5 = vec21.y; + v2Z5 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; v12X5 = v2X5 - v1X5; v12Y5 = v2Y5 - v1Y5; v12Z5 = v2Z5 - v1Z5; @@ -10466,30 +10167,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v24X = v4X - v2X5; v24Y = v4Y - v2Y5; v24Z = v4Z - v2Z5; - v34X = v4X - v3X1; - v34Y = v4Y - v3Y1; - v34Z = v4Z - v3Z1; - var rev; - var n123; var n123X; var n123Y; var n123Z; - var n134; var n134X; var n134Y; var n134Z; - var n142; var n142X; var n142Y; var n142Z; - var n243; var n243X; var n243Y; var n243Z; - var n1; - var nX1; - var nY1; - var nZ1; n123X = v12Y5 * v13Z - v12Z5 * v13Y; n123Y = v12Z5 * v13X - v12X5 * v13Z; n123Z = v12X5 * v13Y - v12Y5 * v13X; @@ -10503,12 +10192,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; - var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; - var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; - var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; var mind1 = -1; - var minv1; var minvX1; var minvY1; var minvZ1; @@ -10516,43 +10200,34 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d123 * sign < 0) { - var v113; + if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { var v1X6; var v1Y6; var v1Z6; - var v212; var v2X6; var v2Y6; var v2Z6; - var v312; var v3X2; var v3Y2; var v3Z2; - var v126; var v12X6; var v12Y6; var v12Z6; - var v232; var v23X2; var v23Y2; var v23Z2; - var v313; var v31X1; var v31Y1; var v31Z1; - var v49 = vec11; - v1X6 = v49.x; - v1Y6 = v49.y; - v1Z6 = v49.z; - var v50 = vec21; - v2X6 = v50.x; - v2Y6 = v50.y; - v2Z6 = v50.z; - var v51 = vec31; - v3X2 = v51.x; - v3Y2 = v51.y; - v3Z2 = v51.z; + v1X6 = vec11.x; + v1Y6 = vec11.y; + v1Z6 = vec11.z; + v2X6 = vec21.x; + v2Y6 = vec21.y; + v2Z6 = vec21.z; + v3X2 = vec31.x; + v3Y2 = vec31.y; + v3Z2 = vec31.z; v12X6 = v2X6 - v1X6; v12Y6 = v2Y6 - v1Y6; v12Z6 = v2Z6 - v1Z6; @@ -10562,39 +10237,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X1 = v1X6 - v3X2; v31Y1 = v1Y6 - v3Y2; v31Z1 = v1Z6 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n121; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; var n12X1; var n12Y1; var n12Z1; - var n231; var n23X1; var n23Y1; var n23Z1; - var n311; var n31X1; var n31Y1; var n31Z1; - n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; - n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; - n12Z1 = v12X6 * nY2 - v12Y6 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; - var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; + n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; + n12Z1 = v12X6 * nY1 - v12Y6 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; var mind2 = -1; - var minv2; var minvX2; var minvY2; var minvZ2; @@ -10602,268 +10269,220 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX2 = 0; minvY2 = 0; minvZ2 = 0; - if(d121 < 0) { - var v114; + if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { var v1X7; var v1Y7; var v1Z7; - var v213; var v2X7; var v2Y7; var v2Z7; - var v52 = vec11; - v1X7 = v52.x; - v1Y7 = v52.y; - v1Z7 = v52.z; - var v53 = vec21; - v2X7 = v53.x; - v2Y7 = v53.y; - v2Z7 = v53.z; - var v127; + v1X7 = vec11.x; + v1Y7 = vec11.y; + v1Z7 = vec11.z; + v2X7 = vec21.x; + v2Y7 = vec21.y; + v2Z7 = vec21.z; var v12X7; var v12Y7; var v12Z7; v12X7 = v2X7 - v1X7; v12Y7 = v2Y7 - v1Y7; v12Z7 = v2Z7 - v1Z7; - var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d7; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); var b3; if(t4 < 0) { - var v54 = closest; - v54.x = v1X7; - v54.y = v1Y7; - v54.z = v1Z7; + closest.x = v1X7; + closest.y = v1Y7; + closest.z = v1Z7; b3 = 1; } else if(t4 > 1) { - var v55 = closest; - v55.x = v2X7; - v55.y = v2Y7; - v55.z = v2Z7; + closest.x = v2X7; + closest.y = v2Y7; + closest.z = v2Z7; b3 = 2; } else { - var p4; var pX4; var pY4; var pZ4; pX4 = v1X7 + v12X7 * t4; pY4 = v1Y7 + v12Y7 * t4; pZ4 = v1Z7 + v12Z7 * t4; - var v56 = closest; - v56.x = pX4; - v56.y = pY4; - v56.z = pZ4; + closest.x = pX4; + closest.y = pY4; + closest.z = pZ4; b3 = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini2 = b3; - mind2 = d8; - var v57 = closest; - minvX2 = v57.x; - minvY2 = v57.y; - minvZ2 = v57.z; + mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } - if(d231 < 0) { - var v115; + if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { var v1X8; var v1Y8; var v1Z8; - var v214; var v2X8; var v2Y8; var v2Z8; - var v58 = vec21; - v1X8 = v58.x; - v1Y8 = v58.y; - v1Z8 = v58.z; - var v59 = vec31; - v2X8 = v59.x; - v2Y8 = v59.y; - v2Z8 = v59.z; - var v128; + v1X8 = vec21.x; + v1Y8 = vec21.y; + v1Z8 = vec21.z; + v2X8 = vec31.x; + v2Y8 = vec31.y; + v2Z8 = vec31.z; var v12X8; var v12Y8; var v12Z8; v12X8 = v2X8 - v1X8; v12Y8 = v2Y8 - v1Y8; v12Z8 = v2Z8 - v1Z8; - var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d9; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); var b4; if(t5 < 0) { - var v60 = closest; - v60.x = v1X8; - v60.y = v1Y8; - v60.z = v1Z8; + closest.x = v1X8; + closest.y = v1Y8; + closest.z = v1Z8; b4 = 1; } else if(t5 > 1) { - var v61 = closest; - v61.x = v2X8; - v61.y = v2Y8; - v61.z = v2Z8; + closest.x = v2X8; + closest.y = v2Y8; + closest.z = v2Z8; b4 = 2; } else { - var p5; var pX5; var pY5; var pZ5; pX5 = v1X8 + v12X8 * t5; pY5 = v1Y8 + v12Y8 * t5; pZ5 = v1Z8 + v12Z8 * t5; - var v62 = closest; - v62.x = pX5; - v62.y = pY5; - v62.z = pZ5; + closest.x = pX5; + closest.y = pY5; + closest.z = pZ5; b4 = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d10 < mind2) { + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d2 < mind2) { mini2 = b4 << 1; - mind2 = d10; - var v63 = closest; - minvX2 = v63.x; - minvY2 = v63.y; - minvZ2 = v63.z; + mind2 = d2; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } } - if(d311 < 0) { - var v116; + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { var v1X9; var v1Y9; var v1Z9; - var v215; var v2X9; var v2Y9; var v2Z9; - var v64 = vec11; - v1X9 = v64.x; - v1Y9 = v64.y; - v1Z9 = v64.z; - var v65 = vec31; - v2X9 = v65.x; - v2Y9 = v65.y; - v2Z9 = v65.z; - var v129; + v1X9 = vec11.x; + v1Y9 = vec11.y; + v1Z9 = vec11.z; + v2X9 = vec31.x; + v2Y9 = vec31.y; + v2Z9 = vec31.z; var v12X9; var v12Y9; var v12Z9; v12X9 = v2X9 - v1X9; v12Y9 = v2Y9 - v1Y9; v12Z9 = v2Z9 - v1Z9; - var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / d11; + t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); var b5; if(t6 < 0) { - var v66 = closest; - v66.x = v1X9; - v66.y = v1Y9; - v66.z = v1Z9; + closest.x = v1X9; + closest.y = v1Y9; + closest.z = v1Z9; b5 = 1; } else if(t6 > 1) { - var v67 = closest; - v67.x = v2X9; - v67.y = v2Y9; - v67.z = v2Z9; + closest.x = v2X9; + closest.y = v2Y9; + closest.z = v2Z9; b5 = 2; } else { - var p6; var pX6; var pY6; var pZ6; pX6 = v1X9 + v12X9 * t6; pY6 = v1Y9 + v12Y9 * t6; pZ6 = v1Z9 + v12Z9 * t6; - var v68 = closest; - v68.x = pX6; - v68.y = pY6; - v68.z = pZ6; + closest.x = pX6; + closest.y = pY6; + closest.z = pZ6; b5 = 3; } - var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d13 < mind2) { + var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d3 < mind2) { mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d13; - var v69 = closest; - minvX2 = v69.x; - minvY2 = v69.y; - minvZ2 = v69.z; + mind2 = d3; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; } } var b6; if(mind2 > 0) { - var v70 = closest; - v70.x = minvX2; - v70.y = minvY2; - v70.z = minvZ2; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; b6 = mini2; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v71 = closest; - v71.x = minvX2; - v71.y = minvY2; - v71.z = minvZ2; + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; b6 = 7; } - var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini1 = b6; - mind1 = d14; - var v72 = closest; - minvX1 = v72.x; - minvY1 = v72.y; - minvZ1 = v72.z; - } - if(d134 * sign < 0) { - var v117; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { var v1X10; var v1Y10; var v1Z10; - var v216; var v2X10; var v2Y10; var v2Z10; - var v314; var v3X3; var v3Y3; var v3Z3; - var v1210; var v12X10; var v12Y10; var v12Z10; - var v233; var v23X3; var v23Y3; var v23Z3; - var v315; var v31X2; var v31Y2; var v31Z2; - var v73 = vec11; - v1X10 = v73.x; - v1Y10 = v73.y; - v1Z10 = v73.z; - var v74 = vec31; - v2X10 = v74.x; - v2Y10 = v74.y; - v2Z10 = v74.z; - var v75 = vec4; - v3X3 = v75.x; - v3Y3 = v75.y; - v3Z3 = v75.z; + v1X10 = vec11.x; + v1Y10 = vec11.y; + v1Z10 = vec11.z; + v2X10 = vec31.x; + v2Y10 = vec31.y; + v2Z10 = vec31.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; v12X10 = v2X10 - v1X10; v12Y10 = v2Y10 - v1Y10; v12Z10 = v2Z10 - v1Z10; @@ -10873,39 +10492,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X2 = v1X10 - v3X3; v31Y2 = v1Y10 - v3Y3; v31Z2 = v1Z10 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n122; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; var n12X2; var n12Y2; var n12Z2; - var n232; var n23X2; var n23Y2; var n23Z2; - var n312; var n31X2; var n31Y2; var n31Z2; - n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; - n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; - n12Z2 = v12X10 * nY3 - v12Y10 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; - var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; + n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; + n12Z2 = v12X10 * nY2 - v12Y10 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; var mind3 = -1; - var minv3; var minvX3; var minvY3; var minvZ3; @@ -10913,270 +10524,223 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX3 = 0; minvY3 = 0; minvZ3 = 0; - if(d122 < 0) { - var v118; + if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { var v1X11; var v1Y11; var v1Z11; - var v217; var v2X11; var v2Y11; var v2Z11; - var v76 = vec11; - v1X11 = v76.x; - v1Y11 = v76.y; - v1Z11 = v76.z; - var v77 = vec31; - v2X11 = v77.x; - v2Y11 = v77.y; - v2Z11 = v77.z; - var v1211; + v1X11 = vec11.x; + v1Y11 = vec11.y; + v1Z11 = vec11.z; + v2X11 = vec31.x; + v2Y11 = vec31.y; + v2Z11 = vec31.z; var v12X11; var v12Y11; var v12Z11; v12X11 = v2X11 - v1X11; v12Y11 = v2Y11 - v1Y11; v12Z11 = v2Z11 - v1Z11; - var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d15; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); var b7; if(t7 < 0) { - var v78 = closest; - v78.x = v1X11; - v78.y = v1Y11; - v78.z = v1Z11; + closest.x = v1X11; + closest.y = v1Y11; + closest.z = v1Z11; b7 = 1; } else if(t7 > 1) { - var v79 = closest; - v79.x = v2X11; - v79.y = v2Y11; - v79.z = v2Z11; + closest.x = v2X11; + closest.y = v2Y11; + closest.z = v2Z11; b7 = 2; } else { - var p7; var pX7; var pY7; var pZ7; pX7 = v1X11 + v12X11 * t7; pY7 = v1Y11 + v12Y11 * t7; pZ7 = v1Z11 + v12Z11 * t7; - var v80 = closest; - v80.x = pX7; - v80.y = pY7; - v80.z = pZ7; + closest.x = pX7; + closest.y = pY7; + closest.z = pZ7; b7 = 3; } - var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini3 = b7; - mind3 = d16; - var v81 = closest; - minvX3 = v81.x; - minvY3 = v81.y; - minvZ3 = v81.z; + mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } - if(d232 < 0) { - var v119; + if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { var v1X12; var v1Y12; var v1Z12; - var v218; var v2X12; var v2Y12; var v2Z12; - var v82 = vec31; - v1X12 = v82.x; - v1Y12 = v82.y; - v1Z12 = v82.z; - var v83 = vec4; - v2X12 = v83.x; - v2Y12 = v83.y; - v2Z12 = v83.z; - var v1212; + v1X12 = vec31.x; + v1Y12 = vec31.y; + v1Z12 = vec31.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; var v12X12; var v12Y12; var v12Z12; v12X12 = v2X12 - v1X12; v12Y12 = v2Y12 - v1Y12; v12Z12 = v2Z12 - v1Z12; - var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d17; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); var b8; if(t8 < 0) { - var v84 = closest; - v84.x = v1X12; - v84.y = v1Y12; - v84.z = v1Z12; + closest.x = v1X12; + closest.y = v1Y12; + closest.z = v1Z12; b8 = 1; } else if(t8 > 1) { - var v85 = closest; - v85.x = v2X12; - v85.y = v2Y12; - v85.z = v2Z12; + closest.x = v2X12; + closest.y = v2Y12; + closest.z = v2Z12; b8 = 2; } else { - var p8; var pX8; var pY8; var pZ8; pX8 = v1X12 + v12X12 * t8; pY8 = v1Y12 + v12Y12 * t8; pZ8 = v1Z12 + v12Z12 * t8; - var v86 = closest; - v86.x = pX8; - v86.y = pY8; - v86.z = pZ8; + closest.x = pX8; + closest.y = pY8; + closest.z = pZ8; b8 = 3; } - var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d18 < mind3) { + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d4 < mind3) { mini3 = b8 << 1; - mind3 = d18; - var v87 = closest; - minvX3 = v87.x; - minvY3 = v87.y; - minvZ3 = v87.z; + mind3 = d4; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } } - if(d312 < 0) { - var v120; + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { var v1X13; var v1Y13; var v1Z13; - var v219; var v2X13; var v2Y13; var v2Z13; - var v88 = vec11; - v1X13 = v88.x; - v1Y13 = v88.y; - v1Z13 = v88.z; - var v89 = vec4; - v2X13 = v89.x; - v2Y13 = v89.y; - v2Z13 = v89.z; - var v1213; + v1X13 = vec11.x; + v1Y13 = vec11.y; + v1Z13 = vec11.z; + v2X13 = vec4.x; + v2Y13 = vec4.y; + v2Z13 = vec4.z; var v12X13; var v12Y13; var v12Z13; v12X13 = v2X13 - v1X13; v12Y13 = v2Y13 - v1Y13; v12Z13 = v2Z13 - v1Z13; - var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / d19; + t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); var b9; if(t9 < 0) { - var v90 = closest; - v90.x = v1X13; - v90.y = v1Y13; - v90.z = v1Z13; + closest.x = v1X13; + closest.y = v1Y13; + closest.z = v1Z13; b9 = 1; } else if(t9 > 1) { - var v91 = closest; - v91.x = v2X13; - v91.y = v2Y13; - v91.z = v2Z13; + closest.x = v2X13; + closest.y = v2Y13; + closest.z = v2Z13; b9 = 2; } else { - var p9; var pX9; var pY9; var pZ9; pX9 = v1X13 + v12X13 * t9; pY9 = v1Y13 + v12Y13 * t9; pZ9 = v1Z13 + v12Z13 * t9; - var v92 = closest; - v92.x = pX9; - v92.y = pY9; - v92.z = pZ9; + closest.x = pX9; + closest.y = pY9; + closest.z = pZ9; b9 = 3; } - var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d20 < mind3) { + var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d5 < mind3) { mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d20; - var v93 = closest; - minvX3 = v93.x; - minvY3 = v93.y; - minvZ3 = v93.z; + mind3 = d5; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; } } var b10; if(mind3 > 0) { - var v94 = closest; - v94.x = minvX3; - v94.y = minvY3; - v94.z = minvZ3; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; b10 = mini3; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; if(l3 > 0) { l3 = 1 / Math.sqrt(l3); } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v95 = closest; - v95.x = minvX3; - v95.y = minvY3; - v95.z = minvZ3; + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; b10 = 7; } - var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d21 < mind1) { + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d6 < mind1) { mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d21; - var v96 = closest; - minvX1 = v96.x; - minvY1 = v96.y; - minvZ1 = v96.z; + mind1 = d6; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } - if(d142 * sign < 0) { - var v130; + if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { var v1X14; var v1Y14; var v1Z14; - var v220; var v2X14; var v2Y14; var v2Z14; - var v316; var v3X4; var v3Y4; var v3Z4; - var v1214; var v12X14; var v12Y14; var v12Z14; - var v234; var v23X4; var v23Y4; var v23Z4; - var v317; var v31X3; var v31Y3; var v31Z3; - var v97 = vec11; - v1X14 = v97.x; - v1Y14 = v97.y; - v1Z14 = v97.z; - var v98 = vec21; - v2X14 = v98.x; - v2Y14 = v98.y; - v2Z14 = v98.z; - var v99 = vec4; - v3X4 = v99.x; - v3Y4 = v99.y; - v3Z4 = v99.z; + v1X14 = vec11.x; + v1Y14 = vec11.y; + v1Z14 = vec11.z; + v2X14 = vec21.x; + v2Y14 = vec21.y; + v2Z14 = vec21.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; v12X14 = v2X14 - v1X14; v12Y14 = v2Y14 - v1Y14; v12Z14 = v2Z14 - v1Z14; @@ -11186,39 +10750,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X3 = v1X14 - v3X4; v31Y3 = v1Y14 - v3Y4; v31Z3 = v1Z14 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n124; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; var n12X3; var n12Y3; var n12Z3; - var n233; var n23X3; var n23Y3; var n23Z3; - var n313; var n31X3; var n31Y3; var n31Z3; - n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; - n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; - n12Z3 = v12X14 * nY4 - v12Y14 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; - var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; + n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; + n12Z3 = v12X14 * nY3 - v12Y14 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; var mind4 = -1; - var minv4; var minvX4; var minvY4; var minvZ4; @@ -11226,270 +10782,223 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX4 = 0; minvY4 = 0; minvZ4 = 0; - if(d124 < 0) { - var v132; + if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { var v1X15; var v1Y15; var v1Z15; - var v221; var v2X15; var v2Y15; var v2Z15; - var v100 = vec11; - v1X15 = v100.x; - v1Y15 = v100.y; - v1Z15 = v100.z; - var v101 = vec21; - v2X15 = v101.x; - v2Y15 = v101.y; - v2Z15 = v101.z; - var v1215; + v1X15 = vec11.x; + v1Y15 = vec11.y; + v1Z15 = vec11.z; + v2X15 = vec21.x; + v2Y15 = vec21.y; + v2Z15 = vec21.z; var v12X15; var v12Y15; var v12Z15; v12X15 = v2X15 - v1X15; v12Y15 = v2Y15 - v1Y15; v12Z15 = v2Z15 - v1Z15; - var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d22; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); var b11; if(t10 < 0) { - var v102 = closest; - v102.x = v1X15; - v102.y = v1Y15; - v102.z = v1Z15; + closest.x = v1X15; + closest.y = v1Y15; + closest.z = v1Z15; b11 = 1; } else if(t10 > 1) { - var v103 = closest; - v103.x = v2X15; - v103.y = v2Y15; - v103.z = v2Z15; + closest.x = v2X15; + closest.y = v2Y15; + closest.z = v2Z15; b11 = 2; } else { - var p10; var pX10; var pY10; var pZ10; pX10 = v1X15 + v12X15 * t10; pY10 = v1Y15 + v12Y15 * t10; pZ10 = v1Z15 + v12Z15 * t10; - var v104 = closest; - v104.x = pX10; - v104.y = pY10; - v104.z = pZ10; + closest.x = pX10; + closest.y = pY10; + closest.z = pZ10; b11 = 3; } - var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini4 = b11; - mind4 = d24; - var v105 = closest; - minvX4 = v105.x; - minvY4 = v105.y; - minvZ4 = v105.z; + mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } - if(d233 < 0) { - var v133; + if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { var v1X16; var v1Y16; var v1Z16; - var v222; var v2X16; var v2Y16; var v2Z16; - var v106 = vec21; - v1X16 = v106.x; - v1Y16 = v106.y; - v1Z16 = v106.z; - var v107 = vec4; - v2X16 = v107.x; - v2Y16 = v107.y; - v2Z16 = v107.z; - var v1216; + v1X16 = vec21.x; + v1Y16 = vec21.y; + v1Z16 = vec21.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; var v12X16; var v12Y16; var v12Z16; v12X16 = v2X16 - v1X16; v12Y16 = v2Y16 - v1Y16; v12Z16 = v2Z16 - v1Z16; - var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d25; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); var b12; if(t11 < 0) { - var v108 = closest; - v108.x = v1X16; - v108.y = v1Y16; - v108.z = v1Z16; + closest.x = v1X16; + closest.y = v1Y16; + closest.z = v1Z16; b12 = 1; } else if(t11 > 1) { - var v109 = closest; - v109.x = v2X16; - v109.y = v2Y16; - v109.z = v2Z16; + closest.x = v2X16; + closest.y = v2Y16; + closest.z = v2Z16; b12 = 2; } else { - var p11; var pX11; var pY11; var pZ11; pX11 = v1X16 + v12X16 * t11; pY11 = v1Y16 + v12Y16 * t11; pZ11 = v1Z16 + v12Z16 * t11; - var v134 = closest; - v134.x = pX11; - v134.y = pY11; - v134.z = pZ11; + closest.x = pX11; + closest.y = pY11; + closest.z = pZ11; b12 = 3; } - var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d26 < mind4) { + var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d7 < mind4) { mini4 = b12 << 1; - mind4 = d26; - var v135 = closest; - minvX4 = v135.x; - minvY4 = v135.y; - minvZ4 = v135.z; + mind4 = d7; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } } - if(d313 < 0) { - var v136; + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { var v1X17; var v1Y17; var v1Z17; - var v223; var v2X17; var v2Y17; var v2Z17; - var v137 = vec11; - v1X17 = v137.x; - v1Y17 = v137.y; - v1Z17 = v137.z; - var v138 = vec4; - v2X17 = v138.x; - v2Y17 = v138.y; - v2Z17 = v138.z; - var v1217; + v1X17 = vec11.x; + v1Y17 = vec11.y; + v1Z17 = vec11.z; + v2X17 = vec4.x; + v2Y17 = vec4.y; + v2Z17 = vec4.z; var v12X17; var v12Y17; var v12Z17; v12X17 = v2X17 - v1X17; v12Y17 = v2Y17 - v1Y17; v12Z17 = v2Z17 - v1Z17; - var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / d27; + t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); var b13; if(t12 < 0) { - var v139 = closest; - v139.x = v1X17; - v139.y = v1Y17; - v139.z = v1Z17; + closest.x = v1X17; + closest.y = v1Y17; + closest.z = v1Z17; b13 = 1; } else if(t12 > 1) { - var v140 = closest; - v140.x = v2X17; - v140.y = v2Y17; - v140.z = v2Z17; + closest.x = v2X17; + closest.y = v2Y17; + closest.z = v2Z17; b13 = 2; } else { - var p12; var pX12; var pY12; var pZ12; pX12 = v1X17 + v12X17 * t12; pY12 = v1Y17 + v12Y17 * t12; pZ12 = v1Z17 + v12Z17 * t12; - var v142 = closest; - v142.x = pX12; - v142.y = pY12; - v142.z = pZ12; + closest.x = pX12; + closest.y = pY12; + closest.z = pZ12; b13 = 3; } - var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d28 < mind4) { + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d8 < mind4) { mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d28; - var v143 = closest; - minvX4 = v143.x; - minvY4 = v143.y; - minvZ4 = v143.z; + mind4 = d8; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; } } var b14; if(mind4 > 0) { - var v144 = closest; - v144.x = minvX4; - v144.y = minvY4; - v144.z = minvZ4; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; b14 = mini4; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; if(l4 > 0) { l4 = 1 / Math.sqrt(l4); } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v145 = closest; - v145.x = minvX4; - v145.y = minvY4; - v145.z = minvZ4; + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; b14 = 7; } - var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d29 < mind1) { + var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d9 < mind1) { mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d29; - var v146 = closest; - minvX1 = v146.x; - minvY1 = v146.y; - minvZ1 = v146.z; + mind1 = d9; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } - if(d243 * sign < 0) { - var v147; + if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { var v1X18; var v1Y18; var v1Z18; - var v224; var v2X18; var v2Y18; var v2Z18; - var v318; var v3X5; var v3Y5; var v3Z5; - var v1218; var v12X18; var v12Y18; var v12Z18; - var v235; var v23X5; var v23Y5; var v23Z5; - var v319; var v31X4; var v31Y4; var v31Z4; - var v148 = vec21; - v1X18 = v148.x; - v1Y18 = v148.y; - v1Z18 = v148.z; - var v149 = vec31; - v2X18 = v149.x; - v2Y18 = v149.y; - v2Z18 = v149.z; - var v150 = vec4; - v3X5 = v150.x; - v3Y5 = v150.y; - v3Z5 = v150.z; + v1X18 = vec21.x; + v1Y18 = vec21.y; + v1Z18 = vec21.z; + v2X18 = vec31.x; + v2Y18 = vec31.y; + v2Z18 = vec31.z; + v3X5 = vec4.x; + v3Y5 = vec4.y; + v3Z5 = vec4.z; v12X18 = v2X18 - v1X18; v12Y18 = v2Y18 - v1Y18; v12Z18 = v2Z18 - v1Z18; @@ -11499,39 +11008,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X4 = v1X18 - v3X5; v31Y4 = v1Y18 - v3Y5; v31Z4 = v1Z18 - v3Z5; - var n5; - var nX5; - var nY5; - var nZ5; - nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n125; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; var n12X4; var n12Y4; var n12Z4; - var n234; var n23X4; var n23Y4; var n23Z4; - var n314; var n31X4; var n31Y4; var n31Z4; - n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; - n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; - n12Z4 = v12X18 * nY5 - v12Y18 * nX5; - n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; - n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; - n23Z4 = v23X5 * nY5 - v23Y5 * nX5; - n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; - n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; - n31Z4 = v31X4 * nY5 - v31Y4 * nX5; - var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; - var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; - var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; + n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; + n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; + n12Z4 = v12X18 * nY4 - v12Y18 * nX4; + n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; + n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; + n23Z4 = v23X5 * nY4 - v23Y5 * nX4; + n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; + n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; + n31Z4 = v31X4 * nY4 - v31Y4 * nX4; var mind5 = -1; - var minv5; var minvX5; var minvY5; var minvZ5; @@ -11539,365 +11040,299 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvX5 = 0; minvY5 = 0; minvZ5 = 0; - if(d125 < 0) { - var v151; + if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { var v1X19; var v1Y19; var v1Z19; - var v225; var v2X19; var v2Y19; var v2Z19; - var v152 = vec21; - v1X19 = v152.x; - v1Y19 = v152.y; - v1Z19 = v152.z; - var v153 = vec31; - v2X19 = v153.x; - v2Y19 = v153.y; - v2Z19 = v153.z; - var v1219; + v1X19 = vec21.x; + v1Y19 = vec21.y; + v1Z19 = vec21.z; + v2X19 = vec31.x; + v2Y19 = vec31.y; + v2Z19 = vec31.z; var v12X19; var v12Y19; var v12Z19; v12X19 = v2X19 - v1X19; v12Y19 = v2Y19 - v1Y19; v12Z19 = v2Z19 - v1Z19; - var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / d30; + t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); var b15; if(t13 < 0) { - var v154 = closest; - v154.x = v1X19; - v154.y = v1Y19; - v154.z = v1Z19; + closest.x = v1X19; + closest.y = v1Y19; + closest.z = v1Z19; b15 = 1; } else if(t13 > 1) { - var v155 = closest; - v155.x = v2X19; - v155.y = v2Y19; - v155.z = v2Z19; + closest.x = v2X19; + closest.y = v2Y19; + closest.z = v2Z19; b15 = 2; } else { - var p13; var pX13; var pY13; var pZ13; pX13 = v1X19 + v12X19 * t13; pY13 = v1Y19 + v12Y19 * t13; pZ13 = v1Z19 + v12Z19 * t13; - var v156 = closest; - v156.x = pX13; - v156.y = pY13; - v156.z = pZ13; + closest.x = pX13; + closest.y = pY13; + closest.z = pZ13; b15 = 3; } - var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini5 = b15; - mind5 = d32; - var v157 = closest; - minvX5 = v157.x; - minvY5 = v157.y; - minvZ5 = v157.z; + mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } - if(d234 < 0) { - var v158; + if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { var v1X20; var v1Y20; var v1Z20; - var v226; var v2X20; var v2Y20; var v2Z20; - var v159 = vec31; - v1X20 = v159.x; - v1Y20 = v159.y; - v1Z20 = v159.z; - var v160 = vec4; - v2X20 = v160.x; - v2Y20 = v160.y; - v2Z20 = v160.z; - var v1220; + v1X20 = vec31.x; + v1Y20 = vec31.y; + v1Z20 = vec31.z; + v2X20 = vec4.x; + v2Y20 = vec4.y; + v2Z20 = vec4.z; var v12X20; var v12Y20; var v12Z20; v12X20 = v2X20 - v1X20; v12Y20 = v2Y20 - v1Y20; v12Z20 = v2Z20 - v1Z20; - var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / d33; + t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); var b16; if(t14 < 0) { - var v161 = closest; - v161.x = v1X20; - v161.y = v1Y20; - v161.z = v1Z20; + closest.x = v1X20; + closest.y = v1Y20; + closest.z = v1Z20; b16 = 1; } else if(t14 > 1) { - var v162 = closest; - v162.x = v2X20; - v162.y = v2Y20; - v162.z = v2Z20; + closest.x = v2X20; + closest.y = v2Y20; + closest.z = v2Z20; b16 = 2; } else { - var p14; var pX14; var pY14; var pZ14; pX14 = v1X20 + v12X20 * t14; pY14 = v1Y20 + v12Y20 * t14; pZ14 = v1Z20 + v12Z20 * t14; - var v163 = closest; - v163.x = pX14; - v163.y = pY14; - v163.z = pZ14; + closest.x = pX14; + closest.y = pY14; + closest.z = pZ14; b16 = 3; } - var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d34 < mind5) { + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d10 < mind5) { mini5 = b16 << 1; - mind5 = d34; - var v164 = closest; - minvX5 = v164.x; - minvY5 = v164.y; - minvZ5 = v164.z; + mind5 = d10; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } } - if(d314 < 0) { - var v165; + if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { var v1X21; var v1Y21; var v1Z21; - var v227; var v2X21; var v2Y21; var v2Z21; - var v166 = vec21; - v1X21 = v166.x; - v1Y21 = v166.y; - v1Z21 = v166.z; - var v167 = vec4; - v2X21 = v167.x; - v2Y21 = v167.y; - v2Z21 = v167.z; - var v1221; + v1X21 = vec21.x; + v1Y21 = vec21.y; + v1Z21 = vec21.z; + v2X21 = vec4.x; + v2Y21 = vec4.y; + v2Z21 = vec4.z; var v12X21; var v12Y21; var v12Z21; v12X21 = v2X21 - v1X21; v12Y21 = v2Y21 - v1Y21; v12Z21 = v2Z21 - v1Z21; - var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / d35; + t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); var b17; if(t15 < 0) { - var v168 = closest; - v168.x = v1X21; - v168.y = v1Y21; - v168.z = v1Z21; + closest.x = v1X21; + closest.y = v1Y21; + closest.z = v1Z21; b17 = 1; } else if(t15 > 1) { - var v169 = closest; - v169.x = v2X21; - v169.y = v2Y21; - v169.z = v2Z21; + closest.x = v2X21; + closest.y = v2Y21; + closest.z = v2Z21; b17 = 2; } else { - var p15; var pX15; var pY15; var pZ15; pX15 = v1X21 + v12X21 * t15; pY15 = v1Y21 + v12Y21 * t15; pZ15 = v1Z21 + v12Z21 * t15; - var v170 = closest; - v170.x = pX15; - v170.y = pY15; - v170.z = pZ15; + closest.x = pX15; + closest.y = pY15; + closest.z = pZ15; b17 = 3; } - var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d36 < mind5) { + var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d11 < mind5) { mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d36; - var v171 = closest; - minvX5 = v171.x; - minvY5 = v171.y; - minvZ5 = v171.z; + mind5 = d11; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; } } var b18; if(mind5 > 0) { - var v172 = closest; - v172.x = minvX5; - v172.y = minvY5; - v172.z = minvZ5; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; b18 = mini5; } else { - var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; if(l5 > 0) { l5 = 1 / Math.sqrt(l5); } - nX5 *= l5; - nY5 *= l5; - nZ5 *= l5; - var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; - var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - l24 = dn4 / l24; - minvX5 = nX5 * l24; - minvY5 = nY5 * l24; - minvZ5 = nZ5 * l24; - var v173 = closest; - v173.x = minvX5; - v173.y = minvY5; - v173.z = minvZ5; + nX4 *= l5; + nY4 *= l5; + nZ4 *= l5; + var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; + minvX5 = nX4 * l24; + minvY5 = nY4 * l24; + minvZ5 = nZ4 * l24; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; b18 = 7; } - var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d37 < mind1) { + var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d12 < mind1) { mini1 = b18 << 1; - mind1 = d37; - var v174 = closest; - minvX1 = v174.x; - minvY1 = v174.y; - minvZ1 = v174.z; + mind1 = d12; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } if(mind1 > 0) { - var v175 = closest; - v175.x = minvX1; - v175.y = minvY1; - v175.z = minvZ1; - v4 = mini1; + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v3 = mini1; } else { closest.zero(); - v4 = 15; + v3 = 15; } break; } - this.shrinkSimplex(v4); - if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + this.shrinkSimplex(v3); + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(lambda == 0 || this.simplexSize == 4) { hit.fraction = lambda; return false; } this.interpolateClosestPoints(); hit.fraction = lambda; - var _this3 = hit.normal; - _this3.x = dir.x; - _this3.y = dir.y; - _this3.z = dir.z; - var _this4 = _this3; - var invLen = Math.sqrt(_this4.x * _this4.x + _this4.y * _this4.y + _this4.z * _this4.z); + var _this1 = hit.normal; + _this1.x = dir.x; + _this1.y = dir.y; + _this1.z = dir.z; + var invLen = Math.sqrt(_this1.x * _this1.x + _this1.y * _this1.y + _this1.z * _this1.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx2 = _this4.x * invLen; - var ty2 = _this4.y * invLen; - var tz2 = _this4.z * invLen; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; - var _this5 = hit.position; - var v176 = this.closestPoint1; - _this5.x = v176.x; - _this5.y = v176.y; - _this5.z = v176.z; - var _this6 = _this5; - var tx3 = _this6.x + tl1.x * lambda; - var ty3 = _this6.y + tl1.y * lambda; - var tz3 = _this6.z + tl1.z * lambda; - _this6.x = tx3; - _this6.y = ty3; - _this6.z = tz3; + _this1.x *= invLen; + _this1.y *= invLen; + _this1.z *= invLen; + var _this2 = hit.position; + var v7 = this.closestPoint1; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; + _this2.x += tl1.x * lambda; + _this2.y += tl1.y * lambda; + _this2.z += tl1.z * lambda; return true; } dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; - var _this7 = dir; - var tx4 = -_this7.x; - var ty4 = -_this7.y; - var tz4 = -_this7.z; - _this7.x = tx4; - _this7.y = ty4; - _this7.z = tz4; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v177 = this.w1[this.simplexSize]; - v177.x = this.tf1._positionX; - v177.y = this.tf1._positionY; - v177.z = this.tf1._positionZ; + var v8 = this.w1[this.simplexSize]; + v8.x = this.tf1._positionX; + v8.y = this.tf1._positionY; + v8.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this8 = this.s[this.simplexSize]; - var v178 = this.w1[this.simplexSize]; - _this8.x = v178.x; - _this8.y = v178.y; - _this8.z = v178.z; - var _this9 = _this8; - var v179 = this.w2[this.simplexSize]; - var tx5 = _this9.x - v179.x; - var ty5 = _this9.y - v179.y; - var tz5 = _this9.z - v179.z; - _this9.x = tx5; - _this9.y = ty5; - _this9.z = tz5; - var _this10 = s[this.simplexSize]; - var tx6 = _this10.x - rayX.x; - var ty6 = _this10.y - rayX.y; - var tz6 = _this10.z - rayX.z; - _this10.x = tx6; - _this10.y = ty6; - _this10.z = tz6; - if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + var _this3 = this.s[this.simplexSize]; + var v9 = this.w1[this.simplexSize]; + _this3.x = v9.x; + _this3.y = v9.y; + _this3.z = v9.z; + var v10 = this.w2[this.simplexSize]; + _this3.x -= v10.x; + _this3.y -= v10.y; + _this3.z -= v10.z; + var _this4 = s[this.simplexSize]; + _this4.x -= rayX.x; + _this4.y -= rayX.y; + _this4.z -= rayX.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var p16 = s[this.simplexSize]; - var n6 = dir; - var pn = p16.x * n6.x + p16.y * n6.y + p16.z * n6.z; + var p = s[this.simplexSize]; + var pn = p.x * dir.x + p.y * dir.y + p.z * dir.z; if(pn < 0) { - if(rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z >= 0) { + if(rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z >= 0) { return false; } - var dLambda = pn / (rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z); + var dLambda = pn / (rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z); lambda += dLambda; if(lambda >= 1) { return false; } - var tx7 = rayX.x + rayR.x * dLambda; - var ty7 = rayX.y + rayR.y * dLambda; - var tz7 = rayX.z + rayR.z * dLambda; - rayX.x = tx7; - rayX.y = ty7; - rayX.z = tz7; - var _g2 = 0; - var _g1 = this.simplexSize + 1; - while(_g2 < _g1) { - var i = _g2++; - var _this11 = s[i]; + rayX.x += rayR.x * dLambda; + rayX.y += rayR.y * dLambda; + rayX.z += rayR.z * dLambda; + var _g1 = 0; + var _g2 = this.simplexSize + 1; + while(_g1 < _g2) { + var _this5 = s[_g1++]; var s1 = -dLambda; - var tx8 = _this11.x + rayR.x * s1; - var ty8 = _this11.y + rayR.y * s1; - var tz8 = _this11.z + rayR.z * s1; - _this11.x = tx8; - _this11.y = ty8; - _this11.z = tz8; + _this5.x += rayR.x * s1; + _this5.y += rayR.y * s1; + _this5.z += rayR.z * s1; } } var duplicate = false; - var _g21 = 0; - var _g11 = this.simplexSize; - while(_g21 < _g11) { - var i1 = _g21++; - var dx = s[i1].x - s[this.simplexSize].x; - var dy = s[i1].y - s[this.simplexSize].y; - var dz = s[i1].z - s[this.simplexSize].z; - if(dx * dx + dy * dy + dz * dz < eps2) { + var _g11 = 0; + var _g21 = this.simplexSize; + while(_g11 < _g21) { + var i = _g11++; + var dx = s[i].x - s[this.simplexSize].x; + var dy = s[i].y - s[this.simplexSize].y; + var dz = s[i].z - s[this.simplexSize].z; + if(dx * dx + dy * dy + dz * dz < 1e-008) { duplicate = true; break; } @@ -11910,8 +11345,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { return false; } ,interpolateClosestPoints: function() { - var _g = this.simplexSize; - switch(_g) { + switch(this.simplexSize) { case 1: var _this = this.closestPoint1; var v = this.w1[0]; @@ -11925,7 +11359,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this1.z = v1.z; break; case 2: - var c; var cX; var cY; var cZ; @@ -11933,42 +11366,24 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cX = v2.x; cY = v2.y; cZ = v2.z; - var s0; var s0X; var s0Y; var s0Z; - var w10; var w10X; var w10Y; var w10Z; - var w20; var w20X; var w20Y; var w20Z; - var s1; var s1X; var s1Y; var s1Z; - var w11; var w11X; var w11Y; var w11Z; - var w21; var w21X; var w21Y; var w21Z; - var s2; - var s2X; - var s2Y; - var s2Z; - var w12; - var w12X; - var w12Y; - var w12Z; - var w22; - var w22X; - var w22Y; - var w22Z; var v3 = this.s[0]; s0X = v3.x; s0Y = v3.y; @@ -11993,19 +11408,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { w21X = v8.x; w21Y = v8.y; w21Z = v8.z; - var v9 = this.s[2]; - s2X = v9.x; - s2Y = v9.y; - s2Z = v9.z; - var v10 = this.w1[2]; - w12X = v10.x; - w12Y = v10.y; - w12Z = v10.z; - var v11 = this.w2[2]; - w22X = v11.x; - w22Y = v11.y; - w22Z = v11.z; - var s01; var s01X; var s01Y; var s01Z; @@ -12016,7 +11418,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(invDet != 0) { invDet = 1 / invDet; } - var s0c; var s0cX; var s0cY; var s0cZ; @@ -12024,15 +11425,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { s0cY = cY - s0Y; s0cZ = cZ - s0Z; var t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; - var diff; var diffX; var diffY; var diffZ; - var cp1; var cp1X; var cp1Y; var cp1Z; - var cp2; var cp2X; var cp2Y; var cp2Z; @@ -12048,114 +11446,101 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp2X = w20X + diffX * t; cp2Y = w20Y + diffY * t; cp2Z = w20Z + diffZ * t; - var v12 = this.closestPoint1; - v12.x = cp1X; - v12.y = cp1Y; - v12.z = cp1Z; - var v13 = this.closestPoint2; - v13.x = cp2X; - v13.y = cp2Y; - v13.z = cp2Z; + var v9 = this.closestPoint1; + v9.x = cp1X; + v9.y = cp1Y; + v9.z = cp1Z; + var v10 = this.closestPoint2; + v10.x = cp2X; + v10.y = cp2Y; + v10.z = cp2Z; break; case 3: - var c1; var cX1; var cY1; var cZ1; - var v14 = this.closest; - cX1 = v14.x; - cY1 = v14.y; - cZ1 = v14.z; - var s02; + var v11 = this.closest; + cX1 = v11.x; + cY1 = v11.y; + cZ1 = v11.z; var s0X1; var s0Y1; var s0Z1; - var w101; var w10X1; var w10Y1; var w10Z1; - var w201; var w20X1; var w20Y1; var w20Z1; - var s11; var s1X1; var s1Y1; var s1Z1; - var w111; var w11X1; var w11Y1; var w11Z1; - var w211; var w21X1; var w21Y1; var w21Z1; - var s21; - var s2X1; - var s2Y1; - var s2Z1; - var w121; - var w12X1; - var w12Y1; - var w12Z1; - var w221; - var w22X1; - var w22Y1; - var w22Z1; - var v15 = this.s[0]; - s0X1 = v15.x; - s0Y1 = v15.y; - s0Z1 = v15.z; - var v16 = this.w1[0]; - w10X1 = v16.x; - w10Y1 = v16.y; - w10Z1 = v16.z; - var v17 = this.w2[0]; - w20X1 = v17.x; - w20Y1 = v17.y; - w20Z1 = v17.z; - var v18 = this.s[1]; - s1X1 = v18.x; - s1Y1 = v18.y; - s1Z1 = v18.z; - var v19 = this.w1[1]; - w11X1 = v19.x; - w11Y1 = v19.y; - w11Z1 = v19.z; - var v20 = this.w2[1]; - w21X1 = v20.x; - w21Y1 = v20.y; - w21Z1 = v20.z; - var v21 = this.s[2]; - s2X1 = v21.x; - s2Y1 = v21.y; - s2Z1 = v21.z; - var v22 = this.w1[2]; - w12X1 = v22.x; - w12Y1 = v22.y; - w12Z1 = v22.z; - var v23 = this.w2[2]; - w22X1 = v23.x; - w22Y1 = v23.y; - w22Z1 = v23.z; - var s011; + var s2X; + var s2Y; + var s2Z; + var w12X; + var w12Y; + var w12Z; + var w22X; + var w22Y; + var w22Z; + var v12 = this.s[0]; + s0X1 = v12.x; + s0Y1 = v12.y; + s0Z1 = v12.z; + var v13 = this.w1[0]; + w10X1 = v13.x; + w10Y1 = v13.y; + w10Z1 = v13.z; + var v14 = this.w2[0]; + w20X1 = v14.x; + w20Y1 = v14.y; + w20Z1 = v14.z; + var v15 = this.s[1]; + s1X1 = v15.x; + s1Y1 = v15.y; + s1Z1 = v15.z; + var v16 = this.w1[1]; + w11X1 = v16.x; + w11Y1 = v16.y; + w11Z1 = v16.z; + var v17 = this.w2[1]; + w21X1 = v17.x; + w21Y1 = v17.y; + w21Z1 = v17.z; + var v18 = this.s[2]; + s2X = v18.x; + s2Y = v18.y; + s2Z = v18.z; + var v19 = this.w1[2]; + w12X = v19.x; + w12Y = v19.y; + w12Z = v19.z; + var v20 = this.w2[2]; + w22X = v20.x; + w22Y = v20.y; + w22Z = v20.z; var s01X1; var s01Y1; var s01Z1; - var s021; var s02X; var s02Y; var s02Z; - var s0c1; var s0cX1; var s0cY1; var s0cZ1; s01X1 = s1X1 - s0X1; s01Y1 = s1Y1 - s0Y1; s01Z1 = s1Z1 - s0Z1; - s02X = s2X1 - s0X1; - s02Y = s2Y1 - s0Y1; - s02Z = s2Z1 - s0Z1; + s02X = s2X - s0X1; + s02Y = s2Y - s0Y1; + s02Z = s2Z - s0Z1; s0cX1 = cX1 - s0X1; s0cY1 = cY1 - s0Y1; s0cZ1 = cZ1 - s0Z1; @@ -12170,15 +11555,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } var s = (d1c * d22 - d2c * d12) * invDet1; var t1 = (-d1c * d12 + d2c * d11) * invDet1; - var diff1; var diffX1; var diffY1; var diffZ1; - var cp11; var cp1X1; var cp1Y1; var cp1Z1; - var cp21; var cp2X1; var cp2Y1; var cp2Z1; @@ -12188,9 +11570,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp1X1 = w10X1 + diffX1 * s; cp1Y1 = w10Y1 + diffY1 * s; cp1Z1 = w10Z1 + diffZ1 * s; - diffX1 = w12X1 - w10X1; - diffY1 = w12Y1 - w10Y1; - diffZ1 = w12Z1 - w10Z1; + diffX1 = w12X - w10X1; + diffY1 = w12Y - w10Y1; + diffZ1 = w12Z - w10Z1; cp1X1 += diffX1 * t1; cp1Y1 += diffY1 * t1; cp1Z1 += diffZ1 * t1; @@ -12200,20 +11582,20 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp2X1 = w20X1 + diffX1 * s; cp2Y1 = w20Y1 + diffY1 * s; cp2Z1 = w20Z1 + diffZ1 * s; - diffX1 = w22X1 - w20X1; - diffY1 = w22Y1 - w20Y1; - diffZ1 = w22Z1 - w20Z1; + diffX1 = w22X - w20X1; + diffY1 = w22Y - w20Y1; + diffZ1 = w22Z - w20Z1; cp2X1 += diffX1 * t1; cp2Y1 += diffY1 * t1; cp2Z1 += diffZ1 * t1; - var v24 = this.closestPoint1; - v24.x = cp1X1; - v24.y = cp1Y1; - v24.z = cp1Z1; - var v25 = this.closestPoint2; - v25.x = cp2X1; - v25.y = cp2Y1; - v25.z = cp2Z1; + var v21 = this.closestPoint1; + v21.x = cp1X1; + v21.y = cp1Y1; + v21.z = cp1Z1; + var v22 = this.closestPoint2; + v22.x = cp2X1; + v22.y = cp2Y1; + v22.z = cp2Z1; break; default: throw new Error("!?"); @@ -12232,13 +11614,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = _this; - var tx = -_this1.x; - var ty = -_this1.y; - var tz = -_this1.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; } ,shrinkSimplex: function(vertexBits) { this.simplexSize = vertexBits; @@ -12450,11 +11828,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } } ,computeWitnessPoint1: function(addMargin) { - var tmp; var tmpX; var tmpY; var tmpZ; - var idir; var idirX; var idirY; var idirZ; @@ -12462,7 +11838,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir1; var ldir1X; var ldir1Y; var ldir1Z; @@ -12475,7 +11850,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { ldir1X = __tmp__X; ldir1Y = __tmp__Y; ldir1Z = __tmp__Z; - var iw1; var iw1X; var iw1Y; var iw1Z; @@ -12490,21 +11864,15 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; var _this1 = this.w1[this.simplexSize]; var v2 = this.dir; var s = this.c1._gjkMargin; - var tx1 = _this1.x + v2.x * s; - var ty1 = _this1.y + v2.y * s; - var tz1 = _this1.z + v2.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; + _this1.x += v2.x * s; + _this1.y += v2.y * s; + _this1.z += v2.z * s; } var v3 = this.w1[this.simplexSize]; tmpX = v3.x; @@ -12532,11 +11900,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v5.z = idirZ; } ,computeWitnessPoint2: function(addMargin) { - var tmp; var tmpX; var tmpY; var tmpZ; - var idir; var idirX; var idirY; var idirZ; @@ -12544,7 +11910,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir2; var ldir2X; var ldir2Y; var ldir2Z; @@ -12560,7 +11925,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { ldir2X = -ldir2X; ldir2Y = -ldir2Y; ldir2Z = -ldir2Z; - var iw2; var iw2X; var iw2Y; var iw2Z; @@ -12575,21 +11939,15 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; var _this1 = this.w2[this.simplexSize]; var v2 = this.dir; var s = this.c2._gjkMargin; - var tx1 = _this1.x + v2.x * s; - var ty1 = _this1.y + v2.y * s; - var tz1 = _this1.z + v2.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; + _this1.x += v2.x * s; + _this1.y += v2.y * s; + _this1.z += v2.z * s; } var v3 = this.w2[this.simplexSize]; tmpX = v3.x; @@ -12619,9 +11977,8 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { ,pointToTetrahedron: function() { var _g = 0; while(_g < 3) { - var i = _g++; var _this = this.dir; - var v = this.baseDirs[i]; + var v = this.baseDirs[_g++]; _this.x = v.x; _this.y = v.y; _this.z = v.z; @@ -12632,42 +11989,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; - var _this2 = _this1; var v2 = this.w2[this.simplexSize]; - var tx = _this2.x - v2.x; - var ty = _this2.y - v2.y; - var tz = _this2.z - v2.z; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; this.simplexSize++; this.lineToTetrahedron(); if(this.simplexSize == 4) { break; } this.simplexSize--; - var _this3 = this.dir; - var tx1 = -_this3.x; - var ty1 = -_this3.y; - var tz1 = -_this3.z; - _this3.x = tx1; - _this3.y = ty1; - _this3.z = tz1; + var _this2 = this.dir; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this4 = this.s[this.simplexSize]; + var _this3 = this.s[this.simplexSize]; var v3 = this.w1[this.simplexSize]; - _this4.x = v3.x; - _this4.y = v3.y; - _this4.z = v3.z; - var _this5 = _this4; + _this3.x = v3.x; + _this3.y = v3.y; + _this3.z = v3.z; var v4 = this.w2[this.simplexSize]; - var tx2 = _this5.x - v4.x; - var ty2 = _this5.y - v4.y; - var tz2 = _this5.z - v4.z; - _this5.x = tx2; - _this5.y = ty2; - _this5.z = tz2; + _this3.x -= v4.x; + _this3.y -= v4.y; + _this3.z -= v4.z; this.simplexSize++; this.lineToTetrahedron(); if(this.simplexSize == 4) { @@ -12677,7 +12023,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } } ,lineToTetrahedron: function() { - var oldDir; var oldDirX; var oldDirY; var oldDirZ; @@ -12685,15 +12030,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { oldDirX = v.x; oldDirY = v.y; oldDirZ = v.z; - var s0; var s0X; var s0Y; var s0Z; - var s1; var s1X; var s1Y; var s1Z; - var lineDir; var lineDirX; var lineDirY; var lineDirZ; @@ -12710,16 +12052,13 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { lineDirZ = s0Z - s1Z; var _g = 0; while(_g < 3) { - var i = _g++; - var baseDir; var baseDirX; var baseDirY; var baseDirZ; - var v3 = this.baseDirs[i]; + var v3 = this.baseDirs[_g++]; baseDirX = v3.x; baseDirY = v3.y; baseDirZ = v3.z; - var newDir; var newDirX; var newDirY; var newDirZ; @@ -12737,42 +12076,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v5.x; _this.y = v5.y; _this.z = v5.z; - var _this1 = _this; var v6 = this.w2[this.simplexSize]; - var tx = _this1.x - v6.x; - var ty = _this1.y - v6.y; - var tz = _this1.z - v6.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + _this.x -= v6.x; + _this.y -= v6.y; + _this.z -= v6.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { break; } this.simplexSize--; - var _this2 = this.dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + var _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; + var _this2 = this.s[this.simplexSize]; var v7 = this.w1[this.simplexSize]; - _this3.x = v7.x; - _this3.y = v7.y; - _this3.z = v7.z; - var _this4 = _this3; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; var v8 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v8.x; - var ty2 = _this4.y - v8.y; - var tz2 = _this4.z - v8.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; + _this2.x -= v8.x; + _this2.y -= v8.y; + _this2.z -= v8.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { @@ -12786,7 +12114,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v9.z = oldDirZ; } ,triangleToTetrahedron: function() { - var oldDir; var oldDirX; var oldDirY; var oldDirZ; @@ -12795,23 +12122,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { oldDirY = v.y; oldDirZ = v.z; while(true) { - var s0; var s0X; var s0Y; var s0Z; - var s1; var s1X; var s1Y; var s1Z; - var s2; var s2X; var s2Y; var s2Z; - var s01; var s01X; var s01Y; var s01Z; - var s02; var s02X; var s02Y; var s02Z; @@ -12833,7 +12155,6 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { s02X = s2X - s0X; s02Y = s2Y - s0Y; s02Z = s2Z - s0Z; - var n; var nX; var nY; var nZ; @@ -12851,49 +12172,36 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v5.x; _this.y = v5.y; _this.z = v5.z; - var _this1 = _this; var v6 = this.w2[this.simplexSize]; - var tx = _this1.x - v6.x; - var ty = _this1.y - v6.y; - var tz = _this1.z - v6.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + _this.x -= v6.x; + _this.y -= v6.y; + _this.z -= v6.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; } this.simplexSize--; - var _this2 = this.dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + var _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; + var _this2 = this.s[this.simplexSize]; var v7 = this.w1[this.simplexSize]; - _this3.x = v7.x; - _this3.y = v7.y; - _this3.z = v7.z; - var _this4 = _this3; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; var v8 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v8.x; - var ty2 = _this4.y - v8.y; - var tz2 = _this4.z - v8.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; + _this2.x -= v8.x; + _this2.y -= v8.y; + _this2.z -= v8.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; } this.simplexSize--; - if(!false) { - break; - } + break; } var v9 = this.dir; v9.x = oldDirX; @@ -12901,16 +12209,13 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v9.z = oldDirZ; } ,isValidTetrahedron: function() { - var e00 = this.s[1].x - this.s[0].x; - var e01 = this.s[1].y - this.s[0].y; - var e02 = this.s[1].z - this.s[0].z; var e10 = this.s[2].x - this.s[0].x; var e11 = this.s[2].y - this.s[0].y; var e12 = this.s[2].z - this.s[0].z; var e20 = this.s[3].x - this.s[0].x; var e21 = this.s[3].y - this.s[0].y; var e22 = this.s[3].z - this.s[0].z; - var det = e00 * (e11 * e22 - e12 * e21) - e01 * (e10 * e22 - e12 * e20) + e02 * (e10 * e21 - e11 * e20); + var det = (this.s[1].x - this.s[0].x) * (e11 * e22 - e12 * e21) - (this.s[1].y - this.s[0].y) * (e10 * e22 - e12 * e20) + (this.s[1].z - this.s[0].z) * (e10 * e21 - e11 * e20); if(!(det > 1e-12)) { return det < -1e-12; } else { @@ -12992,18 +12297,16 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var witness1 = this.w1[0]; var witness2 = this.w2[0]; var count = 0; - var maxIterations = 40; - while(count < maxIterations) { + while(count < 40) { var f = this.polyhedron._triangleList; - var mind = 1.0 / 0; + var mind = 1e65536; var minf = null; while(f != null) { - var n = f._next; if(f._distanceSq < mind) { mind = f._distanceSq; minf = f; } - f = n; + f = f._next; } var face = minf; var _this5 = this.dir; @@ -13011,58 +12314,43 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this5.x = v1.x; _this5.y = v1.y; _this5.z = v1.z; - var _this6 = _this5; - var invLen = Math.sqrt(_this6.x * _this6.x + _this6.y * _this6.y + _this6.z * _this6.z); + var invLen = Math.sqrt(_this5.x * _this5.x + _this5.y * _this5.y + _this5.z * _this5.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this6.x * invLen; - var ty = _this6.y * invLen; - var tz = _this6.z * invLen; - _this6.x = tx; - _this6.y = ty; - _this6.z = tz; + _this5.x *= invLen; + _this5.y *= invLen; + _this5.z *= invLen; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this7 = this.s[this.simplexSize]; + var _this6 = this.s[this.simplexSize]; var v2 = this.w1[this.simplexSize]; - _this7.x = v2.x; - _this7.y = v2.y; - _this7.z = v2.z; - var _this8 = _this7; + _this6.x = v2.x; + _this6.y = v2.y; + _this6.z = v2.z; var v3 = this.w2[this.simplexSize]; - var tx1 = _this8.x - v3.x; - var ty1 = _this8.y - v3.y; - var tz1 = _this8.z - v3.z; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; + _this6.x -= v3.x; + _this6.y -= v3.y; + _this6.z -= v3.z; var v0 = face._vertices[0]; var v11 = face._vertices[1]; var v21 = face._vertices[2]; - var _this9 = v0.v; + var _this7 = v0.v; var v4 = this.dir; - var dot1 = _this9.x * v4.x + _this9.y * v4.y + _this9.z * v4.z; var v5 = this.dir; - var dot2 = supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z; - if(dot2 - dot1 < 1e-6 || count == maxIterations - 1) { - var _this10 = this.closest; + if(supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z - (_this7.x * v4.x + _this7.y * v4.y + _this7.z * v4.z) < 1e-6 || count == 39) { + var _this8 = this.closest; var v6 = this.dir; - _this10.x = v6.x; - _this10.y = v6.y; - _this10.z = v6.z; - var _this11 = _this10; - var _this12 = this.dir; + _this8.x = v6.x; + _this8.y = v6.y; + _this8.z = v6.z; + var _this9 = this.dir; var v7 = v0.v; - var _this13 = this.dir; - var s = (_this12.x * v7.x + _this12.y * v7.y + _this12.z * v7.z) / (_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); - var tx2 = _this11.x * s; - var ty2 = _this11.y * s; - var tz2 = _this11.z * s; - _this11.x = tx2; - _this11.y = ty2; - _this11.z = tz2; - var c; + var _this10 = this.dir; + var s = (_this9.x * v7.x + _this9.y * v7.y + _this9.z * v7.z) / (_this10.x * _this10.x + _this10.y * _this10.y + _this10.z * _this10.z); + _this8.x *= s; + _this8.y *= s; + _this8.z *= s; var cX; var cY; var cZ; @@ -13070,39 +12358,30 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cX = v8.x; cY = v8.y; cZ = v8.z; - var s0; var s0X; var s0Y; var s0Z; - var w10; var w10X; var w10Y; var w10Z; - var w20; var w20X; var w20Y; var w20Z; - var s1; var s1X; var s1Y; var s1Z; - var w11; var w11X; var w11Y; var w11Z; - var w21; var w21X; var w21Y; var w21Z; - var s2; var s2X; var s2Y; var s2Z; - var w12; var w12X; var w12Y; var w12Z; - var w22; var w22X; var w22Y; var w22Z; @@ -13142,15 +12421,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { w22X = v18.x; w22Y = v18.y; w22Z = v18.z; - var s01; var s01X; var s01Y; var s01Z; - var s02; var s02X; var s02Y; var s02Z; - var s0c; var s0cX; var s0cY; var s0cZ; @@ -13172,26 +12448,23 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(invDet != 0) { invDet = 1 / invDet; } - var s3 = (d1c * d22 - d2c * d12) * invDet; + var s1 = (d1c * d22 - d2c * d12) * invDet; var t1 = (-d1c * d12 + d2c * d11) * invDet; - var diff; var diffX; var diffY; var diffZ; - var cp1; var cp1X; var cp1Y; var cp1Z; - var cp2; var cp2X; var cp2Y; var cp2Z; diffX = w11X - w10X; diffY = w11Y - w10Y; diffZ = w11Z - w10Z; - cp1X = w10X + diffX * s3; - cp1Y = w10Y + diffY * s3; - cp1Z = w10Z + diffZ * s3; + cp1X = w10X + diffX * s1; + cp1Y = w10Y + diffY * s1; + cp1Z = w10Z + diffZ * s1; diffX = w12X - w10X; diffY = w12Y - w10Y; diffZ = w12Z - w10Z; @@ -13201,9 +12474,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { diffX = w21X - w20X; diffY = w21Y - w20Y; diffZ = w21Z - w20Z; - cp2X = w20X + diffX * s3; - cp2Y = w20Y + diffY * s3; - cp2Z = w20Z + diffZ * s3; + cp2X = w20X + diffX * s1; + cp2Y = w20Y + diffY * s1; + cp2Z = w20Z + diffZ * s1; diffX = w22X - w20X; diffY = w22Y - w20Y; diffZ = w22Z - w20Z; @@ -13218,14 +12491,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v20.x = cp2X; v20.y = cp2Y; v20.z = cp2Z; - var _this14 = this.closest; - this.depth = Math.sqrt(_this14.x * _this14.x + _this14.y * _this14.y + _this14.z * _this14.z); + var _this11 = this.closest; + this.depth = Math.sqrt(_this11.x * _this11.x + _this11.y * _this11.y + _this11.z * _this11.z); return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED; } - var _this15 = this.polyhedron; - var first4 = _this15._vertexPool; + var _this12 = this.polyhedron; + var first4 = _this12._vertexPool; if(first4 != null) { - _this15._vertexPool = first4._next; + _this12._vertexPool = first4._next; first4._next = null; } else { first4 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); @@ -13249,121 +12522,96 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } ,rayCast: function(c,tf,begin,end,hit) { var tf1 = this.tempTransform; - var tf2 = tf; - var v = begin; - tf1._positionX = v.x; - tf1._positionY = v.y; - tf1._positionZ = v.z; + tf1._positionX = begin.x; + tf1._positionY = begin.y; + tf1._positionZ = begin.z; var tl1 = this.tl1; var tl2 = this.tl2; tl1.x = end.x; tl1.y = end.y; tl1.z = end.z; - var _this = tl1; - var tx = _this.x - begin.x; - var ty = _this.y - begin.y; - var tz = _this.z - begin.z; - _this.x = tx; - _this.y = ty; - _this.z = tz; + tl1.x -= begin.x; + tl1.y -= begin.y; + tl1.z -= begin.z; tl2.zero(); - return this.convexCastImpl(null,c,tf1,tf2,tl1,tl2,hit); + return this.convexCastImpl(null,c,tf1,tf,tl1,tl2,hit); } }; var oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog = function() { }; var oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState = function() { }; var oimo_collision_narrowphase_detector_gjkepa_SimplexUtil = function() { }; oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2 = function(vec1,vec2,out) { - var v1; var v1X; var v1Y; var v1Z; - var v2; var v2X; var v2Y; var v2Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v3 = vec2; - v2X = v3.x; - v2Y = v3.y; - v2Z = v3.z; - var v12; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; var v12X; var v12Y; var v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v4 = out; - v4.x = v1X; - v4.y = v1Y; - v4.z = v1Z; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; return 1; } if(t > 1) { - var v5 = out; - v5.x = v2X; - v5.y = v2Y; - v5.z = v2Z; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; return 2; } - var p; var pX; var pY; var pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v6 = out; - v6.x = pX; - v6.y = pY; - v6.z = pZ; + out.x = pX; + out.y = pY; + out.z = pZ; return 3; }; oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function(vec1,vec2,vec3,out) { - var v1; var v1X; var v1Y; var v1Z; - var v2; var v2X; var v2Y; var v2Z; - var v3; var v3X; var v3Y; var v3Z; - var v12; var v12X; var v12Y; var v12Z; - var v23; var v23X; var v23Y; var v23Z; - var v31; var v31X; var v31Y; var v31Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v4 = vec2; - v2X = v4.x; - v2Y = v4.y; - v2Z = v4.z; - var v5 = vec3; - v3X = v5.x; - v3Y = v5.y; - v3Z = v5.z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -13373,22 +12621,18 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function v31X = v1X - v3X; v31Y = v1Y - v3Y; v31Z = v1Z - v3Z; - var n; var nX; var nY; var nZ; nX = v12Y * v23Z - v12Z * v23Y; nY = v12Z * v23X - v12X * v23Z; nZ = v12X * v23Y - v12Y * v23X; - var n12; var n12X; var n12Y; var n12Z; - var n23; var n23X; var n23Y; var n23Z; - var n31; var n31X; var n31Y; var n31Z; @@ -13401,11 +12645,7 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X * n12X + v1Y * n12Y + v1Z * n12Z; - var d23 = v2X * n23X + v2Y * n23Y + v2Z * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; var mind = -1; - var minv; var minvX; var minvY; var minvZ; @@ -13413,201 +12653,166 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v11; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { var v1X1; var v1Y1; var v1Z1; - var v21; var v2X1; var v2Y1; var v2Z1; - var v6 = vec1; - v1X1 = v6.x; - v1Y1 = v6.y; - v1Z1 = v6.z; - var v7 = vec2; - v2X1 = v7.x; - v2Y1 = v7.y; - v2Z1 = v7.z; - var v121; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; var v12X1; var v12Y1; var v12Z1; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; - var d = v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1; var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; - t = -t / d; + t = -t / (v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1); var b; if(t < 0) { - var v8 = out; - v8.x = v1X1; - v8.y = v1Y1; - v8.z = v1Z1; + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; b = 1; } else if(t > 1) { - var v9 = out; - v9.x = v2X1; - v9.y = v2Y1; - v9.z = v2Z1; + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; b = 2; } else { - var p; var pX; var pY; var pZ; pX = v1X1 + v12X1 * t; pY = v1Y1 + v12Y1 * t; pZ = v1Z1 + v12Z1 * t; - var v10 = out; - v10.x = pX; - v10.y = pY; - v10.z = pZ; + out.x = pX; + out.y = pY; + out.z = pZ; b = 3; } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; mini = b; - mind = d1; - var v13 = out; - minvX = v13.x; - minvY = v13.y; - minvZ = v13.z; - } - if(d23 < 0) { - var v14; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { var v1X2; var v1Y2; var v1Z2; - var v22; var v2X2; var v2Y2; var v2Z2; - var v15 = vec2; - v1X2 = v15.x; - v1Y2 = v15.y; - v1Z2 = v15.z; - var v16 = vec3; - v2X2 = v16.x; - v2Y2 = v16.y; - v2Z2 = v16.z; - var v122; + v1X2 = vec2.x; + v1Y2 = vec2.y; + v1Z2 = vec2.z; + v2X2 = vec3.x; + v2Y2 = vec3.y; + v2Z2 = vec3.z; var v12X2; var v12Y2; var v12Z2; v12X2 = v2X2 - v1X2; v12Y2 = v2Y2 - v1Y2; v12Z2 = v2Z2 - v1Z2; - var d2 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d2; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); var b1; if(t1 < 0) { - var v17 = out; - v17.x = v1X2; - v17.y = v1Y2; - v17.z = v1Z2; + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; b1 = 1; } else if(t1 > 1) { - var v18 = out; - v18.x = v2X2; - v18.y = v2Y2; - v18.z = v2Z2; + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; b1 = 2; } else { - var p1; var pX1; var pY1; var pZ1; pX1 = v1X2 + v12X2 * t1; pY1 = v1Y2 + v12Y2 * t1; pZ1 = v1Z2 + v12Z2 * t1; - var v19 = out; - v19.x = pX1; - v19.y = pY1; - v19.z = pZ1; + out.x = pX1; + out.y = pY1; + out.z = pZ1; b1 = 3; } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d3 < mind) { + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { mini = b1 << 1; - mind = d3; - var v20 = out; - minvX = v20.x; - minvY = v20.y; - minvZ = v20.z; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } - if(d31 < 0) { - var v110; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { var v1X3; var v1Y3; var v1Z3; - var v24; var v2X3; var v2Y3; var v2Z3; - var v25 = vec1; - v1X3 = v25.x; - v1Y3 = v25.y; - v1Z3 = v25.z; - var v26 = vec3; - v2X3 = v26.x; - v2Y3 = v26.y; - v2Z3 = v26.z; - var v123; + v1X3 = vec1.x; + v1Y3 = vec1.y; + v1Z3 = vec1.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; var v12X3; var v12Y3; var v12Z3; v12X3 = v2X3 - v1X3; v12Y3 = v2Y3 - v1Y3; v12Z3 = v2Z3 - v1Z3; - var d4 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d4; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); var b2; if(t2 < 0) { - var v27 = out; - v27.x = v1X3; - v27.y = v1Y3; - v27.z = v1Z3; + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; b2 = 1; } else if(t2 > 1) { - var v28 = out; - v28.x = v2X3; - v28.y = v2Y3; - v28.z = v2Z3; + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; b2 = 2; } else { - var p2; var pX2; var pY2; var pZ2; pX2 = v1X3 + v12X3 * t2; pY2 = v1Y3 + v12Y3 * t2; pZ2 = v1Z3 + v12Z3 * t2; - var v29 = out; - v29.x = pX2; - v29.y = pY2; - v29.z = pZ2; + out.x = pX2; + out.y = pY2; + out.z = pZ2; b2 = 3; } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d5 < mind) { + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d1 < mind) { mini = b2 & 1 | (b2 & 2) << 1; - mind = d5; - var v30 = out; - minvX = v30.x; - minvY = v30.y; - minvZ = v30.z; + mind = d1; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v32 = out; - v32.x = minvX; - v32.y = minvY; - v32.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return mini; } var l = nX * nX + nY * nY + nZ * nZ; @@ -13617,75 +12822,56 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function nX *= l; nY *= l; nZ *= l; - var dn = v1X * nX + v1Y * nY + v1Z * nZ; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v33 = out; - v33.x = minvX; - v33.y = minvY; - v33.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return 7; }; oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function(vec1,vec2,vec3,vec4,out) { - var v1; var v1X; var v1Y; var v1Z; - var v2; var v2X; var v2Y; var v2Z; - var v3; var v3X; var v3Y; var v3Z; - var v4; var v4X; var v4Y; var v4Z; - var v12; var v12X; var v12Y; var v12Z; - var v13; var v13X; var v13Y; var v13Z; - var v14; var v14X; var v14Y; var v14Z; - var v23; var v23X; var v23Y; var v23Z; - var v24; var v24X; var v24Y; var v24Z; - var v34; - var v34X; - var v34Y; - var v34Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v5 = vec2; - v2X = v5.x; - v2Y = v5.y; - v2Z = v5.z; - var v6 = vec3; - v3X = v6.x; - v3Y = v6.y; - v3Z = v6.z; - var v7 = vec4; - v4X = v7.x; - v4Y = v7.y; - v4Z = v7.z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -13701,30 +12887,18 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v24X = v4X - v2X; v24Y = v4Y - v2Y; v24Z = v4Z - v2Z; - v34X = v4X - v3X; - v34Y = v4Y - v3Y; - v34Z = v4Z - v3Z; - var rev; - var n123; var n123X; var n123Y; var n123Z; - var n134; var n134X; var n134Y; var n134Z; - var n142; var n142X; var n142Y; var n142Z; - var n243; var n243X; var n243Y; var n243Z; - var n; - var nX; - var nY; - var nZ; n123X = v12Y * v13Z - v12Z * v13Y; n123Y = v12Z * v13X - v12X * v13Z; n123Z = v12X * v13Y - v12Y * v13X; @@ -13738,12 +12912,7 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function n243Y = v24Z * v23X - v24X * v23Z; n243Z = v24X * v23Y - v24Y * v23X; var sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; - var d123 = v1X * n123X + v1Y * n123Y + v1Z * n123Z; - var d134 = v1X * n134X + v1Y * n134Y + v1Z * n134Z; - var d142 = v1X * n142X + v1Y * n142Y + v1Z * n142Z; - var d243 = v2X * n243X + v2Y * n243Y + v2Z * n243Z; var mind = -1; - var minv; var minvX; var minvY; var minvZ; @@ -13751,43 +12920,34 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvX = 0; minvY = 0; minvZ = 0; - if(d123 * sign < 0) { - var v11; + if((v1X * n123X + v1Y * n123Y + v1Z * n123Z) * sign < 0) { var v1X1; var v1Y1; var v1Z1; - var v21; var v2X1; var v2Y1; var v2Z1; - var v31; var v3X1; var v3Y1; var v3Z1; - var v121; var v12X1; var v12Y1; var v12Z1; - var v231; var v23X1; var v23Y1; var v23Z1; - var v311; var v31X; var v31Y; var v31Z; - var v8 = vec1; - v1X1 = v8.x; - v1Y1 = v8.y; - v1Z1 = v8.z; - var v9 = vec2; - v2X1 = v9.x; - v2Y1 = v9.y; - v2Z1 = v9.z; - var v10 = vec3; - v3X1 = v10.x; - v3Y1 = v10.y; - v3Z1 = v10.z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X1 = vec3.x; + v3Y1 = vec3.y; + v3Z1 = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -13797,39 +12957,31 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v31X = v1X1 - v3X1; v31Y = v1Y1 - v3Y1; v31Z = v1Z1 - v3Z1; - var n1; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y1 * v23Z1 - v12Z1 * v23Y1; - nY1 = v12Z1 * v23X1 - v12X1 * v23Z1; - nZ1 = v12X1 * v23Y1 - v12Y1 * v23X1; - var n12; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z1 - v12Z1 * v23Y1; + nY = v12Z1 * v23X1 - v12X1 * v23Z1; + nZ = v12X1 * v23Y1 - v12Y1 * v23X1; var n12X; var n12Y; var n12Z; - var n23; var n23X; var n23Y; var n23Z; - var n31; var n31X; var n31Y; var n31Z; - n12X = v12Y1 * nZ1 - v12Z1 * nY1; - n12Y = v12Z1 * nX1 - v12X1 * nZ1; - n12Z = v12X1 * nY1 - v12Y1 * nX1; - n23X = v23Y1 * nZ1 - v23Z1 * nY1; - n23Y = v23Z1 * nX1 - v23X1 * nZ1; - n23Z = v23X1 * nY1 - v23Y1 * nX1; - n31X = v31Y * nZ1 - v31Z * nY1; - n31Y = v31Z * nX1 - v31X * nZ1; - n31Z = v31X * nY1 - v31Y * nX1; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y1 * nZ - v23Z1 * nY; + n23Y = v23Z1 * nX - v23X1 * nZ; + n23Z = v23X1 * nY - v23Y1 * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; var mind1 = -1; - var minv1; var minvX1; var minvY1; var minvZ1; @@ -13837,268 +12989,220 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d12 < 0) { - var v15; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { var v1X2; var v1Y2; var v1Z2; - var v22; var v2X2; var v2Y2; var v2Z2; - var v16 = vec1; - v1X2 = v16.x; - v1Y2 = v16.y; - v1Z2 = v16.z; - var v17 = vec2; - v2X2 = v17.x; - v2Y2 = v17.y; - v2Z2 = v17.z; - var v122; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; var v12X2; var v12Y2; var v12Z2; v12X2 = v2X2 - v1X2; v12Y2 = v2Y2 - v1Y2; v12Z2 = v2Z2 - v1Z2; - var d = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / d; + t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); var b; if(t < 0) { - var v18 = out; - v18.x = v1X2; - v18.y = v1Y2; - v18.z = v1Z2; + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; b = 1; } else if(t > 1) { - var v19 = out; - v19.x = v2X2; - v19.y = v2Y2; - v19.z = v2Z2; + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; b = 2; } else { - var p; var pX; var pY; var pZ; pX = v1X2 + v12X2 * t; pY = v1Y2 + v12Y2 * t; pZ = v1Z2 + v12Z2 * t; - var v20 = out; - v20.x = pX; - v20.y = pY; - v20.z = pZ; + out.x = pX; + out.y = pY; + out.z = pZ; b = 3; } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; mini1 = b; - mind1 = d1; - var v25 = out; - minvX1 = v25.x; - minvY1 = v25.y; - minvZ1 = v25.z; - } - if(d23 < 0) { - var v110; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { var v1X3; var v1Y3; var v1Z3; - var v26; var v2X3; var v2Y3; var v2Z3; - var v27 = vec2; - v1X3 = v27.x; - v1Y3 = v27.y; - v1Z3 = v27.z; - var v28 = vec3; - v2X3 = v28.x; - v2Y3 = v28.y; - v2Z3 = v28.z; - var v123; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; var v12X3; var v12Y3; var v12Z3; v12X3 = v2X3 - v1X3; v12Y3 = v2Y3 - v1Y3; v12Z3 = v2Z3 - v1Z3; - var d2 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / d2; + t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); var b1; if(t1 < 0) { - var v29 = out; - v29.x = v1X3; - v29.y = v1Y3; - v29.z = v1Z3; + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; b1 = 1; } else if(t1 > 1) { - var v30 = out; - v30.x = v2X3; - v30.y = v2Y3; - v30.z = v2Z3; + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; b1 = 2; } else { - var p1; var pX1; var pY1; var pZ1; pX1 = v1X3 + v12X3 * t1; pY1 = v1Y3 + v12Y3 * t1; pZ1 = v1Z3 + v12Z3 * t1; - var v32 = out; - v32.x = pX1; - v32.y = pY1; - v32.z = pZ1; + out.x = pX1; + out.y = pY1; + out.z = pZ1; b1 = 3; } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d3 < mind1) { + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { mini1 = b1 << 1; - mind1 = d3; - var v33 = out; - minvX1 = v33.x; - minvY1 = v33.y; - minvZ1 = v33.z; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; } } - if(d31 < 0) { - var v111; + if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { var v1X4; var v1Y4; var v1Z4; - var v210; var v2X4; var v2Y4; var v2Z4; - var v35 = vec1; - v1X4 = v35.x; - v1Y4 = v35.y; - v1Z4 = v35.z; - var v36 = vec3; - v2X4 = v36.x; - v2Y4 = v36.y; - v2Z4 = v36.z; - var v124; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; var v12X4; var v12Y4; var v12Z4; v12X4 = v2X4 - v1X4; v12Y4 = v2Y4 - v1Y4; v12Z4 = v2Z4 - v1Z4; - var d4 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / d4; + t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); var b2; if(t2 < 0) { - var v37 = out; - v37.x = v1X4; - v37.y = v1Y4; - v37.z = v1Z4; + out.x = v1X4; + out.y = v1Y4; + out.z = v1Z4; b2 = 1; } else if(t2 > 1) { - var v38 = out; - v38.x = v2X4; - v38.y = v2Y4; - v38.z = v2Z4; + out.x = v2X4; + out.y = v2Y4; + out.z = v2Z4; b2 = 2; } else { - var p2; var pX2; var pY2; var pZ2; pX2 = v1X4 + v12X4 * t2; pY2 = v1Y4 + v12Y4 * t2; pZ2 = v1Z4 + v12Z4 * t2; - var v39 = out; - v39.x = pX2; - v39.y = pY2; - v39.z = pZ2; + out.x = pX2; + out.y = pY2; + out.z = pZ2; b2 = 3; } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d5 < mind1) { + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d1 < mind1) { mini1 = b2 & 1 | (b2 & 2) << 1; - mind1 = d5; - var v40 = out; - minvX1 = v40.x; - minvY1 = v40.y; - minvZ1 = v40.z; + mind1 = d1; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; } } var b3; if(mind1 > 0) { - var v41 = out; - v41.x = minvX1; - v41.y = minvY1; - v41.z = minvZ1; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; b3 = mini1; } else { - var l = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } - nX1 *= l; - nY1 *= l; - nZ1 *= l; - var dn = v1X1 * nX1 + v1Y1 * nY1 + v1Z1 * nZ1; - var l2 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l2 = dn / l2; - minvX1 = nX1 * l2; - minvY1 = nY1 * l2; - minvZ1 = nZ1 * l2; - var v42 = out; - v42.x = minvX1; - v42.y = minvY1; - v42.z = minvZ1; + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; b3 = 7; } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; mini = b3; - mind = d6; - var v43 = out; - minvX = v43.x; - minvY = v43.y; - minvZ = v43.z; - } - if(d134 * sign < 0) { - var v112; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { var v1X5; var v1Y5; var v1Z5; - var v211; var v2X5; var v2Y5; var v2Z5; - var v310; var v3X2; var v3Y2; var v3Z2; - var v125; var v12X5; var v12Y5; var v12Z5; - var v232; var v23X2; var v23Y2; var v23Z2; - var v312; var v31X1; var v31Y1; var v31Z1; - var v44 = vec1; - v1X5 = v44.x; - v1Y5 = v44.y; - v1Z5 = v44.z; - var v45 = vec3; - v2X5 = v45.x; - v2Y5 = v45.y; - v2Z5 = v45.z; - var v46 = vec4; - v3X2 = v46.x; - v3Y2 = v46.y; - v3Z2 = v46.z; + v1X5 = vec1.x; + v1Y5 = vec1.y; + v1Z5 = vec1.z; + v2X5 = vec3.x; + v2Y5 = vec3.y; + v2Z5 = vec3.z; + v3X2 = vec4.x; + v3Y2 = vec4.y; + v3Z2 = vec4.z; v12X5 = v2X5 - v1X5; v12Y5 = v2Y5 - v1Y5; v12Z5 = v2Z5 - v1Z5; @@ -14108,39 +13212,31 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v31X1 = v1X5 - v3X2; v31Y1 = v1Y5 - v3Y2; v31Z1 = v1Z5 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y5 * v23Z2 - v12Z5 * v23Y2; - nY2 = v12Z5 * v23X2 - v12X5 * v23Z2; - nZ2 = v12X5 * v23Y2 - v12Y5 * v23X2; - var n121; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y5 * v23Z2 - v12Z5 * v23Y2; + nY1 = v12Z5 * v23X2 - v12X5 * v23Z2; + nZ1 = v12X5 * v23Y2 - v12Y5 * v23X2; var n12X1; var n12Y1; var n12Z1; - var n231; var n23X1; var n23Y1; var n23Z1; - var n311; var n31X1; var n31Y1; var n31Z1; - n12X1 = v12Y5 * nZ2 - v12Z5 * nY2; - n12Y1 = v12Z5 * nX2 - v12X5 * nZ2; - n12Z1 = v12X5 * nY2 - v12Y5 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1; - var d231 = v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + n12X1 = v12Y5 * nZ1 - v12Z5 * nY1; + n12Y1 = v12Z5 * nX1 - v12X5 * nZ1; + n12Z1 = v12X5 * nY1 - v12Y5 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; var mind2 = -1; - var minv2; var minvX2; var minvY2; var minvZ2; @@ -14148,270 +13244,223 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvX2 = 0; minvY2 = 0; minvZ2 = 0; - if(d121 < 0) { - var v113; + if(v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1 < 0) { var v1X6; var v1Y6; var v1Z6; - var v212; var v2X6; var v2Y6; var v2Z6; - var v47 = vec1; - v1X6 = v47.x; - v1Y6 = v47.y; - v1Z6 = v47.z; - var v48 = vec3; - v2X6 = v48.x; - v2Y6 = v48.y; - v2Z6 = v48.z; - var v126; + v1X6 = vec1.x; + v1Y6 = vec1.y; + v1Z6 = vec1.z; + v2X6 = vec3.x; + v2Y6 = vec3.y; + v2Z6 = vec3.z; var v12X6; var v12Y6; var v12Z6; v12X6 = v2X6 - v1X6; v12Y6 = v2Y6 - v1Y6; v12Z6 = v2Z6 - v1Z6; - var d7 = v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6; var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; - t3 = -t3 / d7; + t3 = -t3 / (v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6); var b4; if(t3 < 0) { - var v49 = out; - v49.x = v1X6; - v49.y = v1Y6; - v49.z = v1Z6; + out.x = v1X6; + out.y = v1Y6; + out.z = v1Z6; b4 = 1; } else if(t3 > 1) { - var v50 = out; - v50.x = v2X6; - v50.y = v2Y6; - v50.z = v2Z6; + out.x = v2X6; + out.y = v2Y6; + out.z = v2Z6; b4 = 2; } else { - var p3; var pX3; var pY3; var pZ3; pX3 = v1X6 + v12X6 * t3; pY3 = v1Y6 + v12Y6 * t3; pZ3 = v1Z6 + v12Z6 * t3; - var v51 = out; - v51.x = pX3; - v51.y = pY3; - v51.z = pZ3; + out.x = pX3; + out.y = pY3; + out.z = pZ3; b4 = 3; } - var d8 = out.x * out.x + out.y * out.y + out.z * out.z; mini2 = b4; - mind2 = d8; - var v52 = out; - minvX2 = v52.x; - minvY2 = v52.y; - minvZ2 = v52.z; - } - if(d231 < 0) { - var v114; + mind2 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; + } + if(v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1 < 0) { var v1X7; var v1Y7; var v1Z7; - var v213; var v2X7; var v2Y7; var v2Z7; - var v53 = vec3; - v1X7 = v53.x; - v1Y7 = v53.y; - v1Z7 = v53.z; - var v54 = vec4; - v2X7 = v54.x; - v2Y7 = v54.y; - v2Z7 = v54.z; - var v127; + v1X7 = vec3.x; + v1Y7 = vec3.y; + v1Z7 = vec3.z; + v2X7 = vec4.x; + v2Y7 = vec4.y; + v2Z7 = vec4.z; var v12X7; var v12Y7; var v12Z7; v12X7 = v2X7 - v1X7; v12Y7 = v2Y7 - v1Y7; v12Z7 = v2Z7 - v1Z7; - var d9 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d9; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); var b5; if(t4 < 0) { - var v55 = out; - v55.x = v1X7; - v55.y = v1Y7; - v55.z = v1Z7; + out.x = v1X7; + out.y = v1Y7; + out.z = v1Z7; b5 = 1; } else if(t4 > 1) { - var v56 = out; - v56.x = v2X7; - v56.y = v2Y7; - v56.z = v2Z7; + out.x = v2X7; + out.y = v2Y7; + out.z = v2Z7; b5 = 2; } else { - var p4; var pX4; var pY4; var pZ4; pX4 = v1X7 + v12X7 * t4; pY4 = v1Y7 + v12Y7 * t4; pZ4 = v1Z7 + v12Z7 * t4; - var v57 = out; - v57.x = pX4; - v57.y = pY4; - v57.z = pZ4; + out.x = pX4; + out.y = pY4; + out.z = pZ4; b5 = 3; } - var d10 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d10 < mind2) { + var d2 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d2 < mind2) { mini2 = b5 << 1; - mind2 = d10; - var v58 = out; - minvX2 = v58.x; - minvY2 = v58.y; - minvZ2 = v58.z; + mind2 = d2; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; } } - if(d311 < 0) { - var v115; + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { var v1X8; var v1Y8; var v1Z8; - var v214; var v2X8; var v2Y8; var v2Z8; - var v59 = vec1; - v1X8 = v59.x; - v1Y8 = v59.y; - v1Z8 = v59.z; - var v60 = vec4; - v2X8 = v60.x; - v2Y8 = v60.y; - v2Z8 = v60.z; - var v128; + v1X8 = vec1.x; + v1Y8 = vec1.y; + v1Z8 = vec1.z; + v2X8 = vec4.x; + v2Y8 = vec4.y; + v2Z8 = vec4.z; var v12X8; var v12Y8; var v12Z8; v12X8 = v2X8 - v1X8; v12Y8 = v2Y8 - v1Y8; v12Z8 = v2Z8 - v1Z8; - var d11 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d11; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); var b6; if(t5 < 0) { - var v61 = out; - v61.x = v1X8; - v61.y = v1Y8; - v61.z = v1Z8; + out.x = v1X8; + out.y = v1Y8; + out.z = v1Z8; b6 = 1; } else if(t5 > 1) { - var v62 = out; - v62.x = v2X8; - v62.y = v2Y8; - v62.z = v2Z8; + out.x = v2X8; + out.y = v2Y8; + out.z = v2Z8; b6 = 2; } else { - var p5; var pX5; var pY5; var pZ5; pX5 = v1X8 + v12X8 * t5; pY5 = v1Y8 + v12Y8 * t5; pZ5 = v1Z8 + v12Z8 * t5; - var v63 = out; - v63.x = pX5; - v63.y = pY5; - v63.z = pZ5; + out.x = pX5; + out.y = pY5; + out.z = pZ5; b6 = 3; } - var d13 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d13 < mind2) { + var d3 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d3 < mind2) { mini2 = b6 & 1 | (b6 & 2) << 1; - mind2 = d13; - var v64 = out; - minvX2 = v64.x; - minvY2 = v64.y; - minvZ2 = v64.z; + mind2 = d3; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; } } var b7; if(mind2 > 0) { - var v65 = out; - v65.x = minvX2; - v65.y = minvY2; - v65.z = minvZ2; + out.x = minvX2; + out.y = minvY2; + out.z = minvZ2; b7 = mini2; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X5 * nX2 + v1Y5 * nY2 + v1Z5 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v66 = out; - v66.x = minvX2; - v66.y = minvY2; - v66.z = minvZ2; + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X5 * nX1 + v1Y5 * nY1 + v1Z5 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + out.x = minvX2; + out.y = minvY2; + out.z = minvZ2; b7 = 7; } - var d14 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d14 < mind) { + var d4 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d4 < mind) { mini = b7 & 1 | (b7 & 6) << 1; - mind = d14; - var v67 = out; - minvX = v67.x; - minvY = v67.y; - minvZ = v67.z; + mind = d4; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } - if(d142 * sign < 0) { - var v116; + if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { var v1X9; var v1Y9; var v1Z9; - var v215; var v2X9; var v2Y9; var v2Z9; - var v313; var v3X3; var v3Y3; var v3Z3; - var v129; var v12X9; var v12Y9; var v12Z9; - var v233; var v23X3; var v23Y3; var v23Z3; - var v314; var v31X2; var v31Y2; var v31Z2; - var v68 = vec1; - v1X9 = v68.x; - v1Y9 = v68.y; - v1Z9 = v68.z; - var v69 = vec2; - v2X9 = v69.x; - v2Y9 = v69.y; - v2Z9 = v69.z; - var v70 = vec4; - v3X3 = v70.x; - v3Y3 = v70.y; - v3Z3 = v70.z; + v1X9 = vec1.x; + v1Y9 = vec1.y; + v1Z9 = vec1.z; + v2X9 = vec2.x; + v2Y9 = vec2.y; + v2Z9 = vec2.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; v12X9 = v2X9 - v1X9; v12Y9 = v2Y9 - v1Y9; v12Z9 = v2Z9 - v1Z9; @@ -14421,39 +13470,31 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v31X2 = v1X9 - v3X3; v31Y2 = v1Y9 - v3Y3; v31Z2 = v1Z9 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y9 * v23Z3 - v12Z9 * v23Y3; - nY3 = v12Z9 * v23X3 - v12X9 * v23Z3; - nZ3 = v12X9 * v23Y3 - v12Y9 * v23X3; - var n122; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y9 * v23Z3 - v12Z9 * v23Y3; + nY2 = v12Z9 * v23X3 - v12X9 * v23Z3; + nZ2 = v12X9 * v23Y3 - v12Y9 * v23X3; var n12X2; var n12Y2; var n12Z2; - var n232; var n23X2; var n23Y2; var n23Z2; - var n312; var n31X2; var n31Y2; var n31Z2; - n12X2 = v12Y9 * nZ3 - v12Z9 * nY3; - n12Y2 = v12Z9 * nX3 - v12X9 * nZ3; - n12Z2 = v12X9 * nY3 - v12Y9 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2; - var d232 = v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + n12X2 = v12Y9 * nZ2 - v12Z9 * nY2; + n12Y2 = v12Z9 * nX2 - v12X9 * nZ2; + n12Z2 = v12X9 * nY2 - v12Y9 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; var mind3 = -1; - var minv3; var minvX3; var minvY3; var minvZ3; @@ -14461,270 +13502,223 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvX3 = 0; minvY3 = 0; minvZ3 = 0; - if(d122 < 0) { - var v117; + if(v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2 < 0) { var v1X10; var v1Y10; var v1Z10; - var v216; var v2X10; var v2Y10; var v2Z10; - var v71 = vec1; - v1X10 = v71.x; - v1Y10 = v71.y; - v1Z10 = v71.z; - var v72 = vec2; - v2X10 = v72.x; - v2Y10 = v72.y; - v2Z10 = v72.z; - var v1210; + v1X10 = vec1.x; + v1Y10 = vec1.y; + v1Z10 = vec1.z; + v2X10 = vec2.x; + v2Y10 = vec2.y; + v2Z10 = vec2.z; var v12X10; var v12Y10; var v12Z10; v12X10 = v2X10 - v1X10; v12Y10 = v2Y10 - v1Y10; v12Z10 = v2Z10 - v1Z10; - var d15 = v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10; var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; - t6 = -t6 / d15; + t6 = -t6 / (v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10); var b8; if(t6 < 0) { - var v73 = out; - v73.x = v1X10; - v73.y = v1Y10; - v73.z = v1Z10; + out.x = v1X10; + out.y = v1Y10; + out.z = v1Z10; b8 = 1; } else if(t6 > 1) { - var v74 = out; - v74.x = v2X10; - v74.y = v2Y10; - v74.z = v2Z10; + out.x = v2X10; + out.y = v2Y10; + out.z = v2Z10; b8 = 2; } else { - var p6; var pX6; var pY6; var pZ6; pX6 = v1X10 + v12X10 * t6; pY6 = v1Y10 + v12Y10 * t6; pZ6 = v1Z10 + v12Z10 * t6; - var v75 = out; - v75.x = pX6; - v75.y = pY6; - v75.z = pZ6; + out.x = pX6; + out.y = pY6; + out.z = pZ6; b8 = 3; } - var d16 = out.x * out.x + out.y * out.y + out.z * out.z; mini3 = b8; - mind3 = d16; - var v76 = out; - minvX3 = v76.x; - minvY3 = v76.y; - minvZ3 = v76.z; - } - if(d232 < 0) { - var v118; + mind3 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; + } + if(v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2 < 0) { var v1X11; var v1Y11; var v1Z11; - var v217; var v2X11; var v2Y11; var v2Z11; - var v77 = vec2; - v1X11 = v77.x; - v1Y11 = v77.y; - v1Z11 = v77.z; - var v78 = vec4; - v2X11 = v78.x; - v2Y11 = v78.y; - v2Z11 = v78.z; - var v1211; + v1X11 = vec2.x; + v1Y11 = vec2.y; + v1Z11 = vec2.z; + v2X11 = vec4.x; + v2Y11 = vec4.y; + v2Z11 = vec4.z; var v12X11; var v12Y11; var v12Z11; v12X11 = v2X11 - v1X11; v12Y11 = v2Y11 - v1Y11; v12Z11 = v2Z11 - v1Z11; - var d17 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d17; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); var b9; if(t7 < 0) { - var v79 = out; - v79.x = v1X11; - v79.y = v1Y11; - v79.z = v1Z11; + out.x = v1X11; + out.y = v1Y11; + out.z = v1Z11; b9 = 1; } else if(t7 > 1) { - var v80 = out; - v80.x = v2X11; - v80.y = v2Y11; - v80.z = v2Z11; + out.x = v2X11; + out.y = v2Y11; + out.z = v2Z11; b9 = 2; } else { - var p7; var pX7; var pY7; var pZ7; pX7 = v1X11 + v12X11 * t7; pY7 = v1Y11 + v12Y11 * t7; pZ7 = v1Z11 + v12Z11 * t7; - var v81 = out; - v81.x = pX7; - v81.y = pY7; - v81.z = pZ7; + out.x = pX7; + out.y = pY7; + out.z = pZ7; b9 = 3; } - var d18 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d18 < mind3) { + var d5 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d5 < mind3) { mini3 = b9 << 1; - mind3 = d18; - var v82 = out; - minvX3 = v82.x; - minvY3 = v82.y; - minvZ3 = v82.z; + mind3 = d5; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; } } - if(d312 < 0) { - var v119; + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { var v1X12; var v1Y12; var v1Z12; - var v218; var v2X12; var v2Y12; var v2Z12; - var v83 = vec1; - v1X12 = v83.x; - v1Y12 = v83.y; - v1Z12 = v83.z; - var v84 = vec4; - v2X12 = v84.x; - v2Y12 = v84.y; - v2Z12 = v84.z; - var v1212; + v1X12 = vec1.x; + v1Y12 = vec1.y; + v1Z12 = vec1.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; var v12X12; var v12Y12; var v12Z12; v12X12 = v2X12 - v1X12; v12Y12 = v2Y12 - v1Y12; v12Z12 = v2Z12 - v1Z12; - var d19 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d19; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); var b10; if(t8 < 0) { - var v85 = out; - v85.x = v1X12; - v85.y = v1Y12; - v85.z = v1Z12; + out.x = v1X12; + out.y = v1Y12; + out.z = v1Z12; b10 = 1; } else if(t8 > 1) { - var v86 = out; - v86.x = v2X12; - v86.y = v2Y12; - v86.z = v2Z12; + out.x = v2X12; + out.y = v2Y12; + out.z = v2Z12; b10 = 2; } else { - var p8; var pX8; var pY8; var pZ8; pX8 = v1X12 + v12X12 * t8; pY8 = v1Y12 + v12Y12 * t8; pZ8 = v1Z12 + v12Z12 * t8; - var v87 = out; - v87.x = pX8; - v87.y = pY8; - v87.z = pZ8; + out.x = pX8; + out.y = pY8; + out.z = pZ8; b10 = 3; } - var d20 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d20 < mind3) { + var d6 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d6 < mind3) { mini3 = b10 & 1 | (b10 & 2) << 1; - mind3 = d20; - var v88 = out; - minvX3 = v88.x; - minvY3 = v88.y; - minvZ3 = v88.z; + mind3 = d6; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; } } var b11; if(mind3 > 0) { - var v89 = out; - v89.x = minvX3; - v89.y = minvY3; - v89.z = minvZ3; + out.x = minvX3; + out.y = minvY3; + out.z = minvZ3; b11 = mini3; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; if(l3 > 0) { l3 = 1 / Math.sqrt(l3); } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X9 * nX3 + v1Y9 * nY3 + v1Z9 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v90 = out; - v90.x = minvX3; - v90.y = minvY3; - v90.z = minvZ3; + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X9 * nX2 + v1Y9 * nY2 + v1Z9 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + out.x = minvX3; + out.y = minvY3; + out.z = minvZ3; b11 = 7; } - var d21 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d21 < mind) { + var d7 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d7 < mind) { mini = b11 & 3 | (b11 & 4) << 1; - mind = d21; - var v91 = out; - minvX = v91.x; - minvY = v91.y; - minvZ = v91.z; + mind = d7; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } - if(d243 * sign < 0) { - var v120; + if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { var v1X13; var v1Y13; var v1Z13; - var v219; var v2X13; var v2Y13; var v2Z13; - var v315; var v3X4; var v3Y4; var v3Z4; - var v1213; var v12X13; var v12Y13; var v12Z13; - var v234; var v23X4; var v23Y4; var v23Z4; - var v316; var v31X3; var v31Y3; var v31Z3; - var v92 = vec2; - v1X13 = v92.x; - v1Y13 = v92.y; - v1Z13 = v92.z; - var v93 = vec3; - v2X13 = v93.x; - v2Y13 = v93.y; - v2Z13 = v93.z; - var v94 = vec4; - v3X4 = v94.x; - v3Y4 = v94.y; - v3Z4 = v94.z; + v1X13 = vec2.x; + v1Y13 = vec2.y; + v1Z13 = vec2.z; + v2X13 = vec3.x; + v2Y13 = vec3.y; + v2Z13 = vec3.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; v12X13 = v2X13 - v1X13; v12Y13 = v2Y13 - v1Y13; v12Z13 = v2Z13 - v1Z13; @@ -14734,39 +13728,31 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v31X3 = v1X13 - v3X4; v31Y3 = v1Y13 - v3Y4; v31Z3 = v1Z13 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y13 * v23Z4 - v12Z13 * v23Y4; - nY4 = v12Z13 * v23X4 - v12X13 * v23Z4; - nZ4 = v12X13 * v23Y4 - v12Y13 * v23X4; - var n124; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y13 * v23Z4 - v12Z13 * v23Y4; + nY3 = v12Z13 * v23X4 - v12X13 * v23Z4; + nZ3 = v12X13 * v23Y4 - v12Y13 * v23X4; var n12X3; var n12Y3; var n12Z3; - var n233; var n23X3; var n23Y3; var n23Z3; - var n313; var n31X3; var n31Y3; var n31Z3; - n12X3 = v12Y13 * nZ4 - v12Z13 * nY4; - n12Y3 = v12Z13 * nX4 - v12X13 * nZ4; - n12Z3 = v12X13 * nY4 - v12Y13 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3; - var d233 = v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + n12X3 = v12Y13 * nZ3 - v12Z13 * nY3; + n12Y3 = v12Z13 * nX3 - v12X13 * nZ3; + n12Z3 = v12X13 * nY3 - v12Y13 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; var mind4 = -1; - var minv4; var minvX4; var minvY4; var minvZ4; @@ -14774,238 +13760,199 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvX4 = 0; minvY4 = 0; minvZ4 = 0; - if(d124 < 0) { - var v130; + if(v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3 < 0) { var v1X14; var v1Y14; var v1Z14; - var v220; var v2X14; var v2Y14; var v2Z14; - var v95 = vec2; - v1X14 = v95.x; - v1Y14 = v95.y; - v1Z14 = v95.z; - var v96 = vec3; - v2X14 = v96.x; - v2Y14 = v96.y; - v2Z14 = v96.z; - var v1214; + v1X14 = vec2.x; + v1Y14 = vec2.y; + v1Z14 = vec2.z; + v2X14 = vec3.x; + v2Y14 = vec3.y; + v2Z14 = vec3.z; var v12X14; var v12Y14; var v12Z14; v12X14 = v2X14 - v1X14; v12Y14 = v2Y14 - v1Y14; v12Z14 = v2Z14 - v1Z14; - var d22 = v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14; var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; - t9 = -t9 / d22; + t9 = -t9 / (v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14); var b12; if(t9 < 0) { - var v97 = out; - v97.x = v1X14; - v97.y = v1Y14; - v97.z = v1Z14; + out.x = v1X14; + out.y = v1Y14; + out.z = v1Z14; b12 = 1; } else if(t9 > 1) { - var v98 = out; - v98.x = v2X14; - v98.y = v2Y14; - v98.z = v2Z14; + out.x = v2X14; + out.y = v2Y14; + out.z = v2Z14; b12 = 2; } else { - var p9; var pX9; var pY9; var pZ9; pX9 = v1X14 + v12X14 * t9; pY9 = v1Y14 + v12Y14 * t9; pZ9 = v1Z14 + v12Z14 * t9; - var v99 = out; - v99.x = pX9; - v99.y = pY9; - v99.z = pZ9; + out.x = pX9; + out.y = pY9; + out.z = pZ9; b12 = 3; } - var d24 = out.x * out.x + out.y * out.y + out.z * out.z; mini4 = b12; - mind4 = d24; - var v100 = out; - minvX4 = v100.x; - minvY4 = v100.y; - minvZ4 = v100.z; - } - if(d233 < 0) { - var v131; + mind4 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; + } + if(v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3 < 0) { var v1X15; var v1Y15; var v1Z15; - var v221; var v2X15; var v2Y15; var v2Z15; - var v101 = vec3; - v1X15 = v101.x; - v1Y15 = v101.y; - v1Z15 = v101.z; - var v102 = vec4; - v2X15 = v102.x; - v2Y15 = v102.y; - v2Z15 = v102.z; - var v1215; + v1X15 = vec3.x; + v1Y15 = vec3.y; + v1Z15 = vec3.z; + v2X15 = vec4.x; + v2Y15 = vec4.y; + v2Z15 = vec4.z; var v12X15; var v12Y15; var v12Z15; v12X15 = v2X15 - v1X15; v12Y15 = v2Y15 - v1Y15; v12Z15 = v2Z15 - v1Z15; - var d25 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d25; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); var b13; if(t10 < 0) { - var v103 = out; - v103.x = v1X15; - v103.y = v1Y15; - v103.z = v1Z15; + out.x = v1X15; + out.y = v1Y15; + out.z = v1Z15; b13 = 1; } else if(t10 > 1) { - var v104 = out; - v104.x = v2X15; - v104.y = v2Y15; - v104.z = v2Z15; + out.x = v2X15; + out.y = v2Y15; + out.z = v2Z15; b13 = 2; } else { - var p10; var pX10; var pY10; var pZ10; pX10 = v1X15 + v12X15 * t10; pY10 = v1Y15 + v12Y15 * t10; pZ10 = v1Z15 + v12Z15 * t10; - var v105 = out; - v105.x = pX10; - v105.y = pY10; - v105.z = pZ10; + out.x = pX10; + out.y = pY10; + out.z = pZ10; b13 = 3; } - var d26 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d26 < mind4) { + var d8 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d8 < mind4) { mini4 = b13 << 1; - mind4 = d26; - var v106 = out; - minvX4 = v106.x; - minvY4 = v106.y; - minvZ4 = v106.z; + mind4 = d8; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; } } - if(d313 < 0) { - var v132; + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { var v1X16; var v1Y16; var v1Z16; - var v222; var v2X16; var v2Y16; var v2Z16; - var v107 = vec2; - v1X16 = v107.x; - v1Y16 = v107.y; - v1Z16 = v107.z; - var v108 = vec4; - v2X16 = v108.x; - v2Y16 = v108.y; - v2Z16 = v108.z; - var v1216; + v1X16 = vec2.x; + v1Y16 = vec2.y; + v1Z16 = vec2.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; var v12X16; var v12Y16; var v12Z16; v12X16 = v2X16 - v1X16; v12Y16 = v2Y16 - v1Y16; v12Z16 = v2Z16 - v1Z16; - var d27 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d27; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); var b14; if(t11 < 0) { - var v109 = out; - v109.x = v1X16; - v109.y = v1Y16; - v109.z = v1Z16; + out.x = v1X16; + out.y = v1Y16; + out.z = v1Z16; b14 = 1; } else if(t11 > 1) { - var v133 = out; - v133.x = v2X16; - v133.y = v2Y16; - v133.z = v2Z16; + out.x = v2X16; + out.y = v2Y16; + out.z = v2Z16; b14 = 2; } else { - var p11; var pX11; var pY11; var pZ11; pX11 = v1X16 + v12X16 * t11; pY11 = v1Y16 + v12Y16 * t11; pZ11 = v1Z16 + v12Z16 * t11; - var v134 = out; - v134.x = pX11; - v134.y = pY11; - v134.z = pZ11; + out.x = pX11; + out.y = pY11; + out.z = pZ11; b14 = 3; } - var d28 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d28 < mind4) { + var d9 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d9 < mind4) { mini4 = b14 & 1 | (b14 & 2) << 1; - mind4 = d28; - var v135 = out; - minvX4 = v135.x; - minvY4 = v135.y; - minvZ4 = v135.z; + mind4 = d9; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; } } var b15; if(mind4 > 0) { - var v136 = out; - v136.x = minvX4; - v136.y = minvY4; - v136.z = minvZ4; + out.x = minvX4; + out.y = minvY4; + out.z = minvZ4; b15 = mini4; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; if(l4 > 0) { l4 = 1 / Math.sqrt(l4); } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X13 * nX4 + v1Y13 * nY4 + v1Z13 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v137 = out; - v137.x = minvX4; - v137.y = minvY4; - v137.z = minvZ4; + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X13 * nX3 + v1Y13 * nY3 + v1Z13 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + out.x = minvX4; + out.y = minvY4; + out.z = minvZ4; b15 = 7; } - var d29 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d29 < mind) { + var d10 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d10 < mind) { mini = b15 << 1; - mind = d29; - var v138 = out; - minvX = v138.x; - minvY = v138.y; - minvZ = v138.z; + mind = d10; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v139 = out; - v139.x = minvX; - v139.y = minvY; - v139.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return mini; } out.zero(); @@ -15064,24 +14011,15 @@ oimo_common_Mat3.prototype = { return this; } ,identity: function() { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; return this; } ,add: function(m) { @@ -15097,87 +14035,59 @@ oimo_common_Mat3.prototype = { return new oimo_common_Mat3(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22); } ,addEq: function(m) { - var t00 = this.e00 + m.e00; - var t01 = this.e01 + m.e01; - var t02 = this.e02 + m.e02; - var t10 = this.e10 + m.e10; - var t11 = this.e11 + m.e11; - var t12 = this.e12 + m.e12; - var t20 = this.e20 + m.e20; - var t21 = this.e21 + m.e21; - var t22 = this.e22 + m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; return this; } ,subEq: function(m) { - var t00 = this.e00 - m.e00; - var t01 = this.e01 - m.e01; - var t02 = this.e02 - m.e02; - var t10 = this.e10 - m.e10; - var t11 = this.e11 - m.e11; - var t12 = this.e12 - m.e12; - var t20 = this.e20 - m.e20; - var t21 = this.e21 - m.e21; - var t22 = this.e22 - m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; return this; } ,scaleEq: function(s) { - var t00 = this.e00 * s; - var t01 = this.e01 * s; - var t02 = this.e02 * s; - var t10 = this.e10 * s; - var t11 = this.e11 * s; - var t12 = this.e12 * s; - var t20 = this.e20 * s; - var t21 = this.e21 * s; - var t22 = this.e22 * s; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; return this; } ,mulEq: function(m) { - var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; - var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; - var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; - var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; - var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; - var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; - var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; - var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; - var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; + var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; + var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; + var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; + var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; + var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; + var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; + var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; return this; } ,prependScale: function(sx,sy,sz) { @@ -15217,45 +14127,27 @@ oimo_common_Mat3.prototype = { return new oimo_common_Mat3(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22); } ,prependScaleEq: function(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sx; - var t02 = this.e02 * sx; - var t10 = this.e10 * sy; - var t11 = this.e11 * sy; - var t12 = this.e12 * sy; - var t20 = this.e20 * sz; - var t21 = this.e21 * sz; - var t22 = this.e22 * sz; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; return this; } ,appendScaleEq: function(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sy; - var t02 = this.e02 * sz; - var t10 = this.e10 * sx; - var t11 = this.e11 * sy; - var t12 = this.e12 * sz; - var t20 = this.e20 * sx; - var t21 = this.e21 * sy; - var t22 = this.e22 * sz; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; return this; } ,prependRotationEq: function(rad,axisX,axisY,axisZ) { @@ -15271,28 +14163,25 @@ oimo_common_Mat3.prototype = { var r20 = axisZ * axisX * c1 - axisY * s; var r21 = axisZ * axisY * c1 + axisX * s; var r22 = axisZ * axisZ * c1 + c; - var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; - var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; - var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; - var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - return this; - } - ,appendRotationEq: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); + var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + return this; + } + ,appendRotationEq: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); var c = Math.cos(rad); var c1 = 1 - c; var r00 = axisX * axisX * c1 + c; @@ -15304,48 +14193,39 @@ oimo_common_Mat3.prototype = { var r20 = axisZ * axisX * c1 - axisY * s; var r21 = axisZ * axisY * c1 + axisX * s; var r22 = axisZ * axisZ * c1 + c; - var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; - var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; - var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; - var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; return this; } ,transpose: function() { return new oimo_common_Mat3(this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22); } ,transposeEq: function() { - var t00 = this.e00; - var t01 = this.e10; - var t02 = this.e20; - var t10 = this.e01; - var t11 = this.e11; - var t12 = this.e21; - var t20 = this.e02; - var t21 = this.e12; - var t22 = this.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + var e10 = this.e01; + var e20 = this.e02; + var e21 = this.e12; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; return this; } ,determinant: function() { @@ -15358,48 +14238,32 @@ oimo_common_Mat3.prototype = { var d00 = this.e11 * this.e22 - this.e12 * this.e21; var d01 = this.e10 * this.e22 - this.e12 * this.e20; var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var d10 = this.e01 * this.e22 - this.e02 * this.e21; - var d11 = this.e00 * this.e22 - this.e02 * this.e20; - var d12 = this.e00 * this.e21 - this.e01 * this.e20; - var d20 = this.e01 * this.e12 - this.e02 * this.e11; - var d21 = this.e00 * this.e12 - this.e02 * this.e10; - var d22 = this.e00 * this.e11 - this.e01 * this.e10; var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } - return new oimo_common_Mat3(d00 * invDet,-d10 * invDet,d20 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet); + return new oimo_common_Mat3(d00 * invDet,-(this.e01 * this.e22 - this.e02 * this.e21) * invDet,(this.e01 * this.e12 - this.e02 * this.e11) * invDet,-d01 * invDet,(this.e00 * this.e22 - this.e02 * this.e20) * invDet,-(this.e00 * this.e12 - this.e02 * this.e10) * invDet,d02 * invDet,-(this.e00 * this.e21 - this.e01 * this.e20) * invDet,(this.e00 * this.e11 - this.e01 * this.e10) * invDet); } ,inverseEq: function() { var d00 = this.e11 * this.e22 - this.e12 * this.e21; var d01 = this.e10 * this.e22 - this.e12 * this.e20; var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var d10 = this.e01 * this.e22 - this.e02 * this.e21; - var d11 = this.e00 * this.e22 - this.e02 * this.e20; - var d12 = this.e00 * this.e21 - this.e01 * this.e20; - var d20 = this.e01 * this.e12 - this.e02 * this.e11; - var d21 = this.e00 * this.e12 - this.e02 * this.e10; - var d22 = this.e00 * this.e11 - this.e01 * this.e10; var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } - var t00 = d00 * invDet; - var t01 = -d10 * invDet; - var t02 = d20 * invDet; - var t10 = -d01 * invDet; - var t11 = d11 * invDet; - var t12 = -d21 * invDet; - var t20 = d02 * invDet; - var t21 = -d12 * invDet; - var t22 = d22 * invDet; - this.e00 = t00; - this.e01 = t01; + var t02 = (this.e01 * this.e12 - this.e02 * this.e11) * invDet; + var t11 = (this.e00 * this.e22 - this.e02 * this.e20) * invDet; + var t12 = -(this.e00 * this.e12 - this.e02 * this.e10) * invDet; + var t21 = -(this.e00 * this.e21 - this.e01 * this.e20) * invDet; + var t22 = (this.e00 * this.e11 - this.e01 * this.e10) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * this.e22 - this.e02 * this.e21) * invDet; this.e02 = t02; - this.e10 = t10; + this.e10 = -d01 * invDet; this.e11 = t11; this.e12 = t12; - this.e20 = t20; + this.e20 = d02 * invDet; this.e21 = t21; this.e22 = t22; return this; @@ -15511,24 +14375,15 @@ oimo_common_Mat3.prototype = { var cx = Math.cos(eulerAngles.x); var cy = Math.cos(eulerAngles.y); var cz = Math.cos(eulerAngles.z); - var t00 = cy * cz; - var t01 = -cy * sz; - var t02 = sy; - var t10 = cx * sz + cz * sx * sy; - var t11 = cx * cz - sx * sy * sz; - var t12 = -cy * sx; - var t20 = sx * sz - cx * cz * sy; - var t21 = cz * sx + cx * sy * sz; - var t22 = cx * cy; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = cy * cz; + this.e01 = -cy * sz; + this.e02 = sy; + this.e10 = cx * sz + cz * sx * sy; + this.e11 = cx * cz - sx * sy * sz; + this.e12 = -cy * sx; + this.e20 = sx * sz - cx * cz * sy; + this.e21 = cz * sx + cx * sy * sz; + this.e22 = cx * cy; return this; } ,toEulerXyz: function() { @@ -15541,10 +14396,7 @@ oimo_common_Mat3.prototype = { var xAddZ = Math.atan2(this.e21,this.e11); return new oimo_common_Vec3(xAddZ * 0.5,1.570796326794895,xAddZ * 0.5); } - var y = Math.asin(sy); - var x = Math.atan2(-this.e12,this.e22); - var z = Math.atan2(-this.e01,this.e00); - return new oimo_common_Vec3(x,y,z); + return new oimo_common_Vec3(Math.atan2(-this.e12,this.e22),Math.asin(sy),Math.atan2(-this.e01,this.e00)); } ,getRow: function(index) { if(index == 0) { @@ -15591,45 +14443,27 @@ oimo_common_Mat3.prototype = { } } ,fromRows: function(row0,row1,row2) { - var t00 = row0.x; - var t01 = row0.y; - var t02 = row0.z; - var t10 = row1.x; - var t11 = row1.y; - var t12 = row1.z; - var t20 = row2.x; - var t21 = row2.y; - var t22 = row2.z; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = row0.x; + this.e01 = row0.y; + this.e02 = row0.z; + this.e10 = row1.x; + this.e11 = row1.y; + this.e12 = row1.z; + this.e20 = row2.x; + this.e21 = row2.y; + this.e22 = row2.z; return this; } ,fromCols: function(col0,col1,col2) { - var t00 = col0.x; - var t01 = col1.x; - var t02 = col2.x; - var t10 = col0.y; - var t11 = col1.y; - var t12 = col2.y; - var t20 = col0.z; - var t21 = col1.z; - var t22 = col2.z; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = col0.x; + this.e01 = col1.x; + this.e02 = col2.x; + this.e10 = col0.y; + this.e11 = col1.y; + this.e12 = col2.y; + this.e20 = col0.z; + this.e21 = col1.z; + this.e22 = col2.z; return this; } ,toString: function() { @@ -15724,38 +14558,22 @@ oimo_common_Mat4.prototype = { return this; } ,identity: function() { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t03 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t13 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } ,add: function(m) { @@ -15771,143 +14589,94 @@ oimo_common_Mat4.prototype = { return new oimo_common_Mat4(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32,this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32,this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32,this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33,this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30,this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31,this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32,this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33); } ,addEq: function(m) { - var t00 = this.e00 + m.e00; - var t01 = this.e01 + m.e01; - var t02 = this.e02 + m.e02; - var t03 = this.e03 + m.e03; - var t10 = this.e10 + m.e10; - var t11 = this.e11 + m.e11; - var t12 = this.e12 + m.e12; - var t13 = this.e13 + m.e13; - var t20 = this.e20 + m.e20; - var t21 = this.e21 + m.e21; - var t22 = this.e22 + m.e22; - var t23 = this.e23 + m.e23; - var t30 = this.e30 + m.e30; - var t31 = this.e31 + m.e31; - var t32 = this.e32 + m.e32; - var t33 = this.e33 + m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e03 += m.e03; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e13 += m.e13; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; + this.e23 += m.e23; + this.e30 += m.e30; + this.e31 += m.e31; + this.e32 += m.e32; + this.e33 += m.e33; return this; } ,subEq: function(m) { - var t00 = this.e00 - m.e00; - var t01 = this.e01 - m.e01; - var t02 = this.e02 - m.e02; - var t03 = this.e03 - m.e03; - var t10 = this.e10 - m.e10; - var t11 = this.e11 - m.e11; - var t12 = this.e12 - m.e12; - var t13 = this.e13 - m.e13; - var t20 = this.e20 - m.e20; - var t21 = this.e21 - m.e21; - var t22 = this.e22 - m.e22; - var t23 = this.e23 - m.e23; - var t30 = this.e30 - m.e30; - var t31 = this.e31 - m.e31; - var t32 = this.e32 - m.e32; - var t33 = this.e33 - m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e03 -= m.e03; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e13 -= m.e13; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; + this.e23 -= m.e23; + this.e30 -= m.e30; + this.e31 -= m.e31; + this.e32 -= m.e32; + this.e33 -= m.e33; return this; } ,scaleEq: function(s) { - var t00 = this.e00 * s; - var t01 = this.e01 * s; - var t02 = this.e02 * s; - var t03 = this.e03 * s; - var t10 = this.e10 * s; - var t11 = this.e11 * s; - var t12 = this.e12 * s; - var t13 = this.e13 * s; - var t20 = this.e20 * s; - var t21 = this.e21 * s; - var t22 = this.e22 * s; - var t23 = this.e23 * s; - var t30 = this.e30 * s; - var t31 = this.e31 * s; - var t32 = this.e32 * s; - var t33 = this.e33 * s; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e03 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e13 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; + this.e23 *= s; + this.e30 *= s; + this.e31 *= s; + this.e32 *= s; + this.e33 *= s; return this; } ,mulEq: function(m) { - var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; - var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; - var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; - var t03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; - var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; - var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; - var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; - var t13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; - var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; - var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; - var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; - var t23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; - var t30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; - var t31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; - var t32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; - var t33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; + var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; + var e03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; + var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; + var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; + var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; + var e13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; + var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; + var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; + var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; + var e23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; + var e30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; + var e31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; + var e32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; + var e33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; return this; } ,prependScale: function(sx,sy,sz) { @@ -15953,73 +14722,41 @@ oimo_common_Mat4.prototype = { return new oimo_common_Mat4(this.e00,this.e01,this.e02,this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03,this.e10,this.e11,this.e12,this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13,this.e20,this.e21,this.e22,this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23,this.e30,this.e31,this.e32,this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33); } ,prependScaleEq: function(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sx; - var t02 = this.e02 * sx; - var t03 = this.e03 * sx; - var t10 = this.e10 * sy; - var t11 = this.e11 * sy; - var t12 = this.e12 * sy; - var t13 = this.e13 * sy; - var t20 = this.e20 * sz; - var t21 = this.e21 * sz; - var t22 = this.e22 * sz; - var t23 = this.e23 * sz; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e03 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e13 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; + this.e23 *= sz; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } ,appendScaleEq: function(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sy; - var t02 = this.e02 * sz; - var t03 = this.e03; - var t10 = this.e10 * sx; - var t11 = this.e11 * sy; - var t12 = this.e12 * sz; - var t13 = this.e13; - var t20 = this.e20 * sx; - var t21 = this.e21 * sy; - var t22 = this.e22 * sz; - var t23 = this.e23; - var t30 = this.e30 * sx; - var t31 = this.e31 * sy; - var t32 = this.e32 * sz; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e03 = this.e03; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e13 = this.e13; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; + this.e23 = this.e23; + this.e30 *= sx; + this.e31 *= sy; + this.e32 *= sz; + this.e33 = this.e33; return this; } ,prependRotationEq: function(rad,axisX,axisY,axisZ) { @@ -16035,38 +14772,30 @@ oimo_common_Mat4.prototype = { var r20 = axisZ * axisX * c1 - axisY * s; var r21 = axisZ * axisY * c1 + axisX * s; var r22 = axisZ * axisZ * c1 + c; - var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; - var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; - var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; - var t03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; - var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var t13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; - var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; - var t23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var e13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; + var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + var e23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } ,appendRotationEq: function(rad,axisX,axisY,axisZ) { @@ -16082,146 +14811,100 @@ oimo_common_Mat4.prototype = { var r20 = axisZ * axisX * c1 - axisY * s; var r21 = axisZ * axisY * c1 + axisX * s; var r22 = axisZ * axisZ * c1 + c; - var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; - var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var t03 = this.e03; - var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; - var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var t13 = this.e13; - var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; - var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; - var t23 = this.e23; - var t30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; - var t31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; - var t32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + var e31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; + var e32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e03 = this.e03; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e13 = this.e13; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; + this.e23 = this.e23; + this.e30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; return this; } ,prependTranslationEq: function(tx,ty,tz) { - var t00 = this.e00 + tx * this.e30; - var t01 = this.e01 + tx * this.e31; - var t02 = this.e02 + tx * this.e32; - var t03 = this.e03 + tx * this.e33; - var t10 = this.e10 + ty * this.e30; - var t11 = this.e11 + ty * this.e31; - var t12 = this.e12 + ty * this.e32; - var t13 = this.e13 + ty * this.e33; - var t20 = this.e20 + tz * this.e30; - var t21 = this.e21 + tz * this.e31; - var t22 = this.e22 + tz * this.e32; - var t23 = this.e23 + tz * this.e33; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 += tx * this.e30; + this.e01 += tx * this.e31; + this.e02 += tx * this.e32; + this.e03 += tx * this.e33; + this.e10 += ty * this.e30; + this.e11 += ty * this.e31; + this.e12 += ty * this.e32; + this.e13 += ty * this.e33; + this.e20 += tz * this.e30; + this.e21 += tz * this.e31; + this.e22 += tz * this.e32; + this.e23 += tz * this.e33; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } ,appendTranslationEq: function(tx,ty,tz) { - var t00 = this.e00; - var t01 = this.e01; - var t02 = this.e02; - var t03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; - var t10 = this.e10; - var t11 = this.e11; - var t12 = this.e12; - var t13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; - var t20 = this.e20; - var t21 = this.e21; - var t22 = this.e22; - var t23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + var e03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; + var e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; + var e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; + var e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; + this.e00 = this.e00; + this.e01 = this.e01; + this.e02 = this.e02; + this.e03 = e03; + this.e10 = this.e10; + this.e11 = this.e11; + this.e12 = this.e12; + this.e13 = e13; + this.e20 = this.e20; + this.e21 = this.e21; + this.e22 = this.e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = e33; return this; } ,transpose: function() { return new oimo_common_Mat4(this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33); } ,transposeEq: function() { - var t00 = this.e00; - var t01 = this.e10; - var t02 = this.e20; - var t03 = this.e30; - var t10 = this.e01; - var t11 = this.e11; - var t12 = this.e21; - var t13 = this.e31; - var t20 = this.e02; - var t21 = this.e12; - var t22 = this.e22; - var t23 = this.e32; - var t30 = this.e03; - var t31 = this.e13; - var t32 = this.e23; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + var e10 = this.e01; + var e20 = this.e02; + var e21 = this.e12; + var e30 = this.e03; + var e31 = this.e13; + var e32 = this.e23; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e03 = this.e30; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e13 = this.e31; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; + this.e23 = this.e32; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; return this; } ,determinant: function() { @@ -16253,23 +14936,11 @@ oimo_common_Mat4.prototype = { var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; - var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; - var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; - var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; - var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; - var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; - var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; - var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; - var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; - var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; - var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; - var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } - return new oimo_common_Mat4(d00 * invDet,-d10 * invDet,d20 * invDet,-d30 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d31 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet,-d32 * invDet,-d03 * invDet,d13 * invDet,-d23 * invDet,d33 * invDet); + return new oimo_common_Mat4(d00 * invDet,-(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet,(this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet,-(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet,-d01 * invDet,(this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet,-(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet,(this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet,d02 * invDet,-(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet,(this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet,-(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet,-d03 * invDet,(this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet,-(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet,(this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet); } ,inverseEq: function() { var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; @@ -16288,51 +14959,29 @@ oimo_common_Mat4.prototype = { var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; - var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; - var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; - var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; - var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; - var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; - var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; - var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; - var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; - var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; - var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; - var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } - var t00 = d00 * invDet; - var t01 = -d10 * invDet; - var t02 = d20 * invDet; - var t03 = -d30 * invDet; - var t10 = -d01 * invDet; - var t11 = d11 * invDet; - var t12 = -d21 * invDet; - var t13 = d31 * invDet; - var t20 = d02 * invDet; - var t21 = -d12 * invDet; - var t22 = d22 * invDet; - var t23 = -d32 * invDet; - var t30 = -d03 * invDet; - var t31 = d13 * invDet; - var t32 = -d23 * invDet; - var t33 = d33 * invDet; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; + var t11 = (this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet; + var t21 = -(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet; + var t23 = -(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet; + var t31 = (this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet; + var t32 = -(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet; + var t33 = (this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet; + this.e02 = (this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet; + this.e03 = -(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet; + this.e10 = -d01 * invDet; this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; + this.e12 = -(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet; + this.e13 = (this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet; + this.e20 = d02 * invDet; this.e21 = t21; - this.e22 = t22; + this.e22 = (this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet; this.e23 = t23; - this.e30 = t30; + this.e30 = -d03 * invDet; this.e31 = t31; this.e32 = t32; this.e33 = t33; @@ -16445,38 +15094,22 @@ oimo_common_Mat4.prototype = { return this; } ,fromMat3: function(m) { - var t00 = m.e00; - var t01 = m.e01; - var t02 = m.e02; - var t03 = 0; - var t10 = m.e10; - var t11 = m.e11; - var t12 = m.e12; - var t13 = 0; - var t20 = m.e20; - var t21 = m.e21; - var t22 = m.e22; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e03 = 0; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e13 = 0; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } ,fromTransform: function(transform) { @@ -16578,17 +15211,13 @@ oimo_common_MathUtil.randVec3 = function() { return new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); }; var oimo_common_Pool = function() { - var this1 = new Array(256); - this.stackVec3 = this1; + this.stackVec3 = new Array(256); this.sizeVec3 = 0; - var this2 = new Array(256); - this.stackMat3 = this2; + this.stackMat3 = new Array(256); this.sizeMat3 = 0; - var this3 = new Array(256); - this.stackMat4 = this3; + this.stackMat4 = new Array(256); this.sizeMat4 = 0; - var this4 = new Array(256); - this.stackQuat = this4; + this.stackQuat = new Array(256); this.sizeQuat = 0; }; oimo_common_Pool.prototype = { @@ -16624,13 +15253,11 @@ oimo_common_Pool.prototype = { if(vec3 != null) { vec3.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newLength = this.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.sizeVec3 << 1); + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -16639,32 +15266,21 @@ oimo_common_Pool.prototype = { this.stackVec3[this.sizeVec3++] = vec3; } if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; + mat3.e00 = 1; + mat3.e01 = 0; + mat3.e02 = 0; + mat3.e10 = 0; + mat3.e11 = 1; + mat3.e12 = 0; + mat3.e20 = 0; + mat3.e21 = 0; + mat3.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newLength1 = this.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = this.sizeMat3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(this.sizeMat3 << 1); + var _g2 = 0; + var _g11 = this.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = this.stackMat3[i1]; this.stackMat3[i1] = null; } @@ -16673,46 +15289,28 @@ oimo_common_Pool.prototype = { this.stackMat3[this.sizeMat3++] = mat3; } if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; + mat4.e00 = 1; + mat4.e01 = 0; + mat4.e02 = 0; + mat4.e03 = 0; + mat4.e10 = 0; + mat4.e11 = 1; + mat4.e12 = 0; + mat4.e13 = 0; + mat4.e20 = 0; + mat4.e21 = 0; + mat4.e22 = 1; + mat4.e23 = 0; + mat4.e30 = 0; + mat4.e31 = 0; + mat4.e32 = 0; + mat4.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newLength2 = this.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = this.sizeMat4; - while(_g12 < _g3) { - var i2 = _g12++; + var newArray2 = new Array(this.sizeMat4 << 1); + var _g3 = 0; + var _g12 = this.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; newArray2[i2] = this.stackMat4[i2]; this.stackMat4[i2] = null; } @@ -16721,22 +15319,16 @@ oimo_common_Pool.prototype = { this.stackMat4[this.sizeMat4++] = mat4; } if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; + quat.x = 0; + quat.y = 0; + quat.z = 0; + quat.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newLength3 = this.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = this.sizeQuat; - while(_g13 < _g4) { - var i3 = _g13++; + var newArray3 = new Array(this.sizeQuat << 1); + var _g4 = 0; + var _g13 = this.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; newArray3[i3] = this.stackQuat[i3]; this.stackQuat[i3] = null; } @@ -16748,13 +15340,11 @@ oimo_common_Pool.prototype = { ,disposeVec3: function(v) { v.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newLength = this.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.sizeVec3 << 1); + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -16763,32 +15353,21 @@ oimo_common_Pool.prototype = { this.stackVec3[this.sizeVec3++] = v; } ,disposeMat3: function(m) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newLength = this.sizeMat3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.sizeMat3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.sizeMat3 << 1); + var _g = 0; + var _g1 = this.sizeMat3; + while(_g < _g1) { + var i = _g++; newArray[i] = this.stackMat3[i]; this.stackMat3[i] = null; } @@ -16797,46 +15376,28 @@ oimo_common_Pool.prototype = { this.stackMat3[this.sizeMat3++] = m; } ,disposeMat4: function(m) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t03 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t13 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e03 = t03; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e13 = t13; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - m.e23 = t23; - m.e30 = t30; - m.e31 = t31; - m.e32 = t32; - m.e33 = t33; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e03 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e13 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + m.e23 = 0; + m.e30 = 0; + m.e31 = 0; + m.e32 = 0; + m.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newLength = this.sizeMat4 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.sizeMat4; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.sizeMat4 << 1); + var _g = 0; + var _g1 = this.sizeMat4; + while(_g < _g1) { + var i = _g++; newArray[i] = this.stackMat4[i]; this.stackMat4[i] = null; } @@ -16845,22 +15406,16 @@ oimo_common_Pool.prototype = { this.stackMat4[this.sizeMat4++] = m; } ,disposeQuat: function(q) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - q.x = tx; - q.y = ty; - q.z = tz; - q.w = tw; + q.x = 0; + q.y = 0; + q.z = 0; + q.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newLength = this.sizeQuat << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.sizeQuat; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.sizeQuat << 1); + var _g = 0; + var _g1 = this.sizeQuat; + while(_g < _g1) { + var i = _g++; newArray[i] = this.stackQuat[i]; this.stackQuat[i] = null; } @@ -16890,14 +15445,10 @@ var oimo_common_Quat = function(x,y,z,w) { }; oimo_common_Quat.prototype = { identity: function() { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; return this; } ,init: function(x,y,z,w) { @@ -16917,36 +15468,24 @@ oimo_common_Quat.prototype = { return new oimo_common_Quat(this.x * s,this.y * s,this.z * s,this.w * s); } ,addEq: function(q) { - var tx = this.x + q.x; - var ty = this.y + q.y; - var tz = this.z + q.z; - var tw = this.w + q.w; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x += q.x; + this.y += q.y; + this.z += q.z; + this.w += q.w; return this; } ,subEq: function(q) { - var tx = this.x - q.x; - var ty = this.y - q.y; - var tz = this.z - q.z; - var tw = this.w - q.w; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x -= q.x; + this.y -= q.y; + this.z -= q.z; + this.w -= q.w; return this; } ,scaleEq: function(s) { - var tx = this.x * s; - var ty = this.y * s; - var tz = this.z * s; - var tw = this.w * s; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x *= s; + this.y *= s; + this.z *= s; + this.w *= s; return this; } ,length: function() { @@ -16970,14 +15509,10 @@ oimo_common_Quat.prototype = { if(invLen > 0) { invLen = 1 / invLen; } - var tx = this.x * invLen; - var ty = this.y * invLen; - var tz = this.z * invLen; - var tw = this.w * invLen; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; + this.w *= invLen; return this; } ,setArc: function(v1,v2) { @@ -17019,12 +15554,9 @@ oimo_common_Quat.prototype = { return this; } d = 0.5 / this.w; - var cx = y1 * z2 - z1 * y2; - var cy = z1 * x2 - x1 * z2; - var cz = x1 * y2 - y1 * x2; - this.x = cx * d; - this.y = cy * d; - this.z = cz * d; + this.x = (y1 * z2 - z1 * y2) * d; + this.y = (z1 * x2 - x1 * z2) * d; + this.z = (x1 * y2 - y1 * x2) * d; return this; } ,slerp: function(q,t) { @@ -17051,14 +15583,10 @@ oimo_common_Quat.prototype = { if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - var tw = _this.w * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - _this.w = tw; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + _this.w *= invLen; return _this; } var theta = t * Math.acos(d); @@ -17191,8 +15719,7 @@ oimo_dynamics_Contact.prototype = { var ptouching = this._touching; var result = this._detectorResult; this._detector.detect(result,this._s1._geom,this._s2._geom,this._s1._transform,this._s2._transform,this._cachedDetectorData); - var num = result.numPoints; - this._touching = num > 0; + this._touching = result.numPoints > 0; if(this._touching) { this._manifold._buildBasis(result.normal); if(result.getMaxDepth() > oimo_common_Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold) { @@ -17209,57 +15736,29 @@ oimo_dynamics_Contact.prototype = { this._manifold._clear(); } if(this._touching && !ptouching) { - var cc1 = this._s1._contactCallback; var cc2 = this._s2._contactCallback; - if(cc1 == cc2) { + if(this._s1._contactCallback == cc2) { cc2 = null; } - if(cc1 != null) { - cc1.beginContact(this); - } - if(cc2 != null) { - cc2.beginContact(this); - } } if(!this._touching && ptouching) { - var cc11 = this._s1._contactCallback; var cc21 = this._s2._contactCallback; - if(cc11 == cc21) { + if(this._s1._contactCallback == cc21) { cc21 = null; } - if(cc11 != null) { - cc11.endContact(this); - } - if(cc21 != null) { - cc21.endContact(this); - } } if(this._touching) { - var cc12 = this._s1._contactCallback; var cc22 = this._s2._contactCallback; - if(cc12 == cc22) { + if(this._s1._contactCallback == cc22) { cc22 = null; } - if(cc12 != null) { - cc12.preSolve(this); - } - if(cc22 != null) { - cc22.preSolve(this); - } } } ,_postSolve: function() { - var cc1 = this._s1._contactCallback; var cc2 = this._s2._contactCallback; - if(cc1 == cc2) { + if(this._s1._contactCallback == cc2) { cc2 = null; } - if(cc1 != null) { - cc1.postSolve(this); - } - if(cc2 != null) { - cc2.postSolve(this); - } } ,getShape1: function() { return this._s1; @@ -17328,10 +15827,8 @@ oimo_dynamics_ContactManager.prototype = { } var b1 = s1._rigidBody; var b2 = s2._rigidBody; - var n1 = b1._numContactLinks; - var n2 = b2._numContactLinks; var l; - if(n1 < n2) { + if(b1._numContactLinks < b2._numContactLinks) { l = b1._contactLinkList; } else { l = b2._contactLinkList; @@ -17340,14 +15837,13 @@ oimo_dynamics_ContactManager.prototype = { var id2 = s2._id; var found = false; while(l != null) { - var n3 = l._next; var c = l._contact; if(c._s1._id == id1 && c._s2._id == id2) { c._latest = true; found = true; break; } - l = n3; + l = l._next; } if(!found) { var first = this._contactPool; @@ -17405,9 +15901,7 @@ oimo_dynamics_ContactManager.prototype = { _this._tf2 = _this._b2._transform; this._numContacts++; } - if(!false) { - break; - } + break; } pp = n; } @@ -17441,17 +15935,10 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(cc1 == cc2) { + if(c._s1._contactCallback == cc2) { cc2 = null; } - if(cc1 != null) { - cc1.endContact(c); - } - if(cc2 != null) { - cc2.endContact(c); - } } var prev1 = c._link1._prev; var next1 = c._link1._next; @@ -17515,9 +16002,7 @@ oimo_dynamics_ContactManager.prototype = { var s2 = c._s2; var r1 = s1._rigidBody; var r2 = s2._rigidBody; - var active1 = !r1._sleeping && r1._type != 1; - var active2 = !r2._sleeping && r2._type != 1; - if(!active1 && !active2) { + if(!(!r1._sleeping && r1._type != 1) && !(!r2._sleeping && r2._type != 1)) { c._shouldBeSkipped = true; break; } @@ -17543,17 +16028,10 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc11 = c._s1._contactCallback; var cc21 = c._s2._contactCallback; - if(cc11 == cc21) { + if(c._s1._contactCallback == cc21) { cc21 = null; } - if(cc11 != null) { - cc11.endContact(c); - } - if(cc21 != null) { - cc21.endContact(c); - } } var prev4 = c._link1._prev; var next4 = c._link1._next; @@ -17613,11 +16091,8 @@ oimo_dynamics_ContactManager.prototype = { this._numContacts--; break; } - var aabbOverlapping = aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ; - c._shouldBeSkipped = !aabbOverlapping; - if(!false) { - break; - } + c._shouldBeSkipped = !(aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ); + break; } c = n; } @@ -17644,11 +16119,10 @@ oimo_dynamics_ContactManager.prototype = { other = r1; } while(jl != null) { - var n = jl._next; if(jl._other == other && !jl._joint._allowCollision) { return false; } - jl = n; + jl = jl._next; } return true; } @@ -17675,18 +16149,10 @@ oimo_dynamics_ContactManager.prototype = { } }; var oimo_dynamics_Island = function() { - var length = oimo_common_Setting.islandInitialRigidBodyArraySize; - var this1 = new Array(length); - this.rigidBodies = this1; - var length1 = oimo_common_Setting.islandInitialConstraintArraySize; - var this2 = new Array(length1); - this.solvers = this2; - var length2 = oimo_common_Setting.islandInitialConstraintArraySize; - var this3 = new Array(length2); - this.solversSi = this3; - var length3 = oimo_common_Setting.islandInitialConstraintArraySize; - var this4 = new Array(length3); - this.solversNgs = this4; + this.rigidBodies = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); + this.solvers = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversSi = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversNgs = new Array(oimo_common_Setting.islandInitialConstraintArraySize); this.numRigidBodies = 0; this.numSolvers = 0; this.numSolversSi = 0; @@ -17701,13 +16167,11 @@ oimo_dynamics_Island.prototype = { } ,_addRigidBody: function(rigidBody) { if(this.numRigidBodies == this.rigidBodies.length) { - var newLength = this.numRigidBodies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.numRigidBodies; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.numRigidBodies << 1); + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var i = _g++; newArray[i] = this.rigidBodies[i]; this.rigidBodies[i] = null; } @@ -17718,13 +16182,11 @@ oimo_dynamics_Island.prototype = { } ,_addConstraintSolver: function(solver,positionCorrection) { if(this.numSolvers == this.solvers.length) { - var newLength = this.numSolvers << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this.numSolvers; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this.numSolvers << 1); + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) { + var i = _g++; newArray[i] = this.solvers[i]; this.solvers[i] = null; } @@ -17734,13 +16196,11 @@ oimo_dynamics_Island.prototype = { this.solvers[this.numSolvers++] = solver; if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.SPLIT_IMPULSE) { if(this.numSolversSi == this.solversSi.length) { - var newLength1 = this.numSolversSi << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = this.numSolversSi; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(this.numSolversSi << 1); + var _g2 = 0; + var _g11 = this.numSolversSi; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = this.solversSi[i1]; this.solversSi[i1] = null; } @@ -17750,13 +16210,11 @@ oimo_dynamics_Island.prototype = { } if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.NGS) { if(this.numSolversNgs == this.solversNgs.length) { - var newLength2 = this.numSolversNgs << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = this.numSolversNgs; - while(_g12 < _g3) { - var i2 = _g12++; + var newArray2 = new Array(this.numSolversNgs << 1); + var _g3 = 0; + var _g12 = this.numSolversNgs; + while(_g3 < _g12) { + var i2 = _g3++; newArray2[i2] = this.solversNgs[i2]; this.solversNgs[i2] = null; } @@ -17781,6 +16239,12 @@ oimo_dynamics_Island.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo_common_Setting.sleepingVelocityThreshold * oimo_common_Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo_common_Setting.sleepingAngularVelocityThreshold * oimo_common_Setting.sleepingAngularVelocityThreshold) { rb._sleepTime += dt; if(rb._sleepTime > oimo_common_Setting.sleepingTimeThreshold) { @@ -17798,11 +16262,9 @@ oimo_dynamics_Island.prototype = { var x1 = dt * rb._angularDamping; var x21 = x1 * x1; var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); - var linAcc; var linAccX; var linAccY; var linAccZ; - var angAcc; var angAccX; var angAccY; var angAccZ; @@ -17838,9 +16300,10 @@ oimo_dynamics_Island.prototype = { var s = rb._shapeList; while(s != null) { var n = s._next; + var tf1 = rb._ptransform; + var tf2 = rb._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = rb._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -17850,15 +16313,15 @@ oimo_dynamics_Island.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__00; dst1._rotation01 = __tmp__01; dst1._rotation02 = __tmp__02; @@ -17871,18 +16334,17 @@ oimo_dynamics_Island.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = rb._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -17892,15 +16354,15 @@ oimo_dynamics_Island.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__001; dst2._rotation01 = __tmp__011; dst2._rotation02 = __tmp__021; @@ -17913,20 +16375,18 @@ oimo_dynamics_Island.prototype = { var __tmp__X2; var __tmp__Y2; var __tmp__Z2; - __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X2; dst2._positionY = __tmp__Y2; dst2._positionZ = __tmp__Z2; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -17945,7 +16405,6 @@ oimo_dynamics_Island.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -17965,11 +16424,10 @@ oimo_dynamics_Island.prototype = { ,_step: function(timeStep,numVelocityIterations,numPositionIterations) { var dt = timeStep.dt; var sleepIsland = true; - var _g1 = 0; - var _g = this.numRigidBodies; - while(_g1 < _g) { - var i = _g1++; - var rb = this.rigidBodies[i]; + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var rb = this.rigidBodies[_g++]; var dst = rb._ptransform; var src = rb._transform; dst._positionX = src._positionX; @@ -17984,6 +16442,12 @@ oimo_dynamics_Island.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; rb._sleeping = false; if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo_common_Setting.sleepingVelocityThreshold * oimo_common_Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo_common_Setting.sleepingAngularVelocityThreshold * oimo_common_Setting.sleepingAngularVelocityThreshold) { rb._sleepTime += dt; @@ -18000,11 +16464,9 @@ oimo_dynamics_Island.prototype = { var x1 = dt * rb._angularDamping; var x21 = x1 * x1; var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); - var linAcc; var linAccX; var linAccY; var linAccZ; - var angAcc; var angAccX; var angAccY; var angAccZ; @@ -18038,119 +16500,71 @@ oimo_dynamics_Island.prototype = { } } if(sleepIsland) { - var _g11 = 0; - var _g2 = this.numRigidBodies; - while(_g11 < _g2) { - var i1 = _g11++; - var rb1 = this.rigidBodies[i1]; + var _g2 = 0; + var _g3 = this.numRigidBodies; + while(_g2 < _g3) { + var rb1 = this.rigidBodies[_g2++]; rb1._sleeping = true; rb1._sleepTime = 0; } return; } + var _g21 = 0; + var _g31 = this.numSolvers; + while(_g21 < _g31) this.solvers[_g21++].preSolveVelocity(timeStep); + var _g4 = 0; + var _g5 = this.numSolvers; + while(_g4 < _g5) this.solvers[_g4++].warmStart(timeStep); + var _g6 = 0; + while(_g6 < numVelocityIterations) { + ++_g6; + var _g61 = 0; + var _g7 = this.numSolvers; + while(_g61 < _g7) this.solvers[_g61++].solveVelocity(); + } + var _g8 = 0; + var _g9 = this.numSolvers; + while(_g8 < _g9) this.solvers[_g8++].postSolveVelocity(timeStep); + var _g10 = 0; + var _g11 = this.numRigidBodies; + while(_g10 < _g11) this.rigidBodies[_g10++]._integrate(dt); var _g12 = 0; - var _g3 = this.numSolvers; - while(_g12 < _g3) { - var i2 = _g12++; - var s = this.solvers[i2]; - s.preSolveVelocity(timeStep); - } - var _g13 = 0; - var _g4 = this.numSolvers; - while(_g13 < _g4) { - var i3 = _g13++; - var s1 = this.solvers[i3]; - s1.warmStart(timeStep); - } + var _g13 = this.numSolversSi; + while(_g12 < _g13) this.solversSi[_g12++].preSolvePosition(timeStep); var _g14 = 0; - var _g5 = numVelocityIterations; - while(_g14 < _g5) { - var t = _g14++; - var _g31 = 0; - var _g21 = this.numSolvers; - while(_g31 < _g21) { - var i4 = _g31++; - var s2 = this.solvers[i4]; - s2.solveVelocity(); - } - } - var _g15 = 0; - var _g6 = this.numSolvers; - while(_g15 < _g6) { - var i5 = _g15++; - var s3 = this.solvers[i5]; - s3.postSolveVelocity(timeStep); + while(_g14 < numPositionIterations) { + ++_g14; + var _g141 = 0; + var _g15 = this.numSolversSi; + while(_g141 < _g15) this.solversSi[_g141++].solvePositionSplitImpulse(); } var _g16 = 0; - var _g7 = this.numRigidBodies; - while(_g16 < _g7) { - var i6 = _g16++; - var rb2 = this.rigidBodies[i6]; - rb2._integrate(dt); - } - var _g17 = 0; - var _g8 = this.numSolversSi; - while(_g17 < _g8) { - var i7 = _g17++; - var s4 = this.solversSi[i7]; - s4.preSolvePosition(timeStep); - } + var _g17 = this.numRigidBodies; + while(_g16 < _g17) this.rigidBodies[_g16++]._integratePseudoVelocity(); var _g18 = 0; - var _g9 = numPositionIterations; - while(_g18 < _g9) { - var t1 = _g18++; - var _g32 = 0; - var _g22 = this.numSolversSi; - while(_g32 < _g22) { - var i8 = _g32++; - var s5 = this.solversSi[i8]; - s5.solvePositionSplitImpulse(); - } - } - var _g19 = 0; - var _g10 = this.numRigidBodies; - while(_g19 < _g10) { - var i9 = _g19++; - var rb3 = this.rigidBodies[i9]; - rb3._integratePseudoVelocity(); - } - var _g110 = 0; - var _g20 = this.numSolversNgs; - while(_g110 < _g20) { - var i10 = _g110++; - var s6 = this.solversNgs[i10]; - s6.preSolvePosition(timeStep); - } - var _g111 = 0; - var _g23 = numPositionIterations; - while(_g111 < _g23) { - var t2 = _g111++; - var _g33 = 0; - var _g24 = this.numSolversNgs; - while(_g33 < _g24) { - var i11 = _g33++; - var s7 = this.solversNgs[i11]; - s7.solvePositionNgs(timeStep); - } - } - var _g112 = 0; - var _g25 = this.numSolvers; - while(_g112 < _g25) { - var i12 = _g112++; - var s8 = this.solvers[i12]; - s8.postSolve(); - } - var _g113 = 0; - var _g26 = this.numRigidBodies; - while(_g113 < _g26) { - var i13 = _g113++; - var rb4 = this.rigidBodies[i13]; - var s9 = rb4._shapeList; - while(s9 != null) { - var n = s9._next; - var dst1 = s9._ptransform; - var src1 = s9._localTransform; - var src2 = rb4._ptransform; + var _g19 = this.numSolversNgs; + while(_g18 < _g19) this.solversNgs[_g18++].preSolvePosition(timeStep); + var _g20 = 0; + while(_g20 < numPositionIterations) { + ++_g20; + var _g201 = 0; + var _g211 = this.numSolversNgs; + while(_g201 < _g211) this.solversNgs[_g201++].solvePositionNgs(timeStep); + } + var _g22 = 0; + var _g23 = this.numSolvers; + while(_g22 < _g23) this.solvers[_g22++].postSolve(); + var _g24 = 0; + var _g25 = this.numRigidBodies; + while(_g24 < _g25) { + var rb2 = this.rigidBodies[_g24++]; + var s = rb2._shapeList; + while(s != null) { + var n = s._next; + var tf1 = rb2._ptransform; + var tf2 = rb2._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -18160,15 +16574,15 @@ oimo_dynamics_Island.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__00; dst1._rotation01 = __tmp__01; dst1._rotation02 = __tmp__02; @@ -18181,18 +16595,17 @@ oimo_dynamics_Island.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s9._transform; - var src11 = s9._localTransform; - var src21 = rb4._transform; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -18202,15 +16615,15 @@ oimo_dynamics_Island.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__001; dst2._rotation01 = __tmp__011; dst2._rotation02 = __tmp__021; @@ -18223,52 +16636,49 @@ oimo_dynamics_Island.prototype = { var __tmp__X2; var __tmp__Y2; var __tmp__Z2; - __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X2; dst2._positionY = __tmp__Y2; dst2._positionZ = __tmp__Z2; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; - s9._geom._computeAabb(s9._aabb,s9._ptransform); - minX = s9._aabb._minX; - minY = s9._aabb._minY; - minZ = s9._aabb._minZ; - maxX = s9._aabb._maxX; - maxY = s9._aabb._maxY; - maxZ = s9._aabb._maxZ; - s9._geom._computeAabb(s9._aabb,s9._transform); - s9._aabb._minX = minX < s9._aabb._minX ? minX : s9._aabb._minX; - s9._aabb._minY = minY < s9._aabb._minY ? minY : s9._aabb._minY; - s9._aabb._minZ = minZ < s9._aabb._minZ ? minZ : s9._aabb._minZ; - s9._aabb._maxX = maxX > s9._aabb._maxX ? maxX : s9._aabb._maxX; - s9._aabb._maxY = maxY > s9._aabb._maxY ? maxY : s9._aabb._maxY; - s9._aabb._maxZ = maxZ > s9._aabb._maxZ ? maxZ : s9._aabb._maxZ; - if(s9._proxy != null) { - var d; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s9._transform._positionX - s9._ptransform._positionX; - dY = s9._transform._positionY - s9._ptransform._positionY; - dZ = s9._transform._positionZ - s9._ptransform._positionZ; - var v = s9.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s9._rigidBody._world._broadPhase.moveProxy(s9._proxy,s9._aabb,s9.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s9 = n; + s = n; } } } @@ -18309,23 +16719,18 @@ var oimo_dynamics_World = function(broadPhaseType,gravity) { this._convexCastWrapper = new oimo_dynamics__$World_ConvexCastWrapper(); this._aabbTestWrapper = new oimo_dynamics__$World_AabbTestWrapper(); this._island = new oimo_dynamics_Island(); - var length = oimo_common_Setting.islandInitialConstraintArraySize; - var this1 = new Array(length); - this._solversInIslands = this1; - var length1 = oimo_common_Setting.islandInitialRigidBodyArraySize; - var this2 = new Array(length1); - this._rigidBodyStack = this2; + this._solversInIslands = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this._rigidBodyStack = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); this._timeStep = new oimo_dynamics_TimeStep(); this._pool = new oimo_common_Pool(); this._shapeIdCount = 0; }; oimo_dynamics_World.prototype = { _updateContacts: function() { - var st = new Date().getTime() / 1000; + var st = Date.now() / 1000; this._contactManager._updateContacts(); - var en = new Date().getTime() / 1000; - oimo_dynamics_common_Performance.broadPhaseCollisionTime = (en - st) * 1000; - var st1 = new Date().getTime() / 1000; + oimo_dynamics_common_Performance.broadPhaseCollisionTime = (Date.now() / 1000 - st) * 1000; + var st1 = Date.now() / 1000; var c = this._contactManager._contactList; while(c != null) { var n = c._next; @@ -18334,36 +16739,33 @@ oimo_dynamics_World.prototype = { } c = n; } - var en1 = new Date().getTime() / 1000; - oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (en1 - st1) * 1000; + oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (Date.now() / 1000 - st1) * 1000; } ,_solveIslands: function() { - var st = new Date().getTime() / 1000; + var st = Date.now() / 1000; if(oimo_common_Setting.disableSleeping) { var b = this._rigidBodyList; while(b != null) { - var n = b._next; b._sleeping = false; b._sleepTime = 0; - b = n; + b = b._next; } } if(this._rigidBodyStack.length < this._numRigidBodies) { var newStackSize = this._rigidBodyStack.length << 1; while(newStackSize < this._numRigidBodies) newStackSize <<= 1; - var this1 = new Array(newStackSize); - this._rigidBodyStack = this1; + this._rigidBodyStack = new Array(newStackSize); } this._numIslands = 0; var _this = this._island; - var v = this._gravity; - _this.gravityX = v.x; - _this.gravityY = v.y; - _this.gravityZ = v.z; + var gravity = this._gravity; + _this.gravityX = gravity.x; + _this.gravityY = gravity.y; + _this.gravityZ = gravity.z; var b1 = this._rigidBodyList; this._numSolversInIslands = 0; while(b1 != null) { - var n1 = b1._next; + var n = b1._next; while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { this._island._stepSingleRigidBody(this._timeStep,b1); @@ -18374,36 +16776,31 @@ oimo_dynamics_World.prototype = { this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); this._island._clear(); this._numIslands++; - if(!false) { - break; - } + break; } - b1 = n1; + b1 = n; } this._contactManager._postSolve(); b1 = this._rigidBodyList; while(b1 != null) { - var n2 = b1._next; b1._addedToIsland = false; - b1 = n2; + b1 = b1._next; } b1 = this._rigidBodyList; while(b1 != null) { - var n3 = b1._next; b1._forceX = 0; b1._forceY = 0; b1._forceZ = 0; b1._torqueX = 0; b1._torqueY = 0; b1._torqueZ = 0; - b1 = n3; + b1 = b1._next; } while(this._numSolversInIslands > 0) { this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; this._solversInIslands[this._numSolversInIslands] = null; } - var en = new Date().getTime() / 1000; - oimo_dynamics_common_Performance.dynamicsTime = (en - st) * 1000; + oimo_dynamics_common_Performance.dynamicsTime = (Date.now() / 1000 - st) * 1000; } ,buildIsland: function(base) { var stackCount = 1; @@ -18422,13 +16819,11 @@ oimo_dynamics_World.prototype = { var ccs = cl._contact._contactConstraint._solver; if(cc.isTouching() && !ccs._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newLength = this._numSolversInIslands << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = this._numSolversInIslands; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(this._numSolversInIslands << 1); + var _g = 0; + var _g1 = this._numSolversInIslands; + while(_g < _g1) { + var i = _g++; newArray[i] = this._solversInIslands[i]; this._solversInIslands[i] = null; } @@ -18448,23 +16843,21 @@ oimo_dynamics_World.prototype = { while(jl != null) { var n1 = jl._next; var j = jl._joint; - var js = j._solver; - if(!js._addedToIsland) { + var js1 = j._solver; + if(!js1._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newLength1 = this._numSolversInIslands << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = this._numSolversInIslands; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(this._numSolversInIslands << 1); + var _g2 = 0; + var _g11 = this._numSolversInIslands; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = this._solversInIslands[i1]; this._solversInIslands[i1] = null; } this._solversInIslands = newArray1; } - this._solversInIslands[this._numSolversInIslands++] = js; - this._island._addConstraintSolver(js,j._positionCorrectionAlgorithm); + this._solversInIslands[this._numSolversInIslands++] = js1; + this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); var other1 = jl._other; if(!other1._addedToIsland) { this._island._addRigidBody(other1); @@ -18502,13 +16895,11 @@ oimo_dynamics_World.prototype = { if(min != null) { min.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newLength = _this2.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this2.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -18520,13 +16911,11 @@ oimo_dynamics_World.prototype = { if(max != null) { max.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength1 = _this3.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this3.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(_this3.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this3.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = _this3.stackVec3[i1]; _this3.stackVec3[i1] = null; } @@ -18565,8 +16954,7 @@ oimo_dynamics_World.prototype = { if(d.drawShapes) { var geom = s._geom; var tf = s._transform; - var _g = geom._type; - switch(_g) { + switch(geom._type) { case 0: d.sphere(tf,geom._radius,shapeColor); break; @@ -18583,13 +16971,11 @@ oimo_dynamics_World.prototype = { if(hx != null) { hx.zero(); if(_this1.sizeVec3 == _this1.stackVec3.length) { - var newLength = _this1.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g2 = _this1.sizeVec3; - while(_g1 < _g2) { - var i = _g1++; + var newArray = new Array(_this1.sizeVec3 << 1); + var _g = 0; + var _g1 = _this1.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this1.stackVec3[i]; _this1.stackVec3[i] = null; } @@ -18643,35 +17029,27 @@ oimo_dynamics_World.prototype = { v4.x = tf._positionX; v4.y = tf._positionY; v4.z = tf._positionZ; - var _g11 = 0; - var _g3 = n2; - while(_g11 < _g3) { - var i1 = _g11++; + var _g2 = 0; + while(_g2 < n2) { + var i1 = _g2++; var _this10 = g4._tmpVertices[i1]; var v5 = g4._vertices[i1]; _this10.x = v5.x; _this10.y = v5.y; _this10.z = v5.z; - var _this11 = _this10; - var tx = _this11.x * m.e00 + _this11.y * m.e01 + _this11.z * m.e02; - var ty = _this11.x * m.e10 + _this11.y * m.e11 + _this11.z * m.e12; - var tz = _this11.x * m.e20 + _this11.y * m.e21 + _this11.z * m.e22; - _this11.x = tx; - _this11.y = ty; - _this11.z = tz; - var _this12 = _this11; - var tx1 = _this12.x + o.x; - var ty1 = _this12.y + o.y; - var tz1 = _this12.z + o.z; - _this12.x = tx1; - _this12.y = ty1; - _this12.z = tz1; + var y = _this10.x * m.e10 + _this10.y * m.e11 + _this10.z * m.e12; + var z = _this10.x * m.e20 + _this10.y * m.e21 + _this10.z * m.e22; + _this10.x = _this10.x * m.e00 + _this10.y * m.e01 + _this10.z * m.e02; + _this10.y = y; + _this10.z = z; + _this10.x += o.x; + _this10.y += o.y; + _this10.z += o.z; } if(n2 > 30) { - var _g12 = 0; - var _g4 = n2; - while(_g12 < _g4) { - var i2 = _g12++; + var _g21 = 0; + while(_g21 < n2) { + var i2 = _g21++; var v6 = g4._tmpVertices[i2]; v1.x = v6.x; v1.y = v6.y; @@ -18680,266 +17058,216 @@ oimo_dynamics_World.prototype = { v2.x = v7.x; v2.y = v7.y; v2.z = v7.z; - d.line(v1,v2,shapeColor); } } else if(this._debugDraw.wireframe || n2 > 10) { - var _g13 = 0; - var _g5 = n2; - while(_g13 < _g5) { - var i3 = _g13++; + var _g22 = 0; + while(_g22 < n2) { + var i3 = _g22++; var v8 = g4._tmpVertices[i3]; v1.x = v8.x; v1.y = v8.y; v1.z = v8.z; - var _g31 = 0; - var _g21 = i3; - while(_g31 < _g21) { - var j = _g31++; - var v9 = g4._tmpVertices[j]; + var _g23 = 0; + while(_g23 < i3) { + var v9 = g4._tmpVertices[_g23++]; v2.x = v9.x; v2.y = v9.y; v2.z = v9.z; - d.line(v1,v2,shapeColor); } } } else { - var _g14 = 0; - var _g6 = n2; - while(_g14 < _g6) { - var i4 = _g14++; + var _g24 = 0; + while(_g24 < n2) { + var i4 = _g24++; var v10 = g4._tmpVertices[i4]; v1.x = v10.x; v1.y = v10.y; v1.z = v10.z; - var _g32 = 0; - var _g22 = i4; - while(_g32 < _g22) { - var j1 = _g32++; - var v11 = g4._tmpVertices[j1]; + var _g25 = 0; + while(_g25 < i4) { + var j = _g25++; + var v11 = g4._tmpVertices[j]; v2.x = v11.x; v2.y = v11.y; v2.z = v11.z; - var _g51 = 0; - var _g41 = j1; - while(_g51 < _g41) { - var k = _g51++; - var v14 = g4._tmpVertices[k]; + var _g26 = 0; + while(_g26 < j) { + var v14 = g4._tmpVertices[_g26++]; v3.x = v14.x; v3.y = v14.y; v3.z = v14.z; v12.x = v2.x; v12.y = v2.y; v12.z = v2.z; - var _this13 = v12; - var tx2 = _this13.x - v1.x; - var ty2 = _this13.y - v1.y; - var tz2 = _this13.z - v1.z; - _this13.x = tx2; - _this13.y = ty2; - _this13.z = tz2; + var _this11 = v12; + _this11.x -= v1.x; + _this11.y -= v1.y; + _this11.z -= v1.z; v13.x = v3.x; v13.y = v3.y; v13.z = v3.z; - var _this14 = v13; - var tx3 = _this14.x - v1.x; - var ty3 = _this14.y - v1.y; - var tz3 = _this14.z - v1.z; - _this14.x = tx3; - _this14.y = ty3; - _this14.z = tz3; + var _this12 = v13; + _this12.x -= v1.x; + _this12.y -= v1.y; + _this12.z -= v1.z; normal.x = v12.x; normal.y = v12.y; normal.z = v12.z; - var _this15 = normal; - var tx4 = _this15.y * v13.z - _this15.z * v13.y; - var ty4 = _this15.z * v13.x - _this15.x * v13.z; - var tz4 = _this15.x * v13.y - _this15.y * v13.x; - _this15.x = tx4; - _this15.y = ty4; - _this15.z = tz4; - var _this16 = _this15; - var invLen = Math.sqrt(_this16.x * _this16.x + _this16.y * _this16.y + _this16.z * _this16.z); + var _this13 = normal; + var y1 = _this13.z * v13.x - _this13.x * v13.z; + var z1 = _this13.x * v13.y - _this13.y * v13.x; + _this13.x = _this13.y * v13.z - _this13.z * v13.y; + _this13.y = y1; + _this13.z = z1; + var invLen = Math.sqrt(_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx5 = _this16.x * invLen; - var ty5 = _this16.y * invLen; - var tz5 = _this16.z * invLen; - _this16.x = tx5; - _this16.y = ty5; - _this16.z = tz5; - d.triangle(v1,v2,v3,normal,normal,normal,shapeColor); - var tx6 = -normal.x; - var ty6 = -normal.y; - var tz6 = -normal.z; - normal.x = tx6; - normal.y = ty6; - normal.z = tz6; - d.triangle(v1,v3,v2,normal,normal,normal,shapeColor); + _this13.x *= invLen; + _this13.y *= invLen; + _this13.z *= invLen; + normal.x = -normal.x; + normal.y = -normal.y; + normal.z = -normal.z; } } } } - var _this17 = this._pool; + var _this14 = this._pool; if(v1 != null) { v1.zero(); - if(_this17.sizeVec3 == _this17.stackVec3.length) { - var newLength1 = _this17.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g15 = 0; - var _g7 = _this17.sizeVec3; - while(_g15 < _g7) { - var i5 = _g15++; - newArray1[i5] = _this17.stackVec3[i5]; - _this17.stackVec3[i5] = null; + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray1 = new Array(_this14.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this14.sizeVec3; + while(_g3 < _g11) { + var i5 = _g3++; + newArray1[i5] = _this14.stackVec3[i5]; + _this14.stackVec3[i5] = null; } - _this17.stackVec3 = newArray1; + _this14.stackVec3 = newArray1; } - _this17.stackVec3[_this17.sizeVec3++] = v1; + _this14.stackVec3[_this14.sizeVec3++] = v1; } - var _this18 = this._pool; + var _this15 = this._pool; if(v2 != null) { v2.zero(); - if(_this18.sizeVec3 == _this18.stackVec3.length) { - var newLength2 = _this18.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g16 = 0; - var _g8 = _this18.sizeVec3; - while(_g16 < _g8) { - var i6 = _g16++; - newArray2[i6] = _this18.stackVec3[i6]; - _this18.stackVec3[i6] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray2 = new Array(_this15.sizeVec3 << 1); + var _g4 = 0; + var _g12 = _this15.sizeVec3; + while(_g4 < _g12) { + var i6 = _g4++; + newArray2[i6] = _this15.stackVec3[i6]; + _this15.stackVec3[i6] = null; } - _this18.stackVec3 = newArray2; + _this15.stackVec3 = newArray2; } - _this18.stackVec3[_this18.sizeVec3++] = v2; + _this15.stackVec3[_this15.sizeVec3++] = v2; } - var _this19 = this._pool; + var _this16 = this._pool; if(v3 != null) { v3.zero(); - if(_this19.sizeVec3 == _this19.stackVec3.length) { - var newLength3 = _this19.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g17 = 0; - var _g9 = _this19.sizeVec3; - while(_g17 < _g9) { - var i7 = _g17++; - newArray3[i7] = _this19.stackVec3[i7]; - _this19.stackVec3[i7] = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + var newArray3 = new Array(_this16.sizeVec3 << 1); + var _g5 = 0; + var _g13 = _this16.sizeVec3; + while(_g5 < _g13) { + var i7 = _g5++; + newArray3[i7] = _this16.stackVec3[i7]; + _this16.stackVec3[i7] = null; } - _this19.stackVec3 = newArray3; + _this16.stackVec3 = newArray3; } - _this19.stackVec3[_this19.sizeVec3++] = v3; + _this16.stackVec3[_this16.sizeVec3++] = v3; } - var _this20 = this._pool; + var _this17 = this._pool; if(v12 != null) { v12.zero(); - if(_this20.sizeVec3 == _this20.stackVec3.length) { - var newLength4 = _this20.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g18 = 0; - var _g10 = _this20.sizeVec3; - while(_g18 < _g10) { - var i8 = _g18++; - newArray4[i8] = _this20.stackVec3[i8]; - _this20.stackVec3[i8] = null; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + var newArray4 = new Array(_this17.sizeVec3 << 1); + var _g6 = 0; + var _g14 = _this17.sizeVec3; + while(_g6 < _g14) { + var i8 = _g6++; + newArray4[i8] = _this17.stackVec3[i8]; + _this17.stackVec3[i8] = null; } - _this20.stackVec3 = newArray4; + _this17.stackVec3 = newArray4; } - _this20.stackVec3[_this20.sizeVec3++] = v12; + _this17.stackVec3[_this17.sizeVec3++] = v12; } - var _this21 = this._pool; + var _this18 = this._pool; if(v13 != null) { v13.zero(); - if(_this21.sizeVec3 == _this21.stackVec3.length) { - var newLength5 = _this21.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g19 = 0; - var _g20 = _this21.sizeVec3; - while(_g19 < _g20) { - var i9 = _g19++; - newArray5[i9] = _this21.stackVec3[i9]; - _this21.stackVec3[i9] = null; + if(_this18.sizeVec3 == _this18.stackVec3.length) { + var newArray5 = new Array(_this18.sizeVec3 << 1); + var _g7 = 0; + var _g15 = _this18.sizeVec3; + while(_g7 < _g15) { + var i9 = _g7++; + newArray5[i9] = _this18.stackVec3[i9]; + _this18.stackVec3[i9] = null; } - _this21.stackVec3 = newArray5; + _this18.stackVec3 = newArray5; } - _this21.stackVec3[_this21.sizeVec3++] = v13; + _this18.stackVec3[_this18.sizeVec3++] = v13; } - var _this22 = this._pool; + var _this19 = this._pool; if(normal != null) { normal.zero(); - if(_this22.sizeVec3 == _this22.stackVec3.length) { - var newLength6 = _this22.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g110 = 0; - var _g23 = _this22.sizeVec3; - while(_g110 < _g23) { - var i10 = _g110++; - newArray6[i10] = _this22.stackVec3[i10]; - _this22.stackVec3[i10] = null; + if(_this19.sizeVec3 == _this19.stackVec3.length) { + var newArray6 = new Array(_this19.sizeVec3 << 1); + var _g8 = 0; + var _g16 = _this19.sizeVec3; + while(_g8 < _g16) { + var i10 = _g8++; + newArray6[i10] = _this19.stackVec3[i10]; + _this19.stackVec3[i10] = null; } - _this22.stackVec3 = newArray6; + _this19.stackVec3 = newArray6; } - _this22.stackVec3[_this22.sizeVec3++] = normal; + _this19.stackVec3[_this19.sizeVec3++] = normal; } - var _this23 = this._pool; + var _this20 = this._pool; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this23.sizeMat3 == _this23.stackMat3.length) { - var newLength7 = _this23.sizeMat3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g111 = 0; - var _g24 = _this23.sizeMat3; - while(_g111 < _g24) { - var i11 = _g111++; - newArray7[i11] = _this23.stackMat3[i11]; - _this23.stackMat3[i11] = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this20.sizeMat3 == _this20.stackMat3.length) { + var newArray7 = new Array(_this20.sizeMat3 << 1); + var _g9 = 0; + var _g17 = _this20.sizeMat3; + while(_g9 < _g17) { + var i11 = _g9++; + newArray7[i11] = _this20.stackMat3[i11]; + _this20.stackMat3[i11] = null; } - _this23.stackMat3 = newArray7; + _this20.stackMat3 = newArray7; } - _this23.stackMat3[_this23.sizeMat3++] = m; + _this20.stackMat3[_this20.sizeMat3++] = m; } - var _this24 = this._pool; + var _this21 = this._pool; if(o != null) { o.zero(); - if(_this24.sizeVec3 == _this24.stackVec3.length) { - var newLength8 = _this24.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g112 = 0; - var _g25 = _this24.sizeVec3; - while(_g112 < _g25) { - var i12 = _g112++; - newArray8[i12] = _this24.stackVec3[i12]; - _this24.stackVec3[i12] = null; + if(_this21.sizeVec3 == _this21.stackVec3.length) { + var newArray8 = new Array(_this21.sizeVec3 << 1); + var _g10 = 0; + var _g18 = _this21.sizeVec3; + while(_g10 < _g18) { + var i12 = _g10++; + newArray8[i12] = _this21.stackVec3[i12]; + _this21.stackVec3[i12] = null; } - _this24.stackVec3 = newArray8; + _this21.stackVec3 = newArray8; } - _this24.stackVec3[_this24.sizeVec3++] = o; + _this21.stackVec3[_this21.sizeVec3++] = o; } break; } @@ -18947,10 +17275,10 @@ oimo_dynamics_World.prototype = { if(d.drawAabbs) { var aabb = s._aabb; var color = style.aabbColor; - var _this25 = this._pool; - var min = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - var _this26 = this._pool; - var max = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + var _this22 = this._pool; + var min = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; + var _this23 = this._pool; + var max = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; var v15 = min; v15.x = aabb._minX; v15.y = aabb._minY; @@ -18960,41 +17288,37 @@ oimo_dynamics_World.prototype = { v16.y = aabb._maxY; v16.z = aabb._maxZ; d.aabb(min,max,color); - var _this27 = this._pool; + var _this24 = this._pool; if(min != null) { min.zero(); - if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newLength9 = _this27.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g113 = 0; - var _g26 = _this27.sizeVec3; - while(_g113 < _g26) { - var i13 = _g113++; - newArray9[i13] = _this27.stackVec3[i13]; - _this27.stackVec3[i13] = null; + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newArray9 = new Array(_this24.sizeVec3 << 1); + var _g19 = 0; + var _g110 = _this24.sizeVec3; + while(_g19 < _g110) { + var i13 = _g19++; + newArray9[i13] = _this24.stackVec3[i13]; + _this24.stackVec3[i13] = null; } - _this27.stackVec3 = newArray9; + _this24.stackVec3 = newArray9; } - _this27.stackVec3[_this27.sizeVec3++] = min; + _this24.stackVec3[_this24.sizeVec3++] = min; } - var _this28 = this._pool; + var _this25 = this._pool; if(max != null) { max.zero(); - if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newLength10 = _this28.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g114 = 0; - var _g27 = _this28.sizeVec3; - while(_g114 < _g27) { - var i14 = _g114++; - newArray10[i14] = _this28.stackVec3[i14]; - _this28.stackVec3[i14] = null; + if(_this25.sizeVec3 == _this25.stackVec3.length) { + var newArray10 = new Array(_this25.sizeVec3 << 1); + var _g20 = 0; + var _g111 = _this25.sizeVec3; + while(_g20 < _g111) { + var i14 = _g20++; + newArray10[i14] = _this25.stackVec3[i14]; + _this25.stackVec3[i14] = null; } - _this28.stackVec3 = newArray10; + _this25.stackVec3 = newArray10; } - _this28.stackVec3[_this28.sizeVec3++] = max; + _this25.stackVec3[_this25.sizeVec3++] = max; } } s = n1; @@ -19003,13 +17327,11 @@ oimo_dynamics_World.prototype = { } } ,_drawConstraints: function(d) { - var style = d.style; if(d.drawPairs || d.drawContacts) { var c = this._contactManager._contactList; while(c != null) { var n = c._next; if(d.drawPairs) { - var color = style.pairColor; var _this = this._pool; var v1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; var _this1 = this._pool; @@ -19022,18 +17344,15 @@ oimo_dynamics_World.prototype = { v3.x = c._s2._transform._positionX; v3.y = c._s2._transform._positionY; v3.z = c._s2._transform._positionZ; - d.line(v1,v2,color); var _this2 = this._pool; if(v1 != null) { v1.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newLength = _this2.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this2.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -19045,13 +17364,11 @@ oimo_dynamics_World.prototype = { if(v2 != null) { v2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength1 = _this3.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this3.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(_this3.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this3.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = _this3.stackVec3[i1]; _this3.stackVec3[i1] = null; } @@ -19063,14 +17380,11 @@ oimo_dynamics_World.prototype = { if(d.drawContacts) { var cc = c._contactConstraint; var ps = c._contactConstraint._manifold._points; - var _g12 = 0; - var _g3 = c._contactConstraint._manifold._numPoints; - while(_g12 < _g3) { - var i2 = _g12++; - var p = ps[i2]; - var style1 = d.style; - var tf1 = cc._s1._transform; - var tf2 = cc._s2._transform; + var _g3 = 0; + var _g12 = c._contactConstraint._manifold._numPoints; + while(_g3 < _g12) { + var p = ps[_g3++]; + var style = d.style; var _this4 = this._pool; var pos1 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; var _this5 = this._pool; @@ -19101,85 +17415,61 @@ oimo_dynamics_World.prototype = { v8.x = cc._manifold._binormalX; v8.y = cc._manifold._binormalY; v8.z = cc._manifold._binormalZ; - if(p._disabled) { - d.point(pos1,style1.disabledContactColor); - d.point(pos2,style1.disabledContactColor); - d.line(pos1,pos2,style1.disabledContactColor); - } else if(p._warmStarted) { - var color1; - var _g4 = p._id & 3; - switch(_g4) { - case 0: - color1 = style1.contactColor; - break; - case 1: - color1 = style1.contactColor2; - break; - case 2: - color1 = style1.contactColor3; - break; - default: - color1 = style1.contactColor4; + if(!p._disabled) { + if(p._warmStarted) { + var color; + switch(p._id & 3) { + case 0: + color = style.contactColor; + break; + case 1: + color = style.contactColor2; + break; + case 2: + color = style.contactColor3; + break; + default: + color = style.contactColor4; + } } - d.point(pos1,color1); - d.point(pos2,color1); - d.line(pos1,pos2,style1.contactColor); - } else { - d.point(pos1,style1.newContactColor); - d.point(pos2,style1.newContactColor); - d.line(pos1,pos2,style1.newContactColor); } pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; var _this9 = pos2; - var s = style1.contactNormalLength; - var tx = _this9.x + normal.x * s; - var ty = _this9.y + normal.y * s; - var tz = _this9.z + normal.z * s; - _this9.x = tx; - _this9.y = ty; - _this9.z = tz; - d.line(pos1,pos2,style1.contactNormalColor); + var s = style.contactNormalLength; + _this9.x += normal.x * s; + _this9.y += normal.y * s; + _this9.z += normal.z * s; if(d.drawContactBases) { pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; var _this10 = pos2; - var s1 = style1.contactTangentLength; - var tx1 = _this10.x + tangent.x * s1; - var ty1 = _this10.y + tangent.y * s1; - var tz1 = _this10.z + tangent.z * s1; - _this10.x = tx1; - _this10.y = ty1; - _this10.z = tz1; - d.line(pos1,pos2,style1.contactTangentColor); + var s1 = style.contactTangentLength; + _this10.x += tangent.x * s1; + _this10.y += tangent.y * s1; + _this10.z += tangent.z * s1; pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; var _this11 = pos2; - var s2 = style1.contactBinormalLength; - var tx2 = _this11.x + binormal.x * s2; - var ty2 = _this11.y + binormal.y * s2; - var tz2 = _this11.z + binormal.z * s2; - _this11.x = tx2; - _this11.y = ty2; - _this11.z = tz2; - d.line(pos1,pos2,style1.contactBinormalColor); + var s2 = style.contactBinormalLength; + _this11.x += binormal.x * s2; + _this11.y += binormal.y * s2; + _this11.z += binormal.z * s2; } var _this12 = this._pool; if(pos1 != null) { pos1.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength2 = _this12.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g13 = 0; - var _g5 = _this12.sizeVec3; - while(_g13 < _g5) { - var i3 = _g13++; - newArray2[i3] = _this12.stackVec3[i3]; - _this12.stackVec3[i3] = null; + var newArray2 = new Array(_this12.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this12.sizeVec3; + while(_g4 < _g13) { + var i2 = _g4++; + newArray2[i2] = _this12.stackVec3[i2]; + _this12.stackVec3[i2] = null; } _this12.stackVec3 = newArray2; } @@ -19189,15 +17479,13 @@ oimo_dynamics_World.prototype = { if(pos2 != null) { pos2.zero(); if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength3 = _this13.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g14 = 0; - var _g6 = _this13.sizeVec3; - while(_g14 < _g6) { - var i4 = _g14++; - newArray3[i4] = _this13.stackVec3[i4]; - _this13.stackVec3[i4] = null; + var newArray3 = new Array(_this13.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this13.sizeVec3; + while(_g5 < _g14) { + var i3 = _g5++; + newArray3[i3] = _this13.stackVec3[i3]; + _this13.stackVec3[i3] = null; } _this13.stackVec3 = newArray3; } @@ -19207,15 +17495,13 @@ oimo_dynamics_World.prototype = { if(normal != null) { normal.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength4 = _this14.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g15 = 0; - var _g7 = _this14.sizeVec3; - while(_g15 < _g7) { - var i5 = _g15++; - newArray4[i5] = _this14.stackVec3[i5]; - _this14.stackVec3[i5] = null; + var newArray4 = new Array(_this14.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this14.sizeVec3; + while(_g6 < _g15) { + var i4 = _g6++; + newArray4[i4] = _this14.stackVec3[i4]; + _this14.stackVec3[i4] = null; } _this14.stackVec3 = newArray4; } @@ -19225,15 +17511,13 @@ oimo_dynamics_World.prototype = { if(tangent != null) { tangent.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength5 = _this15.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g16 = 0; - var _g8 = _this15.sizeVec3; - while(_g16 < _g8) { - var i6 = _g16++; - newArray5[i6] = _this15.stackVec3[i6]; - _this15.stackVec3[i6] = null; + var newArray5 = new Array(_this15.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this15.sizeVec3; + while(_g7 < _g16) { + var i5 = _g7++; + newArray5[i5] = _this15.stackVec3[i5]; + _this15.stackVec3[i5] = null; } _this15.stackVec3 = newArray5; } @@ -19243,15 +17527,13 @@ oimo_dynamics_World.prototype = { if(binormal != null) { binormal.zero(); if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newLength6 = _this16.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g17 = 0; - var _g9 = _this16.sizeVec3; - while(_g17 < _g9) { - var i7 = _g17++; - newArray6[i7] = _this16.stackVec3[i7]; - _this16.stackVec3[i7] = null; + var newArray6 = new Array(_this16.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this16.sizeVec3; + while(_g8 < _g17) { + var i6 = _g8++; + newArray6[i6] = _this16.stackVec3[i6]; + _this16.stackVec3[i6] = null; } _this16.stackVec3 = newArray6; } @@ -19326,265 +17608,264 @@ oimo_dynamics_World.prototype = { v18.x = j._basisZ2X; v18.y = j._basisZ2Y; v18.z = j._basisZ2Z; - d.line(p1,anchor1,d.style.jointLineColor); - d.line(p2,anchor2,d.style.jointLineColor); if(d.drawJointLimits) { - var _g10 = j._type; - switch(_g10) { + switch(j._type) { case 0: break; case 1: - var radius = d.style.jointRotationalConstraintRadius; - var color2 = d.style.jointLineColor; var lm = j._lm; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,radius,lm.lowerLimit,lm.upperLimit,color2); + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,lm.lowerLimit,lm.upperLimit,d.style.jointLineColor); break; case 2: var j1 = j; - var radius1 = d.style.jointRotationalConstraintRadius; - var color3 = d.style.jointLineColor; + var color1 = d.style.jointLineColor; var rlm = j1._rotLm; var tlm = j1._translLm; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,radius1,rlm.lowerLimit,rlm.upperLimit,color3); - this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color3); + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color1); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color1); break; case 3: - var radius2 = d.style.jointRotationalConstraintRadius; - var color4 = d.style.jointLineColor; var lm1 = j._lm; - this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,color4); + this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,d.style.jointLineColor); break; case 4: var j2 = j; - var radius3 = d.style.jointRotationalConstraintRadius; - var color5 = d.style.jointLineColor; + var radius = d.style.jointRotationalConstraintRadius; + var color2 = d.style.jointLineColor; var lm11 = j2._lm1; var lm2 = j2._lm2; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius3,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color5); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius3,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color5); + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color2); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color2); break; case 5: var j3 = j; - var radius4 = d.style.jointRotationalConstraintRadius; - var color6 = d.style.jointLineColor; + var radius1 = d.style.jointRotationalConstraintRadius; + var color3 = d.style.jointLineColor; var lm3 = j3._twistLm; - this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius4,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color6); - this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius4,color6); + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color3); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color3); var _this27 = this._pool; var _this28 = _this27.sizeVec3 == 0 ? new oimo_common_Vec3() : _this27.stackVec3[--_this27.sizeVec3]; _this28.x = anchor2.x; _this28.y = anchor2.y; _this28.z = anchor2.z; var _this29 = _this28; - var tx3 = _this29.x + basisX2.x * radius4; - var ty3 = _this29.y + basisX2.y * radius4; - var tz3 = _this29.z + basisX2.z * radius4; - _this29.x = tx3; - _this29.y = ty3; - _this29.z = tz3; - var to = _this29; - d.line(anchor2,to,color6); + _this29.x += basisX2.x * radius1; + _this29.y += basisX2.y * radius1; + _this29.z += basisX2.z * radius1; var _this30 = this._pool; - if(to != null) { - to.zero(); + if(_this29 != null) { + _this29.zero(); if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newLength7 = _this30.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g18 = 0; - var _g19 = _this30.sizeVec3; - while(_g18 < _g19) { - var i8 = _g18++; - newArray7[i8] = _this30.stackVec3[i8]; - _this30.stackVec3[i8] = null; + var newArray7 = new Array(_this30.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this30.sizeVec3; + while(_g9 < _g18) { + var i7 = _g9++; + newArray7[i7] = _this30.stackVec3[i7]; + _this30.stackVec3[i7] = null; } _this30.stackVec3 = newArray7; } - _this30.stackVec3[_this30.sizeVec3++] = to; + _this30.stackVec3[_this30.sizeVec3++] = _this29; } break; + case 6: + var j4 = j; + var radius2 = d.style.jointRotationalConstraintRadius; + var color4 = d.style.jointLineColor; + var rxlm = j4._rotLms[0]; + var rylm = j4._rotLms[1]; + var rzlm = j4._rotLms[2]; + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color4); + var _this31 = this._pool; + var rotYAxis = _this31.sizeVec3 == 0 ? new oimo_common_Vec3() : _this31.stackVec3[--_this31.sizeVec3]; + var v19 = rotYAxis; + v19.x = j4._axisYX; + v19.y = j4._axisYY; + v19.z = j4._axisYZ; + var _this32 = this._pool; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = basisX1.x; + _this33.y = basisX1.y; + _this33.z = basisX1.z; + var rotYBasisX = _this33; + var _this34 = this._pool; + var _this35 = _this34.sizeVec3 == 0 ? new oimo_common_Vec3() : _this34.stackVec3[--_this34.sizeVec3]; + _this35.x = basisX1.x; + _this35.y = basisX1.y; + _this35.z = basisX1.z; + var _this36 = _this35; + var y = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; + var z = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; + _this36.x = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; + _this36.y = y; + _this36.z = z; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color4); + this._drawRotationalLimit(d,anchor2,rotYBasisX,_this36,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color4); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color4); + break; } } - d.line(anchor1,anchor2,d.style.jointErrorColor); - var _this31 = this._pool; + var _this37 = this._pool; if(p1 != null) { p1.zero(); - if(_this31.sizeVec3 == _this31.stackVec3.length) { - var newLength8 = _this31.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g110 = 0; - var _g20 = _this31.sizeVec3; - while(_g110 < _g20) { - var i9 = _g110++; - newArray8[i9] = _this31.stackVec3[i9]; - _this31.stackVec3[i9] = null; + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray8 = new Array(_this37.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this37.sizeVec3; + while(_g10 < _g19) { + var i8 = _g10++; + newArray8[i8] = _this37.stackVec3[i8]; + _this37.stackVec3[i8] = null; } - _this31.stackVec3 = newArray8; + _this37.stackVec3 = newArray8; } - _this31.stackVec3[_this31.sizeVec3++] = p1; + _this37.stackVec3[_this37.sizeVec3++] = p1; } - var _this32 = this._pool; + var _this38 = this._pool; if(p2 != null) { p2.zero(); - if(_this32.sizeVec3 == _this32.stackVec3.length) { - var newLength9 = _this32.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g111 = 0; - var _g21 = _this32.sizeVec3; - while(_g111 < _g21) { - var i10 = _g111++; - newArray9[i10] = _this32.stackVec3[i10]; - _this32.stackVec3[i10] = null; + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray9 = new Array(_this38.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this38.sizeVec3; + while(_g20 < _g110) { + var i9 = _g20++; + newArray9[i9] = _this38.stackVec3[i9]; + _this38.stackVec3[i9] = null; } - _this32.stackVec3 = newArray9; + _this38.stackVec3 = newArray9; } - _this32.stackVec3[_this32.sizeVec3++] = p2; + _this38.stackVec3[_this38.sizeVec3++] = p2; } - var _this33 = this._pool; + var _this39 = this._pool; if(anchor1 != null) { anchor1.zero(); - if(_this33.sizeVec3 == _this33.stackVec3.length) { - var newLength10 = _this33.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g112 = 0; - var _g22 = _this33.sizeVec3; - while(_g112 < _g22) { - var i11 = _g112++; - newArray10[i11] = _this33.stackVec3[i11]; - _this33.stackVec3[i11] = null; + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray10 = new Array(_this39.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this39.sizeVec3; + while(_g21 < _g111) { + var i10 = _g21++; + newArray10[i10] = _this39.stackVec3[i10]; + _this39.stackVec3[i10] = null; } - _this33.stackVec3 = newArray10; + _this39.stackVec3 = newArray10; } - _this33.stackVec3[_this33.sizeVec3++] = anchor1; + _this39.stackVec3[_this39.sizeVec3++] = anchor1; } - var _this34 = this._pool; + var _this40 = this._pool; if(anchor2 != null) { anchor2.zero(); - if(_this34.sizeVec3 == _this34.stackVec3.length) { - var newLength11 = _this34.sizeVec3 << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g113 = 0; - var _g23 = _this34.sizeVec3; - while(_g113 < _g23) { - var i12 = _g113++; - newArray11[i12] = _this34.stackVec3[i12]; - _this34.stackVec3[i12] = null; + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray11 = new Array(_this40.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this40.sizeVec3; + while(_g22 < _g112) { + var i11 = _g22++; + newArray11[i11] = _this40.stackVec3[i11]; + _this40.stackVec3[i11] = null; } - _this34.stackVec3 = newArray11; + _this40.stackVec3 = newArray11; } - _this34.stackVec3[_this34.sizeVec3++] = anchor2; + _this40.stackVec3[_this40.sizeVec3++] = anchor2; } - var _this35 = this._pool; + var _this41 = this._pool; if(basisX1 != null) { basisX1.zero(); - if(_this35.sizeVec3 == _this35.stackVec3.length) { - var newLength12 = _this35.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g114 = 0; - var _g24 = _this35.sizeVec3; - while(_g114 < _g24) { - var i13 = _g114++; - newArray12[i13] = _this35.stackVec3[i13]; - _this35.stackVec3[i13] = null; + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray12 = new Array(_this41.sizeVec3 << 1); + var _g23 = 0; + var _g113 = _this41.sizeVec3; + while(_g23 < _g113) { + var i12 = _g23++; + newArray12[i12] = _this41.stackVec3[i12]; + _this41.stackVec3[i12] = null; } - _this35.stackVec3 = newArray12; + _this41.stackVec3 = newArray12; } - _this35.stackVec3[_this35.sizeVec3++] = basisX1; + _this41.stackVec3[_this41.sizeVec3++] = basisX1; } - var _this36 = this._pool; + var _this42 = this._pool; if(basisY1 != null) { basisY1.zero(); - if(_this36.sizeVec3 == _this36.stackVec3.length) { - var newLength13 = _this36.sizeVec3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g115 = 0; - var _g25 = _this36.sizeVec3; - while(_g115 < _g25) { - var i14 = _g115++; - newArray13[i14] = _this36.stackVec3[i14]; - _this36.stackVec3[i14] = null; + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray13 = new Array(_this42.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this42.sizeVec3; + while(_g24 < _g114) { + var i13 = _g24++; + newArray13[i13] = _this42.stackVec3[i13]; + _this42.stackVec3[i13] = null; } - _this36.stackVec3 = newArray13; + _this42.stackVec3 = newArray13; } - _this36.stackVec3[_this36.sizeVec3++] = basisY1; + _this42.stackVec3[_this42.sizeVec3++] = basisY1; } - var _this37 = this._pool; + var _this43 = this._pool; if(basisZ1 != null) { basisZ1.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newLength14 = _this37.sizeVec3 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g116 = 0; - var _g26 = _this37.sizeVec3; - while(_g116 < _g26) { - var i15 = _g116++; - newArray14[i15] = _this37.stackVec3[i15]; - _this37.stackVec3[i15] = null; + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray14 = new Array(_this43.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this43.sizeVec3; + while(_g25 < _g115) { + var i14 = _g25++; + newArray14[i14] = _this43.stackVec3[i14]; + _this43.stackVec3[i14] = null; } - _this37.stackVec3 = newArray14; + _this43.stackVec3 = newArray14; } - _this37.stackVec3[_this37.sizeVec3++] = basisZ1; + _this43.stackVec3[_this43.sizeVec3++] = basisZ1; } - var _this38 = this._pool; + var _this44 = this._pool; if(basisX2 != null) { basisX2.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newLength15 = _this38.sizeVec3 << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g117 = 0; - var _g27 = _this38.sizeVec3; - while(_g117 < _g27) { - var i16 = _g117++; - newArray15[i16] = _this38.stackVec3[i16]; - _this38.stackVec3[i16] = null; + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray15 = new Array(_this44.sizeVec3 << 1); + var _g26 = 0; + var _g116 = _this44.sizeVec3; + while(_g26 < _g116) { + var i15 = _g26++; + newArray15[i15] = _this44.stackVec3[i15]; + _this44.stackVec3[i15] = null; } - _this38.stackVec3 = newArray15; + _this44.stackVec3 = newArray15; } - _this38.stackVec3[_this38.sizeVec3++] = basisX2; + _this44.stackVec3[_this44.sizeVec3++] = basisX2; } - var _this39 = this._pool; + var _this45 = this._pool; if(basisY2 != null) { basisY2.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newLength16 = _this39.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g118 = 0; - var _g28 = _this39.sizeVec3; - while(_g118 < _g28) { - var i17 = _g118++; - newArray16[i17] = _this39.stackVec3[i17]; - _this39.stackVec3[i17] = null; + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray16 = new Array(_this45.sizeVec3 << 1); + var _g27 = 0; + var _g117 = _this45.sizeVec3; + while(_g27 < _g117) { + var i16 = _g27++; + newArray16[i16] = _this45.stackVec3[i16]; + _this45.stackVec3[i16] = null; } - _this39.stackVec3 = newArray16; + _this45.stackVec3 = newArray16; } - _this39.stackVec3[_this39.sizeVec3++] = basisY2; + _this45.stackVec3[_this45.sizeVec3++] = basisY2; } - var _this40 = this._pool; + var _this46 = this._pool; if(basisZ2 != null) { basisZ2.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newLength17 = _this40.sizeVec3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g119 = 0; - var _g29 = _this40.sizeVec3; - while(_g119 < _g29) { - var i18 = _g119++; - newArray17[i18] = _this40.stackVec3[i18]; - _this40.stackVec3[i18] = null; + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newArray17 = new Array(_this46.sizeVec3 << 1); + var _g28 = 0; + var _g118 = _this46.sizeVec3; + while(_g28 < _g118) { + var i17 = _g28++; + newArray17[i17] = _this46.stackVec3[i17]; + _this46.stackVec3[i17] = null; } - _this40.stackVec3 = newArray17; + _this46.stackVec3 = newArray17; } - _this40.stackVec3[_this40.sizeVec3++] = basisZ2; + _this46.stackVec3[_this46.sizeVec3++] = basisZ2; } j = n1; } @@ -19598,37 +17879,30 @@ oimo_dynamics_World.prototype = { _this1.y = center.y; _this1.z = center.z; var _this2 = _this1; - var tx = _this2.x + needle.x * radius; - var ty = _this2.y + needle.y * radius; - var tz = _this2.z + needle.z * radius; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; - var to = _this2; - d.line(center,to,color); + _this2.x += needle.x * radius; + _this2.y += needle.y * radius; + _this2.z += needle.z * radius; var _this3 = this._pool; - if(to != null) { - to.zero(); + if(_this2 != null) { + _this2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength = _this3.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this3.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this3.sizeVec3 << 1); + var _g = 0; + var _g1 = _this3.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this3.stackVec3[i]; _this3.stackVec3[i] = null; } _this3.stackVec3 = newArray; } - _this3.stackVec3[_this3.sizeVec3++] = to; + _this3.stackVec3[_this3.sizeVec3++] = _this2; + } + if(min > max) { + d.ellipse(center,ex,ey,radius,radius,color); + } else { + d.arc(center,ex,ey,radius,radius,min,max,true,color); } - } - if(min > max) { - d.ellipse(center,ex,ey,radius,radius,color); - } else { - d.arc(center,ex,ey,radius,radius,min,max,true,color); } } ,_drawTranslationalLimit: function(d,center,ex,min,max,color) { @@ -19639,69 +17913,322 @@ oimo_dynamics_World.prototype = { _this1.y = center.y; _this1.z = center.z; var _this2 = _this1; - var tx = _this2.x + ex.x * min; - var ty = _this2.y + ex.y * min; - var tz = _this2.z + ex.z * min; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; - var lower = _this2; + _this2.x += ex.x * min; + _this2.y += ex.y * min; + _this2.z += ex.z * min; var _this3 = this._pool; var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = center.x; _this4.y = center.y; _this4.z = center.z; var _this5 = _this4; - var tx1 = _this5.x + ex.x * max; - var ty1 = _this5.y + ex.y * max; - var tz1 = _this5.z + ex.z * max; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var upper = _this5; - d.line(lower,upper,color); + _this5.x += ex.x * max; + _this5.y += ex.y * max; + _this5.z += ex.z * max; var _this6 = this._pool; - if(lower != null) { - lower.zero(); + if(_this2 != null) { + _this2.zero(); if(_this6.sizeVec3 == _this6.stackVec3.length) { - var newLength = _this6.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this6.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this6.sizeVec3 << 1); + var _g = 0; + var _g1 = _this6.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this6.stackVec3[i]; _this6.stackVec3[i] = null; } _this6.stackVec3 = newArray; } - _this6.stackVec3[_this6.sizeVec3++] = lower; + _this6.stackVec3[_this6.sizeVec3++] = _this2; } var _this7 = this._pool; - if(upper != null) { - upper.zero(); + if(_this5 != null) { + _this5.zero(); if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newLength1 = _this7.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this7.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(_this7.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this7.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = _this7.stackVec3[i1]; _this7.stackVec3[i1] = null; } _this7.stackVec3 = newArray1; } - _this7.stackVec3[_this7.sizeVec3++] = upper; + _this7.stackVec3[_this7.sizeVec3++] = _this5; + } + } + } + ,_drawTranslationalLimit3D: function(d,center,ex,ey,ez,xlm,ylm,zlm,color) { + var minx = xlm.lowerLimit; + var maxx = xlm.upperLimit; + var miny = ylm.lowerLimit; + var maxy = ylm.upperLimit; + var minz = zlm.lowerLimit; + var maxz = zlm.upperLimit; + var _this = this._pool; + if(_this.sizeVec3 == 0) { + new oimo_common_Vec3(); + } else { + --_this.sizeVec3; + } + var _this1 = this._pool; + if(_this1.sizeVec3 == 0) { + new oimo_common_Vec3(); + } else { + --_this1.sizeVec3; + } + var _this2 = this._pool; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = center.x; + _this3.y = center.y; + _this3.z = center.z; + var _this4 = _this3; + _this4.x += ex.x * minx; + _this4.y += ex.y * minx; + _this4.z += ex.z * minx; + _this4.x += ey.x * miny; + _this4.y += ey.y * miny; + _this4.z += ey.z * miny; + _this4.x += ez.x * minz; + _this4.y += ez.y * minz; + _this4.z += ez.z * minz; + var _this5 = this._pool; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = center.x; + _this6.y = center.y; + _this6.z = center.z; + var _this7 = _this6; + _this7.x += ex.x * minx; + _this7.y += ex.y * minx; + _this7.z += ex.z * minx; + _this7.x += ey.x * miny; + _this7.y += ey.y * miny; + _this7.z += ey.z * miny; + _this7.x += ez.x * maxz; + _this7.y += ez.y * maxz; + _this7.z += ez.z * maxz; + var _this8 = this._pool; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = center.x; + _this9.y = center.y; + _this9.z = center.z; + var _this10 = _this9; + _this10.x += ex.x * minx; + _this10.y += ex.y * minx; + _this10.z += ex.z * minx; + _this10.x += ey.x * maxy; + _this10.y += ey.y * maxy; + _this10.z += ey.z * maxy; + _this10.x += ez.x * minz; + _this10.y += ez.y * minz; + _this10.z += ez.z * minz; + var _this11 = this._pool; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = center.x; + _this12.y = center.y; + _this12.z = center.z; + var _this13 = _this12; + _this13.x += ex.x * minx; + _this13.y += ex.y * minx; + _this13.z += ex.z * minx; + _this13.x += ey.x * maxy; + _this13.y += ey.y * maxy; + _this13.z += ey.z * maxy; + _this13.x += ez.x * maxz; + _this13.y += ez.y * maxz; + _this13.z += ez.z * maxz; + var _this14 = this._pool; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = center.x; + _this15.y = center.y; + _this15.z = center.z; + var _this16 = _this15; + _this16.x += ex.x * maxx; + _this16.y += ex.y * maxx; + _this16.z += ex.z * maxx; + _this16.x += ey.x * miny; + _this16.y += ey.y * miny; + _this16.z += ey.z * miny; + _this16.x += ez.x * minz; + _this16.y += ez.y * minz; + _this16.z += ez.z * minz; + var _this17 = this._pool; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = center.x; + _this18.y = center.y; + _this18.z = center.z; + var _this19 = _this18; + _this19.x += ex.x * maxx; + _this19.y += ex.y * maxx; + _this19.z += ex.z * maxx; + _this19.x += ey.x * miny; + _this19.y += ey.y * miny; + _this19.z += ey.z * miny; + _this19.x += ez.x * maxz; + _this19.y += ez.y * maxz; + _this19.z += ez.z * maxz; + var _this20 = this._pool; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = center.x; + _this21.y = center.y; + _this21.z = center.z; + var _this22 = _this21; + _this22.x += ex.x * maxx; + _this22.y += ex.y * maxx; + _this22.z += ex.z * maxx; + _this22.x += ey.x * maxy; + _this22.y += ey.y * maxy; + _this22.z += ey.z * maxy; + _this22.x += ez.x * minz; + _this22.y += ez.y * minz; + _this22.z += ez.z * minz; + var _this23 = this._pool; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = center.x; + _this24.y = center.y; + _this24.z = center.z; + var _this25 = _this24; + _this25.x += ex.x * maxx; + _this25.y += ex.y * maxx; + _this25.z += ex.z * maxx; + _this25.x += ey.x * maxy; + _this25.y += ey.y * maxy; + _this25.z += ey.z * maxy; + _this25.x += ez.x * maxz; + _this25.y += ez.y * maxz; + _this25.z += ez.z * maxz; + var _this26 = this._pool; + if(_this4 != null) { + _this4.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + var newArray = new Array(_this26.sizeVec3 << 1); + var _g = 0; + var _g1 = _this26.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; + } + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this4; + } + var _this27 = this._pool; + if(_this7 != null) { + _this7.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + var newArray1 = new Array(_this27.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this27.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this27.stackVec3[i1]; + _this27.stackVec3[i1] = null; + } + _this27.stackVec3 = newArray1; } + _this27.stackVec3[_this27.sizeVec3++] = _this7; + } + var _this28 = this._pool; + if(_this10 != null) { + _this10.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + var newArray2 = new Array(_this28.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this28.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this28.stackVec3[i2]; + _this28.stackVec3[i2] = null; + } + _this28.stackVec3 = newArray2; + } + _this28.stackVec3[_this28.sizeVec3++] = _this10; + } + var _this29 = this._pool; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + var newArray3 = new Array(_this29.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this29.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this29.stackVec3[i3]; + _this29.stackVec3[i3] = null; + } + _this29.stackVec3 = newArray3; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + var _this30 = this._pool; + if(_this16 != null) { + _this16.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + var newArray4 = new Array(_this30.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this30.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this30.stackVec3[i4]; + _this30.stackVec3[i4] = null; + } + _this30.stackVec3 = newArray4; + } + _this30.stackVec3[_this30.sizeVec3++] = _this16; + } + var _this31 = this._pool; + if(_this19 != null) { + _this19.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + var newArray5 = new Array(_this31.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this31.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this31.stackVec3[i5]; + _this31.stackVec3[i5] = null; + } + _this31.stackVec3 = newArray5; + } + _this31.stackVec3[_this31.sizeVec3++] = _this19; + } + var _this32 = this._pool; + if(_this22 != null) { + _this22.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + var newArray6 = new Array(_this32.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this32.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this32.stackVec3[i6]; + _this32.stackVec3[i6] = null; + } + _this32.stackVec3 = newArray6; + } + _this32.stackVec3[_this32.sizeVec3++] = _this22; + } + var _this33 = this._pool; + if(_this25 != null) { + _this25.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + var newArray7 = new Array(_this33.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this33.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this33.stackVec3[i7]; + _this33.stackVec3[i7] = null; + } + _this33.stackVec3 = newArray7; + } + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } ,_drawEllipseOnSphere: function(d,center,normal,x,y,radiansX,radiansY,radius,color) { - var n = 16; var theta = 0; - var dTheta = 6.28318530717958 / n; var _this = this._pool; var rotVec = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; var _this1 = this._pool; @@ -19710,36 +18237,25 @@ oimo_dynamics_World.prototype = { var rotM = _this2.sizeMat3 == 0 ? new oimo_common_Mat3() : _this2.stackMat3[--_this2.sizeMat3]; var _this3 = this._pool; var prevV = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _g1 = 0; - var _g = n + 1; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < 17) { + _g++; var rx = Math.cos(theta) * radiansX; var ry = Math.sin(theta) * radiansY; var halfRotAng = Math.sqrt(rx * rx + ry * ry); var rotSin = Math.sin(halfRotAng * 0.5); var rotCos = Math.cos(halfRotAng * 0.5); var _this4 = rotVec.zero(); - var tx = _this4.x + x.x * rx; - var ty = _this4.y + x.y * rx; - var tz = _this4.z + x.z * rx; - _this4.x = tx; - _this4.y = ty; - _this4.z = tz; - var _this5 = _this4; - var tx1 = _this5.x + y.x * ry; - var ty1 = _this5.y + y.y * ry; - var tz1 = _this5.z + y.z * ry; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; + _this4.x += x.x * rx; + _this4.y += x.y * rx; + _this4.z += x.z * rx; + _this4.x += y.x * ry; + _this4.y += y.y * ry; + _this4.z += y.z * ry; var s = 1 / halfRotAng * rotSin; - var tx2 = rotVec.x * s; - var ty2 = rotVec.y * s; - var tz2 = rotVec.z * s; - rotVec.x = tx2; - rotVec.y = ty2; - rotVec.z = tz2; + rotVec.x *= s; + rotVec.y *= s; + rotVec.z *= s; rotQ.x = rotVec.x; rotQ.y = rotVec.y; rotQ.z = rotVec.z; @@ -19769,147 +18285,113 @@ oimo_dynamics_World.prototype = { rotM.e20 = xz - wy; rotM.e21 = yz + wx; rotM.e22 = 1 - xx - yy; - var _this6 = this._pool; - var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var tx3 = _this7.x + normal.x * radius; - var ty3 = _this7.y + normal.y * radius; - var tz3 = _this7.z + normal.z * radius; - _this7.x = tx3; - _this7.y = ty3; - _this7.z = tz3; - var v = _this7; - var tx4 = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; - var ty4 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; - var tz4 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; - v.x = tx4; - v.y = ty4; - v.z = tz4; - var _this8 = v; - var tx5 = _this8.x + center.x; - var ty5 = _this8.y + center.y; - var tz5 = _this8.z + center.z; - _this8.x = tx5; - _this8.y = ty5; - _this8.z = tz5; - if(i >= 1) { - d.line(prevV,v,color); - } - var _this9 = this._pool; + var _this5 = this._pool; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x += normal.x * radius; + _this6.y += normal.y * radius; + _this6.z += normal.z * radius; + var v = _this6; + var y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; + var z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; + v.x = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; + v.y = y3; + v.z = z1; + v.x += center.x; + v.y += center.y; + v.z += center.z; + var _this7 = this._pool; if(prevV != null) { prevV.zero(); - if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newLength = _this9.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g11 = 0; - var _g2 = _this9.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; - newArray[i1] = _this9.stackVec3[i1]; - _this9.stackVec3[i1] = null; + if(_this7.sizeVec3 == _this7.stackVec3.length) { + var newArray = new Array(_this7.sizeVec3 << 1); + var _g1 = 0; + var _g11 = _this7.sizeVec3; + while(_g1 < _g11) { + var i = _g1++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this9.stackVec3 = newArray; + _this7.stackVec3 = newArray; } - _this9.stackVec3[_this9.sizeVec3++] = prevV; + _this7.stackVec3[_this7.sizeVec3++] = prevV; } prevV = v; - theta += dTheta; + theta += 0.39269908169872375; } - var _this10 = this._pool; + var _this8 = this._pool; if(rotVec != null) { rotVec.zero(); - if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength1 = _this10.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g12 = 0; - var _g3 = _this10.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; - newArray1[i2] = _this10.stackVec3[i2]; - _this10.stackVec3[i2] = null; + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray1 = new Array(_this8.sizeVec3 << 1); + var _g2 = 0; + var _g12 = _this8.sizeVec3; + while(_g2 < _g12) { + var i1 = _g2++; + newArray1[i1] = _this8.stackVec3[i1]; + _this8.stackVec3[i1] = null; } - _this10.stackVec3 = newArray1; + _this8.stackVec3 = newArray1; } - _this10.stackVec3[_this10.sizeVec3++] = rotVec; + _this8.stackVec3[_this8.sizeVec3++] = rotVec; } - var _this11 = this._pool; + var _this9 = this._pool; if(rotQ != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw = 1; - rotQ.x = tx6; - rotQ.y = ty6; - rotQ.z = tz6; - rotQ.w = tw; - if(_this11.sizeQuat == _this11.stackQuat.length) { - var newLength2 = _this11.sizeQuat << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g13 = 0; - var _g4 = _this11.sizeQuat; - while(_g13 < _g4) { - var i3 = _g13++; - newArray2[i3] = _this11.stackQuat[i3]; - _this11.stackQuat[i3] = null; - } - _this11.stackQuat = newArray2; - } - _this11.stackQuat[_this11.sizeQuat++] = rotQ; - } - var _this12 = this._pool; + rotQ.x = 0; + rotQ.y = 0; + rotQ.z = 0; + rotQ.w = 1; + if(_this9.sizeQuat == _this9.stackQuat.length) { + var newArray2 = new Array(_this9.sizeQuat << 1); + var _g3 = 0; + var _g13 = _this9.sizeQuat; + while(_g3 < _g13) { + var i2 = _g3++; + newArray2[i2] = _this9.stackQuat[i2]; + _this9.stackQuat[i2] = null; + } + _this9.stackQuat = newArray2; + } + _this9.stackQuat[_this9.sizeQuat++] = rotQ; + } + var _this10 = this._pool; if(rotM != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - rotM.e00 = t00; - rotM.e01 = t01; - rotM.e02 = t02; - rotM.e10 = t10; - rotM.e11 = t11; - rotM.e12 = t12; - rotM.e20 = t20; - rotM.e21 = t21; - rotM.e22 = t22; - if(_this12.sizeMat3 == _this12.stackMat3.length) { - var newLength3 = _this12.sizeMat3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g14 = 0; - var _g5 = _this12.sizeMat3; - while(_g14 < _g5) { - var i4 = _g14++; - newArray3[i4] = _this12.stackMat3[i4]; - _this12.stackMat3[i4] = null; - } - _this12.stackMat3 = newArray3; - } - _this12.stackMat3[_this12.sizeMat3++] = rotM; - } - var _this13 = this._pool; + rotM.e00 = 1; + rotM.e01 = 0; + rotM.e02 = 0; + rotM.e10 = 0; + rotM.e11 = 1; + rotM.e12 = 0; + rotM.e20 = 0; + rotM.e21 = 0; + rotM.e22 = 1; + if(_this10.sizeMat3 == _this10.stackMat3.length) { + var newArray3 = new Array(_this10.sizeMat3 << 1); + var _g4 = 0; + var _g14 = _this10.sizeMat3; + while(_g4 < _g14) { + var i3 = _g4++; + newArray3[i3] = _this10.stackMat3[i3]; + _this10.stackMat3[i3] = null; + } + _this10.stackMat3 = newArray3; + } + _this10.stackMat3[_this10.sizeMat3++] = rotM; + } + var _this11 = this._pool; if(prevV != null) { prevV.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength4 = _this13.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g15 = 0; - var _g6 = _this13.sizeVec3; - while(_g15 < _g6) { - var i5 = _g15++; - newArray4[i5] = _this13.stackVec3[i5]; - _this13.stackVec3[i5] = null; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newArray4 = new Array(_this11.sizeVec3 << 1); + var _g5 = 0; + var _g15 = _this11.sizeVec3; + while(_g5 < _g15) { + var i4 = _g5++; + newArray4[i4] = _this11.stackVec3[i4]; + _this11.stackVec3[i4] = null; } - _this13.stackVec3 = newArray4; + _this11.stackVec3 = newArray4; } - _this13.stackVec3[_this13.sizeVec3++] = prevV; + _this11.stackVec3[_this11.sizeVec3++] = prevV; } } ,step: function(timeStep) { @@ -19918,11 +18400,10 @@ oimo_dynamics_World.prototype = { } this._timeStep.dt = timeStep; this._timeStep.invDt = 1 / timeStep; - var st = new Date().getTime() / 1000; + var st = Date.now() / 1000; this._updateContacts(); this._solveIslands(); - var en = new Date().getTime() / 1000; - oimo_dynamics_common_Performance.totalTime = (en - st) * 1000; + oimo_dynamics_common_Performance.totalTime = (Date.now() / 1000 - st) * 1000; } ,addRigidBody: function(rigidBody) { if(rigidBody._world != null) { @@ -20000,17 +18481,10 @@ oimo_dynamics_World.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(cc1 == cc2) { + if(c._s1._contactCallback == cc2) { cc2 = null; } - if(cc1 != null) { - cc1.endContact(c); - } - if(cc2 != null) { - cc2.endContact(c); - } } var prev2 = c._link1._prev; var next2 = c._link1._next; @@ -20192,8 +18666,7 @@ oimo_dynamics_World.prototype = { ,debugDraw: function() { if(this._debugDraw != null) { if(this._broadPhase._type == 2) { - var bvhBroadPhase = this._broadPhase; - this._drawBvh(this._debugDraw,bvhBroadPhase._tree); + this._drawBvh(this._debugDraw,this._broadPhase._tree); } this._drawRigidBodies(this._debugDraw); this._drawConstraints(this._debugDraw); @@ -20317,8 +18790,7 @@ oimo_dynamics__$World_ConvexCastWrapper.prototype = $extend(oimo_collision_broad if(type < 0 || type > 5) { return; } - var geom = shape._geom; - if(oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance.convexCast(this.convex,geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { + if(oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance.convexCast(this.convex,shape._geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { this.callback.process(shape,this.rayCastHit); } } @@ -20331,11 +18803,7 @@ var oimo_dynamics__$World_AabbTestWrapper = function() { oimo_dynamics__$World_AabbTestWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; oimo_dynamics__$World_AabbTestWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ process: function(proxy) { - var shape = proxy.userData; - var shapeAabb = shape._aabb; - if(shapeAabb._minX < this._aabb._maxX && shapeAabb._maxX > this._aabb._minX && shapeAabb._minY < this._aabb._maxY && shapeAabb._maxY > this._aabb._minY && shapeAabb._minZ < this._aabb._maxZ && shapeAabb._maxZ > this._aabb._minZ) { - this._callback.process(shape); - } + var shapeAabb = proxy.userData._aabb; } }); var oimo_dynamics_callback_AabbTestCallback = function() { @@ -20412,57 +18880,36 @@ var oimo_dynamics_common_DebugDraw = function() { this.drawContacts = false; this.drawJoints = true; this.drawJointLimits = false; - var nt = 4; - var dt = 3.14159265358979 / nt; - var np = 8; - var dp = 6.28318530717958 / np; - var this1 = new Array(nt + 1); - this.sphereCoords = this1; - var this2 = new Array(nt + 1); - this.tmpSphereVerts = this2; - var this3 = new Array(nt + 1); - this.tmpSphereNorms = this3; - var _g1 = 0; - var _g = nt + 1; - while(_g1 < _g) { - var i = _g1++; - var num = i == 0 || i == nt ? 1 : np; - var this4 = this.sphereCoords; - var this5 = new Array(num); - this4[i] = this5; - var this6 = this.tmpSphereVerts; - var this7 = new Array(num); - this6[i] = this7; - var this8 = this.tmpSphereNorms; - var this9 = new Array(num); - this8[i] = this9; - var _g3 = 0; - var _g2 = np; - while(_g3 < _g2) { - var j = _g3++; - var theta = i * dt; - var phi = j * dp; + this.sphereCoords = new Array(5); + this.tmpSphereVerts = new Array(5); + this.tmpSphereNorms = new Array(5); + var _g = 0; + while(_g < 5) { + var i = _g++; + var num = i == 0 || i == 4 ? 1 : 8; + this.sphereCoords[i] = new Array(num); + this.tmpSphereVerts[i] = new Array(num); + this.tmpSphereNorms[i] = new Array(num); + var _g1 = 0; + while(_g1 < 8) { + var j = _g1++; + var theta = i * 0.7853981633974475; + var phi = j * 0.7853981633974475; this.sphereCoords[i][j] = new oimo_common_Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); this.tmpSphereVerts[i][j] = new oimo_common_Vec3(); this.tmpSphereNorms[i][j] = new oimo_common_Vec3(); } } - var this10 = new Array(8); - this.circleCoords = this10; - var this11 = new Array(8); - this.circleCoordsShift = this11; - var this12 = new Array(8); - this.tmpCircleVerts1 = this12; - var this13 = new Array(8); - this.tmpCircleVerts2 = this13; - var this14 = new Array(8); - this.tmpCircleNorms = this14; - var td = 0.7853981633974475; - var _g4 = 0; - while(_g4 < 8) { - var i1 = _g4++; - this.circleCoords[i1] = new oimo_common_Vec3(Math.cos(i1 * td),0,-Math.sin(i1 * td)); - this.circleCoordsShift[i1] = new oimo_common_Vec3(Math.cos((i1 + 0.5) * td),0,-Math.sin((i1 + 0.5) * td)); + this.circleCoords = new Array(8); + this.circleCoordsShift = new Array(8); + this.tmpCircleVerts1 = new Array(8); + this.tmpCircleVerts2 = new Array(8); + this.tmpCircleNorms = new Array(8); + var _g2 = 0; + while(_g2 < 8) { + var i1 = _g2++; + this.circleCoords[i1] = new oimo_common_Vec3(Math.cos(i1 * 0.7853981633974475),0,-Math.sin(i1 * 0.7853981633974475)); + this.circleCoordsShift[i1] = new oimo_common_Vec3(Math.cos((i1 + 0.5) * 0.7853981633974475),0,-Math.sin((i1 + 0.5) * 0.7853981633974475)); this.tmpCircleVerts1[i1] = new oimo_common_Vec3(); this.tmpCircleVerts2[i1] = new oimo_common_Vec3(); this.tmpCircleNorms[i1] = new oimo_common_Vec3(); @@ -20487,29 +18934,15 @@ oimo_dynamics_common_DebugDraw.prototype = { var v7 = (_this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); var _this7 = this.p; var v8 = (_this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); - this.line(v1,v2,color); - this.line(v3,v4,color); - this.line(v5,v6,color); - this.line(v7,v8,color); - this.line(v1,v3,color); - this.line(v2,v4,color); - this.line(v5,v7,color); - this.line(v6,v8,color); - this.line(v1,v5,color); - this.line(v2,v6,color); - this.line(v3,v7,color); - this.line(v4,v8,color); var _this8 = this.p; if(v1 != null) { v1.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newLength = _this8.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this8.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -20521,13 +18954,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v2 != null) { v2.zero(); if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newLength1 = _this9.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this9.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(_this9.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this9.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = _this9.stackVec3[i1]; _this9.stackVec3[i1] = null; } @@ -20539,13 +18970,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v3 != null) { v3.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength2 = _this10.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = _this10.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; + var newArray2 = new Array(_this10.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this10.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; newArray2[i2] = _this10.stackVec3[i2]; _this10.stackVec3[i2] = null; } @@ -20557,13 +18986,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v4 != null) { v4.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newLength3 = _this11.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = _this11.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; + var newArray3 = new Array(_this11.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this11.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; newArray3[i3] = _this11.stackVec3[i3]; _this11.stackVec3[i3] = null; } @@ -20575,13 +19002,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v5 != null) { v5.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength4 = _this12.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g14 = 0; - var _g5 = _this12.sizeVec3; - while(_g14 < _g5) { - var i4 = _g14++; + var newArray4 = new Array(_this12.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this12.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; newArray4[i4] = _this12.stackVec3[i4]; _this12.stackVec3[i4] = null; } @@ -20593,13 +19018,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v6 != null) { v6.zero(); if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength5 = _this13.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g15 = 0; - var _g6 = _this13.sizeVec3; - while(_g15 < _g6) { - var i5 = _g15++; + var newArray5 = new Array(_this13.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this13.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; newArray5[i5] = _this13.stackVec3[i5]; _this13.stackVec3[i5] = null; } @@ -20611,13 +19034,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v7 != null) { v7.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength6 = _this14.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g16 = 0; - var _g7 = _this14.sizeVec3; - while(_g16 < _g7) { - var i6 = _g16++; + var newArray6 = new Array(_this14.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this14.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; newArray6[i6] = _this14.stackVec3[i6]; _this14.stackVec3[i6] = null; } @@ -20629,13 +19050,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(v8 != null) { v8.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength7 = _this15.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g17 = 0; - var _g8 = _this15.sizeVec3; - while(_g17 < _g8) { - var i7 = _g17++; + var newArray7 = new Array(_this15.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this15.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; newArray7[i7] = _this15.stackVec3[i7]; _this15.stackVec3[i7] = null; } @@ -20672,59 +19091,36 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(rot.e00,rot.e10,rot.e20); ey.init(rot.e01,rot.e11,rot.e21); ez.init(rot.e02,rot.e12,rot.e22); - var tx = ex.x * length; - var ty = ex.y * length; - var tz = ex.z * length; - ex.x = tx; - ex.y = ty; - ex.z = tz; + ex.x *= length; + ex.y *= length; + ex.z *= length; var _this5 = ex; - var tx1 = _this5.x + pos.x; - var ty1 = _this5.y + pos.y; - var tz1 = _this5.z + pos.z; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var tx2 = ey.x * length; - var ty2 = ey.y * length; - var tz2 = ey.z * length; - ey.x = tx2; - ey.y = ty2; - ey.z = tz2; + _this5.x += pos.x; + _this5.y += pos.y; + _this5.z += pos.z; + ey.x *= length; + ey.y *= length; + ey.z *= length; var _this6 = ey; - var tx3 = _this6.x + pos.x; - var ty3 = _this6.y + pos.y; - var tz3 = _this6.z + pos.z; - _this6.x = tx3; - _this6.y = ty3; - _this6.z = tz3; - var tx4 = ez.x * length; - var ty4 = ez.y * length; - var tz4 = ez.z * length; - ez.x = tx4; - ez.y = ty4; - ez.z = tz4; + _this6.x += pos.x; + _this6.y += pos.y; + _this6.z += pos.z; + ez.x *= length; + ez.y *= length; + ez.z *= length; var _this7 = ez; - var tx5 = _this7.x + pos.x; - var ty5 = _this7.y + pos.y; - var tz5 = _this7.z + pos.z; - _this7.x = tx5; - _this7.y = ty5; - _this7.z = tz5; - this.line(pos,ex,colorX); - this.line(pos,ey,colorY); - this.line(pos,ez,colorZ); + _this7.x += pos.x; + _this7.y += pos.y; + _this7.z += pos.z; var _this8 = this.p; if(pos != null) { pos.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newLength = _this8.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this8.sizeVec3; - while(_g1 < _g) { - var i = _g1++; + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -20734,32 +19130,21 @@ oimo_dynamics_common_DebugDraw.prototype = { } var _this9 = this.p; if(rot != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - rot.e00 = t00; - rot.e01 = t01; - rot.e02 = t02; - rot.e10 = t10; - rot.e11 = t11; - rot.e12 = t12; - rot.e20 = t20; - rot.e21 = t21; - rot.e22 = t22; + rot.e00 = 1; + rot.e01 = 0; + rot.e02 = 0; + rot.e10 = 0; + rot.e11 = 1; + rot.e12 = 0; + rot.e20 = 0; + rot.e21 = 0; + rot.e22 = 1; if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newLength1 = _this9.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this9.sizeMat3; - while(_g11 < _g2) { - var i1 = _g11++; + var newArray1 = new Array(_this9.sizeMat3 << 1); + var _g2 = 0; + var _g11 = _this9.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; newArray1[i1] = _this9.stackMat3[i1]; _this9.stackMat3[i1] = null; } @@ -20771,13 +19156,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(ex != null) { ex.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength2 = _this10.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = _this10.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; + var newArray2 = new Array(_this10.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this10.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; newArray2[i2] = _this10.stackVec3[i2]; _this10.stackVec3[i2] = null; } @@ -20789,13 +19172,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(ey != null) { ey.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newLength3 = _this11.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = _this11.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; + var newArray3 = new Array(_this11.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this11.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; newArray3[i3] = _this11.stackVec3[i3]; _this11.stackVec3[i3] = null; } @@ -20807,13 +19188,11 @@ oimo_dynamics_common_DebugDraw.prototype = { if(ez != null) { ez.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength4 = _this12.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g14 = 0; - var _g5 = _this12.sizeVec3; - while(_g14 < _g5) { - var i4 = _g14++; + var newArray4 = new Array(_this12.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this12.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; newArray4[i4] = _this12.stackVec3[i4]; _this12.stackVec3[i4] = null; } @@ -20832,12 +19211,9 @@ oimo_dynamics_common_DebugDraw.prototype = { _this1.y = ex.y; _this1.z = ex.z; var _this2 = _this1; - var tx = _this2.x * radiusX; - var ty = _this2.y * radiusX; - var tz = _this2.z * radiusX; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; + _this2.x *= radiusX; + _this2.y *= radiusX; + _this2.z *= radiusX; ex = _this2; var _this3 = this.p; var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; @@ -20845,19 +19221,15 @@ oimo_dynamics_common_DebugDraw.prototype = { _this4.y = ey.y; _this4.z = ey.z; var _this5 = _this4; - var tx1 = _this5.x * radiusY; - var ty1 = _this5.y * radiusY; - var tz1 = _this5.z * radiusY; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; + _this5.x *= radiusY; + _this5.y *= radiusY; + _this5.z *= radiusY; ey = _this5; - var step = 0.52359877559829837; var angDiff = endAngle - startAngle; if(angDiff < 0) { angDiff = -angDiff; } - var n = angDiff / step + 0.5 | 0; + var n = angDiff / 0.52359877559829837 + 0.5 | 0; if(n == 0) { n = 1; } @@ -20869,131 +19241,99 @@ oimo_dynamics_common_DebugDraw.prototype = { _this7.y = center.y; _this7.z = center.z; var _this8 = _this7; - var s = Math.cos(theta); - var tx2 = _this8.x + ex.x * s; - var ty2 = _this8.y + ex.y * s; - var tz2 = _this8.z + ex.z * s; - _this8.x = tx2; - _this8.y = ty2; - _this8.z = tz2; - var _this9 = _this8; - var s1 = Math.sin(theta); - var tx3 = _this9.x + ey.x * s1; - var ty3 = _this9.y + ey.y * s1; - var tz3 = _this9.z + ey.z * s1; - _this9.x = tx3; - _this9.y = ty3; - _this9.z = tz3; - var v = _this9; - var prevV = v; - if(drawSector) { - this.line(center,prevV,color); - } - var _g1 = 0; - var _g = n; - while(_g1 < _g) { - var i = _g1++; + var s = Math.cos(startAngle); + _this8.x += _this2.x * s; + _this8.y += _this2.y * s; + _this8.z += _this2.z * s; + var s1 = Math.sin(startAngle); + _this8.x += _this5.x * s1; + _this8.y += _this5.y * s1; + _this8.z += _this5.z * s1; + var prevV = _this8; + var _g = 0; + var _g1 = n; + while(_g < _g1) { + ++_g; theta += dt; - var _this10 = this.p; - var _this11 = _this10.sizeVec3 == 0 ? new oimo_common_Vec3() : _this10.stackVec3[--_this10.sizeVec3]; - _this11.x = center.x; - _this11.y = center.y; - _this11.z = center.z; - var _this12 = _this11; + var _this9 = this.p; + var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + _this10.x = center.x; + _this10.y = center.y; + _this10.z = center.z; + var _this11 = _this10; var s2 = Math.cos(theta); - var tx4 = _this12.x + ex.x * s2; - var ty4 = _this12.y + ex.y * s2; - var tz4 = _this12.z + ex.z * s2; - _this12.x = tx4; - _this12.y = ty4; - _this12.z = tz4; - var _this13 = _this12; + _this11.x += _this2.x * s2; + _this11.y += _this2.y * s2; + _this11.z += _this2.z * s2; var s3 = Math.sin(theta); - var tx5 = _this13.x + ey.x * s3; - var ty5 = _this13.y + ey.y * s3; - var tz5 = _this13.z + ey.z * s3; - _this13.x = tx5; - _this13.y = ty5; - _this13.z = tz5; - var v1 = _this13; - var v2 = v1; - this.line(prevV,v2,color); - var _this14 = this.p; + _this11.x += _this5.x * s3; + _this11.y += _this5.y * s3; + _this11.z += _this5.z * s3; + var _this12 = this.p; if(prevV != null) { prevV.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength = _this14.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g11 = 0; - var _g2 = _this14.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; - newArray[i1] = _this14.stackVec3[i1]; - _this14.stackVec3[i1] = null; + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newArray = new Array(_this12.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this12.sizeVec3; + while(_g2 < _g11) { + var i = _g2++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this14.stackVec3 = newArray; + _this12.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = prevV; + _this12.stackVec3[_this12.sizeVec3++] = prevV; } - prevV = v2; - } - if(drawSector) { - this.line(center,prevV,color); + prevV = _this11; } - var _this15 = this.p; + var _this13 = this.p; if(prevV != null) { prevV.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength1 = _this15.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g12 = 0; - var _g3 = _this15.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; - newArray1[i2] = _this15.stackVec3[i2]; - _this15.stackVec3[i2] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newArray1 = new Array(_this13.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this13.sizeVec3; + while(_g3 < _g12) { + var i1 = _g3++; + newArray1[i1] = _this13.stackVec3[i1]; + _this13.stackVec3[i1] = null; } - _this15.stackVec3 = newArray1; + _this13.stackVec3 = newArray1; } - _this15.stackVec3[_this15.sizeVec3++] = prevV; + _this13.stackVec3[_this13.sizeVec3++] = prevV; } - var _this16 = this.p; - if(ex != null) { - ex.zero(); - if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newLength2 = _this16.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g13 = 0; - var _g4 = _this16.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; - newArray2[i3] = _this16.stackVec3[i3]; - _this16.stackVec3[i3] = null; + var _this14 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray2 = new Array(_this14.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this14.sizeVec3; + while(_g4 < _g13) { + var i2 = _g4++; + newArray2[i2] = _this14.stackVec3[i2]; + _this14.stackVec3[i2] = null; } - _this16.stackVec3 = newArray2; + _this14.stackVec3 = newArray2; } - _this16.stackVec3[_this16.sizeVec3++] = ex; + _this14.stackVec3[_this14.sizeVec3++] = _this2; } - var _this17 = this.p; - if(ey != null) { - ey.zero(); - if(_this17.sizeVec3 == _this17.stackVec3.length) { - var newLength3 = _this17.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g14 = 0; - var _g5 = _this17.sizeVec3; - while(_g14 < _g5) { - var i4 = _g14++; - newArray3[i4] = _this17.stackVec3[i4]; - _this17.stackVec3[i4] = null; + var _this15 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray3 = new Array(_this15.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this15.sizeVec3; + while(_g5 < _g14) { + var i3 = _g5++; + newArray3[i3] = _this15.stackVec3[i3]; + _this15.stackVec3[i3] = null; } - _this17.stackVec3 = newArray3; + _this15.stackVec3 = newArray3; } - _this17.stackVec3[_this17.sizeVec3++] = ey; + _this15.stackVec3[_this15.sizeVec3++] = _this5; } } ,cone: function(tf,radius,halfHeight,color) { @@ -21030,13 +19370,9 @@ oimo_dynamics_common_DebugDraw.prototype = { _this6.y = o.y; _this6.z = o.z; var _this7 = _this6; - var tx = _this7.x + ey.x * halfHeight; - var ty = _this7.y + ey.y * halfHeight; - var tz = _this7.z + ey.z * halfHeight; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var top = _this7; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; var _this8 = this.p; var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; @@ -21044,445 +19380,339 @@ oimo_dynamics_common_DebugDraw.prototype = { _this9.z = o.z; var _this10 = _this9; var s = -halfHeight; - var tx1 = _this10.x + ey.x * s; - var ty1 = _this10.y + ey.y * s; - var tz1 = _this10.z + ey.z * s; - _this10.x = tx1; - _this10.y = ty1; - _this10.z = tz1; - var bottom = _this10; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { var _this11 = this.p; var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = bottom.x; - _this12.y = bottom.y; - _this12.z = bottom.z; + _this12.x = _this10.x; + _this12.y = _this10.y; + _this12.z = _this10.z; var _this13 = _this12; var s1 = -radius; - var tx2 = _this13.x + ex.x * s1; - var ty2 = _this13.y + ex.y * s1; - var tz2 = _this13.z + ex.z * s1; - _this13.x = tx2; - _this13.y = ty2; - _this13.z = tz2; - var _this14 = _this13; - var tx3 = _this14.x + ez.x * 0; - var ty3 = _this14.y + ez.y * 0; - var tz3 = _this14.z + ez.z * 0; - _this14.x = tx3; - _this14.y = ty3; - _this14.z = tz3; - var bottom1 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = bottom.x; - _this16.y = bottom.y; - _this16.z = bottom.z; - var _this17 = _this16; - var tx4 = _this17.x + ex.x * radius; - var ty4 = _this17.y + ex.y * radius; - var tz4 = _this17.z + ex.z * radius; - _this17.x = tx4; - _this17.y = ty4; - _this17.z = tz4; - var _this18 = _this17; - var tx5 = _this18.x + ez.x * 0; - var ty5 = _this18.y + ez.y * 0; - var tz5 = _this18.z + ez.z * 0; - _this18.x = tx5; - _this18.y = ty5; - _this18.z = tz5; - var bottom2 = _this18; - var _this19 = this.p; - var _this20 = _this19.sizeVec3 == 0 ? new oimo_common_Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - _this20.x = bottom.x; - _this20.y = bottom.y; - _this20.z = bottom.z; - var _this21 = _this20; - var tx6 = _this21.x + ex.x * 0; - var ty6 = _this21.y + ex.y * 0; - var tz6 = _this21.z + ex.z * 0; - _this21.x = tx6; - _this21.y = ty6; - _this21.z = tz6; - var _this22 = _this21; + _this13.x += ex.x * s1; + _this13.y += ex.y * s1; + _this13.z += ex.z * s1; + _this13.x += ez.x * 0; + _this13.y += ez.y * 0; + _this13.z += ez.z * 0; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + var _this16 = _this15; + _this16.x += ex.x * radius; + _this16.y += ex.y * radius; + _this16.z += ex.z * radius; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + var _this19 = _this18; + _this19.x += ex.x * 0; + _this19.y += ex.y * 0; + _this19.z += ex.z * 0; var s2 = -radius; - var tx7 = _this22.x + ez.x * s2; - var ty7 = _this22.y + ez.y * s2; - var tz7 = _this22.z + ez.z * s2; - _this22.x = tx7; - _this22.y = ty7; - _this22.z = tz7; - var bottom3 = _this22; + _this19.x += ez.x * s2; + _this19.y += ez.y * s2; + _this19.z += ez.z * s2; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + _this22.x += ez.x * radius; + _this22.y += ez.y * radius; + _this22.z += ez.z * radius; + this.ellipse(_this10,ex,ez,radius,radius,color); var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = bottom.x; - _this24.y = bottom.y; - _this24.z = bottom.z; - var _this25 = _this24; - var tx8 = _this25.x + ex.x * 0; - var ty8 = _this25.y + ex.y * 0; - var tz8 = _this25.z + ex.z * 0; - _this25.x = tx8; - _this25.y = ty8; - _this25.z = tz8; - var _this26 = _this25; - var tx9 = _this26.x + ez.x * radius; - var ty9 = _this26.y + ez.y * radius; - var tz9 = _this26.z + ez.z * radius; - _this26.x = tx9; - _this26.y = ty9; - _this26.z = tz9; - var bottom4 = _this26; - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top,bottom1,color); - this.line(top,bottom2,color); - this.line(top,bottom3,color); - this.line(top,bottom4,color); - var _this27 = this.p; - if(bottom1 != null) { - bottom1.zero(); - if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newLength = _this27.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this27.sizeVec3; - while(_g1 < _g) { - var i = _g1++; - newArray[i] = _this27.stackVec3[i]; - _this27.stackVec3[i] = null; + if(_this13 != null) { + _this13.zero(); + if(_this23.sizeVec3 == _this23.stackVec3.length) { + var newArray = new Array(_this23.sizeVec3 << 1); + var _g = 0; + var _g1 = _this23.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this23.stackVec3[i]; + _this23.stackVec3[i] = null; } - _this27.stackVec3 = newArray; - } - _this27.stackVec3[_this27.sizeVec3++] = bottom1; - } - var _this28 = this.p; - if(bottom2 != null) { - bottom2.zero(); - if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newLength1 = _this28.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this28.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; - newArray1[i1] = _this28.stackVec3[i1]; - _this28.stackVec3[i1] = null; + _this23.stackVec3 = newArray; + } + _this23.stackVec3[_this23.sizeVec3++] = _this13; + } + var _this24 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newArray1 = new Array(_this24.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this24.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this24.stackVec3[i1]; + _this24.stackVec3[i1] = null; } - _this28.stackVec3 = newArray1; + _this24.stackVec3 = newArray1; } - _this28.stackVec3[_this28.sizeVec3++] = bottom2; + _this24.stackVec3[_this24.sizeVec3++] = _this16; } - var _this29 = this.p; - if(bottom3 != null) { - bottom3.zero(); - if(_this29.sizeVec3 == _this29.stackVec3.length) { - var newLength2 = _this29.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = _this29.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; - newArray2[i2] = _this29.stackVec3[i2]; - _this29.stackVec3[i2] = null; + var _this25 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this25.sizeVec3 == _this25.stackVec3.length) { + var newArray2 = new Array(_this25.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this25.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this25.stackVec3[i2]; + _this25.stackVec3[i2] = null; } - _this29.stackVec3 = newArray2; - } - _this29.stackVec3[_this29.sizeVec3++] = bottom3; - } - var _this30 = this.p; - if(bottom4 != null) { - bottom4.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newLength3 = _this30.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = _this30.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; - newArray3[i3] = _this30.stackVec3[i3]; - _this30.stackVec3[i3] = null; + _this25.stackVec3 = newArray2; + } + _this25.stackVec3[_this25.sizeVec3++] = _this19; + } + var _this26 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + var newArray3 = new Array(_this26.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this26.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this26.stackVec3[i3]; + _this26.stackVec3[i3] = null; } - _this30.stackVec3 = newArray3; + _this26.stackVec3 = newArray3; } - _this30.stackVec3[_this30.sizeVec3++] = bottom4; + _this26.stackVec3[_this26.sizeVec3++] = _this22; } } else { var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); var cos = 2 * halfHeight * invDenom; var sin = radius * invDenom; - var invDenom2 = 1 / Math.sqrt(2 * (1 + cos)); var _g5 = 0; while(_g5 < 8) { var i4 = _g5++; - var _this31 = this.tmpCircleNorms[i4]; + var _this27 = this.tmpCircleNorms[i4]; var v1 = this.circleCoords[i4]; - _this31.x = v1.x; - _this31.y = v1.y; - _this31.z = v1.z; - var _this32 = _this31; - var tx10 = _this32.x * cos; - var ty10 = _this32.y * cos; - var tz10 = _this32.z * cos; - _this32.x = tx10; - _this32.y = ty10; - _this32.z = tz10; - _this32.y += sin; - var _this33 = this.tmpCircleNorms[i4]; - var tx11 = _this33.x * m.e00 + _this33.y * m.e01 + _this33.z * m.e02; - var ty11 = _this33.x * m.e10 + _this33.y * m.e11 + _this33.z * m.e12; - var tz11 = _this33.x * m.e20 + _this33.y * m.e21 + _this33.z * m.e22; - _this33.x = tx11; - _this33.y = ty11; - _this33.z = tz11; - var _this34 = this.tmpCircleVerts1[i4]; + _this27.x = v1.x; + _this27.y = v1.y; + _this27.z = v1.z; + _this27.x *= cos; + _this27.y *= cos; + _this27.z *= cos; + _this27.y += sin; + var _this28 = this.tmpCircleNorms[i4]; + var y = _this28.x * m.e10 + _this28.y * m.e11 + _this28.z * m.e12; + var z = _this28.x * m.e20 + _this28.y * m.e21 + _this28.z * m.e22; + _this28.x = _this28.x * m.e00 + _this28.y * m.e01 + _this28.z * m.e02; + _this28.y = y; + _this28.z = z; + var _this29 = this.tmpCircleVerts1[i4]; var v2 = this.circleCoordsShift[i4]; - _this34.x = v2.x; - _this34.y = v2.y; - _this34.z = v2.z; - var _this35 = _this34; - var tx12 = _this35.x * cos; - var ty12 = _this35.y * cos; - var tz12 = _this35.z * cos; - _this35.x = tx12; - _this35.y = ty12; - _this35.z = tz12; - _this35.y += sin; - var _this36 = this.tmpCircleVerts1[i4]; - var tx13 = _this36.x * m.e00 + _this36.y * m.e01 + _this36.z * m.e02; - var ty13 = _this36.x * m.e10 + _this36.y * m.e11 + _this36.z * m.e12; - var tz13 = _this36.x * m.e20 + _this36.y * m.e21 + _this36.z * m.e22; - _this36.x = tx13; - _this36.y = ty13; - _this36.z = tz13; - var _this37 = this.tmpCircleVerts2[i4]; + _this29.x = v2.x; + _this29.y = v2.y; + _this29.z = v2.z; + _this29.x *= cos; + _this29.y *= cos; + _this29.z *= cos; + _this29.y += sin; + var _this30 = this.tmpCircleVerts1[i4]; + var y1 = _this30.x * m.e10 + _this30.y * m.e11 + _this30.z * m.e12; + var z1 = _this30.x * m.e20 + _this30.y * m.e21 + _this30.z * m.e22; + _this30.x = _this30.x * m.e00 + _this30.y * m.e01 + _this30.z * m.e02; + _this30.y = y1; + _this30.z = z1; + var _this31 = this.tmpCircleVerts2[i4]; var v3 = this.circleCoords[i4]; - _this37.x = v3.x; - _this37.y = v3.y; - _this37.z = v3.z; - var _this38 = _this37; - var tx14 = _this38.x * m.e00 + _this38.y * m.e01 + _this38.z * m.e02; - var ty14 = _this38.x * m.e10 + _this38.y * m.e11 + _this38.z * m.e12; - var tz14 = _this38.x * m.e20 + _this38.y * m.e21 + _this38.z * m.e22; - _this38.x = tx14; - _this38.y = ty14; - _this38.z = tz14; - var _this39 = _this38; - var tx15 = _this39.x * radius; - var ty15 = _this39.y * radius; - var tz15 = _this39.z * radius; - _this39.x = tx15; - _this39.y = ty15; - _this39.z = tz15; - var _this40 = _this39; - var tx16 = _this40.x + o.x; - var ty16 = _this40.y + o.y; - var tz16 = _this40.z + o.z; - _this40.x = tx16; - _this40.y = ty16; - _this40.z = tz16; - var _this41 = this.tmpCircleVerts2[i4]; + _this31.x = v3.x; + _this31.y = v3.y; + _this31.z = v3.z; + var y2 = _this31.x * m.e10 + _this31.y * m.e11 + _this31.z * m.e12; + var z2 = _this31.x * m.e20 + _this31.y * m.e21 + _this31.z * m.e22; + _this31.x = _this31.x * m.e00 + _this31.y * m.e01 + _this31.z * m.e02; + _this31.y = y2; + _this31.z = z2; + _this31.x *= radius; + _this31.y *= radius; + _this31.z *= radius; + _this31.x += o.x; + _this31.y += o.y; + _this31.z += o.z; + var _this32 = this.tmpCircleVerts2[i4]; var s3 = -halfHeight; - var tx17 = _this41.x + ey.x * s3; - var ty17 = _this41.y + ey.y * s3; - var tz17 = _this41.z + ey.z * s3; - _this41.x = tx17; - _this41.y = ty17; - _this41.z = tz17; - } - var _g6 = 0; - while(_g6 < 8) { - var i5 = _g6++; - var v11 = top; + _this32.x += ey.x * s3; + _this32.y += ey.y * s3; + _this32.z += ey.z * s3; + } + var _g14 = 0; + while(_g14 < 8) { + var i5 = _g14++; var v21 = this.tmpCircleVerts2[i5]; var v31 = this.tmpCircleVerts2[(i5 + 1) % 8]; var n1 = this.tmpCircleVerts1[i5]; - var n2 = this.tmpCircleNorms[i5]; - var n3 = this.tmpCircleNorms[(i5 + 1) % 8]; - this.triangle(v11,v21,v31,n1,n2,n3,color); - v11 = bottom; v21 = this.tmpCircleVerts2[(i5 + 1) % 8]; v31 = this.tmpCircleVerts2[i5]; - var _this42 = this.p; - var _this43 = _this42.sizeVec3 == 0 ? new oimo_common_Vec3() : _this42.stackVec3[--_this42.sizeVec3]; - _this43.x = ey.x; - _this43.y = ey.y; - _this43.z = ey.z; - var _this44 = _this43; - var tx18 = -_this44.x; - var ty18 = -_this44.y; - var tz18 = -_this44.z; - _this44.x = tx18; - _this44.y = ty18; - _this44.z = tz18; - n1 = _this44; - this.triangle(v11,v21,v31,n1,n1,n1,color); - var _this45 = this.p; - if(n1 != null) { - n1.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength4 = _this45.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g14 = 0; - var _g7 = _this45.sizeVec3; - while(_g14 < _g7) { - var i6 = _g14++; - newArray4[i6] = _this45.stackVec3[i6]; - _this45.stackVec3[i6] = null; + var _this33 = this.p; + var _this34 = _this33.sizeVec3 == 0 ? new oimo_common_Vec3() : _this33.stackVec3[--_this33.sizeVec3]; + _this34.x = ey.x; + _this34.y = ey.y; + _this34.z = ey.z; + var _this35 = _this34; + _this35.x = -_this35.x; + _this35.y = -_this35.y; + _this35.z = -_this35.z; + n1 = _this35; + var _this36 = this.p; + if(_this35 != null) { + _this35.zero(); + if(_this36.sizeVec3 == _this36.stackVec3.length) { + var newArray4 = new Array(_this36.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this36.sizeVec3; + while(_g6 < _g15) { + var i6 = _g6++; + newArray4[i6] = _this36.stackVec3[i6]; + _this36.stackVec3[i6] = null; } - _this45.stackVec3 = newArray4; + _this36.stackVec3 = newArray4; } - _this45.stackVec3[_this45.sizeVec3++] = n1; + _this36.stackVec3[_this36.sizeVec3++] = _this35; } } } - var _this46 = this.p; - if(top != null) { - top.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength5 = _this46.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g15 = 0; - var _g8 = _this46.sizeVec3; - while(_g15 < _g8) { - var i7 = _g15++; - newArray5[i7] = _this46.stackVec3[i7]; - _this46.stackVec3[i7] = null; + var _this37 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray5 = new Array(_this37.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this37.sizeVec3; + while(_g7 < _g16) { + var i7 = _g7++; + newArray5[i7] = _this37.stackVec3[i7]; + _this37.stackVec3[i7] = null; } - _this46.stackVec3 = newArray5; + _this37.stackVec3 = newArray5; } - _this46.stackVec3[_this46.sizeVec3++] = top; + _this37.stackVec3[_this37.sizeVec3++] = _this7; } - var _this47 = this.p; - if(bottom != null) { - bottom.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newLength6 = _this47.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g16 = 0; - var _g9 = _this47.sizeVec3; - while(_g16 < _g9) { - var i8 = _g16++; - newArray6[i8] = _this47.stackVec3[i8]; - _this47.stackVec3[i8] = null; + var _this38 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray6 = new Array(_this38.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this38.sizeVec3; + while(_g8 < _g17) { + var i8 = _g8++; + newArray6[i8] = _this38.stackVec3[i8]; + _this38.stackVec3[i8] = null; } - _this47.stackVec3 = newArray6; + _this38.stackVec3 = newArray6; } - _this47.stackVec3[_this47.sizeVec3++] = bottom; + _this38.stackVec3[_this38.sizeVec3++] = _this10; } - var _this48 = this.p; + var _this39 = this.p; if(o != null) { o.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newLength7 = _this48.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g17 = 0; - var _g10 = _this48.sizeVec3; - while(_g17 < _g10) { - var i9 = _g17++; - newArray7[i9] = _this48.stackVec3[i9]; - _this48.stackVec3[i9] = null; + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray7 = new Array(_this39.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this39.sizeVec3; + while(_g9 < _g18) { + var i9 = _g9++; + newArray7[i9] = _this39.stackVec3[i9]; + _this39.stackVec3[i9] = null; } - _this48.stackVec3 = newArray7; + _this39.stackVec3 = newArray7; } - _this48.stackVec3[_this48.sizeVec3++] = o; + _this39.stackVec3[_this39.sizeVec3++] = o; } - var _this49 = this.p; + var _this40 = this.p; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this49.sizeMat3 == _this49.stackMat3.length) { - var newLength8 = _this49.sizeMat3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g18 = 0; - var _g19 = _this49.sizeMat3; - while(_g18 < _g19) { - var i10 = _g18++; - newArray8[i10] = _this49.stackMat3[i10]; - _this49.stackMat3[i10] = null; - } - _this49.stackMat3 = newArray8; - } - _this49.stackMat3[_this49.sizeMat3++] = m; - } - var _this50 = this.p; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this40.sizeMat3 == _this40.stackMat3.length) { + var newArray8 = new Array(_this40.sizeMat3 << 1); + var _g10 = 0; + var _g19 = _this40.sizeMat3; + while(_g10 < _g19) { + var i10 = _g10++; + newArray8[i10] = _this40.stackMat3[i10]; + _this40.stackMat3[i10] = null; + } + _this40.stackMat3 = newArray8; + } + _this40.stackMat3[_this40.sizeMat3++] = m; + } + var _this41 = this.p; if(ex != null) { ex.zero(); - if(_this50.sizeVec3 == _this50.stackVec3.length) { - var newLength9 = _this50.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g110 = 0; - var _g20 = _this50.sizeVec3; - while(_g110 < _g20) { - var i11 = _g110++; - newArray9[i11] = _this50.stackVec3[i11]; - _this50.stackVec3[i11] = null; + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray9 = new Array(_this41.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this41.sizeVec3; + while(_g20 < _g110) { + var i11 = _g20++; + newArray9[i11] = _this41.stackVec3[i11]; + _this41.stackVec3[i11] = null; } - _this50.stackVec3 = newArray9; + _this41.stackVec3 = newArray9; } - _this50.stackVec3[_this50.sizeVec3++] = ex; + _this41.stackVec3[_this41.sizeVec3++] = ex; } - var _this51 = this.p; + var _this42 = this.p; if(ey != null) { ey.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newLength10 = _this51.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g111 = 0; - var _g21 = _this51.sizeVec3; - while(_g111 < _g21) { - var i12 = _g111++; - newArray10[i12] = _this51.stackVec3[i12]; - _this51.stackVec3[i12] = null; + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray10 = new Array(_this42.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this42.sizeVec3; + while(_g21 < _g111) { + var i12 = _g21++; + newArray10[i12] = _this42.stackVec3[i12]; + _this42.stackVec3[i12] = null; } - _this51.stackVec3 = newArray10; + _this42.stackVec3 = newArray10; } - _this51.stackVec3[_this51.sizeVec3++] = ey; + _this42.stackVec3[_this42.sizeVec3++] = ey; } - var _this52 = this.p; + var _this43 = this.p; if(ez != null) { ez.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newLength11 = _this52.sizeVec3 << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g112 = 0; - var _g22 = _this52.sizeVec3; - while(_g112 < _g22) { - var i13 = _g112++; - newArray11[i13] = _this52.stackVec3[i13]; - _this52.stackVec3[i13] = null; + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray11 = new Array(_this43.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this43.sizeVec3; + while(_g22 < _g112) { + var i13 = _g22++; + newArray11[i13] = _this43.stackVec3[i13]; + _this43.stackVec3[i13] = null; } - _this52.stackVec3 = newArray11; + _this43.stackVec3 = newArray11; } - _this52.stackVec3[_this52.sizeVec3++] = ez; + _this43.stackVec3[_this43.sizeVec3++] = ez; } } ,cylinder: function(tf,radius,halfHeight,color) { @@ -21519,13 +19749,9 @@ oimo_dynamics_common_DebugDraw.prototype = { _this6.y = o.y; _this6.z = o.z; var _this7 = _this6; - var tx = _this7.x + ey.x * halfHeight; - var ty = _this7.y + ey.y * halfHeight; - var tz = _this7.z + ey.z * halfHeight; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var top = _this7; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; var _this8 = this.p; var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; @@ -21533,580 +19759,443 @@ oimo_dynamics_common_DebugDraw.prototype = { _this9.z = o.z; var _this10 = _this9; var s = -halfHeight; - var tx1 = _this10.x + ey.x * s; - var ty1 = _this10.y + ey.y * s; - var tz1 = _this10.z + ey.z * s; - _this10.x = tx1; - _this10.y = ty1; - _this10.z = tz1; - var bottom = _this10; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { var _this11 = this.p; var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = top.x; - _this12.y = top.y; - _this12.z = top.z; + _this12.x = _this7.x; + _this12.y = _this7.y; + _this12.z = _this7.z; var _this13 = _this12; var s1 = -radius; - var tx2 = _this13.x + ex.x * s1; - var ty2 = _this13.y + ex.y * s1; - var tz2 = _this13.z + ex.z * s1; - _this13.x = tx2; - _this13.y = ty2; - _this13.z = tz2; - var _this14 = _this13; - var tx3 = _this14.x + ez.x * 0; - var ty3 = _this14.y + ez.y * 0; - var tz3 = _this14.z + ez.z * 0; - _this14.x = tx3; - _this14.y = ty3; - _this14.z = tz3; - var top1 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = top.x; - _this16.y = top.y; - _this16.z = top.z; - var _this17 = _this16; - var tx4 = _this17.x + ex.x * radius; - var ty4 = _this17.y + ex.y * radius; - var tz4 = _this17.z + ex.z * radius; - _this17.x = tx4; - _this17.y = ty4; - _this17.z = tz4; - var _this18 = _this17; - var tx5 = _this18.x + ez.x * 0; - var ty5 = _this18.y + ez.y * 0; - var tz5 = _this18.z + ez.z * 0; - _this18.x = tx5; - _this18.y = ty5; - _this18.z = tz5; - var top2 = _this18; - var _this19 = this.p; - var _this20 = _this19.sizeVec3 == 0 ? new oimo_common_Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - _this20.x = top.x; - _this20.y = top.y; - _this20.z = top.z; - var _this21 = _this20; - var tx6 = _this21.x + ex.x * 0; - var ty6 = _this21.y + ex.y * 0; - var tz6 = _this21.z + ex.z * 0; - _this21.x = tx6; - _this21.y = ty6; - _this21.z = tz6; - var _this22 = _this21; + _this13.x += ex.x * s1; + _this13.y += ex.y * s1; + _this13.z += ex.z * s1; + _this13.x += ez.x * 0; + _this13.y += ez.y * 0; + _this13.z += ez.z * 0; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this7.x; + _this15.y = _this7.y; + _this15.z = _this7.z; + var _this16 = _this15; + _this16.x += ex.x * radius; + _this16.y += ex.y * radius; + _this16.z += ex.z * radius; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this7.x; + _this18.y = _this7.y; + _this18.z = _this7.z; + var _this19 = _this18; + _this19.x += ex.x * 0; + _this19.y += ex.y * 0; + _this19.z += ex.z * 0; var s2 = -radius; - var tx7 = _this22.x + ez.x * s2; - var ty7 = _this22.y + ez.y * s2; - var tz7 = _this22.z + ez.z * s2; - _this22.x = tx7; - _this22.y = ty7; - _this22.z = tz7; - var top3 = _this22; + _this19.x += ez.x * s2; + _this19.y += ez.y * s2; + _this19.z += ez.z * s2; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this7.x; + _this21.y = _this7.y; + _this21.z = _this7.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + _this22.x += ez.x * radius; + _this22.y += ez.y * radius; + _this22.z += ez.z * radius; var _this23 = this.p; var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = top.x; - _this24.y = top.y; - _this24.z = top.z; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; var _this25 = _this24; - var tx8 = _this25.x + ex.x * 0; - var ty8 = _this25.y + ex.y * 0; - var tz8 = _this25.z + ex.z * 0; - _this25.x = tx8; - _this25.y = ty8; - _this25.z = tz8; - var _this26 = _this25; - var tx9 = _this26.x + ez.x * radius; - var ty9 = _this26.y + ez.y * radius; - var tz9 = _this26.z + ez.z * radius; - _this26.x = tx9; - _this26.y = ty9; - _this26.z = tz9; - var top4 = _this26; - var _this27 = this.p; - var _this28 = _this27.sizeVec3 == 0 ? new oimo_common_Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = bottom.x; - _this28.y = bottom.y; - _this28.z = bottom.z; - var _this29 = _this28; var s3 = -radius; - var tx10 = _this29.x + ex.x * s3; - var ty10 = _this29.y + ex.y * s3; - var tz10 = _this29.z + ex.z * s3; - _this29.x = tx10; - _this29.y = ty10; - _this29.z = tz10; - var _this30 = _this29; - var tx11 = _this30.x + ez.x * 0; - var ty11 = _this30.y + ez.y * 0; - var tz11 = _this30.z + ez.z * 0; - _this30.x = tx11; - _this30.y = ty11; - _this30.z = tz11; - var bottom1 = _this30; - var _this31 = this.p; - var _this32 = _this31.sizeVec3 == 0 ? new oimo_common_Vec3() : _this31.stackVec3[--_this31.sizeVec3]; - _this32.x = bottom.x; - _this32.y = bottom.y; - _this32.z = bottom.z; - var _this33 = _this32; - var tx12 = _this33.x + ex.x * radius; - var ty12 = _this33.y + ex.y * radius; - var tz12 = _this33.z + ex.z * radius; - _this33.x = tx12; - _this33.y = ty12; - _this33.z = tz12; - var _this34 = _this33; - var tx13 = _this34.x + ez.x * 0; - var ty13 = _this34.y + ez.y * 0; - var tz13 = _this34.z + ez.z * 0; - _this34.x = tx13; - _this34.y = ty13; - _this34.z = tz13; - var bottom2 = _this34; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = bottom.x; - _this36.y = bottom.y; - _this36.z = bottom.z; - var _this37 = _this36; - var tx14 = _this37.x + ex.x * 0; - var ty14 = _this37.y + ex.y * 0; - var tz14 = _this37.z + ex.z * 0; - _this37.x = tx14; - _this37.y = ty14; - _this37.z = tz14; - var _this38 = _this37; + _this25.x += ex.x * s3; + _this25.y += ex.y * s3; + _this25.z += ex.z * s3; + _this25.x += ez.x * 0; + _this25.y += ez.y * 0; + _this25.z += ez.z * 0; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = _this10.x; + _this27.y = _this10.y; + _this27.z = _this10.z; + var _this28 = _this27; + _this28.x += ex.x * radius; + _this28.y += ex.y * radius; + _this28.z += ex.z * radius; + _this28.x += ez.x * 0; + _this28.y += ez.y * 0; + _this28.z += ez.z * 0; + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = _this10.x; + _this30.y = _this10.y; + _this30.z = _this10.z; + var _this31 = _this30; + _this31.x += ex.x * 0; + _this31.y += ex.y * 0; + _this31.z += ex.z * 0; var s4 = -radius; - var tx15 = _this38.x + ez.x * s4; - var ty15 = _this38.y + ez.y * s4; - var tz15 = _this38.z + ez.z * s4; - _this38.x = tx15; - _this38.y = ty15; - _this38.z = tz15; - var bottom3 = _this38; - var _this39 = this.p; - var _this40 = _this39.sizeVec3 == 0 ? new oimo_common_Vec3() : _this39.stackVec3[--_this39.sizeVec3]; - _this40.x = bottom.x; - _this40.y = bottom.y; - _this40.z = bottom.z; - var _this41 = _this40; - var tx16 = _this41.x + ex.x * 0; - var ty16 = _this41.y + ex.y * 0; - var tz16 = _this41.z + ex.z * 0; - _this41.x = tx16; - _this41.y = ty16; - _this41.z = tz16; - var _this42 = _this41; - var tx17 = _this42.x + ez.x * radius; - var ty17 = _this42.y + ez.y * radius; - var tz17 = _this42.z + ez.z * radius; - _this42.x = tx17; - _this42.y = ty17; - _this42.z = tz17; - var bottom4 = _this42; - this.ellipse(top,ex,ez,radius,radius,color); - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top1,bottom1,color); - this.line(top2,bottom2,color); - this.line(top3,bottom3,color); - this.line(top4,bottom4,color); - var _this43 = this.p; - if(top1 != null) { - top1.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newLength = _this43.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this43.sizeVec3; - while(_g1 < _g) { - var i = _g1++; - newArray[i] = _this43.stackVec3[i]; - _this43.stackVec3[i] = null; + _this31.x += ez.x * s4; + _this31.y += ez.y * s4; + _this31.z += ez.z * s4; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = _this10.x; + _this33.y = _this10.y; + _this33.z = _this10.z; + var _this34 = _this33; + _this34.x += ex.x * 0; + _this34.y += ex.y * 0; + _this34.z += ex.z * 0; + _this34.x += ez.x * radius; + _this34.y += ez.y * radius; + _this34.z += ez.z * radius; + this.ellipse(_this7,ex,ez,radius,radius,color); + this.ellipse(_this10,ex,ez,radius,radius,color); + var _this35 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this35.sizeVec3 == _this35.stackVec3.length) { + var newArray = new Array(_this35.sizeVec3 << 1); + var _g = 0; + var _g1 = _this35.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this35.stackVec3[i]; + _this35.stackVec3[i] = null; } - _this43.stackVec3 = newArray; - } - _this43.stackVec3[_this43.sizeVec3++] = top1; - } - var _this44 = this.p; - if(top2 != null) { - top2.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newLength1 = _this44.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this44.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; - newArray1[i1] = _this44.stackVec3[i1]; - _this44.stackVec3[i1] = null; + _this35.stackVec3 = newArray; + } + _this35.stackVec3[_this35.sizeVec3++] = _this13; + } + var _this36 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this36.sizeVec3 == _this36.stackVec3.length) { + var newArray1 = new Array(_this36.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this36.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this36.stackVec3[i1]; + _this36.stackVec3[i1] = null; } - _this44.stackVec3 = newArray1; + _this36.stackVec3 = newArray1; } - _this44.stackVec3[_this44.sizeVec3++] = top2; + _this36.stackVec3[_this36.sizeVec3++] = _this16; } - var _this45 = this.p; - if(top3 != null) { - top3.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength2 = _this45.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = _this45.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; - newArray2[i2] = _this45.stackVec3[i2]; - _this45.stackVec3[i2] = null; + var _this37 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray2 = new Array(_this37.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this37.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this37.stackVec3[i2]; + _this37.stackVec3[i2] = null; } - _this45.stackVec3 = newArray2; - } - _this45.stackVec3[_this45.sizeVec3++] = top3; - } - var _this46 = this.p; - if(top4 != null) { - top4.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength3 = _this46.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = _this46.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; - newArray3[i3] = _this46.stackVec3[i3]; - _this46.stackVec3[i3] = null; + _this37.stackVec3 = newArray2; + } + _this37.stackVec3[_this37.sizeVec3++] = _this19; + } + var _this38 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray3 = new Array(_this38.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this38.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this38.stackVec3[i3]; + _this38.stackVec3[i3] = null; } - _this46.stackVec3 = newArray3; - } - _this46.stackVec3[_this46.sizeVec3++] = top4; - } - var _this47 = this.p; - if(bottom1 != null) { - bottom1.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newLength4 = _this47.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g14 = 0; - var _g5 = _this47.sizeVec3; - while(_g14 < _g5) { - var i4 = _g14++; - newArray4[i4] = _this47.stackVec3[i4]; - _this47.stackVec3[i4] = null; + _this38.stackVec3 = newArray3; + } + _this38.stackVec3[_this38.sizeVec3++] = _this22; + } + var _this39 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray4 = new Array(_this39.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this39.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this39.stackVec3[i4]; + _this39.stackVec3[i4] = null; } - _this47.stackVec3 = newArray4; - } - _this47.stackVec3[_this47.sizeVec3++] = bottom1; - } - var _this48 = this.p; - if(bottom2 != null) { - bottom2.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newLength5 = _this48.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g15 = 0; - var _g6 = _this48.sizeVec3; - while(_g15 < _g6) { - var i5 = _g15++; - newArray5[i5] = _this48.stackVec3[i5]; - _this48.stackVec3[i5] = null; + _this39.stackVec3 = newArray4; + } + _this39.stackVec3[_this39.sizeVec3++] = _this25; + } + var _this40 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray5 = new Array(_this40.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this40.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this40.stackVec3[i5]; + _this40.stackVec3[i5] = null; } - _this48.stackVec3 = newArray5; - } - _this48.stackVec3[_this48.sizeVec3++] = bottom2; - } - var _this49 = this.p; - if(bottom3 != null) { - bottom3.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newLength6 = _this49.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g16 = 0; - var _g7 = _this49.sizeVec3; - while(_g16 < _g7) { - var i6 = _g16++; - newArray6[i6] = _this49.stackVec3[i6]; - _this49.stackVec3[i6] = null; + _this40.stackVec3 = newArray5; + } + _this40.stackVec3[_this40.sizeVec3++] = _this28; + } + var _this41 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray6 = new Array(_this41.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this41.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this41.stackVec3[i6]; + _this41.stackVec3[i6] = null; } - _this49.stackVec3 = newArray6; - } - _this49.stackVec3[_this49.sizeVec3++] = bottom3; - } - var _this50 = this.p; - if(bottom4 != null) { - bottom4.zero(); - if(_this50.sizeVec3 == _this50.stackVec3.length) { - var newLength7 = _this50.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g17 = 0; - var _g8 = _this50.sizeVec3; - while(_g17 < _g8) { - var i7 = _g17++; - newArray7[i7] = _this50.stackVec3[i7]; - _this50.stackVec3[i7] = null; + _this41.stackVec3 = newArray6; + } + _this41.stackVec3[_this41.sizeVec3++] = _this31; + } + var _this42 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray7 = new Array(_this42.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this42.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this42.stackVec3[i7]; + _this42.stackVec3[i7] = null; } - _this50.stackVec3 = newArray7; + _this42.stackVec3 = newArray7; } - _this50.stackVec3[_this50.sizeVec3++] = bottom4; + _this42.stackVec3[_this42.sizeVec3++] = _this34; } } else { var _g9 = 0; while(_g9 < 8) { var i8 = _g9++; - var _this51 = this.tmpCircleNorms[i8]; + var _this43 = this.tmpCircleNorms[i8]; var v1 = this.circleCoords[i8]; - _this51.x = v1.x; - _this51.y = v1.y; - _this51.z = v1.z; - var _this52 = _this51; - var tx18 = _this52.x * m.e00 + _this52.y * m.e01 + _this52.z * m.e02; - var ty18 = _this52.x * m.e10 + _this52.y * m.e11 + _this52.z * m.e12; - var tz18 = _this52.x * m.e20 + _this52.y * m.e21 + _this52.z * m.e22; - _this52.x = tx18; - _this52.y = ty18; - _this52.z = tz18; - var _this53 = this.tmpCircleVerts1[i8]; + _this43.x = v1.x; + _this43.y = v1.y; + _this43.z = v1.z; + var y = _this43.x * m.e10 + _this43.y * m.e11 + _this43.z * m.e12; + var z = _this43.x * m.e20 + _this43.y * m.e21 + _this43.z * m.e22; + _this43.x = _this43.x * m.e00 + _this43.y * m.e01 + _this43.z * m.e02; + _this43.y = y; + _this43.z = z; + var _this44 = this.tmpCircleVerts1[i8]; var v2 = this.tmpCircleNorms[i8]; - _this53.x = v2.x; - _this53.y = v2.y; - _this53.z = v2.z; - var _this54 = _this53; - var tx19 = _this54.x * radius; - var ty19 = _this54.y * radius; - var tz19 = _this54.z * radius; - _this54.x = tx19; - _this54.y = ty19; - _this54.z = tz19; - var _this55 = _this54; - var tx20 = _this55.x + o.x; - var ty20 = _this55.y + o.y; - var tz20 = _this55.z + o.z; - _this55.x = tx20; - _this55.y = ty20; - _this55.z = tz20; - var _this56 = this.tmpCircleVerts2[i8]; + _this44.x = v2.x; + _this44.y = v2.y; + _this44.z = v2.z; + _this44.x *= radius; + _this44.y *= radius; + _this44.z *= radius; + _this44.x += o.x; + _this44.y += o.y; + _this44.z += o.z; + var _this45 = this.tmpCircleVerts2[i8]; var v3 = this.tmpCircleVerts1[i8]; - _this56.x = v3.x; - _this56.y = v3.y; - _this56.z = v3.z; - var _this57 = this.tmpCircleVerts1[i8]; - var tx21 = _this57.x + ey.x * halfHeight; - var ty21 = _this57.y + ey.y * halfHeight; - var tz21 = _this57.z + ey.z * halfHeight; - _this57.x = tx21; - _this57.y = ty21; - _this57.z = tz21; - var _this58 = this.tmpCircleVerts2[i8]; + _this45.x = v3.x; + _this45.y = v3.y; + _this45.z = v3.z; + var _this46 = this.tmpCircleVerts1[i8]; + _this46.x += ey.x * halfHeight; + _this46.y += ey.y * halfHeight; + _this46.z += ey.z * halfHeight; + var _this47 = this.tmpCircleVerts2[i8]; var s5 = -halfHeight; - var tx22 = _this58.x + ey.x * s5; - var ty22 = _this58.y + ey.y * s5; - var tz22 = _this58.z + ey.z * s5; - _this58.x = tx22; - _this58.y = ty22; - _this58.z = tz22; - } - var _g10 = 0; - while(_g10 < 8) { - var i9 = _g10++; - var n3; - var n4; - var v11 = top; + _this47.x += ey.x * s5; + _this47.y += ey.y * s5; + _this47.z += ey.z * s5; + } + var _g18 = 0; + while(_g18 < 8) { + var i9 = _g18++; + var v11 = _this7; var v21 = this.tmpCircleVerts1[i9]; var v31 = this.tmpCircleVerts1[(i9 + 1) % 8]; var n1 = ey; - this.triangle(v11,v21,v31,n1,n1,n1,color); - v11 = bottom; + v11 = _this10; v21 = this.tmpCircleVerts2[(i9 + 1) % 8]; v31 = this.tmpCircleVerts2[i9]; - var _this59 = this.p; - var _this60 = _this59.sizeVec3 == 0 ? new oimo_common_Vec3() : _this59.stackVec3[--_this59.sizeVec3]; - _this60.x = ey.x; - _this60.y = ey.y; - _this60.z = ey.z; - var _this61 = _this60; - var tx23 = -_this61.x; - var ty23 = -_this61.y; - var tz23 = -_this61.z; - _this61.x = tx23; - _this61.y = ty23; - _this61.z = tz23; - n1 = _this61; - this.triangle(v11,v21,v31,n1,n1,n1,color); - var _this62 = this.p; - if(n1 != null) { - n1.zero(); - if(_this62.sizeVec3 == _this62.stackVec3.length) { - var newLength8 = _this62.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g18 = 0; - var _g19 = _this62.sizeVec3; - while(_g18 < _g19) { - var i10 = _g18++; - newArray8[i10] = _this62.stackVec3[i10]; - _this62.stackVec3[i10] = null; + var _this48 = this.p; + var _this49 = _this48.sizeVec3 == 0 ? new oimo_common_Vec3() : _this48.stackVec3[--_this48.sizeVec3]; + _this49.x = ey.x; + _this49.y = ey.y; + _this49.z = ey.z; + var _this50 = _this49; + _this50.x = -_this50.x; + _this50.y = -_this50.y; + _this50.z = -_this50.z; + n1 = _this50; + var _this51 = this.p; + if(_this50 != null) { + _this50.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray8 = new Array(_this51.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this51.sizeVec3; + while(_g10 < _g19) { + var i10 = _g10++; + newArray8[i10] = _this51.stackVec3[i10]; + _this51.stackVec3[i10] = null; } - _this62.stackVec3 = newArray8; + _this51.stackVec3 = newArray8; } - _this62.stackVec3[_this62.sizeVec3++] = n1; + _this51.stackVec3[_this51.sizeVec3++] = _this50; } v11 = this.tmpCircleVerts1[i9]; v21 = this.tmpCircleVerts2[i9]; v31 = this.tmpCircleVerts2[(i9 + 1) % 8]; - var v4 = this.tmpCircleVerts1[(i9 + 1) % 8]; n1 = this.tmpCircleNorms[i9]; var n2 = this.tmpCircleNorms[(i9 + 1) % 8]; - this.rect(v11,v21,v31,v4,n1,n1,n2,n2,color); - } - } - var _this63 = this.p; - if(top != null) { - top.zero(); - if(_this63.sizeVec3 == _this63.stackVec3.length) { - var newLength9 = _this63.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g110 = 0; - var _g20 = _this63.sizeVec3; - while(_g110 < _g20) { - var i11 = _g110++; - newArray9[i11] = _this63.stackVec3[i11]; - _this63.stackVec3[i11] = null; - } - _this63.stackVec3 = newArray9; - } - _this63.stackVec3[_this63.sizeVec3++] = top; - } - var _this64 = this.p; - if(bottom != null) { - bottom.zero(); - if(_this64.sizeVec3 == _this64.stackVec3.length) { - var newLength10 = _this64.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g111 = 0; - var _g21 = _this64.sizeVec3; - while(_g111 < _g21) { - var i12 = _g111++; - newArray10[i12] = _this64.stackVec3[i12]; - _this64.stackVec3[i12] = null; - } - _this64.stackVec3 = newArray10; - } - _this64.stackVec3[_this64.sizeVec3++] = bottom; - } - var _this65 = this.p; + this.rect(v11,v21,v31,this.tmpCircleVerts1[(i9 + 1) % 8],n1,n1,n2,n2,color); + } + } + var _this52 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray9 = new Array(_this52.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this52.sizeVec3; + while(_g20 < _g110) { + var i11 = _g20++; + newArray9[i11] = _this52.stackVec3[i11]; + _this52.stackVec3[i11] = null; + } + _this52.stackVec3 = newArray9; + } + _this52.stackVec3[_this52.sizeVec3++] = _this7; + } + var _this53 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray10 = new Array(_this53.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this53.sizeVec3; + while(_g21 < _g111) { + var i12 = _g21++; + newArray10[i12] = _this53.stackVec3[i12]; + _this53.stackVec3[i12] = null; + } + _this53.stackVec3 = newArray10; + } + _this53.stackVec3[_this53.sizeVec3++] = _this10; + } + var _this54 = this.p; if(o != null) { o.zero(); - if(_this65.sizeVec3 == _this65.stackVec3.length) { - var newLength11 = _this65.sizeVec3 << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g112 = 0; - var _g22 = _this65.sizeVec3; - while(_g112 < _g22) { - var i13 = _g112++; - newArray11[i13] = _this65.stackVec3[i13]; - _this65.stackVec3[i13] = null; - } - _this65.stackVec3 = newArray11; - } - _this65.stackVec3[_this65.sizeVec3++] = o; - } - var _this66 = this.p; + if(_this54.sizeVec3 == _this54.stackVec3.length) { + var newArray11 = new Array(_this54.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this54.sizeVec3; + while(_g22 < _g112) { + var i13 = _g22++; + newArray11[i13] = _this54.stackVec3[i13]; + _this54.stackVec3[i13] = null; + } + _this54.stackVec3 = newArray11; + } + _this54.stackVec3[_this54.sizeVec3++] = o; + } + var _this55 = this.p; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this66.sizeMat3 == _this66.stackMat3.length) { - var newLength12 = _this66.sizeMat3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g113 = 0; - var _g23 = _this66.sizeMat3; - while(_g113 < _g23) { - var i14 = _g113++; - newArray12[i14] = _this66.stackMat3[i14]; - _this66.stackMat3[i14] = null; - } - _this66.stackMat3 = newArray12; - } - _this66.stackMat3[_this66.sizeMat3++] = m; - } - var _this67 = this.p; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this55.sizeMat3 == _this55.stackMat3.length) { + var newArray12 = new Array(_this55.sizeMat3 << 1); + var _g23 = 0; + var _g113 = _this55.sizeMat3; + while(_g23 < _g113) { + var i14 = _g23++; + newArray12[i14] = _this55.stackMat3[i14]; + _this55.stackMat3[i14] = null; + } + _this55.stackMat3 = newArray12; + } + _this55.stackMat3[_this55.sizeMat3++] = m; + } + var _this56 = this.p; if(ex != null) { ex.zero(); - if(_this67.sizeVec3 == _this67.stackVec3.length) { - var newLength13 = _this67.sizeVec3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g114 = 0; - var _g24 = _this67.sizeVec3; - while(_g114 < _g24) { - var i15 = _g114++; - newArray13[i15] = _this67.stackVec3[i15]; - _this67.stackVec3[i15] = null; - } - _this67.stackVec3 = newArray13; - } - _this67.stackVec3[_this67.sizeVec3++] = ex; - } - var _this68 = this.p; + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newArray13 = new Array(_this56.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this56.sizeVec3; + while(_g24 < _g114) { + var i15 = _g24++; + newArray13[i15] = _this56.stackVec3[i15]; + _this56.stackVec3[i15] = null; + } + _this56.stackVec3 = newArray13; + } + _this56.stackVec3[_this56.sizeVec3++] = ex; + } + var _this57 = this.p; if(ey != null) { ey.zero(); - if(_this68.sizeVec3 == _this68.stackVec3.length) { - var newLength14 = _this68.sizeVec3 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g115 = 0; - var _g25 = _this68.sizeVec3; - while(_g115 < _g25) { - var i16 = _g115++; - newArray14[i16] = _this68.stackVec3[i16]; - _this68.stackVec3[i16] = null; - } - _this68.stackVec3 = newArray14; - } - _this68.stackVec3[_this68.sizeVec3++] = ey; - } - var _this69 = this.p; + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newArray14 = new Array(_this57.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this57.sizeVec3; + while(_g25 < _g115) { + var i16 = _g25++; + newArray14[i16] = _this57.stackVec3[i16]; + _this57.stackVec3[i16] = null; + } + _this57.stackVec3 = newArray14; + } + _this57.stackVec3[_this57.sizeVec3++] = ey; + } + var _this58 = this.p; if(ez != null) { ez.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength15 = _this69.sizeVec3 << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g116 = 0; - var _g26 = _this69.sizeVec3; - while(_g116 < _g26) { - var i17 = _g116++; - newArray15[i17] = _this69.stackVec3[i17]; - _this69.stackVec3[i17] = null; + if(_this58.sizeVec3 == _this58.stackVec3.length) { + var newArray15 = new Array(_this58.sizeVec3 << 1); + var _g26 = 0; + var _g116 = _this58.sizeVec3; + while(_g26 < _g116) { + var i17 = _g26++; + newArray15[i17] = _this58.stackVec3[i17]; + _this58.stackVec3[i17] = null; } - _this69.stackVec3 = newArray15; + _this58.stackVec3 = newArray15; } - _this69.stackVec3[_this69.sizeVec3++] = ez; + _this58.stackVec3[_this58.sizeVec3++] = ez; } } ,capsule: function(tf,radius,halfHeight,color) { @@ -22137,122 +20226,84 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var nt = 4; - var np = 8; var vs = this.tmpSphereVerts; var ns = this.tmpSphereNorms; - var _g1 = 0; - var _g = nt + 1; - while(_g1 < _g) { - var i2 = _g1++; + var _g = 0; + while(_g < 5) { + var i2 = _g++; var n = this.tmpSphereVerts[i2].length; - var _g3 = 0; - var _g2 = n; - while(_g3 < _g2) { - var j2 = _g3++; + var _g1 = 0; + while(_g1 < n) { + var j2 = _g1++; var _this5 = ns[i2][j2]; var v1 = this.sphereCoords[i2][j2]; _this5.x = v1.x; _this5.y = v1.y; _this5.z = v1.z; - var _this6 = _this5; - var tx = _this6.x * m.e00 + _this6.y * m.e01 + _this6.z * m.e02; - var ty = _this6.x * m.e10 + _this6.y * m.e11 + _this6.z * m.e12; - var tz = _this6.x * m.e20 + _this6.y * m.e21 + _this6.z * m.e22; - _this6.x = tx; - _this6.y = ty; - _this6.z = tz; - } - } - var _g11 = 0; - var _g4 = nt; - while(_g11 < _g4) { - var i = _g11++; + var y = _this5.x * m.e10 + _this5.y * m.e11 + _this5.z * m.e12; + var z = _this5.x * m.e20 + _this5.y * m.e21 + _this5.z * m.e22; + _this5.x = _this5.x * m.e00 + _this5.y * m.e01 + _this5.z * m.e02; + _this5.y = y; + _this5.z = z; + } + } + var _g2 = 0; + while(_g2 < 4) { + var i = _g2++; if(i == 0) { - var half = nt >> 1; - var _g31 = 0; - var _g21 = half + 1; - while(_g31 < _g21) { - var i21 = _g31++; + var _g21 = 0; + while(_g21 < 3) { + var i21 = _g21++; var n1 = this.tmpSphereVerts[i21].length; - var _g5 = 0; - var _g41 = n1; - while(_g5 < _g41) { - var j21 = _g5++; - var _this7 = vs[i21][j21]; + var _g22 = 0; + while(_g22 < n1) { + var j21 = _g22++; + var _this6 = vs[i21][j21]; var v2 = ns[i21][j21]; - _this7.x = v2.x; - _this7.y = v2.y; - _this7.z = v2.z; - var _this8 = _this7; - var tx1 = _this8.x * radius; - var ty1 = _this8.y * radius; - var tz1 = _this8.z * radius; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; - var _this9 = _this8; - var tx2 = _this9.x + o.x; - var ty2 = _this9.y + o.y; - var tz2 = _this9.z + o.z; - _this9.x = tx2; - _this9.y = ty2; - _this9.z = tz2; - var _this10 = _this9; - var tx3 = _this10.x + ey.x * halfHeight; - var ty3 = _this10.y + ey.y * halfHeight; - var tz3 = _this10.z + ey.z * halfHeight; - _this10.x = tx3; - _this10.y = ty3; - _this10.z = tz3; + _this6.x = v2.x; + _this6.y = v2.y; + _this6.z = v2.z; + _this6.x *= radius; + _this6.y *= radius; + _this6.z *= radius; + _this6.x += o.x; + _this6.y += o.y; + _this6.z += o.z; + _this6.x += ey.x * halfHeight; + _this6.y += ey.y * halfHeight; + _this6.z += ey.z * halfHeight; } } } - if(i == nt >> 1) { - var half1 = nt >> 1; - var _g32 = half1; - var _g22 = nt + 1; - while(_g32 < _g22) { - var i22 = _g32++; + if(i == 2) { + var _g23 = 2; + while(_g23 < 5) { + var i22 = _g23++; var n2 = this.tmpSphereVerts[i22].length; - var _g51 = 0; - var _g42 = n2; - while(_g51 < _g42) { - var j22 = _g51++; - var _this11 = vs[i22][j22]; + var _g24 = 0; + while(_g24 < n2) { + var j22 = _g24++; + var _this7 = vs[i22][j22]; var v3 = ns[i22][j22]; - _this11.x = v3.x; - _this11.y = v3.y; - _this11.z = v3.z; - var _this12 = _this11; - var tx4 = _this12.x * radius; - var ty4 = _this12.y * radius; - var tz4 = _this12.z * radius; - _this12.x = tx4; - _this12.y = ty4; - _this12.z = tz4; - var _this13 = _this12; - var tx5 = _this13.x + o.x; - var ty5 = _this13.y + o.y; - var tz5 = _this13.z + o.z; - _this13.x = tx5; - _this13.y = ty5; - _this13.z = tz5; - var _this14 = _this13; + _this7.x = v3.x; + _this7.y = v3.y; + _this7.z = v3.z; + _this7.x *= radius; + _this7.y *= radius; + _this7.z *= radius; + _this7.x += o.x; + _this7.y += o.y; + _this7.z += o.z; var s = -halfHeight; - var tx6 = _this14.x + ey.x * s; - var ty6 = _this14.y + ey.y * s; - var tz6 = _this14.z + ey.z * s; - _this14.x = tx6; - _this14.y = ty6; - _this14.z = tz6; + _this7.x += ey.x * s; + _this7.y += ey.y * s; + _this7.z += ey.z * s; } } } - var _g33 = 0; - var _g23 = np; - while(_g33 < _g23) { - var j = _g33++; + var _g25 = 0; + while(_g25 < 8) { + var j = _g25++; var v11; var v21; var v31; @@ -22265,603 +20316,461 @@ oimo_dynamics_common_DebugDraw.prototype = { if(this.wireframe) { v11 = vs[0][0]; v21 = vs[1][j]; - this.line(v11,v21,color); } else { v11 = vs[0][0]; v21 = vs[1][j]; - v31 = vs[1][(j + 1) % np]; + v31 = vs[1][(j + 1) % 8]; n11 = ns[0][0]; n21 = ns[1][j]; - n3 = ns[1][(j + 1) % np]; - this.triangle(v11,v21,v31,n11,n21,n3,color); + n3 = ns[1][(j + 1) % 8]; } - } else if(i == nt - 1) { + } else if(i == 3) { if(this.wireframe) { - v11 = vs[nt][0]; - v21 = vs[i][(j + 1) % np]; + v11 = vs[4][0]; + v21 = vs[i][(j + 1) % 8]; v31 = vs[i][j]; - this.line(v11,v21,color); - this.line(v21,v31,color); } else { - v11 = vs[nt][0]; - v21 = vs[i][(j + 1) % np]; + v11 = vs[4][0]; + v21 = vs[i][(j + 1) % 8]; v31 = vs[i][j]; - n11 = ns[nt][0]; - n21 = ns[i][(j + 1) % np]; + n11 = ns[4][0]; + n21 = ns[i][(j + 1) % 8]; n3 = ns[i][j]; - this.triangle(v11,v21,v31,n11,n21,n3,color); } } else if(this.wireframe) { v11 = vs[i][j]; - v21 = vs[i][(j + 1) % np]; + v21 = vs[i][(j + 1) % 8]; v31 = vs[i + 1][j]; - this.line(v11,v21,color); - this.line(v11,v31,color); } else { v11 = vs[i][j]; - v21 = vs[i][(j + 1) % np]; + v21 = vs[i][(j + 1) % 8]; v31 = vs[i + 1][j]; - v4 = vs[i + 1][(j + 1) % np]; + v4 = vs[i + 1][(j + 1) % 8]; n11 = ns[i][j]; - n21 = ns[i][(j + 1) % np]; + n21 = ns[i][(j + 1) % 8]; n3 = ns[i + 1][j]; - n4 = ns[i + 1][(j + 1) % np]; + n4 = ns[i + 1][(j + 1) % 8]; this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); } } } - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = o.x; - _this16.y = o.y; - _this16.z = o.z; - var _this17 = _this16; - var tx7 = _this17.x + ey.x * halfHeight; - var ty7 = _this17.y + ey.y * halfHeight; - var tz7 = _this17.z + ey.z * halfHeight; - _this17.x = tx7; - _this17.y = ty7; - _this17.z = tz7; - var top = _this17; - var _this18 = this.p; - var _this19 = _this18.sizeVec3 == 0 ? new oimo_common_Vec3() : _this18.stackVec3[--_this18.sizeVec3]; - _this19.x = o.x; - _this19.y = o.y; - _this19.z = o.z; - var _this20 = _this19; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + _this10.x += ey.x * halfHeight; + _this10.y += ey.y * halfHeight; + _this10.z += ey.z * halfHeight; + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = o.x; + _this12.y = o.y; + _this12.z = o.z; + var _this13 = _this12; var s1 = -halfHeight; - var tx8 = _this20.x + ey.x * s1; - var ty8 = _this20.y + ey.y * s1; - var tz8 = _this20.z + ey.z * s1; - _this20.x = tx8; - _this20.y = ty8; - _this20.z = tz8; - var bottom = _this20; + _this13.x += ey.x * s1; + _this13.y += ey.y * s1; + _this13.z += ey.z * s1; if(this.wireframe) { - var _this21 = this.p; - var _this22 = _this21.sizeVec3 == 0 ? new oimo_common_Vec3() : _this21.stackVec3[--_this21.sizeVec3]; - _this22.x = top.x; - _this22.y = top.y; - _this22.z = top.z; - var _this23 = _this22; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + var _this16 = _this15; var s2 = -radius; - var tx9 = _this23.x + ex.x * s2; - var ty9 = _this23.y + ex.y * s2; - var tz9 = _this23.z + ex.z * s2; - _this23.x = tx9; - _this23.y = ty9; - _this23.z = tz9; - var _this24 = _this23; - var tx10 = _this24.x + ez.x * 0; - var ty10 = _this24.y + ez.y * 0; - var tz10 = _this24.z + ez.z * 0; - _this24.x = tx10; - _this24.y = ty10; - _this24.z = tz10; - var top1 = _this24; - var _this25 = this.p; - var _this26 = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - _this26.x = top.x; - _this26.y = top.y; - _this26.z = top.z; - var _this27 = _this26; - var tx11 = _this27.x + ex.x * radius; - var ty11 = _this27.y + ex.y * radius; - var tz11 = _this27.z + ex.z * radius; - _this27.x = tx11; - _this27.y = ty11; - _this27.z = tz11; + _this16.x += ex.x * s2; + _this16.y += ex.y * s2; + _this16.z += ex.z * s2; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + var _this19 = _this18; + _this19.x += ex.x * radius; + _this19.y += ex.y * radius; + _this19.z += ex.z * radius; + _this19.x += ez.x * 0; + _this19.y += ez.y * 0; + _this19.z += ez.z * 0; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + var s3 = -radius; + _this22.x += ez.x * s3; + _this22.y += ez.y * s3; + _this22.z += ez.z * s3; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; + var _this25 = _this24; + _this25.x += ex.x * 0; + _this25.y += ex.y * 0; + _this25.z += ex.z * 0; + _this25.x += ez.x * radius; + _this25.y += ez.y * radius; + _this25.z += ez.z * radius; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = _this13.x; + _this27.y = _this13.y; + _this27.z = _this13.z; var _this28 = _this27; - var tx12 = _this28.x + ez.x * 0; - var ty12 = _this28.y + ez.y * 0; - var tz12 = _this28.z + ez.z * 0; - _this28.x = tx12; - _this28.y = ty12; - _this28.z = tz12; - var top2 = _this28; + var s4 = -radius; + _this28.x += ex.x * s4; + _this28.y += ex.y * s4; + _this28.z += ex.z * s4; + _this28.x += ez.x * 0; + _this28.y += ez.y * 0; + _this28.z += ez.z * 0; var _this29 = this.p; var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = top.x; - _this30.y = top.y; - _this30.z = top.z; + _this30.x = _this13.x; + _this30.y = _this13.y; + _this30.z = _this13.z; var _this31 = _this30; - var tx13 = _this31.x + ex.x * 0; - var ty13 = _this31.y + ex.y * 0; - var tz13 = _this31.z + ex.z * 0; - _this31.x = tx13; - _this31.y = ty13; - _this31.z = tz13; - var _this32 = _this31; - var s3 = -radius; - var tx14 = _this32.x + ez.x * s3; - var ty14 = _this32.y + ez.y * s3; - var tz14 = _this32.z + ez.z * s3; - _this32.x = tx14; - _this32.y = ty14; - _this32.z = tz14; - var top3 = _this32; - var _this33 = this.p; - var _this34 = _this33.sizeVec3 == 0 ? new oimo_common_Vec3() : _this33.stackVec3[--_this33.sizeVec3]; - _this34.x = top.x; - _this34.y = top.y; - _this34.z = top.z; - var _this35 = _this34; - var tx15 = _this35.x + ex.x * 0; - var ty15 = _this35.y + ex.y * 0; - var tz15 = _this35.z + ex.z * 0; - _this35.x = tx15; - _this35.y = ty15; - _this35.z = tz15; - var _this36 = _this35; - var tx16 = _this36.x + ez.x * radius; - var ty16 = _this36.y + ez.y * radius; - var tz16 = _this36.z + ez.z * radius; - _this36.x = tx16; - _this36.y = ty16; - _this36.z = tz16; - var top4 = _this36; - var _this37 = this.p; - var _this38 = _this37.sizeVec3 == 0 ? new oimo_common_Vec3() : _this37.stackVec3[--_this37.sizeVec3]; - _this38.x = bottom.x; - _this38.y = bottom.y; - _this38.z = bottom.z; - var _this39 = _this38; - var s4 = -radius; - var tx17 = _this39.x + ex.x * s4; - var ty17 = _this39.y + ex.y * s4; - var tz17 = _this39.z + ex.z * s4; - _this39.x = tx17; - _this39.y = ty17; - _this39.z = tz17; - var _this40 = _this39; - var tx18 = _this40.x + ez.x * 0; - var ty18 = _this40.y + ez.y * 0; - var tz18 = _this40.z + ez.z * 0; - _this40.x = tx18; - _this40.y = ty18; - _this40.z = tz18; - var bottom1 = _this40; - var _this41 = this.p; - var _this42 = _this41.sizeVec3 == 0 ? new oimo_common_Vec3() : _this41.stackVec3[--_this41.sizeVec3]; - _this42.x = bottom.x; - _this42.y = bottom.y; - _this42.z = bottom.z; - var _this43 = _this42; - var tx19 = _this43.x + ex.x * radius; - var ty19 = _this43.y + ex.y * radius; - var tz19 = _this43.z + ex.z * radius; - _this43.x = tx19; - _this43.y = ty19; - _this43.z = tz19; - var _this44 = _this43; - var tx20 = _this44.x + ez.x * 0; - var ty20 = _this44.y + ez.y * 0; - var tz20 = _this44.z + ez.z * 0; - _this44.x = tx20; - _this44.y = ty20; - _this44.z = tz20; - var bottom2 = _this44; - var _this45 = this.p; - var _this46 = _this45.sizeVec3 == 0 ? new oimo_common_Vec3() : _this45.stackVec3[--_this45.sizeVec3]; - _this46.x = bottom.x; - _this46.y = bottom.y; - _this46.z = bottom.z; - var _this47 = _this46; - var tx21 = _this47.x + ex.x * 0; - var ty21 = _this47.y + ex.y * 0; - var tz21 = _this47.z + ex.z * 0; - _this47.x = tx21; - _this47.y = ty21; - _this47.z = tz21; - var _this48 = _this47; + _this31.x += ex.x * radius; + _this31.y += ex.y * radius; + _this31.z += ex.z * radius; + _this31.x += ez.x * 0; + _this31.y += ez.y * 0; + _this31.z += ez.z * 0; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = _this13.x; + _this33.y = _this13.y; + _this33.z = _this13.z; + var _this34 = _this33; + _this34.x += ex.x * 0; + _this34.y += ex.y * 0; + _this34.z += ex.z * 0; var s5 = -radius; - var tx22 = _this48.x + ez.x * s5; - var ty22 = _this48.y + ez.y * s5; - var tz22 = _this48.z + ez.z * s5; - _this48.x = tx22; - _this48.y = ty22; - _this48.z = tz22; - var bottom3 = _this48; - var _this49 = this.p; - var _this50 = _this49.sizeVec3 == 0 ? new oimo_common_Vec3() : _this49.stackVec3[--_this49.sizeVec3]; - _this50.x = bottom.x; - _this50.y = bottom.y; - _this50.z = bottom.z; - var _this51 = _this50; - var tx23 = _this51.x + ex.x * 0; - var ty23 = _this51.y + ex.y * 0; - var tz23 = _this51.z + ex.z * 0; - _this51.x = tx23; - _this51.y = ty23; - _this51.z = tz23; - var _this52 = _this51; - var tx24 = _this52.x + ez.x * radius; - var ty24 = _this52.y + ez.y * radius; - var tz24 = _this52.z + ez.z * radius; - _this52.x = tx24; - _this52.y = ty24; - _this52.z = tz24; - var bottom4 = _this52; - this.ellipse(top,ex,ez,radius,radius,color); - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top1,bottom1,color); - this.line(top2,bottom2,color); - this.line(top3,bottom3,color); - this.line(top4,bottom4,color); - var _this53 = this.p; - if(top1 != null) { - top1.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newLength = _this53.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g12 = 0; - var _g6 = _this53.sizeVec3; - while(_g12 < _g6) { - var i1 = _g12++; - newArray[i1] = _this53.stackVec3[i1]; - _this53.stackVec3[i1] = null; + _this34.x += ez.x * s5; + _this34.y += ez.y * s5; + _this34.z += ez.z * s5; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = _this13.x; + _this36.y = _this13.y; + _this36.z = _this13.z; + var _this37 = _this36; + _this37.x += ex.x * 0; + _this37.y += ex.y * 0; + _this37.z += ex.z * 0; + _this37.x += ez.x * radius; + _this37.y += ez.y * radius; + _this37.z += ez.z * radius; + this.ellipse(_this10,ex,ez,radius,radius,color); + this.ellipse(_this13,ex,ez,radius,radius,color); + var _this38 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray = new Array(_this38.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this38.sizeVec3; + while(_g3 < _g11) { + var i1 = _g3++; + newArray[i1] = _this38.stackVec3[i1]; + _this38.stackVec3[i1] = null; } - _this53.stackVec3 = newArray; - } - _this53.stackVec3[_this53.sizeVec3++] = top1; - } - var _this54 = this.p; - if(top2 != null) { - top2.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newLength1 = _this54.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g13 = 0; - var _g7 = _this54.sizeVec3; - while(_g13 < _g7) { - var i3 = _g13++; - newArray1[i3] = _this54.stackVec3[i3]; - _this54.stackVec3[i3] = null; + _this38.stackVec3 = newArray; + } + _this38.stackVec3[_this38.sizeVec3++] = _this16; + } + var _this39 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray1 = new Array(_this39.sizeVec3 << 1); + var _g4 = 0; + var _g12 = _this39.sizeVec3; + while(_g4 < _g12) { + var i3 = _g4++; + newArray1[i3] = _this39.stackVec3[i3]; + _this39.stackVec3[i3] = null; } - _this54.stackVec3 = newArray1; - } - _this54.stackVec3[_this54.sizeVec3++] = top2; - } - var _this55 = this.p; - if(top3 != null) { - top3.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newLength2 = _this55.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g14 = 0; - var _g8 = _this55.sizeVec3; - while(_g14 < _g8) { - var i4 = _g14++; - newArray2[i4] = _this55.stackVec3[i4]; - _this55.stackVec3[i4] = null; + _this39.stackVec3 = newArray1; + } + _this39.stackVec3[_this39.sizeVec3++] = _this19; + } + var _this40 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray2 = new Array(_this40.sizeVec3 << 1); + var _g5 = 0; + var _g13 = _this40.sizeVec3; + while(_g5 < _g13) { + var i4 = _g5++; + newArray2[i4] = _this40.stackVec3[i4]; + _this40.stackVec3[i4] = null; } - _this55.stackVec3 = newArray2; - } - _this55.stackVec3[_this55.sizeVec3++] = top3; - } - var _this56 = this.p; - if(top4 != null) { - top4.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newLength3 = _this56.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g15 = 0; - var _g9 = _this56.sizeVec3; - while(_g15 < _g9) { - var i5 = _g15++; - newArray3[i5] = _this56.stackVec3[i5]; - _this56.stackVec3[i5] = null; + _this40.stackVec3 = newArray2; + } + _this40.stackVec3[_this40.sizeVec3++] = _this22; + } + var _this41 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray3 = new Array(_this41.sizeVec3 << 1); + var _g6 = 0; + var _g14 = _this41.sizeVec3; + while(_g6 < _g14) { + var i5 = _g6++; + newArray3[i5] = _this41.stackVec3[i5]; + _this41.stackVec3[i5] = null; } - _this56.stackVec3 = newArray3; - } - _this56.stackVec3[_this56.sizeVec3++] = top4; - } - var _this57 = this.p; - if(bottom1 != null) { - bottom1.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newLength4 = _this57.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g16 = 0; - var _g10 = _this57.sizeVec3; - while(_g16 < _g10) { - var i6 = _g16++; - newArray4[i6] = _this57.stackVec3[i6]; - _this57.stackVec3[i6] = null; + _this41.stackVec3 = newArray3; + } + _this41.stackVec3[_this41.sizeVec3++] = _this25; + } + var _this42 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray4 = new Array(_this42.sizeVec3 << 1); + var _g7 = 0; + var _g15 = _this42.sizeVec3; + while(_g7 < _g15) { + var i6 = _g7++; + newArray4[i6] = _this42.stackVec3[i6]; + _this42.stackVec3[i6] = null; } - _this57.stackVec3 = newArray4; - } - _this57.stackVec3[_this57.sizeVec3++] = bottom1; - } - var _this58 = this.p; - if(bottom2 != null) { - bottom2.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newLength5 = _this58.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g17 = 0; - var _g18 = _this58.sizeVec3; - while(_g17 < _g18) { - var i7 = _g17++; - newArray5[i7] = _this58.stackVec3[i7]; - _this58.stackVec3[i7] = null; + _this42.stackVec3 = newArray4; + } + _this42.stackVec3[_this42.sizeVec3++] = _this28; + } + var _this43 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray5 = new Array(_this43.sizeVec3 << 1); + var _g8 = 0; + var _g16 = _this43.sizeVec3; + while(_g8 < _g16) { + var i7 = _g8++; + newArray5[i7] = _this43.stackVec3[i7]; + _this43.stackVec3[i7] = null; } - _this58.stackVec3 = newArray5; - } - _this58.stackVec3[_this58.sizeVec3++] = bottom2; - } - var _this59 = this.p; - if(bottom3 != null) { - bottom3.zero(); - if(_this59.sizeVec3 == _this59.stackVec3.length) { - var newLength6 = _this59.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g19 = 0; - var _g20 = _this59.sizeVec3; - while(_g19 < _g20) { - var i8 = _g19++; - newArray6[i8] = _this59.stackVec3[i8]; - _this59.stackVec3[i8] = null; + _this43.stackVec3 = newArray5; + } + _this43.stackVec3[_this43.sizeVec3++] = _this31; + } + var _this44 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray6 = new Array(_this44.sizeVec3 << 1); + var _g9 = 0; + var _g17 = _this44.sizeVec3; + while(_g9 < _g17) { + var i8 = _g9++; + newArray6[i8] = _this44.stackVec3[i8]; + _this44.stackVec3[i8] = null; } - _this59.stackVec3 = newArray6; - } - _this59.stackVec3[_this59.sizeVec3++] = bottom3; - } - var _this60 = this.p; - if(bottom4 != null) { - bottom4.zero(); - if(_this60.sizeVec3 == _this60.stackVec3.length) { - var newLength7 = _this60.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g110 = 0; - var _g24 = _this60.sizeVec3; - while(_g110 < _g24) { - var i9 = _g110++; - newArray7[i9] = _this60.stackVec3[i9]; - _this60.stackVec3[i9] = null; + _this44.stackVec3 = newArray6; + } + _this44.stackVec3[_this44.sizeVec3++] = _this34; + } + var _this45 = this.p; + if(_this37 != null) { + _this37.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray7 = new Array(_this45.sizeVec3 << 1); + var _g10 = 0; + var _g18 = _this45.sizeVec3; + while(_g10 < _g18) { + var i9 = _g10++; + newArray7[i9] = _this45.stackVec3[i9]; + _this45.stackVec3[i9] = null; } - _this60.stackVec3 = newArray7; + _this45.stackVec3 = newArray7; } - _this60.stackVec3[_this60.sizeVec3++] = bottom4; + _this45.stackVec3[_this45.sizeVec3++] = _this37; } } else { - var _g25 = 0; - while(_g25 < 8) { - var i10 = _g25++; - var _this61 = this.tmpCircleNorms[i10]; + var _g41 = 0; + while(_g41 < 8) { + var i10 = _g41++; + var _this46 = this.tmpCircleNorms[i10]; var v5 = this.circleCoords[i10]; - _this61.x = v5.x; - _this61.y = v5.y; - _this61.z = v5.z; - var _this62 = _this61; - var tx25 = _this62.x * m.e00 + _this62.y * m.e01 + _this62.z * m.e02; - var ty25 = _this62.x * m.e10 + _this62.y * m.e11 + _this62.z * m.e12; - var tz25 = _this62.x * m.e20 + _this62.y * m.e21 + _this62.z * m.e22; - _this62.x = tx25; - _this62.y = ty25; - _this62.z = tz25; - var _this63 = this.tmpCircleVerts1[i10]; + _this46.x = v5.x; + _this46.y = v5.y; + _this46.z = v5.z; + var y1 = _this46.x * m.e10 + _this46.y * m.e11 + _this46.z * m.e12; + var z1 = _this46.x * m.e20 + _this46.y * m.e21 + _this46.z * m.e22; + _this46.x = _this46.x * m.e00 + _this46.y * m.e01 + _this46.z * m.e02; + _this46.y = y1; + _this46.z = z1; + var _this47 = this.tmpCircleVerts1[i10]; var v6 = this.tmpCircleNorms[i10]; - _this63.x = v6.x; - _this63.y = v6.y; - _this63.z = v6.z; - var _this64 = _this63; - var tx26 = _this64.x * radius; - var ty26 = _this64.y * radius; - var tz26 = _this64.z * radius; - _this64.x = tx26; - _this64.y = ty26; - _this64.z = tz26; - var _this65 = _this64; - var tx27 = _this65.x + o.x; - var ty27 = _this65.y + o.y; - var tz27 = _this65.z + o.z; - _this65.x = tx27; - _this65.y = ty27; - _this65.z = tz27; - var _this66 = this.tmpCircleVerts2[i10]; + _this47.x = v6.x; + _this47.y = v6.y; + _this47.z = v6.z; + _this47.x *= radius; + _this47.y *= radius; + _this47.z *= radius; + _this47.x += o.x; + _this47.y += o.y; + _this47.z += o.z; + var _this48 = this.tmpCircleVerts2[i10]; var v7 = this.tmpCircleVerts1[i10]; - _this66.x = v7.x; - _this66.y = v7.y; - _this66.z = v7.z; - var _this67 = this.tmpCircleVerts1[i10]; - var tx28 = _this67.x + ey.x * halfHeight; - var ty28 = _this67.y + ey.y * halfHeight; - var tz28 = _this67.z + ey.z * halfHeight; - _this67.x = tx28; - _this67.y = ty28; - _this67.z = tz28; - var _this68 = this.tmpCircleVerts2[i10]; + _this48.x = v7.x; + _this48.y = v7.y; + _this48.z = v7.z; + var _this49 = this.tmpCircleVerts1[i10]; + _this49.x += ey.x * halfHeight; + _this49.y += ey.y * halfHeight; + _this49.z += ey.z * halfHeight; + var _this50 = this.tmpCircleVerts2[i10]; var s6 = -halfHeight; - var tx29 = _this68.x + ey.x * s6; - var ty29 = _this68.y + ey.y * s6; - var tz29 = _this68.z + ey.z * s6; - _this68.x = tx29; - _this68.y = ty29; - _this68.z = tz29; - } - var _g26 = 0; - while(_g26 < 8) { - var i11 = _g26++; - var v12 = this.tmpCircleVerts1[i11]; - var v22 = this.tmpCircleVerts2[i11]; - var v32 = this.tmpCircleVerts2[(i11 + 1) % 8]; - var v41 = this.tmpCircleVerts1[(i11 + 1) % 8]; + _this50.x += ey.x * s6; + _this50.y += ey.y * s6; + _this50.z += ey.z * s6; + } + var _g51 = 0; + while(_g51 < 8) { + var i11 = _g51++; var n12 = this.tmpCircleNorms[i11]; var n22 = this.tmpCircleNorms[(i11 + 1) % 8]; - this.rect(v12,v22,v32,v41,n12,n12,n22,n22,color); - } - } - var _this69 = this.p; - if(top != null) { - top.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength8 = _this69.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g111 = 0; - var _g27 = _this69.sizeVec3; - while(_g111 < _g27) { - var i12 = _g111++; - newArray8[i12] = _this69.stackVec3[i12]; - _this69.stackVec3[i12] = null; - } - _this69.stackVec3 = newArray8; - } - _this69.stackVec3[_this69.sizeVec3++] = top; - } - var _this70 = this.p; - if(bottom != null) { - bottom.zero(); - if(_this70.sizeVec3 == _this70.stackVec3.length) { - var newLength9 = _this70.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g112 = 0; - var _g28 = _this70.sizeVec3; - while(_g112 < _g28) { - var i13 = _g112++; - newArray9[i13] = _this70.stackVec3[i13]; - _this70.stackVec3[i13] = null; - } - _this70.stackVec3 = newArray9; - } - _this70.stackVec3[_this70.sizeVec3++] = bottom; - } - var _this71 = this.p; + this.rect(this.tmpCircleVerts1[i11],this.tmpCircleVerts2[i11],this.tmpCircleVerts2[(i11 + 1) % 8],this.tmpCircleVerts1[(i11 + 1) % 8],n12,n12,n22,n22,color); + } + } + var _this51 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray8 = new Array(_this51.sizeVec3 << 1); + var _g19 = 0; + var _g110 = _this51.sizeVec3; + while(_g19 < _g110) { + var i12 = _g19++; + newArray8[i12] = _this51.stackVec3[i12]; + _this51.stackVec3[i12] = null; + } + _this51.stackVec3 = newArray8; + } + _this51.stackVec3[_this51.sizeVec3++] = _this10; + } + var _this52 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray9 = new Array(_this52.sizeVec3 << 1); + var _g20 = 0; + var _g111 = _this52.sizeVec3; + while(_g20 < _g111) { + var i13 = _g20++; + newArray9[i13] = _this52.stackVec3[i13]; + _this52.stackVec3[i13] = null; + } + _this52.stackVec3 = newArray9; + } + _this52.stackVec3[_this52.sizeVec3++] = _this13; + } + var _this53 = this.p; if(o != null) { o.zero(); - if(_this71.sizeVec3 == _this71.stackVec3.length) { - var newLength10 = _this71.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g113 = 0; - var _g29 = _this71.sizeVec3; - while(_g113 < _g29) { - var i14 = _g113++; - newArray10[i14] = _this71.stackVec3[i14]; - _this71.stackVec3[i14] = null; - } - _this71.stackVec3 = newArray10; - } - _this71.stackVec3[_this71.sizeVec3++] = o; - } - var _this72 = this.p; + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray10 = new Array(_this53.sizeVec3 << 1); + var _g26 = 0; + var _g112 = _this53.sizeVec3; + while(_g26 < _g112) { + var i14 = _g26++; + newArray10[i14] = _this53.stackVec3[i14]; + _this53.stackVec3[i14] = null; + } + _this53.stackVec3 = newArray10; + } + _this53.stackVec3[_this53.sizeVec3++] = o; + } + var _this54 = this.p; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this72.sizeMat3 == _this72.stackMat3.length) { - var newLength11 = _this72.sizeMat3 << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g114 = 0; - var _g30 = _this72.sizeMat3; - while(_g114 < _g30) { - var i15 = _g114++; - newArray11[i15] = _this72.stackMat3[i15]; - _this72.stackMat3[i15] = null; - } - _this72.stackMat3 = newArray11; - } - _this72.stackMat3[_this72.sizeMat3++] = m; - } - var _this73 = this.p; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this54.sizeMat3 == _this54.stackMat3.length) { + var newArray11 = new Array(_this54.sizeMat3 << 1); + var _g27 = 0; + var _g113 = _this54.sizeMat3; + while(_g27 < _g113) { + var i15 = _g27++; + newArray11[i15] = _this54.stackMat3[i15]; + _this54.stackMat3[i15] = null; + } + _this54.stackMat3 = newArray11; + } + _this54.stackMat3[_this54.sizeMat3++] = m; + } + var _this55 = this.p; if(ex != null) { ex.zero(); - if(_this73.sizeVec3 == _this73.stackVec3.length) { - var newLength12 = _this73.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g115 = 0; - var _g34 = _this73.sizeVec3; - while(_g115 < _g34) { - var i16 = _g115++; - newArray12[i16] = _this73.stackVec3[i16]; - _this73.stackVec3[i16] = null; - } - _this73.stackVec3 = newArray12; - } - _this73.stackVec3[_this73.sizeVec3++] = ex; - } - var _this74 = this.p; + if(_this55.sizeVec3 == _this55.stackVec3.length) { + var newArray12 = new Array(_this55.sizeVec3 << 1); + var _g28 = 0; + var _g114 = _this55.sizeVec3; + while(_g28 < _g114) { + var i16 = _g28++; + newArray12[i16] = _this55.stackVec3[i16]; + _this55.stackVec3[i16] = null; + } + _this55.stackVec3 = newArray12; + } + _this55.stackVec3[_this55.sizeVec3++] = ex; + } + var _this56 = this.p; if(ey != null) { ey.zero(); - if(_this74.sizeVec3 == _this74.stackVec3.length) { - var newLength13 = _this74.sizeVec3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g116 = 0; - var _g35 = _this74.sizeVec3; - while(_g116 < _g35) { - var i17 = _g116++; - newArray13[i17] = _this74.stackVec3[i17]; - _this74.stackVec3[i17] = null; - } - _this74.stackVec3 = newArray13; - } - _this74.stackVec3[_this74.sizeVec3++] = ey; - } - var _this75 = this.p; + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newArray13 = new Array(_this56.sizeVec3 << 1); + var _g29 = 0; + var _g115 = _this56.sizeVec3; + while(_g29 < _g115) { + var i17 = _g29++; + newArray13[i17] = _this56.stackVec3[i17]; + _this56.stackVec3[i17] = null; + } + _this56.stackVec3 = newArray13; + } + _this56.stackVec3[_this56.sizeVec3++] = ey; + } + var _this57 = this.p; if(ez != null) { ez.zero(); - if(_this75.sizeVec3 == _this75.stackVec3.length) { - var newLength14 = _this75.sizeVec3 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g117 = 0; - var _g36 = _this75.sizeVec3; - while(_g117 < _g36) { - var i18 = _g117++; - newArray14[i18] = _this75.stackVec3[i18]; - _this75.stackVec3[i18] = null; + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newArray14 = new Array(_this57.sizeVec3 << 1); + var _g30 = 0; + var _g116 = _this57.sizeVec3; + while(_g30 < _g116) { + var i18 = _g30++; + newArray14[i18] = _this57.stackVec3[i18]; + _this57.stackVec3[i18] = null; } - _this75.stackVec3 = newArray14; + _this57.stackVec3 = newArray14; } - _this75.stackVec3[_this75.sizeVec3++] = ez; + _this57.stackVec3[_this57.sizeVec3++] = ez; } } ,sphere: function(tf,radius,color) { @@ -22883,60 +20792,44 @@ oimo_dynamics_common_DebugDraw.prototype = { m1.e20 = tf._rotation20; m1.e21 = tf._rotation21; m1.e22 = tf._rotation22; - var nt = 4; - var np = 8; var vs = this.tmpSphereVerts; var ns = this.tmpSphereNorms; - var _g1 = 0; - var _g = nt + 1; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < 5) { + var i = _g++; var n = this.tmpSphereVerts[i].length; - var _g3 = 0; - var _g2 = n; - while(_g3 < _g2) { - var j = _g3++; + var _g1 = 0; + while(_g1 < n) { + var j = _g1++; var _this2 = ns[i][j]; var v1 = this.sphereCoords[i][j]; _this2.x = v1.x; _this2.y = v1.y; _this2.z = v1.z; - var _this3 = _this2; - var tx = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; - var ty = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; - var tz = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; - _this3.x = tx; - _this3.y = ty; - _this3.z = tz; - var _this4 = vs[i][j]; + var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; + var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; + _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; + _this2.y = y; + _this2.z = z; + var _this3 = vs[i][j]; var v2 = ns[i][j]; - _this4.x = v2.x; - _this4.y = v2.y; - _this4.z = v2.z; - var _this5 = _this4; - var tx1 = _this5.x * radius; - var ty1 = _this5.y * radius; - var tz1 = _this5.z * radius; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var _this6 = _this5; - var tx2 = _this6.x + o.x; - var ty2 = _this6.y + o.y; - var tz2 = _this6.z + o.z; - _this6.x = tx2; - _this6.y = ty2; - _this6.z = tz2; - } - } - var _g11 = 0; - var _g4 = nt; - while(_g11 < _g4) { - var i1 = _g11++; - var _g31 = 0; - var _g21 = np; - while(_g31 < _g21) { - var j1 = _g31++; + _this3.x = v2.x; + _this3.y = v2.y; + _this3.z = v2.z; + _this3.x *= radius; + _this3.y *= radius; + _this3.z *= radius; + _this3.x += o.x; + _this3.y += o.y; + _this3.z += o.z; + } + } + var _g2 = 0; + while(_g2 < 4) { + var i1 = _g2++; + var _g21 = 0; + while(_g21 < 8) { + var j1 = _g21++; var v11; var v21; var v3; @@ -22949,103 +20842,83 @@ oimo_dynamics_common_DebugDraw.prototype = { if(this.wireframe) { v11 = vs[0][0]; v21 = vs[1][j1]; - this.line(v11,v21,color); } else { v11 = vs[0][0]; v21 = vs[1][j1]; - v3 = vs[1][(j1 + 1) % np]; + v3 = vs[1][(j1 + 1) % 8]; n1 = ns[0][0]; n2 = ns[1][j1]; - n3 = ns[1][(j1 + 1) % np]; - this.triangle(v11,v21,v3,n1,n2,n3,color); + n3 = ns[1][(j1 + 1) % 8]; } - } else if(i1 == nt - 1) { + } else if(i1 == 3) { if(this.wireframe) { - v11 = vs[nt][0]; - v21 = vs[i1][(j1 + 1) % np]; + v11 = vs[4][0]; + v21 = vs[i1][(j1 + 1) % 8]; v3 = vs[i1][j1]; - this.line(v11,v21,color); - this.line(v21,v3,color); } else { - v11 = vs[nt][0]; - v21 = vs[i1][(j1 + 1) % np]; + v11 = vs[4][0]; + v21 = vs[i1][(j1 + 1) % 8]; v3 = vs[i1][j1]; - n1 = ns[nt][0]; - n2 = ns[i1][(j1 + 1) % np]; + n1 = ns[4][0]; + n2 = ns[i1][(j1 + 1) % 8]; n3 = ns[i1][j1]; - this.triangle(v11,v21,v3,n1,n2,n3,color); } } else if(this.wireframe) { v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % np]; + v21 = vs[i1][(j1 + 1) % 8]; v3 = vs[i1 + 1][j1]; - this.line(v11,v21,color); - this.line(v11,v3,color); } else { v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % np]; + v21 = vs[i1][(j1 + 1) % 8]; v3 = vs[i1 + 1][j1]; - v4 = vs[i1 + 1][(j1 + 1) % np]; + v4 = vs[i1 + 1][(j1 + 1) % 8]; n1 = ns[i1][j1]; - n2 = ns[i1][(j1 + 1) % np]; + n2 = ns[i1][(j1 + 1) % 8]; n3 = ns[i1 + 1][j1]; - n4 = ns[i1 + 1][(j1 + 1) % np]; + n4 = ns[i1 + 1][(j1 + 1) % 8]; this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); } } } - var _this7 = this.p; + var _this4 = this.p; if(o != null) { o.zero(); - if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newLength = _this7.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g12 = 0; - var _g5 = _this7.sizeVec3; - while(_g12 < _g5) { - var i2 = _g12++; - newArray[i2] = _this7.stackVec3[i2]; - _this7.stackVec3[i2] = null; + if(_this4.sizeVec3 == _this4.stackVec3.length) { + var newArray = new Array(_this4.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this4.sizeVec3; + while(_g3 < _g11) { + var i2 = _g3++; + newArray[i2] = _this4.stackVec3[i2]; + _this4.stackVec3[i2] = null; } - _this7.stackVec3 = newArray; + _this4.stackVec3 = newArray; } - _this7.stackVec3[_this7.sizeVec3++] = o; + _this4.stackVec3[_this4.sizeVec3++] = o; } - var _this8 = this.p; + var _this5 = this.p; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this8.sizeMat3 == _this8.stackMat3.length) { - var newLength1 = _this8.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g13 = 0; - var _g6 = _this8.sizeMat3; - while(_g13 < _g6) { - var i3 = _g13++; - newArray1[i3] = _this8.stackMat3[i3]; - _this8.stackMat3[i3] = null; - } - _this8.stackMat3 = newArray1; - } - _this8.stackMat3[_this8.sizeMat3++] = m; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this5.sizeMat3 == _this5.stackMat3.length) { + var newArray1 = new Array(_this5.sizeMat3 << 1); + var _g4 = 0; + var _g12 = _this5.sizeMat3; + while(_g4 < _g12) { + var i3 = _g4++; + newArray1[i3] = _this5.stackMat3[i3]; + _this5.stackMat3[i3] = null; + } + _this5.stackMat3 = newArray1; + } + _this5.stackMat3[_this5.sizeMat3++] = m; } } ,box: function(tf,halfExtents,color) { @@ -23086,596 +20959,432 @@ oimo_dynamics_common_DebugDraw.prototype = { _this6.z = o.z; var _this7 = _this6; var s = -hx; - var tx = _this7.x + ex.x * s; - var ty = _this7.y + ex.y * s; - var tz = _this7.z + ex.z * s; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var _this8 = _this7; + _this7.x += ex.x * s; + _this7.y += ex.y * s; + _this7.z += ex.z * s; var s1 = -hy; - var tx1 = _this8.x + ey.x * s1; - var ty1 = _this8.y + ey.y * s1; - var tz1 = _this8.z + ey.z * s1; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; - var _this9 = _this8; + _this7.x += ey.x * s1; + _this7.y += ey.y * s1; + _this7.z += ey.z * s1; var s2 = -hz; - var tx2 = _this9.x + ez.x * s2; - var ty2 = _this9.y + ez.y * s2; - var tz2 = _this9.z + ez.z * s2; - _this9.x = tx2; - _this9.y = ty2; - _this9.z = tz2; - var v1 = _this9; - var _this10 = this.p; - var _this11 = _this10.sizeVec3 == 0 ? new oimo_common_Vec3() : _this10.stackVec3[--_this10.sizeVec3]; - _this11.x = o.x; - _this11.y = o.y; - _this11.z = o.z; - var _this12 = _this11; + _this7.x += ez.x * s2; + _this7.y += ez.y * s2; + _this7.z += ez.z * s2; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; var s3 = -hx; - var tx3 = _this12.x + ex.x * s3; - var ty3 = _this12.y + ex.y * s3; - var tz3 = _this12.z + ex.z * s3; - _this12.x = tx3; - _this12.y = ty3; - _this12.z = tz3; - var _this13 = _this12; + _this10.x += ex.x * s3; + _this10.y += ex.y * s3; + _this10.z += ex.z * s3; var s4 = -hy; - var tx4 = _this13.x + ey.x * s4; - var ty4 = _this13.y + ey.y * s4; - var tz4 = _this13.z + ey.z * s4; - _this13.x = tx4; - _this13.y = ty4; - _this13.z = tz4; - var _this14 = _this13; - var tx5 = _this14.x + ez.x * hz; - var ty5 = _this14.y + ez.y * hz; - var tz5 = _this14.z + ez.z * hz; - _this14.x = tx5; - _this14.y = ty5; - _this14.z = tz5; - var v2 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = o.x; - _this16.y = o.y; - _this16.z = o.z; - var _this17 = _this16; + _this10.x += ey.x * s4; + _this10.y += ey.y * s4; + _this10.z += ey.z * s4; + _this10.x += ez.x * hz; + _this10.y += ez.y * hz; + _this10.z += ez.z * hz; + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = o.x; + _this12.y = o.y; + _this12.z = o.z; + var _this13 = _this12; var s5 = -hx; - var tx6 = _this17.x + ex.x * s5; - var ty6 = _this17.y + ex.y * s5; - var tz6 = _this17.z + ex.z * s5; - _this17.x = tx6; - _this17.y = ty6; - _this17.z = tz6; - var _this18 = _this17; - var tx7 = _this18.x + ey.x * hy; - var ty7 = _this18.y + ey.y * hy; - var tz7 = _this18.z + ey.z * hy; - _this18.x = tx7; - _this18.y = ty7; - _this18.z = tz7; - var _this19 = _this18; + _this13.x += ex.x * s5; + _this13.y += ex.y * s5; + _this13.z += ex.z * s5; + _this13.x += ey.x * hy; + _this13.y += ey.y * hy; + _this13.z += ey.z * hy; var s6 = -hz; - var tx8 = _this19.x + ez.x * s6; - var ty8 = _this19.y + ez.y * s6; - var tz8 = _this19.z + ez.z * s6; - _this19.x = tx8; - _this19.y = ty8; - _this19.z = tz8; - var v3 = _this19; + _this13.x += ez.x * s6; + _this13.y += ez.y * s6; + _this13.z += ez.z * s6; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = o.x; + _this15.y = o.y; + _this15.z = o.z; + var _this16 = _this15; + var s7 = -hx; + _this16.x += ex.x * s7; + _this16.y += ex.y * s7; + _this16.z += ex.z * s7; + _this16.x += ey.x * hy; + _this16.y += ey.y * hy; + _this16.z += ey.z * hy; + _this16.x += ez.x * hz; + _this16.y += ez.y * hz; + _this16.z += ez.z * hz; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = o.x; + _this18.y = o.y; + _this18.z = o.z; + var _this19 = _this18; + _this19.x += ex.x * hx; + _this19.y += ex.y * hx; + _this19.z += ex.z * hx; + var s8 = -hy; + _this19.x += ey.x * s8; + _this19.y += ey.y * s8; + _this19.z += ey.z * s8; + var s9 = -hz; + _this19.x += ez.x * s9; + _this19.y += ez.y * s9; + _this19.z += ez.z * s9; var _this20 = this.p; var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; _this21.x = o.x; _this21.y = o.y; _this21.z = o.z; var _this22 = _this21; - var s7 = -hx; - var tx9 = _this22.x + ex.x * s7; - var ty9 = _this22.y + ex.y * s7; - var tz9 = _this22.z + ex.z * s7; - _this22.x = tx9; - _this22.y = ty9; - _this22.z = tz9; - var _this23 = _this22; - var tx10 = _this23.x + ey.x * hy; - var ty10 = _this23.y + ey.y * hy; - var tz10 = _this23.z + ey.z * hy; - _this23.x = tx10; - _this23.y = ty10; - _this23.z = tz10; - var _this24 = _this23; - var tx11 = _this24.x + ez.x * hz; - var ty11 = _this24.y + ez.y * hz; - var tz11 = _this24.z + ez.z * hz; - _this24.x = tx11; - _this24.y = ty11; - _this24.z = tz11; - var v4 = _this24; - var _this25 = this.p; - var _this26 = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - _this26.x = o.x; - _this26.y = o.y; - _this26.z = o.z; - var _this27 = _this26; - var tx12 = _this27.x + ex.x * hx; - var ty12 = _this27.y + ex.y * hx; - var tz12 = _this27.z + ex.z * hx; - _this27.x = tx12; - _this27.y = ty12; - _this27.z = tz12; - var _this28 = _this27; - var s8 = -hy; - var tx13 = _this28.x + ey.x * s8; - var ty13 = _this28.y + ey.y * s8; - var tz13 = _this28.z + ey.z * s8; - _this28.x = tx13; - _this28.y = ty13; - _this28.z = tz13; - var _this29 = _this28; - var s9 = -hz; - var tx14 = _this29.x + ez.x * s9; - var ty14 = _this29.y + ez.y * s9; - var tz14 = _this29.z + ez.z * s9; - _this29.x = tx14; - _this29.y = ty14; - _this29.z = tz14; - var v5 = _this29; - var _this30 = this.p; - var _this31 = _this30.sizeVec3 == 0 ? new oimo_common_Vec3() : _this30.stackVec3[--_this30.sizeVec3]; - _this31.x = o.x; - _this31.y = o.y; - _this31.z = o.z; - var _this32 = _this31; - var tx15 = _this32.x + ex.x * hx; - var ty15 = _this32.y + ex.y * hx; - var tz15 = _this32.z + ex.z * hx; - _this32.x = tx15; - _this32.y = ty15; - _this32.z = tz15; - var _this33 = _this32; + _this22.x += ex.x * hx; + _this22.y += ex.y * hx; + _this22.z += ex.z * hx; var s10 = -hy; - var tx16 = _this33.x + ey.x * s10; - var ty16 = _this33.y + ey.y * s10; - var tz16 = _this33.z + ey.z * s10; - _this33.x = tx16; - _this33.y = ty16; - _this33.z = tz16; - var _this34 = _this33; - var tx17 = _this34.x + ez.x * hz; - var ty17 = _this34.y + ez.y * hz; - var tz17 = _this34.z + ez.z * hz; - _this34.x = tx17; - _this34.y = ty17; - _this34.z = tz17; - var v6 = _this34; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = o.x; - _this36.y = o.y; - _this36.z = o.z; - var _this37 = _this36; - var tx18 = _this37.x + ex.x * hx; - var ty18 = _this37.y + ex.y * hx; - var tz18 = _this37.z + ex.z * hx; - _this37.x = tx18; - _this37.y = ty18; - _this37.z = tz18; - var _this38 = _this37; - var tx19 = _this38.x + ey.x * hy; - var ty19 = _this38.y + ey.y * hy; - var tz19 = _this38.z + ey.z * hy; - _this38.x = tx19; - _this38.y = ty19; - _this38.z = tz19; - var _this39 = _this38; + _this22.x += ey.x * s10; + _this22.y += ey.y * s10; + _this22.z += ey.z * s10; + _this22.x += ez.x * hz; + _this22.y += ez.y * hz; + _this22.z += ez.z * hz; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = o.x; + _this24.y = o.y; + _this24.z = o.z; + var _this25 = _this24; + _this25.x += ex.x * hx; + _this25.y += ex.y * hx; + _this25.z += ex.z * hx; + _this25.x += ey.x * hy; + _this25.y += ey.y * hy; + _this25.z += ey.z * hy; var s11 = -hz; - var tx20 = _this39.x + ez.x * s11; - var ty20 = _this39.y + ez.y * s11; - var tz20 = _this39.z + ez.z * s11; - _this39.x = tx20; - _this39.y = ty20; - _this39.z = tz20; - var v7 = _this39; - var _this40 = this.p; - var _this41 = _this40.sizeVec3 == 0 ? new oimo_common_Vec3() : _this40.stackVec3[--_this40.sizeVec3]; - _this41.x = o.x; - _this41.y = o.y; - _this41.z = o.z; - var _this42 = _this41; - var tx21 = _this42.x + ex.x * hx; - var ty21 = _this42.y + ex.y * hx; - var tz21 = _this42.z + ex.z * hx; - _this42.x = tx21; - _this42.y = ty21; - _this42.z = tz21; - var _this43 = _this42; - var tx22 = _this43.x + ey.x * hy; - var ty22 = _this43.y + ey.y * hy; - var tz22 = _this43.z + ey.z * hy; - _this43.x = tx22; - _this43.y = ty22; - _this43.z = tz22; - var _this44 = _this43; - var tx23 = _this44.x + ez.x * hz; - var ty23 = _this44.y + ez.y * hz; - var tz23 = _this44.z + ez.z * hz; - _this44.x = tx23; - _this44.y = ty23; - _this44.z = tz23; - var v8 = _this44; - if(this.wireframe) { - this.line(v1,v2,color); - this.line(v3,v4,color); - this.line(v5,v6,color); - this.line(v7,v8,color); - this.line(v1,v3,color); - this.line(v2,v4,color); - this.line(v5,v7,color); - this.line(v6,v8,color); - this.line(v1,v5,color); - this.line(v2,v6,color); - this.line(v3,v7,color); - this.line(v4,v8,color); - } else { - var _this45 = this.p; - var _this46 = _this45.sizeVec3 == 0 ? new oimo_common_Vec3() : _this45.stackVec3[--_this45.sizeVec3]; - _this46.x = ex.x; - _this46.y = ex.y; - _this46.z = ex.z; - var _this47 = _this46; - var tx24 = -_this47.x; - var ty24 = -_this47.y; - var tz24 = -_this47.z; - _this47.x = tx24; - _this47.y = ty24; - _this47.z = tz24; - var nex = _this47; - var _this48 = this.p; - var _this49 = _this48.sizeVec3 == 0 ? new oimo_common_Vec3() : _this48.stackVec3[--_this48.sizeVec3]; - _this49.x = ey.x; - _this49.y = ey.y; - _this49.z = ey.z; - var _this50 = _this49; - var tx25 = -_this50.x; - var ty25 = -_this50.y; - var tz25 = -_this50.z; - _this50.x = tx25; - _this50.y = ty25; - _this50.z = tz25; - var ney = _this50; - var _this51 = this.p; - var _this52 = _this51.sizeVec3 == 0 ? new oimo_common_Vec3() : _this51.stackVec3[--_this51.sizeVec3]; - _this52.x = ez.x; - _this52.y = ez.y; - _this52.z = ez.z; - var _this53 = _this52; - var tx26 = -_this53.x; - var ty26 = -_this53.y; - var tz26 = -_this53.z; - _this53.x = tx26; - _this53.y = ty26; - _this53.z = tz26; - var nez = _this53; - this.rect(v1,v2,v4,v3,nex,nex,nex,nex,color); - this.rect(v5,v7,v8,v6,ex,ex,ex,ex,color); - this.rect(v1,v5,v6,v2,ney,ney,ney,ney,color); - this.rect(v3,v4,v8,v7,ey,ey,ey,ey,color); - this.rect(v1,v3,v7,v5,nez,nez,nez,nez,color); - this.rect(v2,v6,v8,v4,ez,ez,ez,ez,color); - var _this54 = this.p; - if(nex != null) { - nex.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newLength = _this54.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g1 = 0; - var _g = _this54.sizeVec3; - while(_g1 < _g) { - var i = _g1++; - newArray[i] = _this54.stackVec3[i]; - _this54.stackVec3[i] = null; - } - _this54.stackVec3 = newArray; - } - _this54.stackVec3[_this54.sizeVec3++] = nex; - } - var _this55 = this.p; - if(ney != null) { - ney.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newLength1 = _this55.sizeVec3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g11 = 0; - var _g2 = _this55.sizeVec3; - while(_g11 < _g2) { - var i1 = _g11++; - newArray1[i1] = _this55.stackVec3[i1]; - _this55.stackVec3[i1] = null; - } - _this55.stackVec3 = newArray1; - } - _this55.stackVec3[_this55.sizeVec3++] = ney; - } - var _this56 = this.p; - if(nez != null) { - nez.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newLength2 = _this56.sizeVec3 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g12 = 0; - var _g3 = _this56.sizeVec3; - while(_g12 < _g3) { - var i2 = _g12++; - newArray2[i2] = _this56.stackVec3[i2]; - _this56.stackVec3[i2] = null; + _this25.x += ez.x * s11; + _this25.y += ez.y * s11; + _this25.z += ez.z * s11; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = o.x; + _this27.y = o.y; + _this27.z = o.z; + var _this28 = _this27; + _this28.x += ex.x * hx; + _this28.y += ex.y * hx; + _this28.z += ex.z * hx; + _this28.x += ey.x * hy; + _this28.y += ey.y * hy; + _this28.z += ey.z * hy; + _this28.x += ez.x * hz; + _this28.y += ez.y * hz; + _this28.z += ez.z * hz; + if(!this.wireframe) { + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = ex.x; + _this30.y = ex.y; + _this30.z = ex.z; + var _this31 = _this30; + _this31.x = -_this31.x; + _this31.y = -_this31.y; + _this31.z = -_this31.z; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = ey.x; + _this33.y = ey.y; + _this33.z = ey.z; + var _this34 = _this33; + _this34.x = -_this34.x; + _this34.y = -_this34.y; + _this34.z = -_this34.z; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = ez.x; + _this36.y = ez.y; + _this36.z = ez.z; + var _this37 = _this36; + _this37.x = -_this37.x; + _this37.y = -_this37.y; + _this37.z = -_this37.z; + this.rect(_this7,_this10,_this16,_this13,_this31,_this31,_this31,_this31,color); + this.rect(_this19,_this25,_this28,_this22,ex,ex,ex,ex,color); + this.rect(_this7,_this19,_this22,_this10,_this34,_this34,_this34,_this34,color); + this.rect(_this13,_this16,_this28,_this25,ey,ey,ey,ey,color); + this.rect(_this7,_this13,_this25,_this19,_this37,_this37,_this37,_this37,color); + this.rect(_this10,_this22,_this28,_this16,ez,ez,ez,ez,color); + var _this38 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray = new Array(_this38.sizeVec3 << 1); + var _g = 0; + var _g1 = _this38.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this38.stackVec3[i]; + _this38.stackVec3[i] = null; } - _this56.stackVec3 = newArray2; + _this38.stackVec3 = newArray; } - _this56.stackVec3[_this56.sizeVec3++] = nez; + _this38.stackVec3[_this38.sizeVec3++] = _this31; } + var _this39 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray1 = new Array(_this39.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this39.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this39.stackVec3[i1]; + _this39.stackVec3[i1] = null; + } + _this39.stackVec3 = newArray1; + } + _this39.stackVec3[_this39.sizeVec3++] = _this34; + } + var _this40 = this.p; + if(_this37 != null) { + _this37.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray2 = new Array(_this40.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this40.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this40.stackVec3[i2]; + _this40.stackVec3[i2] = null; + } + _this40.stackVec3 = newArray2; + } + _this40.stackVec3[_this40.sizeVec3++] = _this37; + } + } + var _this41 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray3 = new Array(_this41.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this41.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this41.stackVec3[i3]; + _this41.stackVec3[i3] = null; + } + _this41.stackVec3 = newArray3; + } + _this41.stackVec3[_this41.sizeVec3++] = _this7; + } + var _this42 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray4 = new Array(_this42.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this42.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this42.stackVec3[i4]; + _this42.stackVec3[i4] = null; + } + _this42.stackVec3 = newArray4; + } + _this42.stackVec3[_this42.sizeVec3++] = _this10; + } + var _this43 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray5 = new Array(_this43.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this43.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this43.stackVec3[i5]; + _this43.stackVec3[i5] = null; + } + _this43.stackVec3 = newArray5; + } + _this43.stackVec3[_this43.sizeVec3++] = _this13; + } + var _this44 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray6 = new Array(_this44.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this44.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this44.stackVec3[i6]; + _this44.stackVec3[i6] = null; + } + _this44.stackVec3 = newArray6; + } + _this44.stackVec3[_this44.sizeVec3++] = _this16; + } + var _this45 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray7 = new Array(_this45.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this45.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this45.stackVec3[i7]; + _this45.stackVec3[i7] = null; + } + _this45.stackVec3 = newArray7; + } + _this45.stackVec3[_this45.sizeVec3++] = _this19; } - var _this57 = this.p; - if(v1 != null) { - v1.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newLength3 = _this57.sizeVec3 << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g13 = 0; - var _g4 = _this57.sizeVec3; - while(_g13 < _g4) { - var i3 = _g13++; - newArray3[i3] = _this57.stackVec3[i3]; - _this57.stackVec3[i3] = null; + var _this46 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newArray8 = new Array(_this46.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this46.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this46.stackVec3[i8]; + _this46.stackVec3[i8] = null; } - _this57.stackVec3 = newArray3; + _this46.stackVec3 = newArray8; } - _this57.stackVec3[_this57.sizeVec3++] = v1; + _this46.stackVec3[_this46.sizeVec3++] = _this22; } - var _this58 = this.p; - if(v2 != null) { - v2.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newLength4 = _this58.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g14 = 0; - var _g5 = _this58.sizeVec3; - while(_g14 < _g5) { - var i4 = _g14++; - newArray4[i4] = _this58.stackVec3[i4]; - _this58.stackVec3[i4] = null; + var _this47 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this47.sizeVec3 == _this47.stackVec3.length) { + var newArray9 = new Array(_this47.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this47.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this47.stackVec3[i9]; + _this47.stackVec3[i9] = null; } - _this58.stackVec3 = newArray4; + _this47.stackVec3 = newArray9; } - _this58.stackVec3[_this58.sizeVec3++] = v2; + _this47.stackVec3[_this47.sizeVec3++] = _this25; } - var _this59 = this.p; - if(v3 != null) { - v3.zero(); - if(_this59.sizeVec3 == _this59.stackVec3.length) { - var newLength5 = _this59.sizeVec3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g15 = 0; - var _g6 = _this59.sizeVec3; - while(_g15 < _g6) { - var i5 = _g15++; - newArray5[i5] = _this59.stackVec3[i5]; - _this59.stackVec3[i5] = null; - } - _this59.stackVec3 = newArray5; - } - _this59.stackVec3[_this59.sizeVec3++] = v3; - } - var _this60 = this.p; - if(v4 != null) { - v4.zero(); - if(_this60.sizeVec3 == _this60.stackVec3.length) { - var newLength6 = _this60.sizeVec3 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g16 = 0; - var _g7 = _this60.sizeVec3; - while(_g16 < _g7) { - var i6 = _g16++; - newArray6[i6] = _this60.stackVec3[i6]; - _this60.stackVec3[i6] = null; - } - _this60.stackVec3 = newArray6; - } - _this60.stackVec3[_this60.sizeVec3++] = v4; - } - var _this61 = this.p; - if(v5 != null) { - v5.zero(); - if(_this61.sizeVec3 == _this61.stackVec3.length) { - var newLength7 = _this61.sizeVec3 << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g17 = 0; - var _g8 = _this61.sizeVec3; - while(_g17 < _g8) { - var i7 = _g17++; - newArray7[i7] = _this61.stackVec3[i7]; - _this61.stackVec3[i7] = null; - } - _this61.stackVec3 = newArray7; - } - _this61.stackVec3[_this61.sizeVec3++] = v5; - } - var _this62 = this.p; - if(v6 != null) { - v6.zero(); - if(_this62.sizeVec3 == _this62.stackVec3.length) { - var newLength8 = _this62.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g18 = 0; - var _g9 = _this62.sizeVec3; - while(_g18 < _g9) { - var i8 = _g18++; - newArray8[i8] = _this62.stackVec3[i8]; - _this62.stackVec3[i8] = null; - } - _this62.stackVec3 = newArray8; - } - _this62.stackVec3[_this62.sizeVec3++] = v6; - } - var _this63 = this.p; - if(v7 != null) { - v7.zero(); - if(_this63.sizeVec3 == _this63.stackVec3.length) { - var newLength9 = _this63.sizeVec3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g19 = 0; - var _g10 = _this63.sizeVec3; - while(_g19 < _g10) { - var i9 = _g19++; - newArray9[i9] = _this63.stackVec3[i9]; - _this63.stackVec3[i9] = null; + var _this48 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this48.sizeVec3 == _this48.stackVec3.length) { + var newArray10 = new Array(_this48.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this48.sizeVec3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this48.stackVec3[i10]; + _this48.stackVec3[i10] = null; } - _this63.stackVec3 = newArray9; + _this48.stackVec3 = newArray10; } - _this63.stackVec3[_this63.sizeVec3++] = v7; + _this48.stackVec3[_this48.sizeVec3++] = _this28; } - var _this64 = this.p; - if(v8 != null) { - v8.zero(); - if(_this64.sizeVec3 == _this64.stackVec3.length) { - var newLength10 = _this64.sizeVec3 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g110 = 0; - var _g20 = _this64.sizeVec3; - while(_g110 < _g20) { - var i10 = _g110++; - newArray10[i10] = _this64.stackVec3[i10]; - _this64.stackVec3[i10] = null; - } - _this64.stackVec3 = newArray10; - } - _this64.stackVec3[_this64.sizeVec3++] = v8; - } - var _this65 = this.p; + var _this49 = this.p; if(o != null) { o.zero(); - if(_this65.sizeVec3 == _this65.stackVec3.length) { - var newLength11 = _this65.sizeVec3 << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g111 = 0; - var _g21 = _this65.sizeVec3; - while(_g111 < _g21) { - var i11 = _g111++; - newArray11[i11] = _this65.stackVec3[i11]; - _this65.stackVec3[i11] = null; - } - _this65.stackVec3 = newArray11; - } - _this65.stackVec3[_this65.sizeVec3++] = o; - } - var _this66 = this.p; + if(_this49.sizeVec3 == _this49.stackVec3.length) { + var newArray11 = new Array(_this49.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this49.sizeVec3; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this49.stackVec3[i11]; + _this49.stackVec3[i11] = null; + } + _this49.stackVec3 = newArray11; + } + _this49.stackVec3[_this49.sizeVec3++] = o; + } + var _this50 = this.p; if(m != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - if(_this66.sizeMat3 == _this66.stackMat3.length) { - var newLength12 = _this66.sizeMat3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g112 = 0; - var _g22 = _this66.sizeMat3; - while(_g112 < _g22) { - var i12 = _g112++; - newArray12[i12] = _this66.stackMat3[i12]; - _this66.stackMat3[i12] = null; - } - _this66.stackMat3 = newArray12; - } - _this66.stackMat3[_this66.sizeMat3++] = m; - } - var _this67 = this.p; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this50.sizeMat3 == _this50.stackMat3.length) { + var newArray12 = new Array(_this50.sizeMat3 << 1); + var _g22 = 0; + var _g112 = _this50.sizeMat3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this50.stackMat3[i12]; + _this50.stackMat3[i12] = null; + } + _this50.stackMat3 = newArray12; + } + _this50.stackMat3[_this50.sizeMat3++] = m; + } + var _this51 = this.p; if(ex != null) { ex.zero(); - if(_this67.sizeVec3 == _this67.stackVec3.length) { - var newLength13 = _this67.sizeVec3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g113 = 0; - var _g23 = _this67.sizeVec3; - while(_g113 < _g23) { - var i13 = _g113++; - newArray13[i13] = _this67.stackVec3[i13]; - _this67.stackVec3[i13] = null; - } - _this67.stackVec3 = newArray13; - } - _this67.stackVec3[_this67.sizeVec3++] = ex; - } - var _this68 = this.p; + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray13 = new Array(_this51.sizeVec3 << 1); + var _g23 = 0; + var _g113 = _this51.sizeVec3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this51.stackVec3[i13]; + _this51.stackVec3[i13] = null; + } + _this51.stackVec3 = newArray13; + } + _this51.stackVec3[_this51.sizeVec3++] = ex; + } + var _this52 = this.p; if(ey != null) { ey.zero(); - if(_this68.sizeVec3 == _this68.stackVec3.length) { - var newLength14 = _this68.sizeVec3 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g114 = 0; - var _g24 = _this68.sizeVec3; - while(_g114 < _g24) { - var i14 = _g114++; - newArray14[i14] = _this68.stackVec3[i14]; - _this68.stackVec3[i14] = null; - } - _this68.stackVec3 = newArray14; - } - _this68.stackVec3[_this68.sizeVec3++] = ey; - } - var _this69 = this.p; + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray14 = new Array(_this52.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this52.sizeVec3; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this52.stackVec3[i14]; + _this52.stackVec3[i14] = null; + } + _this52.stackVec3 = newArray14; + } + _this52.stackVec3[_this52.sizeVec3++] = ey; + } + var _this53 = this.p; if(ez != null) { ez.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength15 = _this69.sizeVec3 << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g115 = 0; - var _g25 = _this69.sizeVec3; - while(_g115 < _g25) { - var i15 = _g115++; - newArray15[i15] = _this69.stackVec3[i15]; - _this69.stackVec3[i15] = null; + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray15 = new Array(_this53.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this53.sizeVec3; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this53.stackVec3[i15]; + _this53.stackVec3[i15] = null; } - _this69.stackVec3 = newArray15; + _this53.stackVec3 = newArray15; } - _this69.stackVec3[_this69.sizeVec3++] = ez; + _this53.stackVec3[_this53.sizeVec3++] = ez; } } ,rect: function(v1,v2,v3,v4,n1,n2,n3,n4,color) { - this.triangle(v1,v2,v3,n1,n2,n3,color); - this.triangle(v1,v3,v4,n1,n3,n4,color); } ,point: function(v,color) { } @@ -23749,15 +21458,12 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { _getVelocitySolverInfo: function(timeStep,info) { info.b1 = this._b1; info.b2 = this._b2; - var normal; var normalX; var normalY; var normalZ; - var tangent; var tangentX; var tangentY; var tangentZ; - var binormal; var binormalX; var binormalY; var binormalZ; @@ -23774,18 +21480,9 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { var restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); var num = this._manifold._numPoints; info.numRows = 0; - var posDiff; - var posDiffX; - var posDiffY; - var posDiffZ; - posDiffX = this._tf1._positionX - this._tf2._positionX; - posDiffY = this._tf1._positionY - this._tf2._positionY; - posDiffZ = this._tf1._positionZ - this._tf2._positionZ; - var _g1 = 0; - var _g = num; - while(_g1 < _g) { - var i = _g1++; - var p = this._manifold._points[i]; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; if(p._depth < 0) { p._disabled = true; var _this = p._impulse; @@ -23873,7 +21570,6 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { ,_getPositionSolverInfo: function(info) { info.b1 = this._b1; info.b2 = this._b2; - var normal; var normalX; var normalY; var normalZ; @@ -23882,11 +21578,9 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { normalZ = this._manifold._normalZ; var num = this._manifold._numPoints; info.numRows = 0; - var _g1 = 0; - var _g = num; - while(_g1 < _g) { - var i = _g1++; - var p = this._manifold._points[i]; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; if(p._disabled) { continue; } @@ -23924,13 +21618,10 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { return this._manifold; } ,isTouching: function() { - var _g1 = 0; - var _g = this._manifold._numPoints; - while(_g1 < _g) { - var i = _g1++; - if(this._manifold._points[i]._depth >= 0) { - return true; - } + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) if(this._manifold._points[_g++]._depth >= 0) { + return true; } return false; } @@ -23965,23 +21656,17 @@ var oimo_dynamics_constraint_contact_Manifold = function() { this._binormalY = 0; this._binormalZ = 0; this._numPoints = 0; - var length = oimo_common_Setting.maxManifoldPoints; - var this1 = new Array(length); - this._points = this1; - var _g1 = 0; - var _g = oimo_common_Setting.maxManifoldPoints; - while(_g1 < _g) { - var i = _g1++; - this._points[i] = new oimo_dynamics_constraint_contact_ManifoldPoint(); - } + this._points = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this._points[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); }; oimo_dynamics_constraint_contact_Manifold.prototype = { _clear: function() { - var _g1 = 0; - var _g = this._numPoints; - while(_g1 < _g) { - var i = _g1++; - var _this = this._points[i]; + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var _this = this._points[_g++]; _this._localPos1X = 0; _this._localPos1Y = 0; _this._localPos1Z = 0; @@ -24016,10 +21701,9 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { this._numPoints = 0; } ,_buildBasis: function(normal) { - var v = normal; - this._normalX = v.x; - this._normalY = v.y; - this._normalZ = v.z; + this._normalX = normal.x; + this._normalY = normal.y; + this._normalZ = normal.z; var nx = normal.x; var ny = normal.y; var nz = normal.z; @@ -24075,11 +21759,10 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { this._binormalZ = bz; } ,_updateDepthsAndPositions: function(tf1,tf2) { - var _g1 = 0; - var _g = this._numPoints; - while(_g1 < _g) { - var i = _g1++; - var p = this._points[i]; + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var p = this._points[_g++]; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -24104,58 +21787,50 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { p._pos2X = p._relPos2X + tf2._positionX; p._pos2Y = p._relPos2Y + tf2._positionY; p._pos2Z = p._relPos2Z + tf2._positionZ; - var diff; var diffX; var diffY; var diffZ; diffX = p._pos1X - p._pos2X; diffY = p._pos1Y - p._pos2Y; diffZ = p._pos1Z - p._pos2Z; - var dotN = diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ; - p._depth = -dotN; + p._depth = -(diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ); } } ,getNormal: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._normalX; - v1.y = this._normalY; - v1.z = this._normalZ; - return v; - } - ,getNormalTo: function(normal) { - var v = normal; v.x = this._normalX; v.y = this._normalY; v.z = this._normalZ; + return v; + } + ,getNormalTo: function(normal) { + normal.x = this._normalX; + normal.y = this._normalY; + normal.z = this._normalZ; } ,getTangent: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._tangentX; - v1.y = this._tangentY; - v1.z = this._tangentZ; - return v; - } - ,getTangentTo: function(tangent) { - var v = tangent; v.x = this._tangentX; v.y = this._tangentY; v.z = this._tangentZ; + return v; + } + ,getTangentTo: function(tangent) { + tangent.x = this._tangentX; + tangent.y = this._tangentY; + tangent.z = this._tangentZ; } ,getBinormal: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._binormalX; - v1.y = this._binormalY; - v1.z = this._binormalZ; - return v; - } - ,getBinormalTo: function(binormal) { - var v = binormal; v.x = this._binormalX; v.y = this._binormalY; v.z = this._binormalZ; + return v; + } + ,getBinormalTo: function(binormal) { + binormal.x = this._binormalX; + binormal.y = this._binormalY; + binormal.z = this._binormalZ; } ,getPoints: function() { return this._points; @@ -24192,31 +21867,27 @@ var oimo_dynamics_constraint_contact_ManifoldPoint = function() { oimo_dynamics_constraint_contact_ManifoldPoint.prototype = { getPosition1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._pos1X; - v1.y = this._pos1Y; - v1.z = this._pos1Z; - return v; - } - ,getPosition1To: function(position) { - var v = position; v.x = this._pos1X; v.y = this._pos1Y; v.z = this._pos1Z; + return v; + } + ,getPosition1To: function(position) { + position.x = this._pos1X; + position.y = this._pos1Y; + position.z = this._pos1Z; } ,getPosition2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._pos2X; - v1.y = this._pos2Y; - v1.z = this._pos2Z; - return v; - } - ,getPosition2To: function(position) { - var v = position; v.x = this._pos2X; v.y = this._pos2Y; v.z = this._pos2Z; + return v; + } + ,getPosition2To: function(position) { + position.x = this._pos2X; + position.y = this._pos2Y; + position.z = this._pos2Z; } ,getDepth: function() { return this._depth; @@ -24240,23 +21911,16 @@ oimo_dynamics_constraint_contact_ManifoldPoint.prototype = { var oimo_dynamics_constraint_contact_ManifoldUpdater = function(manifold) { this._manifold = manifold; this.numOldPoints = 0; - var length = oimo_common_Setting.maxManifoldPoints; - var this1 = new Array(length); - this.oldPoints = this1; - var _g1 = 0; - var _g = oimo_common_Setting.maxManifoldPoints; - while(_g1 < _g) { - var i = _g1++; - this.oldPoints[i] = new oimo_dynamics_constraint_contact_ManifoldPoint(); - } + this.oldPoints = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.oldPoints[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); }; oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { removeOutdatedPoints: function() { - var num = this._manifold._numPoints; - var index = num; + var index = this._manifold._numPoints; while(--index >= 0) { var p = this._manifold._points[index]; - var diff; var diffX; var diffY; var diffZ; @@ -24319,8 +21983,7 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { ,addManifoldPoint: function(point,tf1,tf2) { var num = this._manifold._numPoints; if(num == oimo_common_Setting.maxManifoldPoints) { - var targetIndex = this.computeTargetIndex(point,tf1,tf2); - var _this = this._manifold._points[targetIndex]; + var _this = this._manifold._points[this.computeTargetIndex(point,tf1,tf2)]; var v = point.position1; _this._pos1X = v.x; _this._pos1Y = v.y; @@ -24433,7 +22096,6 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { maxDepth = p4._depth; maxDepthIndex = 3; } - var rp1; var rp1X; var rp1Y; var rp1Z; @@ -24453,27 +22115,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var p3X = p4._relPos1X; var p3Y = p4._relPos1Y; var p3Z = p4._relPos1Z; - var v12; var v12X; var v12Y; var v12Z; - var v34; var v34X; var v34Y; var v34Z; - var v13; var v13X; var v13Y; var v13Z; - var v24; var v24X; var v24Y; var v24Z; - var v14; var v14X; var v14Y; var v14Z; - var v23; var v23X; var v23Y; var v23Z; @@ -24495,15 +22151,12 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X = p3X - p2X; v23Y = p3Y - p2Y; v23Z = p3Z - p2Z; - var cross1; var cross1X; var cross1Y; var cross1Z; - var cross2; var cross2X; var cross2Y; var cross2Z; - var cross3; var cross3X; var cross3Y; var cross3Z; @@ -24519,7 +22172,6 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; - var a11 = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; var p1X1 = p1._relPos1X; var p1Y1 = p1._relPos1Y; var p1Z1 = p1._relPos1Z; @@ -24529,27 +22181,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var p3X1 = p4._relPos1X; var p3Y1 = p4._relPos1Y; var p3Z1 = p4._relPos1Z; - var v121; var v12X1; var v12Y1; var v12Z1; - var v341; var v34X1; var v34Y1; var v34Z1; - var v131; var v13X1; var v13Y1; var v13Z1; - var v241; var v24X1; var v24Y1; var v24Z1; - var v141; var v14X1; var v14Y1; var v14Z1; - var v231; var v23X1; var v23Y1; var v23Z1; @@ -24571,15 +22217,12 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X1 = p3X1 - p2X1; v23Y1 = p3Y1 - p2Y1; v23Z1 = p3Z1 - p2Z1; - var cross11; var cross1X1; var cross1Y1; var cross1Z1; - var cross21; var cross2X1; var cross2Y1; var cross2Z1; - var cross31; var cross3X1; var cross3Y1; var cross3Z1; @@ -24592,10 +22235,10 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; - var a12 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; + var a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; - var a22 = a12 > a21 ? a12 > a31 ? a12 : a31 : a21 > a31 ? a21 : a31; + var a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; var p1X2 = p1._relPos1X; var p1Y2 = p1._relPos1Y; var p1Z2 = p1._relPos1Z; @@ -24605,27 +22248,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var p3X2 = p4._relPos1X; var p3Y2 = p4._relPos1Y; var p3Z2 = p4._relPos1Z; - var v122; var v12X2; var v12Y2; var v12Z2; - var v342; var v34X2; var v34Y2; var v34Z2; - var v132; var v13X2; var v13Y2; var v13Z2; - var v242; var v24X2; var v24Y2; var v24Z2; - var v142; var v14X2; var v14Y2; var v14Z2; - var v232; var v23X2; var v23Y2; var v23Z2; @@ -24647,15 +22284,12 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X2 = p3X2 - p2X2; v23Y2 = p3Y2 - p2Y2; v23Z2 = p3Z2 - p2Z2; - var cross12; var cross1X2; var cross1Y2; var cross1Z2; - var cross22; var cross2X2; var cross2Y2; var cross2Z2; - var cross32; var cross3X2; var cross3Y2; var cross3Z2; @@ -24668,10 +22302,10 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; - var a13 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; + var a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; - var a33 = a13 > a23 ? a13 > a32 ? a13 : a32 : a23 > a32 ? a23 : a32; + var a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; var p1X3 = p1._relPos1X; var p1Y3 = p1._relPos1Y; var p1Z3 = p1._relPos1Z; @@ -24681,27 +22315,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var p3X3 = p3._relPos1X; var p3Y3 = p3._relPos1Y; var p3Z3 = p3._relPos1Z; - var v123; var v12X3; var v12Y3; var v12Z3; - var v343; var v34X3; var v34Y3; var v34Z3; - var v133; var v13X3; var v13Y3; var v13Z3; - var v243; var v24X3; var v24Y3; var v24Z3; - var v143; var v14X3; var v14Y3; var v14Z3; - var v233; var v23X3; var v23Y3; var v23Z3; @@ -24723,15 +22351,12 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X3 = p3X3 - p2X3; v23Y3 = p3Y3 - p2Y3; v23Z3 = p3Z3 - p2Z3; - var cross13; var cross1X3; var cross1Y3; var cross1Z3; - var cross23; var cross2X3; var cross2Y3; var cross2Z3; - var cross33; var cross3X3; var cross3Y3; var cross3Z3; @@ -24744,11 +22369,11 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; - var a14 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; + var a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; - var a4 = a14 > a24 ? a14 > a34 ? a14 : a34 : a24 > a34 ? a24 : a34; - var max = a11; + var a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; + var max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; var target = 0; if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { max = a22; @@ -24766,11 +22391,9 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } ,computeRelativePositions: function(tf1,tf2) { var num = this._manifold._numPoints; - var _g1 = 0; - var _g = num; - while(_g1 < _g) { - var i = _g1++; - var p = this._manifold._points[i]; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -24795,16 +22418,14 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { ,findNearestContactPointIndex: function(target,tf1,tf2) { var nearestSq = oimo_common_Setting.contactPersistenceThreshold * oimo_common_Setting.contactPersistenceThreshold; var idx = -1; - var _g1 = 0; - var _g = this._manifold._numPoints; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) { + var i = _g++; var mp = this._manifold._points[i]; - var rp1; var rp1X; var rp1Y; var rp1Z; - var rp2; var rp2X; var rp2Y; var rp2Z; @@ -24822,11 +22443,9 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { rp2X -= tf2._positionX; rp2Y -= tf2._positionY; rp2Z -= tf2._positionZ; - var diff1; var diff1X; var diff1Y; var diff1Z; - var diff2; var diff2X; var diff2Y; var diff2Z; @@ -24848,10 +22467,10 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } ,totalUpdate: function(result,tf1,tf2) { this.numOldPoints = this._manifold._numPoints; - var _g1 = 0; - var _g = this.numOldPoints; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.numOldPoints; + while(_g < _g1) { + var i = _g++; var _this = this.oldPoints[i]; var cp = this._manifold._points[i]; _this._localPos1X = cp._localPos1X; @@ -24880,10 +22499,9 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } var num = result.numPoints; this._manifold._numPoints = num; - var _g11 = 0; - var _g2 = num; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + while(_g2 < num) { + var i1 = _g2++; var p = this._manifold._points[i1]; var ref = result.points[i1]; var v = ref.position1; @@ -24930,11 +22548,10 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { p._id = ref.id; p._warmStarted = false; p._disabled = false; - var _g12 = 0; - var _g3 = this.numOldPoints; - while(_g12 < _g3) { - var i2 = _g12++; - var ocp = this.oldPoints[i2]; + var _g3 = 0; + var _g11 = this.numOldPoints; + while(_g3 < _g11) { + var ocp = this.oldPoints[_g3++]; if(p._id == ocp._id) { p._impulse.copyFrom(ocp._impulse); p._warmStarted = true; @@ -24945,12 +22562,9 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } ,incrementalUpdate: function(result,tf1,tf2) { this._manifold._updateDepthsAndPositions(tf1,tf2); - var _g1 = 0; - var _g = this._manifold._numPoints; - while(_g1 < _g) { - var i = _g1++; - this._manifold._points[i]._warmStarted = true; - } + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) this._manifold._points[_g++]._warmStarted = true; var newPoint = result.points[0]; var index = this.findNearestContactPointIndex(newPoint,tf1,tf2); if(index == -1) { @@ -25024,15 +22638,10 @@ var oimo_dynamics_constraint_info_contact_ContactSolverInfo = function() { this.b1 = null; this.b2 = null; this.numRows = 0; - var length = oimo_common_Setting.maxManifoldPoints; - var this1 = new Array(length); - this.rows = this1; - var _g1 = 0; - var _g = this.rows.length; - while(_g1 < _g) { - var i = _g1++; - this.rows[i] = new oimo_dynamics_constraint_info_contact_ContactSolverInfoRow(); - } + this.rows = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_contact_ContactSolverInfoRow(); }; var oimo_dynamics_constraint_info_contact_ContactSolverInfoRow = function() { this.jacobianN = new oimo_dynamics_constraint_info_JacobianRow(); @@ -25047,15 +22656,10 @@ var oimo_dynamics_constraint_info_joint_JointSolverInfo = function() { this.b1 = null; this.b2 = null; this.numRows = 0; - var length = oimo_common_Setting.maxJacobianRows; - var this1 = new Array(length); - this.rows = this1; - var _g1 = 0; - var _g = this.rows.length; - while(_g1 < _g) { - var i = _g1++; - this.rows[i] = new oimo_dynamics_constraint_info_joint_JointSolverInfoRow(); - } + this.rows = new Array(oimo_common_Setting.maxJacobianRows); + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_joint_JointSolverInfoRow(); }; var oimo_dynamics_constraint_info_joint_JointSolverInfoRow = function() { this.jacobian = new oimo_dynamics_constraint_info_JacobianRow(); @@ -25067,6 +22671,18 @@ var oimo_dynamics_constraint_info_joint_JointSolverInfoRow = function() { this.motorMaxImpulse = 0; this.impulse = null; }; +var oimo_dynamics_constraint_joint_BasisTracker = function(joint) { + this.joint = joint; + this.xX = 0; + this.xY = 0; + this.xZ = 0; + this.yX = 0; + this.yY = 0; + this.yZ = 0; + this.zX = 0; + this.zY = 0; + this.zZ = 0; +}; var oimo_dynamics_constraint_joint_Joint = function(config,type) { this._link1 = new oimo_dynamics_constraint_joint_JointLink(this); this._link2 = new oimo_dynamics_constraint_joint_JointLink(this); @@ -25078,8 +22694,7 @@ var oimo_dynamics_constraint_joint_Joint = function(config,type) { this._allowCollision = config.allowCollision; this._breakForce = config.breakForce; this._breakTorque = config.breakTorque; - var _g = config.solverType; - switch(_g) { + switch(config.solverType) { case 0: this._solver = new oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver(this); break; @@ -25125,119 +22740,1037 @@ var oimo_dynamics_constraint_joint_Joint = function(config,type) { this._localBasisZ2X = 0; this._localBasisZ2Y = 0; this._localBasisZ2Z = 0; - var length = oimo_common_Setting.maxJacobianRows; - var this1 = new Array(length); - this._impulses = this1; - var _g2 = 0; - var _g1 = oimo_common_Setting.maxJacobianRows; - while(_g2 < _g1) { - var i = _g2++; - this._impulses[i] = new oimo_dynamics_constraint_joint_JointImpulse(); - } + this._impulses = new Array(oimo_common_Setting.maxJacobianRows); + var _g1 = 0; + var _g2 = oimo_common_Setting.maxJacobianRows; + while(_g1 < _g2) this._impulses[_g1++] = new oimo_dynamics_constraint_joint_JointImpulse(); }; oimo_dynamics_constraint_joint_Joint.prototype = { - _syncAnchors: function() { - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; + buildLocalBasesFromX: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d2; + if(x22 < y22) { + if(x22 < z22) { + d2 = 1 / Math.sqrt(y22 + z22); + this._localBasisY1X = 0; + this._localBasisY1Y = z11 * d2; + this._localBasisY1Z = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + } else if(y22 < z22) { + d2 = 1 / Math.sqrt(z22 + x22); + this._localBasisY1X = -z11 * d2; + this._localBasisY1Y = 0; + this._localBasisY1Z = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; - __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; - __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; - this._relativeAnchor1X = __tmp__X; - this._relativeAnchor1Y = __tmp__Y; - this._relativeAnchor1Z = __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; - __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; - __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; - this._relativeAnchor2X = __tmp__X1; - this._relativeAnchor2Y = __tmp__Y1; - this._relativeAnchor2Z = __tmp__Z1; - this._anchor1X = this._relativeAnchor1X + tf1._positionX; - this._anchor1Y = this._relativeAnchor1Y + tf1._positionY; - this._anchor1Z = this._relativeAnchor1Z + tf1._positionZ; - this._anchor2X = this._relativeAnchor2X + tf2._positionX; - this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; - this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; var __tmp__X2; var __tmp__Y2; var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; - __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; - __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; - this._basisX1X = __tmp__X2; - this._basisX1Y = __tmp__Y2; - this._basisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; - __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; - __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; - this._basisY1X = __tmp__X3; - this._basisY1Y = __tmp__Y3; - this._basisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; - __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; - __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; - this._basisZ1X = __tmp__X4; - this._basisZ1Y = __tmp__Y4; - this._basisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; - __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; - __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; - __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; - this._basisX2X = __tmp__X5; - this._basisX2Y = __tmp__Y5; - this._basisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; - __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; - __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; - this._basisY2X = __tmp__X6; - this._basisY2Y = __tmp__Y6; - this._basisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; - __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; - __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; - this._basisZ2X = __tmp__X7; - this._basisZ2Y = __tmp__Y7; - this._basisZ2Z = __tmp__Z7; - } - ,_getVelocitySolverInfo: function(timeStep,info) { - info.b1 = this._b1; - info.b2 = this._b2; - info.numRows = 0; - } - ,_getPositionSolverInfo: function(info) { - info.b1 = this._b1; - info.b2 = this._b2; - info.numRows = 0; - } - ,_checkDestruction: function() { - var forceSq = this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ; - var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; - if(this._breakForce > 0 && forceSq > this._breakForce * this._breakForce) { - this._world.removeJoint(this); - return; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + ,buildLocalBasesFromXY: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; } - if(this._breakTorque > 0 && torqueSq > this._breakTorque * this._breakTorque) { - this._world.removeJoint(this); - return; + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._localBasisZ1X *= l2; + this._localBasisZ1Y *= l2; + this._localBasisZ1Z *= l2; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + var x11 = this._localBasisX2X; + var y11 = this._localBasisX2Y; + var z11 = this._localBasisX2Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d1; + if(x21 < y21) { + if(x21 < z21) { + d1 = 1 / Math.sqrt(y21 + z21); + this._localBasisY2X = 0; + this._localBasisY2Y = z11 * d1; + this._localBasisY2Z = -y11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + } else if(y21 < z21) { + d1 = 1 / Math.sqrt(z21 + x21); + this._localBasisY2X = -z11 * d1; + this._localBasisY2Y = 0; + this._localBasisY2Z = x11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + } else { + var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + this._localBasisZ2X *= l3; + this._localBasisZ2Y *= l3; + this._localBasisZ2Z *= l3; + this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; + this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; + this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; + } + } + ,buildLocalBasesFromX1Z2: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 1; + } else { + var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ2X *= l1; + this._localBasisZ2Y *= l1; + this._localBasisZ2Z *= l1; + } + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var worldX1X; + var worldX1Y; + var worldX1Z; + var worldZ1X; + var worldZ1Y; + var worldZ1Z; + var worldYX; + var worldYY; + var worldYZ; + var worldX2X; + var worldX2Y; + var worldX2Z; + var worldZ2X; + var worldZ2Y; + var worldZ2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + worldX1X = __tmp__X; + worldX1Y = __tmp__Y; + worldX1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + worldZ2X = __tmp__X1; + worldZ2Y = __tmp__Y1; + worldZ2Z = __tmp__Z1; + worldYX = worldZ2Y * worldX1Z - worldZ2Z * worldX1Y; + worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; + worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; + if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { + var x1 = worldX1X; + var y1 = worldX1Y; + var z1 = worldX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + worldYX = 0; + worldYY = z1 * d; + worldYZ = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + worldYX = -z1 * d; + worldYY = 0; + worldYZ = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } + worldZ1X = worldX1Y * worldYZ - worldX1Z * worldYY; + worldZ1Y = worldX1Z * worldYX - worldX1X * worldYZ; + worldZ1Z = worldX1X * worldYY - worldX1Y * worldYX; + worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; + worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; + worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; + __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; + __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; + this._localBasisX1X = __tmp__X2; + this._localBasisX1Y = __tmp__Y2; + this._localBasisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; + __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; + __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; + this._localBasisY1X = __tmp__X3; + this._localBasisY1Y = __tmp__Y3; + this._localBasisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; + __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; + __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; + this._localBasisZ1X = __tmp__X4; + this._localBasisZ1Y = __tmp__Y4; + this._localBasisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; + __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; + __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; + this._localBasisX2X = __tmp__X5; + this._localBasisX2Y = __tmp__Y5; + this._localBasisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; + __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; + __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; + this._localBasisY2X = __tmp__X6; + this._localBasisY2Y = __tmp__Y6; + this._localBasisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; + __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; + __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; + this._localBasisZ2X = __tmp__X7; + this._localBasisZ2Y = __tmp__Y7; + this._localBasisZ2Z = __tmp__Z7; + } + ,buildLocalBasesFromXY1X2: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ1X *= l1; + this._localBasisZ1Y *= l1; + this._localBasisZ1Z *= l1; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d1 < -0.999999999) { + var vX; + var vY; + var vZ; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d2; + if(x21 < y21) { + if(x21 < z21) { + d2 = 1 / Math.sqrt(y21 + z21); + vX = 0; + vY = z11 * d2; + vZ = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + } else if(y21 < z21) { + d2 = 1 / Math.sqrt(z21 + x21); + vX = -z11 * d2; + vY = 0; + vZ = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d1) * 0.5); + d1 = 0.5 / w; + cX *= d1; + cY *= d1; + cZ *= d1; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x22 = 2 * x; + var y22 = 2 * y; + var z22 = 2 * z; + var xx = x * x22; + var yy = y * y22; + var zz = z * z22; + var xy = x * y22; + var yz = y * z22; + var xz = x * z22; + var wx = w1 * x22; + var wy = w1 * y22; + var wz = w1 * z22; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + ,setSolverInfoRowLinear: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo_common_Setting.linearSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { + zeta = oimo_common_Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorForce > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorForce * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); + row.rhs = error * erp; + } + ,setSolverInfoRowAngular: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo_common_Setting.angularSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { + zeta = oimo_common_Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorTorque > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorTorque * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var mid = (lower + upper) * 0.5; + diff -= mid; + diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; + diff += mid; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); + row.rhs = error * erp; + } + ,getErp: function(timeStep,isPositionPart) { + if(isPositionPart) { + return 1; + } else if(this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE) { + return timeStep.invDt * oimo_common_Setting.velocityBaumgarte; + } else { + return 0; + } + } + ,computeEffectiveInertiaMoment: function(axisX,axisY,axisZ) { + var ia1X; + var ia1Y; + var ia1Z; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; + __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; + __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; + __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; + __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; + var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; + if(invI1 > 0) { + var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; + var projsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + var projsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + ,computeEffectiveInertiaMoment2: function(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { + var ia1X; + var ia1Y; + var ia1Z; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axis1X + this._b1._invInertia01 * axis1Y + this._b1._invInertia02 * axis1Z; + __tmp__Y = this._b1._invInertia10 * axis1X + this._b1._invInertia11 * axis1Y + this._b1._invInertia12 * axis1Z; + __tmp__Z = this._b1._invInertia20 * axis1X + this._b1._invInertia21 * axis1Y + this._b1._invInertia22 * axis1Z; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; + __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; + __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; + var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; + if(invI1 > 0) { + var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + var dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; + var projsq = rsq * rsq - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + var projsq1 = rsq1 * rsq1 - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + ,_syncAnchors: function() { + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; + __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; + __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; + this._relativeAnchor1X = __tmp__X; + this._relativeAnchor1Y = __tmp__Y; + this._relativeAnchor1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; + __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; + __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; + this._relativeAnchor2X = __tmp__X1; + this._relativeAnchor2Y = __tmp__Y1; + this._relativeAnchor2Z = __tmp__Z1; + this._anchor1X = this._relativeAnchor1X + tf1._positionX; + this._anchor1Y = this._relativeAnchor1Y + tf1._positionY; + this._anchor1Z = this._relativeAnchor1Z + tf1._positionZ; + this._anchor2X = this._relativeAnchor2X + tf2._positionX; + this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; + this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + this._basisX1X = __tmp__X2; + this._basisX1Y = __tmp__Y2; + this._basisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; + __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; + __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; + this._basisY1X = __tmp__X3; + this._basisY1Y = __tmp__Y3; + this._basisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; + __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; + __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; + this._basisZ1X = __tmp__X4; + this._basisZ1Y = __tmp__Y4; + this._basisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; + __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; + __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; + this._basisX2X = __tmp__X5; + this._basisX2Y = __tmp__Y5; + this._basisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; + __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; + __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; + this._basisY2X = __tmp__X6; + this._basisY2Y = __tmp__Y6; + this._basisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + this._basisZ2X = __tmp__X7; + this._basisZ2Y = __tmp__Y7; + this._basisZ2Z = __tmp__Z7; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + ,_getPositionSolverInfo: function(info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + ,_checkDestruction: function() { + var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; + if(this._breakForce > 0 && this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ > this._breakForce * this._breakForce) { + this._world.removeJoint(this); + return; + } + if(this._breakTorque > 0 && torqueSq > this._breakTorque * this._breakTorque) { + this._world.removeJoint(this); + return; } } ,getRigidBody1: function() { @@ -25251,63 +23784,54 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } ,getAnchor1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._anchor1X; - v1.y = this._anchor1Y; - v1.z = this._anchor1Z; + v.x = this._anchor1X; + v.y = this._anchor1Y; + v.z = this._anchor1Z; return v; } ,getAnchor2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._anchor2X; - v1.y = this._anchor2Y; - v1.z = this._anchor2Z; + v.x = this._anchor2X; + v.y = this._anchor2Y; + v.z = this._anchor2Z; return v; } ,getAnchor1To: function(anchor) { - var v = anchor; - v.x = this._anchor1X; - v.y = this._anchor1Y; - v.z = this._anchor1Z; + anchor.x = this._anchor1X; + anchor.y = this._anchor1Y; + anchor.z = this._anchor1Z; } ,getAnchor2To: function(anchor) { - var v = anchor; - v.x = this._anchor2X; - v.y = this._anchor2Y; - v.z = this._anchor2Z; + anchor.x = this._anchor2X; + anchor.y = this._anchor2Y; + anchor.z = this._anchor2Z; } ,getLocalAnchor1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localAnchor1X; - v1.y = this._localAnchor1Y; - v1.z = this._localAnchor1Z; + v.x = this._localAnchor1X; + v.y = this._localAnchor1Y; + v.z = this._localAnchor1Z; return v; } ,getLocalAnchor2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localAnchor2X; - v1.y = this._localAnchor2Y; - v1.z = this._localAnchor2Z; + v.x = this._localAnchor2X; + v.y = this._localAnchor2Y; + v.z = this._localAnchor2Z; return v; } ,getLocalAnchor1To: function(localAnchor) { - var v = localAnchor; - v.x = this._localAnchor1X; - v.y = this._localAnchor1Y; - v.z = this._localAnchor1Z; + localAnchor.x = this._localAnchor1X; + localAnchor.y = this._localAnchor1Y; + localAnchor.z = this._localAnchor1Z; } ,getLocalAnchor2To: function(localAnchor) { - var v = localAnchor; - v.x = this._localAnchor2X; - v.y = this._localAnchor2Y; - v.z = this._localAnchor2Z; + localAnchor.x = this._localAnchor2X; + localAnchor.y = this._localAnchor2Y; + localAnchor.z = this._localAnchor2Z; } ,getBasis1: function() { var m = new oimo_common_Mat3(); - var b; var b00; var b01; var b02; @@ -25326,21 +23850,19 @@ oimo_dynamics_constraint_joint_Joint.prototype = { b20 = this._basisX1Z; b21 = this._basisY1Z; b22 = this._basisZ1Z; - var m1 = m; - m1.e00 = b00; - m1.e01 = b01; - m1.e02 = b02; - m1.e10 = b10; - m1.e11 = b11; - m1.e12 = b12; - m1.e20 = b20; - m1.e21 = b21; - m1.e22 = b22; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; return m; } ,getBasis2: function() { var m = new oimo_common_Mat3(); - var b; var b00; var b01; var b02; @@ -25359,20 +23881,18 @@ oimo_dynamics_constraint_joint_Joint.prototype = { b20 = this._basisX2Z; b21 = this._basisY2Z; b22 = this._basisZ2Z; - var m1 = m; - m1.e00 = b00; - m1.e01 = b01; - m1.e02 = b02; - m1.e10 = b10; - m1.e11 = b11; - m1.e12 = b12; - m1.e20 = b20; - m1.e21 = b21; - m1.e22 = b22; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; return m; } ,getBasis1To: function(basis) { - var b; var b00; var b01; var b02; @@ -25391,19 +23911,17 @@ oimo_dynamics_constraint_joint_Joint.prototype = { b20 = this._basisX1Z; b21 = this._basisY1Z; b22 = this._basisZ1Z; - var m = basis; - m.e00 = b00; - m.e01 = b01; - m.e02 = b02; - m.e10 = b10; - m.e11 = b11; - m.e12 = b12; - m.e20 = b20; - m.e21 = b21; - m.e22 = b22; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; } ,getBasis2To: function(basis) { - var b; var b00; var b01; var b02; @@ -25422,16 +23940,15 @@ oimo_dynamics_constraint_joint_Joint.prototype = { b20 = this._basisX2Z; b21 = this._basisY2Z; b22 = this._basisZ2Z; - var m = basis; - m.e00 = b00; - m.e01 = b01; - m.e02 = b02; - m.e10 = b10; - m.e11 = b11; - m.e12 = b12; - m.e20 = b20; - m.e21 = b21; - m.e22 = b22; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; } ,getAllowCollision: function() { return this._allowCollision; @@ -25465,31 +23982,27 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } ,getAppliedForce: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._appliedForceX; - v1.y = this._appliedForceY; - v1.z = this._appliedForceZ; - return v; - } - ,getAppliedForceTo: function(appliedForce) { - var v = appliedForce; v.x = this._appliedForceX; v.y = this._appliedForceY; v.z = this._appliedForceZ; + return v; + } + ,getAppliedForceTo: function(appliedForce) { + appliedForce.x = this._appliedForceX; + appliedForce.y = this._appliedForceY; + appliedForce.z = this._appliedForceZ; } ,getAppliedTorque: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._appliedTorqueX; - v1.y = this._appliedTorqueY; - v1.z = this._appliedTorqueZ; - return v; - } - ,getAppliedTorqueTo: function(appliedTorque) { - var v = appliedTorque; v.x = this._appliedTorqueX; v.y = this._appliedTorqueY; v.z = this._appliedTorqueZ; + return v; + } + ,getAppliedTorqueTo: function(appliedTorque) { + appliedTorque.x = this._appliedTorqueX; + appliedTorque.y = this._appliedTorqueY; + appliedTorque.z = this._appliedTorqueZ; } ,getPrev: function() { return this._prev; @@ -25508,195 +24021,14 @@ var oimo_dynamics_constraint_joint_CylindricalJoint = function(config) { this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; - if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { - this._localBasisX1X = 1; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._localBasisX1X *= l; - this._localBasisX1Y *= l; - this._localBasisX1Z *= l; - } - if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { - this._localBasisX2X = 1; - this._localBasisX2Y = 0; - this._localBasisX2Z = 0; - } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; - } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; - if(x2 < y2) { - if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); - vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; - vY = 0; - vZ = x1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - slerpQX = vX; - slerpQY = vY; - slerpQZ = vZ; - slerpQW = 0; - } else { - var cX; - var cY; - var cZ; - cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; - cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; - cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d) * 0.5); - d = 0.5 / w; - cX *= d; - cY *= d; - cZ *= d; - slerpQX = cX; - slerpQY = cY; - slerpQZ = cZ; - slerpQW = w; - } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; - slerpM00 = 1 - yy - zz; - slerpM01 = xy - wz; - slerpM02 = xz + wy; - slerpM10 = xy + wz; - slerpM11 = 1 - xx - zz; - slerpM12 = yz - wx; - slerpM20 = xz - wy; - slerpM21 = yz + wx; - slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); - this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; - this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; - this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; - this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; - __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; - __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; - this._localBasisX2X = __tmp__X; - this._localBasisX2Y = __tmp__Y; - this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; + this.buildLocalBasesFromX(); this.angle = 0; this.angularErrorY = 0; this.angularErrorZ = 0; this.translation = 0; this.linearErrorY = 0; this.linearErrorZ = 0; - this._basis = new oimo_dynamics_constraint_joint_JointBasis(this); + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); this._translSd = config.translationalSpringDamper.clone(); this._translLm = config.translationalLimitMotor.clone(); this._rotSd = config.rotationalSpringDamper.clone(); @@ -25705,227 +24037,38 @@ var oimo_dynamics_constraint_joint_CylindricalJoint = function(config) { oimo_dynamics_constraint_joint_CylindricalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ getInfo: function(info,timeStep,isPositionPart) { - var erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; + var erp = this.getErp(timeStep,isPositionPart); var linRhsY = this.linearErrorY * erp; var linRhsZ = this.linearErrorZ * erp; var angRhsY = this.angularErrorY * erp; var angRhsZ = this.angularErrorZ * erp; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; - crossR100 = 0; - crossR101 = -this._relativeAnchor1Z; - crossR102 = this._relativeAnchor1Y; - crossR110 = this._relativeAnchor1Z; - crossR111 = 0; - crossR112 = -this._relativeAnchor1X; - crossR120 = -this._relativeAnchor1Y; - crossR121 = this._relativeAnchor1X; - crossR122 = 0; - crossR200 = 0; - crossR201 = -this._relativeAnchor2Z; - crossR202 = this._relativeAnchor2Y; - crossR210 = this._relativeAnchor2Z; - crossR211 = 0; - crossR212 = -this._relativeAnchor2X; - crossR220 = -this._relativeAnchor2Y; - crossR221 = this._relativeAnchor2X; - crossR222 = 0; - crossR100 = -crossR100; - crossR101 = -crossR101; - crossR102 = -crossR102; - crossR110 = -crossR110; - crossR111 = -crossR111; - crossR112 = -crossR112; - crossR120 = -crossR120; - crossR121 = -crossR121; - crossR122 = -crossR122; - crossR200 = -crossR200; - crossR201 = -crossR201; - crossR202 = -crossR202; - crossR210 = -crossR210; - crossR211 = -crossR211; - crossR212 = -crossR212; - crossR220 = -crossR220; - crossR221 = -crossR221; - crossR222 = -crossR222; - var row; var j; - var translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); - var axisX = this._basis.xX; - var axisY = this._basis.xY; - var axisZ = this._basis.xZ; - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; - __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; - __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; - ia1X = __tmp__X; - ia1Y = __tmp__Y; - ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; - __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; - __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; - if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = rsq - dot * dot; - if(projsq > 0) { - if(this._b1._invMass > 0) { - invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); - } else { - invI1 = 0; - } - } - } - if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = rsq1 - dot1 * dot1; - if(projsq1 > 0) { - if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); - } else { - invI2 = 0; - } - } - } - var rotationalMotorMass = invI1 + invI2 == 0 ? 0 : 1 / (invI1 + invI2); + var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); if(this._translSd.frequency <= 0 || !isPositionPart) { var impulse = this._impulses[0]; - var row1 = info.rows[info.numRows++]; - var _this = row1.jacobian; - _this.lin1X = 0; - _this.lin1Y = 0; - _this.lin1Z = 0; - _this.lin2X = 0; - _this.lin2Y = 0; - _this.lin2Z = 0; - _this.ang1X = 0; - _this.ang1Y = 0; - _this.ang1Z = 0; - _this.ang2X = 0; - _this.ang2Y = 0; - _this.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse; - row = row1; - var diff = this.translation; - var lm = this._translLm; - var sd = this._translSd; - var cfmFactor; - var erp1; - var slop = oimo_common_Setting.linearSlop; - if(isPositionPart) { - cfmFactor = 0; - erp1 = 1; - } else { - if(sd.frequency > 0) { - slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; - if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; - if(sd.useSymplecticEuler) { - cfmFactor = 1 / (h * c); - erp1 = k / c; - } else { - cfmFactor = 1 / (h * (h * k + c)); - erp1 = k / (h * k + c); - } - } else { - cfmFactor = 0; - erp1 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm.motorForce > 0) { - row.motorSpeed = lm.motorSpeed; - row.motorMaxImpulse = lm.motorForce * timeStep.dt; - } else { - row.motorSpeed = 0; - row.motorMaxImpulse = 0; - } - } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var minImp; - var maxImp; - var error; - if(lower > upper) { - minImp = 0; - maxImp = 0; - error = 0; - } else if(lower == upper) { - minImp = -1.0 / 0.0; - maxImp = 1.0 / 0.0; - error = diff - lower; - } else if(diff < lower) { - minImp = -1.0 / 0.0; - maxImp = 0; - error = diff - lower + slop; - if(error > 0) { - error = 0; - } - } else if(diff > upper) { - minImp = 0; - maxImp = 1.0 / 0.0; - error = diff - upper - slop; - if(error < 0) { - error = 0; - } - } else { - minImp = 0; - maxImp = 0; - error = 0; - } - var invMass = translationalMotorMass == 0 ? 0 : 1 / translationalMotorMass; - row.minImpulse = minImp; - row.maxImpulse = maxImp; - row.cfm = cfmFactor * invMass; - row.rhs = error * erp1; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translation,this._translLm,1 / (this._b1._invMass + this._b2._invMass),this._translSd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; j.lin1Y = this._basis.xY; @@ -25933,16 +24076,16 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.lin2X = this._basis.xX; j.lin2Y = this._basis.xY; j.lin2Z = this._basis.xZ; - j.ang1X = crossR100; - j.ang1Y = crossR101; - j.ang1Z = crossR102; - j.ang2X = crossR200; - j.ang2Y = crossR201; - j.ang2Z = crossR202; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -25955,35 +24098,34 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row = row2; - row.rhs = linRhsY; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; j.lin1X = this._basis.yX; j.lin1Y = this._basis.yY; j.lin1Z = this._basis.yZ; j.lin2X = this._basis.yX; j.lin2Y = this._basis.yY; j.lin2Z = this._basis.yZ; - j.ang1X = crossR110; - j.ang1Y = crossR111; - j.ang1Z = crossR112; - j.ang2X = crossR210; - j.ang2Y = crossR211; - j.ang2Z = crossR212; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -25996,36 +24138,35 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row = row3; - row.rhs = linRhsZ; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; j.lin2X = this._basis.zX; j.lin2Y = this._basis.zY; j.lin2Z = this._basis.zZ; - j.ang1X = crossR120; - j.ang1Y = crossR121; - j.ang1Z = crossR122; - j.ang2X = crossR220; - j.ang2Y = crossR221; - j.ang2Z = crossR222; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; if(this._rotSd.frequency <= 0 || !isPositionPart) { var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -26038,96 +24179,16 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row = row4; - var diff1 = this.angle; - var lm1 = this._rotLm; - var sd1 = this._rotSd; - var cfmFactor1; - var erp2; - var slop1 = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor1 = 0; - erp2 = 1; - } else { - if(sd1.frequency > 0) { - slop1 = 0; - var omega1 = 6.28318530717958 * sd1.frequency; - var zeta1 = sd1.dampingRatio; - if(zeta1 < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta1 = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h1 = timeStep.dt; - var c1 = 2 * zeta1 * omega1; - var k1 = omega1 * omega1; - if(sd1.useSymplecticEuler) { - cfmFactor1 = 1 / (h1 * c1); - erp2 = k1 / c1; - } else { - cfmFactor1 = 1 / (h1 * (h1 * k1 + c1)); - erp2 = k1 / (h1 * k1 + c1); - } - } else { - cfmFactor1 = 0; - erp2 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm1.motorTorque > 0) { - row.motorSpeed = lm1.motorSpeed; - row.motorMaxImpulse = lm1.motorTorque * timeStep.dt; - } else { - row.motorSpeed = 0; - row.motorMaxImpulse = 0; - } - } - var lower1 = lm1.lowerLimit; - var upper1 = lm1.upperLimit; - var mid = (lower1 + upper1) * 0.5; - diff1 -= mid; - diff1 = ((diff1 + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff1 += mid; - var minImp1; - var maxImp1; - var error1; - if(lower1 > upper1) { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } else if(lower1 == upper1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - lower1; - } else if(diff1 < lower1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 0; - error1 = diff1 - lower1 + slop1; - if(error1 > 0) { - error1 = 0; - } - } else if(diff1 > upper1) { - minImp1 = 0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - upper1 - slop1; - if(error1 < 0) { - error1 = 0; - } - } else { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } - var invMass1 = rotationalMotorMass == 0 ? 0 : 1 / rotationalMotorMass; - row.minImpulse = minImp1; - row.maxImpulse = maxImp1; - row.cfm = cfmFactor1 * invMass1; - row.rhs = error1 * erp2; - j = row.jacobian; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); + j = row3.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -26136,8 +24197,8 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Z = this._basis.xZ; } var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -26150,20 +24211,19 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row = row5; - row.rhs = angRhsY; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; @@ -26171,8 +24231,8 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; _this5.lin1X = 0; _this5.lin1Y = 0; _this5.lin1Z = 0; @@ -26185,20 +24245,19 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this5.ang2X = 0; _this5.ang2Y = 0; _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row = row6; - row.rhs = angRhsZ; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -26211,22 +24270,18 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic var _this = this._basis; var invM1 = _this.joint._b1._invMass; var invM2 = _this.joint._b2._invMass; - var q; var qX; var qY; var qZ; var qW; - var idQ; var idQX; var idQY; var idQZ; var idQW; - var slerpQ; var slerpQX; var slerpQY; var slerpQZ; var slerpQW; - var slerpM; var slerpM00; var slerpM01; var slerpM02; @@ -26236,23 +24291,18 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic var slerpM20; var slerpM21; var slerpM22; - var newX; var newXX; var newXY; var newXZ; - var newY; var newYX; var newYY; var newYZ; - var newZ; var newZX; var newZY; var newZZ; - var prevX; var prevXX; var prevXY; var prevXZ; - var prevY; var prevYX; var prevYY; var prevYZ; @@ -26316,10 +24366,6 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; var q1X; var q1Y; var q1Z; @@ -26361,263 +24407,921 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic if(l > 1e-32) { l = 1 / Math.sqrt(l); } - slerpQX = q2X * l; - slerpQY = q2Y * l; - slerpQZ = q2Z * l; - slerpQW = q2W * l; + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); - q1X *= cos; - q1Y *= cos; - q1Z *= cos; - q1W *= cos; - slerpQX = q1X + q2X * sin; - slerpQY = q1Y + q2Y * sin; - slerpQZ = q1Z + q2Z * sin; - slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; - slerpM00 = 1 - yy - zz; - slerpM01 = xy - wz; - slerpM02 = xz + wy; - slerpM10 = xy + wz; - slerpM11 = 1 - xx - zz; - slerpM12 = yz - wx; - slerpM20 = xz - wy; - slerpM21 = yz + wx; - slerpM22 = 1 - xx - yy; + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var angErrorX; + var angErrorY; + var angErrorZ; + angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; + angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; + angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; + var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + angErrorX *= l3; + angErrorY *= l3; + angErrorZ *= l3; + angErrorX *= theta1; + angErrorY *= theta1; + angErrorZ *= theta1; + this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; + this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; + var perpCrossX; + var perpCrossY; + var perpCrossZ; + perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; + perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; + perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; + cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { + this.angle = -this.angle; + } + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; + this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; + this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; + } + ,getTranslationalSpringDamper: function() { + return this._translSd; + } + ,getRotationalSpringDamper: function() { + return this._rotSd; + } + ,getTranslationalLimitMotor: function() { + return this._translLm; + } + ,getRotationalLimitMotor: function() { + return this._rotLm; + } + ,getAngle: function() { + return this.angle; + } + ,getTranslation: function() { + return this.translation; + } +}); +var oimo_dynamics_constraint_joint_JointConfig = function() { + this.rigidBody1 = null; + this.rigidBody2 = null; + this.localAnchor1 = new oimo_common_Vec3(); + this.localAnchor2 = new oimo_common_Vec3(); + this.allowCollision = false; + this.solverType = oimo_common_Setting.defaultJointConstraintSolverType; + this.positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; + this.breakForce = 0; + this.breakTorque = 0; +}; +oimo_dynamics_constraint_joint_JointConfig.prototype = { + _init: function(rb1,rb2,worldAnchor) { + this.rigidBody1 = rb1; + this.rigidBody2 = rb2; + var _this = this.rigidBody1; + var localPoint = this.localAnchor1; + var vX; + var vY; + var vZ; + vX = worldAnchor.x; + vY = worldAnchor.y; + vZ = worldAnchor.z; + vX -= _this._transform._positionX; + vY -= _this._transform._positionY; + vZ -= _this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; + __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; + __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; + var _this1 = this.rigidBody2; + var localPoint1 = this.localAnchor2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAnchor.x; + vY1 = worldAnchor.y; + vZ1 = worldAnchor.z; + vX1 -= _this1._transform._positionX; + vY1 -= _this1._transform._positionY; + vZ1 -= _this1._transform._positionZ; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; + __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; + __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localPoint1.x = vX1; + localPoint1.y = vY1; + localPoint1.z = vZ1; + } +}; +var oimo_dynamics_constraint_joint_CylindricalJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.translationalLimitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + this.translationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.rotationalLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.rotationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); +}; +oimo_dynamics_constraint_joint_CylindricalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localAxis1; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; - __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; - __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; - newXX = __tmp__X; - newXY = __tmp__Y; - newXZ = __tmp__Z; - prevXX = _this.xX; - prevXY = _this.xY; - prevXZ = _this.xZ; - prevYX = _this.yX; - prevYY = _this.yY; - prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; - } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; - } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; - slerpQW = 0; - } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; - slerpM00 = 1 - yy1 - zz1; - slerpM01 = xy1 - wz1; - slerpM02 = xz1 + wy1; - slerpM10 = xy1 + wz1; - slerpM11 = 1 - xx1 - zz1; - slerpM12 = yz1 - wx1; - slerpM20 = xz1 - wy1; - slerpM21 = yz1 + wx1; - slerpM22 = 1 - xx1 - yy1; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; - __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; - __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; - newYX = __tmp__X1; - newYY = __tmp__Y1; - newYZ = __tmp__Z1; - newZX = newXY * newYZ - newXZ * newYY; - newZY = newXZ * newYX - newXX * newYZ; - newZZ = newXX * newYY - newXY * newYX; - if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - newZX *= l2; - newZY *= l2; - newZZ *= l2; - } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); - newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; - } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; - newZZ = 0; - } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; - newZY = 0; - newZZ = x12 * d5; - } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; - newZZ = 0; - } + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + return this; + } +}); +var oimo_dynamics_constraint_joint_GenericJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.GENERIC); + var tmp; + var _this = config.localBasis1; + if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { + var _this1 = config.localBasis2; + tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; + } else { + tmp = true; + } + if(tmp) { + console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed"); + } + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + var m = config.localBasis1; + lb100 = m.e00; + lb101 = m.e01; + lb102 = m.e02; + lb110 = m.e10; + lb111 = m.e11; + lb112 = m.e12; + lb120 = m.e20; + lb121 = m.e21; + lb122 = m.e22; + var m1 = config.localBasis2; + lb200 = m1.e00; + lb201 = m1.e01; + lb202 = m1.e02; + lb210 = m1.e10; + lb211 = m1.e11; + lb212 = m1.e12; + lb220 = m1.e20; + lb221 = m1.e21; + lb222 = m1.e22; + this._localBasisX1X = lb100; + this._localBasisX1Y = lb110; + this._localBasisX1Z = lb120; + this._localBasisY1X = lb101; + this._localBasisY1Y = lb111; + this._localBasisY1Z = lb121; + this._localBasisZ1X = lb102; + this._localBasisZ1Y = lb112; + this._localBasisZ1Z = lb122; + this._localBasisX2X = lb200; + this._localBasisX2Y = lb210; + this._localBasisX2Z = lb220; + this._localBasisY2X = lb201; + this._localBasisY2Y = lb211; + this._localBasisY2Z = lb221; + this._localBasisZ2X = lb202; + this._localBasisZ2Y = lb212; + this._localBasisZ2Z = lb222; + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.translationX = 0; + this.translationY = 0; + this.translationZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._translLms = new Array(3); + this._translSds = new Array(3); + this._rotLms = new Array(3); + this._rotSds = new Array(3); + this._translLms[0] = config.translationalLimitMotors[0].clone(); + this._translLms[1] = config.translationalLimitMotors[1].clone(); + this._translLms[2] = config.translationalLimitMotors[2].clone(); + this._translSds[0] = config.translationalSpringDampers[0].clone(); + this._translSds[1] = config.translationalSpringDampers[1].clone(); + this._translSds[2] = config.translationalSpringDampers[2].clone(); + this._rotLms[0] = config.rotationalLimitMotors[0].clone(); + this._rotLms[1] = config.rotationalLimitMotors[1].clone(); + this._rotLms[2] = config.rotationalLimitMotors[2].clone(); + this._rotSds[0] = config.rotationalSpringDampers[0].clone(); + this._rotSds[1] = config.rotationalSpringDampers[1].clone(); + this._rotSds[2] = config.rotationalSpringDampers[2].clone(); +}; +oimo_dynamics_constraint_joint_GenericJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var j; + var translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + if(this._translSds[0].frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationX,this._translLms[0],translMotorMass,this._translSds[0],timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basisX1X; + j.lin1Y = this._basisX1Y; + j.lin1Z = this._basisX1Z; + j.lin2X = this._basisX1X; + j.lin2Y = this._basisX1Y; + j.lin2Z = this._basisX1Z; + j.ang1X = this._relativeAnchor1Y * this._basisX1Z - this._relativeAnchor1Z * this._basisX1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisX1X - this._relativeAnchor1X * this._basisX1Z; + j.ang1Z = this._relativeAnchor1X * this._basisX1Y - this._relativeAnchor1Y * this._basisX1X; + j.ang2X = this._relativeAnchor2Y * this._basisX1Z - this._relativeAnchor2Z * this._basisX1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisX1X - this._relativeAnchor2X * this._basisX1Z; + j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; + } + if(this._translSds[1].frequency <= 0 || !isPositionPart) { + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + this.setSolverInfoRowLinear(row1,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); + j = row1.jacobian; + j.lin1X = this._basisY1X; + j.lin1Y = this._basisY1Y; + j.lin1Z = this._basisY1Z; + j.lin2X = this._basisY1X; + j.lin2Y = this._basisY1Y; + j.lin2Z = this._basisY1Z; + j.ang1X = this._relativeAnchor1Y * this._basisY1Z - this._relativeAnchor1Z * this._basisY1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisY1X - this._relativeAnchor1X * this._basisY1Z; + j.ang1Z = this._relativeAnchor1X * this._basisY1Y - this._relativeAnchor1Y * this._basisY1X; + j.ang2X = this._relativeAnchor2Y * this._basisY1Z - this._relativeAnchor2Z * this._basisY1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisY1X - this._relativeAnchor2X * this._basisY1Z; + j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; + } + if(this._translSds[2].frequency <= 0 || !isPositionPart) { + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + this.setSolverInfoRowLinear(row2,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); + j = row2.jacobian; + j.lin1X = this._basisZ1X; + j.lin1Y = this._basisZ1Y; + j.lin1Z = this._basisZ1Z; + j.lin2X = this._basisZ1X; + j.lin2Y = this._basisZ1Y; + j.lin2Z = this._basisZ1Z; + j.ang1X = this._relativeAnchor1Y * this._basisZ1Z - this._relativeAnchor1Z * this._basisZ1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisZ1X - this._relativeAnchor1X * this._basisZ1Z; + j.ang1Z = this._relativeAnchor1X * this._basisZ1Y - this._relativeAnchor1Y * this._basisZ1X; + j.ang2X = this._relativeAnchor2Y * this._basisZ1Z - this._relativeAnchor2Z * this._basisZ1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisZ1X - this._relativeAnchor2X * this._basisZ1Z; + j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; + } + if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this._axisXX; + j.ang1Y = this._axisXY; + j.ang1Z = this._axisXZ; + j.ang2X = this._axisXX; + j.ang2Y = this._axisXY; + j.ang2Z = this._axisXZ; + } + if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + this.setSolverInfoRowAngular(row4,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); + j = row4.jacobian; + j.ang1X = this._axisYX; + j.ang1Y = this._axisYY; + j.ang1Z = this._axisYZ; + j.ang2X = this._axisYX; + j.ang2Y = this._axisYY; + j.ang2Z = this._axisYZ; } - newYX = newZY * newXZ - newZZ * newXY; - newYY = newZZ * newXX - newZX * newXZ; - newYZ = newZX * newXY - newZY * newXX; - _this.xX = newXX; - _this.xY = newXY; - _this.xZ = newXZ; - _this.yX = newYX; - _this.yY = newYY; - _this.yZ = newYZ; - _this.zX = newZX; - _this.zY = newZY; - _this.zZ = newZZ; - var angError; - var angErrorX; - var angErrorY; - var angErrorZ; - angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; - angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; - angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + this.setSolverInfoRowAngular(row5,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); + j = row5.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; - this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; - this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCross; - var perpCrossX; - var perpCrossY; - var perpCrossZ; - perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; - perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; - perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { - this.angle = -this.angle; + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot00; + var relRot01; + var relRot02; + var relRot11; + var relRot12; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__11; + var __tmp__12; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var anglesX; + var anglesY; + var anglesZ; + var sy = relRot02; + if(sy <= -1) { + var xSubZ = Math.atan2(relRot21,relRot11); + anglesX = xSubZ * 0.5; + anglesY = -1.570796326794895; + anglesZ = -xSubZ * 0.5; + } else if(sy >= 1) { + var xAddZ = Math.atan2(relRot21,relRot11); + anglesX = xAddZ * 0.5; + anglesY = 1.570796326794895; + anglesZ = xAddZ * 0.5; + } else { + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); } - var anchorDiff; + this._angleX = anglesX; + this._angleY = anglesY; + this._angleZ = anglesZ; var anchorDiffX; var anchorDiffY; var anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; - this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; - this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; - this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + this.translationX = anchorDiffX * this._basisX1X + anchorDiffY * this._basisX1Y + anchorDiffZ * this._basisX1Z; + this.translationY = anchorDiffX * this._basisY1X + anchorDiffY * this._basisY1Y + anchorDiffZ * this._basisY1Z; + this.translationZ = anchorDiffX * this._basisZ1X + anchorDiffY * this._basisZ1Y + anchorDiffZ * this._basisZ1Z; } ,_getVelocitySolverInfo: function(timeStep,info) { oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); @@ -26627,218 +25331,200 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; - return v; - } - ,getAxis2: function() { + ,getAxisX: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; - return v; - } - ,getAxis1To: function(axis) { - var v = axis; v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; + return v; } - ,getAxis2To: function(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; - } - ,getLocalAxis1: function() { + ,getAxisY: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + v.x = this._axisYX; + v.y = this._axisYY; + v.z = this._axisYZ; return v; } - ,getLocalAxis2: function() { + ,getAxisZ: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; return v; } - ,getLocalAxis1To: function(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; - } - ,getLocalAxis2To: function(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; - } - ,getTranslationalSpringDamper: function() { - return this._translSd; - } - ,getRotationalSpringDamper: function() { - return this._rotSd; + ,getTranslationalSpringDampers: function() { + return this._translSds.slice(0); } - ,getTranslationalLimitMotor: function() { - return this._translLm; + ,getRotationalSpringDampers: function() { + return this._translSds.slice(0); } - ,getRotationalLimitMotor: function() { - return this._rotLm; + ,getTranslationalLimitMotors: function() { + return this._translLms.slice(0); } - ,getAngle: function() { - return this.angle; + ,getRotationalLimitMotors: function() { + return this._rotLms.slice(0); } - ,getTranslation: function() { - return this.translation; + ,getAngles: function() { + return new oimo_common_Vec3(this._angleX,this._angleY,this._angleZ); } -}); -var oimo_dynamics_constraint_joint_JointConfig = function() { - this.rigidBody1 = null; - this.rigidBody2 = null; - this.localAnchor1 = new oimo_common_Vec3(); - this.localAnchor2 = new oimo_common_Vec3(); - this.allowCollision = false; - this.solverType = oimo_common_Setting.defaultJointConstraintSolverType; - this.positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; - this.breakForce = 0; - this.breakTorque = 0; -}; -oimo_dynamics_constraint_joint_JointConfig.prototype = { - _init: function(rb1,rb2,worldAnchor) { - this.rigidBody1 = rb1; - this.rigidBody2 = rb2; - var _this = this.rigidBody1; - var v; - var vX; - var vY; - var vZ; - var v1 = worldAnchor; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - vX -= _this._transform._positionX; - vY -= _this._transform._positionY; - vZ -= _this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; - __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; - __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; - vX = __tmp__X; - vY = __tmp__Y; - vZ = __tmp__Z; - var v2 = this.localAnchor1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var _this1 = this.rigidBody2; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAnchor; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - vX1 -= _this1._transform._positionX; - vY1 -= _this1._transform._positionY; - vZ1 -= _this1._transform._positionZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; - __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; - __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - var v5 = this.localAnchor2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + ,getTranslations: function() { + return new oimo_common_Vec3(this.translationX,this.translationY,this.translationZ); } -}; -var oimo_dynamics_constraint_joint_CylindricalJointConfig = function() { +}); +var oimo_dynamics_constraint_joint_GenericJointConfig = function() { oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localAxis1 = new oimo_common_Vec3(1,0,0); - this.localAxis2 = new oimo_common_Vec3(1,0,0); - this.translationalLimitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); - this.translationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); - this.rotationalLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); - this.rotationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.localBasis1 = new oimo_common_Mat3(); + this.localBasis2 = new oimo_common_Mat3(); + var _g = []; + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + this.translationalLimitMotors = _g; + var _g1 = []; + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + this.rotationalLimitMotors = _g1; + this.translationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; + this.rotationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; }; -oimo_dynamics_constraint_joint_CylindricalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { +oimo_dynamics_constraint_joint_GenericJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; - __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; - __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; - vX = __tmp__X; - vY = __tmp__Y; - vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + var tf1 = rigidBody1._transform; + var tf2 = rigidBody2._transform; + var wb100; + var wb101; + var wb102; + var wb110; + var wb111; + var wb112; + var wb120; + var wb121; + var wb122; + var wb200; + var wb201; + var wb202; + var wb210; + var wb211; + var wb212; + var wb220; + var wb221; + var wb222; + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + wb100 = worldBasis1.e00; + wb101 = worldBasis1.e01; + wb102 = worldBasis1.e02; + wb110 = worldBasis1.e10; + wb111 = worldBasis1.e11; + wb112 = worldBasis1.e12; + wb120 = worldBasis1.e20; + wb121 = worldBasis1.e21; + wb122 = worldBasis1.e22; + wb200 = worldBasis2.e00; + wb201 = worldBasis2.e01; + wb202 = worldBasis2.e02; + wb210 = worldBasis2.e10; + wb211 = worldBasis2.e11; + wb212 = worldBasis2.e12; + wb220 = worldBasis2.e20; + wb221 = worldBasis2.e21; + wb222 = worldBasis2.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * wb100 + tf1._rotation10 * wb110 + tf1._rotation20 * wb120; + __tmp__01 = tf1._rotation00 * wb101 + tf1._rotation10 * wb111 + tf1._rotation20 * wb121; + __tmp__02 = tf1._rotation00 * wb102 + tf1._rotation10 * wb112 + tf1._rotation20 * wb122; + __tmp__10 = tf1._rotation01 * wb100 + tf1._rotation11 * wb110 + tf1._rotation21 * wb120; + __tmp__11 = tf1._rotation01 * wb101 + tf1._rotation11 * wb111 + tf1._rotation21 * wb121; + __tmp__12 = tf1._rotation01 * wb102 + tf1._rotation11 * wb112 + tf1._rotation21 * wb122; + __tmp__20 = tf1._rotation02 * wb100 + tf1._rotation12 * wb110 + tf1._rotation22 * wb120; + __tmp__21 = tf1._rotation02 * wb101 + tf1._rotation12 * wb111 + tf1._rotation22 * wb121; + __tmp__22 = tf1._rotation02 * wb102 + tf1._rotation12 * wb112 + tf1._rotation22 * wb122; + lb100 = __tmp__00; + lb101 = __tmp__01; + lb102 = __tmp__02; + lb110 = __tmp__10; + lb111 = __tmp__11; + lb112 = __tmp__12; + lb120 = __tmp__20; + lb121 = __tmp__21; + lb122 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; + __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; + __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; + __tmp__101 = tf2._rotation01 * wb200 + tf2._rotation11 * wb210 + tf2._rotation21 * wb220; + __tmp__111 = tf2._rotation01 * wb201 + tf2._rotation11 * wb211 + tf2._rotation21 * wb221; + __tmp__121 = tf2._rotation01 * wb202 + tf2._rotation11 * wb212 + tf2._rotation21 * wb222; + __tmp__201 = tf2._rotation02 * wb200 + tf2._rotation12 * wb210 + tf2._rotation22 * wb220; + __tmp__211 = tf2._rotation02 * wb201 + tf2._rotation12 * wb211 + tf2._rotation22 * wb221; + __tmp__221 = tf2._rotation02 * wb202 + tf2._rotation12 * wb212 + tf2._rotation22 * wb222; + lb200 = __tmp__001; + lb201 = __tmp__011; + lb202 = __tmp__021; + lb210 = __tmp__101; + lb211 = __tmp__111; + lb212 = __tmp__121; + lb220 = __tmp__201; + lb221 = __tmp__211; + lb222 = __tmp__221; + var m = this.localBasis1; + m.e00 = lb100; + m.e01 = lb101; + m.e02 = lb102; + m.e10 = lb110; + m.e11 = lb111; + m.e12 = lb112; + m.e20 = lb120; + m.e21 = lb121; + m.e22 = lb122; + var m1 = this.localBasis2; + m1.e00 = lb200; + m1.e01 = lb201; + m1.e02 = lb202; + m1.e10 = lb210; + m1.e11 = lb211; + m1.e12 = lb212; + m1.e20 = lb220; + m1.e21 = lb221; + m1.e22 = lb222; return this; } }); -var oimo_dynamics_constraint_joint_JointBasis = function(joint) { - this.joint = joint; - this.xX = 0; - this.xY = 0; - this.xZ = 0; - this.yX = 0; - this.yY = 0; - this.yZ = 0; - this.zX = 0; - this.zY = 0; - this.zZ = 0; -}; var oimo_dynamics_constraint_joint_JointImpulse = function() { this.impulse = 0; this.impulseM = 0; @@ -26873,189 +25559,8 @@ var oimo_dynamics_constraint_joint_PrismaticJoint = function(config) { this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; - if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { - this._localBasisX1X = 1; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._localBasisX1X *= l; - this._localBasisX1Y *= l; - this._localBasisX1Z *= l; - } - if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { - this._localBasisX2X = 1; - this._localBasisX2Y = 0; - this._localBasisX2Z = 0; - } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; - } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; - if(x2 < y2) { - if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); - vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; - vY = 0; - vZ = x1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - slerpQX = vX; - slerpQY = vY; - slerpQZ = vZ; - slerpQW = 0; - } else { - var cX; - var cY; - var cZ; - cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; - cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; - cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d) * 0.5); - d = 0.5 / w; - cX *= d; - cY *= d; - cZ *= d; - slerpQX = cX; - slerpQY = cY; - slerpQZ = cZ; - slerpQW = w; - } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; - slerpM00 = 1 - yy - zz; - slerpM01 = xy - wz; - slerpM02 = xz + wy; - slerpM10 = xy + wz; - slerpM11 = 1 - xx - zz; - slerpM12 = yz - wx; - slerpM20 = xz - wy; - slerpM21 = yz + wx; - slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); - this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; - this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; - this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; - this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; - __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; - __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; - this._localBasisX2X = __tmp__X; - this._localBasisX2Y = __tmp__Y; - this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; - this._basis = new oimo_dynamics_constraint_joint_JointBasis(this); + this.buildLocalBasesFromX(); + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); this.translation = 0; this.linearErrorY = 0; this.linearErrorZ = 0; @@ -27068,75 +25573,17 @@ var oimo_dynamics_constraint_joint_PrismaticJoint = function(config) { oimo_dynamics_constraint_joint_PrismaticJoint.__super__ = oimo_dynamics_constraint_joint_Joint; oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ getInfo: function(info,timeStep,isPositionPart) { - var erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; + var erp = this.getErp(timeStep,isPositionPart); var linRhsY = this.linearErrorY * erp; var linRhsZ = this.linearErrorZ * erp; var angRhsX = this.angularErrorX * erp; var angRhsY = this.angularErrorY * erp; var angRhsZ = this.angularErrorZ * erp; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; - crossR100 = 0; - crossR101 = -this._relativeAnchor1Z; - crossR102 = this._relativeAnchor1Y; - crossR110 = this._relativeAnchor1Z; - crossR111 = 0; - crossR112 = -this._relativeAnchor1X; - crossR120 = -this._relativeAnchor1Y; - crossR121 = this._relativeAnchor1X; - crossR122 = 0; - crossR200 = 0; - crossR201 = -this._relativeAnchor2Z; - crossR202 = this._relativeAnchor2Y; - crossR210 = this._relativeAnchor2Z; - crossR211 = 0; - crossR212 = -this._relativeAnchor2X; - crossR220 = -this._relativeAnchor2Y; - crossR221 = this._relativeAnchor2X; - crossR222 = 0; - crossR100 = -crossR100; - crossR101 = -crossR101; - crossR102 = -crossR102; - crossR110 = -crossR110; - crossR111 = -crossR111; - crossR112 = -crossR112; - crossR120 = -crossR120; - crossR121 = -crossR121; - crossR122 = -crossR122; - crossR200 = -crossR200; - crossR201 = -crossR201; - crossR202 = -crossR202; - crossR210 = -crossR210; - crossR211 = -crossR211; - crossR212 = -crossR212; - crossR220 = -crossR220; - crossR221 = -crossR221; - crossR222 = -crossR222; - var row; var j; - var motorMass = 1 / (this._b1._invMass + this._b2._invMass); if(this._sd.frequency <= 0 || !isPositionPart) { var impulse = this._impulses[0]; - var row1 = info.rows[info.numRows++]; - var _this = row1.jacobian; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -27149,91 +25596,15 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this.ang2X = 0; _this.ang2Y = 0; _this.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse; - row = row1; - var diff = this.translation; - var lm = this._lm; - var sd = this._sd; - var cfmFactor; - var erp1; - var slop = oimo_common_Setting.linearSlop; - if(isPositionPart) { - cfmFactor = 0; - erp1 = 1; - } else { - if(sd.frequency > 0) { - slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; - if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; - if(sd.useSymplecticEuler) { - cfmFactor = 1 / (h * c); - erp1 = k / c; - } else { - cfmFactor = 1 / (h * (h * k + c)); - erp1 = k / (h * k + c); - } - } else { - cfmFactor = 0; - erp1 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm.motorForce > 0) { - row.motorSpeed = lm.motorSpeed; - row.motorMaxImpulse = lm.motorForce * timeStep.dt; - } else { - row.motorSpeed = 0; - row.motorMaxImpulse = 0; - } - } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var minImp; - var maxImp; - var error; - if(lower > upper) { - minImp = 0; - maxImp = 0; - error = 0; - } else if(lower == upper) { - minImp = -1.0 / 0.0; - maxImp = 1.0 / 0.0; - error = diff - lower; - } else if(diff < lower) { - minImp = -1.0 / 0.0; - maxImp = 0; - error = diff - lower + slop; - if(error > 0) { - error = 0; - } - } else if(diff > upper) { - minImp = 0; - maxImp = 1.0 / 0.0; - error = diff - upper - slop; - if(error < 0) { - error = 0; - } - } else { - minImp = 0; - maxImp = 0; - error = 0; - } - var invMass = motorMass == 0 ? 0 : 1 / motorMass; - row.minImpulse = minImp; - row.maxImpulse = maxImp; - row.cfm = cfmFactor * invMass; - row.rhs = error * erp1; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translation,this._lm,1 / (this._b1._invMass + this._b2._invMass),this._sd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; j.lin1Y = this._basis.xY; @@ -27241,16 +25612,16 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.lin2X = this._basis.xX; j.lin2Y = this._basis.xY; j.lin2Z = this._basis.xZ; - j.ang1X = crossR100; - j.ang1Y = crossR101; - j.ang1Z = crossR102; - j.ang2X = crossR200; - j.ang2Y = crossR201; - j.ang2Z = crossR202; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -27263,76 +25634,74 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row = row2; - row.rhs = linRhsY; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; j.lin1X = this._basis.yX; j.lin1Y = this._basis.yY; j.lin1Z = this._basis.yZ; j.lin2X = this._basis.yX; j.lin2Y = this._basis.yY; j.lin2Z = this._basis.yZ; - j.ang1X = crossR110; - j.ang1Y = crossR111; - j.ang1Z = crossR112; - j.ang2X = crossR210; - j.ang2Y = crossR211; - j.ang2Z = crossR212; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; _this2.lin2X = 0; _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row = row3; - row.rhs = linRhsZ; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; j.lin2X = this._basis.zX; j.lin2Y = this._basis.zY; j.lin2Z = this._basis.zZ; - j.ang1X = crossR120; - j.ang1Y = crossR121; - j.ang1Z = crossR122; - j.ang2X = crossR220; - j.ang2Y = crossR221; - j.ang2Z = crossR222; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -27345,20 +25714,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row = row4; - row.rhs = angRhsX; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsX; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; j.ang1X = 1; j.ang1Y = 0; j.ang1Z = 0; @@ -27366,8 +25734,8 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = 0; j.ang2Z = 0; var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -27380,20 +25748,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row = row5; - row.rhs = angRhsY; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = 0; j.ang1Y = 1; j.ang1Z = 0; @@ -27401,8 +25768,8 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = 1; j.ang2Z = 0; var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; _this5.lin1X = 0; _this5.lin1Y = 0; _this5.lin1Z = 0; @@ -27415,20 +25782,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this5.ang2X = 0; _this5.ang2Y = 0; _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row = row6; - row.rhs = angRhsZ; - row.cfm = 0; - row.minImpulse = -1.0 / 0.0; - row.maxImpulse = 1.0 / 0.0; - j = row.jacobian; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; j.ang1X = 0; j.ang1Y = 0; j.ang1Z = 1; @@ -27441,22 +25807,18 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ var _this = this._basis; var invM1 = _this.joint._b1._invMass; var invM2 = _this.joint._b2._invMass; - var q; var qX; var qY; var qZ; var qW; - var idQ; var idQX; var idQY; var idQZ; var idQW; - var slerpQ; var slerpQX; var slerpQY; var slerpQZ; var slerpQW; - var slerpM; var slerpM00; var slerpM01; var slerpM02; @@ -27466,23 +25828,18 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ var slerpM20; var slerpM21; var slerpM22; - var newX; var newXX; var newXY; var newXZ; - var newY; var newYX; var newYY; var newYZ; - var newZ; var newZX; var newZY; var newZZ; - var prevX; var prevXX; var prevXY; var prevXZ; - var prevY; var prevYX; var prevYY; var prevYZ; @@ -27546,10 +25903,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; var q1X; var q1Y; var q1Z; @@ -27805,7 +26158,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var rot1; var rot100; var rot101; var rot102; @@ -27815,7 +26167,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ var rot120; var rot121; var rot122; - var rot2; var rot200; var rot201; var rot202; @@ -27843,7 +26194,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot; var relRot00; var relRot01; var relRot02; @@ -27880,7 +26230,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ relRot20 = __tmp__20; relRot21 = __tmp__21; relRot22 = __tmp__22; - var relQ; var relQX; var relQY; var relQZ; @@ -27943,7 +26292,6 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ this.angularErrorX *= theta1; this.angularErrorY *= theta1; this.angularErrorZ *= theta1; - var anchorDiff; var anchorDiffX; var anchorDiffY; var anchorDiffZ; @@ -27964,59 +26312,51 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ } ,getAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } ,getAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } ,getAxis1To: function(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } ,getAxis2To: function(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } ,getLocalAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } ,getLocalAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } ,getLocalAxis1To: function(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } ,getLocalAxis2To: function(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } ,getSpringDamper: function() { return this._sd; @@ -28039,14 +26379,13 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.__super__ = oimo_dynamics_co oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; + var localVector = this.localAxis1; var vX; var vY; var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -28056,18 +26395,16 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dyn vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; var vX1; var vY1; var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; @@ -28077,10 +26414,9 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dyn vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } }); @@ -28098,191 +26434,7 @@ var oimo_dynamics_constraint_joint_RagdollJoint = function(config) { this._localBasisX2X = v2.x; this._localBasisX2Y = v2.y; this._localBasisX2Z = v2.z; - if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { - this._localBasisX1X = 1; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._localBasisX1X *= l; - this._localBasisX1Y *= l; - this._localBasisX1Z *= l; - } - this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; - this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; - this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; - if(x2 < y2) { - if(x2 < z2) { - d = 1 / Math.sqrt(y2 + z2); - this._localBasisY1X = 0; - this._localBasisY1Y = z1 * d; - this._localBasisY1Z = -y1 * d; - } else { - d = 1 / Math.sqrt(x2 + y2); - this._localBasisY1X = y1 * d; - this._localBasisY1Y = -x1 * d; - this._localBasisY1Z = 0; - } - } else if(y2 < z2) { - d = 1 / Math.sqrt(z2 + x2); - this._localBasisY1X = -z1 * d; - this._localBasisY1Y = 0; - this._localBasisY1Z = x1 * d; - } else { - d = 1 / Math.sqrt(x2 + y2); - this._localBasisY1X = y1 * d; - this._localBasisY1Y = -x1 * d; - this._localBasisY1Z = 0; - } - this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; - this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; - this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - } else { - var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisZ1X *= l1; - this._localBasisZ1Y *= l1; - this._localBasisZ1Z *= l1; - this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; - this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; - this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; - } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d1 < -0.999999999) { - var vX; - var vY; - var vZ; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d2; - if(x21 < y21) { - if(x21 < z21) { - d2 = 1 / Math.sqrt(y21 + z21); - vX = 0; - vY = z11 * d2; - vZ = -y11 * d2; - } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; - vZ = 0; - } - } else if(y21 < z21) { - d2 = 1 / Math.sqrt(z21 + x21); - vX = -z11 * d2; - vY = 0; - vZ = x11 * d2; - } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; - vZ = 0; - } - slerpQX = vX; - slerpQY = vY; - slerpQZ = vZ; - slerpQW = 0; - } else { - var cX; - var cY; - var cZ; - cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; - cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; - cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d1) * 0.5); - d1 = 0.5 / w; - cX *= d1; - cY *= d1; - cZ *= d1; - slerpQX = cX; - slerpQY = cY; - slerpQZ = cZ; - slerpQW = w; - } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x22 = 2 * x; - var y22 = 2 * y; - var z22 = 2 * z; - var xx = x * x22; - var yy = y * y22; - var zz = z * z22; - var xy = x * y22; - var yz = y * z22; - var xz = x * z22; - var wx = w1 * x22; - var wy = w1 * y22; - var wz = w1 * z22; - slerpM00 = 1 - yy - zz; - slerpM01 = xy - wz; - slerpM02 = xz + wy; - slerpM10 = xy + wz; - slerpM11 = 1 - xx - zz; - slerpM12 = yz - wx; - slerpM20 = xz - wy; - slerpM21 = yz + wx; - slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; - __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; - __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; - this._localBasisX2X = __tmp__X; - this._localBasisX2Y = __tmp__Y; - this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; + this.buildLocalBasesFromXY1X2(); this._twistSd = config.twistSpringDamper.clone(); this._twistLm = config.twistLimitMotor.clone(); this._swingSd = config.swingSpringDamper.clone(); @@ -28310,185 +26462,69 @@ var oimo_dynamics_constraint_joint_RagdollJoint = function(config) { oimo_dynamics_constraint_joint_RagdollJoint.__super__ = oimo_dynamics_constraint_joint_Joint; oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ getInfo: function(info,timeStep,isPositionPart) { - var erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - var linearRhs; + var erp = this.getErp(timeStep,isPositionPart); var linearRhsX; var linearRhsY; var linearRhsZ; - linearRhsX = this.linearErrorX * erp; - linearRhsY = this.linearErrorY * erp; - linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; - crossR100 = 0; - crossR101 = -this._relativeAnchor1Z; - crossR102 = this._relativeAnchor1Y; - crossR110 = this._relativeAnchor1Z; - crossR111 = 0; - crossR112 = -this._relativeAnchor1X; - crossR120 = -this._relativeAnchor1Y; - crossR121 = this._relativeAnchor1X; - crossR122 = 0; - crossR200 = 0; - crossR201 = -this._relativeAnchor2Z; - crossR202 = this._relativeAnchor2Y; - crossR210 = this._relativeAnchor2Z; - crossR211 = 0; - crossR212 = -this._relativeAnchor2X; - crossR220 = -this._relativeAnchor2Y; - crossR221 = this._relativeAnchor2X; - crossR222 = 0; - crossR100 = -crossR100; - crossR101 = -crossR101; - crossR102 = -crossR102; - crossR110 = -crossR110; - crossR111 = -crossR111; - crossR112 = -crossR112; - crossR120 = -crossR120; - crossR121 = -crossR121; - crossR122 = -crossR122; - crossR200 = -crossR200; - crossR201 = -crossR201; - crossR202 = -crossR202; - crossR210 = -crossR210; - crossR211 = -crossR211; - crossR212 = -crossR212; - crossR220 = -crossR220; - crossR221 = -crossR221; - crossR222 = -crossR222; - var axisX = this.swingAxisX; - var axisY = this.swingAxisY; - var axisZ = this.swingAxisZ; - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; - __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; - __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; - ia1X = __tmp__X; - ia1Y = __tmp__Y; - ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; - __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; - __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; - if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = rsq - dot * dot; - if(projsq > 0) { - if(this._b1._invMass > 0) { - invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); - } else { - invI1 = 0; - } - } - } - if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = rsq1 - dot1 * dot1; - if(projsq1 > 0) { - if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); - } else { - invI2 = 0; - } - } - } - var swingMass = invI1 + invI2 == 0 ? 0 : 1 / (invI1 + invI2); - var axisX1 = this._basisX2X; - var axisY1 = this._basisX2Y; - var axisZ1 = this._basisX2Z; - var ia11; - var ia1X1; - var ia1Y1; - var ia1Z1; - var ia21; - var ia2X1; - var ia2Y1; - var ia2Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = this._b1._invInertia00 * axisX1 + this._b1._invInertia01 * axisY1 + this._b1._invInertia02 * axisZ1; - __tmp__Y2 = this._b1._invInertia10 * axisX1 + this._b1._invInertia11 * axisY1 + this._b1._invInertia12 * axisZ1; - __tmp__Z2 = this._b1._invInertia20 * axisX1 + this._b1._invInertia21 * axisY1 + this._b1._invInertia22 * axisZ1; - ia1X1 = __tmp__X2; - ia1Y1 = __tmp__Y2; - ia1Z1 = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = this._b2._invInertia00 * axisX1 + this._b2._invInertia01 * axisY1 + this._b2._invInertia02 * axisZ1; - __tmp__Y3 = this._b2._invInertia10 * axisX1 + this._b2._invInertia11 * axisY1 + this._b2._invInertia12 * axisZ1; - __tmp__Z3 = this._b2._invInertia20 * axisX1 + this._b2._invInertia21 * axisY1 + this._b2._invInertia22 * axisZ1; - ia2X1 = __tmp__X3; - ia2Y1 = __tmp__Y3; - ia2Z1 = __tmp__Z3; - var invI11 = ia1X1 * axisX1 + ia1Y1 * axisY1 + ia1Z1 * axisZ1; - var invI21 = ia2X1 * axisX1 + ia2Y1 * axisY1 + ia2Z1 * axisZ1; - if(invI11 > 0) { - var rsq2 = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot2 = axisX1 * this._relativeAnchor1X + axisY1 * this._relativeAnchor1Y + axisZ1 * this._relativeAnchor1Z; - var projsq2 = rsq2 - dot2 * dot2; - if(projsq2 > 0) { - if(this._b1._invMass > 0) { - invI11 = 1 / (1 / invI11 + this._b1._mass * projsq2); - } else { - invI11 = 0; - } - } - } - if(invI21 > 0) { - var rsq3 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot3 = axisX1 * this._relativeAnchor2X + axisY1 * this._relativeAnchor2Y + axisZ1 * this._relativeAnchor2Z; - var projsq3 = rsq3 - dot3 * dot3; - if(projsq3 > 0) { - if(this._b2._invMass > 0) { - invI21 = 1 / (1 / invI21 + this._b2._mass * projsq3); - } else { - invI21 = 0; - } - } - } - var twistMass = invI11 + invI21 == 0 ? 0 : 1 / (invI11 + invI21); + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); + var twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); var impulse = this._impulses[0]; var row = info.rows[info.numRows++]; var _this = row.jacobian; @@ -28512,12 +26548,11 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -28531,8 +26566,8 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Y = crossR201; j.ang2Z = crossR202; var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -28545,19 +26580,18 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; j = row1.jacobian; j.lin1X = 0; j.lin1Y = 1; @@ -28572,8 +26606,8 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Y = crossR211; j.ang2Z = crossR212; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -28586,20 +26620,19 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -28614,8 +26647,8 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = crossR222; if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -28628,96 +26661,16 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - var diff = this.swingError; - var lm = this.dummySwingLm; - var sd = this._swingSd; - var cfmFactor; - var erp1; - var slop = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor = 0; - erp1 = 1; - } else { - if(sd.frequency > 0) { - slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; - if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; - if(sd.useSymplecticEuler) { - cfmFactor = 1 / (h * c); - erp1 = k / c; - } else { - cfmFactor = 1 / (h * (h * k + c)); - erp1 = k / (h * k + c); - } - } else { - cfmFactor = 0; - erp1 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm.motorTorque > 0) { - row1.motorSpeed = lm.motorSpeed; - row1.motorMaxImpulse = lm.motorTorque * timeStep.dt; - } else { - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - } - } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var mid = (lower + upper) * 0.5; - diff -= mid; - diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff += mid; - var minImp; - var maxImp; - var error; - if(lower > upper) { - minImp = 0; - maxImp = 0; - error = 0; - } else if(lower == upper) { - minImp = -1.0 / 0.0; - maxImp = 1.0 / 0.0; - error = diff - lower; - } else if(diff < lower) { - minImp = -1.0 / 0.0; - maxImp = 0; - error = diff - lower + slop; - if(error > 0) { - error = 0; - } - } else if(diff > upper) { - minImp = 0; - maxImp = 1.0 / 0.0; - error = diff - upper - slop; - if(error < 0) { - error = 0; - } - } else { - minImp = 0; - maxImp = 0; - error = 0; - } - var invMass = swingMass == 0 ? 0 : 1 / swingMass; - row1.minImpulse = minImp; - row1.maxImpulse = maxImp; - row1.cfm = cfmFactor * invMass; - row1.rhs = error * erp1; - j = row1.jacobian; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row3.jacobian; j.ang1X = this.swingAxisX; j.ang1Y = this.swingAxisY; j.ang1Z = this.swingAxisZ; @@ -28727,8 +26680,8 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co } if(this._twistSd.frequency <= 0 || !isPositionPart) { var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -28741,96 +26694,16 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - var diff1 = this._twistAngle; - var lm1 = this._twistLm; - var sd1 = this._twistSd; - var cfmFactor1; - var erp2; - var slop1 = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor1 = 0; - erp2 = 1; - } else { - if(sd1.frequency > 0) { - slop1 = 0; - var omega1 = 6.28318530717958 * sd1.frequency; - var zeta1 = sd1.dampingRatio; - if(zeta1 < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta1 = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h1 = timeStep.dt; - var c1 = 2 * zeta1 * omega1; - var k1 = omega1 * omega1; - if(sd1.useSymplecticEuler) { - cfmFactor1 = 1 / (h1 * c1); - erp2 = k1 / c1; - } else { - cfmFactor1 = 1 / (h1 * (h1 * k1 + c1)); - erp2 = k1 / (h1 * k1 + c1); - } - } else { - cfmFactor1 = 0; - erp2 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm1.motorTorque > 0) { - row1.motorSpeed = lm1.motorSpeed; - row1.motorMaxImpulse = lm1.motorTorque * timeStep.dt; - } else { - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - } - } - var lower1 = lm1.lowerLimit; - var upper1 = lm1.upperLimit; - var mid1 = (lower1 + upper1) * 0.5; - diff1 -= mid1; - diff1 = ((diff1 + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff1 += mid1; - var minImp1; - var maxImp1; - var error1; - if(lower1 > upper1) { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } else if(lower1 == upper1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - lower1; - } else if(diff1 < lower1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 0; - error1 = diff1 - lower1 + slop1; - if(error1 > 0) { - error1 = 0; - } - } else if(diff1 > upper1) { - minImp1 = 0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - upper1 - slop1; - if(error1 < 0) { - error1 = 0; - } - } else { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } - var invMass1 = twistMass == 0 ? 0 : 1 / twistMass; - row1.minImpulse = minImp1; - row1.maxImpulse = maxImp1; - row1.cfm = cfmFactor1 * invMass1; - row1.rhs = error1 * erp2; - j = row1.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + this.setSolverInfoRowAngular(row4,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row4.jacobian; j.ang1X = this.twistAxisX; j.ang1Y = this.twistAxisY; j.ang1Z = this.twistAxisZ; @@ -28841,13 +26714,9 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co } ,_syncAnchors: function() { oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var axis1; var axis1X; var axis1Y; var axis1Z; - var axis2; var axis2X; var axis2Y; var axis2Z; @@ -28857,7 +26726,6 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co axis2X = this._basisX2X; axis2Y = this._basisX2Y; axis2Z = this._basisX2Z; - var basis1Mat; var basis1Mat00; var basis1Mat01; var basis1Mat02; @@ -28867,16 +26735,6 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co var basis1Mat20; var basis1Mat21; var basis1Mat22; - var basis2Mat; - var basis2Mat00; - var basis2Mat01; - var basis2Mat02; - var basis2Mat10; - var basis2Mat11; - var basis2Mat12; - var basis2Mat20; - var basis2Mat21; - var basis2Mat22; basis1Mat00 = this._basisX1X; basis1Mat01 = this._basisY1X; basis1Mat02 = this._basisZ1X; @@ -28886,21 +26744,10 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co basis1Mat20 = this._basisX1Z; basis1Mat21 = this._basisY1Z; basis1Mat22 = this._basisZ1Z; - basis2Mat00 = this._basisX2X; - basis2Mat01 = this._basisY2X; - basis2Mat02 = this._basisZ2X; - basis2Mat10 = this._basisX2Y; - basis2Mat11 = this._basisY2Y; - basis2Mat12 = this._basisZ2Y; - basis2Mat20 = this._basisX2Z; - basis2Mat21 = this._basisY2Z; - basis2Mat22 = this._basisZ2Z; - var swingQ; var swingQX; var swingQY; var swingQZ; var swingQW; - var swingM; var swingM00; var swingM01; var swingM02; @@ -28910,7 +26757,6 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co var swingM20; var swingM21; var swingM22; - var swingV; var swingVX; var swingVY; var swingVZ; @@ -28999,7 +26845,6 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co swingVX = swingQX; swingVY = swingQY; swingVZ = swingQZ; - var basisY2In1; var basisY2In1X; var basisY2In1Y; var basisY2In1Z; @@ -29012,9 +26857,7 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co basisY2In1X = __tmp__X; basisY2In1Y = __tmp__Y; basisY2In1Z = __tmp__Z; - var yCoord = this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z; - var zCoord = this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z; - this._twistAngle = Math.atan2(zCoord,yCoord); + this._twistAngle = Math.atan2(this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z,this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z); this.twistAxisX = this._basisX1X + this._basisX2X; this.twistAxisY = this._basisX1Y + this._basisX2Y; this.twistAxisZ = this._basisX1Z + this._basisX2Z; @@ -29104,59 +26947,51 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co } ,getAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } ,getAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } ,getAxis1To: function(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } ,getAxis2To: function(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } ,getLocalAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } ,getLocalAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } ,getLocalAxis1To: function(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } ,getLocalAxis2To: function(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } ,getTwistSpringDamper: function() { return this._twistSd; @@ -29169,17 +27004,15 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co } ,getSwingAxis: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this.swingAxisX; - v1.y = this.swingAxisY; - v1.z = this.swingAxisZ; - return v; - } - ,getSwingAxisTo: function(axis) { - var v = axis; v.x = this.swingAxisX; v.y = this.swingAxisY; v.z = this.swingAxisZ; + return v; + } + ,getSwingAxisTo: function(axis) { + axis.x = this.swingAxisX; + axis.y = this.swingAxisY; + axis.z = this.swingAxisZ; } ,getSwingAngle: function() { return this._swingAngle; @@ -29203,14 +27036,13 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.__super__ = oimo_dynamics_cons oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ init: function(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; + var localVector = this.localTwistAxis1; var vX; var vY; var vZ; - var v1 = worldTwistAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldTwistAxis.x; + vY = worldTwistAxis.y; + vZ = worldTwistAxis.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -29220,18 +27052,16 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localTwistAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localTwistAxis2; var vX1; var vY1; var vZ1; - var v4 = worldTwistAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; + vX1 = worldTwistAxis.x; + vY1 = worldTwistAxis.y; + vZ1 = worldTwistAxis.z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; @@ -29241,18 +27071,16 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localTwistAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; - var v6; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + var localVector2 = this.localSwingAxis1; var vX2; var vY2; var vZ2; - var v7 = worldSwingAxis; - vX2 = v7.x; - vY2 = v7.y; - vZ2 = v7.z; + vX2 = worldSwingAxis.x; + vY2 = worldSwingAxis.y; + vZ2 = worldSwingAxis.z; var __tmp__X2; var __tmp__Y2; var __tmp__Z2; @@ -29262,10 +27090,9 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam vX2 = __tmp__X2; vY2 = __tmp__Y2; vZ2 = __tmp__Z2; - var v8 = this.localSwingAxis1; - v8.x = vX2; - v8.y = vY2; - v8.z = vZ2; + localVector2.x = vX2; + localVector2.y = vY2; + localVector2.z = vZ2; return this; } }); @@ -29279,212 +27106,26 @@ var oimo_dynamics_constraint_joint_RevoluteJoint = function(config) { this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; - if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { - this._localBasisX1X = 1; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._localBasisX1X *= l; - this._localBasisX1Y *= l; - this._localBasisX1Z *= l; - } - if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { - this._localBasisX2X = 1; - this._localBasisX2Y = 0; - this._localBasisX2Z = 0; - } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; - } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; - if(x2 < y2) { - if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); - vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; - vY = 0; - vZ = x1 * d1; - } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; - vZ = 0; - } - slerpQX = vX; - slerpQY = vY; - slerpQZ = vZ; - slerpQW = 0; - } else { - var cX; - var cY; - var cZ; - cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; - cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; - cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d) * 0.5); - d = 0.5 / w; - cX *= d; - cY *= d; - cZ *= d; - slerpQX = cX; - slerpQY = cY; - slerpQZ = cZ; - slerpQW = w; - } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; - slerpM00 = 1 - yy - zz; - slerpM01 = xy - wz; - slerpM02 = xz + wy; - slerpM10 = xy + wz; - slerpM11 = 1 - xx - zz; - slerpM12 = yz - wx; - slerpM20 = xz - wy; - slerpM21 = yz + wx; - slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); - this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; - this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; - } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; - this._localBasisY1Z = 0; - } - this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; - this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; - this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; - __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; - __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; - this._localBasisX2X = __tmp__X; - this._localBasisX2Y = __tmp__Y; - this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; + this.buildLocalBasesFromX(); this.angle = 0; this.angularErrorY = 0; this.angularErrorZ = 0; - this._basis = new oimo_dynamics_constraint_joint_JointBasis(this); + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); this._sd = config.springDamper.clone(); this._lm = config.limitMotor.clone(); }; oimo_dynamics_constraint_joint_RevoluteJoint.__super__ = oimo_dynamics_constraint_joint_Joint; oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ getInfo: function(info,timeStep,isPositionPart) { - var erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - var linearRhs; + var erp = this.getErp(timeStep,isPositionPart); var linearRhsX; var linearRhsY; var linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; var angRhsY = this.angularErrorY * erp; var angRhsZ = this.angularErrorZ * erp; - var crossR1; var crossR100; var crossR101; var crossR102; @@ -29494,7 +27135,6 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c var crossR120; var crossR121; var crossR122; - var crossR2; var crossR200; var crossR201; var crossR202; @@ -29530,72 +27170,17 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c crossR112 = -crossR112; crossR120 = -crossR120; crossR121 = -crossR121; - crossR122 = -crossR122; - crossR200 = -crossR200; - crossR201 = -crossR201; - crossR202 = -crossR202; - crossR210 = -crossR210; - crossR211 = -crossR211; - crossR212 = -crossR212; - crossR220 = -crossR220; - crossR221 = -crossR221; - crossR222 = -crossR222; - var axisX = this._basis.xX; - var axisY = this._basis.xY; - var axisZ = this._basis.xZ; - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; - __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; - __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; - ia1X = __tmp__X; - ia1Y = __tmp__Y; - ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; - __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; - __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; - if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = rsq - dot * dot; - if(projsq > 0) { - if(this._b1._invMass > 0) { - invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); - } else { - invI1 = 0; - } - } - } - if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = rsq1 - dot1 * dot1; - if(projsq1 > 0) { - if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); - } else { - invI2 = 0; - } - } - } - var motorMass = invI1 + invI2 == 0 ? 0 : 1 / (invI1 + invI2); + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); var impulse = this._impulses[0]; var row = info.rows[info.numRows++]; var _this = row.jacobian; @@ -29619,12 +27204,11 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -29638,8 +27222,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = crossR201; j.ang2Z = crossR202; var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -29652,19 +27236,18 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; j = row1.jacobian; j.lin1X = 0; j.lin1Y = 1; @@ -29679,8 +27262,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = crossR211; j.ang2Z = crossR212; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -29693,20 +27276,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -29721,8 +27303,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Z = crossR222; if(this._sd.frequency <= 0 || !isPositionPart) { var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -29735,96 +27317,16 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - var diff = this.angle; - var lm = this._lm; - var sd = this._sd; - var cfmFactor; - var erp1; - var slop = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor = 0; - erp1 = 1; - } else { - if(sd.frequency > 0) { - slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; - if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; - if(sd.useSymplecticEuler) { - cfmFactor = 1 / (h * c); - erp1 = k / c; - } else { - cfmFactor = 1 / (h * (h * k + c)); - erp1 = k / (h * k + c); - } - } else { - cfmFactor = 0; - erp1 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm.motorTorque > 0) { - row1.motorSpeed = lm.motorSpeed; - row1.motorMaxImpulse = lm.motorTorque * timeStep.dt; - } else { - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - } - } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var mid = (lower + upper) * 0.5; - diff -= mid; - diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff += mid; - var minImp; - var maxImp; - var error; - if(lower > upper) { - minImp = 0; - maxImp = 0; - error = 0; - } else if(lower == upper) { - minImp = -1.0 / 0.0; - maxImp = 1.0 / 0.0; - error = diff - lower; - } else if(diff < lower) { - minImp = -1.0 / 0.0; - maxImp = 0; - error = diff - lower + slop; - if(error > 0) { - error = 0; - } - } else if(diff > upper) { - minImp = 0; - maxImp = 1.0 / 0.0; - error = diff - upper - slop; - if(error < 0) { - error = 0; - } - } else { - minImp = 0; - maxImp = 0; - error = 0; - } - var invMass = motorMass == 0 ? 0 : 1 / motorMass; - row1.minImpulse = minImp; - row1.maxImpulse = maxImp; - row1.cfm = cfmFactor * invMass; - row1.rhs = error * erp1; - j = row1.jacobian; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row3.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -29833,8 +27335,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Z = this._basis.xZ; } var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -29847,20 +27349,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - row1.rhs = angRhsY; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; @@ -29868,8 +27369,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; _this5.lin1X = 0; _this5.lin1Y = 0; _this5.lin1Z = 0; @@ -29882,20 +27383,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this5.ang2X = 0; _this5.ang2Y = 0; _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row1 = row6; - row1.rhs = angRhsZ; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -29908,22 +27408,18 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c var _this = this._basis; var invM1 = _this.joint._b1._invMass; var invM2 = _this.joint._b2._invMass; - var q; var qX; var qY; var qZ; var qW; - var idQ; var idQX; var idQY; var idQZ; var idQW; - var slerpQ; var slerpQX; var slerpQY; var slerpQZ; var slerpQW; - var slerpM; var slerpM00; var slerpM01; var slerpM02; @@ -29933,23 +27429,18 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c var slerpM20; var slerpM21; var slerpM22; - var newX; var newXX; var newXY; var newXZ; - var newY; var newYX; var newYY; var newYZ; - var newZ; var newZX; var newZY; var newZZ; - var prevX; var prevXX; var prevXY; var prevXZ; - var prevY; var prevYX; var prevYY; var prevYZ; @@ -30013,10 +27504,6 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; var q1X; var q1Y; var q1Z; @@ -30272,7 +27759,6 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var angError; var angErrorX; var angErrorY; var angErrorZ; @@ -30293,7 +27779,6 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c angErrorZ *= theta1; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCross; var perpCrossX; var perpCrossY; var perpCrossZ; @@ -30319,59 +27804,51 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c } ,getAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } ,getAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } ,getAxis1To: function(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } ,getAxis2To: function(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } ,getLocalAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } ,getLocalAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } ,getLocalAxis1To: function(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } ,getLocalAxis2To: function(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } ,getSpringDamper: function() { return this._sd; @@ -30394,14 +27871,13 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.__super__ = oimo_dynamics_con oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; + var localVector = this.localAxis1; var vX; var vY; var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -30411,18 +27887,16 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dyna vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; var vX1; var vY1; var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; @@ -30432,10 +27906,9 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dyna vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } }); @@ -30474,7 +27947,6 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ if(this._sd.frequency > 0 && isPositionPart) { return; } - var error; var errorX; var errorY; var errorZ; @@ -30502,19 +27974,14 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ cfm *= this._b1._invMass + this._b2._invMass; } else { cfm = 0; - erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; + erp = this.getErp(timeStep,isPositionPart); } - var linearRhs; var linearRhsX; var linearRhsY; var linearRhsZ; linearRhsX = errorX * erp; linearRhsY = errorY * erp; linearRhsZ = errorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var crossR1; var crossR100; var crossR101; var crossR102; @@ -30524,7 +27991,6 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ var crossR120; var crossR121; var crossR122; - var crossR2; var crossR200; var crossR201; var crossR202; @@ -30593,12 +28059,11 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = cfm; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = cfm; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -30612,8 +28077,8 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR201; j.ang2Z = crossR202; var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -30626,19 +28091,18 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = cfm; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; j = row1.jacobian; j.lin1X = 0; j.lin1Y = 1; @@ -30653,8 +28117,8 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR211; j.ang2Z = crossR212; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -30667,20 +28131,19 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = cfm; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = cfm; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -30775,167 +28238,7 @@ var oimo_dynamics_constraint_joint_UniversalJoint = function(config) { this._localBasisZ2X = v1.x; this._localBasisZ2Y = v1.y; this._localBasisZ2Z = v1.z; - if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { - this._localBasisX1X = 1; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._localBasisX1X *= l; - this._localBasisX1Y *= l; - this._localBasisX1Z *= l; - } - if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { - this._localBasisZ2X = 0; - this._localBasisZ2Y = 0; - this._localBasisZ2Z = 1; - } else { - var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisZ2X *= l1; - this._localBasisZ2Y *= l1; - this._localBasisZ2Z *= l1; - } - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var worldX1; - var worldX1X; - var worldX1Y; - var worldX1Z; - var worldZ1; - var worldZ1X; - var worldZ1Y; - var worldZ1Z; - var worldY; - var worldYX; - var worldYY; - var worldYZ; - var worldX2; - var worldX2X; - var worldX2Y; - var worldX2Z; - var worldZ2; - var worldZ2X; - var worldZ2Y; - var worldZ2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; - __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; - __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; - worldX1X = __tmp__X; - worldX1Y = __tmp__Y; - worldX1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; - __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; - __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; - worldZ2X = __tmp__X1; - worldZ2Y = __tmp__Y1; - worldZ2Z = __tmp__Z1; - worldYX = worldZ2Y * worldX1Z - worldZ2Z * worldX1Y; - worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; - worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; - if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { - var x1 = worldX1X; - var y1 = worldX1Y; - var z1 = worldX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; - if(x2 < y2) { - if(x2 < z2) { - d = 1 / Math.sqrt(y2 + z2); - worldYX = 0; - worldYY = z1 * d; - worldYZ = -y1 * d; - } else { - d = 1 / Math.sqrt(x2 + y2); - worldYX = y1 * d; - worldYY = -x1 * d; - worldYZ = 0; - } - } else if(y2 < z2) { - d = 1 / Math.sqrt(z2 + x2); - worldYX = -z1 * d; - worldYY = 0; - worldYZ = x1 * d; - } else { - d = 1 / Math.sqrt(x2 + y2); - worldYX = y1 * d; - worldYY = -x1 * d; - worldYZ = 0; - } - } - worldZ1X = worldX1Y * worldYZ - worldX1Z * worldYY; - worldZ1Y = worldX1Z * worldYX - worldX1X * worldYZ; - worldZ1Z = worldX1X * worldYY - worldX1Y * worldYX; - worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; - worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; - worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; - __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; - __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; - this._localBasisX1X = __tmp__X2; - this._localBasisX1Y = __tmp__Y2; - this._localBasisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; - __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; - __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; - this._localBasisY1X = __tmp__X3; - this._localBasisY1Y = __tmp__Y3; - this._localBasisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; - __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; - __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; - this._localBasisZ1X = __tmp__X4; - this._localBasisZ1Y = __tmp__Y4; - this._localBasisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; - __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; - __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; - __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; - this._localBasisX2X = __tmp__X5; - this._localBasisX2Y = __tmp__Y5; - this._localBasisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; - __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; - __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; - this._localBasisY2X = __tmp__X6; - this._localBasisY2Y = __tmp__Y6; - this._localBasisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; - __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; - __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; - this._localBasisZ2X = __tmp__X7; - this._localBasisZ2Y = __tmp__Y7; - this._localBasisZ2Z = __tmp__Z7; + this.buildLocalBasesFromX1Z2(); this._angleX = 0; this._angleY = 0; this._angleZ = 0; @@ -30950,19 +28253,14 @@ var oimo_dynamics_constraint_joint_UniversalJoint = function(config) { oimo_dynamics_constraint_joint_UniversalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ getInfo: function(info,timeStep,isPositionPart) { - var erp = isPositionPart ? 1 : this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - var linearRhs; + var erp = this.getErp(timeStep,isPositionPart); var linearRhsX; var linearRhsY; var linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; var angRhsY = this._angleY * erp; - var crossR1; var crossR100; var crossR101; var crossR102; @@ -30972,7 +28270,6 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ var crossR120; var crossR121; var crossR122; - var crossR2; var crossR200; var crossR201; var crossR202; @@ -30993,143 +28290,33 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ crossR122 = 0; crossR200 = 0; crossR201 = -this._relativeAnchor2Z; - crossR202 = this._relativeAnchor2Y; - crossR210 = this._relativeAnchor2Z; - crossR211 = 0; - crossR212 = -this._relativeAnchor2X; - crossR220 = -this._relativeAnchor2Y; - crossR221 = this._relativeAnchor2X; - crossR222 = 0; - crossR100 = -crossR100; - crossR101 = -crossR101; - crossR102 = -crossR102; - crossR110 = -crossR110; - crossR111 = -crossR111; - crossR112 = -crossR112; - crossR120 = -crossR120; - crossR121 = -crossR121; - crossR122 = -crossR122; - crossR200 = -crossR200; - crossR201 = -crossR201; - crossR202 = -crossR202; - crossR210 = -crossR210; - crossR211 = -crossR211; - crossR212 = -crossR212; - crossR220 = -crossR220; - crossR221 = -crossR221; - crossR222 = -crossR222; - var axisX = this._axisXX; - var axisY = this._axisXY; - var axisZ = this._axisXZ; - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; - __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; - __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; - ia1X = __tmp__X; - ia1Y = __tmp__Y; - ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; - __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; - __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; - if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = rsq - dot * dot; - if(projsq > 0) { - if(this._b1._invMass > 0) { - invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); - } else { - invI1 = 0; - } - } - } - if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = rsq1 - dot1 * dot1; - if(projsq1 > 0) { - if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); - } else { - invI2 = 0; - } - } - } - var motorMassX = invI1 + invI2 == 0 ? 0 : 1 / (invI1 + invI2); - var axisX1 = this._axisZX; - var axisY1 = this._axisZY; - var axisZ1 = this._axisZZ; - var ia11; - var ia1X1; - var ia1Y1; - var ia1Z1; - var ia21; - var ia2X1; - var ia2Y1; - var ia2Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = this._b1._invInertia00 * axisX1 + this._b1._invInertia01 * axisY1 + this._b1._invInertia02 * axisZ1; - __tmp__Y2 = this._b1._invInertia10 * axisX1 + this._b1._invInertia11 * axisY1 + this._b1._invInertia12 * axisZ1; - __tmp__Z2 = this._b1._invInertia20 * axisX1 + this._b1._invInertia21 * axisY1 + this._b1._invInertia22 * axisZ1; - ia1X1 = __tmp__X2; - ia1Y1 = __tmp__Y2; - ia1Z1 = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = this._b2._invInertia00 * axisX1 + this._b2._invInertia01 * axisY1 + this._b2._invInertia02 * axisZ1; - __tmp__Y3 = this._b2._invInertia10 * axisX1 + this._b2._invInertia11 * axisY1 + this._b2._invInertia12 * axisZ1; - __tmp__Z3 = this._b2._invInertia20 * axisX1 + this._b2._invInertia21 * axisY1 + this._b2._invInertia22 * axisZ1; - ia2X1 = __tmp__X3; - ia2Y1 = __tmp__Y3; - ia2Z1 = __tmp__Z3; - var invI11 = ia1X1 * axisX1 + ia1Y1 * axisY1 + ia1Z1 * axisZ1; - var invI21 = ia2X1 * axisX1 + ia2Y1 * axisY1 + ia2Z1 * axisZ1; - if(invI11 > 0) { - var rsq2 = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot2 = axisX1 * this._relativeAnchor1X + axisY1 * this._relativeAnchor1Y + axisZ1 * this._relativeAnchor1Z; - var projsq2 = rsq2 - dot2 * dot2; - if(projsq2 > 0) { - if(this._b1._invMass > 0) { - invI11 = 1 / (1 / invI11 + this._b1._mass * projsq2); - } else { - invI11 = 0; - } - } - } - if(invI21 > 0) { - var rsq3 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot3 = axisX1 * this._relativeAnchor2X + axisY1 * this._relativeAnchor2Y + axisZ1 * this._relativeAnchor2Z; - var projsq3 = rsq3 - dot3 * dot3; - if(projsq3 > 0) { - if(this._b2._invMass > 0) { - invI21 = 1 / (1 / invI21 + this._b2._mass * projsq3); - } else { - invI21 = 0; - } - } - } - var motorMassZ = invI11 + invI21 == 0 ? 0 : 1 / (invI11 + invI21); + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); var impulse = this._impulses[0]; var row = info.rows[info.numRows++]; var _this = row.jacobian; @@ -31153,12 +28340,11 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -31172,8 +28358,8 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR201; j.ang2Z = crossR202; var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -31186,19 +28372,18 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; j = row1.jacobian; j.lin1X = 0; j.lin1Y = 1; @@ -31213,8 +28398,8 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR211; j.ang2Z = crossR212; var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -31227,20 +28412,19 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -31255,8 +28439,8 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = crossR222; if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -31269,96 +28453,16 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - var diff = this._angleX; - var lm = this._lm1; - var sd = this._sd1; - var cfmFactor; - var erp1; - var slop = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor = 0; - erp1 = 1; - } else { - if(sd.frequency > 0) { - slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; - if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; - if(sd.useSymplecticEuler) { - cfmFactor = 1 / (h * c); - erp1 = k / c; - } else { - cfmFactor = 1 / (h * (h * k + c)); - erp1 = k / (h * k + c); - } - } else { - cfmFactor = 0; - erp1 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm.motorTorque > 0) { - row1.motorSpeed = lm.motorSpeed; - row1.motorMaxImpulse = lm.motorTorque * timeStep.dt; - } else { - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - } - } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var mid = (lower + upper) * 0.5; - diff -= mid; - diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff += mid; - var minImp; - var maxImp; - var error; - if(lower > upper) { - minImp = 0; - maxImp = 0; - error = 0; - } else if(lower == upper) { - minImp = -1.0 / 0.0; - maxImp = 1.0 / 0.0; - error = diff - lower; - } else if(diff < lower) { - minImp = -1.0 / 0.0; - maxImp = 0; - error = diff - lower + slop; - if(error > 0) { - error = 0; - } - } else if(diff > upper) { - minImp = 0; - maxImp = 1.0 / 0.0; - error = diff - upper - slop; - if(error < 0) { - error = 0; - } - } else { - minImp = 0; - maxImp = 0; - error = 0; - } - var invMass = motorMassX == 0 ? 0 : 1 / motorMassX; - row1.minImpulse = minImp; - row1.maxImpulse = maxImp; - row1.cfm = cfmFactor * invMass; - row1.rhs = error * erp1; - j = row1.jacobian; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row3.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -31368,8 +28472,8 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ } if(!this.ySingular) { var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -31382,20 +28486,19 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - row1.rhs = angRhsY; - row1.cfm = 0; - row1.minImpulse = -1.0 / 0.0; - row1.maxImpulse = 1.0 / 0.0; - j = row1.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -31405,8 +28508,8 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ } if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; _this5.lin1X = 0; _this5.lin1Y = 0; _this5.lin1Z = 0; @@ -31419,96 +28522,16 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ _this5.ang2X = 0; _this5.ang2Y = 0; _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row1 = row6; - var diff1 = this._angleZ; - var lm1 = this._lm2; - var sd1 = this._sd2; - var cfmFactor1; - var erp2; - var slop1 = oimo_common_Setting.angularSlop; - if(isPositionPart) { - cfmFactor1 = 0; - erp2 = 1; - } else { - if(sd1.frequency > 0) { - slop1 = 0; - var omega1 = 6.28318530717958 * sd1.frequency; - var zeta1 = sd1.dampingRatio; - if(zeta1 < oimo_common_Setting.minSpringDamperDampingRatio) { - zeta1 = oimo_common_Setting.minSpringDamperDampingRatio; - } - var h1 = timeStep.dt; - var c1 = 2 * zeta1 * omega1; - var k1 = omega1 * omega1; - if(sd1.useSymplecticEuler) { - cfmFactor1 = 1 / (h1 * c1); - erp2 = k1 / c1; - } else { - cfmFactor1 = 1 / (h1 * (h1 * k1 + c1)); - erp2 = k1 / (h1 * k1 + c1); - } - } else { - cfmFactor1 = 0; - erp2 = this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? timeStep.invDt * oimo_common_Setting.velocityBaumgarte : 0; - } - if(lm1.motorTorque > 0) { - row1.motorSpeed = lm1.motorSpeed; - row1.motorMaxImpulse = lm1.motorTorque * timeStep.dt; - } else { - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - } - } - var lower1 = lm1.lowerLimit; - var upper1 = lm1.upperLimit; - var mid1 = (lower1 + upper1) * 0.5; - diff1 -= mid1; - diff1 = ((diff1 + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; - diff1 += mid1; - var minImp1; - var maxImp1; - var error1; - if(lower1 > upper1) { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } else if(lower1 == upper1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - lower1; - } else if(diff1 < lower1) { - minImp1 = -1.0 / 0.0; - maxImp1 = 0; - error1 = diff1 - lower1 + slop1; - if(error1 > 0) { - error1 = 0; - } - } else if(diff1 > upper1) { - minImp1 = 0; - maxImp1 = 1.0 / 0.0; - error1 = diff1 - upper1 - slop1; - if(error1 < 0) { - error1 = 0; - } - } else { - minImp1 = 0; - maxImp1 = 0; - error1 = 0; - } - var invMass1 = motorMassZ == 0 ? 0 : 1 / motorMassZ; - row1.minImpulse = minImp1; - row1.maxImpulse = maxImp1; - row1.cfm = cfmFactor1 * invMass1; - row1.rhs = error1 * erp2; - j = row1.jacobian; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + this.setSolverInfoRowAngular(row5,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row5.jacobian; j.ang1X = this._axisZX; j.ang1Y = this._axisZY; j.ang1Z = this._axisZZ; @@ -31519,7 +28542,57 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ } ,_syncAnchors: function() { oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var rot1; + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; var rot100; var rot101; var rot102; @@ -31529,7 +28602,6 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ var rot120; var rot121; var rot122; - var rot2; var rot200; var rot201; var rot202; @@ -31557,194 +28629,52 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot; var relRot00; var relRot01; var relRot02; - var relRot10; var relRot11; var relRot12; - var relRot20; var relRot21; var relRot22; var __tmp__00; var __tmp__01; var __tmp__02; - var __tmp__10; var __tmp__11; var __tmp__12; - var __tmp__20; var __tmp__21; var __tmp__22; __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; - __tmp__10 = rot101 * rot200 + rot111 * rot210 + rot121 * rot220; __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; - __tmp__20 = rot102 * rot200 + rot112 * rot210 + rot122 * rot220; __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; relRot00 = __tmp__00; relRot01 = __tmp__01; relRot02 = __tmp__02; - relRot10 = __tmp__10; relRot11 = __tmp__11; relRot12 = __tmp__12; - relRot20 = __tmp__20; relRot21 = __tmp__21; relRot22 = __tmp__22; - var angleAxisX; - var angleAxisXX; - var angleAxisXY; - var angleAxisXZ; - var angleAxisY; - var angleAxisYX; - var angleAxisYY; - var angleAxisYZ; - var angleAxisZ; - var angleAxisZX; - var angleAxisZY; - var angleAxisZZ; - angleAxisXX = this._basisX1X; - angleAxisXY = this._basisX1Y; - angleAxisXZ = this._basisX1Z; - angleAxisZX = this._basisZ2X; - angleAxisZY = this._basisZ2Y; - angleAxisZZ = this._basisZ2Z; - angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; - angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; - angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; - this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; - this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; - this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; - this._axisYX = angleAxisYX; - this._axisYY = angleAxisYY; - this._axisYZ = angleAxisYZ; - this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; - this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; - this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; - var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - this._axisXX *= l; - this._axisXY *= l; - this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._axisYX *= l1; - this._axisYY *= l1; - this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - this._axisZX *= l2; - this._axisZY *= l2; - this._axisZZ *= l2; - this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; - this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; - this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; - var rot11; - var rot1001; - var rot1011; - var rot1021; - var rot1101; - var rot1111; - var rot1121; - var rot1201; - var rot1211; - var rot1221; - var rot21; - var rot2001; - var rot2011; - var rot2021; - var rot2101; - var rot2111; - var rot2121; - var rot2201; - var rot2211; - var rot2221; - rot1001 = this._basisX1X; - rot1011 = this._basisY1X; - rot1021 = this._basisZ1X; - rot1101 = this._basisX1Y; - rot1111 = this._basisY1Y; - rot1121 = this._basisZ1Y; - rot1201 = this._basisX1Z; - rot1211 = this._basisY1Z; - rot1221 = this._basisZ1Z; - rot2001 = this._basisX2X; - rot2011 = this._basisY2X; - rot2021 = this._basisZ2X; - rot2101 = this._basisX2Y; - rot2111 = this._basisY2Y; - rot2121 = this._basisZ2Y; - rot2201 = this._basisX2Z; - rot2211 = this._basisY2Z; - rot2221 = this._basisZ2Z; - var relRot1; - var relRot001; - var relRot011; - var relRot021; - var relRot101; - var relRot111; - var relRot121; - var relRot201; - var relRot211; - var relRot221; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = rot1001 * rot2001 + rot1101 * rot2101 + rot1201 * rot2201; - __tmp__011 = rot1001 * rot2011 + rot1101 * rot2111 + rot1201 * rot2211; - __tmp__021 = rot1001 * rot2021 + rot1101 * rot2121 + rot1201 * rot2221; - __tmp__101 = rot1011 * rot2001 + rot1111 * rot2101 + rot1211 * rot2201; - __tmp__111 = rot1011 * rot2011 + rot1111 * rot2111 + rot1211 * rot2211; - __tmp__121 = rot1011 * rot2021 + rot1111 * rot2121 + rot1211 * rot2221; - __tmp__201 = rot1021 * rot2001 + rot1121 * rot2101 + rot1221 * rot2201; - __tmp__211 = rot1021 * rot2011 + rot1121 * rot2111 + rot1221 * rot2211; - __tmp__221 = rot1021 * rot2021 + rot1121 * rot2121 + rot1221 * rot2221; - relRot001 = __tmp__001; - relRot011 = __tmp__011; - relRot021 = __tmp__021; - relRot101 = __tmp__101; - relRot111 = __tmp__111; - relRot121 = __tmp__121; - relRot201 = __tmp__201; - relRot211 = __tmp__211; - relRot221 = __tmp__221; - var angles; var anglesX; var anglesY; var anglesZ; - var sy = relRot021; + var sy = relRot02; if(sy <= -1) { - var xSubZ = Math.atan2(relRot211,relRot111); + var xSubZ = Math.atan2(relRot21,relRot11); anglesX = xSubZ * 0.5; anglesY = -1.570796326794895; anglesZ = -xSubZ * 0.5; } else if(sy >= 1) { - var xAddZ = Math.atan2(relRot211,relRot111); + var xAddZ = Math.atan2(relRot21,relRot11); anglesX = xAddZ * 0.5; anglesY = 1.570796326794895; anglesZ = xAddZ * 0.5; } else { - var y = Math.asin(sy); - var x = Math.atan2(-relRot121,relRot221); - var z = Math.atan2(-relRot011,relRot001); - anglesX = x; - anglesY = y; - anglesZ = z; + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); } this._angleX = anglesX; this._angleY = anglesY; @@ -31763,59 +28693,51 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ } ,getAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } ,getAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._basisZ2X; - v1.y = this._basisZ2Y; - v1.z = this._basisZ2Z; + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; return v; } ,getAxis1To: function(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } ,getAxis2To: function(axis) { - var v = axis; - v.x = this._basisZ2X; - v.y = this._basisZ2Y; - v.z = this._basisZ2Z; + axis.x = this._basisZ2X; + axis.y = this._basisZ2Y; + axis.z = this._basisZ2Z; } ,getLocalAxis1: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } ,getLocalAxis2: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._localBasisZ2X; - v1.y = this._localBasisZ2Y; - v1.z = this._localBasisZ2Z; + v.x = this._localBasisZ2X; + v.y = this._localBasisZ2Y; + v.z = this._localBasisZ2Z; return v; } - ,getLocalAxis1To: function(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } ,getLocalAxis2To: function(axis) { - var v = axis; - v.x = this._localBasisZ2X; - v.y = this._localBasisZ2Y; - v.z = this._localBasisZ2Z; + axis.x = this._localBasisZ2X; + axis.y = this._localBasisZ2Y; + axis.z = this._localBasisZ2Z; } ,getSpringDamper1: function() { return this._sd1; @@ -31849,14 +28771,13 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.__super__ = oimo_dynamics_co oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; + var localVector = this.localAxis1; var vX; var vY; var vZ; - var v1 = worldAxis1; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldAxis1.x; + vY = worldAxis1.y; + vZ = worldAxis1.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -31866,18 +28787,16 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dyn vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; var vX1; var vY1; var vZ1; - var v4 = worldAxis2; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; + vX1 = worldAxis2.x; + vY1 = worldAxis2.y; + vZ1 = worldAxis2.z; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; @@ -31887,10 +28806,9 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dyn vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } }); @@ -31955,14 +28873,10 @@ var oimo_dynamics_constraint_solver_common_JointSolverMassDataRow = function() { this.massWithoutCfm = 0; }; var oimo_dynamics_constraint_solver_direct_Boundary = function(maxRows) { - var this1 = new Array(maxRows); - this.iBounded = this1; - var this2 = new Array(maxRows); - this.iUnbounded = this2; - var this3 = new Array(maxRows); - this.signs = this3; - var this4 = new Array(maxRows); - this.b = this4; + this.iBounded = new Array(maxRows); + this.iUnbounded = new Array(maxRows); + this.signs = new Array(maxRows); + this.b = new Array(maxRows); this.numBounded = 0; this.numUnbounded = 0; this.matrixId = 0; @@ -31970,68 +28884,57 @@ var oimo_dynamics_constraint_solver_direct_Boundary = function(maxRows) { oimo_dynamics_constraint_solver_direct_Boundary.prototype = { init: function(buildInfo) { this.numBounded = buildInfo.numBounded; - var _g1 = 0; - var _g = this.numBounded; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.numBounded; + while(_g < _g1) { + var i = _g++; this.iBounded[i] = buildInfo.iBounded[i]; this.signs[i] = buildInfo.signs[i]; } this.numUnbounded = buildInfo.numUnbounded; this.matrixId = 0; - var _g11 = 0; - var _g2 = this.numUnbounded; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + var _g3 = this.numUnbounded; + while(_g2 < _g3) { + var i1 = _g2++; var idx = buildInfo.iUnbounded[i1]; this.iUnbounded[i1] = idx; this.matrixId |= 1 << idx; } } ,computeImpulses: function(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { - var _g1 = 0; - var _g = this.numUnbounded; - while(_g1 < _g) { - var i = _g1++; - var idx = this.iUnbounded[i]; + var _g = 0; + var _g1 = this.numUnbounded; + while(_g < _g1) { + var idx = this.iUnbounded[_g++]; var row = info.rows[idx]; - var relVel = relVels[idx]; - this.b[idx] = row.rhs * impulseFactor - relVel - row.cfm * impulses[idx]; + this.b[idx] = row.rhs * impulseFactor - relVels[idx] - row.cfm * impulses[idx]; } var invMassWithoutCfm = mass._invMassWithoutCfm; - var _g11 = 0; - var _g2 = this.numBounded; - while(_g11 < _g2) { - var i1 = _g11++; - var idx1 = this.iBounded[i1]; - var sign = this.signs[i1]; + var _g2 = 0; + var _g3 = this.numBounded; + while(_g2 < _g3) { + var i = _g2++; + var idx1 = this.iBounded[i]; + var sign = this.signs[i]; var row1 = info.rows[idx1]; - var oldImpulse = impulses[idx1]; - var impulse = sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0; - var dImpulse = impulse - oldImpulse; + var dImpulse = (sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0) - impulses[idx1]; dImpulses[idx1] = dImpulse; if(dImpulse != 0) { - var _g3 = 0; - var _g21 = this.numUnbounded; - while(_g3 < _g21) { - var j = _g3++; - var idx2 = this.iUnbounded[j]; - var dRelVel = invMassWithoutCfm[idx1][idx2] * dImpulse; - var _g4 = idx2; - var _g5 = this.b; - _g5[_g4] = _g5[_g4] - dRelVel; + var _g21 = 0; + var _g31 = this.numUnbounded; + while(_g21 < _g31) { + var idx2 = this.iUnbounded[_g21++]; + var _g32 = this.b; + _g32[idx2] = _g32[idx2] - invMassWithoutCfm[idx1][idx2] * dImpulse; } } } var indices = this.iUnbounded; var n = this.numUnbounded; var id = 0; - var _g12 = 0; - var _g6 = n; - while(_g12 < _g6) { - var i2 = _g12++; - id |= 1 << indices[i2]; - } + var _g4 = 0; + while(_g4 < n) id |= 1 << indices[_g4++]; var massMatrix; if(mass._cacheComputed[id]) { massMatrix = mass._cachedSubmatrices[id]; @@ -32041,26 +28944,25 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { massMatrix = mass._cachedSubmatrices[id]; } var ok = true; - var _g13 = 0; - var _g7 = this.numUnbounded; - while(_g13 < _g7) { - var i3 = _g13++; - var idx3 = this.iUnbounded[i3]; + var _g41 = 0; + var _g5 = this.numUnbounded; + while(_g41 < _g5) { + var i1 = _g41++; + var idx3 = this.iUnbounded[i1]; var row2 = info.rows[idx3]; - var oldImpulse1 = impulses[idx3]; - var impulse1 = oldImpulse1; - var _g31 = 0; - var _g22 = this.numUnbounded; - while(_g31 < _g22) { - var j1 = _g31++; - var idx21 = this.iUnbounded[j1]; - impulse1 += this.b[idx21] * massMatrix[i3][j1]; - } - if(impulse1 < row2.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse1 > row2.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { + var oldImpulse = impulses[idx3]; + var impulse = oldImpulse; + var _g42 = 0; + var _g51 = this.numUnbounded; + while(_g42 < _g51) { + var j = _g42++; + impulse += this.b[this.iUnbounded[j]] * massMatrix[i1][j]; + } + if(impulse < row2.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row2.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { ok = false; break; } - dImpulses[idx3] = impulse1 - oldImpulse1; + dImpulses[idx3] = impulse - oldImpulse; } if(noCheck) { return true; @@ -32068,23 +28970,23 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { if(!ok) { return false; } - var _g14 = 0; - var _g8 = this.numBounded; - while(_g14 < _g8) { - var i4 = _g14++; - var idx4 = this.iBounded[i4]; + var _g6 = 0; + var _g7 = this.numBounded; + while(_g6 < _g7) { + var i2 = _g6++; + var idx4 = this.iBounded[i2]; var row3 = info.rows[idx4]; - var sign1 = this.signs[i4]; + var sign1 = this.signs[i2]; var error = 0; var newImpulse = impulses[idx4] + dImpulses[idx4]; - var relVel1 = relVels[idx4]; - var _g32 = 0; - var _g23 = info.numRows; - while(_g32 < _g23) { - var j2 = _g32++; - relVel1 += invMassWithoutCfm[idx4][j2] * dImpulses[j2]; - } - error = row3.rhs * impulseFactor - relVel1 - row3.cfm * newImpulse; + var relVel = relVels[idx4]; + var _g61 = 0; + var _g71 = info.numRows; + while(_g61 < _g71) { + var j1 = _g61++; + relVel += invMassWithoutCfm[idx4][j1] * dImpulses[j1]; + } + error = row3.rhs * impulseFactor - relVel - row3.cfm * newImpulse; if(sign1 < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { ok = false; break; @@ -32096,19 +28998,15 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { var oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo = function(size) { this.size = size; this.numBounded = 0; - var this1 = new Array(size); - this.iBounded = this1; - var this2 = new Array(size); - this.signs = this2; + this.iBounded = new Array(size); + this.signs = new Array(size); this.numUnbounded = 0; - var this3 = new Array(size); - this.iUnbounded = this3; + this.iUnbounded = new Array(size); }; var oimo_dynamics_constraint_solver_direct_BoundaryBuilder = function(maxRows) { this.maxRows = maxRows; this.numBoundaries = 0; - var this1 = new Array(1 << maxRows); - this.boundaries = this1; + this.boundaries = new Array(1 << maxRows); this.bbInfo = new oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo(maxRows); }; oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { @@ -32121,10 +29019,9 @@ oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { return; } var row = info.rows[i]; - var lowerLimitEnabled = row.minImpulse > -1.0 / 0.0; - var upperLimitEnabled = row.maxImpulse < 1.0 / 0.0; - var disabled = row.minImpulse == 0 && row.maxImpulse == 0; - if(disabled) { + var lowerLimitEnabled = row.minImpulse > -1e65536; + var upperLimitEnabled = row.maxImpulse < 1e65536; + if(row.minImpulse == 0 && row.maxImpulse == 0) { var _this = this.bbInfo; _this.iBounded[_this.numBounded] = i; _this.signs[_this.numBounded] = 0; @@ -32165,14 +29062,11 @@ oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { }; var oimo_dynamics_constraint_solver_direct_BoundarySelector = function(n) { this.n = n; - var this1 = new Array(n); - this.indices = this1; - var this2 = new Array(n); - this.tmpIndices = this2; - var _g1 = 0; - var _g = n; - while(_g1 < _g) { - var i = _g1++; + this.indices = new Array(n); + this.tmpIndices = new Array(n); + var _g = 0; + while(_g < n) { + var i = _g++; this.indices[i] = i; } }; @@ -32193,11 +29087,10 @@ oimo_dynamics_constraint_solver_direct_BoundarySelector.prototype = { ,setSize: function(size) { var numSmaller = 0; var numGreater = 0; - var _g1 = 0; - var _g = this.n; - while(_g1 < _g) { - var i = _g1++; - var idx = this.indices[i]; + var _g = 0; + var _g1 = this.n; + while(_g < _g1) { + var idx = this.indices[_g++]; if(idx < size) { this.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -32218,33 +29111,24 @@ var oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver = functio var maxRows = oimo_common_Setting.maxJacobianRows; this.massMatrix = new oimo_dynamics_constraint_solver_direct_MassMatrix(maxRows); this.boundaryBuilder = new oimo_dynamics_constraint_solver_direct_BoundaryBuilder(maxRows); - var this1 = new Array(maxRows); - this.massData = this1; - var _g1 = 0; - var _g = this.massData.length; - while(_g1 < _g) { - var i = _g1++; - this.massData[i] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); - } + this.massData = new Array(maxRows); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); var numMaxBoundaries = this.boundaryBuilder.boundaries.length; this.velBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); this.posBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); - var this2 = new Array(maxRows); - this.relVels = this2; - var this3 = new Array(maxRows); - this.impulses = this3; - var this4 = new Array(maxRows); - this.dImpulses = this4; - var this5 = new Array(maxRows); - this.dTotalImpulses = this5; - var _g11 = 0; - var _g2 = maxRows; - while(_g11 < _g2) { - var i1 = _g11++; - this.relVels[i1] = 0; - this.impulses[i1] = 0; - this.dImpulses[i1] = 0; - this.dTotalImpulses[i1] = 0; + this.relVels = new Array(maxRows); + this.impulses = new Array(maxRows); + this.dImpulses = new Array(maxRows); + this.dTotalImpulses = new Array(maxRows); + var _g2 = 0; + while(_g2 < maxRows) { + var i = _g2++; + this.relVels[i] = 0; + this.impulses[i] = 0; + this.dImpulses[i] = 0; + this.dTotalImpulses[i] = 0; } }; oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; @@ -32265,11 +29149,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; - var _g1 = 0; - var _g = _this2.n; - while(_g1 < _g) { - var i = _g1++; - var idx = _this2.indices[i]; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -32283,38 +29166,35 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this2.tmpIndices = tmp; } ,warmStart: function(timeStep) { - var _g = this.joint._positionCorrectionAlgorithm; - var factor = _g == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g1 = 0; - var _g2 = this.info.numRows; - while(_g1 < _g2) { - var i = _g1++; - var row = this.info.rows[i]; - var _this = row.impulse; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var _g11 = 0; - var _g3 = this.info.numRows; - while(_g11 < _g3) { - var i1 = _g11++; - var row1 = this.info.rows[i1]; - var imp = row1.impulse; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i = _g2++; + var row = this.info.rows[i]; + var imp = row.impulse; var impulse = imp.impulse * factor; - if(impulse < row1.minImpulse) { - impulse = row1.minImpulse; - } else if(impulse > row1.maxImpulse) { - impulse = row1.maxImpulse; + if(impulse < row.minImpulse) { + impulse = row.minImpulse; + } else if(impulse > row.maxImpulse) { + impulse = row.maxImpulse; } imp.impulse = impulse; - if(row1.motorMaxImpulse > 0) { + if(row.motorMaxImpulse > 0) { var impulseM = imp.impulseM * factor; - var max = row1.motorMaxImpulse; + var max = row.motorMaxImpulse; if(impulseM < -max) { impulseM = -max; } else if(impulseM > max) { @@ -32324,24 +29204,20 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } else { imp.impulseM = 0; } - this.dImpulses[i1] = imp.impulse + imp.impulseM; + this.dImpulses[i] = imp.impulse + imp.impulseM; } var impulses = this.dImpulses; var linearSet = false; var angularSet = false; - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -32357,14 +29233,13 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g12 = 0; - var _g4 = this.info.numRows; - while(_g12 < _g4) { - var i2 = _g12++; - var row2 = this.info.rows[i2]; - var j = row2.jacobian; - var md = this.massData[i2]; - var imp1 = impulses[i2]; + var _g3 = 0; + var _g12 = this.info.numRows; + while(_g3 < _g12) { + var i1 = _g3++; + var j = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp1 = impulses[i1]; if((j.flag & 1) != 0) { lv1X += md.invMLin1X * imp1; lv1Y += md.invMLin1Y * imp1; @@ -32403,19 +29278,15 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } ,solveVelocity: function() { var numRows = this.info.numRows; - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -32431,12 +29302,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g1 = 0; - var _g = numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < numRows) { + var i = _g++; var row = this.info.rows[i]; - var imp = row.impulse; var j = row.jacobian; var relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; @@ -32444,75 +29313,61 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; this.relVels[i] = relVel; - this.impulses[i] = imp.impulse; + this.impulses[i] = row.impulse.impulse; this.dTotalImpulses[i] = 0; } var invMass = this.massMatrix._invMassWithoutCfm; - var _g11 = 0; - var _g2 = numRows; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + while(_g2 < numRows) { + var i1 = _g2++; var row1 = this.info.rows[i1]; - var imp1 = row1.impulse; - var md = this.massData[i1]; + var imp = row1.impulse; if(row1.motorMaxImpulse > 0) { - var oldImpulseM = imp1.impulseM; - var impulseM = oldImpulseM + md.massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); - var maxImpulseM = imp1.impulseM; + var oldImpulseM = imp.impulseM; + var impulseM = oldImpulseM + this.massData[i1].massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); + var maxImpulseM = row1.motorMaxImpulse; if(impulseM < -maxImpulseM) { impulseM = -maxImpulseM; } else if(impulseM > maxImpulseM) { impulseM = maxImpulseM; } - imp1.impulseM = impulseM; + imp.impulseM = impulseM; var dImpulseM = impulseM - oldImpulseM; this.dTotalImpulses[i1] = dImpulseM; - var _g3 = 0; - var _g21 = numRows; - while(_g3 < _g21) { - var j1 = _g3++; - var _g4 = j1; - var _g5 = this.relVels; - _g5[_g4] = _g5[_g4] + dImpulseM * invMass[i1][j1]; + var _g21 = 0; + while(_g21 < numRows) { + var j1 = _g21++; + var _g3 = this.relVels; + _g3[j1] = _g3[j1] + dImpulseM * invMass[i1][j1]; } } } var solved = false; - var _g12 = 0; - var _g6 = this.boundaryBuilder.numBoundaries; - while(_g12 < _g6) { - var i2 = _g12++; - var idx = this.velBoundarySelector.indices[i2]; - var b = this.boundaryBuilder.boundaries[idx]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { - var _g31 = 0; - var _g22 = numRows; - while(_g31 < _g22) { - var j2 = _g31++; - var row2 = this.info.rows[j2]; - var imp2 = row2.impulse; + var _g4 = 0; + var _g5 = this.boundaryBuilder.numBoundaries; + while(_g4 < _g5) { + var idx = this.velBoundarySelector.indices[_g4++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { + var _g41 = 0; + while(_g41 < numRows) { + var j2 = _g41++; var dimp = this.dImpulses[j2]; - imp2.impulse += dimp; - var _g41 = j2; + this.info.rows[j2].impulse.impulse += dimp; var _g51 = this.dTotalImpulses; - _g51[_g41] = _g51[_g41] + dimp; + _g51[j2] = _g51[j2] + dimp; } var impulses = this.dTotalImpulses; var linearSet = false; var angularSet = false; - var lv11; var lv1X1; var lv1Y1; var lv1Z1; - var lv21; var lv2X1; var lv2Y1; var lv2Z1; - var av11; var av1X1; var av1Y1; var av1Z1; - var av21; var av2X1; var av2Y1; var av2Z1; @@ -32528,30 +29383,29 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X1 = this._b2._angVelX; av2Y1 = this._b2._angVelY; av2Z1 = this._b2._angVelZ; - var _g13 = 0; - var _g7 = this.info.numRows; - while(_g13 < _g7) { - var i3 = _g13++; - var row3 = this.info.rows[i3]; - var j3 = row3.jacobian; - var md1 = this.massData[i3]; - var imp3 = impulses[i3]; + var _g1 = 0; + var _g11 = this.info.numRows; + while(_g1 < _g11) { + var i2 = _g1++; + var j3 = this.info.rows[i2].jacobian; + var md = this.massData[i2]; + var imp1 = impulses[i2]; if((j3.flag & 1) != 0) { - lv1X1 += md1.invMLin1X * imp3; - lv1Y1 += md1.invMLin1Y * imp3; - lv1Z1 += md1.invMLin1Z * imp3; - lv2X1 += md1.invMLin2X * -imp3; - lv2Y1 += md1.invMLin2Y * -imp3; - lv2Z1 += md1.invMLin2Z * -imp3; + lv1X1 += md.invMLin1X * imp1; + lv1Y1 += md.invMLin1Y * imp1; + lv1Z1 += md.invMLin1Z * imp1; + lv2X1 += md.invMLin2X * -imp1; + lv2Y1 += md.invMLin2Y * -imp1; + lv2Z1 += md.invMLin2Z * -imp1; linearSet = true; } if((j3.flag & 2) != 0) { - av1X1 += md1.invMAng1X * imp3; - av1Y1 += md1.invMAng1Y * imp3; - av1Z1 += md1.invMAng1Z * imp3; - av2X1 += md1.invMAng2X * -imp3; - av2Y1 += md1.invMAng2Y * -imp3; - av2Z1 += md1.invMAng2Z * -imp3; + av1X1 += md.invMAng1X * imp1; + av1Y1 += md.invMAng1Y * imp1; + av1Z1 += md.invMAng1Z * imp1; + av2X1 += md.invMAng2X * -imp1; + av2Y1 += md.invMAng2Y * -imp1; + av2Z1 += md.invMAng2Z * -imp1; angularSet = true; } } @@ -32572,29 +29426,27 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this._b2._angVelZ = av2Z1; } var _this = this.velBoundarySelector; - var i4 = 0; - while(_this.indices[i4] != idx) ++i4; - while(i4 > 0) { - var tmp = _this.indices[i4]; - _this.indices[i4] = _this.indices[i4 - 1]; - _this.indices[i4 - 1] = tmp; - --i4; + var i3 = 0; + while(_this.indices[i3] != idx) ++i3; + while(i3 > 0) { + var tmp = _this.indices[i3]; + _this.indices[i3] = _this.indices[i3 - 1]; + _this.indices[i3 - 1] = tmp; + --i3; } solved = true; break; } } if(!solved) { - console.log("DirectJointConstraintSolver.hx:338:","could not find solution. (velocity)"); + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:335:","could not find solution. (velocity)"); return; } } ,postSolveVelocity: function(timeStep) { - var lin; var linX; var linY; var linZ; - var ang; var angX; var angY; var angZ; @@ -32604,11 +29456,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ angX = 0; angY = 0; angZ = 0; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; var imp = row.impulse; var j = row.jacobian; if((j.flag & 1) != 0) { @@ -32644,11 +29495,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; - var _g1 = 0; - var _g = _this2.n; - while(_g1 < _g) { - var i = _g1++; - var idx = _this2.indices[i]; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -32660,28 +29510,21 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; - this.info.rows[i1].impulse.impulseP = 0; - } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { var numRows = this.info.numRows; - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -32697,12 +29540,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g1 = 0; - var _g = numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < numRows) { + var i = _g++; var row = this.info.rows[i]; - var imp = row.impulse; var j = row.jacobian; var relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; @@ -32710,41 +29551,31 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; this.relVels[i] = relVel; - this.impulses[i] = imp.impulseP; + this.impulses[i] = row.impulse.impulseP; } var solved = false; - var _g11 = 0; - var _g2 = this.boundaryBuilder.numBoundaries; - while(_g11 < _g2) { - var i1 = _g11++; - var idx = this.posBoundarySelector.indices[i1]; - var b = this.boundaryBuilder.boundaries[idx]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionSplitImpulseBaumgarte,false)) { - var _g3 = 0; - var _g21 = numRows; - while(_g3 < _g21) { - var j1 = _g3++; - var row1 = this.info.rows[j1]; - var imp1 = row1.impulse; - var dimp = this.dImpulses[j1]; - imp1.impulseP += dimp; + var _g2 = 0; + var _g3 = this.boundaryBuilder.numBoundaries; + while(_g2 < _g3) { + var idx = this.posBoundarySelector.indices[_g2++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionSplitImpulseBaumgarte,false)) { + var _g21 = 0; + while(_g21 < numRows) { + var j1 = _g21++; + this.info.rows[j1].impulse.impulseP += this.dImpulses[j1]; } var impulses = this.dImpulses; var linearSet = false; var angularSet = false; - var lv11; var lv1X1; var lv1Y1; var lv1Z1; - var lv21; var lv2X1; var lv2Y1; var lv2Z1; - var av11; var av1X1; var av1Y1; var av1Z1; - var av21; var av2X1; var av2Y1; var av2Z1; @@ -32760,30 +29591,29 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X1 = this._b2._angPseudoVelX; av2Y1 = this._b2._angPseudoVelY; av2Z1 = this._b2._angPseudoVelZ; - var _g12 = 0; - var _g4 = this.info.numRows; - while(_g12 < _g4) { - var i2 = _g12++; - var row2 = this.info.rows[i2]; - var j2 = row2.jacobian; - var md = this.massData[i2]; - var imp2 = impulses[i2]; + var _g1 = 0; + var _g11 = this.info.numRows; + while(_g1 < _g11) { + var i1 = _g1++; + var j2 = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp = impulses[i1]; if((j2.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp2; - lv1Y1 += md.invMLin1Y * imp2; - lv1Z1 += md.invMLin1Z * imp2; - lv2X1 += md.invMLin2X * -imp2; - lv2Y1 += md.invMLin2Y * -imp2; - lv2Z1 += md.invMLin2Z * -imp2; + lv1X1 += md.invMLin1X * imp; + lv1Y1 += md.invMLin1Y * imp; + lv1Z1 += md.invMLin1Z * imp; + lv2X1 += md.invMLin2X * -imp; + lv2Y1 += md.invMLin2Y * -imp; + lv2Z1 += md.invMLin2Z * -imp; linearSet = true; } if((j2.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp2; - av1Y1 += md.invMAng1Y * imp2; - av1Z1 += md.invMAng1Z * imp2; - av2X1 += md.invMAng2X * -imp2; - av2Y1 += md.invMAng2Y * -imp2; - av2Z1 += md.invMAng2Z * -imp2; + av1X1 += md.invMAng1X * imp; + av1Y1 += md.invMAng1Y * imp; + av1Z1 += md.invMAng1Z * imp; + av2X1 += md.invMAng2X * -imp; + av2Y1 += md.invMAng2Y * -imp; + av2Z1 += md.invMAng2Z * -imp; angularSet = true; } } @@ -32804,20 +29634,20 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this._b2._angPseudoVelZ = av2Z1; } var _this = this.posBoundarySelector; - var i3 = 0; - while(_this.indices[i3] != idx) ++i3; - while(i3 > 0) { - var tmp = _this.indices[i3]; - _this.indices[i3] = _this.indices[i3 - 1]; - _this.indices[i3 - 1] = tmp; - --i3; + var i2 = 0; + while(_this.indices[i2] != idx) ++i2; + while(i2 > 0) { + var tmp = _this.indices[i2]; + _this.indices[i2] = _this.indices[i2 - 1]; + _this.indices[i2 - 1] = tmp; + --i2; } solved = true; break; } } if(!solved) { - console.log("DirectJointConstraintSolver.hx:454:","could not find solution. (split impulse)"); + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:450:","could not find solution. (split impulse)"); return; } } @@ -32837,11 +29667,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; - var _g1 = 0; - var _g = _this2.n; - while(_g1 < _g) { - var i = _g1++; - var idx = _this2.indices[i]; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -32854,49 +29683,36 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; var numRows = this.info.numRows; - var _g11 = 0; - var _g2 = numRows; - while(_g11 < _g2) { - var i1 = _g11++; - var row = this.info.rows[i1]; - var imp = row.impulse; - var j = row.jacobian; - this.relVels[i1] = 0; - this.impulses[i1] = imp.impulseP; + var _g2 = 0; + while(_g2 < numRows) { + var i = _g2++; + var imp = this.info.rows[i].impulse; + this.relVels[i] = 0; + this.impulses[i] = imp.impulseP; } var solved = false; - var _g12 = 0; + var _g21 = 0; var _g3 = this.boundaryBuilder.numBoundaries; - while(_g12 < _g3) { - var i2 = _g12++; - var idx1 = this.posBoundarySelector.indices[i2]; - var b = this.boundaryBuilder.boundaries[idx1]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { - var _g31 = 0; - var _g21 = numRows; - while(_g31 < _g21) { - var j1 = _g31++; - var row1 = this.info.rows[j1]; - var imp1 = row1.impulse; - var dimp = this.dImpulses[j1]; - imp1.impulseP += dimp; + while(_g21 < _g3) { + var idx1 = this.posBoundarySelector.indices[_g21++]; + if(this.boundaryBuilder.boundaries[idx1].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { + var _g22 = 0; + while(_g22 < numRows) { + var j = _g22++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; } var impulses = this.dImpulses; var linearSet = false; var angularSet = false; - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -32912,30 +29728,29 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = 0; av2Y = 0; av2Z = 0; - var _g13 = 0; - var _g4 = this.info.numRows; - while(_g13 < _g4) { - var i3 = _g13++; - var row2 = this.info.rows[i3]; - var j2 = row2.jacobian; - var md = this.massData[i3]; - var imp2 = impulses[i3]; - if((j2.flag & 1) != 0) { - lv1X += md.invMLin1X * imp2; - lv1Y += md.invMLin1Y * imp2; - lv1Z += md.invMLin1Z * imp2; - lv2X += md.invMLin2X * -imp2; - lv2Y += md.invMLin2Y * -imp2; - lv2Z += md.invMLin2Z * -imp2; + var _g4 = 0; + var _g11 = this.info.numRows; + while(_g4 < _g11) { + var i1 = _g4++; + var j1 = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp1 = impulses[i1]; + if((j1.flag & 1) != 0) { + lv1X += md.invMLin1X * imp1; + lv1Y += md.invMLin1Y * imp1; + lv1Z += md.invMLin1Z * imp1; + lv2X += md.invMLin2X * -imp1; + lv2Y += md.invMLin2Y * -imp1; + lv2Z += md.invMLin2Z * -imp1; linearSet = true; } - if((j2.flag & 2) != 0) { - av1X += md.invMAng1X * imp2; - av1Y += md.invMAng1Y * imp2; - av1Z += md.invMAng1Z * imp2; - av2X += md.invMAng2X * -imp2; - av2Y += md.invMAng2Y * -imp2; - av2Z += md.invMAng2Z * -imp2; + if((j1.flag & 2) != 0) { + av1X += md.invMAng1X * imp1; + av1Y += md.invMAng1Y * imp1; + av1Z += md.invMAng1Z * imp1; + av2X += md.invMAng2X * -imp1; + av2Y += md.invMAng2Y * -imp1; + av2Z += md.invMAng2Z * -imp1; angularSet = true; } } @@ -32963,14 +29778,12 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; var sinAxisX; var sinAxisY; var sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; var dqX; var dqY; var dqZ; @@ -32979,7 +29792,6 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; var qX; var qY; var qZ; @@ -33140,14 +29952,12 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; var sinAxisX1; var sinAxisY1; var sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; var dqX1; var dqY1; var dqZ1; @@ -33156,7 +29966,6 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; var qX1; var qY1; var qZ1; @@ -33306,20 +30115,20 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this6._invInertia22 *= _this6._rotFactor.z; } var _this7 = this.posBoundarySelector; - var i4 = 0; - while(_this7.indices[i4] != idx1) ++i4; - while(i4 > 0) { - var tmp1 = _this7.indices[i4]; - _this7.indices[i4] = _this7.indices[i4 - 1]; - _this7.indices[i4 - 1] = tmp1; - --i4; + var i2 = 0; + while(_this7.indices[i2] != idx1) ++i2; + while(i2 > 0) { + var tmp1 = _this7.indices[i2]; + _this7.indices[i2] = _this7.indices[i2 - 1]; + _this7.indices[i2 - 1] = tmp1; + --i2; } solved = true; break; } } if(!solved) { - console.log("DirectJointConstraintSolver.hx:506:","could not find solution. (NGS)"); + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:502:","could not find solution. (NGS)"); return; } } @@ -33330,70 +30139,44 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ }); var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { this._size = size; - var length = this._size; - var this1 = new Array(length); - this.tmpMatrix = this1; - var length1 = this._size; - var this2 = new Array(length1); - this._invMass = this2; - var length2 = this._size; - var this3 = new Array(length2); - this._invMassWithoutCfm = this3; - var _g1 = 0; - var _g = this._size; - while(_g1 < _g) { - var i = _g1++; - var this4 = this.tmpMatrix; - var length3 = this._size; - var this5 = new Array(length3); - this4[i] = this5; - var this6 = this._invMass; - var length4 = this._size; - var this7 = new Array(length4); - this6[i] = this7; - var this8 = this._invMassWithoutCfm; - var length5 = this._size; - var this9 = new Array(length5); - this8[i] = this9; - var _g3 = 0; - var _g2 = this._size; - while(_g3 < _g2) { - var j = _g3++; + this.tmpMatrix = new Array(this._size); + this._invMass = new Array(this._size); + this._invMassWithoutCfm = new Array(this._size); + var _g = 0; + var _g1 = this._size; + while(_g < _g1) { + var i = _g++; + this.tmpMatrix[i] = new Array(this._size); + this._invMass[i] = new Array(this._size); + this._invMassWithoutCfm[i] = new Array(this._size); + var _g2 = 0; + var _g11 = this._size; + while(_g2 < _g11) { + var j = _g2++; this.tmpMatrix[i][j] = 0; this._invMass[i][j] = 0; this._invMassWithoutCfm[i][j] = 0; } } this._maxSubmatrixId = 1 << this._size; - var length6 = this._maxSubmatrixId; - var this10 = new Array(length6); - this._cacheComputed = this10; - var length7 = this._maxSubmatrixId; - var this11 = new Array(length7); - this._cachedSubmatrices = this11; - var _g11 = 0; - var _g4 = this._maxSubmatrixId; - while(_g11 < _g4) { - var i1 = _g11++; + this._cacheComputed = new Array(this._maxSubmatrixId); + this._cachedSubmatrices = new Array(this._maxSubmatrixId); + var _g21 = 0; + var _g3 = this._maxSubmatrixId; + while(_g21 < _g3) { + var i1 = _g21++; var t = i1; - t = (t & 85) + (t >> 1 & 85); + t = (i1 & 85) + (i1 >> 1 & 85); t = (t & 51) + (t >> 2 & 51); t = (t & 15) + (t >> 4 & 15); var matrixSize = t; - var this12 = new Array(matrixSize); - var subMatrix = this12; - var _g31 = 0; - var _g21 = matrixSize; - while(_g31 < _g21) { - var j1 = _g31++; - var this13 = new Array(matrixSize); - subMatrix[j1] = this13; - var _g5 = 0; - var _g41 = matrixSize; - while(_g5 < _g41) { - var k = _g5++; - subMatrix[j1][k] = 0; - } + var subMatrix = new Array(matrixSize); + var _g22 = 0; + while(_g22 < matrixSize) { + var j1 = _g22++; + subMatrix[j1] = new Array(matrixSize); + var _g23 = 0; + while(_g23 < matrixSize) subMatrix[j1][_g23++] = 0; } this._cacheComputed[i1] = false; this._cachedSubmatrices[i1] = subMatrix; @@ -33401,15 +30184,13 @@ var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { }; oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { computeSubmatrix: function(id,indices,size) { - var _g1 = 0; - var _g = size; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < size) { + var i = _g++; var ii = indices[i]; - var _g3 = 0; - var _g2 = size; - while(_g3 < _g2) { - var j = _g3++; + var _g1 = 0; + while(_g1 < size) { + var j = _g1++; this.tmpMatrix[i][j] = this._invMass[ii][indices[j]]; } } @@ -33980,75 +30761,65 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dst[4][5] = dsti[4]; break; default: - var _g11 = 0; - var _g4 = size; - while(_g11 < _g4) { - var i1 = _g11++; + var _g2 = 0; + while(_g2 < size) { + var i1 = _g2++; srci = src[i1]; dsti = dst[i1]; var diag1 = 1 / srci[i1]; dsti[i1] = diag1; - var _g31 = 0; - var _g21 = i1; - while(_g31 < _g21) { - var j1 = _g31++; + var _g21 = 0; + while(_g21 < i1) { + var j1 = _g21++; dsti[j1] = dsti[j1] * diag1; } - var _g32 = i1 + 1; - var _g22 = size; - while(_g32 < _g22) { - var j2 = _g32++; + var _g4 = i1 + 1; + while(_g4 < size) { + var j2 = _g4++; srci[j2] = srci[j2] * diag1; } - var _g33 = 0; - var _g23 = i1; - while(_g33 < _g23) { - var j3 = _g33++; + var _g6 = 0; + while(_g6 < i1) { + var j3 = _g6++; srcj = src[j3]; dstj = dst[j3]; - var _g5 = 0; - var _g41 = j3 + 1; - while(_g5 < _g41) { - var k = _g5++; + var _g61 = 0; + var _g7 = j3 + 1; + while(_g61 < _g7) { + var k = _g61++; dstj[k] = dstj[k] - dsti[k] * srcj[i1]; } - var _g51 = i1 + 1; - var _g42 = size; - while(_g51 < _g42) { - var k1 = _g51++; + var _g8 = i1 + 1; + while(_g8 < size) { + var k1 = _g8++; srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; } } - var _g34 = i1 + 1; - var _g24 = size; - while(_g34 < _g24) { - var j4 = _g34++; + var _g81 = i1 + 1; + while(_g81 < size) { + var j4 = _g81++; srcj = src[j4]; dstj = dst[j4]; - var _g52 = 0; - var _g43 = i1; - while(_g52 < _g43) { - var k2 = _g52++; + var _g82 = 0; + while(_g82 < i1) { + var k2 = _g82++; dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; } dstj[i1] = -diag1 * srcj[i1]; - var _g53 = i1 + 1; - var _g44 = size; - while(_g53 < _g44) { - var k3 = _g53++; + var _g10 = i1 + 1; + while(_g10 < size) { + var k3 = _g10++; srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; } } } - var _g12 = 1; - var _g6 = size; - while(_g12 < _g6) { - var i2 = _g12++; + var _g41 = 1; + while(_g41 < size) { + var i2 = _g41++; dsti = dst[i2]; - var _g35 = 0; - var _g25 = i2; - while(_g35 < _g25) { - var j5 = _g35++; + var _g42 = 0; + while(_g42 < i2) { + var j5 = _g42++; dst[j5][i2] = dsti[j5]; } } @@ -34062,7 +30833,6 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { var b2 = info.b2; var invM1 = b1._invMass; var invM2 = b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -34072,7 +30842,6 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -34100,10 +30869,9 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { invI220 = b2._invInertia20; invI221 = b2._invInertia21; invI222 = b2._invInertia22; - var _g1 = 0; - var _g = numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + while(_g < numRows) { + var i = _g++; var j = info.rows[i].jacobian; var md = massData[i]; j.updateSparsity(); @@ -34150,16 +30918,13 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md.invMAng2Z = 0; } } - var _g11 = 0; - var _g2 = numRows; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + while(_g2 < numRows) { + var i1 = _g2++; var j1 = info.rows[i1].jacobian; - var _g3 = i1; - var _g21 = numRows; - while(_g3 < _g21) { - var j2 = _g3++; - var j21 = info.rows[j2].jacobian; + var _g21 = i1; + while(_g21 < numRows) { + var j2 = _g21++; var md2 = massData[j2]; var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); if(i1 == j2) { @@ -34181,27 +30946,19 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { } } } - var _g12 = 0; - var _g4 = this._maxSubmatrixId; - while(_g12 < _g4) { - var i2 = _g12++; - this._cacheComputed[i2] = false; - } + var _g1 = 0; + var _g11 = this._maxSubmatrixId; + while(_g1 < _g11) this._cacheComputed[_g1++] = false; } }; var oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver = function(constraint) { oimo_dynamics_constraint_ConstraintSolver.call(this); this.constraint = constraint; this.info = new oimo_dynamics_constraint_info_contact_ContactSolverInfo(); - var length = oimo_common_Setting.maxManifoldPoints; - var this1 = new Array(length); - this.massData = this1; - var _g1 = 0; - var _g = this.massData.length; - while(_g1 < _g) { - var i = _g1++; - this.massData[i] = new oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow(); - } + this.massData = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow(); }; oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ @@ -34211,7 +30968,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2 = this.info.b2; var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -34221,7 +30977,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -34249,10 +31004,10 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var j = row.jacobianN; @@ -34336,32 +31091,27 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.invMAngB2Z = __tmp__Z5; var invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); var invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); - var invMassTB10 = invMassTB01; var invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); - var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB10; + var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB01; if(invDet != 0) { invDet = 1 / invDet; } md.massTB00 = invMassTB11 * invDet; md.massTB01 = -invMassTB01 * invDet; - md.massTB10 = -invMassTB10 * invDet; + md.massTB10 = -invMassTB01 * invDet; md.massTB11 = invMassTB00 * invDet; } } ,warmStart: function(timeStep) { - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -34377,10 +31127,10 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var imp = row.impulse; var md = this.massData[i]; @@ -34445,19 +31195,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2._angVelZ = av2Z; } ,solveVelocity: function() { - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -34473,10 +31219,10 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var imp = row.impulse; @@ -34537,10 +31283,10 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2Y += md.invMAngB2Y * -impulseB; av2Z += md.invMAngB2Z * -impulseB; } - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; var row1 = this.info.rows[i1]; var md1 = this.massData[i1]; var imp1 = row1.impulse; @@ -34588,7 +31334,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this.constraint._getPositionSolverInfo(this.info); var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -34598,7 +31343,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -34626,13 +31370,12 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var md = this.massData[i]; - var j = row.jacobianN; + var j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; @@ -34662,27 +31405,20 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massN = 1 / md.massN; } } - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; - this.info.rows[i1].impulse.impulseP = 0; - } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -34698,10 +31434,10 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var imp = row.impulse; @@ -34749,7 +31485,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this.constraint._getPositionSolverInfo(this.info); var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -34759,7 +31494,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -34787,13 +31521,12 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var md = this.massData[i]; - var j = row.jacobianN; + var j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; @@ -34823,19 +31556,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massN = 1 / md.massN; } } - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -34851,20 +31580,20 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = 0; av2Y = 0; av2Z = 0; - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; - var row1 = this.info.rows[i1]; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row = this.info.rows[i1]; var md1 = this.massData[i1]; - var imp = row1.impulse; - var j1 = row1.jacobianN; + var imp = row.impulse; + var j1 = row.jacobianN; var rvn = 0; rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row1.rhs - rvn) * md1.massN * oimo_common_Setting.positionNgsBaumgarte; + var impulseP = (row.rhs - rvn) * md1.massN * oimo_common_Setting.positionNgsBaumgarte; var oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { @@ -34905,14 +31634,12 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; var sinAxisX; var sinAxisY; var sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; var dqX; var dqY; var dqZ; @@ -34921,7 +31648,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; var qX; var qY; var qZ; @@ -35082,14 +31808,12 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; var sinAxisX1; var sinAxisY1; var sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; var dqX1; var dqY1; var dqZ1; @@ -35098,7 +31822,6 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; var qX1; var qY1; var qZ1; @@ -35248,31 +31971,90 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this3._invInertia22 *= _this3._rotFactor.z; } ,postSolve: function() { - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var lin1X; + var lin1Y; + var lin1Z; + var ang1X; + var ang1Y; + var ang1Z; + var ang2X; + var ang2Y; + var ang2Z; + lin1X = 0; + lin1Y = 0; + lin1Z = 0; + ang1X = 0; + ang1Y = 0; + ang1Z = 0; + ang2X = 0; + ang2Y = 0; + ang2Z = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; var imp = row.impulse; + var jn = row.jacobianN; var jt = row.jacobianT; var jb = row.jacobianB; - var impulseL; + var impN = imp.impulseN; + var impT = imp.impulseT; + var impB = imp.impulseB; var impulseLX; var impulseLY; var impulseLZ; impulseLX = 0; impulseLY = 0; impulseLZ = 0; - impulseLX += jt.lin1X * imp.impulseT; - impulseLY += jt.lin1Y * imp.impulseT; - impulseLZ += jt.lin1Z * imp.impulseT; - impulseLX += jb.lin1X * imp.impulseB; - impulseLY += jb.lin1Y * imp.impulseB; - impulseLZ += jb.lin1Z * imp.impulseB; + impulseLX += jt.lin1X * impT; + impulseLY += jt.lin1Y * impT; + impulseLZ += jt.lin1Z * impT; + impulseLX += jb.lin1X * impB; + impulseLY += jb.lin1Y * impB; + impulseLZ += jb.lin1Z * impB; imp.impulseLX = impulseLX; imp.impulseLY = impulseLY; imp.impulseLZ = impulseLZ; - } + lin1X += jn.lin1X * impN; + lin1Y += jn.lin1Y * impN; + lin1Z += jn.lin1Z * impN; + ang1X += jn.ang1X * impN; + ang1Y += jn.ang1Y * impN; + ang1Z += jn.ang1Z * impN; + ang2X += jn.ang2X * impN; + ang2Y += jn.ang2Y * impN; + ang2Z += jn.ang2Z * impN; + lin1X += jt.lin1X * impT; + lin1Y += jt.lin1Y * impT; + lin1Z += jt.lin1Z * impT; + ang1X += jt.ang1X * impT; + ang1Y += jt.ang1Y * impT; + ang1Z += jt.ang1Z * impT; + ang2X += jt.ang2X * impT; + ang2Y += jt.ang2Y * impT; + ang2Z += jt.ang2Z * impT; + lin1X += jb.lin1X * impB; + lin1Y += jb.lin1Y * impB; + lin1Z += jb.lin1Z * impB; + ang1X += jb.ang1X * impB; + ang1Y += jb.ang1Y * impB; + ang1Z += jb.ang1Z * impB; + ang2X += jb.ang2X * impB; + ang2Y += jb.ang2Y * impB; + ang2Z += jb.ang2Z * impB; + } + this._b1._linearContactImpulseX += lin1X; + this._b1._linearContactImpulseY += lin1Y; + this._b1._linearContactImpulseZ += lin1Z; + this._b1._angularContactImpulseX += ang1X; + this._b1._angularContactImpulseY += ang1Y; + this._b1._angularContactImpulseZ += ang1Z; + this._b2._linearContactImpulseX -= lin1X; + this._b2._linearContactImpulseY -= lin1Y; + this._b2._linearContactImpulseZ -= lin1Z; + this._b2._angularContactImpulseX -= ang2X; + this._b2._angularContactImpulseY -= ang2Y; + this._b2._angularContactImpulseZ -= ang2Z; this.constraint._syncManifold(); } }); @@ -35280,15 +32062,10 @@ var oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver = function(join oimo_dynamics_constraint_ConstraintSolver.call(this); this.joint = joint; this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); - var length = oimo_common_Setting.maxJacobianRows; - var this1 = new Array(length); - this.massData = this1; - var _g1 = 0; - var _g = this.massData.length; - while(_g1 < _g) { - var i = _g1++; - this.massData[i] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); - } + this.massData = new Array(oimo_common_Setting.maxJacobianRows); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); }; oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ @@ -35299,7 +32076,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2 = this.info.b2; var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -35309,7 +32085,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -35337,10 +32112,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var j = row.jacobian; @@ -35398,35 +32173,28 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend } } ,warmStart: function(timeStep) { - var _g = this.joint._positionCorrectionAlgorithm; - var factor = _g == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g1 = 0; - var _g2 = this.info.numRows; - while(_g1 < _g2) { - var i = _g1++; - var row = this.info.rows[i]; - var _this = row.impulse; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -35442,14 +32210,12 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g11 = 0; - var _g3 = this.info.numRows; - while(_g11 < _g3) { - var i1 = _g11++; - var row1 = this.info.rows[i1]; - var md = this.massData[i1]; - var imp = row1.impulse; - var j = row1.jacobian; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i = _g2++; + var md = this.massData[i]; + var imp = this.info.rows[i].impulse; imp.impulse *= factor; imp.impulseM *= factor; var impulse = imp.impulse + imp.impulseM; @@ -35480,19 +32246,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2._angVelZ = av2Z; } ,solveVelocity: function() { - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -35508,10 +32270,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var imp = row.impulse; @@ -35550,10 +32312,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2Z += md.invMAng2Z * -impulseM; } } - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; var row1 = this.info.rows[i1]; var md1 = this.massData[i1]; var imp1 = row1.impulse; @@ -35603,11 +32365,9 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2._angVelZ = av2Z; } ,postSolveVelocity: function(timeStep) { - var lin; var linX; var linY; var linZ; - var ang; var angX; var angY; var angZ; @@ -35617,11 +32377,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend angX = 0; angY = 0; angZ = 0; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; var imp = row.impulse; var j = row.jacobian; if((j.flag & 1) != 0) { @@ -35648,7 +32407,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2 = this.info.b2; var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -35658,7 +32416,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -35686,14 +32443,12 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + var j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; @@ -35723,27 +32478,20 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.mass = 1 / md.mass; } } - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; - this.info.rows[i1].impulse.impulseP = 0; - } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -35759,10 +32507,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var md = this.massData[i]; var imp = row.impulse; @@ -35814,7 +32562,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2 = this.info.b2; var invM1 = this._b1._invMass; var invM2 = this._b2._invMass; - var invI1; var invI100; var invI101; var invI102; @@ -35824,7 +32571,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var invI120; var invI121; var invI122; - var invI2; var invI200; var invI201; var invI202; @@ -35852,14 +32598,12 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g1 = 0; - var _g = this.info.numRows; - while(_g1 < _g) { - var i = _g1++; - var row = this.info.rows[i]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + var j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; @@ -35889,19 +32633,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.mass = 1 / md.mass; } } - var lv1; var lv1X; var lv1Y; var lv1Z; - var lv2; var lv2X; var lv2Y; var lv2Z; - var av1; var av1X; var av1Y; var av1Z; - var av2; var av2X; var av2Y; var av2Z; @@ -35917,28 +32657,28 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = 0; av2Y = 0; av2Z = 0; - var _g11 = 0; - var _g2 = this.info.numRows; - while(_g11 < _g2) { - var i1 = _g11++; - var row1 = this.info.rows[i1]; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row = this.info.rows[i1]; var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var j1 = row1.jacobian; + var imp = row.impulse; + var j1 = row.jacobian; var rv = 0; rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row1.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md1.mass; - var oldImpulseP = imp1.impulseP; - imp1.impulseP += impulseP; - if(imp1.impulseP < row1.minImpulse) { - imp1.impulseP = row1.minImpulse; - } else if(imp1.impulseP > row1.maxImpulse) { - imp1.impulseP = row1.maxImpulse; - } - impulseP = imp1.impulseP - oldImpulseP; + var impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md1.mass; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < row.minImpulse) { + imp.impulseP = row.minImpulse; + } else if(imp.impulseP > row.maxImpulse) { + imp.impulseP = row.maxImpulse; + } + impulseP = imp.impulseP - oldImpulseP; lv1X += md1.invMLin1X * impulseP; lv1Y += md1.invMLin1Y * impulseP; lv1Z += md1.invMLin1Z * impulseP; @@ -35973,14 +32713,12 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; var sinAxisX; var sinAxisY; var sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; var dqX; var dqY; var dqZ; @@ -35989,7 +32727,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; var qX; var qY; var qZ; @@ -36150,14 +32887,12 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; var sinAxisX1; var sinAxisY1; var sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; var dqX1; var dqY1; var dqZ1; @@ -36166,7 +32901,6 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; var qX1; var qY1; var qZ1; @@ -36430,6 +33164,12 @@ var oimo_dynamics_rigidbody_RigidBody = function(config) { this._torqueX = 0; this._torqueY = 0; this._torqueZ = 0; + this._linearContactImpulseX = 0; + this._linearContactImpulseY = 0; + this._linearContactImpulseZ = 0; + this._angularContactImpulseX = 0; + this._angularContactImpulseY = 0; + this._angularContactImpulseZ = 0; this._rotFactor = new oimo_common_Vec3(1,1,1); this._addedToIsland = false; this._gravityScale = 1; @@ -36437,8 +33177,7 @@ var oimo_dynamics_rigidbody_RigidBody = function(config) { }; oimo_dynamics_rigidbody_RigidBody.prototype = { _integrate: function(dt) { - var _g = this._type; - switch(_g) { + switch(this._type) { case 1: this._velX = 0; this._velY = 0; @@ -36454,11 +33193,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._angPseudoVelZ = 0; break; case 0:case 2: - var translation; var translationX; var translationY; var translationZ; - var rotation; var rotationX; var rotationY; var rotationZ; @@ -36506,14 +33243,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; var sinAxisX; var sinAxisY; var sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dq; var dqX; var dqY; var dqZ; @@ -36522,7 +33257,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; var qX; var qY; var qZ; @@ -36674,13 +33408,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } } ,_integratePseudoVelocity: function() { - var pseudoVelLengthSq = this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ; - var angPseudoVelLengthSq = this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ; - if(pseudoVelLengthSq == 0 && angPseudoVelLengthSq == 0) { + if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { return; } - var _g = this._type; - switch(_g) { + switch(this._type) { case 1: this._pseudoVelX = 0; this._pseudoVelY = 0; @@ -36690,11 +33421,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._angPseudoVelZ = 0; break; case 0:case 2: - var translation; var translationX; var translationY; var translationZ; - var rotation; var rotationX; var rotationY; var rotationZ; @@ -36725,14 +33454,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; var sinAxisX; var sinAxisY; var sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dq; var dqX; var dqY; var dqZ; @@ -36741,7 +33468,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; var qX; var qY; var qZ; @@ -36893,7 +33619,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } } ,updateMass: function() { - var totalInertia; var totalInertia00; var totalInertia01; var totalInertia02; @@ -36919,7 +33644,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var g = s._geom; g._updateMass(); var mass = s._density * g._volume; - var inertia; var inertia00; var inertia01; var inertia02; @@ -36992,7 +33716,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { inertia20 *= mass; inertia21 *= mass; inertia22 *= mass; - var cogInertia; var cogInertia00; var cogInertia01; var cogInertia02; @@ -37048,34 +33771,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._localInertia20 = totalInertia20; this._localInertia21 = totalInertia21; this._localInertia22 = totalInertia22; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; - if(this._mass > 0 && det > 0 && this._type == 0) { + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; - var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; - var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; - var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; - var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; - var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; - var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } - this._invLocalInertia00 = d001 * d; - this._invLocalInertia01 = -d10 * d; - this._invLocalInertia02 = d20 * d; - this._invLocalInertia10 = -d011 * d; - this._invLocalInertia11 = d11 * d; - this._invLocalInertia12 = -d21 * d; - this._invLocalInertia20 = d021 * d; - this._invLocalInertia21 = -d12 * d; - this._invLocalInertia22 = d22 * d; + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; @@ -37186,23 +33899,20 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,getPosition: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._transform._positionX; - v1.y = this._transform._positionY; - v1.z = this._transform._positionZ; - return v; - } - ,getPositionTo: function(position) { - var v = position; v.x = this._transform._positionX; v.y = this._transform._positionY; v.z = this._transform._positionZ; + return v; + } + ,getPositionTo: function(position) { + position.x = this._transform._positionX; + position.y = this._transform._positionY; + position.z = this._transform._positionZ; } ,setPosition: function(position) { - var v = position; - this._transform._positionX = v.x; - this._transform._positionY = v.y; - this._transform._positionZ = v.z; + this._transform._positionX = position.x; + this._transform._positionY = position.y; + this._transform._positionZ = position.z; var dst = this._ptransform; var src = this._transform; dst._positionX = src._positionX; @@ -37220,9 +33930,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -37232,15 +33943,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__00; dst1._rotation01 = __tmp__01; dst1._rotation02 = __tmp__02; @@ -37253,18 +33964,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -37274,15 +33984,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__001; dst2._rotation01 = __tmp__011; dst2._rotation02 = __tmp__021; @@ -37295,20 +34005,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -37327,17 +34035,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -37346,14 +34053,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,translate: function(translation) { - var diff; var diffX; var diffY; var diffZ; - var v = translation; - diffX = v.x; - diffY = v.y; - diffZ = v.z; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; this._transform._positionX += diffX; this._transform._positionY += diffY; this._transform._positionZ += diffZ; @@ -37374,9 +34079,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -37386,15 +34092,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__00; dst1._rotation01 = __tmp__01; dst1._rotation02 = __tmp__02; @@ -37407,18 +34113,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -37428,15 +34133,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__001; dst2._rotation01 = __tmp__011; dst2._rotation02 = __tmp__021; @@ -37449,20 +34154,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -37481,17 +34184,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -37501,20 +34203,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,getRotation: function() { var m = new oimo_common_Mat3(); - var m1 = m; - m1.e00 = this._transform._rotation00; - m1.e01 = this._transform._rotation01; - m1.e02 = this._transform._rotation02; - m1.e10 = this._transform._rotation10; - m1.e11 = this._transform._rotation11; - m1.e12 = this._transform._rotation12; - m1.e20 = this._transform._rotation20; - m1.e21 = this._transform._rotation21; - m1.e22 = this._transform._rotation22; - return m; - } - ,getRotationTo: function(rotation) { - var m = rotation; m.e00 = this._transform._rotation00; m.e01 = this._transform._rotation01; m.e02 = this._transform._rotation02; @@ -37524,18 +34212,29 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e20 = this._transform._rotation20; m.e21 = this._transform._rotation21; m.e22 = this._transform._rotation22; + return m; + } + ,getRotationTo: function(rotation) { + rotation.e00 = this._transform._rotation00; + rotation.e01 = this._transform._rotation01; + rotation.e02 = this._transform._rotation02; + rotation.e10 = this._transform._rotation10; + rotation.e11 = this._transform._rotation11; + rotation.e12 = this._transform._rotation12; + rotation.e20 = this._transform._rotation20; + rotation.e21 = this._transform._rotation21; + rotation.e22 = this._transform._rotation22; } ,setRotation: function(rotation) { - var m = rotation; - this._transform._rotation00 = m.e00; - this._transform._rotation01 = m.e01; - this._transform._rotation02 = m.e02; - this._transform._rotation10 = m.e10; - this._transform._rotation11 = m.e11; - this._transform._rotation12 = m.e12; - this._transform._rotation20 = m.e20; - this._transform._rotation21 = m.e21; - this._transform._rotation22 = m.e22; + this._transform._rotation00 = rotation.e00; + this._transform._rotation01 = rotation.e01; + this._transform._rotation02 = rotation.e02; + this._transform._rotation10 = rotation.e10; + this._transform._rotation11 = rotation.e11; + this._transform._rotation12 = rotation.e12; + this._transform._rotation20 = rotation.e20; + this._transform._rotation21 = rotation.e21; + this._transform._rotation22 = rotation.e22; var __tmp__00; var __tmp__01; var __tmp__02; @@ -37616,9 +34315,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__002; var __tmp__012; var __tmp__022; @@ -37628,15 +34328,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__202; var __tmp__212; var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__002; dst1._rotation01 = __tmp__012; dst1._rotation02 = __tmp__022; @@ -37649,18 +34349,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -37670,15 +34369,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__003; dst2._rotation01 = __tmp__013; dst2._rotation02 = __tmp__023; @@ -37691,20 +34390,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -37723,7 +34420,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -37742,14 +34438,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,setRotationXyz: function(eulerAngles) { - var xyz; var xyzX; var xyzY; var xyzZ; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; var sx = Math.sin(xyzX); var sy = Math.sin(xyzY); var sz = Math.sin(xyzZ); @@ -37845,9 +34539,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__002; var __tmp__012; var __tmp__022; @@ -37857,15 +34552,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__202; var __tmp__212; var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__002; dst1._rotation01 = __tmp__012; dst1._rotation02 = __tmp__022; @@ -37878,18 +34573,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -37899,15 +34593,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__003; dst2._rotation01 = __tmp__013; dst2._rotation02 = __tmp__023; @@ -37920,20 +34614,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -37952,17 +34644,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -37971,7 +34662,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,rotate: function(rotation) { - var rot; var rot00; var rot01; var rot02; @@ -37981,16 +34671,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var rot20; var rot21; var rot22; - var m = rotation; - rot00 = m.e00; - rot01 = m.e01; - rot02 = m.e02; - rot10 = m.e10; - rot11 = m.e11; - rot12 = m.e12; - rot20 = m.e20; - rot21 = m.e21; - rot22 = m.e22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; var __tmp__00; var __tmp__01; var __tmp__02; @@ -38098,9 +34787,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -38110,15 +34800,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__003; dst1._rotation01 = __tmp__013; dst1._rotation02 = __tmp__023; @@ -38131,18 +34821,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__004; var __tmp__014; var __tmp__024; @@ -38152,15 +34841,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__204; var __tmp__214; var __tmp__224; - __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__004; dst2._rotation01 = __tmp__014; dst2._rotation02 = __tmp__024; @@ -38173,20 +34862,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -38205,7 +34892,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -38224,11 +34910,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,rotateXyz: function(eulerAngles) { - var xyz; var xyzX; var xyzY; var xyzZ; - var rot; var rot00; var rot01; var rot02; @@ -38238,10 +34922,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var rot20; var rot21; var rot22; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; var sx = Math.sin(xyzX); var sy = Math.sin(xyzY); var sz = Math.sin(xyzZ); @@ -38364,9 +35047,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -38376,15 +35060,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__003; dst1._rotation01 = __tmp__013; dst1._rotation02 = __tmp__023; @@ -38397,18 +35081,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__004; var __tmp__014; var __tmp__024; @@ -38418,15 +35101,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__204; var __tmp__214; var __tmp__224; - __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__004; dst2._rotation01 = __tmp__014; dst2._rotation02 = __tmp__024; @@ -38439,20 +35122,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -38471,17 +35152,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -38491,7 +35171,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,getOrientation: function() { var q = new oimo_common_Quat(); - var iq; var iqX; var iqY; var iqZ; @@ -38539,15 +35218,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { iqY = (this._transform._rotation12 + this._transform._rotation21) * s; iqW = (this._transform._rotation10 - this._transform._rotation01) * s; } - var q1 = q; - q1.x = iqX; - q1.y = iqY; - q1.z = iqZ; - q1.w = iqW; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; return q; } ,getOrientationTo: function(orientation) { - var iq; var iqX; var iqY; var iqZ; @@ -38595,23 +35272,20 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { iqY = (this._transform._rotation12 + this._transform._rotation21) * s; iqW = (this._transform._rotation10 - this._transform._rotation01) * s; } - var q = orientation; - q.x = iqX; - q.y = iqY; - q.z = iqZ; - q.w = iqW; + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; } ,setOrientation: function(quaternion) { - var q; var qX; var qY; var qZ; var qW; - var q1 = quaternion; - qX = q1.x; - qY = q1.y; - qZ = q1.z; - qW = q1.w; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; var x = qX; var y = qY; var z = qZ; @@ -38717,9 +35391,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__002; var __tmp__012; var __tmp__022; @@ -38729,15 +35404,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__202; var __tmp__212; var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__002; dst1._rotation01 = __tmp__012; dst1._rotation02 = __tmp__022; @@ -38750,18 +35425,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -38771,15 +35445,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__003; dst2._rotation01 = __tmp__013; dst2._rotation02 = __tmp__023; @@ -38792,20 +35466,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -38824,7 +35496,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -38967,9 +35638,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst1 = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__002; var __tmp__012; var __tmp__022; @@ -38979,15 +35651,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__202; var __tmp__212; var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst1._rotation00 = __tmp__002; dst1._rotation01 = __tmp__012; dst1._rotation02 = __tmp__022; @@ -39000,18 +35672,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst1._positionX = __tmp__X; dst1._positionY = __tmp__Y; dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; var dst2 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__003; var __tmp__013; var __tmp__023; @@ -39021,15 +35692,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst2._rotation00 = __tmp__003; dst2._rotation01 = __tmp__013; dst2._rotation02 = __tmp__023; @@ -39042,20 +35713,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst2._positionX = __tmp__X1; dst2._positionY = __tmp__Y1; dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -39074,7 +35743,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -39097,20 +35765,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,getLocalInertia: function() { var m = new oimo_common_Mat3(); - var m1 = m; - m1.e00 = this._localInertia00; - m1.e01 = this._localInertia01; - m1.e02 = this._localInertia02; - m1.e10 = this._localInertia10; - m1.e11 = this._localInertia11; - m1.e12 = this._localInertia12; - m1.e20 = this._localInertia20; - m1.e21 = this._localInertia21; - m1.e22 = this._localInertia22; - return m; - } - ,getLocalInertiaTo: function(inertia) { - var m = inertia; m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -39120,6 +35774,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e20 = this._localInertia20; m.e21 = this._localInertia21; m.e22 = this._localInertia22; + return m; + } + ,getLocalInertiaTo: function(inertia) { + inertia.e00 = this._localInertia00; + inertia.e01 = this._localInertia01; + inertia.e02 = this._localInertia02; + inertia.e10 = this._localInertia10; + inertia.e11 = this._localInertia11; + inertia.e12 = this._localInertia12; + inertia.e20 = this._localInertia20; + inertia.e21 = this._localInertia21; + inertia.e22 = this._localInertia22; } ,getMassData: function() { var md = new oimo_dynamics_rigidbody_MassData(); @@ -39161,34 +35827,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._localInertia20 = m.e20; this._localInertia21 = m.e21; this._localInertia22 = m.e22; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; - if(this._mass > 0 && det > 0 && this._type == 0) { + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; - var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; - var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; - var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; - var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; - var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; - var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } - this._invLocalInertia00 = d001 * d; - this._invLocalInertia01 = -d10 * d; - this._invLocalInertia02 = d20 * d; - this._invLocalInertia10 = -d011 * d; - this._invLocalInertia11 = d11 * d; - this._invLocalInertia12 = -d21 * d; - this._invLocalInertia20 = d021 * d; - this._invLocalInertia21 = -d12 * d; - this._invLocalInertia22 = d22 * d; + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; @@ -39374,17 +36030,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,getLinearVelocity: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._velX; - v1.y = this._velY; - v1.z = this._velZ; - return v; - } - ,getLinearVelocityTo: function(linearVelocity) { - var v = linearVelocity; v.x = this._velX; v.y = this._velY; v.z = this._velZ; + return v; + } + ,getLinearVelocityTo: function(linearVelocity) { + linearVelocity.x = this._velX; + linearVelocity.y = this._velY; + linearVelocity.z = this._velZ; } ,setLinearVelocity: function(linearVelocity) { if(this._type == 1) { @@ -39392,27 +36046,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._velY = 0; this._velZ = 0; } else { - var v = linearVelocity; - this._velX = v.x; - this._velY = v.y; - this._velZ = v.z; + this._velX = linearVelocity.x; + this._velY = linearVelocity.y; + this._velZ = linearVelocity.z; } this._sleeping = false; this._sleepTime = 0; } ,getAngularVelocity: function() { var v = new oimo_common_Vec3(); - var v1 = v; - v1.x = this._angVelX; - v1.y = this._angVelY; - v1.z = this._angVelZ; + v.x = this._angVelX; + v.y = this._angVelY; + v.z = this._angVelZ; return v; } ,getAngularVelocityTo: function(angularVelocity) { - var v = angularVelocity; - v.x = this._velX; - v.y = this._velY; - v.z = this._velZ; + angularVelocity.x = this._velX; + angularVelocity.y = this._velY; + angularVelocity.z = this._velZ; } ,setAngularVelocity: function(angularVelocity) { if(this._type == 1) { @@ -39420,24 +36071,21 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._angVelY = 0; this._angVelZ = 0; } else { - var v = angularVelocity; - this._angVelX = v.x; - this._angVelY = v.y; - this._angVelZ = v.z; + this._angVelX = angularVelocity.x; + this._angVelY = angularVelocity.y; + this._angVelZ = angularVelocity.z; } this._sleeping = false; this._sleepTime = 0; } ,addLinearVelocity: function(linearVelocityChange) { if(this._type != 1) { - var d; var dX; var dY; var dZ; - var v = linearVelocityChange; - dX = v.x; - dY = v.y; - dZ = v.z; + dX = linearVelocityChange.x; + dY = linearVelocityChange.y; + dZ = linearVelocityChange.z; this._velX += dX; this._velY += dY; this._velZ += dZ; @@ -39447,14 +36095,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } ,addAngularVelocity: function(angularVelocityChange) { if(this._type != 1) { - var d; var dX; var dY; var dZ; - var v = angularVelocityChange; - dX = v.x; - dY = v.y; - dZ = v.z; + dX = angularVelocityChange.x; + dY = angularVelocityChange.y; + dZ = angularVelocityChange.z; this._angVelX += dX; this._angVelY += dY; this._angVelZ += dZ; @@ -39463,29 +36109,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyImpulse: function(impulse,positionInWorld) { - var imp; var impX; var impY; var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; this._velX += impX * this._invMass; this._velY += impY * this._invMass; this._velZ += impZ * this._invMass; - var aimp; var aimpX; var aimpY; var aimpZ; - var pos; var posX; var posY; var posZ; - var v1 = positionInWorld; - posX = v1.x; - posY = v1.y; - posZ = v1.z; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; posX -= this._transform._positionX; posY -= this._transform._positionY; posZ -= this._transform._positionZ; @@ -39508,14 +36149,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyLinearImpulse: function(impulse) { - var imp; var impX; var impY; var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; this._velX += impX * this._invMass; this._velY += impY * this._invMass; this._velZ += impZ * this._invMass; @@ -39523,14 +36162,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyAngularImpulse: function(impulse) { - var imp; var impX; var impY; var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39547,29 +36184,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyForce: function(force,positionInWorld) { - var iforce; var iforceX; var iforceY; var iforceZ; - var v = force; - iforceX = v.x; - iforceY = v.y; - iforceZ = v.z; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; this._forceX += iforceX; this._forceY += iforceY; this._forceZ += iforceZ; - var itorque; var itorqueX; var itorqueY; var itorqueZ; - var pos; var posX; var posY; var posZ; - var v1 = positionInWorld; - posX = v1.x; - posY = v1.y; - posZ = v1.z; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; posX -= this._transform._positionX; posY -= this._transform._positionY; posZ -= this._transform._positionZ; @@ -39583,14 +36215,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyForceToCenter: function(force) { - var iforce; var iforceX; var iforceY; var iforceZ; - var v = force; - iforceX = v.x; - iforceY = v.y; - iforceZ = v.z; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; this._forceX += iforceX; this._forceY += iforceY; this._forceZ += iforceZ; @@ -39598,20 +36228,42 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,applyTorque: function(torque) { - var itorque; var itorqueX; var itorqueY; var itorqueZ; - var v = torque; - itorqueX = v.x; - itorqueY = v.y; - itorqueZ = v.z; + itorqueX = torque.x; + itorqueY = torque.y; + itorqueZ = torque.z; this._torqueX += itorqueX; this._torqueY += itorqueY; this._torqueZ += itorqueZ; this._sleeping = false; this._sleepTime = 0; } + ,getLinearContactImpulse: function() { + var res = new oimo_common_Vec3(); + res.x = this._linearContactImpulseX; + res.y = this._linearContactImpulseY; + res.z = this._linearContactImpulseZ; + return res; + } + ,getLinearContactImpulseTo: function(linearContactImpulse) { + linearContactImpulse.x = this._linearContactImpulseX; + linearContactImpulse.y = this._linearContactImpulseY; + linearContactImpulse.z = this._linearContactImpulseZ; + } + ,getAngularContactImpulse: function() { + var res = new oimo_common_Vec3(); + res.x = this._angularContactImpulseX; + res.y = this._angularContactImpulseY; + res.z = this._angularContactImpulseZ; + return res; + } + ,getAngularContactImpulseTo: function(angularContactImpulse) { + angularContactImpulse.x = this._angularContactImpulseX; + angularContactImpulse.y = this._angularContactImpulseY; + angularContactImpulse.z = this._angularContactImpulseZ; + } ,getGravityScale: function() { return this._gravityScale; } @@ -39621,14 +36273,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleepTime = 0; } ,getLocalPoint: function(worldPoint) { - var v; var vX; var vY; var vZ; - var v1 = worldPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; @@ -39642,21 +36292,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vY = __tmp__Y; vZ = __tmp__Z; var res = new oimo_common_Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + res.x = vX; + res.y = vY; + res.z = vZ; return res; } ,getLocalPointTo: function(worldPoint,localPoint) { - var v; var vX; var vY; var vZ; - var v1 = worldPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; @@ -39669,20 +36316,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = localPoint; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; } ,getLocalVector: function(worldVector) { - var v; var vX; var vY; var vZ; - var v1 = worldVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39693,21 +36337,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vY = __tmp__Y; vZ = __tmp__Z; var res = new oimo_common_Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + res.x = vX; + res.y = vY; + res.z = vZ; return res; } ,getLocalVectorTo: function(worldVector,localVector) { - var v; var vX; var vY; var vZ; - var v1 = worldVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39717,20 +36358,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = localVector; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; } ,getWorldPoint: function(localPoint) { - var v; var vX; var vY; var vZ; - var v1 = localPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39744,21 +36382,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vY += this._transform._positionY; vZ += this._transform._positionZ; var res = new oimo_common_Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + res.x = vX; + res.y = vY; + res.z = vZ; return res; } ,getWorldPointTo: function(localPoint,worldPoint) { - var v; var vX; var vY; var vZ; - var v1 = localPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39771,20 +36406,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vX += this._transform._positionX; vY += this._transform._positionY; vZ += this._transform._positionZ; - var v2 = worldPoint; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + worldPoint.x = vX; + worldPoint.y = vY; + worldPoint.z = vZ; } ,getWorldVector: function(localVector) { - var v; var vX; var vY; var vZ; - var v1 = localVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39795,21 +36427,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vY = __tmp__Y; vZ = __tmp__Z; var res = new oimo_common_Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + res.x = vX; + res.y = vY; + res.z = vZ; return res; } ,getWorldVectorTo: function(localVector,worldVector) { - var v; var vX; var vY; var vZ; - var v1 = localVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -39819,10 +36448,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = worldVector; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + worldVector.x = vX; + worldVector.y = vY; + worldVector.z = vZ; } ,getNumShapes: function() { return this._numShapes; @@ -39863,9 +36491,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -39875,15 +36504,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -39896,18 +36525,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; var dst1 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -39917,15 +36545,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -39938,20 +36566,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -39970,7 +36596,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -40036,17 +36661,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(cc1 == cc2) { + if(c._s1._contactCallback == cc2) { cc2 = null; } - if(cc1 != null) { - cc1.endContact(c); - } - if(cc2 != null) { - cc2.endContact(c); - } } var prev2 = c._link1._prev; var next2 = c._link1._next; @@ -40113,9 +36731,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var s = this._shapeList; while(s != null) { var n1 = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; var dst = s._ptransform; var src1 = s._localTransform; - var src2 = this._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -40125,15 +36744,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -40146,18 +36765,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; var dst1 = s._transform; var src11 = s._localTransform; - var src21 = this._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -40167,15 +36785,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -40188,20 +36806,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -40220,7 +36836,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -40447,9 +37062,10 @@ oimo_dynamics_rigidbody_Shape.prototype = { var s = _this1._shapeList; while(s != null) { var n = s._next; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; var dst = s._ptransform; var src1 = s._localTransform; - var src2 = _this1._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -40459,15 +37075,15 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -40480,18 +37096,17 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; var dst1 = s._transform; var src11 = s._localTransform; - var src21 = _this1._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -40501,15 +37116,15 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -40522,20 +37137,18 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -40554,7 +37167,6 @@ oimo_dynamics_rigidbody_Shape.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -40582,9 +37194,10 @@ oimo_dynamics_rigidbody_Shape.prototype = { var s = _this._shapeList; while(s != null) { var n = s._next; + var tf1 = _this._ptransform; + var tf2 = _this._transform; var dst = s._ptransform; var src1 = s._localTransform; - var src2 = _this._ptransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -40594,15 +37207,15 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -40615,18 +37228,17 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__X; var __tmp__Y; var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; var dst1 = s._transform; var src11 = s._localTransform; - var src21 = _this._transform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -40636,15 +37248,15 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -40657,20 +37269,18 @@ oimo_dynamics_rigidbody_Shape.prototype = { var __tmp__X1; var __tmp__Y1; var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; - var max; var maxX; var maxY; var maxZ; @@ -40689,7 +37299,6 @@ oimo_dynamics_rigidbody_Shape.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; var dX; var dY; var dZ; @@ -40754,6 +37363,7 @@ var oimo_dynamics_rigidbody_ShapeConfig = function() { this.geometry = null; this.contactCallback = null; }; +var oimo_m_M = function() { }; oimo_collision_broadphase_BroadPhaseType._BRUTE_FORCE = 1; oimo_collision_broadphase_BroadPhaseType._BVH = 2; oimo_collision_broadphase_BroadPhaseType.BRUTE_FORCE = 1; @@ -40837,8 +37447,8 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_ADD_V oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_DID_NOT_CONVERGE = 259; oimo_common_Mat3.numCreations = 0; oimo_common_Mat4.numCreations = 0; -oimo_common_MathUtil.POSITIVE_INFINITY = 1.0 / 0.0; -oimo_common_MathUtil.NEGATIVE_INFINITY = -1.0 / 0.0; +oimo_common_MathUtil.POSITIVE_INFINITY = 1e65536; +oimo_common_MathUtil.NEGATIVE_INFINITY = -1e65536; oimo_common_MathUtil.PI = 3.14159265358979; oimo_common_MathUtil.TWO_PI = 6.28318530717958; oimo_common_MathUtil.HALF_PI = 1.570796326794895; @@ -40866,12 +37476,14 @@ oimo_dynamics_constraint_joint_JointType._CYLINDRICAL = 2; oimo_dynamics_constraint_joint_JointType._PRISMATIC = 3; oimo_dynamics_constraint_joint_JointType._UNIVERSAL = 4; oimo_dynamics_constraint_joint_JointType._RAGDOLL = 5; +oimo_dynamics_constraint_joint_JointType._GENERIC = 6; oimo_dynamics_constraint_joint_JointType.SPHERICAL = 0; oimo_dynamics_constraint_joint_JointType.REVOLUTE = 1; oimo_dynamics_constraint_joint_JointType.CYLINDRICAL = 2; oimo_dynamics_constraint_joint_JointType.PRISMATIC = 3; oimo_dynamics_constraint_joint_JointType.UNIVERSAL = 4; oimo_dynamics_constraint_joint_JointType.RAGDOLL = 5; +oimo_dynamics_constraint_joint_JointType.GENERIC = 6; oimo_dynamics_constraint_solver_ConstraintSolverType._ITERATIVE = 0; oimo_dynamics_constraint_solver_ConstraintSolverType._DIRECT = 1; oimo_dynamics_constraint_solver_ConstraintSolverType.ITERATIVE = 0; @@ -40882,641 +37494,5 @@ oimo_dynamics_rigidbody_RigidBodyType._KINEMATIC = 2; oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC = 0; oimo_dynamics_rigidbody_RigidBodyType.STATIC = 1; oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC = 2; -window["OIMO"] = {}; -window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; -window["OIMO"]["BroadPhase"] = oimo_collision_broadphase_BroadPhase; -oimo_collision_broadphase_BroadPhase.prototype["createProxy"] = oimo_collision_broadphase_BroadPhase.prototype.createProxy; -oimo_collision_broadphase_BroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_BroadPhase.prototype.destroyProxy; -oimo_collision_broadphase_BroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_BroadPhase.prototype.moveProxy; -oimo_collision_broadphase_BroadPhase.prototype["isOverlapping"] = oimo_collision_broadphase_BroadPhase.prototype.isOverlapping; -oimo_collision_broadphase_BroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_BroadPhase.prototype.collectPairs; -oimo_collision_broadphase_BroadPhase.prototype["getProxyPairList"] = oimo_collision_broadphase_BroadPhase.prototype.getProxyPairList; -oimo_collision_broadphase_BroadPhase.prototype["isIncremental"] = oimo_collision_broadphase_BroadPhase.prototype.isIncremental; -oimo_collision_broadphase_BroadPhase.prototype["getTestCount"] = oimo_collision_broadphase_BroadPhase.prototype.getTestCount; -oimo_collision_broadphase_BroadPhase.prototype["rayCast"] = oimo_collision_broadphase_BroadPhase.prototype.rayCast; -oimo_collision_broadphase_BroadPhase.prototype["convexCast"] = oimo_collision_broadphase_BroadPhase.prototype.convexCast; -oimo_collision_broadphase_BroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_BroadPhase.prototype.aabbTest; -window["OIMO"]["Geometry"] = oimo_collision_geometry_Geometry; -oimo_collision_geometry_Geometry.prototype["getType"] = oimo_collision_geometry_Geometry.prototype.getType; -oimo_collision_geometry_Geometry.prototype["getVolume"] = oimo_collision_geometry_Geometry.prototype.getVolume; -oimo_collision_geometry_Geometry.prototype["rayCast"] = oimo_collision_geometry_Geometry.prototype.rayCast; -window["OIMO"]["ConvexGeometry"] = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_ConvexGeometry.prototype["getGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.getGjkMergin; -oimo_collision_geometry_ConvexGeometry.prototype["setGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.setGjkMergin; -oimo_collision_geometry_ConvexGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexGeometry.prototype.computeLocalSupportingVertex; -oimo_collision_geometry_ConvexGeometry.prototype["rayCast"] = oimo_collision_geometry_ConvexGeometry.prototype.rayCast; -window["OIMO"]["BroadPhaseProxyCallback"] = oimo_collision_broadphase_BroadPhaseProxyCallback; -oimo_collision_broadphase_BroadPhaseProxyCallback.prototype["process"] = oimo_collision_broadphase_BroadPhaseProxyCallback.prototype.process; -window["OIMO"]["BroadPhaseType"] = oimo_collision_broadphase_BroadPhaseType; -window["OIMO"]["Proxy"] = oimo_collision_broadphase_Proxy; -oimo_collision_broadphase_Proxy.prototype["getId"] = oimo_collision_broadphase_Proxy.prototype.getId; -oimo_collision_broadphase_Proxy.prototype["getFatAabb"] = oimo_collision_broadphase_Proxy.prototype.getFatAabb; -oimo_collision_broadphase_Proxy.prototype["getFatAabbTo"] = oimo_collision_broadphase_Proxy.prototype.getFatAabbTo; -window["OIMO"]["ProxyPair"] = oimo_collision_broadphase_ProxyPair; -oimo_collision_broadphase_ProxyPair.prototype["getProxy1"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy1; -oimo_collision_broadphase_ProxyPair.prototype["getProxy2"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy2; -oimo_collision_broadphase_ProxyPair.prototype["getNext"] = oimo_collision_broadphase_ProxyPair.prototype.getNext; -window["OIMO"]["BruteForceBroadPhase"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.createProxy; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.destroyProxy; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.moveProxy; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.collectPairs; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.rayCast; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.convexCast; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.aabbTest; -window["OIMO"]["BvhBroadPhase"] = oimo_collision_broadphase_bvh_BvhBroadPhase; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.createProxy; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.destroyProxy; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.moveProxy; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.collectPairs; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.rayCast; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.convexCast; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.aabbTest; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["getTreeBalance"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.getTreeBalance; -window["OIMO"]["Aabb"] = oimo_collision_geometry_Aabb; -oimo_collision_geometry_Aabb.prototype["init"] = oimo_collision_geometry_Aabb.prototype.init; -oimo_collision_geometry_Aabb.prototype["getMin"] = oimo_collision_geometry_Aabb.prototype.getMin; -oimo_collision_geometry_Aabb.prototype["getMinTo"] = oimo_collision_geometry_Aabb.prototype.getMinTo; -oimo_collision_geometry_Aabb.prototype["setMin"] = oimo_collision_geometry_Aabb.prototype.setMin; -oimo_collision_geometry_Aabb.prototype["getMax"] = oimo_collision_geometry_Aabb.prototype.getMax; -oimo_collision_geometry_Aabb.prototype["getMaxTo"] = oimo_collision_geometry_Aabb.prototype.getMaxTo; -oimo_collision_geometry_Aabb.prototype["setMax"] = oimo_collision_geometry_Aabb.prototype.setMax; -oimo_collision_geometry_Aabb.prototype["getCenter"] = oimo_collision_geometry_Aabb.prototype.getCenter; -oimo_collision_geometry_Aabb.prototype["getCenterTo"] = oimo_collision_geometry_Aabb.prototype.getCenterTo; -oimo_collision_geometry_Aabb.prototype["getExtents"] = oimo_collision_geometry_Aabb.prototype.getExtents; -oimo_collision_geometry_Aabb.prototype["getExtentsTo"] = oimo_collision_geometry_Aabb.prototype.getExtentsTo; -oimo_collision_geometry_Aabb.prototype["combine"] = oimo_collision_geometry_Aabb.prototype.combine; -oimo_collision_geometry_Aabb.prototype["combined"] = oimo_collision_geometry_Aabb.prototype.combined; -oimo_collision_geometry_Aabb.prototype["overlap"] = oimo_collision_geometry_Aabb.prototype.overlap; -oimo_collision_geometry_Aabb.prototype["getIntersection"] = oimo_collision_geometry_Aabb.prototype.getIntersection; -oimo_collision_geometry_Aabb.prototype["getIntersectionTo"] = oimo_collision_geometry_Aabb.prototype.getIntersectionTo; -oimo_collision_geometry_Aabb.prototype["copyFrom"] = oimo_collision_geometry_Aabb.prototype.copyFrom; -oimo_collision_geometry_Aabb.prototype["clone"] = oimo_collision_geometry_Aabb.prototype.clone; -window["OIMO"]["BoxGeometry"] = oimo_collision_geometry_BoxGeometry; -oimo_collision_geometry_BoxGeometry.prototype["getHalfExtents"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtents; -oimo_collision_geometry_BoxGeometry.prototype["getHalfExtentsTo"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtentsTo; -oimo_collision_geometry_BoxGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_BoxGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["CapsuleGeometry"] = oimo_collision_geometry_CapsuleGeometry; -oimo_collision_geometry_CapsuleGeometry.prototype["getRadius"] = oimo_collision_geometry_CapsuleGeometry.prototype.getRadius; -oimo_collision_geometry_CapsuleGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CapsuleGeometry.prototype.getHalfHeight; -oimo_collision_geometry_CapsuleGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CapsuleGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["ConeGeometry"] = oimo_collision_geometry_ConeGeometry; -oimo_collision_geometry_ConeGeometry.prototype["getRadius"] = oimo_collision_geometry_ConeGeometry.prototype.getRadius; -oimo_collision_geometry_ConeGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_ConeGeometry.prototype.getHalfHeight; -oimo_collision_geometry_ConeGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConeGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["ConvexHullGeometry"] = oimo_collision_geometry_ConvexHullGeometry; -oimo_collision_geometry_ConvexHullGeometry.prototype["getVertices"] = oimo_collision_geometry_ConvexHullGeometry.prototype.getVertices; -oimo_collision_geometry_ConvexHullGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexHullGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["CylinderGeometry"] = oimo_collision_geometry_CylinderGeometry; -oimo_collision_geometry_CylinderGeometry.prototype["getRadius"] = oimo_collision_geometry_CylinderGeometry.prototype.getRadius; -oimo_collision_geometry_CylinderGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CylinderGeometry.prototype.getHalfHeight; -oimo_collision_geometry_CylinderGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CylinderGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["GeometryType"] = oimo_collision_geometry_GeometryType; -window["OIMO"]["RayCastHit"] = oimo_collision_geometry_RayCastHit; -window["OIMO"]["SphereGeometry"] = oimo_collision_geometry_SphereGeometry; -oimo_collision_geometry_SphereGeometry.prototype["getRadius"] = oimo_collision_geometry_SphereGeometry.prototype.getRadius; -oimo_collision_geometry_SphereGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_SphereGeometry.prototype.computeLocalSupportingVertex; -window["OIMO"]["CollisionMatrix"] = oimo_collision_narrowphase_CollisionMatrix; -oimo_collision_narrowphase_CollisionMatrix.prototype["getDetector"] = oimo_collision_narrowphase_CollisionMatrix.prototype.getDetector; -window["OIMO"]["DetectorResult"] = oimo_collision_narrowphase_DetectorResult; -oimo_collision_narrowphase_DetectorResult.prototype["getMaxDepth"] = oimo_collision_narrowphase_DetectorResult.prototype.getMaxDepth; -oimo_collision_narrowphase_DetectorResult.prototype["clear"] = oimo_collision_narrowphase_DetectorResult.prototype.clear; -window["OIMO"]["DetectorResultPoint"] = oimo_collision_narrowphase_DetectorResultPoint; -window["OIMO"]["Detector"] = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_Detector.prototype["detect"] = oimo_collision_narrowphase_detector_Detector.prototype.detect; -window["OIMO"]["BoxBoxDetector"] = oimo_collision_narrowphase_detector_BoxBoxDetector; -window["OIMO"]["CapsuleCapsuleDetector"] = oimo_collision_narrowphase_detector_CapsuleCapsuleDetector; -window["OIMO"]["GjkEpaDetector"] = oimo_collision_narrowphase_detector_GjkEpaDetector; -window["OIMO"]["SphereBoxDetector"] = oimo_collision_narrowphase_detector_SphereBoxDetector; -window["OIMO"]["SphereCapsuleDetector"] = oimo_collision_narrowphase_detector_SphereCapsuleDetector; -window["OIMO"]["SphereSphereDetector"] = oimo_collision_narrowphase_detector_SphereSphereDetector; -window["OIMO"]["Vec3"] = oimo_common_Vec3; -oimo_common_Vec3.prototype["init"] = oimo_common_Vec3.prototype.init; -oimo_common_Vec3.prototype["zero"] = oimo_common_Vec3.prototype.zero; -oimo_common_Vec3.prototype["add"] = oimo_common_Vec3.prototype.add; -oimo_common_Vec3.prototype["addScaled"] = oimo_common_Vec3.prototype.addScaled; -oimo_common_Vec3.prototype["sub"] = oimo_common_Vec3.prototype.sub; -oimo_common_Vec3.prototype["scale"] = oimo_common_Vec3.prototype.scale; -oimo_common_Vec3.prototype["scale3"] = oimo_common_Vec3.prototype.scale3; -oimo_common_Vec3.prototype["dot"] = oimo_common_Vec3.prototype.dot; -oimo_common_Vec3.prototype["cross"] = oimo_common_Vec3.prototype.cross; -oimo_common_Vec3.prototype["addEq"] = oimo_common_Vec3.prototype.addEq; -oimo_common_Vec3.prototype["addScaledEq"] = oimo_common_Vec3.prototype.addScaledEq; -oimo_common_Vec3.prototype["subEq"] = oimo_common_Vec3.prototype.subEq; -oimo_common_Vec3.prototype["scaleEq"] = oimo_common_Vec3.prototype.scaleEq; -oimo_common_Vec3.prototype["scale3Eq"] = oimo_common_Vec3.prototype.scale3Eq; -oimo_common_Vec3.prototype["crossEq"] = oimo_common_Vec3.prototype.crossEq; -oimo_common_Vec3.prototype["mulMat3"] = oimo_common_Vec3.prototype.mulMat3; -oimo_common_Vec3.prototype["mulMat4"] = oimo_common_Vec3.prototype.mulMat4; -oimo_common_Vec3.prototype["mulTransform"] = oimo_common_Vec3.prototype.mulTransform; -oimo_common_Vec3.prototype["mulMat3Eq"] = oimo_common_Vec3.prototype.mulMat3Eq; -oimo_common_Vec3.prototype["mulMat4Eq"] = oimo_common_Vec3.prototype.mulMat4Eq; -oimo_common_Vec3.prototype["mulTransformEq"] = oimo_common_Vec3.prototype.mulTransformEq; -oimo_common_Vec3.prototype["length"] = oimo_common_Vec3.prototype.length; -oimo_common_Vec3.prototype["lengthSq"] = oimo_common_Vec3.prototype.lengthSq; -oimo_common_Vec3.prototype["normalized"] = oimo_common_Vec3.prototype.normalized; -oimo_common_Vec3.prototype["normalize"] = oimo_common_Vec3.prototype.normalize; -oimo_common_Vec3.prototype["negate"] = oimo_common_Vec3.prototype.negate; -oimo_common_Vec3.prototype["negateEq"] = oimo_common_Vec3.prototype.negateEq; -oimo_common_Vec3.prototype["copyFrom"] = oimo_common_Vec3.prototype.copyFrom; -oimo_common_Vec3.prototype["clone"] = oimo_common_Vec3.prototype.clone; -oimo_common_Vec3.prototype["toString"] = oimo_common_Vec3.prototype.toString; -window["OIMO"]["Transform"] = oimo_common_Transform; -oimo_common_Transform.prototype["identity"] = oimo_common_Transform.prototype.identity; -oimo_common_Transform.prototype["getPosition"] = oimo_common_Transform.prototype.getPosition; -oimo_common_Transform.prototype["getPositionTo"] = oimo_common_Transform.prototype.getPositionTo; -oimo_common_Transform.prototype["setPosition"] = oimo_common_Transform.prototype.setPosition; -oimo_common_Transform.prototype["translate"] = oimo_common_Transform.prototype.translate; -oimo_common_Transform.prototype["getRotation"] = oimo_common_Transform.prototype.getRotation; -oimo_common_Transform.prototype["getRotationTo"] = oimo_common_Transform.prototype.getRotationTo; -oimo_common_Transform.prototype["setRotation"] = oimo_common_Transform.prototype.setRotation; -oimo_common_Transform.prototype["setRotationXyz"] = oimo_common_Transform.prototype.setRotationXyz; -oimo_common_Transform.prototype["rotate"] = oimo_common_Transform.prototype.rotate; -oimo_common_Transform.prototype["rotateXyz"] = oimo_common_Transform.prototype.rotateXyz; -oimo_common_Transform.prototype["getOrientation"] = oimo_common_Transform.prototype.getOrientation; -oimo_common_Transform.prototype["getOrientationTo"] = oimo_common_Transform.prototype.getOrientationTo; -oimo_common_Transform.prototype["setOrientation"] = oimo_common_Transform.prototype.setOrientation; -oimo_common_Transform.prototype["clone"] = oimo_common_Transform.prototype.clone; -oimo_common_Transform.prototype["copyFrom"] = oimo_common_Transform.prototype.copyFrom; -window["OIMO"]["Setting"] = oimo_common_Setting; -window["OIMO"]["GjkEpa"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeClosestPoints"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeClosestPoints; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeDistance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeDistance; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["convexCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.convexCast; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["rayCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.rayCast; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa["getInstance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.getInstance; -window["OIMO"]["GjkEpaResultState"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState; -window["OIMO"]["SimplexUtil"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin2"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin3"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin4"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4; -window["OIMO"]["Mat3"] = oimo_common_Mat3; -oimo_common_Mat3.prototype["init"] = oimo_common_Mat3.prototype.init; -oimo_common_Mat3.prototype["identity"] = oimo_common_Mat3.prototype.identity; -oimo_common_Mat3.prototype["add"] = oimo_common_Mat3.prototype.add; -oimo_common_Mat3.prototype["sub"] = oimo_common_Mat3.prototype.sub; -oimo_common_Mat3.prototype["scale"] = oimo_common_Mat3.prototype.scale; -oimo_common_Mat3.prototype["mul"] = oimo_common_Mat3.prototype.mul; -oimo_common_Mat3.prototype["addEq"] = oimo_common_Mat3.prototype.addEq; -oimo_common_Mat3.prototype["subEq"] = oimo_common_Mat3.prototype.subEq; -oimo_common_Mat3.prototype["scaleEq"] = oimo_common_Mat3.prototype.scaleEq; -oimo_common_Mat3.prototype["mulEq"] = oimo_common_Mat3.prototype.mulEq; -oimo_common_Mat3.prototype["prependScale"] = oimo_common_Mat3.prototype.prependScale; -oimo_common_Mat3.prototype["appendScale"] = oimo_common_Mat3.prototype.appendScale; -oimo_common_Mat3.prototype["prependRotation"] = oimo_common_Mat3.prototype.prependRotation; -oimo_common_Mat3.prototype["appendRotation"] = oimo_common_Mat3.prototype.appendRotation; -oimo_common_Mat3.prototype["prependScaleEq"] = oimo_common_Mat3.prototype.prependScaleEq; -oimo_common_Mat3.prototype["appendScaleEq"] = oimo_common_Mat3.prototype.appendScaleEq; -oimo_common_Mat3.prototype["prependRotationEq"] = oimo_common_Mat3.prototype.prependRotationEq; -oimo_common_Mat3.prototype["appendRotationEq"] = oimo_common_Mat3.prototype.appendRotationEq; -oimo_common_Mat3.prototype["transpose"] = oimo_common_Mat3.prototype.transpose; -oimo_common_Mat3.prototype["transposeEq"] = oimo_common_Mat3.prototype.transposeEq; -oimo_common_Mat3.prototype["determinant"] = oimo_common_Mat3.prototype.determinant; -oimo_common_Mat3.prototype["trace"] = oimo_common_Mat3.prototype.trace; -oimo_common_Mat3.prototype["inverse"] = oimo_common_Mat3.prototype.inverse; -oimo_common_Mat3.prototype["inverseEq"] = oimo_common_Mat3.prototype.inverseEq; -oimo_common_Mat3.prototype["toArray"] = oimo_common_Mat3.prototype.toArray; -oimo_common_Mat3.prototype["copyFrom"] = oimo_common_Mat3.prototype.copyFrom; -oimo_common_Mat3.prototype["clone"] = oimo_common_Mat3.prototype.clone; -oimo_common_Mat3.prototype["fromQuat"] = oimo_common_Mat3.prototype.fromQuat; -oimo_common_Mat3.prototype["toQuat"] = oimo_common_Mat3.prototype.toQuat; -oimo_common_Mat3.prototype["fromEulerXyz"] = oimo_common_Mat3.prototype.fromEulerXyz; -oimo_common_Mat3.prototype["toEulerXyz"] = oimo_common_Mat3.prototype.toEulerXyz; -oimo_common_Mat3.prototype["getRow"] = oimo_common_Mat3.prototype.getRow; -oimo_common_Mat3.prototype["getCol"] = oimo_common_Mat3.prototype.getCol; -oimo_common_Mat3.prototype["getRowTo"] = oimo_common_Mat3.prototype.getRowTo; -oimo_common_Mat3.prototype["getColTo"] = oimo_common_Mat3.prototype.getColTo; -oimo_common_Mat3.prototype["fromRows"] = oimo_common_Mat3.prototype.fromRows; -oimo_common_Mat3.prototype["fromCols"] = oimo_common_Mat3.prototype.fromCols; -oimo_common_Mat3.prototype["toString"] = oimo_common_Mat3.prototype.toString; -window["OIMO"]["Mat4"] = oimo_common_Mat4; -oimo_common_Mat4.prototype["init"] = oimo_common_Mat4.prototype.init; -oimo_common_Mat4.prototype["identity"] = oimo_common_Mat4.prototype.identity; -oimo_common_Mat4.prototype["add"] = oimo_common_Mat4.prototype.add; -oimo_common_Mat4.prototype["sub"] = oimo_common_Mat4.prototype.sub; -oimo_common_Mat4.prototype["scale"] = oimo_common_Mat4.prototype.scale; -oimo_common_Mat4.prototype["mul"] = oimo_common_Mat4.prototype.mul; -oimo_common_Mat4.prototype["addEq"] = oimo_common_Mat4.prototype.addEq; -oimo_common_Mat4.prototype["subEq"] = oimo_common_Mat4.prototype.subEq; -oimo_common_Mat4.prototype["scaleEq"] = oimo_common_Mat4.prototype.scaleEq; -oimo_common_Mat4.prototype["mulEq"] = oimo_common_Mat4.prototype.mulEq; -oimo_common_Mat4.prototype["prependScale"] = oimo_common_Mat4.prototype.prependScale; -oimo_common_Mat4.prototype["appendScale"] = oimo_common_Mat4.prototype.appendScale; -oimo_common_Mat4.prototype["prependRotation"] = oimo_common_Mat4.prototype.prependRotation; -oimo_common_Mat4.prototype["appendRotation"] = oimo_common_Mat4.prototype.appendRotation; -oimo_common_Mat4.prototype["prependTranslation"] = oimo_common_Mat4.prototype.prependTranslation; -oimo_common_Mat4.prototype["appendTranslation"] = oimo_common_Mat4.prototype.appendTranslation; -oimo_common_Mat4.prototype["prependScaleEq"] = oimo_common_Mat4.prototype.prependScaleEq; -oimo_common_Mat4.prototype["appendScaleEq"] = oimo_common_Mat4.prototype.appendScaleEq; -oimo_common_Mat4.prototype["prependRotationEq"] = oimo_common_Mat4.prototype.prependRotationEq; -oimo_common_Mat4.prototype["appendRotationEq"] = oimo_common_Mat4.prototype.appendRotationEq; -oimo_common_Mat4.prototype["prependTranslationEq"] = oimo_common_Mat4.prototype.prependTranslationEq; -oimo_common_Mat4.prototype["appendTranslationEq"] = oimo_common_Mat4.prototype.appendTranslationEq; -oimo_common_Mat4.prototype["transpose"] = oimo_common_Mat4.prototype.transpose; -oimo_common_Mat4.prototype["transposeEq"] = oimo_common_Mat4.prototype.transposeEq; -oimo_common_Mat4.prototype["determinant"] = oimo_common_Mat4.prototype.determinant; -oimo_common_Mat4.prototype["trace"] = oimo_common_Mat4.prototype.trace; -oimo_common_Mat4.prototype["inverse"] = oimo_common_Mat4.prototype.inverse; -oimo_common_Mat4.prototype["inverseEq"] = oimo_common_Mat4.prototype.inverseEq; -oimo_common_Mat4.prototype["lookAt"] = oimo_common_Mat4.prototype.lookAt; -oimo_common_Mat4.prototype["perspective"] = oimo_common_Mat4.prototype.perspective; -oimo_common_Mat4.prototype["ortho"] = oimo_common_Mat4.prototype.ortho; -oimo_common_Mat4.prototype["toArray"] = oimo_common_Mat4.prototype.toArray; -oimo_common_Mat4.prototype["copyFrom"] = oimo_common_Mat4.prototype.copyFrom; -oimo_common_Mat4.prototype["fromMat3"] = oimo_common_Mat4.prototype.fromMat3; -oimo_common_Mat4.prototype["fromTransform"] = oimo_common_Mat4.prototype.fromTransform; -oimo_common_Mat4.prototype["clone"] = oimo_common_Mat4.prototype.clone; -oimo_common_Mat4.prototype["toString"] = oimo_common_Mat4.prototype.toString; -window["OIMO"]["MathUtil"] = oimo_common_MathUtil; -oimo_common_MathUtil["abs"] = oimo_common_MathUtil.abs; -oimo_common_MathUtil["sin"] = oimo_common_MathUtil.sin; -oimo_common_MathUtil["cos"] = oimo_common_MathUtil.cos; -oimo_common_MathUtil["tan"] = oimo_common_MathUtil.tan; -oimo_common_MathUtil["asin"] = oimo_common_MathUtil.asin; -oimo_common_MathUtil["acos"] = oimo_common_MathUtil.acos; -oimo_common_MathUtil["atan"] = oimo_common_MathUtil.atan; -oimo_common_MathUtil["safeAsin"] = oimo_common_MathUtil.safeAsin; -oimo_common_MathUtil["safeAcos"] = oimo_common_MathUtil.safeAcos; -oimo_common_MathUtil["atan2"] = oimo_common_MathUtil.atan2; -oimo_common_MathUtil["sqrt"] = oimo_common_MathUtil.sqrt; -oimo_common_MathUtil["clamp"] = oimo_common_MathUtil.clamp; -oimo_common_MathUtil["rand"] = oimo_common_MathUtil.rand; -oimo_common_MathUtil["randIn"] = oimo_common_MathUtil.randIn; -oimo_common_MathUtil["randVec3In"] = oimo_common_MathUtil.randVec3In; -oimo_common_MathUtil["randVec3"] = oimo_common_MathUtil.randVec3; -window["OIMO"]["Pool"] = oimo_common_Pool; -oimo_common_Pool.prototype["vec3"] = oimo_common_Pool.prototype.vec3; -oimo_common_Pool.prototype["mat3"] = oimo_common_Pool.prototype.mat3; -oimo_common_Pool.prototype["mat4"] = oimo_common_Pool.prototype.mat4; -oimo_common_Pool.prototype["quat"] = oimo_common_Pool.prototype.quat; -oimo_common_Pool.prototype["dispose"] = oimo_common_Pool.prototype.dispose; -oimo_common_Pool.prototype["disposeVec3"] = oimo_common_Pool.prototype.disposeVec3; -oimo_common_Pool.prototype["disposeMat3"] = oimo_common_Pool.prototype.disposeMat3; -oimo_common_Pool.prototype["disposeMat4"] = oimo_common_Pool.prototype.disposeMat4; -oimo_common_Pool.prototype["disposeQuat"] = oimo_common_Pool.prototype.disposeQuat; -window["OIMO"]["Quat"] = oimo_common_Quat; -oimo_common_Quat.prototype["identity"] = oimo_common_Quat.prototype.identity; -oimo_common_Quat.prototype["init"] = oimo_common_Quat.prototype.init; -oimo_common_Quat.prototype["add"] = oimo_common_Quat.prototype.add; -oimo_common_Quat.prototype["sub"] = oimo_common_Quat.prototype.sub; -oimo_common_Quat.prototype["scale"] = oimo_common_Quat.prototype.scale; -oimo_common_Quat.prototype["addEq"] = oimo_common_Quat.prototype.addEq; -oimo_common_Quat.prototype["subEq"] = oimo_common_Quat.prototype.subEq; -oimo_common_Quat.prototype["scaleEq"] = oimo_common_Quat.prototype.scaleEq; -oimo_common_Quat.prototype["length"] = oimo_common_Quat.prototype.length; -oimo_common_Quat.prototype["lengthSq"] = oimo_common_Quat.prototype.lengthSq; -oimo_common_Quat.prototype["dot"] = oimo_common_Quat.prototype.dot; -oimo_common_Quat.prototype["normalized"] = oimo_common_Quat.prototype.normalized; -oimo_common_Quat.prototype["normalize"] = oimo_common_Quat.prototype.normalize; -oimo_common_Quat.prototype["setArc"] = oimo_common_Quat.prototype.setArc; -oimo_common_Quat.prototype["slerp"] = oimo_common_Quat.prototype.slerp; -oimo_common_Quat.prototype["copyFrom"] = oimo_common_Quat.prototype.copyFrom; -oimo_common_Quat.prototype["clone"] = oimo_common_Quat.prototype.clone; -oimo_common_Quat.prototype["fromMat3"] = oimo_common_Quat.prototype.fromMat3; -oimo_common_Quat.prototype["toMat3"] = oimo_common_Quat.prototype.toMat3; -oimo_common_Quat.prototype["toString"] = oimo_common_Quat.prototype.toString; -window["OIMO"]["Contact"] = oimo_dynamics_Contact; -oimo_dynamics_Contact.prototype["getShape1"] = oimo_dynamics_Contact.prototype.getShape1; -oimo_dynamics_Contact.prototype["getShape2"] = oimo_dynamics_Contact.prototype.getShape2; -oimo_dynamics_Contact.prototype["isTouching"] = oimo_dynamics_Contact.prototype.isTouching; -oimo_dynamics_Contact.prototype["getManifold"] = oimo_dynamics_Contact.prototype.getManifold; -oimo_dynamics_Contact.prototype["getContactConstraint"] = oimo_dynamics_Contact.prototype.getContactConstraint; -oimo_dynamics_Contact.prototype["getPrev"] = oimo_dynamics_Contact.prototype.getPrev; -oimo_dynamics_Contact.prototype["getNext"] = oimo_dynamics_Contact.prototype.getNext; -window["OIMO"]["ContactLink"] = oimo_dynamics_ContactLink; -oimo_dynamics_ContactLink.prototype["getContact"] = oimo_dynamics_ContactLink.prototype.getContact; -oimo_dynamics_ContactLink.prototype["getOther"] = oimo_dynamics_ContactLink.prototype.getOther; -oimo_dynamics_ContactLink.prototype["getPrev"] = oimo_dynamics_ContactLink.prototype.getPrev; -oimo_dynamics_ContactLink.prototype["getNext"] = oimo_dynamics_ContactLink.prototype.getNext; -window["OIMO"]["ContactManager"] = oimo_dynamics_ContactManager; -oimo_dynamics_ContactManager.prototype["getNumContacts"] = oimo_dynamics_ContactManager.prototype.getNumContacts; -oimo_dynamics_ContactManager.prototype["getContactList"] = oimo_dynamics_ContactManager.prototype.getContactList; -window["OIMO"]["TimeStep"] = oimo_dynamics_TimeStep; -window["OIMO"]["World"] = oimo_dynamics_World; -oimo_dynamics_World.prototype["step"] = oimo_dynamics_World.prototype.step; -oimo_dynamics_World.prototype["addRigidBody"] = oimo_dynamics_World.prototype.addRigidBody; -oimo_dynamics_World.prototype["removeRigidBody"] = oimo_dynamics_World.prototype.removeRigidBody; -oimo_dynamics_World.prototype["addJoint"] = oimo_dynamics_World.prototype.addJoint; -oimo_dynamics_World.prototype["removeJoint"] = oimo_dynamics_World.prototype.removeJoint; -oimo_dynamics_World.prototype["setDebugDraw"] = oimo_dynamics_World.prototype.setDebugDraw; -oimo_dynamics_World.prototype["getDebugDraw"] = oimo_dynamics_World.prototype.getDebugDraw; -oimo_dynamics_World.prototype["debugDraw"] = oimo_dynamics_World.prototype.debugDraw; -oimo_dynamics_World.prototype["rayCast"] = oimo_dynamics_World.prototype.rayCast; -oimo_dynamics_World.prototype["convexCast"] = oimo_dynamics_World.prototype.convexCast; -oimo_dynamics_World.prototype["aabbTest"] = oimo_dynamics_World.prototype.aabbTest; -oimo_dynamics_World.prototype["getRigidBodyList"] = oimo_dynamics_World.prototype.getRigidBodyList; -oimo_dynamics_World.prototype["getJointList"] = oimo_dynamics_World.prototype.getJointList; -oimo_dynamics_World.prototype["getBroadPhase"] = oimo_dynamics_World.prototype.getBroadPhase; -oimo_dynamics_World.prototype["getContactManager"] = oimo_dynamics_World.prototype.getContactManager; -oimo_dynamics_World.prototype["getNumRigidBodies"] = oimo_dynamics_World.prototype.getNumRigidBodies; -oimo_dynamics_World.prototype["getNumJoints"] = oimo_dynamics_World.prototype.getNumJoints; -oimo_dynamics_World.prototype["getNumShapes"] = oimo_dynamics_World.prototype.getNumShapes; -oimo_dynamics_World.prototype["getNumIslands"] = oimo_dynamics_World.prototype.getNumIslands; -oimo_dynamics_World.prototype["getNumVelocityIterations"] = oimo_dynamics_World.prototype.getNumVelocityIterations; -oimo_dynamics_World.prototype["setNumVelocityIterations"] = oimo_dynamics_World.prototype.setNumVelocityIterations; -oimo_dynamics_World.prototype["getNumPositionIterations"] = oimo_dynamics_World.prototype.getNumPositionIterations; -oimo_dynamics_World.prototype["setNumPositionIterations"] = oimo_dynamics_World.prototype.setNumPositionIterations; -oimo_dynamics_World.prototype["getGravity"] = oimo_dynamics_World.prototype.getGravity; -oimo_dynamics_World.prototype["setGravity"] = oimo_dynamics_World.prototype.setGravity; -window["OIMO"]["AabbTestCallback"] = oimo_dynamics_callback_AabbTestCallback; -window["OIMO"]["ContactCallback"] = oimo_dynamics_callback_ContactCallback; -window["OIMO"]["RayCastCallback"] = oimo_dynamics_callback_RayCastCallback; -window["OIMO"]["RayCastClosest"] = oimo_dynamics_callback_RayCastClosest; -oimo_dynamics_callback_RayCastClosest.prototype["clear"] = oimo_dynamics_callback_RayCastClosest.prototype.clear; -oimo_dynamics_callback_RayCastClosest.prototype["process"] = oimo_dynamics_callback_RayCastClosest.prototype.process; -window["OIMO"]["DebugDrawStyle"] = oimo_dynamics_common_DebugDrawStyle; -window["OIMO"]["Performance"] = oimo_dynamics_common_Performance; -window["OIMO"]["ConstraintSolver"] = oimo_dynamics_constraint_ConstraintSolver; -oimo_dynamics_constraint_ConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolveVelocity; -oimo_dynamics_constraint_ConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_ConstraintSolver.prototype.warmStart; -oimo_dynamics_constraint_ConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solveVelocity; -oimo_dynamics_constraint_ConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolveVelocity; -oimo_dynamics_constraint_ConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolvePosition; -oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionSplitImpulse; -oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionNgs; -oimo_dynamics_constraint_ConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolve; -window["OIMO"]["PositionCorrectionAlgorithm"] = oimo_dynamics_constraint_PositionCorrectionAlgorithm; -window["OIMO"]["ContactConstraint"] = oimo_dynamics_constraint_contact_ContactConstraint; -oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape1"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape1; -oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape2"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape2; -oimo_dynamics_constraint_contact_ContactConstraint.prototype["getManifold"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getManifold; -oimo_dynamics_constraint_contact_ContactConstraint.prototype["isTouching"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.isTouching; -window["OIMO"]["Manifold"] = oimo_dynamics_constraint_contact_Manifold; -oimo_dynamics_constraint_contact_Manifold.prototype["getNormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormal; -oimo_dynamics_constraint_contact_Manifold.prototype["getNormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormalTo; -oimo_dynamics_constraint_contact_Manifold.prototype["getTangent"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangent; -oimo_dynamics_constraint_contact_Manifold.prototype["getTangentTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangentTo; -oimo_dynamics_constraint_contact_Manifold.prototype["getBinormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormal; -oimo_dynamics_constraint_contact_Manifold.prototype["getBinormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormalTo; -oimo_dynamics_constraint_contact_Manifold.prototype["getPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getPoints; -oimo_dynamics_constraint_contact_Manifold.prototype["getNumPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNumPoints; -window["OIMO"]["ManifoldPoint"] = oimo_dynamics_constraint_contact_ManifoldPoint; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1To; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2To; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getDepth"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getDepth; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isWarmStarted"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isWarmStarted; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getNormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getNormalImpulse; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getTangentImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getTangentImpulse; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getBinormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getBinormalImpulse; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isEnabled"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isEnabled; -window["OIMO"]["Joint"] = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody1"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody1; -oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody2"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody2; -oimo_dynamics_constraint_joint_Joint.prototype["getType"] = oimo_dynamics_constraint_joint_Joint.prototype.getType; -oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1; -oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2; -oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1To; -oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2To; -oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1; -oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2; -oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1To; -oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2To; -oimo_dynamics_constraint_joint_Joint.prototype["getBasis1"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1; -oimo_dynamics_constraint_joint_Joint.prototype["getBasis2"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2; -oimo_dynamics_constraint_joint_Joint.prototype["getBasis1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1To; -oimo_dynamics_constraint_joint_Joint.prototype["getBasis2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2To; -oimo_dynamics_constraint_joint_Joint.prototype["getAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.getAllowCollision; -oimo_dynamics_constraint_joint_Joint.prototype["setAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.setAllowCollision; -oimo_dynamics_constraint_joint_Joint.prototype["getBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakForce; -oimo_dynamics_constraint_joint_Joint.prototype["setBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakForce; -oimo_dynamics_constraint_joint_Joint.prototype["getBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakTorque; -oimo_dynamics_constraint_joint_Joint.prototype["setBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakTorque; -oimo_dynamics_constraint_joint_Joint.prototype["getPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.getPositionCorrectionAlgorithm; -oimo_dynamics_constraint_joint_Joint.prototype["setPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.setPositionCorrectionAlgorithm; -oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForce; -oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForceTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForceTo; -oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorque; -oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorqueTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorqueTo; -oimo_dynamics_constraint_joint_Joint.prototype["getPrev"] = oimo_dynamics_constraint_joint_Joint.prototype.getPrev; -oimo_dynamics_constraint_joint_Joint.prototype["getNext"] = oimo_dynamics_constraint_joint_Joint.prototype.getNext; -window["OIMO"]["CylindricalJoint"] = oimo_dynamics_constraint_joint_CylindricalJoint; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1To; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2To; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1To; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2To; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalSpringDamper; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalSpringDamper; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalLimitMotor; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalLimitMotor; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAngle; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslation; -window["OIMO"]["JointConfig"] = oimo_dynamics_constraint_joint_JointConfig; -window["OIMO"]["CylindricalJointConfig"] = oimo_dynamics_constraint_joint_CylindricalJointConfig; -oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype.init; -window["OIMO"]["JointLink"] = oimo_dynamics_constraint_joint_JointLink; -oimo_dynamics_constraint_joint_JointLink.prototype["getContact"] = oimo_dynamics_constraint_joint_JointLink.prototype.getContact; -oimo_dynamics_constraint_joint_JointLink.prototype["getOther"] = oimo_dynamics_constraint_joint_JointLink.prototype.getOther; -oimo_dynamics_constraint_joint_JointLink.prototype["getPrev"] = oimo_dynamics_constraint_joint_JointLink.prototype.getPrev; -oimo_dynamics_constraint_joint_JointLink.prototype["getNext"] = oimo_dynamics_constraint_joint_JointLink.prototype.getNext; -window["OIMO"]["JointType"] = oimo_dynamics_constraint_joint_JointType; -window["OIMO"]["PrismaticJoint"] = oimo_dynamics_constraint_joint_PrismaticJoint; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1To; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2To; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1To; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2To; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getSpringDamper; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLimitMotor; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getTranslation; -window["OIMO"]["PrismaticJointConfig"] = oimo_dynamics_constraint_joint_PrismaticJointConfig; -oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype.init; -window["OIMO"]["RagdollJoint"] = oimo_dynamics_constraint_joint_RagdollJoint; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1To; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2To; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1To; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2To; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistSpringDamper; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistLimitMotor"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistLimitMotor; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingSpringDamper; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxis"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxis; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxisTo"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxisTo; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAngle; -oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistAngle; -window["OIMO"]["RagdollJointConfig"] = oimo_dynamics_constraint_joint_RagdollJointConfig; -oimo_dynamics_constraint_joint_RagdollJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RagdollJointConfig.prototype.init; -window["OIMO"]["RevoluteJoint"] = oimo_dynamics_constraint_joint_RevoluteJoint; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1To; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2To; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1To; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2To; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getSpringDamper; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLimitMotor; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAngle; -window["OIMO"]["RevoluteJointConfig"] = oimo_dynamics_constraint_joint_RevoluteJointConfig; -oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype.init; -window["OIMO"]["RotationalLimitMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor; -oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setLimits; -oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setMotor; -oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.clone; -window["OIMO"]["SphericalJoint"] = oimo_dynamics_constraint_joint_SphericalJoint; -oimo_dynamics_constraint_joint_SphericalJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_SphericalJoint.prototype.getSpringDamper; -window["OIMO"]["SphericalJointConfig"] = oimo_dynamics_constraint_joint_SphericalJointConfig; -oimo_dynamics_constraint_joint_SphericalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_SphericalJointConfig.prototype.init; -window["OIMO"]["SpringDamper"] = oimo_dynamics_constraint_joint_SpringDamper; -oimo_dynamics_constraint_joint_SpringDamper.prototype["setSpring"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSpring; -oimo_dynamics_constraint_joint_SpringDamper.prototype["setSymplecticEuler"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSymplecticEuler; -oimo_dynamics_constraint_joint_SpringDamper.prototype["clone"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.clone; -window["OIMO"]["TranslationalLimitMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor; -oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setLimits; -oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setMotor; -oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.clone; -window["OIMO"]["UniversalJoint"] = oimo_dynamics_constraint_joint_UniversalJoint; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1To; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2To; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1To; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2To; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper1; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper2; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor1; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor2; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle1; -oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle2; -window["OIMO"]["UniversalJointConfig"] = oimo_dynamics_constraint_joint_UniversalJointConfig; -oimo_dynamics_constraint_joint_UniversalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_UniversalJointConfig.prototype.init; -window["OIMO"]["ConstraintSolverType"] = oimo_dynamics_constraint_solver_ConstraintSolverType; -window["OIMO"]["DirectJointConstraintSolver"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolveVelocity; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.warmStart; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solveVelocity; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolveVelocity; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolvePosition; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionSplitImpulse; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionNgs; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolve; -window["OIMO"]["PgsContactConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolveVelocity; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.warmStart; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solveVelocity; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolvePosition; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionSplitImpulse; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionNgs; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.postSolve; -window["OIMO"]["PgsJointConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolveVelocity; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.warmStart; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solveVelocity; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolveVelocity; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolvePosition; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionSplitImpulse; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionNgs; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolve; -window["OIMO"]["MassData"] = oimo_dynamics_rigidbody_MassData; -window["OIMO"]["RigidBody"] = oimo_dynamics_rigidbody_RigidBody; -oimo_dynamics_rigidbody_RigidBody.prototype["getPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPosition; -oimo_dynamics_rigidbody_RigidBody.prototype["getPositionTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPositionTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.setPosition; -oimo_dynamics_rigidbody_RigidBody.prototype["translate"] = oimo_dynamics_rigidbody_RigidBody.prototype.translate; -oimo_dynamics_rigidbody_RigidBody.prototype["getRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotation; -oimo_dynamics_rigidbody_RigidBody.prototype["getRotationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotation; -oimo_dynamics_rigidbody_RigidBody.prototype["setRotationXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationXyz; -oimo_dynamics_rigidbody_RigidBody.prototype["rotate"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotate; -oimo_dynamics_rigidbody_RigidBody.prototype["rotateXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotateXyz; -oimo_dynamics_rigidbody_RigidBody.prototype["getOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientation; -oimo_dynamics_rigidbody_RigidBody.prototype["getOrientationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientationTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setOrientation; -oimo_dynamics_rigidbody_RigidBody.prototype["getTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransform; -oimo_dynamics_rigidbody_RigidBody.prototype["getTransformTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransformTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.setTransform; -oimo_dynamics_rigidbody_RigidBody.prototype["getMass"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMass; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertia"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertia; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertiaTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertiaTo; -oimo_dynamics_rigidbody_RigidBody.prototype["getMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassData; -oimo_dynamics_rigidbody_RigidBody.prototype["getMassDataTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassDataTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.setMassData; -oimo_dynamics_rigidbody_RigidBody.prototype["getRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationFactor; -oimo_dynamics_rigidbody_RigidBody.prototype["setRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationFactor; -oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocityTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocityTo; -oimo_dynamics_rigidbody_RigidBody.prototype["setAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["addLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addLinearVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["addAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addAngularVelocity; -oimo_dynamics_rigidbody_RigidBody.prototype["applyImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyImpulse; -oimo_dynamics_rigidbody_RigidBody.prototype["applyLinearImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyLinearImpulse; -oimo_dynamics_rigidbody_RigidBody.prototype["applyAngularImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyAngularImpulse; -oimo_dynamics_rigidbody_RigidBody.prototype["applyForce"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForce; -oimo_dynamics_rigidbody_RigidBody.prototype["applyForceToCenter"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForceToCenter; -oimo_dynamics_rigidbody_RigidBody.prototype["applyTorque"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyTorque; -oimo_dynamics_rigidbody_RigidBody.prototype["getGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.getGravityScale; -oimo_dynamics_rigidbody_RigidBody.prototype["setGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.setGravityScale; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPoint; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPointTo; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVector; -oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVectorTo; -oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPoint; -oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPointTo; -oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVector; -oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVectorTo; -oimo_dynamics_rigidbody_RigidBody.prototype["getNumShapes"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumShapes; -oimo_dynamics_rigidbody_RigidBody.prototype["getShapeList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getShapeList; -oimo_dynamics_rigidbody_RigidBody.prototype["getNumContectLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContectLinks; -oimo_dynamics_rigidbody_RigidBody.prototype["getContactLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getContactLinkList; -oimo_dynamics_rigidbody_RigidBody.prototype["getNumJointLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumJointLinks; -oimo_dynamics_rigidbody_RigidBody.prototype["getJointLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getJointLinkList; -oimo_dynamics_rigidbody_RigidBody.prototype["addShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.addShape; -oimo_dynamics_rigidbody_RigidBody.prototype["removeShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.removeShape; -oimo_dynamics_rigidbody_RigidBody.prototype["getType"] = oimo_dynamics_rigidbody_RigidBody.prototype.getType; -oimo_dynamics_rigidbody_RigidBody.prototype["setType"] = oimo_dynamics_rigidbody_RigidBody.prototype.setType; -oimo_dynamics_rigidbody_RigidBody.prototype["wakeUp"] = oimo_dynamics_rigidbody_RigidBody.prototype.wakeUp; -oimo_dynamics_rigidbody_RigidBody.prototype["sleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.sleep; -oimo_dynamics_rigidbody_RigidBody.prototype["isSleeping"] = oimo_dynamics_rigidbody_RigidBody.prototype.isSleeping; -oimo_dynamics_rigidbody_RigidBody.prototype["getSleepTime"] = oimo_dynamics_rigidbody_RigidBody.prototype.getSleepTime; -oimo_dynamics_rigidbody_RigidBody.prototype["setAutoSleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAutoSleep; -oimo_dynamics_rigidbody_RigidBody.prototype["getLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearDamping; -oimo_dynamics_rigidbody_RigidBody.prototype["setLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearDamping; -oimo_dynamics_rigidbody_RigidBody.prototype["getAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularDamping; -oimo_dynamics_rigidbody_RigidBody.prototype["setAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularDamping; -oimo_dynamics_rigidbody_RigidBody.prototype["getPrev"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPrev; -oimo_dynamics_rigidbody_RigidBody.prototype["getNext"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNext; -window["OIMO"]["RigidBodyConfig"] = oimo_dynamics_rigidbody_RigidBodyConfig; -window["OIMO"]["RigidBodyType"] = oimo_dynamics_rigidbody_RigidBodyType; -window["OIMO"]["Shape"] = oimo_dynamics_rigidbody_Shape; -oimo_dynamics_rigidbody_Shape.prototype["getFriction"] = oimo_dynamics_rigidbody_Shape.prototype.getFriction; -oimo_dynamics_rigidbody_Shape.prototype["setFriction"] = oimo_dynamics_rigidbody_Shape.prototype.setFriction; -oimo_dynamics_rigidbody_Shape.prototype["getRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.getRestitution; -oimo_dynamics_rigidbody_Shape.prototype["setRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.setRestitution; -oimo_dynamics_rigidbody_Shape.prototype["getLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransform; -oimo_dynamics_rigidbody_Shape.prototype["getLocalTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransformTo; -oimo_dynamics_rigidbody_Shape.prototype["getTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getTransform; -oimo_dynamics_rigidbody_Shape.prototype["getTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getTransformTo; -oimo_dynamics_rigidbody_Shape.prototype["setLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.setLocalTransform; -oimo_dynamics_rigidbody_Shape.prototype["getDensity"] = oimo_dynamics_rigidbody_Shape.prototype.getDensity; -oimo_dynamics_rigidbody_Shape.prototype["setDensity"] = oimo_dynamics_rigidbody_Shape.prototype.setDensity; -oimo_dynamics_rigidbody_Shape.prototype["getAabb"] = oimo_dynamics_rigidbody_Shape.prototype.getAabb; -oimo_dynamics_rigidbody_Shape.prototype["getAabbTo"] = oimo_dynamics_rigidbody_Shape.prototype.getAabbTo; -oimo_dynamics_rigidbody_Shape.prototype["getGeometry"] = oimo_dynamics_rigidbody_Shape.prototype.getGeometry; -oimo_dynamics_rigidbody_Shape.prototype["getRigidBody"] = oimo_dynamics_rigidbody_Shape.prototype.getRigidBody; -oimo_dynamics_rigidbody_Shape.prototype["getCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionGroup; -oimo_dynamics_rigidbody_Shape.prototype["setCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionGroup; -oimo_dynamics_rigidbody_Shape.prototype["getCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionMask; -oimo_dynamics_rigidbody_Shape.prototype["setCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionMask; -oimo_dynamics_rigidbody_Shape.prototype["getContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.getContactCallback; -oimo_dynamics_rigidbody_Shape.prototype["setContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.setContactCallback; -oimo_dynamics_rigidbody_Shape.prototype["getPrev"] = oimo_dynamics_rigidbody_Shape.prototype.getPrev; -oimo_dynamics_rigidbody_Shape.prototype["getNext"] = oimo_dynamics_rigidbody_Shape.prototype.getNext; -window["OIMO"]["ShapeConfig"] = oimo_dynamics_rigidbody_ShapeConfig; -})(window); +export_js_Export.main(); +})({}); diff --git a/bin/js/OimoPhysics.min.js b/bin/js/OimoPhysics.min.js index 9d9a58a..187fc94 100644 --- a/bin/js/OimoPhysics.min.js +++ b/bin/js/OimoPhysics.min.js @@ -1 +1 @@ -/* OimoPhysics 1.2.0 (c) 2018 saharan, The MIT License */'use strict';(function(S){function Wa(a){this.Cc=-1;this.ha=new Ja;this.pa=new Ja;this.a=new Ja;var b=a.position;this.ha.v=b.x;this.ha.A=b.y;this.ha.B=b.z;b=a.rotation;this.ha.o=b.e00;this.ha.f=b.e01;this.ha.h=b.e02;this.ha.i=b.e10;this.ha.m=b.e11;this.ha.j=b.e12;this.ha.l=b.e20;this.ha.g=b.e21;this.ha.s=b.e22;var b=this.pa,e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;b=this.a;e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.hk=a.restitution;this.Xj=a.friction;this.Dk=a.density;this.Kb=a.geometry;this.Tj=a.collisionGroup;this.Uj=a.collisionMask;this.yd=a.contactCallback;this.u=new Xa;this.tb=null;this.rc=new t}function Rd(){}function u(a){this.Fi=this.Dc=this.ia=this.M=null;this.zg=0;this.kc=this.Ob=null;this.Ae=0;this.Ze=this.ze=null;this.kh=0;var b=a.linearVelocity;this.gb=b.x;this.hb=b.y;this.ib=b.z;b=a.angularVelocity;this.kb=b.x;this.lb=b.y;this.mb=b.z;this.Wc=this.Vc=this.Uc=this.$c=this.Zc=this.Yc=0;this.pa=new Ja;this.a=new Ja;b=a.position;this.pa.v=b.x;this.pa.A=b.y;this.pa.B=b.z;b=a.rotation;this.pa.o=b.e00;this.pa.f=b.e01;this.pa.h=b.e02;this.pa.i=b.e10;this.pa.m=b.e11;this.pa.j=b.e12;this.pa.l=b.e20;this.pa.g=b.e21;this.pa.s=b.e22;var b=this.a,e=this.pa;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Lb=a.type;this.yb=0;this.Gb=!1;this.Bk=a.autoSleep;this.Y=this.X=this.W=this.V=this.U=this.T=this.S=this.R=this.P=this.yi=this.xi=this.wi=this.vi=this.ui=this.ti=this.si=this.ri=this.pi=this.Za=this.Ya=this.Xa=this.Wa=this.Va=this.Ua=this.Ta=this.Sa=this.Ra=this.Id=this.Hd=this.Gd=this.Fd=this.Ed=this.Dd=this.Cd=this.Bd=this.Ad=this.$a=this.Pc=0;this.$j=a.linearDamping;this.Qj=a.angularDamping;this.xf=this.wf=this.vf=this.Oh=this.Nh=this.Mh=0;this.N=new t(1,1,1);this.Nf=!1;this.eh=1;this.oc=null}function ql(){this.mass=0;this.localInertia=new E}function mc(a){Ob.call(this);this.$=a;this.info=new rl;this.ac=Array(G.maxJacobianRows);a=0;for(var b=this.ac.length;a>1&85),c=(c&51)+(c>>2&51),c=(c&15)+(c>>4&15),d=Array(c),f=0,h=c;fc?(b=this.qa,e=this.ra,d=this.sa,c=b*b,f=e*e,h=d*d,cd?(b=this.qa,e=this.ra,c=this.sa,d=b*b,f=e*e,h=c*c,dc?(b=this.qa,e=this.ra,d=this.sa,c=b*b,f=e*e,h=d*d,cc?(b=this.qa,e=this.ra,d=this.sa,c=b*b,f=e*e,h=d*d,ca;){var b=a++,e=b&&4!=b?8:1;this.vk[b]=Array(e);this.Fh[b]=Array(e);this.xk[b]=Array(e);for(e=0;8>e;){var c=e++,d=.7853981633974475*b,f=.7853981633974475*c;this.vk[b][c]=new t(Math.sin(d)*Math.cos(f),Math.cos(d),-Math.sin(d)*Math.sin(f));this.Fh[b][c]=new t;this.xk[b][c]=new t}}this.yj=Array(8);this.dm=Array(8);this.fe=Array(8);this.Xd=Array(8);this.Te=Array(8);for(a=0;8>a;)b=a++,this.yj[b]=new t(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.dm[b]=new t(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.fe[b]=new t,this.Xd[b]=new t,this.Te[b]=new t;this.style=new xl}function hf(){this.position=new t;this.normal=new t;this.shape=null;this.fraction=1;this.position.Z();this.normal.Z();this.hit=!1}function ej(){}function fl(){}function yl(){}function Wj(){this.u=new Xa;this.Ql=null}function gl(){this.Mi=new fj;this.vj=new Ja;this.eg=new t;this.Z=new t;this.em=this.xj=null}function hl(){this.Mi=new fj;this.vj=new t;this.end=new t;this.xj=null}function Ma(a,b){null==a&&(a=2);switch(a){case 1:this.jc=new oc;break;case 2:this.jc=new hc}this.Kh=new He(this.jc);null==b&&(b=new t(0,-9.80665,0));this.Fk=new t(b.x,b.y,b.z);this.zi=this.Ph=this.Ei=this.uf=null;this.ek=this.Sk=this.zg=this.jj=0;this.Uk=10;this.Tk=5;this.gk=new hl;this.aj=new gl;this.yk=new Wj;this.vg=new zl;this.af=Array(G.islandInitialConstraintArraySize);this.ph=Array(G.islandInitialRigidBodyArraySize);this.Sh=new Al;this.Ga=new $b;this.Xl=0}function Al(){this.invDt=this.dt=0;this.dtRatio=1}function zl(){this.Jf=Array(G.islandInitialRigidBodyArraySize);this.Kf=Array(G.islandInitialConstraintArraySize);this.Eh=Array(G.islandInitialConstraintArraySize);this.Dh=Array(G.islandInitialConstraintArraySize);this.vh=this.wh=this.If=this.Hf=0}function He(a){this.jc=a;this.Xm=new dg;this.Bi=0}function ed(){this.Qc=this.Zd=this.M=this.ia=null}function Rb(){this.ia=this.M=null;this.rb=new ed;this.sb=new ed;this.Lh=this.D=this.C=this.$b=this.Zb=null;this.$i=new Bl;this.Ym=new ce;this.ik=this.Zj=!1;this.Ja=new ic;this.Zl=new el(this.Ja);this.Ye=new zd(this.Ja);this.Td=!1}function ta(a,b,e,c){null==c&&(c=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=c;ta.numCreations++}function $b(){this.b=Array(256);this.c=0;this.bb=Array(256);this.eb=0;this.Lf=Array(256);this.dg=0;this.Wd=Array(256);this.ee=0}function Oa(){}function O(a,b,e,c,d,f,h,l,g,k,m,n,q,p,r,v){null==v&&(v=1);null==r&&(r=0);null==p&&(p=0);null==q&&(q=0);null==n&&(n=0);null==m&&(m=1);null==k&&(k=0);null==g&&(g=0);null==l&&(l=0);null==h&&(h=0);null==f&&(f=1);null==d&&(d=0);null==c&&(c=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=c;this.e10=d;this.e11=f;this.e12=h;this.e13=l;this.e20=g;this.e21=k;this.e22=m;this.e23=n;this.e30=q;this.e31=p;this.e32=r;this.e33=v;O.numCreations++}function E(a,b,e,c,d,f,h,l,g){null==g&&(g=1);null==l&&(l=0);null==h&&(h=0);null==f&&(f=0);null==d&&(d=1);null==c&&(c=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=c;this.e11=d;this.e12=f;this.e20=h;this.e21=l;this.e22=g;E.numCreations++}function de(){}function Gc(){}function ec(){this.Na=Array(4);this.jb=Array(4);this.qb=Array(4);this.uj=Array(3);this.uj[0]=new t(1,0,0);this.uj[1]=new t(0,1,0);this.uj[2]=new t(0,0,1);this.bo=new t;this.co=new t;this.Vn=new t;this.Un=new t;this.ao=new Ja;for(var a=0;4>a;){var b=a++;this.Na[b]=new t;this.jb[b]=new t;this.qb[b]=new t}this.dir=new t;this.closest=new t;this.closestPoint1=new t;this.closestPoint2=new t;this.Og=new il}function G(){}function Ja(){this.B=this.A=this.v=0;this.o=1;this.i=this.h=this.f=0;this.m=1;this.g=this.l=this.j=0;this.s=1}function t(a,b,e){null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;t.numCreations++}function jl(){this.Il=new t}function ke(){this.xd=new t;this.jb=new t;this.qb=new t}function Ie(){this.id=++Ie.Mb;this.ia=this.M=null;this.dk=new t;this.bl=this.Wj=0;this.rj=!1;this.zb=Array(3);this.Ge=Array(3);this.We=Array(3);this.fi=new t;this.Ai=Array(3);this.Ai[0]=1;this.Ai[1]=2;this.Ai[2]=0}function il(){this.zb=Array(G.maxEPAVertices);this.mi=new t;this.Ne=0;this.Rc=this.jd=null;this.lh=0;this.bf=this.De=null}function Fk(){this.Sg=!1}function Sf(a){this.Sg=a}function Sg(a){this.Sg=a}function gj(){this.Sg=!1}function hj(){this.Sg=!1}function Bl(){}function Cl(){this.hc=this.Tc=this.Dj=this.w=0;this.Bc=Array(8);this.ic=Array(8);for(var a=0;8>a;){var b=a++;this.Bc[b]=new kl;this.ic[b]=new kl}}function kl(){this.Qa=this.Pa=this.Oa=this.y=this.x=0}function ij(){this.Sg=!1;this.Dg=new Cl}function Tc(a){this.Sg=a}function ll(){this.position1=new t;this.position2=new t;this.id=this.depth=0}function ce(){this.numPoints=0;this.normal=new t;this.points=Array(G.maxManifoldPoints);this.incremental=!1;for(var a=0,b=G.maxManifoldPoints;aa;){var b=a++;this.Jb[b]=Array(8)}a=new gj;this.Jb[0][0]=new Fk;this.Jb[0][1]=new Sg(!1);this.Jb[0][2]=a;this.Jb[0][3]=a;this.Jb[0][4]=new Sf(!1);this.Jb[0][5]=a;this.Jb[1][0]=new Sg(!0);this.Jb[1][1]=new ij;this.Jb[1][2]=a;this.Jb[1][3]=a;this.Jb[1][4]=a;this.Jb[1][5]=a;this.Jb[2][0]=a;this.Jb[2][1]=a;this.Jb[2][2]=a;this.Jb[2][3]=a;this.Jb[2][4]=a;this.Jb[2][5]=a;this.Jb[3][0]=a;this.Jb[3][1]=a;this.Jb[3][2]=a;this.Jb[3][3]=a;this.Jb[3][4]=a;this.Jb[3][5]=a;this.Jb[4][0]=new Sf(!0);this.Jb[4][1]=a;this.Jb[4][2]=a;this.Jb[4][3]=a;this.Jb[4][4]=new hj;this.Jb[4][5]=a;this.Jb[5][0]=a;this.Jb[5][1]=a;this.Jb[5][2]=a;this.Jb[5][3]=a;this.Jb[5][4]=a;this.Jb[5][5]=a}function Td(a){tb.call(this,0);this.Rb=this.ab=a;this.Oe()}function fj(){this.position=new t;this.normal=new t;this.fraction=0}function Uc(){}function Ud(a,b){tb.call(this,2);this.ab=a;this.Ib=b;this.Oe()}function le(a){tb.call(this,5);this.Ne=a.length;this.zb=Array(this.Ne);this.Bg=Array(this.Ne);for(var b=0,e=this.Ne;b.2*a&&(this.Rb=.2*a)}function Xa(){this.la=this.ka=this.ja=this.oa=this.na=this.ma=0}function ml(){this.Qb=null;this.fk=0;this.Gi=new Ql;this.gf=this.cg=this.Xc=null;this.fi=Array(1024)}function Ql(){this.Vl=0;this.Rj=!1}function Xj(a,b){ad.call(this,a,b);this.Qh=null;this.jh=!1}function jj(){this.Uf=this.Vf=this.M=null;this.F=Array(2);this.La=0;this.Ea=null;this.O=0;this.tb=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function hc(){wb.call(this,2);this.Yj=!0;this.ge=new ml;this.hf=Array(1024);this.Gf=0}function oc(){wb.call(this,1);this.Yj=!1}function Be(){this.nh=this.mh=null}function ad(a,b){this.userData=a;this.Cc=b;this.M=this.ia=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function wh(){}function Mc(){}function nl(){tb.call(this,-1);this.min=new t;this.max=new t}function ol(){tb.call(this,-1)}function tb(a){fd.call(this,a);this.Rb=G.defaultGJKMargin;this.$l=!1}function fd(a){this.Lb=a;this.yf=0}function wb(a){this.Lb=a;this.Ci=0;this.ce=this.$e=this.Be=null;this.Yj=!1;this.oj=0;this.oh=null;this.Ul=0;this.Vj=new ol;this.u=new nl;this.Wf=new Ja;this.Z=new t;this.Mi=new fj}function cb(a,b){function e(){}e.prototype=a;a=new e;for(var c in b)a[c]=b[c];b.toString!==Object.prototype.toString&&(a.toString=b.toString);return a}wb.prototype={Vh:function(){return null},Wh:function(){},wd:function(){},Mb:function(a,b){return a.Jb.J&&a.Kb.K&&a.Lb.L:!1},Ii:function(){},ua:function(){return this.ce},Hb:function(){return this.Yj},cb:function(){return this.oj},Vd:function(){},Bf:function(){},qh:function(){}};fd.prototype={Oe:function(){},Nb:function(){},Di:function(){return!1},cb:function(){return this.Lb},ua:function(){return this.yf},Vd:function(a,b,e,c){var d,f,h,l;d=a.x;f=a.y;a=a.z;h=b.x;l=b.y;b=b.z;d-=e.v;f-=e.A;a-=e.B;h-=e.v;l-=e.A;b-=e.B;if(this.Di(e.o*d+e.i*f+e.l*a,e.f*d+e.m*f+e.g*a,e.h*d+e.j*f+e.s*a,e.o*h+e.i*l+e.l*b,e.f*h+e.m*l+e.g*b,e.h*h+e.j*l+e.s*b,c)){var g,k;b=c.position;d=b.x;f=b.y;h=b.z;b=c.normal;l=b.x;g=b.y;k=b.z;var m,n;m=e.o*d+e.f*f+e.h*h;n=e.i*d+e.m*f+e.j*h;h=e.l*d+e.g*f+e.s*h;b=e.o*l+e.f*g+e.h*k;a=e.i*l+e.m*g+e.j*k;l=e.l*l+e.g*g+e.s*k;d=m+e.v;f=n+e.A;h+=e.B;e=c.position;e.x=d;e.y=f;e.z=h;c=c.normal;c.x=b;c.y=a;c.z=l;return!0}return!1}};tb.ua=fd;tb.prototype=cb(fd.prototype,{un:function(){return this.Rb},Zn:function(a){0>a&&(a=0);this.Rb=a},Pd:function(){},Vd:function(a,b,e,c){return this.$l?ec.cb.Vd(this,e,a,b,c):fd.prototype.Vd.call(this,a,b,e,c)}});ol.ua=tb;ol.prototype=cb(tb.prototype,{za:function(a,b,e){this.ln=a;var c,d,f;c=e.x;d=e.y;f=e.z;var h;e=b.o*c+b.i*d+b.l*f;h=b.f*c+b.m*d+b.g*f;b=b.h*c+b.j*d+b.s*f;c=this.Fl=new t;c.x=e;c.y=h;c.z=b;this.Rb=a.Rb},Pd:function(a,b){this.ln.Pd(a,b);var e=this.Fl;if(0e.J&&a.Ke.K&&a.Le.L){var d=this.oh;null!=d?(this.oh=d.M,d.M=null):d=new Be;null!=this.ce&&(d.M=this.ce);this.ce=d;d.mh=a;d.nh=e}e=c}a=b}},Vd:function(a,b,e){var c,d,f,h;c=a.x;d=a.y;a=a.z;f=b.x;h=b.y;b=b.z;for(var l=this.Be;null!=l;){var g=l.M,k=c,m=d,n=a,q=f,p=h,r=b,v=kp?m:p,w=n>r?n:r,D=l.J,Sa=l.K,B=l.L,C=l.G,A=l.H,t=l.I;if(D>(k>q?k:q)||CL||Aw||tq?-q:q,v=0>p?-p:p,L=0>I?-I:I,R=.5*(C-D),y=.5*(A-Sa),w=.5*(t-B),k=k-.5*(C+D),m=m-.5*(A+Sa),n=n-.5*(t+B),B=m*I-n*p;0<(0>B?-B:B)-(y*L+w*v)?n=!0:(n=n*q-k*I,n=0<(0>n?-n:n)-(w*r+R*L));n?n=!0:(n=k*p-m*q,n=0<(0>n?-n:n)-(R*v+y*r));n=n?!1:!0}n&&e.process(l);l=g}},Bf:function(a,b,e,c){for(var d=this.Be;null!=d;){var f=d.M,h=this.u.min;h.x=d.J;h.y=d.K;h.z=d.L;h=this.u.max;h.x=d.G;h.y=d.H;h.z=d.I;this.Vj.za(a,b,e);h=ec.cb;0==h.zj(this.Vj,this.u,b,this.Wf,null,!1)&&0>=h.distance&&c.process(d);d=f}},qh:function(a,b){for(var e=this.Be;null!=e;){var c=e.M;a.mae.J&&a.nae.K&&a.oae.L&&b.process(e);e=c}}});hc.ua=wb;hc.prototype=cb(wb.prototype,{sh:function(a,b){this.oj++;var e=0==a.O,c=0==b.O;a==b?e||(this.sh(a.F[0],b),this.sh(a.F[1],b)):a.Jb.J&&a.Kb.K&&a.Lb.L&&(e&&c?(a=a.tb,b=b.tb,e=this.oh,null!=e?(this.oh=e.M,e.M=null):e=new Be,null!=this.ce&&(e.M=this.ce),this.ce=e,e.mh=a,e.nh=b):c||a.O>b.O?(this.sh(a.F[0],b),this.sh(a.F[1],b)):(this.sh(b.F[0],a),this.sh(b.F[1],a)))},Jl:function(a,b,e,c,d,f,h,l){var g=a.J,k=a.K,m=a.L,n=a.G,q=a.H,p=a.I,r;if(g>(b>d?b:d)||n<(b(e>f?e:f)||q<(e(c>h?c:h)||p<(cv?-v:v;var L=0>R?-R:R,w=0>y?-y:y,D=.5*(n-g),Sa=.5*(q-k),B=.5*(p-m),g=b-.5*(n+g),k=e-.5*(q+k),m=c-.5*(p+m),p=k*y-m*R;0<(0>p?-p:p)-(Sa*w+B*L)?w=!0:(y=m*v-g*y,w=0<(0>y?-y:y)-(B*r+D*w));w?r=!0:(v=g*R-k*v,r=0<(0>v?-v:v)-(D*L+Sa*r));r=r?!1:!0}r&&(0==a.O?l.process(a.tb):(this.Jl(a.F[0],b,e,c,d,f,h,l),this.Jl(a.F[1],b,e,c,d,f,h,l)))},ml:function(a,b,e,c,d){var f=this.u.min;f.x=a.J;f.y=a.K;f.z=a.L;f=this.u.max;f.x=a.G;f.y=a.H;f.z=a.I;this.Vj.za(b,e,c);f=ec.cb;0==f.zj(this.Vj,this.u,e,this.Wf,null,!1)&&0>=f.distance&&(0==a.O?d.process(a.tb):(this.ml(a.F[0],b,e,c,d),this.ml(a.F[1],b,e,c,d)))},hl:function(a,b,e){a.Jb.ma&&a.Kb.na&&a.Lb.oa&&(0==a.O?e.process(a.tb):(this.hl(a.F[0],b,e),this.hl(a.F[1],b,e)))},Vh:function(a,b){a=new Xj(a,this.Ul++);this.Ci++;null==this.Be?this.Be=a:(this.$e.M=a,a.ia=this.$e);this.$e=a;a.J=b.ma;a.K=b.na;a.L=b.oa;a.G=b.ja;a.H=b.ka;a.I=b.la;b=G.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;b=this.ge;var e=b.Xc;null!=e?(b.Xc=e.M,e.M=null):e=new jj;var c=e;c.tb=a;a.Qh=c;c.J=a.J;c.K=a.K;c.L=a.L;c.G=a.G;c.H=a.H;c.I=a.I;b.fk++;null==b.cg?b.cg=c:(b.gf.Uf=c,c.Vf=b.gf);b.gf=c;if(null==b.Qb)b.Qb=c;else{for(var d=b.Qb;0e.O)){var c=e.Ea,f=e.F[0],h=e.F[1],l=f.O-h.O,d=e.La;1l.O?(f.F[1]=e,e.Ea=f,e.La=1,e.F[0]=l,l.Ea=e,l.La=0):(f.F[0]=e,e.Ea=f,e.La=0,e.F[0]=h,h.Ea=e,h.La=0),h=f.F[0],l=f.F[1],f.J=h.Jl.G?h.G:l.G,f.H=h.H>l.H?h.H:l.H,f.I=h.I>l.I?h.I:l.I,h=f.F[0].O,l=f.F[1].O,f.O=(h>l?h:l)+1,h=e.F[0],l=e.F[1],e.J=h.Jl.G?h.G:l.G,e.H=h.H>l.H?h.H:l.H,e.I=h.I>l.I?h.I:l.I,h=e.F[0].O,l=e.F[1].O,e.O=(h>l?h:l)+1,null!=c?(c.F[d]=f,f.Ea=c,f.La=d):(b.Qb=f,f.Ea=null),e=f):-1>l&&(f=h.F[0],l=h.F[1],f.O>l.O?(h.F[1]=e,e.Ea=h,e.La=1,e.F[1]=l,l.Ea=e,l.La=1):(h.F[0]=e,e.Ea=h,e.La=0,e.F[1]=f,f.Ea=e,f.La=1),f=h.F[0],l=h.F[1],h.J=f.Jl.G?f.G:l.G,h.H=f.H>l.H?f.H:l.H,h.I=f.I>l.I?f.I:l.I,f=h.F[0].O,l=h.F[1].O,h.O=(f>l?f:l)+1,f=e.F[0],l=e.F[1],e.J=f.Jl.G?f.G:l.G,e.H=f.H>l.H?f.H:l.H,e.I=f.I>l.I?f.I:l.I,f=e.F[0].O,l=e.F[1].O,e.O=(f>l?f:l)+1,null!=c?(c.F[d]=h,h.Ea=c,h.La=d):(b.Qb=h,h.Ea=null),e=h)}c=e.F[0].O;d=e.F[1].O;e.O=(c>d?c:d)+1;c=e.F[0];d=e.F[1];e.J=c.Jd.G?c.G:d.G;e.H=c.H>d.H?c.H:d.H;e.I=c.I>d.I?c.I:d.I;e=e.Ea}}if(!a.jh){a.jh=!0;if(this.hf.length==this.Gf){b=Array(this.Gf<<1);e=0;for(c=this.Gf;ec.O)){var d=c.Ea,h=c.F[0],l=c.F[1],g=h.O-l.O,f=c.La;1g.O?(h.F[1]=c,c.Ea=h,c.La=1,c.F[0]=g,g.Ea=c,g.La=0):(h.F[0]=c,c.Ea=h,c.La=0,c.F[0]=l,l.Ea=c,l.La=0),l=h.F[0],g=h.F[1],h.J=l.Jg.G?l.G:g.G,h.H=l.H>g.H?l.H:g.H,h.I=l.I>g.I?l.I:g.I,l=h.F[0].O,g=h.F[1].O,h.O=(l>g?l:g)+1,l=c.F[0],g=c.F[1],c.J=l.Jg.G?l.G:g.G,c.H=l.H>g.H?l.H:g.H,c.I=l.I>g.I?l.I:g.I,l=c.F[0].O,g=c.F[1].O,c.O=(l>g?l:g)+1,null!=d?(d.F[f]=h,h.Ea=d,h.La=f):(b.Qb=h,h.Ea=null),c=h):-1>g&&(h=l.F[0],g=l.F[1],h.O>g.O?(l.F[1]=c,c.Ea=l,c.La=1,c.F[1]=g,g.Ea=c,g.La=1):(l.F[0]=c,c.Ea=l,c.La=0,c.F[1]=h,h.Ea=c,h.La=1),h=l.F[0],g=l.F[1],l.J=h.Jg.G?h.G:g.G,l.H=h.H>g.H?h.H:g.H,l.I=h.I>g.I?h.I:g.I,h=l.F[0].O,g=l.F[1].O,l.O=(h>g?h:g)+1,h=c.F[0],g=c.F[1],c.J=h.Jg.G?h.G:g.G,c.H=h.H>g.H?h.H:g.H,c.I=h.I>g.I?h.I:g.I,h=c.F[0].O,g=c.F[1].O,c.O=(h>g?h:g)+1,null!=d?(d.F[f]=l,l.Ea=d,l.La=f):(b.Qb=l,l.Ea=null),c=l)}d=c.F[0].O;f=c.F[1].O;c.O=(d>f?d:f)+1;d=c.F[0];f=c.F[1];c.J=d.Jf.G?d.G:f.G;c.H=d.H>f.H?d.H:f.H;c.I=d.I>f.I?d.I:f.I;c=c.Ea}}}a.Qh=null;e.F[0]=null;e.F[1]=null;e.La=0;e.Ea=null;e.O=0;e.tb=null;e.M=b.Xc;b.Xc=e;a.userData=null;a.M=null;a.ia=null;a.jh&&(a.jh=!1)},wd:function(a,b,e){if(!(a.J<=b.ma&&a.G>=b.ja&&a.K<=b.na&&a.H>=b.ka&&a.L<=b.oa&&a.I>=b.la)){a.J=b.ma;a.K=b.na;a.L=b.oa;a.G=b.ja;a.H=b.ka;a.I=b.la;b=G.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;if(null!=e){var c;b=e.x;c=e.y;e=e.z;a.J+=0b?0:b;a.H+=0>c?0:c;a.I+=0>e?0:e}if(!a.jh){a.jh=!0;if(this.hf.length==this.Gf){e=Array(this.Gf<<1);b=0;for(c=this.Gf;bthis.Ci)){for(var b=this.Gf/this.Cir.O)){var v=r.Ea,R=r.F[0],y=r.F[1],L=R.O-y.O,w=r.La;if(1Sa.O){R.F[1]=r;r.Ea=R;r.La=1;r.F[0]=Sa;Sa.Ea=r;Sa.La=0;var B=R.F[0],C=R.F[1];R.J=B.JC.G?B.G:C.G;R.H=B.H>C.H?B.H:C.H;R.I=B.I>C.I?B.I:C.I;var A=R.F[0].O,t=R.F[1].O;R.O=(A>t?A:t)+1;var I=r.F[0],J=r.F[1];r.J=I.JJ.G?I.G:J.G;r.H=I.H>J.H?I.H:J.H;r.I=I.I>J.I?I.I:J.I;var Gb=r.F[0].O,Ce=r.F[1].O;r.O=(Gb>Ce?Gb:Ce)+1}else{R.F[0]=r;r.Ea=R;r.La=0;r.F[0]=D;D.Ea=r;D.La=0;var u=R.F[0],da=R.F[1];R.J=u.Jda.G?u.G:da.G;R.H=u.H>da.H?u.H:da.H;R.I=u.I>da.I?u.I:da.I;var Rl=R.F[0].O,Bd=R.F[1].O;R.O=(Rl>Bd?Rl:Bd)+1;var Db=r.F[0],Ia=r.F[1];r.J=Db.JIa.G?Db.G:Ia.G;r.H=Db.H>Ia.H?Db.H:Ia.H;r.I=Db.I>Ia.I?Db.I:Ia.I;var Da=r.F[0].O,ma=r.F[1].O;r.O=(Da>ma?Da:ma)+1}null!=v?(v.F[w]=R,R.Ea=v,R.La=w):(h.Qb=R,R.Ea=null);r=R}else if(-1>L){var Q=y.F[0],E=y.F[1];if(Q.O>E.O){y.F[1]=r;r.Ea=y;r.La=1;r.F[1]=E;E.Ea=r;E.La=1;var Ga=y.F[0],Ea=y.F[1];y.J=Ga.JEa.G?Ga.G:Ea.G;y.H=Ga.H>Ea.H?Ga.H:Ea.H;y.I=Ga.I>Ea.I?Ga.I:Ea.I;var Ua=y.F[0].O,va=y.F[1].O;y.O=(Ua>va?Ua:va)+1;var oa=r.F[0],Ya=r.F[1];r.J=oa.JYa.G?oa.G:Ya.G;r.H=oa.H>Ya.H?oa.H:Ya.H;r.I=oa.I>Ya.I?oa.I:Ya.I;var F=r.F[0].O,Qa=r.F[1].O;r.O=(F>Qa?F:Qa)+1}else{y.F[0]=r;r.Ea=y;r.La=0;r.F[1]=Q;Q.Ea=r;Q.La=1;var X=y.F[0],M=y.F[1];y.J=X.JM.G?X.G:M.G;y.H=X.H>M.H?X.H:M.H;y.I=X.I>M.I?X.I:M.I;var N=y.F[0].O,ca=y.F[1].O;y.O=(N>ca?N:ca)+1;var Y=r.F[0],T=r.F[1];r.J=Y.JT.G?Y.G:T.G;r.H=Y.H>T.H?Y.H:T.H;r.I=Y.I>T.I?Y.I:T.I;var aa=r.F[0].O,z=r.F[1].O;r.O=(aa>z?aa:z)+1}null!=v?(v.F[w]=y,y.Ea=v,y.La=w):(h.Qb=y,y.Ea=null);r=y}}var fa=r.F[0].O,U=r.F[1].O;r.O=(fa>U?fa:U)+1;var pa=r.F[0],sa=r.F[1];r.J=pa.Jsa.G?pa.G:sa.G;r.H=pa.H>sa.H?pa.H:sa.H;r.I=pa.I>sa.I?pa.I:sa.I;r=r.Ea}}}f.Qh=null;l.M=null;l.La=0;l.F[0]=null;l.F[1]=null;l.La=0;l.Ea=null;l.O=0;l.tb=null;l.M=h.Xc;h.Xc=l;var wa=this.ge,ra=wa.Xc;null!=ra?(wa.Xc=ra.M,ra.M=null):ra=new jj;var ka=ra;ka.tb=f;f.Qh=ka;ka.J=f.J;ka.K=f.K;ka.L=f.L;ka.G=f.G;ka.H=f.H;ka.I=f.I;wa.fk++;null==wa.cg?wa.cg=ka:(wa.gf.Uf=ka,ka.Vf=wa.gf);wa.gf=ka;if(null==wa.Qb)wa.Qb=ka;else{for(var Z=wa.Qb;0K.O)){var Va=K.Ea,ga=K.F[0],P=K.F[1],za=ga.O-P.O,xb=K.La;if(1V.O){ga.F[1]=K;K.Ea=ga;K.La=1;K.F[0]=V;V.Ea=K;V.La=0;var O=ga.F[0],gb=ga.F[1];ga.J=O.Jgb.G?O.G:gb.G;ga.H=O.H>gb.H?O.H:gb.H;ga.I=O.I>gb.I?O.I:gb.I;var pb=ga.F[0].O,ua=ga.F[1].O;ga.O=(pb>ua?pb:ua)+1;var xa=K.F[0],Fa=K.F[1];K.J=xa.JFa.G?xa.G:Fa.G;K.H=xa.H>Fa.H?xa.H:Fa.H;K.I=xa.I>Fa.I?xa.I:Fa.I;var fb=K.F[0].O,Ha=K.F[1].O;K.O=(fb>Ha?fb:Ha)+1}else{ga.F[0]=K;K.Ea=ga;K.La=0;K.F[0]=ja;ja.Ea=K;ja.La=0;var qb=ga.F[0],Na=ga.F[1];ga.J=qb.JNa.G?qb.G:Na.G;ga.H=qb.H>Na.H?qb.H:Na.H;ga.I=qb.I>Na.I?qb.I:Na.I;var la=ga.F[0].O,Ca=ga.F[1].O;ga.O=(la>Ca?la:Ca)+1;var Za=K.F[0],Ra=K.F[1];K.J=Za.JRa.G?Za.G:Ra.G;K.H=Za.H>Ra.H?Za.H:Ra.H;K.I=Za.I>Ra.I?Za.I:Ra.I;var ib=K.F[0].O,Lb=K.F[1].O;K.O=(ib>Lb?ib:Lb)+1}null!=Va?(Va.F[xb]=ga,ga.Ea=Va,ga.La=xb):(wa.Qb=ga,ga.Ea=null);K=ga}else if(-1>za){var db=P.F[0],Ib=P.F[1];if(db.O>Ib.O){P.F[1]=K;K.Ea=P;K.La=1;K.F[1]=Ib;Ib.Ea=K;Ib.La=1;var kb=P.F[0],nb=P.F[1];P.J=kb.Jnb.G?kb.G:nb.G;P.H=kb.H>nb.H?kb.H:nb.H;P.I=kb.I>nb.I?kb.I:nb.I;var Yb=P.F[0].O,sc=P.F[1].O;P.O=(Yb>sc?Yb:sc)+1;var $a=K.F[0],Ka=K.F[1];K.J=$a.JKa.G?$a.G:Ka.G;K.H=$a.H>Ka.H?$a.H:Ka.H;K.I=$a.I>Ka.I?$a.I:Ka.I;var vb=K.F[0].O,H=K.F[1].O;K.O=(vb>H?vb:H)+1}else{P.F[0]=K;K.Ea=P;K.La=0;K.F[1]=db;db.Ea=K;db.La=1;var eb=P.F[0],lb=P.F[1];P.J=eb.Jlb.G?eb.G:lb.G;P.H=eb.H>lb.H?eb.H:lb.H;P.I=eb.I>lb.I?eb.I:lb.I;var yb=P.F[0].O,mb=P.F[1].O;P.O=(yb>mb?yb:mb)+1;var ub=K.F[0],x=K.F[1];K.J=ub.Jx.G?ub.G:x.G;K.H=ub.H>x.H?ub.H:x.H;K.I=ub.I>x.I?ub.I:x.I;var W=K.F[0].O,ea=K.F[1].O;K.O=(W>ea?W:ea)+1}null!=Va?(Va.F[xb]=P,P.Ea=Va,P.La=xb):(wa.Qb=P,P.Ea=null);K=P}}var S=K.F[0].O,xc=K.F[1].O;K.O=(S>xc?S:xc)+1;var Pa=K.F[0],rb=K.F[1];K.J=Pa.Jrb.G?Pa.G:rb.G;K.H=Pa.H>rb.H?Pa.H:rb.H;K.I=Pa.I>rb.I?Pa.I:rb.I;K=K.Ea}}b&&this.sh(this.ge.Qb,f.Qh);f.jh=!1}this.hf[d]=null}b||this.sh(this.ge.Qb,this.ge.Qb);this.Gf=0}},Vd:function(a,b,e){null!=this.ge.Qb&&this.Jl(this.ge.Qb,a.x,a.y,a.z,b.x,b.y,b.z,e)},Bf:function(a,b,e,c){null!=this.ge.Qb&&this.ml(this.ge.Qb,a,b,e,c)},qh:function(a,b){null!=this.ge.Qb&&this.hl(this.ge.Qb,a,b)},Jn:function(){return this.ge.cn()}});Xj.ua=ad;Xj.prototype=cb(ad.prototype,{});Ql.prototype={Sl:function(a,b){switch(this.Vl){case 0:var e,c,d;e=b.J+b.G;c=b.K+b.H;d=b.L+b.I;var f=a.F[0],h=a.F[1],l,g;b=f.J+f.G;a=f.K+f.H;f=f.L+f.I;l=h.J+h.G;g=h.K+h.H;h=h.L+h.I;b-=e;a-=c;f-=d;l-=e;g-=c;h-=d;return b*b+a*a+f*fb.G?a.G:b.G;m=a.H>b.H?a.H:b.H;g=a.I>b.I?a.I:b.I;a=m-k;l=g-l;c=2*((d-c)*(a+l)+a*l);a=2*c;var n=2*(c-h),h=n;c=f.Jb.G?f.G:b.G;m=f.H>b.H?f.H:b.H;g=f.I>b.I?f.I:b.I;0==f.O?(f=m-k,l=g-l,h+=2*((d-c)*(f+l)+f*l)):(k=m-k,l=g-l,g=f.H-f.K,m=f.I-f.L,h+=2*((d-c)*(k+l)+k*l)-2*((f.G-f.J)*(g+m)+g*m));f=n;c=e.Jb.G?e.G:b.G;m=e.H>b.H?e.H:b.H;g=e.I>b.I?e.I:b.I;0==e.O?(e=m-k,b=g-l,f+=2*((d-c)*(e+b)+e*b)):(b=m-k,l=g-l,g=e.H-e.K,n=e.I-e.L,f+=2*((d-c)*(b+l)+b*l)-2*((e.G-e.J)*(g+n)+g*n));return ab&&(b=-b);return b+this.pl(a.F[0])+this.pl(a.F[1])}};Xa.prototype={za:function(a,b){this.ma=a.x;this.na=a.y;this.oa=a.z;this.ja=b.x;this.ka=b.y;this.la=b.z;return this},Jc:function(){var a=new t;a.x=this.ma;a.y=this.na;a.z=this.oa;return a},Kc:function(a){a.x=this.ma;a.y=this.na;a.z=this.oa},Yd:function(a){this.ma=a.x;this.na=a.y;this.oa=a.z;return this},Ac:function(){var a=new t;a.x=this.ja;a.y=this.ka;a.z=this.la;return a},Ec:function(a){a.x=this.ja;a.y=this.ka;a.z=this.la},fd:function(a){this.ja=a.x;this.ka=a.y;this.la=a.z;return this},Hb:function(){var a=new t,b,e,c;b=this.ma+this.ja;e=this.na+this.ka;c=this.oa+this.la;a.x=.5*b;a.y=.5*e;a.z=.5*c;return a},Mb:function(a){var b,e,c;b=this.ma+this.ja;e=this.na+this.ka;c=this.oa+this.la;a.x=.5*b;a.y=.5*e;a.z=.5*c},pc:function(){var a=new t,b,e,c;b=this.ja-this.ma;e=this.ka-this.na;c=this.la-this.oa;a.x=.5*b;a.y=.5*e;a.z=.5*c;return a},qc:function(a){var b,e,c;b=this.ja-this.ma;e=this.ka-this.na;c=this.la-this.oa;a.x=.5*b;a.y=.5*e;a.z=.5*c},ua:function(a){this.ma=this.maa.ja?this.ja:a.ja;this.ka=this.ka>a.ka?this.ka:a.ka;this.la=this.la>a.la?this.la:a.la;return this},cb:function(a){var b=new Xa;b.ma=this.maa.ja?this.ja:a.ja;b.ka=this.ka>a.ka?this.ka:a.ka;b.la=this.la>a.la?this.la:a.la;return b},Lc:function(a){return this.maa.ma&&this.naa.na&&this.oaa.oa:!1},uc:function(a){var b=new Xa;b.ma=this.ma>a.ma?this.ma:a.ma;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.ja=this.jaa.ma?this.ma:a.ma;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.ja=this.jaf?-f:f)+(0>l?-l:l)+(0>k?-k:k);h=(0>h?-h:h)+(0>g?-g:g)+(0>m?-m:m);e=(0>e?-e:e)+(0>c?-c:c)+(0>d?-d:d);a.ma=b.v-f;a.na=b.A-h;a.oa=b.B-e;a.ja=b.v+f;a.ka=b.A+h;a.la=b.B+e},Pd:function(a,b){var e,c,d;d=c=e=this.Rb;e=ec){if(a<=-l||a>=l)return!1}else{var R=1/c,y=(-l-a)*R,l=(l-a)*R;y>l&&(R=y,y=l,l=R);0l&&(p=l)}if(-1E-6d){if(b<=-g||b>=g)return!1}else y=1/d,l=(-g-b)*y,g=(g-b)*y,l>g&&(y=l,l=g,g=y),0g&&(r=g);if(-1E-6f){if(e<=-k||e>=k)return!1}else l=1/f,g=(-k-e)*l,k=(k-e)*l,g>k&&(l=g,g=k,k=l),0k&&(v=k);if(1<=m||1<=n||1<=q||0>=p||0>=r||0>=v)return!1;k=m;m=0;n>k&&(k=n,m=1);q>k&&(k=q,m=2);rp||!k)return!1;switch(m){case 0:h.normal.za(0f?-f:f)*this.Ib;h=(0>h?-h:h)*this.Ib;l=(0>l?-l:l)*this.Ib;e+=f;c+=h;d+=l;a.ma=b.v-e;a.na=b.A-c;a.oa=b.B-d;a.ja=b.v+e;a.ka=b.A+c;a.la=b.B+d},Pd:function(a,b){0p)return!1;if(0=(-q+p)/n)return!1}else{if(0<=m)return!1;m=0}n=b+(d-b)*m;if(n>-l&&nn?-l:l,r;r=a-0;l=b-g;k=e-0;a=c-a;b=d-b;e=f-e;n=a*a+b*b+e*e;q=r*a+l*b+k*e;m=r*r+l*l+k*k-this.ab*this.ab;p=q*q-n*m;if(0>p)return!1;f=(-q-Math.sqrt(p))/n;if(0>f||1n?g:n;h=k>q?k:q;f=m>p?m:p;g=ge?l:e);a.ka=b.A+(h>c?h:c);a.la=b.B+(f>d?f:d)},Pd:function(a,b){var e=a.x,c=a.y,d=a.z;0this.uk*this.uk*(e*e+c*c+d*d)?(b.za(0,this.Ib-this.Rb/this.uk,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,c=e*e+a*a,d=2*this.Ib,d=(d-this.Rb)/d*this.ab-this.Rb/this.kk,0>d&&(d=0),c=0d&&(d=0),b.x=e*c,b.y=-d,b.z=a*c)},Di:function(a,b,e,c,d,f,h){var l=this.Ib;c-=a;d-=b;f-=e;var g=0,k=1;if(-1E-6d){if(b<=-l||b>=l)return!1}else{var m=1/d,n=(-l-b)*m,m=(l-b)*m;if(n>m)var q=n,n=m,m=q;0m&&(k=m)}if(1<=g||0>=k)return!1;b-=l;var q=this.kk*this.kk,m=q*(c*c+d*d+f*f)-d*d,n=q*(a*c+b*d+e*f)-b*d,q=q*(a*a+b*b+e*e)-b*b,p=n*n-m*q;if(m){if(0>p)return!1;p=Math.sqrt(p);if(0>m)if(0=n)return!1}else{if(q=(-n-p)/m,n=1,1<=q)return!1}else if(q=(-n-p)/m,n=(-n+p)/m,1<=q||0>=n)return!1}else if(m=-q/(2*n),0=m)return!1}else if(q=m,n=1,1<=m)return!1;b+=l;if(n<=g||k<=q)return!1;if(qc&&(c=k);md&&(d=m);gf&&(f=g)}h=c-a;l=d-b;k=f-e;this.yf=h*l*k;a=.25*((a+c)*(a+c)+(b+d)*(b+d)+(e+f)*(e+f));h=h*h*.25;l=l*l*.25;k=k*k*.25;this.mg=.3333333333333333*(l+k)+a;this.pg=this.og=this.ng=0;this.qg=.3333333333333333*(k+h)+a;this.tg=this.sg=this.rg=0;this.ug=.3333333333333333*(h+l)+a},Nb:function(a,b){var e,c,d,f,h,l,g,k,m;m=k=g=this.Rb;var n,q,p;e=this.zb[0];n=e.x;q=e.y;p=e.z;c=b.o*n+b.f*q+b.h*p;e=b.i*n+b.m*q+b.j*p;d=b.l*n+b.g*q+b.s*p;n=c+b.v;q=e+b.A;p=d+b.B;e=n;c=q;d=p;f=n;h=q;l=p;for(var r=1,v=this.Ne;rn?f:n;h=h>q?h:q;l=l>p?l:p}a.ma=e-g;a.na=c-k;a.oa=d-m;a.ja=f+g;a.ka=h+k;a.la=l+m},Pd:function(a,b){for(var e=this.zb[0],e=e.x*a.x+e.y*a.y+e.z*a.z,c=0,d=1,f=this.Ne;de&&(e=l,c=h)}a=this.zb[c];b.x=a.x;b.y=a.y;b.z=a.z}});Ud.ua=tb;Ud.prototype=cb(tb.prototype,{Xh:function(){return this.ab},Bj:function(){return this.Ib},Oe:function(){var a=this.ab*this.ab,b=this.Ib*this.Ib*4;this.yf=3.14159265358979*a*this.Ib*2;this.mg=.08333333333333333*(3*a+b);this.pg=this.og=this.ng=0;this.qg=.5*a;this.tg=this.sg=this.rg=0;this.ug=.08333333333333333*(3*a+b)},Nb:function(a,b){var e,c,d,f,h,l;e=b.f;c=b.m;d=b.g;e=0>e?-e:e;c=0>c?-c:c;d=0>d?-d:d;f=Math.sqrt(1-e*e);h=Math.sqrt(1-c*c);l=Math.sqrt(1-d*d);f*=this.ab;h*=this.ab;l*=this.ab;e*=this.Ib;c*=this.Ib;d*=this.Ib;f+=e;h+=c;l+=d;a.ma=b.v-f;a.na=b.A-h;a.oa=b.B-l;a.ja=b.v+f;a.ka=b.A+h;a.la=b.B+l},Pd:function(a,b){var e=a.x,c=a.z,d=e*e+c*c,f=this.ab-this.Rb;0>f&&(f=0);d=0f&&(f=0);b.x=e*d;b.y=0d){if(b<=-l||b>=l)return!1}else{var m=1/d,n=(-l-b)*m,l=(l-b)*m;n>l&&(m=n,n=l,l=m);0l&&(k=l)}if(1<=g||0>=k)return!1;var l=c*c+f*f,n=a*c+e*f,m=a*a+e*e-this.ab*this.ab,q=n*n-l*m;if(0>q)return!1;if(0=l)return!1}else{if(0<=m)return!1;m=0;l=1}if(l<=g||k<=m)return!1;if(mk)return!1;f=(-g-Math.sqrt(k))/f;if(0>f||1a&&(a=this.points[c].depth)}return a},clear:function(){for(var a=this.numPoints=0,b=this.points;aAa&&(Aa=-Aa);0>ya&&(ya=-ya);0>K&&(K=-K);var Ba=Aa+ya+K,ha=R*p+y*r+L*v,ba=na+Ba,Va=0>ha,ga=Va?-ha:ha;if(gaza&&(za=-za);0>xb&&(xb=-xb);0>ja&&(ja=-ja);var Ba=za+xb+ja,ha=w*p+D*r+Sa*v,V=na+Ba,S=0>ha,gb=S?-ha:ha;if(gbua&&(ua=-ua);0>xa&&(xa=-xa);0>Fa&&(Fa=-Fa);var Ba=ua+xa+Fa,ha=B*p+C*r+A*v,fb=na+Ba,Ha=0>ha,qb=Ha?-ha:ha;if(qbG.linearSlop?pa-G.linearSlop:0,la=t*Ga+I*Ea+J*Ua,Ca=t*va+I*oa+J*Ya,Za=t*F+I*Qa+J*X;0>la&&(la=-la);0>Ca&&(Ca=-Ca);0>Za&&(Za=-Za);var na=la+Ca+Za,Ba=ma,ha=t*p+I*r+J*v,Ra=na+Ba,ib=0>ha,Lb=ib?-ha:ha;if(LbIb&&(Ib=-Ib);0>kb&&(kb=-kb);0>nb&&(nb=-nb);var na=Ib+kb+nb,Ba=Q,ha=Gb*p+Ce*r+u*v,Yb=na+Ba,sc=0>ha,$a=sc?-ha:ha;if($avb&&(vb=-vb);0>H&&(H=-H);0>eb&&(eb=-eb);var na=vb+H+eb,Ba=O,ha=da*p+E*r+Bd*v,lb=na+Ba,yb=0>ha,mb=yb?-ha:ha;if(mbG.linearSlop?pa-G.linearSlop:0,x,W,ea;x=y*J-L*I;W=L*t-R*J;ea=R*I-y*t;if(x||W||ea){var Nc=x*x+W*W+ea*ea;0xc&&(xc=-xc);0>Pa&&(Pa=-Pa);var na=xc+Pa,rb=x*Y+W*T+ea*aa,ob=x*z+W*fa+ea*U;0>rb&&(rb=-rb);0>ob&&(ob=-ob);var Ba=rb+ob,ha=x*p+W*r+ea*v,zb=na+Ba,Ab=0>ha,ia=Ab?-ha:ha;if(iajb&&(jb=-jb);0>Bb&&(Bb=-Bb);var na=jb+Bb,La=x*M+W*N+ea*ca,Eb=x*z+W*fa+ea*U;0>La&&(La=-La);0>Eb&&(Eb=-Eb);var Ba=La+Eb,ha=x*p+W*r+ea*v,Cd=na+Ba,qa=0>ha,Bc=qa?-ha:ha;if(Bcsf&&(sf=-sf);0>Je&&(Je=-Je);var na=sf+Je,Yj=x*M+W*N+ea*ca,Zb=x*Y+W*T+ea*aa;0>Yj&&(Yj=-Yj);0>Zb&&(Zb=-Zb);var Ba=Yj+Zb,ha=x*p+W*r+ea*v,Sl=na+Ba,xh=0>ha,Tl=xh?-ha:ha;if(Tlgc&&(gc=-gc);0>fc&&(fc=-fc);var na=gc+fc,Pb=x*Y+W*T+ea*aa,cc=x*z+W*fa+ea*U;0>Pb&&(Pb=-Pb);0>cc&&(cc=-cc);var Ba=Pb+cc,ha=x*p+W*r+ea*v,Fb=na+Ba,lc=0>ha,bc=lc?-ha:ha;if(bcVb&&(Vb=-Vb);0>Nb&&(Nb=-Nb);var na=Vb+Nb,Tb=x*M+W*N+ea*ca,sb=x*z+W*fa+ea*U;0>Tb&&(Tb=-Tb);0>sb&&(sb=-sb);var Ba=Tb+sb,ha=x*p+W*r+ea*v,Oa=na+Ba,qc=0>ha,Ma=qc?-ha:ha;if(MaHc&&(Hc=-Hc);0>pc&&(pc=-pc);var na=Hc+pc,Wa=x*M+W*N+ea*ca,$c=x*Y+W*T+ea*aa;0>Wa&&(Wa=-Wa);0>$c&&($c=-$c);var Ba=Wa+$c,ha=x*p+W*r+ea*v,tc=na+Ba,Ja=0>ha,Yc=Ja?-ha:ha;if(YcCc&&(Cc=-Cc);0>Dl&&(Dl=-Dl);var na=Cc+Dl,wc=x*Y+W*T+ea*aa,cb=x*z+W*fa+ea*U;0>wc&&(wc=-wc);0>cb&&(cb=-cb);var Ba=wc+cb,ha=x*p+W*r+ea*v,tb=na+Ba,Ff=0>ha,jf=Ff?-ha:ha;if(jfOc&&(Oc=-Oc);0>Zj&&(Zj=-Zj);var na=Oc+Zj,hb=x*M+W*N+ea*ca,Ec=x*z+W*fa+ea*U;0>hb&&(hb=-hb);0>Ec&&(Ec=-Ec);var Ba=hb+Ec,ha=x*p+W*r+ea*v,Cb=na+Ba,yh=0>ha,wb=yh?-ha:ha;if(wbHb&&(Hb=-Hb);0>Jb&&(Jb=-Jb);var na=Hb+Jb,Wd=x*M+W*N+ea*ca,Kb=x*Y+W*T+ea*aa;0>Wd&&(Wd=-Wd);0>Kb&&(Kb=-Kb);var Ba=Wd+Kb,ha=x*p+W*r+ea*v,Xb=na+Ba,$b=0>ha,ec=$b?-ha:ha;if(ecwa){Id=-Id;Jd=-Jd;te=-te;ud=-ud;vd=-vd;wd=-wd;Fc=Kd;Ac=ue;zc=fe;Kd=Ld;ue=Zd;fe=Fd;Ld=Fc;Zd=Ac;Fd=zc;var oc=ve;ve=Ke;Ke=oc}Id+=l;Jd+=g;te+=k;var we=1,Le=0,Md=ud*t+vd*I+wd*J;Md-G.contactPersistenceThreshold&&(Yd?this.Cg(a,Pe,Qe,ge,Re,yf,Xe,he,wf):this.Cg(a,Re,yf,Xe,Pe,Qe,ge,he,wf))}}}}}}}}}});Cl.prototype={clip:function(){for(var a=0,b=this.Tc;a=f){var h=this.ic[this.hc++];h.x=c.x;h.y=c.y;h.Oa=c.Oa;h.Pa=c.Pa;h.Qa=c.Qa;d/=d-f;f=this.ic[this.hc++];f.x=c.x+(e.x-c.x)*d;f.y=c.y+(e.y-c.y)*d;f.Oa=c.Oa+(e.Oa-c.Oa)*d;f.Pa=c.Pa+(e.Pa-c.Pa)*d;f.Qa=c.Qa+(e.Qa-c.Qa)*d}else 0>=d&&0=f?(h=this.ic[this.hc++],h.x=c.x,h.y=c.y,h.Oa=c.Oa,h.Pa=c.Pa,h.Qa=c.Qa,d/=d-f,f=this.ic[this.hc++],f.x=c.x+(e.x-c.x)*d,f.y=c.y+(e.y-c.y)*d,f.Oa=c.Oa+(e.Oa-c.Oa)*d,f.Pa=c.Pa+(e.Pa-c.Pa)*d,f.Qa=c.Qa+(e.Qa-c.Qa)*d):0>=d&&0=f?(h=this.ic[this.hc++],h.x=c.x,h.y=c.y,h.Oa=c.Oa,h.Pa=c.Pa,h.Qa=c.Qa,d/=d-f,f=this.ic[this.hc++],f.x=c.x+(e.x-c.x)*d,f.y=c.y+(e.y-c.y)*d,f.Oa=c.Oa+(e.Oa-c.Oa)*d,f.Pa=c.Pa+(e.Pa-c.Pa)*d,f.Qa=c.Qa+(e.Qa-c.Qa)*d):0>=d&&0=f?(h=this.ic[this.hc++],h.x=c.x,h.y=c.y,h.Oa=c.Oa,h.Pa=c.Pa,h.Qa=c.Qa,d/=d-f,f=this.ic[this.hc++],f.x=c.x+(e.x-c.x)*d,f.y=c.y+(e.y-c.y)*d,f.Oa=c.Oa+(e.Oa-c.Oa)*d,f.Pa=c.Pa+(e.Pa-c.Pa)*d,f.Qa=c.Qa+(e.Qa-c.Qa)*d):0>=d&&0this.Tc)){for(var a=-1/0,b=1/0,e=-1/0,c=1/0,d=null,f=null,h=null,l=null,g=0,k=this.Tc;ga&&(a=n,d=m);ne&&(e=q,h=m);qn?0:n>q?1:n/q):n=0,q=n*t+w,0>q?(q=0,n=k,n=0>n?0:n>D?1:n/D):q>L?(q=1,n=t+k,n=0>n?0:n>D?1:n/D):q/=L):(q=0,n=k,n=0>n?0:n>D?1:n/D):(n=0,q=w,q=0>q?0:q>L?1:q/L):q=n=0;p+=f*n;r+=R*n;v+=d*n;h+=m*q;l+=y*q;c+=g*q;R=p-h;f=r-l;q=v-c;n=R*R+f*f+q*q;n>=(b+e)*(b+e)||(n=Math.sqrt(n),0e?b>c?(f=Math.sqrt(b-e-c+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,c=(this.h+this.l)*f,d=(this.g-this.j)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,d=(this.i-this.f)*f):e>c?(f=Math.sqrt(e-c-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,c=(this.j+this.g)*f,d=(this.h-this.l)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,d=(this.i-this.f)*f);a.x=b;a.y=e;a.z=c;a.w=d;return a},cb:function(a){var b,e,c,d;b=this.o;e=this.m;c=this.s;d=b+e+c;var f;0e?b>c?(f=Math.sqrt(b-e-c+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,c=(this.h+this.l)*f,d=(this.g-this.j)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,d=(this.i-this.f)*f):e>c?(f=Math.sqrt(e-c-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,c=(this.j+this.g)*f,d=(this.h-this.l)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,d=(this.i-this.f)*f);a.x=b;a.y=e;a.z=c;a.w=d},Ac:function(a){var b,e,c;b=a.x;e=a.y;c=a.z;var d=a.w,f=2*b,h=2*e,l=2*c;a=b*f;var g=e*h;c*=l;var k=b*h;e*=l;b*=l;f*=d;h*=d;d*=l;this.o=1-g-c;this.f=k-d;this.h=b+h;this.i=k+d;this.m=1-a-c;this.j=e-f;this.l=b-h;this.g=e+f;this.s=1-a-g;return this},clone:function(){var a=new Ja;a.v=this.v;a.A=this.A;a.B=this.B;a.o=this.o;a.f=this.f;a.h=this.h;a.i=this.i;a.m=this.m;a.j=this.j;a.l=this.l;a.g=this.g;a.s=this.s;return a},de:function(a){this.v=a.v;this.A=a.A;this.B=a.B;this.o=a.o;this.f=a.f;this.h=a.h;this.i=a.i;this.m=a.m;this.j=a.j;this.l=a.l;this.g=a.g;this.s=a.s;return this}};ec.pc=function(){return ec.cb};ec.prototype={zj:function(a,b,e,c,d,f){this.wj=a;this.jl=b;this.tc=e;this.Ic=c;var h=this.Na,l=this.jb,g=this.qb,k=this.closest,m=this.dir;null!=d?(null==d.oi&&(d.oi=new jl),this.Pn(d.oi)):m.Z();if(!(m.x*m.x+m.y*m.y+m.z*m.z)){var n,q,p;n=c.v-e.v;q=c.A-e.A;p=c.B-e.B;m.x=n;m.y=q;m.z=p;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.za(1,0,0)}this.ya=0;this.zf(!1);this.Af(!1);var r=this.Na[this.ya],v=this.jb[this.ya];r.x=v.x;r.y=v.y;r.z=v.z;var R=this.qb[this.ya],y=r.y-R.y,L=r.z-R.z;r.x=r.x-R.x;r.y=y;r.z=L;this.ya=1;for(var w=0;40>w;){var D=0;switch(this.ya){case 1:var t=h[0];k.x=t.x;k.y=t.y;k.z=t.z;D=1;break;case 2:var B,C,A,Vc,I,J,Gb=h[0];B=Gb.x;C=Gb.y;A=Gb.z;var u=h[1];Vc=u.x;I=u.y;J=u.z;var G,da,E;G=Vc-B;da=I-C;E=J-A;var O=G*B+da*C+E*A,O=-O/(G*G+da*da+E*E);if(0>O){var Db=k;Db.x=B;Db.y=C;Db.z=A;D=1}else if(1K){var xb,ja,S,bd,gb,pb,ua=Ga;xb=ua.x;ja=ua.y;S=ua.z;var xa=Ea;bd=xa.x;gb=xa.y;pb=xa.z;var Fa,fb,Ha;Fa=bd-xb;fb=gb-ja;Ha=pb-S;var qb=Fa*xb+fb*ja+Ha*S,qb=-qb/(Fa*Fa+fb*fb+Ha*Ha),Na;if(0>qb){var la=k;la.x=xb;la.y=ja;la.z=S;Na=1}else if(1Ba){var kb,nb,Yb,sc,$a,Ka,vb=Ea;kb=vb.x;nb=vb.y;Yb=vb.z;var H=Ua;sc=H.x;$a=H.y;Ka=H.z;var eb,lb,yb;eb=sc-kb;lb=$a-nb;yb=Ka-Yb;var mb=eb*kb+lb*nb+yb*Yb,mb=-mb/(eb*eb+lb*lb+yb*yb),ub;if(0>mb){var x=k;x.x=kb;x.y=nb;x.z=Yb;ub=1}else if(1ba||rbha){var zb,Ab,ia,Ta,bb,jb,Bb=Ga;zb=Bb.x;Ab=Bb.y;ia=Bb.z;var La=Ua;Ta=La.x;bb=La.y;jb=La.z;var Eb,Cd,qa;Eb=Ta-zb;Cd=bb-Ab;qa=jb-ia;var Bc=Eb*zb+Cd*Ab+qa*ia,Bc=-Bc/(Eb*Eb+Cd*Cd+qa*qa),Mb;if(0>Bc){var Sb=k;Sb.x=zb;Sb.y=Ab;Sb.z=ia;Mb=1}else if(1ba||xhvc*mc){var yc,uc,sd,Bg,ic,Xd,od,Hd,ne,nc,Wb,rd,oe,pe,qe,re,td,se,oc=Pb;yc=oc.x;uc=oc.y;sd=oc.z;var Rb=cc;Bg=Rb.x;ic=Rb.y;Xd=Rb.z;var tf=Fb;od=tf.x;Hd=tf.y;ne=tf.z;nc=Bg-yc;Wb=ic-uc;rd=Xd-sd;oe=od-Bg;pe=Hd-ic;qe=ne-Xd;re=yc-od;td=uc-Hd;se=sd-ne;var Rc,md,pd;Rc=Wb*qe-rd*pe;md=rd*oe-nc*qe;pd=nc*pe-Wb*oe;var rc=yc*(Wb*pd-rd*md)+uc*(rd*Rc-nc*pd)+sd*(nc*md-Wb*Rc),Tc=Bg*(pe*pd-qe*md)+ic*(qe*Rc-oe*pd)+Xd*(oe*md-pe*Rc),cd=od*(td*pd-se*md)+Hd*(se*Rc-re*pd)+ne*(re*md-td*Rc),dd=-1,gd,Fc,Ac,zc=0;Ac=Fc=gd=0;if(0>rc){var Yd,kf,Gf,Ed,ac,Id,Jd=Pb;Yd=Jd.x;kf=Jd.y;Gf=Jd.z;var te=cc;Ed=te.x;ac=te.y;Id=te.z;var ud,vd,wd;ud=Ed-Yd;vd=ac-kf;wd=Id-Gf;var Kd=ud*Yd+vd*kf+wd*Gf,Kd=-Kd/(ud*ud+vd*vd+wd*wd),ue;if(0>Kd){var fe=k;fe.x=Yd;fe.y=kf;fe.z=Gf;ue=1}else if(1Tc){var Le,Md,hd,xd,qd,id,jd=cc;Le=jd.x;Md=jd.y;hd=jd.z;var kd=Fb;xd=kd.x;qd=kd.y;id=kd.z;var Ic,Jc,Kc;Ic=xd-Le;Jc=qd-Md;Kc=id-hd;var Sc=Ic*Le+Jc*Md+Kc*hd,Sc=-Sc/(Ic*Ic+Jc*Jc+Kc*Kc),ld;if(0>Sc){var nd=k;nd.x=Le;nd.y=Md;nd.z=hd;ld=1}else if(1dd||adcd){var fd,We,Oe,vf,lf,De,mf=Pb;fd=mf.x;We=mf.y;Oe=mf.z;var wf=Fb;vf=wf.x;lf=wf.y;De=wf.z;var xf,Pe,Qe;xf=vf-fd;Pe=lf-We;Qe=De-Oe;var ge=xf*fd+Pe*We+Qe*Oe,ge=-ge/(xf*xf+Pe*Pe+Qe*Qe),he;if(0>ge){var Re=k;Re.x=fd;Re.y=We;Re.z=Oe;he=1}else if(1dd||ydkc*mc){var Ye,nf,zh,de,ng,Nd,Od,Pd,El,og,pg,Se,Ze,$e,Te,Tf,If,Jf,Kf=Pb;Ye=Kf.x;nf=Kf.y;zh=Kf.z;var fg=Fb;de=fg.x;ng=fg.y;Nd=fg.z;var Jl=lc;Od=Jl.x;Pd=Jl.y;El=Jl.z;og=de-Ye;pg=ng-nf;Se=Nd-zh;Ze=Od-de;$e=Pd-ng;Te=El-Nd;Tf=Ye-Od;If=nf-Pd;Jf=zh-El;var xe,$d,ae;xe=pg*Te-Se*$e;$d=Se*Ze-og*Te;ae=og*$e-pg*Ze;var dm=Ye*(pg*ae-Se*$d)+nf*(Se*xe-og*ae)+zh*(og*$d-pg*xe),gg=de*($e*ae-Te*$d)+ng*(Te*xe-Ze*ae)+Nd*(Ze*$d-$e*xe),Ae=Od*(If*ae-Jf*$d)+Pd*(Jf*xe-Tf*ae)+El*(Tf*$d-If*xe),Gd=-1,Qd,qg,Ah,rg=0;Ah=qg=Qd=0;if(0>dm){var Ee,Ue,of,Lf,sg,Mf,Nf=Pb;Ee=Nf.x;Ue=Nf.y;of=Nf.z;var Of=Fb;Lf=Of.x;sg=Of.y;Mf=Of.z;var pf,Uf,tg;pf=Lf-Ee;Uf=sg-Ue;tg=Mf-of;var Vf=pf*Ee+Uf*Ue+tg*of,Vf=-Vf/(pf*pf+Uf*Uf+tg*tg),mj;if(0>Vf){var ug=k;ug.x=Ee;ug.y=Ue;ug.z=of;mj=1}else if(1gg){var Xf,Yf,qf,Eg,Mc,wg,xg=Fb;Xf=xg.x;Yf=xg.y;qf=xg.z;var yg=lc;Eg=yg.x;Mc=yg.y;wg=yg.z;var hg,Bf,Qf;hg=Eg-Xf;Bf=Mc-Yf;Qf=wg-qf;var Zf=hg*Xf+Bf*Yf+Qf*qf,Zf=-Zf/(hg*hg+Bf*Bf+Qf*Qf),Ad;if(0>Zf){var Ud=k;Ud.x=Xf;Ud.y=Yf;Ud.z=qf;Ad=1}else if(1Gd||RdAe){var nj,oj,Bh,hf,He,Ch,Dh=Pb;nj=Dh.x;oj=Dh.y;Bh=Dh.z;var Eh=lc;hf=Eh.x;He=Eh.y;Ch=Eh.z;var Fh,Gh,Hh;Fh=hf-nj;Gh=He-oj;Hh=Ch-Bh;var Fg=Fh*nj+Gh*oj+Hh*Bh,Fg=-Fg/(Fh*Fh+Gh*Gh+Hh*Hh),Ih;if(0>Fg){var Jh=k;Jh.x=nj;Jh.y=oj;Jh.z=Bh;Ih=1}else if(1Gd||Tdeg||ekhc*mc){var zg,Gg,Lh,gk,sj,Wg,Xg,Yg,Mh,Zg,$g,ah,bh,ch,Hg,Nh,Oh,Ph,Qh=Pb;zg=Qh.x;Gg=Qh.y;Lh=Qh.z;var Rh=cc;gk=Rh.x;sj=Rh.y;Wg=Rh.z;var hk=lc;Xg=hk.x;Yg=hk.y;Mh=hk.z;Zg=gk-zg;$g=sj-Gg;ah=Wg-Lh;bh=Xg-gk;ch=Yg-sj;Hg=Mh-Wg;Nh=zg-Xg;Oh=Gg-Yg;Ph=Lh-Mh;var af,bf,cf;af=$g*Hg-ah*ch;bf=ah*bh-Zg*Hg;cf=Zg*ch-$g*bh;var Fe=zg*($g*cf-ah*bf)+Gg*(ah*af-Zg*cf)+Lh*(Zg*bf-$g*af),rf=gk*(ch*cf-Hg*bf)+sj*(Hg*af-bh*cf)+Wg*(bh*bf-ch*af),Cf=Xg*(Oh*cf-Ph*bf)+Yg*(Ph*af-Nh*cf)+Mh*(Nh*bf-Oh*af),ie=-1,ye,Sh,Th,Hk=0;Th=Sh=ye=0;if(0>Fe){var $f,ig,jg,Ig,tj,Uh,Vh=Pb;$f=Vh.x;ig=Vh.y;jg=Vh.z;var Wh=cc;Ig=Wh.x;tj=Wh.y;Uh=Wh.z;var Xh,Yh,Zh;Xh=Ig-$f;Yh=tj-ig;Zh=Uh-jg;var Jg=Xh*$f+Yh*ig+Zh*jg,Jg=-Jg/(Xh*Xh+Yh*Yh+Zh*Zh),uj;if(0>Jg){var $h=k;$h.x=$f;$h.y=ig;$h.z=jg;uj=1}else if(1rf){var wj,xj,bi,Sd,kk,ci,di=cc;wj=di.x;xj=di.y;bi=di.z;var ei=lc;Sd=ei.x;kk=ei.y;ci=ei.z;var fi,gi,hi;fi=Sd-wj;gi=kk-xj;hi=ci-bi;var Kg=fi*wj+gi*xj+hi*bi,Kg=-Kg/(fi*fi+gi*gi+hi*hi),yj;if(0>Kg){var ii=k;ii.x=wj;ii.y=xj;ii.z=bi;yj=1}else if(1ie||JkCf){var Aj,Bj,ki,Lk,nk,li,mi=Pb;Aj=mi.x;Bj=mi.y;ki=mi.z;var ni=lc;Lk=ni.x;nk=ni.y;li=ni.z;var oi,pi,qi;oi=Lk-Aj;pi=nk-Bj;qi=li-ki;var Lg=oi*Aj+pi*Bj+qi*ki,Lg=-Lg/(oi*oi+pi*pi+qi*qi),ri;if(0>Lg){var si=k;si.x=Aj;si.y=Bj;si.z=ki;ri=1}else if(1ie||Mkeg||rkGc*mc){var Ag,Mg,ui,tk,Fj,hh,ih,jh,vi,kh,lh,mh,nh,oh,Ng,wi,xi,yi,zi=cc;Ag=zi.x;Mg=zi.y;ui=zi.z;var Ai=Fb;tk=Ai.x;Fj=Ai.y;hh=Ai.z;var uk=lc;ih=uk.x;jh=uk.y;vi=uk.z;kh=tk-Ag;lh=Fj-Mg;mh=hh-ui;nh=ih-tk;oh=jh-Fj;Ng=vi-hh;wi=Ag-ih;xi=Mg-jh;yi=ui-vi;var df,ef,ff;df=lh*Ng-mh*oh;ef=mh*nh-kh*Ng;ff=kh*oh-lh*nh;var Ef=Ag*(lh*ff-mh*ef)+Mg*(mh*df-kh*ff)+ui*(kh*ef-lh*df),Rf=tk*(oh*ff-Ng*ef)+Fj*(Ng*df-nh*ff)+hh*(nh*ef-oh*df),Df=ih*(xi*ff-yi*ef)+jh*(yi*df-wi*ff)+vi*(wi*ef-xi*df),je=-1,ze,Bi,Ci,Pk=0;Ci=Bi=ze=0;if(0>Ef){var ag,kg,lg,Og,Gj,Di,Ei=cc;ag=Ei.x;kg=Ei.y;lg=Ei.z;var Fi=Fb;Og=Fi.x;Gj=Fi.y;Di=Fi.z;var Gi,Hi,Ii;Gi=Og-ag;Hi=Gj-kg;Ii=Di-lg;var Pg=Gi*ag+Hi*kg+Ii*lg,Pg=-Pg/(Gi*Gi+Hi*Hi+Ii*Ii),Hj;if(0>Pg){var Ji=k;Ji.x=ag;Ji.y=kg;Ji.z=lg;Hj=1}else if(1Rf){var Jj,Kj,Li,Ge,xk,Mi,Ni=Fb;Jj=Ni.x;Kj=Ni.y;Li=Ni.z;var Oi=lc;Ge=Oi.x;xk=Oi.y;Mi=Oi.z;var Pi,Qi,Ri;Pi=Ge-Jj;Qi=xk-Kj;Ri=Mi-Li;var Qg=Pi*Jj+Qi*Kj+Ri*Li,Qg=-Qg/(Pi*Pi+Qi*Qi+Ri*Ri),Lj;if(0>Qg){var Si=k;Si.x=Jj;Si.y=Kj;Si.z=Li;Lj=1}else if(1je||RkDf){var Nj,Oj,Ui,Tk,Ak,Vi,Wi=cc;Nj=Wi.x;Oj=Wi.y;Ui=Wi.z;var Xi=lc;Tk=Xi.x;Ak=Xi.y;Vi=Xi.z;var Yi,Zi,$i;Yi=Tk-Nj;Zi=Ak-Oj;$i=Vi-Ui;var Rg=Yi*Nj+Zi*Oj+$i*Ui,Rg=-Rg/(Yi*Yi+Zi*Zi+$i*$i),aj;if(0>Rg){var bj=k;bj.x=Nj;bj.y=Oj;bj.z=Ui;aj=1}else if(1je||Ukeg||Ykk.x*k.x+k.y*k.y+k.z*k.z){if(!f)return this.distance=0;switch(this.ya){case 1:this.Rn();break;case 2:this.El();break;case 3:this.Ll()}if(4==this.ya){var Sj=this.mn(a,b,e,c,h,l,g);if(0!=Sj)return this.distance=0,Sj;this.distance=-this.depth;return 0}this.distance=0;return 1}this.Hm(D);m.x=k.x;m.y=k.y;m.z=k.z;var uh=m,gf=-uh.y,dg=-uh.z;uh.x=-uh.x;uh.y=gf;uh.z=dg;this.zf(!1);this.Af(!1);var Tj=this.Na[this.ya],Uj=this.jb[this.ya];Tj.x=Uj.x;Tj.y=Uj.y;Tj.z=Uj.z;var Ve=Tj,vh=this.qb[this.ya],Sf=Ve.y-vh.y,Sg=Ve.z-vh.z;Ve.x=Ve.x-vh.x;Ve.y=Sf;Ve.z=Sg;if(1E-8>m.x*m.x+m.y*m.y+m.z*m.z)throw Error("!?");var Vj=h[this.ya];if(1E-8>Vj.x*m.x+Vj.y*m.y+Vj.z*m.z-(k.x*m.x+k.y*m.y+k.z*m.z))return this.sm(),this.distance=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),null!=d&&null!=d.oi&&this.Yn(d.oi),0;this.ya++;++w}return 2},fm:function(a,b,e,c,d,f,h){this.wj=a;this.jl=b;this.tc=e;this.Ic=c;var l=this.Na,g=this.closest,k=this.dir,m,n,q;m=c.v-e.v;n=c.A-e.A;q=c.B-e.B;k.x=m;k.y=n;k.z=q;1E-6>k.x*k.x+k.y*k.y+k.z*k.z&&k.za(1,0,0);this.ya=0;if(null!=this.wj)this.zf(!0);else{var p=this.jb[this.ya];p.x=this.tc.v;p.y=this.tc.A;p.z=this.tc.B}this.Af(!0);var r=this.Na[this.ya],v=this.jb[this.ya];r.x=v.x;r.y=v.y;r.z=v.z;var R=this.qb[this.ya],y=r.y-R.y,L=r.z-R.z;r.x=r.x-R.x;r.y=y;r.z=L;this.ya=1;var w=0,D=0,t=this.Vn,B=this.Un;t.Z();B.x=f.x;B.y=f.y;B.z=f.z;var C=B.y-d.y,A=B.z-d.z;B.x=B.x-d.x;B.y=C;for(B.z=A;40>w;){var Vc=0;switch(this.ya){case 1:var I=l[0];g.x=I.x;g.y=I.y;g.z=I.z;Vc=1;break;case 2:var J,Gb,u,G,da,E,O=l[0];J=O.x;Gb=O.y;u=O.z;var Db=l[1];G=Db.x;da=Db.y;E=Db.z;var Ia,Da,ma;Ia=G-J;Da=da-Gb;ma=E-u;var Q=Ia*J+Da*Gb+ma*u,Q=-Q/(Ia*Ia+Da*Da+ma*ma);if(0>Q){var V=g;V.x=J;V.y=Gb;V.z=u;Vc=1}else if(1ga){var pb,ua,xa,Fa,fb,Ha,qb=Ya;pb=qb.x;ua=qb.y;xa=qb.z;var Na=F;Fa=Na.x;fb=Na.y;Ha=Na.z;var la,Ca,Za;la=Fa-pb;Ca=fb-ua;Za=Ha-xa;var Ra=la*pb+Ca*ua+Za*xa,Ra=-Ra/(la*la+Ca*Ca+Za*Za),ib;if(0>Ra){var Lb=g;Lb.x=pb;Lb.y=ua;Lb.z=xa;ib=1}else if(1P){var Ka,vb,H,eb,lb,yb,mb=F;Ka=mb.x;vb=mb.y;H=mb.z;var ub=Qa;eb=ub.x;lb=ub.y;yb=ub.z;var x,W,ea;x=eb-Ka;W=lb-vb;ea=yb-H;var Nc=x*Ka+W*vb+ea*H,Nc=-Nc/(x*x+W*W+ea*ea),xc;if(0>Nc){var Pa=g;Pa.x=Ka;Pa.y=vb;Pa.z=H;xc=1}else if(1xb||Taza){var jb,Bb,La,Eb,Cd,qa,Bc=Ya;jb=Bc.x;Bb=Bc.y;La=Bc.z;var Mb=Qa;Eb=Mb.x;Cd=Mb.y;qa=Mb.z;var Sb,sf,Je;Sb=Eb-jb;sf=Cd-Bb;Je=qa-La;var ta=Sb*jb+sf*Bb+Je*La,ta=-ta/(Sb*Sb+sf*sf+Je*Je),Zb;if(0>ta){var Oa=g;Oa.x=jb;Oa.y=Bb;Oa.z=La;Zb=1}else if(1xb||fcWc*oc){var Xd,od,Hd,ne,rc,Tc,rd,oe,pe,qe,re,td,se,fd,Uc,tf,Rc,md,pd=Qb;Xd=pd.x;od=pd.y;Hd=pd.z;var Xc=dc;ne=Xc.x;rc=Xc.y;Tc=Xc.z;var zd=Vb;rd=zd.x;oe=zd.y;pe=zd.z;qe=ne-Xd;re=rc-od;td=Tc-Hd;se=rd-ne;fd=oe-rc;Uc=pe-Tc;tf=Xd-rd;Rc=od-oe;md=Hd-pe;var cd,dd,gd;cd=re*Uc-td*fd;dd=td*se-qe*Uc;gd=qe*fd-re*se;var Fc=Xd*(re*gd-td*dd)+od*(td*cd-qe*gd)+Hd*(qe*dd-re*cd),Ac=ne*(fd*gd-Uc*dd)+rc*(Uc*cd-se*gd)+Tc*(se*dd-fd*cd),zc=rd*(Rc*gd-md*dd)+oe*(md*cd-tf*gd)+pe*(tf*dd-Rc*cd),Yd=-1,kf,Gf,Ed,ed=0;Ed=Gf=kf=0;if(0>Fc){var Id,Jd,te,ud,vd,wd,Kd=Qb;Id=Kd.x;Jd=Kd.y;te=Kd.z;var ue=dc;ud=ue.x;vd=ue.y;wd=ue.z;var fe,Ld,Zd;fe=ud-Id;Ld=vd-Jd;Zd=wd-te;var Fd=fe*Id+Ld*Jd+Zd*te,Fd=-Fd/(fe*fe+Ld*Ld+Zd*Zd),ve;if(0>Fd){var Ke=g;Ke.x=Id;Ke.y=Jd;Ke.z=te;ve=1}else if(1Ac){var id,jd,kd,Ic,Jc,Kc,Sc=dc;id=Sc.x;jd=Sc.y;kd=Sc.z;var ld=Vb;Ic=ld.x;Jc=ld.y;Kc=ld.z;var nd,ad,yd;nd=Ic-id;ad=Jc-jd;yd=Kc-kd;var Me=nd*id+ad*jd+yd*kd,Me=-Me/(nd*nd+ad*ad+yd*yd),Ad;if(0>Me){var Ne=g;Ne.x=id;Ne.y=jd;Ne.z=kd;Ad=1}else if(1Yd||vfzc){var De,mf,wf,xf,Pe,Qe,ge=Qb;De=ge.x;mf=ge.y;wf=ge.z;var he=Vb;xf=he.x;Pe=he.y;Qe=he.z;var Re,yf,Xe;Re=xf-De;yf=Pe-mf;Xe=Qe-wf;var zf=Re*De+yf*mf+Xe*wf,zf=-zf/(Re*Re+yf*yf+Xe*Xe),kj;if(0>zf){var Vd=g;Vd.x=De;Vd.y=mf;Vd.z=wf;kj=1}else if(1Yd||ljQc*oc){var Nd,Od,Pd,He,og,pg,Se,Ze,$e,Te,Tf,If,Jf,Kf,fg,ce,xe,$d,ae=Qb;Nd=ae.x;Od=ae.y;Pd=ae.z;var le=Vb;He=le.x;og=le.y;pg=le.z;var gg=Nb;Se=gg.x;Ze=gg.y;$e=gg.z;Te=He-Nd;Tf=og-Od;If=pg-Pd;Jf=Se-He;Kf=Ze-og;fg=$e-pg;ce=Nd-Se;xe=Od-Ze;$d=Pd-$e;var Ae,Gd,Qd;Ae=Tf*fg-If*Kf;Gd=If*Jf-Te*fg;Qd=Te*Kf-Tf*Jf;var qg=Nd*(Tf*Qd-If*Gd)+Od*(If*Ae-Te*Qd)+Pd*(Te*Gd-Tf*Ae),Ah=He*(Kf*Qd-fg*Gd)+og*(fg*Ae-Jf*Qd)+pg*(Jf*Gd-Kf*Ae),rg=Se*(xe*Qd-$d*Gd)+Ze*($d*Ae-ce*Qd)+$e*(ce*Gd-xe*Ae),Ee=-1,Ue,of,Lf,sg=0;Lf=of=Ue=0;if(0>qg){var Mf,Nf,Of,pf,Uf,tg,Vf=Qb;Mf=Vf.x;Nf=Vf.y;Of=Vf.z;var mj=Vb;pf=mj.x;Uf=mj.y;tg=mj.z;var ug,Pf,Wf;ug=pf-Mf;Pf=Uf-Nf;Wf=tg-Of;var Af=ug*Mf+Pf*Nf+Wf*Of,Af=-Af/(ug*ug+Pf*Pf+Wf*Wf),Cg;if(0>Af){var Dg=g;Dg.x=Mf;Dg.y=Nf;Dg.z=Of;Cg=1}else if(1Ah){var wg,xg,yg,hg,Bf,Qf,Zf=Vb;wg=Zf.x;xg=Zf.y;yg=Zf.z;var Td=Nb;hg=Td.x;Bf=Td.y;Qf=Td.z;var Sd,Ge,Fe;Sd=hg-wg;Ge=Bf-xg;Fe=Qf-yg;var Tg=Sd*wg+Ge*xg+Fe*yg,Tg=-Tg/(Sd*Sd+Ge*Ge+Fe*Fe),rf;if(0>Tg){var bg=g;bg.x=wg;bg.y=xg;bg.z=yg;rf=1}else if(1Ee||cgrg){var Ch,Dh,Eh,Fh,Gh,Hh,Fg=Qb;Ch=Fg.x;Dh=Fg.y;Eh=Fg.z;var Ih=Nb;Fh=Ih.x;Gh=Ih.y;Hh=Ih.z;var Jh,Kh,pj;Jh=Fh-Ch;Kh=Gh-Dh;pj=Hh-Eh;var Ug=Jh*Ch+Kh*Dh+pj*Eh,Ug=-Ug/(Jh*Jh+Kh*Kh+pj*pj),qj;if(0>Ug){var dg=g;dg.x=Ch;dg.y=Dh;dg.z=Eh;qj=1}else if(1Ee||rjyc||gkDc*oc){var Wg,Xg,Yg,Mh,Zg,$g,ah,bh,ch,Hg,Nh,Oh,Ph,Qh,Rh,hk,af,bf,cf=Qb;Wg=cf.x;Xg=cf.y;Yg=cf.z;var wh=dc;Mh=wh.x;Zg=wh.y;$g=wh.z;var ej=Nb;ah=ej.x;bh=ej.y;ch=ej.z;Hg=Mh-Wg;Nh=Zg-Xg;Oh=$g-Yg;Ph=ah-Mh;Qh=bh-Zg;Rh=ch-$g;hk=Wg-ah;af=Xg-bh;bf=Yg-ch;var Cf,ie,ye;Cf=Nh*Rh-Oh*Qh;ie=Oh*Ph-Hg*Rh;ye=Hg*Qh-Nh*Ph;var Sh=Wg*(Nh*ye-Oh*ie)+Xg*(Oh*Cf-Hg*ye)+Yg*(Hg*ie-Nh*Cf),Th=Mh*(Qh*ye-Rh*ie)+Zg*(Rh*Cf-Ph*ye)+$g*(Ph*ie-Qh*Cf),Hk=ah*(af*ye-bf*ie)+bh*(bf*Cf-hk*ye)+ch*(hk*ie-af*Cf),$f=-1,ig,jg,Ig,tj=0;Ig=jg=ig=0;if(0>Sh){var Uh,Vh,Wh,Xh,Yh,Zh,Jg=Qb;Uh=Jg.x;Vh=Jg.y;Wh=Jg.z;var uj=dc;Xh=uj.x;Yh=uj.y;Zh=uj.z;var $h,ai,vj;$h=Xh-Uh;ai=Yh-Vh;vj=Zh-Wh;var dh=$h*Uh+ai*Vh+vj*Wh,dh=-dh/($h*$h+ai*ai+vj*vj),ik;if(0>dh){var jk=g;jk.x=Uh;jk.y=Vh;jk.z=Wh;ik=1}else if(1Th){var ci,di,ei,fi,gi,hi,Kg=dc;ci=Kg.x;di=Kg.y;ei=Kg.z;var yj=Nb;fi=yj.x;gi=yj.y;hi=yj.z;var ii,ji,zj;ii=fi-ci;ji=gi-di;zj=hi-ei;var eh=ii*ci+ji*di+zj*ei,eh=-eh/(ii*ii+ji*ji+zj*zj),lk;if(0>eh){var mk=g;mk.x=ci;mk.y=di;mk.z=ei;lk=1}else if(1$f||Lk<$f){var tj=lk<<1,$f=Lk,nk=g;ig=nk.x;jg=nk.y;Ig=nk.z}}if(0>Hk){var li,mi,ni,oi,pi,qi,Lg=Qb;li=Lg.x;mi=Lg.y;ni=Lg.z;var ri=Nb;oi=ri.x;pi=ri.y;qi=ri.z;var si,ti,Cj;si=oi-li;ti=pi-mi;Cj=qi-ni;var fh=si*li+ti*mi+Cj*ni,fh=-fh/(si*si+ti*ti+Cj*Cj),Dj;if(0>fh){var ok=g;ok.x=li;ok.y=mi;ok.z=ni;Dj=1}else if(1$f||Ej<$f){var tj=Dj&1|(Dj&2)<<1,$f=Ej,qk=g;ig=qk.x;jg=qk.y;Ig=qk.z}}var rk;if(0<$f){var sk=g;sk.x=ig;sk.y=jg;sk.z=Ig;rk=tj}else{var Ag=Cf*Cf+ie*ie+ye*ye;0yc||tkLc*oc){var hh,ih,jh,vi,kh,lh,mh,nh,oh,Ng,wi,xi,yi,zi,Ai,uk,df,ef,ff=dc;hh=ff.x;ih=ff.y;jh=ff.z;var gj=Vb;vi=gj.x;kh=gj.y;lh=gj.z;var hj=Nb;mh=hj.x;nh=hj.y;oh=hj.z;Ng=vi-hh;wi=kh-ih;xi=lh-jh;yi=mh-vi;zi=nh-kh;Ai=oh-lh;uk=hh-mh;df=ih-nh;ef=jh-oh;var Df,je,ze;Df=wi*Ai-xi*zi;je=xi*yi-Ng*Ai;ze=Ng*zi-wi*yi;var Bi=hh*(wi*ze-xi*je)+ih*(xi*Df-Ng*ze)+jh*(Ng*je-wi*Df),Ci=vi*(zi*ze-Ai*je)+kh*(Ai*Df-yi*ze)+lh*(yi*je-zi*Df),Pk=mh*(df*ze-ef*je)+nh*(ef*Df-uk*ze)+oh*(uk*je-df*Df),ag=-1,kg,lg,Og,Gj=0;Og=lg=kg=0;if(0>Bi){var Di,Ei,Fi,Gi,Hi,Ii,Pg=dc;Di=Pg.x;Ei=Pg.y;Fi=Pg.z;var Hj=Vb;Gi=Hj.x;Hi=Hj.y;Ii=Hj.z;var Ji,Ki,Ij;Ji=Gi-Di;Ki=Hi-Ei;Ij=Ii-Fi;var ph=Ji*Di+Ki*Ei+Ij*Fi,ph=-ph/(Ji*Ji+Ki*Ki+Ij*Ij),vk;if(0>ph){var wk=g;wk.x=Di;wk.y=Ei;wk.z=Fi;vk=1}else if(1Ci){var Mi,Ni,Oi,Pi,Qi,Ri,Qg=Vb;Mi=Qg.x;Ni=Qg.y;Oi=Qg.z;var Lj=Nb;Pi=Lj.x;Qi=Lj.y;Ri=Lj.z;var Si,Ti,Mj;Si=Pi-Mi;Ti=Qi-Ni;Mj=Ri-Oi;var qh=Si*Mi+Ti*Ni+Mj*Oi,qh=-qh/(Si*Si+Ti*Ti+Mj*Mj),yk;if(0>qh){var zk=g;zk.x=Mi;zk.y=Ni;zk.z=Oi;yk=1}else if(1ag||TkPk){var Vi,Wi,Xi,Yi,Zi,$i,Rg=dc;Vi=Rg.x;Wi=Rg.y;Xi=Rg.z;var aj=Nb;Yi=aj.x;Zi=aj.y;$i=aj.z;var bj,cj,Pj;bj=Yi-Vi;cj=Zi-Wi;Pj=$i-Xi;var rh=bj*Vi+cj*Wi+Pj*Xi,rh=-rh/(bj*bj+cj*cj+Pj*Pj),Qj;if(0>rh){var Bk=g;Bk.x=Vi;Bk.y=Wi;Bk.z=Xi;Qj=1}else if(1ag||Rjyc||Ekg.x*g.x+g.y*g.y+g.z*g.z){if(!D||4==this.ya){h.fraction=D;break}this.sm();h.fraction=D;var Uj=h.normal;Uj.x=k.x;Uj.y=k.y;Uj.z=k.z;var Ve=Uj,vh=Math.sqrt(Ve.x*Ve.x+Ve.y*Ve.y+Ve.z*Ve.z);0k.x*k.x+k.y*k.y+k.z*k.z)throw Error("!?");var Nl=l[this.ya],dj=k,el=Nl.x*dj.x+Nl.y*dj.y+Nl.z*dj.z;if(0>el){if(0<=B.x*dj.x+B.y*dj.y+B.z*dj.z)break;var pl=el/(B.x*dj.x+B.y*dj.y+B.z*dj.z),D=D+pl;if(1<=D)break;var wl=t.y+B.y*pl,xl=t.z+B.z*pl;t.x=t.x+B.x*pl;t.y=wl;t.z=xl;for(var fl=0,yl=this.ya+1;flkl*kl+ll*ll+ml*ml){il=!0;break}}il||this.ya++;++w}return!1},sm:function(){switch(this.ya){case 1:var a=this.closestPoint1,b=this.jb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,c=this.qb[0];e.x=c.x;e.y=c.y;e.z=c.z;break;case 2:var d,f,h,l=this.closest;d=l.x;f=l.y;h=l.z;var g,k,m,n,q,p,r,v,R,y,L,w,D,t,B,C,A,Vc,I=this.Na[0];g=I.x;k=I.y;m=I.z;var J=this.jb[0];n=J.x;q=J.y;p=J.z;var Gb=this.qb[0];r=Gb.x;v=Gb.y;R=Gb.z;var u=this.Na[1];y=u.x;L=u.y;w=u.z;var G=this.jb[1];D=G.x;t=G.y;B=G.z;var da=this.qb[1];C=da.x;A=da.y;Vc=da.z;var E,O,Db;E=y-g;O=L-k;Db=w-m;var Ia=E*E+O*O+Db*Db;Ia&&(Ia=1/Ia);var Da=((d-g)*E+(f-k)*O+(h-m)*Db)*Ia,ma,Q,V,Ga,Ea,Ua,va,oa,Ya;ma=D-n;Q=t-q;V=B-p;Ga=n+ma*Da;Ea=q+Q*Da;Ua=p+V*Da;ma=C-r;Q=A-v;V=Vc-R;va=r+ma*Da;oa=v+Q*Da;Ya=R+V*Da;var F=this.closestPoint1;F.x=Ga;F.y=Ea;F.z=Ua;var Qa=this.closestPoint2;Qa.x=va;Qa.y=oa;Qa.z=Ya;break;case 3:var X,M,N,ca=this.closest;X=ca.x;M=ca.y;N=ca.z;var Y,T,aa,z,fa,U,pa,sa,wa,ra,ka,Z,na,Aa,ya,K,Ba,ha,ba,Va,ga,P,za,S,ja,ta,bd,gb=this.Na[0];Y=gb.x;T=gb.y;aa=gb.z;var pb=this.jb[0];z=pb.x;fa=pb.y;U=pb.z;var ua=this.qb[0];pa=ua.x;sa=ua.y;wa=ua.z;var xa=this.Na[1];ra=xa.x;ka=xa.y;Z=xa.z;var Fa=this.jb[1];na=Fa.x;Aa=Fa.y;ya=Fa.z;var fb=this.qb[1];K=fb.x;Ba=fb.y;ha=fb.z;var Ha=this.Na[2];ba=Ha.x;Va=Ha.y;ga=Ha.z;var qb=this.jb[2];P=qb.x;za=qb.y;S=qb.z;var Na=this.qb[2];ja=Na.x;ta=Na.y;bd=Na.z;var la,Ca,Za,Ra,ib,Lb,db,Ib,kb;la=ra-Y;Ca=ka-T;Za=Z-aa;Ra=ba-Y;ib=Va-T;Lb=ga-aa;db=X-Y;Ib=M-T;kb=N-aa;var nb=la*la+Ca*Ca+Za*Za,Yb=la*Ra+Ca*ib+Za*Lb,sc=Ra*Ra+ib*ib+Lb*Lb,$a=la*db+Ca*Ib+Za*kb,Ka=Ra*db+ib*Ib+Lb*kb,vb=nb*sc-Yb*Yb;vb&&(vb=1/vb);var H=($a*sc-Ka*Yb)*vb,eb=(-$a*Yb+Ka*nb)*vb,lb,yb,mb,ub,x,W,ea,Nc,xc;lb=na-z;yb=Aa-fa;mb=ya-U;ub=z+lb*H;x=fa+yb*H;W=U+mb*H;lb=P-z;yb=za-fa;mb=S-U;ub+=lb*eb;x+=yb*eb;W+=mb*eb;lb=K-pa;yb=Ba-sa;mb=ha-wa;ea=pa+lb*H;Nc=sa+yb*H;xc=wa+mb*H;lb=ja-pa;yb=ta-sa;mb=bd-wa;ea+=lb*eb;Nc+=yb*eb;xc+=mb*eb;var Pa=this.closestPoint1;Pa.x=ub;Pa.y=x;Pa.z=W;var rb=this.closestPoint2;rb.x=ea;rb.y=Nc;rb.z=xc;break;default:throw Error("!?");}},Pn:function(a){var b=this.dir;a=a.Il;b.x=a.x;b.y=a.y;b.z=a.z},Yn:function(a){a=a.Il;var b=this.closest;a.x=b.x;a.y=b.y;a.z=b.z;var b=-a.y,e=-a.z;a.x=-a.x;a.y=b;a.z=e},Hm:function(a){this.ya=a;this.ya=(this.ya&5)+(this.ya>>1&5);this.ya=(this.ya&3)+(this.ya>>2&3);switch(a){case 2:a=this.Na[0];var b=this.Na[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[1];a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.Na[0];b=this.Na[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.Na[1];b=this.Na[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[1];b=this.jb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[1];b=this.qb[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.Na[0];b=this.Na[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 8:a=this.Na[0];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.Na[1];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[1];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[1];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.Na[0];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a=this.Na[2];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[2];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[2];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.Na[0];b=this.Na[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[0];b=this.jb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[0];b=this.qb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.Na[1];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[1];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[1];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.Na[1];b=this.Na[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.jb[1];b=this.jb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.qb[1];b=this.qb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.Na[0],b=this.Na[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.jb[0],b=this.jb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.qb[0],b=this.qb[3],a.x=b.x,a.y=b.y,a.z=b.z}},zf:function(a){var b,e,c,d,f,h;h=this.dir;d=h.x;f=h.y;h=h.z;var l;e=this.tc.o*d+this.tc.i*f+this.tc.l*h;l=this.tc.f*d+this.tc.m*f+this.tc.g*h;b=this.tc.h*d+this.tc.j*f+this.tc.s*h;c=this.dir;c.x=e;c.y=l;c.z=b;this.wj.Pd(this.dir,this.jb[this.ya]);a&&(a=this.dir,b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=a++,e=this.dir,b=this.uj[b];e.x=b.x;e.y=b.y;e.z=b.z;this.zf(!1);this.Af(!1);e=this.Na[this.ya];b=this.jb[this.ya];e.x=b.x;e.y=b.y;e.z=b.z;var b=this.qb[this.ya],c=e.y-b.y,d=e.z-b.z;e.x=e.x-b.x;e.y=c;e.z=d;this.ya++;this.El();if(4==this.ya)break;this.ya--;e=this.dir;b=-e.y;c=-e.z;e.x=-e.x;e.y=b;e.z=c;this.zf(!1);this.Af(!1);e=this.Na[this.ya];b=this.jb[this.ya];e.x=b.x;e.y=b.y;e.z=b.z;b=this.qb[this.ya];c=e.y-b.y;d=e.z-b.z;e.x=e.x-b.x;e.y=c;e.z=d;this.ya++;this.El();if(4==this.ya)break;this.ya--}},El:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;e=e.z;var c,d,f,h,l,g;f=this.Na[0];c=f.x;d=f.y;f=f.z;g=this.Na[1];h=g.x;l=g.y;g=g.z;c-=h;d-=l;f-=g;for(l=0;3>l;){g=l++;var k,m;g=this.uj[g];h=g.x;k=g.y;m=g.z;g=d*m-f*k;m=f*h-c*m;h=c*k-d*h;k=this.dir;k.x=g;k.y=m;k.z=h;this.zf(!1);this.Af(!1);g=this.Na[this.ya];h=this.jb[this.ya];g.x=h.x;g.y=h.y;g.z=h.z;h=this.qb[this.ya];k=g.y-h.y;m=g.z-h.z;g.x=g.x-h.x;g.y=k;g.z=m;this.ya++;this.Ll();if(4==this.ya)break;this.ya--;g=this.dir;h=-g.y;k=-g.z;g.x=-g.x;g.y=h;g.z=k;this.zf(!1);this.Af(!1);g=this.Na[this.ya];h=this.jb[this.ya];g.x=h.x;g.y=h.y;g.z=h.z;h=this.qb[this.ya];k=g.y-h.y;m=g.z-h.z;g.x=g.x-h.x;g.y=k;g.z=m;this.ya++;this.Ll();if(4==this.ya)break;this.ya--}c=this.dir;c.x=a;c.y=b;c.z=e},Ll:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;for(e=e.z;;){var c,d,f,h,l,g,k,m,n;f=this.Na[0];c=f.x;d=f.y;f=f.z;m=this.Na[1];h=m.x;l=m.y;g=m.z;n=this.Na[2];k=n.x;m=n.y;n=n.z;h-=c;l-=d;g-=f;c=k-c;d=m-d;m=n-f;f=l*m-g*d;m=g*c-h*m;d=h*d-l*c;h=this.dir;h.x=f;h.y=m;h.z=d;this.zf(!1);this.Af(!1);d=this.Na[this.ya];f=this.jb[this.ya];d.x=f.x;d.y=f.y;d.z=f.z;f=this.qb[this.ya];h=d.y-f.y;c=d.z-f.z;d.x=d.x-f.x;d.y=h;d.z=c;this.ya++;if(this.tm())break;this.ya--;d=this.dir;f=-d.y;h=-d.z;d.x=-d.x;d.y=f;d.z=h;this.zf(!1);this.Af(!1);d=this.Na[this.ya];f=this.jb[this.ya];d.x=f.x;d.y=f.y;d.z=f.z;f=this.qb[this.ya];h=d.y-f.y;c=d.z-f.z;d.x=d.x-f.x;d.y=h;d.z=c;this.ya++;if(this.tm())break;this.ya--;break}d=this.dir;d.x=a;d.y=b;d.z=e},tm:function(){var a=this.Na[2].x-this.Na[0].x,b=this.Na[2].y-this.Na[0].y,e=this.Na[2].z-this.Na[0].z,c=this.Na[3].x-this.Na[0].x,d=this.Na[3].y-this.Na[0].y,f=this.Na[3].z-this.Na[0].z,a=(this.Na[1].x-this.Na[0].x)*(b*f-e*d)-(this.Na[1].y-this.Na[0].y)*(a*f-e*c)+(this.Na[1].z-this.Na[0].z)*(a*d-b*c);return 1E-12a},mn:function(a,b,e,c,d,f,h){for(var l=this.Og;0J;){for(var Gb=this.Og.jd,u=1/0,G=null;null!=Gb;){var da=Gb.M;Gb.WjA.x*N.x+A.y*N.y+A.z*N.z-(X.x*M.x+X.y*M.y+X.z*M.z)||39==J){var ca=this.closest,Y=this.dir;ca.x=Y.x;ca.y=Y.y;ca.z=Y.z;var T=ca,aa=this.dir,z=Ya.xd,fa=this.dir,U=(aa.x*z.x+aa.y*z.y+aa.z*z.z)/(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z),pa=T.y*U,sa=T.z*U;T.x=T.x*U;T.y=pa;T.z=sa;var wa,ra,ka,Z=this.closest;wa=Z.x;ra=Z.y;ka=Z.z;var na,Aa,ya,K,Ba,ha,ba,Va,ga,P,za,xb,ja,ta,bd,gb,pb,ua,xa,Fa,fb,Ha,qb,Na,la,Ca,Za,Ra=Ya.xd;na=Ra.x;Aa=Ra.y;ya=Ra.z;var ib=Ya.jb;K=ib.x;Ba=ib.y;ha=ib.z;var Lb=Ya.qb;ba=Lb.x;Va=Lb.y;ga=Lb.z;var db=F.xd;P=db.x;za=db.y;xb=db.z;var Ib=F.jb;ja=Ib.x;ta=Ib.y;bd=Ib.z;var kb=F.qb;gb=kb.x;pb=kb.y;ua=kb.z;var nb=Qa.xd;xa=nb.x;Fa=nb.y;fb=nb.z;var Yb=Qa.jb;Ha=Yb.x;qb=Yb.y;Na=Yb.z;var sc=Qa.qb;la=sc.x;Ca=sc.y;Za=sc.z;var $a,Ka,vb,H,eb,lb,yb,mb,ub;$a=P-na;Ka=za-Aa;vb=xb-ya;H=xa-na;eb=Fa-Aa;lb=fb-ya;yb=wa-na;mb=ra-Aa;ub=ka-ya;var x=$a*$a+Ka*Ka+vb*vb,W=$a*H+Ka*eb+vb*lb,ea=H*H+eb*eb+lb*lb,Nc=$a*yb+Ka*mb+vb*ub,xc=H*yb+eb*mb+lb*ub,Pa=x*ea-W*W;Pa&&(Pa=1/Pa);var rb=(Nc*ea-xc*W)*Pa,ob=(-Nc*W+xc*x)*Pa,zb,Ab,ia,Ta,bb,jb,Bb,La,Eb;zb=ja-K;Ab=ta-Ba;ia=bd-ha;Ta=K+zb*rb;bb=Ba+Ab*rb;jb=ha+ia*rb;zb=Ha-K;Ab=qb-Ba;ia=Na-ha;Ta+=zb*ob;bb+=Ab*ob;jb+=ia*ob;zb=gb-ba;Ab=pb-Va;ia=ua-ga;Bb=ba+zb*rb;La=Va+Ab*rb;Eb=ga+ia*rb;zb=la-ba;Ab=Ca-Va;ia=Za-ga;Bb+=zb*ob;La+=Ab*ob;Eb+=ia*ob;var Cd=this.closestPoint1;Cd.x=Ta;Cd.y=bb;Cd.z=jb;var qa=this.closestPoint2;qa.x=Bb;qa.y=La;qa.z=Eb;var Bc=this.closest;this.depth=Math.sqrt(Bc.x*Bc.x+Bc.y*Bc.y+Bc.z*Bc.z);return Gc.SUCCEEDED}var Mb=this.Og,Sb=Mb.bf;null!=Sb?(Mb.bf=Sb.M,Sb.M=null):Sb=new ke;var Oa=Sb.za(A,Vc,I);if(!this.Og.Vm(Oa,E))return Gc.EPA_FAILED_TO_ADD_VERTEX;++J}return Gc.EPA_DID_NOT_CONVERGE},ua:function(a,b,e,c,d){return this.zj(a,b,e,c,d,!0)},cb:function(a,b,e,c,d){return this.zj(a,b,e,c,d,!1)},Bf:function(a,b,e,c,d,f,h){return this.fm(a,b,e,c,d,f,h)},Vd:function(a,b,e,c,d){var f=this.ao;f.v=e.x;f.A=e.y;f.B=e.z;var h=this.bo,l=this.co;h.x=c.x;h.y=c.y;h.z=c.z;c=h.y-e.y;var g=h.z-e.z;h.x=h.x-e.x;h.y=c;h.z=g;l.Z();return this.fm(null,a,f,b,h,l,d)}};de.qc=function(a,b,e){var c,d,f,h;c=a.x;d=a.y;a=a.z;f=b.x;h=b.y;b=b.z;var l,g,k;l=f-c;g=h-d;k=b-a;var m;m=-(l*c+g*d+k*a)/(l*l+g*g+k*k);if(0>m)return e.x=c,e.y=d,e.z=a,1;if(1d*(r*A-v*C)+f*(v*B-p*A)+h*(p*C-r*B)){var G;p=a.x;Vc=a.y;I=a.z;r=b.x;v=b.y;G=b.z;var da;da=r-p;Gb=v-Vc;J=G-I;u=-(da*p+Gb*Vc+J*I)/(da*da+Gb*Gb+J*J);0>u?(c.x=p,c.y=Vc,c.z=I,J=1):1l*(y*A-L*C)+g*(L*B-R*A)+k*(R*C-y*B)&&(R=b.x,l=b.y,b=b.z,L=e.x,p=e.y,r=e.z,v=L-R,y=p-l,g=r-b,k=-(v*R+y*l+g*b)/(v*v+y*y+g*g),0>k?(c.x=R,c.y=l,c.z=b,b=1):1Vc||lm*(D*A-t*C)+n*(t*B-w*A)+q*(w*C-D*B)&&(n=a.x,m=a.y,a=a.z,w=e.x,D=e.y,b=e.z,l=w-n,t=D-m,e=b-a,q=-(l*n+t*m+e*a)/(l*l+t*t+e*e),0>q?(c.x=n,c.y=m,c.z=a,e=1):1Vc||aYa*oa){var aa,z,fa,U,pa,sa,wa,ra,ka,Z,na,Aa,ya,K,Ba,ha,ba,Va;aa=a.x;z=a.y;fa=a.z;U=b.x;pa=b.y;sa=b.z;wa=e.x;ra=e.y;ka=e.z;Z=U-aa;na=pa-z;Aa=sa-fa;ya=wa-U;K=ra-pa;Ba=ka-sa;ha=aa-wa;ba=z-ra;Va=fa-ka;var ga,P,za;ga=na*Ba-Aa*K;P=Aa*ya-Z*Ba;za=Z*K-na*ya;var xb=aa*(na*za-Aa*P)+z*(Aa*ga-Z*za)+fa*(Z*P-na*ga),ja=U*(K*za-Ba*P)+pa*(Ba*ga-ya*za)+sa*(ya*P-K*ga),Oa=wa*(ba*za-Va*P)+ra*(Va*ga-ha*za)+ka*(ha*P-ba*ga),bd=-1,gb,pb,ua,xa=0;ua=pb=gb=0;if(0>xb){var Fa,fb,Ha,qb,Na,la;Fa=a.x;fb=a.y;Ha=a.z;qb=b.x;Na=b.y;la=b.z;var Ca,Za,Ra;Ca=qb-Fa;Za=Na-fb;Ra=la-Ha;var ib=Ca*Fa+Za*fb+Ra*Ha,ib=-ib/(Ca*Ca+Za*Za+Ra*Ra),Lb;if(0>ib)d.x=Fa,d.y=fb,d.z=Ha,Lb=1;else if(1ja){var Yb,sc,$a,Ka,vb,H;Yb=b.x;sc=b.y;$a=b.z;Ka=e.x;vb=e.y;H=e.z;var eb,lb,yb;eb=Ka-Yb;lb=vb-sc;yb=H-$a;var mb=eb*Yb+lb*sc+yb*$a,mb=-mb/(eb*eb+lb*lb+yb*yb),ub;if(0>mb)d.x=Yb,d.y=sc,d.z=$a,ub=1;else if(1bd||NcOa){var xc,Pa,rb,ob,zb,Ab;xc=a.x;Pa=a.y;rb=a.z;ob=e.x;zb=e.y;Ab=e.z;var ia,Ta,bb;ia=ob-xc;Ta=zb-Pa;bb=Ab-rb;var jb=ia*xc+Ta*Pa+bb*rb,jb=-jb/(ia*ia+Ta*Ta+bb*bb),Bb;if(0>jb)d.x=xc,d.y=Pa,d.z=rb,Bb=1;else if(1bd||qaF*oa){var Je,Xa,Zb,Ma,Wa,Ja,ab,Ub,gc,fc,Pb,cc,Fb,lc,bc,Qb,dc,Vb;Je=a.x;Xa=a.y;Zb=a.z;Ma=e.x;Wa=e.y;Ja=e.z;ab=c.x;Ub=c.y;gc=c.z;fc=Ma-Je;Pb=Wa-Xa;cc=Ja-Zb;Fb=ab-Ma;lc=Ub-Wa;bc=gc-Ja;Qb=Je-ab;dc=Xa-Ub;Vb=Zb-gc;var Nb,Tb,sb;Nb=Pb*bc-cc*lc;Tb=cc*Fb-fc*bc;sb=fc*lc-Pb*Fb;var cb=Je*(Pb*sb-cc*Tb)+Xa*(cc*Nb-fc*sb)+Zb*(fc*Tb-Pb*Nb),qc=Ma*(lc*sb-bc*Tb)+Wa*(bc*Nb-Fb*sb)+Ja*(Fb*Tb-lc*Nb),tb=ab*(dc*sb-Vb*Tb)+Ub*(Vb*Nb-Qb*sb)+gc*(Qb*Tb-dc*Nb),Zc=-1,jc,Hc,pc,hb=0;pc=Hc=jc=0;if(0>cb){var $c,tc,Cb,Yc,wb,Hb;$c=a.x;tc=a.y;Cb=a.z;Yc=e.x;wb=e.y;Hb=e.z;var Cc,Ob,wc;Cc=Yc-$c;Ob=wb-tc;wc=Hb-Cb;var Jb=Cc*$c+Ob*tc+wc*Cb,Jb=-Jb/(Cc*Cc+Ob*Ob+wc*wc),Kb;if(0>Jb)d.x=$c,d.y=tc,d.z=Cb,Kb=1;else if(1qc){var Oc,$b,mc,Ec,Rb,ec;Oc=e.x;$b=e.y;mc=e.z;Ec=c.x;Rb=c.y;ec=c.z;var nc,ic,Pc;nc=Ec-Oc;ic=Rb-$b;Pc=ec-mc;var kc=nc*Oc+ic*$b+Pc*mc,kc=-kc/(nc*nc+ic*ic+Pc*Pc),Wb;if(0>kc)d.x=Oc,d.y=$b,d.z=mc,Wb=1;else if(1Zc||Gctb){var vc,ac,rc,Tc,Wc,Qc;vc=a.x;ac=a.y;rc=a.z;Tc=c.x;Wc=c.y;Qc=c.z;var Dc,Lc,yc;Dc=Tc-vc;Lc=Wc-ac;yc=Qc-rc;var uc=Dc*vc+Lc*ac+yc*rc,uc=-uc/(Dc*Dc+Lc*Lc+yc*yc),sd;if(0>uc)d.x=vc,d.y=ac,d.z=rc,sd=1;else if(1Zc||odM||ydQa*oa){var rd,oe,pe,qe,re,td,se,Xc,ed,tf,Rc,md,pd,zd,Ad,cd,dd,gd;rd=a.x;oe=a.y;pe=a.z;qe=b.x;re=b.y;td=b.z;se=c.x;Xc=c.y;ed=c.z;tf=qe-rd;Rc=re-oe;md=td-pe;pd=se-qe;zd=Xc-re;Ad=ed-td;cd=rd-se;dd=oe-Xc;gd=pe-ed;var Fc,Ac,zc;Fc=Rc*Ad-md*zd;Ac=md*pd-tf*Ad;zc=tf*zd-Rc*pd;var Yd=rd*(Rc*zc-md*Ac)+oe*(md*Fc-tf*zc)+pe*(tf*Ac-Rc*Fc),kf=qe*(zd*zc-Ad*Ac)+re*(Ad*Fc-pd*zc)+td*(pd*Ac-zd*Fc),de=se*(dd*zc-gd*Ac)+Xc*(gd*Fc-cd*zc)+ed*(cd*Ac-dd*Fc),Ed=-1,Mc,Id,Jd,te=0;Jd=Id=Mc=0;if(0>Yd){var ud,vd,wd,Kd,ue,fe;ud=a.x;vd=a.y;wd=a.z;Kd=b.x;ue=b.y;fe=b.z;var Ld,Zd,Fd;Ld=Kd-ud;Zd=ue-vd;Fd=fe-wd;var ve=Ld*ud+Zd*vd+Fd*wd,ve=-ve/(Ld*Ld+Zd*Zd+Fd*Fd),Ke;if(0>ve)d.x=ud,d.y=vd,d.z=wd,Ke=1;else if(1kf){var hd,xd,qd,id,jd,kd;hd=b.x;xd=b.y;qd=b.z;id=c.x;jd=c.y;kd=c.z;var Ic,Jc,Kc;Ic=id-hd;Jc=jd-xd;Kc=kd-qd;var Sc=Ic*hd+Jc*xd+Kc*qd,Sc=-Sc/(Ic*Ic+Jc*Jc+Kc*Kc),ld;if(0>Sc)d.x=hd,d.y=xd,d.z=qd,ld=1;else if(1Ed||Mede){var Ud,Ne,Sd,uf,Ge,We;Ud=a.x;Ne=a.y;Sd=a.z;uf=c.x;Ge=c.y;We=c.z;var Oe,vf,lf;Oe=uf-Ud;vf=Ge-Ne;lf=We-Sd;var De=Oe*Ud+vf*Ne+lf*Sd,De=-De/(Oe*Oe+vf*vf+lf*lf),mf;if(0>De)d.x=Ud,d.y=Ne,d.z=Sd,mf=1;else if(1Ed||QeM||yfX*oa){var Xe,zf,be,ce,le,ee,me,Be,Hf,Rd,ke,Td,Fe,Ye,nf,hf,rf,ng;Xe=b.x;zf=b.y;be=b.z;ce=e.x;le=e.y;ee=e.z;me=c.x;Be=c.y;Hf=c.z;Rd=ce-Xe;ke=le-zf;Td=ee-be;Fe=me-ce;Ye=Be-le;nf=Hf-ee;hf=Xe-me;rf=zf-Be;ng=be-Hf;var Nd,Od,Pd;Nd=ke*nf-Td*Ye;Od=Td*Fe-Rd*nf;Pd=Rd*Ye-ke*Fe;var bg=Xe*(ke*Pd-Td*Od)+zf*(Td*Nd-Rd*Pd)+be*(Rd*Od-ke*Nd),og=ce*(Ye*Pd-nf*Od)+le*(nf*Nd-Fe*Pd)+ee*(Fe*Od-Ye*Nd),pg=me*(rf*Pd-ng*Od)+Be*(ng*Nd-hf*Pd)+Hf*(hf*Od-rf*Nd),Se=-1,Ze,$e,Te,Tf=0;Te=$e=Ze=0;if(0>bg){var If,Jf,Kf,fg,Ef,xe;If=b.x;Jf=b.y;Kf=b.z;fg=e.x;Ef=e.y;xe=e.z;var $d,ae,gf;$d=fg-If;ae=Ef-Jf;gf=xe-Kf;var gg=$d*If+ae*Jf+gf*Kf,gg=-gg/($d*$d+ae*ae+gf*gf),Ae;if(0>gg)d.x=If,d.y=Jf,d.z=Kf,Ae=1;else if(1og){var rg,Ee,Ue,of,Lf,sg;rg=e.x;Ee=e.y;Ue=e.z;of=c.x;Lf=c.y;sg=c.z;var Mf,Nf,Of;Mf=of-rg;Nf=Lf-Ee;Of=sg-Ue;var pf=Mf*rg+Nf*Ee+Of*Ue,pf=-pf/(Mf*Mf+Nf*Nf+Of*Of),Uf;if(0>pf)d.x=rg,d.y=Ee,d.z=Ue,Uf=1;else if(1Se||ugpg){var Pf,Wf,Af,Cg,Dg,Rf;Pf=b.x;Wf=b.y;Af=b.z;Cg=c.x;Dg=c.y;Rf=c.z;var vg,Xf,Yf;vg=Cg-Pf;Xf=Dg-Wf;Yf=Rf-Af;var qf=vg*Pf+Xf*Wf+Yf*Af,qf=-qf/(vg*vg+Xf*Xf+Yf*Yf),Eg;if(0>qf)d.x=Pf,d.y=Wf,d.z=Af,Eg=1;else if(1Se||ygM||Zfe?b>c?(b=Math.sqrt(b-e-c+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b,a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(c-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>c?(b=Math.sqrt(e-c-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(c-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a},cb:function(a){var b=Math.sin(a.x),e=Math.sin(a.y),c=Math.sin(a.z),d=Math.cos(a.x),f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*c;this.e02=e;this.e10=d*c+a*b*e;this.e11=d*a-b*e*c;this.e12=-f*b;this.e20=b*c-d*a*e;this.e21=a*b+d*e*c;this.e22=d*f;return this},li:function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new t(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new t(.5*a,1.570796326794895,.5*a)):new t(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))},uc:function(a){return 0==a?new t(this.e00,this.e01,this.e02):1==a?new t(this.e10,this.e11,this.e12):2==a?new t(this.e20,this.e21,this.e22):null},pc:function(a){return 0==a?new t(this.e00,this.e10,this.e20):1==a?new t(this.e01,this.e11,this.e21):2==a?new t(this.e02,this.e12,this.e22):null},vc:function(a,b){0==a?b.za(this.e00,this.e01,this.e02):1==a?b.za(this.e10,this.e11,this.e12):2==a?b.za(this.e20,this.e21,this.e22):b.Z()},qc:function(a,b){0==a?b.za(this.e00,this.e10,this.e20):1==a?b.za(this.e01,this.e11,this.e21):2==a?b.za(this.e02,this.e12,this.e22):b.Z()},Mb:function(a,b,e){var c=a.y,d=a.z,f=b.x,h=b.y;b=b.z;var l=e.x,g=e.y;e=e.z;this.e00=a.x;this.e01=c;this.e02=d;this.e10=f;this.e11=h;this.e12=b;this.e20=l;this.e21=g;this.e22=e;return this},ua:function(a,b,e){var c=b.x,d=e.x,f=a.y,h=b.y,l=e.y,g=a.z;b=b.z;e=e.z;this.e00=a.x;this.e01=c;this.e02=d;this.e10=f;this.e11=h;this.e12=l;this.e20=g;this.e21=b;this.e22=e;return this},toString:function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};Oa.Lc=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};Oa.atan2=function(a,b){return Math.atan2(a,b)};Oa.sqrt=function(a){return Math.sqrt(a)};Oa.Hb=function(a,b,e){return ae?e:a};Oa.Ac=function(){return Math.random()};Oa.Ec=function(a,b){return a+Math.random()*(b-a)};Oa.Kc=function(a,b){return new t(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};Oa.Jc=function(){return new t(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};$b.prototype={Ac:function(){return 0==this.c?new t:this.b[--this.c]},qc:function(){return 0==this.eb?new E:this.bb[--this.eb]},uc:function(){return 0==this.dg?new O:this.Lf[--this.dg]},vc:function(){return 0==this.ee?new ta:this.Wd[--this.ee]},ua:function(a,b,e,c){if(null!=a){a.Z();if(this.c==this.b.length){for(var d=Array(this.c<<1),f=0,h=this.c;ff?(f=-f,e=-a.x,c=-a.y,d=-a.z,a=-a.w):(e=a.x,c=a.y,d=a.z,a=a.w);if(.999999e?b>c?(b=Math.sqrt(b-e-c+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(c-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>c?(b=Math.sqrt(e-c-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(c-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this},fd:function(){var a=new E,b=this.x,e=this.y,c=this.z,d=this.w,f=2*b,h=2*e,l=2*c,g=b*f,k=e*h,c=c*l,m=b*h,e=e*l,b=b*l,f=d*f,h=d*h,d=d*l;a.e00=1-k-c;a.e01=m-d;a.e02=b+h;a.e10=m+d;a.e11=1-g-c;a.e12=e-f;a.e20=b-h;a.e21=e+f;a.e22=1-g-k;return a},toString:function(){return"Quat["+(0G.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?G.alternativeContactPositionCorrectionAlgorithm:G.defaultContactPositionCorrectionAlgorithm,b.incremental?this.Zl.On(b,this.C.a,this.D.a):this.Zl.eo(b,this.C.a,this.D.a)):this.Ja.Xe();if(this.Td&&!a){var b=this.Zb.yd,e=this.$b.yd;b==e&&(e=null);null!=b&&b.beginContact(this);null!=e&&e.beginContact(this)}!this.Td&&a&&(a=this.Zb.yd,b=this.$b.yd,a==b&&(b=null),null!=a&&a.endContact(this),null!=b&&b.endContact(this));this.Td&&(a=this.Zb.yd,b=this.$b.yd,a==b&&(b=null),null!=a&&a.preSolve(this),null!=b&&b.preSolve(this))}},Vk:function(){var a=this.Zb.yd,b=this.$b.yd;a==b&&(b=null);null!=a&&a.postSolve(this);null!=b&&b.postSolve(this)},pc:function(){return this.Zb},qc:function(){return this.$b},sk:function(){return this.Td},cb:function(){return this.Ja},ua:function(){return this.Ye},Mb:function(){return this.ia},Hb:function(){return this.M}};ed.prototype={ua:function(){return this.Zd},Hb:function(){return this.Qc},Mb:function(){return this.ia},cb:function(){return this.M}};He.prototype={pn:function(){for(var a=this.jc.ce;null!=a;){for(var b=a.M;;){var e;a.mh.Ccg.J&&l.Kg.K&&l.Lg.L&&this.Gm(c,d))){c=b.ia;d=b.M;null!=c&&(c.M=d);null!=d&&(d.ia=c);b==this.zd&&(this.zd=this.zd.M);b==this.ye&&(this.ye=this.ye.ia);b.M=null;b.ia=null;b.Td&&(c=b.Zb.yd,d=b.$b.yd,c==d&&(d=null),null!=c&&c.endContact(b),null!=d&&d.endContact(b));c=b.rb.ia;d=b.rb.M;null!=c&&(c.M=d);null!=d&&(d.ia=c);b.rb==b.C.Ob&&(b.C.Ob=b.C.Ob.M);b.rb==b.C.kc&&(b.C.kc=b.C.kc.ia);b.rb.M=null;b.rb.ia=null;c=b.sb.ia;d=b.sb.M;null!=c&&(c.M=d);null!=d&&(d.ia=c);b.sb==b.D.Ob&&(b.D.Ob=b.D.Ob.M);b.sb==b.D.kc&&(b.D.kc=b.D.kc.ia);b.sb.M=null;b.sb.ia=null;b.C.Ae--;b.D.Ae--;b.rb.Qc=null;b.sb.Qc=null;b.rb.Zd=null;b.sb.Zd=null;b.Zb=null;b.$b=null;b.C=null;b.D=null;b.Td=!1;b.$i.Xe();b.Ja.Xe();b.Lh=null;c=b.Ye;c.Zb=null;c.$b=null;c.C=null;c.D=null;c.pj=null;c.qj=null;b.M=this.lg;this.lg=b;this.Bi--;break}b.ik=!(f.mah.ma&&f.nah.na&&f.oah.oa);break}b=e}},Gm:function(a,b){var e=a.Yb,c=b.Yb;if(e==c||0!=e.Lb&&0!=c.Lb||!(a.Tj&b.Uj&&b.Tj&a.Uj))return!1;e.khG.sleepingTimeThreshold&&(b.Gb=!0,b.yb=0)):b.yb=0;if(!b.Gb){if(0==b.Lb){var e=a*b.$j,c=e*e,e=1/(1+e+c*(.5+.16666666666666666*e+.041666666666666664*c)),c=a*b.Qj,d=c*c,c=1/(1+c+d*(.5+.16666666666666666*c+.041666666666666664*d)),f,h,l,d=this.nm*b.eh;f=this.om*b.eh;h=this.pm*b.eh;d+=b.Mh*b.$a;f+=b.Nh*b.$a;h+=b.Oh*b.$a;var g,k;g=b.P*b.vf+b.R*b.wf+b.S*b.xf;k=b.T*b.vf+b.U*b.wf+b.V*b.xf;l=b.W*b.vf+b.X*b.wf+b.Y*b.xf;b.gb+=d*a;b.hb+=f*a;b.ib+=h*a;b.gb*=e;b.hb*=e;b.ib*=e;b.kb+=g*a;b.lb+=k*a;b.mb+=l*a;b.kb*=c;b.lb*=c;b.mb*=c}b.Wl(a);for(a=b.Dc;null!=a;){e=a.M;c=a.pa;f=a.ha;var d=b.pa,m,n,q,p,r;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;n=d.i*f.h+d.m*f.j+d.j*f.s;q=d.l*f.o+d.g*f.i+d.s*f.l;p=d.l*f.f+d.g*f.m+d.s*f.g;r=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;c=a.a;f=a.ha;d=b.a;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;n=d.i*f.h+d.m*f.j+d.j*f.s;q=d.l*f.o+d.g*f.i+d.s*f.l;p=d.l*f.f+d.g*f.m+d.s*f.g;r=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;a.Kb.Nb(a.u,a.pa);c=a.u.ma;d=a.u.na;f=a.u.oa;h=a.u.ja;l=a.u.ka;g=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=ca.u.ja?h:a.u.ja;a.u.ka=l>a.u.ka?l:a.u.ka;a.u.la=g>a.u.la?g:a.u.la;null!=a.tb&&(c=a.a.v-a.pa.v,d=a.a.A-a.pa.A,f=a.a.B-a.pa.B,h=a.rc,h.x=c,h.y=d,h.z=f,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=e}}},fn:function(a,b,e){for(var c=a.dt,d=!0,f=0,h=this.Hf;fba.u.ja?lb:ba.u.ja;ba.u.ka=yb>ba.u.ka?yb:ba.u.ka;ba.u.la=mb>ba.u.la?mb:ba.u.la;if(null!=ba.tb){var ub,x,W;ub=ba.a.v-ba.pa.v;x=ba.a.A-ba.pa.A;W=ba.a.B-ba.pa.B;var ea=ba.rc;ea.x=ub;ea.y=x;ea.z=W;ba.Yb.oc.jc.wd(ba.tb,ba.u,ba.rc)}ba=Va}}}};Ma.prototype={gl:function(){var a=(new Date).getTime()/1E3;this.Kh.gl();Ad.broadPhaseCollisionTime=1E3*((new Date).getTime()/1E3-a);for(var a=(new Date).getTime()/1E3,b=this.Kh.zd;null!=b;){var e=b.M;b.ik||b.hn();b=e}Ad.narrowPhaseCollisionTime=1E3*((new Date).getTime()/1E3-a)},en:function(){var a=(new Date).getTime()/1E3;if(G.disableSleeping)for(var b=this.uf;null!=b;){var e=b.M;b.Gb=!1;b.yb=0;b=e}if(this.ph.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var d=this.Ga,f=0==d.c?new t:d.b[--d.c],d=this.Ga,d=0==d.c?new t:d.b[--d.c];f.x=b.J;f.y=b.K;f.z=b.L;d.x=b.G;d.y=b.H;d.z=b.I;a.aabb(f,d,c);var h=this.Ga;if(null!=f){f.Z();if(h.c==h.b.length){for(var l=Array(h.c<<1),g=0,k=h.c;gG.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2:e.Gb?b.sleepingShapeColor1:e.yb>G.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1);if(a.drawShapes){var k=l.Kb,m=l.a;switch(k.Lb){case 0:a.sphere(m,k.ab,f);break;case 1:var n=k,q=this.Ga,p=0==q.c?new t:q.b[--q.c],r=p;r.x=n.Ke;r.y=n.Le;r.z=n.Me;a.box(m,p,f);var v=this.Ga;if(null!=p){p.Z();if(v.c==v.b.length){for(var R=Array(v.c<<1),y=0,L=v.c;yl?a.ellipse(b,e,c,f,f,g):a.arc(b,e,c,f,f,h,l,!0,g)},Tl:function(a,b,e,c,d,f){if(cr;){var v=r++,R=Math.cos(k)*f,y=Math.sin(k)*h,L=Math.sqrt(R*R+y*y),w=Math.sin(.5*L),D=Math.cos(.5*L),Sa=n.Z(),B=Sa.y+c.y*R,C=Sa.z+c.z*R;Sa.x=Sa.x+c.x*R;Sa.y=B;Sa.z=C;R=Sa;Sa=R.y+d.y*y;B=R.z+d.z*y;R.x=R.x+d.x*y;R.y=Sa;R.z=B;y=1/L*w;L=n.y*y;w=n.z*y;n.x=n.x*y;n.y=L;n.z=w;q.x=n.x;q.y=n.y;q.z=n.z;q.w=D;var A=q.x,C=q.y,R=q.z,L=q.w,G=2*A,B=2*C,w=2*R,D=A*G,y=C*B,R=R*w,Sa=A*B,C=C*w,A=A*w,G=L*G,B=L*B,L=L*w;p.e00=1-y-R;p.e01=Sa-L;p.e02=A+B;p.e10=Sa+L;p.e11=1-D-R;p.e12=C-G;p.e20=A-B;p.e21=C+G;p.e22=1-D-y;D=this.Ga;D=0==D.c?new t:D.b[--D.c];y=D.y+e.y*l;L=D.z+e.z*l;D.x=D.x+e.x*l;D.y=y;D.z=L;y=D.x*p.e10+D.y*p.e11+D.z*p.e12;L=D.x*p.e20+D.y*p.e21+D.z*p.e22;D.x=D.x*p.e00+D.y*p.e01+D.z*p.e02;D.y=y;D.z=L;y=D;L=y.y+b.y;w=y.z+b.z;y.x=y.x+b.x;y.y=L;y.z=w;1<=v&&a.line(m,D,g);v=this.Ga;if(null!=m){m.Z();if(v.c==v.b.length){y=Array(v.c<<1);L=0;for(w=v.c;Lb||5this.u.ma&&b.nathis.u.na&&b.oathis.u.oa&&this.Ql.process(a)}});yl.prototype={process:function(){}};fl.prototype={beginContact:function(){},preSolve:function(){},postSolve:function(){},endContact:function(){}};ej.prototype={process:function(){}};hf.ua=ej;hf.prototype=cb(ej.prototype,{clear:function(){this.shape=null;this.fraction=1;this.position.Z();this.normal.Z();this.hit=!1},process:function(a,b){if(b.fractiond&&(d=-d);(k=d/.5235987755982984+.5|0)||(k=1);d=f;f=(h-f)/k;h=this.p;h=0==h.c?new t:h.b[--h.c];h.x=a.x;h.y=a.y;h.z=a.z;c=Math.cos(d);var m=h.y+b.y*c,n=h.z+b.z*c;h.x+=b.x*c;h.y=m;h.z=n;c=Math.sin(d);m=h.y+e.y*c;n=h.z+e.z*c;h.x+=e.x*c;h.y=m;h.z=n;l&&this.line(a,h,g);for(c=0;cga;){var P=ga++,za=this.Te[P],xb=this.yj[P];za.x=xb.x;za.y=xb.y;za.z=xb.z;var ja=za,Xa=ja.y*ba,Wa=ja.z*ba;ja.x=ja.x*ba;ja.y=Xa;ja.z=Wa;ja.y+=Va;var gb=this.Te[P],pb=gb.x*p.e10+gb.y*p.e11+gb.z*p.e12,ua=gb.x*p.e20+gb.y*p.e21+gb.z*p.e22;gb.x=gb.x*p.e00+gb.y*p.e01+gb.z*p.e02;gb.y=pb;gb.z=ua;var xa=this.fe[P],Fa=this.dm[P];xa.x=Fa.x;xa.y=Fa.y;xa.z=Fa.z;var fb=xa,Ha=fb.y*ba,qb=fb.z*ba;fb.x=fb.x*ba;fb.y=Ha;fb.z=qb;fb.y+=Va;var Na=this.fe[P],la=Na.x*p.e10+Na.y*p.e11+Na.z*p.e12,Ca=Na.x*p.e20+Na.y*p.e21+Na.z*p.e22;Na.x=Na.x*p.e00+Na.y*p.e01+Na.z*p.e02;Na.y=la;Na.z=Ca;var Za=this.Xd[P],Ra=this.yj[P];Za.x=Ra.x;Za.y=Ra.y;Za.z=Ra.z;var ib=Za,Lb=ib.x*p.e10+ib.y*p.e11+ib.z*p.e12,db=ib.x*p.e20+ib.y*p.e21+ib.z*p.e22;ib.x=ib.x*p.e00+ib.y*p.e01+ib.z*p.e02;ib.y=Lb;ib.z=db;var Ib=ib,kb=Ib.y*b,nb=Ib.z*b;Ib.x=Ib.x*b;Ib.y=kb;Ib.z=nb;var Yb=Ib,sc=Yb.y+n.y,$a=Yb.z+n.z;Yb.x=Yb.x+n.x;Yb.y=sc;Yb.z=$a;var Ka=this.Xd[P],vb=-e,H=Ka.y+l.y*vb,eb=Ka.z+l.z*vb;Ka.x=Ka.x+l.x*vb;Ka.y=H;Ka.z=eb}for(var lb=0;8>lb;){var yb=lb++,mb=v,ub=this.Xd[yb],x=this.Xd[(yb+1)%8],W=this.fe[yb];this.triangle(mb,ub,x,W,this.Te[yb],this.Te[(yb+1)%8],c);var mb=w,ub=this.Xd[(yb+1)%8],x=this.Xd[yb],ea=this.p,Nc=0==ea.c?new t:ea.b[--ea.c];Nc.x=l.x;Nc.y=l.y;Nc.z=l.z;var xc=Nc,Pa=-xc.y,rb=-xc.z;xc.x=-xc.x;xc.y=Pa;xc.z=rb;W=xc;this.triangle(mb,ub,x,W,W,W,c);var ob=this.p;if(null!=W){W.Z();if(ob.c==ob.b.length){for(var zb=Array(ob.c<<1),Ab=0,ia=ob.c;Abrb;){var ob=rb++,zb=this.Te[ob],Ab=this.yj[ob];zb.x=Ab.x;zb.y=Ab.y;zb.z=Ab.z;var ia=zb,Ta=ia.x*p.e10+ia.y*p.e11+ia.z*p.e12,bb=ia.x*p.e20+ia.y*p.e21+ia.z*p.e22;ia.x=ia.x*p.e00+ia.y*p.e01+ia.z*p.e02;ia.y=Ta;ia.z=bb;var jb=this.fe[ob],Bb=this.Te[ob];jb.x=Bb.x;jb.y=Bb.y;jb.z=Bb.z;var La=jb,Eb=La.y*b,Wa=La.z*b;La.x=La.x*b;La.y=Eb;La.z=Wa;var qa=La,Bc=qa.y+n.y,Mb=qa.z+n.z;qa.x=qa.x+n.x;qa.y=Bc;qa.z=Mb;var Sb=this.Xd[ob],ab=this.fe[ob];Sb.x=ab.x;Sb.y=ab.y;Sb.z=ab.z;var cb=this.fe[ob],tb=cb.y+l.y*e,Zb=cb.z+l.z*e;cb.x=cb.x+l.x*e;cb.y=tb;cb.z=Zb;var hb=this.Xd[ob],Cb=-e,wb=hb.y+l.y*Cb,Hb=hb.z+l.z*Cb;hb.x=hb.x+l.x*Cb;hb.y=wb;hb.z=Hb}for(var Ub=0;8>Ub;){var gc=Ub++,fc=v,Pb=this.fe[gc],cc=this.fe[(gc+1)%8],Fb=l;this.triangle(fc,Pb,cc,Fb,Fb,Fb,c);var fc=w,Pb=this.Xd[(gc+1)%8],cc=this.Xd[gc],lc=this.p,bc=0==lc.c?new t:lc.b[--lc.c];bc.x=l.x;bc.y=l.y;bc.z=l.z;var Qb=bc,dc=-Qb.y,Vb=-Qb.z;Qb.x=-Qb.x;Qb.y=dc;Qb.z=Vb;Fb=Qb;this.triangle(fc,Pb,cc,Fb,Fb,Fb,c);var Nb=this.p;if(null!=Fb){Fb.Z();if(Nb.c==Nb.b.length){for(var Tb=Array(Nb.c<<1),sb=0,Jb=Nb.c;sbR;)for(var y=R++,L=0,w=this.Fh[y].length;LI;){var J=I++;if(!J)for(var u=0;3>u;)for(var O=u++,V=0,da=this.Fh[O].length;Voa;)for(var Ya=oa++,F=0,Qa=this.Fh[Ya].length;Fra;){var ka=ra++,Z,na,Aa,ya,K,Ba,ha,ba;J?3==J?this.wireframe?(Z=r[4][0],na=r[J][(ka+1)%8],Aa=r[J][ka],this.line(Z,na,c),this.line(na,Aa,c)):(Z=r[4][0],na=r[J][(ka+1)%8],Aa=r[J][ka],K=v[4][0],Ba=v[J][(ka+1)%8],ha=v[J][ka],this.triangle(Z,na,Aa,K,Ba,ha,c)):this.wireframe?(Z=r[J][ka],na=r[J][(ka+1)%8],Aa=r[J+1][ka],this.line(Z,na,c),this.line(Z,Aa,c)):(Z=r[J][ka],na=r[J][(ka+1)%8],Aa=r[J+1][ka],ya=r[J+1][(ka+1)%8],K=v[J][ka],Ba=v[J][(ka+1)%8],ha=v[J+1][ka],ba=v[J+1][(ka+1)%8],this.rect(Z,Aa,ya,na,K,ha,ba,Ba,c)):this.wireframe?(Z=r[0][0],na=r[1][ka],this.line(Z,na,c)):(Z=r[0][0],na=r[1][ka],Aa=r[1][(ka+1)%8],K=v[0][0],Ba=v[1][ka],ha=v[1][(ka+1)%8],this.triangle(Z,na,Aa,K,Ba,ha,c))}}var Va=this.p,ga=0==Va.c?new t:Va.b[--Va.c];ga.x=n.x;ga.y=n.y;ga.z=n.z;var P=ga.y+l.y*e,za=ga.z+l.z*e;ga.x+=l.x*e;ga.y=P;ga.z=za;var xb=this.p,ja=0==xb.c?new t:xb.b[--xb.c];ja.x=n.x;ja.y=n.y;ja.z=n.z;var Ja=-e,Oa=ja.y+l.y*Ja,gb=ja.z+l.z*Ja;ja.x+=l.x*Ja;ja.y=Oa;ja.z=gb;if(this.wireframe){var pb=this.p,ua=0==pb.c?new t:pb.b[--pb.c];ua.x=ga.x;ua.y=ga.y;ua.z=ga.z;var xa=-b,Fa=ua.y+f.y*xa,fb=ua.z+f.z*xa;ua.x+=f.x*xa;ua.y=Fa;ua.z=fb;var Ha=ua.y+0*k.y,qb=ua.z+0*k.z;ua.x+=0*k.x;ua.y=Ha;ua.z=qb;var Na=this.p,la=0==Na.c?new t:Na.b[--Na.c];la.x=ga.x;la.y=ga.y;la.z=ga.z;var Ca=la.y+f.y*b,Za=la.z+f.z*b;la.x+=f.x*b;la.y=Ca;la.z=Za;var Ra=la.y+0*k.y,ib=la.z+0*k.z;la.x+=0*k.x;la.y=Ra;la.z=ib;var Lb=this.p,db=0==Lb.c?new t:Lb.b[--Lb.c];db.x=ga.x;db.y=ga.y;db.z=ga.z;var Ib=db.y+0*f.y,kb=db.z+0*f.z;db.x+=0*f.x;db.y=Ib;db.z=kb;var nb=-b,Yb=db.y+k.y*nb,sc=db.z+k.z*nb;db.x+=k.x*nb;db.y=Yb;db.z=sc;var $a=this.p,Ka=0==$a.c?new t:$a.b[--$a.c];Ka.x=ga.x;Ka.y=ga.y;Ka.z=ga.z;var vb=Ka.y+0*f.y,H=Ka.z+0*f.z;Ka.x+=0*f.x;Ka.y=vb;Ka.z=H;var eb=Ka.y+k.y*b,lb=Ka.z+k.z*b;Ka.x+=k.x*b;Ka.y=eb;Ka.z=lb;var yb=this.p,mb=0==yb.c?new t:yb.b[--yb.c];mb.x=ja.x;mb.y=ja.y;mb.z=ja.z;var ub=-b,x=mb.y+f.y*ub,W=mb.z+f.z*ub;mb.x+=f.x*ub;mb.y=x;mb.z=W;var ea=mb.y+0*k.y,Xa=mb.z+0*k.z;mb.x+=0*k.x;mb.y=ea;mb.z=Xa;var xc=this.p,Pa=0==xc.c?new t:xc.b[--xc.c];Pa.x=ja.x;Pa.y=ja.y;Pa.z=ja.z;var rb=Pa.y+f.y*b,ob=Pa.z+f.z*b;Pa.x+=f.x*b;Pa.y=rb;Pa.z=ob;var zb=Pa.y+0*k.y,Ab=Pa.z+0*k.z;Pa.x+=0*k.x;Pa.y=zb;Pa.z=Ab;var ia=this.p,Ta=0==ia.c?new t:ia.b[--ia.c];Ta.x=ja.x;Ta.y=ja.y;Ta.z=ja.z;var bb=Ta.y+0*f.y,jb=Ta.z+0*f.z;Ta.x+=0*f.x;Ta.y=bb;Ta.z=jb;var Bb=-b,La=Ta.y+k.y*Bb,Eb=Ta.z+k.z*Bb;Ta.x+=k.x*Bb;Ta.y=La;Ta.z=Eb;var Wa=this.p,qa=0==Wa.c?new t:Wa.b[--Wa.c];qa.x=ja.x;qa.y=ja.y;qa.z=ja.z;var Bc=qa.y+0*f.y,Mb=qa.z+0*f.z;qa.x+=0*f.x;qa.y=Bc;qa.z=Mb;var Sb=qa.y+k.y*b,cb=qa.z+k.z*b;qa.x+=k.x*b;qa.y=Sb;qa.z=cb;this.ellipse(ga,f,k,b,b,c);this.ellipse(ja,f,k,b,b,c);this.line(ua,mb,c);this.line(la,Pa,c);this.line(db,Ta,c);this.line(Ka,qa,c);var ab=this.p;if(null!=ua){ua.Z();if(ab.c==ab.b.length){for(var hb=Array(ab.c<<1),Zb=0,tb=ab.c;Zbmc;){var Wb=mc++,nc=this.Te[Wb],Rb=this.yj[Wb];nc.x=Rb.x;nc.y=Rb.y;nc.z=Rb.z;var Oc=nc,ec=Oc.x*p.e10+Oc.y*p.e11+Oc.z*p.e12,vc=Oc.x*p.e20+Oc.y*p.e21+Oc.z*p.e22;Oc.x=Oc.x*p.e00+Oc.y*p.e01+Oc.z*p.e02;Oc.y=ec;Oc.z=vc;var Ec=this.fe[Wb],rc=this.Te[Wb];Ec.x=rc.x;Ec.y=rc.y;Ec.z=rc.z;var hc=Ec,Gc=hc.y*b,Tc=hc.z*b;hc.x=hc.x*b;hc.y=Gc;hc.z=Tc;var Pc=hc,ad=Pc.y+n.y,fd=Pc.z+n.z;Pc.x=Pc.x+n.x;Pc.y=ad;Pc.z=fd;var Xc=this.Xd[Wb],Uc=this.fe[Wb];Xc.x=Uc.x;Xc.y=Uc.y;Xc.z=Uc.z;var Mc=this.fe[Wb],zd=Mc.y+l.y*e,Ad=Mc.z+l.z*e;Mc.x=Mc.x+l.x*e;Mc.y=zd;Mc.z=Ad;var ed=this.Xd[Wb],yd=-e,Ud=ed.y+l.y*yd,Wc=ed.z+l.z*yd;ed.x=ed.x+l.x*yd;ed.y=Ud;ed.z=Wc}for(var Qc=0;8>Qc;){var Dc=Qc++,Lc=this.Te[Dc],yc=this.Te[(Dc+1)%8];this.rect(this.fe[Dc],this.Xd[Dc],this.Xd[(Dc+1)%8],this.fe[(Dc+1)%8],Lc,Lc,yc,yc,c)}}var uc=this.p;if(null!=ga){ga.Z();if(uc.c==uc.b.length){for(var sd=Array(uc.c<<1),Sd=0,be=uc.c;Sdh;)for(var l=h++,g=0,k=this.Fh[l].length;gb;)for(h=b++,l=0;8>l;){var r=l++,v;h?3==h?this.wireframe?(g=a[4][0],k=a[h][(r+1)%8],m=a[h][r],this.line(g,k,e),this.line(k,m,e)):(g=a[4][0],k=a[h][(r+1)%8],m=a[h][r],q=f[4][0],p=f[h][(r+1)%8],v=f[h][r],this.triangle(g,k,m,q,p,v,e)):this.wireframe?(g=a[h][r],k=a[h][(r+1)%8],m=a[h+1][r],this.line(g,k,e),this.line(g,m,e)):(g=a[h][r],k=a[h][(r+1)%8],m=a[h+1][r],n=a[h+1][(r+1)%8],q=f[h][r],p=f[h][(r+1)%8],v=f[h+1][r],r=f[h+1][(r+1)%8],this.rect(g,m,n,k,q,v,r,p,e)):this.wireframe?(g=a[0][0],k=a[1][r],this.line(g,k,e)):(g=a[0][0],k=a[1][r],m=a[1][(r+1)%8],q=f[0][0],p=f[1][r],v=f[1][(r+1)%8],this.triangle(g,k,m,q,p,v,e))}e=this.p;if(null!=d){d.Z();if(e.c==e.b.length){a=Array(e.c<<1);f=0;for(b=e.c;fv.Gc)v.lf=!0,v=v.ae,v.bd=0,v.zc=0,v.yc=0,v.ub=0,v.df=0,v.ef=0,v.ff=0;else{v.lf=!1;var R=b.rows[b.Ka++];R.friction=n;R.Ma=0;var y=R.Ng;y.va=e;y.wa=c;y.xa=d;y.Ba=e;y.Ca=c;y.Da=d;y.aa=v.Eb*d-v.Fb*c;y.ba=v.Fb*e-v.Db*d;y.ca=v.Db*c-v.Eb*e;y.ea=v.fc*d-v.gc*c;y.fa=v.gc*e-v.ec*d;y.ga=v.ec*c-v.fc*e;y=R.Lj;y.va=f;y.wa=h;y.xa=l;y.Ba=f;y.Ca=h;y.Da=l;y.aa=v.Eb*l-v.Fb*h;y.ba=v.Fb*f-v.Db*l;y.ca=v.Db*h-v.Eb*f;y.ea=v.fc*l-v.gc*h;y.fa=v.gc*f-v.ec*l;y.ga=v.ec*h-v.fc*f;y=R.Kj;y.va=g;y.wa=k;y.xa=m;y.Ba=g;y.Ca=k;y.Da=m;y.aa=v.Eb*m-v.Fb*k;y.ba=v.Fb*g-v.Db*m;y.ca=v.Db*k-v.Eb*g;y.ea=v.fc*m-v.gc*k;y.fa=v.gc*g-v.ec*m;y.ga=v.ec*k-v.fc*g;y=R.Ng;y=y.va*this.C.gb+y.wa*this.C.hb+y.xa*this.C.ib+(y.aa*this.C.kb+y.ba*this.C.lb+y.ca*this.C.mb)-(y.Ba*this.D.gb+y.Ca*this.D.hb+y.Da*this.D.ib+(y.ea*this.D.kb+y.fa*this.D.lb+y.ga*this.D.mb));R.Fa=y<-G.contactEnableBounceThreshold&&!v.Pe?-y*q:0;this.Hc==Hb.BAUMGARTE&&v.Gc>G.linearSlop&&(y=(v.Gc-G.linearSlop)*G.velocityBaumgarte*a.invDt,R.Fal.Fa&&(l.Fa=0);l.ta=h.ae}}},al:function(){this.Ja.Yl(this.pj,this.qj)},cb:function(){return this.Zb},Hb:function(){return this.$b},ua:function(){return this.Ja},sk:function(){for(var a=0,b=this.Ja.be;aG.contactPersistenceThreshold?this.Fm(a):(e+=this.Ja.wg*-d,c+=this.Ja.xg*-d,b+=this.Ja.yg*-d,e*e+c*c+b*b>G.contactPersistenceThreshold*G.contactPersistenceThreshold&&this.Fm(a))}},Fm:function(a){var b=--this.Ja.be;if(a!=b){var e=this.Ja.wc[a];this.Ja.wc[a]=this.Ja.wc[b];this.Ja.wc[b]=e}a=this.Ja.wc[b];a.mf=0;a.nf=0;a.pf=0;a.qf=0;a.rf=0;a.sf=0;a.Db=0;a.Eb=0;a.Fb=0;a.ec=0;a.fc=0;a.gc=0;a.Jd=0;a.Kd=0;a.Ld=0;a.Md=0;a.Nd=0;a.Od=0;a.Gc=0;b=a.ae;b.bd=0;b.zc=0;b.yc=0;b.ub=0;b.df=0;b.ef=0;b.ff=0;a.Pe=!1;a.lf=!1;a.Cc=-1},jn:function(a,b,e){var c=this.Ja.be;if(c==G.maxManifoldPoints){var c=this.Ja.wc[this.on(a,b,e)],d=a.position1;c.Jd=d.x;c.Kd=d.y;c.Ld=d.z;d=a.position2;c.Md=d.x;c.Nd=d.y;c.Od=d.z;c.Db=c.Jd-b.v;c.Eb=c.Kd-b.A;c.Fb=c.Ld-b.B;c.ec=c.Md-e.v;c.fc=c.Nd-e.A;c.gc=c.Od-e.B;var f,d=b.o*c.Db+b.i*c.Eb+b.l*c.Fb;f=b.f*c.Db+b.m*c.Eb+b.g*c.Fb;b=b.h*c.Db+b.j*c.Eb+b.s*c.Fb;c.mf=d;c.nf=f;c.pf=b;b=e.o*c.ec+e.i*c.fc+e.l*c.gc;d=e.f*c.ec+e.m*c.fc+e.g*c.gc;e=e.h*c.ec+e.j*c.fc+e.s*c.gc;c.qf=b;c.rf=d;c.sf=e;c.Gc=a.depth;e=c.ae;e.bd=0;e.zc=0;e.yc=0;e.ub=0;e.df=0;e.ef=0;e.ff=0;c.Cc=a.id;c.Pe=!1;c.lf=!1}else c=this.Ja.wc[c],d=a.position1,c.Jd=d.x,c.Kd=d.y,c.Ld=d.z,d=a.position2,c.Md=d.x,c.Nd=d.y,c.Od=d.z,c.Db=c.Jd-b.v,c.Eb=c.Kd-b.A,c.Fb=c.Ld-b.B,c.ec=c.Md-e.v,c.fc=c.Nd-e.A,c.gc=c.Od-e.B,d=b.o*c.Db+b.i*c.Eb+b.l*c.Fb,f=b.f*c.Db+b.m*c.Eb+b.g*c.Fb,b=b.h*c.Db+b.j*c.Eb+b.s*c.Fb,c.mf=d,c.nf=f,c.pf=b,b=e.o*c.ec+e.i*c.fc+e.l*c.gc,d=e.f*c.ec+e.m*c.fc+e.g*c.gc,e=e.h*c.ec+e.j*c.fc+e.s*c.gc,c.qf=b,c.rf=d,c.sf=e,c.Gc=a.depth,e=c.ae,e.bd=0,e.zc=0,e.yc=0,e.ub=0,e.df=0,e.ef=0,e.ff=0,c.Cc=a.id,c.Pe=!1,c.lf=!1,this.Ja.be++},on:function(a,b){var e=this.Ja.wc[0],c=this.Ja.wc[1],d=this.Ja.wc[2],f=this.Ja.wc[3],h=e.Gc,l=0;c.Gc>h&&(h=c.Gc,l=1);d.Gc>h&&(h=d.Gc,l=2);f.Gc>h&&(h=f.Gc,l=3);var g,k,m,n=a.position1;g=n.x;k=n.y;m=n.z;g-=b.v;k-=b.A;m-=b.B;var q=c.Db,p=c.Eb,r=c.Fb,v=d.Db,R=d.Eb,y=d.Fb,L=f.Db,w=f.Eb,D=f.Fb,t,B,C,A,u,I,J,G,E,O,da,V,S,Db,Ia,Da,ma,Q;t=v-q;B=R-p;C=y-r;A=g-L;u=k-w;I=m-D;J=L-q;G=w-p;E=D-r;O=g-v;da=k-R;V=m-y;S=g-q;Db=k-p;Ia=m-r;Da=L-v;ma=w-R;Q=D-y;var ta,Ga,Ea,Ua,va,oa,Ya,F,Qa;ta=B*I-C*u;Ga=C*A-t*I;Ea=t*u-B*A;Ua=G*V-E*da;va=E*O-J*V;oa=J*da-G*O;Ya=Db*Q-Ia*ma;F=Ia*Da-S*Q;Qa=S*ma-Db*Da;var X=ta*ta+Ga*Ga+Ea*Ea,M=Ua*Ua+va*va+oa*oa,N=Ya*Ya+F*F+Qa*Qa,ca=X>M?X>N?X:N:M>N?M:N,Y=e.Db,T=e.Eb,aa=e.Fb,z=d.Db,fa=d.Eb,U=d.Fb,pa=f.Db,sa=f.Eb,wa=f.Fb,ra,ka,Z,na,Aa,ya,K,Ba,ha,ba,Va,ga,P,za,xb,ja,Ja,Ma;ra=z-Y;ka=fa-T;Z=U-aa;na=g-pa;Aa=k-sa;ya=m-wa;K=pa-Y;Ba=sa-T;ha=wa-aa;ba=g-z;Va=k-fa;ga=m-U;P=g-Y;za=k-T;xb=m-aa;ja=pa-z;Ja=sa-fa;Ma=wa-U;var gb,pb,ua,xa,Fa,fb,Ha,qb,Na;gb=ka*ya-Z*Aa;pb=Z*na-ra*ya;ua=ra*Aa-ka*na;xa=Ba*ga-ha*Va;Fa=ha*ba-K*ga;fb=K*Va-Ba*ba;Ha=za*Ma-xb*Ja;qb=xb*ja-P*Ma;Na=P*Ja-za*ja;var la=gb*gb+pb*pb+ua*ua,Ca=xa*xa+Fa*Fa+fb*fb,Za=Ha*Ha+qb*qb+Na*Na,Ra=la>Ca?la>Za?la:Za:Ca>Za?Ca:Za,ib=e.Db,Lb=e.Eb,db=e.Fb,Ib=c.Db,kb=c.Eb,nb=c.Fb,Yb=f.Db,Oa=f.Eb,$a=f.Fb,Ka,vb,H,eb,lb,yb,mb,ub,x,W,ea,Xa,ab,Pa,rb,ob,zb,Ab;Ka=Ib-ib;vb=kb-Lb;H=nb-db;eb=g-Yb;lb=k-Oa;yb=m-$a;mb=Yb-ib;ub=Oa-Lb;x=$a-db;W=g-Ib;ea=k-kb;Xa=m-nb;ab=g-ib;Pa=k-Lb;rb=m-db;ob=Yb-Ib;zb=Oa-kb;Ab=$a-nb;var ia,Ta,bb,jb,Bb,La,Eb,Wa,qa;ia=vb*yb-H*lb;Ta=H*eb-Ka*yb;bb=Ka*lb-vb*eb;jb=ub*Xa-x*ea;Bb=x*W-mb*Xa;La=mb*ea-ub*W;Eb=Pa*Ab-rb*zb;Wa=rb*ob-ab*Ab;qa=ab*zb-Pa*ob;var cb=ia*ia+Ta*Ta+bb*bb,Mb=jb*jb+Bb*Bb+La*La,Sb=Eb*Eb+Wa*Wa+qa*qa,hb=cb>Mb?cb>Sb?cb:Sb:Mb>Sb?Mb:Sb,tb=e.Db,Cb=e.Eb,Zb=e.Fb,wb=c.Db,Jb=c.Eb,Kb=c.Fb,Hb=d.Db,Ub=d.Eb,gc=d.Fb,fc,Pb,cc,Fb,lc,bc,Qb,dc,Vb,Nb,Tb,sb,Wb,qc,Rb,Xb,jc,Hc;fc=wb-tb;Pb=Jb-Cb;cc=Kb-Zb;Fb=g-Hb;lc=k-Ub;bc=m-gc;Qb=Hb-tb;dc=Ub-Cb;Vb=gc-Zb;Nb=g-wb;Tb=k-Jb;sb=m-Kb;Wb=g-tb;qc=k-Cb;Rb=m-Zb;Xb=Hb-wb;jc=Ub-Jb;Hc=gc-Kb;var pc,Ob,ac,tc,$b,ic,kc,mc,nc;pc=Pb*bc-cc*lc;Ob=cc*Fb-fc*bc;ac=fc*lc-Pb*Fb;tc=dc*sb-Vb*Tb;$b=Vb*Nb-Qb*sb;ic=Qb*Tb-dc*Nb;kc=qc*Hc-Rb*jc;mc=Rb*Xb-Wb*Hc;nc=Wb*jc-qc*Xb;var oc=pc*pc+Ob*Ob+ac*ac,wc=tc*tc+$b*$b+ic*ic,hc=kc*kc+mc*mc+nc*nc,rc=oc>wc?oc>hc?oc:hc:wc>hc?wc:hc,ec=ca,vc=0;if(Ra>ec&&1!=l||!l)ec=Ra,vc=1;hb>ec&&2!=l&&(ec=hb,vc=2);rc>ec&&3!=l&&(ec=rc,vc=3);return vc},rn:function(a,b,e){for(var c=G.contactPersistenceThreshold*G.contactPersistenceThreshold,d=-1,f=0,h=this.Ja.be;fthis.Yi*this.Yi?this.oc.Kl(this):0this.Zi*this.Zi&&this.oc.Kl(this)},ue:function(){return this.C},Ue:function(){return this.D},Tg:function(){return this.Lb},cb:function(){var a=new t;a.x=this.Of;a.y=this.Pf;a.z=this.Qf;return a},Mb:function(){var a=new t;a.x=this.Rf;a.y=this.Sf;a.z=this.Tf;return a},Hb:function(a){a.x=this.Of;a.y=this.Pf;a.z=this.Qf},pc:function(a){a.x=this.Rf;a.y=this.Sf;a.z=this.Tf},pe:function(){var a=new t;a.x=this.dj;a.y=this.ej;a.z=this.fj;return a},re:function(){var a=new t;a.x=this.gj;a.y=this.hj;a.z=this.ij;return a},qe:function(a){a.x=this.dj;a.y=this.ej;a.z=this.fj},se:function(a){a.x=this.gj;a.y=this.hj;a.z=this.ij},Ec:function(){var a=new E,b,e,c,d,f,h,l,g,k;b=this.vb;e=this.He;c=this.Hh;d=this.wb;f=this.Ie;h=this.Ih;l=this.xb;g=this.Je;k=this.Jh;a.e00=b;a.e01=e;a.e02=c;a.e10=d;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Kc:function(){var a=new E,b,e,c,d,f,h,l,g,k;b=this.bc;e=this.ve;c=this.ah;d=this.cc;f=this.we;h=this.bh;l=this.dc;g=this.xe;k=this.dh;a.e00=b;a.e01=e;a.e02=c;a.e10=d;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Jc:function(a){var b,e,c,d,f,h,l,g,k;b=this.vb;e=this.He;c=this.Hh;d=this.wb;f=this.Ie;h=this.Ih;l=this.xb;g=this.Je;k=this.Jh;a.e00=b;a.e01=e;a.e02=c;a.e10=d;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},Lc:function(a){var b,e,c,d,f,h,l,g,k;b=this.bc;e=this.ve;c=this.ah;d=this.cc;f=this.we;h=this.bh;l=this.dc;g=this.xe;k=this.dh;a.e00=b;a.e01=e;a.e02=c;a.e10=d;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},ua:function(){return this.Ak},Ug:function(a){this.Ak=a},fd:function(){return this.Yi},Vg:function(a){this.Yi=a},Yd:function(){return this.Zi},Wg:function(a){this.Zi=a},te:function(){return this.Hc},Xg:function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.Hc=a},qc:function(){var a=new t;a.x=this.Pi;a.y=this.Qi;a.z=this.Ri;return a},uc:function(a){a.x=this.Pi;a.y=this.Qi;a.z=this.Ri},vc:function(){var a=new t;a.x=this.Si;a.y=this.Ti;a.z=this.Ui;return a},Ac:function(a){a.x=this.Si;a.y=this.Ti;a.z=this.Ui},Mf:function(){return this.ia},Ve:function(){return this.M}};Cb.ua=V;Cb.prototype=cb(V.prototype,{Ud:function(a,b,e){var c=e?1:this.Hc==Hb.BAUMGARTE?b.invDt*G.velocityBaumgarte:0,d=this.Df*c,f=this.Ef*c,h=this.Ee*c,c=this.Fe*c,l,g,k,m,n,q,p,r,v,t,y,L;l=-this.Ub;g=this.Tb;k=this.Ub;m=-this.Sb;n=-this.Tb;q=this.Sb;p=-this.Xb;r=this.Wb;v=this.Xb;t=-this.Vb;y=-this.Wb;L=this.Vb;var w,D=1/(this.C.$a+this.D.$a),Sa=this.da.cd,B=this.da.dd,C=this.da.ed,A=(this.C.P*Sa+this.C.R*B+this.C.S*C)*Sa+(this.C.T*Sa+this.C.U*B+this.C.V*C)*B+(this.C.W*Sa+this.C.X*B+this.C.Y*C)*C;w=(this.D.P*Sa+this.D.R*B+this.D.S*C)*Sa+(this.D.T*Sa+this.D.U*B+this.D.V*C)*B+(this.D.W*Sa+this.D.X*B+this.D.Y*C)*C;if(0=this.dl.frequency||!e){w=this.Pb[0];Sa=a.rows[a.Ka++];B=Sa.Aa;B.va=0;B.wa=0;B.xa=0;B.Ba=0;B.Ca=0;B.Da=0;B.aa=0;B.ba=0;B.ca=0;B.ea=0;B.fa=0;B.ga=0;Sa.Fa=0;Sa.Ma=0;Sa.Ia=0;Sa.Ha=0;Sa.motorSpeed=0;Sa.fb=0;Sa.ta=null;Sa.ta=w;w=Sa;var Sa=this.eg,u=this.cl,C=this.dl,I,B=G.linearSlop;if(e)C=0,I=1;else{if(0O?Sa=J=u=0:E==O?(u=-1/0,J=1/0,Sa-=E):SaO?(u=0,J=1/0,Sa=Sa-O-B,0>Sa&&(Sa=0)):Sa=J=u=0;w.Ia=u;w.Ha=J;w.Ma=C*(D?1/D:0);w.Fa=Sa*I;w=w.Aa;w.va=this.da.cd;w.wa=this.da.dd;w.xa=this.da.ed;w.Ba=this.da.cd;w.Ca=this.da.dd;w.Da=this.da.ed;w.aa=-0;w.ba=-l;w.ca=-g;w.ea=-0;w.fa=-p;w.ga=-r}w=this.Pb[1];l=a.rows[a.Ka++];g=l.Aa;g.va=0;g.wa=0;g.xa=0;g.Ba=0;g.Ca=0;g.Da=0;g.aa=0;g.ba=0;g.ca=0;g.ea=0;g.fa=0;g.ga=0;l.Fa=0;l.Ma=0;l.Ia=0;l.Ha=0;l.motorSpeed=0;l.fb=0;l.ta=w;w=l;w.Fa=d;w.Ma=0;w.Ia=-1/0;w.Ha=1/0;w=w.Aa;w.va=this.da.Qd;w.wa=this.da.Rd;w.xa=this.da.Sd;w.Ba=this.da.Qd;w.Ca=this.da.Rd;w.Da=this.da.Sd;w.aa=-k;w.ba=-0;w.ca=-m;w.ea=-v;w.fa=-0;w.ga=-t;d=this.Pb[2];w=a.rows[a.Ka++];k=w.Aa;k.va=0;k.wa=0;k.xa=0;k.Ba=0;k.Ca=0;k.Da=0;k.aa=0;k.ba=0;k.ca=0;k.ea=0;k.fa=0;k.ga=0;w.Fa=0;w.Ma=0;w.Ia=0;w.Ha=0;w.motorSpeed=0;w.fb=0;w.ta=d;w.Fa=f;w.Ma=0;w.Ia=-1/0;w.Ha=1/0;w=w.Aa;w.va=this.da.me;w.wa=this.da.ne;w.xa=this.da.oe;w.Ba=this.da.me;w.Ca=this.da.ne;w.Da=this.da.oe;w.aa=-n;w.ba=-q;w.ca=-0;w.ea=-y;w.fa=-L;w.ga=-0;if(0>=this.Xk.frequency||!e)f=this.Pb[3],n=a.rows[a.Ka++],q=n.Aa,q.va=0,q.wa=0,q.xa=0,q.Ba=0,q.Ca=0,q.Da=0,q.aa=0,q.ba=0,q.ca=0,q.ea=0,q.fa=0,q.ga=0,n.Fa=0,n.Ma=0,n.Ia=0,n.Ha=0,n.motorSpeed=0,n.fb=0,n.ta=f,w=n,f=this.angle,q=this.Wk,y=this.Xk,n=G.angularSlop,e?(e=0,y=1):(0q?b=d=L=0:b==q?(L=-1/0,d=1/0,b=f-b):fq?(L=0,d=1/0,b=f-q-n,0>b&&(b=0)):b=d=L=0,w.Ia=L,w.Ha=d,w.Ma=e*(A?1/A:0),w.Fa=b*y,w=w.Aa,w.aa=this.da.cd,w.ba=this.da.dd,w.ca=this.da.ed,w.ea=this.da.cd,w.fa=this.da.dd,w.ga=this.da.ed;b=this.Pb[4];A=a.rows[a.Ka++];e=A.Aa;e.va=0;e.wa=0;e.xa=0;e.Ba=0;e.Ca=0;e.Da=0;e.aa=0;e.ba=0;e.ca=0;e.ea=0;e.fa=0;e.ga=0;A.Fa=0;A.Ma=0;A.Ia=0;A.Ha=0;A.motorSpeed=0;A.fb=0;A.ta=b;w=A;w.Fa=h;w.Ma=0;w.Ia=-1/0;w.Ha=1/0;w=w.Aa;w.aa=this.da.Qd;w.ba=this.da.Rd;w.ca=this.da.Sd;w.ea=this.da.Qd;w.fa=this.da.Rd;w.ga=this.da.Sd;h=this.Pb[5];a=a.rows[a.Ka++];b=a.Aa;b.va=0;b.wa=0;b.xa=0;b.Ba=0;b.Ca=0;b.Da=0;b.aa=0;b.ba=0;b.ca=0;b.ea=0;b.fa=0;b.ga=0;a.Fa=0;a.Ma=0;a.Ia=0;a.Ha=0;a.motorSpeed=0;a.fb=0;a.ta=h;w=a;w.Fa=c;w.Ma=0;w.Ia=-1/0;w.Ha=1/0;w=w.Aa;w.aa=this.da.me;w.ba=this.da.ne;w.ca=this.da.oe;w.ea=this.da.me;w.fa=this.da.ne;w.ga=this.da.oe},hd:function(){V.prototype.hd.call(this);var a=this.da,b=a.$.C.$a,e=a.$.D.$a,c,d,f,h,l,g,k,m,n,q,p,r,v,t,y,L,w,D,Sa,B,C,A,u,I,J,G,E,O,da,S,ta=a.$.vb*a.$.bc+a.$.wb*a.$.cc+a.$.xb*a.$.dc;if(-.999999999>ta){var Db,Ia,Da,ma=a.$.vb,Q=a.$.wb,Ja=a.$.xb,Ga=ma*ma,Ea=Q*Q,Ua=Ja*Ja,va;Gafa&&(fa=-fa,Y=-Y,T=-T,aa=-aa,z=-z);if(.999999fb){var Ha,qb,Na,la=J*J,Ca=G*G,Za=E*E,Ra;la=Bb?3.14159265358979:1<=Bb?0:Math.acos(Bb),Eb=Ta*Ta+bb*bb+jb*jb;0=Bb?3.14159265358979:1<=Bb?0:Math.acos(Bb);0>cb*this.da.cd+qa*this.da.dd+tb*this.da.ed&&(this.angle=-this.angle);var Mb,Sb,hb;Mb=this.Rf-this.Of;Sb=this.Sf-this.Pf;hb=this.Tf-this.Qf;this.eg=Mb*this.da.cd+Sb*this.da.dd+hb*this.da.ed;this.Df=Mb*this.da.Qd+Sb*this.da.Rd+hb*this.da.Sd;this.Ef=Mb*this.da.me+Sb*this.da.ne+hb*this.da.oe},$d:function(a,b){V.prototype.$d.call(this,a,b);this.Ud(b,a,!1)},gd:function(a){V.prototype.gd.call(this,a);this.Ud(a,null,!0)},Eg:function(){var a=new t;a.x=this.vb;a.y=this.wb;a.z=this.xb;return a},Gg:function(){var a=new t;a.x=this.bc;a.y=this.cc;a.z=this.dc;return a},Fg:function(a){a.x=this.vb;a.y=this.wb;a.z=this.xb},Hg:function(a){a.x=this.bc;a.y=this.cc;a.z=this.dc},Ig:function(){var a=new t;a.x=this.qa;a.y=this.ra;a.z=this.sa;return a},Kg:function(){var a=new t;a.x=this.nb;a.y=this.ob;a.z=this.pb;return a},Jg:function(a){a.x=this.qa;a.y=this.ra;a.z=this.sa},Lg:function(a){a.x=this.nb;a.y=this.ob;a.z=this.pb},In:function(){return this.dl},An:function(){return this.Xk},Hn:function(){return this.cl},zn:function(){return this.Wk},ol:function(){return this.angle},rl:function(){return this.eg}});kc.prototype={fh:function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var c=this.rigidBody1,d,f,h;d=e.x;f=e.y;h=e.z;d-=c.a.v;f-=c.a.A;h-=c.a.B;a=c.a.o*d+c.a.i*f+c.a.l*h;b=c.a.f*d+c.a.m*f+c.a.g*h;c=c.a.h*d+c.a.j*f+c.a.s*h;d=this.localAnchor1;d.x=a;d.y=b;d.z=c;b=this.rigidBody2;c=e.x;d=e.y;f=e.z;c-=b.a.v;d-=b.a.A;f-=b.a.B;e=b.a.o*c+b.a.i*d+b.a.l*f;a=b.a.f*c+b.a.m*d+b.a.g*f;b=b.a.h*c+b.a.j*d+b.a.s*f;c=this.localAnchor2;c.x=e;c.y=a;c.z=b}};Ge.ua=kc;Ge.prototype=cb(kc.prototype,{za:function(a,b,e,c){this.fh(a,b,e);var d,f,h;d=c.x;f=c.y;h=c.z;var l;e=a.a.o*d+a.a.i*f+a.a.l*h;l=a.a.f*d+a.a.m*f+a.a.g*h;a=a.a.h*d+a.a.j*f+a.a.s*h;d=this.localAxis1;d.x=e;d.y=l;d.z=a;l=c.x;a=c.y;d=c.z;c=b.a.o*l+b.a.i*a+b.a.l*d;e=b.a.f*l+b.a.m*a+b.a.g*d;b=b.a.h*l+b.a.j*a+b.a.s*d;l=this.localAxis2;l.x=c;l.y=e;l.z=b;return this}});Xc.prototype={ua:function(){return this.Pk},Hb:function(){return this.Qc},Mb:function(){return this.ia},cb:function(){return this.M}};Kb.ua=V;Kb.prototype=cb(V.prototype,{Ud:function(a,b,e){var c=e?1:this.Hc==Hb.BAUMGARTE?b.invDt*G.velocityBaumgarte:0,d=this.Df*c,f=this.Ef*c,h=this.rh*c,l=this.Ee*c,c=this.Fe*c,g,k,m,n,q,p,r,v,t,y,L,w;g=-this.Ub;k=this.Tb;m=this.Ub;n=-this.Sb;q=-this.Tb;p=this.Sb;r=-this.Xb;v=this.Wb;t=this.Xb;y=-this.Vb;L=-this.Wb;w=this.Vb;var D,u;u=1/(this.C.$a+this.D.$a);if(0>=this.Ce.frequency||!e){D=this.Pb[0];var B=a.rows[a.Ka++],C=B.Aa;C.va=0;C.wa=0;C.xa=0;C.Ba=0;C.Ca=0;C.Da=0;C.aa=0;C.ba=0;C.ca=0;C.ea=0;C.fa=0;C.ga=0;B.Fa=0;B.Ma=0;B.Ia=0;B.Ha=0;B.motorSpeed=0;B.fb=0;B.ta=D;D=B;var B=this.eg,A=this.Rh,E=this.Ce,C=G.linearSlop;if(e)E=0,e=1;else{if(0I?b=J=A=0:b==I?(A=-1/0,J=1/0,b=B-b):BI?(A=0,J=1/0,b=B-I-C,0>b&&(b=0)):b=J=A=0;D.Ia=A;D.Ha=J;D.Ma=E*(u?1/u:0);D.Fa=b*e;u=D.Aa;u.va=this.da.cd;u.wa=this.da.dd;u.xa=this.da.ed;u.Ba=this.da.cd;u.Ca=this.da.dd;u.Da=this.da.ed;u.aa=-0;u.ba=-g;u.ca=-k;u.ea=-0;u.fa=-r;u.ga=-v}g=this.Pb[1];k=a.rows[a.Ka++];r=k.Aa;r.va=0;r.wa=0;r.xa=0;r.Ba=0;r.Ca=0;r.Da=0;r.aa=0;r.ba=0;r.ca=0;r.ea=0;r.fa=0;r.ga=0;k.Fa=0;k.Ma=0;k.Ia=0;k.Ha=0;k.motorSpeed=0;k.fb=0;k.ta=g;D=k;D.Fa=d;D.Ma=0;D.Ia=-1/0;D.Ha=1/0;u=D.Aa;u.va=this.da.Qd;u.wa=this.da.Rd;u.xa=this.da.Sd;u.Ba=this.da.Qd;u.Ca=this.da.Rd;u.Da=this.da.Sd;u.aa=-m;u.ba=-0;u.ca=-n;u.ea=-t;u.fa=-0;u.ga=-y;d=this.Pb[2];m=a.rows[a.Ka++];n=m.Aa;n.va=0;n.wa=0;n.xa=0;n.Ba=0;n.Ca=0;n.Da=0;n.aa=0;n.ba=0;n.ca=0;n.ea=0;n.fa=0;n.ga=0;m.Fa=0;m.Ma=0;m.Ia=0;m.Ha=0;m.motorSpeed=0;m.fb=0;m.ta=d;D=m;D.Fa=f;D.Ma=0;D.Ia=-1/0;D.Ha=1/0;u=D.Aa;u.va=this.da.me;u.wa=this.da.ne;u.xa=this.da.oe;u.Ba=this.da.me;u.Ca=this.da.ne;u.Da=this.da.oe;u.aa=-q;u.ba=-p;u.ca=-0;u.ea=-L;u.fa=-w;u.ga=-0;f=this.Pb[3];q=a.rows[a.Ka++];p=q.Aa;p.va=0;p.wa=0;p.xa=0;p.Ba=0;p.Ca=0;p.Da=0;p.aa=0;p.ba=0;p.ca=0;p.ea=0;p.fa=0;p.ga=0;q.Fa=0;q.Ma=0;q.Ia=0;q.Ha=0;q.motorSpeed=0;q.fb=0;q.ta=f;D=q;D.Fa=h;D.Ma=0;D.Ia=-1/0;D.Ha=1/0;u=D.Aa;u.aa=1;u.ba=0;u.ca=0;u.ea=1;u.fa=0;u.ga=0;h=this.Pb[4];f=a.rows[a.Ka++];q=f.Aa;q.va=0;q.wa=0;q.xa=0;q.Ba=0;q.Ca=0;q.Da=0;q.aa=0;q.ba=0;q.ca=0;q.ea=0;q.fa=0;q.ga=0;f.Fa=0;f.Ma=0;f.Ia=0;f.Ha=0;f.motorSpeed=0;f.fb=0;f.ta=h;D=f;D.Fa=l;D.Ma=0;D.Ia=-1/0;D.Ha=1/0;u=D.Aa;u.aa=0;u.ba=1;u.ca=0;u.ea=0;u.fa=1;u.ga=0;l=this.Pb[5];a=a.rows[a.Ka++];h=a.Aa;h.va=0;h.wa=0;h.xa=0;h.Ba=0;h.Ca=0;h.Da=0;h.aa=0;h.ba=0;h.ca=0;h.ea=0;h.fa=0;h.ga=0;a.Fa=0;a.Ma=0;a.Ia=0;a.Ha=0;a.motorSpeed=0;a.fb=0;a.ta=l;D=a;D.Fa=c;D.Ma=0;D.Ia=-1/0;D.Ha=1/0;u=D.Aa;u.aa=0;u.ba=0;u.ca=1;u.ea=0;u.fa=0;u.ga=1},hd:function(){V.prototype.hd.call(this);var a=this.da,b=a.$.C.$a,e=a.$.D.$a,c,d,f,h,l,g,k,m,n,q,p,r,v,t,y,L,w,D,u,B,C,A,G,I,J,E,O,S,da,ta,Ja=a.$.vb*a.$.bc+a.$.wb*a.$.cc+a.$.xb*a.$.dc;if(-.999999999>Ja){var Db,Ia,Da,ma=a.$.vb,Q=a.$.wb,Ma=a.$.xb,Ga=ma*ma,Ea=Q*Q,Ua=Ma*Ma,va;Gafa&&(fa=-fa,Y=-Y,T=-T,aa=-aa,z=-z);if(.999999fb){var Ha,qb,Na,la=J*J,Ca=E*E,Za=O*O,Ra;laPb?Rb>Nb?(sb=Math.sqrt(Rb-Pb-Nb+1),bc=.5*sb,sb=.5/sb,Qb=(Ub+fc)*sb,dc=(gc+Fb)*sb,Vb=(lc-cc)*sb):(sb=Math.sqrt(Nb-Rb-Pb+1),dc=.5*sb,sb=.5/sb,bc=(gc+Fb)*sb,Qb=(cc+lc)*sb,Vb=(fc-Ub)*sb):Pb>Nb?(sb=Math.sqrt(Pb-Nb-Rb+1),Qb=.5*sb,sb=.5/sb,bc=(Ub+fc)*sb,dc=(cc+lc)*sb,Vb=(gc-Fb)*sb):(sb=Math.sqrt(Nb-Rb-Pb+1),dc=.5*sb,sb=.5/sb,bc=(gc+Fb)*sb,Qb=(cc+lc)*sb,Vb=(fc-Ub)*sb);var Xb=Vb,qc=2*(-1>=Xb?3.14159265358979:1<=Xb?0:Math.acos(Xb));this.rh=bc;this.Ee=Qb;this.Fe=dc;var Ob=this.rh*this.rh+this.Ee*this.Ee+this.Fe*this.Fe;0=this.$k.frequency||!e)&&(w=this.Pb[3],h=a.rows[a.Ka++],n=h.Aa,n.va=0,n.wa=0,n.xa=0,n.Ba=0,n.Ca=0,n.Da=0,n.aa=0,n.ba=0,n.ca=0,n.ea=0,n.fa=0,n.ga=0,h.Fa=0,h.Ma=0,h.Ia=0,h.Ha=0,h.motorSpeed=0,h.fb=0,h.ta=w,w=h,h=this.Nj,y=this.nl,q=this.$k,n=G.angularSlop,e?(q=0,L=1):(0y?h=m=k=0:f==y?(k=-1/0,m=1/0,h-=f):hy?(k=0,m=1/0,h=h-y-n,0>h&&(h=0)):h=m=k=0,w.Ia=k,w.Ha=m,w.Ma=q*(B?1/B:0),w.Fa=h*L,w=w.Aa,w.aa=this.je,w.ba=this.ke,w.ca=this.le,w.ea=this.je,w.fa=this.ke,w.ga=this.le);if(0>=this.fl.frequency||!e)B=this.Pb[4],a=a.rows[a.Ka++],w=a.Aa,w.va=0,w.wa=0,w.xa=0,w.Ba=0,w.Ca=0,w.Da=0,w.aa=0,w.ba=0,w.ca=0,w.ea=0,w.fa=0,w.ga=0,a.Fa=0,a.Ma=0,a.Ia=0,a.Ha=0,a.motorSpeed=0,a.fb=0,a.ta=B,w=a,a=this.tj,h=this.el,n=this.fl,B=G.angularSlop,e?(e=0,n=1):(0h?b=y=q=0:b==h?(q=-1/0,y=1/0,b=a-b):ah?(q=0,y=1/0,b=a-h-B,0>b&&(b=0)):b=y=q=0,w.Ia=q,w.Ha=y,w.Ma=e*(c?1/c:0),w.Fa=b*n,w=w.Aa,w.aa=this.gi,w.ba=this.hi,w.ca=this.ii,w.ea=this.gi,w.fa=this.hi,w.ga=this.ii},hd:function(){V.prototype.hd.call(this);var a,b,e,c,d,f;a=this.vb;b=this.wb;e=this.xb;c=this.bc;d=this.cc;f=this.dc;var h,l,g,k,m,n,q,p,r;h=this.vb;l=this.He;g=this.Hh;k=this.wb;m=this.Ie;n=this.Ih;q=this.xb;p=this.Je;r=this.Jh;var v,t,y,L,w,D,u,B;D=a*c+b*d+e*f;-.999999999>D?(w=a*a,c=b*b,d=e*e,w=L?3.14159265358979:1<=L?0:Math.acos(L));L=v;B=y;y=a*this.ve+w*this.we+D*this.xe;C=b*this.ve+c*this.we+f*this.xe;v=e*this.ve+d*this.we+u*this.xe;this.tj=Math.atan2(this.Hh*y+this.Ih*C+this.Jh*v,this.He*y+this.Ie*C+this.Je*v);this.gi=this.vb+this.bc;this.hi=this.wb+this.cc;this.ii=this.xb+this.dc;v=this.gi*this.gi+this.hi*this.hi+this.ii*this.ii;0=this.Ce.frequency||!e)h=this.Pb[3],q=a.rows[a.Ka++],p=q.Aa,p.va=0,p.wa=0,p.xa=0,p.Ba=0,p.Ca=0,p.Da=0,p.aa=0,p.ba=0,p.ca=0,p.ea=0,p.fa=0,p.ga=0,q.Fa=0,q.Ma=0,q.Ia=0,q.Ha=0,q.motorSpeed=0,q.fb=0,q.ta=h,A=q,h=this.angle,p=this.Rh,L=this.Ce,q=G.angularSlop,e?(e=0,L=1):(0p?b=f=w=0:b==p?(w=-1/0,f=1/0,b=h-b):hp?(w=0,f=1/0,b=h-p-q,0>b&&(b=0)):b=f=w=0,A.Ia=w,A.Ha=f,A.Ma=e*(C?1/C:0),A.Fa=b*L,A=A.Aa,A.aa=this.da.cd,A.ba=this.da.dd,A.ca=this.da.ed,A.ea=this.da.cd,A.fa=this.da.dd,A.ga=this.da.ed;b=this.Pb[4];C=a.rows[a.Ka++];e=C.Aa;e.va=0;e.wa=0;e.xa=0;e.Ba=0;e.Ca=0;e.Da=0;e.aa=0;e.ba=0;e.ca=0;e.ea=0;e.fa=0;e.ga=0;C.Fa=0;C.Ma=0;C.Ia=0;C.Ha=0;C.motorSpeed=0;C.fb=0;C.ta=b;A=C;A.Fa=l;A.Ma=0;A.Ia=-1/0;A.Ha=1/0;A=A.Aa;A.aa=this.da.Qd;A.ba=this.da.Rd;A.ca=this.da.Sd;A.ea=this.da.Qd;A.fa=this.da.Rd;A.ga=this.da.Sd;l=this.Pb[5];a=a.rows[a.Ka++];b=a.Aa;b.va=0;b.wa=0;b.xa=0;b.Ba=0;b.Ca=0;b.Da=0;b.aa=0;b.ba=0;b.ca=0;b.ea=0;b.fa=0;b.ga=0;a.Fa=0;a.Ma=0;a.Ia=0;a.Ha=0;a.motorSpeed=0;a.fb=0;a.ta=l;A=a;A.Fa=c;A.Ma=0;A.Ia=-1/0;A.Ha=1/0;A=A.Aa;A.aa=this.da.me;A.ba=this.da.ne;A.ca=this.da.oe;A.ea=this.da.me;A.fa=this.da.ne;A.ga=this.da.oe},hd:function(){V.prototype.hd.call(this);var a=this.da,b=a.$.C.$a,e=a.$.D.$a,c,d,f,h,l,g,k,m,n,q,p,r,v,t,y,L,w,u,G,B,C,A,E,I,J,O,S,ta,da,Ja,Ma=a.$.vb*a.$.bc+a.$.wb*a.$.cc+a.$.xb*a.$.dc;if(-.999999999>Ma){var Db,Ia,Da,ma=a.$.vb,Q=a.$.wb,Oa=a.$.xb,Ga=ma*ma,Ea=Q*Q,Ua=Oa*Oa,va;Gafa&&(fa=-fa,Y=-Y,T=-T,aa=-aa,z=-z);if(.999999fb){var Ha,qb,Na,la=J*J,Ca=O*O,Za=S*S,Ra;la=Bb?3.14159265358979:1<=Bb?0:Math.acos(Bb),Eb=Ta*Ta+bb*bb+jb*jb;0=Bb?3.14159265358979:1<=Bb?0:Math.acos(Bb);0>Cb*this.da.cd+qa*this.da.dd+wb*this.da.ed&&(this.angle=-this.angle);this.Mj=this.Rf-this.Of;this.Df=this.Sf-this.Pf;this.Ef=this.Tf-this.Qf},$d:function(a,b){V.prototype.$d.call(this,a,b);this.Ud(b,a,!1)},gd:function(a){V.prototype.gd.call(this,a);this.Ud(a,null,!0)},Eg:function(){var a=new t;a.x=this.vb;a.y=this.wb;a.z=this.xb;return a},Gg:function(){var a=new t;a.x=this.bc;a.y=this.cc;a.z=this.dc;return a},Fg:function(a){a.x=this.vb;a.y=this.wb;a.z=this.xb},Hg:function(a){a.x=this.bc;a.y=this.cc;a.z=this.dc},Ig:function(){var a=new t;a.x=this.qa;a.y=this.ra;a.z=this.sa;return a},Kg:function(){var a=new t;a.x=this.nb;a.y=this.ob;a.z=this.pb;return a},Jg:function(a){a.x=this.qa;a.y=this.ra;a.z=this.sa},Lg:function(a){a.x=this.nb;a.y=this.ob;a.z=this.pb},Cj:function(){return this.Ce},ql:function(){return this.Rh},ol:function(){return this.angle}});Ef.ua=kc;Ef.prototype=cb(kc.prototype,{za:function(a,b,e,c){this.fh(a,b,e);var d,f,h;d=c.x;f=c.y;h=c.z;var l;e=a.a.o*d+a.a.i*f+a.a.l*h;l=a.a.f*d+a.a.m*f+a.a.g*h;a=a.a.h*d+a.a.j*f+a.a.s*h;d=this.localAxis1;d.x=e;d.y=l;d.z=a;l=c.x;a=c.y;d=c.z;c=b.a.o*l+b.a.i*a+b.a.l*d;e=b.a.f*l+b.a.m*a+b.a.g*d;b=b.a.h*l+b.a.j*a+b.a.s*d;l=this.localAxis2;l.x=c;l.y=e;l.z=b;return this}});ac.prototype={ua:function(a,b){this.lowerLimit=a;this.upperLimit=b;return this},cb:function(a,b){this.motorSpeed=a;this.motorTorque=b;return this},clone:function(){var a=new ac;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed=this.motorSpeed;a.motorTorque=this.motorTorque;return a}};Sd.ua=V;Sd.prototype=cb(V.prototype,{Ud:function(a,b,e){if(!(0=this.Yk.frequency||!e)){var U=this.Pb[3],pa=a.rows[a.Ka++],sa=pa.Aa;sa.va=0;sa.wa=0;sa.xa=0;sa.Ba=0;sa.Ca=0;sa.Da=0;sa.aa=0;sa.ba=0;sa.ca=0;sa.ea=0;sa.fa=0;sa.ga=0;pa.Fa=0;pa.Ma=0;pa.Ia=0;pa.Ha=0;pa.motorSpeed=0;pa.fb=0;pa.ta=U;var M=pa,wa=this.Ni,ra=this.Qk,ka=this.Yk,Z,na,Aa=G.angularSlop;if(e)Z=0,na=1;else{if(0ga?ja=xb=za=0:Va==ga?(za=-1/0,xb=1/0,ja=wa-Va):waga?(za=0,xb=1/0,ja=wa-ga-Aa,0>ja&&(ja=0)):ja=xb=za=0;var Xa=Ia?1/Ia:0;M.Ia=za;M.Ha=xb;M.Ma=Z*Xa;M.Fa=ja*na;N=M.Aa;N.aa=this.fg;N.ba=this.gg;N.ca=this.hg;N.ea=this.fg;N.fa=this.gg;N.ga=this.hg}if(!this.Km){var ab=this.Pb[4],gb=a.rows[a.Ka++],pb=gb.Aa;pb.va=0;pb.wa=0;pb.xa=0;pb.Ba=0;pb.Ca=0;pb.Da=0;pb.aa=0;pb.ba=0;pb.ca=0;pb.ea=0;pb.fa=0;pb.ga=0;gb.Fa=0;gb.Ma=0;gb.Ia=0;gb.Ha=0;gb.motorSpeed=0;gb.fb=0;gb.ta=ab;M=gb;M.Fa=l;M.Ma=0;M.Ia=-1/0;M.Ha=1/0;N=M.Aa;N.aa=this.Yg;N.ba=this.Zg;N.ca=this.$g;N.ea=this.Yg;N.fa=this.Zg;N.ga=this.$g}if(!this.Lm&&(0>=this.Zk.frequency||!e)){var ua=this.Pb[5],xa=a.rows[a.Ka++],Fa=xa.Aa;Fa.va=0;Fa.wa=0;Fa.xa=0;Fa.Ba=0;Fa.Ca=0;Fa.Da=0;Fa.aa=0;Fa.ba=0;Fa.ca=0;Fa.ea=0;Fa.fa=0;Fa.ga=0;xa.Fa=0;xa.Ma=0;xa.Ia=0;xa.Ha=0;xa.motorSpeed=0;xa.fb=0;xa.ta=ua;var M=xa,fb=this.Oi,Ha=this.Rk,qb=this.Zk,Na,la,Ca=G.angularSlop;if(e)Na=0,la=1;else{if(0kb?$a=hb=cb=0:Ib==kb?(cb=-1/0,hb=1/0,$a=fb-Ib):fbkb?(cb=0,hb=1/0,$a=fb-kb-Ca,0>$a&&($a=0)):$a=hb=cb=0;var Ka=Ya?1/Ya:0;M.Ia=cb;M.Ha=hb;M.Ma=Na*Ka;M.Fa=$a*la;N=M.Aa;N.aa=this.ig;N.ba=this.jg;N.ca=this.kg;N.ea=this.ig;N.fa=this.jg;N.ga=this.kg}},hd:function(){V.prototype.hd.call(this);var a,b,e,c,d,f,h,l,g;a=this.vb;b=this.wb;e=this.xb;h=this.ah;l=this.bh;g=this.dh;c=l*e-g*b;d=g*a-h*e;f=h*b-l*a;this.fg=d*g-f*l;this.gg=f*h-c*g;this.hg=c*l-d*h;this.Yg=c;this.Zg=d;this.$g=f;this.ig=b*f-e*d;this.jg=e*c-a*f;this.kg=a*d-b*c;a=this.fg*this.fg+this.gg*this.gg+this.hg*this.hg;0=u?(e=Math.atan2(D,w),a=.5*e,b=-1.570796326794895,e=.5*-e):1<=u?(e=Math.atan2(D,w),a=.5*e,b=1.570796326794895,e*=.5):(u=Math.asin(u),k=Math.atan2(-(k*p+m*v+n*y),k*q+m*r+n*t),a=Math.atan2(-(a*h+e*l+d*g),b*h+c*l+f*g),b=u,e=k);this.Ni=a;this.Pl=b;this.Oi=e;this.Mj=this.Rf-this.Of;this.Df=this.Sf-this.Pf;this.Ef=this.Tf-this.Qf},$d:function(a,b){V.prototype.$d.call(this,a,b);this.Ud(b,a,!1)},gd:function(a){V.prototype.gd.call(this,a);this.Ud(a,null,!0)},Eg:function(){var a=new t;a.x=this.vb;a.y=this.wb;a.z=this.xb;return a},Gg:function(){var a=new t;a.x=this.ah;a.y=this.bh;a.z=this.dh;return a},Fg:function(a){a.x=this.vb;a.y=this.wb;a.z=this.xb},Hg:function(a){a.x=this.ah;a.y=this.bh;a.z=this.dh},Ig:function(){var a=new t;a.x=this.qa;a.y=this.ra;a.z=this.sa;return a},Kg:function(){var a=new t;a.x=this.Mc;a.y=this.Nc;a.z=this.Oc;return a},Jg:function(a){a.x=this.qa;a.y=this.ra;a.z=this.sa},Lg:function(a){a.x=this.Mc;a.y=this.Nc;a.z=this.Oc},Bn:function(){return this.Yk},Cn:function(){return this.Zk},xn:function(){return this.Qk},yn:function(){return this.Rk},sn:function(){return this.Ni},tn:function(){return this.Oi}});rf.ua=kc;rf.prototype=cb(kc.prototype,{za:function(a,b,e,c,d){this.fh(a,b,e);var f,h,l;f=c.x;h=c.y;l=c.z;c=a.a.o*f+a.a.i*h+a.a.l*l;e=a.a.f*f+a.a.m*h+a.a.g*l;a=a.a.h*f+a.a.j*h+a.a.s*l;f=this.localAxis1;f.x=c;f.y=e;f.z=a;c=d.x;e=d.y;f=d.z;d=b.a.o*c+b.a.i*e+b.a.l*f;a=b.a.f*c+b.a.m*e+b.a.g*f;b=b.a.h*c+b.a.j*e+b.a.s*f;c=this.localAxis2;c.x=d;c.y=a;c.z=b;return this}});vl.prototype={za:function(a){this.Sc=a.Sc;for(var b=0,e=this.Sc;bn?q.Ia:0p.Ha+G.directMlcpSolverEps){b=!1;break}d[q]=v-r}if(h)return!0;if(!b)return!1;h=0;for(g=this.Sc;hn&&k>G.directMlcpSolverEps||0-1/0,d=e.Ha<1/0;0==e.Ia&&0==e.Ha?(d=this.cf,d.uh[d.Sc]=b,d.zh[d.Sc]=0,d.Sc++,this.Uh(a,b+1),this.cf.Sc--):(e=this.cf,e.Mg[e.ie]=b,e.ie++,this.Uh(a,b+1),this.cf.ie--,c&&(c=this.cf,c.uh[c.Sc]=b,c.zh[c.Sc]=-1,c.Sc++,this.Uh(a,b+1),this.cf.Sc--),d&&(d=this.cf,d.uh[d.Sc]=b,d.zh[d.Sc]=1,d.Sc++,this.Uh(a,b+1),this.cf.Sc--))}}};dl.prototype={};vc.ua=Ob;vc.prototype=cb(Ob.prototype,{xh:function(a){this.$.hd();this.$.$d(a,this.info);this.C=this.info.Qe;this.D=this.info.Re;this.ei.ll(this.info,this.ac);a=this.Se;a.jf=0;var b=a.cf;b.Sc=0;b.ie=0;a.Uh(this.info,0);a=this.Ml;for(var b=this.Se.jf,e=0,c=0,d=0,f=a.n;d=b)for(b=0,a=this.info.Ka;bd.Ha&&(h=d.Ha);f.ta=h;0d&&(h=d),f.ad=h):f.ad=0;this.Cf[c]=f.ta+f.ad}var b=this.Cf,e=a=!1,l,g,k,m,n,q,p,r,c=this.C.gb,f=this.C.hb,d=this.C.ib,h=this.D.gb;l=this.D.hb;g=this.D.ib;k=this.C.kb;m=this.C.lb;n=this.C.mb;q=this.D.kb;p=this.D.lb;r=this.D.mb;for(var v=0,u=this.info.Ka;vl&&(h=l),d.ad=h,d=h-f,this.Aj[c]=d,f=0,h=a;fX){var ca=X*X;M=.5*(1-.16666666666666666*ca+ca*ca*.008333333333333333);N=1-.5*ca+ca*ca*.041666666666666664}else M=Math.sin(X)/Qa,N=Math.cos(X);var Y,T,aa;Y=Ja*M;T=Ma*M;aa=Oa*M;var z,fa,U,pa;z=Y;fa=T;U=aa;pa=N;var sa,wa,ra,ka,Z=F.a.o,na=F.a.m,Aa=F.a.s,ya=Z+na+Aa,K;0na?Z>Aa?(K=Math.sqrt(Z-na-Aa+1),sa=.5*K,K=.5/K,wa=(F.a.f+F.a.i)*K,ra=(F.a.h+F.a.l)*K,ka=(F.a.g-F.a.j)*K):(K=Math.sqrt(Aa-Z-na+1),ra=.5*K,K=.5/K,sa=(F.a.h+F.a.l)*K,wa=(F.a.j+F.a.g)*K,ka=(F.a.i-F.a.f)*K):na>Aa?(K=Math.sqrt(na-Aa-Z+1),wa=.5*K,K=.5/K,sa=(F.a.f+F.a.i)*K,ra=(F.a.j+F.a.g)*K,ka=(F.a.h-F.a.l)*K):(K=Math.sqrt(Aa-Z-na+1),ra=.5*K,K=.5/K,sa=(F.a.h+F.a.l)*K,wa=(F.a.j+F.a.g)*K,ka=(F.a.i-F.a.f)*K);sa=pa*sa+z*ka+fa*ra-U*wa;wa=pa*wa-z*ra+fa*ka+U*sa;ra=pa*ra+z*wa-fa*sa+U*ka;ka=pa*ka-z*sa-fa*wa-U*ra;var Ba=sa*sa+wa*wa+ra*ra+ka*ka;1E-32lb){var ub=lb*lb;yb=.5*(1-.16666666666666666*ub+ub*ub*.008333333333333333);mb=1-.5*ub+ub*ub*.041666666666666664}else yb=Math.sin(lb)/eb,mb=Math.cos(lb);var x,W,ea;x=Ia*yb;W=Da*yb;ea=ma*yb;var wb,Jb,Pa,rb;wb=x;Jb=W;Pa=ea;rb=mb;var ob,zb,Ab,ia,Ta=H.a.o,bb=H.a.m,jb=H.a.s,Bb=Ta+bb+jb,La;0bb?Ta>jb?(La=Math.sqrt(Ta-bb-jb+1),ob=.5*La,La=.5/La,zb=(H.a.f+H.a.i)*La,Ab=(H.a.h+H.a.l)*La,ia=(H.a.g-H.a.j)*La):(La=Math.sqrt(jb-Ta-bb+1),Ab=.5*La,La=.5/La,ob=(H.a.h+H.a.l)*La,zb=(H.a.j+H.a.g)*La,ia=(H.a.i-H.a.f)*La):bb>jb?(La=Math.sqrt(bb-jb-Ta+1),zb=.5*La,La=.5/La,ob=(H.a.f+H.a.i)*La,Ab=(H.a.j+H.a.g)*La,ia=(H.a.h-H.a.l)*La):(La=Math.sqrt(jb-Ta-bb+1),Ab=.5*La,La=.5/La,ob=(H.a.h+H.a.l)*La,zb=(H.a.j+H.a.g)*La,ia=(H.a.i-H.a.f)*La);ob=rb*ob+wb*ia+Jb*Ab-Pa*zb;zb=rb*zb-wb*Ab+Jb*ia+Pa*ob;Ab=rb*Ab+wb*zb-Jb*ob+Pa*ia;ia=rb*ia-wb*ob-Jb*zb-Pa*Ab;var Eb=ob*ob+zb*zb+Ab*Ab+ia*ia;1E-32v*v&&(v/=Math.sqrt(t),u.zc*=v,u.yc*=v)):(u.zc=0,u.yc=0);t=u.zc-y;D=u.yc-w;a+=r.yl*t;b+=r.zl*t;e+=r.Al*t;a+=r.sl*D;b+=r.tl*D;e+=r.ul*D;c+=r.Bl*-t;d+=r.Cl*-t;f+=r.Dl*-t;c+=r.vl*-D;d+=r.wl*-D;f+=r.xl*-D;h+=r.Ej*t;l+=r.Fj*t;g+=r.Gj*t;h+=r.lk*D;l+=r.mk*D;g+=r.nk*D;k+=r.Hj*-t;m+=r.Ij*-t;n+=r.Jj*-t;k+=r.pk*-D;m+=r.qk*-D;n+=r.rk*-D}q=0;for(p=this.info.Ka;qu.bd&&(u.bd=0),v=u.bd-y,a+=r.Zh*v,b+=r.$h*v,e+=r.ai*v,c+=r.bi*-v,d+=r.ci*-v,f+=r.di*-v,h+=r.Xf*v,l+=r.Yf*v,g+=r.Zf*v,k+=r.$f*-v,m+=r.ag*-v,n+=r.bg*-v;this.C.gb=a;this.C.hb=b;this.C.ib=e;this.D.gb=c;this.D.hb=d;this.D.ib=f;this.C.kb=h;this.C.lb=l;this.C.mb=g;this.D.kb=k;this.D.lb=m;this.D.mb=n},Pg:function(){this.Ji.al();this.Ji.gd(this.info);var a=this.C.$a,b=this.D.$a,e,c,d,f,h,l,g,k,m,n,q,p,r,v,t,y,u,w;e=this.C.P;c=this.C.R;d=this.C.S;f=this.C.T;h=this.C.U;l=this.C.V;g=this.C.W;k=this.C.X;m=this.C.Y;n=this.D.P;q=this.D.R;p=this.D.S;r=this.D.T;v=this.D.U;t=this.D.V;y=this.D.W;u=this.D.X;w=this.D.Y;for(var D=0,G=this.info.Ka;Dt.ub&&(t.ub=0);v=t.ub-y;a+=r.Zh*v;b+=r.$h*v;e+=r.ai*v;c+=r.bi*-v;d+=r.ci*-v;f+=r.di*-v;h+=r.Xf*v;l+=r.Yf*v;g+=r.Zf*v;k+=r.$f*-v;m+=r.ag*-v;n+=r.bg*-v}this.C.Yc=a;this.C.Zc=b;this.C.$c=e;this.D.Yc=c;this.D.Zc=d;this.D.$c=f;this.C.Uc=h;this.C.Vc=l;this.C.Wc=g;this.D.Uc=k;this.D.Vc=m;this.D.Wc=n},Ah:function(){this.Ji.al();this.Ji.gd(this.info);var a=this.C.$a,b=this.D.$a,e,c,d,f,h,l,g,k,m,n,q,p,r,v,t,y,u,w;e=this.C.P;c=this.C.R;d=this.C.S;f=this.C.T;h=this.C.U;l=this.C.V;g=this.C.W;k=this.C.X;m=this.C.Y;n=this.D.P;q=this.D.R;p=this.D.S;r=this.D.T;v=this.D.U;t=this.D.V;y=this.D.W;u=this.D.X;w=this.D.Y;for(var D=0,E=this.info.Ka;DX.ub&&(X.ub=0);ca=X.ub-Y;da+=Qa.Zh*ca;Ja+=Qa.$h*ca;Ma+=Qa.ai*ca;Oa+=Qa.bi*-ca;Ia+=Qa.ci*-ca;Da+=Qa.di*-ca;ma+=Qa.Xf*ca;Q+=Qa.Yf*ca;Wa+=Qa.Zf*ca;Ga+=Qa.$f*-ca;Ea+=Qa.ag*-ca;Ua+=Qa.bg*-ca}var T=this.C;T.a.v+=da;T.a.A+=Ja;T.a.B+=Ma;var aa=this.D;aa.a.v+=Oa;aa.a.A+=Ia;aa.a.B+=Da;var z=this.C,fa=Math.sqrt(ma*ma+Q*Q+Wa*Wa),U=.5*fa,pa,sa;if(.5>U){var wa=U*U;pa=.5*(1-.16666666666666666*wa+wa*wa*.008333333333333333);sa=1-.5*wa+wa*wa*.041666666666666664}else pa=Math.sin(U)/fa,sa=Math.cos(U);var ra,ka;ra=ma*pa;ka=Q*pa;var Z,na;Z=Wa*pa;na=sa;var Aa,ya,K,Ba,ha=z.a.o,ba=z.a.m,Va=z.a.s,ga=ha+ba+Va,P;0ba?ha>Va?(P=Math.sqrt(ha-ba-Va+1),Aa=.5*P,P=.5/P,ya=(z.a.f+z.a.i)*P,K=(z.a.h+z.a.l)*P,Ba=(z.a.g-z.a.j)*P):(P=Math.sqrt(Va-ha-ba+1),K=.5*P,P=.5/P,Aa=(z.a.h+z.a.l)*P,ya=(z.a.j+z.a.g)*P,Ba=(z.a.i-z.a.f)*P):ba>Va?(P=Math.sqrt(ba-Va-ha+1),ya=.5*P,P=.5/P,Aa=(z.a.f+z.a.i)*P,K=(z.a.j+z.a.g)*P,Ba=(z.a.h-z.a.l)*P):(P=Math.sqrt(Va-ha-ba+1),K=.5*P,P=.5/P,Aa=(z.a.h+z.a.l)*P,ya=(z.a.j+z.a.g)*P,Ba=(z.a.i-z.a.f)*P);Aa=na*Aa+ra*Ba+ka*K-Z*ya;ya=na*ya-ra*K+ka*Ba+Z*Aa;K=na*K+ra*ya-ka*Aa+Z*Ba;Ba=na*Ba-ra*Aa-ka*ya-Z*K;var za=Aa*Aa+ya*ya+K*K+Ba*Ba;1E-32ea){var Pa=ea*ea;Jb=.5*(1-.16666666666666666*Pa+Pa*Pa*.008333333333333333);Kb=1-.5*Pa+Pa*Pa*.041666666666666664}else Jb=Math.sin(ea)/W,Kb=Math.cos(ea);var rb,ob;rb=Ga*Jb;ob=Ea*Jb;var zb,Ab;zb=Ua*Jb;Ab=Kb;var ia,Ta,bb,jb,Bb=x.a.o,La=x.a.m,Eb=x.a.s,Rb=Bb+La+Eb,qa;0La?Bb>Eb?(qa=Math.sqrt(Bb-La-Eb+1),ia=.5*qa,qa=.5/qa,Ta=(x.a.f+x.a.i)*qa,bb=(x.a.h+x.a.l)*qa,jb=(x.a.g-x.a.j)*qa):(qa=Math.sqrt(Eb-Bb-La+1),bb=.5*qa,qa=.5/qa,ia=(x.a.h+x.a.l)*qa,Ta=(x.a.j+x.a.g)*qa,jb=(x.a.i-x.a.f)*qa):La>Eb?(qa=Math.sqrt(La-Eb-Bb+1),Ta=.5*qa,qa=.5/qa,ia=(x.a.f+x.a.i)*qa,bb=(x.a.j+x.a.g)*qa,jb=(x.a.h-x.a.l)*qa):(qa=Math.sqrt(Eb-Bb-La+1),bb=.5*qa,qa=.5/qa,ia=(x.a.h+x.a.l)*qa,Ta=(x.a.j+x.a.g)*qa,jb=(x.a.i-x.a.f)*qa);ia=Ab*ia+rb*jb+ob*bb-zb*Ta;Ta=Ab*Ta-rb*bb+ob*jb+zb*ia;bb=Ab*bb+rb*Ta-ob*ia+zb*jb;jb=Ab*jb-rb*ia-ob*Ta-zb*bb;var Hb=ia*ia+Ta*Ta+bb*bb+jb*jb;1E-32=b)for(b=0,a=this.info.Ka;bv.fb&&(t.ad=v.fb);u=t.ad-w;y.xc&1&&(a+=r.qd*u,b+=r.rd*u,e+=r.sd*u,c+=r.td*-u,d+=r.ud*-u,f+=r.vd*-u);y.xc&2&&(h+=r.kd*u,l+=r.ld*u,g+=r.md*u,k+=r.nd*-u,m+=r.od*-u,n+=r.pd*-u)}}q=0;for(p=this.info.Ka;qv.Ha&&(t.ta=v.Ha),u=t.ta-w,y.xc&1&&(a+=r.qd*u,b+=r.rd*u,e+=r.sd*u,c+=r.td*-u,d+=r.ud*-u,f+=r.vd*-u),y.xc&2&&(h+=r.kd*u,l+=r.ld*u,g+=r.md*u,k+=r.nd*-u,m+=r.od*-u,n+=r.pd*-u);this.C.gb=a;this.C.hb=b;this.C.ib=e;this.D.gb=c;this.D.hb=d;this.D.ib=f;this.C.kb=h;this.C.lb=l;this.C.mb=g;this.D.kb=k;this.D.lb=m;this.D.mb=n},Li:function(a){for(var b,e,c,d,f,h,l=h=f=d=c=e=b=0,g=this.info.Ka;lv.Ha&&(u.ub=v.Ha);t=u.ub-E;a+=r.qd*t;b+=r.rd*t;e+=r.sd*t;c+=r.td*-t;d+=r.ud*-t;f+=r.vd*-t;h+=r.kd*t;l+=r.ld*t;g+=r.md*t;k+=r.nd*-t;m+=r.od*-t;n+=r.pd*-t}this.C.Yc=a;this.C.Zc=b;this.C.$c=e;this.D.Yc=c;this.D.Zc=d;this.D.$c=f;this.C.Uc=h;this.C.Vc=l;this.C.Wc=g;this.D.Uc=k;this.D.Vc=m;this.D.Wc=n},Ah:function(){this.$.hd();this.$.gd(this.info);this.C=this.info.Qe;this.D=this.info.Re;var a=this.C.$a,b=this.D.$a,e,c,d,f,h,l,g,k,m,n,q,p,r,t,u,y,E,w;e=this.C.P;c=this.C.R;d=this.C.S;f=this.C.T;h=this.C.U;l=this.C.V;g=this.C.W;k=this.C.X;m=this.C.Y;n=this.D.P;q=this.D.R;p=this.D.S;r=this.D.T;t=this.D.U;u=this.D.V;y=this.D.W;E=this.D.X;w=this.D.Y;for(var D=0,O=this.info.Ka;DF.Ha&&(X.ub=F.Ha);ca=X.ub-Y;da+=Qa.qd*ca;Ma+=Qa.rd*ca;Oa+=Qa.sd*ca;Wa+=Qa.td*-ca;Ia+=Qa.ud*-ca;Da+=Qa.vd*-ca;ma+=Qa.kd*ca;Q+=Qa.ld*ca;Xa+=Qa.md*ca;Ga+=Qa.nd*-ca;Ea+=Qa.od*-ca;Ua+=Qa.pd*-ca}var T=this.C;T.a.v+=da;T.a.A+=Ma;T.a.B+=Oa;var aa=this.D;aa.a.v+=Wa;aa.a.A+=Ia;aa.a.B+=Da;var z=this.C,fa=Math.sqrt(ma*ma+Q*Q+Xa*Xa),U=.5*fa,pa,sa;if(.5>U){var wa=U*U;pa=.5*(1-.16666666666666666*wa+wa*wa*.008333333333333333);sa=1-.5*wa+wa*wa*.041666666666666664}else pa=Math.sin(U)/fa,sa=Math.cos(U);var ra,ka;ra=ma*pa;ka=Q*pa;var Z,na;Z=Xa*pa;na=sa;var Aa,ya,K,Ba,ha=z.a.o,ba=z.a.m,Va=z.a.s,ga=ha+ba+Va,P;0ba?ha>Va?(P=Math.sqrt(ha-ba-Va+1),Aa=.5*P,P=.5/P,ya=(z.a.f+z.a.i)*P,K=(z.a.h+z.a.l)*P,Ba=(z.a.g-z.a.j)*P):(P=Math.sqrt(Va-ha-ba+1),K=.5*P,P=.5/P,Aa=(z.a.h+z.a.l)*P,ya=(z.a.j+z.a.g)*P,Ba=(z.a.i-z.a.f)*P):ba>Va?(P=Math.sqrt(ba-Va-ha+1),ya=.5*P,P=.5/P,Aa=(z.a.f+z.a.i)*P,K=(z.a.j+z.a.g)*P,Ba=(z.a.h-z.a.l)*P):(P=Math.sqrt(Va-ha-ba+1),K=.5*P,P=.5/P,Aa=(z.a.h+z.a.l)*P,ya=(z.a.j+z.a.g)*P,Ba=(z.a.i-z.a.f)*P);Aa=na*Aa+ra*Ba+ka*K-Z*ya;ya=na*ya-ra*K+ka*Ba+Z*Aa;K=na*K+ra*ya-ka*Aa+Z*Ba;Ba=na*Ba-ra*Aa-ka*ya-Z*K;var za=Aa*Aa+ya*ya+K*K+Ba*Ba;1E-32ea){var Pa=ea*ea;Hb=.5*(1-.16666666666666666*Pa+Pa*Pa*.008333333333333333);Kb=1-.5*Pa+Pa*Pa*.041666666666666664}else Hb=Math.sin(ea)/W,Kb=Math.cos(ea);var rb,ob;rb=Ga*Hb;ob=Ea*Hb;var zb,Ab;zb=Ua*Hb;Ab=Kb;var ia,Ta,bb,jb,Bb=x.a.o,La=x.a.m,Eb=x.a.s,Rb=Bb+La+Eb,qa;0La?Bb>Eb?(qa=Math.sqrt(Bb-La-Eb+1),ia=.5*qa,qa=.5/qa,Ta=(x.a.f+x.a.i)*qa,bb=(x.a.h+x.a.l)*qa,jb=(x.a.g-x.a.j)*qa):(qa=Math.sqrt(Eb-Bb-La+1),bb=.5*qa,qa=.5/qa,ia=(x.a.h+x.a.l)*qa,Ta=(x.a.j+x.a.g)*qa,jb=(x.a.i-x.a.f)*qa):La>Eb?(qa=Math.sqrt(La-Eb-Bb+1),Ta=.5*qa,qa=.5/qa,ia=(x.a.f+x.a.i)*qa,bb=(x.a.j+x.a.g)*qa,jb=(x.a.h-x.a.l)*qa):(qa=Math.sqrt(Eb-Bb-La+1),bb=.5*qa,qa=.5/qa,ia=(x.a.h+x.a.l)*qa,Ta=(x.a.j+x.a.g)*qa,jb=(x.a.i-x.a.f)*qa);ia=Ab*ia+rb*jb+ob*bb-zb*Ta;Ta=Ab*Ta-rb*bb+ob*jb+zb*ia;bb=Ab*bb+rb*Ta-ob*ia+zb*jb;jb=Ab*jb-rb*ia-ob*Ta-zb*bb;var Ob=ia*ia+Ta*Ta+bb*bb+jb*jb;1E-32G.maxTranslationPerStep*G.maxTranslationPerStep&&(h=G.maxTranslationPerStep/Math.sqrt(h),this.gb*=h,this.hb*=h,this.ib*=h,b*=h,e*=h,c*=h);l>G.maxRotationPerStep*G.maxRotationPerStep&&(l=G.maxRotationPerStep/Math.sqrt(l),this.kb*=l,this.lb*=l,this.mb*=l,d*=l,f*=l,a*=l);this.a.v+=b;this.a.A+=e;this.a.B+=c;b=Math.sqrt(d*d+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));d*=b;f*=b;a*=b;b=e;e=this.a.o;c=this.a.m;var l=this.a.s,h=e+c+l,g;0c?e>l?(g=Math.sqrt(e-c-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,c=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-c+1),c=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):c>l?(g=Math.sqrt(c-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,c=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-c+1),c=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+d*e+f*c-a*l;l=b*l-d*c+f*e+a*h;c=b*c+d*l-f*h+a*e;e=b*e-d*h-f*l-a*c;a=h*h+l*l+c*c+e*e;1E-32e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));a*=b;d*=b;f*=b;b=e;var h,l;e=this.a.o;c=this.a.m;l=this.a.s;h=e+c+l;var g;0c?e>l?(g=Math.sqrt(e-c-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,c=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-c+1),c=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):c>l?(g=Math.sqrt(c-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,c=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-c+1),c=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+a*e+d*c-f*l;l=b*l-a*c+d*e+f*h;c=b*c+a*l-d*h+f*e;e=b*e-a*h-d*l-f*c;d=h*h+l*l+c*c+e*e;1E-32k||1E-32a.u.ja?f:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(e=a.a.v-a.pa.v,d=a.a.A-a.pa.A,c=a.a.B-a.pa.B,f=a.rc,f.x=e,f.y=d,f.z=c,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=b}this.Gb=!1;this.yb=0},jo:function(a){var b,e;b=a.x;e=a.y;a=a.z;this.a.v+=b;this.a.A+=e;this.a.B+=a;b=this.pa;e=this.a;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;for(b=this.Dc;null!=b;){e=b.M;a=b.pa;var c=b.ha,d=this.pa,f,h,l,g,k,m,n,q,p;f=d.o*c.o+d.f*c.i+d.h*c.l;h=d.o*c.f+d.f*c.m+d.h*c.g;l=d.o*c.h+d.f*c.j+d.h*c.s;g=d.i*c.o+d.m*c.i+d.j*c.l;k=d.i*c.f+d.m*c.m+d.j*c.g;m=d.i*c.h+d.m*c.j+d.j*c.s;n=d.l*c.o+d.g*c.i+d.s*c.l;q=d.l*c.f+d.g*c.m+d.s*c.g;p=d.l*c.h+d.g*c.j+d.s*c.s;a.o=f;a.f=h;a.h=l;a.i=g;a.m=k;a.j=m;a.l=n;a.g=q;a.s=p;f=d.o*c.v+d.f*c.A+d.h*c.B;h=d.i*c.v+d.m*c.A+d.j*c.B;c=d.l*c.v+d.g*c.A+d.s*c.B;a.v=f;a.A=h;a.B=c;a.v+=d.v;a.A+=d.A;a.B+=d.B;a=b.a;c=b.ha;d=this.a;f=d.o*c.o+d.f*c.i+d.h*c.l;h=d.o*c.f+d.f*c.m+d.h*c.g;l=d.o*c.h+d.f*c.j+d.h*c.s;g=d.i*c.o+d.m*c.i+d.j*c.l;k=d.i*c.f+d.m*c.m+d.j*c.g;m=d.i*c.h+d.m*c.j+d.j*c.s;n=d.l*c.o+d.g*c.i+d.s*c.l;q=d.l*c.f+d.g*c.m+d.s*c.g;p=d.l*c.h+d.g*c.j+d.s*c.s;a.o=f;a.f=h;a.h=l;a.i=g;a.m=k;a.j=m;a.l=n;a.g=q;a.s=p;f=d.o*c.v+d.f*c.A+d.h*c.B;h=d.i*c.v+d.m*c.A+d.j*c.B;c=d.l*c.v+d.g*c.A+d.s*c.B;a.v=f;a.A=h;a.B=c;a.v+=d.v;a.A+=d.A;a.B+=d.B;b.Kb.Nb(b.u,b.pa);a=b.u.ma;d=b.u.na;c=b.u.oa;f=b.u.ja;h=b.u.ka;l=b.u.la;b.Kb.Nb(b.u,b.a);b.u.ma=ab.u.ja?f:b.u.ja;b.u.ka=h>b.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;null!=b.tb&&(a=b.a.v-b.pa.v,d=b.a.A-b.pa.A,c=b.a.B-b.pa.B,f=b.rc,f.x=a,f.y=d,f.z=c,b.Yb.oc.jc.wd(b.tb,b.u,b.rc));b=e}this.Gb=!1;this.yb=0},vm:function(){var a=new E;a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s;return a},wm:function(a){a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s},$n:function(a){this.a.o=a.e00;this.a.f=a.e01;this.a.h=a.e02;this.a.i=a.e10;this.a.m=a.e11;this.a.j=a.e12;this.a.l=a.e20;this.a.g=a.e21;this.a.s=a.e22;var b,e,c,d,f,h,l,g;a=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;b=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;e=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;f=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;h=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;l=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;g=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=a;this.R=b;this.S=e;this.T=c;this.U=d;this.V=f;this.W=h;this.X=l;this.Y=g;a=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;b=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;e=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;c=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;d=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;f=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;h=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;l=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;g=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=a;this.R=b;this.S=e;this.T=c;this.U=d;this.V=f;this.W=h;this.X=l;this.Y=g;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;a=this.pa;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Dc;null!=a;){b=a.M;e=a.pa;d=a.ha;c=this.pa;var k,m,n,q,p;f=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;l=c.o*d.h+c.f*d.j+c.h*d.s;g=c.i*d.o+c.m*d.i+c.j*d.l;k=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;n=c.l*d.o+c.g*d.i+c.s*d.l;q=c.l*d.f+c.g*d.m+c.s*d.g;p=c.l*d.h+c.g*d.j+c.s*d.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;e.v=f;e.A=h;e.B=d;e.v+=c.v;e.A+=c.A;e.B+=c.B;e=a.a;d=a.ha;c=this.a;f=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;l=c.o*d.h+c.f*d.j+c.h*d.s;g=c.i*d.o+c.m*d.i+c.j*d.l;k=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;n=c.l*d.o+c.g*d.i+c.s*d.l;q=c.l*d.f+c.g*d.m+c.s*d.g;p=c.l*d.h+c.g*d.j+c.s*d.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;e.v=f;e.A=h;e.B=d;e.v+=c.v;e.A+=c.A;e.B+=c.B;a.Kb.Nb(a.u,a.pa);e=a.u.ma;c=a.u.na;d=a.u.oa;f=a.u.ja;h=a.u.ka;l=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=ea.u.ja?f:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(e=a.a.v-a.pa.v,c=a.a.A-a.pa.A,d=a.a.B-a.pa.B,f=a.rc,f.x=e,f.y=c,f.z=d,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=b}this.Gb=!1;this.yb=0},fo:function(a){var b,e,c;b=a.x;e=a.y;c=a.z;a=Math.sin(b);var d=Math.sin(e),f=Math.sin(c);b=Math.cos(b);e=Math.cos(e);c=Math.cos(c);this.a.o=e*c;this.a.f=-e*f;this.a.h=d;this.a.i=b*f+c*a*d;this.a.m=b*c-a*d*f;this.a.j=-e*a;this.a.l=a*f-b*c*d;this.a.g=c*a+b*d*f;this.a.s=b*e;var h,l,g;a=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;d=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;f=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;c=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;b=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;h=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;l=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;g=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=a;this.R=d;this.S=f;this.T=e;this.U=c;this.V=b;this.W=h;this.X=l;this.Y=g;a=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;d=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;f=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;e=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;c=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;b=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;h=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;l=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;g=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=a;this.R=d;this.S=f;this.T=e;this.U=c;this.V=b;this.W=h;this.X=l;this.Y=g;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;a=this.pa;d=this.a;a.v=d.v;a.A=d.A;a.B=d.B;a.o=d.o;a.f=d.f;a.h=d.h;a.i=d.i;a.m=d.m;a.j=d.j;a.l=d.l;a.g=d.g;a.s=d.s;for(a=this.Dc;null!=a;){d=a.M;f=a.pa;c=a.ha;e=this.pa;var k,m,n,q,p;b=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;n=e.l*c.o+e.g*c.i+e.s*c.l;q=e.l*c.f+e.g*c.m+e.s*c.g;p=e.l*c.h+e.g*c.j+e.s*c.s;f.o=b;f.f=h;f.h=l;f.i=g;f.m=k;f.j=m;f.l=n;f.g=q;f.s=p;b=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;f.v=b;f.A=h;f.B=c;f.v+=e.v;f.A+=e.A;f.B+=e.B;f=a.a;c=a.ha;e=this.a;b=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;n=e.l*c.o+e.g*c.i+e.s*c.l;q=e.l*c.f+e.g*c.m+e.s*c.g;p=e.l*c.h+e.g*c.j+e.s*c.s;f.o=b;f.f=h;f.h=l;f.i=g;f.m=k;f.j=m;f.l=n;f.g=q;f.s=p;b=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;f.v=b;f.A=h;f.B=c;f.v+=e.v;f.A+=e.A;f.B+=e.B;a.Kb.Nb(a.u,a.pa);f=a.u.ma;e=a.u.na;c=a.u.oa;b=a.u.ja;h=a.u.ka;l=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=fa.u.ja?b:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(f=a.a.v-a.pa.v,e=a.a.A-a.pa.A,c=a.a.B-a.pa.B,b=a.rc,b.x=f,b.y=e,b.z=c,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=d}this.Gb=!1;this.yb=0},Em:function(a){var b,e,c,d,f,h,l,g,k;b=a.e00;e=a.e01;c=a.e02;d=a.e10;f=a.e11;h=a.e12;l=a.e20;g=a.e21;k=a.e22;var m;a=b*this.a.o+e*this.a.i+c*this.a.l;m=b*this.a.f+e*this.a.m+c*this.a.g;b=b*this.a.h+e*this.a.j+c*this.a.s;e=d*this.a.o+f*this.a.i+h*this.a.l;c=d*this.a.f+f*this.a.m+h*this.a.g;d=d*this.a.h+f*this.a.j+h*this.a.s;f=l*this.a.o+g*this.a.i+k*this.a.l;h=l*this.a.f+g*this.a.m+k*this.a.g;l=l*this.a.h+g*this.a.j+k*this.a.s;this.a.o=a;this.a.f=m;this.a.h=b;this.a.i=e;this.a.m=c;this.a.j=d;this.a.l=f;this.a.g=h;this.a.s=l;l=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;g=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;a=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;m=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;k=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;b=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=l;this.R=g;this.S=a;this.T=m;this.U=k;this.V=d;this.W=f;this.X=h;this.Y=b;l=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;g=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;a=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;m=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;k=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;d=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;f=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;h=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;b=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=l;this.R=g;this.S=a;this.T=m;this.U=k;this.V=d;this.W=f;this.X=h;this.Y=b;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;l=this.pa;g=this.a;l.v=g.v;l.A=g.A;l.B=g.B;l.o=g.o;l.f=g.f;l.h=g.h;l.i=g.i;l.m=g.m;l.j=g.j;l.l=g.l;l.g=g.g;l.s=g.s;for(l=this.Dc;null!=l;){g=l.M;a=l.pa;k=l.ha;m=this.pa;var n,q,p;d=m.o*k.o+m.f*k.i+m.h*k.l;f=m.o*k.f+m.f*k.m+m.h*k.g;h=m.o*k.h+m.f*k.j+m.h*k.s;b=m.i*k.o+m.m*k.i+m.j*k.l;e=m.i*k.f+m.m*k.m+m.j*k.g;c=m.i*k.h+m.m*k.j+m.j*k.s;n=m.l*k.o+m.g*k.i+m.s*k.l;q=m.l*k.f+m.g*k.m+m.s*k.g;p=m.l*k.h+m.g*k.j+m.s*k.s;a.o=d;a.f=f;a.h=h;a.i=b;a.m=e;a.j=c;a.l=n;a.g=q;a.s=p;d=m.o*k.v+m.f*k.A+m.h*k.B;f=m.i*k.v+m.m*k.A+m.j*k.B;k=m.l*k.v+m.g*k.A+m.s*k.B;a.v=d;a.A=f;a.B=k;a.v+=m.v;a.A+=m.A;a.B+=m.B;a=l.a;k=l.ha;m=this.a;d=m.o*k.o+m.f*k.i+m.h*k.l;f=m.o*k.f+m.f*k.m+m.h*k.g;h=m.o*k.h+m.f*k.j+m.h*k.s;b=m.i*k.o+m.m*k.i+m.j*k.l;e=m.i*k.f+m.m*k.m+m.j*k.g;c=m.i*k.h+m.m*k.j+m.j*k.s;n=m.l*k.o+m.g*k.i+m.s*k.l;q=m.l*k.f+m.g*k.m+m.s*k.g;p=m.l*k.h+m.g*k.j+m.s*k.s;a.o=d;a.f=f;a.h=h;a.i=b;a.m=e;a.j=c;a.l=n;a.g=q;a.s=p;d=m.o*k.v+m.f*k.A+m.h*k.B;f=m.i*k.v+m.m*k.A+m.j*k.B;k=m.l*k.v+m.g*k.A+m.s*k.B;a.v=d;a.A=f;a.B=k;a.v+=m.v;a.A+=m.A;a.B+=m.B;l.Kb.Nb(l.u,l.pa);a=l.u.ma;m=l.u.na;k=l.u.oa;d=l.u.ja;f=l.u.ka;h=l.u.la;l.Kb.Nb(l.u,l.a);l.u.ma=al.u.ja?d:l.u.ja;l.u.ka=f>l.u.ka?f:l.u.ka;l.u.la=h>l.u.la?h:l.u.la;null!=l.tb&&(a=l.a.v-l.pa.v,m=l.a.A-l.pa.A,k=l.a.B-l.pa.B,d=l.rc,d.x=a,d.y=m,d.z=k,l.Yb.oc.jc.wd(l.tb,l.u,l.rc));l=g}this.Gb=!1;this.yb=0},Sn:function(a){var b,e,c,d,f,h,l;b=a.x;e=a.y;a=a.z;h=Math.sin(b);var g=Math.sin(e),k=Math.sin(a),m=Math.cos(b);l=Math.cos(e);var n=Math.cos(a);c=l*n;d=-l*k;a=m*k+n*h*g;b=m*n-h*g*k;f=-l*h;e=h*k-m*n*g;h=n*h+m*g*k;l*=m;k=c*this.a.o+d*this.a.i+g*this.a.l;m=c*this.a.f+d*this.a.m+g*this.a.g;g=c*this.a.h+d*this.a.j+g*this.a.s;c=a*this.a.o+b*this.a.i+f*this.a.l;d=a*this.a.f+b*this.a.m+f*this.a.g;a=a*this.a.h+b*this.a.j+f*this.a.s;b=e*this.a.o+h*this.a.i+l*this.a.l;f=e*this.a.f+h*this.a.m+l*this.a.g;e=e*this.a.h+h*this.a.j+l*this.a.s;this.a.o=k;this.a.f=m;this.a.h=g;this.a.i=c;this.a.m=d;this.a.j=a;this.a.l=b;this.a.g=f;this.a.s=e;e=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;f=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;h=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;g=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;k=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;m=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=e;this.R=a;this.S=b;this.T=f;this.U=h;this.V=g;this.W=k;this.X=m;this.Y=l;e=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;a=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;b=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;f=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;h=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;g=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;k=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;m=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;l=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=e;this.R=a;this.S=b;this.T=f;this.U=h;this.V=g;this.W=k;this.X=m;this.Y=l;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;e=this.pa;a=this.a;e.v=a.v;e.A=a.A;e.B=a.B;e.o=a.o;e.f=a.f;e.h=a.h;e.i=a.i;e.m=a.m;e.j=a.j;e.l=a.l;e.g=a.g;e.s=a.s;for(e=this.Dc;null!=e;){a=e.M;b=e.pa;h=e.ha;f=this.pa;var q,p,g=f.o*h.o+f.f*h.i+f.h*h.l,k=f.o*h.f+f.f*h.m+f.h*h.g,m=f.o*h.h+f.f*h.j+f.h*h.s;l=f.i*h.o+f.m*h.i+f.j*h.l;c=f.i*h.f+f.m*h.m+f.j*h.g;d=f.i*h.h+f.m*h.j+f.j*h.s;n=f.l*h.o+f.g*h.i+f.s*h.l;q=f.l*h.f+f.g*h.m+f.s*h.g;p=f.l*h.h+f.g*h.j+f.s*h.s;b.o=g;b.f=k;b.h=m;b.i=l;b.m=c;b.j=d;b.l=n;b.g=q;b.s=p;g=f.o*h.v+f.f*h.A+f.h*h.B;k=f.i*h.v+f.m*h.A+f.j*h.B;h=f.l*h.v+f.g*h.A+f.s*h.B;b.v=g;b.A=k;b.B=h;b.v+=f.v;b.A+=f.A;b.B+=f.B;b=e.a;h=e.ha;f=this.a;g=f.o*h.o+f.f*h.i+f.h*h.l;k=f.o*h.f+f.f*h.m+f.h*h.g;m=f.o*h.h+f.f*h.j+f.h*h.s;l=f.i*h.o+f.m*h.i+f.j*h.l;c=f.i*h.f+f.m*h.m+f.j*h.g;d=f.i*h.h+f.m*h.j+f.j*h.s;n=f.l*h.o+f.g*h.i+f.s*h.l;q=f.l*h.f+f.g*h.m+f.s*h.g;p=f.l*h.h+f.g*h.j+f.s*h.s;b.o=g;b.f=k;b.h=m;b.i=l;b.m=c;b.j=d;b.l=n;b.g=q;b.s=p;g=f.o*h.v+f.f*h.A+f.h*h.B;k=f.i*h.v+f.m*h.A+f.j*h.B;h=f.l*h.v+f.g*h.A+f.s*h.B;b.v=g;b.A=k;b.B=h;b.v+=f.v;b.A+=f.A;b.B+=f.B;e.Kb.Nb(e.u,e.pa);b=e.u.ma;f=e.u.na;h=e.u.oa;g=e.u.ja;k=e.u.ka;m=e.u.la;e.Kb.Nb(e.u,e.a);e.u.ma=be.u.ja?g:e.u.ja;e.u.ka=k>e.u.ka?k:e.u.ka;e.u.la=m>e.u.la?m:e.u.la;null!=e.tb&&(b=e.a.v-e.pa.v,f=e.a.A-e.pa.A,h=e.a.B-e.pa.B,g=e.rc,g.x=b,g.y=f,g.z=h,e.Yb.oc.jc.wd(e.tb,e.u,e.rc));e=a}this.Gb=!1;this.yb=0},jm:function(){var a=new ta,b,e,c,d;b=this.a.o;e=this.a.m;c=this.a.s;d=b+e+c;var f;0e?b>c?(f=Math.sqrt(b-e-c+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,c=(this.a.h+this.a.l)*f,d=(this.a.g-this.a.j)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,d=(this.a.i-this.a.f)*f):e>c?(f=Math.sqrt(e-c-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,c=(this.a.j+this.a.g)*f,d=(this.a.h-this.a.l)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,d=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=c;a.w=d;return a},lm:function(a){var b,e,c,d;b=this.a.o;e=this.a.m;c=this.a.s;d=b+e+c;var f;0e?b>c?(f=Math.sqrt(b-e-c+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,c=(this.a.h+this.a.l)*f,d=(this.a.g-this.a.j)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,d=(this.a.i-this.a.f)*f):e>c?(f=Math.sqrt(e-c-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,c=(this.a.j+this.a.g)*f,d=(this.a.h-this.a.l)*f):(f=Math.sqrt(c-b-e+1),c=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,d=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=c;a.w=d},Tn:function(a){var b,e,c;b=a.x;e=a.y;c=a.z;var d=a.w,f=2*b,h=2*e,l=2*c;a=b*f;var g=e*h;c*=l;var k=b*h;e*=l;b*=l;f*=d;h*=d;d*=l;this.a.o=1-g-c;this.a.f=k-d;this.a.h=b+h;this.a.i=k+d;this.a.m=1-a-c;this.a.j=e-f;this.a.l=b-h;this.a.g=e+f;this.a.s=1-a-g;a=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;g=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;d=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;l=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;c=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;k=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;h=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;e=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;b=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=a;this.R=g;this.S=d;this.T=l;this.U=c;this.V=k;this.W=h;this.X=e;this.Y=b;a=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;g=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;d=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;l=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;c=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;k=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;h=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;e=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;b=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=a;this.R=g;this.S=d;this.T=l;this.U=c;this.V=k;this.W=h;this.X=e;this.Y=b;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;a=this.pa;g=this.a;a.v=g.v;a.A=g.A;a.B=g.B;a.o=g.o;a.f=g.f;a.h=g.h;a.i=g.i;a.m=g.m;a.j=g.j;a.l=g.l;a.g=g.g;a.s=g.s;for(a=this.Dc;null!=a;){g=a.M;d=a.pa;c=a.ha;var l=this.pa,m,n,q,p,k=l.o*c.o+l.f*c.i+l.h*c.l,h=l.o*c.f+l.f*c.m+l.h*c.g;e=l.o*c.h+l.f*c.j+l.h*c.s;b=l.i*c.o+l.m*c.i+l.j*c.l;f=l.i*c.f+l.m*c.m+l.j*c.g;m=l.i*c.h+l.m*c.j+l.j*c.s;n=l.l*c.o+l.g*c.i+l.s*c.l;q=l.l*c.f+l.g*c.m+l.s*c.g;p=l.l*c.h+l.g*c.j+l.s*c.s;d.o=k;d.f=h;d.h=e;d.i=b;d.m=f;d.j=m;d.l=n;d.g=q;d.s=p;k=l.o*c.v+l.f*c.A+l.h*c.B;h=l.i*c.v+l.m*c.A+l.j*c.B;c=l.l*c.v+l.g*c.A+l.s*c.B;d.v=k;d.A=h;d.B=c;d.v+=l.v;d.A+=l.A;d.B+=l.B;d=a.a;c=a.ha;l=this.a;k=l.o*c.o+l.f*c.i+l.h*c.l;h=l.o*c.f+l.f*c.m+l.h*c.g;e=l.o*c.h+l.f*c.j+l.h*c.s;b=l.i*c.o+l.m*c.i+l.j*c.l;f=l.i*c.f+l.m*c.m+l.j*c.g;m=l.i*c.h+l.m*c.j+l.j*c.s;n=l.l*c.o+l.g*c.i+l.s*c.l;q=l.l*c.f+l.g*c.m+l.s*c.g;p=l.l*c.h+l.g*c.j+l.s*c.s;d.o=k;d.f=h;d.h=e;d.i=b;d.m=f;d.j=m;d.l=n;d.g=q;d.s=p;k=l.o*c.v+l.f*c.A+l.h*c.B;h=l.i*c.v+l.m*c.A+l.j*c.B;c=l.l*c.v+l.g*c.A+l.s*c.B;d.v=k;d.A=h;d.B=c;d.v+=l.v;d.A+=l.A;d.B+=l.B;a.Kb.Nb(a.u,a.pa);d=a.u.ma;l=a.u.na;c=a.u.oa;k=a.u.ja;h=a.u.ka;e=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=da.u.ja?k:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=e>a.u.la?e:a.u.la;null!=a.tb&&(d=a.a.v-a.pa.v,l=a.a.A-a.pa.A,c=a.a.B-a.pa.B,k=a.rc,k.x=d,k.y=l,k.z=c,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=g}this.Gb=!1;this.yb=0},xm:function(){var a=this.a,b=new Ja;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Cm:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},ho:function(a){this.a.v=a.v;this.a.A=a.A;this.a.B=a.B;this.a.o=a.o;this.a.f=a.f;this.a.h=a.h;this.a.i=a.i;this.a.m=a.m;this.a.j=a.j;this.a.l=a.l;this.a.g=a.g;this.a.s=a.s;var b,e,c,d,f,h,l,g;a=this.a.o*this.Ra+this.a.f*this.Ua+this.a.h*this.Xa;b=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;e=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.i*this.Ra+this.a.m*this.Ua+this.a.j*this.Xa;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;f=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;h=this.a.l*this.Ra+this.a.g*this.Ua+this.a.s*this.Xa;l=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;g=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;this.P=a;this.R=b;this.S=e;this.T=c;this.U=d;this.V=f;this.W=h;this.X=l;this.Y=g;a=this.P*this.a.o+this.R*this.a.f+this.S*this.a.h;b=this.P*this.a.i+this.R*this.a.m+this.S*this.a.j;e=this.P*this.a.l+this.R*this.a.g+this.S*this.a.s;c=this.T*this.a.o+this.U*this.a.f+this.V*this.a.h;d=this.T*this.a.i+this.U*this.a.m+this.V*this.a.j;f=this.T*this.a.l+this.U*this.a.g+this.V*this.a.s;h=this.W*this.a.o+this.X*this.a.f+this.Y*this.a.h;l=this.W*this.a.i+this.X*this.a.m+this.Y*this.a.j;g=this.W*this.a.l+this.X*this.a.g+this.Y*this.a.s;this.P=a;this.R=b;this.S=e;this.T=c;this.U=d;this.V=f;this.W=h;this.X=l;this.Y=g;this.P*=this.N.x;this.R*=this.N.x;this.S*=this.N.x;this.T*=this.N.y;this.U*=this.N.y;this.V*=this.N.y;this.W*=this.N.z;this.X*=this.N.z;this.Y*=this.N.z;a=this.pa;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Dc;null!=a;){b=a.M;e=a.pa;d=a.ha;c=this.pa;var k,m,n,q,p;f=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;l=c.o*d.h+c.f*d.j+c.h*d.s;g=c.i*d.o+c.m*d.i+c.j*d.l;k=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;n=c.l*d.o+c.g*d.i+c.s*d.l;q=c.l*d.f+c.g*d.m+c.s*d.g;p=c.l*d.h+c.g*d.j+c.s*d.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;e.v=f;e.A=h;e.B=d;e.v+=c.v;e.A+=c.A;e.B+=c.B;e=a.a;d=a.ha;c=this.a;f=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;l=c.o*d.h+c.f*d.j+c.h*d.s;g=c.i*d.o+c.m*d.i+c.j*d.l;k=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;n=c.l*d.o+c.g*d.i+c.s*d.l;q=c.l*d.f+c.g*d.m+c.s*d.g;p=c.l*d.h+c.g*d.j+c.s*d.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;e.v=f;e.A=h;e.B=d;e.v+=c.v;e.A+=c.A;e.B+=c.B;a.Kb.Nb(a.u,a.pa);e=a.u.ma;c=a.u.na;d=a.u.oa;f=a.u.ja;h=a.u.ka;l=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=ea.u.ja?f:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(e=a.a.v-a.pa.v,c=a.a.A-a.pa.A,d=a.a.B-a.pa.B,f=a.rc,f.x=e,f.y=c,f.z=d,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=b}this.Gb=!1;this.yb=0},Tg:function(){return this.Pc},se:function(){var a=new E;a.e00=this.Ad;a.e01=this.Bd;a.e02=this.Cd;a.e10=this.Dd;a.e11=this.Ed;a.e12=this.Fd;a.e20=this.Gd;a.e21=this.Hd;a.e22=this.Id;return a},te:function(a){a.e00=this.Ad;a.e01=this.Bd;a.e02=this.Cd;a.e10=this.Dd;a.e11=this.Ed;a.e12=this.Fd;a.e20=this.Gd;a.e21=this.Hd;a.e22=this.Id},Ug:function(){var a=new ql;a.mass=this.Pc;var b=a.localInertia;b.e00=this.Ad;b.e01=this.Bd;b.e02=this.Cd;b.e10=this.Dd;b.e11=this.Ed;b.e12=this.Fd;b.e20=this.Gd;b.e21=this.Hd;b.e22=this.Id;return a},Vg:function(a){a.mass=this.Pc;a=a.localInertia;a.e00=this.Ad;a.e01=this.Bd;a.e02=this.Cd;a.e10=this.Dd;a.e11=this.Ed;a.e12=this.Fd;a.e20=this.Gd;a.e21=this.Hd;a.e22=this.Id},Qm:function(a){this.Pc=a.mass;a=a.localInertia;this.Ad=a.e00;this.Bd=a.e01;this.Cd=a.e02;this.Dd=a.e10;this.Ed=a.e11;this.Fd=a.e12;this.Gd=a.e20;this.Hd=a.e21;this.Id=a.e22;a=this.Ad*(this.Ed*this.Id-this.Fd*this.Hd)-this.Bd*(this.Dd*this.Id-this.Fd*this.Gd)+this.Cd*(this.Dd*this.Hd-this.Ed*this.Gd);if(0k||1E-32a.u.ja?f:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(e=a.a.v-a.pa.v,d=a.a.A-a.pa.A,c=a.a.B-a.pa.B,f=a.rc,f.x=e,f.y=d,f.z=c,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=b}},ko:function(a){var b=a.ia,e=a.M;null!=b&&(b.M=e);null!=e&&(e.ia=b);a==this.Dc&&(this.Dc=this.Dc.M);a==this.Fi&&(this.Fi=this.Fi.ia);a.M=null;a.ia=null;this.zg--;a.Yb=null;if(null!=this.oc){b=this.oc;b.jc.Wh(a.tb);a.tb=null;a.Cc=-1;for(var c=a.Yb.Ob;null!=c;){var e=c.M,d=c.Zd;if(d.Zb==a||d.$b==a){c=c.Qc;c.Gb=!1;c.yb=0;var c=b.Kh,f=d.ia,h=d.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);d==c.zd&&(c.zd=c.zd.M);d==c.ye&&(c.ye=c.ye.ia);d.M=null;d.ia=null;d.Td&&(f=d.Zb.yd,h=d.$b.yd,f==h&&(h=null),null!=f&&f.endContact(d),null!=h&&h.endContact(d));f=d.rb.ia;h=d.rb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);d.rb==d.C.Ob&&(d.C.Ob=d.C.Ob.M);d.rb==d.C.kc&&(d.C.kc=d.C.kc.ia);d.rb.M=null;d.rb.ia=null;f=d.sb.ia;h=d.sb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);d.sb==d.D.Ob&&(d.D.Ob=d.D.Ob.M);d.sb==d.D.kc&&(d.D.kc=d.D.kc.ia);d.sb.M=null;d.sb.ia=null;d.C.Ae--;d.D.Ae--;d.rb.Qc=null;d.sb.Qc=null;d.rb.Zd=null;d.sb.Zd=null;d.Zb=null;d.$b=null;d.C=null;d.D=null;d.Td=!1;d.$i.Xe();d.Ja.Xe();d.Lh=null;f=d.Ye;f.Zb=null;f.$b=null;f.C=null;f.D=null;f.pj=null;f.qj=null;d.M=c.lg;c.lg=d;c.Bi--}c=e}b.zg--}this.Oj();for(a=this.Dc;null!=a;){var b=a.M,e=a.pa,c=a.ha,d=this.pa,l,g,k,m,n,q,p,f=d.o*c.o+d.f*c.i+d.h*c.l,h=d.o*c.f+d.f*c.m+d.h*c.g;l=d.o*c.h+d.f*c.j+d.h*c.s;g=d.i*c.o+d.m*c.i+d.j*c.l;k=d.i*c.f+d.m*c.m+d.j*c.g;m=d.i*c.h+d.m*c.j+d.j*c.s;n=d.l*c.o+d.g*c.i+d.s*c.l;q=d.l*c.f+d.g*c.m+d.s*c.g;p=d.l*c.h+d.g*c.j+d.s*c.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=d.o*c.v+d.f*c.A+d.h*c.B;h=d.i*c.v+d.m*c.A+d.j*c.B;c=d.l*c.v+d.g*c.A+d.s*c.B;e.v=f;e.A=h;e.B=c;e.v+=d.v;e.A+=d.A;e.B+=d.B;e=a.a;c=a.ha;d=this.a;f=d.o*c.o+d.f*c.i+d.h*c.l;h=d.o*c.f+d.f*c.m+d.h*c.g;l=d.o*c.h+d.f*c.j+d.h*c.s;g=d.i*c.o+d.m*c.i+d.j*c.l;k=d.i*c.f+d.m*c.m+d.j*c.g;m=d.i*c.h+d.m*c.j+d.j*c.s;n=d.l*c.o+d.g*c.i+d.s*c.l;q=d.l*c.f+d.g*c.m+d.s*c.g;p=d.l*c.h+d.g*c.j+d.s*c.s;e.o=f;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=n;e.g=q;e.s=p;f=d.o*c.v+d.f*c.A+d.h*c.B;h=d.i*c.v+d.m*c.A+d.j*c.B;c=d.l*c.v+d.g*c.A+d.s*c.B;e.v=f;e.A=h;e.B=c;e.v+=d.v;e.A+=d.A;e.B+=d.B;a.Kb.Nb(a.u,a.pa);e=a.u.ma;d=a.u.na;c=a.u.oa;f=a.u.ja;h=a.u.ka;l=a.u.la;a.Kb.Nb(a.u,a.a);a.u.ma=ea.u.ja?f:a.u.ja;a.u.ka=h>a.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;null!=a.tb&&(e=a.a.v-a.pa.v,d=a.a.A-a.pa.A,c=a.a.B-a.pa.B,f=a.rc,f.x=e,f.y=d,f.z=c,a.Yb.oc.jc.wd(a.tb,a.u,a.rc));a=b}},Dm:function(){return this.Lb},Sm:function(a){this.Lb=a;this.Oj()},Um:function(){this.Gb=!1;this.yb=0},Tm:function(){this.Gb=!0;this.yb=0},cm:function(){return this.Gb},li:function(){return this.yb},Mm:function(a){this.Bk=a;this.Gb=!1;this.yb=0},pe:function(){return this.$j},Om:function(a){this.$j=a},Ec:function(){return this.Qj},lo:function(a){this.Qj=a},um:function(){return this.ia},gm:function(){return this.M}};Wa.prototype={uc:function(){return this.Xj},ue:function(a){this.Xj=a},Jc:function(){return this.hk},Ve:function(a){this.hk=a},Ac:function(){var a=this.ha,b=new Ja;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Ec:function(a){var b=this.ha;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},Yd:function(){var a=this.a,b=new Ja;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},pe:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},Ue:function(a){var b=this.ha;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;if(null!=this.Yb)for(a=this.Yb,a.Oj(),b=a.Dc;null!=b;){var e=b.M,c=b.pa,d=b.ha,f=a.pa,h,l,g,k,m,n,q,p,r;h=f.o*d.o+f.f*d.i+f.h*d.l;l=f.o*d.f+f.f*d.m+f.h*d.g;g=f.o*d.h+f.f*d.j+f.h*d.s;k=f.i*d.o+f.m*d.i+f.j*d.l;m=f.i*d.f+f.m*d.m+f.j*d.g;n=f.i*d.h+f.m*d.j+f.j*d.s;q=f.l*d.o+f.g*d.i+f.s*d.l;p=f.l*d.f+f.g*d.m+f.s*d.g;r=f.l*d.h+f.g*d.j+f.s*d.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=f.o*d.v+f.f*d.A+f.h*d.B;l=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;c.v=h;c.A=l;c.B=d;c.v+=f.v;c.A+=f.A;c.B+=f.B;c=b.a;d=b.ha;f=a.a;h=f.o*d.o+f.f*d.i+f.h*d.l;l=f.o*d.f+f.f*d.m+f.h*d.g;g=f.o*d.h+f.f*d.j+f.h*d.s;k=f.i*d.o+f.m*d.i+f.j*d.l;m=f.i*d.f+f.m*d.m+f.j*d.g;n=f.i*d.h+f.m*d.j+f.j*d.s;q=f.l*d.o+f.g*d.i+f.s*d.l;p=f.l*d.f+f.g*d.m+f.s*d.g;r=f.l*d.h+f.g*d.j+f.s*d.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=f.o*d.v+f.f*d.A+f.h*d.B;l=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;c.v=h;c.A=l;c.B=d;c.v+=f.v;c.A+=f.A;c.B+=f.B;b.Kb.Nb(b.u,b.pa);c=b.u.ma;f=b.u.na;d=b.u.oa;h=b.u.ja;l=b.u.ka;g=b.u.la;b.Kb.Nb(b.u,b.a);b.u.ma=cb.u.ja?h:b.u.ja;b.u.ka=l>b.u.ka?l:b.u.ka;b.u.la=g>b.u.la?g:b.u.la;null!=b.tb&&(c=b.a.v-b.pa.v,f=b.a.A-b.pa.A,d=b.a.B-b.pa.B,h=b.rc,h.x=c,h.y=f,h.z=d,b.Yb.oc.jc.wd(b.tb,b.u,b.rc));b=e}},qc:function(){return this.Dk},te:function(a){this.Dk=a;if(null!=this.Yb){a=this.Yb;a.Oj();for(var b=a.Dc;null!=b;){var e=b.M,c=b.pa,d=b.ha,f=a.pa,h,l,g,k,m,n,q,p,r;h=f.o*d.o+f.f*d.i+f.h*d.l;l=f.o*d.f+f.f*d.m+f.h*d.g;g=f.o*d.h+f.f*d.j+f.h*d.s;k=f.i*d.o+f.m*d.i+f.j*d.l;m=f.i*d.f+f.m*d.m+f.j*d.g;n=f.i*d.h+f.m*d.j+f.j*d.s;q=f.l*d.o+f.g*d.i+f.s*d.l;p=f.l*d.f+f.g*d.m+f.s*d.g;r=f.l*d.h+f.g*d.j+f.s*d.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=f.o*d.v+f.f*d.A+f.h*d.B;l=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;c.v=h;c.A=l;c.B=d;c.v+=f.v;c.A+=f.A;c.B+=f.B;c=b.a;d=b.ha;f=a.a;h=f.o*d.o+f.f*d.i+f.h*d.l;l=f.o*d.f+f.f*d.m+f.h*d.g;g=f.o*d.h+f.f*d.j+f.h*d.s;k=f.i*d.o+f.m*d.i+f.j*d.l;m=f.i*d.f+f.m*d.m+f.j*d.g;n=f.i*d.h+f.m*d.j+f.j*d.s;q=f.l*d.o+f.g*d.i+f.s*d.l;p=f.l*d.f+f.g*d.m+f.s*d.g;r=f.l*d.h+f.g*d.j+f.s*d.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=n;c.l=q;c.g=p;c.s=r;h=f.o*d.v+f.f*d.A+f.h*d.B;l=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;c.v=h;c.A=l;c.B=d;c.v+=f.v;c.A+=f.A;c.B+=f.B;b.Kb.Nb(b.u,b.pa);c=b.u.ma;f=b.u.na;d=b.u.oa;h=b.u.ja;l=b.u.ka;g=b.u.la;b.Kb.Nb(b.u,b.a);b.u.ma=cb.u.ja?h:b.u.ja;b.u.ka=l>b.u.ka?l:b.u.ka;b.u.la=g>b.u.la?g:b.u.la;null!=b.tb&&(c=b.a.v-b.pa.v,f=b.a.A-b.pa.A,d=b.a.B-b.pa.B,h=b.rc,h.x=c,h.y=f,h.z=d,b.Yb.oc.jc.wd(b.tb,b.u,b.rc));b=e}}},ua:function(){return this.u.clone()},cb:function(a){a.de(this.u)},vc:function(){return this.Kb},Kc:function(){return this.Yb},Hb:function(){return this.Tj},qe:function(a){this.Tj=a},Mb:function(){return this.Uj},re:function(a){this.Uj=a},pc:function(){return this.yd},se:function(a){this.yd=a},fd:function(){return this.ia},Lc:function(){return this.M}};wh.Ve=1;wh.Mf=2;wh.BRUTE_FORCE=1;wh.BVH=2;Uc.vm=0;Uc.Ue=1;Uc.ji=2;Uc.Ug=3;Uc.Tg=4;Uc.Vg=5;Uc.Xg=0;Uc.Wg=5;Uc.SPHERE=0;Uc.BOX=1;Uc.CYLINDER=2;Uc.CONE=3;Uc.CAPSULE=4;Uc.CONVEX_HULL=5;ij.re=1;Ie.Mb=0;t.numCreations=0;G.defaultFriction=.2;G.defaultRestitution=.2;G.defaultDensity=1;G.defaultCollisionGroup=1;G.defaultCollisionMask=1;G.maxTranslationPerStep=20;G.maxRotationPerStep=3.14159265358979;G.bvhProxyPadding=.1;G.bvhIncrementalCollisionThreshold=.45;G.defaultGJKMargin=.05;G.enableGJKCaching=!0;G.maxEPAVertices=128;G.maxEPAPolyhedronFaces=128;G.contactEnableBounceThreshold=.5;G.velocityBaumgarte=.2;G.positionSplitImpulseBaumgarte=.4;G.positionNgsBaumgarte=1;G.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;G.defaultContactPositionCorrectionAlgorithm=0;G.alternativeContactPositionCorrectionAlgorithm=1;G.contactPersistenceThreshold=.05;G.maxManifoldPoints=4;G.defaultJointConstraintSolverType=0;G.defaultJointPositionCorrectionAlgorithm=0;G.jointWarmStartingFactorForBaungarte=.8;G.jointWarmStartingFactor=.95;G.minSpringDamperDampingRatio=1E-6;G.minRagdollMaxSwingAngle=1E-6;G.maxJacobianRows=6;G.directMlcpSolverEps=1E-9;G.islandInitialRigidBodyArraySize=128;G.islandInitialConstraintArraySize=128;G.sleepingVelocityThreshold=.2;G.sleepingAngularVelocityThreshold=.5;G.sleepingTimeThreshold=1;G.disableSleeping=!1;G.linearSlop=.005;G.angularSlop=.017453292519943278;ec.cb=new ec;Gc.Dm=0;Gc.gm=1;Gc.cm=2;Gc.bm=257;Gc.am=258;Gc.Nl=259;Gc.SUCCEEDED=0;Gc.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;Gc.GJK_DID_NOT_CONVERGE=2;Gc.EPA_FAILED_TO_INIT=257;Gc.EPA_FAILED_TO_ADD_VERTEX=258;Gc.EPA_DID_NOT_CONVERGE=259;E.numCreations=0;O.numCreations=0;Oa.POSITIVE_INFINITY=1/0;Oa.NEGATIVE_INFINITY=-1/0;Oa.PI=3.14159265358979;Oa.TWO_PI=6.28318530717958;Oa.HALF_PI=1.570796326794895;Oa.TO_RADIANS=.017453292519943278;Oa.TO_DEGREES=57.29577951308238;ta.numCreations=0;gf.se=8;gf.te=4;gf.qe=8;Ad.broadPhaseCollisionTime=0;Ad.narrowPhaseCollisionTime=0;Ad.dynamicsTime=0;Ad.totalTime=0;Hb.ue=0;Hb.xm=1;Hb.lm=2;Hb.BAUMGARTE=0;Hb.SPLIT_IMPULSE=1;Hb.NGS=2;be.pe=1;be.Yd=2;rc.wm=0;rc.um=1;rc.ki=2;rc.qm=3;rc.Em=4;rc.rm=5;rc.SPHERICAL=0;rc.REVOLUTE=1;rc.CYLINDRICAL=2;rc.PRISMATIC=3;rc.UNIVERSAL=4;rc.RAGDOLL=5;Fe.im=0;Fe.li=1;Fe.ITERATIVE=0;Fe.DIRECT=1;Rd.Pj=0;Rd.Cm=1;Rd.jm=2;Rd.DYNAMIC=0;Rd.STATIC=1;Rd.KINEMATIC=2;S.OIMO={};S.OIMO.DebugDraw=gf;S.OIMO.BroadPhase=wb;wb.prototype.createProxy=wb.prototype.Vh;wb.prototype.destroyProxy=wb.prototype.Wh;wb.prototype.moveProxy=wb.prototype.wd;wb.prototype.isOverlapping=wb.prototype.Mb;wb.prototype.collectPairs=wb.prototype.Ii;wb.prototype.getProxyPairList=wb.prototype.ua;wb.prototype.isIncremental=wb.prototype.Hb;wb.prototype.getTestCount=wb.prototype.cb;wb.prototype.rayCast=wb.prototype.Vd;wb.prototype.convexCast=wb.prototype.Bf;wb.prototype.aabbTest=wb.prototype.qh;S.OIMO.Geometry=fd;fd.prototype.getType=fd.prototype.cb;fd.prototype.getVolume=fd.prototype.ua;fd.prototype.rayCast=fd.prototype.Vd;S.OIMO.ConvexGeometry=tb;tb.prototype.getGjkMergin=tb.prototype.un;tb.prototype.setGjkMergin=tb.prototype.Zn;tb.prototype.computeLocalSupportingVertex=tb.prototype.Pd;tb.prototype.rayCast=tb.prototype.Vd;S.OIMO.BroadPhaseProxyCallback=Mc;Mc.prototype.process=Mc.prototype.process;S.OIMO.BroadPhaseType=wh;S.OIMO.Proxy=ad;ad.prototype.getId=ad.prototype.Hb;ad.prototype.getFatAabb=ad.prototype.ua;ad.prototype.getFatAabbTo=ad.prototype.cb;S.OIMO.ProxyPair=Be;Be.prototype.getProxy1=Be.prototype.ua;Be.prototype.getProxy2=Be.prototype.cb;Be.prototype.getNext=Be.prototype.Hb;S.OIMO.BruteForceBroadPhase=oc;oc.prototype.createProxy=oc.prototype.Vh;oc.prototype.destroyProxy=oc.prototype.Wh;oc.prototype.moveProxy=oc.prototype.wd;oc.prototype.collectPairs=oc.prototype.Ii;oc.prototype.rayCast=oc.prototype.Vd;oc.prototype.convexCast=oc.prototype.Bf;oc.prototype.aabbTest=oc.prototype.qh;S.OIMO.BvhBroadPhase=hc;hc.prototype.createProxy=hc.prototype.Vh;hc.prototype.destroyProxy=hc.prototype.Wh;hc.prototype.moveProxy=hc.prototype.wd;hc.prototype.collectPairs=hc.prototype.Ii;hc.prototype.rayCast=hc.prototype.Vd;hc.prototype.convexCast=hc.prototype.Bf;hc.prototype.aabbTest=hc.prototype.qh;hc.prototype.getTreeBalance=hc.prototype.Jn;S.OIMO.Aabb=Xa;Xa.prototype.init=Xa.prototype.za;Xa.prototype.getMin=Xa.prototype.Jc;Xa.prototype.getMinTo=Xa.prototype.Kc;Xa.prototype.setMin=Xa.prototype.Yd;Xa.prototype.getMax=Xa.prototype.Ac;Xa.prototype.getMaxTo=Xa.prototype.Ec;Xa.prototype.setMax=Xa.prototype.fd;Xa.prototype.getCenter=Xa.prototype.Hb;Xa.prototype.getCenterTo=Xa.prototype.Mb;Xa.prototype.getExtents=Xa.prototype.pc;Xa.prototype.getExtentsTo=Xa.prototype.qc;Xa.prototype.combine=Xa.prototype.ua;Xa.prototype.combined=Xa.prototype.cb;Xa.prototype.overlap=Xa.prototype.Lc;Xa.prototype.getIntersection=Xa.prototype.uc;Xa.prototype.getIntersectionTo=Xa.prototype.vc;Xa.prototype.copyFrom=Xa.prototype.de;Xa.prototype.clone=Xa.prototype.clone;S.OIMO.BoxGeometry=me;me.prototype.getHalfExtents=me.prototype.vn;me.prototype.getHalfExtentsTo=me.prototype.wn;me.prototype.computeLocalSupportingVertex=me.prototype.Pd;S.OIMO.CapsuleGeometry=ee;ee.prototype.getRadius=ee.prototype.Xh;ee.prototype.getHalfHeight=ee.prototype.Bj;ee.prototype.computeLocalSupportingVertex=ee.prototype.Pd;S.OIMO.ConeGeometry=Vd;Vd.prototype.getRadius=Vd.prototype.Xh;Vd.prototype.getHalfHeight=Vd.prototype.Bj;Vd.prototype.computeLocalSupportingVertex=Vd.prototype.Pd;S.OIMO.ConvexHullGeometry=le;le.prototype.getVertices=le.prototype.Nn;le.prototype.computeLocalSupportingVertex=le.prototype.Pd;S.OIMO.CylinderGeometry=Ud;Ud.prototype.getRadius=Ud.prototype.Xh;Ud.prototype.getHalfHeight=Ud.prototype.Bj;Ud.prototype.computeLocalSupportingVertex=Ud.prototype.Pd;S.OIMO.GeometryType=Uc;S.OIMO.RayCastHit=fj;S.OIMO.SphereGeometry=Td;Td.prototype.getRadius=Td.prototype.Xh;Td.prototype.computeLocalSupportingVertex=Td.prototype.Pd;S.OIMO.CollisionMatrix=dg;dg.prototype.getDetector=dg.prototype.ua;S.OIMO.DetectorResult=ce;ce.prototype.getMaxDepth=ce.prototype.mm;ce.prototype.clear=ce.prototype.clear;S.OIMO.DetectorResultPoint=ll;S.OIMO.Detector=Tc;Tc.prototype.detect=Tc.prototype.hm;S.OIMO.BoxBoxDetector=ij;S.OIMO.CapsuleCapsuleDetector=hj;S.OIMO.GjkEpaDetector=gj;S.OIMO.SphereBoxDetector=Sg;S.OIMO.SphereCapsuleDetector=Sf;S.OIMO.SphereSphereDetector=Fk;S.OIMO.Vec3=t;t.prototype.init=t.prototype.za;t.prototype.zero=t.prototype.Z;t.prototype.add=t.prototype.Lc;t.prototype.addScaled=t.prototype.ua;t.prototype.sub=t.prototype.ue;t.prototype.scale=t.prototype.se;t.prototype.scale3=t.prototype.Ve;t.prototype.dot=t.prototype.Yd;t.prototype.cross=t.prototype.Hb;t.prototype.addEq=t.prototype.fd;t.prototype.addScaledEq=t.prototype.cb;t.prototype.subEq=t.prototype.Ue;t.prototype.scaleEq=t.prototype.te;t.prototype.scale3Eq=t.prototype.Mf;t.prototype.crossEq=t.prototype.Mb;t.prototype.mulMat3=t.prototype.pc;t.prototype.mulMat4=t.prototype.uc;t.prototype.mulTransform=t.prototype.Ac;t.prototype.mulMat3Eq=t.prototype.qc;t.prototype.mulMat4Eq=t.prototype.vc;t.prototype.mulTransformEq=t.prototype.Ec;t.prototype.length=t.prototype.length;t.prototype.lengthSq=t.prototype.pe;t.prototype.normalized=t.prototype.re;t.prototype.normalize=t.prototype.qe;t.prototype.negate=t.prototype.Jc;t.prototype.negateEq=t.prototype.Kc;t.prototype.copyFrom=t.prototype.de;t.prototype.clone=t.prototype.clone;t.prototype.toString=t.prototype.toString;S.OIMO.Transform=Ja;Ja.prototype.identity=Ja.prototype.Wf;Ja.prototype.getPosition=Ja.prototype.Hb;Ja.prototype.getPositionTo=Ja.prototype.Mb;Ja.prototype.setPosition=Ja.prototype.Ec;Ja.prototype.translate=Ja.prototype.Lc;Ja.prototype.getRotation=Ja.prototype.pc;Ja.prototype.getRotationTo=Ja.prototype.qc;Ja.prototype.setRotation=Ja.prototype.Jc;Ja.prototype.setRotationXyz=Ja.prototype.Kc;Ja.prototype.rotate=Ja.prototype.uc;Ja.prototype.rotateXyz=Ja.prototype.vc;Ja.prototype.getOrientation=Ja.prototype.ua;Ja.prototype.getOrientationTo=Ja.prototype.cb;Ja.prototype.setOrientation=Ja.prototype.Ac;Ja.prototype.clone=Ja.prototype.clone;Ja.prototype.copyFrom=Ja.prototype.de;S.OIMO.Setting=G;S.OIMO.GjkEpa=ec;ec.prototype.computeClosestPoints=ec.prototype.ua;ec.prototype.computeDistance=ec.prototype.cb;ec.prototype.convexCast=ec.prototype.Bf;ec.prototype.rayCast=ec.prototype.Vd;ec.getInstance=ec.pc;S.OIMO.GjkEpaResultState=Gc;S.OIMO.SimplexUtil=de;de.projectOrigin2=de.qc;de.projectOrigin3=de.uc;de.projectOrigin4=de.vc;S.OIMO.Mat3=E;E.prototype.init=E.prototype.za;E.prototype.identity=E.prototype.Wf;E.prototype.add=E.prototype.Ac;E.prototype.sub=E.prototype.Ug;E.prototype.scale=E.prototype.Mf;E.prototype.mul=E.prototype.re;E.prototype.addEq=E.prototype.Ec;E.prototype.subEq=E.prototype.Vg;E.prototype.scaleEq=E.prototype.Tg;E.prototype.mulEq=E.prototype.se;E.prototype.prependScale=E.prototype.Ue;E.prototype.appendScale=E.prototype.Lc;E.prototype.prependRotation=E.prototype.te;E.prototype.appendRotation=E.prototype.Jc;E.prototype.prependScaleEq=E.prototype.Ve;E.prototype.appendScaleEq=E.prototype.fd;E.prototype.prependRotationEq=E.prototype.ue;E.prototype.appendRotationEq=E.prototype.Kc;E.prototype.transpose=E.prototype.ji;E.prototype.transposeEq=E.prototype.ki;E.prototype.determinant=E.prototype.Yd;E.prototype.trace=E.prototype.Xg;E.prototype.inverse=E.prototype.pe;E.prototype.inverseEq=E.prototype.qe;E.prototype.toArray=E.prototype.Wg;E.prototype.copyFrom=E.prototype.de;E.prototype.clone=E.prototype.clone;E.prototype.fromQuat=E.prototype.Hb;E.prototype.toQuat=E.prototype.Pj;E.prototype.fromEulerXyz=E.prototype.cb;E.prototype.toEulerXyz=E.prototype.li;E.prototype.getRow=E.prototype.uc;E.prototype.getCol=E.prototype.pc;E.prototype.getRowTo=E.prototype.vc;E.prototype.getColTo=E.prototype.qc;E.prototype.fromRows=E.prototype.Mb;E.prototype.fromCols=E.prototype.ua;E.prototype.toString=E.prototype.toString;S.OIMO.Mat4=O;O.prototype.init=O.prototype.za;O.prototype.identity=O.prototype.Wf;O.prototype.add=O.prototype.pc;O.prototype.sub=O.prototype.Mf;O.prototype.scale=O.prototype.Ue;O.prototype.mul=O.prototype.Yd;O.prototype.addEq=O.prototype.qc;O.prototype.subEq=O.prototype.Tg;O.prototype.scaleEq=O.prototype.Ve;O.prototype.mulEq=O.prototype.pe;O.prototype.prependScale=O.prototype.te;O.prototype.appendScale=O.prototype.Ac;O.prototype.prependRotation=O.prototype.re;O.prototype.appendRotation=O.prototype.uc;O.prototype.prependTranslation=O.prototype.ki;O.prototype.appendTranslation=O.prototype.ua;O.prototype.prependScaleEq=O.prototype.ue;O.prototype.appendScaleEq=O.prototype.Ec;O.prototype.prependRotationEq=O.prototype.se;O.prototype.appendRotationEq=O.prototype.vc;O.prototype.prependTranslationEq=O.prototype.li;O.prototype.appendTranslationEq=O.prototype.cb;O.prototype.transpose=O.prototype.Wg;O.prototype.transposeEq=O.prototype.Xg;O.prototype.determinant=O.prototype.Jc;O.prototype.trace=O.prototype.Vg;O.prototype.inverse=O.prototype.Lc;O.prototype.inverseEq=O.prototype.fd;O.prototype.lookAt=O.prototype.Mb;O.prototype.perspective=O.prototype.qe;O.prototype.ortho=O.prototype.ji;O.prototype.toArray=O.prototype.Ug;O.prototype.copyFrom=O.prototype.de;O.prototype.fromMat3=O.prototype.Kc;O.prototype.fromTransform=O.prototype.Hb;O.prototype.clone=O.prototype.clone;O.prototype.toString=O.prototype.toString;S.OIMO.MathUtil=Oa;Oa.abs=Oa.abs;Oa.sin=Oa.sin;Oa.cos=Oa.cos;Oa.tan=Oa.tan;Oa.asin=Oa.asin;Oa.acos=Oa.acos;Oa.atan=Oa.atan;Oa.safeAsin=Oa.fd;Oa.safeAcos=Oa.Lc;Oa.atan2=Oa.atan2;Oa.sqrt=Oa.sqrt;Oa.clamp=Oa.Hb;Oa.rand=Oa.Ac;Oa.randIn=Oa.Ec;Oa.randVec3In=Oa.Kc;Oa.randVec3=Oa.Jc;S.OIMO.Pool=$b;$b.prototype.vec3=$b.prototype.Ac;$b.prototype.mat3=$b.prototype.qc;$b.prototype.mat4=$b.prototype.uc;$b.prototype.quat=$b.prototype.vc;$b.prototype.dispose=$b.prototype.ua;$b.prototype.disposeVec3=$b.prototype.pc;$b.prototype.disposeMat3=$b.prototype.cb;$b.prototype.disposeMat4=$b.prototype.Hb;$b.prototype.disposeQuat=$b.prototype.Mb;S.OIMO.Quat=ta;ta.prototype.identity=ta.prototype.Wf;ta.prototype.init=ta.prototype.za;ta.prototype.add=ta.prototype.ua;ta.prototype.sub=ta.prototype.Ec;ta.prototype.scale=ta.prototype.vc;ta.prototype.addEq=ta.prototype.cb;ta.prototype.subEq=ta.prototype.Jc;ta.prototype.scaleEq=ta.prototype.Ac;ta.prototype.length=ta.prototype.length;ta.prototype.lengthSq=ta.prototype.pc;ta.prototype.dot=ta.prototype.Hb;ta.prototype.normalized=ta.prototype.uc;ta.prototype.normalize=ta.prototype.qc;ta.prototype.setArc=ta.prototype.Kc;ta.prototype.slerp=ta.prototype.Lc;ta.prototype.copyFrom=ta.prototype.de;ta.prototype.clone=ta.prototype.clone;ta.prototype.fromMat3=ta.prototype.Mb;ta.prototype.toMat3=ta.prototype.fd;ta.prototype.toString=ta.prototype.toString;S.OIMO.Contact=Rb;Rb.prototype.getShape1=Rb.prototype.pc;Rb.prototype.getShape2=Rb.prototype.qc;Rb.prototype.isTouching=Rb.prototype.sk;Rb.prototype.getManifold=Rb.prototype.cb;Rb.prototype.getContactConstraint=Rb.prototype.ua;Rb.prototype.getPrev=Rb.prototype.Mb;Rb.prototype.getNext=Rb.prototype.Hb;S.OIMO.ContactLink=ed;ed.prototype.getContact=ed.prototype.ua;ed.prototype.getOther=ed.prototype.Hb;ed.prototype.getPrev=ed.prototype.Mb;ed.prototype.getNext=ed.prototype.cb;S.OIMO.ContactManager=He;He.prototype.getNumContacts=He.prototype.cb;He.prototype.getContactList=He.prototype.ua;S.OIMO.TimeStep=Al;S.OIMO.World=Ma;Ma.prototype.step=Ma.prototype.pe;Ma.prototype.addRigidBody=Ma.prototype.cb;Ma.prototype.removeRigidBody=Ma.prototype.qe;Ma.prototype.addJoint=Ma.prototype.ua;Ma.prototype.removeJoint=Ma.prototype.Kl;Ma.prototype.setDebugDraw=Ma.prototype.re;Ma.prototype.getDebugDraw=Ma.prototype.qc;Ma.prototype.debugDraw=Ma.prototype.Hb;Ma.prototype.rayCast=Ma.prototype.Vd;Ma.prototype.convexCast=Ma.prototype.Bf;Ma.prototype.aabbTest=Ma.prototype.qh;Ma.prototype.getRigidBodyList=Ma.prototype.fd;Ma.prototype.getJointList=Ma.prototype.vc;Ma.prototype.getBroadPhase=Ma.prototype.Mb;Ma.prototype.getContactManager=Ma.prototype.pc;Ma.prototype.getNumRigidBodies=Ma.prototype.Kc;Ma.prototype.getNumJoints=Ma.prototype.Ec;Ma.prototype.getNumShapes=Ma.prototype.Yd;Ma.prototype.getNumIslands=Ma.prototype.Ac;Ma.prototype.getNumVelocityIterations=Ma.prototype.Lc;Ma.prototype.setNumVelocityIterations=Ma.prototype.ue;Ma.prototype.getNumPositionIterations=Ma.prototype.Jc;Ma.prototype.setNumPositionIterations=Ma.prototype.te;Ma.prototype.getGravity=Ma.prototype.uc;Ma.prototype.setGravity=Ma.prototype.se;S.OIMO.AabbTestCallback=yl;S.OIMO.ContactCallback=fl;S.OIMO.RayCastCallback=ej;S.OIMO.RayCastClosest=hf;hf.prototype.clear=hf.prototype.clear;hf.prototype.process=hf.prototype.process;S.OIMO.DebugDrawStyle=xl;S.OIMO.Performance=Ad;S.OIMO.ConstraintSolver=Ob;Ob.prototype.preSolveVelocity=Ob.prototype.xh;Ob.prototype.warmStart=Ob.prototype.Gh;Ob.prototype.solveVelocity=Ob.prototype.Ch;Ob.prototype.postSolveVelocity=Ob.prototype.Li;Ob.prototype.preSolvePosition=Ob.prototype.Pg;Ob.prototype.solvePositionSplitImpulse=Ob.prototype.Bh;Ob.prototype.solvePositionNgs=Ob.prototype.Ah;Ob.prototype.postSolve=Ob.prototype.postSolve;S.OIMO.PositionCorrectionAlgorithm=Hb;S.OIMO.ContactConstraint=zd;zd.prototype.getShape1=zd.prototype.cb;zd.prototype.getShape2=zd.prototype.Hb;zd.prototype.getManifold=zd.prototype.ua;zd.prototype.isTouching=zd.prototype.sk;S.OIMO.Manifold=ic;ic.prototype.getNormal=ic.prototype.Hb;ic.prototype.getNormalTo=ic.prototype.Mb;ic.prototype.getTangent=ic.prototype.uc;ic.prototype.getTangentTo=ic.prototype.vc;ic.prototype.getBinormal=ic.prototype.ua;ic.prototype.getBinormalTo=ic.prototype.cb;ic.prototype.getPoints=ic.prototype.qc;ic.prototype.getNumPoints=ic.prototype.pc;S.OIMO.ManifoldPoint=Xb;Xb.prototype.getPosition1=Xb.prototype.Mb;Xb.prototype.getPosition1To=Xb.prototype.pc;Xb.prototype.getPosition2=Xb.prototype.qc;Xb.prototype.getPosition2To=Xb.prototype.uc;Xb.prototype.getDepth=Xb.prototype.cb;Xb.prototype.isWarmStarted=Xb.prototype.Ac;Xb.prototype.getNormalImpulse=Xb.prototype.Hb;Xb.prototype.getTangentImpulse=Xb.prototype.vc;Xb.prototype.getBinormalImpulse=Xb.prototype.ua;Xb.prototype.isEnabled=Xb.prototype.Ec;S.OIMO.Joint=V;V.prototype.getRigidBody1=V.prototype.ue;V.prototype.getRigidBody2=V.prototype.Ue;V.prototype.getType=V.prototype.Tg;V.prototype.getAnchor1=V.prototype.cb;V.prototype.getAnchor2=V.prototype.Mb;V.prototype.getAnchor1To=V.prototype.Hb;V.prototype.getAnchor2To=V.prototype.pc;V.prototype.getLocalAnchor1=V.prototype.pe;V.prototype.getLocalAnchor2=V.prototype.re;V.prototype.getLocalAnchor1To=V.prototype.qe;V.prototype.getLocalAnchor2To=V.prototype.se;V.prototype.getBasis1=V.prototype.Ec;V.prototype.getBasis2=V.prototype.Kc;V.prototype.getBasis1To=V.prototype.Jc;V.prototype.getBasis2To=V.prototype.Lc;V.prototype.getAllowCollision=V.prototype.ua;V.prototype.setAllowCollision=V.prototype.Ug;V.prototype.getBreakForce=V.prototype.fd;V.prototype.setBreakForce=V.prototype.Vg;V.prototype.getBreakTorque=V.prototype.Yd;V.prototype.setBreakTorque=V.prototype.Wg;V.prototype.getPositionCorrectionAlgorithm=V.prototype.te;V.prototype.setPositionCorrectionAlgorithm=V.prototype.Xg;V.prototype.getAppliedForce=V.prototype.qc;V.prototype.getAppliedForceTo=V.prototype.uc;V.prototype.getAppliedTorque=V.prototype.vc;V.prototype.getAppliedTorqueTo=V.prototype.Ac;V.prototype.getPrev=V.prototype.Mf;V.prototype.getNext=V.prototype.Ve;S.OIMO.CylindricalJoint=Cb;Cb.prototype.getAxis1=Cb.prototype.Eg;Cb.prototype.getAxis2=Cb.prototype.Gg;Cb.prototype.getAxis1To=Cb.prototype.Fg;Cb.prototype.getAxis2To=Cb.prototype.Hg;Cb.prototype.getLocalAxis1=Cb.prototype.Ig;Cb.prototype.getLocalAxis2=Cb.prototype.Kg;Cb.prototype.getLocalAxis1To=Cb.prototype.Jg;Cb.prototype.getLocalAxis2To=Cb.prototype.Lg;Cb.prototype.getTranslationalSpringDamper=Cb.prototype.In;Cb.prototype.getRotationalSpringDamper=Cb.prototype.An;Cb.prototype.getTranslationalLimitMotor=Cb.prototype.Hn;Cb.prototype.getRotationalLimitMotor=Cb.prototype.zn;Cb.prototype.getAngle=Cb.prototype.ol;Cb.prototype.getTranslation=Cb.prototype.rl;S.OIMO.JointConfig=kc;S.OIMO.CylindricalJointConfig=Ge;Ge.prototype.init=Ge.prototype.za;S.OIMO.JointLink=Xc;Xc.prototype.getContact=Xc.prototype.ua;Xc.prototype.getOther=Xc.prototype.Hb;Xc.prototype.getPrev=Xc.prototype.Mb;Xc.prototype.getNext=Xc.prototype.cb;S.OIMO.JointType=rc;S.OIMO.PrismaticJoint=Kb;Kb.prototype.getAxis1=Kb.prototype.Eg;Kb.prototype.getAxis2=Kb.prototype.Gg;Kb.prototype.getAxis1To=Kb.prototype.Fg;Kb.prototype.getAxis2To=Kb.prototype.Hg;Kb.prototype.getLocalAxis1=Kb.prototype.Ig;Kb.prototype.getLocalAxis2=Kb.prototype.Kg;Kb.prototype.getLocalAxis1To=Kb.prototype.Jg;Kb.prototype.getLocalAxis2To=Kb.prototype.Lg;Kb.prototype.getSpringDamper=Kb.prototype.Cj;Kb.prototype.getLimitMotor=Kb.prototype.ql;Kb.prototype.getTranslation=Kb.prototype.rl;S.OIMO.PrismaticJointConfig=cg;cg.prototype.init=cg.prototype.za;S.OIMO.RagdollJoint=ab;ab.prototype.getAxis1=ab.prototype.Eg;ab.prototype.getAxis2=ab.prototype.Gg;ab.prototype.getAxis1To=ab.prototype.Fg;ab.prototype.getAxis2To=ab.prototype.Hg;ab.prototype.getLocalAxis1=ab.prototype.Ig;ab.prototype.getLocalAxis2=ab.prototype.Kg;ab.prototype.getLocalAxis1To=ab.prototype.Jg;ab.prototype.getLocalAxis2To=ab.prototype.Lg;ab.prototype.getTwistSpringDamper=ab.prototype.Mn;ab.prototype.getTwistLimitMotor=ab.prototype.Ln;ab.prototype.getSwingSpringDamper=ab.prototype.Gn;ab.prototype.getSwingAxis=ab.prototype.En;ab.prototype.getSwingAxisTo=ab.prototype.Fn;ab.prototype.getSwingAngle=ab.prototype.Dn;ab.prototype.getTwistAngle=ab.prototype.Kn;S.OIMO.RagdollJointConfig=Rf;Rf.prototype.init=Rf.prototype.za;S.OIMO.RevoluteJoint=Jb;Jb.prototype.getAxis1=Jb.prototype.Eg;Jb.prototype.getAxis2=Jb.prototype.Gg;Jb.prototype.getAxis1To=Jb.prototype.Fg;Jb.prototype.getAxis2To=Jb.prototype.Hg;Jb.prototype.getLocalAxis1=Jb.prototype.Ig;Jb.prototype.getLocalAxis2=Jb.prototype.Kg;Jb.prototype.getLocalAxis1To=Jb.prototype.Jg;Jb.prototype.getLocalAxis2To=Jb.prototype.Lg;Jb.prototype.getSpringDamper=Jb.prototype.Cj;Jb.prototype.getLimitMotor=Jb.prototype.ql;Jb.prototype.getAngle=Jb.prototype.ol;S.OIMO.RevoluteJointConfig=Ef;Ef.prototype.init=Ef.prototype.za;S.OIMO.RotationalLimitMotor=ac;ac.prototype.setLimits=ac.prototype.ua;ac.prototype.setMotor=ac.prototype.cb;ac.prototype.clone=ac.prototype.clone;S.OIMO.SphericalJoint=Sd;Sd.prototype.getSpringDamper=Sd.prototype.Cj;S.OIMO.SphericalJointConfig=bg;bg.prototype.init=bg.prototype.za;S.OIMO.SpringDamper=Wb;Wb.prototype.setSpring=Wb.prototype.ua;Wb.prototype.setSymplecticEuler=Wb.prototype.cb;Wb.prototype.clone=Wb.prototype.clone;S.OIMO.TranslationalLimitMotor=yd;yd.prototype.setLimits=yd.prototype.ua;yd.prototype.setMotor=yd.prototype.cb;yd.prototype.clone=yd.prototype.clone;S.OIMO.UniversalJoint=hb;hb.prototype.getAxis1=hb.prototype.Eg;hb.prototype.getAxis2=hb.prototype.Gg;hb.prototype.getAxis1To=hb.prototype.Fg;hb.prototype.getAxis2To=hb.prototype.Hg;hb.prototype.getLocalAxis1=hb.prototype.Ig;hb.prototype.getLocalAxis2=hb.prototype.Kg;hb.prototype.getLocalAxis1To=hb.prototype.Jg;hb.prototype.getLocalAxis2To=hb.prototype.Lg;hb.prototype.getSpringDamper1=hb.prototype.Bn;hb.prototype.getSpringDamper2=hb.prototype.Cn;hb.prototype.getLimitMotor1=hb.prototype.xn;hb.prototype.getLimitMotor2=hb.prototype.yn;hb.prototype.getAngle1=hb.prototype.sn;hb.prototype.getAngle2=hb.prototype.tn;S.OIMO.UniversalJointConfig=rf;rf.prototype.init=rf.prototype.za;S.OIMO.ConstraintSolverType=Fe;S.OIMO.DirectJointConstraintSolver=vc;vc.prototype.preSolveVelocity=vc.prototype.xh;vc.prototype.warmStart=vc.prototype.Gh;vc.prototype.solveVelocity=vc.prototype.Ch;vc.prototype.postSolveVelocity=vc.prototype.Li;vc.prototype.preSolvePosition=vc.prototype.Pg;vc.prototype.solvePositionSplitImpulse=vc.prototype.Bh;vc.prototype.solvePositionNgs=vc.prototype.Ah;vc.prototype.postSolve=vc.prototype.postSolve;S.OIMO.PgsContactConstraintSolver=nc;nc.prototype.preSolveVelocity=nc.prototype.xh;nc.prototype.warmStart=nc.prototype.Gh;nc.prototype.solveVelocity=nc.prototype.Ch;nc.prototype.preSolvePosition=nc.prototype.Pg;nc.prototype.solvePositionSplitImpulse=nc.prototype.Bh;nc.prototype.solvePositionNgs=nc.prototype.Ah;nc.prototype.postSolve=nc.prototype.postSolve;S.OIMO.PgsJointConstraintSolver=mc;mc.prototype.preSolveVelocity=mc.prototype.xh;mc.prototype.warmStart=mc.prototype.Gh;mc.prototype.solveVelocity=mc.prototype.Ch;mc.prototype.postSolveVelocity=mc.prototype.Li;mc.prototype.preSolvePosition=mc.prototype.Pg;mc.prototype.solvePositionSplitImpulse=mc.prototype.Bh;mc.prototype.solvePositionNgs=mc.prototype.Ah;mc.prototype.postSolve=mc.prototype.postSolve;S.OIMO.MassData=ql;S.OIMO.RigidBody=u;u.prototype.getPosition=u.prototype.qm;u.prototype.getPositionTo=u.prototype.rm;u.prototype.setPosition=u.prototype.Xn;u.prototype.translate=u.prototype.jo;u.prototype.getRotation=u.prototype.vm;u.prototype.getRotationTo=u.prototype.wm;u.prototype.setRotation=u.prototype.$n;u.prototype.setRotationXyz=u.prototype.fo;u.prototype.rotate=u.prototype.Em;u.prototype.rotateXyz=u.prototype.Sn;u.prototype.getOrientation=u.prototype.jm;u.prototype.getOrientationTo=u.prototype.lm;u.prototype.setOrientation=u.prototype.Tn;u.prototype.getTransform=u.prototype.xm;u.prototype.getTransformTo=u.prototype.Cm;u.prototype.setTransform=u.prototype.ho;u.prototype.getMass=u.prototype.Tg;u.prototype.getLocalInertia=u.prototype.se;u.prototype.getLocalInertiaTo=u.prototype.te;u.prototype.getMassData=u.prototype.Ug;u.prototype.getMassDataTo=u.prototype.Vg;u.prototype.setMassData=u.prototype.Qm;u.prototype.getRotationFactor=u.prototype.ji;u.prototype.setRotationFactor=u.prototype.Rm;u.prototype.getLinearVelocity=u.prototype.qe;u.prototype.getLinearVelocityTo=u.prototype.re;u.prototype.setLinearVelocity=u.prototype.Pm;u.prototype.getAngularVelocity=u.prototype.Jc;u.prototype.getAngularVelocityTo=u.prototype.Kc;u.prototype.setAngularVelocity=u.prototype.mo;u.prototype.addLinearVelocity=u.prototype.cb;u.prototype.addAngularVelocity=u.prototype.ua;u.prototype.applyImpulse=u.prototype.uc;u.prototype.applyLinearImpulse=u.prototype.vc;u.prototype.applyAngularImpulse=u.prototype.Mb;u.prototype.applyForce=u.prototype.pc;u.prototype.applyForceToCenter=u.prototype.qc;u.prototype.applyTorque=u.prototype.Ac;u.prototype.getGravityScale=u.prototype.fd;u.prototype.setGravityScale=u.prototype.Nm;u.prototype.getLocalPoint=u.prototype.ue;u.prototype.getLocalPointTo=u.prototype.Ue;u.prototype.getLocalVector=u.prototype.Ve;u.prototype.getLocalVectorTo=u.prototype.Mf;u.prototype.getWorldPoint=u.prototype.Pj;u.prototype.getWorldPointTo=u.prototype.Nl;u.prototype.getWorldVector=u.prototype.am;u.prototype.getWorldVectorTo=u.prototype.bm;u.prototype.getNumShapes=u.prototype.im;u.prototype.getShapeList=u.prototype.ki;u.prototype.getNumContectLinks=u.prototype.Wg;u.prototype.getContactLinkList=u.prototype.Lc;u.prototype.getNumJointLinks=u.prototype.Xg;u.prototype.getJointLinkList=u.prototype.Yd;u.prototype.addShape=u.prototype.Hb;u.prototype.removeShape=u.prototype.ko;u.prototype.getType=u.prototype.Dm;u.prototype.setType=u.prototype.Sm;u.prototype.wakeUp=u.prototype.Um;u.prototype.sleep=u.prototype.Tm;u.prototype.isSleeping=u.prototype.cm;u.prototype.getSleepTime=u.prototype.li;u.prototype.setAutoSleep=u.prototype.Mm;u.prototype.getLinearDamping=u.prototype.pe;u.prototype.setLinearDamping=u.prototype.Om;u.prototype.getAngularDamping=u.prototype.Ec;u.prototype.setAngularDamping=u.prototype.lo;u.prototype.getPrev=u.prototype.um;u.prototype.getNext=u.prototype.gm;S.OIMO.RigidBodyConfig=function(){this.position=new t;this.rotation=new E;this.linearVelocity=new t;this.angularVelocity=new t;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0};S.OIMO.RigidBodyType=Rd;S.OIMO.Shape=Wa;Wa.prototype.getFriction=Wa.prototype.uc;Wa.prototype.setFriction=Wa.prototype.ue;Wa.prototype.getRestitution=Wa.prototype.Jc;Wa.prototype.setRestitution=Wa.prototype.Ve;Wa.prototype.getLocalTransform=Wa.prototype.Ac;Wa.prototype.getLocalTransformTo=Wa.prototype.Ec;Wa.prototype.getTransform=Wa.prototype.Yd;Wa.prototype.getTransformTo=Wa.prototype.pe;Wa.prototype.setLocalTransform=Wa.prototype.Ue;Wa.prototype.getDensity=Wa.prototype.qc;Wa.prototype.setDensity=Wa.prototype.te;Wa.prototype.getAabb=Wa.prototype.ua;Wa.prototype.getAabbTo=Wa.prototype.cb;Wa.prototype.getGeometry=Wa.prototype.vc;Wa.prototype.getRigidBody=Wa.prototype.Kc;Wa.prototype.getCollisionGroup=Wa.prototype.Hb;Wa.prototype.setCollisionGroup=Wa.prototype.qe;Wa.prototype.getCollisionMask=Wa.prototype.Mb;Wa.prototype.setCollisionMask=Wa.prototype.re;Wa.prototype.getContactCallback=Wa.prototype.pc;Wa.prototype.setContactCallback=Wa.prototype.se;Wa.prototype.getPrev=Wa.prototype.fd;Wa.prototype.getNext=Wa.prototype.Lc;S.OIMO.ShapeConfig=function(){this.position=new t;this.rotation=new E;this.friction=G.defaultFriction;this.restitution=G.defaultRestitution;this.density=G.defaultDensity;this.collisionGroup=G.defaultCollisionGroup;this.collisionMask=G.defaultCollisionMask;this.contactCallback=this.geometry=null}})(window); \ No newline at end of file +/* OimoPhysics 1.2.1 (c) 2020 saharan, The MIT License */ 'use strict';(function(){function Qj(){this.position=new n;this.rotation=new I;this.friction=F.defaultFriction;this.restitution=F.defaultRestitution;this.density=F.defaultDensity;this.collisionGroup=F.defaultCollisionGroup;this.collisionMask=F.defaultCollisionMask;this.contactCallback=this.geometry=null}function Ka(a){this.Ic=-1;this.ha=new Ua;this.ja=new Ua;this.a=new Ua;var b=a.position;this.ha.v=b.x;this.ha.A=b.y;this.ha.B=b.z;b=a.rotation;this.ha.o=b.e00;this.ha.f=b.e01;this.ha.h=b.e02;this.ha.i=b.e10;this.ha.m=b.e11;this.ha.j=b.e12;this.ha.l=b.e20;this.ha.g=b.e21;this.ha.s=b.e22;var b=this.ja,e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;b=this.a;e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Ak=a.restitution;this.pk=a.friction;this.Vk=a.density;this.Fb=a.geometry;this.kk=a.collisionGroup;this.lk=a.collisionMask;this.im=a.contactCallback;this.u=new eb;this.ub=null;this.mc=new n}function Qe(){}function Rj(){this.position=new n;this.rotation=new I;this.linearVelocity=new n;this.angularVelocity=new n;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0}function x(a){this.Yi=this.Gc=this.ia=this.M=null;this.Rg=0;this.ic=this.Mb=null;this.Ne=0;this.ff=this.Me=null;this.Ah=0;var b=a.linearVelocity;this.jb=b.x;this.kb=b.y;this.lb=b.z;b=a.angularVelocity;this.nb=b.x;this.ob=b.y;this.pb=b.z;this.jd=this.hd=this.gd=this.td=this.sd=this.rd=0;this.ja=new Ua;this.a=new Ua;b=a.position;this.ja.v=b.x;this.ja.A=b.y;this.ja.B=b.z;b=a.rotation;this.ja.o=b.e00;this.ja.f=b.e01;this.ja.h=b.e02;this.ja.i=b.e10;this.ja.m=b.e11;this.ja.j=b.e12;this.ja.l=b.e20;this.ja.g=b.e21;this.ja.s=b.e22;var b=this.a,e=this.ja;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Jb=a.type;this.wb=0;this.Bb=!1;this.Tk=a.autoSleep;this.$=this.Z=this.Y=this.X=this.W=this.V=this.U=this.T=this.S=this.Si=this.Ri=this.Qi=this.Pi=this.Oi=this.Ni=this.Mi=this.Li=this.Ki=this.$a=this.Za=this.Ya=this.Xa=this.Wa=this.Va=this.Ua=this.Ta=this.Sa=this.ae=this.$d=this.Zd=this.Yd=this.Xd=this.Wd=this.Vd=this.Ud=this.Td=this.qb=this.Lf=0;this.sk=a.linearDamping;this.hk=a.angularDamping;this.th=this.sh=this.rh=this.yh=this.xh=this.wh=this.Qf=this.Pf=this.Of=this.ci=this.bi=this.ai=0;this.O=new n(1,1,1);this.lg=!1;this.vh=1;this.jc=null}function fj(){this.mass=0;this.localInertia=new I}function Rb(a){Ob.call(this);this.ga=a;this.info=new gj;this.Wb=Array(F.maxJacobianRows);a=0;for(var b=this.Wb.length;a>1&85);d=(d&51)+(d>>2&51);d=(d&15)+(d>>4&15);c=Array(d);for(f=0;fb.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20)?b=!0:(b=a.localBasis2,b=0>b.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20));b&&console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed");var e,d,c,f,h,l,g,k,m,p,r,q,t,A,L,u,z;k=a.localBasis1;b=k.e00;e=k.e01;d=k.e02;c=k.e10;f=k.e11;h=k.e12;l=k.e20;g=k.e21;k=k.e22;z=a.localBasis2;m=z.e00;p=z.e01;r=z.e02;q=z.e10;t=z.e11;A=z.e12;L=z.e20;u=z.e21;z=z.e22;this.Ma=b;this.Na=c;this.Oa=l;this.sc=e;this.tc=f;this.uc=g;this.Pc=d;this.Qc=h;this.Rc=k;this.Sb=m;this.Tb=q;this.Ub=L;this.gi=p;this.hi=t;this.ii=u;this.nd=r;this.od=A;this.pd=z;this.cm=this.translationY=this.translationX=this.Bf=this.qh=this.Af=0;this.fk=this.ek=this.dk=!1;this.qg=Array(3);this.Rf=Array(3);this.pg=Array(3);this.Tg=Array(3);this.qg[0]=a.translationalLimitMotors[0].clone();this.qg[1]=a.translationalLimitMotors[1].clone();this.qg[2]=a.translationalLimitMotors[2].clone();this.Rf[0]=a.translationalSpringDampers[0].clone();this.Rf[1]=a.translationalSpringDampers[1].clone();this.Rf[2]=a.translationalSpringDampers[2].clone();this.pg[0]=a.rotationalLimitMotors[0].clone();this.pg[1]=a.rotationalLimitMotors[1].clone();this.pg[2]=a.rotationalLimitMotors[2].clone();this.Tg[0]=a.rotationalSpringDampers[0].clone();this.Tg[1]=a.rotationalSpringDampers[1].clone();this.Tg[2]=a.rotationalSpringDampers[2].clone()}function wf(){Gb.call(this);this.localAxis1=new n(1,0,0);this.localAxis2=new n(1,0,0);this.translationalLimitMotor=new tc;this.translationalSpringDamper=new Hb;this.rotationalLimitMotor=new $b;this.rotationalSpringDamper=new Hb}function Gb(){this.rigidBody2=this.rigidBody1=null;this.localAnchor1=new n;this.localAnchor2=new n;this.allowCollision=!1;this.solverType=F.defaultJointConstraintSolverType;this.positionCorrectionAlgorithm=F.defaultJointPositionCorrectionAlgorithm;this.breakTorque=this.breakForce=0}function Fb(a){N.call(this,a,2);var b=a.localAxis1;this.Ma=b.x;this.Na=b.y;this.Oa=b.z;b=a.localAxis2;this.Sb=b.x;this.Tb=b.y;this.Ub=b.z;this.Al();this.Yf=this.Xf=this.Bg=this.Se=this.Re=this.angle=0;this.N=new Ui(this);this.ul=a.translationalSpringDamper.clone();this.tl=a.translationalLimitMotor.clone();this.nl=a.rotationalSpringDamper.clone();this.ml=a.rotationalLimitMotor.clone()}function N(a,b){this.rb=new qc(this);this.sb=new qc(this);this.Sg=F.defaultJointPositionCorrectionAlgorithm;this.Jb=b;this.jc=null;this.C=a.rigidBody1;this.D=a.rigidBody2;this.Sk=a.allowCollision;this.nj=a.breakForce;this.oj=a.breakTorque;switch(a.solverType){case 0:this.Ck=new Rb(this);break;case 1:this.Ck=new Wb(this)}b=a.localAnchor1;this.sj=b.x;this.tj=b.y;this.uj=b.z;a=a.localAnchor2;this.vj=a.x;this.wj=a.y;this.xj=a.z;this.pd=this.od=this.nd=this.ii=this.hi=this.gi=this.Ub=this.Tb=this.Sb=this.Rc=this.Qc=this.Pc=this.uc=this.tc=this.sc=this.Oa=this.Na=this.Ma=this.zf=this.yf=this.xf=this.wf=this.vf=this.uf=this.fc=this.ec=this.dc=this.cc=this.bc=this.ac=0;this.Eb=Array(F.maxJacobianRows);a=0;for(b=F.maxJacobianRows;aa;){var b=a++,e=b&&4!=b?8:1;this.Nk[b]=Array(e);this.Yh[b]=Array(e);this.Pk[b]=Array(e);for(e=0;8>e;){var d=e++,c=.7853981633974475*b,f=.7853981633974475*d;this.Nk[b][d]=new n(Math.sin(c)*Math.cos(f),Math.cos(c),-Math.sin(c)*Math.sin(f));this.Yh[b][d]=new n;this.Pk[b][d]=new n}}this.Mj=Array(8);this.vm=Array(8);this.Ee=Array(8);this.af=Array(8);this.fg=Array(8);for(a=0;8>a;)b=a++,this.Mj[b]=new n(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.vm[b]=new n(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.Ee[b]=new n,this.af[b]=new n,this.fg[b]=new n;this.style=new wj}function hf(){this.position=new n;this.normal=new n;this.shape=null;this.fraction=1;this.position.R();this.normal.R();this.hit=!1}function Ni(){}function xj(){}function yj(){}function Vi(){this.u=new eb;this.sn=null}function ij(){this.dj=new Oi;this.Jj=new Ua;this.Bg=new n;this.R=new n;this.wm=this.Lj=null}function Pi(){this.dj=new Oi;this.Jj=new n;this.end=new n;this.Lj=null}function Ca(a,b){null==a&&(a=2);switch(a){case 1:this.hc=new pc;break;case 2:this.hc=new Kb}this.Hi=new De(this.hc);null==b&&(b=new n(0,-9.80665,0));this.Xk=new n(b.x,b.y,b.z);this.Ti=this.di=this.Xi=this.Nf=null;this.xk=this.jl=this.Rg=this.yj=0;this.ll=10;this.kl=5;this.zk=new Pi;this.qj=new ij;this.Qk=new Vi;this.Ng=new zj;this.hf=Array(F.islandInitialConstraintArraySize);this.Fh=Array(F.islandInitialRigidBodyArraySize);this.ji=new Aj;this.ra=new Nb;this.om=0}function Aj(){this.invDt=this.dt=0;this.dtRatio=1}function zj(){this.cg=Array(F.islandInitialRigidBodyArraySize);this.dg=Array(F.islandInitialConstraintArraySize);this.Xh=Array(F.islandInitialConstraintArraySize);this.Wh=Array(F.islandInitialConstraintArraySize);this.Oh=this.Ph=this.bg=this.ag=0}function De(a){this.hc=a;this.tn=new hi;this.Ui=0}function Zb(){this.ad=this.me=this.M=this.ia=null}function ac(){this.ia=this.M=null;this.rb=new Zb;this.sb=new Zb;this.$h=this.D=this.C=this.Fc=this.Ec=null;this.pj=new Bj;this.un=new jf;this.Bk=this.rk=!1;this.Ia=new Tb;this.qm=new uj(this.Ia);this.ef=new Uc(this.Ia);this.Hh=!1}function wa(a,b,e,d){null==d&&(d=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=d;wa.numCreations++}function Nb(){this.c=Array(256);this.b=0;this.bb=Array(256);this.cb=0;this.eg=Array(256);this.Ag=0;this.le=Array(256);this.re=0}function pa(){}function J(a,b,e,d,c,f,h,l,g,k,m,p,r,q,t,A){null==A&&(A=1);null==t&&(t=0);null==q&&(q=0);null==r&&(r=0);null==p&&(p=0);null==m&&(m=1);null==k&&(k=0);null==g&&(g=0);null==l&&(l=0);null==h&&(h=0);null==f&&(f=1);null==c&&(c=0);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=d;this.e10=c;this.e11=f;this.e12=h;this.e13=l;this.e20=g;this.e21=k;this.e22=m;this.e23=p;this.e30=r;this.e31=q;this.e32=t;this.e33=A;J.numCreations++}function I(a,b,e,d,c,f,h,l,g){null==g&&(g=1);null==l&&(l=0);null==h&&(h=0);null==f&&(f=0);null==c&&(c=1);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=d;this.e11=c;this.e12=f;this.e20=h;this.e21=l;this.e22=g;I.numCreations++}function Pc(){}function dc(){}function lb(){this.La=Array(4);this.eb=Array(4);this.ib=Array(4);this.Ij=Array(3);this.Ij[0]=new n(1,0,0);this.Ij[1]=new n(0,1,0);this.Ij[2]=new n(0,0,1);this.Jo=new n;this.Ko=new n;this.Co=new n;this.Bo=new n;this.Io=new Ua;this.La[0]=new n;this.eb[0]=new n;this.ib[0]=new n;this.La[1]=new n;this.eb[1]=new n;this.ib[1]=new n;this.La[2]=new n;this.eb[2]=new n;this.ib[2]=new n;this.La[3]=new n;this.eb[3]=new n;this.ib[3]=new n;this.dir=new n;this.closest=new n;this.closestPoint1=new n;this.closestPoint2=new n;this.ih=new Cj}function F(){}function Ua(){this.B=this.A=this.v=0;this.o=1;this.i=this.h=this.f=0;this.m=1;this.g=this.l=this.j=0;this.s=1}function n(a,b,e){null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;n.numCreations++}function Dj(){this.$l=new n}function te(){this.Rd=new n;this.eb=new n;this.ib=new n}function Ee(){this.id=++Ee.Kb;this.ia=this.M=null;this.wk=new n;this.sl=this.nk=0;this.Gj=!1;this.Ca=Array(3);this.Hb=Array(3);this.Ib=Array(3);this.zi=new n;this.Sc=Array(3);this.Sc[0]=1;this.Sc[1]=2;this.Sc[2]=0}function Cj(){this.Ca=Array(F.maxEPAVertices);this.Gi=new n;this.We=0;this.cd=this.Cd=null;this.Bh=0;this.jf=this.Qe=null}function ii(){this.oh=!1}function ji(a){this.oh=a}function ki(a){this.oh=a}function li(){this.oh=!1}function mi(){this.oh=!1}function Bj(){}function Ej(){this.gc=this.fd=this.Rj=this.w=0;this.Xb=Array(8);this.Gb=Array(8);this.Xb[0]=new kc;this.Gb[0]=new kc;this.Xb[1]=new kc;this.Gb[1]=new kc;this.Xb[2]=new kc;this.Gb[2]=new kc;this.Xb[3]=new kc;this.Gb[3]=new kc;this.Xb[4]=new kc;this.Gb[4]=new kc;this.Xb[5]=new kc;this.Gb[5]=new kc;this.Xb[6]=new kc;this.Gb[6]=new kc;this.Xb[7]=new kc;this.Gb[7]=new kc}function kc(){this.Ra=this.Qa=this.Pa=this.y=this.x=0}function ni(){this.oh=!1;this.Xg=new Ej}function lc(a){this.oh=a}function Fj(){this.position1=new n;this.position2=new n;this.id=this.depth=0}function jf(){this.numPoints=0;this.normal=new n;this.points=Array(F.maxManifoldPoints);this.incremental=!1;for(var a=0,b=F.maxManifoldPoints;a.2*a&&(this.Rb=.2*a)}function eb(){this.ma=this.la=this.ka=this.pa=this.oa=this.na=0}function Gj(){this.Nb=null;this.yk=0;this.Zi=new Hj;this.qf=this.zg=this.qd=null;this.zi=Array(1024)}function Hj(){this.mm=0;this.ik=!1}function Wi(a,b){Qc.call(this,a,b);this.ei=null;this.zh=!1}function oi(){this.ng=this.og=this.M=null;this.F=Array(2);this.Ja=0;this.Ea=null;this.P=0;this.ub=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function Kb(){ub.call(this,2);this.qk=!0;this.ye=new Gj;this.rf=Array(1024);this.$f=0}function pc(){ub.call(this,1);this.qk=!1}function ve(){this.Dh=this.Ch=null}function Qc(a,b){this.userData=a;this.Ic=b;this.M=this.ia=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function pi(){}function we(){}function Xi(){Qa.call(this,-1);this.min=new n;this.max=new n}function jj(){Qa.call(this,-1)}function Qa(a){wc.call(this,a);this.Rb=F.defaultGJKMargin;this.rm=!1}function wc(a){this.Jb=a;this.Sf=0}function ub(a){this.Jb=a;this.Vi=0;this.pe=this.gf=this.Oe=null;this.qk=!1;this.Dj=0;this.Eh=null;this.lm=0;this.mk=new jj;this.u=new Xi;this.rg=new Ua;this.R=new n;this.dj=new Oi}function Ij(){}function gb(a,b){a=Object.create(a);for(var e in b)a[e]=b[e];b.toString!==Object.prototype.toString&&(a.toString=b.toString);return a}Ij.lc=function(){window.OIMO={};window.OIMO.DebugDraw=Mg;window.OIMO.BroadPhase=ub;ub.prototype.createProxy=ub.prototype.ni;ub.prototype.destroyProxy=ub.prototype.oi;ub.prototype.moveProxy=ub.prototype.Qd;ub.prototype.isOverlapping=ub.prototype.Kb;ub.prototype.collectPairs=ub.prototype.$i;ub.prototype.getProxyPairList=ub.prototype.wa;ub.prototype.isIncremental=ub.prototype.Cb;ub.prototype.getTestCount=ub.prototype.mb;ub.prototype.rayCast=ub.prototype.ke;ub.prototype.convexCast=ub.prototype.Vf;ub.prototype.aabbTest=ub.prototype.Ih;window.OIMO.Geometry=wc;wc.prototype.getType=wc.prototype.mb;wc.prototype.getVolume=wc.prototype.wa;wc.prototype.rayCast=wc.prototype.ke;window.OIMO.ConvexGeometry=Qa;Qa.prototype.getGjkMergin=Qa.prototype.Xn;Qa.prototype.setGjkMergin=Qa.prototype.Go;Qa.prototype.computeLocalSupportingVertex=Qa.prototype.he;Qa.prototype.rayCast=Qa.prototype.ke;window.OIMO.BroadPhaseProxyCallback=we;we.prototype.process=we.prototype.process;window.OIMO.BroadPhaseType=pi;window.OIMO.Proxy=Qc;Qc.prototype.getId=Qc.prototype.Cb;Qc.prototype.getFatAabb=Qc.prototype.wa;Qc.prototype.getFatAabbTo=Qc.prototype.mb;window.OIMO.ProxyPair=ve;ve.prototype.getProxy1=ve.prototype.wa;ve.prototype.getProxy2=ve.prototype.mb;ve.prototype.getNext=ve.prototype.Cb;window.OIMO.BruteForceBroadPhase=pc;pc.prototype.createProxy=pc.prototype.ni;pc.prototype.destroyProxy=pc.prototype.oi;pc.prototype.moveProxy=pc.prototype.Qd;pc.prototype.collectPairs=pc.prototype.$i;pc.prototype.rayCast=pc.prototype.ke;pc.prototype.convexCast=pc.prototype.Vf;pc.prototype.aabbTest=pc.prototype.Ih;window.OIMO.BvhBroadPhase=Kb;Kb.prototype.createProxy=Kb.prototype.ni;Kb.prototype.destroyProxy=Kb.prototype.oi;Kb.prototype.moveProxy=Kb.prototype.Qd;Kb.prototype.collectPairs=Kb.prototype.$i;Kb.prototype.rayCast=Kb.prototype.ke;Kb.prototype.convexCast=Kb.prototype.Vf;Kb.prototype.aabbTest=Kb.prototype.Ih;Kb.prototype.getTreeBalance=Kb.prototype.so;window.OIMO.Aabb=eb;eb.prototype.init=eb.prototype.Aa;eb.prototype.getMin=eb.prototype.Uc;eb.prototype.getMinTo=eb.prototype.Vc;eb.prototype.setMin=eb.prototype.ie;eb.prototype.getMax=eb.prototype.Dc;eb.prototype.getMaxTo=eb.prototype.Hc;eb.prototype.setMax=eb.prototype.vd;eb.prototype.getCenter=eb.prototype.Cb;eb.prototype.getCenterTo=eb.prototype.Kb;eb.prototype.getExtents=eb.prototype.kc;eb.prototype.getExtentsTo=eb.prototype.lc;eb.prototype.combine=eb.prototype.wa;eb.prototype.combined=eb.prototype.mb;eb.prototype.overlap=eb.prototype.Wc;eb.prototype.getIntersection=eb.prototype.wc;eb.prototype.getIntersectionTo=eb.prototype.xc;eb.prototype.copyFrom=eb.prototype.qe;eb.prototype.clone=eb.prototype.clone;window.OIMO.BoxGeometry=Hd;Hd.prototype.getHalfExtents=Hd.prototype.Yn;Hd.prototype.getHalfExtentsTo=Hd.prototype.Zn;Hd.prototype.computeLocalSupportingVertex=Hd.prototype.he;window.OIMO.CapsuleGeometry=Wc;Wc.prototype.getRadius=Wc.prototype.pi;Wc.prototype.getHalfHeight=Wc.prototype.Pj;Wc.prototype.computeLocalSupportingVertex=Wc.prototype.he;window.OIMO.ConeGeometry=Fe;Fe.prototype.getRadius=Fe.prototype.pi;Fe.prototype.getHalfHeight=Fe.prototype.Pj;Fe.prototype.computeLocalSupportingVertex=Fe.prototype.he;window.OIMO.ConvexHullGeometry=kf;kf.prototype.getVertices=kf.prototype.wo;kf.prototype.computeLocalSupportingVertex=kf.prototype.he;window.OIMO.CylinderGeometry=Qd;Qd.prototype.getRadius=Qd.prototype.pi;Qd.prototype.getHalfHeight=Qd.prototype.Pj;Qd.prototype.computeLocalSupportingVertex=Qd.prototype.he;window.OIMO.GeometryType=bc;window.OIMO.RayCastHit=Oi;window.OIMO.SphereGeometry=ue;ue.prototype.getRadius=ue.prototype.pi;ue.prototype.computeLocalSupportingVertex=ue.prototype.he;window.OIMO.CollisionMatrix=hi;hi.prototype.getDetector=hi.prototype.wa;window.OIMO.DetectorResult=jf;jf.prototype.getMaxDepth=jf.prototype.Em;jf.prototype.clear=jf.prototype.clear;window.OIMO.DetectorResultPoint=Fj;window.OIMO.Detector=lc;lc.prototype.detect=lc.prototype.zm;window.OIMO.BoxBoxDetector=ni;window.OIMO.CapsuleCapsuleDetector=mi;window.OIMO.GjkEpaDetector=li;window.OIMO.SphereBoxDetector=ki;window.OIMO.SphereCapsuleDetector=ji;window.OIMO.SphereSphereDetector=ii;window.OIMO.Vec3=n;n.prototype.init=n.prototype.Aa;n.prototype.zero=n.prototype.R;n.prototype.add=n.prototype.ie;n.prototype.add3=n.prototype.wa;n.prototype.addScaled=n.prototype.Cb;n.prototype.sub=n.prototype.cf;n.prototype.sub3=n.prototype.jg;n.prototype.scale=n.prototype.Ke;n.prototype.scale3=n.prototype.hg;n.prototype.dot=n.prototype.Ge;n.prototype.cross=n.prototype.kc;n.prototype.addEq=n.prototype.Fe;n.prototype.add3Eq=n.prototype.mb;n.prototype.addScaledEq=n.prototype.Kb;n.prototype.subEq=n.prototype.gg;n.prototype.sub3Eq=n.prototype.kg;n.prototype.scaleEq=n.prototype.bf;n.prototype.scale3Eq=n.prototype.ig;n.prototype.crossEq=n.prototype.lc;n.prototype.mulMat3=n.prototype.wc;n.prototype.mulMat4=n.prototype.Dc;n.prototype.mulTransform=n.prototype.Uc;n.prototype.mulMat3Eq=n.prototype.xc;n.prototype.mulMat4Eq=n.prototype.Hc;n.prototype.mulTransformEq=n.prototype.Vc;n.prototype.length=n.prototype.length;n.prototype.lengthSq=n.prototype.He;n.prototype.normalized=n.prototype.Je;n.prototype.normalize=n.prototype.Ie;n.prototype.negate=n.prototype.Wc;n.prototype.negateEq=n.prototype.vd;n.prototype.copyFrom=n.prototype.qe;n.prototype.clone=n.prototype.clone;n.prototype.toString=n.prototype.toString;window.OIMO.Transform=Ua;Ua.prototype.identity=Ua.prototype.rg;Ua.prototype.getPosition=Ua.prototype.Cb;Ua.prototype.getPositionTo=Ua.prototype.Kb;Ua.prototype.setPosition=Ua.prototype.Hc;Ua.prototype.translate=Ua.prototype.Wc;Ua.prototype.getRotation=Ua.prototype.kc;Ua.prototype.getRotationTo=Ua.prototype.lc;Ua.prototype.setRotation=Ua.prototype.Uc;Ua.prototype.setRotationXyz=Ua.prototype.Vc;Ua.prototype.rotate=Ua.prototype.wc;Ua.prototype.rotateXyz=Ua.prototype.xc;Ua.prototype.getOrientation=Ua.prototype.wa;Ua.prototype.getOrientationTo=Ua.prototype.mb;Ua.prototype.setOrientation=Ua.prototype.Dc;Ua.prototype.clone=Ua.prototype.clone;Ua.prototype.copyFrom=Ua.prototype.qe;window.OIMO.Setting=F;window.OIMO.GjkEpa=lb;lb.prototype.computeClosestPoints=lb.prototype.wa;lb.prototype.computeDistance=lb.prototype.mb;lb.prototype.convexCast=lb.prototype.Vf;lb.prototype.rayCast=lb.prototype.ke;lb.getInstance=lb.kc;window.OIMO.GjkEpaResultState=dc;window.OIMO.SimplexUtil=Pc;Pc.projectOrigin2=Pc.wc;Pc.projectOrigin3=Pc.xc;Pc.projectOrigin4=Pc.Dc;window.OIMO.Mat3=I;I.prototype.init=I.prototype.Aa;I.prototype.identity=I.prototype.rg;I.prototype.add=I.prototype.Dc;I.prototype.sub=I.prototype.ig;I.prototype.scale=I.prototype.gg;I.prototype.mul=I.prototype.He;I.prototype.addEq=I.prototype.Hc;I.prototype.subEq=I.prototype.jg;I.prototype.scaleEq=I.prototype.hg;I.prototype.mulEq=I.prototype.Ie;I.prototype.prependScale=I.prototype.bf;I.prototype.appendScale=I.prototype.Wc;I.prototype.prependRotation=I.prototype.Je;I.prototype.appendRotation=I.prototype.Uc;I.prototype.prependScaleEq=I.prototype.cf;I.prototype.appendScaleEq=I.prototype.vd;I.prototype.prependRotationEq=I.prototype.Ke;I.prototype.appendRotationEq=I.prototype.Vc;I.prototype.transpose=I.prototype.Di;I.prototype.transposeEq=I.prototype.Ei;I.prototype.determinant=I.prototype.ie;I.prototype.trace=I.prototype.ph;I.prototype.inverse=I.prototype.Fe;I.prototype.inverseEq=I.prototype.Ge;I.prototype.toArray=I.prototype.kg;I.prototype.copyFrom=I.prototype.qe;I.prototype.clone=I.prototype.clone;I.prototype.fromQuat=I.prototype.Cb;I.prototype.toQuat=I.prototype.gk;I.prototype.fromEulerXyz=I.prototype.mb;I.prototype.toEulerXyz=I.prototype.Fi;I.prototype.getRow=I.prototype.wc;I.prototype.getCol=I.prototype.kc;I.prototype.getRowTo=I.prototype.xc;I.prototype.getColTo=I.prototype.lc;I.prototype.fromRows=I.prototype.Kb;I.prototype.fromCols=I.prototype.wa;I.prototype.toString=I.prototype.toString;window.OIMO.Mat4=J;J.prototype.init=J.prototype.Aa;J.prototype.identity=J.prototype.rg;J.prototype.add=J.prototype.kc;J.prototype.sub=J.prototype.gg;J.prototype.scale=J.prototype.bf;J.prototype.mul=J.prototype.ie;J.prototype.addEq=J.prototype.lc;J.prototype.subEq=J.prototype.hg;J.prototype.scaleEq=J.prototype.cf;J.prototype.mulEq=J.prototype.Fe;J.prototype.prependScale=J.prototype.Je;J.prototype.appendScale=J.prototype.Dc;J.prototype.prependRotation=J.prototype.He;J.prototype.appendRotation=J.prototype.wc;J.prototype.prependTranslation=J.prototype.Ei;J.prototype.appendTranslation=J.prototype.wa;J.prototype.prependScaleEq=J.prototype.Ke;J.prototype.appendScaleEq=J.prototype.Hc;J.prototype.prependRotationEq=J.prototype.Ie;J.prototype.appendRotationEq=J.prototype.xc;J.prototype.prependTranslationEq=J.prototype.Fi;J.prototype.appendTranslationEq=J.prototype.mb;J.prototype.transpose=J.prototype.kg;J.prototype.transposeEq=J.prototype.ph;J.prototype.determinant=J.prototype.Uc;J.prototype.trace=J.prototype.jg;J.prototype.inverse=J.prototype.Wc;J.prototype.inverseEq=J.prototype.vd;J.prototype.lookAt=J.prototype.Kb;J.prototype.perspective=J.prototype.Ge;J.prototype.ortho=J.prototype.Di;J.prototype.toArray=J.prototype.ig;J.prototype.copyFrom=J.prototype.qe;J.prototype.fromMat3=J.prototype.Vc;J.prototype.fromTransform=J.prototype.Cb;J.prototype.clone=J.prototype.clone;J.prototype.toString=J.prototype.toString;window.OIMO.MathUtil=pa;pa.abs=pa.abs;pa.sin=pa.sin;pa.cos=pa.cos;pa.tan=pa.tan;pa.asin=pa.asin;pa.acos=pa.acos;pa.atan=pa.atan;pa.safeAsin=pa.ie;pa.safeAcos=pa.vd;pa.atan2=pa.atan2;pa.sqrt=pa.sqrt;pa.clamp=pa.Cb;pa.rand=pa.Hc;pa.randIn=pa.Uc;pa.randVec3In=pa.Wc;pa.randVec3=pa.Vc;window.OIMO.Pool=Nb;Nb.prototype.vec3=Nb.prototype.Dc;Nb.prototype.mat3=Nb.prototype.lc;Nb.prototype.mat4=Nb.prototype.wc;Nb.prototype.quat=Nb.prototype.xc;Nb.prototype.dispose=Nb.prototype.wa;Nb.prototype.disposeVec3=Nb.prototype.kc;Nb.prototype.disposeMat3=Nb.prototype.mb;Nb.prototype.disposeMat4=Nb.prototype.Cb;Nb.prototype.disposeQuat=Nb.prototype.Kb;window.OIMO.Quat=wa;wa.prototype.identity=wa.prototype.rg;wa.prototype.init=wa.prototype.Aa;wa.prototype.add=wa.prototype.wa;wa.prototype.sub=wa.prototype.Hc;wa.prototype.scale=wa.prototype.xc;wa.prototype.addEq=wa.prototype.mb;wa.prototype.subEq=wa.prototype.Uc;wa.prototype.scaleEq=wa.prototype.Dc;wa.prototype.length=wa.prototype.length;wa.prototype.lengthSq=wa.prototype.kc;wa.prototype.dot=wa.prototype.Cb;wa.prototype.normalized=wa.prototype.wc;wa.prototype.normalize=wa.prototype.lc;wa.prototype.setArc=wa.prototype.Vc;wa.prototype.slerp=wa.prototype.Wc;wa.prototype.copyFrom=wa.prototype.qe;wa.prototype.clone=wa.prototype.clone;wa.prototype.fromMat3=wa.prototype.Kb;wa.prototype.toMat3=wa.prototype.vd;wa.prototype.toString=wa.prototype.toString;window.OIMO.Contact=ac;ac.prototype.getShape1=ac.prototype.kc;ac.prototype.getShape2=ac.prototype.lc;ac.prototype.isTouching=ac.prototype.Kk;ac.prototype.getManifold=ac.prototype.mb;ac.prototype.getContactConstraint=ac.prototype.wa;ac.prototype.getPrev=ac.prototype.Kb;ac.prototype.getNext=ac.prototype.Cb;window.OIMO.ContactLink=Zb;Zb.prototype.getContact=Zb.prototype.wa;Zb.prototype.getOther=Zb.prototype.Cb;Zb.prototype.getPrev=Zb.prototype.Kb;Zb.prototype.getNext=Zb.prototype.mb;window.OIMO.ContactManager=De;De.prototype.getNumContacts=De.prototype.mb;De.prototype.getContactList=De.prototype.wa;window.OIMO.TimeStep=Aj;window.OIMO.World=Ca;Ca.prototype.step=Ca.prototype.Fe;Ca.prototype.addRigidBody=Ca.prototype.mb;Ca.prototype.removeRigidBody=Ca.prototype.Ge;Ca.prototype.addJoint=Ca.prototype.wa;Ca.prototype.removeJoint=Ca.prototype.bm;Ca.prototype.setDebugDraw=Ca.prototype.He;Ca.prototype.getDebugDraw=Ca.prototype.lc;Ca.prototype.debugDraw=Ca.prototype.Cb;Ca.prototype.rayCast=Ca.prototype.ke;Ca.prototype.convexCast=Ca.prototype.Vf;Ca.prototype.aabbTest=Ca.prototype.Ih;Ca.prototype.getRigidBodyList=Ca.prototype.vd;Ca.prototype.getJointList=Ca.prototype.xc;Ca.prototype.getBroadPhase=Ca.prototype.Kb;Ca.prototype.getContactManager=Ca.prototype.kc;Ca.prototype.getNumRigidBodies=Ca.prototype.Vc;Ca.prototype.getNumJoints=Ca.prototype.Hc;Ca.prototype.getNumShapes=Ca.prototype.ie;Ca.prototype.getNumIslands=Ca.prototype.Dc;Ca.prototype.getNumVelocityIterations=Ca.prototype.Wc;Ca.prototype.setNumVelocityIterations=Ca.prototype.Ke;Ca.prototype.getNumPositionIterations=Ca.prototype.Uc;Ca.prototype.setNumPositionIterations=Ca.prototype.Je;Ca.prototype.getGravity=Ca.prototype.wc;Ca.prototype.setGravity=Ca.prototype.Ie;window.OIMO.AabbTestCallback=yj;window.OIMO.ContactCallback=xj;window.OIMO.RayCastCallback=Ni;window.OIMO.RayCastClosest=hf;hf.prototype.clear=hf.prototype.clear;hf.prototype.process=hf.prototype.process;window.OIMO.DebugDrawStyle=wj;window.OIMO.Performance=Ce;window.OIMO.ConstraintSolver=Ob;Ob.prototype.preSolveVelocity=Ob.prototype.Qh;Ob.prototype.warmStart=Ob.prototype.Zh;Ob.prototype.solveVelocity=Ob.prototype.Vh;Ob.prototype.postSolveVelocity=Ob.prototype.cj;Ob.prototype.preSolvePosition=Ob.prototype.jh;Ob.prototype.solvePositionSplitImpulse=Ob.prototype.Uh;Ob.prototype.solvePositionNgs=Ob.prototype.Th;Ob.prototype.postSolve=Ob.prototype.postSolve;window.OIMO.PositionCorrectionAlgorithm=jc;window.OIMO.ContactConstraint=Uc;Uc.prototype.getShape1=Uc.prototype.mb;Uc.prototype.getShape2=Uc.prototype.Cb;Uc.prototype.getManifold=Uc.prototype.wa;Uc.prototype.isTouching=Uc.prototype.Kk;window.OIMO.Manifold=Tb;Tb.prototype.getNormal=Tb.prototype.Cb;Tb.prototype.getNormalTo=Tb.prototype.Kb;Tb.prototype.getTangent=Tb.prototype.wc;Tb.prototype.getTangentTo=Tb.prototype.xc;Tb.prototype.getBinormal=Tb.prototype.wa;Tb.prototype.getBinormalTo=Tb.prototype.mb;Tb.prototype.getPoints=Tb.prototype.lc;Tb.prototype.getNumPoints=Tb.prototype.kc;window.OIMO.ManifoldPoint=Lb;Lb.prototype.getPosition1=Lb.prototype.Kb;Lb.prototype.getPosition1To=Lb.prototype.kc;Lb.prototype.getPosition2=Lb.prototype.lc;Lb.prototype.getPosition2To=Lb.prototype.wc;Lb.prototype.getDepth=Lb.prototype.mb;Lb.prototype.isWarmStarted=Lb.prototype.Dc;Lb.prototype.getNormalImpulse=Lb.prototype.Cb;Lb.prototype.getTangentImpulse=Lb.prototype.xc;Lb.prototype.getBinormalImpulse=Lb.prototype.wa;Lb.prototype.isEnabled=Lb.prototype.Hc;window.OIMO.Joint=N;N.prototype.getRigidBody1=N.prototype.Ke;N.prototype.getRigidBody2=N.prototype.bf;N.prototype.getType=N.prototype.hg;N.prototype.getAnchor1=N.prototype.mb;N.prototype.getAnchor2=N.prototype.Kb;N.prototype.getAnchor1To=N.prototype.Cb;N.prototype.getAnchor2To=N.prototype.kc;N.prototype.getLocalAnchor1=N.prototype.Fe;N.prototype.getLocalAnchor2=N.prototype.He;N.prototype.getLocalAnchor1To=N.prototype.Ge;N.prototype.getLocalAnchor2To=N.prototype.Ie;N.prototype.getBasis1=N.prototype.Hc;N.prototype.getBasis2=N.prototype.Vc;N.prototype.getBasis1To=N.prototype.Uc;N.prototype.getBasis2To=N.prototype.Wc;N.prototype.getAllowCollision=N.prototype.wa;N.prototype.setAllowCollision=N.prototype.ig;N.prototype.getBreakForce=N.prototype.vd;N.prototype.setBreakForce=N.prototype.jg;N.prototype.getBreakTorque=N.prototype.ie;N.prototype.setBreakTorque=N.prototype.kg;N.prototype.getPositionCorrectionAlgorithm=N.prototype.Je;N.prototype.setPositionCorrectionAlgorithm=N.prototype.ph;N.prototype.getAppliedForce=N.prototype.lc;N.prototype.getAppliedForceTo=N.prototype.wc;N.prototype.getAppliedTorque=N.prototype.xc;N.prototype.getAppliedTorqueTo=N.prototype.Dc;N.prototype.getPrev=N.prototype.gg;N.prototype.getNext=N.prototype.cf;window.OIMO.CylindricalJoint=Fb;Fb.prototype.getAxis1=Fb.prototype.Zg;Fb.prototype.getAxis2=Fb.prototype.ah;Fb.prototype.getAxis1To=Fb.prototype.$g;Fb.prototype.getAxis2To=Fb.prototype.bh;Fb.prototype.getLocalAxis1=Fb.prototype.dh;Fb.prototype.getLocalAxis2=Fb.prototype.fh;Fb.prototype.getLocalAxis1To=Fb.prototype.eh;Fb.prototype.getLocalAxis2To=Fb.prototype.gh;Fb.prototype.getTranslationalSpringDamper=Fb.prototype.po;Fb.prototype.getRotationalSpringDamper=Fb.prototype.eo;Fb.prototype.getTranslationalLimitMotor=Fb.prototype.no;Fb.prototype.getRotationalLimitMotor=Fb.prototype.bo;Fb.prototype.getAngle=Fb.prototype.Gl;Fb.prototype.getTranslation=Fb.prototype.Jl;window.OIMO.JointConfig=Gb;window.OIMO.CylindricalJointConfig=wf;wf.prototype.init=wf.prototype.Aa;window.OIMO.GenericJoint=Sb;Sb.prototype.getAxisX=Sb.prototype.Un;Sb.prototype.getAxisY=Sb.prototype.Vn;Sb.prototype.getAxisZ=Sb.prototype.Wn;Sb.prototype.getTranslationalSpringDampers=Sb.prototype.qo;Sb.prototype.getRotationalSpringDampers=Sb.prototype.fo;Sb.prototype.getTranslationalLimitMotors=Sb.prototype.oo;Sb.prototype.getRotationalLimitMotors=Sb.prototype.co;Sb.prototype.getAngles=Sb.prototype.Tn;Sb.prototype.getTranslations=Sb.prototype.ro;window.OIMO.GenericJointConfig=Lg;Lg.prototype.init=Lg.prototype.Aa;window.OIMO.JointLink=qc;qc.prototype.getContact=qc.prototype.wa;qc.prototype.getOther=qc.prototype.Cb;qc.prototype.getPrev=qc.prototype.Kb;qc.prototype.getNext=qc.prototype.mb;window.OIMO.JointType=Mb;window.OIMO.PrismaticJoint=Jb;Jb.prototype.getAxis1=Jb.prototype.Zg;Jb.prototype.getAxis2=Jb.prototype.ah;Jb.prototype.getAxis1To=Jb.prototype.$g;Jb.prototype.getAxis2To=Jb.prototype.bh;Jb.prototype.getLocalAxis1=Jb.prototype.dh;Jb.prototype.getLocalAxis2=Jb.prototype.fh;Jb.prototype.getLocalAxis1To=Jb.prototype.eh;Jb.prototype.getLocalAxis2To=Jb.prototype.gh;Jb.prototype.getSpringDamper=Jb.prototype.Qj;Jb.prototype.getLimitMotor=Jb.prototype.Il;Jb.prototype.getTranslation=Jb.prototype.Jl;window.OIMO.PrismaticJointConfig=Kg;Kg.prototype.init=Kg.prototype.Aa;window.OIMO.RagdollJoint=pb;pb.prototype.getAxis1=pb.prototype.Zg;pb.prototype.getAxis2=pb.prototype.ah;pb.prototype.getAxis1To=pb.prototype.$g;pb.prototype.getAxis2To=pb.prototype.bh;pb.prototype.getLocalAxis1=pb.prototype.dh;pb.prototype.getLocalAxis2=pb.prototype.fh;pb.prototype.getLocalAxis1To=pb.prototype.eh;pb.prototype.getLocalAxis2To=pb.prototype.gh;pb.prototype.getTwistSpringDamper=pb.prototype.vo;pb.prototype.getTwistLimitMotor=pb.prototype.uo;pb.prototype.getSwingSpringDamper=pb.prototype.mo;pb.prototype.getSwingAxis=pb.prototype.ko;pb.prototype.getSwingAxisTo=pb.prototype.lo;pb.prototype.getSwingAngle=pb.prototype.jo;pb.prototype.getTwistAngle=pb.prototype.to;window.OIMO.RagdollJointConfig=Jg;Jg.prototype.init=Jg.prototype.Aa;window.OIMO.RevoluteJoint=Qb;Qb.prototype.getAxis1=Qb.prototype.Zg;Qb.prototype.getAxis2=Qb.prototype.ah;Qb.prototype.getAxis1To=Qb.prototype.$g;Qb.prototype.getAxis2To=Qb.prototype.bh;Qb.prototype.getLocalAxis1=Qb.prototype.dh;Qb.prototype.getLocalAxis2=Qb.prototype.fh;Qb.prototype.getLocalAxis1To=Qb.prototype.eh;Qb.prototype.getLocalAxis2To=Qb.prototype.gh;Qb.prototype.getSpringDamper=Qb.prototype.Qj;Qb.prototype.getLimitMotor=Qb.prototype.Il;Qb.prototype.getAngle=Qb.prototype.Gl;window.OIMO.RevoluteJointConfig=ff;ff.prototype.init=ff.prototype.Aa;window.OIMO.RotationalLimitMotor=$b;$b.prototype.setLimits=$b.prototype.mh;$b.prototype.setMotor=$b.prototype.wa;$b.prototype.clone=$b.prototype.clone;window.OIMO.SphericalJoint=se;se.prototype.getSpringDamper=se.prototype.Qj;window.OIMO.SphericalJointConfig=Lf;Lf.prototype.init=Lf.prototype.Aa;window.OIMO.SpringDamper=Hb;Hb.prototype.setSpring=Hb.prototype.wa;Hb.prototype.setSymplecticEuler=Hb.prototype.mb;Hb.prototype.clone=Hb.prototype.clone;window.OIMO.TranslationalLimitMotor=tc;tc.prototype.setLimits=tc.prototype.mh;tc.prototype.setMotor=tc.prototype.wa;tc.prototype.clone=tc.prototype.clone;window.OIMO.UniversalJoint=Bb;Bb.prototype.getAxis1=Bb.prototype.Zg;Bb.prototype.getAxis2=Bb.prototype.ah;Bb.prototype.getAxis1To=Bb.prototype.$g;Bb.prototype.getAxis2To=Bb.prototype.bh;Bb.prototype.getLocalAxis1=Bb.prototype.dh;Bb.prototype.getLocalAxis2=Bb.prototype.fh;Bb.prototype.getLocalAxis1To=Bb.prototype.eh;Bb.prototype.getLocalAxis2To=Bb.prototype.gh;Bb.prototype.getSpringDamper1=Bb.prototype.ho;Bb.prototype.getSpringDamper2=Bb.prototype.io;Bb.prototype.getLimitMotor1=Bb.prototype.$n;Bb.prototype.getLimitMotor2=Bb.prototype.ao;Bb.prototype.getAngle1=Bb.prototype.Rn;Bb.prototype.getAngle2=Bb.prototype.Sn;window.OIMO.UniversalJointConfig=Kf;Kf.prototype.init=Kf.prototype.Aa;window.OIMO.ConstraintSolverType=vf;window.OIMO.DirectJointConstraintSolver=Wb;Wb.prototype.preSolveVelocity=Wb.prototype.Qh;Wb.prototype.warmStart=Wb.prototype.Zh;Wb.prototype.solveVelocity=Wb.prototype.Vh;Wb.prototype.postSolveVelocity=Wb.prototype.cj;Wb.prototype.preSolvePosition=Wb.prototype.jh;Wb.prototype.solvePositionSplitImpulse=Wb.prototype.Uh;Wb.prototype.solvePositionNgs=Wb.prototype.Th;Wb.prototype.postSolve=Wb.prototype.postSolve;window.OIMO.PgsContactConstraintSolver=Pb;Pb.prototype.preSolveVelocity=Pb.prototype.Qh;Pb.prototype.warmStart=Pb.prototype.Zh;Pb.prototype.solveVelocity=Pb.prototype.Vh;Pb.prototype.preSolvePosition=Pb.prototype.jh;Pb.prototype.solvePositionSplitImpulse=Pb.prototype.Uh;Pb.prototype.solvePositionNgs=Pb.prototype.Th;Pb.prototype.postSolve=Pb.prototype.postSolve;window.OIMO.PgsJointConstraintSolver=Rb;Rb.prototype.preSolveVelocity=Rb.prototype.Qh;Rb.prototype.warmStart=Rb.prototype.Zh;Rb.prototype.solveVelocity=Rb.prototype.Vh;Rb.prototype.postSolveVelocity=Rb.prototype.cj;Rb.prototype.preSolvePosition=Rb.prototype.jh;Rb.prototype.solvePositionSplitImpulse=Rb.prototype.Uh;Rb.prototype.solvePositionNgs=Rb.prototype.Th;Rb.prototype.postSolve=Rb.prototype.postSolve;window.OIMO.MassData=fj;window.OIMO.RigidBody=x;x.prototype.getPosition=x.prototype.Om;x.prototype.getPositionTo=x.prototype.Pm;x.prototype.setPosition=x.prototype.Po;x.prototype.translate=x.prototype.cn;x.prototype.getRotation=x.prototype.Vm;x.prototype.getRotationTo=x.prototype.Wm;x.prototype.setRotation=x.prototype.Qo;x.prototype.setRotationXyz=x.prototype.Ro;x.prototype.rotate=x.prototype.Ho;x.prototype.rotateXyz=x.prototype.Mo;x.prototype.getOrientation=x.prototype.Mm;x.prototype.getOrientationTo=x.prototype.Nm;x.prototype.setOrientation=x.prototype.No;x.prototype.getTransform=x.prototype.Xm;x.prototype.getTransformTo=x.prototype.Ym;x.prototype.setTransform=x.prototype.So;x.prototype.getMass=x.prototype.ph;x.prototype.getLocalInertia=x.prototype.cf;x.prototype.getLocalInertiaTo=x.prototype.gg;x.prototype.getMassData=x.prototype.Di;x.prototype.getMassDataTo=x.prototype.Ei;x.prototype.setMassData=x.prototype.ln;x.prototype.getRotationFactor=x.prototype.fm;x.prototype.setRotationFactor=x.prototype.mn;x.prototype.getLinearVelocity=x.prototype.Ke;x.prototype.getLinearVelocityTo=x.prototype.bf;x.prototype.setLinearVelocity=x.prototype.kn;x.prototype.getAngularVelocity=x.prototype.Wc;x.prototype.getAngularVelocityTo=x.prototype.vd;x.prototype.setAngularVelocity=x.prototype.fn;x.prototype.addLinearVelocity=x.prototype.mb;x.prototype.addAngularVelocity=x.prototype.wa;x.prototype.applyImpulse=x.prototype.wc;x.prototype.applyLinearImpulse=x.prototype.xc;x.prototype.applyAngularImpulse=x.prototype.Kb;x.prototype.applyForce=x.prototype.kc;x.prototype.applyForceToCenter=x.prototype.lc;x.prototype.applyTorque=x.prototype.Dc;x.prototype.getLinearContactImpulse=x.prototype.He;x.prototype.getLinearContactImpulseTo=x.prototype.Ie;x.prototype.getAngularContactImpulse=x.prototype.Hc;x.prototype.getAngularContactImpulseTo=x.prototype.Uc;x.prototype.getGravityScale=x.prototype.Fe;x.prototype.setGravityScale=x.prototype.hn;x.prototype.getLocalPoint=x.prototype.hg;x.prototype.getLocalPointTo=x.prototype.ig;x.prototype.getLocalVector=x.prototype.jg;x.prototype.getLocalVectorTo=x.prototype.kg;x.prototype.getWorldPoint=x.prototype.um;x.prototype.getWorldPointTo=x.prototype.ym;x.prototype.getWorldVector=x.prototype.Am;x.prototype.getWorldVectorTo=x.prototype.Bm;x.prototype.getNumShapes=x.prototype.Jm;x.prototype.getShapeList=x.prototype.sm;x.prototype.getNumContectLinks=x.prototype.Fi;x.prototype.getContactLinkList=x.prototype.ie;x.prototype.getNumJointLinks=x.prototype.gk;x.prototype.getJointLinkList=x.prototype.Ge;x.prototype.addShape=x.prototype.Cb;x.prototype.removeShape=x.prototype.dn;x.prototype.getType=x.prototype.Eo;x.prototype.setType=x.prototype.nn;x.prototype.wakeUp=x.prototype.pn;x.prototype.sleep=x.prototype.on;x.prototype.isSleeping=x.prototype.Dm;x.prototype.getSleepTime=x.prototype.tm;x.prototype.setAutoSleep=x.prototype.gn;x.prototype.getLinearDamping=x.prototype.Je;x.prototype.setLinearDamping=x.prototype.jn;x.prototype.getAngularDamping=x.prototype.Vc;x.prototype.setAngularDamping=x.prototype.en;x.prototype.getPrev=x.prototype.Um;x.prototype.getNext=x.prototype.Im;window.OIMO.RigidBodyConfig=Rj;window.OIMO.RigidBodyType=Qe;window.OIMO.Shape=Ka;Ka.prototype.getFriction=Ka.prototype.wc;Ka.prototype.setFriction=Ka.prototype.Ke;Ka.prototype.getRestitution=Ka.prototype.Uc;Ka.prototype.setRestitution=Ka.prototype.cf;Ka.prototype.getLocalTransform=Ka.prototype.Dc;Ka.prototype.getLocalTransformTo=Ka.prototype.Hc;Ka.prototype.getTransform=Ka.prototype.ie;Ka.prototype.getTransformTo=Ka.prototype.Fe;Ka.prototype.setLocalTransform=Ka.prototype.bf;Ka.prototype.getDensity=Ka.prototype.lc;Ka.prototype.setDensity=Ka.prototype.Je;Ka.prototype.getAabb=Ka.prototype.wa;Ka.prototype.getAabbTo=Ka.prototype.mb;Ka.prototype.getGeometry=Ka.prototype.xc;Ka.prototype.getRigidBody=Ka.prototype.Vc;Ka.prototype.getCollisionGroup=Ka.prototype.Cb;Ka.prototype.setCollisionGroup=Ka.prototype.Ge;Ka.prototype.getCollisionMask=Ka.prototype.Kb;Ka.prototype.setCollisionMask=Ka.prototype.He;Ka.prototype.getContactCallback=Ka.prototype.kc;Ka.prototype.setContactCallback=Ka.prototype.Ie;Ka.prototype.getPrev=Ka.prototype.vd;Ka.prototype.getNext=Ka.prototype.Wc;window.OIMO.ShapeConfig=Qj};ub.prototype={ni:function(){return null},oi:function(){},Qd:function(){},Kb:function(a,b){return a.Jb.J&&a.Kb.K&&a.Lb.L:!1},$i:function(){},wa:function(){return this.pe},Cb:function(){return this.qk},mb:function(){return this.Dj},ke:function(){},Vf:function(){},Ih:function(){}};wc.prototype={Xe:function(){},Lb:function(){},Wi:function(){return!1},mb:function(){return this.Jb},wa:function(){return this.Sf},ke:function(a,b,e,d){var c,f,h,l;c=a.x;f=a.y;a=a.z;h=b.x;l=b.y;b=b.z;c-=e.v;f-=e.A;a-=e.B;h-=e.v;l-=e.A;b-=e.B;if(this.Wi(e.o*c+e.i*f+e.l*a,e.f*c+e.m*f+e.g*a,e.h*c+e.j*f+e.s*a,e.o*h+e.i*l+e.l*b,e.f*h+e.m*l+e.g*b,e.h*h+e.j*l+e.s*b,d)){var g,k;b=d.position;c=b.x;f=b.y;h=b.z;b=d.normal;l=b.x;g=b.y;k=b.z;var m,p;m=e.o*c+e.f*f+e.h*h;p=e.i*c+e.m*f+e.j*h;h=e.l*c+e.g*f+e.s*h;b=e.o*l+e.f*g+e.h*k;a=e.i*l+e.m*g+e.j*k;l=e.l*l+e.g*g+e.s*k;c=m+e.v;f=p+e.A;h+=e.B;e=d.position;e.x=c;e.y=f;e.z=h;d=d.normal;d.x=b;d.y=a;d.z=l;return!0}return!1}};Qa.wa=wc;Qa.prototype=gb(wc.prototype,{Xn:function(){return this.Rb},Go:function(a){0>a&&(a=0);this.Rb=a},he:function(){},ke:function(a,b,e,d){return this.rm?lb.mb.ke(this,e,a,b,d):wc.prototype.ke.call(this,a,b,e,d)}});jj.wa=Qa;jj.prototype=gb(Qa.prototype,{Aa:function(a,b,e){this.Kn=a;var d,c,f;d=e.x;c=e.y;f=e.z;var h;e=b.o*d+b.i*c+b.l*f;h=b.f*d+b.m*c+b.g*f;b=b.h*d+b.j*c+b.s*f;d=this.Xl=new n;d.x=e;d.y=h;d.z=b;this.Rb=a.Rb},he:function(a,b){this.Kn.he(a,b);var e=this.Xl;0e.J&&a.Ke.K&&a.Le.L){var c=this.Eh;null!=c?(this.Eh=c.M,c.M=null):c=new ve;null!=this.pe&&(c.M=this.pe);this.pe=c;c.Ch=a;c.Dh=e}e=d}a=b}},ke:function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;for(var l=this.Oe;null!=l;){var g=l.M,k=d,m=c,p=a,r=f,q=h,t=b,A=l.J,L=l.K,u=l.L,z=l.G,n=l.H,D=l.I;if(A>(k>r?k:r)||z<(k(m>q?m:q)||n<(m(p>t?p:t)||D<(pr?-r:r,y=0>q?-q:q,B=0>Ib?-Ib:Ib,E=.5*(z-A),K=.5*(n-L),H=.5*(D-u),k=k-.5*(z+A),m=m-.5*(n+L),p=p-.5*(D+u),u=m*Ib-p*q;0<(0>u?-u:u)-(K*B+H*y)?p=!0:(p=p*r-k*Ib,p=0<(0>p?-p:p)-(H*t+E*B));p?r=!0:(r=k*q-m*r,r=0<(0>r?-r:r)-(E*y+K*t));r=r?!1:!0}r&&e.process(l);l=g}},Vf:function(a,b,e,d){for(var c=this.Oe;null!=c;){var f=c.M,h=this.u.min;h.x=c.J;h.y=c.K;h.z=c.L;h=this.u.max;h.x=c.G;h.y=c.H;h.z=c.I;this.mk.Aa(a,b,e);h=lb.mb;0==h.Nj(this.mk,this.u,b,this.rg,null,!1)&&0>=h.distance&&d.process(c);c=f}},Ih:function(a,b){for(var e=this.Oe;null!=e;){var d=e.M;a.nae.J&&a.oae.K&&a.pae.L&&b.process(e);e=d}}});Kb.wa=ub;Kb.prototype=gb(ub.prototype,{Kh:function(a,b){this.Dj++;var e=0==a.P,d=0==b.P;a==b?e||(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):a.Jb.J&&a.Kb.K&&a.Lb.L&&(e&&d?(e=this.Eh,null!=e?(this.Eh=e.M,e.M=null):e=new ve,null!=this.pe&&(e.M=this.pe),this.pe=e,e.Ch=a.ub,e.Dh=b.ub):d||a.P>b.P?(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):(this.Kh(b.F[0],a),this.Kh(b.F[1],a)))},am:function(a,b,e,d,c,f,h,l){var g=a.J,k=a.K,m=a.L,p=a.G,r=a.H,q=a.I,t;if(g>(b>c?b:c)||p<(b(e>f?e:f)||r<(e(d>h?d:h)||q<(dA?-A:A;var z=0>L?-L:L,n=0>u?-u:u,D=.5*(p-g),Ib=.5*(r-k),y=.5*(q-m),g=b-.5*(p+g),k=e-.5*(r+k),m=d-.5*(q+m),q=k*u-m*L;0<(0>q?-q:q)-(Ib*n+y*z)?n=!0:(u=m*A-g*u,n=0<(0>u?-u:u)-(y*t+D*n));n?t=!0:(A=g*L-k*A,t=0<(0>A?-A:A)-(D*z+Ib*t));t=t?!1:!0}t&&(0==a.P?l.process(a.ub):(this.am(a.F[0],b,e,d,c,f,h,l),this.am(a.F[1],b,e,d,c,f,h,l)))},El:function(a,b,e,d,c){var f=this.u.min;f.x=a.J;f.y=a.K;f.z=a.L;f=this.u.max;f.x=a.G;f.y=a.H;f.z=a.I;this.mk.Aa(b,e,d);f=lb.mb;0==f.Nj(this.mk,this.u,e,this.rg,null,!1)&&0>=f.distance&&(0==a.P?c.process(a.ub):(this.El(a.F[0],b,e,d,c),this.El(a.F[1],b,e,d,c)))},yl:function(a,b,e){a.Jb.na&&a.Kb.oa&&a.Lb.pa&&(0==a.P?e.process(a.ub):(this.yl(a.F[0],b,e),this.yl(a.F[1],b,e)))},ni:function(a,b){a=new Wi(a,this.lm++);this.Vi++;null==this.Oe?this.Oe=a:(this.gf.M=a,a.ia=this.gf);this.gf=a;a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;b=this.ye;var e=b.qd;null!=e?(b.qd=e.M,e.M=null):e=new oi;var d=e;d.ub=a;a.ei=d;d.J=a.J;d.K=a.K;d.L=a.L;d.G=a.G;d.H=a.H;d.I=a.I;b.yk++;null==b.zg?b.zg=d:(b.qf.ng=d,d.og=b.qf);b.qf=d;if(null==b.Nb)b.Nb=d;else{for(var c=b.Nb;0e.P)){var d=e.Ea,f=e.F[0],h=e.F[1],l=f.P-h.P,c=e.Ja;1l.P?(f.F[1]=e,e.Ea=f,e.Ja=1,e.F[0]=l,l.Ea=e,l.Ja=0):(f.F[0]=e,e.Ea=f,e.Ja=0,e.F[0]=h,h.Ea=e,h.Ja=0),h=f.F[0],l=f.F[1],f.J=h.Jl.G?h.G:l.G,f.H=h.H>l.H?h.H:l.H,f.I=h.I>l.I?h.I:l.I,h=f.F[0].P,l=f.F[1].P,f.P=(h>l?h:l)+1,h=e.F[0],l=e.F[1],e.J=h.Jl.G?h.G:l.G,e.H=h.H>l.H?h.H:l.H,e.I=h.I>l.I?h.I:l.I,h=e.F[0].P,l=e.F[1].P,e.P=(h>l?h:l)+1,null!=d?(d.F[c]=f,f.Ea=d,f.Ja=c):(b.Nb=f,f.Ea=null),e=f):-1>l&&(f=h.F[0],l=h.F[1],f.P>l.P?(h.F[1]=e,e.Ea=h,e.Ja=1,e.F[1]=l,l.Ea=e,l.Ja=1):(h.F[0]=e,e.Ea=h,e.Ja=0,e.F[1]=f,f.Ea=e,f.Ja=1),f=h.F[0],l=h.F[1],h.J=f.Jl.G?f.G:l.G,h.H=f.H>l.H?f.H:l.H,h.I=f.I>l.I?f.I:l.I,f=h.F[0].P,l=h.F[1].P,h.P=(f>l?f:l)+1,f=e.F[0],l=e.F[1],e.J=f.Jl.G?f.G:l.G,e.H=f.H>l.H?f.H:l.H,e.I=f.I>l.I?f.I:l.I,f=e.F[0].P,l=e.F[1].P,e.P=(f>l?f:l)+1,null!=d?(d.F[c]=h,h.Ea=d,h.Ja=c):(b.Nb=h,h.Ea=null),e=h)}d=e.F[0].P;c=e.F[1].P;e.P=(d>c?d:c)+1;d=e.F[0];c=e.F[1];e.J=d.Jc.G?d.G:c.G;e.H=d.H>c.H?d.H:c.H;e.I=d.I>c.I?d.I:c.I;e=e.Ea}}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){b=Array(this.$f<<1);e=0;for(d=this.$f;ed.P)){var c=d.Ea,h=d.F[0],l=d.F[1],g=h.P-l.P,f=d.Ja;1g.P?(h.F[1]=d,d.Ea=h,d.Ja=1,d.F[0]=g,g.Ea=d,g.Ja=0):(h.F[0]=d,d.Ea=h,d.Ja=0,d.F[0]=l,l.Ea=d,l.Ja=0),l=h.F[0],g=h.F[1],h.J=l.Jg.G?l.G:g.G,h.H=l.H>g.H?l.H:g.H,h.I=l.I>g.I?l.I:g.I,l=h.F[0].P,g=h.F[1].P,h.P=(l>g?l:g)+1,l=d.F[0],g=d.F[1],d.J=l.Jg.G?l.G:g.G,d.H=l.H>g.H?l.H:g.H,d.I=l.I>g.I?l.I:g.I,l=d.F[0].P,g=d.F[1].P,d.P=(l>g?l:g)+1,null!=c?(c.F[f]=h,h.Ea=c,h.Ja=f):(b.Nb=h,h.Ea=null),d=h):-1>g&&(h=l.F[0],g=l.F[1],h.P>g.P?(l.F[1]=d,d.Ea=l,d.Ja=1,d.F[1]=g,g.Ea=d,g.Ja=1):(l.F[0]=d,d.Ea=l,d.Ja=0,d.F[1]=h,h.Ea=d,h.Ja=1),h=l.F[0],g=l.F[1],l.J=h.Jg.G?h.G:g.G,l.H=h.H>g.H?h.H:g.H,l.I=h.I>g.I?h.I:g.I,h=l.F[0].P,g=l.F[1].P,l.P=(h>g?h:g)+1,h=d.F[0],g=d.F[1],d.J=h.Jg.G?h.G:g.G,d.H=h.H>g.H?h.H:g.H,d.I=h.I>g.I?h.I:g.I,h=d.F[0].P,g=d.F[1].P,d.P=(h>g?h:g)+1,null!=c?(c.F[f]=l,l.Ea=c,l.Ja=f):(b.Nb=l,l.Ea=null),d=l)}c=d.F[0].P;f=d.F[1].P;d.P=(c>f?c:f)+1;c=d.F[0];f=d.F[1];d.J=c.Jf.G?c.G:f.G;d.H=c.H>f.H?c.H:f.H;d.I=c.I>f.I?c.I:f.I;d=d.Ea}}}a.ei=null;e.F[0]=null;e.F[1]=null;e.Ja=0;e.Ea=null;e.P=0;e.ub=null;e.M=b.qd;b.qd=e;a.userData=null;a.M=null;a.ia=null;a.zh&&(a.zh=!1)},Qd:function(a,b,e){if(!(a.J<=b.na&&a.G>=b.ka&&a.K<=b.oa&&a.H>=b.la&&a.L<=b.pa&&a.I>=b.ma)){a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;if(null!=e){var d;b=e.x;d=e.y;e=e.z;a.J+=0b?0:b;a.H+=0>d?0:d;a.I+=0>e?0:e}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){e=Array(this.$f<<1);b=0;for(d=this.$f;bthis.Vi)){for(var b=this.$f/this.Vit.P)){var A=t.Ea,L=t.F[0],u=t.F[1],z=L.P-u.P,n=t.Ja;if(1Ib.P){L.F[1]=t;t.Ea=L;t.Ja=1;t.F[0]=Ib;Ib.Ea=t;Ib.Ja=0;var y=L.F[0],B=L.F[1];L.J=y.JB.G?y.G:B.G;L.H=y.H>B.H?y.H:B.H;L.I=y.I>B.I?y.I:B.I;var E=L.F[0].P,K=L.F[1].P;L.P=(E>K?E:K)+1;var H=t.F[0],mc=t.F[1];t.J=H.Jmc.G?H.G:mc.G;t.H=H.H>mc.H?H.H:mc.H;t.I=H.I>mc.I?H.I:mc.I;var R=t.F[0].P,x=t.F[1].P;t.P=(R>x?R:x)+1}else{L.F[0]=t;t.Ea=L;t.Ja=0;t.F[0]=D;D.Ea=t;D.Ja=0;var X=L.F[0],dd=L.F[1];L.J=X.Jdd.G?X.G:dd.G;L.H=X.H>dd.H?X.H:dd.H;L.I=X.I>dd.I?X.I:dd.I;var Da=L.F[0].P,qa=L.F[1].P;L.P=(Da>qa?Da:qa)+1;var Ub=t.F[0],ya=t.F[1];t.J=Ub.Jya.G?Ub.G:ya.G;t.H=Ub.H>ya.H?Ub.H:ya.H;t.I=Ub.I>ya.I?Ub.I:ya.I;var Jj=t.F[0].P,Ea=t.F[1].P;t.P=(Jj>Ea?Jj:Ea)+1}null!=A?(A.F[n]=L,L.Ea=A,L.Ja=n):(h.Nb=L,L.Ea=null);t=L}else if(-1>z){var O=u.F[0],sa=u.F[1];if(O.P>sa.P){u.F[1]=t;t.Ea=u;t.Ja=1;t.F[1]=sa;sa.Ea=t;sa.Ja=1;var ba=u.F[0],za=u.F[1];u.J=ba.Jza.G?ba.G:za.G;u.H=ba.H>za.H?ba.H:za.H;u.I=ba.I>za.I?ba.I:za.I;var Ta=u.F[0].P,C=u.F[1].P;u.P=(Ta>C?Ta:C)+1;var Aa=t.F[0],na=t.F[1];t.J=Aa.Jna.G?Aa.G:na.G;t.H=Aa.H>na.H?Aa.H:na.H;t.I=Aa.I>na.I?Aa.I:na.I;var La=t.F[0].P,Ba=t.F[1].P;t.P=(La>Ba?La:Ba)+1}else{u.F[0]=t;t.Ea=u;t.Ja=0;t.F[1]=O;O.Ea=t;O.Ja=1;var ta=u.F[0],S=u.F[1];u.J=ta.JS.G?ta.G:S.G;u.H=ta.H>S.H?ta.H:S.H;u.I=ta.I>S.I?ta.I:S.I;var ha=u.F[0].P,ea=u.F[1].P;u.P=(ha>ea?ha:ea)+1;var da=t.F[0],M=t.F[1];t.J=da.JM.G?da.G:M.G;t.H=da.H>M.H?da.H:M.H;t.I=da.I>M.I?da.I:M.I;var T=t.F[0].P,w=t.F[1].P;t.P=(T>w?T:w)+1}null!=A?(A.F[n]=u,u.Ea=A,u.Ja=n):(h.Nb=u,u.Ea=null);t=u}}var V=t.F[0].P,ia=t.F[1].P;t.P=(V>ia?V:ia)+1;var Y=t.F[0],oa=t.F[1];t.J=Y.Joa.G?Y.G:oa.G;t.H=Y.H>oa.H?Y.H:oa.H;t.I=Y.I>oa.I?Y.I:oa.I;t=t.Ea}}}f.ei=null;l.M=null;l.Ja=0;l.F[0]=null;l.F[1]=null;l.Ja=0;l.Ea=null;l.P=0;l.ub=null;l.M=h.qd;h.qd=l;var ua=this.ye,ca=ua.qd;null!=ca?(ua.qd=ca.M,ca.M=null):ca=new oi;var Ma=ca;Ma.ub=f;f.ei=Ma;Ma.J=f.J;Ma.K=f.K;Ma.L=f.L;Ma.G=f.G;Ma.H=f.H;Ma.I=f.I;ua.yk++;null==ua.zg?ua.zg=Ma:(ua.qf.ng=Ma,Ma.og=ua.qf);ua.qf=Ma;if(null==ua.Nb)ua.Nb=Ma;else{for(var va=ua.Nb;0Q.P)){var ja=Q.Ea,Ga=Q.F[0],P=Q.F[1],Ya=Ga.P-P.P,N=Q.Ja;if(1J.P){Ga.F[1]=Q;Q.Ea=Ga;Q.Ja=1;Q.F[0]=J;J.Ea=Q;J.Ja=0;var Vb=Ga.F[0],Ab=Ga.F[1];Ga.J=Vb.JAb.G?Vb.G:Ab.G;Ga.H=Vb.H>Ab.H?Vb.H:Ab.H;Ga.I=Vb.I>Ab.I?Vb.I:Ab.I;var ib=Ga.F[0].P,hb=Ga.F[1].P;Ga.P=(ib>hb?ib:hb)+1;var ka=Q.F[0],Ia=Q.F[1];Q.J=ka.JIa.G?ka.G:Ia.G;Q.H=ka.H>Ia.H?ka.H:Ia.H;Q.I=ka.I>Ia.I?ka.I:Ia.I;var ab=Q.F[0].P,bb=Q.F[1].P;Q.P=(ab>bb?ab:bb)+1}else{Ga.F[0]=Q;Q.Ea=Ga;Q.Ja=0;Q.F[0]=wb;wb.Ea=Q;wb.Ja=0;var Wa=Ga.F[0],Va=Ga.F[1];Ga.J=Wa.JVa.G?Wa.G:Va.G;Ga.H=Wa.H>Va.H?Wa.H:Va.H;Ga.I=Wa.I>Va.I?Wa.I:Va.I;var qb=Ga.F[0].P,kb=Ga.F[1].P;Ga.P=(qb>kb?qb:kb)+1;var Sa=Q.F[0],Na=Q.F[1];Q.J=Sa.JNa.G?Sa.G:Na.G;Q.H=Sa.H>Na.H?Sa.H:Na.H;Q.I=Sa.I>Na.I?Sa.I:Na.I;var Za=Q.F[0].P,vb=Q.F[1].P;Q.P=(Za>vb?Za:vb)+1}null!=ja?(ja.F[N]=Ga,Ga.Ea=ja,Ga.Ja=N):(ua.Nb=Ga,Ga.Ea=null);Q=Ga}else if(-1>Ya){var mb=P.F[0],xb=P.F[1];if(mb.P>xb.P){P.F[1]=Q;Q.Ea=P;Q.Ja=1;Q.F[1]=xb;xb.Ea=Q;xb.Ja=1;var nb=P.F[0],fb=P.F[1];P.J=nb.Jfb.G?nb.G:fb.G;P.H=nb.H>fb.H?nb.H:fb.H;P.I=nb.I>fb.I?nb.I:fb.I;var Re=P.F[0].P,Db=P.F[1].P;P.P=(Re>Db?Re:Db)+1;var G=Q.F[0],sb=Q.F[1];Q.J=G.Jsb.G?G.G:sb.G;Q.H=G.H>sb.H?G.H:sb.H;Q.I=G.I>sb.I?G.I:sb.I;var jb=Q.F[0].P,Xb=Q.F[1].P;Q.P=(jb>Xb?jb:Xb)+1}else{P.F[0]=Q;Q.Ea=P;Q.Ja=0;Q.F[1]=mb;mb.Ea=Q;mb.Ja=1;var ob=P.F[0],cb=P.F[1];P.J=ob.Jcb.G?ob.G:cb.G;P.H=ob.H>cb.H?ob.H:cb.H;P.I=ob.I>cb.I?ob.I:cb.I;var zb=P.F[0].P,Xa=P.F[1].P;P.P=(zb>Xa?zb:Xa)+1;var tb=Q.F[0],v=Q.F[1];Q.J=tb.Jv.G?tb.G:v.G;Q.H=tb.H>v.H?tb.H:v.H;Q.I=tb.I>v.I?tb.I:v.I;var W=Q.F[0].P,U=Q.F[1].P;Q.P=(W>U?W:U)+1}null!=ja?(ja.F[N]=P,P.Ea=ja,P.Ja=N):(ua.Nb=P,P.Ea=null);Q=P}}var db=Q.F[0].P,cc=Q.F[1].P;Q.P=(db>cc?db:cc)+1;var Ra=Q.F[0],Ha=Q.F[1];Q.J=Ra.JHa.G?Ra.G:Ha.G;Q.H=Ra.H>Ha.H?Ra.H:Ha.H;Q.I=Ra.I>Ha.I?Ra.I:Ha.I;Q=Q.Ea}}b&&this.Kh(this.ye.Nb,f.ei);f.zh=!1}this.rf[c]=null}b||this.Kh(this.ye.Nb,this.ye.Nb);this.$f=0}},ke:function(a,b,e){null!=this.ye.Nb&&this.am(this.ye.Nb,a.x,a.y,a.z,b.x,b.y,b.z,e)},Vf:function(a,b,e,d){null!=this.ye.Nb&&this.El(this.ye.Nb,a,b,e,d)},Ih:function(a,b){null!=this.ye.Nb&&this.yl(this.ye.Nb,a,b)},so:function(){return this.ye.An()}});Wi.wa=Qc;Wi.prototype=gb(Qc.prototype,{});Hj.prototype={jm:function(a,b){switch(this.mm){case 0:var e,d,c;e=b.J+b.G;d=b.K+b.H;c=b.L+b.I;var f=a.F[0];a=a.F[1];var h,l,g;h=f.J+f.G;b=f.K+f.H;f=f.L+f.I;l=a.J+a.G;g=a.K+a.H;a=a.L+a.I;h-=e;b-=d;f-=c;l-=e;g-=d;a-=c;return h*h+b*b+f*fb.G?a.G:b.G;r=a.H>b.H?a.H:b.H;g=a.I>b.I?a.I:b.I;c=r-p;l=g-l;e=2*((d-e)*(c+l)+c*l);c=2*e;a=2*(e-2*((a.G-a.J)*(k+m)+k*m));e=f.Jb.G?f.G:b.G;r=f.H>b.H?f.H:b.H;g=f.I>b.I?f.I:b.I;0==f.P?(f=r-p,l=g-l,f=a+2*((d-e)*(f+l)+f*l)):(k=r-p,l=g-l,g=f.H-f.K,m=f.I-f.L,f=a+(2*((d-e)*(k+l)+k*l)-2*((f.G-f.J)*(g+m)+g*m)));e=h.Jb.G?h.G:b.G;r=h.H>b.H?h.H:b.H;g=h.I>b.I?h.I:b.I;0==h.P?(h=r-p,b=g-l,e=a+2*((d-e)*(h+b)+h*b)):(b=r-p,l=g-l,g=h.H-h.K,k=h.I-h.L,e=a+(2*((d-e)*(b+l)+b*l)-2*((h.G-h.J)*(g+k)+g*k)));return cb&&(b=-b);return b+this.Hl(a.F[0])+this.Hl(a.F[1])}};eb.prototype={Aa:function(a,b){this.na=a.x;this.oa=a.y;this.pa=a.z;this.ka=b.x;this.la=b.y;this.ma=b.z;return this},Uc:function(){var a=new n;a.x=this.na;a.y=this.oa;a.z=this.pa;return a},Vc:function(a){a.x=this.na;a.y=this.oa;a.z=this.pa},ie:function(a){this.na=a.x;this.oa=a.y;this.pa=a.z;return this},Dc:function(){var a=new n;a.x=this.ka;a.y=this.la;a.z=this.ma;return a},Hc:function(a){a.x=this.ka;a.y=this.la;a.z=this.ma},vd:function(a){this.ka=a.x;this.la=a.y;this.ma=a.z;return this},Cb:function(){var a=new n,b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},Kb:function(a){var b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d},kc:function(){var a=new n,b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},lc:function(a){var b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d},wa:function(a){this.na=this.naa.ka?this.ka:a.ka;this.la=this.la>a.la?this.la:a.la;this.ma=this.ma>a.ma?this.ma:a.ma;return this},mb:function(a){var b=new eb;b.na=this.naa.ka?this.ka:a.ka;b.la=this.la>a.la?this.la:a.la;b.ma=this.ma>a.ma?this.ma:a.ma;return b},Wc:function(a){return this.naa.na&&this.oaa.oa&&this.paa.pa:!1},wc:function(a){var b=new eb;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaa.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaf?-f:f)+(0>l?-l:l)+(0>k?-k:k);h=(0>h?-h:h)+(0>g?-g:g)+(0>m?-m:m);e=(0>e?-e:e)+(0>d?-d:d)+(0>c?-c:c);a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-e;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+e},he:function(a,b){var e,d,c;c=d=e=this.Rb;e=ed){if(a<=-l||a>=l)return!1}else{var L=1/d,u=(-l-a)*L,l=(l-a)*L;u>l&&(L=u,u=l,l=L);0l&&(q=l)}if(-1E-6c){if(b<=-g||b>=g)return!1}else u=1/c,l=(-g-b)*u,g=(g-b)*u,l>g&&(u=l,l=g,g=u),0g&&(t=g);if(-1E-6f){if(e<=-k||e>=k)return!1}else l=1/f,g=(-k-e)*l,k=(k-e)*l,g>k&&(l=g,g=k,k=l),0k&&(A=k);if(1<=m||1<=p||1<=r||0>=q||0>=t||0>=A)return!1;k=m;m=0;p>k&&(k=p,m=1);r>k&&(k=r,m=2);tq||!k)return!1;switch(m){case 0:h.normal.Aa(0f?-f:f)*this.Db;h=(0>h?-h:h)*this.Db;l=(0>l?-l:l)*this.Db;e+=f;d+=h;c+=l;a.na=b.v-e;a.oa=b.A-d;a.pa=b.B-c;a.ka=b.v+e;a.la=b.A+d;a.ma=b.B+c},he:function(a,b){0q)return!1;if(0=(-r+q)/p)return!1}else{if(0<=m)return!1;m=0}p=b+(c-b)*m;if(p>-l&&pp?-l:l;t=a-0;l=b-g;k=e-0;a=d-a;b=c-b;e=f-e;p=a*a+b*b+e*e;r=t*a+l*b+k*e;m=t*t+l*l+k*k-this.ab*this.ab;q=r*r-p*m;if(0>q)return!1;f=(-r-Math.sqrt(q))/p;if(0>f||1p?g:p;h=k>r?k:r;f=m>q?m:q;g=ge?l:e);a.la=b.A+(h>d?h:d);a.ma=b.B+(f>c?f:c)},he:function(a,b){var e=a.x,d=a.y,c=a.z;0this.Mk*this.Mk*(e*e+d*d+c*c)?(b.Aa(0,this.Db-this.Rb/this.Mk,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,d=e*e+a*a,c=2*this.Db,c=(c-this.Rb)/c*this.ab-this.Rb/this.Dk,0>c&&(c=0),d=0c&&(c=0),b.x=e*d,b.y=-c,b.z=a*d)},Wi:function(a,b,e,d,c,f,h){var l=this.Db;d-=a;c-=b;f-=e;var g=0,k=1;if(-1E-6c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,m=(l-b)*m;if(p>m)var r=p,p=m,m=r;0m&&(k=m)}if(1<=g||0>=k)return!1;b-=l;var r=this.Dk*this.Dk,m=r*(d*d+c*c+f*f)-c*c,p=r*(a*d+b*c+e*f)-b*c,r=r*(a*a+b*b+e*e)-b*b,q=p*p-m*r;if(m){if(0>q)return!1;q=Math.sqrt(q);if(0>m)if(0=p)return!1}else{if(r=(-p-q)/m,p=1,1<=r)return!1}else if(r=(-p-q)/m,p=(-p+q)/m,1<=r||0>=p)return!1}else if(m=-r/(2*p),0=m)return!1}else if(r=m,p=1,1<=m)return!1;b+=l;if(p<=g||k<=r)return!1;if(rd&&(d=k);mc&&(c=m);gf&&(f=g)}h=d-a;l=c-b;k=f-e;this.Sf=h*l*k;a=.25*((a+d)*(a+d)+(b+c)*(b+c)+(e+f)*(e+f));h=h*h*.25;l=l*l*.25;k=k*k*.25;this.Dg=.3333333333333333*(l+k)+a;this.Gg=this.Fg=this.Eg=0;this.Hg=.3333333333333333*(k+h)+a;this.Kg=this.Jg=this.Ig=0;this.Lg=.3333333333333333*(h+l)+a},Lb:function(a,b){var e,d,c,f,h,l,g,k,m;m=k=g=this.Rb;var p,r,q;e=this.Ca[0];p=e.x;r=e.y;q=e.z;d=b.o*p+b.f*r+b.h*q;e=b.i*p+b.m*r+b.j*q;c=b.l*p+b.g*r+b.s*q;p=d+b.v;r=e+b.A;q=c+b.B;e=p;d=r;c=q;f=p;h=r;l=q;for(var t=1,A=this.We;tp?f:p;h=h>r?h:r;l=l>q?l:q}a.na=e-g;a.oa=d-k;a.pa=c-m;a.ka=f+g;a.la=h+k;a.ma=l+m},he:function(a,b){for(var e=this.Ca[0],e=e.x*a.x+e.y*a.y+e.z*a.z,d=0,c=1,f=this.We;ce&&(e=l,d=h)}a=this.Ca[d];b.x=a.x;b.y=a.y;b.z=a.z}});Qd.wa=Qa;Qd.prototype=gb(Qa.prototype,{pi:function(){return this.ab},Pj:function(){return this.Db},Xe:function(){var a=this.ab*this.ab,b=this.Db*this.Db*4;this.Sf=3.14159265358979*a*this.Db*2;this.Dg=.08333333333333333*(3*a+b);this.Gg=this.Fg=this.Eg=0;this.Hg=.5*a;this.Kg=this.Jg=this.Ig=0;this.Lg=.08333333333333333*(3*a+b)},Lb:function(a,b){var e,d,c,f,h,l;e=b.f;d=b.m;c=b.g;e=0>e?-e:e;d=0>d?-d:d;c=0>c?-c:c;f=Math.sqrt(1-e*e);h=Math.sqrt(1-d*d);l=Math.sqrt(1-c*c);f*=this.ab;h*=this.ab;l*=this.ab;e*=this.Db;d*=this.Db;c*=this.Db;f+=e;h+=d;l+=c;a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-l;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+l},he:function(a,b){var e=a.x,d=a.z,c=e*e+d*d,f=this.ab-this.Rb;0>f&&(f=0);c=0f&&(f=0);b.x=e*c;b.y=0c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,l=(l-b)*m;p>l&&(m=p,p=l,l=m);0l&&(k=l)}if(1<=g||0>=k)return!1;var l=d*d+f*f,p=a*d+e*f,m=a*a+e*e-this.ab*this.ab,r=p*p-l*m;if(0>r)return!1;if(0=l)return!1}else{if(0<=m)return!1;m=0;l=1}if(l<=g||k<=m)return!1;if(mk)return!1;f=(-g-Math.sqrt(k))/f;if(0>f||1a&&(a=this.points[d].depth)}return a},clear:function(){for(var a=this.numPoints=0,b=this.points;aPa&&(Pa=-Pa);0>Fa&&(Fa=-Fa);0>Q&&(Q=-Q);var aa=Pa+Fa+Q,fa=L*q+u*t+z*A,N=Z+aa,ja=0>fa,Ga=ja?-fa:fa;if(GaP&&(Y=P,oa=0,ca=L,Ma=u,va=z,ua=ja?-1:1);var Z=ya,Ya=n*S+D*ha+Ib*ea,J=n*da+D*M+Ib*T,wb=n*w+D*V+Ib*ia;0>Ya&&(Ya=-Ya);0>J&&(J=-J);0>wb&&(wb=-wb);var aa=Ya+J+wb,fa=n*q+D*t+Ib*A,ec=Z+aa,Vb=0>fa,Ab=Vb?-fa:fa;if(Abhb&&(hb=-hb);0>ka&&(ka=-ka);0>Ia&&(Ia=-Ia);var aa=hb+ka+Ia,fa=y*q+B*t+E*A,ab=Z+aa,bb=0>fa,Wa=bb?-fa:fa;if(WaF.linearSlop?Y-F.linearSlop:0,qb=K*ba+H*za+mc*Ta,kb=K*C+H*Aa+mc*na,Sa=K*La+H*Ba+mc*ta;0>qb&&(qb=-qb);0>kb&&(kb=-kb);0>Sa&&(Sa=-Sa);var Z=qb+kb+Sa,aa=Ea,fa=K*q+H*t+mc*A,Na=Z+aa,Za=0>fa,vb=Za?-fa:fa;if(vbxb&&(xb=-xb);0>nb&&(nb=-nb);0>fb&&(fb=-fb);var Z=xb+nb+fb,aa=O,fa=R*q+x*t+X*A,Re=Z+aa,Db=0>fa,G=Db?-fa:fa;if(Gjb&&(jb=-jb);0>Xb&&(Xb=-Xb);0>ob&&(ob=-ob);var Z=jb+Xb+ob,aa=sa,fa=dd*q+Da*t+qa*A,cb=Z+aa,zb=0>fa,Xa=zb?-fa:fa;if(XaF.linearSlop?Y-F.linearSlop:0,v,W,U;v=u*mc-z*H;W=z*K-L*mc;U=L*H-u*K;if(v||W||U){var db=v*v+W*W+U*U;0cc&&(cc=-cc);0>Ra&&(Ra=-Ra);var Z=cc+Ra,Ha=v*da+W*M+U*T,rb=v*w+W*V+U*ia;0>Ha&&(Ha=-Ha);0>rb&&(rb=-rb);var aa=Ha+rb,fa=v*q+W*t+U*A,yb=Z+aa,Cb=0>fa,la=Cb?-fa:fa;if(lama&&(ma=-ma);0>Ja&&(Ja=-Ja);var Z=ma+Ja,$a=v*S+W*ha+U*ea,Oa=v*w+W*V+U*ia;0>$a&&($a=-$a);0>Oa&&(Oa=-Oa);var aa=$a+Oa,fa=v*q+W*t+U*A,nc=Z+aa,xa=0>fa,Fc=xa?-fa:fa;if(Fcoj&&(oj=-oj);0>pa&&(pa=-pa);var Z=oj+pa,Ca=v*S+W*ha+U*ea,xd=v*da+W*M+U*T;0>Ca&&(Ca=-Ca);0>xd&&(xd=-xd);var aa=Ca+xd,fa=v*q+W*t+U*A,Kj=Z+aa,Ka=0>fa,de=Ka?-fa:fa;if(deoc&&(oc=-oc);0>Id&&(Id=-Id);var Z=oc+Id,$d=v*da+W*M+U*T,rc=v*w+W*V+U*ia;0>$d&&($d=-$d);0>rc&&(rc=-rc);var aa=$d+rc,fa=v*q+W*t+U*A,Jc=Z+aa,Ua=0>fa,eb=Ua?-fa:fa;if(ebuc&&(uc=-uc);0>gc&&(gc=-gc);var Z=uc+gc,Xc=v*S+W*ha+U*ea,Eb=v*w+W*V+U*ia;0>Xc&&(Xc=-Xc);0>Eb&&(Eb=-Eb);var aa=Xc+Eb,fa=v*q+W*t+U*A,Ng=Z+aa,qi=0>fa,gb=qi?-fa:fa;if(gbic&&(ic=-ic);0>Og&&(Og=-Og);var Z=ic+Og,pb=v*S+W*ha+U*ea,Bb=v*da+W*M+U*T;0>pb&&(pb=-pb);0>Bb&&(Bb=-Bb);var aa=pb+Bb,fa=v*q+W*t+U*A,Pg=Z+aa,sc=0>fa,Jd=sc?-fa:fa;if(JdZg&&(Zg=-Zg);0>vc&&(vc=-vc);var Z=Zg+vc,Fb=v*da+W*M+U*T,ub=v*w+W*V+U*ia;0>Fb&&(Fb=-Fb);0>ub&&(ub=-ub);var aa=Fb+ub,fa=v*q+W*t+U*A,Ob=Z+aa,Mj=0>fa,Qi=Mj?-fa:fa;if(QiHb&&(Hb=-Hb);0>Lb&&(Lb=-Lb);var Z=Hb+Lb,yf=v*S+W*ha+U*ea,Gb=v*w+W*V+U*ia;0>yf&&(yf=-yf);0>Gb&&(Gb=-Gb);var aa=yf+Gb,fa=v*q+W*t+U*A,Nb=Z+aa,Nj=0>fa,ri=Nj?-fa:fa;if(riSb&&(Sb=-Sb);0>fd&&(fd=-fd);var Z=Sb+fd,Rc=v*S+W*ha+U*ea,zc=v*da+W*M+U*T;0>Rc&&(Rc=-Rc);0>zc&&(zc=-zc);var aa=Rc+zc,fa=v*q+W*t+U*A,gd=Z+aa,Yc=0>fa,od=Yc?-fa:fa;if(odua){ke=-ke;le=-le;me=-me;Cd=-Cd;Dd=-Dd;hd=-hd;$c=Kd;Sc=ee;ld=Td;Kd=qd;ee=Ud;Td=Ld;qd=$c;Ud=Sc;Ld=ld;var Ue=Md;Md=ne;ne=Ue}ke+=l;le+=g;me+=k;var ad=1,Ed=0,id=Cd*K+Dd*H+hd*mc;id-F.contactPersistenceThreshold&&(bc?this.Wg(a,ge,rd,Vd,Wd,qe,he,wd,fe):this.Wg(a,Wd,qe,he,ge,rd,Vd,wd,fe))}}}}}}}}}});Ej.prototype={clip:function(){for(var a=0,b=this.fd;a=f){var h=this.Gb[this.gc++];h.x=d.x;h.y=d.y;h.Pa=d.Pa;h.Qa=d.Qa;h.Ra=d.Ra;c/=c-f;f=this.Gb[this.gc++];f.x=d.x+(e.x-d.x)*c;f.y=d.y+(e.y-d.y)*c;f.Pa=d.Pa+(e.Pa-d.Pa)*c;f.Qa=d.Qa+(e.Qa-d.Qa)*c;f.Ra=d.Ra+(e.Ra-d.Ra)*c}else 0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0this.fd)){for(var a=-Infinity,b=Infinity,e=-Infinity,d=Infinity,c=null,f=null,h=null,l=null,g=0,k=this.fd;ga&&(a=p,c=m);pe&&(e=r,h=m);rp?0:p>r?1:p/r):p=0,r=p*Ib+n,0>r?(r=0,p=0>k?0:k>D?1:k/D):r>z?(r=1,p=Ib+k,p=0>p?0:p>D?1:p/D):r/=z):(r=0,p=0>k?0:k>D?1:k/D):(p=0,r=0>n?0:n>z?1:n/z):r=p=0;q+=f*p;t+=L*p;A+=c*p;h+=m*r;l+=u*r;d+=g*r;L=q-h;f=t-l;r=A-d;p=L*L+f*f+r*r;p>=(b+e)*(b+e)||(p=Math.sqrt(p),0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},mb:function(a){var b,e,d,c;b=this.o;e=this.m;d=this.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},Dc:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.o=1-g-d;this.f=k-c;this.h=b+h;this.i=k+c;this.m=1-a-d;this.j=e-f;this.l=b-h;this.g=e+f;this.s=1-a-g;return this},clone:function(){var a=new Ua;a.v=this.v;a.A=this.A;a.B=this.B;a.o=this.o;a.f=this.f;a.h=this.h;a.i=this.i;a.m=this.m;a.j=this.j;a.l=this.l;a.g=this.g;a.s=this.s;return a},qe:function(a){this.v=a.v;this.A=a.A;this.B=a.B;this.o=a.o;this.f=a.f;this.h=a.h;this.i=a.i;this.m=a.m;this.j=a.j;this.l=a.l;this.g=a.g;this.s=a.s;return this}};lb.kc=function(){return lb.mb};lb.prototype={Nj:function(a,b,e,d,c,f){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var h=this.La,l=this.eb,g=this.ib,k=this.closest,m=this.dir;null!=c?(null==c.Ji&&(c.Ji=new Dj),this.yo(c.Ji)):m.R();if(!(m.x*m.x+m.y*m.y+m.z*m.z)){var p,r,q;p=d.v-e.v;r=d.A-e.A;q=d.B-e.B;m.x=p;m.y=r;m.z=q;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.Aa(1,0,0)}this.Ba=0;this.Tf(!1);this.Uf(!1);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;for(var u=0;40>u;){var z=0;switch(this.Ba){case 1:var n=h[0];k.x=n.x;k.y=n.y;k.z=n.z;z=1;break;case 2:var D,Ib,y,B,E,K,H=h[0];D=H.x;Ib=H.y;y=H.z;var mc=h[1];B=mc.x;E=mc.y;K=mc.z;var R,x,X;R=B-D;x=E-Ib;X=K-y;var F=R*D+x*Ib+X*y,F=-F/(R*R+x*x+X*X);if(0>F)k.x=D,k.y=Ib,k.z=y,z=1;else if(1O*oa+sa*ua+ba*ca){var P,Ya,Yg,wb,ec,Vb;P=ya.x;Ya=ya.y;Yg=ya.z;wb=N.x;ec=N.y;Vb=N.z;var Ab,ib,hb;Ab=wb-P;ib=ec-Ya;hb=Vb-Yg;var ka=Ab*P+ib*Ya+hb*Yg,ka=-ka/(Ab*Ab+ib*ib+hb*hb),Ia;if(0>ka)k.x=P,k.y=Ya,k.z=Yg,Ia=1;else if(1za*Ma+Ta*va+C*Z){var Va,qb,kb,Sa,Na,Za;Va=N.x;qb=N.y;kb=N.z;Sa=Ea.x;Na=Ea.y;Za=Ea.z;var vb,mb,xb;vb=Sa-Va;mb=Na-qb;xb=Za-kb;var nb=vb*Va+mb*qb+xb*kb,nb=-nb/(vb*vb+mb*mb+xb*xb),fb;if(0>nb)k.x=Va,k.y=qb,k.z=kb,fb=1;else if(1aa||sbAa*Pa+na*Fa+La*Q){var jb,Xb,ob,cb,zb,Xa;jb=ya.x;Xb=ya.y;ob=ya.z;cb=Ea.x;zb=Ea.y;Xa=Ea.z;var tb,v,W;tb=cb-jb;v=zb-Xb;W=Xa-ob;var U=tb*jb+v*Xb+W*ob,U=-U/(tb*tb+v*v+W*W),db;if(0>U)k.x=jb,k.y=Xb,k.z=ob,db=1;else if(1aa||rb(Ja*gc+$a*Xc+Oa*Eb)*Pg){var vc,Jb,Ob,Hb,Lb,Qi,Gb,Qb,Sb,Nb,yf,lb,Rb,Kb,ri,kd,dc,Wb;vc=la.x;Jb=la.y;Ob=la.z;Hb=ra.x;Lb=ra.y;Qi=ra.z;Gb=ga.x;Qb=ga.y;Sb=ga.z;Nb=Hb-vc;yf=Lb-Jb;lb=Qi-Ob;Rb=Gb-Hb;Kb=Qb-Lb;ri=Sb-Qi;kd=vc-Gb;dc=Jb-Qb;Wb=Ob-Sb;var fd,Rc,zc;fd=yf*ri-lb*Kb;Rc=lb*Rb-Nb*ri;zc=Nb*Kb-yf*Rb;var gd,Yc,od,Mb,Tb,pc,Zc,Kc,Lc;gd=yf*zc-lb*Rc;Yc=lb*fd-Nb*zc;od=Nb*Rc-yf*fd;Mb=Kb*zc-ri*Rc;Tb=ri*fd-Rb*zc;pc=Rb*Rc-Kb*fd;Zc=dc*zc-Wb*Rc;Kc=Wb*fd-kd*zc;Lc=kd*Rc-dc*fd;var xc=-1,Cc,Dc,pd,yd=0;pd=Dc=Cc=0;if(0>vc*gd+Jb*Yc+Ob*od){var sd,td,zd,$g,Pb,$b;sd=la.x;td=la.y;zd=la.z;$g=ra.x;Pb=ra.y;$b=ra.z;var ac,bc,kc;ac=$g-sd;bc=Pb-td;kc=$b-zd;var Sd=ac*sd+bc*td+kc*zd,Sd=-Sd/(ac*ac+bc*bc+kc*kc),ie;if(0>Sd)k.x=sd,k.y=td,k.z=zd,ie=1;else if(1Hb*Mb+Lb*Tb+Qi*pc){var tc,qc,Zb,Ge,He,Se;tc=ra.x;qc=ra.y;Zb=ra.z;Ge=ga.x;He=ga.y;Se=ga.z;var Te,Ie,Je;Te=Ge-tc;Ie=He-qc;Je=Se-Zb;var ae=Te*tc+Ie*qc+Je*Zb,ae=-ae/(Te*Te+Ie*Ie+Je*Je),xe;if(0>ae)k.x=tc,k.y=qc,k.z=Zb,xe=1;else if(1xc||QcGb*Zc+Qb*Kc+Sb*Lc){var wc,Ad,Bd,ud,ke,le;wc=la.x;Ad=la.y;Bd=la.z;ud=ga.x;ke=ga.y;le=ga.z;var me,Cd,Dd;me=ud-wc;Cd=ke-Ad;Dd=le-Bd;var hd=me*wc+Cd*Ad+Dd*Bd,hd=-hd/(me*me+Cd*Cd+Dd*Dd),Kd;if(0>hd)k.x=wc,k.y=Ad,k.z=Bd,Kd=1;else if(1xc||Ud(Ja*Ng+$a*qi+Oa*pb)*Pg){var Ue,ad,Ed,id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf;Ue=la.x;ad=la.y;Ed=la.z;id=ga.x;bd=ga.y;cd=ga.z;Vc=ma.x;Mc=ma.y;Nc=ma.z;Ec=id-Ue;yc=bd-ad;Bc=cd-Ed;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ue-Vc;oe=ad-Mc;lf=Ed-Nc;var md,Fd,ed;md=yc*Hc-Bc*Tc;Fd=Bc*Ac-Ec*Hc;ed=Ec*Tc-yc*Ac;var vd,jd,nd,mf,Uc,Pc,ve,we,Ri;vd=yc*ed-Bc*Fd;jd=Bc*md-Ec*ed;nd=Ec*Fd-yc*md;mf=Tc*ed-Hc*Fd;Uc=Hc*md-Ac*ed;Pc=Ac*Fd-Tc*md;ve=oe*ed-lf*Fd;we=lf*md-Oc*ed;Ri=Oc*Fd-oe*md;var fe=-1,pe,ge,rd,Vd=0;rd=ge=pe=0;if(0>Ue*vd+ad*jd+Ed*nd){var wd,Wd,qe,he,zf,sh;wd=la.x;Wd=la.y;qe=la.z;he=ga.x;zf=ga.y;sh=ga.z;var tg,ug,vg;tg=he-wd;ug=zf-Wd;vg=sh-qe;var Ke=tg*wd+ug*Wd+vg*qe,Ke=-Ke/(tg*tg+ug*ug+vg*vg),Ve;if(0>Ke)k.x=wd,k.y=Wd,k.z=qe,Ve=1;else if(1id*mf+bd*Uc+cd*Pc){var Nf,Of,gg,Pf,Qf,Rf;Nf=ga.x;Of=ga.y;gg=ga.z;Pf=ma.x;Qf=ma.y;Rf=ma.z;var Sf,Tf,Af;Sf=Pf-Nf;Tf=Qf-Of;Af=Rf-gg;var ye=Sf*Nf+Tf*Of+Af*gg,ye=-ye/(Sf*Sf+Tf*Tf+Af*Af),nf;if(0>ye)k.x=Nf,k.y=Of,k.z=gg,nf=1;else if(1fe||CeVc*ve+Mc*we+Nc*Ri){var wg,xg,Xd,Nd,Od,yg;wg=la.x;xg=la.y;Xd=la.z;Nd=ma.x;Od=ma.y;yg=ma.z;var zg,Ag,Bg;zg=Nd-wg;Ag=Od-xg;Bg=yg-Xd;var pf=zg*wg+Ag*xg+Bg*Xd,pf=-pf/(zg*zg+Ag*Ag+Bg*Bg),Vf;if(0>pf)k.x=wg,k.y=xg,k.z=Xd,Vf=1;else if(1fe||Wfsc||Cg(Ja*Qa+$a*xf+Oa*ic)*Pg){var Le,Xe,Xf,Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg;Le=la.x;Xe=la.y;Xf=la.z;Yf=ra.x;Zf=ra.y;$f=ra.z;Cf=ma.x;Df=ma.y;Ef=ma.z;Me=Yf-Le;Ff=Zf-Xe;jg=$f-Xf;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Le-Cf;Hf=Xe-Df;kg=Xf-Ef;var be,ce,Pd;be=Ff*Ye-jg*bg;ce=jg*ag-Me*Ye;Pd=Me*bg-Ff*ag;var Yd,Zd,Gd,Oj,Qd,Fe,Wc,Hd,Qg;Yd=Ff*Pd-jg*ce;Zd=jg*be-Me*Pd;Gd=Me*ce-Ff*be;Oj=bg*Pd-Ye*ce;Qd=Ye*be-ag*Pd;Fe=ag*ce-bg*be;Wc=Hf*Pd-kg*ce;Hd=kg*be-Gf*Pd;Qg=Gf*ce-Hf*be;var Ze=-1,rf,cg,re,sf=0;re=cg=rf=0;if(0>Le*Yd+Xe*Zd+Xf*Gd){var ze,Ae,tf,$e,If,Dg;ze=la.x;Ae=la.y;tf=la.z;$e=ra.x;If=ra.y;Dg=ra.z;var Eg,Fg,Gg;Eg=$e-ze;Fg=If-Ae;Gg=Dg-tf;var af=Eg*ze+Fg*Ae+Gg*tf,af=-af/(Eg*Eg+Fg*Fg+Gg*Gg),bf;if(0>af)k.x=ze,k.y=Ae,k.z=tf,bf=1;else if(1Yf*Oj+Zf*Qd+$f*Fe){var kj,lj,mj,th,uh,vh;kj=ra.x;lj=ra.y;mj=ra.z;th=ma.x;uh=ma.y;vh=ma.z;var wh,xh,yh;wh=th-kj;xh=uh-lj;yh=vh-mj;var mg=wh*kj+xh*lj+yh*mj,mg=-mg/(wh*wh+xh*xh+yh*yh),ah;if(0>mg)k.x=kj,k.y=lj,k.z=mj,ah=1;else if(1Ze||gfCf*Wc+Df*Hd+Ef*Qg){var ui,vi,wi,zh,Ah,Bh;ui=la.x;vi=la.y;wi=la.z;zh=ma.x;Ah=ma.y;Bh=ma.z;var Ch,Dh,Eh;Ch=zh-ui;Dh=Ah-vi;Eh=Bh-wi;var ng=Ch*ui+Dh*vi+Eh*wi,ng=-ng/(Ch*Ch+Dh*Dh+Eh*Eh),Rg;if(0>ng)k.x=ui,k.y=vi,k.z=wi,Rg=1;else if(1Ze||hfsc||jf(nc*Og+xa*Bb+Fc*Fb)*Pg){var Hg,Sg,Ai,dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh;Hg=ra.x;Sg=ra.y;Ai=ra.z;dh=ga.x;eh=ga.y;fh=ga.z;Gh=ma.x;Hh=ma.y;Ih=ma.z;gh=dh-Hg;hh=eh-Sg;ih=fh-Ai;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=Hg-Gh;Kh=Sg-Hh;Lh=Ai-Ih;var Ne,Oe,Pe;Ne=hh*Vg-ih*Ug;Oe=ih*Tg-gh*Vg;Pe=gh*Ug-hh*Tg;var cf,df,ef,ue,kf,te,vf,Kf,Lf;cf=hh*Pe-ih*Oe;df=ih*Ne-gh*Pe;ef=gh*Oe-hh*Ne;ue=Ug*Pe-Vg*Oe;kf=Vg*Ne-Tg*Pe;te=Tg*Oe-Ug*Ne;vf=Kh*Pe-Lh*Oe;Kf=Lh*Ne-Jh*Pe;Lf=Jh*Oe-Kh*Ne;var Wg=-1,jh,kh,uf,Ig=0;uf=kh=jh=0;if(0>Hg*cf+Sg*df+Ai*ef){var og,pg,lh,Mh,Nh,Oh;og=ra.x;pg=ra.y;lh=ra.z;Mh=ga.x;Nh=ga.y;Oh=ga.z;var Ph,Qh,Rh;Ph=Mh-og;Qh=Nh-pg;Rh=Oh-lh;var qg=Ph*og+Qh*pg+Rh*lh,qg=-qg/(Ph*Ph+Qh*Qh+Rh*Rh),mh;if(0>qg)k.x=og,k.y=pg,k.z=lh,mh=1;else if(1dh*ue+eh*kf+fh*te){var Ci,Di,Ei,Sh,Th,Uh;Ci=ga.x;Di=ga.y;Ei=ga.z;Sh=ma.x;Th=ma.y;Uh=ma.z;var Vh,Wh,Xh;Vh=Sh-Ci;Wh=Th-Di;Xh=Uh-Ei;var rg=Vh*Ci+Wh*Di+Xh*Ei,rg=-rg/(Vh*Vh+Wh*Wh+Xh*Xh),oh;if(0>rg)k.x=Ci,k.y=Di,k.z=Ei,oh=1;else if(1Wg||seGh*vf+Hh*Kf+Ih*Lf){var Gi,Hi,Ii,Yh,Zh,$h;Gi=ra.x;Hi=ra.y;Ii=ra.z;Yh=ma.x;Zh=ma.y;$h=ma.z;var ai,bi,ci;ai=Yh-Gi;bi=Zh-Hi;ci=$h-Ii;var sg=ai*Gi+bi*Hi+ci*Ii,sg=-sg/(ai*ai+bi*bi+ci*ci),Xg;if(0>sg)k.x=Gi,k.y=Hi,k.z=Ii,Xg=1;else if(1Wg||ffsc||bjk.x*k.x+k.y*k.y+k.z*k.z){if(!f)return this.distance=0;switch(this.Ba){case 1:this.Ao();break;case 2:this.Wl();break;case 3:this.dm()}if(4==this.Ba){var ei=this.Ln(a,b,e,d,h,l,g);if(0!=ei)return this.distance=0,ei;this.distance=-this.depth;return 0}this.distance=0;return 1}this.an(z);m.x=k.x;m.y=k.y;m.z=k.z;m.x=-m.x;m.y=-m.y;m.z=-m.z;this.Tf(!1);this.Uf(!1);var Jf=this.La[this.Ba],cj=this.eb[this.Ba];Jf.x=cj.x;Jf.y=cj.y;Jf.z=cj.z;var Be=this.ib[this.Ba];Jf.x-=Be.x;Jf.y-=Be.y;Jf.z-=Be.z;if(1E-8>m.x*m.x+m.y*m.y+m.z*m.z)throw Error("!?");var rh=h[this.Ba];if(1E-8>rh.x*m.x+rh.y*m.y+rh.z*m.z-(k.x*m.x+k.y*m.y+k.z*m.z))return this.Km(),this.distance=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),null!=c&&null!=c.Ji&&this.Fo(c.Ji),0;this.Ba++;++u}return 2},xm:function(a,b,e,d,c,f,h){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var l=this.La,g=this.closest,k=this.dir,m,p,r;m=d.v-e.v;p=d.A-e.A;r=d.B-e.B;k.x=m;k.y=p;k.z=r;1E-6>k.x*k.x+k.y*k.y+k.z*k.z&&k.Aa(1,0,0);this.Ba=0;if(null!=this.Kj)this.Tf(!0);else{var q=this.eb[this.Ba];q.x=this.oc.v;q.y=this.oc.A;q.z=this.oc.B}this.Uf(!0);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;var u=0,z=0,n=this.Co,D=this.Bo;n.R();D.x=f.x;D.y=f.y;D.z=f.z;D.x-=c.x;D.y-=c.y;for(D.z-=c.z;40>u;){var Ib=0;switch(this.Ba){case 1:var y=l[0];g.x=y.x;g.y=y.y;g.z=y.z;Ib=1;break;case 2:var B,E,K,H,mc,R,x=l[0];B=x.x;E=x.y;K=x.z;var X=l[1];H=X.x;mc=X.y;R=X.z;var F,Da,qa;F=H-B;Da=mc-E;qa=R-K;var I=F*B+Da*E+qa*K,I=-I/(F*F+Da*Da+qa*qa);if(0>I)g.x=B,g.y=E,g.z=K,Ib=1;else if(1za*Ma+J*va+C*Z){var wb,ec,Vb,Ab,ib,hb;wb=O.x;ec=O.y;Vb=O.z;Ab=sa.x;ib=sa.y;hb=sa.z;var ka,Ia,ab;ka=Ab-wb;Ia=ib-ec;ab=hb-Vb;var bb=ka*wb+Ia*ec+ab*Vb,bb=-bb/(ka*ka+Ia*Ia+ab*ab),Wa;if(0>bb)g.x=wb,g.y=ec,g.z=Vb,Wa=1;else if(1Aa*Pa+na*Fa+La*Q){var Sa,Na,Za,vb,mb,xb;Sa=sa.x;Na=sa.y;Za=sa.z;vb=ba.x;mb=ba.y;xb=ba.z;var nb,fb,Re;nb=vb-Sa;fb=mb-Na;Re=xb-Za;var Db=nb*Sa+fb*Na+Re*Za,Db=-Db/(nb*nb+fb*fb+Re*Re),G;if(0>Db)g.x=Sa,g.y=Na,g.z=Za,G=1;else if(1ja||obBa*aa+ta*fa+S*Rd){var cb,zb,Xa,tb,v,W;cb=O.x;zb=O.y;Xa=O.z;tb=ba.x;v=ba.y;W=ba.z;var U,db,cc;U=tb-cb;db=v-zb;cc=W-Xa;var Ra=U*cb+db*zb+cc*Xa,Ra=-Ra/(U*U+db*db+cc*cc),Ha;if(0>Ra)g.x=cb,g.y=zb,g.z=Xa,Ha=1;else if(1ja||la(nc*Ng+xa*qi+Fc*Bb)*Hb){var Sb,Nb,lb,Rb,Kb,dc,Wb,yf,ac,bc,Pb,$b,kd,Mb,Tb,fd,Rc,zc;Sb=ma.x;Nb=ma.y;lb=ma.z;Rb=Ja.x;Kb=Ja.y;dc=Ja.z;Wb=$a.x;yf=$a.y;ac=$a.z;bc=Rb-Sb;Pb=Kb-Nb;$b=dc-lb;kd=Wb-Rb;Mb=yf-Kb;Tb=ac-dc;fd=Sb-Wb;Rc=Nb-yf;zc=lb-ac;var gd,Yc,od;gd=Pb*Tb-$b*Mb;Yc=$b*kd-bc*Tb;od=bc*Mb-Pb*kd;var pc,kc,tc,Zc,Kc,Lc,xc,Cc,Dc;pc=Pb*od-$b*Yc;kc=$b*gd-bc*od;tc=bc*Yc-Pb*gd;Zc=Mb*od-Tb*Yc;Kc=Tb*gd-kd*od;Lc=kd*Yc-Mb*gd;xc=Rc*od-zc*Yc;Cc=zc*gd-fd*od;Dc=fd*Yc-Rc*gd;var pd=-1,yd,sd,td,zd=0;td=sd=yd=0;if(0>Sb*pc+Nb*kc+lb*tc){var qc,Zb,lc,jc,Qc,wc;qc=ma.x;Zb=ma.y;lc=ma.z;jc=Ja.x;Qc=Ja.y;wc=Ja.z;var Sd,ie,Uc;Sd=jc-qc;ie=Qc-Zb;Uc=wc-lc;var je=Sd*qc+ie*Zb+Uc*lc,je=-je/(Sd*Sd+ie*ie+Uc*Uc),Pc;if(0>je)g.x=qc,g.y=Zb,g.z=lc,Pc=1;else if(1Rb*Zc+Kb*Kc+dc*Lc){var Ge,He,Se,Te,Ie,Je;Ge=Ja.x;He=Ja.y;Se=Ja.z;Te=$a.x;Ie=$a.y;Je=$a.z;var ae,xe,$c;ae=Te-Ge;xe=Ie-He;$c=Je-Se;var Sc=ae*Ge+xe*He+$c*Se,Sc=-Sc/(ae*ae+xe*xe+$c*$c),ld;if(0>Sc)g.x=Ge,g.y=He,g.z=Se,ld=1;else if(1pd||BdWb*xc+yf*Cc+ac*Dc){var ud,ke,le,me,Cd,Dd;ud=ma.x;ke=ma.y;le=ma.z;me=$a.x;Cd=$a.y;Dd=$a.z;var hd,Kd,ee;hd=me-ud;Kd=Cd-ke;ee=Dd-le;var Td=hd*ud+Kd*ke+ee*le,Td=-Td/(hd*hd+Kd*Kd+ee*ee),qd;if(0>Td)g.x=ud,g.y=ke,g.z=le,qd=1;else if(1pd||ne(nc*Fb+xa*xf+Fc*ic)*Hb){var id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf,md,Fd,ed;id=ma.x;bd=ma.y;cd=ma.z;Vc=$a.x;Mc=$a.y;Nc=$a.z;Ec=Oa.x;yc=Oa.y;Bc=Oa.z;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ec-Vc;oe=yc-Mc;lf=Bc-Nc;md=id-Ec;Fd=bd-yc;ed=cd-Bc;var vd,jd,nd;vd=Tc*lf-Hc*oe;jd=Hc*Oc-Ac*lf;nd=Ac*oe-Tc*Oc;var mf,Fe,Wc,Hd,Ee,Ri,fe,pe,ge;mf=Tc*nd-Hc*jd;Fe=Hc*vd-Ac*nd;Wc=Ac*jd-Tc*vd;Hd=oe*nd-lf*jd;Ee=lf*vd-Oc*nd;Ri=Oc*jd-oe*vd;fe=Fd*nd-ed*jd;pe=ed*vd-md*nd;ge=md*jd-Fd*vd;var rd=-1,Vd,wd,Wd,qe=0;Wd=wd=Vd=0;if(0>id*mf+bd*Fe+cd*Wc){var he,zf,sh,tg,ug,vg;he=ma.x;zf=ma.y;sh=ma.z;tg=$a.x;ug=$a.y;vg=$a.z;var Ke,Ve,Mf;Ke=tg-he;Ve=ug-zf;Mf=vg-sh;var eg=Ke*he+Ve*zf+Mf*sh,eg=-eg/(Ke*Ke+Ve*Ve+Mf*Mf),fg;if(0>eg)g.x=he,g.y=zf,g.z=sh,fg=1;else if(1Vc*Hd+Mc*Ee+Nc*Ri){var Pf,Qf,Rf,Sf,Tf,Af;Pf=$a.x;Qf=$a.y;Rf=$a.z;Sf=Oa.x;Tf=Oa.y;Af=Oa.z;var ye,nf,Uf;ye=Sf-Pf;nf=Tf-Qf;Uf=Af-Rf;var of=ye*Pf+nf*Qf+Uf*Rf,of=-of/(ye*ye+nf*nf+Uf*Uf),hg;if(0>of)g.x=Pf,g.y=Qf,g.z=Rf,hg=1;else if(1rd||XdEc*fe+yc*pe+Bc*ge){var Nd,Od,yg,zg,Ag,Bg;Nd=ma.x;Od=ma.y;yg=ma.z;zg=Oa.x;Ag=Oa.y;Bg=Oa.z;var pf,Vf,si;pf=zg-Nd;Vf=Ag-Od;si=Bg-yg;var ig=pf*Nd+Vf*Od+si*yg,ig=-ig/(pf*pf+Vf*Vf+si*si),ti;if(0>ig)g.x=Nd,g.y=Od,g.z=yg,ti=1;else if(1rd||qfGc||Xf(nc*Og+xa*Jb+Fc*Ob)*Hb){var Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg,be,ce,Pd;Yf=ma.x;Zf=ma.y;$f=ma.z;Cf=Ja.x;Df=Ja.y;Ef=Ja.z;Me=Oa.x;Ff=Oa.y;jg=Oa.z;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Me-Cf;Hf=Ff-Df;kg=jg-Ef;be=Yf-Me;ce=Zf-Ff;Pd=$f-jg;var Yd,Zd,Gd;Yd=bg*kg-Ye*Hf;Zd=Ye*Gf-ag*kg;Gd=ag*Hf-bg*Gf;var gf,hf,jf,ue,kf,Qg,Ze,rf,cg;gf=bg*Gd-Ye*Zd;hf=Ye*Yd-ag*Gd;jf=ag*Zd-bg*Yd;ue=Hf*Gd-kg*Zd;kf=kg*Yd-Gf*Gd;Qg=Gf*Zd-Hf*Yd;Ze=ce*Gd-Pd*Zd;rf=Pd*Yd-be*Gd;cg=be*Zd-ce*Yd;var re=-1,sf,ze,Ae,tf=0;Ae=ze=sf=0;if(0>Yf*gf+Zf*hf+$f*jf){var $e,If,Dg,Eg,Fg,Gg;$e=ma.x;If=ma.y;Dg=ma.z;Eg=Ja.x;Fg=Ja.y;Gg=Ja.z;var af,bf,dg;af=Eg-$e;bf=Fg-If;dg=Gg-Dg;var lg=af*$e+bf*If+dg*Dg,lg=-lg/(af*af+bf*bf+dg*dg),te;if(0>lg)g.x=$e,g.y=If,g.z=Dg,te=1;else if(1Cf*ue+Df*kf+Ef*Qg){var th,uh,vh,wh,xh,yh;th=Ja.x;uh=Ja.y;vh=Ja.z;wh=Oa.x;xh=Oa.y;yh=Oa.z;var mg,ah,se;mg=wh-th;ah=xh-uh;se=yh-vh;var bh=mg*th+ah*uh+se*vh,bh=-bh/(mg*mg+ah*ah+se*se),ff;if(0>bh)g.x=th,g.y=uh,g.z=vh,ff=1;else if(1re||wiMe*Ze+Ff*rf+jg*cg){var zh,Ah,Bh,Ch,Dh,Eh;zh=ma.x;Ah=ma.y;Bh=ma.z;Ch=Oa.x;Dh=Oa.y;Eh=Oa.z;var ng,Rg,xi;ng=Ch-zh;Rg=Dh-Ah;xi=Eh-Bh;var ch=ng*zh+Rg*Ah+xi*Bh,ch=-ch/(ng*ng+Rg*Rg+xi*xi),yi;if(0>ch)g.x=zh,g.y=Ah,g.z=Bh,yi=1;else if(1re||ziGc||Ai(wa*Pg+pa*sc+Ca*Jd)*Hb){var dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh,Ne,Oe,Pe;dh=Ja.x;eh=Ja.y;fh=Ja.z;Gh=$a.x;Hh=$a.y;Ih=$a.z;gh=Oa.x;hh=Oa.y;ih=Oa.z;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=gh-Gh;Kh=hh-Hh;Lh=ih-Ih;Ne=dh-gh;Oe=eh-hh;Pe=fh-ih;var cf,df,ef;cf=Ug*Lh-Vg*Kh;df=Vg*Jh-Tg*Lh;ef=Tg*Kh-Ug*Jh;var Mg,hi,ji,ki,ni,pi,Wg,jh,kh;Mg=Ug*ef-Vg*df;hi=Vg*cf-Tg*ef;ji=Tg*df-Ug*cf;ki=Kh*ef-Lh*df;ni=Lh*cf-Jh*ef;pi=Jh*df-Kh*cf;Wg=Oe*ef-Pe*df;jh=Pe*cf-Ne*ef;kh=Ne*df-Oe*cf;var uf=-1,Ig,og,pg,lh=0;pg=og=Ig=0;if(0>dh*Mg+eh*hi+fh*ji){var Mh,Nh,Oh,Ph,Qh,Rh;Mh=Ja.x;Nh=Ja.y;Oh=Ja.z;Ph=$a.x;Qh=$a.y;Rh=$a.z;var qg,mh,Bi;qg=Ph-Mh;mh=Qh-Nh;Bi=Rh-Oh;var nh=qg*Mh+mh*Nh+Bi*Oh,nh=-nh/(qg*qg+mh*mh+Bi*Bi),Si;if(0>nh)g.x=Mh,g.y=Nh,g.z=Oh,Si=1;else if(1Gh*ki+Hh*ni+Ih*pi){var Sh,Th,Uh,Vh,Wh,Xh;Sh=$a.x;Th=$a.y;Uh=$a.z;Vh=Oa.x;Wh=Oa.y;Xh=Oa.z;var rg,oh,Fi;rg=Vh-Sh;oh=Wh-Th;Fi=Xh-Uh;var ph=rg*Sh+oh*Th+Fi*Uh,ph=-ph/(rg*rg+oh*oh+Fi*Fi),Ti;if(0>ph)g.x=Sh,g.y=Th,g.z=Uh,Ti=1;else if(1uf||Iigh*Wg+hh*jh+ih*kh){var Yh,Zh,$h,ai,bi,ci;Yh=Ja.x;Zh=Ja.y;$h=Ja.z;ai=Oa.x;bi=Oa.y;ci=Oa.z;var sg,Xg,Ji;sg=ai-Yh;Xg=bi-Zh;Ji=ci-$h;var qh=sg*Yh+Xg*Zh+Ji*$h,qh=-qh/(sg*sg+Xg*Xg+Ji*Ji),Ki;if(0>qh)g.x=Yh,g.y=Zh,g.z=$h,Ki=1;else if(1uf||LiGc||cjg.x*g.x+g.y*g.y+g.z*g.z){if(!z||4==this.Ba){h.fraction=z;break}this.Km();h.fraction=z;var Be=h.normal;Be.x=k.x;Be.y=k.y;Be.z=k.z;var rh=Math.sqrt(Be.x*Be.x+Be.y*Be.y+Be.z*Be.z);0k.x*k.x+k.y*k.y+k.z*k.z)throw Error("!?");var Mi=l[this.Ba],Ui=Mi.x*k.x+Mi.y*k.y+Mi.z*k.z;if(0>Ui){if(0<=D.x*k.x+D.y*k.y+D.z*k.z)break;var nj=Ui/(D.x*k.x+D.y*k.y+D.z*k.z),z=z+nj;if(1<=z)break;n.x+=D.x*nj;n.y+=D.y*nj;n.z+=D.z*nj;for(var Vi=0,ij=this.Ba+1;Vifj*fj+gj*gj+hj*hj){Wi=!0;break}}Wi||this.Ba++;++u}return!1},Km:function(){switch(this.Ba){case 1:var a=this.closestPoint1,b=this.eb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,d=this.ib[0];e.x=d.x;e.y=d.y;e.z=d.z;break;case 2:var c,f,h,l=this.closest;c=l.x;f=l.y;h=l.z;var g,k,m,p,r,q,t,A,L,u,n,fc,D,Ib,y,B,E,K,H=this.La[0];g=H.x;k=H.y;m=H.z;var mc=this.eb[0];p=mc.x;r=mc.y;q=mc.z;var R=this.ib[0];t=R.x;A=R.y;L=R.z;var x=this.La[1];u=x.x;n=x.y;fc=x.z;var X=this.eb[1];D=X.x;Ib=X.y;y=X.z;var F=this.ib[1];B=F.x;E=F.y;K=F.z;var I,qa,N;I=u-g;qa=n-k;N=fc-m;var ya=I*I+qa*qa+N*N;ya&&(ya=1/ya);var J=((c-g)*I+(f-k)*qa+(h-m)*N)*ya,Ea,O,sa,ba,za,Ta,C,Aa,na;Ea=D-p;O=Ib-r;sa=y-q;ba=p+Ea*J;za=r+O*J;Ta=q+sa*J;Ea=B-t;O=E-A;sa=K-L;C=t+Ea*J;Aa=A+O*J;na=L+sa*J;var La=this.closestPoint1;La.x=ba;La.y=za;La.z=Ta;var Ba=this.closestPoint2;Ba.x=C;Ba.y=Aa;Ba.z=na;break;case 3:var ta,S,ha,ea=this.closest;ta=ea.x;S=ea.y;ha=ea.z;var da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab=this.La[0];da=Ab.x;M=Ab.y;T=Ab.z;var ib=this.eb[0];w=ib.x;V=ib.y;ia=ib.z;var hb=this.ib[0];Y=hb.x;oa=hb.y;ua=hb.z;var ka=this.La[1];ca=ka.x;Ma=ka.y;va=ka.z;var Ia=this.eb[1];Z=Ia.x;Pa=Ia.y;Fa=Ia.z;var ab=this.ib[1];Q=ab.x;aa=ab.y;fa=ab.z;var bb=this.La[2];Rd=bb.x;ja=bb.y;Ga=bb.z;var Wa=this.eb[2];P=Wa.x;Ya=Wa.y;wa=Wa.z;var Va=this.ib[2];wb=Va.x;ec=Va.y;Vb=Va.z;var qb,kb,Sa,Na,Za,vb,mb,xb,nb;qb=ca-da;kb=Ma-M;Sa=va-T;Na=Rd-da;Za=ja-M;vb=Ga-T;mb=ta-da;xb=S-M;nb=ha-T;var fb=qb*qb+kb*kb+Sa*Sa,pa=qb*Na+kb*Za+Sa*vb,Db=Na*Na+Za*Za+vb*vb,G=qb*mb+kb*xb+Sa*nb,sb=Na*mb+Za*xb+vb*nb,jb=fb*Db-pa*pa;jb&&(jb=1/jb);var Xb=(G*Db-sb*pa)*jb,ob=(-G*pa+sb*fb)*jb,cb,zb,Xa,tb,v,W,U,db,cc;cb=Z-w;zb=Pa-V;Xa=Fa-ia;tb=w+cb*Xb;v=V+zb*Xb;W=ia+Xa*Xb;cb=P-w;zb=Ya-V;Xa=wa-ia;tb+=cb*ob;v+=zb*ob;W+=Xa*ob;cb=Q-Y;zb=aa-oa;Xa=fa-ua;U=Y+cb*Xb;db=oa+zb*Xb;cc=ua+Xa*Xb;cb=wb-Y;zb=ec-oa;Xa=Vb-ua;U+=cb*ob;db+=zb*ob;cc+=Xa*ob;var Ra=this.closestPoint1;Ra.x=tb;Ra.y=v;Ra.z=W;var Ha=this.closestPoint2;Ha.x=U;Ha.y=db;Ha.z=cc;break;default:throw Error("!?");}},yo:function(a){var b=this.dir;a=a.$l;b.x=a.x;b.y=a.y;b.z=a.z},Fo:function(a){a=a.$l;var b=this.closest;a.x=b.x;a.y=b.y;a.z=b.z;a.x=-a.x;a.y=-a.y;a.z=-a.z},an:function(a){this.Ba=a;this.Ba=(this.Ba&5)+(this.Ba>>1&5);this.Ba=(this.Ba&3)+(this.Ba>>2&3);switch(a){case 2:a=this.La[0];var b=this.La[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[1];a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.La[1];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 8:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a=this.La[2];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[2];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[2];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.La[0],b=this.La[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.eb[0],b=this.eb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.ib[0],b=this.ib[3],a.x=b.x,a.y=b.y,a.z=b.z}},Tf:function(a){var b,e,d,c,f,h;h=this.dir;c=h.x;f=h.y;h=h.z;var l;e=this.oc.o*c+this.oc.i*f+this.oc.l*h;l=this.oc.f*c+this.oc.m*f+this.oc.g*h;b=this.oc.h*c+this.oc.j*f+this.oc.s*h;d=this.dir;d.x=e;d.y=l;d.z=b;this.Kj.he(this.dir,this.eb[this.Ba]);a&&(a=this.dir,b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=this.dir,e=this.Ij[a++];b.x=e.x;b.y=e.y;b.z=e.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--;b=this.dir;b.x=-b.x;b.y=-b.y;b.z=-b.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--}},Wl:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;e=e.z;var d,c,f,h,l,g;f=this.La[0];d=f.x;c=f.y;f=f.z;g=this.La[1];h=g.x;l=g.y;g=g.z;d-=h;c-=l;f-=g;for(l=0;3>l;){var k,m;g=this.Ij[l++];h=g.x;k=g.y;m=g.z;g=c*m-f*k;m=f*h-d*m;h=d*k-c*h;k=this.dir;k.x=g;k.y=m;k.z=h;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--;g=this.dir;g.x=-g.x;g.y=-g.y;g.z=-g.z;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--}d=this.dir;d.x=a;d.y=b;d.z=e},dm:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;for(e=e.z;;){var d,c,f,h,l,g,k,m,p;f=this.La[0];d=f.x;c=f.y;f=f.z;m=this.La[1];h=m.x;l=m.y;g=m.z;p=this.La[2];k=p.x;m=p.y;p=p.z;h-=d;l-=c;g-=f;d=k-d;c=m-c;m=p-f;f=l*m-g*c;m=g*d-h*m;c=h*c-l*d;h=this.dir;h.x=f;h.y=m;h.z=c;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;c=this.dir;c.x=-c.x;c.y=-c.y;c.z=-c.z;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;break}c=this.dir;c.x=a;c.y=b;c.z=e},Lm:function(){var a=this.La[2].x-this.La[0].x,b=this.La[2].y-this.La[0].y,e=this.La[2].z-this.La[0].z,d=this.La[3].x-this.La[0].x,c=this.La[3].y-this.La[0].y,f=this.La[3].z-this.La[0].z,a=(this.La[1].x-this.La[0].x)*(b*f-e*c)-(this.La[1].y-this.La[0].y)*(a*f-e*d)+(this.La[1].z-this.La[0].z)*(a*c-b*d);return 1E-12a},Ln:function(a,b,e,d,c,f,h){for(var l=this.ih;0x;){for(var R=this.ih.Cd,F=Infinity,X=null;null!=R;)R.nkE.x*C.x+E.y*C.y+E.z*C.z-(za.x*Ta.x+za.y*Ta.y+za.z*Ta.z)||39==x){var Aa=this.closest,na=this.dir;Aa.x=na.x;Aa.y=na.y;Aa.z=na.z;var La=this.dir,Ba=O.Rd,ta=this.dir,S=(La.x*Ba.x+La.y*Ba.y+La.z*Ba.z)/(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z);Aa.x*=S;Aa.y*=S;Aa.z*=S;var ha,ea,da,M=this.closest;ha=M.x;ea=M.y;da=M.z;var T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab,ib,hb=O.Rd;T=hb.x;w=hb.y;V=hb.z;var ka=O.eb;ia=ka.x;Y=ka.y;oa=ka.z;var Ia=O.ib;ua=Ia.x;ca=Ia.y;Ma=Ia.z;var ab=sa.Rd;va=ab.x;Z=ab.y;Pa=ab.z;var bb=sa.eb;Fa=bb.x;Q=bb.y;aa=bb.z;var Wa=sa.ib;fa=Wa.x;Rd=Wa.y;ja=Wa.z;var Va=ba.Rd;Ga=Va.x;P=Va.y;Ya=Va.z;var qb=ba.eb;wa=qb.x;wb=qb.y;ec=qb.z;var kb=ba.ib;Vb=kb.x;Ab=kb.y;ib=kb.z;var Sa,Na,Za,vb,mb,xb,nb,fb,pa;Sa=va-T;Na=Z-w;Za=Pa-V;vb=Ga-T;mb=P-w;xb=Ya-V;nb=ha-T;fb=ea-w;pa=da-V;var Db=Sa*Sa+Na*Na+Za*Za,G=Sa*vb+Na*mb+Za*xb,sb=vb*vb+mb*mb+xb*xb,jb=Sa*nb+Na*fb+Za*pa,Xb=vb*nb+mb*fb+xb*pa,ob=Db*sb-G*G;ob&&(ob=1/ob);var cb=(jb*sb-Xb*G)*ob,zb=(-jb*G+Xb*Db)*ob,Xa,tb,v,W,U,db,cc,Ra,Ha;Xa=Fa-ia;tb=Q-Y;v=aa-oa;W=ia+Xa*cb;U=Y+tb*cb;db=oa+v*cb;Xa=wa-ia;tb=wb-Y;v=ec-oa;W+=Xa*zb;U+=tb*zb;db+=v*zb;Xa=fa-ua;tb=Rd-ca;v=ja-Ma;cc=ua+Xa*cb;Ra=ca+tb*cb;Ha=Ma+v*cb;Xa=Vb-ua;tb=Ab-ca;v=ib-Ma;cc+=Xa*zb;Ra+=tb*zb;Ha+=v*zb;var rb=this.closestPoint1;rb.x=W;rb.y=U;rb.z=db;var yb=this.closestPoint2;yb.x=cc;yb.y=Ra;yb.z=Ha;var Cb=this.closest;this.depth=Math.sqrt(Cb.x*Cb.x+Cb.y*Cb.y+Cb.z*Cb.z);return dc.SUCCEEDED}var la=this.ih,ra=la.jf;null!=ra?(la.jf=ra.M,ra.M=null):ra=new te;var ga=ra.Aa(E,K,H);if(!this.ih.qn(ga,I))return dc.EPA_FAILED_TO_ADD_VERTEX;++x}return dc.EPA_DID_NOT_CONVERGE},wa:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!0)},mb:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!1)},Vf:function(a,b,e,d,c,f,h){return this.xm(a,b,e,d,c,f,h)},ke:function(a,b,e,d,c){var f=this.Io;f.v=e.x;f.A=e.y;f.B=e.z;var h=this.Jo,l=this.Ko;h.x=d.x;h.y=d.y;h.z=d.z;h.x-=e.x;h.y-=e.y;h.z-=e.z;l.R();return this.xm(null,a,f,b,h,l,c)}};Pc.wc=function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;var l,g,k;l=f-d;g=h-c;k=b-a;var m;m=-(l*d+g*c+k*a)/(l*l+g*g+k*k);if(0>m)return e.x=d,e.y=c,e.z=a,1;if(1c*(t*E-A*B)+f*(A*y-q*E)+h*(q*B-t*y)){K=a.x;H=a.y;x=a.z;R=b.x;F=b.y;q=b.z;var X;t=R-K;A=F-H;X=q-x;var I;I=-(t*K+A*H+X*x)/(t*t+A*A+X*X);0>I?(d.x=K,d.y=H,d.z=x,K=1):1l*(u*E-n*B)+g*(n*y-L*E)+k*(L*B-u*y)&&(l=b.x,g=b.y,b=b.z,k=e.x,L=e.y,u=e.z,n=k-l,q=L-g,t=u-b,A=-(n*l+q*g+t*b)/(n*n+q*q+t*t),0>A?(d.x=l,d.y=g,d.z=b,b=1):1K||lm*(D*E-Ib*B)+p*(Ib*y-fc*E)+r*(fc*B-D*y)&&(m=a.x,p=a.y,a=a.z,r=e.x,fc=e.y,e=e.z,D=r-m,Ib=fc-p,b=e-a,l=-(D*m+Ib*p+b*a)/(D*D+Ib*Ib+b*b),0>l?(d.x=m,d.y=p,d.z=a,e=1):1K||a(f*Da+h*qa+l*J)*Aa){var ha,ea,da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q;ha=a.x;ea=a.y;da=a.z;M=b.x;T=b.y;w=b.z;V=e.x;ia=e.y;Y=e.z;oa=M-ha;ua=T-ea;ca=w-da;Ma=V-M;va=ia-T;Z=Y-w;Pa=ha-V;Fa=ea-ia;Q=da-Y;var aa,fa,Rd;aa=ua*Z-ca*va;fa=ca*Ma-oa*Z;Rd=oa*va-ua*Ma;var ja,Ga,P,Ya,wa,wb,ec,Vb,Ab;ja=ua*Rd-ca*fa;Ga=ca*aa-oa*Rd;P=oa*fa-ua*aa;Ya=va*Rd-Z*fa;wa=Z*aa-Ma*Rd;wb=Ma*fa-va*aa;ec=Fa*Rd-Q*fa;Vb=Q*aa-Pa*Rd;Ab=Pa*fa-Fa*aa;var ib=-1,hb,ka,Ia,ab=0;Ia=ka=hb=0;if(0>ha*ja+ea*Ga+da*P){var bb,Wa,Va,qb,kb,Sa;bb=a.x;Wa=a.y;Va=a.z;qb=b.x;kb=b.y;Sa=b.z;var Na,Za,vb;Na=qb-bb;Za=kb-Wa;vb=Sa-Va;var mb=Na*bb+Za*Wa+vb*Va,mb=-mb/(Na*Na+Za*Za+vb*vb),xb;if(0>mb)c.x=bb,c.y=Wa,c.z=Va,xb=1;else if(1M*Ya+T*wa+w*wb){var Db,G,sb,jb,Xb,ob;Db=b.x;G=b.y;sb=b.z;jb=e.x;Xb=e.y;ob=e.z;var cb,zb,Xa;cb=jb-Db;zb=Xb-G;Xa=ob-sb;var tb=cb*Db+zb*G+Xa*sb,tb=-tb/(cb*cb+zb*zb+Xa*Xa),v;if(0>tb)c.x=Db,c.y=G,c.z=sb,v=1;else if(1ib||ccV*ec+ia*Vb+Y*Ab){var Ra,Ha,rb,yb,Cb,la;Ra=a.x;Ha=a.y;rb=a.z;yb=e.x;Cb=e.y;la=e.z;var ra,ga,ma;ra=yb-Ra;ga=Cb-Ha;ma=la-rb;var Ja=ra*Ra+ga*Ha+ma*rb,Ja=-Ja/(ra*ra+ga*ga+ma*ma),$a;if(0>Ja)c.x=Ra,c.y=Ha,c.z=rb,$a=1;else if(1ib||Fc(f*ya+h*pa+l*Ea)*Aa){var gb,ub,xd,pb,Qa,de,Ic,Yb,oc,Id,$d,rc,Jc,Bb,Fb,Jb,hc,uc;gb=a.x;ub=a.y;xd=a.z;pb=e.x;Qa=e.y;de=e.z;Ic=d.x;Yb=d.y;oc=d.z;Id=pb-gb;$d=Qa-ub;rc=de-xd;Jc=Ic-pb;Bb=Yb-Qa;Fb=oc-de;Jb=gb-Ic;hc=ub-Yb;uc=xd-oc;var gc,Xc,Eb;gc=$d*Fb-rc*Bb;Xc=rc*Jc-Id*Fb;Eb=Id*Bb-$d*Jc;var Ng,Lb,Gb,Ob,xf,ic,Hb,Qb,Sb;Ng=$d*Eb-rc*Xc;Lb=rc*gc-Id*Eb;Gb=Id*Xc-$d*gc;Ob=Bb*Eb-Fb*Xc;xf=Fb*gc-Jc*Eb;ic=Jc*Xc-Bb*gc;Hb=hc*Eb-uc*Xc;Qb=uc*gc-Jb*Eb;Sb=Jb*Xc-hc*gc;var Nb=-1,sc,Jd,lb,Gc=0;lb=Jd=sc=0;if(0>gb*Ng+ub*Lb+xd*Gb){var Rb,vc,Kb,dc,bc,Pb;Rb=a.x;vc=a.y;Kb=a.z;dc=e.x;bc=e.y;Pb=e.z;var Wb,$b,Mb;Wb=dc-Rb;$b=bc-vc;Mb=Pb-Kb;var Tb=Wb*Rb+$b*vc+Mb*Kb,Tb=-Tb/(Wb*Wb+$b*$b+Mb*Mb),ac;if(0>Tb)c.x=Rb,c.y=vc,c.z=Kb,ac=1;else if(1pb*Ob+Qa*xf+de*ic){var kc,lc,kd,tc,jc,fd;kc=e.x;lc=e.y;kd=e.z;tc=d.x;jc=d.y;fd=d.z;var Rc,zc,gd;Rc=tc-kc;zc=jc-lc;gd=fd-kd;var Yc=Rc*kc+zc*lc+gd*kd,Yc=-Yc/(Rc*Rc+zc*zc+gd*gd),od;if(0>Yc)c.x=kc,c.y=lc,c.z=kd,od=1;else if(1Nb||ZcIc*Hb+Yb*Qb+oc*Sb){var Kc,Lc,xc,Cc,Dc,pd;Kc=a.x;Lc=a.y;xc=a.z;Cc=d.x;Dc=d.y;pd=d.z;var yd,sd,td;yd=Cc-Kc;sd=Dc-Lc;td=pd-xc;var zd=yd*Kc+sd*Lc+td*xc,zd=-zd/(yd*yd+sd*sd+td*td),Pc;if(0>zd)c.x=Kc,c.y=Lc,c.z=xc,Pc=1;else if(1Nb||Dena||Fe(f*O+h*sa+l*ba)*Aa){var je,Wc,Hd,se,te,Ge,He,Se,Te,Ie,Je,ae,xe,$c,Sc,ld,Ee,Qe;je=a.x;Wc=a.y;Hd=a.z;se=b.x;te=b.y;Ge=b.z;He=d.x;Se=d.y;Te=d.z;Ie=se-je;Je=te-Wc;ae=Ge-Hd;xe=He-se;$c=Se-te;Sc=Te-Ge;ld=je-He;Ee=Wc-Se;Qe=Hd-Te;var Ad,Bd,ud;Ad=Je*Sc-ae*$c;Bd=ae*xe-Ie*Sc;ud=Ie*$c-Je*xe;var ke,le,me,Cd,Dd,hd,Kd,ee,Td;ke=Je*ud-ae*Bd;le=ae*Ad-Ie*ud;me=Ie*Bd-Je*Ad;Cd=$c*ud-Sc*Bd;Dd=Sc*Ad-xe*ud;hd=xe*Bd-$c*Ad;Kd=Ee*ud-Qe*Bd;ee=Qe*Ad-ld*ud;Td=ld*Bd-Ee*Ad;var qd=-1,Ud,Ld,Md,ne=0;Md=Ld=Ud=0;if(0>je*ke+Wc*le+Hd*me){var Ue,ad,Ed,id,bd,cd;Ue=a.x;ad=a.y;Ed=a.z;id=b.x;bd=b.y;cd=b.z;var Vc,Mc,Nc;Vc=id-Ue;Mc=bd-ad;Nc=cd-Ed;var Ec=Vc*Ue+Mc*ad+Nc*Ed,Ec=-Ec/(Vc*Vc+Mc*Mc+Nc*Nc),yc;if(0>Ec)c.x=Ue,c.y=ad,c.z=Ed,yc=1;else if(1se*Cd+te*Dd+Ge*hd){var Hc,Oc,oe,lf,md,Fd;Hc=b.x;Oc=b.y;oe=b.z;lf=d.x;md=d.y;Fd=d.z;var ed,vd,jd;ed=lf-Hc;vd=md-Oc;jd=Fd-oe;var nd=ed*Hc+vd*Oc+jd*oe,nd=-nd/(ed*ed+vd*vd+jd*jd),mf;if(0>nd)c.x=Hc,c.y=Oc,c.z=oe,mf=1;else if(1qd||jfHe*Kd+Se*ee+Te*Td){var ue,fe,pe,ge,rd,Vd;ue=a.x;fe=a.y;pe=a.z;ge=d.x;rd=d.y;Vd=d.z;var wd,Wd,qe;wd=ge-ue;Wd=rd-fe;qe=Vd-pe;var he=wd*ue+Wd*fe+qe*pe,he=-he/(wd*wd+Wd*Wd+qe*qe),zf;if(0>he)c.x=ue,c.y=fe,c.z=pe,zf=1;else if(1qd||vgna||eg(g*za+k*Ta+m*C)*Aa){var fg,Nf,Of,gg,Pf,Qf,Rf,Sf,Tf,Af,ye,nf,Uf,of,hg,vf,wg,xg;fg=b.x;Nf=b.y;Of=b.z;gg=e.x;Pf=e.y;Qf=e.z;Rf=d.x;Sf=d.y;Tf=d.z;Af=gg-fg;ye=Pf-Nf;nf=Qf-Of;Uf=Rf-gg;of=Sf-Pf;hg=Tf-Qf;vf=fg-Rf;wg=Nf-Sf;xg=Of-Tf;var Xd,Nd,Od;Xd=ye*hg-nf*of;Nd=nf*Uf-Af*hg;Od=Af*of-ye*Uf;var yg,zg,Ag,Bg,pf,Vf,Kf,ig,Lf;yg=ye*Od-nf*Nd;zg=nf*Xd-Af*Od;Ag=Af*Nd-ye*Xd;Bg=of*Od-hg*Nd;pf=hg*Xd-Uf*Od;Vf=Uf*Nd-of*Xd;Kf=wg*Od-xg*Nd;ig=xg*Xd-vf*Od;Lf=vf*Nd-wg*Xd;var Wf=-1,Bf,We,qf,Cg=0;qf=We=Bf=0;if(0>fg*yg+Nf*zg+Of*Ag){var Le,Xe,Xf,Yf,Zf,$f;Le=b.x;Xe=b.y;Xf=b.z;Yf=e.x;Zf=e.y;$f=e.z;var Cf,Df,Ef;Cf=Yf-Le;Df=Zf-Xe;Ef=$f-Xf;var Me=Cf*Le+Df*Xe+Ef*Xf,Me=-Me/(Cf*Cf+Df*Df+Ef*Ef),Ff;if(0>Me)c.x=Le,c.y=Xe,c.z=Xf,Ff=1;else if(1gg*Bg+Pf*pf+Qf*Vf){var Ye,Gf,Hf,kg,be,ce;Ye=e.x;Gf=e.y;Hf=e.z;kg=d.x;be=d.y;ce=d.z;var Pd,Yd,Zd;Pd=kg-Ye;Yd=be-Gf;Zd=ce-Hf;var Gd=Pd*Ye+Yd*Gf+Zd*Hf,Gd=-Gd/(Pd*Pd+Yd*Yd+Zd*Zd),wf;if(0>Gd)c.x=Ye,c.y=Gf,c.z=Hf,wf=1;else if(1Wf||MgRf*Kf+Sf*ig+Tf*Lf){var Qg,Ze,rf,cg,re,sf;Qg=b.x;Ze=b.y;rf=b.z;cg=d.x;re=d.y;sf=d.z;var ze,Ae,tf;ze=cg-Qg;Ae=re-Ze;tf=sf-rf;var $e=ze*Qg+Ae*Ze+tf*rf,$e=-$e/(ze*ze+Ae*Ae+tf*tf),If;if(0>$e)c.x=Qg,c.y=Ze,c.z=rf,If=1;else if(1<$e)c.x=cg,c.y=re,c.z=sf,If=2;else{var Dg,Eg,Fg;Dg=Qg+ze*$e;Eg=Ze+Ae*$e;Fg=rf+tf*$e;c.x=Dg;c.y=Eg;c.z=Fg;If=3}var Gg=c.x*c.x+c.y*c.y+c.z*c.z;if(0>Wf||Ggna||lge?b>d?(b=Math.sqrt(b-e-d+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b,a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a},mb:function(a){var b=Math.sin(a.x),e=Math.sin(a.y),d=Math.sin(a.z),c=Math.cos(a.x),f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*d;this.e02=e;this.e10=c*d+a*b*e;this.e11=c*a-b*e*d;this.e12=-f*b;this.e20=b*d-c*a*e;this.e21=a*b+c*e*d;this.e22=c*f;return this},Fi:function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,1.570796326794895,.5*a)):new n(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))},wc:function(a){return 0==a?new n(this.e00,this.e01,this.e02):1==a?new n(this.e10,this.e11,this.e12):2==a?new n(this.e20,this.e21,this.e22):null},kc:function(a){return 0==a?new n(this.e00,this.e10,this.e20):1==a?new n(this.e01,this.e11,this.e21):2==a?new n(this.e02,this.e12,this.e22):null},xc:function(a,b){0==a?b.Aa(this.e00,this.e01,this.e02):1==a?b.Aa(this.e10,this.e11,this.e12):2==a?b.Aa(this.e20,this.e21,this.e22):b.R()},lc:function(a,b){0==a?b.Aa(this.e00,this.e10,this.e20):1==a?b.Aa(this.e01,this.e11,this.e21):2==a?b.Aa(this.e02,this.e12,this.e22):b.R()},Kb:function(a,b,e){this.e00=a.x;this.e01=a.y;this.e02=a.z;this.e10=b.x;this.e11=b.y;this.e12=b.z;this.e20=e.x;this.e21=e.y;this.e22=e.z;return this},wa:function(a,b,e){this.e00=a.x;this.e01=b.x;this.e02=e.x;this.e10=a.y;this.e11=b.y;this.e12=e.y;this.e20=a.z;this.e21=b.z;this.e22=e.z;return this},toString:function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};pa.vd=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};pa.atan2=function(a,b){return Math.atan2(a,b)};pa.sqrt=function(a){return Math.sqrt(a)};pa.Cb=function(a,b,e){return ae?e:a};pa.Hc=function(){return Math.random()};pa.Uc=function(a,b){return a+Math.random()*(b-a)};pa.Wc=function(a,b){return new n(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};pa.Vc=function(){return new n(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};Nb.prototype={Dc:function(){return 0==this.b?new n:this.c[--this.b]},lc:function(){return 0==this.cb?new I:this.bb[--this.cb]},wc:function(){return 0==this.Ag?new J:this.eg[--this.Ag]},xc:function(){return 0==this.re?new wa:this.le[--this.re]},wa:function(a,b,e,d){if(null!=a){a.R();if(this.b==this.c.length){for(var c=Array(this.b<<1),f=0,h=this.b;ff?(f=-f,e=-a.x,d=-a.y,c=-a.z,a=-a.w):(e=a.x,d=a.y,c=a.z,a=a.w);if(.999999e?b>d?(b=Math.sqrt(b-e-d+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this},vd:function(){var a=new I,b=this.x,e=this.y,d=this.z,c=this.w,f=2*b,h=2*e,l=2*d,g=b*f,k=e*h,d=d*l,m=b*h,e=e*l,b=b*l,f=c*f,h=c*h,c=c*l;a.e00=1-k-d;a.e01=m-c;a.e02=b+h;a.e10=m+c;a.e11=1-g-d;a.e12=e-f;a.e20=b-h;a.e21=e+f;a.e22=1-g-k;return a},toString:function(){return"Quat["+(0F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?F.alternativeContactPositionCorrectionAlgorithm:F.defaultContactPositionCorrectionAlgorithm,a.incremental?this.qm.xo(a,this.C.a,this.D.a):this.qm.Lo(a,this.C.a,this.D.a)):this.Ia.df()}},kc:function(){return this.Ec},lc:function(){return this.Fc},Kk:function(){return this.Hh},mb:function(){return this.Ia},wa:function(){return this.ef},Kb:function(){return this.ia},Cb:function(){return this.M}};Zb.prototype={wa:function(){return this.me},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};De.prototype={On:function(){for(var a=this.hc.pe;null!=a;){for(var b=a.M;;){var e;a.Ch.Icg.J&&l.Kg.K&&l.Lg.L&&this.$m(d,c))){d=b.ia;c=b.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b==this.je&&(this.je=this.je.M);b==this.Le&&(this.Le=this.Le.ia);b.M=null;b.ia=null;d=b.rb.ia;c=b.rb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.rb==b.C.Mb&&(b.C.Mb=b.C.Mb.M);b.rb==b.C.ic&&(b.C.ic=b.C.ic.ia);b.rb.M=null;b.rb.ia=null;d=b.sb.ia;c=b.sb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.sb==b.D.Mb&&(b.D.Mb=b.D.Mb.M);b.sb==b.D.ic&&(b.D.ic=b.D.ic.ia);b.sb.M=null;b.sb.ia=null;b.C.Ne--;b.D.Ne--;b.rb.ad=null;b.sb.ad=null;b.rb.me=null;b.sb.me=null;b.Ec=null;b.Fc=null;b.C=null;b.D=null;b.Hh=!1;b.pj.df();b.Ia.df();b.$h=null;d=b.ef;d.Ec=null;d.Fc=null;d.C=null;d.D=null;d.Ej=null;d.Fj=null;b.M=this.Cg;this.Cg=b;this.Ui--;break}b.Bk=!(f.nah.na&&f.oah.oa&&f.pah.pa);break}b=e}},$m:function(a,b){var e=a.Vb,d=b.Vb;if(e==d||0!=e.Jb&&0!=d.Jb||!(a.kk&b.lk&&b.kk&a.lk))return!1;e.AhF.sleepingTimeThreshold&&(b.Bb=!0,b.wb=0)):b.wb=0;if(!b.Bb){if(0==b.Jb){var e=a*b.sk,d=e*e,e=1/(1+e+d*(.5+.16666666666666666*e+.041666666666666664*d)),d=a*b.hk,c=d*d,d=1/(1+d+c*(.5+.16666666666666666*d+.041666666666666664*c)),f,h,l,c=this.Fm*b.vh;f=this.Gm*b.vh;h=this.Hm*b.vh;c+=b.ai*b.qb;f+=b.bi*b.qb;h+=b.ci*b.qb;var g,k;g=b.S*b.Of+b.T*b.Pf+b.U*b.Qf;k=b.V*b.Of+b.W*b.Pf+b.X*b.Qf;l=b.Y*b.Of+b.Z*b.Pf+b.$*b.Qf;b.jb+=c*a;b.kb+=f*a;b.lb+=h*a;b.jb*=e;b.kb*=e;b.lb*=e;b.nb+=g*a;b.ob+=k*a;b.pb+=l*a;b.nb*=d;b.ob*=d;b.pb*=d}b.nm(a);for(a=b.Gc;null!=a;){e=a.M;c=b.ja;d=b.a;f=a.ja;h=a.ha;var m,p,r,q,t,A;l=c.o*h.o+c.f*h.i+c.h*h.l;g=c.o*h.f+c.f*h.m+c.h*h.g;k=c.o*h.h+c.f*h.j+c.h*h.s;m=c.i*h.o+c.m*h.i+c.j*h.l;p=c.i*h.f+c.m*h.m+c.j*h.g;r=c.i*h.h+c.m*h.j+c.j*h.s;q=c.l*h.o+c.g*h.i+c.s*h.l;t=c.l*h.f+c.g*h.m+c.s*h.g;A=c.l*h.h+c.g*h.j+c.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=p;f.j=r;f.l=q;f.g=t;f.s=A;l=c.o*h.v+c.f*h.A+c.h*h.B;g=c.i*h.v+c.m*h.A+c.j*h.B;h=c.l*h.v+c.g*h.A+c.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=c.v;f.A+=c.A;f.B+=c.B;c=a.a;f=a.ha;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;r=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=r;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;a.Fb.Lb(a.u,a.ja);d=a.u.na;c=a.u.oa;f=a.u.pa;h=a.u.ka;l=a.u.la;g=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=da.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;a.u.ma=g>a.u.ma?g:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,c=a.a.A-a.ja.A,f=a.a.B-a.ja.B,h=a.mc,h.x=d,h.y=c,h.z=f,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=e}}},Dn:function(a,b,e){for(var d=a.dt,c=!0,f=0,h=this.ag;fb.u.ka?g:b.u.ka;b.u.la=k>b.u.la?k:b.u.la;b.u.ma=m>b.u.ma?m:b.u.ma;null!=b.ub&&(f=b.a.v-b.ja.v,h=b.a.A-b.ja.A,l=b.a.B-b.ja.B,g=b.mc,g.x=f,g.y=h,g.z=l,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=c}}}};Ca.prototype={xl:function(){var a=Date.now()/1E3;this.Hi.xl();Ce.broadPhaseCollisionTime=1E3*(Date.now()/1E3-a);for(var a=Date.now()/1E3,b=this.Hi.je;null!=b;){var e=b.M;b.Bk||b.Fn();b=e}Ce.narrowPhaseCollisionTime=1E3*(Date.now()/1E3-a)},Cn:function(){var a=Date.now()/1E3;if(F.disableSleeping)for(var b=this.Nf;null!=b;)b.Bb=!1,b.wb=0,b=b.M;if(this.Fh.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var c=this.ra,f=0==c.b?new n:c.c[--c.b],c=this.ra,c=0==c.b?new n:c.c[--c.b];f.x=b.J;f.y=b.K;f.z=b.L;c.x=b.G;c.y=b.H;c.z=b.I;a.aabb(f,c,d);var h=this.ra;if(null!=f){f.R();if(h.b==h.c.length){for(var l=Array(h.b<<1),g=0,k=h.b;gF.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2:e.Bb?b.sleepingShapeColor1:e.wb>F.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1);if(a.drawShapes){var k=l.Fb,m=l.a;switch(k.Jb){case 0:a.sphere(m,k.ab,f);break;case 1:var p=k,r=this.ra,q=0==r.b?new n:r.c[--r.b],t=q;t.x=p.Te;t.y=p.Ue;t.z=p.Ve;a.box(m,q,f);var A=this.ra;if(null!=q){q.R();if(A.b==A.c.length){for(var L=Array(A.b<<1),u=0,z=A.b;ul?a.ellipse(b,e,d,f,f,g):a.arc(b,e,d,f,f,h,l,!0,g)}},km:function(a,b,e,d,c){if(dr;){r++;var q=Math.cos(g)*f,t=Math.sin(g)*h,A=Math.sqrt(q*q+t*t),L=Math.sin(.5*A),u=Math.cos(.5*A),z=k.R();z.x+=d.x*q;z.y+=d.y*q;z.z+=d.z*q;z.x+=c.x*t;z.y+=c.y*t;z.z+=c.z*t;q=1/A*L;k.x*=q;k.y*=q;k.z*=q;m.x=k.x;m.y=k.y;m.z=k.z;m.w=u;var fc=m.x,D=m.y,L=m.z,t=m.w,x=2*fc,y=2*D,A=2*L,u=fc*x,q=D*y,L=L*A,z=fc*y,D=D*A,fc=fc*A,x=t*x,y=t*y,t=t*A;p.e00=1-q-L;p.e01=z-t;p.e02=fc+y;p.e10=z+t;p.e11=1-u-L;p.e12=D-x;p.e20=fc-y;p.e21=D+x;p.e22=1-u-q;u=this.ra;u=0==u.b?new n:u.c[--u.b];u.x+=e.x*l;u.y+=e.y*l;u.z+=e.z*l;q=u.x*p.e10+u.y*p.e11+u.z*p.e12;t=u.x*p.e20+u.y*p.e21+u.z*p.e22;u.x=u.x*p.e00+u.y*p.e01+u.z*p.e02;u.y=q;u.z=t;u.x+=b.x;u.y+=b.y;u.z+=b.z;q=this.ra;if(null!=a){a.R();if(q.b==q.c.length){t=Array(q.b<<1);A=0;for(L=q.b;Ab||5e&&(e=-e);(d=e/.5235987755982984+.5|0)||(d=1);e=f;h=(h-f)/d;c=this.p;c=0==c.b?new n:c.c[--c.b];c.x=a.x;c.y=a.y;c.z=a.z;var g=Math.cos(f);c.x+=l.x*g;c.y+=l.y*g;c.z+=l.z*g;f=Math.sin(f);c.x+=b.x*f;c.y+=b.y*f;c.z+=b.z*f;f=c;for(c=0;cda;){var M=da++,T=this.fg[M],w=this.Mj[M];T.x=w.x;T.y=w.y;T.z=w.z;T.x*=ha;T.y*=ha;T.z*=ha;T.y+=ea;var V=this.fg[M],ia=V.x*q.e10+V.y*q.e11+V.z*q.e12,Y=V.x*q.e20+V.y*q.e21+V.z*q.e22;V.x=V.x*q.e00+V.y*q.e01+V.z*q.e02;V.y=ia;V.z=Y;var oa=this.Ee[M],ua=this.vm[M];oa.x=ua.x;oa.y=ua.y;oa.z=ua.z;oa.x*=ha;oa.y*=ha;oa.z*=ha;oa.y+=ea;var ca=this.Ee[M],Ma=ca.x*q.e10+ca.y*q.e11+ca.z*q.e12,va=ca.x*q.e20+ca.y*q.e21+ca.z*q.e22;ca.x=ca.x*q.e00+ca.y*q.e01+ca.z*q.e02;ca.y=Ma;ca.z=va;var Z=this.af[M],Pa=this.Mj[M];Z.x=Pa.x;Z.y=Pa.y;Z.z=Pa.z;var Fa=Z.x*q.e10+Z.y*q.e11+Z.z*q.e12,Q=Z.x*q.e20+Z.y*q.e21+Z.z*q.e22;Z.x=Z.x*q.e00+Z.y*q.e01+Z.z*q.e02;Z.y=Fa;Z.z=Q;Z.x*=b;Z.y*=b;Z.z*=b;Z.x+=p.x;Z.y+=p.y;Z.z+=p.z;var aa=this.af[M],fa=-e;aa.x+=l.x*fa;aa.y+=l.y*fa;aa.z+=l.z*fa}for(var wa=0;8>wa;){wa++;var ja=this.p,Ga=0==ja.b?new n:ja.c[--ja.b];Ga.x=l.x;Ga.y=l.y;Ga.z=l.z;var P=Ga;P.x=-P.x;P.y=-P.y;P.z=-P.z;var Ya=this.p;if(null!=P){P.R();if(Ya.b==Ya.c.length){for(var Ca=Array(Ya.b<<1),wb=0,ec=Ya.b;wbAb;){var ib=Ab++,hb=this.fg[ib],ka=this.Mj[ib];hb.x=ka.x;hb.y=ka.y;hb.z=ka.z;var Ia=hb.x*q.e10+hb.y*q.e11+hb.z*q.e12,ab=hb.x*q.e20+hb.y*q.e21+hb.z*q.e22;hb.x=hb.x*q.e00+hb.y*q.e01+hb.z*q.e02;hb.y=Ia;hb.z=ab;var bb=this.Ee[ib],Wa=this.fg[ib];bb.x=Wa.x;bb.y=Wa.y;bb.z=Wa.z;bb.x*=b;bb.y*=b;bb.z*=b;bb.x+=p.x;bb.y+=p.y;bb.z+=p.z;var Va=this.af[ib],qb=this.Ee[ib];Va.x=qb.x;Va.y=qb.y;Va.z=qb.z;var kb=this.Ee[ib];kb.x+=l.x*e;kb.y+=l.y*e;kb.z+=l.z*e;var Sa=this.af[ib],Na=-e;Sa.x+=l.x*Na;Sa.y+=l.y*Na;Sa.z+=l.z*Na}for(var Za=0;8>Za;){var vb=Za++,mb=A,xb=this.Ee[vb],nb=this.Ee[(vb+1)%8],fb=l,mb=u,xb=this.af[(vb+1)%8],nb=this.af[vb],Ka=this.p,Db=0==Ka.b?new n:Ka.c[--Ka.b];Db.x=l.x;Db.y=l.y;Db.z=l.z;var G=Db;G.x=-G.x;G.y=-G.y;G.z=-G.z;var fb=G,sb=this.p;if(null!=G){G.R();if(sb.b==sb.c.length){for(var jb=Array(sb.b<<1),Xb=0,ob=sb.b;XbL;)for(var u=L++,z=this.Yh[u].length,fc=0;fcK;){var H=K++;if(!H)for(var F=0;3>F;)for(var R=F++,N=this.Yh[R].length,X=0;Xpa;)for(var ya=pa++,wa=this.Yh[ya].length,Ea=0;EaTa;){var C=Ta++,Aa,na,La,Ba,ta,S,ha,ea;H?3==H?this.wireframe?(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C]):(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C],ta=A[4][0],S=A[H][(C+1)%8],ha=A[H][C]):this.wireframe?(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C]):(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C],Ba=t[H+1][(C+1)%8],ta=A[H][C],S=A[H][(C+1)%8],ha=A[H+1][C],ea=A[H+1][(C+1)%8],this.rect(Aa,La,Ba,na,ta,ha,ea,S,d)):this.wireframe?(Aa=t[0][0],na=t[1][C]):(Aa=t[0][0],na=t[1][C],La=t[1][(C+1)%8],ta=A[0][0],S=A[1][C],ha=A[1][(C+1)%8])}}var da=this.p,M=0==da.b?new n:da.c[--da.b];M.x=p.x;M.y=p.y;M.z=p.z;M.x+=l.x*e;M.y+=l.y*e;M.z+=l.z*e;var T=this.p,w=0==T.b?new n:T.c[--T.b];w.x=p.x;w.y=p.y;w.z=p.z;var V=-e;w.x+=l.x*V;w.y+=l.y*V;w.z+=l.z*V;if(this.wireframe){var ia=this.p,Y=0==ia.b?new n:ia.c[--ia.b];Y.x=M.x;Y.y=M.y;Y.z=M.z;var oa=-b;Y.x+=f.x*oa;Y.y+=f.y*oa;Y.z+=f.z*oa;Y.x+=0*k.x;Y.y+=0*k.y;Y.z+=0*k.z;var ua=this.p,ca=0==ua.b?new n:ua.c[--ua.b];ca.x=M.x;ca.y=M.y;ca.z=M.z;ca.x+=f.x*b;ca.y+=f.y*b;ca.z+=f.z*b;ca.x+=0*k.x;ca.y+=0*k.y;ca.z+=0*k.z;var Ma=this.p,va=0==Ma.b?new n:Ma.c[--Ma.b];va.x=M.x;va.y=M.y;va.z=M.z;va.x+=0*f.x;va.y+=0*f.y;va.z+=0*f.z;var Z=-b;va.x+=k.x*Z;va.y+=k.y*Z;va.z+=k.z*Z;var Pa=this.p,Fa=0==Pa.b?new n:Pa.c[--Pa.b];Fa.x=M.x;Fa.y=M.y;Fa.z=M.z;Fa.x+=0*f.x;Fa.y+=0*f.y;Fa.z+=0*f.z;Fa.x+=k.x*b;Fa.y+=k.y*b;Fa.z+=k.z*b;var Q=this.p,aa=0==Q.b?new n:Q.c[--Q.b];aa.x=w.x;aa.y=w.y;aa.z=w.z;var fa=-b;aa.x+=f.x*fa;aa.y+=f.y*fa;aa.z+=f.z*fa;aa.x+=0*k.x;aa.y+=0*k.y;aa.z+=0*k.z;var Ca=this.p,ja=0==Ca.b?new n:Ca.c[--Ca.b];ja.x=w.x;ja.y=w.y;ja.z=w.z;ja.x+=f.x*b;ja.y+=f.y*b;ja.z+=f.z*b;ja.x+=0*k.x;ja.y+=0*k.y;ja.z+=0*k.z;var Ga=this.p,P=0==Ga.b?new n:Ga.c[--Ga.b];P.x=w.x;P.y=w.y;P.z=w.z;P.x+=0*f.x;P.y+=0*f.y;P.z+=0*f.z;var Ya=-b;P.x+=k.x*Ya;P.y+=k.y*Ya;P.z+=k.z*Ya;var Ka=this.p,wb=0==Ka.b?new n:Ka.c[--Ka.b];wb.x=w.x;wb.y=w.y;wb.z=w.z;wb.x+=0*f.x;wb.y+=0*f.y;wb.z+=0*f.z;wb.x+=k.x*b;wb.y+=k.y*b;wb.z+=k.z*b;this.ellipse(M,f,k,b,b,d);this.ellipse(w,f,k,b,b,d);var ec=this.p;if(null!=Y){Y.R();if(ec.b==ec.c.length){for(var Vb=Array(ec.b<<1),Ab=0,ib=ec.b;Abyb;){var Cb=yb++,la=this.fg[Cb],ra=this.Mj[Cb];la.x=ra.x;la.y=ra.y;la.z=ra.z;var ga=la.x*q.e10+la.y*q.e11+la.z*q.e12,ma=la.x*q.e20+la.y*q.e21+la.z*q.e22;la.x=la.x*q.e00+la.y*q.e01+la.z*q.e02;la.y=ga;la.z=ma;var Ja=this.Ee[Cb],$a=this.fg[Cb];Ja.x=$a.x;Ja.y=$a.y;Ja.z=$a.z;Ja.x*=b;Ja.y*=b;Ja.z*=b;Ja.x+=p.x;Ja.y+=p.y;Ja.z+=p.z;var Oa=this.af[Cb],nc=this.Ee[Cb];Oa.x=nc.x;Oa.y=nc.y;Oa.z=nc.z;var xa=this.Ee[Cb];xa.x+=l.x*e;xa.y+=l.y*e;xa.z+=l.z*e;var Fc=this.af[Cb],eb=-e;Fc.x+=l.x*eb;Fc.y+=l.y*eb;Fc.z+=l.z*eb}for(var gb=0;8>gb;){var pb=gb++,Qa=this.fg[pb],ub=this.fg[(pb+1)%8];this.rect(this.Ee[pb],this.af[pb],this.af[(pb+1)%8],this.Ee[(pb+1)%8],Qa,Qa,ub,ub,d)}}var lb=this.p;if(null!=M){M.R();if(lb.b==lb.c.length){for(var Bb=Array(lb.b<<1),Fb=0,Nb=lb.b;Fbh;)for(var l=h++,g=this.Yh[l].length,k=0;kb;)for(h=b++,l=0;8>l;){var t=l++,A;h&&3!=h&&!this.wireframe&&(g=a[h][t],k=a[h][(t+1)%8],m=a[h+1][t],p=a[h+1][(t+1)%8],r=f[h][t],q=f[h][(t+1)%8],A=f[h+1][t],t=f[h+1][(t+1)%8],this.rect(g,m,p,k,r,A,t,q,e))}e=this.p;if(null!=c){c.R();if(e.b==e.c.length){a=Array(e.b<<1);f=0;for(b=e.b;fA.Oc)A.mg=!0,A=A.ne,A.dd=0,A.Kc=0,A.Jc=0,A.vb=0,A.mf=0,A.nf=0,A.pf=0;else{A.mg=!1;var L=b.rows[b.Da++];L.friction=p;L.Ka=0;var u=L.yg;u.sa=e;u.ta=d;u.ua=c;u.xa=e;u.ya=d;u.za=c;u.aa=A.zb*c-A.Ab*d;u.ba=A.Ab*e-A.yb*c;u.ca=A.yb*d-A.zb*e;u.da=A.Zb*c-A.$b*d;u.ea=A.$b*e-A.Yb*c;u.fa=A.Yb*d-A.Zb*e;u=L.Zj;u.sa=f;u.ta=h;u.ua=l;u.xa=f;u.ya=h;u.za=l;u.aa=A.zb*l-A.Ab*h;u.ba=A.Ab*f-A.yb*l;u.ca=A.yb*h-A.zb*f;u.da=A.Zb*l-A.$b*h;u.ea=A.$b*f-A.Yb*l;u.fa=A.Yb*h-A.Zb*f;u=L.Yj;u.sa=g;u.ta=k;u.ua=m;u.xa=g;u.ya=k;u.za=m;u.aa=A.zb*m-A.Ab*k;u.ba=A.Ab*g-A.yb*m;u.ca=A.yb*k-A.zb*g;u.da=A.Zb*m-A.$b*k;u.ea=A.$b*g-A.Yb*m;u.fa=A.Yb*k-A.Zb*g;u=L.yg;u=u.sa*this.C.jb+u.ta*this.C.kb+u.ua*this.C.lb+(u.aa*this.C.nb+u.ba*this.C.ob+u.ca*this.C.pb)-(u.xa*this.D.jb+u.ya*this.D.kb+u.za*this.D.lb+(u.da*this.D.nb+u.ea*this.D.ob+u.fa*this.D.pb));L.Fa=u<-F.contactEnableBounceThreshold&&!A.kf?-u*r:0;this.Sg==jc.BAUMGARTE&&A.Oc>F.linearSlop&&(u=(A.Oc-F.linearSlop)*F.velocityBaumgarte*a.invDt,L.Fal.Fa&&(l.Fa=0);l.qa=h.ne}}},rl:function(){this.Ia.pm(this.Ej,this.Fj)},mb:function(){return this.Ec},Cb:function(){return this.Fc},wa:function(){return this.Ia},Kk:function(){for(var a=0,b=this.Ia.oe;aF.contactPersistenceThreshold?this.Zm(a):(e+=this.Ia.Og*-c,d+=this.Ia.Pg*-c,b+=this.Ia.Qg*-c,e*e+d*d+b*b>F.contactPersistenceThreshold*F.contactPersistenceThreshold&&this.Zm(a))}},Zm:function(a){var b=--this.Ia.oe;if(a!=b){var e=this.Ia.Bc[a];this.Ia.Bc[a]=this.Ia.Bc[b];this.Ia.Bc[b]=e}a=this.Ia.Bc[b];a.Ff=0;a.Gf=0;a.Hf=0;a.If=0;a.Jf=0;a.Kf=0;a.yb=0;a.zb=0;a.Ab=0;a.Yb=0;a.Zb=0;a.$b=0;a.be=0;a.ce=0;a.de=0;a.ee=0;a.fe=0;a.ge=0;a.Oc=0;b=a.ne;b.dd=0;b.Kc=0;b.Jc=0;b.vb=0;b.mf=0;b.nf=0;b.pf=0;a.kf=!1;a.mg=!1;a.Ic=-1},Gn:function(a,b,e){var d=this.Ia.oe;if(d==F.maxManifoldPoints){var d=this.Ia.Bc[this.Nn(a,b,e)],c=a.position1;d.be=c.x;d.ce=c.y;d.de=c.z;c=a.position2;d.ee=c.x;d.fe=c.y;d.ge=c.z;d.yb=d.be-b.v;d.zb=d.ce-b.A;d.Ab=d.de-b.B;d.Yb=d.ee-e.v;d.Zb=d.fe-e.A;d.$b=d.ge-e.B;var f,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab;f=b.f*d.yb+b.m*d.zb+b.g*d.Ab;b=b.h*d.yb+b.j*d.zb+b.s*d.Ab;d.Ff=c;d.Gf=f;d.Hf=b;b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b;c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b;e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b;d.If=b;d.Jf=c;d.Kf=e;d.Oc=a.depth;e=d.ne;e.dd=0;e.Kc=0;e.Jc=0;e.vb=0;e.mf=0;e.nf=0;e.pf=0;d.Ic=a.id;d.kf=!1;d.mg=!1}else d=this.Ia.Bc[d],c=a.position1,d.be=c.x,d.ce=c.y,d.de=c.z,c=a.position2,d.ee=c.x,d.fe=c.y,d.ge=c.z,d.yb=d.be-b.v,d.zb=d.ce-b.A,d.Ab=d.de-b.B,d.Yb=d.ee-e.v,d.Zb=d.fe-e.A,d.$b=d.ge-e.B,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab,f=b.f*d.yb+b.m*d.zb+b.g*d.Ab,b=b.h*d.yb+b.j*d.zb+b.s*d.Ab,d.Ff=c,d.Gf=f,d.Hf=b,b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b,c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b,e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b,d.If=b,d.Jf=c,d.Kf=e,d.Oc=a.depth,e=d.ne,e.dd=0,e.Kc=0,e.Jc=0,e.vb=0,e.mf=0,e.nf=0,e.pf=0,d.Ic=a.id,d.kf=!1,d.mg=!1,this.Ia.oe++},Nn:function(a,b){var e=this.Ia.Bc[0],d=this.Ia.Bc[1],c=this.Ia.Bc[2],f=this.Ia.Bc[3],h=e.Oc,l=0;d.Oc>h&&(h=d.Oc,l=1);c.Oc>h&&(h=c.Oc,l=2);f.Oc>h&&(h=f.Oc,l=3);var g,k,m,p=a.position1;g=p.x;k=p.y;m=p.z;g-=b.v;k-=b.A;m-=b.B;var r=d.yb,q=d.zb,t=d.Ab,A=c.yb,L=c.zb,u=c.Ab,n=f.yb,x=f.zb,D=f.Ab,F,y,B,E,K,H,N,R,I,X,J,Da,qa,pa,ya,wa,Ea,O;F=A-r;y=L-q;B=u-t;E=g-n;K=k-x;H=m-D;N=n-r;R=x-q;I=D-t;X=g-A;J=k-L;Da=m-u;qa=g-r;pa=k-q;ya=m-t;wa=n-A;Ea=x-L;O=D-u;var sa,ba,za,Ta,C,Aa,na,La,Ba;sa=y*H-B*K;ba=B*E-F*H;za=F*K-y*E;Ta=R*Da-I*J;C=I*X-N*Da;Aa=N*J-R*X;na=pa*O-ya*Ea;La=ya*wa-qa*O;Ba=qa*Ea-pa*wa;var ta=sa*sa+ba*ba+za*za,S=Ta*Ta+C*C+Aa*Aa,ha=na*na+La*La+Ba*Ba,ea=e.yb,da=e.zb,M=e.Ab,T=c.yb,w=c.zb,V=c.Ab,ia=f.yb,Y=f.zb,oa=f.Ab,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Ca,ja,Ga,P,Ya,Ka,wb,Ua;ua=T-ea;ca=w-da;Ma=V-M;va=g-ia;Z=k-Y;Pa=m-oa;Fa=ia-ea;Q=Y-da;aa=oa-M;fa=g-T;Ca=k-w;ja=m-V;Ga=g-ea;P=k-da;Ya=m-M;Ka=ia-T;wb=Y-w;Ua=oa-V;var Vb,Ab,ib,hb,ka,Ia,ab,bb,Wa;Vb=ca*Pa-Ma*Z;Ab=Ma*va-ua*Pa;ib=ua*Z-ca*va;hb=Q*ja-aa*Ca;ka=aa*fa-Fa*ja;Ia=Fa*Ca-Q*fa;ab=P*Ua-Ya*wb;bb=Ya*Ka-Ga*Ua;Wa=Ga*wb-P*Ka;var Va=Vb*Vb+Ab*Ab+ib*ib,qb=hb*hb+ka*ka+Ia*Ia,kb=ab*ab+bb*bb+Wa*Wa,Sa=Va>qb?Va>kb?Va:kb:qb>kb?qb:kb,Na=e.yb,Za=e.zb,vb=e.Ab,mb=d.yb,xb=d.zb,nb=d.Ab,fb=f.yb,gb=f.zb,Db=f.Ab,G,sb,jb,Xb,ob,cb,zb,Xa,tb,v,W,U,db,cc,Ra,Ha,rb,yb;G=mb-Na;sb=xb-Za;jb=nb-vb;Xb=g-fb;ob=k-gb;cb=m-Db;zb=fb-Na;Xa=gb-Za;tb=Db-vb;v=g-mb;W=k-xb;U=m-nb;db=g-Na;cc=k-Za;Ra=m-vb;Ha=fb-mb;rb=gb-xb;yb=Db-nb;var Cb,la,ra,ga,ma,Ja,$a,Oa,eb;Cb=sb*cb-jb*ob;la=jb*Xb-G*cb;ra=G*ob-sb*Xb;ga=Xa*U-tb*W;ma=tb*v-zb*U;Ja=zb*W-Xa*v;$a=cc*yb-Ra*rb;Oa=Ra*Ha-db*yb;eb=db*rb-cc*Ha;var xa=Cb*Cb+la*la+ra*ra,pb=ga*ga+ma*ma+Ja*Ja,lb=$a*$a+Oa*Oa+eb*eb,Qa=xa>pb?xa>lb?xa:lb:pb>lb?pb:lb,ub=e.yb,Bb=e.zb,Fb=e.Ab,Hb=d.yb,Kb=d.zb,Lb=d.Ab,Nb=c.yb,Ic=c.zb,Yb=c.Ab,oc,Mb,Pb,rc,Jc,Gb,Qb,Jb,hc,uc,gc,Ob,Eb,Rb,Sb,Tb,$b,Zb;oc=Hb-ub;Mb=Kb-Bb;Pb=Lb-Fb;rc=g-Nb;Jc=k-Ic;Gb=m-Yb;Qb=Nb-ub;Jb=Ic-Bb;hc=Yb-Fb;uc=g-Hb;gc=k-Kb;Ob=m-Lb;Eb=g-ub;Rb=k-Bb;Sb=m-Fb;Tb=Nb-Hb;$b=Ic-Kb;Zb=Yb-Lb;var ic,bc,Wb,ac,dc,sc,kc,lc,Gc;ic=Mb*Gb-Pb*Jc;bc=Pb*rc-oc*Gb;Wb=oc*Jc-Mb*rc;ac=Jb*Ob-hc*gc;dc=hc*uc-Qb*Ob;sc=Qb*gc-Jb*uc;kc=Rb*Zb-Sb*$b;lc=Sb*Tb-Eb*Zb;Gc=Eb*$b-Rb*Tb;var pc=ic*ic+bc*bc+Wb*Wb,vc=ac*ac+dc*dc+sc*sc,qc=kc*kc+lc*lc+Gc*Gc,tc=pc>vc?pc>qc?pc:qc:vc>qc?vc:qc,jc=ta>S?ta>ha?ta:ha:S>ha?S:ha,wc=0;if(Sa>jc&&1!=l||!l)jc=Sa,wc=1;Qa>jc&&2!=l&&(jc=Qa,wc=2);tc>jc&&3!=l&&(jc=tc,wc=3);return wc},Qn:function(a,b,e){for(var d=F.contactPersistenceThreshold*F.contactPersistenceThreshold,c=-1,f=0,h=this.Ia.oe;fe?(a=this.Ma,b=this.Na,d=this.Oa,e=a*a,c=b*b,f=d*d,ed?(a=this.Ma,b=this.Na,e=this.Oa,d=a*a,c=b*b,f=e*e,dg?b=k=e=0:f==g?(e=-Infinity,k=Infinity,b-=f):bg?(e=0,k=Infinity,b=b-g-l,0>b&&(b=0)):b=k=e=0;a.Ha=e;a.Ga=k;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},nh:function(a,b,e,d,c,f,h){var l=F.angularSlop;if(h)c=0,h=1;else{if(0e?b=g=k=0:f==e?(k=-Infinity,g=Infinity,b-=f):be?(k=0,g=Infinity,b=b-e-l,0>b&&(b=0)):b=g=k=0;a.Ha=k;a.Ga=g;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},Mh:function(a,b){return b?1:this.Sg==jc.BAUMGARTE?a.invDt*F.velocityBaumgarte:0},Yg:function(a,b,e){var d=(this.C.S*a+this.C.T*b+this.C.U*e)*a+(this.C.V*a+this.C.W*b+this.C.X*e)*b+(this.C.Y*a+this.C.Z*b+this.C.$*e)*e,c=(this.D.S*a+this.D.T*b+this.D.U*e)*a+(this.D.V*a+this.D.W*b+this.D.X*e)*b+(this.D.Y*a+this.D.Z*b+this.D.$*e)*e;if(0this.nj*this.nj?this.jc.bm(this):0this.oj*this.oj&&this.jc.bm(this)},Ke:function(){return this.C},bf:function(){return this.D},hg:function(){return this.Jb},mb:function(){var a=new n;a.x=this.uf;a.y=this.vf;a.z=this.wf;return a},Kb:function(){var a=new n;a.x=this.xf;a.y=this.yf;a.z=this.zf;return a},Cb:function(a){a.x=this.uf;a.y=this.vf;a.z=this.wf},kc:function(a){a.x=this.xf;a.y=this.yf;a.z=this.zf},Fe:function(){var a=new n;a.x=this.sj;a.y=this.tj;a.z=this.uj;return a},He:function(){var a=new n;a.x=this.vj;a.y=this.wj;a.z=this.xj;return a},Ge:function(a){a.x=this.sj;a.y=this.tj;a.z=this.uj},Ie:function(a){a.x=this.vj;a.y=this.wj;a.z=this.xj},Hc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Vc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Uc:function(a){var b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},Wc:function(a){var b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},wa:function(){return this.Sk},ig:function(a){this.Sk=a},vd:function(){return this.nj},jg:function(a){this.nj=a},ie:function(){return this.oj},kg:function(a){this.oj=a},Je:function(){return this.Sg},ph:function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.Sg=a},lc:function(){var a=new n;a.x=this.ej;a.y=this.fj;a.z=this.gj;return a},wc:function(a){a.x=this.ej;a.y=this.fj;a.z=this.gj},xc:function(){var a=new n;a.x=this.hj;a.y=this.ij;a.z=this.jj;return a},Dc:function(a){a.x=this.hj;a.y=this.ij;a.z=this.jj},gg:function(){return this.ia},cf:function(){return this.M}};Fb.wa=N;Fb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Re*d,d=this.Se*d,l,g=this.Yg(this.N.pc,this.N.qc,this.N.rc);if(0>=this.ul.frequency||!e){l=this.Eb[0];var k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=null;k.qa=l;this.ak(k,this.Bg,this.tl,1/(this.C.qb+this.D.qb),this.ul,b,e);l=k.va;l.sa=this.N.pc;l.ta=this.N.qc;l.ua=this.N.rc;l.xa=this.N.pc;l.ya=this.N.qc;l.za=this.N.rc;l.aa=this.bc*this.N.rc-this.cc*this.N.qc;l.ba=this.cc*this.N.pc-this.ac*this.N.rc;l.ca=this.ac*this.N.qc-this.bc*this.N.pc;l.da=this.ec*this.N.rc-this.fc*this.N.qc;l.ea=this.fc*this.N.pc-this.dc*this.N.rc;l.fa=this.dc*this.N.qc-this.ec*this.N.pc}l=this.Eb[1];k=a.rows[a.Da++];m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=l;k.Fa=c;k.Ka=0;k.Ha=-Infinity;k.Ga=Infinity;l=k.va;l.sa=this.N.yc;l.ta=this.N.zc;l.ua=this.N.Ac;l.xa=this.N.yc;l.ya=this.N.zc;l.za=this.N.Ac;l.aa=this.bc*this.N.Ac-this.cc*this.N.zc;l.ba=this.cc*this.N.yc-this.ac*this.N.Ac;l.ca=this.ac*this.N.zc-this.bc*this.N.yc;l.da=this.ec*this.N.Ac-this.fc*this.N.zc;l.ea=this.fc*this.N.yc-this.dc*this.N.Ac;l.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];l=a.rows[a.Da++];k=l.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;l.Fa=0;l.Ka=0;l.Ha=0;l.Ga=0;l.motorSpeed=0;l.tb=0;l.qa=c;l.Fa=f;l.Ka=0;l.Ha=-Infinity;l.Ga=Infinity;l=l.va;l.sa=this.N.Lc;l.ta=this.N.Mc;l.ua=this.N.Nc;l.xa=this.N.Lc;l.ya=this.N.Mc;l.za=this.N.Nc;l.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;l.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;l.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;l.da=this.ec*this.N.Nc-this.fc*this.N.Mc;l.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;l.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;if(0>=this.nl.frequency||!e)f=this.Eb[3],c=a.rows[a.Da++],l=c.va,l.sa=0,l.ta=0,l.ua=0,l.xa=0,l.ya=0,l.za=0,l.aa=0,l.ba=0,l.ca=0,l.da=0,l.ea=0,l.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.angle,this.ml,g,this.nl,b,e),l=c.va,l.aa=this.N.pc,l.ba=this.N.qc,l.ca=this.N.rc,l.da=this.N.pc,l.ea=this.N.qc,l.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=h;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;l=e.va;l.aa=this.N.yc;l.ba=this.N.zc;l.ca=this.N.Ac;l.da=this.N.yc;l.ea=this.N.zc;l.fa=this.N.Ac;h=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=h;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;l=a.va;l.aa=this.N.Lc;l.ba=this.N.Mc;l.ca=this.N.Nc;l.da=this.N.Lc;l.ea=this.N.Mc;l.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>pb*this.N.pc+xa*this.N.qc+lb*this.N.rc&&(this.angle=-this.angle);var Qa,ub,Bb;Qa=this.xf-this.uf;ub=this.yf-this.vf;Bb=this.zf-this.wf;this.Bg=Qa*this.N.pc+ub*this.N.qc+Bb*this.N.rc;this.Xf=Qa*this.N.yc+ub*this.N.zc+Bb*this.N.Ac;this.Yf=Qa*this.N.Lc+ub*this.N.Mc+Bb*this.N.Nc},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},po:function(){return this.ul},eo:function(){return this.nl},no:function(){return this.tl},bo:function(){return this.ml},Gl:function(){return this.angle},Jl:function(){return this.Bg}});Gb.prototype={Mg:function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var d=this.rigidBody1;a=this.localAnchor1;var c,f,h;c=e.x;f=e.y;h=e.z;c-=d.a.v;f-=d.a.A;h-=d.a.B;var l;b=d.a.o*c+d.a.i*f+d.a.l*h;l=d.a.f*c+d.a.m*f+d.a.g*h;d=d.a.h*c+d.a.j*f+d.a.s*h;a.x=b;a.y=l;a.z=d;b=this.rigidBody2;a=this.localAnchor2;l=e.x;d=e.y;f=e.z;l-=b.a.v;d-=b.a.A;f-=b.a.B;e=b.a.o*l+b.a.i*d+b.a.l*f;c=b.a.f*l+b.a.m*d+b.a.g*f;b=b.a.h*l+b.a.j*d+b.a.s*f;a.x=e;a.y=c;a.z=b}};wf.wa=Gb;wf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});Sb.wa=N;Sb.prototype=gb(N.prototype,{ud:function(a,b,e){var d,c=1/(this.C.qb+this.D.qb),f=this.Yg(this.wd,this.xd,this.yd),h=this.Yg(this.kd,this.ld,this.md),l=this.Yg(this.zd,this.Ad,this.Bd);if(0>=this.Rf[0].frequency||!e){d=this.Eb[0];var g=a.rows[a.Da++],k=g.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;g.Fa=0;g.Ka=0;g.Ha=0;g.Ga=0;g.motorSpeed=0;g.tb=0;g.qa=d;this.ak(g,this.translationX,this.qg[0],c,this.Rf[0],b,e);d=g.va;d.sa=this.fb;d.ta=this.gb;d.ua=this.hb;d.xa=this.fb;d.ya=this.gb;d.za=this.hb;d.aa=this.bc*this.hb-this.cc*this.gb;d.ba=this.cc*this.fb-this.ac*this.hb;d.ca=this.ac*this.gb-this.bc*this.fb;d.da=this.ec*this.hb-this.fc*this.gb;d.ea=this.fc*this.fb-this.dc*this.hb;d.fa=this.dc*this.gb-this.ec*this.fb}if(0>=this.Rf[1].frequency||!e)d=this.Eb[1],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.translationY,this.qg[1],c,this.Rf[1],b,e),d=g.va,d.sa=this.Xc,d.ta=this.Yc,d.ua=this.Zc,d.xa=this.Xc,d.ya=this.Yc,d.za=this.Zc,d.aa=this.bc*this.Zc-this.cc*this.Yc,d.ba=this.cc*this.Xc-this.ac*this.Zc,d.ca=this.ac*this.Yc-this.bc*this.Xc,d.da=this.ec*this.Zc-this.fc*this.Yc,d.ea=this.fc*this.Xc-this.dc*this.Zc,d.fa=this.dc*this.Yc-this.ec*this.Xc;if(0>=this.Rf[2].frequency||!e)d=this.Eb[2],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.cm,this.qg[2],c,this.Rf[2],b,e),d=g.va,d.sa=this.ve,d.ta=this.we,d.ua=this.xe,d.xa=this.ve,d.ya=this.we,d.za=this.xe,d.aa=this.bc*this.xe-this.cc*this.we,d.ba=this.cc*this.ve-this.ac*this.xe,d.ca=this.ac*this.we-this.bc*this.ve,d.da=this.ec*this.xe-this.fc*this.we,d.ea=this.fc*this.ve-this.dc*this.xe,d.fa=this.dc*this.we-this.ec*this.ve;this.dk||!(0>=this.Tg[0].frequency)&&e||(c=this.Eb[3],d=a.rows[a.Da++],g=d.va,g.sa=0,g.ta=0,g.ua=0,g.xa=0,g.ya=0,g.za=0,g.aa=0,g.ba=0,g.ca=0,g.da=0,g.ea=0,g.fa=0,d.Fa=0,d.Ka=0,d.Ha=0,d.Ga=0,d.motorSpeed=0,d.tb=0,d.qa=c,this.nh(d,this.Af,this.pg[0],f,this.Tg[0],b,e),d=d.va,d.aa=this.wd,d.ba=this.xd,d.ca=this.yd,d.da=this.wd,d.ea=this.xd,d.fa=this.yd);this.ek||!(0>=this.Tg[1].frequency)&&e||(f=this.Eb[4],c=a.rows[a.Da++],d=c.va,d.sa=0,d.ta=0,d.ua=0,d.xa=0,d.ya=0,d.za=0,d.aa=0,d.ba=0,d.ca=0,d.da=0,d.ea=0,d.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.qh,this.pg[1],h,this.Tg[1],b,e),d=c.va,d.aa=this.kd,d.ba=this.ld,d.ca=this.md,d.da=this.kd,d.ea=this.ld,d.fa=this.md);this.fk||!(0>=this.Tg[2].frequency)&&e||(h=this.Eb[5],a=a.rows[a.Da++],f=a.va,f.sa=0,f.ta=0,f.ua=0,f.xa=0,f.ya=0,f.za=0,f.aa=0,f.ba=0,f.ca=0,f.da=0,f.ea=0,f.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=h,this.nh(a,this.Bf,this.pg[2],l,this.Tg[2],b,e),d=a.va,d.aa=this.zd,d.ba=this.Ad,d.ca=this.Bd,d.da=this.zd,d.ea=this.Ad,d.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;a=this.xf-this.uf;b=this.yf-this.vf;e=this.zf-this.wf;this.translationX=a*this.fb+b*this.gb+e*this.hb;this.translationY=a*this.Xc+b*this.Yc+e*this.Zc;this.cm=a*this.ve+b*this.we+e*this.xe},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Un:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},Vn:function(){var a=new n;a.x=this.kd;a.y=this.ld;a.z=this.md;return a},Wn:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},qo:function(){return this.Rf.slice(0)},fo:function(){return this.Rf.slice(0)},oo:function(){return this.qg.slice(0)},co:function(){return this.pg.slice(0)},Tn:function(){return new n(this.Af,this.qh,this.Bf)},ro:function(){return new n(this.translationX,this.translationY,this.cm)}});Lg.wa=Gb;Lg.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);var f=a.a;b=b.a;var h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B;h=d.e00;l=d.e01;g=d.e02;k=d.e10;m=d.e11;p=d.e12;r=d.e20;q=d.e21;t=d.e22;A=c.e00;n=c.e01;u=c.e02;z=c.e10;x=c.e11;D=c.e12;F=c.e20;y=c.e21;B=c.e22;var E,K;c=f.o*h+f.i*k+f.l*r;d=f.o*l+f.i*m+f.l*q;a=f.o*g+f.i*p+f.l*t;e=f.f*h+f.m*k+f.g*r;E=f.f*l+f.m*m+f.g*q;K=f.f*g+f.m*p+f.g*t;h=f.h*h+f.j*k+f.s*r;l=f.h*l+f.j*m+f.s*q;k=f.h*g+f.j*p+f.s*t;f=b.o*A+b.i*z+b.l*F;g=b.o*n+b.i*x+b.l*y;p=b.o*u+b.i*D+b.l*B;m=b.f*A+b.m*z+b.g*F;q=b.f*n+b.m*x+b.g*y;t=b.f*u+b.m*D+b.g*B;A=b.h*A+b.j*z+b.s*F;n=b.h*n+b.j*x+b.s*y;b=b.h*u+b.j*D+b.s*B;u=this.localBasis1;u.e00=c;u.e01=d;u.e02=a;u.e10=e;u.e11=E;u.e12=K;u.e20=h;u.e21=l;u.e22=k;c=this.localBasis2;c.e00=f;c.e01=g;c.e02=p;c.e10=m;c.e11=q;c.e12=t;c.e20=A;c.e21=n;c.e22=b;return this}});qc.prototype={wa:function(){return this.gl},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};Jb.wa=N;Jb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Jh*d,l=this.Re*d,d=this.Se*d;if(0>=this.Pe.frequency||!e){var g=this.Eb[0],k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=g;this.ak(k,this.Bg,this.fi,1/(this.C.qb+this.D.qb),this.Pe,b,e);b=k.va;b.sa=this.N.pc;b.ta=this.N.qc;b.ua=this.N.rc;b.xa=this.N.pc;b.ya=this.N.qc;b.za=this.N.rc;b.aa=this.bc*this.N.rc-this.cc*this.N.qc;b.ba=this.cc*this.N.pc-this.ac*this.N.rc;b.ca=this.ac*this.N.qc-this.bc*this.N.pc;b.da=this.ec*this.N.rc-this.fc*this.N.qc;b.ea=this.fc*this.N.pc-this.dc*this.N.rc;b.fa=this.dc*this.N.qc-this.ec*this.N.pc}b=this.Eb[1];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=c;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;b=e.va;b.sa=this.N.yc;b.ta=this.N.zc;b.ua=this.N.Ac;b.xa=this.N.yc;b.ya=this.N.zc;b.za=this.N.Ac;b.aa=this.bc*this.N.Ac-this.cc*this.N.zc;b.ba=this.cc*this.N.yc-this.ac*this.N.Ac;b.ca=this.ac*this.N.zc-this.bc*this.N.yc;b.da=this.ec*this.N.Ac-this.fc*this.N.zc;b.ea=this.fc*this.N.yc-this.dc*this.N.Ac;b.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];b=a.rows[a.Da++];e=b.va;e.sa=0;e.ta=0;e.ua=0;e.xa=0;e.ya=0;e.za=0;e.aa=0;e.ba=0;e.ca=0;e.da=0;e.ea=0;e.fa=0;b.Fa=0;b.Ka=0;b.Ha=0;b.Ga=0;b.motorSpeed=0;b.tb=0;b.qa=c;b.Fa=f;b.Ka=0;b.Ha=-Infinity;b.Ga=Infinity;b=b.va;b.sa=this.N.Lc;b.ta=this.N.Mc;b.ua=this.N.Nc;b.xa=this.N.Lc;b.ya=this.N.Mc;b.za=this.N.Nc;b.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;b.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;b.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;b.da=this.ec*this.N.Nc-this.fc*this.N.Mc;b.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;b.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;f=this.Eb[3];c=a.rows[a.Da++];b=c.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;c.Fa=0;c.Ka=0;c.Ha=0;c.Ga=0;c.motorSpeed=0;c.tb=0;c.qa=f;c.Fa=h;c.Ka=0;c.Ha=-Infinity;c.Ga=Infinity;b=c.va;b.aa=1;b.ba=0;b.ca=0;b.da=1;b.ea=0;b.fa=0;h=this.Eb[4];f=a.rows[a.Da++];c=f.va;c.sa=0;c.ta=0;c.ua=0;c.xa=0;c.ya=0;c.za=0;c.aa=0;c.ba=0;c.ca=0;c.da=0;c.ea=0;c.fa=0;f.Fa=0;f.Ka=0;f.Ha=0;f.Ga=0;f.motorSpeed=0;f.tb=0;f.qa=h;f.Fa=l;f.Ka=0;f.Ha=-Infinity;f.Ga=Infinity;b=f.va;b.aa=0;b.ba=1;b.ca=0;b.da=0;b.ea=1;b.fa=0;l=this.Eb[5];a=a.rows[a.Da++];h=a.va;h.sa=0;h.ta=0;h.ua=0;h.xa=0;h.ya=0;h.za=0;h.aa=0;h.ba=0;h.ca=0;h.da=0;h.ea=0;h.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;b=a.va;b.aa=0;b.ba=0;b.ca=1;b.da=0;b.ea=0;b.fa=1},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qbJb?Gb>gc?(Eb=Math.sqrt(Gb-Jb-gc+1),Sb=.5*Eb,Eb=.5/Eb,Tb=(Yb+Qb)*Eb,hc=(oc+Ob)*Eb,uc=(Rb-rc)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb):Jb>gc?(Eb=Math.sqrt(Jb-gc-Gb+1),Tb=.5*Eb,Eb=.5/Eb,Sb=(Yb+Qb)*Eb,hc=(rc+Rb)*Eb,uc=(oc-Ob)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb);var Zb=uc,bc=2*(-1>=Zb?3.14159265358979:1<=Zb?0:Math.acos(Zb));this.Jh=Sb;this.Re=Tb;this.Se=hc;var Wb=this.Jh*this.Jh+this.Re*this.Re+this.Se*this.Se;0=this.ql.frequency||!e)&&(h=this.Eb[3],p=a.rows[a.Da++],r=p.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,p.Fa=0,p.Ka=0,p.Ha=0,p.Ga=0,p.motorSpeed=0,p.tb=0,p.qa=h,this.nh(p,this.bk,this.Fl,x,this.ql,b,e),c=p.va,c.aa=this.Be,c.ba=this.Ce,c.ca=this.De,c.da=this.Be,c.ea=this.Ce,c.fa=this.De);if(0>=this.wl.frequency||!e)x=this.Eb[4],a=a.rows[a.Da++],h=a.va,h.sa=0,h.ta=0,h.ua=0,h.xa=0,h.ya=0,h.za=0,h.aa=0,h.ba=0,h.ca=0,h.da=0,h.ea=0,h.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=x,this.nh(a,this.Hj,this.vl,d,this.wl,b,e),c=a.va,c.aa=this.Ai,c.ba=this.Bi,c.ca=this.Ci,c.da=this.Ai,c.ea=this.Bi,c.fa=this.Ci},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f;a=this.fb;b=this.gb;e=this.hb;d=this.Ob;c=this.Pb;f=this.Qb;var h,l,g,k,m,p,r,q,t;h=this.fb;l=this.Xc;g=this.ve;k=this.gb;m=this.Yc;p=this.we;r=this.hb;q=this.Zc;t=this.xe;var A,n,u,z,x,D,F,y;D=a*d+b*c+e*f;-.999999999>D?(x=a*a,d=b*b,c=e*e,x=z?3.14159265358979:1<=z?0:Math.acos(z));z=A;y=u;u=a*this.se+x*this.te+D*this.ue;B=b*this.se+d*this.te+f*this.ue;A=e*this.se+c*this.te+F*this.ue;this.Hj=Math.atan2(this.ve*u+this.we*B+this.xe*A,this.Xc*u+this.Yc*B+this.Zc*A);this.Ai=this.fb+this.Ob;this.Bi=this.gb+this.Pb;this.Ci=this.hb+this.Qb;A=this.Ai*this.Ai+this.Bi*this.Bi+this.Ci*this.Ci;0=this.Pe.frequency||!e)h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.angle,this.fi,D,this.Pe,b,e),c=r.va,c.aa=this.N.pc,c.ba=this.N.qc,c.ca=this.N.rc,c.da=this.N.pc,c.ea=this.N.qc,c.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];D=e.va;D.sa=0;D.ta=0;D.ua=0;D.xa=0;D.ya=0;D.za=0;D.aa=0;D.ba=0;D.ca=0;D.da=0;D.ea=0;D.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=l;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;c=e.va;c.aa=this.N.yc;c.ba=this.N.zc;c.ca=this.N.Ac;c.da=this.N.yc;c.ea=this.N.zc;c.fa=this.N.Ac;l=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;c=a.va;c.aa=this.N.Lc;c.ba=this.N.Mc;c.ca=this.N.Nc;c.da=this.N.Lc;c.ea=this.N.Mc;c.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>Qa*this.N.pc+xa*this.N.qc+ub*this.N.rc&&(this.angle=-this.angle);this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},Qj:function(){return this.Pe},Il:function(){return this.fi},Gl:function(){return this.angle}});ff.wa=Gb;ff.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});$b.prototype={mh:function(a,b){this.lowerLimit=a;this.upperLimit=b;return this},wa:function(a,b){this.motorSpeed=a;this.motorTorque=b;return this},clone:function(){var a=new $b;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed=this.motorSpeed;a.motorTorque=this.motorTorque;return a}};se.wa=N;se.prototype=gb(N.prototype,{ud:function(a,b,e){if(!(0=this.ol.frequency)&&e||(h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.Af,this.hl,D,this.ol,b,e),c=r.va,c.aa=this.wd,c.ba=this.xd,c.ca=this.yd,c.da=this.wd,c.ea=this.xd,c.fa=this.yd);this.ek||(D=this.Eb[4],h=a.rows[a.Da++],r=h.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,h.Fa=0,h.Ka=0,h.Ha=0,h.Ga=0,h.motorSpeed=0,h.tb=0,h.qa=D,h.Fa=l,h.Ka=0,h.Ha=-Infinity,h.Ga=Infinity,c=h.va,c.aa=this.kd,c.ba=this.ld,c.ca=this.md,c.da=this.kd,c.ea=this.ld,c.fa=this.md);this.fk||!(0>=this.pl.frequency)&&e||(l=this.Eb[5],a=a.rows[a.Da++],D=a.va,D.sa=0,D.ta=0,D.ua=0,D.xa=0,D.ya=0,D.za=0,D.aa=0,D.ba=0,D.ca=0,D.da=0,D.ea=0,D.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=l,this.nh(a,this.Bf,this.il,d,this.pl,b,e),c=a.va,c.aa=this.zd,c.ba=this.Ad,c.ca=this.Bd,c.da=this.zd,c.ea=this.Ad,c.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Cf;a.y=this.Df;a.z=this.Ef},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.nd;a.y=this.od;a.z=this.pd;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.nd;a.y=this.od;a.z=this.pd},ho:function(){return this.ol},io:function(){return this.pl},$n:function(){return this.hl},ao:function(){return this.il},Rn:function(){return this.Af},Sn:function(){return this.Bf}});Kf.wa=Gb;Kf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);e=this.localAxis1;var f,h,l;f=d.x;h=d.y;l=d.z;var g;d=a.a.o*f+a.a.i*h+a.a.l*l;g=a.a.f*f+a.a.m*h+a.a.g*l;a=a.a.h*f+a.a.j*h+a.a.s*l;e.x=d;e.y=g;e.z=a;a=this.localAxis2;e=c.x;f=c.y;d=c.z;c=b.a.o*e+b.a.i*f+b.a.l*d;h=b.a.f*e+b.a.m*f+b.a.g*d;b=b.a.h*e+b.a.j*f+b.a.s*d;a.x=c;a.y=h;a.z=b;return this}});tj.prototype={Aa:function(a){this.ed=a.ed;for(var b=0,e=this.ed;bp?r.Ha:0q.Ga+F.directMlcpSolverEps){b=!1;break}c[r]=A-t}if(h)return!0;if(!b)return!1;h=0;for(g=this.ed;hp&&k>F.directMlcpSolverEps||0e.Ga;0==e.Ha&&0==e.Ga?(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=0,c.ed++,this.mi(a,b+1),this.lf.ed--):(e=this.lf,e.hh[e.Ae]=b,e.Ae++,this.mi(a,b+1),this.lf.Ae--,d&&(d=this.lf,d.Nh[d.ed]=b,d.Sh[d.ed]=-1,d.ed++,this.mi(a,b+1),this.lf.ed--),c&&(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=1,c.ed++,this.mi(a,b+1),this.lf.ed--))}}};Mi.prototype={};Wb.wa=Ob;Wb.prototype=gb(Ob.prototype,{Qh:function(a){this.ga.bd();this.ga.Sd(a,this.info);this.C=this.info.Ye;this.D=this.info.Ze;this.yi.Dl(this.info,this.Wb);a=this.$e;a.sf=0;var b=a.lf;b.ed=0;b.Ae=0;a.mi(this.info,0);a=this.em;for(var b=this.$e.sf,e=0,d=0,c=0,f=a.n;c=b)for(b=0,a=this.info.Da;bc.Ga&&(h=c.Ga);f.qa=h;0c&&(h=c),f.Dd=h):f.Dd=0;this.Wf[d]=f.qa+f.Dd}var b=this.Wf,e=a=!1,l,g,k,m,p,r,q,t,d=this.C.jb,f=this.C.kb,c=this.C.lb,h=this.D.jb;l=this.D.kb;g=this.D.lb;k=this.C.nb;m=this.C.ob;p=this.C.pb;r=this.D.nb;q=this.D.ob;t=this.D.pb;for(var A=0,n=this.info.Da;Al&&(h=l),c.Dd=h,c=h-f,this.Oj[d]=c,f=0;fna){var ta=na*na;La=.5*(1-.16666666666666666*ta+ta*ta*.008333333333333333);Ba=1-.5*ta+ta*ta*.041666666666666664}else La=Math.sin(na)/Aa,Ba=Math.cos(na);var S,ha,ea;S=N*La;ha=X*La;ea=pa*La;var da,M,T,w;da=S;M=ha;T=ea;w=Ba;var V,ia,Y,oa,ua=C.a.o,ca=C.a.m,Ma=C.a.s,va=ua+ca+Ma,Z;0ca?ua>Ma?(Z=Math.sqrt(ua-ca-Ma+1),V=.5*Z,Z=.5/Z,ia=(C.a.f+C.a.i)*Z,Y=(C.a.h+C.a.l)*Z,oa=(C.a.g-C.a.j)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z):ca>Ma?(Z=Math.sqrt(ca-Ma-ua+1),ia=.5*Z,Z=.5/Z,V=(C.a.f+C.a.i)*Z,Y=(C.a.j+C.a.g)*Z,oa=(C.a.h-C.a.l)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z);V=w*V+da*oa+M*Y-T*ia;ia=w*ia-da*Y+M*oa+T*V;Y=w*Y+da*ia-M*V+T*oa;oa=w*oa-da*V-M*ia-T*Y;var Pa=V*V+ia*ia+Y*Y+oa*oa;1E-32jb){var cb=jb*jb;lb=.5*(1-.16666666666666666*cb+cb*cb*.008333333333333333);ob=1-.5*cb+cb*cb*.041666666666666664}else lb=Math.sin(jb)/sb,ob=Math.cos(jb);var zb,Xa,tb;zb=Da*lb;Xa=qa*lb;tb=wa*lb;var v,W,U,db;v=zb;W=Xa;U=tb;db=ob;var Qa,Ra,Ha,rb,yb=G.a.o,Cb=G.a.m,la=G.a.s,ra=yb+Cb+la,ga;0Cb?yb>la?(ga=Math.sqrt(yb-Cb-la+1),Qa=.5*ga,ga=.5/ga,Ra=(G.a.f+G.a.i)*ga,Ha=(G.a.h+G.a.l)*ga,rb=(G.a.g-G.a.j)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga):Cb>la?(ga=Math.sqrt(Cb-la-yb+1),Ra=.5*ga,ga=.5/ga,Qa=(G.a.f+G.a.i)*ga,Ha=(G.a.j+G.a.g)*ga,rb=(G.a.h-G.a.l)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga);Qa=db*Qa+v*rb+W*Ha-U*Ra;Ra=db*Ra-v*Ha+W*rb+U*Qa;Ha=db*Ha+v*Ra-W*Qa+U*rb;rb=db*rb-v*Qa-W*Ra-U*Ha;var ma=Qa*Qa+Ra*Ra+Ha*Ha+rb*rb;1E-32n*n&&(n/=Math.sqrt(z),x.Kc*=n,x.Jc*=n)):(x.Kc=0,x.Jc=0);z=x.Kc-u;D=x.Jc-F;a+=t.Ql*z;b+=t.Rl*z;e+=t.Sl*z;a+=t.Kl*D;b+=t.Ll*D;e+=t.Ml*D;d+=t.Tl*-z;c+=t.Ul*-z;f+=t.Vl*-z;d+=t.Nl*-D;c+=t.Ol*-D;f+=t.Pl*-D;h+=t.Sj*z;l+=t.Tj*z;g+=t.Uj*z;h+=t.Ek*D;l+=t.Fk*D;g+=t.Gk*D;k+=t.Vj*-z;m+=t.Wj*-z;p+=t.Xj*-z;k+=t.Hk*-D;m+=t.Ik*-D;p+=t.Jk*-D}r=0;for(q=this.info.Da;rx.dd&&(x.dd=0),n=x.dd-u,a+=t.si*n,b+=t.ti*n,e+=t.ui*n,d+=t.vi*-n,c+=t.wi*-n,f+=t.xi*-n,h+=t.sg*n,l+=t.tg*n,g+=t.ug*n,k+=t.vg*-n,m+=t.wg*-n,p+=t.xg*-n;this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},jh:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,F;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;F=this.D.$;for(var D=0,I=this.info.Da;Dx.vb&&(x.vb=0);n=x.vb-u;a+=t.si*n;b+=t.ti*n;e+=t.ui*n;d+=t.vi*-n;c+=t.wi*-n;f+=t.xi*-n;h+=t.sg*n;l+=t.tg*n;g+=t.ug*n;k+=t.vg*-n;m+=t.wg*-n;p+=t.xg*-n}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,I;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;I=this.D.$;for(var D=0,J=this.info.Da;Dta.vb&&(ta.vb=0);ea=ta.vb-da;wa+=Ba.si*ea;Da+=Ba.ti*ea;qa+=Ba.ui*ea;Ca+=Ba.vi*-ea;ya+=Ba.wi*-ea;Ka+=Ba.xi*-ea;Ea+=Ba.sg*ea;O+=Ba.tg*ea;sa+=Ba.ug*ea;ba+=Ba.vg*-ea;za+=Ba.wg*-ea;Ta+=Ba.xg*-ea}var M=this.C;M.a.v+=wa;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ca;T.a.A+=ya;T.a.B+=Ka;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Qa=w.a.m,ja=w.a.s,Ga=fa+Qa+ja,P;0Qa?fa>ja?(P=Math.sqrt(fa-Qa-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Qa>ja?(P=Math.sqrt(Qa-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Fb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Fb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Fb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Hb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Gb=la*la+ra*ra+ga*ga+ma*ma;1E-32=b)for(b=0,a=this.info.Da;bx.tb&&(F.Dd=x.tb);z=F.Dd-I;u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z);u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z)}}r=0;for(q=this.info.Da;rx.Ga&&(F.qa=x.Ga),z=F.qa-I,u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z),u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z);this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},cj:function(a){for(var b,e,d,c,f,h,l=h=f=c=d=e=b=0,g=this.info.Da;lx.Ga&&(I.vb=x.Ga);u=I.vb-z;a+=n.Kd*u;b+=n.Ld*u;e+=n.Md*u;d+=n.Nd*-u;c+=n.Od*-u;f+=n.Pd*-u;h+=n.Ed*u;l+=n.Fd*u;g+=n.Gd*u;k+=n.Hd*-u;m+=n.Id*-u;p+=n.Jd*-u}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.ga.bd();this.ga.$c(this.info);this.C=this.info.Ye;this.D=this.info.Ze;var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,n,t,x,I,u,z,J;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;n=this.D.U;t=this.D.V;x=this.D.W;I=this.D.X;u=this.D.Y;z=this.D.Z;J=this.D.$;for(var D=0,N=this.info.Da;DLa.Ga&&(ta.vb=La.Ga);ea=ta.vb-da;Ca+=Ba.Kd*ea;Da+=Ba.Ld*ea;qa+=Ba.Md*ea;Ka+=Ba.Nd*-ea;ya+=Ba.Od*-ea;Qa+=Ba.Pd*-ea;Ea+=Ba.Ed*ea;O+=Ba.Fd*ea;sa+=Ba.Gd*ea;ba+=Ba.Hd*-ea;za+=Ba.Id*-ea;Ta+=Ba.Jd*-ea}var M=this.C;M.a.v+=Ca;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ka;T.a.A+=ya;T.a.B+=Qa;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Ua=w.a.m,ja=w.a.s,Ga=fa+Ua+ja,P;0Ua?fa>ja?(P=Math.sqrt(fa-Ua-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Ua>ja?(P=Math.sqrt(Ua-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Gb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Gb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Gb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Jb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Hb=la*la+ra*ra+ga*ga+ma*ma;1E-32F.maxTranslationPerStep*F.maxTranslationPerStep&&(h=F.maxTranslationPerStep/Math.sqrt(h),this.jb*=h,this.kb*=h,this.lb*=h,b*=h,e*=h,d*=h);l>F.maxRotationPerStep*F.maxRotationPerStep&&(l=F.maxRotationPerStep/Math.sqrt(l),this.nb*=l,this.ob*=l,this.pb*=l,c*=l,f*=l,a*=l);this.a.v+=b;this.a.A+=e;this.a.B+=d;b=Math.sqrt(c*c+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));c*=b;f*=b;a*=b;b=e;e=this.a.o;d=this.a.m;var l=this.a.s,h=e+d+l,g;0d?e>l?(g=Math.sqrt(e-d-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,d=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):d>l?(g=Math.sqrt(d-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,d=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+c*e+f*d-a*l;l=b*l-c*d+f*e+a*h;d=b*d+c*l-f*h+a*e;e=b*e-c*h-f*l-a*d;a=h*h+l*l+d*d+e*e;1E-32b?(b*=b,a=.5*(1-.16666666666666666*b+b*b*.008333333333333333),b=1-.5*b+b*b*.041666666666666664):(a=Math.sin(b)/a,b=Math.cos(b));d*=a;c*=a;f*=a;a=b;var h,l;b=this.a.o;e=this.a.m;l=this.a.s;h=b+e+l;var g;0e?b>l?(g=Math.sqrt(b-e-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,e=(this.a.h+this.a.l)*g,b=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g):e>l?(g=Math.sqrt(e-l-b+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,e=(this.a.j+this.a.g)*g,b=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g);h=a*h+d*b+c*e-f*l;l=a*l-d*e+c*b+f*h;e=a*e+d*l-c*h+f*b;b=a*b-d*h-c*l-f*e;c=h*h+l*l+e*e+b*b;1E-32d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},cn:function(a){var b,e;b=a.x;e=a.y;a=a.z;this.a.v+=b;this.a.A+=e;this.a.B+=a;b=this.ja;e=this.a;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;for(b=this.Gc;null!=b;){e=b.M;var d=this.ja;a=this.a;var c=b.ja,f=b.ha,h,l,g,k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=b.a;c=b.ha;f=a.o*c.o+a.f*c.i+a.h*c.l;h=a.o*c.f+a.f*c.m+a.h*c.g;l=a.o*c.h+a.f*c.j+a.h*c.s;g=a.i*c.o+a.m*c.i+a.j*c.l;k=a.i*c.f+a.m*c.m+a.j*c.g;m=a.i*c.h+a.m*c.j+a.j*c.s;p=a.l*c.o+a.g*c.i+a.s*c.l;n=a.l*c.f+a.g*c.m+a.s*c.g;q=a.l*c.h+a.g*c.j+a.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=a.o*c.v+a.f*c.A+a.h*c.B;h=a.i*c.v+a.m*c.A+a.j*c.B;c=a.l*c.v+a.g*c.A+a.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=a.v;d.A+=a.A;d.B+=a.B;b.Fb.Lb(b.u,b.ja);a=b.u.na;d=b.u.oa;c=b.u.pa;f=b.u.ka;h=b.u.la;l=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=ab.u.ka?f:b.u.ka;b.u.la=h>b.u.la?h:b.u.la;b.u.ma=l>b.u.ma?l:b.u.ma;null!=b.ub&&(a=b.a.v-b.ja.v,d=b.a.A-b.ja.A,c=b.a.B-b.ja.B,f=b.mc,f.x=a,f.y=d,f.z=c,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}this.Bb=!1;this.wb=0},Vm:function(){var a=new I;a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s;return a},Wm:function(a){a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s},Qo:function(a){this.a.o=a.e00;this.a.f=a.e01;this.a.h=a.e02;this.a.i=a.e10;this.a.m=a.e11;this.a.j=a.e12;this.a.l=a.e20;this.a.g=a.e21;this.a.s=a.e22;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},Ro:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;a=Math.sin(b);var c=Math.sin(e),f=Math.sin(d);b=Math.cos(b);e=Math.cos(e);d=Math.cos(d);this.a.o=e*d;this.a.f=-e*f;this.a.h=c;this.a.i=b*f+d*a*c;this.a.m=b*d-a*c*f;this.a.j=-e*a;this.a.l=a*f-b*d*c;this.a.g=d*a+b*c*f;this.a.s=b*e;var h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;c=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;f=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;e=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;b=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;c=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;f=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;e=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;b=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;c=this.a;a.v=c.v;a.A=c.A;a.B=c.B;a.o=c.o;a.f=c.f;a.h=c.h;a.i=c.i;a.m=c.m;a.j=c.j;a.l=c.l;a.g=c.g;a.s=c.s;for(a=this.Gc;null!=a;){c=a.M;e=this.ja;f=this.a;d=a.ja;b=a.ha;var k,m,p,n,q,t;h=e.o*b.o+e.f*b.i+e.h*b.l;l=e.o*b.f+e.f*b.m+e.h*b.g;g=e.o*b.h+e.f*b.j+e.h*b.s;k=e.i*b.o+e.m*b.i+e.j*b.l;m=e.i*b.f+e.m*b.m+e.j*b.g;p=e.i*b.h+e.m*b.j+e.j*b.s;n=e.l*b.o+e.g*b.i+e.s*b.l;q=e.l*b.f+e.g*b.m+e.s*b.g;t=e.l*b.h+e.g*b.j+e.s*b.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=e.o*b.v+e.f*b.A+e.h*b.B;l=e.i*b.v+e.m*b.A+e.j*b.B;b=e.l*b.v+e.g*b.A+e.s*b.B;d.v=h;d.A=l;d.B=b;d.v+=e.v;d.A+=e.A;d.B+=e.B;e=a.a;d=a.ha;b=f.o*d.o+f.f*d.i+f.h*d.l;h=f.o*d.f+f.f*d.m+f.h*d.g;l=f.o*d.h+f.f*d.j+f.h*d.s;g=f.i*d.o+f.m*d.i+f.j*d.l;k=f.i*d.f+f.m*d.m+f.j*d.g;m=f.i*d.h+f.m*d.j+f.j*d.s;p=f.l*d.o+f.g*d.i+f.s*d.l;n=f.l*d.f+f.g*d.m+f.s*d.g;q=f.l*d.h+f.g*d.j+f.s*d.s;e.o=b;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=p;e.g=n;e.s=q;b=f.o*d.v+f.f*d.A+f.h*d.B;h=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;e.v=b;e.A=h;e.B=d;e.v+=f.v;e.A+=f.A;e.B+=f.B;a.Fb.Lb(a.u,a.ja);f=a.u.na;e=a.u.oa;d=a.u.pa;b=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=fa.u.ka?b:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(f=a.a.v-a.ja.v,e=a.a.A-a.ja.A,d=a.a.B-a.ja.B,b=a.mc,b.x=f,b.y=e,b.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=c}this.Bb=!1;this.wb=0},Ho:function(a){var b,e,d,c,f,h,l,g,k;b=a.e00;e=a.e01;d=a.e02;c=a.e10;f=a.e11;h=a.e12;l=a.e20;g=a.e21;k=a.e22;var m;a=b*this.a.o+e*this.a.i+d*this.a.l;m=b*this.a.f+e*this.a.m+d*this.a.g;b=b*this.a.h+e*this.a.j+d*this.a.s;e=c*this.a.o+f*this.a.i+h*this.a.l;d=c*this.a.f+f*this.a.m+h*this.a.g;c=c*this.a.h+f*this.a.j+h*this.a.s;f=l*this.a.o+g*this.a.i+k*this.a.l;h=l*this.a.f+g*this.a.m+k*this.a.g;l=l*this.a.h+g*this.a.j+k*this.a.s;this.a.o=a;this.a.f=m;this.a.h=b;this.a.i=e;this.a.m=d;this.a.j=c;this.a.l=f;this.a.g=h;this.a.s=l;l=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;a=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;m=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;k=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;c=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;f=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;h=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;l=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;a=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;m=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;k=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;c=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;f=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;h=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;l=this.ja;g=this.a;l.v=g.v;l.A=g.A;l.B=g.B;l.o=g.o;l.f=g.f;l.h=g.h;l.i=g.i;l.m=g.m;l.j=g.j;l.l=g.l;l.g=g.g;l.s=g.s;for(l=this.Gc;null!=l;){g=l.M;m=this.ja;a=this.a;k=l.ja;c=l.ha;var p,n,q,t;f=m.o*c.o+m.f*c.i+m.h*c.l;h=m.o*c.f+m.f*c.m+m.h*c.g;b=m.o*c.h+m.f*c.j+m.h*c.s;e=m.i*c.o+m.m*c.i+m.j*c.l;d=m.i*c.f+m.m*c.m+m.j*c.g;p=m.i*c.h+m.m*c.j+m.j*c.s;n=m.l*c.o+m.g*c.i+m.s*c.l;q=m.l*c.f+m.g*c.m+m.s*c.g;t=m.l*c.h+m.g*c.j+m.s*c.s;k.o=f;k.f=h;k.h=b;k.i=e;k.m=d;k.j=p;k.l=n;k.g=q;k.s=t;f=m.o*c.v+m.f*c.A+m.h*c.B;h=m.i*c.v+m.m*c.A+m.j*c.B;c=m.l*c.v+m.g*c.A+m.s*c.B;k.v=f;k.A=h;k.B=c;k.v+=m.v;k.A+=m.A;k.B+=m.B;m=l.a;k=l.ha;c=a.o*k.o+a.f*k.i+a.h*k.l;f=a.o*k.f+a.f*k.m+a.h*k.g;h=a.o*k.h+a.f*k.j+a.h*k.s;b=a.i*k.o+a.m*k.i+a.j*k.l;e=a.i*k.f+a.m*k.m+a.j*k.g;d=a.i*k.h+a.m*k.j+a.j*k.s;p=a.l*k.o+a.g*k.i+a.s*k.l;n=a.l*k.f+a.g*k.m+a.s*k.g;q=a.l*k.h+a.g*k.j+a.s*k.s;m.o=c;m.f=f;m.h=h;m.i=b;m.m=e;m.j=d;m.l=p;m.g=n;m.s=q;c=a.o*k.v+a.f*k.A+a.h*k.B;f=a.i*k.v+a.m*k.A+a.j*k.B;k=a.l*k.v+a.g*k.A+a.s*k.B;m.v=c;m.A=f;m.B=k;m.v+=a.v;m.A+=a.A;m.B+=a.B;l.Fb.Lb(l.u,l.ja);a=l.u.na;m=l.u.oa;k=l.u.pa;c=l.u.ka;f=l.u.la;h=l.u.ma;l.Fb.Lb(l.u,l.a);l.u.na=al.u.ka?c:l.u.ka;l.u.la=f>l.u.la?f:l.u.la;l.u.ma=h>l.u.ma?h:l.u.ma;null!=l.ub&&(a=l.a.v-l.ja.v,m=l.a.A-l.ja.A,k=l.a.B-l.ja.B,c=l.mc,c.x=a,c.y=m,c.z=k,l.Vb.jc.hc.Qd(l.ub,l.u,l.mc));l=g}this.Bb=!1;this.wb=0},Mo:function(a){var b,e,d,c,f,h,l;b=a.x;e=a.y;a=a.z;h=Math.sin(b);var g=Math.sin(e),k=Math.sin(a),m=Math.cos(b);l=Math.cos(e);var p=Math.cos(a);d=l*p;c=-l*k;a=m*k+p*h*g;b=m*p-h*g*k;f=-l*h;e=h*k-m*p*g;h=p*h+m*g*k;l*=m;k=d*this.a.o+c*this.a.i+g*this.a.l;m=d*this.a.f+c*this.a.m+g*this.a.g;g=d*this.a.h+c*this.a.j+g*this.a.s;d=a*this.a.o+b*this.a.i+f*this.a.l;c=a*this.a.f+b*this.a.m+f*this.a.g;a=a*this.a.h+b*this.a.j+f*this.a.s;b=e*this.a.o+h*this.a.i+l*this.a.l;f=e*this.a.f+h*this.a.m+l*this.a.g;e=e*this.a.h+h*this.a.j+l*this.a.s;this.a.o=k;this.a.f=m;this.a.h=g;this.a.i=d;this.a.m=c;this.a.j=a;this.a.l=b;this.a.g=f;this.a.s=e;e=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;a=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;b=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;f=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;h=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;g=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;k=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;m=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;l=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;e=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;a=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;b=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;f=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;h=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;g=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;k=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;m=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;l=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;e=this.ja;a=this.a;e.v=a.v;e.A=a.A;e.B=a.B;e.o=a.o;e.f=a.f;e.h=a.h;e.i=a.i;e.m=a.m;e.j=a.j;e.l=a.l;e.g=a.g;e.s=a.s;for(e=this.Gc;null!=e;){a=e.M;f=this.ja;b=this.a;h=e.ja;var g=e.ha,n,q,t,k=f.o*g.o+f.f*g.i+f.h*g.l,m=f.o*g.f+f.f*g.m+f.h*g.g;l=f.o*g.h+f.f*g.j+f.h*g.s;d=f.i*g.o+f.m*g.i+f.j*g.l;c=f.i*g.f+f.m*g.m+f.j*g.g;p=f.i*g.h+f.m*g.j+f.j*g.s;n=f.l*g.o+f.g*g.i+f.s*g.l;q=f.l*g.f+f.g*g.m+f.s*g.g;t=f.l*g.h+f.g*g.j+f.s*g.s;h.o=k;h.f=m;h.h=l;h.i=d;h.m=c;h.j=p;h.l=n;h.g=q;h.s=t;k=f.o*g.v+f.f*g.A+f.h*g.B;m=f.i*g.v+f.m*g.A+f.j*g.B;g=f.l*g.v+f.g*g.A+f.s*g.B;h.v=k;h.A=m;h.B=g;h.v+=f.v;h.A+=f.A;h.B+=f.B;f=e.a;h=e.ha;g=b.o*h.o+b.f*h.i+b.h*h.l;k=b.o*h.f+b.f*h.m+b.h*h.g;m=b.o*h.h+b.f*h.j+b.h*h.s;l=b.i*h.o+b.m*h.i+b.j*h.l;d=b.i*h.f+b.m*h.m+b.j*h.g;c=b.i*h.h+b.m*h.j+b.j*h.s;p=b.l*h.o+b.g*h.i+b.s*h.l;n=b.l*h.f+b.g*h.m+b.s*h.g;q=b.l*h.h+b.g*h.j+b.s*h.s;f.o=g;f.f=k;f.h=m;f.i=l;f.m=d;f.j=c;f.l=p;f.g=n;f.s=q;g=b.o*h.v+b.f*h.A+b.h*h.B;k=b.i*h.v+b.m*h.A+b.j*h.B;h=b.l*h.v+b.g*h.A+b.s*h.B;f.v=g;f.A=k;f.B=h;f.v+=b.v;f.A+=b.A;f.B+=b.B;e.Fb.Lb(e.u,e.ja);b=e.u.na;f=e.u.oa;h=e.u.pa;g=e.u.ka;k=e.u.la;m=e.u.ma;e.Fb.Lb(e.u,e.a);e.u.na=be.u.ka?g:e.u.ka;e.u.la=k>e.u.la?k:e.u.la;e.u.ma=m>e.u.ma?m:e.u.ma;null!=e.ub&&(b=e.a.v-e.ja.v,f=e.a.A-e.ja.A,h=e.a.B-e.ja.B,g=e.mc,g.x=b,g.y=f,g.z=h,e.Vb.jc.hc.Qd(e.ub,e.u,e.mc));e=a}this.Bb=!1;this.wb=0},Mm:function(){var a=new wa,b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},Nm:function(a){var b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},No:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.a.o=1-g-d;this.a.f=k-c;this.a.h=b+h;this.a.i=k+c;this.a.m=1-a-d;this.a.j=e-f;this.a.l=b-h;this.a.g=e+f;this.a.s=1-a-g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;l=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;k=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;e=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;c=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;l=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;k=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;e=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;g=this.a;a.v=g.v;a.A=g.A;a.B=g.B;a.o=g.o;a.f=g.f;a.h=g.h;a.i=g.i;a.m=g.m;a.j=g.j;a.l=g.l;a.g=g.g;a.s=g.s;for(a=this.Gc;null!=a;){g=a.M;l=this.ja;c=this.a;d=a.ja;var k=a.ha,m,p,n,q,t,h=l.o*k.o+l.f*k.i+l.h*k.l;e=l.o*k.f+l.f*k.m+l.h*k.g;b=l.o*k.h+l.f*k.j+l.h*k.s;f=l.i*k.o+l.m*k.i+l.j*k.l;m=l.i*k.f+l.m*k.m+l.j*k.g;p=l.i*k.h+l.m*k.j+l.j*k.s;n=l.l*k.o+l.g*k.i+l.s*k.l;q=l.l*k.f+l.g*k.m+l.s*k.g;t=l.l*k.h+l.g*k.j+l.s*k.s;d.o=h;d.f=e;d.h=b;d.i=f;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=l.o*k.v+l.f*k.A+l.h*k.B;e=l.i*k.v+l.m*k.A+l.j*k.B;k=l.l*k.v+l.g*k.A+l.s*k.B;d.v=h;d.A=e;d.B=k;d.v+=l.v;d.A+=l.A;d.B+=l.B;l=a.a;d=a.ha;k=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;e=c.o*d.h+c.f*d.j+c.h*d.s;b=c.i*d.o+c.m*d.i+c.j*d.l;f=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;p=c.l*d.o+c.g*d.i+c.s*d.l;n=c.l*d.f+c.g*d.m+c.s*d.g;q=c.l*d.h+c.g*d.j+c.s*d.s;l.o=k;l.f=h;l.h=e;l.i=b;l.m=f;l.j=m;l.l=p;l.g=n;l.s=q;k=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;l.v=k;l.A=h;l.B=d;l.v+=c.v;l.A+=c.A;l.B+=c.B;a.Fb.Lb(a.u,a.ja);c=a.u.na;l=a.u.oa;d=a.u.pa;k=a.u.ka;h=a.u.la;e=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ca.u.ka?k:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=e>a.u.ma?e:a.u.ma;null!=a.ub&&(c=a.a.v-a.ja.v,l=a.a.A-a.ja.A,d=a.a.B-a.ja.B,k=a.mc,k.x=c,k.y=l,k.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=g}this.Bb=!1;this.wb=0},Xm:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Ym:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},So:function(a){this.a.v=a.v;this.a.A=a.A;this.a.B=a.B;this.a.o=a.o;this.a.f=a.f;this.a.h=a.h;this.a.i=a.i;this.a.m=a.m;this.a.j=a.j;this.a.l=a.l;this.a.g=a.g;this.a.s=a.s;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},ph:function(){return this.Lf},cf:function(){var a=new I;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae;return a},gg:function(a){a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},Di:function(){var a=new fj;a.mass=this.Lf;var b=a.localInertia;b.e00=this.Td;b.e01=this.Ud;b.e02=this.Vd;b.e10=this.Wd;b.e11=this.Xd;b.e12=this.Yd;b.e20=this.Zd;b.e21=this.$d;b.e22=this.ae;return a},Ei:function(a){a.mass=this.Lf;a=a.localInertia;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},ln:function(a){this.Lf=a.mass;a=a.localInertia;this.Td=a.e00;this.Ud=a.e01;this.Vd=a.e02;this.Wd=a.e10;this.Xd=a.e11;this.Yd=a.e12;this.Zd=a.e20;this.$d=a.e21;this.ae=a.e22;if(0d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},dn:function(a){var b=a.ia,e=a.M;null!=b&&(b.M=e);null!=e&&(e.ia=b);a==this.Gc&&(this.Gc=this.Gc.M);a==this.Yi&&(this.Yi=this.Yi.ia);a.M=null;a.ia=null;this.Rg--;a.Vb=null;if(null!=this.jc){b=this.jc;b.hc.oi(a.ub);a.ub=null;a.Ic=-1;for(var d=a.Vb.Mb;null!=d;){var e=d.M,c=d.me;if(c.Ec==a||c.Fc==a){d=d.ad;d.Bb=!1;d.wb=0;var d=b.Hi,f=c.ia,h=c.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c==d.je&&(d.je=d.je.M);c==d.Le&&(d.Le=d.Le.ia);c.M=null;c.ia=null;f=c.rb.ia;h=c.rb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.rb==c.C.Mb&&(c.C.Mb=c.C.Mb.M);c.rb==c.C.ic&&(c.C.ic=c.C.ic.ia);c.rb.M=null;c.rb.ia=null;f=c.sb.ia;h=c.sb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.sb==c.D.Mb&&(c.D.Mb=c.D.Mb.M);c.sb==c.D.ic&&(c.D.ic=c.D.ic.ia);c.sb.M=null;c.sb.ia=null;c.C.Ne--;c.D.Ne--;c.rb.ad=null;c.sb.ad=null;c.rb.me=null;c.sb.me=null;c.Ec=null;c.Fc=null;c.C=null;c.D=null;c.Hh=!1;c.pj.df();c.Ia.df();c.$h=null;f=c.ef;f.Ec=null;f.Fc=null;f.C=null;f.D=null;f.Ej=null;f.Fj=null;c.M=d.Cg;d.Cg=c;d.Ui--}d=e}b.Rg--}this.ck();for(a=this.Gc;null!=a;){var b=a.M,c=this.ja,e=this.a,d=a.ja,f=a.ha,l,g,k,m,n,r,q,t,h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;c=a.a;d=a.ha;f=e.o*d.o+e.f*d.i+e.h*d.l;h=e.o*d.f+e.f*d.m+e.h*d.g;l=e.o*d.h+e.f*d.j+e.h*d.s;g=e.i*d.o+e.m*d.i+e.j*d.l;k=e.i*d.f+e.m*d.m+e.j*d.g;m=e.i*d.h+e.m*d.j+e.j*d.s;n=e.l*d.o+e.g*d.i+e.s*d.l;r=e.l*d.f+e.g*d.m+e.s*d.g;q=e.l*d.h+e.g*d.j+e.s*d.s;c.o=f;c.f=h;c.h=l;c.i=g;c.m=k;c.j=m;c.l=n;c.g=r;c.s=q;f=e.o*d.v+e.f*d.A+e.h*d.B;h=e.i*d.v+e.m*d.A+e.j*d.B;d=e.l*d.v+e.g*d.A+e.s*d.B;c.v=f;c.A=h;c.B=d;c.v+=e.v;c.A+=e.A;c.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;c=a.u.oa;d=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,c=a.a.A-a.ja.A,d=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=c,f.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},Eo:function(){return this.Jb},nn:function(a){this.Jb=a;this.ck()},pn:function(){this.Bb=!1;this.wb=0},on:function(){this.Bb=!0;this.wb=0},Dm:function(){return this.Bb},tm:function(){return this.wb},gn:function(a){this.Tk=a;this.Bb=!1;this.wb=0},Je:function(){return this.sk},jn:function(a){this.sk=a},Vc:function(){return this.hk},en:function(a){this.hk=a},Um:function(){return this.ia},Im:function(){return this.M}};Ka.prototype={wc:function(){return this.pk},Ke:function(a){this.pk=a},Uc:function(){return this.Ak},cf:function(a){this.Ak=a},Dc:function(){var a=this.ha,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Hc:function(a){var b=this.ha;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},ie:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Fe:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},bf:function(a){var b=this.ha;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;if(null!=this.Vb)for(a=this.Vb,a.ck(),b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}},lc:function(){return this.Vk},Je:function(a){this.Vk=a;if(null!=this.Vb){a=this.Vb;a.ck();for(var b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}}},wa:function(){return this.u.clone()},mb:function(a){a.qe(this.u)},xc:function(){return this.Fb},Vc:function(){return this.Vb},Cb:function(){return this.kk},Ge:function(a){this.kk=a},Kb:function(){return this.lk},He:function(a){this.lk=a},kc:function(){return this.im},Ie:function(a){this.im=a},vd:function(){return this.ia},Wc:function(){return this.M}};pi.gg=1;pi.hg=2;pi.BRUTE_FORCE=1;pi.BVH=2;bc.Pm=0;bc.cf=1;bc.Ei=2;bc.jg=3;bc.ig=4;bc.kg=5;bc.Di=0;bc.ph=5;bc.SPHERE=0;bc.BOX=1;bc.CYLINDER=2;bc.CONE=3;bc.CAPSULE=4;bc.CONVEX_HULL=5;ni.Ie=1;Ee.Kb=0;n.numCreations=0;F.defaultFriction=.2;F.defaultRestitution=.2;F.defaultDensity=1;F.defaultCollisionGroup=1;F.defaultCollisionMask=1;F.maxTranslationPerStep=20;F.maxRotationPerStep=3.14159265358979;F.bvhProxyPadding=.1;F.bvhIncrementalCollisionThreshold=.45;F.defaultGJKMargin=.05;F.enableGJKCaching=!0;F.maxEPAVertices=128;F.maxEPAPolyhedronFaces=128;F.contactEnableBounceThreshold=.5;F.velocityBaumgarte=.2;F.positionSplitImpulseBaumgarte=.4;F.positionNgsBaumgarte=1;F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;F.defaultContactPositionCorrectionAlgorithm=0;F.alternativeContactPositionCorrectionAlgorithm=1;F.contactPersistenceThreshold=.05;F.maxManifoldPoints=4;F.defaultJointConstraintSolverType=0;F.defaultJointPositionCorrectionAlgorithm=0;F.jointWarmStartingFactorForBaungarte=.8;F.jointWarmStartingFactor=.95;F.minSpringDamperDampingRatio=1E-6;F.minRagdollMaxSwingAngle=1E-6;F.maxJacobianRows=6;F.directMlcpSolverEps=1E-9;F.islandInitialRigidBodyArraySize=128;F.islandInitialConstraintArraySize=128;F.sleepingVelocityThreshold=.2;F.sleepingAngularVelocityThreshold=.5;F.sleepingTimeThreshold=1;F.disableSleeping=!1;F.linearSlop=.005;F.angularSlop=.017453292519943278;lb.mb=new lb;dc.Xm=0;dc.Bm=1;dc.Am=2;dc.um=257;dc.tm=258;dc.sm=259;dc.SUCCEEDED=0;dc.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;dc.GJK_DID_NOT_CONVERGE=2;dc.EPA_FAILED_TO_INIT=257;dc.EPA_FAILED_TO_ADD_VERTEX=258;dc.EPA_DID_NOT_CONVERGE=259;I.numCreations=0;J.numCreations=0;pa.POSITIVE_INFINITY=Infinity;pa.NEGATIVE_INFINITY=-Infinity;pa.PI=3.14159265358979;pa.TWO_PI=6.28318530717958;pa.HALF_PI=1.570796326794895;pa.TO_RADIANS=.017453292519943278;pa.TO_DEGREES=57.29577951308238;wa.numCreations=0;Mg.Je=8;Mg.Ke=4;Mg.He=8;Ce.broadPhaseCollisionTime=0;Ce.narrowPhaseCollisionTime=0;Ce.dynamicsTime=0;Ce.totalTime=0;jc.bf=0;jc.Vm=1;jc.Jm=2;jc.BAUMGARTE=0;jc.SPLIT_IMPULSE=1;jc.NGS=2;gf.Ge=1;gf.Fe=2;Mb.Um=0;Mb.Om=1;Mb.Fi=2;Mb.Mm=3;Mb.Ym=4;Mb.Nm=5;Mb.ym=6;Mb.SPHERICAL=0;Mb.REVOLUTE=1;Mb.CYLINDRICAL=2;Mb.PRISMATIC=3;Mb.UNIVERSAL=4;Mb.RAGDOLL=5;Mb.GENERIC=6;vf.Dm=0;vf.gk=1;vf.ITERATIVE=0;vf.DIRECT=1;Qe.fm=0;Qe.Wm=1;Qe.Im=2;Qe.DYNAMIC=0;Qe.STATIC=1;Qe.KINEMATIC=2;Ij.lc()})({}); diff --git a/bin/js/externs.js b/bin/js/externs.js index 61d7a2c..b31cb12 100644 --- a/bin/js/externs.js +++ b/bin/js/externs.js @@ -1,4 +1,4 @@ -// externs for closure compiler +// externs for Closure Compiler OIMO.DebugDraw.wireframe; OIMO.DebugDraw.drawShapes; OIMO.DebugDraw.drawBvh; @@ -202,12 +202,19 @@ OIMO.CylindricalJointConfig.translationalLimitMotor; OIMO.CylindricalJointConfig.translationalSpringDamper; OIMO.CylindricalJointConfig.rotationalLimitMotor; OIMO.CylindricalJointConfig.rotationalSpringDamper; +OIMO.GenericJointConfig.localBasis1; +OIMO.GenericJointConfig.localBasis2; +OIMO.GenericJointConfig.translationalLimitMotors; +OIMO.GenericJointConfig.translationalSpringDampers; +OIMO.GenericJointConfig.rotationalLimitMotors; +OIMO.GenericJointConfig.rotationalSpringDampers; OIMO.JointType.SPHERICAL; OIMO.JointType.REVOLUTE; OIMO.JointType.CYLINDRICAL; OIMO.JointType.PRISMATIC; OIMO.JointType.UNIVERSAL; OIMO.JointType.RAGDOLL; +OIMO.JointType.GENERIC; OIMO.PrismaticJointConfig.localAxis1; OIMO.PrismaticJointConfig.localAxis2; OIMO.PrismaticJointConfig.limitMotor; diff --git a/build-doc.hxml b/build-doc.hxml new file mode 100644 index 0000000..82ca62f --- /dev/null +++ b/build-doc.hxml @@ -0,0 +1,7 @@ +-cp src +-cp exports/src +-D analyzer-optimize +-main export.Export +--interp +-xml docs/doc.xml +-cmd haxelib run dox -i docs/doc.xml -o docs -in "oimo.(collision|common|dynamics)" -ex "oimo.dynamics.constraint.(info|solver.common)" --title "OimoPhysics API documentation" -D website https://github.com/saharan/OimoPhysics -D source-path https://github.com/saharan/OimoPhysics/tree/master/src/ -D description "OimoPhysics API Documentation" -D version 1.2.1 diff --git a/build-js-demos.hxml b/build-js-demos.hxml new file mode 100644 index 0000000..c4ac9b1 --- /dev/null +++ b/build-js-demos.hxml @@ -0,0 +1,5 @@ +-cp src +-cp demos/src +-D analyzer-optimize +-main demo.js.DemoJS +-js demos/bin/js/demos.js diff --git a/build-js.hxml b/build-js.hxml new file mode 100644 index 0000000..14344ff --- /dev/null +++ b/build-js.hxml @@ -0,0 +1,5 @@ +-cp src +-cp exports/src +-D analyzer-optimize +-main export.js.Export +-js bin/js/OimoPhysics.js diff --git a/demos/bin/js/demos.js b/demos/bin/js/demos.js new file mode 100644 index 0000000..b23784e --- /dev/null +++ b/demos/bin/js/demos.js @@ -0,0 +1,45972 @@ +// Generated by Haxe 4.0.5 +(function ($global) { "use strict"; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.iter = function(a) { + return { cur : 0, arr : a, hasNext : function() { + return this.cur < this.arr.length; + }, next : function() { + return this.arr[this.cur++]; + }}; +}; +Math.__name__ = true; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +var demo_common_Control = function(keyText,description,keyCode,onAction) { + this.keyText = keyText; + this.description = description; + this.keyCode = keyCode; + this.onAction = onAction; +}; +demo_common_Control.__name__ = true; +demo_common_Control.prototype = { + __class__: demo_common_Control +}; +var demo_common_DemoBase = function(demoName) { + this.demoName = demoName; + this.count = 0; +}; +demo_common_DemoBase.__name__ = true; +demo_common_DemoBase.prototype = { + initControls: function(controls) { + } + ,init: function(world,renderer,input,viewInfo) { + this.world = world; + this.renderer = renderer; + this.input = input; + this.viewInfo = viewInfo; + var eye_x = 0; + var eye_y = 5; + var eye_z = 10; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 0; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + var rigidBodyConfig = new oimo_dynamics_rigidbody_RigidBodyConfig(); + rigidBodyConfig.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; + this.mouseJointDummyBody = new oimo_dynamics_rigidbody_RigidBody(rigidBodyConfig); + this.mouseJoint = null; + this.dt = 0.016666666666666666; + } + ,teleportRigidBodies: function(thresholdY,toY,rangeX,rangeZ) { + var rb = this.world._rigidBodyList; + var v_x = 0; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + var v_x1 = 0; + var v_y1 = 0; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + while(rb != null) { + v_x = rb._transform._positionX; + v_y = rb._transform._positionY; + v_z = rb._transform._positionZ; + if(v_y < thresholdY) { + v_y = toY; + v_x = (-1 + Math.random() * 2) * rangeX; + v_z = (-1 + Math.random() * 2) * rangeZ; + rb._transform._positionX = v_x; + rb._transform._positionY = toY; + rb._transform._positionZ = v_z; + var dst = rb._ptransform; + var src = rb._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = rb._shapeList; + while(s != null) { + var n = s._next; + var tf1 = rb._ptransform; + var tf2 = rb._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + rb._sleeping = false; + rb._sleepTime = 0; + if(rb._type == 1) { + rb._velX = 0; + rb._velY = 0; + rb._velZ = 0; + } else { + rb._velX = v_x1; + rb._velY = v_y1; + rb._velZ = v_z1; + } + rb._sleeping = false; + rb._sleepTime = 0; + } + rb = rb._next; + } + } + ,update: function() { + this.count++; + this.updateMouseJoint(); + } + ,drawAdditionalObjects: function(debugDraw) { + } + ,updateMouseJoint: function() { + var _this = this.renderer; + var cameraPos = new oimo_common_Vec3(-(_this.viewMat.e00 * _this.viewMat.e03 + _this.viewMat.e10 * _this.viewMat.e13 + _this.viewMat.e20 * _this.viewMat.e23),-(_this.viewMat.e01 * _this.viewMat.e03 + _this.viewMat.e11 * _this.viewMat.e13 + _this.viewMat.e21 * _this.viewMat.e23),-(_this.viewMat.e02 * _this.viewMat.e03 + _this.viewMat.e12 * _this.viewMat.e13 + _this.viewMat.e22 * _this.viewMat.e23)); + var x = (this.input.mouseX / this.viewInfo.width - 0.5) * this.viewInfo.screenWidth; + var y = (0.5 - this.input.mouseY / this.viewInfo.height) * this.viewInfo.screenHeight; + var z = -this.viewInfo.screenDistance; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + var _this_x = x; + var _this_y = y; + var _this_z = z; + oimo_common_Vec3.numCreations++; + var _this1 = this.renderer.viewMat; + var e00 = _this1.e00; + var e01 = _this1.e01; + var e02 = _this1.e02; + var e03 = _this1.e03; + var e10 = _this1.e10; + var e11 = _this1.e11; + var e12 = _this1.e12; + var e13 = _this1.e13; + var e20 = _this1.e20; + var e21 = _this1.e21; + var e22 = _this1.e22; + var e23 = _this1.e23; + var e30 = _this1.e30; + var e31 = _this1.e31; + var e32 = _this1.e32; + var e33 = _this1.e33; + if(e33 == null) { + e33 = 1; + } + if(e32 == null) { + e32 = 0; + } + if(e31 == null) { + e31 = 0; + } + if(e30 == null) { + e30 = 0; + } + if(e23 == null) { + e23 = 0; + } + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e13 == null) { + e13 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e03 == null) { + e03 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + var viewMat_e00 = e00; + var viewMat_e01 = e01; + var viewMat_e02 = e02; + var viewMat_e03 = e03; + var viewMat_e10 = e10; + var viewMat_e11 = e11; + var viewMat_e12 = e12; + var viewMat_e13 = e13; + var viewMat_e20 = e20; + var viewMat_e21 = e21; + var viewMat_e22 = e22; + var viewMat_e23 = e23; + var viewMat_e30 = e30; + var viewMat_e31 = e31; + var viewMat_e32 = e32; + oimo_common_Mat4.numCreations++; + var e001 = viewMat_e00; + var e011 = viewMat_e10; + var e021 = viewMat_e20; + var e101 = viewMat_e01; + var e111 = viewMat_e11; + var e121 = viewMat_e21; + var e201 = viewMat_e02; + var e211 = viewMat_e12; + var e221 = viewMat_e22; + var e301 = viewMat_e03; + var e311 = viewMat_e13; + var e321 = viewMat_e23; + viewMat_e00 = e001; + viewMat_e01 = e011; + viewMat_e02 = e021; + viewMat_e03 = viewMat_e30; + viewMat_e10 = e101; + viewMat_e11 = e111; + viewMat_e12 = e121; + viewMat_e13 = viewMat_e31; + viewMat_e20 = e201; + viewMat_e21 = e211; + viewMat_e22 = e221; + viewMat_e23 = viewMat_e32; + viewMat_e30 = e301; + viewMat_e31 = e311; + viewMat_e32 = e321; + viewMat_e03 = 0; + viewMat_e13 = 0; + viewMat_e23 = 0; + var x1 = _this_x * e001 + _this_y * e011 + _this_z * e021 + viewMat_e03; + var y1 = _this_x * e101 + _this_y * e111 + _this_z * e121 + viewMat_e13; + var z1 = _this_x * e201 + _this_y * e211 + _this_z * e221 + viewMat_e23; + _this_x = x1; + _this_y = y1; + _this_z = z1; + var invLen = Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1); + if(invLen > 0) { + invLen = 1 / invLen; + } + var x2 = x1 * invLen; + var y2 = y1 * invLen; + var z2 = z1 * invLen; + _this_x = x2; + _this_y = y2; + _this_z = z2; + if(this.mouseJoint != null) { + if(this.input.mouseL) { + var _this2 = this.mouseJointDummyBody; + var s = this.grabbingDistance; + var x3 = x2 * s; + var y3 = y2 * s; + var z3 = z2 * s; + if(z3 == null) { + z3 = 0; + } + if(y3 == null) { + y3 = 0; + } + if(x3 == null) { + x3 = 0; + } + oimo_common_Vec3.numCreations++; + var x4 = cameraPos.x + x3; + var y4 = cameraPos.y + y3; + var z4 = cameraPos.z + z3; + if(z4 == null) { + z4 = 0; + } + if(y4 == null) { + y4 = 0; + } + if(x4 == null) { + x4 = 0; + } + oimo_common_Vec3.numCreations++; + _this2._transform._positionX = x4; + _this2._transform._positionY = y4; + _this2._transform._positionZ = z4; + var dst = _this2._ptransform; + var src = _this2._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s1 = _this2._shapeList; + while(s1 != null) { + var n = s1._next; + var tf1 = _this2._ptransform; + var tf2 = _this2._transform; + var dst1 = s1._ptransform; + var src1 = s1._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s1._transform; + var src11 = s1._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s1._geom._computeAabb(s1._aabb,s1._ptransform); + minX = s1._aabb._minX; + minY = s1._aabb._minY; + minZ = s1._aabb._minZ; + maxX = s1._aabb._maxX; + maxY = s1._aabb._maxY; + maxZ = s1._aabb._maxZ; + s1._geom._computeAabb(s1._aabb,s1._transform); + s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; + s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; + s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; + s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; + s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; + s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; + if(s1._proxy != null) { + var dX; + var dY; + var dZ; + dX = s1._transform._positionX - s1._ptransform._positionX; + dY = s1._transform._positionY - s1._ptransform._positionY; + dZ = s1._transform._positionZ - s1._ptransform._positionZ; + var v = s1.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + } + s1 = n; + } + _this2._sleeping = false; + _this2._sleepTime = 0; + var _this3 = this.mouseJoint._b1; + _this3._sleeping = false; + _this3._sleepTime = 0; + var _this4 = this.mouseJoint._b2; + _this4._sleeping = false; + _this4._sleepTime = 0; + } else { + this.world.removeJoint(this.mouseJoint); + this.mouseJoint = null; + } + } else if(this.input.mouseL && !this.input.pmouseL) { + var x5 = x2 * 500; + var y5 = y2 * 500; + var z5 = z2 * 500; + if(z5 == null) { + z5 = 0; + } + if(y5 == null) { + y5 = 0; + } + if(x5 == null) { + x5 = 0; + } + oimo_common_Vec3.numCreations++; + var end = new oimo_common_Vec3(cameraPos.x + x5,cameraPos.y + y5,cameraPos.z + z5); + var closest = new oimo_dynamics_callback_RayCastClosest(); + this.world.rayCast(cameraPos,end,closest); + if(!closest.hit) { + return; + } + var body = closest.shape._rigidBody; + var position = closest.position; + if(body == null || body._type != oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC) { + return; + } + var jc = new oimo_dynamics_constraint_joint_SphericalJointConfig(); + jc.springDamper.frequency = 4.0; + jc.springDamper.dampingRatio = 1; + jc.rigidBody1 = body; + jc.rigidBody2 = this.mouseJointDummyBody; + jc.allowCollision = false; + var v_x = 0; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + v_x = body._transform._positionX; + v_y = body._transform._positionY; + v_z = body._transform._positionZ; + jc.localAnchor1 = new oimo_common_Vec3(position.x - v_x,position.y - v_y,position.z - v_z); + var _this5 = jc.localAnchor1; + var m_e00 = 1; + var m_e01 = 0; + var m_e02 = 0; + var m_e10 = 0; + var m_e11 = 1; + var m_e12 = 0; + var m_e20 = 0; + var m_e21 = 0; + var m_e22 = 1; + oimo_common_Mat3.numCreations++; + m_e00 = body._transform._rotation00; + m_e01 = body._transform._rotation01; + m_e02 = body._transform._rotation02; + m_e10 = body._transform._rotation10; + m_e11 = body._transform._rotation11; + m_e12 = body._transform._rotation12; + m_e20 = body._transform._rotation20; + m_e21 = body._transform._rotation21; + m_e22 = body._transform._rotation22; + var e002 = m_e00; + var e012 = m_e10; + var e022 = m_e20; + var e102 = m_e01; + var e112 = m_e11; + var e122 = m_e21; + var e202 = m_e02; + var e212 = m_e12; + var e222 = m_e22; + m_e00 = e002; + m_e01 = e012; + m_e02 = e022; + m_e10 = e102; + m_e11 = e112; + m_e12 = e122; + m_e20 = e202; + m_e21 = e212; + m_e22 = e222; + var y6 = _this5.x * e102 + _this5.y * e112 + _this5.z * e122; + var z6 = _this5.x * e202 + _this5.y * e212 + _this5.z * e222; + _this5.x = _this5.x * e002 + _this5.y * e012 + _this5.z * e022; + _this5.y = y6; + _this5.z = z6; + jc.localAnchor2.zero(); + var _this6 = this.mouseJointDummyBody; + _this6._transform._positionX = position.x; + _this6._transform._positionY = position.y; + _this6._transform._positionZ = position.z; + var dst3 = _this6._ptransform; + var src2 = _this6._transform; + dst3._positionX = src2._positionX; + dst3._positionY = src2._positionY; + dst3._positionZ = src2._positionZ; + dst3._rotation00 = src2._rotation00; + dst3._rotation01 = src2._rotation01; + dst3._rotation02 = src2._rotation02; + dst3._rotation10 = src2._rotation10; + dst3._rotation11 = src2._rotation11; + dst3._rotation12 = src2._rotation12; + dst3._rotation20 = src2._rotation20; + dst3._rotation21 = src2._rotation21; + dst3._rotation22 = src2._rotation22; + var s2 = _this6._shapeList; + while(s2 != null) { + var n1 = s2._next; + var tf11 = _this6._ptransform; + var tf21 = _this6._transform; + var dst4 = s2._ptransform; + var src12 = s2._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__012 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__022 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__102 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__112 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__122 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__202 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__212 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__222 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst4._rotation00 = __tmp__002; + dst4._rotation01 = __tmp__012; + dst4._rotation02 = __tmp__022; + dst4._rotation10 = __tmp__102; + dst4._rotation11 = __tmp__112; + dst4._rotation12 = __tmp__122; + dst4._rotation20 = __tmp__202; + dst4._rotation21 = __tmp__212; + dst4._rotation22 = __tmp__222; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst4._positionX = __tmp__X2; + dst4._positionY = __tmp__Y2; + dst4._positionZ = __tmp__Z2; + dst4._positionX += tf11._positionX; + dst4._positionY += tf11._positionY; + dst4._positionZ += tf11._positionZ; + var dst5 = s2._transform; + var src13 = s2._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__013 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__023 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__103 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__113 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__123 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__203 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__213 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__223 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst5._rotation00 = __tmp__003; + dst5._rotation01 = __tmp__013; + dst5._rotation02 = __tmp__023; + dst5._rotation10 = __tmp__103; + dst5._rotation11 = __tmp__113; + dst5._rotation12 = __tmp__123; + dst5._rotation20 = __tmp__203; + dst5._rotation21 = __tmp__213; + dst5._rotation22 = __tmp__223; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst5._positionX = __tmp__X3; + dst5._positionY = __tmp__Y3; + dst5._positionZ = __tmp__Z3; + dst5._positionX += tf21._positionX; + dst5._positionY += tf21._positionY; + dst5._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX1 = s2._aabb._minX; + minY1 = s2._aabb._minY; + minZ1 = s2._aabb._minZ; + maxX1 = s2._aabb._maxX; + maxY1 = s2._aabb._maxY; + maxZ1 = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; + s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; + s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; + s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; + s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; + s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s2._transform._positionX - s2._ptransform._positionX; + dY1 = s2._transform._positionY - s2._ptransform._positionY; + dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; + var v1 = s2.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n1; + } + _this6._sleeping = false; + _this6._sleepTime = 0; + this.mouseJoint = new oimo_dynamics_constraint_joint_SphericalJoint(jc); + this.world.addJoint(this.mouseJoint); + var x6 = position.x - cameraPos.x; + var y7 = position.y - cameraPos.y; + var z7 = position.z - cameraPos.z; + if(z7 == null) { + z7 = 0; + } + if(y7 == null) { + y7 = 0; + } + if(x6 == null) { + x6 = 0; + } + var _this_x1 = x6; + var _this_y1 = y7; + var _this_z1 = z7; + oimo_common_Vec3.numCreations++; + this.grabbingDistance = Math.sqrt(_this_x1 * _this_x1 + _this_y1 * _this_y1 + _this_z1 * _this_z1); + } + } + ,draw: function() { + this.renderer.draw(this); + } + ,additionalInfo: function() { + return ""; + } + ,__class__: demo_common_DemoBase +}; +var demo_common_DemoMain = function(width,height) { + this.width = width; + this.height = height; + this.input = new demo_common_UserInput(); + this.viewInfo = new demo_common_ViewInfo(); + this.nmouseX = 0; + this.nmouseY = 0; + this.fpsTime = Date.now() / 1000; + this.fpsCount = 0; + this.fps = 0; + this.pause = false; + this.singleStep = false; + this.nkeyboard = new Array(demo_common_UserInput.KEYBOARD_LENGTH); + var _g = 0; + var _g1 = demo_common_UserInput.KEYBOARD_LENGTH; + while(_g < _g1) this.nkeyboard[_g++] = false; + this.text = ""; + this.createDemos(); +}; +demo_common_DemoMain.__name__ = true; +demo_common_DemoMain.prototype = { + createDemos: function() { + this.demos = [new demo_core_BasicDemo(),new demo_core_CompoundShapesDemo(),new demo_core_FrictionsAndRestitutions(),new demo_core_CollisionFilteringDemo(),new demo_core_ConvexHullDemo(),new demo_core_VerticalStackingDemo(),new demo_core_LimitRotationDemo(),new demo_core_BroadPhaseStressDemo(),new demo_core_BridgeDemo(),new demo_core_SpringsDemo(),new demo_core_JointsDemo(),new demo_core_BreakableJointDemo(),new demo_core_RagdollDemo(),new demo_core_FallingRagdollDemo(),new demo_core_VariableTimeStepDemo(),new demo_core_GearsDemo(),new demo_core_RayCastingDemo(),new demo_core_ConvexCastingDemo()]; + this.currentDemoIndex = 0; + this.currentDemo = this.demos[0]; + } + ,init: function(graphics) { + this.g = graphics; + this.renderer = new demo_common_DemoRenderer(null,this.g); + var aspectRatio = this.width / this.height; + var fovY = Math.max(1.0471975511965967,Math.atan(Math.tan(0.52359877559829837) / aspectRatio) * 2); + var _this = this.renderer.projMat; + var h = 1 / Math.tan(fovY * 0.5); + _this.e00 = h / aspectRatio; + _this.e01 = 0; + _this.e02 = 0; + _this.e03 = 0; + _this.e10 = 0; + _this.e11 = h; + _this.e12 = 0; + _this.e13 = 0; + _this.e20 = 0; + _this.e21 = 0; + _this.e22 = -1.000100010001; + _this.e23 = -0.1000100010001; + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = -1; + _this.e33 = 0; + this.viewInfo.width = this.width; + this.viewInfo.height = this.height; + this.viewInfo.screenDistance = 1; + this.viewInfo.screenHeight = 2 * Math.tan(fovY * 0.5); + this.viewInfo.screenWidth = this.viewInfo.screenHeight * aspectRatio; + this.initDemo(); + } + ,initDemo: function() { + this.world = new oimo_dynamics_World(); + this.renderer.w = this.world; + this.renderer.g.getDebugDraw().style = new oimo_dynamics_common_DebugDrawStyle(); + this.initControls(); + this.currentDemo.init(this.world,this.renderer,this.input,this.viewInfo); + this.count = 0; + } + ,initControls: function() { + var _gthis = this; + var dd = this.g.getDebugDraw(); + this.controls = []; + this.controls = this.controls.concat([new demo_common_Control("Q",function() { + return "previous demo"; + },HxOverrides.cca("Q",0),function() { + _gthis.changeDemo(-1); + return; + }),new demo_common_Control("E",function() { + return "next demo"; + },HxOverrides.cca("E",0),function() { + _gthis.changeDemo(1); + return; + }),new demo_common_Control("ENTER",function() { + if(_gthis.pause) { + return "resume"; + } else { + return "pause"; + } + },demo_common_UserInput.KEYCODE_ENTER,function() { + return _gthis.pause = !_gthis.pause; + }),new demo_common_Control("P",function() { + if(_gthis.pause) { + return "compute single step"; + } else { + return "---"; + } + },HxOverrides.cca("P",0),function() { + if(_gthis.pause) { + _gthis.singleStep = true; + } + return; + }),new demo_common_Control("W",function() { + return (dd.wireframe ? "solid" : "wireframe") + " mode"; + },HxOverrides.cca("W",0),function() { + return dd.wireframe = !dd.wireframe; + }),new demo_common_Control("L",function() { + return (oimo_common_Setting.disableSleeping ? "enable" : "disable") + " sleeping"; + },HxOverrides.cca("L",0),function() { + return oimo_common_Setting.disableSleeping = !oimo_common_Setting.disableSleeping; + }),new demo_common_Control("R",function() { + return (dd.drawPairs ? "hide" : "draw") + " pairs"; + },HxOverrides.cca("R",0),function() { + return dd.drawPairs = !dd.drawPairs; + }),new demo_common_Control("V",function() { + return (dd.drawAabbs ? "hide" : "draw") + " AABBs"; + },HxOverrides.cca("V",0),function() { + return dd.drawAabbs = !dd.drawAabbs; + }),new demo_common_Control("B",function() { + return (dd.drawBases ? "hide" : "draw") + " bases"; + },HxOverrides.cca("B",0),function() { + return dd.drawBases = !dd.drawBases; + }),new demo_common_Control("C",function() { + return (dd.drawContacts ? "hide" : "draw") + " contacts"; + },HxOverrides.cca("C",0),function() { + return dd.drawContacts = !dd.drawContacts; + }),new demo_common_Control("J",function() { + return (dd.drawJoints ? "hide" : "draw") + " joints"; + },HxOverrides.cca("J",0),function() { + return dd.drawJoints = !dd.drawJoints; + }),new demo_common_Control("K",function() { + return (dd.drawJointLimits ? "hide" : "draw") + " joint limits"; + },HxOverrides.cca("K",0),function() { + return dd.drawJointLimits = !dd.drawJointLimits; + }),new demo_common_Control("A",function() { + return (dd.drawContactBases ? "hide" : "draw") + " contact bases"; + },HxOverrides.cca("A",0),function() { + return dd.drawContactBases = !dd.drawContactBases; + }),new demo_common_Control("T",function() { + return (dd.drawBvh ? "hide" : "draw") + " AABB tree"; + },HxOverrides.cca("T",0),function() { + return dd.drawBvh = !dd.drawBvh; + }),new demo_common_Control("S",function() { + return (dd.drawShapes ? "hide" : "draw") + " shapes"; + },HxOverrides.cca("S",0),function() { + return dd.drawShapes = !dd.drawShapes; + })]); + this.currentDemo.initControls(this.controls); + } + ,loop: function() { + this.count++; + this.input.pmouseX = this.input.mouseX; + this.input.pmouseY = this.input.mouseY; + this.input.pmouseL = this.input.mouseL; + this.input.pmouseR = this.input.mouseR; + this.input.mouseX = this.nmouseX; + this.input.mouseY = this.nmouseY; + this.input.mouseL = this.nmouseL; + this.input.mouseR = this.nmouseR; + var _g = 0; + var _g1 = demo_common_UserInput.KEYBOARD_LENGTH; + while(_g < _g1) { + var i = _g++; + this.input.pkeyboard[i] = this.input.keyboard[i]; + this.input.keyboard[i] = this.nkeyboard[i]; + } + this.control(); + this.currentDemo.update(); + if(!this.pause || this.singleStep) { + this.world.step(this.currentDemo.dt); + this.singleStep = false; + } + var drawBegin = Date.now() / 1000; + this.currentDemo.draw(); + var drawTime = (Date.now() / 1000 - drawBegin) * 1000; + var currentTime = Date.now() / 1000; + this.fpsCount++; + if(this.fpsTime + 1 < currentTime) { + this.fps = this.fpsCount; + this.fpsTime += 1; + this.fpsCount = 0; + } + this.text = "" + this.currentDemo.demoName + " - " + (this.pause ? "Paused" : "Running") + "\n" + "------------\n" + "Profile\n" + (" Rigid Bodies : " + this.world._numRigidBodies + "\n") + (" Joints : " + this.world._numJoints + "\n") + (" Shapes : " + this.world._numShapes + "\n") + (" Pairs : " + this.world._contactManager._numContacts + "\n") + "------------\n" + "Performance\n" + (" Broad Phase : " + Math.round(oimo_dynamics_common_Performance.broadPhaseCollisionTime) + "ms\n") + (" Narrow Phase : " + Math.round(oimo_dynamics_common_Performance.narrowPhaseCollisionTime) + "ms\n") + (" Dynamics : " + Math.round(oimo_dynamics_common_Performance.dynamicsTime) + "ms\n") + (" Physics Total: " + Math.round(oimo_dynamics_common_Performance.totalTime) + "ms\n") + (" Rendering : " + Math.round(drawTime) + "ms\n") + (" Actual FPS : " + this.fps + "\n") + "------------\n" + "Control\n" + ("" + this.createKeyDescriptions(" ")) + "------------\n" + "Misc. Info\n" + ("" + this.additionalInfo()) + "\n"; + oimo_common_Vec3.numCreations = 0; + oimo_common_Mat3.numCreations = 0; + oimo_common_Quat.numCreations = 0; + } + ,createKeyDescriptions: function(prefix) { + var res = ""; + var _g = 0; + var _g1 = this.controls; + while(_g < _g1.length) { + var control = _g1[_g]; + ++_g; + res += "" + prefix + control.keyText + ": " + control.description() + "\n"; + } + return res; + } + ,additionalInfo: function() { + return this.currentDemo.additionalInfo(); + } + ,control: function() { + var _g = 0; + var _g1 = this.controls; + while(_g < _g1.length) { + var control = _g1[_g]; + ++_g; + if(this.input.isKeyPressed(null,control.keyCode)) { + control.onAction(); + } + } + } + ,changeDemo: function(offset) { + var num = this.demos.length; + this.currentDemoIndex = ((this.currentDemoIndex + offset) % num + num) % num; + this.currentDemo = this.demos[this.currentDemoIndex]; + this.initDemo(); + } + ,mouseMoved: function(x,y) { + this.nmouseX = x; + this.nmouseY = y; + } + ,mouseLPressed: function() { + this.nmouseL = true; + } + ,mouseRPressed: function() { + this.nmouseR = true; + } + ,mouseLReleased: function() { + this.nmouseL = false; + } + ,mouseRReleased: function() { + this.nmouseR = false; + } + ,keyPressed: function(keyCode) { + if(keyCode < 0 || keyCode >= demo_common_UserInput.KEYBOARD_LENGTH) { + return; + } + this.nkeyboard[keyCode] = true; + } + ,keyReleased: function(keyCode) { + if(keyCode < 0 || keyCode >= demo_common_UserInput.KEYBOARD_LENGTH) { + return; + } + this.nkeyboard[keyCode] = false; + } + ,action: function(index) { + if(index >= 0 && index < this.controls.length) { + this.controls[index].onAction(); + } + } + ,__class__: demo_common_DemoMain +}; +var demo_common_DemoRenderer = function(world,graphics) { + this.w = world; + this.g = graphics; + this.bgColor = new oimo_common_Vec3(0.1,0.1,0.1); + this.viewMat = new oimo_common_Mat4(); + this.projMat = new oimo_common_Mat4(); +}; +demo_common_DemoRenderer.__name__ = true; +demo_common_DemoRenderer.prototype = { + setWorld: function(world) { + this.w = world; + } + ,setGraphics: function(graphics) { + this.g = graphics; + } + ,getGraphics: function() { + return this.g; + } + ,draw: function(test) { + this.g.setViewMatrix(this.viewMat); + this.g.setProjectionMatrix(this.projMat); + this.g.begin(this.bgColor); + this.w._debugDraw = this.g.getDebugDraw(); + this.w.debugDraw(); + test.drawAdditionalObjects(this.g.getDebugDraw()); + this.g.end(); + } + ,camera: function(eye,at,up) { + var _this = this.viewMat; + var eyeX = eye.x; + var eyeY = eye.y; + var eyeZ = eye.z; + var upX = up.x; + var upY = up.y; + var upZ = up.z; + var zx = eyeX - at.x; + var zy = eyeY - at.y; + var zz = eyeZ - at.z; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = upY * zz - upZ * zy; + var xy = upZ * zx - upX * zz; + var xz = upX * zy - upY * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eyeX + xy * eyeY + xz * eyeZ); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eyeX + yy * eyeY + yz * eyeZ); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eyeX + zy * eyeY + zz * eyeZ); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + } + ,getViewMatrix: function() { + var _this = this.viewMat; + return new oimo_common_Mat4(_this.e00,_this.e01,_this.e02,_this.e03,_this.e10,_this.e11,_this.e12,_this.e13,_this.e20,_this.e21,_this.e22,_this.e23,_this.e30,_this.e31,_this.e32,_this.e33); + } + ,getCameraPosition: function() { + return new oimo_common_Vec3(-(this.viewMat.e00 * this.viewMat.e03 + this.viewMat.e10 * this.viewMat.e13 + this.viewMat.e20 * this.viewMat.e23),-(this.viewMat.e01 * this.viewMat.e03 + this.viewMat.e11 * this.viewMat.e13 + this.viewMat.e21 * this.viewMat.e23),-(this.viewMat.e02 * this.viewMat.e03 + this.viewMat.e12 * this.viewMat.e13 + this.viewMat.e22 * this.viewMat.e23)); + } + ,perspective: function(fovY,aspect) { + var _this = this.projMat; + var h = 1 / Math.tan(fovY * 0.5); + _this.e00 = h / aspect; + _this.e01 = 0; + _this.e02 = 0; + _this.e03 = 0; + _this.e10 = 0; + _this.e11 = h; + _this.e12 = 0; + _this.e13 = 0; + _this.e20 = 0; + _this.e21 = 0; + _this.e22 = -1.000100010001; + _this.e23 = -0.1000100010001; + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = -1; + _this.e33 = 0; + } + ,getProjectionMatrix: function() { + var _this = this.projMat; + return new oimo_common_Mat4(_this.e00,_this.e01,_this.e02,_this.e03,_this.e10,_this.e11,_this.e12,_this.e13,_this.e20,_this.e21,_this.e22,_this.e23,_this.e30,_this.e31,_this.e32,_this.e33); + } + ,__class__: demo_common_DemoRenderer +}; +var demo_common_IDemoGraphics = function() { }; +demo_common_IDemoGraphics.__name__ = true; +demo_common_IDemoGraphics.__isInterface__ = true; +demo_common_IDemoGraphics.prototype = { + __class__: demo_common_IDemoGraphics +}; +var demo_common_OimoUtil = function() { }; +demo_common_OimoUtil.__name__ = true; +demo_common_OimoUtil.addRagdollJoint = function(w,rb1,rb2,anchor,twistAxis,swingAxis,swingSd,maxSwing1Deg,maxSwing2Deg,twistSd,twistLm) { + if(maxSwing2Deg == null) { + maxSwing2Deg = 180; + } + if(maxSwing1Deg == null) { + maxSwing1Deg = 180; + } + var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); + jc.init(rb1,rb2,anchor,twistAxis,swingAxis); + if(twistSd != null) { + jc.twistSpringDamper = twistSd; + } + if(twistLm != null) { + jc.twistLimitMotor = twistLm; + } + if(swingSd != null) { + jc.swingSpringDamper = swingSd; + } + jc.maxSwingAngle1 = maxSwing1Deg * 0.017453292519943278; + jc.maxSwingAngle2 = maxSwing2Deg * 0.017453292519943278; + var j = new oimo_dynamics_constraint_joint_RagdollJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addUniversalJoint = function(w,rb1,rb2,anchor,axis1,axis2,sd1,lm1,sd2,lm2) { + var jc = new oimo_dynamics_constraint_joint_UniversalJointConfig(); + jc.init(rb1,rb2,anchor,axis1,axis2); + if(sd1 != null) { + jc.springDamper1 = sd1; + } + if(lm1 != null) { + jc.limitMotor1 = lm1; + } + if(sd2 != null) { + jc.springDamper2 = sd2; + } + if(lm2 != null) { + jc.limitMotor2 = lm2; + } + var j = new oimo_dynamics_constraint_joint_UniversalJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addGenericJoint = function(w,rb1,rb2,anchor,basis1,basis2,translSds,translLms,rotSds,rotLms) { + var jc = new oimo_dynamics_constraint_joint_GenericJointConfig(); + jc.init(rb1,rb2,anchor,basis1,basis2); + if(translSds != null && translSds[0] != null) { + jc.translationalSpringDampers[0] = translSds[0]; + } + if(translLms != null && translLms[0] != null) { + jc.translationalLimitMotors[0] = translLms[0]; + } + if(rotSds != null && rotSds[0] != null) { + jc.rotationalSpringDampers[0] = rotSds[0]; + } + if(rotLms != null && rotLms[0] != null) { + jc.rotationalLimitMotors[0] = rotLms[0]; + } + if(translSds != null && translSds[1] != null) { + jc.translationalSpringDampers[1] = translSds[1]; + } + if(translLms != null && translLms[1] != null) { + jc.translationalLimitMotors[1] = translLms[1]; + } + if(rotSds != null && rotSds[1] != null) { + jc.rotationalSpringDampers[1] = rotSds[1]; + } + if(rotLms != null && rotLms[1] != null) { + jc.rotationalLimitMotors[1] = rotLms[1]; + } + if(translSds != null && translSds[2] != null) { + jc.translationalSpringDampers[2] = translSds[2]; + } + if(translLms != null && translLms[2] != null) { + jc.translationalLimitMotors[2] = translLms[2]; + } + if(rotSds != null && rotSds[2] != null) { + jc.rotationalSpringDampers[2] = rotSds[2]; + } + if(rotLms != null && rotLms[2] != null) { + jc.rotationalLimitMotors[2] = rotLms[2]; + } + var j = new oimo_dynamics_constraint_joint_GenericJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addPrismaticJoint = function(w,rb1,rb2,anchor,axis,sd,lm) { + var jc = new oimo_dynamics_constraint_joint_PrismaticJointConfig(); + jc.init(rb1,rb2,anchor,axis); + if(sd != null) { + jc.springDamper = sd; + } + if(lm != null) { + jc.limitMotor = lm; + } + var j = new oimo_dynamics_constraint_joint_PrismaticJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addRevoluteJoint = function(w,rb1,rb2,anchor,axis,sd,lm) { + var jc = new oimo_dynamics_constraint_joint_RevoluteJointConfig(); + jc.init(rb1,rb2,anchor,axis); + if(sd != null) { + jc.springDamper = sd; + } + if(lm != null) { + jc.limitMotor = lm; + } + var j = new oimo_dynamics_constraint_joint_RevoluteJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addCylindricalJoint = function(w,rb1,rb2,anchor,axis,rotSd,rotLm,traSd,traLm) { + var jc = new oimo_dynamics_constraint_joint_CylindricalJointConfig(); + jc.init(rb1,rb2,anchor,axis); + if(rotSd != null) { + jc.rotationalSpringDamper = rotSd; + } + if(rotLm != null) { + jc.rotationalLimitMotor = rotLm; + } + if(traSd != null) { + jc.translationalSpringDamper = traSd; + } + if(traLm != null) { + jc.translationalLimitMotor = traLm; + } + var j = new oimo_dynamics_constraint_joint_CylindricalJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addSphericalJoint = function(w,rb1,rb2,anchor) { + var jc = new oimo_dynamics_constraint_joint_SphericalJointConfig(); + jc.init(rb1,rb2,anchor); + var j = new oimo_dynamics_constraint_joint_SphericalJoint(jc); + w.addJoint(j); + return j; +}; +demo_common_OimoUtil.addSphere = function(w,center,radius,wall) { + return demo_common_OimoUtil.addRigidBody(w,center,new oimo_collision_geometry_SphereGeometry(radius),wall); +}; +demo_common_OimoUtil.addBox = function(w,center,halfExtents,wall) { + return demo_common_OimoUtil.addRigidBody(w,center,new oimo_collision_geometry_BoxGeometry(halfExtents),wall); +}; +demo_common_OimoUtil.addCylinder = function(w,center,radius,halfHeight,wall) { + return demo_common_OimoUtil.addRigidBody(w,center,new oimo_collision_geometry_CylinderGeometry(radius,halfHeight),wall); +}; +demo_common_OimoUtil.addCone = function(w,center,radius,halfHeight,wall) { + return demo_common_OimoUtil.addRigidBody(w,center,new oimo_collision_geometry_ConeGeometry(radius,halfHeight),wall); +}; +demo_common_OimoUtil.addCapsule = function(w,center,radius,halfHeight,wall) { + return demo_common_OimoUtil.addRigidBody(w,center,new oimo_collision_geometry_CapsuleGeometry(radius,halfHeight),wall); +}; +demo_common_OimoUtil.addRigidBody = function(w,center,geom,wall) { + var shapec = new oimo_dynamics_rigidbody_ShapeConfig(); + shapec.geometry = geom; + var bodyc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + bodyc.type = wall ? oimo_dynamics_rigidbody_RigidBodyType.STATIC : oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC; + bodyc.position = center; + var body = new oimo_dynamics_rigidbody_RigidBody(bodyc); + body.addShape(new oimo_dynamics_rigidbody_Shape(shapec)); + w.addRigidBody(body); + return body; +}; +demo_common_OimoUtil.addRagdoll = function(w,pos) { + oimo_common_Vec3.numCreations++; + var head = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0,pos.y + 1.0499999999999998,pos.z + 0),0.12,0.03,false); + oimo_common_Vec3.numCreations++; + var body1 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0,pos.y + 0.52499999999999991,pos.z + 0),0.2,0.175,false); + oimo_common_Vec3.numCreations++; + var body2 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0,pos.y + 0.175,pos.z + 0),0.2,0.175,false); + oimo_common_Vec3.numCreations++; + var legL1 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + (-0.15),pos.y + (-0.4),pos.z + 0),0.1,0.25,false); + oimo_common_Vec3.numCreations++; + var legL2 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + (-0.15),pos.y + (-0.9),pos.z + 0),0.1,0.25,false); + oimo_common_Vec3.numCreations++; + var legR1 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0.15,pos.y + (-0.4),pos.z + 0),0.1,0.25,false); + oimo_common_Vec3.numCreations++; + var legR2 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0.15,pos.y + (-0.9),pos.z + 0),0.1,0.25,false); + oimo_common_Vec3.numCreations++; + var armL1 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + (-0.375),pos.y + 0.7,pos.z + 0),0.075,0.175,false); + oimo_common_Vec3.numCreations++; + var armL2 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + (-0.72500000000000009),pos.y + 0.7,pos.z + 0),0.075,0.175,false); + oimo_common_Vec3.numCreations++; + var armR1 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0.375,pos.y + 0.7,pos.z + 0),0.075,0.175,false); + oimo_common_Vec3.numCreations++; + var armR2 = demo_common_OimoUtil.addCapsule(w,new oimo_common_Vec3(pos.x + 0.72500000000000009,pos.y + 0.7,pos.z + 0),0.075,0.175,false); + var m_e00 = 1; + var m_e01 = 0; + var m_e02 = 0; + var m_e10 = 0; + var m_e11 = 1; + var m_e12 = 0; + var m_e20 = 0; + var m_e21 = 0; + var m_e22 = 1; + oimo_common_Mat3.numCreations++; + var s = Math.sin(1.570796326794895); + var c = Math.cos(1.570796326794895); + var c1 = 1 - c; + var r00 = 0 * c1 + c; + var r01 = 0 * c1 - s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - 0 * s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + 0 * s; + var r22 = c1 + c; + var e00 = m_e00 * r00 + m_e01 * r10 + m_e02 * r20; + var e01 = m_e00 * r01 + m_e01 * r11 + m_e02 * r21; + var e02 = m_e00 * r02 + m_e01 * r12 + m_e02 * r22; + var e10 = m_e10 * r00 + m_e11 * r10 + m_e12 * r20; + var e11 = m_e10 * r01 + m_e11 * r11 + m_e12 * r21; + var e12 = m_e10 * r02 + m_e11 * r12 + m_e12 * r22; + var e20 = m_e20 * r00 + m_e21 * r10 + m_e22 * r20; + var e21 = m_e20 * r01 + m_e21 * r11 + m_e22 * r21; + var e22 = m_e20 * r02 + m_e21 * r12 + m_e22 * r22; + m_e00 = e00; + m_e01 = e01; + m_e02 = e02; + m_e10 = e10; + m_e11 = e11; + m_e12 = e12; + m_e20 = e20; + m_e21 = e21; + m_e22 = e22; + armL1._transform._rotation00 = e00; + armL1._transform._rotation01 = e01; + armL1._transform._rotation02 = e02; + armL1._transform._rotation10 = e10; + armL1._transform._rotation11 = e11; + armL1._transform._rotation12 = e12; + armL1._transform._rotation20 = e20; + armL1._transform._rotation21 = e21; + armL1._transform._rotation22 = e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armL1._transform._rotation00 * armL1._invLocalInertia00 + armL1._transform._rotation01 * armL1._invLocalInertia10 + armL1._transform._rotation02 * armL1._invLocalInertia20; + __tmp__01 = armL1._transform._rotation00 * armL1._invLocalInertia01 + armL1._transform._rotation01 * armL1._invLocalInertia11 + armL1._transform._rotation02 * armL1._invLocalInertia21; + __tmp__02 = armL1._transform._rotation00 * armL1._invLocalInertia02 + armL1._transform._rotation01 * armL1._invLocalInertia12 + armL1._transform._rotation02 * armL1._invLocalInertia22; + __tmp__10 = armL1._transform._rotation10 * armL1._invLocalInertia00 + armL1._transform._rotation11 * armL1._invLocalInertia10 + armL1._transform._rotation12 * armL1._invLocalInertia20; + __tmp__11 = armL1._transform._rotation10 * armL1._invLocalInertia01 + armL1._transform._rotation11 * armL1._invLocalInertia11 + armL1._transform._rotation12 * armL1._invLocalInertia21; + __tmp__12 = armL1._transform._rotation10 * armL1._invLocalInertia02 + armL1._transform._rotation11 * armL1._invLocalInertia12 + armL1._transform._rotation12 * armL1._invLocalInertia22; + __tmp__20 = armL1._transform._rotation20 * armL1._invLocalInertia00 + armL1._transform._rotation21 * armL1._invLocalInertia10 + armL1._transform._rotation22 * armL1._invLocalInertia20; + __tmp__21 = armL1._transform._rotation20 * armL1._invLocalInertia01 + armL1._transform._rotation21 * armL1._invLocalInertia11 + armL1._transform._rotation22 * armL1._invLocalInertia21; + __tmp__22 = armL1._transform._rotation20 * armL1._invLocalInertia02 + armL1._transform._rotation21 * armL1._invLocalInertia12 + armL1._transform._rotation22 * armL1._invLocalInertia22; + armL1._invInertia00 = __tmp__00; + armL1._invInertia01 = __tmp__01; + armL1._invInertia02 = __tmp__02; + armL1._invInertia10 = __tmp__10; + armL1._invInertia11 = __tmp__11; + armL1._invInertia12 = __tmp__12; + armL1._invInertia20 = __tmp__20; + armL1._invInertia21 = __tmp__21; + armL1._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = armL1._invInertia00 * armL1._transform._rotation00 + armL1._invInertia01 * armL1._transform._rotation01 + armL1._invInertia02 * armL1._transform._rotation02; + __tmp__011 = armL1._invInertia00 * armL1._transform._rotation10 + armL1._invInertia01 * armL1._transform._rotation11 + armL1._invInertia02 * armL1._transform._rotation12; + __tmp__021 = armL1._invInertia00 * armL1._transform._rotation20 + armL1._invInertia01 * armL1._transform._rotation21 + armL1._invInertia02 * armL1._transform._rotation22; + __tmp__101 = armL1._invInertia10 * armL1._transform._rotation00 + armL1._invInertia11 * armL1._transform._rotation01 + armL1._invInertia12 * armL1._transform._rotation02; + __tmp__111 = armL1._invInertia10 * armL1._transform._rotation10 + armL1._invInertia11 * armL1._transform._rotation11 + armL1._invInertia12 * armL1._transform._rotation12; + __tmp__121 = armL1._invInertia10 * armL1._transform._rotation20 + armL1._invInertia11 * armL1._transform._rotation21 + armL1._invInertia12 * armL1._transform._rotation22; + __tmp__201 = armL1._invInertia20 * armL1._transform._rotation00 + armL1._invInertia21 * armL1._transform._rotation01 + armL1._invInertia22 * armL1._transform._rotation02; + __tmp__211 = armL1._invInertia20 * armL1._transform._rotation10 + armL1._invInertia21 * armL1._transform._rotation11 + armL1._invInertia22 * armL1._transform._rotation12; + __tmp__221 = armL1._invInertia20 * armL1._transform._rotation20 + armL1._invInertia21 * armL1._transform._rotation21 + armL1._invInertia22 * armL1._transform._rotation22; + armL1._invInertia00 = __tmp__001; + armL1._invInertia01 = __tmp__011; + armL1._invInertia02 = __tmp__021; + armL1._invInertia10 = __tmp__101; + armL1._invInertia11 = __tmp__111; + armL1._invInertia12 = __tmp__121; + armL1._invInertia20 = __tmp__201; + armL1._invInertia21 = __tmp__211; + armL1._invInertia22 = __tmp__221; + armL1._invInertia00 *= armL1._rotFactor.x; + armL1._invInertia01 *= armL1._rotFactor.x; + armL1._invInertia02 *= armL1._rotFactor.x; + armL1._invInertia10 *= armL1._rotFactor.y; + armL1._invInertia11 *= armL1._rotFactor.y; + armL1._invInertia12 *= armL1._rotFactor.y; + armL1._invInertia20 *= armL1._rotFactor.z; + armL1._invInertia21 *= armL1._rotFactor.z; + armL1._invInertia22 *= armL1._rotFactor.z; + var dst = armL1._ptransform; + var src = armL1._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s1 = armL1._shapeList; + while(s1 != null) { + var n = s1._next; + var tf1 = armL1._ptransform; + var tf2 = armL1._transform; + var dst1 = s1._ptransform; + var src1 = s1._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s1._transform; + var src11 = s1._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s1._geom._computeAabb(s1._aabb,s1._ptransform); + minX = s1._aabb._minX; + minY = s1._aabb._minY; + minZ = s1._aabb._minZ; + maxX = s1._aabb._maxX; + maxY = s1._aabb._maxY; + maxZ = s1._aabb._maxZ; + s1._geom._computeAabb(s1._aabb,s1._transform); + s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; + s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; + s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; + s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; + s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; + s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; + if(s1._proxy != null) { + var dX; + var dY; + var dZ; + dX = s1._transform._positionX - s1._ptransform._positionX; + dY = s1._transform._positionY - s1._ptransform._positionY; + dZ = s1._transform._positionZ - s1._ptransform._positionZ; + var v = s1.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + } + s1 = n; + } + armL1._sleeping = false; + armL1._sleepTime = 0; + armL2._transform._rotation00 = e00; + armL2._transform._rotation01 = e01; + armL2._transform._rotation02 = e02; + armL2._transform._rotation10 = e10; + armL2._transform._rotation11 = e11; + armL2._transform._rotation12 = e12; + armL2._transform._rotation20 = e20; + armL2._transform._rotation21 = e21; + armL2._transform._rotation22 = e22; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = armL2._transform._rotation00 * armL2._invLocalInertia00 + armL2._transform._rotation01 * armL2._invLocalInertia10 + armL2._transform._rotation02 * armL2._invLocalInertia20; + __tmp__014 = armL2._transform._rotation00 * armL2._invLocalInertia01 + armL2._transform._rotation01 * armL2._invLocalInertia11 + armL2._transform._rotation02 * armL2._invLocalInertia21; + __tmp__024 = armL2._transform._rotation00 * armL2._invLocalInertia02 + armL2._transform._rotation01 * armL2._invLocalInertia12 + armL2._transform._rotation02 * armL2._invLocalInertia22; + __tmp__104 = armL2._transform._rotation10 * armL2._invLocalInertia00 + armL2._transform._rotation11 * armL2._invLocalInertia10 + armL2._transform._rotation12 * armL2._invLocalInertia20; + __tmp__114 = armL2._transform._rotation10 * armL2._invLocalInertia01 + armL2._transform._rotation11 * armL2._invLocalInertia11 + armL2._transform._rotation12 * armL2._invLocalInertia21; + __tmp__124 = armL2._transform._rotation10 * armL2._invLocalInertia02 + armL2._transform._rotation11 * armL2._invLocalInertia12 + armL2._transform._rotation12 * armL2._invLocalInertia22; + __tmp__204 = armL2._transform._rotation20 * armL2._invLocalInertia00 + armL2._transform._rotation21 * armL2._invLocalInertia10 + armL2._transform._rotation22 * armL2._invLocalInertia20; + __tmp__214 = armL2._transform._rotation20 * armL2._invLocalInertia01 + armL2._transform._rotation21 * armL2._invLocalInertia11 + armL2._transform._rotation22 * armL2._invLocalInertia21; + __tmp__224 = armL2._transform._rotation20 * armL2._invLocalInertia02 + armL2._transform._rotation21 * armL2._invLocalInertia12 + armL2._transform._rotation22 * armL2._invLocalInertia22; + armL2._invInertia00 = __tmp__004; + armL2._invInertia01 = __tmp__014; + armL2._invInertia02 = __tmp__024; + armL2._invInertia10 = __tmp__104; + armL2._invInertia11 = __tmp__114; + armL2._invInertia12 = __tmp__124; + armL2._invInertia20 = __tmp__204; + armL2._invInertia21 = __tmp__214; + armL2._invInertia22 = __tmp__224; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = armL2._invInertia00 * armL2._transform._rotation00 + armL2._invInertia01 * armL2._transform._rotation01 + armL2._invInertia02 * armL2._transform._rotation02; + __tmp__015 = armL2._invInertia00 * armL2._transform._rotation10 + armL2._invInertia01 * armL2._transform._rotation11 + armL2._invInertia02 * armL2._transform._rotation12; + __tmp__025 = armL2._invInertia00 * armL2._transform._rotation20 + armL2._invInertia01 * armL2._transform._rotation21 + armL2._invInertia02 * armL2._transform._rotation22; + __tmp__105 = armL2._invInertia10 * armL2._transform._rotation00 + armL2._invInertia11 * armL2._transform._rotation01 + armL2._invInertia12 * armL2._transform._rotation02; + __tmp__115 = armL2._invInertia10 * armL2._transform._rotation10 + armL2._invInertia11 * armL2._transform._rotation11 + armL2._invInertia12 * armL2._transform._rotation12; + __tmp__125 = armL2._invInertia10 * armL2._transform._rotation20 + armL2._invInertia11 * armL2._transform._rotation21 + armL2._invInertia12 * armL2._transform._rotation22; + __tmp__205 = armL2._invInertia20 * armL2._transform._rotation00 + armL2._invInertia21 * armL2._transform._rotation01 + armL2._invInertia22 * armL2._transform._rotation02; + __tmp__215 = armL2._invInertia20 * armL2._transform._rotation10 + armL2._invInertia21 * armL2._transform._rotation11 + armL2._invInertia22 * armL2._transform._rotation12; + __tmp__225 = armL2._invInertia20 * armL2._transform._rotation20 + armL2._invInertia21 * armL2._transform._rotation21 + armL2._invInertia22 * armL2._transform._rotation22; + armL2._invInertia00 = __tmp__005; + armL2._invInertia01 = __tmp__015; + armL2._invInertia02 = __tmp__025; + armL2._invInertia10 = __tmp__105; + armL2._invInertia11 = __tmp__115; + armL2._invInertia12 = __tmp__125; + armL2._invInertia20 = __tmp__205; + armL2._invInertia21 = __tmp__215; + armL2._invInertia22 = __tmp__225; + armL2._invInertia00 *= armL2._rotFactor.x; + armL2._invInertia01 *= armL2._rotFactor.x; + armL2._invInertia02 *= armL2._rotFactor.x; + armL2._invInertia10 *= armL2._rotFactor.y; + armL2._invInertia11 *= armL2._rotFactor.y; + armL2._invInertia12 *= armL2._rotFactor.y; + armL2._invInertia20 *= armL2._rotFactor.z; + armL2._invInertia21 *= armL2._rotFactor.z; + armL2._invInertia22 *= armL2._rotFactor.z; + var dst3 = armL2._ptransform; + var src2 = armL2._transform; + dst3._positionX = src2._positionX; + dst3._positionY = src2._positionY; + dst3._positionZ = src2._positionZ; + dst3._rotation00 = src2._rotation00; + dst3._rotation01 = src2._rotation01; + dst3._rotation02 = src2._rotation02; + dst3._rotation10 = src2._rotation10; + dst3._rotation11 = src2._rotation11; + dst3._rotation12 = src2._rotation12; + dst3._rotation20 = src2._rotation20; + dst3._rotation21 = src2._rotation21; + dst3._rotation22 = src2._rotation22; + var s2 = armL2._shapeList; + while(s2 != null) { + var n1 = s2._next; + var tf11 = armL2._ptransform; + var tf21 = armL2._transform; + var dst4 = s2._ptransform; + var src12 = s2._localTransform; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__016 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__026 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__106 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__116 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__126 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__206 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__216 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__226 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst4._rotation00 = __tmp__006; + dst4._rotation01 = __tmp__016; + dst4._rotation02 = __tmp__026; + dst4._rotation10 = __tmp__106; + dst4._rotation11 = __tmp__116; + dst4._rotation12 = __tmp__126; + dst4._rotation20 = __tmp__206; + dst4._rotation21 = __tmp__216; + dst4._rotation22 = __tmp__226; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst4._positionX = __tmp__X2; + dst4._positionY = __tmp__Y2; + dst4._positionZ = __tmp__Z2; + dst4._positionX += tf11._positionX; + dst4._positionY += tf11._positionY; + dst4._positionZ += tf11._positionZ; + var dst5 = s2._transform; + var src13 = s2._localTransform; + var __tmp__007; + var __tmp__017; + var __tmp__027; + var __tmp__107; + var __tmp__117; + var __tmp__127; + var __tmp__207; + var __tmp__217; + var __tmp__227; + __tmp__007 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__017 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__027 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__107 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__117 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__127 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__207 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__217 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__227 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst5._rotation00 = __tmp__007; + dst5._rotation01 = __tmp__017; + dst5._rotation02 = __tmp__027; + dst5._rotation10 = __tmp__107; + dst5._rotation11 = __tmp__117; + dst5._rotation12 = __tmp__127; + dst5._rotation20 = __tmp__207; + dst5._rotation21 = __tmp__217; + dst5._rotation22 = __tmp__227; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst5._positionX = __tmp__X3; + dst5._positionY = __tmp__Y3; + dst5._positionZ = __tmp__Z3; + dst5._positionX += tf21._positionX; + dst5._positionY += tf21._positionY; + dst5._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX1 = s2._aabb._minX; + minY1 = s2._aabb._minY; + minZ1 = s2._aabb._minZ; + maxX1 = s2._aabb._maxX; + maxY1 = s2._aabb._maxY; + maxZ1 = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; + s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; + s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; + s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; + s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; + s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s2._transform._positionX - s2._ptransform._positionX; + dY1 = s2._transform._positionY - s2._ptransform._positionY; + dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; + var v1 = s2.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n1; + } + armL2._sleeping = false; + armL2._sleepTime = 0; + armR1._transform._rotation00 = e00; + armR1._transform._rotation01 = e01; + armR1._transform._rotation02 = e02; + armR1._transform._rotation10 = e10; + armR1._transform._rotation11 = e11; + armR1._transform._rotation12 = e12; + armR1._transform._rotation20 = e20; + armR1._transform._rotation21 = e21; + armR1._transform._rotation22 = e22; + var __tmp__008; + var __tmp__018; + var __tmp__028; + var __tmp__108; + var __tmp__118; + var __tmp__128; + var __tmp__208; + var __tmp__218; + var __tmp__228; + __tmp__008 = armR1._transform._rotation00 * armR1._invLocalInertia00 + armR1._transform._rotation01 * armR1._invLocalInertia10 + armR1._transform._rotation02 * armR1._invLocalInertia20; + __tmp__018 = armR1._transform._rotation00 * armR1._invLocalInertia01 + armR1._transform._rotation01 * armR1._invLocalInertia11 + armR1._transform._rotation02 * armR1._invLocalInertia21; + __tmp__028 = armR1._transform._rotation00 * armR1._invLocalInertia02 + armR1._transform._rotation01 * armR1._invLocalInertia12 + armR1._transform._rotation02 * armR1._invLocalInertia22; + __tmp__108 = armR1._transform._rotation10 * armR1._invLocalInertia00 + armR1._transform._rotation11 * armR1._invLocalInertia10 + armR1._transform._rotation12 * armR1._invLocalInertia20; + __tmp__118 = armR1._transform._rotation10 * armR1._invLocalInertia01 + armR1._transform._rotation11 * armR1._invLocalInertia11 + armR1._transform._rotation12 * armR1._invLocalInertia21; + __tmp__128 = armR1._transform._rotation10 * armR1._invLocalInertia02 + armR1._transform._rotation11 * armR1._invLocalInertia12 + armR1._transform._rotation12 * armR1._invLocalInertia22; + __tmp__208 = armR1._transform._rotation20 * armR1._invLocalInertia00 + armR1._transform._rotation21 * armR1._invLocalInertia10 + armR1._transform._rotation22 * armR1._invLocalInertia20; + __tmp__218 = armR1._transform._rotation20 * armR1._invLocalInertia01 + armR1._transform._rotation21 * armR1._invLocalInertia11 + armR1._transform._rotation22 * armR1._invLocalInertia21; + __tmp__228 = armR1._transform._rotation20 * armR1._invLocalInertia02 + armR1._transform._rotation21 * armR1._invLocalInertia12 + armR1._transform._rotation22 * armR1._invLocalInertia22; + armR1._invInertia00 = __tmp__008; + armR1._invInertia01 = __tmp__018; + armR1._invInertia02 = __tmp__028; + armR1._invInertia10 = __tmp__108; + armR1._invInertia11 = __tmp__118; + armR1._invInertia12 = __tmp__128; + armR1._invInertia20 = __tmp__208; + armR1._invInertia21 = __tmp__218; + armR1._invInertia22 = __tmp__228; + var __tmp__009; + var __tmp__019; + var __tmp__029; + var __tmp__109; + var __tmp__119; + var __tmp__129; + var __tmp__209; + var __tmp__219; + var __tmp__229; + __tmp__009 = armR1._invInertia00 * armR1._transform._rotation00 + armR1._invInertia01 * armR1._transform._rotation01 + armR1._invInertia02 * armR1._transform._rotation02; + __tmp__019 = armR1._invInertia00 * armR1._transform._rotation10 + armR1._invInertia01 * armR1._transform._rotation11 + armR1._invInertia02 * armR1._transform._rotation12; + __tmp__029 = armR1._invInertia00 * armR1._transform._rotation20 + armR1._invInertia01 * armR1._transform._rotation21 + armR1._invInertia02 * armR1._transform._rotation22; + __tmp__109 = armR1._invInertia10 * armR1._transform._rotation00 + armR1._invInertia11 * armR1._transform._rotation01 + armR1._invInertia12 * armR1._transform._rotation02; + __tmp__119 = armR1._invInertia10 * armR1._transform._rotation10 + armR1._invInertia11 * armR1._transform._rotation11 + armR1._invInertia12 * armR1._transform._rotation12; + __tmp__129 = armR1._invInertia10 * armR1._transform._rotation20 + armR1._invInertia11 * armR1._transform._rotation21 + armR1._invInertia12 * armR1._transform._rotation22; + __tmp__209 = armR1._invInertia20 * armR1._transform._rotation00 + armR1._invInertia21 * armR1._transform._rotation01 + armR1._invInertia22 * armR1._transform._rotation02; + __tmp__219 = armR1._invInertia20 * armR1._transform._rotation10 + armR1._invInertia21 * armR1._transform._rotation11 + armR1._invInertia22 * armR1._transform._rotation12; + __tmp__229 = armR1._invInertia20 * armR1._transform._rotation20 + armR1._invInertia21 * armR1._transform._rotation21 + armR1._invInertia22 * armR1._transform._rotation22; + armR1._invInertia00 = __tmp__009; + armR1._invInertia01 = __tmp__019; + armR1._invInertia02 = __tmp__029; + armR1._invInertia10 = __tmp__109; + armR1._invInertia11 = __tmp__119; + armR1._invInertia12 = __tmp__129; + armR1._invInertia20 = __tmp__209; + armR1._invInertia21 = __tmp__219; + armR1._invInertia22 = __tmp__229; + armR1._invInertia00 *= armR1._rotFactor.x; + armR1._invInertia01 *= armR1._rotFactor.x; + armR1._invInertia02 *= armR1._rotFactor.x; + armR1._invInertia10 *= armR1._rotFactor.y; + armR1._invInertia11 *= armR1._rotFactor.y; + armR1._invInertia12 *= armR1._rotFactor.y; + armR1._invInertia20 *= armR1._rotFactor.z; + armR1._invInertia21 *= armR1._rotFactor.z; + armR1._invInertia22 *= armR1._rotFactor.z; + var dst6 = armR1._ptransform; + var src3 = armR1._transform; + dst6._positionX = src3._positionX; + dst6._positionY = src3._positionY; + dst6._positionZ = src3._positionZ; + dst6._rotation00 = src3._rotation00; + dst6._rotation01 = src3._rotation01; + dst6._rotation02 = src3._rotation02; + dst6._rotation10 = src3._rotation10; + dst6._rotation11 = src3._rotation11; + dst6._rotation12 = src3._rotation12; + dst6._rotation20 = src3._rotation20; + dst6._rotation21 = src3._rotation21; + dst6._rotation22 = src3._rotation22; + var s3 = armR1._shapeList; + while(s3 != null) { + var n2 = s3._next; + var tf12 = armR1._ptransform; + var tf22 = armR1._transform; + var dst7 = s3._ptransform; + var src14 = s3._localTransform; + var __tmp__0010; + var __tmp__0110; + var __tmp__0210; + var __tmp__1010; + var __tmp__1110; + var __tmp__1210; + var __tmp__2010; + var __tmp__2110; + var __tmp__2210; + __tmp__0010 = tf12._rotation00 * src14._rotation00 + tf12._rotation01 * src14._rotation10 + tf12._rotation02 * src14._rotation20; + __tmp__0110 = tf12._rotation00 * src14._rotation01 + tf12._rotation01 * src14._rotation11 + tf12._rotation02 * src14._rotation21; + __tmp__0210 = tf12._rotation00 * src14._rotation02 + tf12._rotation01 * src14._rotation12 + tf12._rotation02 * src14._rotation22; + __tmp__1010 = tf12._rotation10 * src14._rotation00 + tf12._rotation11 * src14._rotation10 + tf12._rotation12 * src14._rotation20; + __tmp__1110 = tf12._rotation10 * src14._rotation01 + tf12._rotation11 * src14._rotation11 + tf12._rotation12 * src14._rotation21; + __tmp__1210 = tf12._rotation10 * src14._rotation02 + tf12._rotation11 * src14._rotation12 + tf12._rotation12 * src14._rotation22; + __tmp__2010 = tf12._rotation20 * src14._rotation00 + tf12._rotation21 * src14._rotation10 + tf12._rotation22 * src14._rotation20; + __tmp__2110 = tf12._rotation20 * src14._rotation01 + tf12._rotation21 * src14._rotation11 + tf12._rotation22 * src14._rotation21; + __tmp__2210 = tf12._rotation20 * src14._rotation02 + tf12._rotation21 * src14._rotation12 + tf12._rotation22 * src14._rotation22; + dst7._rotation00 = __tmp__0010; + dst7._rotation01 = __tmp__0110; + dst7._rotation02 = __tmp__0210; + dst7._rotation10 = __tmp__1010; + dst7._rotation11 = __tmp__1110; + dst7._rotation12 = __tmp__1210; + dst7._rotation20 = __tmp__2010; + dst7._rotation21 = __tmp__2110; + dst7._rotation22 = __tmp__2210; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf12._rotation00 * src14._positionX + tf12._rotation01 * src14._positionY + tf12._rotation02 * src14._positionZ; + __tmp__Y4 = tf12._rotation10 * src14._positionX + tf12._rotation11 * src14._positionY + tf12._rotation12 * src14._positionZ; + __tmp__Z4 = tf12._rotation20 * src14._positionX + tf12._rotation21 * src14._positionY + tf12._rotation22 * src14._positionZ; + dst7._positionX = __tmp__X4; + dst7._positionY = __tmp__Y4; + dst7._positionZ = __tmp__Z4; + dst7._positionX += tf12._positionX; + dst7._positionY += tf12._positionY; + dst7._positionZ += tf12._positionZ; + var dst8 = s3._transform; + var src15 = s3._localTransform; + var __tmp__0011; + var __tmp__0111; + var __tmp__0211; + var __tmp__1011; + var __tmp__1111; + var __tmp__1211; + var __tmp__2011; + var __tmp__2111; + var __tmp__2211; + __tmp__0011 = tf22._rotation00 * src15._rotation00 + tf22._rotation01 * src15._rotation10 + tf22._rotation02 * src15._rotation20; + __tmp__0111 = tf22._rotation00 * src15._rotation01 + tf22._rotation01 * src15._rotation11 + tf22._rotation02 * src15._rotation21; + __tmp__0211 = tf22._rotation00 * src15._rotation02 + tf22._rotation01 * src15._rotation12 + tf22._rotation02 * src15._rotation22; + __tmp__1011 = tf22._rotation10 * src15._rotation00 + tf22._rotation11 * src15._rotation10 + tf22._rotation12 * src15._rotation20; + __tmp__1111 = tf22._rotation10 * src15._rotation01 + tf22._rotation11 * src15._rotation11 + tf22._rotation12 * src15._rotation21; + __tmp__1211 = tf22._rotation10 * src15._rotation02 + tf22._rotation11 * src15._rotation12 + tf22._rotation12 * src15._rotation22; + __tmp__2011 = tf22._rotation20 * src15._rotation00 + tf22._rotation21 * src15._rotation10 + tf22._rotation22 * src15._rotation20; + __tmp__2111 = tf22._rotation20 * src15._rotation01 + tf22._rotation21 * src15._rotation11 + tf22._rotation22 * src15._rotation21; + __tmp__2211 = tf22._rotation20 * src15._rotation02 + tf22._rotation21 * src15._rotation12 + tf22._rotation22 * src15._rotation22; + dst8._rotation00 = __tmp__0011; + dst8._rotation01 = __tmp__0111; + dst8._rotation02 = __tmp__0211; + dst8._rotation10 = __tmp__1011; + dst8._rotation11 = __tmp__1111; + dst8._rotation12 = __tmp__1211; + dst8._rotation20 = __tmp__2011; + dst8._rotation21 = __tmp__2111; + dst8._rotation22 = __tmp__2211; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf22._rotation00 * src15._positionX + tf22._rotation01 * src15._positionY + tf22._rotation02 * src15._positionZ; + __tmp__Y5 = tf22._rotation10 * src15._positionX + tf22._rotation11 * src15._positionY + tf22._rotation12 * src15._positionZ; + __tmp__Z5 = tf22._rotation20 * src15._positionX + tf22._rotation21 * src15._positionY + tf22._rotation22 * src15._positionZ; + dst8._positionX = __tmp__X5; + dst8._positionY = __tmp__Y5; + dst8._positionZ = __tmp__Z5; + dst8._positionX += tf22._positionX; + dst8._positionY += tf22._positionY; + dst8._positionZ += tf22._positionZ; + var minX2; + var minY2; + var minZ2; + var maxX2; + var maxY2; + var maxZ2; + s3._geom._computeAabb(s3._aabb,s3._ptransform); + minX2 = s3._aabb._minX; + minY2 = s3._aabb._minY; + minZ2 = s3._aabb._minZ; + maxX2 = s3._aabb._maxX; + maxY2 = s3._aabb._maxY; + maxZ2 = s3._aabb._maxZ; + s3._geom._computeAabb(s3._aabb,s3._transform); + s3._aabb._minX = minX2 < s3._aabb._minX ? minX2 : s3._aabb._minX; + s3._aabb._minY = minY2 < s3._aabb._minY ? minY2 : s3._aabb._minY; + s3._aabb._minZ = minZ2 < s3._aabb._minZ ? minZ2 : s3._aabb._minZ; + s3._aabb._maxX = maxX2 > s3._aabb._maxX ? maxX2 : s3._aabb._maxX; + s3._aabb._maxY = maxY2 > s3._aabb._maxY ? maxY2 : s3._aabb._maxY; + s3._aabb._maxZ = maxZ2 > s3._aabb._maxZ ? maxZ2 : s3._aabb._maxZ; + if(s3._proxy != null) { + var dX2; + var dY2; + var dZ2; + dX2 = s3._transform._positionX - s3._ptransform._positionX; + dY2 = s3._transform._positionY - s3._ptransform._positionY; + dZ2 = s3._transform._positionZ - s3._ptransform._positionZ; + var v2 = s3.displacement; + v2.x = dX2; + v2.y = dY2; + v2.z = dZ2; + s3._rigidBody._world._broadPhase.moveProxy(s3._proxy,s3._aabb,s3.displacement); + } + s3 = n2; + } + armR1._sleeping = false; + armR1._sleepTime = 0; + armR2._transform._rotation00 = e00; + armR2._transform._rotation01 = e01; + armR2._transform._rotation02 = e02; + armR2._transform._rotation10 = e10; + armR2._transform._rotation11 = e11; + armR2._transform._rotation12 = e12; + armR2._transform._rotation20 = e20; + armR2._transform._rotation21 = e21; + armR2._transform._rotation22 = e22; + var __tmp__0012; + var __tmp__0112; + var __tmp__0212; + var __tmp__1012; + var __tmp__1112; + var __tmp__1212; + var __tmp__2012; + var __tmp__2112; + var __tmp__2212; + __tmp__0012 = armR2._transform._rotation00 * armR2._invLocalInertia00 + armR2._transform._rotation01 * armR2._invLocalInertia10 + armR2._transform._rotation02 * armR2._invLocalInertia20; + __tmp__0112 = armR2._transform._rotation00 * armR2._invLocalInertia01 + armR2._transform._rotation01 * armR2._invLocalInertia11 + armR2._transform._rotation02 * armR2._invLocalInertia21; + __tmp__0212 = armR2._transform._rotation00 * armR2._invLocalInertia02 + armR2._transform._rotation01 * armR2._invLocalInertia12 + armR2._transform._rotation02 * armR2._invLocalInertia22; + __tmp__1012 = armR2._transform._rotation10 * armR2._invLocalInertia00 + armR2._transform._rotation11 * armR2._invLocalInertia10 + armR2._transform._rotation12 * armR2._invLocalInertia20; + __tmp__1112 = armR2._transform._rotation10 * armR2._invLocalInertia01 + armR2._transform._rotation11 * armR2._invLocalInertia11 + armR2._transform._rotation12 * armR2._invLocalInertia21; + __tmp__1212 = armR2._transform._rotation10 * armR2._invLocalInertia02 + armR2._transform._rotation11 * armR2._invLocalInertia12 + armR2._transform._rotation12 * armR2._invLocalInertia22; + __tmp__2012 = armR2._transform._rotation20 * armR2._invLocalInertia00 + armR2._transform._rotation21 * armR2._invLocalInertia10 + armR2._transform._rotation22 * armR2._invLocalInertia20; + __tmp__2112 = armR2._transform._rotation20 * armR2._invLocalInertia01 + armR2._transform._rotation21 * armR2._invLocalInertia11 + armR2._transform._rotation22 * armR2._invLocalInertia21; + __tmp__2212 = armR2._transform._rotation20 * armR2._invLocalInertia02 + armR2._transform._rotation21 * armR2._invLocalInertia12 + armR2._transform._rotation22 * armR2._invLocalInertia22; + armR2._invInertia00 = __tmp__0012; + armR2._invInertia01 = __tmp__0112; + armR2._invInertia02 = __tmp__0212; + armR2._invInertia10 = __tmp__1012; + armR2._invInertia11 = __tmp__1112; + armR2._invInertia12 = __tmp__1212; + armR2._invInertia20 = __tmp__2012; + armR2._invInertia21 = __tmp__2112; + armR2._invInertia22 = __tmp__2212; + var __tmp__0013; + var __tmp__0113; + var __tmp__0213; + var __tmp__1013; + var __tmp__1113; + var __tmp__1213; + var __tmp__2013; + var __tmp__2113; + var __tmp__2213; + __tmp__0013 = armR2._invInertia00 * armR2._transform._rotation00 + armR2._invInertia01 * armR2._transform._rotation01 + armR2._invInertia02 * armR2._transform._rotation02; + __tmp__0113 = armR2._invInertia00 * armR2._transform._rotation10 + armR2._invInertia01 * armR2._transform._rotation11 + armR2._invInertia02 * armR2._transform._rotation12; + __tmp__0213 = armR2._invInertia00 * armR2._transform._rotation20 + armR2._invInertia01 * armR2._transform._rotation21 + armR2._invInertia02 * armR2._transform._rotation22; + __tmp__1013 = armR2._invInertia10 * armR2._transform._rotation00 + armR2._invInertia11 * armR2._transform._rotation01 + armR2._invInertia12 * armR2._transform._rotation02; + __tmp__1113 = armR2._invInertia10 * armR2._transform._rotation10 + armR2._invInertia11 * armR2._transform._rotation11 + armR2._invInertia12 * armR2._transform._rotation12; + __tmp__1213 = armR2._invInertia10 * armR2._transform._rotation20 + armR2._invInertia11 * armR2._transform._rotation21 + armR2._invInertia12 * armR2._transform._rotation22; + __tmp__2013 = armR2._invInertia20 * armR2._transform._rotation00 + armR2._invInertia21 * armR2._transform._rotation01 + armR2._invInertia22 * armR2._transform._rotation02; + __tmp__2113 = armR2._invInertia20 * armR2._transform._rotation10 + armR2._invInertia21 * armR2._transform._rotation11 + armR2._invInertia22 * armR2._transform._rotation12; + __tmp__2213 = armR2._invInertia20 * armR2._transform._rotation20 + armR2._invInertia21 * armR2._transform._rotation21 + armR2._invInertia22 * armR2._transform._rotation22; + armR2._invInertia00 = __tmp__0013; + armR2._invInertia01 = __tmp__0113; + armR2._invInertia02 = __tmp__0213; + armR2._invInertia10 = __tmp__1013; + armR2._invInertia11 = __tmp__1113; + armR2._invInertia12 = __tmp__1213; + armR2._invInertia20 = __tmp__2013; + armR2._invInertia21 = __tmp__2113; + armR2._invInertia22 = __tmp__2213; + armR2._invInertia00 *= armR2._rotFactor.x; + armR2._invInertia01 *= armR2._rotFactor.x; + armR2._invInertia02 *= armR2._rotFactor.x; + armR2._invInertia10 *= armR2._rotFactor.y; + armR2._invInertia11 *= armR2._rotFactor.y; + armR2._invInertia12 *= armR2._rotFactor.y; + armR2._invInertia20 *= armR2._rotFactor.z; + armR2._invInertia21 *= armR2._rotFactor.z; + armR2._invInertia22 *= armR2._rotFactor.z; + var dst9 = armR2._ptransform; + var src4 = armR2._transform; + dst9._positionX = src4._positionX; + dst9._positionY = src4._positionY; + dst9._positionZ = src4._positionZ; + dst9._rotation00 = src4._rotation00; + dst9._rotation01 = src4._rotation01; + dst9._rotation02 = src4._rotation02; + dst9._rotation10 = src4._rotation10; + dst9._rotation11 = src4._rotation11; + dst9._rotation12 = src4._rotation12; + dst9._rotation20 = src4._rotation20; + dst9._rotation21 = src4._rotation21; + dst9._rotation22 = src4._rotation22; + var s4 = armR2._shapeList; + while(s4 != null) { + var n3 = s4._next; + var tf13 = armR2._ptransform; + var tf23 = armR2._transform; + var dst10 = s4._ptransform; + var src16 = s4._localTransform; + var __tmp__0014; + var __tmp__0114; + var __tmp__0214; + var __tmp__1014; + var __tmp__1114; + var __tmp__1214; + var __tmp__2014; + var __tmp__2114; + var __tmp__2214; + __tmp__0014 = tf13._rotation00 * src16._rotation00 + tf13._rotation01 * src16._rotation10 + tf13._rotation02 * src16._rotation20; + __tmp__0114 = tf13._rotation00 * src16._rotation01 + tf13._rotation01 * src16._rotation11 + tf13._rotation02 * src16._rotation21; + __tmp__0214 = tf13._rotation00 * src16._rotation02 + tf13._rotation01 * src16._rotation12 + tf13._rotation02 * src16._rotation22; + __tmp__1014 = tf13._rotation10 * src16._rotation00 + tf13._rotation11 * src16._rotation10 + tf13._rotation12 * src16._rotation20; + __tmp__1114 = tf13._rotation10 * src16._rotation01 + tf13._rotation11 * src16._rotation11 + tf13._rotation12 * src16._rotation21; + __tmp__1214 = tf13._rotation10 * src16._rotation02 + tf13._rotation11 * src16._rotation12 + tf13._rotation12 * src16._rotation22; + __tmp__2014 = tf13._rotation20 * src16._rotation00 + tf13._rotation21 * src16._rotation10 + tf13._rotation22 * src16._rotation20; + __tmp__2114 = tf13._rotation20 * src16._rotation01 + tf13._rotation21 * src16._rotation11 + tf13._rotation22 * src16._rotation21; + __tmp__2214 = tf13._rotation20 * src16._rotation02 + tf13._rotation21 * src16._rotation12 + tf13._rotation22 * src16._rotation22; + dst10._rotation00 = __tmp__0014; + dst10._rotation01 = __tmp__0114; + dst10._rotation02 = __tmp__0214; + dst10._rotation10 = __tmp__1014; + dst10._rotation11 = __tmp__1114; + dst10._rotation12 = __tmp__1214; + dst10._rotation20 = __tmp__2014; + dst10._rotation21 = __tmp__2114; + dst10._rotation22 = __tmp__2214; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf13._rotation00 * src16._positionX + tf13._rotation01 * src16._positionY + tf13._rotation02 * src16._positionZ; + __tmp__Y6 = tf13._rotation10 * src16._positionX + tf13._rotation11 * src16._positionY + tf13._rotation12 * src16._positionZ; + __tmp__Z6 = tf13._rotation20 * src16._positionX + tf13._rotation21 * src16._positionY + tf13._rotation22 * src16._positionZ; + dst10._positionX = __tmp__X6; + dst10._positionY = __tmp__Y6; + dst10._positionZ = __tmp__Z6; + dst10._positionX += tf13._positionX; + dst10._positionY += tf13._positionY; + dst10._positionZ += tf13._positionZ; + var dst11 = s4._transform; + var src17 = s4._localTransform; + var __tmp__0015; + var __tmp__0115; + var __tmp__0215; + var __tmp__1015; + var __tmp__1115; + var __tmp__1215; + var __tmp__2015; + var __tmp__2115; + var __tmp__2215; + __tmp__0015 = tf23._rotation00 * src17._rotation00 + tf23._rotation01 * src17._rotation10 + tf23._rotation02 * src17._rotation20; + __tmp__0115 = tf23._rotation00 * src17._rotation01 + tf23._rotation01 * src17._rotation11 + tf23._rotation02 * src17._rotation21; + __tmp__0215 = tf23._rotation00 * src17._rotation02 + tf23._rotation01 * src17._rotation12 + tf23._rotation02 * src17._rotation22; + __tmp__1015 = tf23._rotation10 * src17._rotation00 + tf23._rotation11 * src17._rotation10 + tf23._rotation12 * src17._rotation20; + __tmp__1115 = tf23._rotation10 * src17._rotation01 + tf23._rotation11 * src17._rotation11 + tf23._rotation12 * src17._rotation21; + __tmp__1215 = tf23._rotation10 * src17._rotation02 + tf23._rotation11 * src17._rotation12 + tf23._rotation12 * src17._rotation22; + __tmp__2015 = tf23._rotation20 * src17._rotation00 + tf23._rotation21 * src17._rotation10 + tf23._rotation22 * src17._rotation20; + __tmp__2115 = tf23._rotation20 * src17._rotation01 + tf23._rotation21 * src17._rotation11 + tf23._rotation22 * src17._rotation21; + __tmp__2215 = tf23._rotation20 * src17._rotation02 + tf23._rotation21 * src17._rotation12 + tf23._rotation22 * src17._rotation22; + dst11._rotation00 = __tmp__0015; + dst11._rotation01 = __tmp__0115; + dst11._rotation02 = __tmp__0215; + dst11._rotation10 = __tmp__1015; + dst11._rotation11 = __tmp__1115; + dst11._rotation12 = __tmp__1215; + dst11._rotation20 = __tmp__2015; + dst11._rotation21 = __tmp__2115; + dst11._rotation22 = __tmp__2215; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf23._rotation00 * src17._positionX + tf23._rotation01 * src17._positionY + tf23._rotation02 * src17._positionZ; + __tmp__Y7 = tf23._rotation10 * src17._positionX + tf23._rotation11 * src17._positionY + tf23._rotation12 * src17._positionZ; + __tmp__Z7 = tf23._rotation20 * src17._positionX + tf23._rotation21 * src17._positionY + tf23._rotation22 * src17._positionZ; + dst11._positionX = __tmp__X7; + dst11._positionY = __tmp__Y7; + dst11._positionZ = __tmp__Z7; + dst11._positionX += tf23._positionX; + dst11._positionY += tf23._positionY; + dst11._positionZ += tf23._positionZ; + var minX3; + var minY3; + var minZ3; + var maxX3; + var maxY3; + var maxZ3; + s4._geom._computeAabb(s4._aabb,s4._ptransform); + minX3 = s4._aabb._minX; + minY3 = s4._aabb._minY; + minZ3 = s4._aabb._minZ; + maxX3 = s4._aabb._maxX; + maxY3 = s4._aabb._maxY; + maxZ3 = s4._aabb._maxZ; + s4._geom._computeAabb(s4._aabb,s4._transform); + s4._aabb._minX = minX3 < s4._aabb._minX ? minX3 : s4._aabb._minX; + s4._aabb._minY = minY3 < s4._aabb._minY ? minY3 : s4._aabb._minY; + s4._aabb._minZ = minZ3 < s4._aabb._minZ ? minZ3 : s4._aabb._minZ; + s4._aabb._maxX = maxX3 > s4._aabb._maxX ? maxX3 : s4._aabb._maxX; + s4._aabb._maxY = maxY3 > s4._aabb._maxY ? maxY3 : s4._aabb._maxY; + s4._aabb._maxZ = maxZ3 > s4._aabb._maxZ ? maxZ3 : s4._aabb._maxZ; + if(s4._proxy != null) { + var dX3; + var dY3; + var dZ3; + dX3 = s4._transform._positionX - s4._ptransform._positionX; + dY3 = s4._transform._positionY - s4._ptransform._positionY; + dZ3 = s4._transform._positionZ - s4._ptransform._positionZ; + var v3 = s4.displacement; + v3.x = dX3; + v3.y = dY3; + v3.z = dZ3; + s4._rigidBody._world._broadPhase.moveProxy(s4._proxy,s4._aabb,s4.displacement); + } + s4 = n3; + } + armR2._sleeping = false; + armR2._sleepTime = 0; + var x = new oimo_common_Vec3(1,0,0); + var y = new oimo_common_Vec3(0,1,0); + var z = new oimo_common_Vec3(0,0,1); + var sd = new oimo_dynamics_constraint_joint_SpringDamper(); + sd.setSpring(10,1); + var lm180 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.570796326794895,1.570796326794895); + var lm90 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.7853981633974475,0.7853981633974475); + var lmElbow = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0.,2.7925268031909245); + var lmKnee = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0.,2.7925268031909245); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRagdollJoint(w,body1,head,new oimo_common_Vec3(pos.x + 0,pos.y + 0.89999999999999991,pos.z + 0),y,x,sd,90,70,sd,lm180); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRagdollJoint(w,body1,body2,new oimo_common_Vec3(pos.x + 0,pos.y + 0.35,pos.z + 0),y,x,sd,60,45,sd,lm90); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRagdollJoint(w,body1,armL1,new oimo_common_Vec3(pos.x + (-0.2),pos.y + 0.7,pos.z + 0),x,z,sd,90,90,sd,lm180); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRagdollJoint(w,body1,armR1,new oimo_common_Vec3(pos.x + 0.2,pos.y + 0.7,pos.z + 0),new oimo_common_Vec3(-x.x,-x.y,-x.z),z,sd,90,90,sd,lm180); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRevoluteJoint(w,armL1,armL2,new oimo_common_Vec3(pos.x + (-0.55),pos.y + 0.7,pos.z + 0),y,sd,lmElbow); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRevoluteJoint(w,armR1,armR2,new oimo_common_Vec3(pos.x + 0.55,pos.y + 0.7,pos.z + 0),new oimo_common_Vec3(-y.x,-y.y,-y.z),sd,lmElbow); + var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); + jc.swingSpringDamper = sd; + jc.maxSwingAngle1 = 1.570796326794895; + jc.maxSwingAngle2 = 1.2217304763960295; + jc.twistSpringDamper = sd; + jc.twistLimitMotor = lm180; + oimo_common_Vec3.numCreations++; + jc.init(body2,legL1,new oimo_common_Vec3(pos.x + (-0.15),pos.y + (-0.15),pos.z + 0),y,x); + jc.localTwistAxis1 = new oimo_common_Vec3(-z.x,-z.y,-z.z); + w.addJoint(new oimo_dynamics_constraint_joint_RagdollJoint(jc)); + oimo_common_Vec3.numCreations++; + jc.init(body2,legR1,new oimo_common_Vec3(pos.x + 0.15,pos.y + (-0.15),pos.z + 0),y,x); + jc.localTwistAxis1 = new oimo_common_Vec3(-z.x,-z.y,-z.z); + w.addJoint(new oimo_dynamics_constraint_joint_RagdollJoint(jc)); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRevoluteJoint(w,legL1,legL2,new oimo_common_Vec3(pos.x + (-0.15),pos.y + (-0.65),pos.z + 0),x,sd,lmKnee); + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRevoluteJoint(w,legR1,legR2,new oimo_common_Vec3(pos.x + 0.15,pos.y + (-0.65),pos.z + 0),x,sd,lmKnee); + return body1; +}; +var demo_common_UserInput = function() { + this.pmouseX = 0; + this.pmouseY = 0; + this.pmouseL = false; + this.pmouseR = false; + this.mouseX = 0; + this.mouseY = 0; + this.mouseL = false; + this.mouseR = false; + this.pkeyboard = new Array(demo_common_UserInput.KEYBOARD_LENGTH); + this.keyboard = new Array(demo_common_UserInput.KEYBOARD_LENGTH); + var _g = 0; + var _g1 = demo_common_UserInput.KEYBOARD_LENGTH; + while(_g < _g1) { + var i = _g++; + this.pkeyboard[i] = false; + this.keyboard[i] = false; + } +}; +demo_common_UserInput.__name__ = true; +demo_common_UserInput.prototype = { + isKeyPressed: function(char,code) { + if(code == null) { + code = -1; + } + if(char != null) { + code = HxOverrides.cca(char,0); + } + if(code < 0 || code >= demo_common_UserInput.KEYBOARD_LENGTH) { + return false; + } + if(!this.pkeyboard[code]) { + return this.keyboard[code]; + } else { + return false; + } + } + ,__class__: demo_common_UserInput +}; +var demo_common_ViewInfo = function() { +}; +demo_common_ViewInfo.__name__ = true; +demo_common_ViewInfo.prototype = { + __class__: demo_common_ViewInfo +}; +var demo_core_BasicDemo = function() { + demo_common_DemoBase.call(this,"Basic Demo"); +}; +demo_core_BasicDemo.__name__ = true; +demo_core_BasicDemo.__super__ = demo_common_DemoBase; +demo_core_BasicDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var _g = 0; + while(_g < 5) { + var i = _g++; + var _g1 = -2; + while(_g1 < 3) { + var j = _g1++; + var _g2 = -2; + while(_g2 < 3) { + var box = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.61,0.3 + i * 0.3 * 3,_g2++ * 0.61),new oimo_common_Vec3(0.3,0.3,0.3),false); + var x = -0.05 + Math.random() * 0.1; + var y = -0.05 + Math.random() * 0.1; + var z = -0.05 + Math.random() * 0.1; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + if(box._type == 1) { + box._angVelX = 0; + box._angVelY = 0; + box._angVelZ = 0; + } else { + box._angVelX = x; + box._angVelY = y; + box._angVelZ = z; + } + box._sleeping = false; + box._sleepTime = 0; + } + } + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_BasicDemo +}); +var demo_core_BreakableJointDemo = function() { + demo_common_DemoBase.call(this,"Breakable Joint"); +}; +demo_core_BreakableJointDemo.__name__ = true; +demo_core_BreakableJointDemo.__super__ = demo_common_DemoBase; +demo_core_BreakableJointDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var chain = []; + chain.push(demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(0,6,0),0.3,true)); + var _g = 0; + while(_g < 12) { + var i = _g++; + chain.push(i % 2 == 0 ? demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3((i + 1) * 0.4,6,0),0.25,false) : demo_common_OimoUtil.addBox(world,new oimo_common_Vec3((i + 1) * 0.4,6,0),new oimo_common_Vec3(0.25,0.25,0.25),false)); + var _this1 = chain[i]; + var x = -1 + Math.random() * 2; + var y = -1 + Math.random() * 2; + var z = -1 + Math.random() * 2; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + var v_x = x; + var v_y = y; + var v_z = z; + oimo_common_Vec3.numCreations++; + var x1 = v_x * 0.05; + var y1 = v_y * 0.05; + var z1 = v_z * 0.05; + v_x = x1; + v_y = y1; + v_z = z1; + if(_this1._type == 1) { + _this1._velX = 0; + _this1._velY = 0; + _this1._velZ = 0; + } else { + _this1._velX = x1; + _this1._velY = y1; + _this1._velZ = z1; + } + _this1._sleeping = false; + _this1._sleepTime = 0; + } + var _g1 = 1; + var _g2 = chain.length; + while(_g1 < _g2) { + var i1 = _g1++; + var center; + if(i1 == 1) { + var _this2 = chain[0]; + var v = new oimo_common_Vec3(); + v.x = _this2._transform._positionX; + v.y = _this2._transform._positionY; + v.z = _this2._transform._positionZ; + center = v; + } else { + var _this3 = chain[i1 - 1]; + var v1 = new oimo_common_Vec3(); + v1.x = _this3._transform._positionX; + v1.y = _this3._transform._positionY; + v1.z = _this3._transform._positionZ; + var _this4 = chain[i1]; + var v_x1 = 0; + var v_y1 = 0; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + v_x1 = _this4._transform._positionX; + v_y1 = _this4._transform._positionY; + v_z1 = _this4._transform._positionZ; + v1.x += v_x1; + v1.y += v_y1; + v1.z += v_z1; + v1.x *= 0.5; + v1.y *= 0.5; + v1.z *= 0.5; + center = v1; + } + demo_common_OimoUtil.addSphericalJoint(world,chain[i1 - 1],chain[i1],center)._breakForce = 100; + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_BreakableJointDemo +}); +var demo_core_BridgeDemo = function() { + demo_common_DemoBase.call(this,"Bridge"); +}; +demo_core_BridgeDemo.__name__ = true; +demo_core_BridgeDemo.__super__ = demo_common_DemoBase; +demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 8; + var eye_z = 12; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + var _g = 0; + while(_g < 5) { + ++_g; + var _this1 = demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.8,false)._shapeList; + _this1._density = 0.3; + if(_this1._rigidBody != null) { + var _this2 = _this1._rigidBody; + _this2.updateMass(); + var s = _this2._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this2._ptransform; + var tf2 = _this2._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + var _this3 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),new oimo_common_Vec3(0.5,0.5,0.5),false)._shapeList; + _this3._density = 0.3; + if(_this3._rigidBody != null) { + var _this4 = _this3._rigidBody; + _this4.updateMass(); + var s1 = _this4._shapeList; + while(s1 != null) { + var n1 = s1._next; + var tf11 = _this4._ptransform; + var tf21 = _this4._transform; + var dst2 = s1._ptransform; + var src12 = s1._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__012 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__022 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__102 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__112 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__122 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__202 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__212 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__222 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst2._rotation00 = __tmp__002; + dst2._rotation01 = __tmp__012; + dst2._rotation02 = __tmp__022; + dst2._rotation10 = __tmp__102; + dst2._rotation11 = __tmp__112; + dst2._rotation12 = __tmp__122; + dst2._rotation20 = __tmp__202; + dst2._rotation21 = __tmp__212; + dst2._rotation22 = __tmp__222; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst2._positionX = __tmp__X2; + dst2._positionY = __tmp__Y2; + dst2._positionZ = __tmp__Z2; + dst2._positionX += tf11._positionX; + dst2._positionY += tf11._positionY; + dst2._positionZ += tf11._positionZ; + var dst3 = s1._transform; + var src13 = s1._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__013 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__023 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__103 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__113 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__123 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__203 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__213 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__223 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst3._rotation00 = __tmp__003; + dst3._rotation01 = __tmp__013; + dst3._rotation02 = __tmp__023; + dst3._rotation10 = __tmp__103; + dst3._rotation11 = __tmp__113; + dst3._rotation12 = __tmp__123; + dst3._rotation20 = __tmp__203; + dst3._rotation21 = __tmp__213; + dst3._rotation22 = __tmp__223; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst3._positionX = __tmp__X3; + dst3._positionY = __tmp__Y3; + dst3._positionZ = __tmp__Z3; + dst3._positionX += tf21._positionX; + dst3._positionY += tf21._positionY; + dst3._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s1._geom._computeAabb(s1._aabb,s1._ptransform); + minX1 = s1._aabb._minX; + minY1 = s1._aabb._minY; + minZ1 = s1._aabb._minZ; + maxX1 = s1._aabb._maxX; + maxY1 = s1._aabb._maxY; + maxZ1 = s1._aabb._maxZ; + s1._geom._computeAabb(s1._aabb,s1._transform); + s1._aabb._minX = minX1 < s1._aabb._minX ? minX1 : s1._aabb._minX; + s1._aabb._minY = minY1 < s1._aabb._minY ? minY1 : s1._aabb._minY; + s1._aabb._minZ = minZ1 < s1._aabb._minZ ? minZ1 : s1._aabb._minZ; + s1._aabb._maxX = maxX1 > s1._aabb._maxX ? maxX1 : s1._aabb._maxX; + s1._aabb._maxY = maxY1 > s1._aabb._maxY ? maxY1 : s1._aabb._maxY; + s1._aabb._maxZ = maxZ1 > s1._aabb._maxZ ? maxZ1 : s1._aabb._maxZ; + if(s1._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s1._transform._positionX - s1._ptransform._positionX; + dY1 = s1._transform._positionY - s1._ptransform._positionY; + dZ1 = s1._transform._positionZ - s1._ptransform._positionZ; + var v1 = s1.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + } + s1 = n1; + } + } + var _this5 = demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.6,0.6,false)._shapeList; + _this5._density = 0.3; + if(_this5._rigidBody != null) { + var _this6 = _this5._rigidBody; + _this6.updateMass(); + var s2 = _this6._shapeList; + while(s2 != null) { + var n2 = s2._next; + var tf12 = _this6._ptransform; + var tf22 = _this6._transform; + var dst4 = s2._ptransform; + var src14 = s2._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf12._rotation00 * src14._rotation00 + tf12._rotation01 * src14._rotation10 + tf12._rotation02 * src14._rotation20; + __tmp__014 = tf12._rotation00 * src14._rotation01 + tf12._rotation01 * src14._rotation11 + tf12._rotation02 * src14._rotation21; + __tmp__024 = tf12._rotation00 * src14._rotation02 + tf12._rotation01 * src14._rotation12 + tf12._rotation02 * src14._rotation22; + __tmp__104 = tf12._rotation10 * src14._rotation00 + tf12._rotation11 * src14._rotation10 + tf12._rotation12 * src14._rotation20; + __tmp__114 = tf12._rotation10 * src14._rotation01 + tf12._rotation11 * src14._rotation11 + tf12._rotation12 * src14._rotation21; + __tmp__124 = tf12._rotation10 * src14._rotation02 + tf12._rotation11 * src14._rotation12 + tf12._rotation12 * src14._rotation22; + __tmp__204 = tf12._rotation20 * src14._rotation00 + tf12._rotation21 * src14._rotation10 + tf12._rotation22 * src14._rotation20; + __tmp__214 = tf12._rotation20 * src14._rotation01 + tf12._rotation21 * src14._rotation11 + tf12._rotation22 * src14._rotation21; + __tmp__224 = tf12._rotation20 * src14._rotation02 + tf12._rotation21 * src14._rotation12 + tf12._rotation22 * src14._rotation22; + dst4._rotation00 = __tmp__004; + dst4._rotation01 = __tmp__014; + dst4._rotation02 = __tmp__024; + dst4._rotation10 = __tmp__104; + dst4._rotation11 = __tmp__114; + dst4._rotation12 = __tmp__124; + dst4._rotation20 = __tmp__204; + dst4._rotation21 = __tmp__214; + dst4._rotation22 = __tmp__224; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf12._rotation00 * src14._positionX + tf12._rotation01 * src14._positionY + tf12._rotation02 * src14._positionZ; + __tmp__Y4 = tf12._rotation10 * src14._positionX + tf12._rotation11 * src14._positionY + tf12._rotation12 * src14._positionZ; + __tmp__Z4 = tf12._rotation20 * src14._positionX + tf12._rotation21 * src14._positionY + tf12._rotation22 * src14._positionZ; + dst4._positionX = __tmp__X4; + dst4._positionY = __tmp__Y4; + dst4._positionZ = __tmp__Z4; + dst4._positionX += tf12._positionX; + dst4._positionY += tf12._positionY; + dst4._positionZ += tf12._positionZ; + var dst5 = s2._transform; + var src15 = s2._localTransform; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = tf22._rotation00 * src15._rotation00 + tf22._rotation01 * src15._rotation10 + tf22._rotation02 * src15._rotation20; + __tmp__015 = tf22._rotation00 * src15._rotation01 + tf22._rotation01 * src15._rotation11 + tf22._rotation02 * src15._rotation21; + __tmp__025 = tf22._rotation00 * src15._rotation02 + tf22._rotation01 * src15._rotation12 + tf22._rotation02 * src15._rotation22; + __tmp__105 = tf22._rotation10 * src15._rotation00 + tf22._rotation11 * src15._rotation10 + tf22._rotation12 * src15._rotation20; + __tmp__115 = tf22._rotation10 * src15._rotation01 + tf22._rotation11 * src15._rotation11 + tf22._rotation12 * src15._rotation21; + __tmp__125 = tf22._rotation10 * src15._rotation02 + tf22._rotation11 * src15._rotation12 + tf22._rotation12 * src15._rotation22; + __tmp__205 = tf22._rotation20 * src15._rotation00 + tf22._rotation21 * src15._rotation10 + tf22._rotation22 * src15._rotation20; + __tmp__215 = tf22._rotation20 * src15._rotation01 + tf22._rotation21 * src15._rotation11 + tf22._rotation22 * src15._rotation21; + __tmp__225 = tf22._rotation20 * src15._rotation02 + tf22._rotation21 * src15._rotation12 + tf22._rotation22 * src15._rotation22; + dst5._rotation00 = __tmp__005; + dst5._rotation01 = __tmp__015; + dst5._rotation02 = __tmp__025; + dst5._rotation10 = __tmp__105; + dst5._rotation11 = __tmp__115; + dst5._rotation12 = __tmp__125; + dst5._rotation20 = __tmp__205; + dst5._rotation21 = __tmp__215; + dst5._rotation22 = __tmp__225; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf22._rotation00 * src15._positionX + tf22._rotation01 * src15._positionY + tf22._rotation02 * src15._positionZ; + __tmp__Y5 = tf22._rotation10 * src15._positionX + tf22._rotation11 * src15._positionY + tf22._rotation12 * src15._positionZ; + __tmp__Z5 = tf22._rotation20 * src15._positionX + tf22._rotation21 * src15._positionY + tf22._rotation22 * src15._positionZ; + dst5._positionX = __tmp__X5; + dst5._positionY = __tmp__Y5; + dst5._positionZ = __tmp__Z5; + dst5._positionX += tf22._positionX; + dst5._positionY += tf22._positionY; + dst5._positionZ += tf22._positionZ; + var minX2; + var minY2; + var minZ2; + var maxX2; + var maxY2; + var maxZ2; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX2 = s2._aabb._minX; + minY2 = s2._aabb._minY; + minZ2 = s2._aabb._minZ; + maxX2 = s2._aabb._maxX; + maxY2 = s2._aabb._maxY; + maxZ2 = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX2 < s2._aabb._minX ? minX2 : s2._aabb._minX; + s2._aabb._minY = minY2 < s2._aabb._minY ? minY2 : s2._aabb._minY; + s2._aabb._minZ = minZ2 < s2._aabb._minZ ? minZ2 : s2._aabb._minZ; + s2._aabb._maxX = maxX2 > s2._aabb._maxX ? maxX2 : s2._aabb._maxX; + s2._aabb._maxY = maxY2 > s2._aabb._maxY ? maxY2 : s2._aabb._maxY; + s2._aabb._maxZ = maxZ2 > s2._aabb._maxZ ? maxZ2 : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX2; + var dY2; + var dZ2; + dX2 = s2._transform._positionX - s2._ptransform._positionX; + dY2 = s2._transform._positionY - s2._ptransform._positionY; + dZ2 = s2._transform._positionZ - s2._ptransform._positionZ; + var v2 = s2.displacement; + v2.x = dX2; + v2.y = dY2; + v2.z = dZ2; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n2; + } + } + } + oimo_common_Vec3.numCreations++; + var bodies = []; + var _g1 = 0; + while(_g1 < 20) { + var i = _g1++; + bodies.push(demo_common_OimoUtil.addBox(world,new oimo_common_Vec3((i - 9.5) * 0.75,0,0),new oimo_common_Vec3(0.35,0.15,1.5),i == 0 || i == 19)); + } + var _g3 = 0; + while(_g3 < 19) { + var i1 = _g3++; + var bodies1 = bodies[i1]; + var bodies2 = bodies[i1 + 1]; + var _this7 = bodies[i1]; + var _this_x = 0; + var _this_y = 0; + var _this_z = 0; + oimo_common_Vec3.numCreations++; + _this_x = _this7._transform._positionX; + _this_y = _this7._transform._positionY; + _this_z = _this7._transform._positionZ; + var _this8 = bodies[i1 + 1]; + var v_x = 0; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + v_x = _this8._transform._positionX; + v_y = _this8._transform._positionY; + v_z = _this8._transform._positionZ; + var x = _this_x + v_x; + var y = _this_y + v_y; + var z = _this_z + v_z; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addRevoluteJoint(world,bodies1,bodies2,new oimo_common_Vec3(x * 0.5,y * 0.5,z * 0.5),new oimo_common_Vec3(0,0,1)); + } + var _g5 = 0; + while(_g5 < 20) { + var i2 = _g5++; + var _this9 = bodies[i2]; + var v_x1 = 0; + var v_y1 = 0; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + v_x1 = _this9._transform._positionX; + v_y1 = _this9._transform._positionY; + v_z1 = _this9._transform._positionZ; + v_x1 *= 0.95; + var _this10 = bodies[i2]; + _this10._transform._positionX = v_x1; + _this10._transform._positionY = v_y1; + _this10._transform._positionZ = v_z1; + var dst6 = _this10._ptransform; + var src = _this10._transform; + dst6._positionX = src._positionX; + dst6._positionY = src._positionY; + dst6._positionZ = src._positionZ; + dst6._rotation00 = src._rotation00; + dst6._rotation01 = src._rotation01; + dst6._rotation02 = src._rotation02; + dst6._rotation10 = src._rotation10; + dst6._rotation11 = src._rotation11; + dst6._rotation12 = src._rotation12; + dst6._rotation20 = src._rotation20; + dst6._rotation21 = src._rotation21; + dst6._rotation22 = src._rotation22; + var s3 = _this10._shapeList; + while(s3 != null) { + var n3 = s3._next; + var tf13 = _this10._ptransform; + var tf23 = _this10._transform; + var dst7 = s3._ptransform; + var src16 = s3._localTransform; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = tf13._rotation00 * src16._rotation00 + tf13._rotation01 * src16._rotation10 + tf13._rotation02 * src16._rotation20; + __tmp__016 = tf13._rotation00 * src16._rotation01 + tf13._rotation01 * src16._rotation11 + tf13._rotation02 * src16._rotation21; + __tmp__026 = tf13._rotation00 * src16._rotation02 + tf13._rotation01 * src16._rotation12 + tf13._rotation02 * src16._rotation22; + __tmp__106 = tf13._rotation10 * src16._rotation00 + tf13._rotation11 * src16._rotation10 + tf13._rotation12 * src16._rotation20; + __tmp__116 = tf13._rotation10 * src16._rotation01 + tf13._rotation11 * src16._rotation11 + tf13._rotation12 * src16._rotation21; + __tmp__126 = tf13._rotation10 * src16._rotation02 + tf13._rotation11 * src16._rotation12 + tf13._rotation12 * src16._rotation22; + __tmp__206 = tf13._rotation20 * src16._rotation00 + tf13._rotation21 * src16._rotation10 + tf13._rotation22 * src16._rotation20; + __tmp__216 = tf13._rotation20 * src16._rotation01 + tf13._rotation21 * src16._rotation11 + tf13._rotation22 * src16._rotation21; + __tmp__226 = tf13._rotation20 * src16._rotation02 + tf13._rotation21 * src16._rotation12 + tf13._rotation22 * src16._rotation22; + dst7._rotation00 = __tmp__006; + dst7._rotation01 = __tmp__016; + dst7._rotation02 = __tmp__026; + dst7._rotation10 = __tmp__106; + dst7._rotation11 = __tmp__116; + dst7._rotation12 = __tmp__126; + dst7._rotation20 = __tmp__206; + dst7._rotation21 = __tmp__216; + dst7._rotation22 = __tmp__226; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf13._rotation00 * src16._positionX + tf13._rotation01 * src16._positionY + tf13._rotation02 * src16._positionZ; + __tmp__Y6 = tf13._rotation10 * src16._positionX + tf13._rotation11 * src16._positionY + tf13._rotation12 * src16._positionZ; + __tmp__Z6 = tf13._rotation20 * src16._positionX + tf13._rotation21 * src16._positionY + tf13._rotation22 * src16._positionZ; + dst7._positionX = __tmp__X6; + dst7._positionY = __tmp__Y6; + dst7._positionZ = __tmp__Z6; + dst7._positionX += tf13._positionX; + dst7._positionY += tf13._positionY; + dst7._positionZ += tf13._positionZ; + var dst8 = s3._transform; + var src17 = s3._localTransform; + var __tmp__007; + var __tmp__017; + var __tmp__027; + var __tmp__107; + var __tmp__117; + var __tmp__127; + var __tmp__207; + var __tmp__217; + var __tmp__227; + __tmp__007 = tf23._rotation00 * src17._rotation00 + tf23._rotation01 * src17._rotation10 + tf23._rotation02 * src17._rotation20; + __tmp__017 = tf23._rotation00 * src17._rotation01 + tf23._rotation01 * src17._rotation11 + tf23._rotation02 * src17._rotation21; + __tmp__027 = tf23._rotation00 * src17._rotation02 + tf23._rotation01 * src17._rotation12 + tf23._rotation02 * src17._rotation22; + __tmp__107 = tf23._rotation10 * src17._rotation00 + tf23._rotation11 * src17._rotation10 + tf23._rotation12 * src17._rotation20; + __tmp__117 = tf23._rotation10 * src17._rotation01 + tf23._rotation11 * src17._rotation11 + tf23._rotation12 * src17._rotation21; + __tmp__127 = tf23._rotation10 * src17._rotation02 + tf23._rotation11 * src17._rotation12 + tf23._rotation12 * src17._rotation22; + __tmp__207 = tf23._rotation20 * src17._rotation00 + tf23._rotation21 * src17._rotation10 + tf23._rotation22 * src17._rotation20; + __tmp__217 = tf23._rotation20 * src17._rotation01 + tf23._rotation21 * src17._rotation11 + tf23._rotation22 * src17._rotation21; + __tmp__227 = tf23._rotation20 * src17._rotation02 + tf23._rotation21 * src17._rotation12 + tf23._rotation22 * src17._rotation22; + dst8._rotation00 = __tmp__007; + dst8._rotation01 = __tmp__017; + dst8._rotation02 = __tmp__027; + dst8._rotation10 = __tmp__107; + dst8._rotation11 = __tmp__117; + dst8._rotation12 = __tmp__127; + dst8._rotation20 = __tmp__207; + dst8._rotation21 = __tmp__217; + dst8._rotation22 = __tmp__227; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf23._rotation00 * src17._positionX + tf23._rotation01 * src17._positionY + tf23._rotation02 * src17._positionZ; + __tmp__Y7 = tf23._rotation10 * src17._positionX + tf23._rotation11 * src17._positionY + tf23._rotation12 * src17._positionZ; + __tmp__Z7 = tf23._rotation20 * src17._positionX + tf23._rotation21 * src17._positionY + tf23._rotation22 * src17._positionZ; + dst8._positionX = __tmp__X7; + dst8._positionY = __tmp__Y7; + dst8._positionZ = __tmp__Z7; + dst8._positionX += tf23._positionX; + dst8._positionY += tf23._positionY; + dst8._positionZ += tf23._positionZ; + var minX3; + var minY3; + var minZ3; + var maxX3; + var maxY3; + var maxZ3; + s3._geom._computeAabb(s3._aabb,s3._ptransform); + minX3 = s3._aabb._minX; + minY3 = s3._aabb._minY; + minZ3 = s3._aabb._minZ; + maxX3 = s3._aabb._maxX; + maxY3 = s3._aabb._maxY; + maxZ3 = s3._aabb._maxZ; + s3._geom._computeAabb(s3._aabb,s3._transform); + s3._aabb._minX = minX3 < s3._aabb._minX ? minX3 : s3._aabb._minX; + s3._aabb._minY = minY3 < s3._aabb._minY ? minY3 : s3._aabb._minY; + s3._aabb._minZ = minZ3 < s3._aabb._minZ ? minZ3 : s3._aabb._minZ; + s3._aabb._maxX = maxX3 > s3._aabb._maxX ? maxX3 : s3._aabb._maxX; + s3._aabb._maxY = maxY3 > s3._aabb._maxY ? maxY3 : s3._aabb._maxY; + s3._aabb._maxZ = maxZ3 > s3._aabb._maxZ ? maxZ3 : s3._aabb._maxZ; + if(s3._proxy != null) { + var dX3; + var dY3; + var dZ3; + dX3 = s3._transform._positionX - s3._ptransform._positionX; + dY3 = s3._transform._positionY - s3._ptransform._positionY; + dZ3 = s3._transform._positionZ - s3._ptransform._positionZ; + var v3 = s3.displacement; + v3.x = dX3; + v3.y = dY3; + v3.z = dZ3; + s3._rigidBody._world._broadPhase.moveProxy(s3._proxy,s3._aabb,s3.displacement); + } + s3 = n3; + } + _this10._sleeping = false; + _this10._sleepTime = 0; + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,0); + } + ,__class__: demo_core_BridgeDemo +}); +var demo_core_BroadPhaseStressDemo = function() { + this.speed = 4; + demo_common_DemoBase.call(this,"Broad-Phase Stress Test"); +}; +demo_core_BroadPhaseStressDemo.__name__ = true; +demo_core_BroadPhaseStressDemo.__super__ = demo_common_DemoBase; +demo_core_BroadPhaseStressDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + initControls: function(controls) { + var _gthis = this; + controls.push(new demo_common_Control("↑",function() { + return "increase shapes"; + },demo_common_UserInput.KEYCODE_UP,function() { + _gthis.increaseRigidBodies(); + })); + controls.push(new demo_common_Control("↓",function() { + return "decrease shapes"; + },demo_common_UserInput.KEYCODE_DOWN,function() { + _gthis.decreaseRigidBodies(); + })); + controls.push(new demo_common_Control("→",function() { + return "increase speed"; + },demo_common_UserInput.KEYCODE_RIGHT,function() { + _gthis.speed += 2; + if(_gthis.speed > 20) { + _gthis.speed = 20; + } + })); + controls.push(new demo_common_Control("←",function() { + return "decrease speed"; + },demo_common_UserInput.KEYCODE_LEFT,function() { + _gthis.speed -= 2; + if(_gthis.speed < 0) { + _gthis.speed = 0; + } + })); + } + ,max: function(a,b) { + if(a > b) { + return a; + } else { + return b; + } + } + ,init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var z = this.max(50,this.max(50,50)) * 3; + if(z == null) { + z = 0; + } + var eye_x = 0; + var eye_y = 0; + var eye_z = z; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 0; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + oimo_common_Vec3.numCreations++; + var _this1 = world._gravity; + _this1.x = 0; + _this1.y = 0; + _this1.z = 0; + this.increaseRigidBodies(); + this.increaseRigidBodies(); + this.increaseRigidBodies(); + this.increaseRigidBodies(); + this.increaseRigidBodies(); + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + var bp = this.world._broadPhase; + this.pairTestCount = bp._testCount; + if(((bp) instanceof oimo_collision_broadphase_bvh_BvhBroadPhase)) { + this.treeBalance = (js_Boot.__cast(bp , oimo_collision_broadphase_bvh_BvhBroadPhase))._tree._getBalance(); + } else { + this.treeBalance = 0; + } + this.reflectRigidBodies(); + } + ,additionalInfo: function() { + return " broad-phase test count: " + this.pairTestCount + "\n" + (" tree balance : " + this.treeBalance + "\n"); + } + ,increaseRigidBodies: function() { + var _this = new oimo_common_Vec3(0.4,0.5,0.6); + _this.x *= 0.7; + _this.y *= 0.7; + _this.z *= 0.7; + var shapes = [new oimo_collision_geometry_BoxGeometry(_this),new oimo_collision_geometry_SphereGeometry(0.35)]; + var compc = new oimo_dynamics_rigidbody_ShapeConfig(); + var rigidc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + var _g = 0; + while(_g < 100) { + ++_g; + compc.geometry = shapes[Math.random() * 2 | 0]; + compc.position.init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + var _this1 = compc.position; + _this1.x *= 0; + _this1.y *= 0; + _this1.z *= 0; + rigidc.position.init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + rigidc.position.x *= 50; + rigidc.position.y *= 50; + rigidc.position.z *= 50; + var body = new oimo_dynamics_rigidbody_RigidBody(rigidc); + body.addShape(new oimo_dynamics_rigidbody_Shape(compc)); + this.moveRigidBody(body); + this.world.addRigidBody(body); + } + } + ,moveRigidBody: function(b) { + var speed = this.speed; + var _this = new oimo_common_Vec3().init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + _this.x *= speed; + _this.y *= speed; + _this.z *= speed; + var _this1 = new oimo_common_Vec3().init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this1.x *= 5; + _this1.y *= 5; + _this1.z *= 5; + if(b._type == 1) { + b._velX = 0; + b._velY = 0; + b._velZ = 0; + } else { + b._velX = _this.x; + b._velY = _this.y; + b._velZ = _this.z; + } + b._sleeping = false; + b._sleepTime = 0; + if(b._type == 1) { + b._angVelX = 0; + b._angVelY = 0; + b._angVelZ = 0; + } else { + b._angVelX = _this1.x; + b._angVelY = _this1.y; + b._angVelZ = _this1.z; + } + b._sleeping = false; + b._sleepTime = 0; + } + ,decreaseRigidBodies: function() { + if(100 > this.world._numRigidBodies) { + return; + } + var rb = this.world._rigidBodyList; + while(rb._next != null) rb = rb._next; + var _g = 0; + while(_g < 100) { + ++_g; + var prev = rb._prev; + this.world.removeRigidBody(rb); + rb = prev; + } + } + ,reflectRigidBodies: function() { + var rb = this.world._rigidBodyList; + var v_x = 0; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + while(rb != null) { + v_x = rb._transform._positionX; + v_y = rb._transform._positionY; + v_z = rb._transform._positionZ; + var v_x1 = 0; + var v_y1 = 0; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + v_x1 = rb._velX; + v_y1 = rb._velY; + v_z1 = rb._velZ; + if(v_x < -50 || v_x > 50) { + v_x1 *= -1; + } + if(v_y < -50 || v_y > 50) { + v_y1 *= -1; + } + if(v_z < -50 || v_z > 50) { + v_z1 *= -1; + } + if(rb._type == 1) { + rb._velX = 0; + rb._velY = 0; + rb._velZ = 0; + } else { + rb._velX = v_x1; + rb._velY = v_y1; + rb._velZ = v_z1; + } + rb._sleeping = false; + rb._sleepTime = 0; + rb = rb._next; + } + } + ,__class__: demo_core_BroadPhaseStressDemo +}); +var demo_core_CollisionFilteringDemo = function() { + demo_common_DemoBase.call(this,"Collision Filtering"); +}; +demo_core_CollisionFilteringDemo.__name__ = true; +demo_core_CollisionFilteringDemo.__super__ = demo_common_DemoBase; +demo_core_CollisionFilteringDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + var floorShape = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true)._shapeList; + floorShape._collisionGroup = 1; + floorShape._collisionMask = 8; + var wallShape = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,2,0),new oimo_common_Vec3(3,0.2,3),true)._shapeList; + wallShape._collisionGroup = 2; + wallShape._collisionMask = 4; + var _g = 0; + while(_g < 2) { + var i = _g++; + var _g1 = -2; + while(_g1 < 3) { + var j = _g1++; + var _g2 = -2; + while(_g2 < 3) { + var pos = new oimo_common_Vec3(j * 0.3 * 3,3 + i * 0.3 * 3,_g2++ * 0.3 * 3); + var x = -0.01 + Math.random() * 0.02; + var y = -0.01 + Math.random() * 0.02; + var z = -0.01 + Math.random() * 0.02; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + pos.x += x; + pos.y += y; + pos.z += z; + var shape; + if(i == 0) { + shape = demo_common_OimoUtil.addSphere(world,pos,0.3,false)._shapeList; + shape._collisionGroup = 4; + shape._collisionMask = 14; + } else { + shape = demo_common_OimoUtil.addBox(world,pos,new oimo_common_Vec3(0.3,0.3,0.3),false)._shapeList; + shape._collisionGroup = 8; + shape._collisionMask = 13; + } + } + } + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_CollisionFilteringDemo +}); +var demo_core_CompoundShapesDemo = function() { + demo_common_DemoBase.call(this,"Compound Shapes"); +}; +demo_core_CompoundShapesDemo.__name__ = true; +demo_core_CompoundShapesDemo.__super__ = demo_common_DemoBase; +demo_core_CompoundShapesDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var rc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + var geom1 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.3,0.1,0.3)); + var geom2 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.1,0.3,0.1)); + var sc1 = new oimo_dynamics_rigidbody_ShapeConfig(); + var sc2 = new oimo_dynamics_rigidbody_ShapeConfig(); + sc1.geometry = geom1; + sc2.geometry = geom2; + sc1.position.init(0,0.2,0); + sc2.position.init(0,-0.2,0); + var _g = 0; + while(_g < 32) { + var _this1 = rc.position.init(-2,1 + _g++,0); + var x = -0.01 + Math.random() * 0.02; + var y = -0.01 + Math.random() * 0.02; + var z = -0.01 + Math.random() * 0.02; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + _this1.x += x; + _this1.y += y; + _this1.z += z; + var rb = new oimo_dynamics_rigidbody_RigidBody(rc); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc1)); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc2)); + world.addRigidBody(rb); + } + var geom11 = new oimo_collision_geometry_ConeGeometry(0.275,0.325); + var geom21 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.3,0.075,0.3)); + var sc11 = new oimo_dynamics_rigidbody_ShapeConfig(); + var sc21 = new oimo_dynamics_rigidbody_ShapeConfig(); + sc11.geometry = geom11; + sc21.geometry = geom21; + sc11.position.init(0,0.2,0); + sc21.position.init(0,-0.2,0); + var _g1 = 0; + while(_g1 < 32) { + var _this2 = rc.position.init(0,1 + _g1++,0); + var x1 = -0.01 + Math.random() * 0.02; + var y1 = -0.01 + Math.random() * 0.02; + var z1 = -0.01 + Math.random() * 0.02; + if(z1 == null) { + z1 = 0; + } + if(y1 == null) { + y1 = 0; + } + if(x1 == null) { + x1 = 0; + } + oimo_common_Vec3.numCreations++; + _this2.x += x1; + _this2.y += y1; + _this2.z += z1; + var rb1 = new oimo_dynamics_rigidbody_RigidBody(rc); + rb1.addShape(new oimo_dynamics_rigidbody_Shape(sc11)); + rb1.addShape(new oimo_dynamics_rigidbody_Shape(sc21)); + world.addRigidBody(rb1); + } + var geom12 = new oimo_collision_geometry_CylinderGeometry(0.25,0.4); + var geom22 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.075,0.4,0.075)); + var sc12 = new oimo_dynamics_rigidbody_ShapeConfig(); + var sc22 = new oimo_dynamics_rigidbody_ShapeConfig(); + sc12.geometry = geom12; + sc22.geometry = geom22; + sc12.position.init(0,0,0); + sc22.position.init(0,-0.1,0); + var _this3 = sc12.rotation; + var s = Math.sin(1.570796326794895); + var c = Math.cos(1.570796326794895); + var c1 = 1 - c; + var r00 = 0 * c1 + c; + var r01 = 0 * c1 - s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - 0 * s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + 0 * s; + var r22 = c1 + c; + var e01 = _this3.e00 * r01 + _this3.e01 * r11 + _this3.e02 * r21; + var e02 = _this3.e00 * r02 + _this3.e01 * r12 + _this3.e02 * r22; + var e11 = _this3.e10 * r01 + _this3.e11 * r11 + _this3.e12 * r21; + var e12 = _this3.e10 * r02 + _this3.e11 * r12 + _this3.e12 * r22; + var e21 = _this3.e20 * r01 + _this3.e21 * r11 + _this3.e22 * r21; + var e22 = _this3.e20 * r02 + _this3.e21 * r12 + _this3.e22 * r22; + _this3.e00 = _this3.e00 * r00 + _this3.e01 * r10 + _this3.e02 * r20; + _this3.e01 = e01; + _this3.e02 = e02; + _this3.e10 = _this3.e10 * r00 + _this3.e11 * r10 + _this3.e12 * r20; + _this3.e11 = e11; + _this3.e12 = e12; + _this3.e20 = _this3.e20 * r00 + _this3.e21 * r10 + _this3.e22 * r20; + _this3.e21 = e21; + _this3.e22 = e22; + var _g2 = 0; + while(_g2 < 32) { + var _this4 = rc.position.init(2,1 + _g2++,0); + var x2 = -0.01 + Math.random() * 0.02; + var y2 = -0.01 + Math.random() * 0.02; + var z2 = -0.01 + Math.random() * 0.02; + if(z2 == null) { + z2 = 0; + } + if(y2 == null) { + y2 = 0; + } + if(x2 == null) { + x2 = 0; + } + oimo_common_Vec3.numCreations++; + _this4.x += x2; + _this4.y += y2; + _this4.z += z2; + var rb2 = new oimo_dynamics_rigidbody_RigidBody(rc); + rb2.addShape(new oimo_dynamics_rigidbody_Shape(sc12)); + rb2.addShape(new oimo_dynamics_rigidbody_Shape(sc22)); + world.addRigidBody(rb2); + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_CompoundShapesDemo +}); +var demo_core_ConvexCastingDemo = function() { + demo_common_DemoBase.call(this,"Convex Casting"); +}; +demo_core_ConvexCastingDemo.__name__ = true; +demo_core_ConvexCastingDemo.__super__ = demo_common_DemoBase; +demo_core_ConvexCastingDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 7; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 0; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(5,0.5,5),true); + var wid = 0.3; + var hei = 0.3; + var _g = 0; + while(_g < 3) { + var i = _g++; + var _g1 = -2; + while(_g1 < 3) { + var j = _g1++; + var _g2 = -2; + while(_g2 < 3) { + var k = _g2++; + oimo_common_Setting.defaultDensity = i == 2 ? 1 : 1; + wid = 0.2 + Math.random() * 0.2; + hei = 0.2 + Math.random() * 0.2; + switch(5 * Math.random() | 0) { + case 0: + demo_common_OimoUtil.addCylinder(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.6 + i * 0.6 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 1: + demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.6 + i * 0.6 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 2: + demo_common_OimoUtil.addCapsule(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.6 + i * 0.6 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 3: + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.6 + i * 0.6 * 2 * 0.9998,k * 0.8 + (-0.01 + Math.random() * 0.02)),new oimo_common_Vec3(wid,hei,wid),false); + break; + case 4: + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.6 + i * 0.6 * 2 * 0.9998,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,false); + break; + } + } + } + } + this.lps = []; + this.lps.push(new demo_core__$ConvexCastingDemo_LaserPointer(new oimo_common_Vec3(-2,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$ConvexCastingDemo_LaserPointer(new oimo_common_Vec3(0,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$ConvexCastingDemo_LaserPointer(new oimo_common_Vec3(2,4,0),world,new oimo_common_Vec3(0,1,0))); + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,drawAdditionalObjects: function(debugDraw) { + var w = debugDraw.wireframe; + debugDraw.wireframe = true; + var _g = 0; + var _g1 = this.lps; + while(_g < _g1.length) _g1[_g++].draw(debugDraw); + debugDraw.wireframe = w; + } + ,__class__: demo_core_ConvexCastingDemo +}); +var demo_core__$ConvexCastingDemo_LaserPointer = function(pos,world,color) { + this.world = world; + this.color = color; + this.cb = new oimo_dynamics_callback_RayCastClosest(); + this.length = 0.4; + var rc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + rc.autoSleep = false; + rc.angularDamping = 4.0; + var _this = rc.position; + _this.x = pos.x; + _this.y = pos.y; + _this.z = pos.z; + this.rb = new oimo_dynamics_rigidbody_RigidBody(rc); + var sc = new oimo_dynamics_rigidbody_ShapeConfig(); + sc.geometry = new oimo_collision_geometry_CylinderGeometry(0.4,this.length); + this.rb.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + world.addRigidBody(this.rb); + var _this1 = rc.position; + var y = this.length; + if(y == null) { + y = 0; + } + oimo_common_Vec3.numCreations++; + _this1.x += 0; + _this1.y += y; + _this1.z += 0; + rc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; + var fix = new oimo_dynamics_rigidbody_RigidBody(rc); + sc.geometry = new oimo_collision_geometry_SphereGeometry(0.1); + fix.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + world.addRigidBody(fix); + var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); + var tmp = this.rb; + var _this2 = this.rb; + var v = new oimo_common_Vec3(); + v.x = _this2._transform._positionX; + v.y = _this2._transform._positionY; + v.z = _this2._transform._positionZ; + var y1 = this.length; + if(y1 == null) { + y1 = 0; + } + oimo_common_Vec3.numCreations++; + v.x += 0; + v.y += y1; + v.z += 0; + jc.init(tmp,fix,v,new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(1,0,0)); + jc.twistLimitMotor.setLimits(0,0); + jc.maxSwingAngle1 = 1.570796326794895; + jc.maxSwingAngle2 = 1.570796326794895; + world.addJoint(new oimo_dynamics_constraint_joint_RagdollJoint(jc)); +}; +demo_core__$ConvexCastingDemo_LaserPointer.__name__ = true; +demo_core__$ConvexCastingDemo_LaserPointer.prototype = { + draw: function(debugDraw) { + var _this = this.rb._transform; + var tf = new oimo_common_Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + var y = -this.length; + if(y == null) { + y = 0; + } + var v_x = 0; + var v_y = y; + var v_z = 0; + oimo_common_Vec3.numCreations++; + var vX; + var vY; + var vZ; + vX = v_x; + vY = v_y; + vZ = v_z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * v_x + tf._rotation01 * v_y + tf._rotation02 * v_z; + __tmp__Y = tf._rotation10 * v_x + tf._rotation11 * v_y + tf._rotation12 * v_z; + __tmp__Z = tf._rotation20 * v_x + tf._rotation21 * v_y + tf._rotation22 * v_z; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + var y1 = -this.length - 20; + if(y1 == null) { + y1 = 0; + } + var v_x1 = 0; + var v_y1 = y1; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + var vX1 = v_x1; + var vY1 = v_y1; + var vZ1 = v_z1; + var __tmp__X1 = tf._rotation00 * v_x1 + tf._rotation01 * v_y1 + tf._rotation02 * v_z1; + var __tmp__Y1 = tf._rotation10 * v_x1 + tf._rotation11 * v_y1 + tf._rotation12 * v_z1; + var __tmp__Z1 = tf._rotation20 * v_x1 + tf._rotation21 * v_y1 + tf._rotation22 * v_z1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + vX1 = __tmp__X1 + tf._positionX; + vY1 = __tmp__Y1 + tf._positionY; + vZ1 = __tmp__Z1 + tf._positionZ; + var end_x = 0; + var end_y = 0; + var end_z = 0; + oimo_common_Vec3.numCreations++; + end_x = vX1; + end_y = vY1; + end_z = vZ1; + var r = new oimo_common_Vec3(end_x - res.x,end_y - res.y,end_z - res.z); + var convex = this.rb._shapeList._geom; + var _this1 = this.cb; + _this1.shape = null; + _this1.fraction = 1; + _this1.position.zero(); + _this1.normal.zero(); + _this1.hit = false; + var green = new oimo_common_Vec3(0,1,0); + this.world.convexCast(convex,tf,r,this.cb); + if(this.cb.hit) { + var s = this.cb.fraction; + var x = res.x + r.x * s; + var y2 = res.y + r.y * s; + var z = res.z + r.z * s; + if(z == null) { + z = 0; + } + if(y2 == null) { + y2 = 0; + } + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + var s1 = this.cb.fraction; + debugDraw.line(res,new oimo_common_Vec3(res.x + r.x * s1,res.y + r.y * s1,res.z + r.z * s1),green); + var v_x2 = 0; + var v_y2 = 0; + var v_z2 = 0; + oimo_common_Vec3.numCreations++; + v_x2 = tf._positionX; + v_y2 = tf._positionY; + v_z2 = tf._positionZ; + var s2 = this.cb.fraction; + var x1 = v_x2 + r.x * s2; + var y3 = v_y2 + r.y * s2; + var z1 = v_z2 + r.z * s2; + v_x2 = x1; + v_y2 = y3; + v_z2 = z1; + tf._positionX = x1; + tf._positionY = y3; + tf._positionZ = z1; + debugDraw.cylinder(tf,convex._radius,convex._halfHeight,green); + debugDraw.point(this.cb.position,green); + } + } + ,__class__: demo_core__$ConvexCastingDemo_LaserPointer +}; +var demo_core_ConvexHullDemo = function() { + demo_common_DemoBase.call(this,"Convex Hull"); +}; +demo_core_ConvexHullDemo.__name__ = true; +demo_core_ConvexHullDemo.__super__ = demo_common_DemoBase; +demo_core_ConvexHullDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var _g = 0; + while(_g < 3) { + var i = _g++; + var _g1 = -1; + while(_g1 < 2) { + var j = _g1++; + var _g2 = -1; + while(_g2 < 2) { + var center = new oimo_common_Vec3(j * 0.6 * 2,0.6 + i * 0.6 * 3.0,_g2++ * 0.6 * 2); + var bc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + var sc = new oimo_dynamics_rigidbody_ShapeConfig(); + bc.position = center; + var _g3 = []; + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + _g3.push(new oimo_common_Vec3(this.rand() * 0.6,this.rand() * 0.6,this.rand() * 0.6)); + sc.geometry = new oimo_collision_geometry_ConvexHullGeometry(_g3); + var b = new oimo_dynamics_rigidbody_RigidBody(bc); + b.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + world.addRigidBody(b); + } + } + } + } + ,rand: function() { + var x = Math.pow(Math.random(),0.7); + if(Math.random() < 0.5) { + x = -x; + } + return x; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_ConvexHullDemo +}); +var demo_core_FallingRagdollDemo = function() { + demo_common_DemoBase.call(this,"Falling Ragdoll"); +}; +demo_core_FallingRagdollDemo.__name__ = true; +demo_core_FallingRagdollDemo.__super__ = demo_common_DemoBase; +demo_core_FallingRagdollDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 2; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + renderer.g.getDebugDraw().drawJointLimits = false; + var tmp1 = oimo_common_Setting.defaultRestitution; + var tmp2 = oimo_common_Setting.defaultFriction; + oimo_common_Setting.defaultRestitution = 0.3; + oimo_common_Setting.defaultFriction = 0.2; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var stairCenter_x = 0; + var stairCenter_y = 0; + var stairCenter_z = 0; + oimo_common_Vec3.numCreations++; + var _g = 0; + while(_g < 30) { + var i = _g++; + if(i == 29) { + var y = (i + 0.5) * 0.5; + var z = -(i + 2.) * 0.6; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(stairCenter_x + 0,stairCenter_y + y,stairCenter_z + z),new oimo_common_Vec3(2.,0.25,1.2),true); + } else { + var y1 = (i + 0.5) * 0.5; + var z1 = -(i + 0.5) * 0.6; + if(z1 == null) { + z1 = 0; + } + if(y1 == null) { + y1 = 0; + } + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(stairCenter_x + 0,stairCenter_y + y1,stairCenter_z + z1),new oimo_common_Vec3(2.,0.25,0.3),true); + var y2 = (i + 1.) * 0.5; + var z2 = -(i + 0.5) * 0.6; + if(z2 == null) { + z2 = 0; + } + if(y2 == null) { + y2 = 0; + } + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-2.,stairCenter_y + y2,stairCenter_z + z2),new oimo_common_Vec3(0.1,0.5,0.3),true); + var y3 = (i + 1.) * 0.5; + var z3 = -(i + 0.5) * 0.6; + if(z3 == null) { + z3 = 0; + } + if(y3 == null) { + y3 = 0; + } + oimo_common_Vec3.numCreations++; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(2.,stairCenter_y + y3,stairCenter_z + z3),new oimo_common_Vec3(0.1,0.5,0.3),true); + } + } + oimo_common_Vec3.numCreations++; + var ragdollPos = new oimo_common_Vec3(stairCenter_x + 0,16.21,-17.7); + this.ragdoll = demo_common_OimoUtil.addRagdoll(world,ragdollPos); + oimo_common_Vec3.numCreations++; + var _this1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(ragdollPos.x + 0,ragdollPos.y + 0,ragdollPos.z + (-2)),new oimo_common_Vec3(0.2,0.2,0.2),false); + oimo_common_Vec3.numCreations++; + if(_this1._type == 1) { + _this1._velX = 0; + _this1._velY = 0; + _this1._velZ = 0; + } else { + _this1._velX = 0; + _this1._velY = 3.5; + _this1._velZ = 4; + } + _this1._sleeping = false; + _this1._sleepTime = 0; + oimo_common_Setting.defaultRestitution = tmp1; + oimo_common_Setting.defaultFriction = tmp2; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + if(this.ragdoll != null) { + var _this = this.ragdoll; + var _this_x = 0; + var _this_y = 0; + var _this_z = 0; + oimo_common_Vec3.numCreations++; + _this_x = _this._transform._positionX; + _this_y = _this._transform._positionY; + _this_z = _this._transform._positionZ; + oimo_common_Vec3.numCreations++; + var x = _this_x + 2; + var y = _this_y + 5; + var z = _this_z + 7; + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + var eye_x = x; + var eye_y = y; + var eye_z = z; + oimo_common_Vec3.numCreations++; + var _this1 = this.ragdoll; + var at_x = 0; + var at_y = 0; + var at_z = 0; + oimo_common_Vec3.numCreations++; + at_x = _this1._transform._positionX; + at_y = _this1._transform._positionY; + at_z = _this1._transform._positionZ; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this2 = this.renderer.viewMat; + var zx = eye_x - at_x; + var zy = eye_y - at_y; + var zz = eye_z - at_z; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this2.e00 = xx; + _this2.e01 = xy; + _this2.e02 = xz; + _this2.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this2.e10 = yx; + _this2.e11 = yy; + _this2.e12 = yz; + _this2.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this2.e20 = zx; + _this2.e21 = zy; + _this2.e22 = zz; + _this2.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this2.e30 = 0; + _this2.e31 = 0; + _this2.e32 = 0; + _this2.e33 = 1; + } + } + ,__class__: demo_core_FallingRagdollDemo +}); +var demo_core_FrictionsAndRestitutions = function() { + demo_common_DemoBase.call(this,"Frictions and Restitutions"); +}; +demo_core_FrictionsAndRestitutions.__name__ = true; +demo_core_FrictionsAndRestitutions.__super__ = demo_common_DemoBase; +demo_core_FrictionsAndRestitutions.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var m_e00 = 1; + var m_e01 = 0; + var m_e02 = 0; + var m_e10 = 0; + var m_e11 = 1; + var m_e12 = 0; + var m_e20 = 0; + var m_e21 = 0; + var m_e22 = 1; + oimo_common_Mat3.numCreations++; + var s = Math.sin(0.34906585039886556); + var c = Math.cos(0.34906585039886556); + var c1 = 1 - c; + var r00 = 0 * c1 + c; + var r01 = 0 * c1 - s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - 0 * s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + 0 * s; + var r22 = c1 + c; + var e00 = m_e00 * r00 + m_e01 * r10 + m_e02 * r20; + var e01 = m_e00 * r01 + m_e01 * r11 + m_e02 * r21; + var e02 = m_e00 * r02 + m_e01 * r12 + m_e02 * r22; + var e10 = m_e10 * r00 + m_e11 * r10 + m_e12 * r20; + var e11 = m_e10 * r01 + m_e11 * r11 + m_e12 * r21; + var e12 = m_e10 * r02 + m_e11 * r12 + m_e12 * r22; + var e20 = m_e20 * r00 + m_e21 * r10 + m_e22 * r20; + var e21 = m_e20 * r01 + m_e21 * r11 + m_e22 * r21; + var e22 = m_e20 * r02 + m_e21 * r12 + m_e22 * r22; + m_e00 = e00; + m_e01 = e01; + m_e02 = e02; + m_e10 = e10; + m_e11 = e11; + m_e12 = e12; + m_e20 = e20; + m_e21 = e21; + m_e22 = e22; + var tiltedFloor = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,2,0),new oimo_common_Vec3(3,0.1,1),true); + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = e00; + rot01 = e01; + rot02 = e02; + rot10 = e10; + rot11 = e11; + rot12 = e12; + rot20 = e20; + rot21 = e21; + rot22 = e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * tiltedFloor._transform._rotation00 + rot01 * tiltedFloor._transform._rotation10 + rot02 * tiltedFloor._transform._rotation20; + __tmp__01 = rot00 * tiltedFloor._transform._rotation01 + rot01 * tiltedFloor._transform._rotation11 + rot02 * tiltedFloor._transform._rotation21; + __tmp__02 = rot00 * tiltedFloor._transform._rotation02 + rot01 * tiltedFloor._transform._rotation12 + rot02 * tiltedFloor._transform._rotation22; + __tmp__10 = rot10 * tiltedFloor._transform._rotation00 + rot11 * tiltedFloor._transform._rotation10 + rot12 * tiltedFloor._transform._rotation20; + __tmp__11 = rot10 * tiltedFloor._transform._rotation01 + rot11 * tiltedFloor._transform._rotation11 + rot12 * tiltedFloor._transform._rotation21; + __tmp__12 = rot10 * tiltedFloor._transform._rotation02 + rot11 * tiltedFloor._transform._rotation12 + rot12 * tiltedFloor._transform._rotation22; + __tmp__20 = rot20 * tiltedFloor._transform._rotation00 + rot21 * tiltedFloor._transform._rotation10 + rot22 * tiltedFloor._transform._rotation20; + __tmp__21 = rot20 * tiltedFloor._transform._rotation01 + rot21 * tiltedFloor._transform._rotation11 + rot22 * tiltedFloor._transform._rotation21; + __tmp__22 = rot20 * tiltedFloor._transform._rotation02 + rot21 * tiltedFloor._transform._rotation12 + rot22 * tiltedFloor._transform._rotation22; + tiltedFloor._transform._rotation00 = __tmp__00; + tiltedFloor._transform._rotation01 = __tmp__01; + tiltedFloor._transform._rotation02 = __tmp__02; + tiltedFloor._transform._rotation10 = __tmp__10; + tiltedFloor._transform._rotation11 = __tmp__11; + tiltedFloor._transform._rotation12 = __tmp__12; + tiltedFloor._transform._rotation20 = __tmp__20; + tiltedFloor._transform._rotation21 = __tmp__21; + tiltedFloor._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia20; + __tmp__011 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia21; + __tmp__021 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia22; + __tmp__101 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia20; + __tmp__111 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia21; + __tmp__121 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia22; + __tmp__201 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia20; + __tmp__211 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia21; + __tmp__221 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia22; + tiltedFloor._invInertia00 = __tmp__001; + tiltedFloor._invInertia01 = __tmp__011; + tiltedFloor._invInertia02 = __tmp__021; + tiltedFloor._invInertia10 = __tmp__101; + tiltedFloor._invInertia11 = __tmp__111; + tiltedFloor._invInertia12 = __tmp__121; + tiltedFloor._invInertia20 = __tmp__201; + tiltedFloor._invInertia21 = __tmp__211; + tiltedFloor._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation02; + __tmp__012 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation12; + __tmp__022 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation22; + __tmp__102 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation02; + __tmp__112 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation12; + __tmp__122 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation22; + __tmp__202 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation02; + __tmp__212 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation12; + __tmp__222 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation22; + tiltedFloor._invInertia00 = __tmp__002; + tiltedFloor._invInertia01 = __tmp__012; + tiltedFloor._invInertia02 = __tmp__022; + tiltedFloor._invInertia10 = __tmp__102; + tiltedFloor._invInertia11 = __tmp__112; + tiltedFloor._invInertia12 = __tmp__122; + tiltedFloor._invInertia20 = __tmp__202; + tiltedFloor._invInertia21 = __tmp__212; + tiltedFloor._invInertia22 = __tmp__222; + tiltedFloor._invInertia00 *= tiltedFloor._rotFactor.x; + tiltedFloor._invInertia01 *= tiltedFloor._rotFactor.x; + tiltedFloor._invInertia02 *= tiltedFloor._rotFactor.x; + tiltedFloor._invInertia10 *= tiltedFloor._rotFactor.y; + tiltedFloor._invInertia11 *= tiltedFloor._rotFactor.y; + tiltedFloor._invInertia12 *= tiltedFloor._rotFactor.y; + tiltedFloor._invInertia20 *= tiltedFloor._rotFactor.z; + tiltedFloor._invInertia21 *= tiltedFloor._rotFactor.z; + tiltedFloor._invInertia22 *= tiltedFloor._rotFactor.z; + var dst = tiltedFloor._ptransform; + var src = tiltedFloor._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s1 = tiltedFloor._shapeList; + while(s1 != null) { + var n = s1._next; + var tf1 = tiltedFloor._ptransform; + var tf2 = tiltedFloor._transform; + var dst1 = s1._ptransform; + var src1 = s1._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s1._transform; + var src11 = s1._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s1._geom._computeAabb(s1._aabb,s1._ptransform); + minX = s1._aabb._minX; + minY = s1._aabb._minY; + minZ = s1._aabb._minZ; + maxX = s1._aabb._maxX; + maxY = s1._aabb._maxY; + maxZ = s1._aabb._maxZ; + s1._geom._computeAabb(s1._aabb,s1._transform); + s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; + s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; + s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; + s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; + s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; + s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; + if(s1._proxy != null) { + var dX; + var dY; + var dZ; + dX = s1._transform._positionX - s1._ptransform._positionX; + dY = s1._transform._positionY - s1._ptransform._positionY; + dZ = s1._transform._positionZ - s1._ptransform._positionZ; + var v = s1.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + } + s1 = n; + } + tiltedFloor._sleeping = false; + tiltedFloor._sleepTime = 0; + tiltedFloor._shapeList._friction = 0.5; + var _g = 0; + while(_g < 7) { + var i = _g++; + var pos = new oimo_common_Vec3((i - 3) * 0.8,0,0); + var y = pos.x * e10 + pos.y * e11 + pos.z * e12; + var z = pos.x * e20 + pos.y * e21 + pos.z * e22; + pos.x = pos.x * e00 + pos.y * e01 + pos.z * e02; + pos.y = y; + pos.z = z; + pos.y += 2.3; + var box = demo_common_OimoUtil.addBox(world,pos,new oimo_common_Vec3(0.2,0.2,0.2),false); + box._shapeList._friction = i / 16; + var rot001; + var rot011; + var rot021; + var rot101; + var rot111; + var rot121; + var rot201; + var rot211; + var rot221; + rot001 = e00; + rot011 = e01; + rot021 = e02; + rot101 = e10; + rot111 = e11; + rot121 = e12; + rot201 = e20; + rot211 = e21; + rot221 = e22; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = rot001 * box._transform._rotation00 + rot011 * box._transform._rotation10 + rot021 * box._transform._rotation20; + __tmp__015 = rot001 * box._transform._rotation01 + rot011 * box._transform._rotation11 + rot021 * box._transform._rotation21; + __tmp__025 = rot001 * box._transform._rotation02 + rot011 * box._transform._rotation12 + rot021 * box._transform._rotation22; + __tmp__105 = rot101 * box._transform._rotation00 + rot111 * box._transform._rotation10 + rot121 * box._transform._rotation20; + __tmp__115 = rot101 * box._transform._rotation01 + rot111 * box._transform._rotation11 + rot121 * box._transform._rotation21; + __tmp__125 = rot101 * box._transform._rotation02 + rot111 * box._transform._rotation12 + rot121 * box._transform._rotation22; + __tmp__205 = rot201 * box._transform._rotation00 + rot211 * box._transform._rotation10 + rot221 * box._transform._rotation20; + __tmp__215 = rot201 * box._transform._rotation01 + rot211 * box._transform._rotation11 + rot221 * box._transform._rotation21; + __tmp__225 = rot201 * box._transform._rotation02 + rot211 * box._transform._rotation12 + rot221 * box._transform._rotation22; + box._transform._rotation00 = __tmp__005; + box._transform._rotation01 = __tmp__015; + box._transform._rotation02 = __tmp__025; + box._transform._rotation10 = __tmp__105; + box._transform._rotation11 = __tmp__115; + box._transform._rotation12 = __tmp__125; + box._transform._rotation20 = __tmp__205; + box._transform._rotation21 = __tmp__215; + box._transform._rotation22 = __tmp__225; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = box._transform._rotation00 * box._invLocalInertia00 + box._transform._rotation01 * box._invLocalInertia10 + box._transform._rotation02 * box._invLocalInertia20; + __tmp__016 = box._transform._rotation00 * box._invLocalInertia01 + box._transform._rotation01 * box._invLocalInertia11 + box._transform._rotation02 * box._invLocalInertia21; + __tmp__026 = box._transform._rotation00 * box._invLocalInertia02 + box._transform._rotation01 * box._invLocalInertia12 + box._transform._rotation02 * box._invLocalInertia22; + __tmp__106 = box._transform._rotation10 * box._invLocalInertia00 + box._transform._rotation11 * box._invLocalInertia10 + box._transform._rotation12 * box._invLocalInertia20; + __tmp__116 = box._transform._rotation10 * box._invLocalInertia01 + box._transform._rotation11 * box._invLocalInertia11 + box._transform._rotation12 * box._invLocalInertia21; + __tmp__126 = box._transform._rotation10 * box._invLocalInertia02 + box._transform._rotation11 * box._invLocalInertia12 + box._transform._rotation12 * box._invLocalInertia22; + __tmp__206 = box._transform._rotation20 * box._invLocalInertia00 + box._transform._rotation21 * box._invLocalInertia10 + box._transform._rotation22 * box._invLocalInertia20; + __tmp__216 = box._transform._rotation20 * box._invLocalInertia01 + box._transform._rotation21 * box._invLocalInertia11 + box._transform._rotation22 * box._invLocalInertia21; + __tmp__226 = box._transform._rotation20 * box._invLocalInertia02 + box._transform._rotation21 * box._invLocalInertia12 + box._transform._rotation22 * box._invLocalInertia22; + box._invInertia00 = __tmp__006; + box._invInertia01 = __tmp__016; + box._invInertia02 = __tmp__026; + box._invInertia10 = __tmp__106; + box._invInertia11 = __tmp__116; + box._invInertia12 = __tmp__126; + box._invInertia20 = __tmp__206; + box._invInertia21 = __tmp__216; + box._invInertia22 = __tmp__226; + var __tmp__007; + var __tmp__017; + var __tmp__027; + var __tmp__107; + var __tmp__117; + var __tmp__127; + var __tmp__207; + var __tmp__217; + var __tmp__227; + __tmp__007 = box._invInertia00 * box._transform._rotation00 + box._invInertia01 * box._transform._rotation01 + box._invInertia02 * box._transform._rotation02; + __tmp__017 = box._invInertia00 * box._transform._rotation10 + box._invInertia01 * box._transform._rotation11 + box._invInertia02 * box._transform._rotation12; + __tmp__027 = box._invInertia00 * box._transform._rotation20 + box._invInertia01 * box._transform._rotation21 + box._invInertia02 * box._transform._rotation22; + __tmp__107 = box._invInertia10 * box._transform._rotation00 + box._invInertia11 * box._transform._rotation01 + box._invInertia12 * box._transform._rotation02; + __tmp__117 = box._invInertia10 * box._transform._rotation10 + box._invInertia11 * box._transform._rotation11 + box._invInertia12 * box._transform._rotation12; + __tmp__127 = box._invInertia10 * box._transform._rotation20 + box._invInertia11 * box._transform._rotation21 + box._invInertia12 * box._transform._rotation22; + __tmp__207 = box._invInertia20 * box._transform._rotation00 + box._invInertia21 * box._transform._rotation01 + box._invInertia22 * box._transform._rotation02; + __tmp__217 = box._invInertia20 * box._transform._rotation10 + box._invInertia21 * box._transform._rotation11 + box._invInertia22 * box._transform._rotation12; + __tmp__227 = box._invInertia20 * box._transform._rotation20 + box._invInertia21 * box._transform._rotation21 + box._invInertia22 * box._transform._rotation22; + box._invInertia00 = __tmp__007; + box._invInertia01 = __tmp__017; + box._invInertia02 = __tmp__027; + box._invInertia10 = __tmp__107; + box._invInertia11 = __tmp__117; + box._invInertia12 = __tmp__127; + box._invInertia20 = __tmp__207; + box._invInertia21 = __tmp__217; + box._invInertia22 = __tmp__227; + box._invInertia00 *= box._rotFactor.x; + box._invInertia01 *= box._rotFactor.x; + box._invInertia02 *= box._rotFactor.x; + box._invInertia10 *= box._rotFactor.y; + box._invInertia11 *= box._rotFactor.y; + box._invInertia12 *= box._rotFactor.y; + box._invInertia20 *= box._rotFactor.z; + box._invInertia21 *= box._rotFactor.z; + box._invInertia22 *= box._rotFactor.z; + var dst3 = box._ptransform; + var src2 = box._transform; + dst3._positionX = src2._positionX; + dst3._positionY = src2._positionY; + dst3._positionZ = src2._positionZ; + dst3._rotation00 = src2._rotation00; + dst3._rotation01 = src2._rotation01; + dst3._rotation02 = src2._rotation02; + dst3._rotation10 = src2._rotation10; + dst3._rotation11 = src2._rotation11; + dst3._rotation12 = src2._rotation12; + dst3._rotation20 = src2._rotation20; + dst3._rotation21 = src2._rotation21; + dst3._rotation22 = src2._rotation22; + var s2 = box._shapeList; + while(s2 != null) { + var n1 = s2._next; + var tf11 = box._ptransform; + var tf21 = box._transform; + var dst4 = s2._ptransform; + var src12 = s2._localTransform; + var __tmp__008; + var __tmp__018; + var __tmp__028; + var __tmp__108; + var __tmp__118; + var __tmp__128; + var __tmp__208; + var __tmp__218; + var __tmp__228; + __tmp__008 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__018 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__028 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__108 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__118 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__128 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__208 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__218 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__228 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst4._rotation00 = __tmp__008; + dst4._rotation01 = __tmp__018; + dst4._rotation02 = __tmp__028; + dst4._rotation10 = __tmp__108; + dst4._rotation11 = __tmp__118; + dst4._rotation12 = __tmp__128; + dst4._rotation20 = __tmp__208; + dst4._rotation21 = __tmp__218; + dst4._rotation22 = __tmp__228; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst4._positionX = __tmp__X2; + dst4._positionY = __tmp__Y2; + dst4._positionZ = __tmp__Z2; + dst4._positionX += tf11._positionX; + dst4._positionY += tf11._positionY; + dst4._positionZ += tf11._positionZ; + var dst5 = s2._transform; + var src13 = s2._localTransform; + var __tmp__009; + var __tmp__019; + var __tmp__029; + var __tmp__109; + var __tmp__119; + var __tmp__129; + var __tmp__209; + var __tmp__219; + var __tmp__229; + __tmp__009 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__019 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__029 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__109 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__119 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__129 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__209 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__219 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__229 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst5._rotation00 = __tmp__009; + dst5._rotation01 = __tmp__019; + dst5._rotation02 = __tmp__029; + dst5._rotation10 = __tmp__109; + dst5._rotation11 = __tmp__119; + dst5._rotation12 = __tmp__129; + dst5._rotation20 = __tmp__209; + dst5._rotation21 = __tmp__219; + dst5._rotation22 = __tmp__229; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst5._positionX = __tmp__X3; + dst5._positionY = __tmp__Y3; + dst5._positionZ = __tmp__Z3; + dst5._positionX += tf21._positionX; + dst5._positionY += tf21._positionY; + dst5._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX1 = s2._aabb._minX; + minY1 = s2._aabb._minY; + minZ1 = s2._aabb._minZ; + maxX1 = s2._aabb._maxX; + maxY1 = s2._aabb._maxY; + maxZ1 = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; + s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; + s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; + s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; + s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; + s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s2._transform._positionX - s2._ptransform._positionX; + dY1 = s2._transform._positionY - s2._ptransform._positionY; + dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; + var v1 = s2.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n1; + } + box._sleeping = false; + box._sleepTime = 0; + } + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,0.1,2),new oimo_common_Vec3(3,0.1,1),true)._shapeList._restitution = 1.0; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-2.4000000000000004,3,2),0.25,false)._shapeList._restitution = 0.; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-1.6,3,2),0.25,false)._shapeList._restitution = 0.16666666666666666; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-0.8,3,2),0.25,false)._shapeList._restitution = 0.33333333333333331; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(0.,3,2),0.25,false)._shapeList._restitution = 0.5; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(0.8,3,2),0.25,false)._shapeList._restitution = 0.66666666666666663; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(1.6,3,2),0.25,false)._shapeList._restitution = 0.83333333333333337; + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(2.4000000000000004,3,2),0.25,false)._shapeList._restitution = 1.; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_FrictionsAndRestitutions +}); +var demo_core_GearsDemo = function() { + demo_common_DemoBase.call(this,"Gears"); +}; +demo_core_GearsDemo.__name__ = true; +demo_core_GearsDemo.__super__ = demo_common_DemoBase; +demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 6; + var eye_z = 8; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.2,0),new oimo_common_Vec3(4,0.2,1),true); + this.createGear(new oimo_common_Vec3(1,3,0.5),1.0,0.3); + this.createGear(new oimo_common_Vec3(3,3,0.5),1.0,0.3); + this.createGear(new oimo_common_Vec3(-0.5,3,0),0.5,1.6); + this.createGear(new oimo_common_Vec3(1.5,3,-0.5),1.5,0.3); + this.createGear(new oimo_common_Vec3(-2,3,0),1.0,0.3,new oimo_dynamics_constraint_joint_RotationalLimitMotor().setMotor(3.14159265358979,50)); + this.createGear(new oimo_common_Vec3(-3.5,3,0),0.5,0.3); + var _g = 0; + while(_g < 20) { + ++_g; + var _this1 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this1.x *= 3; + _this1.y = _this1.y; + _this1.z = _this1.z; + oimo_common_Vec3.numCreations++; + _this1.x += 0; + _this1.y += 6; + _this1.z += 0; + demo_common_OimoUtil.addBox(world,_this1,new oimo_common_Vec3(0.2,0.2,0.2),false); + } + var _g1 = 0; + while(_g1 < 20) { + ++_g1; + var _this2 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this2.x *= 3; + _this2.y = _this2.y; + _this2.z = _this2.z; + oimo_common_Vec3.numCreations++; + _this2.x += 0; + _this2.y += 6; + _this2.z += 0; + demo_common_OimoUtil.addSphere(world,_this2,0.3,false); + } + } + ,createGear: function(center,radius,thickness,lm) { + var numTeeth = Math.round(6.28318530717958 * radius / 0.4) + 1; + if(numTeeth % 2 == 0) { + --numTeeth; + } + if(numTeeth < 2) { + numTeeth = 2; + } + var toothPos = new oimo_common_Vec3(radius - 0.066666666666666666,0,0); + var toothRot = new oimo_common_Mat3(); + var dtoothRot_e00 = 1; + var dtoothRot_e01 = 0; + var dtoothRot_e02 = 0; + var dtoothRot_e10 = 0; + var dtoothRot_e11 = 1; + var dtoothRot_e12 = 0; + var dtoothRot_e20 = 0; + var dtoothRot_e21 = 0; + var dtoothRot_e22 = 1; + oimo_common_Mat3.numCreations++; + var rad = 6.28318530717958 / numTeeth; + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = 0 * c1 + c; + var r01 = 0 * c1 - 0 * s; + var r02 = 0 * c1 + s; + var r10 = 0 * c1 + 0 * s; + var r11 = c1 + c; + var r12 = 0 * c1 - 0 * s; + var r20 = 0 * c1 - s; + var r21 = 0 * c1 + 0 * s; + var r22 = 0 * c1 + c; + var e00 = dtoothRot_e00 * r00 + dtoothRot_e01 * r10 + dtoothRot_e02 * r20; + var e01 = dtoothRot_e00 * r01 + dtoothRot_e01 * r11 + dtoothRot_e02 * r21; + var e02 = dtoothRot_e00 * r02 + dtoothRot_e01 * r12 + dtoothRot_e02 * r22; + var e10 = dtoothRot_e10 * r00 + dtoothRot_e11 * r10 + dtoothRot_e12 * r20; + var e11 = dtoothRot_e10 * r01 + dtoothRot_e11 * r11 + dtoothRot_e12 * r21; + var e12 = dtoothRot_e10 * r02 + dtoothRot_e11 * r12 + dtoothRot_e12 * r22; + var e20 = dtoothRot_e20 * r00 + dtoothRot_e21 * r10 + dtoothRot_e22 * r20; + var e21 = dtoothRot_e20 * r01 + dtoothRot_e21 * r11 + dtoothRot_e22 * r21; + var e22 = dtoothRot_e20 * r02 + dtoothRot_e21 * r12 + dtoothRot_e22 * r22; + dtoothRot_e00 = e00; + dtoothRot_e01 = e01; + dtoothRot_e02 = e02; + dtoothRot_e10 = e10; + dtoothRot_e11 = e11; + dtoothRot_e12 = e12; + dtoothRot_e20 = e20; + dtoothRot_e21 = e21; + dtoothRot_e22 = e22; + var toothGeom = this.createGearTooth(0.13333333333333333,thickness * 0.5,0.13333333333333333); + var toothSc = new oimo_dynamics_rigidbody_ShapeConfig(); + toothSc.restitution = 0; + toothSc.geometry = toothGeom; + var wheel = demo_common_OimoUtil.addCylinder(this.world,center,radius - 0.13333333333333333,thickness * 0.48,false); + var _g = 0; + var _g1 = numTeeth; + while(_g < _g1) { + ++_g; + toothSc.position = toothPos; + toothSc.rotation = toothRot; + wheel.addShape(new oimo_dynamics_rigidbody_Shape(toothSc)); + var y = toothPos.x * e10 + toothPos.y * e11 + toothPos.z * e12; + var z = toothPos.x * e20 + toothPos.y * e21 + toothPos.z * e22; + toothPos.x = toothPos.x * e00 + toothPos.y * e01 + toothPos.z * e02; + toothPos.y = y; + toothPos.z = z; + var e011 = toothRot.e00 * e01 + toothRot.e01 * e11 + toothRot.e02 * e21; + var e021 = toothRot.e00 * e02 + toothRot.e01 * e12 + toothRot.e02 * e22; + var e111 = toothRot.e10 * e01 + toothRot.e11 * e11 + toothRot.e12 * e21; + var e121 = toothRot.e10 * e02 + toothRot.e11 * e12 + toothRot.e12 * e22; + var e211 = toothRot.e20 * e01 + toothRot.e21 * e11 + toothRot.e22 * e21; + var e221 = toothRot.e20 * e02 + toothRot.e21 * e12 + toothRot.e22 * e22; + toothRot.e00 = toothRot.e00 * e00 + toothRot.e01 * e10 + toothRot.e02 * e20; + toothRot.e01 = e011; + toothRot.e02 = e021; + toothRot.e10 = toothRot.e10 * e00 + toothRot.e11 * e10 + toothRot.e12 * e20; + toothRot.e11 = e111; + toothRot.e12 = e121; + toothRot.e20 = toothRot.e20 * e00 + toothRot.e21 * e10 + toothRot.e22 * e20; + toothRot.e21 = e211; + toothRot.e22 = e221; + } + var m_e00 = 1; + var m_e01 = 0; + var m_e02 = 0; + var m_e10 = 0; + var m_e11 = 1; + var m_e12 = 0; + var m_e20 = 0; + var m_e21 = 0; + var m_e22 = 1; + oimo_common_Mat3.numCreations++; + var s1 = Math.sin(1.570796326794895); + var c2 = Math.cos(1.570796326794895); + var c11 = 1 - c2; + var r001 = c11 + c2; + var r011 = 0 * c11 - 0 * s1; + var r021 = 0 * c11 + 0 * s1; + var r101 = 0 * c11 + 0 * s1; + var r111 = 0 * c11 + c2; + var r121 = 0 * c11 - s1; + var r201 = 0 * c11 - 0 * s1; + var r211 = 0 * c11 + s1; + var r221 = 0 * c11 + c2; + var e001 = m_e00 * r001 + m_e01 * r101 + m_e02 * r201; + var e012 = m_e00 * r011 + m_e01 * r111 + m_e02 * r211; + var e022 = m_e00 * r021 + m_e01 * r121 + m_e02 * r221; + var e101 = m_e10 * r001 + m_e11 * r101 + m_e12 * r201; + var e112 = m_e10 * r011 + m_e11 * r111 + m_e12 * r211; + var e122 = m_e10 * r021 + m_e11 * r121 + m_e12 * r221; + var e201 = m_e20 * r001 + m_e21 * r101 + m_e22 * r201; + var e212 = m_e20 * r011 + m_e21 * r111 + m_e22 * r211; + var e222 = m_e20 * r021 + m_e21 * r121 + m_e22 * r221; + m_e00 = e001; + m_e01 = e012; + m_e02 = e022; + m_e10 = e101; + m_e11 = e112; + m_e12 = e122; + m_e20 = e201; + m_e21 = e212; + m_e22 = e222; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = e001; + rot01 = e012; + rot02 = e022; + rot10 = e101; + rot11 = e112; + rot12 = e122; + rot20 = e201; + rot21 = e212; + rot22 = e222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * wheel._transform._rotation00 + rot01 * wheel._transform._rotation10 + rot02 * wheel._transform._rotation20; + __tmp__01 = rot00 * wheel._transform._rotation01 + rot01 * wheel._transform._rotation11 + rot02 * wheel._transform._rotation21; + __tmp__02 = rot00 * wheel._transform._rotation02 + rot01 * wheel._transform._rotation12 + rot02 * wheel._transform._rotation22; + __tmp__10 = rot10 * wheel._transform._rotation00 + rot11 * wheel._transform._rotation10 + rot12 * wheel._transform._rotation20; + __tmp__11 = rot10 * wheel._transform._rotation01 + rot11 * wheel._transform._rotation11 + rot12 * wheel._transform._rotation21; + __tmp__12 = rot10 * wheel._transform._rotation02 + rot11 * wheel._transform._rotation12 + rot12 * wheel._transform._rotation22; + __tmp__20 = rot20 * wheel._transform._rotation00 + rot21 * wheel._transform._rotation10 + rot22 * wheel._transform._rotation20; + __tmp__21 = rot20 * wheel._transform._rotation01 + rot21 * wheel._transform._rotation11 + rot22 * wheel._transform._rotation21; + __tmp__22 = rot20 * wheel._transform._rotation02 + rot21 * wheel._transform._rotation12 + rot22 * wheel._transform._rotation22; + wheel._transform._rotation00 = __tmp__00; + wheel._transform._rotation01 = __tmp__01; + wheel._transform._rotation02 = __tmp__02; + wheel._transform._rotation10 = __tmp__10; + wheel._transform._rotation11 = __tmp__11; + wheel._transform._rotation12 = __tmp__12; + wheel._transform._rotation20 = __tmp__20; + wheel._transform._rotation21 = __tmp__21; + wheel._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = wheel._transform._rotation00 * wheel._invLocalInertia00 + wheel._transform._rotation01 * wheel._invLocalInertia10 + wheel._transform._rotation02 * wheel._invLocalInertia20; + __tmp__011 = wheel._transform._rotation00 * wheel._invLocalInertia01 + wheel._transform._rotation01 * wheel._invLocalInertia11 + wheel._transform._rotation02 * wheel._invLocalInertia21; + __tmp__021 = wheel._transform._rotation00 * wheel._invLocalInertia02 + wheel._transform._rotation01 * wheel._invLocalInertia12 + wheel._transform._rotation02 * wheel._invLocalInertia22; + __tmp__101 = wheel._transform._rotation10 * wheel._invLocalInertia00 + wheel._transform._rotation11 * wheel._invLocalInertia10 + wheel._transform._rotation12 * wheel._invLocalInertia20; + __tmp__111 = wheel._transform._rotation10 * wheel._invLocalInertia01 + wheel._transform._rotation11 * wheel._invLocalInertia11 + wheel._transform._rotation12 * wheel._invLocalInertia21; + __tmp__121 = wheel._transform._rotation10 * wheel._invLocalInertia02 + wheel._transform._rotation11 * wheel._invLocalInertia12 + wheel._transform._rotation12 * wheel._invLocalInertia22; + __tmp__201 = wheel._transform._rotation20 * wheel._invLocalInertia00 + wheel._transform._rotation21 * wheel._invLocalInertia10 + wheel._transform._rotation22 * wheel._invLocalInertia20; + __tmp__211 = wheel._transform._rotation20 * wheel._invLocalInertia01 + wheel._transform._rotation21 * wheel._invLocalInertia11 + wheel._transform._rotation22 * wheel._invLocalInertia21; + __tmp__221 = wheel._transform._rotation20 * wheel._invLocalInertia02 + wheel._transform._rotation21 * wheel._invLocalInertia12 + wheel._transform._rotation22 * wheel._invLocalInertia22; + wheel._invInertia00 = __tmp__001; + wheel._invInertia01 = __tmp__011; + wheel._invInertia02 = __tmp__021; + wheel._invInertia10 = __tmp__101; + wheel._invInertia11 = __tmp__111; + wheel._invInertia12 = __tmp__121; + wheel._invInertia20 = __tmp__201; + wheel._invInertia21 = __tmp__211; + wheel._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = wheel._invInertia00 * wheel._transform._rotation00 + wheel._invInertia01 * wheel._transform._rotation01 + wheel._invInertia02 * wheel._transform._rotation02; + __tmp__012 = wheel._invInertia00 * wheel._transform._rotation10 + wheel._invInertia01 * wheel._transform._rotation11 + wheel._invInertia02 * wheel._transform._rotation12; + __tmp__022 = wheel._invInertia00 * wheel._transform._rotation20 + wheel._invInertia01 * wheel._transform._rotation21 + wheel._invInertia02 * wheel._transform._rotation22; + __tmp__102 = wheel._invInertia10 * wheel._transform._rotation00 + wheel._invInertia11 * wheel._transform._rotation01 + wheel._invInertia12 * wheel._transform._rotation02; + __tmp__112 = wheel._invInertia10 * wheel._transform._rotation10 + wheel._invInertia11 * wheel._transform._rotation11 + wheel._invInertia12 * wheel._transform._rotation12; + __tmp__122 = wheel._invInertia10 * wheel._transform._rotation20 + wheel._invInertia11 * wheel._transform._rotation21 + wheel._invInertia12 * wheel._transform._rotation22; + __tmp__202 = wheel._invInertia20 * wheel._transform._rotation00 + wheel._invInertia21 * wheel._transform._rotation01 + wheel._invInertia22 * wheel._transform._rotation02; + __tmp__212 = wheel._invInertia20 * wheel._transform._rotation10 + wheel._invInertia21 * wheel._transform._rotation11 + wheel._invInertia22 * wheel._transform._rotation12; + __tmp__222 = wheel._invInertia20 * wheel._transform._rotation20 + wheel._invInertia21 * wheel._transform._rotation21 + wheel._invInertia22 * wheel._transform._rotation22; + wheel._invInertia00 = __tmp__002; + wheel._invInertia01 = __tmp__012; + wheel._invInertia02 = __tmp__022; + wheel._invInertia10 = __tmp__102; + wheel._invInertia11 = __tmp__112; + wheel._invInertia12 = __tmp__122; + wheel._invInertia20 = __tmp__202; + wheel._invInertia21 = __tmp__212; + wheel._invInertia22 = __tmp__222; + wheel._invInertia00 *= wheel._rotFactor.x; + wheel._invInertia01 *= wheel._rotFactor.x; + wheel._invInertia02 *= wheel._rotFactor.x; + wheel._invInertia10 *= wheel._rotFactor.y; + wheel._invInertia11 *= wheel._rotFactor.y; + wheel._invInertia12 *= wheel._rotFactor.y; + wheel._invInertia20 *= wheel._rotFactor.z; + wheel._invInertia21 *= wheel._rotFactor.z; + wheel._invInertia22 *= wheel._rotFactor.z; + var dst = wheel._ptransform; + var src = wheel._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s2 = wheel._shapeList; + while(s2 != null) { + var n = s2._next; + var tf1 = wheel._ptransform; + var tf2 = wheel._transform; + var dst1 = s2._ptransform; + var src1 = s2._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s2._transform; + var src11 = s2._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX = s2._aabb._minX; + minY = s2._aabb._minY; + minZ = s2._aabb._minZ; + maxX = s2._aabb._maxX; + maxY = s2._aabb._maxY; + maxZ = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX < s2._aabb._minX ? minX : s2._aabb._minX; + s2._aabb._minY = minY < s2._aabb._minY ? minY : s2._aabb._minY; + s2._aabb._minZ = minZ < s2._aabb._minZ ? minZ : s2._aabb._minZ; + s2._aabb._maxX = maxX > s2._aabb._maxX ? maxX : s2._aabb._maxX; + s2._aabb._maxY = maxY > s2._aabb._maxY ? maxY : s2._aabb._maxY; + s2._aabb._maxZ = maxZ > s2._aabb._maxZ ? maxZ : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX; + var dY; + var dZ; + dX = s2._transform._positionX - s2._ptransform._positionX; + dY = s2._transform._positionY - s2._ptransform._positionY; + dZ = s2._transform._positionZ - s2._ptransform._positionZ; + var v = s2.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n; + } + wheel._sleeping = false; + wheel._sleepTime = 0; + var fixture = demo_common_OimoUtil.addCylinder(this.world,center,0.1,thickness * 0.52,true); + var m_e001 = 1; + var m_e011 = 0; + var m_e021 = 0; + var m_e101 = 0; + var m_e111 = 1; + var m_e121 = 0; + var m_e201 = 0; + var m_e211 = 0; + var m_e221 = 1; + oimo_common_Mat3.numCreations++; + var s3 = Math.sin(1.570796326794895); + var c3 = Math.cos(1.570796326794895); + var c12 = 1 - c3; + var r002 = c12 + c3; + var r012 = 0 * c12 - 0 * s3; + var r022 = 0 * c12 + 0 * s3; + var r102 = 0 * c12 + 0 * s3; + var r112 = 0 * c12 + c3; + var r122 = 0 * c12 - s3; + var r202 = 0 * c12 - 0 * s3; + var r212 = 0 * c12 + s3; + var r222 = 0 * c12 + c3; + var e002 = m_e001 * r002 + m_e011 * r102 + m_e021 * r202; + var e013 = m_e001 * r012 + m_e011 * r112 + m_e021 * r212; + var e023 = m_e001 * r022 + m_e011 * r122 + m_e021 * r222; + var e102 = m_e101 * r002 + m_e111 * r102 + m_e121 * r202; + var e113 = m_e101 * r012 + m_e111 * r112 + m_e121 * r212; + var e123 = m_e101 * r022 + m_e111 * r122 + m_e121 * r222; + var e202 = m_e201 * r002 + m_e211 * r102 + m_e221 * r202; + var e213 = m_e201 * r012 + m_e211 * r112 + m_e221 * r212; + var e223 = m_e201 * r022 + m_e211 * r122 + m_e221 * r222; + m_e001 = e002; + m_e011 = e013; + m_e021 = e023; + m_e101 = e102; + m_e111 = e113; + m_e121 = e123; + m_e201 = e202; + m_e211 = e213; + m_e221 = e223; + var rot001; + var rot011; + var rot021; + var rot101; + var rot111; + var rot121; + var rot201; + var rot211; + var rot221; + rot001 = e002; + rot011 = e013; + rot021 = e023; + rot101 = e102; + rot111 = e113; + rot121 = e123; + rot201 = e202; + rot211 = e213; + rot221 = e223; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = rot001 * fixture._transform._rotation00 + rot011 * fixture._transform._rotation10 + rot021 * fixture._transform._rotation20; + __tmp__015 = rot001 * fixture._transform._rotation01 + rot011 * fixture._transform._rotation11 + rot021 * fixture._transform._rotation21; + __tmp__025 = rot001 * fixture._transform._rotation02 + rot011 * fixture._transform._rotation12 + rot021 * fixture._transform._rotation22; + __tmp__105 = rot101 * fixture._transform._rotation00 + rot111 * fixture._transform._rotation10 + rot121 * fixture._transform._rotation20; + __tmp__115 = rot101 * fixture._transform._rotation01 + rot111 * fixture._transform._rotation11 + rot121 * fixture._transform._rotation21; + __tmp__125 = rot101 * fixture._transform._rotation02 + rot111 * fixture._transform._rotation12 + rot121 * fixture._transform._rotation22; + __tmp__205 = rot201 * fixture._transform._rotation00 + rot211 * fixture._transform._rotation10 + rot221 * fixture._transform._rotation20; + __tmp__215 = rot201 * fixture._transform._rotation01 + rot211 * fixture._transform._rotation11 + rot221 * fixture._transform._rotation21; + __tmp__225 = rot201 * fixture._transform._rotation02 + rot211 * fixture._transform._rotation12 + rot221 * fixture._transform._rotation22; + fixture._transform._rotation00 = __tmp__005; + fixture._transform._rotation01 = __tmp__015; + fixture._transform._rotation02 = __tmp__025; + fixture._transform._rotation10 = __tmp__105; + fixture._transform._rotation11 = __tmp__115; + fixture._transform._rotation12 = __tmp__125; + fixture._transform._rotation20 = __tmp__205; + fixture._transform._rotation21 = __tmp__215; + fixture._transform._rotation22 = __tmp__225; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = fixture._transform._rotation00 * fixture._invLocalInertia00 + fixture._transform._rotation01 * fixture._invLocalInertia10 + fixture._transform._rotation02 * fixture._invLocalInertia20; + __tmp__016 = fixture._transform._rotation00 * fixture._invLocalInertia01 + fixture._transform._rotation01 * fixture._invLocalInertia11 + fixture._transform._rotation02 * fixture._invLocalInertia21; + __tmp__026 = fixture._transform._rotation00 * fixture._invLocalInertia02 + fixture._transform._rotation01 * fixture._invLocalInertia12 + fixture._transform._rotation02 * fixture._invLocalInertia22; + __tmp__106 = fixture._transform._rotation10 * fixture._invLocalInertia00 + fixture._transform._rotation11 * fixture._invLocalInertia10 + fixture._transform._rotation12 * fixture._invLocalInertia20; + __tmp__116 = fixture._transform._rotation10 * fixture._invLocalInertia01 + fixture._transform._rotation11 * fixture._invLocalInertia11 + fixture._transform._rotation12 * fixture._invLocalInertia21; + __tmp__126 = fixture._transform._rotation10 * fixture._invLocalInertia02 + fixture._transform._rotation11 * fixture._invLocalInertia12 + fixture._transform._rotation12 * fixture._invLocalInertia22; + __tmp__206 = fixture._transform._rotation20 * fixture._invLocalInertia00 + fixture._transform._rotation21 * fixture._invLocalInertia10 + fixture._transform._rotation22 * fixture._invLocalInertia20; + __tmp__216 = fixture._transform._rotation20 * fixture._invLocalInertia01 + fixture._transform._rotation21 * fixture._invLocalInertia11 + fixture._transform._rotation22 * fixture._invLocalInertia21; + __tmp__226 = fixture._transform._rotation20 * fixture._invLocalInertia02 + fixture._transform._rotation21 * fixture._invLocalInertia12 + fixture._transform._rotation22 * fixture._invLocalInertia22; + fixture._invInertia00 = __tmp__006; + fixture._invInertia01 = __tmp__016; + fixture._invInertia02 = __tmp__026; + fixture._invInertia10 = __tmp__106; + fixture._invInertia11 = __tmp__116; + fixture._invInertia12 = __tmp__126; + fixture._invInertia20 = __tmp__206; + fixture._invInertia21 = __tmp__216; + fixture._invInertia22 = __tmp__226; + var __tmp__007; + var __tmp__017; + var __tmp__027; + var __tmp__107; + var __tmp__117; + var __tmp__127; + var __tmp__207; + var __tmp__217; + var __tmp__227; + __tmp__007 = fixture._invInertia00 * fixture._transform._rotation00 + fixture._invInertia01 * fixture._transform._rotation01 + fixture._invInertia02 * fixture._transform._rotation02; + __tmp__017 = fixture._invInertia00 * fixture._transform._rotation10 + fixture._invInertia01 * fixture._transform._rotation11 + fixture._invInertia02 * fixture._transform._rotation12; + __tmp__027 = fixture._invInertia00 * fixture._transform._rotation20 + fixture._invInertia01 * fixture._transform._rotation21 + fixture._invInertia02 * fixture._transform._rotation22; + __tmp__107 = fixture._invInertia10 * fixture._transform._rotation00 + fixture._invInertia11 * fixture._transform._rotation01 + fixture._invInertia12 * fixture._transform._rotation02; + __tmp__117 = fixture._invInertia10 * fixture._transform._rotation10 + fixture._invInertia11 * fixture._transform._rotation11 + fixture._invInertia12 * fixture._transform._rotation12; + __tmp__127 = fixture._invInertia10 * fixture._transform._rotation20 + fixture._invInertia11 * fixture._transform._rotation21 + fixture._invInertia12 * fixture._transform._rotation22; + __tmp__207 = fixture._invInertia20 * fixture._transform._rotation00 + fixture._invInertia21 * fixture._transform._rotation01 + fixture._invInertia22 * fixture._transform._rotation02; + __tmp__217 = fixture._invInertia20 * fixture._transform._rotation10 + fixture._invInertia21 * fixture._transform._rotation11 + fixture._invInertia22 * fixture._transform._rotation12; + __tmp__227 = fixture._invInertia20 * fixture._transform._rotation20 + fixture._invInertia21 * fixture._transform._rotation21 + fixture._invInertia22 * fixture._transform._rotation22; + fixture._invInertia00 = __tmp__007; + fixture._invInertia01 = __tmp__017; + fixture._invInertia02 = __tmp__027; + fixture._invInertia10 = __tmp__107; + fixture._invInertia11 = __tmp__117; + fixture._invInertia12 = __tmp__127; + fixture._invInertia20 = __tmp__207; + fixture._invInertia21 = __tmp__217; + fixture._invInertia22 = __tmp__227; + fixture._invInertia00 *= fixture._rotFactor.x; + fixture._invInertia01 *= fixture._rotFactor.x; + fixture._invInertia02 *= fixture._rotFactor.x; + fixture._invInertia10 *= fixture._rotFactor.y; + fixture._invInertia11 *= fixture._rotFactor.y; + fixture._invInertia12 *= fixture._rotFactor.y; + fixture._invInertia20 *= fixture._rotFactor.z; + fixture._invInertia21 *= fixture._rotFactor.z; + fixture._invInertia22 *= fixture._rotFactor.z; + var dst3 = fixture._ptransform; + var src2 = fixture._transform; + dst3._positionX = src2._positionX; + dst3._positionY = src2._positionY; + dst3._positionZ = src2._positionZ; + dst3._rotation00 = src2._rotation00; + dst3._rotation01 = src2._rotation01; + dst3._rotation02 = src2._rotation02; + dst3._rotation10 = src2._rotation10; + dst3._rotation11 = src2._rotation11; + dst3._rotation12 = src2._rotation12; + dst3._rotation20 = src2._rotation20; + dst3._rotation21 = src2._rotation21; + dst3._rotation22 = src2._rotation22; + var s4 = fixture._shapeList; + while(s4 != null) { + var n1 = s4._next; + var tf11 = fixture._ptransform; + var tf21 = fixture._transform; + var dst4 = s4._ptransform; + var src12 = s4._localTransform; + var __tmp__008; + var __tmp__018; + var __tmp__028; + var __tmp__108; + var __tmp__118; + var __tmp__128; + var __tmp__208; + var __tmp__218; + var __tmp__228; + __tmp__008 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__018 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__028 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__108 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__118 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__128 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__208 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__218 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__228 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst4._rotation00 = __tmp__008; + dst4._rotation01 = __tmp__018; + dst4._rotation02 = __tmp__028; + dst4._rotation10 = __tmp__108; + dst4._rotation11 = __tmp__118; + dst4._rotation12 = __tmp__128; + dst4._rotation20 = __tmp__208; + dst4._rotation21 = __tmp__218; + dst4._rotation22 = __tmp__228; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst4._positionX = __tmp__X2; + dst4._positionY = __tmp__Y2; + dst4._positionZ = __tmp__Z2; + dst4._positionX += tf11._positionX; + dst4._positionY += tf11._positionY; + dst4._positionZ += tf11._positionZ; + var dst5 = s4._transform; + var src13 = s4._localTransform; + var __tmp__009; + var __tmp__019; + var __tmp__029; + var __tmp__109; + var __tmp__119; + var __tmp__129; + var __tmp__209; + var __tmp__219; + var __tmp__229; + __tmp__009 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__019 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__029 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__109 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__119 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__129 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__209 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__219 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__229 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst5._rotation00 = __tmp__009; + dst5._rotation01 = __tmp__019; + dst5._rotation02 = __tmp__029; + dst5._rotation10 = __tmp__109; + dst5._rotation11 = __tmp__119; + dst5._rotation12 = __tmp__129; + dst5._rotation20 = __tmp__209; + dst5._rotation21 = __tmp__219; + dst5._rotation22 = __tmp__229; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst5._positionX = __tmp__X3; + dst5._positionY = __tmp__Y3; + dst5._positionZ = __tmp__Z3; + dst5._positionX += tf21._positionX; + dst5._positionY += tf21._positionY; + dst5._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s4._geom._computeAabb(s4._aabb,s4._ptransform); + minX1 = s4._aabb._minX; + minY1 = s4._aabb._minY; + minZ1 = s4._aabb._minZ; + maxX1 = s4._aabb._maxX; + maxY1 = s4._aabb._maxY; + maxZ1 = s4._aabb._maxZ; + s4._geom._computeAabb(s4._aabb,s4._transform); + s4._aabb._minX = minX1 < s4._aabb._minX ? minX1 : s4._aabb._minX; + s4._aabb._minY = minY1 < s4._aabb._minY ? minY1 : s4._aabb._minY; + s4._aabb._minZ = minZ1 < s4._aabb._minZ ? minZ1 : s4._aabb._minZ; + s4._aabb._maxX = maxX1 > s4._aabb._maxX ? maxX1 : s4._aabb._maxX; + s4._aabb._maxY = maxY1 > s4._aabb._maxY ? maxY1 : s4._aabb._maxY; + s4._aabb._maxZ = maxZ1 > s4._aabb._maxZ ? maxZ1 : s4._aabb._maxZ; + if(s4._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s4._transform._positionX - s4._ptransform._positionX; + dY1 = s4._transform._positionY - s4._ptransform._positionY; + dZ1 = s4._transform._positionZ - s4._ptransform._positionZ; + var v1 = s4.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s4._rigidBody._world._broadPhase.moveProxy(s4._proxy,s4._aabb,s4.displacement); + } + s4 = n1; + } + fixture._sleeping = false; + fixture._sleepTime = 0; + demo_common_OimoUtil.addRevoluteJoint(this.world,wheel,fixture,center,new oimo_common_Vec3(0,0,1),null,lm); + } + ,createGearTooth: function(hw,hh,hd) { + var geom = new oimo_collision_geometry_ConvexHullGeometry([new oimo_common_Vec3(-hw,-hh,-hd),new oimo_common_Vec3(-hw,-hh,hd),new oimo_common_Vec3(-hw,hh,-hd),new oimo_common_Vec3(-hw,hh,hd),new oimo_common_Vec3(hw,-hh,-hd * 0.3),new oimo_common_Vec3(hw,-hh,hd * 0.3),new oimo_common_Vec3(hw,hh,-hd * 0.3),new oimo_common_Vec3(hw,hh,hd * 0.3)]); + geom._gjkMargin = 0; + return geom; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,3,1); + } + ,__class__: demo_core_GearsDemo +}); +var demo_core_JointsDemo = function() { + demo_common_DemoBase.call(this,"Joints"); +}; +demo_core_JointsDemo.__name__ = true; +demo_core_JointsDemo.__super__ = demo_common_DemoBase; +demo_core_JointsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.2,0),new oimo_common_Vec3(6,0.2,6),true); + renderer.g.getDebugDraw().drawJointLimits = true; + this.createBallChain(new oimo_common_Vec3(-2,5,-2),0.4,7); + this.createHingeChain(new oimo_common_Vec3(2,5,-2),0.3,7,new oimo_common_Vec3(0,0,1)); + this.createBoard(0,4,0,new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.7853981633974475,0.7853981633974475),new oimo_dynamics_constraint_joint_SpringDamper().setSpring(2,0.3)); + this.createBoard(0,6,0,new oimo_dynamics_constraint_joint_RotationalLimitMotor().setMotor(6.28318530717958,25.13274122871832),new oimo_dynamics_constraint_joint_SpringDamper()); + var x = 2; + var y = 5; + var z = 1; + demo_common_OimoUtil.addPrismaticJoint(world,demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(x,y,z),0.1,true),demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(0.3,0.5,0.5),false),new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(1,1,0),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-1,1)); + var x1 = -2; + var y1 = 5; + var z1 = 1; + demo_common_OimoUtil.addCylindricalJoint(world,demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(x1,y1,z1),0.1,true),demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-2.31,y1,z1),new oimo_common_Vec3(0.3,0.5,0.5),false),new oimo_common_Vec3(x1,y1,z1),new oimo_common_Vec3(1,0,0),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-2,2),new oimo_dynamics_constraint_joint_SpringDamper().setSpring(4,0.7),new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-1,1)); + var x2 = -2; + var z2 = 3; + var b1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x2,4.,z2),new oimo_common_Vec3(0.2,0.2,0.2),true); + b1.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); + oimo_common_Vec3.numCreations++; + if(b1._type == 1) { + b1._angVelX = 0; + b1._angVelY = 0; + b1._angVelZ = 0; + } else { + b1._angVelX = 0; + b1._angVelY = 1.5; + b1._angVelZ = 0; + } + b1._sleeping = false; + b1._sleepTime = 0; + demo_common_OimoUtil.addRagdollJoint(world,b1,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x2,2.,z2),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x2,3,z2),new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),40,80,new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.570796326794895,1.570796326794895)); + var x3 = 2; + var z3 = 3; + var hingeLimit1 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.7853981633974475,0.7853981633974475); + var hingeLimit2 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.2566370614359161,1.2566370614359161); + var b11 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x3,4.,z3),new oimo_common_Vec3(0.2,0.2,0.2),true); + b11.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); + oimo_common_Vec3.numCreations++; + if(b11._type == 1) { + b11._angVelX = 0; + b11._angVelY = 0; + b11._angVelZ = 0; + } else { + b11._angVelX = 0; + b11._angVelY = 1.5; + b11._angVelZ = 0; + } + b11._sleeping = false; + b11._sleepTime = 0; + demo_common_OimoUtil.addUniversalJoint(world,b11,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x3,2.,z3),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x3,3,z3),new oimo_common_Vec3(1,0,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit1,new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit2); + var x4 = 0; + var z4 = 3; + var rotXLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.62831853071795807,0.62831853071795807); + var rotYLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.31415926535897903,0.31415926535897903); + var rotZLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.2566370614359161,1.2566370614359161); + var translXLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.2,0.2); + var translYLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.3,0); + var translZLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.2,0.8); + var b12 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x4,4.,z4),new oimo_common_Vec3(0.2,0.2,0.2),true); + b12.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); + oimo_common_Vec3.numCreations++; + if(b12._type == 1) { + b12._angVelX = 0; + b12._angVelY = 0; + b12._angVelZ = 0; + } else { + b12._angVelX = 0; + b12._angVelY = 1.5; + b12._angVelZ = 0; + } + b12._sleeping = false; + b12._sleepTime = 0; + demo_common_OimoUtil.addGenericJoint(world,b12,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x4,2.,z4),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x4,3,z4),new oimo_common_Mat3(),new oimo_common_Mat3(),null,[translXLimit,translYLimit,translZLimit],null,[rotXLimit,rotYLimit,rotZLimit]); + } + ,createBoard: function(x,y,z,lm,sd) { + var b1 = demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(0.1,0.1,0.1),true); + var b2 = demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(x + 0.5,y,z),new oimo_common_Vec3(0.5,0.2,0.4),false); + demo_common_OimoUtil.addRevoluteJoint(this.world,b1,b2,new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(0,0,1),sd,lm); + } + ,createBallChain: function(from,radius,num) { + var bc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + var _this = bc.position; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + bc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; + var sc = new oimo_dynamics_rigidbody_ShapeConfig(); + sc.geometry = new oimo_collision_geometry_SphereGeometry(radius * 0.9); + var b2; + var b1 = new oimo_dynamics_rigidbody_RigidBody(bc); + b1.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + this.world.addRigidBody(b1); + var jc = new oimo_dynamics_constraint_joint_SphericalJointConfig(); + jc.localAnchor1.init(0,0,0); + jc.localAnchor2.init(0,-radius * 2,0); + bc.type = oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC; + var _g = 0; + while(_g < num) { + if(_g++ == num - 1) { + bc.position.x += -0.001 + Math.random() * 0.002; + bc.position.z += -0.001 + Math.random() * 0.002; + } + bc.position.y += radius * 2; + b2 = new oimo_dynamics_rigidbody_RigidBody(bc); + b2.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + this.world.addRigidBody(b2); + jc.rigidBody1 = b1; + jc.rigidBody2 = b2; + this.world.addJoint(new oimo_dynamics_constraint_joint_SphericalJoint(jc)); + b1 = b2; + jc.localAnchor1.init(0,radius,0); + jc.localAnchor2.init(0,-radius,0); + } + } + ,createHingeChain: function(from,radius,num,axis) { + var bc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + var _this = bc.position; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + bc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; + var cc = new oimo_dynamics_rigidbody_ShapeConfig(); + cc.geometry = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(radius,radius,radius)); + var b2; + var b1 = new oimo_dynamics_rigidbody_RigidBody(bc); + b1.addShape(new oimo_dynamics_rigidbody_Shape(cc)); + this.world.addRigidBody(b1); + cc.geometry = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(radius * 0.5,radius * 0.9,radius * 0.9)); + var jc = new oimo_dynamics_constraint_joint_RevoluteJointConfig(); + jc.localAnchor1.init(0,0,0); + jc.localAnchor2.init(0,-radius * 2,0); + bc.type = oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC; + var _g = 0; + while(_g < num) { + jc.localAxis1 = axis; + jc.localAxis2 = axis; + if(_g++ == num - 1) { + bc.position.x += -0.001 + Math.random() * 0.002; + bc.position.z += -0.001 + Math.random() * 0.002; + } + bc.position.y += radius * 2; + b2 = new oimo_dynamics_rigidbody_RigidBody(bc); + b2.addShape(new oimo_dynamics_rigidbody_Shape(cc)); + this.world.addRigidBody(b2); + jc.rigidBody1 = b1; + jc.rigidBody2 = b2; + this.world.addJoint(new oimo_dynamics_constraint_joint_RevoluteJoint(jc)); + b1 = b2; + jc.localAnchor1.init(0,radius,0); + jc.localAnchor2.init(0,-radius,0); + } + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + } + ,__class__: demo_core_JointsDemo +}); +var demo_core_LimitRotationDemo = function() { + demo_common_DemoBase.call(this,"Rotation Limit"); +}; +demo_core_LimitRotationDemo.__name__ = true; +demo_core_LimitRotationDemo.__super__ = demo_common_DemoBase; +demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(7,0.5,7),true); + var _g = 0; + while(_g < 5) { + var i = _g++; + var _g1 = -2; + while(_g1 < 3) { + var j = _g1++; + var _g2 = -2; + while(_g2 < 3) { + var box = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.61,0.3 + i * 0.3 * 3,_g2++ * 0.61),new oimo_common_Vec3(0.3,0.3,0.3),false); + oimo_common_Vec3.numCreations++; + var _this1 = box._rotFactor; + _this1.x = 0; + _this1.y = 0; + _this1.z = 0; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = box._transform._rotation00 * box._invLocalInertia00 + box._transform._rotation01 * box._invLocalInertia10 + box._transform._rotation02 * box._invLocalInertia20; + __tmp__01 = box._transform._rotation00 * box._invLocalInertia01 + box._transform._rotation01 * box._invLocalInertia11 + box._transform._rotation02 * box._invLocalInertia21; + __tmp__02 = box._transform._rotation00 * box._invLocalInertia02 + box._transform._rotation01 * box._invLocalInertia12 + box._transform._rotation02 * box._invLocalInertia22; + __tmp__10 = box._transform._rotation10 * box._invLocalInertia00 + box._transform._rotation11 * box._invLocalInertia10 + box._transform._rotation12 * box._invLocalInertia20; + __tmp__11 = box._transform._rotation10 * box._invLocalInertia01 + box._transform._rotation11 * box._invLocalInertia11 + box._transform._rotation12 * box._invLocalInertia21; + __tmp__12 = box._transform._rotation10 * box._invLocalInertia02 + box._transform._rotation11 * box._invLocalInertia12 + box._transform._rotation12 * box._invLocalInertia22; + __tmp__20 = box._transform._rotation20 * box._invLocalInertia00 + box._transform._rotation21 * box._invLocalInertia10 + box._transform._rotation22 * box._invLocalInertia20; + __tmp__21 = box._transform._rotation20 * box._invLocalInertia01 + box._transform._rotation21 * box._invLocalInertia11 + box._transform._rotation22 * box._invLocalInertia21; + __tmp__22 = box._transform._rotation20 * box._invLocalInertia02 + box._transform._rotation21 * box._invLocalInertia12 + box._transform._rotation22 * box._invLocalInertia22; + box._invInertia00 = __tmp__00; + box._invInertia01 = __tmp__01; + box._invInertia02 = __tmp__02; + box._invInertia10 = __tmp__10; + box._invInertia11 = __tmp__11; + box._invInertia12 = __tmp__12; + box._invInertia20 = __tmp__20; + box._invInertia21 = __tmp__21; + box._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = box._invInertia00 * box._transform._rotation00 + box._invInertia01 * box._transform._rotation01 + box._invInertia02 * box._transform._rotation02; + __tmp__011 = box._invInertia00 * box._transform._rotation10 + box._invInertia01 * box._transform._rotation11 + box._invInertia02 * box._transform._rotation12; + __tmp__021 = box._invInertia00 * box._transform._rotation20 + box._invInertia01 * box._transform._rotation21 + box._invInertia02 * box._transform._rotation22; + __tmp__101 = box._invInertia10 * box._transform._rotation00 + box._invInertia11 * box._transform._rotation01 + box._invInertia12 * box._transform._rotation02; + __tmp__111 = box._invInertia10 * box._transform._rotation10 + box._invInertia11 * box._transform._rotation11 + box._invInertia12 * box._transform._rotation12; + __tmp__121 = box._invInertia10 * box._transform._rotation20 + box._invInertia11 * box._transform._rotation21 + box._invInertia12 * box._transform._rotation22; + __tmp__201 = box._invInertia20 * box._transform._rotation00 + box._invInertia21 * box._transform._rotation01 + box._invInertia22 * box._transform._rotation02; + __tmp__211 = box._invInertia20 * box._transform._rotation10 + box._invInertia21 * box._transform._rotation11 + box._invInertia22 * box._transform._rotation12; + __tmp__221 = box._invInertia20 * box._transform._rotation20 + box._invInertia21 * box._transform._rotation21 + box._invInertia22 * box._transform._rotation22; + box._invInertia00 = __tmp__001; + box._invInertia01 = __tmp__011; + box._invInertia02 = __tmp__021; + box._invInertia10 = __tmp__101; + box._invInertia11 = __tmp__111; + box._invInertia12 = __tmp__121; + box._invInertia20 = __tmp__201; + box._invInertia21 = __tmp__211; + box._invInertia22 = __tmp__221; + box._invInertia00 *= box._rotFactor.x; + box._invInertia01 *= box._rotFactor.x; + box._invInertia02 *= box._rotFactor.x; + box._invInertia10 *= box._rotFactor.y; + box._invInertia11 *= box._rotFactor.y; + box._invInertia12 *= box._rotFactor.y; + box._invInertia20 *= box._rotFactor.z; + box._invInertia21 *= box._rotFactor.z; + box._invInertia22 *= box._rotFactor.z; + box._sleeping = false; + box._sleepTime = 0; + } + } + } + var cylinder = demo_common_OimoUtil.addCylinder(world,new oimo_common_Vec3(0,8,0),1.0,0.3,false); + var cylinderShape = cylinder._shapeList; + var _this2 = cylinderShape._localTransform; + var tf = new oimo_common_Transform(); + tf._positionX = _this2._positionX; + tf._positionY = _this2._positionY; + tf._positionZ = _this2._positionZ; + tf._rotation00 = _this2._rotation00; + tf._rotation01 = _this2._rotation01; + tf._rotation02 = _this2._rotation02; + tf._rotation10 = _this2._rotation10; + tf._rotation11 = _this2._rotation11; + tf._rotation12 = _this2._rotation12; + tf._rotation20 = _this2._rotation20; + tf._rotation21 = _this2._rotation21; + tf._rotation22 = _this2._rotation22; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + var sx = Math.sin(1.570796326794895); + var sy = Math.sin(v_y); + var sz = Math.sin(v_z); + var cx = Math.cos(1.570796326794895); + var cy = Math.cos(v_y); + var cz = Math.cos(v_z); + rot00 = cy * cz; + rot01 = -cy * sz; + rot02 = sy; + rot10 = cx * sz + cz * sx * sy; + rot11 = cx * cz - sx * sy * sz; + rot12 = -cy * sx; + rot20 = sx * sz - cx * cz * sy; + rot21 = cz * sx + cx * sy * sz; + rot22 = cx * cy; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = rot00 * tf._rotation00 + rot01 * tf._rotation10 + rot02 * tf._rotation20; + __tmp__012 = rot00 * tf._rotation01 + rot01 * tf._rotation11 + rot02 * tf._rotation21; + __tmp__022 = rot00 * tf._rotation02 + rot01 * tf._rotation12 + rot02 * tf._rotation22; + __tmp__102 = rot10 * tf._rotation00 + rot11 * tf._rotation10 + rot12 * tf._rotation20; + __tmp__112 = rot10 * tf._rotation01 + rot11 * tf._rotation11 + rot12 * tf._rotation21; + __tmp__122 = rot10 * tf._rotation02 + rot11 * tf._rotation12 + rot12 * tf._rotation22; + __tmp__202 = rot20 * tf._rotation00 + rot21 * tf._rotation10 + rot22 * tf._rotation20; + __tmp__212 = rot20 * tf._rotation01 + rot21 * tf._rotation11 + rot22 * tf._rotation21; + __tmp__222 = rot20 * tf._rotation02 + rot21 * tf._rotation12 + rot22 * tf._rotation22; + tf._rotation00 = __tmp__002; + tf._rotation01 = __tmp__012; + tf._rotation02 = __tmp__022; + tf._rotation10 = __tmp__102; + tf._rotation11 = __tmp__112; + tf._rotation12 = __tmp__122; + tf._rotation20 = __tmp__202; + tf._rotation21 = __tmp__212; + tf._rotation22 = __tmp__222; + var _this3 = cylinderShape._localTransform; + _this3._positionX = tf._positionX; + _this3._positionY = tf._positionY; + _this3._positionZ = tf._positionZ; + _this3._rotation00 = tf._rotation00; + _this3._rotation01 = tf._rotation01; + _this3._rotation02 = tf._rotation02; + _this3._rotation10 = tf._rotation10; + _this3._rotation11 = tf._rotation11; + _this3._rotation12 = tf._rotation12; + _this3._rotation20 = tf._rotation20; + _this3._rotation21 = tf._rotation21; + _this3._rotation22 = tf._rotation22; + if(cylinderShape._rigidBody != null) { + var _this4 = cylinderShape._rigidBody; + _this4.updateMass(); + var s = _this4._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this4._ptransform; + var tf2 = _this4._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__003; + dst._rotation01 = __tmp__013; + dst._rotation02 = __tmp__023; + dst._rotation10 = __tmp__103; + dst._rotation11 = __tmp__113; + dst._rotation12 = __tmp__123; + dst._rotation20 = __tmp__203; + dst._rotation21 = __tmp__213; + dst._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__004; + dst1._rotation01 = __tmp__014; + dst1._rotation02 = __tmp__024; + dst1._rotation10 = __tmp__104; + dst1._rotation11 = __tmp__114; + dst1._rotation12 = __tmp__124; + dst1._rotation20 = __tmp__204; + dst1._rotation21 = __tmp__214; + dst1._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + oimo_common_Vec3.numCreations++; + var _this5 = cylinder._rotFactor; + _this5.x = 0; + _this5.y = 0; + _this5.z = 1; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = cylinder._transform._rotation00 * cylinder._invLocalInertia00 + cylinder._transform._rotation01 * cylinder._invLocalInertia10 + cylinder._transform._rotation02 * cylinder._invLocalInertia20; + __tmp__015 = cylinder._transform._rotation00 * cylinder._invLocalInertia01 + cylinder._transform._rotation01 * cylinder._invLocalInertia11 + cylinder._transform._rotation02 * cylinder._invLocalInertia21; + __tmp__025 = cylinder._transform._rotation00 * cylinder._invLocalInertia02 + cylinder._transform._rotation01 * cylinder._invLocalInertia12 + cylinder._transform._rotation02 * cylinder._invLocalInertia22; + __tmp__105 = cylinder._transform._rotation10 * cylinder._invLocalInertia00 + cylinder._transform._rotation11 * cylinder._invLocalInertia10 + cylinder._transform._rotation12 * cylinder._invLocalInertia20; + __tmp__115 = cylinder._transform._rotation10 * cylinder._invLocalInertia01 + cylinder._transform._rotation11 * cylinder._invLocalInertia11 + cylinder._transform._rotation12 * cylinder._invLocalInertia21; + __tmp__125 = cylinder._transform._rotation10 * cylinder._invLocalInertia02 + cylinder._transform._rotation11 * cylinder._invLocalInertia12 + cylinder._transform._rotation12 * cylinder._invLocalInertia22; + __tmp__205 = cylinder._transform._rotation20 * cylinder._invLocalInertia00 + cylinder._transform._rotation21 * cylinder._invLocalInertia10 + cylinder._transform._rotation22 * cylinder._invLocalInertia20; + __tmp__215 = cylinder._transform._rotation20 * cylinder._invLocalInertia01 + cylinder._transform._rotation21 * cylinder._invLocalInertia11 + cylinder._transform._rotation22 * cylinder._invLocalInertia21; + __tmp__225 = cylinder._transform._rotation20 * cylinder._invLocalInertia02 + cylinder._transform._rotation21 * cylinder._invLocalInertia12 + cylinder._transform._rotation22 * cylinder._invLocalInertia22; + cylinder._invInertia00 = __tmp__005; + cylinder._invInertia01 = __tmp__015; + cylinder._invInertia02 = __tmp__025; + cylinder._invInertia10 = __tmp__105; + cylinder._invInertia11 = __tmp__115; + cylinder._invInertia12 = __tmp__125; + cylinder._invInertia20 = __tmp__205; + cylinder._invInertia21 = __tmp__215; + cylinder._invInertia22 = __tmp__225; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = cylinder._invInertia00 * cylinder._transform._rotation00 + cylinder._invInertia01 * cylinder._transform._rotation01 + cylinder._invInertia02 * cylinder._transform._rotation02; + __tmp__016 = cylinder._invInertia00 * cylinder._transform._rotation10 + cylinder._invInertia01 * cylinder._transform._rotation11 + cylinder._invInertia02 * cylinder._transform._rotation12; + __tmp__026 = cylinder._invInertia00 * cylinder._transform._rotation20 + cylinder._invInertia01 * cylinder._transform._rotation21 + cylinder._invInertia02 * cylinder._transform._rotation22; + __tmp__106 = cylinder._invInertia10 * cylinder._transform._rotation00 + cylinder._invInertia11 * cylinder._transform._rotation01 + cylinder._invInertia12 * cylinder._transform._rotation02; + __tmp__116 = cylinder._invInertia10 * cylinder._transform._rotation10 + cylinder._invInertia11 * cylinder._transform._rotation11 + cylinder._invInertia12 * cylinder._transform._rotation12; + __tmp__126 = cylinder._invInertia10 * cylinder._transform._rotation20 + cylinder._invInertia11 * cylinder._transform._rotation21 + cylinder._invInertia12 * cylinder._transform._rotation22; + __tmp__206 = cylinder._invInertia20 * cylinder._transform._rotation00 + cylinder._invInertia21 * cylinder._transform._rotation01 + cylinder._invInertia22 * cylinder._transform._rotation02; + __tmp__216 = cylinder._invInertia20 * cylinder._transform._rotation10 + cylinder._invInertia21 * cylinder._transform._rotation11 + cylinder._invInertia22 * cylinder._transform._rotation12; + __tmp__226 = cylinder._invInertia20 * cylinder._transform._rotation20 + cylinder._invInertia21 * cylinder._transform._rotation21 + cylinder._invInertia22 * cylinder._transform._rotation22; + cylinder._invInertia00 = __tmp__006; + cylinder._invInertia01 = __tmp__016; + cylinder._invInertia02 = __tmp__026; + cylinder._invInertia10 = __tmp__106; + cylinder._invInertia11 = __tmp__116; + cylinder._invInertia12 = __tmp__126; + cylinder._invInertia20 = __tmp__206; + cylinder._invInertia21 = __tmp__216; + cylinder._invInertia22 = __tmp__226; + cylinder._invInertia00 *= cylinder._rotFactor.x; + cylinder._invInertia01 *= cylinder._rotFactor.x; + cylinder._invInertia02 *= cylinder._rotFactor.x; + cylinder._invInertia10 *= cylinder._rotFactor.y; + cylinder._invInertia11 *= cylinder._rotFactor.y; + cylinder._invInertia12 *= cylinder._rotFactor.y; + cylinder._invInertia20 *= cylinder._rotFactor.z; + cylinder._invInertia21 *= cylinder._rotFactor.z; + cylinder._invInertia22 *= cylinder._rotFactor.z; + cylinder._sleeping = false; + cylinder._sleepTime = 0; + this.body = cylinder; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_LimitRotationDemo +}); +var demo_core_RagdollDemo = function() { + demo_common_DemoBase.call(this,"Ragdolls"); +}; +demo_core_RagdollDemo.__name__ = true; +demo_core_RagdollDemo.__super__ = demo_common_DemoBase; +demo_core_RagdollDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 5; + var eye_z = 6; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + renderer.g.getDebugDraw().drawJointLimits = false; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.2,0),new oimo_common_Vec3(6,0.2,6),true); + var tmp1 = oimo_common_Setting.defaultFriction; + oimo_common_Setting.defaultFriction = 0.5; + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,2,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,4,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,6,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,8,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,10,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,12,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,14,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,16,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,18,0)); + demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,20,0)); + oimo_common_Setting.defaultFriction = tmp1; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + } + ,__class__: demo_core_RagdollDemo +}); +var demo_core_RayCastingDemo = function() { + demo_common_DemoBase.call(this,"Ray Casting"); +}; +demo_core_RayCastingDemo.__name__ = true; +demo_core_RayCastingDemo.__super__ = demo_common_DemoBase; +demo_core_RayCastingDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 7; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 0; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(5,0.5,5),true); + var wid = 0.4; + var hei = 0.4; + var _g = 0; + while(_g < 3) { + var i = _g++; + var _g1 = -2; + while(_g1 < 3) { + var j = _g1++; + var _g2 = -1; + while(_g2 < 2) { + var k = _g2++; + wid = 0.3 + Math.random() * 0.10000000000000003; + hei = 0.3 + Math.random() * 0.10000000000000003; + switch(5 * Math.random() | 0) { + case 0: + demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.4 + i * 0.4 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 1: + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.4 + i * 0.4 * 2 * 0.9998,k * 0.8 + (-0.01 + Math.random() * 0.02)),new oimo_common_Vec3(wid,hei,wid),false); + break; + case 2: + demo_common_OimoUtil.addCylinder(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.4 + i * 0.4 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 3: + demo_common_OimoUtil.addCapsule(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.4 + i * 0.4 * 2 * 1.002,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,hei,false); + break; + case 4: + demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(j * 0.8 + (-0.01 + Math.random() * 0.02),0.4 + i * 0.4 * 2 * 0.9998,k * 0.8 + (-0.01 + Math.random() * 0.02)),wid,false); + break; + } + } + } + } + this.lps = []; + this.lps.push(new demo_core__$RayCastingDemo_LaserPointer(new oimo_common_Vec3(-2,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$RayCastingDemo_LaserPointer(new oimo_common_Vec3(-1,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$RayCastingDemo_LaserPointer(new oimo_common_Vec3(0,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$RayCastingDemo_LaserPointer(new oimo_common_Vec3(1,4,0),world,new oimo_common_Vec3(0,1,0))); + this.lps.push(new demo_core__$RayCastingDemo_LaserPointer(new oimo_common_Vec3(2,4,0),world,new oimo_common_Vec3(0,1,0))); + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,drawAdditionalObjects: function(debugDraw) { + var _g = 0; + var _g1 = this.lps; + while(_g < _g1.length) _g1[_g++].draw(debugDraw); + } + ,__class__: demo_core_RayCastingDemo +}); +var demo_core__$RayCastingDemo_LaserPointer = function(pos,world,color) { + this.w = world; + this.color = color; + this.cb = new oimo_dynamics_callback_RayCastClosest(); + this.length = 0.4; + var rc = new oimo_dynamics_rigidbody_RigidBodyConfig(); + rc.autoSleep = false; + rc.angularDamping = 4.0; + var _this = rc.position; + _this.x = pos.x; + _this.y = pos.y; + _this.z = pos.z; + this.rb = new oimo_dynamics_rigidbody_RigidBody(rc); + var sc = new oimo_dynamics_rigidbody_ShapeConfig(); + sc.geometry = new oimo_collision_geometry_CylinderGeometry(0.2,this.length); + this.rb.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + this.w.addRigidBody(this.rb); + var _this1 = rc.position; + var y = this.length; + if(y == null) { + y = 0; + } + oimo_common_Vec3.numCreations++; + _this1.x += 0; + _this1.y += y; + _this1.z += 0; + rc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; + var fix = new oimo_dynamics_rigidbody_RigidBody(rc); + sc.geometry = new oimo_collision_geometry_SphereGeometry(0.1); + fix.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + this.w.addRigidBody(fix); + var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); + var tmp = this.rb; + var _this2 = this.rb; + var v = new oimo_common_Vec3(); + v.x = _this2._transform._positionX; + v.y = _this2._transform._positionY; + v.z = _this2._transform._positionZ; + var y1 = this.length; + if(y1 == null) { + y1 = 0; + } + oimo_common_Vec3.numCreations++; + v.x += 0; + v.y += y1; + v.z += 0; + jc.init(tmp,fix,v,new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(1,0,0)); + jc.twistLimitMotor.setLimits(0,0); + jc.maxSwingAngle1 = 1.570796326794895; + jc.maxSwingAngle2 = 1.570796326794895; + world.addJoint(new oimo_dynamics_constraint_joint_RagdollJoint(jc)); +}; +demo_core__$RayCastingDemo_LaserPointer.__name__ = true; +demo_core__$RayCastingDemo_LaserPointer.prototype = { + draw: function(dd) { + var _this = this.rb._transform; + var tf = new oimo_common_Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + var y = -this.length; + if(y == null) { + y = 0; + } + var v_x = 0; + var v_y = y; + var v_z = 0; + oimo_common_Vec3.numCreations++; + var vX; + var vY; + var vZ; + vX = v_x; + vY = v_y; + vZ = v_z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * v_x + tf._rotation01 * v_y + tf._rotation02 * v_z; + __tmp__Y = tf._rotation10 * v_x + tf._rotation11 * v_y + tf._rotation12 * v_z; + __tmp__Z = tf._rotation20 * v_x + tf._rotation21 * v_y + tf._rotation22 * v_z; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + var begin = res; + var y1 = -this.length - 20; + if(y1 == null) { + y1 = 0; + } + var v_x1 = 0; + var v_y1 = y1; + var v_z1 = 0; + oimo_common_Vec3.numCreations++; + var vX1; + var vY1; + var vZ1; + vX1 = v_x1; + vY1 = v_y1; + vZ1 = v_z1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf._rotation00 * v_x1 + tf._rotation01 * v_y1 + tf._rotation02 * v_z1; + __tmp__Y1 = tf._rotation10 * v_x1 + tf._rotation11 * v_y1 + tf._rotation12 * v_z1; + __tmp__Z1 = tf._rotation20 * v_x1 + tf._rotation21 * v_y1 + tf._rotation22 * v_z1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + vX1 += tf._positionX; + vY1 += tf._positionY; + vZ1 += tf._positionZ; + var res1 = new oimo_common_Vec3(); + res1.x = vX1; + res1.y = vY1; + res1.z = vZ1; + var end = res1; + var _g = 0; + while(_g < 3) { + ++_g; + var _this1 = this.cb; + _this1.shape = null; + _this1.fraction = 1; + _this1.position.zero(); + _this1.normal.zero(); + _this1.hit = false; + this.w.rayCast(begin,end,this.cb); + if(this.cb.hit) { + dd.line(begin,this.cb.position,this.color); + dd.point(this.cb.position,this.color); + var x = end.x - begin.x; + var y2 = end.y - begin.y; + var z = end.z - begin.z; + if(z == null) { + z = 0; + } + if(y2 == null) { + y2 = 0; + } + if(x == null) { + x = 0; + } + var _this_x = x; + var _this_y = y2; + var _this_z = z; + oimo_common_Vec3.numCreations++; + var invLen = Math.sqrt(_this_x * _this_x + _this_y * _this_y + _this_z * _this_z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var x1 = _this_x * invLen; + var y3 = _this_y * invLen; + var z1 = _this_z * invLen; + if(z1 == null) { + z1 = 0; + } + if(y3 == null) { + y3 = 0; + } + if(x1 == null) { + x1 = 0; + } + var dir_x = x1; + var dir_y = y3; + var dir_z = z1; + oimo_common_Vec3.numCreations++; + var v = this.cb.normal; + var _this2 = this.cb.normal; + var s = -2 * (_this2.x * dir_x + _this2.y * dir_y + _this2.z * dir_z); + var x2 = dir_x + v.x * s; + var y4 = dir_y + v.y * s; + var z2 = dir_z + v.z * s; + if(z2 == null) { + z2 = 0; + } + if(y4 == null) { + y4 = 0; + } + if(x2 == null) { + x2 = 0; + } + oimo_common_Vec3.numCreations++; + var _this3 = this.cb.position; + var v1 = this.cb.normal; + begin = new oimo_common_Vec3(_this3.x + v1.x * 0.01,_this3.y + v1.y * 0.01,_this3.z + v1.z * 0.01); + var _this4 = this.cb.position; + end = new oimo_common_Vec3(_this4.x + x2 * 20,_this4.y + y4 * 20,_this4.z + z2 * 20); + } else { + dd.line(begin,end,this.color); + break; + } + } + } + ,__class__: demo_core__$RayCastingDemo_LaserPointer +}; +var demo_core_SpringsDemo = function() { + demo_common_DemoBase.call(this,"Springs"); +}; +demo_core_SpringsDemo.__name__ = true; +demo_core_SpringsDemo.__super__ = demo_common_DemoBase; +demo_core_SpringsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + var _this1 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this1.x *= 2; + _this1.y *= 2; + _this1.z *= 0.1; + oimo_common_Vec3.numCreations++; + _this1.x += 0; + _this1.y += 8; + _this1.z += 0; + demo_common_OimoUtil.addSphere(world,_this1,0.6,false); + var _this2 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this2.x *= 2; + _this2.y *= 2; + _this2.z *= 0.1; + oimo_common_Vec3.numCreations++; + _this2.x += 0; + _this2.y += 8; + _this2.z += 0; + demo_common_OimoUtil.addSphere(world,_this2,0.6,false); + var _this3 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this3.x *= 2; + _this3.y *= 2; + _this3.z *= 0.1; + oimo_common_Vec3.numCreations++; + _this3.x += 0; + _this3.y += 8; + _this3.z += 0; + demo_common_OimoUtil.addSphere(world,_this3,0.6,false); + var _this4 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this4.x *= 2; + _this4.y *= 2; + _this4.z *= 0.1; + oimo_common_Vec3.numCreations++; + _this4.x += 0; + _this4.y += 8; + _this4.z += 0; + demo_common_OimoUtil.addSphere(world,_this4,0.6,false); + var _this5 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this5.x *= 2; + _this5.y *= 2; + _this5.z *= 0.1; + oimo_common_Vec3.numCreations++; + _this5.x += 0; + _this5.y += 8; + _this5.z += 0; + demo_common_OimoUtil.addSphere(world,_this5,0.6,false); + this.addSpringyBoard(new oimo_common_Vec3(-3,3,0),1,8); + this.addSpringyBoard(new oimo_common_Vec3(3,3,0),-1,8); + this.addSpringyBoard(new oimo_common_Vec3(-3,4,0),1,8); + this.addSpringyBoard(new oimo_common_Vec3(3,4,0),-1,8); + this.addSpringyFloor(new oimo_common_Vec3(-2,0,0)); + this.addSpringyFloor(new oimo_common_Vec3(-1,0,0)); + this.addSpringyFloor(new oimo_common_Vec3(0,0,0)); + this.addSpringyFloor(new oimo_common_Vec3(1,0,0)); + this.addSpringyFloor(new oimo_common_Vec3(2,0,0)); + } + ,addSpringyBoard: function(at,dir,num) { + var bodies = []; + var _g = 0; + while(_g < num) { + var i = _g++; + var x = i * 0.4 * dir; + if(x == null) { + x = 0; + } + oimo_common_Vec3.numCreations++; + bodies.push(demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(at.x + x,at.y + 0,at.z + 0),new oimo_common_Vec3(0.2,0.1,0.4),i == 0)); + } + var _g2 = 1; + while(_g2 < num) { + var i1 = _g2++; + var b1 = bodies[i1 - 1]; + var b2 = bodies[i1]; + var v = new oimo_common_Vec3(); + v.x = b1._transform._positionX; + v.y = b1._transform._positionY; + v.z = b1._transform._positionZ; + var v_x = 0; + var v_y = 0; + var v_z = 0; + oimo_common_Vec3.numCreations++; + v_x = b2._transform._positionX; + v_y = b2._transform._positionY; + v_z = b2._transform._positionZ; + v.x += v_x; + v.y += v_y; + v.z += v_z; + v.x *= 0.5; + v.y *= 0.5; + v.z *= 0.5; + var axis = new oimo_common_Vec3(0,0,1); + var springDamper = new oimo_dynamics_constraint_joint_SpringDamper().setSpring(15,0.4); + var limitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0); + demo_common_OimoUtil.addRevoluteJoint(this.world,b1,b2,v,axis,springDamper,limitMotor); + } + } + ,addSpringyFloor: function(at) { + oimo_common_Vec3.numCreations++; + var base = demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(at.x + 0,at.y + (-2),at.z + 0),new oimo_common_Vec3(0.5,0.1,0.5),true); + var floor = demo_common_OimoUtil.addBox(this.world,at,new oimo_common_Vec3(0.4,0.1,0.4),false); + var v = new oimo_common_Vec3(); + v.x = floor._transform._positionX; + v.y = floor._transform._positionY; + v.z = floor._transform._positionZ; + var axis = new oimo_common_Vec3(0,1,0); + var springDamper = new oimo_dynamics_constraint_joint_SpringDamper().setSpring(3,0.2); + var limitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0); + demo_common_OimoUtil.addPrismaticJoint(this.world,base,floor,v,axis,springDamper,limitMotor); + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,2,0.1); + } + ,__class__: demo_core_SpringsDemo +}); +var demo_core_VariableTimeStepDemo = function() { + demo_common_DemoBase.call(this,"Variable Time Step"); +}; +demo_core_VariableTimeStepDemo.__name__ = true; +demo_core_VariableTimeStepDemo.__super__ = demo_common_DemoBase; +demo_core_VariableTimeStepDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = -5; + var eye_y = 7; + var eye_z = 9; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(5,0.5,5),true); + var _g = 0; + while(_g < 5) { + var i = _g++; + var _g1 = -1; + while(_g1 < 2) { + var k = _g1++; + var _g2 = 0; + while(_g2 < 5) { + var j = _g2++; + if((j + k & 1) == 0) { + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.3 * 2 + (-0.01 + Math.random() * 0.02),0.3 + i * 0.3 * 2.2,k * 0.3 * 2 + (-0.01 + Math.random() * 0.02)),new oimo_common_Vec3(0.3,0.3,0.3),false); + } else { + demo_common_OimoUtil.addCylinder(world,new oimo_common_Vec3(j * 0.3 * 2 + (-0.01 + Math.random() * 0.02),0.3 + i * 0.3 * 2.2,k * 0.3 * 2 + (-0.01 + Math.random() * 0.02)),0.3,0.3,false); + } + } + } + } + var b = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-4,4,-4),new oimo_common_Vec3(0.5,0.5,0.5),false); + oimo_common_Vec3.numCreations++; + if(b._type == 1) { + b._velX = 0; + b._velY = 0; + b._velZ = 0; + } else { + b._velX = 5; + b._velY = 0; + b._velZ = 4; + } + b._sleeping = false; + b._sleepTime = 0; + oimo_common_Vec3.numCreations++; + if(b._type == 1) { + b._angVelX = 0; + b._angVelY = 0; + b._angVelZ = 0; + } else { + b._angVelX = 3; + b._angVelY = 6; + b._angVelZ = 8; + } + b._sleeping = false; + b._sleepTime = 0; + this.bullet = demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(-150,3,0),0.42,0.44999999999999996,false); + var tmp1 = this.bullet; + var sc = new oimo_dynamics_rigidbody_ShapeConfig(); + oimo_common_Vec3.numCreations++; + sc.geometry = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.12,0.3,0.12)); + sc.position.y -= 0.75; + tmp1.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + var _this1 = this.bullet; + var _this_e00 = 1; + var _this_e01 = 0; + var _this_e02 = 0; + var _this_e10 = 0; + var _this_e11 = 1; + var _this_e12 = 0; + var _this_e20 = 0; + var _this_e21 = 0; + var _this_e22 = 1; + oimo_common_Mat3.numCreations++; + var s = Math.sin(1.570796326794895); + var c = Math.cos(1.570796326794895); + var c1 = 1 - c; + var r00 = 0 * c1 + c; + var r01 = 0 * c1 - -1 * s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + -1 * s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - 0 * s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + 0 * s; + var r22 = c1 + c; + var e00 = _this_e00 * r00 + _this_e01 * r10 + _this_e02 * r20; + var e01 = _this_e00 * r01 + _this_e01 * r11 + _this_e02 * r21; + var e02 = _this_e00 * r02 + _this_e01 * r12 + _this_e02 * r22; + var e10 = _this_e10 * r00 + _this_e11 * r10 + _this_e12 * r20; + var e11 = _this_e10 * r01 + _this_e11 * r11 + _this_e12 * r21; + var e12 = _this_e10 * r02 + _this_e11 * r12 + _this_e12 * r22; + var e20 = _this_e20 * r00 + _this_e21 * r10 + _this_e22 * r20; + var e21 = _this_e20 * r01 + _this_e21 * r11 + _this_e22 * r21; + var e22 = _this_e20 * r02 + _this_e21 * r12 + _this_e22 * r22; + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + var m_e00 = e00; + var m_e01 = e01; + var m_e02 = e02; + var m_e10 = e10; + var m_e11 = e11; + var m_e12 = e12; + var m_e20 = e20; + var m_e21 = e21; + var m_e22 = e22; + oimo_common_Mat3.numCreations++; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = m_e00 * _this1._transform._rotation00 + m_e01 * _this1._transform._rotation10 + m_e02 * _this1._transform._rotation20; + __tmp__01 = m_e00 * _this1._transform._rotation01 + m_e01 * _this1._transform._rotation11 + m_e02 * _this1._transform._rotation21; + __tmp__02 = m_e00 * _this1._transform._rotation02 + m_e01 * _this1._transform._rotation12 + m_e02 * _this1._transform._rotation22; + __tmp__10 = m_e10 * _this1._transform._rotation00 + m_e11 * _this1._transform._rotation10 + m_e12 * _this1._transform._rotation20; + __tmp__11 = m_e10 * _this1._transform._rotation01 + m_e11 * _this1._transform._rotation11 + m_e12 * _this1._transform._rotation21; + __tmp__12 = m_e10 * _this1._transform._rotation02 + m_e11 * _this1._transform._rotation12 + m_e12 * _this1._transform._rotation22; + __tmp__20 = m_e20 * _this1._transform._rotation00 + m_e21 * _this1._transform._rotation10 + m_e22 * _this1._transform._rotation20; + __tmp__21 = m_e20 * _this1._transform._rotation01 + m_e21 * _this1._transform._rotation11 + m_e22 * _this1._transform._rotation21; + __tmp__22 = m_e20 * _this1._transform._rotation02 + m_e21 * _this1._transform._rotation12 + m_e22 * _this1._transform._rotation22; + _this1._transform._rotation00 = __tmp__00; + _this1._transform._rotation01 = __tmp__01; + _this1._transform._rotation02 = __tmp__02; + _this1._transform._rotation10 = __tmp__10; + _this1._transform._rotation11 = __tmp__11; + _this1._transform._rotation12 = __tmp__12; + _this1._transform._rotation20 = __tmp__20; + _this1._transform._rotation21 = __tmp__21; + _this1._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this1._transform._rotation00 * _this1._invLocalInertia00 + _this1._transform._rotation01 * _this1._invLocalInertia10 + _this1._transform._rotation02 * _this1._invLocalInertia20; + __tmp__011 = _this1._transform._rotation00 * _this1._invLocalInertia01 + _this1._transform._rotation01 * _this1._invLocalInertia11 + _this1._transform._rotation02 * _this1._invLocalInertia21; + __tmp__021 = _this1._transform._rotation00 * _this1._invLocalInertia02 + _this1._transform._rotation01 * _this1._invLocalInertia12 + _this1._transform._rotation02 * _this1._invLocalInertia22; + __tmp__101 = _this1._transform._rotation10 * _this1._invLocalInertia00 + _this1._transform._rotation11 * _this1._invLocalInertia10 + _this1._transform._rotation12 * _this1._invLocalInertia20; + __tmp__111 = _this1._transform._rotation10 * _this1._invLocalInertia01 + _this1._transform._rotation11 * _this1._invLocalInertia11 + _this1._transform._rotation12 * _this1._invLocalInertia21; + __tmp__121 = _this1._transform._rotation10 * _this1._invLocalInertia02 + _this1._transform._rotation11 * _this1._invLocalInertia12 + _this1._transform._rotation12 * _this1._invLocalInertia22; + __tmp__201 = _this1._transform._rotation20 * _this1._invLocalInertia00 + _this1._transform._rotation21 * _this1._invLocalInertia10 + _this1._transform._rotation22 * _this1._invLocalInertia20; + __tmp__211 = _this1._transform._rotation20 * _this1._invLocalInertia01 + _this1._transform._rotation21 * _this1._invLocalInertia11 + _this1._transform._rotation22 * _this1._invLocalInertia21; + __tmp__221 = _this1._transform._rotation20 * _this1._invLocalInertia02 + _this1._transform._rotation21 * _this1._invLocalInertia12 + _this1._transform._rotation22 * _this1._invLocalInertia22; + _this1._invInertia00 = __tmp__001; + _this1._invInertia01 = __tmp__011; + _this1._invInertia02 = __tmp__021; + _this1._invInertia10 = __tmp__101; + _this1._invInertia11 = __tmp__111; + _this1._invInertia12 = __tmp__121; + _this1._invInertia20 = __tmp__201; + _this1._invInertia21 = __tmp__211; + _this1._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this1._invInertia00 * _this1._transform._rotation00 + _this1._invInertia01 * _this1._transform._rotation01 + _this1._invInertia02 * _this1._transform._rotation02; + __tmp__012 = _this1._invInertia00 * _this1._transform._rotation10 + _this1._invInertia01 * _this1._transform._rotation11 + _this1._invInertia02 * _this1._transform._rotation12; + __tmp__022 = _this1._invInertia00 * _this1._transform._rotation20 + _this1._invInertia01 * _this1._transform._rotation21 + _this1._invInertia02 * _this1._transform._rotation22; + __tmp__102 = _this1._invInertia10 * _this1._transform._rotation00 + _this1._invInertia11 * _this1._transform._rotation01 + _this1._invInertia12 * _this1._transform._rotation02; + __tmp__112 = _this1._invInertia10 * _this1._transform._rotation10 + _this1._invInertia11 * _this1._transform._rotation11 + _this1._invInertia12 * _this1._transform._rotation12; + __tmp__122 = _this1._invInertia10 * _this1._transform._rotation20 + _this1._invInertia11 * _this1._transform._rotation21 + _this1._invInertia12 * _this1._transform._rotation22; + __tmp__202 = _this1._invInertia20 * _this1._transform._rotation00 + _this1._invInertia21 * _this1._transform._rotation01 + _this1._invInertia22 * _this1._transform._rotation02; + __tmp__212 = _this1._invInertia20 * _this1._transform._rotation10 + _this1._invInertia21 * _this1._transform._rotation11 + _this1._invInertia22 * _this1._transform._rotation12; + __tmp__222 = _this1._invInertia20 * _this1._transform._rotation20 + _this1._invInertia21 * _this1._transform._rotation21 + _this1._invInertia22 * _this1._transform._rotation22; + _this1._invInertia00 = __tmp__002; + _this1._invInertia01 = __tmp__012; + _this1._invInertia02 = __tmp__022; + _this1._invInertia10 = __tmp__102; + _this1._invInertia11 = __tmp__112; + _this1._invInertia12 = __tmp__122; + _this1._invInertia20 = __tmp__202; + _this1._invInertia21 = __tmp__212; + _this1._invInertia22 = __tmp__222; + _this1._invInertia00 *= _this1._rotFactor.x; + _this1._invInertia01 *= _this1._rotFactor.x; + _this1._invInertia02 *= _this1._rotFactor.x; + _this1._invInertia10 *= _this1._rotFactor.y; + _this1._invInertia11 *= _this1._rotFactor.y; + _this1._invInertia12 *= _this1._rotFactor.y; + _this1._invInertia20 *= _this1._rotFactor.z; + _this1._invInertia21 *= _this1._rotFactor.z; + _this1._invInertia22 *= _this1._rotFactor.z; + var dst = _this1._ptransform; + var src = _this1._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s1 = _this1._shapeList; + while(s1 != null) { + var n = s1._next; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; + var dst1 = s1._ptransform; + var src1 = s1._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s1._transform; + var src11 = s1._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s1._geom._computeAabb(s1._aabb,s1._ptransform); + minX = s1._aabb._minX; + minY = s1._aabb._minY; + minZ = s1._aabb._minZ; + maxX = s1._aabb._maxX; + maxY = s1._aabb._maxY; + maxZ = s1._aabb._maxZ; + s1._geom._computeAabb(s1._aabb,s1._transform); + s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; + s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; + s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; + s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; + s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; + s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; + if(s1._proxy != null) { + var dX; + var dY; + var dZ; + dX = s1._transform._positionX - s1._ptransform._positionX; + dY = s1._transform._positionY - s1._ptransform._positionY; + dZ = s1._transform._positionZ - s1._ptransform._positionZ; + var v = s1.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + } + s1 = n; + } + _this1._sleeping = false; + _this1._sleepTime = 0; + var _this2 = this.bullet._shapeList; + _this2._density = 50; + if(_this2._rigidBody != null) { + var _this3 = _this2._rigidBody; + _this3.updateMass(); + var s2 = _this3._shapeList; + while(s2 != null) { + var n1 = s2._next; + var tf11 = _this3._ptransform; + var tf21 = _this3._transform; + var dst3 = s2._ptransform; + var src12 = s2._localTransform; + var __tmp__005; + var __tmp__015; + var __tmp__025; + var __tmp__105; + var __tmp__115; + var __tmp__125; + var __tmp__205; + var __tmp__215; + var __tmp__225; + __tmp__005 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; + __tmp__015 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; + __tmp__025 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; + __tmp__105 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; + __tmp__115 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; + __tmp__125 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; + __tmp__205 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; + __tmp__215 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; + __tmp__225 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; + dst3._rotation00 = __tmp__005; + dst3._rotation01 = __tmp__015; + dst3._rotation02 = __tmp__025; + dst3._rotation10 = __tmp__105; + dst3._rotation11 = __tmp__115; + dst3._rotation12 = __tmp__125; + dst3._rotation20 = __tmp__205; + dst3._rotation21 = __tmp__215; + dst3._rotation22 = __tmp__225; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; + __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; + __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; + dst3._positionX = __tmp__X2; + dst3._positionY = __tmp__Y2; + dst3._positionZ = __tmp__Z2; + dst3._positionX += tf11._positionX; + dst3._positionY += tf11._positionY; + dst3._positionZ += tf11._positionZ; + var dst4 = s2._transform; + var src13 = s2._localTransform; + var __tmp__006; + var __tmp__016; + var __tmp__026; + var __tmp__106; + var __tmp__116; + var __tmp__126; + var __tmp__206; + var __tmp__216; + var __tmp__226; + __tmp__006 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; + __tmp__016 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; + __tmp__026 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; + __tmp__106 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; + __tmp__116 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; + __tmp__126 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; + __tmp__206 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; + __tmp__216 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; + __tmp__226 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; + dst4._rotation00 = __tmp__006; + dst4._rotation01 = __tmp__016; + dst4._rotation02 = __tmp__026; + dst4._rotation10 = __tmp__106; + dst4._rotation11 = __tmp__116; + dst4._rotation12 = __tmp__126; + dst4._rotation20 = __tmp__206; + dst4._rotation21 = __tmp__216; + dst4._rotation22 = __tmp__226; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; + __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; + __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; + dst4._positionX = __tmp__X3; + dst4._positionY = __tmp__Y3; + dst4._positionZ = __tmp__Z3; + dst4._positionX += tf21._positionX; + dst4._positionY += tf21._positionY; + dst4._positionZ += tf21._positionZ; + var minX1; + var minY1; + var minZ1; + var maxX1; + var maxY1; + var maxZ1; + s2._geom._computeAabb(s2._aabb,s2._ptransform); + minX1 = s2._aabb._minX; + minY1 = s2._aabb._minY; + minZ1 = s2._aabb._minZ; + maxX1 = s2._aabb._maxX; + maxY1 = s2._aabb._maxY; + maxZ1 = s2._aabb._maxZ; + s2._geom._computeAabb(s2._aabb,s2._transform); + s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; + s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; + s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; + s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; + s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; + s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; + if(s2._proxy != null) { + var dX1; + var dY1; + var dZ1; + dX1 = s2._transform._positionX - s2._ptransform._positionX; + dY1 = s2._transform._positionY - s2._ptransform._positionY; + dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; + var v1 = s2.displacement; + v1.x = dX1; + v1.y = dY1; + v1.z = dZ1; + s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + } + s2 = n1; + } + } + var _this4 = this.bullet; + oimo_common_Vec3.numCreations++; + if(_this4._type == 1) { + _this4._velX = 0; + _this4._velY = 0; + _this4._velZ = 0; + } else { + _this4._velX = 300; + _this4._velY = 0; + _this4._velZ = 0; + } + _this4._sleeping = false; + _this4._sleepTime = 0; + var _this5 = this.bullet; + oimo_common_Vec3.numCreations++; + if(_this5._type == 1) { + _this5._angVelX = 0; + _this5._angVelY = 0; + _this5._angVelZ = 0; + } else { + _this5._angVelX = 628.318530717958; + _this5._angVelY = 0; + _this5._angVelZ = 0; + } + _this5._sleeping = false; + _this5._sleepTime = 0; + } + ,update: function() { + var v_x = 0; + oimo_common_Vec3.numCreations++; + v_x = this.bullet._transform._positionX; + var x = 0 - v_x; + var timeStep = (x > 0 ? x : -x) / 8000; + var v_x1 = 0; + oimo_common_Vec3.numCreations++; + v_x1 = this.bullet._transform._positionX; + if(v_x1 > 0) { + timeStep *= 10; + } + var maxTimeStep = 0.016666666666666666; + var v_x2 = 0; + oimo_common_Vec3.numCreations++; + v_x2 = this.bullet._transform._positionX; + if(v_x2 < -10) { + maxTimeStep = 0.0055555555555555558; + } + if(timeStep < 0.0001) { + timeStep = 0.0001; + } + if(timeStep > maxTimeStep) { + timeStep = maxTimeStep; + } + this.dt = timeStep; + demo_common_DemoBase.prototype.update.call(this); + } + ,__class__: demo_core_VariableTimeStepDemo +}); +var demo_core_VerticalStackingDemo = function() { + demo_common_DemoBase.call(this,"Vertical Stacking"); +}; +demo_core_VerticalStackingDemo.__name__ = true; +demo_core_VerticalStackingDemo.__super__ = demo_common_DemoBase; +demo_core_VerticalStackingDemo.prototype = $extend(demo_common_DemoBase.prototype,{ + init: function(world,renderer,input,viewInfo) { + demo_common_DemoBase.prototype.init.call(this,world,renderer,input,viewInfo); + var eye_x = 0; + var eye_y = 16; + var eye_z = 16; + oimo_common_Vec3.numCreations++; + oimo_common_Vec3.numCreations++; + var up_x = 0; + var up_y = 1; + var up_z = 0; + oimo_common_Vec3.numCreations++; + var _this = renderer.viewMat; + var zx = eye_x - 0; + var zy = eye_y - 2; + var zz = eye_z - 0; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = up_y * zz - up_z * zy; + var xy = up_z * zx - up_x * zz; + var xz = up_x * zy - up_y * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(10,0.5,6),true); + var sp = 3; + var tmp1 = oimo_common_Setting.defaultRestitution; + oimo_common_Setting.defaultRestitution = 0; + var _g = -2; + while(_g < 3) { + var i = _g++; + var _g1 = 0; + var _g11 = 6 + 2 * (i + 2); + while(_g1 < _g11) demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(i * sp + (-0.01 + Math.random() * 0.02),0.4 + _g1++ * 0.4 * 2.2,-0.01 + Math.random() * 0.02),new oimo_common_Vec3(0.4,0.4,0.4),false); + } + oimo_common_Setting.defaultRestitution = tmp1; + } + ,update: function() { + demo_common_DemoBase.prototype.update.call(this); + this.teleportRigidBodies(-20,10,5,5); + } + ,__class__: demo_core_VerticalStackingDemo +}); +var demo_js_minilib_OMain = function(canvas) { + this.canvas = canvas; + this.input = new demo_js_minilib_OInput(); + this.__setup(); +}; +demo_js_minilib_OMain.__name__ = true; +demo_js_minilib_OMain.prototype = { + __setup: function() { + this.__state = 0; + this.frameCount = 0; + this.setup(); + if(this.__state != 1) { + throw new js__$Boot_HaxeError("call init()"); + } + this.__state = 2; + var _gthis = this; + if(this.__state != 2) { + throw new js__$Boot_HaxeError("invalid call"); + } + var touchCount = 0; + var firstTouchId = -1; + var scalingRatio = window.devicePixelRatio; + var elementX = function() { + return _gthis.canvas.getBoundingClientRect().left; + }; + var elementY = function() { + return _gthis.canvas.getBoundingClientRect().top; + }; + var body = this.canvas; + this.canvas.addEventListener("touchstart",function(e) { + if(e.cancelable) { + e.preventDefault(); + } + if(firstTouchId == -1) { + firstTouchId = e.changedTouches[0].identifier; + } + var _g = 0; + var _g1 = e.changedTouches.length; + while(_g < _g1) { + var touch = e.changedTouches[_g++]; + if(touch.identifier == firstTouchId) { + var tmp = touch.clientX - elementX(); + _gthis.input._ntouchX = tmp * scalingRatio; + var tmp1 = touch.clientY - elementY(); + _gthis.input._ntouchY = tmp1 * scalingRatio; + _gthis.input._ntouch = true; + } + } + touchCount += e.changedTouches.length; + }); + body.addEventListener("touchmove",function(e1) { + if(e1.cancelable) { + e1.preventDefault(); + } + var _g2 = 0; + var _g11 = e1.touches.length; + while(_g2 < _g11) { + var touch1 = e1.touches[_g2++]; + if(touch1.identifier == firstTouchId) { + var tmp2 = touch1.clientX - elementX(); + _gthis.input._ntouchX = tmp2 * scalingRatio; + var tmp3 = touch1.clientY - elementY(); + _gthis.input._ntouchY = tmp3 * scalingRatio; + } + } + }); + var touchend = function(e2) { + if(e2.cancelable) { + e2.preventDefault(); + } + var _g3 = 0; + var _g12 = e2.changedTouches.length; + while(_g3 < _g12) { + var touch2 = e2.changedTouches[_g3++]; + if(touch2.identifier == firstTouchId) { + firstTouchId = -1; + var touchend1 = touch2.clientX - elementX(); + _gthis.input._ntouchX = touchend1 * scalingRatio; + var touchend2 = touch2.clientY - elementY(); + _gthis.input._ntouchY = touchend2 * scalingRatio; + _gthis.input._ntouch = false; + } + } + touchCount -= e2.changedTouches.length; + }; + body.addEventListener("touchend",touchend); + body.addEventListener("touchcancel",touchend); + body.addEventListener("mousedown",function(e3) { + if(e3.cancelable) { + e3.preventDefault(); + } + switch(e3.button) { + case 0: + _gthis.input._nmouseL = true; + break; + case 2: + _gthis.input._nmouseR = true; + break; + } + var tmp4 = e3.clientX - elementX(); + _gthis.input._nmouseX = tmp4 * scalingRatio; + var tmp5 = e3.clientY - elementY(); + _gthis.input._nmouseY = tmp5 * scalingRatio; + }); + body.addEventListener("mouseup",function(e4) { + if(e4.cancelable) { + e4.preventDefault(); + } + switch(e4.button) { + case 0: + _gthis.input._nmouseL = false; + break; + case 2: + _gthis.input._nmouseR = false; + break; + } + var tmp6 = e4.clientX - elementX(); + _gthis.input._nmouseX = tmp6 * scalingRatio; + var tmp7 = e4.clientY - elementY(); + _gthis.input._nmouseY = tmp7 * scalingRatio; + }); + body.addEventListener("mousemove",function(e5) { + if(e5.cancelable) { + e5.preventDefault(); + } + var tmp8 = e5.clientX - elementX(); + _gthis.input._nmouseX = tmp8 * scalingRatio; + var tmp9 = e5.clientY - elementY(); + _gthis.input._nmouseY = tmp9 * scalingRatio; + }); + body.oncontextmenu = function(e6) { + return false; + }; + this.__state = 3; + var _this = this.__timer; + _this.running = true; + _this.expectedNextTime = new Date().getTime(); + _this.loop(); + } + ,setup: function() { + throw new js__$Boot_HaxeError("override this"); + } + ,__loop: function() { + if(this.__state != 3) { + throw new js__$Boot_HaxeError("invalid call"); + } + this.frameCount++; + this.input._update(); + this.loop(); + } + ,loop: function() { + throw new js__$Boot_HaxeError("override this"); + } + ,__class__: demo_js_minilib_OMain +}; +var demo_js_DemoJS = function(canvas) { + demo_js_minilib_OMain.call(this,canvas); +}; +demo_js_DemoJS.__name__ = true; +demo_js_DemoJS.main = function() { + window.onload = function() { + new demo_js_DemoJS(window.document.getElementById("canvas")); + }; +}; +demo_js_DemoJS.__super__ = demo_js_minilib_OMain; +demo_js_DemoJS.prototype = $extend(demo_js_minilib_OMain.prototype,{ + setup: function() { + if(this.__state != 0) { + throw new js__$Boot_HaxeError("invalid call"); + } + this.__state = 1; + var pixelRatio = window.devicePixelRatio; + var widthPix = window.innerWidth; + var heightPix = window.innerHeight; + window.document.body.style.margin = "0"; + this.__width = widthPix * pixelRatio | 0; + this.__height = heightPix * pixelRatio | 0; + this.__screenWidth = this.__width; + this.__screenHeight = this.__height; + this.canvas.style.width = widthPix + "px"; + this.canvas.style.height = heightPix + "px"; + this.canvas.width = this.__width; + this.canvas.height = this.__height; + var dom = this.canvas.parentElement; + while(dom != null) { + dom.style.overflow = "hidden"; + dom = dom.parentElement; + } + this.gl = js_html__$CanvasElement_CanvasUtil.getContextWebGL(this.canvas,null); + this.__timer = new demo_js_minilib_OTimer(60,$bind(this,this.__loop)); + var a = this.__width; + var b = this.__height; + this.textScale = (a < b ? a : b) / 600; + this.initText(); + this.initUserInput(); + this.test = new demo_common_DemoMain(this.__width,this.__height); + this.test.init(new demo_js_WebGLDebugGraphics(this.gl)); + console.log("demos/src/demo/js/DemoJS.hx:24:","OimoPhysics demo is running..."); + console.log("demos/src/demo/js/DemoJS.hx:25:","width: " + this.canvas.width + ", height: " + this.canvas.height); + } + ,initUserInput: function() { + var _gthis = this; + window.document.addEventListener("keydown",function(e) { + _gthis.test.keyPressed(e.keyCode); + if(!(e.keyCode >= 112 && e.keyCode <= 123)) { + e.preventDefault(); + } + }); + window.document.addEventListener("keyup",function(e1) { + _gthis.test.keyReleased(e1.keyCode); + }); + } + ,initText: function() { + window.document.getElementById("container").style.position = "relative"; + this.textCanvas = window.document.getElementById("text"); + this.textCanvas.width = this.canvas.width; + this.textCanvas.height = this.canvas.height; + this.textCanvas.style.width = this.canvas.style.width; + this.textCanvas.style.height = this.canvas.style.height; + this.g = this.textCanvas.getContext("2d",null); + this.g.font = 12 * this.textScale + "px Courier New"; + this.g.fillStyle = "#fff"; + this.g.textBaseline = "top"; + var textStyle = this.textCanvas.style; + textStyle.position = "absolute"; + textStyle.left = "0px"; + textStyle.top = "0px"; + textStyle.zIndex = "1"; + } + ,loop: function() { + this.test.mouseMoved(this.input.mouseX + this.input.touchX,this.input.mouseY + this.input.touchY); + if(this.input.mouseL && !this.input.pmouseL || this.input.touch && !this.input.ptouch) { + this.test.mouseLPressed(); + } + if(!this.input.mouseL && this.input.pmouseL || !this.input.touch && this.input.ptouch) { + this.test.mouseLReleased(); + } + if(this.input.mouseR && !this.input.pmouseR) { + this.test.mouseRPressed(); + } + if(!this.input.mouseR && this.input.pmouseR) { + this.test.mouseRReleased(); + } + this.test.loop(); + this.g.clearRect(0,0,this.__width,this.__height); + var lines = this.test.text.split("\n"); + var y = 8; + var a = 15 * this.textScale; + var lineHeight = a < 0 ? a - 0.5 | 0 : a + 0.5 | 0; + var controlIndex = -1; + var _g = 0; + while(_g < lines.length) { + var line = lines[_g]; + ++_g; + var w = this.g.measureText(line).width + 4; + this.g.save(); + if(this.input.mouseX >= 8 && this.input.mouseX < 8 + w && this.input.mouseY >= y && this.input.mouseY < y + lineHeight || (this.input.touch || this.input.ptouch) && this.input.touchX >= 8 && this.input.touchX < 8 + w && this.input.touchY >= y && this.input.touchY < y + lineHeight) { + if((this.input.dmouseL == 1 || this.input.dtouch == -1) && controlIndex >= 0) { + this.test.action(controlIndex); + } + this.g.fillStyle = "rgba(192, 0, 0, 0.5)"; + } else { + this.g.fillStyle = "rgba(0, 0, 0, 0.5)"; + } + this.g.fillRect(8,y,w,lineHeight); + this.g.restore(); + this.g.fillText(line,8,y); + if(controlIndex >= 0) { + ++controlIndex; + } + if(line == "Control") { + controlIndex = 0; + } + y += lineHeight; + } + } + ,__class__: demo_js_DemoJS +}); +var oimo_dynamics_common_DebugDraw = function() { + this.p = new oimo_common_Pool(); + this.wireframe = false; + this.drawShapes = true; + this.drawBvh = false; + this.drawBvhMinLevel = 0; + this.drawBvhMaxLevel = 65536; + this.drawAabbs = false; + this.drawBases = false; + this.drawPairs = false; + this.drawContacts = false; + this.drawJoints = true; + this.drawJointLimits = false; + this.sphereCoords = new Array(5); + this.tmpSphereVerts = new Array(5); + this.tmpSphereNorms = new Array(5); + var _g = 0; + while(_g < 5) { + var i = _g++; + var num = i == 0 || i == 4 ? 1 : 8; + this.sphereCoords[i] = new Array(num); + this.tmpSphereVerts[i] = new Array(num); + this.tmpSphereNorms[i] = new Array(num); + var _g1 = 0; + while(_g1 < 8) { + var j = _g1++; + var theta = i * 0.7853981633974475; + var phi = j * 0.7853981633974475; + this.sphereCoords[i][j] = new oimo_common_Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); + this.tmpSphereVerts[i][j] = new oimo_common_Vec3(); + this.tmpSphereNorms[i][j] = new oimo_common_Vec3(); + } + } + this.circleCoords = new Array(8); + this.circleCoordsShift = new Array(8); + this.tmpCircleVerts1 = new Array(8); + this.tmpCircleVerts2 = new Array(8); + this.tmpCircleNorms = new Array(8); + var _g2 = 0; + while(_g2 < 8) { + var i1 = _g2++; + this.circleCoords[i1] = new oimo_common_Vec3(Math.cos(i1 * 0.7853981633974475),0,-Math.sin(i1 * 0.7853981633974475)); + this.circleCoordsShift[i1] = new oimo_common_Vec3(Math.cos((i1 + 0.5) * 0.7853981633974475),0,-Math.sin((i1 + 0.5) * 0.7853981633974475)); + this.tmpCircleVerts1[i1] = new oimo_common_Vec3(); + this.tmpCircleVerts2[i1] = new oimo_common_Vec3(); + this.tmpCircleNorms[i1] = new oimo_common_Vec3(); + } + this.style = new oimo_dynamics_common_DebugDrawStyle(); +}; +oimo_dynamics_common_DebugDraw.__name__ = true; +oimo_dynamics_common_DebugDraw.prototype = { + aabb: function(min,max,color) { + var _this = this.p; + var v1 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); + var _this1 = this.p; + var v2 = (_this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); + var _this2 = this.p; + var v3 = (_this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); + var _this3 = this.p; + var v4 = (_this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); + var _this4 = this.p; + var v5 = (_this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); + var _this5 = this.p; + var v6 = (_this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); + var _this6 = this.p; + var v7 = (_this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); + var _this7 = this.p; + var v8 = (_this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); + this.line(v1,v2,color); + this.line(v3,v4,color); + this.line(v5,v6,color); + this.line(v7,v8,color); + this.line(v1,v3,color); + this.line(v2,v4,color); + this.line(v5,v7,color); + this.line(v6,v8,color); + this.line(v1,v5,color); + this.line(v2,v6,color); + this.line(v3,v7,color); + this.line(v4,v8,color); + var _this8 = this.p; + if(v1 != null) { + v1.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = v1; + } + var _this9 = this.p; + if(v2 != null) { + v2.zero(); + if(_this9.sizeVec3 == _this9.stackVec3.length) { + var newArray1 = new Array(_this9.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this9.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this9.stackVec3[i1]; + _this9.stackVec3[i1] = null; + } + _this9.stackVec3 = newArray1; + } + _this9.stackVec3[_this9.sizeVec3++] = v2; + } + var _this10 = this.p; + if(v3 != null) { + v3.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newArray2 = new Array(_this10.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this10.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this10.stackVec3[i2]; + _this10.stackVec3[i2] = null; + } + _this10.stackVec3 = newArray2; + } + _this10.stackVec3[_this10.sizeVec3++] = v3; + } + var _this11 = this.p; + if(v4 != null) { + v4.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newArray3 = new Array(_this11.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this11.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this11.stackVec3[i3]; + _this11.stackVec3[i3] = null; + } + _this11.stackVec3 = newArray3; + } + _this11.stackVec3[_this11.sizeVec3++] = v4; + } + var _this12 = this.p; + if(v5 != null) { + v5.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newArray4 = new Array(_this12.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this12.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this12.stackVec3[i4]; + _this12.stackVec3[i4] = null; + } + _this12.stackVec3 = newArray4; + } + _this12.stackVec3[_this12.sizeVec3++] = v5; + } + var _this13 = this.p; + if(v6 != null) { + v6.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newArray5 = new Array(_this13.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this13.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this13.stackVec3[i5]; + _this13.stackVec3[i5] = null; + } + _this13.stackVec3 = newArray5; + } + _this13.stackVec3[_this13.sizeVec3++] = v6; + } + var _this14 = this.p; + if(v7 != null) { + v7.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray6 = new Array(_this14.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this14.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this14.stackVec3[i6]; + _this14.stackVec3[i6] = null; + } + _this14.stackVec3 = newArray6; + } + _this14.stackVec3[_this14.sizeVec3++] = v7; + } + var _this15 = this.p; + if(v8 != null) { + v8.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray7 = new Array(_this15.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this15.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this15.stackVec3[i7]; + _this15.stackVec3[i7] = null; + } + _this15.stackVec3 = newArray7; + } + _this15.stackVec3[_this15.sizeVec3++] = v8; + } + } + ,basis: function(transform,length,colorX,colorY,colorZ) { + var _this = this.p; + var pos = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var rot = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + var _this2 = this.p; + var ex = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var ey = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var ez = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var v = pos; + v.x = transform._positionX; + v.y = transform._positionY; + v.z = transform._positionZ; + var m = rot; + m.e00 = transform._rotation00; + m.e01 = transform._rotation01; + m.e02 = transform._rotation02; + m.e10 = transform._rotation10; + m.e11 = transform._rotation11; + m.e12 = transform._rotation12; + m.e20 = transform._rotation20; + m.e21 = transform._rotation21; + m.e22 = transform._rotation22; + ex.init(rot.e00,rot.e10,rot.e20); + ey.init(rot.e01,rot.e11,rot.e21); + ez.init(rot.e02,rot.e12,rot.e22); + ex.x *= length; + ex.y *= length; + ex.z *= length; + var _this5 = ex; + _this5.x += pos.x; + _this5.y += pos.y; + _this5.z += pos.z; + ey.x *= length; + ey.y *= length; + ey.z *= length; + var _this6 = ey; + _this6.x += pos.x; + _this6.y += pos.y; + _this6.z += pos.z; + ez.x *= length; + ez.y *= length; + ez.z *= length; + var _this7 = ez; + _this7.x += pos.x; + _this7.y += pos.y; + _this7.z += pos.z; + this.line(pos,ex,colorX); + this.line(pos,ey,colorY); + this.line(pos,ez,colorZ); + var _this8 = this.p; + if(pos != null) { + pos.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = pos; + } + var _this9 = this.p; + if(rot != null) { + rot.e00 = 1; + rot.e01 = 0; + rot.e02 = 0; + rot.e10 = 0; + rot.e11 = 1; + rot.e12 = 0; + rot.e20 = 0; + rot.e21 = 0; + rot.e22 = 1; + if(_this9.sizeMat3 == _this9.stackMat3.length) { + var newArray1 = new Array(_this9.sizeMat3 << 1); + var _g2 = 0; + var _g11 = _this9.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this9.stackMat3[i1]; + _this9.stackMat3[i1] = null; + } + _this9.stackMat3 = newArray1; + } + _this9.stackMat3[_this9.sizeMat3++] = rot; + } + var _this10 = this.p; + if(ex != null) { + ex.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newArray2 = new Array(_this10.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this10.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this10.stackVec3[i2]; + _this10.stackVec3[i2] = null; + } + _this10.stackVec3 = newArray2; + } + _this10.stackVec3[_this10.sizeVec3++] = ex; + } + var _this11 = this.p; + if(ey != null) { + ey.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newArray3 = new Array(_this11.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this11.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this11.stackVec3[i3]; + _this11.stackVec3[i3] = null; + } + _this11.stackVec3 = newArray3; + } + _this11.stackVec3[_this11.sizeVec3++] = ey; + } + var _this12 = this.p; + if(ez != null) { + ez.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newArray4 = new Array(_this12.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this12.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this12.stackVec3[i4]; + _this12.stackVec3[i4] = null; + } + _this12.stackVec3 = newArray4; + } + _this12.stackVec3[_this12.sizeVec3++] = ez; + } + } + ,ellipse: function(center,ex,ey,radiusX,radiusY,color) { + this.arc(center,ex,ey,radiusX,radiusY,0,6.28318530717958,false,color); + } + ,arc: function(center,ex,ey,radiusX,radiusY,startAngle,endAngle,drawSector,color) { + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ex.x; + _this1.y = ex.y; + _this1.z = ex.z; + var _this2 = _this1; + _this2.x *= radiusX; + _this2.y *= radiusX; + _this2.z *= radiusX; + ex = _this2; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = ey.x; + _this4.y = ey.y; + _this4.z = ey.z; + var _this5 = _this4; + _this5.x *= radiusY; + _this5.y *= radiusY; + _this5.z *= radiusY; + ey = _this5; + var angDiff = endAngle - startAngle; + if(angDiff < 0) { + angDiff = -angDiff; + } + var n = angDiff / 0.52359877559829837 + 0.5 | 0; + if(n == 0) { + n = 1; + } + var theta = startAngle; + var dt = (endAngle - startAngle) / n; + var _this6 = this.p; + var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = center.x; + _this7.y = center.y; + _this7.z = center.z; + var _this8 = _this7; + var s = Math.cos(startAngle); + _this8.x += _this2.x * s; + _this8.y += _this2.y * s; + _this8.z += _this2.z * s; + var s1 = Math.sin(startAngle); + _this8.x += _this5.x * s1; + _this8.y += _this5.y * s1; + _this8.z += _this5.z * s1; + var prevV = _this8; + if(drawSector) { + this.line(center,_this8,color); + } + var _g = 0; + var _g1 = n; + while(_g < _g1) { + ++_g; + theta += dt; + var _this9 = this.p; + var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + _this10.x = center.x; + _this10.y = center.y; + _this10.z = center.z; + var _this11 = _this10; + var s2 = Math.cos(theta); + _this11.x += _this2.x * s2; + _this11.y += _this2.y * s2; + _this11.z += _this2.z * s2; + var s3 = Math.sin(theta); + _this11.x += _this5.x * s3; + _this11.y += _this5.y * s3; + _this11.z += _this5.z * s3; + this.line(prevV,_this11,color); + var _this12 = this.p; + if(prevV != null) { + prevV.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newArray = new Array(_this12.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this12.sizeVec3; + while(_g2 < _g11) { + var i = _g2++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = prevV; + } + prevV = _this11; + } + if(drawSector) { + this.line(center,prevV,color); + } + var _this13 = this.p; + if(prevV != null) { + prevV.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newArray1 = new Array(_this13.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this13.sizeVec3; + while(_g3 < _g12) { + var i1 = _g3++; + newArray1[i1] = _this13.stackVec3[i1]; + _this13.stackVec3[i1] = null; + } + _this13.stackVec3 = newArray1; + } + _this13.stackVec3[_this13.sizeVec3++] = prevV; + } + var _this14 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray2 = new Array(_this14.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this14.sizeVec3; + while(_g4 < _g13) { + var i2 = _g4++; + newArray2[i2] = _this14.stackVec3[i2]; + _this14.stackVec3[i2] = null; + } + _this14.stackVec3 = newArray2; + } + _this14.stackVec3[_this14.sizeVec3++] = _this2; + } + var _this15 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray3 = new Array(_this15.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this15.sizeVec3; + while(_g5 < _g14) { + var i3 = _g5++; + newArray3[i3] = _this15.stackVec3[i3]; + _this15.stackVec3[i3] = null; + } + _this15.stackVec3 = newArray3; + } + _this15.stackVec3[_this15.sizeVec3++] = _this5; + } + } + ,cone: function(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + var s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; + if(this.wireframe) { + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this10.x; + _this12.y = _this10.y; + _this12.z = _this10.z; + var _this13 = _this12; + var s1 = -radius; + _this13.x += ex.x * s1; + _this13.y += ex.y * s1; + _this13.z += ex.z * s1; + _this13.x += ez.x * 0; + _this13.y += ez.y * 0; + _this13.z += ez.z * 0; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + var _this16 = _this15; + _this16.x += ex.x * radius; + _this16.y += ex.y * radius; + _this16.z += ex.z * radius; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + var _this19 = _this18; + _this19.x += ex.x * 0; + _this19.y += ex.y * 0; + _this19.z += ex.z * 0; + var s2 = -radius; + _this19.x += ez.x * s2; + _this19.y += ez.y * s2; + _this19.z += ez.z * s2; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + _this22.x += ez.x * radius; + _this22.y += ez.y * radius; + _this22.z += ez.z * radius; + this.ellipse(_this10,ex,ez,radius,radius,color); + this.line(_this7,_this13,color); + this.line(_this7,_this16,color); + this.line(_this7,_this19,color); + this.line(_this7,_this22,color); + var _this23 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this23.sizeVec3 == _this23.stackVec3.length) { + var newArray = new Array(_this23.sizeVec3 << 1); + var _g = 0; + var _g1 = _this23.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this23.stackVec3[i]; + _this23.stackVec3[i] = null; + } + _this23.stackVec3 = newArray; + } + _this23.stackVec3[_this23.sizeVec3++] = _this13; + } + var _this24 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newArray1 = new Array(_this24.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this24.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this24.stackVec3[i1]; + _this24.stackVec3[i1] = null; + } + _this24.stackVec3 = newArray1; + } + _this24.stackVec3[_this24.sizeVec3++] = _this16; + } + var _this25 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this25.sizeVec3 == _this25.stackVec3.length) { + var newArray2 = new Array(_this25.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this25.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this25.stackVec3[i2]; + _this25.stackVec3[i2] = null; + } + _this25.stackVec3 = newArray2; + } + _this25.stackVec3[_this25.sizeVec3++] = _this19; + } + var _this26 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + var newArray3 = new Array(_this26.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this26.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this26.stackVec3[i3]; + _this26.stackVec3[i3] = null; + } + _this26.stackVec3 = newArray3; + } + _this26.stackVec3[_this26.sizeVec3++] = _this22; + } + } else { + var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + var cos = 2 * halfHeight * invDenom; + var sin = radius * invDenom; + var _g5 = 0; + while(_g5 < 8) { + var i4 = _g5++; + var _this27 = this.tmpCircleNorms[i4]; + var v1 = this.circleCoords[i4]; + _this27.x = v1.x; + _this27.y = v1.y; + _this27.z = v1.z; + _this27.x *= cos; + _this27.y *= cos; + _this27.z *= cos; + _this27.y += sin; + var _this28 = this.tmpCircleNorms[i4]; + var y = _this28.x * m.e10 + _this28.y * m.e11 + _this28.z * m.e12; + var z = _this28.x * m.e20 + _this28.y * m.e21 + _this28.z * m.e22; + _this28.x = _this28.x * m.e00 + _this28.y * m.e01 + _this28.z * m.e02; + _this28.y = y; + _this28.z = z; + var _this29 = this.tmpCircleVerts1[i4]; + var v2 = this.circleCoordsShift[i4]; + _this29.x = v2.x; + _this29.y = v2.y; + _this29.z = v2.z; + _this29.x *= cos; + _this29.y *= cos; + _this29.z *= cos; + _this29.y += sin; + var _this30 = this.tmpCircleVerts1[i4]; + var y1 = _this30.x * m.e10 + _this30.y * m.e11 + _this30.z * m.e12; + var z1 = _this30.x * m.e20 + _this30.y * m.e21 + _this30.z * m.e22; + _this30.x = _this30.x * m.e00 + _this30.y * m.e01 + _this30.z * m.e02; + _this30.y = y1; + _this30.z = z1; + var _this31 = this.tmpCircleVerts2[i4]; + var v3 = this.circleCoords[i4]; + _this31.x = v3.x; + _this31.y = v3.y; + _this31.z = v3.z; + var y2 = _this31.x * m.e10 + _this31.y * m.e11 + _this31.z * m.e12; + var z2 = _this31.x * m.e20 + _this31.y * m.e21 + _this31.z * m.e22; + _this31.x = _this31.x * m.e00 + _this31.y * m.e01 + _this31.z * m.e02; + _this31.y = y2; + _this31.z = z2; + _this31.x *= radius; + _this31.y *= radius; + _this31.z *= radius; + _this31.x += o.x; + _this31.y += o.y; + _this31.z += o.z; + var _this32 = this.tmpCircleVerts2[i4]; + var s3 = -halfHeight; + _this32.x += ey.x * s3; + _this32.y += ey.y * s3; + _this32.z += ey.z * s3; + } + var _g14 = 0; + while(_g14 < 8) { + var i5 = _g14++; + var v21 = this.tmpCircleVerts2[i5]; + var v31 = this.tmpCircleVerts2[(i5 + 1) % 8]; + var n1 = this.tmpCircleVerts1[i5]; + this.triangle(_this7,v21,v31,n1,this.tmpCircleNorms[i5],this.tmpCircleNorms[(i5 + 1) % 8],color); + v21 = this.tmpCircleVerts2[(i5 + 1) % 8]; + v31 = this.tmpCircleVerts2[i5]; + var _this33 = this.p; + var _this34 = _this33.sizeVec3 == 0 ? new oimo_common_Vec3() : _this33.stackVec3[--_this33.sizeVec3]; + _this34.x = ey.x; + _this34.y = ey.y; + _this34.z = ey.z; + var _this35 = _this34; + _this35.x = -_this35.x; + _this35.y = -_this35.y; + _this35.z = -_this35.z; + n1 = _this35; + this.triangle(_this10,v21,v31,_this35,_this35,_this35,color); + var _this36 = this.p; + if(_this35 != null) { + _this35.zero(); + if(_this36.sizeVec3 == _this36.stackVec3.length) { + var newArray4 = new Array(_this36.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this36.sizeVec3; + while(_g6 < _g15) { + var i6 = _g6++; + newArray4[i6] = _this36.stackVec3[i6]; + _this36.stackVec3[i6] = null; + } + _this36.stackVec3 = newArray4; + } + _this36.stackVec3[_this36.sizeVec3++] = _this35; + } + } + } + var _this37 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray5 = new Array(_this37.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this37.sizeVec3; + while(_g7 < _g16) { + var i7 = _g7++; + newArray5[i7] = _this37.stackVec3[i7]; + _this37.stackVec3[i7] = null; + } + _this37.stackVec3 = newArray5; + } + _this37.stackVec3[_this37.sizeVec3++] = _this7; + } + var _this38 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray6 = new Array(_this38.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this38.sizeVec3; + while(_g8 < _g17) { + var i8 = _g8++; + newArray6[i8] = _this38.stackVec3[i8]; + _this38.stackVec3[i8] = null; + } + _this38.stackVec3 = newArray6; + } + _this38.stackVec3[_this38.sizeVec3++] = _this10; + } + var _this39 = this.p; + if(o != null) { + o.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray7 = new Array(_this39.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this39.sizeVec3; + while(_g9 < _g18) { + var i9 = _g9++; + newArray7[i9] = _this39.stackVec3[i9]; + _this39.stackVec3[i9] = null; + } + _this39.stackVec3 = newArray7; + } + _this39.stackVec3[_this39.sizeVec3++] = o; + } + var _this40 = this.p; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this40.sizeMat3 == _this40.stackMat3.length) { + var newArray8 = new Array(_this40.sizeMat3 << 1); + var _g10 = 0; + var _g19 = _this40.sizeMat3; + while(_g10 < _g19) { + var i10 = _g10++; + newArray8[i10] = _this40.stackMat3[i10]; + _this40.stackMat3[i10] = null; + } + _this40.stackMat3 = newArray8; + } + _this40.stackMat3[_this40.sizeMat3++] = m; + } + var _this41 = this.p; + if(ex != null) { + ex.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray9 = new Array(_this41.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this41.sizeVec3; + while(_g20 < _g110) { + var i11 = _g20++; + newArray9[i11] = _this41.stackVec3[i11]; + _this41.stackVec3[i11] = null; + } + _this41.stackVec3 = newArray9; + } + _this41.stackVec3[_this41.sizeVec3++] = ex; + } + var _this42 = this.p; + if(ey != null) { + ey.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray10 = new Array(_this42.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this42.sizeVec3; + while(_g21 < _g111) { + var i12 = _g21++; + newArray10[i12] = _this42.stackVec3[i12]; + _this42.stackVec3[i12] = null; + } + _this42.stackVec3 = newArray10; + } + _this42.stackVec3[_this42.sizeVec3++] = ey; + } + var _this43 = this.p; + if(ez != null) { + ez.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray11 = new Array(_this43.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this43.sizeVec3; + while(_g22 < _g112) { + var i13 = _g22++; + newArray11[i13] = _this43.stackVec3[i13]; + _this43.stackVec3[i13] = null; + } + _this43.stackVec3 = newArray11; + } + _this43.stackVec3[_this43.sizeVec3++] = ez; + } + } + ,cylinder: function(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + var s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; + if(this.wireframe) { + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this7.x; + _this12.y = _this7.y; + _this12.z = _this7.z; + var _this13 = _this12; + var s1 = -radius; + _this13.x += ex.x * s1; + _this13.y += ex.y * s1; + _this13.z += ex.z * s1; + _this13.x += ez.x * 0; + _this13.y += ez.y * 0; + _this13.z += ez.z * 0; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this7.x; + _this15.y = _this7.y; + _this15.z = _this7.z; + var _this16 = _this15; + _this16.x += ex.x * radius; + _this16.y += ex.y * radius; + _this16.z += ex.z * radius; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this7.x; + _this18.y = _this7.y; + _this18.z = _this7.z; + var _this19 = _this18; + _this19.x += ex.x * 0; + _this19.y += ex.y * 0; + _this19.z += ex.z * 0; + var s2 = -radius; + _this19.x += ez.x * s2; + _this19.y += ez.y * s2; + _this19.z += ez.z * s2; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this7.x; + _this21.y = _this7.y; + _this21.z = _this7.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + _this22.x += ez.x * radius; + _this22.y += ez.y * radius; + _this22.z += ez.z * radius; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; + var _this25 = _this24; + var s3 = -radius; + _this25.x += ex.x * s3; + _this25.y += ex.y * s3; + _this25.z += ex.z * s3; + _this25.x += ez.x * 0; + _this25.y += ez.y * 0; + _this25.z += ez.z * 0; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = _this10.x; + _this27.y = _this10.y; + _this27.z = _this10.z; + var _this28 = _this27; + _this28.x += ex.x * radius; + _this28.y += ex.y * radius; + _this28.z += ex.z * radius; + _this28.x += ez.x * 0; + _this28.y += ez.y * 0; + _this28.z += ez.z * 0; + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = _this10.x; + _this30.y = _this10.y; + _this30.z = _this10.z; + var _this31 = _this30; + _this31.x += ex.x * 0; + _this31.y += ex.y * 0; + _this31.z += ex.z * 0; + var s4 = -radius; + _this31.x += ez.x * s4; + _this31.y += ez.y * s4; + _this31.z += ez.z * s4; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = _this10.x; + _this33.y = _this10.y; + _this33.z = _this10.z; + var _this34 = _this33; + _this34.x += ex.x * 0; + _this34.y += ex.y * 0; + _this34.z += ex.z * 0; + _this34.x += ez.x * radius; + _this34.y += ez.y * radius; + _this34.z += ez.z * radius; + this.ellipse(_this7,ex,ez,radius,radius,color); + this.ellipse(_this10,ex,ez,radius,radius,color); + this.line(_this13,_this25,color); + this.line(_this16,_this28,color); + this.line(_this19,_this31,color); + this.line(_this22,_this34,color); + var _this35 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this35.sizeVec3 == _this35.stackVec3.length) { + var newArray = new Array(_this35.sizeVec3 << 1); + var _g = 0; + var _g1 = _this35.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this35.stackVec3[i]; + _this35.stackVec3[i] = null; + } + _this35.stackVec3 = newArray; + } + _this35.stackVec3[_this35.sizeVec3++] = _this13; + } + var _this36 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this36.sizeVec3 == _this36.stackVec3.length) { + var newArray1 = new Array(_this36.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this36.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this36.stackVec3[i1]; + _this36.stackVec3[i1] = null; + } + _this36.stackVec3 = newArray1; + } + _this36.stackVec3[_this36.sizeVec3++] = _this16; + } + var _this37 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray2 = new Array(_this37.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this37.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this37.stackVec3[i2]; + _this37.stackVec3[i2] = null; + } + _this37.stackVec3 = newArray2; + } + _this37.stackVec3[_this37.sizeVec3++] = _this19; + } + var _this38 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray3 = new Array(_this38.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this38.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this38.stackVec3[i3]; + _this38.stackVec3[i3] = null; + } + _this38.stackVec3 = newArray3; + } + _this38.stackVec3[_this38.sizeVec3++] = _this22; + } + var _this39 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray4 = new Array(_this39.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this39.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this39.stackVec3[i4]; + _this39.stackVec3[i4] = null; + } + _this39.stackVec3 = newArray4; + } + _this39.stackVec3[_this39.sizeVec3++] = _this25; + } + var _this40 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray5 = new Array(_this40.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this40.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this40.stackVec3[i5]; + _this40.stackVec3[i5] = null; + } + _this40.stackVec3 = newArray5; + } + _this40.stackVec3[_this40.sizeVec3++] = _this28; + } + var _this41 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray6 = new Array(_this41.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this41.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this41.stackVec3[i6]; + _this41.stackVec3[i6] = null; + } + _this41.stackVec3 = newArray6; + } + _this41.stackVec3[_this41.sizeVec3++] = _this31; + } + var _this42 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray7 = new Array(_this42.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this42.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this42.stackVec3[i7]; + _this42.stackVec3[i7] = null; + } + _this42.stackVec3 = newArray7; + } + _this42.stackVec3[_this42.sizeVec3++] = _this34; + } + } else { + var _g9 = 0; + while(_g9 < 8) { + var i8 = _g9++; + var _this43 = this.tmpCircleNorms[i8]; + var v1 = this.circleCoords[i8]; + _this43.x = v1.x; + _this43.y = v1.y; + _this43.z = v1.z; + var y = _this43.x * m.e10 + _this43.y * m.e11 + _this43.z * m.e12; + var z = _this43.x * m.e20 + _this43.y * m.e21 + _this43.z * m.e22; + _this43.x = _this43.x * m.e00 + _this43.y * m.e01 + _this43.z * m.e02; + _this43.y = y; + _this43.z = z; + var _this44 = this.tmpCircleVerts1[i8]; + var v2 = this.tmpCircleNorms[i8]; + _this44.x = v2.x; + _this44.y = v2.y; + _this44.z = v2.z; + _this44.x *= radius; + _this44.y *= radius; + _this44.z *= radius; + _this44.x += o.x; + _this44.y += o.y; + _this44.z += o.z; + var _this45 = this.tmpCircleVerts2[i8]; + var v3 = this.tmpCircleVerts1[i8]; + _this45.x = v3.x; + _this45.y = v3.y; + _this45.z = v3.z; + var _this46 = this.tmpCircleVerts1[i8]; + _this46.x += ey.x * halfHeight; + _this46.y += ey.y * halfHeight; + _this46.z += ey.z * halfHeight; + var _this47 = this.tmpCircleVerts2[i8]; + var s5 = -halfHeight; + _this47.x += ey.x * s5; + _this47.y += ey.y * s5; + _this47.z += ey.z * s5; + } + var _g18 = 0; + while(_g18 < 8) { + var i9 = _g18++; + var v11 = _this7; + var v21 = this.tmpCircleVerts1[i9]; + var v31 = this.tmpCircleVerts1[(i9 + 1) % 8]; + var n1 = ey; + this.triangle(_this7,v21,v31,n1,n1,n1,color); + v11 = _this10; + v21 = this.tmpCircleVerts2[(i9 + 1) % 8]; + v31 = this.tmpCircleVerts2[i9]; + var _this48 = this.p; + var _this49 = _this48.sizeVec3 == 0 ? new oimo_common_Vec3() : _this48.stackVec3[--_this48.sizeVec3]; + _this49.x = ey.x; + _this49.y = ey.y; + _this49.z = ey.z; + var _this50 = _this49; + _this50.x = -_this50.x; + _this50.y = -_this50.y; + _this50.z = -_this50.z; + n1 = _this50; + this.triangle(_this10,v21,v31,_this50,_this50,_this50,color); + var _this51 = this.p; + if(_this50 != null) { + _this50.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray8 = new Array(_this51.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this51.sizeVec3; + while(_g10 < _g19) { + var i10 = _g10++; + newArray8[i10] = _this51.stackVec3[i10]; + _this51.stackVec3[i10] = null; + } + _this51.stackVec3 = newArray8; + } + _this51.stackVec3[_this51.sizeVec3++] = _this50; + } + v11 = this.tmpCircleVerts1[i9]; + v21 = this.tmpCircleVerts2[i9]; + v31 = this.tmpCircleVerts2[(i9 + 1) % 8]; + n1 = this.tmpCircleNorms[i9]; + var n2 = this.tmpCircleNorms[(i9 + 1) % 8]; + this.rect(v11,v21,v31,this.tmpCircleVerts1[(i9 + 1) % 8],n1,n1,n2,n2,color); + } + } + var _this52 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray9 = new Array(_this52.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this52.sizeVec3; + while(_g20 < _g110) { + var i11 = _g20++; + newArray9[i11] = _this52.stackVec3[i11]; + _this52.stackVec3[i11] = null; + } + _this52.stackVec3 = newArray9; + } + _this52.stackVec3[_this52.sizeVec3++] = _this7; + } + var _this53 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray10 = new Array(_this53.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this53.sizeVec3; + while(_g21 < _g111) { + var i12 = _g21++; + newArray10[i12] = _this53.stackVec3[i12]; + _this53.stackVec3[i12] = null; + } + _this53.stackVec3 = newArray10; + } + _this53.stackVec3[_this53.sizeVec3++] = _this10; + } + var _this54 = this.p; + if(o != null) { + o.zero(); + if(_this54.sizeVec3 == _this54.stackVec3.length) { + var newArray11 = new Array(_this54.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this54.sizeVec3; + while(_g22 < _g112) { + var i13 = _g22++; + newArray11[i13] = _this54.stackVec3[i13]; + _this54.stackVec3[i13] = null; + } + _this54.stackVec3 = newArray11; + } + _this54.stackVec3[_this54.sizeVec3++] = o; + } + var _this55 = this.p; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this55.sizeMat3 == _this55.stackMat3.length) { + var newArray12 = new Array(_this55.sizeMat3 << 1); + var _g23 = 0; + var _g113 = _this55.sizeMat3; + while(_g23 < _g113) { + var i14 = _g23++; + newArray12[i14] = _this55.stackMat3[i14]; + _this55.stackMat3[i14] = null; + } + _this55.stackMat3 = newArray12; + } + _this55.stackMat3[_this55.sizeMat3++] = m; + } + var _this56 = this.p; + if(ex != null) { + ex.zero(); + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newArray13 = new Array(_this56.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this56.sizeVec3; + while(_g24 < _g114) { + var i15 = _g24++; + newArray13[i15] = _this56.stackVec3[i15]; + _this56.stackVec3[i15] = null; + } + _this56.stackVec3 = newArray13; + } + _this56.stackVec3[_this56.sizeVec3++] = ex; + } + var _this57 = this.p; + if(ey != null) { + ey.zero(); + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newArray14 = new Array(_this57.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this57.sizeVec3; + while(_g25 < _g115) { + var i16 = _g25++; + newArray14[i16] = _this57.stackVec3[i16]; + _this57.stackVec3[i16] = null; + } + _this57.stackVec3 = newArray14; + } + _this57.stackVec3[_this57.sizeVec3++] = ey; + } + var _this58 = this.p; + if(ez != null) { + ez.zero(); + if(_this58.sizeVec3 == _this58.stackVec3.length) { + var newArray15 = new Array(_this58.sizeVec3 << 1); + var _g26 = 0; + var _g116 = _this58.sizeVec3; + while(_g26 < _g116) { + var i17 = _g26++; + newArray15[i17] = _this58.stackVec3[i17]; + _this58.stackVec3[i17] = null; + } + _this58.stackVec3 = newArray15; + } + _this58.stackVec3[_this58.sizeVec3++] = ez; + } + } + ,capsule: function(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var vs = this.tmpSphereVerts; + var ns = this.tmpSphereNorms; + var _g = 0; + while(_g < 5) { + var i2 = _g++; + var n = this.tmpSphereVerts[i2].length; + var _g1 = 0; + while(_g1 < n) { + var j2 = _g1++; + var _this5 = ns[i2][j2]; + var v1 = this.sphereCoords[i2][j2]; + _this5.x = v1.x; + _this5.y = v1.y; + _this5.z = v1.z; + var y = _this5.x * m.e10 + _this5.y * m.e11 + _this5.z * m.e12; + var z = _this5.x * m.e20 + _this5.y * m.e21 + _this5.z * m.e22; + _this5.x = _this5.x * m.e00 + _this5.y * m.e01 + _this5.z * m.e02; + _this5.y = y; + _this5.z = z; + } + } + var _g2 = 0; + while(_g2 < 4) { + var i = _g2++; + if(i == 0) { + var _g21 = 0; + while(_g21 < 3) { + var i21 = _g21++; + var n1 = this.tmpSphereVerts[i21].length; + var _g22 = 0; + while(_g22 < n1) { + var j21 = _g22++; + var _this6 = vs[i21][j21]; + var v2 = ns[i21][j21]; + _this6.x = v2.x; + _this6.y = v2.y; + _this6.z = v2.z; + _this6.x *= radius; + _this6.y *= radius; + _this6.z *= radius; + _this6.x += o.x; + _this6.y += o.y; + _this6.z += o.z; + _this6.x += ey.x * halfHeight; + _this6.y += ey.y * halfHeight; + _this6.z += ey.z * halfHeight; + } + } + } + if(i == 2) { + var _g23 = 2; + while(_g23 < 5) { + var i22 = _g23++; + var n2 = this.tmpSphereVerts[i22].length; + var _g24 = 0; + while(_g24 < n2) { + var j22 = _g24++; + var _this7 = vs[i22][j22]; + var v3 = ns[i22][j22]; + _this7.x = v3.x; + _this7.y = v3.y; + _this7.z = v3.z; + _this7.x *= radius; + _this7.y *= radius; + _this7.z *= radius; + _this7.x += o.x; + _this7.y += o.y; + _this7.z += o.z; + var s = -halfHeight; + _this7.x += ey.x * s; + _this7.y += ey.y * s; + _this7.z += ey.z * s; + } + } + } + var _g25 = 0; + while(_g25 < 8) { + var j = _g25++; + var v11; + var v21; + var v31; + var v4; + var n11; + var n21; + var n3; + var n4; + if(i == 0) { + if(this.wireframe) { + v11 = vs[0][0]; + v21 = vs[1][j]; + this.line(v11,v21,color); + } else { + v11 = vs[0][0]; + v21 = vs[1][j]; + v31 = vs[1][(j + 1) % 8]; + n11 = ns[0][0]; + n21 = ns[1][j]; + n3 = ns[1][(j + 1) % 8]; + this.triangle(v11,v21,v31,n11,n21,n3,color); + } + } else if(i == 3) { + if(this.wireframe) { + v11 = vs[4][0]; + v21 = vs[i][(j + 1) % 8]; + v31 = vs[i][j]; + this.line(v11,v21,color); + this.line(v21,v31,color); + } else { + v11 = vs[4][0]; + v21 = vs[i][(j + 1) % 8]; + v31 = vs[i][j]; + n11 = ns[4][0]; + n21 = ns[i][(j + 1) % 8]; + n3 = ns[i][j]; + this.triangle(v11,v21,v31,n11,n21,n3,color); + } + } else if(this.wireframe) { + v11 = vs[i][j]; + v21 = vs[i][(j + 1) % 8]; + v31 = vs[i + 1][j]; + this.line(v11,v21,color); + this.line(v11,v31,color); + } else { + v11 = vs[i][j]; + v21 = vs[i][(j + 1) % 8]; + v31 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % 8]; + n11 = ns[i][j]; + n21 = ns[i][(j + 1) % 8]; + n3 = ns[i + 1][j]; + n4 = ns[i + 1][(j + 1) % 8]; + this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); + } + } + } + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + _this10.x += ey.x * halfHeight; + _this10.y += ey.y * halfHeight; + _this10.z += ey.z * halfHeight; + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = o.x; + _this12.y = o.y; + _this12.z = o.z; + var _this13 = _this12; + var s1 = -halfHeight; + _this13.x += ey.x * s1; + _this13.y += ey.y * s1; + _this13.z += ey.z * s1; + if(this.wireframe) { + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + var _this16 = _this15; + var s2 = -radius; + _this16.x += ex.x * s2; + _this16.y += ex.y * s2; + _this16.z += ex.z * s2; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + var _this19 = _this18; + _this19.x += ex.x * radius; + _this19.y += ex.y * radius; + _this19.z += ex.z * radius; + _this19.x += ez.x * 0; + _this19.y += ez.y * 0; + _this19.z += ez.z * 0; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + var _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + var s3 = -radius; + _this22.x += ez.x * s3; + _this22.y += ez.y * s3; + _this22.z += ez.z * s3; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; + var _this25 = _this24; + _this25.x += ex.x * 0; + _this25.y += ex.y * 0; + _this25.z += ex.z * 0; + _this25.x += ez.x * radius; + _this25.y += ez.y * radius; + _this25.z += ez.z * radius; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = _this13.x; + _this27.y = _this13.y; + _this27.z = _this13.z; + var _this28 = _this27; + var s4 = -radius; + _this28.x += ex.x * s4; + _this28.y += ex.y * s4; + _this28.z += ex.z * s4; + _this28.x += ez.x * 0; + _this28.y += ez.y * 0; + _this28.z += ez.z * 0; + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = _this13.x; + _this30.y = _this13.y; + _this30.z = _this13.z; + var _this31 = _this30; + _this31.x += ex.x * radius; + _this31.y += ex.y * radius; + _this31.z += ex.z * radius; + _this31.x += ez.x * 0; + _this31.y += ez.y * 0; + _this31.z += ez.z * 0; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = _this13.x; + _this33.y = _this13.y; + _this33.z = _this13.z; + var _this34 = _this33; + _this34.x += ex.x * 0; + _this34.y += ex.y * 0; + _this34.z += ex.z * 0; + var s5 = -radius; + _this34.x += ez.x * s5; + _this34.y += ez.y * s5; + _this34.z += ez.z * s5; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = _this13.x; + _this36.y = _this13.y; + _this36.z = _this13.z; + var _this37 = _this36; + _this37.x += ex.x * 0; + _this37.y += ex.y * 0; + _this37.z += ex.z * 0; + _this37.x += ez.x * radius; + _this37.y += ez.y * radius; + _this37.z += ez.z * radius; + this.ellipse(_this10,ex,ez,radius,radius,color); + this.ellipse(_this13,ex,ez,radius,radius,color); + this.line(_this16,_this28,color); + this.line(_this19,_this31,color); + this.line(_this22,_this34,color); + this.line(_this25,_this37,color); + var _this38 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray = new Array(_this38.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this38.sizeVec3; + while(_g3 < _g11) { + var i1 = _g3++; + newArray[i1] = _this38.stackVec3[i1]; + _this38.stackVec3[i1] = null; + } + _this38.stackVec3 = newArray; + } + _this38.stackVec3[_this38.sizeVec3++] = _this16; + } + var _this39 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray1 = new Array(_this39.sizeVec3 << 1); + var _g4 = 0; + var _g12 = _this39.sizeVec3; + while(_g4 < _g12) { + var i3 = _g4++; + newArray1[i3] = _this39.stackVec3[i3]; + _this39.stackVec3[i3] = null; + } + _this39.stackVec3 = newArray1; + } + _this39.stackVec3[_this39.sizeVec3++] = _this19; + } + var _this40 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray2 = new Array(_this40.sizeVec3 << 1); + var _g5 = 0; + var _g13 = _this40.sizeVec3; + while(_g5 < _g13) { + var i4 = _g5++; + newArray2[i4] = _this40.stackVec3[i4]; + _this40.stackVec3[i4] = null; + } + _this40.stackVec3 = newArray2; + } + _this40.stackVec3[_this40.sizeVec3++] = _this22; + } + var _this41 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray3 = new Array(_this41.sizeVec3 << 1); + var _g6 = 0; + var _g14 = _this41.sizeVec3; + while(_g6 < _g14) { + var i5 = _g6++; + newArray3[i5] = _this41.stackVec3[i5]; + _this41.stackVec3[i5] = null; + } + _this41.stackVec3 = newArray3; + } + _this41.stackVec3[_this41.sizeVec3++] = _this25; + } + var _this42 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray4 = new Array(_this42.sizeVec3 << 1); + var _g7 = 0; + var _g15 = _this42.sizeVec3; + while(_g7 < _g15) { + var i6 = _g7++; + newArray4[i6] = _this42.stackVec3[i6]; + _this42.stackVec3[i6] = null; + } + _this42.stackVec3 = newArray4; + } + _this42.stackVec3[_this42.sizeVec3++] = _this28; + } + var _this43 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray5 = new Array(_this43.sizeVec3 << 1); + var _g8 = 0; + var _g16 = _this43.sizeVec3; + while(_g8 < _g16) { + var i7 = _g8++; + newArray5[i7] = _this43.stackVec3[i7]; + _this43.stackVec3[i7] = null; + } + _this43.stackVec3 = newArray5; + } + _this43.stackVec3[_this43.sizeVec3++] = _this31; + } + var _this44 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray6 = new Array(_this44.sizeVec3 << 1); + var _g9 = 0; + var _g17 = _this44.sizeVec3; + while(_g9 < _g17) { + var i8 = _g9++; + newArray6[i8] = _this44.stackVec3[i8]; + _this44.stackVec3[i8] = null; + } + _this44.stackVec3 = newArray6; + } + _this44.stackVec3[_this44.sizeVec3++] = _this34; + } + var _this45 = this.p; + if(_this37 != null) { + _this37.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray7 = new Array(_this45.sizeVec3 << 1); + var _g10 = 0; + var _g18 = _this45.sizeVec3; + while(_g10 < _g18) { + var i9 = _g10++; + newArray7[i9] = _this45.stackVec3[i9]; + _this45.stackVec3[i9] = null; + } + _this45.stackVec3 = newArray7; + } + _this45.stackVec3[_this45.sizeVec3++] = _this37; + } + } else { + var _g41 = 0; + while(_g41 < 8) { + var i10 = _g41++; + var _this46 = this.tmpCircleNorms[i10]; + var v5 = this.circleCoords[i10]; + _this46.x = v5.x; + _this46.y = v5.y; + _this46.z = v5.z; + var y1 = _this46.x * m.e10 + _this46.y * m.e11 + _this46.z * m.e12; + var z1 = _this46.x * m.e20 + _this46.y * m.e21 + _this46.z * m.e22; + _this46.x = _this46.x * m.e00 + _this46.y * m.e01 + _this46.z * m.e02; + _this46.y = y1; + _this46.z = z1; + var _this47 = this.tmpCircleVerts1[i10]; + var v6 = this.tmpCircleNorms[i10]; + _this47.x = v6.x; + _this47.y = v6.y; + _this47.z = v6.z; + _this47.x *= radius; + _this47.y *= radius; + _this47.z *= radius; + _this47.x += o.x; + _this47.y += o.y; + _this47.z += o.z; + var _this48 = this.tmpCircleVerts2[i10]; + var v7 = this.tmpCircleVerts1[i10]; + _this48.x = v7.x; + _this48.y = v7.y; + _this48.z = v7.z; + var _this49 = this.tmpCircleVerts1[i10]; + _this49.x += ey.x * halfHeight; + _this49.y += ey.y * halfHeight; + _this49.z += ey.z * halfHeight; + var _this50 = this.tmpCircleVerts2[i10]; + var s6 = -halfHeight; + _this50.x += ey.x * s6; + _this50.y += ey.y * s6; + _this50.z += ey.z * s6; + } + var _g51 = 0; + while(_g51 < 8) { + var i11 = _g51++; + var n12 = this.tmpCircleNorms[i11]; + var n22 = this.tmpCircleNorms[(i11 + 1) % 8]; + this.rect(this.tmpCircleVerts1[i11],this.tmpCircleVerts2[i11],this.tmpCircleVerts2[(i11 + 1) % 8],this.tmpCircleVerts1[(i11 + 1) % 8],n12,n12,n22,n22,color); + } + } + var _this51 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray8 = new Array(_this51.sizeVec3 << 1); + var _g19 = 0; + var _g110 = _this51.sizeVec3; + while(_g19 < _g110) { + var i12 = _g19++; + newArray8[i12] = _this51.stackVec3[i12]; + _this51.stackVec3[i12] = null; + } + _this51.stackVec3 = newArray8; + } + _this51.stackVec3[_this51.sizeVec3++] = _this10; + } + var _this52 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray9 = new Array(_this52.sizeVec3 << 1); + var _g20 = 0; + var _g111 = _this52.sizeVec3; + while(_g20 < _g111) { + var i13 = _g20++; + newArray9[i13] = _this52.stackVec3[i13]; + _this52.stackVec3[i13] = null; + } + _this52.stackVec3 = newArray9; + } + _this52.stackVec3[_this52.sizeVec3++] = _this13; + } + var _this53 = this.p; + if(o != null) { + o.zero(); + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray10 = new Array(_this53.sizeVec3 << 1); + var _g26 = 0; + var _g112 = _this53.sizeVec3; + while(_g26 < _g112) { + var i14 = _g26++; + newArray10[i14] = _this53.stackVec3[i14]; + _this53.stackVec3[i14] = null; + } + _this53.stackVec3 = newArray10; + } + _this53.stackVec3[_this53.sizeVec3++] = o; + } + var _this54 = this.p; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this54.sizeMat3 == _this54.stackMat3.length) { + var newArray11 = new Array(_this54.sizeMat3 << 1); + var _g27 = 0; + var _g113 = _this54.sizeMat3; + while(_g27 < _g113) { + var i15 = _g27++; + newArray11[i15] = _this54.stackMat3[i15]; + _this54.stackMat3[i15] = null; + } + _this54.stackMat3 = newArray11; + } + _this54.stackMat3[_this54.sizeMat3++] = m; + } + var _this55 = this.p; + if(ex != null) { + ex.zero(); + if(_this55.sizeVec3 == _this55.stackVec3.length) { + var newArray12 = new Array(_this55.sizeVec3 << 1); + var _g28 = 0; + var _g114 = _this55.sizeVec3; + while(_g28 < _g114) { + var i16 = _g28++; + newArray12[i16] = _this55.stackVec3[i16]; + _this55.stackVec3[i16] = null; + } + _this55.stackVec3 = newArray12; + } + _this55.stackVec3[_this55.sizeVec3++] = ex; + } + var _this56 = this.p; + if(ey != null) { + ey.zero(); + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newArray13 = new Array(_this56.sizeVec3 << 1); + var _g29 = 0; + var _g115 = _this56.sizeVec3; + while(_g29 < _g115) { + var i17 = _g29++; + newArray13[i17] = _this56.stackVec3[i17]; + _this56.stackVec3[i17] = null; + } + _this56.stackVec3 = newArray13; + } + _this56.stackVec3[_this56.sizeVec3++] = ey; + } + var _this57 = this.p; + if(ez != null) { + ez.zero(); + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newArray14 = new Array(_this57.sizeVec3 << 1); + var _g30 = 0; + var _g116 = _this57.sizeVec3; + while(_g30 < _g116) { + var i18 = _g30++; + newArray14[i18] = _this57.stackVec3[i18]; + _this57.stackVec3[i18] = null; + } + _this57.stackVec3 = newArray14; + } + _this57.stackVec3[_this57.sizeVec3++] = ez; + } + } + ,sphere: function(tf,radius,color) { + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var m = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + var vs = this.tmpSphereVerts; + var ns = this.tmpSphereNorms; + var _g = 0; + while(_g < 5) { + var i = _g++; + var n = this.tmpSphereVerts[i].length; + var _g1 = 0; + while(_g1 < n) { + var j = _g1++; + var _this2 = ns[i][j]; + var v1 = this.sphereCoords[i][j]; + _this2.x = v1.x; + _this2.y = v1.y; + _this2.z = v1.z; + var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; + var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; + _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; + _this2.y = y; + _this2.z = z; + var _this3 = vs[i][j]; + var v2 = ns[i][j]; + _this3.x = v2.x; + _this3.y = v2.y; + _this3.z = v2.z; + _this3.x *= radius; + _this3.y *= radius; + _this3.z *= radius; + _this3.x += o.x; + _this3.y += o.y; + _this3.z += o.z; + } + } + var _g2 = 0; + while(_g2 < 4) { + var i1 = _g2++; + var _g21 = 0; + while(_g21 < 8) { + var j1 = _g21++; + var v11; + var v21; + var v3; + var v4; + var n1; + var n2; + var n3; + var n4; + if(i1 == 0) { + if(this.wireframe) { + v11 = vs[0][0]; + v21 = vs[1][j1]; + this.line(v11,v21,color); + } else { + v11 = vs[0][0]; + v21 = vs[1][j1]; + v3 = vs[1][(j1 + 1) % 8]; + n1 = ns[0][0]; + n2 = ns[1][j1]; + n3 = ns[1][(j1 + 1) % 8]; + this.triangle(v11,v21,v3,n1,n2,n3,color); + } + } else if(i1 == 3) { + if(this.wireframe) { + v11 = vs[4][0]; + v21 = vs[i1][(j1 + 1) % 8]; + v3 = vs[i1][j1]; + this.line(v11,v21,color); + this.line(v21,v3,color); + } else { + v11 = vs[4][0]; + v21 = vs[i1][(j1 + 1) % 8]; + v3 = vs[i1][j1]; + n1 = ns[4][0]; + n2 = ns[i1][(j1 + 1) % 8]; + n3 = ns[i1][j1]; + this.triangle(v11,v21,v3,n1,n2,n3,color); + } + } else if(this.wireframe) { + v11 = vs[i1][j1]; + v21 = vs[i1][(j1 + 1) % 8]; + v3 = vs[i1 + 1][j1]; + this.line(v11,v21,color); + this.line(v11,v3,color); + } else { + v11 = vs[i1][j1]; + v21 = vs[i1][(j1 + 1) % 8]; + v3 = vs[i1 + 1][j1]; + v4 = vs[i1 + 1][(j1 + 1) % 8]; + n1 = ns[i1][j1]; + n2 = ns[i1][(j1 + 1) % 8]; + n3 = ns[i1 + 1][j1]; + n4 = ns[i1 + 1][(j1 + 1) % 8]; + this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); + } + } + } + var _this4 = this.p; + if(o != null) { + o.zero(); + if(_this4.sizeVec3 == _this4.stackVec3.length) { + var newArray = new Array(_this4.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this4.sizeVec3; + while(_g3 < _g11) { + var i2 = _g3++; + newArray[i2] = _this4.stackVec3[i2]; + _this4.stackVec3[i2] = null; + } + _this4.stackVec3 = newArray; + } + _this4.stackVec3[_this4.sizeVec3++] = o; + } + var _this5 = this.p; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this5.sizeMat3 == _this5.stackMat3.length) { + var newArray1 = new Array(_this5.sizeMat3 << 1); + var _g4 = 0; + var _g12 = _this5.sizeMat3; + while(_g4 < _g12) { + var i3 = _g4++; + newArray1[i3] = _this5.stackMat3[i3]; + _this5.stackMat3[i3] = null; + } + _this5.stackMat3 = newArray1; + } + _this5.stackMat3[_this5.sizeMat3++] = m; + } + } + ,box: function(tf,halfExtents,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var hx = halfExtents.x; + var hy = halfExtents.y; + var hz = halfExtents.z; + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + var s = -hx; + _this7.x += ex.x * s; + _this7.y += ex.y * s; + _this7.z += ex.z * s; + var s1 = -hy; + _this7.x += ey.x * s1; + _this7.y += ey.y * s1; + _this7.z += ey.z * s1; + var s2 = -hz; + _this7.x += ez.x * s2; + _this7.y += ez.y * s2; + _this7.z += ez.z * s2; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + var s3 = -hx; + _this10.x += ex.x * s3; + _this10.y += ex.y * s3; + _this10.z += ex.z * s3; + var s4 = -hy; + _this10.x += ey.x * s4; + _this10.y += ey.y * s4; + _this10.z += ey.z * s4; + _this10.x += ez.x * hz; + _this10.y += ez.y * hz; + _this10.z += ez.z * hz; + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = o.x; + _this12.y = o.y; + _this12.z = o.z; + var _this13 = _this12; + var s5 = -hx; + _this13.x += ex.x * s5; + _this13.y += ex.y * s5; + _this13.z += ex.z * s5; + _this13.x += ey.x * hy; + _this13.y += ey.y * hy; + _this13.z += ey.z * hy; + var s6 = -hz; + _this13.x += ez.x * s6; + _this13.y += ez.y * s6; + _this13.z += ez.z * s6; + var _this14 = this.p; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = o.x; + _this15.y = o.y; + _this15.z = o.z; + var _this16 = _this15; + var s7 = -hx; + _this16.x += ex.x * s7; + _this16.y += ex.y * s7; + _this16.z += ex.z * s7; + _this16.x += ey.x * hy; + _this16.y += ey.y * hy; + _this16.z += ey.z * hy; + _this16.x += ez.x * hz; + _this16.y += ez.y * hz; + _this16.z += ez.z * hz; + var _this17 = this.p; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = o.x; + _this18.y = o.y; + _this18.z = o.z; + var _this19 = _this18; + _this19.x += ex.x * hx; + _this19.y += ex.y * hx; + _this19.z += ex.z * hx; + var s8 = -hy; + _this19.x += ey.x * s8; + _this19.y += ey.y * s8; + _this19.z += ey.z * s8; + var s9 = -hz; + _this19.x += ez.x * s9; + _this19.y += ez.y * s9; + _this19.z += ez.z * s9; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = o.x; + _this21.y = o.y; + _this21.z = o.z; + var _this22 = _this21; + _this22.x += ex.x * hx; + _this22.y += ex.y * hx; + _this22.z += ex.z * hx; + var s10 = -hy; + _this22.x += ey.x * s10; + _this22.y += ey.y * s10; + _this22.z += ey.z * s10; + _this22.x += ez.x * hz; + _this22.y += ez.y * hz; + _this22.z += ez.z * hz; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = o.x; + _this24.y = o.y; + _this24.z = o.z; + var _this25 = _this24; + _this25.x += ex.x * hx; + _this25.y += ex.y * hx; + _this25.z += ex.z * hx; + _this25.x += ey.x * hy; + _this25.y += ey.y * hy; + _this25.z += ey.z * hy; + var s11 = -hz; + _this25.x += ez.x * s11; + _this25.y += ez.y * s11; + _this25.z += ez.z * s11; + var _this26 = this.p; + var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = o.x; + _this27.y = o.y; + _this27.z = o.z; + var _this28 = _this27; + _this28.x += ex.x * hx; + _this28.y += ex.y * hx; + _this28.z += ex.z * hx; + _this28.x += ey.x * hy; + _this28.y += ey.y * hy; + _this28.z += ey.z * hy; + _this28.x += ez.x * hz; + _this28.y += ez.y * hz; + _this28.z += ez.z * hz; + if(this.wireframe) { + this.line(_this7,_this10,color); + this.line(_this13,_this16,color); + this.line(_this19,_this22,color); + this.line(_this25,_this28,color); + this.line(_this7,_this13,color); + this.line(_this10,_this16,color); + this.line(_this19,_this25,color); + this.line(_this22,_this28,color); + this.line(_this7,_this19,color); + this.line(_this10,_this22,color); + this.line(_this13,_this25,color); + this.line(_this16,_this28,color); + } else { + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = ex.x; + _this30.y = ex.y; + _this30.z = ex.z; + var _this31 = _this30; + _this31.x = -_this31.x; + _this31.y = -_this31.y; + _this31.z = -_this31.z; + var _this32 = this.p; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = ey.x; + _this33.y = ey.y; + _this33.z = ey.z; + var _this34 = _this33; + _this34.x = -_this34.x; + _this34.y = -_this34.y; + _this34.z = -_this34.z; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = ez.x; + _this36.y = ez.y; + _this36.z = ez.z; + var _this37 = _this36; + _this37.x = -_this37.x; + _this37.y = -_this37.y; + _this37.z = -_this37.z; + this.rect(_this7,_this10,_this16,_this13,_this31,_this31,_this31,_this31,color); + this.rect(_this19,_this25,_this28,_this22,ex,ex,ex,ex,color); + this.rect(_this7,_this19,_this22,_this10,_this34,_this34,_this34,_this34,color); + this.rect(_this13,_this16,_this28,_this25,ey,ey,ey,ey,color); + this.rect(_this7,_this13,_this25,_this19,_this37,_this37,_this37,_this37,color); + this.rect(_this10,_this22,_this28,_this16,ez,ez,ez,ez,color); + var _this38 = this.p; + if(_this31 != null) { + _this31.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray = new Array(_this38.sizeVec3 << 1); + var _g = 0; + var _g1 = _this38.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this38.stackVec3[i]; + _this38.stackVec3[i] = null; + } + _this38.stackVec3 = newArray; + } + _this38.stackVec3[_this38.sizeVec3++] = _this31; + } + var _this39 = this.p; + if(_this34 != null) { + _this34.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray1 = new Array(_this39.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this39.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this39.stackVec3[i1]; + _this39.stackVec3[i1] = null; + } + _this39.stackVec3 = newArray1; + } + _this39.stackVec3[_this39.sizeVec3++] = _this34; + } + var _this40 = this.p; + if(_this37 != null) { + _this37.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray2 = new Array(_this40.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this40.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this40.stackVec3[i2]; + _this40.stackVec3[i2] = null; + } + _this40.stackVec3 = newArray2; + } + _this40.stackVec3[_this40.sizeVec3++] = _this37; + } + } + var _this41 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray3 = new Array(_this41.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this41.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this41.stackVec3[i3]; + _this41.stackVec3[i3] = null; + } + _this41.stackVec3 = newArray3; + } + _this41.stackVec3[_this41.sizeVec3++] = _this7; + } + var _this42 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray4 = new Array(_this42.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this42.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this42.stackVec3[i4]; + _this42.stackVec3[i4] = null; + } + _this42.stackVec3 = newArray4; + } + _this42.stackVec3[_this42.sizeVec3++] = _this10; + } + var _this43 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray5 = new Array(_this43.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this43.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this43.stackVec3[i5]; + _this43.stackVec3[i5] = null; + } + _this43.stackVec3 = newArray5; + } + _this43.stackVec3[_this43.sizeVec3++] = _this13; + } + var _this44 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray6 = new Array(_this44.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this44.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this44.stackVec3[i6]; + _this44.stackVec3[i6] = null; + } + _this44.stackVec3 = newArray6; + } + _this44.stackVec3[_this44.sizeVec3++] = _this16; + } + var _this45 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray7 = new Array(_this45.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this45.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this45.stackVec3[i7]; + _this45.stackVec3[i7] = null; + } + _this45.stackVec3 = newArray7; + } + _this45.stackVec3[_this45.sizeVec3++] = _this19; + } + var _this46 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newArray8 = new Array(_this46.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this46.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this46.stackVec3[i8]; + _this46.stackVec3[i8] = null; + } + _this46.stackVec3 = newArray8; + } + _this46.stackVec3[_this46.sizeVec3++] = _this22; + } + var _this47 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this47.sizeVec3 == _this47.stackVec3.length) { + var newArray9 = new Array(_this47.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this47.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this47.stackVec3[i9]; + _this47.stackVec3[i9] = null; + } + _this47.stackVec3 = newArray9; + } + _this47.stackVec3[_this47.sizeVec3++] = _this25; + } + var _this48 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this48.sizeVec3 == _this48.stackVec3.length) { + var newArray10 = new Array(_this48.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this48.sizeVec3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this48.stackVec3[i10]; + _this48.stackVec3[i10] = null; + } + _this48.stackVec3 = newArray10; + } + _this48.stackVec3[_this48.sizeVec3++] = _this28; + } + var _this49 = this.p; + if(o != null) { + o.zero(); + if(_this49.sizeVec3 == _this49.stackVec3.length) { + var newArray11 = new Array(_this49.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this49.sizeVec3; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this49.stackVec3[i11]; + _this49.stackVec3[i11] = null; + } + _this49.stackVec3 = newArray11; + } + _this49.stackVec3[_this49.sizeVec3++] = o; + } + var _this50 = this.p; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this50.sizeMat3 == _this50.stackMat3.length) { + var newArray12 = new Array(_this50.sizeMat3 << 1); + var _g22 = 0; + var _g112 = _this50.sizeMat3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this50.stackMat3[i12]; + _this50.stackMat3[i12] = null; + } + _this50.stackMat3 = newArray12; + } + _this50.stackMat3[_this50.sizeMat3++] = m; + } + var _this51 = this.p; + if(ex != null) { + ex.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newArray13 = new Array(_this51.sizeVec3 << 1); + var _g23 = 0; + var _g113 = _this51.sizeVec3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this51.stackVec3[i13]; + _this51.stackVec3[i13] = null; + } + _this51.stackVec3 = newArray13; + } + _this51.stackVec3[_this51.sizeVec3++] = ex; + } + var _this52 = this.p; + if(ey != null) { + ey.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newArray14 = new Array(_this52.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this52.sizeVec3; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this52.stackVec3[i14]; + _this52.stackVec3[i14] = null; + } + _this52.stackVec3 = newArray14; + } + _this52.stackVec3[_this52.sizeVec3++] = ey; + } + var _this53 = this.p; + if(ez != null) { + ez.zero(); + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newArray15 = new Array(_this53.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this53.sizeVec3; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this53.stackVec3[i15]; + _this53.stackVec3[i15] = null; + } + _this53.stackVec3 = newArray15; + } + _this53.stackVec3[_this53.sizeVec3++] = ez; + } + } + ,rect: function(v1,v2,v3,v4,n1,n2,n3,n4,color) { + this.triangle(v1,v2,v3,n1,n2,n3,color); + this.triangle(v1,v3,v4,n1,n3,n4,color); + } + ,point: function(v,color) { + } + ,triangle: function(v1,v2,v3,n1,n2,n3,color) { + } + ,line: function(v1,v2,color) { + } + ,__class__: oimo_dynamics_common_DebugDraw +}; +var demo_js_WebGLDebugGraphics = function(gl) { + oimo_dynamics_common_DebugDraw.call(this); + this.gl = gl; + gl.enable(2929); + this.cameraPos = new oimo_common_Vec3(); + this.lightDir = new oimo_common_Vec3(); + this.viewMat = new oimo_common_Mat4(); + this.projMat = new oimo_common_Mat4(); + this.tmpMat = new oimo_common_Mat4(); + this.initShader(); + this.initBuffers(); +}; +demo_js_WebGLDebugGraphics.__name__ = true; +demo_js_WebGLDebugGraphics.__interfaces__ = [demo_common_IDemoGraphics]; +demo_js_WebGLDebugGraphics.__super__ = oimo_dynamics_common_DebugDraw; +demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.prototype,{ + initBuffers: function() { + var attribs = [new demo_js_minilib_OVertexAttribute(3,"aPosition"),new demo_js_minilib_OVertexAttribute(3,"aNormal"),new demo_js_minilib_OVertexAttribute(3,"aColor")]; + this.pointVBO = new demo_js_minilib_OVertexBuffer(this.gl); + this.pointIBO = new demo_js_minilib_OIndexBuffer(this.gl); + this.pointVBO.setAttribs(attribs); + this.pointVBO.loadAttribIndices(this.shader); + this.lineVBO = new demo_js_minilib_OVertexBuffer(this.gl); + this.lineIBO = new demo_js_minilib_OIndexBuffer(this.gl); + this.lineVBO.setAttribs(attribs); + this.lineVBO.loadAttribIndices(this.shader); + this.triVBO = new demo_js_minilib_OVertexBuffer(this.gl); + this.triIBO = new demo_js_minilib_OIndexBuffer(this.gl); + this.triVBO.setAttribs(attribs); + this.triVBO.loadAttribIndices(this.shader); + this.pointBufferSize = 4096; + this.lineBufferSize = 4096; + this.triBufferSize = 4096; + this.pointData = new Float32Array(this.pointBufferSize * 9); + this.lineData = new Float32Array(this.lineBufferSize * 9 * 2); + this.triData = new Float32Array(this.triBufferSize * 9 * 3); + this.initFloatArray(this.pointData); + this.initFloatArray(this.lineData); + this.initFloatArray(this.triData); + var vbo = []; + var ibo = []; + var _g = 0; + var _g1 = this.pointBufferSize; + while(_g < _g1) { + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + ibo.push(_g++); + } + this.pointVBO.setData(vbo,35048); + this.pointIBO.setData(ibo,35048); + vbo = []; + ibo = []; + var _g2 = 0; + var _g3 = this.lineBufferSize; + while(_g2 < _g3) { + var i = _g2++; + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + ibo.push(i * 2); + ibo.push(i * 2 + 1); + } + this.lineVBO.setData(vbo,35048); + this.lineIBO.setData(ibo,35048); + vbo = []; + ibo = []; + var _g4 = 0; + var _g5 = this.triBufferSize; + while(_g4 < _g5) { + var i1 = _g4++; + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + vbo.push(0); + ibo.push(i1 * 3); + ibo.push(i1 * 3 + 1); + ibo.push(i1 * 3 + 2); + } + this.triVBO.setData(vbo,35048); + this.triIBO.setData(ibo,35048); + } + ,initFloatArray: function(a) { + var num = a.length; + var _g = 0; + while(_g < num) a[_g++] = 0; + } + ,initShader: function() { + this.shader = new demo_js_minilib_OShader(this.gl); + this.shader.compile("\r\n\t\t\tprecision highp float;\r\n\t\t\tattribute vec3 aPosition;\r\n\t\t\tattribute vec3 aColor;\r\n\t\t\tattribute vec3 aNormal;\r\n\t\t\tvarying vec3 vPosition;\r\n\t\t\tvarying vec3 vNormal;\r\n\t\t\tvarying vec3 vColor;\r\n\t\t\tuniform mat4 worldMat;\r\n\t\t\tuniform mat4 viewMat;\r\n\t\t\tuniform mat4 projMat;\r\n\r\n\t\t\tvoid main() {\r\n\t\t\t\tvec4 worldPos = worldMat * vec4(aPosition, 1.0);\r\n\t\t\t\tvPosition = worldPos.xyz;\r\n\t\t\t\tvColor = aColor;\r\n\t\t\t\tvNormal = aNormal;\r\n\t\t\t\tgl_Position = projMat * (viewMat * worldPos);\r\n\t\t\t\tgl_PointSize = 6.0;\r\n\t\t\t}\r\n\t\t","\r\n\t\t\tprecision highp float;\r\n\t\t\tvarying vec3 vPosition;\r\n\t\t\tvarying vec3 vNormal;\r\n\t\t\tvarying vec3 vColor;\r\n\t\t\tuniform vec3 lightDir;\r\n\t\t\tuniform vec3 lightCol;\r\n\t\t\tuniform vec3 cameraPos;\r\n\t\t\tuniform float ambient;\r\n\t\t\tuniform float diffuse;\r\n\t\t\tuniform float specular;\r\n\t\t\tuniform float shininess;\r\n\r\n\t\t\tvoid main() {\r\n\t\t\t\tvec3 normal = length(vNormal) > 0.0 ? normalize(vNormal) : vec3(0.0, 0.0, 0.0);\r\n\t\t\t\tvec3 dir = normalize(lightDir);\r\n\t\t\t\tfloat d = -dot(dir, normal);\r\n\t\t\t\tfloat brightness = max(0.0, d) * diffuse;\r\n\t\t\t\tvec3 eye = normalize(vPosition - cameraPos);\r\n\t\t\t\tvec3 pixColor = vColor * min(1.0, ambient + diffuse * brightness);\r\n\t\t\t\tif (d > 0.0) {\r\n\t\t\t\t\td = -dot(dir, reflect(eye, normal));\r\n\t\t\t\t\tpixColor += lightCol * specular * pow(max(0.0, d), shininess);\r\n\t\t\t\t}\r\n\t\t\t\tgl_FragColor = vec4(pixColor, 1.0);\r\n\t\t\t}\r\n\t\t"); + } + ,setViewMatrix: function(matrix) { + var _this = this.viewMat; + _this.e00 = matrix.e00; + _this.e01 = matrix.e01; + _this.e02 = matrix.e02; + _this.e03 = matrix.e03; + _this.e10 = matrix.e10; + _this.e11 = matrix.e11; + _this.e12 = matrix.e12; + _this.e13 = matrix.e13; + _this.e20 = matrix.e20; + _this.e21 = matrix.e21; + _this.e22 = matrix.e22; + _this.e23 = matrix.e23; + _this.e30 = matrix.e30; + _this.e31 = matrix.e31; + _this.e32 = matrix.e32; + _this.e33 = matrix.e33; + var d01_01 = _this.e00 * _this.e11 - _this.e01 * _this.e10; + var d01_02 = _this.e00 * _this.e12 - _this.e02 * _this.e10; + var d01_03 = _this.e00 * _this.e13 - _this.e03 * _this.e10; + var d01_12 = _this.e01 * _this.e12 - _this.e02 * _this.e11; + var d01_13 = _this.e01 * _this.e13 - _this.e03 * _this.e11; + var d01_23 = _this.e02 * _this.e13 - _this.e03 * _this.e12; + var d23_01 = _this.e20 * _this.e31 - _this.e21 * _this.e30; + var d23_02 = _this.e20 * _this.e32 - _this.e22 * _this.e30; + var d23_03 = _this.e20 * _this.e33 - _this.e23 * _this.e30; + var d23_12 = _this.e21 * _this.e32 - _this.e22 * _this.e31; + var d23_13 = _this.e21 * _this.e33 - _this.e23 * _this.e31; + var d23_23 = _this.e22 * _this.e33 - _this.e23 * _this.e32; + var d00 = _this.e11 * d23_23 - _this.e12 * d23_13 + _this.e13 * d23_12; + var d01 = _this.e10 * d23_23 - _this.e12 * d23_03 + _this.e13 * d23_02; + var d02 = _this.e10 * d23_13 - _this.e11 * d23_03 + _this.e13 * d23_01; + var d03 = _this.e10 * d23_12 - _this.e11 * d23_02 + _this.e12 * d23_01; + var d11 = _this.e00 * d23_23 - _this.e02 * d23_03 + _this.e03 * d23_02; + var d12 = _this.e00 * d23_13 - _this.e01 * d23_03 + _this.e03 * d23_01; + var d13 = _this.e00 * d23_12 - _this.e01 * d23_02 + _this.e02 * d23_01; + var d23 = _this.e30 * d01_12 - _this.e31 * d01_02 + _this.e32 * d01_01; + var d32 = _this.e20 * d01_13 - _this.e21 * d01_03 + _this.e23 * d01_01; + var d33 = _this.e20 * d01_12 - _this.e21 * d01_02 + _this.e22 * d01_01; + var invDet = _this.e00 * d00 - _this.e01 * d01 + _this.e02 * d02 - _this.e03 * d03; + if(invDet != 0) { + invDet = 1 / invDet; + } + _this.e00 = d00 * invDet; + _this.e01 = -(_this.e01 * d23_23 - _this.e02 * d23_13 + _this.e03 * d23_12) * invDet; + _this.e02 = (_this.e31 * d01_23 - _this.e32 * d01_13 + _this.e33 * d01_12) * invDet; + _this.e03 = -(_this.e21 * d01_23 - _this.e22 * d01_13 + _this.e23 * d01_12) * invDet; + _this.e10 = -d01 * invDet; + _this.e11 = d11 * invDet; + _this.e12 = -(_this.e30 * d01_23 - _this.e32 * d01_03 + _this.e33 * d01_02) * invDet; + _this.e13 = (_this.e20 * d01_23 - _this.e22 * d01_03 + _this.e23 * d01_02) * invDet; + _this.e20 = d02 * invDet; + _this.e21 = -d12 * invDet; + _this.e22 = (_this.e30 * d01_13 - _this.e31 * d01_03 + _this.e33 * d01_01) * invDet; + _this.e23 = -d32 * invDet; + _this.e30 = -d03 * invDet; + _this.e31 = d13 * invDet; + _this.e32 = -d23 * invDet; + _this.e33 = d33 * invDet; + this.cameraPos.init(this.viewMat.e03,this.viewMat.e13,this.viewMat.e23); + var _this1 = this.lightDir.init(this.viewMat.e02,this.viewMat.e12,this.viewMat.e22); + _this1.x *= -1; + _this1.y *= -1; + _this1.z *= -1; + var _this2 = this.viewMat; + _this2.e00 = matrix.e00; + _this2.e01 = matrix.e01; + _this2.e02 = matrix.e02; + _this2.e03 = matrix.e03; + _this2.e10 = matrix.e10; + _this2.e11 = matrix.e11; + _this2.e12 = matrix.e12; + _this2.e13 = matrix.e13; + _this2.e20 = matrix.e20; + _this2.e21 = matrix.e21; + _this2.e22 = matrix.e22; + _this2.e23 = matrix.e23; + _this2.e30 = matrix.e30; + _this2.e31 = matrix.e31; + _this2.e32 = matrix.e32; + _this2.e33 = matrix.e33; + } + ,setProjectionMatrix: function(matrix) { + var _this = this.projMat; + _this.e00 = matrix.e00; + _this.e01 = matrix.e01; + _this.e02 = matrix.e02; + _this.e03 = matrix.e03; + _this.e10 = matrix.e10; + _this.e11 = matrix.e11; + _this.e12 = matrix.e12; + _this.e13 = matrix.e13; + _this.e20 = matrix.e20; + _this.e21 = matrix.e21; + _this.e22 = matrix.e22; + _this.e23 = matrix.e23; + _this.e30 = matrix.e30; + _this.e31 = matrix.e31; + _this.e32 = matrix.e32; + _this.e33 = matrix.e33; + } + ,begin: function(color) { + this.gl.clearColor(color.x,color.y,color.z,1); + this.gl.enable(2884); + this.gl.clearDepth(1); + this.gl.clear(16640); + this.gl.lineWidth(2.0); + this.shader.use(); + var matrix = this.viewMat; + this.gl.uniformMatrix4fv(this.shader.getUniformLocation("viewMat"),false,[matrix.e00,matrix.e10,matrix.e20,matrix.e30,matrix.e01,matrix.e11,matrix.e21,matrix.e31,matrix.e02,matrix.e12,matrix.e22,matrix.e32,matrix.e03,matrix.e13,matrix.e23,matrix.e33]); + var matrix1 = this.projMat; + this.gl.uniformMatrix4fv(this.shader.getUniformLocation("projMat"),false,[matrix1.e00,matrix1.e10,matrix1.e20,matrix1.e30,matrix1.e01,matrix1.e11,matrix1.e21,matrix1.e31,matrix1.e02,matrix1.e12,matrix1.e22,matrix1.e32,matrix1.e03,matrix1.e13,matrix1.e23,matrix1.e33]); + var v = this.cameraPos; + this.gl.uniform3f(this.shader.getUniformLocation("cameraPos"),v.x,v.y,v.z); + var v1 = this.lightDir; + this.gl.uniform3f(this.shader.getUniformLocation("lightDir"),v1.x,v1.y,v1.z); + this.gl.uniform3f(this.shader.getUniformLocation("lightCol"),1,1,1); + var _this = this.tmpMat; + _this.e00 = 1; + _this.e01 = 0; + _this.e02 = 0; + _this.e03 = 0; + _this.e10 = 0; + _this.e11 = 1; + _this.e12 = 0; + _this.e13 = 0; + _this.e20 = 0; + _this.e21 = 0; + _this.e22 = 1; + _this.e23 = 0; + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; + var matrix2 = this.tmpMat; + this.gl.uniformMatrix4fv(this.shader.getUniformLocation("worldMat"),false,[matrix2.e00,matrix2.e10,matrix2.e20,matrix2.e30,matrix2.e01,matrix2.e11,matrix2.e21,matrix2.e31,matrix2.e02,matrix2.e12,matrix2.e22,matrix2.e32,matrix2.e03,matrix2.e13,matrix2.e23,matrix2.e33]); + this.numPointData = 0; + this.numLineData = 0; + this.numTriData = 0; + } + ,end: function() { + this.colorModeWireframe(); + if(this.numPointData > 0) { + this.pointVBO.updateDataFloat32Array(this.pointData); + this.pointVBO.bindAttribs(); + this.pointIBO.draw(0,this.numPointData); + this.numPointData = 0; + } + if(this.numLineData > 0) { + this.lineVBO.updateDataFloat32Array(this.lineData); + this.lineVBO.bindAttribs(); + this.lineIBO.draw(1,this.numLineData * 2); + this.numLineData = 0; + } + this.colorModeSolid(); + if(this.numTriData > 0) { + this.triVBO.updateDataFloat32Array(this.triData); + this.triVBO.bindAttribs(); + this.triIBO.draw(4,this.numTriData * 3); + this.numTriData = 0; + } + this.gl.flush(); + } + ,getDebugDraw: function() { + return this; + } + ,point: function(v,color) { + var idx = this.numPointData * 9; + var data = this.pointData; + data[idx++] = v.x; + data[idx++] = v.y; + data[idx++] = v.z; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + this.numPointData++; + if(this.numPointData == this.pointBufferSize) { + this.colorModeWireframe(); + this.pointVBO.updateDataFloat32Array(this.pointData); + this.pointVBO.bindAttribs(); + this.pointIBO.draw(0); + this.numPointData = 0; + } + } + ,line: function(v1,v2,color) { + var idx = this.numLineData * 18; + var data = this.lineData; + data[idx++] = v1.x; + data[idx++] = v1.y; + data[idx++] = v1.z; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + data[idx++] = v2.x; + data[idx++] = v2.y; + data[idx++] = v2.z; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = 0; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + this.numLineData++; + if(this.numLineData == this.lineBufferSize) { + this.colorModeWireframe(); + this.lineVBO.updateDataFloat32Array(this.lineData); + this.lineVBO.bindAttribs(); + this.lineIBO.draw(1); + this.numLineData = 0; + } + } + ,triangle: function(v1,v2,v3,n1,n2,n3,color) { + var idx = this.numTriData * 27; + var data = this.triData; + data[idx++] = v1.x; + data[idx++] = v1.y; + data[idx++] = v1.z; + data[idx++] = n1.x; + data[idx++] = n1.y; + data[idx++] = n1.z; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + data[idx++] = v2.x; + data[idx++] = v2.y; + data[idx++] = v2.z; + data[idx++] = n2.x; + data[idx++] = n2.y; + data[idx++] = n2.z; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + data[idx++] = v3.x; + data[idx++] = v3.y; + data[idx++] = v3.z; + data[idx++] = n3.x; + data[idx++] = n3.y; + data[idx++] = n3.z; + data[idx++] = color.x; + data[idx++] = color.y; + data[idx++] = color.z; + this.numTriData++; + if(this.numTriData == this.triBufferSize) { + this.colorModeSolid(); + this.triVBO.updateDataFloat32Array(this.triData); + this.triVBO.bindAttribs(); + this.triIBO.draw(4); + this.numTriData = 0; + } + } + ,colorModeSolid: function() { + this.gl.uniform1f(this.shader.getUniformLocation("ambient"),0.2); + this.gl.uniform1f(this.shader.getUniformLocation("diffuse"),0.8); + this.gl.uniform1f(this.shader.getUniformLocation("specular"),0.8); + this.gl.uniform1f(this.shader.getUniformLocation("shininess"),20); + } + ,colorModeWireframe: function() { + this.gl.uniform1f(this.shader.getUniformLocation("ambient"),1); + this.gl.uniform1f(this.shader.getUniformLocation("diffuse"),0); + this.gl.uniform1f(this.shader.getUniformLocation("specular"),0); + this.gl.uniform1f(this.shader.getUniformLocation("shininess"),1); + } + ,__class__: demo_js_WebGLDebugGraphics +}); +var demo_js_minilib_OIndexBuffer = function(gl) { + this.gl = gl; + this.buffer = gl.createBuffer(); +}; +demo_js_minilib_OIndexBuffer.__name__ = true; +demo_js_minilib_OIndexBuffer.prototype = { + setData: function(array,usage) { + if(usage == null) { + usage = 35044; + } + this.gl.bindBuffer(34963,this.buffer); + this.gl.bufferData(34963,new Int16Array(array),usage); + this.gl.bindBuffer(34963,null); + this.count = array.length; + } + ,updateData: function(array,usage) { + if(usage == null) { + usage = 35044; + } + this.gl.bindBuffer(34963,this.buffer); + this.gl.bufferSubData(34963,0,new Int16Array(array)); + this.gl.bindBuffer(34963,null); + } + ,updateDataInt16Array: function(array) { + this.gl.bindBuffer(34963,this.buffer); + this.gl.bufferSubData(34963,0,array); + this.gl.bindBuffer(34963,null); + } + ,draw: function(mode,count) { + if(count == null) { + count = -1; + } + if(mode == null) { + mode = 4; + } + this.gl.bindBuffer(34963,this.buffer); + this.gl.drawElements(mode,count >= 0 ? count : this.count,5123,0); + } + ,__class__: demo_js_minilib_OIndexBuffer +}; +var demo_js_minilib_OInput = function() { + this.ptouchX = 0; + this.ptouchY = 0; + this.touchX = 0; + this.touchY = 0; + this.dtouchX = 0; + this.dtouchY = 0; + this._ntouchX = 0; + this._ntouchY = 0; + this.ptouch = false; + this.touch = false; + this._ntouch = false; + this.dtouch = 0; + this.pmouseX = 0; + this.pmouseY = 0; + this.mouseX = 0; + this.mouseY = 0; + this.dmouseX = 0; + this.dmouseY = 0; + this._nmouseX = 0; + this._nmouseY = 0; + this.pmouseL = false; + this.pmouseR = false; + this.mouseL = false; + this.mouseR = false; + this.dmouseL = 0; + this.dmouseR = 0; + this._nmouseL = false; + this._nmouseR = false; +}; +demo_js_minilib_OInput.__name__ = true; +demo_js_minilib_OInput.prototype = { + _update: function() { + this.ptouchX = this.touchX; + this.ptouchY = this.touchY; + this.touchX = this._ntouchX; + this.touchY = this._ntouchY; + this.dtouchX = this.touchX - this.ptouchX; + this.dtouchY = this.touchY - this.ptouchY; + this.ptouch = this.touch; + this.touch = this._ntouch; + this.dtouch = (this.touch ? 1 : 0) - (this.ptouch ? 1 : 0); + if(this.dtouch == 1) { + this.ptouchX = this.touchX; + this.ptouchY = this.touchY; + } + this.pmouseX = this.mouseX; + this.pmouseY = this.mouseY; + this.mouseX = this._nmouseX; + this.mouseY = this._nmouseY; + this.dmouseX = this.mouseX - this.pmouseX; + this.dmouseY = this.mouseY - this.pmouseY; + this.pmouseL = this.mouseL; + this.pmouseR = this.mouseR; + this.mouseL = this._nmouseL; + this.mouseR = this._nmouseR; + this.dmouseL = (this.mouseL ? 1 : 0) - (this.pmouseL ? 1 : 0); + this.dmouseR = (this.mouseR ? 1 : 0) - (this.pmouseR ? 1 : 0); + } + ,__class__: demo_js_minilib_OInput +}; +var demo_js_minilib_OShader = function(gl) { + this.gl = gl; + this.program = gl.createProgram(); + this.vertexShader = gl.createShader(35633); + this.fragmentShader = gl.createShader(35632); +}; +demo_js_minilib_OShader.__name__ = true; +demo_js_minilib_OShader.prototype = { + compile: function(vertexSource,fragmentSource) { + this.uniformLocationMap = new haxe_ds_StringMap(); + this.compileShader(this.vertexShader,vertexSource); + this.compileShader(this.fragmentShader,fragmentSource); + this.gl.attachShader(this.program,this.vertexShader); + this.gl.attachShader(this.program,this.fragmentShader); + this.gl.linkProgram(this.program); + if(!this.gl.getProgramParameter(this.program,35714)) { + console.log("demos/src/demo/js/minilib/OShader.hx:27:",this.gl.getProgramInfoLog(this.program)); + } + } + ,getAttribIndex: function(name) { + return this.gl.getAttribLocation(this.program,name); + } + ,getUniformLocation: function(name) { + var _this = this.uniformLocationMap; + if(__map_reserved[name] != null ? _this.existsReserved(name) : _this.h.hasOwnProperty(name)) { + var _this1 = this.uniformLocationMap; + if(__map_reserved[name] != null) { + return _this1.getReserved(name); + } else { + return _this1.h[name]; + } + } + var location = this.gl.getUniformLocation(this.program,name); + var _this2 = this.uniformLocationMap; + if(__map_reserved[name] != null) { + _this2.setReserved(name,location); + } else { + _this2.h[name] = location; + } + return location; + } + ,getAttribIndices: function(attribs) { + var indices = []; + var _g = 0; + while(_g < attribs.length) indices.push(this.getAttribIndex(attribs[_g++].name)); + return indices; + } + ,use: function() { + this.gl.useProgram(this.program); + } + ,compileShader: function(shader,source) { + this.gl.shaderSource(shader,source); + this.gl.compileShader(shader); + if(!this.gl.getShaderParameter(shader,35713)) { + window.alert(Std.string(this.gl.getShaderInfoLog(shader))); + } + } + ,__class__: demo_js_minilib_OShader +}; +var demo_js_minilib_OTimer = function(targetFPS,targetFunction) { + this.targetFPS = targetFPS; + this.targetFunction = targetFunction; + this.running = false; +}; +demo_js_minilib_OTimer.__name__ = true; +demo_js_minilib_OTimer.prototype = { + run: function() { + this.running = true; + this.expectedNextTime = new Date().getTime(); + this.loop(); + } + ,stop: function() { + this.running = false; + } + ,loop: function() { + this.targetFunction(); + var en = new Date().getTime(); + var sleep = this.expectedNextTime + 1000.0 / this.targetFPS - en; + if(sleep < 3) { + sleep = 3; + } + this.expectedNextTime = en + sleep; + if(this.running) { + window.setTimeout($bind(this,this.loop),sleep + 0.5 | 0); + } + } + ,time: function() { + return new Date().getTime(); + } + ,__class__: demo_js_minilib_OTimer +}; +var demo_js_minilib_OVertexAttribute = function(float32Count,name) { + this.float32Count = float32Count; + this.name = name; +}; +demo_js_minilib_OVertexAttribute.__name__ = true; +demo_js_minilib_OVertexAttribute.prototype = { + __class__: demo_js_minilib_OVertexAttribute +}; +var demo_js_minilib_OVertexBuffer = function(gl) { + this.gl = gl; + this.buffer = gl.createBuffer(); +}; +demo_js_minilib_OVertexBuffer.__name__ = true; +demo_js_minilib_OVertexBuffer.prototype = { + setData: function(array,usage) { + if(usage == null) { + usage = 35044; + } + if(this.attribs == null) { + throw new js__$Boot_HaxeError("set attributes first"); + } + this.numVertices = array.length / (this.stride / 4); + this.gl.bindBuffer(34962,this.buffer); + this.gl.bufferData(34962,new Float32Array(array),usage); + this.gl.bindBuffer(34962,null); + } + ,updateData: function(array) { + this.gl.bindBuffer(34962,this.buffer); + this.gl.bufferSubData(34962,0,new Float32Array(array)); + this.gl.bindBuffer(34962,null); + } + ,updateDataFloat32Array: function(array) { + this.gl.bindBuffer(34962,this.buffer); + this.gl.bufferSubData(34962,0,array); + this.gl.bindBuffer(34962,null); + } + ,setAttribs: function(attribs) { + this.attribs = attribs; + this.offsets = []; + this.stride = 0; + var num = attribs.length; + var _g = 0; + while(_g < num) { + this.offsets.push(this.stride); + this.stride += attribs[_g++].float32Count * 4; + } + } + ,loadAttribIndices: function(program) { + this.indices = program.getAttribIndices(this.attribs); + } + ,bindAttribs: function() { + if(this.indices == null) { + throw new js__$Boot_HaxeError("indices are not loaded"); + } + var num = this.attribs.length; + this.gl.bindBuffer(34962,this.buffer); + var _g = 0; + while(_g < num) { + var i = _g++; + this.gl.enableVertexAttribArray(this.indices[i]); + this.gl.vertexAttribPointer(this.indices[i],this.attribs[i].float32Count,5126,false,this.stride,this.offsets[i]); + } + this.gl.bindBuffer(34962,null); + } + ,__class__: demo_js_minilib_OVertexBuffer +}; +var haxe_IMap = function() { }; +haxe_IMap.__name__ = true; +haxe_IMap.__isInterface__ = true; +var haxe_ds_StringMap = function() { + this.h = { }; +}; +haxe_ds_StringMap.__name__ = true; +haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; +haxe_ds_StringMap.prototype = { + setReserved: function(key,value) { + if(this.rh == null) { + this.rh = { }; + } + this.rh["$" + key] = value; + } + ,getReserved: function(key) { + if(this.rh == null) { + return null; + } else { + return this.rh["$" + key]; + } + } + ,existsReserved: function(key) { + if(this.rh == null) { + return false; + } + return this.rh.hasOwnProperty("$" + key); + } + ,__class__: haxe_ds_StringMap +}; +var js__$Boot_HaxeError = function(val) { + Error.call(this); + this.val = val; + if(Error.captureStackTrace) { + Error.captureStackTrace(this,js__$Boot_HaxeError); + } +}; +js__$Boot_HaxeError.__name__ = true; +js__$Boot_HaxeError.__super__ = Error; +js__$Boot_HaxeError.prototype = $extend(Error.prototype,{ + __class__: js__$Boot_HaxeError +}); +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.getClass = function(o) { + if(o == null) { + return null; + } else if(((o) instanceof Array)) { + return Array; + } else { + var cl = o.__class__; + if(cl != null) { + return cl; + } + var name = js_Boot.__nativeClassName(o); + if(name != null) { + return js_Boot.__resolveNativeClass(name); + } + return null; + } +}; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g3 = 0; + var _g11 = o.length; + while(_g3 < _g11) { + var i = _g3++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( e1 ) { + var e2 = ((e1) instanceof js__$Boot_HaxeError) ? e1.val : e1; + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str1 = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str1.length != 2) { + str1 += ", \n"; + } + str1 += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str1 += "\n" + s + "}"; + return str1; + case "string": + return o; + default: + return String(o); + } +}; +js_Boot.__interfLoop = function(cc,cl) { + if(cc == null) { + return false; + } + if(cc == cl) { + return true; + } + if(Object.prototype.hasOwnProperty.call(cc,"__interfaces__")) { + var intf = cc.__interfaces__; + var _g = 0; + var _g1 = intf.length; + while(_g < _g1) { + var i = intf[_g++]; + if(i == cl || js_Boot.__interfLoop(i,cl)) { + return true; + } + } + } + return js_Boot.__interfLoop(cc.__super__,cl); +}; +js_Boot.__instanceof = function(o,cl) { + if(cl == null) { + return false; + } + switch(cl) { + case Array: + return ((o) instanceof Array); + case Bool: + return typeof(o) == "boolean"; + case Dynamic: + return o != null; + case Float: + return typeof(o) == "number"; + case Int: + if(typeof(o) == "number") { + return ((o | 0) === o); + } else { + return false; + } + break; + case String: + return typeof(o) == "string"; + default: + if(o != null) { + if(typeof(cl) == "function") { + if(js_Boot.__downcastCheck(o,cl)) { + return true; + } + } else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) { + if(((o) instanceof cl)) { + return true; + } + } + } else { + return false; + } + if(cl == Class ? o.__name__ != null : false) { + return true; + } + if(cl == Enum ? o.__ename__ != null : false) { + return true; + } + return false; + } +}; +js_Boot.__downcastCheck = function(o,cl) { + if(!((o) instanceof cl)) { + if(cl.__isInterface__) { + return js_Boot.__interfLoop(js_Boot.getClass(o),cl); + } else { + return false; + } + } else { + return true; + } +}; +js_Boot.__cast = function(o,t) { + if(o == null || js_Boot.__instanceof(o,t)) { + return o; + } else { + throw new js__$Boot_HaxeError("Cannot cast " + Std.string(o) + " to " + Std.string(t)); + } +}; +js_Boot.__nativeClassName = function(o) { + var name = js_Boot.__toStr.call(o).slice(8,-1); + if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") { + return null; + } + return name; +}; +js_Boot.__isNativeObj = function(o) { + return js_Boot.__nativeClassName(o) != null; +}; +js_Boot.__resolveNativeClass = function(name) { + return $global[name]; +}; +var js_html__$CanvasElement_CanvasUtil = function() { }; +js_html__$CanvasElement_CanvasUtil.__name__ = true; +js_html__$CanvasElement_CanvasUtil.getContextWebGL = function(canvas,attribs) { + var ctx = canvas.getContext("webgl",attribs); + if(ctx != null) { + return ctx; + } + var ctx1 = canvas.getContext("experimental-webgl",attribs); + if(ctx1 != null) { + return ctx1; + } + return null; +}; +var oimo_collision_broadphase_BroadPhase = function(type) { + this._type = type; + this._numProxies = 0; + this._proxyList = null; + this._proxyListLast = null; + this._proxyPairList = null; + this._incremental = false; + this._testCount = 0; + this._proxyPairPool = null; + this._idCount = 0; + this._convexSweep = new oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry(); + this._aabb = new oimo_collision_broadphase__$BroadPhase_AabbGeometry(); + this.identity = new oimo_common_Transform(); + this.zero = new oimo_common_Vec3(); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); +}; +oimo_collision_broadphase_BroadPhase.__name__ = true; +oimo_collision_broadphase_BroadPhase.prototype = { + createProxy: function(userData,aabb) { + return null; + } + ,destroyProxy: function(proxy) { + } + ,moveProxy: function(proxy,aabb,displacement) { + } + ,isOverlapping: function(proxy1,proxy2) { + if(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ) { + return proxy1._aabbMaxZ > proxy2._aabbMinZ; + } else { + return false; + } + } + ,collectPairs: function() { + } + ,getProxyPairList: function() { + return this._proxyPairList; + } + ,isIncremental: function() { + return this._incremental; + } + ,getTestCount: function() { + return this._testCount; + } + ,rayCast: function(begin,end,callback) { + } + ,convexCast: function(convex,begin,translation,callback) { + } + ,aabbTest: function(aabb,callback) { + } + ,__class__: oimo_collision_broadphase_BroadPhase +}; +var oimo_collision_geometry_Geometry = function(type) { + this._type = type; + this._volume = 0; +}; +oimo_collision_geometry_Geometry.__name__ = true; +oimo_collision_geometry_Geometry.prototype = { + _updateMass: function() { + } + ,_computeAabb: function(aabb,tf) { + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + return false; + } + ,getType: function() { + return this._type; + } + ,getVolume: function() { + return this._volume; + } + ,rayCast: function(begin,end,transform,hit) { + var beginLocalX; + var beginLocalY; + var beginLocalZ; + var endLocalX; + var endLocalY; + var endLocalZ; + beginLocalX = begin.x; + beginLocalY = begin.y; + beginLocalZ = begin.z; + endLocalX = end.x; + endLocalY = end.y; + endLocalZ = end.z; + beginLocalX -= transform._positionX; + beginLocalY -= transform._positionY; + beginLocalZ -= transform._positionZ; + endLocalX -= transform._positionX; + endLocalY -= transform._positionY; + endLocalZ -= transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * beginLocalX + transform._rotation10 * beginLocalY + transform._rotation20 * beginLocalZ; + __tmp__Y = transform._rotation01 * beginLocalX + transform._rotation11 * beginLocalY + transform._rotation21 * beginLocalZ; + __tmp__Z = transform._rotation02 * beginLocalX + transform._rotation12 * beginLocalY + transform._rotation22 * beginLocalZ; + beginLocalX = __tmp__X; + beginLocalY = __tmp__Y; + beginLocalZ = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; + __tmp__Y1 = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; + __tmp__Z1 = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; + endLocalX = __tmp__X1; + endLocalY = __tmp__Y1; + endLocalZ = __tmp__Z1; + if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { + var localPosX; + var localPosY; + var localPosZ; + var localNormalX; + var localNormalY; + var localNormalZ; + var v = hit.position; + localPosX = v.x; + localPosY = v.y; + localPosZ = v.z; + var v1 = hit.normal; + localNormalX = v1.x; + localNormalY = v1.y; + localNormalZ = v1.z; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; + __tmp__Y2 = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; + __tmp__Z2 = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; + localPosX = __tmp__X2; + localPosY = __tmp__Y2; + localPosZ = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; + __tmp__Y3 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; + __tmp__Z3 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; + localNormalX = __tmp__X3; + localNormalY = __tmp__Y3; + localNormalZ = __tmp__Z3; + localPosX += transform._positionX; + localPosY += transform._positionY; + localPosZ += transform._positionZ; + var v2 = hit.position; + v2.x = localPosX; + v2.y = localPosY; + v2.z = localPosZ; + var v3 = hit.normal; + v3.x = localNormalX; + v3.y = localNormalY; + v3.z = localNormalZ; + return true; + } + return false; + } + ,__class__: oimo_collision_geometry_Geometry +}; +var oimo_collision_geometry_ConvexGeometry = function(type) { + oimo_collision_geometry_Geometry.call(this,type); + this._gjkMargin = oimo_common_Setting.defaultGJKMargin; + this._useGjkRayCast = false; +}; +oimo_collision_geometry_ConvexGeometry.__name__ = true; +oimo_collision_geometry_ConvexGeometry.__super__ = oimo_collision_geometry_Geometry; +oimo_collision_geometry_ConvexGeometry.prototype = $extend(oimo_collision_geometry_Geometry.prototype,{ + getGjkMergin: function() { + return this._gjkMargin; + } + ,setGjkMergin: function(gjkMergin) { + if(gjkMergin < 0) { + gjkMergin = 0; + } + this._gjkMargin = gjkMergin; + } + ,computeLocalSupportingVertex: function(dir,out) { + } + ,rayCast: function(begin,end,transform,hit) { + if(this._useGjkRayCast) { + return oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance.rayCast(this,transform,begin,end,hit); + } else { + return oimo_collision_geometry_Geometry.prototype.rayCast.call(this,begin,end,transform,hit); + } + } + ,__class__: oimo_collision_geometry_ConvexGeometry +}); +var oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry = function() { + oimo_collision_geometry_ConvexGeometry.call(this,-1); +}; +oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.__name__ = true; +oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + init: function(c,transform,translation) { + this.c = c; + var trX; + var trY; + var trZ; + trX = translation.x; + trY = translation.y; + trZ = translation.z; + var localTrX; + var localTrY; + var localTrZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * trX + transform._rotation10 * trY + transform._rotation20 * trZ; + __tmp__Y = transform._rotation01 * trX + transform._rotation11 * trY + transform._rotation21 * trZ; + __tmp__Z = transform._rotation02 * trX + transform._rotation12 * trY + transform._rotation22 * trZ; + localTrX = __tmp__X; + localTrY = __tmp__Y; + localTrZ = __tmp__Z; + this.localTranslation = new oimo_common_Vec3(); + var v = this.localTranslation; + v.x = localTrX; + v.y = localTrY; + v.z = localTrZ; + this._gjkMargin = c._gjkMargin; + } + ,computeLocalSupportingVertex: function(dir,out) { + this.c.computeLocalSupportingVertex(dir,out); + var v = this.localTranslation; + if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { + var v1 = this.localTranslation; + out.x += v1.x; + out.y += v1.y; + out.z += v1.z; + } + } + ,__class__: oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry +}); +var oimo_collision_broadphase__$BroadPhase_AabbGeometry = function() { + oimo_collision_geometry_ConvexGeometry.call(this,-1); + this.min = new oimo_common_Vec3(); + this.max = new oimo_common_Vec3(); +}; +oimo_collision_broadphase__$BroadPhase_AabbGeometry.__name__ = true; +oimo_collision_broadphase__$BroadPhase_AabbGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_broadphase__$BroadPhase_AabbGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + computeLocalSupportingVertex: function(dir,out) { + out.x = dir.x > 0 ? this.max.x : this.min.x; + out.y = dir.y > 0 ? this.max.y : this.min.y; + out.z = dir.z > 0 ? this.max.z : this.min.z; + } + ,__class__: oimo_collision_broadphase__$BroadPhase_AabbGeometry +}); +var oimo_collision_broadphase_BroadPhaseProxyCallback = function() { +}; +oimo_collision_broadphase_BroadPhaseProxyCallback.__name__ = true; +oimo_collision_broadphase_BroadPhaseProxyCallback.prototype = { + process: function(proxy) { + } + ,__class__: oimo_collision_broadphase_BroadPhaseProxyCallback +}; +var oimo_collision_broadphase_BroadPhaseType = function() { }; +oimo_collision_broadphase_BroadPhaseType.__name__ = true; +var oimo_collision_broadphase_Proxy = function(userData,id) { + this.userData = userData; + this._id = id; + this._prev = null; + this._next = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; +}; +oimo_collision_broadphase_Proxy.__name__ = true; +oimo_collision_broadphase_Proxy.prototype = { + getId: function() { + return this._id; + } + ,getFatAabb: function() { + var aabb = new oimo_collision_geometry_Aabb(); + aabb._minX = this._aabbMinX; + aabb._minY = this._aabbMinY; + aabb._minZ = this._aabbMinZ; + aabb._maxX = this._aabbMaxX; + aabb._maxY = this._aabbMaxY; + aabb._maxZ = this._aabbMaxZ; + return aabb; + } + ,getFatAabbTo: function(aabb) { + aabb._minX = this._aabbMinX; + aabb._minY = this._aabbMinY; + aabb._minZ = this._aabbMinZ; + aabb._maxX = this._aabbMaxX; + aabb._maxY = this._aabbMaxY; + aabb._maxZ = this._aabbMaxZ; + } + ,__class__: oimo_collision_broadphase_Proxy +}; +var oimo_collision_broadphase_ProxyPair = function() { + this._p1 = null; + this._p2 = null; +}; +oimo_collision_broadphase_ProxyPair.__name__ = true; +oimo_collision_broadphase_ProxyPair.prototype = { + getProxy1: function() { + return this._p1; + } + ,getProxy2: function() { + return this._p2; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_collision_broadphase_ProxyPair +}; +var oimo_collision_broadphase_bruteforce_BruteForceBroadPhase = function() { + oimo_collision_broadphase_BroadPhase.call(this,1); + this._incremental = false; +}; +oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.__name__ = true; +oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.__super__ = oimo_collision_broadphase_BroadPhase; +oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oimo_collision_broadphase_BroadPhase.prototype,{ + createProxy: function(userData,aabb) { + var proxy = new oimo_collision_broadphase_Proxy(userData,this._idCount++); + this._numProxies++; + if(this._proxyList == null) { + this._proxyList = proxy; + this._proxyListLast = proxy; + } else { + this._proxyListLast._next = proxy; + proxy._prev = this._proxyListLast; + this._proxyListLast = proxy; + } + proxy._aabbMinX = aabb._minX; + proxy._aabbMinY = aabb._minY; + proxy._aabbMinZ = aabb._minZ; + proxy._aabbMaxX = aabb._maxX; + proxy._aabbMaxY = aabb._maxY; + proxy._aabbMaxZ = aabb._maxZ; + return proxy; + } + ,destroyProxy: function(proxy) { + this._numProxies--; + var prev = proxy._prev; + var next = proxy._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(proxy == this._proxyList) { + this._proxyList = this._proxyList._next; + } + if(proxy == this._proxyListLast) { + this._proxyListLast = this._proxyListLast._prev; + } + proxy._next = null; + proxy._prev = null; + proxy.userData = null; + } + ,moveProxy: function(proxy,aabb,dislacement) { + proxy._aabbMinX = aabb._minX; + proxy._aabbMinY = aabb._minY; + proxy._aabbMinZ = aabb._minZ; + proxy._aabbMaxX = aabb._maxX; + proxy._aabbMaxY = aabb._maxY; + proxy._aabbMaxZ = aabb._maxZ; + } + ,collectPairs: function() { + var p = this._proxyPairList; + if(p != null) { + while(true) { + p._p1 = null; + p._p2 = null; + p = p._next; + if(!(p != null)) { + break; + } + } + this._proxyPairList._next = this._proxyPairPool; + this._proxyPairPool = this._proxyPairList; + this._proxyPairList = null; + } + this._testCount = 0; + var p1 = this._proxyList; + while(p1 != null) { + var n = p1._next; + var p2 = p1._next; + while(p2 != null) { + var n1 = p2._next; + this._testCount++; + if(p1._aabbMinX < p2._aabbMaxX && p1._aabbMaxX > p2._aabbMinX && p1._aabbMinY < p2._aabbMaxY && p1._aabbMaxY > p2._aabbMinY && p1._aabbMinZ < p2._aabbMaxZ && p1._aabbMaxZ > p2._aabbMinZ) { + var first = this._proxyPairPool; + if(first != null) { + this._proxyPairPool = first._next; + first._next = null; + } else { + first = new oimo_collision_broadphase_ProxyPair(); + } + var pp = first; + if(this._proxyPairList == null) { + this._proxyPairList = pp; + } else { + pp._next = this._proxyPairList; + this._proxyPairList = pp; + } + pp._p1 = p1; + pp._p2 = p2; + } + p2 = n1; + } + p1 = n; + } + } + ,rayCast: function(begin,end,callback) { + var p1X; + var p1Y; + var p1Z; + var p2X; + var p2Y; + var p2Z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; + var p = this._proxyList; + while(p != null) { + var n = p._next; + var x1 = p1X; + var y1 = p1Y; + var z1 = p1Z; + var x2 = p2X; + var y2 = p2Y; + var z2 = p2Z; + var pminx = p._aabbMinX; + var pminy = p._aabbMinY; + var pminz = p._aabbMinZ; + var pmaxx = p._aabbMaxX; + var pmaxy = p._aabbMaxY; + var pmaxz = p._aabbMaxZ; + var tmp; + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { + tmp = false; + } else { + var dx = x2 - x1; + var dy = y2 - y1; + var dz = z2 - z1; + var adx = dx < 0 ? -dx : dx; + var ady = dy < 0 ? -dy : dy; + var adz = dz < 0 ? -dz : dz; + var pextx = (pmaxx - pminx) * 0.5; + var pexty = (pmaxy - pminy) * 0.5; + var pextz = (pmaxz - pminz) * 0.5; + var cpx = x1 - (pmaxx + pminx) * 0.5; + var cpy = y1 - (pmaxy + pminy) * 0.5; + var cpz = z1 - (pmaxz + pminz) * 0.5; + var tmp1; + var tmp2; + var x = cpy * dz - cpz * dy; + if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { + var x3 = cpz * dx - cpx * dz; + tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + } else { + tmp2 = true; + } + if(!tmp2) { + var x4 = cpx * dy - cpy * dx; + tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + } else { + tmp1 = true; + } + tmp = tmp1 ? false : true; + } + if(tmp) { + callback.process(p); + } + p = n; + } + } + ,convexCast: function(convex,begin,translation,callback) { + var p = this._proxyList; + while(p != null) { + var n = p._next; + var v = this._aabb.min; + v.x = p._aabbMinX; + v.y = p._aabbMinY; + v.z = p._aabbMinZ; + var v1 = this._aabb.max; + v1.x = p._aabbMaxX; + v1.y = p._aabbMaxY; + v1.z = p._aabbMaxZ; + this._convexSweep.init(convex,begin,translation); + var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + if(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0) { + callback.process(p); + } + p = n; + } + } + ,aabbTest: function(aabb,callback) { + var p = this._proxyList; + while(p != null) { + var n = p._next; + if(aabb._minX < p._aabbMaxX && aabb._maxX > p._aabbMinX && aabb._minY < p._aabbMaxY && aabb._maxY > p._aabbMinY && aabb._minZ < p._aabbMaxZ && aabb._maxZ > p._aabbMinZ) { + callback.process(p); + } + p = n; + } + } + ,__class__: oimo_collision_broadphase_bruteforce_BruteForceBroadPhase +}); +var oimo_collision_broadphase_bvh_BvhBroadPhase = function() { + oimo_collision_broadphase_BroadPhase.call(this,2); + this._incremental = true; + this._tree = new oimo_collision_broadphase_bvh_BvhTree(); + this.movedProxies = new Array(1024); + this.numMovedProxies = 0; +}; +oimo_collision_broadphase_bvh_BvhBroadPhase.__name__ = true; +oimo_collision_broadphase_bvh_BvhBroadPhase.__super__ = oimo_collision_broadphase_BroadPhase; +oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_broadphase_BroadPhase.prototype,{ + collide: function(n1,n2) { + this._testCount++; + var l1 = n1._height == 0; + var l2 = n2._height == 0; + if(n1 == n2) { + if(l1) { + return; + } + this.collide(n1._children[0],n2); + this.collide(n1._children[1],n2); + return; + } + if(!(n1._aabbMinX < n2._aabbMaxX && n1._aabbMaxX > n2._aabbMinX && n1._aabbMinY < n2._aabbMaxY && n1._aabbMaxY > n2._aabbMinY && n1._aabbMinZ < n2._aabbMaxZ && n1._aabbMaxZ > n2._aabbMinZ)) { + return; + } + if(l1 && l2) { + var first = this._proxyPairPool; + if(first != null) { + this._proxyPairPool = first._next; + first._next = null; + } else { + first = new oimo_collision_broadphase_ProxyPair(); + } + var pp = first; + if(this._proxyPairList == null) { + this._proxyPairList = pp; + } else { + pp._next = this._proxyPairList; + this._proxyPairList = pp; + } + pp._p1 = n1._proxy; + pp._p2 = n2._proxy; + return; + } + if(l2 || n1._height > n2._height) { + this.collide(n1._children[0],n2); + this.collide(n1._children[1],n2); + } else { + this.collide(n2._children[0],n1); + this.collide(n2._children[1],n1); + } + } + ,rayCastRecursive: function(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { + var x1 = _p1X; + var y1 = _p1Y; + var z1 = _p1Z; + var x2 = _p2X; + var y2 = _p2Y; + var z2 = _p2Z; + var pminx = node._aabbMinX; + var pminy = node._aabbMinY; + var pminz = node._aabbMinZ; + var pmaxx = node._aabbMaxX; + var pmaxy = node._aabbMaxY; + var pmaxz = node._aabbMaxZ; + var tmp; + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { + tmp = false; + } else { + var dx = x2 - x1; + var dy = y2 - y1; + var dz = z2 - z1; + var adx = dx < 0 ? -dx : dx; + var ady = dy < 0 ? -dy : dy; + var adz = dz < 0 ? -dz : dz; + var pextx = (pmaxx - pminx) * 0.5; + var pexty = (pmaxy - pminy) * 0.5; + var pextz = (pmaxz - pminz) * 0.5; + var cpx = x1 - (pmaxx + pminx) * 0.5; + var cpy = y1 - (pmaxy + pminy) * 0.5; + var cpz = z1 - (pmaxz + pminz) * 0.5; + var tmp1; + var tmp2; + var x = cpy * dz - cpz * dy; + if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { + var x3 = cpz * dx - cpx * dz; + tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + } else { + tmp2 = true; + } + if(!tmp2) { + var x4 = cpx * dy - cpy * dx; + tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + } else { + tmp1 = true; + } + tmp = tmp1 ? false : true; + } + if(!tmp) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.rayCastRecursive(node._children[0],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); + this.rayCastRecursive(node._children[1],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); + } + ,convexCastRecursive: function(node,convex,begin,translation,callback) { + var v = this._aabb.min; + v.x = node._aabbMinX; + v.y = node._aabbMinY; + v.z = node._aabbMinZ; + var v1 = this._aabb.max; + v1.x = node._aabbMaxX; + v1.y = node._aabbMaxY; + v1.z = node._aabbMaxZ; + this._convexSweep.init(convex,begin,translation); + var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + if(!(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0)) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.convexCastRecursive(node._children[0],convex,begin,translation,callback); + this.convexCastRecursive(node._children[1],convex,begin,translation,callback); + } + ,aabbTestRecursive: function(node,aabb,callback) { + if(!(node._aabbMinX < aabb._maxX && node._aabbMaxX > aabb._minX && node._aabbMinY < aabb._maxY && node._aabbMaxY > aabb._minY && node._aabbMinZ < aabb._maxZ && node._aabbMaxZ > aabb._minZ)) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.aabbTestRecursive(node._children[0],aabb,callback); + this.aabbTestRecursive(node._children[1],aabb,callback); + } + ,createProxy: function(userData,aabb) { + var p = new oimo_collision_broadphase_bvh_BvhProxy(userData,this._idCount++); + this._numProxies++; + if(this._proxyList == null) { + this._proxyList = p; + this._proxyListLast = p; + } else { + this._proxyListLast._next = p; + p._prev = this._proxyListLast; + this._proxyListLast = p; + } + p._aabbMinX = aabb._minX; + p._aabbMinY = aabb._minY; + p._aabbMinZ = aabb._minZ; + p._aabbMaxX = aabb._maxX; + p._aabbMaxY = aabb._maxY; + p._aabbMaxZ = aabb._maxZ; + var padding = oimo_common_Setting.bvhProxyPadding; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; + var _this = this._tree; + var first = _this._nodePool; + if(first != null) { + _this._nodePool = first._next; + first._next = null; + } else { + first = new oimo_collision_broadphase_bvh_BvhNode(); + } + var leaf = first; + leaf._proxy = p; + p._leaf = leaf; + leaf._aabbMinX = p._aabbMinX; + leaf._aabbMinY = p._aabbMinY; + leaf._aabbMinZ = p._aabbMinZ; + leaf._aabbMaxX = p._aabbMaxX; + leaf._aabbMaxY = p._aabbMaxY; + leaf._aabbMaxZ = p._aabbMaxZ; + _this._numLeaves++; + if(_this.leafList == null) { + _this.leafList = leaf; + _this.leafListLast = leaf; + } else { + _this.leafListLast._nextLeaf = leaf; + leaf._prevLeaf = _this.leafListLast; + _this.leafListLast = leaf; + } + if(_this._root == null) { + _this._root = leaf; + } else { + var sibling = _this._root; + while(sibling._height > 0) { + var nextStep = _this._strategy._decideInsertion(sibling,leaf); + if(nextStep == -1) { + break; + } else { + sibling = sibling._children[nextStep]; + } + } + var parent = sibling._parent; + var first1 = _this._nodePool; + if(first1 != null) { + _this._nodePool = first1._next; + first1._next = null; + } else { + first1 = new oimo_collision_broadphase_bvh_BvhNode(); + } + var node = first1; + if(parent == null) { + _this._root = node; + } else { + var index = sibling._childIndex; + parent._children[index] = node; + node._parent = parent; + node._childIndex = index; + } + var index1 = sibling._childIndex; + node._children[index1] = sibling; + sibling._parent = node; + sibling._childIndex = index1; + var index2 = sibling._childIndex ^ 1; + node._children[index2] = leaf; + leaf._parent = node; + leaf._childIndex = index2; + while(node != null) { + if(_this._strategy._balancingEnabled) { + if(node._height < 2) { + node = node; + } else { + var p1 = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var balance = l._height - r._height; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + if(ll._height > lr._height) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p1 != null) { + p1._children[nodeIndex] = l; + l._parent = p1; + l._childIndex = nodeIndex; + } else { + _this._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + if(rl._height > rr._height) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p1 != null) { + p1._children[nodeIndex] = r; + r._parent = p1; + r._childIndex = nodeIndex; + } else { + _this._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + if(!p._moved) { + p._moved = true; + if(this.movedProxies.length == this.numMovedProxies) { + var newArray = new Array(this.numMovedProxies << 1); + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.movedProxies[i]; + this.movedProxies[i] = null; + } + this.movedProxies = newArray; + } + this.movedProxies[this.numMovedProxies++] = p; + } + return p; + } + ,destroyProxy: function(proxy) { + this._numProxies--; + var prev = proxy._prev; + var next = proxy._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(proxy == this._proxyList) { + this._proxyList = this._proxyList._next; + } + if(proxy == this._proxyListLast) { + this._proxyListLast = this._proxyListLast._prev; + } + proxy._next = null; + proxy._prev = null; + var bvhProxy = proxy; + var _this = this._tree; + var leaf = bvhProxy._leaf; + _this._numLeaves--; + var prev1 = leaf._prevLeaf; + var next1 = leaf._nextLeaf; + if(prev1 != null) { + prev1._nextLeaf = next1; + } + if(next1 != null) { + next1._prevLeaf = prev1; + } + if(leaf == _this.leafList) { + _this.leafList = _this.leafList._nextLeaf; + } + if(leaf == _this.leafListLast) { + _this.leafListLast = _this.leafListLast._prevLeaf; + } + leaf._nextLeaf = null; + leaf._prevLeaf = null; + if(_this._root == leaf) { + _this._root = null; + } else { + var parent = leaf._parent; + var sibling = parent._children[leaf._childIndex ^ 1]; + var grandParent = parent._parent; + if(grandParent == null) { + sibling._parent = null; + sibling._childIndex = 0; + _this._root = sibling; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + } else { + sibling._parent = grandParent; + var index = parent._childIndex; + grandParent._children[index] = sibling; + sibling._parent = grandParent; + sibling._childIndex = index; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + var node = grandParent; + while(node != null) { + if(_this._strategy._balancingEnabled) { + if(node._height < 2) { + node = node; + } else { + var p = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var balance = l._height - r._height; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + if(ll._height > lr._height) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; + l._childIndex = nodeIndex; + } else { + _this._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + if(rl._height > rr._height) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; + r._childIndex = nodeIndex; + } else { + _this._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + } + bvhProxy._leaf = null; + leaf._next = null; + leaf._childIndex = 0; + leaf._children[0] = null; + leaf._children[1] = null; + leaf._childIndex = 0; + leaf._parent = null; + leaf._height = 0; + leaf._proxy = null; + leaf._next = _this._nodePool; + _this._nodePool = leaf; + bvhProxy.userData = null; + bvhProxy._next = null; + bvhProxy._prev = null; + if(bvhProxy._moved) { + bvhProxy._moved = false; + } + } + ,moveProxy: function(proxy,aabb,displacement) { + var p = proxy; + if(p._aabbMinX <= aabb._minX && p._aabbMaxX >= aabb._maxX && p._aabbMinY <= aabb._minY && p._aabbMaxY >= aabb._maxY && p._aabbMinZ <= aabb._minZ && p._aabbMaxZ >= aabb._maxZ) { + return; + } + p._aabbMinX = aabb._minX; + p._aabbMinY = aabb._minY; + p._aabbMinZ = aabb._minZ; + p._aabbMaxX = aabb._maxX; + p._aabbMaxY = aabb._maxY; + p._aabbMaxZ = aabb._maxZ; + var padding = oimo_common_Setting.bvhProxyPadding; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; + if(displacement != null) { + var dX; + var dY; + var dZ; + var zeroX; + var zeroY; + var zeroZ; + var addToMinX; + var addToMinY; + var addToMinZ; + var addToMaxX; + var addToMaxY; + var addToMaxZ; + zeroX = 0; + zeroY = 0; + zeroZ = 0; + dX = displacement.x; + dY = displacement.y; + dZ = displacement.z; + addToMinX = zeroX < dX ? zeroX : dX; + addToMinY = zeroY < dY ? zeroY : dY; + addToMinZ = zeroZ < dZ ? zeroZ : dZ; + addToMaxX = zeroX > dX ? zeroX : dX; + addToMaxY = zeroY > dY ? zeroY : dY; + addToMaxZ = zeroZ > dZ ? zeroZ : dZ; + p._aabbMinX += addToMinX; + p._aabbMinY += addToMinY; + p._aabbMinZ += addToMinZ; + p._aabbMaxX += addToMaxX; + p._aabbMaxY += addToMaxY; + p._aabbMaxZ += addToMaxZ; + } + if(!p._moved) { + p._moved = true; + if(this.movedProxies.length == this.numMovedProxies) { + var newArray = new Array(this.numMovedProxies << 1); + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.movedProxies[i]; + this.movedProxies[i] = null; + } + this.movedProxies = newArray; + } + this.movedProxies[this.numMovedProxies++] = p; + } + } + ,collectPairs: function() { + var p = this._proxyPairList; + if(p != null) { + while(true) { + p._p1 = null; + p._p2 = null; + p = p._next; + if(!(p != null)) { + break; + } + } + this._proxyPairList._next = this._proxyPairPool; + this._proxyPairPool = this._proxyPairList; + this._proxyPairList = null; + } + this._testCount = 0; + if(this._numProxies < 2) { + return; + } + var incrementalCollision = this.numMovedProxies / this._numProxies < oimo_common_Setting.bvhIncrementalCollisionThreshold; + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + var p1 = this.movedProxies[i]; + if(p1._moved) { + var _this = this._tree; + var leaf = p1._leaf; + _this._numLeaves--; + var prev = leaf._prevLeaf; + var next = leaf._nextLeaf; + if(prev != null) { + prev._nextLeaf = next; + } + if(next != null) { + next._prevLeaf = prev; + } + if(leaf == _this.leafList) { + _this.leafList = _this.leafList._nextLeaf; + } + if(leaf == _this.leafListLast) { + _this.leafListLast = _this.leafListLast._prevLeaf; + } + leaf._nextLeaf = null; + leaf._prevLeaf = null; + if(_this._root == leaf) { + _this._root = null; + } else { + var parent = leaf._parent; + var sibling = parent._children[leaf._childIndex ^ 1]; + var grandParent = parent._parent; + if(grandParent == null) { + sibling._parent = null; + sibling._childIndex = 0; + _this._root = sibling; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + } else { + sibling._parent = grandParent; + var index = parent._childIndex; + grandParent._children[index] = sibling; + sibling._parent = grandParent; + sibling._childIndex = index; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + var node = grandParent; + while(node != null) { + if(_this._strategy._balancingEnabled) { + if(node._height < 2) { + node = node; + } else { + var p2 = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var balance = l._height - r._height; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + if(ll._height > lr._height) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p2 != null) { + p2._children[nodeIndex] = l; + l._parent = p2; + l._childIndex = nodeIndex; + } else { + _this._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + if(rl._height > rr._height) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p2 != null) { + p2._children[nodeIndex] = r; + r._parent = p2; + r._childIndex = nodeIndex; + } else { + _this._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + } + p1._leaf = null; + leaf._next = null; + leaf._childIndex = 0; + leaf._children[0] = null; + leaf._children[1] = null; + leaf._childIndex = 0; + leaf._parent = null; + leaf._height = 0; + leaf._proxy = null; + leaf._next = _this._nodePool; + _this._nodePool = leaf; + var _this1 = this._tree; + var first = _this1._nodePool; + if(first != null) { + _this1._nodePool = first._next; + first._next = null; + } else { + first = new oimo_collision_broadphase_bvh_BvhNode(); + } + var leaf1 = first; + leaf1._proxy = p1; + p1._leaf = leaf1; + leaf1._aabbMinX = p1._aabbMinX; + leaf1._aabbMinY = p1._aabbMinY; + leaf1._aabbMinZ = p1._aabbMinZ; + leaf1._aabbMaxX = p1._aabbMaxX; + leaf1._aabbMaxY = p1._aabbMaxY; + leaf1._aabbMaxZ = p1._aabbMaxZ; + _this1._numLeaves++; + if(_this1.leafList == null) { + _this1.leafList = leaf1; + _this1.leafListLast = leaf1; + } else { + _this1.leafListLast._nextLeaf = leaf1; + leaf1._prevLeaf = _this1.leafListLast; + _this1.leafListLast = leaf1; + } + if(_this1._root == null) { + _this1._root = leaf1; + } else { + var sibling1 = _this1._root; + while(sibling1._height > 0) { + var nextStep = _this1._strategy._decideInsertion(sibling1,leaf1); + if(nextStep == -1) { + break; + } else { + sibling1 = sibling1._children[nextStep]; + } + } + var parent1 = sibling1._parent; + var first1 = _this1._nodePool; + if(first1 != null) { + _this1._nodePool = first1._next; + first1._next = null; + } else { + first1 = new oimo_collision_broadphase_bvh_BvhNode(); + } + var node1 = first1; + if(parent1 == null) { + _this1._root = node1; + } else { + var index1 = sibling1._childIndex; + parent1._children[index1] = node1; + node1._parent = parent1; + node1._childIndex = index1; + } + var index2 = sibling1._childIndex; + node1._children[index2] = sibling1; + sibling1._parent = node1; + sibling1._childIndex = index2; + var index3 = sibling1._childIndex ^ 1; + node1._children[index3] = leaf1; + leaf1._parent = node1; + leaf1._childIndex = index3; + while(node1 != null) { + if(_this1._strategy._balancingEnabled) { + if(node1._height < 2) { + node1 = node1; + } else { + var p3 = node1._parent; + var l1 = node1._children[0]; + var r1 = node1._children[1]; + var balance1 = l1._height - r1._height; + var nodeIndex1 = node1._childIndex; + if(balance1 > 1) { + var ll1 = l1._children[0]; + var lr1 = l1._children[1]; + if(ll1._height > lr1._height) { + l1._children[1] = node1; + node1._parent = l1; + node1._childIndex = 1; + node1._children[0] = lr1; + lr1._parent = node1; + lr1._childIndex = 0; + var c19 = l1._children[0]; + var c29 = l1._children[1]; + l1._aabbMinX = c19._aabbMinX < c29._aabbMinX ? c19._aabbMinX : c29._aabbMinX; + l1._aabbMinY = c19._aabbMinY < c29._aabbMinY ? c19._aabbMinY : c29._aabbMinY; + l1._aabbMinZ = c19._aabbMinZ < c29._aabbMinZ ? c19._aabbMinZ : c29._aabbMinZ; + l1._aabbMaxX = c19._aabbMaxX > c29._aabbMaxX ? c19._aabbMaxX : c29._aabbMaxX; + l1._aabbMaxY = c19._aabbMaxY > c29._aabbMaxY ? c19._aabbMaxY : c29._aabbMaxY; + l1._aabbMaxZ = c19._aabbMaxZ > c29._aabbMaxZ ? c19._aabbMaxZ : c29._aabbMaxZ; + var h19 = l1._children[0]._height; + var h29 = l1._children[1]._height; + l1._height = (h19 > h29 ? h19 : h29) + 1; + var c110 = node1._children[0]; + var c210 = node1._children[1]; + node1._aabbMinX = c110._aabbMinX < c210._aabbMinX ? c110._aabbMinX : c210._aabbMinX; + node1._aabbMinY = c110._aabbMinY < c210._aabbMinY ? c110._aabbMinY : c210._aabbMinY; + node1._aabbMinZ = c110._aabbMinZ < c210._aabbMinZ ? c110._aabbMinZ : c210._aabbMinZ; + node1._aabbMaxX = c110._aabbMaxX > c210._aabbMaxX ? c110._aabbMaxX : c210._aabbMaxX; + node1._aabbMaxY = c110._aabbMaxY > c210._aabbMaxY ? c110._aabbMaxY : c210._aabbMaxY; + node1._aabbMaxZ = c110._aabbMaxZ > c210._aabbMaxZ ? c110._aabbMaxZ : c210._aabbMaxZ; + var h110 = node1._children[0]._height; + var h210 = node1._children[1]._height; + node1._height = (h110 > h210 ? h110 : h210) + 1; + } else { + l1._children[0] = node1; + node1._parent = l1; + node1._childIndex = 0; + node1._children[0] = ll1; + ll1._parent = node1; + ll1._childIndex = 0; + var c111 = l1._children[0]; + var c211 = l1._children[1]; + l1._aabbMinX = c111._aabbMinX < c211._aabbMinX ? c111._aabbMinX : c211._aabbMinX; + l1._aabbMinY = c111._aabbMinY < c211._aabbMinY ? c111._aabbMinY : c211._aabbMinY; + l1._aabbMinZ = c111._aabbMinZ < c211._aabbMinZ ? c111._aabbMinZ : c211._aabbMinZ; + l1._aabbMaxX = c111._aabbMaxX > c211._aabbMaxX ? c111._aabbMaxX : c211._aabbMaxX; + l1._aabbMaxY = c111._aabbMaxY > c211._aabbMaxY ? c111._aabbMaxY : c211._aabbMaxY; + l1._aabbMaxZ = c111._aabbMaxZ > c211._aabbMaxZ ? c111._aabbMaxZ : c211._aabbMaxZ; + var h111 = l1._children[0]._height; + var h211 = l1._children[1]._height; + l1._height = (h111 > h211 ? h111 : h211) + 1; + var c112 = node1._children[0]; + var c212 = node1._children[1]; + node1._aabbMinX = c112._aabbMinX < c212._aabbMinX ? c112._aabbMinX : c212._aabbMinX; + node1._aabbMinY = c112._aabbMinY < c212._aabbMinY ? c112._aabbMinY : c212._aabbMinY; + node1._aabbMinZ = c112._aabbMinZ < c212._aabbMinZ ? c112._aabbMinZ : c212._aabbMinZ; + node1._aabbMaxX = c112._aabbMaxX > c212._aabbMaxX ? c112._aabbMaxX : c212._aabbMaxX; + node1._aabbMaxY = c112._aabbMaxY > c212._aabbMaxY ? c112._aabbMaxY : c212._aabbMaxY; + node1._aabbMaxZ = c112._aabbMaxZ > c212._aabbMaxZ ? c112._aabbMaxZ : c212._aabbMaxZ; + var h112 = node1._children[0]._height; + var h212 = node1._children[1]._height; + node1._height = (h112 > h212 ? h112 : h212) + 1; + } + if(p3 != null) { + p3._children[nodeIndex1] = l1; + l1._parent = p3; + l1._childIndex = nodeIndex1; + } else { + _this1._root = l1; + l1._parent = null; + } + node1 = l1; + } else if(balance1 < -1) { + var rl1 = r1._children[0]; + var rr1 = r1._children[1]; + if(rl1._height > rr1._height) { + r1._children[1] = node1; + node1._parent = r1; + node1._childIndex = 1; + node1._children[1] = rr1; + rr1._parent = node1; + rr1._childIndex = 1; + var c113 = r1._children[0]; + var c213 = r1._children[1]; + r1._aabbMinX = c113._aabbMinX < c213._aabbMinX ? c113._aabbMinX : c213._aabbMinX; + r1._aabbMinY = c113._aabbMinY < c213._aabbMinY ? c113._aabbMinY : c213._aabbMinY; + r1._aabbMinZ = c113._aabbMinZ < c213._aabbMinZ ? c113._aabbMinZ : c213._aabbMinZ; + r1._aabbMaxX = c113._aabbMaxX > c213._aabbMaxX ? c113._aabbMaxX : c213._aabbMaxX; + r1._aabbMaxY = c113._aabbMaxY > c213._aabbMaxY ? c113._aabbMaxY : c213._aabbMaxY; + r1._aabbMaxZ = c113._aabbMaxZ > c213._aabbMaxZ ? c113._aabbMaxZ : c213._aabbMaxZ; + var h113 = r1._children[0]._height; + var h213 = r1._children[1]._height; + r1._height = (h113 > h213 ? h113 : h213) + 1; + var c114 = node1._children[0]; + var c214 = node1._children[1]; + node1._aabbMinX = c114._aabbMinX < c214._aabbMinX ? c114._aabbMinX : c214._aabbMinX; + node1._aabbMinY = c114._aabbMinY < c214._aabbMinY ? c114._aabbMinY : c214._aabbMinY; + node1._aabbMinZ = c114._aabbMinZ < c214._aabbMinZ ? c114._aabbMinZ : c214._aabbMinZ; + node1._aabbMaxX = c114._aabbMaxX > c214._aabbMaxX ? c114._aabbMaxX : c214._aabbMaxX; + node1._aabbMaxY = c114._aabbMaxY > c214._aabbMaxY ? c114._aabbMaxY : c214._aabbMaxY; + node1._aabbMaxZ = c114._aabbMaxZ > c214._aabbMaxZ ? c114._aabbMaxZ : c214._aabbMaxZ; + var h114 = node1._children[0]._height; + var h214 = node1._children[1]._height; + node1._height = (h114 > h214 ? h114 : h214) + 1; + } else { + r1._children[0] = node1; + node1._parent = r1; + node1._childIndex = 0; + node1._children[1] = rl1; + rl1._parent = node1; + rl1._childIndex = 1; + var c115 = r1._children[0]; + var c215 = r1._children[1]; + r1._aabbMinX = c115._aabbMinX < c215._aabbMinX ? c115._aabbMinX : c215._aabbMinX; + r1._aabbMinY = c115._aabbMinY < c215._aabbMinY ? c115._aabbMinY : c215._aabbMinY; + r1._aabbMinZ = c115._aabbMinZ < c215._aabbMinZ ? c115._aabbMinZ : c215._aabbMinZ; + r1._aabbMaxX = c115._aabbMaxX > c215._aabbMaxX ? c115._aabbMaxX : c215._aabbMaxX; + r1._aabbMaxY = c115._aabbMaxY > c215._aabbMaxY ? c115._aabbMaxY : c215._aabbMaxY; + r1._aabbMaxZ = c115._aabbMaxZ > c215._aabbMaxZ ? c115._aabbMaxZ : c215._aabbMaxZ; + var h115 = r1._children[0]._height; + var h215 = r1._children[1]._height; + r1._height = (h115 > h215 ? h115 : h215) + 1; + var c116 = node1._children[0]; + var c216 = node1._children[1]; + node1._aabbMinX = c116._aabbMinX < c216._aabbMinX ? c116._aabbMinX : c216._aabbMinX; + node1._aabbMinY = c116._aabbMinY < c216._aabbMinY ? c116._aabbMinY : c216._aabbMinY; + node1._aabbMinZ = c116._aabbMinZ < c216._aabbMinZ ? c116._aabbMinZ : c216._aabbMinZ; + node1._aabbMaxX = c116._aabbMaxX > c216._aabbMaxX ? c116._aabbMaxX : c216._aabbMaxX; + node1._aabbMaxY = c116._aabbMaxY > c216._aabbMaxY ? c116._aabbMaxY : c216._aabbMaxY; + node1._aabbMaxZ = c116._aabbMaxZ > c216._aabbMaxZ ? c116._aabbMaxZ : c216._aabbMaxZ; + var h116 = node1._children[0]._height; + var h216 = node1._children[1]._height; + node1._height = (h116 > h216 ? h116 : h216) + 1; + } + if(p3 != null) { + p3._children[nodeIndex1] = r1; + r1._parent = p3; + r1._childIndex = nodeIndex1; + } else { + _this1._root = r1; + r1._parent = null; + } + node1 = r1; + } else { + node1 = node1; + } + } + } + var h117 = node1._children[0]._height; + var h217 = node1._children[1]._height; + node1._height = (h117 > h217 ? h117 : h217) + 1; + var c117 = node1._children[0]; + var c217 = node1._children[1]; + node1._aabbMinX = c117._aabbMinX < c217._aabbMinX ? c117._aabbMinX : c217._aabbMinX; + node1._aabbMinY = c117._aabbMinY < c217._aabbMinY ? c117._aabbMinY : c217._aabbMinY; + node1._aabbMinZ = c117._aabbMinZ < c217._aabbMinZ ? c117._aabbMinZ : c217._aabbMinZ; + node1._aabbMaxX = c117._aabbMaxX > c217._aabbMaxX ? c117._aabbMaxX : c217._aabbMaxX; + node1._aabbMaxY = c117._aabbMaxY > c217._aabbMaxY ? c117._aabbMaxY : c217._aabbMaxY; + node1._aabbMaxZ = c117._aabbMaxZ > c217._aabbMaxZ ? c117._aabbMaxZ : c217._aabbMaxZ; + node1 = node1._parent; + } + } + if(incrementalCollision) { + this.collide(this._tree._root,p1._leaf); + } + p1._moved = false; + } + this.movedProxies[i] = null; + } + if(!incrementalCollision) { + this.collide(this._tree._root,this._tree._root); + } + this.numMovedProxies = 0; + } + ,rayCast: function(begin,end,callback) { + if(this._tree._root == null) { + return; + } + var p1X; + var p1Y; + var p1Z; + var p2X; + var p2Y; + var p2Z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; + this.rayCastRecursive(this._tree._root,p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + } + ,convexCast: function(convex,begin,translation,callback) { + if(this._tree._root == null) { + return; + } + this.convexCastRecursive(this._tree._root,convex,begin,translation,callback); + } + ,aabbTest: function(aabb,callback) { + if(this._tree._root == null) { + return; + } + this.aabbTestRecursive(this._tree._root,aabb,callback); + } + ,getTreeBalance: function() { + return this._tree._getBalance(); + } + ,__class__: oimo_collision_broadphase_bvh_BvhBroadPhase +}); +var oimo_collision_broadphase_bvh_BvhInsertionStrategy = function() { }; +oimo_collision_broadphase_bvh_BvhInsertionStrategy.__name__ = true; +var oimo_collision_broadphase_bvh_BvhNode = function() { + this._next = null; + this._prevLeaf = null; + this._nextLeaf = null; + this._children = new Array(2); + this._childIndex = 0; + this._parent = null; + this._height = 0; + this._proxy = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; +}; +oimo_collision_broadphase_bvh_BvhNode.__name__ = true; +oimo_collision_broadphase_bvh_BvhNode.prototype = { + __class__: oimo_collision_broadphase_bvh_BvhNode +}; +var oimo_collision_broadphase_bvh_BvhProxy = function(userData,id) { + oimo_collision_broadphase_Proxy.call(this,userData,id); + this._leaf = null; + this._moved = false; +}; +oimo_collision_broadphase_bvh_BvhProxy.__name__ = true; +oimo_collision_broadphase_bvh_BvhProxy.__super__ = oimo_collision_broadphase_Proxy; +oimo_collision_broadphase_bvh_BvhProxy.prototype = $extend(oimo_collision_broadphase_Proxy.prototype,{ + __class__: oimo_collision_broadphase_bvh_BvhProxy +}); +var oimo_collision_broadphase_bvh_BvhStrategy = function() { + this._insertionStrategy = 0; + this._balancingEnabled = false; +}; +oimo_collision_broadphase_bvh_BvhStrategy.__name__ = true; +oimo_collision_broadphase_bvh_BvhStrategy.prototype = { + _decideInsertion: function(currentNode,leaf) { + switch(this._insertionStrategy) { + case 0: + var centerX; + var centerY; + var centerZ; + centerX = leaf._aabbMinX + leaf._aabbMaxX; + centerY = leaf._aabbMinY + leaf._aabbMaxY; + centerZ = leaf._aabbMinZ + leaf._aabbMaxZ; + var c1 = currentNode._children[0]; + var c2 = currentNode._children[1]; + var diff1X; + var diff1Y; + var diff1Z; + var diff2X; + var diff2Y; + var diff2Z; + diff1X = c1._aabbMinX + c1._aabbMaxX; + diff1Y = c1._aabbMinY + c1._aabbMaxY; + diff1Z = c1._aabbMinZ + c1._aabbMaxZ; + diff2X = c2._aabbMinX + c2._aabbMaxX; + diff2Y = c2._aabbMinY + c2._aabbMaxY; + diff2Z = c2._aabbMinZ + c2._aabbMaxZ; + diff1X -= centerX; + diff1Y -= centerY; + diff1Z -= centerZ; + diff2X -= centerX; + diff2Y -= centerY; + diff2Z -= centerZ; + if(diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z < diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z) { + return 0; + } else { + return 1; + } + break; + case 1: + var c11 = currentNode._children[0]; + var c21 = currentNode._children[1]; + var ey = currentNode._aabbMaxY - currentNode._aabbMinY; + var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; + var combinedMinX; + var combinedMinY; + var combinedMinZ; + var combinedMaxX; + var combinedMaxY; + var combinedMaxZ; + combinedMinX = currentNode._aabbMinX < leaf._aabbMinX ? currentNode._aabbMinX : leaf._aabbMinX; + combinedMinY = currentNode._aabbMinY < leaf._aabbMinY ? currentNode._aabbMinY : leaf._aabbMinY; + combinedMinZ = currentNode._aabbMinZ < leaf._aabbMinZ ? currentNode._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = currentNode._aabbMaxX > leaf._aabbMaxX ? currentNode._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = currentNode._aabbMaxY > leaf._aabbMaxY ? currentNode._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = currentNode._aabbMaxZ > leaf._aabbMaxZ ? currentNode._aabbMaxZ : leaf._aabbMaxZ; + var ey1 = combinedMaxY - combinedMinY; + var ez1 = combinedMaxZ - combinedMinZ; + var newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; + var creatingCost = newArea * 2; + var incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; + var descendingCost1 = incrementalCost; + combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; + combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; + combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c11._aabbMaxX > leaf._aabbMaxX ? c11._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; + if(c11._height == 0) { + var ey2 = combinedMaxY - combinedMinY; + var ez2 = combinedMaxZ - combinedMinZ; + descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey2 + ez2) + ey2 * ez2) * 2; + } else { + var ey3 = combinedMaxY - combinedMinY; + var ez3 = combinedMaxZ - combinedMinZ; + var ey4 = c11._aabbMaxY - c11._aabbMinY; + var ez4 = c11._aabbMaxZ - c11._aabbMinZ; + descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey3 + ez3) + ey3 * ez3) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey4 + ez4) + ey4 * ez4) * 2); + } + var descendingCost2 = incrementalCost; + combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; + combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; + combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c21._aabbMaxX > leaf._aabbMaxX ? c21._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; + if(c21._height == 0) { + var ey5 = combinedMaxY - combinedMinY; + var ez5 = combinedMaxZ - combinedMinZ; + descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey5 + ez5) + ey5 * ez5) * 2; + } else { + var ey6 = combinedMaxY - combinedMinY; + var ez6 = combinedMaxZ - combinedMinZ; + var ey7 = c21._aabbMaxY - c21._aabbMinY; + var ez7 = c21._aabbMaxZ - c21._aabbMinZ; + descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey6 + ez6) + ey6 * ez6) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey7 + ez7) + ey7 * ez7) * 2); + } + if(creatingCost < descendingCost1) { + if(creatingCost < descendingCost2) { + return -1; + } else { + return 1; + } + } else if(descendingCost1 < descendingCost2) { + return 0; + } else { + return 1; + } + break; + default: + console.log("src/oimo/collision/broadphase/bvh/BvhStrategy.hx:37:","invalid BVH insertion strategy: " + this._insertionStrategy); + return -1; + } + } + ,_splitLeaves: function(leaves,from,until) { + var invN = 1.0 / (until - from); + var centerMeanX; + var centerMeanY; + var centerMeanZ; + centerMeanX = 0; + centerMeanY = 0; + centerMeanZ = 0; + var _g = from; + while(_g < until) { + var leaf = leaves[_g++]; + leaf._tmpX = leaf._aabbMaxX + leaf._aabbMinX; + leaf._tmpY = leaf._aabbMaxY + leaf._aabbMinY; + leaf._tmpZ = leaf._aabbMaxZ + leaf._aabbMinZ; + centerMeanX += leaf._tmpX; + centerMeanY += leaf._tmpY; + centerMeanZ += leaf._tmpZ; + } + centerMeanX *= invN; + centerMeanY *= invN; + centerMeanZ *= invN; + var varianceX; + var varianceY; + var varianceZ; + varianceX = 0; + varianceY = 0; + varianceZ = 0; + var _g2 = from; + while(_g2 < until) { + var leaf1 = leaves[_g2++]; + var diffX; + var diffY; + var diffZ; + diffX = leaf1._tmpX - centerMeanX; + diffY = leaf1._tmpY - centerMeanY; + diffZ = leaf1._tmpZ - centerMeanZ; + diffX *= diffX; + diffY *= diffY; + diffZ *= diffZ; + varianceX += diffX; + varianceY += diffY; + varianceZ += diffZ; + } + var varX = varianceX; + var varY = varianceY; + var varZ = varianceZ; + var l = from; + var r = until - 1; + if(varX > varY) { + if(varX > varZ) { + var mean = centerMeanX; + while(true) { + while(!(leaves[l]._tmpX <= mean)) ++l; + while(!(leaves[r]._tmpX >= mean)) --r; + if(l >= r) { + break; + } + var tmp = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp; + ++l; + --r; + } + } else { + var mean1 = centerMeanZ; + while(true) { + while(!(leaves[l]._tmpZ <= mean1)) ++l; + while(!(leaves[r]._tmpZ >= mean1)) --r; + if(l >= r) { + break; + } + var tmp1 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp1; + ++l; + --r; + } + } + } else if(varY > varZ) { + var mean2 = centerMeanY; + while(true) { + while(!(leaves[l]._tmpY <= mean2)) ++l; + while(!(leaves[r]._tmpY >= mean2)) --r; + if(l >= r) { + break; + } + var tmp2 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp2; + ++l; + --r; + } + } else { + var mean3 = centerMeanZ; + while(true) { + while(!(leaves[l]._tmpZ <= mean3)) ++l; + while(!(leaves[r]._tmpZ >= mean3)) --r; + if(l >= r) { + break; + } + var tmp3 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp3; + ++l; + --r; + } + } + return l; + } + ,__class__: oimo_collision_broadphase_bvh_BvhStrategy +}; +var oimo_collision_broadphase_bvh_BvhTree = function() { + this._root = null; + this._numLeaves = 0; + this._strategy = new oimo_collision_broadphase_bvh_BvhStrategy(); + this._nodePool = null; + this.leafList = null; + this.leafListLast = null; + this.tmp = new Array(1024); +}; +oimo_collision_broadphase_bvh_BvhTree.__name__ = true; +oimo_collision_broadphase_bvh_BvhTree.prototype = { + _print: function(root,indent) { + if(indent == null) { + indent = ""; + } + if(root == null) { + return; + } + if(root._height == 0) { + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:39:",indent + root._proxy._id); + } else { + this._print(root._children[0],indent + " "); + var tmp; + var sizeX; + var sizeY; + var sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + var y = sizeY; + var z = sizeZ; + if(sizeX * (y + z) + y * z > 0) { + var sizeX1; + var sizeY1; + var sizeZ1; + sizeX1 = root._aabbMaxX - root._aabbMinX; + sizeY1 = root._aabbMaxY - root._aabbMinY; + sizeZ1 = root._aabbMaxZ - root._aabbMinZ; + var y1 = sizeY1; + var z1 = sizeZ1; + tmp = ((sizeX1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + } else { + var sizeX2; + var sizeY2; + var sizeZ2; + sizeX2 = root._aabbMaxX - root._aabbMinX; + sizeY2 = root._aabbMaxY - root._aabbMinY; + sizeZ2 = root._aabbMaxZ - root._aabbMinZ; + var y2 = sizeY2; + var z2 = sizeZ2; + tmp = ((sizeX2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + } + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); + this._print(root._children[1],indent + " "); + } + } + ,_getBalance: function() { + return this.getBalanceRecursive(this._root); + } + ,deleteRecursive: function(root) { + if(root._height == 0) { + var prev = root._prevLeaf; + var next = root._nextLeaf; + if(prev != null) { + prev._nextLeaf = next; + } + if(next != null) { + next._prevLeaf = prev; + } + if(root == this.leafList) { + this.leafList = this.leafList._nextLeaf; + } + if(root == this.leafListLast) { + this.leafListLast = this.leafListLast._prevLeaf; + } + root._nextLeaf = null; + root._prevLeaf = null; + root._proxy._leaf = null; + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + return; + } + this.deleteRecursive(root._children[0]); + this.deleteRecursive(root._children[1]); + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + } + ,decomposeRecursive: function(root) { + if(root._height == 0) { + root._childIndex = 0; + root._parent = null; + return; + } + this.decomposeRecursive(root._children[0]); + this.decomposeRecursive(root._children[1]); + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + } + ,buildTopDownRecursive: function(leaves,from,until) { + if(until - from == 1) { + var leaf = leaves[from]; + var proxy = leaf._proxy; + leaf._aabbMinX = proxy._aabbMinX; + leaf._aabbMinY = proxy._aabbMinY; + leaf._aabbMinZ = proxy._aabbMinZ; + leaf._aabbMaxX = proxy._aabbMaxX; + leaf._aabbMaxY = proxy._aabbMaxY; + leaf._aabbMaxZ = proxy._aabbMaxZ; + return leaf; + } + var splitAt = this._strategy._splitLeaves(leaves,from,until); + var child1 = this.buildTopDownRecursive(leaves,from,splitAt); + var child2 = this.buildTopDownRecursive(leaves,splitAt,until); + var first = this._nodePool; + if(first != null) { + this._nodePool = first._next; + first._next = null; + } else { + first = new oimo_collision_broadphase_bvh_BvhNode(); + } + var parent = first; + parent._children[0] = child1; + child1._parent = parent; + child1._childIndex = 0; + parent._children[1] = child2; + child2._parent = parent; + child2._childIndex = 1; + var c1 = parent._children[0]; + var c2 = parent._children[1]; + parent._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + parent._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + parent._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + parent._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + parent._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + parent._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = parent._children[0]._height; + var h2 = parent._children[1]._height; + parent._height = (h1 > h2 ? h1 : h2) + 1; + return parent; + } + ,getBalanceRecursive: function(root) { + if(root == null || root._height == 0) { + return 0; + } + var balance = root._children[0]._height - root._children[1]._height; + if(balance < 0) { + balance = -balance; + } + return balance + this.getBalanceRecursive(root._children[0]) + this.getBalanceRecursive(root._children[1]); + } + ,__class__: oimo_collision_broadphase_bvh_BvhTree +}; +var oimo_collision_geometry_Aabb = function() { + this._minX = 0; + this._minY = 0; + this._minZ = 0; + this._maxX = 0; + this._maxY = 0; + this._maxZ = 0; +}; +oimo_collision_geometry_Aabb.__name__ = true; +oimo_collision_geometry_Aabb.prototype = { + init: function(min,max) { + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; + return this; + } + ,getMin: function() { + var min = new oimo_common_Vec3(); + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; + return min; + } + ,getMinTo: function(min) { + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; + } + ,setMin: function(min) { + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; + return this; + } + ,getMax: function() { + var max = new oimo_common_Vec3(); + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; + return max; + } + ,getMaxTo: function(max) { + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; + } + ,setMax: function(max) { + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; + return this; + } + ,getCenter: function() { + var v = new oimo_common_Vec3(); + var cX; + var cY; + var cZ; + cX = this._minX + this._maxX; + cY = this._minY + this._maxY; + cZ = this._minZ + this._maxZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + v.x = cX; + v.y = cY; + v.z = cZ; + return v; + } + ,getCenterTo: function(center) { + var cX; + var cY; + var cZ; + cX = this._minX + this._maxX; + cY = this._minY + this._maxY; + cZ = this._minZ + this._maxZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + center.x = cX; + center.y = cY; + center.z = cZ; + } + ,getExtents: function() { + var v = new oimo_common_Vec3(); + var cX; + var cY; + var cZ; + cX = this._maxX - this._minX; + cY = this._maxY - this._minY; + cZ = this._maxZ - this._minZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + v.x = cX; + v.y = cY; + v.z = cZ; + return v; + } + ,getExtentsTo: function(halfExtents) { + var cX; + var cY; + var cZ; + cX = this._maxX - this._minX; + cY = this._maxY - this._minY; + cZ = this._maxZ - this._minZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + halfExtents.x = cX; + halfExtents.y = cY; + halfExtents.z = cZ; + } + ,combine: function(other) { + this._minX = this._minX < other._minX ? this._minX : other._minX; + this._minY = this._minY < other._minY ? this._minY : other._minY; + this._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; + this._maxX = this._maxX > other._maxX ? this._maxX : other._maxX; + this._maxY = this._maxY > other._maxY ? this._maxY : other._maxY; + this._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; + return this; + } + ,combined: function(other) { + var aabb = new oimo_collision_geometry_Aabb(); + aabb._minX = this._minX < other._minX ? this._minX : other._minX; + aabb._minY = this._minY < other._minY ? this._minY : other._minY; + aabb._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; + aabb._maxX = this._maxX > other._maxX ? this._maxX : other._maxX; + aabb._maxY = this._maxY > other._maxY ? this._maxY : other._maxY; + aabb._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; + return aabb; + } + ,overlap: function(other) { + if(this._minX < other._maxX && this._maxX > other._minX && this._minY < other._maxY && this._maxY > other._minY && this._minZ < other._maxZ) { + return this._maxZ > other._minZ; + } else { + return false; + } + } + ,getIntersection: function(other) { + var aabb = new oimo_collision_geometry_Aabb(); + aabb._minX = this._minX > other._minX ? this._minX : other._minX; + aabb._minY = this._minY > other._minY ? this._minY : other._minY; + aabb._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; + aabb._maxX = this._maxX < other._maxX ? this._maxX : other._maxX; + aabb._maxY = this._maxY < other._maxY ? this._maxY : other._maxY; + aabb._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; + return aabb; + } + ,getIntersectionTo: function(other,intersection) { + intersection._minX = this._minX > other._minX ? this._minX : other._minX; + intersection._minY = this._minY > other._minY ? this._minY : other._minY; + intersection._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; + intersection._maxX = this._maxX < other._maxX ? this._maxX : other._maxX; + intersection._maxY = this._maxY < other._maxY ? this._maxY : other._maxY; + intersection._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; + } + ,copyFrom: function(aabb) { + this._minX = aabb._minX; + this._minY = aabb._minY; + this._minZ = aabb._minZ; + this._maxX = aabb._maxX; + this._maxY = aabb._maxY; + this._maxZ = aabb._maxZ; + return this; + } + ,clone: function() { + var aabb = new oimo_collision_geometry_Aabb(); + aabb._minX = this._minX; + aabb._minY = this._minY; + aabb._minZ = this._minZ; + aabb._maxX = this._maxX; + aabb._maxY = this._maxY; + aabb._maxZ = this._maxZ; + return aabb; + } + ,__class__: oimo_collision_geometry_Aabb +}; +var oimo_collision_geometry_BoxGeometry = function(halfExtents) { + oimo_collision_geometry_ConvexGeometry.call(this,1); + this._halfExtentsX = halfExtents.x; + this._halfExtentsY = halfExtents.y; + this._halfExtentsZ = halfExtents.z; + this._halfAxisXX = halfExtents.x; + this._halfAxisXY = 0; + this._halfAxisXZ = 0; + this._halfAxisYX = 0; + this._halfAxisYY = halfExtents.y; + this._halfAxisYZ = 0; + this._halfAxisZX = 0; + this._halfAxisZY = 0; + this._halfAxisZZ = halfExtents.z; + this._updateMass(); + var minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; + if(this._gjkMargin > minHalfExtents * 0.2) { + this._gjkMargin = minHalfExtents * 0.2; + } +}; +oimo_collision_geometry_BoxGeometry.__name__ = true; +oimo_collision_geometry_BoxGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getHalfExtents: function() { + var v = new oimo_common_Vec3(); + v.x = this._halfExtentsX; + v.y = this._halfExtentsY; + v.z = this._halfExtentsZ; + return v; + } + ,getHalfExtentsTo: function(halfExtents) { + halfExtents.x = this._halfExtentsX; + halfExtents.y = this._halfExtentsY; + halfExtents.z = this._halfExtentsZ; + } + ,_updateMass: function() { + this._volume = 8 * (this._halfExtentsX * this._halfExtentsY * this._halfExtentsZ); + var sqX; + var sqY; + var sqZ; + sqX = this._halfExtentsX * this._halfExtentsX; + sqY = this._halfExtentsY * this._halfExtentsY; + sqZ = this._halfExtentsZ * this._halfExtentsZ; + this._inertiaCoeff00 = 0.33333333333333331 * (sqY + sqZ); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.33333333333333331 * (sqZ + sqX); + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.33333333333333331 * (sqX + sqY); + } + ,_computeAabb: function(aabb,tf) { + var tfxX; + var tfxY; + var tfxZ; + var tfyX; + var tfyY; + var tfyZ; + var tfzX; + var tfzY; + var tfzZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * this._halfAxisXX + tf._rotation01 * this._halfAxisXY + tf._rotation02 * this._halfAxisXZ; + __tmp__Y = tf._rotation10 * this._halfAxisXX + tf._rotation11 * this._halfAxisXY + tf._rotation12 * this._halfAxisXZ; + __tmp__Z = tf._rotation20 * this._halfAxisXX + tf._rotation21 * this._halfAxisXY + tf._rotation22 * this._halfAxisXZ; + tfxX = __tmp__X; + tfxY = __tmp__Y; + tfxZ = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; + __tmp__Y1 = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; + __tmp__Z1 = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; + tfyX = __tmp__X1; + tfyY = __tmp__Y1; + tfyZ = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; + __tmp__Y2 = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; + __tmp__Z2 = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; + tfzX = __tmp__X2; + tfzY = __tmp__Y2; + tfzZ = __tmp__Z2; + tfxX = tfxX < 0 ? -tfxX : tfxX; + tfxY = tfxY < 0 ? -tfxY : tfxY; + tfxZ = tfxZ < 0 ? -tfxZ : tfxZ; + tfyX = tfyX < 0 ? -tfyX : tfyX; + tfyY = tfyY < 0 ? -tfyY : tfyY; + tfyZ = tfyZ < 0 ? -tfyZ : tfyZ; + tfzX = tfzX < 0 ? -tfzX : tfzX; + tfzY = tfzY < 0 ? -tfzY : tfzY; + tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; + var tfsX; + var tfsY; + var tfsZ; + tfsX = tfxX + tfyX; + tfsY = tfxY + tfyY; + tfsZ = tfxZ + tfyZ; + tfsX += tfzX; + tfsY += tfzY; + tfsZ += tfzZ; + aabb._minX = tf._positionX - tfsX; + aabb._minY = tf._positionY - tfsY; + aabb._minZ = tf._positionZ - tfsZ; + aabb._maxX = tf._positionX + tfsX; + aabb._maxY = tf._positionY + tfsY; + aabb._maxZ = tf._positionZ + tfsZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + var gjkMarginsX; + var gjkMarginsY; + var gjkMarginsZ; + var coreExtentsX; + var coreExtentsY; + var coreExtentsZ; + gjkMarginsX = this._gjkMargin; + gjkMarginsY = this._gjkMargin; + gjkMarginsZ = this._gjkMargin; + gjkMarginsX = gjkMarginsX < this._halfExtentsX ? gjkMarginsX : this._halfExtentsX; + gjkMarginsY = gjkMarginsY < this._halfExtentsY ? gjkMarginsY : this._halfExtentsY; + gjkMarginsZ = gjkMarginsZ < this._halfExtentsZ ? gjkMarginsZ : this._halfExtentsZ; + coreExtentsX = this._halfExtentsX - gjkMarginsX; + coreExtentsY = this._halfExtentsY - gjkMarginsY; + coreExtentsZ = this._halfExtentsZ - gjkMarginsZ; + out.x = dir.x > 0 ? coreExtentsX : -coreExtentsX; + out.y = dir.y > 0 ? coreExtentsY : -coreExtentsY; + out.z = dir.z > 0 ? coreExtentsZ : -coreExtentsZ; + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var halfW = this._halfExtentsX; + var halfH = this._halfExtentsY; + var halfD = this._halfExtentsZ; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; + var tminx = 0; + var tminy = 0; + var tminz = 0; + var tmaxx = 1; + var tmaxy = 1; + var tmaxz = 1; + if(dx > -1e-6 && dx < 1e-6) { + if(beginX <= -halfW || beginX >= halfW) { + return false; + } + } else { + var invDx = 1 / dx; + var t1 = (-halfW - beginX) * invDx; + var t2 = (halfW - beginX) * invDx; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminx = t1; + } + if(t2 < 1) { + tmaxx = t2; + } + } + if(dy > -1e-6 && dy < 1e-6) { + if(beginY <= -halfH || beginY >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t11 = (-halfH - beginY) * invDy; + var t21 = (halfH - beginY) * invDy; + if(t11 > t21) { + var tmp1 = t11; + t11 = t21; + t21 = tmp1; + } + if(t11 > 0) { + tminy = t11; + } + if(t21 < 1) { + tmaxy = t21; + } + } + if(dz > -1e-6 && dz < 1e-6) { + if(beginZ <= -halfD || beginZ >= halfD) { + return false; + } + } else { + var invDz = 1 / dz; + var t12 = (-halfD - beginZ) * invDz; + var t22 = (halfD - beginZ) * invDz; + if(t12 > t22) { + var tmp2 = t12; + t12 = t22; + t22 = tmp2; + } + if(t12 > 0) { + tminz = t12; + } + if(t22 < 1) { + tmaxz = t22; + } + } + if(tminx >= 1 || tminy >= 1 || tminz >= 1 || tmaxx <= 0 || tmaxy <= 0 || tmaxz <= 0) { + return false; + } + var min = tminx; + var max = tmaxx; + var hitDirection = 0; + if(tminy > min) { + min = tminy; + hitDirection = 1; + } + if(tminz > min) { + min = tminz; + hitDirection = 2; + } + if(tmaxy < max) { + max = tmaxy; + } + if(tmaxz < max) { + max = tmaxz; + } + if(min > max) { + return false; + } + if(min == 0) { + return false; + } + switch(hitDirection) { + case 0: + hit.normal.init(dx > 0 ? -1 : 1,0,0); + break; + case 1: + hit.normal.init(0,dy > 0 ? -1 : 1,0); + break; + case 2: + hit.normal.init(0,0,dz > 0 ? -1 : 1); + break; + } + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); + hit.fraction = min; + return true; + } + ,__class__: oimo_collision_geometry_BoxGeometry +}); +var oimo_collision_geometry_CapsuleGeometry = function(radius,halfHeight) { + oimo_collision_geometry_ConvexGeometry.call(this,4); + this._radius = radius; + this._halfHeight = halfHeight; + this._gjkMargin = this._radius; + this._updateMass(); +}; +oimo_collision_geometry_CapsuleGeometry.__name__ = true; +oimo_collision_geometry_CapsuleGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getRadius: function() { + return this._radius; + } + ,getHalfHeight: function() { + return this._halfHeight; + } + ,_updateMass: function() { + var r2 = this._radius * this._radius; + var hh2 = this._halfHeight * this._halfHeight; + var cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; + var sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; + this._volume = cylinderVolume + sphereVolume; + var invVolume = this._volume == 0 ? 0 : 1 / this._volume; + var inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); + this._inertiaCoeff00 = inertiaXZ; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = inertiaXZ; + } + ,_computeAabb: function(aabb,tf) { + var radVecX; + var radVecY; + var radVecZ; + radVecX = this._radius; + radVecY = this._radius; + radVecZ = this._radius; + var axisX; + var axisY; + var axisZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axisX = axisX < 0 ? -axisX : axisX; + axisY = axisY < 0 ? -axisY : axisY; + axisZ = axisZ < 0 ? -axisZ : axisZ; + axisX *= this._halfHeight; + axisY *= this._halfHeight; + axisZ *= this._halfHeight; + radVecX += axisX; + radVecY += axisY; + radVecZ += axisZ; + aabb._minX = tf._positionX - radVecX; + aabb._minY = tf._positionY - radVecY; + aabb._minZ = tf._positionZ - radVecZ; + aabb._maxX = tf._positionX + radVecX; + aabb._maxY = tf._positionY + radVecY; + aabb._maxZ = tf._positionZ + radVecZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + if(dir.y > 0) { + out.init(0,this._halfHeight,0); + } else { + out.init(0,-this._halfHeight,0); + } + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var halfH = this._halfHeight; + var dx = endX - beginX; + var dz = endZ - beginZ; + var tminxz = 0; + var tmaxxz = 1; + var a = dx * dx + dz * dz; + var b = beginX * dx + beginZ * dz; + var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + var D = b * b - a * c; + if(D < 0) { + return false; + } + if(a > 0) { + var sqrtD = Math.sqrt(D); + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } else { + if(c >= 0) { + return false; + } + tminxz = 0; + tmaxxz = 1; + } + var crossY = beginY + (endY - beginY) * tminxz; + var min; + if(crossY > -halfH && crossY < halfH) { + if(tminxz > 0) { + min = tminxz; + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + hit.position.init(beginX + min * dx,crossY,beginZ + min * dz); + hit.fraction = min; + return true; + } + return false; + } + var spherePosX; + var spherePosY; + var spherePosZ; + var sphereToBeginX; + var sphereToBeginY; + var sphereToBeginZ; + spherePosX = 0; + spherePosY = crossY < 0 ? -halfH : halfH; + spherePosZ = 0; + sphereToBeginX = beginX - spherePosX; + sphereToBeginY = beginY - spherePosY; + sphereToBeginZ = beginZ - spherePosZ; + var dX; + var dY; + var dZ; + dX = endX - beginX; + dY = endY - beginY; + dZ = endZ - beginZ; + a = dX * dX + dY * dY + dZ * dZ; + b = sphereToBeginX * dX + sphereToBeginY * dY + sphereToBeginZ * dZ; + c = sphereToBeginX * sphereToBeginX + sphereToBeginY * sphereToBeginY + sphereToBeginZ * sphereToBeginZ - this._radius * this._radius; + D = b * b - a * c; + if(D < 0) { + return false; + } + var t = (-b - Math.sqrt(D)) / a; + if(t < 0 || t > 1) { + return false; + } + var hitPosX; + var hitPosY; + var hitPosZ; + var hitNormalX; + var hitNormalY; + var hitNormalZ; + hitPosX = sphereToBeginX + dX * t; + hitPosY = sphereToBeginY + dY * t; + hitPosZ = sphereToBeginZ + dZ * t; + var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + hitNormalX = hitPosX * l; + hitNormalY = hitPosY * l; + hitNormalZ = hitPosZ * l; + hitPosX += spherePosX; + hitPosY += spherePosY; + hitPosZ += spherePosZ; + var v = hit.position; + v.x = hitPosX; + v.y = hitPosY; + v.z = hitPosZ; + var v1 = hit.normal; + v1.x = hitNormalX; + v1.y = hitNormalY; + v1.z = hitNormalZ; + hit.fraction = t; + return true; + } + ,__class__: oimo_collision_geometry_CapsuleGeometry +}); +var oimo_collision_geometry_ConeGeometry = function(radius,halfHeight) { + oimo_collision_geometry_ConvexGeometry.call(this,3); + this._radius = radius; + this._halfHeight = halfHeight; + this.sinTheta = radius / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this.cosTheta = 2 * halfHeight / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this._updateMass(); +}; +oimo_collision_geometry_ConeGeometry.__name__ = true; +oimo_collision_geometry_ConeGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getRadius: function() { + return this._radius; + } + ,getHalfHeight: function() { + return this._halfHeight; + } + ,_updateMass: function() { + var r2 = this._radius * this._radius; + var h2 = this._halfHeight * this._halfHeight * 4; + this._volume = 3.14159265358979 * r2 * this._halfHeight * 2 / 3; + this._inertiaCoeff00 = 0.05 * (3 * r2 + 2 * h2); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.3 * r2; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.05 * (3 * r2 + 2 * h2); + } + ,_computeAabb: function(aabb,tf) { + var axisX; + var axisY; + var axisZ; + var axis2X; + var axis2Y; + var axis2Z; + var ehX; + var ehY; + var ehZ; + var erX; + var erY; + var erZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axis2X = axisX * axisX; + axis2Y = axisY * axisY; + axis2Z = axisZ * axisZ; + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); + erX *= this._radius; + erY *= this._radius; + erZ *= this._radius; + ehX = axisX * this._halfHeight; + ehY = axisY * this._halfHeight; + ehZ = axisZ * this._halfHeight; + var rminX; + var rminY; + var rminZ; + var rmaxX; + var rmaxY; + var rmaxZ; + rminX = -ehX; + rminY = -ehY; + rminZ = -ehZ; + rminX -= erX; + rminY -= erY; + rminZ -= erZ; + rmaxX = -ehX; + rmaxY = -ehY; + rmaxZ = -ehZ; + rmaxX += erX; + rmaxY += erY; + rmaxZ += erZ; + var maxX; + var maxY; + var maxZ; + var minX; + var minY; + var minZ; + maxX = rminX > rmaxX ? rminX : rmaxX; + maxY = rminY > rmaxY ? rminY : rmaxY; + maxZ = rminZ > rmaxZ ? rminZ : rmaxZ; + maxX = maxX > ehX ? maxX : ehX; + maxY = maxY > ehY ? maxY : ehY; + maxZ = maxZ > ehZ ? maxZ : ehZ; + minX = rminX < rmaxX ? rminX : rmaxX; + minY = rminY < rmaxY ? rminY : rmaxY; + minZ = rminZ < rmaxZ ? rminZ : rmaxZ; + minX = minX < ehX ? minX : ehX; + minY = minY < ehY ? minY : ehY; + minZ = minZ < ehZ ? minZ : ehZ; + aabb._minX = tf._positionX + minX; + aabb._minY = tf._positionY + minY; + aabb._minZ = tf._positionZ + minZ; + aabb._maxX = tf._positionX + maxX; + aabb._maxY = tf._positionY + maxY; + aabb._maxZ = tf._positionZ + maxZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + var dx = dir.x; + var dy = dir.y; + var dz = dir.z; + if(dy > 0 && dy * dy > this.sinTheta * this.sinTheta * (dx * dx + dy * dy + dz * dz)) { + out.init(0,this._halfHeight - this._gjkMargin / this.sinTheta,0); + if(out.y < 0) { + out.y = 0; + } + return; + } + var rx = dir.x; + var rz = dir.z; + var len = rx * rx + rz * rz; + var height = 2 * this._halfHeight; + var coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; + if(coreRadius < 0) { + coreRadius = 0; + } + var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + var coreHalfHeight = this._halfHeight - this._gjkMargin; + if(coreHalfHeight < 0) { + coreHalfHeight = 0; + } + out.x = rx * invLen; + out.y = -coreHalfHeight; + out.z = rz * invLen; + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var p1y = beginY; + var halfH = this._halfHeight; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; + var tminy = 0; + var tmaxy = 1; + if(dy > -1e-6 && dy < 1e-6) { + if(beginY <= -halfH || beginY >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t1 = (-halfH - beginY) * invDy; + var t2 = (halfH - beginY) * invDy; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminy = t1; + } + if(t2 < 1) { + tmaxy = t2; + } + } + if(tminy >= 1 || tmaxy <= 0) { + return false; + } + var tminxz = 0; + var tmaxxz = 0; + p1y = beginY - halfH; + var cos2 = this.cosTheta * this.cosTheta; + var a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; + var b = cos2 * (beginX * dx + p1y * dy + beginZ * dz) - p1y * dy; + var c = cos2 * (beginX * beginX + p1y * p1y + beginZ * beginZ) - p1y * p1y; + var D = b * b - a * c; + if(a != 0) { + if(D < 0) { + return false; + } + var sqrtD = Math.sqrt(D); + if(a < 0) { + if(dy > 0) { + tminxz = 0; + tmaxxz = (-b + sqrtD) / a; + if(tmaxxz <= 0) { + return false; + } + } else { + tminxz = (-b - sqrtD) / a; + tmaxxz = 1; + if(tminxz >= 1) { + return false; + } + } + } else { + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } + } else { + var t = -c / (2 * b); + if(b > 0) { + tminxz = 0; + tmaxxz = t; + if(t <= 0) { + return false; + } + } else { + tminxz = t; + tmaxxz = 1; + if(t >= 1) { + return false; + } + } + } + p1y += halfH; + var min; + if(tmaxxz <= tminy || tmaxy <= tminxz) { + return false; + } + if(tminxz < tminy) { + min = tminy; + if(min == 0) { + return false; + } + hit.normal.init(0,dy > 0 ? -1 : 1,0); + } else { + min = tminxz; + if(min == 0) { + return false; + } + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + var s = this.cosTheta; + _this.x *= s; + _this.y *= s; + _this.z *= s; + hit.normal.y += this.sinTheta; + } + hit.position.init(beginX + min * dx,p1y + min * dy,beginZ + min * dz); + hit.fraction = min; + return true; + } + ,__class__: oimo_collision_geometry_ConeGeometry +}); +var oimo_collision_geometry_ConvexHullGeometry = function(vertices) { + oimo_collision_geometry_ConvexGeometry.call(this,5); + this._numVertices = vertices.length; + this._vertices = new Array(this._numVertices); + this._tmpVertices = new Array(this._numVertices); + var _g = 0; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + this._vertices[i] = vertices[i]; + this._tmpVertices[i] = new oimo_common_Vec3(); + } + this._useGjkRayCast = true; + this._updateMass(); +}; +oimo_collision_geometry_ConvexHullGeometry.__name__ = true; +oimo_collision_geometry_ConvexHullGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getVertices: function() { + return this._vertices; + } + ,_updateMass: function() { + this._volume = 1; + this._inertiaCoeff00 = 1; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 1; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 1; + var minx = this._vertices[0].x; + var miny = this._vertices[0].y; + var minz = this._vertices[0].z; + var maxx = this._vertices[0].x; + var maxy = this._vertices[0].y; + var maxz = this._vertices[0].z; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + var vx = this._vertices[i].x; + var vy = this._vertices[i].y; + var vz = this._vertices[i].z; + if(vx < minx) { + minx = vx; + } else if(vx > maxx) { + maxx = vx; + } + if(vy < miny) { + miny = vy; + } else if(vy > maxy) { + maxy = vy; + } + if(vz < minz) { + minz = vz; + } else if(vz > maxz) { + maxz = vz; + } + } + var sizex = maxx - minx; + var sizey = maxy - miny; + var sizez = maxz - minz; + this._volume = sizex * sizey * sizez; + var diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; + sizex = sizex * sizex * 0.25; + sizey = sizey * sizey * 0.25; + sizez = sizez * sizez * 0.25; + this._inertiaCoeff00 = 0.33333333333333331 * (sizey + sizez) + diffCog; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.33333333333333331 * (sizez + sizex) + diffCog; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.33333333333333331 * (sizex + sizey) + diffCog; + } + ,_computeAabb: function(aabb,tf) { + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + var marginX; + var marginY; + var marginZ; + marginX = this._gjkMargin; + marginY = this._gjkMargin; + marginZ = this._gjkMargin; + var localVX; + var localVY; + var localVZ; + var v = this._vertices[0]; + localVX = v.x; + localVY = v.y; + localVZ = v.z; + var worldVX; + var worldVY; + var worldVZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X; + worldVY = __tmp__Y; + worldVZ = __tmp__Z; + worldVX += tf._positionX; + worldVY += tf._positionY; + worldVZ += tf._positionZ; + minX = worldVX; + minY = worldVY; + minZ = worldVZ; + maxX = worldVX; + maxY = worldVY; + maxZ = worldVZ; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var v1 = this._vertices[_g++]; + localVX = v1.x; + localVY = v1.y; + localVZ = v1.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y1 = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z1 = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X1; + worldVY = __tmp__Y1; + worldVZ = __tmp__Z1; + worldVX += tf._positionX; + worldVY += tf._positionY; + worldVZ += tf._positionZ; + minX = minX < worldVX ? minX : worldVX; + minY = minY < worldVY ? minY : worldVY; + minZ = minZ < worldVZ ? minZ : worldVZ; + maxX = maxX > worldVX ? maxX : worldVX; + maxY = maxY > worldVY ? maxY : worldVY; + maxZ = maxZ > worldVZ ? maxZ : worldVZ; + } + aabb._minX = minX - marginX; + aabb._minY = minY - marginY; + aabb._minZ = minZ - marginZ; + aabb._maxX = maxX + marginX; + aabb._maxY = maxY + marginY; + aabb._maxZ = maxZ + marginZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + var _this = this._vertices[0]; + var maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; + var maxIndex = 0; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + var _this1 = this._vertices[i]; + var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; + if(dot > maxDot) { + maxDot = dot; + maxIndex = i; + } + } + var v = this._vertices[maxIndex]; + out.x = v.x; + out.y = v.y; + out.z = v.z; + } + ,__class__: oimo_collision_geometry_ConvexHullGeometry +}); +var oimo_collision_geometry_CylinderGeometry = function(radius,halfHeight) { + oimo_collision_geometry_ConvexGeometry.call(this,2); + this._radius = radius; + this._halfHeight = halfHeight; + this._updateMass(); +}; +oimo_collision_geometry_CylinderGeometry.__name__ = true; +oimo_collision_geometry_CylinderGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getRadius: function() { + return this._radius; + } + ,getHalfHeight: function() { + return this._halfHeight; + } + ,_updateMass: function() { + var r2 = this._radius * this._radius; + var h2 = this._halfHeight * this._halfHeight * 4; + this._volume = 3.14159265358979 * r2 * this._halfHeight * 2; + this._inertiaCoeff00 = 0.083333333333333329 * (3 * r2 + h2); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.5 * r2; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.083333333333333329 * (3 * r2 + h2); + } + ,_computeAabb: function(aabb,tf) { + var axisX; + var axisY; + var axisZ; + var axis2X; + var axis2Y; + var axis2Z; + var ehX; + var ehY; + var ehZ; + var erX; + var erY; + var erZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axisX = axisX < 0 ? -axisX : axisX; + axisY = axisY < 0 ? -axisY : axisY; + axisZ = axisZ < 0 ? -axisZ : axisZ; + axis2X = axisX * axisX; + axis2Y = axisY * axisY; + axis2Z = axisZ * axisZ; + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); + erX *= this._radius; + erY *= this._radius; + erZ *= this._radius; + ehX = axisX * this._halfHeight; + ehY = axisY * this._halfHeight; + ehZ = axisZ * this._halfHeight; + var maxX; + var maxY; + var maxZ; + maxX = erX + ehX; + maxY = erY + ehY; + maxZ = erZ + ehZ; + aabb._minX = tf._positionX - maxX; + aabb._minY = tf._positionY - maxY; + aabb._minZ = tf._positionZ - maxZ; + aabb._maxX = tf._positionX + maxX; + aabb._maxY = tf._positionY + maxY; + aabb._maxZ = tf._positionZ + maxZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + var rx = dir.x; + var rz = dir.z; + var len = rx * rx + rz * rz; + var coreRadius = this._radius - this._gjkMargin; + if(coreRadius < 0) { + coreRadius = 0; + } + var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + var coreHeight = this._halfHeight - this._gjkMargin; + if(coreHeight < 0) { + coreHeight = 0; + } + out.x = rx * invLen; + out.y = dir.y > 0 ? coreHeight : -coreHeight; + out.z = rz * invLen; + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var halfH = this._halfHeight; + var dx = endX - beginX; + var dy = endY - beginY; + var dz = endZ - beginZ; + var tminy = 0; + var tmaxy = 1; + if(dy > -1e-6 && dy < 1e-6) { + if(beginY <= -halfH || beginY >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t1 = (-halfH - beginY) * invDy; + var t2 = (halfH - beginY) * invDy; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminy = t1; + } + if(t2 < 1) { + tmaxy = t2; + } + } + if(tminy >= 1 || tmaxy <= 0) { + return false; + } + var tminxz = 0; + var tmaxxz = 1; + var a = dx * dx + dz * dz; + var b = beginX * dx + beginZ * dz; + var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + var D = b * b - a * c; + if(D < 0) { + return false; + } + if(a > 0) { + var sqrtD = Math.sqrt(D); + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } else { + if(c >= 0) { + return false; + } + tminxz = 0; + tmaxxz = 1; + } + var min; + if(tmaxxz <= tminy || tmaxy <= tminxz) { + return false; + } + if(tminxz < tminy) { + min = tminy; + if(min == 0) { + return false; + } + hit.normal.init(0,dy > 0 ? -1 : 1,0); + } else { + min = tminxz; + if(min == 0) { + return false; + } + var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + } + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); + hit.fraction = min; + return true; + } + ,__class__: oimo_collision_geometry_CylinderGeometry +}); +var oimo_collision_geometry_GeometryType = function() { }; +oimo_collision_geometry_GeometryType.__name__ = true; +var oimo_collision_geometry_RayCastHit = function() { + this.position = new oimo_common_Vec3(); + this.normal = new oimo_common_Vec3(); + this.fraction = 0; +}; +oimo_collision_geometry_RayCastHit.__name__ = true; +oimo_collision_geometry_RayCastHit.prototype = { + __class__: oimo_collision_geometry_RayCastHit +}; +var oimo_collision_geometry_SphereGeometry = function(radius) { + oimo_collision_geometry_ConvexGeometry.call(this,0); + this._radius = radius; + this._gjkMargin = this._radius; + this._updateMass(); +}; +oimo_collision_geometry_SphereGeometry.__name__ = true; +oimo_collision_geometry_SphereGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; +oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ + getRadius: function() { + return this._radius; + } + ,_updateMass: function() { + this._volume = 4.1887902047863861 * this._radius * this._radius * this._radius; + this._inertiaCoeff00 = 0.4 * this._radius * this._radius; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.4 * this._radius * this._radius; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.4 * this._radius * this._radius; + } + ,_computeAabb: function(aabb,tf) { + var radVecX; + var radVecY; + var radVecZ; + radVecX = this._radius; + radVecY = this._radius; + radVecZ = this._radius; + aabb._minX = tf._positionX - radVecX; + aabb._minY = tf._positionY - radVecY; + aabb._minZ = tf._positionZ - radVecZ; + aabb._maxX = tf._positionX + radVecX; + aabb._maxY = tf._positionY + radVecY; + aabb._maxZ = tf._positionZ + radVecZ; + } + ,computeLocalSupportingVertex: function(dir,out) { + out.zero(); + } + ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var dX; + var dY; + var dZ; + dX = endX - beginX; + dY = endY - beginY; + dZ = endZ - beginZ; + var a = dX * dX + dY * dY + dZ * dZ; + var b = beginX * dX + beginY * dY + beginZ * dZ; + var D = b * b - a * (beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius); + if(D < 0) { + return false; + } + var t = (-b - Math.sqrt(D)) / a; + if(t < 0 || t > 1) { + return false; + } + var hitPosX; + var hitPosY; + var hitPosZ; + var hitNormalX; + var hitNormalY; + var hitNormalZ; + hitPosX = beginX + dX * t; + hitPosY = beginY + dY * t; + hitPosZ = beginZ + dZ * t; + var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + hitNormalX = hitPosX * l; + hitNormalY = hitPosY * l; + hitNormalZ = hitPosZ * l; + var v = hit.position; + v.x = hitPosX; + v.y = hitPosY; + v.z = hitPosZ; + var v1 = hit.normal; + v1.x = hitNormalX; + v1.y = hitNormalY; + v1.z = hitNormalZ; + hit.fraction = t; + return true; + } + ,__class__: oimo_collision_geometry_SphereGeometry +}); +var oimo_collision_narrowphase_CollisionMatrix = function() { + this.detectors = new Array(8); + this.detectors[0] = new Array(8); + this.detectors[1] = new Array(8); + this.detectors[2] = new Array(8); + this.detectors[3] = new Array(8); + this.detectors[4] = new Array(8); + this.detectors[5] = new Array(8); + var gjkEpaDetector = new oimo_collision_narrowphase_detector_GjkEpaDetector(); + this.detectors[0][0] = new oimo_collision_narrowphase_detector_SphereSphereDetector(); + this.detectors[0][1] = new oimo_collision_narrowphase_detector_SphereBoxDetector(false); + this.detectors[0][2] = gjkEpaDetector; + this.detectors[0][3] = gjkEpaDetector; + this.detectors[0][4] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(false); + this.detectors[0][5] = gjkEpaDetector; + this.detectors[1][0] = new oimo_collision_narrowphase_detector_SphereBoxDetector(true); + this.detectors[1][1] = new oimo_collision_narrowphase_detector_BoxBoxDetector(); + this.detectors[1][2] = gjkEpaDetector; + this.detectors[1][3] = gjkEpaDetector; + this.detectors[1][4] = gjkEpaDetector; + this.detectors[1][5] = gjkEpaDetector; + this.detectors[2][0] = gjkEpaDetector; + this.detectors[2][1] = gjkEpaDetector; + this.detectors[2][2] = gjkEpaDetector; + this.detectors[2][3] = gjkEpaDetector; + this.detectors[2][4] = gjkEpaDetector; + this.detectors[2][5] = gjkEpaDetector; + this.detectors[3][0] = gjkEpaDetector; + this.detectors[3][1] = gjkEpaDetector; + this.detectors[3][2] = gjkEpaDetector; + this.detectors[3][3] = gjkEpaDetector; + this.detectors[3][4] = gjkEpaDetector; + this.detectors[3][5] = gjkEpaDetector; + this.detectors[4][0] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(true); + this.detectors[4][1] = gjkEpaDetector; + this.detectors[4][2] = gjkEpaDetector; + this.detectors[4][3] = gjkEpaDetector; + this.detectors[4][4] = new oimo_collision_narrowphase_detector_CapsuleCapsuleDetector(); + this.detectors[4][5] = gjkEpaDetector; + this.detectors[5][0] = gjkEpaDetector; + this.detectors[5][1] = gjkEpaDetector; + this.detectors[5][2] = gjkEpaDetector; + this.detectors[5][3] = gjkEpaDetector; + this.detectors[5][4] = gjkEpaDetector; + this.detectors[5][5] = gjkEpaDetector; +}; +oimo_collision_narrowphase_CollisionMatrix.__name__ = true; +oimo_collision_narrowphase_CollisionMatrix.prototype = { + getDetector: function(geomType1,geomType2) { + return this.detectors[geomType1][geomType2]; + } + ,__class__: oimo_collision_narrowphase_CollisionMatrix +}; +var oimo_collision_narrowphase_DetectorResult = function() { + this.numPoints = 0; + this.normal = new oimo_common_Vec3(); + this.points = new Array(oimo_common_Setting.maxManifoldPoints); + this.incremental = false; + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.points[_g++] = new oimo_collision_narrowphase_DetectorResultPoint(); +}; +oimo_collision_narrowphase_DetectorResult.__name__ = true; +oimo_collision_narrowphase_DetectorResult.prototype = { + getMaxDepth: function() { + var max = 0; + var _g = 0; + var _g1 = this.numPoints; + while(_g < _g1) { + var i = _g++; + if(this.points[i].depth > max) { + max = this.points[i].depth; + } + } + return max; + } + ,clear: function() { + this.numPoints = 0; + var _g = 0; + var _g1 = this.points; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.position1.zero(); + p.position2.zero(); + p.depth = 0; + p.id = 0; + } + this.normal.zero(); + } + ,__class__: oimo_collision_narrowphase_DetectorResult +}; +var oimo_collision_narrowphase_DetectorResultPoint = function() { + this.position1 = new oimo_common_Vec3(); + this.position2 = new oimo_common_Vec3(); + this.depth = 0; + this.id = 0; +}; +oimo_collision_narrowphase_DetectorResultPoint.__name__ = true; +oimo_collision_narrowphase_DetectorResultPoint.prototype = { + __class__: oimo_collision_narrowphase_DetectorResultPoint +}; +var oimo_collision_narrowphase_detector_Detector = function(swapped) { + this.swapped = swapped; +}; +oimo_collision_narrowphase_detector_Detector.__name__ = true; +oimo_collision_narrowphase_detector_Detector.prototype = { + setNormal: function(result,nX,nY,nZ) { + var v = result.normal; + v.x = nX; + v.y = nY; + v.z = nZ; + if(this.swapped) { + var _this = result.normal; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; + } + } + ,addPoint: function(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { + var p = result.points[result.numPoints++]; + p.depth = depth; + p.id = id; + if(this.swapped) { + var v = p.position1; + v.x = pos2X; + v.y = pos2Y; + v.z = pos2Z; + var v1 = p.position2; + v1.x = pos1X; + v1.y = pos1Y; + v1.z = pos1Z; + } else { + var v2 = p.position1; + v2.x = pos1X; + v2.y = pos1Y; + v2.z = pos1Z; + var v3 = p.position2; + v3.x = pos2X; + v3.y = pos2Y; + v3.z = pos2Z; + } + } + ,detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + } + ,detect: function(result,geom1,geom2,transform1,transform2,cachedData) { + result.numPoints = 0; + var _g = 0; + var _g1 = result.points; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.position1.zero(); + p.position2.zero(); + p.depth = 0; + p.id = 0; + } + result.normal.zero(); + if(this.swapped) { + this.detectImpl(result,geom2,geom1,transform2,transform1,cachedData); + } else { + this.detectImpl(result,geom1,geom2,transform1,transform2,cachedData); + } + } + ,__class__: oimo_collision_narrowphase_detector_Detector +}; +var oimo_collision_narrowphase_detector_BoxBoxDetector = function() { + oimo_collision_narrowphase_detector_Detector.call(this,false); + this.clipper = new oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper(); +}; +oimo_collision_narrowphase_detector_BoxBoxDetector.__name__ = true; +oimo_collision_narrowphase_detector_BoxBoxDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + var b1 = geom1; + var b2 = geom2; + result.incremental = false; + var c1X; + var c1Y; + var c1Z; + var c2X; + var c2Y; + var c2Z; + var c12X; + var c12Y; + var c12Z; + c1X = tf1._positionX; + c1Y = tf1._positionY; + c1Z = tf1._positionZ; + c2X = tf2._positionX; + c2Y = tf2._positionY; + c2Z = tf2._positionZ; + c12X = c2X - c1X; + c12Y = c2Y - c1Y; + c12Z = c2Z - c1Z; + var x1X; + var x1Y; + var x1Z; + var y1X; + var y1Y; + var y1Z; + var z1X; + var z1Y; + var z1Z; + var x2X; + var x2Y; + var x2Z; + var y2X; + var y2Y; + var y2Z; + var z2X; + var z2Y; + var z2Z; + x1X = tf1._rotation00; + x1Y = tf1._rotation10; + x1Z = tf1._rotation20; + y1X = tf1._rotation01; + y1Y = tf1._rotation11; + y1Z = tf1._rotation21; + z1X = tf1._rotation02; + z1Y = tf1._rotation12; + z1Z = tf1._rotation22; + x2X = tf2._rotation00; + x2Y = tf2._rotation10; + x2Z = tf2._rotation20; + y2X = tf2._rotation01; + y2Y = tf2._rotation11; + y2Z = tf2._rotation21; + z2X = tf2._rotation02; + z2Y = tf2._rotation12; + z2Z = tf2._rotation22; + var w1 = b1._halfExtentsX; + var h1 = b1._halfExtentsY; + var d1 = b1._halfExtentsZ; + var w2 = b2._halfExtentsX; + var h2 = b2._halfExtentsY; + var d2 = b2._halfExtentsZ; + var sx1X; + var sx1Y; + var sx1Z; + var sy1X; + var sy1Y; + var sy1Z; + var sz1X; + var sz1Y; + var sz1Z; + var sx2X; + var sx2Y; + var sx2Z; + var sy2X; + var sy2Y; + var sy2Z; + var sz2X; + var sz2Y; + var sz2Z; + sx1X = x1X * w1; + sx1Y = x1Y * w1; + sx1Z = x1Z * w1; + sy1X = y1X * h1; + sy1Y = y1Y * h1; + sy1Z = y1Z * h1; + sz1X = z1X * d1; + sz1Y = z1Y * d1; + sz1Z = z1Z * d1; + sx2X = x2X * w2; + sx2Y = x2Y * w2; + sx2Z = x2Z * w2; + sy2X = y2X * h2; + sy2Y = y2Y * h2; + sy2Z = y2Z * h2; + sz2X = z2X * d2; + sz2Y = z2Y * d2; + sz2Z = z2Z * d2; + var mDepth = 1e65536; + var mId = -1; + var mSign = 0; + var mAxisX; + var mAxisY; + var mAxisZ; + mAxisX = 0; + mAxisY = 0; + mAxisZ = 0; + var proj1 = w1; + var dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; + var dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; + var dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + if(dz < 0) { + dz = -dz; + } + var proj2 = dx + dy + dz; + var projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < 1e65536) { + mDepth = depth; + mId = 0; + mAxisX = x1X; + mAxisY = x1Y; + mAxisZ = x1Z; + mSign = neg ? -1 : 1; + } + } else { + return; + } + proj1 = h1; + var dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; + var dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; + var dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + if(dz1 < 0) { + dz1 = -dz1; + } + proj2 = dx1 + dy1 + dz1; + projC12 = y1X * c12X + y1Y * c12Y + y1Z * c12Z; + var sum1 = proj1 + proj2; + var neg1 = projC12 < 0; + var abs1 = neg1 ? -projC12 : projC12; + if(abs1 < sum1) { + var depth1 = sum1 - abs1; + if(depth1 < mDepth) { + mDepth = depth1; + mId = 1; + mAxisX = y1X; + mAxisY = y1Y; + mAxisZ = y1Z; + mSign = neg1 ? -1 : 1; + } + } else { + return; + } + proj1 = d1; + var dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; + var dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; + var dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; + if(dx2 < 0) { + dx2 = -dx2; + } + if(dy2 < 0) { + dy2 = -dy2; + } + if(dz2 < 0) { + dz2 = -dz2; + } + proj2 = dx2 + dy2 + dz2; + projC12 = z1X * c12X + z1Y * c12Y + z1Z * c12Z; + var sum2 = proj1 + proj2; + var neg2 = projC12 < 0; + var abs2 = neg2 ? -projC12 : projC12; + if(abs2 < sum2) { + var depth2 = sum2 - abs2; + if(depth2 < mDepth) { + mDepth = depth2; + mId = 2; + mAxisX = z1X; + mAxisY = z1Y; + mAxisZ = z1Z; + mSign = neg2 ? -1 : 1; + } + } else { + return; + } + if(mDepth > oimo_common_Setting.linearSlop) { + mDepth -= oimo_common_Setting.linearSlop; + } else { + mDepth = 0; + } + var dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; + var dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; + var dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; + if(dx3 < 0) { + dx3 = -dx3; + } + if(dy3 < 0) { + dy3 = -dy3; + } + if(dz3 < 0) { + dz3 = -dz3; + } + proj1 = dx3 + dy3 + dz3; + proj2 = w2; + projC12 = x2X * c12X + x2Y * c12Y + x2Z * c12Z; + var sum3 = proj1 + proj2; + var neg3 = projC12 < 0; + var abs3 = neg3 ? -projC12 : projC12; + if(abs3 < sum3) { + var depth3 = sum3 - abs3; + if(depth3 < mDepth) { + mDepth = depth3; + mId = 3; + mAxisX = x2X; + mAxisY = x2Y; + mAxisZ = x2Z; + mSign = neg3 ? -1 : 1; + } + } else { + return; + } + var dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; + var dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; + var dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; + if(dx4 < 0) { + dx4 = -dx4; + } + if(dy4 < 0) { + dy4 = -dy4; + } + if(dz4 < 0) { + dz4 = -dz4; + } + proj1 = dx4 + dy4 + dz4; + proj2 = h2; + projC12 = y2X * c12X + y2Y * c12Y + y2Z * c12Z; + var sum4 = proj1 + proj2; + var neg4 = projC12 < 0; + var abs4 = neg4 ? -projC12 : projC12; + if(abs4 < sum4) { + var depth4 = sum4 - abs4; + if(depth4 < mDepth) { + mDepth = depth4; + mId = 4; + mAxisX = y2X; + mAxisY = y2Y; + mAxisZ = y2Z; + mSign = neg4 ? -1 : 1; + } + } else { + return; + } + var dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; + var dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; + var dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; + if(dx5 < 0) { + dx5 = -dx5; + } + if(dy5 < 0) { + dy5 = -dy5; + } + if(dz5 < 0) { + dz5 = -dz5; + } + proj1 = dx5 + dy5 + dz5; + proj2 = d2; + projC12 = z2X * c12X + z2Y * c12Y + z2Z * c12Z; + var sum5 = proj1 + proj2; + var neg5 = projC12 < 0; + var abs5 = neg5 ? -projC12 : projC12; + if(abs5 < sum5) { + var depth5 = sum5 - abs5; + if(depth5 < mDepth) { + mDepth = depth5; + mId = 5; + mAxisX = z2X; + mAxisY = z2Y; + mAxisZ = z2Z; + mSign = neg5 ? -1 : 1; + } + } else { + return; + } + if(mDepth > oimo_common_Setting.linearSlop) { + mDepth -= oimo_common_Setting.linearSlop; + } else { + mDepth = 0; + } + var edgeAxisX; + var edgeAxisY; + var edgeAxisZ; + edgeAxisX = x1Y * x2Z - x1Z * x2Y; + edgeAxisY = x1Z * x2X - x1X * x2Z; + edgeAxisZ = x1X * x2Y - x1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx6 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy6 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx6 < 0) { + dx6 = -dx6; + } + if(dy6 < 0) { + dy6 = -dy6; + } + proj1 = dx6 + dy6; + var dx7 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy7 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx7 < 0) { + dx7 = -dx7; + } + if(dy7 < 0) { + dy7 = -dy7; + } + proj2 = dx7 + dy7; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum6 = proj1 + proj2; + var neg6 = projC12 < 0; + var abs6 = neg6 ? -projC12 : projC12; + if(abs6 < sum6) { + var depth6 = sum6 - abs6; + if(depth6 < mDepth) { + mDepth = depth6; + mId = 6; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg6 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = x1Y * y2Z - x1Z * y2Y; + edgeAxisY = x1Z * y2X - x1X * y2Z; + edgeAxisZ = x1X * y2Y - x1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l1 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + edgeAxisX *= l1; + edgeAxisY *= l1; + edgeAxisZ *= l1; + var dx8 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy8 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx8 < 0) { + dx8 = -dx8; + } + if(dy8 < 0) { + dy8 = -dy8; + } + proj1 = dx8 + dy8; + var dx9 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy9 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx9 < 0) { + dx9 = -dx9; + } + if(dy9 < 0) { + dy9 = -dy9; + } + proj2 = dx9 + dy9; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum7 = proj1 + proj2; + var neg7 = projC12 < 0; + var abs7 = neg7 ? -projC12 : projC12; + if(abs7 < sum7) { + var depth7 = sum7 - abs7; + if(depth7 < mDepth) { + mDepth = depth7; + mId = 7; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg7 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = x1Y * z2Z - x1Z * z2Y; + edgeAxisY = x1Z * z2X - x1X * z2Z; + edgeAxisZ = x1X * z2Y - x1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l2 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + edgeAxisX *= l2; + edgeAxisY *= l2; + edgeAxisZ *= l2; + var dx10 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy10 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx10 < 0) { + dx10 = -dx10; + } + if(dy10 < 0) { + dy10 = -dy10; + } + proj1 = dx10 + dy10; + var dx11 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy11 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx11 < 0) { + dx11 = -dx11; + } + if(dy11 < 0) { + dy11 = -dy11; + } + proj2 = dx11 + dy11; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum8 = proj1 + proj2; + var neg8 = projC12 < 0; + var abs8 = neg8 ? -projC12 : projC12; + if(abs8 < sum8) { + var depth8 = sum8 - abs8; + if(depth8 < mDepth) { + mDepth = depth8; + mId = 8; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg8 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * x2Z - y1Z * x2Y; + edgeAxisY = y1Z * x2X - y1X * x2Z; + edgeAxisZ = y1X * x2Y - y1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l3 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + edgeAxisX *= l3; + edgeAxisY *= l3; + edgeAxisZ *= l3; + var dx12 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy12 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx12 < 0) { + dx12 = -dx12; + } + if(dy12 < 0) { + dy12 = -dy12; + } + proj1 = dx12 + dy12; + var dx13 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy13 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx13 < 0) { + dx13 = -dx13; + } + if(dy13 < 0) { + dy13 = -dy13; + } + proj2 = dx13 + dy13; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum9 = proj1 + proj2; + var neg9 = projC12 < 0; + var abs9 = neg9 ? -projC12 : projC12; + if(abs9 < sum9) { + var depth9 = sum9 - abs9; + if(depth9 < mDepth) { + mDepth = depth9; + mId = 9; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg9 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * y2Z - y1Z * y2Y; + edgeAxisY = y1Z * y2X - y1X * y2Z; + edgeAxisZ = y1X * y2Y - y1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l4 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + edgeAxisX *= l4; + edgeAxisY *= l4; + edgeAxisZ *= l4; + var dx14 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy14 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx14 < 0) { + dx14 = -dx14; + } + if(dy14 < 0) { + dy14 = -dy14; + } + proj1 = dx14 + dy14; + var dx15 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy15 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx15 < 0) { + dx15 = -dx15; + } + if(dy15 < 0) { + dy15 = -dy15; + } + proj2 = dx15 + dy15; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum10 = proj1 + proj2; + var neg10 = projC12 < 0; + var abs10 = neg10 ? -projC12 : projC12; + if(abs10 < sum10) { + var depth10 = sum10 - abs10; + if(depth10 < mDepth) { + mDepth = depth10; + mId = 10; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg10 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * z2Z - y1Z * z2Y; + edgeAxisY = y1Z * z2X - y1X * z2Z; + edgeAxisZ = y1X * z2Y - y1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l5 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + edgeAxisX *= l5; + edgeAxisY *= l5; + edgeAxisZ *= l5; + var dx16 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy16 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx16 < 0) { + dx16 = -dx16; + } + if(dy16 < 0) { + dy16 = -dy16; + } + proj1 = dx16 + dy16; + var dx17 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy17 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx17 < 0) { + dx17 = -dx17; + } + if(dy17 < 0) { + dy17 = -dy17; + } + proj2 = dx17 + dy17; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum11 = proj1 + proj2; + var neg11 = projC12 < 0; + var abs11 = neg11 ? -projC12 : projC12; + if(abs11 < sum11) { + var depth11 = sum11 - abs11; + if(depth11 < mDepth) { + mDepth = depth11; + mId = 11; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg11 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * x2Z - z1Z * x2Y; + edgeAxisY = z1Z * x2X - z1X * x2Z; + edgeAxisZ = z1X * x2Y - z1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l6 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l6 > 0) { + l6 = 1 / Math.sqrt(l6); + } + edgeAxisX *= l6; + edgeAxisY *= l6; + edgeAxisZ *= l6; + var dx18 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy18 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx18 < 0) { + dx18 = -dx18; + } + if(dy18 < 0) { + dy18 = -dy18; + } + proj1 = dx18 + dy18; + var dx19 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy19 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx19 < 0) { + dx19 = -dx19; + } + if(dy19 < 0) { + dy19 = -dy19; + } + proj2 = dx19 + dy19; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum12 = proj1 + proj2; + var neg12 = projC12 < 0; + var abs12 = neg12 ? -projC12 : projC12; + if(abs12 < sum12) { + var depth12 = sum12 - abs12; + if(depth12 < mDepth) { + mDepth = depth12; + mId = 12; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg12 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * y2Z - z1Z * y2Y; + edgeAxisY = z1Z * y2X - z1X * y2Z; + edgeAxisZ = z1X * y2Y - z1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l7 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l7 > 0) { + l7 = 1 / Math.sqrt(l7); + } + edgeAxisX *= l7; + edgeAxisY *= l7; + edgeAxisZ *= l7; + var dx20 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy20 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx20 < 0) { + dx20 = -dx20; + } + if(dy20 < 0) { + dy20 = -dy20; + } + proj1 = dx20 + dy20; + var dx21 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy21 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx21 < 0) { + dx21 = -dx21; + } + if(dy21 < 0) { + dy21 = -dy21; + } + proj2 = dx21 + dy21; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum13 = proj1 + proj2; + var neg13 = projC12 < 0; + var abs13 = neg13 ? -projC12 : projC12; + if(abs13 < sum13) { + var depth13 = sum13 - abs13; + if(depth13 < mDepth) { + mDepth = depth13; + mId = 13; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg13 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * z2Z - z1Z * z2Y; + edgeAxisY = z1Z * z2X - z1X * z2Z; + edgeAxisZ = z1X * z2Y - z1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l8 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l8 > 0) { + l8 = 1 / Math.sqrt(l8); + } + edgeAxisX *= l8; + edgeAxisY *= l8; + edgeAxisZ *= l8; + var dx22 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy22 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx22 < 0) { + dx22 = -dx22; + } + if(dy22 < 0) { + dy22 = -dy22; + } + proj1 = dx22 + dy22; + var dx23 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy23 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx23 < 0) { + dx23 = -dx23; + } + if(dy23 < 0) { + dy23 = -dy23; + } + proj2 = dx23 + dy23; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum14 = proj1 + proj2; + var neg14 = projC12 < 0; + var abs14 = neg14 ? -projC12 : projC12; + if(abs14 < sum14) { + var depth14 = sum14 - abs14; + if(depth14 < mDepth) { + mDepth = depth14; + mId = 14; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg14 ? -1 : 1; + } + } else { + return; + } + } + if(mId >= 6) { + mAxisX *= mSign; + mAxisY *= mSign; + mAxisZ *= mSign; + var id1 = (mId - 6) / 3 | 0; + var id2 = mId - 6 - id1 * 3; + var p1X; + var p1Y; + var p1Z; + var p2X; + var p2Y; + var p2Z; + var d1X; + var d1Y; + var d1Z; + var d2X; + var d2Y; + var d2Z; + switch(id1) { + case 0: + d1X = x1X; + d1Y = x1Y; + d1Z = x1Z; + var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0) { + if(signY) { + p1X = sy1X + sz1X; + p1Y = sy1Y + sz1Y; + p1Z = sy1Z + sz1Z; + } else { + p1X = sy1X - sz1X; + p1Y = sy1Y - sz1Y; + p1Z = sy1Z - sz1Z; + } + } else if(signY) { + p1X = sz1X - sy1X; + p1Y = sz1Y - sy1Y; + p1Z = sz1Z - sy1Z; + } else { + p1X = sy1X + sz1X; + p1Y = sy1Y + sz1Y; + p1Z = sy1Z + sz1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + break; + case 1: + d1X = y1X; + d1Y = y1Y; + d1Z = y1Z; + var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { + if(signY1) { + p1X = sx1X + sz1X; + p1Y = sx1Y + sz1Y; + p1Z = sx1Z + sz1Z; + } else { + p1X = sx1X - sz1X; + p1Y = sx1Y - sz1Y; + p1Z = sx1Z - sz1Z; + } + } else if(signY1) { + p1X = sz1X - sx1X; + p1Y = sz1Y - sx1Y; + p1Z = sz1Z - sx1Z; + } else { + p1X = sx1X + sz1X; + p1Y = sx1Y + sz1Y; + p1Z = sx1Z + sz1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + break; + default: + d1X = z1X; + d1Y = z1Y; + d1Z = z1Z; + var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { + if(signY2) { + p1X = sx1X + sy1X; + p1Y = sx1Y + sy1Y; + p1Z = sx1Z + sy1Z; + } else { + p1X = sx1X - sy1X; + p1Y = sx1Y - sy1Y; + p1Z = sx1Z - sy1Z; + } + } else if(signY2) { + p1X = sy1X - sx1X; + p1Y = sy1Y - sx1Y; + p1Z = sy1Z - sx1Z; + } else { + p1X = sx1X + sy1X; + p1Y = sx1Y + sy1Y; + p1Z = sx1Z + sy1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + } + p1X = c1X + p1X; + p1Y = c1Y + p1Y; + p1Z = c1Z + p1Z; + switch(id2) { + case 0: + d2X = x2X; + d2Y = x2Y; + d2Z = x2Z; + var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0) { + if(signY3) { + p2X = sy2X + sz2X; + p2Y = sy2Y + sz2Y; + p2Z = sy2Z + sz2Z; + } else { + p2X = sy2X - sz2X; + p2Y = sy2Y - sz2Y; + p2Z = sy2Z - sz2Z; + } + } else if(signY3) { + p2X = sz2X - sy2X; + p2Y = sz2Y - sy2Y; + p2Z = sz2Z - sy2Z; + } else { + p2X = sy2X + sz2X; + p2Y = sy2Y + sz2Y; + p2Z = sy2Z + sz2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + break; + case 1: + d2X = y2X; + d2Y = y2Y; + d2Z = y2Z; + var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { + if(signY4) { + p2X = sx2X + sz2X; + p2Y = sx2Y + sz2Y; + p2Z = sx2Z + sz2Z; + } else { + p2X = sx2X - sz2X; + p2Y = sx2Y - sz2Y; + p2Z = sx2Z - sz2Z; + } + } else if(signY4) { + p2X = sz2X - sx2X; + p2Y = sz2Y - sx2Y; + p2Z = sz2Z - sx2Z; + } else { + p2X = sx2X + sz2X; + p2Y = sx2Y + sz2Y; + p2Z = sx2Z + sz2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + break; + default: + d2X = z2X; + d2Y = z2Y; + d2Z = z2Z; + var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { + if(signY5) { + p2X = sx2X + sy2X; + p2Y = sx2Y + sy2Y; + p2Z = sx2Z + sy2Z; + } else { + p2X = sx2X - sy2X; + p2Y = sx2Y - sy2Y; + p2Z = sx2Z - sy2Z; + } + } else if(signY5) { + p2X = sy2X - sx2X; + p2Y = sy2Y - sx2Y; + p2Z = sy2Z - sx2Z; + } else { + p2X = sx2X + sy2X; + p2Y = sx2Y + sy2Y; + p2Z = sx2Z + sy2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + } + p2X = c2X - p2X; + p2Y = c2Y - p2Y; + p2Z = c2Z - p2Z; + var rX; + var rY; + var rZ; + rX = p1X - p2X; + rY = p1Y - p2Y; + rZ = p1Z - p2Z; + var dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + var dot1r = d1X * rX + d1Y * rY + d1Z * rZ; + var dot2r = d2X * rX + d2Y * rY + d2Z * rZ; + var invDet = 1 / (1 - dot12 * dot12); + var t1 = (dot12 * dot2r - dot1r) * invDet; + var t2 = (dot2r - dot12 * dot1r) * invDet; + var cp1X; + var cp1Y; + var cp1Z; + var cp2X; + var cp2Y; + var cp2Z; + cp1X = p1X + d1X * t1; + cp1Y = p1Y + d1Y * t1; + cp1Z = p1Z + d1Z * t1; + cp2X = p2X + d2X * t2; + cp2Y = p2Y + d2Y * t2; + cp2Z = p2Z + d2Z * t2; + var normalX; + var normalY; + var normalZ; + normalX = -mAxisX; + normalY = -mAxisY; + normalZ = -mAxisZ; + this.setNormal(result,normalX,normalY,normalZ); + this.addPoint(result,cp1X,cp1Y,cp1Z,cp2X,cp2Y,cp2Z,mDepth,4); + return; + } + var tmpX; + var tmpY; + var tmpZ; + var swapped; + if(mId >= 3) { + mSign = -mSign; + c12X = -c12X; + c12Y = -c12Y; + c12Z = -c12Z; + var tmp = b1; + b1 = b2; + b2 = tmp; + var tmp1 = w1; + w1 = w2; + w2 = tmp1; + var tmp2 = h1; + h1 = h2; + h2 = tmp2; + var tmp3 = d1; + d1 = d2; + d2 = tmp3; + tmpX = c1X; + tmpY = c1Y; + tmpZ = c1Z; + c1X = c2X; + c1Y = c2Y; + c1Z = c2Z; + c2X = tmpX; + c2Y = tmpY; + c2Z = tmpZ; + tmpX = x1X; + tmpY = x1Y; + tmpZ = x1Z; + x1X = x2X; + x1Y = x2Y; + x1Z = x2Z; + x2X = tmpX; + x2Y = tmpY; + x2Z = tmpZ; + tmpX = y1X; + tmpY = y1Y; + tmpZ = y1Z; + y1X = y2X; + y1Y = y2Y; + y1Z = y2Z; + y2X = tmpX; + y2Y = tmpY; + y2Z = tmpZ; + tmpX = z1X; + tmpY = z1Y; + tmpZ = z1Z; + z1X = z2X; + z1Y = z2Y; + z1Z = z2Z; + z2X = tmpX; + z2Y = tmpY; + z2Z = tmpZ; + tmpX = sx1X; + tmpY = sx1Y; + tmpZ = sx1Z; + sx1X = sx2X; + sx1Y = sx2Y; + sx1Z = sx2Z; + sx2X = tmpX; + sx2Y = tmpY; + sx2Z = tmpZ; + tmpX = sy1X; + tmpY = sy1Y; + tmpZ = sy1Z; + sy1X = sy2X; + sy1Y = sy2Y; + sy1Z = sy2Z; + sy2X = tmpX; + sy2Y = tmpY; + sy2Z = tmpZ; + tmpX = sz1X; + tmpY = sz1Y; + tmpZ = sz1Z; + sz1X = sz2X; + sz1Y = sz2Y; + sz1Z = sz2Z; + sz2X = tmpX; + sz2Y = tmpY; + sz2Z = tmpZ; + mId -= 3; + swapped = true; + } else { + swapped = false; + } + var refCenterX; + var refCenterY; + var refCenterZ; + var refNormalX; + var refNormalY; + var refNormalZ; + var refXX; + var refXY; + var refXZ; + var refYX; + var refYY; + var refYZ; + var refW; + var refH; + switch(mId) { + case 0: + refCenterX = sx1X; + refCenterY = sx1Y; + refCenterZ = sx1Z; + refNormalX = x1X; + refNormalY = x1Y; + refNormalZ = x1Z; + refXX = y1X; + refXY = y1Y; + refXZ = y1Z; + refYX = z1X; + refYY = z1Y; + refYZ = z1Z; + refW = h1; + refH = d1; + break; + case 1: + refCenterX = sy1X; + refCenterY = sy1Y; + refCenterZ = sy1Z; + refNormalX = y1X; + refNormalY = y1Y; + refNormalZ = y1Z; + refXX = z1X; + refXY = z1Y; + refXZ = z1Z; + refYX = x1X; + refYY = x1Y; + refYZ = x1Z; + refW = d1; + refH = w1; + break; + default: + refCenterX = sz1X; + refCenterY = sz1Y; + refCenterZ = sz1Z; + refNormalX = z1X; + refNormalY = z1Y; + refNormalZ = z1Z; + refXX = x1X; + refXY = x1Y; + refXZ = x1Z; + refYX = y1X; + refYY = y1Y; + refYZ = y1Z; + refW = w1; + refH = h1; + } + if(mSign < 0) { + refCenterX = -refCenterX; + refCenterY = -refCenterY; + refCenterZ = -refCenterZ; + refNormalX = -refNormalX; + refNormalY = -refNormalY; + refNormalZ = -refNormalZ; + tmpX = refXX; + tmpY = refXY; + tmpZ = refXZ; + refXX = refYX; + refXY = refYY; + refXZ = refYZ; + refYX = tmpX; + refYY = tmpY; + refYZ = tmpZ; + var tmp4 = refW; + refW = refH; + refH = tmp4; + } + refCenterX += c1X; + refCenterY += c1Y; + refCenterZ += c1Z; + var minIncDot = 1; + var incId = 0; + var incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 0; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 1; + } + incDot = refNormalX * y2X + refNormalY * y2Y + refNormalZ * y2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 2; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 3; + } + incDot = refNormalX * z2X + refNormalY * z2Y + refNormalZ * z2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 4; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 5; + } + var incV1X; + var incV1Y; + var incV1Z; + var incV2X; + var incV2Y; + var incV2Z; + var incV3X; + var incV3Y; + var incV3Z; + var incV4X; + var incV4Y; + var incV4Z; + switch(incId) { + case 0: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X - sy2X; + incV2Y = sx2Y - sy2Y; + incV2Z = sx2Z - sy2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X - sy2X; + incV3Y = sx2Y - sy2Y; + incV3Z = sx2Z - sy2Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X + sy2X; + incV4Y = sx2Y + sy2Y; + incV4Z = sx2Z + sy2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + break; + case 1: + incV1X = sy2X - sx2X; + incV1Y = sy2Y - sx2Y; + incV1Z = sy2Z - sx2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sy2X - sx2X; + incV2Y = sy2Y - sx2Y; + incV2Z = sy2Z - sx2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X + sy2X; + incV4Y = sx2Y + sy2Y; + incV4Z = sx2Z + sy2Z; + incV4X = -incV4X; + incV4Y = -incV4Y; + incV4Z = -incV4Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + case 2: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X + sy2X; + incV2Y = sx2Y + sy2Y; + incV2Z = sx2Z + sy2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sy2X - sx2X; + incV3Y = sy2Y - sx2Y; + incV3Z = sy2Z - sx2Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sy2X - sx2X; + incV4Y = sy2Y - sx2Y; + incV4Z = sy2Z - sx2Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + case 3: + incV1X = sx2X - sy2X; + incV1Y = sx2Y - sy2Y; + incV1Z = sx2Z - sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X + sy2X; + incV2Y = sx2Y + sy2Y; + incV2Z = sx2Z + sy2Z; + incV2X = -incV2X; + incV2Y = -incV2Y; + incV2Z = -incV2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X - sy2X; + incV4Y = sx2Y - sy2Y; + incV4Z = sx2Z - sy2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + break; + case 4: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sy2X - sx2X; + incV2Y = sy2Y - sx2Y; + incV2Z = sy2Z - sx2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X += sz2X; + incV3Y += sz2Y; + incV3Z += sz2Z; + incV4X = sx2X - sy2X; + incV4Y = sx2Y - sy2Y; + incV4Z = sx2Z - sy2Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + default: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X -= sz2X; + incV1Y -= sz2Y; + incV1Z -= sz2Z; + incV2X = sx2X - sy2X; + incV2Y = sx2Y - sy2Y; + incV2Z = sx2Z - sy2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sy2X - sx2X; + incV4Y = sy2Y - sx2Y; + incV4Z = sy2Z - sx2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + } + incV1X += c12X; + incV1Y += c12Y; + incV1Z += c12Z; + incV2X += c12X; + incV2Y += c12Y; + incV2Z += c12Z; + incV3X += c12X; + incV3Y += c12Y; + incV3Z += c12Z; + incV4X += c12X; + incV4Y += c12Y; + incV4Z += c12Z; + var _this = this.clipper; + _this.w = refW; + _this.h = refH; + _this.numVertices = 0; + _this.numTmpVertices = 0; + var _this1 = this.clipper; + var _this2 = _this1.vertices[_this1.numVertices++]; + _this2.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; + _this2.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; + _this2.wx = incV1X; + _this2.wy = incV1Y; + _this2.wz = incV1Z; + var _this3 = this.clipper; + var _this4 = _this3.vertices[_this3.numVertices++]; + _this4.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; + _this4.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; + _this4.wx = incV2X; + _this4.wy = incV2Y; + _this4.wz = incV2Z; + var _this5 = this.clipper; + var _this6 = _this5.vertices[_this5.numVertices++]; + _this6.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; + _this6.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; + _this6.wx = incV3X; + _this6.wy = incV3Y; + _this6.wz = incV3Z; + var _this7 = this.clipper; + var _this8 = _this7.vertices[_this7.numVertices++]; + _this8.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; + _this8.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; + _this8.wx = incV4X; + _this8.wy = incV4Y; + _this8.wz = incV4Z; + this.clipper.clip(); + this.clipper.reduce(); + var normalX1; + var normalY1; + var normalZ1; + if(swapped) { + normalX1 = refNormalX; + normalY1 = refNormalY; + normalZ1 = refNormalZ; + } else { + normalX1 = -refNormalX; + normalY1 = -refNormalY; + normalZ1 = -refNormalZ; + } + this.setNormal(result,normalX1,normalY1,normalZ1); + var _g = 0; + var _g1 = this.clipper.numVertices; + while(_g < _g1) { + var i = _g++; + var v = this.clipper.vertices[i]; + var clippedVertexX; + var clippedVertexY; + var clippedVertexZ; + clippedVertexX = v.wx; + clippedVertexY = v.wy; + clippedVertexZ = v.wz; + clippedVertexX += c1X; + clippedVertexY += c1Y; + clippedVertexZ += c1Z; + var clippedVertexToRefCenterX; + var clippedVertexToRefCenterY; + var clippedVertexToRefCenterZ; + clippedVertexToRefCenterX = refCenterX - clippedVertexX; + clippedVertexToRefCenterY = refCenterY - clippedVertexY; + clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; + var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; + var clippedVertexOnRefFaceX; + var clippedVertexOnRefFaceY; + var clippedVertexOnRefFaceZ; + clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth15; + clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth15; + clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth15; + if(depth15 > -oimo_common_Setting.contactPersistenceThreshold) { + if(swapped) { + this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth15,i); + } else { + this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth15,i); + } + } + } + } + ,__class__: oimo_collision_narrowphase_detector_BoxBoxDetector +}); +var oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex = function() { + this.x = 0; + this.y = 0; + this.wx = 0; + this.wy = 0; + this.wz = 0; +}; +oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex.__name__ = true; +oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex.prototype = { + __class__: oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex +}; +var oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper = function() { + this.w = 0; + this.h = 0; + this.numVertices = 0; + this.numTmpVertices = 0; + this.vertices = new Array(8); + this.tmpVertices = new Array(8); + this.vertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); +}; +oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.__name__ = true; +oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { + clip: function() { + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this.vertices[i]; + var v2 = this.vertices[(i + 1) % this.numVertices]; + var s1 = this.w + v1.x; + var s2 = this.w + v2.x; + if(s1 > 0 && s2 > 0) { + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.wx = v1.wx; + _this1.wy = v1.wy; + _this1.wz = v1.wz; + var t = s1 / (s1 - s2); + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = v1.x + (v2.x - v1.x) * t; + _this2.y = v1.y + (v2.y - v1.y) * t; + _this2.wx = v1.wx + (v2.wx - v1.wx) * t; + _this2.wy = v1.wy + (v2.wy - v1.wy) * t; + _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + var t1 = s1 / (s1 - s2); + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = v1.x + (v2.x - v1.x) * t1; + _this3.y = v1.y + (v2.y - v1.y) * t1; + _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; + _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; + _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + } + } + var tmp = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g2 = 0; + var _g11 = this.numVertices; + while(_g2 < _g11) { + var i1 = _g2++; + var v11 = this.vertices[i1]; + var v21 = this.vertices[(i1 + 1) % this.numVertices]; + var s11 = this.w - v11.x; + var s21 = this.w - v21.x; + if(s11 > 0 && s21 > 0) { + var _this4 = this.tmpVertices[this.numTmpVertices++]; + _this4.x = v11.x; + _this4.y = v11.y; + _this4.wx = v11.wx; + _this4.wy = v11.wy; + _this4.wz = v11.wz; + } else if(s11 > 0 && s21 <= 0) { + var _this5 = this.tmpVertices[this.numTmpVertices++]; + _this5.x = v11.x; + _this5.y = v11.y; + _this5.wx = v11.wx; + _this5.wy = v11.wy; + _this5.wz = v11.wz; + var t2 = s11 / (s11 - s21); + var _this6 = this.tmpVertices[this.numTmpVertices++]; + _this6.x = v11.x + (v21.x - v11.x) * t2; + _this6.y = v11.y + (v21.y - v11.y) * t2; + _this6.wx = v11.wx + (v21.wx - v11.wx) * t2; + _this6.wy = v11.wy + (v21.wy - v11.wy) * t2; + _this6.wz = v11.wz + (v21.wz - v11.wz) * t2; + } else if(s11 <= 0 && s21 > 0) { + var t3 = s11 / (s11 - s21); + var _this7 = this.tmpVertices[this.numTmpVertices++]; + _this7.x = v11.x + (v21.x - v11.x) * t3; + _this7.y = v11.y + (v21.y - v11.y) * t3; + _this7.wx = v11.wx + (v21.wx - v11.wx) * t3; + _this7.wy = v11.wy + (v21.wy - v11.wy) * t3; + _this7.wz = v11.wz + (v21.wz - v11.wz) * t3; + } + } + var tmp1 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp1; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g3 = 0; + var _g12 = this.numVertices; + while(_g3 < _g12) { + var i2 = _g3++; + var v12 = this.vertices[i2]; + var v22 = this.vertices[(i2 + 1) % this.numVertices]; + var s12 = this.h + v12.y; + var s22 = this.h + v22.y; + if(s12 > 0 && s22 > 0) { + var _this8 = this.tmpVertices[this.numTmpVertices++]; + _this8.x = v12.x; + _this8.y = v12.y; + _this8.wx = v12.wx; + _this8.wy = v12.wy; + _this8.wz = v12.wz; + } else if(s12 > 0 && s22 <= 0) { + var _this9 = this.tmpVertices[this.numTmpVertices++]; + _this9.x = v12.x; + _this9.y = v12.y; + _this9.wx = v12.wx; + _this9.wy = v12.wy; + _this9.wz = v12.wz; + var t4 = s12 / (s12 - s22); + var _this10 = this.tmpVertices[this.numTmpVertices++]; + _this10.x = v12.x + (v22.x - v12.x) * t4; + _this10.y = v12.y + (v22.y - v12.y) * t4; + _this10.wx = v12.wx + (v22.wx - v12.wx) * t4; + _this10.wy = v12.wy + (v22.wy - v12.wy) * t4; + _this10.wz = v12.wz + (v22.wz - v12.wz) * t4; + } else if(s12 <= 0 && s22 > 0) { + var t5 = s12 / (s12 - s22); + var _this11 = this.tmpVertices[this.numTmpVertices++]; + _this11.x = v12.x + (v22.x - v12.x) * t5; + _this11.y = v12.y + (v22.y - v12.y) * t5; + _this11.wx = v12.wx + (v22.wx - v12.wx) * t5; + _this11.wy = v12.wy + (v22.wy - v12.wy) * t5; + _this11.wz = v12.wz + (v22.wz - v12.wz) * t5; + } + } + var tmp2 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp2; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g4 = 0; + var _g13 = this.numVertices; + while(_g4 < _g13) { + var i3 = _g4++; + var v13 = this.vertices[i3]; + var v23 = this.vertices[(i3 + 1) % this.numVertices]; + var s13 = this.h - v13.y; + var s23 = this.h - v23.y; + if(s13 > 0 && s23 > 0) { + var _this12 = this.tmpVertices[this.numTmpVertices++]; + _this12.x = v13.x; + _this12.y = v13.y; + _this12.wx = v13.wx; + _this12.wy = v13.wy; + _this12.wz = v13.wz; + } else if(s13 > 0 && s23 <= 0) { + var _this13 = this.tmpVertices[this.numTmpVertices++]; + _this13.x = v13.x; + _this13.y = v13.y; + _this13.wx = v13.wx; + _this13.wy = v13.wy; + _this13.wz = v13.wz; + var t6 = s13 / (s13 - s23); + var _this14 = this.tmpVertices[this.numTmpVertices++]; + _this14.x = v13.x + (v23.x - v13.x) * t6; + _this14.y = v13.y + (v23.y - v13.y) * t6; + _this14.wx = v13.wx + (v23.wx - v13.wx) * t6; + _this14.wy = v13.wy + (v23.wy - v13.wy) * t6; + _this14.wz = v13.wz + (v23.wz - v13.wz) * t6; + } else if(s13 <= 0 && s23 > 0) { + var t7 = s13 / (s13 - s23); + var _this15 = this.tmpVertices[this.numTmpVertices++]; + _this15.x = v13.x + (v23.x - v13.x) * t7; + _this15.y = v13.y + (v23.y - v13.y) * t7; + _this15.wx = v13.wx + (v23.wx - v13.wx) * t7; + _this15.wy = v13.wy + (v23.wy - v13.wy) * t7; + _this15.wz = v13.wz + (v23.wz - v13.wz) * t7; + } + } + var tmp3 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp3; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + } + ,reduce: function() { + if(this.numVertices < 4) { + return; + } + var max1 = -1e65536; + var min1 = 1e65536; + var max2 = -1e65536; + var min2 = 1e65536; + var max1V = null; + var min1V = null; + var max2V = null; + var min2V = null; + var e1x = 1; + var e1y = 1; + var e2x = -1; + var e2y = 1; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var v = this.vertices[_g++]; + var dot1 = v.x * e1x + v.y * e1y; + var dot2 = v.x * e2x + v.y * e2y; + if(dot1 > max1) { + max1 = dot1; + max1V = v; + } + if(dot1 < min1) { + min1 = dot1; + min1V = v; + } + if(dot2 > max2) { + max2 = dot2; + max2V = v; + } + if(dot2 < min2) { + min2 = dot2; + min2V = v; + } + } + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = max1V.x; + _this.y = max1V.y; + _this.wx = max1V.wx; + _this.wy = max1V.wy; + _this.wz = max1V.wz; + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = max2V.x; + _this1.y = max2V.y; + _this1.wx = max2V.wx; + _this1.wy = max2V.wy; + _this1.wz = max2V.wz; + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = min1V.x; + _this2.y = min1V.y; + _this2.wx = min1V.wx; + _this2.wy = min1V.wy; + _this2.wz = min1V.wz; + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = min2V.x; + _this3.y = min2V.y; + _this3.wx = min2V.wx; + _this3.wy = min2V.wy; + _this3.wz = min2V.wz; + var tmp = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + } + ,__class__: oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper +}; +var oimo_collision_narrowphase_detector_BoxBoxDetectorMacro = function() { }; +oimo_collision_narrowphase_detector_BoxBoxDetectorMacro.__name__ = true; +var oimo_collision_narrowphase_detector_CachedDetectorData = function() { +}; +oimo_collision_narrowphase_detector_CachedDetectorData.__name__ = true; +oimo_collision_narrowphase_detector_CachedDetectorData.prototype = { + _clear: function() { + if(this._gjkCache != null) { + this._gjkCache.clear(); + } + } + ,__class__: oimo_collision_narrowphase_detector_CachedDetectorData +}; +var oimo_collision_narrowphase_detector_CapsuleCapsuleDetector = function() { + oimo_collision_narrowphase_detector_Detector.call(this,false); +}; +oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.__name__ = true; +oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + var c1 = geom1; + var c2 = geom2; + result.incremental = false; + var axis1X; + var axis1Y; + var axis1Z; + var axis2X; + var axis2Y; + var axis2Z; + axis1X = tf1._rotation01; + axis1Y = tf1._rotation11; + axis1Z = tf1._rotation21; + axis2X = tf2._rotation01; + axis2Y = tf2._rotation11; + axis2Z = tf2._rotation21; + var hh1 = c1._halfHeight; + var hh2 = c2._halfHeight; + var r1 = c1._radius; + var r2 = c2._radius; + var p1X; + var p1Y; + var p1Z; + var q1X; + var q1Y; + var q1Z; + var p2X; + var p2Y; + var p2Z; + var q2X; + var q2Y; + var q2Z; + p1X = tf1._positionX + axis1X * -hh1; + p1Y = tf1._positionY + axis1Y * -hh1; + p1Z = tf1._positionZ + axis1Z * -hh1; + q1X = tf1._positionX + axis1X * hh1; + q1Y = tf1._positionY + axis1Y * hh1; + q1Z = tf1._positionZ + axis1Z * hh1; + p2X = tf2._positionX + axis2X * -hh2; + p2Y = tf2._positionY + axis2Y * -hh2; + p2Z = tf2._positionZ + axis2Z * -hh2; + q2X = tf2._positionX + axis2X * hh2; + q2Y = tf2._positionY + axis2Y * hh2; + q2Z = tf2._positionZ + axis2Z * hh2; + var p12X; + var p12Y; + var p12Z; + p12X = p1X - p2X; + p12Y = p1Y - p2Y; + p12Z = p1Z - p2Z; + var d1X; + var d1Y; + var d1Z; + var d2X; + var d2Y; + var d2Z; + d1X = q1X - p1X; + d1Y = q1Y - p1Y; + d1Z = q1Z - p1Z; + d2X = q2X - p2X; + d2Y = q2Y - p2Y; + d2Z = q2Z - p2Z; + var p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); + var p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + var d11 = hh1 * hh1 * 4; + var d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + var d22 = hh2 * hh2 * 4; + var t1; + var t2; + if(d11 == 0 && d22 == 0) { + t1 = 0; + t2 = 0; + } else if(d11 == 0) { + t1 = 0; + t2 = p12d2; + if(p12d2 < 0) { + t2 = 0; + } else if(p12d2 > d22) { + t2 = 1; + } else { + t2 = p12d2 / d22; + } + } else if(d22 == 0) { + t2 = 0; + t1 = p21d1; + if(p21d1 < 0) { + t1 = 0; + } else if(p21d1 > d11) { + t1 = 1; + } else { + t1 = p21d1 / d11; + } + } else { + var det = d11 * d22 - d12 * d12; + if(det == 0) { + t1 = 0; + } else { + t1 = d12 * p12d2 + d22 * p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > det) { + t1 = 1; + } else { + t1 /= det; + } + } + t2 = t1 * d12 + p12d2; + if(t2 < 0) { + t2 = 0; + t1 = p21d1; + if(p21d1 < 0) { + t1 = 0; + } else if(p21d1 > d11) { + t1 = 1; + } else { + t1 = p21d1 / d11; + } + } else if(t2 > d22) { + t2 = 1; + t1 = d12 + p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > d11) { + t1 = 1; + } else { + t1 /= d11; + } + } else { + t2 /= d22; + } + } + var cp1X; + var cp1Y; + var cp1Z; + var cp2X; + var cp2Y; + var cp2Z; + cp1X = p1X + d1X * t1; + cp1Y = p1Y + d1Y * t1; + cp1Z = p1Z + d1Z * t1; + cp2X = p2X + d2X * t2; + cp2Y = p2Y + d2Y * t2; + cp2Z = p2Z + d2Z * t2; + var dX; + var dY; + var dZ; + dX = cp1X - cp2X; + dY = cp1Y - cp2Y; + dZ = cp1Z - cp2Z; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = cp1X + nX * -r1; + pos1Y = cp1Y + nY * -r1; + pos1Z = cp1Z + nZ * -r1; + pos2X = cp2X + nX * r2; + pos2Y = cp2Y + nY * r2; + pos2Z = cp2Z + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } + ,__class__: oimo_collision_narrowphase_detector_CapsuleCapsuleDetector +}); +var oimo_collision_narrowphase_detector_GjkEpaDetector = function() { + oimo_collision_narrowphase_detector_Detector.call(this,false); +}; +oimo_collision_narrowphase_detector_GjkEpaDetector.__name__ = true; +oimo_collision_narrowphase_detector_GjkEpaDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + var g1 = geom1; + var g2 = geom2; + var status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo_common_Setting.enableGJKCaching ? cachedData : null,true); + result.incremental = true; + if(status != oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED) { + console.log("src/oimo/collision/narrowphase/detector/GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); + return; + } + if(gjkEpa.distance > g1._gjkMargin + g2._gjkMargin) { + return; + } + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + var v = gjkEpa.closestPoint1; + pos1X = v.x; + pos1Y = v.y; + pos1Z = v.z; + var v1 = gjkEpa.closestPoint2; + pos2X = v1.x; + pos2Y = v1.y; + pos2Z = v1.z; + var normalX; + var normalY; + var normalZ; + normalX = pos1X - pos2X; + normalY = pos1Y - pos2Y; + normalZ = pos1Z - pos2Z; + if(normalX * normalX + normalY * normalY + normalZ * normalZ == 0) { + return; + } + if(gjkEpa.distance < 0) { + normalX = -normalX; + normalY = -normalY; + normalZ = -normalZ; + } + var l = normalX * normalX + normalY * normalY + normalZ * normalZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + normalX *= l; + normalY *= l; + normalZ *= l; + this.setNormal(result,normalX,normalY,normalZ); + pos1X += normalX * -g1._gjkMargin; + pos1Y += normalY * -g1._gjkMargin; + pos1Z += normalZ * -g1._gjkMargin; + pos2X += normalX * g2._gjkMargin; + pos2Y += normalY * g2._gjkMargin; + pos2Z += normalZ * g2._gjkMargin; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,g1._gjkMargin + g2._gjkMargin - gjkEpa.distance,0); + } + ,__class__: oimo_collision_narrowphase_detector_GjkEpaDetector +}); +var oimo_collision_narrowphase_detector_SphereBoxDetector = function(swapped) { + oimo_collision_narrowphase_detector_Detector.call(this,swapped); +}; +oimo_collision_narrowphase_detector_SphereBoxDetector.__name__ = true; +oimo_collision_narrowphase_detector_SphereBoxDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + var b = geom2; + result.incremental = false; + var halfExtX; + var halfExtY; + var halfExtZ; + var negHalfExtX; + var negHalfExtY; + var negHalfExtZ; + halfExtX = b._halfExtentsX; + halfExtY = b._halfExtentsY; + halfExtZ = b._halfExtentsZ; + negHalfExtX = -halfExtX; + negHalfExtY = -halfExtY; + negHalfExtZ = -halfExtZ; + var r = geom1._radius; + var boxToSphereX; + var boxToSphereY; + var boxToSphereZ; + boxToSphereX = tf1._positionX - tf2._positionX; + boxToSphereY = tf1._positionY - tf2._positionY; + boxToSphereZ = tf1._positionZ - tf2._positionZ; + var boxToSphereInBoxX; + var boxToSphereInBoxY; + var boxToSphereInBoxZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * boxToSphereX + tf2._rotation10 * boxToSphereY + tf2._rotation20 * boxToSphereZ; + __tmp__Y = tf2._rotation01 * boxToSphereX + tf2._rotation11 * boxToSphereY + tf2._rotation21 * boxToSphereZ; + __tmp__Z = tf2._rotation02 * boxToSphereX + tf2._rotation12 * boxToSphereY + tf2._rotation22 * boxToSphereZ; + boxToSphereInBoxX = __tmp__X; + boxToSphereInBoxY = __tmp__Y; + boxToSphereInBoxZ = __tmp__Z; + if(negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ) { + var sphereToBoxSurfaceX; + var sphereToBoxSurfaceY; + var sphereToBoxSurfaceZ; + sphereToBoxSurfaceX = boxToSphereInBoxX < 0 ? -boxToSphereInBoxX : boxToSphereInBoxX; + sphereToBoxSurfaceY = boxToSphereInBoxY < 0 ? -boxToSphereInBoxY : boxToSphereInBoxY; + sphereToBoxSurfaceZ = boxToSphereInBoxZ < 0 ? -boxToSphereInBoxZ : boxToSphereInBoxZ; + sphereToBoxSurfaceX = halfExtX - sphereToBoxSurfaceX; + sphereToBoxSurfaceY = halfExtY - sphereToBoxSurfaceY; + sphereToBoxSurfaceZ = halfExtZ - sphereToBoxSurfaceZ; + var normalInBoxX; + var normalInBoxY; + var normalInBoxZ; + var distX = sphereToBoxSurfaceX; + var distY = sphereToBoxSurfaceY; + var distZ = sphereToBoxSurfaceZ; + var depth; + var projectionMaskX; + var projectionMaskY; + var projectionMaskZ; + if(distX < distY) { + if(distX < distZ) { + if(boxToSphereInBoxX > 0) { + normalInBoxX = 1; + normalInBoxY = 0; + normalInBoxZ = 0; + } else { + normalInBoxX = -1; + normalInBoxY = 0; + normalInBoxZ = 0; + } + projectionMaskX = 0; + projectionMaskY = 1; + projectionMaskZ = 1; + depth = distX; + } else { + if(boxToSphereInBoxZ > 0) { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = 1; + } else { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = -1; + } + projectionMaskX = 1; + projectionMaskY = 1; + projectionMaskZ = 0; + depth = distZ; + } + } else if(distY < distZ) { + if(boxToSphereInBoxY > 0) { + normalInBoxX = 0; + normalInBoxY = 1; + normalInBoxZ = 0; + } else { + normalInBoxX = 0; + normalInBoxY = -1; + normalInBoxZ = 0; + } + projectionMaskX = 1; + projectionMaskY = 0; + projectionMaskZ = 1; + depth = distY; + } else { + if(boxToSphereInBoxZ > 0) { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = 1; + } else { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = -1; + } + projectionMaskX = 1; + projectionMaskY = 1; + projectionMaskZ = 0; + depth = distZ; + } + var baseX; + var baseY; + var baseZ; + baseX = projectionMaskX * boxToSphereInBoxX; + baseY = projectionMaskY * boxToSphereInBoxY; + baseZ = projectionMaskZ * boxToSphereInBoxZ; + var boxToClosestPointInBoxX; + var boxToClosestPointInBoxY; + var boxToClosestPointInBoxZ; + boxToClosestPointInBoxX = normalInBoxX * halfExtX; + boxToClosestPointInBoxY = normalInBoxY * halfExtY; + boxToClosestPointInBoxZ = normalInBoxZ * halfExtZ; + boxToClosestPointInBoxX += baseX; + boxToClosestPointInBoxY += baseY; + boxToClosestPointInBoxZ += baseZ; + var boxToClosestPointX; + var boxToClosestPointY; + var boxToClosestPointZ; + var normalX; + var normalY; + var normalZ; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X1; + boxToClosestPointY = __tmp__Y1; + boxToClosestPointZ = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; + __tmp__Y2 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; + __tmp__Z2 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; + normalX = __tmp__X2; + normalY = __tmp__Y2; + normalZ = __tmp__Z2; + this.setNormal(result,normalX,normalY,normalZ); + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = tf1._positionX + normalX * -r; + pos1Y = tf1._positionY + normalY * -r; + pos1Z = tf1._positionZ + normalZ * -r; + pos2X = tf2._positionX + boxToClosestPointX; + pos2Y = tf2._positionY + boxToClosestPointY; + pos2Z = tf2._positionZ + boxToClosestPointZ; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); + return; + } + var boxToClosestPointInBoxX1; + var boxToClosestPointInBoxY1; + var boxToClosestPointInBoxZ1; + halfExtX -= 1e-9; + halfExtY -= 1e-9; + halfExtZ -= 1e-9; + negHalfExtX += 1e-9; + negHalfExtY += 1e-9; + negHalfExtZ += 1e-9; + boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; + boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; + boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; + boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; + boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; + boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; + var closestPointToSphereInBoxX; + var closestPointToSphereInBoxY; + var closestPointToSphereInBoxZ; + closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX1; + closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY1; + closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ1; + var dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; + if(dist >= r * r) { + return; + } + dist = Math.sqrt(dist); + var boxToClosestPointX1; + var boxToClosestPointY1; + var boxToClosestPointZ1; + var closestPointToSphereX; + var closestPointToSphereY; + var closestPointToSphereZ; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf2._rotation00 * boxToClosestPointInBoxX1 + tf2._rotation01 * boxToClosestPointInBoxY1 + tf2._rotation02 * boxToClosestPointInBoxZ1; + __tmp__Y3 = tf2._rotation10 * boxToClosestPointInBoxX1 + tf2._rotation11 * boxToClosestPointInBoxY1 + tf2._rotation12 * boxToClosestPointInBoxZ1; + __tmp__Z3 = tf2._rotation20 * boxToClosestPointInBoxX1 + tf2._rotation21 * boxToClosestPointInBoxY1 + tf2._rotation22 * boxToClosestPointInBoxZ1; + boxToClosestPointX1 = __tmp__X3; + boxToClosestPointY1 = __tmp__Y3; + boxToClosestPointZ1 = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; + __tmp__Y4 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; + __tmp__Z4 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; + closestPointToSphereX = __tmp__X4; + closestPointToSphereY = __tmp__Y4; + closestPointToSphereZ = __tmp__Z4; + var normalX1; + var normalY1; + var normalZ1; + var l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + normalX1 = closestPointToSphereX * l; + normalY1 = closestPointToSphereY * l; + normalZ1 = closestPointToSphereZ * l; + this.setNormal(result,normalX1,normalY1,normalZ1); + var pos1X1; + var pos1Y1; + var pos1Z1; + var pos2X1; + var pos2Y1; + var pos2Z1; + pos1X1 = tf1._positionX + normalX1 * -r; + pos1Y1 = tf1._positionY + normalY1 * -r; + pos1Z1 = tf1._positionZ + normalZ1 * -r; + pos2X1 = tf2._positionX + boxToClosestPointX1; + pos2Y1 = tf2._positionY + boxToClosestPointY1; + pos2Z1 = tf2._positionZ + boxToClosestPointZ1; + this.addPoint(result,pos1X1,pos1Y1,pos1Z1,pos2X1,pos2Y1,pos2Z1,r - dist,0); + } + ,__class__: oimo_collision_narrowphase_detector_SphereBoxDetector +}); +var oimo_collision_narrowphase_detector_SphereCapsuleDetector = function(swapped) { + oimo_collision_narrowphase_detector_Detector.call(this,swapped); +}; +oimo_collision_narrowphase_detector_SphereCapsuleDetector.__name__ = true; +oimo_collision_narrowphase_detector_SphereCapsuleDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + var c2 = geom2; + result.incremental = false; + var hh2 = c2._halfHeight; + var r1 = geom1._radius; + var r2 = c2._radius; + var axis2X; + var axis2Y; + var axis2Z; + axis2X = tf2._rotation01; + axis2Y = tf2._rotation11; + axis2Z = tf2._rotation21; + var cp1X; + var cp1Y; + var cp1Z; + cp1X = tf1._positionX; + cp1Y = tf1._positionY; + cp1Z = tf1._positionZ; + var p2X; + var p2Y; + var p2Z; + var q2X; + var q2Y; + var q2Z; + p2X = tf2._positionX + axis2X * -hh2; + p2Y = tf2._positionY + axis2Y * -hh2; + p2Z = tf2._positionZ + axis2Z * -hh2; + q2X = tf2._positionX + axis2X * hh2; + q2Y = tf2._positionY + axis2Y * hh2; + q2Z = tf2._positionZ + axis2Z * hh2; + var p12X; + var p12Y; + var p12Z; + p12X = cp1X - p2X; + p12Y = cp1Y - p2Y; + p12Z = cp1Z - p2Z; + var d2X; + var d2Y; + var d2Z; + d2X = q2X - p2X; + d2Y = q2Y - p2Y; + d2Z = q2Z - p2Z; + var d22 = hh2 * hh2 * 4; + var t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + if(t < 0) { + t = 0; + } else if(t > d22) { + t = 1; + } else { + t /= d22; + } + var cp2X; + var cp2Y; + var cp2Z; + cp2X = p2X + d2X * t; + cp2Y = p2Y + d2Y * t; + cp2Z = p2Z + d2Z * t; + var dX; + var dY; + var dZ; + dX = cp1X - cp2X; + dY = cp1Y - cp2Y; + dZ = cp1Z - cp2Z; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = cp1X + nX * -r1; + pos1Y = cp1Y + nY * -r1; + pos1Z = cp1Z + nZ * -r1; + pos2X = cp2X + nX * r2; + pos2Y = cp2Y + nY * r2; + pos2Z = cp2Z + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } + ,__class__: oimo_collision_narrowphase_detector_SphereCapsuleDetector +}); +var oimo_collision_narrowphase_detector_SphereSphereDetector = function() { + oimo_collision_narrowphase_detector_Detector.call(this,false); +}; +oimo_collision_narrowphase_detector_SphereSphereDetector.__name__ = true; +oimo_collision_narrowphase_detector_SphereSphereDetector.__super__ = oimo_collision_narrowphase_detector_Detector; +oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ + detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + result.incremental = false; + var dX; + var dY; + var dZ; + dX = tf1._positionX - tf2._positionX; + dY = tf1._positionY - tf2._positionY; + dZ = tf1._positionZ - tf2._positionZ; + var r1 = geom1._radius; + var r2 = geom2._radius; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = tf1._positionX + nX * -r1; + pos1Y = tf1._positionY + nY * -r1; + pos1Z = tf1._positionZ + nZ * -r1; + pos2X = tf2._positionX + nX * r2; + pos2Y = tf2._positionY + nY * r2; + pos2Z = tf2._positionZ + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } + ,__class__: oimo_collision_narrowphase_detector_SphereSphereDetector +}); +var oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron = function() { + this._vertices = new Array(oimo_common_Setting.maxEPAVertices); + this._center = new oimo_common_Vec3(); + this._numVertices = 0; + this._triangleList = null; + this._triangleListLast = null; + this._numTriangles = 0; + this._trianglePool = null; + this._vertexPool = null; +}; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { + dumpHoleEdge: function(first) { + } + ,validate: function() { + var t = this._triangleList; + while(t != null) { + t._vertices[0]._tmpEdgeLoopOuterTriangle = null; + t._vertices[0]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[0] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[0] == null) { + this._status = 3; + return false; + } + t._vertices[1]._tmpEdgeLoopOuterTriangle = null; + t._vertices[1]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[1] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[1] == null) { + this._status = 3; + return false; + } + t._vertices[2]._tmpEdgeLoopOuterTriangle = null; + t._vertices[2]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[2] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[2] == null) { + this._status = 3; + return false; + } + t = t._next; + } + return true; + } + ,findEdgeLoop: function(id,base,from) { + if(base._tmpDfsId == id) { + return; + } + base._tmpDfsId = id; + var _this = base.tmp; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + var v = base._vertices[0].v; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + var _this1 = base.tmp; + var v1 = base._normal; + base._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; + if(!base._tmpDfsVisible) { + this._status = 6; + return; + } + var _g = 0; + while(_g < 3) { + var i = _g++; + var t = base._adjacentTriangles[i]; + if(t == null) { + continue; + } + var _this2 = t.tmp; + _this2.x = from.x; + _this2.y = from.y; + _this2.z = from.z; + var v2 = t._vertices[0].v; + _this2.x -= v2.x; + _this2.y -= v2.y; + _this2.z -= v2.z; + var _this3 = t.tmp; + var v3 = t._normal; + t._tmpDfsVisible = _this3.x * v3.x + _this3.y * v3.y + _this3.z * v3.z > 0; + if(t._tmpDfsVisible) { + this.findEdgeLoop(id,t,from); + } else { + var v11 = base._vertices[i]; + v11._tmpEdgeLoopNext = base._vertices[base._nextIndex[i]]; + v11._tmpEdgeLoopOuterTriangle = t; + } + } + var triangle = base._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = base._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + base._adjacentTriangles[0] = null; + base._adjacentPairIndex[0] = -1; + } + var triangle1 = base._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = base._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + base._adjacentTriangles[1] = null; + base._adjacentPairIndex[1] = -1; + } + var triangle2 = base._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = base._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + base._adjacentTriangles[2] = null; + base._adjacentPairIndex[2] = -1; + } + this._numTriangles--; + var prev = base._prev; + var next = base._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(base == this._triangleList) { + this._triangleList = this._triangleList._next; + } + if(base == this._triangleListLast) { + this._triangleListLast = this._triangleListLast._prev; + } + base._next = null; + base._prev = null; + base.removeReferences(); + base._next = this._trianglePool; + this._trianglePool = base; + } + ,_init: function(v1,v2,v3,v4) { + this._status = 0; + this._numVertices = 4; + this._vertices[0] = v1; + this._vertices[1] = v2; + this._vertices[2] = v3; + this._vertices[3] = v4; + var _this = this._center; + var v = v1.v; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var v5 = v2.v; + _this.x += v5.x; + _this.y += v5.y; + _this.z += v5.z; + var v6 = v3.v; + _this.x += v6.x; + _this.y += v6.y; + _this.z += v6.z; + var v7 = v4.v; + _this.x += v7.x; + _this.y += v7.y; + _this.z += v7.z; + _this.x *= 0.25; + _this.y *= 0.25; + _this.z *= 0.25; + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; + } else { + first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + } + var t1 = first; + var first1 = this._trianglePool; + if(first1 != null) { + this._trianglePool = first1._next; + first1._next = null; + } else { + first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + } + var t2 = first1; + var first2 = this._trianglePool; + if(first2 != null) { + this._trianglePool = first2._next; + first2._next = null; + } else { + first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + } + var t3 = first2; + var first3 = this._trianglePool; + if(first3 != null) { + this._trianglePool = first3._next; + first3._next = null; + } else { + first3 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + } + var t4 = first3; + if(!t1.init(v1,v2,v3,this._center,true)) { + this._status = 1; + } + if(!t2.init(v1,v2,v4,this._center,true)) { + this._status = 1; + } + if(!t3.init(v1,v3,v4,this._center,true)) { + this._status = 1; + } + if(!t4.init(v2,v3,v4,this._center,true)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t2)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t3)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t4)) { + this._status = 1; + } + if(!t2.setAdjacentTriangle(t3)) { + this._status = 1; + } + if(!t2.setAdjacentTriangle(t4)) { + this._status = 1; + } + if(!t3.setAdjacentTriangle(t4)) { + this._status = 1; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t1; + this._triangleListLast = t1; + } else { + this._triangleListLast._next = t1; + t1._prev = this._triangleListLast; + this._triangleListLast = t1; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t2; + this._triangleListLast = t2; + } else { + this._triangleListLast._next = t2; + t2._prev = this._triangleListLast; + this._triangleListLast = t2; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t3; + this._triangleListLast = t3; + } else { + this._triangleListLast._next = t3; + t3._prev = this._triangleListLast; + this._triangleListLast = t3; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t4; + this._triangleListLast = t4; + } else { + this._triangleListLast._next = t4; + t4._prev = this._triangleListLast; + this._triangleListLast = t4; + } + return this._status == 0; + } + ,_addVertex: function(vertex,base) { + this._vertices[this._numVertices++] = vertex; + var v1 = base._vertices[0]; + this.findEdgeLoop(this._numVertices,base,vertex.v); + if(this._status != 0) { + return false; + } + var v = v1; + var prevT = null; + var firstT = null; + while(true) { + if(v._tmpEdgeLoopNext == null) { + this._status = 4; + return false; + } + if(v._tmpEdgeLoopOuterTriangle == null) { + this._status = 5; + return false; + } + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; + } else { + first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + } + var t = first; + if(firstT == null) { + firstT = t; + } + if(!t.init(v,v._tmpEdgeLoopNext,vertex,this._center,false)) { + this._status = 1; + } + if(this._status != 0) { + return false; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t; + this._triangleListLast = t; + } else { + this._triangleListLast._next = t; + t._prev = this._triangleListLast; + this._triangleListLast = t; + } + if(!t.setAdjacentTriangle(v._tmpEdgeLoopOuterTriangle)) { + this._status = 1; + } + if(prevT != null) { + if(!t.setAdjacentTriangle(prevT)) { + this._status = 1; + } + } + prevT = t; + v = v._tmpEdgeLoopNext; + if(!(v != v1)) { + break; + } + } + if(!prevT.setAdjacentTriangle(firstT)) { + this._status = 1; + } + if(this._status == 0) { + return this.validate(); + } else { + return false; + } + } + ,_dumpAsObjModel: function() { + } + ,__class__: oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron +}; +var oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState = function() { }; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.__name__ = true; +var oimo_collision_narrowphase_detector_gjkepa_EpaTriangle = function() { + this.id = ++oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.count; + this._next = null; + this._prev = null; + this._normal = new oimo_common_Vec3(); + this._distanceSq = 0; + this._tmpDfsId = 0; + this._tmpDfsVisible = false; + this._vertices = new Array(3); + this._adjacentTriangles = new Array(3); + this._adjacentPairIndex = new Array(3); + this.tmp = new oimo_common_Vec3(); + this._nextIndex = new Array(3); + this._nextIndex[0] = 1; + this._nextIndex[1] = 2; + this._nextIndex[2] = 0; +}; +oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { + init: function(vertex1,vertex2,vertex3,center,autoCheck) { + if(autoCheck == null) { + autoCheck = false; + } + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v3X; + var v3Y; + var v3Z; + var vcX; + var vcY; + var vcZ; + var v = vertex1.v; + v1X = v.x; + v1Y = v.y; + v1Z = v.z; + var v1 = vertex2.v; + v2X = v1.x; + v2Y = v1.y; + v2Z = v1.z; + var v2 = vertex3.v; + v3X = v2.x; + v3Y = v2.y; + v3Z = v2.z; + vcX = center.x; + vcY = center.y; + vcZ = center.z; + var v12X; + var v12Y; + var v12Z; + var v13X; + var v13Y; + var v13Z; + var vc1X; + var vc1Y; + var vc1Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v13X = v3X - v1X; + v13Y = v3Y - v1Y; + v13Z = v3Z - v1Z; + vc1X = v1X - vcX; + vc1Y = v1Y - vcY; + vc1Z = v1Z - vcZ; + var inorX; + var inorY; + var inorZ; + inorX = v12Y * v13Z - v12Z * v13Y; + inorY = v12Z * v13X - v12X * v13Z; + inorZ = v12X * v13Y - v12Y * v13X; + var inverted = false; + if(vc1X * inorX + vc1Y * inorY + vc1Z * inorZ < 0) { + if(autoCheck) { + var tmp = vertex2; + vertex2 = vertex3; + vertex3 = tmp; + inorX *= -1; + inorY *= -1; + inorZ *= -1; + } else { + inverted = true; + } + } + this._vertices[0] = vertex1; + this._vertices[1] = vertex2; + this._vertices[2] = vertex3; + var v3 = this._normal; + v3.x = inorX; + v3.y = inorY; + v3.z = inorZ; + var vec1 = vertex1.v; + var vec2 = vertex2.v; + var vec3 = vertex3.v; + var out = this.tmp; + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + var v3X1; + var v3Y1; + var v3Z1; + var v12X1; + var v12Y1; + var v12Z1; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X1 = vec3.x; + v3Y1 = vec3.y; + v3Z1 = vec3.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X1 - v2X1; + v23Y = v3Y1 - v2Y1; + v23Z = v3Z1 - v2Z1; + v31X = v1X1 - v3X1; + v31Y = v1Y1 - v3Y1; + v31Z = v1Z1 - v3Z1; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind = -1; + var minvX; + var minvY; + var minvZ; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + } else if(t > 1) { + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X2 * t; + pY = v1Y2 + v12Y2 * t; + pZ = v1Z2 + v12Z2 * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X3; + var v1Y3; + var v1Z3; + var v2X3; + var v2Y3; + var v2Z3; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); + if(t1 < 0) { + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; + } else if(t1 > 1) { + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; + } else { + var pX1; + var pY1; + var pZ1; + pX1 = v1X3 + v12X3 * t1; + pY1 = v1Y3 + v12Y3 * t1; + pZ1 = v1Z3 + v12Z3 * t1; + out.x = pX1; + out.y = pY1; + out.z = pZ1; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { + var v1X4; + var v1Y4; + var v1Z4; + var v2X4; + var v2Y4; + var v2Z4; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); + if(t2 < 0) { + out.x = v1X4; + out.y = v1Y4; + out.z = v1Z4; + } else if(t2 > 1) { + out.x = v2X4; + out.y = v2Y4; + out.z = v2Z4; + } else { + var pX2; + var pY2; + var pZ2; + pX2 = v1X4 + v12X4 * t2; + pY2 = v1Y4 + v12Y4 * t2; + pZ2 = v1Z4 + v12Z4 * t2; + out.x = pX2; + out.y = pY2; + out.z = pZ2; + } + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d1 < mind) { + mind = d1; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(mind > 0) { + out.x = minvX; + out.y = minvY; + out.z = minvZ; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + out.x = minvX; + out.y = minvY; + out.z = minvZ; + } + var _this = this.tmp; + this._distanceSq = _this.x * _this.x + _this.y * _this.y + _this.z * _this.z; + this._adjacentTriangles[0] = null; + this._adjacentTriangles[1] = null; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[0] = -1; + this._adjacentPairIndex[1] = -1; + this._adjacentPairIndex[2] = -1; + return !inverted; + } + ,setAdjacentTriangle: function(triangle) { + var count = 0; + if(this._vertices[0] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[0]] == triangle._vertices[0]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 0; + count = 1; + } + if(this._vertices[0] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[0]] == triangle._vertices[1]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 0; + ++count; + } + if(this._vertices[0] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[0]] == triangle._vertices[2]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 0; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[1]] == triangle._vertices[0]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 1; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[1]] == triangle._vertices[1]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 1; + ++count; + } + if(this._vertices[1] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[1]] == triangle._vertices[2]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 1; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[2]] == triangle._vertices[0]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 2; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[2]] == triangle._vertices[1]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 2; + ++count; + } + if(this._vertices[2] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[2]] == triangle._vertices[2]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 2; + ++count; + } + if(count != 1) { + return false; + } + return true; + } + ,removeAdjacentTriangles: function() { + var triangle = this._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = this._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + this._adjacentTriangles[0] = null; + this._adjacentPairIndex[0] = -1; + } + var triangle1 = this._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = this._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + this._adjacentTriangles[1] = null; + this._adjacentPairIndex[1] = -1; + } + var triangle2 = this._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = this._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[2] = -1; + } + } + ,removeReferences: function() { + this._next = null; + this._prev = null; + this._tmpDfsId = 0; + this._tmpDfsVisible = false; + this._distanceSq = 0; + this._vertices[0] = null; + this._vertices[1] = null; + this._vertices[2] = null; + this._adjacentTriangles[0] = null; + this._adjacentTriangles[1] = null; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[0] = 0; + this._adjacentPairIndex[1] = 0; + this._adjacentPairIndex[2] = 0; + } + ,dump: function() { + } + ,__class__: oimo_collision_narrowphase_detector_gjkepa_EpaTriangle +}; +var oimo_collision_narrowphase_detector_gjkepa_EpaVertex = function() { + this.randId = Math.random() * 100000 | 0; + this.v = new oimo_common_Vec3(); + this.w1 = new oimo_common_Vec3(); + this.w2 = new oimo_common_Vec3(); +}; +oimo_collision_narrowphase_detector_gjkepa_EpaVertex.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_EpaVertex.prototype = { + init: function(v,w1,w2) { + var _this = this.v; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.w1; + _this1.x = w1.x; + _this1.y = w1.y; + _this1.z = w1.z; + var _this2 = this.w2; + _this2.x = w2.x; + _this2.y = w2.y; + _this2.z = w2.z; + this._next = null; + this._tmpEdgeLoopNext = null; + this._tmpEdgeLoopOuterTriangle = null; + return this; + } + ,removeReferences: function() { + this._next = null; + this._tmpEdgeLoopNext = null; + this._tmpEdgeLoopOuterTriangle = null; + } + ,__class__: oimo_collision_narrowphase_detector_gjkepa_EpaVertex +}; +var oimo_collision_narrowphase_detector_gjkepa_GjkCache = function() { + this.prevClosestDir = new oimo_common_Vec3(); +}; +oimo_collision_narrowphase_detector_gjkepa_GjkCache.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_GjkCache.prototype = { + clear: function() { + this.prevClosestDir.zero(); + } + ,__class__: oimo_collision_narrowphase_detector_gjkepa_GjkCache +}; +var oimo_common_Vec3 = function(x,y,z) { + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + oimo_common_Vec3.numCreations++; +}; +oimo_common_Vec3.__name__ = true; +oimo_common_Vec3.prototype = { + init: function(x,y,z) { + this.x = x; + this.y = y; + this.z = z; + return this; + } + ,zero: function() { + this.x = 0; + this.y = 0; + this.z = 0; + return this; + } + ,add: function(v) { + return new oimo_common_Vec3(this.x + v.x,this.y + v.y,this.z + v.z); + } + ,add3: function(vx,vy,vz) { + return new oimo_common_Vec3(this.x + vx,this.y + vy,this.z + vz); + } + ,addScaled: function(v,s) { + return new oimo_common_Vec3(this.x + v.x * s,this.y + v.y * s,this.z + v.z * s); + } + ,sub: function(v) { + return new oimo_common_Vec3(this.x - v.x,this.y - v.y,this.z - v.z); + } + ,sub3: function(vx,vy,vz) { + return new oimo_common_Vec3(this.x - vx,this.y - vy,this.z - vz); + } + ,scale: function(s) { + return new oimo_common_Vec3(this.x * s,this.y * s,this.z * s); + } + ,scale3: function(sx,sy,sz) { + return new oimo_common_Vec3(this.x * sx,this.y * sy,this.z * sz); + } + ,dot: function(v) { + return this.x * v.x + this.y * v.y + this.z * v.z; + } + ,cross: function(v) { + return new oimo_common_Vec3(this.y * v.z - this.z * v.y,this.z * v.x - this.x * v.z,this.x * v.y - this.y * v.x); + } + ,addEq: function(v) { + this.x += v.x; + this.y += v.y; + this.z += v.z; + return this; + } + ,add3Eq: function(vx,vy,vz) { + this.x += vx; + this.y += vy; + this.z += vz; + return this; + } + ,addScaledEq: function(v,s) { + this.x += v.x * s; + this.y += v.y * s; + this.z += v.z * s; + return this; + } + ,subEq: function(v) { + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; + return this; + } + ,sub3Eq: function(vx,vy,vz) { + this.x -= vx; + this.y -= vy; + this.z -= vz; + return this; + } + ,scaleEq: function(s) { + this.x *= s; + this.y *= s; + this.z *= s; + return this; + } + ,scale3Eq: function(sx,sy,sz) { + this.x *= sx; + this.y *= sy; + this.z *= sz; + return this; + } + ,crossEq: function(v) { + var y = this.z * v.x - this.x * v.z; + var z = this.x * v.y - this.y * v.x; + this.x = this.y * v.z - this.z * v.y; + this.y = y; + this.z = z; + return this; + } + ,mulMat3: function(m) { + return new oimo_common_Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02,this.x * m.e10 + this.y * m.e11 + this.z * m.e12,this.x * m.e20 + this.y * m.e21 + this.z * m.e22); + } + ,mulMat4: function(m) { + return new oimo_common_Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03,this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13,this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23); + } + ,mulTransform: function(tf) { + var vX; + var vY; + var vZ; + var v = this; + vX = v.x; + vY = v.y; + vZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; + __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; + __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + return res; + } + ,mulMat3Eq: function(m) { + var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; + var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; + this.y = y; + this.z = z; + return this; + } + ,mulMat4Eq: function(m) { + var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; + var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; + this.y = y; + this.z = z; + return this; + } + ,mulTransformEq: function(tf) { + var vX; + var vY; + var vZ; + var v = this; + vX = v.x; + vY = v.y; + vZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; + __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; + __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var v1 = this; + v1.x = vX; + v1.y = vY; + v1.z = vZ; + return this; + } + ,length: function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + } + ,lengthSq: function() { + return this.x * this.x + this.y * this.y + this.z * this.z; + } + ,normalized: function() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + return new oimo_common_Vec3(this.x * invLen,this.y * invLen,this.z * invLen); + } + ,normalize: function() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; + return this; + } + ,negate: function() { + return new oimo_common_Vec3(-this.x,-this.y,-this.z); + } + ,negateEq: function() { + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; + return this; + } + ,copyFrom: function(v) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + return this; + } + ,clone: function() { + return new oimo_common_Vec3(this.x,this.y,this.z); + } + ,toString: function() { + return "Vec3[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + "]"; + } + ,__class__: oimo_common_Vec3 +}; +var oimo_common_Transform = function() { + this._positionX = 0; + this._positionY = 0; + this._positionZ = 0; + this._rotation00 = 1; + this._rotation01 = 0; + this._rotation02 = 0; + this._rotation10 = 0; + this._rotation11 = 1; + this._rotation12 = 0; + this._rotation20 = 0; + this._rotation21 = 0; + this._rotation22 = 1; +}; +oimo_common_Transform.__name__ = true; +oimo_common_Transform.prototype = { + identity: function() { + this._positionX = 0; + this._positionY = 0; + this._positionZ = 0; + this._rotation00 = 1; + this._rotation01 = 0; + this._rotation02 = 0; + this._rotation10 = 0; + this._rotation11 = 1; + this._rotation12 = 0; + this._rotation20 = 0; + this._rotation21 = 0; + this._rotation22 = 1; + return this; + } + ,getPosition: function() { + var position = new oimo_common_Vec3(); + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; + return position; + } + ,getPositionTo: function(position) { + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; + } + ,setPosition: function(position) { + this._positionX = position.x; + this._positionY = position.y; + this._positionZ = position.z; + return this; + } + ,translate: function(translation) { + var diffX; + var diffY; + var diffZ; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; + this._positionX += diffX; + this._positionY += diffY; + this._positionZ += diffZ; + } + ,getRotation: function() { + var rotation = new oimo_common_Mat3(); + rotation.e00 = this._rotation00; + rotation.e01 = this._rotation01; + rotation.e02 = this._rotation02; + rotation.e10 = this._rotation10; + rotation.e11 = this._rotation11; + rotation.e12 = this._rotation12; + rotation.e20 = this._rotation20; + rotation.e21 = this._rotation21; + rotation.e22 = this._rotation22; + return rotation; + } + ,getRotationTo: function(out) { + out.e00 = this._rotation00; + out.e01 = this._rotation01; + out.e02 = this._rotation02; + out.e10 = this._rotation10; + out.e11 = this._rotation11; + out.e12 = this._rotation12; + out.e20 = this._rotation20; + out.e21 = this._rotation21; + out.e22 = this._rotation22; + } + ,setRotation: function(rotation) { + this._rotation00 = rotation.e00; + this._rotation01 = rotation.e01; + this._rotation02 = rotation.e02; + this._rotation10 = rotation.e10; + this._rotation11 = rotation.e11; + this._rotation12 = rotation.e12; + this._rotation20 = rotation.e20; + this._rotation21 = rotation.e21; + this._rotation22 = rotation.e22; + return this; + } + ,setRotationXyz: function(eulerAngles) { + var xyzX; + var xyzY; + var xyzZ; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + this._rotation00 = cy * cz; + this._rotation01 = -cy * sz; + this._rotation02 = sy; + this._rotation10 = cx * sz + cz * sx * sy; + this._rotation11 = cx * cz - sx * sy * sz; + this._rotation12 = -cy * sx; + this._rotation20 = sx * sz - cx * cz * sy; + this._rotation21 = cz * sx + cx * sy * sz; + this._rotation22 = cx * cy; + } + ,rotate: function(rotation) { + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; + __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; + __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; + __tmp__10 = rot10 * this._rotation00 + rot11 * this._rotation10 + rot12 * this._rotation20; + __tmp__11 = rot10 * this._rotation01 + rot11 * this._rotation11 + rot12 * this._rotation21; + __tmp__12 = rot10 * this._rotation02 + rot11 * this._rotation12 + rot12 * this._rotation22; + __tmp__20 = rot20 * this._rotation00 + rot21 * this._rotation10 + rot22 * this._rotation20; + __tmp__21 = rot20 * this._rotation01 + rot21 * this._rotation11 + rot22 * this._rotation21; + __tmp__22 = rot20 * this._rotation02 + rot21 * this._rotation12 + rot22 * this._rotation22; + this._rotation00 = __tmp__00; + this._rotation01 = __tmp__01; + this._rotation02 = __tmp__02; + this._rotation10 = __tmp__10; + this._rotation11 = __tmp__11; + this._rotation12 = __tmp__12; + this._rotation20 = __tmp__20; + this._rotation21 = __tmp__21; + this._rotation22 = __tmp__22; + } + ,rotateXyz: function(eulerAngles) { + var xyzX; + var xyzY; + var xyzZ; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + rot00 = cy * cz; + rot01 = -cy * sz; + rot02 = sy; + rot10 = cx * sz + cz * sx * sy; + rot11 = cx * cz - sx * sy * sz; + rot12 = -cy * sx; + rot20 = sx * sz - cx * cz * sy; + rot21 = cz * sx + cx * sy * sz; + rot22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; + __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; + __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; + __tmp__10 = rot10 * this._rotation00 + rot11 * this._rotation10 + rot12 * this._rotation20; + __tmp__11 = rot10 * this._rotation01 + rot11 * this._rotation11 + rot12 * this._rotation21; + __tmp__12 = rot10 * this._rotation02 + rot11 * this._rotation12 + rot12 * this._rotation22; + __tmp__20 = rot20 * this._rotation00 + rot21 * this._rotation10 + rot22 * this._rotation20; + __tmp__21 = rot20 * this._rotation01 + rot21 * this._rotation11 + rot22 * this._rotation21; + __tmp__22 = rot20 * this._rotation02 + rot21 * this._rotation12 + rot22 * this._rotation22; + this._rotation00 = __tmp__00; + this._rotation01 = __tmp__01; + this._rotation02 = __tmp__02; + this._rotation10 = __tmp__10; + this._rotation11 = __tmp__11; + this._rotation12 = __tmp__12; + this._rotation20 = __tmp__20; + this._rotation21 = __tmp__21; + this._rotation22 = __tmp__22; + } + ,getOrientation: function() { + var q = new oimo_common_Quat(); + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._rotation00; + var e11 = this._rotation11; + var e22 = this._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation21 - this._rotation12) * s; + iqY = (this._rotation02 - this._rotation20) * s; + iqZ = (this._rotation10 - this._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation02 + this._rotation20) * s; + iqW = (this._rotation21 - this._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation02 - this._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; + return q; + } + ,getOrientationTo: function(orientation) { + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._rotation00; + var e11 = this._rotation11; + var e22 = this._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation21 - this._rotation12) * s; + iqY = (this._rotation02 - this._rotation20) * s; + iqZ = (this._rotation10 - this._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation02 + this._rotation20) * s; + iqW = (this._rotation21 - this._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation02 - this._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; + } + ,setOrientation: function(quaternion) { + var qX; + var qY; + var qZ; + var qW; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._rotation00 = 1 - yy - zz; + this._rotation01 = xy - wz; + this._rotation02 = xz + wy; + this._rotation10 = xy + wz; + this._rotation11 = 1 - xx - zz; + this._rotation12 = yz - wx; + this._rotation20 = xz - wy; + this._rotation21 = yz + wx; + this._rotation22 = 1 - xx - yy; + return this; + } + ,clone: function() { + var tf = new oimo_common_Transform(); + tf._positionX = this._positionX; + tf._positionY = this._positionY; + tf._positionZ = this._positionZ; + tf._rotation00 = this._rotation00; + tf._rotation01 = this._rotation01; + tf._rotation02 = this._rotation02; + tf._rotation10 = this._rotation10; + tf._rotation11 = this._rotation11; + tf._rotation12 = this._rotation12; + tf._rotation20 = this._rotation20; + tf._rotation21 = this._rotation21; + tf._rotation22 = this._rotation22; + return tf; + } + ,copyFrom: function(transform) { + this._positionX = transform._positionX; + this._positionY = transform._positionY; + this._positionZ = transform._positionZ; + this._rotation00 = transform._rotation00; + this._rotation01 = transform._rotation01; + this._rotation02 = transform._rotation02; + this._rotation10 = transform._rotation10; + this._rotation11 = transform._rotation11; + this._rotation12 = transform._rotation12; + this._rotation20 = transform._rotation20; + this._rotation21 = transform._rotation21; + this._rotation22 = transform._rotation22; + return this; + } + ,__class__: oimo_common_Transform +}; +var oimo_common_Setting = function() { }; +oimo_common_Setting.__name__ = true; +var oimo_collision_narrowphase_detector_gjkepa_GjkEpa = function() { + this.s = new Array(4); + this.w1 = new Array(4); + this.w2 = new Array(4); + this.baseDirs = new Array(3); + this.baseDirs[0] = new oimo_common_Vec3(1,0,0); + this.baseDirs[1] = new oimo_common_Vec3(0,1,0); + this.baseDirs[2] = new oimo_common_Vec3(0,0,1); + this.tl1 = new oimo_common_Vec3(); + this.tl2 = new oimo_common_Vec3(); + this.rayX = new oimo_common_Vec3(); + this.rayR = new oimo_common_Vec3(); + this.tempTransform = new oimo_common_Transform(); + this.s[0] = new oimo_common_Vec3(); + this.w1[0] = new oimo_common_Vec3(); + this.w2[0] = new oimo_common_Vec3(); + this.s[1] = new oimo_common_Vec3(); + this.w1[1] = new oimo_common_Vec3(); + this.w2[1] = new oimo_common_Vec3(); + this.s[2] = new oimo_common_Vec3(); + this.w1[2] = new oimo_common_Vec3(); + this.w2[2] = new oimo_common_Vec3(); + this.s[3] = new oimo_common_Vec3(); + this.w1[3] = new oimo_common_Vec3(); + this.w2[3] = new oimo_common_Vec3(); + this.dir = new oimo_common_Vec3(); + this.closest = new oimo_common_Vec3(); + this.closestPoint1 = new oimo_common_Vec3(); + this.closestPoint2 = new oimo_common_Vec3(); + this.polyhedron = new oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron(); +}; +oimo_collision_narrowphase_detector_gjkepa_GjkEpa.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_GjkEpa.getInstance = function() { + return oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; +}; +oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { + computeClosestPointsImpl: function(c1,c2,tf1,tf2,cache,useEpa) { + this.c1 = c1; + this.c2 = c2; + this.tf1 = tf1; + this.tf2 = tf2; + var s = this.s; + var w1 = this.w1; + var w2 = this.w2; + var closest = this.closest; + var dir = this.dir; + if(cache != null) { + if(cache._gjkCache == null) { + cache._gjkCache = new oimo_collision_narrowphase_detector_gjkepa_GjkCache(); + } + this.loadCache(cache._gjkCache); + } else { + dir.zero(); + } + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z == 0) { + var firstDirX; + var firstDirY; + var firstDirZ; + firstDirX = tf2._positionX - tf1._positionX; + firstDirY = tf2._positionY - tf1._positionY; + firstDirZ = tf2._positionZ - tf1._positionZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { + dir.init(1,0,0); + } + } + this.simplexSize = 0; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var v1 = this.w2[this.simplexSize]; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; + this.simplexSize = 1; + var count = 0; + while(count < 40) { + var v2 = 0; + switch(this.simplexSize) { + case 1: + var v3 = s[0]; + closest.x = v3.x; + closest.y = v3.y; + closest.z = v3.z; + v2 = 1; + break; + case 2: + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v4 = s[0]; + v1X = v4.x; + v1Y = v4.y; + v1Z = v4.z; + var v5 = s[1]; + v2X = v5.x; + v2Y = v5.y; + v2Z = v5.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v2 = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v2 = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v2 = 3; + } + break; + case 3: + var vec1 = s[0]; + var vec2 = s[1]; + var vec3 = s[2]; + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + var v3X; + var v3Y; + var v3Z; + var v12X1; + var v12Y1; + var v12Z1; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind = -1; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + var b; + if(t1 < 0) { + closest.x = v1X2; + closest.y = v1Y2; + closest.z = v1Z2; + b = 1; + } else if(t1 > 1) { + closest.x = v2X2; + closest.y = v2Y2; + closest.z = v2Z2; + b = 2; + } else { + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + closest.x = pX1; + closest.y = pY1; + closest.z = pZ1; + b = 3; + } + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X3; + var v1Y3; + var v1Z3; + var v2X3; + var v2Y3; + var v2Z3; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); + var b1; + if(t2 < 0) { + closest.x = v1X3; + closest.y = v1Y3; + closest.z = v1Z3; + b1 = 1; + } else if(t2 > 1) { + closest.x = v2X3; + closest.y = v2Y3; + closest.z = v2Z3; + b1 = 2; + } else { + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + closest.x = pX2; + closest.y = pY2; + closest.z = pZ2; + b1 = 3; + } + var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b1 << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X4; + var v1Y4; + var v1Z4; + var v2X4; + var v2Y4; + var v2Z4; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); + var b2; + if(t3 < 0) { + closest.x = v1X4; + closest.y = v1Y4; + closest.z = v1Z4; + b2 = 1; + } else if(t3 > 1) { + closest.x = v2X4; + closest.y = v2Y4; + closest.z = v2Z4; + b2 = 2; + } else { + var pX3; + var pY3; + var pZ3; + pX3 = v1X4 + v12X4 * t3; + pY3 = v1Y4 + v12Y4 * t3; + pZ3 = v1Z4 + v12Z4 * t3; + closest.x = pX3; + closest.y = pY3; + closest.z = pZ3; + b2 = 3; + } + var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d1 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d1; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v2 = mini; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v2 = 7; + } + break; + case 4: + var vec11 = s[0]; + var vec21 = s[1]; + var vec31 = s[2]; + var vec4 = s[3]; + var v1X5; + var v1Y5; + var v1Z5; + var v2X5; + var v2Y5; + var v2Z5; + var v3X1; + var v3Y1; + var v3Z1; + var v4X; + var v4Y; + var v4Z; + var v12X5; + var v12Y5; + var v12Z5; + var v13X; + var v13Y; + var v13Z; + var v14X; + var v14Y; + var v14Z; + var v23X1; + var v23Y1; + var v23Z1; + var v24X; + var v24Y; + var v24Z; + v1X5 = vec11.x; + v1Y5 = vec11.y; + v1Z5 = vec11.z; + v2X5 = vec21.x; + v2Y5 = vec21.y; + v2Z5 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v13X = v3X1 - v1X5; + v13Y = v3Y1 - v1Y5; + v13Z = v3Z1 - v1Z5; + v14X = v4X - v1X5; + v14Y = v4Y - v1Y5; + v14Z = v4Z - v1Z5; + v23X1 = v3X1 - v2X5; + v23Y1 = v3Y1 - v2Y5; + v23Z1 = v3Z1 - v2Z5; + v24X = v4X - v2X5; + v24Y = v4Y - v2Y5; + v24Z = v4Z - v2Z5; + var n123X; + var n123Y; + var n123Z; + var n134X; + var n134Y; + var n134Z; + var n142X; + var n142Y; + var n142Z; + var n243X; + var n243Y; + var n243Z; + n123X = v12Y5 * v13Z - v12Z5 * v13Y; + n123Y = v12Z5 * v13X - v12X5 * v13Z; + n123Z = v12X5 * v13Y - v12Y5 * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z5 - v14Z * v12Y5; + n142Y = v14Z * v12X5 - v14X * v12Z5; + n142Z = v14X * v12Y5 - v14Y * v12X5; + n243X = v24Y * v23Z1 - v24Z * v23Y1; + n243Y = v24Z * v23X1 - v24X * v23Z1; + n243Z = v24X * v23Y1 - v24Y * v23X1; + var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { + var v1X6; + var v1Y6; + var v1Z6; + var v2X6; + var v2Y6; + var v2Z6; + var v3X2; + var v3Y2; + var v3Z2; + var v12X6; + var v12Y6; + var v12Z6; + var v23X2; + var v23Y2; + var v23Z2; + var v31X1; + var v31Y1; + var v31Z1; + v1X6 = vec11.x; + v1Y6 = vec11.y; + v1Z6 = vec11.z; + v2X6 = vec21.x; + v2Y6 = vec21.y; + v2Z6 = vec21.z; + v3X2 = vec31.x; + v3Y2 = vec31.y; + v3Z2 = vec31.z; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + v23X2 = v3X2 - v2X6; + v23Y2 = v3Y2 - v2Y6; + v23Z2 = v3Z2 - v2Z6; + v31X1 = v1X6 - v3X2; + v31Y1 = v1Y6 - v3Y2; + v31Z1 = v1Z6 - v3Z2; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; + var n12X1; + var n12Y1; + var n12Z1; + var n23X1; + var n23Y1; + var n23Z1; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; + n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; + n12Z1 = v12X6 * nY1 - v12Y6 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; + var mind2 = -1; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { + var v1X7; + var v1Y7; + var v1Z7; + var v2X7; + var v2Y7; + var v2Z7; + v1X7 = vec11.x; + v1Y7 = vec11.y; + v1Z7 = vec11.z; + v2X7 = vec21.x; + v2Y7 = vec21.y; + v2Z7 = vec21.z; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); + var b3; + if(t4 < 0) { + closest.x = v1X7; + closest.y = v1Y7; + closest.z = v1Z7; + b3 = 1; + } else if(t4 > 1) { + closest.x = v2X7; + closest.y = v2Y7; + closest.z = v2Z7; + b3 = 2; + } else { + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + closest.x = pX4; + closest.y = pY4; + closest.z = pZ4; + b3 = 3; + } + mini2 = b3; + mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { + var v1X8; + var v1Y8; + var v1Z8; + var v2X8; + var v2Y8; + var v2Z8; + v1X8 = vec21.x; + v1Y8 = vec21.y; + v1Z8 = vec21.z; + v2X8 = vec31.x; + v2Y8 = vec31.y; + v2Z8 = vec31.z; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); + var b4; + if(t5 < 0) { + closest.x = v1X8; + closest.y = v1Y8; + closest.z = v1Z8; + b4 = 1; + } else if(t5 > 1) { + closest.x = v2X8; + closest.y = v2Y8; + closest.z = v2Z8; + b4 = 2; + } else { + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + closest.x = pX5; + closest.y = pY5; + closest.z = pZ5; + b4 = 3; + } + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d2 < mind2) { + mini2 = b4 << 1; + mind2 = d2; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + } + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { + var v1X9; + var v1Y9; + var v1Z9; + var v2X9; + var v2Y9; + var v2Z9; + v1X9 = vec11.x; + v1Y9 = vec11.y; + v1Z9 = vec11.z; + v2X9 = vec31.x; + v2Y9 = vec31.y; + v2Z9 = vec31.z; + var v12X9; + var v12Y9; + var v12Z9; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; + t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); + var b5; + if(t6 < 0) { + closest.x = v1X9; + closest.y = v1Y9; + closest.z = v1Z9; + b5 = 1; + } else if(t6 > 1) { + closest.x = v2X9; + closest.y = v2Y9; + closest.z = v2Z9; + b5 = 2; + } else { + var pX6; + var pY6; + var pZ6; + pX6 = v1X9 + v12X9 * t6; + pY6 = v1Y9 + v12Y9 * t6; + pZ6 = v1Z9 + v12Z9 * t6; + closest.x = pX6; + closest.y = pY6; + closest.z = pZ6; + b5 = 3; + } + var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d3 < mind2) { + mini2 = b5 & 1 | (b5 & 2) << 1; + mind2 = d3; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + } + var b6; + if(mind2 > 0) { + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; + b6 = mini2; + } else { + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; + b6 = 7; + } + mini1 = b6; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { + var v1X10; + var v1Y10; + var v1Z10; + var v2X10; + var v2Y10; + var v2Z10; + var v3X3; + var v3Y3; + var v3Z3; + var v12X10; + var v12Y10; + var v12Z10; + var v23X3; + var v23Y3; + var v23Z3; + var v31X2; + var v31Y2; + var v31Z2; + v1X10 = vec11.x; + v1Y10 = vec11.y; + v1Z10 = vec11.z; + v2X10 = vec31.x; + v2Y10 = vec31.y; + v2Z10 = vec31.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + v23X3 = v3X3 - v2X10; + v23Y3 = v3Y3 - v2Y10; + v23Z3 = v3Z3 - v2Z10; + v31X2 = v1X10 - v3X3; + v31Y2 = v1Y10 - v3Y3; + v31Z2 = v1Z10 - v3Z3; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; + var n12X2; + var n12Y2; + var n12Z2; + var n23X2; + var n23Y2; + var n23Z2; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; + n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; + n12Z2 = v12X10 * nY2 - v12Y10 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; + var mind3 = -1; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { + var v1X11; + var v1Y11; + var v1Z11; + var v2X11; + var v2Y11; + var v2Z11; + v1X11 = vec11.x; + v1Y11 = vec11.y; + v1Z11 = vec11.z; + v2X11 = vec31.x; + v2Y11 = vec31.y; + v2Z11 = vec31.z; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); + var b7; + if(t7 < 0) { + closest.x = v1X11; + closest.y = v1Y11; + closest.z = v1Z11; + b7 = 1; + } else if(t7 > 1) { + closest.x = v2X11; + closest.y = v2Y11; + closest.z = v2Z11; + b7 = 2; + } else { + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + closest.x = pX7; + closest.y = pY7; + closest.z = pZ7; + b7 = 3; + } + mini3 = b7; + mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { + var v1X12; + var v1Y12; + var v1Z12; + var v2X12; + var v2Y12; + var v2Z12; + v1X12 = vec31.x; + v1Y12 = vec31.y; + v1Z12 = vec31.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); + var b8; + if(t8 < 0) { + closest.x = v1X12; + closest.y = v1Y12; + closest.z = v1Z12; + b8 = 1; + } else if(t8 > 1) { + closest.x = v2X12; + closest.y = v2Y12; + closest.z = v2Z12; + b8 = 2; + } else { + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + closest.x = pX8; + closest.y = pY8; + closest.z = pZ8; + b8 = 3; + } + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d4 < mind3) { + mini3 = b8 << 1; + mind3 = d4; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + } + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { + var v1X13; + var v1Y13; + var v1Z13; + var v2X13; + var v2Y13; + var v2Z13; + v1X13 = vec11.x; + v1Y13 = vec11.y; + v1Z13 = vec11.z; + v2X13 = vec4.x; + v2Y13 = vec4.y; + v2Z13 = vec4.z; + var v12X13; + var v12Y13; + var v12Z13; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; + t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); + var b9; + if(t9 < 0) { + closest.x = v1X13; + closest.y = v1Y13; + closest.z = v1Z13; + b9 = 1; + } else if(t9 > 1) { + closest.x = v2X13; + closest.y = v2Y13; + closest.z = v2Z13; + b9 = 2; + } else { + var pX9; + var pY9; + var pZ9; + pX9 = v1X13 + v12X13 * t9; + pY9 = v1Y13 + v12Y13 * t9; + pZ9 = v1Z13 + v12Z13 * t9; + closest.x = pX9; + closest.y = pY9; + closest.z = pZ9; + b9 = 3; + } + var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d5 < mind3) { + mini3 = b9 & 1 | (b9 & 2) << 1; + mind3 = d5; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + } + var b10; + if(mind3 > 0) { + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; + b10 = mini3; + } else { + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; + b10 = 7; + } + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d6 < mind1) { + mini1 = b10 & 1 | (b10 & 6) << 1; + mind1 = d6; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { + var v1X14; + var v1Y14; + var v1Z14; + var v2X14; + var v2Y14; + var v2Z14; + var v3X4; + var v3Y4; + var v3Z4; + var v12X14; + var v12Y14; + var v12Z14; + var v23X4; + var v23Y4; + var v23Z4; + var v31X3; + var v31Y3; + var v31Z3; + v1X14 = vec11.x; + v1Y14 = vec11.y; + v1Z14 = vec11.z; + v2X14 = vec21.x; + v2Y14 = vec21.y; + v2Z14 = vec21.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + v23X4 = v3X4 - v2X14; + v23Y4 = v3Y4 - v2Y14; + v23Z4 = v3Z4 - v2Z14; + v31X3 = v1X14 - v3X4; + v31Y3 = v1Y14 - v3Y4; + v31Z3 = v1Z14 - v3Z4; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; + var n12X3; + var n12Y3; + var n12Z3; + var n23X3; + var n23Y3; + var n23Z3; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; + n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; + n12Z3 = v12X14 * nY3 - v12Y14 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; + var mind4 = -1; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { + var v1X15; + var v1Y15; + var v1Z15; + var v2X15; + var v2Y15; + var v2Z15; + v1X15 = vec11.x; + v1Y15 = vec11.y; + v1Z15 = vec11.z; + v2X15 = vec21.x; + v2Y15 = vec21.y; + v2Z15 = vec21.z; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); + var b11; + if(t10 < 0) { + closest.x = v1X15; + closest.y = v1Y15; + closest.z = v1Z15; + b11 = 1; + } else if(t10 > 1) { + closest.x = v2X15; + closest.y = v2Y15; + closest.z = v2Z15; + b11 = 2; + } else { + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + closest.x = pX10; + closest.y = pY10; + closest.z = pZ10; + b11 = 3; + } + mini4 = b11; + mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { + var v1X16; + var v1Y16; + var v1Z16; + var v2X16; + var v2Y16; + var v2Z16; + v1X16 = vec21.x; + v1Y16 = vec21.y; + v1Z16 = vec21.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); + var b12; + if(t11 < 0) { + closest.x = v1X16; + closest.y = v1Y16; + closest.z = v1Z16; + b12 = 1; + } else if(t11 > 1) { + closest.x = v2X16; + closest.y = v2Y16; + closest.z = v2Z16; + b12 = 2; + } else { + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + closest.x = pX11; + closest.y = pY11; + closest.z = pZ11; + b12 = 3; + } + var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d7 < mind4) { + mini4 = b12 << 1; + mind4 = d7; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + } + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { + var v1X17; + var v1Y17; + var v1Z17; + var v2X17; + var v2Y17; + var v2Z17; + v1X17 = vec11.x; + v1Y17 = vec11.y; + v1Z17 = vec11.z; + v2X17 = vec4.x; + v2Y17 = vec4.y; + v2Z17 = vec4.z; + var v12X17; + var v12Y17; + var v12Z17; + v12X17 = v2X17 - v1X17; + v12Y17 = v2Y17 - v1Y17; + v12Z17 = v2Z17 - v1Z17; + var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; + t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); + var b13; + if(t12 < 0) { + closest.x = v1X17; + closest.y = v1Y17; + closest.z = v1Z17; + b13 = 1; + } else if(t12 > 1) { + closest.x = v2X17; + closest.y = v2Y17; + closest.z = v2Z17; + b13 = 2; + } else { + var pX12; + var pY12; + var pZ12; + pX12 = v1X17 + v12X17 * t12; + pY12 = v1Y17 + v12Y17 * t12; + pZ12 = v1Z17 + v12Z17 * t12; + closest.x = pX12; + closest.y = pY12; + closest.z = pZ12; + b13 = 3; + } + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d8 < mind4) { + mini4 = b13 & 1 | (b13 & 2) << 1; + mind4 = d8; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + } + var b14; + if(mind4 > 0) { + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; + b14 = mini4; + } else { + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; + b14 = 7; + } + var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d9 < mind1) { + mini1 = b14 & 3 | (b14 & 4) << 1; + mind1 = d9; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { + var v1X18; + var v1Y18; + var v1Z18; + var v2X18; + var v2Y18; + var v2Z18; + var v3X5; + var v3Y5; + var v3Z5; + var v12X18; + var v12Y18; + var v12Z18; + var v23X5; + var v23Y5; + var v23Z5; + var v31X4; + var v31Y4; + var v31Z4; + v1X18 = vec21.x; + v1Y18 = vec21.y; + v1Z18 = vec21.z; + v2X18 = vec31.x; + v2Y18 = vec31.y; + v2Z18 = vec31.z; + v3X5 = vec4.x; + v3Y5 = vec4.y; + v3Z5 = vec4.z; + v12X18 = v2X18 - v1X18; + v12Y18 = v2Y18 - v1Y18; + v12Z18 = v2Z18 - v1Z18; + v23X5 = v3X5 - v2X18; + v23Y5 = v3Y5 - v2Y18; + v23Z5 = v3Z5 - v2Z18; + v31X4 = v1X18 - v3X5; + v31Y4 = v1Y18 - v3Y5; + v31Z4 = v1Z18 - v3Z5; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; + var n12X4; + var n12Y4; + var n12Z4; + var n23X4; + var n23Y4; + var n23Z4; + var n31X4; + var n31Y4; + var n31Z4; + n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; + n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; + n12Z4 = v12X18 * nY4 - v12Y18 * nX4; + n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; + n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; + n23Z4 = v23X5 * nY4 - v23Y5 * nX4; + n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; + n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; + n31Z4 = v31X4 * nY4 - v31Y4 * nX4; + var mind5 = -1; + var minvX5; + var minvY5; + var minvZ5; + var mini5 = 0; + minvX5 = 0; + minvY5 = 0; + minvZ5 = 0; + if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { + var v1X19; + var v1Y19; + var v1Z19; + var v2X19; + var v2Y19; + var v2Z19; + v1X19 = vec21.x; + v1Y19 = vec21.y; + v1Z19 = vec21.z; + v2X19 = vec31.x; + v2Y19 = vec31.y; + v2Z19 = vec31.z; + var v12X19; + var v12Y19; + var v12Z19; + v12X19 = v2X19 - v1X19; + v12Y19 = v2Y19 - v1Y19; + v12Z19 = v2Z19 - v1Z19; + var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; + t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); + var b15; + if(t13 < 0) { + closest.x = v1X19; + closest.y = v1Y19; + closest.z = v1Z19; + b15 = 1; + } else if(t13 > 1) { + closest.x = v2X19; + closest.y = v2Y19; + closest.z = v2Z19; + b15 = 2; + } else { + var pX13; + var pY13; + var pZ13; + pX13 = v1X19 + v12X19 * t13; + pY13 = v1Y19 + v12Y19 * t13; + pZ13 = v1Z19 + v12Z19 * t13; + closest.x = pX13; + closest.y = pY13; + closest.z = pZ13; + b15 = 3; + } + mini5 = b15; + mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { + var v1X20; + var v1Y20; + var v1Z20; + var v2X20; + var v2Y20; + var v2Z20; + v1X20 = vec31.x; + v1Y20 = vec31.y; + v1Z20 = vec31.z; + v2X20 = vec4.x; + v2Y20 = vec4.y; + v2Z20 = vec4.z; + var v12X20; + var v12Y20; + var v12Z20; + v12X20 = v2X20 - v1X20; + v12Y20 = v2Y20 - v1Y20; + v12Z20 = v2Z20 - v1Z20; + var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; + t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); + var b16; + if(t14 < 0) { + closest.x = v1X20; + closest.y = v1Y20; + closest.z = v1Z20; + b16 = 1; + } else if(t14 > 1) { + closest.x = v2X20; + closest.y = v2Y20; + closest.z = v2Z20; + b16 = 2; + } else { + var pX14; + var pY14; + var pZ14; + pX14 = v1X20 + v12X20 * t14; + pY14 = v1Y20 + v12Y20 * t14; + pZ14 = v1Z20 + v12Z20 * t14; + closest.x = pX14; + closest.y = pY14; + closest.z = pZ14; + b16 = 3; + } + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d10 < mind5) { + mini5 = b16 << 1; + mind5 = d10; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + } + if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { + var v1X21; + var v1Y21; + var v1Z21; + var v2X21; + var v2Y21; + var v2Z21; + v1X21 = vec21.x; + v1Y21 = vec21.y; + v1Z21 = vec21.z; + v2X21 = vec4.x; + v2Y21 = vec4.y; + v2Z21 = vec4.z; + var v12X21; + var v12Y21; + var v12Z21; + v12X21 = v2X21 - v1X21; + v12Y21 = v2Y21 - v1Y21; + v12Z21 = v2Z21 - v1Z21; + var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; + t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); + var b17; + if(t15 < 0) { + closest.x = v1X21; + closest.y = v1Y21; + closest.z = v1Z21; + b17 = 1; + } else if(t15 > 1) { + closest.x = v2X21; + closest.y = v2Y21; + closest.z = v2Z21; + b17 = 2; + } else { + var pX15; + var pY15; + var pZ15; + pX15 = v1X21 + v12X21 * t15; + pY15 = v1Y21 + v12Y21 * t15; + pZ15 = v1Z21 + v12Z21 * t15; + closest.x = pX15; + closest.y = pY15; + closest.z = pZ15; + b17 = 3; + } + var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d11 < mind5) { + mini5 = b17 & 1 | (b17 & 2) << 1; + mind5 = d11; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + } + var b18; + if(mind5 > 0) { + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; + b18 = mini5; + } else { + var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + nX4 *= l5; + nY4 *= l5; + nZ4 *= l5; + var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; + minvX5 = nX4 * l24; + minvY5 = nY4 * l24; + minvZ5 = nZ4 * l24; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; + b18 = 7; + } + var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d12 < mind1) { + mini1 = b18 << 1; + mind1 = d12; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if(mind1 > 0) { + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v2 = mini1; + } else { + closest.zero(); + v2 = 15; + } + break; + } + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { + if(!useEpa) { + this.distance = 0; + return 0; + } + switch(this.simplexSize) { + case 1: + this.pointToTetrahedron(); + break; + case 2: + this.lineToTetrahedron(); + break; + case 3: + this.triangleToTetrahedron(); + break; + } + if(this.simplexSize == 4) { + var epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); + if(epaState != 0) { + this.distance = 0; + return epaState; + } + this.distance = -this.depth; + return 0; + } + this.distance = 0; + return 1; + } + this.shrinkSimplex(v2); + dir.x = closest.x; + dir.y = closest.y; + dir.z = closest.z; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this1 = this.s[this.simplexSize]; + var v6 = this.w1[this.simplexSize]; + _this1.x = v6.x; + _this1.y = v6.y; + _this1.z = v6.z; + var v7 = this.w2[this.simplexSize]; + _this1.x -= v7.x; + _this1.y -= v7.y; + _this1.z -= v7.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { + throw new Error("!?"); + } + var _this2 = s[this.simplexSize]; + if(_this2.x * dir.x + _this2.y * dir.y + _this2.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { + this.interpolateClosestPoints(); + this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); + if(cache != null && cache._gjkCache != null) { + this.saveCache(cache._gjkCache); + } + return 0; + } + this.simplexSize++; + ++count; + } + return 2; + } + ,convexCastImpl: function(c1,c2,tf1,tf2,tl1,tl2,hit) { + this.c1 = c1; + this.c2 = c2; + this.tf1 = tf1; + this.tf2 = tf2; + var s = this.s; + var closest = this.closest; + var dir = this.dir; + var firstDirX; + var firstDirY; + var firstDirZ; + firstDirX = tf2._positionX - tf1._positionX; + firstDirY = tf2._positionY - tf1._positionY; + firstDirZ = tf2._positionZ - tf1._positionZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { + dir.init(1,0,0); + } + this.simplexSize = 0; + if(this.c1 != null) { + this.computeWitnessPoint1(true); + } else { + var v = this.w1[this.simplexSize]; + v.x = this.tf1._positionX; + v.y = this.tf1._positionY; + v.z = this.tf1._positionZ; + } + this.computeWitnessPoint2(true); + var _this = this.s[this.simplexSize]; + var v1 = this.w1[this.simplexSize]; + _this.x = v1.x; + _this.y = v1.y; + _this.z = v1.z; + var v2 = this.w2[this.simplexSize]; + _this.x -= v2.x; + _this.y -= v2.y; + _this.z -= v2.z; + this.simplexSize = 1; + var count = 0; + var lambda = 0.0; + var rayX = this.rayX; + var rayR = this.rayR; + rayX.zero(); + rayR.x = tl2.x; + rayR.y = tl2.y; + rayR.z = tl2.z; + rayR.x -= tl1.x; + rayR.y -= tl1.y; + rayR.z -= tl1.z; + while(count < 40) { + var v3 = 0; + switch(this.simplexSize) { + case 1: + var v4 = s[0]; + closest.x = v4.x; + closest.y = v4.y; + closest.z = v4.z; + v3 = 1; + break; + case 2: + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v5 = s[0]; + v1X = v5.x; + v1Y = v5.y; + v1Z = v5.z; + var v6 = s[1]; + v2X = v6.x; + v2Y = v6.y; + v2Z = v6.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v3 = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v3 = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v3 = 3; + } + break; + case 3: + var vec1 = s[0]; + var vec2 = s[1]; + var vec3 = s[2]; + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + var v3X; + var v3Y; + var v3Z; + var v12X1; + var v12Y1; + var v12Z1; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind = -1; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + var b; + if(t1 < 0) { + closest.x = v1X2; + closest.y = v1Y2; + closest.z = v1Z2; + b = 1; + } else if(t1 > 1) { + closest.x = v2X2; + closest.y = v2Y2; + closest.z = v2Z2; + b = 2; + } else { + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + closest.x = pX1; + closest.y = pY1; + closest.z = pZ1; + b = 3; + } + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X3; + var v1Y3; + var v1Z3; + var v2X3; + var v2Y3; + var v2Z3; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); + var b1; + if(t2 < 0) { + closest.x = v1X3; + closest.y = v1Y3; + closest.z = v1Z3; + b1 = 1; + } else if(t2 > 1) { + closest.x = v2X3; + closest.y = v2Y3; + closest.z = v2Z3; + b1 = 2; + } else { + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + closest.x = pX2; + closest.y = pY2; + closest.z = pZ2; + b1 = 3; + } + var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b1 << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X4; + var v1Y4; + var v1Z4; + var v2X4; + var v2Y4; + var v2Z4; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); + var b2; + if(t3 < 0) { + closest.x = v1X4; + closest.y = v1Y4; + closest.z = v1Z4; + b2 = 1; + } else if(t3 > 1) { + closest.x = v2X4; + closest.y = v2Y4; + closest.z = v2Z4; + b2 = 2; + } else { + var pX3; + var pY3; + var pZ3; + pX3 = v1X4 + v12X4 * t3; + pY3 = v1Y4 + v12Y4 * t3; + pZ3 = v1Z4 + v12Z4 * t3; + closest.x = pX3; + closest.y = pY3; + closest.z = pZ3; + b2 = 3; + } + var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d1 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d1; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v3 = mini; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v3 = 7; + } + break; + case 4: + var vec11 = s[0]; + var vec21 = s[1]; + var vec31 = s[2]; + var vec4 = s[3]; + var v1X5; + var v1Y5; + var v1Z5; + var v2X5; + var v2Y5; + var v2Z5; + var v3X1; + var v3Y1; + var v3Z1; + var v4X; + var v4Y; + var v4Z; + var v12X5; + var v12Y5; + var v12Z5; + var v13X; + var v13Y; + var v13Z; + var v14X; + var v14Y; + var v14Z; + var v23X1; + var v23Y1; + var v23Z1; + var v24X; + var v24Y; + var v24Z; + v1X5 = vec11.x; + v1Y5 = vec11.y; + v1Z5 = vec11.z; + v2X5 = vec21.x; + v2Y5 = vec21.y; + v2Z5 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v13X = v3X1 - v1X5; + v13Y = v3Y1 - v1Y5; + v13Z = v3Z1 - v1Z5; + v14X = v4X - v1X5; + v14Y = v4Y - v1Y5; + v14Z = v4Z - v1Z5; + v23X1 = v3X1 - v2X5; + v23Y1 = v3Y1 - v2Y5; + v23Z1 = v3Z1 - v2Z5; + v24X = v4X - v2X5; + v24Y = v4Y - v2Y5; + v24Z = v4Z - v2Z5; + var n123X; + var n123Y; + var n123Z; + var n134X; + var n134Y; + var n134Z; + var n142X; + var n142Y; + var n142Z; + var n243X; + var n243Y; + var n243Z; + n123X = v12Y5 * v13Z - v12Z5 * v13Y; + n123Y = v12Z5 * v13X - v12X5 * v13Z; + n123Z = v12X5 * v13Y - v12Y5 * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z5 - v14Z * v12Y5; + n142Y = v14Z * v12X5 - v14X * v12Z5; + n142Z = v14X * v12Y5 - v14Y * v12X5; + n243X = v24Y * v23Z1 - v24Z * v23Y1; + n243Y = v24Z * v23X1 - v24X * v23Z1; + n243Z = v24X * v23Y1 - v24Y * v23X1; + var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { + var v1X6; + var v1Y6; + var v1Z6; + var v2X6; + var v2Y6; + var v2Z6; + var v3X2; + var v3Y2; + var v3Z2; + var v12X6; + var v12Y6; + var v12Z6; + var v23X2; + var v23Y2; + var v23Z2; + var v31X1; + var v31Y1; + var v31Z1; + v1X6 = vec11.x; + v1Y6 = vec11.y; + v1Z6 = vec11.z; + v2X6 = vec21.x; + v2Y6 = vec21.y; + v2Z6 = vec21.z; + v3X2 = vec31.x; + v3Y2 = vec31.y; + v3Z2 = vec31.z; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + v23X2 = v3X2 - v2X6; + v23Y2 = v3Y2 - v2Y6; + v23Z2 = v3Z2 - v2Z6; + v31X1 = v1X6 - v3X2; + v31Y1 = v1Y6 - v3Y2; + v31Z1 = v1Z6 - v3Z2; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; + var n12X1; + var n12Y1; + var n12Z1; + var n23X1; + var n23Y1; + var n23Z1; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; + n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; + n12Z1 = v12X6 * nY1 - v12Y6 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; + var mind2 = -1; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { + var v1X7; + var v1Y7; + var v1Z7; + var v2X7; + var v2Y7; + var v2Z7; + v1X7 = vec11.x; + v1Y7 = vec11.y; + v1Z7 = vec11.z; + v2X7 = vec21.x; + v2Y7 = vec21.y; + v2Z7 = vec21.z; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); + var b3; + if(t4 < 0) { + closest.x = v1X7; + closest.y = v1Y7; + closest.z = v1Z7; + b3 = 1; + } else if(t4 > 1) { + closest.x = v2X7; + closest.y = v2Y7; + closest.z = v2Z7; + b3 = 2; + } else { + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + closest.x = pX4; + closest.y = pY4; + closest.z = pZ4; + b3 = 3; + } + mini2 = b3; + mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { + var v1X8; + var v1Y8; + var v1Z8; + var v2X8; + var v2Y8; + var v2Z8; + v1X8 = vec21.x; + v1Y8 = vec21.y; + v1Z8 = vec21.z; + v2X8 = vec31.x; + v2Y8 = vec31.y; + v2Z8 = vec31.z; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); + var b4; + if(t5 < 0) { + closest.x = v1X8; + closest.y = v1Y8; + closest.z = v1Z8; + b4 = 1; + } else if(t5 > 1) { + closest.x = v2X8; + closest.y = v2Y8; + closest.z = v2Z8; + b4 = 2; + } else { + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + closest.x = pX5; + closest.y = pY5; + closest.z = pZ5; + b4 = 3; + } + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d2 < mind2) { + mini2 = b4 << 1; + mind2 = d2; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + } + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { + var v1X9; + var v1Y9; + var v1Z9; + var v2X9; + var v2Y9; + var v2Z9; + v1X9 = vec11.x; + v1Y9 = vec11.y; + v1Z9 = vec11.z; + v2X9 = vec31.x; + v2Y9 = vec31.y; + v2Z9 = vec31.z; + var v12X9; + var v12Y9; + var v12Z9; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; + t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); + var b5; + if(t6 < 0) { + closest.x = v1X9; + closest.y = v1Y9; + closest.z = v1Z9; + b5 = 1; + } else if(t6 > 1) { + closest.x = v2X9; + closest.y = v2Y9; + closest.z = v2Z9; + b5 = 2; + } else { + var pX6; + var pY6; + var pZ6; + pX6 = v1X9 + v12X9 * t6; + pY6 = v1Y9 + v12Y9 * t6; + pZ6 = v1Z9 + v12Z9 * t6; + closest.x = pX6; + closest.y = pY6; + closest.z = pZ6; + b5 = 3; + } + var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d3 < mind2) { + mini2 = b5 & 1 | (b5 & 2) << 1; + mind2 = d3; + minvX2 = closest.x; + minvY2 = closest.y; + minvZ2 = closest.z; + } + } + var b6; + if(mind2 > 0) { + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; + b6 = mini2; + } else { + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + closest.x = minvX2; + closest.y = minvY2; + closest.z = minvZ2; + b6 = 7; + } + mini1 = b6; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { + var v1X10; + var v1Y10; + var v1Z10; + var v2X10; + var v2Y10; + var v2Z10; + var v3X3; + var v3Y3; + var v3Z3; + var v12X10; + var v12Y10; + var v12Z10; + var v23X3; + var v23Y3; + var v23Z3; + var v31X2; + var v31Y2; + var v31Z2; + v1X10 = vec11.x; + v1Y10 = vec11.y; + v1Z10 = vec11.z; + v2X10 = vec31.x; + v2Y10 = vec31.y; + v2Z10 = vec31.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + v23X3 = v3X3 - v2X10; + v23Y3 = v3Y3 - v2Y10; + v23Z3 = v3Z3 - v2Z10; + v31X2 = v1X10 - v3X3; + v31Y2 = v1Y10 - v3Y3; + v31Z2 = v1Z10 - v3Z3; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; + var n12X2; + var n12Y2; + var n12Z2; + var n23X2; + var n23Y2; + var n23Z2; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; + n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; + n12Z2 = v12X10 * nY2 - v12Y10 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; + var mind3 = -1; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { + var v1X11; + var v1Y11; + var v1Z11; + var v2X11; + var v2Y11; + var v2Z11; + v1X11 = vec11.x; + v1Y11 = vec11.y; + v1Z11 = vec11.z; + v2X11 = vec31.x; + v2Y11 = vec31.y; + v2Z11 = vec31.z; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); + var b7; + if(t7 < 0) { + closest.x = v1X11; + closest.y = v1Y11; + closest.z = v1Z11; + b7 = 1; + } else if(t7 > 1) { + closest.x = v2X11; + closest.y = v2Y11; + closest.z = v2Z11; + b7 = 2; + } else { + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + closest.x = pX7; + closest.y = pY7; + closest.z = pZ7; + b7 = 3; + } + mini3 = b7; + mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { + var v1X12; + var v1Y12; + var v1Z12; + var v2X12; + var v2Y12; + var v2Z12; + v1X12 = vec31.x; + v1Y12 = vec31.y; + v1Z12 = vec31.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); + var b8; + if(t8 < 0) { + closest.x = v1X12; + closest.y = v1Y12; + closest.z = v1Z12; + b8 = 1; + } else if(t8 > 1) { + closest.x = v2X12; + closest.y = v2Y12; + closest.z = v2Z12; + b8 = 2; + } else { + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + closest.x = pX8; + closest.y = pY8; + closest.z = pZ8; + b8 = 3; + } + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d4 < mind3) { + mini3 = b8 << 1; + mind3 = d4; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + } + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { + var v1X13; + var v1Y13; + var v1Z13; + var v2X13; + var v2Y13; + var v2Z13; + v1X13 = vec11.x; + v1Y13 = vec11.y; + v1Z13 = vec11.z; + v2X13 = vec4.x; + v2Y13 = vec4.y; + v2Z13 = vec4.z; + var v12X13; + var v12Y13; + var v12Z13; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; + t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); + var b9; + if(t9 < 0) { + closest.x = v1X13; + closest.y = v1Y13; + closest.z = v1Z13; + b9 = 1; + } else if(t9 > 1) { + closest.x = v2X13; + closest.y = v2Y13; + closest.z = v2Z13; + b9 = 2; + } else { + var pX9; + var pY9; + var pZ9; + pX9 = v1X13 + v12X13 * t9; + pY9 = v1Y13 + v12Y13 * t9; + pZ9 = v1Z13 + v12Z13 * t9; + closest.x = pX9; + closest.y = pY9; + closest.z = pZ9; + b9 = 3; + } + var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d5 < mind3) { + mini3 = b9 & 1 | (b9 & 2) << 1; + mind3 = d5; + minvX3 = closest.x; + minvY3 = closest.y; + minvZ3 = closest.z; + } + } + var b10; + if(mind3 > 0) { + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; + b10 = mini3; + } else { + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + closest.x = minvX3; + closest.y = minvY3; + closest.z = minvZ3; + b10 = 7; + } + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d6 < mind1) { + mini1 = b10 & 1 | (b10 & 6) << 1; + mind1 = d6; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { + var v1X14; + var v1Y14; + var v1Z14; + var v2X14; + var v2Y14; + var v2Z14; + var v3X4; + var v3Y4; + var v3Z4; + var v12X14; + var v12Y14; + var v12Z14; + var v23X4; + var v23Y4; + var v23Z4; + var v31X3; + var v31Y3; + var v31Z3; + v1X14 = vec11.x; + v1Y14 = vec11.y; + v1Z14 = vec11.z; + v2X14 = vec21.x; + v2Y14 = vec21.y; + v2Z14 = vec21.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + v23X4 = v3X4 - v2X14; + v23Y4 = v3Y4 - v2Y14; + v23Z4 = v3Z4 - v2Z14; + v31X3 = v1X14 - v3X4; + v31Y3 = v1Y14 - v3Y4; + v31Z3 = v1Z14 - v3Z4; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; + var n12X3; + var n12Y3; + var n12Z3; + var n23X3; + var n23Y3; + var n23Z3; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; + n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; + n12Z3 = v12X14 * nY3 - v12Y14 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; + var mind4 = -1; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { + var v1X15; + var v1Y15; + var v1Z15; + var v2X15; + var v2Y15; + var v2Z15; + v1X15 = vec11.x; + v1Y15 = vec11.y; + v1Z15 = vec11.z; + v2X15 = vec21.x; + v2Y15 = vec21.y; + v2Z15 = vec21.z; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); + var b11; + if(t10 < 0) { + closest.x = v1X15; + closest.y = v1Y15; + closest.z = v1Z15; + b11 = 1; + } else if(t10 > 1) { + closest.x = v2X15; + closest.y = v2Y15; + closest.z = v2Z15; + b11 = 2; + } else { + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + closest.x = pX10; + closest.y = pY10; + closest.z = pZ10; + b11 = 3; + } + mini4 = b11; + mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { + var v1X16; + var v1Y16; + var v1Z16; + var v2X16; + var v2Y16; + var v2Z16; + v1X16 = vec21.x; + v1Y16 = vec21.y; + v1Z16 = vec21.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); + var b12; + if(t11 < 0) { + closest.x = v1X16; + closest.y = v1Y16; + closest.z = v1Z16; + b12 = 1; + } else if(t11 > 1) { + closest.x = v2X16; + closest.y = v2Y16; + closest.z = v2Z16; + b12 = 2; + } else { + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + closest.x = pX11; + closest.y = pY11; + closest.z = pZ11; + b12 = 3; + } + var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d7 < mind4) { + mini4 = b12 << 1; + mind4 = d7; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + } + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { + var v1X17; + var v1Y17; + var v1Z17; + var v2X17; + var v2Y17; + var v2Z17; + v1X17 = vec11.x; + v1Y17 = vec11.y; + v1Z17 = vec11.z; + v2X17 = vec4.x; + v2Y17 = vec4.y; + v2Z17 = vec4.z; + var v12X17; + var v12Y17; + var v12Z17; + v12X17 = v2X17 - v1X17; + v12Y17 = v2Y17 - v1Y17; + v12Z17 = v2Z17 - v1Z17; + var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; + t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); + var b13; + if(t12 < 0) { + closest.x = v1X17; + closest.y = v1Y17; + closest.z = v1Z17; + b13 = 1; + } else if(t12 > 1) { + closest.x = v2X17; + closest.y = v2Y17; + closest.z = v2Z17; + b13 = 2; + } else { + var pX12; + var pY12; + var pZ12; + pX12 = v1X17 + v12X17 * t12; + pY12 = v1Y17 + v12Y17 * t12; + pZ12 = v1Z17 + v12Z17 * t12; + closest.x = pX12; + closest.y = pY12; + closest.z = pZ12; + b13 = 3; + } + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d8 < mind4) { + mini4 = b13 & 1 | (b13 & 2) << 1; + mind4 = d8; + minvX4 = closest.x; + minvY4 = closest.y; + minvZ4 = closest.z; + } + } + var b14; + if(mind4 > 0) { + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; + b14 = mini4; + } else { + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + closest.x = minvX4; + closest.y = minvY4; + closest.z = minvZ4; + b14 = 7; + } + var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d9 < mind1) { + mini1 = b14 & 3 | (b14 & 4) << 1; + mind1 = d9; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { + var v1X18; + var v1Y18; + var v1Z18; + var v2X18; + var v2Y18; + var v2Z18; + var v3X5; + var v3Y5; + var v3Z5; + var v12X18; + var v12Y18; + var v12Z18; + var v23X5; + var v23Y5; + var v23Z5; + var v31X4; + var v31Y4; + var v31Z4; + v1X18 = vec21.x; + v1Y18 = vec21.y; + v1Z18 = vec21.z; + v2X18 = vec31.x; + v2Y18 = vec31.y; + v2Z18 = vec31.z; + v3X5 = vec4.x; + v3Y5 = vec4.y; + v3Z5 = vec4.z; + v12X18 = v2X18 - v1X18; + v12Y18 = v2Y18 - v1Y18; + v12Z18 = v2Z18 - v1Z18; + v23X5 = v3X5 - v2X18; + v23Y5 = v3Y5 - v2Y18; + v23Z5 = v3Z5 - v2Z18; + v31X4 = v1X18 - v3X5; + v31Y4 = v1Y18 - v3Y5; + v31Z4 = v1Z18 - v3Z5; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; + var n12X4; + var n12Y4; + var n12Z4; + var n23X4; + var n23Y4; + var n23Z4; + var n31X4; + var n31Y4; + var n31Z4; + n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; + n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; + n12Z4 = v12X18 * nY4 - v12Y18 * nX4; + n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; + n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; + n23Z4 = v23X5 * nY4 - v23Y5 * nX4; + n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; + n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; + n31Z4 = v31X4 * nY4 - v31Y4 * nX4; + var mind5 = -1; + var minvX5; + var minvY5; + var minvZ5; + var mini5 = 0; + minvX5 = 0; + minvY5 = 0; + minvZ5 = 0; + if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { + var v1X19; + var v1Y19; + var v1Z19; + var v2X19; + var v2Y19; + var v2Z19; + v1X19 = vec21.x; + v1Y19 = vec21.y; + v1Z19 = vec21.z; + v2X19 = vec31.x; + v2Y19 = vec31.y; + v2Z19 = vec31.z; + var v12X19; + var v12Y19; + var v12Z19; + v12X19 = v2X19 - v1X19; + v12Y19 = v2Y19 - v1Y19; + v12Z19 = v2Z19 - v1Z19; + var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; + t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); + var b15; + if(t13 < 0) { + closest.x = v1X19; + closest.y = v1Y19; + closest.z = v1Z19; + b15 = 1; + } else if(t13 > 1) { + closest.x = v2X19; + closest.y = v2Y19; + closest.z = v2Z19; + b15 = 2; + } else { + var pX13; + var pY13; + var pZ13; + pX13 = v1X19 + v12X19 * t13; + pY13 = v1Y19 + v12Y19 * t13; + pZ13 = v1Z19 + v12Z19 * t13; + closest.x = pX13; + closest.y = pY13; + closest.z = pZ13; + b15 = 3; + } + mini5 = b15; + mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { + var v1X20; + var v1Y20; + var v1Z20; + var v2X20; + var v2Y20; + var v2Z20; + v1X20 = vec31.x; + v1Y20 = vec31.y; + v1Z20 = vec31.z; + v2X20 = vec4.x; + v2Y20 = vec4.y; + v2Z20 = vec4.z; + var v12X20; + var v12Y20; + var v12Z20; + v12X20 = v2X20 - v1X20; + v12Y20 = v2Y20 - v1Y20; + v12Z20 = v2Z20 - v1Z20; + var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; + t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); + var b16; + if(t14 < 0) { + closest.x = v1X20; + closest.y = v1Y20; + closest.z = v1Z20; + b16 = 1; + } else if(t14 > 1) { + closest.x = v2X20; + closest.y = v2Y20; + closest.z = v2Z20; + b16 = 2; + } else { + var pX14; + var pY14; + var pZ14; + pX14 = v1X20 + v12X20 * t14; + pY14 = v1Y20 + v12Y20 * t14; + pZ14 = v1Z20 + v12Z20 * t14; + closest.x = pX14; + closest.y = pY14; + closest.z = pZ14; + b16 = 3; + } + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d10 < mind5) { + mini5 = b16 << 1; + mind5 = d10; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + } + if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { + var v1X21; + var v1Y21; + var v1Z21; + var v2X21; + var v2Y21; + var v2Z21; + v1X21 = vec21.x; + v1Y21 = vec21.y; + v1Z21 = vec21.z; + v2X21 = vec4.x; + v2Y21 = vec4.y; + v2Z21 = vec4.z; + var v12X21; + var v12Y21; + var v12Z21; + v12X21 = v2X21 - v1X21; + v12Y21 = v2Y21 - v1Y21; + v12Z21 = v2Z21 - v1Z21; + var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; + t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); + var b17; + if(t15 < 0) { + closest.x = v1X21; + closest.y = v1Y21; + closest.z = v1Z21; + b17 = 1; + } else if(t15 > 1) { + closest.x = v2X21; + closest.y = v2Y21; + closest.z = v2Z21; + b17 = 2; + } else { + var pX15; + var pY15; + var pZ15; + pX15 = v1X21 + v12X21 * t15; + pY15 = v1Y21 + v12Y21 * t15; + pZ15 = v1Z21 + v12Z21 * t15; + closest.x = pX15; + closest.y = pY15; + closest.z = pZ15; + b17 = 3; + } + var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d11 < mind5) { + mini5 = b17 & 1 | (b17 & 2) << 1; + mind5 = d11; + minvX5 = closest.x; + minvY5 = closest.y; + minvZ5 = closest.z; + } + } + var b18; + if(mind5 > 0) { + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; + b18 = mini5; + } else { + var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + nX4 *= l5; + nY4 *= l5; + nZ4 *= l5; + var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; + minvX5 = nX4 * l24; + minvY5 = nY4 * l24; + minvZ5 = nZ4 * l24; + closest.x = minvX5; + closest.y = minvY5; + closest.z = minvZ5; + b18 = 7; + } + var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d12 < mind1) { + mini1 = b18 << 1; + mind1 = d12; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if(mind1 > 0) { + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v3 = mini1; + } else { + closest.zero(); + v3 = 15; + } + break; + } + this.shrinkSimplex(v3); + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { + if(lambda == 0 || this.simplexSize == 4) { + hit.fraction = lambda; + return false; + } + this.interpolateClosestPoints(); + hit.fraction = lambda; + var _this1 = hit.normal; + _this1.x = dir.x; + _this1.y = dir.y; + _this1.z = dir.z; + var invLen = Math.sqrt(_this1.x * _this1.x + _this1.y * _this1.y + _this1.z * _this1.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this1.x *= invLen; + _this1.y *= invLen; + _this1.z *= invLen; + var _this2 = hit.position; + var v7 = this.closestPoint1; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; + _this2.x += tl1.x * lambda; + _this2.y += tl1.y * lambda; + _this2.z += tl1.z * lambda; + return true; + } + dir.x = closest.x; + dir.y = closest.y; + dir.z = closest.z; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; + if(this.c1 != null) { + this.computeWitnessPoint1(true); + } else { + var v8 = this.w1[this.simplexSize]; + v8.x = this.tf1._positionX; + v8.y = this.tf1._positionY; + v8.z = this.tf1._positionZ; + } + this.computeWitnessPoint2(true); + var _this3 = this.s[this.simplexSize]; + var v9 = this.w1[this.simplexSize]; + _this3.x = v9.x; + _this3.y = v9.y; + _this3.z = v9.z; + var v10 = this.w2[this.simplexSize]; + _this3.x -= v10.x; + _this3.y -= v10.y; + _this3.z -= v10.z; + var _this4 = s[this.simplexSize]; + _this4.x -= rayX.x; + _this4.y -= rayX.y; + _this4.z -= rayX.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { + throw new Error("!?"); + } + var p = s[this.simplexSize]; + var pn = p.x * dir.x + p.y * dir.y + p.z * dir.z; + if(pn < 0) { + if(rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z >= 0) { + return false; + } + var dLambda = pn / (rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z); + lambda += dLambda; + if(lambda >= 1) { + return false; + } + rayX.x += rayR.x * dLambda; + rayX.y += rayR.y * dLambda; + rayX.z += rayR.z * dLambda; + var _g1 = 0; + var _g2 = this.simplexSize + 1; + while(_g1 < _g2) { + var _this5 = s[_g1++]; + var s1 = -dLambda; + _this5.x += rayR.x * s1; + _this5.y += rayR.y * s1; + _this5.z += rayR.z * s1; + } + } + var duplicate = false; + var _g11 = 0; + var _g21 = this.simplexSize; + while(_g11 < _g21) { + var i = _g11++; + var dx = s[i].x - s[this.simplexSize].x; + var dy = s[i].y - s[this.simplexSize].y; + var dz = s[i].z - s[this.simplexSize].z; + if(dx * dx + dy * dy + dz * dz < 1e-008) { + duplicate = true; + break; + } + } + if(!duplicate) { + this.simplexSize++; + } + ++count; + } + return false; + } + ,interpolateClosestPoints: function() { + switch(this.simplexSize) { + case 1: + var _this = this.closestPoint1; + var v = this.w1[0]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.closestPoint2; + var v1 = this.w2[0]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + break; + case 2: + var cX; + var cY; + var cZ; + var v2 = this.closest; + cX = v2.x; + cY = v2.y; + cZ = v2.z; + var s0X; + var s0Y; + var s0Z; + var w10X; + var w10Y; + var w10Z; + var w20X; + var w20Y; + var w20Z; + var s1X; + var s1Y; + var s1Z; + var w11X; + var w11Y; + var w11Z; + var w21X; + var w21Y; + var w21Z; + var v3 = this.s[0]; + s0X = v3.x; + s0Y = v3.y; + s0Z = v3.z; + var v4 = this.w1[0]; + w10X = v4.x; + w10Y = v4.y; + w10Z = v4.z; + var v5 = this.w2[0]; + w20X = v5.x; + w20Y = v5.y; + w20Z = v5.z; + var v6 = this.s[1]; + s1X = v6.x; + s1Y = v6.y; + s1Z = v6.z; + var v7 = this.w1[1]; + w11X = v7.x; + w11Y = v7.y; + w11Z = v7.z; + var v8 = this.w2[1]; + w21X = v8.x; + w21Y = v8.y; + w21Z = v8.z; + var s01X; + var s01Y; + var s01Z; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + var invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + if(invDet != 0) { + invDet = 1 / invDet; + } + var s0cX; + var s0cY; + var s0cZ; + s0cX = cX - s0X; + s0cY = cY - s0Y; + s0cZ = cZ - s0Z; + var t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; + var diffX; + var diffY; + var diffZ; + var cp1X; + var cp1Y; + var cp1Z; + var cp2X; + var cp2Y; + var cp2Z; + diffX = w11X - w10X; + diffY = w11Y - w10Y; + diffZ = w11Z - w10Z; + cp1X = w10X + diffX * t; + cp1Y = w10Y + diffY * t; + cp1Z = w10Z + diffZ * t; + diffX = w21X - w20X; + diffY = w21Y - w20Y; + diffZ = w21Z - w20Z; + cp2X = w20X + diffX * t; + cp2Y = w20Y + diffY * t; + cp2Z = w20Z + diffZ * t; + var v9 = this.closestPoint1; + v9.x = cp1X; + v9.y = cp1Y; + v9.z = cp1Z; + var v10 = this.closestPoint2; + v10.x = cp2X; + v10.y = cp2Y; + v10.z = cp2Z; + break; + case 3: + var cX1; + var cY1; + var cZ1; + var v11 = this.closest; + cX1 = v11.x; + cY1 = v11.y; + cZ1 = v11.z; + var s0X1; + var s0Y1; + var s0Z1; + var w10X1; + var w10Y1; + var w10Z1; + var w20X1; + var w20Y1; + var w20Z1; + var s1X1; + var s1Y1; + var s1Z1; + var w11X1; + var w11Y1; + var w11Z1; + var w21X1; + var w21Y1; + var w21Z1; + var s2X; + var s2Y; + var s2Z; + var w12X; + var w12Y; + var w12Z; + var w22X; + var w22Y; + var w22Z; + var v12 = this.s[0]; + s0X1 = v12.x; + s0Y1 = v12.y; + s0Z1 = v12.z; + var v13 = this.w1[0]; + w10X1 = v13.x; + w10Y1 = v13.y; + w10Z1 = v13.z; + var v14 = this.w2[0]; + w20X1 = v14.x; + w20Y1 = v14.y; + w20Z1 = v14.z; + var v15 = this.s[1]; + s1X1 = v15.x; + s1Y1 = v15.y; + s1Z1 = v15.z; + var v16 = this.w1[1]; + w11X1 = v16.x; + w11Y1 = v16.y; + w11Z1 = v16.z; + var v17 = this.w2[1]; + w21X1 = v17.x; + w21Y1 = v17.y; + w21Z1 = v17.z; + var v18 = this.s[2]; + s2X = v18.x; + s2Y = v18.y; + s2Z = v18.z; + var v19 = this.w1[2]; + w12X = v19.x; + w12Y = v19.y; + w12Z = v19.z; + var v20 = this.w2[2]; + w22X = v20.x; + w22Y = v20.y; + w22Z = v20.z; + var s01X1; + var s01Y1; + var s01Z1; + var s02X; + var s02Y; + var s02Z; + var s0cX1; + var s0cY1; + var s0cZ1; + s01X1 = s1X1 - s0X1; + s01Y1 = s1Y1 - s0Y1; + s01Z1 = s1Z1 - s0Z1; + s02X = s2X - s0X1; + s02Y = s2Y - s0Y1; + s02Z = s2Z - s0Z1; + s0cX1 = cX1 - s0X1; + s0cY1 = cY1 - s0Y1; + s0cZ1 = cZ1 - s0Z1; + var d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; + var d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; + var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + var d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; + var d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; + var invDet1 = d11 * d22 - d12 * d12; + if(invDet1 != 0) { + invDet1 = 1 / invDet1; + } + var s = (d1c * d22 - d2c * d12) * invDet1; + var t1 = (-d1c * d12 + d2c * d11) * invDet1; + var diffX1; + var diffY1; + var diffZ1; + var cp1X1; + var cp1Y1; + var cp1Z1; + var cp2X1; + var cp2Y1; + var cp2Z1; + diffX1 = w11X1 - w10X1; + diffY1 = w11Y1 - w10Y1; + diffZ1 = w11Z1 - w10Z1; + cp1X1 = w10X1 + diffX1 * s; + cp1Y1 = w10Y1 + diffY1 * s; + cp1Z1 = w10Z1 + diffZ1 * s; + diffX1 = w12X - w10X1; + diffY1 = w12Y - w10Y1; + diffZ1 = w12Z - w10Z1; + cp1X1 += diffX1 * t1; + cp1Y1 += diffY1 * t1; + cp1Z1 += diffZ1 * t1; + diffX1 = w21X1 - w20X1; + diffY1 = w21Y1 - w20Y1; + diffZ1 = w21Z1 - w20Z1; + cp2X1 = w20X1 + diffX1 * s; + cp2Y1 = w20Y1 + diffY1 * s; + cp2Z1 = w20Z1 + diffZ1 * s; + diffX1 = w22X - w20X1; + diffY1 = w22Y - w20Y1; + diffZ1 = w22Z - w20Z1; + cp2X1 += diffX1 * t1; + cp2Y1 += diffY1 * t1; + cp2Z1 += diffZ1 * t1; + var v21 = this.closestPoint1; + v21.x = cp1X1; + v21.y = cp1Y1; + v21.z = cp1Z1; + var v22 = this.closestPoint2; + v22.x = cp2X1; + v22.y = cp2Y1; + v22.z = cp2Z1; + break; + default: + throw new Error("!?"); + } + } + ,loadCache: function(gjkCache) { + var _this = this.dir; + var v = gjkCache.prevClosestDir; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + } + ,saveCache: function(gjkCache) { + var _this = gjkCache.prevClosestDir; + var v = this.closest; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; + } + ,shrinkSimplex: function(vertexBits) { + this.simplexSize = vertexBits; + this.simplexSize = (this.simplexSize & 5) + (this.simplexSize >> 1 & 5); + this.simplexSize = (this.simplexSize & 3) + (this.simplexSize >> 2 & 3); + switch(vertexBits) { + case 2: + var _this = this.s[0]; + var v = this.s[1]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.w1[0]; + var v1 = this.w1[1]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + var _this2 = this.w2[0]; + var v2 = this.w2[1]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + break; + case 4: + var _this3 = this.s[0]; + var v3 = this.s[2]; + _this3.x = v3.x; + _this3.y = v3.y; + _this3.z = v3.z; + var _this4 = this.w1[0]; + var v4 = this.w1[2]; + _this4.x = v4.x; + _this4.y = v4.y; + _this4.z = v4.z; + var _this5 = this.w2[0]; + var v5 = this.w2[2]; + _this5.x = v5.x; + _this5.y = v5.y; + _this5.z = v5.z; + break; + case 5: + var _this6 = this.s[1]; + var v6 = this.s[2]; + _this6.x = v6.x; + _this6.y = v6.y; + _this6.z = v6.z; + var _this7 = this.w1[1]; + var v7 = this.w1[2]; + _this7.x = v7.x; + _this7.y = v7.y; + _this7.z = v7.z; + var _this8 = this.w2[1]; + var v8 = this.w2[2]; + _this8.x = v8.x; + _this8.y = v8.y; + _this8.z = v8.z; + break; + case 6: + var _this9 = this.s[0]; + var v9 = this.s[2]; + _this9.x = v9.x; + _this9.y = v9.y; + _this9.z = v9.z; + var _this10 = this.w1[0]; + var v10 = this.w1[2]; + _this10.x = v10.x; + _this10.y = v10.y; + _this10.z = v10.z; + var _this11 = this.w2[0]; + var v11 = this.w2[2]; + _this11.x = v11.x; + _this11.y = v11.y; + _this11.z = v11.z; + break; + case 8: + var _this12 = this.s[0]; + var v12 = this.s[3]; + _this12.x = v12.x; + _this12.y = v12.y; + _this12.z = v12.z; + var _this13 = this.w1[0]; + var v13 = this.w1[3]; + _this13.x = v13.x; + _this13.y = v13.y; + _this13.z = v13.z; + var _this14 = this.w2[0]; + var v14 = this.w2[3]; + _this14.x = v14.x; + _this14.y = v14.y; + _this14.z = v14.z; + break; + case 9: + var _this15 = this.s[1]; + var v15 = this.s[3]; + _this15.x = v15.x; + _this15.y = v15.y; + _this15.z = v15.z; + var _this16 = this.w1[1]; + var v16 = this.w1[3]; + _this16.x = v16.x; + _this16.y = v16.y; + _this16.z = v16.z; + var _this17 = this.w2[1]; + var v17 = this.w2[3]; + _this17.x = v17.x; + _this17.y = v17.y; + _this17.z = v17.z; + break; + case 10: + var _this18 = this.s[0]; + var v18 = this.s[3]; + _this18.x = v18.x; + _this18.y = v18.y; + _this18.z = v18.z; + var _this19 = this.w1[0]; + var v19 = this.w1[3]; + _this19.x = v19.x; + _this19.y = v19.y; + _this19.z = v19.z; + var _this20 = this.w2[0]; + var v20 = this.w2[3]; + _this20.x = v20.x; + _this20.y = v20.y; + _this20.z = v20.z; + break; + case 11: + var _this21 = this.s[2]; + var v21 = this.s[3]; + _this21.x = v21.x; + _this21.y = v21.y; + _this21.z = v21.z; + var _this22 = this.w1[2]; + var v22 = this.w1[3]; + _this22.x = v22.x; + _this22.y = v22.y; + _this22.z = v22.z; + var _this23 = this.w2[2]; + var v23 = this.w2[3]; + _this23.x = v23.x; + _this23.y = v23.y; + _this23.z = v23.z; + break; + case 12: + var _this24 = this.s[0]; + var v24 = this.s[2]; + _this24.x = v24.x; + _this24.y = v24.y; + _this24.z = v24.z; + var _this25 = this.w1[0]; + var v25 = this.w1[2]; + _this25.x = v25.x; + _this25.y = v25.y; + _this25.z = v25.z; + var _this26 = this.w2[0]; + var v26 = this.w2[2]; + _this26.x = v26.x; + _this26.y = v26.y; + _this26.z = v26.z; + var _this27 = this.s[1]; + var v27 = this.s[3]; + _this27.x = v27.x; + _this27.y = v27.y; + _this27.z = v27.z; + var _this28 = this.w1[1]; + var v28 = this.w1[3]; + _this28.x = v28.x; + _this28.y = v28.y; + _this28.z = v28.z; + var _this29 = this.w2[1]; + var v29 = this.w2[3]; + _this29.x = v29.x; + _this29.y = v29.y; + _this29.z = v29.z; + break; + case 13: + var _this30 = this.s[1]; + var v30 = this.s[3]; + _this30.x = v30.x; + _this30.y = v30.y; + _this30.z = v30.z; + var _this31 = this.w1[1]; + var v31 = this.w1[3]; + _this31.x = v31.x; + _this31.y = v31.y; + _this31.z = v31.z; + var _this32 = this.w2[1]; + var v32 = this.w2[3]; + _this32.x = v32.x; + _this32.y = v32.y; + _this32.z = v32.z; + break; + case 14: + var _this33 = this.s[0]; + var v33 = this.s[3]; + _this33.x = v33.x; + _this33.y = v33.y; + _this33.z = v33.z; + var _this34 = this.w1[0]; + var v34 = this.w1[3]; + _this34.x = v34.x; + _this34.y = v34.y; + _this34.z = v34.z; + var _this35 = this.w2[0]; + var v35 = this.w2[3]; + _this35.x = v35.x; + _this35.y = v35.y; + _this35.z = v35.z; + break; + } + } + ,computeWitnessPoint1: function(addMargin) { + var tmpX; + var tmpY; + var tmpZ; + var idirX; + var idirY; + var idirZ; + var v = this.dir; + idirX = v.x; + idirY = v.y; + idirZ = v.z; + var ldir1X; + var ldir1Y; + var ldir1Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf1._rotation00 * idirX + this.tf1._rotation10 * idirY + this.tf1._rotation20 * idirZ; + __tmp__Y = this.tf1._rotation01 * idirX + this.tf1._rotation11 * idirY + this.tf1._rotation21 * idirZ; + __tmp__Z = this.tf1._rotation02 * idirX + this.tf1._rotation12 * idirY + this.tf1._rotation22 * idirZ; + ldir1X = __tmp__X; + ldir1Y = __tmp__Y; + ldir1Z = __tmp__Z; + var iw1X; + var iw1Y; + var iw1Z; + var v1 = this.dir; + v1.x = ldir1X; + v1.y = ldir1Y; + v1.z = ldir1Z; + this.c1.computeLocalSupportingVertex(this.dir,this.w1[this.simplexSize]); + if(addMargin) { + var _this = this.dir; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + var _this1 = this.w1[this.simplexSize]; + var v2 = this.dir; + var s = this.c1._gjkMargin; + _this1.x += v2.x * s; + _this1.y += v2.y * s; + _this1.z += v2.z * s; + } + var v3 = this.w1[this.simplexSize]; + tmpX = v3.x; + tmpY = v3.y; + tmpZ = v3.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; + __tmp__Y1 = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; + __tmp__Z1 = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; + iw1X = __tmp__X1; + iw1Y = __tmp__Y1; + iw1Z = __tmp__Z1; + iw1X += this.tf1._positionX; + iw1Y += this.tf1._positionY; + iw1Z += this.tf1._positionZ; + var v4 = this.w1[this.simplexSize]; + v4.x = iw1X; + v4.y = iw1Y; + v4.z = iw1Z; + var v5 = this.dir; + v5.x = idirX; + v5.y = idirY; + v5.z = idirZ; + } + ,computeWitnessPoint2: function(addMargin) { + var tmpX; + var tmpY; + var tmpZ; + var idirX; + var idirY; + var idirZ; + var v = this.dir; + idirX = v.x; + idirY = v.y; + idirZ = v.z; + var ldir2X; + var ldir2Y; + var ldir2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf2._rotation00 * idirX + this.tf2._rotation10 * idirY + this.tf2._rotation20 * idirZ; + __tmp__Y = this.tf2._rotation01 * idirX + this.tf2._rotation11 * idirY + this.tf2._rotation21 * idirZ; + __tmp__Z = this.tf2._rotation02 * idirX + this.tf2._rotation12 * idirY + this.tf2._rotation22 * idirZ; + ldir2X = __tmp__X; + ldir2Y = __tmp__Y; + ldir2Z = __tmp__Z; + ldir2X = -ldir2X; + ldir2Y = -ldir2Y; + ldir2Z = -ldir2Z; + var iw2X; + var iw2Y; + var iw2Z; + var v1 = this.dir; + v1.x = ldir2X; + v1.y = ldir2Y; + v1.z = ldir2Z; + this.c2.computeLocalSupportingVertex(this.dir,this.w2[this.simplexSize]); + if(addMargin) { + var _this = this.dir; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + var _this1 = this.w2[this.simplexSize]; + var v2 = this.dir; + var s = this.c2._gjkMargin; + _this1.x += v2.x * s; + _this1.y += v2.y * s; + _this1.z += v2.z * s; + } + var v3 = this.w2[this.simplexSize]; + tmpX = v3.x; + tmpY = v3.y; + tmpZ = v3.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; + __tmp__Y1 = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; + __tmp__Z1 = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; + iw2X = __tmp__X1; + iw2Y = __tmp__Y1; + iw2Z = __tmp__Z1; + iw2X += this.tf2._positionX; + iw2Y += this.tf2._positionY; + iw2Z += this.tf2._positionZ; + var v4 = this.w2[this.simplexSize]; + v4.x = iw2X; + v4.y = iw2Y; + v4.z = iw2Z; + var v5 = this.dir; + v5.x = idirX; + v5.y = idirY; + v5.z = idirZ; + } + ,pointToTetrahedron: function() { + var _g = 0; + while(_g < 3) { + var _this = this.dir; + var v = this.baseDirs[_g++]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this1 = this.s[this.simplexSize]; + var v1 = this.w1[this.simplexSize]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + var v2 = this.w2[this.simplexSize]; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; + this.simplexSize++; + this.lineToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + var _this2 = this.dir; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this3 = this.s[this.simplexSize]; + var v3 = this.w1[this.simplexSize]; + _this3.x = v3.x; + _this3.y = v3.y; + _this3.z = v3.z; + var v4 = this.w2[this.simplexSize]; + _this3.x -= v4.x; + _this3.y -= v4.y; + _this3.z -= v4.z; + this.simplexSize++; + this.lineToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + } + } + ,lineToTetrahedron: function() { + var oldDirX; + var oldDirY; + var oldDirZ; + var v = this.dir; + oldDirX = v.x; + oldDirY = v.y; + oldDirZ = v.z; + var s0X; + var s0Y; + var s0Z; + var s1X; + var s1Y; + var s1Z; + var lineDirX; + var lineDirY; + var lineDirZ; + var v1 = this.s[0]; + s0X = v1.x; + s0Y = v1.y; + s0Z = v1.z; + var v2 = this.s[1]; + s1X = v2.x; + s1Y = v2.y; + s1Z = v2.z; + lineDirX = s0X - s1X; + lineDirY = s0Y - s1Y; + lineDirZ = s0Z - s1Z; + var _g = 0; + while(_g < 3) { + var baseDirX; + var baseDirY; + var baseDirZ; + var v3 = this.baseDirs[_g++]; + baseDirX = v3.x; + baseDirY = v3.y; + baseDirZ = v3.z; + var newDirX; + var newDirY; + var newDirZ; + newDirX = lineDirY * baseDirZ - lineDirZ * baseDirY; + newDirY = lineDirZ * baseDirX - lineDirX * baseDirZ; + newDirZ = lineDirX * baseDirY - lineDirY * baseDirX; + var v4 = this.dir; + v4.x = newDirX; + v4.y = newDirY; + v4.z = newDirZ; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v5 = this.w1[this.simplexSize]; + _this.x = v5.x; + _this.y = v5.y; + _this.z = v5.z; + var v6 = this.w2[this.simplexSize]; + _this.x -= v6.x; + _this.y -= v6.y; + _this.z -= v6.z; + this.simplexSize++; + this.triangleToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + var _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this2 = this.s[this.simplexSize]; + var v7 = this.w1[this.simplexSize]; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; + var v8 = this.w2[this.simplexSize]; + _this2.x -= v8.x; + _this2.y -= v8.y; + _this2.z -= v8.z; + this.simplexSize++; + this.triangleToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + } + var v9 = this.dir; + v9.x = oldDirX; + v9.y = oldDirY; + v9.z = oldDirZ; + } + ,triangleToTetrahedron: function() { + var oldDirX; + var oldDirY; + var oldDirZ; + var v = this.dir; + oldDirX = v.x; + oldDirY = v.y; + oldDirZ = v.z; + while(true) { + var s0X; + var s0Y; + var s0Z; + var s1X; + var s1Y; + var s1Z; + var s2X; + var s2Y; + var s2Z; + var s01X; + var s01Y; + var s01Z; + var s02X; + var s02Y; + var s02Z; + var v1 = this.s[0]; + s0X = v1.x; + s0Y = v1.y; + s0Z = v1.z; + var v2 = this.s[1]; + s1X = v2.x; + s1Y = v2.y; + s1Z = v2.z; + var v3 = this.s[2]; + s2X = v3.x; + s2Y = v3.y; + s2Z = v3.z; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + s02X = s2X - s0X; + s02Y = s2Y - s0Y; + s02Z = s2Z - s0Z; + var nX; + var nY; + var nZ; + nX = s01Y * s02Z - s01Z * s02Y; + nY = s01Z * s02X - s01X * s02Z; + nZ = s01X * s02Y - s01Y * s02X; + var v4 = this.dir; + v4.x = nX; + v4.y = nY; + v4.z = nZ; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v5 = this.w1[this.simplexSize]; + _this.x = v5.x; + _this.y = v5.y; + _this.z = v5.z; + var v6 = this.w2[this.simplexSize]; + _this.x -= v6.x; + _this.y -= v6.y; + _this.z -= v6.z; + this.simplexSize++; + if(this.isValidTetrahedron()) { + break; + } + this.simplexSize--; + var _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this2 = this.s[this.simplexSize]; + var v7 = this.w1[this.simplexSize]; + _this2.x = v7.x; + _this2.y = v7.y; + _this2.z = v7.z; + var v8 = this.w2[this.simplexSize]; + _this2.x -= v8.x; + _this2.y -= v8.y; + _this2.z -= v8.z; + this.simplexSize++; + if(this.isValidTetrahedron()) { + break; + } + this.simplexSize--; + break; + } + var v9 = this.dir; + v9.x = oldDirX; + v9.y = oldDirY; + v9.z = oldDirZ; + } + ,isValidTetrahedron: function() { + var e10 = this.s[2].x - this.s[0].x; + var e11 = this.s[2].y - this.s[0].y; + var e12 = this.s[2].z - this.s[0].z; + var e20 = this.s[3].x - this.s[0].x; + var e21 = this.s[3].y - this.s[0].y; + var e22 = this.s[3].z - this.s[0].z; + var det = (this.s[1].x - this.s[0].x) * (e11 * e22 - e12 * e21) - (this.s[1].y - this.s[0].y) * (e10 * e22 - e12 * e20) + (this.s[1].z - this.s[0].z) * (e10 * e21 - e11 * e20); + if(!(det > 1e-12)) { + return det < -1e-12; + } else { + return true; + } + } + ,computeDepth: function(convex1,convex2,tf1,tf2,initialPolyhedron,initialPolyhedron1,initialPolyhedron2) { + var _this = this.polyhedron; + while(_this._numTriangles > 0) { + var t = _this._triangleList; + _this._numTriangles--; + var prev = t._prev; + var next = t._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(t == _this._triangleList) { + _this._triangleList = _this._triangleList._next; + } + if(t == _this._triangleListLast) { + _this._triangleListLast = _this._triangleListLast._prev; + } + t._next = null; + t._prev = null; + t.removeReferences(); + t._next = _this._trianglePool; + _this._trianglePool = t; + } + while(_this._numVertices > 0) { + var v = _this._vertices[--_this._numVertices]; + v.removeReferences(); + v._next = _this._vertexPool; + _this._vertexPool = v; + } + var tmp = this.polyhedron; + var _this1 = this.polyhedron; + var first = _this1._vertexPool; + if(first != null) { + _this1._vertexPool = first._next; + first._next = null; + } else { + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); + var _this2 = this.polyhedron; + var first1 = _this2._vertexPool; + if(first1 != null) { + _this2._vertexPool = first1._next; + first1._next = null; + } else { + first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); + var _this3 = this.polyhedron; + var first2 = _this3._vertexPool; + if(first2 != null) { + _this3._vertexPool = first2._next; + first2._next = null; + } else { + first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); + var _this4 = this.polyhedron; + var first3 = _this4._vertexPool; + if(first3 != null) { + _this4._vertexPool = first3._next; + first3._next = null; + } else { + first3 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + if(!tmp._init(tmp1,tmp2,tmp3,first3.init(initialPolyhedron[3],initialPolyhedron1[3],initialPolyhedron2[3]))) { + return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_INIT; + } + this.simplexSize = 0; + var supportingVertex = this.s[0]; + var witness1 = this.w1[0]; + var witness2 = this.w2[0]; + var count = 0; + while(count < 40) { + var f = this.polyhedron._triangleList; + var mind = 1e65536; + var minf = null; + while(f != null) { + if(f._distanceSq < mind) { + mind = f._distanceSq; + minf = f; + } + f = f._next; + } + var face = minf; + var _this5 = this.dir; + var v1 = face._normal; + _this5.x = v1.x; + _this5.y = v1.y; + _this5.z = v1.z; + var invLen = Math.sqrt(_this5.x * _this5.x + _this5.y * _this5.y + _this5.z * _this5.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this5.x *= invLen; + _this5.y *= invLen; + _this5.z *= invLen; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this6 = this.s[this.simplexSize]; + var v2 = this.w1[this.simplexSize]; + _this6.x = v2.x; + _this6.y = v2.y; + _this6.z = v2.z; + var v3 = this.w2[this.simplexSize]; + _this6.x -= v3.x; + _this6.y -= v3.y; + _this6.z -= v3.z; + var v0 = face._vertices[0]; + var v11 = face._vertices[1]; + var v21 = face._vertices[2]; + var _this7 = v0.v; + var v4 = this.dir; + var v5 = this.dir; + if(supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z - (_this7.x * v4.x + _this7.y * v4.y + _this7.z * v4.z) < 1e-6 || count == 39) { + var _this8 = this.closest; + var v6 = this.dir; + _this8.x = v6.x; + _this8.y = v6.y; + _this8.z = v6.z; + var _this9 = this.dir; + var v7 = v0.v; + var _this10 = this.dir; + var s = (_this9.x * v7.x + _this9.y * v7.y + _this9.z * v7.z) / (_this10.x * _this10.x + _this10.y * _this10.y + _this10.z * _this10.z); + _this8.x *= s; + _this8.y *= s; + _this8.z *= s; + var cX; + var cY; + var cZ; + var v8 = this.closest; + cX = v8.x; + cY = v8.y; + cZ = v8.z; + var s0X; + var s0Y; + var s0Z; + var w10X; + var w10Y; + var w10Z; + var w20X; + var w20Y; + var w20Z; + var s1X; + var s1Y; + var s1Z; + var w11X; + var w11Y; + var w11Z; + var w21X; + var w21Y; + var w21Z; + var s2X; + var s2Y; + var s2Z; + var w12X; + var w12Y; + var w12Z; + var w22X; + var w22Y; + var w22Z; + var v9 = v0.v; + s0X = v9.x; + s0Y = v9.y; + s0Z = v9.z; + var v10 = v0.w1; + w10X = v10.x; + w10Y = v10.y; + w10Z = v10.z; + var v12 = v0.w2; + w20X = v12.x; + w20Y = v12.y; + w20Z = v12.z; + var v13 = v11.v; + s1X = v13.x; + s1Y = v13.y; + s1Z = v13.z; + var v14 = v11.w1; + w11X = v14.x; + w11Y = v14.y; + w11Z = v14.z; + var v15 = v11.w2; + w21X = v15.x; + w21Y = v15.y; + w21Z = v15.z; + var v16 = v21.v; + s2X = v16.x; + s2Y = v16.y; + s2Z = v16.z; + var v17 = v21.w1; + w12X = v17.x; + w12Y = v17.y; + w12Z = v17.z; + var v18 = v21.w2; + w22X = v18.x; + w22Y = v18.y; + w22Z = v18.z; + var s01X; + var s01Y; + var s01Z; + var s02X; + var s02Y; + var s02Z; + var s0cX; + var s0cY; + var s0cZ; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + s02X = s2X - s0X; + s02Y = s2Y - s0Y; + s02Z = s2Z - s0Z; + s0cX = cX - s0X; + s0cY = cY - s0Y; + s0cZ = cZ - s0Z; + var d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + var d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; + var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + var d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; + var d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; + var invDet = d11 * d22 - d12 * d12; + if(invDet != 0) { + invDet = 1 / invDet; + } + var s1 = (d1c * d22 - d2c * d12) * invDet; + var t1 = (-d1c * d12 + d2c * d11) * invDet; + var diffX; + var diffY; + var diffZ; + var cp1X; + var cp1Y; + var cp1Z; + var cp2X; + var cp2Y; + var cp2Z; + diffX = w11X - w10X; + diffY = w11Y - w10Y; + diffZ = w11Z - w10Z; + cp1X = w10X + diffX * s1; + cp1Y = w10Y + diffY * s1; + cp1Z = w10Z + diffZ * s1; + diffX = w12X - w10X; + diffY = w12Y - w10Y; + diffZ = w12Z - w10Z; + cp1X += diffX * t1; + cp1Y += diffY * t1; + cp1Z += diffZ * t1; + diffX = w21X - w20X; + diffY = w21Y - w20Y; + diffZ = w21Z - w20Z; + cp2X = w20X + diffX * s1; + cp2Y = w20Y + diffY * s1; + cp2Z = w20Z + diffZ * s1; + diffX = w22X - w20X; + diffY = w22Y - w20Y; + diffZ = w22Z - w20Z; + cp2X += diffX * t1; + cp2Y += diffY * t1; + cp2Z += diffZ * t1; + var v19 = this.closestPoint1; + v19.x = cp1X; + v19.y = cp1Y; + v19.z = cp1Z; + var v20 = this.closestPoint2; + v20.x = cp2X; + v20.y = cp2Y; + v20.z = cp2Z; + var _this11 = this.closest; + this.depth = Math.sqrt(_this11.x * _this11.x + _this11.y * _this11.y + _this11.z * _this11.z); + return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED; + } + var _this12 = this.polyhedron; + var first4 = _this12._vertexPool; + if(first4 != null) { + _this12._vertexPool = first4._next; + first4._next = null; + } else { + first4 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var epaVertex = first4.init(supportingVertex,witness1,witness2); + if(!this.polyhedron._addVertex(epaVertex,face)) { + return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; + } + ++count; + } + return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_DID_NOT_CONVERGE; + } + ,computeClosestPoints: function(c1,c2,tf1,tf2,cache) { + return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,true); + } + ,computeDistance: function(c1,c2,tf1,tf2,cache) { + return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,false); + } + ,convexCast: function(c1,c2,tf1,tf2,tl1,tl2,hit) { + return this.convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit); + } + ,rayCast: function(c,tf,begin,end,hit) { + var tf1 = this.tempTransform; + tf1._positionX = begin.x; + tf1._positionY = begin.y; + tf1._positionZ = begin.z; + var tl1 = this.tl1; + var tl2 = this.tl2; + tl1.x = end.x; + tl1.y = end.y; + tl1.z = end.z; + tl1.x -= begin.x; + tl1.y -= begin.y; + tl1.z -= begin.z; + tl2.zero(); + return this.convexCastImpl(null,c,tf1,tf,tl1,tl2,hit); + } + ,__class__: oimo_collision_narrowphase_detector_gjkepa_GjkEpa +}; +var oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog = function() { }; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog.__name__ = true; +var oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState = function() { }; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.__name__ = true; +var oimo_collision_narrowphase_detector_gjkepa_SimplexUtil = function() { }; +oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.__name__ = true; +oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2 = function(vec1,vec2,out) { + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + return 1; + } + if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + return 2; + } + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + return 3; +}; +oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function(vec1,vec2,vec3,out) { + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind = -1; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + var v12X1; + var v12Y1; + var v12Z1; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; + t = -t / (v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X1 + v12X1 * t; + pY = v1Y1 + v12Y1 * t; + pZ = v1Z1 + v12Z1 * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini = b; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec2.x; + v1Y2 = vec2.y; + v1Z2 = vec2.z; + v2X2 = vec3.x; + v2Y2 = vec3.y; + v2Z2 = vec3.z; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + var b1; + if(t1 < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b1 = 1; + } else if(t1 > 1) { + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; + b1 = 2; + } else { + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + out.x = pX1; + out.y = pY1; + out.z = pZ1; + b1 = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b1 << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X3; + var v1Y3; + var v1Z3; + var v2X3; + var v2Y3; + var v2Z3; + v1X3 = vec1.x; + v1Y3 = vec1.y; + v1Z3 = vec1.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); + var b2; + if(t2 < 0) { + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; + b2 = 1; + } else if(t2 > 1) { + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; + b2 = 2; + } else { + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + out.x = pX2; + out.y = pY2; + out.z = pZ2; + b2 = 3; + } + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d1 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d1; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(mind > 0) { + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return mini; + } + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return 7; +}; +oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function(vec1,vec2,vec3,vec4,out) { + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v3X; + var v3Y; + var v3Z; + var v4X; + var v4Y; + var v4Z; + var v12X; + var v12Y; + var v12Z; + var v13X; + var v13Y; + var v13Z; + var v14X; + var v14Y; + var v14Z; + var v23X; + var v23Y; + var v23Z; + var v24X; + var v24Y; + var v24Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v13X = v3X - v1X; + v13Y = v3Y - v1Y; + v13Z = v3Z - v1Z; + v14X = v4X - v1X; + v14Y = v4Y - v1Y; + v14Z = v4Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v24X = v4X - v2X; + v24Y = v4Y - v2Y; + v24Z = v4Z - v2Z; + var n123X; + var n123Y; + var n123Z; + var n134X; + var n134Y; + var n134Z; + var n142X; + var n142Y; + var n142Z; + var n243X; + var n243Y; + var n243Z; + n123X = v12Y * v13Z - v12Z * v13Y; + n123Y = v12Z * v13X - v12X * v13Z; + n123Z = v12X * v13Y - v12Y * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z - v14Z * v12Y; + n142Y = v14Z * v12X - v14X * v12Z; + n142Z = v14X * v12Y - v14Y * v12X; + n243X = v24Y * v23Z - v24Z * v23Y; + n243Y = v24Z * v23X - v24X * v23Z; + n243Z = v24X * v23Y - v24Y * v23X; + var sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; + var mind = -1; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if((v1X * n123X + v1Y * n123Y + v1Z * n123Z) * sign < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + var v3X1; + var v3Y1; + var v3Z1; + var v12X1; + var v12Y1; + var v12Z1; + var v23X1; + var v23Y1; + var v23Z1; + var v31X; + var v31Y; + var v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X1 = vec3.x; + v3Y1 = vec3.y; + v3Z1 = vec3.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X1 = v3X1 - v2X1; + v23Y1 = v3Y1 - v2Y1; + v23Z1 = v3Z1 - v2Z1; + v31X = v1X1 - v3X1; + v31Y = v1Y1 - v3Y1; + v31Z = v1Z1 - v3Z1; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z1 - v12Z1 * v23Y1; + nY = v12Z1 * v23X1 - v12X1 * v23Z1; + nZ = v12X1 * v23Y1 - v12Y1 * v23X1; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y1 * nZ - v23Z1 * nY; + n23Y = v23Z1 * nX - v23X1 * nZ; + n23Z = v23X1 * nY - v23Y1 * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X2 * t; + pY = v1Y2 + v12Y2 * t; + pZ = v1Z2 + v12Z2 * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X3; + var v1Y3; + var v1Z3; + var v2X3; + var v2Y3; + var v2Z3; + v1X3 = vec2.x; + v1Y3 = vec2.y; + v1Z3 = vec2.z; + v2X3 = vec3.x; + v2Y3 = vec3.y; + v2Z3 = vec3.z; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); + var b1; + if(t1 < 0) { + out.x = v1X3; + out.y = v1Y3; + out.z = v1Z3; + b1 = 1; + } else if(t1 > 1) { + out.x = v2X3; + out.y = v2Y3; + out.z = v2Z3; + b1 = 2; + } else { + var pX1; + var pY1; + var pZ1; + pX1 = v1X3 + v12X3 * t1; + pY1 = v1Y3 + v12Y3 * t1; + pZ1 = v1Z3 + v12Z3 * t1; + out.x = pX1; + out.y = pY1; + out.z = pZ1; + b1 = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b1 << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { + var v1X4; + var v1Y4; + var v1Z4; + var v2X4; + var v2Y4; + var v2Z4; + v1X4 = vec1.x; + v1Y4 = vec1.y; + v1Z4 = vec1.z; + v2X4 = vec3.x; + v2Y4 = vec3.y; + v2Z4 = vec3.z; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); + var b2; + if(t2 < 0) { + out.x = v1X4; + out.y = v1Y4; + out.z = v1Z4; + b2 = 1; + } else if(t2 > 1) { + out.x = v2X4; + out.y = v2Y4; + out.z = v2Z4; + b2 = 2; + } else { + var pX2; + var pY2; + var pZ2; + pX2 = v1X4 + v12X4 * t2; + pY2 = v1Y4 + v12Y4 * t2; + pZ2 = v1Z4 + v12Z4 * t2; + out.x = pX2; + out.y = pY2; + out.z = pZ2; + b2 = 3; + } + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d1 < mind1) { + mini1 = b2 & 1 | (b2 & 2) << 1; + mind1 = d1; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + var b3; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b3 = mini1; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b3 = 7; + } + mini = b3; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { + var v1X5; + var v1Y5; + var v1Z5; + var v2X5; + var v2Y5; + var v2Z5; + var v3X2; + var v3Y2; + var v3Z2; + var v12X5; + var v12Y5; + var v12Z5; + var v23X2; + var v23Y2; + var v23Z2; + var v31X1; + var v31Y1; + var v31Z1; + v1X5 = vec1.x; + v1Y5 = vec1.y; + v1Z5 = vec1.z; + v2X5 = vec3.x; + v2Y5 = vec3.y; + v2Z5 = vec3.z; + v3X2 = vec4.x; + v3Y2 = vec4.y; + v3Z2 = vec4.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v23X2 = v3X2 - v2X5; + v23Y2 = v3Y2 - v2Y5; + v23Z2 = v3Z2 - v2Z5; + v31X1 = v1X5 - v3X2; + v31Y1 = v1Y5 - v3Y2; + v31Z1 = v1Z5 - v3Z2; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y5 * v23Z2 - v12Z5 * v23Y2; + nY1 = v12Z5 * v23X2 - v12X5 * v23Z2; + nZ1 = v12X5 * v23Y2 - v12Y5 * v23X2; + var n12X1; + var n12Y1; + var n12Z1; + var n23X1; + var n23Y1; + var n23Z1; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y5 * nZ1 - v12Z5 * nY1; + n12Y1 = v12Z5 * nX1 - v12X5 * nZ1; + n12Z1 = v12X5 * nY1 - v12Y5 * nX1; + n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; + n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; + n23Z1 = v23X2 * nY1 - v23Y2 * nX1; + n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; + n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; + n31Z1 = v31X1 * nY1 - v31Y1 * nX1; + var mind2 = -1; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1 < 0) { + var v1X6; + var v1Y6; + var v1Z6; + var v2X6; + var v2Y6; + var v2Z6; + v1X6 = vec1.x; + v1Y6 = vec1.y; + v1Z6 = vec1.z; + v2X6 = vec3.x; + v2Y6 = vec3.y; + v2Z6 = vec3.z; + var v12X6; + var v12Y6; + var v12Z6; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; + t3 = -t3 / (v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6); + var b4; + if(t3 < 0) { + out.x = v1X6; + out.y = v1Y6; + out.z = v1Z6; + b4 = 1; + } else if(t3 > 1) { + out.x = v2X6; + out.y = v2Y6; + out.z = v2Z6; + b4 = 2; + } else { + var pX3; + var pY3; + var pZ3; + pX3 = v1X6 + v12X6 * t3; + pY3 = v1Y6 + v12Y6 * t3; + pZ3 = v1Z6 + v12Z6 * t3; + out.x = pX3; + out.y = pY3; + out.z = pZ3; + b4 = 3; + } + mini2 = b4; + mind2 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; + } + if(v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1 < 0) { + var v1X7; + var v1Y7; + var v1Z7; + var v2X7; + var v2Y7; + var v2Z7; + v1X7 = vec3.x; + v1Y7 = vec3.y; + v1Z7 = vec3.z; + v2X7 = vec4.x; + v2Y7 = vec4.y; + v2Z7 = vec4.z; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); + var b5; + if(t4 < 0) { + out.x = v1X7; + out.y = v1Y7; + out.z = v1Z7; + b5 = 1; + } else if(t4 > 1) { + out.x = v2X7; + out.y = v2Y7; + out.z = v2Z7; + b5 = 2; + } else { + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + out.x = pX4; + out.y = pY4; + out.z = pZ4; + b5 = 3; + } + var d2 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d2 < mind2) { + mini2 = b5 << 1; + mind2 = d2; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; + } + } + if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { + var v1X8; + var v1Y8; + var v1Z8; + var v2X8; + var v2Y8; + var v2Z8; + v1X8 = vec1.x; + v1Y8 = vec1.y; + v1Z8 = vec1.z; + v2X8 = vec4.x; + v2Y8 = vec4.y; + v2Z8 = vec4.z; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); + var b6; + if(t5 < 0) { + out.x = v1X8; + out.y = v1Y8; + out.z = v1Z8; + b6 = 1; + } else if(t5 > 1) { + out.x = v2X8; + out.y = v2Y8; + out.z = v2Z8; + b6 = 2; + } else { + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + out.x = pX5; + out.y = pY5; + out.z = pZ5; + b6 = 3; + } + var d3 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d3 < mind2) { + mini2 = b6 & 1 | (b6 & 2) << 1; + mind2 = d3; + minvX2 = out.x; + minvY2 = out.y; + minvZ2 = out.z; + } + } + var b7; + if(mind2 > 0) { + out.x = minvX2; + out.y = minvY2; + out.z = minvZ2; + b7 = mini2; + } else { + var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX1 *= l1; + nY1 *= l1; + nZ1 *= l1; + var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l21 = (v1X5 * nX1 + v1Y5 * nY1 + v1Z5 * nZ1) / l21; + minvX2 = nX1 * l21; + minvY2 = nY1 * l21; + minvZ2 = nZ1 * l21; + out.x = minvX2; + out.y = minvY2; + out.z = minvZ2; + b7 = 7; + } + var d4 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d4 < mind) { + mini = b7 & 1 | (b7 & 6) << 1; + mind = d4; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { + var v1X9; + var v1Y9; + var v1Z9; + var v2X9; + var v2Y9; + var v2Z9; + var v3X3; + var v3Y3; + var v3Z3; + var v12X9; + var v12Y9; + var v12Z9; + var v23X3; + var v23Y3; + var v23Z3; + var v31X2; + var v31Y2; + var v31Z2; + v1X9 = vec1.x; + v1Y9 = vec1.y; + v1Z9 = vec1.z; + v2X9 = vec2.x; + v2Y9 = vec2.y; + v2Z9 = vec2.z; + v3X3 = vec4.x; + v3Y3 = vec4.y; + v3Z3 = vec4.z; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + v23X3 = v3X3 - v2X9; + v23Y3 = v3Y3 - v2Y9; + v23Z3 = v3Z3 - v2Z9; + v31X2 = v1X9 - v3X3; + v31Y2 = v1Y9 - v3Y3; + v31Z2 = v1Z9 - v3Z3; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y9 * v23Z3 - v12Z9 * v23Y3; + nY2 = v12Z9 * v23X3 - v12X9 * v23Z3; + nZ2 = v12X9 * v23Y3 - v12Y9 * v23X3; + var n12X2; + var n12Y2; + var n12Z2; + var n23X2; + var n23Y2; + var n23Z2; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y9 * nZ2 - v12Z9 * nY2; + n12Y2 = v12Z9 * nX2 - v12X9 * nZ2; + n12Z2 = v12X9 * nY2 - v12Y9 * nX2; + n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; + n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; + n23Z2 = v23X3 * nY2 - v23Y3 * nX2; + n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; + n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; + n31Z2 = v31X2 * nY2 - v31Y2 * nX2; + var mind3 = -1; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2 < 0) { + var v1X10; + var v1Y10; + var v1Z10; + var v2X10; + var v2Y10; + var v2Z10; + v1X10 = vec1.x; + v1Y10 = vec1.y; + v1Z10 = vec1.z; + v2X10 = vec2.x; + v2Y10 = vec2.y; + v2Z10 = vec2.z; + var v12X10; + var v12Y10; + var v12Z10; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; + t6 = -t6 / (v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10); + var b8; + if(t6 < 0) { + out.x = v1X10; + out.y = v1Y10; + out.z = v1Z10; + b8 = 1; + } else if(t6 > 1) { + out.x = v2X10; + out.y = v2Y10; + out.z = v2Z10; + b8 = 2; + } else { + var pX6; + var pY6; + var pZ6; + pX6 = v1X10 + v12X10 * t6; + pY6 = v1Y10 + v12Y10 * t6; + pZ6 = v1Z10 + v12Z10 * t6; + out.x = pX6; + out.y = pY6; + out.z = pZ6; + b8 = 3; + } + mini3 = b8; + mind3 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; + } + if(v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2 < 0) { + var v1X11; + var v1Y11; + var v1Z11; + var v2X11; + var v2Y11; + var v2Z11; + v1X11 = vec2.x; + v1Y11 = vec2.y; + v1Z11 = vec2.z; + v2X11 = vec4.x; + v2Y11 = vec4.y; + v2Z11 = vec4.z; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); + var b9; + if(t7 < 0) { + out.x = v1X11; + out.y = v1Y11; + out.z = v1Z11; + b9 = 1; + } else if(t7 > 1) { + out.x = v2X11; + out.y = v2Y11; + out.z = v2Z11; + b9 = 2; + } else { + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + out.x = pX7; + out.y = pY7; + out.z = pZ7; + b9 = 3; + } + var d5 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d5 < mind3) { + mini3 = b9 << 1; + mind3 = d5; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; + } + } + if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { + var v1X12; + var v1Y12; + var v1Z12; + var v2X12; + var v2Y12; + var v2Z12; + v1X12 = vec1.x; + v1Y12 = vec1.y; + v1Z12 = vec1.z; + v2X12 = vec4.x; + v2Y12 = vec4.y; + v2Z12 = vec4.z; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); + var b10; + if(t8 < 0) { + out.x = v1X12; + out.y = v1Y12; + out.z = v1Z12; + b10 = 1; + } else if(t8 > 1) { + out.x = v2X12; + out.y = v2Y12; + out.z = v2Z12; + b10 = 2; + } else { + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + out.x = pX8; + out.y = pY8; + out.z = pZ8; + b10 = 3; + } + var d6 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d6 < mind3) { + mini3 = b10 & 1 | (b10 & 2) << 1; + mind3 = d6; + minvX3 = out.x; + minvY3 = out.y; + minvZ3 = out.z; + } + } + var b11; + if(mind3 > 0) { + out.x = minvX3; + out.y = minvY3; + out.z = minvZ3; + b11 = mini3; + } else { + var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX2 *= l3; + nY2 *= l3; + nZ2 *= l3; + var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l22 = (v1X9 * nX2 + v1Y9 * nY2 + v1Z9 * nZ2) / l22; + minvX3 = nX2 * l22; + minvY3 = nY2 * l22; + minvZ3 = nZ2 * l22; + out.x = minvX3; + out.y = minvY3; + out.z = minvZ3; + b11 = 7; + } + var d7 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d7 < mind) { + mini = b11 & 3 | (b11 & 4) << 1; + mind = d7; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { + var v1X13; + var v1Y13; + var v1Z13; + var v2X13; + var v2Y13; + var v2Z13; + var v3X4; + var v3Y4; + var v3Z4; + var v12X13; + var v12Y13; + var v12Z13; + var v23X4; + var v23Y4; + var v23Z4; + var v31X3; + var v31Y3; + var v31Z3; + v1X13 = vec2.x; + v1Y13 = vec2.y; + v1Z13 = vec2.z; + v2X13 = vec3.x; + v2Y13 = vec3.y; + v2Z13 = vec3.z; + v3X4 = vec4.x; + v3Y4 = vec4.y; + v3Z4 = vec4.z; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + v23X4 = v3X4 - v2X13; + v23Y4 = v3Y4 - v2Y13; + v23Z4 = v3Z4 - v2Z13; + v31X3 = v1X13 - v3X4; + v31Y3 = v1Y13 - v3Y4; + v31Z3 = v1Z13 - v3Z4; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y13 * v23Z4 - v12Z13 * v23Y4; + nY3 = v12Z13 * v23X4 - v12X13 * v23Z4; + nZ3 = v12X13 * v23Y4 - v12Y13 * v23X4; + var n12X3; + var n12Y3; + var n12Z3; + var n23X3; + var n23Y3; + var n23Z3; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y13 * nZ3 - v12Z13 * nY3; + n12Y3 = v12Z13 * nX3 - v12X13 * nZ3; + n12Z3 = v12X13 * nY3 - v12Y13 * nX3; + n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; + n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; + n23Z3 = v23X4 * nY3 - v23Y4 * nX3; + n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; + n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; + n31Z3 = v31X3 * nY3 - v31Y3 * nX3; + var mind4 = -1; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3 < 0) { + var v1X14; + var v1Y14; + var v1Z14; + var v2X14; + var v2Y14; + var v2Z14; + v1X14 = vec2.x; + v1Y14 = vec2.y; + v1Z14 = vec2.z; + v2X14 = vec3.x; + v2Y14 = vec3.y; + v2Z14 = vec3.z; + var v12X14; + var v12Y14; + var v12Z14; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; + t9 = -t9 / (v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14); + var b12; + if(t9 < 0) { + out.x = v1X14; + out.y = v1Y14; + out.z = v1Z14; + b12 = 1; + } else if(t9 > 1) { + out.x = v2X14; + out.y = v2Y14; + out.z = v2Z14; + b12 = 2; + } else { + var pX9; + var pY9; + var pZ9; + pX9 = v1X14 + v12X14 * t9; + pY9 = v1Y14 + v12Y14 * t9; + pZ9 = v1Z14 + v12Z14 * t9; + out.x = pX9; + out.y = pY9; + out.z = pZ9; + b12 = 3; + } + mini4 = b12; + mind4 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; + } + if(v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3 < 0) { + var v1X15; + var v1Y15; + var v1Z15; + var v2X15; + var v2Y15; + var v2Z15; + v1X15 = vec3.x; + v1Y15 = vec3.y; + v1Z15 = vec3.z; + v2X15 = vec4.x; + v2Y15 = vec4.y; + v2Z15 = vec4.z; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); + var b13; + if(t10 < 0) { + out.x = v1X15; + out.y = v1Y15; + out.z = v1Z15; + b13 = 1; + } else if(t10 > 1) { + out.x = v2X15; + out.y = v2Y15; + out.z = v2Z15; + b13 = 2; + } else { + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + out.x = pX10; + out.y = pY10; + out.z = pZ10; + b13 = 3; + } + var d8 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d8 < mind4) { + mini4 = b13 << 1; + mind4 = d8; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; + } + } + if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { + var v1X16; + var v1Y16; + var v1Z16; + var v2X16; + var v2Y16; + var v2Z16; + v1X16 = vec2.x; + v1Y16 = vec2.y; + v1Z16 = vec2.z; + v2X16 = vec4.x; + v2Y16 = vec4.y; + v2Z16 = vec4.z; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); + var b14; + if(t11 < 0) { + out.x = v1X16; + out.y = v1Y16; + out.z = v1Z16; + b14 = 1; + } else if(t11 > 1) { + out.x = v2X16; + out.y = v2Y16; + out.z = v2Z16; + b14 = 2; + } else { + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + out.x = pX11; + out.y = pY11; + out.z = pZ11; + b14 = 3; + } + var d9 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d9 < mind4) { + mini4 = b14 & 1 | (b14 & 2) << 1; + mind4 = d9; + minvX4 = out.x; + minvY4 = out.y; + minvZ4 = out.z; + } + } + var b15; + if(mind4 > 0) { + out.x = minvX4; + out.y = minvY4; + out.z = minvZ4; + b15 = mini4; + } else { + var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX3 *= l4; + nY3 *= l4; + nZ3 *= l4; + var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l23 = (v1X13 * nX3 + v1Y13 * nY3 + v1Z13 * nZ3) / l23; + minvX4 = nX3 * l23; + minvY4 = nY3 * l23; + minvZ4 = nZ3 * l23; + out.x = minvX4; + out.y = minvY4; + out.z = minvZ4; + b15 = 7; + } + var d10 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d10 < mind) { + mini = b15 << 1; + mind = d10; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(mind > 0) { + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return mini; + } + out.zero(); + return 15; +}; +var oimo_common_Mat3 = function(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + oimo_common_Mat3.numCreations++; +}; +oimo_common_Mat3.__name__ = true; +oimo_common_Mat3.prototype = { + init: function(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + return this; + } + ,identity: function() { + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; + return this; + } + ,add: function(m) { + return new oimo_common_Mat3(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22); + } + ,sub: function(m) { + return new oimo_common_Mat3(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22); + } + ,scale: function(s) { + return new oimo_common_Mat3(this.e00 * s,this.e01 * s,this.e02 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e20 * s,this.e21 * s,this.e22 * s); + } + ,mul: function(m) { + return new oimo_common_Mat3(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22); + } + ,addEq: function(m) { + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; + return this; + } + ,subEq: function(m) { + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; + return this; + } + ,scaleEq: function(s) { + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; + return this; + } + ,mulEq: function(m) { + var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; + var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; + var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; + var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; + var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; + var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; + var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; + var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + return this; + } + ,prependScale: function(sx,sy,sz) { + return new oimo_common_Mat3(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz); + } + ,appendScale: function(sx,sy,sz) { + return new oimo_common_Mat3(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e20 * sx,this.e21 * sy,this.e22 * sz); + } + ,prependRotation: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo_common_Mat3(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22); + } + ,appendRotation: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo_common_Mat3(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22); + } + ,prependScaleEq: function(sx,sy,sz) { + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; + return this; + } + ,appendScaleEq: function(sx,sy,sz) { + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; + return this; + } + ,prependRotationEq: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + return this; + } + ,appendRotationEq: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; + return this; + } + ,transpose: function() { + return new oimo_common_Mat3(this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22); + } + ,transposeEq: function() { + var e10 = this.e01; + var e20 = this.e02; + var e21 = this.e12; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; + return this; + } + ,determinant: function() { + return this.e00 * (this.e11 * this.e22 - this.e12 * this.e21) - this.e01 * (this.e10 * this.e22 - this.e12 * this.e20) + this.e02 * (this.e10 * this.e21 - this.e11 * this.e20); + } + ,trace: function() { + return this.e00 + this.e11 + this.e22; + } + ,inverse: function() { + var d00 = this.e11 * this.e22 - this.e12 * this.e21; + var d01 = this.e10 * this.e22 - this.e12 * this.e20; + var d02 = this.e10 * this.e21 - this.e11 * this.e20; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + if(invDet != 0) { + invDet = 1 / invDet; + } + return new oimo_common_Mat3(d00 * invDet,-(this.e01 * this.e22 - this.e02 * this.e21) * invDet,(this.e01 * this.e12 - this.e02 * this.e11) * invDet,-d01 * invDet,(this.e00 * this.e22 - this.e02 * this.e20) * invDet,-(this.e00 * this.e12 - this.e02 * this.e10) * invDet,d02 * invDet,-(this.e00 * this.e21 - this.e01 * this.e20) * invDet,(this.e00 * this.e11 - this.e01 * this.e10) * invDet); + } + ,inverseEq: function() { + var d00 = this.e11 * this.e22 - this.e12 * this.e21; + var d01 = this.e10 * this.e22 - this.e12 * this.e20; + var d02 = this.e10 * this.e21 - this.e11 * this.e20; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + if(invDet != 0) { + invDet = 1 / invDet; + } + var t02 = (this.e01 * this.e12 - this.e02 * this.e11) * invDet; + var t11 = (this.e00 * this.e22 - this.e02 * this.e20) * invDet; + var t12 = -(this.e00 * this.e12 - this.e02 * this.e10) * invDet; + var t21 = -(this.e00 * this.e21 - this.e01 * this.e20) * invDet; + var t22 = (this.e00 * this.e11 - this.e01 * this.e10) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * this.e22 - this.e02 * this.e21) * invDet; + this.e02 = t02; + this.e10 = -d01 * invDet; + this.e11 = t11; + this.e12 = t12; + this.e20 = d02 * invDet; + this.e21 = t21; + this.e22 = t22; + return this; + } + ,toArray: function(columnMajor) { + if(columnMajor == null) { + columnMajor = false; + } + if(columnMajor) { + return [this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22]; + } else { + return [this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22]; + } + } + ,copyFrom: function(m) { + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + return this; + } + ,clone: function() { + return new oimo_common_Mat3(this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22); + } + ,fromQuat: function(q) { + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this.e00 = 1 - yy - zz; + this.e01 = xy - wz; + this.e02 = xz + wy; + this.e10 = xy + wz; + this.e11 = 1 - xx - zz; + this.e12 = yz - wx; + this.e20 = xz - wy; + this.e21 = yz + wx; + this.e22 = 1 - xx - yy; + return this; + } + ,toQuat: function() { + var _this = new oimo_common_Quat(); + var e00 = this.e00; + var e11 = this.e11; + var e22 = this.e22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + _this.w = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e21 - this.e12) * s; + _this.y = (this.e02 - this.e20) * s; + _this.z = (this.e10 - this.e01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + _this.x = 0.5 * s; + s = 0.5 / s; + _this.y = (this.e01 + this.e10) * s; + _this.z = (this.e02 + this.e20) * s; + _this.w = (this.e21 - this.e12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + _this.z = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e02 + this.e20) * s; + _this.y = (this.e12 + this.e21) * s; + _this.w = (this.e10 - this.e01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + _this.y = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e01 + this.e10) * s; + _this.z = (this.e12 + this.e21) * s; + _this.w = (this.e02 - this.e20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + _this.z = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e02 + this.e20) * s; + _this.y = (this.e12 + this.e21) * s; + _this.w = (this.e10 - this.e01) * s; + } + return _this; + } + ,fromEulerXyz: function(eulerAngles) { + var sx = Math.sin(eulerAngles.x); + var sy = Math.sin(eulerAngles.y); + var sz = Math.sin(eulerAngles.z); + var cx = Math.cos(eulerAngles.x); + var cy = Math.cos(eulerAngles.y); + var cz = Math.cos(eulerAngles.z); + this.e00 = cy * cz; + this.e01 = -cy * sz; + this.e02 = sy; + this.e10 = cx * sz + cz * sx * sy; + this.e11 = cx * cz - sx * sy * sz; + this.e12 = -cy * sx; + this.e20 = sx * sz - cx * cz * sy; + this.e21 = cz * sx + cx * sy * sz; + this.e22 = cx * cy; + return this; + } + ,toEulerXyz: function() { + var sy = this.e02; + if(sy <= -1) { + var xSubZ = Math.atan2(this.e21,this.e11); + return new oimo_common_Vec3(xSubZ * 0.5,-1.570796326794895,-xSubZ * 0.5); + } + if(sy >= 1) { + var xAddZ = Math.atan2(this.e21,this.e11); + return new oimo_common_Vec3(xAddZ * 0.5,1.570796326794895,xAddZ * 0.5); + } + return new oimo_common_Vec3(Math.atan2(-this.e12,this.e22),Math.asin(sy),Math.atan2(-this.e01,this.e00)); + } + ,getRow: function(index) { + if(index == 0) { + return new oimo_common_Vec3(this.e00,this.e01,this.e02); + } else if(index == 1) { + return new oimo_common_Vec3(this.e10,this.e11,this.e12); + } else if(index == 2) { + return new oimo_common_Vec3(this.e20,this.e21,this.e22); + } else { + return null; + } + } + ,getCol: function(index) { + if(index == 0) { + return new oimo_common_Vec3(this.e00,this.e10,this.e20); + } else if(index == 1) { + return new oimo_common_Vec3(this.e01,this.e11,this.e21); + } else if(index == 2) { + return new oimo_common_Vec3(this.e02,this.e12,this.e22); + } else { + return null; + } + } + ,getRowTo: function(index,dst) { + if(index == 0) { + dst.init(this.e00,this.e01,this.e02); + } else if(index == 1) { + dst.init(this.e10,this.e11,this.e12); + } else if(index == 2) { + dst.init(this.e20,this.e21,this.e22); + } else { + dst.zero(); + } + } + ,getColTo: function(index,dst) { + if(index == 0) { + dst.init(this.e00,this.e10,this.e20); + } else if(index == 1) { + dst.init(this.e01,this.e11,this.e21); + } else if(index == 2) { + dst.init(this.e02,this.e12,this.e22); + } else { + dst.zero(); + } + } + ,fromRows: function(row0,row1,row2) { + this.e00 = row0.x; + this.e01 = row0.y; + this.e02 = row0.z; + this.e10 = row1.x; + this.e11 = row1.y; + this.e12 = row1.z; + this.e20 = row2.x; + this.e21 = row2.y; + this.e22 = row2.z; + return this; + } + ,fromCols: function(col0,col1,col2) { + this.e00 = col0.x; + this.e01 = col1.x; + this.e02 = col2.x; + this.e10 = col0.y; + this.e11 = col1.y; + this.e12 = col2.y; + this.e20 = col0.z; + this.e21 = col1.z; + this.e22 = col2.z; + return this; + } + ,toString: function() { + return "Mat3[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + "]"; + } + ,__class__: oimo_common_Mat3 +}; +var oimo_common_Mat4 = function(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + if(e33 == null) { + e33 = 1; + } + if(e32 == null) { + e32 = 0; + } + if(e31 == null) { + e31 = 0; + } + if(e30 == null) { + e30 = 0; + } + if(e23 == null) { + e23 = 0; + } + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e13 == null) { + e13 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e03 == null) { + e03 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + oimo_common_Mat4.numCreations++; +}; +oimo_common_Mat4.__name__ = true; +oimo_common_Mat4.prototype = { + init: function(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + return this; + } + ,identity: function() { + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + ,add: function(m) { + return new oimo_common_Mat4(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e03 + m.e03,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e13 + m.e13,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22,this.e23 + m.e23,this.e30 + m.e30,this.e31 + m.e31,this.e32 + m.e32,this.e33 + m.e33); + } + ,sub: function(m) { + return new oimo_common_Mat4(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e03 - m.e03,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e13 - m.e13,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22,this.e23 - m.e23,this.e30 - m.e30,this.e31 - m.e31,this.e32 - m.e32,this.e33 - m.e33); + } + ,scale: function(s) { + return new oimo_common_Mat4(this.e00 * s,this.e01 * s,this.e02 * s,this.e03 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e13 * s,this.e20 * s,this.e21 * s,this.e22 * s,this.e23 * s,this.e30 * s,this.e31 * s,this.e32 * s,this.e33 * s); + } + ,mul: function(m) { + return new oimo_common_Mat4(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32,this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32,this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32,this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33,this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30,this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31,this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32,this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33); + } + ,addEq: function(m) { + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e03 += m.e03; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e13 += m.e13; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; + this.e23 += m.e23; + this.e30 += m.e30; + this.e31 += m.e31; + this.e32 += m.e32; + this.e33 += m.e33; + return this; + } + ,subEq: function(m) { + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e03 -= m.e03; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e13 -= m.e13; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; + this.e23 -= m.e23; + this.e30 -= m.e30; + this.e31 -= m.e31; + this.e32 -= m.e32; + this.e33 -= m.e33; + return this; + } + ,scaleEq: function(s) { + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e03 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e13 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; + this.e23 *= s; + this.e30 *= s; + this.e31 *= s; + this.e32 *= s; + this.e33 *= s; + return this; + } + ,mulEq: function(m) { + var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; + var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; + var e03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; + var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; + var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; + var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; + var e13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; + var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; + var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; + var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; + var e23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; + var e30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; + var e31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; + var e32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; + var e33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + return this; + } + ,prependScale: function(sx,sy,sz) { + return new oimo_common_Mat4(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e03 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e13 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz,this.e23 * sz,this.e30,this.e31,this.e32,this.e33); + } + ,appendScale: function(sx,sy,sz) { + return new oimo_common_Mat4(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e03,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e13,this.e20 * sx,this.e21 * sy,this.e22 * sz,this.e23,this.e30 * sx,this.e31 * sy,this.e32 * sz,this.e33); + } + ,prependRotation: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo_common_Mat4(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r00 * this.e03 + r01 * this.e13 + r02 * this.e23,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r10 * this.e03 + r11 * this.e13 + r12 * this.e23,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22,r20 * this.e03 + r21 * this.e13 + r22 * this.e23,this.e30,this.e31,this.e32,this.e33); + } + ,appendRotation: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo_common_Mat4(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e03,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e13,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22,this.e23,this.e30 * r00 + this.e31 * r10 + this.e32 * r20,this.e30 * r01 + this.e31 * r11 + this.e32 * r21,this.e30 * r02 + this.e31 * r12 + this.e32 * r22,this.e33); + } + ,prependTranslation: function(tx,ty,tz) { + return new oimo_common_Mat4(this.e00 + tx * this.e30,this.e01 + tx * this.e31,this.e02 + tx * this.e32,this.e03 + tx * this.e33,this.e10 + ty * this.e30,this.e11 + ty * this.e31,this.e12 + ty * this.e32,this.e13 + ty * this.e33,this.e20 + tz * this.e30,this.e21 + tz * this.e31,this.e22 + tz * this.e32,this.e23 + tz * this.e33,this.e30,this.e31,this.e32,this.e33); + } + ,appendTranslation: function(tx,ty,tz) { + return new oimo_common_Mat4(this.e00,this.e01,this.e02,this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03,this.e10,this.e11,this.e12,this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13,this.e20,this.e21,this.e22,this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23,this.e30,this.e31,this.e32,this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33); + } + ,prependScaleEq: function(sx,sy,sz) { + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e03 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e13 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; + this.e23 *= sz; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; + return this; + } + ,appendScaleEq: function(sx,sy,sz) { + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e03 = this.e03; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e13 = this.e13; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; + this.e23 = this.e23; + this.e30 *= sx; + this.e31 *= sy; + this.e32 *= sz; + this.e33 = this.e33; + return this; + } + ,prependRotationEq: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var e13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; + var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + var e23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; + return this; + } + ,appendRotationEq: function(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + var e31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; + var e32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e03 = this.e03; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e13 = this.e13; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; + this.e23 = this.e23; + this.e30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; + return this; + } + ,prependTranslationEq: function(tx,ty,tz) { + this.e00 += tx * this.e30; + this.e01 += tx * this.e31; + this.e02 += tx * this.e32; + this.e03 += tx * this.e33; + this.e10 += ty * this.e30; + this.e11 += ty * this.e31; + this.e12 += ty * this.e32; + this.e13 += ty * this.e33; + this.e20 += tz * this.e30; + this.e21 += tz * this.e31; + this.e22 += tz * this.e32; + this.e23 += tz * this.e33; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; + return this; + } + ,appendTranslationEq: function(tx,ty,tz) { + var e03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; + var e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; + var e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; + var e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; + this.e00 = this.e00; + this.e01 = this.e01; + this.e02 = this.e02; + this.e03 = e03; + this.e10 = this.e10; + this.e11 = this.e11; + this.e12 = this.e12; + this.e13 = e13; + this.e20 = this.e20; + this.e21 = this.e21; + this.e22 = this.e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = e33; + return this; + } + ,transpose: function() { + return new oimo_common_Mat4(this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33); + } + ,transposeEq: function() { + var e10 = this.e01; + var e20 = this.e02; + var e21 = this.e12; + var e30 = this.e03; + var e31 = this.e13; + var e32 = this.e23; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e03 = this.e30; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e13 = this.e31; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; + this.e23 = this.e32; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; + return this; + } + ,determinant: function() { + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + return this.e00 * (this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12) - this.e01 * (this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02) + this.e02 * (this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01) - this.e03 * (this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01); + } + ,trace: function() { + return this.e00 + this.e11 + this.e22 + this.e33; + } + ,inverse: function() { + var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + if(invDet != 0) { + invDet = 1 / invDet; + } + return new oimo_common_Mat4(d00 * invDet,-(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet,(this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet,-(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet,-d01 * invDet,(this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet,-(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet,(this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet,d02 * invDet,-(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet,(this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet,-(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet,-d03 * invDet,(this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet,-(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet,(this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet); + } + ,inverseEq: function() { + var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + if(invDet != 0) { + invDet = 1 / invDet; + } + var t11 = (this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet; + var t21 = -(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet; + var t23 = -(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet; + var t31 = (this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet; + var t32 = -(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet; + var t33 = (this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet; + this.e02 = (this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet; + this.e03 = -(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet; + this.e10 = -d01 * invDet; + this.e11 = t11; + this.e12 = -(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet; + this.e13 = (this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet; + this.e20 = d02 * invDet; + this.e21 = t21; + this.e22 = (this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet; + this.e23 = t23; + this.e30 = -d03 * invDet; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + ,lookAt: function(eyeX,eyeY,eyeZ,atX,atY,atZ,upX,upY,upZ) { + var zx = eyeX - atX; + var zy = eyeY - atY; + var zz = eyeZ - atZ; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = upY * zz - upZ * zy; + var xy = upZ * zx - upX * zz; + var xz = upX * zy - upY * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + this.e00 = xx; + this.e01 = xy; + this.e02 = xz; + this.e03 = -(xx * eyeX + xy * eyeY + xz * eyeZ); + this.e10 = yx; + this.e11 = yy; + this.e12 = yz; + this.e13 = -(yx * eyeX + yy * eyeY + yz * eyeZ); + this.e20 = zx; + this.e21 = zy; + this.e22 = zz; + this.e23 = -(zx * eyeX + zy * eyeY + zz * eyeZ); + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + ,perspective: function(fovY,aspect,near,far) { + var h = 1 / Math.tan(fovY * 0.5); + var fnf = far / (near - far); + this.e00 = h / aspect; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = h; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = fnf; + this.e23 = near * fnf; + this.e30 = 0; + this.e31 = 0; + this.e32 = -1; + this.e33 = 0; + return this; + } + ,ortho: function(width,height,near,far) { + var nf = 1 / (near - far); + this.e00 = 2 / width; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = 2 / height; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = nf; + this.e23 = near * nf; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + ,toArray: function(columnMajor) { + if(columnMajor == null) { + columnMajor = false; + } + if(columnMajor) { + return [this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33]; + } else { + return [this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33]; + } + } + ,copyFrom: function(m) { + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e03 = m.e03; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e13 = m.e13; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + this.e23 = m.e23; + this.e30 = m.e30; + this.e31 = m.e31; + this.e32 = m.e32; + this.e33 = m.e33; + return this; + } + ,fromMat3: function(m) { + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e03 = 0; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e13 = 0; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + ,fromTransform: function(transform) { + var m = this; + m.e00 = transform._rotation00; + m.e01 = transform._rotation01; + m.e02 = transform._rotation02; + m.e10 = transform._rotation10; + m.e11 = transform._rotation11; + m.e12 = transform._rotation12; + m.e20 = transform._rotation20; + m.e21 = transform._rotation21; + m.e22 = transform._rotation22; + m.e03 = transform._positionX; + m.e13 = transform._positionY; + m.e23 = transform._positionZ; + m.e30 = 0; + m.e31 = 0; + m.e32 = 0; + m.e33 = 1; + return this; + } + ,clone: function() { + return new oimo_common_Mat4(this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33); + } + ,toString: function() { + return "Mat4[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e03 > 0 ? (this.e03 * 10000000 + 0.5 | 0) / 10000000 : (this.e03 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e13 > 0 ? (this.e13 * 10000000 + 0.5 | 0) / 10000000 : (this.e13 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e23 > 0 ? (this.e23 * 10000000 + 0.5 | 0) / 10000000 : (this.e23 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e30 > 0 ? (this.e30 * 10000000 + 0.5 | 0) / 10000000 : (this.e30 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e31 > 0 ? (this.e31 * 10000000 + 0.5 | 0) / 10000000 : (this.e31 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e32 > 0 ? (this.e32 * 10000000 + 0.5 | 0) / 10000000 : (this.e32 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e33 > 0 ? (this.e33 * 10000000 + 0.5 | 0) / 10000000 : (this.e33 * 10000000 - 0.5 | 0) / 10000000) + "]"; + } + ,__class__: oimo_common_Mat4 +}; +var oimo_common_MathUtil = function() { }; +oimo_common_MathUtil.__name__ = true; +oimo_common_MathUtil.abs = function(x) { + if(x > 0) { + return x; + } else { + return -x; + } +}; +oimo_common_MathUtil.sin = function(x) { + return Math.sin(x); +}; +oimo_common_MathUtil.cos = function(x) { + return Math.cos(x); +}; +oimo_common_MathUtil.tan = function(x) { + return Math.tan(x); +}; +oimo_common_MathUtil.asin = function(x) { + return Math.asin(x); +}; +oimo_common_MathUtil.acos = function(x) { + return Math.acos(x); +}; +oimo_common_MathUtil.atan = function(x) { + return Math.atan(x); +}; +oimo_common_MathUtil.safeAsin = function(x) { + if(x <= -1) { + return -1.570796326794895; + } + if(x >= 1) { + return 1.570796326794895; + } + return Math.asin(x); +}; +oimo_common_MathUtil.safeAcos = function(x) { + if(x <= -1) { + return 3.14159265358979; + } + if(x >= 1) { + return 0; + } + return Math.acos(x); +}; +oimo_common_MathUtil.atan2 = function(y,x) { + return Math.atan2(y,x); +}; +oimo_common_MathUtil.sqrt = function(x) { + return Math.sqrt(x); +}; +oimo_common_MathUtil.clamp = function(x,min,max) { + if(x < min) { + return min; + } else if(x > max) { + return max; + } else { + return x; + } +}; +oimo_common_MathUtil.rand = function() { + return Math.random(); +}; +oimo_common_MathUtil.randIn = function(min,max) { + return min + Math.random() * (max - min); +}; +oimo_common_MathUtil.randVec3In = function(min,max) { + return new oimo_common_Vec3(min + Math.random() * (max - min),min + Math.random() * (max - min),min + Math.random() * (max - min)); +}; +oimo_common_MathUtil.randVec3 = function() { + return new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); +}; +var oimo_common_Pool = function() { + this.stackVec3 = new Array(256); + this.sizeVec3 = 0; + this.stackMat3 = new Array(256); + this.sizeMat3 = 0; + this.stackMat4 = new Array(256); + this.sizeMat4 = 0; + this.stackQuat = new Array(256); + this.sizeQuat = 0; +}; +oimo_common_Pool.__name__ = true; +oimo_common_Pool.prototype = { + vec3: function() { + if(this.sizeVec3 == 0) { + return new oimo_common_Vec3(); + } else { + return this.stackVec3[--this.sizeVec3]; + } + } + ,mat3: function() { + if(this.sizeMat3 == 0) { + return new oimo_common_Mat3(); + } else { + return this.stackMat3[--this.sizeMat3]; + } + } + ,mat4: function() { + if(this.sizeMat4 == 0) { + return new oimo_common_Mat4(); + } else { + return this.stackMat4[--this.sizeMat4]; + } + } + ,quat: function() { + if(this.sizeQuat == 0) { + return new oimo_common_Quat(); + } else { + return this.stackQuat[--this.sizeQuat]; + } + } + ,dispose: function(vec3,mat3,mat4,quat) { + if(vec3 != null) { + vec3.zero(); + if(this.sizeVec3 == this.stackVec3.length) { + var newArray = new Array(this.sizeVec3 << 1); + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackVec3[i]; + this.stackVec3[i] = null; + } + this.stackVec3 = newArray; + } + this.stackVec3[this.sizeVec3++] = vec3; + } + if(mat3 != null) { + mat3.e00 = 1; + mat3.e01 = 0; + mat3.e02 = 0; + mat3.e10 = 0; + mat3.e11 = 1; + mat3.e12 = 0; + mat3.e20 = 0; + mat3.e21 = 0; + mat3.e22 = 1; + if(this.sizeMat3 == this.stackMat3.length) { + var newArray1 = new Array(this.sizeMat3 << 1); + var _g2 = 0; + var _g11 = this.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this.stackMat3[i1]; + this.stackMat3[i1] = null; + } + this.stackMat3 = newArray1; + } + this.stackMat3[this.sizeMat3++] = mat3; + } + if(mat4 != null) { + mat4.e00 = 1; + mat4.e01 = 0; + mat4.e02 = 0; + mat4.e03 = 0; + mat4.e10 = 0; + mat4.e11 = 1; + mat4.e12 = 0; + mat4.e13 = 0; + mat4.e20 = 0; + mat4.e21 = 0; + mat4.e22 = 1; + mat4.e23 = 0; + mat4.e30 = 0; + mat4.e31 = 0; + mat4.e32 = 0; + mat4.e33 = 1; + if(this.sizeMat4 == this.stackMat4.length) { + var newArray2 = new Array(this.sizeMat4 << 1); + var _g3 = 0; + var _g12 = this.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = this.stackMat4[i2]; + this.stackMat4[i2] = null; + } + this.stackMat4 = newArray2; + } + this.stackMat4[this.sizeMat4++] = mat4; + } + if(quat != null) { + quat.x = 0; + quat.y = 0; + quat.z = 0; + quat.w = 1; + if(this.sizeQuat == this.stackQuat.length) { + var newArray3 = new Array(this.sizeQuat << 1); + var _g4 = 0; + var _g13 = this.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = this.stackQuat[i3]; + this.stackQuat[i3] = null; + } + this.stackQuat = newArray3; + } + this.stackQuat[this.sizeQuat++] = quat; + } + } + ,disposeVec3: function(v) { + v.zero(); + if(this.sizeVec3 == this.stackVec3.length) { + var newArray = new Array(this.sizeVec3 << 1); + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackVec3[i]; + this.stackVec3[i] = null; + } + this.stackVec3 = newArray; + } + this.stackVec3[this.sizeVec3++] = v; + } + ,disposeMat3: function(m) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(this.sizeMat3 == this.stackMat3.length) { + var newArray = new Array(this.sizeMat3 << 1); + var _g = 0; + var _g1 = this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat3[i]; + this.stackMat3[i] = null; + } + this.stackMat3 = newArray; + } + this.stackMat3[this.sizeMat3++] = m; + } + ,disposeMat4: function(m) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e03 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e13 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + m.e23 = 0; + m.e30 = 0; + m.e31 = 0; + m.e32 = 0; + m.e33 = 1; + if(this.sizeMat4 == this.stackMat4.length) { + var newArray = new Array(this.sizeMat4 << 1); + var _g = 0; + var _g1 = this.sizeMat4; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat4[i]; + this.stackMat4[i] = null; + } + this.stackMat4 = newArray; + } + this.stackMat4[this.sizeMat4++] = m; + } + ,disposeQuat: function(q) { + q.x = 0; + q.y = 0; + q.z = 0; + q.w = 1; + if(this.sizeQuat == this.stackQuat.length) { + var newArray = new Array(this.sizeQuat << 1); + var _g = 0; + var _g1 = this.sizeQuat; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackQuat[i]; + this.stackQuat[i] = null; + } + this.stackQuat = newArray; + } + this.stackQuat[this.sizeQuat++] = q; + } + ,__class__: oimo_common_Pool +}; +var oimo_common_Quat = function(x,y,z,w) { + if(w == null) { + w = 1; + } + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + this.w = w; + oimo_common_Quat.numCreations++; +}; +oimo_common_Quat.__name__ = true; +oimo_common_Quat.prototype = { + identity: function() { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + return this; + } + ,init: function(x,y,z,w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + return this; + } + ,add: function(q) { + return new oimo_common_Quat(this.x + q.x,this.y + q.y,this.z + q.z,this.w + q.w); + } + ,sub: function(q) { + return new oimo_common_Quat(this.x - q.x,this.y - q.y,this.z - q.z,this.w - q.w); + } + ,scale: function(s) { + return new oimo_common_Quat(this.x * s,this.y * s,this.z * s,this.w * s); + } + ,addEq: function(q) { + this.x += q.x; + this.y += q.y; + this.z += q.z; + this.w += q.w; + return this; + } + ,subEq: function(q) { + this.x -= q.x; + this.y -= q.y; + this.z -= q.z; + this.w -= q.w; + return this; + } + ,scaleEq: function(s) { + this.x *= s; + this.y *= s; + this.z *= s; + this.w *= s; + return this; + } + ,length: function() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + } + ,lengthSq: function() { + return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; + } + ,dot: function(q) { + return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + } + ,normalized: function() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + return new oimo_common_Quat(this.x * invLen,this.y * invLen,this.z * invLen,this.w * invLen); + } + ,normalize: function() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; + this.w *= invLen; + return this; + } + ,setArc: function(v1,v2) { + var x1 = v1.x; + var y1 = v1.y; + var z1 = v1.z; + var x2 = v2.x; + var y2 = v2.y; + var z2 = v2.z; + var d = x1 * x2 + y1 * y2 + z1 * z2; + this.w = Math.sqrt((1 + d) * 0.5); + if(this.w == 0) { + x2 = x1 * x1; + y2 = y1 * y1; + z2 = z1 * z1; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this.x = 0; + this.y = z1 * d; + this.z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this.z = 0; + this.x = y1 * d; + this.y = -x1 * d; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this.y = 0; + this.z = x1 * d; + this.x = -z1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this.z = 0; + this.x = y1 * d; + this.y = -x1 * d; + } + return this; + } + d = 0.5 / this.w; + this.x = (y1 * z2 - z1 * y2) * d; + this.y = (z1 * x2 - x1 * z2) * d; + this.z = (x1 * y2 - y1 * x2) * d; + return this; + } + ,slerp: function(q,t) { + var qx; + var qy; + var qz; + var qw; + var d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + if(d < 0) { + d = -d; + qx = -q.x; + qy = -q.y; + qz = -q.z; + qw = -q.w; + } else { + qx = q.x; + qy = q.y; + qz = q.z; + qw = q.w; + } + if(d > 0.999999) { + var _this = new oimo_common_Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + _this.w *= invLen; + return _this; + } + var theta = t * Math.acos(d); + qx -= this.x * d; + qy -= this.y * d; + qz -= this.z * d; + qw -= this.w * d; + var invLen1 = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); + qx *= invLen1; + qy *= invLen1; + qz *= invLen1; + qw *= invLen1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + return new oimo_common_Quat(this.x * cos + qx * sin,this.y * cos + qy * sin,this.z * cos + qz * sin,this.w * cos + qw * sin); + } + ,copyFrom: function(q) { + this.x = q.x; + this.y = q.y; + this.z = q.z; + this.w = q.w; + return this; + } + ,clone: function() { + return new oimo_common_Quat(this.x,this.y,this.z,this.w); + } + ,fromMat3: function(m) { + var e00 = m.e00; + var e11 = m.e11; + var e22 = m.e22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + this.w = 0.5 * s; + s = 0.5 / s; + this.x = (m.e21 - m.e12) * s; + this.y = (m.e02 - m.e20) * s; + this.z = (m.e10 - m.e01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + this.x = 0.5 * s; + s = 0.5 / s; + this.y = (m.e01 + m.e10) * s; + this.z = (m.e02 + m.e20) * s; + this.w = (m.e21 - m.e12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + this.z = 0.5 * s; + s = 0.5 / s; + this.x = (m.e02 + m.e20) * s; + this.y = (m.e12 + m.e21) * s; + this.w = (m.e10 - m.e01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + this.y = 0.5 * s; + s = 0.5 / s; + this.x = (m.e01 + m.e10) * s; + this.z = (m.e12 + m.e21) * s; + this.w = (m.e02 - m.e20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + this.z = 0.5 * s; + s = 0.5 / s; + this.x = (m.e02 + m.e20) * s; + this.y = (m.e12 + m.e21) * s; + this.w = (m.e10 - m.e01) * s; + } + return this; + } + ,toMat3: function() { + var _this = new oimo_common_Mat3(); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this.e00 = 1 - yy - zz; + _this.e01 = xy - wz; + _this.e02 = xz + wy; + _this.e10 = xy + wz; + _this.e11 = 1 - xx - zz; + _this.e12 = yz - wx; + _this.e20 = xz - wy; + _this.e21 = yz + wx; + _this.e22 = 1 - xx - yy; + return _this; + } + ,toString: function() { + return "Quat[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + " i,\n" + " " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + " j,\n" + " " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + " k,\n" + " " + (this.w > 0 ? (this.w * 10000000 + 0.5 | 0) / 10000000 : (this.w * 10000000 - 0.5 | 0) / 10000000) + "]"; + } + ,__class__: oimo_common_Quat +}; +var oimo_dynamics_Contact = function() { + this._next = null; + this._prev = null; + this._link1 = new oimo_dynamics_ContactLink(); + this._link2 = new oimo_dynamics_ContactLink(); + this._s1 = null; + this._s2 = null; + this._b1 = null; + this._b2 = null; + this._detector = null; + this._cachedDetectorData = new oimo_collision_narrowphase_detector_CachedDetectorData(); + this._detectorResult = new oimo_collision_narrowphase_DetectorResult(); + this._latest = false; + this._shouldBeSkipped = false; + this._manifold = new oimo_dynamics_constraint_contact_Manifold(); + this._updater = new oimo_dynamics_constraint_contact_ManifoldUpdater(this._manifold); + this._contactConstraint = new oimo_dynamics_constraint_contact_ContactConstraint(this._manifold); + this._touching = false; +}; +oimo_dynamics_Contact.__name__ = true; +oimo_dynamics_Contact.prototype = { + _updateManifold: function() { + if(this._detector == null) { + return; + } + var ptouching = this._touching; + var result = this._detectorResult; + this._detector.detect(result,this._s1._geom,this._s2._geom,this._s1._transform,this._s2._transform,this._cachedDetectorData); + this._touching = result.numPoints > 0; + if(this._touching) { + this._manifold._buildBasis(result.normal); + if(result.getMaxDepth() > oimo_common_Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold) { + this._contactConstraint._positionCorrectionAlgorithm = oimo_common_Setting.alternativeContactPositionCorrectionAlgorithm; + } else { + this._contactConstraint._positionCorrectionAlgorithm = oimo_common_Setting.defaultContactPositionCorrectionAlgorithm; + } + if(result.incremental) { + this._updater.incrementalUpdate(result,this._b1._transform,this._b2._transform); + } else { + this._updater.totalUpdate(result,this._b1._transform,this._b2._transform); + } + } else { + this._manifold._clear(); + } + if(this._touching && !ptouching) { + var cc2 = this._s2._contactCallback; + if(this._s1._contactCallback == cc2) { + cc2 = null; + } + } + if(!this._touching && ptouching) { + var cc21 = this._s2._contactCallback; + if(this._s1._contactCallback == cc21) { + cc21 = null; + } + } + if(this._touching) { + var cc22 = this._s2._contactCallback; + if(this._s1._contactCallback == cc22) { + cc22 = null; + } + } + } + ,_postSolve: function() { + var cc2 = this._s2._contactCallback; + if(this._s1._contactCallback == cc2) { + cc2 = null; + } + } + ,getShape1: function() { + return this._s1; + } + ,getShape2: function() { + return this._s2; + } + ,isTouching: function() { + return this._touching; + } + ,getManifold: function() { + return this._manifold; + } + ,getContactConstraint: function() { + return this._contactConstraint; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_Contact +}; +var oimo_dynamics_ContactLink = function() { + this._prev = null; + this._next = null; + this._contact = null; + this._other = null; +}; +oimo_dynamics_ContactLink.__name__ = true; +oimo_dynamics_ContactLink.prototype = { + getContact: function() { + return this._contact; + } + ,getOther: function() { + return this._other; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_ContactLink +}; +var oimo_dynamics_ContactManager = function(broadPhase) { + this._broadPhase = broadPhase; + this._collisionMatrix = new oimo_collision_narrowphase_CollisionMatrix(); + this._numContacts = 0; +}; +oimo_dynamics_ContactManager.__name__ = true; +oimo_dynamics_ContactManager.prototype = { + createContacts: function() { + var pp = this._broadPhase._proxyPairList; + while(pp != null) { + var n = pp._next; + while(true) { + var s1; + var s2; + if(pp._p1._id < pp._p2._id) { + s1 = pp._p1.userData; + s2 = pp._p2.userData; + } else { + s1 = pp._p2.userData; + s2 = pp._p1.userData; + } + if(!this.shouldCollide(s1,s2)) { + break; + } + var b1 = s1._rigidBody; + var b2 = s2._rigidBody; + var l; + if(b1._numContactLinks < b2._numContactLinks) { + l = b1._contactLinkList; + } else { + l = b2._contactLinkList; + } + var id1 = s1._id; + var id2 = s2._id; + var found = false; + while(l != null) { + var c = l._contact; + if(c._s1._id == id1 && c._s2._id == id2) { + c._latest = true; + found = true; + break; + } + l = l._next; + } + if(!found) { + var first = this._contactPool; + if(first != null) { + this._contactPool = first._next; + first._next = null; + } else { + first = new oimo_dynamics_Contact(); + } + var c1 = first; + if(this._contactList == null) { + this._contactList = c1; + this._contactListLast = c1; + } else { + this._contactListLast._next = c1; + c1._prev = this._contactListLast; + this._contactListLast = c1; + } + c1._latest = true; + var detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; + c1._s1 = s1; + c1._s2 = s2; + c1._b1 = s1._rigidBody; + c1._b2 = s2._rigidBody; + c1._touching = false; + if(c1._b1._contactLinkList == null) { + c1._b1._contactLinkList = c1._link1; + c1._b1._contactLinkListLast = c1._link1; + } else { + c1._b1._contactLinkListLast._next = c1._link1; + c1._link1._prev = c1._b1._contactLinkListLast; + c1._b1._contactLinkListLast = c1._link1; + } + if(c1._b2._contactLinkList == null) { + c1._b2._contactLinkList = c1._link2; + c1._b2._contactLinkListLast = c1._link2; + } else { + c1._b2._contactLinkListLast._next = c1._link2; + c1._link2._prev = c1._b2._contactLinkListLast; + c1._b2._contactLinkListLast = c1._link2; + } + c1._b1._numContactLinks++; + c1._b2._numContactLinks++; + c1._link1._other = c1._b2; + c1._link2._other = c1._b1; + c1._link1._contact = c1; + c1._link2._contact = c1; + c1._detector = detector; + var _this = c1._contactConstraint; + _this._s1 = s1; + _this._s2 = s2; + _this._b1 = _this._s1._rigidBody; + _this._b2 = _this._s2._rigidBody; + _this._tf1 = _this._b1._transform; + _this._tf2 = _this._b2._transform; + this._numContacts++; + } + break; + } + pp = n; + } + } + ,destroyOutdatedContacts: function() { + var incremental = this._broadPhase._incremental; + var c = this._contactList; + while(c != null) { + var n = c._next; + while(true) { + if(c._latest) { + c._latest = false; + c._shouldBeSkipped = false; + break; + } + if(!incremental) { + var prev = c._prev; + var next = c._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(c == this._contactList) { + this._contactList = this._contactList._next; + } + if(c == this._contactListLast) { + this._contactListLast = this._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc2 = c._s2._contactCallback; + if(c._s1._contactCallback == cc2) { + cc2 = null; + } + } + var prev1 = c._link1._prev; + var next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev2 = c._link2._prev; + var next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this = c._contactConstraint; + _this._s1 = null; + _this._s2 = null; + _this._b1 = null; + _this._b2 = null; + _this._tf1 = null; + _this._tf2 = null; + c._next = this._contactPool; + this._contactPool = c; + this._numContacts--; + break; + } + var s1 = c._s1; + var s2 = c._s2; + var r1 = s1._rigidBody; + var r2 = s2._rigidBody; + if(!(!r1._sleeping && r1._type != 1) && !(!r2._sleeping && r2._type != 1)) { + c._shouldBeSkipped = true; + break; + } + var aabb1 = s1._aabb; + var aabb2 = s2._aabb; + var proxy1 = s1._proxy; + var proxy2 = s2._proxy; + if(!(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ && proxy1._aabbMaxZ > proxy2._aabbMinZ) || !this.shouldCollide(s1,s2)) { + var prev3 = c._prev; + var next3 = c._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c == this._contactList) { + this._contactList = this._contactList._next; + } + if(c == this._contactListLast) { + this._contactListLast = this._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc21 = c._s2._contactCallback; + if(c._s1._contactCallback == cc21) { + cc21 = null; + } + } + var prev4 = c._link1._prev; + var next4 = c._link1._next; + if(prev4 != null) { + prev4._next = next4; + } + if(next4 != null) { + next4._prev = prev4; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev5 = c._link2._prev; + var next5 = c._link2._next; + if(prev5 != null) { + prev5._next = next5; + } + if(next5 != null) { + next5._prev = prev5; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this1 = c._contactConstraint; + _this1._s1 = null; + _this1._s2 = null; + _this1._b1 = null; + _this1._b2 = null; + _this1._tf1 = null; + _this1._tf2 = null; + c._next = this._contactPool; + this._contactPool = c; + this._numContacts--; + break; + } + c._shouldBeSkipped = !(aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ); + break; + } + c = n; + } + } + ,shouldCollide: function(s1,s2) { + var r1 = s1._rigidBody; + var r2 = s2._rigidBody; + if(r1 == r2) { + return false; + } + if(r1._type != 0 && r2._type != 0) { + return false; + } + if((s1._collisionGroup & s2._collisionMask) == 0 || (s2._collisionGroup & s1._collisionMask) == 0) { + return false; + } + var jl; + var other; + if(r1._numJointLinks < r2._numJointLinks) { + jl = r1._jointLinkList; + other = r2; + } else { + jl = r2._jointLinkList; + other = r1; + } + while(jl != null) { + if(jl._other == other && !jl._joint._allowCollision) { + return false; + } + jl = jl._next; + } + return true; + } + ,_updateContacts: function() { + this._broadPhase.collectPairs(); + this.createContacts(); + this.destroyOutdatedContacts(); + } + ,_postSolve: function() { + var c = this._contactList; + while(c != null) { + var n = c._next; + if(c._touching) { + c._postSolve(); + } + c = n; + } + } + ,getNumContacts: function() { + return this._numContacts; + } + ,getContactList: function() { + return this._contactList; + } + ,__class__: oimo_dynamics_ContactManager +}; +var oimo_dynamics_Island = function() { + this.rigidBodies = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); + this.solvers = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversSi = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversNgs = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.numRigidBodies = 0; + this.numSolvers = 0; + this.numSolversSi = 0; + this.numSolversNgs = 0; +}; +oimo_dynamics_Island.__name__ = true; +oimo_dynamics_Island.prototype = { + _clear: function() { + while(this.numRigidBodies > 0) this.rigidBodies[--this.numRigidBodies] = null; + while(this.numSolvers > 0) this.solvers[--this.numSolvers] = null; + while(this.numSolversSi > 0) this.solversSi[--this.numSolversSi] = null; + while(this.numSolversNgs > 0) this.solversNgs[--this.numSolversNgs] = null; + } + ,_addRigidBody: function(rigidBody) { + if(this.numRigidBodies == this.rigidBodies.length) { + var newArray = new Array(this.numRigidBodies << 1); + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.rigidBodies[i]; + this.rigidBodies[i] = null; + } + this.rigidBodies = newArray; + } + rigidBody._addedToIsland = true; + this.rigidBodies[this.numRigidBodies++] = rigidBody; + } + ,_addConstraintSolver: function(solver,positionCorrection) { + if(this.numSolvers == this.solvers.length) { + var newArray = new Array(this.numSolvers << 1); + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.solvers[i]; + this.solvers[i] = null; + } + this.solvers = newArray; + } + solver._addedToIsland = true; + this.solvers[this.numSolvers++] = solver; + if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.SPLIT_IMPULSE) { + if(this.numSolversSi == this.solversSi.length) { + var newArray1 = new Array(this.numSolversSi << 1); + var _g2 = 0; + var _g11 = this.numSolversSi; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this.solversSi[i1]; + this.solversSi[i1] = null; + } + this.solversSi = newArray1; + } + this.solversSi[this.numSolversSi++] = solver; + } + if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.NGS) { + if(this.numSolversNgs == this.solversNgs.length) { + var newArray2 = new Array(this.numSolversNgs << 1); + var _g3 = 0; + var _g12 = this.numSolversNgs; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = this.solversNgs[i2]; + this.solversNgs[i2] = null; + } + this.solversNgs = newArray2; + } + this.solversNgs[this.numSolversNgs++] = solver; + } + } + ,_stepSingleRigidBody: function(timeStep,rb) { + var dt = timeStep.dt; + var dst = rb._ptransform; + var src = rb._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; + if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo_common_Setting.sleepingVelocityThreshold * oimo_common_Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo_common_Setting.sleepingAngularVelocityThreshold * oimo_common_Setting.sleepingAngularVelocityThreshold) { + rb._sleepTime += dt; + if(rb._sleepTime > oimo_common_Setting.sleepingTimeThreshold) { + rb._sleeping = true; + rb._sleepTime = 0; + } + } else { + rb._sleepTime = 0; + } + if(!rb._sleeping) { + if(rb._type == 0) { + var x = dt * rb._linearDamping; + var x2 = x * x; + var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + var x1 = dt * rb._angularDamping; + var x21 = x1 * x1; + var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + var linAccX; + var linAccY; + var linAccZ; + var angAccX; + var angAccY; + var angAccZ; + linAccX = this.gravityX * rb._gravityScale; + linAccY = this.gravityY * rb._gravityScale; + linAccZ = this.gravityZ * rb._gravityScale; + linAccX += rb._forceX * rb._invMass; + linAccY += rb._forceY * rb._invMass; + linAccZ += rb._forceZ * rb._invMass; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; + __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; + __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; + angAccX = __tmp__X; + angAccY = __tmp__Y; + angAccZ = __tmp__Z; + rb._velX += linAccX * dt; + rb._velY += linAccY * dt; + rb._velZ += linAccZ * dt; + rb._velX *= linScale; + rb._velY *= linScale; + rb._velZ *= linScale; + rb._angVelX += angAccX * dt; + rb._angVelY += angAccY * dt; + rb._angVelZ += angAccZ * dt; + rb._angVelX *= angScale; + rb._angVelY *= angScale; + rb._angVelZ *= angScale; + } + rb._integrate(dt); + var s = rb._shapeList; + while(s != null) { + var n = s._next; + var tf1 = rb._ptransform; + var tf2 = rb._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X2; + dst2._positionY = __tmp__Y2; + dst2._positionZ = __tmp__Z2; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + ,_step: function(timeStep,numVelocityIterations,numPositionIterations) { + var dt = timeStep.dt; + var sleepIsland = true; + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var rb = this.rigidBodies[_g++]; + var dst = rb._ptransform; + var src = rb._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; + rb._sleeping = false; + if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo_common_Setting.sleepingVelocityThreshold * oimo_common_Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo_common_Setting.sleepingAngularVelocityThreshold * oimo_common_Setting.sleepingAngularVelocityThreshold) { + rb._sleepTime += dt; + } else { + rb._sleepTime = 0; + } + if(rb._sleepTime < oimo_common_Setting.sleepingTimeThreshold) { + sleepIsland = false; + } + if(rb._type == 0) { + var x = dt * rb._linearDamping; + var x2 = x * x; + var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + var x1 = dt * rb._angularDamping; + var x21 = x1 * x1; + var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + var linAccX; + var linAccY; + var linAccZ; + var angAccX; + var angAccY; + var angAccZ; + linAccX = this.gravityX * rb._gravityScale; + linAccY = this.gravityY * rb._gravityScale; + linAccZ = this.gravityZ * rb._gravityScale; + linAccX += rb._forceX * rb._invMass; + linAccY += rb._forceY * rb._invMass; + linAccZ += rb._forceZ * rb._invMass; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; + __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; + __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; + angAccX = __tmp__X; + angAccY = __tmp__Y; + angAccZ = __tmp__Z; + rb._velX += linAccX * dt; + rb._velY += linAccY * dt; + rb._velZ += linAccZ * dt; + rb._velX *= linScale; + rb._velY *= linScale; + rb._velZ *= linScale; + rb._angVelX += angAccX * dt; + rb._angVelY += angAccY * dt; + rb._angVelZ += angAccZ * dt; + rb._angVelX *= angScale; + rb._angVelY *= angScale; + rb._angVelZ *= angScale; + } + } + if(sleepIsland) { + var _g2 = 0; + var _g3 = this.numRigidBodies; + while(_g2 < _g3) { + var rb1 = this.rigidBodies[_g2++]; + rb1._sleeping = true; + rb1._sleepTime = 0; + } + return; + } + var _g21 = 0; + var _g31 = this.numSolvers; + while(_g21 < _g31) this.solvers[_g21++].preSolveVelocity(timeStep); + var _g4 = 0; + var _g5 = this.numSolvers; + while(_g4 < _g5) this.solvers[_g4++].warmStart(timeStep); + var _g6 = 0; + while(_g6 < numVelocityIterations) { + ++_g6; + var _g61 = 0; + var _g7 = this.numSolvers; + while(_g61 < _g7) this.solvers[_g61++].solveVelocity(); + } + var _g8 = 0; + var _g9 = this.numSolvers; + while(_g8 < _g9) this.solvers[_g8++].postSolveVelocity(timeStep); + var _g10 = 0; + var _g11 = this.numRigidBodies; + while(_g10 < _g11) this.rigidBodies[_g10++]._integrate(dt); + var _g12 = 0; + var _g13 = this.numSolversSi; + while(_g12 < _g13) this.solversSi[_g12++].preSolvePosition(timeStep); + var _g14 = 0; + while(_g14 < numPositionIterations) { + ++_g14; + var _g141 = 0; + var _g15 = this.numSolversSi; + while(_g141 < _g15) this.solversSi[_g141++].solvePositionSplitImpulse(); + } + var _g16 = 0; + var _g17 = this.numRigidBodies; + while(_g16 < _g17) this.rigidBodies[_g16++]._integratePseudoVelocity(); + var _g18 = 0; + var _g19 = this.numSolversNgs; + while(_g18 < _g19) this.solversNgs[_g18++].preSolvePosition(timeStep); + var _g20 = 0; + while(_g20 < numPositionIterations) { + ++_g20; + var _g201 = 0; + var _g211 = this.numSolversNgs; + while(_g201 < _g211) this.solversNgs[_g201++].solvePositionNgs(timeStep); + } + var _g22 = 0; + var _g23 = this.numSolvers; + while(_g22 < _g23) this.solvers[_g22++].postSolve(); + var _g24 = 0; + var _g25 = this.numRigidBodies; + while(_g24 < _g25) { + var rb2 = this.rigidBodies[_g24++]; + var s = rb2._shapeList; + while(s != null) { + var n = s._next; + var tf1 = rb2._ptransform; + var tf2 = rb2._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X2; + dst2._positionY = __tmp__Y2; + dst2._positionZ = __tmp__Z2; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + ,__class__: oimo_dynamics_Island +}; +var oimo_dynamics_TimeStep = function() { + this.dt = 0; + this.invDt = 0; + this.dtRatio = 1; +}; +oimo_dynamics_TimeStep.__name__ = true; +oimo_dynamics_TimeStep.prototype = { + __class__: oimo_dynamics_TimeStep +}; +var oimo_dynamics_World = function(broadPhaseType,gravity) { + if(broadPhaseType == null) { + broadPhaseType = 2; + } + switch(broadPhaseType) { + case 1: + this._broadPhase = new oimo_collision_broadphase_bruteforce_BruteForceBroadPhase(); + break; + case 2: + this._broadPhase = new oimo_collision_broadphase_bvh_BvhBroadPhase(); + break; + } + this._contactManager = new oimo_dynamics_ContactManager(this._broadPhase); + if(gravity == null) { + gravity = new oimo_common_Vec3(0,-9.80665,0); + } + this._gravity = new oimo_common_Vec3(gravity.x,gravity.y,gravity.z); + this._rigidBodyList = null; + this._rigidBodyListLast = null; + this._jointList = null; + this._jointListLast = null; + this._numRigidBodies = 0; + this._numShapes = 0; + this._numJoints = 0; + this._numIslands = 0; + this._numVelocityIterations = 10; + this._numPositionIterations = 5; + this._rayCastWrapper = new oimo_dynamics__$World_RayCastWrapper(); + this._convexCastWrapper = new oimo_dynamics__$World_ConvexCastWrapper(); + this._aabbTestWrapper = new oimo_dynamics__$World_AabbTestWrapper(); + this._island = new oimo_dynamics_Island(); + this._solversInIslands = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this._rigidBodyStack = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); + this._timeStep = new oimo_dynamics_TimeStep(); + this._pool = new oimo_common_Pool(); + this._shapeIdCount = 0; +}; +oimo_dynamics_World.__name__ = true; +oimo_dynamics_World.prototype = { + _updateContacts: function() { + var st = Date.now() / 1000; + this._contactManager._updateContacts(); + oimo_dynamics_common_Performance.broadPhaseCollisionTime = (Date.now() / 1000 - st) * 1000; + var st1 = Date.now() / 1000; + var c = this._contactManager._contactList; + while(c != null) { + var n = c._next; + if(!c._shouldBeSkipped) { + c._updateManifold(); + } + c = n; + } + oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (Date.now() / 1000 - st1) * 1000; + } + ,_solveIslands: function() { + var st = Date.now() / 1000; + if(oimo_common_Setting.disableSleeping) { + var b = this._rigidBodyList; + while(b != null) { + b._sleeping = false; + b._sleepTime = 0; + b = b._next; + } + } + if(this._rigidBodyStack.length < this._numRigidBodies) { + var newStackSize = this._rigidBodyStack.length << 1; + while(newStackSize < this._numRigidBodies) newStackSize <<= 1; + this._rigidBodyStack = new Array(newStackSize); + } + this._numIslands = 0; + var _this = this._island; + var gravity = this._gravity; + _this.gravityX = gravity.x; + _this.gravityY = gravity.y; + _this.gravityZ = gravity.z; + var b1 = this._rigidBodyList; + this._numSolversInIslands = 0; + while(b1 != null) { + var n = b1._next; + while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { + if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { + this._island._stepSingleRigidBody(this._timeStep,b1); + this._numIslands++; + break; + } + this.buildIsland(b1); + this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); + this._island._clear(); + this._numIslands++; + break; + } + b1 = n; + } + this._contactManager._postSolve(); + b1 = this._rigidBodyList; + while(b1 != null) { + b1._addedToIsland = false; + b1 = b1._next; + } + b1 = this._rigidBodyList; + while(b1 != null) { + b1._forceX = 0; + b1._forceY = 0; + b1._forceZ = 0; + b1._torqueX = 0; + b1._torqueY = 0; + b1._torqueZ = 0; + b1 = b1._next; + } + while(this._numSolversInIslands > 0) { + this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; + this._solversInIslands[this._numSolversInIslands] = null; + } + oimo_dynamics_common_Performance.dynamicsTime = (Date.now() / 1000 - st) * 1000; + } + ,buildIsland: function(base) { + var stackCount = 1; + this._island._addRigidBody(base); + this._rigidBodyStack[0] = base; + while(stackCount > 0) { + var rb = this._rigidBodyStack[--stackCount]; + this._rigidBodyStack[stackCount] = null; + if(rb._type == 1) { + continue; + } + var cl = rb._contactLinkList; + while(cl != null) { + var n = cl._next; + var cc = cl._contact._contactConstraint; + var ccs = cl._contact._contactConstraint._solver; + if(cc.isTouching() && !ccs._addedToIsland) { + if(this._solversInIslands.length == this._numSolversInIslands) { + var newArray = new Array(this._numSolversInIslands << 1); + var _g = 0; + var _g1 = this._numSolversInIslands; + while(_g < _g1) { + var i = _g++; + newArray[i] = this._solversInIslands[i]; + this._solversInIslands[i] = null; + } + this._solversInIslands = newArray; + } + this._solversInIslands[this._numSolversInIslands++] = ccs; + this._island._addConstraintSolver(ccs,cc._positionCorrectionAlgorithm); + var other = cl._other; + if(!other._addedToIsland) { + this._island._addRigidBody(other); + this._rigidBodyStack[stackCount++] = other; + } + } + cl = n; + } + var jl = rb._jointLinkList; + while(jl != null) { + var n1 = jl._next; + var j = jl._joint; + var js1 = j._solver; + if(!js1._addedToIsland) { + if(this._solversInIslands.length == this._numSolversInIslands) { + var newArray1 = new Array(this._numSolversInIslands << 1); + var _g2 = 0; + var _g11 = this._numSolversInIslands; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this._solversInIslands[i1]; + this._solversInIslands[i1] = null; + } + this._solversInIslands = newArray1; + } + this._solversInIslands[this._numSolversInIslands++] = js1; + this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); + var other1 = jl._other; + if(!other1._addedToIsland) { + this._island._addRigidBody(other1); + this._rigidBodyStack[stackCount++] = other1; + } + } + jl = n1; + } + } + } + ,_drawBvh: function(d,tree) { + if(d.drawBvh) { + this._drawBvhNode(d,tree._root,0,d.style.bvhNodeColor); + } + } + ,_drawBvhNode: function(d,node,level,color) { + if(node == null) { + return; + } + if(level >= d.drawBvhMinLevel && level <= d.drawBvhMaxLevel) { + var _this = this._pool; + var min = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var max = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var v = min; + v.x = node._aabbMinX; + v.y = node._aabbMinY; + v.z = node._aabbMinZ; + var v1 = max; + v1.x = node._aabbMaxX; + v1.y = node._aabbMaxY; + v1.z = node._aabbMaxZ; + d.aabb(min,max,color); + var _this2 = this._pool; + if(min != null) { + min.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = min; + } + var _this3 = this._pool; + if(max != null) { + max.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newArray1 = new Array(_this3.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this3.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this3.stackVec3[i1]; + _this3.stackVec3[i1] = null; + } + _this3.stackVec3 = newArray1; + } + _this3.stackVec3[_this3.sizeVec3++] = max; + } + } + this._drawBvhNode(d,node._children[0],level + 1,color); + this._drawBvhNode(d,node._children[1],level + 1,color); + } + ,_drawRigidBodies: function(d) { + var style = d.style; + var r = this._rigidBodyList; + while(r != null) { + var n = r._next; + if(d.drawBases) { + var style1 = d.style; + d.basis(r._transform,style1.basisLength,style1.basisColorX,style1.basisColorY,style1.basisColorZ); + } + var shapeColor = null; + var isDynamic = r._type == 0; + if(!isDynamic) { + shapeColor = r._type == 2 ? style.kinematicShapeColor : style.staticShapeColor; + } + var s = r._shapeList; + while(s != null) { + var n1 = s._next; + if(isDynamic) { + if((s._id & 1) == 0) { + shapeColor = r._sleeping ? style.sleepingShapeColor1 : r._sleepTime > oimo_common_Setting.sleepingTimeThreshold ? style.sleepyShapeColor1 : style.shapeColor1; + } else { + shapeColor = r._sleeping ? style.sleepingShapeColor2 : r._sleepTime > oimo_common_Setting.sleepingTimeThreshold ? style.sleepyShapeColor2 : style.shapeColor2; + } + } + if(d.drawShapes) { + var geom = s._geom; + var tf = s._transform; + switch(geom._type) { + case 0: + d.sphere(tf,geom._radius,shapeColor); + break; + case 1: + var g = geom; + var _this = this._pool; + var hx = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var v = hx; + v.x = g._halfExtentsX; + v.y = g._halfExtentsY; + v.z = g._halfExtentsZ; + d.box(tf,hx,shapeColor); + var _this1 = this._pool; + if(hx != null) { + hx.zero(); + if(_this1.sizeVec3 == _this1.stackVec3.length) { + var newArray = new Array(_this1.sizeVec3 << 1); + var _g = 0; + var _g1 = _this1.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this1.stackVec3[i]; + _this1.stackVec3[i] = null; + } + _this1.stackVec3 = newArray; + } + _this1.stackVec3[_this1.sizeVec3++] = hx; + } + break; + case 2: + var g1 = geom; + d.cylinder(tf,g1._radius,g1._halfHeight,shapeColor); + break; + case 3: + var g2 = geom; + d.cone(tf,g2._radius,g2._halfHeight,shapeColor); + break; + case 4: + var g3 = geom; + d.capsule(tf,g3._radius,g3._halfHeight,shapeColor); + break; + case 5: + var g4 = geom; + var n2 = g4._numVertices; + var _this2 = this._pool; + var v1 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this._pool; + var v2 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this._pool; + var v3 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this5 = this._pool; + var v12 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + var _this6 = this._pool; + var v13 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var _this7 = this._pool; + var normal = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + var _this8 = this._pool; + var m = _this8.sizeMat3 == 0 ? new oimo_common_Mat3() : _this8.stackMat3[--_this8.sizeMat3]; + var _this9 = this._pool; + var o = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + var v4 = o; + v4.x = tf._positionX; + v4.y = tf._positionY; + v4.z = tf._positionZ; + var _g2 = 0; + while(_g2 < n2) { + var i1 = _g2++; + var _this10 = g4._tmpVertices[i1]; + var v5 = g4._vertices[i1]; + _this10.x = v5.x; + _this10.y = v5.y; + _this10.z = v5.z; + var y = _this10.x * m.e10 + _this10.y * m.e11 + _this10.z * m.e12; + var z = _this10.x * m.e20 + _this10.y * m.e21 + _this10.z * m.e22; + _this10.x = _this10.x * m.e00 + _this10.y * m.e01 + _this10.z * m.e02; + _this10.y = y; + _this10.z = z; + _this10.x += o.x; + _this10.y += o.y; + _this10.z += o.z; + } + if(n2 > 30) { + var _g21 = 0; + while(_g21 < n2) { + var i2 = _g21++; + var v6 = g4._tmpVertices[i2]; + v1.x = v6.x; + v1.y = v6.y; + v1.z = v6.z; + var v7 = g4._tmpVertices[(i2 + 1) % n2]; + v2.x = v7.x; + v2.y = v7.y; + v2.z = v7.z; + d.line(v1,v2,shapeColor); + } + } else if(this._debugDraw.wireframe || n2 > 10) { + var _g22 = 0; + while(_g22 < n2) { + var i3 = _g22++; + var v8 = g4._tmpVertices[i3]; + v1.x = v8.x; + v1.y = v8.y; + v1.z = v8.z; + var _g23 = 0; + while(_g23 < i3) { + var v9 = g4._tmpVertices[_g23++]; + v2.x = v9.x; + v2.y = v9.y; + v2.z = v9.z; + d.line(v1,v2,shapeColor); + } + } + } else { + var _g24 = 0; + while(_g24 < n2) { + var i4 = _g24++; + var v10 = g4._tmpVertices[i4]; + v1.x = v10.x; + v1.y = v10.y; + v1.z = v10.z; + var _g25 = 0; + while(_g25 < i4) { + var j = _g25++; + var v11 = g4._tmpVertices[j]; + v2.x = v11.x; + v2.y = v11.y; + v2.z = v11.z; + var _g26 = 0; + while(_g26 < j) { + var v14 = g4._tmpVertices[_g26++]; + v3.x = v14.x; + v3.y = v14.y; + v3.z = v14.z; + v12.x = v2.x; + v12.y = v2.y; + v12.z = v2.z; + var _this11 = v12; + _this11.x -= v1.x; + _this11.y -= v1.y; + _this11.z -= v1.z; + v13.x = v3.x; + v13.y = v3.y; + v13.z = v3.z; + var _this12 = v13; + _this12.x -= v1.x; + _this12.y -= v1.y; + _this12.z -= v1.z; + normal.x = v12.x; + normal.y = v12.y; + normal.z = v12.z; + var _this13 = normal; + var y1 = _this13.z * v13.x - _this13.x * v13.z; + var z1 = _this13.x * v13.y - _this13.y * v13.x; + _this13.x = _this13.y * v13.z - _this13.z * v13.y; + _this13.y = y1; + _this13.z = z1; + var invLen = Math.sqrt(_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + _this13.x *= invLen; + _this13.y *= invLen; + _this13.z *= invLen; + d.triangle(v1,v2,v3,normal,normal,normal,shapeColor); + normal.x = -normal.x; + normal.y = -normal.y; + normal.z = -normal.z; + d.triangle(v1,v3,v2,normal,normal,normal,shapeColor); + } + } + } + } + var _this14 = this._pool; + if(v1 != null) { + v1.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray1 = new Array(_this14.sizeVec3 << 1); + var _g3 = 0; + var _g11 = _this14.sizeVec3; + while(_g3 < _g11) { + var i5 = _g3++; + newArray1[i5] = _this14.stackVec3[i5]; + _this14.stackVec3[i5] = null; + } + _this14.stackVec3 = newArray1; + } + _this14.stackVec3[_this14.sizeVec3++] = v1; + } + var _this15 = this._pool; + if(v2 != null) { + v2.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray2 = new Array(_this15.sizeVec3 << 1); + var _g4 = 0; + var _g12 = _this15.sizeVec3; + while(_g4 < _g12) { + var i6 = _g4++; + newArray2[i6] = _this15.stackVec3[i6]; + _this15.stackVec3[i6] = null; + } + _this15.stackVec3 = newArray2; + } + _this15.stackVec3[_this15.sizeVec3++] = v2; + } + var _this16 = this._pool; + if(v3 != null) { + v3.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + var newArray3 = new Array(_this16.sizeVec3 << 1); + var _g5 = 0; + var _g13 = _this16.sizeVec3; + while(_g5 < _g13) { + var i7 = _g5++; + newArray3[i7] = _this16.stackVec3[i7]; + _this16.stackVec3[i7] = null; + } + _this16.stackVec3 = newArray3; + } + _this16.stackVec3[_this16.sizeVec3++] = v3; + } + var _this17 = this._pool; + if(v12 != null) { + v12.zero(); + if(_this17.sizeVec3 == _this17.stackVec3.length) { + var newArray4 = new Array(_this17.sizeVec3 << 1); + var _g6 = 0; + var _g14 = _this17.sizeVec3; + while(_g6 < _g14) { + var i8 = _g6++; + newArray4[i8] = _this17.stackVec3[i8]; + _this17.stackVec3[i8] = null; + } + _this17.stackVec3 = newArray4; + } + _this17.stackVec3[_this17.sizeVec3++] = v12; + } + var _this18 = this._pool; + if(v13 != null) { + v13.zero(); + if(_this18.sizeVec3 == _this18.stackVec3.length) { + var newArray5 = new Array(_this18.sizeVec3 << 1); + var _g7 = 0; + var _g15 = _this18.sizeVec3; + while(_g7 < _g15) { + var i9 = _g7++; + newArray5[i9] = _this18.stackVec3[i9]; + _this18.stackVec3[i9] = null; + } + _this18.stackVec3 = newArray5; + } + _this18.stackVec3[_this18.sizeVec3++] = v13; + } + var _this19 = this._pool; + if(normal != null) { + normal.zero(); + if(_this19.sizeVec3 == _this19.stackVec3.length) { + var newArray6 = new Array(_this19.sizeVec3 << 1); + var _g8 = 0; + var _g16 = _this19.sizeVec3; + while(_g8 < _g16) { + var i10 = _g8++; + newArray6[i10] = _this19.stackVec3[i10]; + _this19.stackVec3[i10] = null; + } + _this19.stackVec3 = newArray6; + } + _this19.stackVec3[_this19.sizeVec3++] = normal; + } + var _this20 = this._pool; + if(m != null) { + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this20.sizeMat3 == _this20.stackMat3.length) { + var newArray7 = new Array(_this20.sizeMat3 << 1); + var _g9 = 0; + var _g17 = _this20.sizeMat3; + while(_g9 < _g17) { + var i11 = _g9++; + newArray7[i11] = _this20.stackMat3[i11]; + _this20.stackMat3[i11] = null; + } + _this20.stackMat3 = newArray7; + } + _this20.stackMat3[_this20.sizeMat3++] = m; + } + var _this21 = this._pool; + if(o != null) { + o.zero(); + if(_this21.sizeVec3 == _this21.stackVec3.length) { + var newArray8 = new Array(_this21.sizeVec3 << 1); + var _g10 = 0; + var _g18 = _this21.sizeVec3; + while(_g10 < _g18) { + var i12 = _g10++; + newArray8[i12] = _this21.stackVec3[i12]; + _this21.stackVec3[i12] = null; + } + _this21.stackVec3 = newArray8; + } + _this21.stackVec3[_this21.sizeVec3++] = o; + } + break; + } + } + if(d.drawAabbs) { + var aabb = s._aabb; + var color = style.aabbColor; + var _this22 = this._pool; + var min = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; + var _this23 = this._pool; + var max = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + var v15 = min; + v15.x = aabb._minX; + v15.y = aabb._minY; + v15.z = aabb._minZ; + var v16 = max; + v16.x = aabb._maxX; + v16.y = aabb._maxY; + v16.z = aabb._maxZ; + d.aabb(min,max,color); + var _this24 = this._pool; + if(min != null) { + min.zero(); + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newArray9 = new Array(_this24.sizeVec3 << 1); + var _g19 = 0; + var _g110 = _this24.sizeVec3; + while(_g19 < _g110) { + var i13 = _g19++; + newArray9[i13] = _this24.stackVec3[i13]; + _this24.stackVec3[i13] = null; + } + _this24.stackVec3 = newArray9; + } + _this24.stackVec3[_this24.sizeVec3++] = min; + } + var _this25 = this._pool; + if(max != null) { + max.zero(); + if(_this25.sizeVec3 == _this25.stackVec3.length) { + var newArray10 = new Array(_this25.sizeVec3 << 1); + var _g20 = 0; + var _g111 = _this25.sizeVec3; + while(_g20 < _g111) { + var i14 = _g20++; + newArray10[i14] = _this25.stackVec3[i14]; + _this25.stackVec3[i14] = null; + } + _this25.stackVec3 = newArray10; + } + _this25.stackVec3[_this25.sizeVec3++] = max; + } + } + s = n1; + } + r = n; + } + } + ,_drawConstraints: function(d) { + var style = d.style; + if(d.drawPairs || d.drawContacts) { + var c = this._contactManager._contactList; + while(c != null) { + var n = c._next; + if(d.drawPairs) { + var color = style.pairColor; + var _this = this._pool; + var v1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var v2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var v = v1; + v.x = c._s1._transform._positionX; + v.y = c._s1._transform._positionY; + v.z = c._s1._transform._positionZ; + var v3 = v2; + v3.x = c._s2._transform._positionX; + v3.y = c._s2._transform._positionY; + v3.z = c._s2._transform._positionZ; + d.line(v1,v2,color); + var _this2 = this._pool; + if(v1 != null) { + v1.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = v1; + } + var _this3 = this._pool; + if(v2 != null) { + v2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newArray1 = new Array(_this3.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this3.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this3.stackVec3[i1]; + _this3.stackVec3[i1] = null; + } + _this3.stackVec3 = newArray1; + } + _this3.stackVec3[_this3.sizeVec3++] = v2; + } + } + if(d.drawContacts) { + var cc = c._contactConstraint; + var ps = c._contactConstraint._manifold._points; + var _g3 = 0; + var _g12 = c._contactConstraint._manifold._numPoints; + while(_g3 < _g12) { + var p = ps[_g3++]; + var style1 = d.style; + var _this4 = this._pool; + var pos1 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this5 = this._pool; + var pos2 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + var _this6 = this._pool; + var normal = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var _this7 = this._pool; + var tangent = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + var _this8 = this._pool; + var binormal = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + var v4 = pos1; + v4.x = p._pos1X; + v4.y = p._pos1Y; + v4.z = p._pos1Z; + var v5 = pos2; + v5.x = p._pos2X; + v5.y = p._pos2Y; + v5.z = p._pos2Z; + var v6 = normal; + v6.x = cc._manifold._normalX; + v6.y = cc._manifold._normalY; + v6.z = cc._manifold._normalZ; + var v7 = tangent; + v7.x = cc._manifold._tangentX; + v7.y = cc._manifold._tangentY; + v7.z = cc._manifold._tangentZ; + var v8 = binormal; + v8.x = cc._manifold._binormalX; + v8.y = cc._manifold._binormalY; + v8.z = cc._manifold._binormalZ; + if(p._disabled) { + d.point(pos1,style1.disabledContactColor); + d.point(pos2,style1.disabledContactColor); + d.line(pos1,pos2,style1.disabledContactColor); + } else if(p._warmStarted) { + var color1; + switch(p._id & 3) { + case 0: + color1 = style1.contactColor; + break; + case 1: + color1 = style1.contactColor2; + break; + case 2: + color1 = style1.contactColor3; + break; + default: + color1 = style1.contactColor4; + } + d.point(pos1,color1); + d.point(pos2,color1); + d.line(pos1,pos2,style1.contactColor); + } else { + d.point(pos1,style1.newContactColor); + d.point(pos2,style1.newContactColor); + d.line(pos1,pos2,style1.newContactColor); + } + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this9 = pos2; + var s = style1.contactNormalLength; + _this9.x += normal.x * s; + _this9.y += normal.y * s; + _this9.z += normal.z * s; + d.line(pos1,pos2,style1.contactNormalColor); + if(d.drawContactBases) { + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this10 = pos2; + var s1 = style1.contactTangentLength; + _this10.x += tangent.x * s1; + _this10.y += tangent.y * s1; + _this10.z += tangent.z * s1; + d.line(pos1,pos2,style1.contactTangentColor); + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this11 = pos2; + var s2 = style1.contactBinormalLength; + _this11.x += binormal.x * s2; + _this11.y += binormal.y * s2; + _this11.z += binormal.z * s2; + d.line(pos1,pos2,style1.contactBinormalColor); + } + var _this12 = this._pool; + if(pos1 != null) { + pos1.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newArray2 = new Array(_this12.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this12.sizeVec3; + while(_g4 < _g13) { + var i2 = _g4++; + newArray2[i2] = _this12.stackVec3[i2]; + _this12.stackVec3[i2] = null; + } + _this12.stackVec3 = newArray2; + } + _this12.stackVec3[_this12.sizeVec3++] = pos1; + } + var _this13 = this._pool; + if(pos2 != null) { + pos2.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newArray3 = new Array(_this13.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this13.sizeVec3; + while(_g5 < _g14) { + var i3 = _g5++; + newArray3[i3] = _this13.stackVec3[i3]; + _this13.stackVec3[i3] = null; + } + _this13.stackVec3 = newArray3; + } + _this13.stackVec3[_this13.sizeVec3++] = pos2; + } + var _this14 = this._pool; + if(normal != null) { + normal.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newArray4 = new Array(_this14.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this14.sizeVec3; + while(_g6 < _g15) { + var i4 = _g6++; + newArray4[i4] = _this14.stackVec3[i4]; + _this14.stackVec3[i4] = null; + } + _this14.stackVec3 = newArray4; + } + _this14.stackVec3[_this14.sizeVec3++] = normal; + } + var _this15 = this._pool; + if(tangent != null) { + tangent.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newArray5 = new Array(_this15.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this15.sizeVec3; + while(_g7 < _g16) { + var i5 = _g7++; + newArray5[i5] = _this15.stackVec3[i5]; + _this15.stackVec3[i5] = null; + } + _this15.stackVec3 = newArray5; + } + _this15.stackVec3[_this15.sizeVec3++] = tangent; + } + var _this16 = this._pool; + if(binormal != null) { + binormal.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + var newArray6 = new Array(_this16.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this16.sizeVec3; + while(_g8 < _g17) { + var i6 = _g8++; + newArray6[i6] = _this16.stackVec3[i6]; + _this16.stackVec3[i6] = null; + } + _this16.stackVec3 = newArray6; + } + _this16.stackVec3[_this16.sizeVec3++] = binormal; + } + } + } + c = n; + } + } + if(d.drawJoints) { + var j = this._jointList; + while(j != null) { + var n1 = j._next; + var _this17 = this._pool; + var p1 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + var _this18 = this._pool; + var p2 = _this18.sizeVec3 == 0 ? new oimo_common_Vec3() : _this18.stackVec3[--_this18.sizeVec3]; + var v9 = p1; + v9.x = j._b1._transform._positionX; + v9.y = j._b1._transform._positionY; + v9.z = j._b1._transform._positionZ; + var v10 = p2; + v10.x = j._b2._transform._positionX; + v10.y = j._b2._transform._positionY; + v10.z = j._b2._transform._positionZ; + var _this19 = this._pool; + var anchor1 = _this19.sizeVec3 == 0 ? new oimo_common_Vec3() : _this19.stackVec3[--_this19.sizeVec3]; + var _this20 = this._pool; + var anchor2 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + var _this21 = this._pool; + var basisX1 = _this21.sizeVec3 == 0 ? new oimo_common_Vec3() : _this21.stackVec3[--_this21.sizeVec3]; + var _this22 = this._pool; + var basisY1 = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; + var _this23 = this._pool; + var basisZ1 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + var _this24 = this._pool; + var basisX2 = _this24.sizeVec3 == 0 ? new oimo_common_Vec3() : _this24.stackVec3[--_this24.sizeVec3]; + var _this25 = this._pool; + var basisY2 = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; + var _this26 = this._pool; + var basisZ2 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + var v11 = anchor1; + v11.x = j._anchor1X; + v11.y = j._anchor1Y; + v11.z = j._anchor1Z; + var v12 = anchor2; + v12.x = j._anchor2X; + v12.y = j._anchor2Y; + v12.z = j._anchor2Z; + var v13 = basisX1; + v13.x = j._basisX1X; + v13.y = j._basisX1Y; + v13.z = j._basisX1Z; + var v14 = basisY1; + v14.x = j._basisY1X; + v14.y = j._basisY1Y; + v14.z = j._basisY1Z; + var v15 = basisZ1; + v15.x = j._basisZ1X; + v15.y = j._basisZ1Y; + v15.z = j._basisZ1Z; + var v16 = basisX2; + v16.x = j._basisX2X; + v16.y = j._basisX2Y; + v16.z = j._basisX2Z; + var v17 = basisY2; + v17.x = j._basisY2X; + v17.y = j._basisY2Y; + v17.z = j._basisY2Z; + var v18 = basisZ2; + v18.x = j._basisZ2X; + v18.y = j._basisZ2Y; + v18.z = j._basisZ2Z; + d.line(p1,anchor1,d.style.jointLineColor); + d.line(p2,anchor2,d.style.jointLineColor); + if(d.drawJointLimits) { + switch(j._type) { + case 0: + break; + case 1: + var lm = j._lm; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,lm.lowerLimit,lm.upperLimit,d.style.jointLineColor); + break; + case 2: + var j1 = j; + var color2 = d.style.jointLineColor; + var rlm = j1._rotLm; + var tlm = j1._translLm; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color2); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color2); + break; + case 3: + var lm1 = j._lm; + this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,d.style.jointLineColor); + break; + case 4: + var j2 = j; + var radius = d.style.jointRotationalConstraintRadius; + var color3 = d.style.jointLineColor; + var lm11 = j2._lm1; + var lm2 = j2._lm2; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color3); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color3); + break; + case 5: + var j3 = j; + var radius1 = d.style.jointRotationalConstraintRadius; + var color4 = d.style.jointLineColor; + var lm3 = j3._twistLm; + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color4); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color4); + var _this27 = this._pool; + var _this28 = _this27.sizeVec3 == 0 ? new oimo_common_Vec3() : _this27.stackVec3[--_this27.sizeVec3]; + _this28.x = anchor2.x; + _this28.y = anchor2.y; + _this28.z = anchor2.z; + var _this29 = _this28; + _this29.x += basisX2.x * radius1; + _this29.y += basisX2.y * radius1; + _this29.z += basisX2.z * radius1; + d.line(anchor2,_this29,color4); + var _this30 = this._pool; + if(_this29 != null) { + _this29.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + var newArray7 = new Array(_this30.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this30.sizeVec3; + while(_g9 < _g18) { + var i7 = _g9++; + newArray7[i7] = _this30.stackVec3[i7]; + _this30.stackVec3[i7] = null; + } + _this30.stackVec3 = newArray7; + } + _this30.stackVec3[_this30.sizeVec3++] = _this29; + } + break; + case 6: + var j4 = j; + var radius2 = d.style.jointRotationalConstraintRadius; + var color5 = d.style.jointLineColor; + var rxlm = j4._rotLms[0]; + var rylm = j4._rotLms[1]; + var rzlm = j4._rotLms[2]; + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color5); + var _this31 = this._pool; + var rotYAxis = _this31.sizeVec3 == 0 ? new oimo_common_Vec3() : _this31.stackVec3[--_this31.sizeVec3]; + var v19 = rotYAxis; + v19.x = j4._axisYX; + v19.y = j4._axisYY; + v19.z = j4._axisYZ; + var _this32 = this._pool; + var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = basisX1.x; + _this33.y = basisX1.y; + _this33.z = basisX1.z; + var rotYBasisX = _this33; + var _this34 = this._pool; + var _this35 = _this34.sizeVec3 == 0 ? new oimo_common_Vec3() : _this34.stackVec3[--_this34.sizeVec3]; + _this35.x = basisX1.x; + _this35.y = basisX1.y; + _this35.z = basisX1.z; + var _this36 = _this35; + var y = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; + var z = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; + _this36.x = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; + _this36.y = y; + _this36.z = z; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color5); + this._drawRotationalLimit(d,anchor2,rotYBasisX,_this36,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color5); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color5); + break; + } + } + d.line(anchor1,anchor2,d.style.jointErrorColor); + var _this37 = this._pool; + if(p1 != null) { + p1.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newArray8 = new Array(_this37.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this37.sizeVec3; + while(_g10 < _g19) { + var i8 = _g10++; + newArray8[i8] = _this37.stackVec3[i8]; + _this37.stackVec3[i8] = null; + } + _this37.stackVec3 = newArray8; + } + _this37.stackVec3[_this37.sizeVec3++] = p1; + } + var _this38 = this._pool; + if(p2 != null) { + p2.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newArray9 = new Array(_this38.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this38.sizeVec3; + while(_g20 < _g110) { + var i9 = _g20++; + newArray9[i9] = _this38.stackVec3[i9]; + _this38.stackVec3[i9] = null; + } + _this38.stackVec3 = newArray9; + } + _this38.stackVec3[_this38.sizeVec3++] = p2; + } + var _this39 = this._pool; + if(anchor1 != null) { + anchor1.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newArray10 = new Array(_this39.sizeVec3 << 1); + var _g21 = 0; + var _g111 = _this39.sizeVec3; + while(_g21 < _g111) { + var i10 = _g21++; + newArray10[i10] = _this39.stackVec3[i10]; + _this39.stackVec3[i10] = null; + } + _this39.stackVec3 = newArray10; + } + _this39.stackVec3[_this39.sizeVec3++] = anchor1; + } + var _this40 = this._pool; + if(anchor2 != null) { + anchor2.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newArray11 = new Array(_this40.sizeVec3 << 1); + var _g22 = 0; + var _g112 = _this40.sizeVec3; + while(_g22 < _g112) { + var i11 = _g22++; + newArray11[i11] = _this40.stackVec3[i11]; + _this40.stackVec3[i11] = null; + } + _this40.stackVec3 = newArray11; + } + _this40.stackVec3[_this40.sizeVec3++] = anchor2; + } + var _this41 = this._pool; + if(basisX1 != null) { + basisX1.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newArray12 = new Array(_this41.sizeVec3 << 1); + var _g23 = 0; + var _g113 = _this41.sizeVec3; + while(_g23 < _g113) { + var i12 = _g23++; + newArray12[i12] = _this41.stackVec3[i12]; + _this41.stackVec3[i12] = null; + } + _this41.stackVec3 = newArray12; + } + _this41.stackVec3[_this41.sizeVec3++] = basisX1; + } + var _this42 = this._pool; + if(basisY1 != null) { + basisY1.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newArray13 = new Array(_this42.sizeVec3 << 1); + var _g24 = 0; + var _g114 = _this42.sizeVec3; + while(_g24 < _g114) { + var i13 = _g24++; + newArray13[i13] = _this42.stackVec3[i13]; + _this42.stackVec3[i13] = null; + } + _this42.stackVec3 = newArray13; + } + _this42.stackVec3[_this42.sizeVec3++] = basisY1; + } + var _this43 = this._pool; + if(basisZ1 != null) { + basisZ1.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newArray14 = new Array(_this43.sizeVec3 << 1); + var _g25 = 0; + var _g115 = _this43.sizeVec3; + while(_g25 < _g115) { + var i14 = _g25++; + newArray14[i14] = _this43.stackVec3[i14]; + _this43.stackVec3[i14] = null; + } + _this43.stackVec3 = newArray14; + } + _this43.stackVec3[_this43.sizeVec3++] = basisZ1; + } + var _this44 = this._pool; + if(basisX2 != null) { + basisX2.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newArray15 = new Array(_this44.sizeVec3 << 1); + var _g26 = 0; + var _g116 = _this44.sizeVec3; + while(_g26 < _g116) { + var i15 = _g26++; + newArray15[i15] = _this44.stackVec3[i15]; + _this44.stackVec3[i15] = null; + } + _this44.stackVec3 = newArray15; + } + _this44.stackVec3[_this44.sizeVec3++] = basisX2; + } + var _this45 = this._pool; + if(basisY2 != null) { + basisY2.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newArray16 = new Array(_this45.sizeVec3 << 1); + var _g27 = 0; + var _g117 = _this45.sizeVec3; + while(_g27 < _g117) { + var i16 = _g27++; + newArray16[i16] = _this45.stackVec3[i16]; + _this45.stackVec3[i16] = null; + } + _this45.stackVec3 = newArray16; + } + _this45.stackVec3[_this45.sizeVec3++] = basisY2; + } + var _this46 = this._pool; + if(basisZ2 != null) { + basisZ2.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newArray17 = new Array(_this46.sizeVec3 << 1); + var _g28 = 0; + var _g118 = _this46.sizeVec3; + while(_g28 < _g118) { + var i17 = _g28++; + newArray17[i17] = _this46.stackVec3[i17]; + _this46.stackVec3[i17] = null; + } + _this46.stackVec3 = newArray17; + } + _this46.stackVec3[_this46.sizeVec3++] = basisZ2; + } + j = n1; + } + } + } + ,_drawRotationalLimit: function(d,center,ex,ey,needle,radius,min,max,color) { + if(min != max) { + var _this = this._pool; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + var _this2 = _this1; + _this2.x += needle.x * radius; + _this2.y += needle.y * radius; + _this2.z += needle.z * radius; + d.line(center,_this2,color); + var _this3 = this._pool; + if(_this2 != null) { + _this2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newArray = new Array(_this3.sizeVec3 << 1); + var _g = 0; + var _g1 = _this3.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; + } + _this3.stackVec3 = newArray; + } + _this3.stackVec3[_this3.sizeVec3++] = _this2; + } + if(min > max) { + d.ellipse(center,ex,ey,radius,radius,color); + } else { + d.arc(center,ex,ey,radius,radius,min,max,true,color); + } + } + } + ,_drawTranslationalLimit: function(d,center,ex,min,max,color) { + if(min < max) { + var _this = this._pool; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + var _this2 = _this1; + _this2.x += ex.x * min; + _this2.y += ex.y * min; + _this2.z += ex.z * min; + var _this3 = this._pool; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = center.x; + _this4.y = center.y; + _this4.z = center.z; + var _this5 = _this4; + _this5.x += ex.x * max; + _this5.y += ex.y * max; + _this5.z += ex.z * max; + d.line(_this2,_this5,color); + var _this6 = this._pool; + if(_this2 != null) { + _this2.zero(); + if(_this6.sizeVec3 == _this6.stackVec3.length) { + var newArray = new Array(_this6.sizeVec3 << 1); + var _g = 0; + var _g1 = _this6.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this6.stackVec3[i]; + _this6.stackVec3[i] = null; + } + _this6.stackVec3 = newArray; + } + _this6.stackVec3[_this6.sizeVec3++] = _this2; + } + var _this7 = this._pool; + if(_this5 != null) { + _this5.zero(); + if(_this7.sizeVec3 == _this7.stackVec3.length) { + var newArray1 = new Array(_this7.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this7.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this7.stackVec3[i1]; + _this7.stackVec3[i1] = null; + } + _this7.stackVec3 = newArray1; + } + _this7.stackVec3[_this7.sizeVec3++] = _this5; + } + } + } + ,_drawTranslationalLimit3D: function(d,center,ex,ey,ez,xlm,ylm,zlm,color) { + var minx = xlm.lowerLimit; + var maxx = xlm.upperLimit; + var miny = ylm.lowerLimit; + var maxy = ylm.upperLimit; + var minz = zlm.lowerLimit; + var maxz = zlm.upperLimit; + var _this = this._pool; + if(_this.sizeVec3 == 0) { + new oimo_common_Vec3(); + } else { + --_this.sizeVec3; + } + var _this1 = this._pool; + if(_this1.sizeVec3 == 0) { + new oimo_common_Vec3(); + } else { + --_this1.sizeVec3; + } + var _this2 = this._pool; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = center.x; + _this3.y = center.y; + _this3.z = center.z; + var _this4 = _this3; + _this4.x += ex.x * minx; + _this4.y += ex.y * minx; + _this4.z += ex.z * minx; + _this4.x += ey.x * miny; + _this4.y += ey.y * miny; + _this4.z += ey.z * miny; + _this4.x += ez.x * minz; + _this4.y += ez.y * minz; + _this4.z += ez.z * minz; + var _this5 = this._pool; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = center.x; + _this6.y = center.y; + _this6.z = center.z; + var _this7 = _this6; + _this7.x += ex.x * minx; + _this7.y += ex.y * minx; + _this7.z += ex.z * minx; + _this7.x += ey.x * miny; + _this7.y += ey.y * miny; + _this7.z += ey.z * miny; + _this7.x += ez.x * maxz; + _this7.y += ez.y * maxz; + _this7.z += ez.z * maxz; + var _this8 = this._pool; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = center.x; + _this9.y = center.y; + _this9.z = center.z; + var _this10 = _this9; + _this10.x += ex.x * minx; + _this10.y += ex.y * minx; + _this10.z += ex.z * minx; + _this10.x += ey.x * maxy; + _this10.y += ey.y * maxy; + _this10.z += ey.z * maxy; + _this10.x += ez.x * minz; + _this10.y += ez.y * minz; + _this10.z += ez.z * minz; + var _this11 = this._pool; + var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = center.x; + _this12.y = center.y; + _this12.z = center.z; + var _this13 = _this12; + _this13.x += ex.x * minx; + _this13.y += ex.y * minx; + _this13.z += ex.z * minx; + _this13.x += ey.x * maxy; + _this13.y += ey.y * maxy; + _this13.z += ey.z * maxy; + _this13.x += ez.x * maxz; + _this13.y += ez.y * maxz; + _this13.z += ez.z * maxz; + var _this14 = this._pool; + var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = center.x; + _this15.y = center.y; + _this15.z = center.z; + var _this16 = _this15; + _this16.x += ex.x * maxx; + _this16.y += ex.y * maxx; + _this16.z += ex.z * maxx; + _this16.x += ey.x * miny; + _this16.y += ey.y * miny; + _this16.z += ey.z * miny; + _this16.x += ez.x * minz; + _this16.y += ez.y * minz; + _this16.z += ez.z * minz; + var _this17 = this._pool; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = center.x; + _this18.y = center.y; + _this18.z = center.z; + var _this19 = _this18; + _this19.x += ex.x * maxx; + _this19.y += ex.y * maxx; + _this19.z += ex.z * maxx; + _this19.x += ey.x * miny; + _this19.y += ey.y * miny; + _this19.z += ey.z * miny; + _this19.x += ez.x * maxz; + _this19.y += ez.y * maxz; + _this19.z += ez.z * maxz; + var _this20 = this._pool; + var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = center.x; + _this21.y = center.y; + _this21.z = center.z; + var _this22 = _this21; + _this22.x += ex.x * maxx; + _this22.y += ex.y * maxx; + _this22.z += ex.z * maxx; + _this22.x += ey.x * maxy; + _this22.y += ey.y * maxy; + _this22.z += ey.z * maxy; + _this22.x += ez.x * minz; + _this22.y += ez.y * minz; + _this22.z += ez.z * minz; + var _this23 = this._pool; + var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = center.x; + _this24.y = center.y; + _this24.z = center.z; + var _this25 = _this24; + _this25.x += ex.x * maxx; + _this25.y += ex.y * maxx; + _this25.z += ex.z * maxx; + _this25.x += ey.x * maxy; + _this25.y += ey.y * maxy; + _this25.z += ey.z * maxy; + _this25.x += ez.x * maxz; + _this25.y += ez.y * maxz; + _this25.z += ez.z * maxz; + d.line(_this4,_this16,color); + d.line(_this10,_this22,color); + d.line(_this7,_this19,color); + d.line(_this13,_this25,color); + d.line(_this4,_this10,color); + d.line(_this16,_this22,color); + d.line(_this7,_this13,color); + d.line(_this19,_this25,color); + d.line(_this4,_this7,color); + d.line(_this16,_this19,color); + d.line(_this10,_this13,color); + d.line(_this22,_this25,color); + var _this26 = this._pool; + if(_this4 != null) { + _this4.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + var newArray = new Array(_this26.sizeVec3 << 1); + var _g = 0; + var _g1 = _this26.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; + } + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this4; + } + var _this27 = this._pool; + if(_this7 != null) { + _this7.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + var newArray1 = new Array(_this27.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this27.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this27.stackVec3[i1]; + _this27.stackVec3[i1] = null; + } + _this27.stackVec3 = newArray1; + } + _this27.stackVec3[_this27.sizeVec3++] = _this7; + } + var _this28 = this._pool; + if(_this10 != null) { + _this10.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + var newArray2 = new Array(_this28.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this28.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this28.stackVec3[i2]; + _this28.stackVec3[i2] = null; + } + _this28.stackVec3 = newArray2; + } + _this28.stackVec3[_this28.sizeVec3++] = _this10; + } + var _this29 = this._pool; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + var newArray3 = new Array(_this29.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this29.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this29.stackVec3[i3]; + _this29.stackVec3[i3] = null; + } + _this29.stackVec3 = newArray3; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + var _this30 = this._pool; + if(_this16 != null) { + _this16.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + var newArray4 = new Array(_this30.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this30.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this30.stackVec3[i4]; + _this30.stackVec3[i4] = null; + } + _this30.stackVec3 = newArray4; + } + _this30.stackVec3[_this30.sizeVec3++] = _this16; + } + var _this31 = this._pool; + if(_this19 != null) { + _this19.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + var newArray5 = new Array(_this31.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this31.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this31.stackVec3[i5]; + _this31.stackVec3[i5] = null; + } + _this31.stackVec3 = newArray5; + } + _this31.stackVec3[_this31.sizeVec3++] = _this19; + } + var _this32 = this._pool; + if(_this22 != null) { + _this22.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + var newArray6 = new Array(_this32.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this32.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this32.stackVec3[i6]; + _this32.stackVec3[i6] = null; + } + _this32.stackVec3 = newArray6; + } + _this32.stackVec3[_this32.sizeVec3++] = _this22; + } + var _this33 = this._pool; + if(_this25 != null) { + _this25.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + var newArray7 = new Array(_this33.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this33.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this33.stackVec3[i7]; + _this33.stackVec3[i7] = null; + } + _this33.stackVec3 = newArray7; + } + _this33.stackVec3[_this33.sizeVec3++] = _this25; + } + } + ,_drawEllipseOnSphere: function(d,center,normal,x,y,radiansX,radiansY,radius,color) { + var theta = 0; + var _this = this._pool; + var rotVec = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var rotQ = _this1.sizeQuat == 0 ? new oimo_common_Quat() : _this1.stackQuat[--_this1.sizeQuat]; + var _this2 = this._pool; + var rotM = _this2.sizeMat3 == 0 ? new oimo_common_Mat3() : _this2.stackMat3[--_this2.sizeMat3]; + var _this3 = this._pool; + var prevV = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _g = 0; + while(_g < 17) { + var i = _g++; + var rx = Math.cos(theta) * radiansX; + var ry = Math.sin(theta) * radiansY; + var halfRotAng = Math.sqrt(rx * rx + ry * ry); + var rotSin = Math.sin(halfRotAng * 0.5); + var rotCos = Math.cos(halfRotAng * 0.5); + var _this4 = rotVec.zero(); + _this4.x += x.x * rx; + _this4.y += x.y * rx; + _this4.z += x.z * rx; + _this4.x += y.x * ry; + _this4.y += y.y * ry; + _this4.z += y.z * ry; + var s = 1 / halfRotAng * rotSin; + rotVec.x *= s; + rotVec.y *= s; + rotVec.z *= s; + rotQ.x = rotVec.x; + rotQ.y = rotVec.y; + rotQ.z = rotVec.z; + rotQ.w = rotCos; + var x1 = rotQ.x; + var y1 = rotQ.y; + var z = rotQ.z; + var w = rotQ.w; + var x2 = 2 * x1; + var y2 = 2 * y1; + var z2 = 2 * z; + var xx = x1 * x2; + var yy = y1 * y2; + var zz = z * z2; + var xy = x1 * y2; + var yz = y1 * z2; + var xz = x1 * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + rotM.e00 = 1 - yy - zz; + rotM.e01 = xy - wz; + rotM.e02 = xz + wy; + rotM.e10 = xy + wz; + rotM.e11 = 1 - xx - zz; + rotM.e12 = yz - wx; + rotM.e20 = xz - wy; + rotM.e21 = yz + wx; + rotM.e22 = 1 - xx - yy; + var _this5 = this._pool; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x += normal.x * radius; + _this6.y += normal.y * radius; + _this6.z += normal.z * radius; + var v = _this6; + var y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; + var z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; + v.x = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; + v.y = y3; + v.z = z1; + v.x += center.x; + v.y += center.y; + v.z += center.z; + if(i >= 1) { + d.line(prevV,v,color); + } + var _this7 = this._pool; + if(prevV != null) { + prevV.zero(); + if(_this7.sizeVec3 == _this7.stackVec3.length) { + var newArray = new Array(_this7.sizeVec3 << 1); + var _g1 = 0; + var _g11 = _this7.sizeVec3; + while(_g1 < _g11) { + var i1 = _g1++; + newArray[i1] = _this7.stackVec3[i1]; + _this7.stackVec3[i1] = null; + } + _this7.stackVec3 = newArray; + } + _this7.stackVec3[_this7.sizeVec3++] = prevV; + } + prevV = v; + theta += 0.39269908169872375; + } + var _this8 = this._pool; + if(rotVec != null) { + rotVec.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray1 = new Array(_this8.sizeVec3 << 1); + var _g2 = 0; + var _g12 = _this8.sizeVec3; + while(_g2 < _g12) { + var i2 = _g2++; + newArray1[i2] = _this8.stackVec3[i2]; + _this8.stackVec3[i2] = null; + } + _this8.stackVec3 = newArray1; + } + _this8.stackVec3[_this8.sizeVec3++] = rotVec; + } + var _this9 = this._pool; + if(rotQ != null) { + rotQ.x = 0; + rotQ.y = 0; + rotQ.z = 0; + rotQ.w = 1; + if(_this9.sizeQuat == _this9.stackQuat.length) { + var newArray2 = new Array(_this9.sizeQuat << 1); + var _g3 = 0; + var _g13 = _this9.sizeQuat; + while(_g3 < _g13) { + var i3 = _g3++; + newArray2[i3] = _this9.stackQuat[i3]; + _this9.stackQuat[i3] = null; + } + _this9.stackQuat = newArray2; + } + _this9.stackQuat[_this9.sizeQuat++] = rotQ; + } + var _this10 = this._pool; + if(rotM != null) { + rotM.e00 = 1; + rotM.e01 = 0; + rotM.e02 = 0; + rotM.e10 = 0; + rotM.e11 = 1; + rotM.e12 = 0; + rotM.e20 = 0; + rotM.e21 = 0; + rotM.e22 = 1; + if(_this10.sizeMat3 == _this10.stackMat3.length) { + var newArray3 = new Array(_this10.sizeMat3 << 1); + var _g4 = 0; + var _g14 = _this10.sizeMat3; + while(_g4 < _g14) { + var i4 = _g4++; + newArray3[i4] = _this10.stackMat3[i4]; + _this10.stackMat3[i4] = null; + } + _this10.stackMat3 = newArray3; + } + _this10.stackMat3[_this10.sizeMat3++] = rotM; + } + var _this11 = this._pool; + if(prevV != null) { + prevV.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newArray4 = new Array(_this11.sizeVec3 << 1); + var _g5 = 0; + var _g15 = _this11.sizeVec3; + while(_g5 < _g15) { + var i5 = _g5++; + newArray4[i5] = _this11.stackVec3[i5]; + _this11.stackVec3[i5] = null; + } + _this11.stackVec3 = newArray4; + } + _this11.stackVec3[_this11.sizeVec3++] = prevV; + } + } + ,step: function(timeStep) { + if(this._timeStep.dt > 0) { + this._timeStep.dtRatio = timeStep / this._timeStep.dt; + } + this._timeStep.dt = timeStep; + this._timeStep.invDt = 1 / timeStep; + var st = Date.now() / 1000; + this._updateContacts(); + this._solveIslands(); + oimo_dynamics_common_Performance.totalTime = (Date.now() / 1000 - st) * 1000; + } + ,addRigidBody: function(rigidBody) { + if(rigidBody._world != null) { + throw new Error("A rigid body cannot belong to multiple worlds."); + } + if(this._rigidBodyList == null) { + this._rigidBodyList = rigidBody; + this._rigidBodyListLast = rigidBody; + } else { + this._rigidBodyListLast._next = rigidBody; + rigidBody._prev = this._rigidBodyListLast; + this._rigidBodyListLast = rigidBody; + } + rigidBody._world = this; + var s = rigidBody._shapeList; + while(s != null) { + var n = s._next; + s._proxy = this._broadPhase.createProxy(s,s._aabb); + s._id = this._shapeIdCount++; + this._numShapes++; + s = n; + } + this._numRigidBodies++; + } + ,removeRigidBody: function(rigidBody) { + if(rigidBody._world != this) { + throw new Error("The rigid body doesn't belong to the world."); + } + var prev = rigidBody._prev; + var next = rigidBody._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(rigidBody == this._rigidBodyList) { + this._rigidBodyList = this._rigidBodyList._next; + } + if(rigidBody == this._rigidBodyListLast) { + this._rigidBodyListLast = this._rigidBodyListLast._prev; + } + rigidBody._next = null; + rigidBody._prev = null; + rigidBody._world = null; + var s = rigidBody._shapeList; + while(s != null) { + var n = s._next; + this._broadPhase.destroyProxy(s._proxy); + s._proxy = null; + s._id = -1; + var cl = s._rigidBody._contactLinkList; + while(cl != null) { + var n1 = cl._next; + var c = cl._contact; + if(c._s1 == s || c._s2 == s) { + var _this = cl._other; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = this._contactManager; + var prev1 = c._prev; + var next1 = c._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c == _this1._contactList) { + _this1._contactList = _this1._contactList._next; + } + if(c == _this1._contactListLast) { + _this1._contactListLast = _this1._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc2 = c._s2._contactCallback; + if(c._s1._contactCallback == cc2) { + cc2 = null; + } + } + var prev2 = c._link1._prev; + var next2 = c._link1._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev3 = c._link2._prev; + var next3 = c._link2._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this2 = c._contactConstraint; + _this2._s1 = null; + _this2._s2 = null; + _this2._b1 = null; + _this2._b2 = null; + _this2._tf1 = null; + _this2._tf2 = null; + c._next = _this1._contactPool; + _this1._contactPool = c; + _this1._numContacts--; + } + cl = n1; + } + this._numShapes--; + s = n; + } + this._numRigidBodies--; + } + ,addJoint: function(joint) { + if(joint._world != null) { + throw new Error("A joint cannot belong to multiple worlds."); + } + if(this._jointList == null) { + this._jointList = joint; + this._jointListLast = joint; + } else { + this._jointListLast._next = joint; + joint._prev = this._jointListLast; + this._jointListLast = joint; + } + joint._world = this; + joint._link1._other = joint._b2; + joint._link2._other = joint._b1; + if(joint._b1._jointLinkList == null) { + joint._b1._jointLinkList = joint._link1; + joint._b1._jointLinkListLast = joint._link1; + } else { + joint._b1._jointLinkListLast._next = joint._link1; + joint._link1._prev = joint._b1._jointLinkListLast; + joint._b1._jointLinkListLast = joint._link1; + } + if(joint._b2._jointLinkList == null) { + joint._b2._jointLinkList = joint._link2; + joint._b2._jointLinkListLast = joint._link2; + } else { + joint._b2._jointLinkListLast._next = joint._link2; + joint._link2._prev = joint._b2._jointLinkListLast; + joint._b2._jointLinkListLast = joint._link2; + } + joint._b1._numJointLinks++; + joint._b2._numJointLinks++; + var _this = joint._b1; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = joint._b2; + _this1._sleeping = false; + _this1._sleepTime = 0; + joint._syncAnchors(); + this._numJoints++; + } + ,removeJoint: function(joint) { + if(joint._world != this) { + throw new Error("The joint doesn't belong to the world."); + } + var prev = joint._prev; + var next = joint._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(joint == this._jointList) { + this._jointList = this._jointList._next; + } + if(joint == this._jointListLast) { + this._jointListLast = this._jointListLast._prev; + } + joint._next = null; + joint._prev = null; + joint._world = null; + var prev1 = joint._link1._prev; + var next1 = joint._link1._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(joint._link1 == joint._b1._jointLinkList) { + joint._b1._jointLinkList = joint._b1._jointLinkList._next; + } + if(joint._link1 == joint._b1._jointLinkListLast) { + joint._b1._jointLinkListLast = joint._b1._jointLinkListLast._prev; + } + joint._link1._next = null; + joint._link1._prev = null; + var prev2 = joint._link2._prev; + var next2 = joint._link2._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(joint._link2 == joint._b2._jointLinkList) { + joint._b2._jointLinkList = joint._b2._jointLinkList._next; + } + if(joint._link2 == joint._b2._jointLinkListLast) { + joint._b2._jointLinkListLast = joint._b2._jointLinkListLast._prev; + } + joint._link2._next = null; + joint._link2._prev = null; + joint._link1._other = null; + joint._link2._other = null; + joint._b1._numJointLinks--; + joint._b2._numJointLinks--; + var _this = joint._b1; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = joint._b2; + _this1._sleeping = false; + _this1._sleepTime = 0; + this._numJoints--; + } + ,setDebugDraw: function(debugDraw) { + this._debugDraw = debugDraw; + } + ,getDebugDraw: function() { + return this._debugDraw; + } + ,debugDraw: function() { + if(this._debugDraw != null) { + if(this._broadPhase._type == 2) { + this._drawBvh(this._debugDraw,this._broadPhase._tree); + } + this._drawRigidBodies(this._debugDraw); + this._drawConstraints(this._debugDraw); + } + } + ,rayCast: function(begin,end,callback) { + var _this = this._rayCastWrapper.begin; + _this.x = begin.x; + _this.y = begin.y; + _this.z = begin.z; + var _this1 = this._rayCastWrapper.end; + _this1.x = end.x; + _this1.y = end.y; + _this1.z = end.z; + this._rayCastWrapper.callback = callback; + this._broadPhase.rayCast(begin,end,this._rayCastWrapper); + } + ,convexCast: function(convex,begin,translation,callback) { + this._convexCastWrapper.convex = convex; + var _this = this._convexCastWrapper.begin; + _this._positionX = begin._positionX; + _this._positionY = begin._positionY; + _this._positionZ = begin._positionZ; + _this._rotation00 = begin._rotation00; + _this._rotation01 = begin._rotation01; + _this._rotation02 = begin._rotation02; + _this._rotation10 = begin._rotation10; + _this._rotation11 = begin._rotation11; + _this._rotation12 = begin._rotation12; + _this._rotation20 = begin._rotation20; + _this._rotation21 = begin._rotation21; + _this._rotation22 = begin._rotation22; + var _this1 = this._convexCastWrapper.translation; + _this1.x = translation.x; + _this1.y = translation.y; + _this1.z = translation.z; + this._convexCastWrapper.callback = callback; + this._broadPhase.convexCast(convex,begin,translation,this._convexCastWrapper); + } + ,aabbTest: function(aabb,callback) { + this._aabbTestWrapper._aabb.copyFrom(aabb); + this._aabbTestWrapper._callback = callback; + this._broadPhase.aabbTest(aabb,this._aabbTestWrapper); + } + ,getRigidBodyList: function() { + return this._rigidBodyList; + } + ,getJointList: function() { + return this._jointList; + } + ,getBroadPhase: function() { + return this._broadPhase; + } + ,getContactManager: function() { + return this._contactManager; + } + ,getNumRigidBodies: function() { + return this._numRigidBodies; + } + ,getNumJoints: function() { + return this._numJoints; + } + ,getNumShapes: function() { + return this._numShapes; + } + ,getNumIslands: function() { + return this._numIslands; + } + ,getNumVelocityIterations: function() { + return this._numVelocityIterations; + } + ,setNumVelocityIterations: function(numVelocityIterations) { + this._numVelocityIterations = numVelocityIterations; + } + ,getNumPositionIterations: function() { + return this._numPositionIterations; + } + ,setNumPositionIterations: function(numPositionIterations) { + this._numPositionIterations = numPositionIterations; + } + ,getGravity: function() { + return this._gravity; + } + ,setGravity: function(gravity) { + var _this = this._gravity; + _this.x = gravity.x; + _this.y = gravity.y; + _this.z = gravity.z; + } + ,__class__: oimo_dynamics_World +}; +var oimo_dynamics__$World_RayCastWrapper = function() { + oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); + this.begin = new oimo_common_Vec3(); + this.end = new oimo_common_Vec3(); + this.callback = null; +}; +oimo_dynamics__$World_RayCastWrapper.__name__ = true; +oimo_dynamics__$World_RayCastWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; +oimo_dynamics__$World_RayCastWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ + process: function(proxy) { + var shape = proxy.userData; + if(shape._geom.rayCast(this.begin,this.end,shape._transform,this.rayCastHit)) { + this.callback.process(shape,this.rayCastHit); + } + } + ,__class__: oimo_dynamics__$World_RayCastWrapper +}); +var oimo_dynamics__$World_ConvexCastWrapper = function() { + oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); + this.begin = new oimo_common_Transform(); + this.translation = new oimo_common_Vec3(); + this.zero = new oimo_common_Vec3(); + this.callback = null; + this.convex = null; +}; +oimo_dynamics__$World_ConvexCastWrapper.__name__ = true; +oimo_dynamics__$World_ConvexCastWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; +oimo_dynamics__$World_ConvexCastWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ + process: function(proxy) { + var shape = proxy.userData; + var type = shape._geom._type; + if(type < 0 || type > 5) { + return; + } + if(oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance.convexCast(this.convex,shape._geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { + this.callback.process(shape,this.rayCastHit); + } + } + ,__class__: oimo_dynamics__$World_ConvexCastWrapper +}); +var oimo_dynamics__$World_AabbTestWrapper = function() { + oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); + this._aabb = new oimo_collision_geometry_Aabb(); + this._callback = null; +}; +oimo_dynamics__$World_AabbTestWrapper.__name__ = true; +oimo_dynamics__$World_AabbTestWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; +oimo_dynamics__$World_AabbTestWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ + process: function(proxy) { + var shapeAabb = proxy.userData._aabb; + } + ,__class__: oimo_dynamics__$World_AabbTestWrapper +}); +var oimo_dynamics_callback_AabbTestCallback = function() { +}; +oimo_dynamics_callback_AabbTestCallback.__name__ = true; +oimo_dynamics_callback_AabbTestCallback.prototype = { + process: function(shape) { + } + ,__class__: oimo_dynamics_callback_AabbTestCallback +}; +var oimo_dynamics_callback_ContactCallback = function() { +}; +oimo_dynamics_callback_ContactCallback.__name__ = true; +oimo_dynamics_callback_ContactCallback.prototype = { + beginContact: function(c) { + } + ,preSolve: function(c) { + } + ,postSolve: function(c) { + } + ,endContact: function(c) { + } + ,__class__: oimo_dynamics_callback_ContactCallback +}; +var oimo_dynamics_callback_RayCastCallback = function() { +}; +oimo_dynamics_callback_RayCastCallback.__name__ = true; +oimo_dynamics_callback_RayCastCallback.prototype = { + process: function(shape,hit) { + } + ,__class__: oimo_dynamics_callback_RayCastCallback +}; +var oimo_dynamics_callback_RayCastClosest = function() { + oimo_dynamics_callback_RayCastCallback.call(this); + this.position = new oimo_common_Vec3(); + this.normal = new oimo_common_Vec3(); + this.shape = null; + this.fraction = 1; + this.position.zero(); + this.normal.zero(); + this.hit = false; +}; +oimo_dynamics_callback_RayCastClosest.__name__ = true; +oimo_dynamics_callback_RayCastClosest.__super__ = oimo_dynamics_callback_RayCastCallback; +oimo_dynamics_callback_RayCastClosest.prototype = $extend(oimo_dynamics_callback_RayCastCallback.prototype,{ + clear: function() { + this.shape = null; + this.fraction = 1; + this.position.zero(); + this.normal.zero(); + this.hit = false; + } + ,process: function(shape,hit) { + if(hit.fraction < this.fraction) { + this.shape = shape; + this.hit = true; + this.fraction = hit.fraction; + var _this = this.position; + var v = hit.position; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.normal; + var v1 = hit.normal; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + } + } + ,__class__: oimo_dynamics_callback_RayCastClosest +}); +var oimo_dynamics_common_DebugDrawStyle = function() { + this.basisColorZ = new oimo_common_Vec3(0.0,0.0,1.0); + this.basisColorY = new oimo_common_Vec3(0.0,1.0,0.0); + this.basisColorX = new oimo_common_Vec3(1.0,0.0,0.0); + this.basisLength = 0.5; + this.jointRotationalConstraintRadius = 0.3; + this.jointErrorColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.jointLineColor = new oimo_common_Vec3(0.8,0.8,0.8); + this.contactBinormalLength = 0.5; + this.contactTangentLength = 0.5; + this.contactNormalLength = 0.5; + this.contactBinormalColor = new oimo_common_Vec3(0.2,0.2,1.0); + this.contactTangentColor = new oimo_common_Vec3(0.1,0.8,0.1); + this.contactNormalColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.disabledContactColor = new oimo_common_Vec3(0.5,0.1,0.1); + this.newContactColor = new oimo_common_Vec3(1.0,1.0,0.1); + this.contactColor4 = new oimo_common_Vec3(0.8,0.1,1.0); + this.contactColor3 = new oimo_common_Vec3(0.1,0.8,0.6); + this.contactColor2 = new oimo_common_Vec3(1.0,0.6,0.1); + this.contactColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.pairColor = new oimo_common_Vec3(1.0,1.0,0.1); + this.bvhNodeColor = new oimo_common_Vec3(0.4,0.4,0.4); + this.aabbColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.kinematicShapeColor = new oimo_common_Vec3(1.0,0.5,0.1); + this.staticShapeColor = new oimo_common_Vec3(0.7,0.7,0.7); + this.sleepingShapeColor2 = new oimo_common_Vec3(0.2,0.8,0.5); + this.sleepingShapeColor1 = new oimo_common_Vec3(0.3,0.3,0.8); + this.sleepyShapeColor2 = new oimo_common_Vec3(0.6,0.8,0.3); + this.sleepyShapeColor1 = new oimo_common_Vec3(0.5,0.25,0.6); + this.shapeColor2 = new oimo_common_Vec3(1.0,0.8,0.1); + this.shapeColor1 = new oimo_common_Vec3(0.7,0.2,0.4); +}; +oimo_dynamics_common_DebugDrawStyle.__name__ = true; +oimo_dynamics_common_DebugDrawStyle.prototype = { + __class__: oimo_dynamics_common_DebugDrawStyle +}; +var oimo_dynamics_common_Performance = function() { }; +oimo_dynamics_common_Performance.__name__ = true; +var oimo_dynamics_constraint_ConstraintSolver = function() { + this._b1 = null; + this._b2 = null; + this._addedToIsland = false; +}; +oimo_dynamics_constraint_ConstraintSolver.__name__ = true; +oimo_dynamics_constraint_ConstraintSolver.prototype = { + preSolveVelocity: function(timeStep) { + } + ,warmStart: function(timeStep) { + } + ,solveVelocity: function() { + } + ,postSolveVelocity: function(timeStep) { + } + ,preSolvePosition: function(timeStep) { + } + ,solvePositionSplitImpulse: function() { + } + ,solvePositionNgs: function(timeStep) { + } + ,postSolve: function() { + } + ,__class__: oimo_dynamics_constraint_ConstraintSolver +}; +var oimo_dynamics_constraint_PositionCorrectionAlgorithm = function() { }; +oimo_dynamics_constraint_PositionCorrectionAlgorithm.__name__ = true; +var oimo_dynamics_constraint_contact_ContactConstraint = function(manifold) { + this._solver = new oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver(this); + this._manifold = manifold; +}; +oimo_dynamics_constraint_contact_ContactConstraint.__name__ = true; +oimo_dynamics_constraint_contact_ContactConstraint.prototype = { + _getVelocitySolverInfo: function(timeStep,info) { + info.b1 = this._b1; + info.b2 = this._b2; + var normalX; + var normalY; + var normalZ; + var tangentX; + var tangentY; + var tangentZ; + var binormalX; + var binormalY; + var binormalZ; + normalX = this._manifold._normalX; + normalY = this._manifold._normalY; + normalZ = this._manifold._normalZ; + tangentX = this._manifold._tangentX; + tangentY = this._manifold._tangentY; + tangentZ = this._manifold._tangentZ; + binormalX = this._manifold._binormalX; + binormalY = this._manifold._binormalY; + binormalZ = this._manifold._binormalZ; + var friction = Math.sqrt(this._s1._friction * this._s2._friction); + var restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); + var num = this._manifold._numPoints; + info.numRows = 0; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; + if(p._depth < 0) { + p._disabled = true; + var _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; + continue; + } else { + p._disabled = false; + } + var row = info.rows[info.numRows++]; + row.friction = friction; + row.cfm = 0; + var j = row.jacobianN; + j.lin1X = normalX; + j.lin1Y = normalY; + j.lin1Z = normalZ; + j.lin2X = normalX; + j.lin2Y = normalY; + j.lin2Z = normalZ; + j.ang1X = p._relPos1Y * normalZ - p._relPos1Z * normalY; + j.ang1Y = p._relPos1Z * normalX - p._relPos1X * normalZ; + j.ang1Z = p._relPos1X * normalY - p._relPos1Y * normalX; + j.ang2X = p._relPos2Y * normalZ - p._relPos2Z * normalY; + j.ang2Y = p._relPos2Z * normalX - p._relPos2X * normalZ; + j.ang2Z = p._relPos2X * normalY - p._relPos2Y * normalX; + j = row.jacobianT; + j.lin1X = tangentX; + j.lin1Y = tangentY; + j.lin1Z = tangentZ; + j.lin2X = tangentX; + j.lin2Y = tangentY; + j.lin2Z = tangentZ; + j.ang1X = p._relPos1Y * tangentZ - p._relPos1Z * tangentY; + j.ang1Y = p._relPos1Z * tangentX - p._relPos1X * tangentZ; + j.ang1Z = p._relPos1X * tangentY - p._relPos1Y * tangentX; + j.ang2X = p._relPos2Y * tangentZ - p._relPos2Z * tangentY; + j.ang2Y = p._relPos2Z * tangentX - p._relPos2X * tangentZ; + j.ang2Z = p._relPos2X * tangentY - p._relPos2Y * tangentX; + j = row.jacobianB; + j.lin1X = binormalX; + j.lin1Y = binormalY; + j.lin1Z = binormalZ; + j.lin2X = binormalX; + j.lin2Y = binormalY; + j.lin2Z = binormalZ; + j.ang1X = p._relPos1Y * binormalZ - p._relPos1Z * binormalY; + j.ang1Y = p._relPos1Z * binormalX - p._relPos1X * binormalZ; + j.ang1Z = p._relPos1X * binormalY - p._relPos1Y * binormalX; + j.ang2X = p._relPos2Y * binormalZ - p._relPos2Z * binormalY; + j.ang2Y = p._relPos2Z * binormalX - p._relPos2X * binormalZ; + j.ang2Z = p._relPos2X * binormalY - p._relPos2Y * binormalX; + j = row.jacobianN; + var rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); + if(rvn < -oimo_common_Setting.contactEnableBounceThreshold && !p._warmStarted) { + row.rhs = -rvn * restitution; + } else { + row.rhs = 0; + } + if(this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE) { + if(p._depth > oimo_common_Setting.linearSlop) { + var minRhs = (p._depth - oimo_common_Setting.linearSlop) * oimo_common_Setting.velocityBaumgarte * timeStep.invDt; + if(row.rhs < minRhs) { + row.rhs = minRhs; + } + } + } + if(!p._warmStarted) { + var _this1 = p._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + } + row.impulse = p._impulse; + } + } + ,_getPositionSolverInfo: function(info) { + info.b1 = this._b1; + info.b2 = this._b2; + var normalX; + var normalY; + var normalZ; + normalX = this._manifold._normalX; + normalY = this._manifold._normalY; + normalZ = this._manifold._normalZ; + var num = this._manifold._numPoints; + info.numRows = 0; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; + if(p._disabled) { + continue; + } + var row = info.rows[info.numRows++]; + var j = row.jacobianN; + j.lin1X = normalX; + j.lin1Y = normalY; + j.lin1Z = normalZ; + j.lin2X = normalX; + j.lin2Y = normalY; + j.lin2Z = normalZ; + j.ang1X = p._relPos1Y * normalZ - p._relPos1Z * normalY; + j.ang1Y = p._relPos1Z * normalX - p._relPos1X * normalZ; + j.ang1Z = p._relPos1X * normalY - p._relPos1Y * normalX; + j.ang2X = p._relPos2Y * normalZ - p._relPos2Z * normalY; + j.ang2Y = p._relPos2Z * normalX - p._relPos2X * normalZ; + j.ang2Z = p._relPos2X * normalY - p._relPos2Y * normalX; + row.rhs = p._depth - oimo_common_Setting.linearSlop; + if(row.rhs < 0) { + row.rhs = 0; + } + row.impulse = p._impulse; + } + } + ,_syncManifold: function() { + this._manifold._updateDepthsAndPositions(this._tf1,this._tf2); + } + ,getShape1: function() { + return this._s1; + } + ,getShape2: function() { + return this._s2; + } + ,getManifold: function() { + return this._manifold; + } + ,isTouching: function() { + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) if(this._manifold._points[_g++]._depth >= 0) { + return true; + } + return false; + } + ,__class__: oimo_dynamics_constraint_contact_ContactConstraint +}; +var oimo_dynamics_constraint_contact_ContactImpulse = function() { + this.impulseN = 0; + this.impulseT = 0; + this.impulseB = 0; + this.impulseP = 0; + this.impulseLX = 0; + this.impulseLY = 0; + this.impulseLZ = 0; +}; +oimo_dynamics_constraint_contact_ContactImpulse.__name__ = true; +oimo_dynamics_constraint_contact_ContactImpulse.prototype = { + copyFrom: function(imp) { + this.impulseN = imp.impulseN; + this.impulseT = imp.impulseT; + this.impulseB = imp.impulseB; + this.impulseLX = imp.impulseLX; + this.impulseLY = imp.impulseLY; + this.impulseLZ = imp.impulseLZ; + } + ,__class__: oimo_dynamics_constraint_contact_ContactImpulse +}; +var oimo_dynamics_constraint_contact_Manifold = function() { + this._normalX = 0; + this._normalY = 0; + this._normalZ = 0; + this._tangentX = 0; + this._tangentY = 0; + this._tangentZ = 0; + this._binormalX = 0; + this._binormalY = 0; + this._binormalZ = 0; + this._numPoints = 0; + this._points = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this._points[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); +}; +oimo_dynamics_constraint_contact_Manifold.__name__ = true; +oimo_dynamics_constraint_contact_Manifold.prototype = { + _clear: function() { + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var _this = this._points[_g++]; + _this._localPos1X = 0; + _this._localPos1Y = 0; + _this._localPos1Z = 0; + _this._localPos2X = 0; + _this._localPos2Y = 0; + _this._localPos2Z = 0; + _this._relPos1X = 0; + _this._relPos1Y = 0; + _this._relPos1Z = 0; + _this._relPos2X = 0; + _this._relPos2Y = 0; + _this._relPos2Z = 0; + _this._pos1X = 0; + _this._pos1Y = 0; + _this._pos1Z = 0; + _this._pos2X = 0; + _this._pos2Y = 0; + _this._pos2Z = 0; + _this._depth = 0; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._warmStarted = false; + _this._disabled = false; + _this._id = -1; + } + this._numPoints = 0; + } + ,_buildBasis: function(normal) { + this._normalX = normal.x; + this._normalY = normal.y; + this._normalZ = normal.z; + var nx = normal.x; + var ny = normal.y; + var nz = normal.z; + var nx2 = nx * nx; + var ny2 = ny * ny; + var nz2 = nz * nz; + var tx; + var ty; + var tz; + var bx; + var by; + var bz; + if(nx2 < ny2) { + if(nx2 < nz2) { + var invL = 1 / Math.sqrt(ny2 + nz2); + tx = 0; + ty = -nz * invL; + tz = ny * invL; + bx = ny * tz - nz * ty; + by = -nx * tz; + bz = nx * ty; + } else { + var invL1 = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL1; + ty = nx * invL1; + tz = 0; + bx = -nz * ty; + by = nz * tx; + bz = nx * ty - ny * tx; + } + } else if(ny2 < nz2) { + var invL2 = 1 / Math.sqrt(nx2 + nz2); + tx = nz * invL2; + ty = 0; + tz = -nx * invL2; + bx = ny * tz; + by = nz * tx - nx * tz; + bz = -ny * tx; + } else { + var invL3 = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL3; + ty = nx * invL3; + tz = 0; + bx = -nz * ty; + by = nz * tx; + bz = nx * ty - ny * tx; + } + this._tangentX = tx; + this._tangentY = ty; + this._tangentZ = tz; + this._binormalX = bx; + this._binormalY = by; + this._binormalZ = bz; + } + ,_updateDepthsAndPositions: function(tf1,tf2) { + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var p = this._points[_g++]; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; + __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; + __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; + p._relPos1X = __tmp__X; + p._relPos1Y = __tmp__Y; + p._relPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; + __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; + __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; + p._relPos2X = __tmp__X1; + p._relPos2Y = __tmp__Y1; + p._relPos2Z = __tmp__Z1; + p._pos1X = p._relPos1X + tf1._positionX; + p._pos1Y = p._relPos1Y + tf1._positionY; + p._pos1Z = p._relPos1Z + tf1._positionZ; + p._pos2X = p._relPos2X + tf2._positionX; + p._pos2Y = p._relPos2Y + tf2._positionY; + p._pos2Z = p._relPos2Z + tf2._positionZ; + var diffX; + var diffY; + var diffZ; + diffX = p._pos1X - p._pos2X; + diffY = p._pos1Y - p._pos2Y; + diffZ = p._pos1Z - p._pos2Z; + p._depth = -(diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ); + } + } + ,getNormal: function() { + var v = new oimo_common_Vec3(); + v.x = this._normalX; + v.y = this._normalY; + v.z = this._normalZ; + return v; + } + ,getNormalTo: function(normal) { + normal.x = this._normalX; + normal.y = this._normalY; + normal.z = this._normalZ; + } + ,getTangent: function() { + var v = new oimo_common_Vec3(); + v.x = this._tangentX; + v.y = this._tangentY; + v.z = this._tangentZ; + return v; + } + ,getTangentTo: function(tangent) { + tangent.x = this._tangentX; + tangent.y = this._tangentY; + tangent.z = this._tangentZ; + } + ,getBinormal: function() { + var v = new oimo_common_Vec3(); + v.x = this._binormalX; + v.y = this._binormalY; + v.z = this._binormalZ; + return v; + } + ,getBinormalTo: function(binormal) { + binormal.x = this._binormalX; + binormal.y = this._binormalY; + binormal.z = this._binormalZ; + } + ,getPoints: function() { + return this._points; + } + ,getNumPoints: function() { + return this._numPoints; + } + ,__class__: oimo_dynamics_constraint_contact_Manifold +}; +var oimo_dynamics_constraint_contact_ManifoldPoint = function() { + this._localPos1X = 0; + this._localPos1Y = 0; + this._localPos1Z = 0; + this._localPos2X = 0; + this._localPos2Y = 0; + this._localPos2Z = 0; + this._relPos1X = 0; + this._relPos1Y = 0; + this._relPos1Z = 0; + this._relPos2X = 0; + this._relPos2Y = 0; + this._relPos2Z = 0; + this._pos1X = 0; + this._pos1Y = 0; + this._pos1Z = 0; + this._pos2X = 0; + this._pos2Y = 0; + this._pos2Z = 0; + this._depth = 0; + this._impulse = new oimo_dynamics_constraint_contact_ContactImpulse(); + this._warmStarted = false; + this._disabled = false; + this._id = -1; +}; +oimo_dynamics_constraint_contact_ManifoldPoint.__name__ = true; +oimo_dynamics_constraint_contact_ManifoldPoint.prototype = { + getPosition1: function() { + var v = new oimo_common_Vec3(); + v.x = this._pos1X; + v.y = this._pos1Y; + v.z = this._pos1Z; + return v; + } + ,getPosition1To: function(position) { + position.x = this._pos1X; + position.y = this._pos1Y; + position.z = this._pos1Z; + } + ,getPosition2: function() { + var v = new oimo_common_Vec3(); + v.x = this._pos2X; + v.y = this._pos2Y; + v.z = this._pos2Z; + return v; + } + ,getPosition2To: function(position) { + position.x = this._pos2X; + position.y = this._pos2Y; + position.z = this._pos2Z; + } + ,getDepth: function() { + return this._depth; + } + ,isWarmStarted: function() { + return this._warmStarted; + } + ,getNormalImpulse: function() { + return this._impulse.impulseN; + } + ,getTangentImpulse: function() { + return this._impulse.impulseT; + } + ,getBinormalImpulse: function() { + return this._impulse.impulseB; + } + ,isEnabled: function() { + return !this._disabled; + } + ,__class__: oimo_dynamics_constraint_contact_ManifoldPoint +}; +var oimo_dynamics_constraint_contact_ManifoldUpdater = function(manifold) { + this._manifold = manifold; + this.numOldPoints = 0; + this.oldPoints = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.oldPoints[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); +}; +oimo_dynamics_constraint_contact_ManifoldUpdater.__name__ = true; +oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { + removeOutdatedPoints: function() { + var index = this._manifold._numPoints; + while(--index >= 0) { + var p = this._manifold._points[index]; + var diffX; + var diffY; + var diffZ; + diffX = p._pos1X - p._pos2X; + diffY = p._pos1Y - p._pos2Y; + diffZ = p._pos1Z - p._pos2Z; + var dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; + if(dotN > oimo_common_Setting.contactPersistenceThreshold) { + this.removeManifoldPoint(index); + continue; + } + diffX += this._manifold._normalX * -dotN; + diffY += this._manifold._normalY * -dotN; + diffZ += this._manifold._normalZ * -dotN; + if(diffX * diffX + diffY * diffY + diffZ * diffZ > oimo_common_Setting.contactPersistenceThreshold * oimo_common_Setting.contactPersistenceThreshold) { + this.removeManifoldPoint(index); + continue; + } + } + } + ,removeManifoldPoint: function(index) { + var lastIndex = --this._manifold._numPoints; + if(index != lastIndex) { + var tmp = this._manifold._points[index]; + this._manifold._points[index] = this._manifold._points[lastIndex]; + this._manifold._points[lastIndex] = tmp; + } + var _this = this._manifold._points[lastIndex]; + _this._localPos1X = 0; + _this._localPos1Y = 0; + _this._localPos1Z = 0; + _this._localPos2X = 0; + _this._localPos2Y = 0; + _this._localPos2Z = 0; + _this._relPos1X = 0; + _this._relPos1Y = 0; + _this._relPos1Z = 0; + _this._relPos2X = 0; + _this._relPos2Y = 0; + _this._relPos2Z = 0; + _this._pos1X = 0; + _this._pos1Y = 0; + _this._pos1Z = 0; + _this._pos2X = 0; + _this._pos2Y = 0; + _this._pos2Z = 0; + _this._depth = 0; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._warmStarted = false; + _this._disabled = false; + _this._id = -1; + } + ,addManifoldPoint: function(point,tf1,tf2) { + var num = this._manifold._numPoints; + if(num == oimo_common_Setting.maxManifoldPoints) { + var _this = this._manifold._points[this.computeTargetIndex(point,tf1,tf2)]; + var v = point.position1; + _this._pos1X = v.x; + _this._pos1Y = v.y; + _this._pos1Z = v.z; + var v1 = point.position2; + _this._pos2X = v1.x; + _this._pos2Y = v1.y; + _this._pos2Z = v1.z; + _this._relPos1X = _this._pos1X - tf1._positionX; + _this._relPos1Y = _this._pos1Y - tf1._positionY; + _this._relPos1Z = _this._pos1Z - tf1._positionZ; + _this._relPos2X = _this._pos2X - tf2._positionX; + _this._relPos2Y = _this._pos2Y - tf2._positionY; + _this._relPos2Z = _this._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; + __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; + __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; + _this._localPos1X = __tmp__X; + _this._localPos1Y = __tmp__Y; + _this._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X1; + _this._localPos2Y = __tmp__Y1; + _this._localPos2Z = __tmp__Z1; + _this._depth = point.depth; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._id = point.id; + _this._warmStarted = false; + _this._disabled = false; + return; + } + var _this2 = this._manifold._points[num]; + var v2 = point.position1; + _this2._pos1X = v2.x; + _this2._pos1Y = v2.y; + _this2._pos1Z = v2.z; + var v3 = point.position2; + _this2._pos2X = v3.x; + _this2._pos2Y = v3.y; + _this2._pos2Z = v3.z; + _this2._relPos1X = _this2._pos1X - tf1._positionX; + _this2._relPos1Y = _this2._pos1Y - tf1._positionY; + _this2._relPos1Z = _this2._pos1Z - tf1._positionZ; + _this2._relPos2X = _this2._pos2X - tf2._positionX; + _this2._relPos2Y = _this2._pos2Y - tf2._positionY; + _this2._relPos2Z = _this2._pos2Z - tf2._positionZ; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * _this2._relPos1X + tf1._rotation10 * _this2._relPos1Y + tf1._rotation20 * _this2._relPos1Z; + __tmp__Y2 = tf1._rotation01 * _this2._relPos1X + tf1._rotation11 * _this2._relPos1Y + tf1._rotation21 * _this2._relPos1Z; + __tmp__Z2 = tf1._rotation02 * _this2._relPos1X + tf1._rotation12 * _this2._relPos1Y + tf1._rotation22 * _this2._relPos1Z; + _this2._localPos1X = __tmp__X2; + _this2._localPos1Y = __tmp__Y2; + _this2._localPos1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf2._rotation00 * _this2._relPos2X + tf2._rotation10 * _this2._relPos2Y + tf2._rotation20 * _this2._relPos2Z; + __tmp__Y3 = tf2._rotation01 * _this2._relPos2X + tf2._rotation11 * _this2._relPos2Y + tf2._rotation21 * _this2._relPos2Z; + __tmp__Z3 = tf2._rotation02 * _this2._relPos2X + tf2._rotation12 * _this2._relPos2Y + tf2._rotation22 * _this2._relPos2Z; + _this2._localPos2X = __tmp__X3; + _this2._localPos2Y = __tmp__Y3; + _this2._localPos2Z = __tmp__Z3; + _this2._depth = point.depth; + var _this3 = _this2._impulse; + _this3.impulseN = 0; + _this3.impulseT = 0; + _this3.impulseB = 0; + _this3.impulseP = 0; + _this3.impulseLX = 0; + _this3.impulseLY = 0; + _this3.impulseLZ = 0; + _this2._id = point.id; + _this2._warmStarted = false; + _this2._disabled = false; + this._manifold._numPoints++; + } + ,computeTargetIndex: function(newPoint,tf1,tf2) { + var p1 = this._manifold._points[0]; + var p2 = this._manifold._points[1]; + var p3 = this._manifold._points[2]; + var p4 = this._manifold._points[3]; + var maxDepth = p1._depth; + var maxDepthIndex = 0; + if(p2._depth > maxDepth) { + maxDepth = p2._depth; + maxDepthIndex = 1; + } + if(p3._depth > maxDepth) { + maxDepth = p3._depth; + maxDepthIndex = 2; + } + if(p4._depth > maxDepth) { + maxDepth = p4._depth; + maxDepthIndex = 3; + } + var rp1X; + var rp1Y; + var rp1Z; + var v = newPoint.position1; + rp1X = v.x; + rp1Y = v.y; + rp1Z = v.z; + rp1X -= tf1._positionX; + rp1Y -= tf1._positionY; + rp1Z -= tf1._positionZ; + var p1X = p2._relPos1X; + var p1Y = p2._relPos1Y; + var p1Z = p2._relPos1Z; + var p2X = p3._relPos1X; + var p2Y = p3._relPos1Y; + var p2Z = p3._relPos1Z; + var p3X = p4._relPos1X; + var p3Y = p4._relPos1Y; + var p3Z = p4._relPos1Z; + var v12X; + var v12Y; + var v12Z; + var v34X; + var v34Y; + var v34Z; + var v13X; + var v13Y; + var v13Z; + var v24X; + var v24Y; + var v24Z; + var v14X; + var v14Y; + var v14Z; + var v23X; + var v23Y; + var v23Z; + v12X = p2X - p1X; + v12Y = p2Y - p1Y; + v12Z = p2Z - p1Z; + v34X = rp1X - p3X; + v34Y = rp1Y - p3Y; + v34Z = rp1Z - p3Z; + v13X = p3X - p1X; + v13Y = p3Y - p1Y; + v13Z = p3Z - p1Z; + v24X = rp1X - p2X; + v24Y = rp1Y - p2Y; + v24Z = rp1Z - p2Z; + v14X = rp1X - p1X; + v14Y = rp1Y - p1Y; + v14Z = rp1Z - p1Z; + v23X = p3X - p2X; + v23Y = p3Y - p2Y; + v23Z = p3Z - p2Z; + var cross1X; + var cross1Y; + var cross1Z; + var cross2X; + var cross2Y; + var cross2Z; + var cross3X; + var cross3Y; + var cross3Z; + cross1X = v12Y * v34Z - v12Z * v34Y; + cross1Y = v12Z * v34X - v12X * v34Z; + cross1Z = v12X * v34Y - v12Y * v34X; + cross2X = v13Y * v24Z - v13Z * v24Y; + cross2Y = v13Z * v24X - v13X * v24Z; + cross2Z = v13X * v24Y - v13Y * v24X; + cross3X = v14Y * v23Z - v14Z * v23Y; + cross3Y = v14Z * v23X - v14X * v23Z; + cross3Z = v14X * v23Y - v14Y * v23X; + var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + var p1X1 = p1._relPos1X; + var p1Y1 = p1._relPos1Y; + var p1Z1 = p1._relPos1Z; + var p2X1 = p3._relPos1X; + var p2Y1 = p3._relPos1Y; + var p2Z1 = p3._relPos1Z; + var p3X1 = p4._relPos1X; + var p3Y1 = p4._relPos1Y; + var p3Z1 = p4._relPos1Z; + var v12X1; + var v12Y1; + var v12Z1; + var v34X1; + var v34Y1; + var v34Z1; + var v13X1; + var v13Y1; + var v13Z1; + var v24X1; + var v24Y1; + var v24Z1; + var v14X1; + var v14Y1; + var v14Z1; + var v23X1; + var v23Y1; + var v23Z1; + v12X1 = p2X1 - p1X1; + v12Y1 = p2Y1 - p1Y1; + v12Z1 = p2Z1 - p1Z1; + v34X1 = rp1X - p3X1; + v34Y1 = rp1Y - p3Y1; + v34Z1 = rp1Z - p3Z1; + v13X1 = p3X1 - p1X1; + v13Y1 = p3Y1 - p1Y1; + v13Z1 = p3Z1 - p1Z1; + v24X1 = rp1X - p2X1; + v24Y1 = rp1Y - p2Y1; + v24Z1 = rp1Z - p2Z1; + v14X1 = rp1X - p1X1; + v14Y1 = rp1Y - p1Y1; + v14Z1 = rp1Z - p1Z1; + v23X1 = p3X1 - p2X1; + v23Y1 = p3Y1 - p2Y1; + v23Z1 = p3Z1 - p2Z1; + var cross1X1; + var cross1Y1; + var cross1Z1; + var cross2X1; + var cross2Y1; + var cross2Z1; + var cross3X1; + var cross3Y1; + var cross3Z1; + cross1X1 = v12Y1 * v34Z1 - v12Z1 * v34Y1; + cross1Y1 = v12Z1 * v34X1 - v12X1 * v34Z1; + cross1Z1 = v12X1 * v34Y1 - v12Y1 * v34X1; + cross2X1 = v13Y1 * v24Z1 - v13Z1 * v24Y1; + cross2Y1 = v13Z1 * v24X1 - v13X1 * v24Z1; + cross2Z1 = v13X1 * v24Y1 - v13Y1 * v24X1; + cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; + cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; + cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; + var a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; + var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; + var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; + var a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; + var p1X2 = p1._relPos1X; + var p1Y2 = p1._relPos1Y; + var p1Z2 = p1._relPos1Z; + var p2X2 = p2._relPos1X; + var p2Y2 = p2._relPos1Y; + var p2Z2 = p2._relPos1Z; + var p3X2 = p4._relPos1X; + var p3Y2 = p4._relPos1Y; + var p3Z2 = p4._relPos1Z; + var v12X2; + var v12Y2; + var v12Z2; + var v34X2; + var v34Y2; + var v34Z2; + var v13X2; + var v13Y2; + var v13Z2; + var v24X2; + var v24Y2; + var v24Z2; + var v14X2; + var v14Y2; + var v14Z2; + var v23X2; + var v23Y2; + var v23Z2; + v12X2 = p2X2 - p1X2; + v12Y2 = p2Y2 - p1Y2; + v12Z2 = p2Z2 - p1Z2; + v34X2 = rp1X - p3X2; + v34Y2 = rp1Y - p3Y2; + v34Z2 = rp1Z - p3Z2; + v13X2 = p3X2 - p1X2; + v13Y2 = p3Y2 - p1Y2; + v13Z2 = p3Z2 - p1Z2; + v24X2 = rp1X - p2X2; + v24Y2 = rp1Y - p2Y2; + v24Z2 = rp1Z - p2Z2; + v14X2 = rp1X - p1X2; + v14Y2 = rp1Y - p1Y2; + v14Z2 = rp1Z - p1Z2; + v23X2 = p3X2 - p2X2; + v23Y2 = p3Y2 - p2Y2; + v23Z2 = p3Z2 - p2Z2; + var cross1X2; + var cross1Y2; + var cross1Z2; + var cross2X2; + var cross2Y2; + var cross2Z2; + var cross3X2; + var cross3Y2; + var cross3Z2; + cross1X2 = v12Y2 * v34Z2 - v12Z2 * v34Y2; + cross1Y2 = v12Z2 * v34X2 - v12X2 * v34Z2; + cross1Z2 = v12X2 * v34Y2 - v12Y2 * v34X2; + cross2X2 = v13Y2 * v24Z2 - v13Z2 * v24Y2; + cross2Y2 = v13Z2 * v24X2 - v13X2 * v24Z2; + cross2Z2 = v13X2 * v24Y2 - v13Y2 * v24X2; + cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; + cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; + cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; + var a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; + var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; + var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; + var a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; + var p1X3 = p1._relPos1X; + var p1Y3 = p1._relPos1Y; + var p1Z3 = p1._relPos1Z; + var p2X3 = p2._relPos1X; + var p2Y3 = p2._relPos1Y; + var p2Z3 = p2._relPos1Z; + var p3X3 = p3._relPos1X; + var p3Y3 = p3._relPos1Y; + var p3Z3 = p3._relPos1Z; + var v12X3; + var v12Y3; + var v12Z3; + var v34X3; + var v34Y3; + var v34Z3; + var v13X3; + var v13Y3; + var v13Z3; + var v24X3; + var v24Y3; + var v24Z3; + var v14X3; + var v14Y3; + var v14Z3; + var v23X3; + var v23Y3; + var v23Z3; + v12X3 = p2X3 - p1X3; + v12Y3 = p2Y3 - p1Y3; + v12Z3 = p2Z3 - p1Z3; + v34X3 = rp1X - p3X3; + v34Y3 = rp1Y - p3Y3; + v34Z3 = rp1Z - p3Z3; + v13X3 = p3X3 - p1X3; + v13Y3 = p3Y3 - p1Y3; + v13Z3 = p3Z3 - p1Z3; + v24X3 = rp1X - p2X3; + v24Y3 = rp1Y - p2Y3; + v24Z3 = rp1Z - p2Z3; + v14X3 = rp1X - p1X3; + v14Y3 = rp1Y - p1Y3; + v14Z3 = rp1Z - p1Z3; + v23X3 = p3X3 - p2X3; + v23Y3 = p3Y3 - p2Y3; + v23Z3 = p3Z3 - p2Z3; + var cross1X3; + var cross1Y3; + var cross1Z3; + var cross2X3; + var cross2Y3; + var cross2Z3; + var cross3X3; + var cross3Y3; + var cross3Z3; + cross1X3 = v12Y3 * v34Z3 - v12Z3 * v34Y3; + cross1Y3 = v12Z3 * v34X3 - v12X3 * v34Z3; + cross1Z3 = v12X3 * v34Y3 - v12Y3 * v34X3; + cross2X3 = v13Y3 * v24Z3 - v13Z3 * v24Y3; + cross2Y3 = v13Z3 * v24X3 - v13X3 * v24Z3; + cross2Z3 = v13X3 * v24Y3 - v13Y3 * v24X3; + cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; + cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; + cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; + var a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; + var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; + var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; + var a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; + var max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; + var target = 0; + if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { + max = a22; + target = 1; + } + if(a33 > max && maxDepthIndex != 2) { + max = a33; + target = 2; + } + if(a4 > max && maxDepthIndex != 3) { + max = a4; + target = 3; + } + return target; + } + ,computeRelativePositions: function(tf1,tf2) { + var num = this._manifold._numPoints; + var _g = 0; + while(_g < num) { + var p = this._manifold._points[_g++]; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; + __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; + __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; + p._relPos1X = __tmp__X; + p._relPos1Y = __tmp__Y; + p._relPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; + __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; + __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; + p._relPos2X = __tmp__X1; + p._relPos2Y = __tmp__Y1; + p._relPos2Z = __tmp__Z1; + p._warmStarted = true; + } + } + ,findNearestContactPointIndex: function(target,tf1,tf2) { + var nearestSq = oimo_common_Setting.contactPersistenceThreshold * oimo_common_Setting.contactPersistenceThreshold; + var idx = -1; + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) { + var i = _g++; + var mp = this._manifold._points[i]; + var rp1X; + var rp1Y; + var rp1Z; + var rp2X; + var rp2Y; + var rp2Z; + var v = target.position1; + rp1X = v.x; + rp1Y = v.y; + rp1Z = v.z; + var v1 = target.position2; + rp2X = v1.x; + rp2Y = v1.y; + rp2Z = v1.z; + rp1X -= tf1._positionX; + rp1Y -= tf1._positionY; + rp1Z -= tf1._positionZ; + rp2X -= tf2._positionX; + rp2Y -= tf2._positionY; + rp2Z -= tf2._positionZ; + var diff1X; + var diff1Y; + var diff1Z; + var diff2X; + var diff2Y; + var diff2Z; + diff1X = mp._relPos1X - rp1X; + diff1Y = mp._relPos1Y - rp1Y; + diff1Z = mp._relPos1Z - rp1Z; + diff2X = mp._relPos2X - rp2X; + diff2Y = mp._relPos2Y - rp2Y; + diff2Z = mp._relPos2Z - rp2Z; + var sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; + var sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; + var d = sq1 < sq2 ? sq1 : sq2; + if(d < nearestSq) { + nearestSq = d; + idx = i; + } + } + return idx; + } + ,totalUpdate: function(result,tf1,tf2) { + this.numOldPoints = this._manifold._numPoints; + var _g = 0; + var _g1 = this.numOldPoints; + while(_g < _g1) { + var i = _g++; + var _this = this.oldPoints[i]; + var cp = this._manifold._points[i]; + _this._localPos1X = cp._localPos1X; + _this._localPos1Y = cp._localPos1Y; + _this._localPos1Z = cp._localPos1Z; + _this._localPos2X = cp._localPos2X; + _this._localPos2Y = cp._localPos2Y; + _this._localPos2Z = cp._localPos2Z; + _this._relPos1X = cp._relPos1X; + _this._relPos1Y = cp._relPos1Y; + _this._relPos1Z = cp._relPos1Z; + _this._relPos2X = cp._relPos2X; + _this._relPos2Y = cp._relPos2Y; + _this._relPos2Z = cp._relPos2Z; + _this._pos1X = cp._pos1X; + _this._pos1Y = cp._pos1Y; + _this._pos1Z = cp._pos1Z; + _this._pos2X = cp._pos2X; + _this._pos2Y = cp._pos2Y; + _this._pos2Z = cp._pos2Z; + _this._depth = cp._depth; + _this._impulse.copyFrom(cp._impulse); + _this._id = cp._id; + _this._warmStarted = cp._warmStarted; + _this._disabled = false; + } + var num = result.numPoints; + this._manifold._numPoints = num; + var _g2 = 0; + while(_g2 < num) { + var i1 = _g2++; + var p = this._manifold._points[i1]; + var ref = result.points[i1]; + var v = ref.position1; + p._pos1X = v.x; + p._pos1Y = v.y; + p._pos1Z = v.z; + var v1 = ref.position2; + p._pos2X = v1.x; + p._pos2Y = v1.y; + p._pos2Z = v1.z; + p._relPos1X = p._pos1X - tf1._positionX; + p._relPos1Y = p._pos1Y - tf1._positionY; + p._relPos1Z = p._pos1Z - tf1._positionZ; + p._relPos2X = p._pos2X - tf2._positionX; + p._relPos2Y = p._pos2Y - tf2._positionY; + p._relPos2Z = p._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._relPos1X + tf1._rotation10 * p._relPos1Y + tf1._rotation20 * p._relPos1Z; + __tmp__Y = tf1._rotation01 * p._relPos1X + tf1._rotation11 * p._relPos1Y + tf1._rotation21 * p._relPos1Z; + __tmp__Z = tf1._rotation02 * p._relPos1X + tf1._rotation12 * p._relPos1Y + tf1._rotation22 * p._relPos1Z; + p._localPos1X = __tmp__X; + p._localPos1Y = __tmp__Y; + p._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._relPos2X + tf2._rotation10 * p._relPos2Y + tf2._rotation20 * p._relPos2Z; + __tmp__Y1 = tf2._rotation01 * p._relPos2X + tf2._rotation11 * p._relPos2Y + tf2._rotation21 * p._relPos2Z; + __tmp__Z1 = tf2._rotation02 * p._relPos2X + tf2._rotation12 * p._relPos2Y + tf2._rotation22 * p._relPos2Z; + p._localPos2X = __tmp__X1; + p._localPos2Y = __tmp__Y1; + p._localPos2Z = __tmp__Z1; + p._depth = ref.depth; + var _this1 = p._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + p._id = ref.id; + p._warmStarted = false; + p._disabled = false; + var _g3 = 0; + var _g11 = this.numOldPoints; + while(_g3 < _g11) { + var ocp = this.oldPoints[_g3++]; + if(p._id == ocp._id) { + p._impulse.copyFrom(ocp._impulse); + p._warmStarted = true; + break; + } + } + } + } + ,incrementalUpdate: function(result,tf1,tf2) { + this._manifold._updateDepthsAndPositions(tf1,tf2); + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) this._manifold._points[_g++]._warmStarted = true; + var newPoint = result.points[0]; + var index = this.findNearestContactPointIndex(newPoint,tf1,tf2); + if(index == -1) { + this.addManifoldPoint(newPoint,tf1,tf2); + } else { + var cp = this._manifold._points[index]; + var v = newPoint.position1; + cp._pos1X = v.x; + cp._pos1Y = v.y; + cp._pos1Z = v.z; + var v1 = newPoint.position2; + cp._pos2X = v1.x; + cp._pos2Y = v1.y; + cp._pos2Z = v1.z; + cp._relPos1X = cp._pos1X - tf1._positionX; + cp._relPos1Y = cp._pos1Y - tf1._positionY; + cp._relPos1Z = cp._pos1Z - tf1._positionZ; + cp._relPos2X = cp._pos2X - tf2._positionX; + cp._relPos2Y = cp._pos2Y - tf2._positionY; + cp._relPos2Z = cp._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * cp._relPos1X + tf1._rotation10 * cp._relPos1Y + tf1._rotation20 * cp._relPos1Z; + __tmp__Y = tf1._rotation01 * cp._relPos1X + tf1._rotation11 * cp._relPos1Y + tf1._rotation21 * cp._relPos1Z; + __tmp__Z = tf1._rotation02 * cp._relPos1X + tf1._rotation12 * cp._relPos1Y + tf1._rotation22 * cp._relPos1Z; + cp._localPos1X = __tmp__X; + cp._localPos1Y = __tmp__Y; + cp._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; + __tmp__Y1 = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; + __tmp__Z1 = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; + cp._localPos2X = __tmp__X1; + cp._localPos2Y = __tmp__Y1; + cp._localPos2Z = __tmp__Z1; + cp._depth = newPoint.depth; + } + this.removeOutdatedPoints(); + } + ,__class__: oimo_dynamics_constraint_contact_ManifoldUpdater +}; +var oimo_dynamics_constraint_info_JacobianRow = function() { + this.lin1X = 0; + this.lin1Y = 0; + this.lin1Z = 0; + this.lin2X = 0; + this.lin2Y = 0; + this.lin2Z = 0; + this.ang1X = 0; + this.ang1Y = 0; + this.ang1Z = 0; + this.ang2X = 0; + this.ang2Y = 0; + this.ang2Z = 0; + this.flag = 0; +}; +oimo_dynamics_constraint_info_JacobianRow.__name__ = true; +oimo_dynamics_constraint_info_JacobianRow.prototype = { + updateSparsity: function() { + this.flag = 0; + if(!(this.lin1X == 0 && this.lin1Y == 0 && this.lin1Z == 0) || !(this.lin2X == 0 && this.lin2Y == 0 && this.lin2Z == 0)) { + this.flag |= 1; + } + if(!(this.ang1X == 0 && this.ang1Y == 0 && this.ang1Z == 0) || !(this.ang2X == 0 && this.ang2Y == 0 && this.ang2Z == 0)) { + this.flag |= 2; + } + } + ,__class__: oimo_dynamics_constraint_info_JacobianRow +}; +var oimo_dynamics_constraint_info_contact_ContactSolverInfo = function() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + this.rows = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_contact_ContactSolverInfoRow(); +}; +oimo_dynamics_constraint_info_contact_ContactSolverInfo.__name__ = true; +oimo_dynamics_constraint_info_contact_ContactSolverInfo.prototype = { + __class__: oimo_dynamics_constraint_info_contact_ContactSolverInfo +}; +var oimo_dynamics_constraint_info_contact_ContactSolverInfoRow = function() { + this.jacobianN = new oimo_dynamics_constraint_info_JacobianRow(); + this.jacobianT = new oimo_dynamics_constraint_info_JacobianRow(); + this.jacobianB = new oimo_dynamics_constraint_info_JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.friction = 0; + this.impulse = null; +}; +oimo_dynamics_constraint_info_contact_ContactSolverInfoRow.__name__ = true; +oimo_dynamics_constraint_info_contact_ContactSolverInfoRow.prototype = { + __class__: oimo_dynamics_constraint_info_contact_ContactSolverInfoRow +}; +var oimo_dynamics_constraint_info_joint_JointSolverInfo = function() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + this.rows = new Array(oimo_common_Setting.maxJacobianRows); + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_joint_JointSolverInfoRow(); +}; +oimo_dynamics_constraint_info_joint_JointSolverInfo.__name__ = true; +oimo_dynamics_constraint_info_joint_JointSolverInfo.prototype = { + __class__: oimo_dynamics_constraint_info_joint_JointSolverInfo +}; +var oimo_dynamics_constraint_info_joint_JointSolverInfoRow = function() { + this.jacobian = new oimo_dynamics_constraint_info_JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.minImpulse = 0; + this.maxImpulse = 0; + this.motorSpeed = 0; + this.motorMaxImpulse = 0; + this.impulse = null; +}; +oimo_dynamics_constraint_info_joint_JointSolverInfoRow.__name__ = true; +oimo_dynamics_constraint_info_joint_JointSolverInfoRow.prototype = { + __class__: oimo_dynamics_constraint_info_joint_JointSolverInfoRow +}; +var oimo_dynamics_constraint_joint_BasisTracker = function(joint) { + this.joint = joint; + this.xX = 0; + this.xY = 0; + this.xZ = 0; + this.yX = 0; + this.yY = 0; + this.yZ = 0; + this.zX = 0; + this.zY = 0; + this.zZ = 0; +}; +oimo_dynamics_constraint_joint_BasisTracker.__name__ = true; +oimo_dynamics_constraint_joint_BasisTracker.prototype = { + __class__: oimo_dynamics_constraint_joint_BasisTracker +}; +var oimo_dynamics_constraint_joint_Joint = function(config,type) { + this._link1 = new oimo_dynamics_constraint_joint_JointLink(this); + this._link2 = new oimo_dynamics_constraint_joint_JointLink(this); + this._positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; + this._type = type; + this._world = null; + this._b1 = config.rigidBody1; + this._b2 = config.rigidBody2; + this._allowCollision = config.allowCollision; + this._breakForce = config.breakForce; + this._breakTorque = config.breakTorque; + switch(config.solverType) { + case 0: + this._solver = new oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver(this); + break; + case 1: + this._solver = new oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver(this); + break; + } + var v = config.localAnchor1; + this._localAnchor1X = v.x; + this._localAnchor1Y = v.y; + this._localAnchor1Z = v.z; + var v1 = config.localAnchor2; + this._localAnchor2X = v1.x; + this._localAnchor2Y = v1.y; + this._localAnchor2Z = v1.z; + this._relativeAnchor1X = 0; + this._relativeAnchor1Y = 0; + this._relativeAnchor1Z = 0; + this._relativeAnchor2X = 0; + this._relativeAnchor2Y = 0; + this._relativeAnchor2Z = 0; + this._anchor1X = 0; + this._anchor1Y = 0; + this._anchor1Z = 0; + this._anchor2X = 0; + this._anchor2Y = 0; + this._anchor2Z = 0; + this._localBasisX1X = 0; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + this._localBasisY1X = 0; + this._localBasisY1Y = 0; + this._localBasisY1Z = 0; + this._localBasisZ1X = 0; + this._localBasisZ1Y = 0; + this._localBasisZ1Z = 0; + this._localBasisX2X = 0; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + this._localBasisY2X = 0; + this._localBasisY2Y = 0; + this._localBasisY2Z = 0; + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 0; + this._impulses = new Array(oimo_common_Setting.maxJacobianRows); + var _g1 = 0; + var _g2 = oimo_common_Setting.maxJacobianRows; + while(_g1 < _g2) this._impulses[_g1++] = new oimo_dynamics_constraint_joint_JointImpulse(); +}; +oimo_dynamics_constraint_joint_Joint.__name__ = true; +oimo_dynamics_constraint_joint_Joint.prototype = { + buildLocalBasesFromX: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d2; + if(x22 < y22) { + if(x22 < z22) { + d2 = 1 / Math.sqrt(y22 + z22); + this._localBasisY1X = 0; + this._localBasisY1Y = z11 * d2; + this._localBasisY1Z = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + } else if(y22 < z22) { + d2 = 1 / Math.sqrt(z22 + x22); + this._localBasisY1X = -z11 * d2; + this._localBasisY1Y = 0; + this._localBasisY1Z = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + ,buildLocalBasesFromXY: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._localBasisZ1X *= l2; + this._localBasisZ1Y *= l2; + this._localBasisZ1Z *= l2; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + var x11 = this._localBasisX2X; + var y11 = this._localBasisX2Y; + var z11 = this._localBasisX2Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d1; + if(x21 < y21) { + if(x21 < z21) { + d1 = 1 / Math.sqrt(y21 + z21); + this._localBasisY2X = 0; + this._localBasisY2Y = z11 * d1; + this._localBasisY2Z = -y11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + } else if(y21 < z21) { + d1 = 1 / Math.sqrt(z21 + x21); + this._localBasisY2X = -z11 * d1; + this._localBasisY2Y = 0; + this._localBasisY2Z = x11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + } else { + var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + this._localBasisZ2X *= l3; + this._localBasisZ2Y *= l3; + this._localBasisZ2Z *= l3; + this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; + this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; + this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; + } + } + ,buildLocalBasesFromX1Z2: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 1; + } else { + var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ2X *= l1; + this._localBasisZ2Y *= l1; + this._localBasisZ2Z *= l1; + } + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var worldX1X; + var worldX1Y; + var worldX1Z; + var worldZ1X; + var worldZ1Y; + var worldZ1Z; + var worldYX; + var worldYY; + var worldYZ; + var worldX2X; + var worldX2Y; + var worldX2Z; + var worldZ2X; + var worldZ2Y; + var worldZ2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + worldX1X = __tmp__X; + worldX1Y = __tmp__Y; + worldX1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + worldZ2X = __tmp__X1; + worldZ2Y = __tmp__Y1; + worldZ2Z = __tmp__Z1; + worldYX = worldZ2Y * worldX1Z - worldZ2Z * worldX1Y; + worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; + worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; + if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { + var x1 = worldX1X; + var y1 = worldX1Y; + var z1 = worldX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + worldYX = 0; + worldYY = z1 * d; + worldYZ = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + worldYX = -z1 * d; + worldYY = 0; + worldYZ = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } + worldZ1X = worldX1Y * worldYZ - worldX1Z * worldYY; + worldZ1Y = worldX1Z * worldYX - worldX1X * worldYZ; + worldZ1Z = worldX1X * worldYY - worldX1Y * worldYX; + worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; + worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; + worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; + __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; + __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; + this._localBasisX1X = __tmp__X2; + this._localBasisX1Y = __tmp__Y2; + this._localBasisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; + __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; + __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; + this._localBasisY1X = __tmp__X3; + this._localBasisY1Y = __tmp__Y3; + this._localBasisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; + __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; + __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; + this._localBasisZ1X = __tmp__X4; + this._localBasisZ1Y = __tmp__Y4; + this._localBasisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; + __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; + __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; + this._localBasisX2X = __tmp__X5; + this._localBasisX2Y = __tmp__Y5; + this._localBasisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; + __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; + __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; + this._localBasisY2X = __tmp__X6; + this._localBasisY2Y = __tmp__Y6; + this._localBasisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; + __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; + __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; + this._localBasisZ2X = __tmp__X7; + this._localBasisZ2Y = __tmp__Y7; + this._localBasisZ2Z = __tmp__Z7; + } + ,buildLocalBasesFromXY1X2: function() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ1X *= l1; + this._localBasisZ1Y *= l1; + this._localBasisZ1Z *= l1; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d1 < -0.999999999) { + var vX; + var vY; + var vZ; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d2; + if(x21 < y21) { + if(x21 < z21) { + d2 = 1 / Math.sqrt(y21 + z21); + vX = 0; + vY = z11 * d2; + vZ = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + } else if(y21 < z21) { + d2 = 1 / Math.sqrt(z21 + x21); + vX = -z11 * d2; + vY = 0; + vZ = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d1) * 0.5); + d1 = 0.5 / w; + cX *= d1; + cY *= d1; + cZ *= d1; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x22 = 2 * x; + var y22 = 2 * y; + var z22 = 2 * z; + var xx = x * x22; + var yy = y * y22; + var zz = z * z22; + var xy = x * y22; + var yz = y * z22; + var xz = x * z22; + var wx = w1 * x22; + var wy = w1 * y22; + var wz = w1 * z22; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + ,setSolverInfoRowLinear: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo_common_Setting.linearSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { + zeta = oimo_common_Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorForce > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorForce * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); + row.rhs = error * erp; + } + ,setSolverInfoRowAngular: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo_common_Setting.angularSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { + zeta = oimo_common_Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorTorque > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorTorque * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var mid = (lower + upper) * 0.5; + diff -= mid; + diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; + diff += mid; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); + row.rhs = error * erp; + } + ,getErp: function(timeStep,isPositionPart) { + if(isPositionPart) { + return 1; + } else if(this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE) { + return timeStep.invDt * oimo_common_Setting.velocityBaumgarte; + } else { + return 0; + } + } + ,computeEffectiveInertiaMoment: function(axisX,axisY,axisZ) { + var ia1X; + var ia1Y; + var ia1Z; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; + __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; + __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; + __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; + __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; + var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; + if(invI1 > 0) { + var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; + var projsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + var projsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + ,computeEffectiveInertiaMoment2: function(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { + var ia1X; + var ia1Y; + var ia1Z; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axis1X + this._b1._invInertia01 * axis1Y + this._b1._invInertia02 * axis1Z; + __tmp__Y = this._b1._invInertia10 * axis1X + this._b1._invInertia11 * axis1Y + this._b1._invInertia12 * axis1Z; + __tmp__Z = this._b1._invInertia20 * axis1X + this._b1._invInertia21 * axis1Y + this._b1._invInertia22 * axis1Z; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; + __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; + __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; + var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; + if(invI1 > 0) { + var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + var dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; + var projsq = rsq * rsq - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + var projsq1 = rsq1 * rsq1 - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + ,_syncAnchors: function() { + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; + __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; + __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; + this._relativeAnchor1X = __tmp__X; + this._relativeAnchor1Y = __tmp__Y; + this._relativeAnchor1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; + __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; + __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; + this._relativeAnchor2X = __tmp__X1; + this._relativeAnchor2Y = __tmp__Y1; + this._relativeAnchor2Z = __tmp__Z1; + this._anchor1X = this._relativeAnchor1X + tf1._positionX; + this._anchor1Y = this._relativeAnchor1Y + tf1._positionY; + this._anchor1Z = this._relativeAnchor1Z + tf1._positionZ; + this._anchor2X = this._relativeAnchor2X + tf2._positionX; + this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; + this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + this._basisX1X = __tmp__X2; + this._basisX1Y = __tmp__Y2; + this._basisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; + __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; + __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; + this._basisY1X = __tmp__X3; + this._basisY1Y = __tmp__Y3; + this._basisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; + __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; + __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; + this._basisZ1X = __tmp__X4; + this._basisZ1Y = __tmp__Y4; + this._basisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; + __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; + __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; + this._basisX2X = __tmp__X5; + this._basisX2Y = __tmp__Y5; + this._basisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; + __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; + __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; + this._basisY2X = __tmp__X6; + this._basisY2Y = __tmp__Y6; + this._basisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + this._basisZ2X = __tmp__X7; + this._basisZ2Y = __tmp__Y7; + this._basisZ2Z = __tmp__Z7; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + ,_getPositionSolverInfo: function(info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + ,_checkDestruction: function() { + var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; + if(this._breakForce > 0 && this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ > this._breakForce * this._breakForce) { + this._world.removeJoint(this); + return; + } + if(this._breakTorque > 0 && torqueSq > this._breakTorque * this._breakTorque) { + this._world.removeJoint(this); + return; + } + } + ,getRigidBody1: function() { + return this._b1; + } + ,getRigidBody2: function() { + return this._b2; + } + ,getType: function() { + return this._type; + } + ,getAnchor1: function() { + var v = new oimo_common_Vec3(); + v.x = this._anchor1X; + v.y = this._anchor1Y; + v.z = this._anchor1Z; + return v; + } + ,getAnchor2: function() { + var v = new oimo_common_Vec3(); + v.x = this._anchor2X; + v.y = this._anchor2Y; + v.z = this._anchor2Z; + return v; + } + ,getAnchor1To: function(anchor) { + anchor.x = this._anchor1X; + anchor.y = this._anchor1Y; + anchor.z = this._anchor1Z; + } + ,getAnchor2To: function(anchor) { + anchor.x = this._anchor2X; + anchor.y = this._anchor2Y; + anchor.z = this._anchor2Z; + } + ,getLocalAnchor1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localAnchor1X; + v.y = this._localAnchor1Y; + v.z = this._localAnchor1Z; + return v; + } + ,getLocalAnchor2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localAnchor2X; + v.y = this._localAnchor2Y; + v.z = this._localAnchor2Z; + return v; + } + ,getLocalAnchor1To: function(localAnchor) { + localAnchor.x = this._localAnchor1X; + localAnchor.y = this._localAnchor1Y; + localAnchor.z = this._localAnchor1Z; + } + ,getLocalAnchor2To: function(localAnchor) { + localAnchor.x = this._localAnchor2X; + localAnchor.y = this._localAnchor2Y; + localAnchor.z = this._localAnchor2Z; + } + ,getBasis1: function() { + var m = new oimo_common_Mat3(); + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX1X; + b01 = this._basisY1X; + b02 = this._basisZ1X; + b10 = this._basisX1Y; + b11 = this._basisY1Y; + b12 = this._basisZ1Y; + b20 = this._basisX1Z; + b21 = this._basisY1Z; + b22 = this._basisZ1Z; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; + return m; + } + ,getBasis2: function() { + var m = new oimo_common_Mat3(); + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX2X; + b01 = this._basisY2X; + b02 = this._basisZ2X; + b10 = this._basisX2Y; + b11 = this._basisY2Y; + b12 = this._basisZ2Y; + b20 = this._basisX2Z; + b21 = this._basisY2Z; + b22 = this._basisZ2Z; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; + return m; + } + ,getBasis1To: function(basis) { + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX1X; + b01 = this._basisY1X; + b02 = this._basisZ1X; + b10 = this._basisX1Y; + b11 = this._basisY1Y; + b12 = this._basisZ1Y; + b20 = this._basisX1Z; + b21 = this._basisY1Z; + b22 = this._basisZ1Z; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; + } + ,getBasis2To: function(basis) { + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX2X; + b01 = this._basisY2X; + b02 = this._basisZ2X; + b10 = this._basisX2Y; + b11 = this._basisY2Y; + b12 = this._basisZ2Y; + b20 = this._basisX2Z; + b21 = this._basisY2Z; + b22 = this._basisZ2Z; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; + } + ,getAllowCollision: function() { + return this._allowCollision; + } + ,setAllowCollision: function(allowCollision) { + this._allowCollision = allowCollision; + } + ,getBreakForce: function() { + return this._breakForce; + } + ,setBreakForce: function(breakForce) { + this._breakForce = breakForce; + } + ,getBreakTorque: function() { + return this._breakTorque; + } + ,setBreakTorque: function(breakTorque) { + this._breakTorque = breakTorque; + } + ,getPositionCorrectionAlgorithm: function() { + return this._positionCorrectionAlgorithm; + } + ,setPositionCorrectionAlgorithm: function(positionCorrectionAlgorithm) { + switch(positionCorrectionAlgorithm) { + case 0:case 1:case 2: + break; + default: + throw new Error("invalid position correction algorithm id: " + positionCorrectionAlgorithm); + } + this._positionCorrectionAlgorithm = positionCorrectionAlgorithm; + } + ,getAppliedForce: function() { + var v = new oimo_common_Vec3(); + v.x = this._appliedForceX; + v.y = this._appliedForceY; + v.z = this._appliedForceZ; + return v; + } + ,getAppliedForceTo: function(appliedForce) { + appliedForce.x = this._appliedForceX; + appliedForce.y = this._appliedForceY; + appliedForce.z = this._appliedForceZ; + } + ,getAppliedTorque: function() { + var v = new oimo_common_Vec3(); + v.x = this._appliedTorqueX; + v.y = this._appliedTorqueY; + v.z = this._appliedTorqueZ; + return v; + } + ,getAppliedTorqueTo: function(appliedTorque) { + appliedTorque.x = this._appliedTorqueX; + appliedTorque.y = this._appliedTorqueY; + appliedTorque.z = this._appliedTorqueZ; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_constraint_joint_Joint +}; +var oimo_dynamics_constraint_joint_CylindricalJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,2); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this._translSd = config.translationalSpringDamper.clone(); + this._translLm = config.translationalLimitMotor.clone(); + this._rotSd = config.rotationalSpringDamper.clone(); + this._rotLm = config.rotationalLimitMotor.clone(); +}; +oimo_dynamics_constraint_joint_CylindricalJoint.__name__ = true; +oimo_dynamics_constraint_joint_CylindricalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linRhsY = this.linearErrorY * erp; + var linRhsZ = this.linearErrorZ * erp; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var j; + var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + if(this._translSd.frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translation,this._translLm,1 / (this._b1._invMass + this._b2._invMass),this._translSd,timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basis.xX; + j.lin1Y = this._basis.xY; + j.lin1Z = this._basis.xZ; + j.lin2X = this._basis.xX; + j.lin2Y = this._basis.xY; + j.lin2Z = this._basis.xZ; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; + } + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + if(this._rotSd.frequency <= 0 || !isPositionPart) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this._basis.xX; + j.ang1Y = this._basis.xY; + j.ang1Z = this._basis.xZ; + j.ang2X = this._basis.xX; + j.ang2Y = this._basis.xY; + j.ang2Z = this._basis.xZ; + } + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; + j.ang1X = this._basis.zX; + j.ang1Y = this._basis.zY; + j.ang1Z = this._basis.zZ; + j.ang2X = this._basis.zX; + j.ang2Y = this._basis.zY; + j.ang2Z = this._basis.zZ; + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var qX; + var qY; + var qZ; + var qW; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newXX; + var newXY; + var newXZ; + var newYX; + var newYY; + var newYZ; + var newZX; + var newZY; + var newZZ; + var prevXX; + var prevXY; + var prevXZ; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var angErrorX; + var angErrorY; + var angErrorZ; + angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; + angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; + angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; + var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + angErrorX *= l3; + angErrorY *= l3; + angErrorZ *= l3; + angErrorX *= theta1; + angErrorY *= theta1; + angErrorZ *= theta1; + this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; + this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; + var perpCrossX; + var perpCrossY; + var perpCrossZ; + perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; + perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; + perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; + cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { + this.angle = -this.angle; + } + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; + this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; + this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; + } + ,getTranslationalSpringDamper: function() { + return this._translSd; + } + ,getRotationalSpringDamper: function() { + return this._rotSd; + } + ,getTranslationalLimitMotor: function() { + return this._translLm; + } + ,getRotationalLimitMotor: function() { + return this._rotLm; + } + ,getAngle: function() { + return this.angle; + } + ,getTranslation: function() { + return this.translation; + } + ,__class__: oimo_dynamics_constraint_joint_CylindricalJoint +}); +var oimo_dynamics_constraint_joint_JointConfig = function() { + this.rigidBody1 = null; + this.rigidBody2 = null; + this.localAnchor1 = new oimo_common_Vec3(); + this.localAnchor2 = new oimo_common_Vec3(); + this.allowCollision = false; + this.solverType = oimo_common_Setting.defaultJointConstraintSolverType; + this.positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; + this.breakForce = 0; + this.breakTorque = 0; +}; +oimo_dynamics_constraint_joint_JointConfig.__name__ = true; +oimo_dynamics_constraint_joint_JointConfig.prototype = { + _init: function(rb1,rb2,worldAnchor) { + this.rigidBody1 = rb1; + this.rigidBody2 = rb2; + var _this = this.rigidBody1; + var localPoint = this.localAnchor1; + var vX; + var vY; + var vZ; + vX = worldAnchor.x; + vY = worldAnchor.y; + vZ = worldAnchor.z; + vX -= _this._transform._positionX; + vY -= _this._transform._positionY; + vZ -= _this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; + __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; + __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; + var _this1 = this.rigidBody2; + var localPoint1 = this.localAnchor2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAnchor.x; + vY1 = worldAnchor.y; + vZ1 = worldAnchor.z; + vX1 -= _this1._transform._positionX; + vY1 -= _this1._transform._positionY; + vZ1 -= _this1._transform._positionZ; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; + __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; + __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localPoint1.x = vX1; + localPoint1.y = vY1; + localPoint1.z = vZ1; + } + ,__class__: oimo_dynamics_constraint_joint_JointConfig +}; +var oimo_dynamics_constraint_joint_CylindricalJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.translationalLimitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + this.translationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.rotationalLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.rotationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); +}; +oimo_dynamics_constraint_joint_CylindricalJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_CylindricalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localAxis1; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_CylindricalJointConfig +}); +var oimo_dynamics_constraint_joint_GenericJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.GENERIC); + var tmp; + var _this = config.localBasis1; + if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { + var _this1 = config.localBasis2; + tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; + } else { + tmp = true; + } + if(tmp) { + console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:50:","[warning] joint basis must be right handed"); + } + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + var m = config.localBasis1; + lb100 = m.e00; + lb101 = m.e01; + lb102 = m.e02; + lb110 = m.e10; + lb111 = m.e11; + lb112 = m.e12; + lb120 = m.e20; + lb121 = m.e21; + lb122 = m.e22; + var m1 = config.localBasis2; + lb200 = m1.e00; + lb201 = m1.e01; + lb202 = m1.e02; + lb210 = m1.e10; + lb211 = m1.e11; + lb212 = m1.e12; + lb220 = m1.e20; + lb221 = m1.e21; + lb222 = m1.e22; + this._localBasisX1X = lb100; + this._localBasisX1Y = lb110; + this._localBasisX1Z = lb120; + this._localBasisY1X = lb101; + this._localBasisY1Y = lb111; + this._localBasisY1Z = lb121; + this._localBasisZ1X = lb102; + this._localBasisZ1Y = lb112; + this._localBasisZ1Z = lb122; + this._localBasisX2X = lb200; + this._localBasisX2Y = lb210; + this._localBasisX2Z = lb220; + this._localBasisY2X = lb201; + this._localBasisY2Y = lb211; + this._localBasisY2Z = lb221; + this._localBasisZ2X = lb202; + this._localBasisZ2Y = lb212; + this._localBasisZ2Z = lb222; + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.translationX = 0; + this.translationY = 0; + this.translationZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._translLms = new Array(3); + this._translSds = new Array(3); + this._rotLms = new Array(3); + this._rotSds = new Array(3); + this._translLms[0] = config.translationalLimitMotors[0].clone(); + this._translLms[1] = config.translationalLimitMotors[1].clone(); + this._translLms[2] = config.translationalLimitMotors[2].clone(); + this._translSds[0] = config.translationalSpringDampers[0].clone(); + this._translSds[1] = config.translationalSpringDampers[1].clone(); + this._translSds[2] = config.translationalSpringDampers[2].clone(); + this._rotLms[0] = config.rotationalLimitMotors[0].clone(); + this._rotLms[1] = config.rotationalLimitMotors[1].clone(); + this._rotLms[2] = config.rotationalLimitMotors[2].clone(); + this._rotSds[0] = config.rotationalSpringDampers[0].clone(); + this._rotSds[1] = config.rotationalSpringDampers[1].clone(); + this._rotSds[2] = config.rotationalSpringDampers[2].clone(); +}; +oimo_dynamics_constraint_joint_GenericJoint.__name__ = true; +oimo_dynamics_constraint_joint_GenericJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var j; + var translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + if(this._translSds[0].frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationX,this._translLms[0],translMotorMass,this._translSds[0],timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basisX1X; + j.lin1Y = this._basisX1Y; + j.lin1Z = this._basisX1Z; + j.lin2X = this._basisX1X; + j.lin2Y = this._basisX1Y; + j.lin2Z = this._basisX1Z; + j.ang1X = this._relativeAnchor1Y * this._basisX1Z - this._relativeAnchor1Z * this._basisX1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisX1X - this._relativeAnchor1X * this._basisX1Z; + j.ang1Z = this._relativeAnchor1X * this._basisX1Y - this._relativeAnchor1Y * this._basisX1X; + j.ang2X = this._relativeAnchor2Y * this._basisX1Z - this._relativeAnchor2Z * this._basisX1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisX1X - this._relativeAnchor2X * this._basisX1Z; + j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; + } + if(this._translSds[1].frequency <= 0 || !isPositionPart) { + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + this.setSolverInfoRowLinear(row1,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); + j = row1.jacobian; + j.lin1X = this._basisY1X; + j.lin1Y = this._basisY1Y; + j.lin1Z = this._basisY1Z; + j.lin2X = this._basisY1X; + j.lin2Y = this._basisY1Y; + j.lin2Z = this._basisY1Z; + j.ang1X = this._relativeAnchor1Y * this._basisY1Z - this._relativeAnchor1Z * this._basisY1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisY1X - this._relativeAnchor1X * this._basisY1Z; + j.ang1Z = this._relativeAnchor1X * this._basisY1Y - this._relativeAnchor1Y * this._basisY1X; + j.ang2X = this._relativeAnchor2Y * this._basisY1Z - this._relativeAnchor2Z * this._basisY1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisY1X - this._relativeAnchor2X * this._basisY1Z; + j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; + } + if(this._translSds[2].frequency <= 0 || !isPositionPart) { + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + this.setSolverInfoRowLinear(row2,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); + j = row2.jacobian; + j.lin1X = this._basisZ1X; + j.lin1Y = this._basisZ1Y; + j.lin1Z = this._basisZ1Z; + j.lin2X = this._basisZ1X; + j.lin2Y = this._basisZ1Y; + j.lin2Z = this._basisZ1Z; + j.ang1X = this._relativeAnchor1Y * this._basisZ1Z - this._relativeAnchor1Z * this._basisZ1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisZ1X - this._relativeAnchor1X * this._basisZ1Z; + j.ang1Z = this._relativeAnchor1X * this._basisZ1Y - this._relativeAnchor1Y * this._basisZ1X; + j.ang2X = this._relativeAnchor2Y * this._basisZ1Z - this._relativeAnchor2Z * this._basisZ1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisZ1X - this._relativeAnchor2X * this._basisZ1Z; + j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; + } + if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this._axisXX; + j.ang1Y = this._axisXY; + j.ang1Z = this._axisXZ; + j.ang2X = this._axisXX; + j.ang2Y = this._axisXY; + j.ang2Z = this._axisXZ; + } + if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + this.setSolverInfoRowAngular(row4,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); + j = row4.jacobian; + j.ang1X = this._axisYX; + j.ang1Y = this._axisYY; + j.ang1Z = this._axisYZ; + j.ang2X = this._axisYX; + j.ang2Y = this._axisYY; + j.ang2Z = this._axisYZ; + } + if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + this.setSolverInfoRowAngular(row5,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); + j = row5.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; + } + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot00; + var relRot01; + var relRot02; + var relRot11; + var relRot12; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__11; + var __tmp__12; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var anglesX; + var anglesY; + var anglesZ; + var sy = relRot02; + if(sy <= -1) { + var xSubZ = Math.atan2(relRot21,relRot11); + anglesX = xSubZ * 0.5; + anglesY = -1.570796326794895; + anglesZ = -xSubZ * 0.5; + } else if(sy >= 1) { + var xAddZ = Math.atan2(relRot21,relRot11); + anglesX = xAddZ * 0.5; + anglesY = 1.570796326794895; + anglesZ = xAddZ * 0.5; + } else { + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); + } + this._angleX = anglesX; + this._angleY = anglesY; + this._angleZ = anglesZ; + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translationX = anchorDiffX * this._basisX1X + anchorDiffY * this._basisX1Y + anchorDiffZ * this._basisX1Z; + this.translationY = anchorDiffX * this._basisY1X + anchorDiffY * this._basisY1Y + anchorDiffZ * this._basisY1Z; + this.translationZ = anchorDiffX * this._basisZ1X + anchorDiffY * this._basisZ1Y + anchorDiffZ * this._basisZ1Z; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxisX: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxisY: function() { + var v = new oimo_common_Vec3(); + v.x = this._axisYX; + v.y = this._axisYY; + v.z = this._axisYZ; + return v; + } + ,getAxisZ: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; + return v; + } + ,getTranslationalSpringDampers: function() { + return this._translSds.slice(0); + } + ,getRotationalSpringDampers: function() { + return this._translSds.slice(0); + } + ,getTranslationalLimitMotors: function() { + return this._translLms.slice(0); + } + ,getRotationalLimitMotors: function() { + return this._rotLms.slice(0); + } + ,getAngles: function() { + return new oimo_common_Vec3(this._angleX,this._angleY,this._angleZ); + } + ,getTranslations: function() { + return new oimo_common_Vec3(this.translationX,this.translationY,this.translationZ); + } + ,__class__: oimo_dynamics_constraint_joint_GenericJoint +}); +var oimo_dynamics_constraint_joint_GenericJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localBasis1 = new oimo_common_Mat3(); + this.localBasis2 = new oimo_common_Mat3(); + var _g = []; + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + this.translationalLimitMotors = _g; + var _g1 = []; + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + this.rotationalLimitMotors = _g1; + this.translationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; + this.rotationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; +}; +oimo_dynamics_constraint_joint_GenericJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_GenericJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var tf1 = rigidBody1._transform; + var tf2 = rigidBody2._transform; + var wb100; + var wb101; + var wb102; + var wb110; + var wb111; + var wb112; + var wb120; + var wb121; + var wb122; + var wb200; + var wb201; + var wb202; + var wb210; + var wb211; + var wb212; + var wb220; + var wb221; + var wb222; + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + wb100 = worldBasis1.e00; + wb101 = worldBasis1.e01; + wb102 = worldBasis1.e02; + wb110 = worldBasis1.e10; + wb111 = worldBasis1.e11; + wb112 = worldBasis1.e12; + wb120 = worldBasis1.e20; + wb121 = worldBasis1.e21; + wb122 = worldBasis1.e22; + wb200 = worldBasis2.e00; + wb201 = worldBasis2.e01; + wb202 = worldBasis2.e02; + wb210 = worldBasis2.e10; + wb211 = worldBasis2.e11; + wb212 = worldBasis2.e12; + wb220 = worldBasis2.e20; + wb221 = worldBasis2.e21; + wb222 = worldBasis2.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * wb100 + tf1._rotation10 * wb110 + tf1._rotation20 * wb120; + __tmp__01 = tf1._rotation00 * wb101 + tf1._rotation10 * wb111 + tf1._rotation20 * wb121; + __tmp__02 = tf1._rotation00 * wb102 + tf1._rotation10 * wb112 + tf1._rotation20 * wb122; + __tmp__10 = tf1._rotation01 * wb100 + tf1._rotation11 * wb110 + tf1._rotation21 * wb120; + __tmp__11 = tf1._rotation01 * wb101 + tf1._rotation11 * wb111 + tf1._rotation21 * wb121; + __tmp__12 = tf1._rotation01 * wb102 + tf1._rotation11 * wb112 + tf1._rotation21 * wb122; + __tmp__20 = tf1._rotation02 * wb100 + tf1._rotation12 * wb110 + tf1._rotation22 * wb120; + __tmp__21 = tf1._rotation02 * wb101 + tf1._rotation12 * wb111 + tf1._rotation22 * wb121; + __tmp__22 = tf1._rotation02 * wb102 + tf1._rotation12 * wb112 + tf1._rotation22 * wb122; + lb100 = __tmp__00; + lb101 = __tmp__01; + lb102 = __tmp__02; + lb110 = __tmp__10; + lb111 = __tmp__11; + lb112 = __tmp__12; + lb120 = __tmp__20; + lb121 = __tmp__21; + lb122 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; + __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; + __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; + __tmp__101 = tf2._rotation01 * wb200 + tf2._rotation11 * wb210 + tf2._rotation21 * wb220; + __tmp__111 = tf2._rotation01 * wb201 + tf2._rotation11 * wb211 + tf2._rotation21 * wb221; + __tmp__121 = tf2._rotation01 * wb202 + tf2._rotation11 * wb212 + tf2._rotation21 * wb222; + __tmp__201 = tf2._rotation02 * wb200 + tf2._rotation12 * wb210 + tf2._rotation22 * wb220; + __tmp__211 = tf2._rotation02 * wb201 + tf2._rotation12 * wb211 + tf2._rotation22 * wb221; + __tmp__221 = tf2._rotation02 * wb202 + tf2._rotation12 * wb212 + tf2._rotation22 * wb222; + lb200 = __tmp__001; + lb201 = __tmp__011; + lb202 = __tmp__021; + lb210 = __tmp__101; + lb211 = __tmp__111; + lb212 = __tmp__121; + lb220 = __tmp__201; + lb221 = __tmp__211; + lb222 = __tmp__221; + var m = this.localBasis1; + m.e00 = lb100; + m.e01 = lb101; + m.e02 = lb102; + m.e10 = lb110; + m.e11 = lb111; + m.e12 = lb112; + m.e20 = lb120; + m.e21 = lb121; + m.e22 = lb122; + var m1 = this.localBasis2; + m1.e00 = lb200; + m1.e01 = lb201; + m1.e02 = lb202; + m1.e10 = lb210; + m1.e11 = lb211; + m1.e12 = lb212; + m1.e20 = lb220; + m1.e21 = lb221; + m1.e22 = lb222; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_GenericJointConfig +}); +var oimo_dynamics_constraint_joint_JointImpulse = function() { + this.impulse = 0; + this.impulseM = 0; + this.impulseP = 0; +}; +oimo_dynamics_constraint_joint_JointImpulse.__name__ = true; +oimo_dynamics_constraint_joint_JointImpulse.prototype = { + __class__: oimo_dynamics_constraint_joint_JointImpulse +}; +var oimo_dynamics_constraint_joint_JointLink = function(joint) { + this._joint = joint; +}; +oimo_dynamics_constraint_joint_JointLink.__name__ = true; +oimo_dynamics_constraint_joint_JointLink.prototype = { + getContact: function() { + return this._joint; + } + ,getOther: function() { + return this._other; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_constraint_joint_JointLink +}; +var oimo_dynamics_constraint_joint_JointMacro = function() { }; +oimo_dynamics_constraint_joint_JointMacro.__name__ = true; +var oimo_dynamics_constraint_joint_JointType = function() { }; +oimo_dynamics_constraint_joint_JointType.__name__ = true; +var oimo_dynamics_constraint_joint_PrismaticJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.PRISMATIC); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this.angularErrorX = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); +}; +oimo_dynamics_constraint_joint_PrismaticJoint.__name__ = true; +oimo_dynamics_constraint_joint_PrismaticJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linRhsY = this.linearErrorY * erp; + var linRhsZ = this.linearErrorZ * erp; + var angRhsX = this.angularErrorX * erp; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var j; + if(this._sd.frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translation,this._lm,1 / (this._b1._invMass + this._b2._invMass),this._sd,timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basis.xX; + j.lin1Y = this._basis.xY; + j.lin1Z = this._basis.xZ; + j.lin2X = this._basis.xX; + j.lin2Y = this._basis.xY; + j.lin2Z = this._basis.xZ; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; + } + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsX; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; + j.ang1X = 1; + j.ang1Y = 0; + j.ang1Z = 0; + j.ang2X = 1; + j.ang2Y = 0; + j.ang2Z = 0; + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; + j.ang1X = 0; + j.ang1Y = 1; + j.ang1Z = 0; + j.ang2X = 0; + j.ang2Y = 1; + j.ang2Z = 0; + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; + j.ang1X = 0; + j.ang1Y = 0; + j.ang1Z = 1; + j.ang2X = 0; + j.ang2Y = 0; + j.ang2Z = 1; + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var qX; + var qY; + var qZ; + var qW; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newXX; + var newXY; + var newXZ; + var newYX; + var newYY; + var newYZ; + var newZX; + var newZY; + var newZZ; + var prevXX; + var prevXY; + var prevXZ; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot00; + var relRot01; + var relRot02; + var relRot10; + var relRot11; + var relRot12; + var relRot20; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot200 * rot100 + rot201 * rot101 + rot202 * rot102; + __tmp__01 = rot200 * rot110 + rot201 * rot111 + rot202 * rot112; + __tmp__02 = rot200 * rot120 + rot201 * rot121 + rot202 * rot122; + __tmp__10 = rot210 * rot100 + rot211 * rot101 + rot212 * rot102; + __tmp__11 = rot210 * rot110 + rot211 * rot111 + rot212 * rot112; + __tmp__12 = rot210 * rot120 + rot211 * rot121 + rot212 * rot122; + __tmp__20 = rot220 * rot100 + rot221 * rot101 + rot222 * rot102; + __tmp__21 = rot220 * rot110 + rot221 * rot111 + rot222 * rot112; + __tmp__22 = rot220 * rot120 + rot221 * rot121 + rot222 * rot122; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot10 = __tmp__10; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot20 = __tmp__20; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var relQX; + var relQY; + var relQZ; + var relQW; + var e00 = relRot00; + var e11 = relRot11; + var e22 = relRot22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + relQW = 0.5 * s; + s = 0.5 / s; + relQX = (relRot21 - relRot12) * s; + relQY = (relRot02 - relRot20) * s; + relQZ = (relRot10 - relRot01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + relQX = 0.5 * s; + s = 0.5 / s; + relQY = (relRot01 + relRot10) * s; + relQZ = (relRot02 + relRot20) * s; + relQW = (relRot21 - relRot12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + relQZ = 0.5 * s; + s = 0.5 / s; + relQX = (relRot02 + relRot20) * s; + relQY = (relRot12 + relRot21) * s; + relQW = (relRot10 - relRot01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + relQY = 0.5 * s; + s = 0.5 / s; + relQX = (relRot01 + relRot10) * s; + relQZ = (relRot12 + relRot21) * s; + relQW = (relRot02 - relRot20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + relQZ = 0.5 * s; + s = 0.5 / s; + relQX = (relRot02 + relRot20) * s; + relQY = (relRot12 + relRot21) * s; + relQW = (relRot10 - relRot01) * s; + } + var cosHalfTheta = relQW; + var theta1 = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; + this.angularErrorX = relQX; + this.angularErrorY = relQY; + this.angularErrorZ = relQZ; + var l3 = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + this.angularErrorX *= l3; + this.angularErrorY *= l3; + this.angularErrorZ *= l3; + this.angularErrorX *= theta1; + this.angularErrorY *= theta1; + this.angularErrorZ *= theta1; + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; + this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; + this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; + } + ,getSpringDamper: function() { + return this._sd; + } + ,getLimitMotor: function() { + return this._lm; + } + ,getTranslation: function() { + return this.translation; + } + ,__class__: oimo_dynamics_constraint_joint_PrismaticJoint +}); +var oimo_dynamics_constraint_joint_PrismaticJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.limitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); +}; +oimo_dynamics_constraint_joint_PrismaticJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_PrismaticJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localAxis1; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_PrismaticJointConfig +}); +var oimo_dynamics_constraint_joint_RagdollJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.RAGDOLL); + var v = config.localTwistAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localSwingAxis1; + this._localBasisY1X = v1.x; + this._localBasisY1Y = v1.y; + this._localBasisY1Z = v1.z; + var v2 = config.localTwistAxis2; + this._localBasisX2X = v2.x; + this._localBasisX2Y = v2.y; + this._localBasisX2Z = v2.z; + this.buildLocalBasesFromXY1X2(); + this._twistSd = config.twistSpringDamper.clone(); + this._twistLm = config.twistLimitMotor.clone(); + this._swingSd = config.swingSpringDamper.clone(); + this._maxSwingAngle1 = config.maxSwingAngle1; + this._maxSwingAngle2 = config.maxSwingAngle2; + if(this._maxSwingAngle1 < oimo_common_Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle1 = oimo_common_Setting.minRagdollMaxSwingAngle; + } + if(this._maxSwingAngle2 < oimo_common_Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle2 = oimo_common_Setting.minRagdollMaxSwingAngle; + } + this.dummySwingLm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.dummySwingLm.lowerLimit = -1; + this.dummySwingLm.upperLimit = 0; + this._swingAngle = 0; + this._twistAngle = 0; + this.swingError = 0; + this.swingAxisX = 0; + this.swingAxisY = 0; + this.swingAxisZ = 0; + this.twistAxisX = 0; + this.twistAxisY = 0; + this.twistAxisZ = 0; +}; +oimo_dynamics_constraint_joint_RagdollJoint.__name__ = true; +oimo_dynamics_constraint_joint_RagdollJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); + var twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this.swingAxisX; + j.ang1Y = this.swingAxisY; + j.ang1Z = this.swingAxisZ; + j.ang2X = this.swingAxisX; + j.ang2Y = this.swingAxisY; + j.ang2Z = this.swingAxisZ; + } + if(this._twistSd.frequency <= 0 || !isPositionPart) { + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + this.setSolverInfoRowAngular(row4,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row4.jacobian; + j.ang1X = this.twistAxisX; + j.ang1Y = this.twistAxisY; + j.ang1Z = this.twistAxisZ; + j.ang2X = this.twistAxisX; + j.ang2Y = this.twistAxisY; + j.ang2Z = this.twistAxisZ; + } + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var axis1X; + var axis1Y; + var axis1Z; + var axis2X; + var axis2Y; + var axis2Z; + axis1X = this._basisX1X; + axis1Y = this._basisX1Y; + axis1Z = this._basisX1Z; + axis2X = this._basisX2X; + axis2Y = this._basisX2Y; + axis2Z = this._basisX2Z; + var basis1Mat00; + var basis1Mat01; + var basis1Mat02; + var basis1Mat10; + var basis1Mat11; + var basis1Mat12; + var basis1Mat20; + var basis1Mat21; + var basis1Mat22; + basis1Mat00 = this._basisX1X; + basis1Mat01 = this._basisY1X; + basis1Mat02 = this._basisZ1X; + basis1Mat10 = this._basisX1Y; + basis1Mat11 = this._basisY1Y; + basis1Mat12 = this._basisZ1Y; + basis1Mat20 = this._basisX1Z; + basis1Mat21 = this._basisY1Z; + basis1Mat22 = this._basisZ1Z; + var swingQX; + var swingQY; + var swingQZ; + var swingQW; + var swingM00; + var swingM01; + var swingM02; + var swingM10; + var swingM11; + var swingM12; + var swingM20; + var swingM21; + var swingM22; + var swingVX; + var swingVY; + var swingVZ; + var d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = axis1X; + var y1 = axis1Y; + var z1 = axis1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + swingQX = vX; + swingQY = vY; + swingQZ = vZ; + swingQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = axis1Y * axis2Z - axis1Z * axis2Y; + cY = axis1Z * axis2X - axis1X * axis2Z; + cZ = axis1X * axis2Y - axis1Y * axis2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + swingQX = cX; + swingQY = cY; + swingQZ = cZ; + swingQW = w; + } + var x = swingQX; + var y = swingQY; + var z = swingQZ; + var w1 = swingQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + swingM00 = 1 - yy - zz; + swingM01 = xy - wz; + swingM02 = xz + wy; + swingM10 = xy + wz; + swingM11 = 1 - xx - zz; + swingM12 = yz - wx; + swingM20 = xz - wy; + swingM21 = yz + wx; + swingM22 = 1 - xx - yy; + this._swingAngle = (swingQW <= -1 ? 3.14159265358979 : swingQW >= 1 ? 0 : Math.acos(swingQW)) * 2; + swingVX = swingQX; + swingVY = swingQY; + swingVZ = swingQZ; + var basisY2In1X; + var basisY2In1Y; + var basisY2In1Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = swingM00 * this._basisY2X + swingM10 * this._basisY2Y + swingM20 * this._basisY2Z; + __tmp__Y = swingM01 * this._basisY2X + swingM11 * this._basisY2Y + swingM21 * this._basisY2Z; + __tmp__Z = swingM02 * this._basisY2X + swingM12 * this._basisY2Y + swingM22 * this._basisY2Z; + basisY2In1X = __tmp__X; + basisY2In1Y = __tmp__Y; + basisY2In1Z = __tmp__Z; + this._twistAngle = Math.atan2(this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z,this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z); + this.twistAxisX = this._basisX1X + this._basisX2X; + this.twistAxisY = this._basisX1Y + this._basisX2Y; + this.twistAxisZ = this._basisX1Z + this._basisX2Z; + var l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this.twistAxisX *= l; + this.twistAxisY *= l; + this.twistAxisZ *= l; + var invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); + if(invLen > 0) { + invLen = 1 / invLen; + } + swingVX *= invLen * this._swingAngle; + swingVY *= invLen * this._swingAngle; + swingVZ *= invLen * this._swingAngle; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; + __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; + __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; + swingVX = __tmp__X1; + swingVY = __tmp__Y1; + swingVZ = __tmp__Z1; + var x3 = swingVY; + var y3 = swingVZ; + var a = this._maxSwingAngle1; + var b = this._maxSwingAngle2; + var invA2 = 1 / (a * a); + var invB2 = 1 / (b * b); + var w2 = x3 * x3 * invA2 + y3 * y3 * invB2; + if(w2 == 0) { + this.swingAxisX = 0; + this.swingAxisY = 0; + this.swingAxisZ = 0; + this.swingError = 0; + } else { + var t = Math.sqrt(1 / w2); + var x0 = x3 * t; + var y0 = y3 * t; + var nx = x0 * invA2; + var ny = y0 * invB2; + invLen = 1 / Math.sqrt(nx * nx + ny * ny); + nx *= invLen; + ny *= invLen; + var depth = (x3 - x0) * nx + (y3 - y0) * ny; + if(depth > 0) { + this.swingError = depth; + this.swingAxisX = 0; + this.swingAxisY = nx; + this.swingAxisZ = ny; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; + __tmp__Y2 = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; + __tmp__Z2 = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; + this.swingAxisX = __tmp__X2; + this.swingAxisY = __tmp__Y2; + this.swingAxisZ = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; + __tmp__Y3 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; + __tmp__Z3 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; + this.swingAxisX = __tmp__X3; + this.swingAxisY = __tmp__Y3; + this.swingAxisZ = __tmp__Z3; + } else { + this.swingError = 0; + } + } + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; + } + ,getTwistSpringDamper: function() { + return this._twistSd; + } + ,getTwistLimitMotor: function() { + return this._twistLm; + } + ,getSwingSpringDamper: function() { + return this._swingSd; + } + ,getSwingAxis: function() { + var v = new oimo_common_Vec3(); + v.x = this.swingAxisX; + v.y = this.swingAxisY; + v.z = this.swingAxisZ; + return v; + } + ,getSwingAxisTo: function(axis) { + axis.x = this.swingAxisX; + axis.y = this.swingAxisY; + axis.z = this.swingAxisZ; + } + ,getSwingAngle: function() { + return this._swingAngle; + } + ,getTwistAngle: function() { + return this._twistAngle; + } + ,__class__: oimo_dynamics_constraint_joint_RagdollJoint +}); +var oimo_dynamics_constraint_joint_RagdollJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localTwistAxis1 = new oimo_common_Vec3(1,0,0); + this.localTwistAxis2 = new oimo_common_Vec3(1,0,0); + this.localSwingAxis1 = new oimo_common_Vec3(0,1,0); + this.twistSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.swingSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.twistLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.maxSwingAngle1 = 3.14159265358979; + this.maxSwingAngle2 = 3.14159265358979; +}; +oimo_dynamics_constraint_joint_RagdollJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_RagdollJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localTwistAxis1; + var vX; + var vY; + var vZ; + vX = worldTwistAxis.x; + vY = worldTwistAxis.y; + vZ = worldTwistAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localTwistAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldTwistAxis.x; + vY1 = worldTwistAxis.y; + vZ1 = worldTwistAxis.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + var localVector2 = this.localSwingAxis1; + var vX2; + var vY2; + var vZ2; + vX2 = worldSwingAxis.x; + vY2 = worldSwingAxis.y; + vZ2 = worldSwingAxis.z; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = rigidBody1._transform._rotation00 * vX2 + rigidBody1._transform._rotation10 * vY2 + rigidBody1._transform._rotation20 * vZ2; + __tmp__Y2 = rigidBody1._transform._rotation01 * vX2 + rigidBody1._transform._rotation11 * vY2 + rigidBody1._transform._rotation21 * vZ2; + __tmp__Z2 = rigidBody1._transform._rotation02 * vX2 + rigidBody1._transform._rotation12 * vY2 + rigidBody1._transform._rotation22 * vZ2; + vX2 = __tmp__X2; + vY2 = __tmp__Y2; + vZ2 = __tmp__Z2; + localVector2.x = vX2; + localVector2.y = vY2; + localVector2.z = vZ2; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_RagdollJointConfig +}); +var oimo_dynamics_constraint_joint_RevoluteJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,1); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); +}; +oimo_dynamics_constraint_joint_RevoluteJoint.__name__ = true; +oimo_dynamics_constraint_joint_RevoluteJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(this._sd.frequency <= 0 || !isPositionPart) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this._basis.xX; + j.ang1Y = this._basis.xY; + j.ang1Z = this._basis.xZ; + j.ang2X = this._basis.xX; + j.ang2Y = this._basis.xY; + j.ang2Z = this._basis.xZ; + } + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + row5.rhs = angRhsZ; + row5.cfm = 0; + row5.minImpulse = -1e65536; + row5.maxImpulse = 1e65536; + j = row5.jacobian; + j.ang1X = this._basis.zX; + j.ang1Y = this._basis.zY; + j.ang1Z = this._basis.zZ; + j.ang2X = this._basis.zX; + j.ang2Y = this._basis.zY; + j.ang2Z = this._basis.zZ; + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var qX; + var qY; + var qZ; + var qW; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newXX; + var newXY; + var newXZ; + var newYX; + var newYY; + var newYZ; + var newZX; + var newZY; + var newZZ; + var prevXX; + var prevXY; + var prevXZ; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var angErrorX; + var angErrorY; + var angErrorZ; + angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; + angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; + angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; + var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + angErrorX *= l3; + angErrorY *= l3; + angErrorZ *= l3; + angErrorX *= theta1; + angErrorY *= theta1; + angErrorZ *= theta1; + this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; + this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; + var perpCrossX; + var perpCrossY; + var perpCrossZ; + perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; + perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; + perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; + cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { + this.angle = -this.angle; + } + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; + } + ,getSpringDamper: function() { + return this._sd; + } + ,getLimitMotor: function() { + return this._lm; + } + ,getAngle: function() { + return this.angle; + } + ,__class__: oimo_dynamics_constraint_joint_RevoluteJoint +}); +var oimo_dynamics_constraint_joint_RevoluteJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.limitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); +}; +oimo_dynamics_constraint_joint_RevoluteJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_RevoluteJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localAxis1; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_RevoluteJointConfig +}); +var oimo_dynamics_constraint_joint_RotationalLimitMotor = function() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorTorque = 0; +}; +oimo_dynamics_constraint_joint_RotationalLimitMotor.__name__ = true; +oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype = { + setLimits: function(lower,upper) { + this.lowerLimit = lower; + this.upperLimit = upper; + return this; + } + ,setMotor: function(speed,torque) { + this.motorSpeed = speed; + this.motorTorque = torque; + return this; + } + ,clone: function() { + var lm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + lm.lowerLimit = this.lowerLimit; + lm.upperLimit = this.upperLimit; + lm.motorSpeed = this.motorSpeed; + lm.motorTorque = this.motorTorque; + return lm; + } + ,__class__: oimo_dynamics_constraint_joint_RotationalLimitMotor +}; +var oimo_dynamics_constraint_joint_SphericalJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,0); + this._sd = config.springDamper.clone(); +}; +oimo_dynamics_constraint_joint_SphericalJoint.__name__ = true; +oimo_dynamics_constraint_joint_SphericalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + if(this._sd.frequency > 0 && isPositionPart) { + return; + } + var errorX; + var errorY; + var errorZ; + errorX = this._anchor2X - this._anchor1X; + errorY = this._anchor2Y - this._anchor1Y; + errorZ = this._anchor2Z - this._anchor1Z; + var cfm; + var erp; + if(this._sd.frequency > 0) { + var omega = 6.28318530717958 * this._sd.frequency; + var zeta = this._sd.dampingRatio; + if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { + zeta = oimo_common_Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(this._sd.useSymplecticEuler) { + cfm = 1 / (h * c); + erp = k / c; + } else { + cfm = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + cfm *= this._b1._invMass + this._b2._invMass; + } else { + cfm = 0; + erp = this.getErp(timeStep,isPositionPart); + } + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = errorX * erp; + linearRhsY = errorY * erp; + linearRhsZ = errorZ * erp; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsX; + row.cfm = cfm; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = cfm; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = cfm; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getSpringDamper: function() { + return this._sd; + } + ,__class__: oimo_dynamics_constraint_joint_SphericalJoint +}); +var oimo_dynamics_constraint_joint_SphericalJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); +}; +oimo_dynamics_constraint_joint_SphericalJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_SphericalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_SphericalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor) { + this._init(rigidBody1,rigidBody2,worldAnchor); + return this; + } + ,__class__: oimo_dynamics_constraint_joint_SphericalJointConfig +}); +var oimo_dynamics_constraint_joint_SpringDamper = function() { + this.frequency = 0; + this.dampingRatio = 0; + this.useSymplecticEuler = false; +}; +oimo_dynamics_constraint_joint_SpringDamper.__name__ = true; +oimo_dynamics_constraint_joint_SpringDamper.prototype = { + setSpring: function(frequency,dampingRatio) { + this.frequency = frequency; + this.dampingRatio = dampingRatio; + return this; + } + ,setSymplecticEuler: function(useSymplecticEuler) { + this.useSymplecticEuler = useSymplecticEuler; + return this; + } + ,clone: function() { + var sd = new oimo_dynamics_constraint_joint_SpringDamper(); + sd.frequency = this.frequency; + sd.dampingRatio = this.dampingRatio; + sd.useSymplecticEuler = this.useSymplecticEuler; + return sd; + } + ,__class__: oimo_dynamics_constraint_joint_SpringDamper +}; +var oimo_dynamics_constraint_joint_TranslationalLimitMotor = function() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorForce = 0; +}; +oimo_dynamics_constraint_joint_TranslationalLimitMotor.__name__ = true; +oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype = { + setLimits: function(lower,upper) { + this.lowerLimit = lower; + this.upperLimit = upper; + return this; + } + ,setMotor: function(speed,force) { + this.motorSpeed = speed; + this.motorForce = force; + return this; + } + ,clone: function() { + var lm = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + lm.lowerLimit = this.lowerLimit; + lm.upperLimit = this.upperLimit; + lm.motorSpeed = this.motorSpeed; + lm.motorForce = this.motorForce; + return lm; + } + ,__class__: oimo_dynamics_constraint_joint_TranslationalLimitMotor +}; +var oimo_dynamics_constraint_joint_UniversalJoint = function(config) { + oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.UNIVERSAL); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisZ2X = v1.x; + this._localBasisZ2Y = v1.y; + this._localBasisZ2Z = v1.z; + this.buildLocalBasesFromX1Z2(); + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._sd1 = config.springDamper1.clone(); + this._sd2 = config.springDamper2.clone(); + this._lm1 = config.limitMotor1.clone(); + this._lm2 = config.limitMotor2.clone(); +}; +oimo_dynamics_constraint_joint_UniversalJoint.__name__ = true; +oimo_dynamics_constraint_joint_UniversalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; +oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ + getInfo: function(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var angRhsY = this._angleY * erp; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + var j = row.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row1 = info.rows[info.numRows++]; + var _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row2 = info.rows[info.numRows++]; + var _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row3 = info.rows[info.numRows++]; + var _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + this.setSolverInfoRowAngular(row3,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row3.jacobian; + j.ang1X = this._axisXX; + j.ang1Y = this._axisXY; + j.ang1Z = this._axisXZ; + j.ang2X = this._axisXX; + j.ang2Y = this._axisXY; + j.ang2Z = this._axisXZ; + } + if(!this.ySingular) { + var impulse4 = this._impulses[4]; + var row4 = info.rows[info.numRows++]; + var _this4 = row4.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsY; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; + j.ang1X = this._axisYX; + j.ang1Y = this._axisYY; + j.ang1Z = this._axisYZ; + j.ang2X = this._axisYX; + j.ang2Y = this._axisYY; + j.ang2Z = this._axisYZ; + } + if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { + var impulse5 = this._impulses[5]; + var row5 = info.rows[info.numRows++]; + var _this5 = row5.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse5; + this.setSolverInfoRowAngular(row5,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row5.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; + } + } + ,_syncAnchors: function() { + oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot00; + var relRot01; + var relRot02; + var relRot11; + var relRot12; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__11; + var __tmp__12; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var anglesX; + var anglesY; + var anglesZ; + var sy = relRot02; + if(sy <= -1) { + var xSubZ = Math.atan2(relRot21,relRot11); + anglesX = xSubZ * 0.5; + anglesY = -1.570796326794895; + anglesZ = -xSubZ * 0.5; + } else if(sy >= 1) { + var xAddZ = Math.atan2(relRot21,relRot11); + anglesX = xAddZ * 0.5; + anglesY = 1.570796326794895; + anglesZ = xAddZ * 0.5; + } else { + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); + } + this._angleX = anglesX; + this._angleY = anglesY; + this._angleZ = anglesZ; + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + ,_getVelocitySolverInfo: function(timeStep,info) { + oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + this.getInfo(info,timeStep,false); + } + ,_getPositionSolverInfo: function(info) { + oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + this.getInfo(info,null,true); + } + ,getAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + return v; + } + ,getAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; + return v; + } + ,getAxis1To: function(axis) { + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; + } + ,getAxis2To: function(axis) { + axis.x = this._basisZ2X; + axis.y = this._basisZ2Y; + axis.z = this._basisZ2Z; + } + ,getLocalAxis1: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + return v; + } + ,getLocalAxis2: function() { + var v = new oimo_common_Vec3(); + v.x = this._localBasisZ2X; + v.y = this._localBasisZ2Y; + v.z = this._localBasisZ2Z; + return v; + } + ,getLocalAxis1To: function(axis) { + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; + } + ,getLocalAxis2To: function(axis) { + axis.x = this._localBasisZ2X; + axis.y = this._localBasisZ2Y; + axis.z = this._localBasisZ2Z; + } + ,getSpringDamper1: function() { + return this._sd1; + } + ,getSpringDamper2: function() { + return this._sd2; + } + ,getLimitMotor1: function() { + return this._lm1; + } + ,getLimitMotor2: function() { + return this._lm2; + } + ,getAngle1: function() { + return this._angleX; + } + ,getAngle2: function() { + return this._angleZ; + } + ,__class__: oimo_dynamics_constraint_joint_UniversalJoint +}); +var oimo_dynamics_constraint_joint_UniversalJointConfig = function() { + oimo_dynamics_constraint_joint_JointConfig.call(this); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.springDamper1 = new oimo_dynamics_constraint_joint_SpringDamper(); + this.springDamper2 = new oimo_dynamics_constraint_joint_SpringDamper(); + this.limitMotor1 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.limitMotor2 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); +}; +oimo_dynamics_constraint_joint_UniversalJointConfig.__name__ = true; +oimo_dynamics_constraint_joint_UniversalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; +oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ + init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var localVector = this.localAxis1; + var vX; + var vY; + var vZ; + vX = worldAxis1.x; + vY = worldAxis1.y; + vZ = worldAxis1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector1 = this.localAxis2; + var vX1; + var vY1; + var vZ1; + vX1 = worldAxis2.x; + vY1 = worldAxis2.y; + vZ1 = worldAxis2.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + return this; + } + ,__class__: oimo_dynamics_constraint_joint_UniversalJointConfig +}); +var oimo_dynamics_constraint_solver_ConstraintSolverType = function() { }; +oimo_dynamics_constraint_solver_ConstraintSolverType.__name__ = true; +var oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow = function() { + this.invMLinN1X = 0; + this.invMLinN1Y = 0; + this.invMLinN1Z = 0; + this.invMLinN2X = 0; + this.invMLinN2Y = 0; + this.invMLinN2Z = 0; + this.invMAngN1X = 0; + this.invMAngN1Y = 0; + this.invMAngN1Z = 0; + this.invMAngN2X = 0; + this.invMAngN2Y = 0; + this.invMAngN2Z = 0; + this.invMLinT1X = 0; + this.invMLinT1Y = 0; + this.invMLinT1Z = 0; + this.invMLinT2X = 0; + this.invMLinT2Y = 0; + this.invMLinT2Z = 0; + this.invMAngT1X = 0; + this.invMAngT1Y = 0; + this.invMAngT1Z = 0; + this.invMAngT2X = 0; + this.invMAngT2Y = 0; + this.invMAngT2Z = 0; + this.invMLinB1X = 0; + this.invMLinB1Y = 0; + this.invMLinB1Z = 0; + this.invMLinB2X = 0; + this.invMLinB2Y = 0; + this.invMLinB2Z = 0; + this.invMAngB1X = 0; + this.invMAngB1Y = 0; + this.invMAngB1Z = 0; + this.invMAngB2X = 0; + this.invMAngB2Y = 0; + this.invMAngB2Z = 0; + this.massN = 0; + this.massTB00 = 0; + this.massTB01 = 0; + this.massTB10 = 0; + this.massTB11 = 0; +}; +oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow.__name__ = true; +oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow.prototype = { + __class__: oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow +}; +var oimo_dynamics_constraint_solver_common_JointSolverMassDataRow = function() { + this.invMLin1X = 0; + this.invMLin1Y = 0; + this.invMLin1Z = 0; + this.invMLin2X = 0; + this.invMLin2Y = 0; + this.invMLin2Z = 0; + this.invMAng1X = 0; + this.invMAng1Y = 0; + this.invMAng1Z = 0; + this.invMAng2X = 0; + this.invMAng2Y = 0; + this.invMAng2Z = 0; + this.mass = 0; + this.massWithoutCfm = 0; +}; +oimo_dynamics_constraint_solver_common_JointSolverMassDataRow.__name__ = true; +oimo_dynamics_constraint_solver_common_JointSolverMassDataRow.prototype = { + __class__: oimo_dynamics_constraint_solver_common_JointSolverMassDataRow +}; +var oimo_dynamics_constraint_solver_direct_Boundary = function(maxRows) { + this.iBounded = new Array(maxRows); + this.iUnbounded = new Array(maxRows); + this.signs = new Array(maxRows); + this.b = new Array(maxRows); + this.numBounded = 0; + this.numUnbounded = 0; + this.matrixId = 0; +}; +oimo_dynamics_constraint_solver_direct_Boundary.__name__ = true; +oimo_dynamics_constraint_solver_direct_Boundary.prototype = { + init: function(buildInfo) { + this.numBounded = buildInfo.numBounded; + var _g = 0; + var _g1 = this.numBounded; + while(_g < _g1) { + var i = _g++; + this.iBounded[i] = buildInfo.iBounded[i]; + this.signs[i] = buildInfo.signs[i]; + } + this.numUnbounded = buildInfo.numUnbounded; + this.matrixId = 0; + var _g2 = 0; + var _g3 = this.numUnbounded; + while(_g2 < _g3) { + var i1 = _g2++; + var idx = buildInfo.iUnbounded[i1]; + this.iUnbounded[i1] = idx; + this.matrixId |= 1 << idx; + } + } + ,computeImpulses: function(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { + var _g = 0; + var _g1 = this.numUnbounded; + while(_g < _g1) { + var idx = this.iUnbounded[_g++]; + var row = info.rows[idx]; + this.b[idx] = row.rhs * impulseFactor - relVels[idx] - row.cfm * impulses[idx]; + } + var invMassWithoutCfm = mass._invMassWithoutCfm; + var _g2 = 0; + var _g3 = this.numBounded; + while(_g2 < _g3) { + var i = _g2++; + var idx1 = this.iBounded[i]; + var sign = this.signs[i]; + var row1 = info.rows[idx1]; + var dImpulse = (sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0) - impulses[idx1]; + dImpulses[idx1] = dImpulse; + if(dImpulse != 0) { + var _g21 = 0; + var _g31 = this.numUnbounded; + while(_g21 < _g31) { + var idx2 = this.iUnbounded[_g21++]; + var _g32 = this.b; + _g32[idx2] = _g32[idx2] - invMassWithoutCfm[idx1][idx2] * dImpulse; + } + } + } + var indices = this.iUnbounded; + var n = this.numUnbounded; + var id = 0; + var _g4 = 0; + while(_g4 < n) id |= 1 << indices[_g4++]; + var massMatrix; + if(mass._cacheComputed[id]) { + massMatrix = mass._cachedSubmatrices[id]; + } else { + mass.computeSubmatrix(id,indices,n); + mass._cacheComputed[id] = true; + massMatrix = mass._cachedSubmatrices[id]; + } + var ok = true; + var _g41 = 0; + var _g5 = this.numUnbounded; + while(_g41 < _g5) { + var i1 = _g41++; + var idx3 = this.iUnbounded[i1]; + var row2 = info.rows[idx3]; + var oldImpulse = impulses[idx3]; + var impulse = oldImpulse; + var _g42 = 0; + var _g51 = this.numUnbounded; + while(_g42 < _g51) { + var j = _g42++; + impulse += this.b[this.iUnbounded[j]] * massMatrix[i1][j]; + } + if(impulse < row2.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row2.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { + ok = false; + break; + } + dImpulses[idx3] = impulse - oldImpulse; + } + if(noCheck) { + return true; + } + if(!ok) { + return false; + } + var _g6 = 0; + var _g7 = this.numBounded; + while(_g6 < _g7) { + var i2 = _g6++; + var idx4 = this.iBounded[i2]; + var row3 = info.rows[idx4]; + var sign1 = this.signs[i2]; + var error = 0; + var newImpulse = impulses[idx4] + dImpulses[idx4]; + var relVel = relVels[idx4]; + var _g61 = 0; + var _g71 = info.numRows; + while(_g61 < _g71) { + var j1 = _g61++; + relVel += invMassWithoutCfm[idx4][j1] * dImpulses[j1]; + } + error = row3.rhs * impulseFactor - relVel - row3.cfm * newImpulse; + if(sign1 < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { + ok = false; + break; + } + } + return ok; + } + ,__class__: oimo_dynamics_constraint_solver_direct_Boundary +}; +var oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo = function(size) { + this.size = size; + this.numBounded = 0; + this.iBounded = new Array(size); + this.signs = new Array(size); + this.numUnbounded = 0; + this.iUnbounded = new Array(size); +}; +oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo.__name__ = true; +oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo.prototype = { + __class__: oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo +}; +var oimo_dynamics_constraint_solver_direct_BoundaryBuilder = function(maxRows) { + this.maxRows = maxRows; + this.numBoundaries = 0; + this.boundaries = new Array(1 << maxRows); + this.bbInfo = new oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo(maxRows); +}; +oimo_dynamics_constraint_solver_direct_BoundaryBuilder.__name__ = true; +oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { + buildBoundariesRecursive: function(info,i) { + if(i == info.numRows) { + if(this.boundaries[this.numBoundaries] == null) { + this.boundaries[this.numBoundaries] = new oimo_dynamics_constraint_solver_direct_Boundary(this.maxRows); + } + this.boundaries[this.numBoundaries++].init(this.bbInfo); + return; + } + var row = info.rows[i]; + var lowerLimitEnabled = row.minImpulse > -1e65536; + var upperLimitEnabled = row.maxImpulse < 1e65536; + if(row.minImpulse == 0 && row.maxImpulse == 0) { + var _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = 0; + _this.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + return; + } + var _this1 = this.bbInfo; + _this1.iUnbounded[_this1.numUnbounded] = i; + _this1.numUnbounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numUnbounded--; + if(lowerLimitEnabled) { + var _this2 = this.bbInfo; + _this2.iBounded[_this2.numBounded] = i; + _this2.signs[_this2.numBounded] = -1; + _this2.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + } + if(upperLimitEnabled) { + var _this3 = this.bbInfo; + _this3.iBounded[_this3.numBounded] = i; + _this3.signs[_this3.numBounded] = 1; + _this3.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + } + } + ,buildBoundaries: function(info) { + this.numBoundaries = 0; + var _this = this.bbInfo; + _this.numBounded = 0; + _this.numUnbounded = 0; + this.buildBoundariesRecursive(info,0); + } + ,__class__: oimo_dynamics_constraint_solver_direct_BoundaryBuilder +}; +var oimo_dynamics_constraint_solver_direct_BoundarySelector = function(n) { + this.n = n; + this.indices = new Array(n); + this.tmpIndices = new Array(n); + var _g = 0; + while(_g < n) { + var i = _g++; + this.indices[i] = i; + } +}; +oimo_dynamics_constraint_solver_direct_BoundarySelector.__name__ = true; +oimo_dynamics_constraint_solver_direct_BoundarySelector.prototype = { + getIndex: function(i) { + return this.indices[i]; + } + ,select: function(index) { + var i = 0; + while(this.indices[i] != index) ++i; + while(i > 0) { + var tmp = this.indices[i]; + this.indices[i] = this.indices[i - 1]; + this.indices[i - 1] = tmp; + --i; + } + } + ,setSize: function(size) { + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = this.n; + while(_g < _g1) { + var idx = this.indices[_g++]; + if(idx < size) { + this.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + this.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = this.indices; + this.indices = this.tmpIndices; + this.tmpIndices = tmp; + } + ,__class__: oimo_dynamics_constraint_solver_direct_BoundarySelector +}; +var oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver = function(joint) { + oimo_dynamics_constraint_ConstraintSolver.call(this); + this.joint = joint; + this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); + var maxRows = oimo_common_Setting.maxJacobianRows; + this.massMatrix = new oimo_dynamics_constraint_solver_direct_MassMatrix(maxRows); + this.boundaryBuilder = new oimo_dynamics_constraint_solver_direct_BoundaryBuilder(maxRows); + this.massData = new Array(maxRows); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); + var numMaxBoundaries = this.boundaryBuilder.boundaries.length; + this.velBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); + this.posBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); + this.relVels = new Array(maxRows); + this.impulses = new Array(maxRows); + this.dImpulses = new Array(maxRows); + this.dTotalImpulses = new Array(maxRows); + var _g2 = 0; + while(_g2 < maxRows) { + var i = _g2++; + this.relVels[i] = 0; + this.impulses[i] = 0; + this.dImpulses[i] = 0; + this.dTotalImpulses[i] = 0; + } +}; +oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.__name__ = true; +oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; +oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ + preSolveVelocity: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.velBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + } + ,warmStart: function(timeStep) { + var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + factor *= timeStep.dtRatio; + if(factor <= 0) { + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var _this = this.info.rows[_g++].impulse; + _this.impulse = 0; + _this.impulseM = 0; + _this.impulseP = 0; + } + return; + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i = _g2++; + var row = this.info.rows[i]; + var imp = row.impulse; + var impulse = imp.impulse * factor; + if(impulse < row.minImpulse) { + impulse = row.minImpulse; + } else if(impulse > row.maxImpulse) { + impulse = row.maxImpulse; + } + imp.impulse = impulse; + if(row.motorMaxImpulse > 0) { + var impulseM = imp.impulseM * factor; + var max = row.motorMaxImpulse; + if(impulseM < -max) { + impulseM = -max; + } else if(impulseM > max) { + impulseM = max; + } + imp.impulseM = impulseM; + } else { + imp.impulseM = 0; + } + this.dImpulses[i] = imp.impulse + imp.impulseM; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g3 = 0; + var _g12 = this.info.numRows; + while(_g3 < _g12) { + var i1 = _g3++; + var j = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp1 = impulses[i1]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp1; + lv1Y += md.invMLin1Y * imp1; + lv1Z += md.invMLin1Z * imp1; + lv2X += md.invMLin2X * -imp1; + lv2Y += md.invMLin2Y * -imp1; + lv2Z += md.invMLin2Z * -imp1; + linearSet = true; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp1; + av1Y += md.invMAng1Y * imp1; + av1Z += md.invMAng1Z * imp1; + av2X += md.invMAng2X * -imp1; + av2Y += md.invMAng2Y * -imp1; + av2Z += md.invMAng2Z * -imp1; + angularSet = true; + } + } + if(linearSet) { + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + } + if(angularSet) { + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + } + ,solveVelocity: function() { + var numRows = this.info.numRows; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + while(_g < numRows) { + var i = _g++; + var row = this.info.rows[i]; + var j = row.jacobian; + var relVel = 0; + relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + this.relVels[i] = relVel; + this.impulses[i] = row.impulse.impulse; + this.dTotalImpulses[i] = 0; + } + var invMass = this.massMatrix._invMassWithoutCfm; + var _g2 = 0; + while(_g2 < numRows) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var imp = row1.impulse; + if(row1.motorMaxImpulse > 0) { + var oldImpulseM = imp.impulseM; + var impulseM = oldImpulseM + this.massData[i1].massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); + var maxImpulseM = row1.motorMaxImpulse; + if(impulseM < -maxImpulseM) { + impulseM = -maxImpulseM; + } else if(impulseM > maxImpulseM) { + impulseM = maxImpulseM; + } + imp.impulseM = impulseM; + var dImpulseM = impulseM - oldImpulseM; + this.dTotalImpulses[i1] = dImpulseM; + var _g21 = 0; + while(_g21 < numRows) { + var j1 = _g21++; + var _g3 = this.relVels; + _g3[j1] = _g3[j1] + dImpulseM * invMass[i1][j1]; + } + } + } + var solved = false; + var _g4 = 0; + var _g5 = this.boundaryBuilder.numBoundaries; + while(_g4 < _g5) { + var idx = this.velBoundarySelector.indices[_g4++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { + var _g41 = 0; + while(_g41 < numRows) { + var j2 = _g41++; + var dimp = this.dImpulses[j2]; + this.info.rows[j2].impulse.impulse += dimp; + var _g51 = this.dTotalImpulses; + _g51[j2] = _g51[j2] + dimp; + } + var impulses = this.dTotalImpulses; + var linearSet = false; + var angularSet = false; + var lv1X1; + var lv1Y1; + var lv1Z1; + var lv2X1; + var lv2Y1; + var lv2Z1; + var av1X1; + var av1Y1; + var av1Z1; + var av2X1; + var av2Y1; + var av2Z1; + lv1X1 = this._b1._velX; + lv1Y1 = this._b1._velY; + lv1Z1 = this._b1._velZ; + lv2X1 = this._b2._velX; + lv2Y1 = this._b2._velY; + lv2Z1 = this._b2._velZ; + av1X1 = this._b1._angVelX; + av1Y1 = this._b1._angVelY; + av1Z1 = this._b1._angVelZ; + av2X1 = this._b2._angVelX; + av2Y1 = this._b2._angVelY; + av2Z1 = this._b2._angVelZ; + var _g1 = 0; + var _g11 = this.info.numRows; + while(_g1 < _g11) { + var i2 = _g1++; + var j3 = this.info.rows[i2].jacobian; + var md = this.massData[i2]; + var imp1 = impulses[i2]; + if((j3.flag & 1) != 0) { + lv1X1 += md.invMLin1X * imp1; + lv1Y1 += md.invMLin1Y * imp1; + lv1Z1 += md.invMLin1Z * imp1; + lv2X1 += md.invMLin2X * -imp1; + lv2Y1 += md.invMLin2Y * -imp1; + lv2Z1 += md.invMLin2Z * -imp1; + linearSet = true; + } + if((j3.flag & 2) != 0) { + av1X1 += md.invMAng1X * imp1; + av1Y1 += md.invMAng1Y * imp1; + av1Z1 += md.invMAng1Z * imp1; + av2X1 += md.invMAng2X * -imp1; + av2Y1 += md.invMAng2Y * -imp1; + av2Z1 += md.invMAng2Z * -imp1; + angularSet = true; + } + } + if(linearSet) { + this._b1._velX = lv1X1; + this._b1._velY = lv1Y1; + this._b1._velZ = lv1Z1; + this._b2._velX = lv2X1; + this._b2._velY = lv2Y1; + this._b2._velZ = lv2Z1; + } + if(angularSet) { + this._b1._angVelX = av1X1; + this._b1._angVelY = av1Y1; + this._b1._angVelZ = av1Z1; + this._b2._angVelX = av2X1; + this._b2._angVelY = av2Y1; + this._b2._angVelZ = av2Z1; + } + var _this = this.velBoundarySelector; + var i3 = 0; + while(_this.indices[i3] != idx) ++i3; + while(i3 > 0) { + var tmp = _this.indices[i3]; + _this.indices[i3] = _this.indices[i3 - 1]; + _this.indices[i3 - 1] = tmp; + --i3; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:335:","could not find solution. (velocity)"); + return; + } + } + ,postSolveVelocity: function(timeStep) { + var linX; + var linY; + var linZ; + var angX; + var angY; + var angZ; + linX = 0; + linY = 0; + linZ = 0; + angX = 0; + angY = 0; + angZ = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; + var imp = row.impulse; + var j = row.jacobian; + if((j.flag & 1) != 0) { + linX += j.lin1X * imp.impulse; + linY += j.lin1Y * imp.impulse; + linZ += j.lin1Z * imp.impulse; + } else if((j.flag & 2) != 0) { + angX += j.ang1X * imp.impulse; + angY += j.ang1Y * imp.impulse; + angZ += j.ang1Z * imp.impulse; + } + } + this.joint._appliedForceX = linX * timeStep.invDt; + this.joint._appliedForceY = linY * timeStep.invDt; + this.joint._appliedForceZ = linZ * timeStep.invDt; + this.joint._appliedTorqueX = angX * timeStep.invDt; + this.joint._appliedTorqueY = angY * timeStep.invDt; + this.joint._appliedTorqueZ = angZ * timeStep.invDt; + } + ,preSolvePosition: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.posBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + } + ,solvePositionSplitImpulse: function() { + var numRows = this.info.numRows; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + while(_g < numRows) { + var i = _g++; + var row = this.info.rows[i]; + var j = row.jacobian; + var relVel = 0; + relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + this.relVels[i] = relVel; + this.impulses[i] = row.impulse.impulseP; + } + var solved = false; + var _g2 = 0; + var _g3 = this.boundaryBuilder.numBoundaries; + while(_g2 < _g3) { + var idx = this.posBoundarySelector.indices[_g2++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionSplitImpulseBaumgarte,false)) { + var _g21 = 0; + while(_g21 < numRows) { + var j1 = _g21++; + this.info.rows[j1].impulse.impulseP += this.dImpulses[j1]; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv1X1; + var lv1Y1; + var lv1Z1; + var lv2X1; + var lv2Y1; + var lv2Z1; + var av1X1; + var av1Y1; + var av1Z1; + var av2X1; + var av2Y1; + var av2Z1; + lv1X1 = this._b1._pseudoVelX; + lv1Y1 = this._b1._pseudoVelY; + lv1Z1 = this._b1._pseudoVelZ; + lv2X1 = this._b2._pseudoVelX; + lv2Y1 = this._b2._pseudoVelY; + lv2Z1 = this._b2._pseudoVelZ; + av1X1 = this._b1._angPseudoVelX; + av1Y1 = this._b1._angPseudoVelY; + av1Z1 = this._b1._angPseudoVelZ; + av2X1 = this._b2._angPseudoVelX; + av2Y1 = this._b2._angPseudoVelY; + av2Z1 = this._b2._angPseudoVelZ; + var _g1 = 0; + var _g11 = this.info.numRows; + while(_g1 < _g11) { + var i1 = _g1++; + var j2 = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp = impulses[i1]; + if((j2.flag & 1) != 0) { + lv1X1 += md.invMLin1X * imp; + lv1Y1 += md.invMLin1Y * imp; + lv1Z1 += md.invMLin1Z * imp; + lv2X1 += md.invMLin2X * -imp; + lv2Y1 += md.invMLin2Y * -imp; + lv2Z1 += md.invMLin2Z * -imp; + linearSet = true; + } + if((j2.flag & 2) != 0) { + av1X1 += md.invMAng1X * imp; + av1Y1 += md.invMAng1Y * imp; + av1Z1 += md.invMAng1Z * imp; + av2X1 += md.invMAng2X * -imp; + av2Y1 += md.invMAng2Y * -imp; + av2Z1 += md.invMAng2Z * -imp; + angularSet = true; + } + } + if(linearSet) { + this._b1._pseudoVelX = lv1X1; + this._b1._pseudoVelY = lv1Y1; + this._b1._pseudoVelZ = lv1Z1; + this._b2._pseudoVelX = lv2X1; + this._b2._pseudoVelY = lv2Y1; + this._b2._pseudoVelZ = lv2Z1; + } + if(angularSet) { + this._b1._angPseudoVelX = av1X1; + this._b1._angPseudoVelY = av1Y1; + this._b1._angPseudoVelZ = av1Z1; + this._b2._angPseudoVelX = av2X1; + this._b2._angPseudoVelY = av2Y1; + this._b2._angPseudoVelZ = av2Z1; + } + var _this = this.posBoundarySelector; + var i2 = 0; + while(_this.indices[i2] != idx) ++i2; + while(i2 > 0) { + var tmp = _this.indices[i2]; + _this.indices[i2] = _this.indices[i2 - 1]; + _this.indices[i2 - 1] = tmp; + --i2; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:450:","could not find solution. (split impulse)"); + return; + } + } + ,solvePositionNgs: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.posBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var idx = _this2.indices[_g++]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + var numRows = this.info.numRows; + var _g2 = 0; + while(_g2 < numRows) { + var i = _g2++; + var imp = this.info.rows[i].impulse; + this.relVels[i] = 0; + this.impulses[i] = imp.impulseP; + } + var solved = false; + var _g21 = 0; + var _g3 = this.boundaryBuilder.numBoundaries; + while(_g21 < _g3) { + var idx1 = this.posBoundarySelector.indices[_g21++]; + if(this.boundaryBuilder.boundaries[idx1].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { + var _g22 = 0; + while(_g22 < numRows) { + var j = _g22++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g4 = 0; + var _g11 = this.info.numRows; + while(_g4 < _g11) { + var i1 = _g4++; + var j1 = this.info.rows[i1].jacobian; + var md = this.massData[i1]; + var imp1 = impulses[i1]; + if((j1.flag & 1) != 0) { + lv1X += md.invMLin1X * imp1; + lv1Y += md.invMLin1Y * imp1; + lv1Z += md.invMLin1Z * imp1; + lv2X += md.invMLin2X * -imp1; + lv2Y += md.invMLin2Y * -imp1; + lv2Z += md.invMLin2Z * -imp1; + linearSet = true; + } + if((j1.flag & 2) != 0) { + av1X += md.invMAng1X * imp1; + av1Y += md.invMAng1Y * imp1; + av1Z += md.invMAng1Z * imp1; + av2X += md.invMAng2X * -imp1; + av2Y += md.invMAng2Y * -imp1; + av2Z += md.invMAng2Z * -imp1; + angularSet = true; + } + } + if(linearSet) { + var _this3 = this._b1; + _this3._transform._positionX += lv1X; + _this3._transform._positionY += lv1Y; + _this3._transform._positionZ += lv1Z; + var _this4 = this._b2; + _this4._transform._positionX += lv2X; + _this4._transform._positionY += lv2Y; + _this4._transform._positionZ += lv2Z; + } + if(angularSet) { + var _this5 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this5._transform._rotation00; + var e11 = _this5._transform._rotation11; + var e22 = _this5._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + qY = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + qZ = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; + qZ = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qW = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; + qZ = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this5._transform._rotation00 = 1 - yy - zz; + _this5._transform._rotation01 = xy - wz; + _this5._transform._rotation02 = xz + wy; + _this5._transform._rotation10 = xy + wz; + _this5._transform._rotation11 = 1 - xx - zz; + _this5._transform._rotation12 = yz - wx; + _this5._transform._rotation20 = xz - wy; + _this5._transform._rotation21 = yz + wx; + _this5._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this5._transform._rotation00 * _this5._invLocalInertia00 + _this5._transform._rotation01 * _this5._invLocalInertia10 + _this5._transform._rotation02 * _this5._invLocalInertia20; + __tmp__01 = _this5._transform._rotation00 * _this5._invLocalInertia01 + _this5._transform._rotation01 * _this5._invLocalInertia11 + _this5._transform._rotation02 * _this5._invLocalInertia21; + __tmp__02 = _this5._transform._rotation00 * _this5._invLocalInertia02 + _this5._transform._rotation01 * _this5._invLocalInertia12 + _this5._transform._rotation02 * _this5._invLocalInertia22; + __tmp__10 = _this5._transform._rotation10 * _this5._invLocalInertia00 + _this5._transform._rotation11 * _this5._invLocalInertia10 + _this5._transform._rotation12 * _this5._invLocalInertia20; + __tmp__11 = _this5._transform._rotation10 * _this5._invLocalInertia01 + _this5._transform._rotation11 * _this5._invLocalInertia11 + _this5._transform._rotation12 * _this5._invLocalInertia21; + __tmp__12 = _this5._transform._rotation10 * _this5._invLocalInertia02 + _this5._transform._rotation11 * _this5._invLocalInertia12 + _this5._transform._rotation12 * _this5._invLocalInertia22; + __tmp__20 = _this5._transform._rotation20 * _this5._invLocalInertia00 + _this5._transform._rotation21 * _this5._invLocalInertia10 + _this5._transform._rotation22 * _this5._invLocalInertia20; + __tmp__21 = _this5._transform._rotation20 * _this5._invLocalInertia01 + _this5._transform._rotation21 * _this5._invLocalInertia11 + _this5._transform._rotation22 * _this5._invLocalInertia21; + __tmp__22 = _this5._transform._rotation20 * _this5._invLocalInertia02 + _this5._transform._rotation21 * _this5._invLocalInertia12 + _this5._transform._rotation22 * _this5._invLocalInertia22; + _this5._invInertia00 = __tmp__00; + _this5._invInertia01 = __tmp__01; + _this5._invInertia02 = __tmp__02; + _this5._invInertia10 = __tmp__10; + _this5._invInertia11 = __tmp__11; + _this5._invInertia12 = __tmp__12; + _this5._invInertia20 = __tmp__20; + _this5._invInertia21 = __tmp__21; + _this5._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this5._invInertia00 * _this5._transform._rotation00 + _this5._invInertia01 * _this5._transform._rotation01 + _this5._invInertia02 * _this5._transform._rotation02; + __tmp__011 = _this5._invInertia00 * _this5._transform._rotation10 + _this5._invInertia01 * _this5._transform._rotation11 + _this5._invInertia02 * _this5._transform._rotation12; + __tmp__021 = _this5._invInertia00 * _this5._transform._rotation20 + _this5._invInertia01 * _this5._transform._rotation21 + _this5._invInertia02 * _this5._transform._rotation22; + __tmp__101 = _this5._invInertia10 * _this5._transform._rotation00 + _this5._invInertia11 * _this5._transform._rotation01 + _this5._invInertia12 * _this5._transform._rotation02; + __tmp__111 = _this5._invInertia10 * _this5._transform._rotation10 + _this5._invInertia11 * _this5._transform._rotation11 + _this5._invInertia12 * _this5._transform._rotation12; + __tmp__121 = _this5._invInertia10 * _this5._transform._rotation20 + _this5._invInertia11 * _this5._transform._rotation21 + _this5._invInertia12 * _this5._transform._rotation22; + __tmp__201 = _this5._invInertia20 * _this5._transform._rotation00 + _this5._invInertia21 * _this5._transform._rotation01 + _this5._invInertia22 * _this5._transform._rotation02; + __tmp__211 = _this5._invInertia20 * _this5._transform._rotation10 + _this5._invInertia21 * _this5._transform._rotation11 + _this5._invInertia22 * _this5._transform._rotation12; + __tmp__221 = _this5._invInertia20 * _this5._transform._rotation20 + _this5._invInertia21 * _this5._transform._rotation21 + _this5._invInertia22 * _this5._transform._rotation22; + _this5._invInertia00 = __tmp__001; + _this5._invInertia01 = __tmp__011; + _this5._invInertia02 = __tmp__021; + _this5._invInertia10 = __tmp__101; + _this5._invInertia11 = __tmp__111; + _this5._invInertia12 = __tmp__121; + _this5._invInertia20 = __tmp__201; + _this5._invInertia21 = __tmp__211; + _this5._invInertia22 = __tmp__221; + _this5._invInertia00 *= _this5._rotFactor.x; + _this5._invInertia01 *= _this5._rotFactor.x; + _this5._invInertia02 *= _this5._rotFactor.x; + _this5._invInertia10 *= _this5._rotFactor.y; + _this5._invInertia11 *= _this5._rotFactor.y; + _this5._invInertia12 *= _this5._rotFactor.y; + _this5._invInertia20 *= _this5._rotFactor.z; + _this5._invInertia21 *= _this5._rotFactor.z; + _this5._invInertia22 *= _this5._rotFactor.z; + var _this6 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this6._transform._rotation00; + var e111 = _this6._transform._rotation11; + var e221 = _this6._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + qY1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + qZ1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; + qZ1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qW1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; + qZ1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this6._transform._rotation00 = 1 - yy1 - zz1; + _this6._transform._rotation01 = xy1 - wz1; + _this6._transform._rotation02 = xz1 + wy1; + _this6._transform._rotation10 = xy1 + wz1; + _this6._transform._rotation11 = 1 - xx1 - zz1; + _this6._transform._rotation12 = yz1 - wx1; + _this6._transform._rotation20 = xz1 - wy1; + _this6._transform._rotation21 = yz1 + wx1; + _this6._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this6._transform._rotation00 * _this6._invLocalInertia00 + _this6._transform._rotation01 * _this6._invLocalInertia10 + _this6._transform._rotation02 * _this6._invLocalInertia20; + __tmp__012 = _this6._transform._rotation00 * _this6._invLocalInertia01 + _this6._transform._rotation01 * _this6._invLocalInertia11 + _this6._transform._rotation02 * _this6._invLocalInertia21; + __tmp__022 = _this6._transform._rotation00 * _this6._invLocalInertia02 + _this6._transform._rotation01 * _this6._invLocalInertia12 + _this6._transform._rotation02 * _this6._invLocalInertia22; + __tmp__102 = _this6._transform._rotation10 * _this6._invLocalInertia00 + _this6._transform._rotation11 * _this6._invLocalInertia10 + _this6._transform._rotation12 * _this6._invLocalInertia20; + __tmp__112 = _this6._transform._rotation10 * _this6._invLocalInertia01 + _this6._transform._rotation11 * _this6._invLocalInertia11 + _this6._transform._rotation12 * _this6._invLocalInertia21; + __tmp__122 = _this6._transform._rotation10 * _this6._invLocalInertia02 + _this6._transform._rotation11 * _this6._invLocalInertia12 + _this6._transform._rotation12 * _this6._invLocalInertia22; + __tmp__202 = _this6._transform._rotation20 * _this6._invLocalInertia00 + _this6._transform._rotation21 * _this6._invLocalInertia10 + _this6._transform._rotation22 * _this6._invLocalInertia20; + __tmp__212 = _this6._transform._rotation20 * _this6._invLocalInertia01 + _this6._transform._rotation21 * _this6._invLocalInertia11 + _this6._transform._rotation22 * _this6._invLocalInertia21; + __tmp__222 = _this6._transform._rotation20 * _this6._invLocalInertia02 + _this6._transform._rotation21 * _this6._invLocalInertia12 + _this6._transform._rotation22 * _this6._invLocalInertia22; + _this6._invInertia00 = __tmp__002; + _this6._invInertia01 = __tmp__012; + _this6._invInertia02 = __tmp__022; + _this6._invInertia10 = __tmp__102; + _this6._invInertia11 = __tmp__112; + _this6._invInertia12 = __tmp__122; + _this6._invInertia20 = __tmp__202; + _this6._invInertia21 = __tmp__212; + _this6._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this6._invInertia00 * _this6._transform._rotation00 + _this6._invInertia01 * _this6._transform._rotation01 + _this6._invInertia02 * _this6._transform._rotation02; + __tmp__013 = _this6._invInertia00 * _this6._transform._rotation10 + _this6._invInertia01 * _this6._transform._rotation11 + _this6._invInertia02 * _this6._transform._rotation12; + __tmp__023 = _this6._invInertia00 * _this6._transform._rotation20 + _this6._invInertia01 * _this6._transform._rotation21 + _this6._invInertia02 * _this6._transform._rotation22; + __tmp__103 = _this6._invInertia10 * _this6._transform._rotation00 + _this6._invInertia11 * _this6._transform._rotation01 + _this6._invInertia12 * _this6._transform._rotation02; + __tmp__113 = _this6._invInertia10 * _this6._transform._rotation10 + _this6._invInertia11 * _this6._transform._rotation11 + _this6._invInertia12 * _this6._transform._rotation12; + __tmp__123 = _this6._invInertia10 * _this6._transform._rotation20 + _this6._invInertia11 * _this6._transform._rotation21 + _this6._invInertia12 * _this6._transform._rotation22; + __tmp__203 = _this6._invInertia20 * _this6._transform._rotation00 + _this6._invInertia21 * _this6._transform._rotation01 + _this6._invInertia22 * _this6._transform._rotation02; + __tmp__213 = _this6._invInertia20 * _this6._transform._rotation10 + _this6._invInertia21 * _this6._transform._rotation11 + _this6._invInertia22 * _this6._transform._rotation12; + __tmp__223 = _this6._invInertia20 * _this6._transform._rotation20 + _this6._invInertia21 * _this6._transform._rotation21 + _this6._invInertia22 * _this6._transform._rotation22; + _this6._invInertia00 = __tmp__003; + _this6._invInertia01 = __tmp__013; + _this6._invInertia02 = __tmp__023; + _this6._invInertia10 = __tmp__103; + _this6._invInertia11 = __tmp__113; + _this6._invInertia12 = __tmp__123; + _this6._invInertia20 = __tmp__203; + _this6._invInertia21 = __tmp__213; + _this6._invInertia22 = __tmp__223; + _this6._invInertia00 *= _this6._rotFactor.x; + _this6._invInertia01 *= _this6._rotFactor.x; + _this6._invInertia02 *= _this6._rotFactor.x; + _this6._invInertia10 *= _this6._rotFactor.y; + _this6._invInertia11 *= _this6._rotFactor.y; + _this6._invInertia12 *= _this6._rotFactor.y; + _this6._invInertia20 *= _this6._rotFactor.z; + _this6._invInertia21 *= _this6._rotFactor.z; + _this6._invInertia22 *= _this6._rotFactor.z; + } + var _this7 = this.posBoundarySelector; + var i2 = 0; + while(_this7.indices[i2] != idx1) ++i2; + while(i2 > 0) { + var tmp1 = _this7.indices[i2]; + _this7.indices[i2] = _this7.indices[i2 - 1]; + _this7.indices[i2 - 1] = tmp1; + --i2; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:502:","could not find solution. (NGS)"); + return; + } + } + ,postSolve: function() { + this.joint._syncAnchors(); + this.joint._checkDestruction(); + } + ,__class__: oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver +}); +var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { + this._size = size; + this.tmpMatrix = new Array(this._size); + this._invMass = new Array(this._size); + this._invMassWithoutCfm = new Array(this._size); + var _g = 0; + var _g1 = this._size; + while(_g < _g1) { + var i = _g++; + this.tmpMatrix[i] = new Array(this._size); + this._invMass[i] = new Array(this._size); + this._invMassWithoutCfm[i] = new Array(this._size); + var _g2 = 0; + var _g11 = this._size; + while(_g2 < _g11) { + var j = _g2++; + this.tmpMatrix[i][j] = 0; + this._invMass[i][j] = 0; + this._invMassWithoutCfm[i][j] = 0; + } + } + this._maxSubmatrixId = 1 << this._size; + this._cacheComputed = new Array(this._maxSubmatrixId); + this._cachedSubmatrices = new Array(this._maxSubmatrixId); + var _g21 = 0; + var _g3 = this._maxSubmatrixId; + while(_g21 < _g3) { + var i1 = _g21++; + var t = i1; + t = (i1 & 85) + (i1 >> 1 & 85); + t = (t & 51) + (t >> 2 & 51); + t = (t & 15) + (t >> 4 & 15); + var matrixSize = t; + var subMatrix = new Array(matrixSize); + var _g22 = 0; + while(_g22 < matrixSize) { + var j1 = _g22++; + subMatrix[j1] = new Array(matrixSize); + var _g23 = 0; + while(_g23 < matrixSize) subMatrix[j1][_g23++] = 0; + } + this._cacheComputed[i1] = false; + this._cachedSubmatrices[i1] = subMatrix; + } +}; +oimo_dynamics_constraint_solver_direct_MassMatrix.__name__ = true; +oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { + computeSubmatrix: function(id,indices,size) { + var _g = 0; + while(_g < size) { + var i = _g++; + var ii = indices[i]; + var _g1 = 0; + while(_g1 < size) { + var j = _g1++; + this.tmpMatrix[i][j] = this._invMass[ii][indices[j]]; + } + } + var src = this.tmpMatrix; + var dst = this._cachedSubmatrices[id]; + var srci; + var dsti; + var srcj; + var dstj; + var diag; + switch(size) { + case 4: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + break; + case 5: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srci = src[4]; + dsti = dst[4]; + diag = 1 / srci[4]; + dsti[4] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + dsti = dst[4]; + dst[0][4] = dsti[0]; + dst[1][4] = dsti[1]; + dst[2][4] = dsti[2]; + dst[3][4] = dsti[3]; + break; + case 6: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srci = src[4]; + dsti = dst[4]; + diag = 1 / srci[4]; + dsti[4] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[4] = -diag * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srci = src[5]; + dsti = dst[5]; + diag = 1 / srci[5]; + dsti[5] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + dsti[4] = dsti[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[3] = dstj[3] - dsti[3] * srcj[5]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[3] = dstj[3] - dsti[3] * srcj[5]; + dstj[4] = dstj[4] - dsti[4] * srcj[5]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + dsti = dst[4]; + dst[0][4] = dsti[0]; + dst[1][4] = dsti[1]; + dst[2][4] = dsti[2]; + dst[3][4] = dsti[3]; + dsti = dst[5]; + dst[0][5] = dsti[0]; + dst[1][5] = dsti[1]; + dst[2][5] = dsti[2]; + dst[3][5] = dsti[3]; + dst[4][5] = dsti[4]; + break; + default: + var _g2 = 0; + while(_g2 < size) { + var i1 = _g2++; + srci = src[i1]; + dsti = dst[i1]; + var diag1 = 1 / srci[i1]; + dsti[i1] = diag1; + var _g21 = 0; + while(_g21 < i1) { + var j1 = _g21++; + dsti[j1] = dsti[j1] * diag1; + } + var _g4 = i1 + 1; + while(_g4 < size) { + var j2 = _g4++; + srci[j2] = srci[j2] * diag1; + } + var _g6 = 0; + while(_g6 < i1) { + var j3 = _g6++; + srcj = src[j3]; + dstj = dst[j3]; + var _g61 = 0; + var _g7 = j3 + 1; + while(_g61 < _g7) { + var k = _g61++; + dstj[k] = dstj[k] - dsti[k] * srcj[i1]; + } + var _g8 = i1 + 1; + while(_g8 < size) { + var k1 = _g8++; + srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; + } + } + var _g81 = i1 + 1; + while(_g81 < size) { + var j4 = _g81++; + srcj = src[j4]; + dstj = dst[j4]; + var _g82 = 0; + while(_g82 < i1) { + var k2 = _g82++; + dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; + } + dstj[i1] = -diag1 * srcj[i1]; + var _g10 = i1 + 1; + while(_g10 < size) { + var k3 = _g10++; + srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; + } + } + } + var _g41 = 1; + while(_g41 < size) { + var i2 = _g41++; + dsti = dst[i2]; + var _g42 = 0; + while(_g42 < i2) { + var j5 = _g42++; + dst[j5][i2] = dsti[j5]; + } + } + } + } + ,computeInvMass: function(info,massData) { + var invMass = this._invMass; + var invMassWithoutCfm = this._invMassWithoutCfm; + var numRows = info.numRows; + var b1 = info.b1; + var b2 = info.b2; + var invM1 = b1._invMass; + var invM2 = b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = b1._invInertia00; + invI101 = b1._invInertia01; + invI102 = b1._invInertia02; + invI110 = b1._invInertia10; + invI111 = b1._invInertia11; + invI112 = b1._invInertia12; + invI120 = b1._invInertia20; + invI121 = b1._invInertia21; + invI122 = b1._invInertia22; + invI200 = b2._invInertia00; + invI201 = b2._invInertia01; + invI202 = b2._invInertia02; + invI210 = b2._invInertia10; + invI211 = b2._invInertia11; + invI212 = b2._invInertia12; + invI220 = b2._invInertia20; + invI221 = b2._invInertia21; + invI222 = b2._invInertia22; + var _g = 0; + while(_g < numRows) { + var i = _g++; + var j = info.rows[i].jacobian; + var md = massData[i]; + j.updateSparsity(); + if((j.flag & 1) != 0) { + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + } else { + md.invMLin1X = 0; + md.invMLin1Y = 0; + md.invMLin1Z = 0; + md.invMLin2X = 0; + md.invMLin2Y = 0; + md.invMLin2Z = 0; + } + if((j.flag & 2) != 0) { + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + } else { + md.invMAng1X = 0; + md.invMAng1Y = 0; + md.invMAng1Z = 0; + md.invMAng2X = 0; + md.invMAng2Y = 0; + md.invMAng2Z = 0; + } + } + var _g2 = 0; + while(_g2 < numRows) { + var i1 = _g2++; + var j1 = info.rows[i1].jacobian; + var _g21 = i1; + while(_g21 < numRows) { + var j2 = _g21++; + var md2 = massData[j2]; + var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); + if(i1 == j2) { + invMass[i1][j2] = val + info.rows[i1].cfm; + invMassWithoutCfm[i1][j2] = val; + md2.mass = val + info.rows[i1].cfm; + md2.massWithoutCfm = val; + if(md2.mass != 0) { + md2.mass = 1 / md2.mass; + } + if(md2.massWithoutCfm != 0) { + md2.massWithoutCfm = 1 / md2.massWithoutCfm; + } + } else { + invMass[i1][j2] = val; + invMass[j2][i1] = val; + invMassWithoutCfm[i1][j2] = val; + invMassWithoutCfm[j2][i1] = val; + } + } + } + var _g1 = 0; + var _g11 = this._maxSubmatrixId; + while(_g1 < _g11) this._cacheComputed[_g1++] = false; + } + ,__class__: oimo_dynamics_constraint_solver_direct_MassMatrix +}; +var oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver = function(constraint) { + oimo_dynamics_constraint_ConstraintSolver.call(this); + this.constraint = constraint; + this.info = new oimo_dynamics_constraint_info_contact_ContactSolverInfo(); + this.massData = new Array(oimo_common_Setting.maxManifoldPoints); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow(); +}; +oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.__name__ = true; +oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; +oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ + preSolveVelocity: function(timeStep) { + this.constraint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + var jt = row.jacobianT; + var jb = row.jacobianB; + md.invMLinT1X = jt.lin1X * invM1; + md.invMLinT1Y = jt.lin1Y * invM1; + md.invMLinT1Z = jt.lin1Z * invM1; + md.invMLinT2X = jt.lin2X * invM2; + md.invMLinT2Y = jt.lin2Y * invM2; + md.invMLinT2Z = jt.lin2Z * invM2; + md.invMLinB1X = jb.lin1X * invM1; + md.invMLinB1Y = jb.lin1Y * invM1; + md.invMLinB1Z = jb.lin1Z * invM1; + md.invMLinB2X = jb.lin2X * invM2; + md.invMLinB2Y = jb.lin2Y * invM2; + md.invMLinB2Z = jb.lin2Z * invM2; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = invI100 * jt.ang1X + invI101 * jt.ang1Y + invI102 * jt.ang1Z; + __tmp__Y2 = invI110 * jt.ang1X + invI111 * jt.ang1Y + invI112 * jt.ang1Z; + __tmp__Z2 = invI120 * jt.ang1X + invI121 * jt.ang1Y + invI122 * jt.ang1Z; + md.invMAngT1X = __tmp__X2; + md.invMAngT1Y = __tmp__Y2; + md.invMAngT1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = invI200 * jt.ang2X + invI201 * jt.ang2Y + invI202 * jt.ang2Z; + __tmp__Y3 = invI210 * jt.ang2X + invI211 * jt.ang2Y + invI212 * jt.ang2Z; + __tmp__Z3 = invI220 * jt.ang2X + invI221 * jt.ang2Y + invI222 * jt.ang2Z; + md.invMAngT2X = __tmp__X3; + md.invMAngT2Y = __tmp__Y3; + md.invMAngT2Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = invI100 * jb.ang1X + invI101 * jb.ang1Y + invI102 * jb.ang1Z; + __tmp__Y4 = invI110 * jb.ang1X + invI111 * jb.ang1Y + invI112 * jb.ang1Z; + __tmp__Z4 = invI120 * jb.ang1X + invI121 * jb.ang1Y + invI122 * jb.ang1Z; + md.invMAngB1X = __tmp__X4; + md.invMAngB1Y = __tmp__Y4; + md.invMAngB1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = invI200 * jb.ang2X + invI201 * jb.ang2Y + invI202 * jb.ang2Z; + __tmp__Y5 = invI210 * jb.ang2X + invI211 * jb.ang2Y + invI212 * jb.ang2Z; + __tmp__Z5 = invI220 * jb.ang2X + invI221 * jb.ang2Y + invI222 * jb.ang2Z; + md.invMAngB2X = __tmp__X5; + md.invMAngB2Y = __tmp__Y5; + md.invMAngB2Z = __tmp__Z5; + var invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); + var invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); + var invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); + var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB01; + if(invDet != 0) { + invDet = 1 / invDet; + } + md.massTB00 = invMassTB11 * invDet; + md.massTB01 = -invMassTB01 * invDet; + md.massTB10 = -invMassTB01 * invDet; + md.massTB11 = invMassTB00 * invDet; + } + } + ,warmStart: function(timeStep) { + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var md = this.massData[i]; + var jt = row.jacobianT; + var jb = row.jacobianB; + var impulseN = imp.impulseN; + var impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; + var impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; + imp.impulseT = impulseT; + imp.impulseB = impulseB; + imp.impulseN *= timeStep.dtRatio; + imp.impulseT *= timeStep.dtRatio; + imp.impulseB *= timeStep.dtRatio; + lv1X += md.invMLinN1X * impulseN; + lv1Y += md.invMLinN1Y * impulseN; + lv1Z += md.invMLinN1Z * impulseN; + lv1X += md.invMLinT1X * impulseT; + lv1Y += md.invMLinT1Y * impulseT; + lv1Z += md.invMLinT1Z * impulseT; + lv1X += md.invMLinB1X * impulseB; + lv1Y += md.invMLinB1Y * impulseB; + lv1Z += md.invMLinB1Z * impulseB; + lv2X += md.invMLinN2X * -impulseN; + lv2Y += md.invMLinN2Y * -impulseN; + lv2Z += md.invMLinN2Z * -impulseN; + lv2X += md.invMLinT2X * -impulseT; + lv2Y += md.invMLinT2Y * -impulseT; + lv2Z += md.invMLinT2Z * -impulseT; + lv2X += md.invMLinB2X * -impulseB; + lv2Y += md.invMLinB2Y * -impulseB; + lv2Z += md.invMLinB2Z * -impulseB; + av1X += md.invMAngN1X * impulseN; + av1Y += md.invMAngN1Y * impulseN; + av1Z += md.invMAngN1Z * impulseN; + av1X += md.invMAngT1X * impulseT; + av1Y += md.invMAngT1Y * impulseT; + av1Z += md.invMAngT1Z * impulseT; + av1X += md.invMAngB1X * impulseB; + av1Y += md.invMAngB1Y * impulseB; + av1Z += md.invMAngB1Z * impulseB; + av2X += md.invMAngN2X * -impulseN; + av2Y += md.invMAngN2Y * -impulseN; + av2Z += md.invMAngN2Z * -impulseN; + av2X += md.invMAngT2X * -impulseT; + av2Y += md.invMAngT2Y * -impulseT; + av2Z += md.invMAngT2Z * -impulseT; + av2X += md.invMAngB2X * -impulseB; + av2Y += md.invMAngB2Y * -impulseB; + av2Z += md.invMAngB2Z * -impulseB; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + ,solveVelocity: function() { + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var rvt = 0; + var j = row.jacobianT; + rvt += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvt -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvt += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvt -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var rvb = 0; + j = row.jacobianB; + rvb += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvb -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvb += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvb -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); + var impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); + var oldImpulseT = imp.impulseT; + var oldImpulseB = imp.impulseB; + imp.impulseT += impulseT; + imp.impulseB += impulseB; + var maxImpulse = row.friction * imp.impulseN; + if(maxImpulse == 0) { + imp.impulseT = 0; + imp.impulseB = 0; + } else { + var impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; + if(impulseLengthSq > maxImpulse * maxImpulse) { + var invL = maxImpulse / Math.sqrt(impulseLengthSq); + imp.impulseT *= invL; + imp.impulseB *= invL; + } + } + impulseT = imp.impulseT - oldImpulseT; + impulseB = imp.impulseB - oldImpulseB; + lv1X += md.invMLinT1X * impulseT; + lv1Y += md.invMLinT1Y * impulseT; + lv1Z += md.invMLinT1Z * impulseT; + lv1X += md.invMLinB1X * impulseB; + lv1Y += md.invMLinB1Y * impulseB; + lv1Z += md.invMLinB1Z * impulseB; + lv2X += md.invMLinT2X * -impulseT; + lv2Y += md.invMLinT2Y * -impulseT; + lv2Z += md.invMLinT2Z * -impulseT; + lv2X += md.invMLinB2X * -impulseB; + lv2Y += md.invMLinB2Y * -impulseB; + lv2Z += md.invMLinB2Z * -impulseB; + av1X += md.invMAngT1X * impulseT; + av1Y += md.invMAngT1Y * impulseT; + av1Z += md.invMAngT1Z * impulseT; + av1X += md.invMAngB1X * impulseB; + av1Y += md.invMAngB1Y * impulseB; + av1Z += md.invMAngB1Z * impulseB; + av2X += md.invMAngT2X * -impulseT; + av2Y += md.invMAngT2Y * -impulseT; + av2Z += md.invMAngT2Z * -impulseT; + av2X += md.invMAngB2X * -impulseB; + av2Y += md.invMAngB2Y * -impulseB; + av2Z += md.invMAngB2Z * -impulseB; + } + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp1 = row1.impulse; + var rvn = 0; + var j1 = row1.jacobianN; + rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseN = (row1.rhs - rvn) * md1.massN; + var oldImpulseN = imp1.impulseN; + imp1.impulseN += impulseN; + if(imp1.impulseN < 0) { + imp1.impulseN = 0; + } + impulseN = imp1.impulseN - oldImpulseN; + lv1X += md1.invMLinN1X * impulseN; + lv1Y += md1.invMLinN1Y * impulseN; + lv1Z += md1.invMLinN1Z * impulseN; + lv2X += md1.invMLinN2X * -impulseN; + lv2Y += md1.invMLinN2Y * -impulseN; + lv2Z += md1.invMLinN2Z * -impulseN; + av1X += md1.invMAngN1X * impulseN; + av1Y += md1.invMAngN1Y * impulseN; + av1Z += md1.invMAngN1Z * impulseN; + av2X += md1.invMAngN2X * -impulseN; + av2Y += md1.invMAngN2Y * -impulseN; + av2Z += md1.invMAngN2Z * -impulseN; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + ,preSolvePosition: function(timeStep) { + this.constraint._syncManifold(); + this.constraint._getPositionSolverInfo(this.info); + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var md = this.massData[i]; + var j = this.info.rows[i].jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + } + ,solvePositionSplitImpulse: function() { + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobianN; + var rvn = 0; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs - rvn) * md.massN * oimo_common_Setting.positionSplitImpulseBaumgarte; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < 0) { + imp.impulseP = 0; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md.invMLinN1X * impulseP; + lv1Y += md.invMLinN1Y * impulseP; + lv1Z += md.invMLinN1Z * impulseP; + lv2X += md.invMLinN2X * -impulseP; + lv2Y += md.invMLinN2Y * -impulseP; + lv2Z += md.invMLinN2Z * -impulseP; + av1X += md.invMAngN1X * impulseP; + av1Y += md.invMAngN1Y * impulseP; + av1Z += md.invMAngN1Z * impulseP; + av2X += md.invMAngN2X * -impulseP; + av2Y += md.invMAngN2Y * -impulseP; + av2Z += md.invMAngN2Z * -impulseP; + } + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + ,solvePositionNgs: function(timeStep) { + this.constraint._syncManifold(); + this.constraint._getPositionSolverInfo(this.info); + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var md = this.massData[i]; + var j = this.info.rows[i].jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + } + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp = row.impulse; + var j1 = row.jacobianN; + var rvn = 0; + rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseP = (row.rhs - rvn) * md1.massN * oimo_common_Setting.positionNgsBaumgarte; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < 0) { + imp.impulseP = 0; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md1.invMLinN1X * impulseP; + lv1Y += md1.invMLinN1Y * impulseP; + lv1Z += md1.invMLinN1Z * impulseP; + lv2X += md1.invMLinN2X * -impulseP; + lv2Y += md1.invMLinN2Y * -impulseP; + lv2Z += md1.invMLinN2Z * -impulseP; + av1X += md1.invMAngN1X * impulseP; + av1Y += md1.invMAngN1Y * impulseP; + av1Z += md1.invMAngN1Z * impulseP; + av2X += md1.invMAngN2X * -impulseP; + av2Y += md1.invMAngN2Y * -impulseP; + av2Z += md1.invMAngN2Z * -impulseP; + } + var _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + var _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; + var _this2 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this2._transform._rotation00; + var e11 = _this2._transform._rotation11; + var e22 = _this2._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this2._transform._rotation00 = 1 - yy - zz; + _this2._transform._rotation01 = xy - wz; + _this2._transform._rotation02 = xz + wy; + _this2._transform._rotation10 = xy + wz; + _this2._transform._rotation11 = 1 - xx - zz; + _this2._transform._rotation12 = yz - wx; + _this2._transform._rotation20 = xz - wy; + _this2._transform._rotation21 = yz + wx; + _this2._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; + __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; + __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; + __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; + __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; + __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; + __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; + __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; + __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; + _this2._invInertia00 = __tmp__00; + _this2._invInertia01 = __tmp__01; + _this2._invInertia02 = __tmp__02; + _this2._invInertia10 = __tmp__10; + _this2._invInertia11 = __tmp__11; + _this2._invInertia12 = __tmp__12; + _this2._invInertia20 = __tmp__20; + _this2._invInertia21 = __tmp__21; + _this2._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; + __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; + __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; + __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; + __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; + __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; + __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; + __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; + __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; + _this2._invInertia00 = __tmp__001; + _this2._invInertia01 = __tmp__011; + _this2._invInertia02 = __tmp__021; + _this2._invInertia10 = __tmp__101; + _this2._invInertia11 = __tmp__111; + _this2._invInertia12 = __tmp__121; + _this2._invInertia20 = __tmp__201; + _this2._invInertia21 = __tmp__211; + _this2._invInertia22 = __tmp__221; + _this2._invInertia00 *= _this2._rotFactor.x; + _this2._invInertia01 *= _this2._rotFactor.x; + _this2._invInertia02 *= _this2._rotFactor.x; + _this2._invInertia10 *= _this2._rotFactor.y; + _this2._invInertia11 *= _this2._rotFactor.y; + _this2._invInertia12 *= _this2._rotFactor.y; + _this2._invInertia20 *= _this2._rotFactor.z; + _this2._invInertia21 *= _this2._rotFactor.z; + _this2._invInertia22 *= _this2._rotFactor.z; + var _this3 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this3._transform._rotation00; + var e111 = _this3._transform._rotation11; + var e221 = _this3._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this3._transform._rotation00 = 1 - yy1 - zz1; + _this3._transform._rotation01 = xy1 - wz1; + _this3._transform._rotation02 = xz1 + wy1; + _this3._transform._rotation10 = xy1 + wz1; + _this3._transform._rotation11 = 1 - xx1 - zz1; + _this3._transform._rotation12 = yz1 - wx1; + _this3._transform._rotation20 = xz1 - wy1; + _this3._transform._rotation21 = yz1 + wx1; + _this3._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; + __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; + __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; + __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; + __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; + __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; + __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; + __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; + __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; + _this3._invInertia00 = __tmp__002; + _this3._invInertia01 = __tmp__012; + _this3._invInertia02 = __tmp__022; + _this3._invInertia10 = __tmp__102; + _this3._invInertia11 = __tmp__112; + _this3._invInertia12 = __tmp__122; + _this3._invInertia20 = __tmp__202; + _this3._invInertia21 = __tmp__212; + _this3._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; + __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; + __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; + __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; + __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; + __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; + __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; + __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; + __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; + _this3._invInertia00 = __tmp__003; + _this3._invInertia01 = __tmp__013; + _this3._invInertia02 = __tmp__023; + _this3._invInertia10 = __tmp__103; + _this3._invInertia11 = __tmp__113; + _this3._invInertia12 = __tmp__123; + _this3._invInertia20 = __tmp__203; + _this3._invInertia21 = __tmp__213; + _this3._invInertia22 = __tmp__223; + _this3._invInertia00 *= _this3._rotFactor.x; + _this3._invInertia01 *= _this3._rotFactor.x; + _this3._invInertia02 *= _this3._rotFactor.x; + _this3._invInertia10 *= _this3._rotFactor.y; + _this3._invInertia11 *= _this3._rotFactor.y; + _this3._invInertia12 *= _this3._rotFactor.y; + _this3._invInertia20 *= _this3._rotFactor.z; + _this3._invInertia21 *= _this3._rotFactor.z; + _this3._invInertia22 *= _this3._rotFactor.z; + } + ,postSolve: function() { + var lin1X; + var lin1Y; + var lin1Z; + var ang1X; + var ang1Y; + var ang1Z; + var ang2X; + var ang2Y; + var ang2Z; + lin1X = 0; + lin1Y = 0; + lin1Z = 0; + ang1X = 0; + ang1Y = 0; + ang1Z = 0; + ang2X = 0; + ang2Y = 0; + ang2Z = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; + var imp = row.impulse; + var jn = row.jacobianN; + var jt = row.jacobianT; + var jb = row.jacobianB; + var impN = imp.impulseN; + var impT = imp.impulseT; + var impB = imp.impulseB; + var impulseLX; + var impulseLY; + var impulseLZ; + impulseLX = 0; + impulseLY = 0; + impulseLZ = 0; + impulseLX += jt.lin1X * impT; + impulseLY += jt.lin1Y * impT; + impulseLZ += jt.lin1Z * impT; + impulseLX += jb.lin1X * impB; + impulseLY += jb.lin1Y * impB; + impulseLZ += jb.lin1Z * impB; + imp.impulseLX = impulseLX; + imp.impulseLY = impulseLY; + imp.impulseLZ = impulseLZ; + lin1X += jn.lin1X * impN; + lin1Y += jn.lin1Y * impN; + lin1Z += jn.lin1Z * impN; + ang1X += jn.ang1X * impN; + ang1Y += jn.ang1Y * impN; + ang1Z += jn.ang1Z * impN; + ang2X += jn.ang2X * impN; + ang2Y += jn.ang2Y * impN; + ang2Z += jn.ang2Z * impN; + lin1X += jt.lin1X * impT; + lin1Y += jt.lin1Y * impT; + lin1Z += jt.lin1Z * impT; + ang1X += jt.ang1X * impT; + ang1Y += jt.ang1Y * impT; + ang1Z += jt.ang1Z * impT; + ang2X += jt.ang2X * impT; + ang2Y += jt.ang2Y * impT; + ang2Z += jt.ang2Z * impT; + lin1X += jb.lin1X * impB; + lin1Y += jb.lin1Y * impB; + lin1Z += jb.lin1Z * impB; + ang1X += jb.ang1X * impB; + ang1Y += jb.ang1Y * impB; + ang1Z += jb.ang1Z * impB; + ang2X += jb.ang2X * impB; + ang2Y += jb.ang2Y * impB; + ang2Z += jb.ang2Z * impB; + } + this._b1._linearContactImpulseX += lin1X; + this._b1._linearContactImpulseY += lin1Y; + this._b1._linearContactImpulseZ += lin1Z; + this._b1._angularContactImpulseX += ang1X; + this._b1._angularContactImpulseY += ang1Y; + this._b1._angularContactImpulseZ += ang1Z; + this._b2._linearContactImpulseX -= lin1X; + this._b2._linearContactImpulseY -= lin1Y; + this._b2._linearContactImpulseZ -= lin1Z; + this._b2._angularContactImpulseX -= ang2X; + this._b2._angularContactImpulseY -= ang2Y; + this._b2._angularContactImpulseZ -= ang2Z; + this.constraint._syncManifold(); + } + ,__class__: oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver +}); +var oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver = function(joint) { + oimo_dynamics_constraint_ConstraintSolver.call(this); + this.joint = joint; + this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); + this.massData = new Array(oimo_common_Setting.maxJacobianRows); + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); +}; +oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.__name__ = true; +oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; +oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ + preSolveVelocity: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobian; + j.updateSparsity(); + if((j.flag & 1) != 0) { + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + } else { + md.invMLin1X = 0; + md.invMLin1Y = 0; + md.invMLin1Z = 0; + md.invMLin2X = 0; + md.invMLin2Y = 0; + md.invMLin2Z = 0; + } + if((j.flag & 2) != 0) { + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + } else { + md.invMAng1X = 0; + md.invMAng1Y = 0; + md.invMAng1Z = 0; + md.invMAng2X = 0; + md.invMAng2Y = 0; + md.invMAng2Z = 0; + } + md.massWithoutCfm = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + md.mass = md.massWithoutCfm + row.cfm; + if(md.massWithoutCfm != 0) { + md.massWithoutCfm = 1 / md.massWithoutCfm; + } + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + } + ,warmStart: function(timeStep) { + var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + factor *= timeStep.dtRatio; + if(factor <= 0) { + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var _this = this.info.rows[_g++].impulse; + _this.impulse = 0; + _this.impulseM = 0; + _this.impulseP = 0; + } + return; + } + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i = _g2++; + var md = this.massData[i]; + var imp = this.info.rows[i].impulse; + imp.impulse *= factor; + imp.impulseM *= factor; + var impulse = imp.impulse + imp.impulseM; + lv1X += md.invMLin1X * impulse; + lv1Y += md.invMLin1Y * impulse; + lv1Z += md.invMLin1Z * impulse; + lv2X += md.invMLin2X * -impulse; + lv2Y += md.invMLin2Y * -impulse; + lv2Z += md.invMLin2Z * -impulse; + av1X += md.invMAng1X * impulse; + av1Y += md.invMAng1Y * impulse; + av1Z += md.invMAng1Z * impulse; + av2X += md.invMAng2X * -impulse; + av2Y += md.invMAng2Y * -impulse; + av2Z += md.invMAng2Z * -impulse; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + ,solveVelocity: function() { + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + if(row.motorMaxImpulse == 0) { + continue; + } + var rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; + var oldImpulseM = imp.impulseM; + imp.impulseM += impulseM; + if(imp.impulseM < -row.motorMaxImpulse) { + imp.impulseM = -row.motorMaxImpulse; + } else if(imp.impulseM > row.motorMaxImpulse) { + imp.impulseM = row.motorMaxImpulse; + } + impulseM = imp.impulseM - oldImpulseM; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * impulseM; + lv1Y += md.invMLin1Y * impulseM; + lv1Z += md.invMLin1Z * impulseM; + lv2X += md.invMLin2X * -impulseM; + lv2Y += md.invMLin2Y * -impulseM; + lv2Z += md.invMLin2Z * -impulseM; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * impulseM; + av1Y += md.invMAng1Y * impulseM; + av1Z += md.invMAng1Z * impulseM; + av2X += md.invMAng2X * -impulseM; + av2Y += md.invMAng2Y * -impulseM; + av2Z += md.invMAng2Z * -impulseM; + } + } + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp1 = row1.impulse; + var j1 = row1.jacobian; + var rv1 = 0; + rv1 += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rv1 -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rv1 += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rv1 -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulse = (row1.rhs - rv1 - imp1.impulse * row1.cfm) * md1.mass; + var oldImpulse = imp1.impulse; + imp1.impulse += impulse; + if(imp1.impulse < row1.minImpulse) { + imp1.impulse = row1.minImpulse; + } else if(imp1.impulse > row1.maxImpulse) { + imp1.impulse = row1.maxImpulse; + } + impulse = imp1.impulse - oldImpulse; + if((j1.flag & 1) != 0) { + lv1X += md1.invMLin1X * impulse; + lv1Y += md1.invMLin1Y * impulse; + lv1Z += md1.invMLin1Z * impulse; + lv2X += md1.invMLin2X * -impulse; + lv2Y += md1.invMLin2Y * -impulse; + lv2Z += md1.invMLin2Z * -impulse; + } + if((j1.flag & 2) != 0) { + av1X += md1.invMAng1X * impulse; + av1Y += md1.invMAng1Y * impulse; + av1Z += md1.invMAng1Z * impulse; + av2X += md1.invMAng2X * -impulse; + av2Y += md1.invMAng2Y * -impulse; + av2Z += md1.invMAng2Z * -impulse; + } + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + ,postSolveVelocity: function(timeStep) { + var linX; + var linY; + var linZ; + var angX; + var angY; + var angZ; + linX = 0; + linY = 0; + linZ = 0; + angX = 0; + angY = 0; + angZ = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var row = this.info.rows[_g++]; + var imp = row.impulse; + var j = row.jacobian; + if((j.flag & 1) != 0) { + linX += j.lin1X * imp.impulse; + linY += j.lin1Y * imp.impulse; + linZ += j.lin1Z * imp.impulse; + } else if((j.flag & 2) != 0) { + angX += j.ang1X * imp.impulse; + angY += j.ang1Y * imp.impulse; + angZ += j.ang1Z * imp.impulse; + } + } + this.joint._appliedForceX = linX * timeStep.invDt; + this.joint._appliedForceY = linY * timeStep.invDt; + this.joint._appliedForceZ = linZ * timeStep.invDt; + this.joint._appliedTorqueX = angX * timeStep.invDt; + this.joint._appliedTorqueY = angY * timeStep.invDt; + this.joint._appliedTorqueZ = angZ * timeStep.invDt; + } + ,preSolvePosition: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var md = this.massData[i]; + var j = this.info.rows[i].jacobian; + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + md.mass = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + } + ,solvePositionSplitImpulse: function() { + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + var rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs * oimo_common_Setting.positionSplitImpulseBaumgarte - rv) * md.mass; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < row.minImpulse) { + imp.impulseP = row.minImpulse; + } else if(imp.impulseP > row.maxImpulse) { + imp.impulseP = row.maxImpulse; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md.invMLin1X * impulseP; + lv1Y += md.invMLin1Y * impulseP; + lv1Z += md.invMLin1Z * impulseP; + lv2X += md.invMLin2X * -impulseP; + lv2Y += md.invMLin2Y * -impulseP; + lv2Z += md.invMLin2Z * -impulseP; + av1X += md.invMAng1X * impulseP; + av1Y += md.invMAng1Y * impulseP; + av1Z += md.invMAng1Z * impulseP; + av2X += md.invMAng2X * -impulseP; + av2Y += md.invMAng2Y * -impulseP; + av2Z += md.invMAng2Z * -impulseP; + } + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + ,solvePositionNgs: function(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var md = this.massData[i]; + var j = this.info.rows[i].jacobian; + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + md.mass = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp = row.impulse; + var j1 = row.jacobian; + var rv = 0; + rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md1.mass; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < row.minImpulse) { + imp.impulseP = row.minImpulse; + } else if(imp.impulseP > row.maxImpulse) { + imp.impulseP = row.maxImpulse; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md1.invMLin1X * impulseP; + lv1Y += md1.invMLin1Y * impulseP; + lv1Z += md1.invMLin1Z * impulseP; + lv2X += md1.invMLin2X * -impulseP; + lv2Y += md1.invMLin2Y * -impulseP; + lv2Z += md1.invMLin2Z * -impulseP; + av1X += md1.invMAng1X * impulseP; + av1Y += md1.invMAng1Y * impulseP; + av1Z += md1.invMAng1Z * impulseP; + av2X += md1.invMAng2X * -impulseP; + av2Y += md1.invMAng2Y * -impulseP; + av2Z += md1.invMAng2Z * -impulseP; + } + var _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + var _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; + var _this2 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this2._transform._rotation00; + var e11 = _this2._transform._rotation11; + var e22 = _this2._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this2._transform._rotation00 = 1 - yy - zz; + _this2._transform._rotation01 = xy - wz; + _this2._transform._rotation02 = xz + wy; + _this2._transform._rotation10 = xy + wz; + _this2._transform._rotation11 = 1 - xx - zz; + _this2._transform._rotation12 = yz - wx; + _this2._transform._rotation20 = xz - wy; + _this2._transform._rotation21 = yz + wx; + _this2._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; + __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; + __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; + __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; + __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; + __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; + __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; + __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; + __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; + _this2._invInertia00 = __tmp__00; + _this2._invInertia01 = __tmp__01; + _this2._invInertia02 = __tmp__02; + _this2._invInertia10 = __tmp__10; + _this2._invInertia11 = __tmp__11; + _this2._invInertia12 = __tmp__12; + _this2._invInertia20 = __tmp__20; + _this2._invInertia21 = __tmp__21; + _this2._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; + __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; + __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; + __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; + __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; + __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; + __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; + __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; + __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; + _this2._invInertia00 = __tmp__001; + _this2._invInertia01 = __tmp__011; + _this2._invInertia02 = __tmp__021; + _this2._invInertia10 = __tmp__101; + _this2._invInertia11 = __tmp__111; + _this2._invInertia12 = __tmp__121; + _this2._invInertia20 = __tmp__201; + _this2._invInertia21 = __tmp__211; + _this2._invInertia22 = __tmp__221; + _this2._invInertia00 *= _this2._rotFactor.x; + _this2._invInertia01 *= _this2._rotFactor.x; + _this2._invInertia02 *= _this2._rotFactor.x; + _this2._invInertia10 *= _this2._rotFactor.y; + _this2._invInertia11 *= _this2._rotFactor.y; + _this2._invInertia12 *= _this2._rotFactor.y; + _this2._invInertia20 *= _this2._rotFactor.z; + _this2._invInertia21 *= _this2._rotFactor.z; + _this2._invInertia22 *= _this2._rotFactor.z; + var _this3 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this3._transform._rotation00; + var e111 = _this3._transform._rotation11; + var e221 = _this3._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this3._transform._rotation00 = 1 - yy1 - zz1; + _this3._transform._rotation01 = xy1 - wz1; + _this3._transform._rotation02 = xz1 + wy1; + _this3._transform._rotation10 = xy1 + wz1; + _this3._transform._rotation11 = 1 - xx1 - zz1; + _this3._transform._rotation12 = yz1 - wx1; + _this3._transform._rotation20 = xz1 - wy1; + _this3._transform._rotation21 = yz1 + wx1; + _this3._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; + __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; + __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; + __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; + __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; + __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; + __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; + __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; + __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; + _this3._invInertia00 = __tmp__002; + _this3._invInertia01 = __tmp__012; + _this3._invInertia02 = __tmp__022; + _this3._invInertia10 = __tmp__102; + _this3._invInertia11 = __tmp__112; + _this3._invInertia12 = __tmp__122; + _this3._invInertia20 = __tmp__202; + _this3._invInertia21 = __tmp__212; + _this3._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; + __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; + __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; + __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; + __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; + __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; + __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; + __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; + __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; + _this3._invInertia00 = __tmp__003; + _this3._invInertia01 = __tmp__013; + _this3._invInertia02 = __tmp__023; + _this3._invInertia10 = __tmp__103; + _this3._invInertia11 = __tmp__113; + _this3._invInertia12 = __tmp__123; + _this3._invInertia20 = __tmp__203; + _this3._invInertia21 = __tmp__213; + _this3._invInertia22 = __tmp__223; + _this3._invInertia00 *= _this3._rotFactor.x; + _this3._invInertia01 *= _this3._rotFactor.x; + _this3._invInertia02 *= _this3._rotFactor.x; + _this3._invInertia10 *= _this3._rotFactor.y; + _this3._invInertia11 *= _this3._rotFactor.y; + _this3._invInertia12 *= _this3._rotFactor.y; + _this3._invInertia20 *= _this3._rotFactor.z; + _this3._invInertia21 *= _this3._rotFactor.z; + _this3._invInertia22 *= _this3._rotFactor.z; + } + ,postSolve: function() { + this.joint._syncAnchors(); + this.joint._checkDestruction(); + } + ,__class__: oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver +}); +var oimo_dynamics_rigidbody_MassData = function() { + this.mass = 0; + this.localInertia = new oimo_common_Mat3(); +}; +oimo_dynamics_rigidbody_MassData.__name__ = true; +oimo_dynamics_rigidbody_MassData.prototype = { + __class__: oimo_dynamics_rigidbody_MassData +}; +var oimo_dynamics_rigidbody_RigidBody = function(config) { + this._next = null; + this._prev = null; + this._shapeList = null; + this._shapeListLast = null; + this._numShapes = 0; + this._contactLinkList = null; + this._contactLinkListLast = null; + this._numContactLinks = 0; + this._jointLinkList = null; + this._jointLinkListLast = null; + this._numJointLinks = 0; + var v = config.linearVelocity; + this._velX = v.x; + this._velY = v.y; + this._velZ = v.z; + var v1 = config.angularVelocity; + this._angVelX = v1.x; + this._angVelY = v1.y; + this._angVelZ = v1.z; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + this._ptransform = new oimo_common_Transform(); + this._transform = new oimo_common_Transform(); + var v2 = config.position; + this._ptransform._positionX = v2.x; + this._ptransform._positionY = v2.y; + this._ptransform._positionZ = v2.z; + var m = config.rotation; + this._ptransform._rotation00 = m.e00; + this._ptransform._rotation01 = m.e01; + this._ptransform._rotation02 = m.e02; + this._ptransform._rotation10 = m.e10; + this._ptransform._rotation11 = m.e11; + this._ptransform._rotation12 = m.e12; + this._ptransform._rotation20 = m.e20; + this._ptransform._rotation21 = m.e21; + this._ptransform._rotation22 = m.e22; + var dst = this._transform; + var src = this._ptransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + this._type = config.type; + this._sleepTime = 0; + this._sleeping = false; + this._autoSleep = config.autoSleep; + this._mass = 0; + this._invMass = 0; + this._localInertia00 = 0; + this._localInertia01 = 0; + this._localInertia02 = 0; + this._localInertia10 = 0; + this._localInertia11 = 0; + this._localInertia12 = 0; + this._localInertia20 = 0; + this._localInertia21 = 0; + this._localInertia22 = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + this._invInertia00 = 0; + this._invInertia01 = 0; + this._invInertia02 = 0; + this._invInertia10 = 0; + this._invInertia11 = 0; + this._invInertia12 = 0; + this._invInertia20 = 0; + this._invInertia21 = 0; + this._invInertia22 = 0; + this._linearDamping = config.linearDamping; + this._angularDamping = config.angularDamping; + this._forceX = 0; + this._forceY = 0; + this._forceZ = 0; + this._torqueX = 0; + this._torqueY = 0; + this._torqueZ = 0; + this._linearContactImpulseX = 0; + this._linearContactImpulseY = 0; + this._linearContactImpulseZ = 0; + this._angularContactImpulseX = 0; + this._angularContactImpulseY = 0; + this._angularContactImpulseZ = 0; + this._rotFactor = new oimo_common_Vec3(1,1,1); + this._addedToIsland = false; + this._gravityScale = 1; + this._world = null; +}; +oimo_dynamics_rigidbody_RigidBody.__name__ = true; +oimo_dynamics_rigidbody_RigidBody.prototype = { + _integrate: function(dt) { + switch(this._type) { + case 1: + this._velX = 0; + this._velY = 0; + this._velZ = 0; + this._angVelX = 0; + this._angVelY = 0; + this._angVelZ = 0; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + break; + case 0:case 2: + var translationX; + var translationY; + var translationZ; + var rotationX; + var rotationY; + var rotationZ; + translationX = this._velX * dt; + translationY = this._velY * dt; + translationZ = this._velZ * dt; + rotationX = this._angVelX * dt; + rotationY = this._angVelY * dt; + rotationZ = this._angVelZ * dt; + var translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; + var rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; + if(translationLengthSq == 0 && rotationLengthSq == 0) { + return; + } + if(translationLengthSq > oimo_common_Setting.maxTranslationPerStep * oimo_common_Setting.maxTranslationPerStep) { + var l = oimo_common_Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); + this._velX *= l; + this._velY *= l; + this._velZ *= l; + translationX *= l; + translationY *= l; + translationZ *= l; + } + if(rotationLengthSq > oimo_common_Setting.maxRotationPerStep * oimo_common_Setting.maxRotationPerStep) { + var l1 = oimo_common_Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); + this._angVelX *= l1; + this._angVelY *= l1; + this._angVelZ *= l1; + rotationX *= l1; + rotationY *= l1; + rotationZ *= l1; + } + this._transform._positionX += translationX; + this._transform._positionY += translationY; + this._transform._positionZ += translationZ; + var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = rotationX * rotationToSinAxisFactor; + sinAxisY = rotationY * rotationToSinAxisFactor; + sinAxisZ = rotationZ * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation21 - this._transform._rotation12) * s; + qY = (this._transform._rotation02 - this._transform._rotation20) * s; + qZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation02 + this._transform._rotation20) * s; + qW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l2 = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l2 > 1e-32) { + l2 = 1 / Math.sqrt(l2); + } + qX *= l2; + qY *= l2; + qZ *= l2; + qW *= l2; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + break; + } + } + ,_integratePseudoVelocity: function() { + if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { + return; + } + switch(this._type) { + case 1: + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + break; + case 0:case 2: + var translationX; + var translationY; + var translationZ; + var rotationX; + var rotationY; + var rotationZ; + translationX = this._pseudoVelX; + translationY = this._pseudoVelY; + translationZ = this._pseudoVelZ; + rotationX = this._angPseudoVelX; + rotationY = this._angPseudoVelY; + rotationZ = this._angPseudoVelZ; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + this._transform._positionX += translationX; + this._transform._positionY += translationY; + this._transform._positionZ += translationZ; + var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = rotationX * rotationToSinAxisFactor; + sinAxisY = rotationY * rotationToSinAxisFactor; + sinAxisZ = rotationZ * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation21 - this._transform._rotation12) * s; + qY = (this._transform._rotation02 - this._transform._rotation20) * s; + qZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation02 + this._transform._rotation20) * s; + qW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + break; + } + } + ,updateMass: function() { + var totalInertia00; + var totalInertia01; + var totalInertia02; + var totalInertia10; + var totalInertia11; + var totalInertia12; + var totalInertia20; + var totalInertia21; + var totalInertia22; + totalInertia00 = 0; + totalInertia01 = 0; + totalInertia02 = 0; + totalInertia10 = 0; + totalInertia11 = 0; + totalInertia12 = 0; + totalInertia20 = 0; + totalInertia21 = 0; + totalInertia22 = 0; + var totalMass = 0; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var g = s._geom; + g._updateMass(); + var mass = s._density * g._volume; + var inertia00; + var inertia01; + var inertia02; + var inertia10; + var inertia11; + var inertia12; + var inertia20; + var inertia21; + var inertia22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = s._localTransform._rotation00 * g._inertiaCoeff00 + s._localTransform._rotation01 * g._inertiaCoeff10 + s._localTransform._rotation02 * g._inertiaCoeff20; + __tmp__01 = s._localTransform._rotation00 * g._inertiaCoeff01 + s._localTransform._rotation01 * g._inertiaCoeff11 + s._localTransform._rotation02 * g._inertiaCoeff21; + __tmp__02 = s._localTransform._rotation00 * g._inertiaCoeff02 + s._localTransform._rotation01 * g._inertiaCoeff12 + s._localTransform._rotation02 * g._inertiaCoeff22; + __tmp__10 = s._localTransform._rotation10 * g._inertiaCoeff00 + s._localTransform._rotation11 * g._inertiaCoeff10 + s._localTransform._rotation12 * g._inertiaCoeff20; + __tmp__11 = s._localTransform._rotation10 * g._inertiaCoeff01 + s._localTransform._rotation11 * g._inertiaCoeff11 + s._localTransform._rotation12 * g._inertiaCoeff21; + __tmp__12 = s._localTransform._rotation10 * g._inertiaCoeff02 + s._localTransform._rotation11 * g._inertiaCoeff12 + s._localTransform._rotation12 * g._inertiaCoeff22; + __tmp__20 = s._localTransform._rotation20 * g._inertiaCoeff00 + s._localTransform._rotation21 * g._inertiaCoeff10 + s._localTransform._rotation22 * g._inertiaCoeff20; + __tmp__21 = s._localTransform._rotation20 * g._inertiaCoeff01 + s._localTransform._rotation21 * g._inertiaCoeff11 + s._localTransform._rotation22 * g._inertiaCoeff21; + __tmp__22 = s._localTransform._rotation20 * g._inertiaCoeff02 + s._localTransform._rotation21 * g._inertiaCoeff12 + s._localTransform._rotation22 * g._inertiaCoeff22; + inertia00 = __tmp__00; + inertia01 = __tmp__01; + inertia02 = __tmp__02; + inertia10 = __tmp__10; + inertia11 = __tmp__11; + inertia12 = __tmp__12; + inertia20 = __tmp__20; + inertia21 = __tmp__21; + inertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = inertia00 * s._localTransform._rotation00 + inertia01 * s._localTransform._rotation01 + inertia02 * s._localTransform._rotation02; + __tmp__011 = inertia00 * s._localTransform._rotation10 + inertia01 * s._localTransform._rotation11 + inertia02 * s._localTransform._rotation12; + __tmp__021 = inertia00 * s._localTransform._rotation20 + inertia01 * s._localTransform._rotation21 + inertia02 * s._localTransform._rotation22; + __tmp__101 = inertia10 * s._localTransform._rotation00 + inertia11 * s._localTransform._rotation01 + inertia12 * s._localTransform._rotation02; + __tmp__111 = inertia10 * s._localTransform._rotation10 + inertia11 * s._localTransform._rotation11 + inertia12 * s._localTransform._rotation12; + __tmp__121 = inertia10 * s._localTransform._rotation20 + inertia11 * s._localTransform._rotation21 + inertia12 * s._localTransform._rotation22; + __tmp__201 = inertia20 * s._localTransform._rotation00 + inertia21 * s._localTransform._rotation01 + inertia22 * s._localTransform._rotation02; + __tmp__211 = inertia20 * s._localTransform._rotation10 + inertia21 * s._localTransform._rotation11 + inertia22 * s._localTransform._rotation12; + __tmp__221 = inertia20 * s._localTransform._rotation20 + inertia21 * s._localTransform._rotation21 + inertia22 * s._localTransform._rotation22; + inertia00 = __tmp__001; + inertia01 = __tmp__011; + inertia02 = __tmp__021; + inertia10 = __tmp__101; + inertia11 = __tmp__111; + inertia12 = __tmp__121; + inertia20 = __tmp__201; + inertia21 = __tmp__211; + inertia22 = __tmp__221; + inertia00 *= mass; + inertia01 *= mass; + inertia02 *= mass; + inertia10 *= mass; + inertia11 *= mass; + inertia12 *= mass; + inertia20 *= mass; + inertia21 *= mass; + inertia22 *= mass; + var cogInertia00; + var cogInertia01; + var cogInertia02; + var cogInertia10; + var cogInertia11; + var cogInertia12; + var cogInertia20; + var cogInertia21; + var cogInertia22; + var xx = s._localTransform._positionX * s._localTransform._positionX; + var yy = s._localTransform._positionY * s._localTransform._positionY; + var zz = s._localTransform._positionZ * s._localTransform._positionZ; + var xy = -s._localTransform._positionX * s._localTransform._positionY; + var yz = -s._localTransform._positionY * s._localTransform._positionZ; + var zx = -s._localTransform._positionZ * s._localTransform._positionX; + cogInertia00 = yy + zz; + cogInertia01 = xy; + cogInertia02 = zx; + cogInertia10 = xy; + cogInertia11 = xx + zz; + cogInertia12 = yz; + cogInertia20 = zx; + cogInertia21 = yz; + cogInertia22 = xx + yy; + inertia00 += cogInertia00 * mass; + inertia01 += cogInertia01 * mass; + inertia02 += cogInertia02 * mass; + inertia10 += cogInertia10 * mass; + inertia11 += cogInertia11 * mass; + inertia12 += cogInertia12 * mass; + inertia20 += cogInertia20 * mass; + inertia21 += cogInertia21 * mass; + inertia22 += cogInertia22 * mass; + totalMass += mass; + totalInertia00 += inertia00; + totalInertia01 += inertia01; + totalInertia02 += inertia02; + totalInertia10 += inertia10; + totalInertia11 += inertia11; + totalInertia12 += inertia12; + totalInertia20 += inertia20; + totalInertia21 += inertia21; + totalInertia22 += inertia22; + s = n; + } + this._mass = totalMass; + this._localInertia00 = totalInertia00; + this._localInertia01 = totalInertia01; + this._localInertia02 = totalInertia02; + this._localInertia10 = totalInertia10; + this._localInertia11 = totalInertia11; + this._localInertia12 = totalInertia12; + this._localInertia20 = totalInertia20; + this._localInertia21 = totalInertia21; + this._localInertia22 = totalInertia22; + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { + this._invMass = 1 / this._mass; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + if(d < -1e-32 || d > 1e-32) { + d = 1 / d; + } + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; + this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; + this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; + this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; + this._invLocalInertiaWithoutRotFactor10 = this._invLocalInertia10; + this._invLocalInertiaWithoutRotFactor11 = this._invLocalInertia11; + this._invLocalInertiaWithoutRotFactor12 = this._invLocalInertia12; + this._invLocalInertiaWithoutRotFactor20 = this._invLocalInertia20; + this._invLocalInertiaWithoutRotFactor21 = this._invLocalInertia21; + this._invLocalInertiaWithoutRotFactor22 = this._invLocalInertia22; + this._invLocalInertia00 = this._invLocalInertiaWithoutRotFactor00 * this._rotFactor.x; + this._invLocalInertia01 = this._invLocalInertiaWithoutRotFactor01 * this._rotFactor.x; + this._invLocalInertia02 = this._invLocalInertiaWithoutRotFactor02 * this._rotFactor.x; + this._invLocalInertia10 = this._invLocalInertiaWithoutRotFactor10 * this._rotFactor.y; + this._invLocalInertia11 = this._invLocalInertiaWithoutRotFactor11 * this._rotFactor.y; + this._invLocalInertia12 = this._invLocalInertiaWithoutRotFactor12 * this._rotFactor.y; + this._invLocalInertia20 = this._invLocalInertiaWithoutRotFactor20 * this._rotFactor.z; + this._invLocalInertia21 = this._invLocalInertiaWithoutRotFactor21 * this._rotFactor.z; + this._invLocalInertia22 = this._invLocalInertiaWithoutRotFactor22 * this._rotFactor.z; + } else { + this._invMass = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + if(this._type == 0) { + this._type = 1; + } + } + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__012 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__022 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__102 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__112 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__122 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__202 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__212 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__222 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__013 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__023 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__103 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__113 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__123 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__203 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__213 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__223 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__003; + this._invInertia01 = __tmp__013; + this._invInertia02 = __tmp__023; + this._invInertia10 = __tmp__103; + this._invInertia11 = __tmp__113; + this._invInertia12 = __tmp__123; + this._invInertia20 = __tmp__203; + this._invInertia21 = __tmp__213; + this._invInertia22 = __tmp__223; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + ,getPosition: function() { + var v = new oimo_common_Vec3(); + v.x = this._transform._positionX; + v.y = this._transform._positionY; + v.z = this._transform._positionZ; + return v; + } + ,getPositionTo: function(position) { + position.x = this._transform._positionX; + position.y = this._transform._positionY; + position.z = this._transform._positionZ; + } + ,setPosition: function(position) { + this._transform._positionX = position.x; + this._transform._positionY = position.y; + this._transform._positionZ = position.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,translate: function(translation) { + var diffX; + var diffY; + var diffZ; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; + this._transform._positionX += diffX; + this._transform._positionY += diffY; + this._transform._positionZ += diffZ; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,getRotation: function() { + var m = new oimo_common_Mat3(); + m.e00 = this._transform._rotation00; + m.e01 = this._transform._rotation01; + m.e02 = this._transform._rotation02; + m.e10 = this._transform._rotation10; + m.e11 = this._transform._rotation11; + m.e12 = this._transform._rotation12; + m.e20 = this._transform._rotation20; + m.e21 = this._transform._rotation21; + m.e22 = this._transform._rotation22; + return m; + } + ,getRotationTo: function(rotation) { + rotation.e00 = this._transform._rotation00; + rotation.e01 = this._transform._rotation01; + rotation.e02 = this._transform._rotation02; + rotation.e10 = this._transform._rotation10; + rotation.e11 = this._transform._rotation11; + rotation.e12 = this._transform._rotation12; + rotation.e20 = this._transform._rotation20; + rotation.e21 = this._transform._rotation21; + rotation.e22 = this._transform._rotation22; + } + ,setRotation: function(rotation) { + this._transform._rotation00 = rotation.e00; + this._transform._rotation01 = rotation.e01; + this._transform._rotation02 = rotation.e02; + this._transform._rotation10 = rotation.e10; + this._transform._rotation11 = rotation.e11; + this._transform._rotation12 = rotation.e12; + this._transform._rotation20 = rotation.e20; + this._transform._rotation21 = rotation.e21; + this._transform._rotation22 = rotation.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,setRotationXyz: function(eulerAngles) { + var xyzX; + var xyzY; + var xyzZ; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + this._transform._rotation00 = cy * cz; + this._transform._rotation01 = -cy * sz; + this._transform._rotation02 = sy; + this._transform._rotation10 = cx * sz + cz * sx * sy; + this._transform._rotation11 = cx * cz - sx * sy * sz; + this._transform._rotation12 = -cy * sx; + this._transform._rotation20 = sx * sz - cx * cz * sy; + this._transform._rotation21 = cz * sx + cx * sy * sz; + this._transform._rotation22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,rotate: function(rotation) { + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; + __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; + __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; + __tmp__10 = rot10 * this._transform._rotation00 + rot11 * this._transform._rotation10 + rot12 * this._transform._rotation20; + __tmp__11 = rot10 * this._transform._rotation01 + rot11 * this._transform._rotation11 + rot12 * this._transform._rotation21; + __tmp__12 = rot10 * this._transform._rotation02 + rot11 * this._transform._rotation12 + rot12 * this._transform._rotation22; + __tmp__20 = rot20 * this._transform._rotation00 + rot21 * this._transform._rotation10 + rot22 * this._transform._rotation20; + __tmp__21 = rot20 * this._transform._rotation01 + rot21 * this._transform._rotation11 + rot22 * this._transform._rotation21; + __tmp__22 = rot20 * this._transform._rotation02 + rot21 * this._transform._rotation12 + rot22 * this._transform._rotation22; + this._transform._rotation00 = __tmp__00; + this._transform._rotation01 = __tmp__01; + this._transform._rotation02 = __tmp__02; + this._transform._rotation10 = __tmp__10; + this._transform._rotation11 = __tmp__11; + this._transform._rotation12 = __tmp__12; + this._transform._rotation20 = __tmp__20; + this._transform._rotation21 = __tmp__21; + this._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,rotateXyz: function(eulerAngles) { + var xyzX; + var xyzY; + var xyzZ; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + rot00 = cy * cz; + rot01 = -cy * sz; + rot02 = sy; + rot10 = cx * sz + cz * sx * sy; + rot11 = cx * cz - sx * sy * sz; + rot12 = -cy * sx; + rot20 = sx * sz - cx * cz * sy; + rot21 = cz * sx + cx * sy * sz; + rot22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; + __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; + __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; + __tmp__10 = rot10 * this._transform._rotation00 + rot11 * this._transform._rotation10 + rot12 * this._transform._rotation20; + __tmp__11 = rot10 * this._transform._rotation01 + rot11 * this._transform._rotation11 + rot12 * this._transform._rotation21; + __tmp__12 = rot10 * this._transform._rotation02 + rot11 * this._transform._rotation12 + rot12 * this._transform._rotation22; + __tmp__20 = rot20 * this._transform._rotation00 + rot21 * this._transform._rotation10 + rot22 * this._transform._rotation20; + __tmp__21 = rot20 * this._transform._rotation01 + rot21 * this._transform._rotation11 + rot22 * this._transform._rotation21; + __tmp__22 = rot20 * this._transform._rotation02 + rot21 * this._transform._rotation12 + rot22 * this._transform._rotation22; + this._transform._rotation00 = __tmp__00; + this._transform._rotation01 = __tmp__01; + this._transform._rotation02 = __tmp__02; + this._transform._rotation10 = __tmp__10; + this._transform._rotation11 = __tmp__11; + this._transform._rotation12 = __tmp__12; + this._transform._rotation20 = __tmp__20; + this._transform._rotation21 = __tmp__21; + this._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,getOrientation: function() { + var q = new oimo_common_Quat(); + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation21 - this._transform._rotation12) * s; + iqY = (this._transform._rotation02 - this._transform._rotation20) * s; + iqZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation02 + this._transform._rotation20) * s; + iqW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; + return q; + } + ,getOrientationTo: function(orientation) { + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation21 - this._transform._rotation12) * s; + iqY = (this._transform._rotation02 - this._transform._rotation20) * s; + iqZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation02 + this._transform._rotation20) * s; + iqW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; + } + ,setOrientation: function(quaternion) { + var qX; + var qY; + var qZ; + var qW; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,getTransform: function() { + var _this = this._transform; + var tf = new oimo_common_Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + ,getTransformTo: function(transform) { + var transform1 = this._transform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + ,setTransform: function(transform) { + this._transform._positionX = transform._positionX; + this._transform._positionY = transform._positionY; + this._transform._positionZ = transform._positionZ; + this._transform._rotation00 = transform._rotation00; + this._transform._rotation01 = transform._rotation01; + this._transform._rotation02 = transform._rotation02; + this._transform._rotation10 = transform._rotation10; + this._transform._rotation11 = transform._rotation11; + this._transform._rotation12 = transform._rotation12; + this._transform._rotation20 = transform._rotation20; + this._transform._rotation21 = transform._rotation21; + this._transform._rotation22 = transform._rotation22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,getMass: function() { + return this._mass; + } + ,getLocalInertia: function() { + var m = new oimo_common_Mat3(); + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + return m; + } + ,getLocalInertiaTo: function(inertia) { + inertia.e00 = this._localInertia00; + inertia.e01 = this._localInertia01; + inertia.e02 = this._localInertia02; + inertia.e10 = this._localInertia10; + inertia.e11 = this._localInertia11; + inertia.e12 = this._localInertia12; + inertia.e20 = this._localInertia20; + inertia.e21 = this._localInertia21; + inertia.e22 = this._localInertia22; + } + ,getMassData: function() { + var md = new oimo_dynamics_rigidbody_MassData(); + md.mass = this._mass; + var m = md.localInertia; + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + return md; + } + ,getMassDataTo: function(massData) { + massData.mass = this._mass; + var m = massData.localInertia; + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + } + ,setMassData: function(massData) { + this._mass = massData.mass; + var m = massData.localInertia; + this._localInertia00 = m.e00; + this._localInertia01 = m.e01; + this._localInertia02 = m.e02; + this._localInertia10 = m.e10; + this._localInertia11 = m.e11; + this._localInertia12 = m.e12; + this._localInertia20 = m.e20; + this._localInertia21 = m.e21; + this._localInertia22 = m.e22; + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { + this._invMass = 1 / this._mass; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + if(d < -1e-32 || d > 1e-32) { + d = 1 / d; + } + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; + this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; + this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; + this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; + this._invLocalInertiaWithoutRotFactor10 = this._invLocalInertia10; + this._invLocalInertiaWithoutRotFactor11 = this._invLocalInertia11; + this._invLocalInertiaWithoutRotFactor12 = this._invLocalInertia12; + this._invLocalInertiaWithoutRotFactor20 = this._invLocalInertia20; + this._invLocalInertiaWithoutRotFactor21 = this._invLocalInertia21; + this._invLocalInertiaWithoutRotFactor22 = this._invLocalInertia22; + this._invLocalInertia00 = this._invLocalInertiaWithoutRotFactor00 * this._rotFactor.x; + this._invLocalInertia01 = this._invLocalInertiaWithoutRotFactor01 * this._rotFactor.x; + this._invLocalInertia02 = this._invLocalInertiaWithoutRotFactor02 * this._rotFactor.x; + this._invLocalInertia10 = this._invLocalInertiaWithoutRotFactor10 * this._rotFactor.y; + this._invLocalInertia11 = this._invLocalInertiaWithoutRotFactor11 * this._rotFactor.y; + this._invLocalInertia12 = this._invLocalInertiaWithoutRotFactor12 * this._rotFactor.y; + this._invLocalInertia20 = this._invLocalInertiaWithoutRotFactor20 * this._rotFactor.z; + this._invLocalInertia21 = this._invLocalInertiaWithoutRotFactor21 * this._rotFactor.z; + this._invLocalInertia22 = this._invLocalInertiaWithoutRotFactor22 * this._rotFactor.z; + } else { + this._invMass = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + if(this._type == 0) { + this._type = 1; + } + } + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + ,getRotationFactor: function() { + var _this = this._rotFactor; + return new oimo_common_Vec3(_this.x,_this.y,_this.z); + } + ,setRotationFactor: function(rotationFactor) { + var _this = this._rotFactor; + _this.x = rotationFactor.x; + _this.y = rotationFactor.y; + _this.z = rotationFactor.z; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + ,getLinearVelocity: function() { + var v = new oimo_common_Vec3(); + v.x = this._velX; + v.y = this._velY; + v.z = this._velZ; + return v; + } + ,getLinearVelocityTo: function(linearVelocity) { + linearVelocity.x = this._velX; + linearVelocity.y = this._velY; + linearVelocity.z = this._velZ; + } + ,setLinearVelocity: function(linearVelocity) { + if(this._type == 1) { + this._velX = 0; + this._velY = 0; + this._velZ = 0; + } else { + this._velX = linearVelocity.x; + this._velY = linearVelocity.y; + this._velZ = linearVelocity.z; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,getAngularVelocity: function() { + var v = new oimo_common_Vec3(); + v.x = this._angVelX; + v.y = this._angVelY; + v.z = this._angVelZ; + return v; + } + ,getAngularVelocityTo: function(angularVelocity) { + angularVelocity.x = this._velX; + angularVelocity.y = this._velY; + angularVelocity.z = this._velZ; + } + ,setAngularVelocity: function(angularVelocity) { + if(this._type == 1) { + this._angVelX = 0; + this._angVelY = 0; + this._angVelZ = 0; + } else { + this._angVelX = angularVelocity.x; + this._angVelY = angularVelocity.y; + this._angVelZ = angularVelocity.z; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,addLinearVelocity: function(linearVelocityChange) { + if(this._type != 1) { + var dX; + var dY; + var dZ; + dX = linearVelocityChange.x; + dY = linearVelocityChange.y; + dZ = linearVelocityChange.z; + this._velX += dX; + this._velY += dY; + this._velZ += dZ; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,addAngularVelocity: function(angularVelocityChange) { + if(this._type != 1) { + var dX; + var dY; + var dZ; + dX = angularVelocityChange.x; + dY = angularVelocityChange.y; + dZ = angularVelocityChange.z; + this._angVelX += dX; + this._angVelY += dY; + this._angVelZ += dZ; + } + this._sleeping = false; + this._sleepTime = 0; + } + ,applyImpulse: function(impulse,positionInWorld) { + var impX; + var impY; + var impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; + this._velX += impX * this._invMass; + this._velY += impY * this._invMass; + this._velZ += impZ * this._invMass; + var aimpX; + var aimpY; + var aimpZ; + var posX; + var posY; + var posZ; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; + posX -= this._transform._positionX; + posY -= this._transform._positionY; + posZ -= this._transform._positionZ; + aimpX = posY * impZ - posZ * impY; + aimpY = posZ * impX - posX * impZ; + aimpZ = posX * impY - posY * impX; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._invInertia00 * aimpX + this._invInertia01 * aimpY + this._invInertia02 * aimpZ; + __tmp__Y = this._invInertia10 * aimpX + this._invInertia11 * aimpY + this._invInertia12 * aimpZ; + __tmp__Z = this._invInertia20 * aimpX + this._invInertia21 * aimpY + this._invInertia22 * aimpZ; + aimpX = __tmp__X; + aimpY = __tmp__Y; + aimpZ = __tmp__Z; + this._angVelX += aimpX; + this._angVelY += aimpY; + this._angVelZ += aimpZ; + this._sleeping = false; + this._sleepTime = 0; + } + ,applyLinearImpulse: function(impulse) { + var impX; + var impY; + var impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; + this._velX += impX * this._invMass; + this._velY += impY * this._invMass; + this._velZ += impZ * this._invMass; + this._sleeping = false; + this._sleepTime = 0; + } + ,applyAngularImpulse: function(impulse) { + var impX; + var impY; + var impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._invInertia00 * impX + this._invInertia01 * impY + this._invInertia02 * impZ; + __tmp__Y = this._invInertia10 * impX + this._invInertia11 * impY + this._invInertia12 * impZ; + __tmp__Z = this._invInertia20 * impX + this._invInertia21 * impY + this._invInertia22 * impZ; + impX = __tmp__X; + impY = __tmp__Y; + impZ = __tmp__Z; + this._angVelX += impX; + this._angVelY += impY; + this._angVelZ += impZ; + this._sleeping = false; + this._sleepTime = 0; + } + ,applyForce: function(force,positionInWorld) { + var iforceX; + var iforceY; + var iforceZ; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; + this._forceX += iforceX; + this._forceY += iforceY; + this._forceZ += iforceZ; + var itorqueX; + var itorqueY; + var itorqueZ; + var posX; + var posY; + var posZ; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; + posX -= this._transform._positionX; + posY -= this._transform._positionY; + posZ -= this._transform._positionZ; + itorqueX = posY * iforceZ - posZ * iforceY; + itorqueY = posZ * iforceX - posX * iforceZ; + itorqueZ = posX * iforceY - posY * iforceX; + this._torqueX += itorqueX; + this._torqueY += itorqueY; + this._torqueZ += itorqueZ; + this._sleeping = false; + this._sleepTime = 0; + } + ,applyForceToCenter: function(force) { + var iforceX; + var iforceY; + var iforceZ; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; + this._forceX += iforceX; + this._forceY += iforceY; + this._forceZ += iforceZ; + this._sleeping = false; + this._sleepTime = 0; + } + ,applyTorque: function(torque) { + var itorqueX; + var itorqueY; + var itorqueZ; + itorqueX = torque.x; + itorqueY = torque.y; + itorqueZ = torque.z; + this._torqueX += itorqueX; + this._torqueY += itorqueY; + this._torqueZ += itorqueZ; + this._sleeping = false; + this._sleepTime = 0; + } + ,getLinearContactImpulse: function() { + var res = new oimo_common_Vec3(); + res.x = this._linearContactImpulseX; + res.y = this._linearContactImpulseY; + res.z = this._linearContactImpulseZ; + return res; + } + ,getLinearContactImpulseTo: function(linearContactImpulse) { + linearContactImpulse.x = this._linearContactImpulseX; + linearContactImpulse.y = this._linearContactImpulseY; + linearContactImpulse.z = this._linearContactImpulseZ; + } + ,getAngularContactImpulse: function() { + var res = new oimo_common_Vec3(); + res.x = this._angularContactImpulseX; + res.y = this._angularContactImpulseY; + res.z = this._angularContactImpulseZ; + return res; + } + ,getAngularContactImpulseTo: function(angularContactImpulse) { + angularContactImpulse.x = this._angularContactImpulseX; + angularContactImpulse.y = this._angularContactImpulseY; + angularContactImpulse.z = this._angularContactImpulseZ; + } + ,getGravityScale: function() { + return this._gravityScale; + } + ,setGravityScale: function(gravityScale) { + this._gravityScale = gravityScale; + this._sleeping = false; + this._sleepTime = 0; + } + ,getLocalPoint: function(worldPoint) { + var vX; + var vY; + var vZ; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; + vX -= this._transform._positionX; + vY -= this._transform._positionY; + vZ -= this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + return res; + } + ,getLocalPointTo: function(worldPoint,localPoint) { + var vX; + var vY; + var vZ; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; + vX -= this._transform._positionX; + vY -= this._transform._positionY; + vZ -= this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; + } + ,getLocalVector: function(worldVector) { + var vX; + var vY; + var vZ; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + return res; + } + ,getLocalVectorTo: function(worldVector,localVector) { + var vX; + var vY; + var vZ; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + } + ,getWorldPoint: function(localPoint) { + var vX; + var vY; + var vZ; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += this._transform._positionX; + vY += this._transform._positionY; + vZ += this._transform._positionZ; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + return res; + } + ,getWorldPointTo: function(localPoint,worldPoint) { + var vX; + var vY; + var vZ; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += this._transform._positionX; + vY += this._transform._positionY; + vZ += this._transform._positionZ; + worldPoint.x = vX; + worldPoint.y = vY; + worldPoint.z = vZ; + } + ,getWorldVector: function(localVector) { + var vX; + var vY; + var vZ; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + return res; + } + ,getWorldVectorTo: function(localVector,worldVector) { + var vX; + var vY; + var vZ; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + worldVector.x = vX; + worldVector.y = vY; + worldVector.z = vZ; + } + ,getNumShapes: function() { + return this._numShapes; + } + ,getShapeList: function() { + return this._shapeList; + } + ,getNumContectLinks: function() { + return this._numContactLinks; + } + ,getContactLinkList: function() { + return this._contactLinkList; + } + ,getNumJointLinks: function() { + return this._numJointLinks; + } + ,getJointLinkList: function() { + return this._jointLinkList; + } + ,addShape: function(shape) { + if(this._shapeList == null) { + this._shapeList = shape; + this._shapeListLast = shape; + } else { + this._shapeListLast._next = shape; + shape._prev = this._shapeListLast; + this._shapeListLast = shape; + } + this._numShapes++; + shape._rigidBody = this; + if(this._world != null) { + var _this = this._world; + shape._proxy = _this._broadPhase.createProxy(shape,shape._aabb); + shape._id = _this._shapeIdCount++; + _this._numShapes++; + } + this.updateMass(); + var s = this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + ,removeShape: function(shape) { + var prev = shape._prev; + var next = shape._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(shape == this._shapeList) { + this._shapeList = this._shapeList._next; + } + if(shape == this._shapeListLast) { + this._shapeListLast = this._shapeListLast._prev; + } + shape._next = null; + shape._prev = null; + this._numShapes--; + shape._rigidBody = null; + if(this._world != null) { + var _this = this._world; + _this._broadPhase.destroyProxy(shape._proxy); + shape._proxy = null; + shape._id = -1; + var cl = shape._rigidBody._contactLinkList; + while(cl != null) { + var n = cl._next; + var c = cl._contact; + if(c._s1 == shape || c._s2 == shape) { + var _this1 = cl._other; + _this1._sleeping = false; + _this1._sleepTime = 0; + var _this2 = _this._contactManager; + var prev1 = c._prev; + var next1 = c._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c == _this2._contactList) { + _this2._contactList = _this2._contactList._next; + } + if(c == _this2._contactListLast) { + _this2._contactListLast = _this2._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc2 = c._s2._contactCallback; + if(c._s1._contactCallback == cc2) { + cc2 = null; + } + } + var prev2 = c._link1._prev; + var next2 = c._link1._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev3 = c._link2._prev; + var next3 = c._link2._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this3 = c._contactConstraint; + _this3._s1 = null; + _this3._s2 = null; + _this3._b1 = null; + _this3._b2 = null; + _this3._tf1 = null; + _this3._tf2 = null; + c._next = _this2._contactPool; + _this2._contactPool = c; + _this2._numContacts--; + } + cl = n; + } + _this._numShapes--; + } + this.updateMass(); + var s = this._shapeList; + while(s != null) { + var n1 = s._next; + var tf1 = this._ptransform; + var tf2 = this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n1; + } + } + ,getType: function() { + return this._type; + } + ,setType: function(type) { + this._type = type; + this.updateMass(); + } + ,wakeUp: function() { + this._sleeping = false; + this._sleepTime = 0; + } + ,sleep: function() { + this._sleeping = true; + this._sleepTime = 0; + } + ,isSleeping: function() { + return this._sleeping; + } + ,getSleepTime: function() { + return this._sleepTime; + } + ,setAutoSleep: function(autoSleepEnabled) { + this._autoSleep = autoSleepEnabled; + this._sleeping = false; + this._sleepTime = 0; + } + ,getLinearDamping: function() { + return this._linearDamping; + } + ,setLinearDamping: function(damping) { + this._linearDamping = damping; + } + ,getAngularDamping: function() { + return this._angularDamping; + } + ,setAngularDamping: function(damping) { + this._angularDamping = damping; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_rigidbody_RigidBody +}; +var oimo_dynamics_rigidbody_RigidBodyConfig = function() { + this.position = new oimo_common_Vec3(); + this.rotation = new oimo_common_Mat3(); + this.linearVelocity = new oimo_common_Vec3(); + this.angularVelocity = new oimo_common_Vec3(); + this.type = 0; + this.autoSleep = true; + this.linearDamping = 0; + this.angularDamping = 0; +}; +oimo_dynamics_rigidbody_RigidBodyConfig.__name__ = true; +oimo_dynamics_rigidbody_RigidBodyConfig.prototype = { + __class__: oimo_dynamics_rigidbody_RigidBodyConfig +}; +var oimo_dynamics_rigidbody_RigidBodyType = function() { }; +oimo_dynamics_rigidbody_RigidBodyType.__name__ = true; +var oimo_dynamics_rigidbody_Shape = function(config) { + this._id = -1; + this._localTransform = new oimo_common_Transform(); + this._ptransform = new oimo_common_Transform(); + this._transform = new oimo_common_Transform(); + var v = config.position; + this._localTransform._positionX = v.x; + this._localTransform._positionY = v.y; + this._localTransform._positionZ = v.z; + var m = config.rotation; + this._localTransform._rotation00 = m.e00; + this._localTransform._rotation01 = m.e01; + this._localTransform._rotation02 = m.e02; + this._localTransform._rotation10 = m.e10; + this._localTransform._rotation11 = m.e11; + this._localTransform._rotation12 = m.e12; + this._localTransform._rotation20 = m.e20; + this._localTransform._rotation21 = m.e21; + this._localTransform._rotation22 = m.e22; + var dst = this._ptransform; + var src = this._localTransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var dst1 = this._transform; + var src1 = this._localTransform; + dst1._positionX = src1._positionX; + dst1._positionY = src1._positionY; + dst1._positionZ = src1._positionZ; + dst1._rotation00 = src1._rotation00; + dst1._rotation01 = src1._rotation01; + dst1._rotation02 = src1._rotation02; + dst1._rotation10 = src1._rotation10; + dst1._rotation11 = src1._rotation11; + dst1._rotation12 = src1._rotation12; + dst1._rotation20 = src1._rotation20; + dst1._rotation21 = src1._rotation21; + dst1._rotation22 = src1._rotation22; + this._restitution = config.restitution; + this._friction = config.friction; + this._density = config.density; + this._geom = config.geometry; + this._collisionGroup = config.collisionGroup; + this._collisionMask = config.collisionMask; + this._contactCallback = config.contactCallback; + this._aabb = new oimo_collision_geometry_Aabb(); + this._proxy = null; + this.displacement = new oimo_common_Vec3(); +}; +oimo_dynamics_rigidbody_Shape.__name__ = true; +oimo_dynamics_rigidbody_Shape.prototype = { + getFriction: function() { + return this._friction; + } + ,setFriction: function(friction) { + this._friction = friction; + } + ,getRestitution: function() { + return this._restitution; + } + ,setRestitution: function(restitution) { + this._restitution = restitution; + } + ,getLocalTransform: function() { + var _this = this._localTransform; + var tf = new oimo_common_Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + ,getLocalTransformTo: function(transform) { + var transform1 = this._localTransform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + ,getTransform: function() { + var _this = this._transform; + var tf = new oimo_common_Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + ,getTransformTo: function(transform) { + var transform1 = this._transform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + ,setLocalTransform: function(transform) { + var _this = this._localTransform; + _this._positionX = transform._positionX; + _this._positionY = transform._positionY; + _this._positionZ = transform._positionZ; + _this._rotation00 = transform._rotation00; + _this._rotation01 = transform._rotation01; + _this._rotation02 = transform._rotation02; + _this._rotation10 = transform._rotation10; + _this._rotation11 = transform._rotation11; + _this._rotation12 = transform._rotation12; + _this._rotation20 = transform._rotation20; + _this._rotation21 = transform._rotation21; + _this._rotation22 = transform._rotation22; + if(this._rigidBody != null) { + var _this1 = this._rigidBody; + _this1.updateMass(); + var s = _this1._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + ,getDensity: function() { + return this._density; + } + ,setDensity: function(density) { + this._density = density; + if(this._rigidBody != null) { + var _this = this._rigidBody; + _this.updateMass(); + var s = _this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this._ptransform; + var tf2 = _this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + ,getAabb: function() { + return this._aabb.clone(); + } + ,getAabbTo: function(aabb) { + aabb.copyFrom(this._aabb); + } + ,getGeometry: function() { + return this._geom; + } + ,getRigidBody: function() { + return this._rigidBody; + } + ,getCollisionGroup: function() { + return this._collisionGroup; + } + ,setCollisionGroup: function(collisionGroup) { + this._collisionGroup = collisionGroup; + } + ,getCollisionMask: function() { + return this._collisionMask; + } + ,setCollisionMask: function(collisionMask) { + this._collisionMask = collisionMask; + } + ,getContactCallback: function() { + return this._contactCallback; + } + ,setContactCallback: function(callback) { + this._contactCallback = callback; + } + ,getPrev: function() { + return this._prev; + } + ,getNext: function() { + return this._next; + } + ,__class__: oimo_dynamics_rigidbody_Shape +}; +var oimo_dynamics_rigidbody_ShapeConfig = function() { + this.position = new oimo_common_Vec3(); + this.rotation = new oimo_common_Mat3(); + this.friction = oimo_common_Setting.defaultFriction; + this.restitution = oimo_common_Setting.defaultRestitution; + this.density = oimo_common_Setting.defaultDensity; + this.collisionGroup = oimo_common_Setting.defaultCollisionGroup; + this.collisionMask = oimo_common_Setting.defaultCollisionMask; + this.geometry = null; + this.contactCallback = null; +}; +oimo_dynamics_rigidbody_ShapeConfig.__name__ = true; +oimo_dynamics_rigidbody_ShapeConfig.prototype = { + __class__: oimo_dynamics_rigidbody_ShapeConfig +}; +var oimo_m_M = function() { }; +oimo_m_M.__name__ = true; +var $_; +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +String.prototype.__class__ = String; +String.__name__ = true; +Array.__name__ = true; +Date.prototype.__class__ = Date; +Date.__name__ = "Date"; +var Int = { }; +var Dynamic = { }; +var Float = Number; +var Bool = Boolean; +var Class = { }; +var Enum = { }; +var __map_reserved = {}; +Object.defineProperty(js__$Boot_HaxeError.prototype,"message",{ get : function() { + return String(this.val); +}}); +js_Boot.__toStr = ({ }).toString; +demo_common_UserInput.KEYBOARD_LENGTH = 256; +demo_common_UserInput.KEYCODE_LEFT = 37; +demo_common_UserInput.KEYCODE_UP = 38; +demo_common_UserInput.KEYCODE_RIGHT = 39; +demo_common_UserInput.KEYCODE_DOWN = 40; +demo_common_UserInput.KEYCODE_ENTER = 13; +demo_common_UserInput.KEYCODE_RETURN = 13; +demo_core_BroadPhaseStressDemo.RIGID_BODIES_STEP = 100; +demo_core_BroadPhaseStressDemo.FIELD_W = 50; +demo_core_BroadPhaseStressDemo.FIELD_H = 50; +demo_core_BroadPhaseStressDemo.FIELD_D = 50; +demo_core_CollisionFilteringDemo.G_FLOOR = 1; +demo_core_CollisionFilteringDemo.G_WALL = 2; +demo_core_CollisionFilteringDemo.G_BALL = 4; +demo_core_CollisionFilteringDemo.G_BOX = 8; +oimo_dynamics_common_DebugDraw.SPHERE_PHI_DIVISION = 8; +oimo_dynamics_common_DebugDraw.SPHERE_THETA_DIVISION = 4; +oimo_dynamics_common_DebugDraw.CIRCLE_THETA_DIVISION = 8; +oimo_collision_broadphase_BroadPhaseType._BRUTE_FORCE = 1; +oimo_collision_broadphase_BroadPhaseType._BVH = 2; +oimo_collision_broadphase_BroadPhaseType.BRUTE_FORCE = 1; +oimo_collision_broadphase_BroadPhaseType.BVH = 2; +oimo_collision_broadphase_bvh_BvhInsertionStrategy.SIMPLE = 0; +oimo_collision_broadphase_bvh_BvhInsertionStrategy.MINIMIZE_SURFACE_AREA = 1; +oimo_collision_geometry_GeometryType._SPHERE = 0; +oimo_collision_geometry_GeometryType._BOX = 1; +oimo_collision_geometry_GeometryType._CYLINDER = 2; +oimo_collision_geometry_GeometryType._CONE = 3; +oimo_collision_geometry_GeometryType._CAPSULE = 4; +oimo_collision_geometry_GeometryType._CONVEX_HULL = 5; +oimo_collision_geometry_GeometryType._CONVEX_MIN = 0; +oimo_collision_geometry_GeometryType._CONVEX_MAX = 5; +oimo_collision_geometry_GeometryType.SPHERE = 0; +oimo_collision_geometry_GeometryType.BOX = 1; +oimo_collision_geometry_GeometryType.CYLINDER = 2; +oimo_collision_geometry_GeometryType.CONE = 3; +oimo_collision_geometry_GeometryType.CAPSULE = 4; +oimo_collision_geometry_GeometryType.CONVEX_HULL = 5; +oimo_collision_narrowphase_detector_BoxBoxDetector.EDGE_BIAS_MULT = 1.0; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.OK = 0; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.INVALID_TRIANGLE = 1; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.NO_ADJACENT_PAIR_INDEX = 2; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.NO_ADJACENT_TRIANGLE = 3; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.EDGE_LOOP_BROKEN = 4; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.NO_OUTER_TRIANGLE = 5; +oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState.TRIANGLE_INVISIBLE = 6; +oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.count = 0; +oimo_common_Vec3.numCreations = 0; +oimo_common_Setting.defaultFriction = 0.2; +oimo_common_Setting.defaultRestitution = 0.2; +oimo_common_Setting.defaultDensity = 1; +oimo_common_Setting.defaultCollisionGroup = 1; +oimo_common_Setting.defaultCollisionMask = 1; +oimo_common_Setting.maxTranslationPerStep = 20; +oimo_common_Setting.maxRotationPerStep = 3.14159265358979; +oimo_common_Setting.bvhProxyPadding = 0.1; +oimo_common_Setting.bvhIncrementalCollisionThreshold = 0.45; +oimo_common_Setting.defaultGJKMargin = 0.05; +oimo_common_Setting.enableGJKCaching = true; +oimo_common_Setting.maxEPAVertices = 128; +oimo_common_Setting.maxEPAPolyhedronFaces = 128; +oimo_common_Setting.contactEnableBounceThreshold = 0.5; +oimo_common_Setting.velocityBaumgarte = 0.2; +oimo_common_Setting.positionSplitImpulseBaumgarte = 0.4; +oimo_common_Setting.positionNgsBaumgarte = 1.0; +oimo_common_Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold = 0.05; +oimo_common_Setting.defaultContactPositionCorrectionAlgorithm = 0; +oimo_common_Setting.alternativeContactPositionCorrectionAlgorithm = 1; +oimo_common_Setting.contactPersistenceThreshold = 0.05; +oimo_common_Setting.maxManifoldPoints = 4; +oimo_common_Setting.defaultJointConstraintSolverType = 0; +oimo_common_Setting.defaultJointPositionCorrectionAlgorithm = 0; +oimo_common_Setting.jointWarmStartingFactorForBaungarte = 0.8; +oimo_common_Setting.jointWarmStartingFactor = 0.95; +oimo_common_Setting.minSpringDamperDampingRatio = 1e-6; +oimo_common_Setting.minRagdollMaxSwingAngle = 1e-6; +oimo_common_Setting.maxJacobianRows = 6; +oimo_common_Setting.directMlcpSolverEps = 1e-9; +oimo_common_Setting.islandInitialRigidBodyArraySize = 128; +oimo_common_Setting.islandInitialConstraintArraySize = 128; +oimo_common_Setting.sleepingVelocityThreshold = 0.2; +oimo_common_Setting.sleepingAngularVelocityThreshold = 0.5; +oimo_common_Setting.sleepingTimeThreshold = 1.0; +oimo_common_Setting.disableSleeping = false; +oimo_common_Setting.linearSlop = 0.005; +oimo_common_Setting.angularSlop = 0.017453292519943278; +oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance = new oimo_collision_narrowphase_detector_gjkepa_GjkEpa(); +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._SUCCEEDED = 0; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._GJK_FAILED_TO_MAKE_TETRAHEDRON = 1; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._GJK_DID_NOT_CONVERGE = 2; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._EPA_FAILED_TO_INIT = 257; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._EPA_FAILED_TO_ADD_VERTEX = 258; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState._EPA_DID_NOT_CONVERGE = 259; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED = 0; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.GJK_FAILED_TO_MAKE_TETRAHEDRON = 1; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.GJK_DID_NOT_CONVERGE = 2; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_INIT = 257; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX = 258; +oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_DID_NOT_CONVERGE = 259; +oimo_common_Mat3.numCreations = 0; +oimo_common_Mat4.numCreations = 0; +oimo_common_MathUtil.POSITIVE_INFINITY = 1e65536; +oimo_common_MathUtil.NEGATIVE_INFINITY = -1e65536; +oimo_common_MathUtil.PI = 3.14159265358979; +oimo_common_MathUtil.TWO_PI = 6.28318530717958; +oimo_common_MathUtil.HALF_PI = 1.570796326794895; +oimo_common_MathUtil.TO_RADIANS = 0.017453292519943278; +oimo_common_MathUtil.TO_DEGREES = 57.29577951308238; +oimo_common_Quat.numCreations = 0; +oimo_dynamics_common_Performance.broadPhaseCollisionTime = 0; +oimo_dynamics_common_Performance.narrowPhaseCollisionTime = 0; +oimo_dynamics_common_Performance.dynamicsTime = 0; +oimo_dynamics_common_Performance.totalTime = 0; +oimo_dynamics_constraint_PositionCorrectionAlgorithm._BAUMGARTE = 0; +oimo_dynamics_constraint_PositionCorrectionAlgorithm._SPLIT_IMPULSE = 1; +oimo_dynamics_constraint_PositionCorrectionAlgorithm._NGS = 2; +oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE = 0; +oimo_dynamics_constraint_PositionCorrectionAlgorithm.SPLIT_IMPULSE = 1; +oimo_dynamics_constraint_PositionCorrectionAlgorithm.NGS = 2; +oimo_dynamics_constraint_info_JacobianRow.BIT_LINEAR_SET = 1; +oimo_dynamics_constraint_info_JacobianRow.BIT_ANGULAR_SET = 2; +oimo_dynamics_constraint_joint_JointType._SPHERICAL = 0; +oimo_dynamics_constraint_joint_JointType._REVOLUTE = 1; +oimo_dynamics_constraint_joint_JointType._CYLINDRICAL = 2; +oimo_dynamics_constraint_joint_JointType._PRISMATIC = 3; +oimo_dynamics_constraint_joint_JointType._UNIVERSAL = 4; +oimo_dynamics_constraint_joint_JointType._RAGDOLL = 5; +oimo_dynamics_constraint_joint_JointType._GENERIC = 6; +oimo_dynamics_constraint_joint_JointType.SPHERICAL = 0; +oimo_dynamics_constraint_joint_JointType.REVOLUTE = 1; +oimo_dynamics_constraint_joint_JointType.CYLINDRICAL = 2; +oimo_dynamics_constraint_joint_JointType.PRISMATIC = 3; +oimo_dynamics_constraint_joint_JointType.UNIVERSAL = 4; +oimo_dynamics_constraint_joint_JointType.RAGDOLL = 5; +oimo_dynamics_constraint_joint_JointType.GENERIC = 6; +oimo_dynamics_constraint_solver_ConstraintSolverType._ITERATIVE = 0; +oimo_dynamics_constraint_solver_ConstraintSolverType._DIRECT = 1; +oimo_dynamics_constraint_solver_ConstraintSolverType.ITERATIVE = 0; +oimo_dynamics_constraint_solver_ConstraintSolverType.DIRECT = 1; +oimo_dynamics_rigidbody_RigidBodyType._DYNAMIC = 0; +oimo_dynamics_rigidbody_RigidBodyType._STATIC = 1; +oimo_dynamics_rigidbody_RigidBodyType._KINEMATIC = 2; +oimo_dynamics_rigidbody_RigidBodyType.DYNAMIC = 0; +oimo_dynamics_rigidbody_RigidBodyType.STATIC = 1; +oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC = 2; +demo_js_DemoJS.main(); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); diff --git a/demos/bin/js/index.html b/demos/bin/js/index.html new file mode 100644 index 0000000..cfd6c0a --- /dev/null +++ b/demos/bin/js/index.html @@ -0,0 +1,16 @@ + + + + + OimoPhysics Demos + + + + + +
+ + +
+ + diff --git a/demos/src/demo/js/WebGLDebugGraphics.hx b/demos/src/demo/js/WebGLDebugGraphics.hx index 5b78fae..4889fab 100644 --- a/demos/src/demo/js/WebGLDebugGraphics.hx +++ b/demos/src/demo/js/WebGLDebugGraphics.hx @@ -1,6 +1,6 @@ package demo.js; import demo.js.minilib.*; -import js.html.Float32Array; +import js.lib.Float32Array; import js.html.webgl.GL; import oimo.dynamics.common.DebugDraw; import oimo.common.Mat4; @@ -8,7 +8,6 @@ import oimo.common.Vec3; import oimo.physics.debugdraw.*; import demo.common.IDemoGraphics; - /** * Debug graphics for WebGL. */ @@ -374,23 +373,19 @@ class WebGLDebugGraphics extends DebugDraw implements IDemoGraphics { setFloat1("shininess", 1); } - @:extern - inline function setMat4(name:String, matrix:Mat4):Void { + extern inline function setMat4(name:String, matrix:Mat4):Void { gl.uniformMatrix4fv(shader.getUniformLocation(name), false, matrix.toArray(true)); } - @:extern - inline function setFloat3(name:String, x:Float, y:Float, z:Float):Void { + extern inline function setFloat3(name:String, x:Float, y:Float, z:Float):Void { gl.uniform3f(shader.getUniformLocation(name), x, y, z); } - @:extern - inline function setVec3(name:String, v:Vec3):Void { + extern inline function setVec3(name:String, v:Vec3):Void { gl.uniform3f(shader.getUniformLocation(name), v.x, v.y, v.z); } - @:extern - inline function setFloat1(name:String, x:Float):Void { + extern inline function setFloat1(name:String, x:Float):Void { gl.uniform1f(shader.getUniformLocation(name), x); } diff --git a/demos/src/demo/js/minilib/OMain.hx b/demos/src/demo/js/minilib/OMain.hx index 4198a61..1683b88 100644 --- a/demos/src/demo/js/minilib/OMain.hx +++ b/demos/src/demo/js/minilib/OMain.hx @@ -38,8 +38,7 @@ class OMain { __timer.run(); } - @:extern - inline function __addEventListeners():Void { + extern inline function __addEventListeners():Void { if (__state != 2) throw "invalid call"; var touchCount:Int = 0; var firstTouchId:Int = -1; @@ -137,8 +136,7 @@ class OMain { throw "override this"; } - @:extern - inline function initFullScreen(frameRate:Int):Void { + extern inline function initFullScreen(frameRate:Int):Void { if (__state != 0) throw "invalid call"; __state = 1; @@ -169,88 +167,72 @@ class OMain { __timer = new OTimer(frameRate, __loop); } - @:extern - inline function get_width():Int { + extern inline function get_width():Int { return __width; } - @:extern - inline function get_height():Int { + extern inline function get_height():Int { return __height; } // ----------------------------------------------- utils - @:extern - public inline function sqrt(a:Float):Float { + extern public inline function sqrt(a:Float):Float { return Math.sqrt(a); } - @:extern - public inline function pow(a:Float, b:Float):Float { + extern public inline function pow(a:Float, b:Float):Float { return Math.pow(a, b); } - @:extern - public inline function round(a:Float):Int { + extern public inline function round(a:Float):Int { return a < 0 ? Std.int(a - 0.5) : Std.int(a + 0.5); } - @:extern - public inline function min(a:Float, b:Float):Float { + extern public inline function min(a:Float, b:Float):Float { return a < b ? a : b; } - @:extern - public inline function max(a:Float, b:Float):Float { + extern public inline function max(a:Float, b:Float):Float { return a > b ? a : b; } - @:extern - public inline function abs(a:Float):Float { + extern public inline function abs(a:Float):Float { return a > 0 ? a : -a; } - @:extern - public inline function clamp(a:Float, min:Float, max:Float):Float { + extern public inline function clamp(a:Float, min:Float, max:Float):Float { return a > max ? max : a < min ? min : a; } - @:extern - public inline function mini(a:Int, b:Int):Int { + extern public inline function mini(a:Int, b:Int):Int { return a < b ? a : b; } - @:extern - public inline function maxi(a:Int, b:Int):Int { + extern public inline function maxi(a:Int, b:Int):Int { return a > b ? a : b; } - @:extern - public inline function absi(a:Int):Int { + extern public inline function absi(a:Int):Int { return a > 0 ? a : -a; } - @:extern - public inline function clampi(a:Int, min:Int, max:Int):Int { + extern public inline function clampi(a:Int, min:Int, max:Int):Int { return a > max ? max : a < min ? min : a; } - @:extern - public inline function smoothstep(x:Float, edge0:Float, edge1:Float):Float { + extern public inline function smoothstep(x:Float, edge0:Float, edge1:Float):Float { var t:Float = (x - edge0) / (edge1 - edge0); if (t > 1) t = 1; else if (t < 0) t = 0; return t * t * (3 - 2 * t); } - @:extern - public inline function rand(min:Float, max:Float):Float { + extern public inline function rand(min:Float, max:Float):Float { return Math.random() * (max - min) + min; } - @:extern - public inline function distance(x:Float, y:Float):Float { + extern public inline function distance(x:Float, y:Float):Float { return Math.sqrt(x * x + y * y); } } diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..f25abc3 --- /dev/null +++ b/docs/404.html @@ -0,0 +1 @@ +File not found - OimoPhysics API documentation

404 Page not found

Page not found, sorry.

\ No newline at end of file diff --git a/docs/doc.xml b/docs/doc.xml new file mode 100644 index 0000000..373a8bd --- /dev/null +++ b/docs/doc.xml @@ -0,0 +1,14308 @@ + + + + + + + `Any` is a type that is compatible with any other in both ways. + + This means that a value of any type can be assigned to `Any`, and + vice-versa, a value of `Any` type can be assigned to any other type. + + It's a more type-safe alternative to `Dynamic`, because it doesn't + support field access or operators and it's bound to monomorphs. So, + to work with the actual value, it needs to be explicitly promoted + to another type. + + + + + + The length of `this` Array. + + + + + + + Returns a new Array by appending the elements of `a` to the elements of + `this` Array. + + This operation does not modify `this` Array. + + If `a` is the empty Array `[]`, a copy of `this` Array is returned. + + The length of the returned Array is equal to the sum of `this.length` + and `a.length`. + + If `a` is `null`, the result is unspecified. + + + + + + + Returns a string representation of `this` Array, with `sep` separating + each element. + + The result of this operation is equal to `Std.string(this[0]) + sep + + Std.string(this[1]) + sep + ... + sep + Std.string(this[this.length-1])` + + If `this` is the empty Array `[]`, the result is the empty String `""`. + If `this` has exactly one element, the result is equal to a call to + `Std.string(this[0])`. + + If `sep` is null, the result is unspecified. + + + + Removes the last element of `this` Array and returns it. + + This operation modifies `this` Array in place. + + If `this` has at least one element, `this.length` will decrease by 1. + + If `this` is the empty Array `[]`, null is returned and the length + remains 0. + + + + + + + Adds the element `x` at the end of `this` Array and returns the new + length of `this` Array. + + This operation modifies `this` Array in place. + + `this.length` increases by 1. + + + + + + + + Removes the first element of `this` Array and returns it. + + This operation modifies `this` Array in place. + + If `this` has at least one element, `this`.length and the index of each + remaining element is decreased by 1. + + If `this` is the empty Array `[]`, `null` is returned and the length + remains 0. + + + + + + + + Creates a shallow copy of the range of `this` Array, starting at and + including `pos`, up to but not including `end`. + + This operation does not modify `this` Array. + + The elements are not copied and retain their identity. + + If `end` is omitted or exceeds `this.length`, it defaults to the end of + `this` Array. + + If `pos` or `end` are negative, their offsets are calculated from the + end of `this` Array by `this.length + pos` and `this.length + end` + respectively. If this yields a negative value, 0 is used instead. + + If `pos` exceeds `this.length` or if `end` is less than or equals + `pos`, the result is `[]`. + + + + + + + + + + + y and a + negative Int if x < y. + + This operation modifies `this` Array in place. + + The sort operation is not guaranteed to be stable, which means that the + order of equal elements may not be retained. For a stable Array sorting + algorithm, `haxe.ds.ArraySort.sort()` can be used instead. + + If `f` is null, the result is unspecified.]]> + + + + + + + + + + + + Returns a string representation of `this` Array. + + The result will include the individual elements' String representations + separated by comma. The enclosing [ ] may be missing on some platforms, + use `Std.string()` to get a String representation that is consistent + across platforms. + + + + + + + Adds the element `x` at the start of `this` Array. + + This operation modifies `this` Array in place. + + `this.length` and the index of each Array element increases by 1. + + + + + + + + Inserts the element `x` at the position `pos`. + + This operation modifies `this` Array in place. + + The offset is calculated like so: + + - If `pos` exceeds `this.length`, the offset is `this.length`. + - If `pos` is negative, the offset is calculated from the end of `this` + Array, i.e. `this.length + pos`. If this yields a negative value, the + offset is 0. + - Otherwise, the offset is `pos`. + + If the resulting offset does not exceed `this.length`, all elements from + and including that offset to the end of `this` Array are moved one index + ahead. + + + + + + + Removes the first occurrence of `x` in `this` Array. + + This operation modifies `this` Array in place. + + If `x` is found by checking standard equality, it is removed from `this` + Array and all following elements are reindexed accordingly. The function + then returns true. + + If `x` is not found, `this` Array is not changed and the function + returns false. + + + + + + + + Returns position of the first occurrence of `x` in `this` Array, searching front to back. + + If `x` is found by checking standard equality, the function returns its index. + + If `x` is not found, the function returns -1. + + If `fromIndex` is specified, it will be used as the starting index to search from, + otherwise search starts with zero index. If it is negative, it will be taken as the + offset from the end of `this` Array to compute the starting index. If given or computed + starting index is less than 0, the whole array will be searched, if it is greater than + or equal to the length of `this` Array, the function returns -1. + + + + + + + + Returns position of the last occurrence of `x` in `this` Array, searching back to front. + + If `x` is found by checking standard equality, the function returns its index. + + If `x` is not found, the function returns -1. + + If `fromIndex` is specified, it will be used as the starting index to search from, + otherwise search starts with the last element index. If it is negative, it will be + taken as the offset from the end of `this` Array to compute the starting index. If + given or computed starting index is greater than or equal to the length of `this` Array, + the whole array will be searched, if it is less than 0, the function returns -1. + + + + Returns a shallow copy of `this` Array. + + The elements are not copied and retain their identity, so + `a[i] == a.copy()[i]` is true for any valid `i`. However, + `a == a.copy()` is always false. + + + + Returns an iterator of the Array values. + + + + + + + + + + + Creates a new Array by applying function `f` to all elements of `this`. + + The order of elements is preserved. + + If `f` is null, the result is unspecified. + + + + + + + + + + + Returns an Array containing those elements of `this` for which `f` + returned true. + + The individual elements are not duplicated and retain their identity. + + If `f` is null, the result is unspecified. + + + + + + + Set the length of the Array. + + If `len` is shorter than the array's current size, the last + `length - len` elements will be removed. If `len` is longer, the Array + will be extended, with new elements set to a target-specific default + value: + + - always null on dynamic targets + - 0, 0.0 or false for Int, Float and Bool respectively on static targets + - null for other types on static targets + + + + Creates a new Array. + + An Array is a storage for values. You can access it using indexes or + with its API. + + @see https://haxe.org/manual/std-Array.html + @see https://haxe.org/manual/lf-array-comprehension.html + + + + + An abstract type that represents a Class. + + See `Type` for the Haxe Reflection API. + + @see https://haxe.org/manual/types-class-instance.html + + + + + + + + + + + + Escape the string `s` for use as a part of regular expression. + + If `s` is null, the result is unspecified. + + + + + + + Tells if `this` regular expression matches String `s`. + + This method modifies the internal state. + + If `s` is `null`, the result is unspecified. + + + + + + + Returns the matched sub-group `n` of `this` EReg. + + This method should only be called after `this.match` or + `this.matchSub`, and then operates on the String of that operation. + + The index `n` corresponds to the n-th set of parentheses in the pattern + of `this` EReg. If no such sub-group exists, the result is unspecified. + + If `n` equals 0, the whole matched substring is returned. + + + + Returns the part to the left of the last matched substring. + + If the most recent call to `this.match` or `this.matchSub` did not + match anything, the result is unspecified. + + If the global g modifier was in place for the matching, only the + substring to the left of the leftmost match is returned. + + The result does not include the matched part. + + + + Returns the part to the right of the last matched substring. + + If the most recent call to `this.match` or `this.matchSub` did not + match anything, the result is unspecified. + + If the global g modifier was in place for the matching, only the + substring to the right of the leftmost match is returned. + + The result does not include the matched part. + + + + + + + Returns the position and length of the last matched substring, within + the String which was last used as argument to `this.match` or + `this.matchSub`. + + If the most recent call to `this.match` or `this.matchSub` did not + match anything, the result is unspecified. + + If the global g modifier was in place for the matching, the position and + length of the leftmost substring is returned. + + + + + + + + + { len : -1 } + Tells if `this` regular expression matches a substring of String `s`. + + This function expects `pos` and `len` to describe a valid substring of + `s`, or else the result is unspecified. To get more robust behavior, + `this.match(s.substr(pos,len))` can be used instead. + + This method modifies the internal state. + + If `s` is null, the result is unspecified. + + + + + + + Splits String `s` at all substrings `this` EReg matches. + + If a match is found at the start of `s`, the result contains a leading + empty String "" entry. + + If a match is found at the end of `s`, the result contains a trailing + empty String "" entry. + + If two matching substrings appear next to each other, the result + contains the empty String `""` between them. + + By default, this method splits `s` into two parts at the first matched + substring. If the global g modifier is in place, `s` is split at each + matched substring. + + If `s` is null, the result is unspecified. + + + + + + + + Replaces the first substring of `s` which `this` EReg matches with `by`. + + If `this` EReg does not match any substring, the result is `s`. + + By default, this method replaces only the first matched substring. If + the global g modifier is in place, all matched substrings are replaced. + + If `by` contains `$1` to `$9`, the digit corresponds to number of a + matched sub-group and its value is used instead. If no such sub-group + exists, the replacement is unspecified. The string `$$` becomes `$`. + + If `s` or `by` are null, the result is unspecified. + + + + + + + + + + + Calls the function `f` for the substring of `s` which `this` EReg matches + and replaces that substring with the result of `f` call. + + The `f` function takes `this` EReg object as its first argument and should + return a replacement string for the substring matched. + + If `this` EReg does not match any substring, the result is `s`. + + By default, this method replaces only the first matched substring. If + the global g modifier is in place, all matched substrings are replaced. + + If `s` or `f` are null, the result is unspecified. + + + + + + + + Creates a new regular expression with pattern `r` and modifiers `opt`. + + This is equivalent to the shorthand syntax `~/r/opt` + + If `r` or `opt` are null, the result is unspecified. + + ]]> + + + + + An abstract type that represents an Enum type. + + The corresponding enum instance type is `EnumValue`. + + See `Type` for the Haxe Reflection API. + + @see https://haxe.org/manual/types-enum-instance.html + + + + + + + + An abstract type that represents any enum value. + See `Type` for the Haxe Reflection API. + + @see https://haxe.org/manual/types-enum-instance.html + + + + + + + + + + + + + + hide + + + + + + + Represents the ratio of the circumference of a circle to its diameter, + specified by the constant, π. `PI` is approximately 3.141592653589793. + + + + A special `Float` constant which denotes negative infinity. + + For example, this is the result of -1.0 / 0.0. + + Operations with `NEGATIVE_INFINITY` as an operand may result in + `NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`. + + If this constant is converted to an `Int`, e.g. through `Std.int()`, the + result is unspecified. + + + + A special `Float` constant which denotes positive infinity. + + For example, this is the result of 1.0 / 0.0. + + Operations with `POSITIVE_INFINITY` as an operand may result in + `NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`. + + If this constant is converted to an `Int`, e.g. through `Std.int()`, the + result is unspecified. + + + + A special `Float` constant which denotes an invalid number. + + NaN stands for "Not a Number". It occurs when a mathematically incorrect + operation is executed, such as taking the square root of a negative + number: Math.sqrt(-1). + + All further operations with `NaN` as an operand will result in `NaN`. + + If this constant is converted to an `Int`, e.g. through `Std.int()`, the + result is unspecified. + + In order to test if a value is `NaN`, you should use `Math.isNaN()` function. + + + + + + + Returns the absolute value of `v`. + + If `v` is positive or 0, the result is unchanged. Otherwise the result + is -`v`. + + If `v` is `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is + `POSITIVE_INFINITY`. + + If `v` is `NaN`, the result is `NaN`. + + + + + + + + Returns the smaller of values `a` and `b`. + + If `a` or `b` are `NaN`, the result is `NaN`. + If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + + + + + + + + Returns the greater of values `a` and `b`. + + If `a` or `b` are `NaN`, the result is `NaN`. + If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + + + + + + + Returns the trigonometric sine of the specified angle `v`, in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + Returns the trigonometric cosine of the specified angle `v`, in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + Returns the trigonometric tangent of the specified angle `v`, in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + Returns the trigonometric arc of the specified angle `v`, in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + Returns the trigonometric arc cosine of the specified angle `v`, + in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + Returns the trigonometric arc tangent of the specified angle `v`, + in radians. + + If `v` is `NaN` or infinite, the result is `NaN`. + + + + + + + + Returns the trigonometric arc tangent whose tangent is the quotient of + two specified numbers, in radians. + + If parameter `x` or `y` is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, + the result is `NaN`. + + + + + + + Returns Euler's number, raised to the power of `v`. + + exp(1.0) is approximately 2.718281828459. + + If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + If `v` is `NEGATIVE_INFINITY`, the result is `0.0`. + If `v` is `NaN`, the result is `NaN`. + + + + + + + Returns the natural logarithm of `v`. + + This is the mathematical inverse operation of exp, + i.e. `log(exp(v)) == v` always holds. + + If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result + is `NaN`. + If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + If `v` is `0.0`, the result is `NEGATIVE_INFINITY`. + + + + + + + + Returns a specified base `v` raised to the specified power `exp`. + + + + + + + Returns the square root of `v`. + + If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result + is `NaN`. + If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + If `v` is `0.0`, the result is `0.0`. + + + + + + + Rounds `v` to the nearest integer value. + + Ties are rounded up, so that `0.5` becomes `1` and `-0.5` becomes `0`. + + If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY` + or `POSITIVE_INFINITY`, the result is unspecified. + + + + + + + Returns the largest integer value that is not greater than `v`. + + If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY` + or `POSITIVE_INFINITY`, the result is unspecified. + + + + + + + Returns the smallest integer value that is not less than `v`. + + If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY` + or `POSITIVE_INFINITY`, the result is unspecified. + + + + Returns a pseudo-random number which is greater than or equal to 0.0, + and less than 1.0. + + + + + + + Returns the largest integer value that is not greater than `v`, as a `Float`. + + If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, + the result is unspecified. + + + + + + + Returns the smallest integer value that is not less than `v`, as a `Float`. + + If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, + the result is unspecified. + + + + + + + Rounds `v` to the nearest integer value, as a Float. + + Ties are rounded up, so that `0.5` becomes `1` and `-0.5` becomes `0`. + + If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, + the result is unspecified. + + + + + + + Tells if `f` is a finite number. + + If `f` is `POSITIVE_INFINITY`, `NEGATIVE_INFINITY` or `NaN`, the result + is `false`, otherwise the result is `true`. + + + + + + + Tells if `f` is not a valid number. + + If `f` is `NaN`, the result is `true`, otherwise the result is `false`. + In particular, both `POSITIVE_INFINITY` and `NEGATIVE_INFINITY` are + not considered `NaN`. + + This class defines mathematical functions and constants. + + @see https://haxe.org/manual/std-math.html + + + + + + + + + + Tells if structure `o` has a field named `field`. + + This is only guaranteed to work for anonymous structures. Refer to + `Type.getInstanceFields` for a function supporting class instances. + + If `o` or `field` are null, the result is unspecified. + + + + + + + + Returns the value of the field named `field` on object `o`. + + If `o` is not an object or has no field named `field`, the result is + null. + + If the field is defined as a property, its accessors are ignored. Refer + to `Reflect.getProperty` for a function supporting property accessors. + + If `field` is null, the result is unspecified. + + (As3) If used on a property field, the getter will be invoked. It is + not possible to obtain the value directly. + + + + + + + + + Sets the field named `field` of object `o` to value `value`. + + If `o` has no field named `field`, this function is only guaranteed to + work for anonymous structures. + + If `o` or `field` are null, the result is unspecified. + + (As3) If used on a property field, the setter will be invoked. It is + not possible to set the value directly. + + + + + + + + Returns the value of the field named `field` on object `o`, taking + property getter functions into account. + + If the field is not a property, this function behaves like + `Reflect.field`, but might be slower. + + If `o` or `field` are null, the result is unspecified. + + + + + + + + + Sets the field named `field` of object `o` to value `value`, taking + property setter functions into account. + + If the field is not a property, this function behaves like + `Reflect.setField`, but might be slower. + + If `field` is null, the result is unspecified. + + + + + + + + + Call a method `func` with the given arguments `args`. + + The object `o` is ignored in most cases. It serves as the `this`-context in the following + situations: + + * (neko) Allows switching the context to `o` in all cases. + * (macro) Same as neko for Haxe 3. No context switching in Haxe 4. + * (js, lua) Require the `o` argument if `func` does not, but should have a context. + This can occur by accessing a function field natively, e.g. through `Reflect.field` + or by using `(object : Dynamic).field`. However, if `func` has a context, `o` is + ignored like on other targets. + + + + + + + Returns the fields of structure `o`. + + This method is only guaranteed to work on anonymous structures. Refer to + `Type.getInstanceFields` for a function supporting class instances. + + If `o` is null, the result is unspecified. + + + + + + + Returns true if `f` is a function, false otherwise. + + If `f` is null, the result is false. + + + + + + + + Compares `a` and `b`. + + If `a` is less than `b`, the result is negative. If `b` is less than + `a`, the result is positive. If `a` and `b` are equal, the result is 0. + + This function is only defined if `a` and `b` are of the same type. + + If that type is a function, the result is unspecified and + `Reflect.compareMethods` should be used instead. + + For all other types, the result is 0 if `a` and `b` are equal. If they + are not equal, the result depends on the type and is negative if: + + - Numeric types: a is less than b + - String: a is lexicographically less than b + - Other: unspecified + + If `a` and `b` are null, the result is 0. If only one of them is null, + the result is unspecified. + + + + + + + + Compares the functions `f1` and `f2`. + + If `f1` or `f2` are null, the result is false. + If `f1` or `f2` are not functions, the result is unspecified. + + Otherwise the result is true if `f1` and the `f2` are physically equal, + false otherwise. + + If `f1` or `f2` are member method closures, the result is true if they + are closures of the same method on the same object value, false otherwise. + + + + + + + ` + - `Enum` + + Otherwise, including if `v` is null, the result is false.]]> + + + + + + + Tells if `v` is an enum value. + + The result is true if `v` is of type EnumValue, i.e. an enum + constructor. + + Otherwise, including if `v` is null, the result is false. + + + + + + + + Removes the field named `field` from structure `o`. + + This method is only guaranteed to work on anonymous structures. + + If `o` or `field` are null, the result is unspecified. + + + + + + + Copies the fields of structure `o`. + + This is only guaranteed to work on anonymous structures. + + If `o` is null, the result is `null`. + + + + + + + + + + Transform a function taking an array of arguments into a function that can + be called with any number of arguments. + + + + + + + + + Transform a function taking an array of arguments into a function that can + be called with any number of arguments. + + + The Reflect API is a way to manipulate values dynamically through an + abstract interface in an untyped manner. Use with care. + + @see https://haxe.org/manual/std-reflection.html + + + + + + + + + Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null. + + If `t` is a class or interface with `@:generic` meta, the result is `false`. + + + + + + + + Checks if object `value` is an instance of class or interface `c`. + + Compiles only if the type specified by `c` can be assigned to the type + of `value`. + + This method checks if a downcast is possible. That is, if the runtime + type of `value` is assignable to the type specified by `c`, `value` is + returned. Otherwise null is returned. + + This method is not guaranteed to work with core types such as `String`, + `Array` and `Date`. + + If `value` is null, the result is null. If `c` is null, the result is + unspecified. + + + + + + + + "Std.instance() is deprecated. Use Std.downcast() instead." + + + + + + + Converts any value to a String. + + If `s` is of `String`, `Int`, `Float` or `Bool`, its value is returned. + + If `s` is an instance of a class and that class or one of its parent classes has + a `toString` method, that method is called. If no such method is present, the result + is unspecified. + + If `s` is an enum constructor without argument, the constructor's name is returned. If + arguments exists, the constructor's name followed by the String representations of + the arguments is returned. + + If `s` is a structure, the field names along with their values are returned. The field order + and the operator separating field names and values are unspecified. + + If s is null, "null" is returned. + + + + + + + Converts a `Float` to an `Int`, rounded towards 0. + + If `x` is outside of the signed Int32 range, or is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is unspecified. + + + + + + + Converts a `String` to an `Int`. + + Leading whitespaces are ignored. + + If `x` starts with 0x or 0X, hexadecimal notation is recognized where the following digits may + contain 0-9 and A-F. + + Otherwise `x` is read as decimal number with 0-9 being allowed characters. `x` may also start with + a - to denote a negative value. + + In decimal mode, parsing continues until an invalid character is detected, in which case the + result up to that point is returned. For hexadecimal notation, the effect of invalid characters + is unspecified. + + Leading 0s that are not part of the 0x/0X hexadecimal notation are ignored, which means octal + notation is not supported. + + If `x` is null, the result is unspecified. + If `x` cannot be parsed as integer, the result is `null`. + + + + + + + Converts a `String` to a `Float`. + + The parsing rules for `parseInt` apply here as well, with the exception of invalid input + resulting in a `NaN` value instead of null. + + Additionally, decimal notation may contain a single `.` to denote the start of the fractions. + + + + + + + + + The Std class provides standard methods for manipulating basic types. + + + + + The standard `Void` type. Only `null` values can be of the type `Void`. + + @see https://haxe.org/manual/types-void.html + + + + + ` can be used instead. + + `Std.int` converts a `Float` to an `Int`, rounded towards 0. + `Std.parseFloat` converts a `String` to a `Float`. + + @see https://haxe.org/manual/types-basic-types.html + @see https://haxe.org/manual/types-nullability.html]]> + + + + + + + + + + ` can be used instead. + + `Std.int` converts a `Float` to an `Int`, rounded towards 0. + `Std.parseInt` converts a `String` to an `Int`. + + @see https://haxe.org/manual/types-basic-types.html + @see https://haxe.org/manual/std-math-integer-math.html + @see https://haxe.org/manual/types-nullability.html]]> + + + + + + + + + + + ` is a wrapper that can be used to make the basic types `Int`, + `Float` and `Bool` nullable on static targets. + + If null safety is enabled, only types wrapped in `Null` are nullable. + + Otherwise, it has no effect on non-basic-types, but it can be useful as a way to document + that `null` is an acceptable value for a method argument, return value or variable. + + @see https://haxe.org/manual/types-nullability.html]]> + + + + + + + + ` can be used instead. + + @see https://haxe.org/manual/types-bool.html + @see https://haxe.org/manual/types-nullability.html]]> + + + + + + + + + `Dynamic` is a special type which is compatible with all other types. + + Use of `Dynamic` should be minimized as it prevents several compiler + checks and optimizations. See `Any` type for a safer alternative for + representing values of any type. + + @see https://haxe.org/manual/types-dynamic.html + + + + + + + + + + Returns the current item of the `Iterator` and advances to the next one. + + This method is not required to check `hasNext()` first. A call to this + method while `hasNext()` is `false` yields unspecified behavior. + + On the other hand, iterators should not require a call to `hasNext()` + before the first call to `next()` if an element is available. + + + + Returns `false` if the iteration is complete, `true` otherwise. + + Usually iteration is considered to be complete if all elements of the + underlying data structure were handled through calls to `next()`. However, + in custom iterators any logic may be used to determine the completion + state. + + + An `Iterator` is a structure that permits iteration over elements of type `T`. + + Any class with matching `hasNext()` and `next()` fields is considered an `Iterator` + and can then be used e.g. in `for`-loops. This makes it easy to implement + custom iterators. + + @see https://haxe.org/manual/lf-iterators.html + + + + An `Iterable` is a data structure which has an `iterator()` method. + See `Lambda` for generic functions on iterable structures. + + @see https://haxe.org/manual/lf-iterators.html + + + + + + + A `KeyValueIterator` is an `Iterator` that has a key and a value. + + + + + + + A `KeyValueIterable` is a data structure which has a `keyValueIterator()` + method to iterate over key-value-pairs. + + `ArrayAccess` is used to indicate a class that can be accessed using brackets. + The type parameter represents the type of the elements stored. + + This interface should be used for externs only. Haxe does not support custom + array access on classes. However, array access can be implemented for + abstract types. + + @see https://haxe.org/manual/types-abstract-array-access.html + + + + + + + Returns the String corresponding to the character code `code`. + + If `code` is negative or has another invalid value, the result is + unspecified. + + + + The number of characters in `this` String. + + + + Returns a String where all characters of `this` String are upper case. + + + + Returns a String where all characters of `this` String are lower case. + + + + + + + Returns the character at position `index` of `this` String. + + If `index` is negative or exceeds `this.length`, the empty String `""` + is returned. + + + + + + + Returns the character code at position `index` of `this` String. + + If `index` is negative or exceeds `this.length`, `null` is returned. + + To obtain the character code of a single character, `"x".code` can be + used instead to inline the character code at compile time. Note that + this only works on String literals of length 1. + + + + + + + + Returns the position of the leftmost occurrence of `str` within `this` + String. + + If `startIndex` is given, the search is performed within the substring + of `this` String starting from `startIndex` (if `startIndex` is posivite + or 0) or `max(this.length + startIndex, 0)` (if `startIndex` is negative). + + If `startIndex` exceeds `this.length`, -1 is returned. + + Otherwise the search is performed within `this` String. In either case, + the returned position is relative to the beginning of `this` String. + + If `str` cannot be found, -1 is returned. + + + + + + + + Returns the position of the rightmost occurrence of `str` within `this` + String. + + If `startIndex` is given, the search is performed within the substring + of `this` String from 0 to `startIndex + str.length`. Otherwise the search + is performed within `this` String. In either case, the returned position + is relative to the beginning of `this` String. + + If `str` cannot be found, -1 is returned. + + + + + + + Splits `this` String at each occurrence of `delimiter`. + + If `this` String is the empty String `""`, the result is not consistent + across targets and may either be `[]` (on Js, Cpp) or `[""]`. + + If `delimiter` is the empty String `""`, `this` String is split into an + Array of `this.length` elements, where the elements correspond to the + characters of `this` String. + + If `delimiter` is not found within `this` String, the result is an Array + with one element, which equals `this` String. + + If `delimiter` is null, the result is unspecified. + + Otherwise, `this` String is split into parts at each occurrence of + `delimiter`. If `this` String starts (or ends) with `delimiter`, the + result `Array` contains a leading (or trailing) empty String `""` element. + Two subsequent delimiters also result in an empty String `""` element. + + + + + + + + Returns `len` characters of `this` String, starting at position `pos`. + + If `len` is omitted, all characters from position `pos` to the end of + `this` String are included. + + If `pos` is negative, its value is calculated from the end of `this` + String by `this.length + pos`. If this yields a negative value, 0 is + used instead. + + If the calculated position + `len` exceeds `this.length`, the characters + from that position to the end of `this` String are returned. + + If `len` is negative, the result is unspecified. + + + + + + + + Returns the part of `this` String from `startIndex` to but not including `endIndex`. + + If `startIndex` or `endIndex` are negative, 0 is used instead. + + If `startIndex` exceeds `endIndex`, they are swapped. + + If the (possibly swapped) `endIndex` is omitted or exceeds + `this.length`, `this.length` is used instead. + + If the (possibly swapped) `startIndex` exceeds `this.length`, the empty + String `""` is returned. + + + + Returns the String itself. + + + + + + + Creates a copy from a given String. + + The basic String class. + + A Haxe String is immutable, it is not possible to modify individual + characters. No method of this class changes the state of `this` String. + + Strings can be constructed using the String literal syntax `"string value"`. + + String can be concatenated by using the `+` operator. If an operand is not a + String, it is passed through `Std.string()` first. + + @see https://haxe.org/manual/std-String.html + + + + + The length of `this` StringBuf in characters. + + + + + + + + Appends the representation of `x` to `this` StringBuf. + + The exact representation of `x` may vary per platform. To get more + consistent behavior, this function should be called with + Std.string(x). + + If `x` is null, the String "null" is appended. + + + + + + + Appends the character identified by `c` to `this` StringBuf. + + If `c` is negative or has another invalid value, the result is + unspecified. + + + + + + + + + Appends a substring of `s` to `this` StringBuf. + + This function expects `pos` and `len` to describe a valid substring of + `s`, or else the result is unspecified. To get more robust behavior, + `this.add(s.substr(pos,len))` can be used instead. + + If `s` or `pos` are null, the result is unspecified. + + If `len` is omitted or null, the substring ranges from `pos` to the end + of `s`. + + + + Returns the content of `this` StringBuf as String. + + The buffer is not emptied by this operation. + + + + Creates a new StringBuf instance. + + This may involve initialization of the internal buffer. + + A String buffer is an efficient way to build a big string by appending small + elements together. + + Its cross-platform implementation uses String concatenation internally, but + StringBuf may be optimized for different targets. + + Unlike String, an instance of StringBuf is not immutable in the sense that + it can be passed as argument to functions which modify it by appending more + values. However, the internal buffer cannot be modified. + + + + This class provides access to various base functions of system platforms. + Look in the `sys` package for more system APIs. + + + + sys + + + + + + + + + + Returns the class of `o`, if `o` is a class instance. + + If `o` is null or of a different type, null is returned. + + In general, type parameter information cannot be obtained at runtime. + + + + + + + `. + + If `o` is null, null is returned. + + In general, type parameter information cannot be obtained at runtime.]]> + + + + + + + Returns the super-class of class `c`. + + If `c` has no super class, null is returned. + + If `c` is null, the result is unspecified. + + In general, type parameter information cannot be obtained at runtime. + + + + + + + Returns the name of class `c`, including its path. + + If `c` is inside a package, the package structure is returned dot- + separated, with another dot separating the class name: + `pack1.pack2.(...).packN.ClassName` + If `c` is a sub-type of a Haxe module, that module is not part of the + package structure. + + If `c` has no package, the class name is returned. + + If `c` is null, the result is unspecified. + + The class name does not include any type parameters. + + + + + + + Returns the name of enum `e`, including its path. + + If `e` is inside a package, the package structure is returned dot- + separated, with another dot separating the enum name: + `pack1.pack2.(...).packN.EnumName` + If `e` is a sub-type of a Haxe module, that module is not part of the + package structure. + + If `e` has no package, the enum name is returned. + + If `e` is null, the result is unspecified. + + The enum name does not include any type parameters. + + + + + + + Resolves a class by name. + + If `name` is the path of an existing class, that class is returned. + + Otherwise null is returned. + + If `name` is null or the path to a different type, the result is + unspecified. + + The class name must not include any type parameters. + + + + + + + Resolves an enum by name. + + If `name` is the path of an existing enum, that enum is returned. + + Otherwise null is returned. + + If `name` is null the result is unspecified. + + If `name` is the path to a different type, null is returned. + + The enum name must not include any type parameters. + + + + + + + + Creates an instance of class `cl`, using `args` as arguments to the + class constructor. + + This function guarantees that the class constructor is called. + + Default values of constructors arguments are not guaranteed to be + taken into account. + + If `cl` or `args` are null, or if the number of elements in `args` does + not match the expected number of constructor arguments, or if any + argument has an invalid type, or if `cl` has no own constructor, the + result is unspecified. + + In particular, default values of constructor arguments are not + guaranteed to be taken into account. + + + + + + + Creates an instance of class `cl`. + + This function guarantees that the class constructor is not called. + + If `cl` is null, the result is unspecified. + + + + + + + + + Creates an instance of enum `e` by calling its constructor `constr` with + arguments `params`. + + If `e` or `constr` is null, or if enum `e` has no constructor named + `constr`, or if the number of elements in `params` does not match the + expected number of constructor arguments, or if any argument has an + invalid type, the result is unspecified. + + + + + + + + + Creates an instance of enum `e` by calling its constructor number + `index` with arguments `params`. + + The constructor indices are preserved from Haxe syntax, so the first + declared is index 0, the next index 1 etc. + + If `e` or `constr` is null, or if enum `e` has no constructor named + `constr`, or if the number of elements in `params` does not match the + expected number of constructor arguments, or if any argument has an + invalid type, the result is unspecified. + + + + + + + Returns a list of the instance fields of class `c`, including + inherited fields. + + This only includes fields which are known at compile-time. In + particular, using `getInstanceFields(getClass(obj))` will not include + any fields which were added to `obj` at runtime. + + The order of the fields in the returned Array is unspecified. + + If `c` is null, the result is unspecified. + + (As3) This method only returns instance fields that are public. + + + + + + + Returns a list of static fields of class `c`. + + This does not include static fields of parent classes. + + The order of the fields in the returned Array is unspecified. + + If `c` is null, the result is unspecified. + + (As3) This method only returns class fields that are public. + + + + + + + Returns a list of the names of all constructors of enum `e`. + + The order of the constructor names in the returned Array is preserved + from the original syntax. + + If `e` is null, the result is unspecified. + + + + + + + Returns the runtime type of value `v`. + + The result corresponds to the type `v` has at runtime, which may vary + per platform. Assumptions regarding this should be minimized to avoid + surprises. + + + + + + + + Recursively compares two enum instances `a` and `b` by value. + + Unlike `a == b`, this function performs a deep equality check on the + arguments of the constructors, if exists. + + If `a` or `b` are null, the result is unspecified. + + + + + + + Returns the constructor name of enum instance `e`. + + The result String does not contain any constructor arguments. + + If `e` is null, the result is unspecified. + + + + + + + Returns a list of the constructor arguments of enum instance `e`. + + If `e` has no arguments, the result is []. + + Otherwise the result are the values that were used as arguments to `e`, + in the order of their declaration. + + If `e` is null, the result is unspecified. + + + + + + + Returns the index of enum instance `e`. + + This corresponds to the original syntactic position of `e`. The index of + the first declared constructor is 0, the next one is 1 etc. + + If `e` is null, the result is unspecified. + + + + + + + Returns a list of all constructors of enum `e` that require no + arguments. + + This may return the empty Array `[]` if all constructors of `e` require + arguments. + + Otherwise an instance of `e` constructed through each of its non- + argument constructors is returned, in the order of the constructor + declaration. + + If `e` is null, the result is unspecified. + + The Haxe Reflection API allows retrieval of type information at runtime. + + This class complements the more lightweight Reflect class, with a focus on + class and enum instances. + + @see https://haxe.org/manual/types.html + @see https://haxe.org/manual/std-reflection.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + match v1,v2 with + | VInt32 i1,VInt32 i2 -> vint32 (Int32.add i1 i2) + | _ -> exc_string "Expected int + int" + ) + ;; + EvalStdLib.StdContext.register ["add_int",add_int] + ``` + + Usage from Haxe: + + ```haxe + var module:TestPlugin = eval.vm.Context.loadPlugin("testPlugin.cmo"); + trace(module.add_int(4, 3)); + ``` + + Plugins have to be compiled with the same OCaml version as the Haxe compiler + and using the same Haxe version. If a plugin cannot be loaded, an exception + of type `String` is thrown.]]> + + + + + + + + + Suspends the execution of the calling thread for `f` seconds. The other program + threads continue to run during this time. + + + + Terminate prematurely the currently executing thread. + + + + + + + Suspends the execution of the calling thread until the thread `thread` has + terminated. + + + + Return the thread currently executing. + + + + Re-schedule the calling thread without suspending it. This function can be used + to give scheduling hints, telling the scheduler that now is a good time to switch + to other threads. + + + + + + + + Return the identifier of the given thread. A thread identifier is an integer + that identifies uniquely the thread. It can be used to build data structures + indexed by threads. + + + + Terminate prematurely the thread whose handle is given. This functionality is + available only with bytecode-level threads. + + + + + + + + + + + Creates a new thread that executes function `f`. + + Exceptions caused while executing `f` are printed to stderr and are not + propagated to the parent thread. + + + +
+ + +
+ * this class just imports all the classes in the library +
+ + + This type unifies with any function type. + + It is intended to be used as a type parameter constraint. If used as a real + type, the underlying type will be `Dynamic`. + + + + + + This type unifies with an enum instance if all constructors of the enum + require no arguments. + + It is intended to be used as a type parameter constraint. If used as a real + type, the underlying type will be `Dynamic`. + + + + + `, A must be explicitly constrained to + `Constructible` as well. + + It is intended to be used as a type parameter constraint. If used as a real + type, the underlying type will be `Dynamic`.]]> + + + + + + The current thread acquire the mutex or wait if not available. + The same thread can acquire several times the same mutex but + must release it as many times it has been acquired. + + + + Try to acquire the mutex, returns true if acquire or false + if it's already locked by another thread. + + + + Release a mutex that has been acquired by the current thread. + The behavior is undefined if the current thread does not own + the mutex. + + + + Creates a mutex. + + Creates a mutex, which can be used to acquire a temporary lock + to access some ressource. The main difference with a lock is + that a mutex must always be released by the owner thread. + + + + + + + + + Waits for the lock to be released, or `timeout` (in seconds) + to expire. Returns `true` if the lock is released and `false` + if a time-out occurs. + + + + Releases the lock once. + + The thread does not need to own the lock in order to release + it. Each call to `release` allows exactly one call to `wait` + to execute. + + + + Creates a new Lock which is initially locked. + + A Lock allows blocking execution until it has been unlocked. It keeps track + of how often `release` has been called, and blocks exactly as many `wait` + calls. + + The order of the `release` and `wait` calls is irrelevant. That is, a Lock + can be released before anyone waits for it. In that case, the `wait` call + will execute immediately. + + Usage example: + + ``` + var lock = new Lock(); + var elements = [1, 2, 3]; + for (element in elements) { + // Create one thread per element + new Thread(function() { + trace(element); + Sys.sleep(1); + // Release once per thread = 3 times + lock.release(); + }); + } + for (_ in elements) { + // Wait 3 times + lock.wait(); + } + trace("All threads finished"); + ``` + + + + + + new Lock() + + + + new Mutex() + + + + ()]]> + + + + 0 + + + + + + Start the main loop. Depending on the platform, this can return immediately or will only return when the application exits. + + If `haxe.MainLoop` is kept from DCE, then we will insert an `haxe.EntryPoint.run()` call just at then end of `main()`. + This class can be redefined by custom frameworks so they can handle their own main loop logic. + + + + + + + + + Returns the name of enum `e`, including its path. + + If `e` is inside a package, the package structure is returned dot- + separated, with another dot separating the enum name: + + pack1.pack2.(...).packN.EnumName + + If `e` is a sub-type of a Haxe module, that module is not part of the + package structure. + + If `e` has no package, the enum name is returned. + + If `e` is `null`, the result is unspecified. + + The enum name does not include any type parameters. + + + + + + + + + Creates an instance of enum `e` by calling its constructor `constr` with + arguments `params`. + + If `e` or `constr` is `null`, or if enum `e` has no constructor named + `constr`, or if the number of elements in `params` does not match the + expected number of constructor arguments, or if any argument has an + invalid type, the result is unspecified. + + + + + + + + + Creates an instance of enum `e` by calling its constructor number + `index` with arguments `params`. + + The constructor indices are preserved from Haxe syntax, so the first + declared is index 0, the next index 1 etc. + + If `e` or `index` is `null`, or if enum `e` has no constructor + corresponding to index `index`, or if the number of elements in `params` + does not match the expected number of constructor arguments, or if any + argument has an invalid type, the result is unspecified. + + + + + + + Returns a list of all constructors of enum `e` that require no + arguments. + + This may return the empty Array `[]` if all constructors of `e` require + arguments. + + Otherwise an instance of `e` constructed through each of its non- + argument constructors is returned, in the order of the constructor + declaration. + + If `e` is `null`, the result is unspecified. + + + + + + + Returns a list of the names of all constructors of enum `e`. + + The order of the constructor names in the returned Array is preserved + from the original syntax. + + If `c` is `null`, the result is unspecified. + + This class provides advanced methods on enums. It is ideally used with + `using EnumTools` and then acts as an + [extension](https://haxe.org/manual/lf-static-extension.html) to the + `enum` types. + + If the first argument to any of the methods is `null`, the result is + unspecified. + + + + + + + + + Recursively compares two enum instances `a` and `b` by value. + + Unlike `a == b`, this function performs a deep equality check on the + arguments of the constructors (if there are any). + + If `a` or `b` are `null`, the result is unspecified. + + + + + + + Returns the constructor name of enum instance `e`. + + The result String does not contain any constructor arguments. + + If `e` is `null`, the result is unspecified. + + + + + + + Returns a list of the constructor arguments of enum instance `e`. + + If `e` has no arguments, the result is `[]`. + + Otherwise the result are the values that were used as arguments to `e`, + in the order of their declaration. + + If `e` is `null`, the result is unspecified. + + + + + + + Returns the index of enum instance `e`. + + This corresponds to the original syntactic position of `e`. The index of + the first declared constructor is 0, the next one is 1 etc. + + If `e` is `null`, the result is unspecified. + + This class provides advanced methods on enum values. It is ideally used with + `using EnumValueTools` and then acts as an + [extension](https://haxe.org/manual/lf-static-extension.html) to the + `EnumValue` types. + + If the first argument to any of the methods is `null`, the result is + unspecified. + + + + + + + + + Int32 provides a 32-bit integer with consistent overflow behavior across + all platforms. + + + + + + + + + + A cross-platform signed 64-bit integer. + Int64 instances can be created from two 32-bit words using `Int64.make()`. + + + + + + + + + + + + + + + This typedef will fool `@:coreApi` into thinking that we are using + the same underlying type, even though it might be different on + specific platforms. + + + + + + + + + Format the output of `trace` before printing it. + + + + + + + + Outputs `v` in a platform-dependent way. + + The second parameter `infos` is injected by the compiler and contains + information about the position where the `trace()` call was made. + + This method can be rebound to a custom function: + + var oldTrace = haxe.Log.trace; // store old function + haxe.Log.trace = function(v, ?infos) { + // handle trace + } + ... + haxe.Log.trace = oldTrace; + + If it is bound to null, subsequent calls to `trace()` will cause an + exception. + + Log primarily provides the `trace()` method, which is invoked upon a call to + `trace()` in Haxe code. + + + + + + + + + + + + true + Tells if the event can lock the process from exiting (default:true) + + + + + + + + + + + + + + + + + + Run the pending events. Return the time for next event. + + + + + haxe.MainEvent + + + + + + + + + + + + + + `PosInfos` is a magic type which can be used to generate position information + into the output for debugging use. + + If a function has a final optional argument of this type, i.e. + `(..., ?pos:haxe.PosInfos)`, each call to that function which does not assign + a value to that argument has its position added as call argument. + + This can be used to track positions of calls in e.g. a unit testing + framework. + + + + + + + HashMap allows mapping of hashable objects to arbitrary values. + + See `Map` for documentation details. + + @see https://haxe.org/manual/std-Map.html + + + + + + + + + + + + + + See `Map.set` + + + + + + + See `Map.get` + + + + + + + See `Map.exists` + + + + + + + See `Map.remove` + + + + See `Map.keys` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + See `Map.iterator` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + + + + + See `Map.keyValueIterator` + + + + See `Map.copy` + + + + See `Map.toString` + + + + See `Map.clear` + + + + Creates a new IntMap. + + IntMap allows mapping of Int keys to arbitrary values. + + See `Map` for documentation details. + + @see https://haxe.org/manual/std-Map.html + + + + + + + + + + + + + + + + + + + + + + + + + + + value1, key2 => value2]` syntax. + + Map is an abstract type, it is not available at runtime. + + @see https://haxe.org/manual/std-Map.html]]> + @:followWithAbstracts K + + + + + + + + + + + + + + See `Map.set` + + + + + + + See `Map.get` + + + + + + + See `Map.exists` + + + + + + + See `Map.remove` + + + + See `Map.keys` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + See `Map.iterator` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + + + + + See `Map.keyValueIterator` + + + + + + + See `Map.copy` + + + + See `Map.toString` + + + + See `Map.clear` + + + + Creates a new ObjectMap. + + ObjectMap allows mapping of object keys to arbitrary values. + + On static targets, the keys are considered to be strong references. Refer + to `haxe.ds.WeakMap` for a weak reference version. + + See `Map` for documentation details. + + @see https://haxe.org/manual/std-Map.html + + + + + `ReadOnlyArray` is an abstract over an ordinary `Array` which only exposes + APIs that don't modify the instance, hence "read-only". + + Note that this doesn't necessarily mean that the instance is *immutable*. + Other code holding a reference to the underlying `Array` can still modify it, + and the reference can be obtained with a `cast`. + + concat + copy + filter + indexOf + iterator + join + lastIndexOf + map + slice + toString + + + + + + The length of `this` Array. + + + + + + + + + + + + + + + + See `Map.set` + + + + + + + See `Map.get` + + + + + + + See `Map.exists` + + + + + + + See `Map.remove` + + + + See `Map.keys` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + See `Map.iterator` + + (cs, java) Implementation detail: Do not `set()` any new value while + iterating, as it may cause a resize, which will break iteration. + + + + + + + + See `Map.keyValueIterator` + + + + See `Map.copy` + + + + See `Map.toString` + + + + See `Map.clear` + + + + Creates a new StringMap. + + StringMap allows mapping of String keys to arbitrary values. + + See `Map` for documentation details. + + @see https://haxe.org/manual/std-Map.html + + + + + A Vector is a storage of fixed size. It can be faster than Array on some + targets, and is never slower. + + @see https://haxe.org/manual/std-vector.html + + + + + Returns the length of `this` Vector. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The length of the buffer in bytes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Returns either a copy or a reference of the current bytes. + Once called, the buffer should no longer be used. + + + + + + + + + + + + + + An Input is an abstract reader. See other classes in the `haxe.io` package + for several possible implementations. + + All functions which read data throw `Eof` when the end of the stream + is reached. + + + + An Output is an abstract write. A specific output implementation will only + have to override the `writeByte` and maybe the `write`, `flush` and `close` + methods. See `File.write` and `String.write` for two ways of creating an + Output. + + + + + + + Position of the first character. + + + + Position of the last character. + + + + Reference to the filename. + + + Represents a position in a file. + + + + + + The position of the expression. + + + + The expression kind. + + + Represents a node in the AST. + @see https://haxe.org/manual/macro-reification-expression.html + + + + Represents a AST node identical to `Expr`, but it allows constraining the + type of accepted expressions. + @see https://haxe.org/manual/macro-ExprOf.html + + + + + + The value expressions of the case. + + + + + The optional guard expressions of the case, if available. + + + + The expression of the case, if available. + + + Represents a switch case. + @see https://haxe.org/manual/expression-switch.html + + + + + + The type-hint of the variable, if available. + + + + The name of the variable. + + + + + Whether or not the variable can be assigned to. + + + + The expression of the variable, if available. + + + Represents a variable in the AST. + @see https://haxe.org/manual/expression-var.html + + + + + + The type of the catch. + + + + The name of the catch variable. + + + + The expression of the catch. + + + Represents a catch in the AST. + @https://haxe.org/manual/expression-try-catch.html + + + + + + + How the field name is quoted. + + + + The name of the field. + + + + The field expression. + + + Represents the field of an object declaration. + + + + + + + Sub is set on module sub-type access: + `pack.Module.Type` has name = Module, sub = Type, if available. + + + + + Optional parameters of the type path. + + + + Represents the package of the type path. + + + + The name of the type path. + + + Represents a type path in the AST. + + + + + + + The optional parameters of the type parameter. + + + + The name of the type parameter. + + + + + The metadata of the type parameter. + + + + + The optional constraints of the type parameter. + + + Represents a type parameter declaration in the AST. + + + + + + The return type-hint of the function, if available. + + + + + An optional list of function parameter type declarations. + + + + The expression of the function body, if available. + + + + A list of function arguments. + + + Represents a function in the AST. + + + + + + + The optional value of the function argument, if available. + + + + The type-hint of the function argument, if available. + + + + + Whether or not the function argument is optional. + + + + The name of the function argument. + + + + + The metadata of the function argument. + + + Represents a function argument in the AST. + + + + + + The position of the metadata entry. + + + + + The optional parameters of the metadata entry. + + + + The name of the metadata entry. + + + Represents a metadata entry in the AST. + + + + Represents metadata in the AST. + + + + + + The position of the field. + + + + The name of the field. + + + + + The optional metadata of the field. + + + + The kind of the field. + + + + + The documentation of the field, if available. If the field has no + documentation, the value is `null`. + + + + + The access modifiers of the field. By default fields have private access. + @see https://haxe.org/manual/class-field-access-modifier.html + + + Represents a field in the AST. + + + + + + The position to the type definition. + + + + + The parameter type declarations of the type definition. + + + + The package of the type definition. + + + + The name of the type definition. + + + + + The optional metadata of the type definition. + + + + The kind of the type definition. + + + + + Whether or not the type is extern. + + + + The fields of the type definition. + + + + + The documentation of the type, if available. If the type has no + documentation, the value is `null`. + + + Represents a type definition. + + + + + + + + + The path to the import expression. + + + + The mode of the import expression. + + + Represents the import expression. + + + + + + + Represents a reference to internal compiler structure. It exists to avoid + expensive encoding if it is not required and to ensure that physical + equality remains intact. + + A structure is only encoded when user requests it through `ref.get()`. + + + + + + The status/kind of the structure. + + + + The class fields of the structure. + + + Represents information for anonymous structure types. + + + + + + The type of the type parameter. It is guaranteed to be a `TInst` with a + `KTypeParameter` kind. + + + + The name of the type parameter. + + + Represents the declaration of type parameters. + + + + + + The type of the class field. + + + + The position of the class field. + + + + The type parameters of the class field. + + + + The overload fields of the class field. + + + + The name of the class field. + + + + The metadata of the class field. + + + + The class field kind. + + + + Whether or not the class field is public. + + + + Whether or not the class field is final. + + + + Whether or not the class field is extern. + + + + Returns the typed expression of the class field. + + + + The associated documentation of the class field. + + + Represents a class field. + + + + + + The type of the enum constructor. + + + + The position of the enum constructor. + + + + The type parameters of the enum constructor. + + + + The name of the enum constructor. + + + + The metadata of the enum constructor. + + + + The index of the enum constructor, i.e. in which position it appears + in the syntax. + + + + The associated documentation of the enum constructor. + + + Represents an enum constructor. + + + + + + The position of the type. + + + + The type parameters of the type. + + + + The package of the type. + + + + The name of the type. + + + + The module name of the type, which might be different. + + + + The metadata of the type. + + + + Whether or not the type is private. + + + + Whether or not the type is extern. + + + + Allows excluding the type from compilation. + + + + The associated documentation of the class field. + + + The information that all types (`ClassType`, `EnumType`, `DefType`, + `AbstractType`) have in common. + + + + + + + + + The parent class and its type parameters, if available. + + + + The static fields of the class. + + + + The position of the type. + + + + The type parameters of the type. + + + + The package of the type. + + + + The list of fields that have override status. + + + + The name of the type. + + + + The module name of the type, which might be different. + + + + The metadata of the type. + + + + The kind of the class. + + + + Whether or not the type is private. + + + + If true the type is an interface, otherwise it is a class. + + + + If true the class is final and cannot be extended. + + + + Whether or not the type is extern. + + + + + + + The implemented interfaces and their type parameters. + + + + The `__init__` expression of the class, if available. + + + + The member fields of the class. + + + + Allows excluding the type from compilation. + + + + The associated documentation of the class field. + + + + The constructor of the class, if available. + + + Represents a class type. + + + + + + The position of the type. + + + + The type parameters of the type. + + + + The package of the type. + + + + An ordered list of enum constructor names. + + + + The name of the type. + + + + The module name of the type, which might be different. + + + + The metadata of the type. + + + + Whether or not the type is private. + + + + Whether or not the type is extern. + + + + Allows excluding the type from compilation. + + + + The associated documentation of the class field. + + + + + + + The available enum constructors. + + + Represents an enum type. + + + + + + The target type of the typedef. + + + + The position of the type. + + + + The type parameters of the type. + + + + The package of the type. + + + + The name of the type. + + + + The module name of the type, which might be different. + + + + The metadata of the type. + + + + Whether or not the type is private. + + + + Whether or not the type is extern. + + + + Allows excluding the type from compilation. + + + + The associated documentation of the class field. + + + Represents a typedef. + + + + + + + + + + The defined unary operators of the abstract. + + + + The underlying type of the abstract. + + + + + + + The available implicit to-casts of the abstract. + + @see https://haxe.org/manual/types-abstract-implicit-casts.html + + + + The method used for resolving unknown field access, if available. + + + + The method used for resolving unknown field access, if available. + + + + The position of the type. + + + + The type parameters of the type. + + + + The package of the type. + + + + The name of the type. + + + + The module name of the type, which might be different. + + + + The metadata of the type. + + + + Whether or not the type is private. + + + + Whether or not the type is extern. + + + + The implementation class of the abstract, if available. + + + + + + + The available implicit from-casts of the abstract. + + @see https://haxe.org/manual/types-abstract-implicit-casts.html + + + + Allows excluding the type from compilation. + + + + The associated documentation of the class field. + + + + + + + The defined binary operators of the abstract. + + + + The defined array-access fields of the abstract. + + + Represents an abstract type. + + + + + + + + + Removes all `name` metadata entries from the origin of `this` + MetaAccess. + + This method might clear several metadata entries of the same name. + + If a `Metadata` array is obtained through a call to `get`, a subsequent + call to `remove` has no effect on that array. + + If `name` is null, compilation fails with an error. + + + + + + + Tells if the origin of `this` MetaAccess has a `name` metadata entry. + + If `name` is null, compilation fails with an error. + + + + Return the wrapped `Metadata` array. + + Modifying this array has no effect on the origin of `this` MetaAccess. + The `add` and `remove` methods can be used for that. + + + + + + + Extract metadata entries by given `name`. + + If there's no metadata with such name, empty array `[]` is returned. + + If `name` is null, compilation fails with an error. + + + + + + + + + Adds the metadata specified by `name`, `params` and `pos` to the origin + of `this` MetaAccess. + + Metadata names are not unique during compilation, so this method never + overwrites a previous metadata. + + If a `Metadata` array is obtained through a call to `get`, a subsequent + call to `add` has no effect on that array. + + If any argument is null, compilation fails with an error. + + + MetaAccess is a wrapper for the `Metadata` array. It can be used to add + metadata to and remove metadata from its origin. + + + + + + The type of the variable. + + + + The name of the variable. + + + + The metadata of the variable. + + + + The unique ID of the variable. + + + + + + + Special information which is internally used to keep track of closure. + information + + + + Whether or not the variable has been captured by a closure. + + + Represents a variable in the typed AST. + + + + + + The return type of the function. + + + + The expression of the function body. + + + + + + + A list of function arguments identified by an argument variable `v` and + an optional initialization `value`. + + + Represents a function in the typed AST. + + + + + + The type of the expression. + + + + The position of the expression. + + + + The expression kind. + + + Represents a typed AST node. + + + <_type public="1"> + + hide + + <_numProxies public="1"> + + hide + + <_proxyList public="1"> + + hide + + <_proxyListLast public="1"> + + hide + + <_proxyPairList public="1"> + + hide + + <_incremental public="1"> + + hide + + <_testCount public="1"> + + hide + + <_proxyPairPool> + + hide + + <_idCount> + + hide + + <_convexSweep> + + hide + + <_aabb> + + hide + + + + + + + + + + + * Returns a new proxy connected with the user data `userData` containing the axis-aligned + * bounding box `aabb`, and adds the proxy into the collision space. + + + + + + + * Removes the proxy `proxy` from the collision space. + + + + + + + + + * Moves the proxy `proxy` to the axis-aligned bounding box `aabb`. `displacement` is the + * difference between current and previous center of the AABB. This is used for predicting + * movement of the proxy. + + + + + + + + * Returns whether the pair of `proxy1` and `proxy2` is overlapping. As proxies can be larger + * than the containing AABBs, two proxies may overlap even though their inner AABBs are separate. + + + + * Collects overlapping pairs of the proxies and put them into a linked list. The linked list + * can be get through `BroadPhase.getProxyPairList` method. + * + * Note that in order to collect pairs, the broad-phase algorithm requires to be informed of + * movements of proxies through `BroadPhase.moveProxy` method. + + + + * Returns the linked list of collected pairs of proxies. + + + + * Returns whether to collect only pairs created in the last step. If this returns + * true, the pairs that are not collected might still be overlapping. Otherwise, such + * pairs are guaranteed to be separated. + + + + * Returns the number of broad-phase AABB tests. + + + + + + + + + * Performs a ray casting. `callback.process` is called for all proxies the line segment + * from `begin` to `end` intersects. + + + + + + + + + + * Performs a convex casting. `callback.process` is called for all shapes the convex geometry + * `convex` hits. The convex geometry translates by `translation` starting from the beginning + * transform `begin`. + + + + + + + + * Performs an AABB query. `callback.process` is called for all proxies that their AABB + * and `aabb` intersect. + + + + + + + hide + + * The abstract class of a broad-phase collision detection algorithm. + oimo.m.B.bu() + + + <_type public="1"> + + hide + + <_volume public="1"> + + hide + + <_inertiaCoeff00 public="1"> + + hide + + <_inertiaCoeff01 public="1"> + + hide + + <_inertiaCoeff02 public="1"> + + hide + + <_inertiaCoeff10 public="1"> + + hide + + <_inertiaCoeff11 public="1"> + + hide + + <_inertiaCoeff12 public="1"> + + hide + + <_inertiaCoeff20 public="1"> + + hide + + <_inertiaCoeff21 public="1"> + + hide + + <_inertiaCoeff22 public="1"> + + hide + + <_updateMass public="1" set="method" line="26"> + + hide + + <_computeAabb public="1" set="method" line="29"> + + + + + + hide + + <_rayCastLocal public="1" set="method" line="32"> + + + + + + + + + + + hide + + + + * Returns the type of the collision geometry. + * + * See `GeometryType` for details. + + + + * Returns the volume of the collision geometry. + + + + + + + + + + * Performs ray casting. Returns `true` and sets the result information to `hit` if + * the line segment from `begin` to `end` and the geometry transformed by `transform` + * intersect. Returns `false` if the line segment and the geometry do not intersect. + + + + + + + hide + + * Abstract collision geometry. + oimo.m.B.bu() + + + + <_gjkMargin public="1"> + + hide + + <_useGjkRayCast public="1"> + + hide + + + + * Returns the GJK mergin around the "core" of the convex geometry. + + + + + + + * Sets the GJK mergin around the "core" to `gjkMergin`. + + + + + + + + * Computes supporting vertex of the "core" of the geometry in local coordinates. + * Note that the direction vector `dir` might not be normalized. `out` is set to + * the computed supporting vertex. + + + + + + + + + + + + + + hide + + * Abstract class of the convex collision geometries supported by GJK/EPA collision detection. + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + * This is called every time a broad phase algorithm reports a proxy `proxy`. + + + + * Default constructor. + + * A callback class for queries in a broad phase. + + + <_BRUTE_FORCE public="1" get="inline" set="null" expr="1" line="8" static="1"> + + + 1 + hide + + + <_BVH public="1" get="inline" set="null" expr="2" line="9" static="1"> + + + 2 + hide + + + + + _BRUTE_FORCE + * The brute force algorithm searches all the possible pairs of the proxies every time. + * This is **very slow** and so users should not choose this algorithm without exceptional reasons. + + + + _BVH + * The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently. + + * Types of broad-phase algorithms. + oimo.m.B.bu() + + + <_prev public="1"> + + hide + + <_next public="1"> + + hide + + <_aabbMinX public="1"> + + hide + + <_aabbMinY public="1"> + + hide + + <_aabbMinZ public="1"> + + hide + + <_aabbMaxX public="1"> + + hide + + <_aabbMaxY public="1"> + + hide + + <_aabbMaxZ public="1"> + + hide + + <_id public="1"> + + hide + + + + * Extra field that users can use for their own purposes. **Do not modify this property if + * you use the physics part of the library**, as the physics part of the library uses this property + * for connecting proxies and shapes of rigid bodies. + + + + * Returns the unique id of the proxy. + + + + * Returns the fat AABB of the proxy. + + + + + + + * Sets `aabb` to the fat AABB of the proxy. + * + * This does not create a new instance of `Aabb`. + + + + + + + + hide + + * A proxy is an object that can be added to a broad-phase collision detection algorithm. + * Users of the collision part of the library can move an axis-aligned bounding box of + * a proxy through `BroadPhase` class. + + + oimo.m.B.bu() + + + + <_next public="1"> + + hide + + <_p1 public="1"> + + hide + + <_p2 public="1"> + + hide + + + + * Returns the first proxy of the pair. + + + + * Returns the second proxy of the pair. + + + + * Returns the next pair. + + + + hide + + * A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies + * as linked list of ProxyPair. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hide + + * Brute force implementation of broad-phase collision detection. Time complexity is O(n^2). + + + oimo.m.B.bu() + + + + + <_tree public="1"> + + hide + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * Returns the balance of the bounding volume tree. + + + + hide + + * The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). + * Average time complexity is O(NlogN) or lower. + + + oimo.m.B.bu() + + + + + + 0 + + + + 1 + + * Internal class. + * + * Strategies of leaf insertion. + hide + + + <_next public="1"> + + hide + + <_prevLeaf public="1"> + + hide + + <_nextLeaf public="1"> + + hide + + <_children public="1"> + + hide + + <_childIndex public="1"> + + hide + + <_parent public="1"> + + hide + + <_height public="1"> + + hide + + <_proxy public="1"> + + hide + + <_aabbMinX public="1"> + + hide + + <_aabbMinY public="1"> + + hide + + <_aabbMinZ public="1"> + + hide + + <_aabbMaxX public="1"> + + hide + + <_aabbMaxY public="1"> + + hide + + <_aabbMaxZ public="1"> + + hide + + <_tmpX public="1"> + + hide + + <_tmpY public="1"> + + hide + + <_tmpZ public="1"> + + hide + + + * Internal class. + * + * BVH Node + + + oimo.m.B.bu() + hide + + + + + <_leaf public="1"> + + hide + + <_moved public="1"> + + hide + + + + + + + * Internal class. + * + * BVH Proxy + + + oimo.m.B.bu() + hide + + + + <_insertionStrategy public="1"> + + hide + + <_balancingEnabled public="1"> + + hide + + <_decideInsertion public="1" set="method" line="30"> + + + + + + hide + * Returns the next step of leaf insertion. + * `0` or `1` to descend to corresponding child of current node. + * `-1` to stop descending and make common parent with current node. + + <_splitLeaves public="1" set="method" line="46"> + + + + + + + hide + * Sorts `leaves` and returns the split index `k` of the half-open interval [`from`, `until`). + * Leaves are separated into [`from`, `k`) and [`k`, `until`). + + + * Internal class. + * + * BVH strategy for BVH tree + + + oimo.m.B.bu() + hide + + + + <_root public="1"> + + hide + + <_numLeaves public="1"> + + hide + + <_strategy public="1"> + + hide + + <_nodePool> + + hide + + + + + <_print public="1" set="method" line="36"> + + + + + + + { indent : "" } + hide + + + <_getBalance public="1" set="method" line="126"> + + hide + + + + + + + + + + + + + + + + + + + + + * Internal class. + * + * BVH Tree + + + oimo.m.B.bu() + hide + + + + <_minX public="1"> + + hide + + <_minY public="1"> + + hide + + <_minZ public="1"> + + hide + + <_maxX public="1"> + + hide + + <_maxY public="1"> + + hide + + <_maxZ public="1"> + + hide + + + + + + + + * Sets the minimum and maximum point and returns `this`. + * + * Equivallent to `setMin(min).setMax(max)`. + + + + * Returns the minimum point of the axis-aligned bounding box. + + + + + + + * Sets the minimum point of the axis-aligned bounding box to `min`. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets the minimum point of the axis-aligned bounding box to `min` and returns `this`. + + + + * Returns the maximum point of the axis-aligned bounding box. + + + + + + + * Sets the maximum point of the axis-aligned bounding box to `max`. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets the maximum point of the axis-aligned bounding box to `max` and returns `this`. + + + + * Returns the center of the AABB. + + + + + + + * Sets `center` to the center of the AABB. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the half extents of the AABB. + + + + + + + * Sets `halfExtents` to the half extents of the AABB. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Combines `other` into this AABB and returns `this`. + + + + + + + * Returns the combined aabb of `this` and `other`. + + + + + + + * Returns whether `this` and `other` intersect. + + + + + + + * Returns the intersection of `this` and `other`. + + + + + + + + * Sets `intersection` to the intersection of `this` and `other`. + * + * This does not create a new instance of `Aabb`. + + + + + + + * Copies AABB from `aabb` to and returns `this`. + + + + * Returns a clone of the AABB. + + + + * Creates an empty AABB. Minimum and maximum points are set to zero. + + * The axis-aligned bounding box. + + + oimo.m.B.bu() + + + + + <_halfExtentsX public="1"> + + hide + + <_halfExtentsY public="1"> + + hide + + <_halfExtentsZ public="1"> + + hide + + <_halfAxisXX public="1"> + + hide + + <_halfAxisXY public="1"> + + hide + + <_halfAxisXZ public="1"> + + hide + + <_halfAxisYX public="1"> + + hide + + <_halfAxisYY public="1"> + + hide + + <_halfAxisYZ public="1"> + + hide + + <_halfAxisZX public="1"> + + hide + + <_halfAxisZY public="1"> + + hide + + <_halfAxisZZ public="1"> + + hide + + + + * Returns the half-extents of the box. + + + + + + + * Sets `halfExtents` to the half-extents of the box. + + <_updateMass public="1" set="method" line="65" override="1"> + + hide + + <_computeAabb public="1" set="method" line="76" override="1"> + + + + + + hide + + + + + + + <_rayCastLocal public="1" set="method" line="105" override="1"> + + + + + + + + + + + hide + + + + + + + * Creates a box collision geometry of half-extents `halfExtents`. + + * A box collision geometry. + oimo.m.B.bu() + + + + <_radius public="1"> + + hide + + <_halfHeight public="1"> + + hide + + + + * Returns the radius of the capsule. + + + + * Returns the half-height of the capsule. + + <_updateMass public="1" set="method" line="42" override="1"> + + hide + + <_computeAabb public="1" set="method" line="65" override="1"> + + + + + + hide + + + + + + + <_rayCastLocal public="1" set="method" line="87" override="1"> + + + + + + + + + + + hide + + + + + + + + * Creates a capsule collision geometry of radius `radius` and half-height `halfHeight`. + + * A capsule collision geometry aligned with the y-axis. + oimo.m.B.bu() + + + + <_radius public="1"> + + hide + + <_halfHeight public="1"> + + hide + + + + + + * Returns the radius of the cone. + + + + * Returns the half-height of the cone. + + <_updateMass public="1" set="method" line="46" override="1"> + + hide + + <_computeAabb public="1" set="method" line="57" override="1"> + + + + + + hide + + + + + + + <_rayCastLocal public="1" set="method" line="115" override="1"> + + + + + + + + + + + hide + + + + + + + + * Creates a cone collision geometry of radius `radius` and half-height `halfHeight`. + + * A cone collision geometry aligned with the y-axis. + oimo.m.B.bu() + + + + <_vertices public="1"> + + hide + + <_tmpVertices public="1"> + + hide + + <_numVertices public="1"> + + hide + + + + * Returns the vertices of the convex hull. + + <_updateMass public="1" set="method" line="41" override="1"> + + hide + + <_computeAabb public="1" set="method" line="87" override="1"> + + + + + + hide + + + + + + + + + + + + * Creates a convex hull collision geometry of the vertices `vertices`. + + * A convex hull collision geometry. A convex hull of the vertices is the smallest convex + * polyhedron which contains all vertices. + oimo.m.B.bu() + + + + <_radius public="1"> + + hide + + <_halfHeight public="1"> + + hide + + + + * Returns the radius of the cylinder. + + + + * Returns the half-height of the cylinder. + + <_updateMass public="1" set="method" line="41" override="1"> + + hide + + <_computeAabb public="1" set="method" line="52" override="1"> + + + + + + hide + + + + + + + <_rayCastLocal public="1" set="method" line="91" override="1"> + + + + + + + + + + + hide + + + + + + + + * Creates a cylinder collision geometry of radius `radius` and half-height `halfHeight`. + + * A cylinder collision geometry aligned with the y-axis. + oimo.m.B.bu() + + + <_SPHERE public="1" get="inline" set="null" expr="0" line="8" static="1"> + + + 0 + hide + + + <_BOX public="1" get="inline" set="null" expr="1" line="9" static="1"> + + + 1 + hide + + + <_CYLINDER public="1" get="inline" set="null" expr="2" line="10" static="1"> + + + 2 + hide + + + <_CONE public="1" get="inline" set="null" expr="3" line="11" static="1"> + + + 3 + hide + + + <_CAPSULE public="1" get="inline" set="null" expr="4" line="12" static="1"> + + + 4 + hide + + + <_CONVEX_HULL public="1" get="inline" set="null" expr="5" line="13" static="1"> + + + 5 + hide + + + <_CONVEX_MIN public="1" get="inline" set="null" expr="0" line="15" static="1"> + + + 0 + hide + + + <_CONVEX_MAX public="1" get="inline" set="null" expr="5" line="16" static="1"> + + + 5 + hide + + + + + _SPHERE + * Represents a sphere collision geometry. + * + * See `SphereGeometry`. + + + + _BOX + * Represents a box collision geometry. + * + * See `BoxGeometry`. + + + + _CYLINDER + * Represents a cylinder collision geometry. + * + * See `CylinderGeometry`. + + + + _CONE + * Represents a cone collision geometry. + * + * See `ConeGeometry`. + + + + _CAPSULE + * Represents a capsule collision geometry. + * + * See `CapsuleGeometry`. + + + + _CONVEX_HULL + * Represents a convex hull collision geometry. + * + * See `ConvexHullGeometry`. + + * The list of collision geometry types. + oimo.m.B.bu() + + + + + * The position the ray hit at. + + + + * The normal vector of the surface the ray hit. + + + + * The ratio of the position the ray hit from the start point to the end point. + + + + * Default constructor. + + * A single ray cast hit data. + + + + + <_radius public="1"> + + hide + + + + * Returns the radius of the sphere. + + <_updateMass public="1" set="method" line="33" override="1"> + + hide + + <_computeAabb public="1" set="method" line="42" override="1"> + + + + + + hide + + + + + + + <_rayCastLocal public="1" set="method" line="53" override="1"> + + + + + + + + + + + hide + + + + + + + * Creates a sphere collision geometry of radius `radius`. + + * A sphere collision geometry. + oimo.m.B.bu() + + + + + + + + + + * Returns an appropriate collision detector of two geometries of types `geomType1` and `geomType2`. + * + * This method is **not symmetric**, so `getDetector(a, b)` may not be equal to `getDetector(b, a)`. + + + + hide + + * CollisionMatrix provides corresponding collision detector for a pair of + * two geometries of given types. + + + + + + * The number of the result points. + + + + * The result points. Note that **only the first `DetectorResult.numPoints` points are + * computed by the collision detector**. + + + + * The normal vector of the contact plane. + + + + * Whether the result points are to be used for incremental menifold update. + + + + * Returns the maximum depth of the result points. Returns `0.0` if no result + * points are available. + + + + * Cleans up the result data. + + + + * Default constructor. + + * The result of narrow-phase collision detection. This is used for generating contact + * points of a contact constraint at once or incrementally. + + + oimo.m.B.bu() + + + + + + * The first collision geometry's closest point. + + + + * The second collision geometry's closest point. + + + + * The amount of the overlap. This becomes negative if two geometries are + * separate. + + + + * The identification of the result point. + + + + hide + + * The result point is a pair of the closest points of collision geometries + * detected by a collision detector. This holds relative closest points for + * each collision geometry and the amount of the overlap. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * Computes the contact manifold of two collision geometries `geom1` and `geom2` with the transforms + * `transform1` and `transform2`, and stores it to `result`. `cachedData` is used to improve performance + * of collision detection in some detectors. + + + + + + + hide + + * Interface of a collision detector for narrow-phase collision detection. + oimo.m.B.bu() + + + + + + 1.0 + + + + + + + + + + + + + + * Default constructor. + + * Box vs Box detector. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + * Clips the incident face by the reference face, generates up to eight vertices. + + + + * Reduces vertices up to four. + + + + + + hide + + + + <_gjkCache public="1"> + + hide + + <_clear public="1" set="method" line="16"> + + hide + + + * This is used for caching narrow-phase data of a pair of collision geometries. + + + oimo.m.B.bu() + hide + + + + + + + + + + + + + + + + * Default constructor. + + * Capsule vs Capsule detector. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + * Default constructor. + + * General convex collision detector using GJK/EPA + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + * If `swapped` is `true`, the collision detector expects `BoxGeometry` and `SphereGeometry` for the + * first and second argument of `SphereBoxDetector.detect`. If `swapped` is `false`, the collision detector expects + * `SphereGeometry` and `BoxGeometry` instead. + + * Sphere vs Box collision detector. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + * If `swapped` is `true`, the collision detector expects `CapsuleGeometry` and `SphereGeometry` for the + * first and second argument of `SphereCapsuleDetector.detect`. If `swapped` is `false`, the collision detector expects + * `SphereGeometry` and `CapsuleGeometry` instead. + + * Sphere vs Capsule detector. + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + * Default constructor. + + * Sphere vs Sphere detector. + + + oimo.m.B.bu() + + + + <_vertices public="1"> + + hide + + <_numVertices public="1"> + + hide + + <_triangleList public="1"> + + hide + + <_triangleListLast public="1"> + + hide + + <_numTriangles public="1"> + + hide + + <_trianglePool public="1"> + + hide + + <_vertexPool public="1"> + + hide + + <_center public="1"> + + hide + + <_status public="1"> + + hide + + + + + + + + + + + + + <_init public="1" set="method" line="171"> + + + + + + + + hide + + <_addVertex public="1" set="method" line="217"> + + + + + + hide + + <_dumpAsObjModel public="1" set="method" line="270"> + + hide + + + * Internal class. + + + oimo.m.B.bu() + hide + + + + + + 0 + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + * Internal class. + hide + + + + + 0 + + <_next public="1"> + + hide + + <_prev public="1"> + + hide + + <_vertices public="1"> + + hide + + <_adjacentTriangles public="1"> + + hide + + <_adjacentPairIndex public="1"> + + hide + + <_normal public="1"> + + hide + + <_distanceSq public="1"> + + hide + + <_nextIndex public="1"> + + hide + + <_tmpDfsId public="1"> + + hide + + <_tmpDfsVisible public="1"> + + hide + + + + + ++count + + + + + + + + + + + { autoCheck : false } + + + + + + + + + + * Internal class. + + + oimo.m.B.bu() + hide + + + + <_next public="1"> + + hide + + + + + <_tmpEdgeLoopNext public="1"> + + hide + + <_tmpEdgeLoopOuterTriangle public="1"> + + hide + + + + Std.int(Math.random() * 100000) + + + + + + + + + + * Internal class. + + + oimo.m.B.bu() + hide + + + + + + + * Internal class. + + + oimo.m.B.bu() + hide + + + + + + 0 + * The number of instance creation. + + + + * The x-value of the vector. + + + + * The y-value of the vector. + + + + * The z-value of the vector. + + + + + + + + + * Sets all values at once and returns `this`. + + + + * Sets this vector to zero vector and returns `this`. + + + + + + + * Returns `this` + `v`. + + + + + + + + + * Returns (`this.x` + `vx`, `this.y` + `vy`, `this.z` + `vz`). + + + + + + + + * Returns `this` + `v` * `s`. + + + + + + + * Returns `this` - `v`. + + + + + + + + + * Returns (`this.x` - `vx`, `this.y` - `vy`, `this.z` - `vz`). + + + + + + + * Returns `this` * `s`. + + + + + + + + + * Returns (`this.x` * `sx`, `this.y` * `sy`, `this.z` * `sz`). + + + + + + + * Returns the dot product of `this` and `v`. + + + + + + + * Returns the cross product of `this` and `v`. + + + + + + + * Sets this vector to `this` + `v` and returns `this`. + + + + + + + + + * Sets this vector to (`this.x` + `vx`, `this.y` + `vy`, `this.z` + `vz`) and returns `this`. + + + + + + + + * Sets this vector to `this` + `v` * `s` and returns `this`. + + + + + + + * Sets this vector to `this` - `v` and returns `this`. + + + + + + + + + * Sets this vector to (`this.x` - `vx`, `this.y` - `vy`, `this.z` - `vz`) and returns `this`. + + + + + + + * Sets this vector to `this` * `s` and returns `this`. + + + + + + + + + * Sets this vector to (`this.x` * `sx`, `this.y` * `sy`, `this.z` * `sz`) and returns `this`. + + + + + + + * Sets this vector to the cross product of `this` and `s`, and returns `this`. + + + + + + + * Returns the transformed vector by `m`. + + + + + + + * Returns the transformed vector by `m`. + + + + + + + * Returns the transformed vector by `tf`. + + + + + + + * Sets this vector to the transformed vector by `m` and returns `this`. + + + + + + + * Sets this vector to the transformed vector by `m` and returns `this`. + + + + + + + * Sets this vector to the transformed vector by `tf` and returns `this`. + + + + * Returns the length of the vector. + + + + * Returns the squared length of the vector. + + + + * Returns the normalized vector. + * + * If the length is zero, zero vector is returned. + + + + * Normalize this vector and returns `this`. + * + * If the length is zero, this vector is set to zero vector. + + + + * Returns the nagated vector. + + + + * Negate the vector and returns `this`. + + + + + + + * Copies values from `v` and returns `this`. + + + + * Returns a clone of the vector. + + + + * Returns the string representation of the vector. + + + + + + + + + { z : 0, y : 0, x : 0 } + * Creates a new vector. The vector is zero vector by default. + + * 3D vector class. + + + oimo.m.B.bu() + + + + <_positionX public="1"> + + hide + + <_positionY public="1"> + + hide + + <_positionZ public="1"> + + hide + + <_rotation00 public="1"> + + hide + + <_rotation01 public="1"> + + hide + + <_rotation02 public="1"> + + hide + + <_rotation10 public="1"> + + hide + + <_rotation11 public="1"> + + hide + + <_rotation12 public="1"> + + hide + + <_rotation20 public="1"> + + hide + + <_rotation21 public="1"> + + hide + + <_rotation22 public="1"> + + hide + + + + * Sets the transformation to identity and returns `this`. + + + + * Returns the position of the transformation. + + + + + + + * Sets `position` to the position of the transformation. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets the position of the transformation to `position` and returns `this`. + + + + + + + * Translates the position by `translation`. + + + + * Returns the rotation matrix. + + + + + + + * Sets `out` to the rotation matrix. + * + * This does not create a new instance of `Mat3`. + + + + + + + * Sets the rotation matrix to `rotation` and returns `this`. + + + + + + + * Sets the rotation by Euler angles `eulerAngles` in radians. + + + + + + + * Applies rotation by the rotation matrix `rotation`. + + + + + + + * Applies the rotation by Euler angles `eulerAngles` in radians. + + + + * Returns the rotation as a quaternion. + + + + + + + * Sets `orientation` to the quaternion representing the rotation. + * + * This does not create a new instance of `Quat`. + + + + + + + * Sets the rotation from a quaternion `quaternion` and returns `this`. + + + + * Returns a clone of the transformation. + + + + + + + * Sets the transformation to `transform` and returns `this`. + + + + * Creates a new identical transform. + + * Transform class provides a set of translation and rotation. + + + oimo.m.B.bu() + + + + + + 0.2 + + + + 0.2 + + + + 1 + + + + 1 + + + + 1 + + + + 20 + + + + MathUtil.PI + + + + 0.1 + + + + 0.45 + + + + 0.05 + + + + true + + + + 128 + + + + 128 + + + + 0.5 + + + + 0.2 + + + + 0.4 + + + + 1.0 + + + + 0.05 + + + + PositionCorrectionAlgorithm._BAUMGARTE + + + + PositionCorrectionAlgorithm._SPLIT_IMPULSE + + + + 0.05 + + + + 4 + + + + ConstraintSolverType._ITERATIVE + + + + PositionCorrectionAlgorithm._BAUMGARTE + + + + 0.8 + + + + 0.95 + + + + 1e-6 + + + + 1e-6 + + + + 6 + + + + 1e-9 + + + + 128 + + + + 128 + + + + 0.2 + + + + 0.5 + + + + 1.0 + + + + false + + + + 0.005 + + + + 1 * MathUtil.TO_RADIANS + + * Setting provides advenced parameters used by the physics simulation. + + + + + + new GjkEpa() + + + + * Returns an instance of `GjkEpa`. + + + + + + + + + + + + + + + + + + + + + + + * Computed closest point of the first geometry in world coordinate system. + + + + * Computed closest point of the second geometry in world coordinate system. + + + + * Computed distance between two geometries. This value may be negative if two + * geometries are overlapping. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * Computes the closest points of two convex geometries `c1` and `c2` with transforms `tf1` and `tf2` + * respectively, and returns the status of the result (see `GjkEpaResultState` for details). If cached + * data `cache` is not `null`, this tries to exploit the previous result in `cache` to improve performance, + * and stores the new result to `cache`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + + + + + + + + + + + * Computes the distance between two convex geometries `c1` and `c2` with transforms `tf1` and `tf2` + * respectively, and returns the status of the result (see `GjkEpaResultState` for details). Different + * from `GjkEpa.computeClosestPoints`, this does not compute negative distances and closest points if + * two geometries are overlapping. If cached data `cache` is not `null`, this tries to exploit the + * previous result in `cache` to improve performance, and stores the new result to `cache`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + + + + + + + + + + + + + * Performs a convex casting between `c1` and `c2`. Returns `true` and sets the result information + * to `hit` if the convex geometries intersect. Each convex geometries translates by `tl1` and `tl2`, + * starting from the beginning transforms `tf1` and `tf2` respectively. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + + + + + + + + + + + * Performs ray cansting against the convex geometry `c` with transform `tf`. Returns `true` and sets + * the result information to `hit` if the line segment from `begin` to `end` intersects the convex + * geometry. Otherwise returns `false`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + + + + * Default constructor. Consider using `GjkEpa.getInstance` instead of creating a new + * instance. + + * GJK algorithm and EPA for narrow-phase collision detection. + + + oimo.m.B.bu() + + + + + hide + + + <_SUCCEEDED public="1" get="inline" set="null" expr="0x000" line="8" static="1"> + + + 0x000 + hide + + + <_GJK_FAILED_TO_MAKE_TETRAHEDRON public="1" get="inline" set="null" expr="0x001" line="9" static="1"> + + + 0x001 + hide + + + <_GJK_DID_NOT_CONVERGE public="1" get="inline" set="null" expr="0x002" line="10" static="1"> + + + 0x002 + hide + + + <_EPA_FAILED_TO_INIT public="1" get="inline" set="null" expr="0x101" line="11" static="1"> + + + 0x101 + hide + + + <_EPA_FAILED_TO_ADD_VERTEX public="1" get="inline" set="null" expr="0x102" line="12" static="1"> + + + 0x102 + hide + + + <_EPA_DID_NOT_CONVERGE public="1" get="inline" set="null" expr="0x103" line="13" static="1"> + + + 0x103 + hide + + + + + _SUCCEEDED + * GJK/EPA computation is successfully finished. + + + + _GJK_FAILED_TO_MAKE_TETRAHEDRON + * Failed to construct a tetrahedron enclosing the origin in GJK computation. + + + + _GJK_DID_NOT_CONVERGE + * GJK iterations did not converge in time. + + + + _EPA_FAILED_TO_INIT + * Failed to construct initial polyhedron in EPA construction. + + + + _EPA_FAILED_TO_ADD_VERTEX + * Failed to add a new vertex to the polyhedron in EPA computation. + + + + _EPA_DID_NOT_CONVERGE + * EPA iterations did not converge in time. + + * The list of the state of a result of `GjkEpa.computeClosestPoints`. + + + oimo.m.B.bu() + + + + + + + + + + + * Sets `out` to the minimum length point on the line (`vec1`, `vec2`) + * and returns the index of the voronoi region. + + + + + + + + + + * Sets `out` to the minimum length point on the triangle (`vec1`, `vec2`, `vec3`) + * and returns the index of the voronoi region. + + + + + + + + + + + * Sets `out` to the minimum length point on the tetrahedron (`vec1`, `vec2`, `vec3`, `vec4`) + * and returns the index of the voronoi region. + + * Simplex utilities for GJK/EPA computations. + oimo.m.B.bu() + + + + + 0 + * The number of instance creation. + + + + * The element at row 0 column 0. + + + + * The element at row 0 column 1. + + + + * The element at row 0 column 2. + + + + * The element at row 1 column 0. + + + + * The element at row 1 column 1. + + + + * The element at row 1 column 2. + + + + * The element at row 2 column 0. + + + + * The element at row 2 column 1. + + + + * The element at row 2 column 2. + + + + + + + + + + + + + + + * Sets all elements at once and returns `this`. + + + + * Sets this matrix to identity matrix and returns `this`. + + + + + + + * Returns `this` + `m` + + + + + + + * Returns `this` - `m` + + + + + + + * Returns `this` * `s` + + + + + + + * Returns `this` * `m` + + + + + + + * Sets this matrix to `this` + `m` and returns `this`. + + + + + + + * Sets this matrix to `this` - `m` and returns `this`. + + + + + + + * Sets this matrix to `this` * `s` and returns `this`. + + + + + + + * Sets this matrix to `this` * `m` and returns `this`. + + + + + + + + + * Returns *scaling matrix* * `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Returns `this` * *scaling matrix*. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + + * Returns *rotation matrix* * `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + + * Returns `this` * *rotation matrix*. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + * Sets this matrix to *scaling matrix* * `this`, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Sets this matrix to `this` * *scaling matrix*, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + + * Sets this matrix to *rotation matrix* * `this`, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + + * Sets this matrix to `this` * *rotation matrix*, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + * Returns the transposed matrix. + + + + * Sets this matrix to the transposed matrix and returns `this`. + + + + * Returns the determinant. + + + + * Returns the trace. + + + + * Returns the inverse matrix. + * + * If the determinant is zero, zero matrix is returned. + + + + * Sets this matrix to the inverse matrix and returns `this`. + * + * If the determinant is zero, this matrix is set to zero matrix. + + + + + + + { columnMajor : false } + * Returns an array of the elements of this matrix. + * + * If `columnMajor` is true, the array is arranged in column-major order. + * Otherwise, the array is arranged in row-major order. + + + + + + + * Copies values from `m` and returns `this`. + + + + * Returns a clone of the matrix. + + + + + + + * Sets this matrix to the representation of the quaternion `q`, and returns `this`. + + + + * Returns a quaternion which represents this matrix. + * + * This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1. + + + + + + + * Sets this matrix to the rotation matrix represented by Euler angles `eulerAngles`, and returns `this`. + * Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. + + + + * Returns a vector `(angleX, angleY, angleZ)` represents the Euler angles of this matrix. + * Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. + * Note that `angleX`, `angleY`, and `angleZ` are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively. + + + + + + + * Returns the `index`th row vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `null` will be returned. + + + + + + + * Returns the `index`th column vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `null` will be returned. + + + + + + + + * Sets `dst` to the `index`th row vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `dst` will be set to the zero vector. + + + + + + + + * Sets `dst` to the `index`th column vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `dst` will be set to the zero vector. + + + + + + + + + * Sets this matrix by row vectors and returns `this`. + + + + + + + + + * Sets this matrix by column vectors and returns `this`. + + + + * Returns the string representation of the matrix. + + + + + + + + + + + + + + + { e22 : 1, e21 : 0, e20 : 0, e12 : 0, e11 : 1, e10 : 0, e02 : 0, e01 : 0, e00 : 1 } + * Creates a new matrix. The matrix is identity by default. + + * 3x3 Matrix class. + * + * Note that columns and rows are 0-indexed. + + + + + + 0 + * The number of instance creation. + + + + * The element at row 0 column 0. + + + + * The element at row 0 column 1. + + + + * The element at row 0 column 2. + + + + * The element at row 0 column 3. + + + + * The element at row 1 column 0. + + + + * The element at row 1 column 1. + + + + * The element at row 1 column 2. + + + + * The element at row 1 column 3. + + + + * The element at row 2 column 0. + + + + * The element at row 2 column 1. + + + + * The element at row 2 column 2. + + + + * The element at row 2 column 3. + + + + * The element at row 3 column 0. + + + + * The element at row 3 column 1. + + + + * The element at row 3 column 2. + + + + * The element at row 3 column 3. + + + + + + + + + + + + + + + + + + + + + + * Sets all elements at once and returns `this`. + + + + * Sets this matrix to identity matrix and returns `this`. + + + + + + + * Returns `this` + `m` + + + + + + + * Returns `this` - `m` + + + + + + + * Returns `this` * `s` + + + + + + + * Returns `this` * `m` + + + + + + + * Sets this matrix to `this` + `m` and returns `this`. + + + + + + + * Sets this matrix to `this` - `m` and returns `this`. + + + + + + + * Sets this matrix to `this` * `s` and returns `this`. + + + + + + + * Sets this matrix to `this` * `m` and returns `this`. + + + + + + + + + * Returns *scaling matrix* * `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Returns `this` * *scaling matrix*. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + + * Returns *rotation matrix* * `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + + * Returns `this` * *rotation matrix*. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + * Returns *translation matrix* * `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Returns `this` * *translation matrix*. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Sets this matrix to *scaling matrix* * `this`, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Sets this matrix to `this` * *scaling matrix*, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + + + + + + + + + + * Sets this matrix to *rotation matrix* * `this`, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + + * Sets this matrix to `this` * *rotation matrix*, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + + + + + + + + + * Sets this matrix to *translation matrix* * `this`, and returns `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + + + + + + + + + * Sets this matrix to `this` * *translation matrix*, and returns `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + + + + * Returns the transposed matrix. + + + + * Sets this matrix to the transposed matrix and returns `this`. + + + + * Returns the determinant. + + + + * Returns the trace. + + + + * Returns the inverse matrix. + * + * If the determinant is zero, zero matrix is returned. + + + + * Sets this matrix to the inverse matrix and returns `this`. + * + * If the determinant is zero, this matrix is set to zero matrix. + + + + + + + + + + + + + + + * Sets this matrix to *view matrix* and returns `this`. + * + * Where *view matrix* is a matrix which represents the viewing transformation with + * eyes at (`eyeX`, `eyeY`, `eyeZ`), fixation point at (`atX`, `atY`, `atZ`), and + * up vector (`upX`, `upY`, `upZ`). + + + + + + + + + + * Sets this matrix to *perspecive projection matrix* and returns `this`. + * + * Where *perspecive projection matrix* is a matrix which represents the perspective + * projection transformation with field of view in the y direction `fovY` in radians, + * aspect ratio `aspect`, and z-value of near and far clipping plane `near`, `far`. + + + + + + + + + + * Sets this matrix to *orthogonal projection matrix* and returns `this`. + * + * Where *orthogonal projection matrix* is a matrix which represents the orthogonal + * projection transformation with screen width and height `width`, `height`, and + * z-value of near and far clipping plane `near`, `far`. + + + + + + + { columnMajor : false } + * Returns an array of the elements of this matrix. + * + * If `columnMajor` is true, the array is arranged in column-major order. + * Otherwise, the array is arranged in row-major order. + + + + + + + * Copies values from `m` and returns `this`. + + + + + + + * Sets this matrix to the extension of `m` and returns `this`. + * + * `this.e33` is set to `1` and other components don't exist in `m` are set to `0`. + + + + + + + * Sets this matrix to the representation of `transform` and returns `this`. + + + + * Returns a clone of the matrix. + + + + * Returns the string representation of the matrix. + + + + + + + + + + + + + + + + + + + + + + { e33 : 1, e32 : 0, e31 : 0, e30 : 0, e23 : 0, e22 : 1, e21 : 0, e20 : 0, e13 : 0, e12 : 0, e11 : 1, e10 : 0, e03 : 0, e02 : 0, e01 : 0, e00 : 1 } + * Creates a new matrix. The matrix is identity by default. + + * 4x4 Matrix class. + * + * Note that columns and rows are 0-indexed. + + + + + + 1e65536 + * Positive infinity. + + + + -1e65536 + * Negative infinity. + + + + 3.14159265358979 + * The ratio of the circumference of a circle to its diameter. + + + + PI * 2 + * Shorthand for `PI * 2`. + + + + PI / 2 + * Shorthand for `PI / 2`. + + + + PI / 180 + * Shorthand for `PI / 180`. + + + + 180 / PI + * Shorthand for `180 / PI`. + + + + + + + * Returns the absolute value of `x`. + + + + + + + * Returns `Math.sin(x)`. + + + + + + + * Returns `Math.cos(x)`. + + + + + + + * Returns `Math.tan(x)`. + + + + + + + * Returns `Math.asin(x)`. + + + + + + + * Returns `Math.acos(x)`. + + + + + + + * Returns `Math.atan(x)`. + + + + + + + * Returns `Math.asin(clamp(-1, x, 1))`. + * This never returns `NaN` as long as `x` is not `NaN`. + + + + + + + * Returns `Math.acos(clamp(-1, x, 1))`. + * This never returns `NaN` as long as `x` is not `NaN`. + + + + + + + + * Returns `Math.atan2(y, x)` + + + + + + + * Returns `Math.sqrt(x)`. + + + + + + + + + * Returns a clamped value of `x` from `min` to `max`. + + + + * Returns `Math.random()`. + + + + + + + + * Returns a random value from `min` inclusive to `max` exclusive. + + + + + + + + * Returns a random `Vec3` from `(min, min, min)` inclusive to `(max, max, max)` exclusive. + + + + * Returns a random `Vec3` from `(-1.0, -1.0, -1.0)` inclusive to `(1.0, 1.0, 1.0)` exclusive. + + * This class provides mathematical operations for internal purposes. + + + + + + + + + + + + + * Returns a `Vec3` object. If an unused object of `Vec3` is pooled, this does + * not create a new instance. + + + + * Returns a `Mat3` object. If an unused object of `Mat3` is pooled, this does + * not create a new instance. + + + + * Returns a `Mat4` object. If an unused object of `Vec3` is pooled, this does + * not create a new instance. + + + + * Returns a `Quat` object. If an unused object of `Quat` is pooled, this does + * not create a new instance. + + + + + + + + + + * Disposes an object got from `Pool.vec3`, `Pool.mat3`, `Pool.mat4`, or `Pool.quat`. + + + + + + + * Disposes an `Vec3` object got from `Pool.vec3`. + + + + + + + * Disposes an `Mat3` object got from `Pool.mat3`. + + + + + + + * Disposes an `Mat4` object got from `Pool.mat4`. + + + + + + + * Disposes an `Quat` object got from `Pool.quat`. + + + + * Default constructor. + + * The object pool system of `Vec3`, `Mat3`, `Mat4`, and `Quat`. + + + + + + 0 + * The number of instance creation. + + + + * The x-value of the imaginary part of the quaternion. + + + + * The y-value of the imaginary part of the quaternion. + + + + * The z-value of the imaginary part of the quaternion. + + + + * The real part of the quaternion. + + + + * Sets the quaternion to identity quaternion and returns `this`. + + + + + + + + + + * Sets all values at once and returns `this`. + + + + + + + * Returns `this` + `v`. + + + + + + + * Returns `this` - `v`. + + + + + + + * Returns `this` * `s`. + + + + + + + * Sets this quaternion to `this` + `v` and returns `this`. + + + + + + + * Sets this quaternion to `this` - `v` and returns `this`. + + + + + + + * Sets this quaternion to `this` * `s` and returns `this`. + + + + * Returns the length of the quaternion. + + + + * Returns the squared length of the quaternion. + + + + + + + * Returns the dot product of `this` and `q`. + + + + * Returns the normalized quaternion. + * + * If the length is zero, zero quaterinon is returned. + + + + * Sets this quaternion to the normalized quaternion and returns `this`. + * + * If the length is zero, this quaternion is set to zero quaternion. + + + + + + + + * Sets this quaternion to the quaternion representing the shortest arc + * rotation from `v1` to `v2`, and return `this`. + + + + + + + + * Returns the spherical linear interpolation between two quaternions `this` and `q` with interpolation paraeter `t`. + * Both quaternions `this` and `q` must be normalized. + + + + + + + * Copies values from `q` and returns `this`. + + + + * Returns a clone of the quaternion. + + + + + + + * Sets this quaternion to the representation of the matrix `m`, and returns `this`. + * + * The matrix `m` must be a rotation matrix, that is, must be orthogonalized and have determinant 1. + + + + * Returns a rotation matrix which represents this quaternion. + + + + * Returns the string representation of the quaternion. + + + + + + + + + + { w : 1, z : 0, y : 0, x : 0 } + * Creates a new quaternion. The quaternion is identity by default. + + * Quaternion class. + + + + <_next public="1"> + + hide + + <_prev public="1"> + + hide + + <_link1 public="1"> + + hide + + <_link2 public="1"> + + hide + + <_s1 public="1"> + + hide + + <_s2 public="1"> + + hide + + <_b1 public="1"> + + hide + + <_b2 public="1"> + + hide + + <_detector public="1"> + + hide + + <_cachedDetectorData public="1"> + + hide + + <_detectorResult public="1"> + + hide + + <_latest public="1"> + + hide + + <_shouldBeSkipped public="1"> + + hide + + <_manifold public="1"> + + hide + + <_updater public="1"> + + hide + + <_contactConstraint public="1"> + + hide + + <_touching public="1"> + + hide + + <_updateManifold public="1" set="method" line="171"> + + hide + + <_postSolve public="1" set="method" line="219"> + + hide + + + + * Returns the first shape of the contact. + + + + * Returns the second shape of the contact. + + + + * Returns whether the shapes are touching. + + + + * Returns the contact manifold. + + + + * Returns the contact constraint. + + + + * Returns the previous contact in the world. + * + * If the previous contact does not exist, `null` will be returned. + + + + * Returns the next contact in the world. + * + * If the next contact does not exist, `null` will be returned. + + + + hide + + * A contact is a cached pair of overlapping shapes in the physics world. contacts + * are created by `ContactManager` when two AABBs of shapes begin overlapping. + * + * As AABBs are larger than its shapes, shapes of a contact don't always + * touching or colliding though their AABBs are overlapping. + + + oimo.m.B.bu() + + + + <_prev public="1"> + + hide + + <_next public="1"> + + hide + + <_contact public="1"> + + hide + + <_other public="1"> + + hide + + + + * Returns the contact of the link. + + + + * Returns the other rigid body of the link. This provides a quick access from a + * rigid body to the other one of the contact. + + + + * Returns the previous contact link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + + + + * Returns the next contact link in the rigid body. + * + * If the next one does not exist, `null` will be returned. + + + + hide + + * A contact link is used to build a constraint graph for clustering rigid bodies. + * In a constraint graph, rigid bodies are nodes and constraints are edges. + * See also `JointLink`. + + + oimo.m.B.bu() + + + + <_numContacts public="1"> + + hide + + <_contactList public="1"> + + hide + + <_contactListLast public="1"> + + hide + + <_contactPool public="1"> + + hide + + <_broadPhase public="1"> + + hide + + <_collisionMatrix public="1"> + + hide + + + + + + + + + <_updateContacts public="1" set="method" line="180"> + + hide + + <_postSolve public="1" set="method" line="187"> + + hide + + + + * Returns the number of the contacts in the world. + + + + * Returns the linked list of the contacts in the world. + + + + + + + hide + + * The manager of the contacts in the physics world. A contact of two + * shapes is created when the AABBs of them begin overlapping, and + * is destroyed when they end overlapping. + + + oimo.m.B.bu() + + + + + + hide + + + + hide + + + + hide + + + + + + + + + + <_clear public="1" set="method" line="67"> + + hide + + <_addRigidBody public="1" set="method" line="78"> + + + + + hide + + <_addConstraintSolver public="1" set="method" line="86"> + + + + + + hide + + <_stepSingleRigidBody public="1" set="method" line="102"> + + + + + + hide + + <_step public="1" set="method" line="148"> + + + + + + + hide + + + * Simulation island. + + + oimo.m.B.bu() + hide + + + +
+ + * The time step of simulation. +
+ + + * The inverse time step of simulation, equivalent to simulation FPS. + + + + * The ratio of time steps. Defined by current time step divided by previous + * time step. + + + + hide + + * Information of time-step sizes of the simulation. + +
+ + <_rigidBodyList public="1"> + + hide + + <_rigidBodyListLast public="1"> + + hide + + <_jointList public="1"> + + hide + + <_jointListLast public="1"> + + hide + + <_broadPhase public="1"> + + hide + + <_contactManager public="1"> + + hide + + <_numRigidBodies public="1"> + + hide + + <_numJoints public="1"> + + hide + + <_numShapes public="1"> + + hide + + <_numIslands public="1"> + + hide + + <_numVelocityIterations public="1"> + + hide + + <_numPositionIterations public="1"> + + hide + + <_gravity public="1"> + + hide + + <_timeStep> + + hide + + <_island> + + hide + + <_rigidBodyStack> + + hide + + <_solversInIslands> + + hide + + <_numSolversInIslands> + + hide + + <_debugDraw> + + hide + + <_rayCastWrapper> + + hide + + <_convexCastWrapper> + + hide + + <_aabbTestWrapper> + + hide + + <_pool> + + hide + + <_shapeIdCount> + + hide + + <_updateContacts set="method" line="106"> + + hide + + <_solveIslands set="method" line="117"> + + hide + + + + + + <_drawBvh set="method" line="279"> + + + + + + hide + + <_drawBvhNode set="method" line="285"> + + + + + + + + hide + + <_drawRigidBodies set="method" line="300"> + + + + + hide + + <_drawConstraints set="method" line="456"> + + + + + hide + + <_drawRotationalLimit set="method" line="679"> + + + + + + + + + + + + + hide + + <_drawTranslationalLimit set="method" line="692"> + + + + + + + + + + hide + + <_drawTranslationalLimit3D set="method" line="702"> + + + + + + + + + + + + + hide + + <_drawEllipseOnSphere set="method" line="744"> + + + + + + + + + + + + + hide + + + + + + + * Advances the simulation by the time step `timeStep`. + + + + + + + * Adds the rigid body `rigidBody` to the simulation world. + + + + + + + * Removes the rigid body `rigidBody` from the simulation world. + + + + + + + * Adds the joint `joint` to the simulation world. + + + + + + + * Removes the joint `joint` from the simulation world. + + + + + + + * Sets the debug draw interface to `debugDraw`. Call `World.debugDraw` to draw the simulation world. + + + + * Returns the debug draw interface. + + + + * Draws the simulation world for debugging. Call `World.setDebugDraw` to set the debug draw interface. + + + + + + + + + * Performs a ray casting. `callback.process` is called for all shapes the ray + * from `begin` to `end` hits. + + + + + + + + + + * Performs a convex casting. `callback.process` is called for all shapes the convex geometry + * `convex` hits. The convex geometry translates by `translation` starting from the beginning + * transform `begin`. + + + + + + + + * Performs an AABB query. `callback.process` is called for all shapes that their + * AABB and `aabb` intersect. + + + + * Returns the list of the rigid bodies added to the world. + + + + * Returns the list of the joints added to the world. + + + + * Returns the broad-phase collision detection algorithm. + + + + * Returns the contact manager. + + + + * Returns the number of the rigid bodies added to the world. + + + + * Returns the number of the joints added to the world. + + + + * Returns the number of the shapes added to the world. + + + + * Returns the number of simulation islands. + + + + * Returns the number of velocity iterations of constraint solvers. + + + + + + + * Sets the number of velocity iterations of constraint solvers to `numVelocityIterations`. + + + + * Returns the number of position iterations of constraint solvers. + + + + + + + * Sets the number of position iterations of constraint solvers to `numPositionIterations`. + + + + * Returns the gravitational acceleration of the simulation world. + + + + + + + * Sets the gravitational acceleration of the simulation world to `gravity`. + + + + + + + + { gravity : null, broadPhaseType : BroadPhaseType._BVH } + * Creates a new physics world, with broad-phase collision detection algorithm `broadPhaseType` and + * gravitational acceleration `gravity`. + + * The physics simulation world. This manages entire the dynamic simulation. You can add + * rigid bodies and joints to the world to simulate them. + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_callback public="1"> + <_aabb public="1"> + + + + + + + + + + + + + + * This is called every time the world detects a shape `shape` that + * the query aabb intersects. + + + + * Default constructor. + + * A callback interface for aabb tests in a world. + + + + + + + + + * This is called when two shapes start touching each other. `c` is the contact of + * the two shapes. + + + + + + + * This is called every frame **before** velocity solver iterations while two shapes + * are touching. `c` is the contact for the two shapes. + + + + + + + * This is called every frame **after** velocity solver iterations while two shapes + * are touching. `c` is the contact for the two shapes. + + + + + + + * This is called when two shapes end touching each other. `c` is the contact of + * the two shapes. + + + + * Default constructor. + + * A callback class for contact events. Contact events between two shapes + * will occur in following order: + * + * 1. `beginContact` + * 1. `preSolve` (before velocity update) + * 1. `postSolve` (after velocity update) + * 1. (repeats 2. and 3. every frame while the shapes are touching) + * 1. `endContact` + + + + + + + + + + * This is called every time the world detects a shape `shape` that + * the ray intersects with the hit data `hit`. + + + + * Default constructor. + + * A callback class for ray casts in a world. + + + + + + + * The shape the ray hit. + + + + * The position the ray hit at. + + + + * The normal vector of the surface the ray hit. + + + + * The ratio of the position the ray hit from the start point to the end point. + + + + * Whether the ray hit any shape in the world. + + + + * Clears the result data. + + + + + + + + + * Default constructor. + + * A ray cast callback implementation that keeps only the closest hit data. + * This is reusable, but make sure to clear the old result by calling + * `RayCastClosest.clear` if used once or more before. + + + + + 8 + + + + 4 + + + + 8 + + + + * Whether the shapes are drawn in wireframe mode. + + + + * Whether to draw the shapes. + + + + * Whether to draw the bounding volume hierarchy of the broad-phase collision + * detection. If `BvhBroadPhase` is not used, nothing will be drawn regardless + * of the value of this parameter. + + + + * The minimum depth of the BVH to be drawn. If `DebugDrawer.drawBvh` is set to + * `false`, the entire BVH will not be drawn. + + + + * The maximum depth of the BVH to be drawn. If `DebugDrawer.drawBvh` is set to + * `false`, the entire BVH will not be drawn. + + + + * Whether to draw the AABBs. + + + + * Whether to draw the bases of the rigid bodies. + + + + * Whether to draw the overlapping pairs of the AABBs. + + + + * Whether to draw the contacts. + + + + * Whether to draw the bases (normals, tangents, and binormals) of the contacts. + + + + * Whether to draw the joints. + + + + * Whether to draw the limits of the joints. + + +

+ + + + + + + + + + + + + + + + * Draws an axis-aligned bounding box. + * + * `min` is the minimum point of the AABB. + * + * `max` is the maximum point of the AABB. + * + * `color` is the color of the AABB. + + + + + + + + + + + * Draws the basis of a transform `transform`. + * + * `length` is the length of the lines to be drawn. + * + * `colorX` is the color of the x-axis of the basis. + * + * `colorY` is the color of the y-axis of the basis. + * + * `colorZ` is the color of the z-axis of the basis. + + + + + + + + + + + + * Draws an ellipse. + * + * `center` is the center of the ellipse. + * + * `ex` is the normalized x-axis vector of the ellipse. + * + * `ey` is the normalized y-axis vector of the ellipse. + * + * `radiusX` is the radius along the x-axis of the ellipse. + * + * `radiusY` is the radius along the y-axis of the ellipse. + * + * `color` is the color of the ellipse. + + + + + + + + + + + + + + + * Draws an arc. + * + * `center` is the center of the arc. + * + * `ex` is the normalized x-axis vector of the arc. + * + * `ey` is the normalized y-axis vector of the arc. + * + * `radiusX` is the radius along the x-axis of the arc. + * + * `radiusY` is the radius along the y-axis of the arc. + * + * `startAngle` is the start angle of the arc in radians. + * + * `endAngle` is the end angle of the arc in radians. + * + * `drawSector` is whether to draw line segments between start/end point and center point. + * + * `color` is the color of the arc. + + + + + + + + + + * Draws a cone locally along to the y-axis. The center of the cone is in the middle of + * the vertex and the center of the base circle. + * + * `tf` is the transformation of the cone. + * + * `radius` is the radius of the base circle of the cone. + * + * `halfHeight` is the half-height of the cone. The local position of the vertex of + * the cone is `(0, halfHeight, 0)`. + * + * `color` is the color of the cone. + + + + + + + + + + * Draws a cylinder locally along to the y-axis. + * + * `tf` is the transformation of the cylinder. + * + * `radius` is the radius of the cylinder. + * + * `halfHeight` is the half-height of the cylinder. + * + * `color` is the color of the cylinder. + + + + + + + + + + * Draws a capsule locally along to the y-axis. + * + * `tf` is the transformation of the capsule. + * + * `radius` is the radius of the capsule. + * + * `halfHeight` is the half-height of the capsule. + * + * `color` is the color of the capsule. + + + + + + + + + * Draws a sphere. + * + * `tf` is the transformation of the sphere. + * + * `radius` is the radius of the sphere. + * + * `color` is the color of the sphere. + + + + + + + + + * Draws a box. + * + * `tf` is the transformation of the box. + * + * `halfExtents` is the half-extents of the box. + * + * `color` is the color of the box. + + + + + + + + + + + + + + + * Draws a rectangle. + * + * `v1`, `v2`, `v3`, `v4` are the rectangle's vertices in CCW order. + * + * `n1`, `n2`, `n3`, `n4` are the normals of the rectangle's vertices in CCW order. + * + * `color` is the color of the rectangle. + + + + + + + + * Draws a point at `v`. + * + * `color` is the color of the point. + + + + + + + + + + + + + * Draws a triangle. + * + * `v1`, `v2`, `v3` are the triangle's vertices in CCW order. + * + * `n1`, `n2`, `n3` are the normals of the triangle's vertices in CCW order. + * + * `color` is the color of the triangle. + + + + + + + + + * Draws a line segment between `v1` and `v2`. + * + * `color` is the color of the line segment. + + + + * Default constructor. + + * The interface of debug drawer. This provides graphical information of a physics world + * for debugging softwares. Users should override at least three methods `DebugDraw.point`, + * `DebugDraw.triangle`, `DebugDraw.line`. + +
+ + + + new Vec3(0.7, 0.2, 0.4) + + + + new Vec3(1.0, 0.8, 0.1) + + + + new Vec3(0.5, 0.25, 0.6) + + + + new Vec3(0.6, 0.8, 0.3) + + + + new Vec3(0.3, 0.3, 0.8) + + + + new Vec3(0.2, 0.8, 0.5) + + + + new Vec3(0.7, 0.7, 0.7) + + + + new Vec3(1.0, 0.5, 0.1) + + + + new Vec3(1.0, 0.1, 0.1) + + + + new Vec3(0.4, 0.4, 0.4) + + + + new Vec3(1.0, 1.0, 0.1) + + + + new Vec3(1.0, 0.1, 0.1) + + + + new Vec3(1.0, 0.6, 0.1) + + + + new Vec3(0.1, 0.8, 0.6) + + + + new Vec3(0.8, 0.1, 1.0) + + + + new Vec3(1.0, 1.0, 0.1) + + + + new Vec3(0.5, 0.1, 0.1) + + + + new Vec3(1.0, 0.1, 0.1) + + + + new Vec3(0.1, 0.8, 0.1) + + + + new Vec3(0.2, 0.2, 1.0) + + + + 0.5 + + + + 0.5 + + + + 0.5 + + + + new Vec3(0.8, 0.8, 0.8) + + + + new Vec3(1.0, 0.1, 0.1) + + + + 0.3 + + + + 0.5 + + + + new Vec3(1.0, 0.0, 0.0) + + + + new Vec3(0.0, 1.0, 0.0) + + + + new Vec3(0.0, 0.0, 1.0) + + + + * Default constructor. + + * Style settings of the debug draw. + + + + + + 0 + + + + 0 + + + + 0 + + + + 0 + + * Performance + + + + <_b1 public="1"> + + hide + + <_b2 public="1"> + + hide + + <_addedToIsland public="1"> + + hide + + + + + + + * Prepares for velocity iteration. Time step information `timeStep` is given for + * computing time-depending data. + + + + + + + * Applies initial impulses. + + + + * Performs single velocity iteration. + + + + + + + * Performs post-processes of velocity part. Time step information `timeStep` is given + * for computing time-depending data. + + + + + + + * Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step + * information `timeStep` is given for computing time-depending data. + * + * This may not be called depending on position correction algorithm. + + + + * Performs single position iteration (split impulse) + + + + + + + * Performs single position iteration (nonlinear Gauss-Seidel) + + + + * Performs post-processes. + + + + hide + + * The base class of all constarint solvers. + oimo.m.B.bu() + + + <_BAUMGARTE public="1" get="inline" set="null" expr="0" line="10" static="1"> + + + 0 + hide + + + <_SPLIT_IMPULSE public="1" get="inline" set="null" expr="1" line="11" static="1"> + + + 1 + hide + + + <_NGS public="1" get="inline" set="null" expr="2" line="12" static="1"> + + + 2 + hide + + + + + _BAUMGARTE + * Baumgarte stabilizaiton. Fastest but introduces extra energy. + + + + _SPLIT_IMPULSE + * Use split impulse and pseudo velocity. Fast enough and does not introduce extra + * energy, but somewhat unstable, especially for joints. + + + + _NGS + * Nonlinear Gauss-Seidel method. Slow but stable. + + * The list of the algorithms for position corretion. + + + oimo.m.B.bu() + + + + <_positionCorrectionAlgorithm public="1"> + + hide + + <_manifold public="1"> + + hide + + <_s1 public="1"> + + hide + + <_s2 public="1"> + + hide + + <_tf1 public="1"> + + hide + + <_tf2 public="1"> + + hide + + <_invM1 public="1"> + + hide + + <_invM2 public="1"> + + hide + + <_friction public="1"> + + hide + + <_restitution public="1"> + + hide + + <_invI100 public="1"> + + hide + + <_invI101 public="1"> + + hide + + <_invI102 public="1"> + + hide + + <_invI110 public="1"> + + hide + + <_invI111 public="1"> + + hide + + <_invI112 public="1"> + + hide + + <_invI120 public="1"> + + hide + + <_invI121 public="1"> + + hide + + <_invI122 public="1"> + + hide + + <_invI200 public="1"> + + hide + + <_invI201 public="1"> + + hide + + <_invI202 public="1"> + + hide + + <_invI210 public="1"> + + hide + + <_invI211 public="1"> + + hide + + <_invI212 public="1"> + + hide + + <_invI220 public="1"> + + hide + + <_invI221 public="1"> + + hide + + <_invI222 public="1"> + + hide + + <_b1 public="1"> + + hide + + <_b2 public="1"> + + hide + + <_solver public="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="70"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="162"> + + + + + hide + + <_syncManifold public="1" set="method" line="198"> + + hide + + + + * Returns the first shape of the contact. + + + + * Returns the second shape of the contact. + + + + * Returns the contact manifold. + + + + * Returns whether the two rigid bodies are touching. + + + + + + + hide + + * A contact constraint provides collision information for a contact constraint solver. + * This holds a contact manifold, which has some contact points, contact normals, and + * contact impulses. See `Manifold` for more information. + + + oimo.m.B.bu() + + + + + + + + + + hide + + + + hide + + + + hide + + + + + + + * Internal class. + + + hide + oimo.m.B.bu() + + + + <_normalX public="1"> + + hide + + <_normalY public="1"> + + hide + + <_normalZ public="1"> + + hide + + <_tangentX public="1"> + + hide + + <_tangentY public="1"> + + hide + + <_tangentZ public="1"> + + hide + + <_binormalX public="1"> + + hide + + <_binormalY public="1"> + + hide + + <_binormalZ public="1"> + + hide + + <_numPoints public="1"> + + hide + + <_points public="1"> + + hide + + <_clear public="1" set="method" line="35"> + + hide + + <_buildBasis public="1" set="method" line="42"> + + + + + hide + + <_updateDepthsAndPositions public="1" set="method" line="85"> + + + + + + hide + + + + * Returns the normal vector of the contact manifold. The normal vector has unit + * length and is perpendicular to the contact plane. + + + + + + + * Sets `normal` to the normal vector of the contact manifold. The normal vector has + * unit length and is perpendicular to the contact plane. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the tangent vector of the contact manifold. The tangent vector has unit + * length and is perpendicular to the normal vector. + + + + + + + * Sets `tangent` to the tangent vector of the contact manifold. The tangent vector has + * unit length and is perpendicular to the normal vector. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the binormal vector of the contact manifold. The binormal vector has unit + * length and is perpendicular to both the normal and the tangent vector. + + + + + + + * Sets `binormal` to the binormal vector of the contact manifold. The binormal vector has + * unit length and is perpendicular to both the normal and the tangent vector. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the manifold point vector of the contact manifold. Note that **only the first + * `Manifold.getNumPoints` elements of the vector are in use**, and the manifold points may + * be disabled (see `ManifoldPoint.isEnabled`). + + + + * Returns the number of existing manifold points. + + + + hide + + * A contact manifold holds collision data of a pair of shapes. + + + oimo.m.B.bu() + + + + <_localPos1X public="1"> + + hide + + <_localPos1Y public="1"> + + hide + + <_localPos1Z public="1"> + + hide + + <_localPos2X public="1"> + + hide + + <_localPos2Y public="1"> + + hide + + <_localPos2Z public="1"> + + hide + + <_relPos1X public="1"> + + hide + + <_relPos1Y public="1"> + + hide + + <_relPos1Z public="1"> + + hide + + <_relPos2X public="1"> + + hide + + <_relPos2Y public="1"> + + hide + + <_relPos2Z public="1"> + + hide + + <_pos1X public="1"> + + hide + + <_pos1Y public="1"> + + hide + + <_pos1Z public="1"> + + hide + + <_pos2X public="1"> + + hide + + <_pos2Y public="1"> + + hide + + <_pos2Z public="1"> + + hide + + <_depth public="1"> + + hide + + <_impulse public="1"> + + hide + + <_warmStarted public="1"> + + hide + + <_disabled public="1"> + + hide + + <_id public="1"> + + hide + + + + * Returns the first rigid body's manifold point in world coordinate. + + + + + + + * Sets `position` to the first rigid body's manifold point in world coordinate. + * This does not create a new instance of `Vec3`. + + + + * Returns the second rigid body's manifold point in world coordinate. + + + + + + + * Sets `position` to the second rigid body's manifold point in world coordinate. + * This does not create a new instance of `Vec3`. + + + + * Returns the amount of the overlap. If the manifold point is separate, a negative + * value is returned. + + + + * Returns whether the manifold point has existed for more than two steps. + + + + * Returns the normal impulse of the manifold point. + + + + * Returns the tangent impulse of the manifold point. + + + + * Returns the binormal impulse of the manifold point. + + + + * Returns whether the manifold point is enabled. + + + + hide + + * A manifold point is a contact point in a contact manifold. This holds detailed collision + * data (position, overlap depth, impulse, etc...) for collision response. + + + oimo.m.B.bu() + + + + <_manifold> + + hide + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * Internal class + + + hide + oimo.m.B.bu() + + + + + + 1 + + + + 2 + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + + * The row of a Jacobian matrix. + + + hide + oimo.m.B.bu() + + + + + + + + + * Internal class. + + + hide + + + + + + Used for both velocity and position solver. + + + + Used for velocity solver. + + + + Used for velocity solver. + + + + Used for both velocity and position solver. + + + + Used for velocity solver. + + + + Used for velocity solver. + + + + Used for both velocity and position solver. + + + * Internal class. + + + hide + + + + + + + + + * Internal class. + + + hide + + + + + + Used for both velocity and position solver. + + + + Used for both velocity and position solver. + + + + Used for velocity solver. + + + + Used for both velocity and position solver. + + + + Used for both velocity and position solver. + + + + Used for velocity solver. + + + + Used for velocity solver. + + + + Used for both velocity and position solver. + + + * Internal class. + + + hide + oimo.m.B.bu() + + + + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + + + * Internal class + + + oimo.m.B.bu() + hide + + + + <_b1 public="1"> + + hide + + <_b2 public="1"> + + hide + + <_link1 public="1"> + + hide + + <_link2 public="1"> + + hide + + <_positionCorrectionAlgorithm public="1"> + + hide + + <_allowCollision public="1"> + + hide + + <_prev public="1"> + + hide + + <_next public="1"> + + hide + + <_world public="1"> + + hide + + <_localAnchor1X public="1"> + + hide + + <_localAnchor1Y public="1"> + + hide + + <_localAnchor1Z public="1"> + + hide + + <_localAnchor2X public="1"> + + hide + + <_localAnchor2Y public="1"> + + hide + + <_localAnchor2Z public="1"> + + hide + + <_relativeAnchor1X public="1"> + + hide + + <_relativeAnchor1Y public="1"> + + hide + + <_relativeAnchor1Z public="1"> + + hide + + <_relativeAnchor2X public="1"> + + hide + + <_relativeAnchor2Y public="1"> + + hide + + <_relativeAnchor2Z public="1"> + + hide + + <_anchor1X public="1"> + + hide + + <_anchor1Y public="1"> + + hide + + <_anchor1Z public="1"> + + hide + + <_anchor2X public="1"> + + hide + + <_anchor2Y public="1"> + + hide + + <_anchor2Z public="1"> + + hide + + <_localBasisX1X public="1"> + + hide + + <_localBasisX1Y public="1"> + + hide + + <_localBasisX1Z public="1"> + + hide + + <_localBasisY1X public="1"> + + hide + + <_localBasisY1Y public="1"> + + hide + + <_localBasisY1Z public="1"> + + hide + + <_localBasisZ1X public="1"> + + hide + + <_localBasisZ1Y public="1"> + + hide + + <_localBasisZ1Z public="1"> + + hide + + <_localBasisX2X public="1"> + + hide + + <_localBasisX2Y public="1"> + + hide + + <_localBasisX2Z public="1"> + + hide + + <_localBasisY2X public="1"> + + hide + + <_localBasisY2Y public="1"> + + hide + + <_localBasisY2Z public="1"> + + hide + + <_localBasisZ2X public="1"> + + hide + + <_localBasisZ2Y public="1"> + + hide + + <_localBasisZ2Z public="1"> + + hide + + <_basisX1X public="1"> + + hide + + <_basisX1Y public="1"> + + hide + + <_basisX1Z public="1"> + + hide + + <_basisY1X public="1"> + + hide + + <_basisY1Y public="1"> + + hide + + <_basisY1Z public="1"> + + hide + + <_basisZ1X public="1"> + + hide + + <_basisZ1Y public="1"> + + hide + + <_basisZ1Z public="1"> + + hide + + <_basisX2X public="1"> + + hide + + <_basisX2Y public="1"> + + hide + + <_basisX2Z public="1"> + + hide + + <_basisY2X public="1"> + + hide + + <_basisY2Y public="1"> + + hide + + <_basisY2Z public="1"> + + hide + + <_basisZ2X public="1"> + + hide + + <_basisZ2Y public="1"> + + hide + + <_basisZ2Z public="1"> + + hide + + <_impulses public="1"> + + hide + + <_appliedForceX public="1"> + + hide + + <_appliedForceY public="1"> + + hide + + <_appliedForceZ public="1"> + + hide + + <_appliedTorqueX public="1"> + + hide + + <_appliedTorqueY public="1"> + + hide + + <_appliedTorqueZ public="1"> + + hide + + <_breakForce public="1"> + + hide + + <_breakTorque public="1"> + + hide + + <_type public="1"> + + hide + + <_solver public="1"> + + hide + + + + * Extra field that users can use for their own purposes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_syncAnchors public="1" set="method" line="511"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="532"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="538"> + + + + + hide + + <_checkDestruction public="1" set="method" line="544"> + + hide + + + + * Returns the first rigid body. + + + + * Returns the second rigid body. + + + + * Returns the type of the joint. + * + * See `JointType` for details. + + + + * Returns the first rigid body's anchor point in world coordinates. + + + + * Returns the second rigid body's anchor point in world coordinates. + + + + + + + * Sets `anchor` to the first rigid body's anchor point in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `anchor` to the second rigid body's anchor point in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's local anchor point in world coordinates. + + + + * Returns the second rigid body's local anchor point in world coordinates. + + + + + + + * Sets `localAnchor` to the first rigid body's anchor point in local coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `localAnchor` to the second rigid body's anchor point in local coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the basis of the joint for the first rigid body in world coordinates. + + + + * Returns the basis of the joint for the second rigid body in world coordinates. + + + + + + + * Sets `basis` to the basis of the joint for the first rigid body in world coordinates. + * + * This does not create a new instance of `Mat3`. + + + + + + + * Sets `basis` to the basis of the joint for the second rigid body in world coordinates. + * + * This does not create a new instance of `Mat3`. + + + + * Returns whether to allow the connected rigid bodies to collide each other. + + + + + + + * Sets whether to allow the connected rigid bodies to collide each other. + + + + * Returns the magnitude of the constraint force at which the joint will be destroyed. + * + * Returns `0` if the joint is unbreakable. + + + + + + + * Sets the magnitude of the constraint force at which the joint will be destroyed. + * + * Set `0` for unbreakable joints. + + + + * Returns the magnitude of the constraint torque at which the joint will be destroyed. + * + * Returns `0` if the joint is unbreakable. + + + + + + + * Sets the magnitude of the constraint force at which the joint will be destroyed. + * + * Set `0` for unbreakable joints. + + + + * Returns the type of the position correction algorithm for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + + + + + + + * Sets the type of the position correction algorithm to `positionCorrectionAlgorithm` for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + + + + * Returns the force applied to the first rigid body at the last time step. + + + + + + + * Sets `appliedForce` to the force applied to the first rigid body at the last time step. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the torque applied to the first rigid body at the last time step. + + + + + + + * Sets `appliedTorque` to the torque applied to the first rigid body at the last time step. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the previous joint in the world. + * + * If the previous one does not exist, `null` will be returned. + + + + * Returns the next joint in the world. + * + * If the next one does not exist, `null` will be returned. + + + + + + + + hide + + * The base class of joints. Joints are used to connect two rigid bodies + * in various ways. See `JointType` for all types of joints. + oimo.m.B.bu() + + + + <_translSd public="1"> + + hide + + <_translLm public="1"> + + hide + + <_rotSd public="1"> + + hide + + <_rotLm public="1"> + + hide + + <_basis public="1"> + + hide + + + + + + + + + + + + + + <_syncAnchors public="1" set="method" line="170" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="178" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="183" override="1"> + + + + + hide + + + + * Returns the first rigid body's constraint axis in world coordinates. + + + + * Returns the second rigid body's constraint axis in world coordinates. + + + + + + + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + + + + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + + + + + + + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the translational spring and damper settings. + + + + * Returns the rotational spring and damper settings. + + + + * Returns the translational limits and motor settings. + + + + * Returns the rotational limits and motor settings. + + + + * Returns the rotation angle in radians. + + + + * Returns the translation of the joint. + + + + + + + * Creates a new cylindrical joint by configuration `config`. + + * A cylindrical joint constrains two rigid bodies to share their constraint + * axes, and restricts relative translation and rotation onto the constraint + * axis. This joint provides two degrees of freedom. You can enable lower and + * upper limits, motors, spring and damper effects of both translation and + * rotation part of the constraint. + oimo.m.B.bu() + + + + + * The first rigid body attached to the joint. + + + + * The second rigid body attached to the joint. + + + + * The local position of the first rigid body's anchor point. + + + + * The local position of the second rigid body's anchor point. + + + + * Whether to allow the connected rigid bodies to collide each other. + + + + * The type of the constraint solver for the joint. + * + * See `ConstraintSolverType` for details. + + + + * The type of the position correction algorithm for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + + + + * The joint will be destroyed when magnitude of the constraint force exceeds the value. + * + * Set `0` for unbreakable joints. + + + + * The joint will be destroyed when magnitude of the constraint torque exceeds the value. + * + * Set `0` for unbreakable joints. + + <_init set="method" line="79"> + + + + + + + + hide + + * A joint configuration is used for constructions of various joints. + * An instance of any kind of the joint configurations can safely be reused. + + + + + + * The first body's local constraint axis. + + + + * The second body's local constraint axis. + + + + * The translational limit and motor along the constraint axis of the joint. + + + + * The translational spring and damper along constraint the axis of the joint. + + + + * The rotational limit and motor along the constraint axis of the joint. + + + + * The rotational spring and damper along the constraint axis of the joint. + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + + + + * Default constructor. + + * A cylindrical joint config is used for constructions of cylindrical joints. + + + + <_translSds public="1"> + + hide + + <_rotSds public="1"> + + hide + + <_translLms public="1"> + + hide + + <_rotLms public="1"> + + hide + + <_axisXX public="1"> + + hide + + <_axisXY public="1"> + + hide + + <_axisXZ public="1"> + + hide + + <_axisYX public="1"> + + hide + + <_axisYY public="1"> + + hide + + <_axisYZ public="1"> + + hide + + <_axisZX public="1"> + + hide + + <_axisZY public="1"> + + hide + + <_axisZZ public="1"> + + hide + + <_angleX public="1"> + + hide + + <_angleY public="1"> + + hide + + <_angleZ public="1"> + + hide + + + + + + + + + + + + + + <_syncAnchors public="1" set="method" line="255" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="263" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="268" override="1"> + + + + + hide + + + + * Returns the first (x) rotation axis of the relative Euler angles. + + + + * Returns the second (y) rotation axis of the relative Euler angles. + + + + * Returns the third (z) rotation axis of the relative Euler angles. + + + + * Returns the translational spring and damper settings along the first body's constraint basis. + + + + * Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles. + + + + * Returns the translational limits and motor settings along the first body's constraint basis. + + + + * Returns the rotational limits and motor settings along the rotation axes of the relative x-y-z Euler angles. + + + + * Returns the relative x-y-z Euler angles. + + + + * Returns the translations along the first rigid body's constraint basis. + + + + + + + * Creates a new generic joint by configuration `config`. + + * A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in + * highly flexible way, so that every translational and rotational axis + * can be locked, unlocked, springy, or powered by a motor like other + * joints. Note that rotation angles are measured as x-y-z Euler angles, + * not as z-x-z Euler angles. + oimo.m.B.bu() + + + + + + * The first body's local constraint basis. + + + + * The second body's local constraint basis. + + + + * The translational limits and motors along the first body's the constraint basis. + + + + * The translational springs and dampers along the first body's constraint basis. + + + + * The rotational limits and motors along the rotation axes of the relative x-y-z Euler angles. + + + + * The rotational springs and dampers along the rotation axes of the relative x-y-z Euler angles. + + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local bases + * from the world bases `worldBasis1` and `worldBasis2`, and returns `this`. + + + + * Default constructor. + + * A generic joint config is used for constructions of generic joints. + oimo.m.B.bu() + + + + + + + * Internal class. + + + hide + + + + <_prev public="1"> + + hide + + <_next public="1"> + + hide + + <_joint public="1"> + + hide + + <_other public="1"> + + hide + + + + * Returns the contact the rigid body is attached to. + + + + * Returns the other rigid body attached to the constraint. This provides a quick access + * from a rigid body to the other one attached to the constraint. + + + + * Returns the previous joint link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + + + + * Returns the next joint link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + + + + + + + hide + + * A joint link is used to build a constraint graph for clustering rigid bodies. + * In a constraint graph, rigid bodies are nodes and constraints are edges. + * See also `ContactLink`. + + + oimo.m.B.bu() + + + + hide + + + + <_SPHERICAL public="1" get="inline" set="null" expr="0" line="8" static="1"> + + + 0 + hide + + + <_REVOLUTE public="1" get="inline" set="null" expr="1" line="9" static="1"> + + + 1 + hide + + + <_CYLINDRICAL public="1" get="inline" set="null" expr="2" line="10" static="1"> + + + 2 + hide + + + <_PRISMATIC public="1" get="inline" set="null" expr="3" line="11" static="1"> + + + 3 + hide + + + <_UNIVERSAL public="1" get="inline" set="null" expr="4" line="12" static="1"> + + + 4 + hide + + + <_RAGDOLL public="1" get="inline" set="null" expr="5" line="13" static="1"> + + + 5 + hide + + + <_GENERIC public="1" get="inline" set="null" expr="6" line="14" static="1"> + + + 6 + hide + + + + + _SPHERICAL + * Represents a spherical joint. + * + * See `SphericalJoint` for details. + + + + _REVOLUTE + * Represents a revolute joint. + * + * See `RevoluteJoint` for details. + + + + _CYLINDRICAL + * Represents a cylindrical joint. + * + * See `CylindricalJoint` for details. + + + + _PRISMATIC + * Represents a prismatic joint. + * + * See `PrismaticJoint` for details. + + + + _UNIVERSAL + * Represents a universal joint. + * + * See `UniversalJoint` for details. + + + + _RAGDOLL + * Represents a ragdoll joint. + * + * See `RagdollJoint` for details. + + + + _GENERIC + * Represents a generic joint. + * + * See `GenericJoint` for details. + + * The list of the types of the joints. + + + oimo.m.B.bu() + + + + + <_sd public="1"> + + hide + + <_lm public="1"> + + hide + + <_basis public="1"> + + hide + + + + + + + hide + + + + hide + + + + hide + + + + + + + + <_syncAnchors public="1" set="method" line="158" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="166" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="171" override="1"> + + + + + hide + + + + * Returns the first rigid body's constraint axis in world coordinates. + + + + * Returns the second rigid body's constraint axis in world coordinates. + + + + + + + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + + + + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + + + + + + + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the translational spring and damper settings. + + + + * Returns the translational limits and motor settings. + + + + * Returns the translation of the joint. + + + + + + + * Creates a new prismatic joint by configuration `config`. + + * A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to + * share their anchor points and constraint axes, and restricts relative + * translation onto the constraint axis. This joint provides one degree of + * freedom. You can enable lower and upper limits, a motor, a spring and + * damper effect of the translational part of the constraint. + oimo.m.B.bu() + + + + + + * The first body's local constraint axis. + + + + * The second body's local constraint axis. + + + + * The translational limit and motor along the constraint axis of the joint. + + + + * The translational spring and damper along the constraint axis of the joint. + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + + + + * Default constructor. + + * A prismatic joint config is used for constructions of prismatic joints. + + + + <_twistSd public="1"> + + hide + + <_swingSd public="1"> + + hide + + <_twistLm public="1"> + + hide + + <_maxSwingAngle1 public="1"> + + hide + + <_maxSwingAngle2 public="1"> + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + <_swingAngle public="1"> + + hide + + <_twistAngle public="1"> + + hide + + + + + + + + <_syncAnchors public="1" set="method" line="253" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="260" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="265" override="1"> + + + + + hide + + + + * Returns the first rigid body's constraint axis in world coordinates. + + + + * Returns the second rigid body's constraint axis in world coordinates. + + + + + + + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + + + + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + + + + + + + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the rotational spring and damper settings along the twist axis. + + + + * Returns the rotational limits and motor settings along the twist axis. + + + + * Returns the rotational spring and damper settings along the swing axis. + + + + * Returns the swing axis in world coordinates. + + + + + + + * Sets `axis` to the swing axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the swing angle in radians. + + + + * Returns the twist angle in radians. + + + + + + + * Creates a new ragdoll joint by configuration `config`. + + * A ragdoll joint is designed to simulate ragdoll's limbs. It constrains + * swing and twist angles between two rigid bodies. The two rigid bodies + * have constraint axes, and the swing angle is defined by the angle of + * two constraint axes, while the twist angle is defined by the rotation + * angle along the two axes. In addition to lower and upper limits of the + * twist angle, You can set an "elliptic cone limit" of the swing angle + * by specifying two swing axes (though one of them is automatically + * computed) and corresponding maximum swing angles. You can also enable a + * motor of the twist part of the constraint, spring and damper effect of + * the both swing and twist part of the constraint. + oimo.m.B.bu() + + + + + + * The first body's local twist axis. + + + + * The second body's local twist axis. + + + + * The first body's local swing axis. + * + * The second swing axis is also attached to the first body. It is perpendicular to the first swing + * axis, and is automatically computed when the joint is created. + + + + * The rotational spring and damper along the twist axis of the joint. + + + + * The rotational limit and motor along the twist axis of the joint. + + + + * The rotational spring and damper along the swing axis of the joint. + + + + * The max angle of rotation along the first swing axis. + * This value must be positive. + + + + * The max angle of rotation along the second swing axis. + * This value must be positive. + + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local twist axes + * from the world twist axis `worldTwistAxis`, local swing axis from the world swing axis + * `worldSwingAxis`, and returns `this`. + + + + * Default constructor. + + * A ragdoll joint config is used for constructions of ragdoll joints. + + + + <_sd public="1"> + + hide + + <_lm public="1"> + + hide + + <_basis public="1"> + + hide + + + + + + + hide + + + + hide + + + + hide + + + + + + + + <_syncAnchors public="1" set="method" line="164" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="172" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="177" override="1"> + + + + + hide + + + + * Returns the first rigid body's constraint axis in world coordinates. + + + + * Returns the second rigid body's constraint axis in world coordinates. + + + + + + + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + + + + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + + + + + + + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the rotational spring and damper settings. + + + + * Returns the rotational limits and motor settings. + + + + * Returns the rotation angle in radians. + + + + + + + * Creates a new revolute joint by configuration `config`. + + * A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share + * their anchor points and constraint axes, and restricts relative rotation onto + * the constraint axis. This joint provides one degree of freedom. You can enable + * lower and upper limits, a motor, a spring and damper effect of the rotational + * part of the constraint. + oimo.m.B.bu() + + + + + + * The first body's local constraint axis. + + + + * The second body's local constraint axis. + + + + * The rotational spring and damper settings. + + + + * The rotational limits and motor settings. + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + + + + * Default constructor. + + * A revolute joint config is used for constructions of revolute joints. + + + + + upperLimit`.]]> + + + + upperLimit`.]]> + + + + * The target speed of the motor in usually radians per second. + + + + + + + + + + + + * Sets limit properties at once and returns `this`. + * `this.lowerLimit` is set to `lower`, and `this.upperLimit` is set to `upper`. + + + + + + + + * Sets motor properties at once and returns `this`. + * `this.motorSpeed` is set to `speed`, and `this.motorTorque` is set to `torque`. + + + + * Returns a clone of the object. + + + + * Default constructor. + + * Rotational limits and motor settings of a joint. + + + + + <_sd public="1"> + + hide + + + + + + + + <_getVelocitySolverInfo public="1" set="method" line="100" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="105" override="1"> + + + + + hide + + + + * Returns the spring and damper settings. + + + + + + + * Creates a new spherical joint by configuration `config`. + + * A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share + * their anchor points. This joint provides three degrees of freedom. You can enable a + * spring and damper effect of the constraint. + oimo.m.B.bu() + + + + + + * The spring and damper setting of the joint. + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, and returns `this`. + + + + * Default constructor. + + * A spherical joint config is used for constructions of spherical joints. + + + + + * The frequency of the spring in Hz. + * Set `0.0` to disable the spring and make the constraint totally rigid. + + + + * The damping ratio of the constraint. + * Set `1.0` to make the constraint critically dumped. + + + + * Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. + * Note that symplectic Euler method conserves energy better than implicit Euler method does, but the constraint will be + * unstable under the high frequency. + + + + + + + + * Sets spring and damper parameters at once and returns `this`. + * `this.frequency` is set to `frequency`, and `this.dampingRatio` is set to `dampingRatio`. + + + + + + + + * Returns a clone of the object. + + + + * Default constructor. + + * Spring and damper settings of a joint. + + + + + + upperLimit`.]]> + + + + upperLimit`.]]> + + + + * The target speed of the motor in usually meters per second. + + + + + + + + + + + + * Sets limit properties at once and returns `this`. + * `this.lowerLimit` is set to `lower`, and `this.upperLimit` is set to `upper`. + + + + + + + + * Sets motor properties at once and returns `this`. + * `this.motorSpeed` is set to `speed`, and `this.motorForce` is set to `force`. + + + + * Returns a clone of the object. + + + + * Default constructor. + + * Translational limits and motor settings of a joint. + + + + + <_sd1 public="1"> + + hide + + <_sd2 public="1"> + + hide + + <_lm1 public="1"> + + hide + + <_lm2 public="1"> + + hide + + <_axisXX public="1"> + + hide + + <_axisXY public="1"> + + hide + + <_axisXZ public="1"> + + hide + + <_axisYX public="1"> + + hide + + <_axisYY public="1"> + + hide + + <_axisYZ public="1"> + + hide + + <_axisZX public="1"> + + hide + + <_axisZY public="1"> + + hide + + <_axisZZ public="1"> + + hide + + <_angleX public="1"> + + hide + + <_angleY public="1"> + + hide + + <_angleZ public="1"> + + hide + + + + + + + hide + + + + hide + + + + hide + + + + + + + + <_syncAnchors public="1" set="method" line="233" override="1"> + + hide + + <_getVelocitySolverInfo public="1" set="method" line="241" override="1"> + + + + + + hide + + <_getPositionSolverInfo public="1" set="method" line="246" override="1"> + + + + + hide + + + + * Returns the first rigid body's constraint axis in world coordinates. + + + + * Returns the second rigid body's constraint axis in world coordinates. + + + + + + + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + + + + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + + + + + + + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the rotational spring and damper settings along the first body's constraint axis. + + + + * Returns the rotational spring and damper settings along the second body's constraint axis. + + + + * Returns the rotational limits and motor settings along the first body's constraint axis. + + + + * Returns the rotational limits and motor settings along the second body's constraint axis. + + + + * Returns the rotation angle along the first body's constraint axis. + + + + * Returns the rotation angle along the second body's constraint axis. + + + + + + + * Creates a new universal joint by configuration `config`. + + * A universal joint constrains two rigid bodies' constraint axes to be perpendicular + * to each other. Rigid bodies can rotate along their constraint axes, but cannot along + * the direction perpendicular to two constraint axes. This joint provides two degrees + * of freedom. You can enable lower and upper limits, motors, spring and damper effects + * of the two rotational constraints. + oimo.m.B.bu() + + + + + + * The first body's local constraint axis. + + + + * The second body's local constraint axis. + + + + * The rotational spring and damper along the first body's constraint axis. + + + + * The rotational spring and damper along the second body's constraint axis. + + + + * The rotational limit and motor along the first body's constraint axis. + + + + * The rotational limit and motor along the second body's constraint axis. + + + + + + + + + + + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axes `worldAxis1` and `worldAxis2`, and returns `this`. + + + + * Default constructor. + + * A universal joint config is used for constructions of universal joints. + + + <_ITERATIVE public="1" get="inline" set="null" expr="0" line="10" static="1"> + + + 0 + hide + + + <_DIRECT public="1" get="inline" set="null" expr="1" line="11" static="1"> + + + 1 + hide + + + + + _ITERATIVE + * Iterative constraint solver. Fast and stable enough for common usages. + + + + _DIRECT + * Direct constraint solver. Very stable but not suitable for a situation where fast + * computation is required. + + * The list of the constraint solvers. + oimo.m.B.bu() + + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + + + + + * Internal class. + + + hide + oimo.m.B.bu() + + + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + hide + + + + + * Internal class. + + + hide + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * Internal class + + + hide + + + + + + + + + + + + + + * Internal class + + + hide + + + + + + + + + + + + + + + + + + + + + * Internal class. + + + hide + + + + + + + + + + + + + + + + + * Makes first n elements the permutation of {0, 1, ... , n-1} + + + + + + * Internal Class + + + hide + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hide + + * The direct solver of a mixed linear complementality problem (MLCP) for + * joint constraints. + + + oimo.m.B.bu() + + + + <_size public="1"> + + hide + + <_invMass public="1"> + + hide + + <_invMassWithoutCfm public="1"> + + hide + + <_massData public="1"> + + hide + + <_cachedSubmatrices public="1"> + + hide + + <_cacheComputed public="1"> + + hide + + <_maxSubmatrixId public="1"> + + hide + + + + + + + + + + + + + + + + + + * Internal class + + + hide + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hide + + * A contact constraint solver using projected Gauss-Seidel (sequential impulse). + + + oimo.m.B.bu() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hide + + * A joint constraint solver using projected Gauss-Seidel (sequential impulse). + + + oimo.m.B.bu() + + + + + + * Mass. `0` for a non-dynamic rigid body. + + + + * Inertia tensor in local space. Zero matrix for a non-dynamic rigid body. + + + + * Default constructor. + + * This class holds mass and moment of inertia for a rigid body. + + + + <_next public="1"> + + hide + + <_prev public="1"> + + hide + + <_shapeList public="1"> + + hide + + <_shapeListLast public="1"> + + hide + + <_numShapes public="1"> + + hide + + <_velX public="1"> + + hide + + <_velY public="1"> + + hide + + <_velZ public="1"> + + hide + + <_angVelX public="1"> + + hide + + <_angVelY public="1"> + + hide + + <_angVelZ public="1"> + + hide + + <_pseudoVelX public="1"> + + hide + + <_pseudoVelY public="1"> + + hide + + <_pseudoVelZ public="1"> + + hide + + <_angPseudoVelX public="1"> + + hide + + <_angPseudoVelY public="1"> + + hide + + <_angPseudoVelZ public="1"> + + hide + + <_ptransform public="1"> + + hide + + <_transform public="1"> + + hide + + <_type public="1"> + + hide + + <_sleepTime public="1"> + + hide + + <_sleeping public="1"> + + hide + + <_autoSleep public="1"> + + hide + + <_mass public="1"> + + hide + + <_invMass public="1"> + + hide + + <_localInertia00 public="1"> + + hide + + <_localInertia01 public="1"> + + hide + + <_localInertia02 public="1"> + + hide + + <_localInertia10 public="1"> + + hide + + <_localInertia11 public="1"> + + hide + + <_localInertia12 public="1"> + + hide + + <_localInertia20 public="1"> + + hide + + <_localInertia21 public="1"> + + hide + + <_localInertia22 public="1"> + + hide + + <_rotFactor public="1"> + + hide + + <_invLocalInertia00 public="1"> + + hide + + <_invLocalInertia01 public="1"> + + hide + + <_invLocalInertia02 public="1"> + + hide + + <_invLocalInertia10 public="1"> + + hide + + <_invLocalInertia11 public="1"> + + hide + + <_invLocalInertia12 public="1"> + + hide + + <_invLocalInertia20 public="1"> + + hide + + <_invLocalInertia21 public="1"> + + hide + + <_invLocalInertia22 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor00 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor01 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor02 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor10 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor11 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor12 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor20 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor21 public="1"> + + hide + + <_invLocalInertiaWithoutRotFactor22 public="1"> + + hide + + <_invInertia00 public="1"> + + hide + + <_invInertia01 public="1"> + + hide + + <_invInertia02 public="1"> + + hide + + <_invInertia10 public="1"> + + hide + + <_invInertia11 public="1"> + + hide + + <_invInertia12 public="1"> + + hide + + <_invInertia20 public="1"> + + hide + + <_invInertia21 public="1"> + + hide + + <_invInertia22 public="1"> + + hide + + <_linearDamping public="1"> + + hide + + <_angularDamping public="1"> + + hide + + <_forceX public="1"> + + hide + + <_forceY public="1"> + + hide + + <_forceZ public="1"> + + hide + + <_torqueX public="1"> + + hide + + <_torqueY public="1"> + + hide + + <_torqueZ public="1"> + + hide + + <_linearContactImpulseX public="1"> + + hide + + <_linearContactImpulseY public="1"> + + hide + + <_linearContactImpulseZ public="1"> + + hide + + <_angularContactImpulseX public="1"> + + hide + + <_angularContactImpulseY public="1"> + + hide + + <_angularContactImpulseZ public="1"> + + hide + + <_world public="1"> + + hide + + <_contactLinkList public="1"> + + hide + + <_contactLinkListLast public="1"> + + hide + + <_numContactLinks public="1"> + + hide + + <_jointLinkList public="1"> + + hide + + <_jointLinkListLast public="1"> + + hide + + <_numJointLinks public="1"> + + hide + + <_addedToIsland public="1"> + + hide + + <_gravityScale public="1"> + + hide + + + + * Extra field that users can use for their own purposes. + + <_integrate public="1" set="method" line="141"> + + + + + hide + + <_integratePseudoVelocity public="1" set="method" line="182"> + + hide + + + + + * Returns the world position of the rigid body. + + + + + + + * Sets `position` to the world position of the rigid body. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Sets the world position of the rigid body to `position`. + + + + + + + * Translates the position of the rigid body by `translation`. + + + + * Returns the rotation matrix of the rigid body. + + + + + + + * Sets `rotation` to the rotation matrix of the rigid body. + * + * This does not create a new instance of `Mat3`. + + + + + + + * Sets the rotation matrix of the rigid body to `rotation`. + + + + + + + * Sets the rotation of the rigid body by Euler angles `eulerAngles` in radians. + + + + + + + * Rotates the rigid body by the rotation matrix `rotation`. + + + + + + + * Rotates the rigid body by Euler angles `eulerAngles` in radians. + + + + * Returns the rotation of the rigid body as a quaternion. + + + + + + + * Sets `orientation` to the rotation quaternion of the rigid body. + * + * This does not create a new instance of `Quat`. + + + + + + + * Sets the rotation of the rigid body from a quaternion `quaternion`. + + + + * Returns the transform of the rigid body. + + + + + + + * Sets `transform` to the transform of the rigid body. + * + * This does not create a new instance of `Transform`. + + + + + + + * Sets the transform of the rigid body to `transform`. + * + * This does not keep any references to `transform`. + + + + * Returns the mass of the rigid body. + * + * If the rigid body has infinite mass, `0` will be returned. + + + + * Returns the moment of inertia tensor in local space. + + + + + + + * Sets `inertia` to the moment of inertia tensor in local space. + * + * This does not create a new instance of `Mat3` + + + + * Returns the mass data of the rigid body. + + + + + + + * Sets `massData` to the mass data of the rigid body. + * + * This does not create a new instance of `MassData`. + + + + + + + * Sets the mass and moment of inertia of the rigid body by the mass data `massData`. + * The properties set by this will be overwritten when + * + * - some shapes are added or removed + * - the type of the rigid body is changed + + + + * Returns the rotation factor of the rigid body. + + + + + + + * Sets the rotation factor of the rigid body to `rotationFactor`. + * + * This changes moment of inertia internally, so that the change of + * angular velocity in **global space** along X, Y and Z axis will scale by `rotationFactor.x`, + * `rotationFactor.y` and `rotationFactor.z` times respectively. + + + + * Returns the linear velocity of the rigid body. + + + + + + + * Sets `linearVelocity` to the linear velocity of the rigid body. + * + * This does not create a new intrance of `Vec3`. + + + + + + + * Sets the linear velocity of the rigid body. + + + + * Returns the angular velocity of the rigid body. + + + + + + + * Sets `angularVelocity` to the angular velocity of the rigid body. + * + * This does not create a new intrance of `Vec3`. + + + + + + + * Sets the angular velocity of the rigid body. + + + + + + + * Adds `linearVelocityChange` to the linear velcity of the rigid body. + + + + + + + * Adds `angularVelocityChange` to the angular velcity of the rigid body. + + + + + + + + * Applies the impulse `impulse` to the rigid body at `positionInWorld` in world position. + * + * This changes both the linear velocity and the angular velocity. + + + + + + + * Applies the linear impulse `impulse` to the rigid body. + * + * This does not change the angular velocity. + + + + + + + * Applies the angular impulse `impulse` to the rigid body. + * + * This does not change the linear velocity. + + + + + + + + * Applies the force `force` to `positionInWorld` in world position. + + + + + + + * Applies the force `force` to the center of mass. + + + + + + + * Applies the torque `torque`. + + + + * Returns the total linear impulse applied by contact constraints. + + + + + + + * Sets `linearContactImpulse` to the total linear impulse applied by contact constraints. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the total angular impulse applied by contact constraints. + + + + + + + * Sets `angularContactImpulse` to the total angular impulse applied by contact constraints. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the gravity scaling factor of the rigid body. + + + + + + + * Sets the gravity scaling factor of the rigid body to `gravityScale`. + * + * If `0` is set, the rigid body will not be affected by gravity. + + + + + + + * Returns the local coordinates of the point `worldPoint` in world coodinates. + + + + + + + + * Sets `localPoint` to the local coordinates of the point `worldPoint` in world coodinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Returns the local coordinates of the vector `worldVector` in world coodinates. + + + + + + + + * Sets `localVector` to the local coordinates of the vector `worldVector` in world coodinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Returns the world coordinates of the point `localPoint` in local coodinates. + + + + + + + + * Sets `worldPoint` to the world coordinates of the point `localPoint` in local coodinates. + * + * This does not create a new instance of `Vec3`. + + + + + + + * Returns the world coordinates of the vector `localVector` in local coodinates. + + + + + + + + * Sets `worldVector` to the world coordinates of the vector `localVector` in local coodinates. + * + * This does not create a new instance of `Vec3`. + + + + * Returns the number of the shapes added. + + + + * Returns the list of the shapes of the rigid body. + + + + * Returns the number of the contact lists the rigid body is involved. + + + + * Returns the list of the contact links the rigid body is involved. + + + + * Returns the number of the joint links the rigid body is attached. + + + + * Returns the list of the joint links the rigid body is attached. + + + + + + + * Adds the shape to the rigid body. + + + + + + + * Removes the shape from the rigid body. + + + + * Returns the rigid body's type of behaviour. + * + * See `RigidBodyType` class for details. + + + + + + + * Sets the rigid body's type of behaviour. + * + * See `RigidBodyType` class for details. + + + + * Sets the rigid body's sleep flag false. + * + * This also resets the sleeping timer of the rigid body. + + + + * Sets the rigid body's sleep flag true. + * + * This also resets the sleeping timer of the rigid body. + + + + * Returns whether the rigid body is sleeping. + + + + * Returns how long the rigid body is stopping moving. This returns `0` if the body + * has already slept. + + + + + + + * Sets the rigid body's auto sleep flag. + * + * If auto sleep is enabled, the rigid body will automatically sleep when needed. + + + + * Returns the linear damping. + + + + + + + * Sets the linear damping to `damping`. + + + + * Returns the angular damping. + + + + + + + * Sets the angular damping to `damping`. + + + + * Returns the previous rigid body in the world. + * + * If the previous one does not exist, `null` will be returned. + + + + * Returns the next rigid body in the world. + * + * If the next one does not exist, `null` will be returned. + + + + + + + * Creates a new rigid body by configuration `config`. + + * A rigid body. To add a rigid body to a physics world, create a `RigidBody` + * instance, create and add shapes via `RigidBody.addShape`, and add the rigid + * body to the physics world through `World.addRigidBody`. Rigid bodies have + * three motion types: dynamic, static, and kinematic. See `RigidBodyType` for + * details of motion types. + oimo.m.B.bu() + + + + + * The world position of the rigid body's center of gravity. + + + + * The rotation matrix of the rigid body. + + + + * The initial value of the rigid body's linear velocity. + + + + * The initial value of the rigid body's angular velocity. + + + + * The rigid body's motion type. See `RigidBodyType` for details. + + + + * Whether to automatically sleep the rigid body when it stops moving + * for a certain period of time, namely `Setting.sleepingTimeThreshold`. + + + + * The damping coefficient of the linear velocity. Set positive values to + * gradually reduce the linear velocity. + + + + * The damping coefficient of the angular velocity. Set positive values to + * gradually reduce the angular velocity. + + + + * Default constructor. + + * A rigid body configuration is used for constructions of rigid bodies. An instance of this + * class can safely be reused, as a rigid body will not have any references to a field of + * this class. + + + <_DYNAMIC public="1" get="inline" set="null" expr="0" line="8" static="1"> + + + 0 + hide + + + <_STATIC public="1" get="inline" set="null" expr="1" line="9" static="1"> + + + 1 + hide + + + <_KINEMATIC public="1" get="inline" set="null" expr="2" line="10" static="1"> + + + 2 + hide + + + + + _DYNAMIC + * Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia + * tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved. + + + + _STATIC + * Represents a static rigid body. A static rigid body has zero velocities and infinite mass + * and inertia tensor. The rigid body is not affected by any force or impulse, such as gravity, + * constraints, or external forces or impulses added by an user. + + + + _KINEMATIC + * Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except + * that it can have non-zero linear and angular velocities. This is useful for overlapping rigid + * bodies to pre-computed motions. + + * The list of a rigid body's motion types. + oimo.m.B.bu() + + + <_id public="1"> + + hide + + <_prev public="1"> + + hide + + <_next public="1"> + + hide + + <_rigidBody public="1"> + + hide + + <_geom public="1"> + + hide + + <_localTransform public="1"> + + hide + + <_ptransform public="1"> + + hide + + <_transform public="1"> + + hide + + <_restitution public="1"> + + hide + + <_friction public="1"> + + hide + + <_density public="1"> + + hide + + <_aabb public="1"> + + hide + + <_proxy public="1"> + + hide + + <_collisionGroup public="1"> + + hide + + <_collisionMask public="1"> + + hide + + <_contactCallback public="1"> + + hide + + + + + * Extra field that users can use for their own purposes. + + + + * Returns the coefficient of friction. + + + + + + + * Sets the coefficient of friction to `friction`. + + + + * Returns the coefficient of restitution. + + + + + + + * Sets the coefficient of restitution to `restitution`. + + + + * Returns the transform of the shape relative to the parent rigid body's transform. + + + + + + + * Sets `transform` to the transform of the shape relative to the parent rigid body's + * transform. + * + * This does not create a new instance of `Transform`. + + + + * Returns the world transform of the shape. + + + + + + + * Sets `transform` to the world transform of the shape. + * + * This does not create a new instance of `Transform`. + + + + + + + * Sets the shape's transform to `transform` relative to the parent rigid body's transform. + * + * This affects the parent rigid body's mass data. + + + + * Returns the density of the shape. + + + + + + + * Sets the density of the shape to `density`. + * + * This affects the parent rigid body's mass data. + + + + * Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a + * parent rigid body. + + + + + + + * Sets `aabb` to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a + * parent rigid body. + * + * This does not create a new instance of `AABB`. + + + + * Returns the colision geometry of the shape. + + + + * Returns the parent rigid body. This returns `null` if the shape doesn't have a parent + * rigid body. + + + + * Returns the collision group bits the shape belongs to. + + + + + + + * Sets the shape's collision group bits to `collisionGroup`. + + + + * Returns the collision mask bits of the shape. + + + + + + + * Sets the shape's collision mask bits to `collisionMask`. + + + + * Returns the contact callback of the shape. + + + + + + + * Sets the contact callback of the shape to `callback`. + + + + * Returns the previous shape in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + + + + * Returns the next shape in the rigid body. + * + * If the next one does not exist, `null` will be returned. + + + + + + + * Creates a new shape by configuration `config`. + + * A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body + * with some physical properties such as coefficients of friction and restitution. The collision + * geometry can locally be transformed relative to the parent rigid body's center of gravity. + oimo.m.B.bu() + + + + + * The shape's local position relative to the parent rigid body's origin. + + + + * The shape's local rotation matrix relative to the parent rigid body's + * rotation. + + + + * The coefficient of friction of the shape. + + + + * The coefficient of restitution of the shape. + + + + * The density of the shape, usually in Kg/m^3. + + + + * The collision geometry of the shape. + + + + + + + + + + + + * The contact callback of the shape. The callback methods are called + * when contact events the shape is involved occurred. + + + + * Default constructor. + + * A shape configuration is used for construction of shapes. An instance of + * this class can safely be reused as a shape will not have any references + * of a field of this class. + + + + + * Expression Macro + + + Use `sys.io.File.read` to create a `FileInput`. + + + + + + + + Use `sys.io.File.write` to create a `FileOutput`. + + + + + + + + + +
\ No newline at end of file diff --git a/docs/extra-styles.css b/docs/extra-styles.css new file mode 100644 index 0000000..1376552 --- /dev/null +++ b/docs/extra-styles.css @@ -0,0 +1 @@ +/** to be overridden in sub-themes */ \ No newline at end of file diff --git a/docs/highlighter.css b/docs/highlighter.css index 12e9fe7..4ff7fc4 100644 --- a/docs/highlighter.css +++ b/docs/highlighter.css @@ -1,40 +1,46 @@ - /** - Code Highlighting + Code Highlighting **/ - html pre, html pre code { - font-family: consolas, monospace; - white-space: pre; - overflow-x: auto; + font-family: consolas, monospace; + white-space: pre; + overflow-x: auto; +} +code { + color: #333; +} +code a { + color: #08c; } pre { - color: #333; - margin: 15px 0; + color: #333; + margin: 15px 0; padding: 0.5em; } pre .type { - color: #0086b3; + color: #0086b3; } pre .kwd { - color: #00a; + color: #00a; } pre .val { - color: #44a; + color: #44a; } pre .str, div.pre .str, pre .str .kwd, pre .str .val, pre .str .type { - color: #a00; + color: #a00; } pre .cmt { - color: #008800; + color: #008800; color: #998; font-style: italic; } /* Make sure keywords inside comments are not highlighted*/ pre .cmt .kwd, pre .cmt .str, pre .cmt .val, pre .cmt .type { - color: #998; + color: #998; } - .last-modified { color:#999; -} \ No newline at end of file +} +.semantic { + display:none; +} diff --git a/docs/highlighter.js b/docs/highlighter.js index b40bb63..49b6349 100644 --- a/docs/highlighter.js +++ b/docs/highlighter.js @@ -1,4 +1,4 @@ -// highlighter adapted from code.haxe.org +// highlighter adapted/modified from code.haxe.org (function (console) { "use strict"; var EReg = function(r,opt) { opt = opt.split("u").join(""); @@ -11,13 +11,19 @@ EReg.prototype = { }; var Highlighter = function() { }; Highlighter.main = function() { - js.JQuery("pre code").each(function() { - var el = js.JQuery(this); - if(!el.hasClass("highlighted")) { - el.html(Highlighter.syntaxHighlight(el.html())); - el.addClass("highlighted"); + var _g = 0; + var _g1 = window.document.body.querySelectorAll("pre code"); + while(_g < _g1.length) { + var el = _g1[_g]; + ++_g; + if(!Highlighter.hasClass(el,"highlighted")) { + el.innerHTML = Highlighter.syntaxHighlight(el.innerHTML); + el.className += " highlighted"; } - }); + } +}; +Highlighter.hasClass = function(el,className) { + return el.className.indexOf(className) != -1; }; Highlighter.syntaxHighlight = function(html) { var kwds = ["abstract","trace","break","case","cast","class","continue","default","do","dynamic","else","enum","extends","extern","for","function","if","implements","import","in","inline","interface","macro","new","override","package","private","public","return","static","switch","throw","try","typedef","untyped","using","var","while"]; @@ -29,12 +35,9 @@ Highlighter.syntaxHighlight = function(html) { html = vals1.replace(html,"$1"); html = types.replace(html,"$1"); html = new EReg("(\"[^\"]*\")","g").replace(html,"$1"); - html = new EReg("(//.+\n)","g").replace(html,"$1"); - html = new EReg("(/\\*\\*?[^*]*\\*?\\*/)","g").replace(html,"$1"); + html = new EReg("(//.+?)(\n|$)","g").replace(html,"$1$2"); + html = new EReg("(/\\*\\*?(.|\n)+?\\*?\\*/)","g").replace(html,"$1"); return html; }; -var q = window.jQuery; -var js = js || {} -js.JQuery = q; Highlighter.main(); -})(typeof console != "undefined" ? console : {log:function(){}}); \ No newline at end of file +})(typeof console != "undefined" ? console : {log:function(){}}); diff --git a/docs/index.html b/docs/index.html index 0faff28..db9a0b5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,9 +1,9 @@ -top level - OimoPhysics API documentation

top level version 1.2.0

OimoPhysics API Documentation

oimo
\ No newline at end of file +

top level version 1.2.1

OimoPhysics API Documentation

oimo
\ No newline at end of file diff --git a/docs/index.js b/docs/index.js index efff5aa..c25114a 100644 --- a/docs/index.js +++ b/docs/index.js @@ -108,13 +108,9 @@ $(document).ready(function(){ setPlatform(readCookie("platform") == null ? "all" : readCookie("platform")); //setVersion(readCookie("version") == null ? "3_0" : readCookie("version")); - $("#search").focus(); $("#search").on("input", function(e){ searchQuery(e.target.value); }); - $(window).keypress(function(e){ - $("#search").focus(); - }) $("#select-platform").selectpicker().on("change", function(e){ var value = $(":selected", this).val(); @@ -235,3 +231,21 @@ function searchMatch(text, queryParts) { } return scoreSum; } + +function errorSearch() { + var errorURL = ""; + if(!!window.location.pathname) { + errorURL = window.location.pathname; + }else if(!!window.location.href) { + errorURL = window.location.href; + } + if(!!errorURL) { + var searchTerm = errorURL.split("/").pop(); + if(searchTerm.indexOf(".html") > -1) { searchTerm = searchTerm.split(".html").join(""); } + if(!!searchTerm) { + // update filter with search term + $("#search").val(searchTerm); + searchQuery(searchTerm); + } + } +} \ No newline at end of file diff --git a/docs/nav.js b/docs/nav.js index bd18623..d37b90d 100644 --- a/docs/nav.js +++ b/docs/nav.js @@ -1 +1 @@ -var navContent=''; \ No newline at end of file +var navContent=''; \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhase.html b/docs/oimo/collision/broadphase/BroadPhase.html index 08df006..660d5af 100644 --- a/docs/oimo/collision/broadphase/BroadPhase.html +++ b/docs/oimo/collision/broadphase/BroadPhase.html @@ -1,22 +1,22 @@ -oimo.collision.broadphase.BroadPhase - OimoPhysics API documentation

The abstract class of a broad-phase collision detection algorithm.

Methods

aabbTest (aabb:Aabb, callback:BroadPhaseProxyCallback):Void

Performs an AABB query. callback.process is called for all proxies that their AABB -and aabb intersect.

collectPairs ():Void

Collects overlapping pairs of the proxies and put them into a linked list. The linked list +

The abstract class of a broad-phase collision detection algorithm.

Methods

aabbTest (aabb:Aabb, callback:BroadPhaseProxyCallback):Void

Performs an AABB query. callback.process is called for all proxies that their AABB +and aabb intersect.

collectPairs ():Void

Collects overlapping pairs of the proxies and put them into a linked list. The linked list can be get through BroadPhase.getProxyPairList method.

Note that in order to collect pairs, the broad-phase algorithm requires to be informed of -movements of proxies through BroadPhase.moveProxy method.

convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:BroadPhaseProxyCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry +movements of proxies through BroadPhase.moveProxy method.

convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:BroadPhaseProxyCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning -transform begin.

createProxy (userData:Any, aabb:Aabb):Proxy

Returns a new proxy connected with the user data userData containing the axis-aligned -bounding box aabb, and adds the proxy into the collision space.

destroyProxy (proxy:Proxy):Void

Removes the proxy proxy from the collision space.

inline getProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inline getTestCount ():Int

Returns the number of broad-phase AABB tests.

inline isIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns +transform begin.

createProxy (userData:Any, aabb:Aabb):Proxy

Returns a new proxy connected with the user data userData containing the axis-aligned +bounding box aabb, and adds the proxy into the collision space.

destroyProxy (proxy:Proxy):Void

Removes the proxy proxy from the collision space.

inlinegetProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inlinegetTestCount ():Int

Returns the number of broad-phase AABB tests.

inlineisIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

inline isOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

moveProxy (proxy:Proxy, aabb:Aabb, displacement:Vec3):Void

Moves the proxy proxy to the axis-aligned bounding box aabb. displacement is the +pairs are guaranteed to be separated.

inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

moveProxy (proxy:Proxy, aabb:Aabb, displacement:Vec3):Void

Moves the proxy proxy to the axis-aligned bounding box aabb. displacement is the difference between current and previous center of the AABB. This is used for predicting -movement of the proxy.

rayCast (begin:Vec3, end:Vec3, callback:BroadPhaseProxyCallback):Void

Performs a ray casting. callback.process is called for all proxies the line segment -from begin to end intersects.

\ No newline at end of file +movement of the proxy.

rayCast (begin:Vec3, end:Vec3, callback:BroadPhaseProxyCallback):Void

Performs a ray casting. callback.process is called for all proxies the line segment +from begin to end intersects.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html index 6e433c8..cadf449 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html +++ b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html @@ -1,9 +1,9 @@ -oimo.collision.broadphase.BroadPhaseProxyCallback - OimoPhysics API documentation

A callback class for queries in a broad phase.

Constructor

new ()

Default constructor.

Methods

process (proxy:Proxy):Void

This is called every time a broad phase algorithm reports a proxy proxy.

\ No newline at end of file +

A callback class for queries in a broad phase.

Constructor

new ()

Default constructor.

Methods

process (proxy:Proxy):Void

This is called every time a broad phase algorithm reports a proxy proxy.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseType.html b/docs/oimo/collision/broadphase/BroadPhaseType.html index bac8b99..ffc7452 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseType.html +++ b/docs/oimo/collision/broadphase/BroadPhaseType.html @@ -1,10 +1,10 @@ -oimo.collision.broadphase.BroadPhaseType - OimoPhysics API documentation

Types of broad-phase algorithms.

Static variables

staticread onlyBRUTE_FORCE:Int

The brute force algorithm searches all the possible pairs of the proxies every time. -This is very slow and so users should not choose this algorithm without exceptional reasons.

staticread onlyBVH:Int

The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

\ No newline at end of file +

Types of broad-phase algorithms.

Static variables

@:value(_BRUTE_FORCE)staticread onlyBRUTE_FORCE:Int = _BRUTE_FORCE

The brute force algorithm searches all the possible pairs of the proxies every time. +This is very slow and so users should not choose this algorithm without exceptional reasons.

@:value(_BVH)staticread onlyBVH:Int = _BVH

The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/Proxy.html b/docs/oimo/collision/broadphase/Proxy.html index 6d5abac..c5c9e45 100644 --- a/docs/oimo/collision/broadphase/Proxy.html +++ b/docs/oimo/collision/broadphase/Proxy.html @@ -1,16 +1,16 @@ -oimo.collision.broadphase.Proxy - OimoPhysics API documentationoimo.collision.broadphase.Proxy - OimoPhysics API documentation

A proxy is an object that can be added to a broad-phase collision detection algorithm. +

A proxy is an object that can be added to a broad-phase collision detection algorithm. Users of the collision part of the library can move an axis-aligned bounding box of -a proxy through BroadPhase class.

Variables

userData:Any

Extra field that users can use for their own purposes. Do not modify this property if +a proxy through BroadPhase class.

Variables

userData:Any

Extra field that users can use for their own purposes. Do not modify this property if you use the physics part of the library, as the physics part of the library uses this property -for connecting proxies and shapes of rigid bodies.

Methods

getFatAabb ():Aabb

Returns the fat AABB of the proxy.

getFatAabbTo (aabb:Aabb):Void

Sets aabb to the fat AABB of the proxy.

-

This does not create a new instance of Aabb.

getId ():Int

Returns the unique id of the proxy.

\ No newline at end of file +for connecting proxies and shapes of rigid bodies.

Methods

getFatAabb ():Aabb

Returns the fat AABB of the proxy.

getFatAabbTo (aabb:Aabb):Void

Sets aabb to the fat AABB of the proxy.

+

This does not create a new instance of Aabb.

getId ():Int

Returns the unique id of the proxy.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/ProxyPair.html b/docs/oimo/collision/broadphase/ProxyPair.html index 8c08114..f0b8677 100644 --- a/docs/oimo/collision/broadphase/ProxyPair.html +++ b/docs/oimo/collision/broadphase/ProxyPair.html @@ -1,11 +1,11 @@ -oimo.collision.broadphase.ProxyPair - OimoPhysics API documentationoimo.collision.broadphase.ProxyPair - OimoPhysics API documentation

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

Methods

getNext ():ProxyPair

Returns the next pair.

getProxy1 ():Proxy

Returns the first proxy of the pair.

getProxy2 ():Proxy

Returns the second proxy of the pair.

\ No newline at end of file +

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies +as linked list of ProxyPair.

Methods

getNext ():ProxyPair

Returns the next pair.

getProxy1 ():Proxy

Returns the first proxy of the pair.

getProxy2 ():Proxy

Returns the second proxy of the pair.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html index cf9d018..f49b43a 100644 --- a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html +++ b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html @@ -1,12 +1,12 @@ -oimo.collision.broadphase.bruteforce.BruteForceBroadPhase - OimoPhysics API documentation

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

Methods

Inherited Variables

Inherited Methods

Defined by BroadPhase

inline getProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inline getTestCount ():Int

Returns the number of broad-phase AABB tests.

inline isIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns +

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

Methods

Inherited Variables

Inherited Methods

Defined by BroadPhase

inlinegetProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inlinegetTestCount ():Int

Returns the number of broad-phase AABB tests.

inlineisIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

inline isOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file +pairs are guaranteed to be separated.

inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/index.html b/docs/oimo/collision/broadphase/bruteforce/index.html index 6932d6c..704c686 100644 --- a/docs/oimo/collision/broadphase/bruteforce/index.html +++ b/docs/oimo/collision/broadphase/bruteforce/index.html @@ -1,9 +1,9 @@ -oimo.collision.broadphase.bruteforce - OimoPhysics API documentation

oimo.collision.broadphase.bruteforce

OimoPhysics API Documentation

..
BruteForceBroadPhase

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

\ No newline at end of file +

oimo.collision.broadphase.bruteforce

OimoPhysics API Documentation

..
BruteForceBroadPhase

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html index 36927ab..a6ddee9 100644 --- a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html +++ b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html @@ -1,14 +1,14 @@ -oimo.collision.broadphase.bvh.BvhBroadPhase - OimoPhysics API documentationoimo.collision.broadphase.bvh.BvhBroadPhase - OimoPhysics API documentation

The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). -Average time complexity is O(NlogN) or lower.

Methods

inline getTreeBalance ():Int

Returns the balance of the bounding volume tree.

Inherited Variables

Inherited Methods

Defined by BroadPhase

inline getProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inline getTestCount ():Int

Returns the number of broad-phase AABB tests.

inline isIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns +

The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). +Average time complexity is O(NlogN) or lower.

Methods

inlinegetTreeBalance ():Int

Returns the balance of the bounding volume tree.

Inherited Variables

Inherited Methods

Defined by BroadPhase

inlinegetProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inlinegetTestCount ():Int

Returns the number of broad-phase AABB tests.

inlineisIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

inline isOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file +pairs are guaranteed to be separated.

inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/index.html b/docs/oimo/collision/broadphase/bvh/index.html index 825f707..231069a 100644 --- a/docs/oimo/collision/broadphase/bvh/index.html +++ b/docs/oimo/collision/broadphase/bvh/index.html @@ -1,10 +1,10 @@ -oimo.collision.broadphase.bvh - OimoPhysics API documentation

oimo.collision.broadphase.bvh

OimoPhysics API Documentation

..
BvhBroadPhase

The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). -Average time complexity is O(NlogN) or lower.

\ No newline at end of file +

oimo.collision.broadphase.bvh

OimoPhysics API Documentation

..
BvhBroadPhase

The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). +Average time complexity is O(NlogN) or lower.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/index.html b/docs/oimo/collision/broadphase/index.html index 7f539e5..e7b001d 100644 --- a/docs/oimo/collision/broadphase/index.html +++ b/docs/oimo/collision/broadphase/index.html @@ -1,12 +1,12 @@ -oimo.collision.broadphase - OimoPhysics API documentation

oimo.collision.broadphase

OimoPhysics API Documentation

..
bruteforce
bvh
BroadPhase

The abstract class of a broad-phase collision detection algorithm.

BroadPhaseProxyCallback

A callback class for queries in a broad phase.

BroadPhaseType

Types of broad-phase algorithms.

Proxy

A proxy is an object that can be added to a broad-phase collision detection algorithm. +

oimo.collision.broadphase

OimoPhysics API Documentation

..
bruteforce
bvh
BroadPhase

The abstract class of a broad-phase collision detection algorithm.

BroadPhaseProxyCallback

A callback class for queries in a broad phase.

BroadPhaseType

Types of broad-phase algorithms.

Proxy

A proxy is an object that can be added to a broad-phase collision detection algorithm. Users of the collision part of the library can move an axis-aligned bounding box of -a proxy through BroadPhase class.

ProxyPair

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

\ No newline at end of file +a proxy through BroadPhase class.

ProxyPair

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies +as linked list of ProxyPair.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/Aabb.html b/docs/oimo/collision/geometry/Aabb.html index 35d62d2..33b171f 100644 --- a/docs/oimo/collision/geometry/Aabb.html +++ b/docs/oimo/collision/geometry/Aabb.html @@ -1,15 +1,15 @@ -oimo.collision.geometry.Aabb - OimoPhysics API documentation

The axis-aligned bounding box.

Constructor

new ()

Creates an empty AABB. Minimum and maximum points are set to zero.

Methods

clone ():Aabb

Returns a clone of the AABB.

inline combine (other:Aabb):Aabb

Combines other into this AABB and returns this.

inline combined (other:Aabb):Aabb

Returns the combined aabb of this and other.

copyFrom (aabb:Aabb):Aabb

Copies AABB from aabb to and returns this.

inline getCenter ():Vec3

Returns the center of the AABB.

inline getCenterTo (center:Vec3):Void

Sets center to the center of the AABB.

-

This does not create a new instance of Vec3.

inline getExtents ():Vec3

Returns the half extents of the AABB.

inline getExtentsTo (halfExtents:Vec3):Void

Sets halfExtents to the half extents of the AABB.

-

This does not create a new instance of Vec3.

inline getIntersection (other:Aabb):Aabb

Returns the intersection of this and other.

inline getIntersectionTo (other:Aabb, intersection:Aabb):Void

Sets intersection to the intersection of this and other.

-

This does not create a new instance of Aabb.

inline getMax ():Vec3

Returns the maximum point of the axis-aligned bounding box.

inline getMaxTo (max:Vec3):Void

Sets the maximum point of the axis-aligned bounding box to max.

-

This does not create a new instance of Vec3.

inline getMin ():Vec3

Returns the minimum point of the axis-aligned bounding box.

inline getMinTo (min:Vec3):Void

Sets the minimum point of the axis-aligned bounding box to min.

-

This does not create a new instance of Vec3.

inline init (min:Vec3, max:Vec3):Aabb

Sets the minimum and maximum point and returns this.

-

Equivallent to setMin(min).setMax(max).

inline overlap (other:Aabb):Bool

Returns whether this and other intersect.

inline setMax (max:Vec3):Aabb

Sets the maximum point of the axis-aligned bounding box to max and returns this.

inline setMin (min:Vec3):Aabb

Sets the minimum point of the axis-aligned bounding box to min and returns this.

\ No newline at end of file +

The axis-aligned bounding box.

Constructor

new ()

Creates an empty AABB. Minimum and maximum points are set to zero.

Methods

clone ():Aabb

Returns a clone of the AABB.

inlinecombine (other:Aabb):Aabb

Combines other into this AABB and returns this.

inlinecombined (other:Aabb):Aabb

Returns the combined aabb of this and other.

copyFrom (aabb:Aabb):Aabb

Copies AABB from aabb to and returns this.

inlinegetCenter ():Vec3

Returns the center of the AABB.

inlinegetCenterTo (center:Vec3):Void

Sets center to the center of the AABB.

+

This does not create a new instance of Vec3.

inlinegetExtents ():Vec3

Returns the half extents of the AABB.

inlinegetExtentsTo (halfExtents:Vec3):Void

Sets halfExtents to the half extents of the AABB.

+

This does not create a new instance of Vec3.

inlinegetIntersection (other:Aabb):Aabb

Returns the intersection of this and other.

inlinegetIntersectionTo (other:Aabb, intersection:Aabb):Void

Sets intersection to the intersection of this and other.

+

This does not create a new instance of Aabb.

inlinegetMax ():Vec3

Returns the maximum point of the axis-aligned bounding box.

inlinegetMaxTo (max:Vec3):Void

Sets the maximum point of the axis-aligned bounding box to max.

+

This does not create a new instance of Vec3.

inlinegetMin ():Vec3

Returns the minimum point of the axis-aligned bounding box.

inlinegetMinTo (min:Vec3):Void

Sets the minimum point of the axis-aligned bounding box to min.

+

This does not create a new instance of Vec3.

inlineinit (min:Vec3, max:Vec3):Aabb

Sets the minimum and maximum point and returns this.

+

Equivallent to setMin(min).setMax(max).

inlineoverlap (other:Aabb):Bool

Returns whether this and other intersect.

inlinesetMax (max:Vec3):Aabb

Sets the maximum point of the axis-aligned bounding box to max and returns this.

inlinesetMin (min:Vec3):Aabb

Sets the minimum point of the axis-aligned bounding box to min and returns this.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/BoxGeometry.html b/docs/oimo/collision/geometry/BoxGeometry.html index e2d6289..b719fc0 100644 --- a/docs/oimo/collision/geometry/BoxGeometry.html +++ b/docs/oimo/collision/geometry/BoxGeometry.html @@ -1,10 +1,10 @@ -oimo.collision.geometry.BoxGeometry - OimoPhysics API documentation

A box collision geometry.

Constructor

new (halfExtents:Vec3)

Creates a box collision geometry of half-extents halfExtents.

Methods

inline getHalfExtents ():Vec3

Returns the half-extents of the box.

inline getHalfExtentsTo (halfExtents:Vec3):Void

Sets halfExtents to the half-extents of the box.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A box collision geometry.

Constructor

new (halfExtents:Vec3)

Creates a box collision geometry of half-extents halfExtents.

Methods

inlinegetHalfExtents ():Vec3

Returns the half-extents of the box.

inlinegetHalfExtentsTo (halfExtents:Vec3):Void

Sets halfExtents to the half-extents of the box.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/CapsuleGeometry.html b/docs/oimo/collision/geometry/CapsuleGeometry.html index e59df01..406dfae 100644 --- a/docs/oimo/collision/geometry/CapsuleGeometry.html +++ b/docs/oimo/collision/geometry/CapsuleGeometry.html @@ -1,10 +1,10 @@ -oimo.collision.geometry.CapsuleGeometry - OimoPhysics API documentation

A capsule collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a capsule collision geometry of radius radius and half-height halfHeight.

Methods

inline getHalfHeight ():Float

Returns the half-height of the capsule.

inline getRadius ():Float

Returns the radius of the capsule.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A capsule collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a capsule collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the capsule.

inlinegetRadius ():Float

Returns the radius of the capsule.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConeGeometry.html b/docs/oimo/collision/geometry/ConeGeometry.html index 4ef4d0d..30799bc 100644 --- a/docs/oimo/collision/geometry/ConeGeometry.html +++ b/docs/oimo/collision/geometry/ConeGeometry.html @@ -1,10 +1,10 @@ -oimo.collision.geometry.ConeGeometry - OimoPhysics API documentation

A cone collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cone collision geometry of radius radius and half-height halfHeight.

Methods

inline getHalfHeight ():Float

Returns the half-height of the cone.

inline getRadius ():Float

Returns the radius of the cone.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A cone collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cone collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the cone.

inlinegetRadius ():Float

Returns the radius of the cone.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexGeometry.html b/docs/oimo/collision/geometry/ConvexGeometry.html index 05986dd..338908c 100644 --- a/docs/oimo/collision/geometry/ConvexGeometry.html +++ b/docs/oimo/collision/geometry/ConvexGeometry.html @@ -1,12 +1,12 @@ -oimo.collision.geometry.ConvexGeometry - OimoPhysics API documentation

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

Methods

computeLocalSupportingVertex (dir:Vec3, out:Vec3):Void

Computes supporting vertex of the "core" of the geometry in local coordinates. +

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

Methods

computeLocalSupportingVertex (dir:Vec3, out:Vec3):Void

Computes supporting vertex of the "core" of the geometry in local coordinates. Note that the direction vector dir might not be normalized. out is set to -the computed supporting vertex.

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Inherited Variables

Inherited Methods

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +the computed supporting vertex.

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Inherited Variables

Inherited Methods

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexHullGeometry.html b/docs/oimo/collision/geometry/ConvexHullGeometry.html index ee2af3b..b4524a1 100644 --- a/docs/oimo/collision/geometry/ConvexHullGeometry.html +++ b/docs/oimo/collision/geometry/ConvexHullGeometry.html @@ -1,12 +1,12 @@ -oimo.collision.geometry.ConvexHullGeometry - OimoPhysics API documentationoimo.collision.geometry.ConvexHullGeometry - OimoPhysics API documentation

A convex hull collision geometry. A convex hull of the vertices is the smallest convex -polyhedron which contains all vertices.

Constructor

new (vertices:Array<Vec3>)

Creates a convex hull collision geometry of the vertices vertices.

Methods

inline getVertices ():Vector<Vec3>

Returns the vertices of the convex hull.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A convex hull collision geometry. A convex hull of the vertices is the smallest convex +polyhedron which contains all vertices.

Constructor

new (vertices:Array<Vec3>)

Creates a convex hull collision geometry of the vertices vertices.

Methods

inlinegetVertices ():Vector<Vec3>

Returns the vertices of the convex hull.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/CylinderGeometry.html b/docs/oimo/collision/geometry/CylinderGeometry.html index 538595f..358f6de 100644 --- a/docs/oimo/collision/geometry/CylinderGeometry.html +++ b/docs/oimo/collision/geometry/CylinderGeometry.html @@ -1,10 +1,10 @@ -oimo.collision.geometry.CylinderGeometry - OimoPhysics API documentation

A cylinder collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cylinder collision geometry of radius radius and half-height halfHeight.

Methods

inline getHalfHeight ():Float

Returns the half-height of the cylinder.

inline getRadius ():Float

Returns the radius of the cylinder.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A cylinder collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cylinder collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the cylinder.

inlinegetRadius ():Float

Returns the radius of the cylinder.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/Geometry.html b/docs/oimo/collision/geometry/Geometry.html index 0530d35..3d5eea4 100644 --- a/docs/oimo/collision/geometry/Geometry.html +++ b/docs/oimo/collision/geometry/Geometry.html @@ -1,12 +1,12 @@ -oimo.collision.geometry.Geometry - OimoPhysics API documentation

Abstract collision geometry.

Methods

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

rayCast (begin:Vec3, end:Vec3, transform:Transform, hit:RayCastHit):Bool

Performs ray casting. Returns true and sets the result information to hit if +

Abstract collision geometry.

Methods

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

rayCast (begin:Vec3, end:Vec3, transform:Transform, hit:RayCastHit):Bool

Performs ray casting. Returns true and sets the result information to hit if the line segment from begin to end and the geometry transformed by transform -intersect. Returns false if the line segment and the geometry do not intersect.

\ No newline at end of file +intersect. Returns false if the line segment and the geometry do not intersect.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/GeometryType.html b/docs/oimo/collision/geometry/GeometryType.html index 721f043..1f62238 100644 --- a/docs/oimo/collision/geometry/GeometryType.html +++ b/docs/oimo/collision/geometry/GeometryType.html @@ -1,15 +1,15 @@ -oimo.collision.geometry.GeometryType - OimoPhysics API documentation

The list of collision geometry types.

Static variables

staticread onlyBOX:Int

Represents a box collision geometry.

-

See BoxGeometry.

staticread onlyCAPSULE:Int

Represents a capsule collision geometry.

-

See CapsuleGeometry.

staticread onlyCONE:Int

Represents a cone collision geometry.

-

See ConeGeometry.

staticread onlyCONVEX_HULL:Int

Represents a convex hull collision geometry.

-

See ConvexHullGeometry.

staticread onlyCYLINDER:Int

Represents a cylinder collision geometry.

-

See CylinderGeometry.

staticread onlySPHERE:Int

Represents a sphere collision geometry.

-

See SphereGeometry.

\ No newline at end of file +

The list of collision geometry types.

Static variables

@:value(_BOX)staticread onlyBOX:Int = _BOX

Represents a box collision geometry.

+

See BoxGeometry.

@:value(_CAPSULE)staticread onlyCAPSULE:Int = _CAPSULE

Represents a capsule collision geometry.

+

See CapsuleGeometry.

@:value(_CONE)staticread onlyCONE:Int = _CONE

Represents a cone collision geometry.

+

See ConeGeometry.

@:value(_CONVEX_HULL)staticread onlyCONVEX_HULL:Int = _CONVEX_HULL

Represents a convex hull collision geometry.

+

See ConvexHullGeometry.

@:value(_CYLINDER)staticread onlyCYLINDER:Int = _CYLINDER

Represents a cylinder collision geometry.

+

See CylinderGeometry.

@:value(_SPHERE)staticread onlySPHERE:Int = _SPHERE

Represents a sphere collision geometry.

+

See SphereGeometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/RayCastHit.html b/docs/oimo/collision/geometry/RayCastHit.html index a247a27..510c0ba 100644 --- a/docs/oimo/collision/geometry/RayCastHit.html +++ b/docs/oimo/collision/geometry/RayCastHit.html @@ -1,9 +1,9 @@ -oimo.collision.geometry.RayCastHit - OimoPhysics API documentation

A single ray cast hit data.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

\ No newline at end of file +

A single ray cast hit data.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/SphereGeometry.html b/docs/oimo/collision/geometry/SphereGeometry.html index 911ddf5..782b13e 100644 --- a/docs/oimo/collision/geometry/SphereGeometry.html +++ b/docs/oimo/collision/geometry/SphereGeometry.html @@ -1,10 +1,10 @@ -oimo.collision.geometry.SphereGeometry - OimoPhysics API documentation

A sphere collision geometry.

Constructor

new (radius:Float)

Creates a sphere collision geometry of radius radius.

Methods

inline getRadius ():Float

Returns the radius of the sphere.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inline getGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inline setGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inline getType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inline getVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

A sphere collision geometry.

Constructor

new (radius:Float)

Creates a sphere collision geometry of radius radius.

Methods

inlinegetRadius ():Float

Returns the radius of the sphere.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

+

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/index.html b/docs/oimo/collision/geometry/index.html index 3ef972f..d144b40 100644 --- a/docs/oimo/collision/geometry/index.html +++ b/docs/oimo/collision/geometry/index.html @@ -1,10 +1,10 @@ -oimo.collision.geometry - OimoPhysics API documentation

oimo.collision.geometry

OimoPhysics API Documentation

..
Aabb

The axis-aligned bounding box.

BoxGeometry

A box collision geometry.

CapsuleGeometry

A capsule collision geometry aligned with the y-axis.

ConeGeometry

A cone collision geometry aligned with the y-axis.

ConvexGeometry

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

ConvexHullGeometry

A convex hull collision geometry. A convex hull of the vertices is the smallest convex -polyhedron which contains all vertices.

CylinderGeometry

A cylinder collision geometry aligned with the y-axis.

Geometry

Abstract collision geometry.

GeometryType

The list of collision geometry types.

RayCastHit

A single ray cast hit data.

SphereGeometry

A sphere collision geometry.

\ No newline at end of file +

oimo.collision.geometry

OimoPhysics API Documentation

..
Aabb

The axis-aligned bounding box.

BoxGeometry

A box collision geometry.

CapsuleGeometry

A capsule collision geometry aligned with the y-axis.

ConeGeometry

A cone collision geometry aligned with the y-axis.

ConvexGeometry

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

ConvexHullGeometry

A convex hull collision geometry. A convex hull of the vertices is the smallest convex +polyhedron which contains all vertices.

CylinderGeometry

A cylinder collision geometry aligned with the y-axis.

Geometry

Abstract collision geometry.

GeometryType

The list of collision geometry types.

RayCastHit

A single ray cast hit data.

SphereGeometry

A sphere collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/index.html b/docs/oimo/collision/index.html index 2b39333..5079834 100644 --- a/docs/oimo/collision/index.html +++ b/docs/oimo/collision/index.html @@ -1,9 +1,9 @@ -oimo.collision - OimoPhysics API documentation

oimo.collision

OimoPhysics API Documentation

..
broadphase
geometry
narrowphase
\ No newline at end of file +

oimo.collision

OimoPhysics API Documentation

..
broadphase
geometry
narrowphase
\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/CollisionMatrix.html b/docs/oimo/collision/narrowphase/CollisionMatrix.html index 4f078a7..39bfd5f 100644 --- a/docs/oimo/collision/narrowphase/CollisionMatrix.html +++ b/docs/oimo/collision/narrowphase/CollisionMatrix.html @@ -1,12 +1,12 @@ -oimo.collision.narrowphase.CollisionMatrix - OimoPhysics API documentationoimo.collision.narrowphase.CollisionMatrix - OimoPhysics API documentation

CollisionMatrix provides corresponding collision detector for a pair of -two geometries of given types.

Methods

inline getDetector (geomType1:Int, geomType2:Int):Detector

Returns an appropriate collision detector of two geometries of types geomType1 and geomType2.

-

This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

\ No newline at end of file +

CollisionMatrix provides corresponding collision detector for a pair of +two geometries of given types.

Methods

inlinegetDetector (geomType1:Int, geomType2:Int):Detector

Returns an appropriate collision detector of two geometries of types geomType1 and geomType2.

+

This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResult.html b/docs/oimo/collision/narrowphase/DetectorResult.html index 9252d66..dadeb1f 100644 --- a/docs/oimo/collision/narrowphase/DetectorResult.html +++ b/docs/oimo/collision/narrowphase/DetectorResult.html @@ -1,13 +1,13 @@ -oimo.collision.narrowphase.DetectorResult - OimoPhysics API documentationoimo.collision.narrowphase.DetectorResult - OimoPhysics API documentation

The result of narrow-phase collision detection. This is used for generating contact -points of a contact constraint at once or incrementally.

Constructor

new ()

Default constructor.

Variables

incremental:Bool

Whether the result points are to be used for incremental menifold update.

normal:Vec3

The normal vector of the contact plane.

numPoints:Int

The number of the result points.

points:Vector<DetectorResultPoint>

The result points. Note that only the first DetectorResult.numPoints points are -computed by the collision detector.

Methods

inline clear ():Void

Cleans up the result data.

getMaxDepth ():Float

Returns the maximum depth of the result points. Returns 0.0 if no result -points are available.

\ No newline at end of file +

The result of narrow-phase collision detection. This is used for generating contact +points of a contact constraint at once or incrementally.

Constructor

new ()

Default constructor.

Variables

incremental:Bool

Whether the result points are to be used for incremental menifold update.

normal:Vec3

The normal vector of the contact plane.

numPoints:Int

The number of the result points.

points:Vector<DetectorResultPoint>

The result points. Note that only the first DetectorResult.numPoints points are +computed by the collision detector.

Methods

inlineclear ():Void

Cleans up the result data.

getMaxDepth ():Float

Returns the maximum depth of the result points. Returns 0.0 if no result +points are available.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResultPoint.html b/docs/oimo/collision/narrowphase/DetectorResultPoint.html index c8a9941..3355cd0 100644 --- a/docs/oimo/collision/narrowphase/DetectorResultPoint.html +++ b/docs/oimo/collision/narrowphase/DetectorResultPoint.html @@ -1,14 +1,14 @@ -oimo.collision.narrowphase.DetectorResultPoint - OimoPhysics API documentationoimo.collision.narrowphase.DetectorResultPoint - OimoPhysics API documentation

The result point is a pair of the closest points of collision geometries +

The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for -each collision geometry and the amount of the overlap.

Variables

depth:Float

The amount of the overlap. This becomes negative if two geometries are -separate.

id:Int

The identification of the result point.

position1:Vec3

The first collision geometry's closest point.

position2:Vec3

The second collision geometry's closest point.

\ No newline at end of file +each collision geometry and the amount of the overlap.

Variables

depth:Float

The amount of the overlap. This becomes negative if two geometries are +separate.

id:Int

The identification of the result point.

position1:Vec3

The first collision geometry's closest point.

position2:Vec3

The second collision geometry's closest point.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html index 8194364..eb1b3a0 100644 --- a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html @@ -1,11 +1,11 @@ -oimo.collision.narrowphase.detector.BoxBoxDetector - OimoPhysics API documentation

Box vs Box detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

Box vs Box detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html index b19dfca..acf93df 100644 --- a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html @@ -1,11 +1,11 @@ -oimo.collision.narrowphase.detector.CapsuleCapsuleDetector - OimoPhysics API documentation

Capsule vs Capsule detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

Capsule vs Capsule detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/Detector.html b/docs/oimo/collision/narrowphase/detector/Detector.html index 29561b1..95b8ff5 100644 --- a/docs/oimo/collision/narrowphase/detector/Detector.html +++ b/docs/oimo/collision/narrowphase/detector/Detector.html @@ -1,11 +1,11 @@ -oimo.collision.narrowphase.detector.Detector - OimoPhysics API documentation

Interface of a collision detector for narrow-phase collision detection.

Methods

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

Interface of a collision detector for narrow-phase collision detection.

Methods

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html index afe05e4..c4be9c1 100644 --- a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html +++ b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html @@ -1,11 +1,11 @@ -oimo.collision.narrowphase.detector.GjkEpaDetector - OimoPhysics API documentation

General convex collision detector using GJK/EPA

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

General convex collision detector using GJK/EPA

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html index fe433ca..a35f897 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html @@ -1,13 +1,13 @@ -oimo.collision.narrowphase.detector.SphereBoxDetector - OimoPhysics API documentation

Sphere vs Box collision detector.

Constructor

new (swapped:Bool)

If swapped is true, the collision detector expects BoxGeometry and SphereGeometry for the +

Sphere vs Box collision detector.

Constructor

new (swapped:Bool)

If swapped is true, the collision detector expects BoxGeometry and SphereGeometry for the first and second argument of SphereBoxDetector.detect. If swapped is false, the collision detector expects -SphereGeometry and BoxGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +SphereGeometry and BoxGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html index 8f6272a..ff7d781 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html @@ -1,13 +1,13 @@ -oimo.collision.narrowphase.detector.SphereCapsuleDetector - OimoPhysics API documentation

Sphere vs Capsule detector.

Constructor

new (swapped:Bool)

If swapped is true, the collision detector expects CapsuleGeometry and SphereGeometry for the +

Sphere vs Capsule detector.

Constructor

new (swapped:Bool)

If swapped is true, the collision detector expects CapsuleGeometry and SphereGeometry for the first and second argument of SphereCapsuleDetector.detect. If swapped is false, the collision detector expects -SphereGeometry and CapsuleGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +SphereGeometry and CapsuleGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html index e4ab87d..a5187fa 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html @@ -1,11 +1,11 @@ -oimo.collision.narrowphase.detector.SphereSphereDetector - OimoPhysics API documentation

Sphere vs Sphere detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

Sphere vs Sphere detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html index 8db6ae1..d0f7493 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html @@ -1,26 +1,26 @@ -oimo.collision.narrowphase.detector.gjkepa.GjkEpa - OimoPhysics API documentation

GJK algorithm and EPA for narrow-phase collision detection.

Constructor

new ()

Default constructor. Consider using GjkEpa.getInstance instead of creating a new -instance.

Variables

closestPoint1:Vec3

Computed closest point of the first geometry in world coordinate system.

closestPoint2:Vec3

Computed closest point of the second geometry in world coordinate system.

distance:Float

Computed distance between two geometries. This value may be negative if two -geometries are overlapping.

Methods

inline computeClosestPoints (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the closest points of two convex geometries c1 and c2 with transforms tf1 and tf2 -respectively, and returns the status of the result (see GjkEpaResultState for details). If cached +

GJK algorithm and EPA for narrow-phase collision detection.

Constructor

new ()

Default constructor. Consider using GjkEpa.getInstance instead of creating a new +instance.

Variables

closestPoint1:Vec3

Computed closest point of the first geometry in world coordinate system.

closestPoint2:Vec3

Computed closest point of the second geometry in world coordinate system.

distance:Float

Computed distance between two geometries. This value may be negative if two +geometries are overlapping.

Methods

inlinecomputeClosestPoints (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the closest points of two convex geometries c1 and c2 with transforms tf1 and tf2 +respectively, and returns the status of the result (see GjkEpaResultState for details). If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

-

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

inline computeDistance (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the distance between two convex geometries c1 and c2 with transforms tf1 and tf2 -respectively, and returns the status of the result (see GjkEpaResultState for details). Different +

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

inlinecomputeDistance (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

Computes the distance between two convex geometries c1 and c2 with transforms tf1 and tf2 +respectively, and returns the status of the result (see GjkEpaResultState for details). Different from GjkEpa.computeClosestPoints, this does not compute negative distances and closest points if two geometries are overlapping. If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

-

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

convexCast (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, tl1:Vec3, tl2:Vec3, hit:RayCastHit):Bool

Performs a convex casting between c1 and c2. Returns true and sets the result information +

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

convexCast (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, tl1:Vec3, tl2:Vec3, hit:RayCastHit):Bool

Performs a convex casting between c1 and c2. Returns true and sets the result information to hit if the convex geometries intersect. Each convex geometries translates by tl1 and tl2, starting from the beginning transforms tf1 and tf2 respectively.

-

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

rayCast (c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

Performs ray cansting against the convex geometry c with transform tf. Returns true and sets +

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

rayCast (c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

Performs ray cansting against the convex geometry c with transform tf. Returns true and sets the result information to hit if the line segment from begin to end intersects the convex geometry. Otherwise returns false.

-

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

Static methods

staticinline getInstance ():GjkEpa

Returns an instance of GjkEpa.

\ No newline at end of file +

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

Static methods

staticinlinegetInstance ():GjkEpa

Returns an instance of GjkEpa.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html index 6803ed2..33a6928 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html @@ -1,9 +1,9 @@ -oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState - OimoPhysics API documentation

The list of the state of a result of GjkEpa.computeClosestPoints.

Static variables

staticread onlyEPA_DID_NOT_CONVERGE:Int

EPA iterations did not converge in time.

staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int

Failed to add a new vertex to the polyhedron in EPA computation.

staticread onlyEPA_FAILED_TO_INIT:Int

Failed to construct initial polyhedron in EPA construction.

staticread onlyGJK_DID_NOT_CONVERGE:Int

GJK iterations did not converge in time.

staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int

Failed to construct a tetrahedron enclosing the origin in GJK computation.

staticread onlySUCCEEDED:Int

GJK/EPA computation is successfully finished.

\ No newline at end of file +

The list of the state of a result of GjkEpa.computeClosestPoints.

Static variables

@:value(_EPA_DID_NOT_CONVERGE)staticread onlyEPA_DID_NOT_CONVERGE:Int = _EPA_DID_NOT_CONVERGE

EPA iterations did not converge in time.

@:value(_EPA_FAILED_TO_ADD_VERTEX)staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int = _EPA_FAILED_TO_ADD_VERTEX

Failed to add a new vertex to the polyhedron in EPA computation.

@:value(_EPA_FAILED_TO_INIT)staticread onlyEPA_FAILED_TO_INIT:Int = _EPA_FAILED_TO_INIT

Failed to construct initial polyhedron in EPA construction.

@:value(_GJK_DID_NOT_CONVERGE)staticread onlyGJK_DID_NOT_CONVERGE:Int = _GJK_DID_NOT_CONVERGE

GJK iterations did not converge in time.

@:value(_GJK_FAILED_TO_MAKE_TETRAHEDRON)staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int = _GJK_FAILED_TO_MAKE_TETRAHEDRON

Failed to construct a tetrahedron enclosing the origin in GJK computation.

@:value(_SUCCEEDED)staticread onlySUCCEEDED:Int = _SUCCEEDED

GJK/EPA computation is successfully finished.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html index d59089d..a801c52 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html @@ -1,12 +1,12 @@ -oimo.collision.narrowphase.detector.gjkepa.SimplexUtil - OimoPhysics API documentation

Simplex utilities for GJK/EPA computations.

Static methods

staticinline projectOrigin2 (vec1:Vec3, vec2:Vec3, out:Vec3):Int

Sets out to the minimum length point on the line (vec1, vec2) -and returns the index of the voronoi region.

staticinline projectOrigin3 (vec1:Vec3, vec2:Vec3, vec3:Vec3, out:Vec3):Int

Sets out to the minimum length point on the triangle (vec1, vec2, vec3) -and returns the index of the voronoi region.

staticinline projectOrigin4 (vec1:Vec3, vec2:Vec3, vec3:Vec3, vec4:Vec3, out:Vec3):Int

Sets out to the minimum length point on the tetrahedron (vec1, vec2, vec3, vec4) -and returns the index of the voronoi region.

\ No newline at end of file +

Simplex utilities for GJK/EPA computations.

Static methods

staticinlineprojectOrigin2 (vec1:Vec3, vec2:Vec3, out:Vec3):Int

Sets out to the minimum length point on the line (vec1, vec2) +and returns the index of the voronoi region.

staticinlineprojectOrigin3 (vec1:Vec3, vec2:Vec3, vec3:Vec3, out:Vec3):Int

Sets out to the minimum length point on the triangle (vec1, vec2, vec3) +and returns the index of the voronoi region.

staticinlineprojectOrigin4 (vec1:Vec3, vec2:Vec3, vec3:Vec3, vec4:Vec3, out:Vec3):Int

Sets out to the minimum length point on the tetrahedron (vec1, vec2, vec3, vec4) +and returns the index of the voronoi region.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html index d62d07c..673ddab 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html @@ -1,9 +1,9 @@ -oimo.collision.narrowphase.detector.gjkepa - OimoPhysics API documentation

oimo.collision.narrowphase.detector.gjkepa

OimoPhysics API Documentation

..
GjkEpa

GJK algorithm and EPA for narrow-phase collision detection.

GjkEpaResultState

The list of the state of a result of GjkEpa.computeClosestPoints.

SimplexUtil

Simplex utilities for GJK/EPA computations.

\ No newline at end of file +

oimo.collision.narrowphase.detector.gjkepa

OimoPhysics API Documentation

..
GjkEpa

GJK algorithm and EPA for narrow-phase collision detection.

GjkEpaResultState

The list of the state of a result of GjkEpa.computeClosestPoints.

SimplexUtil

Simplex utilities for GJK/EPA computations.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/index.html b/docs/oimo/collision/narrowphase/detector/index.html index ce1a9f1..0c641b1 100644 --- a/docs/oimo/collision/narrowphase/detector/index.html +++ b/docs/oimo/collision/narrowphase/detector/index.html @@ -1,9 +1,9 @@ -oimo.collision.narrowphase.detector - OimoPhysics API documentation

oimo.collision.narrowphase.detector

OimoPhysics API Documentation

..
gjkepa
BoxBoxDetector

Box vs Box detector.

CapsuleCapsuleDetector

Capsule vs Capsule detector.

Detector

Interface of a collision detector for narrow-phase collision detection.

GjkEpaDetector

General convex collision detector using GJK/EPA

SphereBoxDetector

Sphere vs Box collision detector.

SphereCapsuleDetector

Sphere vs Capsule detector.

SphereSphereDetector

Sphere vs Sphere detector.

\ No newline at end of file +

oimo.collision.narrowphase.detector

OimoPhysics API Documentation

..
gjkepa
BoxBoxDetector

Box vs Box detector.

CapsuleCapsuleDetector

Capsule vs Capsule detector.

Detector

Interface of a collision detector for narrow-phase collision detection.

GjkEpaDetector

General convex collision detector using GJK/EPA

SphereBoxDetector

Sphere vs Box collision detector.

SphereCapsuleDetector

Sphere vs Capsule detector.

SphereSphereDetector

Sphere vs Sphere detector.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/index.html b/docs/oimo/collision/narrowphase/index.html index 795754d..12a469e 100644 --- a/docs/oimo/collision/narrowphase/index.html +++ b/docs/oimo/collision/narrowphase/index.html @@ -1,13 +1,13 @@ -oimo.collision.narrowphase - OimoPhysics API documentation

oimo.collision.narrowphase

OimoPhysics API Documentation

..
detector
CollisionMatrix

CollisionMatrix provides corresponding collision detector for a pair of -two geometries of given types.

DetectorResult

The result of narrow-phase collision detection. This is used for generating contact -points of a contact constraint at once or incrementally.

DetectorResultPoint

The result point is a pair of the closest points of collision geometries +

oimo.collision.narrowphase

OimoPhysics API Documentation

..
detector
CollisionMatrix

CollisionMatrix provides corresponding collision detector for a pair of +two geometries of given types.

DetectorResult

The result of narrow-phase collision detection. This is used for generating contact +points of a contact constraint at once or incrementally.

DetectorResultPoint

The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for -each collision geometry and the amount of the overlap.

\ No newline at end of file +each collision geometry and the amount of the overlap.

\ No newline at end of file diff --git a/docs/oimo/common/Mat3.html b/docs/oimo/common/Mat3.html index efda4c4..ea6bd2e 100644 --- a/docs/oimo/common/Mat3.html +++ b/docs/oimo/common/Mat3.html @@ -1,38 +1,38 @@ -oimo.common.Mat3 - OimoPhysics API documentation

3x3 Matrix class.

-

Note that columns and rows are 0-indexed.

Constructor

inline new (?e00:Float, ?e01:Float, ?e02:Float, ?e10:Float, ?e11:Float, ?e12:Float, ?e20:Float, ?e21:Float, ?e22:Float)

Creates a new matrix. The matrix is identity by default.

Variables

e00:Float

The element at row 0 column 0.

e01:Float

The element at row 0 column 1.

e02:Float

The element at row 0 column 2.

e10:Float

The element at row 1 column 0.

e11:Float

The element at row 1 column 1.

e12:Float

The element at row 1 column 2.

e20:Float

The element at row 2 column 0.

e21:Float

The element at row 2 column 1.

e22:Float

The element at row 2 column 2.

Methods

inline add (m:Mat3):Mat3

Returns this + m

inline addEq (m:Mat3):Mat3

Sets this matrix to this + m and returns this.

inline appendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Returns this * rotation matrix.

+

3x3 Matrix class.

+

Note that columns and rows are 0-indexed.

Constructor

@:value({ e22 : 1, e21 : 0, e20 : 0, e12 : 0, e11 : 1, e10 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew (e00:Float = 1, e01:Float = 0, e02:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1)

Creates a new matrix. The matrix is identity by default.

Variables

e00:Float

The element at row 0 column 0.

e01:Float

The element at row 0 column 1.

e02:Float

The element at row 0 column 2.

e10:Float

The element at row 1 column 0.

e11:Float

The element at row 1 column 1.

e12:Float

The element at row 1 column 2.

e20:Float

The element at row 2 column 0.

e21:Float

The element at row 2 column 1.

e22:Float

The element at row 2 column 2.

Methods

inlineadd (m:Mat3):Mat3

Returns this + m

inlineaddEq (m:Mat3):Mat3

Sets this matrix to this + m and returns this.

inlineappendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Returns this * rotation matrix.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline appendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Sets this matrix to this * rotation matrix, and returns this.

+vector (axisX, axisY, axisZ).

inlineappendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Sets this matrix to this * rotation matrix, and returns this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline appendScale (sx:Float, sy:Float, sz:Float):Mat3

Returns this * scaling matrix.

+vector (axisX, axisY, axisZ).

inlineappendScale (sx:Float, sy:Float, sz:Float):Mat3

Returns this * scaling matrix.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline appendScaleEq (sx:Float, sy:Float, sz:Float):Mat3

Sets this matrix to this * scaling matrix, and returns this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineappendScaleEq (sx:Float, sy:Float, sz:Float):Mat3

Sets this matrix to this * scaling matrix, and returns this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline clone ():Mat3

Returns a clone of the matrix.

inline copyFrom (m:Mat3):Mat3

Copies values from m and returns this.

inline determinant ():Float

Returns the determinant.

inline fromCols (col0:Vec3, col1:Vec3, col2:Vec3):Mat3

Sets this matrix by column vectors and returns this.

inline fromEulerXyz (eulerAngles:Vec3):Mat3

Sets this matrix to the rotation matrix represented by Euler angles eulerAngles, and returns this. -Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.

inline fromQuat (q:Quat):Mat3

Sets this matrix to the representation of the quaternion q, and returns this.

inline fromRows (row0:Vec3, row1:Vec3, row2:Vec3):Mat3

Sets this matrix by row vectors and returns this.

inline getCol (index:Int):Vec3

Returns the indexth column vector of the matrix.

-

If index is less than 0 or greater than 2, null will be returned.

inline getColTo (index:Int, dst:Vec3):Void

Sets dst to the indexth column vector of the matrix.

-

If index is less than 0 or greater than 2, dst will be set to the zero vector.

inline getRow (index:Int):Vec3

Returns the indexth row vector of the matrix.

-

If index is less than 0 or greater than 2, null will be returned.

inline getRowTo (index:Int, dst:Vec3):Void

Sets dst to the indexth row vector of the matrix.

-

If index is less than 0 or greater than 2, dst will be set to the zero vector.

inline identity ():Mat3

Sets this matrix to identity matrix and returns this.

inline init (e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float):Mat3

Sets all elements at once and returns this.

inline inverse ():Mat3

Returns the inverse matrix.

-

If the determinant is zero, zero matrix is returned.

inline inverseEq ():Mat3

Sets this matrix to the inverse matrix and returns this.

-

If the determinant is zero, this matrix is set to zero matrix.

inline mul (m:Mat3):Mat3

Returns this * m

inline mulEq (m:Mat3):Mat3

Sets this matrix to this * m and returns this.

inline prependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Returns rotation matrix * this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineclone ():Mat3

Returns a clone of the matrix.

inlinecopyFrom (m:Mat3):Mat3

Copies values from m and returns this.

inlinedeterminant ():Float

Returns the determinant.

inlinefromCols (col0:Vec3, col1:Vec3, col2:Vec3):Mat3

Sets this matrix by column vectors and returns this.

inlinefromEulerXyz (eulerAngles:Vec3):Mat3

Sets this matrix to the rotation matrix represented by Euler angles eulerAngles, and returns this. +Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.

inlinefromQuat (q:Quat):Mat3

Sets this matrix to the representation of the quaternion q, and returns this.

inlinefromRows (row0:Vec3, row1:Vec3, row2:Vec3):Mat3

Sets this matrix by row vectors and returns this.

inlinegetCol (index:Int):Vec3

Returns the indexth column vector of the matrix.

+

If index is less than 0 or greater than 2, null will be returned.

inlinegetColTo (index:Int, dst:Vec3):Void

Sets dst to the indexth column vector of the matrix.

+

If index is less than 0 or greater than 2, dst will be set to the zero vector.

inlinegetRow (index:Int):Vec3

Returns the indexth row vector of the matrix.

+

If index is less than 0 or greater than 2, null will be returned.

inlinegetRowTo (index:Int, dst:Vec3):Void

Sets dst to the indexth row vector of the matrix.

+

If index is less than 0 or greater than 2, dst will be set to the zero vector.

inlineidentity ():Mat3

Sets this matrix to identity matrix and returns this.

inlineinit (e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float):Mat3

Sets all elements at once and returns this.

inlineinverse ():Mat3

Returns the inverse matrix.

+

If the determinant is zero, zero matrix is returned.

inlineinverseEq ():Mat3

Sets this matrix to the inverse matrix and returns this.

+

If the determinant is zero, this matrix is set to zero matrix.

inlinemul (m:Mat3):Mat3

Returns this * m

inlinemulEq (m:Mat3):Mat3

Sets this matrix to this * m and returns this.

inlineprependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Returns rotation matrix * this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline prependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Sets this matrix to rotation matrix * this, and returns this.

+vector (axisX, axisY, axisZ).

inlineprependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

Sets this matrix to rotation matrix * this, and returns this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline prependScale (sx:Float, sy:Float, sz:Float):Mat3

Returns scaling matrix * this.

+vector (axisX, axisY, axisZ).

inlineprependScale (sx:Float, sy:Float, sz:Float):Mat3

Returns scaling matrix * this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline prependScaleEq (sx:Float, sy:Float, sz:Float):Mat3

Sets this matrix to scaling matrix * this, and returns this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineprependScaleEq (sx:Float, sy:Float, sz:Float):Mat3

Sets this matrix to scaling matrix * this, and returns this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline scale (s:Float):Mat3

Returns this * s

inline scaleEq (s:Float):Mat3

Sets this matrix to this * s and returns this.

inline sub (m:Mat3):Mat3

Returns this - m

inline subEq (m:Mat3):Mat3

Sets this matrix to this - m and returns this.

inline toArray (?columnMajor:Bool):Array<Float>

Returns an array of the elements of this matrix.

+sz times along the x-axis, y-axis and z-axis respectively.

inlinescale (s:Float):Mat3

Returns this * s

inlinescaleEq (s:Float):Mat3

Sets this matrix to this * s and returns this.

inlinesub (m:Mat3):Mat3

Returns this - m

inlinesubEq (m:Mat3):Mat3

Sets this matrix to this - m and returns this.

@:value({ columnMajor : false })inlinetoArray (columnMajor:Bool = false):Array<Float>

Returns an array of the elements of this matrix.

If columnMajor is true, the array is arranged in column-major order. -Otherwise, the array is arranged in row-major order.

inline toEulerXyz ():Vec3

Returns a vector (angleX, angleY, angleZ) represents the Euler angles of this matrix. +Otherwise, the array is arranged in row-major order.

inlinetoEulerXyz ():Vec3

Returns a vector (angleX, angleY, angleZ) represents the Euler angles of this matrix. Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. -Note that angleX, angleY, and angleZ are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.

inline toQuat ():Quat

Returns a quaternion which represents this matrix.

-

This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

toString ():String

Returns the string representation of the matrix.

inline trace ():Float

Returns the trace.

inline transpose ():Mat3

Returns the transposed matrix.

inline transposeEq ():Mat3

Sets this matrix to the transposed matrix and returns this.

Static variables

staticnumCreations:Int

The number of instance creation.

\ No newline at end of file +Note that angleX, angleY, and angleZ are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.

inlinetoQuat ():Quat

Returns a quaternion which represents this matrix.

+

This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat3

Returns the transposed matrix.

inlinetransposeEq ():Mat3

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/Mat4.html b/docs/oimo/common/Mat4.html index 2ffac9b..a30e783 100644 --- a/docs/oimo/common/Mat4.html +++ b/docs/oimo/common/Mat4.html @@ -1,48 +1,48 @@ -oimo.common.Mat4 - OimoPhysics API documentation

4x4 Matrix class.

-

Note that columns and rows are 0-indexed.

Constructor

inline new (?e00:Float, ?e01:Float, ?e02:Float, ?e03:Float, ?e10:Float, ?e11:Float, ?e12:Float, ?e13:Float, ?e20:Float, ?e21:Float, ?e22:Float, ?e23:Float, ?e30:Float, ?e31:Float, ?e32:Float, ?e33:Float)

Creates a new matrix. The matrix is identity by default.

Variables

e00:Float

The element at row 0 column 0.

e01:Float

The element at row 0 column 1.

e02:Float

The element at row 0 column 2.

e03:Float

The element at row 0 column 3.

e10:Float

The element at row 1 column 0.

e11:Float

The element at row 1 column 1.

e12:Float

The element at row 1 column 2.

e13:Float

The element at row 1 column 3.

e20:Float

The element at row 2 column 0.

e21:Float

The element at row 2 column 1.

e22:Float

The element at row 2 column 2.

e23:Float

The element at row 2 column 3.

e30:Float

The element at row 3 column 0.

e31:Float

The element at row 3 column 1.

e32:Float

The element at row 3 column 2.

e33:Float

The element at row 3 column 3.

Methods

inline add (m:Mat4):Mat4

Returns this + m

inline addEq (m:Mat4):Mat4

Sets this matrix to this + m and returns this.

inline appendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Returns this * rotation matrix.

+

4x4 Matrix class.

+

Note that columns and rows are 0-indexed.

Constructor

@:value({ e33 : 1, e32 : 0, e31 : 0, e30 : 0, e23 : 0, e22 : 1, e21 : 0, e20 : 0, e13 : 0, e12 : 0, e11 : 1, e10 : 0, e03 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew (e00:Float = 1, e01:Float = 0, e02:Float = 0, e03:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e13:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1, e23:Float = 0, e30:Float = 0, e31:Float = 0, e32:Float = 0, e33:Float = 1)

Creates a new matrix. The matrix is identity by default.

Variables

e00:Float

The element at row 0 column 0.

e01:Float

The element at row 0 column 1.

e02:Float

The element at row 0 column 2.

e03:Float

The element at row 0 column 3.

e10:Float

The element at row 1 column 0.

e11:Float

The element at row 1 column 1.

e12:Float

The element at row 1 column 2.

e13:Float

The element at row 1 column 3.

e20:Float

The element at row 2 column 0.

e21:Float

The element at row 2 column 1.

e22:Float

The element at row 2 column 2.

e23:Float

The element at row 2 column 3.

e30:Float

The element at row 3 column 0.

e31:Float

The element at row 3 column 1.

e32:Float

The element at row 3 column 2.

e33:Float

The element at row 3 column 3.

Methods

inlineadd (m:Mat4):Mat4

Returns this + m

inlineaddEq (m:Mat4):Mat4

Sets this matrix to this + m and returns this.

inlineappendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Returns this * rotation matrix.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline appendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Sets this matrix to this * rotation matrix, and returns this.

+vector (axisX, axisY, axisZ).

inlineappendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Sets this matrix to this * rotation matrix, and returns this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline appendScale (sx:Float, sy:Float, sz:Float):Mat4

Returns this * scaling matrix.

+vector (axisX, axisY, axisZ).

inlineappendScale (sx:Float, sy:Float, sz:Float):Mat4

Returns this * scaling matrix.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline appendScaleEq (sx:Float, sy:Float, sz:Float):Mat4

Sets this matrix to this * scaling matrix, and returns this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineappendScaleEq (sx:Float, sy:Float, sz:Float):Mat4

Sets this matrix to this * scaling matrix, and returns this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline appendTranslation (tx:Float, ty:Float, tz:Float):Mat4

Returns this * translation matrix.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineappendTranslation (tx:Float, ty:Float, tz:Float):Mat4

Returns this * translation matrix.

Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

inline appendTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

Sets this matrix to this * translation matrix, and returns this.

+the x-axis, y-axis and z-axis respectively.

inlineappendTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

Sets this matrix to this * translation matrix, and returns this.

Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

inline clone ():Mat4

Returns a clone of the matrix.

inline copyFrom (m:Mat4):Mat4

Copies values from m and returns this.

inline determinant ():Float

Returns the determinant.

inline fromMat3 (m:Mat3):Mat4

Sets this matrix to the extension of m and returns this.

-

this.e33 is set to 1 and other components don't exist in m are set to 0.

inline fromTransform (transform:Transform):Mat4

Sets this matrix to the representation of transform and returns this.

inline identity ():Mat4

Sets this matrix to identity matrix and returns this.

inline init (e00:Float, e01:Float, e02:Float, e03:Float, e10:Float, e11:Float, e12:Float, e13:Float, e20:Float, e21:Float, e22:Float, e23:Float, e30:Float, e31:Float, e32:Float, e33:Float):Mat4

Sets all elements at once and returns this.

inline inverse ():Mat4

Returns the inverse matrix.

-

If the determinant is zero, zero matrix is returned.

inline inverseEq ():Mat4

Sets this matrix to the inverse matrix and returns this.

-

If the determinant is zero, this matrix is set to zero matrix.

inline lookAt (eyeX:Float, eyeY:Float, eyeZ:Float, atX:Float, atY:Float, atZ:Float, upX:Float, upY:Float, upZ:Float):Mat4

Sets this matrix to view matrix and returns this.

+the x-axis, y-axis and z-axis respectively.

inlineclone ():Mat4

Returns a clone of the matrix.

inlinecopyFrom (m:Mat4):Mat4

Copies values from m and returns this.

inlinedeterminant ():Float

Returns the determinant.

inlinefromMat3 (m:Mat3):Mat4

Sets this matrix to the extension of m and returns this.

+

this.e33 is set to 1 and other components don't exist in m are set to 0.

inlinefromTransform (transform:Transform):Mat4

Sets this matrix to the representation of transform and returns this.

inlineidentity ():Mat4

Sets this matrix to identity matrix and returns this.

inlineinit (e00:Float, e01:Float, e02:Float, e03:Float, e10:Float, e11:Float, e12:Float, e13:Float, e20:Float, e21:Float, e22:Float, e23:Float, e30:Float, e31:Float, e32:Float, e33:Float):Mat4

Sets all elements at once and returns this.

inlineinverse ():Mat4

Returns the inverse matrix.

+

If the determinant is zero, zero matrix is returned.

inlineinverseEq ():Mat4

Sets this matrix to the inverse matrix and returns this.

+

If the determinant is zero, this matrix is set to zero matrix.

inlinelookAt (eyeX:Float, eyeY:Float, eyeZ:Float, atX:Float, atY:Float, atZ:Float, upX:Float, upY:Float, upZ:Float):Mat4

Sets this matrix to view matrix and returns this.

Where view matrix is a matrix which represents the viewing transformation with eyes at (eyeX, eyeY, eyeZ), fixation point at (atX, atY, atZ), and -up vector (upX, upY, upZ).

inline mul (m:Mat4):Mat4

Returns this * m

inline mulEq (m:Mat4):Mat4

Sets this matrix to this * m and returns this.

inline ortho (width:Float, height:Float, near:Float, far:Float):Mat4

Sets this matrix to orthogonal projection matrix and returns this.

+up vector (upX, upY, upZ).

inlinemul (m:Mat4):Mat4

Returns this * m

inlinemulEq (m:Mat4):Mat4

Sets this matrix to this * m and returns this.

inlineortho (width:Float, height:Float, near:Float, far:Float):Mat4

Sets this matrix to orthogonal projection matrix and returns this.

Where orthogonal projection matrix is a matrix which represents the orthogonal projection transformation with screen width and height width, height, and -z-value of near and far clipping plane near, far.

inline perspective (fovY:Float, aspect:Float, near:Float, far:Float):Mat4

Sets this matrix to perspecive projection matrix and returns this.

+z-value of near and far clipping plane near, far.

inlineperspective (fovY:Float, aspect:Float, near:Float, far:Float):Mat4

Sets this matrix to perspecive projection matrix and returns this.

Where perspecive projection matrix is a matrix which represents the perspective projection transformation with field of view in the y direction fovY in radians, -aspect ratio aspect, and z-value of near and far clipping plane near, far.

inline prependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Returns rotation matrix * this.

+aspect ratio aspect, and z-value of near and far clipping plane near, far.

inlineprependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Returns rotation matrix * this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline prependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Sets this matrix to rotation matrix * this, and returns this.

+vector (axisX, axisY, axisZ).

inlineprependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

Sets this matrix to rotation matrix * this, and returns this.

Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

inline prependScale (sx:Float, sy:Float, sz:Float):Mat4

Returns scaling matrix * this.

+vector (axisX, axisY, axisZ).

inlineprependScale (sx:Float, sy:Float, sz:Float):Mat4

Returns scaling matrix * this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline prependScaleEq (sx:Float, sy:Float, sz:Float):Mat4

Sets this matrix to scaling matrix * this, and returns this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineprependScaleEq (sx:Float, sy:Float, sz:Float):Mat4

Sets this matrix to scaling matrix * this, and returns this.

Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

inline prependTranslation (tx:Float, ty:Float, tz:Float):Mat4

Returns translation matrix * this.

+sz times along the x-axis, y-axis and z-axis respectively.

inlineprependTranslation (tx:Float, ty:Float, tz:Float):Mat4

Returns translation matrix * this.

Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

inline prependTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

Sets this matrix to translation matrix * this, and returns this.

+the x-axis, y-axis and z-axis respectively.

inlineprependTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

Sets this matrix to translation matrix * this, and returns this.

Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

inline scale (s:Float):Mat4

Returns this * s

inline scaleEq (s:Float):Mat4

Sets this matrix to this * s and returns this.

inline sub (m:Mat4):Mat4

Returns this - m

inline subEq (m:Mat4):Mat4

Sets this matrix to this - m and returns this.

inline toArray (?columnMajor:Bool):Array<Float>

Returns an array of the elements of this matrix.

+the x-axis, y-axis and z-axis respectively.

inlinescale (s:Float):Mat4

Returns this * s

inlinescaleEq (s:Float):Mat4

Sets this matrix to this * s and returns this.

inlinesub (m:Mat4):Mat4

Returns this - m

inlinesubEq (m:Mat4):Mat4

Sets this matrix to this - m and returns this.

@:value({ columnMajor : false })inlinetoArray (columnMajor:Bool = false):Array<Float>

Returns an array of the elements of this matrix.

If columnMajor is true, the array is arranged in column-major order. -Otherwise, the array is arranged in row-major order.

toString ():String

Returns the string representation of the matrix.

inline trace ():Float

Returns the trace.

inline transpose ():Mat4

Returns the transposed matrix.

inline transposeEq ():Mat4

Sets this matrix to the transposed matrix and returns this.

Static variables

staticnumCreations:Int

The number of instance creation.

\ No newline at end of file +Otherwise, the array is arranged in row-major order.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat4

Returns the transposed matrix.

inlinetransposeEq ():Mat4

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/MathUtil.html b/docs/oimo/common/MathUtil.html index 502b03d..9274ccb 100644 --- a/docs/oimo/common/MathUtil.html +++ b/docs/oimo/common/MathUtil.html @@ -1,11 +1,11 @@ -oimo.common.MathUtil - OimoPhysics API documentation

This class provides mathematical operations for internal purposes.

Static variables

staticinline read onlyHALF_PI:Float

Shorthand for PI / 2.

staticinline read onlyNEGATIVE_INFINITY:Float

Negative infinity.

staticinline read onlyPI:Float

The ratio of the circumference of a circle to its diameter.

staticinline read onlyPOSITIVE_INFINITY:Float

Positive infinity.

staticinline read onlyTO_DEGREES:Float

Shorthand for 180 / PI.

staticinline read onlyTO_RADIANS:Float

Shorthand for PI / 180.

staticinline read onlyTWO_PI:Float

Shorthand for PI * 2.

Static methods

staticinline abs (x:Float):Float

Returns the absolute value of x.

staticinline acos (x:Float):Float

Returns Math.acos(x).

staticinline asin (x:Float):Float

Returns Math.asin(x).

staticinline atan (x:Float):Float

Returns Math.atan(x).

staticinline atan2 (y:Float, x:Float):Float

Returns Math.atan2(y, x)

staticinline clamp (x:Float, min:Float, max:Float):Float

Returns a clamped value of x from min to max.

staticinline cos (x:Float):Float

Returns Math.cos(x).

staticinline rand ():Float

Returns Math.random().

staticinline randIn (min:Float, max:Float):Float

Returns a random value from min inclusive to max exclusive.

staticinline randVec3 ():Vec3

Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

staticinline randVec3In (min:Float, max:Float):Vec3

Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

staticinline safeAcos (x:Float):Float

Returns Math.acos(clamp(-1, x, 1)). -This never returns NaN as long as x is not NaN.

staticinline safeAsin (x:Float):Float

Returns Math.asin(clamp(-1, x, 1)). -This never returns NaN as long as x is not NaN.

staticinline sin (x:Float):Float

Returns Math.sin(x).

staticinline sqrt (x:Float):Float

Returns Math.sqrt(x).

staticinline tan (x:Float):Float

Returns Math.tan(x).

\ No newline at end of file +

This class provides mathematical operations for internal purposes.

Static variables

@:value(PI / 2)staticinlineread onlyHALF_PI:Float = PI / 2

Shorthand for PI / 2.

@:value(-1e65536)staticinlineread onlyNEGATIVE_INFINITY:Float = -1e65536

Negative infinity.

@:value(3.14159265358979)staticinlineread onlyPI:Float = 3.14159265358979

The ratio of the circumference of a circle to its diameter.

@:value(1e65536)staticinlineread onlyPOSITIVE_INFINITY:Float = 1e65536

Positive infinity.

@:value(180 / PI)staticinlineread onlyTO_DEGREES:Float = 180 / PI

Shorthand for 180 / PI.

@:value(PI / 180)staticinlineread onlyTO_RADIANS:Float = PI / 180

Shorthand for PI / 180.

@:value(PI * 2)staticinlineread onlyTWO_PI:Float = PI * 2

Shorthand for PI * 2.

Static methods

staticinlineabs (x:Float):Float

Returns the absolute value of x.

staticinlineacos (x:Float):Float

Returns Math.acos(x).

staticinlineasin (x:Float):Float

Returns Math.asin(x).

staticinlineatan (x:Float):Float

Returns Math.atan(x).

staticinlineatan2 (y:Float, x:Float):Float

Returns Math.atan2(y, x)

staticinlineclamp (x:Float, min:Float, max:Float):Float

Returns a clamped value of x from min to max.

staticinlinecos (x:Float):Float

Returns Math.cos(x).

staticinlinerand ():Float

Returns Math.random().

staticinlinerandIn (min:Float, max:Float):Float

Returns a random value from min inclusive to max exclusive.

staticinlinerandVec3 ():Vec3

Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

staticinlinerandVec3In (min:Float, max:Float):Vec3

Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

staticinlinesafeAcos (x:Float):Float

Returns Math.acos(clamp(-1, x, 1)). +This never returns NaN as long as x is not NaN.

staticinlinesafeAsin (x:Float):Float

Returns Math.asin(clamp(-1, x, 1)). +This never returns NaN as long as x is not NaN.

staticinlinesin (x:Float):Float

Returns Math.sin(x).

staticinlinesqrt (x:Float):Float

Returns Math.sqrt(x).

staticinlinetan (x:Float):Float

Returns Math.tan(x).

\ No newline at end of file diff --git a/docs/oimo/common/Pool.html b/docs/oimo/common/Pool.html index 0641ac2..e72eb34 100644 --- a/docs/oimo/common/Pool.html +++ b/docs/oimo/common/Pool.html @@ -1,13 +1,13 @@ -oimo.common.Pool - OimoPhysics API documentation

The object pool system of Vec3, Mat3, Mat4, and Quat.

Constructor

new ()

Default constructor.

Methods

inline dispose (?vec3:Vec3, ?mat3:Mat3, ?mat4:Mat4, ?quat:Quat):Void

Disposes an object got from Pool.vec3, Pool.mat3, Pool.mat4, or Pool.quat.

inline disposeMat3 (m:Mat3):Void

Disposes an Mat3 object got from Pool.mat3.

inline disposeMat4 (m:Mat4):Void

Disposes an Mat4 object got from Pool.mat4.

inline disposeQuat (q:Quat):Void

Disposes an Quat object got from Pool.quat.

inline disposeVec3 (v:Vec3):Void

Disposes an Vec3 object got from Pool.vec3.

inline mat3 ():Mat3

Returns a Mat3 object. If an unused object of Mat3 is pooled, this does -not create a new instance.

inline mat4 ():Mat4

Returns a Mat4 object. If an unused object of Vec3 is pooled, this does -not create a new instance.

inline quat ():Quat

Returns a Quat object. If an unused object of Quat is pooled, this does -not create a new instance.

inline vec3 ():Vec3

Returns a Vec3 object. If an unused object of Vec3 is pooled, this does -not create a new instance.

\ No newline at end of file +

The object pool system of Vec3, Mat3, Mat4, and Quat.

Constructor

new ()

Default constructor.

Methods

inlinedispose (?vec3:Vec3, ?mat3:Mat3, ?mat4:Mat4, ?quat:Quat):Void

Disposes an object got from Pool.vec3, Pool.mat3, Pool.mat4, or Pool.quat.

inlinedisposeMat3 (m:Mat3):Void

Disposes an Mat3 object got from Pool.mat3.

inlinedisposeMat4 (m:Mat4):Void

Disposes an Mat4 object got from Pool.mat4.

inlinedisposeQuat (q:Quat):Void

Disposes an Quat object got from Pool.quat.

inlinedisposeVec3 (v:Vec3):Void

Disposes an Vec3 object got from Pool.vec3.

inlinemat3 ():Mat3

Returns a Mat3 object. If an unused object of Mat3 is pooled, this does +not create a new instance.

inlinemat4 ():Mat4

Returns a Mat4 object. If an unused object of Vec3 is pooled, this does +not create a new instance.

inlinequat ():Quat

Returns a Quat object. If an unused object of Quat is pooled, this does +not create a new instance.

inlinevec3 ():Vec3

Returns a Vec3 object. If an unused object of Vec3 is pooled, this does +not create a new instance.

\ No newline at end of file diff --git a/docs/oimo/common/Quat.html b/docs/oimo/common/Quat.html index 8b5cde9..77185ed 100644 --- a/docs/oimo/common/Quat.html +++ b/docs/oimo/common/Quat.html @@ -1,14 +1,14 @@ -oimo.common.Quat - OimoPhysics API documentation

Quaternion class.

Constructor

inline new (?x:Float, ?y:Float, ?z:Float, ?w:Float)

Creates a new quaternion. The quaternion is identity by default.

Variables

w:Float

The real part of the quaternion.

x:Float

The x-value of the imaginary part of the quaternion.

y:Float

The y-value of the imaginary part of the quaternion.

z:Float

The z-value of the imaginary part of the quaternion.

Methods

inline add (q:Quat):Quat

Returns this + v.

inline addEq (q:Quat):Quat

Sets this quaternion to this + v and returns this.

inline clone ():Quat

Returns a clone of the quaternion.

inline copyFrom (q:Quat):Quat

Copies values from q and returns this.

inline dot (q:Quat):Float

Returns the dot product of this and q.

inline fromMat3 (m:Mat3):Quat

Sets this quaternion to the representation of the matrix m, and returns this.

-

The matrix m must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

inline identity ():Quat

Sets the quaternion to identity quaternion and returns this.

inline init (x:Float, y:Float, z:Float, w:Float):Quat

Sets all values at once and returns this.

inline length ():Float

Returns the length of the quaternion.

inline lengthSq ():Float

Returns the squared length of the quaternion.

inline normalize ():Quat

Sets this quaternion to the normalized quaternion and returns this.

-

If the length is zero, this quaternion is set to zero quaternion.

inline normalized ():Quat

Returns the normalized quaternion.

-

If the length is zero, zero quaterinon is returned.

inline scale (s:Float):Quat

Returns this * s.

inline scaleEq (s:Float):Quat

Sets this quaternion to this * s and returns this.

setArc (v1:Vec3, v2:Vec3):Quat

Sets this quaternion to the quaternion representing the shortest arc -rotation from v1 to v2, and return this.

slerp (q:Quat, t:Float):Quat

Returns the spherical linear interpolation between two quaternions this and q with interpolation paraeter t. -Both quaternions this and q must be normalized.

inline sub (q:Quat):Quat

Returns this - v.

inline subEq (q:Quat):Quat

Sets this quaternion to this - v and returns this.

inline toMat3 ():Mat3

Returns a rotation matrix which represents this quaternion.

inline toString ():String

Returns the string representation of the quaternion.

Static variables

staticnumCreations:Int

The number of instance creation.

\ No newline at end of file +

Quaternion class.

Constructor

@:value({ w : 1, z : 0, y : 0, x : 0 })inlinenew (x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1)

Creates a new quaternion. The quaternion is identity by default.

Variables

w:Float

The real part of the quaternion.

x:Float

The x-value of the imaginary part of the quaternion.

y:Float

The y-value of the imaginary part of the quaternion.

z:Float

The z-value of the imaginary part of the quaternion.

Methods

inlineadd (q:Quat):Quat

Returns this + v.

inlineaddEq (q:Quat):Quat

Sets this quaternion to this + v and returns this.

inlineclone ():Quat

Returns a clone of the quaternion.

inlinecopyFrom (q:Quat):Quat

Copies values from q and returns this.

inlinedot (q:Quat):Float

Returns the dot product of this and q.

inlinefromMat3 (m:Mat3):Quat

Sets this quaternion to the representation of the matrix m, and returns this.

+

The matrix m must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

inlineidentity ():Quat

Sets the quaternion to identity quaternion and returns this.

inlineinit (x:Float, y:Float, z:Float, w:Float):Quat

Sets all values at once and returns this.

inlinelength ():Float

Returns the length of the quaternion.

inlinelengthSq ():Float

Returns the squared length of the quaternion.

inlinenormalize ():Quat

Sets this quaternion to the normalized quaternion and returns this.

+

If the length is zero, this quaternion is set to zero quaternion.

inlinenormalized ():Quat

Returns the normalized quaternion.

+

If the length is zero, zero quaterinon is returned.

inlinescale (s:Float):Quat

Returns this * s.

inlinescaleEq (s:Float):Quat

Sets this quaternion to this * s and returns this.

setArc (v1:Vec3, v2:Vec3):Quat

Sets this quaternion to the quaternion representing the shortest arc +rotation from v1 to v2, and return this.

slerp (q:Quat, t:Float):Quat

Returns the spherical linear interpolation between two quaternions this and q with interpolation paraeter t. +Both quaternions this and q must be normalized.

inlinesub (q:Quat):Quat

Returns this - v.

inlinesubEq (q:Quat):Quat

Sets this quaternion to this - v and returns this.

inlinetoMat3 ():Mat3

Returns a rotation matrix which represents this quaternion.

inlinetoString ():String

Returns the string representation of the quaternion.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/Setting.html b/docs/oimo/common/Setting.html index c024784..d832bed 100644 --- a/docs/oimo/common/Setting.html +++ b/docs/oimo/common/Setting.html @@ -1,9 +1,9 @@ -oimo.common.Setting - OimoPhysics API documentation
\ No newline at end of file +

Setting provides advenced parameters used by the physics simulation.

Static variables

@:value(PositionCorrectionAlgorithm._SPLIT_IMPULSE)staticalternativeContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._SPLIT_IMPULSE

@:value(1 * MathUtil.TO_RADIANS)staticangularSlop:Float = 1 * MathUtil.TO_RADIANS

@:value(0.45)staticbvhIncrementalCollisionThreshold:Float = 0.45

@:value(0.1)staticbvhProxyPadding:Float = 0.1

@:value(0.5)staticcontactEnableBounceThreshold:Float = 0.5

@:value(0.05)staticcontactPersistenceThreshold:Float = 0.05

@:value(1)staticdefaultCollisionGroup:Int = 1

@:value(1)staticdefaultCollisionMask:Int = 1

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(1)staticdefaultDensity:Float = 1

@:value(0.2)staticdefaultFriction:Float = 0.2

@:value(0.05)staticdefaultGJKMargin:Float = 0.05

@:value(ConstraintSolverType._ITERATIVE)staticdefaultJointConstraintSolverType:Int = ConstraintSolverType._ITERATIVE

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultJointPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(0.2)staticdefaultRestitution:Float = 0.2

@:value(1e-9)staticdirectMlcpSolverEps:Float = 1e-9

@:value(false)staticdisableSleeping:Bool = false

@:value(true)staticenableGJKCaching:Bool = true

@:value(128)staticislandInitialConstraintArraySize:Int = 128

@:value(128)staticislandInitialRigidBodyArraySize:Int = 128

@:value(0.95)staticjointWarmStartingFactor:Float = 0.95

@:value(0.8)staticjointWarmStartingFactorForBaungarte:Float = 0.8

@:value(0.005)staticlinearSlop:Float = 0.005

@:value(128)staticmaxEPAPolyhedronFaces:Int = 128

@:value(128)staticmaxEPAVertices:Int = 128

@:value(6)staticmaxJacobianRows:Int = 6

@:value(4)staticmaxManifoldPoints:Int = 4

@:value(MathUtil.PI)staticmaxRotationPerStep:Float = MathUtil.PI

@:value(20)staticmaxTranslationPerStep:Float = 20

@:value(1e-6)staticminRagdollMaxSwingAngle:Float = 1e-6

@:value(1e-6)staticminSpringDamperDampingRatio:Float = 1e-6

@:value(1.0)staticpositionNgsBaumgarte:Float = 1.0

@:value(0.4)staticpositionSplitImpulseBaumgarte:Float = 0.4

@:value(0.5)staticsleepingAngularVelocityThreshold:Float = 0.5

@:value(1.0)staticsleepingTimeThreshold:Float = 1.0

@:value(0.2)staticsleepingVelocityThreshold:Float = 0.2

@:value(0.2)staticvelocityBaumgarte:Float = 0.2

\ No newline at end of file diff --git a/docs/oimo/common/Transform.html b/docs/oimo/common/Transform.html index 53ac0f2..8b2abe6 100644 --- a/docs/oimo/common/Transform.html +++ b/docs/oimo/common/Transform.html @@ -1,12 +1,12 @@ -oimo.common.Transform - OimoPhysics API documentation

Transform class provides a set of translation and rotation.

Constructor

new ()

Creates a new identical transform.

Methods

inline clone ():Transform

Returns a clone of the transformation.

inline copyFrom (transform:Transform):Transform

Sets the transformation to transform and returns this.

inline getOrientation ():Quat

Returns the rotation as a quaternion.

inline getOrientationTo (orientation:Quat):Void

Sets orientation to the quaternion representing the rotation.

-

This does not create a new instance of Quat.

inline getPosition ():Vec3

Returns the position of the transformation.

inline getPositionTo (position:Vec3):Void

Sets position to the position of the transformation.

-

This does not create a new instance of Vec3.

inline getRotation ():Mat3

Returns the rotation matrix.

inline getRotationTo (out:Mat3):Void

Sets out to the rotation matrix.

-

This does not create a new instance of Mat3.

inline identity ():Transform

Sets the transformation to identity and returns this.

inline rotate (rotation:Mat3):Void

Applies rotation by the rotation matrix rotation.

inline rotateXyz (eulerAngles:Vec3):Void

Applies the rotation by Euler angles eulerAngles in radians.

inline setOrientation (quaternion:Quat):Transform

Sets the rotation from a quaternion quaternion and returns this.

inline setPosition (position:Vec3):Transform

Sets the position of the transformation to position and returns this.

inline setRotation (rotation:Mat3):Transform

Sets the rotation matrix to rotation and returns this.

inline setRotationXyz (eulerAngles:Vec3):Void

Sets the rotation by Euler angles eulerAngles in radians.

inline translate (translation:Vec3):Void

Translates the position by translation.

\ No newline at end of file +

Transform class provides a set of translation and rotation.

Constructor

new ()

Creates a new identical transform.

Methods

inlineclone ():Transform

Returns a clone of the transformation.

inlinecopyFrom (transform:Transform):Transform

Sets the transformation to transform and returns this.

inlinegetOrientation ():Quat

Returns the rotation as a quaternion.

inlinegetOrientationTo (orientation:Quat):Void

Sets orientation to the quaternion representing the rotation.

+

This does not create a new instance of Quat.

inlinegetPosition ():Vec3

Returns the position of the transformation.

inlinegetPositionTo (position:Vec3):Void

Sets position to the position of the transformation.

+

This does not create a new instance of Vec3.

inlinegetRotation ():Mat3

Returns the rotation matrix.

inlinegetRotationTo (out:Mat3):Void

Sets out to the rotation matrix.

+

This does not create a new instance of Mat3.

inlineidentity ():Transform

Sets the transformation to identity and returns this.

inlinerotate (rotation:Mat3):Void

Applies rotation by the rotation matrix rotation.

inlinerotateXyz (eulerAngles:Vec3):Void

Applies the rotation by Euler angles eulerAngles in radians.

inlinesetOrientation (quaternion:Quat):Transform

Sets the rotation from a quaternion quaternion and returns this.

inlinesetPosition (position:Vec3):Transform

Sets the position of the transformation to position and returns this.

inlinesetRotation (rotation:Mat3):Transform

Sets the rotation matrix to rotation and returns this.

inlinesetRotationXyz (eulerAngles:Vec3):Void

Sets the rotation by Euler angles eulerAngles in radians.

inlinetranslate (translation:Vec3):Void

Translates the position by translation.

\ No newline at end of file diff --git a/docs/oimo/common/Vec3.html b/docs/oimo/common/Vec3.html index a6b83cf..4374aba 100644 --- a/docs/oimo/common/Vec3.html +++ b/docs/oimo/common/Vec3.html @@ -1,11 +1,11 @@ -oimo.common.Vec3 - OimoPhysics API documentation

3D vector class.

Constructor

inline new (?x:Float, ?y:Float, ?z:Float)

Creates a new vector. The vector is zero vector by default.

Variables

x:Float

The x-value of the vector.

y:Float

The y-value of the vector.

z:Float

The z-value of the vector.

Methods

inline add (v:Vec3):Vec3

Returns this + v.

inline addEq (v:Vec3):Vec3

Sets this vector to this + v and returns this.

inline addScaled (v:Vec3, s:Float):Vec3

Returns this + v * s.

inline addScaledEq (v:Vec3, s:Float):Vec3

Sets this vector to this + v * s and returns this.

inline clone ():Vec3

Returns a clone of the vector.

inline copyFrom (v:Vec3):Vec3

Copies values from v and returns this.

inline cross (v:Vec3):Vec3

Returns the cross product of this and v.

inline crossEq (v:Vec3):Vec3

Sets this vector to the cross product of this and s, and returns this.

inline dot (v:Vec3):Float

Returns the dot product of this and v.

init (x:Float, y:Float, z:Float):Vec3

Sets all values at once and returns this.

inline length ():Float

Returns the length of the vector.

inline lengthSq ():Float

Returns the squared length of the vector.

inline mulMat3 (m:Mat3):Vec3

Returns the transformed vector by m.

inline mulMat3Eq (m:Mat3):Vec3

Sets this vector to the transformed vector by m and returns this.

inline mulMat4 (m:Mat4):Vec3

Returns the transformed vector by m.

inline mulMat4Eq (m:Mat4):Vec3

Sets this vector to the transformed vector by m and returns this.

inline mulTransform (tf:Transform):Vec3

Returns the transformed vector by tf.

inline mulTransformEq (tf:Transform):Vec3

Sets this vector to the transformed vector by tf and returns this.

inline negate ():Vec3

Returns the nagated vector.

inline negateEq ():Vec3

Negate the vector and returns this.

inline normalize ():Vec3

Normalize this vector and returns this.

-

If the length is zero, this vector is set to zero vector.

inline normalized ():Vec3

Returns the normalized vector.

-

If the length is zero, zero vector is returned.

inline scale (s:Float):Vec3

Returns this * s.

inline scale3 (sx:Float, sy:Float, sz:Float):Vec3

Returns (this.x * sx, this.y * sy, this.z * sz).

inline scale3Eq (sx:Float, sy:Float, sz:Float):Vec3

Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

inline scaleEq (s:Float):Vec3

Sets this vector to this * s and returns this.

inline sub (v:Vec3):Vec3

Returns this - v.

inline subEq (v:Vec3):Vec3

Sets this vector to this - v and returns this.

toString ():String

Returns the string representation of the vector.

zero ():Vec3

Sets this vector to zero vector and returns this.

Static variables

staticnumCreations:Int

The number of instance creation.

\ No newline at end of file +

3D vector class.

Constructor

@:value({ z : 0, y : 0, x : 0 })inlinenew (x:Float = 0, y:Float = 0, z:Float = 0)

Creates a new vector. The vector is zero vector by default.

Variables

x:Float

The x-value of the vector.

y:Float

The y-value of the vector.

z:Float

The z-value of the vector.

Methods

inlineadd (v:Vec3):Vec3

Returns this + v.

inlineadd3 (vx:Float, vy:Float, vz:Float):Vec3

Returns (this.x + vx, this.y + vy, this.z + vz).

inlineadd3Eq (vx:Float, vy:Float, vz:Float):Vec3

Sets this vector to (this.x + vx, this.y + vy, this.z + vz) and returns this.

inlineaddEq (v:Vec3):Vec3

Sets this vector to this + v and returns this.

inlineaddScaled (v:Vec3, s:Float):Vec3

Returns this + v * s.

inlineaddScaledEq (v:Vec3, s:Float):Vec3

Sets this vector to this + v * s and returns this.

inlineclone ():Vec3

Returns a clone of the vector.

inlinecopyFrom (v:Vec3):Vec3

Copies values from v and returns this.

inlinecross (v:Vec3):Vec3

Returns the cross product of this and v.

inlinecrossEq (v:Vec3):Vec3

Sets this vector to the cross product of this and s, and returns this.

inlinedot (v:Vec3):Float

Returns the dot product of this and v.

init (x:Float, y:Float, z:Float):Vec3

Sets all values at once and returns this.

inlinelength ():Float

Returns the length of the vector.

inlinelengthSq ():Float

Returns the squared length of the vector.

inlinemulMat3 (m:Mat3):Vec3

Returns the transformed vector by m.

inlinemulMat3Eq (m:Mat3):Vec3

Sets this vector to the transformed vector by m and returns this.

inlinemulMat4 (m:Mat4):Vec3

Returns the transformed vector by m.

inlinemulMat4Eq (m:Mat4):Vec3

Sets this vector to the transformed vector by m and returns this.

inlinemulTransform (tf:Transform):Vec3

Returns the transformed vector by tf.

inlinemulTransformEq (tf:Transform):Vec3

Sets this vector to the transformed vector by tf and returns this.

inlinenegate ():Vec3

Returns the nagated vector.

inlinenegateEq ():Vec3

Negate the vector and returns this.

inlinenormalize ():Vec3

Normalize this vector and returns this.

+

If the length is zero, this vector is set to zero vector.

inlinenormalized ():Vec3

Returns the normalized vector.

+

If the length is zero, zero vector is returned.

inlinescale (s:Float):Vec3

Returns this * s.

inlinescale3 (sx:Float, sy:Float, sz:Float):Vec3

Returns (this.x * sx, this.y * sy, this.z * sz).

inlinescale3Eq (sx:Float, sy:Float, sz:Float):Vec3

Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

inlinescaleEq (s:Float):Vec3

Sets this vector to this * s and returns this.

inlinesub (v:Vec3):Vec3

Returns this - v.

inlinesub3 (vx:Float, vy:Float, vz:Float):Vec3

Returns (this.x - vx, this.y - vy, this.z - vz).

inlinesub3Eq (vx:Float, vy:Float, vz:Float):Vec3

Sets this vector to (this.x - vx, this.y - vy, this.z - vz) and returns this.

inlinesubEq (v:Vec3):Vec3

Sets this vector to this - v and returns this.

toString ():String

Returns the string representation of the vector.

zero ():Vec3

Sets this vector to zero vector and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/index.html b/docs/oimo/common/index.html index 995710d..4beed28 100644 --- a/docs/oimo/common/index.html +++ b/docs/oimo/common/index.html @@ -1,9 +1,9 @@ -oimo.common - OimoPhysics API documentation

oimo.common

OimoPhysics API Documentation

..
Mat3

3x3 Matrix class.

Mat4

4x4 Matrix class.

MathUtil

This class provides mathematical operations for internal purposes.

Pool

The object pool system of Vec3, Mat3, Mat4, and Quat.

Quat

Quaternion class.

Setting

Setting provides advenced parameters used by the physics simulation.

Transform

Transform class provides a set of translation and rotation.

Vec3

3D vector class.

\ No newline at end of file +

oimo.common

OimoPhysics API Documentation

..
Mat3

3x3 Matrix class.

Mat4

4x4 Matrix class.

MathUtil

This class provides mathematical operations for internal purposes.

Pool

The object pool system of Vec3, Mat3, Mat4, and Quat.

Quat

Quaternion class.

Setting

Setting provides advenced parameters used by the physics simulation.

Transform

Transform class provides a set of translation and rotation.

Vec3

3D vector class.

\ No newline at end of file diff --git a/docs/oimo/dynamics/Contact.html b/docs/oimo/dynamics/Contact.html index 37f963b..4daef28 100644 --- a/docs/oimo/dynamics/Contact.html +++ b/docs/oimo/dynamics/Contact.html @@ -1,15 +1,15 @@ -oimo.dynamics.Contact - OimoPhysics API documentation

A contact is a cached pair of overlapping shapes in the physics world. contacts -are created by ContactManager when two AABBs of shapes begin overlapping.

+

A contact is a cached pair of overlapping shapes in the physics world. contacts +are created by ContactManager when two AABBs of shapes begin overlapping.

As AABBs are larger than its shapes, shapes of a contact don't always -touching or colliding though their AABBs are overlapping.

Methods

inline getContactConstraint ():ContactConstraint

Returns the contact constraint.

inline getManifold ():Manifold

Returns the contact manifold.

inline getNext ():Contact

Returns the next contact in the world.

-

If the next contact does not exist, null will be returned.

inline getPrev ():Contact

Returns the previous contact in the world.

-

If the previous contact does not exist, null will be returned.

inline getShape1 ():Shape

Returns the first shape of the contact.

inline getShape2 ():Shape

Returns the second shape of the contact.

inline isTouching ():Bool

Returns whether the shapes are touching.

\ No newline at end of file +touching or colliding though their AABBs are overlapping.

Methods

inlinegetContactConstraint ():ContactConstraint

Returns the contact constraint.

inlinegetManifold ():Manifold

Returns the contact manifold.

inlinegetNext ():Contact

Returns the next contact in the world.

+

If the next contact does not exist, null will be returned.

inlinegetPrev ():Contact

Returns the previous contact in the world.

+

If the previous contact does not exist, null will be returned.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

inlineisTouching ():Bool

Returns whether the shapes are touching.

\ No newline at end of file diff --git a/docs/oimo/dynamics/ContactLink.html b/docs/oimo/dynamics/ContactLink.html index a117b32..3e4c8cc 100644 --- a/docs/oimo/dynamics/ContactLink.html +++ b/docs/oimo/dynamics/ContactLink.html @@ -1,16 +1,16 @@ -oimo.dynamics.ContactLink - OimoPhysics API documentationoimo.dynamics.ContactLink - OimoPhysics API documentation

A contact link is used to build a constraint graph for clustering rigid bodies. +

A contact link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also JointLink.

Methods

inline getContact ():Contact

Returns the contact of the link.

inline getNext ():ContactLink

Returns the next contact link in the rigid body.

-

If the next one does not exist, null will be returned.

inline getOther ():RigidBody

Returns the other rigid body of the link. This provides a quick access from a -rigid body to the other one of the contact.

inline getPrev ():ContactLink

Returns the previous contact link in the rigid body.

-

If the previous one does not exist, null will be returned.

\ No newline at end of file +See also JointLink.

Methods

inlinegetContact ():Contact

Returns the contact of the link.

inlinegetNext ():ContactLink

Returns the next contact link in the rigid body.

+

If the next one does not exist, null will be returned.

inlinegetOther ():RigidBody

Returns the other rigid body of the link. This provides a quick access from a +rigid body to the other one of the contact.

inlinegetPrev ():ContactLink

Returns the previous contact link in the rigid body.

+

If the previous one does not exist, null will be returned.

\ No newline at end of file diff --git a/docs/oimo/dynamics/ContactManager.html b/docs/oimo/dynamics/ContactManager.html index 22120c8..f2ddb61 100644 --- a/docs/oimo/dynamics/ContactManager.html +++ b/docs/oimo/dynamics/ContactManager.html @@ -1,13 +1,13 @@ -oimo.dynamics.ContactManager - OimoPhysics API documentationoimo.dynamics.ContactManager - OimoPhysics API documentation

The manager of the contacts in the physics world. A contact of two +

The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and -is destroyed when they end overlapping.

Methods

inline getContactList ():Contact

Returns the linked list of the contacts in the world.

inline getNumContacts ():Int

Returns the number of the contacts in the world.

\ No newline at end of file +is destroyed when they end overlapping.

Methods

inlinegetContactList ():Contact

Returns the linked list of the contacts in the world.

inlinegetNumContacts ():Int

Returns the number of the contacts in the world.

\ No newline at end of file diff --git a/docs/oimo/dynamics/TimeStep.html b/docs/oimo/dynamics/TimeStep.html index 06590f0..de01784 100644 --- a/docs/oimo/dynamics/TimeStep.html +++ b/docs/oimo/dynamics/TimeStep.html @@ -1,10 +1,10 @@ -oimo.dynamics.TimeStep - OimoPhysics API documentation

Information of time-step sizes of the simulation.

Variables

dt:Float

The time step of simulation.

dtRatio:Float

The ratio of time steps. Defined by current time step divided by previous -time step.

invDt:Float

The inverse time step of simulation, equivalent to simulation FPS.

\ No newline at end of file +

Information of time-step sizes of the simulation.

Variables

dt:Float

The time step of simulation.

dtRatio:Float

The ratio of time steps. Defined by current time step divided by previous +time step.

invDt:Float

The inverse time step of simulation, equivalent to simulation FPS.

\ No newline at end of file diff --git a/docs/oimo/dynamics/World.html b/docs/oimo/dynamics/World.html index 5cd52d5..2fa0299 100644 --- a/docs/oimo/dynamics/World.html +++ b/docs/oimo/dynamics/World.html @@ -1,16 +1,16 @@ -oimo.dynamics.World - OimoPhysics API documentationoimo.dynamics.World - OimoPhysics API documentation

The physics simulation world. This manages entire the dynamic simulation. You can add -rigid bodies and joints to the world to simulate them.

Constructor

new (?broadPhaseType:Int, ?gravity:Vec3)

Creates a new physics world, with broad-phase collision detection algorithm broadPhaseType and -gravitational acceleration gravity.

Methods

aabbTest (aabb:Aabb, callback:AabbTestCallback):Void

Performs an AABB query. callback.process is called for all shapes that their -AABB and aabb intersect.

addJoint (joint:Joint):Void

Adds the joint joint to the simulation world.

addRigidBody (rigidBody:RigidBody):Void

Adds the rigid body rigidBody to the simulation world.

convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry +

The physics simulation world. This manages entire the dynamic simulation. You can add +rigid bodies and joints to the world to simulate them.

Constructor

@:value({ gravity : null, broadPhaseType : BroadPhaseType._BVH })new (broadPhaseType:Int = BroadPhaseType._BVH, ?gravity:Vec3)

Creates a new physics world, with broad-phase collision detection algorithm broadPhaseType and +gravitational acceleration gravity.

Methods

aabbTest (aabb:Aabb, callback:AabbTestCallback):Void

Performs an AABB query. callback.process is called for all shapes that their +AABB and aabb intersect.

addJoint (joint:Joint):Void

Adds the joint joint to the simulation world.

addRigidBody (rigidBody:RigidBody):Void

Adds the rigid body rigidBody to the simulation world.

convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning -transform begin.

debugDraw ():Void

Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

inline getBroadPhase ():BroadPhase

Returns the broad-phase collision detection algorithm.

inline getContactManager ():ContactManager

Returns the contact manager.

inline getDebugDraw ():DebugDraw

Returns the debug draw interface.

inline getGravity ():Vec3

Returns the gravitational acceleration of the simulation world.

inline getJointList ():Joint

Returns the list of the joints added to the world.

inline getNumIslands ():Int

Returns the number of simulation islands.

inline getNumJoints ():Int

Returns the number of the joints added to the world.

inline getNumPositionIterations ():Int

Returns the number of position iterations of constraint solvers.

inline getNumRigidBodies ():Int

Returns the number of the rigid bodies added to the world.

inline getNumShapes ():Int

Returns the number of the shapes added to the world.

inline getNumVelocityIterations ():Int

Returns the number of velocity iterations of constraint solvers.

inline getRigidBodyList ():RigidBody

Returns the list of the rigid bodies added to the world.

rayCast (begin:Vec3, end:Vec3, callback:RayCastCallback):Void

Performs a ray casting. callback.process is called for all shapes the ray -from begin to end hits.

removeJoint (joint:Joint):Void

Removes the joint joint from the simulation world.

removeRigidBody (rigidBody:RigidBody):Void

Removes the rigid body rigidBody from the simulation world.

inline setDebugDraw (debugDraw:DebugDraw):Void

Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

inline setGravity (gravity:Vec3):Void

Sets the gravitational acceleration of the simulation world to gravity.

inline setNumPositionIterations (numPositionIterations:Int):Void

Sets the number of position iterations of constraint solvers to numPositionIterations.

inline setNumVelocityIterations (numVelocityIterations:Int):Void

Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

step (timeStep:Float):Void

Advances the simulation by the time step timeStep.

\ No newline at end of file +transform begin.

debugDraw ():Void

Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

inlinegetBroadPhase ():BroadPhase

Returns the broad-phase collision detection algorithm.

inlinegetContactManager ():ContactManager

Returns the contact manager.

inlinegetDebugDraw ():DebugDraw

Returns the debug draw interface.

inlinegetGravity ():Vec3

Returns the gravitational acceleration of the simulation world.

inlinegetJointList ():Joint

Returns the list of the joints added to the world.

inlinegetNumIslands ():Int

Returns the number of simulation islands.

inlinegetNumJoints ():Int

Returns the number of the joints added to the world.

inlinegetNumPositionIterations ():Int

Returns the number of position iterations of constraint solvers.

inlinegetNumRigidBodies ():Int

Returns the number of the rigid bodies added to the world.

inlinegetNumShapes ():Int

Returns the number of the shapes added to the world.

inlinegetNumVelocityIterations ():Int

Returns the number of velocity iterations of constraint solvers.

inlinegetRigidBodyList ():RigidBody

Returns the list of the rigid bodies added to the world.

rayCast (begin:Vec3, end:Vec3, callback:RayCastCallback):Void

Performs a ray casting. callback.process is called for all shapes the ray +from begin to end hits.

removeJoint (joint:Joint):Void

Removes the joint joint from the simulation world.

removeRigidBody (rigidBody:RigidBody):Void

Removes the rigid body rigidBody from the simulation world.

inlinesetDebugDraw (debugDraw:DebugDraw):Void

Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

inlinesetGravity (gravity:Vec3):Void

Sets the gravitational acceleration of the simulation world to gravity.

inlinesetNumPositionIterations (numPositionIterations:Int):Void

Sets the number of position iterations of constraint solvers to numPositionIterations.

inlinesetNumVelocityIterations (numVelocityIterations:Int):Void

Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

step (timeStep:Float):Void

Advances the simulation by the time step timeStep.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/AabbTestCallback.html b/docs/oimo/dynamics/callback/AabbTestCallback.html index 8b08332..5377aaa 100644 --- a/docs/oimo/dynamics/callback/AabbTestCallback.html +++ b/docs/oimo/dynamics/callback/AabbTestCallback.html @@ -1,10 +1,10 @@ -oimo.dynamics.callback.AabbTestCallback - OimoPhysics API documentation

A callback interface for aabb tests in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape):Void

This is called every time the world detects a shape shape that -the query aabb intersects.

\ No newline at end of file +

A callback interface for aabb tests in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape):Void

This is called every time the world detects a shape shape that +the query aabb intersects.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/ContactCallback.html b/docs/oimo/dynamics/callback/ContactCallback.html index d40bd94..6b8b9f7 100644 --- a/docs/oimo/dynamics/callback/ContactCallback.html +++ b/docs/oimo/dynamics/callback/ContactCallback.html @@ -1,15 +1,15 @@ -oimo.dynamics.callback.ContactCallback - OimoPhysics API documentationoimo.dynamics.callback.ContactCallback - OimoPhysics API documentation

A callback class for contact events. Contact events between two shapes -will occur in following order:

  1. beginContact
  2. preSolve (before velocity update)
  3. postSolve (after velocity update)
  4. (repeats 2. and 3. every frame while the shapes are touching)
  5. endContact

Constructor

new ()

Default constructor.

Methods

beginContact (c:Contact):Void

This is called when two shapes start touching each other. c is the contact of -the two shapes.

endContact (c:Contact):Void

This is called when two shapes end touching each other. c is the contact of -the two shapes.

postSolve (c:Contact):Void

This is called every frame after velocity solver iterations while two shapes -are touching. c is the contact for the two shapes.

preSolve (c:Contact):Void

This is called every frame before velocity solver iterations while two shapes -are touching. c is the contact for the two shapes.

\ No newline at end of file +

A callback class for contact events. Contact events between two shapes +will occur in following order:

  1. beginContact
  2. preSolve (before velocity update)
  3. postSolve (after velocity update)
  4. (repeats 2. and 3. every frame while the shapes are touching)
  5. endContact

Constructor

new ()

Default constructor.

Methods

beginContact (c:Contact):Void

This is called when two shapes start touching each other. c is the contact of +the two shapes.

endContact (c:Contact):Void

This is called when two shapes end touching each other. c is the contact of +the two shapes.

postSolve (c:Contact):Void

This is called every frame after velocity solver iterations while two shapes +are touching. c is the contact for the two shapes.

preSolve (c:Contact):Void

This is called every frame before velocity solver iterations while two shapes +are touching. c is the contact for the two shapes.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastCallback.html b/docs/oimo/dynamics/callback/RayCastCallback.html index 862cdf2..31387f8 100644 --- a/docs/oimo/dynamics/callback/RayCastCallback.html +++ b/docs/oimo/dynamics/callback/RayCastCallback.html @@ -1,10 +1,10 @@ -oimo.dynamics.callback.RayCastCallback - OimoPhysics API documentation

A callback class for ray casts in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape, hit:RayCastHit):Void

This is called every time the world detects a shape shape that -the ray intersects with the hit data hit.

\ No newline at end of file +

A callback class for ray casts in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape, hit:RayCastHit):Void

This is called every time the world detects a shape shape that +the ray intersects with the hit data hit.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastClosest.html b/docs/oimo/dynamics/callback/RayCastClosest.html index 7f45d30..5c7300a 100644 --- a/docs/oimo/dynamics/callback/RayCastClosest.html +++ b/docs/oimo/dynamics/callback/RayCastClosest.html @@ -1,13 +1,13 @@ -oimo.dynamics.callback.RayCastClosest - OimoPhysics API documentationoimo.dynamics.callback.RayCastClosest - OimoPhysics API documentation

A ray cast callback implementation that keeps only the closest hit data. +

A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

hit:Bool

Whether the ray hit any shape in the world.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

shape:Shape

The shape the ray hit.

Methods

inline clear ():Void

Clears the result data.

Inherited Variables

Inherited Methods

\ No newline at end of file +RayCastClosest.clear if used once or more before.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

hit:Bool

Whether the ray hit any shape in the world.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

shape:Shape

The shape the ray hit.

Methods

inlineclear ():Void

Clears the result data.

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/index.html b/docs/oimo/dynamics/callback/index.html index ceab7fa..38e8b38 100644 --- a/docs/oimo/dynamics/callback/index.html +++ b/docs/oimo/dynamics/callback/index.html @@ -1,12 +1,12 @@ -oimo.dynamics.callback - OimoPhysics API documentation

oimo.dynamics.callback

OimoPhysics API Documentation

..
AabbTestCallback

A callback interface for aabb tests in a world.

ContactCallback

A callback class for contact events. Contact events between two shapes -will occur in following order:

RayCastCallback

A callback class for ray casts in a world.

RayCastClosest

A ray cast callback implementation that keeps only the closest hit data. +

oimo.dynamics.callback

OimoPhysics API Documentation

..
AabbTestCallback

A callback interface for aabb tests in a world.

ContactCallback

A callback class for contact events. Contact events between two shapes +will occur in following order:

RayCastCallback

A callback class for ray casts in a world.

RayCastClosest

A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

\ No newline at end of file +RayCastClosest.clear if used once or more before.

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDraw.html b/docs/oimo/dynamics/common/DebugDraw.html index 7cf1b40..a56ca14 100644 --- a/docs/oimo/dynamics/common/DebugDraw.html +++ b/docs/oimo/dynamics/common/DebugDraw.html @@ -1,23 +1,23 @@ -oimo.dynamics.common.DebugDraw - OimoPhysics API documentation

The interface of debug drawer. This provides graphical information of a physics world +

The interface of debug drawer. This provides graphical information of a physics world for debugging softwares. Users should override at least three methods DebugDraw.point, -DebugDraw.triangle, DebugDraw.line.

Constructor

new ()

Default constructor.

Variables

drawAabbs:Bool

Whether to draw the AABBs.

drawBases:Bool

Whether to draw the bases of the rigid bodies.

drawBvh:Bool

Whether to draw the bounding volume hierarchy of the broad-phase collision -detection. If BvhBroadPhase is not used, nothing will be drawn regardless -of the value of this parameter.

drawBvhMaxLevel:Int

The maximum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to -false, the entire BVH will not be drawn.

drawBvhMinLevel:Int

The minimum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to -false, the entire BVH will not be drawn.

drawContactBases:Bool

Whether to draw the bases (normals, tangents, and binormals) of the contacts.

drawContacts:Bool

Whether to draw the contacts.

drawJointLimits:Bool

Whether to draw the limits of the joints.

drawJoints:Bool

Whether to draw the joints.

drawPairs:Bool

Whether to draw the overlapping pairs of the AABBs.

drawShapes:Bool

Whether to draw the shapes.

style:DebugDrawStyle

The rendering style of the debug draw.

wireframe:Bool

Whether the shapes are drawn in wireframe mode.

Methods

aabb (min:Vec3, max:Vec3, color:Vec3):Void

Draws an axis-aligned bounding box.

+DebugDraw.triangle, DebugDraw.line.

Constructor

new ()

Default constructor.

Variables

drawAabbs:Bool

Whether to draw the AABBs.

drawBases:Bool

Whether to draw the bases of the rigid bodies.

drawBvh:Bool

Whether to draw the bounding volume hierarchy of the broad-phase collision +detection. If BvhBroadPhase is not used, nothing will be drawn regardless +of the value of this parameter.

drawBvhMaxLevel:Int

The maximum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to +false, the entire BVH will not be drawn.

drawBvhMinLevel:Int

The minimum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to +false, the entire BVH will not be drawn.

drawContactBases:Bool

Whether to draw the bases (normals, tangents, and binormals) of the contacts.

drawContacts:Bool

Whether to draw the contacts.

drawJointLimits:Bool

Whether to draw the limits of the joints.

drawJoints:Bool

Whether to draw the joints.

drawPairs:Bool

Whether to draw the overlapping pairs of the AABBs.

drawShapes:Bool

Whether to draw the shapes.

style:DebugDrawStyle

The rendering style of the debug draw.

wireframe:Bool

Whether the shapes are drawn in wireframe mode.

Methods

aabb (min:Vec3, max:Vec3, color:Vec3):Void

Draws an axis-aligned bounding box.

min is the minimum point of the AABB.

max is the maximum point of the AABB.

-

color is the color of the AABB.

arc (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, startAngle:Float, endAngle:Float, drawSector:Bool, color:Vec3):Void

Draws an arc.

+

color is the color of the AABB.

arc (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, startAngle:Float, endAngle:Float, drawSector:Bool, color:Vec3):Void

Draws an arc.

center is the center of the arc.

ex is the normalized x-axis vector of the arc.

ey is the normalized y-axis vector of the arc.

@@ -26,42 +26,42 @@

startAngle is the start angle of the arc in radians.

endAngle is the end angle of the arc in radians.

drawSector is whether to draw line segments between start/end point and center point.

-

color is the color of the arc.

basis (transform:Transform, length:Float, colorX:Vec3, colorY:Vec3, colorZ:Vec3):Void

Draws the basis of a transform transform.

+

color is the color of the arc.

basis (transform:Transform, length:Float, colorX:Vec3, colorY:Vec3, colorZ:Vec3):Void

Draws the basis of a transform transform.

length is the length of the lines to be drawn.

colorX is the color of the x-axis of the basis.

colorY is the color of the y-axis of the basis.

-

colorZ is the color of the z-axis of the basis.

box (tf:Transform, halfExtents:Vec3, color:Vec3):Void

Draws a box.

+

colorZ is the color of the z-axis of the basis.

box (tf:Transform, halfExtents:Vec3, color:Vec3):Void

Draws a box.

tf is the transformation of the box.

halfExtents is the half-extents of the box.

-

color is the color of the box.

capsule (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a capsule locally along to the y-axis.

+

color is the color of the box.

capsule (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a capsule locally along to the y-axis.

tf is the transformation of the capsule.

radius is the radius of the capsule.

halfHeight is the half-height of the capsule.

-

color is the color of the capsule.

cone (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a cone locally along to the y-axis. The center of the cone is in the middle of +

color is the color of the capsule.

cone (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a cone locally along to the y-axis. The center of the cone is in the middle of the vertex and the center of the base circle.

tf is the transformation of the cone.

radius is the radius of the base circle of the cone.

halfHeight is the half-height of the cone. The local position of the vertex of the cone is (0, halfHeight, 0).

-

color is the color of the cone.

cylinder (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a cylinder locally along to the y-axis.

+

color is the color of the cone.

cylinder (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

Draws a cylinder locally along to the y-axis.

tf is the transformation of the cylinder.

radius is the radius of the cylinder.

halfHeight is the half-height of the cylinder.

-

color is the color of the cylinder.

ellipse (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, color:Vec3):Void

Draws an ellipse.

+

color is the color of the cylinder.

ellipse (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, color:Vec3):Void

Draws an ellipse.

center is the center of the ellipse.

ex is the normalized x-axis vector of the ellipse.

ey is the normalized y-axis vector of the ellipse.

radiusX is the radius along the x-axis of the ellipse.

radiusY is the radius along the y-axis of the ellipse.

-

color is the color of the ellipse.

line (v1:Vec3, v2:Vec3, color:Vec3):Void

Draws a line segment between v1 and v2.

-

color is the color of the line segment.

point (v:Vec3, color:Vec3):Void

Draws a point at v.

-

color is the color of the point.

rect (v1:Vec3, v2:Vec3, v3:Vec3, v4:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, n4:Vec3, color:Vec3):Void

Draws a rectangle.

+

color is the color of the ellipse.

line (v1:Vec3, v2:Vec3, color:Vec3):Void

Draws a line segment between v1 and v2.

+

color is the color of the line segment.

point (v:Vec3, color:Vec3):Void

Draws a point at v.

+

color is the color of the point.

rect (v1:Vec3, v2:Vec3, v3:Vec3, v4:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, n4:Vec3, color:Vec3):Void

Draws a rectangle.

v1, v2, v3, v4 are the rectangle's vertices in CCW order.

n1, n2, n3, n4 are the normals of the rectangle's vertices in CCW order.

-

color is the color of the rectangle.

sphere (tf:Transform, radius:Float, color:Vec3):Void

Draws a sphere.

+

color is the color of the rectangle.

sphere (tf:Transform, radius:Float, color:Vec3):Void

Draws a sphere.

tf is the transformation of the sphere.

radius is the radius of the sphere.

-

color is the color of the sphere.

triangle (v1:Vec3, v2:Vec3, v3:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, color:Vec3):Void

Draws a triangle.

+

color is the color of the sphere.

triangle (v1:Vec3, v2:Vec3, v3:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, color:Vec3):Void

Draws a triangle.

v1, v2, v3 are the triangle's vertices in CCW order.

n1, n2, n3 are the normals of the triangle's vertices in CCW order.

-

color is the color of the triangle.

\ No newline at end of file +

color is the color of the triangle.

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDrawStyle.html b/docs/oimo/dynamics/common/DebugDrawStyle.html index 821c427..55d0576 100644 --- a/docs/oimo/dynamics/common/DebugDrawStyle.html +++ b/docs/oimo/dynamics/common/DebugDrawStyle.html @@ -1,9 +1,9 @@ -oimo.dynamics.common.DebugDrawStyle - OimoPhysics API documentation
\ No newline at end of file +

Style settings of the debug draw.

Constructor

new ()

Default constructor.

Variables

@:value(new Vec3(1.0, 0.1, 0.1))aabbColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.0, 0.0))basisColorX:Vec3 = new Vec3(1.0, 0.0, 0.0)

@:value(new Vec3(0.0, 1.0, 0.0))basisColorY:Vec3 = new Vec3(0.0, 1.0, 0.0)

@:value(new Vec3(0.0, 0.0, 1.0))basisColorZ:Vec3 = new Vec3(0.0, 0.0, 1.0)

@:value(0.5)basisLength:Float = 0.5

@:value(new Vec3(0.4, 0.4, 0.4))bvhNodeColor:Vec3 = new Vec3(0.4, 0.4, 0.4)

@:value(new Vec3(0.2, 0.2, 1.0))contactBinormalColor:Vec3 = new Vec3(0.2, 0.2, 1.0)

@:value(0.5)contactBinormalLength:Float = 0.5

@:value(new Vec3(1.0, 0.1, 0.1))contactColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.6, 0.1))contactColor2:Vec3 = new Vec3(1.0, 0.6, 0.1)

@:value(new Vec3(0.1, 0.8, 0.6))contactColor3:Vec3 = new Vec3(0.1, 0.8, 0.6)

@:value(new Vec3(0.8, 0.1, 1.0))contactColor4:Vec3 = new Vec3(0.8, 0.1, 1.0)

@:value(new Vec3(1.0, 0.1, 0.1))contactNormalColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(0.5)contactNormalLength:Float = 0.5

@:value(new Vec3(0.1, 0.8, 0.1))contactTangentColor:Vec3 = new Vec3(0.1, 0.8, 0.1)

@:value(0.5)contactTangentLength:Float = 0.5

@:value(new Vec3(0.5, 0.1, 0.1))disabledContactColor:Vec3 = new Vec3(0.5, 0.1, 0.1)

@:value(new Vec3(1.0, 0.1, 0.1))jointErrorColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(0.8, 0.8, 0.8))jointLineColor:Vec3 = new Vec3(0.8, 0.8, 0.8)

@:value(0.3)jointRotationalConstraintRadius:Float = 0.3

@:value(new Vec3(1.0, 0.5, 0.1))kinematicShapeColor:Vec3 = new Vec3(1.0, 0.5, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))newContactColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))pairColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(0.7, 0.2, 0.4))shapeColor1:Vec3 = new Vec3(0.7, 0.2, 0.4)

@:value(new Vec3(1.0, 0.8, 0.1))shapeColor2:Vec3 = new Vec3(1.0, 0.8, 0.1)

@:value(new Vec3(0.3, 0.3, 0.8))sleepingShapeColor1:Vec3 = new Vec3(0.3, 0.3, 0.8)

@:value(new Vec3(0.2, 0.8, 0.5))sleepingShapeColor2:Vec3 = new Vec3(0.2, 0.8, 0.5)

@:value(new Vec3(0.5, 0.25, 0.6))sleepyShapeColor1:Vec3 = new Vec3(0.5, 0.25, 0.6)

@:value(new Vec3(0.6, 0.8, 0.3))sleepyShapeColor2:Vec3 = new Vec3(0.6, 0.8, 0.3)

@:value(new Vec3(0.7, 0.7, 0.7))staticShapeColor:Vec3 = new Vec3(0.7, 0.7, 0.7)

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/Performance.html b/docs/oimo/dynamics/common/Performance.html index 79bf3e6..9850411 100644 --- a/docs/oimo/dynamics/common/Performance.html +++ b/docs/oimo/dynamics/common/Performance.html @@ -1,9 +1,9 @@ -oimo.dynamics.common.Performance - OimoPhysics API documentation

Performance

Static variables

staticdynamicsTime:Float

statictotalTime:Float

\ No newline at end of file +

Performance

Static variables

@:value(0)staticbroadPhaseCollisionTime:Float = 0

@:value(0)staticdynamicsTime:Float = 0

@:value(0)staticnarrowPhaseCollisionTime:Float = 0

@:value(0)statictotalTime:Float = 0

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/index.html b/docs/oimo/dynamics/common/index.html index 2dd57dc..e5906eb 100644 --- a/docs/oimo/dynamics/common/index.html +++ b/docs/oimo/dynamics/common/index.html @@ -1,11 +1,11 @@ -oimo.dynamics.common - OimoPhysics API documentation

oimo.dynamics.common

OimoPhysics API Documentation

..
DebugDraw

The interface of debug drawer. This provides graphical information of a physics world +

oimo.dynamics.common

OimoPhysics API Documentation

..
DebugDraw

The interface of debug drawer. This provides graphical information of a physics world for debugging softwares. Users should override at least three methods DebugDraw.point, -DebugDraw.triangle, DebugDraw.line.

DebugDrawStyle

Style settings of the debug draw.

Performance

Performance

\ No newline at end of file +DebugDraw.triangle, DebugDraw.line.

DebugDrawStyle

Style settings of the debug draw.

Performance

Performance

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/ConstraintSolver.html b/docs/oimo/dynamics/constraint/ConstraintSolver.html index a0e6687..23f3009 100644 --- a/docs/oimo/dynamics/constraint/ConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/ConstraintSolver.html @@ -1,13 +1,13 @@ -oimo.dynamics.constraint.ConstraintSolver - OimoPhysics API documentation

The base class of all constarint solvers.

Methods

postSolve ():Void

Performs post-processes.

postSolveVelocity (timeStep:TimeStep):Void

Performs post-processes of velocity part. Time step information timeStep is given -for computing time-depending data.

preSolvePosition (timeStep:TimeStep):Void

Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step +

The base class of all constarint solvers.

Methods

postSolve ():Void

Performs post-processes.

postSolveVelocity (timeStep:TimeStep):Void

Performs post-processes of velocity part. Time step information timeStep is given +for computing time-depending data.

preSolvePosition (timeStep:TimeStep):Void

Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step information timeStep is given for computing time-depending data.

-

This may not be called depending on position correction algorithm.

preSolveVelocity (timeStep:TimeStep):Void

Prepares for velocity iteration. Time step information timeStep is given for -computing time-depending data.

solvePositionNgs (timeStep:TimeStep):Void

Performs single position iteration (nonlinear Gauss-Seidel)

solvePositionSplitImpulse ():Void

Performs single position iteration (split impulse)

solveVelocity ():Void

Performs single velocity iteration.

warmStart (timeStep:TimeStep):Void

Applies initial impulses.

\ No newline at end of file +

This may not be called depending on position correction algorithm.

preSolveVelocity (timeStep:TimeStep):Void

Prepares for velocity iteration. Time step information timeStep is given for +computing time-depending data.

solvePositionNgs (timeStep:TimeStep):Void

Performs single position iteration (nonlinear Gauss-Seidel)

solvePositionSplitImpulse ():Void

Performs single position iteration (split impulse)

solveVelocity ():Void

Performs single velocity iteration.

warmStart (timeStep:TimeStep):Void

Applies initial impulses.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html index 348c0d7..6a6a989 100644 --- a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html +++ b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html @@ -1,10 +1,10 @@ -oimo.dynamics.constraint.PositionCorrectionAlgorithm - OimoPhysics API documentation

The list of the algorithms for position corretion.

Static variables

staticread onlyBAUMGARTE:Int

Baumgarte stabilizaiton. Fastest but introduces extra energy.

staticread onlyNGS:Int

Nonlinear Gauss-Seidel method. Slow but stable.

staticread onlySPLIT_IMPULSE:Int

Use split impulse and pseudo velocity. Fast enough and does not introduce extra -energy, but somewhat unstable, especially for joints.

\ No newline at end of file +

The list of the algorithms for position corretion.

Static variables

@:value(_BAUMGARTE)staticread onlyBAUMGARTE:Int = _BAUMGARTE

Baumgarte stabilizaiton. Fastest but introduces extra energy.

@:value(_NGS)staticread onlyNGS:Int = _NGS

Nonlinear Gauss-Seidel method. Slow but stable.

@:value(_SPLIT_IMPULSE)staticread onlySPLIT_IMPULSE:Int = _SPLIT_IMPULSE

Use split impulse and pseudo velocity. Fast enough and does not introduce extra +energy, but somewhat unstable, especially for joints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html index 3627268..cb579f5 100644 --- a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html +++ b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html @@ -1,13 +1,13 @@ -oimo.dynamics.constraint.contact.ContactConstraint - OimoPhysics API documentationoimo.dynamics.constraint.contact.ContactConstraint - OimoPhysics API documentation

A contact constraint provides collision information for a contact constraint solver. +

A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and -contact impulses. See Manifold for more information.

Methods

inline getManifold ():Manifold

Returns the contact manifold.

inline getShape1 ():Shape

Returns the first shape of the contact.

inline getShape2 ():Shape

Returns the second shape of the contact.

isTouching ():Bool

Returns whether the two rigid bodies are touching.

\ No newline at end of file +contact impulses. See Manifold for more information.

Methods

inlinegetManifold ():Manifold

Returns the contact manifold.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

isTouching ():Bool

Returns whether the two rigid bodies are touching.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/Manifold.html b/docs/oimo/dynamics/constraint/contact/Manifold.html index cbd8b89..05e8f1a 100644 --- a/docs/oimo/dynamics/constraint/contact/Manifold.html +++ b/docs/oimo/dynamics/constraint/contact/Manifold.html @@ -1,20 +1,20 @@ -oimo.dynamics.constraint.contact.Manifold - OimoPhysics API documentation

A contact manifold holds collision data of a pair of shapes.

Methods

inline getBinormal ():Vec3

Returns the binormal vector of the contact manifold. The binormal vector has unit -length and is perpendicular to both the normal and the tangent vector.

inline getBinormalTo (binormal:Vec3):Void

Sets binormal to the binormal vector of the contact manifold. The binormal vector has +

A contact manifold holds collision data of a pair of shapes.

Methods

inlinegetBinormal ():Vec3

Returns the binormal vector of the contact manifold. The binormal vector has unit +length and is perpendicular to both the normal and the tangent vector.

inlinegetBinormalTo (binormal:Vec3):Void

Sets binormal to the binormal vector of the contact manifold. The binormal vector has unit length and is perpendicular to both the normal and the tangent vector.

-

This does not create a new instance of Vec3.

inline getNormal ():Vec3

Returns the normal vector of the contact manifold. The normal vector has unit -length and is perpendicular to the contact plane.

inline getNormalTo (normal:Vec3):Void

Sets normal to the normal vector of the contact manifold. The normal vector has +

This does not create a new instance of Vec3.

inlinegetNormal ():Vec3

Returns the normal vector of the contact manifold. The normal vector has unit +length and is perpendicular to the contact plane.

inlinegetNormalTo (normal:Vec3):Void

Sets normal to the normal vector of the contact manifold. The normal vector has unit length and is perpendicular to the contact plane.

-

This does not create a new instance of Vec3.

inline getNumPoints ():Int

Returns the number of existing manifold points.

inline getPoints ():Vector<ManifoldPoint>

Returns the manifold point vector of the contact manifold. Note that only the first +

This does not create a new instance of Vec3.

inlinegetNumPoints ():Int

Returns the number of existing manifold points.

inlinegetPoints ():Vector<ManifoldPoint>

Returns the manifold point vector of the contact manifold. Note that only the first Manifold.getNumPoints elements of the vector are in use, and the manifold points may -be disabled (see ManifoldPoint.isEnabled).

inline getTangent ():Vec3

Returns the tangent vector of the contact manifold. The tangent vector has unit -length and is perpendicular to the normal vector.

inline getTangentTo (tangent:Vec3):Void

Sets tangent to the tangent vector of the contact manifold. The tangent vector has +be disabled (see ManifoldPoint.isEnabled).

inlinegetTangent ():Vec3

Returns the tangent vector of the contact manifold. The tangent vector has unit +length and is perpendicular to the normal vector.

inlinegetTangentTo (tangent:Vec3):Void

Sets tangent to the tangent vector of the contact manifold. The tangent vector has unit length and is perpendicular to the normal vector.

-

This does not create a new instance of Vec3.

\ No newline at end of file +

This does not create a new instance of Vec3.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html index 9c1e9a3..e5a96f6 100644 --- a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html +++ b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.contact.ManifoldPoint - OimoPhysics API documentationoimo.dynamics.constraint.contact.ManifoldPoint - OimoPhysics API documentation

A manifold point is a contact point in a contact manifold. This holds detailed collision -data (position, overlap depth, impulse, etc...) for collision response.

Methods

inline getBinormalImpulse ():Float

Returns the binormal impulse of the manifold point.

inline getDepth ():Float

Returns the amount of the overlap. If the manifold point is separate, a negative -value is returned.

inline getNormalImpulse ():Float

Returns the normal impulse of the manifold point.

inline getPosition1 ():Vec3

Returns the first rigid body's manifold point in world coordinate.

inline getPosition1To (position:Vec3):Void

Sets position to the first rigid body's manifold point in world coordinate. -This does not create a new instance of Vec3.

inline getPosition2 ():Vec3

Returns the second rigid body's manifold point in world coordinate.

inline getPosition2To (position:Vec3):Void

Sets position to the second rigid body's manifold point in world coordinate. -This does not create a new instance of Vec3.

inline getTangentImpulse ():Float

Returns the tangent impulse of the manifold point.

inline isEnabled ():Bool

Returns whether the manifold point is enabled.

inline isWarmStarted ():Bool

Returns whether the manifold point has existed for more than two steps.

\ No newline at end of file +

A manifold point is a contact point in a contact manifold. This holds detailed collision +data (position, overlap depth, impulse, etc...) for collision response.

Methods

inlinegetBinormalImpulse ():Float

Returns the binormal impulse of the manifold point.

inlinegetDepth ():Float

Returns the amount of the overlap. If the manifold point is separate, a negative +value is returned.

inlinegetNormalImpulse ():Float

Returns the normal impulse of the manifold point.

inlinegetPosition1 ():Vec3

Returns the first rigid body's manifold point in world coordinate.

inlinegetPosition1To (position:Vec3):Void

Sets position to the first rigid body's manifold point in world coordinate. +This does not create a new instance of Vec3.

inlinegetPosition2 ():Vec3

Returns the second rigid body's manifold point in world coordinate.

inlinegetPosition2To (position:Vec3):Void

Sets position to the second rigid body's manifold point in world coordinate. +This does not create a new instance of Vec3.

inlinegetTangentImpulse ():Float

Returns the tangent impulse of the manifold point.

inlineisEnabled ():Bool

Returns whether the manifold point is enabled.

inlineisWarmStarted ():Bool

Returns whether the manifold point has existed for more than two steps.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/index.html b/docs/oimo/dynamics/constraint/contact/index.html index e1a2ef6..f6d1a8f 100644 --- a/docs/oimo/dynamics/constraint/contact/index.html +++ b/docs/oimo/dynamics/constraint/contact/index.html @@ -1,12 +1,12 @@ -oimo.dynamics.constraint.contact - OimoPhysics API documentation

oimo.dynamics.constraint.contact

OimoPhysics API Documentation

..
ContactConstraint

A contact constraint provides collision information for a contact constraint solver. +

oimo.dynamics.constraint.contact

OimoPhysics API Documentation

..
ContactConstraint

A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and -contact impulses. See Manifold for more information.

Manifold

A contact manifold holds collision data of a pair of shapes.

ManifoldPoint

A manifold point is a contact point in a contact manifold. This holds detailed collision -data (position, overlap depth, impulse, etc...) for collision response.

\ No newline at end of file +contact impulses. See Manifold for more information.

Manifold

A contact manifold holds collision data of a pair of shapes.

ManifoldPoint

A manifold point is a contact point in a contact manifold. This holds detailed collision +data (position, overlap depth, impulse, etc...) for collision response.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/index.html b/docs/oimo/dynamics/constraint/index.html index 217a9c6..f170623 100644 --- a/docs/oimo/dynamics/constraint/index.html +++ b/docs/oimo/dynamics/constraint/index.html @@ -1,9 +1,9 @@ -oimo.dynamics.constraint - OimoPhysics API documentation

oimo.dynamics.constraint

OimoPhysics API Documentation

..
contact
joint
solver
ConstraintSolver

The base class of all constarint solvers.

PositionCorrectionAlgorithm

The list of the algorithms for position corretion.

\ No newline at end of file +

oimo.dynamics.constraint

OimoPhysics API Documentation

..
contact
joint
solver
ConstraintSolver

The base class of all constarint solvers.

PositionCorrectionAlgorithm

The list of the algorithms for position corretion.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html index 042db2a..6cae1ff 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html @@ -1,7 +1,7 @@ -oimo.dynamics.constraint.joint.CylindricalJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.CylindricalJoint - OimoPhysics API documentation

A cylindrical joint constrains two rigid bodies to share their constraint +

A cylindrical joint constrains two rigid bodies to share their constraint axes, and restricts relative translation and rotation onto the constraint axis. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects of both translation and -rotation part of the constraint.

Constructor

new (config:CylindricalJointConfig)

Creates a new cylindrical joint by configuration config.

Methods

inline getAngle ():Float

Returns the rotation angle in radians.

inline getAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inline getAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inline getAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getRotationalLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings.

inline getRotationalSpringDamper ():SpringDamper

Returns the rotational spring and damper settings.

inline getTranslation ():Float

Returns the translation of the joint.

inline getTranslationalLimitMotor ():TranslationalLimitMotor

Returns the translational limits and motor settings.

inline getTranslationalSpringDamper ():SpringDamper

Returns the translational spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +rotation part of the constraint.

Constructor

new (config:CylindricalJointConfig)

Creates a new cylindrical joint by configuration config.

Methods

inlinegetAngle ():Float

Returns the rotation angle in radians.

inlinegetAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inlinegetAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inlinegetAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetRotationalLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings.

inlinegetRotationalSpringDamper ():SpringDamper

Returns the rotational spring and damper settings.

inlinegetTranslation ():Float

Returns the translation of the joint.

inlinegetTranslationalLimitMotor ():TranslationalLimitMotor

Returns the translational limits and motor settings.

inlinegetTranslationalSpringDamper ():SpringDamper

Returns the translational spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html index 450937f..6a54ccf 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.CylindricalJointConfig - OimoPhysics API documentation

A cylindrical joint config is used for constructions of cylindrical joints.

Constructor

new ()

Default constructor.

Variables

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

rotationalLimitMotor:RotationalLimitMotor

The rotational limit and motor along the constraint axis of the joint.

rotationalSpringDamper:SpringDamper

The rotational spring and damper along the constraint axis of the joint.

translationalLimitMotor:TranslationalLimitMotor

The translational limit and motor along the constraint axis of the joint.

translationalSpringDamper:SpringDamper

The translational spring and damper along constraint the axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):CylindricalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

A cylindrical joint config is used for constructions of cylindrical joints.

Constructor

new ()

Default constructor.

Variables

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

rotationalLimitMotor:RotationalLimitMotor

The rotational limit and motor along the constraint axis of the joint.

rotationalSpringDamper:SpringDamper

The rotational spring and damper along the constraint axis of the joint.

translationalLimitMotor:TranslationalLimitMotor

The translational limit and motor along the constraint axis of the joint.

translationalSpringDamper:SpringDamper

The translational spring and damper along constraint the axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):CylindricalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJoint.html b/docs/oimo/dynamics/constraint/joint/GenericJoint.html new file mode 100644 index 0000000..8642986 --- /dev/null +++ b/docs/oimo/dynamics/constraint/joint/GenericJoint.html @@ -0,0 +1,34 @@ + + + +oimo.dynamics.constraint.joint.GenericJoint - OimoPhysics API documentation

A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in +highly flexible way, so that every translational and rotational axis +can be locked, unlocked, springy, or powered by a motor like other +joints. Note that rotation angles are measured as x-y-z Euler angles, +not as z-x-z Euler angles.

Constructor

new (config:GenericJointConfig)

Creates a new generic joint by configuration config.

Methods

inlinegetAngles ():Vec3

Returns the relative x-y-z Euler angles.

inlinegetAxisX ():Vec3

Returns the first (x) rotation axis of the relative Euler angles.

inlinegetAxisY ():Vec3

Returns the second (y) rotation axis of the relative Euler angles.

inlinegetAxisZ ():Vec3

Returns the third (z) rotation axis of the relative Euler angles.

inlinegetRotationalLimitMotors ():Array<RotationalLimitMotor>

Returns the rotational limits and motor settings along the rotation axes of the relative x-y-z Euler angles.

inlinegetRotationalSpringDampers ():Array<SpringDamper>

Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles.

inlinegetTranslationalLimitMotors ():Array<TranslationalLimitMotor>

Returns the translational limits and motor settings along the first body's constraint basis.

inlinegetTranslationalSpringDampers ():Array<SpringDamper>

Returns the translational spring and damper settings along the first body's constraint basis.

inlinegetTranslations ():Vec3

Returns the translations along the first rigid body's constraint basis.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html new file mode 100644 index 0000000..1433398 --- /dev/null +++ b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html @@ -0,0 +1,14 @@ + + + +oimo.dynamics.constraint.joint.GenericJointConfig - OimoPhysics API documentation

A generic joint config is used for constructions of generic joints.

Constructor

new ()

Default constructor.

Variables

localBasis1:Mat3

The first body's local constraint basis.

localBasis2:Mat3

The second body's local constraint basis.

rotationalLimitMotors:Array<RotationalLimitMotor>

The rotational limits and motors along the rotation axes of the relative x-y-z Euler angles.

rotationalSpringDampers:Array<SpringDamper>

The rotational springs and dampers along the rotation axes of the relative x-y-z Euler angles.

translationalLimitMotors:Array<TranslationalLimitMotor>

The translational limits and motors along the first body's the constraint basis.

translationalSpringDampers:Array<SpringDamper>

The translational springs and dampers along the first body's constraint basis.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldBasis1:Mat3, worldBasis2:Mat3):GenericJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local bases +from the world bases worldBasis1 and worldBasis2, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/Joint.html b/docs/oimo/dynamics/constraint/joint/Joint.html index 7633882..c40901e 100644 --- a/docs/oimo/dynamics/constraint/joint/Joint.html +++ b/docs/oimo/dynamics/constraint/joint/Joint.html @@ -1,28 +1,28 @@ -oimo.dynamics.constraint.joint.Joint - OimoPhysics API documentation

The base class of joints. Joints are used to connect two rigid bodies -in various ways. See JointType for all types of joints.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

The base class of joints. Joints are used to connect two rigid bodies +in various ways. See JointType for all types of joints.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointConfig.html b/docs/oimo/dynamics/constraint/joint/JointConfig.html index a5d312c..dcb1071 100644 --- a/docs/oimo/dynamics/constraint/joint/JointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/JointConfig.html @@ -1,15 +1,15 @@ -oimo.dynamics.constraint.joint.JointConfig - OimoPhysics API documentationoimo.dynamics.constraint.joint.JointConfig - OimoPhysics API documentation

A joint configuration is used for constructions of various joints. -An instance of any kind of the joint configurations can safely be reused.

Variables

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

\ No newline at end of file +

A joint configuration is used for constructions of various joints. +An instance of any kind of the joint configurations can safely be reused.

Variables

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointLink.html b/docs/oimo/dynamics/constraint/joint/JointLink.html index 07e3815..c7ae677 100644 --- a/docs/oimo/dynamics/constraint/joint/JointLink.html +++ b/docs/oimo/dynamics/constraint/joint/JointLink.html @@ -1,16 +1,16 @@ -oimo.dynamics.constraint.joint.JointLink - OimoPhysics API documentationoimo.dynamics.constraint.joint.JointLink - OimoPhysics API documentation

A joint link is used to build a constraint graph for clustering rigid bodies. +

A joint link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also ContactLink.

Methods

getContact ():Joint

Returns the contact the rigid body is attached to.

getNext ():JointLink

Returns the next joint link in the rigid body.

-

If the previous one does not exist, null will be returned.

getOther ():RigidBody

Returns the other rigid body attached to the constraint. This provides a quick access -from a rigid body to the other one attached to the constraint.

getPrev ():JointLink

Returns the previous joint link in the rigid body.

-

If the previous one does not exist, null will be returned.

\ No newline at end of file +See also ContactLink.

Methods

getContact ():Joint

Returns the contact the rigid body is attached to.

getNext ():JointLink

Returns the next joint link in the rigid body.

+

If the previous one does not exist, null will be returned.

getOther ():RigidBody

Returns the other rigid body attached to the constraint. This provides a quick access +from a rigid body to the other one attached to the constraint.

getPrev ():JointLink

Returns the previous joint link in the rigid body.

+

If the previous one does not exist, null will be returned.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointType.html b/docs/oimo/dynamics/constraint/joint/JointType.html index d27ba06..3e764a9 100644 --- a/docs/oimo/dynamics/constraint/joint/JointType.html +++ b/docs/oimo/dynamics/constraint/joint/JointType.html @@ -1,15 +1,16 @@ -oimo.dynamics.constraint.joint.JointType - OimoPhysics API documentation

The list of the types of the joints.

Static variables

staticread onlyCYLINDRICAL:Int

Represents a cylindrical joint.

-

See CylindricalJoint for details.

staticread onlyPRISMATIC:Int

Represents a prismatic joint.

-

See PrismaticJoint for details.

staticread onlyRAGDOLL:Int

Represents a ragdoll joint.

-

See RagdollJoint for details.

staticread onlyREVOLUTE:Int

Represents a revolute joint.

-

See RevoluteJoint for details.

staticread onlySPHERICAL:Int

Represents a spherical joint.

-

See SphericalJoint for details.

staticread onlyUNIVERSAL:Int

Represents a universal joint.

-

See UniversalJoint for details.

\ No newline at end of file +

The list of the types of the joints.

Static variables

@:value(_CYLINDRICAL)staticread onlyCYLINDRICAL:Int = _CYLINDRICAL

Represents a cylindrical joint.

+

See CylindricalJoint for details.

@:value(_GENERIC)staticread onlyGENERIC:Int = _GENERIC

Represents a generic joint.

+

See GenericJoint for details.

@:value(_PRISMATIC)staticread onlyPRISMATIC:Int = _PRISMATIC

Represents a prismatic joint.

+

See PrismaticJoint for details.

@:value(_RAGDOLL)staticread onlyRAGDOLL:Int = _RAGDOLL

Represents a ragdoll joint.

+

See RagdollJoint for details.

@:value(_REVOLUTE)staticread onlyREVOLUTE:Int = _REVOLUTE

Represents a revolute joint.

+

See RevoluteJoint for details.

@:value(_SPHERICAL)staticread onlySPHERICAL:Int = _SPHERICAL

Represents a spherical joint.

+

See SphericalJoint for details.

@:value(_UNIVERSAL)staticread onlyUNIVERSAL:Int = _UNIVERSAL

Represents a universal joint.

+

See UniversalJoint for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html index adacce6..c5ab406 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html @@ -1,7 +1,7 @@ -oimo.dynamics.constraint.joint.PrismaticJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.PrismaticJoint - OimoPhysics API documentation

A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to +

A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative translation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and -damper effect of the translational part of the constraint.

Constructor

new (config:PrismaticJointConfig)

Creates a new prismatic joint by configuration config.

Methods

inline getAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inline getAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inline getAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getLimitMotor ():TranslationalLimitMotor

Returns the translational limits and motor settings.

inline getLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getSpringDamper ():SpringDamper

Returns the translational spring and damper settings.

inline getTranslation ():Float

Returns the translation of the joint.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +damper effect of the translational part of the constraint.

Constructor

new (config:PrismaticJointConfig)

Creates a new prismatic joint by configuration config.

Methods

inlinegetAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inlinegetAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inlinegetAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetLimitMotor ():TranslationalLimitMotor

Returns the translational limits and motor settings.

inlinegetLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetSpringDamper ():SpringDamper

Returns the translational spring and damper settings.

inlinegetTranslation ():Float

Returns the translation of the joint.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html index 670b391..4375039 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.PrismaticJointConfig - OimoPhysics API documentation

A prismatic joint config is used for constructions of prismatic joints.

Constructor

new ()

Default constructor.

Variables

limitMotor:TranslationalLimitMotor

The translational limit and motor along the constraint axis of the joint.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper:SpringDamper

The translational spring and damper along the constraint axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):PrismaticJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

A prismatic joint config is used for constructions of prismatic joints.

Constructor

new ()

Default constructor.

Variables

limitMotor:TranslationalLimitMotor

The translational limit and motor along the constraint axis of the joint.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper:SpringDamper

The translational spring and damper along the constraint axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):PrismaticJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html index 820607c..5980af4 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html @@ -1,12 +1,12 @@ -oimo.dynamics.constraint.joint.RagdollJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.RagdollJoint - OimoPhysics API documentation

A ragdoll joint is designed to simulate ragdoll's limbs. It constrains +

A ragdoll joint is designed to simulate ragdoll's limbs. It constrains swing and twist angles between two rigid bodies. The two rigid bodies have constraint axes, and the swing angle is defined by the angle of two constraint axes, while the twist angle is defined by the rotation @@ -24,26 +24,26 @@ by specifying two swing axes (though one of them is automatically computed) and corresponding maximum swing angles. You can also enable a motor of the twist part of the constraint, spring and damper effect of -the both swing and twist part of the constraint.

Constructor

new (config:RagdollJointConfig)

Creates a new ragdoll joint by configuration config.

Methods

inline getAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inline getAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inline getAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getSwingAngle ():Float

Returns the swing angle in radians.

inline getSwingAxis ():Vec3

Returns the swing axis in world coordinates.

inline getSwingAxisTo (axis:Vec3):Void

Sets axis to the swing axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getSwingSpringDamper ():SpringDamper

Returns the rotational spring and damper settings along the swing axis.

inline getTwistAngle ():Float

Returns the twist angle in radians.

inline getTwistLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings along the twist axis.

inline getTwistSpringDamper ():SpringDamper

Returns the rotational spring and damper settings along the twist axis.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +the both swing and twist part of the constraint.

Constructor

new (config:RagdollJointConfig)

Creates a new ragdoll joint by configuration config.

Methods

inlinegetAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inlinegetAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inlinegetAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetSwingAngle ():Float

Returns the swing angle in radians.

inlinegetSwingAxis ():Vec3

Returns the swing axis in world coordinates.

inlinegetSwingAxisTo (axis:Vec3):Void

Sets axis to the swing axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetSwingSpringDamper ():SpringDamper

Returns the rotational spring and damper settings along the swing axis.

inlinegetTwistAngle ():Float

Returns the twist angle in radians.

inlinegetTwistLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings along the twist axis.

inlinegetTwistSpringDamper ():SpringDamper

Returns the rotational spring and damper settings along the twist axis.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html index 55d8391..f84b386 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html @@ -1,19 +1,19 @@ -oimo.dynamics.constraint.joint.RagdollJointConfig - OimoPhysics API documentation

A ragdoll joint config is used for constructions of ragdoll joints.

Constructor

new ()

Default constructor.

Variables

localSwingAxis1:Vec3

The first body's local swing axis.

+

A ragdoll joint config is used for constructions of ragdoll joints.

Constructor

new ()

Default constructor.

Variables

localSwingAxis1:Vec3

The first body's local swing axis.

The second swing axis is also attached to the first body. It is perpendicular to the first swing -axis, and is automatically computed when the joint is created.

localTwistAxis1:Vec3

The first body's local twist axis.

localTwistAxis2:Vec3

The second body's local twist axis.

maxSwingAngle1:Float

The max angle of rotation along the first swing axis. -This value must be positive.

maxSwingAngle2:Float

The max angle of rotation along the second swing axis. -This value must be positive.

swingSpringDamper:SpringDamper

The rotational spring and damper along the swing axis of the joint.

twistLimitMotor:RotationalLimitMotor

The rotational limit and motor along the twist axis of the joint.

twistSpringDamper:SpringDamper

The rotational spring and damper along the twist axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldTwistAxis:Vec3, worldSwingAxis:Vec3):RagdollJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local twist axes +axis, and is automatically computed when the joint is created.

localTwistAxis1:Vec3

The first body's local twist axis.

localTwistAxis2:Vec3

The second body's local twist axis.

maxSwingAngle1:Float

The max angle of rotation along the first swing axis. +This value must be positive.

maxSwingAngle2:Float

The max angle of rotation along the second swing axis. +This value must be positive.

swingSpringDamper:SpringDamper

The rotational spring and damper along the swing axis of the joint.

twistLimitMotor:RotationalLimitMotor

The rotational limit and motor along the twist axis of the joint.

twistSpringDamper:SpringDamper

The rotational spring and damper along the twist axis of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldTwistAxis:Vec3, worldSwingAxis:Vec3):RagdollJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local twist axes from the world twist axis worldTwistAxis, local swing axis from the world swing axis -worldSwingAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +worldSwingAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html index a447f7d..876e29c 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html @@ -1,7 +1,7 @@ -oimo.dynamics.constraint.joint.RevoluteJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.RevoluteJoint - OimoPhysics API documentation

A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share +

A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative rotation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and damper effect of the rotational -part of the constraint.

Constructor

new (config:RevoluteJointConfig)

Creates a new revolute joint by configuration config.

Methods

inline getAngle ():Float

Returns the rotation angle in radians.

inline getAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inline getAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inline getAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings.

inline getLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getSpringDamper ():SpringDamper

Returns the rotational spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +part of the constraint.

Constructor

new (config:RevoluteJointConfig)

Creates a new revolute joint by configuration config.

Methods

inlinegetAngle ():Float

Returns the rotation angle in radians.

inlinegetAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inlinegetAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inlinegetAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetLimitMotor ():RotationalLimitMotor

Returns the rotational limits and motor settings.

inlinegetLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetSpringDamper ():SpringDamper

Returns the rotational spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html index 44c1d0b..0741e17 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.RevoluteJointConfig - OimoPhysics API documentation

A revolute joint config is used for constructions of revolute joints.

Constructor

new ()

Default constructor.

Variables

limitMotor:RotationalLimitMotor

The rotational limits and motor settings.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper:SpringDamper

The rotational spring and damper settings.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):RevoluteJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

A revolute joint config is used for constructions of revolute joints.

Constructor

new ()

Default constructor.

Variables

limitMotor:RotationalLimitMotor

The rotational limits and motor settings.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper:SpringDamper

The rotational spring and damper settings.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):RevoluteJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html index 010284b..77dd651 100644 --- a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.RotationalLimitMotor - OimoPhysics API documentation

Rotational limits and motor settings of a joint.

Constructor

new ()

Default constructor.

Variables

lowerLimit:Float

The lower bound of the limit in radians.

-

The limit is disabled if lowerLimit > upperLimit.

motorSpeed:Float

The target speed of the motor in usually radians per second.

motorTorque:Float

The maximum torque of the motor in usually newton meters.

-

The motor is disabled if motorTorque <= 0.

upperLimit:Float

The upper bound of the limit in radians.

-

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():RotationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):RotationalLimitMotor

Sets limit properties at once and returns this. -this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, torque:Float):RotationalLimitMotor

Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorTorque is set to torque.

\ No newline at end of file +

Rotational limits and motor settings of a joint.

Constructor

new ()

Default constructor.

Variables

lowerLimit:Float

The lower bound of the limit in radians.

+

The limit is disabled if lowerLimit > upperLimit.

motorSpeed:Float

The target speed of the motor in usually radians per second.

motorTorque:Float

The maximum torque of the motor in usually newton meters.

+

The motor is disabled if motorTorque <= 0.

upperLimit:Float

The upper bound of the limit in radians.

+

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():RotationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):RotationalLimitMotor

Sets limit properties at once and returns this. +this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, torque:Float):RotationalLimitMotor

Sets motor properties at once and returns this. +this.motorSpeed is set to speed, and this.motorTorque is set to torque.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html index 2a82d56..4e5db07 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html @@ -1,30 +1,30 @@ -oimo.dynamics.constraint.joint.SphericalJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.SphericalJoint - OimoPhysics API documentation

A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share +

A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share their anchor points. This joint provides three degrees of freedom. You can enable a -spring and damper effect of the constraint.

Constructor

new (config:SphericalJointConfig)

Creates a new spherical joint by configuration config.

Methods

inline getSpringDamper ():SpringDamper

Returns the spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +spring and damper effect of the constraint.

Constructor

new (config:SphericalJointConfig)

Creates a new spherical joint by configuration config.

Methods

inlinegetSpringDamper ():SpringDamper

Returns the spring and damper settings.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html index 4607698..36f4e72 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html @@ -1,13 +1,13 @@ -oimo.dynamics.constraint.joint.SphericalJointConfig - OimoPhysics API documentation

A spherical joint config is used for constructions of spherical joints.

Constructor

new ()

Default constructor.

Variables

springDamper:SpringDamper

The spring and damper setting of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3):SphericalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

A spherical joint config is used for constructions of spherical joints.

Constructor

new ()

Default constructor.

Variables

springDamper:SpringDamper

The spring and damper setting of the joint.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3):SphericalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SpringDamper.html b/docs/oimo/dynamics/constraint/joint/SpringDamper.html index cae3908..905f2b1 100644 --- a/docs/oimo/dynamics/constraint/joint/SpringDamper.html +++ b/docs/oimo/dynamics/constraint/joint/SpringDamper.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.SpringDamper - OimoPhysics API documentation

Spring and damper settings of a joint.

Constructor

new ()

Default constructor.

Variables

dampingRatio:Float

The damping ratio of the constraint. -Set 1.0 to make the constraint critically dumped.

frequency:Float

The frequency of the spring in Hz. -Set 0.0 to disable the spring and make the constraint totally rigid.

useSymplecticEuler:Bool

Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. +

Spring and damper settings of a joint.

Constructor

new ()

Default constructor.

Variables

dampingRatio:Float

The damping ratio of the constraint. +Set 1.0 to make the constraint critically dumped.

frequency:Float

The frequency of the spring in Hz. +Set 0.0 to disable the spring and make the constraint totally rigid.

useSymplecticEuler:Bool

Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. Note that symplectic Euler method conserves energy better than implicit Euler method does, but the constraint will be -unstable under the high frequency.

Methods

clone ():SpringDamper

Returns a clone of the object.

setSpring (frequency:Float, dampingRatio:Float):SpringDamper

Sets spring and damper parameters at once and returns this. -this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

setSymplecticEuler (useSymplecticEuler:Bool):SpringDamper

\ No newline at end of file +unstable under the high frequency.

Methods

clone ():SpringDamper

Returns a clone of the object.

setSpring (frequency:Float, dampingRatio:Float):SpringDamper

Sets spring and damper parameters at once and returns this. +this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

setSymplecticEuler (useSymplecticEuler:Bool):SpringDamper

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html index d8851aa..7f7d5c9 100644 --- a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.TranslationalLimitMotor - OimoPhysics API documentation

Translational limits and motor settings of a joint.

Constructor

new ()

Default constructor.

Variables

lowerLimit:Float

The lower bound of the limit in usually meters.

-

The limit is disabled if lowerLimit > upperLimit.

motorForce:Float

The maximum force of the motor in usually newtons.

-

The motor is disabled if motorForce <= 0.

motorSpeed:Float

The target speed of the motor in usually meters per second.

upperLimit:Float

The upper bound of the limit in usually meters.

-

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():TranslationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):TranslationalLimitMotor

Sets limit properties at once and returns this. -this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, force:Float):TranslationalLimitMotor

Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorForce is set to force.

\ No newline at end of file +

Translational limits and motor settings of a joint.

Constructor

new ()

Default constructor.

Variables

lowerLimit:Float

The lower bound of the limit in usually meters.

+

The limit is disabled if lowerLimit > upperLimit.

motorForce:Float

The maximum force of the motor in usually newtons.

+

The motor is disabled if motorForce <= 0.

motorSpeed:Float

The target speed of the motor in usually meters per second.

upperLimit:Float

The upper bound of the limit in usually meters.

+

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():TranslationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):TranslationalLimitMotor

Sets limit properties at once and returns this. +this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, force:Float):TranslationalLimitMotor

Sets motor properties at once and returns this. +this.motorSpeed is set to speed, and this.motorForce is set to force.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html index 47aaee8..8f2f97e 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html @@ -1,7 +1,7 @@ -oimo.dynamics.constraint.joint.UniversalJoint - OimoPhysics API documentationoimo.dynamics.constraint.joint.UniversalJoint - OimoPhysics API documentation

A universal joint constrains two rigid bodies' constraint axes to be perpendicular +

A universal joint constrains two rigid bodies' constraint axes to be perpendicular to each other. Rigid bodies can rotate along their constraint axes, but cannot along the direction perpendicular to two constraint axes. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects -of the two rotational constraints.

Constructor

new (config:UniversalJointConfig)

Creates a new universal joint by configuration config.

Methods

inline getAngle1 ():Float

Returns the rotation angle along the first body's constraint axis.

inline getAngle2 ():Float

Returns the rotation angle along the second body's constraint axis.

inline getAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inline getAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inline getAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

-

This does not create a new instance of Vec3.

inline getLimitMotor1 ():RotationalLimitMotor

Returns the rotational limits and motor settings along the first body's constraint axis.

inline getLimitMotor2 ():RotationalLimitMotor

Returns the rotational limits and motor settings along the second body's constraint axis.

inline getLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inline getLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

-

This does not create a new instance of Vec3.

inline getSpringDamper1 ():SpringDamper

Returns the rotational spring and damper settings along the first body's constraint axis.

inline getSpringDamper2 ():SpringDamper

Returns the rotational spring and damper settings along the second body's constraint axis.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inline getAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inline getAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inline getAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inline getAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

-

This does not create a new instance of Vec3.

inline getAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inline getAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inline getAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

-

This does not create a new instance of Vec3.

inline getBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inline getBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inline getBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

-

This does not create a new instance of Mat3.

inline getBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

-

Returns 0 if the joint is unbreakable.

inline getLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inline getLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inline getLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

-

This does not create a new instance of Vec3.

inline getNext ():Joint

Returns the next joint in the world.

-

If the next one does not exist, null will be returned.

inline getPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

inline getPrev ():Joint

Returns the previous joint in the world.

-

If the previous one does not exist, null will be returned.

inline getRigidBody1 ():RigidBody

Returns the first rigid body.

inline getRigidBody2 ():RigidBody

Returns the second rigid body.

inline getType ():Int

Returns the type of the joint.

-

See JointType for details.

inline setAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inline setBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

-

Set 0 for unbreakable joints.

inline setPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +of the two rotational constraints.

Constructor

new (config:UniversalJointConfig)

Creates a new universal joint by configuration config.

Methods

inlinegetAngle1 ():Float

Returns the rotation angle along the first body's constraint axis.

inlinegetAngle2 ():Float

Returns the rotation angle along the second body's constraint axis.

inlinegetAxis1 ():Vec3

Returns the first rigid body's constraint axis in world coordinates.

inlinegetAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAxis2 ():Vec3

Returns the second rigid body's constraint axis in world coordinates.

inlinegetAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetLimitMotor1 ():RotationalLimitMotor

Returns the rotational limits and motor settings along the first body's constraint axis.

inlinegetLimitMotor2 ():RotationalLimitMotor

Returns the rotational limits and motor settings along the second body's constraint axis.

inlinegetLocalAxis1 ():Vec3

Returns the first rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis1To (axis:Vec3):Void

Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetLocalAxis2 ():Vec3

Returns the second rigid body's constraint axis relative to the rigid body's transform.

inlinegetLocalAxis2To (axis:Vec3):Void

Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

+

This does not create a new instance of Vec3.

inlinegetSpringDamper1 ():SpringDamper

Returns the rotational spring and damper settings along the first body's constraint axis.

inlinegetSpringDamper2 ():SpringDamper

Returns the rotational spring and damper settings along the second body's constraint axis.

Inherited Variables

Defined by Joint

userData:Any

Extra field that users can use for their own purposes.

Inherited Methods

Defined by Joint

inlinegetAllowCollision ():Bool

Returns whether to allow the connected rigid bodies to collide each other.

inlinegetAnchor1 ():Vec3

Returns the first rigid body's anchor point in world coordinates.

inlinegetAnchor1To (anchor:Vec3):Void

Sets anchor to the first rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAnchor2 ():Vec3

Returns the second rigid body's anchor point in world coordinates.

inlinegetAnchor2To (anchor:Vec3):Void

Sets anchor to the second rigid body's anchor point in world coordinates.

+

This does not create a new instance of Vec3.

inlinegetAppliedForce ():Vec3

Returns the force applied to the first rigid body at the last time step.

inlinegetAppliedForceTo (appliedForce:Vec3):Void

Sets appliedForce to the force applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetAppliedTorque ():Vec3

Returns the torque applied to the first rigid body at the last time step.

inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

Sets appliedTorque to the torque applied to the first rigid body at the last time step.

+

This does not create a new instance of Vec3.

inlinegetBasis1 ():Mat3

Returns the basis of the joint for the first rigid body in world coordinates.

inlinegetBasis1To (basis:Mat3):Void

Sets basis to the basis of the joint for the first rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBasis2 ():Mat3

Returns the basis of the joint for the second rigid body in world coordinates.

inlinegetBasis2To (basis:Mat3):Void

Sets basis to the basis of the joint for the second rigid body in world coordinates.

+

This does not create a new instance of Mat3.

inlinegetBreakForce ():Float

Returns the magnitude of the constraint force at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetBreakTorque ():Float

Returns the magnitude of the constraint torque at which the joint will be destroyed.

+

Returns 0 if the joint is unbreakable.

inlinegetLocalAnchor1 ():Vec3

Returns the first rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor1To (localAnchor:Vec3):Void

Sets localAnchor to the first rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetLocalAnchor2 ():Vec3

Returns the second rigid body's local anchor point in world coordinates.

inlinegetLocalAnchor2To (localAnchor:Vec3):Void

Sets localAnchor to the second rigid body's anchor point in local coordinates.

+

This does not create a new instance of Vec3.

inlinegetNext ():Joint

Returns the next joint in the world.

+

If the next one does not exist, null will be returned.

inlinegetPositionCorrectionAlgorithm ():Int

Returns the type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

inlinegetPrev ():Joint

Returns the previous joint in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRigidBody1 ():RigidBody

Returns the first rigid body.

inlinegetRigidBody2 ():RigidBody

Returns the second rigid body.

inlinegetType ():Int

Returns the type of the joint.

+

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

+

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html index e3bc987..9742024 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html @@ -1,14 +1,14 @@ -oimo.dynamics.constraint.joint.UniversalJointConfig - OimoPhysics API documentation

A universal joint config is used for constructions of universal joints.

Constructor

new ()

Default constructor.

Variables

limitMotor1:RotationalLimitMotor

The rotational limit and motor along the first body's constraint axis.

limitMotor2:RotationalLimitMotor

The rotational limit and motor along the second body's constraint axis.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper1:SpringDamper

The rotational spring and damper along the first body's constraint axis.

springDamper2:SpringDamper

The rotational spring and damper along the second body's constraint axis.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis1:Vec3, worldAxis2:Vec3):UniversalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axes worldAxis1 and worldAxis2, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

-

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

-

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

A universal joint config is used for constructions of universal joints.

Constructor

new ()

Default constructor.

Variables

limitMotor1:RotationalLimitMotor

The rotational limit and motor along the first body's constraint axis.

limitMotor2:RotationalLimitMotor

The rotational limit and motor along the second body's constraint axis.

localAxis1:Vec3

The first body's local constraint axis.

localAxis2:Vec3

The second body's local constraint axis.

springDamper1:SpringDamper

The rotational spring and damper along the first body's constraint axis.

springDamper2:SpringDamper

The rotational spring and damper along the second body's constraint axis.

Methods

init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis1:Vec3, worldAxis2:Vec3):UniversalJointConfig

Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axes worldAxis1 and worldAxis2, and returns this.

Inherited Variables

Defined by JointConfig

allowCollision:Bool

Whether to allow the connected rigid bodies to collide each other.

breakForce:Float

The joint will be destroyed when magnitude of the constraint force exceeds the value.

+

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

+

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

+

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

+

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/index.html b/docs/oimo/dynamics/constraint/joint/index.html index d1f4078..95bfb6c 100644 --- a/docs/oimo/dynamics/constraint/joint/index.html +++ b/docs/oimo/dynamics/constraint/joint/index.html @@ -1,24 +1,28 @@ -oimo.dynamics.constraint.joint - OimoPhysics API documentation

oimo.dynamics.constraint.joint

OimoPhysics API Documentation

..
CylindricalJoint

A cylindrical joint constrains two rigid bodies to share their constraint +

oimo.dynamics.constraint.joint

OimoPhysics API Documentation

..
CylindricalJoint

A cylindrical joint constrains two rigid bodies to share their constraint axes, and restricts relative translation and rotation onto the constraint axis. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects of both translation and -rotation part of the constraint.

CylindricalJointConfig

A cylindrical joint config is used for constructions of cylindrical joints.

Joint

The base class of joints. Joints are used to connect two rigid bodies -in various ways. See JointType for all types of joints.

JointConfig

A joint configuration is used for constructions of various joints. -An instance of any kind of the joint configurations can safely be reused.

JointLink

A joint link is used to build a constraint graph for clustering rigid bodies. +rotation part of the constraint.

CylindricalJointConfig

A cylindrical joint config is used for constructions of cylindrical joints.

GenericJoint

A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in +highly flexible way, so that every translational and rotational axis +can be locked, unlocked, springy, or powered by a motor like other +joints. Note that rotation angles are measured as x-y-z Euler angles, +not as z-x-z Euler angles.

GenericJointConfig

A generic joint config is used for constructions of generic joints.

Joint

The base class of joints. Joints are used to connect two rigid bodies +in various ways. See JointType for all types of joints.

JointConfig

A joint configuration is used for constructions of various joints. +An instance of any kind of the joint configurations can safely be reused.

JointLink

A joint link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also ContactLink.

JointType

The list of the types of the joints.

PrismaticJoint

A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to +See also ContactLink.

JointType

The list of the types of the joints.

PrismaticJoint

A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative translation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and -damper effect of the translational part of the constraint.

PrismaticJointConfig

A prismatic joint config is used for constructions of prismatic joints.

RagdollJoint

A ragdoll joint is designed to simulate ragdoll's limbs. It constrains +damper effect of the translational part of the constraint.

PrismaticJointConfig

A prismatic joint config is used for constructions of prismatic joints.

RagdollJoint

A ragdoll joint is designed to simulate ragdoll's limbs. It constrains swing and twist angles between two rigid bodies. The two rigid bodies have constraint axes, and the swing angle is defined by the angle of two constraint axes, while the twist angle is defined by the rotation @@ -27,14 +31,14 @@ by specifying two swing axes (though one of them is automatically computed) and corresponding maximum swing angles. You can also enable a motor of the twist part of the constraint, spring and damper effect of -the both swing and twist part of the constraint.

RagdollJointConfig

A ragdoll joint config is used for constructions of ragdoll joints.

RevoluteJoint

A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share +the both swing and twist part of the constraint.

RagdollJointConfig

A ragdoll joint config is used for constructions of ragdoll joints.

RevoluteJoint

A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative rotation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and damper effect of the rotational -part of the constraint.

RevoluteJointConfig

A revolute joint config is used for constructions of revolute joints.

RotationalLimitMotor

Rotational limits and motor settings of a joint.

SphericalJoint

A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share +part of the constraint.

RevoluteJointConfig

A revolute joint config is used for constructions of revolute joints.

RotationalLimitMotor

Rotational limits and motor settings of a joint.

SphericalJoint

A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share their anchor points. This joint provides three degrees of freedom. You can enable a -spring and damper effect of the constraint.

SphericalJointConfig

A spherical joint config is used for constructions of spherical joints.

SpringDamper

Spring and damper settings of a joint.

TranslationalLimitMotor

Translational limits and motor settings of a joint.

UniversalJoint

A universal joint constrains two rigid bodies' constraint axes to be perpendicular +spring and damper effect of the constraint.

SphericalJointConfig

A spherical joint config is used for constructions of spherical joints.

SpringDamper

Spring and damper settings of a joint.

TranslationalLimitMotor

Translational limits and motor settings of a joint.

UniversalJoint

A universal joint constrains two rigid bodies' constraint axes to be perpendicular to each other. Rigid bodies can rotate along their constraint axes, but cannot along the direction perpendicular to two constraint axes. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects -of the two rotational constraints.

UniversalJointConfig

A universal joint config is used for constructions of universal joints.

\ No newline at end of file +of the two rotational constraints.

UniversalJointConfig

A universal joint config is used for constructions of universal joints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html index d6fac3e..7db407c 100644 --- a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html +++ b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html @@ -1,10 +1,10 @@ -oimo.dynamics.constraint.solver.ConstraintSolverType - OimoPhysics API documentation

The list of the constraint solvers.

Static variables

staticread onlyDIRECT:Int

Direct constraint solver. Very stable but not suitable for a situation where fast -computation is required.

staticread onlyITERATIVE:Int

Iterative constraint solver. Fast and stable enough for common usages.

\ No newline at end of file +

The list of the constraint solvers.

Static variables

@:value(_DIRECT)staticread onlyDIRECT:Int = _DIRECT

Direct constraint solver. Very stable but not suitable for a situation where fast +computation is required.

@:value(_ITERATIVE)staticread onlyITERATIVE:Int = _ITERATIVE

Iterative constraint solver. Fast and stable enough for common usages.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html index afd3017..43b2f64 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html @@ -1,11 +1,11 @@ -oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver - OimoPhysics API documentationoimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver - OimoPhysics API documentation

The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file +

The direct solver of a mixed linear complementality problem (MLCP) for +joint constraints.

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/index.html b/docs/oimo/dynamics/constraint/solver/direct/index.html index fb5fc4d..a2338ce 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/index.html +++ b/docs/oimo/dynamics/constraint/solver/direct/index.html @@ -1,10 +1,10 @@ -oimo.dynamics.constraint.solver.direct - OimoPhysics API documentation

oimo.dynamics.constraint.solver.direct

OimoPhysics API Documentation

..
DirectJointConstraintSolver

The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

\ No newline at end of file +

oimo.dynamics.constraint.solver.direct

OimoPhysics API Documentation

..
DirectJointConstraintSolver

The direct solver of a mixed linear complementality problem (MLCP) for +joint constraints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/index.html b/docs/oimo/dynamics/constraint/solver/index.html index 23ac0d9..2eb201c 100644 --- a/docs/oimo/dynamics/constraint/solver/index.html +++ b/docs/oimo/dynamics/constraint/solver/index.html @@ -1,9 +1,9 @@ -oimo.dynamics.constraint.solver - OimoPhysics API documentation

oimo.dynamics.constraint.solver

OimoPhysics API Documentation

..
direct
pgs
ConstraintSolverType

The list of the constraint solvers.

\ No newline at end of file +

oimo.dynamics.constraint.solver

OimoPhysics API Documentation

..
direct
pgs
ConstraintSolverType

The list of the constraint solvers.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html index c6fdbde..6060b16 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html @@ -1,10 +1,10 @@ -oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver - OimoPhysics API documentation

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

Defined by ConstraintSolver

postSolveVelocity (timeStep:TimeStep):Void

Performs post-processes of velocity part. Time step information timeStep is given -for computing time-depending data.

\ No newline at end of file +

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

Defined by ConstraintSolver

postSolveVelocity (timeStep:TimeStep):Void

Performs post-processes of velocity part. Time step information timeStep is given +for computing time-depending data.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html index e779c8c..c911f96 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html @@ -1,9 +1,9 @@ -oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver - OimoPhysics API documentation

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file +

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/index.html b/docs/oimo/dynamics/constraint/solver/pgs/index.html index fb17db5..9bded93 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/index.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/index.html @@ -1,9 +1,9 @@ -oimo.dynamics.constraint.solver.pgs - OimoPhysics API documentation

oimo.dynamics.constraint.solver.pgs

OimoPhysics API Documentation

..
PgsContactConstraintSolver

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

PgsJointConstraintSolver

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

\ No newline at end of file +

oimo.dynamics.constraint.solver.pgs

OimoPhysics API Documentation

..
PgsContactConstraintSolver

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

PgsJointConstraintSolver

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

\ No newline at end of file diff --git a/docs/oimo/dynamics/index.html b/docs/oimo/dynamics/index.html index c26173e..5eb84e1 100644 --- a/docs/oimo/dynamics/index.html +++ b/docs/oimo/dynamics/index.html @@ -1,15 +1,15 @@ -oimo.dynamics - OimoPhysics API documentation

oimo.dynamics

OimoPhysics API Documentation

..
callback
common
constraint
rigidbody
Contact

A contact is a cached pair of overlapping shapes in the physics world. contacts -are created by ContactManager when two AABBs of shapes begin overlapping.

ContactLink

A contact link is used to build a constraint graph for clustering rigid bodies. +

oimo.dynamics

OimoPhysics API Documentation

..
callback
common
constraint
rigidbody
Contact

A contact is a cached pair of overlapping shapes in the physics world. contacts +are created by ContactManager when two AABBs of shapes begin overlapping.

ContactLink

A contact link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also JointLink.

ContactManager

The manager of the contacts in the physics world. A contact of two +See also JointLink.

ContactManager

The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and -is destroyed when they end overlapping.

TimeStep

Information of time-step sizes of the simulation.

World

The physics simulation world. This manages entire the dynamic simulation. You can add -rigid bodies and joints to the world to simulate them.

\ No newline at end of file +is destroyed when they end overlapping.

TimeStep

Information of time-step sizes of the simulation.

World

The physics simulation world. This manages entire the dynamic simulation. You can add +rigid bodies and joints to the world to simulate them.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/MassData.html b/docs/oimo/dynamics/rigidbody/MassData.html index 4fd8a83..2319686 100644 --- a/docs/oimo/dynamics/rigidbody/MassData.html +++ b/docs/oimo/dynamics/rigidbody/MassData.html @@ -1,9 +1,9 @@ -oimo.dynamics.rigidbody.MassData - OimoPhysics API documentation

This class holds mass and moment of inertia for a rigid body.

Constructor

new ()

Default constructor.

Variables

localInertia:Mat3

Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

mass:Float

Mass. 0 for a non-dynamic rigid body.

\ No newline at end of file +

This class holds mass and moment of inertia for a rigid body.

Constructor

new ()

Default constructor.

Variables

localInertia:Mat3

Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

mass:Float

Mass. 0 for a non-dynamic rigid body.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBody.html b/docs/oimo/dynamics/rigidbody/RigidBody.html index beda048..a71e480 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBody.html +++ b/docs/oimo/dynamics/rigidbody/RigidBody.html @@ -1,47 +1,49 @@ -oimo.dynamics.rigidbody.RigidBody - OimoPhysics API documentationoimo.dynamics.rigidbody.RigidBody - OimoPhysics API documentation

A rigid body. To add a rigid body to a physics world, create a RigidBody +

A rigid body. To add a rigid body to a physics world, create a RigidBody instance, create and add shapes via RigidBody.addShape, and add the rigid body to the physics world through World.addRigidBody. Rigid bodies have -three motion types: dynamic, static, and kinematic. See RigidBodyType for -details of motion types.

Constructor

new (config:RigidBodyConfig)

Creates a new rigid body by configuration config.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inline addAngularVelocity (angularVelocityChange:Vec3):Void

Adds angularVelocityChange to the angular velcity of the rigid body.

inline addLinearVelocity (linearVelocityChange:Vec3):Void

Adds linearVelocityChange to the linear velcity of the rigid body.

addShape (shape:Shape):Void

Adds the shape to the rigid body.

applyAngularImpulse (impulse:Vec3):Void

Applies the angular impulse impulse to the rigid body.

-

This does not change the linear velocity.

applyForce (force:Vec3, positionInWorld:Vec3):Void

Applies the force force to positionInWorld in world position.

applyForceToCenter (force:Vec3):Void

Applies the force force to the center of mass.

applyImpulse (impulse:Vec3, positionInWorld:Vec3):Void

Applies the impulse impulse to the rigid body at positionInWorld in world position.

-

This changes both the linear velocity and the angular velocity.

applyLinearImpulse (impulse:Vec3):Void

Applies the linear impulse impulse to the rigid body.

-

This does not change the angular velocity.

applyTorque (torque:Vec3):Void

Applies the torque torque.

inline getAngularDamping ():Float

Returns the angular damping.

inline getAngularVelocity ():Vec3

Returns the angular velocity of the rigid body.

inline getAngularVelocityTo (angularVelocity:Vec3):Void

Sets angularVelocity to the angular velocity of the rigid body.

-

This does not create a new intrance of Vec3.

inline getContactLinkList ():ContactLink

Returns the list of the contact links the rigid body is involved.

inline getGravityScale ():Float

Returns the gravity scaling factor of the rigid body.

inline getJointLinkList ():JointLink

Returns the list of the joint links the rigid body is attached.

inline getLinearDamping ():Float

Returns the linear damping.

inline getLinearVelocity ():Vec3

Returns the linear velocity of the rigid body.

inline getLinearVelocityTo (linearVelocity:Vec3):Void

Sets linearVelocity to the linear velocity of the rigid body.

-

This does not create a new intrance of Vec3.

inline getLocalInertia ():Mat3

Returns the moment of inertia tensor in local space.

inline getLocalInertiaTo (inertia:Mat3):Void

Sets inertia to the moment of inertia tensor in local space.

-

This does not create a new instance of Mat3

inline getLocalPoint (worldPoint:Vec3):Vec3

Returns the local coordinates of the point worldPoint in world coodinates.

inline getLocalPointTo (worldPoint:Vec3, localPoint:Vec3):Void

Sets localPoint to the local coordinates of the point worldPoint in world coodinates.

-

This does not create a new instance of Vec3.

inline getLocalVector (worldVector:Vec3):Vec3

Returns the local coordinates of the vector worldVector in world coodinates.

inline getLocalVectorTo (worldVector:Vec3, localVector:Vec3):Void

Sets localVector to the local coordinates of the vector worldVector in world coodinates.

-

This does not create a new instance of Vec3.

inline getMass ():Float

Returns the mass of the rigid body.

-

If the rigid body has infinite mass, 0 will be returned.

inline getMassData ():MassData

Returns the mass data of the rigid body.

inline getMassDataTo (massData:MassData):Void

Sets massData to the mass data of the rigid body.

-

This does not create a new instance of MassData.

inline getNext ():RigidBody

Returns the next rigid body in the world.

-

If the next one does not exist, null will be returned.

inline getNumContectLinks ():Int

Returns the number of the contact lists the rigid body is involved.

inline getNumJointLinks ():Int

Returns the number of the joint links the rigid body is attached.

inline getNumShapes ():Int

Returns the number of the shapes added.

inline getOrientation ():Quat

Returns the rotation of the rigid body as a quaternion.

inline getOrientationTo (orientation:Quat):Void

Sets orientation to the rotation quaternion of the rigid body.

-

This does not create a new instance of Quat.

inline getPosition ():Vec3

Returns the world position of the rigid body.

inline getPositionTo (position:Vec3):Void

Sets position to the world position of the rigid body.

-

This does not create a new instance of Vec3.

inline getPrev ():RigidBody

Returns the previous rigid body in the world.

-

If the previous one does not exist, null will be returned.

inline getRotation ():Mat3

Returns the rotation matrix of the rigid body.

inline getRotationFactor ():Vec3

Returns the rotation factor of the rigid body.

inline getRotationTo (rotation:Mat3):Void

Sets rotation to the rotation matrix of the rigid body.

-

This does not create a new instance of Mat3.

inline getShapeList ():Shape

Returns the list of the shapes of the rigid body.

inline getSleepTime ():Float

Returns how long the rigid body is stopping moving. This returns 0 if the body -has already slept.

inline getTransform ():Transform

Returns the transform of the rigid body.

inline getTransformTo (transform:Transform):Void

Sets transform to the transform of the rigid body.

-

This does not create a new instance of Transform.

inline getType ():Int

Returns the rigid body's type of behaviour.

-

See RigidBodyType class for details.

inline getWorldPoint (localPoint:Vec3):Vec3

Returns the world coordinates of the point localPoint in local coodinates.

inline getWorldPointTo (localPoint:Vec3, worldPoint:Vec3):Void

Sets worldPoint to the world coordinates of the point localPoint in local coodinates.

-

This does not create a new instance of Vec3.

inline getWorldVector (localVector:Vec3):Vec3

Returns the world coordinates of the vector localVector in local coodinates.

inline getWorldVectorTo (localVector:Vec3, worldVector:Vec3):Void

Sets worldVector to the world coordinates of the vector localVector in local coodinates.

-

This does not create a new instance of Vec3.

inline isSleeping ():Bool

Returns whether the rigid body is sleeping.

removeShape (shape:Shape):Void

Removes the shape from the rigid body.

inline rotate (rotation:Mat3):Void

Rotates the rigid body by the rotation matrix rotation.

inline rotateXyz (eulerAngles:Vec3):Void

Rotates the rigid body by Euler angles eulerAngles in radians.

inline setAngularDamping (damping:Float):Void

Sets the angular damping to damping.

inline setAngularVelocity (angularVelocity:Vec3):Void

Sets the angular velocity of the rigid body.

inline setAutoSleep (autoSleepEnabled:Bool):Void

Sets the rigid body's auto sleep flag.

-

If auto sleep is enabled, the rigid body will automatically sleep when needed.

inline setGravityScale (gravityScale:Float):Void

Sets the gravity scaling factor of the rigid body to gravityScale.

-

If 0 is set, the rigid body will not be affected by gravity.

inline setLinearDamping (damping:Float):Void

Sets the linear damping to damping.

inline setLinearVelocity (linearVelocity:Vec3):Void

Sets the linear velocity of the rigid body.

inline setMassData (massData:MassData):Void

Sets the mass and moment of inertia of the rigid body by the mass data massData. -The properties set by this will be overwritten when

  • some shapes are added or removed
  • the type of the rigid body is changed

inline setOrientation (quaternion:Quat):Void

Sets the rotation of the rigid body from a quaternion quaternion.

inline setPosition (position:Vec3):Void

Sets the world position of the rigid body to position.

inline setRotation (rotation:Mat3):Void

Sets the rotation matrix of the rigid body to rotation.

inline setRotationFactor (rotationFactor:Vec3):Void

Sets the rotation factor of the rigid body to rotationFactor.

+three motion types: dynamic, static, and kinematic. See RigidBodyType for +details of motion types.

Constructor

new (config:RigidBodyConfig)

Creates a new rigid body by configuration config.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inlineaddAngularVelocity (angularVelocityChange:Vec3):Void

Adds angularVelocityChange to the angular velcity of the rigid body.

inlineaddLinearVelocity (linearVelocityChange:Vec3):Void

Adds linearVelocityChange to the linear velcity of the rigid body.

addShape (shape:Shape):Void

Adds the shape to the rigid body.

applyAngularImpulse (impulse:Vec3):Void

Applies the angular impulse impulse to the rigid body.

+

This does not change the linear velocity.

applyForce (force:Vec3, positionInWorld:Vec3):Void

Applies the force force to positionInWorld in world position.

applyForceToCenter (force:Vec3):Void

Applies the force force to the center of mass.

applyImpulse (impulse:Vec3, positionInWorld:Vec3):Void

Applies the impulse impulse to the rigid body at positionInWorld in world position.

+

This changes both the linear velocity and the angular velocity.

applyLinearImpulse (impulse:Vec3):Void

Applies the linear impulse impulse to the rigid body.

+

This does not change the angular velocity.

applyTorque (torque:Vec3):Void

Applies the torque torque.

inlinegetAngularContactImpulse ():Vec3

Returns the total angular impulse applied by contact constraints.

inlinegetAngularContactImpulseTo (angularContactImpulse:Vec3):Void

Sets angularContactImpulse to the total angular impulse applied by contact constraints.

+

This does not create a new instance of Vec3.

inlinegetAngularDamping ():Float

Returns the angular damping.

inlinegetAngularVelocity ():Vec3

Returns the angular velocity of the rigid body.

inlinegetAngularVelocityTo (angularVelocity:Vec3):Void

Sets angularVelocity to the angular velocity of the rigid body.

+

This does not create a new intrance of Vec3.

inlinegetContactLinkList ():ContactLink

Returns the list of the contact links the rigid body is involved.

inlinegetGravityScale ():Float

Returns the gravity scaling factor of the rigid body.

inlinegetJointLinkList ():JointLink

Returns the list of the joint links the rigid body is attached.

inlinegetLinearContactImpulse ():Vec3

Returns the total linear impulse applied by contact constraints.

inlinegetLinearContactImpulseTo (linearContactImpulse:Vec3):Void

Sets linearContactImpulse to the total linear impulse applied by contact constraints.

+

This does not create a new instance of Vec3.

inlinegetLinearDamping ():Float

Returns the linear damping.

inlinegetLinearVelocity ():Vec3

Returns the linear velocity of the rigid body.

inlinegetLinearVelocityTo (linearVelocity:Vec3):Void

Sets linearVelocity to the linear velocity of the rigid body.

+

This does not create a new intrance of Vec3.

inlinegetLocalInertia ():Mat3

Returns the moment of inertia tensor in local space.

inlinegetLocalInertiaTo (inertia:Mat3):Void

Sets inertia to the moment of inertia tensor in local space.

+

This does not create a new instance of Mat3

inlinegetLocalPoint (worldPoint:Vec3):Vec3

Returns the local coordinates of the point worldPoint in world coodinates.

inlinegetLocalPointTo (worldPoint:Vec3, localPoint:Vec3):Void

Sets localPoint to the local coordinates of the point worldPoint in world coodinates.

+

This does not create a new instance of Vec3.

inlinegetLocalVector (worldVector:Vec3):Vec3

Returns the local coordinates of the vector worldVector in world coodinates.

inlinegetLocalVectorTo (worldVector:Vec3, localVector:Vec3):Void

Sets localVector to the local coordinates of the vector worldVector in world coodinates.

+

This does not create a new instance of Vec3.

inlinegetMass ():Float

Returns the mass of the rigid body.

+

If the rigid body has infinite mass, 0 will be returned.

inlinegetMassData ():MassData

Returns the mass data of the rigid body.

inlinegetMassDataTo (massData:MassData):Void

Sets massData to the mass data of the rigid body.

+

This does not create a new instance of MassData.

inlinegetNext ():RigidBody

Returns the next rigid body in the world.

+

If the next one does not exist, null will be returned.

inlinegetNumContectLinks ():Int

Returns the number of the contact lists the rigid body is involved.

inlinegetNumJointLinks ():Int

Returns the number of the joint links the rigid body is attached.

inlinegetNumShapes ():Int

Returns the number of the shapes added.

inlinegetOrientation ():Quat

Returns the rotation of the rigid body as a quaternion.

inlinegetOrientationTo (orientation:Quat):Void

Sets orientation to the rotation quaternion of the rigid body.

+

This does not create a new instance of Quat.

inlinegetPosition ():Vec3

Returns the world position of the rigid body.

inlinegetPositionTo (position:Vec3):Void

Sets position to the world position of the rigid body.

+

This does not create a new instance of Vec3.

inlinegetPrev ():RigidBody

Returns the previous rigid body in the world.

+

If the previous one does not exist, null will be returned.

inlinegetRotation ():Mat3

Returns the rotation matrix of the rigid body.

inlinegetRotationFactor ():Vec3

Returns the rotation factor of the rigid body.

inlinegetRotationTo (rotation:Mat3):Void

Sets rotation to the rotation matrix of the rigid body.

+

This does not create a new instance of Mat3.

inlinegetShapeList ():Shape

Returns the list of the shapes of the rigid body.

inlinegetSleepTime ():Float

Returns how long the rigid body is stopping moving. This returns 0 if the body +has already slept.

inlinegetTransform ():Transform

Returns the transform of the rigid body.

inlinegetTransformTo (transform:Transform):Void

Sets transform to the transform of the rigid body.

+

This does not create a new instance of Transform.

inlinegetType ():Int

Returns the rigid body's type of behaviour.

+

See RigidBodyType class for details.

inlinegetWorldPoint (localPoint:Vec3):Vec3

Returns the world coordinates of the point localPoint in local coodinates.

inlinegetWorldPointTo (localPoint:Vec3, worldPoint:Vec3):Void

Sets worldPoint to the world coordinates of the point localPoint in local coodinates.

+

This does not create a new instance of Vec3.

inlinegetWorldVector (localVector:Vec3):Vec3

Returns the world coordinates of the vector localVector in local coodinates.

inlinegetWorldVectorTo (localVector:Vec3, worldVector:Vec3):Void

Sets worldVector to the world coordinates of the vector localVector in local coodinates.

+

This does not create a new instance of Vec3.

inlineisSleeping ():Bool

Returns whether the rigid body is sleeping.

removeShape (shape:Shape):Void

Removes the shape from the rigid body.

inlinerotate (rotation:Mat3):Void

Rotates the rigid body by the rotation matrix rotation.

inlinerotateXyz (eulerAngles:Vec3):Void

Rotates the rigid body by Euler angles eulerAngles in radians.

inlinesetAngularDamping (damping:Float):Void

Sets the angular damping to damping.

inlinesetAngularVelocity (angularVelocity:Vec3):Void

Sets the angular velocity of the rigid body.

inlinesetAutoSleep (autoSleepEnabled:Bool):Void

Sets the rigid body's auto sleep flag.

+

If auto sleep is enabled, the rigid body will automatically sleep when needed.

inlinesetGravityScale (gravityScale:Float):Void

Sets the gravity scaling factor of the rigid body to gravityScale.

+

If 0 is set, the rigid body will not be affected by gravity.

inlinesetLinearDamping (damping:Float):Void

Sets the linear damping to damping.

inlinesetLinearVelocity (linearVelocity:Vec3):Void

Sets the linear velocity of the rigid body.

inlinesetMassData (massData:MassData):Void

Sets the mass and moment of inertia of the rigid body by the mass data massData. +The properties set by this will be overwritten when

  • some shapes are added or removed
  • the type of the rigid body is changed

inlinesetOrientation (quaternion:Quat):Void

Sets the rotation of the rigid body from a quaternion quaternion.

inlinesetPosition (position:Vec3):Void

Sets the world position of the rigid body to position.

inlinesetRotation (rotation:Mat3):Void

Sets the rotation matrix of the rigid body to rotation.

inlinesetRotationFactor (rotationFactor:Vec3):Void

Sets the rotation factor of the rigid body to rotationFactor.

This changes moment of inertia internally, so that the change of angular velocity in global space along X, Y and Z axis will scale by rotationFactor.x, -rotationFactor.y and rotationFactor.z times respectively.

inline setRotationXyz (eulerAngles:Vec3):Void

Sets the rotation of the rigid body by Euler angles eulerAngles in radians.

inline setTransform (transform:Transform):Void

Sets the transform of the rigid body to transform.

-

This does not keep any references to transform.

setType (type:Int):Void

Sets the rigid body's type of behaviour.

-

See RigidBodyType class for details.

inline sleep ():Void

Sets the rigid body's sleep flag true.

-

This also resets the sleeping timer of the rigid body.

inline translate (translation:Vec3):Void

Translates the position of the rigid body by translation.

inline wakeUp ():Void

Sets the rigid body's sleep flag false.

-

This also resets the sleeping timer of the rigid body.

\ No newline at end of file +rotationFactor.y and rotationFactor.z times respectively.

inlinesetRotationXyz (eulerAngles:Vec3):Void

Sets the rotation of the rigid body by Euler angles eulerAngles in radians.

inlinesetTransform (transform:Transform):Void

Sets the transform of the rigid body to transform.

+

This does not keep any references to transform.

setType (type:Int):Void

Sets the rigid body's type of behaviour.

+

See RigidBodyType class for details.

inlinesleep ():Void

Sets the rigid body's sleep flag true.

+

This also resets the sleeping timer of the rigid body.

inlinetranslate (translation:Vec3):Void

Translates the position of the rigid body by translation.

inlinewakeUp ():Void

Sets the rigid body's sleep flag false.

+

This also resets the sleeping timer of the rigid body.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html index 51ca23e..d5b1592 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html @@ -1,16 +1,16 @@ -oimo.dynamics.rigidbody.RigidBodyConfig - OimoPhysics API documentationoimo.dynamics.rigidbody.RigidBodyConfig - OimoPhysics API documentation

A rigid body configuration is used for constructions of rigid bodies. An instance of this +

A rigid body configuration is used for constructions of rigid bodies. An instance of this class can safely be reused, as a rigid body will not have any references to a field of -this class.

Constructor

new ()

Default constructor.

Variables

angularDamping:Float

The damping coefficient of the angular velocity. Set positive values to -gradually reduce the angular velocity.

angularVelocity:Vec3

The initial value of the rigid body's angular velocity.

autoSleep:Bool

Whether to automatically sleep the rigid body when it stops moving -for a certain period of time, namely Setting.sleepingTimeThreshold.

linearDamping:Float

The damping coefficient of the linear velocity. Set positive values to -gradually reduce the linear velocity.

linearVelocity:Vec3

The initial value of the rigid body's linear velocity.

position:Vec3

The world position of the rigid body's center of gravity.

rotation:Mat3

The rotation matrix of the rigid body.

type:Int

The rigid body's motion type. See RigidBodyType for details.

\ No newline at end of file +this class.

Constructor

new ()

Default constructor.

Variables

angularDamping:Float

The damping coefficient of the angular velocity. Set positive values to +gradually reduce the angular velocity.

angularVelocity:Vec3

The initial value of the rigid body's angular velocity.

autoSleep:Bool

Whether to automatically sleep the rigid body when it stops moving +for a certain period of time, namely Setting.sleepingTimeThreshold.

linearDamping:Float

The damping coefficient of the linear velocity. Set positive values to +gradually reduce the linear velocity.

linearVelocity:Vec3

The initial value of the rigid body's linear velocity.

position:Vec3

The world position of the rigid body's center of gravity.

rotation:Mat3

The rotation matrix of the rigid body.

type:Int

The rigid body's motion type. See RigidBodyType for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyType.html b/docs/oimo/dynamics/rigidbody/RigidBodyType.html index 9b04660..97834c6 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyType.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyType.html @@ -1,14 +1,14 @@ -oimo.dynamics.rigidbody.RigidBodyType - OimoPhysics API documentation

The list of a rigid body's motion types.

Static variables

staticread onlyDYNAMIC:Int

Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia -tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved.

staticread onlyKINEMATIC:Int

Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except +

The list of a rigid body's motion types.

Static variables

@:value(_DYNAMIC)staticread onlyDYNAMIC:Int = _DYNAMIC

Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia +tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved.

@:value(_KINEMATIC)staticread onlyKINEMATIC:Int = _KINEMATIC

Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except that it can have non-zero linear and angular velocities. This is useful for overlapping rigid -bodies to pre-computed motions.

staticread onlySTATIC:Int

Represents a static rigid body. A static rigid body has zero velocities and infinite mass +bodies to pre-computed motions.

@:value(_STATIC)staticread onlySTATIC:Int = _STATIC

Represents a static rigid body. A static rigid body has zero velocities and infinite mass and inertia tensor. The rigid body is not affected by any force or impulse, such as gravity, -constraints, or external forces or impulses added by an user.

\ No newline at end of file +constraints, or external forces or impulses added by an user.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/Shape.html b/docs/oimo/dynamics/rigidbody/Shape.html index bc5ff87..73709c7 100644 --- a/docs/oimo/dynamics/rigidbody/Shape.html +++ b/docs/oimo/dynamics/rigidbody/Shape.html @@ -1,24 +1,24 @@ -oimo.dynamics.rigidbody.Shape - OimoPhysics API documentationoimo.dynamics.rigidbody.Shape - OimoPhysics API documentation

A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body +

A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body with some physical properties such as coefficients of friction and restitution. The collision -geometry can locally be transformed relative to the parent rigid body's center of gravity.

Constructor

new (config:ShapeConfig)

Creates a new shape by configuration config.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inline getAabb ():Aabb

Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a -parent rigid body.

inline getAabbTo (aabb:Aabb):Void

Sets aabb to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a +geometry can locally be transformed relative to the parent rigid body's center of gravity.

Constructor

new (config:ShapeConfig)

Creates a new shape by configuration config.

Variables

userData:Any

Extra field that users can use for their own purposes.

Methods

inlinegetAabb ():Aabb

Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a +parent rigid body.

inlinegetAabbTo (aabb:Aabb):Void

Sets aabb to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a parent rigid body.

-

This does not create a new instance of AABB.

inline getCollisionGroup ():Int

Returns the collision group bits the shape belongs to.

inline getCollisionMask ():Int

Returns the collision mask bits of the shape.

inline getContactCallback ():ContactCallback

Returns the contact callback of the shape.

inline getDensity ():Float

Returns the density of the shape.

inline getFriction ():Float

Returns the coefficient of friction.

inline getGeometry ():Geometry

Returns the colision geometry of the shape.

inline getLocalTransform ():Transform

Returns the transform of the shape relative to the parent rigid body's transform.

inline getLocalTransformTo (transform:Transform):Void

Sets transform to the transform of the shape relative to the parent rigid body's +

This does not create a new instance of AABB.

inlinegetCollisionGroup ():Int

Returns the collision group bits the shape belongs to.

inlinegetCollisionMask ():Int

Returns the collision mask bits of the shape.

inlinegetContactCallback ():ContactCallback

Returns the contact callback of the shape.

inlinegetDensity ():Float

Returns the density of the shape.

inlinegetFriction ():Float

Returns the coefficient of friction.

inlinegetGeometry ():Geometry

Returns the colision geometry of the shape.

inlinegetLocalTransform ():Transform

Returns the transform of the shape relative to the parent rigid body's transform.

inlinegetLocalTransformTo (transform:Transform):Void

Sets transform to the transform of the shape relative to the parent rigid body's transform.

-

This does not create a new instance of Transform.

inline getNext ():Shape

Returns the next shape in the rigid body.

-

If the next one does not exist, null will be returned.

inline getPrev ():Shape

Returns the previous shape in the rigid body.

-

If the previous one does not exist, null will be returned.

inline getRestitution ():Float

Returns the coefficient of restitution.

inline getRigidBody ():RigidBody

Returns the parent rigid body. This returns null if the shape doesn't have a parent -rigid body.

inline getTransform ():Transform

Returns the world transform of the shape.

inline getTransformTo (transform:Transform):Void

Sets transform to the world transform of the shape.

-

This does not create a new instance of Transform.

inline setCollisionGroup (collisionGroup:Int):Void

Sets the shape's collision group bits to collisionGroup.

inline setCollisionMask (collisionMask:Int):Void

Sets the shape's collision mask bits to collisionMask.

inline setContactCallback (callback:ContactCallback):Void

Sets the contact callback of the shape to callback.

inline setDensity (density:Float):Void

Sets the density of the shape to density.

-

This affects the parent rigid body's mass data.

inline setFriction (friction:Float):Void

Sets the coefficient of friction to friction.

inline setLocalTransform (transform:Transform):Void

Sets the shape's transform to transform relative to the parent rigid body's transform.

-

This affects the parent rigid body's mass data.

inline setRestitution (restitution:Float):Void

Sets the coefficient of restitution to restitution.

\ No newline at end of file +

This does not create a new instance of Transform.

inlinegetNext ():Shape

Returns the next shape in the rigid body.

+

If the next one does not exist, null will be returned.

inlinegetPrev ():Shape

Returns the previous shape in the rigid body.

+

If the previous one does not exist, null will be returned.

inlinegetRestitution ():Float

Returns the coefficient of restitution.

inlinegetRigidBody ():RigidBody

Returns the parent rigid body. This returns null if the shape doesn't have a parent +rigid body.

inlinegetTransform ():Transform

Returns the world transform of the shape.

inlinegetTransformTo (transform:Transform):Void

Sets transform to the world transform of the shape.

+

This does not create a new instance of Transform.

inlinesetCollisionGroup (collisionGroup:Int):Void

Sets the shape's collision group bits to collisionGroup.

inlinesetCollisionMask (collisionMask:Int):Void

Sets the shape's collision mask bits to collisionMask.

inlinesetContactCallback (callback:ContactCallback):Void

Sets the contact callback of the shape to callback.

inlinesetDensity (density:Float):Void

Sets the density of the shape to density.

+

This affects the parent rigid body's mass data.

inlinesetFriction (friction:Float):Void

Sets the coefficient of friction to friction.

inlinesetLocalTransform (transform:Transform):Void

Sets the shape's transform to transform relative to the parent rigid body's transform.

+

This affects the parent rigid body's mass data.

inlinesetRestitution (restitution:Float):Void

Sets the coefficient of restitution to restitution.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/ShapeConfig.html b/docs/oimo/dynamics/rigidbody/ShapeConfig.html index f6f92db..593ab01 100644 --- a/docs/oimo/dynamics/rigidbody/ShapeConfig.html +++ b/docs/oimo/dynamics/rigidbody/ShapeConfig.html @@ -1,23 +1,23 @@ -oimo.dynamics.rigidbody.ShapeConfig - OimoPhysics API documentationoimo.dynamics.rigidbody.ShapeConfig - OimoPhysics API documentation

A shape configuration is used for construction of shapes. An instance of +

A shape configuration is used for construction of shapes. An instance of this class can safely be reused as a shape will not have any references -of a field of this class.

Constructor

new ()

Default constructor.

Variables

collisionGroup:Int

The collision group bits the shape belongs to. This is used for collision +of a field of this class.

Constructor

new ()

Default constructor.

Variables

collisionGroup:Int

The collision group bits the shape belongs to. This is used for collision filtering.

Two shapes shape1 and shape2 will collide only if both shape1.collisionGroup & shape2.collisionMask and -shape2.collisionGroup & shape1.collisionMask are not zero.

collisionMask:Int

The collision mask bits of the shape. This is used for collision +shape2.collisionGroup & shape1.collisionMask are not zero.

collisionMask:Int

The collision mask bits of the shape. This is used for collision filtering.

Two shapes shape1 and shape2 will collide only if both shape1.collisionGroup & shape2.collisionMask and -shape2.collisionGroup & shape1.collisionMask are not zero.

contactCallback:ContactCallback

The contact callback of the shape. The callback methods are called -when contact events the shape is involved occurred.

density:Float

The density of the shape, usually in Kg/m^3.

friction:Float

The coefficient of friction of the shape.

geometry:Geometry

The collision geometry of the shape.

position:Vec3

The shape's local position relative to the parent rigid body's origin.

restitution:Float

The coefficient of restitution of the shape.

rotation:Mat3

The shape's local rotation matrix relative to the parent rigid body's -rotation.

\ No newline at end of file +shape2.collisionGroup & shape1.collisionMask are not zero.

contactCallback:ContactCallback

The contact callback of the shape. The callback methods are called +when contact events the shape is involved occurred.

density:Float

The density of the shape, usually in Kg/m^3.

friction:Float

The coefficient of friction of the shape.

geometry:Geometry

The collision geometry of the shape.

position:Vec3

The shape's local position relative to the parent rigid body's origin.

restitution:Float

The coefficient of restitution of the shape.

rotation:Mat3

The shape's local rotation matrix relative to the parent rigid body's +rotation.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/index.html b/docs/oimo/dynamics/rigidbody/index.html index 8b11d25..c93d473 100644 --- a/docs/oimo/dynamics/rigidbody/index.html +++ b/docs/oimo/dynamics/rigidbody/index.html @@ -1,19 +1,19 @@ -oimo.dynamics.rigidbody - OimoPhysics API documentation

oimo.dynamics.rigidbody

OimoPhysics API Documentation

..
MassData

This class holds mass and moment of inertia for a rigid body.

RigidBody

A rigid body. To add a rigid body to a physics world, create a RigidBody +

oimo.dynamics.rigidbody

OimoPhysics API Documentation

..
MassData

This class holds mass and moment of inertia for a rigid body.

RigidBody

A rigid body. To add a rigid body to a physics world, create a RigidBody instance, create and add shapes via RigidBody.addShape, and add the rigid body to the physics world through World.addRigidBody. Rigid bodies have -three motion types: dynamic, static, and kinematic. See RigidBodyType for -details of motion types.

RigidBodyConfig

A rigid body configuration is used for constructions of rigid bodies. An instance of this +three motion types: dynamic, static, and kinematic. See RigidBodyType for +details of motion types.

RigidBodyConfig

A rigid body configuration is used for constructions of rigid bodies. An instance of this class can safely be reused, as a rigid body will not have any references to a field of -this class.

RigidBodyType

The list of a rigid body's motion types.

Shape

A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body +this class.

RigidBodyType

The list of a rigid body's motion types.

Shape

A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body with some physical properties such as coefficients of friction and restitution. The collision -geometry can locally be transformed relative to the parent rigid body's center of gravity.

ShapeConfig

A shape configuration is used for construction of shapes. An instance of +geometry can locally be transformed relative to the parent rigid body's center of gravity.

ShapeConfig

A shape configuration is used for construction of shapes. An instance of this class can safely be reused as a shape will not have any references -of a field of this class.

\ No newline at end of file +of a field of this class.

\ No newline at end of file diff --git a/docs/oimo/index.html b/docs/oimo/index.html index c92451e..e07c210 100644 --- a/docs/oimo/index.html +++ b/docs/oimo/index.html @@ -1,9 +1,9 @@ -oimo - OimoPhysics API documentation

oimo

OimoPhysics API Documentation

..
collision
common
dynamics
\ No newline at end of file +

oimo

OimoPhysics API Documentation

..
collision
common
dynamics
\ No newline at end of file diff --git a/docs/styles.css b/docs/styles.css index f6f3111..e23a3d0 100644 --- a/docs/styles.css +++ b/docs/styles.css @@ -33,7 +33,7 @@ .nav-list {padding-right: 0; } .nav-list>li>a, .nav-list .nav-header {margin-right:0;} .nav-list>li>a.treeLink {padding-left:20px;} -.nav-list a { word-wrap: break-word; font-size:14px; text-shadow: none!important;} +.nav-list a { overflow: hidden; font-size:14px; text-shadow: none!important;} .nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus { background:#999; color:#fff; @@ -54,6 +54,9 @@ footer{ margin-top:40px; font-size:14px; } +.section.site-footer { + border-bottom: 0px; +} .copyright { padding: 6px; overflow: hidden; @@ -98,7 +101,7 @@ footer{ } .availability { - color: #AB611A; + color: #e48931; font-size: 90%; } @@ -112,10 +115,29 @@ h3 code { margin-left: -10px; } -h3 span.label { +h3 span.label, .label-meta { margin-right: 5px; } +.label.label-meta { + background:#5959AC; +} + +/* hide meta that has doesn't belong in the API (implementation details) */ +.label-meta-impl, .label-meta-value, .label-meta-has_untyped, .label-meta-hlNative, .label-meta-access, .label-meta-allow, .label-meta-keep, .label-meta-keepInit, .label-meta-keepSub, .label-meta-dox, .label-meta-noCompletion, .label-meta-directlyUsed, .label-meta-build, .label-meta-autoBuild, .label-meta-genericBuild, .label-meta-analyzer, .label-meta-enum, .label-meta-extern { + display:none; +} + +.label-meta.label-meta-from, .label-meta.label-meta-to { + background:#a93685; +} + +.alert.alert-deprecated { + font-size: 90%; + margin-bottom: 10px; + padding: 4px 35px 4px 14px; +} + code { font-family: Monaco,Menlo,Consolas,"Courier New",monospace; font-weight: normal; diff --git a/demos/src/demo/Export.hx b/exports/src/export/Export.hx similarity index 94% rename from demos/src/demo/Export.hx rename to exports/src/export/Export.hx index 9a7ca48..89c198f 100644 --- a/demos/src/demo/Export.hx +++ b/exports/src/export/Export.hx @@ -1,4 +1,4 @@ -package demo; +package export; import oimo.dynamics.common.DebugDraw; import oimo.collision.broadphase.BroadPhase; @@ -27,8 +27,10 @@ import oimo.collision.geometry.SphereGeometry; import oimo.collision.narrowphase.CollisionMatrix; import oimo.collision.narrowphase.DetectorResult; import oimo.collision.narrowphase.DetectorResultPoint; -import oimo.collision.narrowphase.detector.CachedDetectorData; import oimo.collision.narrowphase.detector.Detector; +import oimo.collision.narrowphase.detector.BoxBoxDetector; +import oimo.collision.narrowphase.detector.BoxBoxDetectorMacro; +import oimo.collision.narrowphase.detector.CachedDetectorData; import oimo.collision.narrowphase.detector.CapsuleCapsuleDetector; import oimo.collision.narrowphase.detector.GjkEpaDetector; import oimo.collision.narrowphase.detector.SphereBoxDetector; @@ -75,11 +77,13 @@ import oimo.dynamics.constraint.info.contact.ContactSolverInfo; import oimo.dynamics.constraint.info.contact.ContactSolverInfoRow; import oimo.dynamics.constraint.info.joint.JointSolverInfo; import oimo.dynamics.constraint.info.joint.JointSolverInfoRow; +import oimo.dynamics.constraint.joint.BasisTracker; import oimo.dynamics.constraint.joint.Joint; import oimo.dynamics.constraint.joint.CylindricalJoint; import oimo.dynamics.constraint.joint.JointConfig; import oimo.dynamics.constraint.joint.CylindricalJointConfig; -import oimo.dynamics.constraint.joint.BasisTracker; +import oimo.dynamics.constraint.joint.GenericJoint; +import oimo.dynamics.constraint.joint.GenericJointConfig; import oimo.dynamics.constraint.joint.JointImpulse; import oimo.dynamics.constraint.joint.JointLink; import oimo.dynamics.constraint.joint.JointMacro; @@ -116,9 +120,8 @@ import oimo.dynamics.rigidbody.Shape; import oimo.dynamics.rigidbody.ShapeConfig; /** - * ... + * this class just imports all the classes in the library */ class Export { - static function main():Void { - } + static function main() {} } diff --git a/exports/src/export/js/Export.hx b/exports/src/export/js/Export.hx new file mode 100644 index 0000000..d19a391 --- /dev/null +++ b/exports/src/export/js/Export.hx @@ -0,0 +1,787 @@ +package export.js; + +import oimo.dynamics.common.DebugDraw; +import oimo.collision.broadphase.BroadPhase; +import oimo.collision.geometry.Geometry; +import oimo.collision.geometry.ConvexGeometry; +import oimo.collision.broadphase.BroadPhaseProxyCallback; +import oimo.collision.broadphase.BroadPhaseType; +import oimo.collision.broadphase.Proxy; +import oimo.collision.broadphase.ProxyPair; +import oimo.collision.broadphase.bruteforce.BruteForceBroadPhase; +import oimo.collision.broadphase.bvh.BvhBroadPhase; +import oimo.collision.broadphase.bvh.BvhInsertionStrategy; +import oimo.collision.broadphase.bvh.BvhNode; +import oimo.collision.broadphase.bvh.BvhProxy; +import oimo.collision.broadphase.bvh.BvhStrategy; +import oimo.collision.broadphase.bvh.BvhTree; +import oimo.collision.geometry.Aabb; +import oimo.collision.geometry.BoxGeometry; +import oimo.collision.geometry.CapsuleGeometry; +import oimo.collision.geometry.ConeGeometry; +import oimo.collision.geometry.ConvexHullGeometry; +import oimo.collision.geometry.CylinderGeometry; +import oimo.collision.geometry.GeometryType; +import oimo.collision.geometry.RayCastHit; +import oimo.collision.geometry.SphereGeometry; +import oimo.collision.narrowphase.CollisionMatrix; +import oimo.collision.narrowphase.DetectorResult; +import oimo.collision.narrowphase.DetectorResultPoint; +import oimo.collision.narrowphase.detector.Detector; +import oimo.collision.narrowphase.detector.BoxBoxDetector; +import oimo.collision.narrowphase.detector.BoxBoxDetectorMacro; +import oimo.collision.narrowphase.detector.CachedDetectorData; +import oimo.collision.narrowphase.detector.CapsuleCapsuleDetector; +import oimo.collision.narrowphase.detector.GjkEpaDetector; +import oimo.collision.narrowphase.detector.SphereBoxDetector; +import oimo.collision.narrowphase.detector.SphereCapsuleDetector; +import oimo.collision.narrowphase.detector.SphereSphereDetector; +import oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron; +import oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState; +import oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; +import oimo.collision.narrowphase.detector.gjkepa.EpaVertex; +import oimo.collision.narrowphase.detector.gjkepa.GjkCache; +import oimo.common.Vec3; +import oimo.common.Transform; +import oimo.common.Setting; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpa; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpaLog; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState; +import oimo.collision.narrowphase.detector.gjkepa.SimplexUtil; +import oimo.common.Mat3; +import oimo.common.Mat4; +import oimo.common.MathUtil; +import oimo.common.Pool; +import oimo.common.Quat; +import oimo.dynamics.Contact; +import oimo.dynamics.ContactLink; +import oimo.dynamics.ContactManager; +import oimo.dynamics.Island; +import oimo.dynamics.TimeStep; +import oimo.dynamics.World; +import oimo.dynamics.callback.AabbTestCallback; +import oimo.dynamics.callback.ContactCallback; +import oimo.dynamics.callback.RayCastCallback; +import oimo.dynamics.callback.RayCastClosest; +import oimo.dynamics.common.DebugDrawStyle; +import oimo.dynamics.common.Performance; +import oimo.dynamics.constraint.ConstraintSolver; +import oimo.dynamics.constraint.PositionCorrectionAlgorithm; +import oimo.dynamics.constraint.contact.ContactConstraint; +import oimo.dynamics.constraint.contact.ContactImpulse; +import oimo.dynamics.constraint.contact.Manifold; +import oimo.dynamics.constraint.contact.ManifoldPoint; +import oimo.dynamics.constraint.contact.ManifoldUpdater; +import oimo.dynamics.constraint.info.JacobianRow; +import oimo.dynamics.constraint.info.contact.ContactSolverInfo; +import oimo.dynamics.constraint.info.contact.ContactSolverInfoRow; +import oimo.dynamics.constraint.info.joint.JointSolverInfo; +import oimo.dynamics.constraint.info.joint.JointSolverInfoRow; +import oimo.dynamics.constraint.joint.BasisTracker; +import oimo.dynamics.constraint.joint.Joint; +import oimo.dynamics.constraint.joint.CylindricalJoint; +import oimo.dynamics.constraint.joint.JointConfig; +import oimo.dynamics.constraint.joint.CylindricalJointConfig; +import oimo.dynamics.constraint.joint.GenericJoint; +import oimo.dynamics.constraint.joint.GenericJointConfig; +import oimo.dynamics.constraint.joint.JointImpulse; +import oimo.dynamics.constraint.joint.JointLink; +import oimo.dynamics.constraint.joint.JointMacro; +import oimo.dynamics.constraint.joint.JointType; +import oimo.dynamics.constraint.joint.PrismaticJoint; +import oimo.dynamics.constraint.joint.PrismaticJointConfig; +import oimo.dynamics.constraint.joint.RagdollJoint; +import oimo.dynamics.constraint.joint.RagdollJointConfig; +import oimo.dynamics.constraint.joint.RevoluteJoint; +import oimo.dynamics.constraint.joint.RevoluteJointConfig; +import oimo.dynamics.constraint.joint.RotationalLimitMotor; +import oimo.dynamics.constraint.joint.SphericalJoint; +import oimo.dynamics.constraint.joint.SphericalJointConfig; +import oimo.dynamics.constraint.joint.SpringDamper; +import oimo.dynamics.constraint.joint.TranslationalLimitMotor; +import oimo.dynamics.constraint.joint.UniversalJoint; +import oimo.dynamics.constraint.joint.UniversalJointConfig; +import oimo.dynamics.constraint.solver.ConstraintSolverType; +import oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow; +import oimo.dynamics.constraint.solver.common.JointSolverMassDataRow; +import oimo.dynamics.constraint.solver.direct.Boundary; +import oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo; +import oimo.dynamics.constraint.solver.direct.BoundaryBuilder; +import oimo.dynamics.constraint.solver.direct.BoundarySelector; +import oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver; +import oimo.dynamics.constraint.solver.direct.MassMatrix; +import oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver; +import oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver; +import oimo.dynamics.rigidbody.MassData; +import oimo.dynamics.rigidbody.RigidBody; +import oimo.dynamics.rigidbody.RigidBodyConfig; +import oimo.dynamics.rigidbody.RigidBodyType; +import oimo.dynamics.rigidbody.Shape; +import oimo.dynamics.rigidbody.ShapeConfig; + +/** + * main class to generate OimoPhysics.js + */ +class Export { + static function main():Void { + untyped __js__(' + window["OIMO"] = {}; + window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; + window["OIMO"]["BroadPhase"] = oimo_collision_broadphase_BroadPhase; + oimo_collision_broadphase_BroadPhase.prototype["createProxy"] = oimo_collision_broadphase_BroadPhase.prototype.createProxy; + oimo_collision_broadphase_BroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_BroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_BroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_BroadPhase.prototype.moveProxy; + oimo_collision_broadphase_BroadPhase.prototype["isOverlapping"] = oimo_collision_broadphase_BroadPhase.prototype.isOverlapping; + oimo_collision_broadphase_BroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_BroadPhase.prototype.collectPairs; + oimo_collision_broadphase_BroadPhase.prototype["getProxyPairList"] = oimo_collision_broadphase_BroadPhase.prototype.getProxyPairList; + oimo_collision_broadphase_BroadPhase.prototype["isIncremental"] = oimo_collision_broadphase_BroadPhase.prototype.isIncremental; + oimo_collision_broadphase_BroadPhase.prototype["getTestCount"] = oimo_collision_broadphase_BroadPhase.prototype.getTestCount; + oimo_collision_broadphase_BroadPhase.prototype["rayCast"] = oimo_collision_broadphase_BroadPhase.prototype.rayCast; + oimo_collision_broadphase_BroadPhase.prototype["convexCast"] = oimo_collision_broadphase_BroadPhase.prototype.convexCast; + oimo_collision_broadphase_BroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_BroadPhase.prototype.aabbTest; + window["OIMO"]["Geometry"] = oimo_collision_geometry_Geometry; + oimo_collision_geometry_Geometry.prototype["getType"] = oimo_collision_geometry_Geometry.prototype.getType; + oimo_collision_geometry_Geometry.prototype["getVolume"] = oimo_collision_geometry_Geometry.prototype.getVolume; + oimo_collision_geometry_Geometry.prototype["rayCast"] = oimo_collision_geometry_Geometry.prototype.rayCast; + window["OIMO"]["ConvexGeometry"] = oimo_collision_geometry_ConvexGeometry; + oimo_collision_geometry_ConvexGeometry.prototype["getGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.getGjkMergin; + oimo_collision_geometry_ConvexGeometry.prototype["setGjkMergin"] = oimo_collision_geometry_ConvexGeometry.prototype.setGjkMergin; + oimo_collision_geometry_ConvexGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexGeometry.prototype.computeLocalSupportingVertex; + oimo_collision_geometry_ConvexGeometry.prototype["rayCast"] = oimo_collision_geometry_ConvexGeometry.prototype.rayCast; + window["OIMO"]["BroadPhaseProxyCallback"] = oimo_collision_broadphase_BroadPhaseProxyCallback; + oimo_collision_broadphase_BroadPhaseProxyCallback.prototype["process"] = oimo_collision_broadphase_BroadPhaseProxyCallback.prototype.process; + window["OIMO"]["BroadPhaseType"] = oimo_collision_broadphase_BroadPhaseType; + window["OIMO"]["Proxy"] = oimo_collision_broadphase_Proxy; + oimo_collision_broadphase_Proxy.prototype["getId"] = oimo_collision_broadphase_Proxy.prototype.getId; + oimo_collision_broadphase_Proxy.prototype["getFatAabb"] = oimo_collision_broadphase_Proxy.prototype.getFatAabb; + oimo_collision_broadphase_Proxy.prototype["getFatAabbTo"] = oimo_collision_broadphase_Proxy.prototype.getFatAabbTo; + window["OIMO"]["ProxyPair"] = oimo_collision_broadphase_ProxyPair; + oimo_collision_broadphase_ProxyPair.prototype["getProxy1"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy1; + oimo_collision_broadphase_ProxyPair.prototype["getProxy2"] = oimo_collision_broadphase_ProxyPair.prototype.getProxy2; + oimo_collision_broadphase_ProxyPair.prototype["getNext"] = oimo_collision_broadphase_ProxyPair.prototype.getNext; + window["OIMO"]["BruteForceBroadPhase"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.createProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.moveProxy; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.collectPairs; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.rayCast; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.convexCast; + oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype.aabbTest; + window["OIMO"]["BvhBroadPhase"] = oimo_collision_broadphase_bvh_BvhBroadPhase; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["createProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.createProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.destroyProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["moveProxy"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.moveProxy; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["collectPairs"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.collectPairs; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["rayCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.rayCast; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["convexCast"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.convexCast; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["aabbTest"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.aabbTest; + oimo_collision_broadphase_bvh_BvhBroadPhase.prototype["getTreeBalance"] = oimo_collision_broadphase_bvh_BvhBroadPhase.prototype.getTreeBalance; + window["OIMO"]["Aabb"] = oimo_collision_geometry_Aabb; + oimo_collision_geometry_Aabb.prototype["init"] = oimo_collision_geometry_Aabb.prototype.init; + oimo_collision_geometry_Aabb.prototype["getMin"] = oimo_collision_geometry_Aabb.prototype.getMin; + oimo_collision_geometry_Aabb.prototype["getMinTo"] = oimo_collision_geometry_Aabb.prototype.getMinTo; + oimo_collision_geometry_Aabb.prototype["setMin"] = oimo_collision_geometry_Aabb.prototype.setMin; + oimo_collision_geometry_Aabb.prototype["getMax"] = oimo_collision_geometry_Aabb.prototype.getMax; + oimo_collision_geometry_Aabb.prototype["getMaxTo"] = oimo_collision_geometry_Aabb.prototype.getMaxTo; + oimo_collision_geometry_Aabb.prototype["setMax"] = oimo_collision_geometry_Aabb.prototype.setMax; + oimo_collision_geometry_Aabb.prototype["getCenter"] = oimo_collision_geometry_Aabb.prototype.getCenter; + oimo_collision_geometry_Aabb.prototype["getCenterTo"] = oimo_collision_geometry_Aabb.prototype.getCenterTo; + oimo_collision_geometry_Aabb.prototype["getExtents"] = oimo_collision_geometry_Aabb.prototype.getExtents; + oimo_collision_geometry_Aabb.prototype["getExtentsTo"] = oimo_collision_geometry_Aabb.prototype.getExtentsTo; + oimo_collision_geometry_Aabb.prototype["combine"] = oimo_collision_geometry_Aabb.prototype.combine; + oimo_collision_geometry_Aabb.prototype["combined"] = oimo_collision_geometry_Aabb.prototype.combined; + oimo_collision_geometry_Aabb.prototype["overlap"] = oimo_collision_geometry_Aabb.prototype.overlap; + oimo_collision_geometry_Aabb.prototype["getIntersection"] = oimo_collision_geometry_Aabb.prototype.getIntersection; + oimo_collision_geometry_Aabb.prototype["getIntersectionTo"] = oimo_collision_geometry_Aabb.prototype.getIntersectionTo; + oimo_collision_geometry_Aabb.prototype["copyFrom"] = oimo_collision_geometry_Aabb.prototype.copyFrom; + oimo_collision_geometry_Aabb.prototype["clone"] = oimo_collision_geometry_Aabb.prototype.clone; + window["OIMO"]["BoxGeometry"] = oimo_collision_geometry_BoxGeometry; + oimo_collision_geometry_BoxGeometry.prototype["getHalfExtents"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtents; + oimo_collision_geometry_BoxGeometry.prototype["getHalfExtentsTo"] = oimo_collision_geometry_BoxGeometry.prototype.getHalfExtentsTo; + oimo_collision_geometry_BoxGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_BoxGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CapsuleGeometry"] = oimo_collision_geometry_CapsuleGeometry; + oimo_collision_geometry_CapsuleGeometry.prototype["getRadius"] = oimo_collision_geometry_CapsuleGeometry.prototype.getRadius; + oimo_collision_geometry_CapsuleGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CapsuleGeometry.prototype.getHalfHeight; + oimo_collision_geometry_CapsuleGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CapsuleGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["ConeGeometry"] = oimo_collision_geometry_ConeGeometry; + oimo_collision_geometry_ConeGeometry.prototype["getRadius"] = oimo_collision_geometry_ConeGeometry.prototype.getRadius; + oimo_collision_geometry_ConeGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_ConeGeometry.prototype.getHalfHeight; + oimo_collision_geometry_ConeGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConeGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["ConvexHullGeometry"] = oimo_collision_geometry_ConvexHullGeometry; + oimo_collision_geometry_ConvexHullGeometry.prototype["getVertices"] = oimo_collision_geometry_ConvexHullGeometry.prototype.getVertices; + oimo_collision_geometry_ConvexHullGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_ConvexHullGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CylinderGeometry"] = oimo_collision_geometry_CylinderGeometry; + oimo_collision_geometry_CylinderGeometry.prototype["getRadius"] = oimo_collision_geometry_CylinderGeometry.prototype.getRadius; + oimo_collision_geometry_CylinderGeometry.prototype["getHalfHeight"] = oimo_collision_geometry_CylinderGeometry.prototype.getHalfHeight; + oimo_collision_geometry_CylinderGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_CylinderGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["GeometryType"] = oimo_collision_geometry_GeometryType; + window["OIMO"]["RayCastHit"] = oimo_collision_geometry_RayCastHit; + window["OIMO"]["SphereGeometry"] = oimo_collision_geometry_SphereGeometry; + oimo_collision_geometry_SphereGeometry.prototype["getRadius"] = oimo_collision_geometry_SphereGeometry.prototype.getRadius; + oimo_collision_geometry_SphereGeometry.prototype["computeLocalSupportingVertex"] = oimo_collision_geometry_SphereGeometry.prototype.computeLocalSupportingVertex; + window["OIMO"]["CollisionMatrix"] = oimo_collision_narrowphase_CollisionMatrix; + oimo_collision_narrowphase_CollisionMatrix.prototype["getDetector"] = oimo_collision_narrowphase_CollisionMatrix.prototype.getDetector; + window["OIMO"]["DetectorResult"] = oimo_collision_narrowphase_DetectorResult; + oimo_collision_narrowphase_DetectorResult.prototype["getMaxDepth"] = oimo_collision_narrowphase_DetectorResult.prototype.getMaxDepth; + oimo_collision_narrowphase_DetectorResult.prototype["clear"] = oimo_collision_narrowphase_DetectorResult.prototype.clear; + window["OIMO"]["DetectorResultPoint"] = oimo_collision_narrowphase_DetectorResultPoint; + window["OIMO"]["Detector"] = oimo_collision_narrowphase_detector_Detector; + oimo_collision_narrowphase_detector_Detector.prototype["detect"] = oimo_collision_narrowphase_detector_Detector.prototype.detect; + window["OIMO"]["BoxBoxDetector"] = oimo_collision_narrowphase_detector_BoxBoxDetector; + window["OIMO"]["CapsuleCapsuleDetector"] = oimo_collision_narrowphase_detector_CapsuleCapsuleDetector; + window["OIMO"]["GjkEpaDetector"] = oimo_collision_narrowphase_detector_GjkEpaDetector; + window["OIMO"]["SphereBoxDetector"] = oimo_collision_narrowphase_detector_SphereBoxDetector; + window["OIMO"]["SphereCapsuleDetector"] = oimo_collision_narrowphase_detector_SphereCapsuleDetector; + window["OIMO"]["SphereSphereDetector"] = oimo_collision_narrowphase_detector_SphereSphereDetector; + window["OIMO"]["Vec3"] = oimo_common_Vec3; + oimo_common_Vec3.prototype["init"] = oimo_common_Vec3.prototype.init; + oimo_common_Vec3.prototype["zero"] = oimo_common_Vec3.prototype.zero; + oimo_common_Vec3.prototype["add"] = oimo_common_Vec3.prototype.add; + oimo_common_Vec3.prototype["add3"] = oimo_common_Vec3.prototype.add3; + oimo_common_Vec3.prototype["addScaled"] = oimo_common_Vec3.prototype.addScaled; + oimo_common_Vec3.prototype["sub"] = oimo_common_Vec3.prototype.sub; + oimo_common_Vec3.prototype["sub3"] = oimo_common_Vec3.prototype.sub3; + oimo_common_Vec3.prototype["scale"] = oimo_common_Vec3.prototype.scale; + oimo_common_Vec3.prototype["scale3"] = oimo_common_Vec3.prototype.scale3; + oimo_common_Vec3.prototype["dot"] = oimo_common_Vec3.prototype.dot; + oimo_common_Vec3.prototype["cross"] = oimo_common_Vec3.prototype.cross; + oimo_common_Vec3.prototype["addEq"] = oimo_common_Vec3.prototype.addEq; + oimo_common_Vec3.prototype["add3Eq"] = oimo_common_Vec3.prototype.add3Eq; + oimo_common_Vec3.prototype["addScaledEq"] = oimo_common_Vec3.prototype.addScaledEq; + oimo_common_Vec3.prototype["subEq"] = oimo_common_Vec3.prototype.subEq; + oimo_common_Vec3.prototype["sub3Eq"] = oimo_common_Vec3.prototype.sub3Eq; + oimo_common_Vec3.prototype["scaleEq"] = oimo_common_Vec3.prototype.scaleEq; + oimo_common_Vec3.prototype["scale3Eq"] = oimo_common_Vec3.prototype.scale3Eq; + oimo_common_Vec3.prototype["crossEq"] = oimo_common_Vec3.prototype.crossEq; + oimo_common_Vec3.prototype["mulMat3"] = oimo_common_Vec3.prototype.mulMat3; + oimo_common_Vec3.prototype["mulMat4"] = oimo_common_Vec3.prototype.mulMat4; + oimo_common_Vec3.prototype["mulTransform"] = oimo_common_Vec3.prototype.mulTransform; + oimo_common_Vec3.prototype["mulMat3Eq"] = oimo_common_Vec3.prototype.mulMat3Eq; + oimo_common_Vec3.prototype["mulMat4Eq"] = oimo_common_Vec3.prototype.mulMat4Eq; + oimo_common_Vec3.prototype["mulTransformEq"] = oimo_common_Vec3.prototype.mulTransformEq; + oimo_common_Vec3.prototype["length"] = oimo_common_Vec3.prototype.length; + oimo_common_Vec3.prototype["lengthSq"] = oimo_common_Vec3.prototype.lengthSq; + oimo_common_Vec3.prototype["normalized"] = oimo_common_Vec3.prototype.normalized; + oimo_common_Vec3.prototype["normalize"] = oimo_common_Vec3.prototype.normalize; + oimo_common_Vec3.prototype["negate"] = oimo_common_Vec3.prototype.negate; + oimo_common_Vec3.prototype["negateEq"] = oimo_common_Vec3.prototype.negateEq; + oimo_common_Vec3.prototype["copyFrom"] = oimo_common_Vec3.prototype.copyFrom; + oimo_common_Vec3.prototype["clone"] = oimo_common_Vec3.prototype.clone; + oimo_common_Vec3.prototype["toString"] = oimo_common_Vec3.prototype.toString; + window["OIMO"]["Transform"] = oimo_common_Transform; + oimo_common_Transform.prototype["identity"] = oimo_common_Transform.prototype.identity; + oimo_common_Transform.prototype["getPosition"] = oimo_common_Transform.prototype.getPosition; + oimo_common_Transform.prototype["getPositionTo"] = oimo_common_Transform.prototype.getPositionTo; + oimo_common_Transform.prototype["setPosition"] = oimo_common_Transform.prototype.setPosition; + oimo_common_Transform.prototype["translate"] = oimo_common_Transform.prototype.translate; + oimo_common_Transform.prototype["getRotation"] = oimo_common_Transform.prototype.getRotation; + oimo_common_Transform.prototype["getRotationTo"] = oimo_common_Transform.prototype.getRotationTo; + oimo_common_Transform.prototype["setRotation"] = oimo_common_Transform.prototype.setRotation; + oimo_common_Transform.prototype["setRotationXyz"] = oimo_common_Transform.prototype.setRotationXyz; + oimo_common_Transform.prototype["rotate"] = oimo_common_Transform.prototype.rotate; + oimo_common_Transform.prototype["rotateXyz"] = oimo_common_Transform.prototype.rotateXyz; + oimo_common_Transform.prototype["getOrientation"] = oimo_common_Transform.prototype.getOrientation; + oimo_common_Transform.prototype["getOrientationTo"] = oimo_common_Transform.prototype.getOrientationTo; + oimo_common_Transform.prototype["setOrientation"] = oimo_common_Transform.prototype.setOrientation; + oimo_common_Transform.prototype["clone"] = oimo_common_Transform.prototype.clone; + oimo_common_Transform.prototype["copyFrom"] = oimo_common_Transform.prototype.copyFrom; + window["OIMO"]["Setting"] = oimo_common_Setting; + window["OIMO"]["GjkEpa"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeClosestPoints"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeClosestPoints; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["computeDistance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.computeDistance; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["convexCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.convexCast; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype["rayCast"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype.rayCast; + oimo_collision_narrowphase_detector_gjkepa_GjkEpa["getInstance"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.getInstance; + window["OIMO"]["GjkEpaResultState"] = oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState; + window["OIMO"]["SimplexUtil"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin2"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin3"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3; + oimo_collision_narrowphase_detector_gjkepa_SimplexUtil["projectOrigin4"] = oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4; + window["OIMO"]["Mat3"] = oimo_common_Mat3; + oimo_common_Mat3.prototype["init"] = oimo_common_Mat3.prototype.init; + oimo_common_Mat3.prototype["identity"] = oimo_common_Mat3.prototype.identity; + oimo_common_Mat3.prototype["add"] = oimo_common_Mat3.prototype.add; + oimo_common_Mat3.prototype["sub"] = oimo_common_Mat3.prototype.sub; + oimo_common_Mat3.prototype["scale"] = oimo_common_Mat3.prototype.scale; + oimo_common_Mat3.prototype["mul"] = oimo_common_Mat3.prototype.mul; + oimo_common_Mat3.prototype["addEq"] = oimo_common_Mat3.prototype.addEq; + oimo_common_Mat3.prototype["subEq"] = oimo_common_Mat3.prototype.subEq; + oimo_common_Mat3.prototype["scaleEq"] = oimo_common_Mat3.prototype.scaleEq; + oimo_common_Mat3.prototype["mulEq"] = oimo_common_Mat3.prototype.mulEq; + oimo_common_Mat3.prototype["prependScale"] = oimo_common_Mat3.prototype.prependScale; + oimo_common_Mat3.prototype["appendScale"] = oimo_common_Mat3.prototype.appendScale; + oimo_common_Mat3.prototype["prependRotation"] = oimo_common_Mat3.prototype.prependRotation; + oimo_common_Mat3.prototype["appendRotation"] = oimo_common_Mat3.prototype.appendRotation; + oimo_common_Mat3.prototype["prependScaleEq"] = oimo_common_Mat3.prototype.prependScaleEq; + oimo_common_Mat3.prototype["appendScaleEq"] = oimo_common_Mat3.prototype.appendScaleEq; + oimo_common_Mat3.prototype["prependRotationEq"] = oimo_common_Mat3.prototype.prependRotationEq; + oimo_common_Mat3.prototype["appendRotationEq"] = oimo_common_Mat3.prototype.appendRotationEq; + oimo_common_Mat3.prototype["transpose"] = oimo_common_Mat3.prototype.transpose; + oimo_common_Mat3.prototype["transposeEq"] = oimo_common_Mat3.prototype.transposeEq; + oimo_common_Mat3.prototype["determinant"] = oimo_common_Mat3.prototype.determinant; + oimo_common_Mat3.prototype["trace"] = oimo_common_Mat3.prototype.trace; + oimo_common_Mat3.prototype["inverse"] = oimo_common_Mat3.prototype.inverse; + oimo_common_Mat3.prototype["inverseEq"] = oimo_common_Mat3.prototype.inverseEq; + oimo_common_Mat3.prototype["toArray"] = oimo_common_Mat3.prototype.toArray; + oimo_common_Mat3.prototype["copyFrom"] = oimo_common_Mat3.prototype.copyFrom; + oimo_common_Mat3.prototype["clone"] = oimo_common_Mat3.prototype.clone; + oimo_common_Mat3.prototype["fromQuat"] = oimo_common_Mat3.prototype.fromQuat; + oimo_common_Mat3.prototype["toQuat"] = oimo_common_Mat3.prototype.toQuat; + oimo_common_Mat3.prototype["fromEulerXyz"] = oimo_common_Mat3.prototype.fromEulerXyz; + oimo_common_Mat3.prototype["toEulerXyz"] = oimo_common_Mat3.prototype.toEulerXyz; + oimo_common_Mat3.prototype["getRow"] = oimo_common_Mat3.prototype.getRow; + oimo_common_Mat3.prototype["getCol"] = oimo_common_Mat3.prototype.getCol; + oimo_common_Mat3.prototype["getRowTo"] = oimo_common_Mat3.prototype.getRowTo; + oimo_common_Mat3.prototype["getColTo"] = oimo_common_Mat3.prototype.getColTo; + oimo_common_Mat3.prototype["fromRows"] = oimo_common_Mat3.prototype.fromRows; + oimo_common_Mat3.prototype["fromCols"] = oimo_common_Mat3.prototype.fromCols; + oimo_common_Mat3.prototype["toString"] = oimo_common_Mat3.prototype.toString; + window["OIMO"]["Mat4"] = oimo_common_Mat4; + oimo_common_Mat4.prototype["init"] = oimo_common_Mat4.prototype.init; + oimo_common_Mat4.prototype["identity"] = oimo_common_Mat4.prototype.identity; + oimo_common_Mat4.prototype["add"] = oimo_common_Mat4.prototype.add; + oimo_common_Mat4.prototype["sub"] = oimo_common_Mat4.prototype.sub; + oimo_common_Mat4.prototype["scale"] = oimo_common_Mat4.prototype.scale; + oimo_common_Mat4.prototype["mul"] = oimo_common_Mat4.prototype.mul; + oimo_common_Mat4.prototype["addEq"] = oimo_common_Mat4.prototype.addEq; + oimo_common_Mat4.prototype["subEq"] = oimo_common_Mat4.prototype.subEq; + oimo_common_Mat4.prototype["scaleEq"] = oimo_common_Mat4.prototype.scaleEq; + oimo_common_Mat4.prototype["mulEq"] = oimo_common_Mat4.prototype.mulEq; + oimo_common_Mat4.prototype["prependScale"] = oimo_common_Mat4.prototype.prependScale; + oimo_common_Mat4.prototype["appendScale"] = oimo_common_Mat4.prototype.appendScale; + oimo_common_Mat4.prototype["prependRotation"] = oimo_common_Mat4.prototype.prependRotation; + oimo_common_Mat4.prototype["appendRotation"] = oimo_common_Mat4.prototype.appendRotation; + oimo_common_Mat4.prototype["prependTranslation"] = oimo_common_Mat4.prototype.prependTranslation; + oimo_common_Mat4.prototype["appendTranslation"] = oimo_common_Mat4.prototype.appendTranslation; + oimo_common_Mat4.prototype["prependScaleEq"] = oimo_common_Mat4.prototype.prependScaleEq; + oimo_common_Mat4.prototype["appendScaleEq"] = oimo_common_Mat4.prototype.appendScaleEq; + oimo_common_Mat4.prototype["prependRotationEq"] = oimo_common_Mat4.prototype.prependRotationEq; + oimo_common_Mat4.prototype["appendRotationEq"] = oimo_common_Mat4.prototype.appendRotationEq; + oimo_common_Mat4.prototype["prependTranslationEq"] = oimo_common_Mat4.prototype.prependTranslationEq; + oimo_common_Mat4.prototype["appendTranslationEq"] = oimo_common_Mat4.prototype.appendTranslationEq; + oimo_common_Mat4.prototype["transpose"] = oimo_common_Mat4.prototype.transpose; + oimo_common_Mat4.prototype["transposeEq"] = oimo_common_Mat4.prototype.transposeEq; + oimo_common_Mat4.prototype["determinant"] = oimo_common_Mat4.prototype.determinant; + oimo_common_Mat4.prototype["trace"] = oimo_common_Mat4.prototype.trace; + oimo_common_Mat4.prototype["inverse"] = oimo_common_Mat4.prototype.inverse; + oimo_common_Mat4.prototype["inverseEq"] = oimo_common_Mat4.prototype.inverseEq; + oimo_common_Mat4.prototype["lookAt"] = oimo_common_Mat4.prototype.lookAt; + oimo_common_Mat4.prototype["perspective"] = oimo_common_Mat4.prototype.perspective; + oimo_common_Mat4.prototype["ortho"] = oimo_common_Mat4.prototype.ortho; + oimo_common_Mat4.prototype["toArray"] = oimo_common_Mat4.prototype.toArray; + oimo_common_Mat4.prototype["copyFrom"] = oimo_common_Mat4.prototype.copyFrom; + oimo_common_Mat4.prototype["fromMat3"] = oimo_common_Mat4.prototype.fromMat3; + oimo_common_Mat4.prototype["fromTransform"] = oimo_common_Mat4.prototype.fromTransform; + oimo_common_Mat4.prototype["clone"] = oimo_common_Mat4.prototype.clone; + oimo_common_Mat4.prototype["toString"] = oimo_common_Mat4.prototype.toString; + window["OIMO"]["MathUtil"] = oimo_common_MathUtil; + oimo_common_MathUtil["abs"] = oimo_common_MathUtil.abs; + oimo_common_MathUtil["sin"] = oimo_common_MathUtil.sin; + oimo_common_MathUtil["cos"] = oimo_common_MathUtil.cos; + oimo_common_MathUtil["tan"] = oimo_common_MathUtil.tan; + oimo_common_MathUtil["asin"] = oimo_common_MathUtil.asin; + oimo_common_MathUtil["acos"] = oimo_common_MathUtil.acos; + oimo_common_MathUtil["atan"] = oimo_common_MathUtil.atan; + oimo_common_MathUtil["safeAsin"] = oimo_common_MathUtil.safeAsin; + oimo_common_MathUtil["safeAcos"] = oimo_common_MathUtil.safeAcos; + oimo_common_MathUtil["atan2"] = oimo_common_MathUtil.atan2; + oimo_common_MathUtil["sqrt"] = oimo_common_MathUtil.sqrt; + oimo_common_MathUtil["clamp"] = oimo_common_MathUtil.clamp; + oimo_common_MathUtil["rand"] = oimo_common_MathUtil.rand; + oimo_common_MathUtil["randIn"] = oimo_common_MathUtil.randIn; + oimo_common_MathUtil["randVec3In"] = oimo_common_MathUtil.randVec3In; + oimo_common_MathUtil["randVec3"] = oimo_common_MathUtil.randVec3; + window["OIMO"]["Pool"] = oimo_common_Pool; + oimo_common_Pool.prototype["vec3"] = oimo_common_Pool.prototype.vec3; + oimo_common_Pool.prototype["mat3"] = oimo_common_Pool.prototype.mat3; + oimo_common_Pool.prototype["mat4"] = oimo_common_Pool.prototype.mat4; + oimo_common_Pool.prototype["quat"] = oimo_common_Pool.prototype.quat; + oimo_common_Pool.prototype["dispose"] = oimo_common_Pool.prototype.dispose; + oimo_common_Pool.prototype["disposeVec3"] = oimo_common_Pool.prototype.disposeVec3; + oimo_common_Pool.prototype["disposeMat3"] = oimo_common_Pool.prototype.disposeMat3; + oimo_common_Pool.prototype["disposeMat4"] = oimo_common_Pool.prototype.disposeMat4; + oimo_common_Pool.prototype["disposeQuat"] = oimo_common_Pool.prototype.disposeQuat; + window["OIMO"]["Quat"] = oimo_common_Quat; + oimo_common_Quat.prototype["identity"] = oimo_common_Quat.prototype.identity; + oimo_common_Quat.prototype["init"] = oimo_common_Quat.prototype.init; + oimo_common_Quat.prototype["add"] = oimo_common_Quat.prototype.add; + oimo_common_Quat.prototype["sub"] = oimo_common_Quat.prototype.sub; + oimo_common_Quat.prototype["scale"] = oimo_common_Quat.prototype.scale; + oimo_common_Quat.prototype["addEq"] = oimo_common_Quat.prototype.addEq; + oimo_common_Quat.prototype["subEq"] = oimo_common_Quat.prototype.subEq; + oimo_common_Quat.prototype["scaleEq"] = oimo_common_Quat.prototype.scaleEq; + oimo_common_Quat.prototype["length"] = oimo_common_Quat.prototype.length; + oimo_common_Quat.prototype["lengthSq"] = oimo_common_Quat.prototype.lengthSq; + oimo_common_Quat.prototype["dot"] = oimo_common_Quat.prototype.dot; + oimo_common_Quat.prototype["normalized"] = oimo_common_Quat.prototype.normalized; + oimo_common_Quat.prototype["normalize"] = oimo_common_Quat.prototype.normalize; + oimo_common_Quat.prototype["setArc"] = oimo_common_Quat.prototype.setArc; + oimo_common_Quat.prototype["slerp"] = oimo_common_Quat.prototype.slerp; + oimo_common_Quat.prototype["copyFrom"] = oimo_common_Quat.prototype.copyFrom; + oimo_common_Quat.prototype["clone"] = oimo_common_Quat.prototype.clone; + oimo_common_Quat.prototype["fromMat3"] = oimo_common_Quat.prototype.fromMat3; + oimo_common_Quat.prototype["toMat3"] = oimo_common_Quat.prototype.toMat3; + oimo_common_Quat.prototype["toString"] = oimo_common_Quat.prototype.toString; + window["OIMO"]["Contact"] = oimo_dynamics_Contact; + oimo_dynamics_Contact.prototype["getShape1"] = oimo_dynamics_Contact.prototype.getShape1; + oimo_dynamics_Contact.prototype["getShape2"] = oimo_dynamics_Contact.prototype.getShape2; + oimo_dynamics_Contact.prototype["isTouching"] = oimo_dynamics_Contact.prototype.isTouching; + oimo_dynamics_Contact.prototype["getManifold"] = oimo_dynamics_Contact.prototype.getManifold; + oimo_dynamics_Contact.prototype["getContactConstraint"] = oimo_dynamics_Contact.prototype.getContactConstraint; + oimo_dynamics_Contact.prototype["getPrev"] = oimo_dynamics_Contact.prototype.getPrev; + oimo_dynamics_Contact.prototype["getNext"] = oimo_dynamics_Contact.prototype.getNext; + window["OIMO"]["ContactLink"] = oimo_dynamics_ContactLink; + oimo_dynamics_ContactLink.prototype["getContact"] = oimo_dynamics_ContactLink.prototype.getContact; + oimo_dynamics_ContactLink.prototype["getOther"] = oimo_dynamics_ContactLink.prototype.getOther; + oimo_dynamics_ContactLink.prototype["getPrev"] = oimo_dynamics_ContactLink.prototype.getPrev; + oimo_dynamics_ContactLink.prototype["getNext"] = oimo_dynamics_ContactLink.prototype.getNext; + window["OIMO"]["ContactManager"] = oimo_dynamics_ContactManager; + oimo_dynamics_ContactManager.prototype["getNumContacts"] = oimo_dynamics_ContactManager.prototype.getNumContacts; + oimo_dynamics_ContactManager.prototype["getContactList"] = oimo_dynamics_ContactManager.prototype.getContactList; + window["OIMO"]["TimeStep"] = oimo_dynamics_TimeStep; + window["OIMO"]["World"] = oimo_dynamics_World; + oimo_dynamics_World.prototype["step"] = oimo_dynamics_World.prototype.step; + oimo_dynamics_World.prototype["addRigidBody"] = oimo_dynamics_World.prototype.addRigidBody; + oimo_dynamics_World.prototype["removeRigidBody"] = oimo_dynamics_World.prototype.removeRigidBody; + oimo_dynamics_World.prototype["addJoint"] = oimo_dynamics_World.prototype.addJoint; + oimo_dynamics_World.prototype["removeJoint"] = oimo_dynamics_World.prototype.removeJoint; + oimo_dynamics_World.prototype["setDebugDraw"] = oimo_dynamics_World.prototype.setDebugDraw; + oimo_dynamics_World.prototype["getDebugDraw"] = oimo_dynamics_World.prototype.getDebugDraw; + oimo_dynamics_World.prototype["debugDraw"] = oimo_dynamics_World.prototype.debugDraw; + oimo_dynamics_World.prototype["rayCast"] = oimo_dynamics_World.prototype.rayCast; + oimo_dynamics_World.prototype["convexCast"] = oimo_dynamics_World.prototype.convexCast; + oimo_dynamics_World.prototype["aabbTest"] = oimo_dynamics_World.prototype.aabbTest; + oimo_dynamics_World.prototype["getRigidBodyList"] = oimo_dynamics_World.prototype.getRigidBodyList; + oimo_dynamics_World.prototype["getJointList"] = oimo_dynamics_World.prototype.getJointList; + oimo_dynamics_World.prototype["getBroadPhase"] = oimo_dynamics_World.prototype.getBroadPhase; + oimo_dynamics_World.prototype["getContactManager"] = oimo_dynamics_World.prototype.getContactManager; + oimo_dynamics_World.prototype["getNumRigidBodies"] = oimo_dynamics_World.prototype.getNumRigidBodies; + oimo_dynamics_World.prototype["getNumJoints"] = oimo_dynamics_World.prototype.getNumJoints; + oimo_dynamics_World.prototype["getNumShapes"] = oimo_dynamics_World.prototype.getNumShapes; + oimo_dynamics_World.prototype["getNumIslands"] = oimo_dynamics_World.prototype.getNumIslands; + oimo_dynamics_World.prototype["getNumVelocityIterations"] = oimo_dynamics_World.prototype.getNumVelocityIterations; + oimo_dynamics_World.prototype["setNumVelocityIterations"] = oimo_dynamics_World.prototype.setNumVelocityIterations; + oimo_dynamics_World.prototype["getNumPositionIterations"] = oimo_dynamics_World.prototype.getNumPositionIterations; + oimo_dynamics_World.prototype["setNumPositionIterations"] = oimo_dynamics_World.prototype.setNumPositionIterations; + oimo_dynamics_World.prototype["getGravity"] = oimo_dynamics_World.prototype.getGravity; + oimo_dynamics_World.prototype["setGravity"] = oimo_dynamics_World.prototype.setGravity; + window["OIMO"]["AabbTestCallback"] = oimo_dynamics_callback_AabbTestCallback; + window["OIMO"]["ContactCallback"] = oimo_dynamics_callback_ContactCallback; + window["OIMO"]["RayCastCallback"] = oimo_dynamics_callback_RayCastCallback; + window["OIMO"]["RayCastClosest"] = oimo_dynamics_callback_RayCastClosest; + oimo_dynamics_callback_RayCastClosest.prototype["clear"] = oimo_dynamics_callback_RayCastClosest.prototype.clear; + oimo_dynamics_callback_RayCastClosest.prototype["process"] = oimo_dynamics_callback_RayCastClosest.prototype.process; + window["OIMO"]["DebugDrawStyle"] = oimo_dynamics_common_DebugDrawStyle; + window["OIMO"]["Performance"] = oimo_dynamics_common_Performance; + window["OIMO"]["ConstraintSolver"] = oimo_dynamics_constraint_ConstraintSolver; + oimo_dynamics_constraint_ConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_ConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_ConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_ConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_ConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_ConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_ConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_ConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_ConstraintSolver.prototype.postSolve; + window["OIMO"]["PositionCorrectionAlgorithm"] = oimo_dynamics_constraint_PositionCorrectionAlgorithm; + window["OIMO"]["ContactConstraint"] = oimo_dynamics_constraint_contact_ContactConstraint; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape1"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape1; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getShape2"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getShape2; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["getManifold"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.getManifold; + oimo_dynamics_constraint_contact_ContactConstraint.prototype["isTouching"] = oimo_dynamics_constraint_contact_ContactConstraint.prototype.isTouching; + window["OIMO"]["Manifold"] = oimo_dynamics_constraint_contact_Manifold; + oimo_dynamics_constraint_contact_Manifold.prototype["getNormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormal; + oimo_dynamics_constraint_contact_Manifold.prototype["getNormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNormalTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getTangent"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangent; + oimo_dynamics_constraint_contact_Manifold.prototype["getTangentTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getTangentTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getBinormal"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormal; + oimo_dynamics_constraint_contact_Manifold.prototype["getBinormalTo"] = oimo_dynamics_constraint_contact_Manifold.prototype.getBinormalTo; + oimo_dynamics_constraint_contact_Manifold.prototype["getPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getPoints; + oimo_dynamics_constraint_contact_Manifold.prototype["getNumPoints"] = oimo_dynamics_constraint_contact_Manifold.prototype.getNumPoints; + window["OIMO"]["ManifoldPoint"] = oimo_dynamics_constraint_contact_ManifoldPoint; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition1To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition1To; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getPosition2To"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getPosition2To; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getDepth"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getDepth; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isWarmStarted"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isWarmStarted; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getNormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getNormalImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getTangentImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getTangentImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["getBinormalImpulse"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.getBinormalImpulse; + oimo_dynamics_constraint_contact_ManifoldPoint.prototype["isEnabled"] = oimo_dynamics_constraint_contact_ManifoldPoint.prototype.isEnabled; + window["OIMO"]["Joint"] = oimo_dynamics_constraint_joint_Joint; + oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody1"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody1; + oimo_dynamics_constraint_joint_Joint.prototype["getRigidBody2"] = oimo_dynamics_constraint_joint_Joint.prototype.getRigidBody2; + oimo_dynamics_constraint_joint_Joint.prototype["getType"] = oimo_dynamics_constraint_joint_Joint.prototype.getType; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor1To; + oimo_dynamics_constraint_joint_Joint.prototype["getAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getAnchor2To; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor1To; + oimo_dynamics_constraint_joint_Joint.prototype["getLocalAnchor2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getLocalAnchor2To; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis1"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis2"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis1To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis1To; + oimo_dynamics_constraint_joint_Joint.prototype["getBasis2To"] = oimo_dynamics_constraint_joint_Joint.prototype.getBasis2To; + oimo_dynamics_constraint_joint_Joint.prototype["getAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.getAllowCollision; + oimo_dynamics_constraint_joint_Joint.prototype["setAllowCollision"] = oimo_dynamics_constraint_joint_Joint.prototype.setAllowCollision; + oimo_dynamics_constraint_joint_Joint.prototype["getBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakForce; + oimo_dynamics_constraint_joint_Joint.prototype["setBreakForce"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakForce; + oimo_dynamics_constraint_joint_Joint.prototype["getBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getBreakTorque; + oimo_dynamics_constraint_joint_Joint.prototype["setBreakTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.setBreakTorque; + oimo_dynamics_constraint_joint_Joint.prototype["getPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.getPositionCorrectionAlgorithm; + oimo_dynamics_constraint_joint_Joint.prototype["setPositionCorrectionAlgorithm"] = oimo_dynamics_constraint_joint_Joint.prototype.setPositionCorrectionAlgorithm; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForce"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForce; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedForceTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedForceTo; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorque"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorque; + oimo_dynamics_constraint_joint_Joint.prototype["getAppliedTorqueTo"] = oimo_dynamics_constraint_joint_Joint.prototype.getAppliedTorqueTo; + oimo_dynamics_constraint_joint_Joint.prototype["getPrev"] = oimo_dynamics_constraint_joint_Joint.prototype.getPrev; + oimo_dynamics_constraint_joint_Joint.prototype["getNext"] = oimo_dynamics_constraint_joint_Joint.prototype.getNext; + window["OIMO"]["CylindricalJoint"] = oimo_dynamics_constraint_joint_CylindricalJoint; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalSpringDamper; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalSpringDamper"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalSpringDamper; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslationalLimitMotor; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getRotationalLimitMotor"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getRotationalLimitMotor; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getAngle; + oimo_dynamics_constraint_joint_CylindricalJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_CylindricalJoint.prototype.getTranslation; + window["OIMO"]["JointConfig"] = oimo_dynamics_constraint_joint_JointConfig; + window["OIMO"]["CylindricalJointConfig"] = oimo_dynamics_constraint_joint_CylindricalJointConfig; + oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype.init; + window["OIMO"]["GenericJoint"] = oimo_dynamics_constraint_joint_GenericJoint; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisX"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisX; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisY"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisY; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAxisZ"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAxisZ; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslationalSpringDampers"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslationalSpringDampers; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getRotationalSpringDampers"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getRotationalSpringDampers; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslationalLimitMotors"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslationalLimitMotors; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getRotationalLimitMotors"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getRotationalLimitMotors; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getAngles"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getAngles; + oimo_dynamics_constraint_joint_GenericJoint.prototype["getTranslations"] = oimo_dynamics_constraint_joint_GenericJoint.prototype.getTranslations; + window["OIMO"]["GenericJointConfig"] = oimo_dynamics_constraint_joint_GenericJointConfig; + oimo_dynamics_constraint_joint_GenericJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_GenericJointConfig.prototype.init; + window["OIMO"]["JointLink"] = oimo_dynamics_constraint_joint_JointLink; + oimo_dynamics_constraint_joint_JointLink.prototype["getContact"] = oimo_dynamics_constraint_joint_JointLink.prototype.getContact; + oimo_dynamics_constraint_joint_JointLink.prototype["getOther"] = oimo_dynamics_constraint_joint_JointLink.prototype.getOther; + oimo_dynamics_constraint_joint_JointLink.prototype["getPrev"] = oimo_dynamics_constraint_joint_JointLink.prototype.getPrev; + oimo_dynamics_constraint_joint_JointLink.prototype["getNext"] = oimo_dynamics_constraint_joint_JointLink.prototype.getNext; + window["OIMO"]["JointType"] = oimo_dynamics_constraint_joint_JointType; + window["OIMO"]["PrismaticJoint"] = oimo_dynamics_constraint_joint_PrismaticJoint; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getSpringDamper; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getLimitMotor; + oimo_dynamics_constraint_joint_PrismaticJoint.prototype["getTranslation"] = oimo_dynamics_constraint_joint_PrismaticJoint.prototype.getTranslation; + window["OIMO"]["PrismaticJointConfig"] = oimo_dynamics_constraint_joint_PrismaticJointConfig; + oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype.init; + window["OIMO"]["RagdollJoint"] = oimo_dynamics_constraint_joint_RagdollJoint; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistSpringDamper; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistLimitMotor"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistLimitMotor; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingSpringDamper"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingSpringDamper; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxis"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxis; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAxisTo"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAxisTo; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getSwingAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getSwingAngle; + oimo_dynamics_constraint_joint_RagdollJoint.prototype["getTwistAngle"] = oimo_dynamics_constraint_joint_RagdollJoint.prototype.getTwistAngle; + window["OIMO"]["RagdollJointConfig"] = oimo_dynamics_constraint_joint_RagdollJointConfig; + oimo_dynamics_constraint_joint_RagdollJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RagdollJointConfig.prototype.init; + window["OIMO"]["RevoluteJoint"] = oimo_dynamics_constraint_joint_RevoluteJoint; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getSpringDamper; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getLimitMotor"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getLimitMotor; + oimo_dynamics_constraint_joint_RevoluteJoint.prototype["getAngle"] = oimo_dynamics_constraint_joint_RevoluteJoint.prototype.getAngle; + window["OIMO"]["RevoluteJointConfig"] = oimo_dynamics_constraint_joint_RevoluteJointConfig; + oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype.init; + window["OIMO"]["RotationalLimitMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setLimits; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.setMotor; + oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype.clone; + window["OIMO"]["SphericalJoint"] = oimo_dynamics_constraint_joint_SphericalJoint; + oimo_dynamics_constraint_joint_SphericalJoint.prototype["getSpringDamper"] = oimo_dynamics_constraint_joint_SphericalJoint.prototype.getSpringDamper; + window["OIMO"]["SphericalJointConfig"] = oimo_dynamics_constraint_joint_SphericalJointConfig; + oimo_dynamics_constraint_joint_SphericalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_SphericalJointConfig.prototype.init; + window["OIMO"]["SpringDamper"] = oimo_dynamics_constraint_joint_SpringDamper; + oimo_dynamics_constraint_joint_SpringDamper.prototype["setSpring"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSpring; + oimo_dynamics_constraint_joint_SpringDamper.prototype["setSymplecticEuler"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.setSymplecticEuler; + oimo_dynamics_constraint_joint_SpringDamper.prototype["clone"] = oimo_dynamics_constraint_joint_SpringDamper.prototype.clone; + window["OIMO"]["TranslationalLimitMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setLimits"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setLimits; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["setMotor"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.setMotor; + oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype["clone"] = oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype.clone; + window["OIMO"]["UniversalJoint"] = oimo_dynamics_constraint_joint_UniversalJoint; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis1To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAxis2To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis1To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis1To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLocalAxis2To"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLocalAxis2To; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getSpringDamper2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getSpringDamper2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getLimitMotor2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getLimitMotor2; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle1"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle1; + oimo_dynamics_constraint_joint_UniversalJoint.prototype["getAngle2"] = oimo_dynamics_constraint_joint_UniversalJoint.prototype.getAngle2; + window["OIMO"]["UniversalJointConfig"] = oimo_dynamics_constraint_joint_UniversalJointConfig; + oimo_dynamics_constraint_joint_UniversalJointConfig.prototype["init"] = oimo_dynamics_constraint_joint_UniversalJointConfig.prototype.init; + window["OIMO"]["ConstraintSolverType"] = oimo_dynamics_constraint_solver_ConstraintSolverType; + window["OIMO"]["DirectJointConstraintSolver"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype.postSolve; + window["OIMO"]["PgsContactConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype.postSolve; + window["OIMO"]["PgsJointConstraintSolver"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["warmStart"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.warmStart; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolveVelocity"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolveVelocity; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["preSolvePosition"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.preSolvePosition; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionSplitImpulse"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionSplitImpulse; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["solvePositionNgs"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.solvePositionNgs; + oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype["postSolve"] = oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype.postSolve; + window["OIMO"]["MassData"] = oimo_dynamics_rigidbody_MassData; + window["OIMO"]["RigidBody"] = oimo_dynamics_rigidbody_RigidBody; + oimo_dynamics_rigidbody_RigidBody.prototype["getPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPosition; + oimo_dynamics_rigidbody_RigidBody.prototype["getPositionTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPositionTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setPosition"] = oimo_dynamics_rigidbody_RigidBody.prototype.setPosition; + oimo_dynamics_rigidbody_RigidBody.prototype["translate"] = oimo_dynamics_rigidbody_RigidBody.prototype.translate; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotation; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotation; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotationXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationXyz; + oimo_dynamics_rigidbody_RigidBody.prototype["rotate"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotate; + oimo_dynamics_rigidbody_RigidBody.prototype["rotateXyz"] = oimo_dynamics_rigidbody_RigidBody.prototype.rotateXyz; + oimo_dynamics_rigidbody_RigidBody.prototype["getOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientation; + oimo_dynamics_rigidbody_RigidBody.prototype["getOrientationTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getOrientationTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setOrientation"] = oimo_dynamics_rigidbody_RigidBody.prototype.setOrientation; + oimo_dynamics_rigidbody_RigidBody.prototype["getTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransform; + oimo_dynamics_rigidbody_RigidBody.prototype["getTransformTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getTransformTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setTransform"] = oimo_dynamics_rigidbody_RigidBody.prototype.setTransform; + oimo_dynamics_rigidbody_RigidBody.prototype["getMass"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMass; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertia"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertia; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalInertiaTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalInertiaTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassData; + oimo_dynamics_rigidbody_RigidBody.prototype["getMassDataTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getMassDataTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setMassData"] = oimo_dynamics_rigidbody_RigidBody.prototype.setMassData; + oimo_dynamics_rigidbody_RigidBody.prototype["getRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.getRotationFactor; + oimo_dynamics_rigidbody_RigidBody.prototype["setRotationFactor"] = oimo_dynamics_rigidbody_RigidBody.prototype.setRotationFactor; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearVelocityTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularVelocityTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularVelocityTo; + oimo_dynamics_rigidbody_RigidBody.prototype["setAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["addLinearVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addLinearVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["addAngularVelocity"] = oimo_dynamics_rigidbody_RigidBody.prototype.addAngularVelocity; + oimo_dynamics_rigidbody_RigidBody.prototype["applyImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyLinearImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyLinearImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyAngularImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyAngularImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["applyForce"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForce; + oimo_dynamics_rigidbody_RigidBody.prototype["applyForceToCenter"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyForceToCenter; + oimo_dynamics_rigidbody_RigidBody.prototype["applyTorque"] = oimo_dynamics_rigidbody_RigidBody.prototype.applyTorque; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearContactImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearContactImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearContactImpulseTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearContactImpulseTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularContactImpulse"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularContactImpulse; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularContactImpulseTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularContactImpulseTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.getGravityScale; + oimo_dynamics_rigidbody_RigidBody.prototype["setGravityScale"] = oimo_dynamics_rigidbody_RigidBody.prototype.setGravityScale; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPoint; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalPointTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVector; + oimo_dynamics_rigidbody_RigidBody.prototype["getLocalVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLocalVectorTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPoint"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPoint; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldPointTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldPointTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVector"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVector; + oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVectorTo; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumShapes"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumShapes; + oimo_dynamics_rigidbody_RigidBody.prototype["getShapeList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getShapeList; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumContectLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContectLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getContactLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getContactLinkList; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumJointLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumJointLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getJointLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getJointLinkList; + oimo_dynamics_rigidbody_RigidBody.prototype["addShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.addShape; + oimo_dynamics_rigidbody_RigidBody.prototype["removeShape"] = oimo_dynamics_rigidbody_RigidBody.prototype.removeShape; + oimo_dynamics_rigidbody_RigidBody.prototype["getType"] = oimo_dynamics_rigidbody_RigidBody.prototype.getType; + oimo_dynamics_rigidbody_RigidBody.prototype["setType"] = oimo_dynamics_rigidbody_RigidBody.prototype.setType; + oimo_dynamics_rigidbody_RigidBody.prototype["wakeUp"] = oimo_dynamics_rigidbody_RigidBody.prototype.wakeUp; + oimo_dynamics_rigidbody_RigidBody.prototype["sleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.sleep; + oimo_dynamics_rigidbody_RigidBody.prototype["isSleeping"] = oimo_dynamics_rigidbody_RigidBody.prototype.isSleeping; + oimo_dynamics_rigidbody_RigidBody.prototype["getSleepTime"] = oimo_dynamics_rigidbody_RigidBody.prototype.getSleepTime; + oimo_dynamics_rigidbody_RigidBody.prototype["setAutoSleep"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAutoSleep; + oimo_dynamics_rigidbody_RigidBody.prototype["getLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getLinearDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["setLinearDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setLinearDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["getAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.getAngularDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["setAngularDamping"] = oimo_dynamics_rigidbody_RigidBody.prototype.setAngularDamping; + oimo_dynamics_rigidbody_RigidBody.prototype["getPrev"] = oimo_dynamics_rigidbody_RigidBody.prototype.getPrev; + oimo_dynamics_rigidbody_RigidBody.prototype["getNext"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNext; + window["OIMO"]["RigidBodyConfig"] = oimo_dynamics_rigidbody_RigidBodyConfig; + window["OIMO"]["RigidBodyType"] = oimo_dynamics_rigidbody_RigidBodyType; + window["OIMO"]["Shape"] = oimo_dynamics_rigidbody_Shape; + oimo_dynamics_rigidbody_Shape.prototype["getFriction"] = oimo_dynamics_rigidbody_Shape.prototype.getFriction; + oimo_dynamics_rigidbody_Shape.prototype["setFriction"] = oimo_dynamics_rigidbody_Shape.prototype.setFriction; + oimo_dynamics_rigidbody_Shape.prototype["getRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.getRestitution; + oimo_dynamics_rigidbody_Shape.prototype["setRestitution"] = oimo_dynamics_rigidbody_Shape.prototype.setRestitution; + oimo_dynamics_rigidbody_Shape.prototype["getLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransform; + oimo_dynamics_rigidbody_Shape.prototype["getLocalTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getLocalTransformTo; + oimo_dynamics_rigidbody_Shape.prototype["getTransform"] = oimo_dynamics_rigidbody_Shape.prototype.getTransform; + oimo_dynamics_rigidbody_Shape.prototype["getTransformTo"] = oimo_dynamics_rigidbody_Shape.prototype.getTransformTo; + oimo_dynamics_rigidbody_Shape.prototype["setLocalTransform"] = oimo_dynamics_rigidbody_Shape.prototype.setLocalTransform; + oimo_dynamics_rigidbody_Shape.prototype["getDensity"] = oimo_dynamics_rigidbody_Shape.prototype.getDensity; + oimo_dynamics_rigidbody_Shape.prototype["setDensity"] = oimo_dynamics_rigidbody_Shape.prototype.setDensity; + oimo_dynamics_rigidbody_Shape.prototype["getAabb"] = oimo_dynamics_rigidbody_Shape.prototype.getAabb; + oimo_dynamics_rigidbody_Shape.prototype["getAabbTo"] = oimo_dynamics_rigidbody_Shape.prototype.getAabbTo; + oimo_dynamics_rigidbody_Shape.prototype["getGeometry"] = oimo_dynamics_rigidbody_Shape.prototype.getGeometry; + oimo_dynamics_rigidbody_Shape.prototype["getRigidBody"] = oimo_dynamics_rigidbody_Shape.prototype.getRigidBody; + oimo_dynamics_rigidbody_Shape.prototype["getCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionGroup; + oimo_dynamics_rigidbody_Shape.prototype["setCollisionGroup"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionGroup; + oimo_dynamics_rigidbody_Shape.prototype["getCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.getCollisionMask; + oimo_dynamics_rigidbody_Shape.prototype["setCollisionMask"] = oimo_dynamics_rigidbody_Shape.prototype.setCollisionMask; + oimo_dynamics_rigidbody_Shape.prototype["getContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.getContactCallback; + oimo_dynamics_rigidbody_Shape.prototype["setContactCallback"] = oimo_dynamics_rigidbody_Shape.prototype.setContactCallback; + oimo_dynamics_rigidbody_Shape.prototype["getPrev"] = oimo_dynamics_rigidbody_Shape.prototype.getPrev; + oimo_dynamics_rigidbody_Shape.prototype["getNext"] = oimo_dynamics_rigidbody_Shape.prototype.getNext; + window["OIMO"]["ShapeConfig"] = oimo_dynamics_rigidbody_ShapeConfig; + '); + } +} diff --git a/src/oimo/collision/broadphase/BroadPhase.hx b/src/oimo/collision/broadphase/BroadPhase.hx index 0bde715..5723437 100644 --- a/src/oimo/collision/broadphase/BroadPhase.hx +++ b/src/oimo/collision/broadphase/BroadPhase.hx @@ -60,16 +60,14 @@ class BroadPhase { // --- private --- - @:extern - inline function pickAndPushProxyPair(p1:Proxy, p2:Proxy):Void { + extern inline function pickAndPushProxyPair(p1:Proxy, p2:Proxy):Void { var pp:ProxyPair = M.singleList_pick(_proxyPairPool, _next, new ProxyPair()); M.singleList_addFirst(_proxyPairList, _next, pp); pp._p1 = p1; pp._p2 = p2; } - @:extern - inline function poolProxyPairs():Void { + extern inline function poolProxyPairs():Void { var p:ProxyPair = _proxyPairList; if (p != null) { do { @@ -83,20 +81,17 @@ class BroadPhase { } } - @:extern - inline function addProxy(p:Proxy):Void { + extern inline function addProxy(p:Proxy):Void { _numProxies++; M.list_push(_proxyList, _proxyListLast, _prev, _next, p); } - @:extern - inline function removeProxy(p:Proxy):Void { + extern inline function removeProxy(p:Proxy):Void { _numProxies--; M.list_remove(_proxyList, _proxyListLast, _prev, _next, p); } - @:extern - inline function aabbSegmentTest(aabbMin:IVec3, aabbMax:IVec3, begin:IVec3, end:IVec3):Bool { + extern inline function aabbSegmentTest(aabbMin:IVec3, aabbMax:IVec3, begin:IVec3, end:IVec3):Bool { inline function abs(x:Float):Float { return x < 0 ? -x : x; } @@ -167,8 +162,7 @@ class BroadPhase { return true; } - @:extern - inline function aabbConvexSweepTest(aabbMin:IVec3, aabbMax:IVec3, convex:ConvexGeometry, begin:Transform, translation:Vec3):Bool { + extern inline function aabbConvexSweepTest(aabbMin:IVec3, aabbMax:IVec3, convex:ConvexGeometry, begin:Transform, translation:Vec3):Bool { M.vec3_toVec3(_aabb.min, aabbMin); M.vec3_toVec3(_aabb.max, aabbMax); _convexSweep.init(convex, begin, translation); diff --git a/src/oimo/collision/broadphase/Proxy.hx b/src/oimo/collision/broadphase/Proxy.hx index ffb5ed8..52bc017 100644 --- a/src/oimo/collision/broadphase/Proxy.hx +++ b/src/oimo/collision/broadphase/Proxy.hx @@ -38,8 +38,7 @@ class Proxy { // --- internal --- - @:extern - public inline function _setAabb(aabb:Aabb):Void { + extern public inline function _setAabb(aabb:Aabb):Void { M.vec3_assign(_aabbMin, aabb._min); M.vec3_assign(_aabbMax, aabb._max); } diff --git a/src/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.hx b/src/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.hx index 4341621..975eb3a 100644 --- a/src/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.hx +++ b/src/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.hx @@ -23,8 +23,7 @@ class BruteForceBroadPhase extends BroadPhase { // --- private --- - @:extern - inline function overlap(p1:Proxy, p2:Proxy):Bool { + extern inline function overlap(p1:Proxy, p2:Proxy):Bool { return M.aabb_overlap(p1._aabbMin, p1._aabbMax, p2._aabbMin, p2._aabbMax); } diff --git a/src/oimo/collision/broadphase/bvh/BvhBroadPhase.hx b/src/oimo/collision/broadphase/bvh/BvhBroadPhase.hx index 436938c..589341c 100644 --- a/src/oimo/collision/broadphase/bvh/BvhBroadPhase.hx +++ b/src/oimo/collision/broadphase/bvh/BvhBroadPhase.hx @@ -31,8 +31,7 @@ class BvhBroadPhase extends BroadPhase { // --- private --- - @:extern - inline function addToMovedProxy(bvhProxy:BvhProxy):Void { + extern inline function addToMovedProxy(bvhProxy:BvhProxy):Void { // add to the buffer if (bvhProxy._moved) return; bvhProxy._moved = true; @@ -45,8 +44,7 @@ class BvhBroadPhase extends BroadPhase { movedProxies[numMovedProxies++] = bvhProxy; } - @:extern - inline function updateProxy(p:BvhProxy, aabb:Aabb, displacement:Vec3):Void { + extern inline function updateProxy(p:BvhProxy, aabb:Aabb, displacement:Vec3):Void { // set tight AABB p._setAabb(aabb); diff --git a/src/oimo/collision/broadphase/bvh/BvhNode.hx b/src/oimo/collision/broadphase/bvh/BvhNode.hx index d0fe814..531a39a 100644 --- a/src/oimo/collision/broadphase/bvh/BvhNode.hx +++ b/src/oimo/collision/broadphase/bvh/BvhNode.hx @@ -46,15 +46,13 @@ class BvhNode { // --- internal --- - @:extern - public inline function _setChild(index:Int, child:BvhNode):Void { + extern public inline function _setChild(index:Int, child:BvhNode):Void { _children[index] = child; child._parent = this; child._childIndex = index; } - @:extern - public inline function _removeReferences():Void { + extern public inline function _removeReferences():Void { _next = null; _childIndex = 0; _children[0] = null; @@ -65,23 +63,20 @@ class BvhNode { _proxy = null; } - @:extern - public inline function _computeAabb():Void { + extern public inline function _computeAabb():Void { var c1:BvhNode = _children[0]; var c2:BvhNode = _children[1]; M.vec3_min(_aabbMin, c1._aabbMin, c2._aabbMin); M.vec3_max(_aabbMax, c1._aabbMax, c2._aabbMax); } - @:extern - public inline function _computeHeight():Void { + extern public inline function _computeHeight():Void { var h1:Int = _children[0]._height; var h2:Int = _children[1]._height; _height = (h1 > h2 ? h1 : h2) + 1; } - @:extern - public inline function _perimeter():Float { + extern public inline function _perimeter():Float { var size:IVec3; M.vec3_sub(size, _aabbMax, _aabbMin); var x:Float = M.vec3_get(size, 0); diff --git a/src/oimo/collision/broadphase/bvh/BvhStrategy.hx b/src/oimo/collision/broadphase/bvh/BvhStrategy.hx index 36c7342..c24f452 100644 --- a/src/oimo/collision/broadphase/bvh/BvhStrategy.hx +++ b/src/oimo/collision/broadphase/bvh/BvhStrategy.hx @@ -49,8 +49,7 @@ class BvhStrategy { // --- private --- - @:extern - inline function decideInsertionSimple(currentNode:BvhNode, leaf:BvhNode):Int { + extern inline function decideInsertionSimple(currentNode:BvhNode, leaf:BvhNode):Int { var center:IVec3; M.vec3_add(center, leaf._aabbMin, leaf._aabbMax); @@ -68,8 +67,7 @@ class BvhStrategy { return dist1 < dist2 ? 0 : 1; } - @:extern - inline function decideInsertionMinimumSurfaceArea(currentNode:BvhNode, leaf:BvhNode):Int { + extern inline function decideInsertionMinimumSurfaceArea(currentNode:BvhNode, leaf:BvhNode):Int { var c1:BvhNode = currentNode._children[0]; var c2:BvhNode = currentNode._children[1]; @@ -114,8 +112,7 @@ class BvhStrategy { }); } - @:extern - inline function splitLeavesMean(leaves:Vector, from:Int, until:Int):Int { + extern inline function splitLeavesMean(leaves:Vector, from:Int, until:Int):Int { var invN:Float = 1.0 / (until - from); // mean := sum(min + max) / n diff --git a/src/oimo/collision/broadphase/bvh/BvhTree.hx b/src/oimo/collision/broadphase/bvh/BvhTree.hx index 0bbe4ad..9582151 100644 --- a/src/oimo/collision/broadphase/bvh/BvhTree.hx +++ b/src/oimo/collision/broadphase/bvh/BvhTree.hx @@ -48,8 +48,7 @@ class BvhTree { * Inserts the proxy. * This creates a leaf connected to the proxy and inserts it to the tree and `leafList`. */ - @:extern - public inline function _insertProxy(proxy:BvhProxy):Void { + extern public inline function _insertProxy(proxy:BvhProxy):Void { var leaf:BvhNode = pick(); leaf._proxy = proxy; proxy._leaf = leaf; @@ -67,8 +66,7 @@ class BvhTree { * Deletes the proxy. * This also deletes the leaf connected to the proxy from the tree and `leafList`. */ - @:extern - public inline function _deleteProxy(proxy:BvhProxy):Void { + extern public inline function _deleteProxy(proxy:BvhProxy):Void { var leaf:BvhNode = proxy._leaf; _numLeaves--; @@ -84,16 +82,14 @@ class BvhTree { * Clears whole the tree. * All leaves are disposed and deleted from `leafList`. */ - @:extern - public inline function _clear():Void { + extern public inline function _clear():Void { if (_root == null) return; deleteRecursive(_root); _root = null; _numLeaves = 0; } - @:extern - public inline function _optimize(count:Int):Void { + extern public inline function _optimize(count:Int):Void { if (_root == null) return; for (i in 0...count) { var leaf:BvhNode = _root; @@ -108,8 +104,7 @@ class BvhTree { } } - @:extern - public inline function _buildTopDown():Void { + extern public inline function _buildTopDown():Void { if (_root == null) return; decompose(); @@ -138,8 +133,7 @@ class BvhTree { * Makes the tree empty, but leaf nodes are not disposed and are reusable. * The tree must be reconstructed using `leafList` after the call of this method. */ - @:extern - inline function decompose():Void { + extern inline function decompose():Void { if (_root == null) return; decomposeRecursive(_root); _root = null; @@ -197,8 +191,7 @@ class BvhTree { return balance + getBalanceRecursive(root._children[0]) + getBalanceRecursive(root._children[1]); } - @:extern - inline function insertLeaf(leaf:BvhNode):Void { + extern inline function insertLeaf(leaf:BvhNode):Void { assertBeLeaf(leaf); if (_root == null) { // the tree is empty _root = leaf; @@ -244,8 +237,7 @@ class BvhTree { } } - @:extern - inline function deleteLeaf(leaf:BvhNode):Void { + extern inline function deleteLeaf(leaf:BvhNode):Void { assertBeLeaf(leaf); if (_root == leaf) { // the tree has only the leaf _root = null; @@ -280,8 +272,7 @@ class BvhTree { /** * Balances and returns the node at the same position of `node`. */ - @:extern - inline function balance(node:BvhNode):BvhNode { + extern inline function balance(node:BvhNode):BvhNode { var nh:Int = node._height; if (nh < 2) { return node; @@ -434,20 +425,17 @@ class BvhTree { return node; } - @:extern - inline function assertBeLeaf(leaf:BvhNode):Void { + extern inline function assertBeLeaf(leaf:BvhNode):Void { M.assert(leaf._proxy != null && leaf._proxy._leaf == leaf && leaf._children[0] == null && leaf._children[1] == null && leaf._height == 0); } - @:extern - inline function pool(node:BvhNode):Void { + extern inline function pool(node:BvhNode):Void { M.assert(node._proxy == null || node._proxy._leaf == null); node._removeReferences(); M.singleList_pool(_nodePool, _next, node); } - @:extern - inline function pick():BvhNode { + extern inline function pick():BvhNode { return M.singleList_pick(_nodePool, _next, new BvhNode()); } diff --git a/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx b/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx index 39817e9..db63af4 100644 --- a/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx +++ b/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx @@ -536,8 +536,7 @@ class BoxBoxDetector extends Detector { * Returns half of the projected length of the box with scaled bases * (`sx`, `sy`, `sz`) onto the normalized axis `axis`. */ - @:extern - inline function project(axis:IVec3, sx:IVec3, sy:IVec3, sz:IVec3):Float { + extern inline function project(axis:IVec3, sx:IVec3, sy:IVec3, sz:IVec3):Float { var dx:Float = M.vec3_dot(axis, sx); var dy:Float = M.vec3_dot(axis, sy); var dz:Float = M.vec3_dot(axis, sz); @@ -550,8 +549,7 @@ class BoxBoxDetector extends Detector { /** * 2D version of `project`. */ - @:extern - inline function project2(axis:IVec3, sx:IVec3, sy:IVec3):Float { + extern inline function project2(axis:IVec3, sx:IVec3, sy:IVec3):Float { var dx:Float = M.vec3_dot(axis, sx); var dy:Float = M.vec3_dot(axis, sy); if (dx < 0) dx = -dx; @@ -578,8 +576,7 @@ private class IncidentVertex { wz = 0; } - @:extern - public inline function init(x:Float, y:Float, wx:Float, wy:Float, wz:Float):Void { + extern public inline function init(x:Float, y:Float, wx:Float, wy:Float, wz:Float):Void { this.x = x; this.y = y; this.wx = wx; @@ -587,8 +584,7 @@ private class IncidentVertex { this.wz = wz; } - @:extern - public inline function copyFrom(v:IncidentVertex):Void { + extern public inline function copyFrom(v:IncidentVertex):Void { x = v.x; y = v.y; wx = v.wx; @@ -596,8 +592,7 @@ private class IncidentVertex { wz = v.wz; } - @:extern - public inline function interp(v1:IncidentVertex, v2:IncidentVertex, t:Float):Void { + extern public inline function interp(v1:IncidentVertex, v2:IncidentVertex, t:Float):Void { x = v1.x + (v2.x - v1.x) * t; y = v1.y + (v2.y - v1.y) * t; wx = v1.wx + (v2.wx - v1.wx) * t; @@ -627,16 +622,14 @@ private class FaceClipper { } } - @:extern - public inline function init(w:Float, h:Float):Void { + extern public inline function init(w:Float, h:Float):Void { this.w = w; this.h = h; numVertices = 0; numTmpVertices = 0; } - @:extern - public inline function addIncidentVertex(x:Float, y:Float, wx:Float, wy:Float, wz:Float):Void { + extern public inline function addIncidentVertex(x:Float, y:Float, wx:Float, wy:Float, wz:Float):Void { vertices[numVertices++].init(x, y, wx, wy, wz); } @@ -703,8 +696,7 @@ private class FaceClipper { flip(); } - @:extern - inline function clipL():Void { + extern inline function clipL():Void { for (i in 0...numVertices) { var v1:IncidentVertex = vertices[i]; var v2:IncidentVertex = vertices[(i + 1) % numVertices]; @@ -714,8 +706,7 @@ private class FaceClipper { } } - @:extern - inline function clipR():Void { + extern inline function clipR():Void { for (i in 0...numVertices) { var v1:IncidentVertex = vertices[i]; var v2:IncidentVertex = vertices[(i + 1) % numVertices]; @@ -725,8 +716,7 @@ private class FaceClipper { } } - @:extern - inline function clipT():Void { + extern inline function clipT():Void { for (i in 0...numVertices) { var v1:IncidentVertex = vertices[i]; var v2:IncidentVertex = vertices[(i + 1) % numVertices]; @@ -736,8 +726,7 @@ private class FaceClipper { } } - @:extern - inline function clipB():Void { + extern inline function clipB():Void { for (i in 0...numVertices) { var v1:IncidentVertex = vertices[i]; var v2:IncidentVertex = vertices[(i + 1) % numVertices]; @@ -747,15 +736,13 @@ private class FaceClipper { } } - @:extern - inline function flip():Void { + extern inline function flip():Void { BoxBoxDetectorMacro.swap(vertices, tmpVertices); numVertices = numTmpVertices; numTmpVertices = 0; } - @:extern - inline function clipWithParam(v1:IncidentVertex, v2:IncidentVertex, s1:Float, s2:Float):Void { + extern inline function clipWithParam(v1:IncidentVertex, v2:IncidentVertex, s1:Float, s2:Float):Void { if (s1 > 0 && s2 > 0) { add(v1); } else if (s1 > 0 && s2 <= 0) { @@ -768,13 +755,11 @@ private class FaceClipper { } } - @:extern - inline function add(v:IncidentVertex):Void { + extern inline function add(v:IncidentVertex):Void { tmpVertices[numTmpVertices++].copyFrom(v); } - @:extern - inline function interp(v1:IncidentVertex, v2:IncidentVertex, t:Float):Void { + extern inline function interp(v1:IncidentVertex, v2:IncidentVertex, t:Float):Void { tmpVertices[numTmpVertices++].interp(v1, v2, t); } } diff --git a/src/oimo/collision/narrowphase/detector/gjkepa/EpaPolyhedron.hx b/src/oimo/collision/narrowphase/detector/gjkepa/EpaPolyhedron.hx index 7da73b6..99e5519 100644 --- a/src/oimo/collision/narrowphase/detector/gjkepa/EpaPolyhedron.hx +++ b/src/oimo/collision/narrowphase/detector/gjkepa/EpaPolyhedron.hx @@ -37,26 +37,22 @@ class EpaPolyhedron { // --- private --- - @:extern - inline function pickTriangle():EpaTriangle { + extern inline function pickTriangle():EpaTriangle { return M.singleList_pick(_trianglePool, _next, new EpaTriangle()); } - @:extern - inline function poolTriangle(t:EpaTriangle):Void { + extern inline function poolTriangle(t:EpaTriangle):Void { t.removeReferences(); M.singleList_pool(_trianglePool, _next, t); } - @:extern - inline function setAdjacentTriangle(t1:EpaTriangle, t2:EpaTriangle):Void { + extern inline function setAdjacentTriangle(t1:EpaTriangle, t2:EpaTriangle):Void { if (!t1.setAdjacentTriangle(t2)) { _status = EpaPolyhedronState.INVALID_TRIANGLE; } } - @:extern - inline function initTriangle(t:EpaTriangle, vertex1:EpaVertex, vertex2:EpaVertex, vertex3:EpaVertex, center:Vec3, autoCheck:Bool = false):Void { + extern inline function initTriangle(t:EpaTriangle, vertex1:EpaVertex, vertex2:EpaVertex, vertex3:EpaVertex, center:Vec3, autoCheck:Bool = false):Void { if (!t.init(vertex1, vertex2, vertex3, center, autoCheck)) { _status = EpaPolyhedronState.INVALID_TRIANGLE; } @@ -136,16 +132,14 @@ class EpaPolyhedron { removeTriangle(base); } - @:extern - inline function addTriangle(t:EpaTriangle):Void { + extern inline function addTriangle(t:EpaTriangle):Void { _numTriangles++; GjkEpaLog.log("triangle added " + _numTriangles + ", id: " + t.id); GjkEpaLog.run(t.dump()); M.list_push(_triangleList, _triangleListLast, _prev, _next, t); } - @:extern - inline function removeTriangle(t:EpaTriangle):Void { + extern inline function removeTriangle(t:EpaTriangle):Void { _numTriangles--; GjkEpaLog.log("triangle removed " + _numTriangles + ", id: " + t.id); M.list_remove(_triangleList, _triangleListLast, _prev, _next, t); @@ -154,19 +148,16 @@ class EpaPolyhedron { // --- internal --- - @:extern - public inline function _pickVertex():EpaVertex { + extern public inline function _pickVertex():EpaVertex { return M.singleList_pick(_vertexPool, _next, new EpaVertex()); } - @:extern - public inline function _poolVertex(v:EpaVertex):Void { + extern public inline function _poolVertex(v:EpaVertex):Void { v.removeReferences(); M.singleList_pool(_vertexPool, _next, v); } - @:extern - public inline function _clear():Void { + extern public inline function _clear():Void { while (_numTriangles > 0) { removeTriangle(_triangleList); } @@ -210,8 +201,7 @@ class EpaPolyhedron { return _status == EpaPolyhedronState.OK; } - @:extern - public inline function _getBestTriangle():EpaTriangle { + extern public inline function _getBestTriangle():EpaTriangle { var f:EpaTriangle = _triangleList; var mind:Float = MathUtil.POSITIVE_INFINITY; var minf:EpaTriangle = null; diff --git a/src/oimo/collision/narrowphase/detector/gjkepa/EpaTriangle.hx b/src/oimo/collision/narrowphase/detector/gjkepa/EpaTriangle.hx index 1b56313..aa5046d 100644 --- a/src/oimo/collision/narrowphase/detector/gjkepa/EpaTriangle.hx +++ b/src/oimo/collision/narrowphase/detector/gjkepa/EpaTriangle.hx @@ -48,8 +48,7 @@ class EpaTriangle { _nextIndex[2] = 0; } - @:extern - public inline function checkVisible(id:Int, from:Vec3):Bool { + extern public inline function checkVisible(id:Int, from:Vec3):Bool { // if (id == _tmpDfsId) return _tmpDfsVisible; tmp.copyFrom(from).subEq(_vertices[0].v); _tmpDfsVisible = tmp.dot(_normal) > 0; diff --git a/src/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.hx b/src/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.hx index 6f061a4..a18c3f1 100644 --- a/src/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.hx +++ b/src/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.hx @@ -517,8 +517,7 @@ class GjkEpa { gjkCache.prevClosestDir.copyFrom(closest).negateEq(); } - ///@:extern - /*inline*/ function shrinkSimplex(vertexBits:Int):Void { + function shrinkSimplex(vertexBits:Int):Void { simplexSize = vertexBits; simplexSize = (simplexSize & 5) + (simplexSize >> 1 & 5); simplexSize = (simplexSize & 3) + (simplexSize >> 2 & 3); @@ -578,15 +577,13 @@ class GjkEpa { } } - @:extern - inline function computeSupportingVertex():Void { + extern inline function computeSupportingVertex():Void { computeWitnessPoint1(false); computeWitnessPoint2(false); s[simplexSize].copyFrom(w1[simplexSize]).subEq(w2[simplexSize]); } - @:extern - inline function computeConvexCastSupportingVertex():Void { + extern inline function computeConvexCastSupportingVertex():Void { if (c1 != null) { computeWitnessPoint1(true); } else { @@ -651,8 +648,7 @@ class GjkEpa { M.vec3_toVec3(dir, idir); } - ///@:extern - /*inline*/ function pointToTetrahedron():Void { + function pointToTetrahedron():Void { for (i in 0...3) { dir.copyFrom(baseDirs[i]); @@ -672,8 +668,7 @@ class GjkEpa { } } - ///@:extern - /*inline*/ function lineToTetrahedron():Void { + function lineToTetrahedron():Void { var oldDir:IVec3; M.vec3_fromVec3(oldDir, dir); @@ -708,8 +703,7 @@ class GjkEpa { M.vec3_toVec3(dir, oldDir); } - ///@:extern - /*inline*/ function triangleToTetrahedron():Void { + function triangleToTetrahedron():Void { var oldDir:IVec3; M.vec3_fromVec3(oldDir, dir); diff --git a/src/oimo/common/Mat3.hx b/src/oimo/common/Mat3.hx index 6bc66a7..68f439f 100644 --- a/src/oimo/common/Mat3.hx +++ b/src/oimo/common/Mat3.hx @@ -81,8 +81,7 @@ class Mat3 { numCreations++; } - @:extern - inline function _init( + extern inline function _init( e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float diff --git a/src/oimo/common/Mat4.hx b/src/oimo/common/Mat4.hx index 9d77bcf..9275d7b 100644 --- a/src/oimo/common/Mat4.hx +++ b/src/oimo/common/Mat4.hx @@ -120,8 +120,7 @@ class Mat4 { numCreations++; } - @:extern - inline function _init( + extern inline function _init( e00:Float, e01:Float, e02:Float, e03:Float, e10:Float, e11:Float, e12:Float, e13:Float, e20:Float, e21:Float, e22:Float, e23:Float, diff --git a/src/oimo/common/Quat.hx b/src/oimo/common/Quat.hx index 0f76f52..1153864 100644 --- a/src/oimo/common/Quat.hx +++ b/src/oimo/common/Quat.hx @@ -44,8 +44,7 @@ class Quat { numCreations++; } - @:extern - inline function initi(x:Float, y:Float, z:Float, w:Float):Quat { + extern inline function initi(x:Float, y:Float, z:Float, w:Float):Quat { var tx:Float = x; var ty:Float = y; var tz:Float = z; diff --git a/src/oimo/common/Vec3.hx b/src/oimo/common/Vec3.hx index 4607ec5..4ea3464 100644 --- a/src/oimo/common/Vec3.hx +++ b/src/oimo/common/Vec3.hx @@ -58,8 +58,7 @@ class Vec3 { return initi(0, 0, 0); } - @:extern - inline function initi(x:Float, y:Float, z:Float):Vec3 { + extern inline function initi(x:Float, y:Float, z:Float):Vec3 { var tx:Float = x; var ty:Float = y; var tz:Float = z; diff --git a/src/oimo/dynamics/Contact.hx b/src/oimo/dynamics/Contact.hx index 0b94fb7..deaec04 100644 --- a/src/oimo/dynamics/Contact.hx +++ b/src/oimo/dynamics/Contact.hx @@ -70,8 +70,7 @@ class Contact { // --- private --- - @:extern - inline function attachLinks():Void { + extern inline function attachLinks():Void { M.list_push(_b1._contactLinkList, _b1._contactLinkListLast, _prev, _next, _link1); M.list_push(_b2._contactLinkList, _b2._contactLinkListLast, _prev, _next, _link2); _b1._numContactLinks++; @@ -82,8 +81,7 @@ class Contact { _link2._contact = this; } - @:extern - inline function detachLinks():Void { + extern inline function detachLinks():Void { M.list_remove(_b1._contactLinkList, _b1._contactLinkListLast, _prev, _next, _link1); M.list_remove(_b2._contactLinkList, _b2._contactLinkListLast, _prev, _next, _link2); _b1._numContactLinks--; @@ -94,8 +92,7 @@ class Contact { _link2._contact = null; } - @:extern - inline function sendBeginContact():Void { + extern inline function sendBeginContact():Void { var cc1:ContactCallback = _s1._contactCallback; var cc2:ContactCallback = _s2._contactCallback; if (cc1 == cc2) { @@ -105,8 +102,7 @@ class Contact { if (cc2 != null) cc2.beginContact(this); } - @:extern - inline function sendEndContact():Void { + extern inline function sendEndContact():Void { var cc1:ContactCallback = _s1._contactCallback; var cc2:ContactCallback = _s2._contactCallback; if (cc1 == cc2) { @@ -116,8 +112,7 @@ class Contact { if (cc2 != null) cc2.endContact(this); } - @:extern - inline function sendPreSolve():Void { + extern inline function sendPreSolve():Void { var cc1:ContactCallback = _s1._contactCallback; var cc2:ContactCallback = _s2._contactCallback; if (cc1 == cc2) { @@ -127,8 +122,7 @@ class Contact { if (cc2 != null) cc2.preSolve(this); } - @:extern - inline function sendPostSolve():Void { + extern inline function sendPostSolve():Void { var cc1:ContactCallback = _s1._contactCallback; var cc2:ContactCallback = _s2._contactCallback; if (cc1 == cc2) { @@ -140,8 +134,7 @@ class Contact { // --- internal --- - @:extern - public inline function _attach(s1:Shape, s2:Shape, detector:Detector):Void { + extern public inline function _attach(s1:Shape, s2:Shape, detector:Detector):Void { _s1 = s1; _s2 = s2; _b1 = s1._rigidBody; @@ -154,8 +147,7 @@ class Contact { _contactConstraint._attach(s1, s2); } - @:extern - public inline function _detach():Void { + extern public inline function _detach():Void { if (_touching) { // touching in the last frame sendEndContact(); diff --git a/src/oimo/dynamics/ContactManager.hx b/src/oimo/dynamics/ContactManager.hx index dba6867..6262f27 100644 --- a/src/oimo/dynamics/ContactManager.hx +++ b/src/oimo/dynamics/ContactManager.hx @@ -193,8 +193,7 @@ class ContactManager { }); } - @:extern - public inline function _updateManifolds():Void { + extern public inline function _updateManifolds():Void { var c:Contact = _contactList; M.list_foreach(c, _next, { if (!c._shouldBeSkipped) { @@ -203,8 +202,7 @@ class ContactManager { }); } - @:extern - public inline function _destroyContact(contact:Contact):Void { + extern public inline function _destroyContact(contact:Contact):Void { M.list_remove(_contactList, _contactListLast, _prev, _next, contact); contact._detach(); diff --git a/src/oimo/dynamics/Island.hx b/src/oimo/dynamics/Island.hx index 36a7c2a..f2b3d39 100644 --- a/src/oimo/dynamics/Island.hx +++ b/src/oimo/dynamics/Island.hx @@ -43,22 +43,19 @@ class Island { // --- private --- - @:extern - inline function fastInvExp(x:Float):Float { + extern inline function fastInvExp(x:Float):Float { var x2:Float = x * x; return 1 / (1 + x + x2 * (1 / 2 + x * (1 / 6) + x2 * (1 / 24))); } - @:extern - inline function addConstraintSolverSI(solver:ConstraintSolver):Void { + extern inline function addConstraintSolverSI(solver:ConstraintSolver):Void { if (numSolversSi == solversSi.length) { M.array_expand(solversSi, numSolversSi); } solversSi[numSolversSi++] = solver; } - @:extern - inline function addConstraintSolverNgs(solver:ConstraintSolver):Void { + extern inline function addConstraintSolverNgs(solver:ConstraintSolver):Void { if (numSolversNgs == solversNgs.length) { M.array_expand(solversNgs, numSolversNgs); } @@ -74,8 +71,7 @@ class Island { M.array_free(solversNgs, numSolversNgs); } - @:extern - public inline function _setGravity(gravity:Vec3):Void { + extern public inline function _setGravity(gravity:Vec3):Void { M.vec3_fromVec3(this.gravity, gravity); } diff --git a/src/oimo/dynamics/World.hx b/src/oimo/dynamics/World.hx index dfb2028..99c882e 100644 --- a/src/oimo/dynamics/World.hx +++ b/src/oimo/dynamics/World.hx @@ -251,16 +251,14 @@ class World { } } - @:extern - public inline function _addShape(shape:Shape):Void { + extern public inline function _addShape(shape:Shape):Void { shape._proxy = _broadPhase.createProxy(shape, shape._aabb); shape._id = _shapeIdCount++; _numShapes++; } - @:extern - public inline function _removeShape(shape:Shape):Void { + extern public inline function _removeShape(shape:Shape):Void { _broadPhase.destroyProxy(shape._proxy); shape._proxy = null; shape._id = -1; @@ -339,14 +337,12 @@ class World { }); } - @:extern - inline function _drawBasis(d:DebugDraw, tf:Transform):Void { + extern inline function _drawBasis(d:DebugDraw, tf:Transform):Void { var style:DebugDrawStyle = d.style; d.basis(tf, style.basisLength, style.basisColorX, style.basisColorY, style.basisColorZ); } - @:extern - inline function _drawShape(d:DebugDraw, geom:Geometry, tf:Transform, color:Vec3):Void { + extern inline function _drawShape(d:DebugDraw, geom:Geometry, tf:Transform, color:Vec3):Void { switch (geom._type) { case GeometryType._SPHERE: _drawSphere(d, cast geom, tf, color); @@ -363,36 +359,30 @@ class World { } } - @:extern - inline function _drawSphere(d:DebugDraw, g:SphereGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawSphere(d:DebugDraw, g:SphereGeometry, tf:Transform, color:Vec3):Void { d.sphere(tf, g._radius, color); } - @:extern - inline function _drawBox(d:DebugDraw, g:BoxGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawBox(d:DebugDraw, g:BoxGeometry, tf:Transform, color:Vec3):Void { var hx:Vec3 = _pool.vec3(); M.vec3_toVec3(hx, g._halfExtents); d.box(tf, hx, color); _pool.dispose(hx); } - @:extern - inline function _drawCylinder(d:DebugDraw, g:CylinderGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawCylinder(d:DebugDraw, g:CylinderGeometry, tf:Transform, color:Vec3):Void { d.cylinder(tf, g._radius, g._halfHeight, color); } - @:extern - inline function _drawCone(d:DebugDraw, g:ConeGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawCone(d:DebugDraw, g:ConeGeometry, tf:Transform, color:Vec3):Void { d.cone(tf, g._radius, g._halfHeight, color); } - @:extern - inline function _drawCapsule(d:DebugDraw, g:CapsuleGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawCapsule(d:DebugDraw, g:CapsuleGeometry, tf:Transform, color:Vec3):Void { d.capsule(tf, g._radius, g._halfHeight, color); } - @:extern - inline function _drawConvexHull(d:DebugDraw, g:ConvexHullGeometry, tf:Transform, color:Vec3):Void { + extern inline function _drawConvexHull(d:DebugDraw, g:ConvexHullGeometry, tf:Transform, color:Vec3):Void { var n:Int = g._numVertices; var v1:Vec3 = _pool.vec3(); var v2:Vec3 = _pool.vec3(); @@ -453,8 +443,7 @@ class World { _pool.dispose(o); } - @:extern - inline function _drawAabb(d:DebugDraw, aabb:Aabb, color:Vec3):Void { + extern inline function _drawAabb(d:DebugDraw, aabb:Aabb, color:Vec3):Void { var min:Vec3 = _pool.vec3(); var max:Vec3 = _pool.vec3(); M.vec3_toVec3(min, aabb._min); @@ -490,8 +479,7 @@ class World { } } - @:extern - inline function _drawContactPoint(d:DebugDraw, c:ContactConstraint, p:ManifoldPoint) { + extern inline function _drawContactPoint(d:DebugDraw, c:ContactConstraint, p:ManifoldPoint) { var style:DebugDrawStyle = d.style; var tf1:Transform = c._s1._transform; var tf2:Transform = c._s2._transform; @@ -549,8 +537,7 @@ class World { _pool.dispose(binormal); } - @:extern - inline function _drawPair(d:DebugDraw, c:Contact, color:Vec3):Void { + extern inline function _drawPair(d:DebugDraw, c:Contact, color:Vec3):Void { var v1:Vec3 = _pool.vec3(); var v2:Vec3 = _pool.vec3(); M.vec3_toVec3(v1, c._s1._transform._position); @@ -560,8 +547,7 @@ class World { _pool.dispose(v2); } - @:extern - inline function _drawJoint(d:DebugDraw, j:Joint):Void { + extern inline function _drawJoint(d:DebugDraw, j:Joint):Void { var p1:Vec3 = _pool.vec3(); var p2:Vec3 = _pool.vec3(); M.vec3_toVec3(p1, j._b1._transform._position); @@ -620,8 +606,7 @@ class World { _pool.dispose(basisZ2); } - @:extern - inline function _drawRevolute(d:DebugDraw, j:RevoluteJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawRevolute(d:DebugDraw, j:RevoluteJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var lm:RotationalLimitMotor = j._lm; @@ -629,8 +614,7 @@ class World { _drawRotationalLimit(d, anchor1, basisY1, basisZ1, basisY2, radius, lm.lowerLimit, lm.upperLimit, color); } - @:extern - inline function _drawCylindrical(d:DebugDraw, j:CylindricalJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawCylindrical(d:DebugDraw, j:CylindricalJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var rlm:RotationalLimitMotor = j._rotLm; @@ -640,8 +624,7 @@ class World { _drawTranslationalLimit(d, anchor1, basisX1, tlm.lowerLimit, tlm.upperLimit, color); } - @:extern - inline function _drawPrismatic(d:DebugDraw, j:PrismaticJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawPrismatic(d:DebugDraw, j:PrismaticJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var lm:TranslationalLimitMotor = j._lm; @@ -649,8 +632,7 @@ class World { _drawTranslationalLimit(d, anchor1, basisX1, lm.lowerLimit, lm.upperLimit, color); } - @:extern - inline function _drawUniversal(d:DebugDraw, j:UniversalJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawUniversal(d:DebugDraw, j:UniversalJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var lm1:RotationalLimitMotor = j._lm1; @@ -660,8 +642,7 @@ class World { _drawRotationalLimit(d, anchor2, basisX2, basisY2, basisX2, radius, lm2.lowerLimit - j._angleZ, lm2.upperLimit - j._angleZ, color); } - @:extern - inline function _drawRagdoll(d:DebugDraw, j:RagdollJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawRagdoll(d:DebugDraw, j:RagdollJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var lm:RotationalLimitMotor = j._twistLm; @@ -674,8 +655,7 @@ class World { _pool.dispose(to); } - @:extern - inline function _drawGeneric(d:DebugDraw, j:GenericJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { + extern inline function _drawGeneric(d:DebugDraw, j:GenericJoint, anchor1:Vec3, anchor2:Vec3, basisX1:Vec3, basisY1:Vec3, basisZ1:Vec3, basisX2:Vec3, basisY2:Vec3, basisZ2:Vec3):Void { var radius:Float = d.style.jointRotationalConstraintRadius; var color:Vec3 = d.style.jointLineColor; var txlm:TranslationalLimitMotor = j._translLms[0]; diff --git a/src/oimo/dynamics/common/DebugDraw.hx b/src/oimo/dynamics/common/DebugDraw.hx index 3d07e93..a414f87 100644 --- a/src/oimo/dynamics/common/DebugDraw.hx +++ b/src/oimo/dynamics/common/DebugDraw.hx @@ -146,8 +146,7 @@ class DebugDraw { return macro p.dispose($obj); } - @:extern - inline function initSphereCoords():Void { + extern inline function initSphereCoords():Void { // theta var nt:Int = SPHERE_THETA_DIVISION; var dt:Float = MathUtil.PI / nt; @@ -178,8 +177,7 @@ class DebugDraw { } } - @:extern - inline function initCircleCoords():Void { + extern inline function initCircleCoords():Void { circleCoords = new Vector(CIRCLE_THETA_DIVISION); circleCoordsShift = new Vector(CIRCLE_THETA_DIVISION); tmpCircleVerts1 = new Vector(CIRCLE_THETA_DIVISION); @@ -196,8 +194,7 @@ class DebugDraw { } } - @:extern - inline function sphericalCoord(origin:Vec3, x:Vec3, y:Vec3, z:Vec3, r:Float, theta:Float, phi:Float):Vec3 { + extern inline function sphericalCoord(origin:Vec3, x:Vec3, y:Vec3, z:Vec3, r:Float, theta:Float, phi:Float):Vec3 { var v:Vec3 = cartesianCoord(origin, x, y, z, r * MathUtil.sin(theta) * MathUtil.cos(phi), r * MathUtil.cos(theta), @@ -206,8 +203,7 @@ class DebugDraw { return v; } - // @:extern // uncommenting this line causes error in version 4.0.0-preview.1 - inline function polarCoord(origin:Vec3, x:Vec3, y:Vec3, r:Float, theta:Float):Vec3 { + extern inline function polarCoord(origin:Vec3, x:Vec3, y:Vec3, r:Float, theta:Float):Vec3 { var v:Vec3 = cartesianCoord2D(origin, x, y, r * MathUtil.cos(theta), r * MathUtil.sin(theta) diff --git a/src/oimo/dynamics/constraint/contact/ContactConstraint.hx b/src/oimo/dynamics/constraint/contact/ContactConstraint.hx index 2c74002..8c6b317 100644 --- a/src/oimo/dynamics/constraint/contact/ContactConstraint.hx +++ b/src/oimo/dynamics/constraint/contact/ContactConstraint.hx @@ -49,8 +49,7 @@ class ContactConstraint { // --- internal --- - @:extern - public inline function _attach(s1:Shape, s2:Shape):Void { + extern public inline function _attach(s1:Shape, s2:Shape):Void { _s1 = s1; _s2 = s2; _b1 = _s1._rigidBody; @@ -59,8 +58,7 @@ class ContactConstraint { _tf2 = _b2._transform; } - @:extern - public inline function _detach():Void { + extern public inline function _detach():Void { _s1 = null; _s2 = null; _b1 = null; diff --git a/src/oimo/dynamics/constraint/contact/ContactImpulse.hx b/src/oimo/dynamics/constraint/contact/ContactImpulse.hx index e95f0b4..d47c7e7 100644 --- a/src/oimo/dynamics/constraint/contact/ContactImpulse.hx +++ b/src/oimo/dynamics/constraint/contact/ContactImpulse.hx @@ -28,8 +28,7 @@ class ContactImpulse { clear(); } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { impulseN = 0; impulseT = 0; impulseB = 0; diff --git a/src/oimo/dynamics/constraint/contact/ManifoldPoint.hx b/src/oimo/dynamics/constraint/contact/ManifoldPoint.hx index 669fec9..3904174 100644 --- a/src/oimo/dynamics/constraint/contact/ManifoldPoint.hx +++ b/src/oimo/dynamics/constraint/contact/ManifoldPoint.hx @@ -53,8 +53,7 @@ class ManifoldPoint { // --- internal --- - @:extern - public inline function _clear():Void { + extern public inline function _clear():Void { M.vec3_zero(_localPos1); M.vec3_zero(_localPos2); M.vec3_zero(_relPos1); @@ -68,8 +67,7 @@ class ManifoldPoint { _id = -1; } - @:extern - public inline function _initialize(result:DetectorResultPoint, tf1:Transform, tf2:Transform):Void { + extern public inline function _initialize(result:DetectorResultPoint, tf1:Transform, tf2:Transform):Void { // world position M.vec3_fromVec3(_pos1, result.position1); M.vec3_fromVec3(_pos2, result.position2); @@ -91,8 +89,7 @@ class ManifoldPoint { _disabled = false; } - @:extern - public inline function _updateDepthAndPositions(result:DetectorResultPoint, tf1:Transform, tf2:Transform):Void { + extern public inline function _updateDepthAndPositions(result:DetectorResultPoint, tf1:Transform, tf2:Transform):Void { // world position M.vec3_fromVec3(_pos1, result.position1); M.vec3_fromVec3(_pos2, result.position2); @@ -108,8 +105,7 @@ class ManifoldPoint { _depth = result.depth; } - @:extern - public inline function _copyFrom(cp:ManifoldPoint):Void { + extern public inline function _copyFrom(cp:ManifoldPoint):Void { M.vec3_assign(_localPos1, cp._localPos1); M.vec3_assign(_localPos2, cp._localPos2); M.vec3_assign(_relPos1, cp._relPos1); diff --git a/src/oimo/dynamics/constraint/contact/ManifoldUpdater.hx b/src/oimo/dynamics/constraint/contact/ManifoldUpdater.hx index cf8a221..4fc2575 100644 --- a/src/oimo/dynamics/constraint/contact/ManifoldUpdater.hx +++ b/src/oimo/dynamics/constraint/contact/ManifoldUpdater.hx @@ -124,8 +124,7 @@ class ManifoldUpdater { return target; } - @:extern - inline function quadAreaFast(p1:IVec3, p2:IVec3, p3:IVec3, p4:IVec3):Float { + extern inline function quadAreaFast(p1:IVec3, p2:IVec3, p3:IVec3, p4:IVec3):Float { // possible diagonals (12-34, 13-24, 14-23) var v12:IVec3; var v34:IVec3; @@ -188,8 +187,7 @@ class ManifoldUpdater { return idx; } - @:extern - inline function distSq(mp:ManifoldPoint, result:DetectorResultPoint, tf1:Transform, tf2:Transform):Float { + extern inline function distSq(mp:ManifoldPoint, result:DetectorResultPoint, tf1:Transform, tf2:Transform):Float { var rp1:IVec3; var rp2:IVec3; M.vec3_fromVec3(rp1, result.position1); @@ -208,16 +206,14 @@ class ManifoldUpdater { return sq1 < sq2 ? sq1 : sq2; } - @:extern - inline function saveOldData():Void { + extern inline function saveOldData():Void { numOldPoints = _manifold._numPoints; for (i in 0...numOldPoints) { oldPoints[i]._copyFrom(_manifold._points[i]); } } - @:extern - inline function updateContactPointById(cp:ManifoldPoint):Void { + extern inline function updateContactPointById(cp:ManifoldPoint):Void { for (i in 0...numOldPoints) { var ocp:ManifoldPoint = oldPoints[i]; if (cp._id == ocp._id) { diff --git a/src/oimo/dynamics/constraint/info/JacobianRow.hx b/src/oimo/dynamics/constraint/info/JacobianRow.hx index 66c5393..1197772 100644 --- a/src/oimo/dynamics/constraint/info/JacobianRow.hx +++ b/src/oimo/dynamics/constraint/info/JacobianRow.hx @@ -25,8 +25,7 @@ class JacobianRow { flag = 0; } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { M.vec3_zero(lin1); M.vec3_zero(lin2); M.vec3_zero(ang1); @@ -43,13 +42,11 @@ class JacobianRow { } } - @:extern - public inline function isLinearSet():Bool { + extern public inline function isLinearSet():Bool { return flag & BIT_LINEAR_SET != 0; } - @:extern - public inline function isAngularSet():Bool { + extern public inline function isAngularSet():Bool { return flag & BIT_ANGULAR_SET != 0; } diff --git a/src/oimo/dynamics/constraint/info/contact/ContactSolverInfoRow.hx b/src/oimo/dynamics/constraint/info/contact/ContactSolverInfoRow.hx index fe4e269..fe18ffa 100644 --- a/src/oimo/dynamics/constraint/info/contact/ContactSolverInfoRow.hx +++ b/src/oimo/dynamics/constraint/info/contact/ContactSolverInfoRow.hx @@ -38,8 +38,7 @@ class ContactSolverInfoRow { impulse = null; } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { jacobianN.clear(); jacobianT.clear(); jacobianB.clear(); diff --git a/src/oimo/dynamics/constraint/info/joint/JointSolverInfo.hx b/src/oimo/dynamics/constraint/info/joint/JointSolverInfo.hx index f2198d3..47eb91b 100644 --- a/src/oimo/dynamics/constraint/info/joint/JointSolverInfo.hx +++ b/src/oimo/dynamics/constraint/info/joint/JointSolverInfo.hx @@ -26,8 +26,7 @@ class JointSolverInfo { } } - @:extern - public inline function addRow(impulse:JointImpulse):JointSolverInfoRow { + extern public inline function addRow(impulse:JointImpulse):JointSolverInfoRow { var row:JointSolverInfoRow = rows[numRows++]; row.clear(); row.impulse = impulse; diff --git a/src/oimo/dynamics/constraint/info/joint/JointSolverInfoRow.hx b/src/oimo/dynamics/constraint/info/joint/JointSolverInfoRow.hx index 06e14ab..e820dc1 100644 --- a/src/oimo/dynamics/constraint/info/joint/JointSolverInfoRow.hx +++ b/src/oimo/dynamics/constraint/info/joint/JointSolverInfoRow.hx @@ -44,8 +44,7 @@ class JointSolverInfoRow { impulse = null; } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { jacobian.clear(); rhs = 0; cfm = 0; @@ -56,16 +55,14 @@ class JointSolverInfoRow { impulse = null; } - @:extern - public inline function equalLimit(rhs:Float, cfm:Float):Void { + extern public inline function equalLimit(rhs:Float, cfm:Float):Void { this.rhs = rhs; this.cfm = cfm; minImpulse = MathUtil.NEGATIVE_INFINITY; maxImpulse = MathUtil.POSITIVE_INFINITY; } - @:extern - public inline function motor(speed:Float, maxImpulse:Float):Void { + extern public inline function motor(speed:Float, maxImpulse:Float):Void { motorSpeed = speed; motorMaxImpulse = maxImpulse; } diff --git a/src/oimo/dynamics/constraint/joint/BasisTracker.hx b/src/oimo/dynamics/constraint/joint/BasisTracker.hx index 108720a..c6b7ca5 100644 --- a/src/oimo/dynamics/constraint/joint/BasisTracker.hx +++ b/src/oimo/dynamics/constraint/joint/BasisTracker.hx @@ -23,23 +23,19 @@ class BasisTracker { M.vec3_zero(z); } - @:extern - public inline function trackByX():Void { + extern public inline function trackByX():Void { trackByAxis(0); } - @:extern - public inline function trackByY():Void { + extern public inline function trackByY():Void { trackByAxis(1); } - @:extern - public inline function trackByZ():Void { + extern public inline function trackByZ():Void { trackByAxis(2); } - @:extern - inline function trackByAxis(axis:Int):Void { + extern inline function trackByAxis(axis:Int):Void { var invM1:Float = joint._b1._invMass; var invM2:Float = joint._b2._invMass; var q:IQuat; diff --git a/src/oimo/dynamics/constraint/joint/CylindricalJoint.hx b/src/oimo/dynamics/constraint/joint/CylindricalJoint.hx index cf06742..9bea0b2 100644 --- a/src/oimo/dynamics/constraint/joint/CylindricalJoint.hx +++ b/src/oimo/dynamics/constraint/joint/CylindricalJoint.hx @@ -135,8 +135,7 @@ class CylindricalJoint extends Joint { M.vec3_assign(j.ang2, _basis.z); } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { var cos:Float; // compute angular error along Y and Z diff --git a/src/oimo/dynamics/constraint/joint/GenericJoint.hx b/src/oimo/dynamics/constraint/joint/GenericJoint.hx index a550929..493fe58 100644 --- a/src/oimo/dynamics/constraint/joint/GenericJoint.hx +++ b/src/oimo/dynamics/constraint/joint/GenericJoint.hx @@ -12,7 +12,11 @@ import oimo.dynamics.constraint.info.joint.JointSolverInfo; import oimo.dynamics.constraint.info.joint.JointSolverInfoRow; /** - * TODO: write doc + * A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in + * highly flexible way, so that every translational and rotational axis + * can be locked, unlocked, springy, or powered by a motor like other + * joints. Note that rotation angles are measured as x-y-z Euler angles, + * not as z-x-z Euler angles. */ @:build(oimo.m.B.bu()) class GenericJoint extends Joint { @@ -85,8 +89,7 @@ class GenericJoint extends Joint { _rotSds[2] = config.rotationalSpringDampers[2].clone(); } - @:extern - inline function updateConstraintAxes():Void { + extern inline function updateConstraintAxes():Void { var rot1:IMat3; var rot2:IMat3; M.mat3_fromCols(rot1, _basisX1, _basisY1, _basisZ1); @@ -213,8 +216,7 @@ class GenericJoint extends Joint { } } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { var rot1:IMat3; var rot2:IMat3; M.mat3_fromCols(rot1, _basisX1, _basisY1, _basisZ1); diff --git a/src/oimo/dynamics/constraint/joint/Joint.hx b/src/oimo/dynamics/constraint/joint/Joint.hx index 287e0d5..99bbc67 100644 --- a/src/oimo/dynamics/constraint/joint/Joint.hx +++ b/src/oimo/dynamics/constraint/joint/Joint.hx @@ -498,8 +498,7 @@ class Joint { // --- internal --- - @:extern - public inline function _getWarmStartingFactor():Float { + extern public inline function _getWarmStartingFactor():Float { switch (_positionCorrectionAlgorithm) { case PositionCorrectionAlgorithm.BAUMGARTE: return Setting.jointWarmStartingFactorForBaungarte; @@ -556,8 +555,7 @@ class Joint { } } - @:extern - public inline function _attachLinks():Void { + extern public inline function _attachLinks():Void { _link1._other = _b2; _link2._other = _b1; M.list_push(_b1._jointLinkList, _b1._jointLinkListLast, _prev, _next, _link1); @@ -568,8 +566,7 @@ class Joint { _b2.wakeUp(); } - @:extern - public inline function _detachLinks():Void { + extern public inline function _detachLinks():Void { M.list_remove(_b1._jointLinkList, _b1._jointLinkListLast, _prev, _next, _link1); M.list_remove(_b2._jointLinkList, _b2._jointLinkListLast, _prev, _next, _link2); _link1._other = null; diff --git a/src/oimo/dynamics/constraint/joint/JointImpulse.hx b/src/oimo/dynamics/constraint/joint/JointImpulse.hx index 4091c6f..a722195 100644 --- a/src/oimo/dynamics/constraint/joint/JointImpulse.hx +++ b/src/oimo/dynamics/constraint/joint/JointImpulse.hx @@ -16,8 +16,7 @@ class JointImpulse { clear(); } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { impulse = 0; impulseM = 0; impulseP = 0; diff --git a/src/oimo/dynamics/constraint/joint/PrismaticJoint.hx b/src/oimo/dynamics/constraint/joint/PrismaticJoint.hx index 617c550..3958ddf 100644 --- a/src/oimo/dynamics/constraint/joint/PrismaticJoint.hx +++ b/src/oimo/dynamics/constraint/joint/PrismaticJoint.hx @@ -127,8 +127,7 @@ class PrismaticJoint extends Joint { M.vec3_set(j.ang2, 0, 0, 1); } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { // compute angular error var rot1:IMat3; var rot2:IMat3; diff --git a/src/oimo/dynamics/constraint/joint/RagdollJoint.hx b/src/oimo/dynamics/constraint/joint/RagdollJoint.hx index 7980d82..878a7f0 100644 --- a/src/oimo/dynamics/constraint/joint/RagdollJoint.hx +++ b/src/oimo/dynamics/constraint/joint/RagdollJoint.hx @@ -156,8 +156,7 @@ class RagdollJoint extends Joint { } } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { var tf1:Transform = _b1._transform; var tf2:Transform = _b2._transform; diff --git a/src/oimo/dynamics/constraint/joint/RevoluteJoint.hx b/src/oimo/dynamics/constraint/joint/RevoluteJoint.hx index 7b0cf9a..0971f8b 100644 --- a/src/oimo/dynamics/constraint/joint/RevoluteJoint.hx +++ b/src/oimo/dynamics/constraint/joint/RevoluteJoint.hx @@ -133,8 +133,7 @@ class RevoluteJoint extends Joint { M.vec3_assign(j.ang2, _basis.z); } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { var cos:Float; // compute angular error along Y and Z diff --git a/src/oimo/dynamics/constraint/joint/UniversalJoint.hx b/src/oimo/dynamics/constraint/joint/UniversalJoint.hx index 03b67fc..1d514ae 100644 --- a/src/oimo/dynamics/constraint/joint/UniversalJoint.hx +++ b/src/oimo/dynamics/constraint/joint/UniversalJoint.hx @@ -61,8 +61,7 @@ class UniversalJoint extends Joint { _lm2 = config.limitMotor2.clone(); } - @:extern - inline function updateConstraintAxes():Void { + extern inline function updateConstraintAxes():Void { var rot1:IMat3; var rot2:IMat3; M.mat3_fromCols(rot1, _basisX1, _basisY1, _basisZ1); @@ -199,8 +198,7 @@ class UniversalJoint extends Joint { } } - @:extern - inline function computeErrors():Void { + extern inline function computeErrors():Void { var rot1:IMat3; var rot2:IMat3; M.mat3_fromCols(rot1, _basisX1, _basisY1, _basisZ1); diff --git a/src/oimo/dynamics/constraint/solver/direct/BoundaryBuildInfo.hx b/src/oimo/dynamics/constraint/solver/direct/BoundaryBuildInfo.hx index 7cae139..833b059 100644 --- a/src/oimo/dynamics/constraint/solver/direct/BoundaryBuildInfo.hx +++ b/src/oimo/dynamics/constraint/solver/direct/BoundaryBuildInfo.hx @@ -26,32 +26,27 @@ class BoundaryBuildInfo { iUnbounded = new Vector(size); } - @:extern - public inline function clear():Void { + extern public inline function clear():Void { numBounded = 0; numUnbounded = 0; } - @:extern - public inline function pushBounded(idx:Int, sign:Int):Void { + extern public inline function pushBounded(idx:Int, sign:Int):Void { iBounded[numBounded] = idx; signs[numBounded] = sign; numBounded++; } - @:extern - public inline function pushUnbounded(idx:Int):Void { + extern public inline function pushUnbounded(idx:Int):Void { iUnbounded[numUnbounded] = idx; numUnbounded++; } - @:extern - public inline function popBounded():Void { + extern public inline function popBounded():Void { numBounded--; } - @:extern - public inline function popUnbounded():Void { + extern public inline function popUnbounded():Void { numUnbounded--; } diff --git a/src/oimo/dynamics/constraint/solver/direct/BoundaryBuilder.hx b/src/oimo/dynamics/constraint/solver/direct/BoundaryBuilder.hx index d1cbd11..a601e36 100644 --- a/src/oimo/dynamics/constraint/solver/direct/BoundaryBuilder.hx +++ b/src/oimo/dynamics/constraint/solver/direct/BoundaryBuilder.hx @@ -63,8 +63,7 @@ class BoundaryBuilder { } } - @:extern - inline function addBoundary():Boundary { + extern inline function addBoundary():Boundary { if (boundaries[numBoundaries] == null) { boundaries[numBoundaries] = new Boundary(maxRows); } diff --git a/src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx b/src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx index e19730e..d444c51 100644 --- a/src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx +++ b/src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx @@ -67,8 +67,7 @@ class DirectJointConstraintSolver extends ConstraintSolver { } } - @:extern - inline function applyImpulses(impulses:Vector):Void { + extern inline function applyImpulses(impulses:Vector):Void { var linearSet:Bool = false; var angularSet:Bool = false; var lv1:IVec3; @@ -106,8 +105,7 @@ class DirectJointConstraintSolver extends ConstraintSolver { } } - @:extern - inline function applySplitImpulses(impulses:Vector):Void { + extern inline function applySplitImpulses(impulses:Vector):Void { var linearSet:Bool = false; var angularSet:Bool = false; var lv1:IVec3; @@ -145,8 +143,7 @@ class DirectJointConstraintSolver extends ConstraintSolver { } } - @:extern - inline function applyPositionImpulses(impulses:Vector):Void { + extern inline function applyPositionImpulses(impulses:Vector):Void { var linearSet:Bool = false; var angularSet:Bool = false; var lv1:IVec3; @@ -364,8 +361,7 @@ class DirectJointConstraintSolver extends ConstraintSolver { M.vec3_scale(joint._appliedTorque, ang, timeStep.invDt); } - @:extern - inline function updatePositionData():Void { + extern inline function updatePositionData():Void { joint._syncAnchors(); joint._getPositionSolverInfo(info); diff --git a/src/oimo/dynamics/constraint/solver/direct/MassMatrix.hx b/src/oimo/dynamics/constraint/solver/direct/MassMatrix.hx index ad2031c..120d914 100644 --- a/src/oimo/dynamics/constraint/solver/direct/MassMatrix.hx +++ b/src/oimo/dynamics/constraint/solver/direct/MassMatrix.hx @@ -235,8 +235,7 @@ class MassMatrix { clearCache(); } - @:extern - public inline function getSubmatrix(indices:Vector, n:Int):Vector> { + extern public inline function getSubmatrix(indices:Vector, n:Int):Vector> { var id:Int = 0; for (i in 0...n) { id |= 1 << indices[i]; @@ -251,15 +250,13 @@ class MassMatrix { return _cachedSubmatrices[id]; } - @:extern - public inline function clearCache():Void { + extern public inline function clearCache():Void { for (i in 0..._maxSubmatrixId) { _cacheComputed[i] = false; } } - @:extern - public function dump():Void { + extern public inline function dump():Void { trace("inverse mass matrix:"); dumpMatrix(_invMass); for (i in 0..._maxSubmatrixId) { @@ -277,8 +274,7 @@ class MassMatrix { } } - @:extern - public function dumpMatrix(data:Vector>):Void { + extern public inline function dumpMatrix(data:Vector>):Void { if (data.length == 0) { trace("| |"); return; diff --git a/src/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.hx b/src/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.hx index 852cd4e..6166482 100644 --- a/src/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.hx +++ b/src/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.hx @@ -251,8 +251,7 @@ class PgsContactConstraintSolver extends ConstraintSolver { M.vec3_assign(_b2._angVel, av2); } - @:extern - inline function updatePositionData():Void { + extern inline function updatePositionData():Void { constraint._syncManifold(); constraint._getPositionSolverInfo(info); diff --git a/src/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.hx b/src/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.hx index a60ae41..5ad912d 100644 --- a/src/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.hx +++ b/src/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.hx @@ -250,8 +250,7 @@ class PgsJointConstraintSolver extends ConstraintSolver { M.vec3_scale(joint._appliedTorque, ang, timeStep.invDt); } - @:extern - inline function updatePositionData():Void { + extern inline function updatePositionData():Void { joint._syncAnchors(); joint._getPositionSolverInfo(info); diff --git a/src/oimo/dynamics/rigidbody/RigidBody.hx b/src/oimo/dynamics/rigidbody/RigidBody.hx index c74f14c..fe0bd45 100644 --- a/src/oimo/dynamics/rigidbody/RigidBody.hx +++ b/src/oimo/dynamics/rigidbody/RigidBody.hx @@ -206,8 +206,7 @@ class RigidBody { } } - @:extern - public inline function _isSleepy():Bool { + extern public inline function _isSleepy():Bool { return _autoSleep && M.vec3_dot(_vel, _vel) < Setting.sleepingVelocityThreshold * Setting.sleepingVelocityThreshold && @@ -215,18 +214,15 @@ class RigidBody { ; } - @:extern - public inline function _isAlone():Bool { + extern public inline function _isAlone():Bool { return _numContactLinks == 0 && _numJointLinks == 0; } - @:extern - public inline function _applyTranslation(translation:IVec3):Void { + extern public inline function _applyTranslation(translation:IVec3):Void { M.vec3_add(_transform._position, _transform._position, translation); } - @:extern - public inline function _applyRotation(rotation:IVec3):Void { + extern public inline function _applyRotation(rotation:IVec3):Void { // compute derivative of the quaternion var theta:Float = M.vec3_length(rotation); var halfTheta:Float = theta * 0.5; @@ -260,29 +256,25 @@ class RigidBody { } // call when added/removed/modified shapes - @:extern - public inline function _shapeModified():Void { + extern public inline function _shapeModified():Void { updateMass(); _syncShapes(); } - @:extern - public inline function _syncShapes():Void { + extern public inline function _syncShapes():Void { var s:Shape = _shapeList; M.list_foreach(s, _next, { M.call(s._sync(_ptransform, _transform)); }); } - @:extern - public inline function _applyLinearPositionImpulse(imp:IVec3):Void { + extern public inline function _applyLinearPositionImpulse(imp:IVec3):Void { var translation:IVec3; M.vec3_scale(translation, imp, _invMass); M.call(_applyTranslation(translation)); } - @:extern - public inline function _applyAngularPositionImpulse(imp:IVec3):Void { + extern public inline function _applyAngularPositionImpulse(imp:IVec3):Void { var rotation:IVec3; M.vec3_mulMat3(rotation, imp, _invInertia); M.call(_applyRotation(rotation)); @@ -331,8 +323,7 @@ class RigidBody { } // compute inverse mass and inertias from _mass and _localInertia - @:extern - inline function completeMassData():Void { + extern inline function completeMassData():Void { var det:Float; det = M.mat3_det(_localInertia); if (_mass > 0 && det > 0 && _type == RigidBodyType._DYNAMIC) { @@ -354,15 +345,13 @@ class RigidBody { updateInvInertia(); } - @:extern - inline function updateInvInertia():Void { + extern inline function updateInvInertia():Void { M.mat3_transformInertia(_invInertia, _invLocalInertia, _transform._rotation); M.mat3_scaleRows(_invInertia, _invInertia, _rotFactor.x, _rotFactor.y, _rotFactor.z); } // call when the transform is externally updated - @:extern - inline function updateTransformExt():Void { + extern inline function updateTransformExt():Void { M.transform_assign(_ptransform, _transform); _syncShapes(); wakeUp(); diff --git a/src/oimo/dynamics/rigidbody/Shape.hx b/src/oimo/dynamics/rigidbody/Shape.hx index e9fa125..7810e74 100644 --- a/src/oimo/dynamics/rigidbody/Shape.hx +++ b/src/oimo/dynamics/rigidbody/Shape.hx @@ -76,8 +76,7 @@ class Shape { // --- internal --- - @:extern - public inline function _sync(tf1:Transform, tf2:Transform):Void { + extern public inline function _sync(tf1:Transform, tf2:Transform):Void { M.transform_mul(_ptransform, _localTransform, tf1); M.transform_mul(_transform, _localTransform, tf2); diff --git a/src/oimo/m/B.hx b/src/oimo/m/B.hx index 4c36765..192f2c0 100644 --- a/src/oimo/m/B.hx +++ b/src/oimo/m/B.hx @@ -182,7 +182,8 @@ class B { return { name: name, type: macro:Float, - expr: null + expr: null, + isFinal: false }; })); } diff --git a/src/oimo/m/M.hx b/src/oimo/m/M.hx index b32a96e..b00ae98 100644 --- a/src/oimo/m/M.hx +++ b/src/oimo/m/M.hx @@ -33,11 +33,10 @@ class M { }; } - @:extern - public static inline function error(msg:String) { + extern public static inline function error(msg:String) { return #if js - new js.Error(msg) + new js.lib.Error(msg) #elseif flash new flash.errors.Error(msg) #elseif java From b5c4da9bee98b589cb1c612aa0fe7e08fd18238a Mon Sep 17 00:00:00 2001 From: saharan Date: Wed, 19 Feb 2020 21:49:07 +0900 Subject: [PATCH 02/13] edit readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d93e9f6..c7582ef 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ A lightweight 3D physics engine. ## [API Documentation](https://saharan.github.io/OimoPhysics/) ## Demos - + * Press `E` or `Q` to change demos -* Click or tap text to control +* Click or tap texts on the left to control ## Features * Written in Haxe * Exported as JavaScript (see [bin/js/](./bin/js)) - * Public classes and methods will be exposed through `window.OIMO`. + * Public classes and methods are exposed through `window.OIMO`. * e.g. `new OIMO.Vec3(1, 2, 3)` to create an instance of `Vec3` class. * Rigid body motion types * Dynamic @@ -46,8 +46,8 @@ A lightweight 3D physics engine. * Collision filterings * Collision queries * AABB query - * ray casting - * convex casting + * Ray casting + * Convex casting ## Compilations Haxe 4.0.0 or later is required. (recommended: Haxe 4.0.5 or later) From 8fd664e16e91b9043e9fee6c42078fe9378c47bd Mon Sep 17 00:00:00 2001 From: Oleksii Maksymov Date: Sun, 1 Mar 2020 13:50:10 +0200 Subject: [PATCH 03/13] Added TS declaration --- README.md | 1 + bin/js_modules/OimoPhysics.d.ts | 5700 ++++ bin/js_modules/OimoPhysics.js | 54881 ++++++++++++++++++++++++++++++ build-js-ts.hxml | 26 + exports/src/export/ts/Export.hx | 247 + 5 files changed, 60855 insertions(+) create mode 100644 bin/js_modules/OimoPhysics.d.ts create mode 100644 bin/js_modules/OimoPhysics.js create mode 100644 build-js-ts.hxml create mode 100644 exports/src/export/ts/Export.hx diff --git a/README.md b/README.md index c7582ef..d477d39 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Haxe 4.0.0 or later is required. (recommended: Haxe 4.0.5 or later) * Use `build-js.hxml` to compile for JavaScript library. * Use `build-js-demos.hxml` to compile JavaScript demos. * Use `build-doc.hxml` to generate API documentation. [dox](https://github.com/HaxeFoundation/dox) is required. +* Use `build-js-ts.hxml` to compile for JavaScript (modules) library with TypeScript declarations. Requires `hxtsdgen` library. Check comments in that file. ## License The MIT License diff --git a/bin/js_modules/OimoPhysics.d.ts b/bin/js_modules/OimoPhysics.d.ts new file mode 100644 index 0000000..953cbbd --- /dev/null +++ b/bin/js_modules/OimoPhysics.d.ts @@ -0,0 +1,5700 @@ +/* tslint:disable */// Generated by Haxe TypeScript Declaration Generator :) + +export namespace oimo.common { + /** + * Quaternion class. + */ + export class Quat { + /** + * Creates a new quaternion. The quaternion is identity by default. + */ + constructor(x?: number, y?: number, z?: number, w?: number); + /** + * The x-value of the imaginary part of the quaternion. + */ + x: number; + /** + * The y-value of the imaginary part of the quaternion. + */ + y: number; + /** + * The z-value of the imaginary part of the quaternion. + */ + z: number; + /** + * The real part of the quaternion. + */ + w: number; + /** + * Sets the quaternion to identity quaternion and returns `this`. + */ + identity(): oimo.common.Quat; + /** + * Sets all values at once and returns `this`. + */ + init(x: number, y: number, z: number, w: number): oimo.common.Quat; + /** + * Returns `this` + `v`. + */ + add(q: oimo.common.Quat): oimo.common.Quat; + /** + * Returns `this` - `v`. + */ + sub(q: oimo.common.Quat): oimo.common.Quat; + /** + * Returns `this` * `s`. + */ + scale(s: number): oimo.common.Quat; + /** + * Sets this quaternion to `this` + `v` and returns `this`. + */ + addEq(q: oimo.common.Quat): oimo.common.Quat; + /** + * Sets this quaternion to `this` - `v` and returns `this`. + */ + subEq(q: oimo.common.Quat): oimo.common.Quat; + /** + * Sets this quaternion to `this` * `s` and returns `this`. + */ + scaleEq(s: number): oimo.common.Quat; + /** + * Returns the length of the quaternion. + */ + length(): number; + /** + * Returns the squared length of the quaternion. + */ + lengthSq(): number; + /** + * Returns the dot product of `this` and `q`. + */ + dot(q: oimo.common.Quat): number; + /** + * Returns the normalized quaternion. + * + * If the length is zero, zero quaterinon is returned. + */ + normalized(): oimo.common.Quat; + /** + * Sets this quaternion to the normalized quaternion and returns `this`. + * + * If the length is zero, this quaternion is set to zero quaternion. + */ + normalize(): oimo.common.Quat; + /** + * Sets this quaternion to the quaternion representing the shortest arc + * rotation from `v1` to `v2`, and return `this`. + */ + setArc(v1: oimo.common.Vec3, v2: oimo.common.Vec3): oimo.common.Quat; + /** + * Returns the spherical linear interpolation between two quaternions `this` and `q` with interpolation paraeter `t`. + * Both quaternions `this` and `q` must be normalized. + */ + slerp(q: oimo.common.Quat, t: number): oimo.common.Quat; + /** + * Copies values from `q` and returns `this`. + */ + copyFrom(q: oimo.common.Quat): oimo.common.Quat; + /** + * Returns a clone of the quaternion. + */ + clone(): oimo.common.Quat; + /** + * Sets this quaternion to the representation of the matrix `m`, and returns `this`. + * + * The matrix `m` must be a rotation matrix, that is, must be orthogonalized and have determinant 1. + */ + fromMat3(m: oimo.common.Mat3): oimo.common.Quat; + /** + * Returns a rotation matrix which represents this quaternion. + */ + toMat3(): oimo.common.Mat3; + /** + * Returns the string representation of the quaternion. + */ + toString(): string; + /** + * The number of instance creation. + */ + static numCreations: number; + } +} + +export namespace oimo.common { + /** + * 3x3 Matrix class. + * + * Note that columns and rows are 0-indexed. + */ + export class Mat3 { + /** + * Creates a new matrix. The matrix is identity by default. + */ + constructor(e00?: number, e01?: number, e02?: number, e10?: number, e11?: number, e12?: number, e20?: number, e21?: number, e22?: number); + /** + * The element at row 0 column 0. + */ + e00: number; + /** + * The element at row 0 column 1. + */ + e01: number; + /** + * The element at row 0 column 2. + */ + e02: number; + /** + * The element at row 1 column 0. + */ + e10: number; + /** + * The element at row 1 column 1. + */ + e11: number; + /** + * The element at row 1 column 2. + */ + e12: number; + /** + * The element at row 2 column 0. + */ + e20: number; + /** + * The element at row 2 column 1. + */ + e21: number; + /** + * The element at row 2 column 2. + */ + e22: number; + /** + * Sets all elements at once and returns `this`. + */ + init(e00: number, e01: number, e02: number, e10: number, e11: number, e12: number, e20: number, e21: number, e22: number): oimo.common.Mat3; + /** + * Sets this matrix to identity matrix and returns `this`. + */ + identity(): oimo.common.Mat3; + /** + * Returns `this` + `m` + */ + add(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Returns `this` - `m` + */ + sub(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Returns `this` * `s` + */ + scale(s: number): oimo.common.Mat3; + /** + * Returns `this` * `m` + */ + mul(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Sets this matrix to `this` + `m` and returns `this`. + */ + addEq(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Sets this matrix to `this` - `m` and returns `this`. + */ + subEq(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Sets this matrix to `this` * `s` and returns `this`. + */ + scaleEq(s: number): oimo.common.Mat3; + /** + * Sets this matrix to `this` * `m` and returns `this`. + */ + mulEq(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Returns *scaling matrix* * `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + prependScale(sx: number, sy: number, sz: number): oimo.common.Mat3; + /** + * Returns `this` * *scaling matrix*. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + appendScale(sx: number, sy: number, sz: number): oimo.common.Mat3; + /** + * Returns *rotation matrix* * `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + prependRotation(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat3; + /** + * Returns `this` * *rotation matrix*. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + appendRotation(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat3; + /** + * Sets this matrix to *scaling matrix* * `this`, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + prependScaleEq(sx: number, sy: number, sz: number): oimo.common.Mat3; + /** + * Sets this matrix to `this` * *scaling matrix*, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + appendScaleEq(sx: number, sy: number, sz: number): oimo.common.Mat3; + /** + * Sets this matrix to *rotation matrix* * `this`, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + prependRotationEq(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat3; + /** + * Sets this matrix to `this` * *rotation matrix*, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + appendRotationEq(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat3; + /** + * Returns the transposed matrix. + */ + transpose(): oimo.common.Mat3; + /** + * Sets this matrix to the transposed matrix and returns `this`. + */ + transposeEq(): oimo.common.Mat3; + /** + * Returns the determinant. + */ + determinant(): number; + /** + * Returns the trace. + */ + trace(): number; + /** + * Returns the inverse matrix. + * + * If the determinant is zero, zero matrix is returned. + */ + inverse(): oimo.common.Mat3; + /** + * Sets this matrix to the inverse matrix and returns `this`. + * + * If the determinant is zero, this matrix is set to zero matrix. + */ + inverseEq(): oimo.common.Mat3; + /** + * Returns an array of the elements of this matrix. + * + * If `columnMajor` is true, the array is arranged in column-major order. + * Otherwise, the array is arranged in row-major order. + */ + toArray(columnMajor?: boolean): number[]; + /** + * Copies values from `m` and returns `this`. + */ + copyFrom(m: oimo.common.Mat3): oimo.common.Mat3; + /** + * Returns a clone of the matrix. + */ + clone(): oimo.common.Mat3; + /** + * Sets this matrix to the representation of the quaternion `q`, and returns `this`. + */ + fromQuat(q: oimo.common.Quat): oimo.common.Mat3; + /** + * Returns a quaternion which represents this matrix. + * + * This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1. + */ + toQuat(): oimo.common.Quat; + /** + * Sets this matrix to the rotation matrix represented by Euler angles `eulerAngles`, and returns `this`. + * Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. + */ + fromEulerXyz(eulerAngles: oimo.common.Vec3): oimo.common.Mat3; + /** + * Returns a vector `(angleX, angleY, angleZ)` represents the Euler angles of this matrix. + * Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. + * Note that `angleX`, `angleY`, and `angleZ` are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively. + */ + toEulerXyz(): oimo.common.Vec3; + /** + * Returns the `index`th row vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `null` will be returned. + */ + getRow(index: number): oimo.common.Vec3; + /** + * Returns the `index`th column vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `null` will be returned. + */ + getCol(index: number): oimo.common.Vec3; + /** + * Sets `dst` to the `index`th row vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `dst` will be set to the zero vector. + */ + getRowTo(index: number, dst: oimo.common.Vec3): void; + /** + * Sets `dst` to the `index`th column vector of the matrix. + * + * If `index` is less than `0` or greater than `2`, `dst` will be set to the zero vector. + */ + getColTo(index: number, dst: oimo.common.Vec3): void; + /** + * Sets this matrix by row vectors and returns `this`. + */ + fromRows(row0: oimo.common.Vec3, row1: oimo.common.Vec3, row2: oimo.common.Vec3): oimo.common.Mat3; + /** + * Sets this matrix by column vectors and returns `this`. + */ + fromCols(col0: oimo.common.Vec3, col1: oimo.common.Vec3, col2: oimo.common.Vec3): oimo.common.Mat3; + /** + * Returns the string representation of the matrix. + */ + toString(): string; + /** + * The number of instance creation. + */ + static numCreations: number; + } +} + +export namespace oimo.common { + /** + * Transform class provides a set of translation and rotation. + */ + export class Transform { + /** + * Creates a new identical transform. + */ + constructor(); + _positionX: number; + _positionY: number; + _positionZ: number; + _rotation00: number; + _rotation01: number; + _rotation02: number; + _rotation10: number; + _rotation11: number; + _rotation12: number; + _rotation20: number; + _rotation21: number; + _rotation22: number; + /** + * Sets the transformation to identity and returns `this`. + */ + identity(): oimo.common.Transform; + /** + * Returns the position of the transformation. + */ + getPosition(): oimo.common.Vec3; + /** + * Sets `position` to the position of the transformation. + * + * This does not create a new instance of `Vec3`. + */ + getPositionTo(position: oimo.common.Vec3): void; + /** + * Sets the position of the transformation to `position` and returns `this`. + */ + setPosition(position: oimo.common.Vec3): oimo.common.Transform; + /** + * Translates the position by `translation`. + */ + translate(translation: oimo.common.Vec3): void; + /** + * Returns the rotation matrix. + */ + getRotation(): oimo.common.Mat3; + /** + * Sets `out` to the rotation matrix. + * + * This does not create a new instance of `Mat3`. + */ + getRotationTo(out: oimo.common.Mat3): void; + /** + * Sets the rotation matrix to `rotation` and returns `this`. + */ + setRotation(rotation: oimo.common.Mat3): oimo.common.Transform; + /** + * Sets the rotation by Euler angles `eulerAngles` in radians. + */ + setRotationXyz(eulerAngles: oimo.common.Vec3): void; + /** + * Applies rotation by the rotation matrix `rotation`. + */ + rotate(rotation: oimo.common.Mat3): void; + /** + * Applies the rotation by Euler angles `eulerAngles` in radians. + */ + rotateXyz(eulerAngles: oimo.common.Vec3): void; + /** + * Returns the rotation as a quaternion. + */ + getOrientation(): oimo.common.Quat; + /** + * Sets `orientation` to the quaternion representing the rotation. + * + * This does not create a new instance of `Quat`. + */ + getOrientationTo(orientation: oimo.common.Quat): void; + /** + * Sets the rotation from a quaternion `quaternion` and returns `this`. + */ + setOrientation(quaternion: oimo.common.Quat): oimo.common.Transform; + /** + * Returns a clone of the transformation. + */ + clone(): oimo.common.Transform; + /** + * Sets the transformation to `transform` and returns `this`. + */ + copyFrom(transform: oimo.common.Transform): oimo.common.Transform; + } +} + +export namespace oimo.common { + /** + * 4x4 Matrix class. + * + * Note that columns and rows are 0-indexed. + */ + export class Mat4 { + /** + * Creates a new matrix. The matrix is identity by default. + */ + constructor(e00?: number, e01?: number, e02?: number, e03?: number, e10?: number, e11?: number, e12?: number, e13?: number, e20?: number, e21?: number, e22?: number, e23?: number, e30?: number, e31?: number, e32?: number, e33?: number); + /** + * The element at row 0 column 0. + */ + e00: number; + /** + * The element at row 0 column 1. + */ + e01: number; + /** + * The element at row 0 column 2. + */ + e02: number; + /** + * The element at row 0 column 3. + */ + e03: number; + /** + * The element at row 1 column 0. + */ + e10: number; + /** + * The element at row 1 column 1. + */ + e11: number; + /** + * The element at row 1 column 2. + */ + e12: number; + /** + * The element at row 1 column 3. + */ + e13: number; + /** + * The element at row 2 column 0. + */ + e20: number; + /** + * The element at row 2 column 1. + */ + e21: number; + /** + * The element at row 2 column 2. + */ + e22: number; + /** + * The element at row 2 column 3. + */ + e23: number; + /** + * The element at row 3 column 0. + */ + e30: number; + /** + * The element at row 3 column 1. + */ + e31: number; + /** + * The element at row 3 column 2. + */ + e32: number; + /** + * The element at row 3 column 3. + */ + e33: number; + /** + * Sets all elements at once and returns `this`. + */ + init(e00: number, e01: number, e02: number, e03: number, e10: number, e11: number, e12: number, e13: number, e20: number, e21: number, e22: number, e23: number, e30: number, e31: number, e32: number, e33: number): oimo.common.Mat4; + /** + * Sets this matrix to identity matrix and returns `this`. + */ + identity(): oimo.common.Mat4; + /** + * Returns `this` + `m` + */ + add(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Returns `this` - `m` + */ + sub(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Returns `this` * `s` + */ + scale(s: number): oimo.common.Mat4; + /** + * Returns `this` * `m` + */ + mul(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Sets this matrix to `this` + `m` and returns `this`. + */ + addEq(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Sets this matrix to `this` - `m` and returns `this`. + */ + subEq(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Sets this matrix to `this` * `s` and returns `this`. + */ + scaleEq(s: number): oimo.common.Mat4; + /** + * Sets this matrix to `this` * `m` and returns `this`. + */ + mulEq(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Returns *scaling matrix* * `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + prependScale(sx: number, sy: number, sz: number): oimo.common.Mat4; + /** + * Returns `this` * *scaling matrix*. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + appendScale(sx: number, sy: number, sz: number): oimo.common.Mat4; + /** + * Returns *rotation matrix* * `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + prependRotation(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat4; + /** + * Returns `this` * *rotation matrix*. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + appendRotation(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat4; + /** + * Returns *translation matrix* * `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + */ + prependTranslation(tx: number, ty: number, tz: number): oimo.common.Mat4; + /** + * Returns `this` * *translation matrix*. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + */ + appendTranslation(tx: number, ty: number, tz: number): oimo.common.Mat4; + /** + * Sets this matrix to *scaling matrix* * `this`, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + prependScaleEq(sx: number, sy: number, sz: number): oimo.common.Mat4; + /** + * Sets this matrix to `this` * *scaling matrix*, and returns `this`. + * + * Where *scaling matrix* is a matrix which scales `sx` times, `sy` times and + * `sz` times along the x-axis, y-axis and z-axis respectively. + */ + appendScaleEq(sx: number, sy: number, sz: number): oimo.common.Mat4; + /** + * Sets this matrix to *rotation matrix* * `this`, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + prependRotationEq(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat4; + /** + * Sets this matrix to `this` * *rotation matrix*, and returns `this`. + * + * Where *rotation matrix* is a matrix which rotates `rad` in radians around the **normalized** + * vector (`axisX`, `axisY`, `axisZ`). + */ + appendRotationEq(rad: number, axisX: number, axisY: number, axisZ: number): oimo.common.Mat4; + /** + * Sets this matrix to *translation matrix* * `this`, and returns `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + */ + prependTranslationEq(tx: number, ty: number, tz: number): oimo.common.Mat4; + /** + * Sets this matrix to `this` * *translation matrix*, and returns `this`. + * + * Where *translation matrix* is a matrix which translates `sx`, `sy` and `sz` along + * the x-axis, y-axis and z-axis respectively. + */ + appendTranslationEq(tx: number, ty: number, tz: number): oimo.common.Mat4; + /** + * Returns the transposed matrix. + */ + transpose(): oimo.common.Mat4; + /** + * Sets this matrix to the transposed matrix and returns `this`. + */ + transposeEq(): oimo.common.Mat4; + /** + * Returns the determinant. + */ + determinant(): number; + /** + * Returns the trace. + */ + trace(): number; + /** + * Returns the inverse matrix. + * + * If the determinant is zero, zero matrix is returned. + */ + inverse(): oimo.common.Mat4; + /** + * Sets this matrix to the inverse matrix and returns `this`. + * + * If the determinant is zero, this matrix is set to zero matrix. + */ + inverseEq(): oimo.common.Mat4; + /** + * Sets this matrix to *view matrix* and returns `this`. + * + * Where *view matrix* is a matrix which represents the viewing transformation with + * eyes at (`eyeX`, `eyeY`, `eyeZ`), fixation point at (`atX`, `atY`, `atZ`), and + * up vector (`upX`, `upY`, `upZ`). + */ + lookAt(eyeX: number, eyeY: number, eyeZ: number, atX: number, atY: number, atZ: number, upX: number, upY: number, upZ: number): oimo.common.Mat4; + /** + * Sets this matrix to *perspecive projection matrix* and returns `this`. + * + * Where *perspecive projection matrix* is a matrix which represents the perspective + * projection transformation with field of view in the y direction `fovY` in radians, + * aspect ratio `aspect`, and z-value of near and far clipping plane `near`, `far`. + */ + perspective(fovY: number, aspect: number, near: number, far: number): oimo.common.Mat4; + /** + * Sets this matrix to *orthogonal projection matrix* and returns `this`. + * + * Where *orthogonal projection matrix* is a matrix which represents the orthogonal + * projection transformation with screen width and height `width`, `height`, and + * z-value of near and far clipping plane `near`, `far`. + */ + ortho(width: number, height: number, near: number, far: number): oimo.common.Mat4; + /** + * Returns an array of the elements of this matrix. + * + * If `columnMajor` is true, the array is arranged in column-major order. + * Otherwise, the array is arranged in row-major order. + */ + toArray(columnMajor?: boolean): number[]; + /** + * Copies values from `m` and returns `this`. + */ + copyFrom(m: oimo.common.Mat4): oimo.common.Mat4; + /** + * Sets this matrix to the extension of `m` and returns `this`. + * + * `this.e33` is set to `1` and other components don't exist in `m` are set to `0`. + */ + fromMat3(m: oimo.common.Mat3): oimo.common.Mat4; + /** + * Sets this matrix to the representation of `transform` and returns `this`. + */ + fromTransform(transform: oimo.common.Transform): oimo.common.Mat4; + /** + * Returns a clone of the matrix. + */ + clone(): oimo.common.Mat4; + /** + * Returns the string representation of the matrix. + */ + toString(): string; + /** + * The number of instance creation. + */ + static numCreations: number; + } +} + +export namespace oimo.common { + /** + * 3D vector class. + */ + export class Vec3 { + /** + * Creates a new vector. The vector is zero vector by default. + */ + constructor(x?: number, y?: number, z?: number); + /** + * The x-value of the vector. + */ + x: number; + /** + * The y-value of the vector. + */ + y: number; + /** + * The z-value of the vector. + */ + z: number; + /** + * Sets all values at once and returns `this`. + */ + init(x: number, y: number, z: number): oimo.common.Vec3; + /** + * Sets this vector to zero vector and returns `this`. + */ + zero(): oimo.common.Vec3; + /** + * Returns `this` + `v`. + */ + add(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Returns (`this.x` + `vx`, `this.y` + `vy`, `this.z` + `vz`). + */ + add3(vx: number, vy: number, vz: number): oimo.common.Vec3; + /** + * Returns `this` + `v` * `s`. + */ + addScaled(v: oimo.common.Vec3, s: number): oimo.common.Vec3; + /** + * Returns `this` - `v`. + */ + sub(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Returns (`this.x` - `vx`, `this.y` - `vy`, `this.z` - `vz`). + */ + sub3(vx: number, vy: number, vz: number): oimo.common.Vec3; + /** + * Returns `this` * `s`. + */ + scale(s: number): oimo.common.Vec3; + /** + * Returns (`this.x` * `sx`, `this.y` * `sy`, `this.z` * `sz`). + */ + scale3(sx: number, sy: number, sz: number): oimo.common.Vec3; + /** + * Returns the dot product of `this` and `v`. + */ + dot(v: oimo.common.Vec3): number; + /** + * Returns the cross product of `this` and `v`. + */ + cross(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets this vector to `this` + `v` and returns `this`. + */ + addEq(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets this vector to (`this.x` + `vx`, `this.y` + `vy`, `this.z` + `vz`) and returns `this`. + */ + add3Eq(vx: number, vy: number, vz: number): oimo.common.Vec3; + /** + * Sets this vector to `this` + `v` * `s` and returns `this`. + */ + addScaledEq(v: oimo.common.Vec3, s: number): oimo.common.Vec3; + /** + * Sets this vector to `this` - `v` and returns `this`. + */ + subEq(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets this vector to (`this.x` - `vx`, `this.y` - `vy`, `this.z` - `vz`) and returns `this`. + */ + sub3Eq(vx: number, vy: number, vz: number): oimo.common.Vec3; + /** + * Sets this vector to `this` * `s` and returns `this`. + */ + scaleEq(s: number): oimo.common.Vec3; + /** + * Sets this vector to (`this.x` * `sx`, `this.y` * `sy`, `this.z` * `sz`) and returns `this`. + */ + scale3Eq(sx: number, sy: number, sz: number): oimo.common.Vec3; + /** + * Sets this vector to the cross product of `this` and `s`, and returns `this`. + */ + crossEq(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Returns the transformed vector by `m`. + */ + mulMat3(m: oimo.common.Mat3): oimo.common.Vec3; + /** + * Returns the transformed vector by `m`. + */ + mulMat4(m: oimo.common.Mat4): oimo.common.Vec3; + /** + * Returns the transformed vector by `tf`. + */ + mulTransform(tf: oimo.common.Transform): oimo.common.Vec3; + /** + * Sets this vector to the transformed vector by `m` and returns `this`. + */ + mulMat3Eq(m: oimo.common.Mat3): oimo.common.Vec3; + /** + * Sets this vector to the transformed vector by `m` and returns `this`. + */ + mulMat4Eq(m: oimo.common.Mat4): oimo.common.Vec3; + /** + * Sets this vector to the transformed vector by `tf` and returns `this`. + */ + mulTransformEq(tf: oimo.common.Transform): oimo.common.Vec3; + /** + * Returns the length of the vector. + */ + length(): number; + /** + * Returns the squared length of the vector. + */ + lengthSq(): number; + /** + * Returns the normalized vector. + * + * If the length is zero, zero vector is returned. + */ + normalized(): oimo.common.Vec3; + /** + * Normalize this vector and returns `this`. + * + * If the length is zero, this vector is set to zero vector. + */ + normalize(): oimo.common.Vec3; + /** + * Returns the nagated vector. + */ + negate(): oimo.common.Vec3; + /** + * Negate the vector and returns `this`. + */ + negateEq(): oimo.common.Vec3; + /** + * Copies values from `v` and returns `this`. + */ + copyFrom(v: oimo.common.Vec3): oimo.common.Vec3; + /** + * Returns a clone of the vector. + */ + clone(): oimo.common.Vec3; + /** + * Returns the string representation of the vector. + */ + toString(): string; + /** + * The number of instance creation. + */ + static numCreations: number; + } +} + +export namespace oimo.dynamics.common { + /** + * Style settings of the debug draw. + */ + export class DebugDrawStyle { + /** + * Default constructor. + */ + constructor(); + shapeColor1: oimo.common.Vec3; + shapeColor2: oimo.common.Vec3; + sleepyShapeColor1: oimo.common.Vec3; + sleepyShapeColor2: oimo.common.Vec3; + sleepingShapeColor1: oimo.common.Vec3; + sleepingShapeColor2: oimo.common.Vec3; + staticShapeColor: oimo.common.Vec3; + kinematicShapeColor: oimo.common.Vec3; + aabbColor: oimo.common.Vec3; + bvhNodeColor: oimo.common.Vec3; + pairColor: oimo.common.Vec3; + contactColor: oimo.common.Vec3; + contactColor2: oimo.common.Vec3; + contactColor3: oimo.common.Vec3; + contactColor4: oimo.common.Vec3; + newContactColor: oimo.common.Vec3; + disabledContactColor: oimo.common.Vec3; + contactNormalColor: oimo.common.Vec3; + contactTangentColor: oimo.common.Vec3; + contactBinormalColor: oimo.common.Vec3; + contactNormalLength: number; + contactTangentLength: number; + contactBinormalLength: number; + jointLineColor: oimo.common.Vec3; + jointErrorColor: oimo.common.Vec3; + jointRotationalConstraintRadius: number; + basisLength: number; + basisColorX: oimo.common.Vec3; + basisColorY: oimo.common.Vec3; + basisColorZ: oimo.common.Vec3; + } +} + +export namespace oimo.dynamics.common { + /** + * The interface of debug drawer. This provides graphical information of a physics world + * for debugging softwares. Users should override at least three methods `DebugDraw.point`, + * `DebugDraw.triangle`, `DebugDraw.line`. + */ + export class DebugDraw { + /** + * Default constructor. + */ + constructor(); + /** + * Whether the shapes are drawn in wireframe mode. + */ + wireframe: boolean; + /** + * Whether to draw the shapes. + */ + drawShapes: boolean; + /** + * Whether to draw the bounding volume hierarchy of the broad-phase collision + * detection. If `BvhBroadPhase` is not used, nothing will be drawn regardless + * of the value of this parameter. + */ + drawBvh: boolean; + /** + * The minimum depth of the BVH to be drawn. If `DebugDrawer.drawBvh` is set to + * `false`, the entire BVH will not be drawn. + */ + drawBvhMinLevel: number; + /** + * The maximum depth of the BVH to be drawn. If `DebugDrawer.drawBvh` is set to + * `false`, the entire BVH will not be drawn. + */ + drawBvhMaxLevel: number; + /** + * Whether to draw the AABBs. + */ + drawAabbs: boolean; + /** + * Whether to draw the bases of the rigid bodies. + */ + drawBases: boolean; + /** + * Whether to draw the overlapping pairs of the AABBs. + */ + drawPairs: boolean; + /** + * Whether to draw the contacts. + */ + drawContacts: boolean; + /** + * Whether to draw the bases (normals, tangents, and binormals) of the contacts. + */ + drawContactBases: boolean; + /** + * Whether to draw the joints. + */ + drawJoints: boolean; + /** + * Whether to draw the limits of the joints. + */ + drawJointLimits: boolean; + /** + * The rendering style of the debug draw. + */ + style: oimo.dynamics.common.DebugDrawStyle; + /** + * Draws an axis-aligned bounding box. + * + * `min` is the minimum point of the AABB. + * + * `max` is the maximum point of the AABB. + * + * `color` is the color of the AABB. + */ + aabb(min: oimo.common.Vec3, max: oimo.common.Vec3, color: oimo.common.Vec3): void; + /** + * Draws the basis of a transform `transform`. + * + * `length` is the length of the lines to be drawn. + * + * `colorX` is the color of the x-axis of the basis. + * + * `colorY` is the color of the y-axis of the basis. + * + * `colorZ` is the color of the z-axis of the basis. + */ + basis(transform: oimo.common.Transform, length: number, colorX: oimo.common.Vec3, colorY: oimo.common.Vec3, colorZ: oimo.common.Vec3): void; + /** + * Draws an ellipse. + * + * `center` is the center of the ellipse. + * + * `ex` is the normalized x-axis vector of the ellipse. + * + * `ey` is the normalized y-axis vector of the ellipse. + * + * `radiusX` is the radius along the x-axis of the ellipse. + * + * `radiusY` is the radius along the y-axis of the ellipse. + * + * `color` is the color of the ellipse. + */ + ellipse(center: oimo.common.Vec3, ex: oimo.common.Vec3, ey: oimo.common.Vec3, radiusX: number, radiusY: number, color: oimo.common.Vec3): void; + /** + * Draws an arc. + * + * `center` is the center of the arc. + * + * `ex` is the normalized x-axis vector of the arc. + * + * `ey` is the normalized y-axis vector of the arc. + * + * `radiusX` is the radius along the x-axis of the arc. + * + * `radiusY` is the radius along the y-axis of the arc. + * + * `startAngle` is the start angle of the arc in radians. + * + * `endAngle` is the end angle of the arc in radians. + * + * `drawSector` is whether to draw line segments between start/end point and center point. + * + * `color` is the color of the arc. + */ + arc(center: oimo.common.Vec3, ex: oimo.common.Vec3, ey: oimo.common.Vec3, radiusX: number, radiusY: number, startAngle: number, endAngle: number, drawSector: boolean, color: oimo.common.Vec3): void; + /** + * Draws a cone locally along to the y-axis. The center of the cone is in the middle of + * the vertex and the center of the base circle. + * + * `tf` is the transformation of the cone. + * + * `radius` is the radius of the base circle of the cone. + * + * `halfHeight` is the half-height of the cone. The local position of the vertex of + * the cone is `(0, halfHeight, 0)`. + * + * `color` is the color of the cone. + */ + cone(tf: oimo.common.Transform, radius: number, halfHeight: number, color: oimo.common.Vec3): void; + /** + * Draws a cylinder locally along to the y-axis. + * + * `tf` is the transformation of the cylinder. + * + * `radius` is the radius of the cylinder. + * + * `halfHeight` is the half-height of the cylinder. + * + * `color` is the color of the cylinder. + */ + cylinder(tf: oimo.common.Transform, radius: number, halfHeight: number, color: oimo.common.Vec3): void; + /** + * Draws a capsule locally along to the y-axis. + * + * `tf` is the transformation of the capsule. + * + * `radius` is the radius of the capsule. + * + * `halfHeight` is the half-height of the capsule. + * + * `color` is the color of the capsule. + */ + capsule(tf: oimo.common.Transform, radius: number, halfHeight: number, color: oimo.common.Vec3): void; + /** + * Draws a sphere. + * + * `tf` is the transformation of the sphere. + * + * `radius` is the radius of the sphere. + * + * `color` is the color of the sphere. + */ + sphere(tf: oimo.common.Transform, radius: number, color: oimo.common.Vec3): void; + /** + * Draws a box. + * + * `tf` is the transformation of the box. + * + * `halfExtents` is the half-extents of the box. + * + * `color` is the color of the box. + */ + box(tf: oimo.common.Transform, halfExtents: oimo.common.Vec3, color: oimo.common.Vec3): void; + /** + * Draws a rectangle. + * + * `v1`, `v2`, `v3`, `v4` are the rectangle's vertices in CCW order. + * + * `n1`, `n2`, `n3`, `n4` are the normals of the rectangle's vertices in CCW order. + * + * `color` is the color of the rectangle. + */ + rect(v1: oimo.common.Vec3, v2: oimo.common.Vec3, v3: oimo.common.Vec3, v4: oimo.common.Vec3, n1: oimo.common.Vec3, n2: oimo.common.Vec3, n3: oimo.common.Vec3, n4: oimo.common.Vec3, color: oimo.common.Vec3): void; + /** + * Draws a point at `v`. + * + * `color` is the color of the point. + */ + point(v: oimo.common.Vec3, color: oimo.common.Vec3): void; + /** + * Draws a triangle. + * + * `v1`, `v2`, `v3` are the triangle's vertices in CCW order. + * + * `n1`, `n2`, `n3` are the normals of the triangle's vertices in CCW order. + * + * `color` is the color of the triangle. + */ + triangle(v1: oimo.common.Vec3, v2: oimo.common.Vec3, v3: oimo.common.Vec3, n1: oimo.common.Vec3, n2: oimo.common.Vec3, n3: oimo.common.Vec3, color: oimo.common.Vec3): void; + /** + * Draws a line segment between `v1` and `v2`. + * + * `color` is the color of the line segment. + */ + line(v1: oimo.common.Vec3, v2: oimo.common.Vec3, color: oimo.common.Vec3): void; + } +} + +export namespace oimo.collision.geometry { + /** + * The axis-aligned bounding box. + */ + export class Aabb { + /** + * Creates an empty AABB. Minimum and maximum points are set to zero. + */ + constructor(); + _minX: number; + _minY: number; + _minZ: number; + _maxX: number; + _maxY: number; + _maxZ: number; + /** + * Sets the minimum and maximum point and returns `this`. + * + * Equivallent to `setMin(min).setMax(max)`. + */ + init(min: oimo.common.Vec3, max: oimo.common.Vec3): oimo.collision.geometry.Aabb; + /** + * Returns the minimum point of the axis-aligned bounding box. + */ + getMin(): oimo.common.Vec3; + /** + * Sets the minimum point of the axis-aligned bounding box to `min`. + * + * This does not create a new instance of `Vec3`. + */ + getMinTo(min: oimo.common.Vec3): void; + /** + * Sets the minimum point of the axis-aligned bounding box to `min` and returns `this`. + */ + setMin(min: oimo.common.Vec3): oimo.collision.geometry.Aabb; + /** + * Returns the maximum point of the axis-aligned bounding box. + */ + getMax(): oimo.common.Vec3; + /** + * Sets the maximum point of the axis-aligned bounding box to `max`. + * + * This does not create a new instance of `Vec3`. + */ + getMaxTo(max: oimo.common.Vec3): void; + /** + * Sets the maximum point of the axis-aligned bounding box to `max` and returns `this`. + */ + setMax(max: oimo.common.Vec3): oimo.collision.geometry.Aabb; + /** + * Returns the center of the AABB. + */ + getCenter(): oimo.common.Vec3; + /** + * Sets `center` to the center of the AABB. + * + * This does not create a new instance of `Vec3`. + */ + getCenterTo(center: oimo.common.Vec3): void; + /** + * Returns the half extents of the AABB. + */ + getExtents(): oimo.common.Vec3; + /** + * Sets `halfExtents` to the half extents of the AABB. + * + * This does not create a new instance of `Vec3`. + */ + getExtentsTo(halfExtents: oimo.common.Vec3): void; + /** + * Combines `other` into this AABB and returns `this`. + */ + combine(other: oimo.collision.geometry.Aabb): oimo.collision.geometry.Aabb; + /** + * Returns the combined aabb of `this` and `other`. + */ + combined(other: oimo.collision.geometry.Aabb): oimo.collision.geometry.Aabb; + /** + * Returns whether `this` and `other` intersect. + */ + overlap(other: oimo.collision.geometry.Aabb): boolean; + /** + * Returns the intersection of `this` and `other`. + */ + getIntersection(other: oimo.collision.geometry.Aabb): oimo.collision.geometry.Aabb; + /** + * Sets `intersection` to the intersection of `this` and `other`. + * + * This does not create a new instance of `Aabb`. + */ + getIntersectionTo(other: oimo.collision.geometry.Aabb, intersection: oimo.collision.geometry.Aabb): void; + /** + * Copies AABB from `aabb` to and returns `this`. + */ + copyFrom(aabb: oimo.collision.geometry.Aabb): oimo.collision.geometry.Aabb; + /** + * Returns a clone of the AABB. + */ + clone(): oimo.collision.geometry.Aabb; + } +} + +export namespace oimo.collision.broadphase { + /** + * A proxy is an object that can be added to a broad-phase collision detection algorithm. + * Users of the collision part of the library can move an axis-aligned bounding box of + * a proxy through `BroadPhase` class. + */ + export class Proxy { + constructor(userData: any, id: number); + _prev: oimo.collision.broadphase.Proxy; + _next: oimo.collision.broadphase.Proxy; + _aabbMinX: number; + _aabbMinY: number; + _aabbMinZ: number; + _aabbMaxX: number; + _aabbMaxY: number; + _aabbMaxZ: number; + _id: number; + /** + * Extra field that users can use for their own purposes. **Do not modify this property if + * you use the physics part of the library**, as the physics part of the library uses this property + * for connecting proxies and shapes of rigid bodies. + */ + userData: any; + /** + * Returns the unique id of the proxy. + */ + getId(): number; + /** + * Returns the fat AABB of the proxy. + */ + getFatAabb(): oimo.collision.geometry.Aabb; + /** + * Sets `aabb` to the fat AABB of the proxy. + * + * This does not create a new instance of `Aabb`. + */ + getFatAabbTo(aabb: oimo.collision.geometry.Aabb): void; + } +} + +export namespace oimo.collision.broadphase { + /** + * A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies + * as linked list of ProxyPair. + */ + export class ProxyPair { + constructor(); + _next: oimo.collision.broadphase.ProxyPair; + _p1: oimo.collision.broadphase.Proxy; + _p2: oimo.collision.broadphase.Proxy; + /** + * Returns the first proxy of the pair. + */ + getProxy1(): oimo.collision.broadphase.Proxy; + /** + * Returns the second proxy of the pair. + */ + getProxy2(): oimo.collision.broadphase.Proxy; + /** + * Returns the next pair. + */ + getNext(): oimo.collision.broadphase.ProxyPair; + } +} + +export namespace oimo.collision.broadphase { + /** + * A callback class for queries in a broad phase. + */ + export class BroadPhaseProxyCallback { + /** + * Default constructor. + */ + constructor(); + /** + * This is called every time a broad phase algorithm reports a proxy `proxy`. + */ + process(proxy: oimo.collision.broadphase.Proxy): void; + } +} + +export namespace oimo.collision.geometry { + /** + * A single ray cast hit data. + */ + export class RayCastHit { + /** + * Default constructor. + */ + constructor(); + /** + * The position the ray hit at. + */ + position: oimo.common.Vec3; + /** + * The normal vector of the surface the ray hit. + */ + normal: oimo.common.Vec3; + /** + * The ratio of the position the ray hit from the start point to the end point. + */ + fraction: number; + } +} + +export namespace oimo.collision.geometry { + /** + * Abstract class of the convex collision geometries supported by GJK/EPA collision detection. + */ + export class ConvexGeometry extends oimo.collision.geometry.Geometry { + constructor(type: number); + _gjkMargin: number; + _useGjkRayCast: boolean; + /** + * Returns the GJK mergin around the "core" of the convex geometry. + */ + getGjkMergin(): number; + /** + * Sets the GJK mergin around the "core" to `gjkMergin`. + */ + setGjkMergin(gjkMergin: number): void; + /** + * Computes supporting vertex of the "core" of the geometry in local coordinates. + * Note that the direction vector `dir` might not be normalized. `out` is set to + * the computed supporting vertex. + */ + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, transform: oimo.common.Transform, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.broadphase { + /** + * The abstract class of a broad-phase collision detection algorithm. + */ + export class BroadPhase { + constructor(type: number); + _type: number; + _numProxies: number; + _proxyList: oimo.collision.broadphase.Proxy; + _proxyListLast: oimo.collision.broadphase.Proxy; + _proxyPairList: oimo.collision.broadphase.ProxyPair; + _incremental: boolean; + _testCount: number; + /** + * Returns a new proxy connected with the user data `userData` containing the axis-aligned + * bounding box `aabb`, and adds the proxy into the collision space. + */ + createProxy(userData: any, aabb: oimo.collision.geometry.Aabb): oimo.collision.broadphase.Proxy; + /** + * Removes the proxy `proxy` from the collision space. + */ + destroyProxy(proxy: oimo.collision.broadphase.Proxy): void; + /** + * Moves the proxy `proxy` to the axis-aligned bounding box `aabb`. `displacement` is the + * difference between current and previous center of the AABB. This is used for predicting + * movement of the proxy. + */ + moveProxy(proxy: oimo.collision.broadphase.Proxy, aabb: oimo.collision.geometry.Aabb, displacement: oimo.common.Vec3): void; + /** + * Returns whether the pair of `proxy1` and `proxy2` is overlapping. As proxies can be larger + * than the containing AABBs, two proxies may overlap even though their inner AABBs are separate. + */ + isOverlapping(proxy1: oimo.collision.broadphase.Proxy, proxy2: oimo.collision.broadphase.Proxy): boolean; + /** + * Collects overlapping pairs of the proxies and put them into a linked list. The linked list + * can be get through `BroadPhase.getProxyPairList` method. + * + * Note that in order to collect pairs, the broad-phase algorithm requires to be informed of + * movements of proxies through `BroadPhase.moveProxy` method. + */ + collectPairs(): void; + /** + * Returns the linked list of collected pairs of proxies. + */ + getProxyPairList(): oimo.collision.broadphase.ProxyPair; + /** + * Returns whether to collect only pairs created in the last step. If this returns + * true, the pairs that are not collected might still be overlapping. Otherwise, such + * pairs are guaranteed to be separated. + */ + isIncremental(): boolean; + /** + * Returns the number of broad-phase AABB tests. + */ + getTestCount(): number; + /** + * Performs a ray casting. `callback.process` is called for all proxies the line segment + * from `begin` to `end` intersects. + */ + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + /** + * Performs a convex casting. `callback.process` is called for all shapes the convex geometry + * `convex` hits. The convex geometry translates by `translation` starting from the beginning + * transform `begin`. + */ + convexCast(convex: oimo.collision.geometry.ConvexGeometry, begin: oimo.common.Transform, translation: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + /** + * Performs an AABB query. `callback.process` is called for all proxies that their AABB + * and `aabb` intersect. + */ + aabbTest(aabb: oimo.collision.geometry.Aabb, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + } +} + +export namespace oimo.collision.geometry { + /** + * Abstract collision geometry. + */ + export class Geometry { + protected constructor(type: number); + _type: number; + _volume: number; + _inertiaCoeff00: number; + _inertiaCoeff01: number; + _inertiaCoeff02: number; + _inertiaCoeff10: number; + _inertiaCoeff11: number; + _inertiaCoeff12: number; + _inertiaCoeff20: number; + _inertiaCoeff21: number; + _inertiaCoeff22: number; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + /** + * Returns the type of the collision geometry. + * + * See `GeometryType` for details. + */ + getType(): number; + /** + * Returns the volume of the collision geometry. + */ + getVolume(): number; + /** + * Performs ray casting. Returns `true` and sets the result information to `hit` if + * the line segment from `begin` to `end` and the geometry transformed by `transform` + * intersect. Returns `false` if the line segment and the geometry do not intersect. + */ + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, transform: oimo.common.Transform, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.broadphase { + /** + * Types of broad-phase algorithms. + */ + export class BroadPhaseType { + protected constructor(); + static readonly _BRUTE_FORCE: number; + static readonly _BVH: number; + /** + * The brute force algorithm searches all the possible pairs of the proxies every time. + * This is **very slow** and so users should not choose this algorithm without exceptional reasons. + */ + static readonly BRUTE_FORCE: number; + /** + * The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently. + */ + static readonly BVH: number; + } +} + +export namespace oimo.collision.broadphase.bruteforce { + /** + * Brute force implementation of broad-phase collision detection. Time complexity is O(n^2). + */ + export class BruteForceBroadPhase extends oimo.collision.broadphase.BroadPhase { + constructor(); + createProxy(userData: any, aabb: oimo.collision.geometry.Aabb): oimo.collision.broadphase.Proxy; + destroyProxy(proxy: oimo.collision.broadphase.Proxy): void; + moveProxy(proxy: oimo.collision.broadphase.Proxy, aabb: oimo.collision.geometry.Aabb, dislacement: oimo.common.Vec3): void; + collectPairs(): void; + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + convexCast(convex: oimo.collision.geometry.ConvexGeometry, begin: oimo.common.Transform, translation: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + aabbTest(aabb: oimo.collision.geometry.Aabb, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * Internal class. + * + * BVH Proxy + */ + export class BvhProxy extends oimo.collision.broadphase.Proxy { + constructor(userData: any, id: number); + _leaf: oimo.collision.broadphase.bvh.BvhNode; + _moved: boolean; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * Internal class. + * + * BVH Node + */ + export class BvhNode { + constructor(); + _next: oimo.collision.broadphase.bvh.BvhNode; + _prevLeaf: oimo.collision.broadphase.bvh.BvhNode; + _nextLeaf: oimo.collision.broadphase.bvh.BvhNode; + _children: oimo.collision.broadphase.bvh.BvhNode[]; + _childIndex: number; + _parent: oimo.collision.broadphase.bvh.BvhNode; + _height: number; + _proxy: oimo.collision.broadphase.bvh.BvhProxy; + _aabbMinX: number; + _aabbMinY: number; + _aabbMinZ: number; + _aabbMaxX: number; + _aabbMaxY: number; + _aabbMaxZ: number; + _tmpX: number; + _tmpY: number; + _tmpZ: number; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * Internal class. + * + * BVH strategy for BVH tree + */ + export class BvhStrategy { + constructor(); + _insertionStrategy: number; + _balancingEnabled: boolean; + /** + * Returns the next step of leaf insertion. + * `0` or `1` to descend to corresponding child of current node. + * `-1` to stop descending and make common parent with current node. + */ + _decideInsertion(currentNode: oimo.collision.broadphase.bvh.BvhNode, leaf: oimo.collision.broadphase.bvh.BvhNode): number; + /** + * Sorts `leaves` and returns the split index `k` of the half-open interval [`from`, `until`). + * Leaves are separated into [`from`, `k`) and [`k`, `until`). + */ + _splitLeaves(leaves: oimo.collision.broadphase.bvh.BvhNode[], from: number, until: number): number; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * Internal class. + * + * BVH Tree + */ + export class BvhTree { + constructor(); + _root: oimo.collision.broadphase.bvh.BvhNode; + _numLeaves: number; + _strategy: oimo.collision.broadphase.bvh.BvhStrategy; + _print(root: oimo.collision.broadphase.bvh.BvhNode, indent?: string): void; + _getBalance(): number; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). + * Average time complexity is O(NlogN) or lower. + */ + export class BvhBroadPhase extends oimo.collision.broadphase.BroadPhase { + constructor(); + _tree: oimo.collision.broadphase.bvh.BvhTree; + createProxy(userData: any, aabb: oimo.collision.geometry.Aabb): oimo.collision.broadphase.Proxy; + destroyProxy(proxy: oimo.collision.broadphase.Proxy): void; + moveProxy(proxy: oimo.collision.broadphase.Proxy, aabb: oimo.collision.geometry.Aabb, displacement: oimo.common.Vec3): void; + collectPairs(): void; + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + convexCast(convex: oimo.collision.geometry.ConvexGeometry, begin: oimo.common.Transform, translation: oimo.common.Vec3, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + aabbTest(aabb: oimo.collision.geometry.Aabb, callback: oimo.collision.broadphase.BroadPhaseProxyCallback): void; + /** + * Returns the balance of the bounding volume tree. + */ + getTreeBalance(): number; + } +} + +export namespace oimo.collision.broadphase.bvh { + /** + * Internal class. + * + * Strategies of leaf insertion. + */ + export class BvhInsertionStrategy { + protected constructor(); + static readonly SIMPLE: number; + static readonly MINIMIZE_SURFACE_AREA: number; + } +} + +export namespace oimo.collision.geometry { + /** + * A box collision geometry. + */ + export class BoxGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a box collision geometry of half-extents `halfExtents`. + */ + constructor(halfExtents: oimo.common.Vec3); + _halfExtentsX: number; + _halfExtentsY: number; + _halfExtentsZ: number; + _halfAxisXX: number; + _halfAxisXY: number; + _halfAxisXZ: number; + _halfAxisYX: number; + _halfAxisYY: number; + _halfAxisYZ: number; + _halfAxisZX: number; + _halfAxisZY: number; + _halfAxisZZ: number; + /** + * Returns the half-extents of the box. + */ + getHalfExtents(): oimo.common.Vec3; + /** + * Sets `halfExtents` to the half-extents of the box. + */ + getHalfExtentsTo(halfExtents: oimo.common.Vec3): void; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.geometry { + /** + * A capsule collision geometry aligned with the y-axis. + */ + export class CapsuleGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a capsule collision geometry of radius `radius` and half-height `halfHeight`. + */ + constructor(radius: number, halfHeight: number); + _radius: number; + _halfHeight: number; + /** + * Returns the radius of the capsule. + */ + getRadius(): number; + /** + * Returns the half-height of the capsule. + */ + getHalfHeight(): number; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.geometry { + /** + * A cone collision geometry aligned with the y-axis. + */ + export class ConeGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a cone collision geometry of radius `radius` and half-height `halfHeight`. + */ + constructor(radius: number, halfHeight: number); + _radius: number; + _halfHeight: number; + /** + * Returns the radius of the cone. + */ + getRadius(): number; + /** + * Returns the half-height of the cone. + */ + getHalfHeight(): number; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.geometry { + /** + * A convex hull collision geometry. A convex hull of the vertices is the smallest convex + * polyhedron which contains all vertices. + */ + export class ConvexHullGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a convex hull collision geometry of the vertices `vertices`. + */ + constructor(vertices: oimo.common.Vec3[]); + _vertices: oimo.common.Vec3[]; + _tmpVertices: oimo.common.Vec3[]; + _numVertices: number; + /** + * Returns the vertices of the convex hull. + */ + getVertices(): oimo.common.Vec3[]; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + } +} + +export namespace oimo.collision.geometry { + /** + * A cylinder collision geometry aligned with the y-axis. + */ + export class CylinderGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a cylinder collision geometry of radius `radius` and half-height `halfHeight`. + */ + constructor(radius: number, halfHeight: number); + _radius: number; + _halfHeight: number; + /** + * Returns the radius of the cylinder. + */ + getRadius(): number; + /** + * Returns the half-height of the cylinder. + */ + getHalfHeight(): number; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.geometry { + /** + * The list of collision geometry types. + */ + export class GeometryType { + protected constructor(); + static readonly _SPHERE: number; + static readonly _BOX: number; + static readonly _CYLINDER: number; + static readonly _CONE: number; + static readonly _CAPSULE: number; + static readonly _CONVEX_HULL: number; + static readonly _CONVEX_MIN: number; + static readonly _CONVEX_MAX: number; + /** + * Represents a sphere collision geometry. + * + * See `SphereGeometry`. + */ + static readonly SPHERE: number; + /** + * Represents a box collision geometry. + * + * See `BoxGeometry`. + */ + static readonly BOX: number; + /** + * Represents a cylinder collision geometry. + * + * See `CylinderGeometry`. + */ + static readonly CYLINDER: number; + /** + * Represents a cone collision geometry. + * + * See `ConeGeometry`. + */ + static readonly CONE: number; + /** + * Represents a capsule collision geometry. + * + * See `CapsuleGeometry`. + */ + static readonly CAPSULE: number; + /** + * Represents a convex hull collision geometry. + * + * See `ConvexHullGeometry`. + */ + static readonly CONVEX_HULL: number; + } +} + +export namespace oimo.collision.geometry { + /** + * A sphere collision geometry. + */ + export class SphereGeometry extends oimo.collision.geometry.ConvexGeometry { + /** + * Creates a sphere collision geometry of radius `radius`. + */ + constructor(radius: number); + _radius: number; + /** + * Returns the radius of the sphere. + */ + getRadius(): number; + _updateMass(): void; + _computeAabb(aabb: oimo.collision.geometry.Aabb, tf: oimo.common.Transform): void; + computeLocalSupportingVertex(dir: oimo.common.Vec3, out: oimo.common.Vec3): void; + _rayCastLocal(beginX: number, beginY: number, beginZ: number, endX: number, endY: number, endZ: number, hit: oimo.collision.geometry.RayCastHit): boolean; + } +} + +export namespace oimo.collision.narrowphase { + /** + * The result point is a pair of the closest points of collision geometries + * detected by a collision detector. This holds relative closest points for + * each collision geometry and the amount of the overlap. + */ + export class DetectorResultPoint { + constructor(); + /** + * The first collision geometry's closest point. + */ + position1: oimo.common.Vec3; + /** + * The second collision geometry's closest point. + */ + position2: oimo.common.Vec3; + /** + * The amount of the overlap. This becomes negative if two geometries are + * separate. + */ + depth: number; + /** + * The identification of the result point. + */ + id: number; + } +} + +export namespace oimo.collision.narrowphase { + /** + * The result of narrow-phase collision detection. This is used for generating contact + * points of a contact constraint at once or incrementally. + */ + export class DetectorResult { + /** + * Default constructor. + */ + constructor(); + /** + * The number of the result points. + */ + numPoints: number; + /** + * The result points. Note that **only the first `DetectorResult.numPoints` points are + * computed by the collision detector**. + */ + points: oimo.collision.narrowphase.DetectorResultPoint[]; + /** + * The normal vector of the contact plane. + */ + normal: oimo.common.Vec3; + /** + * Whether the result points are to be used for incremental menifold update. + */ + incremental: boolean; + /** + * Returns the maximum depth of the result points. Returns `0.0` if no result + * points are available. + */ + getMaxDepth(): number; + /** + * Cleans up the result data. + */ + clear(): void; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Internal class. + */ + export class GjkCache { + constructor(); + prevClosestDir: oimo.common.Vec3; + clear(): void; + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * This is used for caching narrow-phase data of a pair of collision geometries. + */ + export class CachedDetectorData { + constructor(); + _gjkCache: oimo.collision.narrowphase.detector.gjkepa.GjkCache; + _clear(): void; + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Interface of a collision detector for narrow-phase collision detection. + */ + export class Detector { + constructor(swapped: boolean); + /** + * Computes the contact manifold of two collision geometries `geom1` and `geom2` with the transforms + * `transform1` and `transform2`, and stores it to `result`. `cachedData` is used to improve performance + * of collision detection in some detectors. + */ + detect(result: oimo.collision.narrowphase.DetectorResult, geom1: oimo.collision.geometry.Geometry, geom2: oimo.collision.geometry.Geometry, transform1: oimo.common.Transform, transform2: oimo.common.Transform, cachedData: oimo.collision.narrowphase.detector.CachedDetectorData): void; + } +} + +export namespace oimo.collision.narrowphase { + /** + * CollisionMatrix provides corresponding collision detector for a pair of + * two geometries of given types. + */ + export class CollisionMatrix { + constructor(); + /** + * Returns an appropriate collision detector of two geometries of types `geomType1` and `geomType2`. + * + * This method is **not symmetric**, so `getDetector(a, b)` may not be equal to `getDetector(b, a)`. + */ + getDetector(geomType1: number, geomType2: number): oimo.collision.narrowphase.detector.Detector; + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Box vs Box detector. + */ + export class BoxBoxDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * Default constructor. + */ + constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector { + export class BoxBoxDetectorMacro { + protected constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Capsule vs Capsule detector. + */ + export class CapsuleCapsuleDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * Default constructor. + */ + constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * General convex collision detector using GJK/EPA + */ + export class GjkEpaDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * Default constructor. + */ + constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Sphere vs Box collision detector. + */ + export class SphereBoxDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * If `swapped` is `true`, the collision detector expects `BoxGeometry` and `SphereGeometry` for the + * first and second argument of `SphereBoxDetector.detect`. If `swapped` is `false`, the collision detector expects + * `SphereGeometry` and `BoxGeometry` instead. + */ + constructor(swapped: boolean); + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Sphere vs Capsule detector. + */ + export class SphereCapsuleDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * If `swapped` is `true`, the collision detector expects `CapsuleGeometry` and `SphereGeometry` for the + * first and second argument of `SphereCapsuleDetector.detect`. If `swapped` is `false`, the collision detector expects + * `SphereGeometry` and `CapsuleGeometry` instead. + */ + constructor(swapped: boolean); + } +} + +export namespace oimo.collision.narrowphase.detector { + /** + * Sphere vs Sphere detector. + */ + export class SphereSphereDetector extends oimo.collision.narrowphase.detector.Detector { + /** + * Default constructor. + */ + constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Internal class. + */ + export class EpaTriangle { + constructor(); + _next: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + _prev: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + _vertices: oimo.collision.narrowphase.detector.gjkepa.EpaVertex[]; + _adjacentTriangles: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle[]; + _adjacentPairIndex: number[]; + _normal: oimo.common.Vec3; + _distanceSq: number; + _nextIndex: number[]; + _tmpDfsId: number; + _tmpDfsVisible: boolean; + id: number; + init(vertex1: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, vertex2: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, vertex3: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, center: oimo.common.Vec3, autoCheck?: boolean): boolean; + setAdjacentTriangle(triangle: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle): boolean; + removeAdjacentTriangles(): void; + removeReferences(): void; + dump(): void; + static count: number; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Internal class. + */ + export class EpaVertex { + constructor(); + _next: oimo.collision.narrowphase.detector.gjkepa.EpaVertex; + v: oimo.common.Vec3; + w1: oimo.common.Vec3; + w2: oimo.common.Vec3; + _tmpEdgeLoopNext: oimo.collision.narrowphase.detector.gjkepa.EpaVertex; + _tmpEdgeLoopOuterTriangle: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + randId: number; + init(v: oimo.common.Vec3, w1: oimo.common.Vec3, w2: oimo.common.Vec3): oimo.collision.narrowphase.detector.gjkepa.EpaVertex; + removeReferences(): void; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Internal class. + */ + export class EpaPolyhedron { + constructor(); + _vertices: oimo.collision.narrowphase.detector.gjkepa.EpaVertex[]; + _numVertices: number; + _triangleList: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + _triangleListLast: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + _numTriangles: number; + _trianglePool: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; + _vertexPool: oimo.collision.narrowphase.detector.gjkepa.EpaVertex; + _center: oimo.common.Vec3; + _status: number; + _init(v1: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, v2: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, v3: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, v4: oimo.collision.narrowphase.detector.gjkepa.EpaVertex): boolean; + _addVertex(vertex: oimo.collision.narrowphase.detector.gjkepa.EpaVertex, base: oimo.collision.narrowphase.detector.gjkepa.EpaTriangle): boolean; + _dumpAsObjModel(): void; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Internal class. + */ + export class EpaPolyhedronState { + protected constructor(); + static readonly OK: number; + static readonly INVALID_TRIANGLE: number; + static readonly NO_ADJACENT_PAIR_INDEX: number; + static readonly NO_ADJACENT_TRIANGLE: number; + static readonly EDGE_LOOP_BROKEN: number; + static readonly NO_OUTER_TRIANGLE: number; + static readonly TRIANGLE_INVISIBLE: number; + } +} + +export namespace oimo.common { + /** + * Setting provides advenced parameters used by the physics simulation. + */ + export class Setting { + protected constructor(); + static defaultFriction: number; + static defaultRestitution: number; + static defaultDensity: number; + static defaultCollisionGroup: number; + static defaultCollisionMask: number; + static maxTranslationPerStep: number; + static maxRotationPerStep: number; + static bvhProxyPadding: number; + static bvhIncrementalCollisionThreshold: number; + static defaultGJKMargin: number; + static enableGJKCaching: boolean; + static maxEPAVertices: number; + static maxEPAPolyhedronFaces: number; + static contactEnableBounceThreshold: number; + static velocityBaumgarte: number; + static positionSplitImpulseBaumgarte: number; + static positionNgsBaumgarte: number; + static contactUseAlternativePositionCorrectionAlgorithmDepthThreshold: number; + static defaultContactPositionCorrectionAlgorithm: number; + static alternativeContactPositionCorrectionAlgorithm: number; + static contactPersistenceThreshold: number; + static maxManifoldPoints: number; + static defaultJointConstraintSolverType: number; + static defaultJointPositionCorrectionAlgorithm: number; + static jointWarmStartingFactorForBaungarte: number; + static jointWarmStartingFactor: number; + static minSpringDamperDampingRatio: number; + static minRagdollMaxSwingAngle: number; + static maxJacobianRows: number; + static directMlcpSolverEps: number; + static islandInitialRigidBodyArraySize: number; + static islandInitialConstraintArraySize: number; + static sleepingVelocityThreshold: number; + static sleepingAngularVelocityThreshold: number; + static sleepingTimeThreshold: number; + static disableSleeping: boolean; + static linearSlop: number; + static angularSlop: number; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * GJK algorithm and EPA for narrow-phase collision detection. + */ + export class GjkEpa { + /** + * Default constructor. Consider using `GjkEpa.getInstance` instead of creating a new + * instance. + */ + constructor(); + /** + * Computed closest point of the first geometry in world coordinate system. + */ + closestPoint1: oimo.common.Vec3; + /** + * Computed closest point of the second geometry in world coordinate system. + */ + closestPoint2: oimo.common.Vec3; + /** + * Computed distance between two geometries. This value may be negative if two + * geometries are overlapping. + */ + distance: number; + /** + * Computes the closest points of two convex geometries `c1` and `c2` with transforms `tf1` and `tf2` + * respectively, and returns the status of the result (see `GjkEpaResultState` for details). If cached + * data `cache` is not `null`, this tries to exploit the previous result in `cache` to improve performance, + * and stores the new result to `cache`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + */ + computeClosestPoints(c1: oimo.collision.geometry.ConvexGeometry, c2: oimo.collision.geometry.ConvexGeometry, tf1: oimo.common.Transform, tf2: oimo.common.Transform, cache: oimo.collision.narrowphase.detector.CachedDetectorData): number; + /** + * Computes the distance between two convex geometries `c1` and `c2` with transforms `tf1` and `tf2` + * respectively, and returns the status of the result (see `GjkEpaResultState` for details). Different + * from `GjkEpa.computeClosestPoints`, this does not compute negative distances and closest points if + * two geometries are overlapping. If cached data `cache` is not `null`, this tries to exploit the + * previous result in `cache` to improve performance, and stores the new result to `cache`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + */ + computeDistance(c1: oimo.collision.geometry.ConvexGeometry, c2: oimo.collision.geometry.ConvexGeometry, tf1: oimo.common.Transform, tf2: oimo.common.Transform, cache: oimo.collision.narrowphase.detector.CachedDetectorData): number; + /** + * Performs a convex casting between `c1` and `c2`. Returns `true` and sets the result information + * to `hit` if the convex geometries intersect. Each convex geometries translates by `tl1` and `tl2`, + * starting from the beginning transforms `tf1` and `tf2` respectively. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + */ + convexCast(c1: oimo.collision.geometry.ConvexGeometry, c2: oimo.collision.geometry.ConvexGeometry, tf1: oimo.common.Transform, tf2: oimo.common.Transform, tl1: oimo.common.Vec3, tl2: oimo.common.Vec3, hit: oimo.collision.geometry.RayCastHit): boolean; + /** + * Performs ray cansting against the convex geometry `c` with transform `tf`. Returns `true` and sets + * the result information to `hit` if the line segment from `begin` to `end` intersects the convex + * geometry. Otherwise returns `false`. + * + * Set the compiler option `OIMO_GJK_EPA_DEBUG` for debugging (warning: massive logging). + */ + rayCast(c: oimo.collision.geometry.ConvexGeometry, tf: oimo.common.Transform, begin: oimo.common.Vec3, end: oimo.common.Vec3, hit: oimo.collision.geometry.RayCastHit): boolean; + /** + * Returns an instance of `GjkEpa`. + */ + static getInstance(): oimo.collision.narrowphase.detector.gjkepa.GjkEpa; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + export class GjkEpaLog { + protected constructor(); + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * The list of the state of a result of `GjkEpa.computeClosestPoints`. + */ + export class GjkEpaResultState { + protected constructor(); + static readonly _SUCCEEDED: number; + static readonly _GJK_FAILED_TO_MAKE_TETRAHEDRON: number; + static readonly _GJK_DID_NOT_CONVERGE: number; + static readonly _EPA_FAILED_TO_INIT: number; + static readonly _EPA_FAILED_TO_ADD_VERTEX: number; + static readonly _EPA_DID_NOT_CONVERGE: number; + /** + * GJK/EPA computation is successfully finished. + */ + static readonly SUCCEEDED: number; + /** + * Failed to construct a tetrahedron enclosing the origin in GJK computation. + */ + static readonly GJK_FAILED_TO_MAKE_TETRAHEDRON: number; + /** + * GJK iterations did not converge in time. + */ + static readonly GJK_DID_NOT_CONVERGE: number; + /** + * Failed to construct initial polyhedron in EPA construction. + */ + static readonly EPA_FAILED_TO_INIT: number; + /** + * Failed to add a new vertex to the polyhedron in EPA computation. + */ + static readonly EPA_FAILED_TO_ADD_VERTEX: number; + /** + * EPA iterations did not converge in time. + */ + static readonly EPA_DID_NOT_CONVERGE: number; + } +} + +export namespace oimo.collision.narrowphase.detector.gjkepa { + /** + * Simplex utilities for GJK/EPA computations. + */ + export class SimplexUtil { + protected constructor(); + /** + * Sets `out` to the minimum length point on the line (`vec1`, `vec2`) + * and returns the index of the voronoi region. + */ + static projectOrigin2(vec1: oimo.common.Vec3, vec2: oimo.common.Vec3, out: oimo.common.Vec3): number; + /** + * Sets `out` to the minimum length point on the triangle (`vec1`, `vec2`, `vec3`) + * and returns the index of the voronoi region. + */ + static projectOrigin3(vec1: oimo.common.Vec3, vec2: oimo.common.Vec3, vec3: oimo.common.Vec3, out: oimo.common.Vec3): number; + /** + * Sets `out` to the minimum length point on the tetrahedron (`vec1`, `vec2`, `vec3`, `vec4`) + * and returns the index of the voronoi region. + */ + static projectOrigin4(vec1: oimo.common.Vec3, vec2: oimo.common.Vec3, vec3: oimo.common.Vec3, vec4: oimo.common.Vec3, out: oimo.common.Vec3): number; + } +} + +export namespace oimo.common { + /** + * This class provides mathematical operations for internal purposes. + */ + export class MathUtil { + protected constructor(); + /** + * Positive infinity. + */ + static readonly POSITIVE_INFINITY: number; + /** + * Negative infinity. + */ + static readonly NEGATIVE_INFINITY: number; + /** + * The ratio of the circumference of a circle to its diameter. + */ + static readonly PI: number; + /** + * Shorthand for `PI * 2`. + */ + static readonly TWO_PI: number; + /** + * Shorthand for `PI / 2`. + */ + static readonly HALF_PI: number; + /** + * Shorthand for `PI / 180`. + */ + static readonly TO_RADIANS: number; + /** + * Shorthand for `180 / PI`. + */ + static readonly TO_DEGREES: number; + /** + * Returns the absolute value of `x`. + */ + static abs(x: number): number; + /** + * Returns `Math.sin(x)`. + */ + static sin(x: number): number; + /** + * Returns `Math.cos(x)`. + */ + static cos(x: number): number; + /** + * Returns `Math.tan(x)`. + */ + static tan(x: number): number; + /** + * Returns `Math.asin(x)`. + */ + static asin(x: number): number; + /** + * Returns `Math.acos(x)`. + */ + static acos(x: number): number; + /** + * Returns `Math.atan(x)`. + */ + static atan(x: number): number; + /** + * Returns `Math.asin(clamp(-1, x, 1))`. + * This never returns `NaN` as long as `x` is not `NaN`. + */ + static safeAsin(x: number): number; + /** + * Returns `Math.acos(clamp(-1, x, 1))`. + * This never returns `NaN` as long as `x` is not `NaN`. + */ + static safeAcos(x: number): number; + /** + * Returns `Math.atan2(y, x)` + */ + static atan2(y: number, x: number): number; + /** + * Returns `Math.sqrt(x)`. + */ + static sqrt(x: number): number; + /** + * Returns a clamped value of `x` from `min` to `max`. + */ + static clamp(x: number, min: number, max: number): number; + /** + * Returns `Math.random()`. + */ + static rand(): number; + /** + * Returns a random value from `min` inclusive to `max` exclusive. + */ + static randIn(min: number, max: number): number; + /** + * Returns a random `Vec3` from `(min, min, min)` inclusive to `(max, max, max)` exclusive. + */ + static randVec3In(min: number, max: number): oimo.common.Vec3; + /** + * Returns a random `Vec3` from `(-1.0, -1.0, -1.0)` inclusive to `(1.0, 1.0, 1.0)` exclusive. + */ + static randVec3(): oimo.common.Vec3; + } +} + +export namespace oimo.common { + /** + * The object pool system of `Vec3`, `Mat3`, `Mat4`, and `Quat`. + */ + export class Pool { + /** + * Default constructor. + */ + constructor(); + /** + * Returns a `Vec3` object. If an unused object of `Vec3` is pooled, this does + * not create a new instance. + */ + vec3(): oimo.common.Vec3; + /** + * Returns a `Mat3` object. If an unused object of `Mat3` is pooled, this does + * not create a new instance. + */ + mat3(): oimo.common.Mat3; + /** + * Returns a `Mat4` object. If an unused object of `Vec3` is pooled, this does + * not create a new instance. + */ + mat4(): oimo.common.Mat4; + /** + * Returns a `Quat` object. If an unused object of `Quat` is pooled, this does + * not create a new instance. + */ + quat(): oimo.common.Quat; + /** + * Disposes an object got from `Pool.vec3`, `Pool.mat3`, `Pool.mat4`, or `Pool.quat`. + */ + dispose(vec3?: oimo.common.Vec3, mat3?: oimo.common.Mat3, mat4?: oimo.common.Mat4, quat?: oimo.common.Quat): void; + /** + * Disposes an `Vec3` object got from `Pool.vec3`. + */ + disposeVec3(v: oimo.common.Vec3): void; + /** + * Disposes an `Mat3` object got from `Pool.mat3`. + */ + disposeMat3(m: oimo.common.Mat3): void; + /** + * Disposes an `Mat4` object got from `Pool.mat4`. + */ + disposeMat4(m: oimo.common.Mat4): void; + /** + * Disposes an `Quat` object got from `Pool.quat`. + */ + disposeQuat(q: oimo.common.Quat): void; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * A rigid body configuration is used for constructions of rigid bodies. An instance of this + * class can safely be reused, as a rigid body will not have any references to a field of + * this class. + */ + export class RigidBodyConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The world position of the rigid body's center of gravity. + */ + position: oimo.common.Vec3; + /** + * The rotation matrix of the rigid body. + */ + rotation: oimo.common.Mat3; + /** + * The initial value of the rigid body's linear velocity. + */ + linearVelocity: oimo.common.Vec3; + /** + * The initial value of the rigid body's angular velocity. + */ + angularVelocity: oimo.common.Vec3; + /** + * The rigid body's motion type. See `RigidBodyType` for details. + */ + type: number; + /** + * Whether to automatically sleep the rigid body when it stops moving + * for a certain period of time, namely `Setting.sleepingTimeThreshold`. + */ + autoSleep: boolean; + /** + * The damping coefficient of the linear velocity. Set positive values to + * gradually reduce the linear velocity. + */ + linearDamping: number; + /** + * The damping coefficient of the angular velocity. Set positive values to + * gradually reduce the angular velocity. + */ + angularDamping: number; + } +} + +export namespace oimo.dynamics.callback { + /** + * A callback class for contact events. Contact events between two shapes + * will occur in following order: + * + * 1. `beginContact` + * 1. `preSolve` (before velocity update) + * 1. `postSolve` (after velocity update) + * 1. (repeats 2. and 3. every frame while the shapes are touching) + * 1. `endContact` + */ + export class ContactCallback { + /** + * Default constructor. + */ + constructor(); + /** + * This is called when two shapes start touching each other. `c` is the contact of + * the two shapes. + */ + beginContact(c: oimo.dynamics.Contact): void; + /** + * This is called every frame **before** velocity solver iterations while two shapes + * are touching. `c` is the contact for the two shapes. + */ + preSolve(c: oimo.dynamics.Contact): void; + /** + * This is called every frame **after** velocity solver iterations while two shapes + * are touching. `c` is the contact for the two shapes. + */ + postSolve(c: oimo.dynamics.Contact): void; + /** + * This is called when two shapes end touching each other. `c` is the contact of + * the two shapes. + */ + endContact(c: oimo.dynamics.Contact): void; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * A shape configuration is used for construction of shapes. An instance of + * this class can safely be reused as a shape will not have any references + * of a field of this class. + */ + export class ShapeConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The shape's local position relative to the parent rigid body's origin. + */ + position: oimo.common.Vec3; + /** + * The shape's local rotation matrix relative to the parent rigid body's + * rotation. + */ + rotation: oimo.common.Mat3; + /** + * The coefficient of friction of the shape. + */ + friction: number; + /** + * The coefficient of restitution of the shape. + */ + restitution: number; + /** + * The density of the shape, usually in Kg/m^3. + */ + density: number; + /** + * The collision geometry of the shape. + */ + geometry: oimo.collision.geometry.Geometry; + /** + * The collision group bits the shape belongs to. This is used for collision + * filtering. + * + * Two shapes `shape1` and `shape2` will collide only if both + * `shape1.collisionGroup & shape2.collisionMask` and + * `shape2.collisionGroup & shape1.collisionMask` are not zero. + */ + collisionGroup: number; + /** + * The collision mask bits of the shape. This is used for collision + * filtering. + * + * Two shapes `shape1` and `shape2` will collide only if both + * `shape1.collisionGroup & shape2.collisionMask` and + * `shape2.collisionGroup & shape1.collisionMask` are not zero. + */ + collisionMask: number; + /** + * The contact callback of the shape. The callback methods are called + * when contact events the shape is involved occurred. + */ + contactCallback: oimo.dynamics.callback.ContactCallback; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body + * with some physical properties such as coefficients of friction and restitution. The collision + * geometry can locally be transformed relative to the parent rigid body's center of gravity. + */ + export class Shape { + /** + * Creates a new shape by configuration `config`. + */ + constructor(config: oimo.dynamics.rigidbody.ShapeConfig); + _id: number; + _prev: oimo.dynamics.rigidbody.Shape; + _next: oimo.dynamics.rigidbody.Shape; + _rigidBody: oimo.dynamics.rigidbody.RigidBody; + _geom: oimo.collision.geometry.Geometry; + _localTransform: oimo.common.Transform; + _ptransform: oimo.common.Transform; + _transform: oimo.common.Transform; + _restitution: number; + _friction: number; + _density: number; + _aabb: oimo.collision.geometry.Aabb; + _proxy: oimo.collision.broadphase.Proxy; + _collisionGroup: number; + _collisionMask: number; + _contactCallback: oimo.dynamics.callback.ContactCallback; + /** + * Extra field that users can use for their own purposes. + */ + userData: any; + /** + * Returns the coefficient of friction. + */ + getFriction(): number; + /** + * Sets the coefficient of friction to `friction`. + */ + setFriction(friction: number): void; + /** + * Returns the coefficient of restitution. + */ + getRestitution(): number; + /** + * Sets the coefficient of restitution to `restitution`. + */ + setRestitution(restitution: number): void; + /** + * Returns the transform of the shape relative to the parent rigid body's transform. + */ + getLocalTransform(): oimo.common.Transform; + /** + * Sets `transform` to the transform of the shape relative to the parent rigid body's + * transform. + * + * This does not create a new instance of `Transform`. + */ + getLocalTransformTo(transform: oimo.common.Transform): void; + /** + * Returns the world transform of the shape. + */ + getTransform(): oimo.common.Transform; + /** + * Sets `transform` to the world transform of the shape. + * + * This does not create a new instance of `Transform`. + */ + getTransformTo(transform: oimo.common.Transform): void; + /** + * Sets the shape's transform to `transform` relative to the parent rigid body's transform. + * + * This affects the parent rigid body's mass data. + */ + setLocalTransform(transform: oimo.common.Transform): void; + /** + * Returns the density of the shape. + */ + getDensity(): number; + /** + * Sets the density of the shape to `density`. + * + * This affects the parent rigid body's mass data. + */ + setDensity(density: number): void; + /** + * Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a + * parent rigid body. + */ + getAabb(): oimo.collision.geometry.Aabb; + /** + * Sets `aabb` to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a + * parent rigid body. + * + * This does not create a new instance of `AABB`. + */ + getAabbTo(aabb: oimo.collision.geometry.Aabb): void; + /** + * Returns the colision geometry of the shape. + */ + getGeometry(): oimo.collision.geometry.Geometry; + /** + * Returns the parent rigid body. This returns `null` if the shape doesn't have a parent + * rigid body. + */ + getRigidBody(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the collision group bits the shape belongs to. + */ + getCollisionGroup(): number; + /** + * Sets the shape's collision group bits to `collisionGroup`. + */ + setCollisionGroup(collisionGroup: number): void; + /** + * Returns the collision mask bits of the shape. + */ + getCollisionMask(): number; + /** + * Sets the shape's collision mask bits to `collisionMask`. + */ + setCollisionMask(collisionMask: number): void; + /** + * Returns the contact callback of the shape. + */ + getContactCallback(): oimo.dynamics.callback.ContactCallback; + /** + * Sets the contact callback of the shape to `callback`. + */ + setContactCallback(callback: oimo.dynamics.callback.ContactCallback): void; + /** + * Returns the previous shape in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.rigidbody.Shape; + /** + * Returns the next shape in the rigid body. + * + * If the next one does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.rigidbody.Shape; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A joint configuration is used for constructions of various joints. + * An instance of any kind of the joint configurations can safely be reused. + */ + export class JointConfig { + constructor(); + /** + * The first rigid body attached to the joint. + */ + rigidBody1: oimo.dynamics.rigidbody.RigidBody; + /** + * The second rigid body attached to the joint. + */ + rigidBody2: oimo.dynamics.rigidbody.RigidBody; + /** + * The local position of the first rigid body's anchor point. + */ + localAnchor1: oimo.common.Vec3; + /** + * The local position of the second rigid body's anchor point. + */ + localAnchor2: oimo.common.Vec3; + /** + * Whether to allow the connected rigid bodies to collide each other. + */ + allowCollision: boolean; + /** + * The type of the constraint solver for the joint. + * + * See `ConstraintSolverType` for details. + */ + solverType: number; + /** + * The type of the position correction algorithm for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + */ + positionCorrectionAlgorithm: number; + /** + * The joint will be destroyed when magnitude of the constraint force exceeds the value. + * + * Set `0` for unbreakable joints. + */ + breakForce: number; + /** + * The joint will be destroyed when magnitude of the constraint torque exceeds the value. + * + * Set `0` for unbreakable joints. + */ + breakTorque: number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A joint link is used to build a constraint graph for clustering rigid bodies. + * In a constraint graph, rigid bodies are nodes and constraints are edges. + * See also `ContactLink`. + */ + export class JointLink { + constructor(joint: oimo.dynamics.constraint.joint.Joint); + _prev: oimo.dynamics.constraint.joint.JointLink; + _next: oimo.dynamics.constraint.joint.JointLink; + _joint: oimo.dynamics.constraint.joint.Joint; + _other: oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the contact the rigid body is attached to. + */ + getContact(): oimo.dynamics.constraint.joint.Joint; + /** + * Returns the other rigid body attached to the constraint. This provides a quick access + * from a rigid body to the other one attached to the constraint. + */ + getOther(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the previous joint link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.constraint.joint.JointLink; + /** + * Returns the next joint link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.constraint.joint.JointLink; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * Internal class. + */ + export class JointImpulse { + constructor(); + impulse: number; + impulseM: number; + impulseP: number; + } +} + +export namespace oimo.dynamics { + /** + * Information of time-step sizes of the simulation. + */ + export class TimeStep { + constructor(); + /** + * The time step of simulation. + */ + dt: number; + /** + * The inverse time step of simulation, equivalent to simulation FPS. + */ + invDt: number; + /** + * The ratio of time steps. Defined by current time step divided by previous + * time step. + */ + dtRatio: number; + } +} + +export namespace oimo.dynamics.constraint { + /** + * The base class of all constarint solvers. + */ + export class ConstraintSolver { + constructor(); + _b1: oimo.dynamics.rigidbody.RigidBody; + _b2: oimo.dynamics.rigidbody.RigidBody; + _addedToIsland: boolean; + /** + * Prepares for velocity iteration. Time step information `timeStep` is given for + * computing time-depending data. + */ + preSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + /** + * Applies initial impulses. + */ + warmStart(timeStep: oimo.dynamics.TimeStep): void; + /** + * Performs single velocity iteration. + */ + solveVelocity(): void; + /** + * Performs post-processes of velocity part. Time step information `timeStep` is given + * for computing time-depending data. + */ + postSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + /** + * Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step + * information `timeStep` is given for computing time-depending data. + * + * This may not be called depending on position correction algorithm. + */ + preSolvePosition(timeStep: oimo.dynamics.TimeStep): void; + /** + * Performs single position iteration (split impulse) + */ + solvePositionSplitImpulse(): void; + /** + * Performs single position iteration (nonlinear Gauss-Seidel) + */ + solvePositionNgs(timeStep: oimo.dynamics.TimeStep): void; + /** + * Performs post-processes. + */ + postSolve(): void; + } +} + +export namespace oimo.dynamics.constraint.info { + /** + * The row of a Jacobian matrix. + */ + export class JacobianRow { + constructor(); + lin1X: number; + lin1Y: number; + lin1Z: number; + lin2X: number; + lin2Y: number; + lin2Z: number; + ang1X: number; + ang1Y: number; + ang1Z: number; + ang2X: number; + ang2Y: number; + ang2Z: number; + updateSparsity(): void; + } +} + +export namespace oimo.dynamics.constraint.info.joint { + /** + * Internal class. + */ + export class JointSolverInfoRow { + constructor(); + /** + * Used for both velocity and position solver. + */ + jacobian: oimo.dynamics.constraint.info.JacobianRow; + /** + * Used for both velocity and position solver. + */ + rhs: number; + /** + * Used for velocity solver. + */ + cfm: number; + /** + * Used for both velocity and position solver. + */ + minImpulse: number; + /** + * Used for both velocity and position solver. + */ + maxImpulse: number; + /** + * Used for velocity solver. + */ + motorSpeed: number; + /** + * Used for velocity solver. + */ + motorMaxImpulse: number; + /** + * Used for both velocity and position solver. + */ + impulse: oimo.dynamics.constraint.joint.JointImpulse; + } +} + +export namespace oimo.dynamics.constraint.info.joint { + /** + * Internal class. + */ + export class JointSolverInfo { + constructor(); + b1: oimo.dynamics.rigidbody.RigidBody; + b2: oimo.dynamics.rigidbody.RigidBody; + numRows: number; + rows: oimo.dynamics.constraint.info.joint.JointSolverInfoRow[]; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * The base class of joints. Joints are used to connect two rigid bodies + * in various ways. See `JointType` for all types of joints. + */ + export class Joint { + constructor(config: oimo.dynamics.constraint.joint.JointConfig, type: number); + _b1: oimo.dynamics.rigidbody.RigidBody; + _b2: oimo.dynamics.rigidbody.RigidBody; + _link1: oimo.dynamics.constraint.joint.JointLink; + _link2: oimo.dynamics.constraint.joint.JointLink; + _positionCorrectionAlgorithm: number; + _allowCollision: boolean; + _prev: oimo.dynamics.constraint.joint.Joint; + _next: oimo.dynamics.constraint.joint.Joint; + _world: oimo.dynamics.World; + _localAnchor1X: number; + _localAnchor1Y: number; + _localAnchor1Z: number; + _localAnchor2X: number; + _localAnchor2Y: number; + _localAnchor2Z: number; + _relativeAnchor1X: number; + _relativeAnchor1Y: number; + _relativeAnchor1Z: number; + _relativeAnchor2X: number; + _relativeAnchor2Y: number; + _relativeAnchor2Z: number; + _anchor1X: number; + _anchor1Y: number; + _anchor1Z: number; + _anchor2X: number; + _anchor2Y: number; + _anchor2Z: number; + _localBasisX1X: number; + _localBasisX1Y: number; + _localBasisX1Z: number; + _localBasisY1X: number; + _localBasisY1Y: number; + _localBasisY1Z: number; + _localBasisZ1X: number; + _localBasisZ1Y: number; + _localBasisZ1Z: number; + _localBasisX2X: number; + _localBasisX2Y: number; + _localBasisX2Z: number; + _localBasisY2X: number; + _localBasisY2Y: number; + _localBasisY2Z: number; + _localBasisZ2X: number; + _localBasisZ2Y: number; + _localBasisZ2Z: number; + _basisX1X: number; + _basisX1Y: number; + _basisX1Z: number; + _basisY1X: number; + _basisY1Y: number; + _basisY1Z: number; + _basisZ1X: number; + _basisZ1Y: number; + _basisZ1Z: number; + _basisX2X: number; + _basisX2Y: number; + _basisX2Z: number; + _basisY2X: number; + _basisY2Y: number; + _basisY2Z: number; + _basisZ2X: number; + _basisZ2Y: number; + _basisZ2Z: number; + _impulses: oimo.dynamics.constraint.joint.JointImpulse[]; + _appliedForceX: number; + _appliedForceY: number; + _appliedForceZ: number; + _appliedTorqueX: number; + _appliedTorqueY: number; + _appliedTorqueZ: number; + _breakForce: number; + _breakTorque: number; + _type: number; + _solver: oimo.dynamics.constraint.ConstraintSolver; + /** + * Extra field that users can use for their own purposes. + */ + userData: any; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _checkDestruction(): void; + /** + * Returns the first rigid body. + */ + getRigidBody1(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the second rigid body. + */ + getRigidBody2(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the type of the joint. + * + * See `JointType` for details. + */ + getType(): number; + /** + * Returns the first rigid body's anchor point in world coordinates. + */ + getAnchor1(): oimo.common.Vec3; + /** + * Returns the second rigid body's anchor point in world coordinates. + */ + getAnchor2(): oimo.common.Vec3; + /** + * Sets `anchor` to the first rigid body's anchor point in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAnchor1To(anchor: oimo.common.Vec3): void; + /** + * Sets `anchor` to the second rigid body's anchor point in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAnchor2To(anchor: oimo.common.Vec3): void; + /** + * Returns the first rigid body's local anchor point in world coordinates. + */ + getLocalAnchor1(): oimo.common.Vec3; + /** + * Returns the second rigid body's local anchor point in world coordinates. + */ + getLocalAnchor2(): oimo.common.Vec3; + /** + * Sets `localAnchor` to the first rigid body's anchor point in local coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAnchor1To(localAnchor: oimo.common.Vec3): void; + /** + * Sets `localAnchor` to the second rigid body's anchor point in local coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAnchor2To(localAnchor: oimo.common.Vec3): void; + /** + * Returns the basis of the joint for the first rigid body in world coordinates. + */ + getBasis1(): oimo.common.Mat3; + /** + * Returns the basis of the joint for the second rigid body in world coordinates. + */ + getBasis2(): oimo.common.Mat3; + /** + * Sets `basis` to the basis of the joint for the first rigid body in world coordinates. + * + * This does not create a new instance of `Mat3`. + */ + getBasis1To(basis: oimo.common.Mat3): void; + /** + * Sets `basis` to the basis of the joint for the second rigid body in world coordinates. + * + * This does not create a new instance of `Mat3`. + */ + getBasis2To(basis: oimo.common.Mat3): void; + /** + * Returns whether to allow the connected rigid bodies to collide each other. + */ + getAllowCollision(): boolean; + /** + * Sets whether to allow the connected rigid bodies to collide each other. + */ + setAllowCollision(allowCollision: boolean): void; + /** + * Returns the magnitude of the constraint force at which the joint will be destroyed. + * + * Returns `0` if the joint is unbreakable. + */ + getBreakForce(): number; + /** + * Sets the magnitude of the constraint force at which the joint will be destroyed. + * + * Set `0` for unbreakable joints. + */ + setBreakForce(breakForce: number): void; + /** + * Returns the magnitude of the constraint torque at which the joint will be destroyed. + * + * Returns `0` if the joint is unbreakable. + */ + getBreakTorque(): number; + /** + * Sets the magnitude of the constraint force at which the joint will be destroyed. + * + * Set `0` for unbreakable joints. + */ + setBreakTorque(breakTorque: number): void; + /** + * Returns the type of the position correction algorithm for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + */ + getPositionCorrectionAlgorithm(): number; + /** + * Sets the type of the position correction algorithm to `positionCorrectionAlgorithm` for the joint. + * + * See `PositionCorrectionAlgorithm` for details. + */ + setPositionCorrectionAlgorithm(positionCorrectionAlgorithm: number): void; + /** + * Returns the force applied to the first rigid body at the last time step. + */ + getAppliedForce(): oimo.common.Vec3; + /** + * Sets `appliedForce` to the force applied to the first rigid body at the last time step. + * + * This does not create a new instance of `Vec3`. + */ + getAppliedForceTo(appliedForce: oimo.common.Vec3): void; + /** + * Returns the torque applied to the first rigid body at the last time step. + */ + getAppliedTorque(): oimo.common.Vec3; + /** + * Sets `appliedTorque` to the torque applied to the first rigid body at the last time step. + * + * This does not create a new instance of `Vec3`. + */ + getAppliedTorqueTo(appliedTorque: oimo.common.Vec3): void; + /** + * Returns the previous joint in the world. + * + * If the previous one does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.constraint.joint.Joint; + /** + * Returns the next joint in the world. + * + * If the next one does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.constraint.joint.Joint; + } +} + +export namespace oimo.dynamics { + /** + * The manager of the contacts in the physics world. A contact of two + * shapes is created when the AABBs of them begin overlapping, and + * is destroyed when they end overlapping. + */ + export class ContactManager { + constructor(broadPhase: oimo.collision.broadphase.BroadPhase); + _numContacts: number; + _contactList: oimo.dynamics.Contact; + _contactListLast: oimo.dynamics.Contact; + _contactPool: oimo.dynamics.Contact; + _broadPhase: oimo.collision.broadphase.BroadPhase; + _collisionMatrix: oimo.collision.narrowphase.CollisionMatrix; + _updateContacts(): void; + _postSolve(): void; + /** + * Returns the number of the contacts in the world. + */ + getNumContacts(): number; + /** + * Returns the linked list of the contacts in the world. + */ + getContactList(): oimo.dynamics.Contact; + } +} + +export namespace oimo.dynamics.callback { + /** + * A callback class for ray casts in a world. + */ + export class RayCastCallback { + /** + * Default constructor. + */ + constructor(); + /** + * This is called every time the world detects a shape `shape` that + * the ray intersects with the hit data `hit`. + */ + process(shape: oimo.dynamics.rigidbody.Shape, hit: oimo.collision.geometry.RayCastHit): void; + } +} + +export namespace oimo.dynamics.callback { + /** + * A callback interface for aabb tests in a world. + */ + export class AabbTestCallback { + /** + * Default constructor. + */ + constructor(); + /** + * This is called every time the world detects a shape `shape` that + * the query aabb intersects. + */ + process(shape: oimo.dynamics.rigidbody.Shape): void; + } +} + +export namespace oimo.dynamics { + /** + * The physics simulation world. This manages entire the dynamic simulation. You can add + * rigid bodies and joints to the world to simulate them. + */ + export class World { + /** + * Creates a new physics world, with broad-phase collision detection algorithm `broadPhaseType` and + * gravitational acceleration `gravity`. + */ + constructor(broadPhaseType?: number, gravity?: oimo.common.Vec3); + _rigidBodyList: oimo.dynamics.rigidbody.RigidBody; + _rigidBodyListLast: oimo.dynamics.rigidbody.RigidBody; + _jointList: oimo.dynamics.constraint.joint.Joint; + _jointListLast: oimo.dynamics.constraint.joint.Joint; + _broadPhase: oimo.collision.broadphase.BroadPhase; + _contactManager: oimo.dynamics.ContactManager; + _numRigidBodies: number; + _numJoints: number; + _numShapes: number; + _numIslands: number; + _numVelocityIterations: number; + _numPositionIterations: number; + _gravity: oimo.common.Vec3; + /** + * Advances the simulation by the time step `timeStep`. + */ + step(timeStep: number): void; + /** + * Adds the rigid body `rigidBody` to the simulation world. + */ + addRigidBody(rigidBody: oimo.dynamics.rigidbody.RigidBody): void; + /** + * Removes the rigid body `rigidBody` from the simulation world. + */ + removeRigidBody(rigidBody: oimo.dynamics.rigidbody.RigidBody): void; + /** + * Adds the joint `joint` to the simulation world. + */ + addJoint(joint: oimo.dynamics.constraint.joint.Joint): void; + /** + * Removes the joint `joint` from the simulation world. + */ + removeJoint(joint: oimo.dynamics.constraint.joint.Joint): void; + /** + * Sets the debug draw interface to `debugDraw`. Call `World.debugDraw` to draw the simulation world. + */ + setDebugDraw(debugDraw: oimo.dynamics.common.DebugDraw): void; + /** + * Returns the debug draw interface. + */ + getDebugDraw(): oimo.dynamics.common.DebugDraw; + /** + * Draws the simulation world for debugging. Call `World.setDebugDraw` to set the debug draw interface. + */ + debugDraw(): void; + /** + * Performs a ray casting. `callback.process` is called for all shapes the ray + * from `begin` to `end` hits. + */ + rayCast(begin: oimo.common.Vec3, end: oimo.common.Vec3, callback: oimo.dynamics.callback.RayCastCallback): void; + /** + * Performs a convex casting. `callback.process` is called for all shapes the convex geometry + * `convex` hits. The convex geometry translates by `translation` starting from the beginning + * transform `begin`. + */ + convexCast(convex: oimo.collision.geometry.ConvexGeometry, begin: oimo.common.Transform, translation: oimo.common.Vec3, callback: oimo.dynamics.callback.RayCastCallback): void; + /** + * Performs an AABB query. `callback.process` is called for all shapes that their + * AABB and `aabb` intersect. + */ + aabbTest(aabb: oimo.collision.geometry.Aabb, callback: oimo.dynamics.callback.AabbTestCallback): void; + /** + * Returns the list of the rigid bodies added to the world. + */ + getRigidBodyList(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the list of the joints added to the world. + */ + getJointList(): oimo.dynamics.constraint.joint.Joint; + /** + * Returns the broad-phase collision detection algorithm. + */ + getBroadPhase(): oimo.collision.broadphase.BroadPhase; + /** + * Returns the contact manager. + */ + getContactManager(): oimo.dynamics.ContactManager; + /** + * Returns the number of the rigid bodies added to the world. + */ + getNumRigidBodies(): number; + /** + * Returns the number of the joints added to the world. + */ + getNumJoints(): number; + /** + * Returns the number of the shapes added to the world. + */ + getNumShapes(): number; + /** + * Returns the number of simulation islands. + */ + getNumIslands(): number; + /** + * Returns the number of velocity iterations of constraint solvers. + */ + getNumVelocityIterations(): number; + /** + * Sets the number of velocity iterations of constraint solvers to `numVelocityIterations`. + */ + setNumVelocityIterations(numVelocityIterations: number): void; + /** + * Returns the number of position iterations of constraint solvers. + */ + getNumPositionIterations(): number; + /** + * Sets the number of position iterations of constraint solvers to `numPositionIterations`. + */ + setNumPositionIterations(numPositionIterations: number): void; + /** + * Returns the gravitational acceleration of the simulation world. + */ + getGravity(): oimo.common.Vec3; + /** + * Sets the gravitational acceleration of the simulation world to `gravity`. + */ + setGravity(gravity: oimo.common.Vec3): void; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * This class holds mass and moment of inertia for a rigid body. + */ + export class MassData { + /** + * Default constructor. + */ + constructor(); + /** + * Mass. `0` for a non-dynamic rigid body. + */ + mass: number; + /** + * Inertia tensor in local space. Zero matrix for a non-dynamic rigid body. + */ + localInertia: oimo.common.Mat3; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * A rigid body. To add a rigid body to a physics world, create a `RigidBody` + * instance, create and add shapes via `RigidBody.addShape`, and add the rigid + * body to the physics world through `World.addRigidBody`. Rigid bodies have + * three motion types: dynamic, static, and kinematic. See `RigidBodyType` for + * details of motion types. + */ + export class RigidBody { + /** + * Creates a new rigid body by configuration `config`. + */ + constructor(config: oimo.dynamics.rigidbody.RigidBodyConfig); + _next: oimo.dynamics.rigidbody.RigidBody; + _prev: oimo.dynamics.rigidbody.RigidBody; + _shapeList: oimo.dynamics.rigidbody.Shape; + _shapeListLast: oimo.dynamics.rigidbody.Shape; + _numShapes: number; + _velX: number; + _velY: number; + _velZ: number; + _angVelX: number; + _angVelY: number; + _angVelZ: number; + _pseudoVelX: number; + _pseudoVelY: number; + _pseudoVelZ: number; + _angPseudoVelX: number; + _angPseudoVelY: number; + _angPseudoVelZ: number; + _ptransform: oimo.common.Transform; + _transform: oimo.common.Transform; + _type: number; + _sleepTime: number; + _sleeping: boolean; + _autoSleep: boolean; + _mass: number; + _invMass: number; + _localInertia00: number; + _localInertia01: number; + _localInertia02: number; + _localInertia10: number; + _localInertia11: number; + _localInertia12: number; + _localInertia20: number; + _localInertia21: number; + _localInertia22: number; + _rotFactor: oimo.common.Vec3; + _invLocalInertia00: number; + _invLocalInertia01: number; + _invLocalInertia02: number; + _invLocalInertia10: number; + _invLocalInertia11: number; + _invLocalInertia12: number; + _invLocalInertia20: number; + _invLocalInertia21: number; + _invLocalInertia22: number; + _invLocalInertiaWithoutRotFactor00: number; + _invLocalInertiaWithoutRotFactor01: number; + _invLocalInertiaWithoutRotFactor02: number; + _invLocalInertiaWithoutRotFactor10: number; + _invLocalInertiaWithoutRotFactor11: number; + _invLocalInertiaWithoutRotFactor12: number; + _invLocalInertiaWithoutRotFactor20: number; + _invLocalInertiaWithoutRotFactor21: number; + _invLocalInertiaWithoutRotFactor22: number; + _invInertia00: number; + _invInertia01: number; + _invInertia02: number; + _invInertia10: number; + _invInertia11: number; + _invInertia12: number; + _invInertia20: number; + _invInertia21: number; + _invInertia22: number; + _linearDamping: number; + _angularDamping: number; + _forceX: number; + _forceY: number; + _forceZ: number; + _torqueX: number; + _torqueY: number; + _torqueZ: number; + _linearContactImpulseX: number; + _linearContactImpulseY: number; + _linearContactImpulseZ: number; + _angularContactImpulseX: number; + _angularContactImpulseY: number; + _angularContactImpulseZ: number; + _world: oimo.dynamics.World; + _contactLinkList: oimo.dynamics.ContactLink; + _contactLinkListLast: oimo.dynamics.ContactLink; + _numContactLinks: number; + _jointLinkList: oimo.dynamics.constraint.joint.JointLink; + _jointLinkListLast: oimo.dynamics.constraint.joint.JointLink; + _numJointLinks: number; + _addedToIsland: boolean; + _gravityScale: number; + /** + * Extra field that users can use for their own purposes. + */ + userData: any; + _integrate(dt: number): void; + _integratePseudoVelocity(): void; + /** + * Returns the world position of the rigid body. + */ + getPosition(): oimo.common.Vec3; + /** + * Sets `position` to the world position of the rigid body. + * + * This does not create a new instance of `Vec3`. + */ + getPositionTo(position: oimo.common.Vec3): void; + /** + * Sets the world position of the rigid body to `position`. + */ + setPosition(position: oimo.common.Vec3): void; + /** + * Translates the position of the rigid body by `translation`. + */ + translate(translation: oimo.common.Vec3): void; + /** + * Returns the rotation matrix of the rigid body. + */ + getRotation(): oimo.common.Mat3; + /** + * Sets `rotation` to the rotation matrix of the rigid body. + * + * This does not create a new instance of `Mat3`. + */ + getRotationTo(rotation: oimo.common.Mat3): void; + /** + * Sets the rotation matrix of the rigid body to `rotation`. + */ + setRotation(rotation: oimo.common.Mat3): void; + /** + * Sets the rotation of the rigid body by Euler angles `eulerAngles` in radians. + */ + setRotationXyz(eulerAngles: oimo.common.Vec3): void; + /** + * Rotates the rigid body by the rotation matrix `rotation`. + */ + rotate(rotation: oimo.common.Mat3): void; + /** + * Rotates the rigid body by Euler angles `eulerAngles` in radians. + */ + rotateXyz(eulerAngles: oimo.common.Vec3): void; + /** + * Returns the rotation of the rigid body as a quaternion. + */ + getOrientation(): oimo.common.Quat; + /** + * Sets `orientation` to the rotation quaternion of the rigid body. + * + * This does not create a new instance of `Quat`. + */ + getOrientationTo(orientation: oimo.common.Quat): void; + /** + * Sets the rotation of the rigid body from a quaternion `quaternion`. + */ + setOrientation(quaternion: oimo.common.Quat): void; + /** + * Returns the transform of the rigid body. + */ + getTransform(): oimo.common.Transform; + /** + * Sets `transform` to the transform of the rigid body. + * + * This does not create a new instance of `Transform`. + */ + getTransformTo(transform: oimo.common.Transform): void; + /** + * Sets the transform of the rigid body to `transform`. + * + * This does not keep any references to `transform`. + */ + setTransform(transform: oimo.common.Transform): void; + /** + * Returns the mass of the rigid body. + * + * If the rigid body has infinite mass, `0` will be returned. + */ + getMass(): number; + /** + * Returns the moment of inertia tensor in local space. + */ + getLocalInertia(): oimo.common.Mat3; + /** + * Sets `inertia` to the moment of inertia tensor in local space. + * + * This does not create a new instance of `Mat3` + */ + getLocalInertiaTo(inertia: oimo.common.Mat3): void; + /** + * Returns the mass data of the rigid body. + */ + getMassData(): oimo.dynamics.rigidbody.MassData; + /** + * Sets `massData` to the mass data of the rigid body. + * + * This does not create a new instance of `MassData`. + */ + getMassDataTo(massData: oimo.dynamics.rigidbody.MassData): void; + /** + * Sets the mass and moment of inertia of the rigid body by the mass data `massData`. + * The properties set by this will be overwritten when + * + * - some shapes are added or removed + * - the type of the rigid body is changed + */ + setMassData(massData: oimo.dynamics.rigidbody.MassData): void; + /** + * Returns the rotation factor of the rigid body. + */ + getRotationFactor(): oimo.common.Vec3; + /** + * Sets the rotation factor of the rigid body to `rotationFactor`. + * + * This changes moment of inertia internally, so that the change of + * angular velocity in **global space** along X, Y and Z axis will scale by `rotationFactor.x`, + * `rotationFactor.y` and `rotationFactor.z` times respectively. + */ + setRotationFactor(rotationFactor: oimo.common.Vec3): void; + /** + * Returns the linear velocity of the rigid body. + */ + getLinearVelocity(): oimo.common.Vec3; + /** + * Sets `linearVelocity` to the linear velocity of the rigid body. + * + * This does not create a new intrance of `Vec3`. + */ + getLinearVelocityTo(linearVelocity: oimo.common.Vec3): void; + /** + * Sets the linear velocity of the rigid body. + */ + setLinearVelocity(linearVelocity: oimo.common.Vec3): void; + /** + * Returns the angular velocity of the rigid body. + */ + getAngularVelocity(): oimo.common.Vec3; + /** + * Sets `angularVelocity` to the angular velocity of the rigid body. + * + * This does not create a new intrance of `Vec3`. + */ + getAngularVelocityTo(angularVelocity: oimo.common.Vec3): void; + /** + * Sets the angular velocity of the rigid body. + */ + setAngularVelocity(angularVelocity: oimo.common.Vec3): void; + /** + * Adds `linearVelocityChange` to the linear velcity of the rigid body. + */ + addLinearVelocity(linearVelocityChange: oimo.common.Vec3): void; + /** + * Adds `angularVelocityChange` to the angular velcity of the rigid body. + */ + addAngularVelocity(angularVelocityChange: oimo.common.Vec3): void; + /** + * Applies the impulse `impulse` to the rigid body at `positionInWorld` in world position. + * + * This changes both the linear velocity and the angular velocity. + */ + applyImpulse(impulse: oimo.common.Vec3, positionInWorld: oimo.common.Vec3): void; + /** + * Applies the linear impulse `impulse` to the rigid body. + * + * This does not change the angular velocity. + */ + applyLinearImpulse(impulse: oimo.common.Vec3): void; + /** + * Applies the angular impulse `impulse` to the rigid body. + * + * This does not change the linear velocity. + */ + applyAngularImpulse(impulse: oimo.common.Vec3): void; + /** + * Applies the force `force` to `positionInWorld` in world position. + */ + applyForce(force: oimo.common.Vec3, positionInWorld: oimo.common.Vec3): void; + /** + * Applies the force `force` to the center of mass. + */ + applyForceToCenter(force: oimo.common.Vec3): void; + /** + * Applies the torque `torque`. + */ + applyTorque(torque: oimo.common.Vec3): void; + /** + * Returns the total linear impulse applied by contact constraints. + */ + getLinearContactImpulse(): oimo.common.Vec3; + /** + * Sets `linearContactImpulse` to the total linear impulse applied by contact constraints. + * + * This does not create a new instance of `Vec3`. + */ + getLinearContactImpulseTo(linearContactImpulse: oimo.common.Vec3): void; + /** + * Returns the total angular impulse applied by contact constraints. + */ + getAngularContactImpulse(): oimo.common.Vec3; + /** + * Sets `angularContactImpulse` to the total angular impulse applied by contact constraints. + * + * This does not create a new instance of `Vec3`. + */ + getAngularContactImpulseTo(angularContactImpulse: oimo.common.Vec3): void; + /** + * Returns the gravity scaling factor of the rigid body. + */ + getGravityScale(): number; + /** + * Sets the gravity scaling factor of the rigid body to `gravityScale`. + * + * If `0` is set, the rigid body will not be affected by gravity. + */ + setGravityScale(gravityScale: number): void; + /** + * Returns the local coordinates of the point `worldPoint` in world coodinates. + */ + getLocalPoint(worldPoint: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets `localPoint` to the local coordinates of the point `worldPoint` in world coodinates. + * + * This does not create a new instance of `Vec3`. + */ + getLocalPointTo(worldPoint: oimo.common.Vec3, localPoint: oimo.common.Vec3): void; + /** + * Returns the local coordinates of the vector `worldVector` in world coodinates. + */ + getLocalVector(worldVector: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets `localVector` to the local coordinates of the vector `worldVector` in world coodinates. + * + * This does not create a new instance of `Vec3`. + */ + getLocalVectorTo(worldVector: oimo.common.Vec3, localVector: oimo.common.Vec3): void; + /** + * Returns the world coordinates of the point `localPoint` in local coodinates. + */ + getWorldPoint(localPoint: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets `worldPoint` to the world coordinates of the point `localPoint` in local coodinates. + * + * This does not create a new instance of `Vec3`. + */ + getWorldPointTo(localPoint: oimo.common.Vec3, worldPoint: oimo.common.Vec3): void; + /** + * Returns the world coordinates of the vector `localVector` in local coodinates. + */ + getWorldVector(localVector: oimo.common.Vec3): oimo.common.Vec3; + /** + * Sets `worldVector` to the world coordinates of the vector `localVector` in local coodinates. + * + * This does not create a new instance of `Vec3`. + */ + getWorldVectorTo(localVector: oimo.common.Vec3, worldVector: oimo.common.Vec3): void; + /** + * Returns the number of the shapes added. + */ + getNumShapes(): number; + /** + * Returns the list of the shapes of the rigid body. + */ + getShapeList(): oimo.dynamics.rigidbody.Shape; + /** + * Returns the number of the contact lists the rigid body is involved. + */ + getNumContectLinks(): number; + /** + * Returns the list of the contact links the rigid body is involved. + */ + getContactLinkList(): oimo.dynamics.ContactLink; + /** + * Returns the number of the joint links the rigid body is attached. + */ + getNumJointLinks(): number; + /** + * Returns the list of the joint links the rigid body is attached. + */ + getJointLinkList(): oimo.dynamics.constraint.joint.JointLink; + /** + * Adds the shape to the rigid body. + */ + addShape(shape: oimo.dynamics.rigidbody.Shape): void; + /** + * Removes the shape from the rigid body. + */ + removeShape(shape: oimo.dynamics.rigidbody.Shape): void; + /** + * Returns the rigid body's type of behaviour. + * + * See `RigidBodyType` class for details. + */ + getType(): number; + /** + * Sets the rigid body's type of behaviour. + * + * See `RigidBodyType` class for details. + */ + setType(type: number): void; + /** + * Sets the rigid body's sleep flag false. + * + * This also resets the sleeping timer of the rigid body. + */ + wakeUp(): void; + /** + * Sets the rigid body's sleep flag true. + * + * This also resets the sleeping timer of the rigid body. + */ + sleep(): void; + /** + * Returns whether the rigid body is sleeping. + */ + isSleeping(): boolean; + /** + * Returns how long the rigid body is stopping moving. This returns `0` if the body + * has already slept. + */ + getSleepTime(): number; + /** + * Sets the rigid body's auto sleep flag. + * + * If auto sleep is enabled, the rigid body will automatically sleep when needed. + */ + setAutoSleep(autoSleepEnabled: boolean): void; + /** + * Returns the linear damping. + */ + getLinearDamping(): number; + /** + * Sets the linear damping to `damping`. + */ + setLinearDamping(damping: number): void; + /** + * Returns the angular damping. + */ + getAngularDamping(): number; + /** + * Sets the angular damping to `damping`. + */ + setAngularDamping(damping: number): void; + /** + * Returns the previous rigid body in the world. + * + * If the previous one does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the next rigid body in the world. + * + * If the next one does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.rigidbody.RigidBody; + } +} + +export namespace oimo.dynamics { + /** + * A contact link is used to build a constraint graph for clustering rigid bodies. + * In a constraint graph, rigid bodies are nodes and constraints are edges. + * See also `JointLink`. + */ + export class ContactLink { + constructor(); + _prev: oimo.dynamics.ContactLink; + _next: oimo.dynamics.ContactLink; + _contact: oimo.dynamics.Contact; + _other: oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the contact of the link. + */ + getContact(): oimo.dynamics.Contact; + /** + * Returns the other rigid body of the link. This provides a quick access from a + * rigid body to the other one of the contact. + */ + getOther(): oimo.dynamics.rigidbody.RigidBody; + /** + * Returns the previous contact link in the rigid body. + * + * If the previous one does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.ContactLink; + /** + * Returns the next contact link in the rigid body. + * + * If the next one does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.ContactLink; + } +} + +export namespace oimo.dynamics.constraint.contact { + /** + * Internal class. + */ + export class ContactImpulse { + constructor(); + impulseN: number; + impulseT: number; + impulseB: number; + impulseP: number; + impulseLX: number; + impulseLY: number; + impulseLZ: number; + copyFrom(imp: oimo.dynamics.constraint.contact.ContactImpulse): void; + } +} + +export namespace oimo.dynamics.constraint.contact { + /** + * A manifold point is a contact point in a contact manifold. This holds detailed collision + * data (position, overlap depth, impulse, etc...) for collision response. + */ + export class ManifoldPoint { + constructor(); + _localPos1X: number; + _localPos1Y: number; + _localPos1Z: number; + _localPos2X: number; + _localPos2Y: number; + _localPos2Z: number; + _relPos1X: number; + _relPos1Y: number; + _relPos1Z: number; + _relPos2X: number; + _relPos2Y: number; + _relPos2Z: number; + _pos1X: number; + _pos1Y: number; + _pos1Z: number; + _pos2X: number; + _pos2Y: number; + _pos2Z: number; + _depth: number; + _impulse: oimo.dynamics.constraint.contact.ContactImpulse; + _warmStarted: boolean; + _disabled: boolean; + _id: number; + /** + * Returns the first rigid body's manifold point in world coordinate. + */ + getPosition1(): oimo.common.Vec3; + /** + * Sets `position` to the first rigid body's manifold point in world coordinate. + * This does not create a new instance of `Vec3`. + */ + getPosition1To(position: oimo.common.Vec3): void; + /** + * Returns the second rigid body's manifold point in world coordinate. + */ + getPosition2(): oimo.common.Vec3; + /** + * Sets `position` to the second rigid body's manifold point in world coordinate. + * This does not create a new instance of `Vec3`. + */ + getPosition2To(position: oimo.common.Vec3): void; + /** + * Returns the amount of the overlap. If the manifold point is separate, a negative + * value is returned. + */ + getDepth(): number; + /** + * Returns whether the manifold point has existed for more than two steps. + */ + isWarmStarted(): boolean; + /** + * Returns the normal impulse of the manifold point. + */ + getNormalImpulse(): number; + /** + * Returns the tangent impulse of the manifold point. + */ + getTangentImpulse(): number; + /** + * Returns the binormal impulse of the manifold point. + */ + getBinormalImpulse(): number; + /** + * Returns whether the manifold point is enabled. + */ + isEnabled(): boolean; + } +} + +export namespace oimo.dynamics.constraint.contact { + /** + * A contact manifold holds collision data of a pair of shapes. + */ + export class Manifold { + constructor(); + _normalX: number; + _normalY: number; + _normalZ: number; + _tangentX: number; + _tangentY: number; + _tangentZ: number; + _binormalX: number; + _binormalY: number; + _binormalZ: number; + _numPoints: number; + _points: oimo.dynamics.constraint.contact.ManifoldPoint[]; + _clear(): void; + _buildBasis(normal: oimo.common.Vec3): void; + _updateDepthsAndPositions(tf1: oimo.common.Transform, tf2: oimo.common.Transform): void; + /** + * Returns the normal vector of the contact manifold. The normal vector has unit + * length and is perpendicular to the contact plane. + */ + getNormal(): oimo.common.Vec3; + /** + * Sets `normal` to the normal vector of the contact manifold. The normal vector has + * unit length and is perpendicular to the contact plane. + * + * This does not create a new instance of `Vec3`. + */ + getNormalTo(normal: oimo.common.Vec3): void; + /** + * Returns the tangent vector of the contact manifold. The tangent vector has unit + * length and is perpendicular to the normal vector. + */ + getTangent(): oimo.common.Vec3; + /** + * Sets `tangent` to the tangent vector of the contact manifold. The tangent vector has + * unit length and is perpendicular to the normal vector. + * + * This does not create a new instance of `Vec3`. + */ + getTangentTo(tangent: oimo.common.Vec3): void; + /** + * Returns the binormal vector of the contact manifold. The binormal vector has unit + * length and is perpendicular to both the normal and the tangent vector. + */ + getBinormal(): oimo.common.Vec3; + /** + * Sets `binormal` to the binormal vector of the contact manifold. The binormal vector has + * unit length and is perpendicular to both the normal and the tangent vector. + * + * This does not create a new instance of `Vec3`. + */ + getBinormalTo(binormal: oimo.common.Vec3): void; + /** + * Returns the manifold point vector of the contact manifold. Note that **only the first + * `Manifold.getNumPoints` elements of the vector are in use**, and the manifold points may + * be disabled (see `ManifoldPoint.isEnabled`). + */ + getPoints(): oimo.dynamics.constraint.contact.ManifoldPoint[]; + /** + * Returns the number of existing manifold points. + */ + getNumPoints(): number; + } +} + +export namespace oimo.dynamics.constraint.contact { + /** + * Internal class + */ + export class ManifoldUpdater { + constructor(manifold: oimo.dynamics.constraint.contact.Manifold); + totalUpdate(result: oimo.collision.narrowphase.DetectorResult, tf1: oimo.common.Transform, tf2: oimo.common.Transform): void; + incrementalUpdate(result: oimo.collision.narrowphase.DetectorResult, tf1: oimo.common.Transform, tf2: oimo.common.Transform): void; + } +} + +export namespace oimo.dynamics.constraint.info.contact { + /** + * Internal class. + */ + export class ContactSolverInfoRow { + constructor(); + /** + * Used for both velocity and position solver. + */ + jacobianN: oimo.dynamics.constraint.info.JacobianRow; + /** + * Used for velocity solver. + */ + jacobianT: oimo.dynamics.constraint.info.JacobianRow; + /** + * Used for velocity solver. + */ + jacobianB: oimo.dynamics.constraint.info.JacobianRow; + /** + * Used for both velocity and position solver. + */ + rhs: number; + /** + * Used for velocity solver. + */ + cfm: number; + /** + * Used for velocity solver. + */ + friction: number; + /** + * Used for both velocity and position solver. + */ + impulse: oimo.dynamics.constraint.contact.ContactImpulse; + } +} + +export namespace oimo.dynamics.constraint.info.contact { + /** + * Internal class. + */ + export class ContactSolverInfo { + constructor(); + b1: oimo.dynamics.rigidbody.RigidBody; + b2: oimo.dynamics.rigidbody.RigidBody; + numRows: number; + rows: oimo.dynamics.constraint.info.contact.ContactSolverInfoRow[]; + } +} + +export namespace oimo.dynamics.constraint.contact { + /** + * A contact constraint provides collision information for a contact constraint solver. + * This holds a contact manifold, which has some contact points, contact normals, and + * contact impulses. See `Manifold` for more information. + */ + export class ContactConstraint { + constructor(manifold: oimo.dynamics.constraint.contact.Manifold); + _positionCorrectionAlgorithm: number; + _manifold: oimo.dynamics.constraint.contact.Manifold; + _s1: oimo.dynamics.rigidbody.Shape; + _s2: oimo.dynamics.rigidbody.Shape; + _tf1: oimo.common.Transform; + _tf2: oimo.common.Transform; + _invM1: number; + _invM2: number; + _friction: number; + _restitution: number; + _invI100: number; + _invI101: number; + _invI102: number; + _invI110: number; + _invI111: number; + _invI112: number; + _invI120: number; + _invI121: number; + _invI122: number; + _invI200: number; + _invI201: number; + _invI202: number; + _invI210: number; + _invI211: number; + _invI212: number; + _invI220: number; + _invI221: number; + _invI222: number; + _b1: oimo.dynamics.rigidbody.RigidBody; + _b2: oimo.dynamics.rigidbody.RigidBody; + _solver: oimo.dynamics.constraint.ConstraintSolver; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.contact.ContactSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.contact.ContactSolverInfo): void; + _syncManifold(): void; + /** + * Returns the first shape of the contact. + */ + getShape1(): oimo.dynamics.rigidbody.Shape; + /** + * Returns the second shape of the contact. + */ + getShape2(): oimo.dynamics.rigidbody.Shape; + /** + * Returns the contact manifold. + */ + getManifold(): oimo.dynamics.constraint.contact.Manifold; + /** + * Returns whether the two rigid bodies are touching. + */ + isTouching(): boolean; + } +} + +export namespace oimo.dynamics { + /** + * A contact is a cached pair of overlapping shapes in the physics world. contacts + * are created by `ContactManager` when two AABBs of shapes begin overlapping. + * + * As AABBs are larger than its shapes, shapes of a contact don't always + * touching or colliding though their AABBs are overlapping. + */ + export class Contact { + constructor(); + _next: oimo.dynamics.Contact; + _prev: oimo.dynamics.Contact; + _link1: oimo.dynamics.ContactLink; + _link2: oimo.dynamics.ContactLink; + _s1: oimo.dynamics.rigidbody.Shape; + _s2: oimo.dynamics.rigidbody.Shape; + _b1: oimo.dynamics.rigidbody.RigidBody; + _b2: oimo.dynamics.rigidbody.RigidBody; + _detector: oimo.collision.narrowphase.detector.Detector; + _cachedDetectorData: oimo.collision.narrowphase.detector.CachedDetectorData; + _detectorResult: oimo.collision.narrowphase.DetectorResult; + _latest: boolean; + _shouldBeSkipped: boolean; + _manifold: oimo.dynamics.constraint.contact.Manifold; + _updater: oimo.dynamics.constraint.contact.ManifoldUpdater; + _contactConstraint: oimo.dynamics.constraint.contact.ContactConstraint; + _touching: boolean; + _updateManifold(): void; + _postSolve(): void; + /** + * Returns the first shape of the contact. + */ + getShape1(): oimo.dynamics.rigidbody.Shape; + /** + * Returns the second shape of the contact. + */ + getShape2(): oimo.dynamics.rigidbody.Shape; + /** + * Returns whether the shapes are touching. + */ + isTouching(): boolean; + /** + * Returns the contact manifold. + */ + getManifold(): oimo.dynamics.constraint.contact.Manifold; + /** + * Returns the contact constraint. + */ + getContactConstraint(): oimo.dynamics.constraint.contact.ContactConstraint; + /** + * Returns the previous contact in the world. + * + * If the previous contact does not exist, `null` will be returned. + */ + getPrev(): oimo.dynamics.Contact; + /** + * Returns the next contact in the world. + * + * If the next contact does not exist, `null` will be returned. + */ + getNext(): oimo.dynamics.Contact; + } +} + +export namespace oimo.dynamics { + /** + * Simulation island. + */ + export class Island { + constructor(); + _clear(): void; + _addRigidBody(rigidBody: oimo.dynamics.rigidbody.RigidBody): void; + _addConstraintSolver(solver: oimo.dynamics.constraint.ConstraintSolver, positionCorrection: number): void; + _stepSingleRigidBody(timeStep: oimo.dynamics.TimeStep, rb: oimo.dynamics.rigidbody.RigidBody): void; + _step(timeStep: oimo.dynamics.TimeStep, numVelocityIterations: number, numPositionIterations: number): void; + } +} + +export namespace oimo.dynamics.callback { + /** + * A ray cast callback implementation that keeps only the closest hit data. + * This is reusable, but make sure to clear the old result by calling + * `RayCastClosest.clear` if used once or more before. + */ + export class RayCastClosest extends oimo.dynamics.callback.RayCastCallback { + /** + * Default constructor. + */ + constructor(); + /** + * The shape the ray hit. + */ + shape: oimo.dynamics.rigidbody.Shape; + /** + * The position the ray hit at. + */ + position: oimo.common.Vec3; + /** + * The normal vector of the surface the ray hit. + */ + normal: oimo.common.Vec3; + /** + * The ratio of the position the ray hit from the start point to the end point. + */ + fraction: number; + /** + * Whether the ray hit any shape in the world. + */ + hit: boolean; + /** + * Clears the result data. + */ + clear(): void; + process(shape: oimo.dynamics.rigidbody.Shape, hit: oimo.collision.geometry.RayCastHit): void; + } +} + +export namespace oimo.dynamics.common { + /** + * Performance + */ + export class Performance { + protected constructor(); + static broadPhaseCollisionTime: number; + static narrowPhaseCollisionTime: number; + static dynamicsTime: number; + static totalTime: number; + } +} + +export namespace oimo.dynamics.constraint { + /** + * The list of the algorithms for position corretion. + */ + export class PositionCorrectionAlgorithm { + protected constructor(); + static readonly _BAUMGARTE: number; + static readonly _SPLIT_IMPULSE: number; + static readonly _NGS: number; + /** + * Baumgarte stabilizaiton. Fastest but introduces extra energy. + */ + static readonly BAUMGARTE: number; + /** + * Use split impulse and pseudo velocity. Fast enough and does not introduce extra + * energy, but somewhat unstable, especially for joints. + */ + static readonly SPLIT_IMPULSE: number; + /** + * Nonlinear Gauss-Seidel method. Slow but stable. + */ + static readonly NGS: number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * Internal class + */ + export class BasisTracker { + constructor(joint: oimo.dynamics.constraint.joint.Joint); + xX: number; + xY: number; + xZ: number; + yX: number; + yY: number; + yZ: number; + zX: number; + zY: number; + zZ: number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * Translational limits and motor settings of a joint. + */ + export class TranslationalLimitMotor { + /** + * Default constructor. + */ + constructor(); + /** + * The lower bound of the limit in usually meters. + * + * The limit is disabled if `lowerLimit > upperLimit`. + */ + lowerLimit: number; + /** + * The upper bound of the limit in usually meters. + * + * The limit is disabled if `lowerLimit > upperLimit`. + */ + upperLimit: number; + /** + * The target speed of the motor in usually meters per second. + */ + motorSpeed: number; + /** + * The maximum force of the motor in usually newtons. + * + * The motor is disabled if `motorForce <= 0`. + */ + motorForce: number; + /** + * Sets limit properties at once and returns `this`. + * `this.lowerLimit` is set to `lower`, and `this.upperLimit` is set to `upper`. + */ + setLimits(lower: number, upper: number): oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * Sets motor properties at once and returns `this`. + * `this.motorSpeed` is set to `speed`, and `this.motorForce` is set to `force`. + */ + setMotor(speed: number, force: number): oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * Returns a clone of the object. + */ + clone(): oimo.dynamics.constraint.joint.TranslationalLimitMotor; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * Spring and damper settings of a joint. + */ + export class SpringDamper { + /** + * Default constructor. + */ + constructor(); + /** + * The frequency of the spring in Hz. + * Set `0.0` to disable the spring and make the constraint totally rigid. + */ + frequency: number; + /** + * The damping ratio of the constraint. + * Set `1.0` to make the constraint critically dumped. + */ + dampingRatio: number; + /** + * Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. + * Note that symplectic Euler method conserves energy better than implicit Euler method does, but the constraint will be + * unstable under the high frequency. + */ + useSymplecticEuler: boolean; + /** + * Sets spring and damper parameters at once and returns `this`. + * `this.frequency` is set to `frequency`, and `this.dampingRatio` is set to `dampingRatio`. + */ + setSpring(frequency: number, dampingRatio: number): oimo.dynamics.constraint.joint.SpringDamper; + setSymplecticEuler(useSymplecticEuler: boolean): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns a clone of the object. + */ + clone(): oimo.dynamics.constraint.joint.SpringDamper; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * Rotational limits and motor settings of a joint. + */ + export class RotationalLimitMotor { + /** + * Default constructor. + */ + constructor(); + /** + * The lower bound of the limit in radians. + * + * The limit is disabled if `lowerLimit > upperLimit`. + */ + lowerLimit: number; + /** + * The upper bound of the limit in radians. + * + * The limit is disabled if `lowerLimit > upperLimit`. + */ + upperLimit: number; + /** + * The target speed of the motor in usually radians per second. + */ + motorSpeed: number; + /** + * The maximum torque of the motor in usually newton meters. + * + * The motor is disabled if `motorTorque <= 0`. + */ + motorTorque: number; + /** + * Sets limit properties at once and returns `this`. + * `this.lowerLimit` is set to `lower`, and `this.upperLimit` is set to `upper`. + */ + setLimits(lower: number, upper: number): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Sets motor properties at once and returns `this`. + * `this.motorSpeed` is set to `speed`, and `this.motorTorque` is set to `torque`. + */ + setMotor(speed: number, torque: number): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns a clone of the object. + */ + clone(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A cylindrical joint config is used for constructions of cylindrical joints. + */ + export class CylindricalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local constraint axis. + */ + localAxis1: oimo.common.Vec3; + /** + * The second body's local constraint axis. + */ + localAxis2: oimo.common.Vec3; + /** + * The translational limit and motor along the constraint axis of the joint. + */ + translationalLimitMotor: oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * The translational spring and damper along constraint the axis of the joint. + */ + translationalSpringDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The rotational limit and motor along the constraint axis of the joint. + */ + rotationalLimitMotor: oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * The rotational spring and damper along the constraint axis of the joint. + */ + rotationalSpringDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldAxis: oimo.common.Vec3): oimo.dynamics.constraint.joint.CylindricalJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A cylindrical joint constrains two rigid bodies to share their constraint + * axes, and restricts relative translation and rotation onto the constraint + * axis. This joint provides two degrees of freedom. You can enable lower and + * upper limits, motors, spring and damper effects of both translation and + * rotation part of the constraint. + */ + export class CylindricalJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new cylindrical joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.CylindricalJointConfig); + _translSd: oimo.dynamics.constraint.joint.SpringDamper; + _translLm: oimo.dynamics.constraint.joint.TranslationalLimitMotor; + _rotSd: oimo.dynamics.constraint.joint.SpringDamper; + _rotLm: oimo.dynamics.constraint.joint.RotationalLimitMotor; + _basis: oimo.dynamics.constraint.joint.BasisTracker; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first rigid body's constraint axis in world coordinates. + */ + getAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis in world coordinates. + */ + getAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the translational spring and damper settings. + */ + getTranslationalSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the rotational spring and damper settings. + */ + getRotationalSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the translational limits and motor settings. + */ + getTranslationalLimitMotor(): oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * Returns the rotational limits and motor settings. + */ + getRotationalLimitMotor(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns the rotation angle in radians. + */ + getAngle(): number; + /** + * Returns the translation of the joint. + */ + getTranslation(): number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A generic joint config is used for constructions of generic joints. + */ + export class GenericJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local constraint basis. + */ + localBasis1: oimo.common.Mat3; + /** + * The second body's local constraint basis. + */ + localBasis2: oimo.common.Mat3; + /** + * The translational limits and motors along the first body's the constraint basis. + */ + translationalLimitMotors: oimo.dynamics.constraint.joint.TranslationalLimitMotor[]; + /** + * The translational springs and dampers along the first body's constraint basis. + */ + translationalSpringDampers: oimo.dynamics.constraint.joint.SpringDamper[]; + /** + * The rotational limits and motors along the rotation axes of the relative x-y-z Euler angles. + */ + rotationalLimitMotors: oimo.dynamics.constraint.joint.RotationalLimitMotor[]; + /** + * The rotational springs and dampers along the rotation axes of the relative x-y-z Euler angles. + */ + rotationalSpringDampers: oimo.dynamics.constraint.joint.SpringDamper[]; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local bases + * from the world bases `worldBasis1` and `worldBasis2`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldBasis1: oimo.common.Mat3, worldBasis2: oimo.common.Mat3): oimo.dynamics.constraint.joint.GenericJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in + * highly flexible way, so that every translational and rotational axis + * can be locked, unlocked, springy, or powered by a motor like other + * joints. Note that rotation angles are measured as x-y-z Euler angles, + * not as z-x-z Euler angles. + */ + export class GenericJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new generic joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.GenericJointConfig); + _translSds: oimo.dynamics.constraint.joint.SpringDamper[]; + _rotSds: oimo.dynamics.constraint.joint.SpringDamper[]; + _translLms: oimo.dynamics.constraint.joint.TranslationalLimitMotor[]; + _rotLms: oimo.dynamics.constraint.joint.RotationalLimitMotor[]; + _axisXX: number; + _axisXY: number; + _axisXZ: number; + _axisYX: number; + _axisYY: number; + _axisYZ: number; + _axisZX: number; + _axisZY: number; + _axisZZ: number; + _angleX: number; + _angleY: number; + _angleZ: number; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first (x) rotation axis of the relative Euler angles. + */ + getAxisX(): oimo.common.Vec3; + /** + * Returns the second (y) rotation axis of the relative Euler angles. + */ + getAxisY(): oimo.common.Vec3; + /** + * Returns the third (z) rotation axis of the relative Euler angles. + */ + getAxisZ(): oimo.common.Vec3; + /** + * Returns the translational spring and damper settings along the first body's constraint basis. + */ + getTranslationalSpringDampers(): oimo.dynamics.constraint.joint.SpringDamper[]; + /** + * Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles. + */ + getRotationalSpringDampers(): oimo.dynamics.constraint.joint.SpringDamper[]; + /** + * Returns the translational limits and motor settings along the first body's constraint basis. + */ + getTranslationalLimitMotors(): oimo.dynamics.constraint.joint.TranslationalLimitMotor[]; + /** + * Returns the rotational limits and motor settings along the rotation axes of the relative x-y-z Euler angles. + */ + getRotationalLimitMotors(): oimo.dynamics.constraint.joint.RotationalLimitMotor[]; + /** + * Returns the relative x-y-z Euler angles. + */ + getAngles(): oimo.common.Vec3; + /** + * Returns the translations along the first rigid body's constraint basis. + */ + getTranslations(): oimo.common.Vec3; + } +} + +export namespace oimo.dynamics.constraint.joint { + export class JointMacro { + protected constructor(); + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * The list of the types of the joints. + */ + export class JointType { + protected constructor(); + static readonly _SPHERICAL: number; + static readonly _REVOLUTE: number; + static readonly _CYLINDRICAL: number; + static readonly _PRISMATIC: number; + static readonly _UNIVERSAL: number; + static readonly _RAGDOLL: number; + static readonly _GENERIC: number; + /** + * Represents a spherical joint. + * + * See `SphericalJoint` for details. + */ + static readonly SPHERICAL: number; + /** + * Represents a revolute joint. + * + * See `RevoluteJoint` for details. + */ + static readonly REVOLUTE: number; + /** + * Represents a cylindrical joint. + * + * See `CylindricalJoint` for details. + */ + static readonly CYLINDRICAL: number; + /** + * Represents a prismatic joint. + * + * See `PrismaticJoint` for details. + */ + static readonly PRISMATIC: number; + /** + * Represents a universal joint. + * + * See `UniversalJoint` for details. + */ + static readonly UNIVERSAL: number; + /** + * Represents a ragdoll joint. + * + * See `RagdollJoint` for details. + */ + static readonly RAGDOLL: number; + /** + * Represents a generic joint. + * + * See `GenericJoint` for details. + */ + static readonly GENERIC: number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A prismatic joint config is used for constructions of prismatic joints. + */ + export class PrismaticJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local constraint axis. + */ + localAxis1: oimo.common.Vec3; + /** + * The second body's local constraint axis. + */ + localAxis2: oimo.common.Vec3; + /** + * The translational limit and motor along the constraint axis of the joint. + */ + limitMotor: oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * The translational spring and damper along the constraint axis of the joint. + */ + springDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldAxis: oimo.common.Vec3): oimo.dynamics.constraint.joint.PrismaticJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to + * share their anchor points and constraint axes, and restricts relative + * translation onto the constraint axis. This joint provides one degree of + * freedom. You can enable lower and upper limits, a motor, a spring and + * damper effect of the translational part of the constraint. + */ + export class PrismaticJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new prismatic joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.PrismaticJointConfig); + _sd: oimo.dynamics.constraint.joint.SpringDamper; + _lm: oimo.dynamics.constraint.joint.TranslationalLimitMotor; + _basis: oimo.dynamics.constraint.joint.BasisTracker; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first rigid body's constraint axis in world coordinates. + */ + getAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis in world coordinates. + */ + getAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the translational spring and damper settings. + */ + getSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the translational limits and motor settings. + */ + getLimitMotor(): oimo.dynamics.constraint.joint.TranslationalLimitMotor; + /** + * Returns the translation of the joint. + */ + getTranslation(): number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A ragdoll joint config is used for constructions of ragdoll joints. + */ + export class RagdollJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local twist axis. + */ + localTwistAxis1: oimo.common.Vec3; + /** + * The second body's local twist axis. + */ + localTwistAxis2: oimo.common.Vec3; + /** + * The first body's local swing axis. + * + * The second swing axis is also attached to the first body. It is perpendicular to the first swing + * axis, and is automatically computed when the joint is created. + */ + localSwingAxis1: oimo.common.Vec3; + /** + * The rotational spring and damper along the twist axis of the joint. + */ + twistSpringDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The rotational limit and motor along the twist axis of the joint. + */ + twistLimitMotor: oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * The rotational spring and damper along the swing axis of the joint. + */ + swingSpringDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The max angle of rotation along the first swing axis. + * This value must be positive. + */ + maxSwingAngle1: number; + /** + * The max angle of rotation along the second swing axis. + * This value must be positive. + */ + maxSwingAngle2: number; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local twist axes + * from the world twist axis `worldTwistAxis`, local swing axis from the world swing axis + * `worldSwingAxis`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldTwistAxis: oimo.common.Vec3, worldSwingAxis: oimo.common.Vec3): oimo.dynamics.constraint.joint.RagdollJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A ragdoll joint is designed to simulate ragdoll's limbs. It constrains + * swing and twist angles between two rigid bodies. The two rigid bodies + * have constraint axes, and the swing angle is defined by the angle of + * two constraint axes, while the twist angle is defined by the rotation + * angle along the two axes. In addition to lower and upper limits of the + * twist angle, You can set an "elliptic cone limit" of the swing angle + * by specifying two swing axes (though one of them is automatically + * computed) and corresponding maximum swing angles. You can also enable a + * motor of the twist part of the constraint, spring and damper effect of + * the both swing and twist part of the constraint. + */ + export class RagdollJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new ragdoll joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.RagdollJointConfig); + _twistSd: oimo.dynamics.constraint.joint.SpringDamper; + _swingSd: oimo.dynamics.constraint.joint.SpringDamper; + _twistLm: oimo.dynamics.constraint.joint.RotationalLimitMotor; + _maxSwingAngle1: number; + _maxSwingAngle2: number; + _swingAngle: number; + _twistAngle: number; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first rigid body's constraint axis in world coordinates. + */ + getAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis in world coordinates. + */ + getAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the rotational spring and damper settings along the twist axis. + */ + getTwistSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the rotational limits and motor settings along the twist axis. + */ + getTwistLimitMotor(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns the rotational spring and damper settings along the swing axis. + */ + getSwingSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the swing axis in world coordinates. + */ + getSwingAxis(): oimo.common.Vec3; + /** + * Sets `axis` to the swing axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getSwingAxisTo(axis: oimo.common.Vec3): void; + /** + * Returns the swing angle in radians. + */ + getSwingAngle(): number; + /** + * Returns the twist angle in radians. + */ + getTwistAngle(): number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A revolute joint config is used for constructions of revolute joints. + */ + export class RevoluteJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local constraint axis. + */ + localAxis1: oimo.common.Vec3; + /** + * The second body's local constraint axis. + */ + localAxis2: oimo.common.Vec3; + /** + * The rotational spring and damper settings. + */ + springDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The rotational limits and motor settings. + */ + limitMotor: oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axis `worldAxis`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldAxis: oimo.common.Vec3): oimo.dynamics.constraint.joint.RevoluteJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share + * their anchor points and constraint axes, and restricts relative rotation onto + * the constraint axis. This joint provides one degree of freedom. You can enable + * lower and upper limits, a motor, a spring and damper effect of the rotational + * part of the constraint. + */ + export class RevoluteJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new revolute joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.RevoluteJointConfig); + _sd: oimo.dynamics.constraint.joint.SpringDamper; + _lm: oimo.dynamics.constraint.joint.RotationalLimitMotor; + _basis: oimo.dynamics.constraint.joint.BasisTracker; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first rigid body's constraint axis in world coordinates. + */ + getAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis in world coordinates. + */ + getAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the rotational spring and damper settings. + */ + getSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the rotational limits and motor settings. + */ + getLimitMotor(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns the rotation angle in radians. + */ + getAngle(): number; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A spherical joint config is used for constructions of spherical joints. + */ + export class SphericalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The spring and damper setting of the joint. + */ + springDamper: oimo.dynamics.constraint.joint.SpringDamper; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3): oimo.dynamics.constraint.joint.SphericalJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share + * their anchor points. This joint provides three degrees of freedom. You can enable a + * spring and damper effect of the constraint. + */ + export class SphericalJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new spherical joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.SphericalJointConfig); + _sd: oimo.dynamics.constraint.joint.SpringDamper; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the spring and damper settings. + */ + getSpringDamper(): oimo.dynamics.constraint.joint.SpringDamper; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A universal joint config is used for constructions of universal joints. + */ + export class UniversalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + /** + * Default constructor. + */ + constructor(); + /** + * The first body's local constraint axis. + */ + localAxis1: oimo.common.Vec3; + /** + * The second body's local constraint axis. + */ + localAxis2: oimo.common.Vec3; + /** + * The rotational spring and damper along the first body's constraint axis. + */ + springDamper1: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The rotational spring and damper along the second body's constraint axis. + */ + springDamper2: oimo.dynamics.constraint.joint.SpringDamper; + /** + * The rotational limit and motor along the first body's constraint axis. + */ + limitMotor1: oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * The rotational limit and motor along the second body's constraint axis. + */ + limitMotor2: oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Sets rigid bodies, local anchors from the world anchor `worldAnchor`, local axes + * from the world axes `worldAxis1` and `worldAxis2`, and returns `this`. + */ + init(rigidBody1: oimo.dynamics.rigidbody.RigidBody, rigidBody2: oimo.dynamics.rigidbody.RigidBody, worldAnchor: oimo.common.Vec3, worldAxis1: oimo.common.Vec3, worldAxis2: oimo.common.Vec3): oimo.dynamics.constraint.joint.UniversalJointConfig; + } +} + +export namespace oimo.dynamics.constraint.joint { + /** + * A universal joint constrains two rigid bodies' constraint axes to be perpendicular + * to each other. Rigid bodies can rotate along their constraint axes, but cannot along + * the direction perpendicular to two constraint axes. This joint provides two degrees + * of freedom. You can enable lower and upper limits, motors, spring and damper effects + * of the two rotational constraints. + */ + export class UniversalJoint extends oimo.dynamics.constraint.joint.Joint { + /** + * Creates a new universal joint by configuration `config`. + */ + constructor(config: oimo.dynamics.constraint.joint.UniversalJointConfig); + _sd1: oimo.dynamics.constraint.joint.SpringDamper; + _sd2: oimo.dynamics.constraint.joint.SpringDamper; + _lm1: oimo.dynamics.constraint.joint.RotationalLimitMotor; + _lm2: oimo.dynamics.constraint.joint.RotationalLimitMotor; + _axisXX: number; + _axisXY: number; + _axisXZ: number; + _axisYX: number; + _axisYY: number; + _axisYZ: number; + _axisZX: number; + _axisZY: number; + _axisZZ: number; + _angleX: number; + _angleY: number; + _angleZ: number; + _syncAnchors(): void; + _getVelocitySolverInfo(timeStep: oimo.dynamics.TimeStep, info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + _getPositionSolverInfo(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + /** + * Returns the first rigid body's constraint axis in world coordinates. + */ + getAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis in world coordinates. + */ + getAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis in world coordinates. + * + * This does not create a new instance of `Vec3`. + */ + getAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the first rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis1(): oimo.common.Vec3; + /** + * Returns the second rigid body's constraint axis relative to the rigid body's transform. + */ + getLocalAxis2(): oimo.common.Vec3; + /** + * Sets `axis` to the first rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis1To(axis: oimo.common.Vec3): void; + /** + * Sets `axis` to the second rigid body's constraint axis relative to the rigid body's transform. + * + * This does not create a new instance of `Vec3`. + */ + getLocalAxis2To(axis: oimo.common.Vec3): void; + /** + * Returns the rotational spring and damper settings along the first body's constraint axis. + */ + getSpringDamper1(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the rotational spring and damper settings along the second body's constraint axis. + */ + getSpringDamper2(): oimo.dynamics.constraint.joint.SpringDamper; + /** + * Returns the rotational limits and motor settings along the first body's constraint axis. + */ + getLimitMotor1(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns the rotational limits and motor settings along the second body's constraint axis. + */ + getLimitMotor2(): oimo.dynamics.constraint.joint.RotationalLimitMotor; + /** + * Returns the rotation angle along the first body's constraint axis. + */ + getAngle1(): number; + /** + * Returns the rotation angle along the second body's constraint axis. + */ + getAngle2(): number; + } +} + +export namespace oimo.dynamics.constraint.solver { + /** + * The list of the constraint solvers. + */ + export class ConstraintSolverType { + protected constructor(); + static readonly _ITERATIVE: number; + static readonly _DIRECT: number; + /** + * Iterative constraint solver. Fast and stable enough for common usages. + */ + static readonly ITERATIVE: number; + /** + * Direct constraint solver. Very stable but not suitable for a situation where fast + * computation is required. + */ + static readonly DIRECT: number; + } +} + +export namespace oimo.dynamics.constraint.solver.common { + /** + * Internal class. + */ + export class ContactSolverMassDataRow { + constructor(); + invMLinN1X: number; + invMLinN1Y: number; + invMLinN1Z: number; + invMLinN2X: number; + invMLinN2Y: number; + invMLinN2Z: number; + invMAngN1X: number; + invMAngN1Y: number; + invMAngN1Z: number; + invMAngN2X: number; + invMAngN2Y: number; + invMAngN2Z: number; + invMLinT1X: number; + invMLinT1Y: number; + invMLinT1Z: number; + invMLinT2X: number; + invMLinT2Y: number; + invMLinT2Z: number; + invMAngT1X: number; + invMAngT1Y: number; + invMAngT1Z: number; + invMAngT2X: number; + invMAngT2Y: number; + invMAngT2Z: number; + invMLinB1X: number; + invMLinB1Y: number; + invMLinB1Z: number; + invMLinB2X: number; + invMLinB2Y: number; + invMLinB2Z: number; + invMAngB1X: number; + invMAngB1Y: number; + invMAngB1Z: number; + invMAngB2X: number; + invMAngB2Y: number; + invMAngB2Z: number; + massN: number; + massTB00: number; + massTB01: number; + massTB10: number; + massTB11: number; + } +} + +export namespace oimo.dynamics.constraint.solver.common { + /** + * Internal class. + */ + export class JointSolverMassDataRow { + constructor(); + invMLin1X: number; + invMLin1Y: number; + invMLin1Z: number; + invMLin2X: number; + invMLin2Y: number; + invMLin2Z: number; + invMAng1X: number; + invMAng1Y: number; + invMAng1Z: number; + invMAng2X: number; + invMAng2Y: number; + invMAng2Z: number; + mass: number; + massWithoutCfm: number; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * Internal class + */ + export class BoundaryBuildInfo { + constructor(size: number); + size: number; + numBounded: number; + iBounded: number[]; + signs: number[]; + numUnbounded: number; + iUnbounded: number[]; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * Internal class + */ + export class MassMatrix { + constructor(size: number); + _size: number; + _invMass: number[][]; + _invMassWithoutCfm: number[][]; + _massData: oimo.dynamics.constraint.solver.common.JointSolverMassDataRow[]; + _cachedSubmatrices: number[][][]; + _cacheComputed: boolean[]; + _maxSubmatrixId: number; + computeInvMass(info: oimo.dynamics.constraint.info.joint.JointSolverInfo, massData: oimo.dynamics.constraint.solver.common.JointSolverMassDataRow[]): void; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * Internal class + */ + export class Boundary { + constructor(maxRows: number); + numBounded: number; + iBounded: number[]; + signs: number[]; + numUnbounded: number; + iUnbounded: number[]; + init(buildInfo: oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo): void; + computeImpulses(info: oimo.dynamics.constraint.info.joint.JointSolverInfo, mass: oimo.dynamics.constraint.solver.direct.MassMatrix, relVels: number[], impulses: number[], dImpulses: number[], impulseFactor: number, noCheck: boolean): boolean; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * Internal class. + */ + export class BoundaryBuilder { + constructor(maxRows: number); + numBoundaries: number; + boundaries: oimo.dynamics.constraint.solver.direct.Boundary[]; + buildBoundaries(info: oimo.dynamics.constraint.info.joint.JointSolverInfo): void; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * Internal Class + */ + export class BoundarySelector { + constructor(n: number); + getIndex(i: number): number; + select(index: number): void; + /** + * Makes first n elements the permutation of {0, 1, ... , n-1} + */ + setSize(size: number): void; + } +} + +export namespace oimo.dynamics.constraint.solver.direct { + /** + * The direct solver of a mixed linear complementality problem (MLCP) for + * joint constraints. + */ + export class DirectJointConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(joint: oimo.dynamics.constraint.joint.Joint); + preSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + warmStart(timeStep: oimo.dynamics.TimeStep): void; + solveVelocity(): void; + postSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + preSolvePosition(timeStep: oimo.dynamics.TimeStep): void; + solvePositionSplitImpulse(): void; + solvePositionNgs(timeStep: oimo.dynamics.TimeStep): void; + postSolve(): void; + } +} + +export namespace oimo.dynamics.constraint.solver.pgs { + /** + * A contact constraint solver using projected Gauss-Seidel (sequential impulse). + */ + export class PgsContactConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(constraint: oimo.dynamics.constraint.contact.ContactConstraint); + preSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + warmStart(timeStep: oimo.dynamics.TimeStep): void; + solveVelocity(): void; + preSolvePosition(timeStep: oimo.dynamics.TimeStep): void; + solvePositionSplitImpulse(): void; + solvePositionNgs(timeStep: oimo.dynamics.TimeStep): void; + postSolve(): void; + } +} + +export namespace oimo.dynamics.constraint.solver.pgs { + /** + * A joint constraint solver using projected Gauss-Seidel (sequential impulse). + */ + export class PgsJointConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(joint: oimo.dynamics.constraint.joint.Joint); + preSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + warmStart(timeStep: oimo.dynamics.TimeStep): void; + solveVelocity(): void; + postSolveVelocity(timeStep: oimo.dynamics.TimeStep): void; + preSolvePosition(timeStep: oimo.dynamics.TimeStep): void; + solvePositionSplitImpulse(): void; + solvePositionNgs(timeStep: oimo.dynamics.TimeStep): void; + postSolve(): void; + } +} + +export namespace oimo.dynamics.rigidbody { + /** + * The list of a rigid body's motion types. + */ + export class RigidBodyType { + protected constructor(); + static readonly _DYNAMIC: number; + static readonly _STATIC: number; + static readonly _KINEMATIC: number; + /** + * Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia + * tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved. + */ + static readonly DYNAMIC: number; + /** + * Represents a static rigid body. A static rigid body has zero velocities and infinite mass + * and inertia tensor. The rigid body is not affected by any force or impulse, such as gravity, + * constraints, or external forces or impulses added by an user. + */ + static readonly STATIC: number; + /** + * Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except + * that it can have non-zero linear and angular velocities. This is useful for overlapping rigid + * bodies to pre-computed motions. + */ + static readonly KINEMATIC: number; + } +} \ No newline at end of file diff --git a/bin/js_modules/OimoPhysics.js b/bin/js_modules/OimoPhysics.js new file mode 100644 index 0000000..ba6dec5 --- /dev/null +++ b/bin/js_modules/OimoPhysics.js @@ -0,0 +1,54881 @@ +var oimo = oimo || {}; +if(!oimo.collision) oimo.collision = {}; +if(!oimo.collision.broadphase) oimo.collision.broadphase = {}; +oimo.collision.broadphase.BroadPhase = class oimo_collision_broadphase_BroadPhase { + constructor(type) { + this._type = type; + this._numProxies = 0; + this._proxyList = null; + this._proxyListLast = null; + this._proxyPairList = null; + this._incremental = false; + this._testCount = 0; + this._proxyPairPool = null; + this._idCount = 0; + this._convexSweep = new oimo.collision.broadphase._BroadPhase.ConvexSweepGeometry(); + this._aabb = new oimo.collision.broadphase._BroadPhase.AabbGeometry(); + this.identity = new oimo.common.Transform(); + this.zero = new oimo.common.Vec3(); + this.rayCastHit = new oimo.collision.geometry.RayCastHit(); + } + createProxy(userData,aabb) { + return null; + } + destroyProxy(proxy) { + } + moveProxy(proxy,aabb,displacement) { + } + isOverlapping(proxy1,proxy2) { + if(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ) { + return proxy1._aabbMaxZ > proxy2._aabbMinZ; + } else { + return false; + } + } + collectPairs() { + } + getProxyPairList() { + return this._proxyPairList; + } + isIncremental() { + return this._incremental; + } + getTestCount() { + return this._testCount; + } + rayCast(begin,end,callback) { + } + convexCast(convex,begin,translation,callback) { + } + aabbTest(aabb,callback) { + } +} +if(!oimo.collision.geometry) oimo.collision.geometry = {}; +oimo.collision.geometry.Geometry = class oimo_collision_geometry_Geometry { + constructor(type) { + this._type = type; + this._volume = 0; + } + _updateMass() { + } + _computeAabb(aabb,tf) { + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + return false; + } + getType() { + return this._type; + } + getVolume() { + return this._volume; + } + rayCast(begin,end,transform,hit) { + var beginLocal; + var beginLocalX; + var beginLocalY; + var beginLocalZ; + var endLocal; + var endLocalX; + var endLocalY; + var endLocalZ; + var v = begin; + beginLocalX = v.x; + beginLocalY = v.y; + beginLocalZ = v.z; + var v1 = end; + endLocalX = v1.x; + endLocalY = v1.y; + endLocalZ = v1.z; + beginLocalX -= transform._positionX; + beginLocalY -= transform._positionY; + beginLocalZ -= transform._positionZ; + endLocalX -= transform._positionX; + endLocalY -= transform._positionY; + endLocalZ -= transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * beginLocalX + transform._rotation10 * beginLocalY + transform._rotation20 * beginLocalZ; + __tmp__Y = transform._rotation01 * beginLocalX + transform._rotation11 * beginLocalY + transform._rotation21 * beginLocalZ; + __tmp__Z = transform._rotation02 * beginLocalX + transform._rotation12 * beginLocalY + transform._rotation22 * beginLocalZ; + beginLocalX = __tmp__X; + beginLocalY = __tmp__Y; + beginLocalZ = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; + __tmp__Y1 = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; + __tmp__Z1 = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; + endLocalX = __tmp__X1; + endLocalY = __tmp__Y1; + endLocalZ = __tmp__Z1; + if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { + var localPos; + var localPosX; + var localPosY; + var localPosZ; + var localNormal; + var localNormalX; + var localNormalY; + var localNormalZ; + var v2 = hit.position; + localPosX = v2.x; + localPosY = v2.y; + localPosZ = v2.z; + var v3 = hit.normal; + localNormalX = v3.x; + localNormalY = v3.y; + localNormalZ = v3.z; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; + __tmp__Y2 = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; + __tmp__Z2 = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; + localPosX = __tmp__X2; + localPosY = __tmp__Y2; + localPosZ = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; + __tmp__Y3 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; + __tmp__Z3 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; + localNormalX = __tmp__X3; + localNormalY = __tmp__Y3; + localNormalZ = __tmp__Z3; + localPosX += transform._positionX; + localPosY += transform._positionY; + localPosZ += transform._positionZ; + var v4 = hit.position; + v4.x = localPosX; + v4.y = localPosY; + v4.z = localPosZ; + var v5 = hit.normal; + v5.x = localNormalX; + v5.y = localNormalY; + v5.z = localNormalZ; + return true; + } + return false; + } +} +oimo.collision.geometry.ConvexGeometry = class oimo_collision_geometry_ConvexGeometry extends oimo.collision.geometry.Geometry { + constructor(type) { + super(type); + this._gjkMargin = oimo.common.Setting.defaultGJKMargin; + this._useGjkRayCast = false; + } + getGjkMergin() { + return this._gjkMargin; + } + setGjkMergin(gjkMergin) { + if(gjkMergin < 0) { + gjkMergin = 0; + } + this._gjkMargin = gjkMergin; + } + computeLocalSupportingVertex(dir,out) { + } + rayCast(begin,end,transform,hit) { + if(this._useGjkRayCast) { + return oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance.rayCast(this,transform,begin,end,hit); + } else { + return super.rayCast(begin,end,transform,hit); + } + } +} +if(!oimo.collision.broadphase._BroadPhase) oimo.collision.broadphase._BroadPhase = {}; +oimo.collision.broadphase._BroadPhase.ConvexSweepGeometry = class oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor() { + super(-1); + } + init(c,transform,translation) { + this.c = c; + var tr; + var trX; + var trY; + var trZ; + var v = translation; + trX = v.x; + trY = v.y; + trZ = v.z; + var localTr; + var localTrX; + var localTrY; + var localTrZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * trX + transform._rotation10 * trY + transform._rotation20 * trZ; + __tmp__Y = transform._rotation01 * trX + transform._rotation11 * trY + transform._rotation21 * trZ; + __tmp__Z = transform._rotation02 * trX + transform._rotation12 * trY + transform._rotation22 * trZ; + localTrX = __tmp__X; + localTrY = __tmp__Y; + localTrZ = __tmp__Z; + this.localTranslation = new oimo.common.Vec3(); + var v1 = this.localTranslation; + v1.x = localTrX; + v1.y = localTrY; + v1.z = localTrZ; + this._gjkMargin = c._gjkMargin; + } + computeLocalSupportingVertex(dir,out) { + this.c.computeLocalSupportingVertex(dir,out); + var v = this.localTranslation; + if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { + var v1 = this.localTranslation; + var tx = out.x + v1.x; + var ty = out.y + v1.y; + var tz = out.z + v1.z; + out.x = tx; + out.y = ty; + out.z = tz; + } + } +} +oimo.collision.broadphase._BroadPhase.AabbGeometry = class oimo_collision_broadphase__$BroadPhase_AabbGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor() { + super(-1); + this.min = new oimo.common.Vec3(); + this.max = new oimo.common.Vec3(); + } + computeLocalSupportingVertex(dir,out) { + out.x = dir.x > 0 ? this.max.x : this.min.x; + out.y = dir.y > 0 ? this.max.y : this.min.y; + out.z = dir.z > 0 ? this.max.z : this.min.z; + } +} +oimo.collision.broadphase.BroadPhaseProxyCallback = class oimo_collision_broadphase_BroadPhaseProxyCallback { + constructor() { + } + process(proxy) { + } +} +oimo.collision.broadphase.BroadPhaseType = class oimo_collision_broadphase_BroadPhaseType { +} +oimo.collision.broadphase.Proxy = class oimo_collision_broadphase_Proxy { + constructor(userData,id) { + this.userData = userData; + this._id = id; + this._prev = null; + this._next = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; + } + getId() { + return this._id; + } + getFatAabb() { + var aabb = new oimo.collision.geometry.Aabb(); + aabb._minX = this._aabbMinX; + aabb._minY = this._aabbMinY; + aabb._minZ = this._aabbMinZ; + aabb._maxX = this._aabbMaxX; + aabb._maxY = this._aabbMaxY; + aabb._maxZ = this._aabbMaxZ; + return aabb; + } + getFatAabbTo(aabb) { + aabb._minX = this._aabbMinX; + aabb._minY = this._aabbMinY; + aabb._minZ = this._aabbMinZ; + aabb._maxX = this._aabbMaxX; + aabb._maxY = this._aabbMaxY; + aabb._maxZ = this._aabbMaxZ; + } +} +oimo.collision.broadphase.ProxyPair = class oimo_collision_broadphase_ProxyPair { + constructor() { + this._p1 = null; + this._p2 = null; + } + getProxy1() { + return this._p1; + } + getProxy2() { + return this._p2; + } + getNext() { + return this._next; + } +} +if(!oimo.collision.broadphase.bruteforce) oimo.collision.broadphase.bruteforce = {}; +oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision_broadphase_bruteforce_BruteForceBroadPhase extends oimo.collision.broadphase.BroadPhase { + constructor() { + super(1); + this._incremental = false; + } + createProxy(userData,aabb) { + var proxy = new oimo.collision.broadphase.Proxy(userData,this._idCount++); + this._numProxies++; + if(this._proxyList == null) { + this._proxyList = proxy; + this._proxyListLast = proxy; + } else { + this._proxyListLast._next = proxy; + proxy._prev = this._proxyListLast; + this._proxyListLast = proxy; + } + proxy._aabbMinX = aabb._minX; + proxy._aabbMinY = aabb._minY; + proxy._aabbMinZ = aabb._minZ; + proxy._aabbMaxX = aabb._maxX; + proxy._aabbMaxY = aabb._maxY; + proxy._aabbMaxZ = aabb._maxZ; + return proxy; + } + destroyProxy(proxy) { + this._numProxies--; + var prev = proxy._prev; + var next = proxy._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(proxy == this._proxyList) { + this._proxyList = this._proxyList._next; + } + if(proxy == this._proxyListLast) { + this._proxyListLast = this._proxyListLast._prev; + } + proxy._next = null; + proxy._prev = null; + proxy.userData = null; + } + moveProxy(proxy,aabb,dislacement) { + proxy._aabbMinX = aabb._minX; + proxy._aabbMinY = aabb._minY; + proxy._aabbMinZ = aabb._minZ; + proxy._aabbMaxX = aabb._maxX; + proxy._aabbMaxY = aabb._maxY; + proxy._aabbMaxZ = aabb._maxZ; + } + collectPairs() { + var p = this._proxyPairList; + if(p != null) { + while(true) { + p._p1 = null; + p._p2 = null; + p = p._next; + if(!(p != null)) { + break; + } + } + this._proxyPairList._next = this._proxyPairPool; + this._proxyPairPool = this._proxyPairList; + this._proxyPairList = null; + } + this._testCount = 0; + var p1 = this._proxyList; + while(p1 != null) { + var n = p1._next; + var p2 = p1._next; + while(p2 != null) { + var n1 = p2._next; + this._testCount++; + if(p1._aabbMinX < p2._aabbMaxX && p1._aabbMaxX > p2._aabbMinX && p1._aabbMinY < p2._aabbMaxY && p1._aabbMaxY > p2._aabbMinY && p1._aabbMinZ < p2._aabbMaxZ && p1._aabbMaxZ > p2._aabbMinZ) { + var first = this._proxyPairPool; + if(first != null) { + this._proxyPairPool = first._next; + first._next = null; + } else { + first = new oimo.collision.broadphase.ProxyPair(); + } + var pp = first; + if(this._proxyPairList == null) { + this._proxyPairList = pp; + } else { + pp._next = this._proxyPairList; + this._proxyPairList = pp; + } + pp._p1 = p1; + pp._p2 = p2; + } + p2 = n1; + } + p1 = n; + } + } + rayCast(begin,end,callback) { + var p1; + var p1X; + var p1Y; + var p1Z; + var p2; + var p2X; + var p2Y; + var p2Z; + var dir; + var dirX; + var dirY; + var dirZ; + var v = begin; + p1X = v.x; + p1Y = v.y; + p1Z = v.z; + var v1 = end; + p2X = v1.x; + p2Y = v1.y; + p2Z = v1.z; + dirX = p2X - p1X; + dirY = p2Y - p1Y; + dirZ = p2Z - p1Z; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + minX = p1X < p2X ? p1X : p2X; + minY = p1Y < p2Y ? p1Y : p2Y; + minZ = p1Z < p2Z ? p1Z : p2Z; + maxX = p1X > p2X ? p1X : p2X; + maxY = p1Y > p2Y ? p1Y : p2Y; + maxZ = p1Z > p2Z ? p1Z : p2Z; + var p = this._proxyList; + while(p != null) { + var n = p._next; + var x1 = p1X; + var y1 = p1Y; + var z1 = p1Z; + var x2 = p2X; + var y2 = p2Y; + var z2 = p2Z; + var sminx = x1 < x2 ? x1 : x2; + var sminy = y1 < y2 ? y1 : y2; + var sminz = z1 < z2 ? z1 : z2; + var smaxx = x1 > x2 ? x1 : x2; + var smaxy = y1 > y2 ? y1 : y2; + var smaxz = z1 > z2 ? z1 : z2; + var pminx = p._aabbMinX; + var pminy = p._aabbMinY; + var pminz = p._aabbMinZ; + var pmaxx = p._aabbMaxX; + var pmaxy = p._aabbMaxY; + var pmaxz = p._aabbMaxZ; + var tmp; + if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + tmp = false; + } else { + var dx = x2 - x1; + var dy = y2 - y1; + var dz = z2 - z1; + var adx = dx < 0 ? -dx : dx; + var ady = dy < 0 ? -dy : dy; + var adz = dz < 0 ? -dz : dz; + var pextx = (pmaxx - pminx) * 0.5; + var pexty = (pmaxy - pminy) * 0.5; + var pextz = (pmaxz - pminz) * 0.5; + var pcntx = (pmaxx + pminx) * 0.5; + var pcnty = (pmaxy + pminy) * 0.5; + var pcntz = (pmaxz + pminz) * 0.5; + var cpx = x1 - pcntx; + var cpy = y1 - pcnty; + var cpz = z1 - pcntz; + var tmp1; + var tmp2; + var x = cpy * dz - cpz * dy; + if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { + var x3 = cpz * dx - cpx * dz; + tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + } else { + tmp2 = true; + } + if(!tmp2) { + var x4 = cpx * dy - cpy * dx; + tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + } else { + tmp1 = true; + } + tmp = tmp1 ? false : true; + } + if(tmp) { + callback.process(p); + } + p = n; + } + } + convexCast(convex,begin,translation,callback) { + var p = this._proxyList; + while(p != null) { + var n = p._next; + var v = this._aabb.min; + v.x = p._aabbMinX; + v.y = p._aabbMinY; + v.z = p._aabbMinZ; + var v1 = this._aabb.max; + v1.x = p._aabbMaxX; + v1.y = p._aabbMaxY; + v1.z = p._aabbMaxZ; + this._convexSweep.init(convex,begin,translation); + var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + if(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0) { + callback.process(p); + } + p = n; + } + } + aabbTest(aabb,callback) { + var p = this._proxyList; + while(p != null) { + var n = p._next; + if(aabb._minX < p._aabbMaxX && aabb._maxX > p._aabbMinX && aabb._minY < p._aabbMaxY && aabb._maxY > p._aabbMinY && aabb._minZ < p._aabbMaxZ && aabb._maxZ > p._aabbMinZ) { + callback.process(p); + } + p = n; + } + } +} +if(!oimo.collision.broadphase.bvh) oimo.collision.broadphase.bvh = {}; +oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bvh_BvhBroadPhase extends oimo.collision.broadphase.BroadPhase { + constructor() { + super(2); + this._incremental = true; + this._tree = new oimo.collision.broadphase.bvh.BvhTree(); + var this1 = new Array(1024); + this.movedProxies = this1; + this.numMovedProxies = 0; + } + collide(n1,n2) { + this._testCount++; + var l1 = n1._height == 0; + var l2 = n2._height == 0; + if(n1 == n2) { + if(l1) { + return; + } + this.collide(n1._children[0],n2); + this.collide(n1._children[1],n2); + return; + } + if(!(n1._aabbMinX < n2._aabbMaxX && n1._aabbMaxX > n2._aabbMinX && n1._aabbMinY < n2._aabbMaxY && n1._aabbMaxY > n2._aabbMinY && n1._aabbMinZ < n2._aabbMaxZ && n1._aabbMaxZ > n2._aabbMinZ)) { + return; + } + if(l1 && l2) { + var p1 = n1._proxy; + var p2 = n2._proxy; + var first = this._proxyPairPool; + if(first != null) { + this._proxyPairPool = first._next; + first._next = null; + } else { + first = new oimo.collision.broadphase.ProxyPair(); + } + var pp = first; + if(this._proxyPairList == null) { + this._proxyPairList = pp; + } else { + pp._next = this._proxyPairList; + this._proxyPairList = pp; + } + pp._p1 = p1; + pp._p2 = p2; + return; + } + if(l2 || n1._height > n2._height) { + this.collide(n1._children[0],n2); + this.collide(n1._children[1],n2); + } else { + this.collide(n2._children[0],n1); + this.collide(n2._children[1],n1); + } + } + rayCastRecursive(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { + var p1; + var p1X; + var p1Y; + var p1Z; + var p2; + var p2X; + var p2Y; + var p2Z; + p1X = _p1X; + p1Y = _p1Y; + p1Z = _p1Z; + p2X = _p2X; + p2Y = _p2Y; + p2Z = _p2Z; + var x1 = p1X; + var y1 = p1Y; + var z1 = p1Z; + var x2 = p2X; + var y2 = p2Y; + var z2 = p2Z; + var sminx = x1 < x2 ? x1 : x2; + var sminy = y1 < y2 ? y1 : y2; + var sminz = z1 < z2 ? z1 : z2; + var smaxx = x1 > x2 ? x1 : x2; + var smaxy = y1 > y2 ? y1 : y2; + var smaxz = z1 > z2 ? z1 : z2; + var pminx = node._aabbMinX; + var pminy = node._aabbMinY; + var pminz = node._aabbMinZ; + var pmaxx = node._aabbMaxX; + var pmaxy = node._aabbMaxY; + var pmaxz = node._aabbMaxZ; + var tmp; + if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + tmp = false; + } else { + var dx = x2 - x1; + var dy = y2 - y1; + var dz = z2 - z1; + var adx = dx < 0 ? -dx : dx; + var ady = dy < 0 ? -dy : dy; + var adz = dz < 0 ? -dz : dz; + var pextx = (pmaxx - pminx) * 0.5; + var pexty = (pmaxy - pminy) * 0.5; + var pextz = (pmaxz - pminz) * 0.5; + var pcntx = (pmaxx + pminx) * 0.5; + var pcnty = (pmaxy + pminy) * 0.5; + var pcntz = (pmaxz + pminz) * 0.5; + var cpx = x1 - pcntx; + var cpy = y1 - pcnty; + var cpz = z1 - pcntz; + var tmp1; + var tmp2; + var x = cpy * dz - cpz * dy; + if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { + var x3 = cpz * dx - cpx * dz; + tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + } else { + tmp2 = true; + } + if(!tmp2) { + var x4 = cpx * dy - cpy * dx; + tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + } else { + tmp1 = true; + } + tmp = tmp1 ? false : true; + } + if(!tmp) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.rayCastRecursive(node._children[0],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + this.rayCastRecursive(node._children[1],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + } + convexCastRecursive(node,convex,begin,translation,callback) { + var v = this._aabb.min; + v.x = node._aabbMinX; + v.y = node._aabbMinY; + v.z = node._aabbMinZ; + var v1 = this._aabb.max; + v1.x = node._aabbMaxX; + v1.y = node._aabbMaxY; + v1.z = node._aabbMaxZ; + this._convexSweep.init(convex,begin,translation); + var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + if(!(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0)) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.convexCastRecursive(node._children[0],convex,begin,translation,callback); + this.convexCastRecursive(node._children[1],convex,begin,translation,callback); + } + aabbTestRecursive(node,aabb,callback) { + if(!(node._aabbMinX < aabb._maxX && node._aabbMaxX > aabb._minX && node._aabbMinY < aabb._maxY && node._aabbMaxY > aabb._minY && node._aabbMinZ < aabb._maxZ && node._aabbMaxZ > aabb._minZ)) { + return; + } + if(node._height == 0) { + callback.process(node._proxy); + return; + } + this.aabbTestRecursive(node._children[0],aabb,callback); + this.aabbTestRecursive(node._children[1],aabb,callback); + } + createProxy(userData,aabb) { + var p = new oimo.collision.broadphase.bvh.BvhProxy(userData,this._idCount++); + this._numProxies++; + if(this._proxyList == null) { + this._proxyList = p; + this._proxyListLast = p; + } else { + this._proxyListLast._next = p; + p._prev = this._proxyListLast; + this._proxyListLast = p; + } + var displacement = null; + p._aabbMinX = aabb._minX; + p._aabbMinY = aabb._minY; + p._aabbMinZ = aabb._minZ; + p._aabbMaxX = aabb._maxX; + p._aabbMaxY = aabb._maxY; + p._aabbMaxZ = aabb._maxZ; + var padding = oimo.common.Setting.bvhProxyPadding; + var paddingVec; + var paddingVecX; + var paddingVecY; + var paddingVecZ; + paddingVecX = padding; + paddingVecY = padding; + paddingVecZ = padding; + p._aabbMinX -= paddingVecX; + p._aabbMinY -= paddingVecY; + p._aabbMinZ -= paddingVecZ; + p._aabbMaxX += paddingVecX; + p._aabbMaxY += paddingVecY; + p._aabbMaxZ += paddingVecZ; + if(displacement != null) { + var d; + var dX; + var dY; + var dZ; + var zero; + var zeroX; + var zeroY; + var zeroZ; + var addToMin; + var addToMinX; + var addToMinY; + var addToMinZ; + var addToMax; + var addToMaxX; + var addToMaxY; + var addToMaxZ; + zeroX = 0; + zeroY = 0; + zeroZ = 0; + var v = displacement; + dX = v.x; + dY = v.y; + dZ = v.z; + addToMinX = zeroX < dX ? zeroX : dX; + addToMinY = zeroY < dY ? zeroY : dY; + addToMinZ = zeroZ < dZ ? zeroZ : dZ; + addToMaxX = zeroX > dX ? zeroX : dX; + addToMaxY = zeroY > dY ? zeroY : dY; + addToMaxZ = zeroZ > dZ ? zeroZ : dZ; + p._aabbMinX += addToMinX; + p._aabbMinY += addToMinY; + p._aabbMinZ += addToMinZ; + p._aabbMaxX += addToMaxX; + p._aabbMaxY += addToMaxY; + p._aabbMaxZ += addToMaxZ; + } + var _this = this._tree; + var first = _this._nodePool; + if(first != null) { + _this._nodePool = first._next; + first._next = null; + } else { + first = new oimo.collision.broadphase.bvh.BvhNode(); + } + var leaf = first; + leaf._proxy = p; + p._leaf = leaf; + leaf._aabbMinX = p._aabbMinX; + leaf._aabbMinY = p._aabbMinY; + leaf._aabbMinZ = p._aabbMinZ; + leaf._aabbMaxX = p._aabbMaxX; + leaf._aabbMaxY = p._aabbMaxY; + leaf._aabbMaxZ = p._aabbMaxZ; + _this._numLeaves++; + if(_this.leafList == null) { + _this.leafList = leaf; + _this.leafListLast = leaf; + } else { + _this.leafListLast._nextLeaf = leaf; + leaf._prevLeaf = _this.leafListLast; + _this.leafListLast = leaf; + } + if(_this._root == null) { + _this._root = leaf; + } else { + var sibling = _this._root; + while(sibling._height > 0) { + var nextStep = _this._strategy._decideInsertion(sibling,leaf); + if(nextStep == -1) { + break; + } else { + sibling = sibling._children[nextStep]; + } + } + var parent = sibling._parent; + var first1 = _this._nodePool; + if(first1 != null) { + _this._nodePool = first1._next; + first1._next = null; + } else { + first1 = new oimo.collision.broadphase.bvh.BvhNode(); + } + var node = first1; + if(parent == null) { + _this._root = node; + } else { + var index = sibling._childIndex; + parent._children[index] = node; + node._parent = parent; + node._childIndex = index; + } + var index1 = sibling._childIndex; + node._children[index1] = sibling; + sibling._parent = node; + sibling._childIndex = index1; + var index2 = sibling._childIndex ^ 1; + node._children[index2] = leaf; + leaf._parent = node; + leaf._childIndex = index2; + while(node != null) { + if(_this._strategy._balancingEnabled) { + var nh = node._height; + if(nh < 2) { + node = node; + } else { + var p1 = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var lh = l._height; + var rh = r._height; + var balance = lh - rh; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + var llh = ll._height; + var lrh = lr._height; + if(llh > lrh) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p1 != null) { + p1._children[nodeIndex] = l; + l._parent = p1; + l._childIndex = nodeIndex; + } else { + _this._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + var rlh = rl._height; + var rrh = rr._height; + if(rlh > rrh) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p1 != null) { + p1._children[nodeIndex] = r; + r._parent = p1; + r._childIndex = nodeIndex; + } else { + _this._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + if(!p._moved) { + p._moved = true; + if(this.movedProxies.length == this.numMovedProxies) { + var newLength = this.numMovedProxies << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.movedProxies[i]; + this.movedProxies[i] = null; + } + this.movedProxies = newArray; + } + this.movedProxies[this.numMovedProxies++] = p; + } + return p; + } + destroyProxy(proxy) { + this._numProxies--; + var prev = proxy._prev; + var next = proxy._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(proxy == this._proxyList) { + this._proxyList = this._proxyList._next; + } + if(proxy == this._proxyListLast) { + this._proxyListLast = this._proxyListLast._prev; + } + proxy._next = null; + proxy._prev = null; + var bvhProxy = proxy; + var _this = this._tree; + var leaf = bvhProxy._leaf; + _this._numLeaves--; + var prev1 = leaf._prevLeaf; + var next1 = leaf._nextLeaf; + if(prev1 != null) { + prev1._nextLeaf = next1; + } + if(next1 != null) { + next1._prevLeaf = prev1; + } + if(leaf == _this.leafList) { + _this.leafList = _this.leafList._nextLeaf; + } + if(leaf == _this.leafListLast) { + _this.leafListLast = _this.leafListLast._prevLeaf; + } + leaf._nextLeaf = null; + leaf._prevLeaf = null; + if(_this._root == leaf) { + _this._root = null; + } else { + var parent = leaf._parent; + var sibling = parent._children[leaf._childIndex ^ 1]; + var grandParent = parent._parent; + if(grandParent == null) { + sibling._parent = null; + sibling._childIndex = 0; + _this._root = sibling; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + } else { + sibling._parent = grandParent; + var index = parent._childIndex; + grandParent._children[index] = sibling; + sibling._parent = grandParent; + sibling._childIndex = index; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this._nodePool; + _this._nodePool = parent; + var node = grandParent; + while(node != null) { + if(_this._strategy._balancingEnabled) { + var nh = node._height; + if(nh < 2) { + node = node; + } else { + var p = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var lh = l._height; + var rh = r._height; + var balance = lh - rh; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + var llh = ll._height; + var lrh = lr._height; + if(llh > lrh) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; + l._childIndex = nodeIndex; + } else { + _this._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + var rlh = rl._height; + var rrh = rr._height; + if(rlh > rrh) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; + r._childIndex = nodeIndex; + } else { + _this._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + } + bvhProxy._leaf = null; + leaf._next = null; + leaf._childIndex = 0; + leaf._children[0] = null; + leaf._children[1] = null; + leaf._childIndex = 0; + leaf._parent = null; + leaf._height = 0; + leaf._proxy = null; + leaf._next = _this._nodePool; + _this._nodePool = leaf; + bvhProxy.userData = null; + bvhProxy._next = null; + bvhProxy._prev = null; + if(bvhProxy._moved) { + bvhProxy._moved = false; + } + } + moveProxy(proxy,aabb,displacement) { + var p = proxy; + if(p._aabbMinX <= aabb._minX && p._aabbMaxX >= aabb._maxX && p._aabbMinY <= aabb._minY && p._aabbMaxY >= aabb._maxY && p._aabbMinZ <= aabb._minZ && p._aabbMaxZ >= aabb._maxZ) { + return; + } + p._aabbMinX = aabb._minX; + p._aabbMinY = aabb._minY; + p._aabbMinZ = aabb._minZ; + p._aabbMaxX = aabb._maxX; + p._aabbMaxY = aabb._maxY; + p._aabbMaxZ = aabb._maxZ; + var padding = oimo.common.Setting.bvhProxyPadding; + var paddingVec; + var paddingVecX; + var paddingVecY; + var paddingVecZ; + paddingVecX = padding; + paddingVecY = padding; + paddingVecZ = padding; + p._aabbMinX -= paddingVecX; + p._aabbMinY -= paddingVecY; + p._aabbMinZ -= paddingVecZ; + p._aabbMaxX += paddingVecX; + p._aabbMaxY += paddingVecY; + p._aabbMaxZ += paddingVecZ; + if(displacement != null) { + var d; + var dX; + var dY; + var dZ; + var zero; + var zeroX; + var zeroY; + var zeroZ; + var addToMin; + var addToMinX; + var addToMinY; + var addToMinZ; + var addToMax; + var addToMaxX; + var addToMaxY; + var addToMaxZ; + zeroX = 0; + zeroY = 0; + zeroZ = 0; + var v = displacement; + dX = v.x; + dY = v.y; + dZ = v.z; + addToMinX = zeroX < dX ? zeroX : dX; + addToMinY = zeroY < dY ? zeroY : dY; + addToMinZ = zeroZ < dZ ? zeroZ : dZ; + addToMaxX = zeroX > dX ? zeroX : dX; + addToMaxY = zeroY > dY ? zeroY : dY; + addToMaxZ = zeroZ > dZ ? zeroZ : dZ; + p._aabbMinX += addToMinX; + p._aabbMinY += addToMinY; + p._aabbMinZ += addToMinZ; + p._aabbMaxX += addToMaxX; + p._aabbMaxY += addToMaxY; + p._aabbMaxZ += addToMaxZ; + } + if(!p._moved) { + p._moved = true; + if(this.movedProxies.length == this.numMovedProxies) { + var newLength = this.numMovedProxies << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.numMovedProxies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.movedProxies[i]; + this.movedProxies[i] = null; + } + this.movedProxies = newArray; + } + this.movedProxies[this.numMovedProxies++] = p; + } + } + collectPairs() { + var p = this._proxyPairList; + if(p != null) { + while(true) { + p._p1 = null; + p._p2 = null; + p = p._next; + if(!(p != null)) { + break; + } + } + this._proxyPairList._next = this._proxyPairPool; + this._proxyPairPool = this._proxyPairList; + this._proxyPairList = null; + } + this._testCount = 0; + if(this._numProxies < 2) { + return; + } + var topDown = false; + if(topDown) { + while(this.numMovedProxies > 0) this.movedProxies[--this.numMovedProxies] = null; + var _this = this._tree; + if(_this._root != null) { + if(_this._root != null) { + _this.decomposeRecursive(_this._root); + _this._root = null; + } + while(_this.tmp.length < _this._numLeaves) { + var newLength = _this.tmp.length << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this.tmp.length; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.tmp[i]; + _this.tmp[i] = null; + } + _this.tmp = newArray; + } + var idx = 0; + var leaf = _this.leafList; + while(leaf != null) { + var n = leaf._nextLeaf; + _this.tmp[idx] = leaf; + ++idx; + leaf = n; + } + _this._root = _this.buildTopDownRecursive(_this.tmp,0,_this._numLeaves); + } + this.collide(this._tree._root,this._tree._root); + return; + } + var incrementalCollision = this.numMovedProxies / this._numProxies < oimo.common.Setting.bvhIncrementalCollisionThreshold; + var _g2 = 0; + var _g11 = this.numMovedProxies; + while(_g2 < _g11) { + var i1 = _g2++; + var p1 = this.movedProxies[i1]; + if(p1._moved) { + var _this1 = this._tree; + var leaf1 = p1._leaf; + _this1._numLeaves--; + var prev = leaf1._prevLeaf; + var next = leaf1._nextLeaf; + if(prev != null) { + prev._nextLeaf = next; + } + if(next != null) { + next._prevLeaf = prev; + } + if(leaf1 == _this1.leafList) { + _this1.leafList = _this1.leafList._nextLeaf; + } + if(leaf1 == _this1.leafListLast) { + _this1.leafListLast = _this1.leafListLast._prevLeaf; + } + leaf1._nextLeaf = null; + leaf1._prevLeaf = null; + if(_this1._root == leaf1) { + _this1._root = null; + } else { + var parent = leaf1._parent; + var sibling = parent._children[leaf1._childIndex ^ 1]; + var grandParent = parent._parent; + if(grandParent == null) { + sibling._parent = null; + sibling._childIndex = 0; + _this1._root = sibling; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this1._nodePool; + _this1._nodePool = parent; + } else { + sibling._parent = grandParent; + var index = parent._childIndex; + grandParent._children[index] = sibling; + sibling._parent = grandParent; + sibling._childIndex = index; + parent._next = null; + parent._childIndex = 0; + parent._children[0] = null; + parent._children[1] = null; + parent._childIndex = 0; + parent._parent = null; + parent._height = 0; + parent._proxy = null; + parent._next = _this1._nodePool; + _this1._nodePool = parent; + var node = grandParent; + while(node != null) { + if(_this1._strategy._balancingEnabled) { + var nh = node._height; + if(nh < 2) { + node = node; + } else { + var p2 = node._parent; + var l = node._children[0]; + var r = node._children[1]; + var lh = l._height; + var rh = r._height; + var balance = lh - rh; + var nodeIndex = node._childIndex; + if(balance > 1) { + var ll = l._children[0]; + var lr = l._children[1]; + var llh = ll._height; + var lrh = lr._height; + if(llh > lrh) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + var c1 = l._children[0]; + var c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = l._children[0]._height; + var h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + var c11 = node._children[0]; + var c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + var h11 = node._children[0]._height; + var h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; + } else { + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + var c12 = l._children[0]; + var c22 = l._children[1]; + l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; + l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; + l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; + l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; + l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; + l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; + var h12 = l._children[0]._height; + var h22 = l._children[1]._height; + l._height = (h12 > h22 ? h12 : h22) + 1; + var c13 = node._children[0]; + var c23 = node._children[1]; + node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; + node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; + node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; + node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; + node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; + node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; + var h13 = node._children[0]._height; + var h23 = node._children[1]._height; + node._height = (h13 > h23 ? h13 : h23) + 1; + } + if(p2 != null) { + p2._children[nodeIndex] = l; + l._parent = p2; + l._childIndex = nodeIndex; + } else { + _this1._root = l; + l._parent = null; + } + node = l; + } else if(balance < -1) { + var rl = r._children[0]; + var rr = r._children[1]; + var rlh = rl._height; + var rrh = rr._height; + if(rlh > rrh) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + var c14 = r._children[0]; + var c24 = r._children[1]; + r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; + r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; + r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; + r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; + r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; + r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; + var h14 = r._children[0]._height; + var h24 = r._children[1]._height; + r._height = (h14 > h24 ? h14 : h24) + 1; + var c15 = node._children[0]; + var c25 = node._children[1]; + node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; + node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; + node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; + node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; + node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; + node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; + var h15 = node._children[0]._height; + var h25 = node._children[1]._height; + node._height = (h15 > h25 ? h15 : h25) + 1; + } else { + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + var c16 = r._children[0]; + var c26 = r._children[1]; + r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; + r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; + r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; + r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; + r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; + r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; + var h16 = r._children[0]._height; + var h26 = r._children[1]._height; + r._height = (h16 > h26 ? h16 : h26) + 1; + var c17 = node._children[0]; + var c27 = node._children[1]; + node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; + node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; + node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; + node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; + node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; + node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; + var h17 = node._children[0]._height; + var h27 = node._children[1]._height; + node._height = (h17 > h27 ? h17 : h27) + 1; + } + if(p2 != null) { + p2._children[nodeIndex] = r; + r._parent = p2; + r._childIndex = nodeIndex; + } else { + _this1._root = r; + r._parent = null; + } + node = r; + } else { + node = node; + } + } + } + var h18 = node._children[0]._height; + var h28 = node._children[1]._height; + node._height = (h18 > h28 ? h18 : h28) + 1; + var c18 = node._children[0]; + var c28 = node._children[1]; + node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; + node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; + node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; + node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; + node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; + node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + node = node._parent; + } + } + } + p1._leaf = null; + leaf1._next = null; + leaf1._childIndex = 0; + leaf1._children[0] = null; + leaf1._children[1] = null; + leaf1._childIndex = 0; + leaf1._parent = null; + leaf1._height = 0; + leaf1._proxy = null; + leaf1._next = _this1._nodePool; + _this1._nodePool = leaf1; + var _this2 = this._tree; + var first = _this2._nodePool; + if(first != null) { + _this2._nodePool = first._next; + first._next = null; + } else { + first = new oimo.collision.broadphase.bvh.BvhNode(); + } + var leaf2 = first; + leaf2._proxy = p1; + p1._leaf = leaf2; + leaf2._aabbMinX = p1._aabbMinX; + leaf2._aabbMinY = p1._aabbMinY; + leaf2._aabbMinZ = p1._aabbMinZ; + leaf2._aabbMaxX = p1._aabbMaxX; + leaf2._aabbMaxY = p1._aabbMaxY; + leaf2._aabbMaxZ = p1._aabbMaxZ; + _this2._numLeaves++; + if(_this2.leafList == null) { + _this2.leafList = leaf2; + _this2.leafListLast = leaf2; + } else { + _this2.leafListLast._nextLeaf = leaf2; + leaf2._prevLeaf = _this2.leafListLast; + _this2.leafListLast = leaf2; + } + if(_this2._root == null) { + _this2._root = leaf2; + } else { + var sibling1 = _this2._root; + while(sibling1._height > 0) { + var nextStep = _this2._strategy._decideInsertion(sibling1,leaf2); + if(nextStep == -1) { + break; + } else { + sibling1 = sibling1._children[nextStep]; + } + } + var parent1 = sibling1._parent; + var first1 = _this2._nodePool; + if(first1 != null) { + _this2._nodePool = first1._next; + first1._next = null; + } else { + first1 = new oimo.collision.broadphase.bvh.BvhNode(); + } + var node1 = first1; + if(parent1 == null) { + _this2._root = node1; + } else { + var index1 = sibling1._childIndex; + parent1._children[index1] = node1; + node1._parent = parent1; + node1._childIndex = index1; + } + var index2 = sibling1._childIndex; + node1._children[index2] = sibling1; + sibling1._parent = node1; + sibling1._childIndex = index2; + var index3 = sibling1._childIndex ^ 1; + node1._children[index3] = leaf2; + leaf2._parent = node1; + leaf2._childIndex = index3; + while(node1 != null) { + if(_this2._strategy._balancingEnabled) { + var nh1 = node1._height; + if(nh1 < 2) { + node1 = node1; + } else { + var p3 = node1._parent; + var l1 = node1._children[0]; + var r1 = node1._children[1]; + var lh1 = l1._height; + var rh1 = r1._height; + var balance1 = lh1 - rh1; + var nodeIndex1 = node1._childIndex; + if(balance1 > 1) { + var ll1 = l1._children[0]; + var lr1 = l1._children[1]; + var llh1 = ll1._height; + var lrh1 = lr1._height; + if(llh1 > lrh1) { + l1._children[1] = node1; + node1._parent = l1; + node1._childIndex = 1; + node1._children[0] = lr1; + lr1._parent = node1; + lr1._childIndex = 0; + var c19 = l1._children[0]; + var c29 = l1._children[1]; + l1._aabbMinX = c19._aabbMinX < c29._aabbMinX ? c19._aabbMinX : c29._aabbMinX; + l1._aabbMinY = c19._aabbMinY < c29._aabbMinY ? c19._aabbMinY : c29._aabbMinY; + l1._aabbMinZ = c19._aabbMinZ < c29._aabbMinZ ? c19._aabbMinZ : c29._aabbMinZ; + l1._aabbMaxX = c19._aabbMaxX > c29._aabbMaxX ? c19._aabbMaxX : c29._aabbMaxX; + l1._aabbMaxY = c19._aabbMaxY > c29._aabbMaxY ? c19._aabbMaxY : c29._aabbMaxY; + l1._aabbMaxZ = c19._aabbMaxZ > c29._aabbMaxZ ? c19._aabbMaxZ : c29._aabbMaxZ; + var h19 = l1._children[0]._height; + var h29 = l1._children[1]._height; + l1._height = (h19 > h29 ? h19 : h29) + 1; + var c110 = node1._children[0]; + var c210 = node1._children[1]; + node1._aabbMinX = c110._aabbMinX < c210._aabbMinX ? c110._aabbMinX : c210._aabbMinX; + node1._aabbMinY = c110._aabbMinY < c210._aabbMinY ? c110._aabbMinY : c210._aabbMinY; + node1._aabbMinZ = c110._aabbMinZ < c210._aabbMinZ ? c110._aabbMinZ : c210._aabbMinZ; + node1._aabbMaxX = c110._aabbMaxX > c210._aabbMaxX ? c110._aabbMaxX : c210._aabbMaxX; + node1._aabbMaxY = c110._aabbMaxY > c210._aabbMaxY ? c110._aabbMaxY : c210._aabbMaxY; + node1._aabbMaxZ = c110._aabbMaxZ > c210._aabbMaxZ ? c110._aabbMaxZ : c210._aabbMaxZ; + var h110 = node1._children[0]._height; + var h210 = node1._children[1]._height; + node1._height = (h110 > h210 ? h110 : h210) + 1; + } else { + l1._children[0] = node1; + node1._parent = l1; + node1._childIndex = 0; + node1._children[0] = ll1; + ll1._parent = node1; + ll1._childIndex = 0; + var c111 = l1._children[0]; + var c211 = l1._children[1]; + l1._aabbMinX = c111._aabbMinX < c211._aabbMinX ? c111._aabbMinX : c211._aabbMinX; + l1._aabbMinY = c111._aabbMinY < c211._aabbMinY ? c111._aabbMinY : c211._aabbMinY; + l1._aabbMinZ = c111._aabbMinZ < c211._aabbMinZ ? c111._aabbMinZ : c211._aabbMinZ; + l1._aabbMaxX = c111._aabbMaxX > c211._aabbMaxX ? c111._aabbMaxX : c211._aabbMaxX; + l1._aabbMaxY = c111._aabbMaxY > c211._aabbMaxY ? c111._aabbMaxY : c211._aabbMaxY; + l1._aabbMaxZ = c111._aabbMaxZ > c211._aabbMaxZ ? c111._aabbMaxZ : c211._aabbMaxZ; + var h111 = l1._children[0]._height; + var h211 = l1._children[1]._height; + l1._height = (h111 > h211 ? h111 : h211) + 1; + var c112 = node1._children[0]; + var c212 = node1._children[1]; + node1._aabbMinX = c112._aabbMinX < c212._aabbMinX ? c112._aabbMinX : c212._aabbMinX; + node1._aabbMinY = c112._aabbMinY < c212._aabbMinY ? c112._aabbMinY : c212._aabbMinY; + node1._aabbMinZ = c112._aabbMinZ < c212._aabbMinZ ? c112._aabbMinZ : c212._aabbMinZ; + node1._aabbMaxX = c112._aabbMaxX > c212._aabbMaxX ? c112._aabbMaxX : c212._aabbMaxX; + node1._aabbMaxY = c112._aabbMaxY > c212._aabbMaxY ? c112._aabbMaxY : c212._aabbMaxY; + node1._aabbMaxZ = c112._aabbMaxZ > c212._aabbMaxZ ? c112._aabbMaxZ : c212._aabbMaxZ; + var h112 = node1._children[0]._height; + var h212 = node1._children[1]._height; + node1._height = (h112 > h212 ? h112 : h212) + 1; + } + if(p3 != null) { + p3._children[nodeIndex1] = l1; + l1._parent = p3; + l1._childIndex = nodeIndex1; + } else { + _this2._root = l1; + l1._parent = null; + } + node1 = l1; + } else if(balance1 < -1) { + var rl1 = r1._children[0]; + var rr1 = r1._children[1]; + var rlh1 = rl1._height; + var rrh1 = rr1._height; + if(rlh1 > rrh1) { + r1._children[1] = node1; + node1._parent = r1; + node1._childIndex = 1; + node1._children[1] = rr1; + rr1._parent = node1; + rr1._childIndex = 1; + var c113 = r1._children[0]; + var c213 = r1._children[1]; + r1._aabbMinX = c113._aabbMinX < c213._aabbMinX ? c113._aabbMinX : c213._aabbMinX; + r1._aabbMinY = c113._aabbMinY < c213._aabbMinY ? c113._aabbMinY : c213._aabbMinY; + r1._aabbMinZ = c113._aabbMinZ < c213._aabbMinZ ? c113._aabbMinZ : c213._aabbMinZ; + r1._aabbMaxX = c113._aabbMaxX > c213._aabbMaxX ? c113._aabbMaxX : c213._aabbMaxX; + r1._aabbMaxY = c113._aabbMaxY > c213._aabbMaxY ? c113._aabbMaxY : c213._aabbMaxY; + r1._aabbMaxZ = c113._aabbMaxZ > c213._aabbMaxZ ? c113._aabbMaxZ : c213._aabbMaxZ; + var h113 = r1._children[0]._height; + var h213 = r1._children[1]._height; + r1._height = (h113 > h213 ? h113 : h213) + 1; + var c114 = node1._children[0]; + var c214 = node1._children[1]; + node1._aabbMinX = c114._aabbMinX < c214._aabbMinX ? c114._aabbMinX : c214._aabbMinX; + node1._aabbMinY = c114._aabbMinY < c214._aabbMinY ? c114._aabbMinY : c214._aabbMinY; + node1._aabbMinZ = c114._aabbMinZ < c214._aabbMinZ ? c114._aabbMinZ : c214._aabbMinZ; + node1._aabbMaxX = c114._aabbMaxX > c214._aabbMaxX ? c114._aabbMaxX : c214._aabbMaxX; + node1._aabbMaxY = c114._aabbMaxY > c214._aabbMaxY ? c114._aabbMaxY : c214._aabbMaxY; + node1._aabbMaxZ = c114._aabbMaxZ > c214._aabbMaxZ ? c114._aabbMaxZ : c214._aabbMaxZ; + var h114 = node1._children[0]._height; + var h214 = node1._children[1]._height; + node1._height = (h114 > h214 ? h114 : h214) + 1; + } else { + r1._children[0] = node1; + node1._parent = r1; + node1._childIndex = 0; + node1._children[1] = rl1; + rl1._parent = node1; + rl1._childIndex = 1; + var c115 = r1._children[0]; + var c215 = r1._children[1]; + r1._aabbMinX = c115._aabbMinX < c215._aabbMinX ? c115._aabbMinX : c215._aabbMinX; + r1._aabbMinY = c115._aabbMinY < c215._aabbMinY ? c115._aabbMinY : c215._aabbMinY; + r1._aabbMinZ = c115._aabbMinZ < c215._aabbMinZ ? c115._aabbMinZ : c215._aabbMinZ; + r1._aabbMaxX = c115._aabbMaxX > c215._aabbMaxX ? c115._aabbMaxX : c215._aabbMaxX; + r1._aabbMaxY = c115._aabbMaxY > c215._aabbMaxY ? c115._aabbMaxY : c215._aabbMaxY; + r1._aabbMaxZ = c115._aabbMaxZ > c215._aabbMaxZ ? c115._aabbMaxZ : c215._aabbMaxZ; + var h115 = r1._children[0]._height; + var h215 = r1._children[1]._height; + r1._height = (h115 > h215 ? h115 : h215) + 1; + var c116 = node1._children[0]; + var c216 = node1._children[1]; + node1._aabbMinX = c116._aabbMinX < c216._aabbMinX ? c116._aabbMinX : c216._aabbMinX; + node1._aabbMinY = c116._aabbMinY < c216._aabbMinY ? c116._aabbMinY : c216._aabbMinY; + node1._aabbMinZ = c116._aabbMinZ < c216._aabbMinZ ? c116._aabbMinZ : c216._aabbMinZ; + node1._aabbMaxX = c116._aabbMaxX > c216._aabbMaxX ? c116._aabbMaxX : c216._aabbMaxX; + node1._aabbMaxY = c116._aabbMaxY > c216._aabbMaxY ? c116._aabbMaxY : c216._aabbMaxY; + node1._aabbMaxZ = c116._aabbMaxZ > c216._aabbMaxZ ? c116._aabbMaxZ : c216._aabbMaxZ; + var h116 = node1._children[0]._height; + var h216 = node1._children[1]._height; + node1._height = (h116 > h216 ? h116 : h216) + 1; + } + if(p3 != null) { + p3._children[nodeIndex1] = r1; + r1._parent = p3; + r1._childIndex = nodeIndex1; + } else { + _this2._root = r1; + r1._parent = null; + } + node1 = r1; + } else { + node1 = node1; + } + } + } + var h117 = node1._children[0]._height; + var h217 = node1._children[1]._height; + node1._height = (h117 > h217 ? h117 : h217) + 1; + var c117 = node1._children[0]; + var c217 = node1._children[1]; + node1._aabbMinX = c117._aabbMinX < c217._aabbMinX ? c117._aabbMinX : c217._aabbMinX; + node1._aabbMinY = c117._aabbMinY < c217._aabbMinY ? c117._aabbMinY : c217._aabbMinY; + node1._aabbMinZ = c117._aabbMinZ < c217._aabbMinZ ? c117._aabbMinZ : c217._aabbMinZ; + node1._aabbMaxX = c117._aabbMaxX > c217._aabbMaxX ? c117._aabbMaxX : c217._aabbMaxX; + node1._aabbMaxY = c117._aabbMaxY > c217._aabbMaxY ? c117._aabbMaxY : c217._aabbMaxY; + node1._aabbMaxZ = c117._aabbMaxZ > c217._aabbMaxZ ? c117._aabbMaxZ : c217._aabbMaxZ; + node1 = node1._parent; + } + } + if(incrementalCollision) { + this.collide(this._tree._root,p1._leaf); + } + p1._moved = false; + } + this.movedProxies[i1] = null; + } + if(!incrementalCollision) { + this.collide(this._tree._root,this._tree._root); + } + this.numMovedProxies = 0; + } + rayCast(begin,end,callback) { + if(this._tree._root == null) { + return; + } + var p1; + var p1X; + var p1Y; + var p1Z; + var p2; + var p2X; + var p2Y; + var p2Z; + var v = begin; + p1X = v.x; + p1Y = v.y; + p1Z = v.z; + var v1 = end; + p2X = v1.x; + p2Y = v1.y; + p2Z = v1.z; + this.rayCastRecursive(this._tree._root,p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + } + convexCast(convex,begin,translation,callback) { + if(this._tree._root == null) { + return; + } + this.convexCastRecursive(this._tree._root,convex,begin,translation,callback); + } + aabbTest(aabb,callback) { + if(this._tree._root == null) { + return; + } + this.aabbTestRecursive(this._tree._root,aabb,callback); + } + getTreeBalance() { + return this._tree._getBalance(); + } +} +oimo.collision.broadphase.bvh.BvhInsertionStrategy = class oimo_collision_broadphase_bvh_BvhInsertionStrategy { +} +oimo.collision.broadphase.bvh.BvhNode = class oimo_collision_broadphase_bvh_BvhNode { + constructor() { + this._next = null; + this._prevLeaf = null; + this._nextLeaf = null; + var this1 = new Array(2); + this._children = this1; + this._childIndex = 0; + this._parent = null; + this._height = 0; + this._proxy = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; + } +} +oimo.collision.broadphase.bvh.BvhProxy = class oimo_collision_broadphase_bvh_BvhProxy extends oimo.collision.broadphase.Proxy { + constructor(userData,id) { + super(userData,id); + this._leaf = null; + this._moved = false; + } +} +oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_BvhStrategy { + constructor() { + this._insertionStrategy = 0; + this._balancingEnabled = false; + } + _decideInsertion(currentNode,leaf) { + switch(this._insertionStrategy) { + case 0: + var center; + var centerX; + var centerY; + var centerZ; + centerX = leaf._aabbMinX + leaf._aabbMaxX; + centerY = leaf._aabbMinY + leaf._aabbMaxY; + centerZ = leaf._aabbMinZ + leaf._aabbMaxZ; + var c1 = currentNode._children[0]; + var c2 = currentNode._children[1]; + var diff1; + var diff1X; + var diff1Y; + var diff1Z; + var diff2; + var diff2X; + var diff2Y; + var diff2Z; + diff1X = c1._aabbMinX + c1._aabbMaxX; + diff1Y = c1._aabbMinY + c1._aabbMaxY; + diff1Z = c1._aabbMinZ + c1._aabbMaxZ; + diff2X = c2._aabbMinX + c2._aabbMaxX; + diff2Y = c2._aabbMinY + c2._aabbMaxY; + diff2Z = c2._aabbMinZ + c2._aabbMaxZ; + diff1X -= centerX; + diff1Y -= centerY; + diff1Z -= centerZ; + diff2X -= centerX; + diff2Y -= centerY; + diff2Z -= centerZ; + var dist1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; + var dist2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; + if(dist1 < dist2) { + return 0; + } else { + return 1; + } + break; + case 1: + var c11 = currentNode._children[0]; + var c21 = currentNode._children[1]; + var ex = currentNode._aabbMaxX - currentNode._aabbMinX; + var ey = currentNode._aabbMaxY - currentNode._aabbMinY; + var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; + var oldArea = (ex * (ey + ez) + ey * ez) * 2; + var combinedMin; + var combinedMinX; + var combinedMinY; + var combinedMinZ; + var combinedMax; + var combinedMaxX; + var combinedMaxY; + var combinedMaxZ; + combinedMinX = currentNode._aabbMinX < leaf._aabbMinX ? currentNode._aabbMinX : leaf._aabbMinX; + combinedMinY = currentNode._aabbMinY < leaf._aabbMinY ? currentNode._aabbMinY : leaf._aabbMinY; + combinedMinZ = currentNode._aabbMinZ < leaf._aabbMinZ ? currentNode._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = currentNode._aabbMaxX > leaf._aabbMaxX ? currentNode._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = currentNode._aabbMaxY > leaf._aabbMaxY ? currentNode._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = currentNode._aabbMaxZ > leaf._aabbMaxZ ? currentNode._aabbMaxZ : leaf._aabbMaxZ; + var ex1 = combinedMaxX - combinedMinX; + var ey1 = combinedMaxY - combinedMinY; + var ez1 = combinedMaxZ - combinedMinZ; + var newArea = (ex1 * (ey1 + ez1) + ey1 * ez1) * 2; + var creatingCost = newArea * 2; + var incrementalCost = (newArea - oldArea) * 2; + var descendingCost1 = incrementalCost; + combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; + combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; + combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c11._aabbMaxX > leaf._aabbMaxX ? c11._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; + if(c11._height == 0) { + var ex2 = combinedMaxX - combinedMinX; + var ey2 = combinedMaxY - combinedMinY; + var ez2 = combinedMaxZ - combinedMinZ; + descendingCost1 += (ex2 * (ey2 + ez2) + ey2 * ez2) * 2; + } else { + var ex3 = combinedMaxX - combinedMinX; + var ey3 = combinedMaxY - combinedMinY; + var ez3 = combinedMaxZ - combinedMinZ; + var ex4 = c11._aabbMaxX - c11._aabbMinX; + var ey4 = c11._aabbMaxY - c11._aabbMinY; + var ez4 = c11._aabbMaxZ - c11._aabbMinZ; + descendingCost1 += (ex3 * (ey3 + ez3) + ey3 * ez3) * 2 - (ex4 * (ey4 + ez4) + ey4 * ez4) * 2; + } + var descendingCost2 = incrementalCost; + combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; + combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; + combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c21._aabbMaxX > leaf._aabbMaxX ? c21._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; + if(c21._height == 0) { + var ex5 = combinedMaxX - combinedMinX; + var ey5 = combinedMaxY - combinedMinY; + var ez5 = combinedMaxZ - combinedMinZ; + descendingCost2 += (ex5 * (ey5 + ez5) + ey5 * ez5) * 2; + } else { + var ex6 = combinedMaxX - combinedMinX; + var ey6 = combinedMaxY - combinedMinY; + var ez6 = combinedMaxZ - combinedMinZ; + var ex7 = c21._aabbMaxX - c21._aabbMinX; + var ey7 = c21._aabbMaxY - c21._aabbMinY; + var ez7 = c21._aabbMaxZ - c21._aabbMinZ; + descendingCost2 += (ex6 * (ey6 + ez6) + ey6 * ez6) * 2 - (ex7 * (ey7 + ez7) + ey7 * ez7) * 2; + } + if(creatingCost < descendingCost1) { + if(creatingCost < descendingCost2) { + return -1; + } else { + return 1; + } + } else if(descendingCost1 < descendingCost2) { + return 0; + } else { + return 1; + } + break; + default: + console.log("src/oimo/collision/broadphase/bvh/BvhStrategy.hx:37:","invalid BVH insertion strategy: " + this._insertionStrategy); + return -1; + } + } + _splitLeaves(leaves,from,until) { + var invN = 1.0 / (until - from); + var centerMean; + var centerMeanX; + var centerMeanY; + var centerMeanZ; + centerMeanX = 0; + centerMeanY = 0; + centerMeanZ = 0; + var _g = from; + var _g1 = until; + while(_g < _g1) { + var i = _g++; + var leaf = leaves[i]; + leaf._tmpX = leaf._aabbMaxX + leaf._aabbMinX; + leaf._tmpY = leaf._aabbMaxY + leaf._aabbMinY; + leaf._tmpZ = leaf._aabbMaxZ + leaf._aabbMinZ; + centerMeanX += leaf._tmpX; + centerMeanY += leaf._tmpY; + centerMeanZ += leaf._tmpZ; + } + centerMeanX *= invN; + centerMeanY *= invN; + centerMeanZ *= invN; + var variance; + var varianceX; + var varianceY; + var varianceZ; + varianceX = 0; + varianceY = 0; + varianceZ = 0; + var _g2 = from; + var _g3 = until; + while(_g2 < _g3) { + var i1 = _g2++; + var leaf1 = leaves[i1]; + var diff; + var diffX; + var diffY; + var diffZ; + diffX = leaf1._tmpX - centerMeanX; + diffY = leaf1._tmpY - centerMeanY; + diffZ = leaf1._tmpZ - centerMeanZ; + diffX *= diffX; + diffY *= diffY; + diffZ *= diffZ; + varianceX += diffX; + varianceY += diffY; + varianceZ += diffZ; + } + var varX = varianceX; + var varY = varianceY; + var varZ = varianceZ; + var l = from; + var r = until - 1; + if(varX > varY) { + if(varX > varZ) { + var mean = centerMeanX; + while(true) { + while(true) { + var leaf2 = leaves[l]; + if(leaf2._tmpX <= mean) { + break; + } + ++l; + } + while(true) { + var leaf3 = leaves[r]; + if(leaf3._tmpX >= mean) { + break; + } + --r; + } + if(l >= r) { + break; + } + var tmp = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp; + ++l; + --r; + } + } else { + var mean1 = centerMeanZ; + while(true) { + while(true) { + var leaf4 = leaves[l]; + if(leaf4._tmpZ <= mean1) { + break; + } + ++l; + } + while(true) { + var leaf5 = leaves[r]; + if(leaf5._tmpZ >= mean1) { + break; + } + --r; + } + if(l >= r) { + break; + } + var tmp1 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp1; + ++l; + --r; + } + } + } else if(varY > varZ) { + var mean2 = centerMeanY; + while(true) { + while(true) { + var leaf6 = leaves[l]; + if(leaf6._tmpY <= mean2) { + break; + } + ++l; + } + while(true) { + var leaf7 = leaves[r]; + if(leaf7._tmpY >= mean2) { + break; + } + --r; + } + if(l >= r) { + break; + } + var tmp2 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp2; + ++l; + --r; + } + } else { + var mean3 = centerMeanZ; + while(true) { + while(true) { + var leaf8 = leaves[l]; + if(leaf8._tmpZ <= mean3) { + break; + } + ++l; + } + while(true) { + var leaf9 = leaves[r]; + if(leaf9._tmpZ >= mean3) { + break; + } + --r; + } + if(l >= r) { + break; + } + var tmp3 = leaves[l]; + leaves[l] = leaves[r]; + leaves[r] = tmp3; + ++l; + --r; + } + } + return l; + } +} +oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhTree { + constructor() { + this._root = null; + this._numLeaves = 0; + this._strategy = new oimo.collision.broadphase.bvh.BvhStrategy(); + this._nodePool = null; + this.leafList = null; + this.leafListLast = null; + var this1 = new Array(1024); + this.tmp = this1; + } + _print(root,indent) { + if(indent == null) { + indent = ""; + } + if(root == null) { + return; + } + if(root._height == 0) { + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:39:",indent + root._proxy._id); + } else { + this._print(root._children[0],indent + " "); + var tmp; + var size; + var sizeX; + var sizeY; + var sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + var x = sizeX; + var y = sizeY; + var z = sizeZ; + if(x * (y + z) + y * z > 0) { + var size1; + var sizeX1; + var sizeY1; + var sizeZ1; + sizeX1 = root._aabbMaxX - root._aabbMinX; + sizeY1 = root._aabbMaxY - root._aabbMinY; + sizeZ1 = root._aabbMaxZ - root._aabbMinZ; + var x1 = sizeX1; + var y1 = sizeY1; + var z1 = sizeZ1; + tmp = ((x1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + } else { + var size2; + var sizeX2; + var sizeY2; + var sizeZ2; + sizeX2 = root._aabbMaxX - root._aabbMinX; + sizeY2 = root._aabbMaxY - root._aabbMinY; + sizeZ2 = root._aabbMaxZ - root._aabbMinZ; + var x2 = sizeX2; + var y2 = sizeY2; + var z2 = sizeZ2; + tmp = ((x2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + } + console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); + this._print(root._children[1],indent + " "); + } + } + _getBalance() { + return this.getBalanceRecursive(this._root); + } + deleteRecursive(root) { + if(root._height == 0) { + var prev = root._prevLeaf; + var next = root._nextLeaf; + if(prev != null) { + prev._nextLeaf = next; + } + if(next != null) { + next._prevLeaf = prev; + } + if(root == this.leafList) { + this.leafList = this.leafList._nextLeaf; + } + if(root == this.leafListLast) { + this.leafListLast = this.leafListLast._prevLeaf; + } + root._nextLeaf = null; + root._prevLeaf = null; + root._proxy._leaf = null; + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + return; + } + this.deleteRecursive(root._children[0]); + this.deleteRecursive(root._children[1]); + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + } + decomposeRecursive(root) { + if(root._height == 0) { + root._childIndex = 0; + root._parent = null; + return; + } + this.decomposeRecursive(root._children[0]); + this.decomposeRecursive(root._children[1]); + root._next = null; + root._childIndex = 0; + root._children[0] = null; + root._children[1] = null; + root._childIndex = 0; + root._parent = null; + root._height = 0; + root._proxy = null; + root._next = this._nodePool; + this._nodePool = root; + } + buildTopDownRecursive(leaves,from,until) { + var num = until - from; + if(num == 1) { + var leaf = leaves[from]; + var proxy = leaf._proxy; + leaf._aabbMinX = proxy._aabbMinX; + leaf._aabbMinY = proxy._aabbMinY; + leaf._aabbMinZ = proxy._aabbMinZ; + leaf._aabbMaxX = proxy._aabbMaxX; + leaf._aabbMaxY = proxy._aabbMaxY; + leaf._aabbMaxZ = proxy._aabbMaxZ; + return leaf; + } + var splitAt = this._strategy._splitLeaves(leaves,from,until); + var child1 = this.buildTopDownRecursive(leaves,from,splitAt); + var child2 = this.buildTopDownRecursive(leaves,splitAt,until); + var first = this._nodePool; + if(first != null) { + this._nodePool = first._next; + first._next = null; + } else { + first = new oimo.collision.broadphase.bvh.BvhNode(); + } + var parent = first; + parent._children[0] = child1; + child1._parent = parent; + child1._childIndex = 0; + parent._children[1] = child2; + child2._parent = parent; + child2._childIndex = 1; + var c1 = parent._children[0]; + var c2 = parent._children[1]; + parent._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + parent._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + parent._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + parent._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + parent._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + parent._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + var h1 = parent._children[0]._height; + var h2 = parent._children[1]._height; + parent._height = (h1 > h2 ? h1 : h2) + 1; + return parent; + } + getBalanceRecursive(root) { + if(root == null || root._height == 0) { + return 0; + } + var balance = root._children[0]._height - root._children[1]._height; + if(balance < 0) { + balance = -balance; + } + return balance + this.getBalanceRecursive(root._children[0]) + this.getBalanceRecursive(root._children[1]); + } +} +oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { + constructor() { + this._minX = 0; + this._minY = 0; + this._minZ = 0; + this._maxX = 0; + this._maxY = 0; + this._maxZ = 0; + } + init(min,max) { + var v = min; + this._minX = v.x; + this._minY = v.y; + this._minZ = v.z; + var v1 = max; + this._maxX = v1.x; + this._maxY = v1.y; + this._maxZ = v1.z; + return this; + } + getMin() { + var min = new oimo.common.Vec3(); + var v = min; + v.x = this._minX; + v.y = this._minY; + v.z = this._minZ; + return min; + } + getMinTo(min) { + var v = min; + v.x = this._minX; + v.y = this._minY; + v.z = this._minZ; + } + setMin(min) { + var v = min; + this._minX = v.x; + this._minY = v.y; + this._minZ = v.z; + return this; + } + getMax() { + var max = new oimo.common.Vec3(); + var v = max; + v.x = this._maxX; + v.y = this._maxY; + v.z = this._maxZ; + return max; + } + getMaxTo(max) { + var v = max; + v.x = this._maxX; + v.y = this._maxY; + v.z = this._maxZ; + } + setMax(max) { + var v = max; + this._maxX = v.x; + this._maxY = v.y; + this._maxZ = v.z; + return this; + } + getCenter() { + var v = new oimo.common.Vec3(); + var c; + var cX; + var cY; + var cZ; + cX = this._minX + this._maxX; + cY = this._minY + this._maxY; + cZ = this._minZ + this._maxZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + var v1 = v; + v1.x = cX; + v1.y = cY; + v1.z = cZ; + return v; + } + getCenterTo(center) { + var c; + var cX; + var cY; + var cZ; + cX = this._minX + this._maxX; + cY = this._minY + this._maxY; + cZ = this._minZ + this._maxZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + var v = center; + v.x = cX; + v.y = cY; + v.z = cZ; + } + getExtents() { + var v = new oimo.common.Vec3(); + var c; + var cX; + var cY; + var cZ; + cX = this._maxX - this._minX; + cY = this._maxY - this._minY; + cZ = this._maxZ - this._minZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + var v1 = v; + v1.x = cX; + v1.y = cY; + v1.z = cZ; + return v; + } + getExtentsTo(halfExtents) { + var c; + var cX; + var cY; + var cZ; + cX = this._maxX - this._minX; + cY = this._maxY - this._minY; + cZ = this._maxZ - this._minZ; + cX *= 0.5; + cY *= 0.5; + cZ *= 0.5; + var v = halfExtents; + v.x = cX; + v.y = cY; + v.z = cZ; + } + combine(other) { + this._minX = this._minX < other._minX ? this._minX : other._minX; + this._minY = this._minY < other._minY ? this._minY : other._minY; + this._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; + this._maxX = this._maxX > other._maxX ? this._maxX : other._maxX; + this._maxY = this._maxY > other._maxY ? this._maxY : other._maxY; + this._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; + return this; + } + combined(other) { + var aabb = new oimo.collision.geometry.Aabb(); + aabb._minX = this._minX < other._minX ? this._minX : other._minX; + aabb._minY = this._minY < other._minY ? this._minY : other._minY; + aabb._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; + aabb._maxX = this._maxX > other._maxX ? this._maxX : other._maxX; + aabb._maxY = this._maxY > other._maxY ? this._maxY : other._maxY; + aabb._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; + return aabb; + } + overlap(other) { + if(this._minX < other._maxX && this._maxX > other._minX && this._minY < other._maxY && this._maxY > other._minY && this._minZ < other._maxZ) { + return this._maxZ > other._minZ; + } else { + return false; + } + } + getIntersection(other) { + var aabb = new oimo.collision.geometry.Aabb(); + aabb._minX = this._minX > other._minX ? this._minX : other._minX; + aabb._minY = this._minY > other._minY ? this._minY : other._minY; + aabb._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; + aabb._maxX = this._maxX < other._maxX ? this._maxX : other._maxX; + aabb._maxY = this._maxY < other._maxY ? this._maxY : other._maxY; + aabb._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; + return aabb; + } + getIntersectionTo(other,intersection) { + intersection._minX = this._minX > other._minX ? this._minX : other._minX; + intersection._minY = this._minY > other._minY ? this._minY : other._minY; + intersection._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; + intersection._maxX = this._maxX < other._maxX ? this._maxX : other._maxX; + intersection._maxY = this._maxY < other._maxY ? this._maxY : other._maxY; + intersection._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; + } + copyFrom(aabb) { + this._minX = aabb._minX; + this._minY = aabb._minY; + this._minZ = aabb._minZ; + this._maxX = aabb._maxX; + this._maxY = aabb._maxY; + this._maxZ = aabb._maxZ; + return this; + } + clone() { + var aabb = new oimo.collision.geometry.Aabb(); + aabb._minX = this._minX; + aabb._minY = this._minY; + aabb._minZ = this._minZ; + aabb._maxX = this._maxX; + aabb._maxY = this._maxY; + aabb._maxZ = this._maxZ; + return aabb; + } +} +oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(halfExtents) { + super(1); + var v = halfExtents; + this._halfExtentsX = v.x; + this._halfExtentsY = v.y; + this._halfExtentsZ = v.z; + this._halfAxisXX = halfExtents.x; + this._halfAxisXY = 0; + this._halfAxisXZ = 0; + this._halfAxisYX = 0; + this._halfAxisYY = halfExtents.y; + this._halfAxisYZ = 0; + this._halfAxisZX = 0; + this._halfAxisZY = 0; + this._halfAxisZZ = halfExtents.z; + this._updateMass(); + var minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; + if(this._gjkMargin > minHalfExtents * 0.2) { + this._gjkMargin = minHalfExtents * 0.2; + } + } + getHalfExtents() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._halfExtentsX; + v1.y = this._halfExtentsY; + v1.z = this._halfExtentsZ; + return v; + } + getHalfExtentsTo(halfExtents) { + var v = halfExtents; + v.x = this._halfExtentsX; + v.y = this._halfExtentsY; + v.z = this._halfExtentsZ; + } + _updateMass() { + this._volume = 8 * (this._halfExtentsX * this._halfExtentsY * this._halfExtentsZ); + var sq; + var sqX; + var sqY; + var sqZ; + sqX = this._halfExtentsX * this._halfExtentsX; + sqY = this._halfExtentsY * this._halfExtentsY; + sqZ = this._halfExtentsZ * this._halfExtentsZ; + this._inertiaCoeff00 = 0.333333333333333315 * (sqY + sqZ); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.333333333333333315 * (sqZ + sqX); + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.333333333333333315 * (sqX + sqY); + } + _computeAabb(aabb,tf) { + var tfx; + var tfxX; + var tfxY; + var tfxZ; + var tfy; + var tfyX; + var tfyY; + var tfyZ; + var tfz; + var tfzX; + var tfzY; + var tfzZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * this._halfAxisXX + tf._rotation01 * this._halfAxisXY + tf._rotation02 * this._halfAxisXZ; + __tmp__Y = tf._rotation10 * this._halfAxisXX + tf._rotation11 * this._halfAxisXY + tf._rotation12 * this._halfAxisXZ; + __tmp__Z = tf._rotation20 * this._halfAxisXX + tf._rotation21 * this._halfAxisXY + tf._rotation22 * this._halfAxisXZ; + tfxX = __tmp__X; + tfxY = __tmp__Y; + tfxZ = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; + __tmp__Y1 = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; + __tmp__Z1 = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; + tfyX = __tmp__X1; + tfyY = __tmp__Y1; + tfyZ = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; + __tmp__Y2 = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; + __tmp__Z2 = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; + tfzX = __tmp__X2; + tfzY = __tmp__Y2; + tfzZ = __tmp__Z2; + tfxX = tfxX < 0 ? -tfxX : tfxX; + tfxY = tfxY < 0 ? -tfxY : tfxY; + tfxZ = tfxZ < 0 ? -tfxZ : tfxZ; + tfyX = tfyX < 0 ? -tfyX : tfyX; + tfyY = tfyY < 0 ? -tfyY : tfyY; + tfyZ = tfyZ < 0 ? -tfyZ : tfyZ; + tfzX = tfzX < 0 ? -tfzX : tfzX; + tfzY = tfzY < 0 ? -tfzY : tfzY; + tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; + var tfs; + var tfsX; + var tfsY; + var tfsZ; + tfsX = tfxX + tfyX; + tfsY = tfxY + tfyY; + tfsZ = tfxZ + tfyZ; + tfsX += tfzX; + tfsY += tfzY; + tfsZ += tfzZ; + aabb._minX = tf._positionX - tfsX; + aabb._minY = tf._positionY - tfsY; + aabb._minZ = tf._positionZ - tfsZ; + aabb._maxX = tf._positionX + tfsX; + aabb._maxY = tf._positionY + tfsY; + aabb._maxZ = tf._positionZ + tfsZ; + } + computeLocalSupportingVertex(dir,out) { + var gjkMargins; + var gjkMarginsX; + var gjkMarginsY; + var gjkMarginsZ; + var coreExtents; + var coreExtentsX; + var coreExtentsY; + var coreExtentsZ; + gjkMarginsX = this._gjkMargin; + gjkMarginsY = this._gjkMargin; + gjkMarginsZ = this._gjkMargin; + gjkMarginsX = gjkMarginsX < this._halfExtentsX ? gjkMarginsX : this._halfExtentsX; + gjkMarginsY = gjkMarginsY < this._halfExtentsY ? gjkMarginsY : this._halfExtentsY; + gjkMarginsZ = gjkMarginsZ < this._halfExtentsZ ? gjkMarginsZ : this._halfExtentsZ; + coreExtentsX = this._halfExtentsX - gjkMarginsX; + coreExtentsY = this._halfExtentsY - gjkMarginsY; + coreExtentsZ = this._halfExtentsZ - gjkMarginsZ; + out.x = dir.x > 0 ? coreExtentsX : -coreExtentsX; + out.y = dir.y > 0 ? coreExtentsY : -coreExtentsY; + out.z = dir.z > 0 ? coreExtentsZ : -coreExtentsZ; + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var p1x = beginX; + var p1y = beginY; + var p1z = beginZ; + var p2x = endX; + var p2y = endY; + var p2z = endZ; + var halfW = this._halfExtentsX; + var halfH = this._halfExtentsY; + var halfD = this._halfExtentsZ; + var dx = p2x - p1x; + var dy = p2y - p1y; + var dz = p2z - p1z; + var tminx = 0; + var tminy = 0; + var tminz = 0; + var tmaxx = 1; + var tmaxy = 1; + var tmaxz = 1; + if(dx > -1e-6 && dx < 1e-6) { + if(p1x <= -halfW || p1x >= halfW) { + return false; + } + } else { + var invDx = 1 / dx; + var t1 = (-halfW - p1x) * invDx; + var t2 = (halfW - p1x) * invDx; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminx = t1; + } + if(t2 < 1) { + tmaxx = t2; + } + } + if(dy > -1e-6 && dy < 1e-6) { + if(p1y <= -halfH || p1y >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t11 = (-halfH - p1y) * invDy; + var t21 = (halfH - p1y) * invDy; + if(t11 > t21) { + var tmp1 = t11; + t11 = t21; + t21 = tmp1; + } + if(t11 > 0) { + tminy = t11; + } + if(t21 < 1) { + tmaxy = t21; + } + } + if(dz > -1e-6 && dz < 1e-6) { + if(p1z <= -halfD || p1z >= halfD) { + return false; + } + } else { + var invDz = 1 / dz; + var t12 = (-halfD - p1z) * invDz; + var t22 = (halfD - p1z) * invDz; + if(t12 > t22) { + var tmp2 = t12; + t12 = t22; + t22 = tmp2; + } + if(t12 > 0) { + tminz = t12; + } + if(t22 < 1) { + tmaxz = t22; + } + } + if(tminx >= 1 || tminy >= 1 || tminz >= 1 || tmaxx <= 0 || tmaxy <= 0 || tmaxz <= 0) { + return false; + } + var min = tminx; + var max = tmaxx; + var hitDirection = 0; + if(tminy > min) { + min = tminy; + hitDirection = 1; + } + if(tminz > min) { + min = tminz; + hitDirection = 2; + } + if(tmaxy < max) { + max = tmaxy; + } + if(tmaxz < max) { + max = tmaxz; + } + if(min > max) { + return false; + } + if(min == 0) { + return false; + } + switch(hitDirection) { + case 0: + hit.normal.init(dx > 0 ? -1 : 1,0,0); + break; + case 1: + hit.normal.init(0,dy > 0 ? -1 : 1,0); + break; + case 2: + hit.normal.init(0,0,dz > 0 ? -1 : 1); + break; + } + hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.fraction = min; + return true; + } +} +oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(radius,halfHeight) { + super(4); + this._radius = radius; + this._halfHeight = halfHeight; + this._gjkMargin = this._radius; + this._updateMass(); + } + getRadius() { + return this._radius; + } + getHalfHeight() { + return this._halfHeight; + } + _updateMass() { + var r2 = this._radius * this._radius; + var hh2 = this._halfHeight * this._halfHeight; + var cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; + var sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; + this._volume = cylinderVolume + sphereVolume; + var invVolume = this._volume == 0 ? 0 : 1 / this._volume; + var inertiaY = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); + var inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); + this._inertiaCoeff00 = inertiaXZ; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = inertiaY; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = inertiaXZ; + } + _computeAabb(aabb,tf) { + var radVec; + var radVecX; + var radVecY; + var radVecZ; + radVecX = this._radius; + radVecY = this._radius; + radVecZ = this._radius; + var axis; + var axisX; + var axisY; + var axisZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axisX = axisX < 0 ? -axisX : axisX; + axisY = axisY < 0 ? -axisY : axisY; + axisZ = axisZ < 0 ? -axisZ : axisZ; + axisX *= this._halfHeight; + axisY *= this._halfHeight; + axisZ *= this._halfHeight; + radVecX += axisX; + radVecY += axisY; + radVecZ += axisZ; + aabb._minX = tf._positionX - radVecX; + aabb._minY = tf._positionY - radVecY; + aabb._minZ = tf._positionZ - radVecZ; + aabb._maxX = tf._positionX + radVecX; + aabb._maxY = tf._positionY + radVecY; + aabb._maxZ = tf._positionZ + radVecZ; + } + computeLocalSupportingVertex(dir,out) { + if(dir.y > 0) { + out.init(0,this._halfHeight,0); + } else { + out.init(0,-this._halfHeight,0); + } + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var p1x = beginX; + var p1y = beginY; + var p1z = beginZ; + var p2x = endX; + var p2y = endY; + var p2z = endZ; + var halfH = this._halfHeight; + var dx = p2x - p1x; + var dy = p2y - p1y; + var dz = p2z - p1z; + var tminxz = 0; + var tmaxxz = 1; + var a = dx * dx + dz * dz; + var b = p1x * dx + p1z * dz; + var c = p1x * p1x + p1z * p1z - this._radius * this._radius; + var D = b * b - a * c; + if(D < 0) { + return false; + } + var t; + if(a > 0) { + var sqrtD = Math.sqrt(D); + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } else { + if(c >= 0) { + return false; + } + tminxz = 0; + tmaxxz = 1; + } + var crossY = p1y + dy * tminxz; + var min; + if(crossY > -halfH && crossY < halfH) { + if(tminxz > 0) { + min = tminxz; + var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + hit.position.init(p1x + min * dx,crossY,p1z + min * dz); + hit.fraction = min; + return true; + } + return false; + } + var sphereY = crossY < 0 ? -halfH : halfH; + var spherePos; + var spherePosX; + var spherePosY; + var spherePosZ; + var sphereToBegin; + var sphereToBeginX; + var sphereToBeginY; + var sphereToBeginZ; + spherePosX = 0; + spherePosY = sphereY; + spherePosZ = 0; + sphereToBeginX = beginX - spherePosX; + sphereToBeginY = beginY - spherePosY; + sphereToBeginZ = beginZ - spherePosZ; + var d; + var dX; + var dY; + var dZ; + dX = endX - beginX; + dY = endY - beginY; + dZ = endZ - beginZ; + a = dX * dX + dY * dY + dZ * dZ; + b = sphereToBeginX * dX + sphereToBeginY * dY + sphereToBeginZ * dZ; + c = sphereToBeginX * sphereToBeginX + sphereToBeginY * sphereToBeginY + sphereToBeginZ * sphereToBeginZ - this._radius * this._radius; + D = b * b - a * c; + if(D < 0) { + return false; + } + var t1 = (-b - Math.sqrt(D)) / a; + if(t1 < 0 || t1 > 1) { + return false; + } + var hitPos; + var hitPosX; + var hitPosY; + var hitPosZ; + var hitNormal; + var hitNormalX; + var hitNormalY; + var hitNormalZ; + hitPosX = sphereToBeginX + dX * t1; + hitPosY = sphereToBeginY + dY * t1; + hitPosZ = sphereToBeginZ + dZ * t1; + var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + hitNormalX = hitPosX * l; + hitNormalY = hitPosY * l; + hitNormalZ = hitPosZ * l; + hitPosX += spherePosX; + hitPosY += spherePosY; + hitPosZ += spherePosZ; + var v = hit.position; + v.x = hitPosX; + v.y = hitPosY; + v.z = hitPosZ; + var v1 = hit.normal; + v1.x = hitNormalX; + v1.y = hitNormalY; + v1.z = hitNormalZ; + hit.fraction = t1; + return true; + } +} +oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(radius,halfHeight) { + super(3); + this._radius = radius; + this._halfHeight = halfHeight; + this.sinTheta = radius / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this.cosTheta = 2 * halfHeight / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this._updateMass(); + } + getRadius() { + return this._radius; + } + getHalfHeight() { + return this._halfHeight; + } + _updateMass() { + var r2 = this._radius * this._radius; + var h2 = this._halfHeight * this._halfHeight * 4; + this._volume = 3.14159265358979 * r2 * this._halfHeight * 2 / 3; + this._inertiaCoeff00 = 0.05 * (3 * r2 + 2 * h2); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.3 * r2; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.05 * (3 * r2 + 2 * h2); + } + _computeAabb(aabb,tf) { + var axis; + var axisX; + var axisY; + var axisZ; + var axis2; + var axis2X; + var axis2Y; + var axis2Z; + var eh; + var ehX; + var ehY; + var ehZ; + var er; + var erX; + var erY; + var erZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axis2X = axisX * axisX; + axis2Y = axisY * axisY; + axis2Z = axisZ * axisZ; + var axis2x = axis2X; + var axis2y = axis2Y; + var axis2z = axis2Z; + erX = Math.sqrt(1 - axis2x); + erY = Math.sqrt(1 - axis2y); + erZ = Math.sqrt(1 - axis2z); + erX *= this._radius; + erY *= this._radius; + erZ *= this._radius; + ehX = axisX * this._halfHeight; + ehY = axisY * this._halfHeight; + ehZ = axisZ * this._halfHeight; + var rmin; + var rminX; + var rminY; + var rminZ; + var rmax; + var rmaxX; + var rmaxY; + var rmaxZ; + rminX = -ehX; + rminY = -ehY; + rminZ = -ehZ; + rminX -= erX; + rminY -= erY; + rminZ -= erZ; + rmaxX = -ehX; + rmaxY = -ehY; + rmaxZ = -ehZ; + rmaxX += erX; + rmaxY += erY; + rmaxZ += erZ; + var max; + var maxX; + var maxY; + var maxZ; + var min; + var minX; + var minY; + var minZ; + maxX = rminX > rmaxX ? rminX : rmaxX; + maxY = rminY > rmaxY ? rminY : rmaxY; + maxZ = rminZ > rmaxZ ? rminZ : rmaxZ; + maxX = maxX > ehX ? maxX : ehX; + maxY = maxY > ehY ? maxY : ehY; + maxZ = maxZ > ehZ ? maxZ : ehZ; + minX = rminX < rmaxX ? rminX : rmaxX; + minY = rminY < rmaxY ? rminY : rmaxY; + minZ = rminZ < rmaxZ ? rminZ : rmaxZ; + minX = minX < ehX ? minX : ehX; + minY = minY < ehY ? minY : ehY; + minZ = minZ < ehZ ? minZ : ehZ; + aabb._minX = tf._positionX + minX; + aabb._minY = tf._positionY + minY; + aabb._minZ = tf._positionZ + minZ; + aabb._maxX = tf._positionX + maxX; + aabb._maxY = tf._positionY + maxY; + aabb._maxZ = tf._positionZ + maxZ; + } + computeLocalSupportingVertex(dir,out) { + var dx = dir.x; + var dy = dir.y; + var dz = dir.z; + if(dy > 0 && dy * dy > this.sinTheta * this.sinTheta * (dx * dx + dy * dy + dz * dz)) { + out.init(0,this._halfHeight - this._gjkMargin / this.sinTheta,0); + if(out.y < 0) { + out.y = 0; + } + return; + } + var rx = dir.x; + var rz = dir.z; + var len = rx * rx + rz * rz; + var height = 2 * this._halfHeight; + var coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; + if(coreRadius < 0) { + coreRadius = 0; + } + var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + var coreHalfHeight = this._halfHeight - this._gjkMargin; + if(coreHalfHeight < 0) { + coreHalfHeight = 0; + } + out.x = rx * invLen; + out.y = -coreHalfHeight; + out.z = rz * invLen; + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var p1x = beginX; + var p1y = beginY; + var p1z = beginZ; + var p2x = endX; + var p2y = endY; + var p2z = endZ; + var halfH = this._halfHeight; + var dx = p2x - p1x; + var dy = p2y - p1y; + var dz = p2z - p1z; + var tminy = 0; + var tmaxy = 1; + if(dy > -1e-6 && dy < 1e-6) { + if(p1y <= -halfH || p1y >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t1 = (-halfH - p1y) * invDy; + var t2 = (halfH - p1y) * invDy; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminy = t1; + } + if(t2 < 1) { + tmaxy = t2; + } + } + if(tminy >= 1 || tmaxy <= 0) { + return false; + } + var tminxz = 0; + var tmaxxz = 0; + p1y -= halfH; + var cos2 = this.cosTheta * this.cosTheta; + var a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; + var b = cos2 * (p1x * dx + p1y * dy + p1z * dz) - p1y * dy; + var c = cos2 * (p1x * p1x + p1y * p1y + p1z * p1z) - p1y * p1y; + var D = b * b - a * c; + if(a != 0) { + if(D < 0) { + return false; + } + var sqrtD = Math.sqrt(D); + if(a < 0) { + if(dy > 0) { + tminxz = 0; + tmaxxz = (-b + sqrtD) / a; + if(tmaxxz <= 0) { + return false; + } + } else { + tminxz = (-b - sqrtD) / a; + tmaxxz = 1; + if(tminxz >= 1) { + return false; + } + } + } else { + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } + } else { + var t = -c / (2 * b); + if(b > 0) { + tminxz = 0; + tmaxxz = t; + if(t <= 0) { + return false; + } + } else { + tminxz = t; + tmaxxz = 1; + if(t >= 1) { + return false; + } + } + } + p1y += halfH; + var min; + if(tmaxxz <= tminy || tmaxy <= tminxz) { + return false; + } + if(tminxz < tminy) { + min = tminy; + if(min == 0) { + return false; + } + hit.normal.init(0,dy > 0 ? -1 : 1,0); + } else { + min = tminxz; + if(min == 0) { + return false; + } + var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + var _this1 = _this; + var s = this.cosTheta; + var tx1 = _this1.x * s; + var ty1 = _this1.y * s; + var tz1 = _this1.z * s; + _this1.x = tx1; + _this1.y = ty1; + _this1.z = tz1; + hit.normal.y += this.sinTheta; + } + hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.fraction = min; + return true; + } +} +oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_ConvexHullGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(vertices) { + super(5); + this._numVertices = vertices.length; + var this1 = new Array(this._numVertices); + this._vertices = this1; + var this2 = new Array(this._numVertices); + this._tmpVertices = this2; + var _g = 0; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + this._vertices[i] = vertices[i]; + this._tmpVertices[i] = new oimo.common.Vec3(); + } + this._useGjkRayCast = true; + this._updateMass(); + } + getVertices() { + return this._vertices; + } + _updateMass() { + this._volume = 1; + this._inertiaCoeff00 = 1; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 1; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 1; + var minx = this._vertices[0].x; + var miny = this._vertices[0].y; + var minz = this._vertices[0].z; + var maxx = this._vertices[0].x; + var maxy = this._vertices[0].y; + var maxz = this._vertices[0].z; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + var vx = this._vertices[i].x; + var vy = this._vertices[i].y; + var vz = this._vertices[i].z; + if(vx < minx) { + minx = vx; + } else if(vx > maxx) { + maxx = vx; + } + if(vy < miny) { + miny = vy; + } else if(vy > maxy) { + maxy = vy; + } + if(vz < minz) { + minz = vz; + } else if(vz > maxz) { + maxz = vz; + } + } + var sizex = maxx - minx; + var sizey = maxy - miny; + var sizez = maxz - minz; + this._volume = sizex * sizey * sizez; + var diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; + sizex = sizex * sizex * 0.25; + sizey = sizey * sizey * 0.25; + sizez = sizez * sizez * 0.25; + this._inertiaCoeff00 = 0.333333333333333315 * (sizey + sizez) + diffCog; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.333333333333333315 * (sizez + sizex) + diffCog; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.333333333333333315 * (sizex + sizey) + diffCog; + } + _computeAabb(aabb,tf) { + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + var margin; + var marginX; + var marginY; + var marginZ; + marginX = this._gjkMargin; + marginY = this._gjkMargin; + marginZ = this._gjkMargin; + var localV; + var localVX; + var localVY; + var localVZ; + var v = this._vertices[0]; + localVX = v.x; + localVY = v.y; + localVZ = v.z; + var worldV; + var worldVX; + var worldVY; + var worldVZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X; + worldVY = __tmp__Y; + worldVZ = __tmp__Z; + worldVX += tf._positionX; + worldVY += tf._positionY; + worldVZ += tf._positionZ; + minX = worldVX; + minY = worldVY; + minZ = worldVZ; + maxX = worldVX; + maxY = worldVY; + maxZ = worldVZ; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this._vertices[i]; + localVX = v1.x; + localVY = v1.y; + localVZ = v1.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y1 = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z1 = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X1; + worldVY = __tmp__Y1; + worldVZ = __tmp__Z1; + worldVX += tf._positionX; + worldVY += tf._positionY; + worldVZ += tf._positionZ; + minX = minX < worldVX ? minX : worldVX; + minY = minY < worldVY ? minY : worldVY; + minZ = minZ < worldVZ ? minZ : worldVZ; + maxX = maxX > worldVX ? maxX : worldVX; + maxY = maxY > worldVY ? maxY : worldVY; + maxZ = maxZ > worldVZ ? maxZ : worldVZ; + } + aabb._minX = minX - marginX; + aabb._minY = minY - marginY; + aabb._minZ = minZ - marginZ; + aabb._maxX = maxX + marginX; + aabb._maxY = maxY + marginY; + aabb._maxZ = maxZ + marginZ; + } + computeLocalSupportingVertex(dir,out) { + var _this = this._vertices[0]; + var maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; + var maxIndex = 0; + var _g = 1; + var _g1 = this._numVertices; + while(_g < _g1) { + var i = _g++; + var _this1 = this._vertices[i]; + var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; + if(dot > maxDot) { + maxDot = dot; + maxIndex = i; + } + } + var v = this._vertices[maxIndex]; + out.x = v.x; + out.y = v.y; + out.z = v.z; + } +} +oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_CylinderGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(radius,halfHeight) { + super(2); + this._radius = radius; + this._halfHeight = halfHeight; + this._updateMass(); + } + getRadius() { + return this._radius; + } + getHalfHeight() { + return this._halfHeight; + } + _updateMass() { + var r2 = this._radius * this._radius; + var h2 = this._halfHeight * this._halfHeight * 4; + this._volume = 3.14159265358979 * r2 * this._halfHeight * 2; + this._inertiaCoeff00 = 0.0833333333333333287 * (3 * r2 + h2); + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.5 * r2; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.0833333333333333287 * (3 * r2 + h2); + } + _computeAabb(aabb,tf) { + var axis; + var axisX; + var axisY; + var axisZ; + var axis2; + var axis2X; + var axis2Y; + var axis2Z; + var eh; + var ehX; + var ehY; + var ehZ; + var er; + var erX; + var erY; + var erZ; + axisX = tf._rotation01; + axisY = tf._rotation11; + axisZ = tf._rotation21; + axisX = axisX < 0 ? -axisX : axisX; + axisY = axisY < 0 ? -axisY : axisY; + axisZ = axisZ < 0 ? -axisZ : axisZ; + axis2X = axisX * axisX; + axis2Y = axisY * axisY; + axis2Z = axisZ * axisZ; + var axis2x = axis2X; + var axis2y = axis2Y; + var axis2z = axis2Z; + erX = Math.sqrt(1 - axis2x); + erY = Math.sqrt(1 - axis2y); + erZ = Math.sqrt(1 - axis2z); + erX *= this._radius; + erY *= this._radius; + erZ *= this._radius; + ehX = axisX * this._halfHeight; + ehY = axisY * this._halfHeight; + ehZ = axisZ * this._halfHeight; + var max; + var maxX; + var maxY; + var maxZ; + maxX = erX + ehX; + maxY = erY + ehY; + maxZ = erZ + ehZ; + aabb._minX = tf._positionX - maxX; + aabb._minY = tf._positionY - maxY; + aabb._minZ = tf._positionZ - maxZ; + aabb._maxX = tf._positionX + maxX; + aabb._maxY = tf._positionY + maxY; + aabb._maxZ = tf._positionZ + maxZ; + } + computeLocalSupportingVertex(dir,out) { + var rx = dir.x; + var rz = dir.z; + var len = rx * rx + rz * rz; + var coreRadius = this._radius - this._gjkMargin; + if(coreRadius < 0) { + coreRadius = 0; + } + var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + var coreHeight = this._halfHeight - this._gjkMargin; + if(coreHeight < 0) { + coreHeight = 0; + } + out.x = rx * invLen; + out.y = dir.y > 0 ? coreHeight : -coreHeight; + out.z = rz * invLen; + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var p1x = beginX; + var p1y = beginY; + var p1z = beginZ; + var p2x = endX; + var p2y = endY; + var p2z = endZ; + var halfH = this._halfHeight; + var dx = p2x - p1x; + var dy = p2y - p1y; + var dz = p2z - p1z; + var tminy = 0; + var tmaxy = 1; + if(dy > -1e-6 && dy < 1e-6) { + if(p1y <= -halfH || p1y >= halfH) { + return false; + } + } else { + var invDy = 1 / dy; + var t1 = (-halfH - p1y) * invDy; + var t2 = (halfH - p1y) * invDy; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; + } + if(t1 > 0) { + tminy = t1; + } + if(t2 < 1) { + tmaxy = t2; + } + } + if(tminy >= 1 || tmaxy <= 0) { + return false; + } + var tminxz = 0; + var tmaxxz = 1; + var a = dx * dx + dz * dz; + var b = p1x * dx + p1z * dz; + var c = p1x * p1x + p1z * p1z - this._radius * this._radius; + var D = b * b - a * c; + if(D < 0) { + return false; + } + var t; + if(a > 0) { + var sqrtD = Math.sqrt(D); + tminxz = (-b - sqrtD) / a; + tmaxxz = (-b + sqrtD) / a; + if(tminxz >= 1 || tmaxxz <= 0) { + return false; + } + } else { + if(c >= 0) { + return false; + } + tminxz = 0; + tmaxxz = 1; + } + var min; + if(tmaxxz <= tminy || tmaxy <= tminxz) { + return false; + } + if(tminxz < tminy) { + min = tminy; + if(min == 0) { + return false; + } + hit.normal.init(0,dy > 0 ? -1 : 1,0); + } else { + min = tminxz; + if(min == 0) { + return false; + } + var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + } + hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.fraction = min; + return true; + } +} +oimo.collision.geometry.GeometryType = class oimo_collision_geometry_GeometryType { +} +oimo.collision.geometry.RayCastHit = class oimo_collision_geometry_RayCastHit { + constructor() { + this.position = new oimo.common.Vec3(); + this.normal = new oimo.common.Vec3(); + this.fraction = 0; + } +} +oimo.collision.geometry.SphereGeometry = class oimo_collision_geometry_SphereGeometry extends oimo.collision.geometry.ConvexGeometry { + constructor(radius) { + super(0); + this._radius = radius; + this._gjkMargin = this._radius; + this._updateMass(); + } + getRadius() { + return this._radius; + } + _updateMass() { + this._volume = 4.18879020478638608 * this._radius * this._radius * this._radius; + this._inertiaCoeff00 = 0.4 * this._radius * this._radius; + this._inertiaCoeff01 = 0; + this._inertiaCoeff02 = 0; + this._inertiaCoeff10 = 0; + this._inertiaCoeff11 = 0.4 * this._radius * this._radius; + this._inertiaCoeff12 = 0; + this._inertiaCoeff20 = 0; + this._inertiaCoeff21 = 0; + this._inertiaCoeff22 = 0.4 * this._radius * this._radius; + } + _computeAabb(aabb,tf) { + var radVec; + var radVecX; + var radVecY; + var radVecZ; + radVecX = this._radius; + radVecY = this._radius; + radVecZ = this._radius; + aabb._minX = tf._positionX - radVecX; + aabb._minY = tf._positionY - radVecY; + aabb._minZ = tf._positionZ - radVecZ; + aabb._maxX = tf._positionX + radVecX; + aabb._maxY = tf._positionY + radVecY; + aabb._maxZ = tf._positionZ + radVecZ; + } + computeLocalSupportingVertex(dir,out) { + out.zero(); + } + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + var d; + var dX; + var dY; + var dZ; + dX = endX - beginX; + dY = endY - beginY; + dZ = endZ - beginZ; + var a = dX * dX + dY * dY + dZ * dZ; + var b = beginX * dX + beginY * dY + beginZ * dZ; + var c = beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius; + var D = b * b - a * c; + if(D < 0) { + return false; + } + var t = (-b - Math.sqrt(D)) / a; + if(t < 0 || t > 1) { + return false; + } + var hitPos; + var hitPosX; + var hitPosY; + var hitPosZ; + var hitNormal; + var hitNormalX; + var hitNormalY; + var hitNormalZ; + hitPosX = beginX + dX * t; + hitPosY = beginY + dY * t; + hitPosZ = beginZ + dZ * t; + var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + hitNormalX = hitPosX * l; + hitNormalY = hitPosY * l; + hitNormalZ = hitPosZ * l; + var v = hit.position; + v.x = hitPosX; + v.y = hitPosY; + v.z = hitPosZ; + var v1 = hit.normal; + v1.x = hitNormalX; + v1.y = hitNormalY; + v1.z = hitNormalZ; + hit.fraction = t; + return true; + } +} +if(!oimo.collision.narrowphase) oimo.collision.narrowphase = {}; +oimo.collision.narrowphase.CollisionMatrix = class oimo_collision_narrowphase_CollisionMatrix { + constructor() { + var this1 = new Array(8); + this.detectors = this1; + var this2 = this.detectors; + var this3 = new Array(8); + this2[0] = this3; + var this4 = this.detectors; + var this5 = new Array(8); + this4[1] = this5; + var this6 = this.detectors; + var this7 = new Array(8); + this6[2] = this7; + var this8 = this.detectors; + var this9 = new Array(8); + this8[3] = this9; + var this10 = this.detectors; + var this11 = new Array(8); + this10[4] = this11; + var this12 = this.detectors; + var this13 = new Array(8); + this12[5] = this13; + var gjkEpaDetector = new oimo.collision.narrowphase.detector.GjkEpaDetector(); + var sp = 0; + var bo = 1; + var cy = 2; + var co = 3; + var ca = 4; + var ch = 5; + this.detectors[sp][sp] = new oimo.collision.narrowphase.detector.SphereSphereDetector(); + this.detectors[sp][bo] = new oimo.collision.narrowphase.detector.SphereBoxDetector(false); + this.detectors[sp][cy] = gjkEpaDetector; + this.detectors[sp][co] = gjkEpaDetector; + this.detectors[sp][ca] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(false); + this.detectors[sp][ch] = gjkEpaDetector; + this.detectors[bo][sp] = new oimo.collision.narrowphase.detector.SphereBoxDetector(true); + this.detectors[bo][bo] = new oimo.collision.narrowphase.detector.BoxBoxDetector(); + this.detectors[bo][cy] = gjkEpaDetector; + this.detectors[bo][co] = gjkEpaDetector; + this.detectors[bo][ca] = gjkEpaDetector; + this.detectors[bo][ch] = gjkEpaDetector; + this.detectors[cy][sp] = gjkEpaDetector; + this.detectors[cy][bo] = gjkEpaDetector; + this.detectors[cy][cy] = gjkEpaDetector; + this.detectors[cy][co] = gjkEpaDetector; + this.detectors[cy][ca] = gjkEpaDetector; + this.detectors[cy][ch] = gjkEpaDetector; + this.detectors[co][sp] = gjkEpaDetector; + this.detectors[co][bo] = gjkEpaDetector; + this.detectors[co][cy] = gjkEpaDetector; + this.detectors[co][co] = gjkEpaDetector; + this.detectors[co][ca] = gjkEpaDetector; + this.detectors[co][ch] = gjkEpaDetector; + this.detectors[ca][sp] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(true); + this.detectors[ca][bo] = gjkEpaDetector; + this.detectors[ca][cy] = gjkEpaDetector; + this.detectors[ca][co] = gjkEpaDetector; + this.detectors[ca][ca] = new oimo.collision.narrowphase.detector.CapsuleCapsuleDetector(); + this.detectors[ca][ch] = gjkEpaDetector; + this.detectors[ch][sp] = gjkEpaDetector; + this.detectors[ch][bo] = gjkEpaDetector; + this.detectors[ch][cy] = gjkEpaDetector; + this.detectors[ch][co] = gjkEpaDetector; + this.detectors[ch][ca] = gjkEpaDetector; + this.detectors[ch][ch] = gjkEpaDetector; + } + getDetector(geomType1,geomType2) { + return this.detectors[geomType1][geomType2]; + } +} +oimo.collision.narrowphase.DetectorResult = class oimo_collision_narrowphase_DetectorResult { + constructor() { + this.numPoints = 0; + this.normal = new oimo.common.Vec3(); + var this1 = new Array(oimo.common.Setting.maxManifoldPoints); + this.points = this1; + this.incremental = false; + var _g = 0; + var _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) { + var i = _g++; + this.points[i] = new oimo.collision.narrowphase.DetectorResultPoint(); + } + } + getMaxDepth() { + var max = 0; + var _g = 0; + var _g1 = this.numPoints; + while(_g < _g1) { + var i = _g++; + if(this.points[i].depth > max) { + max = this.points[i].depth; + } + } + return max; + } + clear() { + this.numPoints = 0; + var _g = 0; + var _g1 = this.points; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.position1.zero(); + p.position2.zero(); + p.depth = 0; + p.id = 0; + } + this.normal.zero(); + } +} +oimo.collision.narrowphase.DetectorResultPoint = class oimo_collision_narrowphase_DetectorResultPoint { + constructor() { + this.position1 = new oimo.common.Vec3(); + this.position2 = new oimo.common.Vec3(); + this.depth = 0; + this.id = 0; + } +} +if(!oimo.collision.narrowphase.detector) oimo.collision.narrowphase.detector = {}; +oimo.collision.narrowphase.detector.Detector = class oimo_collision_narrowphase_detector_Detector { + constructor(swapped) { + this.swapped = swapped; + } + setNormal(result,nX,nY,nZ) { + var v = result.normal; + v.x = nX; + v.y = nY; + v.z = nZ; + if(this.swapped) { + var _this = result.normal; + var tx = -_this.x; + var ty = -_this.y; + var tz = -_this.z; + _this.x = tx; + _this.y = ty; + _this.z = tz; + } + } + addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { + var p = result.points[result.numPoints++]; + p.depth = depth; + p.id = id; + if(this.swapped) { + var v = p.position1; + v.x = pos2X; + v.y = pos2Y; + v.z = pos2Z; + var v1 = p.position2; + v1.x = pos1X; + v1.y = pos1Y; + v1.z = pos1Z; + } else { + var v2 = p.position1; + v2.x = pos1X; + v2.y = pos1Y; + v2.z = pos1Z; + var v3 = p.position2; + v3.x = pos2X; + v3.y = pos2Y; + v3.z = pos2Z; + } + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + } + detect(result,geom1,geom2,transform1,transform2,cachedData) { + result.numPoints = 0; + var _g = 0; + var _g1 = result.points; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; + p.position1.zero(); + p.position2.zero(); + p.depth = 0; + p.id = 0; + } + result.normal.zero(); + if(this.swapped) { + this.detectImpl(result,geom2,geom1,transform2,transform1,cachedData); + } else { + this.detectImpl(result,geom1,geom2,transform1,transform2,cachedData); + } + } +} +oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrowphase_detector_BoxBoxDetector extends oimo.collision.narrowphase.detector.Detector { + constructor() { + super(false); + this.clipper = new oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper(); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var b1 = geom1; + var b2 = geom2; + result.incremental = false; + var c1; + var c1X; + var c1Y; + var c1Z; + var c2; + var c2X; + var c2Y; + var c2Z; + var c12; + var c12X; + var c12Y; + var c12Z; + c1X = tf1._positionX; + c1Y = tf1._positionY; + c1Z = tf1._positionZ; + c2X = tf2._positionX; + c2Y = tf2._positionY; + c2Z = tf2._positionZ; + c12X = c2X - c1X; + c12Y = c2Y - c1Y; + c12Z = c2Z - c1Z; + var x1; + var x1X; + var x1Y; + var x1Z; + var y1; + var y1X; + var y1Y; + var y1Z; + var z1; + var z1X; + var z1Y; + var z1Z; + var x2; + var x2X; + var x2Y; + var x2Z; + var y2; + var y2X; + var y2Y; + var y2Z; + var z2; + var z2X; + var z2Y; + var z2Z; + x1X = tf1._rotation00; + x1Y = tf1._rotation10; + x1Z = tf1._rotation20; + y1X = tf1._rotation01; + y1Y = tf1._rotation11; + y1Z = tf1._rotation21; + z1X = tf1._rotation02; + z1Y = tf1._rotation12; + z1Z = tf1._rotation22; + x2X = tf2._rotation00; + x2Y = tf2._rotation10; + x2Z = tf2._rotation20; + y2X = tf2._rotation01; + y2Y = tf2._rotation11; + y2Z = tf2._rotation21; + z2X = tf2._rotation02; + z2Y = tf2._rotation12; + z2Z = tf2._rotation22; + var w1 = b1._halfExtentsX; + var h1 = b1._halfExtentsY; + var d1 = b1._halfExtentsZ; + var w2 = b2._halfExtentsX; + var h2 = b2._halfExtentsY; + var d2 = b2._halfExtentsZ; + var sx1; + var sx1X; + var sx1Y; + var sx1Z; + var sy1; + var sy1X; + var sy1Y; + var sy1Z; + var sz1; + var sz1X; + var sz1Y; + var sz1Z; + var sx2; + var sx2X; + var sx2Y; + var sx2Z; + var sy2; + var sy2X; + var sy2Y; + var sy2Z; + var sz2; + var sz2X; + var sz2Y; + var sz2Z; + sx1X = x1X * w1; + sx1Y = x1Y * w1; + sx1Z = x1Z * w1; + sy1X = y1X * h1; + sy1Y = y1Y * h1; + sy1Z = y1Z * h1; + sz1X = z1X * d1; + sz1Y = z1Y * d1; + sz1Z = z1Z * d1; + sx2X = x2X * w2; + sx2Y = x2Y * w2; + sx2Z = x2Z * w2; + sy2X = y2X * h2; + sy2Y = y2Y * h2; + sy2Z = y2Z * h2; + sz2X = z2X * d2; + sz2Y = z2Y * d2; + sz2Z = z2Z * d2; + var projSum; + var projC12Abs; + var mDepth = 1e65536; + var mId = -1; + var mSign = 0; + var mAxis; + var mAxisX; + var mAxisY; + var mAxisZ; + mAxisX = 0; + mAxisY = 0; + mAxisZ = 0; + var proj1 = w1; + var dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; + var dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; + var dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + if(dz < 0) { + dz = -dz; + } + var proj2 = dx + dy + dz; + var projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; + mId = 0; + mAxisX = x1X; + mAxisY = x1Y; + mAxisZ = x1Z; + mSign = neg ? -1 : 1; + } + } else { + return; + } + proj1 = h1; + var dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; + var dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; + var dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + if(dz1 < 0) { + dz1 = -dz1; + } + proj2 = dx1 + dy1 + dz1; + projC12 = y1X * c12X + y1Y * c12Y + y1Z * c12Z; + var sum1 = proj1 + proj2; + var neg1 = projC12 < 0; + var abs1 = neg1 ? -projC12 : projC12; + if(abs1 < sum1) { + var depth1 = sum1 - abs1; + if(depth1 < mDepth) { + mDepth = depth1; + mId = 1; + mAxisX = y1X; + mAxisY = y1Y; + mAxisZ = y1Z; + mSign = neg1 ? -1 : 1; + } + } else { + return; + } + proj1 = d1; + var dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; + var dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; + var dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; + if(dx2 < 0) { + dx2 = -dx2; + } + if(dy2 < 0) { + dy2 = -dy2; + } + if(dz2 < 0) { + dz2 = -dz2; + } + proj2 = dx2 + dy2 + dz2; + projC12 = z1X * c12X + z1Y * c12Y + z1Z * c12Z; + var sum2 = proj1 + proj2; + var neg2 = projC12 < 0; + var abs2 = neg2 ? -projC12 : projC12; + if(abs2 < sum2) { + var depth2 = sum2 - abs2; + if(depth2 < mDepth) { + mDepth = depth2; + mId = 2; + mAxisX = z1X; + mAxisY = z1Y; + mAxisZ = z1Z; + mSign = neg2 ? -1 : 1; + } + } else { + return; + } + if(mDepth > oimo.common.Setting.linearSlop) { + mDepth -= oimo.common.Setting.linearSlop; + } else { + mDepth = 0; + } + var dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; + var dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; + var dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; + if(dx3 < 0) { + dx3 = -dx3; + } + if(dy3 < 0) { + dy3 = -dy3; + } + if(dz3 < 0) { + dz3 = -dz3; + } + proj1 = dx3 + dy3 + dz3; + proj2 = w2; + projC12 = x2X * c12X + x2Y * c12Y + x2Z * c12Z; + var sum3 = proj1 + proj2; + var neg3 = projC12 < 0; + var abs3 = neg3 ? -projC12 : projC12; + if(abs3 < sum3) { + var depth3 = sum3 - abs3; + if(depth3 < mDepth) { + mDepth = depth3; + mId = 3; + mAxisX = x2X; + mAxisY = x2Y; + mAxisZ = x2Z; + mSign = neg3 ? -1 : 1; + } + } else { + return; + } + var dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; + var dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; + var dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; + if(dx4 < 0) { + dx4 = -dx4; + } + if(dy4 < 0) { + dy4 = -dy4; + } + if(dz4 < 0) { + dz4 = -dz4; + } + proj1 = dx4 + dy4 + dz4; + proj2 = h2; + projC12 = y2X * c12X + y2Y * c12Y + y2Z * c12Z; + var sum4 = proj1 + proj2; + var neg4 = projC12 < 0; + var abs4 = neg4 ? -projC12 : projC12; + if(abs4 < sum4) { + var depth4 = sum4 - abs4; + if(depth4 < mDepth) { + mDepth = depth4; + mId = 4; + mAxisX = y2X; + mAxisY = y2Y; + mAxisZ = y2Z; + mSign = neg4 ? -1 : 1; + } + } else { + return; + } + var dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; + var dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; + var dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; + if(dx5 < 0) { + dx5 = -dx5; + } + if(dy5 < 0) { + dy5 = -dy5; + } + if(dz5 < 0) { + dz5 = -dz5; + } + proj1 = dx5 + dy5 + dz5; + proj2 = d2; + projC12 = z2X * c12X + z2Y * c12Y + z2Z * c12Z; + var sum5 = proj1 + proj2; + var neg5 = projC12 < 0; + var abs5 = neg5 ? -projC12 : projC12; + if(abs5 < sum5) { + var depth5 = sum5 - abs5; + if(depth5 < mDepth) { + mDepth = depth5; + mId = 5; + mAxisX = z2X; + mAxisY = z2Y; + mAxisZ = z2Z; + mSign = neg5 ? -1 : 1; + } + } else { + return; + } + if(mDepth > oimo.common.Setting.linearSlop) { + mDepth -= oimo.common.Setting.linearSlop; + } else { + mDepth = 0; + } + var edgeAxis; + var edgeAxisX; + var edgeAxisY; + var edgeAxisZ; + edgeAxisX = x1Y * x2Z - x1Z * x2Y; + edgeAxisY = x1Z * x2X - x1X * x2Z; + edgeAxisZ = x1X * x2Y - x1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx6 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy6 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx6 < 0) { + dx6 = -dx6; + } + if(dy6 < 0) { + dy6 = -dy6; + } + proj1 = dx6 + dy6; + var dx7 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy7 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx7 < 0) { + dx7 = -dx7; + } + if(dy7 < 0) { + dy7 = -dy7; + } + proj2 = dx7 + dy7; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum6 = proj1 + proj2; + var neg6 = projC12 < 0; + var abs6 = neg6 ? -projC12 : projC12; + if(abs6 < sum6) { + var depth6 = sum6 - abs6; + if(depth6 < mDepth) { + mDepth = depth6; + mId = 6; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg6 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = x1Y * y2Z - x1Z * y2Y; + edgeAxisY = x1Z * y2X - x1X * y2Z; + edgeAxisZ = x1X * y2Y - x1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l1 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + edgeAxisX *= l1; + edgeAxisY *= l1; + edgeAxisZ *= l1; + var dx8 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy8 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx8 < 0) { + dx8 = -dx8; + } + if(dy8 < 0) { + dy8 = -dy8; + } + proj1 = dx8 + dy8; + var dx9 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy9 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx9 < 0) { + dx9 = -dx9; + } + if(dy9 < 0) { + dy9 = -dy9; + } + proj2 = dx9 + dy9; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum7 = proj1 + proj2; + var neg7 = projC12 < 0; + var abs7 = neg7 ? -projC12 : projC12; + if(abs7 < sum7) { + var depth7 = sum7 - abs7; + if(depth7 < mDepth) { + mDepth = depth7; + mId = 7; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg7 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = x1Y * z2Z - x1Z * z2Y; + edgeAxisY = x1Z * z2X - x1X * z2Z; + edgeAxisZ = x1X * z2Y - x1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l2 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + edgeAxisX *= l2; + edgeAxisY *= l2; + edgeAxisZ *= l2; + var dx10 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy10 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx10 < 0) { + dx10 = -dx10; + } + if(dy10 < 0) { + dy10 = -dy10; + } + proj1 = dx10 + dy10; + var dx11 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy11 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx11 < 0) { + dx11 = -dx11; + } + if(dy11 < 0) { + dy11 = -dy11; + } + proj2 = dx11 + dy11; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum8 = proj1 + proj2; + var neg8 = projC12 < 0; + var abs8 = neg8 ? -projC12 : projC12; + if(abs8 < sum8) { + var depth8 = sum8 - abs8; + if(depth8 < mDepth) { + mDepth = depth8; + mId = 8; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg8 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * x2Z - y1Z * x2Y; + edgeAxisY = y1Z * x2X - y1X * x2Z; + edgeAxisZ = y1X * x2Y - y1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l3 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + edgeAxisX *= l3; + edgeAxisY *= l3; + edgeAxisZ *= l3; + var dx12 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy12 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx12 < 0) { + dx12 = -dx12; + } + if(dy12 < 0) { + dy12 = -dy12; + } + proj1 = dx12 + dy12; + var dx13 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy13 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx13 < 0) { + dx13 = -dx13; + } + if(dy13 < 0) { + dy13 = -dy13; + } + proj2 = dx13 + dy13; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum9 = proj1 + proj2; + var neg9 = projC12 < 0; + var abs9 = neg9 ? -projC12 : projC12; + if(abs9 < sum9) { + var depth9 = sum9 - abs9; + if(depth9 < mDepth) { + mDepth = depth9; + mId = 9; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg9 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * y2Z - y1Z * y2Y; + edgeAxisY = y1Z * y2X - y1X * y2Z; + edgeAxisZ = y1X * y2Y - y1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l4 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + edgeAxisX *= l4; + edgeAxisY *= l4; + edgeAxisZ *= l4; + var dx14 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy14 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx14 < 0) { + dx14 = -dx14; + } + if(dy14 < 0) { + dy14 = -dy14; + } + proj1 = dx14 + dy14; + var dx15 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy15 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx15 < 0) { + dx15 = -dx15; + } + if(dy15 < 0) { + dy15 = -dy15; + } + proj2 = dx15 + dy15; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum10 = proj1 + proj2; + var neg10 = projC12 < 0; + var abs10 = neg10 ? -projC12 : projC12; + if(abs10 < sum10) { + var depth10 = sum10 - abs10; + if(depth10 < mDepth) { + mDepth = depth10; + mId = 10; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg10 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = y1Y * z2Z - y1Z * z2Y; + edgeAxisY = y1Z * z2X - y1X * z2Z; + edgeAxisZ = y1X * z2Y - y1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l5 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + edgeAxisX *= l5; + edgeAxisY *= l5; + edgeAxisZ *= l5; + var dx16 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy16 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx16 < 0) { + dx16 = -dx16; + } + if(dy16 < 0) { + dy16 = -dy16; + } + proj1 = dx16 + dy16; + var dx17 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy17 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx17 < 0) { + dx17 = -dx17; + } + if(dy17 < 0) { + dy17 = -dy17; + } + proj2 = dx17 + dy17; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum11 = proj1 + proj2; + var neg11 = projC12 < 0; + var abs11 = neg11 ? -projC12 : projC12; + if(abs11 < sum11) { + var depth11 = sum11 - abs11; + if(depth11 < mDepth) { + mDepth = depth11; + mId = 11; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg11 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * x2Z - z1Z * x2Y; + edgeAxisY = z1Z * x2X - z1X * x2Z; + edgeAxisZ = z1X * x2Y - z1Y * x2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l6 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l6 > 0) { + l6 = 1 / Math.sqrt(l6); + } + edgeAxisX *= l6; + edgeAxisY *= l6; + edgeAxisZ *= l6; + var dx18 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy18 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx18 < 0) { + dx18 = -dx18; + } + if(dy18 < 0) { + dy18 = -dy18; + } + proj1 = dx18 + dy18; + var dx19 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy19 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx19 < 0) { + dx19 = -dx19; + } + if(dy19 < 0) { + dy19 = -dy19; + } + proj2 = dx19 + dy19; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum12 = proj1 + proj2; + var neg12 = projC12 < 0; + var abs12 = neg12 ? -projC12 : projC12; + if(abs12 < sum12) { + var depth12 = sum12 - abs12; + if(depth12 < mDepth) { + mDepth = depth12; + mId = 12; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg12 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * y2Z - z1Z * y2Y; + edgeAxisY = z1Z * y2X - z1X * y2Z; + edgeAxisZ = z1X * y2Y - z1Y * y2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l7 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l7 > 0) { + l7 = 1 / Math.sqrt(l7); + } + edgeAxisX *= l7; + edgeAxisY *= l7; + edgeAxisZ *= l7; + var dx20 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy20 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx20 < 0) { + dx20 = -dx20; + } + if(dy20 < 0) { + dy20 = -dy20; + } + proj1 = dx20 + dy20; + var dx21 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy21 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx21 < 0) { + dx21 = -dx21; + } + if(dy21 < 0) { + dy21 = -dy21; + } + proj2 = dx21 + dy21; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum13 = proj1 + proj2; + var neg13 = projC12 < 0; + var abs13 = neg13 ? -projC12 : projC12; + if(abs13 < sum13) { + var depth13 = sum13 - abs13; + if(depth13 < mDepth) { + mDepth = depth13; + mId = 13; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg13 ? -1 : 1; + } + } else { + return; + } + } + edgeAxisX = z1Y * z2Z - z1Z * z2Y; + edgeAxisY = z1Z * z2X - z1X * z2Z; + edgeAxisZ = z1X * z2Y - z1Y * z2X; + if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { + var l8 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l8 > 0) { + l8 = 1 / Math.sqrt(l8); + } + edgeAxisX *= l8; + edgeAxisY *= l8; + edgeAxisZ *= l8; + var dx22 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy22 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx22 < 0) { + dx22 = -dx22; + } + if(dy22 < 0) { + dy22 = -dy22; + } + proj1 = dx22 + dy22; + var dx23 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy23 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx23 < 0) { + dx23 = -dx23; + } + if(dy23 < 0) { + dy23 = -dy23; + } + proj2 = dx23 + dy23; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + var sum14 = proj1 + proj2; + var neg14 = projC12 < 0; + var abs14 = neg14 ? -projC12 : projC12; + if(abs14 < sum14) { + var depth14 = sum14 - abs14; + if(depth14 < mDepth) { + mDepth = depth14; + mId = 14; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg14 ? -1 : 1; + } + } else { + return; + } + } + if(mId >= 6) { + mAxisX *= mSign; + mAxisY *= mSign; + mAxisZ *= mSign; + var id1 = (mId - 6) / 3 | 0; + var id2 = mId - 6 - id1 * 3; + var p1; + var p1X; + var p1Y; + var p1Z; + var p2; + var p2X; + var p2Y; + var p2Z; + var d11; + var d1X; + var d1Y; + var d1Z; + var d21; + var d2X; + var d2Y; + var d2Z; + switch(id1) { + case 0: + d1X = x1X; + d1Y = x1Y; + d1Z = x1Z; + var signX = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(signX) { + if(signY) { + p1X = sy1X + sz1X; + p1Y = sy1Y + sz1Y; + p1Z = sy1Z + sz1Z; + } else { + p1X = sy1X - sz1X; + p1Y = sy1Y - sz1Y; + p1Z = sy1Z - sz1Z; + } + } else if(signY) { + p1X = sz1X - sy1X; + p1Y = sz1Y - sy1Y; + p1Z = sz1Z - sy1Z; + } else { + p1X = sy1X + sz1X; + p1Y = sy1Y + sz1Y; + p1Z = sy1Z + sz1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + break; + case 1: + d1X = y1X; + d1Y = y1Y; + d1Z = y1Z; + var signX1 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; + var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(signX1) { + if(signY1) { + p1X = sx1X + sz1X; + p1Y = sx1Y + sz1Y; + p1Z = sx1Z + sz1Z; + } else { + p1X = sx1X - sz1X; + p1Y = sx1Y - sz1Y; + p1Z = sx1Z - sz1Z; + } + } else if(signY1) { + p1X = sz1X - sx1X; + p1Y = sz1Y - sx1Y; + p1Z = sz1Z - sx1Z; + } else { + p1X = sx1X + sz1X; + p1Y = sx1Y + sz1Y; + p1Z = sx1Z + sz1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + break; + default: + d1X = z1X; + d1Y = z1Y; + d1Z = z1Z; + var signX2 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; + var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + if(signX2) { + if(signY2) { + p1X = sx1X + sy1X; + p1Y = sx1Y + sy1Y; + p1Z = sx1Z + sy1Z; + } else { + p1X = sx1X - sy1X; + p1Y = sx1Y - sy1Y; + p1Z = sx1Z - sy1Z; + } + } else if(signY2) { + p1X = sy1X - sx1X; + p1Y = sy1Y - sx1Y; + p1Z = sy1Z - sx1Z; + } else { + p1X = sx1X + sy1X; + p1Y = sx1Y + sy1Y; + p1Z = sx1Z + sy1Z; + p1X = -p1X; + p1Y = -p1Y; + p1Z = -p1Z; + } + } + p1X = c1X + p1X; + p1Y = c1Y + p1Y; + p1Z = c1Z + p1Z; + switch(id2) { + case 0: + d2X = x2X; + d2Y = x2Y; + d2Z = x2Z; + var signX3 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(signX3) { + if(signY3) { + p2X = sy2X + sz2X; + p2Y = sy2Y + sz2Y; + p2Z = sy2Z + sz2Z; + } else { + p2X = sy2X - sz2X; + p2Y = sy2Y - sz2Y; + p2Z = sy2Z - sz2Z; + } + } else if(signY3) { + p2X = sz2X - sy2X; + p2Y = sz2Y - sy2Y; + p2Z = sz2Z - sy2Z; + } else { + p2X = sy2X + sz2X; + p2Y = sy2Y + sz2Y; + p2Z = sy2Z + sz2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + break; + case 1: + d2X = y2X; + d2Y = y2Y; + d2Z = y2Z; + var signX4 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; + var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(signX4) { + if(signY4) { + p2X = sx2X + sz2X; + p2Y = sx2Y + sz2Y; + p2Z = sx2Z + sz2Z; + } else { + p2X = sx2X - sz2X; + p2Y = sx2Y - sz2Y; + p2Z = sx2Z - sz2Z; + } + } else if(signY4) { + p2X = sz2X - sx2X; + p2Y = sz2Y - sx2Y; + p2Z = sz2Z - sx2Z; + } else { + p2X = sx2X + sz2X; + p2Y = sx2Y + sz2Y; + p2Z = sx2Z + sz2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + break; + default: + d2X = z2X; + d2Y = z2Y; + d2Z = z2Z; + var signX5 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; + var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + if(signX5) { + if(signY5) { + p2X = sx2X + sy2X; + p2Y = sx2Y + sy2Y; + p2Z = sx2Z + sy2Z; + } else { + p2X = sx2X - sy2X; + p2Y = sx2Y - sy2Y; + p2Z = sx2Z - sy2Z; + } + } else if(signY5) { + p2X = sy2X - sx2X; + p2Y = sy2Y - sx2Y; + p2Z = sy2Z - sx2Z; + } else { + p2X = sx2X + sy2X; + p2Y = sx2Y + sy2Y; + p2Z = sx2Z + sy2Z; + p2X = -p2X; + p2Y = -p2Y; + p2Z = -p2Z; + } + } + p2X = c2X - p2X; + p2Y = c2Y - p2Y; + p2Z = c2Z - p2Z; + var r; + var rX; + var rY; + var rZ; + rX = p1X - p2X; + rY = p1Y - p2Y; + rZ = p1Z - p2Z; + var dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + var dot1r = d1X * rX + d1Y * rY + d1Z * rZ; + var dot2r = d2X * rX + d2Y * rY + d2Z * rZ; + var invDet = 1 / (1 - dot12 * dot12); + var t1 = (dot12 * dot2r - dot1r) * invDet; + var t2 = (dot2r - dot12 * dot1r) * invDet; + var cp1; + var cp1X; + var cp1Y; + var cp1Z; + var cp2; + var cp2X; + var cp2Y; + var cp2Z; + cp1X = p1X + d1X * t1; + cp1Y = p1Y + d1Y * t1; + cp1Z = p1Z + d1Z * t1; + cp2X = p2X + d2X * t2; + cp2Y = p2Y + d2Y * t2; + cp2Z = p2Z + d2Z * t2; + var normal; + var normalX; + var normalY; + var normalZ; + normalX = -mAxisX; + normalY = -mAxisY; + normalZ = -mAxisZ; + this.setNormal(result,normalX,normalY,normalZ); + this.addPoint(result,cp1X,cp1Y,cp1Z,cp2X,cp2Y,cp2Z,mDepth,4); + return; + } + var tmp; + var tmpX; + var tmpY; + var tmpZ; + var swapped; + if(mId >= 3) { + mSign = -mSign; + c12X = -c12X; + c12Y = -c12Y; + c12Z = -c12Z; + var tmp1 = b1; + b1 = b2; + b2 = tmp1; + var tmp2 = w1; + w1 = w2; + w2 = tmp2; + var tmp3 = h1; + h1 = h2; + h2 = tmp3; + var tmp4 = d1; + d1 = d2; + d2 = tmp4; + tmpX = c1X; + tmpY = c1Y; + tmpZ = c1Z; + c1X = c2X; + c1Y = c2Y; + c1Z = c2Z; + c2X = tmpX; + c2Y = tmpY; + c2Z = tmpZ; + tmpX = x1X; + tmpY = x1Y; + tmpZ = x1Z; + x1X = x2X; + x1Y = x2Y; + x1Z = x2Z; + x2X = tmpX; + x2Y = tmpY; + x2Z = tmpZ; + tmpX = y1X; + tmpY = y1Y; + tmpZ = y1Z; + y1X = y2X; + y1Y = y2Y; + y1Z = y2Z; + y2X = tmpX; + y2Y = tmpY; + y2Z = tmpZ; + tmpX = z1X; + tmpY = z1Y; + tmpZ = z1Z; + z1X = z2X; + z1Y = z2Y; + z1Z = z2Z; + z2X = tmpX; + z2Y = tmpY; + z2Z = tmpZ; + tmpX = sx1X; + tmpY = sx1Y; + tmpZ = sx1Z; + sx1X = sx2X; + sx1Y = sx2Y; + sx1Z = sx2Z; + sx2X = tmpX; + sx2Y = tmpY; + sx2Z = tmpZ; + tmpX = sy1X; + tmpY = sy1Y; + tmpZ = sy1Z; + sy1X = sy2X; + sy1Y = sy2Y; + sy1Z = sy2Z; + sy2X = tmpX; + sy2Y = tmpY; + sy2Z = tmpZ; + tmpX = sz1X; + tmpY = sz1Y; + tmpZ = sz1Z; + sz1X = sz2X; + sz1Y = sz2Y; + sz1Z = sz2Z; + sz2X = tmpX; + sz2Y = tmpY; + sz2Z = tmpZ; + mId -= 3; + swapped = true; + } else { + swapped = false; + } + var refCenter; + var refCenterX; + var refCenterY; + var refCenterZ; + var refNormal; + var refNormalX; + var refNormalY; + var refNormalZ; + var refX; + var refXX; + var refXY; + var refXZ; + var refY; + var refYX; + var refYY; + var refYZ; + var refW; + var refH; + switch(mId) { + case 0: + refCenterX = sx1X; + refCenterY = sx1Y; + refCenterZ = sx1Z; + refNormalX = x1X; + refNormalY = x1Y; + refNormalZ = x1Z; + refXX = y1X; + refXY = y1Y; + refXZ = y1Z; + refYX = z1X; + refYY = z1Y; + refYZ = z1Z; + refW = h1; + refH = d1; + break; + case 1: + refCenterX = sy1X; + refCenterY = sy1Y; + refCenterZ = sy1Z; + refNormalX = y1X; + refNormalY = y1Y; + refNormalZ = y1Z; + refXX = z1X; + refXY = z1Y; + refXZ = z1Z; + refYX = x1X; + refYY = x1Y; + refYZ = x1Z; + refW = d1; + refH = w1; + break; + default: + refCenterX = sz1X; + refCenterY = sz1Y; + refCenterZ = sz1Z; + refNormalX = z1X; + refNormalY = z1Y; + refNormalZ = z1Z; + refXX = x1X; + refXY = x1Y; + refXZ = x1Z; + refYX = y1X; + refYY = y1Y; + refYZ = y1Z; + refW = w1; + refH = h1; + } + if(mSign < 0) { + refCenterX = -refCenterX; + refCenterY = -refCenterY; + refCenterZ = -refCenterZ; + refNormalX = -refNormalX; + refNormalY = -refNormalY; + refNormalZ = -refNormalZ; + tmpX = refXX; + tmpY = refXY; + tmpZ = refXZ; + refXX = refYX; + refXY = refYY; + refXZ = refYZ; + refYX = tmpX; + refYY = tmpY; + refYZ = tmpZ; + var tmp5 = refW; + refW = refH; + refH = tmp5; + } + refCenterX += c1X; + refCenterY += c1Y; + refCenterZ += c1Z; + var minIncDot = 1; + var incId = 0; + var incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 0; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 1; + } + incDot = refNormalX * y2X + refNormalY * y2Y + refNormalZ * y2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 2; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 3; + } + incDot = refNormalX * z2X + refNormalY * z2Y + refNormalZ * z2Z; + if(incDot < minIncDot) { + minIncDot = incDot; + incId = 4; + } + if(-incDot < minIncDot) { + minIncDot = -incDot; + incId = 5; + } + var incV1; + var incV1X; + var incV1Y; + var incV1Z; + var incV2; + var incV2X; + var incV2Y; + var incV2Z; + var incV3; + var incV3X; + var incV3Y; + var incV3Z; + var incV4; + var incV4X; + var incV4Y; + var incV4Z; + switch(incId) { + case 0: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X - sy2X; + incV2Y = sx2Y - sy2Y; + incV2Z = sx2Z - sy2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X - sy2X; + incV3Y = sx2Y - sy2Y; + incV3Z = sx2Z - sy2Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X + sy2X; + incV4Y = sx2Y + sy2Y; + incV4Z = sx2Z + sy2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + break; + case 1: + incV1X = sy2X - sx2X; + incV1Y = sy2Y - sx2Y; + incV1Z = sy2Z - sx2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sy2X - sx2X; + incV2Y = sy2Y - sx2Y; + incV2Z = sy2Z - sx2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X + sy2X; + incV4Y = sx2Y + sy2Y; + incV4Z = sx2Z + sy2Z; + incV4X = -incV4X; + incV4Y = -incV4Y; + incV4Z = -incV4Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + case 2: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X + sy2X; + incV2Y = sx2Y + sy2Y; + incV2Z = sx2Z + sy2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sy2X - sx2X; + incV3Y = sy2Y - sx2Y; + incV3Z = sy2Z - sx2Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sy2X - sx2X; + incV4Y = sy2Y - sx2Y; + incV4Z = sy2Z - sx2Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + case 3: + incV1X = sx2X - sy2X; + incV1Y = sx2Y - sy2Y; + incV1Z = sx2Z - sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sx2X + sy2X; + incV2Y = sx2Y + sy2Y; + incV2Z = sx2Z + sy2Z; + incV2X = -incV2X; + incV2Y = -incV2Y; + incV2Z = -incV2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sx2X - sy2X; + incV4Y = sx2Y - sy2Y; + incV4Z = sx2Z - sy2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + break; + case 4: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X += sz2X; + incV1Y += sz2Y; + incV1Z += sz2Z; + incV2X = sy2X - sx2X; + incV2Y = sy2Y - sx2Y; + incV2Z = sy2Z - sx2Z; + incV2X += sz2X; + incV2Y += sz2Y; + incV2Z += sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X += sz2X; + incV3Y += sz2Y; + incV3Z += sz2Z; + incV4X = sx2X - sy2X; + incV4Y = sx2Y - sy2Y; + incV4Z = sx2Z - sy2Z; + incV4X += sz2X; + incV4Y += sz2Y; + incV4Z += sz2Z; + break; + default: + incV1X = sx2X + sy2X; + incV1Y = sx2Y + sy2Y; + incV1Z = sx2Z + sy2Z; + incV1X -= sz2X; + incV1Y -= sz2Y; + incV1Z -= sz2Z; + incV2X = sx2X - sy2X; + incV2Y = sx2Y - sy2Y; + incV2Z = sx2Z - sy2Z; + incV2X -= sz2X; + incV2Y -= sz2Y; + incV2Z -= sz2Z; + incV3X = sx2X + sy2X; + incV3Y = sx2Y + sy2Y; + incV3Z = sx2Z + sy2Z; + incV3X = -incV3X; + incV3Y = -incV3Y; + incV3Z = -incV3Z; + incV3X -= sz2X; + incV3Y -= sz2Y; + incV3Z -= sz2Z; + incV4X = sy2X - sx2X; + incV4Y = sy2Y - sx2Y; + incV4Z = sy2Z - sx2Z; + incV4X -= sz2X; + incV4Y -= sz2Y; + incV4Z -= sz2Z; + } + incV1X += c12X; + incV1Y += c12Y; + incV1Z += c12Z; + incV2X += c12X; + incV2Y += c12Y; + incV2Z += c12Z; + incV3X += c12X; + incV3Y += c12Y; + incV3Z += c12Z; + incV4X += c12X; + incV4Y += c12Y; + incV4Z += c12Z; + var _this = this.clipper; + _this.w = refW; + _this.h = refH; + _this.numVertices = 0; + _this.numTmpVertices = 0; + var _this1 = this.clipper; + var _this2 = _this1.vertices[_this1.numVertices++]; + _this2.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; + _this2.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; + _this2.wx = incV1X; + _this2.wy = incV1Y; + _this2.wz = incV1Z; + var _this3 = this.clipper; + var _this4 = _this3.vertices[_this3.numVertices++]; + _this4.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; + _this4.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; + _this4.wx = incV2X; + _this4.wy = incV2Y; + _this4.wz = incV2Z; + var _this5 = this.clipper; + var _this6 = _this5.vertices[_this5.numVertices++]; + _this6.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; + _this6.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; + _this6.wx = incV3X; + _this6.wy = incV3Y; + _this6.wz = incV3Z; + var _this7 = this.clipper; + var _this8 = _this7.vertices[_this7.numVertices++]; + _this8.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; + _this8.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; + _this8.wx = incV4X; + _this8.wy = incV4Y; + _this8.wz = incV4Z; + this.clipper.clip(); + this.clipper.reduce(); + var normal1; + var normalX1; + var normalY1; + var normalZ1; + if(swapped) { + normalX1 = refNormalX; + normalY1 = refNormalY; + normalZ1 = refNormalZ; + } else { + normalX1 = -refNormalX; + normalY1 = -refNormalY; + normalZ1 = -refNormalZ; + } + this.setNormal(result,normalX1,normalY1,normalZ1); + var _g = 0; + var _g1 = this.clipper.numVertices; + while(_g < _g1) { + var i = _g++; + var v = this.clipper.vertices[i]; + var clippedVertex; + var clippedVertexX; + var clippedVertexY; + var clippedVertexZ; + clippedVertexX = v.wx; + clippedVertexY = v.wy; + clippedVertexZ = v.wz; + clippedVertexX += c1X; + clippedVertexY += c1Y; + clippedVertexZ += c1Z; + var clippedVertexToRefCenter; + var clippedVertexToRefCenterX; + var clippedVertexToRefCenterY; + var clippedVertexToRefCenterZ; + clippedVertexToRefCenterX = refCenterX - clippedVertexX; + clippedVertexToRefCenterY = refCenterY - clippedVertexY; + clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; + var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; + var clippedVertexOnRefFace; + var clippedVertexOnRefFaceX; + var clippedVertexOnRefFaceY; + var clippedVertexOnRefFaceZ; + clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth15; + clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth15; + clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth15; + if(depth15 > -oimo.common.Setting.contactPersistenceThreshold) { + if(swapped) { + this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth15,i); + } else { + this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth15,i); + } + } + } + } +} +if(!oimo.collision.narrowphase.detector._BoxBoxDetector) oimo.collision.narrowphase.detector._BoxBoxDetector = {}; +oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex = class oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex { + constructor() { + this.x = 0; + this.y = 0; + this.wx = 0; + this.wy = 0; + this.wz = 0; + } +} +oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper { + constructor() { + this.w = 0; + this.h = 0; + this.numVertices = 0; + this.numTmpVertices = 0; + var this1 = new Array(8); + this.vertices = this1; + var this2 = new Array(8); + this.tmpVertices = this2; + this.vertices[0] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[0] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[1] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[1] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[2] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[2] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[3] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[3] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[4] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[4] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[5] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[5] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[6] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[6] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.vertices[7] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + this.tmpVertices[7] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); + } + clip() { + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this.vertices[i]; + var v2 = this.vertices[(i + 1) % this.numVertices]; + var s1 = this.w + v1.x; + var s2 = this.w + v2.x; + if(s1 > 0 && s2 > 0) { + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.wx = v1.wx; + _this1.wy = v1.wy; + _this1.wz = v1.wz; + var t = s1 / (s1 - s2); + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = v1.x + (v2.x - v1.x) * t; + _this2.y = v1.y + (v2.y - v1.y) * t; + _this2.wx = v1.wx + (v2.wx - v1.wx) * t; + _this2.wy = v1.wy + (v2.wy - v1.wy) * t; + _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + var t1 = s1 / (s1 - s2); + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = v1.x + (v2.x - v1.x) * t1; + _this3.y = v1.y + (v2.y - v1.y) * t1; + _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; + _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; + _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + } + } + var tmp = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g2 = 0; + var _g11 = this.numVertices; + while(_g2 < _g11) { + var i1 = _g2++; + var v11 = this.vertices[i1]; + var v21 = this.vertices[(i1 + 1) % this.numVertices]; + var s11 = this.w - v11.x; + var s21 = this.w - v21.x; + if(s11 > 0 && s21 > 0) { + var _this4 = this.tmpVertices[this.numTmpVertices++]; + _this4.x = v11.x; + _this4.y = v11.y; + _this4.wx = v11.wx; + _this4.wy = v11.wy; + _this4.wz = v11.wz; + } else if(s11 > 0 && s21 <= 0) { + var _this5 = this.tmpVertices[this.numTmpVertices++]; + _this5.x = v11.x; + _this5.y = v11.y; + _this5.wx = v11.wx; + _this5.wy = v11.wy; + _this5.wz = v11.wz; + var t2 = s11 / (s11 - s21); + var _this6 = this.tmpVertices[this.numTmpVertices++]; + _this6.x = v11.x + (v21.x - v11.x) * t2; + _this6.y = v11.y + (v21.y - v11.y) * t2; + _this6.wx = v11.wx + (v21.wx - v11.wx) * t2; + _this6.wy = v11.wy + (v21.wy - v11.wy) * t2; + _this6.wz = v11.wz + (v21.wz - v11.wz) * t2; + } else if(s11 <= 0 && s21 > 0) { + var t3 = s11 / (s11 - s21); + var _this7 = this.tmpVertices[this.numTmpVertices++]; + _this7.x = v11.x + (v21.x - v11.x) * t3; + _this7.y = v11.y + (v21.y - v11.y) * t3; + _this7.wx = v11.wx + (v21.wx - v11.wx) * t3; + _this7.wy = v11.wy + (v21.wy - v11.wy) * t3; + _this7.wz = v11.wz + (v21.wz - v11.wz) * t3; + } + } + var tmp1 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp1; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g3 = 0; + var _g12 = this.numVertices; + while(_g3 < _g12) { + var i2 = _g3++; + var v12 = this.vertices[i2]; + var v22 = this.vertices[(i2 + 1) % this.numVertices]; + var s12 = this.h + v12.y; + var s22 = this.h + v22.y; + if(s12 > 0 && s22 > 0) { + var _this8 = this.tmpVertices[this.numTmpVertices++]; + _this8.x = v12.x; + _this8.y = v12.y; + _this8.wx = v12.wx; + _this8.wy = v12.wy; + _this8.wz = v12.wz; + } else if(s12 > 0 && s22 <= 0) { + var _this9 = this.tmpVertices[this.numTmpVertices++]; + _this9.x = v12.x; + _this9.y = v12.y; + _this9.wx = v12.wx; + _this9.wy = v12.wy; + _this9.wz = v12.wz; + var t4 = s12 / (s12 - s22); + var _this10 = this.tmpVertices[this.numTmpVertices++]; + _this10.x = v12.x + (v22.x - v12.x) * t4; + _this10.y = v12.y + (v22.y - v12.y) * t4; + _this10.wx = v12.wx + (v22.wx - v12.wx) * t4; + _this10.wy = v12.wy + (v22.wy - v12.wy) * t4; + _this10.wz = v12.wz + (v22.wz - v12.wz) * t4; + } else if(s12 <= 0 && s22 > 0) { + var t5 = s12 / (s12 - s22); + var _this11 = this.tmpVertices[this.numTmpVertices++]; + _this11.x = v12.x + (v22.x - v12.x) * t5; + _this11.y = v12.y + (v22.y - v12.y) * t5; + _this11.wx = v12.wx + (v22.wx - v12.wx) * t5; + _this11.wy = v12.wy + (v22.wy - v12.wy) * t5; + _this11.wz = v12.wz + (v22.wz - v12.wz) * t5; + } + } + var tmp2 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp2; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + var _g4 = 0; + var _g13 = this.numVertices; + while(_g4 < _g13) { + var i3 = _g4++; + var v13 = this.vertices[i3]; + var v23 = this.vertices[(i3 + 1) % this.numVertices]; + var s13 = this.h - v13.y; + var s23 = this.h - v23.y; + if(s13 > 0 && s23 > 0) { + var _this12 = this.tmpVertices[this.numTmpVertices++]; + _this12.x = v13.x; + _this12.y = v13.y; + _this12.wx = v13.wx; + _this12.wy = v13.wy; + _this12.wz = v13.wz; + } else if(s13 > 0 && s23 <= 0) { + var _this13 = this.tmpVertices[this.numTmpVertices++]; + _this13.x = v13.x; + _this13.y = v13.y; + _this13.wx = v13.wx; + _this13.wy = v13.wy; + _this13.wz = v13.wz; + var t6 = s13 / (s13 - s23); + var _this14 = this.tmpVertices[this.numTmpVertices++]; + _this14.x = v13.x + (v23.x - v13.x) * t6; + _this14.y = v13.y + (v23.y - v13.y) * t6; + _this14.wx = v13.wx + (v23.wx - v13.wx) * t6; + _this14.wy = v13.wy + (v23.wy - v13.wy) * t6; + _this14.wz = v13.wz + (v23.wz - v13.wz) * t6; + } else if(s13 <= 0 && s23 > 0) { + var t7 = s13 / (s13 - s23); + var _this15 = this.tmpVertices[this.numTmpVertices++]; + _this15.x = v13.x + (v23.x - v13.x) * t7; + _this15.y = v13.y + (v23.y - v13.y) * t7; + _this15.wx = v13.wx + (v23.wx - v13.wx) * t7; + _this15.wy = v13.wy + (v23.wy - v13.wy) * t7; + _this15.wz = v13.wz + (v23.wz - v13.wz) * t7; + } + } + var tmp3 = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp3; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + } + reduce() { + if(this.numVertices < 4) { + return; + } + var max1 = -1e65536; + var min1 = 1e65536; + var max2 = -1e65536; + var min2 = 1e65536; + var max1V = null; + var min1V = null; + var max2V = null; + var min2V = null; + var e1x = 1; + var e1y = 1; + var e2x = -1; + var e2y = 1; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v = this.vertices[i]; + var dot1 = v.x * e1x + v.y * e1y; + var dot2 = v.x * e2x + v.y * e2y; + if(dot1 > max1) { + max1 = dot1; + max1V = v; + } + if(dot1 < min1) { + min1 = dot1; + min1V = v; + } + if(dot2 > max2) { + max2 = dot2; + max2V = v; + } + if(dot2 < min2) { + min2 = dot2; + min2V = v; + } + } + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = max1V.x; + _this.y = max1V.y; + _this.wx = max1V.wx; + _this.wy = max1V.wy; + _this.wz = max1V.wz; + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = max2V.x; + _this1.y = max2V.y; + _this1.wx = max2V.wx; + _this1.wy = max2V.wy; + _this1.wz = max2V.wz; + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = min1V.x; + _this2.y = min1V.y; + _this2.wx = min1V.wx; + _this2.wy = min1V.wy; + _this2.wz = min1V.wz; + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = min2V.x; + _this3.y = min2V.y; + _this3.wx = min2V.wx; + _this3.wy = min2V.wy; + _this3.wz = min2V.wz; + var tmp = this.vertices; + this.vertices = this.tmpVertices; + this.tmpVertices = tmp; + this.numVertices = this.numTmpVertices; + this.numTmpVertices = 0; + } +} +oimo.collision.narrowphase.detector.BoxBoxDetectorMacro = class oimo_collision_narrowphase_detector_BoxBoxDetectorMacro { +} +oimo.collision.narrowphase.detector.CachedDetectorData = class oimo_collision_narrowphase_detector_CachedDetectorData { + constructor() { + } + _clear() { + if(this._gjkCache != null) { + this._gjkCache.clear(); + } + } +} +oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collision_narrowphase_detector_CapsuleCapsuleDetector extends oimo.collision.narrowphase.detector.Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var c1 = geom1; + var c2 = geom2; + result.incremental = false; + var axis1; + var axis1X; + var axis1Y; + var axis1Z; + var axis2; + var axis2X; + var axis2Y; + var axis2Z; + axis1X = tf1._rotation01; + axis1Y = tf1._rotation11; + axis1Z = tf1._rotation21; + axis2X = tf2._rotation01; + axis2Y = tf2._rotation11; + axis2Z = tf2._rotation21; + var hh1 = c1._halfHeight; + var hh2 = c2._halfHeight; + var r1 = c1._radius; + var r2 = c2._radius; + var p1; + var p1X; + var p1Y; + var p1Z; + var q1; + var q1X; + var q1Y; + var q1Z; + var p2; + var p2X; + var p2Y; + var p2Z; + var q2; + var q2X; + var q2Y; + var q2Z; + p1X = tf1._positionX + axis1X * -hh1; + p1Y = tf1._positionY + axis1Y * -hh1; + p1Z = tf1._positionZ + axis1Z * -hh1; + q1X = tf1._positionX + axis1X * hh1; + q1Y = tf1._positionY + axis1Y * hh1; + q1Z = tf1._positionZ + axis1Z * hh1; + p2X = tf2._positionX + axis2X * -hh2; + p2Y = tf2._positionY + axis2Y * -hh2; + p2Z = tf2._positionZ + axis2Z * -hh2; + q2X = tf2._positionX + axis2X * hh2; + q2Y = tf2._positionY + axis2Y * hh2; + q2Z = tf2._positionZ + axis2Z * hh2; + var p12; + var p12X; + var p12Y; + var p12Z; + p12X = p1X - p2X; + p12Y = p1Y - p2Y; + p12Z = p1Z - p2Z; + var d1; + var d1X; + var d1Y; + var d1Z; + var d2; + var d2X; + var d2Y; + var d2Z; + d1X = q1X - p1X; + d1Y = q1Y - p1Y; + d1Z = q1Z - p1Z; + d2X = q2X - p2X; + d2Y = q2Y - p2Y; + d2Z = q2Z - p2Z; + var p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); + var p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + var d11 = hh1 * hh1 * 4; + var d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + var d22 = hh2 * hh2 * 4; + var t1; + var t2; + if(d11 == 0 && d22 == 0) { + t1 = 0; + t2 = 0; + } else if(d11 == 0) { + t1 = 0; + t2 = p12d2; + if(t2 < 0) { + t2 = 0; + } else if(t2 > d22) { + t2 = 1; + } else { + t2 /= d22; + } + } else if(d22 == 0) { + t2 = 0; + t1 = p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > d11) { + t1 = 1; + } else { + t1 /= d11; + } + } else { + var det = d11 * d22 - d12 * d12; + if(det == 0) { + t1 = 0; + } else { + t1 = d12 * p12d2 + d22 * p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > det) { + t1 = 1; + } else { + t1 /= det; + } + } + t2 = t1 * d12 + p12d2; + if(t2 < 0) { + t2 = 0; + t1 = p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > d11) { + t1 = 1; + } else { + t1 /= d11; + } + } else if(t2 > d22) { + t2 = 1; + t1 = d12 + p21d1; + if(t1 < 0) { + t1 = 0; + } else if(t1 > d11) { + t1 = 1; + } else { + t1 /= d11; + } + } else { + t2 /= d22; + } + } + var cp1; + var cp1X; + var cp1Y; + var cp1Z; + var cp2; + var cp2X; + var cp2Y; + var cp2Z; + cp1X = p1X + d1X * t1; + cp1Y = p1Y + d1Y * t1; + cp1Z = p1Z + d1Z * t1; + cp2X = p2X + d2X * t2; + cp2Y = p2Y + d2Y * t2; + cp2Z = p2Z + d2Z * t2; + var d; + var dX; + var dY; + var dZ; + dX = cp1X - cp2X; + dY = cp1Y - cp2Y; + dZ = cp1Z - cp2Z; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var n; + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1; + var pos1X; + var pos1Y; + var pos1Z; + var pos2; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = cp1X + nX * -r1; + pos1Y = cp1Y + nY * -r1; + pos1Z = cp1Z + nZ * -r1; + pos2X = cp2X + nX * r2; + pos2Y = cp2Y + nY * r2; + pos2Z = cp2Z + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } +} +oimo.collision.narrowphase.detector.GjkEpaDetector = class oimo_collision_narrowphase_detector_GjkEpaDetector extends oimo.collision.narrowphase.detector.Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + var g1 = geom1; + var g2 = geom2; + var status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo.common.Setting.enableGJKCaching ? cachedData : null,true); + result.incremental = true; + if(status != oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.SUCCEEDED) { + console.log("src/oimo/collision/narrowphase/detector/GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); + return; + } + var margin1 = g1._gjkMargin; + var margin2 = g2._gjkMargin; + if(gjkEpa.distance > margin1 + margin2) { + return; + } + var pos1; + var pos1X; + var pos1Y; + var pos1Z; + var pos2; + var pos2X; + var pos2Y; + var pos2Z; + var v = gjkEpa.closestPoint1; + pos1X = v.x; + pos1Y = v.y; + pos1Z = v.z; + var v1 = gjkEpa.closestPoint2; + pos2X = v1.x; + pos2Y = v1.y; + pos2Z = v1.z; + var normal; + var normalX; + var normalY; + var normalZ; + normalX = pos1X - pos2X; + normalY = pos1Y - pos2Y; + normalZ = pos1Z - pos2Z; + if(normalX * normalX + normalY * normalY + normalZ * normalZ == 0) { + return; + } + if(gjkEpa.distance < 0) { + normalX = -normalX; + normalY = -normalY; + normalZ = -normalZ; + } + var l = normalX * normalX + normalY * normalY + normalZ * normalZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + normalX *= l; + normalY *= l; + normalZ *= l; + this.setNormal(result,normalX,normalY,normalZ); + pos1X += normalX * -g1._gjkMargin; + pos1Y += normalY * -g1._gjkMargin; + pos1Z += normalZ * -g1._gjkMargin; + pos2X += normalX * g2._gjkMargin; + pos2Y += normalY * g2._gjkMargin; + pos2Z += normalZ * g2._gjkMargin; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,g1._gjkMargin + g2._gjkMargin - gjkEpa.distance,0); + } +} +oimo.collision.narrowphase.detector.SphereBoxDetector = class oimo_collision_narrowphase_detector_SphereBoxDetector extends oimo.collision.narrowphase.detector.Detector { + constructor(swapped) { + super(swapped); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var s = geom1; + var b = geom2; + result.incremental = false; + var halfExt; + var halfExtX; + var halfExtY; + var halfExtZ; + var negHalfExt; + var negHalfExtX; + var negHalfExtY; + var negHalfExtZ; + halfExtX = b._halfExtentsX; + halfExtY = b._halfExtentsY; + halfExtZ = b._halfExtentsZ; + negHalfExtX = -halfExtX; + negHalfExtY = -halfExtY; + negHalfExtZ = -halfExtZ; + var r = s._radius; + var boxToSphere; + var boxToSphereX; + var boxToSphereY; + var boxToSphereZ; + boxToSphereX = tf1._positionX - tf2._positionX; + boxToSphereY = tf1._positionY - tf2._positionY; + boxToSphereZ = tf1._positionZ - tf2._positionZ; + var boxToSphereInBox; + var boxToSphereInBoxX; + var boxToSphereInBoxY; + var boxToSphereInBoxZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * boxToSphereX + tf2._rotation10 * boxToSphereY + tf2._rotation20 * boxToSphereZ; + __tmp__Y = tf2._rotation01 * boxToSphereX + tf2._rotation11 * boxToSphereY + tf2._rotation21 * boxToSphereZ; + __tmp__Z = tf2._rotation02 * boxToSphereX + tf2._rotation12 * boxToSphereY + tf2._rotation22 * boxToSphereZ; + boxToSphereInBoxX = __tmp__X; + boxToSphereInBoxY = __tmp__Y; + boxToSphereInBoxZ = __tmp__Z; + var insideBox = negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ; + if(insideBox) { + var sphereToBoxSurface; + var sphereToBoxSurfaceX; + var sphereToBoxSurfaceY; + var sphereToBoxSurfaceZ; + sphereToBoxSurfaceX = boxToSphereInBoxX < 0 ? -boxToSphereInBoxX : boxToSphereInBoxX; + sphereToBoxSurfaceY = boxToSphereInBoxY < 0 ? -boxToSphereInBoxY : boxToSphereInBoxY; + sphereToBoxSurfaceZ = boxToSphereInBoxZ < 0 ? -boxToSphereInBoxZ : boxToSphereInBoxZ; + sphereToBoxSurfaceX = halfExtX - sphereToBoxSurfaceX; + sphereToBoxSurfaceY = halfExtY - sphereToBoxSurfaceY; + sphereToBoxSurfaceZ = halfExtZ - sphereToBoxSurfaceZ; + var normalInBox; + var normalInBoxX; + var normalInBoxY; + var normalInBoxZ; + var distX = sphereToBoxSurfaceX; + var distY = sphereToBoxSurfaceY; + var distZ = sphereToBoxSurfaceZ; + var depth; + var projectionMask; + var projectionMaskX; + var projectionMaskY; + var projectionMaskZ; + if(distX < distY) { + if(distX < distZ) { + if(boxToSphereInBoxX > 0) { + normalInBoxX = 1; + normalInBoxY = 0; + normalInBoxZ = 0; + } else { + normalInBoxX = -1; + normalInBoxY = 0; + normalInBoxZ = 0; + } + projectionMaskX = 0; + projectionMaskY = 1; + projectionMaskZ = 1; + depth = distX; + } else { + if(boxToSphereInBoxZ > 0) { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = 1; + } else { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = -1; + } + projectionMaskX = 1; + projectionMaskY = 1; + projectionMaskZ = 0; + depth = distZ; + } + } else if(distY < distZ) { + if(boxToSphereInBoxY > 0) { + normalInBoxX = 0; + normalInBoxY = 1; + normalInBoxZ = 0; + } else { + normalInBoxX = 0; + normalInBoxY = -1; + normalInBoxZ = 0; + } + projectionMaskX = 1; + projectionMaskY = 0; + projectionMaskZ = 1; + depth = distY; + } else { + if(boxToSphereInBoxZ > 0) { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = 1; + } else { + normalInBoxX = 0; + normalInBoxY = 0; + normalInBoxZ = -1; + } + projectionMaskX = 1; + projectionMaskY = 1; + projectionMaskZ = 0; + depth = distZ; + } + var base; + var baseX; + var baseY; + var baseZ; + baseX = projectionMaskX * boxToSphereInBoxX; + baseY = projectionMaskY * boxToSphereInBoxY; + baseZ = projectionMaskZ * boxToSphereInBoxZ; + var boxToClosestPointInBox; + var boxToClosestPointInBoxX; + var boxToClosestPointInBoxY; + var boxToClosestPointInBoxZ; + boxToClosestPointInBoxX = normalInBoxX * halfExtX; + boxToClosestPointInBoxY = normalInBoxY * halfExtY; + boxToClosestPointInBoxZ = normalInBoxZ * halfExtZ; + boxToClosestPointInBoxX += baseX; + boxToClosestPointInBoxY += baseY; + boxToClosestPointInBoxZ += baseZ; + var boxToClosestPoint; + var boxToClosestPointX; + var boxToClosestPointY; + var boxToClosestPointZ; + var normal; + var normalX; + var normalY; + var normalZ; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X1; + boxToClosestPointY = __tmp__Y1; + boxToClosestPointZ = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; + __tmp__Y2 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; + __tmp__Z2 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; + normalX = __tmp__X2; + normalY = __tmp__Y2; + normalZ = __tmp__Z2; + this.setNormal(result,normalX,normalY,normalZ); + var pos1; + var pos1X; + var pos1Y; + var pos1Z; + var pos2; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = tf1._positionX + normalX * -r; + pos1Y = tf1._positionY + normalY * -r; + pos1Z = tf1._positionZ + normalZ * -r; + pos2X = tf2._positionX + boxToClosestPointX; + pos2Y = tf2._positionY + boxToClosestPointY; + pos2Z = tf2._positionZ + boxToClosestPointZ; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); + return; + } + var boxToClosestPointInBox1; + var boxToClosestPointInBoxX1; + var boxToClosestPointInBoxY1; + var boxToClosestPointInBoxZ1; + var eps = 1e-9; + var epsVec; + var epsVecX; + var epsVecY; + var epsVecZ; + epsVecX = eps; + epsVecY = eps; + epsVecZ = eps; + halfExtX -= epsVecX; + halfExtY -= epsVecY; + halfExtZ -= epsVecZ; + negHalfExtX += epsVecX; + negHalfExtY += epsVecY; + negHalfExtZ += epsVecZ; + boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; + boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; + boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; + boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; + boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; + boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; + var closestPointToSphereInBox; + var closestPointToSphereInBoxX; + var closestPointToSphereInBoxY; + var closestPointToSphereInBoxZ; + closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX1; + closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY1; + closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ1; + var dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; + if(dist >= r * r) { + return; + } + dist = Math.sqrt(dist); + var boxToClosestPoint1; + var boxToClosestPointX1; + var boxToClosestPointY1; + var boxToClosestPointZ1; + var closestPointToSphere; + var closestPointToSphereX; + var closestPointToSphereY; + var closestPointToSphereZ; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf2._rotation00 * boxToClosestPointInBoxX1 + tf2._rotation01 * boxToClosestPointInBoxY1 + tf2._rotation02 * boxToClosestPointInBoxZ1; + __tmp__Y3 = tf2._rotation10 * boxToClosestPointInBoxX1 + tf2._rotation11 * boxToClosestPointInBoxY1 + tf2._rotation12 * boxToClosestPointInBoxZ1; + __tmp__Z3 = tf2._rotation20 * boxToClosestPointInBoxX1 + tf2._rotation21 * boxToClosestPointInBoxY1 + tf2._rotation22 * boxToClosestPointInBoxZ1; + boxToClosestPointX1 = __tmp__X3; + boxToClosestPointY1 = __tmp__Y3; + boxToClosestPointZ1 = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; + __tmp__Y4 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; + __tmp__Z4 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; + closestPointToSphereX = __tmp__X4; + closestPointToSphereY = __tmp__Y4; + closestPointToSphereZ = __tmp__Z4; + var normal1; + var normalX1; + var normalY1; + var normalZ1; + var l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + normalX1 = closestPointToSphereX * l; + normalY1 = closestPointToSphereY * l; + normalZ1 = closestPointToSphereZ * l; + this.setNormal(result,normalX1,normalY1,normalZ1); + var pos11; + var pos1X1; + var pos1Y1; + var pos1Z1; + var pos21; + var pos2X1; + var pos2Y1; + var pos2Z1; + pos1X1 = tf1._positionX + normalX1 * -r; + pos1Y1 = tf1._positionY + normalY1 * -r; + pos1Z1 = tf1._positionZ + normalZ1 * -r; + pos2X1 = tf2._positionX + boxToClosestPointX1; + pos2Y1 = tf2._positionY + boxToClosestPointY1; + pos2Z1 = tf2._positionZ + boxToClosestPointZ1; + this.addPoint(result,pos1X1,pos1Y1,pos1Z1,pos2X1,pos2Y1,pos2Z1,r - dist,0); + } +} +oimo.collision.narrowphase.detector.SphereCapsuleDetector = class oimo_collision_narrowphase_detector_SphereCapsuleDetector extends oimo.collision.narrowphase.detector.Detector { + constructor(swapped) { + super(swapped); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var s1 = geom1; + var c2 = geom2; + result.incremental = false; + var hh2 = c2._halfHeight; + var r1 = s1._radius; + var r2 = c2._radius; + var axis2; + var axis2X; + var axis2Y; + var axis2Z; + axis2X = tf2._rotation01; + axis2Y = tf2._rotation11; + axis2Z = tf2._rotation21; + var cp1; + var cp1X; + var cp1Y; + var cp1Z; + cp1X = tf1._positionX; + cp1Y = tf1._positionY; + cp1Z = tf1._positionZ; + var p2; + var p2X; + var p2Y; + var p2Z; + var q2; + var q2X; + var q2Y; + var q2Z; + p2X = tf2._positionX + axis2X * -hh2; + p2Y = tf2._positionY + axis2Y * -hh2; + p2Z = tf2._positionZ + axis2Z * -hh2; + q2X = tf2._positionX + axis2X * hh2; + q2Y = tf2._positionY + axis2Y * hh2; + q2Z = tf2._positionZ + axis2Z * hh2; + var p12; + var p12X; + var p12Y; + var p12Z; + p12X = cp1X - p2X; + p12Y = cp1Y - p2Y; + p12Z = cp1Z - p2Z; + var d2; + var d2X; + var d2Y; + var d2Z; + d2X = q2X - p2X; + d2Y = q2Y - p2Y; + d2Z = q2Z - p2Z; + var d22 = hh2 * hh2 * 4; + var t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + if(t < 0) { + t = 0; + } else if(t > d22) { + t = 1; + } else { + t /= d22; + } + var cp2; + var cp2X; + var cp2Y; + var cp2Z; + cp2X = p2X + d2X * t; + cp2Y = p2Y + d2Y * t; + cp2Z = p2Z + d2Z * t; + var d; + var dX; + var dY; + var dZ; + dX = cp1X - cp2X; + dY = cp1Y - cp2Y; + dZ = cp1Z - cp2Z; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var n; + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1; + var pos1X; + var pos1Y; + var pos1Z; + var pos2; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = cp1X + nX * -r1; + pos1Y = cp1Y + nY * -r1; + pos1Z = cp1Z + nZ * -r1; + pos2X = cp2X + nX * r2; + pos2Y = cp2Y + nY * r2; + pos2Z = cp2Z + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } +} +oimo.collision.narrowphase.detector.SphereSphereDetector = class oimo_collision_narrowphase_detector_SphereSphereDetector extends oimo.collision.narrowphase.detector.Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + var s1 = geom1; + var s2 = geom2; + result.incremental = false; + var d; + var dX; + var dY; + var dZ; + dX = tf1._positionX - tf2._positionX; + dY = tf1._positionY - tf2._positionY; + dZ = tf1._positionZ - tf2._positionZ; + var r1 = s1._radius; + var r2 = s2._radius; + var len2 = dX * dX + dY * dY + dZ * dZ; + if(len2 >= (r1 + r2) * (r1 + r2)) { + return; + } + var len = Math.sqrt(len2); + var n; + var nX; + var nY; + var nZ; + if(len > 0) { + nX = dX * (1 / len); + nY = dY * (1 / len); + nZ = dZ * (1 / len); + } else { + nX = 1; + nY = 0; + nZ = 0; + } + this.setNormal(result,nX,nY,nZ); + var pos1; + var pos1X; + var pos1Y; + var pos1Z; + var pos2; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = tf1._positionX + nX * -r1; + pos1Y = tf1._positionY + nY * -r1; + pos1Z = tf1._positionZ + nZ * -r1; + pos2X = tf2._positionX + nX * r2; + pos2Y = tf2._positionY + nY * r2; + pos2Z = tf2._positionZ + nZ * r2; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); + } +} +if(!oimo.collision.narrowphase.detector.gjkepa) oimo.collision.narrowphase.detector.gjkepa = {}; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron { + constructor() { + var this1 = new Array(oimo.common.Setting.maxEPAVertices); + this._vertices = this1; + this._center = new oimo.common.Vec3(); + this._numVertices = 0; + this._triangleList = null; + this._triangleListLast = null; + this._numTriangles = 0; + this._trianglePool = null; + this._vertexPool = null; + } + dumpHoleEdge(first) { + } + validate() { + var t = this._triangleList; + while(t != null) { + var n = t._next; + t._vertices[0]._tmpEdgeLoopOuterTriangle = null; + t._vertices[0]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[0] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[0] == null) { + this._status = 3; + return false; + } + t._vertices[1]._tmpEdgeLoopOuterTriangle = null; + t._vertices[1]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[1] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[1] == null) { + this._status = 3; + return false; + } + t._vertices[2]._tmpEdgeLoopOuterTriangle = null; + t._vertices[2]._tmpEdgeLoopNext = null; + if(t._adjacentPairIndex[2] == -1) { + this._status = 2; + return false; + } + if(t._adjacentTriangles[2] == null) { + this._status = 3; + return false; + } + t = n; + } + return true; + } + findEdgeLoop(id,base,from) { + if(base._tmpDfsId == id) { + return; + } + base._tmpDfsId = id; + var _this = base.tmp; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + var _this1 = _this; + var v = base._vertices[0].v; + var tx = _this1.x - v.x; + var ty = _this1.y - v.y; + var tz = _this1.z - v.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + var _this2 = base.tmp; + var v1 = base._normal; + base._tmpDfsVisible = _this2.x * v1.x + _this2.y * v1.y + _this2.z * v1.z > 0; + if(!base._tmpDfsVisible) { + this._status = 6; + return; + } + var _g = 0; + while(_g < 3) { + var i = _g++; + var t = base._adjacentTriangles[i]; + if(t == null) { + continue; + } + var _this3 = t.tmp; + _this3.x = from.x; + _this3.y = from.y; + _this3.z = from.z; + var _this4 = _this3; + var v2 = t._vertices[0].v; + var tx1 = _this4.x - v2.x; + var ty1 = _this4.y - v2.y; + var tz1 = _this4.z - v2.z; + _this4.x = tx1; + _this4.y = ty1; + _this4.z = tz1; + var _this5 = t.tmp; + var v3 = t._normal; + t._tmpDfsVisible = _this5.x * v3.x + _this5.y * v3.y + _this5.z * v3.z > 0; + if(t._tmpDfsVisible) { + this.findEdgeLoop(id,t,from); + } else { + var i2 = base._nextIndex[i]; + var v11 = base._vertices[i]; + var v21 = base._vertices[i2]; + v11._tmpEdgeLoopNext = v21; + v11._tmpEdgeLoopOuterTriangle = t; + } + } + var triangle = base._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = base._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + base._adjacentTriangles[0] = null; + base._adjacentPairIndex[0] = -1; + } + var triangle1 = base._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = base._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + base._adjacentTriangles[1] = null; + base._adjacentPairIndex[1] = -1; + } + var triangle2 = base._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = base._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + base._adjacentTriangles[2] = null; + base._adjacentPairIndex[2] = -1; + } + this._numTriangles--; + var prev = base._prev; + var next = base._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(base == this._triangleList) { + this._triangleList = this._triangleList._next; + } + if(base == this._triangleListLast) { + this._triangleListLast = this._triangleListLast._prev; + } + base._next = null; + base._prev = null; + base.removeReferences(); + base._next = this._trianglePool; + this._trianglePool = base; + } + _init(v1,v2,v3,v4) { + this._status = 0; + this._numVertices = 4; + this._vertices[0] = v1; + this._vertices[1] = v2; + this._vertices[2] = v3; + this._vertices[3] = v4; + var _this = this._center; + var v = v1.v; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = _this; + var v5 = v2.v; + var tx = _this1.x + v5.x; + var ty = _this1.y + v5.y; + var tz = _this1.z + v5.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + var _this2 = _this1; + var v6 = v3.v; + var tx1 = _this2.x + v6.x; + var ty1 = _this2.y + v6.y; + var tz1 = _this2.z + v6.z; + _this2.x = tx1; + _this2.y = ty1; + _this2.z = tz1; + var _this3 = _this2; + var v7 = v4.v; + var tx2 = _this3.x + v7.x; + var ty2 = _this3.y + v7.y; + var tz2 = _this3.z + v7.z; + _this3.x = tx2; + _this3.y = ty2; + _this3.z = tz2; + var _this4 = _this3; + var tx3 = _this4.x * 0.25; + var ty3 = _this4.y * 0.25; + var tz3 = _this4.z * 0.25; + _this4.x = tx3; + _this4.y = ty3; + _this4.z = tz3; + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; + } else { + first = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); + } + var t1 = first; + var first1 = this._trianglePool; + if(first1 != null) { + this._trianglePool = first1._next; + first1._next = null; + } else { + first1 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); + } + var t2 = first1; + var first2 = this._trianglePool; + if(first2 != null) { + this._trianglePool = first2._next; + first2._next = null; + } else { + first2 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); + } + var t3 = first2; + var first3 = this._trianglePool; + if(first3 != null) { + this._trianglePool = first3._next; + first3._next = null; + } else { + first3 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); + } + var t4 = first3; + var autoCheck = true; + if(autoCheck == null) { + autoCheck = false; + } + if(!t1.init(v1,v2,v3,this._center,autoCheck)) { + this._status = 1; + } + var autoCheck1 = true; + if(autoCheck1 == null) { + autoCheck1 = false; + } + if(!t2.init(v1,v2,v4,this._center,autoCheck1)) { + this._status = 1; + } + var autoCheck2 = true; + if(autoCheck2 == null) { + autoCheck2 = false; + } + if(!t3.init(v1,v3,v4,this._center,autoCheck2)) { + this._status = 1; + } + var autoCheck3 = true; + if(autoCheck3 == null) { + autoCheck3 = false; + } + if(!t4.init(v2,v3,v4,this._center,autoCheck3)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t2)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t3)) { + this._status = 1; + } + if(!t1.setAdjacentTriangle(t4)) { + this._status = 1; + } + if(!t2.setAdjacentTriangle(t3)) { + this._status = 1; + } + if(!t2.setAdjacentTriangle(t4)) { + this._status = 1; + } + if(!t3.setAdjacentTriangle(t4)) { + this._status = 1; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t1; + this._triangleListLast = t1; + } else { + this._triangleListLast._next = t1; + t1._prev = this._triangleListLast; + this._triangleListLast = t1; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t2; + this._triangleListLast = t2; + } else { + this._triangleListLast._next = t2; + t2._prev = this._triangleListLast; + this._triangleListLast = t2; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t3; + this._triangleListLast = t3; + } else { + this._triangleListLast._next = t3; + t3._prev = this._triangleListLast; + this._triangleListLast = t3; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t4; + this._triangleListLast = t4; + } else { + this._triangleListLast._next = t4; + t4._prev = this._triangleListLast; + this._triangleListLast = t4; + } + return this._status == 0; + } + _addVertex(vertex,base) { + this._vertices[this._numVertices++] = vertex; + var v1 = base._vertices[0]; + this.findEdgeLoop(this._numVertices,base,vertex.v); + if(this._status != 0) { + return false; + } + var v = v1; + var firstV = v1; + var prevT = null; + var firstT = null; + while(true) { + if(v._tmpEdgeLoopNext == null) { + this._dumpAsObjModel(); + this._status = 4; + return false; + } + if(v._tmpEdgeLoopOuterTriangle == null) { + this._status = 5; + return false; + } + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; + } else { + first = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); + } + var t = first; + if(firstT == null) { + firstT = t; + } + if(!t.init(v,v._tmpEdgeLoopNext,vertex,this._center,false)) { + this._status = 1; + } + if(this._status != 0) { + return false; + } + this._numTriangles++; + if(this._triangleList == null) { + this._triangleList = t; + this._triangleListLast = t; + } else { + this._triangleListLast._next = t; + t._prev = this._triangleListLast; + this._triangleListLast = t; + } + if(!t.setAdjacentTriangle(v._tmpEdgeLoopOuterTriangle)) { + this._status = 1; + } + if(prevT != null) { + if(!t.setAdjacentTriangle(prevT)) { + this._status = 1; + } + } + prevT = t; + v = v._tmpEdgeLoopNext; + if(!(v != firstV)) { + break; + } + } + if(!prevT.setAdjacentTriangle(firstT)) { + this._status = 1; + } + if(this._status == 0) { + return this.validate(); + } else { + return false; + } + } + _dumpAsObjModel() { + } +} +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState = class oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState { +} +oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_narrowphase_detector_gjkepa_EpaTriangle { + constructor() { + this.id = ++oimo.collision.narrowphase.detector.gjkepa.EpaTriangle.count; + this._next = null; + this._prev = null; + this._normal = new oimo.common.Vec3(); + this._distanceSq = 0; + this._tmpDfsId = 0; + this._tmpDfsVisible = false; + var this1 = new Array(3); + this._vertices = this1; + var this2 = new Array(3); + this._adjacentTriangles = this2; + var this3 = new Array(3); + this._adjacentPairIndex = this3; + this.tmp = new oimo.common.Vec3(); + var this4 = new Array(3); + this._nextIndex = this4; + this._nextIndex[0] = 1; + this._nextIndex[1] = 2; + this._nextIndex[2] = 0; + } + init(vertex1,vertex2,vertex3,center,autoCheck) { + if(autoCheck == null) { + autoCheck = false; + } + var v1; + var v1X; + var v1Y; + var v1Z; + var v2; + var v2X; + var v2Y; + var v2Z; + var v3; + var v3X; + var v3Y; + var v3Z; + var vc; + var vcX; + var vcY; + var vcZ; + var v = vertex1.v; + v1X = v.x; + v1Y = v.y; + v1Z = v.z; + var v4 = vertex2.v; + v2X = v4.x; + v2Y = v4.y; + v2Z = v4.z; + var v5 = vertex3.v; + v3X = v5.x; + v3Y = v5.y; + v3Z = v5.z; + var v6 = center; + vcX = v6.x; + vcY = v6.y; + vcZ = v6.z; + var v12; + var v12X; + var v12Y; + var v12Z; + var v13; + var v13X; + var v13Y; + var v13Z; + var vc1; + var vc1X; + var vc1Y; + var vc1Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v13X = v3X - v1X; + v13Y = v3Y - v1Y; + v13Z = v3Z - v1Z; + vc1X = v1X - vcX; + vc1Y = v1Y - vcY; + vc1Z = v1Z - vcZ; + var inor; + var inorX; + var inorY; + var inorZ; + inorX = v12Y * v13Z - v12Z * v13Y; + inorY = v12Z * v13X - v12X * v13Z; + inorZ = v12X * v13Y - v12Y * v13X; + var inverted = false; + var d = vc1X * inorX + vc1Y * inorY + vc1Z * inorZ; + if(d < 0) { + if(autoCheck) { + var tmp = vertex2; + vertex2 = vertex3; + vertex3 = tmp; + inorX *= -1; + inorY *= -1; + inorZ *= -1; + } else { + inverted = true; + } + } + this._vertices[0] = vertex1; + this._vertices[1] = vertex2; + this._vertices[2] = vertex3; + var v7 = this._normal; + v7.x = inorX; + v7.y = inorY; + v7.z = inorZ; + var vec1 = vertex1.v; + var vec2 = vertex2.v; + var vec3 = vertex3.v; + var out = this.tmp; + var v11; + var v1X1; + var v1Y1; + var v1Z1; + var v21; + var v2X1; + var v2Y1; + var v2Z1; + var v31; + var v3X1; + var v3Y1; + var v3Z1; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + var v23; + var v23X; + var v23Y; + var v23Z; + var v311; + var v31X; + var v31Y; + var v31Z; + var v8 = vec1; + v1X1 = v8.x; + v1Y1 = v8.y; + v1Z1 = v8.z; + var v9 = vec2; + v2X1 = v9.x; + v2Y1 = v9.y; + v2Z1 = v9.z; + var v10 = vec3; + v3X1 = v10.x; + v3Y1 = v10.y; + v3Z1 = v10.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X1 - v2X1; + v23Y = v3Y1 - v2Y1; + v23Z = v3Z1 - v2Z1; + v31X = v1X1 - v3X1; + v31Y = v1Y1 - v3Y1; + v31Z = v1Z1 - v3Z1; + var n; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12; + var n12X; + var n12Y; + var n12Z; + var n23; + var n23X; + var n23Y; + var n23Z; + var n31; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; + var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; + var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; + var mind = -1; + var minv; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(d12 < 0) { + var v14; + var v1X2; + var v1Y2; + var v1Z2; + var v22; + var v2X2; + var v2Y2; + var v2Z2; + var v15 = vec1; + v1X2 = v15.x; + v1Y2 = v15.y; + v1Z2 = v15.z; + var v16 = vec2; + v2X2 = v16.x; + v2Y2 = v16.y; + v2Z2 = v16.z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; + var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t = -t / d1; + var b; + if(t < 0) { + var v17 = out; + v17.x = v1X2; + v17.y = v1Y2; + v17.z = v1Z2; + b = 1; + } else if(t > 1) { + var v18 = out; + v18.x = v2X2; + v18.y = v2Y2; + v18.z = v2Z2; + b = 2; + } else { + var p; + var pX; + var pY; + var pZ; + pX = v1X2 + v12X2 * t; + pY = v1Y2 + v12Y2 * t; + pZ = v1Z2 + v12Z2 * t; + var v19 = out; + v19.x = pX; + v19.y = pY; + v19.z = pZ; + b = 3; + } + var d2 = out.x * out.x + out.y * out.y + out.z * out.z; + mini = b; + mind = d2; + var v20 = out; + minvX = v20.x; + minvY = v20.y; + minvZ = v20.z; + } + if(d23 < 0) { + var v110; + var v1X3; + var v1Y3; + var v1Z3; + var v24; + var v2X3; + var v2Y3; + var v2Z3; + var v25 = vec2; + v1X3 = v25.x; + v1Y3 = v25.y; + v1Z3 = v25.z; + var v26 = vec3; + v2X3 = v26.x; + v2Y3 = v26.y; + v2Z3 = v26.z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; + var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t1 = -t1 / d3; + var b1; + if(t1 < 0) { + var v27 = out; + v27.x = v1X3; + v27.y = v1Y3; + v27.z = v1Z3; + b1 = 1; + } else if(t1 > 1) { + var v28 = out; + v28.x = v2X3; + v28.y = v2Y3; + v28.z = v2Z3; + b1 = 2; + } else { + var p1; + var pX1; + var pY1; + var pZ1; + pX1 = v1X3 + v12X3 * t1; + pY1 = v1Y3 + v12Y3 * t1; + pZ1 = v1Z3 + v12Z3 * t1; + var v29 = out; + v29.x = pX1; + v29.y = pY1; + v29.z = pZ1; + b1 = 3; + } + var d4 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d4 < mind) { + mini = b1 << 1; + mind = d4; + var v30 = out; + minvX = v30.x; + minvY = v30.y; + minvZ = v30.z; + } + } + if(d31 < 0) { + var v111; + var v1X4; + var v1Y4; + var v1Z4; + var v210; + var v2X4; + var v2Y4; + var v2Z4; + var v32 = vec1; + v1X4 = v32.x; + v1Y4 = v32.y; + v1Z4 = v32.z; + var v33 = vec3; + v2X4 = v33.x; + v2Y4 = v33.y; + v2Z4 = v33.z; + var v124; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; + var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t2 = -t2 / d5; + var b2; + if(t2 < 0) { + var v34 = out; + v34.x = v1X4; + v34.y = v1Y4; + v34.z = v1Z4; + b2 = 1; + } else if(t2 > 1) { + var v35 = out; + v35.x = v2X4; + v35.y = v2Y4; + v35.z = v2Z4; + b2 = 2; + } else { + var p2; + var pX2; + var pY2; + var pZ2; + pX2 = v1X4 + v12X4 * t2; + pY2 = v1Y4 + v12Y4 * t2; + pZ2 = v1Z4 + v12Z4 * t2; + var v36 = out; + v36.x = pX2; + v36.y = pY2; + v36.z = pZ2; + b2 = 3; + } + var d6 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d6 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d6; + var v37 = out; + minvX = v37.x; + minvY = v37.y; + minvZ = v37.z; + } + } + if(mind > 0) { + var v38 = out; + v38.x = minvX; + v38.y = minvY; + v38.z = minvZ; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = dn / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + var v39 = out; + v39.x = minvX; + v39.y = minvY; + v39.z = minvZ; + } + var _this = this.tmp; + this._distanceSq = _this.x * _this.x + _this.y * _this.y + _this.z * _this.z; + this._adjacentTriangles[0] = null; + this._adjacentTriangles[1] = null; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[0] = -1; + this._adjacentPairIndex[1] = -1; + this._adjacentPairIndex[2] = -1; + return !inverted; + } + setAdjacentTriangle(triangle) { + var count = 0; + var i2 = this._nextIndex[0]; + var j2 = this._nextIndex[0]; + if(this._vertices[0] == triangle._vertices[j2] && this._vertices[i2] == triangle._vertices[0]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 0; + ++count; + } + var i21 = this._nextIndex[0]; + var j21 = this._nextIndex[1]; + if(this._vertices[0] == triangle._vertices[j21] && this._vertices[i21] == triangle._vertices[1]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 0; + ++count; + } + var i22 = this._nextIndex[0]; + var j22 = this._nextIndex[2]; + if(this._vertices[0] == triangle._vertices[j22] && this._vertices[i22] == triangle._vertices[2]) { + this._adjacentTriangles[0] = triangle; + this._adjacentPairIndex[0] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 0; + ++count; + } + var i23 = this._nextIndex[1]; + var j23 = this._nextIndex[0]; + if(this._vertices[1] == triangle._vertices[j23] && this._vertices[i23] == triangle._vertices[0]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 1; + ++count; + } + var i24 = this._nextIndex[1]; + var j24 = this._nextIndex[1]; + if(this._vertices[1] == triangle._vertices[j24] && this._vertices[i24] == triangle._vertices[1]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 1; + ++count; + } + var i25 = this._nextIndex[1]; + var j25 = this._nextIndex[2]; + if(this._vertices[1] == triangle._vertices[j25] && this._vertices[i25] == triangle._vertices[2]) { + this._adjacentTriangles[1] = triangle; + this._adjacentPairIndex[1] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 1; + ++count; + } + var i26 = this._nextIndex[2]; + var j26 = this._nextIndex[0]; + if(this._vertices[2] == triangle._vertices[j26] && this._vertices[i26] == triangle._vertices[0]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 0; + triangle._adjacentTriangles[0] = this; + triangle._adjacentPairIndex[0] = 2; + ++count; + } + var i27 = this._nextIndex[2]; + var j27 = this._nextIndex[1]; + if(this._vertices[2] == triangle._vertices[j27] && this._vertices[i27] == triangle._vertices[1]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 1; + triangle._adjacentTriangles[1] = this; + triangle._adjacentPairIndex[1] = 2; + ++count; + } + var i28 = this._nextIndex[2]; + var j28 = this._nextIndex[2]; + if(this._vertices[2] == triangle._vertices[j28] && this._vertices[i28] == triangle._vertices[2]) { + this._adjacentTriangles[2] = triangle; + this._adjacentPairIndex[2] = 2; + triangle._adjacentTriangles[2] = this; + triangle._adjacentPairIndex[2] = 2; + ++count; + } + if(count != 1) { + return false; + } + return true; + } + removeAdjacentTriangles() { + var triangle = this._adjacentTriangles[0]; + if(triangle != null) { + var pairIndex = this._adjacentPairIndex[0]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; + this._adjacentTriangles[0] = null; + this._adjacentPairIndex[0] = -1; + } + var triangle1 = this._adjacentTriangles[1]; + if(triangle1 != null) { + var pairIndex1 = this._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex1] = null; + triangle1._adjacentPairIndex[pairIndex1] = -1; + this._adjacentTriangles[1] = null; + this._adjacentPairIndex[1] = -1; + } + var triangle2 = this._adjacentTriangles[2]; + if(triangle2 != null) { + var pairIndex2 = this._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex2] = null; + triangle2._adjacentPairIndex[pairIndex2] = -1; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[2] = -1; + } + } + removeReferences() { + this._next = null; + this._prev = null; + this._tmpDfsId = 0; + this._tmpDfsVisible = false; + this._distanceSq = 0; + this._vertices[0] = null; + this._vertices[1] = null; + this._vertices[2] = null; + this._adjacentTriangles[0] = null; + this._adjacentTriangles[1] = null; + this._adjacentTriangles[2] = null; + this._adjacentPairIndex[0] = 0; + this._adjacentPairIndex[1] = 0; + this._adjacentPairIndex[2] = 0; + } + dump() { + } +} +oimo.collision.narrowphase.detector.gjkepa.EpaVertex = class oimo_collision_narrowphase_detector_gjkepa_EpaVertex { + constructor() { + this.randId = Math.random() * 100000 | 0; + this.v = new oimo.common.Vec3(); + this.w1 = new oimo.common.Vec3(); + this.w2 = new oimo.common.Vec3(); + } + init(v,w1,w2) { + var _this = this.v; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.w1; + _this1.x = w1.x; + _this1.y = w1.y; + _this1.z = w1.z; + var _this2 = this.w2; + _this2.x = w2.x; + _this2.y = w2.y; + _this2.z = w2.z; + this._next = null; + this._tmpEdgeLoopNext = null; + this._tmpEdgeLoopOuterTriangle = null; + return this; + } + removeReferences() { + this._next = null; + this._tmpEdgeLoopNext = null; + this._tmpEdgeLoopOuterTriangle = null; + } +} +oimo.collision.narrowphase.detector.gjkepa.GjkCache = class oimo_collision_narrowphase_detector_gjkepa_GjkCache { + constructor() { + this.prevClosestDir = new oimo.common.Vec3(); + } + clear() { + this.prevClosestDir.zero(); + } +} +if(!oimo.common) oimo.common = {}; +oimo.common.Vec3 = class oimo_common_Vec3 { + constructor(x,y,z) { + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + oimo.common.Vec3.numCreations++; + } + init(x,y,z) { + this.x = x; + this.y = y; + this.z = z; + return this; + } + zero() { + var tx = 0; + var ty = 0; + var tz = 0; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + add(v) { + return new oimo.common.Vec3(this.x + v.x,this.y + v.y,this.z + v.z); + } + add3(vx,vy,vz) { + return new oimo.common.Vec3(this.x + vx,this.y + vy,this.z + vz); + } + addScaled(v,s) { + return new oimo.common.Vec3(this.x + v.x * s,this.y + v.y * s,this.z + v.z * s); + } + sub(v) { + return new oimo.common.Vec3(this.x - v.x,this.y - v.y,this.z - v.z); + } + sub3(vx,vy,vz) { + return new oimo.common.Vec3(this.x - vx,this.y - vy,this.z - vz); + } + scale(s) { + return new oimo.common.Vec3(this.x * s,this.y * s,this.z * s); + } + scale3(sx,sy,sz) { + return new oimo.common.Vec3(this.x * sx,this.y * sy,this.z * sz); + } + dot(v) { + return this.x * v.x + this.y * v.y + this.z * v.z; + } + cross(v) { + return new oimo.common.Vec3(this.y * v.z - this.z * v.y,this.z * v.x - this.x * v.z,this.x * v.y - this.y * v.x); + } + addEq(v) { + var tx = this.x + v.x; + var ty = this.y + v.y; + var tz = this.z + v.z; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + add3Eq(vx,vy,vz) { + var tx = this.x + vx; + var ty = this.y + vy; + var tz = this.z + vz; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + addScaledEq(v,s) { + var tx = this.x + v.x * s; + var ty = this.y + v.y * s; + var tz = this.z + v.z * s; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + subEq(v) { + var tx = this.x - v.x; + var ty = this.y - v.y; + var tz = this.z - v.z; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + sub3Eq(vx,vy,vz) { + var tx = this.x - vx; + var ty = this.y - vy; + var tz = this.z - vz; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + scaleEq(s) { + var tx = this.x * s; + var ty = this.y * s; + var tz = this.z * s; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + scale3Eq(sx,sy,sz) { + var tx = this.x * sx; + var ty = this.y * sy; + var tz = this.z * sz; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + crossEq(v) { + var tx = this.y * v.z - this.z * v.y; + var ty = this.z * v.x - this.x * v.z; + var tz = this.x * v.y - this.y * v.x; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + mulMat3(m) { + return new oimo.common.Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02,this.x * m.e10 + this.y * m.e11 + this.z * m.e12,this.x * m.e20 + this.y * m.e21 + this.z * m.e22); + } + mulMat4(m) { + return new oimo.common.Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03,this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13,this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23); + } + mulTransform(tf) { + var v; + var vX; + var vY; + var vZ; + var v1 = this; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; + __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; + __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var res = new oimo.common.Vec3(); + var v2 = res; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return res; + } + mulMat3Eq(m) { + var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; + var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; + var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + mulMat4Eq(m) { + var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; + var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; + var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + mulTransformEq(tf) { + var v; + var vX; + var vY; + var vZ; + var v1 = this; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; + __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; + __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var v2 = this; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return this; + } + length() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + } + lengthSq() { + return this.x * this.x + this.y * this.y + this.z * this.z; + } + normalized() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + return new oimo.common.Vec3(this.x * invLen,this.y * invLen,this.z * invLen); + } + normalize() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = this.x * invLen; + var ty = this.y * invLen; + var tz = this.z * invLen; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + negate() { + return new oimo.common.Vec3(-this.x,-this.y,-this.z); + } + negateEq() { + var tx = -this.x; + var ty = -this.y; + var tz = -this.z; + this.x = tx; + this.y = ty; + this.z = tz; + return this; + } + copyFrom(v) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + return this; + } + clone() { + return new oimo.common.Vec3(this.x,this.y,this.z); + } + toString() { + return "Vec3[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + "]"; + } +} +oimo.common.Transform = class oimo_common_Transform { + constructor() { + this._positionX = 0; + this._positionY = 0; + this._positionZ = 0; + this._rotation00 = 1; + this._rotation01 = 0; + this._rotation02 = 0; + this._rotation10 = 0; + this._rotation11 = 1; + this._rotation12 = 0; + this._rotation20 = 0; + this._rotation21 = 0; + this._rotation22 = 1; + } + identity() { + this._positionX = 0; + this._positionY = 0; + this._positionZ = 0; + this._rotation00 = 1; + this._rotation01 = 0; + this._rotation02 = 0; + this._rotation10 = 0; + this._rotation11 = 1; + this._rotation12 = 0; + this._rotation20 = 0; + this._rotation21 = 0; + this._rotation22 = 1; + return this; + } + getPosition() { + var position = new oimo.common.Vec3(); + var v = position; + v.x = this._positionX; + v.y = this._positionY; + v.z = this._positionZ; + return position; + } + getPositionTo(position) { + var v = position; + v.x = this._positionX; + v.y = this._positionY; + v.z = this._positionZ; + } + setPosition(position) { + var v = position; + this._positionX = v.x; + this._positionY = v.y; + this._positionZ = v.z; + return this; + } + translate(translation) { + var diff; + var diffX; + var diffY; + var diffZ; + var v = translation; + diffX = v.x; + diffY = v.y; + diffZ = v.z; + this._positionX += diffX; + this._positionY += diffY; + this._positionZ += diffZ; + } + getRotation() { + var rotation = new oimo.common.Mat3(); + var m = rotation; + m.e00 = this._rotation00; + m.e01 = this._rotation01; + m.e02 = this._rotation02; + m.e10 = this._rotation10; + m.e11 = this._rotation11; + m.e12 = this._rotation12; + m.e20 = this._rotation20; + m.e21 = this._rotation21; + m.e22 = this._rotation22; + return rotation; + } + getRotationTo(out) { + var m = out; + m.e00 = this._rotation00; + m.e01 = this._rotation01; + m.e02 = this._rotation02; + m.e10 = this._rotation10; + m.e11 = this._rotation11; + m.e12 = this._rotation12; + m.e20 = this._rotation20; + m.e21 = this._rotation21; + m.e22 = this._rotation22; + } + setRotation(rotation) { + var m = rotation; + this._rotation00 = m.e00; + this._rotation01 = m.e01; + this._rotation02 = m.e02; + this._rotation10 = m.e10; + this._rotation11 = m.e11; + this._rotation12 = m.e12; + this._rotation20 = m.e20; + this._rotation21 = m.e21; + this._rotation22 = m.e22; + return this; + } + setRotationXyz(eulerAngles) { + var xyz; + var xyzX; + var xyzY; + var xyzZ; + var v = eulerAngles; + xyzX = v.x; + xyzY = v.y; + xyzZ = v.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + this._rotation00 = cy * cz; + this._rotation01 = -cy * sz; + this._rotation02 = sy; + this._rotation10 = cx * sz + cz * sx * sy; + this._rotation11 = cx * cz - sx * sy * sz; + this._rotation12 = -cy * sx; + this._rotation20 = sx * sz - cx * cz * sy; + this._rotation21 = cz * sx + cx * sy * sz; + this._rotation22 = cx * cy; + } + rotate(rotation) { + var rot; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + var m = rotation; + rot00 = m.e00; + rot01 = m.e01; + rot02 = m.e02; + rot10 = m.e10; + rot11 = m.e11; + rot12 = m.e12; + rot20 = m.e20; + rot21 = m.e21; + rot22 = m.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; + __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; + __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; + __tmp__10 = rot10 * this._rotation00 + rot11 * this._rotation10 + rot12 * this._rotation20; + __tmp__11 = rot10 * this._rotation01 + rot11 * this._rotation11 + rot12 * this._rotation21; + __tmp__12 = rot10 * this._rotation02 + rot11 * this._rotation12 + rot12 * this._rotation22; + __tmp__20 = rot20 * this._rotation00 + rot21 * this._rotation10 + rot22 * this._rotation20; + __tmp__21 = rot20 * this._rotation01 + rot21 * this._rotation11 + rot22 * this._rotation21; + __tmp__22 = rot20 * this._rotation02 + rot21 * this._rotation12 + rot22 * this._rotation22; + this._rotation00 = __tmp__00; + this._rotation01 = __tmp__01; + this._rotation02 = __tmp__02; + this._rotation10 = __tmp__10; + this._rotation11 = __tmp__11; + this._rotation12 = __tmp__12; + this._rotation20 = __tmp__20; + this._rotation21 = __tmp__21; + this._rotation22 = __tmp__22; + } + rotateXyz(eulerAngles) { + var xyz; + var xyzX; + var xyzY; + var xyzZ; + var rot; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + var v = eulerAngles; + xyzX = v.x; + xyzY = v.y; + xyzZ = v.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + rot00 = cy * cz; + rot01 = -cy * sz; + rot02 = sy; + rot10 = cx * sz + cz * sx * sy; + rot11 = cx * cz - sx * sy * sz; + rot12 = -cy * sx; + rot20 = sx * sz - cx * cz * sy; + rot21 = cz * sx + cx * sy * sz; + rot22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; + __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; + __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; + __tmp__10 = rot10 * this._rotation00 + rot11 * this._rotation10 + rot12 * this._rotation20; + __tmp__11 = rot10 * this._rotation01 + rot11 * this._rotation11 + rot12 * this._rotation21; + __tmp__12 = rot10 * this._rotation02 + rot11 * this._rotation12 + rot12 * this._rotation22; + __tmp__20 = rot20 * this._rotation00 + rot21 * this._rotation10 + rot22 * this._rotation20; + __tmp__21 = rot20 * this._rotation01 + rot21 * this._rotation11 + rot22 * this._rotation21; + __tmp__22 = rot20 * this._rotation02 + rot21 * this._rotation12 + rot22 * this._rotation22; + this._rotation00 = __tmp__00; + this._rotation01 = __tmp__01; + this._rotation02 = __tmp__02; + this._rotation10 = __tmp__10; + this._rotation11 = __tmp__11; + this._rotation12 = __tmp__12; + this._rotation20 = __tmp__20; + this._rotation21 = __tmp__21; + this._rotation22 = __tmp__22; + } + getOrientation() { + var q = new oimo.common.Quat(); + var iq; + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._rotation00; + var e11 = this._rotation11; + var e22 = this._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation21 - this._rotation12) * s; + iqY = (this._rotation02 - this._rotation20) * s; + iqZ = (this._rotation10 - this._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation02 + this._rotation20) * s; + iqW = (this._rotation21 - this._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation02 - this._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + var q1 = q; + q1.x = iqX; + q1.y = iqY; + q1.z = iqZ; + q1.w = iqW; + return q; + } + getOrientationTo(orientation) { + var iq; + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._rotation00; + var e11 = this._rotation11; + var e22 = this._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation21 - this._rotation12) * s; + iqY = (this._rotation02 - this._rotation20) * s; + iqZ = (this._rotation10 - this._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation02 + this._rotation20) * s; + iqW = (this._rotation21 - this._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation01 + this._rotation10) * s; + iqZ = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation02 - this._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._rotation02 + this._rotation20) * s; + iqY = (this._rotation12 + this._rotation21) * s; + iqW = (this._rotation10 - this._rotation01) * s; + } + var q = orientation; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; + } + setOrientation(quaternion) { + var q; + var qX; + var qY; + var qZ; + var qW; + var q1 = quaternion; + qX = q1.x; + qY = q1.y; + qZ = q1.z; + qW = q1.w; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._rotation00 = 1 - yy - zz; + this._rotation01 = xy - wz; + this._rotation02 = xz + wy; + this._rotation10 = xy + wz; + this._rotation11 = 1 - xx - zz; + this._rotation12 = yz - wx; + this._rotation20 = xz - wy; + this._rotation21 = yz + wx; + this._rotation22 = 1 - xx - yy; + return this; + } + clone() { + var tf = new oimo.common.Transform(); + tf._positionX = this._positionX; + tf._positionY = this._positionY; + tf._positionZ = this._positionZ; + tf._rotation00 = this._rotation00; + tf._rotation01 = this._rotation01; + tf._rotation02 = this._rotation02; + tf._rotation10 = this._rotation10; + tf._rotation11 = this._rotation11; + tf._rotation12 = this._rotation12; + tf._rotation20 = this._rotation20; + tf._rotation21 = this._rotation21; + tf._rotation22 = this._rotation22; + return tf; + } + copyFrom(transform) { + this._positionX = transform._positionX; + this._positionY = transform._positionY; + this._positionZ = transform._positionZ; + this._rotation00 = transform._rotation00; + this._rotation01 = transform._rotation01; + this._rotation02 = transform._rotation02; + this._rotation10 = transform._rotation10; + this._rotation11 = transform._rotation11; + this._rotation12 = transform._rotation12; + this._rotation20 = transform._rotation20; + this._rotation21 = transform._rotation21; + this._rotation22 = transform._rotation22; + return this; + } +} +oimo.common.Setting = class oimo_common_Setting { +} +oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowphase_detector_gjkepa_GjkEpa { + constructor() { + var this1 = new Array(4); + this.s = this1; + var this2 = new Array(4); + this.w1 = this2; + var this3 = new Array(4); + this.w2 = this3; + var this4 = new Array(3); + this.baseDirs = this4; + this.baseDirs[0] = new oimo.common.Vec3(1,0,0); + this.baseDirs[1] = new oimo.common.Vec3(0,1,0); + this.baseDirs[2] = new oimo.common.Vec3(0,0,1); + this.tl1 = new oimo.common.Vec3(); + this.tl2 = new oimo.common.Vec3(); + this.rayX = new oimo.common.Vec3(); + this.rayR = new oimo.common.Vec3(); + this.tempTransform = new oimo.common.Transform(); + this.s[0] = new oimo.common.Vec3(); + this.w1[0] = new oimo.common.Vec3(); + this.w2[0] = new oimo.common.Vec3(); + this.s[1] = new oimo.common.Vec3(); + this.w1[1] = new oimo.common.Vec3(); + this.w2[1] = new oimo.common.Vec3(); + this.s[2] = new oimo.common.Vec3(); + this.w1[2] = new oimo.common.Vec3(); + this.w2[2] = new oimo.common.Vec3(); + this.s[3] = new oimo.common.Vec3(); + this.w1[3] = new oimo.common.Vec3(); + this.w2[3] = new oimo.common.Vec3(); + this.dir = new oimo.common.Vec3(); + this.closest = new oimo.common.Vec3(); + this.closestPoint1 = new oimo.common.Vec3(); + this.closestPoint2 = new oimo.common.Vec3(); + this.polyhedron = new oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron(); + } + computeClosestPointsImpl(c1,c2,tf1,tf2,cache,useEpa) { + this.c1 = c1; + this.c2 = c2; + this.tf1 = tf1; + this.tf2 = tf2; + var s = this.s; + var w1 = this.w1; + var w2 = this.w2; + var closest = this.closest; + var dir = this.dir; + if(cache != null) { + if(cache._gjkCache == null) { + cache._gjkCache = new oimo.collision.narrowphase.detector.gjkepa.GjkCache(); + } + this.loadCache(cache._gjkCache); + } else { + dir.zero(); + } + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z == 0) { + var firstDir; + var firstDirX; + var firstDirY; + var firstDirZ; + firstDirX = tf2._positionX - tf1._positionX; + firstDirY = tf2._positionY - tf1._positionY; + firstDirZ = tf2._positionZ - tf1._positionZ; + var v = dir; + v.x = firstDirX; + v.y = firstDirY; + v.z = firstDirZ; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { + dir.init(1,0,0); + } + } + this.simplexSize = 0; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v1 = this.w1[this.simplexSize]; + _this.x = v1.x; + _this.y = v1.y; + _this.z = v1.z; + var _this1 = _this; + var v2 = this.w2[this.simplexSize]; + var tx = _this1.x - v2.x; + var ty = _this1.y - v2.y; + var tz = _this1.z - v2.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + this.simplexSize = 1; + var count = 0; + var max = 40; + var eps = 1e-4; + var eps2 = eps * eps; + while(count < max) { + var v3 = 0; + switch(this.simplexSize) { + case 1: + var v4 = s[0]; + closest.x = v4.x; + closest.y = v4.y; + closest.z = v4.z; + v3 = 1; + break; + case 2: + var v11; + var v1X; + var v1Y; + var v1Z; + var v21; + var v2X; + var v2Y; + var v2Z; + var v5 = s[0]; + v1X = v5.x; + v1Y = v5.y; + v1Z = v5.z; + var v6 = s[1]; + v2X = v6.x; + v2Y = v6.y; + v2Z = v6.z; + var v12; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / d; + if(t < 0) { + var v7 = closest; + v7.x = v1X; + v7.y = v1Y; + v7.z = v1Z; + v3 = 1; + } else if(t > 1) { + var v8 = closest; + v8.x = v2X; + v8.y = v2Y; + v8.z = v2Z; + v3 = 2; + } else { + var p; + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + var v9 = closest; + v9.x = pX; + v9.y = pY; + v9.z = pZ; + v3 = 3; + } + break; + case 3: + var vec1 = s[0]; + var vec2 = s[1]; + var vec3 = s[2]; + var v13; + var v1X1; + var v1Y1; + var v1Z1; + var v22; + var v2X1; + var v2Y1; + var v2Z1; + var v31; + var v3X; + var v3Y; + var v3Z; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + var v23; + var v23X; + var v23Y; + var v23Z; + var v311; + var v31X; + var v31Y; + var v31Z; + var v10 = vec1; + v1X1 = v10.x; + v1Y1 = v10.y; + v1Z1 = v10.z; + var v14 = vec2; + v2X1 = v14.x; + v2Y1 = v14.y; + v2Z1 = v14.z; + var v15 = vec3; + v3X = v15.x; + v3Y = v15.y; + v3Z = v15.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; + var n; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12; + var n12X; + var n12Y; + var n12Z; + var n23; + var n23X; + var n23Y; + var n23Z; + var n31; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; + var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; + var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; + var mind = -1; + var minv; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(d12 < 0) { + var v16; + var v1X2; + var v1Y2; + var v1Z2; + var v24; + var v2X2; + var v2Y2; + var v2Z2; + var v17 = vec1; + v1X2 = v17.x; + v1Y2 = v17.y; + v1Z2 = v17.z; + var v18 = vec2; + v2X2 = v18.x; + v2Y2 = v18.y; + v2Z2 = v18.z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / d1; + var b; + if(t1 < 0) { + var v19 = closest; + v19.x = v1X2; + v19.y = v1Y2; + v19.z = v1Z2; + b = 1; + } else if(t1 > 1) { + var v20 = closest; + v20.x = v2X2; + v20.y = v2Y2; + v20.z = v2Z2; + b = 2; + } else { + var p1; + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + var v25 = closest; + v25.x = pX1; + v25.y = pY1; + v25.z = pZ1; + b = 3; + } + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini = b; + mind = d2; + var v26 = closest; + minvX = v26.x; + minvY = v26.y; + minvZ = v26.z; + } + if(d23 < 0) { + var v110; + var v1X3; + var v1Y3; + var v1Z3; + var v27; + var v2X3; + var v2Y3; + var v2Z3; + var v28 = vec2; + v1X3 = v28.x; + v1Y3 = v28.y; + v1Z3 = v28.z; + var v29 = vec3; + v2X3 = v29.x; + v2Y3 = v29.y; + v2Z3 = v29.z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / d3; + var b1; + if(t2 < 0) { + var v30 = closest; + v30.x = v1X3; + v30.y = v1Y3; + v30.z = v1Z3; + b1 = 1; + } else if(t2 > 1) { + var v32 = closest; + v32.x = v2X3; + v32.y = v2Y3; + v32.z = v2Z3; + b1 = 2; + } else { + var p2; + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + var v33 = closest; + v33.x = pX2; + v33.y = pY2; + v33.z = pZ2; + b1 = 3; + } + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d4 < mind) { + mini = b1 << 1; + mind = d4; + var v34 = closest; + minvX = v34.x; + minvY = v34.y; + minvZ = v34.z; + } + } + if(d31 < 0) { + var v111; + var v1X4; + var v1Y4; + var v1Z4; + var v210; + var v2X4; + var v2Y4; + var v2Z4; + var v35 = vec1; + v1X4 = v35.x; + v1Y4 = v35.y; + v1Z4 = v35.z; + var v36 = vec3; + v2X4 = v36.x; + v2Y4 = v36.y; + v2Z4 = v36.z; + var v124; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; + var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t3 = -t3 / d5; + var b2; + if(t3 < 0) { + var v37 = closest; + v37.x = v1X4; + v37.y = v1Y4; + v37.z = v1Z4; + b2 = 1; + } else if(t3 > 1) { + var v38 = closest; + v38.x = v2X4; + v38.y = v2Y4; + v38.z = v2Z4; + b2 = 2; + } else { + var p3; + var pX3; + var pY3; + var pZ3; + pX3 = v1X4 + v12X4 * t3; + pY3 = v1Y4 + v12Y4 * t3; + pZ3 = v1Z4 + v12Z4 * t3; + var v39 = closest; + v39.x = pX3; + v39.y = pY3; + v39.z = pZ3; + b2 = 3; + } + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d6 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d6; + var v40 = closest; + minvX = v40.x; + minvY = v40.y; + minvZ = v40.z; + } + } + if(mind > 0) { + var v41 = closest; + v41.x = minvX; + v41.y = minvY; + v41.z = minvZ; + v3 = mini; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = dn / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + var v42 = closest; + v42.x = minvX; + v42.y = minvY; + v42.z = minvZ; + v3 = 7; + } + break; + case 4: + var vec11 = s[0]; + var vec21 = s[1]; + var vec31 = s[2]; + var vec4 = s[3]; + var v112; + var v1X5; + var v1Y5; + var v1Z5; + var v211; + var v2X5; + var v2Y5; + var v2Z5; + var v310; + var v3X1; + var v3Y1; + var v3Z1; + var v43; + var v4X; + var v4Y; + var v4Z; + var v125; + var v12X5; + var v12Y5; + var v12Z5; + var v131; + var v13X; + var v13Y; + var v13Z; + var v141; + var v14X; + var v14Y; + var v14Z; + var v231; + var v23X1; + var v23Y1; + var v23Z1; + var v241; + var v24X; + var v24Y; + var v24Z; + var v341; + var v34X; + var v34Y; + var v34Z; + var v44 = vec11; + v1X5 = v44.x; + v1Y5 = v44.y; + v1Z5 = v44.z; + var v45 = vec21; + v2X5 = v45.x; + v2Y5 = v45.y; + v2Z5 = v45.z; + var v46 = vec31; + v3X1 = v46.x; + v3Y1 = v46.y; + v3Z1 = v46.z; + var v47 = vec4; + v4X = v47.x; + v4Y = v47.y; + v4Z = v47.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v13X = v3X1 - v1X5; + v13Y = v3Y1 - v1Y5; + v13Z = v3Z1 - v1Z5; + v14X = v4X - v1X5; + v14Y = v4Y - v1Y5; + v14Z = v4Z - v1Z5; + v23X1 = v3X1 - v2X5; + v23Y1 = v3Y1 - v2Y5; + v23Z1 = v3Z1 - v2Z5; + v24X = v4X - v2X5; + v24Y = v4Y - v2Y5; + v24Z = v4Z - v2Z5; + v34X = v4X - v3X1; + v34Y = v4Y - v3Y1; + v34Z = v4Z - v3Z1; + var rev; + var n123; + var n123X; + var n123Y; + var n123Z; + var n134; + var n134X; + var n134Y; + var n134Z; + var n142; + var n142X; + var n142Y; + var n142Z; + var n243; + var n243X; + var n243Y; + var n243Z; + var n1; + var nX1; + var nY1; + var nZ1; + n123X = v12Y5 * v13Z - v12Z5 * v13Y; + n123Y = v12Z5 * v13X - v12X5 * v13Z; + n123Z = v12X5 * v13Y - v12Y5 * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z5 - v14Z * v12Y5; + n142Y = v14Z * v12X5 - v14X * v12Z5; + n142Z = v14X * v12Y5 - v14Y * v12X5; + n243X = v24Y * v23Z1 - v24Z * v23Y1; + n243Y = v24Z * v23X1 - v24X * v23Z1; + n243Z = v24X * v23Y1 - v24Y * v23X1; + var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; + var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; + var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; + var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; + var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; + var mind1 = -1; + var minv1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(d123 * sign < 0) { + var v113; + var v1X6; + var v1Y6; + var v1Z6; + var v212; + var v2X6; + var v2Y6; + var v2Z6; + var v312; + var v3X2; + var v3Y2; + var v3Z2; + var v126; + var v12X6; + var v12Y6; + var v12Z6; + var v232; + var v23X2; + var v23Y2; + var v23Z2; + var v313; + var v31X1; + var v31Y1; + var v31Z1; + var v48 = vec11; + v1X6 = v48.x; + v1Y6 = v48.y; + v1Z6 = v48.z; + var v49 = vec21; + v2X6 = v49.x; + v2Y6 = v49.y; + v2Z6 = v49.z; + var v50 = vec31; + v3X2 = v50.x; + v3Y2 = v50.y; + v3Z2 = v50.z; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + v23X2 = v3X2 - v2X6; + v23Y2 = v3Y2 - v2Y6; + v23Z2 = v3Z2 - v2Z6; + v31X1 = v1X6 - v3X2; + v31Y1 = v1Y6 - v3Y2; + v31Z1 = v1Z6 - v3Z2; + var n2; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; + var n121; + var n12X1; + var n12Y1; + var n12Z1; + var n231; + var n23X1; + var n23Y1; + var n23Z1; + var n311; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; + n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; + n12Z1 = v12X6 * nY2 - v12Y6 * nX2; + n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; + n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; + n23Z1 = v23X2 * nY2 - v23Y2 * nX2; + n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; + n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; + n31Z1 = v31X1 * nY2 - v31Y1 * nX2; + var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; + var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; + var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + var mind2 = -1; + var minv2; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(d121 < 0) { + var v114; + var v1X7; + var v1Y7; + var v1Z7; + var v213; + var v2X7; + var v2Y7; + var v2Z7; + var v51 = vec11; + v1X7 = v51.x; + v1Y7 = v51.y; + v1Z7 = v51.z; + var v52 = vec21; + v2X7 = v52.x; + v2Y7 = v52.y; + v2Z7 = v52.z; + var v127; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / d7; + var b3; + if(t4 < 0) { + var v53 = closest; + v53.x = v1X7; + v53.y = v1Y7; + v53.z = v1Z7; + b3 = 1; + } else if(t4 > 1) { + var v54 = closest; + v54.x = v2X7; + v54.y = v2Y7; + v54.z = v2Z7; + b3 = 2; + } else { + var p4; + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + var v55 = closest; + v55.x = pX4; + v55.y = pY4; + v55.z = pZ4; + b3 = 3; + } + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini2 = b3; + mind2 = d8; + var v56 = closest; + minvX2 = v56.x; + minvY2 = v56.y; + minvZ2 = v56.z; + } + if(d231 < 0) { + var v115; + var v1X8; + var v1Y8; + var v1Z8; + var v214; + var v2X8; + var v2Y8; + var v2Z8; + var v57 = vec21; + v1X8 = v57.x; + v1Y8 = v57.y; + v1Z8 = v57.z; + var v58 = vec31; + v2X8 = v58.x; + v2Y8 = v58.y; + v2Z8 = v58.z; + var v128; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / d9; + var b4; + if(t5 < 0) { + var v59 = closest; + v59.x = v1X8; + v59.y = v1Y8; + v59.z = v1Z8; + b4 = 1; + } else if(t5 > 1) { + var v60 = closest; + v60.x = v2X8; + v60.y = v2Y8; + v60.z = v2Z8; + b4 = 2; + } else { + var p5; + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + var v61 = closest; + v61.x = pX5; + v61.y = pY5; + v61.z = pZ5; + b4 = 3; + } + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d10 < mind2) { + mini2 = b4 << 1; + mind2 = d10; + var v62 = closest; + minvX2 = v62.x; + minvY2 = v62.y; + minvZ2 = v62.z; + } + } + if(d311 < 0) { + var v116; + var v1X9; + var v1Y9; + var v1Z9; + var v215; + var v2X9; + var v2Y9; + var v2Z9; + var v63 = vec11; + v1X9 = v63.x; + v1Y9 = v63.y; + v1Z9 = v63.z; + var v64 = vec31; + v2X9 = v64.x; + v2Y9 = v64.y; + v2Z9 = v64.z; + var v129; + var v12X9; + var v12Y9; + var v12Z9; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; + var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; + t6 = -t6 / d11; + var b5; + if(t6 < 0) { + var v65 = closest; + v65.x = v1X9; + v65.y = v1Y9; + v65.z = v1Z9; + b5 = 1; + } else if(t6 > 1) { + var v66 = closest; + v66.x = v2X9; + v66.y = v2Y9; + v66.z = v2Z9; + b5 = 2; + } else { + var p6; + var pX6; + var pY6; + var pZ6; + pX6 = v1X9 + v12X9 * t6; + pY6 = v1Y9 + v12Y9 * t6; + pZ6 = v1Z9 + v12Z9 * t6; + var v67 = closest; + v67.x = pX6; + v67.y = pY6; + v67.z = pZ6; + b5 = 3; + } + var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d13 < mind2) { + mini2 = b5 & 1 | (b5 & 2) << 1; + mind2 = d13; + var v68 = closest; + minvX2 = v68.x; + minvY2 = v68.y; + minvZ2 = v68.z; + } + } + var b6; + if(mind2 > 0) { + var v69 = closest; + v69.x = minvX2; + v69.y = minvY2; + v69.z = minvZ2; + b6 = mini2; + } else { + var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX2 *= l1; + nY2 *= l1; + nZ2 *= l1; + var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; + var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l21 = dn1 / l21; + minvX2 = nX2 * l21; + minvY2 = nY2 * l21; + minvZ2 = nZ2 * l21; + var v70 = closest; + v70.x = minvX2; + v70.y = minvY2; + v70.z = minvZ2; + b6 = 7; + } + var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini1 = b6; + mind1 = d14; + var v71 = closest; + minvX1 = v71.x; + minvY1 = v71.y; + minvZ1 = v71.z; + } + if(d134 * sign < 0) { + var v117; + var v1X10; + var v1Y10; + var v1Z10; + var v216; + var v2X10; + var v2Y10; + var v2Z10; + var v314; + var v3X3; + var v3Y3; + var v3Z3; + var v1210; + var v12X10; + var v12Y10; + var v12Z10; + var v233; + var v23X3; + var v23Y3; + var v23Z3; + var v315; + var v31X2; + var v31Y2; + var v31Z2; + var v72 = vec11; + v1X10 = v72.x; + v1Y10 = v72.y; + v1Z10 = v72.z; + var v73 = vec31; + v2X10 = v73.x; + v2Y10 = v73.y; + v2Z10 = v73.z; + var v74 = vec4; + v3X3 = v74.x; + v3Y3 = v74.y; + v3Z3 = v74.z; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + v23X3 = v3X3 - v2X10; + v23Y3 = v3Y3 - v2Y10; + v23Z3 = v3Z3 - v2Z10; + v31X2 = v1X10 - v3X3; + v31Y2 = v1Y10 - v3Y3; + v31Z2 = v1Z10 - v3Z3; + var n3; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; + var n122; + var n12X2; + var n12Y2; + var n12Z2; + var n232; + var n23X2; + var n23Y2; + var n23Z2; + var n312; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; + n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; + n12Z2 = v12X10 * nY3 - v12Y10 * nX3; + n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; + n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; + n23Z2 = v23X3 * nY3 - v23Y3 * nX3; + n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; + n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; + n31Z2 = v31X2 * nY3 - v31Y2 * nX3; + var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; + var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; + var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + var mind3 = -1; + var minv3; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(d122 < 0) { + var v118; + var v1X11; + var v1Y11; + var v1Z11; + var v217; + var v2X11; + var v2Y11; + var v2Z11; + var v75 = vec11; + v1X11 = v75.x; + v1Y11 = v75.y; + v1Z11 = v75.z; + var v76 = vec31; + v2X11 = v76.x; + v2Y11 = v76.y; + v2Z11 = v76.z; + var v1211; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / d15; + var b7; + if(t7 < 0) { + var v77 = closest; + v77.x = v1X11; + v77.y = v1Y11; + v77.z = v1Z11; + b7 = 1; + } else if(t7 > 1) { + var v78 = closest; + v78.x = v2X11; + v78.y = v2Y11; + v78.z = v2Z11; + b7 = 2; + } else { + var p7; + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + var v79 = closest; + v79.x = pX7; + v79.y = pY7; + v79.z = pZ7; + b7 = 3; + } + var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini3 = b7; + mind3 = d16; + var v80 = closest; + minvX3 = v80.x; + minvY3 = v80.y; + minvZ3 = v80.z; + } + if(d232 < 0) { + var v119; + var v1X12; + var v1Y12; + var v1Z12; + var v218; + var v2X12; + var v2Y12; + var v2Z12; + var v81 = vec31; + v1X12 = v81.x; + v1Y12 = v81.y; + v1Z12 = v81.z; + var v82 = vec4; + v2X12 = v82.x; + v2Y12 = v82.y; + v2Z12 = v82.z; + var v1212; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / d17; + var b8; + if(t8 < 0) { + var v83 = closest; + v83.x = v1X12; + v83.y = v1Y12; + v83.z = v1Z12; + b8 = 1; + } else if(t8 > 1) { + var v84 = closest; + v84.x = v2X12; + v84.y = v2Y12; + v84.z = v2Z12; + b8 = 2; + } else { + var p8; + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + var v85 = closest; + v85.x = pX8; + v85.y = pY8; + v85.z = pZ8; + b8 = 3; + } + var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d18 < mind3) { + mini3 = b8 << 1; + mind3 = d18; + var v86 = closest; + minvX3 = v86.x; + minvY3 = v86.y; + minvZ3 = v86.z; + } + } + if(d312 < 0) { + var v120; + var v1X13; + var v1Y13; + var v1Z13; + var v219; + var v2X13; + var v2Y13; + var v2Z13; + var v87 = vec11; + v1X13 = v87.x; + v1Y13 = v87.y; + v1Z13 = v87.z; + var v88 = vec4; + v2X13 = v88.x; + v2Y13 = v88.y; + v2Z13 = v88.z; + var v1213; + var v12X13; + var v12Y13; + var v12Z13; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; + var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; + t9 = -t9 / d19; + var b9; + if(t9 < 0) { + var v89 = closest; + v89.x = v1X13; + v89.y = v1Y13; + v89.z = v1Z13; + b9 = 1; + } else if(t9 > 1) { + var v90 = closest; + v90.x = v2X13; + v90.y = v2Y13; + v90.z = v2Z13; + b9 = 2; + } else { + var p9; + var pX9; + var pY9; + var pZ9; + pX9 = v1X13 + v12X13 * t9; + pY9 = v1Y13 + v12Y13 * t9; + pZ9 = v1Z13 + v12Z13 * t9; + var v91 = closest; + v91.x = pX9; + v91.y = pY9; + v91.z = pZ9; + b9 = 3; + } + var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d20 < mind3) { + mini3 = b9 & 1 | (b9 & 2) << 1; + mind3 = d20; + var v92 = closest; + minvX3 = v92.x; + minvY3 = v92.y; + minvZ3 = v92.z; + } + } + var b10; + if(mind3 > 0) { + var v93 = closest; + v93.x = minvX3; + v93.y = minvY3; + v93.z = minvZ3; + b10 = mini3; + } else { + var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX3 *= l3; + nY3 *= l3; + nZ3 *= l3; + var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; + var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l22 = dn2 / l22; + minvX3 = nX3 * l22; + minvY3 = nY3 * l22; + minvZ3 = nZ3 * l22; + var v94 = closest; + v94.x = minvX3; + v94.y = minvY3; + v94.z = minvZ3; + b10 = 7; + } + var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d21 < mind1) { + mini1 = b10 & 1 | (b10 & 6) << 1; + mind1 = d21; + var v95 = closest; + minvX1 = v95.x; + minvY1 = v95.y; + minvZ1 = v95.z; + } + } + if(d142 * sign < 0) { + var v130; + var v1X14; + var v1Y14; + var v1Z14; + var v220; + var v2X14; + var v2Y14; + var v2Z14; + var v316; + var v3X4; + var v3Y4; + var v3Z4; + var v1214; + var v12X14; + var v12Y14; + var v12Z14; + var v234; + var v23X4; + var v23Y4; + var v23Z4; + var v317; + var v31X3; + var v31Y3; + var v31Z3; + var v96 = vec11; + v1X14 = v96.x; + v1Y14 = v96.y; + v1Z14 = v96.z; + var v97 = vec21; + v2X14 = v97.x; + v2Y14 = v97.y; + v2Z14 = v97.z; + var v98 = vec4; + v3X4 = v98.x; + v3Y4 = v98.y; + v3Z4 = v98.z; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + v23X4 = v3X4 - v2X14; + v23Y4 = v3Y4 - v2Y14; + v23Z4 = v3Z4 - v2Z14; + v31X3 = v1X14 - v3X4; + v31Y3 = v1Y14 - v3Y4; + v31Z3 = v1Z14 - v3Z4; + var n4; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; + var n124; + var n12X3; + var n12Y3; + var n12Z3; + var n233; + var n23X3; + var n23Y3; + var n23Z3; + var n313; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; + n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; + n12Z3 = v12X14 * nY4 - v12Y14 * nX4; + n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; + n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; + n23Z3 = v23X4 * nY4 - v23Y4 * nX4; + n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; + n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; + n31Z3 = v31X3 * nY4 - v31Y3 * nX4; + var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; + var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; + var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + var mind4 = -1; + var minv4; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(d124 < 0) { + var v132; + var v1X15; + var v1Y15; + var v1Z15; + var v221; + var v2X15; + var v2Y15; + var v2Z15; + var v99 = vec11; + v1X15 = v99.x; + v1Y15 = v99.y; + v1Z15 = v99.z; + var v100 = vec21; + v2X15 = v100.x; + v2Y15 = v100.y; + v2Z15 = v100.z; + var v1215; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / d22; + var b11; + if(t10 < 0) { + var v101 = closest; + v101.x = v1X15; + v101.y = v1Y15; + v101.z = v1Z15; + b11 = 1; + } else if(t10 > 1) { + var v102 = closest; + v102.x = v2X15; + v102.y = v2Y15; + v102.z = v2Z15; + b11 = 2; + } else { + var p10; + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + var v103 = closest; + v103.x = pX10; + v103.y = pY10; + v103.z = pZ10; + b11 = 3; + } + var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini4 = b11; + mind4 = d24; + var v104 = closest; + minvX4 = v104.x; + minvY4 = v104.y; + minvZ4 = v104.z; + } + if(d233 < 0) { + var v133; + var v1X16; + var v1Y16; + var v1Z16; + var v222; + var v2X16; + var v2Y16; + var v2Z16; + var v105 = vec21; + v1X16 = v105.x; + v1Y16 = v105.y; + v1Z16 = v105.z; + var v106 = vec4; + v2X16 = v106.x; + v2Y16 = v106.y; + v2Z16 = v106.z; + var v1216; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / d25; + var b12; + if(t11 < 0) { + var v107 = closest; + v107.x = v1X16; + v107.y = v1Y16; + v107.z = v1Z16; + b12 = 1; + } else if(t11 > 1) { + var v108 = closest; + v108.x = v2X16; + v108.y = v2Y16; + v108.z = v2Z16; + b12 = 2; + } else { + var p11; + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + var v109 = closest; + v109.x = pX11; + v109.y = pY11; + v109.z = pZ11; + b12 = 3; + } + var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d26 < mind4) { + mini4 = b12 << 1; + mind4 = d26; + var v134 = closest; + minvX4 = v134.x; + minvY4 = v134.y; + minvZ4 = v134.z; + } + } + if(d313 < 0) { + var v135; + var v1X17; + var v1Y17; + var v1Z17; + var v223; + var v2X17; + var v2Y17; + var v2Z17; + var v136 = vec11; + v1X17 = v136.x; + v1Y17 = v136.y; + v1Z17 = v136.z; + var v137 = vec4; + v2X17 = v137.x; + v2Y17 = v137.y; + v2Z17 = v137.z; + var v1217; + var v12X17; + var v12Y17; + var v12Z17; + v12X17 = v2X17 - v1X17; + v12Y17 = v2Y17 - v1Y17; + v12Z17 = v2Z17 - v1Z17; + var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; + var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; + t12 = -t12 / d27; + var b13; + if(t12 < 0) { + var v138 = closest; + v138.x = v1X17; + v138.y = v1Y17; + v138.z = v1Z17; + b13 = 1; + } else if(t12 > 1) { + var v139 = closest; + v139.x = v2X17; + v139.y = v2Y17; + v139.z = v2Z17; + b13 = 2; + } else { + var p12; + var pX12; + var pY12; + var pZ12; + pX12 = v1X17 + v12X17 * t12; + pY12 = v1Y17 + v12Y17 * t12; + pZ12 = v1Z17 + v12Z17 * t12; + var v140 = closest; + v140.x = pX12; + v140.y = pY12; + v140.z = pZ12; + b13 = 3; + } + var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d28 < mind4) { + mini4 = b13 & 1 | (b13 & 2) << 1; + mind4 = d28; + var v142 = closest; + minvX4 = v142.x; + minvY4 = v142.y; + minvZ4 = v142.z; + } + } + var b14; + if(mind4 > 0) { + var v143 = closest; + v143.x = minvX4; + v143.y = minvY4; + v143.z = minvZ4; + b14 = mini4; + } else { + var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX4 *= l4; + nY4 *= l4; + nZ4 *= l4; + var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; + var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l23 = dn3 / l23; + minvX4 = nX4 * l23; + minvY4 = nY4 * l23; + minvZ4 = nZ4 * l23; + var v144 = closest; + v144.x = minvX4; + v144.y = minvY4; + v144.z = minvZ4; + b14 = 7; + } + var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d29 < mind1) { + mini1 = b14 & 3 | (b14 & 4) << 1; + mind1 = d29; + var v145 = closest; + minvX1 = v145.x; + minvY1 = v145.y; + minvZ1 = v145.z; + } + } + if(d243 * sign < 0) { + var v146; + var v1X18; + var v1Y18; + var v1Z18; + var v224; + var v2X18; + var v2Y18; + var v2Z18; + var v318; + var v3X5; + var v3Y5; + var v3Z5; + var v1218; + var v12X18; + var v12Y18; + var v12Z18; + var v235; + var v23X5; + var v23Y5; + var v23Z5; + var v319; + var v31X4; + var v31Y4; + var v31Z4; + var v147 = vec21; + v1X18 = v147.x; + v1Y18 = v147.y; + v1Z18 = v147.z; + var v148 = vec31; + v2X18 = v148.x; + v2Y18 = v148.y; + v2Z18 = v148.z; + var v149 = vec4; + v3X5 = v149.x; + v3Y5 = v149.y; + v3Z5 = v149.z; + v12X18 = v2X18 - v1X18; + v12Y18 = v2Y18 - v1Y18; + v12Z18 = v2Z18 - v1Z18; + v23X5 = v3X5 - v2X18; + v23Y5 = v3Y5 - v2Y18; + v23Z5 = v3Z5 - v2Z18; + v31X4 = v1X18 - v3X5; + v31Y4 = v1Y18 - v3Y5; + v31Z4 = v1Z18 - v3Z5; + var n5; + var nX5; + var nY5; + var nZ5; + nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; + var n125; + var n12X4; + var n12Y4; + var n12Z4; + var n234; + var n23X4; + var n23Y4; + var n23Z4; + var n314; + var n31X4; + var n31Y4; + var n31Z4; + n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; + n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; + n12Z4 = v12X18 * nY5 - v12Y18 * nX5; + n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; + n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; + n23Z4 = v23X5 * nY5 - v23Y5 * nX5; + n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; + n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; + n31Z4 = v31X4 * nY5 - v31Y4 * nX5; + var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; + var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; + var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; + var mind5 = -1; + var minv5; + var minvX5; + var minvY5; + var minvZ5; + var mini5 = 0; + minvX5 = 0; + minvY5 = 0; + minvZ5 = 0; + if(d125 < 0) { + var v150; + var v1X19; + var v1Y19; + var v1Z19; + var v225; + var v2X19; + var v2Y19; + var v2Z19; + var v151 = vec21; + v1X19 = v151.x; + v1Y19 = v151.y; + v1Z19 = v151.z; + var v152 = vec31; + v2X19 = v152.x; + v2Y19 = v152.y; + v2Z19 = v152.z; + var v1219; + var v12X19; + var v12Y19; + var v12Z19; + v12X19 = v2X19 - v1X19; + v12Y19 = v2Y19 - v1Y19; + v12Z19 = v2Z19 - v1Z19; + var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; + var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; + t13 = -t13 / d30; + var b15; + if(t13 < 0) { + var v153 = closest; + v153.x = v1X19; + v153.y = v1Y19; + v153.z = v1Z19; + b15 = 1; + } else if(t13 > 1) { + var v154 = closest; + v154.x = v2X19; + v154.y = v2Y19; + v154.z = v2Z19; + b15 = 2; + } else { + var p13; + var pX13; + var pY13; + var pZ13; + pX13 = v1X19 + v12X19 * t13; + pY13 = v1Y19 + v12Y19 * t13; + pZ13 = v1Z19 + v12Z19 * t13; + var v155 = closest; + v155.x = pX13; + v155.y = pY13; + v155.z = pZ13; + b15 = 3; + } + var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini5 = b15; + mind5 = d32; + var v156 = closest; + minvX5 = v156.x; + minvY5 = v156.y; + minvZ5 = v156.z; + } + if(d234 < 0) { + var v157; + var v1X20; + var v1Y20; + var v1Z20; + var v226; + var v2X20; + var v2Y20; + var v2Z20; + var v158 = vec31; + v1X20 = v158.x; + v1Y20 = v158.y; + v1Z20 = v158.z; + var v159 = vec4; + v2X20 = v159.x; + v2Y20 = v159.y; + v2Z20 = v159.z; + var v1220; + var v12X20; + var v12Y20; + var v12Z20; + v12X20 = v2X20 - v1X20; + v12Y20 = v2Y20 - v1Y20; + v12Z20 = v2Z20 - v1Z20; + var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; + var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; + t14 = -t14 / d33; + var b16; + if(t14 < 0) { + var v160 = closest; + v160.x = v1X20; + v160.y = v1Y20; + v160.z = v1Z20; + b16 = 1; + } else if(t14 > 1) { + var v161 = closest; + v161.x = v2X20; + v161.y = v2Y20; + v161.z = v2Z20; + b16 = 2; + } else { + var p14; + var pX14; + var pY14; + var pZ14; + pX14 = v1X20 + v12X20 * t14; + pY14 = v1Y20 + v12Y20 * t14; + pZ14 = v1Z20 + v12Z20 * t14; + var v162 = closest; + v162.x = pX14; + v162.y = pY14; + v162.z = pZ14; + b16 = 3; + } + var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d34 < mind5) { + mini5 = b16 << 1; + mind5 = d34; + var v163 = closest; + minvX5 = v163.x; + minvY5 = v163.y; + minvZ5 = v163.z; + } + } + if(d314 < 0) { + var v164; + var v1X21; + var v1Y21; + var v1Z21; + var v227; + var v2X21; + var v2Y21; + var v2Z21; + var v165 = vec21; + v1X21 = v165.x; + v1Y21 = v165.y; + v1Z21 = v165.z; + var v166 = vec4; + v2X21 = v166.x; + v2Y21 = v166.y; + v2Z21 = v166.z; + var v1221; + var v12X21; + var v12Y21; + var v12Z21; + v12X21 = v2X21 - v1X21; + v12Y21 = v2Y21 - v1Y21; + v12Z21 = v2Z21 - v1Z21; + var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; + var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; + t15 = -t15 / d35; + var b17; + if(t15 < 0) { + var v167 = closest; + v167.x = v1X21; + v167.y = v1Y21; + v167.z = v1Z21; + b17 = 1; + } else if(t15 > 1) { + var v168 = closest; + v168.x = v2X21; + v168.y = v2Y21; + v168.z = v2Z21; + b17 = 2; + } else { + var p15; + var pX15; + var pY15; + var pZ15; + pX15 = v1X21 + v12X21 * t15; + pY15 = v1Y21 + v12Y21 * t15; + pZ15 = v1Z21 + v12Z21 * t15; + var v169 = closest; + v169.x = pX15; + v169.y = pY15; + v169.z = pZ15; + b17 = 3; + } + var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d36 < mind5) { + mini5 = b17 & 1 | (b17 & 2) << 1; + mind5 = d36; + var v170 = closest; + minvX5 = v170.x; + minvY5 = v170.y; + minvZ5 = v170.z; + } + } + var b18; + if(mind5 > 0) { + var v171 = closest; + v171.x = minvX5; + v171.y = minvY5; + v171.z = minvZ5; + b18 = mini5; + } else { + var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + nX5 *= l5; + nY5 *= l5; + nZ5 *= l5; + var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; + var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + l24 = dn4 / l24; + minvX5 = nX5 * l24; + minvY5 = nY5 * l24; + minvZ5 = nZ5 * l24; + var v172 = closest; + v172.x = minvX5; + v172.y = minvY5; + v172.z = minvZ5; + b18 = 7; + } + var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d37 < mind1) { + mini1 = b18 << 1; + mind1 = d37; + var v173 = closest; + minvX1 = v173.x; + minvY1 = v173.y; + minvZ1 = v173.z; + } + } + if(mind1 > 0) { + var v174 = closest; + v174.x = minvX1; + v174.y = minvY1; + v174.z = minvZ1; + v3 = mini1; + } else { + closest.zero(); + v3 = 15; + } + break; + } + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + if(!useEpa) { + this.distance = 0; + return 0; + } + switch(this.simplexSize) { + case 1: + this.pointToTetrahedron(); + break; + case 2: + this.lineToTetrahedron(); + break; + case 3: + this.triangleToTetrahedron(); + break; + } + if(this.simplexSize == 4) { + var epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); + if(epaState != 0) { + this.distance = 0; + return epaState; + } + this.distance = -this.depth; + return 0; + } + this.distance = 0; + return 1; + } + this.shrinkSimplex(v3); + dir.x = closest.x; + dir.y = closest.y; + dir.z = closest.z; + var _this2 = dir; + var tx1 = -_this2.x; + var ty1 = -_this2.y; + var tz1 = -_this2.z; + _this2.x = tx1; + _this2.y = ty1; + _this2.z = tz1; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this3 = this.s[this.simplexSize]; + var v175 = this.w1[this.simplexSize]; + _this3.x = v175.x; + _this3.y = v175.y; + _this3.z = v175.z; + var _this4 = _this3; + var v176 = this.w2[this.simplexSize]; + var tx2 = _this4.x - v176.x; + var ty2 = _this4.y - v176.y; + var tz2 = _this4.z - v176.z; + _this4.x = tx2; + _this4.y = ty2; + _this4.z = tz2; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + throw new Error("!?"); + } + var d110 = closest.x * dir.x + closest.y * dir.y + closest.z * dir.z; + var _this5 = s[this.simplexSize]; + var d210 = _this5.x * dir.x + _this5.y * dir.y + _this5.z * dir.z; + if(d210 - d110 < eps2) { + this.interpolateClosestPoints(); + this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); + if(cache != null && cache._gjkCache != null) { + this.saveCache(cache._gjkCache); + } + return 0; + } + this.simplexSize++; + ++count; + } + return 2; + } + convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit) { + this.c1 = c1; + this.c2 = c2; + this.tf1 = tf1; + this.tf2 = tf2; + var s = this.s; + var w1 = this.w1; + var w2 = this.w2; + var closest = this.closest; + var dir = this.dir; + var firstDir; + var firstDirX; + var firstDirY; + var firstDirZ; + firstDirX = tf2._positionX - tf1._positionX; + firstDirY = tf2._positionY - tf1._positionY; + firstDirZ = tf2._positionZ - tf1._positionZ; + var v = dir; + v.x = firstDirX; + v.y = firstDirY; + v.z = firstDirZ; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { + dir.init(1,0,0); + } + this.simplexSize = 0; + if(this.c1 != null) { + this.computeWitnessPoint1(true); + } else { + var v1 = this.w1[this.simplexSize]; + v1.x = this.tf1._positionX; + v1.y = this.tf1._positionY; + v1.z = this.tf1._positionZ; + } + this.computeWitnessPoint2(true); + var _this = this.s[this.simplexSize]; + var v2 = this.w1[this.simplexSize]; + _this.x = v2.x; + _this.y = v2.y; + _this.z = v2.z; + var _this1 = _this; + var v3 = this.w2[this.simplexSize]; + var tx = _this1.x - v3.x; + var ty = _this1.y - v3.y; + var tz = _this1.z - v3.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + this.simplexSize = 1; + var count = 0; + var max = 40; + var lambda = 0.0; + var rayX = this.rayX; + var rayR = this.rayR; + rayX.zero(); + rayR.x = tl2.x; + rayR.y = tl2.y; + rayR.z = tl2.z; + var _this2 = rayR; + var tx1 = _this2.x - tl1.x; + var ty1 = _this2.y - tl1.y; + var tz1 = _this2.z - tl1.z; + _this2.x = tx1; + _this2.y = ty1; + _this2.z = tz1; + var eps = 1e-4; + var eps2 = eps * eps; + while(count < max) { + var v4 = 0; + switch(this.simplexSize) { + case 1: + var v5 = s[0]; + closest.x = v5.x; + closest.y = v5.y; + closest.z = v5.z; + v4 = 1; + break; + case 2: + var v11; + var v1X; + var v1Y; + var v1Z; + var v21; + var v2X; + var v2Y; + var v2Z; + var v6 = s[0]; + v1X = v6.x; + v1Y = v6.y; + v1Z = v6.z; + var v7 = s[1]; + v2X = v7.x; + v2Y = v7.y; + v2Z = v7.z; + var v12; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / d; + if(t < 0) { + var v8 = closest; + v8.x = v1X; + v8.y = v1Y; + v8.z = v1Z; + v4 = 1; + } else if(t > 1) { + var v9 = closest; + v9.x = v2X; + v9.y = v2Y; + v9.z = v2Z; + v4 = 2; + } else { + var p; + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + var v10 = closest; + v10.x = pX; + v10.y = pY; + v10.z = pZ; + v4 = 3; + } + break; + case 3: + var vec1 = s[0]; + var vec2 = s[1]; + var vec3 = s[2]; + var v13; + var v1X1; + var v1Y1; + var v1Z1; + var v22; + var v2X1; + var v2Y1; + var v2Z1; + var v31; + var v3X; + var v3Y; + var v3Z; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + var v23; + var v23X; + var v23Y; + var v23Z; + var v311; + var v31X; + var v31Y; + var v31Z; + var v14 = vec1; + v1X1 = v14.x; + v1Y1 = v14.y; + v1Z1 = v14.z; + var v15 = vec2; + v2X1 = v15.x; + v2Y1 = v15.y; + v2Z1 = v15.z; + var v16 = vec3; + v3X = v16.x; + v3Y = v16.y; + v3Z = v16.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; + var n; + var nX; + var nY; + var nZ; + nX = v12Y1 * v23Z - v12Z1 * v23Y; + nY = v12Z1 * v23X - v12X1 * v23Z; + nZ = v12X1 * v23Y - v12Y1 * v23X; + var n12; + var n12X; + var n12Y; + var n12Z; + var n23; + var n23X; + var n23Y; + var n23Z; + var n31; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ - v12Z1 * nY; + n12Y = v12Z1 * nX - v12X1 * nZ; + n12Z = v12X1 * nY - v12Y1 * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; + var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; + var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; + var mind = -1; + var minv; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(d12 < 0) { + var v17; + var v1X2; + var v1Y2; + var v1Z2; + var v24; + var v2X2; + var v2Y2; + var v2Z2; + var v18 = vec1; + v1X2 = v18.x; + v1Y2 = v18.y; + v1Z2 = v18.z; + var v19 = vec2; + v2X2 = v19.x; + v2Y2 = v19.y; + v2Z2 = v19.z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / d1; + var b; + if(t1 < 0) { + var v20 = closest; + v20.x = v1X2; + v20.y = v1Y2; + v20.z = v1Z2; + b = 1; + } else if(t1 > 1) { + var v25 = closest; + v25.x = v2X2; + v25.y = v2Y2; + v25.z = v2Z2; + b = 2; + } else { + var p1; + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + var v26 = closest; + v26.x = pX1; + v26.y = pY1; + v26.z = pZ1; + b = 3; + } + var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini = b; + mind = d2; + var v27 = closest; + minvX = v27.x; + minvY = v27.y; + minvZ = v27.z; + } + if(d23 < 0) { + var v110; + var v1X3; + var v1Y3; + var v1Z3; + var v28; + var v2X3; + var v2Y3; + var v2Z3; + var v29 = vec2; + v1X3 = v29.x; + v1Y3 = v29.y; + v1Z3 = v29.z; + var v30 = vec3; + v2X3 = v30.x; + v2Y3 = v30.y; + v2Z3 = v30.z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / d3; + var b1; + if(t2 < 0) { + var v32 = closest; + v32.x = v1X3; + v32.y = v1Y3; + v32.z = v1Z3; + b1 = 1; + } else if(t2 > 1) { + var v33 = closest; + v33.x = v2X3; + v33.y = v2Y3; + v33.z = v2Z3; + b1 = 2; + } else { + var p2; + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + var v34 = closest; + v34.x = pX2; + v34.y = pY2; + v34.z = pZ2; + b1 = 3; + } + var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d4 < mind) { + mini = b1 << 1; + mind = d4; + var v35 = closest; + minvX = v35.x; + minvY = v35.y; + minvZ = v35.z; + } + } + if(d31 < 0) { + var v111; + var v1X4; + var v1Y4; + var v1Z4; + var v210; + var v2X4; + var v2Y4; + var v2Z4; + var v36 = vec1; + v1X4 = v36.x; + v1Y4 = v36.y; + v1Z4 = v36.z; + var v37 = vec3; + v2X4 = v37.x; + v2Y4 = v37.y; + v2Z4 = v37.z; + var v124; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; + var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t3 = -t3 / d5; + var b2; + if(t3 < 0) { + var v38 = closest; + v38.x = v1X4; + v38.y = v1Y4; + v38.z = v1Z4; + b2 = 1; + } else if(t3 > 1) { + var v39 = closest; + v39.x = v2X4; + v39.y = v2Y4; + v39.z = v2Z4; + b2 = 2; + } else { + var p3; + var pX3; + var pY3; + var pZ3; + pX3 = v1X4 + v12X4 * t3; + pY3 = v1Y4 + v12Y4 * t3; + pZ3 = v1Z4 + v12Z4 * t3; + var v40 = closest; + v40.x = pX3; + v40.y = pY3; + v40.z = pZ3; + b2 = 3; + } + var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d6 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d6; + var v41 = closest; + minvX = v41.x; + minvY = v41.y; + minvZ = v41.z; + } + } + if(mind > 0) { + var v42 = closest; + v42.x = minvX; + v42.y = minvY; + v42.z = minvZ; + v4 = mini; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = dn / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + var v43 = closest; + v43.x = minvX; + v43.y = minvY; + v43.z = minvZ; + v4 = 7; + } + break; + case 4: + var vec11 = s[0]; + var vec21 = s[1]; + var vec31 = s[2]; + var vec4 = s[3]; + var v112; + var v1X5; + var v1Y5; + var v1Z5; + var v211; + var v2X5; + var v2Y5; + var v2Z5; + var v310; + var v3X1; + var v3Y1; + var v3Z1; + var v44; + var v4X; + var v4Y; + var v4Z; + var v125; + var v12X5; + var v12Y5; + var v12Z5; + var v131; + var v13X; + var v13Y; + var v13Z; + var v141; + var v14X; + var v14Y; + var v14Z; + var v231; + var v23X1; + var v23Y1; + var v23Z1; + var v241; + var v24X; + var v24Y; + var v24Z; + var v341; + var v34X; + var v34Y; + var v34Z; + var v45 = vec11; + v1X5 = v45.x; + v1Y5 = v45.y; + v1Z5 = v45.z; + var v46 = vec21; + v2X5 = v46.x; + v2Y5 = v46.y; + v2Z5 = v46.z; + var v47 = vec31; + v3X1 = v47.x; + v3Y1 = v47.y; + v3Z1 = v47.z; + var v48 = vec4; + v4X = v48.x; + v4Y = v48.y; + v4Z = v48.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v13X = v3X1 - v1X5; + v13Y = v3Y1 - v1Y5; + v13Z = v3Z1 - v1Z5; + v14X = v4X - v1X5; + v14Y = v4Y - v1Y5; + v14Z = v4Z - v1Z5; + v23X1 = v3X1 - v2X5; + v23Y1 = v3Y1 - v2Y5; + v23Z1 = v3Z1 - v2Z5; + v24X = v4X - v2X5; + v24Y = v4Y - v2Y5; + v24Z = v4Z - v2Z5; + v34X = v4X - v3X1; + v34Y = v4Y - v3Y1; + v34Z = v4Z - v3Z1; + var rev; + var n123; + var n123X; + var n123Y; + var n123Z; + var n134; + var n134X; + var n134Y; + var n134Z; + var n142; + var n142X; + var n142Y; + var n142Z; + var n243; + var n243X; + var n243Y; + var n243Z; + var n1; + var nX1; + var nY1; + var nZ1; + n123X = v12Y5 * v13Z - v12Z5 * v13Y; + n123Y = v12Z5 * v13X - v12X5 * v13Z; + n123Z = v12X5 * v13Y - v12Y5 * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z5 - v14Z * v12Y5; + n142Y = v14Z * v12X5 - v14X * v12Z5; + n142Z = v14X * v12Y5 - v14Y * v12X5; + n243X = v24Y * v23Z1 - v24Z * v23Y1; + n243Y = v24Z * v23X1 - v24X * v23Z1; + n243Z = v24X * v23Y1 - v24Y * v23X1; + var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; + var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; + var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; + var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; + var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; + var mind1 = -1; + var minv1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(d123 * sign < 0) { + var v113; + var v1X6; + var v1Y6; + var v1Z6; + var v212; + var v2X6; + var v2Y6; + var v2Z6; + var v312; + var v3X2; + var v3Y2; + var v3Z2; + var v126; + var v12X6; + var v12Y6; + var v12Z6; + var v232; + var v23X2; + var v23Y2; + var v23Z2; + var v313; + var v31X1; + var v31Y1; + var v31Z1; + var v49 = vec11; + v1X6 = v49.x; + v1Y6 = v49.y; + v1Z6 = v49.z; + var v50 = vec21; + v2X6 = v50.x; + v2Y6 = v50.y; + v2Z6 = v50.z; + var v51 = vec31; + v3X2 = v51.x; + v3Y2 = v51.y; + v3Z2 = v51.z; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + v23X2 = v3X2 - v2X6; + v23Y2 = v3Y2 - v2Y6; + v23Z2 = v3Z2 - v2Z6; + v31X1 = v1X6 - v3X2; + v31Y1 = v1Y6 - v3Y2; + v31Z1 = v1Z6 - v3Z2; + var n2; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; + nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; + nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; + var n121; + var n12X1; + var n12Y1; + var n12Z1; + var n231; + var n23X1; + var n23Y1; + var n23Z1; + var n311; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; + n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; + n12Z1 = v12X6 * nY2 - v12Y6 * nX2; + n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; + n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; + n23Z1 = v23X2 * nY2 - v23Y2 * nX2; + n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; + n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; + n31Z1 = v31X1 * nY2 - v31Y1 * nX2; + var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; + var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; + var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + var mind2 = -1; + var minv2; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(d121 < 0) { + var v114; + var v1X7; + var v1Y7; + var v1Z7; + var v213; + var v2X7; + var v2Y7; + var v2Z7; + var v52 = vec11; + v1X7 = v52.x; + v1Y7 = v52.y; + v1Z7 = v52.z; + var v53 = vec21; + v2X7 = v53.x; + v2Y7 = v53.y; + v2Z7 = v53.z; + var v127; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / d7; + var b3; + if(t4 < 0) { + var v54 = closest; + v54.x = v1X7; + v54.y = v1Y7; + v54.z = v1Z7; + b3 = 1; + } else if(t4 > 1) { + var v55 = closest; + v55.x = v2X7; + v55.y = v2Y7; + v55.z = v2Z7; + b3 = 2; + } else { + var p4; + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + var v56 = closest; + v56.x = pX4; + v56.y = pY4; + v56.z = pZ4; + b3 = 3; + } + var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini2 = b3; + mind2 = d8; + var v57 = closest; + minvX2 = v57.x; + minvY2 = v57.y; + minvZ2 = v57.z; + } + if(d231 < 0) { + var v115; + var v1X8; + var v1Y8; + var v1Z8; + var v214; + var v2X8; + var v2Y8; + var v2Z8; + var v58 = vec21; + v1X8 = v58.x; + v1Y8 = v58.y; + v1Z8 = v58.z; + var v59 = vec31; + v2X8 = v59.x; + v2Y8 = v59.y; + v2Z8 = v59.z; + var v128; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / d9; + var b4; + if(t5 < 0) { + var v60 = closest; + v60.x = v1X8; + v60.y = v1Y8; + v60.z = v1Z8; + b4 = 1; + } else if(t5 > 1) { + var v61 = closest; + v61.x = v2X8; + v61.y = v2Y8; + v61.z = v2Z8; + b4 = 2; + } else { + var p5; + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + var v62 = closest; + v62.x = pX5; + v62.y = pY5; + v62.z = pZ5; + b4 = 3; + } + var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d10 < mind2) { + mini2 = b4 << 1; + mind2 = d10; + var v63 = closest; + minvX2 = v63.x; + minvY2 = v63.y; + minvZ2 = v63.z; + } + } + if(d311 < 0) { + var v116; + var v1X9; + var v1Y9; + var v1Z9; + var v215; + var v2X9; + var v2Y9; + var v2Z9; + var v64 = vec11; + v1X9 = v64.x; + v1Y9 = v64.y; + v1Z9 = v64.z; + var v65 = vec31; + v2X9 = v65.x; + v2Y9 = v65.y; + v2Z9 = v65.z; + var v129; + var v12X9; + var v12Y9; + var v12Z9; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; + var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; + t6 = -t6 / d11; + var b5; + if(t6 < 0) { + var v66 = closest; + v66.x = v1X9; + v66.y = v1Y9; + v66.z = v1Z9; + b5 = 1; + } else if(t6 > 1) { + var v67 = closest; + v67.x = v2X9; + v67.y = v2Y9; + v67.z = v2Z9; + b5 = 2; + } else { + var p6; + var pX6; + var pY6; + var pZ6; + pX6 = v1X9 + v12X9 * t6; + pY6 = v1Y9 + v12Y9 * t6; + pZ6 = v1Z9 + v12Z9 * t6; + var v68 = closest; + v68.x = pX6; + v68.y = pY6; + v68.z = pZ6; + b5 = 3; + } + var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind2 < 0 || d13 < mind2) { + mini2 = b5 & 1 | (b5 & 2) << 1; + mind2 = d13; + var v69 = closest; + minvX2 = v69.x; + minvY2 = v69.y; + minvZ2 = v69.z; + } + } + var b6; + if(mind2 > 0) { + var v70 = closest; + v70.x = minvX2; + v70.y = minvY2; + v70.z = minvZ2; + b6 = mini2; + } else { + var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX2 *= l1; + nY2 *= l1; + nZ2 *= l1; + var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; + var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l21 = dn1 / l21; + minvX2 = nX2 * l21; + minvY2 = nY2 * l21; + minvZ2 = nZ2 * l21; + var v71 = closest; + v71.x = minvX2; + v71.y = minvY2; + v71.z = minvZ2; + b6 = 7; + } + var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini1 = b6; + mind1 = d14; + var v72 = closest; + minvX1 = v72.x; + minvY1 = v72.y; + minvZ1 = v72.z; + } + if(d134 * sign < 0) { + var v117; + var v1X10; + var v1Y10; + var v1Z10; + var v216; + var v2X10; + var v2Y10; + var v2Z10; + var v314; + var v3X3; + var v3Y3; + var v3Z3; + var v1210; + var v12X10; + var v12Y10; + var v12Z10; + var v233; + var v23X3; + var v23Y3; + var v23Z3; + var v315; + var v31X2; + var v31Y2; + var v31Z2; + var v73 = vec11; + v1X10 = v73.x; + v1Y10 = v73.y; + v1Z10 = v73.z; + var v74 = vec31; + v2X10 = v74.x; + v2Y10 = v74.y; + v2Z10 = v74.z; + var v75 = vec4; + v3X3 = v75.x; + v3Y3 = v75.y; + v3Z3 = v75.z; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + v23X3 = v3X3 - v2X10; + v23Y3 = v3Y3 - v2Y10; + v23Z3 = v3Z3 - v2Z10; + v31X2 = v1X10 - v3X3; + v31Y2 = v1Y10 - v3Y3; + v31Z2 = v1Z10 - v3Z3; + var n3; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; + nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; + nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; + var n122; + var n12X2; + var n12Y2; + var n12Z2; + var n232; + var n23X2; + var n23Y2; + var n23Z2; + var n312; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; + n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; + n12Z2 = v12X10 * nY3 - v12Y10 * nX3; + n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; + n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; + n23Z2 = v23X3 * nY3 - v23Y3 * nX3; + n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; + n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; + n31Z2 = v31X2 * nY3 - v31Y2 * nX3; + var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; + var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; + var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + var mind3 = -1; + var minv3; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(d122 < 0) { + var v118; + var v1X11; + var v1Y11; + var v1Z11; + var v217; + var v2X11; + var v2Y11; + var v2Z11; + var v76 = vec11; + v1X11 = v76.x; + v1Y11 = v76.y; + v1Z11 = v76.z; + var v77 = vec31; + v2X11 = v77.x; + v2Y11 = v77.y; + v2Z11 = v77.z; + var v1211; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / d15; + var b7; + if(t7 < 0) { + var v78 = closest; + v78.x = v1X11; + v78.y = v1Y11; + v78.z = v1Z11; + b7 = 1; + } else if(t7 > 1) { + var v79 = closest; + v79.x = v2X11; + v79.y = v2Y11; + v79.z = v2Z11; + b7 = 2; + } else { + var p7; + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + var v80 = closest; + v80.x = pX7; + v80.y = pY7; + v80.z = pZ7; + b7 = 3; + } + var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini3 = b7; + mind3 = d16; + var v81 = closest; + minvX3 = v81.x; + minvY3 = v81.y; + minvZ3 = v81.z; + } + if(d232 < 0) { + var v119; + var v1X12; + var v1Y12; + var v1Z12; + var v218; + var v2X12; + var v2Y12; + var v2Z12; + var v82 = vec31; + v1X12 = v82.x; + v1Y12 = v82.y; + v1Z12 = v82.z; + var v83 = vec4; + v2X12 = v83.x; + v2Y12 = v83.y; + v2Z12 = v83.z; + var v1212; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / d17; + var b8; + if(t8 < 0) { + var v84 = closest; + v84.x = v1X12; + v84.y = v1Y12; + v84.z = v1Z12; + b8 = 1; + } else if(t8 > 1) { + var v85 = closest; + v85.x = v2X12; + v85.y = v2Y12; + v85.z = v2Z12; + b8 = 2; + } else { + var p8; + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + var v86 = closest; + v86.x = pX8; + v86.y = pY8; + v86.z = pZ8; + b8 = 3; + } + var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d18 < mind3) { + mini3 = b8 << 1; + mind3 = d18; + var v87 = closest; + minvX3 = v87.x; + minvY3 = v87.y; + minvZ3 = v87.z; + } + } + if(d312 < 0) { + var v120; + var v1X13; + var v1Y13; + var v1Z13; + var v219; + var v2X13; + var v2Y13; + var v2Z13; + var v88 = vec11; + v1X13 = v88.x; + v1Y13 = v88.y; + v1Z13 = v88.z; + var v89 = vec4; + v2X13 = v89.x; + v2Y13 = v89.y; + v2Z13 = v89.z; + var v1213; + var v12X13; + var v12Y13; + var v12Z13; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; + var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; + t9 = -t9 / d19; + var b9; + if(t9 < 0) { + var v90 = closest; + v90.x = v1X13; + v90.y = v1Y13; + v90.z = v1Z13; + b9 = 1; + } else if(t9 > 1) { + var v91 = closest; + v91.x = v2X13; + v91.y = v2Y13; + v91.z = v2Z13; + b9 = 2; + } else { + var p9; + var pX9; + var pY9; + var pZ9; + pX9 = v1X13 + v12X13 * t9; + pY9 = v1Y13 + v12Y13 * t9; + pZ9 = v1Z13 + v12Z13 * t9; + var v92 = closest; + v92.x = pX9; + v92.y = pY9; + v92.z = pZ9; + b9 = 3; + } + var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind3 < 0 || d20 < mind3) { + mini3 = b9 & 1 | (b9 & 2) << 1; + mind3 = d20; + var v93 = closest; + minvX3 = v93.x; + minvY3 = v93.y; + minvZ3 = v93.z; + } + } + var b10; + if(mind3 > 0) { + var v94 = closest; + v94.x = minvX3; + v94.y = minvY3; + v94.z = minvZ3; + b10 = mini3; + } else { + var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX3 *= l3; + nY3 *= l3; + nZ3 *= l3; + var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; + var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l22 = dn2 / l22; + minvX3 = nX3 * l22; + minvY3 = nY3 * l22; + minvZ3 = nZ3 * l22; + var v95 = closest; + v95.x = minvX3; + v95.y = minvY3; + v95.z = minvZ3; + b10 = 7; + } + var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d21 < mind1) { + mini1 = b10 & 1 | (b10 & 6) << 1; + mind1 = d21; + var v96 = closest; + minvX1 = v96.x; + minvY1 = v96.y; + minvZ1 = v96.z; + } + } + if(d142 * sign < 0) { + var v130; + var v1X14; + var v1Y14; + var v1Z14; + var v220; + var v2X14; + var v2Y14; + var v2Z14; + var v316; + var v3X4; + var v3Y4; + var v3Z4; + var v1214; + var v12X14; + var v12Y14; + var v12Z14; + var v234; + var v23X4; + var v23Y4; + var v23Z4; + var v317; + var v31X3; + var v31Y3; + var v31Z3; + var v97 = vec11; + v1X14 = v97.x; + v1Y14 = v97.y; + v1Z14 = v97.z; + var v98 = vec21; + v2X14 = v98.x; + v2Y14 = v98.y; + v2Z14 = v98.z; + var v99 = vec4; + v3X4 = v99.x; + v3Y4 = v99.y; + v3Z4 = v99.z; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + v23X4 = v3X4 - v2X14; + v23Y4 = v3Y4 - v2Y14; + v23Z4 = v3Z4 - v2Z14; + v31X3 = v1X14 - v3X4; + v31Y3 = v1Y14 - v3Y4; + v31Z3 = v1Z14 - v3Z4; + var n4; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; + nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; + nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; + var n124; + var n12X3; + var n12Y3; + var n12Z3; + var n233; + var n23X3; + var n23Y3; + var n23Z3; + var n313; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; + n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; + n12Z3 = v12X14 * nY4 - v12Y14 * nX4; + n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; + n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; + n23Z3 = v23X4 * nY4 - v23Y4 * nX4; + n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; + n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; + n31Z3 = v31X3 * nY4 - v31Y3 * nX4; + var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; + var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; + var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + var mind4 = -1; + var minv4; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(d124 < 0) { + var v132; + var v1X15; + var v1Y15; + var v1Z15; + var v221; + var v2X15; + var v2Y15; + var v2Z15; + var v100 = vec11; + v1X15 = v100.x; + v1Y15 = v100.y; + v1Z15 = v100.z; + var v101 = vec21; + v2X15 = v101.x; + v2Y15 = v101.y; + v2Z15 = v101.z; + var v1215; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / d22; + var b11; + if(t10 < 0) { + var v102 = closest; + v102.x = v1X15; + v102.y = v1Y15; + v102.z = v1Z15; + b11 = 1; + } else if(t10 > 1) { + var v103 = closest; + v103.x = v2X15; + v103.y = v2Y15; + v103.z = v2Z15; + b11 = 2; + } else { + var p10; + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + var v104 = closest; + v104.x = pX10; + v104.y = pY10; + v104.z = pZ10; + b11 = 3; + } + var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini4 = b11; + mind4 = d24; + var v105 = closest; + minvX4 = v105.x; + minvY4 = v105.y; + minvZ4 = v105.z; + } + if(d233 < 0) { + var v133; + var v1X16; + var v1Y16; + var v1Z16; + var v222; + var v2X16; + var v2Y16; + var v2Z16; + var v106 = vec21; + v1X16 = v106.x; + v1Y16 = v106.y; + v1Z16 = v106.z; + var v107 = vec4; + v2X16 = v107.x; + v2Y16 = v107.y; + v2Z16 = v107.z; + var v1216; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / d25; + var b12; + if(t11 < 0) { + var v108 = closest; + v108.x = v1X16; + v108.y = v1Y16; + v108.z = v1Z16; + b12 = 1; + } else if(t11 > 1) { + var v109 = closest; + v109.x = v2X16; + v109.y = v2Y16; + v109.z = v2Z16; + b12 = 2; + } else { + var p11; + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + var v134 = closest; + v134.x = pX11; + v134.y = pY11; + v134.z = pZ11; + b12 = 3; + } + var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d26 < mind4) { + mini4 = b12 << 1; + mind4 = d26; + var v135 = closest; + minvX4 = v135.x; + minvY4 = v135.y; + minvZ4 = v135.z; + } + } + if(d313 < 0) { + var v136; + var v1X17; + var v1Y17; + var v1Z17; + var v223; + var v2X17; + var v2Y17; + var v2Z17; + var v137 = vec11; + v1X17 = v137.x; + v1Y17 = v137.y; + v1Z17 = v137.z; + var v138 = vec4; + v2X17 = v138.x; + v2Y17 = v138.y; + v2Z17 = v138.z; + var v1217; + var v12X17; + var v12Y17; + var v12Z17; + v12X17 = v2X17 - v1X17; + v12Y17 = v2Y17 - v1Y17; + v12Z17 = v2Z17 - v1Z17; + var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; + var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; + t12 = -t12 / d27; + var b13; + if(t12 < 0) { + var v139 = closest; + v139.x = v1X17; + v139.y = v1Y17; + v139.z = v1Z17; + b13 = 1; + } else if(t12 > 1) { + var v140 = closest; + v140.x = v2X17; + v140.y = v2Y17; + v140.z = v2Z17; + b13 = 2; + } else { + var p12; + var pX12; + var pY12; + var pZ12; + pX12 = v1X17 + v12X17 * t12; + pY12 = v1Y17 + v12Y17 * t12; + pZ12 = v1Z17 + v12Z17 * t12; + var v142 = closest; + v142.x = pX12; + v142.y = pY12; + v142.z = pZ12; + b13 = 3; + } + var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind4 < 0 || d28 < mind4) { + mini4 = b13 & 1 | (b13 & 2) << 1; + mind4 = d28; + var v143 = closest; + minvX4 = v143.x; + minvY4 = v143.y; + minvZ4 = v143.z; + } + } + var b14; + if(mind4 > 0) { + var v144 = closest; + v144.x = minvX4; + v144.y = minvY4; + v144.z = minvZ4; + b14 = mini4; + } else { + var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX4 *= l4; + nY4 *= l4; + nZ4 *= l4; + var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; + var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l23 = dn3 / l23; + minvX4 = nX4 * l23; + minvY4 = nY4 * l23; + minvZ4 = nZ4 * l23; + var v145 = closest; + v145.x = minvX4; + v145.y = minvY4; + v145.z = minvZ4; + b14 = 7; + } + var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d29 < mind1) { + mini1 = b14 & 3 | (b14 & 4) << 1; + mind1 = d29; + var v146 = closest; + minvX1 = v146.x; + minvY1 = v146.y; + minvZ1 = v146.z; + } + } + if(d243 * sign < 0) { + var v147; + var v1X18; + var v1Y18; + var v1Z18; + var v224; + var v2X18; + var v2Y18; + var v2Z18; + var v318; + var v3X5; + var v3Y5; + var v3Z5; + var v1218; + var v12X18; + var v12Y18; + var v12Z18; + var v235; + var v23X5; + var v23Y5; + var v23Z5; + var v319; + var v31X4; + var v31Y4; + var v31Z4; + var v148 = vec21; + v1X18 = v148.x; + v1Y18 = v148.y; + v1Z18 = v148.z; + var v149 = vec31; + v2X18 = v149.x; + v2Y18 = v149.y; + v2Z18 = v149.z; + var v150 = vec4; + v3X5 = v150.x; + v3Y5 = v150.y; + v3Z5 = v150.z; + v12X18 = v2X18 - v1X18; + v12Y18 = v2Y18 - v1Y18; + v12Z18 = v2Z18 - v1Z18; + v23X5 = v3X5 - v2X18; + v23Y5 = v3Y5 - v2Y18; + v23Z5 = v3Z5 - v2Z18; + v31X4 = v1X18 - v3X5; + v31Y4 = v1Y18 - v3Y5; + v31Z4 = v1Z18 - v3Z5; + var n5; + var nX5; + var nY5; + var nZ5; + nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; + nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; + nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; + var n125; + var n12X4; + var n12Y4; + var n12Z4; + var n234; + var n23X4; + var n23Y4; + var n23Z4; + var n314; + var n31X4; + var n31Y4; + var n31Z4; + n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; + n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; + n12Z4 = v12X18 * nY5 - v12Y18 * nX5; + n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; + n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; + n23Z4 = v23X5 * nY5 - v23Y5 * nX5; + n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; + n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; + n31Z4 = v31X4 * nY5 - v31Y4 * nX5; + var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; + var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; + var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; + var mind5 = -1; + var minv5; + var minvX5; + var minvY5; + var minvZ5; + var mini5 = 0; + minvX5 = 0; + minvY5 = 0; + minvZ5 = 0; + if(d125 < 0) { + var v151; + var v1X19; + var v1Y19; + var v1Z19; + var v225; + var v2X19; + var v2Y19; + var v2Z19; + var v152 = vec21; + v1X19 = v152.x; + v1Y19 = v152.y; + v1Z19 = v152.z; + var v153 = vec31; + v2X19 = v153.x; + v2Y19 = v153.y; + v2Z19 = v153.z; + var v1219; + var v12X19; + var v12Y19; + var v12Z19; + v12X19 = v2X19 - v1X19; + v12Y19 = v2Y19 - v1Y19; + v12Z19 = v2Z19 - v1Z19; + var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; + var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; + t13 = -t13 / d30; + var b15; + if(t13 < 0) { + var v154 = closest; + v154.x = v1X19; + v154.y = v1Y19; + v154.z = v1Z19; + b15 = 1; + } else if(t13 > 1) { + var v155 = closest; + v155.x = v2X19; + v155.y = v2Y19; + v155.z = v2Z19; + b15 = 2; + } else { + var p13; + var pX13; + var pY13; + var pZ13; + pX13 = v1X19 + v12X19 * t13; + pY13 = v1Y19 + v12Y19 * t13; + pZ13 = v1Z19 + v12Z19 * t13; + var v156 = closest; + v156.x = pX13; + v156.y = pY13; + v156.z = pZ13; + b15 = 3; + } + var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + mini5 = b15; + mind5 = d32; + var v157 = closest; + minvX5 = v157.x; + minvY5 = v157.y; + minvZ5 = v157.z; + } + if(d234 < 0) { + var v158; + var v1X20; + var v1Y20; + var v1Z20; + var v226; + var v2X20; + var v2Y20; + var v2Z20; + var v159 = vec31; + v1X20 = v159.x; + v1Y20 = v159.y; + v1Z20 = v159.z; + var v160 = vec4; + v2X20 = v160.x; + v2Y20 = v160.y; + v2Z20 = v160.z; + var v1220; + var v12X20; + var v12Y20; + var v12Z20; + v12X20 = v2X20 - v1X20; + v12Y20 = v2Y20 - v1Y20; + v12Z20 = v2Z20 - v1Z20; + var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; + var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; + t14 = -t14 / d33; + var b16; + if(t14 < 0) { + var v161 = closest; + v161.x = v1X20; + v161.y = v1Y20; + v161.z = v1Z20; + b16 = 1; + } else if(t14 > 1) { + var v162 = closest; + v162.x = v2X20; + v162.y = v2Y20; + v162.z = v2Z20; + b16 = 2; + } else { + var p14; + var pX14; + var pY14; + var pZ14; + pX14 = v1X20 + v12X20 * t14; + pY14 = v1Y20 + v12Y20 * t14; + pZ14 = v1Z20 + v12Z20 * t14; + var v163 = closest; + v163.x = pX14; + v163.y = pY14; + v163.z = pZ14; + b16 = 3; + } + var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d34 < mind5) { + mini5 = b16 << 1; + mind5 = d34; + var v164 = closest; + minvX5 = v164.x; + minvY5 = v164.y; + minvZ5 = v164.z; + } + } + if(d314 < 0) { + var v165; + var v1X21; + var v1Y21; + var v1Z21; + var v227; + var v2X21; + var v2Y21; + var v2Z21; + var v166 = vec21; + v1X21 = v166.x; + v1Y21 = v166.y; + v1Z21 = v166.z; + var v167 = vec4; + v2X21 = v167.x; + v2Y21 = v167.y; + v2Z21 = v167.z; + var v1221; + var v12X21; + var v12Y21; + var v12Z21; + v12X21 = v2X21 - v1X21; + v12Y21 = v2Y21 - v1Y21; + v12Z21 = v2Z21 - v1Z21; + var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; + var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; + t15 = -t15 / d35; + var b17; + if(t15 < 0) { + var v168 = closest; + v168.x = v1X21; + v168.y = v1Y21; + v168.z = v1Z21; + b17 = 1; + } else if(t15 > 1) { + var v169 = closest; + v169.x = v2X21; + v169.y = v2Y21; + v169.z = v2Z21; + b17 = 2; + } else { + var p15; + var pX15; + var pY15; + var pZ15; + pX15 = v1X21 + v12X21 * t15; + pY15 = v1Y21 + v12Y21 * t15; + pZ15 = v1Z21 + v12Z21 * t15; + var v170 = closest; + v170.x = pX15; + v170.y = pY15; + v170.z = pZ15; + b17 = 3; + } + var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind5 < 0 || d36 < mind5) { + mini5 = b17 & 1 | (b17 & 2) << 1; + mind5 = d36; + var v171 = closest; + minvX5 = v171.x; + minvY5 = v171.y; + minvZ5 = v171.z; + } + } + var b18; + if(mind5 > 0) { + var v172 = closest; + v172.x = minvX5; + v172.y = minvY5; + v172.z = minvZ5; + b18 = mini5; + } else { + var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + if(l5 > 0) { + l5 = 1 / Math.sqrt(l5); + } + nX5 *= l5; + nY5 *= l5; + nZ5 *= l5; + var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; + var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; + l24 = dn4 / l24; + minvX5 = nX5 * l24; + minvY5 = nY5 * l24; + minvZ5 = nZ5 * l24; + var v173 = closest; + v173.x = minvX5; + v173.y = minvY5; + v173.z = minvZ5; + b18 = 7; + } + var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d37 < mind1) { + mini1 = b18 << 1; + mind1 = d37; + var v174 = closest; + minvX1 = v174.x; + minvY1 = v174.y; + minvZ1 = v174.z; + } + } + if(mind1 > 0) { + var v175 = closest; + v175.x = minvX1; + v175.y = minvY1; + v175.z = minvZ1; + v4 = mini1; + } else { + closest.zero(); + v4 = 15; + } + break; + } + this.shrinkSimplex(v4); + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + if(lambda == 0 || this.simplexSize == 4) { + hit.fraction = lambda; + return false; + } + this.interpolateClosestPoints(); + hit.fraction = lambda; + var _this3 = hit.normal; + _this3.x = dir.x; + _this3.y = dir.y; + _this3.z = dir.z; + var _this4 = _this3; + var invLen = Math.sqrt(_this4.x * _this4.x + _this4.y * _this4.y + _this4.z * _this4.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx2 = _this4.x * invLen; + var ty2 = _this4.y * invLen; + var tz2 = _this4.z * invLen; + _this4.x = tx2; + _this4.y = ty2; + _this4.z = tz2; + var _this5 = hit.position; + var v176 = this.closestPoint1; + _this5.x = v176.x; + _this5.y = v176.y; + _this5.z = v176.z; + var _this6 = _this5; + var tx3 = _this6.x + tl1.x * lambda; + var ty3 = _this6.y + tl1.y * lambda; + var tz3 = _this6.z + tl1.z * lambda; + _this6.x = tx3; + _this6.y = ty3; + _this6.z = tz3; + return true; + } + dir.x = closest.x; + dir.y = closest.y; + dir.z = closest.z; + var _this7 = dir; + var tx4 = -_this7.x; + var ty4 = -_this7.y; + var tz4 = -_this7.z; + _this7.x = tx4; + _this7.y = ty4; + _this7.z = tz4; + if(this.c1 != null) { + this.computeWitnessPoint1(true); + } else { + var v177 = this.w1[this.simplexSize]; + v177.x = this.tf1._positionX; + v177.y = this.tf1._positionY; + v177.z = this.tf1._positionZ; + } + this.computeWitnessPoint2(true); + var _this8 = this.s[this.simplexSize]; + var v178 = this.w1[this.simplexSize]; + _this8.x = v178.x; + _this8.y = v178.y; + _this8.z = v178.z; + var _this9 = _this8; + var v179 = this.w2[this.simplexSize]; + var tx5 = _this9.x - v179.x; + var ty5 = _this9.y - v179.y; + var tz5 = _this9.z - v179.z; + _this9.x = tx5; + _this9.y = ty5; + _this9.z = tz5; + var _this10 = s[this.simplexSize]; + var tx6 = _this10.x - rayX.x; + var ty6 = _this10.y - rayX.y; + var tz6 = _this10.z - rayX.z; + _this10.x = tx6; + _this10.y = ty6; + _this10.z = tz6; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + throw new Error("!?"); + } + var p16 = s[this.simplexSize]; + var n6 = dir; + var pn = p16.x * n6.x + p16.y * n6.y + p16.z * n6.z; + if(pn < 0) { + if(rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z >= 0) { + return false; + } + var dLambda = pn / (rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z); + lambda += dLambda; + if(lambda >= 1) { + return false; + } + var tx7 = rayX.x + rayR.x * dLambda; + var ty7 = rayX.y + rayR.y * dLambda; + var tz7 = rayX.z + rayR.z * dLambda; + rayX.x = tx7; + rayX.y = ty7; + rayX.z = tz7; + var _g1 = 0; + var _g2 = this.simplexSize + 1; + while(_g1 < _g2) { + var i = _g1++; + var _this11 = s[i]; + var s1 = -dLambda; + var tx8 = _this11.x + rayR.x * s1; + var ty8 = _this11.y + rayR.y * s1; + var tz8 = _this11.z + rayR.z * s1; + _this11.x = tx8; + _this11.y = ty8; + _this11.z = tz8; + } + } + var duplicate = false; + var _g11 = 0; + var _g21 = this.simplexSize; + while(_g11 < _g21) { + var i1 = _g11++; + var dx = s[i1].x - s[this.simplexSize].x; + var dy = s[i1].y - s[this.simplexSize].y; + var dz = s[i1].z - s[this.simplexSize].z; + if(dx * dx + dy * dy + dz * dz < eps2) { + duplicate = true; + break; + } + } + if(!duplicate) { + this.simplexSize++; + } + ++count; + } + return false; + } + interpolateClosestPoints() { + switch(this.simplexSize) { + case 1: + var _this = this.closestPoint1; + var v = this.w1[0]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.closestPoint2; + var v1 = this.w2[0]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + break; + case 2: + var c; + var cX; + var cY; + var cZ; + var v2 = this.closest; + cX = v2.x; + cY = v2.y; + cZ = v2.z; + var s0; + var s0X; + var s0Y; + var s0Z; + var w10; + var w10X; + var w10Y; + var w10Z; + var w20; + var w20X; + var w20Y; + var w20Z; + var s1; + var s1X; + var s1Y; + var s1Z; + var w11; + var w11X; + var w11Y; + var w11Z; + var w21; + var w21X; + var w21Y; + var w21Z; + var s2; + var s2X; + var s2Y; + var s2Z; + var w12; + var w12X; + var w12Y; + var w12Z; + var w22; + var w22X; + var w22Y; + var w22Z; + var v3 = this.s[0]; + s0X = v3.x; + s0Y = v3.y; + s0Z = v3.z; + var v4 = this.w1[0]; + w10X = v4.x; + w10Y = v4.y; + w10Z = v4.z; + var v5 = this.w2[0]; + w20X = v5.x; + w20Y = v5.y; + w20Z = v5.z; + var v6 = this.s[1]; + s1X = v6.x; + s1Y = v6.y; + s1Z = v6.z; + var v7 = this.w1[1]; + w11X = v7.x; + w11Y = v7.y; + w11Z = v7.z; + var v8 = this.w2[1]; + w21X = v8.x; + w21Y = v8.y; + w21Z = v8.z; + var v9 = this.s[2]; + s2X = v9.x; + s2Y = v9.y; + s2Z = v9.z; + var v10 = this.w1[2]; + w12X = v10.x; + w12Y = v10.y; + w12Z = v10.z; + var v11 = this.w2[2]; + w22X = v11.x; + w22Y = v11.y; + w22Z = v11.z; + var s01; + var s01X; + var s01Y; + var s01Z; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + var invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + if(invDet != 0) { + invDet = 1 / invDet; + } + var s0c; + var s0cX; + var s0cY; + var s0cZ; + s0cX = cX - s0X; + s0cY = cY - s0Y; + s0cZ = cZ - s0Z; + var t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; + var diff; + var diffX; + var diffY; + var diffZ; + var cp1; + var cp1X; + var cp1Y; + var cp1Z; + var cp2; + var cp2X; + var cp2Y; + var cp2Z; + diffX = w11X - w10X; + diffY = w11Y - w10Y; + diffZ = w11Z - w10Z; + cp1X = w10X + diffX * t; + cp1Y = w10Y + diffY * t; + cp1Z = w10Z + diffZ * t; + diffX = w21X - w20X; + diffY = w21Y - w20Y; + diffZ = w21Z - w20Z; + cp2X = w20X + diffX * t; + cp2Y = w20Y + diffY * t; + cp2Z = w20Z + diffZ * t; + var v12 = this.closestPoint1; + v12.x = cp1X; + v12.y = cp1Y; + v12.z = cp1Z; + var v13 = this.closestPoint2; + v13.x = cp2X; + v13.y = cp2Y; + v13.z = cp2Z; + break; + case 3: + var c1; + var cX1; + var cY1; + var cZ1; + var v14 = this.closest; + cX1 = v14.x; + cY1 = v14.y; + cZ1 = v14.z; + var s02; + var s0X1; + var s0Y1; + var s0Z1; + var w101; + var w10X1; + var w10Y1; + var w10Z1; + var w201; + var w20X1; + var w20Y1; + var w20Z1; + var s11; + var s1X1; + var s1Y1; + var s1Z1; + var w111; + var w11X1; + var w11Y1; + var w11Z1; + var w211; + var w21X1; + var w21Y1; + var w21Z1; + var s21; + var s2X1; + var s2Y1; + var s2Z1; + var w121; + var w12X1; + var w12Y1; + var w12Z1; + var w221; + var w22X1; + var w22Y1; + var w22Z1; + var v15 = this.s[0]; + s0X1 = v15.x; + s0Y1 = v15.y; + s0Z1 = v15.z; + var v16 = this.w1[0]; + w10X1 = v16.x; + w10Y1 = v16.y; + w10Z1 = v16.z; + var v17 = this.w2[0]; + w20X1 = v17.x; + w20Y1 = v17.y; + w20Z1 = v17.z; + var v18 = this.s[1]; + s1X1 = v18.x; + s1Y1 = v18.y; + s1Z1 = v18.z; + var v19 = this.w1[1]; + w11X1 = v19.x; + w11Y1 = v19.y; + w11Z1 = v19.z; + var v20 = this.w2[1]; + w21X1 = v20.x; + w21Y1 = v20.y; + w21Z1 = v20.z; + var v21 = this.s[2]; + s2X1 = v21.x; + s2Y1 = v21.y; + s2Z1 = v21.z; + var v22 = this.w1[2]; + w12X1 = v22.x; + w12Y1 = v22.y; + w12Z1 = v22.z; + var v23 = this.w2[2]; + w22X1 = v23.x; + w22Y1 = v23.y; + w22Z1 = v23.z; + var s011; + var s01X1; + var s01Y1; + var s01Z1; + var s021; + var s02X; + var s02Y; + var s02Z; + var s0c1; + var s0cX1; + var s0cY1; + var s0cZ1; + s01X1 = s1X1 - s0X1; + s01Y1 = s1Y1 - s0Y1; + s01Z1 = s1Z1 - s0Z1; + s02X = s2X1 - s0X1; + s02Y = s2Y1 - s0Y1; + s02Z = s2Z1 - s0Z1; + s0cX1 = cX1 - s0X1; + s0cY1 = cY1 - s0Y1; + s0cZ1 = cZ1 - s0Z1; + var d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; + var d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; + var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + var d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; + var d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; + var invDet1 = d11 * d22 - d12 * d12; + if(invDet1 != 0) { + invDet1 = 1 / invDet1; + } + var s = (d1c * d22 - d2c * d12) * invDet1; + var t1 = (-d1c * d12 + d2c * d11) * invDet1; + var diff1; + var diffX1; + var diffY1; + var diffZ1; + var cp11; + var cp1X1; + var cp1Y1; + var cp1Z1; + var cp21; + var cp2X1; + var cp2Y1; + var cp2Z1; + diffX1 = w11X1 - w10X1; + diffY1 = w11Y1 - w10Y1; + diffZ1 = w11Z1 - w10Z1; + cp1X1 = w10X1 + diffX1 * s; + cp1Y1 = w10Y1 + diffY1 * s; + cp1Z1 = w10Z1 + diffZ1 * s; + diffX1 = w12X1 - w10X1; + diffY1 = w12Y1 - w10Y1; + diffZ1 = w12Z1 - w10Z1; + cp1X1 += diffX1 * t1; + cp1Y1 += diffY1 * t1; + cp1Z1 += diffZ1 * t1; + diffX1 = w21X1 - w20X1; + diffY1 = w21Y1 - w20Y1; + diffZ1 = w21Z1 - w20Z1; + cp2X1 = w20X1 + diffX1 * s; + cp2Y1 = w20Y1 + diffY1 * s; + cp2Z1 = w20Z1 + diffZ1 * s; + diffX1 = w22X1 - w20X1; + diffY1 = w22Y1 - w20Y1; + diffZ1 = w22Z1 - w20Z1; + cp2X1 += diffX1 * t1; + cp2Y1 += diffY1 * t1; + cp2Z1 += diffZ1 * t1; + var v24 = this.closestPoint1; + v24.x = cp1X1; + v24.y = cp1Y1; + v24.z = cp1Z1; + var v25 = this.closestPoint2; + v25.x = cp2X1; + v25.y = cp2Y1; + v25.z = cp2Z1; + break; + default: + throw new Error("!?"); + } + } + loadCache(gjkCache) { + var _this = this.dir; + var v = gjkCache.prevClosestDir; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + } + saveCache(gjkCache) { + var _this = gjkCache.prevClosestDir; + var v = this.closest; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = _this; + var tx = -_this1.x; + var ty = -_this1.y; + var tz = -_this1.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + } + shrinkSimplex(vertexBits) { + this.simplexSize = vertexBits; + this.simplexSize = (this.simplexSize & 5) + (this.simplexSize >> 1 & 5); + this.simplexSize = (this.simplexSize & 3) + (this.simplexSize >> 2 & 3); + switch(vertexBits) { + case 2: + var _this = this.s[0]; + var v = this.s[1]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.w1[0]; + var v1 = this.w1[1]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + var _this2 = this.w2[0]; + var v2 = this.w2[1]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + break; + case 4: + var _this3 = this.s[0]; + var v3 = this.s[2]; + _this3.x = v3.x; + _this3.y = v3.y; + _this3.z = v3.z; + var _this4 = this.w1[0]; + var v4 = this.w1[2]; + _this4.x = v4.x; + _this4.y = v4.y; + _this4.z = v4.z; + var _this5 = this.w2[0]; + var v5 = this.w2[2]; + _this5.x = v5.x; + _this5.y = v5.y; + _this5.z = v5.z; + break; + case 5: + var _this6 = this.s[1]; + var v6 = this.s[2]; + _this6.x = v6.x; + _this6.y = v6.y; + _this6.z = v6.z; + var _this7 = this.w1[1]; + var v7 = this.w1[2]; + _this7.x = v7.x; + _this7.y = v7.y; + _this7.z = v7.z; + var _this8 = this.w2[1]; + var v8 = this.w2[2]; + _this8.x = v8.x; + _this8.y = v8.y; + _this8.z = v8.z; + break; + case 6: + var _this9 = this.s[0]; + var v9 = this.s[2]; + _this9.x = v9.x; + _this9.y = v9.y; + _this9.z = v9.z; + var _this10 = this.w1[0]; + var v10 = this.w1[2]; + _this10.x = v10.x; + _this10.y = v10.y; + _this10.z = v10.z; + var _this11 = this.w2[0]; + var v11 = this.w2[2]; + _this11.x = v11.x; + _this11.y = v11.y; + _this11.z = v11.z; + break; + case 8: + var _this12 = this.s[0]; + var v12 = this.s[3]; + _this12.x = v12.x; + _this12.y = v12.y; + _this12.z = v12.z; + var _this13 = this.w1[0]; + var v13 = this.w1[3]; + _this13.x = v13.x; + _this13.y = v13.y; + _this13.z = v13.z; + var _this14 = this.w2[0]; + var v14 = this.w2[3]; + _this14.x = v14.x; + _this14.y = v14.y; + _this14.z = v14.z; + break; + case 9: + var _this15 = this.s[1]; + var v15 = this.s[3]; + _this15.x = v15.x; + _this15.y = v15.y; + _this15.z = v15.z; + var _this16 = this.w1[1]; + var v16 = this.w1[3]; + _this16.x = v16.x; + _this16.y = v16.y; + _this16.z = v16.z; + var _this17 = this.w2[1]; + var v17 = this.w2[3]; + _this17.x = v17.x; + _this17.y = v17.y; + _this17.z = v17.z; + break; + case 10: + var _this18 = this.s[0]; + var v18 = this.s[3]; + _this18.x = v18.x; + _this18.y = v18.y; + _this18.z = v18.z; + var _this19 = this.w1[0]; + var v19 = this.w1[3]; + _this19.x = v19.x; + _this19.y = v19.y; + _this19.z = v19.z; + var _this20 = this.w2[0]; + var v20 = this.w2[3]; + _this20.x = v20.x; + _this20.y = v20.y; + _this20.z = v20.z; + break; + case 11: + var _this21 = this.s[2]; + var v21 = this.s[3]; + _this21.x = v21.x; + _this21.y = v21.y; + _this21.z = v21.z; + var _this22 = this.w1[2]; + var v22 = this.w1[3]; + _this22.x = v22.x; + _this22.y = v22.y; + _this22.z = v22.z; + var _this23 = this.w2[2]; + var v23 = this.w2[3]; + _this23.x = v23.x; + _this23.y = v23.y; + _this23.z = v23.z; + break; + case 12: + var _this24 = this.s[0]; + var v24 = this.s[2]; + _this24.x = v24.x; + _this24.y = v24.y; + _this24.z = v24.z; + var _this25 = this.w1[0]; + var v25 = this.w1[2]; + _this25.x = v25.x; + _this25.y = v25.y; + _this25.z = v25.z; + var _this26 = this.w2[0]; + var v26 = this.w2[2]; + _this26.x = v26.x; + _this26.y = v26.y; + _this26.z = v26.z; + var _this27 = this.s[1]; + var v27 = this.s[3]; + _this27.x = v27.x; + _this27.y = v27.y; + _this27.z = v27.z; + var _this28 = this.w1[1]; + var v28 = this.w1[3]; + _this28.x = v28.x; + _this28.y = v28.y; + _this28.z = v28.z; + var _this29 = this.w2[1]; + var v29 = this.w2[3]; + _this29.x = v29.x; + _this29.y = v29.y; + _this29.z = v29.z; + break; + case 13: + var _this30 = this.s[1]; + var v30 = this.s[3]; + _this30.x = v30.x; + _this30.y = v30.y; + _this30.z = v30.z; + var _this31 = this.w1[1]; + var v31 = this.w1[3]; + _this31.x = v31.x; + _this31.y = v31.y; + _this31.z = v31.z; + var _this32 = this.w2[1]; + var v32 = this.w2[3]; + _this32.x = v32.x; + _this32.y = v32.y; + _this32.z = v32.z; + break; + case 14: + var _this33 = this.s[0]; + var v33 = this.s[3]; + _this33.x = v33.x; + _this33.y = v33.y; + _this33.z = v33.z; + var _this34 = this.w1[0]; + var v34 = this.w1[3]; + _this34.x = v34.x; + _this34.y = v34.y; + _this34.z = v34.z; + var _this35 = this.w2[0]; + var v35 = this.w2[3]; + _this35.x = v35.x; + _this35.y = v35.y; + _this35.z = v35.z; + break; + } + } + computeWitnessPoint1(addMargin) { + var tmp; + var tmpX; + var tmpY; + var tmpZ; + var idir; + var idirX; + var idirY; + var idirZ; + var v = this.dir; + idirX = v.x; + idirY = v.y; + idirZ = v.z; + var ldir1; + var ldir1X; + var ldir1Y; + var ldir1Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf1._rotation00 * idirX + this.tf1._rotation10 * idirY + this.tf1._rotation20 * idirZ; + __tmp__Y = this.tf1._rotation01 * idirX + this.tf1._rotation11 * idirY + this.tf1._rotation21 * idirZ; + __tmp__Z = this.tf1._rotation02 * idirX + this.tf1._rotation12 * idirY + this.tf1._rotation22 * idirZ; + ldir1X = __tmp__X; + ldir1Y = __tmp__Y; + ldir1Z = __tmp__Z; + var iw1; + var iw1X; + var iw1Y; + var iw1Z; + var v1 = this.dir; + v1.x = ldir1X; + v1.y = ldir1Y; + v1.z = ldir1Z; + this.c1.computeLocalSupportingVertex(this.dir,this.w1[this.simplexSize]); + if(addMargin) { + var _this = this.dir; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + var _this1 = this.w1[this.simplexSize]; + var v2 = this.dir; + var s = this.c1._gjkMargin; + var tx1 = _this1.x + v2.x * s; + var ty1 = _this1.y + v2.y * s; + var tz1 = _this1.z + v2.z * s; + _this1.x = tx1; + _this1.y = ty1; + _this1.z = tz1; + } + var v3 = this.w1[this.simplexSize]; + tmpX = v3.x; + tmpY = v3.y; + tmpZ = v3.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; + __tmp__Y1 = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; + __tmp__Z1 = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; + iw1X = __tmp__X1; + iw1Y = __tmp__Y1; + iw1Z = __tmp__Z1; + iw1X += this.tf1._positionX; + iw1Y += this.tf1._positionY; + iw1Z += this.tf1._positionZ; + var v4 = this.w1[this.simplexSize]; + v4.x = iw1X; + v4.y = iw1Y; + v4.z = iw1Z; + var v5 = this.dir; + v5.x = idirX; + v5.y = idirY; + v5.z = idirZ; + } + computeWitnessPoint2(addMargin) { + var tmp; + var tmpX; + var tmpY; + var tmpZ; + var idir; + var idirX; + var idirY; + var idirZ; + var v = this.dir; + idirX = v.x; + idirY = v.y; + idirZ = v.z; + var ldir2; + var ldir2X; + var ldir2Y; + var ldir2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf2._rotation00 * idirX + this.tf2._rotation10 * idirY + this.tf2._rotation20 * idirZ; + __tmp__Y = this.tf2._rotation01 * idirX + this.tf2._rotation11 * idirY + this.tf2._rotation21 * idirZ; + __tmp__Z = this.tf2._rotation02 * idirX + this.tf2._rotation12 * idirY + this.tf2._rotation22 * idirZ; + ldir2X = __tmp__X; + ldir2Y = __tmp__Y; + ldir2Z = __tmp__Z; + ldir2X = -ldir2X; + ldir2Y = -ldir2Y; + ldir2Z = -ldir2Z; + var iw2; + var iw2X; + var iw2Y; + var iw2Z; + var v1 = this.dir; + v1.x = ldir2X; + v1.y = ldir2Y; + v1.z = ldir2Z; + this.c2.computeLocalSupportingVertex(this.dir,this.w2[this.simplexSize]); + if(addMargin) { + var _this = this.dir; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + var _this1 = this.w2[this.simplexSize]; + var v2 = this.dir; + var s = this.c2._gjkMargin; + var tx1 = _this1.x + v2.x * s; + var ty1 = _this1.y + v2.y * s; + var tz1 = _this1.z + v2.z * s; + _this1.x = tx1; + _this1.y = ty1; + _this1.z = tz1; + } + var v3 = this.w2[this.simplexSize]; + tmpX = v3.x; + tmpY = v3.y; + tmpZ = v3.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; + __tmp__Y1 = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; + __tmp__Z1 = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; + iw2X = __tmp__X1; + iw2Y = __tmp__Y1; + iw2Z = __tmp__Z1; + iw2X += this.tf2._positionX; + iw2Y += this.tf2._positionY; + iw2Z += this.tf2._positionZ; + var v4 = this.w2[this.simplexSize]; + v4.x = iw2X; + v4.y = iw2Y; + v4.z = iw2Z; + var v5 = this.dir; + v5.x = idirX; + v5.y = idirY; + v5.z = idirZ; + } + pointToTetrahedron() { + var _g = 0; + while(_g < 3) { + var i = _g++; + var _this = this.dir; + var v = this.baseDirs[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this1 = this.s[this.simplexSize]; + var v1 = this.w1[this.simplexSize]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + var _this2 = _this1; + var v2 = this.w2[this.simplexSize]; + var tx = _this2.x - v2.x; + var ty = _this2.y - v2.y; + var tz = _this2.z - v2.z; + _this2.x = tx; + _this2.y = ty; + _this2.z = tz; + this.simplexSize++; + this.lineToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + var _this3 = this.dir; + var tx1 = -_this3.x; + var ty1 = -_this3.y; + var tz1 = -_this3.z; + _this3.x = tx1; + _this3.y = ty1; + _this3.z = tz1; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this4 = this.s[this.simplexSize]; + var v3 = this.w1[this.simplexSize]; + _this4.x = v3.x; + _this4.y = v3.y; + _this4.z = v3.z; + var _this5 = _this4; + var v4 = this.w2[this.simplexSize]; + var tx2 = _this5.x - v4.x; + var ty2 = _this5.y - v4.y; + var tz2 = _this5.z - v4.z; + _this5.x = tx2; + _this5.y = ty2; + _this5.z = tz2; + this.simplexSize++; + this.lineToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + } + } + lineToTetrahedron() { + var oldDir; + var oldDirX; + var oldDirY; + var oldDirZ; + var v = this.dir; + oldDirX = v.x; + oldDirY = v.y; + oldDirZ = v.z; + var s0; + var s0X; + var s0Y; + var s0Z; + var s1; + var s1X; + var s1Y; + var s1Z; + var lineDir; + var lineDirX; + var lineDirY; + var lineDirZ; + var v1 = this.s[0]; + s0X = v1.x; + s0Y = v1.y; + s0Z = v1.z; + var v2 = this.s[1]; + s1X = v2.x; + s1Y = v2.y; + s1Z = v2.z; + lineDirX = s0X - s1X; + lineDirY = s0Y - s1Y; + lineDirZ = s0Z - s1Z; + var _g = 0; + while(_g < 3) { + var i = _g++; + var baseDir; + var baseDirX; + var baseDirY; + var baseDirZ; + var v3 = this.baseDirs[i]; + baseDirX = v3.x; + baseDirY = v3.y; + baseDirZ = v3.z; + var newDir; + var newDirX; + var newDirY; + var newDirZ; + newDirX = lineDirY * baseDirZ - lineDirZ * baseDirY; + newDirY = lineDirZ * baseDirX - lineDirX * baseDirZ; + newDirZ = lineDirX * baseDirY - lineDirY * baseDirX; + var v4 = this.dir; + v4.x = newDirX; + v4.y = newDirY; + v4.z = newDirZ; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v5 = this.w1[this.simplexSize]; + _this.x = v5.x; + _this.y = v5.y; + _this.z = v5.z; + var _this1 = _this; + var v6 = this.w2[this.simplexSize]; + var tx = _this1.x - v6.x; + var ty = _this1.y - v6.y; + var tz = _this1.z - v6.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + this.simplexSize++; + this.triangleToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + var _this2 = this.dir; + var tx1 = -_this2.x; + var ty1 = -_this2.y; + var tz1 = -_this2.z; + _this2.x = tx1; + _this2.y = ty1; + _this2.z = tz1; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this3 = this.s[this.simplexSize]; + var v7 = this.w1[this.simplexSize]; + _this3.x = v7.x; + _this3.y = v7.y; + _this3.z = v7.z; + var _this4 = _this3; + var v8 = this.w2[this.simplexSize]; + var tx2 = _this4.x - v8.x; + var ty2 = _this4.y - v8.y; + var tz2 = _this4.z - v8.z; + _this4.x = tx2; + _this4.y = ty2; + _this4.z = tz2; + this.simplexSize++; + this.triangleToTetrahedron(); + if(this.simplexSize == 4) { + break; + } + this.simplexSize--; + } + var v9 = this.dir; + v9.x = oldDirX; + v9.y = oldDirY; + v9.z = oldDirZ; + } + triangleToTetrahedron() { + var oldDir; + var oldDirX; + var oldDirY; + var oldDirZ; + var v = this.dir; + oldDirX = v.x; + oldDirY = v.y; + oldDirZ = v.z; + while(true) { + var s0; + var s0X; + var s0Y; + var s0Z; + var s1; + var s1X; + var s1Y; + var s1Z; + var s2; + var s2X; + var s2Y; + var s2Z; + var s01; + var s01X; + var s01Y; + var s01Z; + var s02; + var s02X; + var s02Y; + var s02Z; + var v1 = this.s[0]; + s0X = v1.x; + s0Y = v1.y; + s0Z = v1.z; + var v2 = this.s[1]; + s1X = v2.x; + s1Y = v2.y; + s1Z = v2.z; + var v3 = this.s[2]; + s2X = v3.x; + s2Y = v3.y; + s2Z = v3.z; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + s02X = s2X - s0X; + s02Y = s2Y - s0Y; + s02Z = s2Z - s0Z; + var n; + var nX; + var nY; + var nZ; + nX = s01Y * s02Z - s01Z * s02Y; + nY = s01Z * s02X - s01X * s02Z; + nZ = s01X * s02Y - s01Y * s02X; + var v4 = this.dir; + v4.x = nX; + v4.y = nY; + v4.z = nZ; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this = this.s[this.simplexSize]; + var v5 = this.w1[this.simplexSize]; + _this.x = v5.x; + _this.y = v5.y; + _this.z = v5.z; + var _this1 = _this; + var v6 = this.w2[this.simplexSize]; + var tx = _this1.x - v6.x; + var ty = _this1.y - v6.y; + var tz = _this1.z - v6.z; + _this1.x = tx; + _this1.y = ty; + _this1.z = tz; + this.simplexSize++; + if(this.isValidTetrahedron()) { + break; + } + this.simplexSize--; + var _this2 = this.dir; + var tx1 = -_this2.x; + var ty1 = -_this2.y; + var tz1 = -_this2.z; + _this2.x = tx1; + _this2.y = ty1; + _this2.z = tz1; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this3 = this.s[this.simplexSize]; + var v7 = this.w1[this.simplexSize]; + _this3.x = v7.x; + _this3.y = v7.y; + _this3.z = v7.z; + var _this4 = _this3; + var v8 = this.w2[this.simplexSize]; + var tx2 = _this4.x - v8.x; + var ty2 = _this4.y - v8.y; + var tz2 = _this4.z - v8.z; + _this4.x = tx2; + _this4.y = ty2; + _this4.z = tz2; + this.simplexSize++; + if(this.isValidTetrahedron()) { + break; + } + this.simplexSize--; + if(!false) { + break; + } + } + var v9 = this.dir; + v9.x = oldDirX; + v9.y = oldDirY; + v9.z = oldDirZ; + } + isValidTetrahedron() { + var e00 = this.s[1].x - this.s[0].x; + var e01 = this.s[1].y - this.s[0].y; + var e02 = this.s[1].z - this.s[0].z; + var e10 = this.s[2].x - this.s[0].x; + var e11 = this.s[2].y - this.s[0].y; + var e12 = this.s[2].z - this.s[0].z; + var e20 = this.s[3].x - this.s[0].x; + var e21 = this.s[3].y - this.s[0].y; + var e22 = this.s[3].z - this.s[0].z; + var det = e00 * (e11 * e22 - e12 * e21) - e01 * (e10 * e22 - e12 * e20) + e02 * (e10 * e21 - e11 * e20); + if(!(det > 1e-12)) { + return det < -1e-12; + } else { + return true; + } + } + computeDepth(convex1,convex2,tf1,tf2,initialPolyhedron,initialPolyhedron1,initialPolyhedron2) { + var _this = this.polyhedron; + while(_this._numTriangles > 0) { + var t = _this._triangleList; + _this._numTriangles--; + var prev = t._prev; + var next = t._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(t == _this._triangleList) { + _this._triangleList = _this._triangleList._next; + } + if(t == _this._triangleListLast) { + _this._triangleListLast = _this._triangleListLast._prev; + } + t._next = null; + t._prev = null; + t.removeReferences(); + t._next = _this._trianglePool; + _this._trianglePool = t; + } + while(_this._numVertices > 0) { + var v = _this._vertices[--_this._numVertices]; + v.removeReferences(); + v._next = _this._vertexPool; + _this._vertexPool = v; + } + var tmp = this.polyhedron; + var _this1 = this.polyhedron; + var first = _this1._vertexPool; + if(first != null) { + _this1._vertexPool = first._next; + first._next = null; + } else { + first = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + } + var tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); + var _this2 = this.polyhedron; + var first1 = _this2._vertexPool; + if(first1 != null) { + _this2._vertexPool = first1._next; + first1._next = null; + } else { + first1 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + } + var tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); + var _this3 = this.polyhedron; + var first2 = _this3._vertexPool; + if(first2 != null) { + _this3._vertexPool = first2._next; + first2._next = null; + } else { + first2 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + } + var tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); + var _this4 = this.polyhedron; + var first3 = _this4._vertexPool; + if(first3 != null) { + _this4._vertexPool = first3._next; + first3._next = null; + } else { + first3 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + } + if(!tmp._init(tmp1,tmp2,tmp3,first3.init(initialPolyhedron[3],initialPolyhedron1[3],initialPolyhedron2[3]))) { + return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_INIT; + } + this.simplexSize = 0; + var supportingVertex = this.s[0]; + var witness1 = this.w1[0]; + var witness2 = this.w2[0]; + var count = 0; + var maxIterations = 40; + while(count < maxIterations) { + var f = this.polyhedron._triangleList; + var mind = 1e65536; + var minf = null; + while(f != null) { + var n = f._next; + if(f._distanceSq < mind) { + mind = f._distanceSq; + minf = f; + } + f = n; + } + var face = minf; + var _this5 = this.dir; + var v1 = face._normal; + _this5.x = v1.x; + _this5.y = v1.y; + _this5.z = v1.z; + var _this6 = _this5; + var invLen = Math.sqrt(_this6.x * _this6.x + _this6.y * _this6.y + _this6.z * _this6.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this6.x * invLen; + var ty = _this6.y * invLen; + var tz = _this6.z * invLen; + _this6.x = tx; + _this6.y = ty; + _this6.z = tz; + this.computeWitnessPoint1(false); + this.computeWitnessPoint2(false); + var _this7 = this.s[this.simplexSize]; + var v2 = this.w1[this.simplexSize]; + _this7.x = v2.x; + _this7.y = v2.y; + _this7.z = v2.z; + var _this8 = _this7; + var v3 = this.w2[this.simplexSize]; + var tx1 = _this8.x - v3.x; + var ty1 = _this8.y - v3.y; + var tz1 = _this8.z - v3.z; + _this8.x = tx1; + _this8.y = ty1; + _this8.z = tz1; + var v0 = face._vertices[0]; + var v11 = face._vertices[1]; + var v21 = face._vertices[2]; + var _this9 = v0.v; + var v4 = this.dir; + var dot1 = _this9.x * v4.x + _this9.y * v4.y + _this9.z * v4.z; + var v5 = this.dir; + var dot2 = supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z; + if(dot2 - dot1 < 1e-6 || count == maxIterations - 1) { + var _this10 = this.closest; + var v6 = this.dir; + _this10.x = v6.x; + _this10.y = v6.y; + _this10.z = v6.z; + var _this11 = _this10; + var _this12 = this.dir; + var v7 = v0.v; + var _this13 = this.dir; + var s = (_this12.x * v7.x + _this12.y * v7.y + _this12.z * v7.z) / (_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); + var tx2 = _this11.x * s; + var ty2 = _this11.y * s; + var tz2 = _this11.z * s; + _this11.x = tx2; + _this11.y = ty2; + _this11.z = tz2; + var c; + var cX; + var cY; + var cZ; + var v8 = this.closest; + cX = v8.x; + cY = v8.y; + cZ = v8.z; + var s0; + var s0X; + var s0Y; + var s0Z; + var w10; + var w10X; + var w10Y; + var w10Z; + var w20; + var w20X; + var w20Y; + var w20Z; + var s1; + var s1X; + var s1Y; + var s1Z; + var w11; + var w11X; + var w11Y; + var w11Z; + var w21; + var w21X; + var w21Y; + var w21Z; + var s2; + var s2X; + var s2Y; + var s2Z; + var w12; + var w12X; + var w12Y; + var w12Z; + var w22; + var w22X; + var w22Y; + var w22Z; + var v9 = v0.v; + s0X = v9.x; + s0Y = v9.y; + s0Z = v9.z; + var v10 = v0.w1; + w10X = v10.x; + w10Y = v10.y; + w10Z = v10.z; + var v12 = v0.w2; + w20X = v12.x; + w20Y = v12.y; + w20Z = v12.z; + var v13 = v11.v; + s1X = v13.x; + s1Y = v13.y; + s1Z = v13.z; + var v14 = v11.w1; + w11X = v14.x; + w11Y = v14.y; + w11Z = v14.z; + var v15 = v11.w2; + w21X = v15.x; + w21Y = v15.y; + w21Z = v15.z; + var v16 = v21.v; + s2X = v16.x; + s2Y = v16.y; + s2Z = v16.z; + var v17 = v21.w1; + w12X = v17.x; + w12Y = v17.y; + w12Z = v17.z; + var v18 = v21.w2; + w22X = v18.x; + w22Y = v18.y; + w22Z = v18.z; + var s01; + var s01X; + var s01Y; + var s01Z; + var s02; + var s02X; + var s02Y; + var s02Z; + var s0c; + var s0cX; + var s0cY; + var s0cZ; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + s02X = s2X - s0X; + s02Y = s2Y - s0Y; + s02Z = s2Z - s0Z; + s0cX = cX - s0X; + s0cY = cY - s0Y; + s0cZ = cZ - s0Z; + var d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + var d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; + var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + var d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; + var d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; + var invDet = d11 * d22 - d12 * d12; + if(invDet != 0) { + invDet = 1 / invDet; + } + var s3 = (d1c * d22 - d2c * d12) * invDet; + var t1 = (-d1c * d12 + d2c * d11) * invDet; + var diff; + var diffX; + var diffY; + var diffZ; + var cp1; + var cp1X; + var cp1Y; + var cp1Z; + var cp2; + var cp2X; + var cp2Y; + var cp2Z; + diffX = w11X - w10X; + diffY = w11Y - w10Y; + diffZ = w11Z - w10Z; + cp1X = w10X + diffX * s3; + cp1Y = w10Y + diffY * s3; + cp1Z = w10Z + diffZ * s3; + diffX = w12X - w10X; + diffY = w12Y - w10Y; + diffZ = w12Z - w10Z; + cp1X += diffX * t1; + cp1Y += diffY * t1; + cp1Z += diffZ * t1; + diffX = w21X - w20X; + diffY = w21Y - w20Y; + diffZ = w21Z - w20Z; + cp2X = w20X + diffX * s3; + cp2Y = w20Y + diffY * s3; + cp2Z = w20Z + diffZ * s3; + diffX = w22X - w20X; + diffY = w22Y - w20Y; + diffZ = w22Z - w20Z; + cp2X += diffX * t1; + cp2Y += diffY * t1; + cp2Z += diffZ * t1; + var v19 = this.closestPoint1; + v19.x = cp1X; + v19.y = cp1Y; + v19.z = cp1Z; + var v20 = this.closestPoint2; + v20.x = cp2X; + v20.y = cp2Y; + v20.z = cp2Z; + var _this14 = this.closest; + this.depth = Math.sqrt(_this14.x * _this14.x + _this14.y * _this14.y + _this14.z * _this14.z); + return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.SUCCEEDED; + } + var _this15 = this.polyhedron; + var first4 = _this15._vertexPool; + if(first4 != null) { + _this15._vertexPool = first4._next; + first4._next = null; + } else { + first4 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + } + var epaVertex = first4.init(supportingVertex,witness1,witness2); + if(!this.polyhedron._addVertex(epaVertex,face)) { + return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; + } + ++count; + } + return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_DID_NOT_CONVERGE; + } + computeClosestPoints(c1,c2,tf1,tf2,cache) { + return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,true); + } + computeDistance(c1,c2,tf1,tf2,cache) { + return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,false); + } + convexCast(c1,c2,tf1,tf2,tl1,tl2,hit) { + return this.convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit); + } + rayCast(c,tf,begin,end,hit) { + var tf1 = this.tempTransform; + var tf2 = tf; + var v = begin; + tf1._positionX = v.x; + tf1._positionY = v.y; + tf1._positionZ = v.z; + var tl1 = this.tl1; + var tl2 = this.tl2; + tl1.x = end.x; + tl1.y = end.y; + tl1.z = end.z; + var _this = tl1; + var tx = _this.x - begin.x; + var ty = _this.y - begin.y; + var tz = _this.z - begin.z; + _this.x = tx; + _this.y = ty; + _this.z = tz; + tl2.zero(); + return this.convexCastImpl(null,c,tf1,tf2,tl1,tl2,hit); + } + static getInstance() { + return oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + } +} +oimo.collision.narrowphase.detector.gjkepa.GjkEpaLog = class oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog { +} +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState = class oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState { +} +oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_narrowphase_detector_gjkepa_SimplexUtil { + static projectOrigin2(vec1,vec2,out) { + var v1; + var v1X; + var v1Y; + var v1Z; + var v2; + var v2X; + var v2Y; + var v2Z; + var v = vec1; + v1X = v.x; + v1Y = v.y; + v1Z = v.z; + var v3 = vec2; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; + var v12; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; + var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / d; + if(t < 0) { + var v4 = out; + v4.x = v1X; + v4.y = v1Y; + v4.z = v1Z; + return 1; + } + if(t > 1) { + var v5 = out; + v5.x = v2X; + v5.y = v2Y; + v5.z = v2Z; + return 2; + } + var p; + var pX; + var pY; + var pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + var v6 = out; + v6.x = pX; + v6.y = pY; + v6.z = pZ; + return 3; + } + static projectOrigin3(vec1,vec2,vec3,out) { + var v1; + var v1X; + var v1Y; + var v1Z; + var v2; + var v2X; + var v2Y; + var v2Z; + var v3; + var v3X; + var v3Y; + var v3Z; + var v12; + var v12X; + var v12Y; + var v12Z; + var v23; + var v23X; + var v23Y; + var v23Z; + var v31; + var v31X; + var v31Y; + var v31Z; + var v = vec1; + v1X = v.x; + v1Y = v.y; + v1Z = v.z; + var v4 = vec2; + v2X = v4.x; + v2Y = v4.y; + v2Z = v4.z; + var v5 = vec3; + v3X = v5.x; + v3Y = v5.y; + v3Z = v5.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + var n; + var nX; + var nY; + var nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + var n12; + var n12X; + var n12Y; + var n12Z; + var n23; + var n23X; + var n23Y; + var n23Z; + var n31; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var d12 = v1X * n12X + v1Y * n12Y + v1Z * n12Z; + var d23 = v2X * n23X + v2Y * n23Y + v2Z * n23Z; + var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; + var mind = -1; + var minv; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(d12 < 0) { + var v11; + var v1X1; + var v1Y1; + var v1Z1; + var v21; + var v2X1; + var v2Y1; + var v2Z1; + var v6 = vec1; + v1X1 = v6.x; + v1Y1 = v6.y; + v1Z1 = v6.z; + var v7 = vec2; + v2X1 = v7.x; + v2Y1 = v7.y; + v2Z1 = v7.z; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + var d = v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1; + var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; + t = -t / d; + var b; + if(t < 0) { + var v8 = out; + v8.x = v1X1; + v8.y = v1Y1; + v8.z = v1Z1; + b = 1; + } else if(t > 1) { + var v9 = out; + v9.x = v2X1; + v9.y = v2Y1; + v9.z = v2Z1; + b = 2; + } else { + var p; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X1 * t; + pY = v1Y1 + v12Y1 * t; + pZ = v1Z1 + v12Z1 * t; + var v10 = out; + v10.x = pX; + v10.y = pY; + v10.z = pZ; + b = 3; + } + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + mini = b; + mind = d1; + var v13 = out; + minvX = v13.x; + minvY = v13.y; + minvZ = v13.z; + } + if(d23 < 0) { + var v14; + var v1X2; + var v1Y2; + var v1Z2; + var v22; + var v2X2; + var v2Y2; + var v2Z2; + var v15 = vec2; + v1X2 = v15.x; + v1Y2 = v15.y; + v1Z2 = v15.z; + var v16 = vec3; + v2X2 = v16.x; + v2Y2 = v16.y; + v2Z2 = v16.z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var d2 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; + var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t1 = -t1 / d2; + var b1; + if(t1 < 0) { + var v17 = out; + v17.x = v1X2; + v17.y = v1Y2; + v17.z = v1Z2; + b1 = 1; + } else if(t1 > 1) { + var v18 = out; + v18.x = v2X2; + v18.y = v2Y2; + v18.z = v2Z2; + b1 = 2; + } else { + var p1; + var pX1; + var pY1; + var pZ1; + pX1 = v1X2 + v12X2 * t1; + pY1 = v1Y2 + v12Y2 * t1; + pZ1 = v1Z2 + v12Z2 * t1; + var v19 = out; + v19.x = pX1; + v19.y = pY1; + v19.z = pZ1; + b1 = 3; + } + var d3 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d3 < mind) { + mini = b1 << 1; + mind = d3; + var v20 = out; + minvX = v20.x; + minvY = v20.y; + minvZ = v20.z; + } + } + if(d31 < 0) { + var v110; + var v1X3; + var v1Y3; + var v1Z3; + var v24; + var v2X3; + var v2Y3; + var v2Z3; + var v25 = vec1; + v1X3 = v25.x; + v1Y3 = v25.y; + v1Z3 = v25.z; + var v26 = vec3; + v2X3 = v26.x; + v2Y3 = v26.y; + v2Z3 = v26.z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var d4 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; + var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t2 = -t2 / d4; + var b2; + if(t2 < 0) { + var v27 = out; + v27.x = v1X3; + v27.y = v1Y3; + v27.z = v1Z3; + b2 = 1; + } else if(t2 > 1) { + var v28 = out; + v28.x = v2X3; + v28.y = v2Y3; + v28.z = v2Z3; + b2 = 2; + } else { + var p2; + var pX2; + var pY2; + var pZ2; + pX2 = v1X3 + v12X3 * t2; + pY2 = v1Y3 + v12Y3 * t2; + pZ2 = v1Z3 + v12Z3 * t2; + var v29 = out; + v29.x = pX2; + v29.y = pY2; + v29.z = pZ2; + b2 = 3; + } + var d5 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d5 < mind) { + mini = b2 & 1 | (b2 & 2) << 1; + mind = d5; + var v30 = out; + minvX = v30.x; + minvY = v30.y; + minvZ = v30.z; + } + } + if(mind > 0) { + var v32 = out; + v32.x = minvX; + v32.y = minvY; + v32.z = minvZ; + return mini; + } + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var dn = v1X * nX + v1Y * nY + v1Z * nZ; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = dn / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + var v33 = out; + v33.x = minvX; + v33.y = minvY; + v33.z = minvZ; + return 7; + } + static projectOrigin4(vec1,vec2,vec3,vec4,out) { + var v1; + var v1X; + var v1Y; + var v1Z; + var v2; + var v2X; + var v2Y; + var v2Z; + var v3; + var v3X; + var v3Y; + var v3Z; + var v4; + var v4X; + var v4Y; + var v4Z; + var v12; + var v12X; + var v12Y; + var v12Z; + var v13; + var v13X; + var v13Y; + var v13Z; + var v14; + var v14X; + var v14Y; + var v14Z; + var v23; + var v23X; + var v23Y; + var v23Z; + var v24; + var v24X; + var v24Y; + var v24Z; + var v34; + var v34X; + var v34Y; + var v34Z; + var v = vec1; + v1X = v.x; + v1Y = v.y; + v1Z = v.z; + var v5 = vec2; + v2X = v5.x; + v2Y = v5.y; + v2Z = v5.z; + var v6 = vec3; + v3X = v6.x; + v3Y = v6.y; + v3Z = v6.z; + var v7 = vec4; + v4X = v7.x; + v4Y = v7.y; + v4Z = v7.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v13X = v3X - v1X; + v13Y = v3Y - v1Y; + v13Z = v3Z - v1Z; + v14X = v4X - v1X; + v14Y = v4Y - v1Y; + v14Z = v4Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v24X = v4X - v2X; + v24Y = v4Y - v2Y; + v24Z = v4Z - v2Z; + v34X = v4X - v3X; + v34Y = v4Y - v3Y; + v34Z = v4Z - v3Z; + var rev; + var n123; + var n123X; + var n123Y; + var n123Z; + var n134; + var n134X; + var n134Y; + var n134Z; + var n142; + var n142X; + var n142Y; + var n142Z; + var n243; + var n243X; + var n243Y; + var n243Z; + var n; + var nX; + var nY; + var nZ; + n123X = v12Y * v13Z - v12Z * v13Y; + n123Y = v12Z * v13X - v12X * v13Z; + n123Z = v12X * v13Y - v12Y * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z - v14Z * v12Y; + n142Y = v14Z * v12X - v14X * v12Z; + n142Z = v14X * v12Y - v14Y * v12X; + n243X = v24Y * v23Z - v24Z * v23Y; + n243Y = v24Z * v23X - v24X * v23Z; + n243Z = v24X * v23Y - v24Y * v23X; + var sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; + var d123 = v1X * n123X + v1Y * n123Y + v1Z * n123Z; + var d134 = v1X * n134X + v1Y * n134Y + v1Z * n134Z; + var d142 = v1X * n142X + v1Y * n142Y + v1Z * n142Z; + var d243 = v2X * n243X + v2Y * n243Y + v2Z * n243Z; + var mind = -1; + var minv; + var minvX; + var minvY; + var minvZ; + var mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(d123 * sign < 0) { + var v11; + var v1X1; + var v1Y1; + var v1Z1; + var v21; + var v2X1; + var v2Y1; + var v2Z1; + var v31; + var v3X1; + var v3Y1; + var v3Z1; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + var v231; + var v23X1; + var v23Y1; + var v23Z1; + var v311; + var v31X; + var v31Y; + var v31Z; + var v8 = vec1; + v1X1 = v8.x; + v1Y1 = v8.y; + v1Z1 = v8.z; + var v9 = vec2; + v2X1 = v9.x; + v2Y1 = v9.y; + v2Z1 = v9.z; + var v10 = vec3; + v3X1 = v10.x; + v3Y1 = v10.y; + v3Z1 = v10.z; + v12X1 = v2X1 - v1X1; + v12Y1 = v2Y1 - v1Y1; + v12Z1 = v2Z1 - v1Z1; + v23X1 = v3X1 - v2X1; + v23Y1 = v3Y1 - v2Y1; + v23Z1 = v3Z1 - v2Z1; + v31X = v1X1 - v3X1; + v31Y = v1Y1 - v3Y1; + v31Z = v1Z1 - v3Z1; + var n1; + var nX1; + var nY1; + var nZ1; + nX1 = v12Y1 * v23Z1 - v12Z1 * v23Y1; + nY1 = v12Z1 * v23X1 - v12X1 * v23Z1; + nZ1 = v12X1 * v23Y1 - v12Y1 * v23X1; + var n12; + var n12X; + var n12Y; + var n12Z; + var n23; + var n23X; + var n23Y; + var n23Z; + var n31; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y1 * nZ1 - v12Z1 * nY1; + n12Y = v12Z1 * nX1 - v12X1 * nZ1; + n12Z = v12X1 * nY1 - v12Y1 * nX1; + n23X = v23Y1 * nZ1 - v23Z1 * nY1; + n23Y = v23Z1 * nX1 - v23X1 * nZ1; + n23Z = v23X1 * nY1 - v23Y1 * nX1; + n31X = v31Y * nZ1 - v31Z * nY1; + n31Y = v31Z * nX1 - v31X * nZ1; + n31Z = v31X * nY1 - v31Y * nX1; + var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; + var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; + var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; + var mind1 = -1; + var minv1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(d12 < 0) { + var v15; + var v1X2; + var v1Y2; + var v1Z2; + var v22; + var v2X2; + var v2Y2; + var v2Z2; + var v16 = vec1; + v1X2 = v16.x; + v1Y2 = v16.y; + v1Z2 = v16.z; + var v17 = vec2; + v2X2 = v17.x; + v2Y2 = v17.y; + v2Z2 = v17.z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + var d = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; + var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; + t = -t / d; + var b; + if(t < 0) { + var v18 = out; + v18.x = v1X2; + v18.y = v1Y2; + v18.z = v1Z2; + b = 1; + } else if(t > 1) { + var v19 = out; + v19.x = v2X2; + v19.y = v2Y2; + v19.z = v2Z2; + b = 2; + } else { + var p; + var pX; + var pY; + var pZ; + pX = v1X2 + v12X2 * t; + pY = v1Y2 + v12Y2 * t; + pZ = v1Z2 + v12Z2 * t; + var v20 = out; + v20.x = pX; + v20.y = pY; + v20.z = pZ; + b = 3; + } + var d1 = out.x * out.x + out.y * out.y + out.z * out.z; + mini1 = b; + mind1 = d1; + var v25 = out; + minvX1 = v25.x; + minvY1 = v25.y; + minvZ1 = v25.z; + } + if(d23 < 0) { + var v110; + var v1X3; + var v1Y3; + var v1Z3; + var v26; + var v2X3; + var v2Y3; + var v2Z3; + var v27 = vec2; + v1X3 = v27.x; + v1Y3 = v27.y; + v1Z3 = v27.z; + var v28 = vec3; + v2X3 = v28.x; + v2Y3 = v28.y; + v2Z3 = v28.z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + v12X3 = v2X3 - v1X3; + v12Y3 = v2Y3 - v1Y3; + v12Z3 = v2Z3 - v1Z3; + var d2 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; + var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; + t1 = -t1 / d2; + var b1; + if(t1 < 0) { + var v29 = out; + v29.x = v1X3; + v29.y = v1Y3; + v29.z = v1Z3; + b1 = 1; + } else if(t1 > 1) { + var v30 = out; + v30.x = v2X3; + v30.y = v2Y3; + v30.z = v2Z3; + b1 = 2; + } else { + var p1; + var pX1; + var pY1; + var pZ1; + pX1 = v1X3 + v12X3 * t1; + pY1 = v1Y3 + v12Y3 * t1; + pZ1 = v1Z3 + v12Z3 * t1; + var v32 = out; + v32.x = pX1; + v32.y = pY1; + v32.z = pZ1; + b1 = 3; + } + var d3 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d3 < mind1) { + mini1 = b1 << 1; + mind1 = d3; + var v33 = out; + minvX1 = v33.x; + minvY1 = v33.y; + minvZ1 = v33.z; + } + } + if(d31 < 0) { + var v111; + var v1X4; + var v1Y4; + var v1Z4; + var v210; + var v2X4; + var v2Y4; + var v2Z4; + var v35 = vec1; + v1X4 = v35.x; + v1Y4 = v35.y; + v1Z4 = v35.z; + var v36 = vec3; + v2X4 = v36.x; + v2Y4 = v36.y; + v2Z4 = v36.z; + var v124; + var v12X4; + var v12Y4; + var v12Z4; + v12X4 = v2X4 - v1X4; + v12Y4 = v2Y4 - v1Y4; + v12Z4 = v2Z4 - v1Z4; + var d4 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; + var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; + t2 = -t2 / d4; + var b2; + if(t2 < 0) { + var v37 = out; + v37.x = v1X4; + v37.y = v1Y4; + v37.z = v1Z4; + b2 = 1; + } else if(t2 > 1) { + var v38 = out; + v38.x = v2X4; + v38.y = v2Y4; + v38.z = v2Z4; + b2 = 2; + } else { + var p2; + var pX2; + var pY2; + var pZ2; + pX2 = v1X4 + v12X4 * t2; + pY2 = v1Y4 + v12Y4 * t2; + pZ2 = v1Z4 + v12Z4 * t2; + var v39 = out; + v39.x = pX2; + v39.y = pY2; + v39.z = pZ2; + b2 = 3; + } + var d5 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d5 < mind1) { + mini1 = b2 & 1 | (b2 & 2) << 1; + mind1 = d5; + var v40 = out; + minvX1 = v40.x; + minvY1 = v40.y; + minvZ1 = v40.z; + } + } + var b3; + if(mind1 > 0) { + var v41 = out; + v41.x = minvX1; + v41.y = minvY1; + v41.z = minvZ1; + b3 = mini1; + } else { + var l = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX1 *= l; + nY1 *= l; + nZ1 *= l; + var dn = v1X1 * nX1 + v1Y1 * nY1 + v1Z1 * nZ1; + var l2 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + l2 = dn / l2; + minvX1 = nX1 * l2; + minvY1 = nY1 * l2; + minvZ1 = nZ1 * l2; + var v42 = out; + v42.x = minvX1; + v42.y = minvY1; + v42.z = minvZ1; + b3 = 7; + } + var d6 = out.x * out.x + out.y * out.y + out.z * out.z; + mini = b3; + mind = d6; + var v43 = out; + minvX = v43.x; + minvY = v43.y; + minvZ = v43.z; + } + if(d134 * sign < 0) { + var v112; + var v1X5; + var v1Y5; + var v1Z5; + var v211; + var v2X5; + var v2Y5; + var v2Z5; + var v310; + var v3X2; + var v3Y2; + var v3Z2; + var v125; + var v12X5; + var v12Y5; + var v12Z5; + var v232; + var v23X2; + var v23Y2; + var v23Z2; + var v312; + var v31X1; + var v31Y1; + var v31Z1; + var v44 = vec1; + v1X5 = v44.x; + v1Y5 = v44.y; + v1Z5 = v44.z; + var v45 = vec3; + v2X5 = v45.x; + v2Y5 = v45.y; + v2Z5 = v45.z; + var v46 = vec4; + v3X2 = v46.x; + v3Y2 = v46.y; + v3Z2 = v46.z; + v12X5 = v2X5 - v1X5; + v12Y5 = v2Y5 - v1Y5; + v12Z5 = v2Z5 - v1Z5; + v23X2 = v3X2 - v2X5; + v23Y2 = v3Y2 - v2Y5; + v23Z2 = v3Z2 - v2Z5; + v31X1 = v1X5 - v3X2; + v31Y1 = v1Y5 - v3Y2; + v31Z1 = v1Z5 - v3Z2; + var n2; + var nX2; + var nY2; + var nZ2; + nX2 = v12Y5 * v23Z2 - v12Z5 * v23Y2; + nY2 = v12Z5 * v23X2 - v12X5 * v23Z2; + nZ2 = v12X5 * v23Y2 - v12Y5 * v23X2; + var n121; + var n12X1; + var n12Y1; + var n12Z1; + var n231; + var n23X1; + var n23Y1; + var n23Z1; + var n311; + var n31X1; + var n31Y1; + var n31Z1; + n12X1 = v12Y5 * nZ2 - v12Z5 * nY2; + n12Y1 = v12Z5 * nX2 - v12X5 * nZ2; + n12Z1 = v12X5 * nY2 - v12Y5 * nX2; + n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; + n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; + n23Z1 = v23X2 * nY2 - v23Y2 * nX2; + n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; + n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; + n31Z1 = v31X1 * nY2 - v31Y1 * nX2; + var d121 = v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1; + var d231 = v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1; + var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; + var mind2 = -1; + var minv2; + var minvX2; + var minvY2; + var minvZ2; + var mini2 = 0; + minvX2 = 0; + minvY2 = 0; + minvZ2 = 0; + if(d121 < 0) { + var v113; + var v1X6; + var v1Y6; + var v1Z6; + var v212; + var v2X6; + var v2Y6; + var v2Z6; + var v47 = vec1; + v1X6 = v47.x; + v1Y6 = v47.y; + v1Z6 = v47.z; + var v48 = vec3; + v2X6 = v48.x; + v2Y6 = v48.y; + v2Z6 = v48.z; + var v126; + var v12X6; + var v12Y6; + var v12Z6; + v12X6 = v2X6 - v1X6; + v12Y6 = v2Y6 - v1Y6; + v12Z6 = v2Z6 - v1Z6; + var d7 = v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6; + var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; + t3 = -t3 / d7; + var b4; + if(t3 < 0) { + var v49 = out; + v49.x = v1X6; + v49.y = v1Y6; + v49.z = v1Z6; + b4 = 1; + } else if(t3 > 1) { + var v50 = out; + v50.x = v2X6; + v50.y = v2Y6; + v50.z = v2Z6; + b4 = 2; + } else { + var p3; + var pX3; + var pY3; + var pZ3; + pX3 = v1X6 + v12X6 * t3; + pY3 = v1Y6 + v12Y6 * t3; + pZ3 = v1Z6 + v12Z6 * t3; + var v51 = out; + v51.x = pX3; + v51.y = pY3; + v51.z = pZ3; + b4 = 3; + } + var d8 = out.x * out.x + out.y * out.y + out.z * out.z; + mini2 = b4; + mind2 = d8; + var v52 = out; + minvX2 = v52.x; + minvY2 = v52.y; + minvZ2 = v52.z; + } + if(d231 < 0) { + var v114; + var v1X7; + var v1Y7; + var v1Z7; + var v213; + var v2X7; + var v2Y7; + var v2Z7; + var v53 = vec3; + v1X7 = v53.x; + v1Y7 = v53.y; + v1Z7 = v53.z; + var v54 = vec4; + v2X7 = v54.x; + v2Y7 = v54.y; + v2Z7 = v54.z; + var v127; + var v12X7; + var v12Y7; + var v12Z7; + v12X7 = v2X7 - v1X7; + v12Y7 = v2Y7 - v1Y7; + v12Z7 = v2Z7 - v1Z7; + var d9 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; + var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; + t4 = -t4 / d9; + var b5; + if(t4 < 0) { + var v55 = out; + v55.x = v1X7; + v55.y = v1Y7; + v55.z = v1Z7; + b5 = 1; + } else if(t4 > 1) { + var v56 = out; + v56.x = v2X7; + v56.y = v2Y7; + v56.z = v2Z7; + b5 = 2; + } else { + var p4; + var pX4; + var pY4; + var pZ4; + pX4 = v1X7 + v12X7 * t4; + pY4 = v1Y7 + v12Y7 * t4; + pZ4 = v1Z7 + v12Z7 * t4; + var v57 = out; + v57.x = pX4; + v57.y = pY4; + v57.z = pZ4; + b5 = 3; + } + var d10 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d10 < mind2) { + mini2 = b5 << 1; + mind2 = d10; + var v58 = out; + minvX2 = v58.x; + minvY2 = v58.y; + minvZ2 = v58.z; + } + } + if(d311 < 0) { + var v115; + var v1X8; + var v1Y8; + var v1Z8; + var v214; + var v2X8; + var v2Y8; + var v2Z8; + var v59 = vec1; + v1X8 = v59.x; + v1Y8 = v59.y; + v1Z8 = v59.z; + var v60 = vec4; + v2X8 = v60.x; + v2Y8 = v60.y; + v2Z8 = v60.z; + var v128; + var v12X8; + var v12Y8; + var v12Z8; + v12X8 = v2X8 - v1X8; + v12Y8 = v2Y8 - v1Y8; + v12Z8 = v2Z8 - v1Z8; + var d11 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; + var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; + t5 = -t5 / d11; + var b6; + if(t5 < 0) { + var v61 = out; + v61.x = v1X8; + v61.y = v1Y8; + v61.z = v1Z8; + b6 = 1; + } else if(t5 > 1) { + var v62 = out; + v62.x = v2X8; + v62.y = v2Y8; + v62.z = v2Z8; + b6 = 2; + } else { + var p5; + var pX5; + var pY5; + var pZ5; + pX5 = v1X8 + v12X8 * t5; + pY5 = v1Y8 + v12Y8 * t5; + pZ5 = v1Z8 + v12Z8 * t5; + var v63 = out; + v63.x = pX5; + v63.y = pY5; + v63.z = pZ5; + b6 = 3; + } + var d13 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind2 < 0 || d13 < mind2) { + mini2 = b6 & 1 | (b6 & 2) << 1; + mind2 = d13; + var v64 = out; + minvX2 = v64.x; + minvY2 = v64.y; + minvZ2 = v64.z; + } + } + var b7; + if(mind2 > 0) { + var v65 = out; + v65.x = minvX2; + v65.y = minvY2; + v65.z = minvZ2; + b7 = mini2; + } else { + var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + nX2 *= l1; + nY2 *= l1; + nZ2 *= l1; + var dn1 = v1X5 * nX2 + v1Y5 * nY2 + v1Z5 * nZ2; + var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; + l21 = dn1 / l21; + minvX2 = nX2 * l21; + minvY2 = nY2 * l21; + minvZ2 = nZ2 * l21; + var v66 = out; + v66.x = minvX2; + v66.y = minvY2; + v66.z = minvZ2; + b7 = 7; + } + var d14 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d14 < mind) { + mini = b7 & 1 | (b7 & 6) << 1; + mind = d14; + var v67 = out; + minvX = v67.x; + minvY = v67.y; + minvZ = v67.z; + } + } + if(d142 * sign < 0) { + var v116; + var v1X9; + var v1Y9; + var v1Z9; + var v215; + var v2X9; + var v2Y9; + var v2Z9; + var v313; + var v3X3; + var v3Y3; + var v3Z3; + var v129; + var v12X9; + var v12Y9; + var v12Z9; + var v233; + var v23X3; + var v23Y3; + var v23Z3; + var v314; + var v31X2; + var v31Y2; + var v31Z2; + var v68 = vec1; + v1X9 = v68.x; + v1Y9 = v68.y; + v1Z9 = v68.z; + var v69 = vec2; + v2X9 = v69.x; + v2Y9 = v69.y; + v2Z9 = v69.z; + var v70 = vec4; + v3X3 = v70.x; + v3Y3 = v70.y; + v3Z3 = v70.z; + v12X9 = v2X9 - v1X9; + v12Y9 = v2Y9 - v1Y9; + v12Z9 = v2Z9 - v1Z9; + v23X3 = v3X3 - v2X9; + v23Y3 = v3Y3 - v2Y9; + v23Z3 = v3Z3 - v2Z9; + v31X2 = v1X9 - v3X3; + v31Y2 = v1Y9 - v3Y3; + v31Z2 = v1Z9 - v3Z3; + var n3; + var nX3; + var nY3; + var nZ3; + nX3 = v12Y9 * v23Z3 - v12Z9 * v23Y3; + nY3 = v12Z9 * v23X3 - v12X9 * v23Z3; + nZ3 = v12X9 * v23Y3 - v12Y9 * v23X3; + var n122; + var n12X2; + var n12Y2; + var n12Z2; + var n232; + var n23X2; + var n23Y2; + var n23Z2; + var n312; + var n31X2; + var n31Y2; + var n31Z2; + n12X2 = v12Y9 * nZ3 - v12Z9 * nY3; + n12Y2 = v12Z9 * nX3 - v12X9 * nZ3; + n12Z2 = v12X9 * nY3 - v12Y9 * nX3; + n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; + n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; + n23Z2 = v23X3 * nY3 - v23Y3 * nX3; + n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; + n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; + n31Z2 = v31X2 * nY3 - v31Y2 * nX3; + var d122 = v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2; + var d232 = v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2; + var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; + var mind3 = -1; + var minv3; + var minvX3; + var minvY3; + var minvZ3; + var mini3 = 0; + minvX3 = 0; + minvY3 = 0; + minvZ3 = 0; + if(d122 < 0) { + var v117; + var v1X10; + var v1Y10; + var v1Z10; + var v216; + var v2X10; + var v2Y10; + var v2Z10; + var v71 = vec1; + v1X10 = v71.x; + v1Y10 = v71.y; + v1Z10 = v71.z; + var v72 = vec2; + v2X10 = v72.x; + v2Y10 = v72.y; + v2Z10 = v72.z; + var v1210; + var v12X10; + var v12Y10; + var v12Z10; + v12X10 = v2X10 - v1X10; + v12Y10 = v2Y10 - v1Y10; + v12Z10 = v2Z10 - v1Z10; + var d15 = v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10; + var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; + t6 = -t6 / d15; + var b8; + if(t6 < 0) { + var v73 = out; + v73.x = v1X10; + v73.y = v1Y10; + v73.z = v1Z10; + b8 = 1; + } else if(t6 > 1) { + var v74 = out; + v74.x = v2X10; + v74.y = v2Y10; + v74.z = v2Z10; + b8 = 2; + } else { + var p6; + var pX6; + var pY6; + var pZ6; + pX6 = v1X10 + v12X10 * t6; + pY6 = v1Y10 + v12Y10 * t6; + pZ6 = v1Z10 + v12Z10 * t6; + var v75 = out; + v75.x = pX6; + v75.y = pY6; + v75.z = pZ6; + b8 = 3; + } + var d16 = out.x * out.x + out.y * out.y + out.z * out.z; + mini3 = b8; + mind3 = d16; + var v76 = out; + minvX3 = v76.x; + minvY3 = v76.y; + minvZ3 = v76.z; + } + if(d232 < 0) { + var v118; + var v1X11; + var v1Y11; + var v1Z11; + var v217; + var v2X11; + var v2Y11; + var v2Z11; + var v77 = vec2; + v1X11 = v77.x; + v1Y11 = v77.y; + v1Z11 = v77.z; + var v78 = vec4; + v2X11 = v78.x; + v2Y11 = v78.y; + v2Z11 = v78.z; + var v1211; + var v12X11; + var v12Y11; + var v12Z11; + v12X11 = v2X11 - v1X11; + v12Y11 = v2Y11 - v1Y11; + v12Z11 = v2Z11 - v1Z11; + var d17 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; + var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; + t7 = -t7 / d17; + var b9; + if(t7 < 0) { + var v79 = out; + v79.x = v1X11; + v79.y = v1Y11; + v79.z = v1Z11; + b9 = 1; + } else if(t7 > 1) { + var v80 = out; + v80.x = v2X11; + v80.y = v2Y11; + v80.z = v2Z11; + b9 = 2; + } else { + var p7; + var pX7; + var pY7; + var pZ7; + pX7 = v1X11 + v12X11 * t7; + pY7 = v1Y11 + v12Y11 * t7; + pZ7 = v1Z11 + v12Z11 * t7; + var v81 = out; + v81.x = pX7; + v81.y = pY7; + v81.z = pZ7; + b9 = 3; + } + var d18 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d18 < mind3) { + mini3 = b9 << 1; + mind3 = d18; + var v82 = out; + minvX3 = v82.x; + minvY3 = v82.y; + minvZ3 = v82.z; + } + } + if(d312 < 0) { + var v119; + var v1X12; + var v1Y12; + var v1Z12; + var v218; + var v2X12; + var v2Y12; + var v2Z12; + var v83 = vec1; + v1X12 = v83.x; + v1Y12 = v83.y; + v1Z12 = v83.z; + var v84 = vec4; + v2X12 = v84.x; + v2Y12 = v84.y; + v2Z12 = v84.z; + var v1212; + var v12X12; + var v12Y12; + var v12Z12; + v12X12 = v2X12 - v1X12; + v12Y12 = v2Y12 - v1Y12; + v12Z12 = v2Z12 - v1Z12; + var d19 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; + var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; + t8 = -t8 / d19; + var b10; + if(t8 < 0) { + var v85 = out; + v85.x = v1X12; + v85.y = v1Y12; + v85.z = v1Z12; + b10 = 1; + } else if(t8 > 1) { + var v86 = out; + v86.x = v2X12; + v86.y = v2Y12; + v86.z = v2Z12; + b10 = 2; + } else { + var p8; + var pX8; + var pY8; + var pZ8; + pX8 = v1X12 + v12X12 * t8; + pY8 = v1Y12 + v12Y12 * t8; + pZ8 = v1Z12 + v12Z12 * t8; + var v87 = out; + v87.x = pX8; + v87.y = pY8; + v87.z = pZ8; + b10 = 3; + } + var d20 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind3 < 0 || d20 < mind3) { + mini3 = b10 & 1 | (b10 & 2) << 1; + mind3 = d20; + var v88 = out; + minvX3 = v88.x; + minvY3 = v88.y; + minvZ3 = v88.z; + } + } + var b11; + if(mind3 > 0) { + var v89 = out; + v89.x = minvX3; + v89.y = minvY3; + v89.z = minvZ3; + b11 = mini3; + } else { + var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + nX3 *= l3; + nY3 *= l3; + nZ3 *= l3; + var dn2 = v1X9 * nX3 + v1Y9 * nY3 + v1Z9 * nZ3; + var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; + l22 = dn2 / l22; + minvX3 = nX3 * l22; + minvY3 = nY3 * l22; + minvZ3 = nZ3 * l22; + var v90 = out; + v90.x = minvX3; + v90.y = minvY3; + v90.z = minvZ3; + b11 = 7; + } + var d21 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d21 < mind) { + mini = b11 & 3 | (b11 & 4) << 1; + mind = d21; + var v91 = out; + minvX = v91.x; + minvY = v91.y; + minvZ = v91.z; + } + } + if(d243 * sign < 0) { + var v120; + var v1X13; + var v1Y13; + var v1Z13; + var v219; + var v2X13; + var v2Y13; + var v2Z13; + var v315; + var v3X4; + var v3Y4; + var v3Z4; + var v1213; + var v12X13; + var v12Y13; + var v12Z13; + var v234; + var v23X4; + var v23Y4; + var v23Z4; + var v316; + var v31X3; + var v31Y3; + var v31Z3; + var v92 = vec2; + v1X13 = v92.x; + v1Y13 = v92.y; + v1Z13 = v92.z; + var v93 = vec3; + v2X13 = v93.x; + v2Y13 = v93.y; + v2Z13 = v93.z; + var v94 = vec4; + v3X4 = v94.x; + v3Y4 = v94.y; + v3Z4 = v94.z; + v12X13 = v2X13 - v1X13; + v12Y13 = v2Y13 - v1Y13; + v12Z13 = v2Z13 - v1Z13; + v23X4 = v3X4 - v2X13; + v23Y4 = v3Y4 - v2Y13; + v23Z4 = v3Z4 - v2Z13; + v31X3 = v1X13 - v3X4; + v31Y3 = v1Y13 - v3Y4; + v31Z3 = v1Z13 - v3Z4; + var n4; + var nX4; + var nY4; + var nZ4; + nX4 = v12Y13 * v23Z4 - v12Z13 * v23Y4; + nY4 = v12Z13 * v23X4 - v12X13 * v23Z4; + nZ4 = v12X13 * v23Y4 - v12Y13 * v23X4; + var n124; + var n12X3; + var n12Y3; + var n12Z3; + var n233; + var n23X3; + var n23Y3; + var n23Z3; + var n313; + var n31X3; + var n31Y3; + var n31Z3; + n12X3 = v12Y13 * nZ4 - v12Z13 * nY4; + n12Y3 = v12Z13 * nX4 - v12X13 * nZ4; + n12Z3 = v12X13 * nY4 - v12Y13 * nX4; + n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; + n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; + n23Z3 = v23X4 * nY4 - v23Y4 * nX4; + n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; + n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; + n31Z3 = v31X3 * nY4 - v31Y3 * nX4; + var d124 = v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3; + var d233 = v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3; + var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; + var mind4 = -1; + var minv4; + var minvX4; + var minvY4; + var minvZ4; + var mini4 = 0; + minvX4 = 0; + minvY4 = 0; + minvZ4 = 0; + if(d124 < 0) { + var v130; + var v1X14; + var v1Y14; + var v1Z14; + var v220; + var v2X14; + var v2Y14; + var v2Z14; + var v95 = vec2; + v1X14 = v95.x; + v1Y14 = v95.y; + v1Z14 = v95.z; + var v96 = vec3; + v2X14 = v96.x; + v2Y14 = v96.y; + v2Z14 = v96.z; + var v1214; + var v12X14; + var v12Y14; + var v12Z14; + v12X14 = v2X14 - v1X14; + v12Y14 = v2Y14 - v1Y14; + v12Z14 = v2Z14 - v1Z14; + var d22 = v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14; + var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; + t9 = -t9 / d22; + var b12; + if(t9 < 0) { + var v97 = out; + v97.x = v1X14; + v97.y = v1Y14; + v97.z = v1Z14; + b12 = 1; + } else if(t9 > 1) { + var v98 = out; + v98.x = v2X14; + v98.y = v2Y14; + v98.z = v2Z14; + b12 = 2; + } else { + var p9; + var pX9; + var pY9; + var pZ9; + pX9 = v1X14 + v12X14 * t9; + pY9 = v1Y14 + v12Y14 * t9; + pZ9 = v1Z14 + v12Z14 * t9; + var v99 = out; + v99.x = pX9; + v99.y = pY9; + v99.z = pZ9; + b12 = 3; + } + var d24 = out.x * out.x + out.y * out.y + out.z * out.z; + mini4 = b12; + mind4 = d24; + var v100 = out; + minvX4 = v100.x; + minvY4 = v100.y; + minvZ4 = v100.z; + } + if(d233 < 0) { + var v131; + var v1X15; + var v1Y15; + var v1Z15; + var v221; + var v2X15; + var v2Y15; + var v2Z15; + var v101 = vec3; + v1X15 = v101.x; + v1Y15 = v101.y; + v1Z15 = v101.z; + var v102 = vec4; + v2X15 = v102.x; + v2Y15 = v102.y; + v2Z15 = v102.z; + var v1215; + var v12X15; + var v12Y15; + var v12Z15; + v12X15 = v2X15 - v1X15; + v12Y15 = v2Y15 - v1Y15; + v12Z15 = v2Z15 - v1Z15; + var d25 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; + var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; + t10 = -t10 / d25; + var b13; + if(t10 < 0) { + var v103 = out; + v103.x = v1X15; + v103.y = v1Y15; + v103.z = v1Z15; + b13 = 1; + } else if(t10 > 1) { + var v104 = out; + v104.x = v2X15; + v104.y = v2Y15; + v104.z = v2Z15; + b13 = 2; + } else { + var p10; + var pX10; + var pY10; + var pZ10; + pX10 = v1X15 + v12X15 * t10; + pY10 = v1Y15 + v12Y15 * t10; + pZ10 = v1Z15 + v12Z15 * t10; + var v105 = out; + v105.x = pX10; + v105.y = pY10; + v105.z = pZ10; + b13 = 3; + } + var d26 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d26 < mind4) { + mini4 = b13 << 1; + mind4 = d26; + var v106 = out; + minvX4 = v106.x; + minvY4 = v106.y; + minvZ4 = v106.z; + } + } + if(d313 < 0) { + var v132; + var v1X16; + var v1Y16; + var v1Z16; + var v222; + var v2X16; + var v2Y16; + var v2Z16; + var v107 = vec2; + v1X16 = v107.x; + v1Y16 = v107.y; + v1Z16 = v107.z; + var v108 = vec4; + v2X16 = v108.x; + v2Y16 = v108.y; + v2Z16 = v108.z; + var v1216; + var v12X16; + var v12Y16; + var v12Z16; + v12X16 = v2X16 - v1X16; + v12Y16 = v2Y16 - v1Y16; + v12Z16 = v2Z16 - v1Z16; + var d27 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; + var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; + t11 = -t11 / d27; + var b14; + if(t11 < 0) { + var v109 = out; + v109.x = v1X16; + v109.y = v1Y16; + v109.z = v1Z16; + b14 = 1; + } else if(t11 > 1) { + var v133 = out; + v133.x = v2X16; + v133.y = v2Y16; + v133.z = v2Z16; + b14 = 2; + } else { + var p11; + var pX11; + var pY11; + var pZ11; + pX11 = v1X16 + v12X16 * t11; + pY11 = v1Y16 + v12Y16 * t11; + pZ11 = v1Z16 + v12Z16 * t11; + var v134 = out; + v134.x = pX11; + v134.y = pY11; + v134.z = pZ11; + b14 = 3; + } + var d28 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind4 < 0 || d28 < mind4) { + mini4 = b14 & 1 | (b14 & 2) << 1; + mind4 = d28; + var v135 = out; + minvX4 = v135.x; + minvY4 = v135.y; + minvZ4 = v135.z; + } + } + var b15; + if(mind4 > 0) { + var v136 = out; + v136.x = minvX4; + v136.y = minvY4; + v136.z = minvZ4; + b15 = mini4; + } else { + var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + if(l4 > 0) { + l4 = 1 / Math.sqrt(l4); + } + nX4 *= l4; + nY4 *= l4; + nZ4 *= l4; + var dn3 = v1X13 * nX4 + v1Y13 * nY4 + v1Z13 * nZ4; + var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; + l23 = dn3 / l23; + minvX4 = nX4 * l23; + minvY4 = nY4 * l23; + minvZ4 = nZ4 * l23; + var v137 = out; + v137.x = minvX4; + v137.y = minvY4; + v137.z = minvZ4; + b15 = 7; + } + var d29 = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d29 < mind) { + mini = b15 << 1; + mind = d29; + var v138 = out; + minvX = v138.x; + minvY = v138.y; + minvZ = v138.z; + } + } + if(mind > 0) { + var v139 = out; + v139.x = minvX; + v139.y = minvY; + v139.z = minvZ; + return mini; + } + out.zero(); + return 15; + } +} +oimo.common.Mat3 = class oimo_common_Mat3 { + constructor(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + oimo.common.Mat3.numCreations++; + } + init(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + return this; + } + identity() { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + add(m) { + return new oimo.common.Mat3(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22); + } + sub(m) { + return new oimo.common.Mat3(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22); + } + scale(s) { + return new oimo.common.Mat3(this.e00 * s,this.e01 * s,this.e02 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e20 * s,this.e21 * s,this.e22 * s); + } + mul(m) { + return new oimo.common.Mat3(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22); + } + addEq(m) { + var t00 = this.e00 + m.e00; + var t01 = this.e01 + m.e01; + var t02 = this.e02 + m.e02; + var t10 = this.e10 + m.e10; + var t11 = this.e11 + m.e11; + var t12 = this.e12 + m.e12; + var t20 = this.e20 + m.e20; + var t21 = this.e21 + m.e21; + var t22 = this.e22 + m.e22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + subEq(m) { + var t00 = this.e00 - m.e00; + var t01 = this.e01 - m.e01; + var t02 = this.e02 - m.e02; + var t10 = this.e10 - m.e10; + var t11 = this.e11 - m.e11; + var t12 = this.e12 - m.e12; + var t20 = this.e20 - m.e20; + var t21 = this.e21 - m.e21; + var t22 = this.e22 - m.e22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + scaleEq(s) { + var t00 = this.e00 * s; + var t01 = this.e01 * s; + var t02 = this.e02 * s; + var t10 = this.e10 * s; + var t11 = this.e11 * s; + var t12 = this.e12 * s; + var t20 = this.e20 * s; + var t21 = this.e21 * s; + var t22 = this.e22 * s; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + mulEq(m) { + var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; + var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; + var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; + var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; + var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; + var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; + var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; + var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; + var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + prependScale(sx,sy,sz) { + return new oimo.common.Mat3(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz); + } + appendScale(sx,sy,sz) { + return new oimo.common.Mat3(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e20 * sx,this.e21 * sy,this.e22 * sz); + } + prependRotation(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo.common.Mat3(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22); + } + appendRotation(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo.common.Mat3(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22); + } + prependScaleEq(sx,sy,sz) { + var t00 = this.e00 * sx; + var t01 = this.e01 * sx; + var t02 = this.e02 * sx; + var t10 = this.e10 * sy; + var t11 = this.e11 * sy; + var t12 = this.e12 * sy; + var t20 = this.e20 * sz; + var t21 = this.e21 * sz; + var t22 = this.e22 * sz; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + appendScaleEq(sx,sy,sz) { + var t00 = this.e00 * sx; + var t01 = this.e01 * sy; + var t02 = this.e02 * sz; + var t10 = this.e10 * sx; + var t11 = this.e11 * sy; + var t12 = this.e12 * sz; + var t20 = this.e20 * sx; + var t21 = this.e21 * sy; + var t22 = this.e22 * sz; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + prependRotationEq(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + appendRotationEq(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + transpose() { + return new oimo.common.Mat3(this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22); + } + transposeEq() { + var t00 = this.e00; + var t01 = this.e10; + var t02 = this.e20; + var t10 = this.e01; + var t11 = this.e11; + var t12 = this.e21; + var t20 = this.e02; + var t21 = this.e12; + var t22 = this.e22; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + determinant() { + return this.e00 * (this.e11 * this.e22 - this.e12 * this.e21) - this.e01 * (this.e10 * this.e22 - this.e12 * this.e20) + this.e02 * (this.e10 * this.e21 - this.e11 * this.e20); + } + trace() { + return this.e00 + this.e11 + this.e22; + } + inverse() { + var d00 = this.e11 * this.e22 - this.e12 * this.e21; + var d01 = this.e10 * this.e22 - this.e12 * this.e20; + var d02 = this.e10 * this.e21 - this.e11 * this.e20; + var d10 = this.e01 * this.e22 - this.e02 * this.e21; + var d11 = this.e00 * this.e22 - this.e02 * this.e20; + var d12 = this.e00 * this.e21 - this.e01 * this.e20; + var d20 = this.e01 * this.e12 - this.e02 * this.e11; + var d21 = this.e00 * this.e12 - this.e02 * this.e10; + var d22 = this.e00 * this.e11 - this.e01 * this.e10; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + if(invDet != 0) { + invDet = 1 / invDet; + } + return new oimo.common.Mat3(d00 * invDet,-d10 * invDet,d20 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet); + } + inverseEq() { + var d00 = this.e11 * this.e22 - this.e12 * this.e21; + var d01 = this.e10 * this.e22 - this.e12 * this.e20; + var d02 = this.e10 * this.e21 - this.e11 * this.e20; + var d10 = this.e01 * this.e22 - this.e02 * this.e21; + var d11 = this.e00 * this.e22 - this.e02 * this.e20; + var d12 = this.e00 * this.e21 - this.e01 * this.e20; + var d20 = this.e01 * this.e12 - this.e02 * this.e11; + var d21 = this.e00 * this.e12 - this.e02 * this.e10; + var d22 = this.e00 * this.e11 - this.e01 * this.e10; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + if(invDet != 0) { + invDet = 1 / invDet; + } + var t00 = d00 * invDet; + var t01 = -d10 * invDet; + var t02 = d20 * invDet; + var t10 = -d01 * invDet; + var t11 = d11 * invDet; + var t12 = -d21 * invDet; + var t20 = d02 * invDet; + var t21 = -d12 * invDet; + var t22 = d22 * invDet; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + toArray(columnMajor) { + if(columnMajor == null) { + columnMajor = false; + } + if(columnMajor) { + return [this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22]; + } else { + return [this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22]; + } + } + copyFrom(m) { + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + return this; + } + clone() { + return new oimo.common.Mat3(this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22); + } + fromQuat(q) { + var x = q.x; + var y = q.y; + var z = q.z; + var w = q.w; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this.e00 = 1 - yy - zz; + this.e01 = xy - wz; + this.e02 = xz + wy; + this.e10 = xy + wz; + this.e11 = 1 - xx - zz; + this.e12 = yz - wx; + this.e20 = xz - wy; + this.e21 = yz + wx; + this.e22 = 1 - xx - yy; + return this; + } + toQuat() { + var _this = new oimo.common.Quat(); + var e00 = this.e00; + var e11 = this.e11; + var e22 = this.e22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + _this.w = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e21 - this.e12) * s; + _this.y = (this.e02 - this.e20) * s; + _this.z = (this.e10 - this.e01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + _this.x = 0.5 * s; + s = 0.5 / s; + _this.y = (this.e01 + this.e10) * s; + _this.z = (this.e02 + this.e20) * s; + _this.w = (this.e21 - this.e12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + _this.z = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e02 + this.e20) * s; + _this.y = (this.e12 + this.e21) * s; + _this.w = (this.e10 - this.e01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + _this.y = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e01 + this.e10) * s; + _this.z = (this.e12 + this.e21) * s; + _this.w = (this.e02 - this.e20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + _this.z = 0.5 * s; + s = 0.5 / s; + _this.x = (this.e02 + this.e20) * s; + _this.y = (this.e12 + this.e21) * s; + _this.w = (this.e10 - this.e01) * s; + } + return _this; + } + fromEulerXyz(eulerAngles) { + var sx = Math.sin(eulerAngles.x); + var sy = Math.sin(eulerAngles.y); + var sz = Math.sin(eulerAngles.z); + var cx = Math.cos(eulerAngles.x); + var cy = Math.cos(eulerAngles.y); + var cz = Math.cos(eulerAngles.z); + var t00 = cy * cz; + var t01 = -cy * sz; + var t02 = sy; + var t10 = cx * sz + cz * sx * sy; + var t11 = cx * cz - sx * sy * sz; + var t12 = -cy * sx; + var t20 = sx * sz - cx * cz * sy; + var t21 = cz * sx + cx * sy * sz; + var t22 = cx * cy; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + toEulerXyz() { + var sy = this.e02; + if(sy <= -1) { + var xSubZ = Math.atan2(this.e21,this.e11); + return new oimo.common.Vec3(xSubZ * 0.5,-1.570796326794895,-xSubZ * 0.5); + } + if(sy >= 1) { + var xAddZ = Math.atan2(this.e21,this.e11); + return new oimo.common.Vec3(xAddZ * 0.5,1.570796326794895,xAddZ * 0.5); + } + var y = Math.asin(sy); + var x = Math.atan2(-this.e12,this.e22); + var z = Math.atan2(-this.e01,this.e00); + return new oimo.common.Vec3(x,y,z); + } + getRow(index) { + if(index == 0) { + return new oimo.common.Vec3(this.e00,this.e01,this.e02); + } else if(index == 1) { + return new oimo.common.Vec3(this.e10,this.e11,this.e12); + } else if(index == 2) { + return new oimo.common.Vec3(this.e20,this.e21,this.e22); + } else { + return null; + } + } + getCol(index) { + if(index == 0) { + return new oimo.common.Vec3(this.e00,this.e10,this.e20); + } else if(index == 1) { + return new oimo.common.Vec3(this.e01,this.e11,this.e21); + } else if(index == 2) { + return new oimo.common.Vec3(this.e02,this.e12,this.e22); + } else { + return null; + } + } + getRowTo(index,dst) { + if(index == 0) { + dst.init(this.e00,this.e01,this.e02); + } else if(index == 1) { + dst.init(this.e10,this.e11,this.e12); + } else if(index == 2) { + dst.init(this.e20,this.e21,this.e22); + } else { + dst.zero(); + } + } + getColTo(index,dst) { + if(index == 0) { + dst.init(this.e00,this.e10,this.e20); + } else if(index == 1) { + dst.init(this.e01,this.e11,this.e21); + } else if(index == 2) { + dst.init(this.e02,this.e12,this.e22); + } else { + dst.zero(); + } + } + fromRows(row0,row1,row2) { + var t00 = row0.x; + var t01 = row0.y; + var t02 = row0.z; + var t10 = row1.x; + var t11 = row1.y; + var t12 = row1.z; + var t20 = row2.x; + var t21 = row2.y; + var t22 = row2.z; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + fromCols(col0,col1,col2) { + var t00 = col0.x; + var t01 = col1.x; + var t02 = col2.x; + var t10 = col0.y; + var t11 = col1.y; + var t12 = col2.y; + var t20 = col0.z; + var t21 = col1.z; + var t22 = col2.z; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + return this; + } + toString() { + return "Mat3[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + "]"; + } +} +oimo.common.Mat4 = class oimo_common_Mat4 { + constructor(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + if(e33 == null) { + e33 = 1; + } + if(e32 == null) { + e32 = 0; + } + if(e31 == null) { + e31 = 0; + } + if(e30 == null) { + e30 = 0; + } + if(e23 == null) { + e23 = 0; + } + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e13 == null) { + e13 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e03 == null) { + e03 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + oimo.common.Mat4.numCreations++; + } + init(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + return this; + } + identity() { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t03 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t13 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + add(m) { + return new oimo.common.Mat4(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e03 + m.e03,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e13 + m.e13,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22,this.e23 + m.e23,this.e30 + m.e30,this.e31 + m.e31,this.e32 + m.e32,this.e33 + m.e33); + } + sub(m) { + return new oimo.common.Mat4(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e03 - m.e03,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e13 - m.e13,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22,this.e23 - m.e23,this.e30 - m.e30,this.e31 - m.e31,this.e32 - m.e32,this.e33 - m.e33); + } + scale(s) { + return new oimo.common.Mat4(this.e00 * s,this.e01 * s,this.e02 * s,this.e03 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e13 * s,this.e20 * s,this.e21 * s,this.e22 * s,this.e23 * s,this.e30 * s,this.e31 * s,this.e32 * s,this.e33 * s); + } + mul(m) { + return new oimo.common.Mat4(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32,this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32,this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32,this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33,this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30,this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31,this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32,this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33); + } + addEq(m) { + var t00 = this.e00 + m.e00; + var t01 = this.e01 + m.e01; + var t02 = this.e02 + m.e02; + var t03 = this.e03 + m.e03; + var t10 = this.e10 + m.e10; + var t11 = this.e11 + m.e11; + var t12 = this.e12 + m.e12; + var t13 = this.e13 + m.e13; + var t20 = this.e20 + m.e20; + var t21 = this.e21 + m.e21; + var t22 = this.e22 + m.e22; + var t23 = this.e23 + m.e23; + var t30 = this.e30 + m.e30; + var t31 = this.e31 + m.e31; + var t32 = this.e32 + m.e32; + var t33 = this.e33 + m.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + subEq(m) { + var t00 = this.e00 - m.e00; + var t01 = this.e01 - m.e01; + var t02 = this.e02 - m.e02; + var t03 = this.e03 - m.e03; + var t10 = this.e10 - m.e10; + var t11 = this.e11 - m.e11; + var t12 = this.e12 - m.e12; + var t13 = this.e13 - m.e13; + var t20 = this.e20 - m.e20; + var t21 = this.e21 - m.e21; + var t22 = this.e22 - m.e22; + var t23 = this.e23 - m.e23; + var t30 = this.e30 - m.e30; + var t31 = this.e31 - m.e31; + var t32 = this.e32 - m.e32; + var t33 = this.e33 - m.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + scaleEq(s) { + var t00 = this.e00 * s; + var t01 = this.e01 * s; + var t02 = this.e02 * s; + var t03 = this.e03 * s; + var t10 = this.e10 * s; + var t11 = this.e11 * s; + var t12 = this.e12 * s; + var t13 = this.e13 * s; + var t20 = this.e20 * s; + var t21 = this.e21 * s; + var t22 = this.e22 * s; + var t23 = this.e23 * s; + var t30 = this.e30 * s; + var t31 = this.e31 * s; + var t32 = this.e32 * s; + var t33 = this.e33 * s; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + mulEq(m) { + var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; + var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; + var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; + var t03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; + var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; + var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; + var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; + var t13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; + var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; + var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; + var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; + var t23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; + var t30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; + var t31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; + var t32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; + var t33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + prependScale(sx,sy,sz) { + return new oimo.common.Mat4(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e03 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e13 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz,this.e23 * sz,this.e30,this.e31,this.e32,this.e33); + } + appendScale(sx,sy,sz) { + return new oimo.common.Mat4(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e03,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e13,this.e20 * sx,this.e21 * sy,this.e22 * sz,this.e23,this.e30 * sx,this.e31 * sy,this.e32 * sz,this.e33); + } + prependRotation(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo.common.Mat4(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r00 * this.e03 + r01 * this.e13 + r02 * this.e23,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r10 * this.e03 + r11 * this.e13 + r12 * this.e23,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22,r20 * this.e03 + r21 * this.e13 + r22 * this.e23,this.e30,this.e31,this.e32,this.e33); + } + appendRotation(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + return new oimo.common.Mat4(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e03,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e13,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22,this.e23,this.e30 * r00 + this.e31 * r10 + this.e32 * r20,this.e30 * r01 + this.e31 * r11 + this.e32 * r21,this.e30 * r02 + this.e31 * r12 + this.e32 * r22,this.e33); + } + prependTranslation(tx,ty,tz) { + return new oimo.common.Mat4(this.e00 + tx * this.e30,this.e01 + tx * this.e31,this.e02 + tx * this.e32,this.e03 + tx * this.e33,this.e10 + ty * this.e30,this.e11 + ty * this.e31,this.e12 + ty * this.e32,this.e13 + ty * this.e33,this.e20 + tz * this.e30,this.e21 + tz * this.e31,this.e22 + tz * this.e32,this.e23 + tz * this.e33,this.e30,this.e31,this.e32,this.e33); + } + appendTranslation(tx,ty,tz) { + return new oimo.common.Mat4(this.e00,this.e01,this.e02,this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03,this.e10,this.e11,this.e12,this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13,this.e20,this.e21,this.e22,this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23,this.e30,this.e31,this.e32,this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33); + } + prependScaleEq(sx,sy,sz) { + var t00 = this.e00 * sx; + var t01 = this.e01 * sx; + var t02 = this.e02 * sx; + var t03 = this.e03 * sx; + var t10 = this.e10 * sy; + var t11 = this.e11 * sy; + var t12 = this.e12 * sy; + var t13 = this.e13 * sy; + var t20 = this.e20 * sz; + var t21 = this.e21 * sz; + var t22 = this.e22 * sz; + var t23 = this.e23 * sz; + var t30 = this.e30; + var t31 = this.e31; + var t32 = this.e32; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + appendScaleEq(sx,sy,sz) { + var t00 = this.e00 * sx; + var t01 = this.e01 * sy; + var t02 = this.e02 * sz; + var t03 = this.e03; + var t10 = this.e10 * sx; + var t11 = this.e11 * sy; + var t12 = this.e12 * sz; + var t13 = this.e13; + var t20 = this.e20 * sx; + var t21 = this.e21 * sy; + var t22 = this.e22 * sz; + var t23 = this.e23; + var t30 = this.e30 * sx; + var t31 = this.e31 * sy; + var t32 = this.e32 * sz; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + prependRotationEq(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + var t03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; + var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + var t13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; + var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + var t23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; + var t30 = this.e30; + var t31 = this.e31; + var t32 = this.e32; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + appendRotationEq(rad,axisX,axisY,axisZ) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var c1 = 1 - c; + var r00 = axisX * axisX * c1 + c; + var r01 = axisX * axisY * c1 - axisZ * s; + var r02 = axisX * axisZ * c1 + axisY * s; + var r10 = axisY * axisX * c1 + axisZ * s; + var r11 = axisY * axisY * c1 + c; + var r12 = axisY * axisZ * c1 - axisX * s; + var r20 = axisZ * axisX * c1 - axisY * s; + var r21 = axisZ * axisY * c1 + axisX * s; + var r22 = axisZ * axisZ * c1 + c; + var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + var t03 = this.e03; + var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + var t13 = this.e13; + var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + var t23 = this.e23; + var t30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; + var t31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; + var t32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + prependTranslationEq(tx,ty,tz) { + var t00 = this.e00 + tx * this.e30; + var t01 = this.e01 + tx * this.e31; + var t02 = this.e02 + tx * this.e32; + var t03 = this.e03 + tx * this.e33; + var t10 = this.e10 + ty * this.e30; + var t11 = this.e11 + ty * this.e31; + var t12 = this.e12 + ty * this.e32; + var t13 = this.e13 + ty * this.e33; + var t20 = this.e20 + tz * this.e30; + var t21 = this.e21 + tz * this.e31; + var t22 = this.e22 + tz * this.e32; + var t23 = this.e23 + tz * this.e33; + var t30 = this.e30; + var t31 = this.e31; + var t32 = this.e32; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + appendTranslationEq(tx,ty,tz) { + var t00 = this.e00; + var t01 = this.e01; + var t02 = this.e02; + var t03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; + var t10 = this.e10; + var t11 = this.e11; + var t12 = this.e12; + var t13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; + var t20 = this.e20; + var t21 = this.e21; + var t22 = this.e22; + var t23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; + var t30 = this.e30; + var t31 = this.e31; + var t32 = this.e32; + var t33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + transpose() { + return new oimo.common.Mat4(this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33); + } + transposeEq() { + var t00 = this.e00; + var t01 = this.e10; + var t02 = this.e20; + var t03 = this.e30; + var t10 = this.e01; + var t11 = this.e11; + var t12 = this.e21; + var t13 = this.e31; + var t20 = this.e02; + var t21 = this.e12; + var t22 = this.e22; + var t23 = this.e32; + var t30 = this.e03; + var t31 = this.e13; + var t32 = this.e23; + var t33 = this.e33; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + determinant() { + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + return this.e00 * (this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12) - this.e01 * (this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02) + this.e02 * (this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01) - this.e03 * (this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01); + } + trace() { + return this.e00 + this.e11 + this.e22 + this.e33; + } + inverse() { + var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; + var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; + var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; + var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; + var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; + var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; + var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; + var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; + var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; + var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; + var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; + var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + if(invDet != 0) { + invDet = 1 / invDet; + } + return new oimo.common.Mat4(d00 * invDet,-d10 * invDet,d20 * invDet,-d30 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d31 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet,-d32 * invDet,-d03 * invDet,d13 * invDet,-d23 * invDet,d33 * invDet); + } + inverseEq() { + var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; + var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; + var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; + var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; + var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; + var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; + var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; + var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; + var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; + var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; + var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; + var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; + var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + if(invDet != 0) { + invDet = 1 / invDet; + } + var t00 = d00 * invDet; + var t01 = -d10 * invDet; + var t02 = d20 * invDet; + var t03 = -d30 * invDet; + var t10 = -d01 * invDet; + var t11 = d11 * invDet; + var t12 = -d21 * invDet; + var t13 = d31 * invDet; + var t20 = d02 * invDet; + var t21 = -d12 * invDet; + var t22 = d22 * invDet; + var t23 = -d32 * invDet; + var t30 = -d03 * invDet; + var t31 = d13 * invDet; + var t32 = -d23 * invDet; + var t33 = d33 * invDet; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + lookAt(eyeX,eyeY,eyeZ,atX,atY,atZ,upX,upY,upZ) { + var zx = eyeX - atX; + var zy = eyeY - atY; + var zz = eyeZ - atZ; + var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + zx *= tmp; + zy *= tmp; + zz *= tmp; + var xx = upY * zz - upZ * zy; + var xy = upZ * zx - upX * zz; + var xz = upX * zy - upY * zx; + tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); + xx *= tmp; + xy *= tmp; + xz *= tmp; + var yx = zy * xz - zz * xy; + var yy = zz * xx - zx * xz; + var yz = zx * xy - zy * xx; + this.e00 = xx; + this.e01 = xy; + this.e02 = xz; + this.e03 = -(xx * eyeX + xy * eyeY + xz * eyeZ); + this.e10 = yx; + this.e11 = yy; + this.e12 = yz; + this.e13 = -(yx * eyeX + yy * eyeY + yz * eyeZ); + this.e20 = zx; + this.e21 = zy; + this.e22 = zz; + this.e23 = -(zx * eyeX + zy * eyeY + zz * eyeZ); + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + perspective(fovY,aspect,near,far) { + var h = 1 / Math.tan(fovY * 0.5); + var fnf = far / (near - far); + this.e00 = h / aspect; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = h; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = fnf; + this.e23 = near * fnf; + this.e30 = 0; + this.e31 = 0; + this.e32 = -1; + this.e33 = 0; + return this; + } + ortho(width,height,near,far) { + var nf = 1 / (near - far); + this.e00 = 2 / width; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = 2 / height; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = nf; + this.e23 = near * nf; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; + return this; + } + toArray(columnMajor) { + if(columnMajor == null) { + columnMajor = false; + } + if(columnMajor) { + return [this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33]; + } else { + return [this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33]; + } + } + copyFrom(m) { + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e03 = m.e03; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e13 = m.e13; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + this.e23 = m.e23; + this.e30 = m.e30; + this.e31 = m.e31; + this.e32 = m.e32; + this.e33 = m.e33; + return this; + } + fromMat3(m) { + var t00 = m.e00; + var t01 = m.e01; + var t02 = m.e02; + var t03 = 0; + var t10 = m.e10; + var t11 = m.e11; + var t12 = m.e12; + var t13 = 0; + var t20 = m.e20; + var t21 = m.e21; + var t22 = m.e22; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + this.e00 = t00; + this.e01 = t01; + this.e02 = t02; + this.e03 = t03; + this.e10 = t10; + this.e11 = t11; + this.e12 = t12; + this.e13 = t13; + this.e20 = t20; + this.e21 = t21; + this.e22 = t22; + this.e23 = t23; + this.e30 = t30; + this.e31 = t31; + this.e32 = t32; + this.e33 = t33; + return this; + } + fromTransform(transform) { + var m = this; + m.e00 = transform._rotation00; + m.e01 = transform._rotation01; + m.e02 = transform._rotation02; + m.e10 = transform._rotation10; + m.e11 = transform._rotation11; + m.e12 = transform._rotation12; + m.e20 = transform._rotation20; + m.e21 = transform._rotation21; + m.e22 = transform._rotation22; + m.e03 = transform._positionX; + m.e13 = transform._positionY; + m.e23 = transform._positionZ; + m.e30 = 0; + m.e31 = 0; + m.e32 = 0; + m.e33 = 1; + return this; + } + clone() { + return new oimo.common.Mat4(this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33); + } + toString() { + return "Mat4[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e03 > 0 ? (this.e03 * 10000000 + 0.5 | 0) / 10000000 : (this.e03 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e13 > 0 ? (this.e13 * 10000000 + 0.5 | 0) / 10000000 : (this.e13 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e23 > 0 ? (this.e23 * 10000000 + 0.5 | 0) / 10000000 : (this.e23 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e30 > 0 ? (this.e30 * 10000000 + 0.5 | 0) / 10000000 : (this.e30 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e31 > 0 ? (this.e31 * 10000000 + 0.5 | 0) / 10000000 : (this.e31 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e32 > 0 ? (this.e32 * 10000000 + 0.5 | 0) / 10000000 : (this.e32 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e33 > 0 ? (this.e33 * 10000000 + 0.5 | 0) / 10000000 : (this.e33 * 10000000 - 0.5 | 0) / 10000000) + "]"; + } +} +oimo.common.MathUtil = class oimo_common_MathUtil { + static abs(x) { + if(x > 0) { + return x; + } else { + return -x; + } + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static tan(x) { + return Math.tan(x); + } + static asin(x) { + return Math.asin(x); + } + static acos(x) { + return Math.acos(x); + } + static atan(x) { + return Math.atan(x); + } + static safeAsin(x) { + if(x <= -1) { + return -1.570796326794895; + } + if(x >= 1) { + return 1.570796326794895; + } + return Math.asin(x); + } + static safeAcos(x) { + if(x <= -1) { + return 3.14159265358979; + } + if(x >= 1) { + return 0; + } + return Math.acos(x); + } + static atan2(y,x) { + return Math.atan2(y,x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static clamp(x,min,max) { + if(x < min) { + return min; + } else if(x > max) { + return max; + } else { + return x; + } + } + static rand() { + return Math.random(); + } + static randIn(min,max) { + return min + Math.random() * (max - min); + } + static randVec3In(min,max) { + return new oimo.common.Vec3(min + Math.random() * (max - min),min + Math.random() * (max - min),min + Math.random() * (max - min)); + } + static randVec3() { + return new oimo.common.Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + } +} +oimo.common.Pool = class oimo_common_Pool { + constructor() { + var this1 = new Array(256); + this.stackVec3 = this1; + this.sizeVec3 = 0; + var this2 = new Array(256); + this.stackMat3 = this2; + this.sizeMat3 = 0; + var this3 = new Array(256); + this.stackMat4 = this3; + this.sizeMat4 = 0; + var this4 = new Array(256); + this.stackQuat = this4; + this.sizeQuat = 0; + } + vec3() { + if(this.sizeVec3 == 0) { + return new oimo.common.Vec3(); + } else { + return this.stackVec3[--this.sizeVec3]; + } + } + mat3() { + if(this.sizeMat3 == 0) { + return new oimo.common.Mat3(); + } else { + return this.stackMat3[--this.sizeMat3]; + } + } + mat4() { + if(this.sizeMat4 == 0) { + return new oimo.common.Mat4(); + } else { + return this.stackMat4[--this.sizeMat4]; + } + } + quat() { + if(this.sizeQuat == 0) { + return new oimo.common.Quat(); + } else { + return this.stackQuat[--this.sizeQuat]; + } + } + dispose(vec3,mat3,mat4,quat) { + if(vec3 != null) { + vec3.zero(); + if(this.sizeVec3 == this.stackVec3.length) { + var newLength = this.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackVec3[i]; + this.stackVec3[i] = null; + } + this.stackVec3 = newArray; + } + this.stackVec3[this.sizeVec3++] = vec3; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(this.sizeMat3 == this.stackMat3.length) { + var newLength1 = this.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = this.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this.stackMat3[i1]; + this.stackMat3[i1] = null; + } + this.stackMat3 = newArray1; + } + this.stackMat3[this.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(this.sizeMat4 == this.stackMat4.length) { + var newLength2 = this.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = this.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = this.stackMat4[i2]; + this.stackMat4[i2] = null; + } + this.stackMat4 = newArray2; + } + this.stackMat4[this.sizeMat4++] = mat4; + } + if(quat != null) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + quat.x = tx; + quat.y = ty; + quat.z = tz; + quat.w = tw; + if(this.sizeQuat == this.stackQuat.length) { + var newLength3 = this.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = this.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = this.stackQuat[i3]; + this.stackQuat[i3] = null; + } + this.stackQuat = newArray3; + } + this.stackQuat[this.sizeQuat++] = quat; + } + } + disposeVec3(v) { + v.zero(); + if(this.sizeVec3 == this.stackVec3.length) { + var newLength = this.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackVec3[i]; + this.stackVec3[i] = null; + } + this.stackVec3 = newArray; + } + this.stackVec3[this.sizeVec3++] = v; + } + disposeMat3(m) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + m.e00 = t00; + m.e01 = t01; + m.e02 = t02; + m.e10 = t10; + m.e11 = t11; + m.e12 = t12; + m.e20 = t20; + m.e21 = t21; + m.e22 = t22; + if(this.sizeMat3 == this.stackMat3.length) { + var newLength = this.sizeMat3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat3[i]; + this.stackMat3[i] = null; + } + this.stackMat3 = newArray; + } + this.stackMat3[this.sizeMat3++] = m; + } + disposeMat4(m) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t03 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t13 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + m.e00 = t00; + m.e01 = t01; + m.e02 = t02; + m.e03 = t03; + m.e10 = t10; + m.e11 = t11; + m.e12 = t12; + m.e13 = t13; + m.e20 = t20; + m.e21 = t21; + m.e22 = t22; + m.e23 = t23; + m.e30 = t30; + m.e31 = t31; + m.e32 = t32; + m.e33 = t33; + if(this.sizeMat4 == this.stackMat4.length) { + var newLength = this.sizeMat4 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.sizeMat4; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat4[i]; + this.stackMat4[i] = null; + } + this.stackMat4 = newArray; + } + this.stackMat4[this.sizeMat4++] = m; + } + disposeQuat(q) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + q.x = tx; + q.y = ty; + q.z = tz; + q.w = tw; + if(this.sizeQuat == this.stackQuat.length) { + var newLength = this.sizeQuat << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.sizeQuat; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackQuat[i]; + this.stackQuat[i] = null; + } + this.stackQuat = newArray; + } + this.stackQuat[this.sizeQuat++] = q; + } +} +oimo.common.Quat = class oimo_common_Quat { + constructor(x,y,z,w) { + if(w == null) { + w = 1; + } + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + this.w = w; + oimo.common.Quat.numCreations++; + } + identity() { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + this.x = tx; + this.y = ty; + this.z = tz; + this.w = tw; + return this; + } + init(x,y,z,w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + return this; + } + add(q) { + return new oimo.common.Quat(this.x + q.x,this.y + q.y,this.z + q.z,this.w + q.w); + } + sub(q) { + return new oimo.common.Quat(this.x - q.x,this.y - q.y,this.z - q.z,this.w - q.w); + } + scale(s) { + return new oimo.common.Quat(this.x * s,this.y * s,this.z * s,this.w * s); + } + addEq(q) { + var tx = this.x + q.x; + var ty = this.y + q.y; + var tz = this.z + q.z; + var tw = this.w + q.w; + this.x = tx; + this.y = ty; + this.z = tz; + this.w = tw; + return this; + } + subEq(q) { + var tx = this.x - q.x; + var ty = this.y - q.y; + var tz = this.z - q.z; + var tw = this.w - q.w; + this.x = tx; + this.y = ty; + this.z = tz; + this.w = tw; + return this; + } + scaleEq(s) { + var tx = this.x * s; + var ty = this.y * s; + var tz = this.z * s; + var tw = this.w * s; + this.x = tx; + this.y = ty; + this.z = tz; + this.w = tw; + return this; + } + length() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + } + lengthSq() { + return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; + } + dot(q) { + return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + } + normalized() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + return new oimo.common.Quat(this.x * invLen,this.y * invLen,this.z * invLen,this.w * invLen); + } + normalize() { + var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = this.x * invLen; + var ty = this.y * invLen; + var tz = this.z * invLen; + var tw = this.w * invLen; + this.x = tx; + this.y = ty; + this.z = tz; + this.w = tw; + return this; + } + setArc(v1,v2) { + var x1 = v1.x; + var y1 = v1.y; + var z1 = v1.z; + var x2 = v2.x; + var y2 = v2.y; + var z2 = v2.z; + var d = x1 * x2 + y1 * y2 + z1 * z2; + this.w = Math.sqrt((1 + d) * 0.5); + if(this.w == 0) { + x2 = x1 * x1; + y2 = y1 * y1; + z2 = z1 * z1; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this.x = 0; + this.y = z1 * d; + this.z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this.z = 0; + this.x = y1 * d; + this.y = -x1 * d; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this.y = 0; + this.z = x1 * d; + this.x = -z1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this.z = 0; + this.x = y1 * d; + this.y = -x1 * d; + } + return this; + } + d = 0.5 / this.w; + var cx = y1 * z2 - z1 * y2; + var cy = z1 * x2 - x1 * z2; + var cz = x1 * y2 - y1 * x2; + this.x = cx * d; + this.y = cy * d; + this.z = cz * d; + return this; + } + slerp(q,t) { + var qx; + var qy; + var qz; + var qw; + var d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + if(d < 0) { + d = -d; + qx = -q.x; + qy = -q.y; + qz = -q.z; + qw = -q.w; + } else { + qx = q.x; + qy = q.y; + qz = q.z; + qw = q.w; + } + if(d > 0.999999) { + var _this = new oimo.common.Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx = _this.x * invLen; + var ty = _this.y * invLen; + var tz = _this.z * invLen; + var tw = _this.w * invLen; + _this.x = tx; + _this.y = ty; + _this.z = tz; + _this.w = tw; + return _this; + } + var theta = t * Math.acos(d); + qx -= this.x * d; + qy -= this.y * d; + qz -= this.z * d; + qw -= this.w * d; + var invLen1 = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); + qx *= invLen1; + qy *= invLen1; + qz *= invLen1; + qw *= invLen1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + return new oimo.common.Quat(this.x * cos + qx * sin,this.y * cos + qy * sin,this.z * cos + qz * sin,this.w * cos + qw * sin); + } + copyFrom(q) { + this.x = q.x; + this.y = q.y; + this.z = q.z; + this.w = q.w; + return this; + } + clone() { + return new oimo.common.Quat(this.x,this.y,this.z,this.w); + } + fromMat3(m) { + var e00 = m.e00; + var e11 = m.e11; + var e22 = m.e22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + this.w = 0.5 * s; + s = 0.5 / s; + this.x = (m.e21 - m.e12) * s; + this.y = (m.e02 - m.e20) * s; + this.z = (m.e10 - m.e01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + this.x = 0.5 * s; + s = 0.5 / s; + this.y = (m.e01 + m.e10) * s; + this.z = (m.e02 + m.e20) * s; + this.w = (m.e21 - m.e12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + this.z = 0.5 * s; + s = 0.5 / s; + this.x = (m.e02 + m.e20) * s; + this.y = (m.e12 + m.e21) * s; + this.w = (m.e10 - m.e01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + this.y = 0.5 * s; + s = 0.5 / s; + this.x = (m.e01 + m.e10) * s; + this.z = (m.e12 + m.e21) * s; + this.w = (m.e02 - m.e20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + this.z = 0.5 * s; + s = 0.5 / s; + this.x = (m.e02 + m.e20) * s; + this.y = (m.e12 + m.e21) * s; + this.w = (m.e10 - m.e01) * s; + } + return this; + } + toMat3() { + var _this = new oimo.common.Mat3(); + var x = this.x; + var y = this.y; + var z = this.z; + var w = this.w; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this.e00 = 1 - yy - zz; + _this.e01 = xy - wz; + _this.e02 = xz + wy; + _this.e10 = xy + wz; + _this.e11 = 1 - xx - zz; + _this.e12 = yz - wx; + _this.e20 = xz - wy; + _this.e21 = yz + wx; + _this.e22 = 1 - xx - yy; + return _this; + } + toString() { + return "Quat[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + " i,\n" + " " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + " j,\n" + " " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + " k,\n" + " " + (this.w > 0 ? (this.w * 10000000 + 0.5 | 0) / 10000000 : (this.w * 10000000 - 0.5 | 0) / 10000000) + "]"; + } +} +if(!oimo.dynamics) oimo.dynamics = {}; +oimo.dynamics.Contact = class oimo_dynamics_Contact { + constructor() { + this._next = null; + this._prev = null; + this._link1 = new oimo.dynamics.ContactLink(); + this._link2 = new oimo.dynamics.ContactLink(); + this._s1 = null; + this._s2 = null; + this._b1 = null; + this._b2 = null; + this._detector = null; + this._cachedDetectorData = new oimo.collision.narrowphase.detector.CachedDetectorData(); + this._detectorResult = new oimo.collision.narrowphase.DetectorResult(); + this._latest = false; + this._shouldBeSkipped = false; + this._manifold = new oimo.dynamics.constraint.contact.Manifold(); + this._updater = new oimo.dynamics.constraint.contact.ManifoldUpdater(this._manifold); + this._contactConstraint = new oimo.dynamics.constraint.contact.ContactConstraint(this._manifold); + this._touching = false; + } + _updateManifold() { + if(this._detector == null) { + return; + } + var ptouching = this._touching; + var result = this._detectorResult; + this._detector.detect(result,this._s1._geom,this._s2._geom,this._s1._transform,this._s2._transform,this._cachedDetectorData); + var num = result.numPoints; + this._touching = num > 0; + if(this._touching) { + this._manifold._buildBasis(result.normal); + if(result.getMaxDepth() > oimo.common.Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold) { + this._contactConstraint._positionCorrectionAlgorithm = oimo.common.Setting.alternativeContactPositionCorrectionAlgorithm; + } else { + this._contactConstraint._positionCorrectionAlgorithm = oimo.common.Setting.defaultContactPositionCorrectionAlgorithm; + } + if(result.incremental) { + this._updater.incrementalUpdate(result,this._b1._transform,this._b2._transform); + } else { + this._updater.totalUpdate(result,this._b1._transform,this._b2._transform); + } + } else { + this._manifold._clear(); + } + if(this._touching && !ptouching) { + var cc1 = this._s1._contactCallback; + var cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.beginContact(this); + } + if(cc2 != null) { + cc2.beginContact(this); + } + } + if(!this._touching && ptouching) { + var cc11 = this._s1._contactCallback; + var cc21 = this._s2._contactCallback; + if(cc11 == cc21) { + cc21 = null; + } + if(cc11 != null) { + cc11.endContact(this); + } + if(cc21 != null) { + cc21.endContact(this); + } + } + if(this._touching) { + var cc12 = this._s1._contactCallback; + var cc22 = this._s2._contactCallback; + if(cc12 == cc22) { + cc22 = null; + } + if(cc12 != null) { + cc12.preSolve(this); + } + if(cc22 != null) { + cc22.preSolve(this); + } + } + } + _postSolve() { + var cc1 = this._s1._contactCallback; + var cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.postSolve(this); + } + if(cc2 != null) { + cc2.postSolve(this); + } + } + getShape1() { + return this._s1; + } + getShape2() { + return this._s2; + } + isTouching() { + return this._touching; + } + getManifold() { + return this._manifold; + } + getContactConstraint() { + return this._contactConstraint; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.ContactLink = class oimo_dynamics_ContactLink { + constructor() { + this._prev = null; + this._next = null; + this._contact = null; + this._other = null; + } + getContact() { + return this._contact; + } + getOther() { + return this._other; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { + constructor(broadPhase) { + this._broadPhase = broadPhase; + this._collisionMatrix = new oimo.collision.narrowphase.CollisionMatrix(); + this._numContacts = 0; + } + createContacts() { + var pp = this._broadPhase._proxyPairList; + while(pp != null) { + var n = pp._next; + while(true) { + var s1; + var s2; + if(pp._p1._id < pp._p2._id) { + s1 = pp._p1.userData; + s2 = pp._p2.userData; + } else { + s1 = pp._p2.userData; + s2 = pp._p1.userData; + } + if(!this.shouldCollide(s1,s2)) { + break; + } + var b1 = s1._rigidBody; + var b2 = s2._rigidBody; + var n1 = b1._numContactLinks; + var n2 = b2._numContactLinks; + var l; + if(n1 < n2) { + l = b1._contactLinkList; + } else { + l = b2._contactLinkList; + } + var id1 = s1._id; + var id2 = s2._id; + var found = false; + while(l != null) { + var n3 = l._next; + var c = l._contact; + if(c._s1._id == id1 && c._s2._id == id2) { + c._latest = true; + found = true; + break; + } + l = n3; + } + if(!found) { + var first = this._contactPool; + if(first != null) { + this._contactPool = first._next; + first._next = null; + } else { + first = new oimo.dynamics.Contact(); + } + var c1 = first; + if(this._contactList == null) { + this._contactList = c1; + this._contactListLast = c1; + } else { + this._contactListLast._next = c1; + c1._prev = this._contactListLast; + this._contactListLast = c1; + } + c1._latest = true; + var detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; + c1._s1 = s1; + c1._s2 = s2; + c1._b1 = s1._rigidBody; + c1._b2 = s2._rigidBody; + c1._touching = false; + if(c1._b1._contactLinkList == null) { + c1._b1._contactLinkList = c1._link1; + c1._b1._contactLinkListLast = c1._link1; + } else { + c1._b1._contactLinkListLast._next = c1._link1; + c1._link1._prev = c1._b1._contactLinkListLast; + c1._b1._contactLinkListLast = c1._link1; + } + if(c1._b2._contactLinkList == null) { + c1._b2._contactLinkList = c1._link2; + c1._b2._contactLinkListLast = c1._link2; + } else { + c1._b2._contactLinkListLast._next = c1._link2; + c1._link2._prev = c1._b2._contactLinkListLast; + c1._b2._contactLinkListLast = c1._link2; + } + c1._b1._numContactLinks++; + c1._b2._numContactLinks++; + c1._link1._other = c1._b2; + c1._link2._other = c1._b1; + c1._link1._contact = c1; + c1._link2._contact = c1; + c1._detector = detector; + var _this = c1._contactConstraint; + _this._s1 = s1; + _this._s2 = s2; + _this._b1 = _this._s1._rigidBody; + _this._b2 = _this._s2._rigidBody; + _this._tf1 = _this._b1._transform; + _this._tf2 = _this._b2._transform; + this._numContacts++; + } + if(!false) { + break; + } + } + pp = n; + } + } + destroyOutdatedContacts() { + var incremental = this._broadPhase._incremental; + var c = this._contactList; + while(c != null) { + var n = c._next; + while(true) { + if(c._latest) { + c._latest = false; + c._shouldBeSkipped = false; + break; + } + if(!incremental) { + var prev = c._prev; + var next = c._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(c == this._contactList) { + this._contactList = this._contactList._next; + } + if(c == this._contactListLast) { + this._contactListLast = this._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc1 = c._s1._contactCallback; + var cc2 = c._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } + } + var prev1 = c._link1._prev; + var next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev2 = c._link2._prev; + var next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this = c._contactConstraint; + _this._s1 = null; + _this._s2 = null; + _this._b1 = null; + _this._b2 = null; + _this._tf1 = null; + _this._tf2 = null; + c._next = this._contactPool; + this._contactPool = c; + this._numContacts--; + break; + } + var s1 = c._s1; + var s2 = c._s2; + var r1 = s1._rigidBody; + var r2 = s2._rigidBody; + var active1 = !r1._sleeping && r1._type != 1; + var active2 = !r2._sleeping && r2._type != 1; + if(!active1 && !active2) { + c._shouldBeSkipped = true; + break; + } + var aabb1 = s1._aabb; + var aabb2 = s2._aabb; + var proxy1 = s1._proxy; + var proxy2 = s2._proxy; + if(!(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ && proxy1._aabbMaxZ > proxy2._aabbMinZ) || !this.shouldCollide(s1,s2)) { + var prev3 = c._prev; + var next3 = c._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c == this._contactList) { + this._contactList = this._contactList._next; + } + if(c == this._contactListLast) { + this._contactListLast = this._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc11 = c._s1._contactCallback; + var cc21 = c._s2._contactCallback; + if(cc11 == cc21) { + cc21 = null; + } + if(cc11 != null) { + cc11.endContact(c); + } + if(cc21 != null) { + cc21.endContact(c); + } + } + var prev4 = c._link1._prev; + var next4 = c._link1._next; + if(prev4 != null) { + prev4._next = next4; + } + if(next4 != null) { + next4._prev = prev4; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev5 = c._link2._prev; + var next5 = c._link2._next; + if(prev5 != null) { + prev5._next = next5; + } + if(next5 != null) { + next5._prev = prev5; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this1 = c._contactConstraint; + _this1._s1 = null; + _this1._s2 = null; + _this1._b1 = null; + _this1._b2 = null; + _this1._tf1 = null; + _this1._tf2 = null; + c._next = this._contactPool; + this._contactPool = c; + this._numContacts--; + break; + } + var aabbOverlapping = aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ; + c._shouldBeSkipped = !aabbOverlapping; + if(!false) { + break; + } + } + c = n; + } + } + shouldCollide(s1,s2) { + var r1 = s1._rigidBody; + var r2 = s2._rigidBody; + if(r1 == r2) { + return false; + } + if(r1._type != 0 && r2._type != 0) { + return false; + } + if((s1._collisionGroup & s2._collisionMask) == 0 || (s2._collisionGroup & s1._collisionMask) == 0) { + return false; + } + var jl; + var other; + if(r1._numJointLinks < r2._numJointLinks) { + jl = r1._jointLinkList; + other = r2; + } else { + jl = r2._jointLinkList; + other = r1; + } + while(jl != null) { + var n = jl._next; + if(jl._other == other && !jl._joint._allowCollision) { + return false; + } + jl = n; + } + return true; + } + _updateContacts() { + this._broadPhase.collectPairs(); + this.createContacts(); + this.destroyOutdatedContacts(); + } + _postSolve() { + var c = this._contactList; + while(c != null) { + var n = c._next; + if(c._touching) { + c._postSolve(); + } + c = n; + } + } + getNumContacts() { + return this._numContacts; + } + getContactList() { + return this._contactList; + } +} +oimo.dynamics.Island = class oimo_dynamics_Island { + constructor() { + var this1 = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); + this.rigidBodies = this1; + var this2 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this.solvers = this2; + var this3 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this.solversSi = this3; + var this4 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this.solversNgs = this4; + this.numRigidBodies = 0; + this.numSolvers = 0; + this.numSolversSi = 0; + this.numSolversNgs = 0; + } + _clear() { + while(this.numRigidBodies > 0) this.rigidBodies[--this.numRigidBodies] = null; + while(this.numSolvers > 0) this.solvers[--this.numSolvers] = null; + while(this.numSolversSi > 0) this.solversSi[--this.numSolversSi] = null; + while(this.numSolversNgs > 0) this.solversNgs[--this.numSolversNgs] = null; + } + _addRigidBody(rigidBody) { + if(this.numRigidBodies == this.rigidBodies.length) { + var newLength = this.numRigidBodies << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.rigidBodies[i]; + this.rigidBodies[i] = null; + } + this.rigidBodies = newArray; + } + rigidBody._addedToIsland = true; + this.rigidBodies[this.numRigidBodies++] = rigidBody; + } + _addConstraintSolver(solver,positionCorrection) { + if(this.numSolvers == this.solvers.length) { + var newLength = this.numSolvers << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.solvers[i]; + this.solvers[i] = null; + } + this.solvers = newArray; + } + solver._addedToIsland = true; + this.solvers[this.numSolvers++] = solver; + if(positionCorrection == oimo.dynamics.constraint.PositionCorrectionAlgorithm.SPLIT_IMPULSE) { + if(this.numSolversSi == this.solversSi.length) { + var newLength1 = this.numSolversSi << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = this.numSolversSi; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this.solversSi[i1]; + this.solversSi[i1] = null; + } + this.solversSi = newArray1; + } + this.solversSi[this.numSolversSi++] = solver; + } + if(positionCorrection == oimo.dynamics.constraint.PositionCorrectionAlgorithm.NGS) { + if(this.numSolversNgs == this.solversNgs.length) { + var newLength2 = this.numSolversNgs << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = this.numSolversNgs; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = this.solversNgs[i2]; + this.solversNgs[i2] = null; + } + this.solversNgs = newArray2; + } + this.solversNgs[this.numSolversNgs++] = solver; + } + } + _stepSingleRigidBody(timeStep,rb) { + var dt = timeStep.dt; + var dst = rb._ptransform; + var src = rb._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; + if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo.common.Setting.sleepingVelocityThreshold * oimo.common.Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo.common.Setting.sleepingAngularVelocityThreshold * oimo.common.Setting.sleepingAngularVelocityThreshold) { + rb._sleepTime += dt; + if(rb._sleepTime > oimo.common.Setting.sleepingTimeThreshold) { + rb._sleeping = true; + rb._sleepTime = 0; + } + } else { + rb._sleepTime = 0; + } + if(!rb._sleeping) { + if(rb._type == 0) { + var x = dt * rb._linearDamping; + var x2 = x * x; + var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.166666666666666657 + x2 * 0.0416666666666666644)); + var x1 = dt * rb._angularDamping; + var x21 = x1 * x1; + var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.166666666666666657 + x21 * 0.0416666666666666644)); + var linAcc; + var linAccX; + var linAccY; + var linAccZ; + var angAcc; + var angAccX; + var angAccY; + var angAccZ; + linAccX = this.gravityX * rb._gravityScale; + linAccY = this.gravityY * rb._gravityScale; + linAccZ = this.gravityZ * rb._gravityScale; + linAccX += rb._forceX * rb._invMass; + linAccY += rb._forceY * rb._invMass; + linAccZ += rb._forceZ * rb._invMass; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; + __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; + __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; + angAccX = __tmp__X; + angAccY = __tmp__Y; + angAccZ = __tmp__Z; + rb._velX += linAccX * dt; + rb._velY += linAccY * dt; + rb._velZ += linAccZ * dt; + rb._velX *= linScale; + rb._velY *= linScale; + rb._velZ *= linScale; + rb._angVelX += angAccX * dt; + rb._angVelY += angAccY * dt; + rb._angVelZ += angAccZ * dt; + rb._angVelX *= angScale; + rb._angVelY *= angScale; + rb._angVelZ *= angScale; + } + rb._integrate(dt); + var s = rb._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = rb._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = rb._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X2; + dst2._positionY = __tmp__Y2; + dst2._positionZ = __tmp__Z2; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + _step(timeStep,numVelocityIterations,numPositionIterations) { + var dt = timeStep.dt; + var sleepIsland = true; + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var i = _g++; + var rb = this.rigidBodies[i]; + var dst = rb._ptransform; + var src = rb._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + rb._linearContactImpulseX = 0; + rb._linearContactImpulseY = 0; + rb._linearContactImpulseZ = 0; + rb._angularContactImpulseX = 0; + rb._angularContactImpulseY = 0; + rb._angularContactImpulseZ = 0; + rb._sleeping = false; + if(rb._autoSleep && rb._velX * rb._velX + rb._velY * rb._velY + rb._velZ * rb._velZ < oimo.common.Setting.sleepingVelocityThreshold * oimo.common.Setting.sleepingVelocityThreshold && rb._angVelX * rb._angVelX + rb._angVelY * rb._angVelY + rb._angVelZ * rb._angVelZ < oimo.common.Setting.sleepingAngularVelocityThreshold * oimo.common.Setting.sleepingAngularVelocityThreshold) { + rb._sleepTime += dt; + } else { + rb._sleepTime = 0; + } + if(rb._sleepTime < oimo.common.Setting.sleepingTimeThreshold) { + sleepIsland = false; + } + if(rb._type == 0) { + var x = dt * rb._linearDamping; + var x2 = x * x; + var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.166666666666666657 + x2 * 0.0416666666666666644)); + var x1 = dt * rb._angularDamping; + var x21 = x1 * x1; + var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.166666666666666657 + x21 * 0.0416666666666666644)); + var linAcc; + var linAccX; + var linAccY; + var linAccZ; + var angAcc; + var angAccX; + var angAccY; + var angAccZ; + linAccX = this.gravityX * rb._gravityScale; + linAccY = this.gravityY * rb._gravityScale; + linAccZ = this.gravityZ * rb._gravityScale; + linAccX += rb._forceX * rb._invMass; + linAccY += rb._forceY * rb._invMass; + linAccZ += rb._forceZ * rb._invMass; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; + __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; + __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; + angAccX = __tmp__X; + angAccY = __tmp__Y; + angAccZ = __tmp__Z; + rb._velX += linAccX * dt; + rb._velY += linAccY * dt; + rb._velZ += linAccZ * dt; + rb._velX *= linScale; + rb._velY *= linScale; + rb._velZ *= linScale; + rb._angVelX += angAccX * dt; + rb._angVelY += angAccY * dt; + rb._angVelZ += angAccZ * dt; + rb._angVelX *= angScale; + rb._angVelY *= angScale; + rb._angVelZ *= angScale; + } + } + if(sleepIsland) { + var _g2 = 0; + var _g3 = this.numRigidBodies; + while(_g2 < _g3) { + var i1 = _g2++; + var rb1 = this.rigidBodies[i1]; + rb1._sleeping = true; + rb1._sleepTime = 0; + } + return; + } + var _g21 = 0; + var _g31 = this.numSolvers; + while(_g21 < _g31) { + var i2 = _g21++; + var s = this.solvers[i2]; + s.preSolveVelocity(timeStep); + } + var _g4 = 0; + var _g5 = this.numSolvers; + while(_g4 < _g5) { + var i3 = _g4++; + var s1 = this.solvers[i3]; + s1.warmStart(timeStep); + } + var _g6 = 0; + var _g7 = numVelocityIterations; + while(_g6 < _g7) { + var t = _g6++; + var _g61 = 0; + var _g71 = this.numSolvers; + while(_g61 < _g71) { + var i4 = _g61++; + var s2 = this.solvers[i4]; + s2.solveVelocity(); + } + } + var _g8 = 0; + var _g9 = this.numSolvers; + while(_g8 < _g9) { + var i5 = _g8++; + var s3 = this.solvers[i5]; + s3.postSolveVelocity(timeStep); + } + var _g10 = 0; + var _g11 = this.numRigidBodies; + while(_g10 < _g11) { + var i6 = _g10++; + var rb2 = this.rigidBodies[i6]; + rb2._integrate(dt); + } + var _g12 = 0; + var _g13 = this.numSolversSi; + while(_g12 < _g13) { + var i7 = _g12++; + var s4 = this.solversSi[i7]; + s4.preSolvePosition(timeStep); + } + var _g14 = 0; + var _g15 = numPositionIterations; + while(_g14 < _g15) { + var t1 = _g14++; + var _g141 = 0; + var _g151 = this.numSolversSi; + while(_g141 < _g151) { + var i8 = _g141++; + var s5 = this.solversSi[i8]; + s5.solvePositionSplitImpulse(); + } + } + var _g16 = 0; + var _g17 = this.numRigidBodies; + while(_g16 < _g17) { + var i9 = _g16++; + var rb3 = this.rigidBodies[i9]; + rb3._integratePseudoVelocity(); + } + var _g18 = 0; + var _g19 = this.numSolversNgs; + while(_g18 < _g19) { + var i10 = _g18++; + var s6 = this.solversNgs[i10]; + s6.preSolvePosition(timeStep); + } + var _g20 = 0; + var _g211 = numPositionIterations; + while(_g20 < _g211) { + var t2 = _g20++; + var _g201 = 0; + var _g212 = this.numSolversNgs; + while(_g201 < _g212) { + var i11 = _g201++; + var s7 = this.solversNgs[i11]; + s7.solvePositionNgs(timeStep); + } + } + var _g22 = 0; + var _g23 = this.numSolvers; + while(_g22 < _g23) { + var i12 = _g22++; + var s8 = this.solvers[i12]; + s8.postSolve(); + } + var _g24 = 0; + var _g25 = this.numRigidBodies; + while(_g24 < _g25) { + var i13 = _g24++; + var rb4 = this.rigidBodies[i13]; + var s9 = rb4._shapeList; + while(s9 != null) { + var n = s9._next; + var dst1 = s9._ptransform; + var src1 = s9._localTransform; + var src2 = rb4._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s9._transform; + var src11 = s9._localTransform; + var src21 = rb4._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X2; + dst2._positionY = __tmp__Y2; + dst2._positionZ = __tmp__Z2; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s9._geom._computeAabb(s9._aabb,s9._ptransform); + minX = s9._aabb._minX; + minY = s9._aabb._minY; + minZ = s9._aabb._minZ; + maxX = s9._aabb._maxX; + maxY = s9._aabb._maxY; + maxZ = s9._aabb._maxZ; + s9._geom._computeAabb(s9._aabb,s9._transform); + s9._aabb._minX = minX < s9._aabb._minX ? minX : s9._aabb._minX; + s9._aabb._minY = minY < s9._aabb._minY ? minY : s9._aabb._minY; + s9._aabb._minZ = minZ < s9._aabb._minZ ? minZ : s9._aabb._minZ; + s9._aabb._maxX = maxX > s9._aabb._maxX ? maxX : s9._aabb._maxX; + s9._aabb._maxY = maxY > s9._aabb._maxY ? maxY : s9._aabb._maxY; + s9._aabb._maxZ = maxZ > s9._aabb._maxZ ? maxZ : s9._aabb._maxZ; + if(s9._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s9._transform._positionX - s9._ptransform._positionX; + dY = s9._transform._positionY - s9._ptransform._positionY; + dZ = s9._transform._positionZ - s9._ptransform._positionZ; + var v = s9.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s9._rigidBody._world._broadPhase.moveProxy(s9._proxy,s9._aabb,s9.displacement); + } + s9 = n; + } + } + } +} +oimo.dynamics.TimeStep = class oimo_dynamics_TimeStep { + constructor() { + this.dt = 0; + this.invDt = 0; + this.dtRatio = 1; + } +} +oimo.dynamics.World = class oimo_dynamics_World { + constructor(broadPhaseType,gravity) { + if(broadPhaseType == null) { + broadPhaseType = 2; + } + switch(broadPhaseType) { + case 1: + this._broadPhase = new oimo.collision.broadphase.bruteforce.BruteForceBroadPhase(); + break; + case 2: + this._broadPhase = new oimo.collision.broadphase.bvh.BvhBroadPhase(); + break; + } + this._contactManager = new oimo.dynamics.ContactManager(this._broadPhase); + if(gravity == null) { + gravity = new oimo.common.Vec3(0,-9.80665,0); + } + this._gravity = new oimo.common.Vec3(gravity.x,gravity.y,gravity.z); + this._rigidBodyList = null; + this._rigidBodyListLast = null; + this._jointList = null; + this._jointListLast = null; + this._numRigidBodies = 0; + this._numShapes = 0; + this._numJoints = 0; + this._numIslands = 0; + this._numVelocityIterations = 10; + this._numPositionIterations = 5; + this._rayCastWrapper = new oimo.dynamics._World.RayCastWrapper(); + this._convexCastWrapper = new oimo.dynamics._World.ConvexCastWrapper(); + this._aabbTestWrapper = new oimo.dynamics._World.AabbTestWrapper(); + this._island = new oimo.dynamics.Island(); + var this1 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this._solversInIslands = this1; + var this2 = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); + this._rigidBodyStack = this2; + this._timeStep = new oimo.dynamics.TimeStep(); + this._pool = new oimo.common.Pool(); + this._shapeIdCount = 0; + } + _updateContacts() { + var st = Date.now() / 1000; + this._contactManager._updateContacts(); + var en = Date.now() / 1000; + oimo.dynamics.common.Performance.broadPhaseCollisionTime = (en - st) * 1000; + var st1 = Date.now() / 1000; + var c = this._contactManager._contactList; + while(c != null) { + var n = c._next; + if(!c._shouldBeSkipped) { + c._updateManifold(); + } + c = n; + } + var en1 = Date.now() / 1000; + oimo.dynamics.common.Performance.narrowPhaseCollisionTime = (en1 - st1) * 1000; + } + _solveIslands() { + var st = Date.now() / 1000; + if(oimo.common.Setting.disableSleeping) { + var b = this._rigidBodyList; + while(b != null) { + var n = b._next; + b._sleeping = false; + b._sleepTime = 0; + b = n; + } + } + if(this._rigidBodyStack.length < this._numRigidBodies) { + var newStackSize = this._rigidBodyStack.length << 1; + while(newStackSize < this._numRigidBodies) newStackSize <<= 1; + var this1 = new Array(newStackSize); + this._rigidBodyStack = this1; + } + this._numIslands = 0; + var _this = this._island; + var v = this._gravity; + _this.gravityX = v.x; + _this.gravityY = v.y; + _this.gravityZ = v.z; + var b1 = this._rigidBodyList; + this._numSolversInIslands = 0; + while(b1 != null) { + var n1 = b1._next; + while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { + if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { + this._island._stepSingleRigidBody(this._timeStep,b1); + this._numIslands++; + break; + } + this.buildIsland(b1); + this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); + this._island._clear(); + this._numIslands++; + if(!false) { + break; + } + } + b1 = n1; + } + this._contactManager._postSolve(); + b1 = this._rigidBodyList; + while(b1 != null) { + var n2 = b1._next; + b1._addedToIsland = false; + b1 = n2; + } + b1 = this._rigidBodyList; + while(b1 != null) { + var n3 = b1._next; + b1._forceX = 0; + b1._forceY = 0; + b1._forceZ = 0; + b1._torqueX = 0; + b1._torqueY = 0; + b1._torqueZ = 0; + b1 = n3; + } + while(this._numSolversInIslands > 0) { + this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; + this._solversInIslands[this._numSolversInIslands] = null; + } + var en = Date.now() / 1000; + oimo.dynamics.common.Performance.dynamicsTime = (en - st) * 1000; + } + buildIsland(base) { + var stackCount = 1; + this._island._addRigidBody(base); + this._rigidBodyStack[0] = base; + while(stackCount > 0) { + var rb = this._rigidBodyStack[--stackCount]; + this._rigidBodyStack[stackCount] = null; + if(rb._type == 1) { + continue; + } + var cl = rb._contactLinkList; + while(cl != null) { + var n = cl._next; + var cc = cl._contact._contactConstraint; + var ccs = cl._contact._contactConstraint._solver; + if(cc.isTouching() && !ccs._addedToIsland) { + if(this._solversInIslands.length == this._numSolversInIslands) { + var newLength = this._numSolversInIslands << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = this._numSolversInIslands; + while(_g < _g1) { + var i = _g++; + newArray[i] = this._solversInIslands[i]; + this._solversInIslands[i] = null; + } + this._solversInIslands = newArray; + } + this._solversInIslands[this._numSolversInIslands++] = ccs; + this._island._addConstraintSolver(ccs,cc._positionCorrectionAlgorithm); + var other = cl._other; + if(!other._addedToIsland) { + this._island._addRigidBody(other); + this._rigidBodyStack[stackCount++] = other; + } + } + cl = n; + } + var jl = rb._jointLinkList; + while(jl != null) { + var n1 = jl._next; + var j = jl._joint; + var js1 = j._solver; + if(!js1._addedToIsland) { + if(this._solversInIslands.length == this._numSolversInIslands) { + var newLength1 = this._numSolversInIslands << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = this._numSolversInIslands; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = this._solversInIslands[i1]; + this._solversInIslands[i1] = null; + } + this._solversInIslands = newArray1; + } + this._solversInIslands[this._numSolversInIslands++] = js1; + this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); + var other1 = jl._other; + if(!other1._addedToIsland) { + this._island._addRigidBody(other1); + this._rigidBodyStack[stackCount++] = other1; + } + } + jl = n1; + } + } + } + _drawBvh(d,tree) { + if(d.drawBvh) { + this._drawBvhNode(d,tree._root,0,d.style.bvhNodeColor); + } + } + _drawBvhNode(d,node,level,color) { + if(node == null) { + return; + } + if(level >= d.drawBvhMinLevel && level <= d.drawBvhMaxLevel) { + var _this = this._pool; + var min = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var max = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var v = min; + v.x = node._aabbMinX; + v.y = node._aabbMinY; + v.z = node._aabbMinZ; + var v1 = max; + v1.x = node._aabbMaxX; + v1.y = node._aabbMaxY; + v1.z = node._aabbMaxZ; + d.aabb(min,max,color); + var _this2 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(min != null) { + min.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newLength = _this2.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = min; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this2.sizeMat3 == _this2.stackMat3.length) { + var newLength1 = _this2.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this2.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this2.stackMat3[i1]; + _this2.stackMat3[i1] = null; + } + _this2.stackMat3 = newArray1; + } + _this2.stackMat3[_this2.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this2.sizeMat4 == _this2.stackMat4.length) { + var newLength2 = _this2.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this2.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this2.stackMat4[i2]; + _this2.stackMat4[i2] = null; + } + _this2.stackMat4 = newArray2; + } + _this2.stackMat4[_this2.sizeMat4++] = mat4; + } + if(quat != null) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + quat.x = tx; + quat.y = ty; + quat.z = tz; + quat.w = tw; + if(_this2.sizeQuat == _this2.stackQuat.length) { + var newLength3 = _this2.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this2.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this2.stackQuat[i3]; + _this2.stackQuat[i3] = null; + } + _this2.stackQuat = newArray3; + } + _this2.stackQuat[_this2.sizeQuat++] = quat; + } + var _this3 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(max != null) { + max.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newLength4 = _this3.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this3.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this3.stackVec3[i4]; + _this3.stackVec3[i4] = null; + } + _this3.stackVec3 = newArray4; + } + _this3.stackVec3[_this3.sizeVec3++] = max; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this3.sizeMat3 == _this3.stackMat3.length) { + var newLength5 = _this3.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this3.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this3.stackMat3[i5]; + _this3.stackMat3[i5] = null; + } + _this3.stackMat3 = newArray5; + } + _this3.stackMat3[_this3.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this3.sizeMat4 == _this3.stackMat4.length) { + var newLength6 = _this3.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this3.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this3.stackMat4[i6]; + _this3.stackMat4[i6] = null; + } + _this3.stackMat4 = newArray6; + } + _this3.stackMat4[_this3.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx1 = 0; + var ty1 = 0; + var tz1 = 0; + var tw1 = 1; + quat1.x = tx1; + quat1.y = ty1; + quat1.z = tz1; + quat1.w = tw1; + if(_this3.sizeQuat == _this3.stackQuat.length) { + var newLength7 = _this3.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this3.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this3.stackQuat[i7]; + _this3.stackQuat[i7] = null; + } + _this3.stackQuat = newArray7; + } + _this3.stackQuat[_this3.sizeQuat++] = quat1; + } + } + this._drawBvhNode(d,node._children[0],level + 1,color); + this._drawBvhNode(d,node._children[1],level + 1,color); + } + _drawRigidBodies(d) { + var style = d.style; + var r = this._rigidBodyList; + while(r != null) { + var n = r._next; + if(d.drawBases) { + var style1 = d.style; + d.basis(r._transform,style1.basisLength,style1.basisColorX,style1.basisColorY,style1.basisColorZ); + } + var shapeColor = null; + var isDynamic = r._type == 0; + if(!isDynamic) { + shapeColor = r._type == 2 ? style.kinematicShapeColor : style.staticShapeColor; + } + var s = r._shapeList; + while(s != null) { + var n1 = s._next; + if(isDynamic) { + if((s._id & 1) == 0) { + shapeColor = r._sleeping ? style.sleepingShapeColor1 : r._sleepTime > oimo.common.Setting.sleepingTimeThreshold ? style.sleepyShapeColor1 : style.shapeColor1; + } else { + shapeColor = r._sleeping ? style.sleepingShapeColor2 : r._sleepTime > oimo.common.Setting.sleepingTimeThreshold ? style.sleepyShapeColor2 : style.shapeColor2; + } + } + if(d.drawShapes) { + var geom = s._geom; + var tf = s._transform; + switch(geom._type) { + case 0: + d.sphere(tf,geom._radius,shapeColor); + break; + case 1: + var g = geom; + var _this = this._pool; + var hx = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var v = hx; + v.x = g._halfExtentsX; + v.y = g._halfExtentsY; + v.z = g._halfExtentsZ; + d.box(tf,hx,shapeColor); + var _this1 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(hx != null) { + hx.zero(); + if(_this1.sizeVec3 == _this1.stackVec3.length) { + var newLength = _this1.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this1.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this1.stackVec3[i]; + _this1.stackVec3[i] = null; + } + _this1.stackVec3 = newArray; + } + _this1.stackVec3[_this1.sizeVec3++] = hx; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this1.sizeMat3 == _this1.stackMat3.length) { + var newLength1 = _this1.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this1.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this1.stackMat3[i1]; + _this1.stackMat3[i1] = null; + } + _this1.stackMat3 = newArray1; + } + _this1.stackMat3[_this1.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this1.sizeMat4 == _this1.stackMat4.length) { + var newLength2 = _this1.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this1.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this1.stackMat4[i2]; + _this1.stackMat4[i2] = null; + } + _this1.stackMat4 = newArray2; + } + _this1.stackMat4[_this1.sizeMat4++] = mat4; + } + if(quat != null) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + quat.x = tx; + quat.y = ty; + quat.z = tz; + quat.w = tw; + if(_this1.sizeQuat == _this1.stackQuat.length) { + var newLength3 = _this1.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this1.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this1.stackQuat[i3]; + _this1.stackQuat[i3] = null; + } + _this1.stackQuat = newArray3; + } + _this1.stackQuat[_this1.sizeQuat++] = quat; + } + break; + case 2: + var g1 = geom; + d.cylinder(tf,g1._radius,g1._halfHeight,shapeColor); + break; + case 3: + var g2 = geom; + d.cone(tf,g2._radius,g2._halfHeight,shapeColor); + break; + case 4: + var g3 = geom; + d.capsule(tf,g3._radius,g3._halfHeight,shapeColor); + break; + case 5: + var g4 = geom; + var n2 = g4._numVertices; + var _this2 = this._pool; + var v1 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this._pool; + var v2 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this._pool; + var v3 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this5 = this._pool; + var v12 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + var _this6 = this._pool; + var v13 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var _this7 = this._pool; + var normal = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + var _this8 = this._pool; + var m = _this8.sizeMat3 == 0 ? new oimo.common.Mat3() : _this8.stackMat3[--_this8.sizeMat3]; + var _this9 = this._pool; + var o = _this9.sizeVec3 == 0 ? new oimo.common.Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + var v4 = o; + v4.x = tf._positionX; + v4.y = tf._positionY; + v4.z = tf._positionZ; + var _g5 = 0; + var _g14 = n2; + while(_g5 < _g14) { + var i4 = _g5++; + var _this10 = g4._tmpVertices[i4]; + var v5 = g4._vertices[i4]; + _this10.x = v5.x; + _this10.y = v5.y; + _this10.z = v5.z; + var _this11 = _this10; + var tx1 = _this11.x * m.e00 + _this11.y * m.e01 + _this11.z * m.e02; + var ty1 = _this11.x * m.e10 + _this11.y * m.e11 + _this11.z * m.e12; + var tz1 = _this11.x * m.e20 + _this11.y * m.e21 + _this11.z * m.e22; + _this11.x = tx1; + _this11.y = ty1; + _this11.z = tz1; + var _this12 = _this11; + var tx2 = _this12.x + o.x; + var ty2 = _this12.y + o.y; + var tz2 = _this12.z + o.z; + _this12.x = tx2; + _this12.y = ty2; + _this12.z = tz2; + } + if(n2 > 30) { + var _g21 = 0; + var _g31 = n2; + while(_g21 < _g31) { + var i5 = _g21++; + var v6 = g4._tmpVertices[i5]; + v1.x = v6.x; + v1.y = v6.y; + v1.z = v6.z; + var v7 = g4._tmpVertices[(i5 + 1) % n2]; + v2.x = v7.x; + v2.y = v7.y; + v2.z = v7.z; + d.line(v1,v2,shapeColor); + } + } else if(this._debugDraw.wireframe || n2 > 10) { + var _g22 = 0; + var _g32 = n2; + while(_g22 < _g32) { + var i6 = _g22++; + var v8 = g4._tmpVertices[i6]; + v1.x = v8.x; + v1.y = v8.y; + v1.z = v8.z; + var _g23 = 0; + var _g33 = i6; + while(_g23 < _g33) { + var j = _g23++; + var v9 = g4._tmpVertices[j]; + v2.x = v9.x; + v2.y = v9.y; + v2.z = v9.z; + d.line(v1,v2,shapeColor); + } + } + } else { + var _g24 = 0; + var _g34 = n2; + while(_g24 < _g34) { + var i7 = _g24++; + var v10 = g4._tmpVertices[i7]; + v1.x = v10.x; + v1.y = v10.y; + v1.z = v10.z; + var _g25 = 0; + var _g35 = i7; + while(_g25 < _g35) { + var j1 = _g25++; + var v11 = g4._tmpVertices[j1]; + v2.x = v11.x; + v2.y = v11.y; + v2.z = v11.z; + var _g26 = 0; + var _g36 = j1; + while(_g26 < _g36) { + var k = _g26++; + var v14 = g4._tmpVertices[k]; + v3.x = v14.x; + v3.y = v14.y; + v3.z = v14.z; + v12.x = v2.x; + v12.y = v2.y; + v12.z = v2.z; + var _this13 = v12; + var tx3 = _this13.x - v1.x; + var ty3 = _this13.y - v1.y; + var tz3 = _this13.z - v1.z; + _this13.x = tx3; + _this13.y = ty3; + _this13.z = tz3; + v13.x = v3.x; + v13.y = v3.y; + v13.z = v3.z; + var _this14 = v13; + var tx4 = _this14.x - v1.x; + var ty4 = _this14.y - v1.y; + var tz4 = _this14.z - v1.z; + _this14.x = tx4; + _this14.y = ty4; + _this14.z = tz4; + normal.x = v12.x; + normal.y = v12.y; + normal.z = v12.z; + var _this15 = normal; + var tx5 = _this15.y * v13.z - _this15.z * v13.y; + var ty5 = _this15.z * v13.x - _this15.x * v13.z; + var tz5 = _this15.x * v13.y - _this15.y * v13.x; + _this15.x = tx5; + _this15.y = ty5; + _this15.z = tz5; + var _this16 = _this15; + var invLen = Math.sqrt(_this16.x * _this16.x + _this16.y * _this16.y + _this16.z * _this16.z); + if(invLen > 0) { + invLen = 1 / invLen; + } + var tx6 = _this16.x * invLen; + var ty6 = _this16.y * invLen; + var tz6 = _this16.z * invLen; + _this16.x = tx6; + _this16.y = ty6; + _this16.z = tz6; + d.triangle(v1,v2,v3,normal,normal,normal,shapeColor); + var tx7 = -normal.x; + var ty7 = -normal.y; + var tz7 = -normal.z; + normal.x = tx7; + normal.y = ty7; + normal.z = tz7; + d.triangle(v1,v3,v2,normal,normal,normal,shapeColor); + } + } + } + } + var _this17 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(v1 != null) { + v1.zero(); + if(_this17.sizeVec3 == _this17.stackVec3.length) { + var newLength4 = _this17.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g6 = 0; + var _g15 = _this17.sizeVec3; + while(_g6 < _g15) { + var i8 = _g6++; + newArray4[i8] = _this17.stackVec3[i8]; + _this17.stackVec3[i8] = null; + } + _this17.stackVec3 = newArray4; + } + _this17.stackVec3[_this17.sizeVec3++] = v1; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this17.sizeMat3 == _this17.stackMat3.length) { + var newLength5 = _this17.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g7 = 0; + var _g16 = _this17.sizeMat3; + while(_g7 < _g16) { + var i9 = _g7++; + newArray5[i9] = _this17.stackMat3[i9]; + _this17.stackMat3[i9] = null; + } + _this17.stackMat3 = newArray5; + } + _this17.stackMat3[_this17.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this17.sizeMat4 == _this17.stackMat4.length) { + var newLength6 = _this17.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g8 = 0; + var _g17 = _this17.sizeMat4; + while(_g8 < _g17) { + var i10 = _g8++; + newArray6[i10] = _this17.stackMat4[i10]; + _this17.stackMat4[i10] = null; + } + _this17.stackMat4 = newArray6; + } + _this17.stackMat4[_this17.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx8 = 0; + var ty8 = 0; + var tz8 = 0; + var tw1 = 1; + quat1.x = tx8; + quat1.y = ty8; + quat1.z = tz8; + quat1.w = tw1; + if(_this17.sizeQuat == _this17.stackQuat.length) { + var newLength7 = _this17.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g9 = 0; + var _g18 = _this17.sizeQuat; + while(_g9 < _g18) { + var i11 = _g9++; + newArray7[i11] = _this17.stackQuat[i11]; + _this17.stackQuat[i11] = null; + } + _this17.stackQuat = newArray7; + } + _this17.stackQuat[_this17.sizeQuat++] = quat1; + } + var _this18 = this._pool; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(v2 != null) { + v2.zero(); + if(_this18.sizeVec3 == _this18.stackVec3.length) { + var newLength8 = _this18.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g10 = 0; + var _g19 = _this18.sizeVec3; + while(_g10 < _g19) { + var i12 = _g10++; + newArray8[i12] = _this18.stackVec3[i12]; + _this18.stackVec3[i12] = null; + } + _this18.stackVec3 = newArray8; + } + _this18.stackVec3[_this18.sizeVec3++] = v2; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this18.sizeMat3 == _this18.stackMat3.length) { + var newLength9 = _this18.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g20 = 0; + var _g110 = _this18.sizeMat3; + while(_g20 < _g110) { + var i13 = _g20++; + newArray9[i13] = _this18.stackMat3[i13]; + _this18.stackMat3[i13] = null; + } + _this18.stackMat3 = newArray9; + } + _this18.stackMat3[_this18.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this18.sizeMat4 == _this18.stackMat4.length) { + var newLength10 = _this18.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g27 = 0; + var _g111 = _this18.sizeMat4; + while(_g27 < _g111) { + var i14 = _g27++; + newArray10[i14] = _this18.stackMat4[i14]; + _this18.stackMat4[i14] = null; + } + _this18.stackMat4 = newArray10; + } + _this18.stackMat4[_this18.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx9 = 0; + var ty9 = 0; + var tz9 = 0; + var tw2 = 1; + quat2.x = tx9; + quat2.y = ty9; + quat2.z = tz9; + quat2.w = tw2; + if(_this18.sizeQuat == _this18.stackQuat.length) { + var newLength11 = _this18.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g28 = 0; + var _g112 = _this18.sizeQuat; + while(_g28 < _g112) { + var i15 = _g28++; + newArray11[i15] = _this18.stackQuat[i15]; + _this18.stackQuat[i15] = null; + } + _this18.stackQuat = newArray11; + } + _this18.stackQuat[_this18.sizeQuat++] = quat2; + } + var _this19 = this._pool; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(v3 != null) { + v3.zero(); + if(_this19.sizeVec3 == _this19.stackVec3.length) { + var newLength12 = _this19.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g29 = 0; + var _g113 = _this19.sizeVec3; + while(_g29 < _g113) { + var i16 = _g29++; + newArray12[i16] = _this19.stackVec3[i16]; + _this19.stackVec3[i16] = null; + } + _this19.stackVec3 = newArray12; + } + _this19.stackVec3[_this19.sizeVec3++] = v3; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this19.sizeMat3 == _this19.stackMat3.length) { + var newLength13 = _this19.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g30 = 0; + var _g114 = _this19.sizeMat3; + while(_g30 < _g114) { + var i17 = _g30++; + newArray13[i17] = _this19.stackMat3[i17]; + _this19.stackMat3[i17] = null; + } + _this19.stackMat3 = newArray13; + } + _this19.stackMat3[_this19.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this19.sizeMat4 == _this19.stackMat4.length) { + var newLength14 = _this19.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g37 = 0; + var _g115 = _this19.sizeMat4; + while(_g37 < _g115) { + var i18 = _g37++; + newArray14[i18] = _this19.stackMat4[i18]; + _this19.stackMat4[i18] = null; + } + _this19.stackMat4 = newArray14; + } + _this19.stackMat4[_this19.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx10 = 0; + var ty10 = 0; + var tz10 = 0; + var tw3 = 1; + quat3.x = tx10; + quat3.y = ty10; + quat3.z = tz10; + quat3.w = tw3; + if(_this19.sizeQuat == _this19.stackQuat.length) { + var newLength15 = _this19.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g38 = 0; + var _g116 = _this19.sizeQuat; + while(_g38 < _g116) { + var i19 = _g38++; + newArray15[i19] = _this19.stackQuat[i19]; + _this19.stackQuat[i19] = null; + } + _this19.stackQuat = newArray15; + } + _this19.stackQuat[_this19.sizeQuat++] = quat3; + } + var _this20 = this._pool; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(v12 != null) { + v12.zero(); + if(_this20.sizeVec3 == _this20.stackVec3.length) { + var newLength16 = _this20.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g39 = 0; + var _g117 = _this20.sizeVec3; + while(_g39 < _g117) { + var i20 = _g39++; + newArray16[i20] = _this20.stackVec3[i20]; + _this20.stackVec3[i20] = null; + } + _this20.stackVec3 = newArray16; + } + _this20.stackVec3[_this20.sizeVec3++] = v12; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this20.sizeMat3 == _this20.stackMat3.length) { + var newLength17 = _this20.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g40 = 0; + var _g118 = _this20.sizeMat3; + while(_g40 < _g118) { + var i21 = _g40++; + newArray17[i21] = _this20.stackMat3[i21]; + _this20.stackMat3[i21] = null; + } + _this20.stackMat3 = newArray17; + } + _this20.stackMat3[_this20.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this20.sizeMat4 == _this20.stackMat4.length) { + var newLength18 = _this20.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g41 = 0; + var _g119 = _this20.sizeMat4; + while(_g41 < _g119) { + var i22 = _g41++; + newArray18[i22] = _this20.stackMat4[i22]; + _this20.stackMat4[i22] = null; + } + _this20.stackMat4 = newArray18; + } + _this20.stackMat4[_this20.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx11 = 0; + var ty11 = 0; + var tz11 = 0; + var tw4 = 1; + quat4.x = tx11; + quat4.y = ty11; + quat4.z = tz11; + quat4.w = tw4; + if(_this20.sizeQuat == _this20.stackQuat.length) { + var newLength19 = _this20.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g42 = 0; + var _g120 = _this20.sizeQuat; + while(_g42 < _g120) { + var i23 = _g42++; + newArray19[i23] = _this20.stackQuat[i23]; + _this20.stackQuat[i23] = null; + } + _this20.stackQuat = newArray19; + } + _this20.stackQuat[_this20.sizeQuat++] = quat4; + } + var _this21 = this._pool; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(v13 != null) { + v13.zero(); + if(_this21.sizeVec3 == _this21.stackVec3.length) { + var newLength20 = _this21.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g43 = 0; + var _g121 = _this21.sizeVec3; + while(_g43 < _g121) { + var i24 = _g43++; + newArray20[i24] = _this21.stackVec3[i24]; + _this21.stackVec3[i24] = null; + } + _this21.stackVec3 = newArray20; + } + _this21.stackVec3[_this21.sizeVec3++] = v13; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this21.sizeMat3 == _this21.stackMat3.length) { + var newLength21 = _this21.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g44 = 0; + var _g122 = _this21.sizeMat3; + while(_g44 < _g122) { + var i25 = _g44++; + newArray21[i25] = _this21.stackMat3[i25]; + _this21.stackMat3[i25] = null; + } + _this21.stackMat3 = newArray21; + } + _this21.stackMat3[_this21.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this21.sizeMat4 == _this21.stackMat4.length) { + var newLength22 = _this21.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g45 = 0; + var _g123 = _this21.sizeMat4; + while(_g45 < _g123) { + var i26 = _g45++; + newArray22[i26] = _this21.stackMat4[i26]; + _this21.stackMat4[i26] = null; + } + _this21.stackMat4 = newArray22; + } + _this21.stackMat4[_this21.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx12 = 0; + var ty12 = 0; + var tz12 = 0; + var tw5 = 1; + quat5.x = tx12; + quat5.y = ty12; + quat5.z = tz12; + quat5.w = tw5; + if(_this21.sizeQuat == _this21.stackQuat.length) { + var newLength23 = _this21.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g46 = 0; + var _g124 = _this21.sizeQuat; + while(_g46 < _g124) { + var i27 = _g46++; + newArray23[i27] = _this21.stackQuat[i27]; + _this21.stackQuat[i27] = null; + } + _this21.stackQuat = newArray23; + } + _this21.stackQuat[_this21.sizeQuat++] = quat5; + } + var _this22 = this._pool; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(normal != null) { + normal.zero(); + if(_this22.sizeVec3 == _this22.stackVec3.length) { + var newLength24 = _this22.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g47 = 0; + var _g125 = _this22.sizeVec3; + while(_g47 < _g125) { + var i28 = _g47++; + newArray24[i28] = _this22.stackVec3[i28]; + _this22.stackVec3[i28] = null; + } + _this22.stackVec3 = newArray24; + } + _this22.stackVec3[_this22.sizeVec3++] = normal; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this22.sizeMat3 == _this22.stackMat3.length) { + var newLength25 = _this22.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g48 = 0; + var _g126 = _this22.sizeMat3; + while(_g48 < _g126) { + var i29 = _g48++; + newArray25[i29] = _this22.stackMat3[i29]; + _this22.stackMat3[i29] = null; + } + _this22.stackMat3 = newArray25; + } + _this22.stackMat3[_this22.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this22.sizeMat4 == _this22.stackMat4.length) { + var newLength26 = _this22.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g49 = 0; + var _g127 = _this22.sizeMat4; + while(_g49 < _g127) { + var i30 = _g49++; + newArray26[i30] = _this22.stackMat4[i30]; + _this22.stackMat4[i30] = null; + } + _this22.stackMat4 = newArray26; + } + _this22.stackMat4[_this22.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx13 = 0; + var ty13 = 0; + var tz13 = 0; + var tw6 = 1; + quat6.x = tx13; + quat6.y = ty13; + quat6.z = tz13; + quat6.w = tw6; + if(_this22.sizeQuat == _this22.stackQuat.length) { + var newLength27 = _this22.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g50 = 0; + var _g128 = _this22.sizeQuat; + while(_g50 < _g128) { + var i31 = _g50++; + newArray27[i31] = _this22.stackQuat[i31]; + _this22.stackQuat[i31] = null; + } + _this22.stackQuat = newArray27; + } + _this22.stackQuat[_this22.sizeQuat++] = quat6; + } + var _this23 = this._pool; + var vec3 = null; + var mat47 = null; + var quat7 = null; + if(vec3 != null) { + vec3.zero(); + if(_this23.sizeVec3 == _this23.stackVec3.length) { + var newLength28 = _this23.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g51 = 0; + var _g129 = _this23.sizeVec3; + while(_g51 < _g129) { + var i32 = _g51++; + newArray28[i32] = _this23.stackVec3[i32]; + _this23.stackVec3[i32] = null; + } + _this23.stackVec3 = newArray28; + } + _this23.stackVec3[_this23.sizeVec3++] = vec3; + } + if(m != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + m.e00 = t0014; + m.e01 = t0114; + m.e02 = t0214; + m.e10 = t1014; + m.e11 = t1114; + m.e12 = t1214; + m.e20 = t2014; + m.e21 = t2114; + m.e22 = t2214; + if(_this23.sizeMat3 == _this23.stackMat3.length) { + var newLength29 = _this23.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g52 = 0; + var _g130 = _this23.sizeMat3; + while(_g52 < _g130) { + var i33 = _g52++; + newArray29[i33] = _this23.stackMat3[i33]; + _this23.stackMat3[i33] = null; + } + _this23.stackMat3 = newArray29; + } + _this23.stackMat3[_this23.sizeMat3++] = m; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this23.sizeMat4 == _this23.stackMat4.length) { + var newLength30 = _this23.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g53 = 0; + var _g131 = _this23.sizeMat4; + while(_g53 < _g131) { + var i34 = _g53++; + newArray30[i34] = _this23.stackMat4[i34]; + _this23.stackMat4[i34] = null; + } + _this23.stackMat4 = newArray30; + } + _this23.stackMat4[_this23.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx14 = 0; + var ty14 = 0; + var tz14 = 0; + var tw7 = 1; + quat7.x = tx14; + quat7.y = ty14; + quat7.z = tz14; + quat7.w = tw7; + if(_this23.sizeQuat == _this23.stackQuat.length) { + var newLength31 = _this23.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g54 = 0; + var _g132 = _this23.sizeQuat; + while(_g54 < _g132) { + var i35 = _g54++; + newArray31[i35] = _this23.stackQuat[i35]; + _this23.stackQuat[i35] = null; + } + _this23.stackQuat = newArray31; + } + _this23.stackQuat[_this23.sizeQuat++] = quat7; + } + var _this24 = this._pool; + var mat37 = null; + var mat48 = null; + var quat8 = null; + if(o != null) { + o.zero(); + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newLength32 = _this24.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g55 = 0; + var _g133 = _this24.sizeVec3; + while(_g55 < _g133) { + var i36 = _g55++; + newArray32[i36] = _this24.stackVec3[i36]; + _this24.stackVec3[i36] = null; + } + _this24.stackVec3 = newArray32; + } + _this24.stackVec3[_this24.sizeVec3++] = o; + } + if(mat37 != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + mat37.e00 = t0016; + mat37.e01 = t0116; + mat37.e02 = t0216; + mat37.e10 = t1016; + mat37.e11 = t1116; + mat37.e12 = t1216; + mat37.e20 = t2016; + mat37.e21 = t2116; + mat37.e22 = t2216; + if(_this24.sizeMat3 == _this24.stackMat3.length) { + var newLength33 = _this24.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g56 = 0; + var _g134 = _this24.sizeMat3; + while(_g56 < _g134) { + var i37 = _g56++; + newArray33[i37] = _this24.stackMat3[i37]; + _this24.stackMat3[i37] = null; + } + _this24.stackMat3 = newArray33; + } + _this24.stackMat3[_this24.sizeMat3++] = mat37; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this24.sizeMat4 == _this24.stackMat4.length) { + var newLength34 = _this24.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g57 = 0; + var _g135 = _this24.sizeMat4; + while(_g57 < _g135) { + var i38 = _g57++; + newArray34[i38] = _this24.stackMat4[i38]; + _this24.stackMat4[i38] = null; + } + _this24.stackMat4 = newArray34; + } + _this24.stackMat4[_this24.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx15 = 0; + var ty15 = 0; + var tz15 = 0; + var tw8 = 1; + quat8.x = tx15; + quat8.y = ty15; + quat8.z = tz15; + quat8.w = tw8; + if(_this24.sizeQuat == _this24.stackQuat.length) { + var newLength35 = _this24.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g58 = 0; + var _g136 = _this24.sizeQuat; + while(_g58 < _g136) { + var i39 = _g58++; + newArray35[i39] = _this24.stackQuat[i39]; + _this24.stackQuat[i39] = null; + } + _this24.stackQuat = newArray35; + } + _this24.stackQuat[_this24.sizeQuat++] = quat8; + } + break; + } + } + if(d.drawAabbs) { + var aabb = s._aabb; + var color = style.aabbColor; + var _this25 = this._pool; + var min = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; + var _this26 = this._pool; + var max = _this26.sizeVec3 == 0 ? new oimo.common.Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + var v15 = min; + v15.x = aabb._minX; + v15.y = aabb._minY; + v15.z = aabb._minZ; + var v16 = max; + v16.x = aabb._maxX; + v16.y = aabb._maxY; + v16.z = aabb._maxZ; + d.aabb(min,max,color); + var _this27 = this._pool; + var mat38 = null; + var mat49 = null; + var quat9 = null; + if(min != null) { + min.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + var newLength36 = _this27.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g59 = 0; + var _g137 = _this27.sizeVec3; + while(_g59 < _g137) { + var i40 = _g59++; + newArray36[i40] = _this27.stackVec3[i40]; + _this27.stackVec3[i40] = null; + } + _this27.stackVec3 = newArray36; + } + _this27.stackVec3[_this27.sizeVec3++] = min; + } + if(mat38 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat38.e00 = t0018; + mat38.e01 = t0118; + mat38.e02 = t0218; + mat38.e10 = t1018; + mat38.e11 = t1118; + mat38.e12 = t1218; + mat38.e20 = t2018; + mat38.e21 = t2118; + mat38.e22 = t2218; + if(_this27.sizeMat3 == _this27.stackMat3.length) { + var newLength37 = _this27.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g60 = 0; + var _g138 = _this27.sizeMat3; + while(_g60 < _g138) { + var i41 = _g60++; + newArray37[i41] = _this27.stackMat3[i41]; + _this27.stackMat3[i41] = null; + } + _this27.stackMat3 = newArray37; + } + _this27.stackMat3[_this27.sizeMat3++] = mat38; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this27.sizeMat4 == _this27.stackMat4.length) { + var newLength38 = _this27.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g61 = 0; + var _g139 = _this27.sizeMat4; + while(_g61 < _g139) { + var i42 = _g61++; + newArray38[i42] = _this27.stackMat4[i42]; + _this27.stackMat4[i42] = null; + } + _this27.stackMat4 = newArray38; + } + _this27.stackMat4[_this27.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx16 = 0; + var ty16 = 0; + var tz16 = 0; + var tw9 = 1; + quat9.x = tx16; + quat9.y = ty16; + quat9.z = tz16; + quat9.w = tw9; + if(_this27.sizeQuat == _this27.stackQuat.length) { + var newLength39 = _this27.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g62 = 0; + var _g140 = _this27.sizeQuat; + while(_g62 < _g140) { + var i43 = _g62++; + newArray39[i43] = _this27.stackQuat[i43]; + _this27.stackQuat[i43] = null; + } + _this27.stackQuat = newArray39; + } + _this27.stackQuat[_this27.sizeQuat++] = quat9; + } + var _this28 = this._pool; + var mat39 = null; + var mat410 = null; + var quat10 = null; + if(max != null) { + max.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + var newLength40 = _this28.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g63 = 0; + var _g141 = _this28.sizeVec3; + while(_g63 < _g141) { + var i44 = _g63++; + newArray40[i44] = _this28.stackVec3[i44]; + _this28.stackVec3[i44] = null; + } + _this28.stackVec3 = newArray40; + } + _this28.stackVec3[_this28.sizeVec3++] = max; + } + if(mat39 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat39.e00 = t0020; + mat39.e01 = t0120; + mat39.e02 = t0220; + mat39.e10 = t1020; + mat39.e11 = t1120; + mat39.e12 = t1220; + mat39.e20 = t2020; + mat39.e21 = t2120; + mat39.e22 = t2220; + if(_this28.sizeMat3 == _this28.stackMat3.length) { + var newLength41 = _this28.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g64 = 0; + var _g142 = _this28.sizeMat3; + while(_g64 < _g142) { + var i45 = _g64++; + newArray41[i45] = _this28.stackMat3[i45]; + _this28.stackMat3[i45] = null; + } + _this28.stackMat3 = newArray41; + } + _this28.stackMat3[_this28.sizeMat3++] = mat39; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this28.sizeMat4 == _this28.stackMat4.length) { + var newLength42 = _this28.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g65 = 0; + var _g143 = _this28.sizeMat4; + while(_g65 < _g143) { + var i46 = _g65++; + newArray42[i46] = _this28.stackMat4[i46]; + _this28.stackMat4[i46] = null; + } + _this28.stackMat4 = newArray42; + } + _this28.stackMat4[_this28.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx17 = 0; + var ty17 = 0; + var tz17 = 0; + var tw10 = 1; + quat10.x = tx17; + quat10.y = ty17; + quat10.z = tz17; + quat10.w = tw10; + if(_this28.sizeQuat == _this28.stackQuat.length) { + var newLength43 = _this28.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g66 = 0; + var _g144 = _this28.sizeQuat; + while(_g66 < _g144) { + var i47 = _g66++; + newArray43[i47] = _this28.stackQuat[i47]; + _this28.stackQuat[i47] = null; + } + _this28.stackQuat = newArray43; + } + _this28.stackQuat[_this28.sizeQuat++] = quat10; + } + } + s = n1; + } + r = n; + } + } + _drawConstraints(d) { + var style = d.style; + if(d.drawPairs || d.drawContacts) { + var c = this._contactManager._contactList; + while(c != null) { + var n = c._next; + if(d.drawPairs) { + var color = style.pairColor; + var _this = this._pool; + var v1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var v2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var v = v1; + v.x = c._s1._transform._positionX; + v.y = c._s1._transform._positionY; + v.z = c._s1._transform._positionZ; + var v3 = v2; + v3.x = c._s2._transform._positionX; + v3.y = c._s2._transform._positionY; + v3.z = c._s2._transform._positionZ; + d.line(v1,v2,color); + var _this2 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(v1 != null) { + v1.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newLength = _this2.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = v1; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this2.sizeMat3 == _this2.stackMat3.length) { + var newLength1 = _this2.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this2.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this2.stackMat3[i1]; + _this2.stackMat3[i1] = null; + } + _this2.stackMat3 = newArray1; + } + _this2.stackMat3[_this2.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this2.sizeMat4 == _this2.stackMat4.length) { + var newLength2 = _this2.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this2.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this2.stackMat4[i2]; + _this2.stackMat4[i2] = null; + } + _this2.stackMat4 = newArray2; + } + _this2.stackMat4[_this2.sizeMat4++] = mat4; + } + if(quat != null) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + quat.x = tx; + quat.y = ty; + quat.z = tz; + quat.w = tw; + if(_this2.sizeQuat == _this2.stackQuat.length) { + var newLength3 = _this2.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this2.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this2.stackQuat[i3]; + _this2.stackQuat[i3] = null; + } + _this2.stackQuat = newArray3; + } + _this2.stackQuat[_this2.sizeQuat++] = quat; + } + var _this3 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(v2 != null) { + v2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newLength4 = _this3.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this3.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this3.stackVec3[i4]; + _this3.stackVec3[i4] = null; + } + _this3.stackVec3 = newArray4; + } + _this3.stackVec3[_this3.sizeVec3++] = v2; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this3.sizeMat3 == _this3.stackMat3.length) { + var newLength5 = _this3.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this3.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this3.stackMat3[i5]; + _this3.stackMat3[i5] = null; + } + _this3.stackMat3 = newArray5; + } + _this3.stackMat3[_this3.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this3.sizeMat4 == _this3.stackMat4.length) { + var newLength6 = _this3.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this3.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this3.stackMat4[i6]; + _this3.stackMat4[i6] = null; + } + _this3.stackMat4 = newArray6; + } + _this3.stackMat4[_this3.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx1 = 0; + var ty1 = 0; + var tz1 = 0; + var tw1 = 1; + quat1.x = tx1; + quat1.y = ty1; + quat1.z = tz1; + quat1.w = tw1; + if(_this3.sizeQuat == _this3.stackQuat.length) { + var newLength7 = _this3.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this3.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this3.stackQuat[i7]; + _this3.stackQuat[i7] = null; + } + _this3.stackQuat = newArray7; + } + _this3.stackQuat[_this3.sizeQuat++] = quat1; + } + } + if(d.drawContacts) { + var cc = c._contactConstraint; + var ps = c._contactConstraint._manifold._points; + var _g9 = 0; + var _g18 = c._contactConstraint._manifold._numPoints; + while(_g9 < _g18) { + var i8 = _g9++; + var p = ps[i8]; + var style1 = d.style; + var tf1 = cc._s1._transform; + var tf2 = cc._s2._transform; + var _this4 = this._pool; + var pos1 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this5 = this._pool; + var pos2 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + var _this6 = this._pool; + var normal = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var _this7 = this._pool; + var tangent = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + var _this8 = this._pool; + var binormal = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + var v4 = pos1; + v4.x = p._pos1X; + v4.y = p._pos1Y; + v4.z = p._pos1Z; + var v5 = pos2; + v5.x = p._pos2X; + v5.y = p._pos2Y; + v5.z = p._pos2Z; + var v6 = normal; + v6.x = cc._manifold._normalX; + v6.y = cc._manifold._normalY; + v6.z = cc._manifold._normalZ; + var v7 = tangent; + v7.x = cc._manifold._tangentX; + v7.y = cc._manifold._tangentY; + v7.z = cc._manifold._tangentZ; + var v8 = binormal; + v8.x = cc._manifold._binormalX; + v8.y = cc._manifold._binormalY; + v8.z = cc._manifold._binormalZ; + if(p._disabled) { + d.point(pos1,style1.disabledContactColor); + d.point(pos2,style1.disabledContactColor); + d.line(pos1,pos2,style1.disabledContactColor); + } else if(p._warmStarted) { + var color1; + switch(p._id & 3) { + case 0: + color1 = style1.contactColor; + break; + case 1: + color1 = style1.contactColor2; + break; + case 2: + color1 = style1.contactColor3; + break; + default: + color1 = style1.contactColor4; + } + d.point(pos1,color1); + d.point(pos2,color1); + d.line(pos1,pos2,style1.contactColor); + } else { + d.point(pos1,style1.newContactColor); + d.point(pos2,style1.newContactColor); + d.line(pos1,pos2,style1.newContactColor); + } + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this9 = pos2; + var s = style1.contactNormalLength; + var tx2 = _this9.x + normal.x * s; + var ty2 = _this9.y + normal.y * s; + var tz2 = _this9.z + normal.z * s; + _this9.x = tx2; + _this9.y = ty2; + _this9.z = tz2; + d.line(pos1,pos2,style1.contactNormalColor); + if(d.drawContactBases) { + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this10 = pos2; + var s1 = style1.contactTangentLength; + var tx3 = _this10.x + tangent.x * s1; + var ty3 = _this10.y + tangent.y * s1; + var tz3 = _this10.z + tangent.z * s1; + _this10.x = tx3; + _this10.y = ty3; + _this10.z = tz3; + d.line(pos1,pos2,style1.contactTangentColor); + pos2.x = pos1.x; + pos2.y = pos1.y; + pos2.z = pos1.z; + var _this11 = pos2; + var s2 = style1.contactBinormalLength; + var tx4 = _this11.x + binormal.x * s2; + var ty4 = _this11.y + binormal.y * s2; + var tz4 = _this11.z + binormal.z * s2; + _this11.x = tx4; + _this11.y = ty4; + _this11.z = tz4; + d.line(pos1,pos2,style1.contactBinormalColor); + } + var _this12 = this._pool; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(pos1 != null) { + pos1.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newLength8 = _this12.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g10 = 0; + var _g19 = _this12.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray8[i9] = _this12.stackVec3[i9]; + _this12.stackVec3[i9] = null; + } + _this12.stackVec3 = newArray8; + } + _this12.stackVec3[_this12.sizeVec3++] = pos1; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this12.sizeMat3 == _this12.stackMat3.length) { + var newLength9 = _this12.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g20 = 0; + var _g110 = _this12.sizeMat3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray9[i10] = _this12.stackMat3[i10]; + _this12.stackMat3[i10] = null; + } + _this12.stackMat3 = newArray9; + } + _this12.stackMat3[_this12.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this12.sizeMat4 == _this12.stackMat4.length) { + var newLength10 = _this12.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g21 = 0; + var _g111 = _this12.sizeMat4; + while(_g21 < _g111) { + var i11 = _g21++; + newArray10[i11] = _this12.stackMat4[i11]; + _this12.stackMat4[i11] = null; + } + _this12.stackMat4 = newArray10; + } + _this12.stackMat4[_this12.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx5 = 0; + var ty5 = 0; + var tz5 = 0; + var tw2 = 1; + quat2.x = tx5; + quat2.y = ty5; + quat2.z = tz5; + quat2.w = tw2; + if(_this12.sizeQuat == _this12.stackQuat.length) { + var newLength11 = _this12.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g22 = 0; + var _g112 = _this12.sizeQuat; + while(_g22 < _g112) { + var i12 = _g22++; + newArray11[i12] = _this12.stackQuat[i12]; + _this12.stackQuat[i12] = null; + } + _this12.stackQuat = newArray11; + } + _this12.stackQuat[_this12.sizeQuat++] = quat2; + } + var _this13 = this._pool; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(pos2 != null) { + pos2.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newLength12 = _this13.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g23 = 0; + var _g113 = _this13.sizeVec3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray12[i13] = _this13.stackVec3[i13]; + _this13.stackVec3[i13] = null; + } + _this13.stackVec3 = newArray12; + } + _this13.stackVec3[_this13.sizeVec3++] = pos2; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this13.sizeMat3 == _this13.stackMat3.length) { + var newLength13 = _this13.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g24 = 0; + var _g114 = _this13.sizeMat3; + while(_g24 < _g114) { + var i14 = _g24++; + newArray13[i14] = _this13.stackMat3[i14]; + _this13.stackMat3[i14] = null; + } + _this13.stackMat3 = newArray13; + } + _this13.stackMat3[_this13.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this13.sizeMat4 == _this13.stackMat4.length) { + var newLength14 = _this13.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g25 = 0; + var _g115 = _this13.sizeMat4; + while(_g25 < _g115) { + var i15 = _g25++; + newArray14[i15] = _this13.stackMat4[i15]; + _this13.stackMat4[i15] = null; + } + _this13.stackMat4 = newArray14; + } + _this13.stackMat4[_this13.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx6 = 0; + var ty6 = 0; + var tz6 = 0; + var tw3 = 1; + quat3.x = tx6; + quat3.y = ty6; + quat3.z = tz6; + quat3.w = tw3; + if(_this13.sizeQuat == _this13.stackQuat.length) { + var newLength15 = _this13.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g26 = 0; + var _g116 = _this13.sizeQuat; + while(_g26 < _g116) { + var i16 = _g26++; + newArray15[i16] = _this13.stackQuat[i16]; + _this13.stackQuat[i16] = null; + } + _this13.stackQuat = newArray15; + } + _this13.stackQuat[_this13.sizeQuat++] = quat3; + } + var _this14 = this._pool; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(normal != null) { + normal.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newLength16 = _this14.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g27 = 0; + var _g117 = _this14.sizeVec3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray16[i17] = _this14.stackVec3[i17]; + _this14.stackVec3[i17] = null; + } + _this14.stackVec3 = newArray16; + } + _this14.stackVec3[_this14.sizeVec3++] = normal; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + var newLength17 = _this14.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g28 = 0; + var _g118 = _this14.sizeMat3; + while(_g28 < _g118) { + var i18 = _g28++; + newArray17[i18] = _this14.stackMat3[i18]; + _this14.stackMat3[i18] = null; + } + _this14.stackMat3 = newArray17; + } + _this14.stackMat3[_this14.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this14.sizeMat4 == _this14.stackMat4.length) { + var newLength18 = _this14.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g29 = 0; + var _g119 = _this14.sizeMat4; + while(_g29 < _g119) { + var i19 = _g29++; + newArray18[i19] = _this14.stackMat4[i19]; + _this14.stackMat4[i19] = null; + } + _this14.stackMat4 = newArray18; + } + _this14.stackMat4[_this14.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx7 = 0; + var ty7 = 0; + var tz7 = 0; + var tw4 = 1; + quat4.x = tx7; + quat4.y = ty7; + quat4.z = tz7; + quat4.w = tw4; + if(_this14.sizeQuat == _this14.stackQuat.length) { + var newLength19 = _this14.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g30 = 0; + var _g120 = _this14.sizeQuat; + while(_g30 < _g120) { + var i20 = _g30++; + newArray19[i20] = _this14.stackQuat[i20]; + _this14.stackQuat[i20] = null; + } + _this14.stackQuat = newArray19; + } + _this14.stackQuat[_this14.sizeQuat++] = quat4; + } + var _this15 = this._pool; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(tangent != null) { + tangent.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newLength20 = _this15.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g31 = 0; + var _g121 = _this15.sizeVec3; + while(_g31 < _g121) { + var i21 = _g31++; + newArray20[i21] = _this15.stackVec3[i21]; + _this15.stackVec3[i21] = null; + } + _this15.stackVec3 = newArray20; + } + _this15.stackVec3[_this15.sizeVec3++] = tangent; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this15.sizeMat3 == _this15.stackMat3.length) { + var newLength21 = _this15.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g32 = 0; + var _g122 = _this15.sizeMat3; + while(_g32 < _g122) { + var i22 = _g32++; + newArray21[i22] = _this15.stackMat3[i22]; + _this15.stackMat3[i22] = null; + } + _this15.stackMat3 = newArray21; + } + _this15.stackMat3[_this15.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this15.sizeMat4 == _this15.stackMat4.length) { + var newLength22 = _this15.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g33 = 0; + var _g123 = _this15.sizeMat4; + while(_g33 < _g123) { + var i23 = _g33++; + newArray22[i23] = _this15.stackMat4[i23]; + _this15.stackMat4[i23] = null; + } + _this15.stackMat4 = newArray22; + } + _this15.stackMat4[_this15.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx8 = 0; + var ty8 = 0; + var tz8 = 0; + var tw5 = 1; + quat5.x = tx8; + quat5.y = ty8; + quat5.z = tz8; + quat5.w = tw5; + if(_this15.sizeQuat == _this15.stackQuat.length) { + var newLength23 = _this15.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g34 = 0; + var _g124 = _this15.sizeQuat; + while(_g34 < _g124) { + var i24 = _g34++; + newArray23[i24] = _this15.stackQuat[i24]; + _this15.stackQuat[i24] = null; + } + _this15.stackQuat = newArray23; + } + _this15.stackQuat[_this15.sizeQuat++] = quat5; + } + var _this16 = this._pool; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(binormal != null) { + binormal.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + var newLength24 = _this16.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g35 = 0; + var _g125 = _this16.sizeVec3; + while(_g35 < _g125) { + var i25 = _g35++; + newArray24[i25] = _this16.stackVec3[i25]; + _this16.stackVec3[i25] = null; + } + _this16.stackVec3 = newArray24; + } + _this16.stackVec3[_this16.sizeVec3++] = binormal; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this16.sizeMat3 == _this16.stackMat3.length) { + var newLength25 = _this16.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g36 = 0; + var _g126 = _this16.sizeMat3; + while(_g36 < _g126) { + var i26 = _g36++; + newArray25[i26] = _this16.stackMat3[i26]; + _this16.stackMat3[i26] = null; + } + _this16.stackMat3 = newArray25; + } + _this16.stackMat3[_this16.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this16.sizeMat4 == _this16.stackMat4.length) { + var newLength26 = _this16.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g37 = 0; + var _g127 = _this16.sizeMat4; + while(_g37 < _g127) { + var i27 = _g37++; + newArray26[i27] = _this16.stackMat4[i27]; + _this16.stackMat4[i27] = null; + } + _this16.stackMat4 = newArray26; + } + _this16.stackMat4[_this16.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx9 = 0; + var ty9 = 0; + var tz9 = 0; + var tw6 = 1; + quat6.x = tx9; + quat6.y = ty9; + quat6.z = tz9; + quat6.w = tw6; + if(_this16.sizeQuat == _this16.stackQuat.length) { + var newLength27 = _this16.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g38 = 0; + var _g128 = _this16.sizeQuat; + while(_g38 < _g128) { + var i28 = _g38++; + newArray27[i28] = _this16.stackQuat[i28]; + _this16.stackQuat[i28] = null; + } + _this16.stackQuat = newArray27; + } + _this16.stackQuat[_this16.sizeQuat++] = quat6; + } + } + } + c = n; + } + } + if(d.drawJoints) { + var j = this._jointList; + while(j != null) { + var n1 = j._next; + var _this17 = this._pool; + var p1 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + var _this18 = this._pool; + var p2 = _this18.sizeVec3 == 0 ? new oimo.common.Vec3() : _this18.stackVec3[--_this18.sizeVec3]; + var v9 = p1; + v9.x = j._b1._transform._positionX; + v9.y = j._b1._transform._positionY; + v9.z = j._b1._transform._positionZ; + var v10 = p2; + v10.x = j._b2._transform._positionX; + v10.y = j._b2._transform._positionY; + v10.z = j._b2._transform._positionZ; + var _this19 = this._pool; + var anchor1 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; + var _this20 = this._pool; + var anchor2 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + var _this21 = this._pool; + var basisX1 = _this21.sizeVec3 == 0 ? new oimo.common.Vec3() : _this21.stackVec3[--_this21.sizeVec3]; + var _this22 = this._pool; + var basisY1 = _this22.sizeVec3 == 0 ? new oimo.common.Vec3() : _this22.stackVec3[--_this22.sizeVec3]; + var _this23 = this._pool; + var basisZ1 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + var _this24 = this._pool; + var basisX2 = _this24.sizeVec3 == 0 ? new oimo.common.Vec3() : _this24.stackVec3[--_this24.sizeVec3]; + var _this25 = this._pool; + var basisY2 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; + var _this26 = this._pool; + var basisZ2 = _this26.sizeVec3 == 0 ? new oimo.common.Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + var v11 = anchor1; + v11.x = j._anchor1X; + v11.y = j._anchor1Y; + v11.z = j._anchor1Z; + var v12 = anchor2; + v12.x = j._anchor2X; + v12.y = j._anchor2Y; + v12.z = j._anchor2Z; + var v13 = basisX1; + v13.x = j._basisX1X; + v13.y = j._basisX1Y; + v13.z = j._basisX1Z; + var v14 = basisY1; + v14.x = j._basisY1X; + v14.y = j._basisY1Y; + v14.z = j._basisY1Z; + var v15 = basisZ1; + v15.x = j._basisZ1X; + v15.y = j._basisZ1Y; + v15.z = j._basisZ1Z; + var v16 = basisX2; + v16.x = j._basisX2X; + v16.y = j._basisX2Y; + v16.z = j._basisX2Z; + var v17 = basisY2; + v17.x = j._basisY2X; + v17.y = j._basisY2Y; + v17.z = j._basisY2Z; + var v18 = basisZ2; + v18.x = j._basisZ2X; + v18.y = j._basisZ2Y; + v18.z = j._basisZ2Z; + d.line(p1,anchor1,d.style.jointLineColor); + d.line(p2,anchor2,d.style.jointLineColor); + if(d.drawJointLimits) { + switch(j._type) { + case 0: + break; + case 1: + var radius = d.style.jointRotationalConstraintRadius; + var color2 = d.style.jointLineColor; + var lm = j._lm; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,radius,lm.lowerLimit,lm.upperLimit,color2); + break; + case 2: + var j1 = j; + var radius1 = d.style.jointRotationalConstraintRadius; + var color3 = d.style.jointLineColor; + var rlm = j1._rotLm; + var tlm = j1._translLm; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,radius1,rlm.lowerLimit,rlm.upperLimit,color3); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color3); + break; + case 3: + var radius2 = d.style.jointRotationalConstraintRadius; + var color4 = d.style.jointLineColor; + var lm1 = j._lm; + this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,color4); + break; + case 4: + var j2 = j; + var radius3 = d.style.jointRotationalConstraintRadius; + var color5 = d.style.jointLineColor; + var lm11 = j2._lm1; + var lm2 = j2._lm2; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius3,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color5); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius3,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color5); + break; + case 5: + var j3 = j; + var radius4 = d.style.jointRotationalConstraintRadius; + var color6 = d.style.jointLineColor; + var lm3 = j3._twistLm; + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius4,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color6); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius4,color6); + var _this27 = this._pool; + var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; + _this28.x = anchor2.x; + _this28.y = anchor2.y; + _this28.z = anchor2.z; + var _this29 = _this28; + var tx10 = _this29.x + basisX2.x * radius4; + var ty10 = _this29.y + basisX2.y * radius4; + var tz10 = _this29.z + basisX2.z * radius4; + _this29.x = tx10; + _this29.y = ty10; + _this29.z = tz10; + var to = _this29; + d.line(anchor2,to,color6); + var _this30 = this._pool; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(to != null) { + to.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + var newLength28 = _this30.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g39 = 0; + var _g129 = _this30.sizeVec3; + while(_g39 < _g129) { + var i29 = _g39++; + newArray28[i29] = _this30.stackVec3[i29]; + _this30.stackVec3[i29] = null; + } + _this30.stackVec3 = newArray28; + } + _this30.stackVec3[_this30.sizeVec3++] = to; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this30.sizeMat3 == _this30.stackMat3.length) { + var newLength29 = _this30.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g40 = 0; + var _g130 = _this30.sizeMat3; + while(_g40 < _g130) { + var i30 = _g40++; + newArray29[i30] = _this30.stackMat3[i30]; + _this30.stackMat3[i30] = null; + } + _this30.stackMat3 = newArray29; + } + _this30.stackMat3[_this30.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this30.sizeMat4 == _this30.stackMat4.length) { + var newLength30 = _this30.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g41 = 0; + var _g131 = _this30.sizeMat4; + while(_g41 < _g131) { + var i31 = _g41++; + newArray30[i31] = _this30.stackMat4[i31]; + _this30.stackMat4[i31] = null; + } + _this30.stackMat4 = newArray30; + } + _this30.stackMat4[_this30.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx11 = 0; + var ty11 = 0; + var tz11 = 0; + var tw7 = 1; + quat7.x = tx11; + quat7.y = ty11; + quat7.z = tz11; + quat7.w = tw7; + if(_this30.sizeQuat == _this30.stackQuat.length) { + var newLength31 = _this30.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g42 = 0; + var _g132 = _this30.sizeQuat; + while(_g42 < _g132) { + var i32 = _g42++; + newArray31[i32] = _this30.stackQuat[i32]; + _this30.stackQuat[i32] = null; + } + _this30.stackQuat = newArray31; + } + _this30.stackQuat[_this30.sizeQuat++] = quat7; + } + break; + case 6: + var j4 = j; + var radius5 = d.style.jointRotationalConstraintRadius; + var color7 = d.style.jointLineColor; + var txlm = j4._translLms[0]; + var tylm = j4._translLms[1]; + var tzlm = j4._translLms[2]; + var rxlm = j4._rotLms[0]; + var rylm = j4._rotLms[1]; + var rzlm = j4._rotLms[2]; + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,txlm,tylm,tzlm,color7); + var _this31 = this._pool; + var rotYAxis = _this31.sizeVec3 == 0 ? new oimo.common.Vec3() : _this31.stackVec3[--_this31.sizeVec3]; + var v19 = rotYAxis; + v19.x = j4._axisYX; + v19.y = j4._axisYY; + v19.z = j4._axisYZ; + var _this32 = this._pool; + var _this33 = _this32.sizeVec3 == 0 ? new oimo.common.Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = basisX1.x; + _this33.y = basisX1.y; + _this33.z = basisX1.z; + var rotYBasisX = _this33; + var _this34 = this._pool; + var _this35 = _this34.sizeVec3 == 0 ? new oimo.common.Vec3() : _this34.stackVec3[--_this34.sizeVec3]; + _this35.x = basisX1.x; + _this35.y = basisX1.y; + _this35.z = basisX1.z; + var _this36 = _this35; + var tx12 = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; + var ty12 = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; + var tz12 = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; + _this36.x = tx12; + _this36.y = ty12; + _this36.z = tz12; + var rotYBasisY = _this36; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius5,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color7); + this._drawRotationalLimit(d,anchor2,rotYBasisX,rotYBasisY,rotYBasisX,radius5,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color7); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius5,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color7); + break; + } + } + d.line(anchor1,anchor2,d.style.jointErrorColor); + var _this37 = this._pool; + var mat38 = null; + var mat48 = null; + var quat8 = null; + if(p1 != null) { + p1.zero(); + if(_this37.sizeVec3 == _this37.stackVec3.length) { + var newLength32 = _this37.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g43 = 0; + var _g133 = _this37.sizeVec3; + while(_g43 < _g133) { + var i33 = _g43++; + newArray32[i33] = _this37.stackVec3[i33]; + _this37.stackVec3[i33] = null; + } + _this37.stackVec3 = newArray32; + } + _this37.stackVec3[_this37.sizeVec3++] = p1; + } + if(mat38 != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + mat38.e00 = t0016; + mat38.e01 = t0116; + mat38.e02 = t0216; + mat38.e10 = t1016; + mat38.e11 = t1116; + mat38.e12 = t1216; + mat38.e20 = t2016; + mat38.e21 = t2116; + mat38.e22 = t2216; + if(_this37.sizeMat3 == _this37.stackMat3.length) { + var newLength33 = _this37.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g44 = 0; + var _g134 = _this37.sizeMat3; + while(_g44 < _g134) { + var i34 = _g44++; + newArray33[i34] = _this37.stackMat3[i34]; + _this37.stackMat3[i34] = null; + } + _this37.stackMat3 = newArray33; + } + _this37.stackMat3[_this37.sizeMat3++] = mat38; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this37.sizeMat4 == _this37.stackMat4.length) { + var newLength34 = _this37.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g45 = 0; + var _g135 = _this37.sizeMat4; + while(_g45 < _g135) { + var i35 = _g45++; + newArray34[i35] = _this37.stackMat4[i35]; + _this37.stackMat4[i35] = null; + } + _this37.stackMat4 = newArray34; + } + _this37.stackMat4[_this37.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx13 = 0; + var ty13 = 0; + var tz13 = 0; + var tw8 = 1; + quat8.x = tx13; + quat8.y = ty13; + quat8.z = tz13; + quat8.w = tw8; + if(_this37.sizeQuat == _this37.stackQuat.length) { + var newLength35 = _this37.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g46 = 0; + var _g136 = _this37.sizeQuat; + while(_g46 < _g136) { + var i36 = _g46++; + newArray35[i36] = _this37.stackQuat[i36]; + _this37.stackQuat[i36] = null; + } + _this37.stackQuat = newArray35; + } + _this37.stackQuat[_this37.sizeQuat++] = quat8; + } + var _this38 = this._pool; + var mat39 = null; + var mat49 = null; + var quat9 = null; + if(p2 != null) { + p2.zero(); + if(_this38.sizeVec3 == _this38.stackVec3.length) { + var newLength36 = _this38.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g47 = 0; + var _g137 = _this38.sizeVec3; + while(_g47 < _g137) { + var i37 = _g47++; + newArray36[i37] = _this38.stackVec3[i37]; + _this38.stackVec3[i37] = null; + } + _this38.stackVec3 = newArray36; + } + _this38.stackVec3[_this38.sizeVec3++] = p2; + } + if(mat39 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat39.e00 = t0018; + mat39.e01 = t0118; + mat39.e02 = t0218; + mat39.e10 = t1018; + mat39.e11 = t1118; + mat39.e12 = t1218; + mat39.e20 = t2018; + mat39.e21 = t2118; + mat39.e22 = t2218; + if(_this38.sizeMat3 == _this38.stackMat3.length) { + var newLength37 = _this38.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g48 = 0; + var _g138 = _this38.sizeMat3; + while(_g48 < _g138) { + var i38 = _g48++; + newArray37[i38] = _this38.stackMat3[i38]; + _this38.stackMat3[i38] = null; + } + _this38.stackMat3 = newArray37; + } + _this38.stackMat3[_this38.sizeMat3++] = mat39; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this38.sizeMat4 == _this38.stackMat4.length) { + var newLength38 = _this38.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g49 = 0; + var _g139 = _this38.sizeMat4; + while(_g49 < _g139) { + var i39 = _g49++; + newArray38[i39] = _this38.stackMat4[i39]; + _this38.stackMat4[i39] = null; + } + _this38.stackMat4 = newArray38; + } + _this38.stackMat4[_this38.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx14 = 0; + var ty14 = 0; + var tz14 = 0; + var tw9 = 1; + quat9.x = tx14; + quat9.y = ty14; + quat9.z = tz14; + quat9.w = tw9; + if(_this38.sizeQuat == _this38.stackQuat.length) { + var newLength39 = _this38.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g50 = 0; + var _g140 = _this38.sizeQuat; + while(_g50 < _g140) { + var i40 = _g50++; + newArray39[i40] = _this38.stackQuat[i40]; + _this38.stackQuat[i40] = null; + } + _this38.stackQuat = newArray39; + } + _this38.stackQuat[_this38.sizeQuat++] = quat9; + } + var _this39 = this._pool; + var mat310 = null; + var mat410 = null; + var quat10 = null; + if(anchor1 != null) { + anchor1.zero(); + if(_this39.sizeVec3 == _this39.stackVec3.length) { + var newLength40 = _this39.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g51 = 0; + var _g141 = _this39.sizeVec3; + while(_g51 < _g141) { + var i41 = _g51++; + newArray40[i41] = _this39.stackVec3[i41]; + _this39.stackVec3[i41] = null; + } + _this39.stackVec3 = newArray40; + } + _this39.stackVec3[_this39.sizeVec3++] = anchor1; + } + if(mat310 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat310.e00 = t0020; + mat310.e01 = t0120; + mat310.e02 = t0220; + mat310.e10 = t1020; + mat310.e11 = t1120; + mat310.e12 = t1220; + mat310.e20 = t2020; + mat310.e21 = t2120; + mat310.e22 = t2220; + if(_this39.sizeMat3 == _this39.stackMat3.length) { + var newLength41 = _this39.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g52 = 0; + var _g142 = _this39.sizeMat3; + while(_g52 < _g142) { + var i42 = _g52++; + newArray41[i42] = _this39.stackMat3[i42]; + _this39.stackMat3[i42] = null; + } + _this39.stackMat3 = newArray41; + } + _this39.stackMat3[_this39.sizeMat3++] = mat310; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this39.sizeMat4 == _this39.stackMat4.length) { + var newLength42 = _this39.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g53 = 0; + var _g143 = _this39.sizeMat4; + while(_g53 < _g143) { + var i43 = _g53++; + newArray42[i43] = _this39.stackMat4[i43]; + _this39.stackMat4[i43] = null; + } + _this39.stackMat4 = newArray42; + } + _this39.stackMat4[_this39.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx15 = 0; + var ty15 = 0; + var tz15 = 0; + var tw10 = 1; + quat10.x = tx15; + quat10.y = ty15; + quat10.z = tz15; + quat10.w = tw10; + if(_this39.sizeQuat == _this39.stackQuat.length) { + var newLength43 = _this39.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g54 = 0; + var _g144 = _this39.sizeQuat; + while(_g54 < _g144) { + var i44 = _g54++; + newArray43[i44] = _this39.stackQuat[i44]; + _this39.stackQuat[i44] = null; + } + _this39.stackQuat = newArray43; + } + _this39.stackQuat[_this39.sizeQuat++] = quat10; + } + var _this40 = this._pool; + var mat311 = null; + var mat411 = null; + var quat11 = null; + if(anchor2 != null) { + anchor2.zero(); + if(_this40.sizeVec3 == _this40.stackVec3.length) { + var newLength44 = _this40.sizeVec3 << 1; + var this45 = new Array(newLength44); + var newArray44 = this45; + var _g55 = 0; + var _g145 = _this40.sizeVec3; + while(_g55 < _g145) { + var i45 = _g55++; + newArray44[i45] = _this40.stackVec3[i45]; + _this40.stackVec3[i45] = null; + } + _this40.stackVec3 = newArray44; + } + _this40.stackVec3[_this40.sizeVec3++] = anchor2; + } + if(mat311 != null) { + var t0022 = 1; + var t0122 = 0; + var t0222 = 0; + var t1022 = 0; + var t1122 = 1; + var t1222 = 0; + var t2022 = 0; + var t2122 = 0; + var t2222 = 1; + mat311.e00 = t0022; + mat311.e01 = t0122; + mat311.e02 = t0222; + mat311.e10 = t1022; + mat311.e11 = t1122; + mat311.e12 = t1222; + mat311.e20 = t2022; + mat311.e21 = t2122; + mat311.e22 = t2222; + if(_this40.sizeMat3 == _this40.stackMat3.length) { + var newLength45 = _this40.sizeMat3 << 1; + var this46 = new Array(newLength45); + var newArray45 = this46; + var _g56 = 0; + var _g146 = _this40.sizeMat3; + while(_g56 < _g146) { + var i46 = _g56++; + newArray45[i46] = _this40.stackMat3[i46]; + _this40.stackMat3[i46] = null; + } + _this40.stackMat3 = newArray45; + } + _this40.stackMat3[_this40.sizeMat3++] = mat311; + } + if(mat411 != null) { + var t0023 = 1; + var t0123 = 0; + var t0223 = 0; + var t0311 = 0; + var t1023 = 0; + var t1123 = 1; + var t1223 = 0; + var t1311 = 0; + var t2023 = 0; + var t2123 = 0; + var t2223 = 1; + var t2311 = 0; + var t3011 = 0; + var t3111 = 0; + var t3211 = 0; + var t3311 = 1; + mat411.e00 = t0023; + mat411.e01 = t0123; + mat411.e02 = t0223; + mat411.e03 = t0311; + mat411.e10 = t1023; + mat411.e11 = t1123; + mat411.e12 = t1223; + mat411.e13 = t1311; + mat411.e20 = t2023; + mat411.e21 = t2123; + mat411.e22 = t2223; + mat411.e23 = t2311; + mat411.e30 = t3011; + mat411.e31 = t3111; + mat411.e32 = t3211; + mat411.e33 = t3311; + if(_this40.sizeMat4 == _this40.stackMat4.length) { + var newLength46 = _this40.sizeMat4 << 1; + var this47 = new Array(newLength46); + var newArray46 = this47; + var _g57 = 0; + var _g147 = _this40.sizeMat4; + while(_g57 < _g147) { + var i47 = _g57++; + newArray46[i47] = _this40.stackMat4[i47]; + _this40.stackMat4[i47] = null; + } + _this40.stackMat4 = newArray46; + } + _this40.stackMat4[_this40.sizeMat4++] = mat411; + } + if(quat11 != null) { + var tx16 = 0; + var ty16 = 0; + var tz16 = 0; + var tw11 = 1; + quat11.x = tx16; + quat11.y = ty16; + quat11.z = tz16; + quat11.w = tw11; + if(_this40.sizeQuat == _this40.stackQuat.length) { + var newLength47 = _this40.sizeQuat << 1; + var this48 = new Array(newLength47); + var newArray47 = this48; + var _g58 = 0; + var _g148 = _this40.sizeQuat; + while(_g58 < _g148) { + var i48 = _g58++; + newArray47[i48] = _this40.stackQuat[i48]; + _this40.stackQuat[i48] = null; + } + _this40.stackQuat = newArray47; + } + _this40.stackQuat[_this40.sizeQuat++] = quat11; + } + var _this41 = this._pool; + var mat312 = null; + var mat412 = null; + var quat12 = null; + if(basisX1 != null) { + basisX1.zero(); + if(_this41.sizeVec3 == _this41.stackVec3.length) { + var newLength48 = _this41.sizeVec3 << 1; + var this49 = new Array(newLength48); + var newArray48 = this49; + var _g59 = 0; + var _g149 = _this41.sizeVec3; + while(_g59 < _g149) { + var i49 = _g59++; + newArray48[i49] = _this41.stackVec3[i49]; + _this41.stackVec3[i49] = null; + } + _this41.stackVec3 = newArray48; + } + _this41.stackVec3[_this41.sizeVec3++] = basisX1; + } + if(mat312 != null) { + var t0024 = 1; + var t0124 = 0; + var t0224 = 0; + var t1024 = 0; + var t1124 = 1; + var t1224 = 0; + var t2024 = 0; + var t2124 = 0; + var t2224 = 1; + mat312.e00 = t0024; + mat312.e01 = t0124; + mat312.e02 = t0224; + mat312.e10 = t1024; + mat312.e11 = t1124; + mat312.e12 = t1224; + mat312.e20 = t2024; + mat312.e21 = t2124; + mat312.e22 = t2224; + if(_this41.sizeMat3 == _this41.stackMat3.length) { + var newLength49 = _this41.sizeMat3 << 1; + var this50 = new Array(newLength49); + var newArray49 = this50; + var _g60 = 0; + var _g150 = _this41.sizeMat3; + while(_g60 < _g150) { + var i50 = _g60++; + newArray49[i50] = _this41.stackMat3[i50]; + _this41.stackMat3[i50] = null; + } + _this41.stackMat3 = newArray49; + } + _this41.stackMat3[_this41.sizeMat3++] = mat312; + } + if(mat412 != null) { + var t0025 = 1; + var t0125 = 0; + var t0225 = 0; + var t0312 = 0; + var t1025 = 0; + var t1125 = 1; + var t1225 = 0; + var t1312 = 0; + var t2025 = 0; + var t2125 = 0; + var t2225 = 1; + var t2312 = 0; + var t3012 = 0; + var t3112 = 0; + var t3212 = 0; + var t3312 = 1; + mat412.e00 = t0025; + mat412.e01 = t0125; + mat412.e02 = t0225; + mat412.e03 = t0312; + mat412.e10 = t1025; + mat412.e11 = t1125; + mat412.e12 = t1225; + mat412.e13 = t1312; + mat412.e20 = t2025; + mat412.e21 = t2125; + mat412.e22 = t2225; + mat412.e23 = t2312; + mat412.e30 = t3012; + mat412.e31 = t3112; + mat412.e32 = t3212; + mat412.e33 = t3312; + if(_this41.sizeMat4 == _this41.stackMat4.length) { + var newLength50 = _this41.sizeMat4 << 1; + var this51 = new Array(newLength50); + var newArray50 = this51; + var _g61 = 0; + var _g151 = _this41.sizeMat4; + while(_g61 < _g151) { + var i51 = _g61++; + newArray50[i51] = _this41.stackMat4[i51]; + _this41.stackMat4[i51] = null; + } + _this41.stackMat4 = newArray50; + } + _this41.stackMat4[_this41.sizeMat4++] = mat412; + } + if(quat12 != null) { + var tx17 = 0; + var ty17 = 0; + var tz17 = 0; + var tw12 = 1; + quat12.x = tx17; + quat12.y = ty17; + quat12.z = tz17; + quat12.w = tw12; + if(_this41.sizeQuat == _this41.stackQuat.length) { + var newLength51 = _this41.sizeQuat << 1; + var this52 = new Array(newLength51); + var newArray51 = this52; + var _g62 = 0; + var _g152 = _this41.sizeQuat; + while(_g62 < _g152) { + var i52 = _g62++; + newArray51[i52] = _this41.stackQuat[i52]; + _this41.stackQuat[i52] = null; + } + _this41.stackQuat = newArray51; + } + _this41.stackQuat[_this41.sizeQuat++] = quat12; + } + var _this42 = this._pool; + var mat313 = null; + var mat413 = null; + var quat13 = null; + if(basisY1 != null) { + basisY1.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newLength52 = _this42.sizeVec3 << 1; + var this53 = new Array(newLength52); + var newArray52 = this53; + var _g63 = 0; + var _g153 = _this42.sizeVec3; + while(_g63 < _g153) { + var i53 = _g63++; + newArray52[i53] = _this42.stackVec3[i53]; + _this42.stackVec3[i53] = null; + } + _this42.stackVec3 = newArray52; + } + _this42.stackVec3[_this42.sizeVec3++] = basisY1; + } + if(mat313 != null) { + var t0026 = 1; + var t0126 = 0; + var t0226 = 0; + var t1026 = 0; + var t1126 = 1; + var t1226 = 0; + var t2026 = 0; + var t2126 = 0; + var t2226 = 1; + mat313.e00 = t0026; + mat313.e01 = t0126; + mat313.e02 = t0226; + mat313.e10 = t1026; + mat313.e11 = t1126; + mat313.e12 = t1226; + mat313.e20 = t2026; + mat313.e21 = t2126; + mat313.e22 = t2226; + if(_this42.sizeMat3 == _this42.stackMat3.length) { + var newLength53 = _this42.sizeMat3 << 1; + var this54 = new Array(newLength53); + var newArray53 = this54; + var _g64 = 0; + var _g154 = _this42.sizeMat3; + while(_g64 < _g154) { + var i54 = _g64++; + newArray53[i54] = _this42.stackMat3[i54]; + _this42.stackMat3[i54] = null; + } + _this42.stackMat3 = newArray53; + } + _this42.stackMat3[_this42.sizeMat3++] = mat313; + } + if(mat413 != null) { + var t0027 = 1; + var t0127 = 0; + var t0227 = 0; + var t0313 = 0; + var t1027 = 0; + var t1127 = 1; + var t1227 = 0; + var t1313 = 0; + var t2027 = 0; + var t2127 = 0; + var t2227 = 1; + var t2313 = 0; + var t3013 = 0; + var t3113 = 0; + var t3213 = 0; + var t3313 = 1; + mat413.e00 = t0027; + mat413.e01 = t0127; + mat413.e02 = t0227; + mat413.e03 = t0313; + mat413.e10 = t1027; + mat413.e11 = t1127; + mat413.e12 = t1227; + mat413.e13 = t1313; + mat413.e20 = t2027; + mat413.e21 = t2127; + mat413.e22 = t2227; + mat413.e23 = t2313; + mat413.e30 = t3013; + mat413.e31 = t3113; + mat413.e32 = t3213; + mat413.e33 = t3313; + if(_this42.sizeMat4 == _this42.stackMat4.length) { + var newLength54 = _this42.sizeMat4 << 1; + var this55 = new Array(newLength54); + var newArray54 = this55; + var _g65 = 0; + var _g155 = _this42.sizeMat4; + while(_g65 < _g155) { + var i55 = _g65++; + newArray54[i55] = _this42.stackMat4[i55]; + _this42.stackMat4[i55] = null; + } + _this42.stackMat4 = newArray54; + } + _this42.stackMat4[_this42.sizeMat4++] = mat413; + } + if(quat13 != null) { + var tx18 = 0; + var ty18 = 0; + var tz18 = 0; + var tw13 = 1; + quat13.x = tx18; + quat13.y = ty18; + quat13.z = tz18; + quat13.w = tw13; + if(_this42.sizeQuat == _this42.stackQuat.length) { + var newLength55 = _this42.sizeQuat << 1; + var this56 = new Array(newLength55); + var newArray55 = this56; + var _g66 = 0; + var _g156 = _this42.sizeQuat; + while(_g66 < _g156) { + var i56 = _g66++; + newArray55[i56] = _this42.stackQuat[i56]; + _this42.stackQuat[i56] = null; + } + _this42.stackQuat = newArray55; + } + _this42.stackQuat[_this42.sizeQuat++] = quat13; + } + var _this43 = this._pool; + var mat314 = null; + var mat414 = null; + var quat14 = null; + if(basisZ1 != null) { + basisZ1.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newLength56 = _this43.sizeVec3 << 1; + var this57 = new Array(newLength56); + var newArray56 = this57; + var _g67 = 0; + var _g157 = _this43.sizeVec3; + while(_g67 < _g157) { + var i57 = _g67++; + newArray56[i57] = _this43.stackVec3[i57]; + _this43.stackVec3[i57] = null; + } + _this43.stackVec3 = newArray56; + } + _this43.stackVec3[_this43.sizeVec3++] = basisZ1; + } + if(mat314 != null) { + var t0028 = 1; + var t0128 = 0; + var t0228 = 0; + var t1028 = 0; + var t1128 = 1; + var t1228 = 0; + var t2028 = 0; + var t2128 = 0; + var t2228 = 1; + mat314.e00 = t0028; + mat314.e01 = t0128; + mat314.e02 = t0228; + mat314.e10 = t1028; + mat314.e11 = t1128; + mat314.e12 = t1228; + mat314.e20 = t2028; + mat314.e21 = t2128; + mat314.e22 = t2228; + if(_this43.sizeMat3 == _this43.stackMat3.length) { + var newLength57 = _this43.sizeMat3 << 1; + var this58 = new Array(newLength57); + var newArray57 = this58; + var _g68 = 0; + var _g158 = _this43.sizeMat3; + while(_g68 < _g158) { + var i58 = _g68++; + newArray57[i58] = _this43.stackMat3[i58]; + _this43.stackMat3[i58] = null; + } + _this43.stackMat3 = newArray57; + } + _this43.stackMat3[_this43.sizeMat3++] = mat314; + } + if(mat414 != null) { + var t0029 = 1; + var t0129 = 0; + var t0229 = 0; + var t0314 = 0; + var t1029 = 0; + var t1129 = 1; + var t1229 = 0; + var t1314 = 0; + var t2029 = 0; + var t2129 = 0; + var t2229 = 1; + var t2314 = 0; + var t3014 = 0; + var t3114 = 0; + var t3214 = 0; + var t3314 = 1; + mat414.e00 = t0029; + mat414.e01 = t0129; + mat414.e02 = t0229; + mat414.e03 = t0314; + mat414.e10 = t1029; + mat414.e11 = t1129; + mat414.e12 = t1229; + mat414.e13 = t1314; + mat414.e20 = t2029; + mat414.e21 = t2129; + mat414.e22 = t2229; + mat414.e23 = t2314; + mat414.e30 = t3014; + mat414.e31 = t3114; + mat414.e32 = t3214; + mat414.e33 = t3314; + if(_this43.sizeMat4 == _this43.stackMat4.length) { + var newLength58 = _this43.sizeMat4 << 1; + var this59 = new Array(newLength58); + var newArray58 = this59; + var _g69 = 0; + var _g159 = _this43.sizeMat4; + while(_g69 < _g159) { + var i59 = _g69++; + newArray58[i59] = _this43.stackMat4[i59]; + _this43.stackMat4[i59] = null; + } + _this43.stackMat4 = newArray58; + } + _this43.stackMat4[_this43.sizeMat4++] = mat414; + } + if(quat14 != null) { + var tx19 = 0; + var ty19 = 0; + var tz19 = 0; + var tw14 = 1; + quat14.x = tx19; + quat14.y = ty19; + quat14.z = tz19; + quat14.w = tw14; + if(_this43.sizeQuat == _this43.stackQuat.length) { + var newLength59 = _this43.sizeQuat << 1; + var this60 = new Array(newLength59); + var newArray59 = this60; + var _g70 = 0; + var _g160 = _this43.sizeQuat; + while(_g70 < _g160) { + var i60 = _g70++; + newArray59[i60] = _this43.stackQuat[i60]; + _this43.stackQuat[i60] = null; + } + _this43.stackQuat = newArray59; + } + _this43.stackQuat[_this43.sizeQuat++] = quat14; + } + var _this44 = this._pool; + var mat315 = null; + var mat415 = null; + var quat15 = null; + if(basisX2 != null) { + basisX2.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newLength60 = _this44.sizeVec3 << 1; + var this61 = new Array(newLength60); + var newArray60 = this61; + var _g71 = 0; + var _g161 = _this44.sizeVec3; + while(_g71 < _g161) { + var i61 = _g71++; + newArray60[i61] = _this44.stackVec3[i61]; + _this44.stackVec3[i61] = null; + } + _this44.stackVec3 = newArray60; + } + _this44.stackVec3[_this44.sizeVec3++] = basisX2; + } + if(mat315 != null) { + var t0030 = 1; + var t0130 = 0; + var t0230 = 0; + var t1030 = 0; + var t1130 = 1; + var t1230 = 0; + var t2030 = 0; + var t2130 = 0; + var t2230 = 1; + mat315.e00 = t0030; + mat315.e01 = t0130; + mat315.e02 = t0230; + mat315.e10 = t1030; + mat315.e11 = t1130; + mat315.e12 = t1230; + mat315.e20 = t2030; + mat315.e21 = t2130; + mat315.e22 = t2230; + if(_this44.sizeMat3 == _this44.stackMat3.length) { + var newLength61 = _this44.sizeMat3 << 1; + var this62 = new Array(newLength61); + var newArray61 = this62; + var _g72 = 0; + var _g162 = _this44.sizeMat3; + while(_g72 < _g162) { + var i62 = _g72++; + newArray61[i62] = _this44.stackMat3[i62]; + _this44.stackMat3[i62] = null; + } + _this44.stackMat3 = newArray61; + } + _this44.stackMat3[_this44.sizeMat3++] = mat315; + } + if(mat415 != null) { + var t0031 = 1; + var t0131 = 0; + var t0231 = 0; + var t0315 = 0; + var t1031 = 0; + var t1131 = 1; + var t1231 = 0; + var t1315 = 0; + var t2031 = 0; + var t2131 = 0; + var t2231 = 1; + var t2315 = 0; + var t3015 = 0; + var t3115 = 0; + var t3215 = 0; + var t3315 = 1; + mat415.e00 = t0031; + mat415.e01 = t0131; + mat415.e02 = t0231; + mat415.e03 = t0315; + mat415.e10 = t1031; + mat415.e11 = t1131; + mat415.e12 = t1231; + mat415.e13 = t1315; + mat415.e20 = t2031; + mat415.e21 = t2131; + mat415.e22 = t2231; + mat415.e23 = t2315; + mat415.e30 = t3015; + mat415.e31 = t3115; + mat415.e32 = t3215; + mat415.e33 = t3315; + if(_this44.sizeMat4 == _this44.stackMat4.length) { + var newLength62 = _this44.sizeMat4 << 1; + var this63 = new Array(newLength62); + var newArray62 = this63; + var _g73 = 0; + var _g163 = _this44.sizeMat4; + while(_g73 < _g163) { + var i63 = _g73++; + newArray62[i63] = _this44.stackMat4[i63]; + _this44.stackMat4[i63] = null; + } + _this44.stackMat4 = newArray62; + } + _this44.stackMat4[_this44.sizeMat4++] = mat415; + } + if(quat15 != null) { + var tx20 = 0; + var ty20 = 0; + var tz20 = 0; + var tw15 = 1; + quat15.x = tx20; + quat15.y = ty20; + quat15.z = tz20; + quat15.w = tw15; + if(_this44.sizeQuat == _this44.stackQuat.length) { + var newLength63 = _this44.sizeQuat << 1; + var this64 = new Array(newLength63); + var newArray63 = this64; + var _g74 = 0; + var _g164 = _this44.sizeQuat; + while(_g74 < _g164) { + var i64 = _g74++; + newArray63[i64] = _this44.stackQuat[i64]; + _this44.stackQuat[i64] = null; + } + _this44.stackQuat = newArray63; + } + _this44.stackQuat[_this44.sizeQuat++] = quat15; + } + var _this45 = this._pool; + var mat316 = null; + var mat416 = null; + var quat16 = null; + if(basisY2 != null) { + basisY2.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newLength64 = _this45.sizeVec3 << 1; + var this65 = new Array(newLength64); + var newArray64 = this65; + var _g75 = 0; + var _g165 = _this45.sizeVec3; + while(_g75 < _g165) { + var i65 = _g75++; + newArray64[i65] = _this45.stackVec3[i65]; + _this45.stackVec3[i65] = null; + } + _this45.stackVec3 = newArray64; + } + _this45.stackVec3[_this45.sizeVec3++] = basisY2; + } + if(mat316 != null) { + var t0032 = 1; + var t0132 = 0; + var t0232 = 0; + var t1032 = 0; + var t1132 = 1; + var t1232 = 0; + var t2032 = 0; + var t2132 = 0; + var t2232 = 1; + mat316.e00 = t0032; + mat316.e01 = t0132; + mat316.e02 = t0232; + mat316.e10 = t1032; + mat316.e11 = t1132; + mat316.e12 = t1232; + mat316.e20 = t2032; + mat316.e21 = t2132; + mat316.e22 = t2232; + if(_this45.sizeMat3 == _this45.stackMat3.length) { + var newLength65 = _this45.sizeMat3 << 1; + var this66 = new Array(newLength65); + var newArray65 = this66; + var _g76 = 0; + var _g166 = _this45.sizeMat3; + while(_g76 < _g166) { + var i66 = _g76++; + newArray65[i66] = _this45.stackMat3[i66]; + _this45.stackMat3[i66] = null; + } + _this45.stackMat3 = newArray65; + } + _this45.stackMat3[_this45.sizeMat3++] = mat316; + } + if(mat416 != null) { + var t0033 = 1; + var t0133 = 0; + var t0233 = 0; + var t0316 = 0; + var t1033 = 0; + var t1133 = 1; + var t1233 = 0; + var t1316 = 0; + var t2033 = 0; + var t2133 = 0; + var t2233 = 1; + var t2316 = 0; + var t3016 = 0; + var t3116 = 0; + var t3216 = 0; + var t3316 = 1; + mat416.e00 = t0033; + mat416.e01 = t0133; + mat416.e02 = t0233; + mat416.e03 = t0316; + mat416.e10 = t1033; + mat416.e11 = t1133; + mat416.e12 = t1233; + mat416.e13 = t1316; + mat416.e20 = t2033; + mat416.e21 = t2133; + mat416.e22 = t2233; + mat416.e23 = t2316; + mat416.e30 = t3016; + mat416.e31 = t3116; + mat416.e32 = t3216; + mat416.e33 = t3316; + if(_this45.sizeMat4 == _this45.stackMat4.length) { + var newLength66 = _this45.sizeMat4 << 1; + var this67 = new Array(newLength66); + var newArray66 = this67; + var _g77 = 0; + var _g167 = _this45.sizeMat4; + while(_g77 < _g167) { + var i67 = _g77++; + newArray66[i67] = _this45.stackMat4[i67]; + _this45.stackMat4[i67] = null; + } + _this45.stackMat4 = newArray66; + } + _this45.stackMat4[_this45.sizeMat4++] = mat416; + } + if(quat16 != null) { + var tx21 = 0; + var ty21 = 0; + var tz21 = 0; + var tw16 = 1; + quat16.x = tx21; + quat16.y = ty21; + quat16.z = tz21; + quat16.w = tw16; + if(_this45.sizeQuat == _this45.stackQuat.length) { + var newLength67 = _this45.sizeQuat << 1; + var this68 = new Array(newLength67); + var newArray67 = this68; + var _g78 = 0; + var _g168 = _this45.sizeQuat; + while(_g78 < _g168) { + var i68 = _g78++; + newArray67[i68] = _this45.stackQuat[i68]; + _this45.stackQuat[i68] = null; + } + _this45.stackQuat = newArray67; + } + _this45.stackQuat[_this45.sizeQuat++] = quat16; + } + var _this46 = this._pool; + var mat317 = null; + var mat417 = null; + var quat17 = null; + if(basisZ2 != null) { + basisZ2.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newLength68 = _this46.sizeVec3 << 1; + var this69 = new Array(newLength68); + var newArray68 = this69; + var _g79 = 0; + var _g169 = _this46.sizeVec3; + while(_g79 < _g169) { + var i69 = _g79++; + newArray68[i69] = _this46.stackVec3[i69]; + _this46.stackVec3[i69] = null; + } + _this46.stackVec3 = newArray68; + } + _this46.stackVec3[_this46.sizeVec3++] = basisZ2; + } + if(mat317 != null) { + var t0034 = 1; + var t0134 = 0; + var t0234 = 0; + var t1034 = 0; + var t1134 = 1; + var t1234 = 0; + var t2034 = 0; + var t2134 = 0; + var t2234 = 1; + mat317.e00 = t0034; + mat317.e01 = t0134; + mat317.e02 = t0234; + mat317.e10 = t1034; + mat317.e11 = t1134; + mat317.e12 = t1234; + mat317.e20 = t2034; + mat317.e21 = t2134; + mat317.e22 = t2234; + if(_this46.sizeMat3 == _this46.stackMat3.length) { + var newLength69 = _this46.sizeMat3 << 1; + var this70 = new Array(newLength69); + var newArray69 = this70; + var _g80 = 0; + var _g170 = _this46.sizeMat3; + while(_g80 < _g170) { + var i70 = _g80++; + newArray69[i70] = _this46.stackMat3[i70]; + _this46.stackMat3[i70] = null; + } + _this46.stackMat3 = newArray69; + } + _this46.stackMat3[_this46.sizeMat3++] = mat317; + } + if(mat417 != null) { + var t0035 = 1; + var t0135 = 0; + var t0235 = 0; + var t0317 = 0; + var t1035 = 0; + var t1135 = 1; + var t1235 = 0; + var t1317 = 0; + var t2035 = 0; + var t2135 = 0; + var t2235 = 1; + var t2317 = 0; + var t3017 = 0; + var t3117 = 0; + var t3217 = 0; + var t3317 = 1; + mat417.e00 = t0035; + mat417.e01 = t0135; + mat417.e02 = t0235; + mat417.e03 = t0317; + mat417.e10 = t1035; + mat417.e11 = t1135; + mat417.e12 = t1235; + mat417.e13 = t1317; + mat417.e20 = t2035; + mat417.e21 = t2135; + mat417.e22 = t2235; + mat417.e23 = t2317; + mat417.e30 = t3017; + mat417.e31 = t3117; + mat417.e32 = t3217; + mat417.e33 = t3317; + if(_this46.sizeMat4 == _this46.stackMat4.length) { + var newLength70 = _this46.sizeMat4 << 1; + var this71 = new Array(newLength70); + var newArray70 = this71; + var _g81 = 0; + var _g171 = _this46.sizeMat4; + while(_g81 < _g171) { + var i71 = _g81++; + newArray70[i71] = _this46.stackMat4[i71]; + _this46.stackMat4[i71] = null; + } + _this46.stackMat4 = newArray70; + } + _this46.stackMat4[_this46.sizeMat4++] = mat417; + } + if(quat17 != null) { + var tx22 = 0; + var ty22 = 0; + var tz22 = 0; + var tw17 = 1; + quat17.x = tx22; + quat17.y = ty22; + quat17.z = tz22; + quat17.w = tw17; + if(_this46.sizeQuat == _this46.stackQuat.length) { + var newLength71 = _this46.sizeQuat << 1; + var this72 = new Array(newLength71); + var newArray71 = this72; + var _g82 = 0; + var _g172 = _this46.sizeQuat; + while(_g82 < _g172) { + var i72 = _g82++; + newArray71[i72] = _this46.stackQuat[i72]; + _this46.stackQuat[i72] = null; + } + _this46.stackQuat = newArray71; + } + _this46.stackQuat[_this46.sizeQuat++] = quat17; + } + j = n1; + } + } + } + _drawRotationalLimit(d,center,ex,ey,needle,radius,min,max,color) { + if(min != max) { + var _this = this._pool; + var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + var _this2 = _this1; + var tx = _this2.x + needle.x * radius; + var ty = _this2.y + needle.y * radius; + var tz = _this2.z + needle.z * radius; + _this2.x = tx; + _this2.y = ty; + _this2.z = tz; + var to = _this2; + d.line(center,to,color); + var _this3 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(to != null) { + to.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newLength = _this3.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this3.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; + } + _this3.stackVec3 = newArray; + } + _this3.stackVec3[_this3.sizeVec3++] = to; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this3.sizeMat3 == _this3.stackMat3.length) { + var newLength1 = _this3.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this3.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this3.stackMat3[i1]; + _this3.stackMat3[i1] = null; + } + _this3.stackMat3 = newArray1; + } + _this3.stackMat3[_this3.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this3.sizeMat4 == _this3.stackMat4.length) { + var newLength2 = _this3.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this3.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this3.stackMat4[i2]; + _this3.stackMat4[i2] = null; + } + _this3.stackMat4 = newArray2; + } + _this3.stackMat4[_this3.sizeMat4++] = mat4; + } + if(quat != null) { + var tx1 = 0; + var ty1 = 0; + var tz1 = 0; + var tw = 1; + quat.x = tx1; + quat.y = ty1; + quat.z = tz1; + quat.w = tw; + if(_this3.sizeQuat == _this3.stackQuat.length) { + var newLength3 = _this3.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this3.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this3.stackQuat[i3]; + _this3.stackQuat[i3] = null; + } + _this3.stackQuat = newArray3; + } + _this3.stackQuat[_this3.sizeQuat++] = quat; + } + if(min > max) { + d.ellipse(center,ex,ey,radius,radius,color); + } else { + d.arc(center,ex,ey,radius,radius,min,max,true,color); + } + } + } + _drawTranslationalLimit(d,center,ex,min,max,color) { + if(min < max) { + var _this = this._pool; + var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + var _this2 = _this1; + var tx = _this2.x + ex.x * min; + var ty = _this2.y + ex.y * min; + var tz = _this2.z + ex.z * min; + _this2.x = tx; + _this2.y = ty; + _this2.z = tz; + var lower = _this2; + var _this3 = this._pool; + var _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = center.x; + _this4.y = center.y; + _this4.z = center.z; + var _this5 = _this4; + var tx1 = _this5.x + ex.x * max; + var ty1 = _this5.y + ex.y * max; + var tz1 = _this5.z + ex.z * max; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + var upper = _this5; + d.line(lower,upper,color); + var _this6 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(lower != null) { + lower.zero(); + if(_this6.sizeVec3 == _this6.stackVec3.length) { + var newLength = _this6.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this6.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this6.stackVec3[i]; + _this6.stackVec3[i] = null; + } + _this6.stackVec3 = newArray; + } + _this6.stackVec3[_this6.sizeVec3++] = lower; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this6.sizeMat3 == _this6.stackMat3.length) { + var newLength1 = _this6.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this6.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this6.stackMat3[i1]; + _this6.stackMat3[i1] = null; + } + _this6.stackMat3 = newArray1; + } + _this6.stackMat3[_this6.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this6.sizeMat4 == _this6.stackMat4.length) { + var newLength2 = _this6.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this6.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this6.stackMat4[i2]; + _this6.stackMat4[i2] = null; + } + _this6.stackMat4 = newArray2; + } + _this6.stackMat4[_this6.sizeMat4++] = mat4; + } + if(quat != null) { + var tx2 = 0; + var ty2 = 0; + var tz2 = 0; + var tw = 1; + quat.x = tx2; + quat.y = ty2; + quat.z = tz2; + quat.w = tw; + if(_this6.sizeQuat == _this6.stackQuat.length) { + var newLength3 = _this6.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this6.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this6.stackQuat[i3]; + _this6.stackQuat[i3] = null; + } + _this6.stackQuat = newArray3; + } + _this6.stackQuat[_this6.sizeQuat++] = quat; + } + var _this7 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(upper != null) { + upper.zero(); + if(_this7.sizeVec3 == _this7.stackVec3.length) { + var newLength4 = _this7.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this7.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this7.stackVec3[i4]; + _this7.stackVec3[i4] = null; + } + _this7.stackVec3 = newArray4; + } + _this7.stackVec3[_this7.sizeVec3++] = upper; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this7.sizeMat3 == _this7.stackMat3.length) { + var newLength5 = _this7.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this7.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this7.stackMat3[i5]; + _this7.stackMat3[i5] = null; + } + _this7.stackMat3 = newArray5; + } + _this7.stackMat3[_this7.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this7.sizeMat4 == _this7.stackMat4.length) { + var newLength6 = _this7.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this7.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this7.stackMat4[i6]; + _this7.stackMat4[i6] = null; + } + _this7.stackMat4 = newArray6; + } + _this7.stackMat4[_this7.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx3 = 0; + var ty3 = 0; + var tz3 = 0; + var tw1 = 1; + quat1.x = tx3; + quat1.y = ty3; + quat1.z = tz3; + quat1.w = tw1; + if(_this7.sizeQuat == _this7.stackQuat.length) { + var newLength7 = _this7.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this7.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this7.stackQuat[i7]; + _this7.stackQuat[i7] = null; + } + _this7.stackQuat = newArray7; + } + _this7.stackQuat[_this7.sizeQuat++] = quat1; + } + } + } + _drawTranslationalLimit3D(d,center,ex,ey,ez,xlm,ylm,zlm,color) { + var minx = xlm.lowerLimit; + var maxx = xlm.upperLimit; + var miny = ylm.lowerLimit; + var maxy = ylm.upperLimit; + var minz = zlm.lowerLimit; + var maxz = zlm.upperLimit; + var _this = this._pool; + var lower = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var upper = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this._pool; + var _this3 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = center.x; + _this3.y = center.y; + _this3.z = center.z; + var _this4 = _this3; + var tx = _this4.x + ex.x * minx; + var ty = _this4.y + ex.y * minx; + var tz = _this4.z + ex.z * minx; + _this4.x = tx; + _this4.y = ty; + _this4.z = tz; + var _this5 = _this4; + var tx1 = _this5.x + ey.x * miny; + var ty1 = _this5.y + ey.y * miny; + var tz1 = _this5.z + ey.z * miny; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + var _this6 = _this5; + var tx2 = _this6.x + ez.x * minz; + var ty2 = _this6.y + ez.y * minz; + var tz2 = _this6.z + ez.z * minz; + _this6.x = tx2; + _this6.y = ty2; + _this6.z = tz2; + var xyz = _this6; + var _this7 = this._pool; + var _this8 = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + _this8.x = center.x; + _this8.y = center.y; + _this8.z = center.z; + var _this9 = _this8; + var tx3 = _this9.x + ex.x * minx; + var ty3 = _this9.y + ex.y * minx; + var tz3 = _this9.z + ex.z * minx; + _this9.x = tx3; + _this9.y = ty3; + _this9.z = tz3; + var _this10 = _this9; + var tx4 = _this10.x + ey.x * miny; + var ty4 = _this10.y + ey.y * miny; + var tz4 = _this10.z + ey.z * miny; + _this10.x = tx4; + _this10.y = ty4; + _this10.z = tz4; + var _this11 = _this10; + var tx5 = _this11.x + ez.x * maxz; + var ty5 = _this11.y + ez.y * maxz; + var tz5 = _this11.z + ez.z * maxz; + _this11.x = tx5; + _this11.y = ty5; + _this11.z = tz5; + var xyZ = _this11; + var _this12 = this._pool; + var _this13 = _this12.sizeVec3 == 0 ? new oimo.common.Vec3() : _this12.stackVec3[--_this12.sizeVec3]; + _this13.x = center.x; + _this13.y = center.y; + _this13.z = center.z; + var _this14 = _this13; + var tx6 = _this14.x + ex.x * minx; + var ty6 = _this14.y + ex.y * minx; + var tz6 = _this14.z + ex.z * minx; + _this14.x = tx6; + _this14.y = ty6; + _this14.z = tz6; + var _this15 = _this14; + var tx7 = _this15.x + ey.x * maxy; + var ty7 = _this15.y + ey.y * maxy; + var tz7 = _this15.z + ey.z * maxy; + _this15.x = tx7; + _this15.y = ty7; + _this15.z = tz7; + var _this16 = _this15; + var tx8 = _this16.x + ez.x * minz; + var ty8 = _this16.y + ez.y * minz; + var tz8 = _this16.z + ez.z * minz; + _this16.x = tx8; + _this16.y = ty8; + _this16.z = tz8; + var xYz = _this16; + var _this17 = this._pool; + var _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = center.x; + _this18.y = center.y; + _this18.z = center.z; + var _this19 = _this18; + var tx9 = _this19.x + ex.x * minx; + var ty9 = _this19.y + ex.y * minx; + var tz9 = _this19.z + ex.z * minx; + _this19.x = tx9; + _this19.y = ty9; + _this19.z = tz9; + var _this20 = _this19; + var tx10 = _this20.x + ey.x * maxy; + var ty10 = _this20.y + ey.y * maxy; + var tz10 = _this20.z + ey.z * maxy; + _this20.x = tx10; + _this20.y = ty10; + _this20.z = tz10; + var _this21 = _this20; + var tx11 = _this21.x + ez.x * maxz; + var ty11 = _this21.y + ez.y * maxz; + var tz11 = _this21.z + ez.z * maxz; + _this21.x = tx11; + _this21.y = ty11; + _this21.z = tz11; + var xYZ = _this21; + var _this22 = this._pool; + var _this23 = _this22.sizeVec3 == 0 ? new oimo.common.Vec3() : _this22.stackVec3[--_this22.sizeVec3]; + _this23.x = center.x; + _this23.y = center.y; + _this23.z = center.z; + var _this24 = _this23; + var tx12 = _this24.x + ex.x * maxx; + var ty12 = _this24.y + ex.y * maxx; + var tz12 = _this24.z + ex.z * maxx; + _this24.x = tx12; + _this24.y = ty12; + _this24.z = tz12; + var _this25 = _this24; + var tx13 = _this25.x + ey.x * miny; + var ty13 = _this25.y + ey.y * miny; + var tz13 = _this25.z + ey.z * miny; + _this25.x = tx13; + _this25.y = ty13; + _this25.z = tz13; + var _this26 = _this25; + var tx14 = _this26.x + ez.x * minz; + var ty14 = _this26.y + ez.y * minz; + var tz14 = _this26.z + ez.z * minz; + _this26.x = tx14; + _this26.y = ty14; + _this26.z = tz14; + var Xyz = _this26; + var _this27 = this._pool; + var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; + _this28.x = center.x; + _this28.y = center.y; + _this28.z = center.z; + var _this29 = _this28; + var tx15 = _this29.x + ex.x * maxx; + var ty15 = _this29.y + ex.y * maxx; + var tz15 = _this29.z + ex.z * maxx; + _this29.x = tx15; + _this29.y = ty15; + _this29.z = tz15; + var _this30 = _this29; + var tx16 = _this30.x + ey.x * miny; + var ty16 = _this30.y + ey.y * miny; + var tz16 = _this30.z + ey.z * miny; + _this30.x = tx16; + _this30.y = ty16; + _this30.z = tz16; + var _this31 = _this30; + var tx17 = _this31.x + ez.x * maxz; + var ty17 = _this31.y + ez.y * maxz; + var tz17 = _this31.z + ez.z * maxz; + _this31.x = tx17; + _this31.y = ty17; + _this31.z = tz17; + var XyZ = _this31; + var _this32 = this._pool; + var _this33 = _this32.sizeVec3 == 0 ? new oimo.common.Vec3() : _this32.stackVec3[--_this32.sizeVec3]; + _this33.x = center.x; + _this33.y = center.y; + _this33.z = center.z; + var _this34 = _this33; + var tx18 = _this34.x + ex.x * maxx; + var ty18 = _this34.y + ex.y * maxx; + var tz18 = _this34.z + ex.z * maxx; + _this34.x = tx18; + _this34.y = ty18; + _this34.z = tz18; + var _this35 = _this34; + var tx19 = _this35.x + ey.x * maxy; + var ty19 = _this35.y + ey.y * maxy; + var tz19 = _this35.z + ey.z * maxy; + _this35.x = tx19; + _this35.y = ty19; + _this35.z = tz19; + var _this36 = _this35; + var tx20 = _this36.x + ez.x * minz; + var ty20 = _this36.y + ez.y * minz; + var tz20 = _this36.z + ez.z * minz; + _this36.x = tx20; + _this36.y = ty20; + _this36.z = tz20; + var XYz = _this36; + var _this37 = this._pool; + var _this38 = _this37.sizeVec3 == 0 ? new oimo.common.Vec3() : _this37.stackVec3[--_this37.sizeVec3]; + _this38.x = center.x; + _this38.y = center.y; + _this38.z = center.z; + var _this39 = _this38; + var tx21 = _this39.x + ex.x * maxx; + var ty21 = _this39.y + ex.y * maxx; + var tz21 = _this39.z + ex.z * maxx; + _this39.x = tx21; + _this39.y = ty21; + _this39.z = tz21; + var _this40 = _this39; + var tx22 = _this40.x + ey.x * maxy; + var ty22 = _this40.y + ey.y * maxy; + var tz22 = _this40.z + ey.z * maxy; + _this40.x = tx22; + _this40.y = ty22; + _this40.z = tz22; + var _this41 = _this40; + var tx23 = _this41.x + ez.x * maxz; + var ty23 = _this41.y + ez.y * maxz; + var tz23 = _this41.z + ez.z * maxz; + _this41.x = tx23; + _this41.y = ty23; + _this41.z = tz23; + var XYZ = _this41; + d.line(xyz,Xyz,color); + d.line(xYz,XYz,color); + d.line(xyZ,XyZ,color); + d.line(xYZ,XYZ,color); + d.line(xyz,xYz,color); + d.line(Xyz,XYz,color); + d.line(xyZ,xYZ,color); + d.line(XyZ,XYZ,color); + d.line(xyz,xyZ,color); + d.line(Xyz,XyZ,color); + d.line(xYz,xYZ,color); + d.line(XYz,XYZ,color); + var _this42 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(xyz != null) { + xyz.zero(); + if(_this42.sizeVec3 == _this42.stackVec3.length) { + var newLength = _this42.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this42.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this42.stackVec3[i]; + _this42.stackVec3[i] = null; + } + _this42.stackVec3 = newArray; + } + _this42.stackVec3[_this42.sizeVec3++] = xyz; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this42.sizeMat3 == _this42.stackMat3.length) { + var newLength1 = _this42.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this42.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this42.stackMat3[i1]; + _this42.stackMat3[i1] = null; + } + _this42.stackMat3 = newArray1; + } + _this42.stackMat3[_this42.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this42.sizeMat4 == _this42.stackMat4.length) { + var newLength2 = _this42.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this42.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this42.stackMat4[i2]; + _this42.stackMat4[i2] = null; + } + _this42.stackMat4 = newArray2; + } + _this42.stackMat4[_this42.sizeMat4++] = mat4; + } + if(quat != null) { + var tx24 = 0; + var ty24 = 0; + var tz24 = 0; + var tw = 1; + quat.x = tx24; + quat.y = ty24; + quat.z = tz24; + quat.w = tw; + if(_this42.sizeQuat == _this42.stackQuat.length) { + var newLength3 = _this42.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this42.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this42.stackQuat[i3]; + _this42.stackQuat[i3] = null; + } + _this42.stackQuat = newArray3; + } + _this42.stackQuat[_this42.sizeQuat++] = quat; + } + var _this43 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(xyZ != null) { + xyZ.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newLength4 = _this43.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this43.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this43.stackVec3[i4]; + _this43.stackVec3[i4] = null; + } + _this43.stackVec3 = newArray4; + } + _this43.stackVec3[_this43.sizeVec3++] = xyZ; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this43.sizeMat3 == _this43.stackMat3.length) { + var newLength5 = _this43.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this43.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this43.stackMat3[i5]; + _this43.stackMat3[i5] = null; + } + _this43.stackMat3 = newArray5; + } + _this43.stackMat3[_this43.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this43.sizeMat4 == _this43.stackMat4.length) { + var newLength6 = _this43.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this43.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this43.stackMat4[i6]; + _this43.stackMat4[i6] = null; + } + _this43.stackMat4 = newArray6; + } + _this43.stackMat4[_this43.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx25 = 0; + var ty25 = 0; + var tz25 = 0; + var tw1 = 1; + quat1.x = tx25; + quat1.y = ty25; + quat1.z = tz25; + quat1.w = tw1; + if(_this43.sizeQuat == _this43.stackQuat.length) { + var newLength7 = _this43.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this43.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this43.stackQuat[i7]; + _this43.stackQuat[i7] = null; + } + _this43.stackQuat = newArray7; + } + _this43.stackQuat[_this43.sizeQuat++] = quat1; + } + var _this44 = this._pool; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(xYz != null) { + xYz.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newLength8 = _this44.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this44.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this44.stackVec3[i8]; + _this44.stackVec3[i8] = null; + } + _this44.stackVec3 = newArray8; + } + _this44.stackVec3[_this44.sizeVec3++] = xYz; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this44.sizeMat3 == _this44.stackMat3.length) { + var newLength9 = _this44.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this44.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this44.stackMat3[i9]; + _this44.stackMat3[i9] = null; + } + _this44.stackMat3 = newArray9; + } + _this44.stackMat3[_this44.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this44.sizeMat4 == _this44.stackMat4.length) { + var newLength10 = _this44.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this44.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this44.stackMat4[i10]; + _this44.stackMat4[i10] = null; + } + _this44.stackMat4 = newArray10; + } + _this44.stackMat4[_this44.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx26 = 0; + var ty26 = 0; + var tz26 = 0; + var tw2 = 1; + quat2.x = tx26; + quat2.y = ty26; + quat2.z = tz26; + quat2.w = tw2; + if(_this44.sizeQuat == _this44.stackQuat.length) { + var newLength11 = _this44.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this44.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this44.stackQuat[i11]; + _this44.stackQuat[i11] = null; + } + _this44.stackQuat = newArray11; + } + _this44.stackQuat[_this44.sizeQuat++] = quat2; + } + var _this45 = this._pool; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(xYZ != null) { + xYZ.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newLength12 = _this45.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this45.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this45.stackVec3[i12]; + _this45.stackVec3[i12] = null; + } + _this45.stackVec3 = newArray12; + } + _this45.stackVec3[_this45.sizeVec3++] = xYZ; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this45.sizeMat3 == _this45.stackMat3.length) { + var newLength13 = _this45.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this45.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this45.stackMat3[i13]; + _this45.stackMat3[i13] = null; + } + _this45.stackMat3 = newArray13; + } + _this45.stackMat3[_this45.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this45.sizeMat4 == _this45.stackMat4.length) { + var newLength14 = _this45.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this45.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this45.stackMat4[i14]; + _this45.stackMat4[i14] = null; + } + _this45.stackMat4 = newArray14; + } + _this45.stackMat4[_this45.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx27 = 0; + var ty27 = 0; + var tz27 = 0; + var tw3 = 1; + quat3.x = tx27; + quat3.y = ty27; + quat3.z = tz27; + quat3.w = tw3; + if(_this45.sizeQuat == _this45.stackQuat.length) { + var newLength15 = _this45.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this45.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this45.stackQuat[i15]; + _this45.stackQuat[i15] = null; + } + _this45.stackQuat = newArray15; + } + _this45.stackQuat[_this45.sizeQuat++] = quat3; + } + var _this46 = this._pool; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(Xyz != null) { + Xyz.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newLength16 = _this46.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g26 = 0; + var _g116 = _this46.sizeVec3; + while(_g26 < _g116) { + var i16 = _g26++; + newArray16[i16] = _this46.stackVec3[i16]; + _this46.stackVec3[i16] = null; + } + _this46.stackVec3 = newArray16; + } + _this46.stackVec3[_this46.sizeVec3++] = Xyz; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this46.sizeMat3 == _this46.stackMat3.length) { + var newLength17 = _this46.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g27 = 0; + var _g117 = _this46.sizeMat3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray17[i17] = _this46.stackMat3[i17]; + _this46.stackMat3[i17] = null; + } + _this46.stackMat3 = newArray17; + } + _this46.stackMat3[_this46.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this46.sizeMat4 == _this46.stackMat4.length) { + var newLength18 = _this46.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g28 = 0; + var _g118 = _this46.sizeMat4; + while(_g28 < _g118) { + var i18 = _g28++; + newArray18[i18] = _this46.stackMat4[i18]; + _this46.stackMat4[i18] = null; + } + _this46.stackMat4 = newArray18; + } + _this46.stackMat4[_this46.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx28 = 0; + var ty28 = 0; + var tz28 = 0; + var tw4 = 1; + quat4.x = tx28; + quat4.y = ty28; + quat4.z = tz28; + quat4.w = tw4; + if(_this46.sizeQuat == _this46.stackQuat.length) { + var newLength19 = _this46.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g29 = 0; + var _g119 = _this46.sizeQuat; + while(_g29 < _g119) { + var i19 = _g29++; + newArray19[i19] = _this46.stackQuat[i19]; + _this46.stackQuat[i19] = null; + } + _this46.stackQuat = newArray19; + } + _this46.stackQuat[_this46.sizeQuat++] = quat4; + } + var _this47 = this._pool; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(XyZ != null) { + XyZ.zero(); + if(_this47.sizeVec3 == _this47.stackVec3.length) { + var newLength20 = _this47.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g30 = 0; + var _g120 = _this47.sizeVec3; + while(_g30 < _g120) { + var i20 = _g30++; + newArray20[i20] = _this47.stackVec3[i20]; + _this47.stackVec3[i20] = null; + } + _this47.stackVec3 = newArray20; + } + _this47.stackVec3[_this47.sizeVec3++] = XyZ; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this47.sizeMat3 == _this47.stackMat3.length) { + var newLength21 = _this47.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g31 = 0; + var _g121 = _this47.sizeMat3; + while(_g31 < _g121) { + var i21 = _g31++; + newArray21[i21] = _this47.stackMat3[i21]; + _this47.stackMat3[i21] = null; + } + _this47.stackMat3 = newArray21; + } + _this47.stackMat3[_this47.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this47.sizeMat4 == _this47.stackMat4.length) { + var newLength22 = _this47.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g32 = 0; + var _g122 = _this47.sizeMat4; + while(_g32 < _g122) { + var i22 = _g32++; + newArray22[i22] = _this47.stackMat4[i22]; + _this47.stackMat4[i22] = null; + } + _this47.stackMat4 = newArray22; + } + _this47.stackMat4[_this47.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx29 = 0; + var ty29 = 0; + var tz29 = 0; + var tw5 = 1; + quat5.x = tx29; + quat5.y = ty29; + quat5.z = tz29; + quat5.w = tw5; + if(_this47.sizeQuat == _this47.stackQuat.length) { + var newLength23 = _this47.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g33 = 0; + var _g123 = _this47.sizeQuat; + while(_g33 < _g123) { + var i23 = _g33++; + newArray23[i23] = _this47.stackQuat[i23]; + _this47.stackQuat[i23] = null; + } + _this47.stackQuat = newArray23; + } + _this47.stackQuat[_this47.sizeQuat++] = quat5; + } + var _this48 = this._pool; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(XYz != null) { + XYz.zero(); + if(_this48.sizeVec3 == _this48.stackVec3.length) { + var newLength24 = _this48.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g34 = 0; + var _g124 = _this48.sizeVec3; + while(_g34 < _g124) { + var i24 = _g34++; + newArray24[i24] = _this48.stackVec3[i24]; + _this48.stackVec3[i24] = null; + } + _this48.stackVec3 = newArray24; + } + _this48.stackVec3[_this48.sizeVec3++] = XYz; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this48.sizeMat3 == _this48.stackMat3.length) { + var newLength25 = _this48.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g35 = 0; + var _g125 = _this48.sizeMat3; + while(_g35 < _g125) { + var i25 = _g35++; + newArray25[i25] = _this48.stackMat3[i25]; + _this48.stackMat3[i25] = null; + } + _this48.stackMat3 = newArray25; + } + _this48.stackMat3[_this48.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this48.sizeMat4 == _this48.stackMat4.length) { + var newLength26 = _this48.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g36 = 0; + var _g126 = _this48.sizeMat4; + while(_g36 < _g126) { + var i26 = _g36++; + newArray26[i26] = _this48.stackMat4[i26]; + _this48.stackMat4[i26] = null; + } + _this48.stackMat4 = newArray26; + } + _this48.stackMat4[_this48.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx30 = 0; + var ty30 = 0; + var tz30 = 0; + var tw6 = 1; + quat6.x = tx30; + quat6.y = ty30; + quat6.z = tz30; + quat6.w = tw6; + if(_this48.sizeQuat == _this48.stackQuat.length) { + var newLength27 = _this48.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g37 = 0; + var _g127 = _this48.sizeQuat; + while(_g37 < _g127) { + var i27 = _g37++; + newArray27[i27] = _this48.stackQuat[i27]; + _this48.stackQuat[i27] = null; + } + _this48.stackQuat = newArray27; + } + _this48.stackQuat[_this48.sizeQuat++] = quat6; + } + var _this49 = this._pool; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(XYZ != null) { + XYZ.zero(); + if(_this49.sizeVec3 == _this49.stackVec3.length) { + var newLength28 = _this49.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g38 = 0; + var _g128 = _this49.sizeVec3; + while(_g38 < _g128) { + var i28 = _g38++; + newArray28[i28] = _this49.stackVec3[i28]; + _this49.stackVec3[i28] = null; + } + _this49.stackVec3 = newArray28; + } + _this49.stackVec3[_this49.sizeVec3++] = XYZ; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this49.sizeMat3 == _this49.stackMat3.length) { + var newLength29 = _this49.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g39 = 0; + var _g129 = _this49.sizeMat3; + while(_g39 < _g129) { + var i29 = _g39++; + newArray29[i29] = _this49.stackMat3[i29]; + _this49.stackMat3[i29] = null; + } + _this49.stackMat3 = newArray29; + } + _this49.stackMat3[_this49.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this49.sizeMat4 == _this49.stackMat4.length) { + var newLength30 = _this49.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g40 = 0; + var _g130 = _this49.sizeMat4; + while(_g40 < _g130) { + var i30 = _g40++; + newArray30[i30] = _this49.stackMat4[i30]; + _this49.stackMat4[i30] = null; + } + _this49.stackMat4 = newArray30; + } + _this49.stackMat4[_this49.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx31 = 0; + var ty31 = 0; + var tz31 = 0; + var tw7 = 1; + quat7.x = tx31; + quat7.y = ty31; + quat7.z = tz31; + quat7.w = tw7; + if(_this49.sizeQuat == _this49.stackQuat.length) { + var newLength31 = _this49.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g41 = 0; + var _g131 = _this49.sizeQuat; + while(_g41 < _g131) { + var i31 = _g41++; + newArray31[i31] = _this49.stackQuat[i31]; + _this49.stackQuat[i31] = null; + } + _this49.stackQuat = newArray31; + } + _this49.stackQuat[_this49.sizeQuat++] = quat7; + } + } + _drawEllipseOnSphere(d,center,normal,x,y,radiansX,radiansY,radius,color) { + var n = 16; + var theta = 0; + var dTheta = 6.28318530717958 / n; + var _this = this._pool; + var rotVec = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var rotQ = _this1.sizeQuat == 0 ? new oimo.common.Quat() : _this1.stackQuat[--_this1.sizeQuat]; + var _this2 = this._pool; + var rotM = _this2.sizeMat3 == 0 ? new oimo.common.Mat3() : _this2.stackMat3[--_this2.sizeMat3]; + var _this3 = this._pool; + var prevV = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _g = 0; + var _g1 = n + 1; + while(_g < _g1) { + var i = _g++; + var rx = Math.cos(theta) * radiansX; + var ry = Math.sin(theta) * radiansY; + var halfRotAng = Math.sqrt(rx * rx + ry * ry); + var rotSin = Math.sin(halfRotAng * 0.5); + var rotCos = Math.cos(halfRotAng * 0.5); + var _this4 = rotVec.zero(); + var tx = _this4.x + x.x * rx; + var ty = _this4.y + x.y * rx; + var tz = _this4.z + x.z * rx; + _this4.x = tx; + _this4.y = ty; + _this4.z = tz; + var _this5 = _this4; + var tx1 = _this5.x + y.x * ry; + var ty1 = _this5.y + y.y * ry; + var tz1 = _this5.z + y.z * ry; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + var s = 1 / halfRotAng * rotSin; + var tx2 = rotVec.x * s; + var ty2 = rotVec.y * s; + var tz2 = rotVec.z * s; + rotVec.x = tx2; + rotVec.y = ty2; + rotVec.z = tz2; + rotQ.x = rotVec.x; + rotQ.y = rotVec.y; + rotQ.z = rotVec.z; + rotQ.w = rotCos; + var x1 = rotQ.x; + var y1 = rotQ.y; + var z = rotQ.z; + var w = rotQ.w; + var x2 = 2 * x1; + var y2 = 2 * y1; + var z2 = 2 * z; + var xx = x1 * x2; + var yy = y1 * y2; + var zz = z * z2; + var xy = x1 * y2; + var yz = y1 * z2; + var xz = x1 * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + rotM.e00 = 1 - yy - zz; + rotM.e01 = xy - wz; + rotM.e02 = xz + wy; + rotM.e10 = xy + wz; + rotM.e11 = 1 - xx - zz; + rotM.e12 = yz - wx; + rotM.e20 = xz - wy; + rotM.e21 = yz + wx; + rotM.e22 = 1 - xx - yy; + var _this6 = this._pool; + var _this7 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var tx3 = _this7.x + normal.x * radius; + var ty3 = _this7.y + normal.y * radius; + var tz3 = _this7.z + normal.z * radius; + _this7.x = tx3; + _this7.y = ty3; + _this7.z = tz3; + var v = _this7; + var tx4 = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; + var ty4 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; + var tz4 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; + v.x = tx4; + v.y = ty4; + v.z = tz4; + var _this8 = v; + var tx5 = _this8.x + center.x; + var ty5 = _this8.y + center.y; + var tz5 = _this8.z + center.z; + _this8.x = tx5; + _this8.y = ty5; + _this8.z = tz5; + if(i >= 1) { + d.line(prevV,v,color); + } + var _this9 = this._pool; + var mat3 = null; + var mat4 = null; + var quat = null; + if(prevV != null) { + prevV.zero(); + if(_this9.sizeVec3 == _this9.stackVec3.length) { + var newLength = _this9.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g2 = 0; + var _g11 = _this9.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray[i1] = _this9.stackVec3[i1]; + _this9.stackVec3[i1] = null; + } + _this9.stackVec3 = newArray; + } + _this9.stackVec3[_this9.sizeVec3++] = prevV; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this9.sizeMat3 == _this9.stackMat3.length) { + var newLength1 = _this9.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g3 = 0; + var _g12 = _this9.sizeMat3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray1[i2] = _this9.stackMat3[i2]; + _this9.stackMat3[i2] = null; + } + _this9.stackMat3 = newArray1; + } + _this9.stackMat3[_this9.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this9.sizeMat4 == _this9.stackMat4.length) { + var newLength2 = _this9.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g4 = 0; + var _g13 = _this9.sizeMat4; + while(_g4 < _g13) { + var i3 = _g4++; + newArray2[i3] = _this9.stackMat4[i3]; + _this9.stackMat4[i3] = null; + } + _this9.stackMat4 = newArray2; + } + _this9.stackMat4[_this9.sizeMat4++] = mat4; + } + if(quat != null) { + var tx6 = 0; + var ty6 = 0; + var tz6 = 0; + var tw = 1; + quat.x = tx6; + quat.y = ty6; + quat.z = tz6; + quat.w = tw; + if(_this9.sizeQuat == _this9.stackQuat.length) { + var newLength3 = _this9.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g5 = 0; + var _g14 = _this9.sizeQuat; + while(_g5 < _g14) { + var i4 = _g5++; + newArray3[i4] = _this9.stackQuat[i4]; + _this9.stackQuat[i4] = null; + } + _this9.stackQuat = newArray3; + } + _this9.stackQuat[_this9.sizeQuat++] = quat; + } + prevV = v; + theta += dTheta; + } + var _this10 = this._pool; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(rotVec != null) { + rotVec.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newLength4 = _this10.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g6 = 0; + var _g15 = _this10.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray4[i5] = _this10.stackVec3[i5]; + _this10.stackVec3[i5] = null; + } + _this10.stackVec3 = newArray4; + } + _this10.stackVec3[_this10.sizeVec3++] = rotVec; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this10.sizeMat3 == _this10.stackMat3.length) { + var newLength5 = _this10.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g7 = 0; + var _g16 = _this10.sizeMat3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray5[i6] = _this10.stackMat3[i6]; + _this10.stackMat3[i6] = null; + } + _this10.stackMat3 = newArray5; + } + _this10.stackMat3[_this10.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this10.sizeMat4 == _this10.stackMat4.length) { + var newLength6 = _this10.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g8 = 0; + var _g17 = _this10.sizeMat4; + while(_g8 < _g17) { + var i7 = _g8++; + newArray6[i7] = _this10.stackMat4[i7]; + _this10.stackMat4[i7] = null; + } + _this10.stackMat4 = newArray6; + } + _this10.stackMat4[_this10.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx7 = 0; + var ty7 = 0; + var tz7 = 0; + var tw1 = 1; + quat1.x = tx7; + quat1.y = ty7; + quat1.z = tz7; + quat1.w = tw1; + if(_this10.sizeQuat == _this10.stackQuat.length) { + var newLength7 = _this10.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g9 = 0; + var _g18 = _this10.sizeQuat; + while(_g9 < _g18) { + var i8 = _g9++; + newArray7[i8] = _this10.stackQuat[i8]; + _this10.stackQuat[i8] = null; + } + _this10.stackQuat = newArray7; + } + _this10.stackQuat[_this10.sizeQuat++] = quat1; + } + var _this11 = this._pool; + var vec3 = null; + var mat32 = null; + var mat42 = null; + if(vec3 != null) { + vec3.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newLength8 = _this11.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g10 = 0; + var _g19 = _this11.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray8[i9] = _this11.stackVec3[i9]; + _this11.stackVec3[i9] = null; + } + _this11.stackVec3 = newArray8; + } + _this11.stackVec3[_this11.sizeVec3++] = vec3; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this11.sizeMat3 == _this11.stackMat3.length) { + var newLength9 = _this11.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g20 = 0; + var _g110 = _this11.sizeMat3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray9[i10] = _this11.stackMat3[i10]; + _this11.stackMat3[i10] = null; + } + _this11.stackMat3 = newArray9; + } + _this11.stackMat3[_this11.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this11.sizeMat4 == _this11.stackMat4.length) { + var newLength10 = _this11.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g21 = 0; + var _g111 = _this11.sizeMat4; + while(_g21 < _g111) { + var i11 = _g21++; + newArray10[i11] = _this11.stackMat4[i11]; + _this11.stackMat4[i11] = null; + } + _this11.stackMat4 = newArray10; + } + _this11.stackMat4[_this11.sizeMat4++] = mat42; + } + if(rotQ != null) { + var tx8 = 0; + var ty8 = 0; + var tz8 = 0; + var tw2 = 1; + rotQ.x = tx8; + rotQ.y = ty8; + rotQ.z = tz8; + rotQ.w = tw2; + if(_this11.sizeQuat == _this11.stackQuat.length) { + var newLength11 = _this11.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g22 = 0; + var _g112 = _this11.sizeQuat; + while(_g22 < _g112) { + var i12 = _g22++; + newArray11[i12] = _this11.stackQuat[i12]; + _this11.stackQuat[i12] = null; + } + _this11.stackQuat = newArray11; + } + _this11.stackQuat[_this11.sizeQuat++] = rotQ; + } + var _this12 = this._pool; + var vec31 = null; + var mat43 = null; + var quat2 = null; + if(vec31 != null) { + vec31.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newLength12 = _this12.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g23 = 0; + var _g113 = _this12.sizeVec3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray12[i13] = _this12.stackVec3[i13]; + _this12.stackVec3[i13] = null; + } + _this12.stackVec3 = newArray12; + } + _this12.stackVec3[_this12.sizeVec3++] = vec31; + } + if(rotM != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + rotM.e00 = t006; + rotM.e01 = t016; + rotM.e02 = t026; + rotM.e10 = t106; + rotM.e11 = t116; + rotM.e12 = t126; + rotM.e20 = t206; + rotM.e21 = t216; + rotM.e22 = t226; + if(_this12.sizeMat3 == _this12.stackMat3.length) { + var newLength13 = _this12.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g24 = 0; + var _g114 = _this12.sizeMat3; + while(_g24 < _g114) { + var i14 = _g24++; + newArray13[i14] = _this12.stackMat3[i14]; + _this12.stackMat3[i14] = null; + } + _this12.stackMat3 = newArray13; + } + _this12.stackMat3[_this12.sizeMat3++] = rotM; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this12.sizeMat4 == _this12.stackMat4.length) { + var newLength14 = _this12.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g25 = 0; + var _g115 = _this12.sizeMat4; + while(_g25 < _g115) { + var i15 = _g25++; + newArray14[i15] = _this12.stackMat4[i15]; + _this12.stackMat4[i15] = null; + } + _this12.stackMat4 = newArray14; + } + _this12.stackMat4[_this12.sizeMat4++] = mat43; + } + if(quat2 != null) { + var tx9 = 0; + var ty9 = 0; + var tz9 = 0; + var tw3 = 1; + quat2.x = tx9; + quat2.y = ty9; + quat2.z = tz9; + quat2.w = tw3; + if(_this12.sizeQuat == _this12.stackQuat.length) { + var newLength15 = _this12.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g26 = 0; + var _g116 = _this12.sizeQuat; + while(_g26 < _g116) { + var i16 = _g26++; + newArray15[i16] = _this12.stackQuat[i16]; + _this12.stackQuat[i16] = null; + } + _this12.stackQuat = newArray15; + } + _this12.stackQuat[_this12.sizeQuat++] = quat2; + } + var _this13 = this._pool; + var mat33 = null; + var mat44 = null; + var quat3 = null; + if(prevV != null) { + prevV.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newLength16 = _this13.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g27 = 0; + var _g117 = _this13.sizeVec3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray16[i17] = _this13.stackVec3[i17]; + _this13.stackVec3[i17] = null; + } + _this13.stackVec3 = newArray16; + } + _this13.stackVec3[_this13.sizeVec3++] = prevV; + } + if(mat33 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat33.e00 = t008; + mat33.e01 = t018; + mat33.e02 = t028; + mat33.e10 = t108; + mat33.e11 = t118; + mat33.e12 = t128; + mat33.e20 = t208; + mat33.e21 = t218; + mat33.e22 = t228; + if(_this13.sizeMat3 == _this13.stackMat3.length) { + var newLength17 = _this13.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g28 = 0; + var _g118 = _this13.sizeMat3; + while(_g28 < _g118) { + var i18 = _g28++; + newArray17[i18] = _this13.stackMat3[i18]; + _this13.stackMat3[i18] = null; + } + _this13.stackMat3 = newArray17; + } + _this13.stackMat3[_this13.sizeMat3++] = mat33; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this13.sizeMat4 == _this13.stackMat4.length) { + var newLength18 = _this13.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g29 = 0; + var _g119 = _this13.sizeMat4; + while(_g29 < _g119) { + var i19 = _g29++; + newArray18[i19] = _this13.stackMat4[i19]; + _this13.stackMat4[i19] = null; + } + _this13.stackMat4 = newArray18; + } + _this13.stackMat4[_this13.sizeMat4++] = mat44; + } + if(quat3 != null) { + var tx10 = 0; + var ty10 = 0; + var tz10 = 0; + var tw4 = 1; + quat3.x = tx10; + quat3.y = ty10; + quat3.z = tz10; + quat3.w = tw4; + if(_this13.sizeQuat == _this13.stackQuat.length) { + var newLength19 = _this13.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g30 = 0; + var _g120 = _this13.sizeQuat; + while(_g30 < _g120) { + var i20 = _g30++; + newArray19[i20] = _this13.stackQuat[i20]; + _this13.stackQuat[i20] = null; + } + _this13.stackQuat = newArray19; + } + _this13.stackQuat[_this13.sizeQuat++] = quat3; + } + } + step(timeStep) { + if(this._timeStep.dt > 0) { + this._timeStep.dtRatio = timeStep / this._timeStep.dt; + } + this._timeStep.dt = timeStep; + this._timeStep.invDt = 1 / timeStep; + var st = Date.now() / 1000; + this._updateContacts(); + this._solveIslands(); + var en = Date.now() / 1000; + oimo.dynamics.common.Performance.totalTime = (en - st) * 1000; + } + addRigidBody(rigidBody) { + if(rigidBody._world != null) { + throw new Error("A rigid body cannot belong to multiple worlds."); + } + if(this._rigidBodyList == null) { + this._rigidBodyList = rigidBody; + this._rigidBodyListLast = rigidBody; + } else { + this._rigidBodyListLast._next = rigidBody; + rigidBody._prev = this._rigidBodyListLast; + this._rigidBodyListLast = rigidBody; + } + rigidBody._world = this; + var s = rigidBody._shapeList; + while(s != null) { + var n = s._next; + s._proxy = this._broadPhase.createProxy(s,s._aabb); + s._id = this._shapeIdCount++; + this._numShapes++; + s = n; + } + this._numRigidBodies++; + } + removeRigidBody(rigidBody) { + if(rigidBody._world != this) { + throw new Error("The rigid body doesn't belong to the world."); + } + var prev = rigidBody._prev; + var next = rigidBody._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(rigidBody == this._rigidBodyList) { + this._rigidBodyList = this._rigidBodyList._next; + } + if(rigidBody == this._rigidBodyListLast) { + this._rigidBodyListLast = this._rigidBodyListLast._prev; + } + rigidBody._next = null; + rigidBody._prev = null; + rigidBody._world = null; + var s = rigidBody._shapeList; + while(s != null) { + var n = s._next; + this._broadPhase.destroyProxy(s._proxy); + s._proxy = null; + s._id = -1; + var cl = s._rigidBody._contactLinkList; + while(cl != null) { + var n1 = cl._next; + var c = cl._contact; + if(c._s1 == s || c._s2 == s) { + var _this = cl._other; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = this._contactManager; + var prev1 = c._prev; + var next1 = c._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c == _this1._contactList) { + _this1._contactList = _this1._contactList._next; + } + if(c == _this1._contactListLast) { + _this1._contactListLast = _this1._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc1 = c._s1._contactCallback; + var cc2 = c._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } + } + var prev2 = c._link1._prev; + var next2 = c._link1._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev3 = c._link2._prev; + var next3 = c._link2._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this2 = c._contactConstraint; + _this2._s1 = null; + _this2._s2 = null; + _this2._b1 = null; + _this2._b2 = null; + _this2._tf1 = null; + _this2._tf2 = null; + c._next = _this1._contactPool; + _this1._contactPool = c; + _this1._numContacts--; + } + cl = n1; + } + this._numShapes--; + s = n; + } + this._numRigidBodies--; + } + addJoint(joint) { + if(joint._world != null) { + throw new Error("A joint cannot belong to multiple worlds."); + } + if(this._jointList == null) { + this._jointList = joint; + this._jointListLast = joint; + } else { + this._jointListLast._next = joint; + joint._prev = this._jointListLast; + this._jointListLast = joint; + } + joint._world = this; + joint._link1._other = joint._b2; + joint._link2._other = joint._b1; + if(joint._b1._jointLinkList == null) { + joint._b1._jointLinkList = joint._link1; + joint._b1._jointLinkListLast = joint._link1; + } else { + joint._b1._jointLinkListLast._next = joint._link1; + joint._link1._prev = joint._b1._jointLinkListLast; + joint._b1._jointLinkListLast = joint._link1; + } + if(joint._b2._jointLinkList == null) { + joint._b2._jointLinkList = joint._link2; + joint._b2._jointLinkListLast = joint._link2; + } else { + joint._b2._jointLinkListLast._next = joint._link2; + joint._link2._prev = joint._b2._jointLinkListLast; + joint._b2._jointLinkListLast = joint._link2; + } + joint._b1._numJointLinks++; + joint._b2._numJointLinks++; + var _this = joint._b1; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = joint._b2; + _this1._sleeping = false; + _this1._sleepTime = 0; + joint._syncAnchors(); + this._numJoints++; + } + removeJoint(joint) { + if(joint._world != this) { + throw new Error("The joint doesn't belong to the world."); + } + var prev = joint._prev; + var next = joint._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(joint == this._jointList) { + this._jointList = this._jointList._next; + } + if(joint == this._jointListLast) { + this._jointListLast = this._jointListLast._prev; + } + joint._next = null; + joint._prev = null; + joint._world = null; + var prev1 = joint._link1._prev; + var next1 = joint._link1._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(joint._link1 == joint._b1._jointLinkList) { + joint._b1._jointLinkList = joint._b1._jointLinkList._next; + } + if(joint._link1 == joint._b1._jointLinkListLast) { + joint._b1._jointLinkListLast = joint._b1._jointLinkListLast._prev; + } + joint._link1._next = null; + joint._link1._prev = null; + var prev2 = joint._link2._prev; + var next2 = joint._link2._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(joint._link2 == joint._b2._jointLinkList) { + joint._b2._jointLinkList = joint._b2._jointLinkList._next; + } + if(joint._link2 == joint._b2._jointLinkListLast) { + joint._b2._jointLinkListLast = joint._b2._jointLinkListLast._prev; + } + joint._link2._next = null; + joint._link2._prev = null; + joint._link1._other = null; + joint._link2._other = null; + joint._b1._numJointLinks--; + joint._b2._numJointLinks--; + var _this = joint._b1; + _this._sleeping = false; + _this._sleepTime = 0; + var _this1 = joint._b2; + _this1._sleeping = false; + _this1._sleepTime = 0; + this._numJoints--; + } + setDebugDraw(debugDraw) { + this._debugDraw = debugDraw; + } + getDebugDraw() { + return this._debugDraw; + } + debugDraw() { + if(this._debugDraw != null) { + if(this._broadPhase._type == 2) { + var bvhBroadPhase = this._broadPhase; + this._drawBvh(this._debugDraw,bvhBroadPhase._tree); + } + this._drawRigidBodies(this._debugDraw); + this._drawConstraints(this._debugDraw); + } + } + rayCast(begin,end,callback) { + var _this = this._rayCastWrapper.begin; + _this.x = begin.x; + _this.y = begin.y; + _this.z = begin.z; + var _this1 = this._rayCastWrapper.end; + _this1.x = end.x; + _this1.y = end.y; + _this1.z = end.z; + this._rayCastWrapper.callback = callback; + this._broadPhase.rayCast(begin,end,this._rayCastWrapper); + } + convexCast(convex,begin,translation,callback) { + this._convexCastWrapper.convex = convex; + var _this = this._convexCastWrapper.begin; + _this._positionX = begin._positionX; + _this._positionY = begin._positionY; + _this._positionZ = begin._positionZ; + _this._rotation00 = begin._rotation00; + _this._rotation01 = begin._rotation01; + _this._rotation02 = begin._rotation02; + _this._rotation10 = begin._rotation10; + _this._rotation11 = begin._rotation11; + _this._rotation12 = begin._rotation12; + _this._rotation20 = begin._rotation20; + _this._rotation21 = begin._rotation21; + _this._rotation22 = begin._rotation22; + var _this1 = this._convexCastWrapper.translation; + _this1.x = translation.x; + _this1.y = translation.y; + _this1.z = translation.z; + this._convexCastWrapper.callback = callback; + this._broadPhase.convexCast(convex,begin,translation,this._convexCastWrapper); + } + aabbTest(aabb,callback) { + this._aabbTestWrapper._aabb.copyFrom(aabb); + this._aabbTestWrapper._callback = callback; + this._broadPhase.aabbTest(aabb,this._aabbTestWrapper); + } + getRigidBodyList() { + return this._rigidBodyList; + } + getJointList() { + return this._jointList; + } + getBroadPhase() { + return this._broadPhase; + } + getContactManager() { + return this._contactManager; + } + getNumRigidBodies() { + return this._numRigidBodies; + } + getNumJoints() { + return this._numJoints; + } + getNumShapes() { + return this._numShapes; + } + getNumIslands() { + return this._numIslands; + } + getNumVelocityIterations() { + return this._numVelocityIterations; + } + setNumVelocityIterations(numVelocityIterations) { + this._numVelocityIterations = numVelocityIterations; + } + getNumPositionIterations() { + return this._numPositionIterations; + } + setNumPositionIterations(numPositionIterations) { + this._numPositionIterations = numPositionIterations; + } + getGravity() { + return this._gravity; + } + setGravity(gravity) { + var _this = this._gravity; + _this.x = gravity.x; + _this.y = gravity.y; + _this.z = gravity.z; + } +} +if(!oimo.dynamics._World) oimo.dynamics._World = {}; +oimo.dynamics._World.RayCastWrapper = class oimo_dynamics__$World_RayCastWrapper extends oimo.collision.broadphase.BroadPhaseProxyCallback { + constructor() { + super(); + this.rayCastHit = new oimo.collision.geometry.RayCastHit(); + this.begin = new oimo.common.Vec3(); + this.end = new oimo.common.Vec3(); + this.callback = null; + } + process(proxy) { + var shape = proxy.userData; + if(shape._geom.rayCast(this.begin,this.end,shape._transform,this.rayCastHit)) { + this.callback.process(shape,this.rayCastHit); + } + } +} +oimo.dynamics._World.ConvexCastWrapper = class oimo_dynamics__$World_ConvexCastWrapper extends oimo.collision.broadphase.BroadPhaseProxyCallback { + constructor() { + super(); + this.rayCastHit = new oimo.collision.geometry.RayCastHit(); + this.begin = new oimo.common.Transform(); + this.translation = new oimo.common.Vec3(); + this.zero = new oimo.common.Vec3(); + this.callback = null; + this.convex = null; + } + process(proxy) { + var shape = proxy.userData; + var type = shape._geom._type; + if(type < 0 || type > 5) { + return; + } + var geom = shape._geom; + if(oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance.convexCast(this.convex,geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { + this.callback.process(shape,this.rayCastHit); + } + } +} +oimo.dynamics._World.AabbTestWrapper = class oimo_dynamics__$World_AabbTestWrapper extends oimo.collision.broadphase.BroadPhaseProxyCallback { + constructor() { + super(); + this._aabb = new oimo.collision.geometry.Aabb(); + this._callback = null; + } + process(proxy) { + var shape = proxy.userData; + var shapeAabb = shape._aabb; + if(shapeAabb._minX < this._aabb._maxX && shapeAabb._maxX > this._aabb._minX && shapeAabb._minY < this._aabb._maxY && shapeAabb._maxY > this._aabb._minY && shapeAabb._minZ < this._aabb._maxZ && shapeAabb._maxZ > this._aabb._minZ) { + this._callback.process(shape); + } + } +} +if(!oimo.dynamics.callback) oimo.dynamics.callback = {}; +oimo.dynamics.callback.AabbTestCallback = class oimo_dynamics_callback_AabbTestCallback { + constructor() { + } + process(shape) { + } +} +oimo.dynamics.callback.ContactCallback = class oimo_dynamics_callback_ContactCallback { + constructor() { + } + beginContact(c) { + } + preSolve(c) { + } + postSolve(c) { + } + endContact(c) { + } +} +oimo.dynamics.callback.RayCastCallback = class oimo_dynamics_callback_RayCastCallback { + constructor() { + } + process(shape,hit) { + } +} +oimo.dynamics.callback.RayCastClosest = class oimo_dynamics_callback_RayCastClosest extends oimo.dynamics.callback.RayCastCallback { + constructor() { + super(); + this.position = new oimo.common.Vec3(); + this.normal = new oimo.common.Vec3(); + this.shape = null; + this.fraction = 1; + this.position.zero(); + this.normal.zero(); + this.hit = false; + } + clear() { + this.shape = null; + this.fraction = 1; + this.position.zero(); + this.normal.zero(); + this.hit = false; + } + process(shape,hit) { + if(hit.fraction < this.fraction) { + this.shape = shape; + this.hit = true; + this.fraction = hit.fraction; + var _this = this.position; + var v = hit.position; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this1 = this.normal; + var v1 = hit.normal; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + } + } +} +if(!oimo.dynamics.common) oimo.dynamics.common = {}; +oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { + constructor() { + this.p = new oimo.common.Pool(); + this.wireframe = false; + this.drawShapes = true; + this.drawBvh = false; + this.drawBvhMinLevel = 0; + this.drawBvhMaxLevel = 65536; + this.drawAabbs = false; + this.drawBases = false; + this.drawPairs = false; + this.drawContacts = false; + this.drawJoints = true; + this.drawJointLimits = false; + var nt = 4; + var dt = 3.14159265358979 / nt; + var np = 8; + var dp = 6.28318530717958 / np; + var this1 = new Array(nt + 1); + this.sphereCoords = this1; + var this2 = new Array(nt + 1); + this.tmpSphereVerts = this2; + var this3 = new Array(nt + 1); + this.tmpSphereNorms = this3; + var _g = 0; + var _g1 = nt + 1; + while(_g < _g1) { + var i = _g++; + var num = i == 0 || i == nt ? 1 : np; + var this4 = this.sphereCoords; + var this5 = new Array(num); + this4[i] = this5; + var this6 = this.tmpSphereVerts; + var this7 = new Array(num); + this6[i] = this7; + var this8 = this.tmpSphereNorms; + var this9 = new Array(num); + this8[i] = this9; + var _g2 = 0; + var _g11 = np; + while(_g2 < _g11) { + var j = _g2++; + var theta = i * dt; + var phi = j * dp; + this.sphereCoords[i][j] = new oimo.common.Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); + this.tmpSphereVerts[i][j] = new oimo.common.Vec3(); + this.tmpSphereNorms[i][j] = new oimo.common.Vec3(); + } + } + var this10 = new Array(8); + this.circleCoords = this10; + var this11 = new Array(8); + this.circleCoordsShift = this11; + var this12 = new Array(8); + this.tmpCircleVerts1 = this12; + var this13 = new Array(8); + this.tmpCircleVerts2 = this13; + var this14 = new Array(8); + this.tmpCircleNorms = this14; + var td = 0.785398163397447502; + var _g3 = 0; + while(_g3 < 8) { + var i1 = _g3++; + this.circleCoords[i1] = new oimo.common.Vec3(Math.cos(i1 * td),0,-Math.sin(i1 * td)); + this.circleCoordsShift[i1] = new oimo.common.Vec3(Math.cos((i1 + 0.5) * td),0,-Math.sin((i1 + 0.5) * td)); + this.tmpCircleVerts1[i1] = new oimo.common.Vec3(); + this.tmpCircleVerts2[i1] = new oimo.common.Vec3(); + this.tmpCircleNorms[i1] = new oimo.common.Vec3(); + } + this.style = new oimo.dynamics.common.DebugDrawStyle(); + } + aabb(min,max,color) { + var _this = this.p; + var v1 = (_this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); + var _this1 = this.p; + var v2 = (_this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); + var _this2 = this.p; + var v3 = (_this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); + var _this3 = this.p; + var v4 = (_this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); + var _this4 = this.p; + var v5 = (_this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); + var _this5 = this.p; + var v6 = (_this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); + var _this6 = this.p; + var v7 = (_this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); + var _this7 = this.p; + var v8 = (_this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); + this.line(v1,v2,color); + this.line(v3,v4,color); + this.line(v5,v6,color); + this.line(v7,v8,color); + this.line(v1,v3,color); + this.line(v2,v4,color); + this.line(v5,v7,color); + this.line(v6,v8,color); + this.line(v1,v5,color); + this.line(v2,v6,color); + this.line(v3,v7,color); + this.line(v4,v8,color); + var _this8 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(v1 != null) { + v1.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newLength = _this8.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = v1; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this8.sizeMat3 == _this8.stackMat3.length) { + var newLength1 = _this8.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this8.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this8.stackMat3[i1]; + _this8.stackMat3[i1] = null; + } + _this8.stackMat3 = newArray1; + } + _this8.stackMat3[_this8.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this8.sizeMat4 == _this8.stackMat4.length) { + var newLength2 = _this8.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this8.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this8.stackMat4[i2]; + _this8.stackMat4[i2] = null; + } + _this8.stackMat4 = newArray2; + } + _this8.stackMat4[_this8.sizeMat4++] = mat4; + } + if(quat != null) { + var tx = 0; + var ty = 0; + var tz = 0; + var tw = 1; + quat.x = tx; + quat.y = ty; + quat.z = tz; + quat.w = tw; + if(_this8.sizeQuat == _this8.stackQuat.length) { + var newLength3 = _this8.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this8.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this8.stackQuat[i3]; + _this8.stackQuat[i3] = null; + } + _this8.stackQuat = newArray3; + } + _this8.stackQuat[_this8.sizeQuat++] = quat; + } + var _this9 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(v2 != null) { + v2.zero(); + if(_this9.sizeVec3 == _this9.stackVec3.length) { + var newLength4 = _this9.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this9.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this9.stackVec3[i4]; + _this9.stackVec3[i4] = null; + } + _this9.stackVec3 = newArray4; + } + _this9.stackVec3[_this9.sizeVec3++] = v2; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this9.sizeMat3 == _this9.stackMat3.length) { + var newLength5 = _this9.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this9.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this9.stackMat3[i5]; + _this9.stackMat3[i5] = null; + } + _this9.stackMat3 = newArray5; + } + _this9.stackMat3[_this9.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this9.sizeMat4 == _this9.stackMat4.length) { + var newLength6 = _this9.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this9.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this9.stackMat4[i6]; + _this9.stackMat4[i6] = null; + } + _this9.stackMat4 = newArray6; + } + _this9.stackMat4[_this9.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx1 = 0; + var ty1 = 0; + var tz1 = 0; + var tw1 = 1; + quat1.x = tx1; + quat1.y = ty1; + quat1.z = tz1; + quat1.w = tw1; + if(_this9.sizeQuat == _this9.stackQuat.length) { + var newLength7 = _this9.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this9.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this9.stackQuat[i7]; + _this9.stackQuat[i7] = null; + } + _this9.stackQuat = newArray7; + } + _this9.stackQuat[_this9.sizeQuat++] = quat1; + } + var _this10 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(v3 != null) { + v3.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newLength8 = _this10.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this10.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this10.stackVec3[i8]; + _this10.stackVec3[i8] = null; + } + _this10.stackVec3 = newArray8; + } + _this10.stackVec3[_this10.sizeVec3++] = v3; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this10.sizeMat3 == _this10.stackMat3.length) { + var newLength9 = _this10.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this10.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this10.stackMat3[i9]; + _this10.stackMat3[i9] = null; + } + _this10.stackMat3 = newArray9; + } + _this10.stackMat3[_this10.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this10.sizeMat4 == _this10.stackMat4.length) { + var newLength10 = _this10.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this10.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this10.stackMat4[i10]; + _this10.stackMat4[i10] = null; + } + _this10.stackMat4 = newArray10; + } + _this10.stackMat4[_this10.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx2 = 0; + var ty2 = 0; + var tz2 = 0; + var tw2 = 1; + quat2.x = tx2; + quat2.y = ty2; + quat2.z = tz2; + quat2.w = tw2; + if(_this10.sizeQuat == _this10.stackQuat.length) { + var newLength11 = _this10.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this10.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this10.stackQuat[i11]; + _this10.stackQuat[i11] = null; + } + _this10.stackQuat = newArray11; + } + _this10.stackQuat[_this10.sizeQuat++] = quat2; + } + var _this11 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(v4 != null) { + v4.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newLength12 = _this11.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this11.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this11.stackVec3[i12]; + _this11.stackVec3[i12] = null; + } + _this11.stackVec3 = newArray12; + } + _this11.stackVec3[_this11.sizeVec3++] = v4; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this11.sizeMat3 == _this11.stackMat3.length) { + var newLength13 = _this11.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this11.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this11.stackMat3[i13]; + _this11.stackMat3[i13] = null; + } + _this11.stackMat3 = newArray13; + } + _this11.stackMat3[_this11.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this11.sizeMat4 == _this11.stackMat4.length) { + var newLength14 = _this11.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this11.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this11.stackMat4[i14]; + _this11.stackMat4[i14] = null; + } + _this11.stackMat4 = newArray14; + } + _this11.stackMat4[_this11.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx3 = 0; + var ty3 = 0; + var tz3 = 0; + var tw3 = 1; + quat3.x = tx3; + quat3.y = ty3; + quat3.z = tz3; + quat3.w = tw3; + if(_this11.sizeQuat == _this11.stackQuat.length) { + var newLength15 = _this11.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this11.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this11.stackQuat[i15]; + _this11.stackQuat[i15] = null; + } + _this11.stackQuat = newArray15; + } + _this11.stackQuat[_this11.sizeQuat++] = quat3; + } + var _this12 = this.p; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(v5 != null) { + v5.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newLength16 = _this12.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g26 = 0; + var _g116 = _this12.sizeVec3; + while(_g26 < _g116) { + var i16 = _g26++; + newArray16[i16] = _this12.stackVec3[i16]; + _this12.stackVec3[i16] = null; + } + _this12.stackVec3 = newArray16; + } + _this12.stackVec3[_this12.sizeVec3++] = v5; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this12.sizeMat3 == _this12.stackMat3.length) { + var newLength17 = _this12.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g27 = 0; + var _g117 = _this12.sizeMat3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray17[i17] = _this12.stackMat3[i17]; + _this12.stackMat3[i17] = null; + } + _this12.stackMat3 = newArray17; + } + _this12.stackMat3[_this12.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this12.sizeMat4 == _this12.stackMat4.length) { + var newLength18 = _this12.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g28 = 0; + var _g118 = _this12.sizeMat4; + while(_g28 < _g118) { + var i18 = _g28++; + newArray18[i18] = _this12.stackMat4[i18]; + _this12.stackMat4[i18] = null; + } + _this12.stackMat4 = newArray18; + } + _this12.stackMat4[_this12.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx4 = 0; + var ty4 = 0; + var tz4 = 0; + var tw4 = 1; + quat4.x = tx4; + quat4.y = ty4; + quat4.z = tz4; + quat4.w = tw4; + if(_this12.sizeQuat == _this12.stackQuat.length) { + var newLength19 = _this12.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g29 = 0; + var _g119 = _this12.sizeQuat; + while(_g29 < _g119) { + var i19 = _g29++; + newArray19[i19] = _this12.stackQuat[i19]; + _this12.stackQuat[i19] = null; + } + _this12.stackQuat = newArray19; + } + _this12.stackQuat[_this12.sizeQuat++] = quat4; + } + var _this13 = this.p; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(v6 != null) { + v6.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newLength20 = _this13.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g30 = 0; + var _g120 = _this13.sizeVec3; + while(_g30 < _g120) { + var i20 = _g30++; + newArray20[i20] = _this13.stackVec3[i20]; + _this13.stackVec3[i20] = null; + } + _this13.stackVec3 = newArray20; + } + _this13.stackVec3[_this13.sizeVec3++] = v6; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this13.sizeMat3 == _this13.stackMat3.length) { + var newLength21 = _this13.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g31 = 0; + var _g121 = _this13.sizeMat3; + while(_g31 < _g121) { + var i21 = _g31++; + newArray21[i21] = _this13.stackMat3[i21]; + _this13.stackMat3[i21] = null; + } + _this13.stackMat3 = newArray21; + } + _this13.stackMat3[_this13.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this13.sizeMat4 == _this13.stackMat4.length) { + var newLength22 = _this13.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g32 = 0; + var _g122 = _this13.sizeMat4; + while(_g32 < _g122) { + var i22 = _g32++; + newArray22[i22] = _this13.stackMat4[i22]; + _this13.stackMat4[i22] = null; + } + _this13.stackMat4 = newArray22; + } + _this13.stackMat4[_this13.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx5 = 0; + var ty5 = 0; + var tz5 = 0; + var tw5 = 1; + quat5.x = tx5; + quat5.y = ty5; + quat5.z = tz5; + quat5.w = tw5; + if(_this13.sizeQuat == _this13.stackQuat.length) { + var newLength23 = _this13.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g33 = 0; + var _g123 = _this13.sizeQuat; + while(_g33 < _g123) { + var i23 = _g33++; + newArray23[i23] = _this13.stackQuat[i23]; + _this13.stackQuat[i23] = null; + } + _this13.stackQuat = newArray23; + } + _this13.stackQuat[_this13.sizeQuat++] = quat5; + } + var _this14 = this.p; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(v7 != null) { + v7.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newLength24 = _this14.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g34 = 0; + var _g124 = _this14.sizeVec3; + while(_g34 < _g124) { + var i24 = _g34++; + newArray24[i24] = _this14.stackVec3[i24]; + _this14.stackVec3[i24] = null; + } + _this14.stackVec3 = newArray24; + } + _this14.stackVec3[_this14.sizeVec3++] = v7; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + var newLength25 = _this14.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g35 = 0; + var _g125 = _this14.sizeMat3; + while(_g35 < _g125) { + var i25 = _g35++; + newArray25[i25] = _this14.stackMat3[i25]; + _this14.stackMat3[i25] = null; + } + _this14.stackMat3 = newArray25; + } + _this14.stackMat3[_this14.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this14.sizeMat4 == _this14.stackMat4.length) { + var newLength26 = _this14.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g36 = 0; + var _g126 = _this14.sizeMat4; + while(_g36 < _g126) { + var i26 = _g36++; + newArray26[i26] = _this14.stackMat4[i26]; + _this14.stackMat4[i26] = null; + } + _this14.stackMat4 = newArray26; + } + _this14.stackMat4[_this14.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx6 = 0; + var ty6 = 0; + var tz6 = 0; + var tw6 = 1; + quat6.x = tx6; + quat6.y = ty6; + quat6.z = tz6; + quat6.w = tw6; + if(_this14.sizeQuat == _this14.stackQuat.length) { + var newLength27 = _this14.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g37 = 0; + var _g127 = _this14.sizeQuat; + while(_g37 < _g127) { + var i27 = _g37++; + newArray27[i27] = _this14.stackQuat[i27]; + _this14.stackQuat[i27] = null; + } + _this14.stackQuat = newArray27; + } + _this14.stackQuat[_this14.sizeQuat++] = quat6; + } + var _this15 = this.p; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(v8 != null) { + v8.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newLength28 = _this15.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g38 = 0; + var _g128 = _this15.sizeVec3; + while(_g38 < _g128) { + var i28 = _g38++; + newArray28[i28] = _this15.stackVec3[i28]; + _this15.stackVec3[i28] = null; + } + _this15.stackVec3 = newArray28; + } + _this15.stackVec3[_this15.sizeVec3++] = v8; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this15.sizeMat3 == _this15.stackMat3.length) { + var newLength29 = _this15.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g39 = 0; + var _g129 = _this15.sizeMat3; + while(_g39 < _g129) { + var i29 = _g39++; + newArray29[i29] = _this15.stackMat3[i29]; + _this15.stackMat3[i29] = null; + } + _this15.stackMat3 = newArray29; + } + _this15.stackMat3[_this15.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this15.sizeMat4 == _this15.stackMat4.length) { + var newLength30 = _this15.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g40 = 0; + var _g130 = _this15.sizeMat4; + while(_g40 < _g130) { + var i30 = _g40++; + newArray30[i30] = _this15.stackMat4[i30]; + _this15.stackMat4[i30] = null; + } + _this15.stackMat4 = newArray30; + } + _this15.stackMat4[_this15.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx7 = 0; + var ty7 = 0; + var tz7 = 0; + var tw7 = 1; + quat7.x = tx7; + quat7.y = ty7; + quat7.z = tz7; + quat7.w = tw7; + if(_this15.sizeQuat == _this15.stackQuat.length) { + var newLength31 = _this15.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g41 = 0; + var _g131 = _this15.sizeQuat; + while(_g41 < _g131) { + var i31 = _g41++; + newArray31[i31] = _this15.stackQuat[i31]; + _this15.stackQuat[i31] = null; + } + _this15.stackQuat = newArray31; + } + _this15.stackQuat[_this15.sizeQuat++] = quat7; + } + } + basis(transform,length,colorX,colorY,colorZ) { + var _this = this.p; + var pos = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var rot = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + var _this2 = this.p; + var ex = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var ey = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var ez = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var v = pos; + v.x = transform._positionX; + v.y = transform._positionY; + v.z = transform._positionZ; + var m = rot; + m.e00 = transform._rotation00; + m.e01 = transform._rotation01; + m.e02 = transform._rotation02; + m.e10 = transform._rotation10; + m.e11 = transform._rotation11; + m.e12 = transform._rotation12; + m.e20 = transform._rotation20; + m.e21 = transform._rotation21; + m.e22 = transform._rotation22; + ex.init(rot.e00,rot.e10,rot.e20); + ey.init(rot.e01,rot.e11,rot.e21); + ez.init(rot.e02,rot.e12,rot.e22); + var tx = ex.x * length; + var ty = ex.y * length; + var tz = ex.z * length; + ex.x = tx; + ex.y = ty; + ex.z = tz; + var _this5 = ex; + var tx1 = _this5.x + pos.x; + var ty1 = _this5.y + pos.y; + var tz1 = _this5.z + pos.z; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + var tx2 = ey.x * length; + var ty2 = ey.y * length; + var tz2 = ey.z * length; + ey.x = tx2; + ey.y = ty2; + ey.z = tz2; + var _this6 = ey; + var tx3 = _this6.x + pos.x; + var ty3 = _this6.y + pos.y; + var tz3 = _this6.z + pos.z; + _this6.x = tx3; + _this6.y = ty3; + _this6.z = tz3; + var tx4 = ez.x * length; + var ty4 = ez.y * length; + var tz4 = ez.z * length; + ez.x = tx4; + ez.y = ty4; + ez.z = tz4; + var _this7 = ez; + var tx5 = _this7.x + pos.x; + var ty5 = _this7.y + pos.y; + var tz5 = _this7.z + pos.z; + _this7.x = tx5; + _this7.y = ty5; + _this7.z = tz5; + this.line(pos,ex,colorX); + this.line(pos,ey,colorY); + this.line(pos,ez,colorZ); + var _this8 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(pos != null) { + pos.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newLength = _this8.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = pos; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this8.sizeMat3 == _this8.stackMat3.length) { + var newLength1 = _this8.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this8.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this8.stackMat3[i1]; + _this8.stackMat3[i1] = null; + } + _this8.stackMat3 = newArray1; + } + _this8.stackMat3[_this8.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this8.sizeMat4 == _this8.stackMat4.length) { + var newLength2 = _this8.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this8.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this8.stackMat4[i2]; + _this8.stackMat4[i2] = null; + } + _this8.stackMat4 = newArray2; + } + _this8.stackMat4[_this8.sizeMat4++] = mat4; + } + if(quat != null) { + var tx6 = 0; + var ty6 = 0; + var tz6 = 0; + var tw = 1; + quat.x = tx6; + quat.y = ty6; + quat.z = tz6; + quat.w = tw; + if(_this8.sizeQuat == _this8.stackQuat.length) { + var newLength3 = _this8.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this8.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this8.stackQuat[i3]; + _this8.stackQuat[i3] = null; + } + _this8.stackQuat = newArray3; + } + _this8.stackQuat[_this8.sizeQuat++] = quat; + } + var _this9 = this.p; + var vec3 = null; + var mat41 = null; + var quat1 = null; + if(vec3 != null) { + vec3.zero(); + if(_this9.sizeVec3 == _this9.stackVec3.length) { + var newLength4 = _this9.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this9.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this9.stackVec3[i4]; + _this9.stackVec3[i4] = null; + } + _this9.stackVec3 = newArray4; + } + _this9.stackVec3[_this9.sizeVec3++] = vec3; + } + if(rot != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + rot.e00 = t002; + rot.e01 = t012; + rot.e02 = t022; + rot.e10 = t102; + rot.e11 = t112; + rot.e12 = t122; + rot.e20 = t202; + rot.e21 = t212; + rot.e22 = t222; + if(_this9.sizeMat3 == _this9.stackMat3.length) { + var newLength5 = _this9.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this9.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this9.stackMat3[i5]; + _this9.stackMat3[i5] = null; + } + _this9.stackMat3 = newArray5; + } + _this9.stackMat3[_this9.sizeMat3++] = rot; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this9.sizeMat4 == _this9.stackMat4.length) { + var newLength6 = _this9.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this9.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this9.stackMat4[i6]; + _this9.stackMat4[i6] = null; + } + _this9.stackMat4 = newArray6; + } + _this9.stackMat4[_this9.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx7 = 0; + var ty7 = 0; + var tz7 = 0; + var tw1 = 1; + quat1.x = tx7; + quat1.y = ty7; + quat1.z = tz7; + quat1.w = tw1; + if(_this9.sizeQuat == _this9.stackQuat.length) { + var newLength7 = _this9.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this9.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this9.stackQuat[i7]; + _this9.stackQuat[i7] = null; + } + _this9.stackQuat = newArray7; + } + _this9.stackQuat[_this9.sizeQuat++] = quat1; + } + var _this10 = this.p; + var mat31 = null; + var mat42 = null; + var quat2 = null; + if(ex != null) { + ex.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newLength8 = _this10.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this10.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this10.stackVec3[i8]; + _this10.stackVec3[i8] = null; + } + _this10.stackVec3 = newArray8; + } + _this10.stackVec3[_this10.sizeVec3++] = ex; + } + if(mat31 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat31.e00 = t004; + mat31.e01 = t014; + mat31.e02 = t024; + mat31.e10 = t104; + mat31.e11 = t114; + mat31.e12 = t124; + mat31.e20 = t204; + mat31.e21 = t214; + mat31.e22 = t224; + if(_this10.sizeMat3 == _this10.stackMat3.length) { + var newLength9 = _this10.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this10.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this10.stackMat3[i9]; + _this10.stackMat3[i9] = null; + } + _this10.stackMat3 = newArray9; + } + _this10.stackMat3[_this10.sizeMat3++] = mat31; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this10.sizeMat4 == _this10.stackMat4.length) { + var newLength10 = _this10.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this10.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this10.stackMat4[i10]; + _this10.stackMat4[i10] = null; + } + _this10.stackMat4 = newArray10; + } + _this10.stackMat4[_this10.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx8 = 0; + var ty8 = 0; + var tz8 = 0; + var tw2 = 1; + quat2.x = tx8; + quat2.y = ty8; + quat2.z = tz8; + quat2.w = tw2; + if(_this10.sizeQuat == _this10.stackQuat.length) { + var newLength11 = _this10.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this10.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this10.stackQuat[i11]; + _this10.stackQuat[i11] = null; + } + _this10.stackQuat = newArray11; + } + _this10.stackQuat[_this10.sizeQuat++] = quat2; + } + var _this11 = this.p; + var mat32 = null; + var mat43 = null; + var quat3 = null; + if(ey != null) { + ey.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newLength12 = _this11.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this11.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this11.stackVec3[i12]; + _this11.stackVec3[i12] = null; + } + _this11.stackVec3 = newArray12; + } + _this11.stackVec3[_this11.sizeVec3++] = ey; + } + if(mat32 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat32.e00 = t006; + mat32.e01 = t016; + mat32.e02 = t026; + mat32.e10 = t106; + mat32.e11 = t116; + mat32.e12 = t126; + mat32.e20 = t206; + mat32.e21 = t216; + mat32.e22 = t226; + if(_this11.sizeMat3 == _this11.stackMat3.length) { + var newLength13 = _this11.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this11.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this11.stackMat3[i13]; + _this11.stackMat3[i13] = null; + } + _this11.stackMat3 = newArray13; + } + _this11.stackMat3[_this11.sizeMat3++] = mat32; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this11.sizeMat4 == _this11.stackMat4.length) { + var newLength14 = _this11.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this11.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this11.stackMat4[i14]; + _this11.stackMat4[i14] = null; + } + _this11.stackMat4 = newArray14; + } + _this11.stackMat4[_this11.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx9 = 0; + var ty9 = 0; + var tz9 = 0; + var tw3 = 1; + quat3.x = tx9; + quat3.y = ty9; + quat3.z = tz9; + quat3.w = tw3; + if(_this11.sizeQuat == _this11.stackQuat.length) { + var newLength15 = _this11.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this11.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this11.stackQuat[i15]; + _this11.stackQuat[i15] = null; + } + _this11.stackQuat = newArray15; + } + _this11.stackQuat[_this11.sizeQuat++] = quat3; + } + var _this12 = this.p; + var mat33 = null; + var mat44 = null; + var quat4 = null; + if(ez != null) { + ez.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + var newLength16 = _this12.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g26 = 0; + var _g116 = _this12.sizeVec3; + while(_g26 < _g116) { + var i16 = _g26++; + newArray16[i16] = _this12.stackVec3[i16]; + _this12.stackVec3[i16] = null; + } + _this12.stackVec3 = newArray16; + } + _this12.stackVec3[_this12.sizeVec3++] = ez; + } + if(mat33 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat33.e00 = t008; + mat33.e01 = t018; + mat33.e02 = t028; + mat33.e10 = t108; + mat33.e11 = t118; + mat33.e12 = t128; + mat33.e20 = t208; + mat33.e21 = t218; + mat33.e22 = t228; + if(_this12.sizeMat3 == _this12.stackMat3.length) { + var newLength17 = _this12.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g27 = 0; + var _g117 = _this12.sizeMat3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray17[i17] = _this12.stackMat3[i17]; + _this12.stackMat3[i17] = null; + } + _this12.stackMat3 = newArray17; + } + _this12.stackMat3[_this12.sizeMat3++] = mat33; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this12.sizeMat4 == _this12.stackMat4.length) { + var newLength18 = _this12.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g28 = 0; + var _g118 = _this12.sizeMat4; + while(_g28 < _g118) { + var i18 = _g28++; + newArray18[i18] = _this12.stackMat4[i18]; + _this12.stackMat4[i18] = null; + } + _this12.stackMat4 = newArray18; + } + _this12.stackMat4[_this12.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx10 = 0; + var ty10 = 0; + var tz10 = 0; + var tw4 = 1; + quat4.x = tx10; + quat4.y = ty10; + quat4.z = tz10; + quat4.w = tw4; + if(_this12.sizeQuat == _this12.stackQuat.length) { + var newLength19 = _this12.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g29 = 0; + var _g119 = _this12.sizeQuat; + while(_g29 < _g119) { + var i19 = _g29++; + newArray19[i19] = _this12.stackQuat[i19]; + _this12.stackQuat[i19] = null; + } + _this12.stackQuat = newArray19; + } + _this12.stackQuat[_this12.sizeQuat++] = quat4; + } + } + ellipse(center,ex,ey,radiusX,radiusY,color) { + this.arc(center,ex,ey,radiusX,radiusY,0,6.28318530717958,false,color); + } + arc(center,ex,ey,radiusX,radiusY,startAngle,endAngle,drawSector,color) { + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ex.x; + _this1.y = ex.y; + _this1.z = ex.z; + var _this2 = _this1; + var tx = _this2.x * radiusX; + var ty = _this2.y * radiusX; + var tz = _this2.z * radiusX; + _this2.x = tx; + _this2.y = ty; + _this2.z = tz; + ex = _this2; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = ey.x; + _this4.y = ey.y; + _this4.z = ey.z; + var _this5 = _this4; + var tx1 = _this5.x * radiusY; + var ty1 = _this5.y * radiusY; + var tz1 = _this5.z * radiusY; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + ey = _this5; + var step = 0.523598775598298372; + var angDiff = endAngle - startAngle; + if(angDiff < 0) { + angDiff = -angDiff; + } + var n = angDiff / step + 0.5 | 0; + if(n == 0) { + n = 1; + } + var theta = startAngle; + var dt = (endAngle - startAngle) / n; + var _this6 = this.p; + var _this7 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = center.x; + _this7.y = center.y; + _this7.z = center.z; + var _this8 = _this7; + var s = Math.cos(theta); + var tx2 = _this8.x + ex.x * s; + var ty2 = _this8.y + ex.y * s; + var tz2 = _this8.z + ex.z * s; + _this8.x = tx2; + _this8.y = ty2; + _this8.z = tz2; + var _this9 = _this8; + var s1 = Math.sin(theta); + var tx3 = _this9.x + ey.x * s1; + var ty3 = _this9.y + ey.y * s1; + var tz3 = _this9.z + ey.z * s1; + _this9.x = tx3; + _this9.y = ty3; + _this9.z = tz3; + var v = _this9; + var prevV = v; + if(drawSector) { + this.line(center,prevV,color); + } + var _g = 0; + var _g1 = n; + while(_g < _g1) { + var i = _g++; + theta += dt; + var _this10 = this.p; + var _this11 = _this10.sizeVec3 == 0 ? new oimo.common.Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = center.x; + _this11.y = center.y; + _this11.z = center.z; + var _this12 = _this11; + var s2 = Math.cos(theta); + var tx4 = _this12.x + ex.x * s2; + var ty4 = _this12.y + ex.y * s2; + var tz4 = _this12.z + ex.z * s2; + _this12.x = tx4; + _this12.y = ty4; + _this12.z = tz4; + var _this13 = _this12; + var s3 = Math.sin(theta); + var tx5 = _this13.x + ey.x * s3; + var ty5 = _this13.y + ey.y * s3; + var tz5 = _this13.z + ey.z * s3; + _this13.x = tx5; + _this13.y = ty5; + _this13.z = tz5; + var v1 = _this13; + var v2 = v1; + this.line(prevV,v2,color); + var _this14 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(prevV != null) { + prevV.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + var newLength = _this14.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g2 = 0; + var _g11 = _this14.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray[i1] = _this14.stackVec3[i1]; + _this14.stackVec3[i1] = null; + } + _this14.stackVec3 = newArray; + } + _this14.stackVec3[_this14.sizeVec3++] = prevV; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + var newLength1 = _this14.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g3 = 0; + var _g12 = _this14.sizeMat3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray1[i2] = _this14.stackMat3[i2]; + _this14.stackMat3[i2] = null; + } + _this14.stackMat3 = newArray1; + } + _this14.stackMat3[_this14.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this14.sizeMat4 == _this14.stackMat4.length) { + var newLength2 = _this14.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g4 = 0; + var _g13 = _this14.sizeMat4; + while(_g4 < _g13) { + var i3 = _g4++; + newArray2[i3] = _this14.stackMat4[i3]; + _this14.stackMat4[i3] = null; + } + _this14.stackMat4 = newArray2; + } + _this14.stackMat4[_this14.sizeMat4++] = mat4; + } + if(quat != null) { + var tx6 = 0; + var ty6 = 0; + var tz6 = 0; + var tw = 1; + quat.x = tx6; + quat.y = ty6; + quat.z = tz6; + quat.w = tw; + if(_this14.sizeQuat == _this14.stackQuat.length) { + var newLength3 = _this14.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g5 = 0; + var _g14 = _this14.sizeQuat; + while(_g5 < _g14) { + var i4 = _g5++; + newArray3[i4] = _this14.stackQuat[i4]; + _this14.stackQuat[i4] = null; + } + _this14.stackQuat = newArray3; + } + _this14.stackQuat[_this14.sizeQuat++] = quat; + } + prevV = v2; + } + if(drawSector) { + this.line(center,prevV,color); + } + var _this15 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(prevV != null) { + prevV.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + var newLength4 = _this15.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g6 = 0; + var _g15 = _this15.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray4[i5] = _this15.stackVec3[i5]; + _this15.stackVec3[i5] = null; + } + _this15.stackVec3 = newArray4; + } + _this15.stackVec3[_this15.sizeVec3++] = prevV; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this15.sizeMat3 == _this15.stackMat3.length) { + var newLength5 = _this15.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g7 = 0; + var _g16 = _this15.sizeMat3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray5[i6] = _this15.stackMat3[i6]; + _this15.stackMat3[i6] = null; + } + _this15.stackMat3 = newArray5; + } + _this15.stackMat3[_this15.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this15.sizeMat4 == _this15.stackMat4.length) { + var newLength6 = _this15.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g8 = 0; + var _g17 = _this15.sizeMat4; + while(_g8 < _g17) { + var i7 = _g8++; + newArray6[i7] = _this15.stackMat4[i7]; + _this15.stackMat4[i7] = null; + } + _this15.stackMat4 = newArray6; + } + _this15.stackMat4[_this15.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx7 = 0; + var ty7 = 0; + var tz7 = 0; + var tw1 = 1; + quat1.x = tx7; + quat1.y = ty7; + quat1.z = tz7; + quat1.w = tw1; + if(_this15.sizeQuat == _this15.stackQuat.length) { + var newLength7 = _this15.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g9 = 0; + var _g18 = _this15.sizeQuat; + while(_g9 < _g18) { + var i8 = _g9++; + newArray7[i8] = _this15.stackQuat[i8]; + _this15.stackQuat[i8] = null; + } + _this15.stackQuat = newArray7; + } + _this15.stackQuat[_this15.sizeQuat++] = quat1; + } + var _this16 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(ex != null) { + ex.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + var newLength8 = _this16.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g10 = 0; + var _g19 = _this16.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray8[i9] = _this16.stackVec3[i9]; + _this16.stackVec3[i9] = null; + } + _this16.stackVec3 = newArray8; + } + _this16.stackVec3[_this16.sizeVec3++] = ex; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this16.sizeMat3 == _this16.stackMat3.length) { + var newLength9 = _this16.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g20 = 0; + var _g110 = _this16.sizeMat3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray9[i10] = _this16.stackMat3[i10]; + _this16.stackMat3[i10] = null; + } + _this16.stackMat3 = newArray9; + } + _this16.stackMat3[_this16.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this16.sizeMat4 == _this16.stackMat4.length) { + var newLength10 = _this16.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g21 = 0; + var _g111 = _this16.sizeMat4; + while(_g21 < _g111) { + var i11 = _g21++; + newArray10[i11] = _this16.stackMat4[i11]; + _this16.stackMat4[i11] = null; + } + _this16.stackMat4 = newArray10; + } + _this16.stackMat4[_this16.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx8 = 0; + var ty8 = 0; + var tz8 = 0; + var tw2 = 1; + quat2.x = tx8; + quat2.y = ty8; + quat2.z = tz8; + quat2.w = tw2; + if(_this16.sizeQuat == _this16.stackQuat.length) { + var newLength11 = _this16.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g22 = 0; + var _g112 = _this16.sizeQuat; + while(_g22 < _g112) { + var i12 = _g22++; + newArray11[i12] = _this16.stackQuat[i12]; + _this16.stackQuat[i12] = null; + } + _this16.stackQuat = newArray11; + } + _this16.stackQuat[_this16.sizeQuat++] = quat2; + } + var _this17 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(ey != null) { + ey.zero(); + if(_this17.sizeVec3 == _this17.stackVec3.length) { + var newLength12 = _this17.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g23 = 0; + var _g113 = _this17.sizeVec3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray12[i13] = _this17.stackVec3[i13]; + _this17.stackVec3[i13] = null; + } + _this17.stackVec3 = newArray12; + } + _this17.stackVec3[_this17.sizeVec3++] = ey; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this17.sizeMat3 == _this17.stackMat3.length) { + var newLength13 = _this17.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g24 = 0; + var _g114 = _this17.sizeMat3; + while(_g24 < _g114) { + var i14 = _g24++; + newArray13[i14] = _this17.stackMat3[i14]; + _this17.stackMat3[i14] = null; + } + _this17.stackMat3 = newArray13; + } + _this17.stackMat3[_this17.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this17.sizeMat4 == _this17.stackMat4.length) { + var newLength14 = _this17.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g25 = 0; + var _g115 = _this17.sizeMat4; + while(_g25 < _g115) { + var i15 = _g25++; + newArray14[i15] = _this17.stackMat4[i15]; + _this17.stackMat4[i15] = null; + } + _this17.stackMat4 = newArray14; + } + _this17.stackMat4[_this17.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx9 = 0; + var ty9 = 0; + var tz9 = 0; + var tw3 = 1; + quat3.x = tx9; + quat3.y = ty9; + quat3.z = tz9; + quat3.w = tw3; + if(_this17.sizeQuat == _this17.stackQuat.length) { + var newLength15 = _this17.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g26 = 0; + var _g116 = _this17.sizeQuat; + while(_g26 < _g116) { + var i16 = _g26++; + newArray15[i16] = _this17.stackQuat[i16]; + _this17.stackQuat[i16] = null; + } + _this17.stackQuat = newArray15; + } + _this17.stackQuat[_this17.sizeQuat++] = quat3; + } + } + cone(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + var tx = _this7.x + ey.x * halfHeight; + var ty = _this7.y + ey.y * halfHeight; + var tz = _this7.z + ey.z * halfHeight; + _this7.x = tx; + _this7.y = ty; + _this7.z = tz; + var top = _this7; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + var s = -halfHeight; + var tx1 = _this10.x + ey.x * s; + var ty1 = _this10.y + ey.y * s; + var tz1 = _this10.z + ey.z * s; + _this10.x = tx1; + _this10.y = ty1; + _this10.z = tz1; + var bottom = _this10; + if(this.wireframe) { + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = bottom.x; + _this12.y = bottom.y; + _this12.z = bottom.z; + var _this13 = _this12; + var s1 = -radius; + var tx2 = _this13.x + ex.x * s1; + var ty2 = _this13.y + ex.y * s1; + var tz2 = _this13.z + ex.z * s1; + _this13.x = tx2; + _this13.y = ty2; + _this13.z = tz2; + var _this14 = _this13; + var tx3 = _this14.x + ez.x * 0; + var ty3 = _this14.y + ez.y * 0; + var tz3 = _this14.z + ez.z * 0; + _this14.x = tx3; + _this14.y = ty3; + _this14.z = tz3; + var bottom1 = _this14; + var _this15 = this.p; + var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = bottom.x; + _this16.y = bottom.y; + _this16.z = bottom.z; + var _this17 = _this16; + var tx4 = _this17.x + ex.x * radius; + var ty4 = _this17.y + ex.y * radius; + var tz4 = _this17.z + ex.z * radius; + _this17.x = tx4; + _this17.y = ty4; + _this17.z = tz4; + var _this18 = _this17; + var tx5 = _this18.x + ez.x * 0; + var ty5 = _this18.y + ez.y * 0; + var tz5 = _this18.z + ez.z * 0; + _this18.x = tx5; + _this18.y = ty5; + _this18.z = tz5; + var bottom2 = _this18; + var _this19 = this.p; + var _this20 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; + _this20.x = bottom.x; + _this20.y = bottom.y; + _this20.z = bottom.z; + var _this21 = _this20; + var tx6 = _this21.x + ex.x * 0; + var ty6 = _this21.y + ex.y * 0; + var tz6 = _this21.z + ex.z * 0; + _this21.x = tx6; + _this21.y = ty6; + _this21.z = tz6; + var _this22 = _this21; + var s2 = -radius; + var tx7 = _this22.x + ez.x * s2; + var ty7 = _this22.y + ez.y * s2; + var tz7 = _this22.z + ez.z * s2; + _this22.x = tx7; + _this22.y = ty7; + _this22.z = tz7; + var bottom3 = _this22; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = bottom.x; + _this24.y = bottom.y; + _this24.z = bottom.z; + var _this25 = _this24; + var tx8 = _this25.x + ex.x * 0; + var ty8 = _this25.y + ex.y * 0; + var tz8 = _this25.z + ex.z * 0; + _this25.x = tx8; + _this25.y = ty8; + _this25.z = tz8; + var _this26 = _this25; + var tx9 = _this26.x + ez.x * radius; + var ty9 = _this26.y + ez.y * radius; + var tz9 = _this26.z + ez.z * radius; + _this26.x = tx9; + _this26.y = ty9; + _this26.z = tz9; + var bottom4 = _this26; + this.ellipse(bottom,ex,ez,radius,radius,color); + this.line(top,bottom1,color); + this.line(top,bottom2,color); + this.line(top,bottom3,color); + this.line(top,bottom4,color); + var _this27 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(bottom1 != null) { + bottom1.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + var newLength = _this27.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this27.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; + } + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = bottom1; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this27.sizeMat3 == _this27.stackMat3.length) { + var newLength1 = _this27.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this27.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this27.stackMat3[i1]; + _this27.stackMat3[i1] = null; + } + _this27.stackMat3 = newArray1; + } + _this27.stackMat3[_this27.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this27.sizeMat4 == _this27.stackMat4.length) { + var newLength2 = _this27.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this27.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this27.stackMat4[i2]; + _this27.stackMat4[i2] = null; + } + _this27.stackMat4 = newArray2; + } + _this27.stackMat4[_this27.sizeMat4++] = mat4; + } + if(quat != null) { + var tx10 = 0; + var ty10 = 0; + var tz10 = 0; + var tw = 1; + quat.x = tx10; + quat.y = ty10; + quat.z = tz10; + quat.w = tw; + if(_this27.sizeQuat == _this27.stackQuat.length) { + var newLength3 = _this27.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this27.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this27.stackQuat[i3]; + _this27.stackQuat[i3] = null; + } + _this27.stackQuat = newArray3; + } + _this27.stackQuat[_this27.sizeQuat++] = quat; + } + var _this28 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(bottom2 != null) { + bottom2.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + var newLength4 = _this28.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this28.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this28.stackVec3[i4]; + _this28.stackVec3[i4] = null; + } + _this28.stackVec3 = newArray4; + } + _this28.stackVec3[_this28.sizeVec3++] = bottom2; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this28.sizeMat3 == _this28.stackMat3.length) { + var newLength5 = _this28.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this28.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this28.stackMat3[i5]; + _this28.stackMat3[i5] = null; + } + _this28.stackMat3 = newArray5; + } + _this28.stackMat3[_this28.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this28.sizeMat4 == _this28.stackMat4.length) { + var newLength6 = _this28.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this28.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this28.stackMat4[i6]; + _this28.stackMat4[i6] = null; + } + _this28.stackMat4 = newArray6; + } + _this28.stackMat4[_this28.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx11 = 0; + var ty11 = 0; + var tz11 = 0; + var tw1 = 1; + quat1.x = tx11; + quat1.y = ty11; + quat1.z = tz11; + quat1.w = tw1; + if(_this28.sizeQuat == _this28.stackQuat.length) { + var newLength7 = _this28.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this28.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this28.stackQuat[i7]; + _this28.stackQuat[i7] = null; + } + _this28.stackQuat = newArray7; + } + _this28.stackQuat[_this28.sizeQuat++] = quat1; + } + var _this29 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(bottom3 != null) { + bottom3.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + var newLength8 = _this29.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this29.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this29.stackVec3[i8]; + _this29.stackVec3[i8] = null; + } + _this29.stackVec3 = newArray8; + } + _this29.stackVec3[_this29.sizeVec3++] = bottom3; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this29.sizeMat3 == _this29.stackMat3.length) { + var newLength9 = _this29.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this29.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this29.stackMat3[i9]; + _this29.stackMat3[i9] = null; + } + _this29.stackMat3 = newArray9; + } + _this29.stackMat3[_this29.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this29.sizeMat4 == _this29.stackMat4.length) { + var newLength10 = _this29.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this29.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this29.stackMat4[i10]; + _this29.stackMat4[i10] = null; + } + _this29.stackMat4 = newArray10; + } + _this29.stackMat4[_this29.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx12 = 0; + var ty12 = 0; + var tz12 = 0; + var tw2 = 1; + quat2.x = tx12; + quat2.y = ty12; + quat2.z = tz12; + quat2.w = tw2; + if(_this29.sizeQuat == _this29.stackQuat.length) { + var newLength11 = _this29.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this29.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this29.stackQuat[i11]; + _this29.stackQuat[i11] = null; + } + _this29.stackQuat = newArray11; + } + _this29.stackQuat[_this29.sizeQuat++] = quat2; + } + var _this30 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(bottom4 != null) { + bottom4.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + var newLength12 = _this30.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this30.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this30.stackVec3[i12]; + _this30.stackVec3[i12] = null; + } + _this30.stackVec3 = newArray12; + } + _this30.stackVec3[_this30.sizeVec3++] = bottom4; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this30.sizeMat3 == _this30.stackMat3.length) { + var newLength13 = _this30.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this30.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this30.stackMat3[i13]; + _this30.stackMat3[i13] = null; + } + _this30.stackMat3 = newArray13; + } + _this30.stackMat3[_this30.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this30.sizeMat4 == _this30.stackMat4.length) { + var newLength14 = _this30.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this30.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this30.stackMat4[i14]; + _this30.stackMat4[i14] = null; + } + _this30.stackMat4 = newArray14; + } + _this30.stackMat4[_this30.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx13 = 0; + var ty13 = 0; + var tz13 = 0; + var tw3 = 1; + quat3.x = tx13; + quat3.y = ty13; + quat3.z = tz13; + quat3.w = tw3; + if(_this30.sizeQuat == _this30.stackQuat.length) { + var newLength15 = _this30.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this30.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this30.stackQuat[i15]; + _this30.stackQuat[i15] = null; + } + _this30.stackQuat = newArray15; + } + _this30.stackQuat[_this30.sizeQuat++] = quat3; + } + } else { + var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + var cos = 2 * halfHeight * invDenom; + var sin = radius * invDenom; + var invDenom2 = 1 / Math.sqrt(2 * (1 + cos)); + var _g26 = 0; + while(_g26 < 8) { + var i16 = _g26++; + var _this31 = this.tmpCircleNorms[i16]; + var v1 = this.circleCoords[i16]; + _this31.x = v1.x; + _this31.y = v1.y; + _this31.z = v1.z; + var _this32 = _this31; + var tx14 = _this32.x * cos; + var ty14 = _this32.y * cos; + var tz14 = _this32.z * cos; + _this32.x = tx14; + _this32.y = ty14; + _this32.z = tz14; + _this32.y += sin; + var _this33 = this.tmpCircleNorms[i16]; + var tx15 = _this33.x * m.e00 + _this33.y * m.e01 + _this33.z * m.e02; + var ty15 = _this33.x * m.e10 + _this33.y * m.e11 + _this33.z * m.e12; + var tz15 = _this33.x * m.e20 + _this33.y * m.e21 + _this33.z * m.e22; + _this33.x = tx15; + _this33.y = ty15; + _this33.z = tz15; + var _this34 = this.tmpCircleVerts1[i16]; + var v2 = this.circleCoordsShift[i16]; + _this34.x = v2.x; + _this34.y = v2.y; + _this34.z = v2.z; + var _this35 = _this34; + var tx16 = _this35.x * cos; + var ty16 = _this35.y * cos; + var tz16 = _this35.z * cos; + _this35.x = tx16; + _this35.y = ty16; + _this35.z = tz16; + _this35.y += sin; + var _this36 = this.tmpCircleVerts1[i16]; + var tx17 = _this36.x * m.e00 + _this36.y * m.e01 + _this36.z * m.e02; + var ty17 = _this36.x * m.e10 + _this36.y * m.e11 + _this36.z * m.e12; + var tz17 = _this36.x * m.e20 + _this36.y * m.e21 + _this36.z * m.e22; + _this36.x = tx17; + _this36.y = ty17; + _this36.z = tz17; + var _this37 = this.tmpCircleVerts2[i16]; + var v3 = this.circleCoords[i16]; + _this37.x = v3.x; + _this37.y = v3.y; + _this37.z = v3.z; + var _this38 = _this37; + var tx18 = _this38.x * m.e00 + _this38.y * m.e01 + _this38.z * m.e02; + var ty18 = _this38.x * m.e10 + _this38.y * m.e11 + _this38.z * m.e12; + var tz18 = _this38.x * m.e20 + _this38.y * m.e21 + _this38.z * m.e22; + _this38.x = tx18; + _this38.y = ty18; + _this38.z = tz18; + var _this39 = _this38; + var tx19 = _this39.x * radius; + var ty19 = _this39.y * radius; + var tz19 = _this39.z * radius; + _this39.x = tx19; + _this39.y = ty19; + _this39.z = tz19; + var _this40 = _this39; + var tx20 = _this40.x + o.x; + var ty20 = _this40.y + o.y; + var tz20 = _this40.z + o.z; + _this40.x = tx20; + _this40.y = ty20; + _this40.z = tz20; + var _this41 = this.tmpCircleVerts2[i16]; + var s3 = -halfHeight; + var tx21 = _this41.x + ey.x * s3; + var ty21 = _this41.y + ey.y * s3; + var tz21 = _this41.z + ey.z * s3; + _this41.x = tx21; + _this41.y = ty21; + _this41.z = tz21; + } + var _g116 = 0; + while(_g116 < 8) { + var i17 = _g116++; + var v11 = top; + var v21 = this.tmpCircleVerts2[i17]; + var v31 = this.tmpCircleVerts2[(i17 + 1) % 8]; + var n1 = this.tmpCircleVerts1[i17]; + var n2 = this.tmpCircleNorms[i17]; + var n3 = this.tmpCircleNorms[(i17 + 1) % 8]; + this.triangle(v11,v21,v31,n1,n2,n3,color); + v11 = bottom; + v21 = this.tmpCircleVerts2[(i17 + 1) % 8]; + v31 = this.tmpCircleVerts2[i17]; + var _this42 = this.p; + var _this43 = _this42.sizeVec3 == 0 ? new oimo.common.Vec3() : _this42.stackVec3[--_this42.sizeVec3]; + _this43.x = ey.x; + _this43.y = ey.y; + _this43.z = ey.z; + var _this44 = _this43; + var tx22 = -_this44.x; + var ty22 = -_this44.y; + var tz22 = -_this44.z; + _this44.x = tx22; + _this44.y = ty22; + _this44.z = tz22; + n1 = _this44; + this.triangle(v11,v21,v31,n1,n1,n1,color); + var _this45 = this.p; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(n1 != null) { + n1.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newLength16 = _this45.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g27 = 0; + var _g117 = _this45.sizeVec3; + while(_g27 < _g117) { + var i18 = _g27++; + newArray16[i18] = _this45.stackVec3[i18]; + _this45.stackVec3[i18] = null; + } + _this45.stackVec3 = newArray16; + } + _this45.stackVec3[_this45.sizeVec3++] = n1; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this45.sizeMat3 == _this45.stackMat3.length) { + var newLength17 = _this45.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g28 = 0; + var _g118 = _this45.sizeMat3; + while(_g28 < _g118) { + var i19 = _g28++; + newArray17[i19] = _this45.stackMat3[i19]; + _this45.stackMat3[i19] = null; + } + _this45.stackMat3 = newArray17; + } + _this45.stackMat3[_this45.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this45.sizeMat4 == _this45.stackMat4.length) { + var newLength18 = _this45.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g29 = 0; + var _g119 = _this45.sizeMat4; + while(_g29 < _g119) { + var i20 = _g29++; + newArray18[i20] = _this45.stackMat4[i20]; + _this45.stackMat4[i20] = null; + } + _this45.stackMat4 = newArray18; + } + _this45.stackMat4[_this45.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx23 = 0; + var ty23 = 0; + var tz23 = 0; + var tw4 = 1; + quat4.x = tx23; + quat4.y = ty23; + quat4.z = tz23; + quat4.w = tw4; + if(_this45.sizeQuat == _this45.stackQuat.length) { + var newLength19 = _this45.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g30 = 0; + var _g120 = _this45.sizeQuat; + while(_g30 < _g120) { + var i21 = _g30++; + newArray19[i21] = _this45.stackQuat[i21]; + _this45.stackQuat[i21] = null; + } + _this45.stackQuat = newArray19; + } + _this45.stackQuat[_this45.sizeQuat++] = quat4; + } + } + } + var _this46 = this.p; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(top != null) { + top.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newLength20 = _this46.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g31 = 0; + var _g121 = _this46.sizeVec3; + while(_g31 < _g121) { + var i22 = _g31++; + newArray20[i22] = _this46.stackVec3[i22]; + _this46.stackVec3[i22] = null; + } + _this46.stackVec3 = newArray20; + } + _this46.stackVec3[_this46.sizeVec3++] = top; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this46.sizeMat3 == _this46.stackMat3.length) { + var newLength21 = _this46.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g32 = 0; + var _g122 = _this46.sizeMat3; + while(_g32 < _g122) { + var i23 = _g32++; + newArray21[i23] = _this46.stackMat3[i23]; + _this46.stackMat3[i23] = null; + } + _this46.stackMat3 = newArray21; + } + _this46.stackMat3[_this46.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this46.sizeMat4 == _this46.stackMat4.length) { + var newLength22 = _this46.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g33 = 0; + var _g123 = _this46.sizeMat4; + while(_g33 < _g123) { + var i24 = _g33++; + newArray22[i24] = _this46.stackMat4[i24]; + _this46.stackMat4[i24] = null; + } + _this46.stackMat4 = newArray22; + } + _this46.stackMat4[_this46.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx24 = 0; + var ty24 = 0; + var tz24 = 0; + var tw5 = 1; + quat5.x = tx24; + quat5.y = ty24; + quat5.z = tz24; + quat5.w = tw5; + if(_this46.sizeQuat == _this46.stackQuat.length) { + var newLength23 = _this46.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g34 = 0; + var _g124 = _this46.sizeQuat; + while(_g34 < _g124) { + var i25 = _g34++; + newArray23[i25] = _this46.stackQuat[i25]; + _this46.stackQuat[i25] = null; + } + _this46.stackQuat = newArray23; + } + _this46.stackQuat[_this46.sizeQuat++] = quat5; + } + var _this47 = this.p; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(bottom != null) { + bottom.zero(); + if(_this47.sizeVec3 == _this47.stackVec3.length) { + var newLength24 = _this47.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g35 = 0; + var _g125 = _this47.sizeVec3; + while(_g35 < _g125) { + var i26 = _g35++; + newArray24[i26] = _this47.stackVec3[i26]; + _this47.stackVec3[i26] = null; + } + _this47.stackVec3 = newArray24; + } + _this47.stackVec3[_this47.sizeVec3++] = bottom; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this47.sizeMat3 == _this47.stackMat3.length) { + var newLength25 = _this47.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g36 = 0; + var _g126 = _this47.sizeMat3; + while(_g36 < _g126) { + var i27 = _g36++; + newArray25[i27] = _this47.stackMat3[i27]; + _this47.stackMat3[i27] = null; + } + _this47.stackMat3 = newArray25; + } + _this47.stackMat3[_this47.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this47.sizeMat4 == _this47.stackMat4.length) { + var newLength26 = _this47.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g37 = 0; + var _g127 = _this47.sizeMat4; + while(_g37 < _g127) { + var i28 = _g37++; + newArray26[i28] = _this47.stackMat4[i28]; + _this47.stackMat4[i28] = null; + } + _this47.stackMat4 = newArray26; + } + _this47.stackMat4[_this47.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx25 = 0; + var ty25 = 0; + var tz25 = 0; + var tw6 = 1; + quat6.x = tx25; + quat6.y = ty25; + quat6.z = tz25; + quat6.w = tw6; + if(_this47.sizeQuat == _this47.stackQuat.length) { + var newLength27 = _this47.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g38 = 0; + var _g128 = _this47.sizeQuat; + while(_g38 < _g128) { + var i29 = _g38++; + newArray27[i29] = _this47.stackQuat[i29]; + _this47.stackQuat[i29] = null; + } + _this47.stackQuat = newArray27; + } + _this47.stackQuat[_this47.sizeQuat++] = quat6; + } + var _this48 = this.p; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(o != null) { + o.zero(); + if(_this48.sizeVec3 == _this48.stackVec3.length) { + var newLength28 = _this48.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g39 = 0; + var _g129 = _this48.sizeVec3; + while(_g39 < _g129) { + var i30 = _g39++; + newArray28[i30] = _this48.stackVec3[i30]; + _this48.stackVec3[i30] = null; + } + _this48.stackVec3 = newArray28; + } + _this48.stackVec3[_this48.sizeVec3++] = o; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this48.sizeMat3 == _this48.stackMat3.length) { + var newLength29 = _this48.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g40 = 0; + var _g130 = _this48.sizeMat3; + while(_g40 < _g130) { + var i31 = _g40++; + newArray29[i31] = _this48.stackMat3[i31]; + _this48.stackMat3[i31] = null; + } + _this48.stackMat3 = newArray29; + } + _this48.stackMat3[_this48.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this48.sizeMat4 == _this48.stackMat4.length) { + var newLength30 = _this48.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g41 = 0; + var _g131 = _this48.sizeMat4; + while(_g41 < _g131) { + var i32 = _g41++; + newArray30[i32] = _this48.stackMat4[i32]; + _this48.stackMat4[i32] = null; + } + _this48.stackMat4 = newArray30; + } + _this48.stackMat4[_this48.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx26 = 0; + var ty26 = 0; + var tz26 = 0; + var tw7 = 1; + quat7.x = tx26; + quat7.y = ty26; + quat7.z = tz26; + quat7.w = tw7; + if(_this48.sizeQuat == _this48.stackQuat.length) { + var newLength31 = _this48.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g42 = 0; + var _g132 = _this48.sizeQuat; + while(_g42 < _g132) { + var i33 = _g42++; + newArray31[i33] = _this48.stackQuat[i33]; + _this48.stackQuat[i33] = null; + } + _this48.stackQuat = newArray31; + } + _this48.stackQuat[_this48.sizeQuat++] = quat7; + } + var _this49 = this.p; + var vec3 = null; + var mat48 = null; + var quat8 = null; + if(vec3 != null) { + vec3.zero(); + if(_this49.sizeVec3 == _this49.stackVec3.length) { + var newLength32 = _this49.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g43 = 0; + var _g133 = _this49.sizeVec3; + while(_g43 < _g133) { + var i34 = _g43++; + newArray32[i34] = _this49.stackVec3[i34]; + _this49.stackVec3[i34] = null; + } + _this49.stackVec3 = newArray32; + } + _this49.stackVec3[_this49.sizeVec3++] = vec3; + } + if(m != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + m.e00 = t0016; + m.e01 = t0116; + m.e02 = t0216; + m.e10 = t1016; + m.e11 = t1116; + m.e12 = t1216; + m.e20 = t2016; + m.e21 = t2116; + m.e22 = t2216; + if(_this49.sizeMat3 == _this49.stackMat3.length) { + var newLength33 = _this49.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g44 = 0; + var _g134 = _this49.sizeMat3; + while(_g44 < _g134) { + var i35 = _g44++; + newArray33[i35] = _this49.stackMat3[i35]; + _this49.stackMat3[i35] = null; + } + _this49.stackMat3 = newArray33; + } + _this49.stackMat3[_this49.sizeMat3++] = m; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this49.sizeMat4 == _this49.stackMat4.length) { + var newLength34 = _this49.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g45 = 0; + var _g135 = _this49.sizeMat4; + while(_g45 < _g135) { + var i36 = _g45++; + newArray34[i36] = _this49.stackMat4[i36]; + _this49.stackMat4[i36] = null; + } + _this49.stackMat4 = newArray34; + } + _this49.stackMat4[_this49.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx27 = 0; + var ty27 = 0; + var tz27 = 0; + var tw8 = 1; + quat8.x = tx27; + quat8.y = ty27; + quat8.z = tz27; + quat8.w = tw8; + if(_this49.sizeQuat == _this49.stackQuat.length) { + var newLength35 = _this49.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g46 = 0; + var _g136 = _this49.sizeQuat; + while(_g46 < _g136) { + var i37 = _g46++; + newArray35[i37] = _this49.stackQuat[i37]; + _this49.stackQuat[i37] = null; + } + _this49.stackQuat = newArray35; + } + _this49.stackQuat[_this49.sizeQuat++] = quat8; + } + var _this50 = this.p; + var mat38 = null; + var mat49 = null; + var quat9 = null; + if(ex != null) { + ex.zero(); + if(_this50.sizeVec3 == _this50.stackVec3.length) { + var newLength36 = _this50.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g47 = 0; + var _g137 = _this50.sizeVec3; + while(_g47 < _g137) { + var i38 = _g47++; + newArray36[i38] = _this50.stackVec3[i38]; + _this50.stackVec3[i38] = null; + } + _this50.stackVec3 = newArray36; + } + _this50.stackVec3[_this50.sizeVec3++] = ex; + } + if(mat38 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat38.e00 = t0018; + mat38.e01 = t0118; + mat38.e02 = t0218; + mat38.e10 = t1018; + mat38.e11 = t1118; + mat38.e12 = t1218; + mat38.e20 = t2018; + mat38.e21 = t2118; + mat38.e22 = t2218; + if(_this50.sizeMat3 == _this50.stackMat3.length) { + var newLength37 = _this50.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g48 = 0; + var _g138 = _this50.sizeMat3; + while(_g48 < _g138) { + var i39 = _g48++; + newArray37[i39] = _this50.stackMat3[i39]; + _this50.stackMat3[i39] = null; + } + _this50.stackMat3 = newArray37; + } + _this50.stackMat3[_this50.sizeMat3++] = mat38; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this50.sizeMat4 == _this50.stackMat4.length) { + var newLength38 = _this50.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g49 = 0; + var _g139 = _this50.sizeMat4; + while(_g49 < _g139) { + var i40 = _g49++; + newArray38[i40] = _this50.stackMat4[i40]; + _this50.stackMat4[i40] = null; + } + _this50.stackMat4 = newArray38; + } + _this50.stackMat4[_this50.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx28 = 0; + var ty28 = 0; + var tz28 = 0; + var tw9 = 1; + quat9.x = tx28; + quat9.y = ty28; + quat9.z = tz28; + quat9.w = tw9; + if(_this50.sizeQuat == _this50.stackQuat.length) { + var newLength39 = _this50.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g50 = 0; + var _g140 = _this50.sizeQuat; + while(_g50 < _g140) { + var i41 = _g50++; + newArray39[i41] = _this50.stackQuat[i41]; + _this50.stackQuat[i41] = null; + } + _this50.stackQuat = newArray39; + } + _this50.stackQuat[_this50.sizeQuat++] = quat9; + } + var _this51 = this.p; + var mat39 = null; + var mat410 = null; + var quat10 = null; + if(ey != null) { + ey.zero(); + if(_this51.sizeVec3 == _this51.stackVec3.length) { + var newLength40 = _this51.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g51 = 0; + var _g141 = _this51.sizeVec3; + while(_g51 < _g141) { + var i42 = _g51++; + newArray40[i42] = _this51.stackVec3[i42]; + _this51.stackVec3[i42] = null; + } + _this51.stackVec3 = newArray40; + } + _this51.stackVec3[_this51.sizeVec3++] = ey; + } + if(mat39 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat39.e00 = t0020; + mat39.e01 = t0120; + mat39.e02 = t0220; + mat39.e10 = t1020; + mat39.e11 = t1120; + mat39.e12 = t1220; + mat39.e20 = t2020; + mat39.e21 = t2120; + mat39.e22 = t2220; + if(_this51.sizeMat3 == _this51.stackMat3.length) { + var newLength41 = _this51.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g52 = 0; + var _g142 = _this51.sizeMat3; + while(_g52 < _g142) { + var i43 = _g52++; + newArray41[i43] = _this51.stackMat3[i43]; + _this51.stackMat3[i43] = null; + } + _this51.stackMat3 = newArray41; + } + _this51.stackMat3[_this51.sizeMat3++] = mat39; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this51.sizeMat4 == _this51.stackMat4.length) { + var newLength42 = _this51.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g53 = 0; + var _g143 = _this51.sizeMat4; + while(_g53 < _g143) { + var i44 = _g53++; + newArray42[i44] = _this51.stackMat4[i44]; + _this51.stackMat4[i44] = null; + } + _this51.stackMat4 = newArray42; + } + _this51.stackMat4[_this51.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx29 = 0; + var ty29 = 0; + var tz29 = 0; + var tw10 = 1; + quat10.x = tx29; + quat10.y = ty29; + quat10.z = tz29; + quat10.w = tw10; + if(_this51.sizeQuat == _this51.stackQuat.length) { + var newLength43 = _this51.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g54 = 0; + var _g144 = _this51.sizeQuat; + while(_g54 < _g144) { + var i45 = _g54++; + newArray43[i45] = _this51.stackQuat[i45]; + _this51.stackQuat[i45] = null; + } + _this51.stackQuat = newArray43; + } + _this51.stackQuat[_this51.sizeQuat++] = quat10; + } + var _this52 = this.p; + var mat310 = null; + var mat411 = null; + var quat11 = null; + if(ez != null) { + ez.zero(); + if(_this52.sizeVec3 == _this52.stackVec3.length) { + var newLength44 = _this52.sizeVec3 << 1; + var this45 = new Array(newLength44); + var newArray44 = this45; + var _g55 = 0; + var _g145 = _this52.sizeVec3; + while(_g55 < _g145) { + var i46 = _g55++; + newArray44[i46] = _this52.stackVec3[i46]; + _this52.stackVec3[i46] = null; + } + _this52.stackVec3 = newArray44; + } + _this52.stackVec3[_this52.sizeVec3++] = ez; + } + if(mat310 != null) { + var t0022 = 1; + var t0122 = 0; + var t0222 = 0; + var t1022 = 0; + var t1122 = 1; + var t1222 = 0; + var t2022 = 0; + var t2122 = 0; + var t2222 = 1; + mat310.e00 = t0022; + mat310.e01 = t0122; + mat310.e02 = t0222; + mat310.e10 = t1022; + mat310.e11 = t1122; + mat310.e12 = t1222; + mat310.e20 = t2022; + mat310.e21 = t2122; + mat310.e22 = t2222; + if(_this52.sizeMat3 == _this52.stackMat3.length) { + var newLength45 = _this52.sizeMat3 << 1; + var this46 = new Array(newLength45); + var newArray45 = this46; + var _g56 = 0; + var _g146 = _this52.sizeMat3; + while(_g56 < _g146) { + var i47 = _g56++; + newArray45[i47] = _this52.stackMat3[i47]; + _this52.stackMat3[i47] = null; + } + _this52.stackMat3 = newArray45; + } + _this52.stackMat3[_this52.sizeMat3++] = mat310; + } + if(mat411 != null) { + var t0023 = 1; + var t0123 = 0; + var t0223 = 0; + var t0311 = 0; + var t1023 = 0; + var t1123 = 1; + var t1223 = 0; + var t1311 = 0; + var t2023 = 0; + var t2123 = 0; + var t2223 = 1; + var t2311 = 0; + var t3011 = 0; + var t3111 = 0; + var t3211 = 0; + var t3311 = 1; + mat411.e00 = t0023; + mat411.e01 = t0123; + mat411.e02 = t0223; + mat411.e03 = t0311; + mat411.e10 = t1023; + mat411.e11 = t1123; + mat411.e12 = t1223; + mat411.e13 = t1311; + mat411.e20 = t2023; + mat411.e21 = t2123; + mat411.e22 = t2223; + mat411.e23 = t2311; + mat411.e30 = t3011; + mat411.e31 = t3111; + mat411.e32 = t3211; + mat411.e33 = t3311; + if(_this52.sizeMat4 == _this52.stackMat4.length) { + var newLength46 = _this52.sizeMat4 << 1; + var this47 = new Array(newLength46); + var newArray46 = this47; + var _g57 = 0; + var _g147 = _this52.sizeMat4; + while(_g57 < _g147) { + var i48 = _g57++; + newArray46[i48] = _this52.stackMat4[i48]; + _this52.stackMat4[i48] = null; + } + _this52.stackMat4 = newArray46; + } + _this52.stackMat4[_this52.sizeMat4++] = mat411; + } + if(quat11 != null) { + var tx30 = 0; + var ty30 = 0; + var tz30 = 0; + var tw11 = 1; + quat11.x = tx30; + quat11.y = ty30; + quat11.z = tz30; + quat11.w = tw11; + if(_this52.sizeQuat == _this52.stackQuat.length) { + var newLength47 = _this52.sizeQuat << 1; + var this48 = new Array(newLength47); + var newArray47 = this48; + var _g58 = 0; + var _g148 = _this52.sizeQuat; + while(_g58 < _g148) { + var i49 = _g58++; + newArray47[i49] = _this52.stackQuat[i49]; + _this52.stackQuat[i49] = null; + } + _this52.stackQuat = newArray47; + } + _this52.stackQuat[_this52.sizeQuat++] = quat11; + } + } + cylinder(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + var tx = _this7.x + ey.x * halfHeight; + var ty = _this7.y + ey.y * halfHeight; + var tz = _this7.z + ey.z * halfHeight; + _this7.x = tx; + _this7.y = ty; + _this7.z = tz; + var top = _this7; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + var _this10 = _this9; + var s = -halfHeight; + var tx1 = _this10.x + ey.x * s; + var ty1 = _this10.y + ey.y * s; + var tz1 = _this10.z + ey.z * s; + _this10.x = tx1; + _this10.y = ty1; + _this10.z = tz1; + var bottom = _this10; + if(this.wireframe) { + var _this11 = this.p; + var _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = top.x; + _this12.y = top.y; + _this12.z = top.z; + var _this13 = _this12; + var s1 = -radius; + var tx2 = _this13.x + ex.x * s1; + var ty2 = _this13.y + ex.y * s1; + var tz2 = _this13.z + ex.z * s1; + _this13.x = tx2; + _this13.y = ty2; + _this13.z = tz2; + var _this14 = _this13; + var tx3 = _this14.x + ez.x * 0; + var ty3 = _this14.y + ez.y * 0; + var tz3 = _this14.z + ez.z * 0; + _this14.x = tx3; + _this14.y = ty3; + _this14.z = tz3; + var top1 = _this14; + var _this15 = this.p; + var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = top.x; + _this16.y = top.y; + _this16.z = top.z; + var _this17 = _this16; + var tx4 = _this17.x + ex.x * radius; + var ty4 = _this17.y + ex.y * radius; + var tz4 = _this17.z + ex.z * radius; + _this17.x = tx4; + _this17.y = ty4; + _this17.z = tz4; + var _this18 = _this17; + var tx5 = _this18.x + ez.x * 0; + var ty5 = _this18.y + ez.y * 0; + var tz5 = _this18.z + ez.z * 0; + _this18.x = tx5; + _this18.y = ty5; + _this18.z = tz5; + var top2 = _this18; + var _this19 = this.p; + var _this20 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; + _this20.x = top.x; + _this20.y = top.y; + _this20.z = top.z; + var _this21 = _this20; + var tx6 = _this21.x + ex.x * 0; + var ty6 = _this21.y + ex.y * 0; + var tz6 = _this21.z + ex.z * 0; + _this21.x = tx6; + _this21.y = ty6; + _this21.z = tz6; + var _this22 = _this21; + var s2 = -radius; + var tx7 = _this22.x + ez.x * s2; + var ty7 = _this22.y + ez.y * s2; + var tz7 = _this22.z + ez.z * s2; + _this22.x = tx7; + _this22.y = ty7; + _this22.z = tz7; + var top3 = _this22; + var _this23 = this.p; + var _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = top.x; + _this24.y = top.y; + _this24.z = top.z; + var _this25 = _this24; + var tx8 = _this25.x + ex.x * 0; + var ty8 = _this25.y + ex.y * 0; + var tz8 = _this25.z + ex.z * 0; + _this25.x = tx8; + _this25.y = ty8; + _this25.z = tz8; + var _this26 = _this25; + var tx9 = _this26.x + ez.x * radius; + var ty9 = _this26.y + ez.y * radius; + var tz9 = _this26.z + ez.z * radius; + _this26.x = tx9; + _this26.y = ty9; + _this26.z = tz9; + var top4 = _this26; + var _this27 = this.p; + var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; + _this28.x = bottom.x; + _this28.y = bottom.y; + _this28.z = bottom.z; + var _this29 = _this28; + var s3 = -radius; + var tx10 = _this29.x + ex.x * s3; + var ty10 = _this29.y + ex.y * s3; + var tz10 = _this29.z + ex.z * s3; + _this29.x = tx10; + _this29.y = ty10; + _this29.z = tz10; + var _this30 = _this29; + var tx11 = _this30.x + ez.x * 0; + var ty11 = _this30.y + ez.y * 0; + var tz11 = _this30.z + ez.z * 0; + _this30.x = tx11; + _this30.y = ty11; + _this30.z = tz11; + var bottom1 = _this30; + var _this31 = this.p; + var _this32 = _this31.sizeVec3 == 0 ? new oimo.common.Vec3() : _this31.stackVec3[--_this31.sizeVec3]; + _this32.x = bottom.x; + _this32.y = bottom.y; + _this32.z = bottom.z; + var _this33 = _this32; + var tx12 = _this33.x + ex.x * radius; + var ty12 = _this33.y + ex.y * radius; + var tz12 = _this33.z + ex.z * radius; + _this33.x = tx12; + _this33.y = ty12; + _this33.z = tz12; + var _this34 = _this33; + var tx13 = _this34.x + ez.x * 0; + var ty13 = _this34.y + ez.y * 0; + var tz13 = _this34.z + ez.z * 0; + _this34.x = tx13; + _this34.y = ty13; + _this34.z = tz13; + var bottom2 = _this34; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo.common.Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = bottom.x; + _this36.y = bottom.y; + _this36.z = bottom.z; + var _this37 = _this36; + var tx14 = _this37.x + ex.x * 0; + var ty14 = _this37.y + ex.y * 0; + var tz14 = _this37.z + ex.z * 0; + _this37.x = tx14; + _this37.y = ty14; + _this37.z = tz14; + var _this38 = _this37; + var s4 = -radius; + var tx15 = _this38.x + ez.x * s4; + var ty15 = _this38.y + ez.y * s4; + var tz15 = _this38.z + ez.z * s4; + _this38.x = tx15; + _this38.y = ty15; + _this38.z = tz15; + var bottom3 = _this38; + var _this39 = this.p; + var _this40 = _this39.sizeVec3 == 0 ? new oimo.common.Vec3() : _this39.stackVec3[--_this39.sizeVec3]; + _this40.x = bottom.x; + _this40.y = bottom.y; + _this40.z = bottom.z; + var _this41 = _this40; + var tx16 = _this41.x + ex.x * 0; + var ty16 = _this41.y + ex.y * 0; + var tz16 = _this41.z + ex.z * 0; + _this41.x = tx16; + _this41.y = ty16; + _this41.z = tz16; + var _this42 = _this41; + var tx17 = _this42.x + ez.x * radius; + var ty17 = _this42.y + ez.y * radius; + var tz17 = _this42.z + ez.z * radius; + _this42.x = tx17; + _this42.y = ty17; + _this42.z = tz17; + var bottom4 = _this42; + this.ellipse(top,ex,ez,radius,radius,color); + this.ellipse(bottom,ex,ez,radius,radius,color); + this.line(top1,bottom1,color); + this.line(top2,bottom2,color); + this.line(top3,bottom3,color); + this.line(top4,bottom4,color); + var _this43 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(top1 != null) { + top1.zero(); + if(_this43.sizeVec3 == _this43.stackVec3.length) { + var newLength = _this43.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this43.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this43.stackVec3[i]; + _this43.stackVec3[i] = null; + } + _this43.stackVec3 = newArray; + } + _this43.stackVec3[_this43.sizeVec3++] = top1; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this43.sizeMat3 == _this43.stackMat3.length) { + var newLength1 = _this43.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this43.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this43.stackMat3[i1]; + _this43.stackMat3[i1] = null; + } + _this43.stackMat3 = newArray1; + } + _this43.stackMat3[_this43.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this43.sizeMat4 == _this43.stackMat4.length) { + var newLength2 = _this43.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this43.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this43.stackMat4[i2]; + _this43.stackMat4[i2] = null; + } + _this43.stackMat4 = newArray2; + } + _this43.stackMat4[_this43.sizeMat4++] = mat4; + } + if(quat != null) { + var tx18 = 0; + var ty18 = 0; + var tz18 = 0; + var tw = 1; + quat.x = tx18; + quat.y = ty18; + quat.z = tz18; + quat.w = tw; + if(_this43.sizeQuat == _this43.stackQuat.length) { + var newLength3 = _this43.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this43.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this43.stackQuat[i3]; + _this43.stackQuat[i3] = null; + } + _this43.stackQuat = newArray3; + } + _this43.stackQuat[_this43.sizeQuat++] = quat; + } + var _this44 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(top2 != null) { + top2.zero(); + if(_this44.sizeVec3 == _this44.stackVec3.length) { + var newLength4 = _this44.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this44.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this44.stackVec3[i4]; + _this44.stackVec3[i4] = null; + } + _this44.stackVec3 = newArray4; + } + _this44.stackVec3[_this44.sizeVec3++] = top2; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this44.sizeMat3 == _this44.stackMat3.length) { + var newLength5 = _this44.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this44.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this44.stackMat3[i5]; + _this44.stackMat3[i5] = null; + } + _this44.stackMat3 = newArray5; + } + _this44.stackMat3[_this44.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this44.sizeMat4 == _this44.stackMat4.length) { + var newLength6 = _this44.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this44.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this44.stackMat4[i6]; + _this44.stackMat4[i6] = null; + } + _this44.stackMat4 = newArray6; + } + _this44.stackMat4[_this44.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx19 = 0; + var ty19 = 0; + var tz19 = 0; + var tw1 = 1; + quat1.x = tx19; + quat1.y = ty19; + quat1.z = tz19; + quat1.w = tw1; + if(_this44.sizeQuat == _this44.stackQuat.length) { + var newLength7 = _this44.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this44.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this44.stackQuat[i7]; + _this44.stackQuat[i7] = null; + } + _this44.stackQuat = newArray7; + } + _this44.stackQuat[_this44.sizeQuat++] = quat1; + } + var _this45 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(top3 != null) { + top3.zero(); + if(_this45.sizeVec3 == _this45.stackVec3.length) { + var newLength8 = _this45.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this45.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this45.stackVec3[i8]; + _this45.stackVec3[i8] = null; + } + _this45.stackVec3 = newArray8; + } + _this45.stackVec3[_this45.sizeVec3++] = top3; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this45.sizeMat3 == _this45.stackMat3.length) { + var newLength9 = _this45.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this45.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this45.stackMat3[i9]; + _this45.stackMat3[i9] = null; + } + _this45.stackMat3 = newArray9; + } + _this45.stackMat3[_this45.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this45.sizeMat4 == _this45.stackMat4.length) { + var newLength10 = _this45.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this45.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this45.stackMat4[i10]; + _this45.stackMat4[i10] = null; + } + _this45.stackMat4 = newArray10; + } + _this45.stackMat4[_this45.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx20 = 0; + var ty20 = 0; + var tz20 = 0; + var tw2 = 1; + quat2.x = tx20; + quat2.y = ty20; + quat2.z = tz20; + quat2.w = tw2; + if(_this45.sizeQuat == _this45.stackQuat.length) { + var newLength11 = _this45.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this45.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this45.stackQuat[i11]; + _this45.stackQuat[i11] = null; + } + _this45.stackQuat = newArray11; + } + _this45.stackQuat[_this45.sizeQuat++] = quat2; + } + var _this46 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(top4 != null) { + top4.zero(); + if(_this46.sizeVec3 == _this46.stackVec3.length) { + var newLength12 = _this46.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this46.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this46.stackVec3[i12]; + _this46.stackVec3[i12] = null; + } + _this46.stackVec3 = newArray12; + } + _this46.stackVec3[_this46.sizeVec3++] = top4; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this46.sizeMat3 == _this46.stackMat3.length) { + var newLength13 = _this46.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this46.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this46.stackMat3[i13]; + _this46.stackMat3[i13] = null; + } + _this46.stackMat3 = newArray13; + } + _this46.stackMat3[_this46.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this46.sizeMat4 == _this46.stackMat4.length) { + var newLength14 = _this46.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this46.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this46.stackMat4[i14]; + _this46.stackMat4[i14] = null; + } + _this46.stackMat4 = newArray14; + } + _this46.stackMat4[_this46.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx21 = 0; + var ty21 = 0; + var tz21 = 0; + var tw3 = 1; + quat3.x = tx21; + quat3.y = ty21; + quat3.z = tz21; + quat3.w = tw3; + if(_this46.sizeQuat == _this46.stackQuat.length) { + var newLength15 = _this46.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this46.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this46.stackQuat[i15]; + _this46.stackQuat[i15] = null; + } + _this46.stackQuat = newArray15; + } + _this46.stackQuat[_this46.sizeQuat++] = quat3; + } + var _this47 = this.p; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(bottom1 != null) { + bottom1.zero(); + if(_this47.sizeVec3 == _this47.stackVec3.length) { + var newLength16 = _this47.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g26 = 0; + var _g116 = _this47.sizeVec3; + while(_g26 < _g116) { + var i16 = _g26++; + newArray16[i16] = _this47.stackVec3[i16]; + _this47.stackVec3[i16] = null; + } + _this47.stackVec3 = newArray16; + } + _this47.stackVec3[_this47.sizeVec3++] = bottom1; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this47.sizeMat3 == _this47.stackMat3.length) { + var newLength17 = _this47.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g27 = 0; + var _g117 = _this47.sizeMat3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray17[i17] = _this47.stackMat3[i17]; + _this47.stackMat3[i17] = null; + } + _this47.stackMat3 = newArray17; + } + _this47.stackMat3[_this47.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this47.sizeMat4 == _this47.stackMat4.length) { + var newLength18 = _this47.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g28 = 0; + var _g118 = _this47.sizeMat4; + while(_g28 < _g118) { + var i18 = _g28++; + newArray18[i18] = _this47.stackMat4[i18]; + _this47.stackMat4[i18] = null; + } + _this47.stackMat4 = newArray18; + } + _this47.stackMat4[_this47.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx22 = 0; + var ty22 = 0; + var tz22 = 0; + var tw4 = 1; + quat4.x = tx22; + quat4.y = ty22; + quat4.z = tz22; + quat4.w = tw4; + if(_this47.sizeQuat == _this47.stackQuat.length) { + var newLength19 = _this47.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g29 = 0; + var _g119 = _this47.sizeQuat; + while(_g29 < _g119) { + var i19 = _g29++; + newArray19[i19] = _this47.stackQuat[i19]; + _this47.stackQuat[i19] = null; + } + _this47.stackQuat = newArray19; + } + _this47.stackQuat[_this47.sizeQuat++] = quat4; + } + var _this48 = this.p; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(bottom2 != null) { + bottom2.zero(); + if(_this48.sizeVec3 == _this48.stackVec3.length) { + var newLength20 = _this48.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g30 = 0; + var _g120 = _this48.sizeVec3; + while(_g30 < _g120) { + var i20 = _g30++; + newArray20[i20] = _this48.stackVec3[i20]; + _this48.stackVec3[i20] = null; + } + _this48.stackVec3 = newArray20; + } + _this48.stackVec3[_this48.sizeVec3++] = bottom2; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this48.sizeMat3 == _this48.stackMat3.length) { + var newLength21 = _this48.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g31 = 0; + var _g121 = _this48.sizeMat3; + while(_g31 < _g121) { + var i21 = _g31++; + newArray21[i21] = _this48.stackMat3[i21]; + _this48.stackMat3[i21] = null; + } + _this48.stackMat3 = newArray21; + } + _this48.stackMat3[_this48.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this48.sizeMat4 == _this48.stackMat4.length) { + var newLength22 = _this48.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g32 = 0; + var _g122 = _this48.sizeMat4; + while(_g32 < _g122) { + var i22 = _g32++; + newArray22[i22] = _this48.stackMat4[i22]; + _this48.stackMat4[i22] = null; + } + _this48.stackMat4 = newArray22; + } + _this48.stackMat4[_this48.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx23 = 0; + var ty23 = 0; + var tz23 = 0; + var tw5 = 1; + quat5.x = tx23; + quat5.y = ty23; + quat5.z = tz23; + quat5.w = tw5; + if(_this48.sizeQuat == _this48.stackQuat.length) { + var newLength23 = _this48.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g33 = 0; + var _g123 = _this48.sizeQuat; + while(_g33 < _g123) { + var i23 = _g33++; + newArray23[i23] = _this48.stackQuat[i23]; + _this48.stackQuat[i23] = null; + } + _this48.stackQuat = newArray23; + } + _this48.stackQuat[_this48.sizeQuat++] = quat5; + } + var _this49 = this.p; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(bottom3 != null) { + bottom3.zero(); + if(_this49.sizeVec3 == _this49.stackVec3.length) { + var newLength24 = _this49.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g34 = 0; + var _g124 = _this49.sizeVec3; + while(_g34 < _g124) { + var i24 = _g34++; + newArray24[i24] = _this49.stackVec3[i24]; + _this49.stackVec3[i24] = null; + } + _this49.stackVec3 = newArray24; + } + _this49.stackVec3[_this49.sizeVec3++] = bottom3; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this49.sizeMat3 == _this49.stackMat3.length) { + var newLength25 = _this49.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g35 = 0; + var _g125 = _this49.sizeMat3; + while(_g35 < _g125) { + var i25 = _g35++; + newArray25[i25] = _this49.stackMat3[i25]; + _this49.stackMat3[i25] = null; + } + _this49.stackMat3 = newArray25; + } + _this49.stackMat3[_this49.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this49.sizeMat4 == _this49.stackMat4.length) { + var newLength26 = _this49.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g36 = 0; + var _g126 = _this49.sizeMat4; + while(_g36 < _g126) { + var i26 = _g36++; + newArray26[i26] = _this49.stackMat4[i26]; + _this49.stackMat4[i26] = null; + } + _this49.stackMat4 = newArray26; + } + _this49.stackMat4[_this49.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx24 = 0; + var ty24 = 0; + var tz24 = 0; + var tw6 = 1; + quat6.x = tx24; + quat6.y = ty24; + quat6.z = tz24; + quat6.w = tw6; + if(_this49.sizeQuat == _this49.stackQuat.length) { + var newLength27 = _this49.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g37 = 0; + var _g127 = _this49.sizeQuat; + while(_g37 < _g127) { + var i27 = _g37++; + newArray27[i27] = _this49.stackQuat[i27]; + _this49.stackQuat[i27] = null; + } + _this49.stackQuat = newArray27; + } + _this49.stackQuat[_this49.sizeQuat++] = quat6; + } + var _this50 = this.p; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(bottom4 != null) { + bottom4.zero(); + if(_this50.sizeVec3 == _this50.stackVec3.length) { + var newLength28 = _this50.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g38 = 0; + var _g128 = _this50.sizeVec3; + while(_g38 < _g128) { + var i28 = _g38++; + newArray28[i28] = _this50.stackVec3[i28]; + _this50.stackVec3[i28] = null; + } + _this50.stackVec3 = newArray28; + } + _this50.stackVec3[_this50.sizeVec3++] = bottom4; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this50.sizeMat3 == _this50.stackMat3.length) { + var newLength29 = _this50.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g39 = 0; + var _g129 = _this50.sizeMat3; + while(_g39 < _g129) { + var i29 = _g39++; + newArray29[i29] = _this50.stackMat3[i29]; + _this50.stackMat3[i29] = null; + } + _this50.stackMat3 = newArray29; + } + _this50.stackMat3[_this50.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this50.sizeMat4 == _this50.stackMat4.length) { + var newLength30 = _this50.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g40 = 0; + var _g130 = _this50.sizeMat4; + while(_g40 < _g130) { + var i30 = _g40++; + newArray30[i30] = _this50.stackMat4[i30]; + _this50.stackMat4[i30] = null; + } + _this50.stackMat4 = newArray30; + } + _this50.stackMat4[_this50.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx25 = 0; + var ty25 = 0; + var tz25 = 0; + var tw7 = 1; + quat7.x = tx25; + quat7.y = ty25; + quat7.z = tz25; + quat7.w = tw7; + if(_this50.sizeQuat == _this50.stackQuat.length) { + var newLength31 = _this50.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g41 = 0; + var _g131 = _this50.sizeQuat; + while(_g41 < _g131) { + var i31 = _g41++; + newArray31[i31] = _this50.stackQuat[i31]; + _this50.stackQuat[i31] = null; + } + _this50.stackQuat = newArray31; + } + _this50.stackQuat[_this50.sizeQuat++] = quat7; + } + } else { + var _g42 = 0; + while(_g42 < 8) { + var i32 = _g42++; + var _this51 = this.tmpCircleNorms[i32]; + var v1 = this.circleCoords[i32]; + _this51.x = v1.x; + _this51.y = v1.y; + _this51.z = v1.z; + var _this52 = _this51; + var tx26 = _this52.x * m.e00 + _this52.y * m.e01 + _this52.z * m.e02; + var ty26 = _this52.x * m.e10 + _this52.y * m.e11 + _this52.z * m.e12; + var tz26 = _this52.x * m.e20 + _this52.y * m.e21 + _this52.z * m.e22; + _this52.x = tx26; + _this52.y = ty26; + _this52.z = tz26; + var _this53 = this.tmpCircleVerts1[i32]; + var v2 = this.tmpCircleNorms[i32]; + _this53.x = v2.x; + _this53.y = v2.y; + _this53.z = v2.z; + var _this54 = _this53; + var tx27 = _this54.x * radius; + var ty27 = _this54.y * radius; + var tz27 = _this54.z * radius; + _this54.x = tx27; + _this54.y = ty27; + _this54.z = tz27; + var _this55 = _this54; + var tx28 = _this55.x + o.x; + var ty28 = _this55.y + o.y; + var tz28 = _this55.z + o.z; + _this55.x = tx28; + _this55.y = ty28; + _this55.z = tz28; + var _this56 = this.tmpCircleVerts2[i32]; + var v3 = this.tmpCircleVerts1[i32]; + _this56.x = v3.x; + _this56.y = v3.y; + _this56.z = v3.z; + var _this57 = this.tmpCircleVerts1[i32]; + var tx29 = _this57.x + ey.x * halfHeight; + var ty29 = _this57.y + ey.y * halfHeight; + var tz29 = _this57.z + ey.z * halfHeight; + _this57.x = tx29; + _this57.y = ty29; + _this57.z = tz29; + var _this58 = this.tmpCircleVerts2[i32]; + var s5 = -halfHeight; + var tx30 = _this58.x + ey.x * s5; + var ty30 = _this58.y + ey.y * s5; + var tz30 = _this58.z + ey.z * s5; + _this58.x = tx30; + _this58.y = ty30; + _this58.z = tz30; + } + var _g132 = 0; + while(_g132 < 8) { + var i33 = _g132++; + var n3; + var n4; + var v11 = top; + var v21 = this.tmpCircleVerts1[i33]; + var v31 = this.tmpCircleVerts1[(i33 + 1) % 8]; + var n1 = ey; + this.triangle(v11,v21,v31,n1,n1,n1,color); + v11 = bottom; + v21 = this.tmpCircleVerts2[(i33 + 1) % 8]; + v31 = this.tmpCircleVerts2[i33]; + var _this59 = this.p; + var _this60 = _this59.sizeVec3 == 0 ? new oimo.common.Vec3() : _this59.stackVec3[--_this59.sizeVec3]; + _this60.x = ey.x; + _this60.y = ey.y; + _this60.z = ey.z; + var _this61 = _this60; + var tx31 = -_this61.x; + var ty31 = -_this61.y; + var tz31 = -_this61.z; + _this61.x = tx31; + _this61.y = ty31; + _this61.z = tz31; + n1 = _this61; + this.triangle(v11,v21,v31,n1,n1,n1,color); + var _this62 = this.p; + var mat38 = null; + var mat48 = null; + var quat8 = null; + if(n1 != null) { + n1.zero(); + if(_this62.sizeVec3 == _this62.stackVec3.length) { + var newLength32 = _this62.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g43 = 0; + var _g133 = _this62.sizeVec3; + while(_g43 < _g133) { + var i34 = _g43++; + newArray32[i34] = _this62.stackVec3[i34]; + _this62.stackVec3[i34] = null; + } + _this62.stackVec3 = newArray32; + } + _this62.stackVec3[_this62.sizeVec3++] = n1; + } + if(mat38 != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + mat38.e00 = t0016; + mat38.e01 = t0116; + mat38.e02 = t0216; + mat38.e10 = t1016; + mat38.e11 = t1116; + mat38.e12 = t1216; + mat38.e20 = t2016; + mat38.e21 = t2116; + mat38.e22 = t2216; + if(_this62.sizeMat3 == _this62.stackMat3.length) { + var newLength33 = _this62.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g44 = 0; + var _g134 = _this62.sizeMat3; + while(_g44 < _g134) { + var i35 = _g44++; + newArray33[i35] = _this62.stackMat3[i35]; + _this62.stackMat3[i35] = null; + } + _this62.stackMat3 = newArray33; + } + _this62.stackMat3[_this62.sizeMat3++] = mat38; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this62.sizeMat4 == _this62.stackMat4.length) { + var newLength34 = _this62.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g45 = 0; + var _g135 = _this62.sizeMat4; + while(_g45 < _g135) { + var i36 = _g45++; + newArray34[i36] = _this62.stackMat4[i36]; + _this62.stackMat4[i36] = null; + } + _this62.stackMat4 = newArray34; + } + _this62.stackMat4[_this62.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx32 = 0; + var ty32 = 0; + var tz32 = 0; + var tw8 = 1; + quat8.x = tx32; + quat8.y = ty32; + quat8.z = tz32; + quat8.w = tw8; + if(_this62.sizeQuat == _this62.stackQuat.length) { + var newLength35 = _this62.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g46 = 0; + var _g136 = _this62.sizeQuat; + while(_g46 < _g136) { + var i37 = _g46++; + newArray35[i37] = _this62.stackQuat[i37]; + _this62.stackQuat[i37] = null; + } + _this62.stackQuat = newArray35; + } + _this62.stackQuat[_this62.sizeQuat++] = quat8; + } + v11 = this.tmpCircleVerts1[i33]; + v21 = this.tmpCircleVerts2[i33]; + v31 = this.tmpCircleVerts2[(i33 + 1) % 8]; + var v4 = this.tmpCircleVerts1[(i33 + 1) % 8]; + n1 = this.tmpCircleNorms[i33]; + var n2 = this.tmpCircleNorms[(i33 + 1) % 8]; + this.rect(v11,v21,v31,v4,n1,n1,n2,n2,color); + } + } + var _this63 = this.p; + var mat39 = null; + var mat49 = null; + var quat9 = null; + if(top != null) { + top.zero(); + if(_this63.sizeVec3 == _this63.stackVec3.length) { + var newLength36 = _this63.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g47 = 0; + var _g137 = _this63.sizeVec3; + while(_g47 < _g137) { + var i38 = _g47++; + newArray36[i38] = _this63.stackVec3[i38]; + _this63.stackVec3[i38] = null; + } + _this63.stackVec3 = newArray36; + } + _this63.stackVec3[_this63.sizeVec3++] = top; + } + if(mat39 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat39.e00 = t0018; + mat39.e01 = t0118; + mat39.e02 = t0218; + mat39.e10 = t1018; + mat39.e11 = t1118; + mat39.e12 = t1218; + mat39.e20 = t2018; + mat39.e21 = t2118; + mat39.e22 = t2218; + if(_this63.sizeMat3 == _this63.stackMat3.length) { + var newLength37 = _this63.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g48 = 0; + var _g138 = _this63.sizeMat3; + while(_g48 < _g138) { + var i39 = _g48++; + newArray37[i39] = _this63.stackMat3[i39]; + _this63.stackMat3[i39] = null; + } + _this63.stackMat3 = newArray37; + } + _this63.stackMat3[_this63.sizeMat3++] = mat39; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this63.sizeMat4 == _this63.stackMat4.length) { + var newLength38 = _this63.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g49 = 0; + var _g139 = _this63.sizeMat4; + while(_g49 < _g139) { + var i40 = _g49++; + newArray38[i40] = _this63.stackMat4[i40]; + _this63.stackMat4[i40] = null; + } + _this63.stackMat4 = newArray38; + } + _this63.stackMat4[_this63.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx33 = 0; + var ty33 = 0; + var tz33 = 0; + var tw9 = 1; + quat9.x = tx33; + quat9.y = ty33; + quat9.z = tz33; + quat9.w = tw9; + if(_this63.sizeQuat == _this63.stackQuat.length) { + var newLength39 = _this63.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g50 = 0; + var _g140 = _this63.sizeQuat; + while(_g50 < _g140) { + var i41 = _g50++; + newArray39[i41] = _this63.stackQuat[i41]; + _this63.stackQuat[i41] = null; + } + _this63.stackQuat = newArray39; + } + _this63.stackQuat[_this63.sizeQuat++] = quat9; + } + var _this64 = this.p; + var mat310 = null; + var mat410 = null; + var quat10 = null; + if(bottom != null) { + bottom.zero(); + if(_this64.sizeVec3 == _this64.stackVec3.length) { + var newLength40 = _this64.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g51 = 0; + var _g141 = _this64.sizeVec3; + while(_g51 < _g141) { + var i42 = _g51++; + newArray40[i42] = _this64.stackVec3[i42]; + _this64.stackVec3[i42] = null; + } + _this64.stackVec3 = newArray40; + } + _this64.stackVec3[_this64.sizeVec3++] = bottom; + } + if(mat310 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat310.e00 = t0020; + mat310.e01 = t0120; + mat310.e02 = t0220; + mat310.e10 = t1020; + mat310.e11 = t1120; + mat310.e12 = t1220; + mat310.e20 = t2020; + mat310.e21 = t2120; + mat310.e22 = t2220; + if(_this64.sizeMat3 == _this64.stackMat3.length) { + var newLength41 = _this64.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g52 = 0; + var _g142 = _this64.sizeMat3; + while(_g52 < _g142) { + var i43 = _g52++; + newArray41[i43] = _this64.stackMat3[i43]; + _this64.stackMat3[i43] = null; + } + _this64.stackMat3 = newArray41; + } + _this64.stackMat3[_this64.sizeMat3++] = mat310; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this64.sizeMat4 == _this64.stackMat4.length) { + var newLength42 = _this64.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g53 = 0; + var _g143 = _this64.sizeMat4; + while(_g53 < _g143) { + var i44 = _g53++; + newArray42[i44] = _this64.stackMat4[i44]; + _this64.stackMat4[i44] = null; + } + _this64.stackMat4 = newArray42; + } + _this64.stackMat4[_this64.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx34 = 0; + var ty34 = 0; + var tz34 = 0; + var tw10 = 1; + quat10.x = tx34; + quat10.y = ty34; + quat10.z = tz34; + quat10.w = tw10; + if(_this64.sizeQuat == _this64.stackQuat.length) { + var newLength43 = _this64.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g54 = 0; + var _g144 = _this64.sizeQuat; + while(_g54 < _g144) { + var i45 = _g54++; + newArray43[i45] = _this64.stackQuat[i45]; + _this64.stackQuat[i45] = null; + } + _this64.stackQuat = newArray43; + } + _this64.stackQuat[_this64.sizeQuat++] = quat10; + } + var _this65 = this.p; + var mat311 = null; + var mat411 = null; + var quat11 = null; + if(o != null) { + o.zero(); + if(_this65.sizeVec3 == _this65.stackVec3.length) { + var newLength44 = _this65.sizeVec3 << 1; + var this45 = new Array(newLength44); + var newArray44 = this45; + var _g55 = 0; + var _g145 = _this65.sizeVec3; + while(_g55 < _g145) { + var i46 = _g55++; + newArray44[i46] = _this65.stackVec3[i46]; + _this65.stackVec3[i46] = null; + } + _this65.stackVec3 = newArray44; + } + _this65.stackVec3[_this65.sizeVec3++] = o; + } + if(mat311 != null) { + var t0022 = 1; + var t0122 = 0; + var t0222 = 0; + var t1022 = 0; + var t1122 = 1; + var t1222 = 0; + var t2022 = 0; + var t2122 = 0; + var t2222 = 1; + mat311.e00 = t0022; + mat311.e01 = t0122; + mat311.e02 = t0222; + mat311.e10 = t1022; + mat311.e11 = t1122; + mat311.e12 = t1222; + mat311.e20 = t2022; + mat311.e21 = t2122; + mat311.e22 = t2222; + if(_this65.sizeMat3 == _this65.stackMat3.length) { + var newLength45 = _this65.sizeMat3 << 1; + var this46 = new Array(newLength45); + var newArray45 = this46; + var _g56 = 0; + var _g146 = _this65.sizeMat3; + while(_g56 < _g146) { + var i47 = _g56++; + newArray45[i47] = _this65.stackMat3[i47]; + _this65.stackMat3[i47] = null; + } + _this65.stackMat3 = newArray45; + } + _this65.stackMat3[_this65.sizeMat3++] = mat311; + } + if(mat411 != null) { + var t0023 = 1; + var t0123 = 0; + var t0223 = 0; + var t0311 = 0; + var t1023 = 0; + var t1123 = 1; + var t1223 = 0; + var t1311 = 0; + var t2023 = 0; + var t2123 = 0; + var t2223 = 1; + var t2311 = 0; + var t3011 = 0; + var t3111 = 0; + var t3211 = 0; + var t3311 = 1; + mat411.e00 = t0023; + mat411.e01 = t0123; + mat411.e02 = t0223; + mat411.e03 = t0311; + mat411.e10 = t1023; + mat411.e11 = t1123; + mat411.e12 = t1223; + mat411.e13 = t1311; + mat411.e20 = t2023; + mat411.e21 = t2123; + mat411.e22 = t2223; + mat411.e23 = t2311; + mat411.e30 = t3011; + mat411.e31 = t3111; + mat411.e32 = t3211; + mat411.e33 = t3311; + if(_this65.sizeMat4 == _this65.stackMat4.length) { + var newLength46 = _this65.sizeMat4 << 1; + var this47 = new Array(newLength46); + var newArray46 = this47; + var _g57 = 0; + var _g147 = _this65.sizeMat4; + while(_g57 < _g147) { + var i48 = _g57++; + newArray46[i48] = _this65.stackMat4[i48]; + _this65.stackMat4[i48] = null; + } + _this65.stackMat4 = newArray46; + } + _this65.stackMat4[_this65.sizeMat4++] = mat411; + } + if(quat11 != null) { + var tx35 = 0; + var ty35 = 0; + var tz35 = 0; + var tw11 = 1; + quat11.x = tx35; + quat11.y = ty35; + quat11.z = tz35; + quat11.w = tw11; + if(_this65.sizeQuat == _this65.stackQuat.length) { + var newLength47 = _this65.sizeQuat << 1; + var this48 = new Array(newLength47); + var newArray47 = this48; + var _g58 = 0; + var _g148 = _this65.sizeQuat; + while(_g58 < _g148) { + var i49 = _g58++; + newArray47[i49] = _this65.stackQuat[i49]; + _this65.stackQuat[i49] = null; + } + _this65.stackQuat = newArray47; + } + _this65.stackQuat[_this65.sizeQuat++] = quat11; + } + var _this66 = this.p; + var vec3 = null; + var mat412 = null; + var quat12 = null; + if(vec3 != null) { + vec3.zero(); + if(_this66.sizeVec3 == _this66.stackVec3.length) { + var newLength48 = _this66.sizeVec3 << 1; + var this49 = new Array(newLength48); + var newArray48 = this49; + var _g59 = 0; + var _g149 = _this66.sizeVec3; + while(_g59 < _g149) { + var i50 = _g59++; + newArray48[i50] = _this66.stackVec3[i50]; + _this66.stackVec3[i50] = null; + } + _this66.stackVec3 = newArray48; + } + _this66.stackVec3[_this66.sizeVec3++] = vec3; + } + if(m != null) { + var t0024 = 1; + var t0124 = 0; + var t0224 = 0; + var t1024 = 0; + var t1124 = 1; + var t1224 = 0; + var t2024 = 0; + var t2124 = 0; + var t2224 = 1; + m.e00 = t0024; + m.e01 = t0124; + m.e02 = t0224; + m.e10 = t1024; + m.e11 = t1124; + m.e12 = t1224; + m.e20 = t2024; + m.e21 = t2124; + m.e22 = t2224; + if(_this66.sizeMat3 == _this66.stackMat3.length) { + var newLength49 = _this66.sizeMat3 << 1; + var this50 = new Array(newLength49); + var newArray49 = this50; + var _g60 = 0; + var _g150 = _this66.sizeMat3; + while(_g60 < _g150) { + var i51 = _g60++; + newArray49[i51] = _this66.stackMat3[i51]; + _this66.stackMat3[i51] = null; + } + _this66.stackMat3 = newArray49; + } + _this66.stackMat3[_this66.sizeMat3++] = m; + } + if(mat412 != null) { + var t0025 = 1; + var t0125 = 0; + var t0225 = 0; + var t0312 = 0; + var t1025 = 0; + var t1125 = 1; + var t1225 = 0; + var t1312 = 0; + var t2025 = 0; + var t2125 = 0; + var t2225 = 1; + var t2312 = 0; + var t3012 = 0; + var t3112 = 0; + var t3212 = 0; + var t3312 = 1; + mat412.e00 = t0025; + mat412.e01 = t0125; + mat412.e02 = t0225; + mat412.e03 = t0312; + mat412.e10 = t1025; + mat412.e11 = t1125; + mat412.e12 = t1225; + mat412.e13 = t1312; + mat412.e20 = t2025; + mat412.e21 = t2125; + mat412.e22 = t2225; + mat412.e23 = t2312; + mat412.e30 = t3012; + mat412.e31 = t3112; + mat412.e32 = t3212; + mat412.e33 = t3312; + if(_this66.sizeMat4 == _this66.stackMat4.length) { + var newLength50 = _this66.sizeMat4 << 1; + var this51 = new Array(newLength50); + var newArray50 = this51; + var _g61 = 0; + var _g151 = _this66.sizeMat4; + while(_g61 < _g151) { + var i52 = _g61++; + newArray50[i52] = _this66.stackMat4[i52]; + _this66.stackMat4[i52] = null; + } + _this66.stackMat4 = newArray50; + } + _this66.stackMat4[_this66.sizeMat4++] = mat412; + } + if(quat12 != null) { + var tx36 = 0; + var ty36 = 0; + var tz36 = 0; + var tw12 = 1; + quat12.x = tx36; + quat12.y = ty36; + quat12.z = tz36; + quat12.w = tw12; + if(_this66.sizeQuat == _this66.stackQuat.length) { + var newLength51 = _this66.sizeQuat << 1; + var this52 = new Array(newLength51); + var newArray51 = this52; + var _g62 = 0; + var _g152 = _this66.sizeQuat; + while(_g62 < _g152) { + var i53 = _g62++; + newArray51[i53] = _this66.stackQuat[i53]; + _this66.stackQuat[i53] = null; + } + _this66.stackQuat = newArray51; + } + _this66.stackQuat[_this66.sizeQuat++] = quat12; + } + var _this67 = this.p; + var mat312 = null; + var mat413 = null; + var quat13 = null; + if(ex != null) { + ex.zero(); + if(_this67.sizeVec3 == _this67.stackVec3.length) { + var newLength52 = _this67.sizeVec3 << 1; + var this53 = new Array(newLength52); + var newArray52 = this53; + var _g63 = 0; + var _g153 = _this67.sizeVec3; + while(_g63 < _g153) { + var i54 = _g63++; + newArray52[i54] = _this67.stackVec3[i54]; + _this67.stackVec3[i54] = null; + } + _this67.stackVec3 = newArray52; + } + _this67.stackVec3[_this67.sizeVec3++] = ex; + } + if(mat312 != null) { + var t0026 = 1; + var t0126 = 0; + var t0226 = 0; + var t1026 = 0; + var t1126 = 1; + var t1226 = 0; + var t2026 = 0; + var t2126 = 0; + var t2226 = 1; + mat312.e00 = t0026; + mat312.e01 = t0126; + mat312.e02 = t0226; + mat312.e10 = t1026; + mat312.e11 = t1126; + mat312.e12 = t1226; + mat312.e20 = t2026; + mat312.e21 = t2126; + mat312.e22 = t2226; + if(_this67.sizeMat3 == _this67.stackMat3.length) { + var newLength53 = _this67.sizeMat3 << 1; + var this54 = new Array(newLength53); + var newArray53 = this54; + var _g64 = 0; + var _g154 = _this67.sizeMat3; + while(_g64 < _g154) { + var i55 = _g64++; + newArray53[i55] = _this67.stackMat3[i55]; + _this67.stackMat3[i55] = null; + } + _this67.stackMat3 = newArray53; + } + _this67.stackMat3[_this67.sizeMat3++] = mat312; + } + if(mat413 != null) { + var t0027 = 1; + var t0127 = 0; + var t0227 = 0; + var t0313 = 0; + var t1027 = 0; + var t1127 = 1; + var t1227 = 0; + var t1313 = 0; + var t2027 = 0; + var t2127 = 0; + var t2227 = 1; + var t2313 = 0; + var t3013 = 0; + var t3113 = 0; + var t3213 = 0; + var t3313 = 1; + mat413.e00 = t0027; + mat413.e01 = t0127; + mat413.e02 = t0227; + mat413.e03 = t0313; + mat413.e10 = t1027; + mat413.e11 = t1127; + mat413.e12 = t1227; + mat413.e13 = t1313; + mat413.e20 = t2027; + mat413.e21 = t2127; + mat413.e22 = t2227; + mat413.e23 = t2313; + mat413.e30 = t3013; + mat413.e31 = t3113; + mat413.e32 = t3213; + mat413.e33 = t3313; + if(_this67.sizeMat4 == _this67.stackMat4.length) { + var newLength54 = _this67.sizeMat4 << 1; + var this55 = new Array(newLength54); + var newArray54 = this55; + var _g65 = 0; + var _g155 = _this67.sizeMat4; + while(_g65 < _g155) { + var i56 = _g65++; + newArray54[i56] = _this67.stackMat4[i56]; + _this67.stackMat4[i56] = null; + } + _this67.stackMat4 = newArray54; + } + _this67.stackMat4[_this67.sizeMat4++] = mat413; + } + if(quat13 != null) { + var tx37 = 0; + var ty37 = 0; + var tz37 = 0; + var tw13 = 1; + quat13.x = tx37; + quat13.y = ty37; + quat13.z = tz37; + quat13.w = tw13; + if(_this67.sizeQuat == _this67.stackQuat.length) { + var newLength55 = _this67.sizeQuat << 1; + var this56 = new Array(newLength55); + var newArray55 = this56; + var _g66 = 0; + var _g156 = _this67.sizeQuat; + while(_g66 < _g156) { + var i57 = _g66++; + newArray55[i57] = _this67.stackQuat[i57]; + _this67.stackQuat[i57] = null; + } + _this67.stackQuat = newArray55; + } + _this67.stackQuat[_this67.sizeQuat++] = quat13; + } + var _this68 = this.p; + var mat313 = null; + var mat414 = null; + var quat14 = null; + if(ey != null) { + ey.zero(); + if(_this68.sizeVec3 == _this68.stackVec3.length) { + var newLength56 = _this68.sizeVec3 << 1; + var this57 = new Array(newLength56); + var newArray56 = this57; + var _g67 = 0; + var _g157 = _this68.sizeVec3; + while(_g67 < _g157) { + var i58 = _g67++; + newArray56[i58] = _this68.stackVec3[i58]; + _this68.stackVec3[i58] = null; + } + _this68.stackVec3 = newArray56; + } + _this68.stackVec3[_this68.sizeVec3++] = ey; + } + if(mat313 != null) { + var t0028 = 1; + var t0128 = 0; + var t0228 = 0; + var t1028 = 0; + var t1128 = 1; + var t1228 = 0; + var t2028 = 0; + var t2128 = 0; + var t2228 = 1; + mat313.e00 = t0028; + mat313.e01 = t0128; + mat313.e02 = t0228; + mat313.e10 = t1028; + mat313.e11 = t1128; + mat313.e12 = t1228; + mat313.e20 = t2028; + mat313.e21 = t2128; + mat313.e22 = t2228; + if(_this68.sizeMat3 == _this68.stackMat3.length) { + var newLength57 = _this68.sizeMat3 << 1; + var this58 = new Array(newLength57); + var newArray57 = this58; + var _g68 = 0; + var _g158 = _this68.sizeMat3; + while(_g68 < _g158) { + var i59 = _g68++; + newArray57[i59] = _this68.stackMat3[i59]; + _this68.stackMat3[i59] = null; + } + _this68.stackMat3 = newArray57; + } + _this68.stackMat3[_this68.sizeMat3++] = mat313; + } + if(mat414 != null) { + var t0029 = 1; + var t0129 = 0; + var t0229 = 0; + var t0314 = 0; + var t1029 = 0; + var t1129 = 1; + var t1229 = 0; + var t1314 = 0; + var t2029 = 0; + var t2129 = 0; + var t2229 = 1; + var t2314 = 0; + var t3014 = 0; + var t3114 = 0; + var t3214 = 0; + var t3314 = 1; + mat414.e00 = t0029; + mat414.e01 = t0129; + mat414.e02 = t0229; + mat414.e03 = t0314; + mat414.e10 = t1029; + mat414.e11 = t1129; + mat414.e12 = t1229; + mat414.e13 = t1314; + mat414.e20 = t2029; + mat414.e21 = t2129; + mat414.e22 = t2229; + mat414.e23 = t2314; + mat414.e30 = t3014; + mat414.e31 = t3114; + mat414.e32 = t3214; + mat414.e33 = t3314; + if(_this68.sizeMat4 == _this68.stackMat4.length) { + var newLength58 = _this68.sizeMat4 << 1; + var this59 = new Array(newLength58); + var newArray58 = this59; + var _g69 = 0; + var _g159 = _this68.sizeMat4; + while(_g69 < _g159) { + var i60 = _g69++; + newArray58[i60] = _this68.stackMat4[i60]; + _this68.stackMat4[i60] = null; + } + _this68.stackMat4 = newArray58; + } + _this68.stackMat4[_this68.sizeMat4++] = mat414; + } + if(quat14 != null) { + var tx38 = 0; + var ty38 = 0; + var tz38 = 0; + var tw14 = 1; + quat14.x = tx38; + quat14.y = ty38; + quat14.z = tz38; + quat14.w = tw14; + if(_this68.sizeQuat == _this68.stackQuat.length) { + var newLength59 = _this68.sizeQuat << 1; + var this60 = new Array(newLength59); + var newArray59 = this60; + var _g70 = 0; + var _g160 = _this68.sizeQuat; + while(_g70 < _g160) { + var i61 = _g70++; + newArray59[i61] = _this68.stackQuat[i61]; + _this68.stackQuat[i61] = null; + } + _this68.stackQuat = newArray59; + } + _this68.stackQuat[_this68.sizeQuat++] = quat14; + } + var _this69 = this.p; + var mat314 = null; + var mat415 = null; + var quat15 = null; + if(ez != null) { + ez.zero(); + if(_this69.sizeVec3 == _this69.stackVec3.length) { + var newLength60 = _this69.sizeVec3 << 1; + var this61 = new Array(newLength60); + var newArray60 = this61; + var _g71 = 0; + var _g161 = _this69.sizeVec3; + while(_g71 < _g161) { + var i62 = _g71++; + newArray60[i62] = _this69.stackVec3[i62]; + _this69.stackVec3[i62] = null; + } + _this69.stackVec3 = newArray60; + } + _this69.stackVec3[_this69.sizeVec3++] = ez; + } + if(mat314 != null) { + var t0030 = 1; + var t0130 = 0; + var t0230 = 0; + var t1030 = 0; + var t1130 = 1; + var t1230 = 0; + var t2030 = 0; + var t2130 = 0; + var t2230 = 1; + mat314.e00 = t0030; + mat314.e01 = t0130; + mat314.e02 = t0230; + mat314.e10 = t1030; + mat314.e11 = t1130; + mat314.e12 = t1230; + mat314.e20 = t2030; + mat314.e21 = t2130; + mat314.e22 = t2230; + if(_this69.sizeMat3 == _this69.stackMat3.length) { + var newLength61 = _this69.sizeMat3 << 1; + var this62 = new Array(newLength61); + var newArray61 = this62; + var _g72 = 0; + var _g162 = _this69.sizeMat3; + while(_g72 < _g162) { + var i63 = _g72++; + newArray61[i63] = _this69.stackMat3[i63]; + _this69.stackMat3[i63] = null; + } + _this69.stackMat3 = newArray61; + } + _this69.stackMat3[_this69.sizeMat3++] = mat314; + } + if(mat415 != null) { + var t0031 = 1; + var t0131 = 0; + var t0231 = 0; + var t0315 = 0; + var t1031 = 0; + var t1131 = 1; + var t1231 = 0; + var t1315 = 0; + var t2031 = 0; + var t2131 = 0; + var t2231 = 1; + var t2315 = 0; + var t3015 = 0; + var t3115 = 0; + var t3215 = 0; + var t3315 = 1; + mat415.e00 = t0031; + mat415.e01 = t0131; + mat415.e02 = t0231; + mat415.e03 = t0315; + mat415.e10 = t1031; + mat415.e11 = t1131; + mat415.e12 = t1231; + mat415.e13 = t1315; + mat415.e20 = t2031; + mat415.e21 = t2131; + mat415.e22 = t2231; + mat415.e23 = t2315; + mat415.e30 = t3015; + mat415.e31 = t3115; + mat415.e32 = t3215; + mat415.e33 = t3315; + if(_this69.sizeMat4 == _this69.stackMat4.length) { + var newLength62 = _this69.sizeMat4 << 1; + var this63 = new Array(newLength62); + var newArray62 = this63; + var _g73 = 0; + var _g163 = _this69.sizeMat4; + while(_g73 < _g163) { + var i64 = _g73++; + newArray62[i64] = _this69.stackMat4[i64]; + _this69.stackMat4[i64] = null; + } + _this69.stackMat4 = newArray62; + } + _this69.stackMat4[_this69.sizeMat4++] = mat415; + } + if(quat15 != null) { + var tx39 = 0; + var ty39 = 0; + var tz39 = 0; + var tw15 = 1; + quat15.x = tx39; + quat15.y = ty39; + quat15.z = tz39; + quat15.w = tw15; + if(_this69.sizeQuat == _this69.stackQuat.length) { + var newLength63 = _this69.sizeQuat << 1; + var this64 = new Array(newLength63); + var newArray63 = this64; + var _g74 = 0; + var _g164 = _this69.sizeQuat; + while(_g74 < _g164) { + var i65 = _g74++; + newArray63[i65] = _this69.stackQuat[i65]; + _this69.stackQuat[i65] = null; + } + _this69.stackQuat = newArray63; + } + _this69.stackQuat[_this69.sizeQuat++] = quat15; + } + } + capsule(tf,radius,halfHeight,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var nt = 4; + var np = 8; + var vs = this.tmpSphereVerts; + var ns = this.tmpSphereNorms; + var _g = 0; + var _g1 = nt + 1; + while(_g < _g1) { + var i2 = _g++; + var n = this.tmpSphereVerts[i2].length; + var _g2 = 0; + var _g11 = n; + while(_g2 < _g11) { + var j2 = _g2++; + var _this5 = ns[i2][j2]; + var v1 = this.sphereCoords[i2][j2]; + _this5.x = v1.x; + _this5.y = v1.y; + _this5.z = v1.z; + var _this6 = _this5; + var tx = _this6.x * m.e00 + _this6.y * m.e01 + _this6.z * m.e02; + var ty = _this6.x * m.e10 + _this6.y * m.e11 + _this6.z * m.e12; + var tz = _this6.x * m.e20 + _this6.y * m.e21 + _this6.z * m.e22; + _this6.x = tx; + _this6.y = ty; + _this6.z = tz; + } + } + var _g21 = 0; + var _g3 = nt; + while(_g21 < _g3) { + var i = _g21++; + if(i == 0) { + var half = nt >> 1; + var _g22 = 0; + var _g31 = half + 1; + while(_g22 < _g31) { + var i21 = _g22++; + var n1 = this.tmpSphereVerts[i21].length; + var _g23 = 0; + var _g32 = n1; + while(_g23 < _g32) { + var j21 = _g23++; + var _this7 = vs[i21][j21]; + var v2 = ns[i21][j21]; + _this7.x = v2.x; + _this7.y = v2.y; + _this7.z = v2.z; + var _this8 = _this7; + var tx1 = _this8.x * radius; + var ty1 = _this8.y * radius; + var tz1 = _this8.z * radius; + _this8.x = tx1; + _this8.y = ty1; + _this8.z = tz1; + var _this9 = _this8; + var tx2 = _this9.x + o.x; + var ty2 = _this9.y + o.y; + var tz2 = _this9.z + o.z; + _this9.x = tx2; + _this9.y = ty2; + _this9.z = tz2; + var _this10 = _this9; + var tx3 = _this10.x + ey.x * halfHeight; + var ty3 = _this10.y + ey.y * halfHeight; + var tz3 = _this10.z + ey.z * halfHeight; + _this10.x = tx3; + _this10.y = ty3; + _this10.z = tz3; + } + } + } + if(i == nt >> 1) { + var half1 = nt >> 1; + var _g24 = half1; + var _g33 = nt + 1; + while(_g24 < _g33) { + var i22 = _g24++; + var n2 = this.tmpSphereVerts[i22].length; + var _g25 = 0; + var _g34 = n2; + while(_g25 < _g34) { + var j22 = _g25++; + var _this11 = vs[i22][j22]; + var v3 = ns[i22][j22]; + _this11.x = v3.x; + _this11.y = v3.y; + _this11.z = v3.z; + var _this12 = _this11; + var tx4 = _this12.x * radius; + var ty4 = _this12.y * radius; + var tz4 = _this12.z * radius; + _this12.x = tx4; + _this12.y = ty4; + _this12.z = tz4; + var _this13 = _this12; + var tx5 = _this13.x + o.x; + var ty5 = _this13.y + o.y; + var tz5 = _this13.z + o.z; + _this13.x = tx5; + _this13.y = ty5; + _this13.z = tz5; + var _this14 = _this13; + var s = -halfHeight; + var tx6 = _this14.x + ey.x * s; + var ty6 = _this14.y + ey.y * s; + var tz6 = _this14.z + ey.z * s; + _this14.x = tx6; + _this14.y = ty6; + _this14.z = tz6; + } + } + } + var _g26 = 0; + var _g35 = np; + while(_g26 < _g35) { + var j = _g26++; + var v11; + var v21; + var v31; + var v4; + var n11; + var n21; + var n3; + var n4; + if(i == 0) { + if(this.wireframe) { + v11 = vs[0][0]; + v21 = vs[1][j]; + this.line(v11,v21,color); + } else { + v11 = vs[0][0]; + v21 = vs[1][j]; + v31 = vs[1][(j + 1) % np]; + n11 = ns[0][0]; + n21 = ns[1][j]; + n3 = ns[1][(j + 1) % np]; + this.triangle(v11,v21,v31,n11,n21,n3,color); + } + } else if(i == nt - 1) { + if(this.wireframe) { + v11 = vs[nt][0]; + v21 = vs[i][(j + 1) % np]; + v31 = vs[i][j]; + this.line(v11,v21,color); + this.line(v21,v31,color); + } else { + v11 = vs[nt][0]; + v21 = vs[i][(j + 1) % np]; + v31 = vs[i][j]; + n11 = ns[nt][0]; + n21 = ns[i][(j + 1) % np]; + n3 = ns[i][j]; + this.triangle(v11,v21,v31,n11,n21,n3,color); + } + } else if(this.wireframe) { + v11 = vs[i][j]; + v21 = vs[i][(j + 1) % np]; + v31 = vs[i + 1][j]; + this.line(v11,v21,color); + this.line(v11,v31,color); + } else { + v11 = vs[i][j]; + v21 = vs[i][(j + 1) % np]; + v31 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % np]; + n11 = ns[i][j]; + n21 = ns[i][(j + 1) % np]; + n3 = ns[i + 1][j]; + n4 = ns[i + 1][(j + 1) % np]; + this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); + } + } + } + var _this15 = this.p; + var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = o.x; + _this16.y = o.y; + _this16.z = o.z; + var _this17 = _this16; + var tx7 = _this17.x + ey.x * halfHeight; + var ty7 = _this17.y + ey.y * halfHeight; + var tz7 = _this17.z + ey.z * halfHeight; + _this17.x = tx7; + _this17.y = ty7; + _this17.z = tz7; + var top = _this17; + var _this18 = this.p; + var _this19 = _this18.sizeVec3 == 0 ? new oimo.common.Vec3() : _this18.stackVec3[--_this18.sizeVec3]; + _this19.x = o.x; + _this19.y = o.y; + _this19.z = o.z; + var _this20 = _this19; + var s1 = -halfHeight; + var tx8 = _this20.x + ey.x * s1; + var ty8 = _this20.y + ey.y * s1; + var tz8 = _this20.z + ey.z * s1; + _this20.x = tx8; + _this20.y = ty8; + _this20.z = tz8; + var bottom = _this20; + if(this.wireframe) { + var _this21 = this.p; + var _this22 = _this21.sizeVec3 == 0 ? new oimo.common.Vec3() : _this21.stackVec3[--_this21.sizeVec3]; + _this22.x = top.x; + _this22.y = top.y; + _this22.z = top.z; + var _this23 = _this22; + var s2 = -radius; + var tx9 = _this23.x + ex.x * s2; + var ty9 = _this23.y + ex.y * s2; + var tz9 = _this23.z + ex.z * s2; + _this23.x = tx9; + _this23.y = ty9; + _this23.z = tz9; + var _this24 = _this23; + var tx10 = _this24.x + ez.x * 0; + var ty10 = _this24.y + ez.y * 0; + var tz10 = _this24.z + ez.z * 0; + _this24.x = tx10; + _this24.y = ty10; + _this24.z = tz10; + var top1 = _this24; + var _this25 = this.p; + var _this26 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; + _this26.x = top.x; + _this26.y = top.y; + _this26.z = top.z; + var _this27 = _this26; + var tx11 = _this27.x + ex.x * radius; + var ty11 = _this27.y + ex.y * radius; + var tz11 = _this27.z + ex.z * radius; + _this27.x = tx11; + _this27.y = ty11; + _this27.z = tz11; + var _this28 = _this27; + var tx12 = _this28.x + ez.x * 0; + var ty12 = _this28.y + ez.y * 0; + var tz12 = _this28.z + ez.z * 0; + _this28.x = tx12; + _this28.y = ty12; + _this28.z = tz12; + var top2 = _this28; + var _this29 = this.p; + var _this30 = _this29.sizeVec3 == 0 ? new oimo.common.Vec3() : _this29.stackVec3[--_this29.sizeVec3]; + _this30.x = top.x; + _this30.y = top.y; + _this30.z = top.z; + var _this31 = _this30; + var tx13 = _this31.x + ex.x * 0; + var ty13 = _this31.y + ex.y * 0; + var tz13 = _this31.z + ex.z * 0; + _this31.x = tx13; + _this31.y = ty13; + _this31.z = tz13; + var _this32 = _this31; + var s3 = -radius; + var tx14 = _this32.x + ez.x * s3; + var ty14 = _this32.y + ez.y * s3; + var tz14 = _this32.z + ez.z * s3; + _this32.x = tx14; + _this32.y = ty14; + _this32.z = tz14; + var top3 = _this32; + var _this33 = this.p; + var _this34 = _this33.sizeVec3 == 0 ? new oimo.common.Vec3() : _this33.stackVec3[--_this33.sizeVec3]; + _this34.x = top.x; + _this34.y = top.y; + _this34.z = top.z; + var _this35 = _this34; + var tx15 = _this35.x + ex.x * 0; + var ty15 = _this35.y + ex.y * 0; + var tz15 = _this35.z + ex.z * 0; + _this35.x = tx15; + _this35.y = ty15; + _this35.z = tz15; + var _this36 = _this35; + var tx16 = _this36.x + ez.x * radius; + var ty16 = _this36.y + ez.y * radius; + var tz16 = _this36.z + ez.z * radius; + _this36.x = tx16; + _this36.y = ty16; + _this36.z = tz16; + var top4 = _this36; + var _this37 = this.p; + var _this38 = _this37.sizeVec3 == 0 ? new oimo.common.Vec3() : _this37.stackVec3[--_this37.sizeVec3]; + _this38.x = bottom.x; + _this38.y = bottom.y; + _this38.z = bottom.z; + var _this39 = _this38; + var s4 = -radius; + var tx17 = _this39.x + ex.x * s4; + var ty17 = _this39.y + ex.y * s4; + var tz17 = _this39.z + ex.z * s4; + _this39.x = tx17; + _this39.y = ty17; + _this39.z = tz17; + var _this40 = _this39; + var tx18 = _this40.x + ez.x * 0; + var ty18 = _this40.y + ez.y * 0; + var tz18 = _this40.z + ez.z * 0; + _this40.x = tx18; + _this40.y = ty18; + _this40.z = tz18; + var bottom1 = _this40; + var _this41 = this.p; + var _this42 = _this41.sizeVec3 == 0 ? new oimo.common.Vec3() : _this41.stackVec3[--_this41.sizeVec3]; + _this42.x = bottom.x; + _this42.y = bottom.y; + _this42.z = bottom.z; + var _this43 = _this42; + var tx19 = _this43.x + ex.x * radius; + var ty19 = _this43.y + ex.y * radius; + var tz19 = _this43.z + ex.z * radius; + _this43.x = tx19; + _this43.y = ty19; + _this43.z = tz19; + var _this44 = _this43; + var tx20 = _this44.x + ez.x * 0; + var ty20 = _this44.y + ez.y * 0; + var tz20 = _this44.z + ez.z * 0; + _this44.x = tx20; + _this44.y = ty20; + _this44.z = tz20; + var bottom2 = _this44; + var _this45 = this.p; + var _this46 = _this45.sizeVec3 == 0 ? new oimo.common.Vec3() : _this45.stackVec3[--_this45.sizeVec3]; + _this46.x = bottom.x; + _this46.y = bottom.y; + _this46.z = bottom.z; + var _this47 = _this46; + var tx21 = _this47.x + ex.x * 0; + var ty21 = _this47.y + ex.y * 0; + var tz21 = _this47.z + ex.z * 0; + _this47.x = tx21; + _this47.y = ty21; + _this47.z = tz21; + var _this48 = _this47; + var s5 = -radius; + var tx22 = _this48.x + ez.x * s5; + var ty22 = _this48.y + ez.y * s5; + var tz22 = _this48.z + ez.z * s5; + _this48.x = tx22; + _this48.y = ty22; + _this48.z = tz22; + var bottom3 = _this48; + var _this49 = this.p; + var _this50 = _this49.sizeVec3 == 0 ? new oimo.common.Vec3() : _this49.stackVec3[--_this49.sizeVec3]; + _this50.x = bottom.x; + _this50.y = bottom.y; + _this50.z = bottom.z; + var _this51 = _this50; + var tx23 = _this51.x + ex.x * 0; + var ty23 = _this51.y + ex.y * 0; + var tz23 = _this51.z + ex.z * 0; + _this51.x = tx23; + _this51.y = ty23; + _this51.z = tz23; + var _this52 = _this51; + var tx24 = _this52.x + ez.x * radius; + var ty24 = _this52.y + ez.y * radius; + var tz24 = _this52.z + ez.z * radius; + _this52.x = tx24; + _this52.y = ty24; + _this52.z = tz24; + var bottom4 = _this52; + this.ellipse(top,ex,ez,radius,radius,color); + this.ellipse(bottom,ex,ez,radius,radius,color); + this.line(top1,bottom1,color); + this.line(top2,bottom2,color); + this.line(top3,bottom3,color); + this.line(top4,bottom4,color); + var _this53 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(top1 != null) { + top1.zero(); + if(_this53.sizeVec3 == _this53.stackVec3.length) { + var newLength = _this53.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g4 = 0; + var _g12 = _this53.sizeVec3; + while(_g4 < _g12) { + var i1 = _g4++; + newArray[i1] = _this53.stackVec3[i1]; + _this53.stackVec3[i1] = null; + } + _this53.stackVec3 = newArray; + } + _this53.stackVec3[_this53.sizeVec3++] = top1; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this53.sizeMat3 == _this53.stackMat3.length) { + var newLength1 = _this53.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g5 = 0; + var _g13 = _this53.sizeMat3; + while(_g5 < _g13) { + var i3 = _g5++; + newArray1[i3] = _this53.stackMat3[i3]; + _this53.stackMat3[i3] = null; + } + _this53.stackMat3 = newArray1; + } + _this53.stackMat3[_this53.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this53.sizeMat4 == _this53.stackMat4.length) { + var newLength2 = _this53.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g6 = 0; + var _g14 = _this53.sizeMat4; + while(_g6 < _g14) { + var i4 = _g6++; + newArray2[i4] = _this53.stackMat4[i4]; + _this53.stackMat4[i4] = null; + } + _this53.stackMat4 = newArray2; + } + _this53.stackMat4[_this53.sizeMat4++] = mat4; + } + if(quat != null) { + var tx25 = 0; + var ty25 = 0; + var tz25 = 0; + var tw = 1; + quat.x = tx25; + quat.y = ty25; + quat.z = tz25; + quat.w = tw; + if(_this53.sizeQuat == _this53.stackQuat.length) { + var newLength3 = _this53.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g7 = 0; + var _g15 = _this53.sizeQuat; + while(_g7 < _g15) { + var i5 = _g7++; + newArray3[i5] = _this53.stackQuat[i5]; + _this53.stackQuat[i5] = null; + } + _this53.stackQuat = newArray3; + } + _this53.stackQuat[_this53.sizeQuat++] = quat; + } + var _this54 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(top2 != null) { + top2.zero(); + if(_this54.sizeVec3 == _this54.stackVec3.length) { + var newLength4 = _this54.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g8 = 0; + var _g16 = _this54.sizeVec3; + while(_g8 < _g16) { + var i6 = _g8++; + newArray4[i6] = _this54.stackVec3[i6]; + _this54.stackVec3[i6] = null; + } + _this54.stackVec3 = newArray4; + } + _this54.stackVec3[_this54.sizeVec3++] = top2; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this54.sizeMat3 == _this54.stackMat3.length) { + var newLength5 = _this54.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g9 = 0; + var _g17 = _this54.sizeMat3; + while(_g9 < _g17) { + var i7 = _g9++; + newArray5[i7] = _this54.stackMat3[i7]; + _this54.stackMat3[i7] = null; + } + _this54.stackMat3 = newArray5; + } + _this54.stackMat3[_this54.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this54.sizeMat4 == _this54.stackMat4.length) { + var newLength6 = _this54.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g10 = 0; + var _g18 = _this54.sizeMat4; + while(_g10 < _g18) { + var i8 = _g10++; + newArray6[i8] = _this54.stackMat4[i8]; + _this54.stackMat4[i8] = null; + } + _this54.stackMat4 = newArray6; + } + _this54.stackMat4[_this54.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx26 = 0; + var ty26 = 0; + var tz26 = 0; + var tw1 = 1; + quat1.x = tx26; + quat1.y = ty26; + quat1.z = tz26; + quat1.w = tw1; + if(_this54.sizeQuat == _this54.stackQuat.length) { + var newLength7 = _this54.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g19 = 0; + var _g110 = _this54.sizeQuat; + while(_g19 < _g110) { + var i9 = _g19++; + newArray7[i9] = _this54.stackQuat[i9]; + _this54.stackQuat[i9] = null; + } + _this54.stackQuat = newArray7; + } + _this54.stackQuat[_this54.sizeQuat++] = quat1; + } + var _this55 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(top3 != null) { + top3.zero(); + if(_this55.sizeVec3 == _this55.stackVec3.length) { + var newLength8 = _this55.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g20 = 0; + var _g111 = _this55.sizeVec3; + while(_g20 < _g111) { + var i10 = _g20++; + newArray8[i10] = _this55.stackVec3[i10]; + _this55.stackVec3[i10] = null; + } + _this55.stackVec3 = newArray8; + } + _this55.stackVec3[_this55.sizeVec3++] = top3; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this55.sizeMat3 == _this55.stackMat3.length) { + var newLength9 = _this55.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g27 = 0; + var _g112 = _this55.sizeMat3; + while(_g27 < _g112) { + var i11 = _g27++; + newArray9[i11] = _this55.stackMat3[i11]; + _this55.stackMat3[i11] = null; + } + _this55.stackMat3 = newArray9; + } + _this55.stackMat3[_this55.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this55.sizeMat4 == _this55.stackMat4.length) { + var newLength10 = _this55.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g28 = 0; + var _g113 = _this55.sizeMat4; + while(_g28 < _g113) { + var i12 = _g28++; + newArray10[i12] = _this55.stackMat4[i12]; + _this55.stackMat4[i12] = null; + } + _this55.stackMat4 = newArray10; + } + _this55.stackMat4[_this55.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx27 = 0; + var ty27 = 0; + var tz27 = 0; + var tw2 = 1; + quat2.x = tx27; + quat2.y = ty27; + quat2.z = tz27; + quat2.w = tw2; + if(_this55.sizeQuat == _this55.stackQuat.length) { + var newLength11 = _this55.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g29 = 0; + var _g114 = _this55.sizeQuat; + while(_g29 < _g114) { + var i13 = _g29++; + newArray11[i13] = _this55.stackQuat[i13]; + _this55.stackQuat[i13] = null; + } + _this55.stackQuat = newArray11; + } + _this55.stackQuat[_this55.sizeQuat++] = quat2; + } + var _this56 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(top4 != null) { + top4.zero(); + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newLength12 = _this56.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g30 = 0; + var _g115 = _this56.sizeVec3; + while(_g30 < _g115) { + var i14 = _g30++; + newArray12[i14] = _this56.stackVec3[i14]; + _this56.stackVec3[i14] = null; + } + _this56.stackVec3 = newArray12; + } + _this56.stackVec3[_this56.sizeVec3++] = top4; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this56.sizeMat3 == _this56.stackMat3.length) { + var newLength13 = _this56.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g36 = 0; + var _g116 = _this56.sizeMat3; + while(_g36 < _g116) { + var i15 = _g36++; + newArray13[i15] = _this56.stackMat3[i15]; + _this56.stackMat3[i15] = null; + } + _this56.stackMat3 = newArray13; + } + _this56.stackMat3[_this56.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this56.sizeMat4 == _this56.stackMat4.length) { + var newLength14 = _this56.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g37 = 0; + var _g117 = _this56.sizeMat4; + while(_g37 < _g117) { + var i16 = _g37++; + newArray14[i16] = _this56.stackMat4[i16]; + _this56.stackMat4[i16] = null; + } + _this56.stackMat4 = newArray14; + } + _this56.stackMat4[_this56.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx28 = 0; + var ty28 = 0; + var tz28 = 0; + var tw3 = 1; + quat3.x = tx28; + quat3.y = ty28; + quat3.z = tz28; + quat3.w = tw3; + if(_this56.sizeQuat == _this56.stackQuat.length) { + var newLength15 = _this56.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g38 = 0; + var _g118 = _this56.sizeQuat; + while(_g38 < _g118) { + var i17 = _g38++; + newArray15[i17] = _this56.stackQuat[i17]; + _this56.stackQuat[i17] = null; + } + _this56.stackQuat = newArray15; + } + _this56.stackQuat[_this56.sizeQuat++] = quat3; + } + var _this57 = this.p; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(bottom1 != null) { + bottom1.zero(); + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newLength16 = _this57.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g39 = 0; + var _g119 = _this57.sizeVec3; + while(_g39 < _g119) { + var i18 = _g39++; + newArray16[i18] = _this57.stackVec3[i18]; + _this57.stackVec3[i18] = null; + } + _this57.stackVec3 = newArray16; + } + _this57.stackVec3[_this57.sizeVec3++] = bottom1; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this57.sizeMat3 == _this57.stackMat3.length) { + var newLength17 = _this57.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g40 = 0; + var _g120 = _this57.sizeMat3; + while(_g40 < _g120) { + var i19 = _g40++; + newArray17[i19] = _this57.stackMat3[i19]; + _this57.stackMat3[i19] = null; + } + _this57.stackMat3 = newArray17; + } + _this57.stackMat3[_this57.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this57.sizeMat4 == _this57.stackMat4.length) { + var newLength18 = _this57.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g41 = 0; + var _g121 = _this57.sizeMat4; + while(_g41 < _g121) { + var i20 = _g41++; + newArray18[i20] = _this57.stackMat4[i20]; + _this57.stackMat4[i20] = null; + } + _this57.stackMat4 = newArray18; + } + _this57.stackMat4[_this57.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx29 = 0; + var ty29 = 0; + var tz29 = 0; + var tw4 = 1; + quat4.x = tx29; + quat4.y = ty29; + quat4.z = tz29; + quat4.w = tw4; + if(_this57.sizeQuat == _this57.stackQuat.length) { + var newLength19 = _this57.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g42 = 0; + var _g122 = _this57.sizeQuat; + while(_g42 < _g122) { + var i23 = _g42++; + newArray19[i23] = _this57.stackQuat[i23]; + _this57.stackQuat[i23] = null; + } + _this57.stackQuat = newArray19; + } + _this57.stackQuat[_this57.sizeQuat++] = quat4; + } + var _this58 = this.p; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(bottom2 != null) { + bottom2.zero(); + if(_this58.sizeVec3 == _this58.stackVec3.length) { + var newLength20 = _this58.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g43 = 0; + var _g123 = _this58.sizeVec3; + while(_g43 < _g123) { + var i24 = _g43++; + newArray20[i24] = _this58.stackVec3[i24]; + _this58.stackVec3[i24] = null; + } + _this58.stackVec3 = newArray20; + } + _this58.stackVec3[_this58.sizeVec3++] = bottom2; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this58.sizeMat3 == _this58.stackMat3.length) { + var newLength21 = _this58.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g44 = 0; + var _g124 = _this58.sizeMat3; + while(_g44 < _g124) { + var i25 = _g44++; + newArray21[i25] = _this58.stackMat3[i25]; + _this58.stackMat3[i25] = null; + } + _this58.stackMat3 = newArray21; + } + _this58.stackMat3[_this58.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this58.sizeMat4 == _this58.stackMat4.length) { + var newLength22 = _this58.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g45 = 0; + var _g125 = _this58.sizeMat4; + while(_g45 < _g125) { + var i26 = _g45++; + newArray22[i26] = _this58.stackMat4[i26]; + _this58.stackMat4[i26] = null; + } + _this58.stackMat4 = newArray22; + } + _this58.stackMat4[_this58.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx30 = 0; + var ty30 = 0; + var tz30 = 0; + var tw5 = 1; + quat5.x = tx30; + quat5.y = ty30; + quat5.z = tz30; + quat5.w = tw5; + if(_this58.sizeQuat == _this58.stackQuat.length) { + var newLength23 = _this58.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g46 = 0; + var _g126 = _this58.sizeQuat; + while(_g46 < _g126) { + var i27 = _g46++; + newArray23[i27] = _this58.stackQuat[i27]; + _this58.stackQuat[i27] = null; + } + _this58.stackQuat = newArray23; + } + _this58.stackQuat[_this58.sizeQuat++] = quat5; + } + var _this59 = this.p; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(bottom3 != null) { + bottom3.zero(); + if(_this59.sizeVec3 == _this59.stackVec3.length) { + var newLength24 = _this59.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g47 = 0; + var _g127 = _this59.sizeVec3; + while(_g47 < _g127) { + var i28 = _g47++; + newArray24[i28] = _this59.stackVec3[i28]; + _this59.stackVec3[i28] = null; + } + _this59.stackVec3 = newArray24; + } + _this59.stackVec3[_this59.sizeVec3++] = bottom3; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this59.sizeMat3 == _this59.stackMat3.length) { + var newLength25 = _this59.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g48 = 0; + var _g128 = _this59.sizeMat3; + while(_g48 < _g128) { + var i29 = _g48++; + newArray25[i29] = _this59.stackMat3[i29]; + _this59.stackMat3[i29] = null; + } + _this59.stackMat3 = newArray25; + } + _this59.stackMat3[_this59.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this59.sizeMat4 == _this59.stackMat4.length) { + var newLength26 = _this59.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g49 = 0; + var _g129 = _this59.sizeMat4; + while(_g49 < _g129) { + var i30 = _g49++; + newArray26[i30] = _this59.stackMat4[i30]; + _this59.stackMat4[i30] = null; + } + _this59.stackMat4 = newArray26; + } + _this59.stackMat4[_this59.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx31 = 0; + var ty31 = 0; + var tz31 = 0; + var tw6 = 1; + quat6.x = tx31; + quat6.y = ty31; + quat6.z = tz31; + quat6.w = tw6; + if(_this59.sizeQuat == _this59.stackQuat.length) { + var newLength27 = _this59.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g50 = 0; + var _g130 = _this59.sizeQuat; + while(_g50 < _g130) { + var i31 = _g50++; + newArray27[i31] = _this59.stackQuat[i31]; + _this59.stackQuat[i31] = null; + } + _this59.stackQuat = newArray27; + } + _this59.stackQuat[_this59.sizeQuat++] = quat6; + } + var _this60 = this.p; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(bottom4 != null) { + bottom4.zero(); + if(_this60.sizeVec3 == _this60.stackVec3.length) { + var newLength28 = _this60.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g51 = 0; + var _g131 = _this60.sizeVec3; + while(_g51 < _g131) { + var i32 = _g51++; + newArray28[i32] = _this60.stackVec3[i32]; + _this60.stackVec3[i32] = null; + } + _this60.stackVec3 = newArray28; + } + _this60.stackVec3[_this60.sizeVec3++] = bottom4; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this60.sizeMat3 == _this60.stackMat3.length) { + var newLength29 = _this60.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g52 = 0; + var _g132 = _this60.sizeMat3; + while(_g52 < _g132) { + var i33 = _g52++; + newArray29[i33] = _this60.stackMat3[i33]; + _this60.stackMat3[i33] = null; + } + _this60.stackMat3 = newArray29; + } + _this60.stackMat3[_this60.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this60.sizeMat4 == _this60.stackMat4.length) { + var newLength30 = _this60.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g53 = 0; + var _g133 = _this60.sizeMat4; + while(_g53 < _g133) { + var i34 = _g53++; + newArray30[i34] = _this60.stackMat4[i34]; + _this60.stackMat4[i34] = null; + } + _this60.stackMat4 = newArray30; + } + _this60.stackMat4[_this60.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx32 = 0; + var ty32 = 0; + var tz32 = 0; + var tw7 = 1; + quat7.x = tx32; + quat7.y = ty32; + quat7.z = tz32; + quat7.w = tw7; + if(_this60.sizeQuat == _this60.stackQuat.length) { + var newLength31 = _this60.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g54 = 0; + var _g134 = _this60.sizeQuat; + while(_g54 < _g134) { + var i35 = _g54++; + newArray31[i35] = _this60.stackQuat[i35]; + _this60.stackQuat[i35] = null; + } + _this60.stackQuat = newArray31; + } + _this60.stackQuat[_this60.sizeQuat++] = quat7; + } + } else { + var _g410 = 0; + while(_g410 < 8) { + var i36 = _g410++; + var _this61 = this.tmpCircleNorms[i36]; + var v5 = this.circleCoords[i36]; + _this61.x = v5.x; + _this61.y = v5.y; + _this61.z = v5.z; + var _this62 = _this61; + var tx33 = _this62.x * m.e00 + _this62.y * m.e01 + _this62.z * m.e02; + var ty33 = _this62.x * m.e10 + _this62.y * m.e11 + _this62.z * m.e12; + var tz33 = _this62.x * m.e20 + _this62.y * m.e21 + _this62.z * m.e22; + _this62.x = tx33; + _this62.y = ty33; + _this62.z = tz33; + var _this63 = this.tmpCircleVerts1[i36]; + var v6 = this.tmpCircleNorms[i36]; + _this63.x = v6.x; + _this63.y = v6.y; + _this63.z = v6.z; + var _this64 = _this63; + var tx34 = _this64.x * radius; + var ty34 = _this64.y * radius; + var tz34 = _this64.z * radius; + _this64.x = tx34; + _this64.y = ty34; + _this64.z = tz34; + var _this65 = _this64; + var tx35 = _this65.x + o.x; + var ty35 = _this65.y + o.y; + var tz35 = _this65.z + o.z; + _this65.x = tx35; + _this65.y = ty35; + _this65.z = tz35; + var _this66 = this.tmpCircleVerts2[i36]; + var v7 = this.tmpCircleVerts1[i36]; + _this66.x = v7.x; + _this66.y = v7.y; + _this66.z = v7.z; + var _this67 = this.tmpCircleVerts1[i36]; + var tx36 = _this67.x + ey.x * halfHeight; + var ty36 = _this67.y + ey.y * halfHeight; + var tz36 = _this67.z + ey.z * halfHeight; + _this67.x = tx36; + _this67.y = ty36; + _this67.z = tz36; + var _this68 = this.tmpCircleVerts2[i36]; + var s6 = -halfHeight; + var tx37 = _this68.x + ey.x * s6; + var ty37 = _this68.y + ey.y * s6; + var tz37 = _this68.z + ey.z * s6; + _this68.x = tx37; + _this68.y = ty37; + _this68.z = tz37; + } + var _g55 = 0; + while(_g55 < 8) { + var i37 = _g55++; + var v12 = this.tmpCircleVerts1[i37]; + var v22 = this.tmpCircleVerts2[i37]; + var v32 = this.tmpCircleVerts2[(i37 + 1) % 8]; + var v41 = this.tmpCircleVerts1[(i37 + 1) % 8]; + var n12 = this.tmpCircleNorms[i37]; + var n22 = this.tmpCircleNorms[(i37 + 1) % 8]; + this.rect(v12,v22,v32,v41,n12,n12,n22,n22,color); + } + } + var _this69 = this.p; + var mat38 = null; + var mat48 = null; + var quat8 = null; + if(top != null) { + top.zero(); + if(_this69.sizeVec3 == _this69.stackVec3.length) { + var newLength32 = _this69.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g56 = 0; + var _g135 = _this69.sizeVec3; + while(_g56 < _g135) { + var i38 = _g56++; + newArray32[i38] = _this69.stackVec3[i38]; + _this69.stackVec3[i38] = null; + } + _this69.stackVec3 = newArray32; + } + _this69.stackVec3[_this69.sizeVec3++] = top; + } + if(mat38 != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + mat38.e00 = t0016; + mat38.e01 = t0116; + mat38.e02 = t0216; + mat38.e10 = t1016; + mat38.e11 = t1116; + mat38.e12 = t1216; + mat38.e20 = t2016; + mat38.e21 = t2116; + mat38.e22 = t2216; + if(_this69.sizeMat3 == _this69.stackMat3.length) { + var newLength33 = _this69.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g57 = 0; + var _g136 = _this69.sizeMat3; + while(_g57 < _g136) { + var i39 = _g57++; + newArray33[i39] = _this69.stackMat3[i39]; + _this69.stackMat3[i39] = null; + } + _this69.stackMat3 = newArray33; + } + _this69.stackMat3[_this69.sizeMat3++] = mat38; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this69.sizeMat4 == _this69.stackMat4.length) { + var newLength34 = _this69.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g58 = 0; + var _g137 = _this69.sizeMat4; + while(_g58 < _g137) { + var i40 = _g58++; + newArray34[i40] = _this69.stackMat4[i40]; + _this69.stackMat4[i40] = null; + } + _this69.stackMat4 = newArray34; + } + _this69.stackMat4[_this69.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx38 = 0; + var ty38 = 0; + var tz38 = 0; + var tw8 = 1; + quat8.x = tx38; + quat8.y = ty38; + quat8.z = tz38; + quat8.w = tw8; + if(_this69.sizeQuat == _this69.stackQuat.length) { + var newLength35 = _this69.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g59 = 0; + var _g138 = _this69.sizeQuat; + while(_g59 < _g138) { + var i41 = _g59++; + newArray35[i41] = _this69.stackQuat[i41]; + _this69.stackQuat[i41] = null; + } + _this69.stackQuat = newArray35; + } + _this69.stackQuat[_this69.sizeQuat++] = quat8; + } + var _this70 = this.p; + var mat39 = null; + var mat49 = null; + var quat9 = null; + if(bottom != null) { + bottom.zero(); + if(_this70.sizeVec3 == _this70.stackVec3.length) { + var newLength36 = _this70.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g60 = 0; + var _g139 = _this70.sizeVec3; + while(_g60 < _g139) { + var i42 = _g60++; + newArray36[i42] = _this70.stackVec3[i42]; + _this70.stackVec3[i42] = null; + } + _this70.stackVec3 = newArray36; + } + _this70.stackVec3[_this70.sizeVec3++] = bottom; + } + if(mat39 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat39.e00 = t0018; + mat39.e01 = t0118; + mat39.e02 = t0218; + mat39.e10 = t1018; + mat39.e11 = t1118; + mat39.e12 = t1218; + mat39.e20 = t2018; + mat39.e21 = t2118; + mat39.e22 = t2218; + if(_this70.sizeMat3 == _this70.stackMat3.length) { + var newLength37 = _this70.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g61 = 0; + var _g140 = _this70.sizeMat3; + while(_g61 < _g140) { + var i43 = _g61++; + newArray37[i43] = _this70.stackMat3[i43]; + _this70.stackMat3[i43] = null; + } + _this70.stackMat3 = newArray37; + } + _this70.stackMat3[_this70.sizeMat3++] = mat39; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this70.sizeMat4 == _this70.stackMat4.length) { + var newLength38 = _this70.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g62 = 0; + var _g141 = _this70.sizeMat4; + while(_g62 < _g141) { + var i44 = _g62++; + newArray38[i44] = _this70.stackMat4[i44]; + _this70.stackMat4[i44] = null; + } + _this70.stackMat4 = newArray38; + } + _this70.stackMat4[_this70.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx39 = 0; + var ty39 = 0; + var tz39 = 0; + var tw9 = 1; + quat9.x = tx39; + quat9.y = ty39; + quat9.z = tz39; + quat9.w = tw9; + if(_this70.sizeQuat == _this70.stackQuat.length) { + var newLength39 = _this70.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g63 = 0; + var _g142 = _this70.sizeQuat; + while(_g63 < _g142) { + var i45 = _g63++; + newArray39[i45] = _this70.stackQuat[i45]; + _this70.stackQuat[i45] = null; + } + _this70.stackQuat = newArray39; + } + _this70.stackQuat[_this70.sizeQuat++] = quat9; + } + var _this71 = this.p; + var mat310 = null; + var mat410 = null; + var quat10 = null; + if(o != null) { + o.zero(); + if(_this71.sizeVec3 == _this71.stackVec3.length) { + var newLength40 = _this71.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g64 = 0; + var _g143 = _this71.sizeVec3; + while(_g64 < _g143) { + var i46 = _g64++; + newArray40[i46] = _this71.stackVec3[i46]; + _this71.stackVec3[i46] = null; + } + _this71.stackVec3 = newArray40; + } + _this71.stackVec3[_this71.sizeVec3++] = o; + } + if(mat310 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat310.e00 = t0020; + mat310.e01 = t0120; + mat310.e02 = t0220; + mat310.e10 = t1020; + mat310.e11 = t1120; + mat310.e12 = t1220; + mat310.e20 = t2020; + mat310.e21 = t2120; + mat310.e22 = t2220; + if(_this71.sizeMat3 == _this71.stackMat3.length) { + var newLength41 = _this71.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g65 = 0; + var _g144 = _this71.sizeMat3; + while(_g65 < _g144) { + var i47 = _g65++; + newArray41[i47] = _this71.stackMat3[i47]; + _this71.stackMat3[i47] = null; + } + _this71.stackMat3 = newArray41; + } + _this71.stackMat3[_this71.sizeMat3++] = mat310; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this71.sizeMat4 == _this71.stackMat4.length) { + var newLength42 = _this71.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g66 = 0; + var _g145 = _this71.sizeMat4; + while(_g66 < _g145) { + var i48 = _g66++; + newArray42[i48] = _this71.stackMat4[i48]; + _this71.stackMat4[i48] = null; + } + _this71.stackMat4 = newArray42; + } + _this71.stackMat4[_this71.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx40 = 0; + var ty40 = 0; + var tz40 = 0; + var tw10 = 1; + quat10.x = tx40; + quat10.y = ty40; + quat10.z = tz40; + quat10.w = tw10; + if(_this71.sizeQuat == _this71.stackQuat.length) { + var newLength43 = _this71.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g67 = 0; + var _g146 = _this71.sizeQuat; + while(_g67 < _g146) { + var i49 = _g67++; + newArray43[i49] = _this71.stackQuat[i49]; + _this71.stackQuat[i49] = null; + } + _this71.stackQuat = newArray43; + } + _this71.stackQuat[_this71.sizeQuat++] = quat10; + } + var _this72 = this.p; + var vec3 = null; + var mat411 = null; + var quat11 = null; + if(vec3 != null) { + vec3.zero(); + if(_this72.sizeVec3 == _this72.stackVec3.length) { + var newLength44 = _this72.sizeVec3 << 1; + var this45 = new Array(newLength44); + var newArray44 = this45; + var _g68 = 0; + var _g147 = _this72.sizeVec3; + while(_g68 < _g147) { + var i50 = _g68++; + newArray44[i50] = _this72.stackVec3[i50]; + _this72.stackVec3[i50] = null; + } + _this72.stackVec3 = newArray44; + } + _this72.stackVec3[_this72.sizeVec3++] = vec3; + } + if(m != null) { + var t0022 = 1; + var t0122 = 0; + var t0222 = 0; + var t1022 = 0; + var t1122 = 1; + var t1222 = 0; + var t2022 = 0; + var t2122 = 0; + var t2222 = 1; + m.e00 = t0022; + m.e01 = t0122; + m.e02 = t0222; + m.e10 = t1022; + m.e11 = t1122; + m.e12 = t1222; + m.e20 = t2022; + m.e21 = t2122; + m.e22 = t2222; + if(_this72.sizeMat3 == _this72.stackMat3.length) { + var newLength45 = _this72.sizeMat3 << 1; + var this46 = new Array(newLength45); + var newArray45 = this46; + var _g69 = 0; + var _g148 = _this72.sizeMat3; + while(_g69 < _g148) { + var i51 = _g69++; + newArray45[i51] = _this72.stackMat3[i51]; + _this72.stackMat3[i51] = null; + } + _this72.stackMat3 = newArray45; + } + _this72.stackMat3[_this72.sizeMat3++] = m; + } + if(mat411 != null) { + var t0023 = 1; + var t0123 = 0; + var t0223 = 0; + var t0311 = 0; + var t1023 = 0; + var t1123 = 1; + var t1223 = 0; + var t1311 = 0; + var t2023 = 0; + var t2123 = 0; + var t2223 = 1; + var t2311 = 0; + var t3011 = 0; + var t3111 = 0; + var t3211 = 0; + var t3311 = 1; + mat411.e00 = t0023; + mat411.e01 = t0123; + mat411.e02 = t0223; + mat411.e03 = t0311; + mat411.e10 = t1023; + mat411.e11 = t1123; + mat411.e12 = t1223; + mat411.e13 = t1311; + mat411.e20 = t2023; + mat411.e21 = t2123; + mat411.e22 = t2223; + mat411.e23 = t2311; + mat411.e30 = t3011; + mat411.e31 = t3111; + mat411.e32 = t3211; + mat411.e33 = t3311; + if(_this72.sizeMat4 == _this72.stackMat4.length) { + var newLength46 = _this72.sizeMat4 << 1; + var this47 = new Array(newLength46); + var newArray46 = this47; + var _g70 = 0; + var _g149 = _this72.sizeMat4; + while(_g70 < _g149) { + var i52 = _g70++; + newArray46[i52] = _this72.stackMat4[i52]; + _this72.stackMat4[i52] = null; + } + _this72.stackMat4 = newArray46; + } + _this72.stackMat4[_this72.sizeMat4++] = mat411; + } + if(quat11 != null) { + var tx41 = 0; + var ty41 = 0; + var tz41 = 0; + var tw11 = 1; + quat11.x = tx41; + quat11.y = ty41; + quat11.z = tz41; + quat11.w = tw11; + if(_this72.sizeQuat == _this72.stackQuat.length) { + var newLength47 = _this72.sizeQuat << 1; + var this48 = new Array(newLength47); + var newArray47 = this48; + var _g71 = 0; + var _g150 = _this72.sizeQuat; + while(_g71 < _g150) { + var i53 = _g71++; + newArray47[i53] = _this72.stackQuat[i53]; + _this72.stackQuat[i53] = null; + } + _this72.stackQuat = newArray47; + } + _this72.stackQuat[_this72.sizeQuat++] = quat11; + } + var _this73 = this.p; + var mat311 = null; + var mat412 = null; + var quat12 = null; + if(ex != null) { + ex.zero(); + if(_this73.sizeVec3 == _this73.stackVec3.length) { + var newLength48 = _this73.sizeVec3 << 1; + var this49 = new Array(newLength48); + var newArray48 = this49; + var _g72 = 0; + var _g151 = _this73.sizeVec3; + while(_g72 < _g151) { + var i54 = _g72++; + newArray48[i54] = _this73.stackVec3[i54]; + _this73.stackVec3[i54] = null; + } + _this73.stackVec3 = newArray48; + } + _this73.stackVec3[_this73.sizeVec3++] = ex; + } + if(mat311 != null) { + var t0024 = 1; + var t0124 = 0; + var t0224 = 0; + var t1024 = 0; + var t1124 = 1; + var t1224 = 0; + var t2024 = 0; + var t2124 = 0; + var t2224 = 1; + mat311.e00 = t0024; + mat311.e01 = t0124; + mat311.e02 = t0224; + mat311.e10 = t1024; + mat311.e11 = t1124; + mat311.e12 = t1224; + mat311.e20 = t2024; + mat311.e21 = t2124; + mat311.e22 = t2224; + if(_this73.sizeMat3 == _this73.stackMat3.length) { + var newLength49 = _this73.sizeMat3 << 1; + var this50 = new Array(newLength49); + var newArray49 = this50; + var _g73 = 0; + var _g152 = _this73.sizeMat3; + while(_g73 < _g152) { + var i55 = _g73++; + newArray49[i55] = _this73.stackMat3[i55]; + _this73.stackMat3[i55] = null; + } + _this73.stackMat3 = newArray49; + } + _this73.stackMat3[_this73.sizeMat3++] = mat311; + } + if(mat412 != null) { + var t0025 = 1; + var t0125 = 0; + var t0225 = 0; + var t0312 = 0; + var t1025 = 0; + var t1125 = 1; + var t1225 = 0; + var t1312 = 0; + var t2025 = 0; + var t2125 = 0; + var t2225 = 1; + var t2312 = 0; + var t3012 = 0; + var t3112 = 0; + var t3212 = 0; + var t3312 = 1; + mat412.e00 = t0025; + mat412.e01 = t0125; + mat412.e02 = t0225; + mat412.e03 = t0312; + mat412.e10 = t1025; + mat412.e11 = t1125; + mat412.e12 = t1225; + mat412.e13 = t1312; + mat412.e20 = t2025; + mat412.e21 = t2125; + mat412.e22 = t2225; + mat412.e23 = t2312; + mat412.e30 = t3012; + mat412.e31 = t3112; + mat412.e32 = t3212; + mat412.e33 = t3312; + if(_this73.sizeMat4 == _this73.stackMat4.length) { + var newLength50 = _this73.sizeMat4 << 1; + var this51 = new Array(newLength50); + var newArray50 = this51; + var _g74 = 0; + var _g153 = _this73.sizeMat4; + while(_g74 < _g153) { + var i56 = _g74++; + newArray50[i56] = _this73.stackMat4[i56]; + _this73.stackMat4[i56] = null; + } + _this73.stackMat4 = newArray50; + } + _this73.stackMat4[_this73.sizeMat4++] = mat412; + } + if(quat12 != null) { + var tx42 = 0; + var ty42 = 0; + var tz42 = 0; + var tw12 = 1; + quat12.x = tx42; + quat12.y = ty42; + quat12.z = tz42; + quat12.w = tw12; + if(_this73.sizeQuat == _this73.stackQuat.length) { + var newLength51 = _this73.sizeQuat << 1; + var this52 = new Array(newLength51); + var newArray51 = this52; + var _g75 = 0; + var _g154 = _this73.sizeQuat; + while(_g75 < _g154) { + var i57 = _g75++; + newArray51[i57] = _this73.stackQuat[i57]; + _this73.stackQuat[i57] = null; + } + _this73.stackQuat = newArray51; + } + _this73.stackQuat[_this73.sizeQuat++] = quat12; + } + var _this74 = this.p; + var mat312 = null; + var mat413 = null; + var quat13 = null; + if(ey != null) { + ey.zero(); + if(_this74.sizeVec3 == _this74.stackVec3.length) { + var newLength52 = _this74.sizeVec3 << 1; + var this53 = new Array(newLength52); + var newArray52 = this53; + var _g76 = 0; + var _g155 = _this74.sizeVec3; + while(_g76 < _g155) { + var i58 = _g76++; + newArray52[i58] = _this74.stackVec3[i58]; + _this74.stackVec3[i58] = null; + } + _this74.stackVec3 = newArray52; + } + _this74.stackVec3[_this74.sizeVec3++] = ey; + } + if(mat312 != null) { + var t0026 = 1; + var t0126 = 0; + var t0226 = 0; + var t1026 = 0; + var t1126 = 1; + var t1226 = 0; + var t2026 = 0; + var t2126 = 0; + var t2226 = 1; + mat312.e00 = t0026; + mat312.e01 = t0126; + mat312.e02 = t0226; + mat312.e10 = t1026; + mat312.e11 = t1126; + mat312.e12 = t1226; + mat312.e20 = t2026; + mat312.e21 = t2126; + mat312.e22 = t2226; + if(_this74.sizeMat3 == _this74.stackMat3.length) { + var newLength53 = _this74.sizeMat3 << 1; + var this54 = new Array(newLength53); + var newArray53 = this54; + var _g77 = 0; + var _g156 = _this74.sizeMat3; + while(_g77 < _g156) { + var i59 = _g77++; + newArray53[i59] = _this74.stackMat3[i59]; + _this74.stackMat3[i59] = null; + } + _this74.stackMat3 = newArray53; + } + _this74.stackMat3[_this74.sizeMat3++] = mat312; + } + if(mat413 != null) { + var t0027 = 1; + var t0127 = 0; + var t0227 = 0; + var t0313 = 0; + var t1027 = 0; + var t1127 = 1; + var t1227 = 0; + var t1313 = 0; + var t2027 = 0; + var t2127 = 0; + var t2227 = 1; + var t2313 = 0; + var t3013 = 0; + var t3113 = 0; + var t3213 = 0; + var t3313 = 1; + mat413.e00 = t0027; + mat413.e01 = t0127; + mat413.e02 = t0227; + mat413.e03 = t0313; + mat413.e10 = t1027; + mat413.e11 = t1127; + mat413.e12 = t1227; + mat413.e13 = t1313; + mat413.e20 = t2027; + mat413.e21 = t2127; + mat413.e22 = t2227; + mat413.e23 = t2313; + mat413.e30 = t3013; + mat413.e31 = t3113; + mat413.e32 = t3213; + mat413.e33 = t3313; + if(_this74.sizeMat4 == _this74.stackMat4.length) { + var newLength54 = _this74.sizeMat4 << 1; + var this55 = new Array(newLength54); + var newArray54 = this55; + var _g78 = 0; + var _g157 = _this74.sizeMat4; + while(_g78 < _g157) { + var i60 = _g78++; + newArray54[i60] = _this74.stackMat4[i60]; + _this74.stackMat4[i60] = null; + } + _this74.stackMat4 = newArray54; + } + _this74.stackMat4[_this74.sizeMat4++] = mat413; + } + if(quat13 != null) { + var tx43 = 0; + var ty43 = 0; + var tz43 = 0; + var tw13 = 1; + quat13.x = tx43; + quat13.y = ty43; + quat13.z = tz43; + quat13.w = tw13; + if(_this74.sizeQuat == _this74.stackQuat.length) { + var newLength55 = _this74.sizeQuat << 1; + var this56 = new Array(newLength55); + var newArray55 = this56; + var _g79 = 0; + var _g158 = _this74.sizeQuat; + while(_g79 < _g158) { + var i61 = _g79++; + newArray55[i61] = _this74.stackQuat[i61]; + _this74.stackQuat[i61] = null; + } + _this74.stackQuat = newArray55; + } + _this74.stackQuat[_this74.sizeQuat++] = quat13; + } + var _this75 = this.p; + var mat313 = null; + var mat414 = null; + var quat14 = null; + if(ez != null) { + ez.zero(); + if(_this75.sizeVec3 == _this75.stackVec3.length) { + var newLength56 = _this75.sizeVec3 << 1; + var this57 = new Array(newLength56); + var newArray56 = this57; + var _g80 = 0; + var _g159 = _this75.sizeVec3; + while(_g80 < _g159) { + var i62 = _g80++; + newArray56[i62] = _this75.stackVec3[i62]; + _this75.stackVec3[i62] = null; + } + _this75.stackVec3 = newArray56; + } + _this75.stackVec3[_this75.sizeVec3++] = ez; + } + if(mat313 != null) { + var t0028 = 1; + var t0128 = 0; + var t0228 = 0; + var t1028 = 0; + var t1128 = 1; + var t1228 = 0; + var t2028 = 0; + var t2128 = 0; + var t2228 = 1; + mat313.e00 = t0028; + mat313.e01 = t0128; + mat313.e02 = t0228; + mat313.e10 = t1028; + mat313.e11 = t1128; + mat313.e12 = t1228; + mat313.e20 = t2028; + mat313.e21 = t2128; + mat313.e22 = t2228; + if(_this75.sizeMat3 == _this75.stackMat3.length) { + var newLength57 = _this75.sizeMat3 << 1; + var this58 = new Array(newLength57); + var newArray57 = this58; + var _g81 = 0; + var _g160 = _this75.sizeMat3; + while(_g81 < _g160) { + var i63 = _g81++; + newArray57[i63] = _this75.stackMat3[i63]; + _this75.stackMat3[i63] = null; + } + _this75.stackMat3 = newArray57; + } + _this75.stackMat3[_this75.sizeMat3++] = mat313; + } + if(mat414 != null) { + var t0029 = 1; + var t0129 = 0; + var t0229 = 0; + var t0314 = 0; + var t1029 = 0; + var t1129 = 1; + var t1229 = 0; + var t1314 = 0; + var t2029 = 0; + var t2129 = 0; + var t2229 = 1; + var t2314 = 0; + var t3014 = 0; + var t3114 = 0; + var t3214 = 0; + var t3314 = 1; + mat414.e00 = t0029; + mat414.e01 = t0129; + mat414.e02 = t0229; + mat414.e03 = t0314; + mat414.e10 = t1029; + mat414.e11 = t1129; + mat414.e12 = t1229; + mat414.e13 = t1314; + mat414.e20 = t2029; + mat414.e21 = t2129; + mat414.e22 = t2229; + mat414.e23 = t2314; + mat414.e30 = t3014; + mat414.e31 = t3114; + mat414.e32 = t3214; + mat414.e33 = t3314; + if(_this75.sizeMat4 == _this75.stackMat4.length) { + var newLength58 = _this75.sizeMat4 << 1; + var this59 = new Array(newLength58); + var newArray58 = this59; + var _g82 = 0; + var _g161 = _this75.sizeMat4; + while(_g82 < _g161) { + var i64 = _g82++; + newArray58[i64] = _this75.stackMat4[i64]; + _this75.stackMat4[i64] = null; + } + _this75.stackMat4 = newArray58; + } + _this75.stackMat4[_this75.sizeMat4++] = mat414; + } + if(quat14 != null) { + var tx44 = 0; + var ty44 = 0; + var tz44 = 0; + var tw14 = 1; + quat14.x = tx44; + quat14.y = ty44; + quat14.z = tz44; + quat14.w = tw14; + if(_this75.sizeQuat == _this75.stackQuat.length) { + var newLength59 = _this75.sizeQuat << 1; + var this60 = new Array(newLength59); + var newArray59 = this60; + var _g83 = 0; + var _g162 = _this75.sizeQuat; + while(_g83 < _g162) { + var i65 = _g83++; + newArray59[i65] = _this75.stackQuat[i65]; + _this75.stackQuat[i65] = null; + } + _this75.stackQuat = newArray59; + } + _this75.stackQuat[_this75.sizeQuat++] = quat14; + } + } + sphere(tf,radius,color) { + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var m = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + var nt = 4; + var np = 8; + var vs = this.tmpSphereVerts; + var ns = this.tmpSphereNorms; + var _g = 0; + var _g1 = nt + 1; + while(_g < _g1) { + var i = _g++; + var n = this.tmpSphereVerts[i].length; + var _g2 = 0; + var _g11 = n; + while(_g2 < _g11) { + var j = _g2++; + var _this2 = ns[i][j]; + var v1 = this.sphereCoords[i][j]; + _this2.x = v1.x; + _this2.y = v1.y; + _this2.z = v1.z; + var _this3 = _this2; + var tx = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; + var ty = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; + var tz = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; + _this3.x = tx; + _this3.y = ty; + _this3.z = tz; + var _this4 = vs[i][j]; + var v2 = ns[i][j]; + _this4.x = v2.x; + _this4.y = v2.y; + _this4.z = v2.z; + var _this5 = _this4; + var tx1 = _this5.x * radius; + var ty1 = _this5.y * radius; + var tz1 = _this5.z * radius; + _this5.x = tx1; + _this5.y = ty1; + _this5.z = tz1; + var _this6 = _this5; + var tx2 = _this6.x + o.x; + var ty2 = _this6.y + o.y; + var tz2 = _this6.z + o.z; + _this6.x = tx2; + _this6.y = ty2; + _this6.z = tz2; + } + } + var _g21 = 0; + var _g3 = nt; + while(_g21 < _g3) { + var i1 = _g21++; + var _g22 = 0; + var _g31 = np; + while(_g22 < _g31) { + var j1 = _g22++; + var v11; + var v21; + var v3; + var v4; + var n1; + var n2; + var n3; + var n4; + if(i1 == 0) { + if(this.wireframe) { + v11 = vs[0][0]; + v21 = vs[1][j1]; + this.line(v11,v21,color); + } else { + v11 = vs[0][0]; + v21 = vs[1][j1]; + v3 = vs[1][(j1 + 1) % np]; + n1 = ns[0][0]; + n2 = ns[1][j1]; + n3 = ns[1][(j1 + 1) % np]; + this.triangle(v11,v21,v3,n1,n2,n3,color); + } + } else if(i1 == nt - 1) { + if(this.wireframe) { + v11 = vs[nt][0]; + v21 = vs[i1][(j1 + 1) % np]; + v3 = vs[i1][j1]; + this.line(v11,v21,color); + this.line(v21,v3,color); + } else { + v11 = vs[nt][0]; + v21 = vs[i1][(j1 + 1) % np]; + v3 = vs[i1][j1]; + n1 = ns[nt][0]; + n2 = ns[i1][(j1 + 1) % np]; + n3 = ns[i1][j1]; + this.triangle(v11,v21,v3,n1,n2,n3,color); + } + } else if(this.wireframe) { + v11 = vs[i1][j1]; + v21 = vs[i1][(j1 + 1) % np]; + v3 = vs[i1 + 1][j1]; + this.line(v11,v21,color); + this.line(v11,v3,color); + } else { + v11 = vs[i1][j1]; + v21 = vs[i1][(j1 + 1) % np]; + v3 = vs[i1 + 1][j1]; + v4 = vs[i1 + 1][(j1 + 1) % np]; + n1 = ns[i1][j1]; + n2 = ns[i1][(j1 + 1) % np]; + n3 = ns[i1 + 1][j1]; + n4 = ns[i1 + 1][(j1 + 1) % np]; + this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); + } + } + } + var _this7 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(o != null) { + o.zero(); + if(_this7.sizeVec3 == _this7.stackVec3.length) { + var newLength = _this7.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g4 = 0; + var _g12 = _this7.sizeVec3; + while(_g4 < _g12) { + var i2 = _g4++; + newArray[i2] = _this7.stackVec3[i2]; + _this7.stackVec3[i2] = null; + } + _this7.stackVec3 = newArray; + } + _this7.stackVec3[_this7.sizeVec3++] = o; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this7.sizeMat3 == _this7.stackMat3.length) { + var newLength1 = _this7.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g5 = 0; + var _g13 = _this7.sizeMat3; + while(_g5 < _g13) { + var i3 = _g5++; + newArray1[i3] = _this7.stackMat3[i3]; + _this7.stackMat3[i3] = null; + } + _this7.stackMat3 = newArray1; + } + _this7.stackMat3[_this7.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this7.sizeMat4 == _this7.stackMat4.length) { + var newLength2 = _this7.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g6 = 0; + var _g14 = _this7.sizeMat4; + while(_g6 < _g14) { + var i4 = _g6++; + newArray2[i4] = _this7.stackMat4[i4]; + _this7.stackMat4[i4] = null; + } + _this7.stackMat4 = newArray2; + } + _this7.stackMat4[_this7.sizeMat4++] = mat4; + } + if(quat != null) { + var tx3 = 0; + var ty3 = 0; + var tz3 = 0; + var tw = 1; + quat.x = tx3; + quat.y = ty3; + quat.z = tz3; + quat.w = tw; + if(_this7.sizeQuat == _this7.stackQuat.length) { + var newLength3 = _this7.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g7 = 0; + var _g15 = _this7.sizeQuat; + while(_g7 < _g15) { + var i5 = _g7++; + newArray3[i5] = _this7.stackQuat[i5]; + _this7.stackQuat[i5] = null; + } + _this7.stackQuat = newArray3; + } + _this7.stackQuat[_this7.sizeQuat++] = quat; + } + var _this8 = this.p; + var vec3 = null; + var mat41 = null; + var quat1 = null; + if(vec3 != null) { + vec3.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newLength4 = _this8.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g8 = 0; + var _g16 = _this8.sizeVec3; + while(_g8 < _g16) { + var i6 = _g8++; + newArray4[i6] = _this8.stackVec3[i6]; + _this8.stackVec3[i6] = null; + } + _this8.stackVec3 = newArray4; + } + _this8.stackVec3[_this8.sizeVec3++] = vec3; + } + if(m != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + m.e00 = t002; + m.e01 = t012; + m.e02 = t022; + m.e10 = t102; + m.e11 = t112; + m.e12 = t122; + m.e20 = t202; + m.e21 = t212; + m.e22 = t222; + if(_this8.sizeMat3 == _this8.stackMat3.length) { + var newLength5 = _this8.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g9 = 0; + var _g17 = _this8.sizeMat3; + while(_g9 < _g17) { + var i7 = _g9++; + newArray5[i7] = _this8.stackMat3[i7]; + _this8.stackMat3[i7] = null; + } + _this8.stackMat3 = newArray5; + } + _this8.stackMat3[_this8.sizeMat3++] = m; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this8.sizeMat4 == _this8.stackMat4.length) { + var newLength6 = _this8.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g10 = 0; + var _g18 = _this8.sizeMat4; + while(_g10 < _g18) { + var i8 = _g10++; + newArray6[i8] = _this8.stackMat4[i8]; + _this8.stackMat4[i8] = null; + } + _this8.stackMat4 = newArray6; + } + _this8.stackMat4[_this8.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx4 = 0; + var ty4 = 0; + var tz4 = 0; + var tw1 = 1; + quat1.x = tx4; + quat1.y = ty4; + quat1.z = tz4; + quat1.w = tw1; + if(_this8.sizeQuat == _this8.stackQuat.length) { + var newLength7 = _this8.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g19 = 0; + var _g110 = _this8.sizeQuat; + while(_g19 < _g110) { + var i9 = _g19++; + newArray7[i9] = _this8.stackQuat[i9]; + _this8.stackQuat[i9] = null; + } + _this8.stackQuat = newArray7; + } + _this8.stackQuat[_this8.sizeQuat++] = quat1; + } + } + box(tf,halfExtents,color) { + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this.p; + var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this2 = this.p; + var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this.p; + var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this.p; + var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var v = o; + v.x = tf._positionX; + v.y = tf._positionY; + v.z = tf._positionZ; + var m1 = m; + m1.e00 = tf._rotation00; + m1.e01 = tf._rotation01; + m1.e02 = tf._rotation02; + m1.e10 = tf._rotation10; + m1.e11 = tf._rotation11; + m1.e12 = tf._rotation12; + m1.e20 = tf._rotation20; + m1.e21 = tf._rotation21; + m1.e22 = tf._rotation22; + ex.init(m.e00,m.e10,m.e20); + ey.init(m.e01,m.e11,m.e21); + ez.init(m.e02,m.e12,m.e22); + var hx = halfExtents.x; + var hy = halfExtents.y; + var hz = halfExtents.z; + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + var _this7 = _this6; + var s = -hx; + var tx = _this7.x + ex.x * s; + var ty = _this7.y + ex.y * s; + var tz = _this7.z + ex.z * s; + _this7.x = tx; + _this7.y = ty; + _this7.z = tz; + var _this8 = _this7; + var s1 = -hy; + var tx1 = _this8.x + ey.x * s1; + var ty1 = _this8.y + ey.y * s1; + var tz1 = _this8.z + ey.z * s1; + _this8.x = tx1; + _this8.y = ty1; + _this8.z = tz1; + var _this9 = _this8; + var s2 = -hz; + var tx2 = _this9.x + ez.x * s2; + var ty2 = _this9.y + ez.y * s2; + var tz2 = _this9.z + ez.z * s2; + _this9.x = tx2; + _this9.y = ty2; + _this9.z = tz2; + var v1 = _this9; + var _this10 = this.p; + var _this11 = _this10.sizeVec3 == 0 ? new oimo.common.Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = o.x; + _this11.y = o.y; + _this11.z = o.z; + var _this12 = _this11; + var s3 = -hx; + var tx3 = _this12.x + ex.x * s3; + var ty3 = _this12.y + ex.y * s3; + var tz3 = _this12.z + ex.z * s3; + _this12.x = tx3; + _this12.y = ty3; + _this12.z = tz3; + var _this13 = _this12; + var s4 = -hy; + var tx4 = _this13.x + ey.x * s4; + var ty4 = _this13.y + ey.y * s4; + var tz4 = _this13.z + ey.z * s4; + _this13.x = tx4; + _this13.y = ty4; + _this13.z = tz4; + var _this14 = _this13; + var tx5 = _this14.x + ez.x * hz; + var ty5 = _this14.y + ez.y * hz; + var tz5 = _this14.z + ez.z * hz; + _this14.x = tx5; + _this14.y = ty5; + _this14.z = tz5; + var v2 = _this14; + var _this15 = this.p; + var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = o.x; + _this16.y = o.y; + _this16.z = o.z; + var _this17 = _this16; + var s5 = -hx; + var tx6 = _this17.x + ex.x * s5; + var ty6 = _this17.y + ex.y * s5; + var tz6 = _this17.z + ex.z * s5; + _this17.x = tx6; + _this17.y = ty6; + _this17.z = tz6; + var _this18 = _this17; + var tx7 = _this18.x + ey.x * hy; + var ty7 = _this18.y + ey.y * hy; + var tz7 = _this18.z + ey.z * hy; + _this18.x = tx7; + _this18.y = ty7; + _this18.z = tz7; + var _this19 = _this18; + var s6 = -hz; + var tx8 = _this19.x + ez.x * s6; + var ty8 = _this19.y + ez.y * s6; + var tz8 = _this19.z + ez.z * s6; + _this19.x = tx8; + _this19.y = ty8; + _this19.z = tz8; + var v3 = _this19; + var _this20 = this.p; + var _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = o.x; + _this21.y = o.y; + _this21.z = o.z; + var _this22 = _this21; + var s7 = -hx; + var tx9 = _this22.x + ex.x * s7; + var ty9 = _this22.y + ex.y * s7; + var tz9 = _this22.z + ex.z * s7; + _this22.x = tx9; + _this22.y = ty9; + _this22.z = tz9; + var _this23 = _this22; + var tx10 = _this23.x + ey.x * hy; + var ty10 = _this23.y + ey.y * hy; + var tz10 = _this23.z + ey.z * hy; + _this23.x = tx10; + _this23.y = ty10; + _this23.z = tz10; + var _this24 = _this23; + var tx11 = _this24.x + ez.x * hz; + var ty11 = _this24.y + ez.y * hz; + var tz11 = _this24.z + ez.z * hz; + _this24.x = tx11; + _this24.y = ty11; + _this24.z = tz11; + var v4 = _this24; + var _this25 = this.p; + var _this26 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; + _this26.x = o.x; + _this26.y = o.y; + _this26.z = o.z; + var _this27 = _this26; + var tx12 = _this27.x + ex.x * hx; + var ty12 = _this27.y + ex.y * hx; + var tz12 = _this27.z + ex.z * hx; + _this27.x = tx12; + _this27.y = ty12; + _this27.z = tz12; + var _this28 = _this27; + var s8 = -hy; + var tx13 = _this28.x + ey.x * s8; + var ty13 = _this28.y + ey.y * s8; + var tz13 = _this28.z + ey.z * s8; + _this28.x = tx13; + _this28.y = ty13; + _this28.z = tz13; + var _this29 = _this28; + var s9 = -hz; + var tx14 = _this29.x + ez.x * s9; + var ty14 = _this29.y + ez.y * s9; + var tz14 = _this29.z + ez.z * s9; + _this29.x = tx14; + _this29.y = ty14; + _this29.z = tz14; + var v5 = _this29; + var _this30 = this.p; + var _this31 = _this30.sizeVec3 == 0 ? new oimo.common.Vec3() : _this30.stackVec3[--_this30.sizeVec3]; + _this31.x = o.x; + _this31.y = o.y; + _this31.z = o.z; + var _this32 = _this31; + var tx15 = _this32.x + ex.x * hx; + var ty15 = _this32.y + ex.y * hx; + var tz15 = _this32.z + ex.z * hx; + _this32.x = tx15; + _this32.y = ty15; + _this32.z = tz15; + var _this33 = _this32; + var s10 = -hy; + var tx16 = _this33.x + ey.x * s10; + var ty16 = _this33.y + ey.y * s10; + var tz16 = _this33.z + ey.z * s10; + _this33.x = tx16; + _this33.y = ty16; + _this33.z = tz16; + var _this34 = _this33; + var tx17 = _this34.x + ez.x * hz; + var ty17 = _this34.y + ez.y * hz; + var tz17 = _this34.z + ez.z * hz; + _this34.x = tx17; + _this34.y = ty17; + _this34.z = tz17; + var v6 = _this34; + var _this35 = this.p; + var _this36 = _this35.sizeVec3 == 0 ? new oimo.common.Vec3() : _this35.stackVec3[--_this35.sizeVec3]; + _this36.x = o.x; + _this36.y = o.y; + _this36.z = o.z; + var _this37 = _this36; + var tx18 = _this37.x + ex.x * hx; + var ty18 = _this37.y + ex.y * hx; + var tz18 = _this37.z + ex.z * hx; + _this37.x = tx18; + _this37.y = ty18; + _this37.z = tz18; + var _this38 = _this37; + var tx19 = _this38.x + ey.x * hy; + var ty19 = _this38.y + ey.y * hy; + var tz19 = _this38.z + ey.z * hy; + _this38.x = tx19; + _this38.y = ty19; + _this38.z = tz19; + var _this39 = _this38; + var s11 = -hz; + var tx20 = _this39.x + ez.x * s11; + var ty20 = _this39.y + ez.y * s11; + var tz20 = _this39.z + ez.z * s11; + _this39.x = tx20; + _this39.y = ty20; + _this39.z = tz20; + var v7 = _this39; + var _this40 = this.p; + var _this41 = _this40.sizeVec3 == 0 ? new oimo.common.Vec3() : _this40.stackVec3[--_this40.sizeVec3]; + _this41.x = o.x; + _this41.y = o.y; + _this41.z = o.z; + var _this42 = _this41; + var tx21 = _this42.x + ex.x * hx; + var ty21 = _this42.y + ex.y * hx; + var tz21 = _this42.z + ex.z * hx; + _this42.x = tx21; + _this42.y = ty21; + _this42.z = tz21; + var _this43 = _this42; + var tx22 = _this43.x + ey.x * hy; + var ty22 = _this43.y + ey.y * hy; + var tz22 = _this43.z + ey.z * hy; + _this43.x = tx22; + _this43.y = ty22; + _this43.z = tz22; + var _this44 = _this43; + var tx23 = _this44.x + ez.x * hz; + var ty23 = _this44.y + ez.y * hz; + var tz23 = _this44.z + ez.z * hz; + _this44.x = tx23; + _this44.y = ty23; + _this44.z = tz23; + var v8 = _this44; + if(this.wireframe) { + this.line(v1,v2,color); + this.line(v3,v4,color); + this.line(v5,v6,color); + this.line(v7,v8,color); + this.line(v1,v3,color); + this.line(v2,v4,color); + this.line(v5,v7,color); + this.line(v6,v8,color); + this.line(v1,v5,color); + this.line(v2,v6,color); + this.line(v3,v7,color); + this.line(v4,v8,color); + } else { + var _this45 = this.p; + var _this46 = _this45.sizeVec3 == 0 ? new oimo.common.Vec3() : _this45.stackVec3[--_this45.sizeVec3]; + _this46.x = ex.x; + _this46.y = ex.y; + _this46.z = ex.z; + var _this47 = _this46; + var tx24 = -_this47.x; + var ty24 = -_this47.y; + var tz24 = -_this47.z; + _this47.x = tx24; + _this47.y = ty24; + _this47.z = tz24; + var nex = _this47; + var _this48 = this.p; + var _this49 = _this48.sizeVec3 == 0 ? new oimo.common.Vec3() : _this48.stackVec3[--_this48.sizeVec3]; + _this49.x = ey.x; + _this49.y = ey.y; + _this49.z = ey.z; + var _this50 = _this49; + var tx25 = -_this50.x; + var ty25 = -_this50.y; + var tz25 = -_this50.z; + _this50.x = tx25; + _this50.y = ty25; + _this50.z = tz25; + var ney = _this50; + var _this51 = this.p; + var _this52 = _this51.sizeVec3 == 0 ? new oimo.common.Vec3() : _this51.stackVec3[--_this51.sizeVec3]; + _this52.x = ez.x; + _this52.y = ez.y; + _this52.z = ez.z; + var _this53 = _this52; + var tx26 = -_this53.x; + var ty26 = -_this53.y; + var tz26 = -_this53.z; + _this53.x = tx26; + _this53.y = ty26; + _this53.z = tz26; + var nez = _this53; + this.rect(v1,v2,v4,v3,nex,nex,nex,nex,color); + this.rect(v5,v7,v8,v6,ex,ex,ex,ex,color); + this.rect(v1,v5,v6,v2,ney,ney,ney,ney,color); + this.rect(v3,v4,v8,v7,ey,ey,ey,ey,color); + this.rect(v1,v3,v7,v5,nez,nez,nez,nez,color); + this.rect(v2,v6,v8,v4,ez,ez,ez,ez,color); + var _this54 = this.p; + var mat3 = null; + var mat4 = null; + var quat = null; + if(nex != null) { + nex.zero(); + if(_this54.sizeVec3 == _this54.stackVec3.length) { + var newLength = _this54.sizeVec3 << 1; + var this1 = new Array(newLength); + var newArray = this1; + var _g = 0; + var _g1 = _this54.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this54.stackVec3[i]; + _this54.stackVec3[i] = null; + } + _this54.stackVec3 = newArray; + } + _this54.stackVec3[_this54.sizeVec3++] = nex; + } + if(mat3 != null) { + var t00 = 1; + var t01 = 0; + var t02 = 0; + var t10 = 0; + var t11 = 1; + var t12 = 0; + var t20 = 0; + var t21 = 0; + var t22 = 1; + mat3.e00 = t00; + mat3.e01 = t01; + mat3.e02 = t02; + mat3.e10 = t10; + mat3.e11 = t11; + mat3.e12 = t12; + mat3.e20 = t20; + mat3.e21 = t21; + mat3.e22 = t22; + if(_this54.sizeMat3 == _this54.stackMat3.length) { + var newLength1 = _this54.sizeMat3 << 1; + var this2 = new Array(newLength1); + var newArray1 = this2; + var _g2 = 0; + var _g11 = _this54.sizeMat3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this54.stackMat3[i1]; + _this54.stackMat3[i1] = null; + } + _this54.stackMat3 = newArray1; + } + _this54.stackMat3[_this54.sizeMat3++] = mat3; + } + if(mat4 != null) { + var t001 = 1; + var t011 = 0; + var t021 = 0; + var t03 = 0; + var t101 = 0; + var t111 = 1; + var t121 = 0; + var t13 = 0; + var t201 = 0; + var t211 = 0; + var t221 = 1; + var t23 = 0; + var t30 = 0; + var t31 = 0; + var t32 = 0; + var t33 = 1; + mat4.e00 = t001; + mat4.e01 = t011; + mat4.e02 = t021; + mat4.e03 = t03; + mat4.e10 = t101; + mat4.e11 = t111; + mat4.e12 = t121; + mat4.e13 = t13; + mat4.e20 = t201; + mat4.e21 = t211; + mat4.e22 = t221; + mat4.e23 = t23; + mat4.e30 = t30; + mat4.e31 = t31; + mat4.e32 = t32; + mat4.e33 = t33; + if(_this54.sizeMat4 == _this54.stackMat4.length) { + var newLength2 = _this54.sizeMat4 << 1; + var this3 = new Array(newLength2); + var newArray2 = this3; + var _g3 = 0; + var _g12 = _this54.sizeMat4; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this54.stackMat4[i2]; + _this54.stackMat4[i2] = null; + } + _this54.stackMat4 = newArray2; + } + _this54.stackMat4[_this54.sizeMat4++] = mat4; + } + if(quat != null) { + var tx27 = 0; + var ty27 = 0; + var tz27 = 0; + var tw = 1; + quat.x = tx27; + quat.y = ty27; + quat.z = tz27; + quat.w = tw; + if(_this54.sizeQuat == _this54.stackQuat.length) { + var newLength3 = _this54.sizeQuat << 1; + var this4 = new Array(newLength3); + var newArray3 = this4; + var _g4 = 0; + var _g13 = _this54.sizeQuat; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this54.stackQuat[i3]; + _this54.stackQuat[i3] = null; + } + _this54.stackQuat = newArray3; + } + _this54.stackQuat[_this54.sizeQuat++] = quat; + } + var _this55 = this.p; + var mat31 = null; + var mat41 = null; + var quat1 = null; + if(ney != null) { + ney.zero(); + if(_this55.sizeVec3 == _this55.stackVec3.length) { + var newLength4 = _this55.sizeVec3 << 1; + var this5 = new Array(newLength4); + var newArray4 = this5; + var _g5 = 0; + var _g14 = _this55.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this55.stackVec3[i4]; + _this55.stackVec3[i4] = null; + } + _this55.stackVec3 = newArray4; + } + _this55.stackVec3[_this55.sizeVec3++] = ney; + } + if(mat31 != null) { + var t002 = 1; + var t012 = 0; + var t022 = 0; + var t102 = 0; + var t112 = 1; + var t122 = 0; + var t202 = 0; + var t212 = 0; + var t222 = 1; + mat31.e00 = t002; + mat31.e01 = t012; + mat31.e02 = t022; + mat31.e10 = t102; + mat31.e11 = t112; + mat31.e12 = t122; + mat31.e20 = t202; + mat31.e21 = t212; + mat31.e22 = t222; + if(_this55.sizeMat3 == _this55.stackMat3.length) { + var newLength5 = _this55.sizeMat3 << 1; + var this6 = new Array(newLength5); + var newArray5 = this6; + var _g6 = 0; + var _g15 = _this55.sizeMat3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this55.stackMat3[i5]; + _this55.stackMat3[i5] = null; + } + _this55.stackMat3 = newArray5; + } + _this55.stackMat3[_this55.sizeMat3++] = mat31; + } + if(mat41 != null) { + var t003 = 1; + var t013 = 0; + var t023 = 0; + var t031 = 0; + var t103 = 0; + var t113 = 1; + var t123 = 0; + var t131 = 0; + var t203 = 0; + var t213 = 0; + var t223 = 1; + var t231 = 0; + var t301 = 0; + var t311 = 0; + var t321 = 0; + var t331 = 1; + mat41.e00 = t003; + mat41.e01 = t013; + mat41.e02 = t023; + mat41.e03 = t031; + mat41.e10 = t103; + mat41.e11 = t113; + mat41.e12 = t123; + mat41.e13 = t131; + mat41.e20 = t203; + mat41.e21 = t213; + mat41.e22 = t223; + mat41.e23 = t231; + mat41.e30 = t301; + mat41.e31 = t311; + mat41.e32 = t321; + mat41.e33 = t331; + if(_this55.sizeMat4 == _this55.stackMat4.length) { + var newLength6 = _this55.sizeMat4 << 1; + var this7 = new Array(newLength6); + var newArray6 = this7; + var _g7 = 0; + var _g16 = _this55.sizeMat4; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this55.stackMat4[i6]; + _this55.stackMat4[i6] = null; + } + _this55.stackMat4 = newArray6; + } + _this55.stackMat4[_this55.sizeMat4++] = mat41; + } + if(quat1 != null) { + var tx28 = 0; + var ty28 = 0; + var tz28 = 0; + var tw1 = 1; + quat1.x = tx28; + quat1.y = ty28; + quat1.z = tz28; + quat1.w = tw1; + if(_this55.sizeQuat == _this55.stackQuat.length) { + var newLength7 = _this55.sizeQuat << 1; + var this8 = new Array(newLength7); + var newArray7 = this8; + var _g8 = 0; + var _g17 = _this55.sizeQuat; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this55.stackQuat[i7]; + _this55.stackQuat[i7] = null; + } + _this55.stackQuat = newArray7; + } + _this55.stackQuat[_this55.sizeQuat++] = quat1; + } + var _this56 = this.p; + var mat32 = null; + var mat42 = null; + var quat2 = null; + if(nez != null) { + nez.zero(); + if(_this56.sizeVec3 == _this56.stackVec3.length) { + var newLength8 = _this56.sizeVec3 << 1; + var this9 = new Array(newLength8); + var newArray8 = this9; + var _g9 = 0; + var _g18 = _this56.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this56.stackVec3[i8]; + _this56.stackVec3[i8] = null; + } + _this56.stackVec3 = newArray8; + } + _this56.stackVec3[_this56.sizeVec3++] = nez; + } + if(mat32 != null) { + var t004 = 1; + var t014 = 0; + var t024 = 0; + var t104 = 0; + var t114 = 1; + var t124 = 0; + var t204 = 0; + var t214 = 0; + var t224 = 1; + mat32.e00 = t004; + mat32.e01 = t014; + mat32.e02 = t024; + mat32.e10 = t104; + mat32.e11 = t114; + mat32.e12 = t124; + mat32.e20 = t204; + mat32.e21 = t214; + mat32.e22 = t224; + if(_this56.sizeMat3 == _this56.stackMat3.length) { + var newLength9 = _this56.sizeMat3 << 1; + var this10 = new Array(newLength9); + var newArray9 = this10; + var _g10 = 0; + var _g19 = _this56.sizeMat3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this56.stackMat3[i9]; + _this56.stackMat3[i9] = null; + } + _this56.stackMat3 = newArray9; + } + _this56.stackMat3[_this56.sizeMat3++] = mat32; + } + if(mat42 != null) { + var t005 = 1; + var t015 = 0; + var t025 = 0; + var t032 = 0; + var t105 = 0; + var t115 = 1; + var t125 = 0; + var t132 = 0; + var t205 = 0; + var t215 = 0; + var t225 = 1; + var t232 = 0; + var t302 = 0; + var t312 = 0; + var t322 = 0; + var t332 = 1; + mat42.e00 = t005; + mat42.e01 = t015; + mat42.e02 = t025; + mat42.e03 = t032; + mat42.e10 = t105; + mat42.e11 = t115; + mat42.e12 = t125; + mat42.e13 = t132; + mat42.e20 = t205; + mat42.e21 = t215; + mat42.e22 = t225; + mat42.e23 = t232; + mat42.e30 = t302; + mat42.e31 = t312; + mat42.e32 = t322; + mat42.e33 = t332; + if(_this56.sizeMat4 == _this56.stackMat4.length) { + var newLength10 = _this56.sizeMat4 << 1; + var this11 = new Array(newLength10); + var newArray10 = this11; + var _g20 = 0; + var _g110 = _this56.sizeMat4; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this56.stackMat4[i10]; + _this56.stackMat4[i10] = null; + } + _this56.stackMat4 = newArray10; + } + _this56.stackMat4[_this56.sizeMat4++] = mat42; + } + if(quat2 != null) { + var tx29 = 0; + var ty29 = 0; + var tz29 = 0; + var tw2 = 1; + quat2.x = tx29; + quat2.y = ty29; + quat2.z = tz29; + quat2.w = tw2; + if(_this56.sizeQuat == _this56.stackQuat.length) { + var newLength11 = _this56.sizeQuat << 1; + var this12 = new Array(newLength11); + var newArray11 = this12; + var _g21 = 0; + var _g111 = _this56.sizeQuat; + while(_g21 < _g111) { + var i11 = _g21++; + newArray11[i11] = _this56.stackQuat[i11]; + _this56.stackQuat[i11] = null; + } + _this56.stackQuat = newArray11; + } + _this56.stackQuat[_this56.sizeQuat++] = quat2; + } + } + var _this57 = this.p; + var mat33 = null; + var mat43 = null; + var quat3 = null; + if(v1 != null) { + v1.zero(); + if(_this57.sizeVec3 == _this57.stackVec3.length) { + var newLength12 = _this57.sizeVec3 << 1; + var this13 = new Array(newLength12); + var newArray12 = this13; + var _g22 = 0; + var _g112 = _this57.sizeVec3; + while(_g22 < _g112) { + var i12 = _g22++; + newArray12[i12] = _this57.stackVec3[i12]; + _this57.stackVec3[i12] = null; + } + _this57.stackVec3 = newArray12; + } + _this57.stackVec3[_this57.sizeVec3++] = v1; + } + if(mat33 != null) { + var t006 = 1; + var t016 = 0; + var t026 = 0; + var t106 = 0; + var t116 = 1; + var t126 = 0; + var t206 = 0; + var t216 = 0; + var t226 = 1; + mat33.e00 = t006; + mat33.e01 = t016; + mat33.e02 = t026; + mat33.e10 = t106; + mat33.e11 = t116; + mat33.e12 = t126; + mat33.e20 = t206; + mat33.e21 = t216; + mat33.e22 = t226; + if(_this57.sizeMat3 == _this57.stackMat3.length) { + var newLength13 = _this57.sizeMat3 << 1; + var this14 = new Array(newLength13); + var newArray13 = this14; + var _g23 = 0; + var _g113 = _this57.sizeMat3; + while(_g23 < _g113) { + var i13 = _g23++; + newArray13[i13] = _this57.stackMat3[i13]; + _this57.stackMat3[i13] = null; + } + _this57.stackMat3 = newArray13; + } + _this57.stackMat3[_this57.sizeMat3++] = mat33; + } + if(mat43 != null) { + var t007 = 1; + var t017 = 0; + var t027 = 0; + var t033 = 0; + var t107 = 0; + var t117 = 1; + var t127 = 0; + var t133 = 0; + var t207 = 0; + var t217 = 0; + var t227 = 1; + var t233 = 0; + var t303 = 0; + var t313 = 0; + var t323 = 0; + var t333 = 1; + mat43.e00 = t007; + mat43.e01 = t017; + mat43.e02 = t027; + mat43.e03 = t033; + mat43.e10 = t107; + mat43.e11 = t117; + mat43.e12 = t127; + mat43.e13 = t133; + mat43.e20 = t207; + mat43.e21 = t217; + mat43.e22 = t227; + mat43.e23 = t233; + mat43.e30 = t303; + mat43.e31 = t313; + mat43.e32 = t323; + mat43.e33 = t333; + if(_this57.sizeMat4 == _this57.stackMat4.length) { + var newLength14 = _this57.sizeMat4 << 1; + var this15 = new Array(newLength14); + var newArray14 = this15; + var _g24 = 0; + var _g114 = _this57.sizeMat4; + while(_g24 < _g114) { + var i14 = _g24++; + newArray14[i14] = _this57.stackMat4[i14]; + _this57.stackMat4[i14] = null; + } + _this57.stackMat4 = newArray14; + } + _this57.stackMat4[_this57.sizeMat4++] = mat43; + } + if(quat3 != null) { + var tx30 = 0; + var ty30 = 0; + var tz30 = 0; + var tw3 = 1; + quat3.x = tx30; + quat3.y = ty30; + quat3.z = tz30; + quat3.w = tw3; + if(_this57.sizeQuat == _this57.stackQuat.length) { + var newLength15 = _this57.sizeQuat << 1; + var this16 = new Array(newLength15); + var newArray15 = this16; + var _g25 = 0; + var _g115 = _this57.sizeQuat; + while(_g25 < _g115) { + var i15 = _g25++; + newArray15[i15] = _this57.stackQuat[i15]; + _this57.stackQuat[i15] = null; + } + _this57.stackQuat = newArray15; + } + _this57.stackQuat[_this57.sizeQuat++] = quat3; + } + var _this58 = this.p; + var mat34 = null; + var mat44 = null; + var quat4 = null; + if(v2 != null) { + v2.zero(); + if(_this58.sizeVec3 == _this58.stackVec3.length) { + var newLength16 = _this58.sizeVec3 << 1; + var this17 = new Array(newLength16); + var newArray16 = this17; + var _g26 = 0; + var _g116 = _this58.sizeVec3; + while(_g26 < _g116) { + var i16 = _g26++; + newArray16[i16] = _this58.stackVec3[i16]; + _this58.stackVec3[i16] = null; + } + _this58.stackVec3 = newArray16; + } + _this58.stackVec3[_this58.sizeVec3++] = v2; + } + if(mat34 != null) { + var t008 = 1; + var t018 = 0; + var t028 = 0; + var t108 = 0; + var t118 = 1; + var t128 = 0; + var t208 = 0; + var t218 = 0; + var t228 = 1; + mat34.e00 = t008; + mat34.e01 = t018; + mat34.e02 = t028; + mat34.e10 = t108; + mat34.e11 = t118; + mat34.e12 = t128; + mat34.e20 = t208; + mat34.e21 = t218; + mat34.e22 = t228; + if(_this58.sizeMat3 == _this58.stackMat3.length) { + var newLength17 = _this58.sizeMat3 << 1; + var this18 = new Array(newLength17); + var newArray17 = this18; + var _g27 = 0; + var _g117 = _this58.sizeMat3; + while(_g27 < _g117) { + var i17 = _g27++; + newArray17[i17] = _this58.stackMat3[i17]; + _this58.stackMat3[i17] = null; + } + _this58.stackMat3 = newArray17; + } + _this58.stackMat3[_this58.sizeMat3++] = mat34; + } + if(mat44 != null) { + var t009 = 1; + var t019 = 0; + var t029 = 0; + var t034 = 0; + var t109 = 0; + var t119 = 1; + var t129 = 0; + var t134 = 0; + var t209 = 0; + var t219 = 0; + var t229 = 1; + var t234 = 0; + var t304 = 0; + var t314 = 0; + var t324 = 0; + var t334 = 1; + mat44.e00 = t009; + mat44.e01 = t019; + mat44.e02 = t029; + mat44.e03 = t034; + mat44.e10 = t109; + mat44.e11 = t119; + mat44.e12 = t129; + mat44.e13 = t134; + mat44.e20 = t209; + mat44.e21 = t219; + mat44.e22 = t229; + mat44.e23 = t234; + mat44.e30 = t304; + mat44.e31 = t314; + mat44.e32 = t324; + mat44.e33 = t334; + if(_this58.sizeMat4 == _this58.stackMat4.length) { + var newLength18 = _this58.sizeMat4 << 1; + var this19 = new Array(newLength18); + var newArray18 = this19; + var _g28 = 0; + var _g118 = _this58.sizeMat4; + while(_g28 < _g118) { + var i18 = _g28++; + newArray18[i18] = _this58.stackMat4[i18]; + _this58.stackMat4[i18] = null; + } + _this58.stackMat4 = newArray18; + } + _this58.stackMat4[_this58.sizeMat4++] = mat44; + } + if(quat4 != null) { + var tx31 = 0; + var ty31 = 0; + var tz31 = 0; + var tw4 = 1; + quat4.x = tx31; + quat4.y = ty31; + quat4.z = tz31; + quat4.w = tw4; + if(_this58.sizeQuat == _this58.stackQuat.length) { + var newLength19 = _this58.sizeQuat << 1; + var this20 = new Array(newLength19); + var newArray19 = this20; + var _g29 = 0; + var _g119 = _this58.sizeQuat; + while(_g29 < _g119) { + var i19 = _g29++; + newArray19[i19] = _this58.stackQuat[i19]; + _this58.stackQuat[i19] = null; + } + _this58.stackQuat = newArray19; + } + _this58.stackQuat[_this58.sizeQuat++] = quat4; + } + var _this59 = this.p; + var mat35 = null; + var mat45 = null; + var quat5 = null; + if(v3 != null) { + v3.zero(); + if(_this59.sizeVec3 == _this59.stackVec3.length) { + var newLength20 = _this59.sizeVec3 << 1; + var this21 = new Array(newLength20); + var newArray20 = this21; + var _g30 = 0; + var _g120 = _this59.sizeVec3; + while(_g30 < _g120) { + var i20 = _g30++; + newArray20[i20] = _this59.stackVec3[i20]; + _this59.stackVec3[i20] = null; + } + _this59.stackVec3 = newArray20; + } + _this59.stackVec3[_this59.sizeVec3++] = v3; + } + if(mat35 != null) { + var t0010 = 1; + var t0110 = 0; + var t0210 = 0; + var t1010 = 0; + var t1110 = 1; + var t1210 = 0; + var t2010 = 0; + var t2110 = 0; + var t2210 = 1; + mat35.e00 = t0010; + mat35.e01 = t0110; + mat35.e02 = t0210; + mat35.e10 = t1010; + mat35.e11 = t1110; + mat35.e12 = t1210; + mat35.e20 = t2010; + mat35.e21 = t2110; + mat35.e22 = t2210; + if(_this59.sizeMat3 == _this59.stackMat3.length) { + var newLength21 = _this59.sizeMat3 << 1; + var this22 = new Array(newLength21); + var newArray21 = this22; + var _g31 = 0; + var _g121 = _this59.sizeMat3; + while(_g31 < _g121) { + var i21 = _g31++; + newArray21[i21] = _this59.stackMat3[i21]; + _this59.stackMat3[i21] = null; + } + _this59.stackMat3 = newArray21; + } + _this59.stackMat3[_this59.sizeMat3++] = mat35; + } + if(mat45 != null) { + var t0011 = 1; + var t0111 = 0; + var t0211 = 0; + var t035 = 0; + var t1011 = 0; + var t1111 = 1; + var t1211 = 0; + var t135 = 0; + var t2011 = 0; + var t2111 = 0; + var t2211 = 1; + var t235 = 0; + var t305 = 0; + var t315 = 0; + var t325 = 0; + var t335 = 1; + mat45.e00 = t0011; + mat45.e01 = t0111; + mat45.e02 = t0211; + mat45.e03 = t035; + mat45.e10 = t1011; + mat45.e11 = t1111; + mat45.e12 = t1211; + mat45.e13 = t135; + mat45.e20 = t2011; + mat45.e21 = t2111; + mat45.e22 = t2211; + mat45.e23 = t235; + mat45.e30 = t305; + mat45.e31 = t315; + mat45.e32 = t325; + mat45.e33 = t335; + if(_this59.sizeMat4 == _this59.stackMat4.length) { + var newLength22 = _this59.sizeMat4 << 1; + var this23 = new Array(newLength22); + var newArray22 = this23; + var _g32 = 0; + var _g122 = _this59.sizeMat4; + while(_g32 < _g122) { + var i22 = _g32++; + newArray22[i22] = _this59.stackMat4[i22]; + _this59.stackMat4[i22] = null; + } + _this59.stackMat4 = newArray22; + } + _this59.stackMat4[_this59.sizeMat4++] = mat45; + } + if(quat5 != null) { + var tx32 = 0; + var ty32 = 0; + var tz32 = 0; + var tw5 = 1; + quat5.x = tx32; + quat5.y = ty32; + quat5.z = tz32; + quat5.w = tw5; + if(_this59.sizeQuat == _this59.stackQuat.length) { + var newLength23 = _this59.sizeQuat << 1; + var this24 = new Array(newLength23); + var newArray23 = this24; + var _g33 = 0; + var _g123 = _this59.sizeQuat; + while(_g33 < _g123) { + var i23 = _g33++; + newArray23[i23] = _this59.stackQuat[i23]; + _this59.stackQuat[i23] = null; + } + _this59.stackQuat = newArray23; + } + _this59.stackQuat[_this59.sizeQuat++] = quat5; + } + var _this60 = this.p; + var mat36 = null; + var mat46 = null; + var quat6 = null; + if(v4 != null) { + v4.zero(); + if(_this60.sizeVec3 == _this60.stackVec3.length) { + var newLength24 = _this60.sizeVec3 << 1; + var this25 = new Array(newLength24); + var newArray24 = this25; + var _g34 = 0; + var _g124 = _this60.sizeVec3; + while(_g34 < _g124) { + var i24 = _g34++; + newArray24[i24] = _this60.stackVec3[i24]; + _this60.stackVec3[i24] = null; + } + _this60.stackVec3 = newArray24; + } + _this60.stackVec3[_this60.sizeVec3++] = v4; + } + if(mat36 != null) { + var t0012 = 1; + var t0112 = 0; + var t0212 = 0; + var t1012 = 0; + var t1112 = 1; + var t1212 = 0; + var t2012 = 0; + var t2112 = 0; + var t2212 = 1; + mat36.e00 = t0012; + mat36.e01 = t0112; + mat36.e02 = t0212; + mat36.e10 = t1012; + mat36.e11 = t1112; + mat36.e12 = t1212; + mat36.e20 = t2012; + mat36.e21 = t2112; + mat36.e22 = t2212; + if(_this60.sizeMat3 == _this60.stackMat3.length) { + var newLength25 = _this60.sizeMat3 << 1; + var this26 = new Array(newLength25); + var newArray25 = this26; + var _g35 = 0; + var _g125 = _this60.sizeMat3; + while(_g35 < _g125) { + var i25 = _g35++; + newArray25[i25] = _this60.stackMat3[i25]; + _this60.stackMat3[i25] = null; + } + _this60.stackMat3 = newArray25; + } + _this60.stackMat3[_this60.sizeMat3++] = mat36; + } + if(mat46 != null) { + var t0013 = 1; + var t0113 = 0; + var t0213 = 0; + var t036 = 0; + var t1013 = 0; + var t1113 = 1; + var t1213 = 0; + var t136 = 0; + var t2013 = 0; + var t2113 = 0; + var t2213 = 1; + var t236 = 0; + var t306 = 0; + var t316 = 0; + var t326 = 0; + var t336 = 1; + mat46.e00 = t0013; + mat46.e01 = t0113; + mat46.e02 = t0213; + mat46.e03 = t036; + mat46.e10 = t1013; + mat46.e11 = t1113; + mat46.e12 = t1213; + mat46.e13 = t136; + mat46.e20 = t2013; + mat46.e21 = t2113; + mat46.e22 = t2213; + mat46.e23 = t236; + mat46.e30 = t306; + mat46.e31 = t316; + mat46.e32 = t326; + mat46.e33 = t336; + if(_this60.sizeMat4 == _this60.stackMat4.length) { + var newLength26 = _this60.sizeMat4 << 1; + var this27 = new Array(newLength26); + var newArray26 = this27; + var _g36 = 0; + var _g126 = _this60.sizeMat4; + while(_g36 < _g126) { + var i26 = _g36++; + newArray26[i26] = _this60.stackMat4[i26]; + _this60.stackMat4[i26] = null; + } + _this60.stackMat4 = newArray26; + } + _this60.stackMat4[_this60.sizeMat4++] = mat46; + } + if(quat6 != null) { + var tx33 = 0; + var ty33 = 0; + var tz33 = 0; + var tw6 = 1; + quat6.x = tx33; + quat6.y = ty33; + quat6.z = tz33; + quat6.w = tw6; + if(_this60.sizeQuat == _this60.stackQuat.length) { + var newLength27 = _this60.sizeQuat << 1; + var this28 = new Array(newLength27); + var newArray27 = this28; + var _g37 = 0; + var _g127 = _this60.sizeQuat; + while(_g37 < _g127) { + var i27 = _g37++; + newArray27[i27] = _this60.stackQuat[i27]; + _this60.stackQuat[i27] = null; + } + _this60.stackQuat = newArray27; + } + _this60.stackQuat[_this60.sizeQuat++] = quat6; + } + var _this61 = this.p; + var mat37 = null; + var mat47 = null; + var quat7 = null; + if(v5 != null) { + v5.zero(); + if(_this61.sizeVec3 == _this61.stackVec3.length) { + var newLength28 = _this61.sizeVec3 << 1; + var this29 = new Array(newLength28); + var newArray28 = this29; + var _g38 = 0; + var _g128 = _this61.sizeVec3; + while(_g38 < _g128) { + var i28 = _g38++; + newArray28[i28] = _this61.stackVec3[i28]; + _this61.stackVec3[i28] = null; + } + _this61.stackVec3 = newArray28; + } + _this61.stackVec3[_this61.sizeVec3++] = v5; + } + if(mat37 != null) { + var t0014 = 1; + var t0114 = 0; + var t0214 = 0; + var t1014 = 0; + var t1114 = 1; + var t1214 = 0; + var t2014 = 0; + var t2114 = 0; + var t2214 = 1; + mat37.e00 = t0014; + mat37.e01 = t0114; + mat37.e02 = t0214; + mat37.e10 = t1014; + mat37.e11 = t1114; + mat37.e12 = t1214; + mat37.e20 = t2014; + mat37.e21 = t2114; + mat37.e22 = t2214; + if(_this61.sizeMat3 == _this61.stackMat3.length) { + var newLength29 = _this61.sizeMat3 << 1; + var this30 = new Array(newLength29); + var newArray29 = this30; + var _g39 = 0; + var _g129 = _this61.sizeMat3; + while(_g39 < _g129) { + var i29 = _g39++; + newArray29[i29] = _this61.stackMat3[i29]; + _this61.stackMat3[i29] = null; + } + _this61.stackMat3 = newArray29; + } + _this61.stackMat3[_this61.sizeMat3++] = mat37; + } + if(mat47 != null) { + var t0015 = 1; + var t0115 = 0; + var t0215 = 0; + var t037 = 0; + var t1015 = 0; + var t1115 = 1; + var t1215 = 0; + var t137 = 0; + var t2015 = 0; + var t2115 = 0; + var t2215 = 1; + var t237 = 0; + var t307 = 0; + var t317 = 0; + var t327 = 0; + var t337 = 1; + mat47.e00 = t0015; + mat47.e01 = t0115; + mat47.e02 = t0215; + mat47.e03 = t037; + mat47.e10 = t1015; + mat47.e11 = t1115; + mat47.e12 = t1215; + mat47.e13 = t137; + mat47.e20 = t2015; + mat47.e21 = t2115; + mat47.e22 = t2215; + mat47.e23 = t237; + mat47.e30 = t307; + mat47.e31 = t317; + mat47.e32 = t327; + mat47.e33 = t337; + if(_this61.sizeMat4 == _this61.stackMat4.length) { + var newLength30 = _this61.sizeMat4 << 1; + var this31 = new Array(newLength30); + var newArray30 = this31; + var _g40 = 0; + var _g130 = _this61.sizeMat4; + while(_g40 < _g130) { + var i30 = _g40++; + newArray30[i30] = _this61.stackMat4[i30]; + _this61.stackMat4[i30] = null; + } + _this61.stackMat4 = newArray30; + } + _this61.stackMat4[_this61.sizeMat4++] = mat47; + } + if(quat7 != null) { + var tx34 = 0; + var ty34 = 0; + var tz34 = 0; + var tw7 = 1; + quat7.x = tx34; + quat7.y = ty34; + quat7.z = tz34; + quat7.w = tw7; + if(_this61.sizeQuat == _this61.stackQuat.length) { + var newLength31 = _this61.sizeQuat << 1; + var this32 = new Array(newLength31); + var newArray31 = this32; + var _g41 = 0; + var _g131 = _this61.sizeQuat; + while(_g41 < _g131) { + var i31 = _g41++; + newArray31[i31] = _this61.stackQuat[i31]; + _this61.stackQuat[i31] = null; + } + _this61.stackQuat = newArray31; + } + _this61.stackQuat[_this61.sizeQuat++] = quat7; + } + var _this62 = this.p; + var mat38 = null; + var mat48 = null; + var quat8 = null; + if(v6 != null) { + v6.zero(); + if(_this62.sizeVec3 == _this62.stackVec3.length) { + var newLength32 = _this62.sizeVec3 << 1; + var this33 = new Array(newLength32); + var newArray32 = this33; + var _g42 = 0; + var _g132 = _this62.sizeVec3; + while(_g42 < _g132) { + var i32 = _g42++; + newArray32[i32] = _this62.stackVec3[i32]; + _this62.stackVec3[i32] = null; + } + _this62.stackVec3 = newArray32; + } + _this62.stackVec3[_this62.sizeVec3++] = v6; + } + if(mat38 != null) { + var t0016 = 1; + var t0116 = 0; + var t0216 = 0; + var t1016 = 0; + var t1116 = 1; + var t1216 = 0; + var t2016 = 0; + var t2116 = 0; + var t2216 = 1; + mat38.e00 = t0016; + mat38.e01 = t0116; + mat38.e02 = t0216; + mat38.e10 = t1016; + mat38.e11 = t1116; + mat38.e12 = t1216; + mat38.e20 = t2016; + mat38.e21 = t2116; + mat38.e22 = t2216; + if(_this62.sizeMat3 == _this62.stackMat3.length) { + var newLength33 = _this62.sizeMat3 << 1; + var this34 = new Array(newLength33); + var newArray33 = this34; + var _g43 = 0; + var _g133 = _this62.sizeMat3; + while(_g43 < _g133) { + var i33 = _g43++; + newArray33[i33] = _this62.stackMat3[i33]; + _this62.stackMat3[i33] = null; + } + _this62.stackMat3 = newArray33; + } + _this62.stackMat3[_this62.sizeMat3++] = mat38; + } + if(mat48 != null) { + var t0017 = 1; + var t0117 = 0; + var t0217 = 0; + var t038 = 0; + var t1017 = 0; + var t1117 = 1; + var t1217 = 0; + var t138 = 0; + var t2017 = 0; + var t2117 = 0; + var t2217 = 1; + var t238 = 0; + var t308 = 0; + var t318 = 0; + var t328 = 0; + var t338 = 1; + mat48.e00 = t0017; + mat48.e01 = t0117; + mat48.e02 = t0217; + mat48.e03 = t038; + mat48.e10 = t1017; + mat48.e11 = t1117; + mat48.e12 = t1217; + mat48.e13 = t138; + mat48.e20 = t2017; + mat48.e21 = t2117; + mat48.e22 = t2217; + mat48.e23 = t238; + mat48.e30 = t308; + mat48.e31 = t318; + mat48.e32 = t328; + mat48.e33 = t338; + if(_this62.sizeMat4 == _this62.stackMat4.length) { + var newLength34 = _this62.sizeMat4 << 1; + var this35 = new Array(newLength34); + var newArray34 = this35; + var _g44 = 0; + var _g134 = _this62.sizeMat4; + while(_g44 < _g134) { + var i34 = _g44++; + newArray34[i34] = _this62.stackMat4[i34]; + _this62.stackMat4[i34] = null; + } + _this62.stackMat4 = newArray34; + } + _this62.stackMat4[_this62.sizeMat4++] = mat48; + } + if(quat8 != null) { + var tx35 = 0; + var ty35 = 0; + var tz35 = 0; + var tw8 = 1; + quat8.x = tx35; + quat8.y = ty35; + quat8.z = tz35; + quat8.w = tw8; + if(_this62.sizeQuat == _this62.stackQuat.length) { + var newLength35 = _this62.sizeQuat << 1; + var this36 = new Array(newLength35); + var newArray35 = this36; + var _g45 = 0; + var _g135 = _this62.sizeQuat; + while(_g45 < _g135) { + var i35 = _g45++; + newArray35[i35] = _this62.stackQuat[i35]; + _this62.stackQuat[i35] = null; + } + _this62.stackQuat = newArray35; + } + _this62.stackQuat[_this62.sizeQuat++] = quat8; + } + var _this63 = this.p; + var mat39 = null; + var mat49 = null; + var quat9 = null; + if(v7 != null) { + v7.zero(); + if(_this63.sizeVec3 == _this63.stackVec3.length) { + var newLength36 = _this63.sizeVec3 << 1; + var this37 = new Array(newLength36); + var newArray36 = this37; + var _g46 = 0; + var _g136 = _this63.sizeVec3; + while(_g46 < _g136) { + var i36 = _g46++; + newArray36[i36] = _this63.stackVec3[i36]; + _this63.stackVec3[i36] = null; + } + _this63.stackVec3 = newArray36; + } + _this63.stackVec3[_this63.sizeVec3++] = v7; + } + if(mat39 != null) { + var t0018 = 1; + var t0118 = 0; + var t0218 = 0; + var t1018 = 0; + var t1118 = 1; + var t1218 = 0; + var t2018 = 0; + var t2118 = 0; + var t2218 = 1; + mat39.e00 = t0018; + mat39.e01 = t0118; + mat39.e02 = t0218; + mat39.e10 = t1018; + mat39.e11 = t1118; + mat39.e12 = t1218; + mat39.e20 = t2018; + mat39.e21 = t2118; + mat39.e22 = t2218; + if(_this63.sizeMat3 == _this63.stackMat3.length) { + var newLength37 = _this63.sizeMat3 << 1; + var this38 = new Array(newLength37); + var newArray37 = this38; + var _g47 = 0; + var _g137 = _this63.sizeMat3; + while(_g47 < _g137) { + var i37 = _g47++; + newArray37[i37] = _this63.stackMat3[i37]; + _this63.stackMat3[i37] = null; + } + _this63.stackMat3 = newArray37; + } + _this63.stackMat3[_this63.sizeMat3++] = mat39; + } + if(mat49 != null) { + var t0019 = 1; + var t0119 = 0; + var t0219 = 0; + var t039 = 0; + var t1019 = 0; + var t1119 = 1; + var t1219 = 0; + var t139 = 0; + var t2019 = 0; + var t2119 = 0; + var t2219 = 1; + var t239 = 0; + var t309 = 0; + var t319 = 0; + var t329 = 0; + var t339 = 1; + mat49.e00 = t0019; + mat49.e01 = t0119; + mat49.e02 = t0219; + mat49.e03 = t039; + mat49.e10 = t1019; + mat49.e11 = t1119; + mat49.e12 = t1219; + mat49.e13 = t139; + mat49.e20 = t2019; + mat49.e21 = t2119; + mat49.e22 = t2219; + mat49.e23 = t239; + mat49.e30 = t309; + mat49.e31 = t319; + mat49.e32 = t329; + mat49.e33 = t339; + if(_this63.sizeMat4 == _this63.stackMat4.length) { + var newLength38 = _this63.sizeMat4 << 1; + var this39 = new Array(newLength38); + var newArray38 = this39; + var _g48 = 0; + var _g138 = _this63.sizeMat4; + while(_g48 < _g138) { + var i38 = _g48++; + newArray38[i38] = _this63.stackMat4[i38]; + _this63.stackMat4[i38] = null; + } + _this63.stackMat4 = newArray38; + } + _this63.stackMat4[_this63.sizeMat4++] = mat49; + } + if(quat9 != null) { + var tx36 = 0; + var ty36 = 0; + var tz36 = 0; + var tw9 = 1; + quat9.x = tx36; + quat9.y = ty36; + quat9.z = tz36; + quat9.w = tw9; + if(_this63.sizeQuat == _this63.stackQuat.length) { + var newLength39 = _this63.sizeQuat << 1; + var this40 = new Array(newLength39); + var newArray39 = this40; + var _g49 = 0; + var _g139 = _this63.sizeQuat; + while(_g49 < _g139) { + var i39 = _g49++; + newArray39[i39] = _this63.stackQuat[i39]; + _this63.stackQuat[i39] = null; + } + _this63.stackQuat = newArray39; + } + _this63.stackQuat[_this63.sizeQuat++] = quat9; + } + var _this64 = this.p; + var mat310 = null; + var mat410 = null; + var quat10 = null; + if(v8 != null) { + v8.zero(); + if(_this64.sizeVec3 == _this64.stackVec3.length) { + var newLength40 = _this64.sizeVec3 << 1; + var this41 = new Array(newLength40); + var newArray40 = this41; + var _g50 = 0; + var _g140 = _this64.sizeVec3; + while(_g50 < _g140) { + var i40 = _g50++; + newArray40[i40] = _this64.stackVec3[i40]; + _this64.stackVec3[i40] = null; + } + _this64.stackVec3 = newArray40; + } + _this64.stackVec3[_this64.sizeVec3++] = v8; + } + if(mat310 != null) { + var t0020 = 1; + var t0120 = 0; + var t0220 = 0; + var t1020 = 0; + var t1120 = 1; + var t1220 = 0; + var t2020 = 0; + var t2120 = 0; + var t2220 = 1; + mat310.e00 = t0020; + mat310.e01 = t0120; + mat310.e02 = t0220; + mat310.e10 = t1020; + mat310.e11 = t1120; + mat310.e12 = t1220; + mat310.e20 = t2020; + mat310.e21 = t2120; + mat310.e22 = t2220; + if(_this64.sizeMat3 == _this64.stackMat3.length) { + var newLength41 = _this64.sizeMat3 << 1; + var this42 = new Array(newLength41); + var newArray41 = this42; + var _g51 = 0; + var _g141 = _this64.sizeMat3; + while(_g51 < _g141) { + var i41 = _g51++; + newArray41[i41] = _this64.stackMat3[i41]; + _this64.stackMat3[i41] = null; + } + _this64.stackMat3 = newArray41; + } + _this64.stackMat3[_this64.sizeMat3++] = mat310; + } + if(mat410 != null) { + var t0021 = 1; + var t0121 = 0; + var t0221 = 0; + var t0310 = 0; + var t1021 = 0; + var t1121 = 1; + var t1221 = 0; + var t1310 = 0; + var t2021 = 0; + var t2121 = 0; + var t2221 = 1; + var t2310 = 0; + var t3010 = 0; + var t3110 = 0; + var t3210 = 0; + var t3310 = 1; + mat410.e00 = t0021; + mat410.e01 = t0121; + mat410.e02 = t0221; + mat410.e03 = t0310; + mat410.e10 = t1021; + mat410.e11 = t1121; + mat410.e12 = t1221; + mat410.e13 = t1310; + mat410.e20 = t2021; + mat410.e21 = t2121; + mat410.e22 = t2221; + mat410.e23 = t2310; + mat410.e30 = t3010; + mat410.e31 = t3110; + mat410.e32 = t3210; + mat410.e33 = t3310; + if(_this64.sizeMat4 == _this64.stackMat4.length) { + var newLength42 = _this64.sizeMat4 << 1; + var this43 = new Array(newLength42); + var newArray42 = this43; + var _g52 = 0; + var _g142 = _this64.sizeMat4; + while(_g52 < _g142) { + var i42 = _g52++; + newArray42[i42] = _this64.stackMat4[i42]; + _this64.stackMat4[i42] = null; + } + _this64.stackMat4 = newArray42; + } + _this64.stackMat4[_this64.sizeMat4++] = mat410; + } + if(quat10 != null) { + var tx37 = 0; + var ty37 = 0; + var tz37 = 0; + var tw10 = 1; + quat10.x = tx37; + quat10.y = ty37; + quat10.z = tz37; + quat10.w = tw10; + if(_this64.sizeQuat == _this64.stackQuat.length) { + var newLength43 = _this64.sizeQuat << 1; + var this44 = new Array(newLength43); + var newArray43 = this44; + var _g53 = 0; + var _g143 = _this64.sizeQuat; + while(_g53 < _g143) { + var i43 = _g53++; + newArray43[i43] = _this64.stackQuat[i43]; + _this64.stackQuat[i43] = null; + } + _this64.stackQuat = newArray43; + } + _this64.stackQuat[_this64.sizeQuat++] = quat10; + } + var _this65 = this.p; + var mat311 = null; + var mat411 = null; + var quat11 = null; + if(o != null) { + o.zero(); + if(_this65.sizeVec3 == _this65.stackVec3.length) { + var newLength44 = _this65.sizeVec3 << 1; + var this45 = new Array(newLength44); + var newArray44 = this45; + var _g54 = 0; + var _g144 = _this65.sizeVec3; + while(_g54 < _g144) { + var i44 = _g54++; + newArray44[i44] = _this65.stackVec3[i44]; + _this65.stackVec3[i44] = null; + } + _this65.stackVec3 = newArray44; + } + _this65.stackVec3[_this65.sizeVec3++] = o; + } + if(mat311 != null) { + var t0022 = 1; + var t0122 = 0; + var t0222 = 0; + var t1022 = 0; + var t1122 = 1; + var t1222 = 0; + var t2022 = 0; + var t2122 = 0; + var t2222 = 1; + mat311.e00 = t0022; + mat311.e01 = t0122; + mat311.e02 = t0222; + mat311.e10 = t1022; + mat311.e11 = t1122; + mat311.e12 = t1222; + mat311.e20 = t2022; + mat311.e21 = t2122; + mat311.e22 = t2222; + if(_this65.sizeMat3 == _this65.stackMat3.length) { + var newLength45 = _this65.sizeMat3 << 1; + var this46 = new Array(newLength45); + var newArray45 = this46; + var _g55 = 0; + var _g145 = _this65.sizeMat3; + while(_g55 < _g145) { + var i45 = _g55++; + newArray45[i45] = _this65.stackMat3[i45]; + _this65.stackMat3[i45] = null; + } + _this65.stackMat3 = newArray45; + } + _this65.stackMat3[_this65.sizeMat3++] = mat311; + } + if(mat411 != null) { + var t0023 = 1; + var t0123 = 0; + var t0223 = 0; + var t0311 = 0; + var t1023 = 0; + var t1123 = 1; + var t1223 = 0; + var t1311 = 0; + var t2023 = 0; + var t2123 = 0; + var t2223 = 1; + var t2311 = 0; + var t3011 = 0; + var t3111 = 0; + var t3211 = 0; + var t3311 = 1; + mat411.e00 = t0023; + mat411.e01 = t0123; + mat411.e02 = t0223; + mat411.e03 = t0311; + mat411.e10 = t1023; + mat411.e11 = t1123; + mat411.e12 = t1223; + mat411.e13 = t1311; + mat411.e20 = t2023; + mat411.e21 = t2123; + mat411.e22 = t2223; + mat411.e23 = t2311; + mat411.e30 = t3011; + mat411.e31 = t3111; + mat411.e32 = t3211; + mat411.e33 = t3311; + if(_this65.sizeMat4 == _this65.stackMat4.length) { + var newLength46 = _this65.sizeMat4 << 1; + var this47 = new Array(newLength46); + var newArray46 = this47; + var _g56 = 0; + var _g146 = _this65.sizeMat4; + while(_g56 < _g146) { + var i46 = _g56++; + newArray46[i46] = _this65.stackMat4[i46]; + _this65.stackMat4[i46] = null; + } + _this65.stackMat4 = newArray46; + } + _this65.stackMat4[_this65.sizeMat4++] = mat411; + } + if(quat11 != null) { + var tx38 = 0; + var ty38 = 0; + var tz38 = 0; + var tw11 = 1; + quat11.x = tx38; + quat11.y = ty38; + quat11.z = tz38; + quat11.w = tw11; + if(_this65.sizeQuat == _this65.stackQuat.length) { + var newLength47 = _this65.sizeQuat << 1; + var this48 = new Array(newLength47); + var newArray47 = this48; + var _g57 = 0; + var _g147 = _this65.sizeQuat; + while(_g57 < _g147) { + var i47 = _g57++; + newArray47[i47] = _this65.stackQuat[i47]; + _this65.stackQuat[i47] = null; + } + _this65.stackQuat = newArray47; + } + _this65.stackQuat[_this65.sizeQuat++] = quat11; + } + var _this66 = this.p; + var vec3 = null; + var mat412 = null; + var quat12 = null; + if(vec3 != null) { + vec3.zero(); + if(_this66.sizeVec3 == _this66.stackVec3.length) { + var newLength48 = _this66.sizeVec3 << 1; + var this49 = new Array(newLength48); + var newArray48 = this49; + var _g58 = 0; + var _g148 = _this66.sizeVec3; + while(_g58 < _g148) { + var i48 = _g58++; + newArray48[i48] = _this66.stackVec3[i48]; + _this66.stackVec3[i48] = null; + } + _this66.stackVec3 = newArray48; + } + _this66.stackVec3[_this66.sizeVec3++] = vec3; + } + if(m != null) { + var t0024 = 1; + var t0124 = 0; + var t0224 = 0; + var t1024 = 0; + var t1124 = 1; + var t1224 = 0; + var t2024 = 0; + var t2124 = 0; + var t2224 = 1; + m.e00 = t0024; + m.e01 = t0124; + m.e02 = t0224; + m.e10 = t1024; + m.e11 = t1124; + m.e12 = t1224; + m.e20 = t2024; + m.e21 = t2124; + m.e22 = t2224; + if(_this66.sizeMat3 == _this66.stackMat3.length) { + var newLength49 = _this66.sizeMat3 << 1; + var this50 = new Array(newLength49); + var newArray49 = this50; + var _g59 = 0; + var _g149 = _this66.sizeMat3; + while(_g59 < _g149) { + var i49 = _g59++; + newArray49[i49] = _this66.stackMat3[i49]; + _this66.stackMat3[i49] = null; + } + _this66.stackMat3 = newArray49; + } + _this66.stackMat3[_this66.sizeMat3++] = m; + } + if(mat412 != null) { + var t0025 = 1; + var t0125 = 0; + var t0225 = 0; + var t0312 = 0; + var t1025 = 0; + var t1125 = 1; + var t1225 = 0; + var t1312 = 0; + var t2025 = 0; + var t2125 = 0; + var t2225 = 1; + var t2312 = 0; + var t3012 = 0; + var t3112 = 0; + var t3212 = 0; + var t3312 = 1; + mat412.e00 = t0025; + mat412.e01 = t0125; + mat412.e02 = t0225; + mat412.e03 = t0312; + mat412.e10 = t1025; + mat412.e11 = t1125; + mat412.e12 = t1225; + mat412.e13 = t1312; + mat412.e20 = t2025; + mat412.e21 = t2125; + mat412.e22 = t2225; + mat412.e23 = t2312; + mat412.e30 = t3012; + mat412.e31 = t3112; + mat412.e32 = t3212; + mat412.e33 = t3312; + if(_this66.sizeMat4 == _this66.stackMat4.length) { + var newLength50 = _this66.sizeMat4 << 1; + var this51 = new Array(newLength50); + var newArray50 = this51; + var _g60 = 0; + var _g150 = _this66.sizeMat4; + while(_g60 < _g150) { + var i50 = _g60++; + newArray50[i50] = _this66.stackMat4[i50]; + _this66.stackMat4[i50] = null; + } + _this66.stackMat4 = newArray50; + } + _this66.stackMat4[_this66.sizeMat4++] = mat412; + } + if(quat12 != null) { + var tx39 = 0; + var ty39 = 0; + var tz39 = 0; + var tw12 = 1; + quat12.x = tx39; + quat12.y = ty39; + quat12.z = tz39; + quat12.w = tw12; + if(_this66.sizeQuat == _this66.stackQuat.length) { + var newLength51 = _this66.sizeQuat << 1; + var this52 = new Array(newLength51); + var newArray51 = this52; + var _g61 = 0; + var _g151 = _this66.sizeQuat; + while(_g61 < _g151) { + var i51 = _g61++; + newArray51[i51] = _this66.stackQuat[i51]; + _this66.stackQuat[i51] = null; + } + _this66.stackQuat = newArray51; + } + _this66.stackQuat[_this66.sizeQuat++] = quat12; + } + var _this67 = this.p; + var mat312 = null; + var mat413 = null; + var quat13 = null; + if(ex != null) { + ex.zero(); + if(_this67.sizeVec3 == _this67.stackVec3.length) { + var newLength52 = _this67.sizeVec3 << 1; + var this53 = new Array(newLength52); + var newArray52 = this53; + var _g62 = 0; + var _g152 = _this67.sizeVec3; + while(_g62 < _g152) { + var i52 = _g62++; + newArray52[i52] = _this67.stackVec3[i52]; + _this67.stackVec3[i52] = null; + } + _this67.stackVec3 = newArray52; + } + _this67.stackVec3[_this67.sizeVec3++] = ex; + } + if(mat312 != null) { + var t0026 = 1; + var t0126 = 0; + var t0226 = 0; + var t1026 = 0; + var t1126 = 1; + var t1226 = 0; + var t2026 = 0; + var t2126 = 0; + var t2226 = 1; + mat312.e00 = t0026; + mat312.e01 = t0126; + mat312.e02 = t0226; + mat312.e10 = t1026; + mat312.e11 = t1126; + mat312.e12 = t1226; + mat312.e20 = t2026; + mat312.e21 = t2126; + mat312.e22 = t2226; + if(_this67.sizeMat3 == _this67.stackMat3.length) { + var newLength53 = _this67.sizeMat3 << 1; + var this54 = new Array(newLength53); + var newArray53 = this54; + var _g63 = 0; + var _g153 = _this67.sizeMat3; + while(_g63 < _g153) { + var i53 = _g63++; + newArray53[i53] = _this67.stackMat3[i53]; + _this67.stackMat3[i53] = null; + } + _this67.stackMat3 = newArray53; + } + _this67.stackMat3[_this67.sizeMat3++] = mat312; + } + if(mat413 != null) { + var t0027 = 1; + var t0127 = 0; + var t0227 = 0; + var t0313 = 0; + var t1027 = 0; + var t1127 = 1; + var t1227 = 0; + var t1313 = 0; + var t2027 = 0; + var t2127 = 0; + var t2227 = 1; + var t2313 = 0; + var t3013 = 0; + var t3113 = 0; + var t3213 = 0; + var t3313 = 1; + mat413.e00 = t0027; + mat413.e01 = t0127; + mat413.e02 = t0227; + mat413.e03 = t0313; + mat413.e10 = t1027; + mat413.e11 = t1127; + mat413.e12 = t1227; + mat413.e13 = t1313; + mat413.e20 = t2027; + mat413.e21 = t2127; + mat413.e22 = t2227; + mat413.e23 = t2313; + mat413.e30 = t3013; + mat413.e31 = t3113; + mat413.e32 = t3213; + mat413.e33 = t3313; + if(_this67.sizeMat4 == _this67.stackMat4.length) { + var newLength54 = _this67.sizeMat4 << 1; + var this55 = new Array(newLength54); + var newArray54 = this55; + var _g64 = 0; + var _g154 = _this67.sizeMat4; + while(_g64 < _g154) { + var i54 = _g64++; + newArray54[i54] = _this67.stackMat4[i54]; + _this67.stackMat4[i54] = null; + } + _this67.stackMat4 = newArray54; + } + _this67.stackMat4[_this67.sizeMat4++] = mat413; + } + if(quat13 != null) { + var tx40 = 0; + var ty40 = 0; + var tz40 = 0; + var tw13 = 1; + quat13.x = tx40; + quat13.y = ty40; + quat13.z = tz40; + quat13.w = tw13; + if(_this67.sizeQuat == _this67.stackQuat.length) { + var newLength55 = _this67.sizeQuat << 1; + var this56 = new Array(newLength55); + var newArray55 = this56; + var _g65 = 0; + var _g155 = _this67.sizeQuat; + while(_g65 < _g155) { + var i55 = _g65++; + newArray55[i55] = _this67.stackQuat[i55]; + _this67.stackQuat[i55] = null; + } + _this67.stackQuat = newArray55; + } + _this67.stackQuat[_this67.sizeQuat++] = quat13; + } + var _this68 = this.p; + var mat313 = null; + var mat414 = null; + var quat14 = null; + if(ey != null) { + ey.zero(); + if(_this68.sizeVec3 == _this68.stackVec3.length) { + var newLength56 = _this68.sizeVec3 << 1; + var this57 = new Array(newLength56); + var newArray56 = this57; + var _g66 = 0; + var _g156 = _this68.sizeVec3; + while(_g66 < _g156) { + var i56 = _g66++; + newArray56[i56] = _this68.stackVec3[i56]; + _this68.stackVec3[i56] = null; + } + _this68.stackVec3 = newArray56; + } + _this68.stackVec3[_this68.sizeVec3++] = ey; + } + if(mat313 != null) { + var t0028 = 1; + var t0128 = 0; + var t0228 = 0; + var t1028 = 0; + var t1128 = 1; + var t1228 = 0; + var t2028 = 0; + var t2128 = 0; + var t2228 = 1; + mat313.e00 = t0028; + mat313.e01 = t0128; + mat313.e02 = t0228; + mat313.e10 = t1028; + mat313.e11 = t1128; + mat313.e12 = t1228; + mat313.e20 = t2028; + mat313.e21 = t2128; + mat313.e22 = t2228; + if(_this68.sizeMat3 == _this68.stackMat3.length) { + var newLength57 = _this68.sizeMat3 << 1; + var this58 = new Array(newLength57); + var newArray57 = this58; + var _g67 = 0; + var _g157 = _this68.sizeMat3; + while(_g67 < _g157) { + var i57 = _g67++; + newArray57[i57] = _this68.stackMat3[i57]; + _this68.stackMat3[i57] = null; + } + _this68.stackMat3 = newArray57; + } + _this68.stackMat3[_this68.sizeMat3++] = mat313; + } + if(mat414 != null) { + var t0029 = 1; + var t0129 = 0; + var t0229 = 0; + var t0314 = 0; + var t1029 = 0; + var t1129 = 1; + var t1229 = 0; + var t1314 = 0; + var t2029 = 0; + var t2129 = 0; + var t2229 = 1; + var t2314 = 0; + var t3014 = 0; + var t3114 = 0; + var t3214 = 0; + var t3314 = 1; + mat414.e00 = t0029; + mat414.e01 = t0129; + mat414.e02 = t0229; + mat414.e03 = t0314; + mat414.e10 = t1029; + mat414.e11 = t1129; + mat414.e12 = t1229; + mat414.e13 = t1314; + mat414.e20 = t2029; + mat414.e21 = t2129; + mat414.e22 = t2229; + mat414.e23 = t2314; + mat414.e30 = t3014; + mat414.e31 = t3114; + mat414.e32 = t3214; + mat414.e33 = t3314; + if(_this68.sizeMat4 == _this68.stackMat4.length) { + var newLength58 = _this68.sizeMat4 << 1; + var this59 = new Array(newLength58); + var newArray58 = this59; + var _g68 = 0; + var _g158 = _this68.sizeMat4; + while(_g68 < _g158) { + var i58 = _g68++; + newArray58[i58] = _this68.stackMat4[i58]; + _this68.stackMat4[i58] = null; + } + _this68.stackMat4 = newArray58; + } + _this68.stackMat4[_this68.sizeMat4++] = mat414; + } + if(quat14 != null) { + var tx41 = 0; + var ty41 = 0; + var tz41 = 0; + var tw14 = 1; + quat14.x = tx41; + quat14.y = ty41; + quat14.z = tz41; + quat14.w = tw14; + if(_this68.sizeQuat == _this68.stackQuat.length) { + var newLength59 = _this68.sizeQuat << 1; + var this60 = new Array(newLength59); + var newArray59 = this60; + var _g69 = 0; + var _g159 = _this68.sizeQuat; + while(_g69 < _g159) { + var i59 = _g69++; + newArray59[i59] = _this68.stackQuat[i59]; + _this68.stackQuat[i59] = null; + } + _this68.stackQuat = newArray59; + } + _this68.stackQuat[_this68.sizeQuat++] = quat14; + } + var _this69 = this.p; + var mat314 = null; + var mat415 = null; + var quat15 = null; + if(ez != null) { + ez.zero(); + if(_this69.sizeVec3 == _this69.stackVec3.length) { + var newLength60 = _this69.sizeVec3 << 1; + var this61 = new Array(newLength60); + var newArray60 = this61; + var _g70 = 0; + var _g160 = _this69.sizeVec3; + while(_g70 < _g160) { + var i60 = _g70++; + newArray60[i60] = _this69.stackVec3[i60]; + _this69.stackVec3[i60] = null; + } + _this69.stackVec3 = newArray60; + } + _this69.stackVec3[_this69.sizeVec3++] = ez; + } + if(mat314 != null) { + var t0030 = 1; + var t0130 = 0; + var t0230 = 0; + var t1030 = 0; + var t1130 = 1; + var t1230 = 0; + var t2030 = 0; + var t2130 = 0; + var t2230 = 1; + mat314.e00 = t0030; + mat314.e01 = t0130; + mat314.e02 = t0230; + mat314.e10 = t1030; + mat314.e11 = t1130; + mat314.e12 = t1230; + mat314.e20 = t2030; + mat314.e21 = t2130; + mat314.e22 = t2230; + if(_this69.sizeMat3 == _this69.stackMat3.length) { + var newLength61 = _this69.sizeMat3 << 1; + var this62 = new Array(newLength61); + var newArray61 = this62; + var _g71 = 0; + var _g161 = _this69.sizeMat3; + while(_g71 < _g161) { + var i61 = _g71++; + newArray61[i61] = _this69.stackMat3[i61]; + _this69.stackMat3[i61] = null; + } + _this69.stackMat3 = newArray61; + } + _this69.stackMat3[_this69.sizeMat3++] = mat314; + } + if(mat415 != null) { + var t0031 = 1; + var t0131 = 0; + var t0231 = 0; + var t0315 = 0; + var t1031 = 0; + var t1131 = 1; + var t1231 = 0; + var t1315 = 0; + var t2031 = 0; + var t2131 = 0; + var t2231 = 1; + var t2315 = 0; + var t3015 = 0; + var t3115 = 0; + var t3215 = 0; + var t3315 = 1; + mat415.e00 = t0031; + mat415.e01 = t0131; + mat415.e02 = t0231; + mat415.e03 = t0315; + mat415.e10 = t1031; + mat415.e11 = t1131; + mat415.e12 = t1231; + mat415.e13 = t1315; + mat415.e20 = t2031; + mat415.e21 = t2131; + mat415.e22 = t2231; + mat415.e23 = t2315; + mat415.e30 = t3015; + mat415.e31 = t3115; + mat415.e32 = t3215; + mat415.e33 = t3315; + if(_this69.sizeMat4 == _this69.stackMat4.length) { + var newLength62 = _this69.sizeMat4 << 1; + var this63 = new Array(newLength62); + var newArray62 = this63; + var _g72 = 0; + var _g162 = _this69.sizeMat4; + while(_g72 < _g162) { + var i62 = _g72++; + newArray62[i62] = _this69.stackMat4[i62]; + _this69.stackMat4[i62] = null; + } + _this69.stackMat4 = newArray62; + } + _this69.stackMat4[_this69.sizeMat4++] = mat415; + } + if(quat15 != null) { + var tx42 = 0; + var ty42 = 0; + var tz42 = 0; + var tw15 = 1; + quat15.x = tx42; + quat15.y = ty42; + quat15.z = tz42; + quat15.w = tw15; + if(_this69.sizeQuat == _this69.stackQuat.length) { + var newLength63 = _this69.sizeQuat << 1; + var this64 = new Array(newLength63); + var newArray63 = this64; + var _g73 = 0; + var _g163 = _this69.sizeQuat; + while(_g73 < _g163) { + var i63 = _g73++; + newArray63[i63] = _this69.stackQuat[i63]; + _this69.stackQuat[i63] = null; + } + _this69.stackQuat = newArray63; + } + _this69.stackQuat[_this69.sizeQuat++] = quat15; + } + } + rect(v1,v2,v3,v4,n1,n2,n3,n4,color) { + this.triangle(v1,v2,v3,n1,n2,n3,color); + this.triangle(v1,v3,v4,n1,n3,n4,color); + } + point(v,color) { + } + triangle(v1,v2,v3,n1,n2,n3,color) { + } + line(v1,v2,color) { + } +} +oimo.dynamics.common.DebugDrawStyle = class oimo_dynamics_common_DebugDrawStyle { + constructor() { + this.basisColorZ = new oimo.common.Vec3(0.0,0.0,1.0); + this.basisColorY = new oimo.common.Vec3(0.0,1.0,0.0); + this.basisColorX = new oimo.common.Vec3(1.0,0.0,0.0); + this.basisLength = 0.5; + this.jointRotationalConstraintRadius = 0.3; + this.jointErrorColor = new oimo.common.Vec3(1.0,0.1,0.1); + this.jointLineColor = new oimo.common.Vec3(0.8,0.8,0.8); + this.contactBinormalLength = 0.5; + this.contactTangentLength = 0.5; + this.contactNormalLength = 0.5; + this.contactBinormalColor = new oimo.common.Vec3(0.2,0.2,1.0); + this.contactTangentColor = new oimo.common.Vec3(0.1,0.8,0.1); + this.contactNormalColor = new oimo.common.Vec3(1.0,0.1,0.1); + this.disabledContactColor = new oimo.common.Vec3(0.5,0.1,0.1); + this.newContactColor = new oimo.common.Vec3(1.0,1.0,0.1); + this.contactColor4 = new oimo.common.Vec3(0.8,0.1,1.0); + this.contactColor3 = new oimo.common.Vec3(0.1,0.8,0.6); + this.contactColor2 = new oimo.common.Vec3(1.0,0.6,0.1); + this.contactColor = new oimo.common.Vec3(1.0,0.1,0.1); + this.pairColor = new oimo.common.Vec3(1.0,1.0,0.1); + this.bvhNodeColor = new oimo.common.Vec3(0.4,0.4,0.4); + this.aabbColor = new oimo.common.Vec3(1.0,0.1,0.1); + this.kinematicShapeColor = new oimo.common.Vec3(1.0,0.5,0.1); + this.staticShapeColor = new oimo.common.Vec3(0.7,0.7,0.7); + this.sleepingShapeColor2 = new oimo.common.Vec3(0.2,0.8,0.5); + this.sleepingShapeColor1 = new oimo.common.Vec3(0.3,0.3,0.8); + this.sleepyShapeColor2 = new oimo.common.Vec3(0.6,0.8,0.3); + this.sleepyShapeColor1 = new oimo.common.Vec3(0.5,0.25,0.6); + this.shapeColor2 = new oimo.common.Vec3(1.0,0.8,0.1); + this.shapeColor1 = new oimo.common.Vec3(0.7,0.2,0.4); + } +} +oimo.dynamics.common.Performance = class oimo_dynamics_common_Performance { +} +if(!oimo.dynamics.constraint) oimo.dynamics.constraint = {}; +oimo.dynamics.constraint.ConstraintSolver = class oimo_dynamics_constraint_ConstraintSolver { + constructor() { + this._b1 = null; + this._b2 = null; + this._addedToIsland = false; + } + preSolveVelocity(timeStep) { + } + warmStart(timeStep) { + } + solveVelocity() { + } + postSolveVelocity(timeStep) { + } + preSolvePosition(timeStep) { + } + solvePositionSplitImpulse() { + } + solvePositionNgs(timeStep) { + } + postSolve() { + } +} +oimo.dynamics.constraint.PositionCorrectionAlgorithm = class oimo_dynamics_constraint_PositionCorrectionAlgorithm { +} +if(!oimo.dynamics.constraint.contact) oimo.dynamics.constraint.contact = {}; +oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constraint_contact_ContactConstraint { + constructor(manifold) { + this._solver = new oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver(this); + this._manifold = manifold; + } + _getVelocitySolverInfo(timeStep,info) { + info.b1 = this._b1; + info.b2 = this._b2; + var normal; + var normalX; + var normalY; + var normalZ; + var tangent; + var tangentX; + var tangentY; + var tangentZ; + var binormal; + var binormalX; + var binormalY; + var binormalZ; + normalX = this._manifold._normalX; + normalY = this._manifold._normalY; + normalZ = this._manifold._normalZ; + tangentX = this._manifold._tangentX; + tangentY = this._manifold._tangentY; + tangentZ = this._manifold._tangentZ; + binormalX = this._manifold._binormalX; + binormalY = this._manifold._binormalY; + binormalZ = this._manifold._binormalZ; + var friction = Math.sqrt(this._s1._friction * this._s2._friction); + var restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); + var num = this._manifold._numPoints; + info.numRows = 0; + var posDiff; + var posDiffX; + var posDiffY; + var posDiffZ; + posDiffX = this._tf1._positionX - this._tf2._positionX; + posDiffY = this._tf1._positionY - this._tf2._positionY; + posDiffZ = this._tf1._positionZ - this._tf2._positionZ; + var _g = 0; + var _g1 = num; + while(_g < _g1) { + var i = _g++; + var p = this._manifold._points[i]; + if(p._depth < 0) { + p._disabled = true; + var _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; + continue; + } else { + p._disabled = false; + } + var row = info.rows[info.numRows++]; + row.friction = friction; + row.cfm = 0; + var j = row.jacobianN; + j.lin1X = normalX; + j.lin1Y = normalY; + j.lin1Z = normalZ; + j.lin2X = normalX; + j.lin2Y = normalY; + j.lin2Z = normalZ; + j.ang1X = p._relPos1Y * normalZ - p._relPos1Z * normalY; + j.ang1Y = p._relPos1Z * normalX - p._relPos1X * normalZ; + j.ang1Z = p._relPos1X * normalY - p._relPos1Y * normalX; + j.ang2X = p._relPos2Y * normalZ - p._relPos2Z * normalY; + j.ang2Y = p._relPos2Z * normalX - p._relPos2X * normalZ; + j.ang2Z = p._relPos2X * normalY - p._relPos2Y * normalX; + j = row.jacobianT; + j.lin1X = tangentX; + j.lin1Y = tangentY; + j.lin1Z = tangentZ; + j.lin2X = tangentX; + j.lin2Y = tangentY; + j.lin2Z = tangentZ; + j.ang1X = p._relPos1Y * tangentZ - p._relPos1Z * tangentY; + j.ang1Y = p._relPos1Z * tangentX - p._relPos1X * tangentZ; + j.ang1Z = p._relPos1X * tangentY - p._relPos1Y * tangentX; + j.ang2X = p._relPos2Y * tangentZ - p._relPos2Z * tangentY; + j.ang2Y = p._relPos2Z * tangentX - p._relPos2X * tangentZ; + j.ang2Z = p._relPos2X * tangentY - p._relPos2Y * tangentX; + j = row.jacobianB; + j.lin1X = binormalX; + j.lin1Y = binormalY; + j.lin1Z = binormalZ; + j.lin2X = binormalX; + j.lin2Y = binormalY; + j.lin2Z = binormalZ; + j.ang1X = p._relPos1Y * binormalZ - p._relPos1Z * binormalY; + j.ang1Y = p._relPos1Z * binormalX - p._relPos1X * binormalZ; + j.ang1Z = p._relPos1X * binormalY - p._relPos1Y * binormalX; + j.ang2X = p._relPos2Y * binormalZ - p._relPos2Z * binormalY; + j.ang2Y = p._relPos2Z * binormalX - p._relPos2X * binormalZ; + j.ang2Z = p._relPos2X * binormalY - p._relPos2Y * binormalX; + j = row.jacobianN; + var rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); + if(rvn < -oimo.common.Setting.contactEnableBounceThreshold && !p._warmStarted) { + row.rhs = -rvn * restitution; + } else { + row.rhs = 0; + } + if(this._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE) { + if(p._depth > oimo.common.Setting.linearSlop) { + var minRhs = (p._depth - oimo.common.Setting.linearSlop) * oimo.common.Setting.velocityBaumgarte * timeStep.invDt; + if(row.rhs < minRhs) { + row.rhs = minRhs; + } + } + } + if(!p._warmStarted) { + var _this1 = p._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + } + row.impulse = p._impulse; + } + } + _getPositionSolverInfo(info) { + info.b1 = this._b1; + info.b2 = this._b2; + var normal; + var normalX; + var normalY; + var normalZ; + normalX = this._manifold._normalX; + normalY = this._manifold._normalY; + normalZ = this._manifold._normalZ; + var num = this._manifold._numPoints; + info.numRows = 0; + var _g = 0; + var _g1 = num; + while(_g < _g1) { + var i = _g++; + var p = this._manifold._points[i]; + if(p._disabled) { + continue; + } + var row = info.rows[info.numRows++]; + var j = row.jacobianN; + j.lin1X = normalX; + j.lin1Y = normalY; + j.lin1Z = normalZ; + j.lin2X = normalX; + j.lin2Y = normalY; + j.lin2Z = normalZ; + j.ang1X = p._relPos1Y * normalZ - p._relPos1Z * normalY; + j.ang1Y = p._relPos1Z * normalX - p._relPos1X * normalZ; + j.ang1Z = p._relPos1X * normalY - p._relPos1Y * normalX; + j.ang2X = p._relPos2Y * normalZ - p._relPos2Z * normalY; + j.ang2Y = p._relPos2Z * normalX - p._relPos2X * normalZ; + j.ang2Z = p._relPos2X * normalY - p._relPos2Y * normalX; + row.rhs = p._depth - oimo.common.Setting.linearSlop; + if(row.rhs < 0) { + row.rhs = 0; + } + row.impulse = p._impulse; + } + } + _syncManifold() { + this._manifold._updateDepthsAndPositions(this._tf1,this._tf2); + } + getShape1() { + return this._s1; + } + getShape2() { + return this._s2; + } + getManifold() { + return this._manifold; + } + isTouching() { + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) { + var i = _g++; + if(this._manifold._points[i]._depth >= 0) { + return true; + } + } + return false; + } +} +oimo.dynamics.constraint.contact.ContactImpulse = class oimo_dynamics_constraint_contact_ContactImpulse { + constructor() { + this.impulseN = 0; + this.impulseT = 0; + this.impulseB = 0; + this.impulseP = 0; + this.impulseLX = 0; + this.impulseLY = 0; + this.impulseLZ = 0; + } + copyFrom(imp) { + this.impulseN = imp.impulseN; + this.impulseT = imp.impulseT; + this.impulseB = imp.impulseB; + this.impulseLX = imp.impulseLX; + this.impulseLY = imp.impulseLY; + this.impulseLZ = imp.impulseLZ; + } +} +oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_contact_Manifold { + constructor() { + this._normalX = 0; + this._normalY = 0; + this._normalZ = 0; + this._tangentX = 0; + this._tangentY = 0; + this._tangentZ = 0; + this._binormalX = 0; + this._binormalY = 0; + this._binormalZ = 0; + this._numPoints = 0; + var this1 = new Array(oimo.common.Setting.maxManifoldPoints); + this._points = this1; + var _g = 0; + var _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) { + var i = _g++; + this._points[i] = new oimo.dynamics.constraint.contact.ManifoldPoint(); + } + } + _clear() { + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var i = _g++; + var _this = this._points[i]; + _this._localPos1X = 0; + _this._localPos1Y = 0; + _this._localPos1Z = 0; + _this._localPos2X = 0; + _this._localPos2Y = 0; + _this._localPos2Z = 0; + _this._relPos1X = 0; + _this._relPos1Y = 0; + _this._relPos1Z = 0; + _this._relPos2X = 0; + _this._relPos2Y = 0; + _this._relPos2Z = 0; + _this._pos1X = 0; + _this._pos1Y = 0; + _this._pos1Z = 0; + _this._pos2X = 0; + _this._pos2Y = 0; + _this._pos2Z = 0; + _this._depth = 0; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._warmStarted = false; + _this._disabled = false; + _this._id = -1; + } + this._numPoints = 0; + } + _buildBasis(normal) { + var v = normal; + this._normalX = v.x; + this._normalY = v.y; + this._normalZ = v.z; + var nx = normal.x; + var ny = normal.y; + var nz = normal.z; + var nx2 = nx * nx; + var ny2 = ny * ny; + var nz2 = nz * nz; + var tx; + var ty; + var tz; + var bx; + var by; + var bz; + if(nx2 < ny2) { + if(nx2 < nz2) { + var invL = 1 / Math.sqrt(ny2 + nz2); + tx = 0; + ty = -nz * invL; + tz = ny * invL; + bx = ny * tz - nz * ty; + by = -nx * tz; + bz = nx * ty; + } else { + var invL1 = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL1; + ty = nx * invL1; + tz = 0; + bx = -nz * ty; + by = nz * tx; + bz = nx * ty - ny * tx; + } + } else if(ny2 < nz2) { + var invL2 = 1 / Math.sqrt(nx2 + nz2); + tx = nz * invL2; + ty = 0; + tz = -nx * invL2; + bx = ny * tz; + by = nz * tx - nx * tz; + bz = -ny * tx; + } else { + var invL3 = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL3; + ty = nx * invL3; + tz = 0; + bx = -nz * ty; + by = nz * tx; + bz = nx * ty - ny * tx; + } + this._tangentX = tx; + this._tangentY = ty; + this._tangentZ = tz; + this._binormalX = bx; + this._binormalY = by; + this._binormalZ = bz; + } + _updateDepthsAndPositions(tf1,tf2) { + var _g = 0; + var _g1 = this._numPoints; + while(_g < _g1) { + var i = _g++; + var p = this._points[i]; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; + __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; + __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; + p._relPos1X = __tmp__X; + p._relPos1Y = __tmp__Y; + p._relPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; + __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; + __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; + p._relPos2X = __tmp__X1; + p._relPos2Y = __tmp__Y1; + p._relPos2Z = __tmp__Z1; + p._pos1X = p._relPos1X + tf1._positionX; + p._pos1Y = p._relPos1Y + tf1._positionY; + p._pos1Z = p._relPos1Z + tf1._positionZ; + p._pos2X = p._relPos2X + tf2._positionX; + p._pos2Y = p._relPos2Y + tf2._positionY; + p._pos2Z = p._relPos2Z + tf2._positionZ; + var diff; + var diffX; + var diffY; + var diffZ; + diffX = p._pos1X - p._pos2X; + diffY = p._pos1Y - p._pos2Y; + diffZ = p._pos1Z - p._pos2Z; + var dotN = diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ; + p._depth = -dotN; + } + } + getNormal() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._normalX; + v1.y = this._normalY; + v1.z = this._normalZ; + return v; + } + getNormalTo(normal) { + var v = normal; + v.x = this._normalX; + v.y = this._normalY; + v.z = this._normalZ; + } + getTangent() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._tangentX; + v1.y = this._tangentY; + v1.z = this._tangentZ; + return v; + } + getTangentTo(tangent) { + var v = tangent; + v.x = this._tangentX; + v.y = this._tangentY; + v.z = this._tangentZ; + } + getBinormal() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._binormalX; + v1.y = this._binormalY; + v1.z = this._binormalZ; + return v; + } + getBinormalTo(binormal) { + var v = binormal; + v.x = this._binormalX; + v.y = this._binormalY; + v.z = this._binormalZ; + } + getPoints() { + return this._points; + } + getNumPoints() { + return this._numPoints; + } +} +oimo.dynamics.constraint.contact.ManifoldPoint = class oimo_dynamics_constraint_contact_ManifoldPoint { + constructor() { + this._localPos1X = 0; + this._localPos1Y = 0; + this._localPos1Z = 0; + this._localPos2X = 0; + this._localPos2Y = 0; + this._localPos2Z = 0; + this._relPos1X = 0; + this._relPos1Y = 0; + this._relPos1Z = 0; + this._relPos2X = 0; + this._relPos2Y = 0; + this._relPos2Z = 0; + this._pos1X = 0; + this._pos1Y = 0; + this._pos1Z = 0; + this._pos2X = 0; + this._pos2Y = 0; + this._pos2Z = 0; + this._depth = 0; + this._impulse = new oimo.dynamics.constraint.contact.ContactImpulse(); + this._warmStarted = false; + this._disabled = false; + this._id = -1; + } + getPosition1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._pos1X; + v1.y = this._pos1Y; + v1.z = this._pos1Z; + return v; + } + getPosition1To(position) { + var v = position; + v.x = this._pos1X; + v.y = this._pos1Y; + v.z = this._pos1Z; + } + getPosition2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._pos2X; + v1.y = this._pos2Y; + v1.z = this._pos2Z; + return v; + } + getPosition2To(position) { + var v = position; + v.x = this._pos2X; + v.y = this._pos2Y; + v.z = this._pos2Z; + } + getDepth() { + return this._depth; + } + isWarmStarted() { + return this._warmStarted; + } + getNormalImpulse() { + return this._impulse.impulseN; + } + getTangentImpulse() { + return this._impulse.impulseT; + } + getBinormalImpulse() { + return this._impulse.impulseB; + } + isEnabled() { + return !this._disabled; + } +} +oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constraint_contact_ManifoldUpdater { + constructor(manifold) { + this._manifold = manifold; + this.numOldPoints = 0; + var this1 = new Array(oimo.common.Setting.maxManifoldPoints); + this.oldPoints = this1; + var _g = 0; + var _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) { + var i = _g++; + this.oldPoints[i] = new oimo.dynamics.constraint.contact.ManifoldPoint(); + } + } + removeOutdatedPoints() { + var num = this._manifold._numPoints; + var index = num; + while(--index >= 0) { + var p = this._manifold._points[index]; + var diff; + var diffX; + var diffY; + var diffZ; + diffX = p._pos1X - p._pos2X; + diffY = p._pos1Y - p._pos2Y; + diffZ = p._pos1Z - p._pos2Z; + var dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; + if(dotN > oimo.common.Setting.contactPersistenceThreshold) { + this.removeManifoldPoint(index); + continue; + } + diffX += this._manifold._normalX * -dotN; + diffY += this._manifold._normalY * -dotN; + diffZ += this._manifold._normalZ * -dotN; + if(diffX * diffX + diffY * diffY + diffZ * diffZ > oimo.common.Setting.contactPersistenceThreshold * oimo.common.Setting.contactPersistenceThreshold) { + this.removeManifoldPoint(index); + continue; + } + } + } + removeManifoldPoint(index) { + var lastIndex = --this._manifold._numPoints; + if(index != lastIndex) { + var tmp = this._manifold._points[index]; + this._manifold._points[index] = this._manifold._points[lastIndex]; + this._manifold._points[lastIndex] = tmp; + } + var _this = this._manifold._points[lastIndex]; + _this._localPos1X = 0; + _this._localPos1Y = 0; + _this._localPos1Z = 0; + _this._localPos2X = 0; + _this._localPos2Y = 0; + _this._localPos2Z = 0; + _this._relPos1X = 0; + _this._relPos1Y = 0; + _this._relPos1Z = 0; + _this._relPos2X = 0; + _this._relPos2Y = 0; + _this._relPos2Z = 0; + _this._pos1X = 0; + _this._pos1Y = 0; + _this._pos1Z = 0; + _this._pos2X = 0; + _this._pos2Y = 0; + _this._pos2Z = 0; + _this._depth = 0; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._warmStarted = false; + _this._disabled = false; + _this._id = -1; + } + addManifoldPoint(point,tf1,tf2) { + var num = this._manifold._numPoints; + if(num == oimo.common.Setting.maxManifoldPoints) { + var targetIndex = this.computeTargetIndex(point,tf1,tf2); + var _this = this._manifold._points[targetIndex]; + var v = point.position1; + _this._pos1X = v.x; + _this._pos1Y = v.y; + _this._pos1Z = v.z; + var v1 = point.position2; + _this._pos2X = v1.x; + _this._pos2Y = v1.y; + _this._pos2Z = v1.z; + _this._relPos1X = _this._pos1X - tf1._positionX; + _this._relPos1Y = _this._pos1Y - tf1._positionY; + _this._relPos1Z = _this._pos1Z - tf1._positionZ; + _this._relPos2X = _this._pos2X - tf2._positionX; + _this._relPos2Y = _this._pos2Y - tf2._positionY; + _this._relPos2Z = _this._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; + __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; + __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; + _this._localPos1X = __tmp__X; + _this._localPos1Y = __tmp__Y; + _this._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X1; + _this._localPos2Y = __tmp__Y1; + _this._localPos2Z = __tmp__Z1; + _this._depth = point.depth; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._id = point.id; + _this._warmStarted = false; + _this._disabled = false; + return; + } + var _this2 = this._manifold._points[num]; + var v2 = point.position1; + _this2._pos1X = v2.x; + _this2._pos1Y = v2.y; + _this2._pos1Z = v2.z; + var v3 = point.position2; + _this2._pos2X = v3.x; + _this2._pos2Y = v3.y; + _this2._pos2Z = v3.z; + _this2._relPos1X = _this2._pos1X - tf1._positionX; + _this2._relPos1Y = _this2._pos1Y - tf1._positionY; + _this2._relPos1Z = _this2._pos1Z - tf1._positionZ; + _this2._relPos2X = _this2._pos2X - tf2._positionX; + _this2._relPos2Y = _this2._pos2Y - tf2._positionY; + _this2._relPos2Z = _this2._pos2Z - tf2._positionZ; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * _this2._relPos1X + tf1._rotation10 * _this2._relPos1Y + tf1._rotation20 * _this2._relPos1Z; + __tmp__Y2 = tf1._rotation01 * _this2._relPos1X + tf1._rotation11 * _this2._relPos1Y + tf1._rotation21 * _this2._relPos1Z; + __tmp__Z2 = tf1._rotation02 * _this2._relPos1X + tf1._rotation12 * _this2._relPos1Y + tf1._rotation22 * _this2._relPos1Z; + _this2._localPos1X = __tmp__X2; + _this2._localPos1Y = __tmp__Y2; + _this2._localPos1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf2._rotation00 * _this2._relPos2X + tf2._rotation10 * _this2._relPos2Y + tf2._rotation20 * _this2._relPos2Z; + __tmp__Y3 = tf2._rotation01 * _this2._relPos2X + tf2._rotation11 * _this2._relPos2Y + tf2._rotation21 * _this2._relPos2Z; + __tmp__Z3 = tf2._rotation02 * _this2._relPos2X + tf2._rotation12 * _this2._relPos2Y + tf2._rotation22 * _this2._relPos2Z; + _this2._localPos2X = __tmp__X3; + _this2._localPos2Y = __tmp__Y3; + _this2._localPos2Z = __tmp__Z3; + _this2._depth = point.depth; + var _this3 = _this2._impulse; + _this3.impulseN = 0; + _this3.impulseT = 0; + _this3.impulseB = 0; + _this3.impulseP = 0; + _this3.impulseLX = 0; + _this3.impulseLY = 0; + _this3.impulseLZ = 0; + _this2._id = point.id; + _this2._warmStarted = false; + _this2._disabled = false; + this._manifold._numPoints++; + } + computeTargetIndex(newPoint,tf1,tf2) { + var p1 = this._manifold._points[0]; + var p2 = this._manifold._points[1]; + var p3 = this._manifold._points[2]; + var p4 = this._manifold._points[3]; + var maxDepth = p1._depth; + var maxDepthIndex = 0; + if(p2._depth > maxDepth) { + maxDepth = p2._depth; + maxDepthIndex = 1; + } + if(p3._depth > maxDepth) { + maxDepth = p3._depth; + maxDepthIndex = 2; + } + if(p4._depth > maxDepth) { + maxDepth = p4._depth; + maxDepthIndex = 3; + } + var rp1; + var rp1X; + var rp1Y; + var rp1Z; + var v = newPoint.position1; + rp1X = v.x; + rp1Y = v.y; + rp1Z = v.z; + rp1X -= tf1._positionX; + rp1Y -= tf1._positionY; + rp1Z -= tf1._positionZ; + var p1X = p2._relPos1X; + var p1Y = p2._relPos1Y; + var p1Z = p2._relPos1Z; + var p2X = p3._relPos1X; + var p2Y = p3._relPos1Y; + var p2Z = p3._relPos1Z; + var p3X = p4._relPos1X; + var p3Y = p4._relPos1Y; + var p3Z = p4._relPos1Z; + var v12; + var v12X; + var v12Y; + var v12Z; + var v34; + var v34X; + var v34Y; + var v34Z; + var v13; + var v13X; + var v13Y; + var v13Z; + var v24; + var v24X; + var v24Y; + var v24Z; + var v14; + var v14X; + var v14Y; + var v14Z; + var v23; + var v23X; + var v23Y; + var v23Z; + v12X = p2X - p1X; + v12Y = p2Y - p1Y; + v12Z = p2Z - p1Z; + v34X = rp1X - p3X; + v34Y = rp1Y - p3Y; + v34Z = rp1Z - p3Z; + v13X = p3X - p1X; + v13Y = p3Y - p1Y; + v13Z = p3Z - p1Z; + v24X = rp1X - p2X; + v24Y = rp1Y - p2Y; + v24Z = rp1Z - p2Z; + v14X = rp1X - p1X; + v14Y = rp1Y - p1Y; + v14Z = rp1Z - p1Z; + v23X = p3X - p2X; + v23Y = p3Y - p2Y; + v23Z = p3Z - p2Z; + var cross1; + var cross1X; + var cross1Y; + var cross1Z; + var cross2; + var cross2X; + var cross2Y; + var cross2Z; + var cross3; + var cross3X; + var cross3Y; + var cross3Z; + cross1X = v12Y * v34Z - v12Z * v34Y; + cross1Y = v12Z * v34X - v12X * v34Z; + cross1Z = v12X * v34Y - v12Y * v34X; + cross2X = v13Y * v24Z - v13Z * v24Y; + cross2Y = v13Z * v24X - v13X * v24Z; + cross2Z = v13X * v24Y - v13Y * v24X; + cross3X = v14Y * v23Z - v14Z * v23Y; + cross3Y = v14Z * v23X - v14X * v23Z; + cross3Z = v14X * v23Y - v14Y * v23X; + var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + var a11 = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; + var p1X1 = p1._relPos1X; + var p1Y1 = p1._relPos1Y; + var p1Z1 = p1._relPos1Z; + var p2X1 = p3._relPos1X; + var p2Y1 = p3._relPos1Y; + var p2Z1 = p3._relPos1Z; + var p3X1 = p4._relPos1X; + var p3Y1 = p4._relPos1Y; + var p3Z1 = p4._relPos1Z; + var v121; + var v12X1; + var v12Y1; + var v12Z1; + var v341; + var v34X1; + var v34Y1; + var v34Z1; + var v131; + var v13X1; + var v13Y1; + var v13Z1; + var v241; + var v24X1; + var v24Y1; + var v24Z1; + var v141; + var v14X1; + var v14Y1; + var v14Z1; + var v231; + var v23X1; + var v23Y1; + var v23Z1; + v12X1 = p2X1 - p1X1; + v12Y1 = p2Y1 - p1Y1; + v12Z1 = p2Z1 - p1Z1; + v34X1 = rp1X - p3X1; + v34Y1 = rp1Y - p3Y1; + v34Z1 = rp1Z - p3Z1; + v13X1 = p3X1 - p1X1; + v13Y1 = p3Y1 - p1Y1; + v13Z1 = p3Z1 - p1Z1; + v24X1 = rp1X - p2X1; + v24Y1 = rp1Y - p2Y1; + v24Z1 = rp1Z - p2Z1; + v14X1 = rp1X - p1X1; + v14Y1 = rp1Y - p1Y1; + v14Z1 = rp1Z - p1Z1; + v23X1 = p3X1 - p2X1; + v23Y1 = p3Y1 - p2Y1; + v23Z1 = p3Z1 - p2Z1; + var cross11; + var cross1X1; + var cross1Y1; + var cross1Z1; + var cross21; + var cross2X1; + var cross2Y1; + var cross2Z1; + var cross31; + var cross3X1; + var cross3Y1; + var cross3Z1; + cross1X1 = v12Y1 * v34Z1 - v12Z1 * v34Y1; + cross1Y1 = v12Z1 * v34X1 - v12X1 * v34Z1; + cross1Z1 = v12X1 * v34Y1 - v12Y1 * v34X1; + cross2X1 = v13Y1 * v24Z1 - v13Z1 * v24Y1; + cross2Y1 = v13Z1 * v24X1 - v13X1 * v24Z1; + cross2Z1 = v13X1 * v24Y1 - v13Y1 * v24X1; + cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; + cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; + cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; + var a12 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; + var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; + var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; + var a22 = a12 > a21 ? a12 > a31 ? a12 : a31 : a21 > a31 ? a21 : a31; + var p1X2 = p1._relPos1X; + var p1Y2 = p1._relPos1Y; + var p1Z2 = p1._relPos1Z; + var p2X2 = p2._relPos1X; + var p2Y2 = p2._relPos1Y; + var p2Z2 = p2._relPos1Z; + var p3X2 = p4._relPos1X; + var p3Y2 = p4._relPos1Y; + var p3Z2 = p4._relPos1Z; + var v122; + var v12X2; + var v12Y2; + var v12Z2; + var v342; + var v34X2; + var v34Y2; + var v34Z2; + var v132; + var v13X2; + var v13Y2; + var v13Z2; + var v242; + var v24X2; + var v24Y2; + var v24Z2; + var v142; + var v14X2; + var v14Y2; + var v14Z2; + var v232; + var v23X2; + var v23Y2; + var v23Z2; + v12X2 = p2X2 - p1X2; + v12Y2 = p2Y2 - p1Y2; + v12Z2 = p2Z2 - p1Z2; + v34X2 = rp1X - p3X2; + v34Y2 = rp1Y - p3Y2; + v34Z2 = rp1Z - p3Z2; + v13X2 = p3X2 - p1X2; + v13Y2 = p3Y2 - p1Y2; + v13Z2 = p3Z2 - p1Z2; + v24X2 = rp1X - p2X2; + v24Y2 = rp1Y - p2Y2; + v24Z2 = rp1Z - p2Z2; + v14X2 = rp1X - p1X2; + v14Y2 = rp1Y - p1Y2; + v14Z2 = rp1Z - p1Z2; + v23X2 = p3X2 - p2X2; + v23Y2 = p3Y2 - p2Y2; + v23Z2 = p3Z2 - p2Z2; + var cross12; + var cross1X2; + var cross1Y2; + var cross1Z2; + var cross22; + var cross2X2; + var cross2Y2; + var cross2Z2; + var cross32; + var cross3X2; + var cross3Y2; + var cross3Z2; + cross1X2 = v12Y2 * v34Z2 - v12Z2 * v34Y2; + cross1Y2 = v12Z2 * v34X2 - v12X2 * v34Z2; + cross1Z2 = v12X2 * v34Y2 - v12Y2 * v34X2; + cross2X2 = v13Y2 * v24Z2 - v13Z2 * v24Y2; + cross2Y2 = v13Z2 * v24X2 - v13X2 * v24Z2; + cross2Z2 = v13X2 * v24Y2 - v13Y2 * v24X2; + cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; + cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; + cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; + var a13 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; + var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; + var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; + var a33 = a13 > a23 ? a13 > a32 ? a13 : a32 : a23 > a32 ? a23 : a32; + var p1X3 = p1._relPos1X; + var p1Y3 = p1._relPos1Y; + var p1Z3 = p1._relPos1Z; + var p2X3 = p2._relPos1X; + var p2Y3 = p2._relPos1Y; + var p2Z3 = p2._relPos1Z; + var p3X3 = p3._relPos1X; + var p3Y3 = p3._relPos1Y; + var p3Z3 = p3._relPos1Z; + var v123; + var v12X3; + var v12Y3; + var v12Z3; + var v343; + var v34X3; + var v34Y3; + var v34Z3; + var v133; + var v13X3; + var v13Y3; + var v13Z3; + var v243; + var v24X3; + var v24Y3; + var v24Z3; + var v143; + var v14X3; + var v14Y3; + var v14Z3; + var v233; + var v23X3; + var v23Y3; + var v23Z3; + v12X3 = p2X3 - p1X3; + v12Y3 = p2Y3 - p1Y3; + v12Z3 = p2Z3 - p1Z3; + v34X3 = rp1X - p3X3; + v34Y3 = rp1Y - p3Y3; + v34Z3 = rp1Z - p3Z3; + v13X3 = p3X3 - p1X3; + v13Y3 = p3Y3 - p1Y3; + v13Z3 = p3Z3 - p1Z3; + v24X3 = rp1X - p2X3; + v24Y3 = rp1Y - p2Y3; + v24Z3 = rp1Z - p2Z3; + v14X3 = rp1X - p1X3; + v14Y3 = rp1Y - p1Y3; + v14Z3 = rp1Z - p1Z3; + v23X3 = p3X3 - p2X3; + v23Y3 = p3Y3 - p2Y3; + v23Z3 = p3Z3 - p2Z3; + var cross13; + var cross1X3; + var cross1Y3; + var cross1Z3; + var cross23; + var cross2X3; + var cross2Y3; + var cross2Z3; + var cross33; + var cross3X3; + var cross3Y3; + var cross3Z3; + cross1X3 = v12Y3 * v34Z3 - v12Z3 * v34Y3; + cross1Y3 = v12Z3 * v34X3 - v12X3 * v34Z3; + cross1Z3 = v12X3 * v34Y3 - v12Y3 * v34X3; + cross2X3 = v13Y3 * v24Z3 - v13Z3 * v24Y3; + cross2Y3 = v13Z3 * v24X3 - v13X3 * v24Z3; + cross2Z3 = v13X3 * v24Y3 - v13Y3 * v24X3; + cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; + cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; + cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; + var a14 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; + var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; + var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; + var a4 = a14 > a24 ? a14 > a34 ? a14 : a34 : a24 > a34 ? a24 : a34; + var max = a11; + var target = 0; + if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { + max = a22; + target = 1; + } + if(a33 > max && maxDepthIndex != 2) { + max = a33; + target = 2; + } + if(a4 > max && maxDepthIndex != 3) { + max = a4; + target = 3; + } + return target; + } + computeRelativePositions(tf1,tf2) { + var num = this._manifold._numPoints; + var _g = 0; + var _g1 = num; + while(_g < _g1) { + var i = _g++; + var p = this._manifold._points[i]; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; + __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; + __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; + p._relPos1X = __tmp__X; + p._relPos1Y = __tmp__Y; + p._relPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; + __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; + __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; + p._relPos2X = __tmp__X1; + p._relPos2Y = __tmp__Y1; + p._relPos2Z = __tmp__Z1; + p._warmStarted = true; + } + } + findNearestContactPointIndex(target,tf1,tf2) { + var nearestSq = oimo.common.Setting.contactPersistenceThreshold * oimo.common.Setting.contactPersistenceThreshold; + var idx = -1; + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) { + var i = _g++; + var mp = this._manifold._points[i]; + var rp1; + var rp1X; + var rp1Y; + var rp1Z; + var rp2; + var rp2X; + var rp2Y; + var rp2Z; + var v = target.position1; + rp1X = v.x; + rp1Y = v.y; + rp1Z = v.z; + var v1 = target.position2; + rp2X = v1.x; + rp2Y = v1.y; + rp2Z = v1.z; + rp1X -= tf1._positionX; + rp1Y -= tf1._positionY; + rp1Z -= tf1._positionZ; + rp2X -= tf2._positionX; + rp2Y -= tf2._positionY; + rp2Z -= tf2._positionZ; + var diff1; + var diff1X; + var diff1Y; + var diff1Z; + var diff2; + var diff2X; + var diff2Y; + var diff2Z; + diff1X = mp._relPos1X - rp1X; + diff1Y = mp._relPos1Y - rp1Y; + diff1Z = mp._relPos1Z - rp1Z; + diff2X = mp._relPos2X - rp2X; + diff2Y = mp._relPos2Y - rp2Y; + diff2Z = mp._relPos2Z - rp2Z; + var sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; + var sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; + var d = sq1 < sq2 ? sq1 : sq2; + if(d < nearestSq) { + nearestSq = d; + idx = i; + } + } + return idx; + } + totalUpdate(result,tf1,tf2) { + this.numOldPoints = this._manifold._numPoints; + var _g = 0; + var _g1 = this.numOldPoints; + while(_g < _g1) { + var i = _g++; + var _this = this.oldPoints[i]; + var cp = this._manifold._points[i]; + _this._localPos1X = cp._localPos1X; + _this._localPos1Y = cp._localPos1Y; + _this._localPos1Z = cp._localPos1Z; + _this._localPos2X = cp._localPos2X; + _this._localPos2Y = cp._localPos2Y; + _this._localPos2Z = cp._localPos2Z; + _this._relPos1X = cp._relPos1X; + _this._relPos1Y = cp._relPos1Y; + _this._relPos1Z = cp._relPos1Z; + _this._relPos2X = cp._relPos2X; + _this._relPos2Y = cp._relPos2Y; + _this._relPos2Z = cp._relPos2Z; + _this._pos1X = cp._pos1X; + _this._pos1Y = cp._pos1Y; + _this._pos1Z = cp._pos1Z; + _this._pos2X = cp._pos2X; + _this._pos2Y = cp._pos2Y; + _this._pos2Z = cp._pos2Z; + _this._depth = cp._depth; + _this._impulse.copyFrom(cp._impulse); + _this._id = cp._id; + _this._warmStarted = cp._warmStarted; + _this._disabled = false; + } + var num = result.numPoints; + this._manifold._numPoints = num; + var _g2 = 0; + var _g11 = num; + while(_g2 < _g11) { + var i1 = _g2++; + var p = this._manifold._points[i1]; + var ref = result.points[i1]; + var v = ref.position1; + p._pos1X = v.x; + p._pos1Y = v.y; + p._pos1Z = v.z; + var v1 = ref.position2; + p._pos2X = v1.x; + p._pos2Y = v1.y; + p._pos2Z = v1.z; + p._relPos1X = p._pos1X - tf1._positionX; + p._relPos1Y = p._pos1Y - tf1._positionY; + p._relPos1Z = p._pos1Z - tf1._positionZ; + p._relPos2X = p._pos2X - tf2._positionX; + p._relPos2Y = p._pos2Y - tf2._positionY; + p._relPos2Z = p._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * p._relPos1X + tf1._rotation10 * p._relPos1Y + tf1._rotation20 * p._relPos1Z; + __tmp__Y = tf1._rotation01 * p._relPos1X + tf1._rotation11 * p._relPos1Y + tf1._rotation21 * p._relPos1Z; + __tmp__Z = tf1._rotation02 * p._relPos1X + tf1._rotation12 * p._relPos1Y + tf1._rotation22 * p._relPos1Z; + p._localPos1X = __tmp__X; + p._localPos1Y = __tmp__Y; + p._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * p._relPos2X + tf2._rotation10 * p._relPos2Y + tf2._rotation20 * p._relPos2Z; + __tmp__Y1 = tf2._rotation01 * p._relPos2X + tf2._rotation11 * p._relPos2Y + tf2._rotation21 * p._relPos2Z; + __tmp__Z1 = tf2._rotation02 * p._relPos2X + tf2._rotation12 * p._relPos2Y + tf2._rotation22 * p._relPos2Z; + p._localPos2X = __tmp__X1; + p._localPos2Y = __tmp__Y1; + p._localPos2Z = __tmp__Z1; + p._depth = ref.depth; + var _this1 = p._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + p._id = ref.id; + p._warmStarted = false; + p._disabled = false; + var _g3 = 0; + var _g12 = this.numOldPoints; + while(_g3 < _g12) { + var i2 = _g3++; + var ocp = this.oldPoints[i2]; + if(p._id == ocp._id) { + p._impulse.copyFrom(ocp._impulse); + p._warmStarted = true; + break; + } + } + } + } + incrementalUpdate(result,tf1,tf2) { + this._manifold._updateDepthsAndPositions(tf1,tf2); + var _g = 0; + var _g1 = this._manifold._numPoints; + while(_g < _g1) { + var i = _g++; + this._manifold._points[i]._warmStarted = true; + } + var newPoint = result.points[0]; + var index = this.findNearestContactPointIndex(newPoint,tf1,tf2); + if(index == -1) { + this.addManifoldPoint(newPoint,tf1,tf2); + } else { + var cp = this._manifold._points[index]; + var v = newPoint.position1; + cp._pos1X = v.x; + cp._pos1Y = v.y; + cp._pos1Z = v.z; + var v1 = newPoint.position2; + cp._pos2X = v1.x; + cp._pos2Y = v1.y; + cp._pos2Z = v1.z; + cp._relPos1X = cp._pos1X - tf1._positionX; + cp._relPos1Y = cp._pos1Y - tf1._positionY; + cp._relPos1Z = cp._pos1Z - tf1._positionZ; + cp._relPos2X = cp._pos2X - tf2._positionX; + cp._relPos2Y = cp._pos2Y - tf2._positionY; + cp._relPos2Z = cp._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * cp._relPos1X + tf1._rotation10 * cp._relPos1Y + tf1._rotation20 * cp._relPos1Z; + __tmp__Y = tf1._rotation01 * cp._relPos1X + tf1._rotation11 * cp._relPos1Y + tf1._rotation21 * cp._relPos1Z; + __tmp__Z = tf1._rotation02 * cp._relPos1X + tf1._rotation12 * cp._relPos1Y + tf1._rotation22 * cp._relPos1Z; + cp._localPos1X = __tmp__X; + cp._localPos1Y = __tmp__Y; + cp._localPos1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; + __tmp__Y1 = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; + __tmp__Z1 = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; + cp._localPos2X = __tmp__X1; + cp._localPos2Y = __tmp__Y1; + cp._localPos2Z = __tmp__Z1; + cp._depth = newPoint.depth; + } + this.removeOutdatedPoints(); + } +} +if(!oimo.dynamics.constraint.info) oimo.dynamics.constraint.info = {}; +oimo.dynamics.constraint.info.JacobianRow = class oimo_dynamics_constraint_info_JacobianRow { + constructor() { + this.lin1X = 0; + this.lin1Y = 0; + this.lin1Z = 0; + this.lin2X = 0; + this.lin2Y = 0; + this.lin2Z = 0; + this.ang1X = 0; + this.ang1Y = 0; + this.ang1Z = 0; + this.ang2X = 0; + this.ang2Y = 0; + this.ang2Z = 0; + this.flag = 0; + } + updateSparsity() { + this.flag = 0; + if(!(this.lin1X == 0 && this.lin1Y == 0 && this.lin1Z == 0) || !(this.lin2X == 0 && this.lin2Y == 0 && this.lin2Z == 0)) { + this.flag |= 1; + } + if(!(this.ang1X == 0 && this.ang1Y == 0 && this.ang1Z == 0) || !(this.ang2X == 0 && this.ang2Y == 0 && this.ang2Z == 0)) { + this.flag |= 2; + } + } +} +if(!oimo.dynamics.constraint.info.contact) oimo.dynamics.constraint.info.contact = {}; +oimo.dynamics.constraint.info.contact.ContactSolverInfo = class oimo_dynamics_constraint_info_contact_ContactSolverInfo { + constructor() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + var this1 = new Array(oimo.common.Setting.maxManifoldPoints); + this.rows = this1; + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) { + var i = _g++; + this.rows[i] = new oimo.dynamics.constraint.info.contact.ContactSolverInfoRow(); + } + } +} +oimo.dynamics.constraint.info.contact.ContactSolverInfoRow = class oimo_dynamics_constraint_info_contact_ContactSolverInfoRow { + constructor() { + this.jacobianN = new oimo.dynamics.constraint.info.JacobianRow(); + this.jacobianT = new oimo.dynamics.constraint.info.JacobianRow(); + this.jacobianB = new oimo.dynamics.constraint.info.JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.friction = 0; + this.impulse = null; + } +} +if(!oimo.dynamics.constraint.info.joint) oimo.dynamics.constraint.info.joint = {}; +oimo.dynamics.constraint.info.joint.JointSolverInfo = class oimo_dynamics_constraint_info_joint_JointSolverInfo { + constructor() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + var this1 = new Array(oimo.common.Setting.maxJacobianRows); + this.rows = this1; + var _g = 0; + var _g1 = this.rows.length; + while(_g < _g1) { + var i = _g++; + this.rows[i] = new oimo.dynamics.constraint.info.joint.JointSolverInfoRow(); + } + } +} +oimo.dynamics.constraint.info.joint.JointSolverInfoRow = class oimo_dynamics_constraint_info_joint_JointSolverInfoRow { + constructor() { + this.jacobian = new oimo.dynamics.constraint.info.JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.minImpulse = 0; + this.maxImpulse = 0; + this.motorSpeed = 0; + this.motorMaxImpulse = 0; + this.impulse = null; + } +} +if(!oimo.dynamics.constraint.joint) oimo.dynamics.constraint.joint = {}; +oimo.dynamics.constraint.joint.BasisTracker = class oimo_dynamics_constraint_joint_BasisTracker { + constructor(joint) { + this.joint = joint; + this.xX = 0; + this.xY = 0; + this.xZ = 0; + this.yX = 0; + this.yY = 0; + this.yZ = 0; + this.zX = 0; + this.zY = 0; + this.zZ = 0; + } +} +oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Joint { + constructor(config,type) { + this._link1 = new oimo.dynamics.constraint.joint.JointLink(this); + this._link2 = new oimo.dynamics.constraint.joint.JointLink(this); + this._positionCorrectionAlgorithm = oimo.common.Setting.defaultJointPositionCorrectionAlgorithm; + this._type = type; + this._world = null; + this._b1 = config.rigidBody1; + this._b2 = config.rigidBody2; + this._allowCollision = config.allowCollision; + this._breakForce = config.breakForce; + this._breakTorque = config.breakTorque; + switch(config.solverType) { + case 0: + this._solver = new oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver(this); + break; + case 1: + this._solver = new oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver(this); + break; + } + var v = config.localAnchor1; + this._localAnchor1X = v.x; + this._localAnchor1Y = v.y; + this._localAnchor1Z = v.z; + var v1 = config.localAnchor2; + this._localAnchor2X = v1.x; + this._localAnchor2Y = v1.y; + this._localAnchor2Z = v1.z; + this._relativeAnchor1X = 0; + this._relativeAnchor1Y = 0; + this._relativeAnchor1Z = 0; + this._relativeAnchor2X = 0; + this._relativeAnchor2Y = 0; + this._relativeAnchor2Z = 0; + this._anchor1X = 0; + this._anchor1Y = 0; + this._anchor1Z = 0; + this._anchor2X = 0; + this._anchor2Y = 0; + this._anchor2Z = 0; + this._localBasisX1X = 0; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + this._localBasisY1X = 0; + this._localBasisY1Y = 0; + this._localBasisY1Z = 0; + this._localBasisZ1X = 0; + this._localBasisZ1Y = 0; + this._localBasisZ1Z = 0; + this._localBasisX2X = 0; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + this._localBasisY2X = 0; + this._localBasisY2Y = 0; + this._localBasisY2Z = 0; + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 0; + var this1 = new Array(oimo.common.Setting.maxJacobianRows); + this._impulses = this1; + var _g1 = 0; + var _g2 = oimo.common.Setting.maxJacobianRows; + while(_g1 < _g2) { + var i = _g1++; + this._impulses[i] = new oimo.dynamics.constraint.joint.JointImpulse(); + } + } + buildLocalBasesFromX() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + var slerpQ; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d2; + if(x22 < y22) { + if(x22 < z22) { + d2 = 1 / Math.sqrt(y22 + z22); + this._localBasisY1X = 0; + this._localBasisY1Y = z11 * d2; + this._localBasisY1Z = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + } else if(y22 < z22) { + d2 = 1 / Math.sqrt(z22 + x22); + this._localBasisY1X = -z11 * d2; + this._localBasisY1Y = 0; + this._localBasisY1Z = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x22 + y22); + this._localBasisY1X = y11 * d2; + this._localBasisY1Y = -x11 * d2; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + buildLocalBasesFromXY() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z == 0) { + this._localBasisX2X = 1; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + } else { + var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisX2X *= l1; + this._localBasisX2Y *= l1; + this._localBasisX2Z *= l1; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._localBasisZ1X *= l2; + this._localBasisZ1Y *= l2; + this._localBasisZ1Z *= l2; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + var x11 = this._localBasisX2X; + var y11 = this._localBasisX2Y; + var z11 = this._localBasisX2Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d1; + if(x21 < y21) { + if(x21 < z21) { + d1 = 1 / Math.sqrt(y21 + z21); + this._localBasisY2X = 0; + this._localBasisY2Y = z11 * d1; + this._localBasisY2Z = -y11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + } else if(y21 < z21) { + d1 = 1 / Math.sqrt(z21 + x21); + this._localBasisY2X = -z11 * d1; + this._localBasisY2Y = 0; + this._localBasisY2Z = x11 * d1; + } else { + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY2X = y11 * d1; + this._localBasisY2Y = -x11 * d1; + this._localBasisY2Z = 0; + } + this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; + this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; + this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; + } else { + var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + this._localBasisZ2X *= l3; + this._localBasisZ2Y *= l3; + this._localBasisZ2Z *= l3; + this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; + this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; + this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; + } + } + buildLocalBasesFromX1Z2() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 1; + } else { + var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ2X *= l1; + this._localBasisZ2Y *= l1; + this._localBasisZ2Z *= l1; + } + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var worldX1; + var worldX1X; + var worldX1Y; + var worldX1Z; + var worldZ1; + var worldZ1X; + var worldZ1Y; + var worldZ1Z; + var worldY; + var worldYX; + var worldYY; + var worldYZ; + var worldX2; + var worldX2X; + var worldX2Y; + var worldX2Z; + var worldZ2; + var worldZ2X; + var worldZ2Y; + var worldZ2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + worldX1X = __tmp__X; + worldX1Y = __tmp__Y; + worldX1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + worldZ2X = __tmp__X1; + worldZ2Y = __tmp__Y1; + worldZ2Z = __tmp__Z1; + worldYX = worldZ2Y * worldX1Z - worldZ2Z * worldX1Y; + worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; + worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; + if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { + var x1 = worldX1X; + var y1 = worldX1Y; + var z1 = worldX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + worldYX = 0; + worldYY = z1 * d; + worldYZ = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + worldYX = -z1 * d; + worldYY = 0; + worldYZ = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + worldYX = y1 * d; + worldYY = -x1 * d; + worldYZ = 0; + } + } + worldZ1X = worldX1Y * worldYZ - worldX1Z * worldYY; + worldZ1Y = worldX1Z * worldYX - worldX1X * worldYZ; + worldZ1Z = worldX1X * worldYY - worldX1Y * worldYX; + worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; + worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; + worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; + __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; + __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; + this._localBasisX1X = __tmp__X2; + this._localBasisX1Y = __tmp__Y2; + this._localBasisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; + __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; + __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; + this._localBasisY1X = __tmp__X3; + this._localBasisY1Y = __tmp__Y3; + this._localBasisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; + __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; + __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; + this._localBasisZ1X = __tmp__X4; + this._localBasisZ1Y = __tmp__Y4; + this._localBasisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; + __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; + __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; + this._localBasisX2X = __tmp__X5; + this._localBasisX2Y = __tmp__Y5; + this._localBasisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; + __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; + __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; + this._localBasisY2X = __tmp__X6; + this._localBasisY2Y = __tmp__Y6; + this._localBasisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; + __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; + __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; + this._localBasisZ2X = __tmp__X7; + this._localBasisZ2Y = __tmp__Y7; + this._localBasisZ2Z = __tmp__Z7; + } + buildLocalBasesFromXY1X2() { + if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { + this._localBasisX1X = 1; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + } else { + var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX1X *= l; + this._localBasisX1Y *= l; + this._localBasisX1Z *= l; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + this._localBasisY1X = 0; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; + this._localBasisY1Y = 0; + this._localBasisY1Z = x1 * d; + } else { + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; + this._localBasisY1Z = 0; + } + this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; + this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; + this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; + } else { + var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._localBasisZ1X *= l1; + this._localBasisZ1Y *= l1; + this._localBasisZ1Z *= l1; + this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; + this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; + this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; + } + var slerpQ; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d1 < -0.999999999) { + var vX; + var vY; + var vZ; + var x11 = this._localBasisX1X; + var y11 = this._localBasisX1Y; + var z11 = this._localBasisX1Z; + var x21 = x11 * x11; + var y21 = y11 * y11; + var z21 = z11 * z11; + var d2; + if(x21 < y21) { + if(x21 < z21) { + d2 = 1 / Math.sqrt(y21 + z21); + vX = 0; + vY = z11 * d2; + vZ = -y11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + } else if(y21 < z21) { + d2 = 1 / Math.sqrt(z21 + x21); + vX = -z11 * d2; + vY = 0; + vZ = x11 * d2; + } else { + d2 = 1 / Math.sqrt(x21 + y21); + vX = y11 * d2; + vY = -x11 * d2; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; + slerpQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; + cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; + cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; + var w = Math.sqrt((1 + d1) * 0.5); + d1 = 0.5 / w; + cX *= d1; + cY *= d1; + cZ *= d1; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x22 = 2 * x; + var y22 = 2 * y; + var z22 = 2 * z; + var xx = x * x22; + var yy = y * y22; + var zz = z * z22; + var xy = x * y22; + var yz = y * z22; + var xz = x * z22; + var wx = w1 * x22; + var wy = w1 * y22; + var wz = w1 * z22; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; + __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; + __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X1; + this._localBasisY2Y = __tmp__Y1; + this._localBasisY2Z = __tmp__Z1; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X2; + this._localBasisZ2Y = __tmp__Y2; + this._localBasisZ2Z = __tmp__Z2; + } + setSolverInfoRowLinear(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo.common.Setting.linearSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { + zeta = oimo.common.Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorForce > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorForce * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + var invMass = mass == 0 ? 0 : 1 / mass; + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * invMass; + row.rhs = error * erp; + } + setSolverInfoRowAngular(row,diff,lm,mass,sd,timeStep,isPositionPart) { + var cfmFactor; + var erp; + var slop = oimo.common.Setting.angularSlop; + if(isPositionPart) { + cfmFactor = 0; + erp = 1; + } else { + if(sd.frequency > 0) { + slop = 0; + var omega = 6.28318530717958 * sd.frequency; + var zeta = sd.dampingRatio; + if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { + zeta = oimo.common.Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(sd.useSymplecticEuler) { + cfmFactor = 1 / (h * c); + erp = k / c; + } else { + cfmFactor = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + } else { + cfmFactor = 0; + erp = this.getErp(timeStep,false); + } + if(lm.motorTorque > 0) { + row.motorSpeed = lm.motorSpeed; + row.motorMaxImpulse = lm.motorTorque * timeStep.dt; + } else { + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + } + } + var lower = lm.lowerLimit; + var upper = lm.upperLimit; + var mid = (lower + upper) * 0.5; + diff -= mid; + diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; + diff += mid; + var minImp; + var maxImp; + var error; + if(lower > upper) { + minImp = 0; + maxImp = 0; + error = 0; + } else if(lower == upper) { + minImp = -1e65536; + maxImp = 1e65536; + error = diff - lower; + } else if(diff < lower) { + minImp = -1e65536; + maxImp = 0; + error = diff - lower + slop; + if(error > 0) { + error = 0; + } + } else if(diff > upper) { + minImp = 0; + maxImp = 1e65536; + error = diff - upper - slop; + if(error < 0) { + error = 0; + } + } else { + minImp = 0; + maxImp = 0; + error = 0; + } + var invMass = mass == 0 ? 0 : 1 / mass; + row.minImpulse = minImp; + row.maxImpulse = maxImp; + row.cfm = cfmFactor * invMass; + row.rhs = error * erp; + } + getErp(timeStep,isPositionPart) { + if(isPositionPart) { + return 1; + } else if(this._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE) { + return timeStep.invDt * oimo.common.Setting.velocityBaumgarte; + } else { + return 0; + } + } + computeEffectiveInertiaMoment(axisX,axisY,axisZ) { + var ia1; + var ia1X; + var ia1Y; + var ia1Z; + var ia2; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; + __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; + __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; + __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; + __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; + var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; + if(invI1 > 0) { + var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; + var projsq = rsq - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + var projsq1 = rsq1 - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + computeEffectiveInertiaMoment2(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { + var ia1; + var ia1X; + var ia1Y; + var ia1Z; + var ia2; + var ia2X; + var ia2Y; + var ia2Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b1._invInertia00 * axis1X + this._b1._invInertia01 * axis1Y + this._b1._invInertia02 * axis1Z; + __tmp__Y = this._b1._invInertia10 * axis1X + this._b1._invInertia11 * axis1Y + this._b1._invInertia12 * axis1Z; + __tmp__Z = this._b1._invInertia20 * axis1X + this._b1._invInertia21 * axis1Y + this._b1._invInertia22 * axis1Z; + ia1X = __tmp__X; + ia1Y = __tmp__Y; + ia1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; + __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; + __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; + ia2X = __tmp__X1; + ia2Y = __tmp__Y1; + ia2Z = __tmp__Z1; + var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; + var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; + if(invI1 > 0) { + var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + var dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; + var projsq = rsq * rsq - dot * dot; + if(projsq > 0) { + if(this._b1._invMass > 0) { + invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); + } else { + invI1 = 0; + } + } + } + if(invI2 > 0) { + var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + var projsq1 = rsq1 * rsq1 - dot1 * dot1; + if(projsq1 > 0) { + if(this._b2._invMass > 0) { + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + } else { + invI2 = 0; + } + } + } + if(invI1 + invI2 == 0) { + return 0; + } else { + return 1 / (invI1 + invI2); + } + } + _syncAnchors() { + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; + __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; + __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; + this._relativeAnchor1X = __tmp__X; + this._relativeAnchor1Y = __tmp__Y; + this._relativeAnchor1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; + __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; + __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; + this._relativeAnchor2X = __tmp__X1; + this._relativeAnchor2Y = __tmp__Y1; + this._relativeAnchor2Z = __tmp__Z1; + this._anchor1X = this._relativeAnchor1X + tf1._positionX; + this._anchor1Y = this._relativeAnchor1Y + tf1._positionY; + this._anchor1Z = this._relativeAnchor1Z + tf1._positionZ; + this._anchor2X = this._relativeAnchor2X + tf2._positionX; + this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; + this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + this._basisX1X = __tmp__X2; + this._basisX1Y = __tmp__Y2; + this._basisX1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; + __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; + __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; + this._basisY1X = __tmp__X3; + this._basisY1Y = __tmp__Y3; + this._basisY1Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; + __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; + __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; + this._basisZ1X = __tmp__X4; + this._basisZ1Y = __tmp__Y4; + this._basisZ1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; + __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; + __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; + this._basisX2X = __tmp__X5; + this._basisX2Y = __tmp__Y5; + this._basisX2Z = __tmp__Z5; + var __tmp__X6; + var __tmp__Y6; + var __tmp__Z6; + __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; + __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; + __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; + this._basisY2X = __tmp__X6; + this._basisY2Y = __tmp__Y6; + this._basisY2Z = __tmp__Z6; + var __tmp__X7; + var __tmp__Y7; + var __tmp__Z7; + __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + this._basisZ2X = __tmp__X7; + this._basisZ2Y = __tmp__Y7; + this._basisZ2Z = __tmp__Z7; + } + _getVelocitySolverInfo(timeStep,info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + _getPositionSolverInfo(info) { + info.b1 = this._b1; + info.b2 = this._b2; + info.numRows = 0; + } + _checkDestruction() { + var forceSq = this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ; + var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; + if(this._breakForce > 0 && forceSq > this._breakForce * this._breakForce) { + this._world.removeJoint(this); + return; + } + if(this._breakTorque > 0 && torqueSq > this._breakTorque * this._breakTorque) { + this._world.removeJoint(this); + return; + } + } + getRigidBody1() { + return this._b1; + } + getRigidBody2() { + return this._b2; + } + getType() { + return this._type; + } + getAnchor1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._anchor1X; + v1.y = this._anchor1Y; + v1.z = this._anchor1Z; + return v; + } + getAnchor2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._anchor2X; + v1.y = this._anchor2Y; + v1.z = this._anchor2Z; + return v; + } + getAnchor1To(anchor) { + var v = anchor; + v.x = this._anchor1X; + v.y = this._anchor1Y; + v.z = this._anchor1Z; + } + getAnchor2To(anchor) { + var v = anchor; + v.x = this._anchor2X; + v.y = this._anchor2Y; + v.z = this._anchor2Z; + } + getLocalAnchor1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localAnchor1X; + v1.y = this._localAnchor1Y; + v1.z = this._localAnchor1Z; + return v; + } + getLocalAnchor2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localAnchor2X; + v1.y = this._localAnchor2Y; + v1.z = this._localAnchor2Z; + return v; + } + getLocalAnchor1To(localAnchor) { + var v = localAnchor; + v.x = this._localAnchor1X; + v.y = this._localAnchor1Y; + v.z = this._localAnchor1Z; + } + getLocalAnchor2To(localAnchor) { + var v = localAnchor; + v.x = this._localAnchor2X; + v.y = this._localAnchor2Y; + v.z = this._localAnchor2Z; + } + getBasis1() { + var m = new oimo.common.Mat3(); + var b; + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX1X; + b01 = this._basisY1X; + b02 = this._basisZ1X; + b10 = this._basisX1Y; + b11 = this._basisY1Y; + b12 = this._basisZ1Y; + b20 = this._basisX1Z; + b21 = this._basisY1Z; + b22 = this._basisZ1Z; + var m1 = m; + m1.e00 = b00; + m1.e01 = b01; + m1.e02 = b02; + m1.e10 = b10; + m1.e11 = b11; + m1.e12 = b12; + m1.e20 = b20; + m1.e21 = b21; + m1.e22 = b22; + return m; + } + getBasis2() { + var m = new oimo.common.Mat3(); + var b; + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX2X; + b01 = this._basisY2X; + b02 = this._basisZ2X; + b10 = this._basisX2Y; + b11 = this._basisY2Y; + b12 = this._basisZ2Y; + b20 = this._basisX2Z; + b21 = this._basisY2Z; + b22 = this._basisZ2Z; + var m1 = m; + m1.e00 = b00; + m1.e01 = b01; + m1.e02 = b02; + m1.e10 = b10; + m1.e11 = b11; + m1.e12 = b12; + m1.e20 = b20; + m1.e21 = b21; + m1.e22 = b22; + return m; + } + getBasis1To(basis) { + var b; + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX1X; + b01 = this._basisY1X; + b02 = this._basisZ1X; + b10 = this._basisX1Y; + b11 = this._basisY1Y; + b12 = this._basisZ1Y; + b20 = this._basisX1Z; + b21 = this._basisY1Z; + b22 = this._basisZ1Z; + var m = basis; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; + } + getBasis2To(basis) { + var b; + var b00; + var b01; + var b02; + var b10; + var b11; + var b12; + var b20; + var b21; + var b22; + b00 = this._basisX2X; + b01 = this._basisY2X; + b02 = this._basisZ2X; + b10 = this._basisX2Y; + b11 = this._basisY2Y; + b12 = this._basisZ2Y; + b20 = this._basisX2Z; + b21 = this._basisY2Z; + b22 = this._basisZ2Z; + var m = basis; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; + } + getAllowCollision() { + return this._allowCollision; + } + setAllowCollision(allowCollision) { + this._allowCollision = allowCollision; + } + getBreakForce() { + return this._breakForce; + } + setBreakForce(breakForce) { + this._breakForce = breakForce; + } + getBreakTorque() { + return this._breakTorque; + } + setBreakTorque(breakTorque) { + this._breakTorque = breakTorque; + } + getPositionCorrectionAlgorithm() { + return this._positionCorrectionAlgorithm; + } + setPositionCorrectionAlgorithm(positionCorrectionAlgorithm) { + switch(positionCorrectionAlgorithm) { + case 0:case 1:case 2: + break; + default: + throw new Error("invalid position correction algorithm id: " + positionCorrectionAlgorithm); + } + this._positionCorrectionAlgorithm = positionCorrectionAlgorithm; + } + getAppliedForce() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._appliedForceX; + v1.y = this._appliedForceY; + v1.z = this._appliedForceZ; + return v; + } + getAppliedForceTo(appliedForce) { + var v = appliedForce; + v.x = this._appliedForceX; + v.y = this._appliedForceY; + v.z = this._appliedForceZ; + } + getAppliedTorque() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._appliedTorqueX; + v1.y = this._appliedTorqueY; + v1.z = this._appliedTorqueZ; + return v; + } + getAppliedTorqueTo(appliedTorque) { + var v = appliedTorque; + v.x = this._appliedTorqueX; + v.y = this._appliedTorqueY; + v.z = this._appliedTorqueZ; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint_joint_CylindricalJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,2); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this._basis = new oimo.dynamics.constraint.joint.BasisTracker(this); + this._translSd = config.translationalSpringDamper.clone(); + this._translLm = config.translationalLimitMotor.clone(); + this._rotSd = config.rotationalSpringDamper.clone(); + this._rotLm = config.rotationalLimitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linRhsY = this.linearErrorY * erp; + var linRhsZ = this.linearErrorZ * erp; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var row; + var j; + var translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + if(this._translSd.frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row1 = info.rows[info.numRows++]; + var _this = row1.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse; + row = row1; + this.setSolverInfoRowLinear(row,this.translation,this._translLm,translationalMotorMass,this._translSd,timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basis.xX; + j.lin1Y = this._basis.xY; + j.lin1Z = this._basis.xZ; + j.lin2X = this._basis.xX; + j.lin2Y = this._basis.xY; + j.lin2Z = this._basis.xZ; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; + } + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row = row2; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row = row3; + row.rhs = linRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + if(this._rotSd.frequency <= 0 || !isPositionPart) { + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row = row4; + this.setSolverInfoRowAngular(row,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._basis.xX; + j.ang1Y = this._basis.xY; + j.ang1Z = this._basis.xZ; + j.ang2X = this._basis.xX; + j.ang2Y = this._basis.xY; + j.ang2Z = this._basis.xZ; + } + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row = row5; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + var impulse5 = this._impulses[5]; + var row6 = info.rows[info.numRows++]; + var _this5 = row6.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row6.rhs = 0; + row6.cfm = 0; + row6.minImpulse = 0; + row6.maxImpulse = 0; + row6.motorSpeed = 0; + row6.motorMaxImpulse = 0; + row6.impulse = null; + row6.impulse = impulse5; + row = row6; + row.rhs = angRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.ang1X = this._basis.zX; + j.ang1Y = this._basis.zY; + j.ang1Z = this._basis.zZ; + j.ang2X = this._basis.zX; + j.ang2Y = this._basis.zY; + j.ang2Z = this._basis.zZ; + } + _syncAnchors() { + super._syncAnchors(); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var q; + var qX; + var qY; + var qZ; + var qW; + var idQ; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQ; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newX; + var newXX; + var newXY; + var newXZ; + var newY; + var newYX; + var newYY; + var newYZ; + var newZ; + var newZX; + var newZY; + var newZZ; + var prevX; + var prevXX; + var prevXY; + var prevXZ; + var prevY; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var qx; + var qy; + var qz; + var qw; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var angError; + var angErrorX; + var angErrorY; + var angErrorZ; + angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; + angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; + angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; + var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + angErrorX *= l3; + angErrorY *= l3; + angErrorZ *= l3; + angErrorX *= theta1; + angErrorY *= theta1; + angErrorZ *= theta1; + this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; + this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; + var perpCross; + var perpCrossX; + var perpCrossY; + var perpCrossZ; + perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; + perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; + perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; + cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { + this.angle = -this.angle; + } + var anchorDiff; + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; + this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; + this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX2X; + v1.y = this._basisX2Y; + v1.z = this._basisX2Z; + return v; + } + getAxis1To(axis) { + var v = axis; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + } + getAxis2To(axis) { + var v = axis; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + } + getLocalAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX1X; + v1.y = this._localBasisX1Y; + v1.z = this._localBasisX1Z; + return v; + } + getLocalAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX2X; + v1.y = this._localBasisX2Y; + v1.z = this._localBasisX2Z; + return v; + } + getLocalAxis1To(axis) { + var v = axis; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + } + getLocalAxis2To(axis) { + var v = axis; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + } + getTranslationalSpringDamper() { + return this._translSd; + } + getRotationalSpringDamper() { + return this._rotSd; + } + getTranslationalLimitMotor() { + return this._translLm; + } + getRotationalLimitMotor() { + return this._rotLm; + } + getAngle() { + return this.angle; + } + getTranslation() { + return this.translation; + } +} +oimo.dynamics.constraint.joint.JointConfig = class oimo_dynamics_constraint_joint_JointConfig { + constructor() { + this.rigidBody1 = null; + this.rigidBody2 = null; + this.localAnchor1 = new oimo.common.Vec3(); + this.localAnchor2 = new oimo.common.Vec3(); + this.allowCollision = false; + this.solverType = oimo.common.Setting.defaultJointConstraintSolverType; + this.positionCorrectionAlgorithm = oimo.common.Setting.defaultJointPositionCorrectionAlgorithm; + this.breakForce = 0; + this.breakTorque = 0; + } + _init(rb1,rb2,worldAnchor) { + this.rigidBody1 = rb1; + this.rigidBody2 = rb2; + var _this = this.rigidBody1; + var v; + var vX; + var vY; + var vZ; + var v1 = worldAnchor; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + vX -= _this._transform._positionX; + vY -= _this._transform._positionY; + vZ -= _this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; + __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; + __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localAnchor1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var _this1 = this.rigidBody2; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldAnchor; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + vX1 -= _this1._transform._positionX; + vY1 -= _this1._transform._positionY; + vZ1 -= _this1._transform._positionZ; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; + __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; + __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localAnchor2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + } +} +oimo.dynamics.constraint.joint.CylindricalJointConfig = class oimo_dynamics_constraint_joint_CylindricalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo.common.Vec3(1,0,0); + this.localAxis2 = new oimo.common.Vec3(1,0,0); + this.translationalLimitMotor = new oimo.dynamics.constraint.joint.TranslationalLimitMotor(); + this.translationalSpringDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + this.rotationalLimitMotor = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + this.rotationalSpringDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var v; + var vX; + var vY; + var vZ; + var v1 = worldAxis; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localAxis1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldAxis; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localAxis2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + return this; + } +} +oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joint_GenericJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,oimo.dynamics.constraint.joint.JointType.GENERIC); + var tmp; + var _this = config.localBasis1; + if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { + var _this1 = config.localBasis2; + tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; + } else { + tmp = true; + } + if(tmp) { + console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:50:","[warning] joint basis must be right handed"); + } + var lb1; + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb2; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + var m = config.localBasis1; + lb100 = m.e00; + lb101 = m.e01; + lb102 = m.e02; + lb110 = m.e10; + lb111 = m.e11; + lb112 = m.e12; + lb120 = m.e20; + lb121 = m.e21; + lb122 = m.e22; + var m1 = config.localBasis2; + lb200 = m1.e00; + lb201 = m1.e01; + lb202 = m1.e02; + lb210 = m1.e10; + lb211 = m1.e11; + lb212 = m1.e12; + lb220 = m1.e20; + lb221 = m1.e21; + lb222 = m1.e22; + this._localBasisX1X = lb100; + this._localBasisX1Y = lb110; + this._localBasisX1Z = lb120; + this._localBasisY1X = lb101; + this._localBasisY1Y = lb111; + this._localBasisY1Z = lb121; + this._localBasisZ1X = lb102; + this._localBasisZ1Y = lb112; + this._localBasisZ1Z = lb122; + this._localBasisX2X = lb200; + this._localBasisX2Y = lb210; + this._localBasisX2Z = lb220; + this._localBasisY2X = lb201; + this._localBasisY2Y = lb211; + this._localBasisY2Z = lb221; + this._localBasisZ2X = lb202; + this._localBasisZ2Y = lb212; + this._localBasisZ2Z = lb222; + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.translationX = 0; + this.translationY = 0; + this.translationZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + var this1 = new Array(3); + this._translLms = this1; + var this2 = new Array(3); + this._translSds = this2; + var this3 = new Array(3); + this._rotLms = this3; + var this4 = new Array(3); + this._rotSds = this4; + this._translLms[0] = config.translationalLimitMotors[0].clone(); + this._translLms[1] = config.translationalLimitMotors[1].clone(); + this._translLms[2] = config.translationalLimitMotors[2].clone(); + this._translSds[0] = config.translationalSpringDampers[0].clone(); + this._translSds[1] = config.translationalSpringDampers[1].clone(); + this._translSds[2] = config.translationalSpringDampers[2].clone(); + this._rotLms[0] = config.rotationalLimitMotors[0].clone(); + this._rotLms[1] = config.rotationalLimitMotors[1].clone(); + this._rotLms[2] = config.rotationalLimitMotors[2].clone(); + this._rotSds[0] = config.rotationalSpringDampers[0].clone(); + this._rotSds[1] = config.rotationalSpringDampers[1].clone(); + this._rotSds[2] = config.rotationalSpringDampers[2].clone(); + } + getInfo(info,timeStep,isPositionPart) { + var row; + var j; + var translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + if(this._translSds[0].frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row1 = info.rows[info.numRows++]; + var _this = row1.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse; + row = row1; + this.setSolverInfoRowLinear(row,this.translationX,this._translLms[0],translMotorMass,this._translSds[0],timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basisX1X; + j.lin1Y = this._basisX1Y; + j.lin1Z = this._basisX1Z; + j.lin2X = this._basisX1X; + j.lin2Y = this._basisX1Y; + j.lin2Z = this._basisX1Z; + j.ang1X = this._relativeAnchor1Y * this._basisX1Z - this._relativeAnchor1Z * this._basisX1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisX1X - this._relativeAnchor1X * this._basisX1Z; + j.ang1Z = this._relativeAnchor1X * this._basisX1Y - this._relativeAnchor1Y * this._basisX1X; + j.ang2X = this._relativeAnchor2Y * this._basisX1Z - this._relativeAnchor2Z * this._basisX1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisX1X - this._relativeAnchor2X * this._basisX1Z; + j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; + } + if(this._translSds[1].frequency <= 0 || !isPositionPart) { + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row = row2; + this.setSolverInfoRowLinear(row,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basisY1X; + j.lin1Y = this._basisY1Y; + j.lin1Z = this._basisY1Z; + j.lin2X = this._basisY1X; + j.lin2Y = this._basisY1Y; + j.lin2Z = this._basisY1Z; + j.ang1X = this._relativeAnchor1Y * this._basisY1Z - this._relativeAnchor1Z * this._basisY1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisY1X - this._relativeAnchor1X * this._basisY1Z; + j.ang1Z = this._relativeAnchor1X * this._basisY1Y - this._relativeAnchor1Y * this._basisY1X; + j.ang2X = this._relativeAnchor2Y * this._basisY1Z - this._relativeAnchor2Z * this._basisY1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisY1X - this._relativeAnchor2X * this._basisY1Z; + j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; + } + if(this._translSds[2].frequency <= 0 || !isPositionPart) { + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row = row3; + this.setSolverInfoRowLinear(row,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basisZ1X; + j.lin1Y = this._basisZ1Y; + j.lin1Z = this._basisZ1Z; + j.lin2X = this._basisZ1X; + j.lin2Y = this._basisZ1Y; + j.lin2Z = this._basisZ1Z; + j.ang1X = this._relativeAnchor1Y * this._basisZ1Z - this._relativeAnchor1Z * this._basisZ1Y; + j.ang1Y = this._relativeAnchor1Z * this._basisZ1X - this._relativeAnchor1X * this._basisZ1Z; + j.ang1Z = this._relativeAnchor1X * this._basisZ1Y - this._relativeAnchor1Y * this._basisZ1X; + j.ang2X = this._relativeAnchor2Y * this._basisZ1Z - this._relativeAnchor2Z * this._basisZ1Y; + j.ang2Y = this._relativeAnchor2Z * this._basisZ1X - this._relativeAnchor2X * this._basisZ1Z; + j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; + } + if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row = row4; + this.setSolverInfoRowAngular(row,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._axisXX; + j.ang1Y = this._axisXY; + j.ang1Z = this._axisXZ; + j.ang2X = this._axisXX; + j.ang2Y = this._axisXY; + j.ang2Z = this._axisXZ; + } + if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row = row5; + this.setSolverInfoRowAngular(row,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._axisYX; + j.ang1Y = this._axisYY; + j.ang1Z = this._axisYZ; + j.ang2X = this._axisYX; + j.ang2Y = this._axisYY; + j.ang2Z = this._axisYZ; + } + if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { + var impulse5 = this._impulses[5]; + var row6 = info.rows[info.numRows++]; + var _this5 = row6.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row6.rhs = 0; + row6.cfm = 0; + row6.minImpulse = 0; + row6.maxImpulse = 0; + row6.motorSpeed = 0; + row6.motorMaxImpulse = 0; + row6.impulse = null; + row6.impulse = impulse5; + row = row6; + this.setSolverInfoRowAngular(row,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; + } + } + _syncAnchors() { + super._syncAnchors(); + var rot1; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot2; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot; + var relRot00; + var relRot01; + var relRot02; + var relRot10; + var relRot11; + var relRot12; + var relRot20; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__10 = rot101 * rot200 + rot111 * rot210 + rot121 * rot220; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__20 = rot102 * rot200 + rot112 * rot210 + rot122 * rot220; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot10 = __tmp__10; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot20 = __tmp__20; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var angleAxisX; + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisY; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; + var rot11; + var rot1001; + var rot1011; + var rot1021; + var rot1101; + var rot1111; + var rot1121; + var rot1201; + var rot1211; + var rot1221; + var rot21; + var rot2001; + var rot2011; + var rot2021; + var rot2101; + var rot2111; + var rot2121; + var rot2201; + var rot2211; + var rot2221; + rot1001 = this._basisX1X; + rot1011 = this._basisY1X; + rot1021 = this._basisZ1X; + rot1101 = this._basisX1Y; + rot1111 = this._basisY1Y; + rot1121 = this._basisZ1Y; + rot1201 = this._basisX1Z; + rot1211 = this._basisY1Z; + rot1221 = this._basisZ1Z; + rot2001 = this._basisX2X; + rot2011 = this._basisY2X; + rot2021 = this._basisZ2X; + rot2101 = this._basisX2Y; + rot2111 = this._basisY2Y; + rot2121 = this._basisZ2Y; + rot2201 = this._basisX2Z; + rot2211 = this._basisY2Z; + rot2221 = this._basisZ2Z; + var relRot1; + var relRot001; + var relRot011; + var relRot021; + var relRot101; + var relRot111; + var relRot121; + var relRot201; + var relRot211; + var relRot221; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = rot1001 * rot2001 + rot1101 * rot2101 + rot1201 * rot2201; + __tmp__011 = rot1001 * rot2011 + rot1101 * rot2111 + rot1201 * rot2211; + __tmp__021 = rot1001 * rot2021 + rot1101 * rot2121 + rot1201 * rot2221; + __tmp__101 = rot1011 * rot2001 + rot1111 * rot2101 + rot1211 * rot2201; + __tmp__111 = rot1011 * rot2011 + rot1111 * rot2111 + rot1211 * rot2211; + __tmp__121 = rot1011 * rot2021 + rot1111 * rot2121 + rot1211 * rot2221; + __tmp__201 = rot1021 * rot2001 + rot1121 * rot2101 + rot1221 * rot2201; + __tmp__211 = rot1021 * rot2011 + rot1121 * rot2111 + rot1221 * rot2211; + __tmp__221 = rot1021 * rot2021 + rot1121 * rot2121 + rot1221 * rot2221; + relRot001 = __tmp__001; + relRot011 = __tmp__011; + relRot021 = __tmp__021; + relRot101 = __tmp__101; + relRot111 = __tmp__111; + relRot121 = __tmp__121; + relRot201 = __tmp__201; + relRot211 = __tmp__211; + relRot221 = __tmp__221; + var angles; + var anglesX; + var anglesY; + var anglesZ; + var sy = relRot021; + if(sy <= -1) { + var xSubZ = Math.atan2(relRot211,relRot111); + anglesX = xSubZ * 0.5; + anglesY = -1.570796326794895; + anglesZ = -xSubZ * 0.5; + } else if(sy >= 1) { + var xAddZ = Math.atan2(relRot211,relRot111); + anglesX = xAddZ * 0.5; + anglesY = 1.570796326794895; + anglesZ = xAddZ * 0.5; + } else { + var y = Math.asin(sy); + var x = Math.atan2(-relRot121,relRot221); + var z = Math.atan2(-relRot011,relRot001); + anglesX = x; + anglesY = y; + anglesZ = z; + } + this._angleX = anglesX; + this._angleY = anglesY; + this._angleZ = anglesZ; + var anchorDiff; + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translationX = anchorDiffX * this._basisX1X + anchorDiffY * this._basisX1Y + anchorDiffZ * this._basisX1Z; + this.translationY = anchorDiffX * this._basisY1X + anchorDiffY * this._basisY1Y + anchorDiffZ * this._basisY1Z; + this.translationZ = anchorDiffX * this._basisZ1X + anchorDiffY * this._basisZ1Y + anchorDiffZ * this._basisZ1Z; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxisX() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxisY() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._axisYX; + v1.y = this._axisYY; + v1.z = this._axisYZ; + return v; + } + getAxisZ() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisZ2X; + v1.y = this._basisZ2Y; + v1.z = this._basisZ2Z; + return v; + } + getTranslationalSpringDampers() { + return this._translSds.slice(0); + } + getRotationalSpringDampers() { + return this._translSds.slice(0); + } + getTranslationalLimitMotors() { + return this._translLms.slice(0); + } + getRotationalLimitMotors() { + return this._rotLms.slice(0); + } + getAngles() { + return new oimo.common.Vec3(this._angleX,this._angleY,this._angleZ); + } + getTranslations() { + return new oimo.common.Vec3(this.translationX,this.translationY,this.translationZ); + } +} +oimo.dynamics.constraint.joint.GenericJointConfig = class oimo_dynamics_constraint_joint_GenericJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localBasis1 = new oimo.common.Mat3(); + this.localBasis2 = new oimo.common.Mat3(); + var _g = []; + _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); + this.translationalLimitMotors = _g; + var _g1 = []; + _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); + this.rotationalLimitMotors = _g1; + this.translationalSpringDampers = [new oimo.dynamics.constraint.joint.SpringDamper(),new oimo.dynamics.constraint.joint.SpringDamper(),new oimo.dynamics.constraint.joint.SpringDamper()]; + this.rotationalSpringDampers = [new oimo.dynamics.constraint.joint.SpringDamper(),new oimo.dynamics.constraint.joint.SpringDamper(),new oimo.dynamics.constraint.joint.SpringDamper()]; + } + init(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var tf1 = rigidBody1._transform; + var tf2 = rigidBody2._transform; + var wb1; + var wb100; + var wb101; + var wb102; + var wb110; + var wb111; + var wb112; + var wb120; + var wb121; + var wb122; + var wb2; + var wb200; + var wb201; + var wb202; + var wb210; + var wb211; + var wb212; + var wb220; + var wb221; + var wb222; + var lb1; + var lb100; + var lb101; + var lb102; + var lb110; + var lb111; + var lb112; + var lb120; + var lb121; + var lb122; + var lb2; + var lb200; + var lb201; + var lb202; + var lb210; + var lb211; + var lb212; + var lb220; + var lb221; + var lb222; + var m = worldBasis1; + wb100 = m.e00; + wb101 = m.e01; + wb102 = m.e02; + wb110 = m.e10; + wb111 = m.e11; + wb112 = m.e12; + wb120 = m.e20; + wb121 = m.e21; + wb122 = m.e22; + var m1 = worldBasis2; + wb200 = m1.e00; + wb201 = m1.e01; + wb202 = m1.e02; + wb210 = m1.e10; + wb211 = m1.e11; + wb212 = m1.e12; + wb220 = m1.e20; + wb221 = m1.e21; + wb222 = m1.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * wb100 + tf1._rotation10 * wb110 + tf1._rotation20 * wb120; + __tmp__01 = tf1._rotation00 * wb101 + tf1._rotation10 * wb111 + tf1._rotation20 * wb121; + __tmp__02 = tf1._rotation00 * wb102 + tf1._rotation10 * wb112 + tf1._rotation20 * wb122; + __tmp__10 = tf1._rotation01 * wb100 + tf1._rotation11 * wb110 + tf1._rotation21 * wb120; + __tmp__11 = tf1._rotation01 * wb101 + tf1._rotation11 * wb111 + tf1._rotation21 * wb121; + __tmp__12 = tf1._rotation01 * wb102 + tf1._rotation11 * wb112 + tf1._rotation21 * wb122; + __tmp__20 = tf1._rotation02 * wb100 + tf1._rotation12 * wb110 + tf1._rotation22 * wb120; + __tmp__21 = tf1._rotation02 * wb101 + tf1._rotation12 * wb111 + tf1._rotation22 * wb121; + __tmp__22 = tf1._rotation02 * wb102 + tf1._rotation12 * wb112 + tf1._rotation22 * wb122; + lb100 = __tmp__00; + lb101 = __tmp__01; + lb102 = __tmp__02; + lb110 = __tmp__10; + lb111 = __tmp__11; + lb112 = __tmp__12; + lb120 = __tmp__20; + lb121 = __tmp__21; + lb122 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; + __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; + __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; + __tmp__101 = tf2._rotation01 * wb200 + tf2._rotation11 * wb210 + tf2._rotation21 * wb220; + __tmp__111 = tf2._rotation01 * wb201 + tf2._rotation11 * wb211 + tf2._rotation21 * wb221; + __tmp__121 = tf2._rotation01 * wb202 + tf2._rotation11 * wb212 + tf2._rotation21 * wb222; + __tmp__201 = tf2._rotation02 * wb200 + tf2._rotation12 * wb210 + tf2._rotation22 * wb220; + __tmp__211 = tf2._rotation02 * wb201 + tf2._rotation12 * wb211 + tf2._rotation22 * wb221; + __tmp__221 = tf2._rotation02 * wb202 + tf2._rotation12 * wb212 + tf2._rotation22 * wb222; + lb200 = __tmp__001; + lb201 = __tmp__011; + lb202 = __tmp__021; + lb210 = __tmp__101; + lb211 = __tmp__111; + lb212 = __tmp__121; + lb220 = __tmp__201; + lb221 = __tmp__211; + lb222 = __tmp__221; + var m2 = this.localBasis1; + m2.e00 = lb100; + m2.e01 = lb101; + m2.e02 = lb102; + m2.e10 = lb110; + m2.e11 = lb111; + m2.e12 = lb112; + m2.e20 = lb120; + m2.e21 = lb121; + m2.e22 = lb122; + var m3 = this.localBasis2; + m3.e00 = lb200; + m3.e01 = lb201; + m3.e02 = lb202; + m3.e10 = lb210; + m3.e11 = lb211; + m3.e12 = lb212; + m3.e20 = lb220; + m3.e21 = lb221; + m3.e22 = lb222; + return this; + } +} +oimo.dynamics.constraint.joint.JointImpulse = class oimo_dynamics_constraint_joint_JointImpulse { + constructor() { + this.impulse = 0; + this.impulseM = 0; + this.impulseP = 0; + } +} +oimo.dynamics.constraint.joint.JointLink = class oimo_dynamics_constraint_joint_JointLink { + constructor(joint) { + this._joint = joint; + } + getContact() { + return this._joint; + } + getOther() { + return this._other; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.constraint.joint.JointMacro = class oimo_dynamics_constraint_joint_JointMacro { +} +oimo.dynamics.constraint.joint.JointType = class oimo_dynamics_constraint_joint_JointType { +} +oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_joint_PrismaticJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,oimo.dynamics.constraint.joint.JointType.PRISMATIC); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this._basis = new oimo.dynamics.constraint.joint.BasisTracker(this); + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this.angularErrorX = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linRhsY = this.linearErrorY * erp; + var linRhsZ = this.linearErrorZ * erp; + var angRhsX = this.angularErrorX * erp; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var row; + var j; + var motorMass = 1 / (this._b1._invMass + this._b2._invMass); + if(this._sd.frequency <= 0 || !isPositionPart) { + var impulse = this._impulses[0]; + var row1 = info.rows[info.numRows++]; + var _this = row1.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse; + row = row1; + this.setSolverInfoRowLinear(row,this.translation,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row.jacobian; + j.lin1X = this._basis.xX; + j.lin1Y = this._basis.xY; + j.lin1Z = this._basis.xZ; + j.lin2X = this._basis.xX; + j.lin2Y = this._basis.xY; + j.lin2Z = this._basis.xZ; + j.ang1X = this._relativeAnchor1Y * this._basis.xZ - this._relativeAnchor1Z * this._basis.xY; + j.ang1Y = this._relativeAnchor1Z * this._basis.xX - this._relativeAnchor1X * this._basis.xZ; + j.ang1Z = this._relativeAnchor1X * this._basis.xY - this._relativeAnchor1Y * this._basis.xX; + j.ang2X = this._relativeAnchor2Y * this._basis.xZ - this._relativeAnchor2Z * this._basis.xY; + j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; + j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; + } + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row = row2; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row = row3; + row.rhs = linRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row = row4; + row.rhs = angRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.ang1X = 1; + j.ang1Y = 0; + j.ang1Z = 0; + j.ang2X = 1; + j.ang2Y = 0; + j.ang2Z = 0; + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row = row5; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.ang1X = 0; + j.ang1Y = 1; + j.ang1Z = 0; + j.ang2X = 0; + j.ang2Y = 1; + j.ang2Z = 0; + var impulse5 = this._impulses[5]; + var row6 = info.rows[info.numRows++]; + var _this5 = row6.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row6.rhs = 0; + row6.cfm = 0; + row6.minImpulse = 0; + row6.maxImpulse = 0; + row6.motorSpeed = 0; + row6.motorMaxImpulse = 0; + row6.impulse = null; + row6.impulse = impulse5; + row = row6; + row.rhs = angRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.ang1X = 0; + j.ang1Y = 0; + j.ang1Z = 1; + j.ang2X = 0; + j.ang2Y = 0; + j.ang2Z = 1; + } + _syncAnchors() { + super._syncAnchors(); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var q; + var qX; + var qY; + var qZ; + var qW; + var idQ; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQ; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newX; + var newXX; + var newXY; + var newXZ; + var newY; + var newYX; + var newYY; + var newYZ; + var newZ; + var newZX; + var newZY; + var newZZ; + var prevX; + var prevXX; + var prevXY; + var prevXZ; + var prevY; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var qx; + var qy; + var qz; + var qw; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var rot1; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot2; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot; + var relRot00; + var relRot01; + var relRot02; + var relRot10; + var relRot11; + var relRot12; + var relRot20; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot200 * rot100 + rot201 * rot101 + rot202 * rot102; + __tmp__01 = rot200 * rot110 + rot201 * rot111 + rot202 * rot112; + __tmp__02 = rot200 * rot120 + rot201 * rot121 + rot202 * rot122; + __tmp__10 = rot210 * rot100 + rot211 * rot101 + rot212 * rot102; + __tmp__11 = rot210 * rot110 + rot211 * rot111 + rot212 * rot112; + __tmp__12 = rot210 * rot120 + rot211 * rot121 + rot212 * rot122; + __tmp__20 = rot220 * rot100 + rot221 * rot101 + rot222 * rot102; + __tmp__21 = rot220 * rot110 + rot221 * rot111 + rot222 * rot112; + __tmp__22 = rot220 * rot120 + rot221 * rot121 + rot222 * rot122; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot10 = __tmp__10; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot20 = __tmp__20; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var relQ; + var relQX; + var relQY; + var relQZ; + var relQW; + var e00 = relRot00; + var e11 = relRot11; + var e22 = relRot22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + relQW = 0.5 * s; + s = 0.5 / s; + relQX = (relRot21 - relRot12) * s; + relQY = (relRot02 - relRot20) * s; + relQZ = (relRot10 - relRot01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + relQX = 0.5 * s; + s = 0.5 / s; + relQY = (relRot01 + relRot10) * s; + relQZ = (relRot02 + relRot20) * s; + relQW = (relRot21 - relRot12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + relQZ = 0.5 * s; + s = 0.5 / s; + relQX = (relRot02 + relRot20) * s; + relQY = (relRot12 + relRot21) * s; + relQW = (relRot10 - relRot01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + relQY = 0.5 * s; + s = 0.5 / s; + relQX = (relRot01 + relRot10) * s; + relQZ = (relRot12 + relRot21) * s; + relQW = (relRot02 - relRot20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + relQZ = 0.5 * s; + s = 0.5 / s; + relQX = (relRot02 + relRot20) * s; + relQY = (relRot12 + relRot21) * s; + relQW = (relRot10 - relRot01) * s; + } + var cosHalfTheta = relQW; + var theta1 = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; + this.angularErrorX = relQX; + this.angularErrorY = relQY; + this.angularErrorZ = relQZ; + var l3 = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + this.angularErrorX *= l3; + this.angularErrorY *= l3; + this.angularErrorZ *= l3; + this.angularErrorX *= theta1; + this.angularErrorY *= theta1; + this.angularErrorZ *= theta1; + var anchorDiff; + var anchorDiffX; + var anchorDiffY; + var anchorDiffZ; + anchorDiffX = this._anchor2X - this._anchor1X; + anchorDiffY = this._anchor2Y - this._anchor1Y; + anchorDiffZ = this._anchor2Z - this._anchor1Z; + this.translation = anchorDiffX * this._basis.xX + anchorDiffY * this._basis.xY + anchorDiffZ * this._basis.xZ; + this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; + this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX2X; + v1.y = this._basisX2Y; + v1.z = this._basisX2Z; + return v; + } + getAxis1To(axis) { + var v = axis; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + } + getAxis2To(axis) { + var v = axis; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + } + getLocalAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX1X; + v1.y = this._localBasisX1Y; + v1.z = this._localBasisX1Z; + return v; + } + getLocalAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX2X; + v1.y = this._localBasisX2Y; + v1.z = this._localBasisX2Z; + return v; + } + getLocalAxis1To(axis) { + var v = axis; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + } + getLocalAxis2To(axis) { + var v = axis; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + } + getSpringDamper() { + return this._sd; + } + getLimitMotor() { + return this._lm; + } + getTranslation() { + return this.translation; + } +} +oimo.dynamics.constraint.joint.PrismaticJointConfig = class oimo_dynamics_constraint_joint_PrismaticJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo.common.Vec3(1,0,0); + this.localAxis2 = new oimo.common.Vec3(1,0,0); + this.limitMotor = new oimo.dynamics.constraint.joint.TranslationalLimitMotor(); + this.springDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var v; + var vX; + var vY; + var vZ; + var v1 = worldAxis; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localAxis1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldAxis; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localAxis2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + return this; + } +} +oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joint_RagdollJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,oimo.dynamics.constraint.joint.JointType.RAGDOLL); + var v = config.localTwistAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localSwingAxis1; + this._localBasisY1X = v1.x; + this._localBasisY1Y = v1.y; + this._localBasisY1Z = v1.z; + var v2 = config.localTwistAxis2; + this._localBasisX2X = v2.x; + this._localBasisX2Y = v2.y; + this._localBasisX2Z = v2.z; + this.buildLocalBasesFromXY1X2(); + this._twistSd = config.twistSpringDamper.clone(); + this._twistLm = config.twistLimitMotor.clone(); + this._swingSd = config.swingSpringDamper.clone(); + this._maxSwingAngle1 = config.maxSwingAngle1; + this._maxSwingAngle2 = config.maxSwingAngle2; + if(this._maxSwingAngle1 < oimo.common.Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle1 = oimo.common.Setting.minRagdollMaxSwingAngle; + } + if(this._maxSwingAngle2 < oimo.common.Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle2 = oimo.common.Setting.minRagdollMaxSwingAngle; + } + this.dummySwingLm = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + this.dummySwingLm.lowerLimit = -1; + this.dummySwingLm.upperLimit = 0; + this._swingAngle = 0; + this._twistAngle = 0; + this.swingError = 0; + this.swingAxisX = 0; + this.swingAxisY = 0; + this.swingAxisZ = 0; + this.twistAxisX = 0; + this.twistAxisY = 0; + this.twistAxisZ = 0; + } + getInfo(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhs; + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var linRhsX = linearRhsX; + var linRhsY = linearRhsY; + var linRhsZ = linearRhsZ; + var crossR1; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR2; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); + var twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + var row1 = row; + row1.rhs = linRhsX; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + var j = row1.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row1 = row2; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row1 = row3; + row1.rhs = linRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row1 = row4; + this.setSolverInfoRowAngular(row1,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row1.jacobian; + j.ang1X = this.swingAxisX; + j.ang1Y = this.swingAxisY; + j.ang1Z = this.swingAxisZ; + j.ang2X = this.swingAxisX; + j.ang2Y = this.swingAxisY; + j.ang2Z = this.swingAxisZ; + } + if(this._twistSd.frequency <= 0 || !isPositionPart) { + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row1 = row5; + this.setSolverInfoRowAngular(row1,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row1.jacobian; + j.ang1X = this.twistAxisX; + j.ang1Y = this.twistAxisY; + j.ang1Z = this.twistAxisZ; + j.ang2X = this.twistAxisX; + j.ang2Y = this.twistAxisY; + j.ang2Z = this.twistAxisZ; + } + } + _syncAnchors() { + super._syncAnchors(); + var tf1 = this._b1._transform; + var tf2 = this._b2._transform; + var axis1; + var axis1X; + var axis1Y; + var axis1Z; + var axis2; + var axis2X; + var axis2Y; + var axis2Z; + axis1X = this._basisX1X; + axis1Y = this._basisX1Y; + axis1Z = this._basisX1Z; + axis2X = this._basisX2X; + axis2Y = this._basisX2Y; + axis2Z = this._basisX2Z; + var basis1Mat; + var basis1Mat00; + var basis1Mat01; + var basis1Mat02; + var basis1Mat10; + var basis1Mat11; + var basis1Mat12; + var basis1Mat20; + var basis1Mat21; + var basis1Mat22; + var basis2Mat; + var basis2Mat00; + var basis2Mat01; + var basis2Mat02; + var basis2Mat10; + var basis2Mat11; + var basis2Mat12; + var basis2Mat20; + var basis2Mat21; + var basis2Mat22; + basis1Mat00 = this._basisX1X; + basis1Mat01 = this._basisY1X; + basis1Mat02 = this._basisZ1X; + basis1Mat10 = this._basisX1Y; + basis1Mat11 = this._basisY1Y; + basis1Mat12 = this._basisZ1Y; + basis1Mat20 = this._basisX1Z; + basis1Mat21 = this._basisY1Z; + basis1Mat22 = this._basisZ1Z; + basis2Mat00 = this._basisX2X; + basis2Mat01 = this._basisY2X; + basis2Mat02 = this._basisZ2X; + basis2Mat10 = this._basisX2Y; + basis2Mat11 = this._basisY2Y; + basis2Mat12 = this._basisZ2Y; + basis2Mat20 = this._basisX2Z; + basis2Mat21 = this._basisY2Z; + basis2Mat22 = this._basisZ2Z; + var swingQ; + var swingQX; + var swingQY; + var swingQZ; + var swingQW; + var swingM; + var swingM00; + var swingM01; + var swingM02; + var swingM10; + var swingM11; + var swingM12; + var swingM20; + var swingM21; + var swingM22; + var swingV; + var swingVX; + var swingVY; + var swingVZ; + var d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = axis1X; + var y1 = axis1Y; + var z1 = axis1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + swingQX = vX; + swingQY = vY; + swingQZ = vZ; + swingQW = 0; + } else { + var cX; + var cY; + var cZ; + cX = axis1Y * axis2Z - axis1Z * axis2Y; + cY = axis1Z * axis2X - axis1X * axis2Z; + cZ = axis1X * axis2Y - axis1Y * axis2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + swingQX = cX; + swingQY = cY; + swingQZ = cZ; + swingQW = w; + } + var x = swingQX; + var y = swingQY; + var z = swingQZ; + var w1 = swingQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + swingM00 = 1 - yy - zz; + swingM01 = xy - wz; + swingM02 = xz + wy; + swingM10 = xy + wz; + swingM11 = 1 - xx - zz; + swingM12 = yz - wx; + swingM20 = xz - wy; + swingM21 = yz + wx; + swingM22 = 1 - xx - yy; + this._swingAngle = (swingQW <= -1 ? 3.14159265358979 : swingQW >= 1 ? 0 : Math.acos(swingQW)) * 2; + swingVX = swingQX; + swingVY = swingQY; + swingVZ = swingQZ; + var basisY2In1; + var basisY2In1X; + var basisY2In1Y; + var basisY2In1Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = swingM00 * this._basisY2X + swingM10 * this._basisY2Y + swingM20 * this._basisY2Z; + __tmp__Y = swingM01 * this._basisY2X + swingM11 * this._basisY2Y + swingM21 * this._basisY2Z; + __tmp__Z = swingM02 * this._basisY2X + swingM12 * this._basisY2Y + swingM22 * this._basisY2Z; + basisY2In1X = __tmp__X; + basisY2In1Y = __tmp__Y; + basisY2In1Z = __tmp__Z; + var yCoord = this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z; + var zCoord = this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z; + this._twistAngle = Math.atan2(zCoord,yCoord); + this.twistAxisX = this._basisX1X + this._basisX2X; + this.twistAxisY = this._basisX1Y + this._basisX2Y; + this.twistAxisZ = this._basisX1Z + this._basisX2Z; + var l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this.twistAxisX *= l; + this.twistAxisY *= l; + this.twistAxisZ *= l; + var invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); + if(invLen > 0) { + invLen = 1 / invLen; + } + swingVX *= invLen * this._swingAngle; + swingVY *= invLen * this._swingAngle; + swingVZ *= invLen * this._swingAngle; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; + __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; + __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; + swingVX = __tmp__X1; + swingVY = __tmp__Y1; + swingVZ = __tmp__Z1; + var x3 = swingVY; + var y3 = swingVZ; + var a = this._maxSwingAngle1; + var b = this._maxSwingAngle2; + var invA2 = 1 / (a * a); + var invB2 = 1 / (b * b); + var w2 = x3 * x3 * invA2 + y3 * y3 * invB2; + if(w2 == 0) { + this.swingAxisX = 0; + this.swingAxisY = 0; + this.swingAxisZ = 0; + this.swingError = 0; + } else { + var t = Math.sqrt(1 / w2); + var x0 = x3 * t; + var y0 = y3 * t; + var nx = x0 * invA2; + var ny = y0 * invB2; + invLen = 1 / Math.sqrt(nx * nx + ny * ny); + nx *= invLen; + ny *= invLen; + var depth = (x3 - x0) * nx + (y3 - y0) * ny; + if(depth > 0) { + this.swingError = depth; + this.swingAxisX = 0; + this.swingAxisY = nx; + this.swingAxisZ = ny; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; + __tmp__Y2 = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; + __tmp__Z2 = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; + this.swingAxisX = __tmp__X2; + this.swingAxisY = __tmp__Y2; + this.swingAxisZ = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; + __tmp__Y3 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; + __tmp__Z3 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; + this.swingAxisX = __tmp__X3; + this.swingAxisY = __tmp__Y3; + this.swingAxisZ = __tmp__Z3; + } else { + this.swingError = 0; + } + } + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX2X; + v1.y = this._basisX2Y; + v1.z = this._basisX2Z; + return v; + } + getAxis1To(axis) { + var v = axis; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + } + getAxis2To(axis) { + var v = axis; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + } + getLocalAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX1X; + v1.y = this._localBasisX1Y; + v1.z = this._localBasisX1Z; + return v; + } + getLocalAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX2X; + v1.y = this._localBasisX2Y; + v1.z = this._localBasisX2Z; + return v; + } + getLocalAxis1To(axis) { + var v = axis; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + } + getLocalAxis2To(axis) { + var v = axis; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + } + getTwistSpringDamper() { + return this._twistSd; + } + getTwistLimitMotor() { + return this._twistLm; + } + getSwingSpringDamper() { + return this._swingSd; + } + getSwingAxis() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this.swingAxisX; + v1.y = this.swingAxisY; + v1.z = this.swingAxisZ; + return v; + } + getSwingAxisTo(axis) { + var v = axis; + v.x = this.swingAxisX; + v.y = this.swingAxisY; + v.z = this.swingAxisZ; + } + getSwingAngle() { + return this._swingAngle; + } + getTwistAngle() { + return this._twistAngle; + } +} +oimo.dynamics.constraint.joint.RagdollJointConfig = class oimo_dynamics_constraint_joint_RagdollJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localTwistAxis1 = new oimo.common.Vec3(1,0,0); + this.localTwistAxis2 = new oimo.common.Vec3(1,0,0); + this.localSwingAxis1 = new oimo.common.Vec3(0,1,0); + this.twistSpringDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + this.swingSpringDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + this.twistLimitMotor = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + this.maxSwingAngle1 = 3.14159265358979; + this.maxSwingAngle2 = 3.14159265358979; + } + init(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var v; + var vX; + var vY; + var vZ; + var v1 = worldTwistAxis; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localTwistAxis1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldTwistAxis; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localTwistAxis2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + var v6; + var vX2; + var vY2; + var vZ2; + var v7 = worldSwingAxis; + vX2 = v7.x; + vY2 = v7.y; + vZ2 = v7.z; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = rigidBody1._transform._rotation00 * vX2 + rigidBody1._transform._rotation10 * vY2 + rigidBody1._transform._rotation20 * vZ2; + __tmp__Y2 = rigidBody1._transform._rotation01 * vX2 + rigidBody1._transform._rotation11 * vY2 + rigidBody1._transform._rotation21 * vZ2; + __tmp__Z2 = rigidBody1._transform._rotation02 * vX2 + rigidBody1._transform._rotation12 * vY2 + rigidBody1._transform._rotation22 * vZ2; + vX2 = __tmp__X2; + vY2 = __tmp__Y2; + vZ2 = __tmp__Z2; + var v8 = this.localSwingAxis1; + v8.x = vX2; + v8.y = vY2; + v8.z = vZ2; + return this; + } +} +oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_joint_RevoluteJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,1); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._basis = new oimo.dynamics.constraint.joint.BasisTracker(this); + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhs; + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var linRhsX = linearRhsX; + var linRhsY = linearRhsY; + var linRhsZ = linearRhsZ; + var angRhsY = this.angularErrorY * erp; + var angRhsZ = this.angularErrorZ * erp; + var crossR1; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR2; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + var row1 = row; + row1.rhs = linRhsX; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + var j = row1.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row1 = row2; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row1 = row3; + row1.rhs = linRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(this._sd.frequency <= 0 || !isPositionPart) { + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row1 = row4; + this.setSolverInfoRowAngular(row1,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row1.jacobian; + j.ang1X = this._basis.xX; + j.ang1Y = this._basis.xY; + j.ang1Z = this._basis.xZ; + j.ang2X = this._basis.xX; + j.ang2Y = this._basis.xY; + j.ang2Z = this._basis.xZ; + } + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row1 = row5; + row1.rhs = angRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + var impulse5 = this._impulses[5]; + var row6 = info.rows[info.numRows++]; + var _this5 = row6.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row6.rhs = 0; + row6.cfm = 0; + row6.minImpulse = 0; + row6.maxImpulse = 0; + row6.motorSpeed = 0; + row6.motorMaxImpulse = 0; + row6.impulse = null; + row6.impulse = impulse5; + row1 = row6; + row1.rhs = angRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.ang1X = this._basis.zX; + j.ang1Y = this._basis.zY; + j.ang1Z = this._basis.zZ; + j.ang2X = this._basis.zX; + j.ang2Y = this._basis.zY; + j.ang2Z = this._basis.zZ; + } + _syncAnchors() { + super._syncAnchors(); + var _this = this._basis; + var invM1 = _this.joint._b1._invMass; + var invM2 = _this.joint._b2._invMass; + var q; + var qX; + var qY; + var qZ; + var qW; + var idQ; + var idQX; + var idQY; + var idQZ; + var idQW; + var slerpQ; + var slerpQX; + var slerpQY; + var slerpQZ; + var slerpQW; + var slerpM; + var slerpM00; + var slerpM01; + var slerpM02; + var slerpM10; + var slerpM11; + var slerpM12; + var slerpM20; + var slerpM21; + var slerpM22; + var newX; + var newXX; + var newXY; + var newXZ; + var newY; + var newYX; + var newYY; + var newYZ; + var newZ; + var newZX; + var newZY; + var newZZ; + var prevX; + var prevXX; + var prevXY; + var prevXZ; + var prevY; + var prevYX; + var prevYY; + var prevYZ; + var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = _this.joint._basisX1X; + var y1 = _this.joint._basisX1Y; + var z1 = _this.joint._basisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; + } else { + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + qX = vX; + qY = vY; + qZ = vZ; + qW = 0; + } else { + var cX; + var cY; + var cZ; + cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; + cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; + cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + qX = cX; + qY = cY; + qZ = cZ; + qW = w; + } + idQX = 0; + idQY = 0; + idQZ = 0; + idQW = 1; + var qx; + var qy; + var qz; + var qw; + var q1X; + var q1Y; + var q1Z; + var q1W; + var q2X; + var q2Y; + var q2Z; + var q2W; + q1X = idQX; + q1Y = idQY; + q1Z = idQZ; + q1W = idQW; + q2X = qX; + q2Y = qY; + q2Z = qZ; + q2W = qW; + var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d2 < 0) { + d2 = -d2; + q2X = -q2X; + q2Y = -q2Y; + q2Z = -q2Z; + q2W = -q2W; + } + if(d2 > 0.999999) { + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = q2X - q1X; + dqY = q2Y - q1Y; + dqZ = q2Z - q1Z; + dqW = q2W - q1W; + q2X = q1X + dqX * (invM1 / (invM1 + invM2)); + q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); + q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); + q2W = q1W + dqW * (invM1 / (invM1 + invM2)); + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + slerpQX = q2X * l; + slerpQY = q2Y * l; + slerpQZ = q2Z * l; + slerpQW = q2W * l; + } else { + var theta = invM1 / (invM1 + invM2) * Math.acos(d2); + q2X += q1X * -d2; + q2Y += q1Y * -d2; + q2Z += q1Z * -d2; + q2W += q1W * -d2; + var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + q2X *= l1; + q2Y *= l1; + q2Z *= l1; + q2W *= l1; + var sin = Math.sin(theta); + var cos = Math.cos(theta); + q1X *= cos; + q1Y *= cos; + q1Z *= cos; + q1W *= cos; + slerpQX = q1X + q2X * sin; + slerpQY = q1Y + q2Y * sin; + slerpQZ = q1Z + q2Z * sin; + slerpQW = q1W + q2W * sin; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w1 = slerpQW; + var x21 = 2 * x; + var y21 = 2 * y; + var z21 = 2 * z; + var xx = x * x21; + var yy = y * y21; + var zz = z * z21; + var xy = x * y21; + var yz = y * z21; + var xz = x * z21; + var wx = w1 * x21; + var wy = w1 * y21; + var wz = w1 * z21; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; + __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; + __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; + newXX = __tmp__X; + newXY = __tmp__Y; + newXZ = __tmp__Z; + prevXX = _this.xX; + prevXY = _this.xY; + prevXZ = _this.xZ; + prevYX = _this.yX; + prevYY = _this.yY; + prevYZ = _this.yZ; + var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d3 < -0.999999999) { + var vX1; + var vY1; + var vZ1; + var x11 = prevXX; + var y11 = prevXY; + var z11 = prevXZ; + var x22 = x11 * x11; + var y22 = y11 * y11; + var z22 = z11 * z11; + var d4; + if(x22 < y22) { + if(x22 < z22) { + d4 = 1 / Math.sqrt(y22 + z22); + vX1 = 0; + vY1 = z11 * d4; + vZ1 = -y11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + } else if(y22 < z22) { + d4 = 1 / Math.sqrt(z22 + x22); + vX1 = -z11 * d4; + vY1 = 0; + vZ1 = x11 * d4; + } else { + d4 = 1 / Math.sqrt(x22 + y22); + vX1 = y11 * d4; + vY1 = -x11 * d4; + vZ1 = 0; + } + slerpQX = vX1; + slerpQY = vY1; + slerpQZ = vZ1; + slerpQW = 0; + } else { + var cX1; + var cY1; + var cZ1; + cX1 = prevXY * newXZ - prevXZ * newXY; + cY1 = prevXZ * newXX - prevXX * newXZ; + cZ1 = prevXX * newXY - prevXY * newXX; + var w2 = Math.sqrt((1 + d3) * 0.5); + d3 = 0.5 / w2; + cX1 *= d3; + cY1 *= d3; + cZ1 *= d3; + slerpQX = cX1; + slerpQY = cY1; + slerpQZ = cZ1; + slerpQW = w2; + } + var x3 = slerpQX; + var y3 = slerpQY; + var z3 = slerpQZ; + var w3 = slerpQW; + var x23 = 2 * x3; + var y23 = 2 * y3; + var z23 = 2 * z3; + var xx1 = x3 * x23; + var yy1 = y3 * y23; + var zz1 = z3 * z23; + var xy1 = x3 * y23; + var yz1 = y3 * z23; + var xz1 = x3 * z23; + var wx1 = w3 * x23; + var wy1 = w3 * y23; + var wz1 = w3 * z23; + slerpM00 = 1 - yy1 - zz1; + slerpM01 = xy1 - wz1; + slerpM02 = xz1 + wy1; + slerpM10 = xy1 + wz1; + slerpM11 = 1 - xx1 - zz1; + slerpM12 = yz1 - wx1; + slerpM20 = xz1 - wy1; + slerpM21 = yz1 + wx1; + slerpM22 = 1 - xx1 - yy1; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X1; + newYY = __tmp__Y1; + newYZ = __tmp__Z1; + newZX = newXY * newYZ - newXZ * newYY; + newZY = newXZ * newYX - newXX * newYZ; + newZZ = newXX * newYY - newXY * newYX; + if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { + var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + newZX *= l2; + newZY *= l2; + newZZ *= l2; + } else { + var x12 = newXX; + var y12 = newXY; + var z12 = newXZ; + var x24 = x12 * x12; + var y24 = y12 * y12; + var z24 = z12 * z12; + var d5; + if(x24 < y24) { + if(x24 < z24) { + d5 = 1 / Math.sqrt(y24 + z24); + newZX = 0; + newZY = z12 * d5; + newZZ = -y12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } else if(y24 < z24) { + d5 = 1 / Math.sqrt(z24 + x24); + newZX = -z12 * d5; + newZY = 0; + newZZ = x12 * d5; + } else { + d5 = 1 / Math.sqrt(x24 + y24); + newZX = y12 * d5; + newZY = -x12 * d5; + newZZ = 0; + } + } + newYX = newZY * newXZ - newZZ * newXY; + newYY = newZZ * newXX - newZX * newXZ; + newYZ = newZX * newXY - newZY * newXX; + _this.xX = newXX; + _this.xY = newXY; + _this.xZ = newXZ; + _this.yX = newYX; + _this.yY = newYY; + _this.yZ = newYZ; + _this.zX = newZX; + _this.zY = newZY; + _this.zZ = newZZ; + var angError; + var angErrorX; + var angErrorY; + var angErrorZ; + angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; + angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; + angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; + var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l3 > 0) { + l3 = 1 / Math.sqrt(l3); + } + angErrorX *= l3; + angErrorY *= l3; + angErrorZ *= l3; + angErrorX *= theta1; + angErrorY *= theta1; + angErrorZ *= theta1; + this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; + this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; + var perpCross; + var perpCrossX; + var perpCrossY; + var perpCrossZ; + perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; + perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; + perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; + cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { + this.angle = -this.angle; + } + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX2X; + v1.y = this._basisX2Y; + v1.z = this._basisX2Z; + return v; + } + getAxis1To(axis) { + var v = axis; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + } + getAxis2To(axis) { + var v = axis; + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; + } + getLocalAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX1X; + v1.y = this._localBasisX1Y; + v1.z = this._localBasisX1Z; + return v; + } + getLocalAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX2X; + v1.y = this._localBasisX2Y; + v1.z = this._localBasisX2Z; + return v; + } + getLocalAxis1To(axis) { + var v = axis; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + } + getLocalAxis2To(axis) { + var v = axis; + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; + } + getSpringDamper() { + return this._sd; + } + getLimitMotor() { + return this._lm; + } + getAngle() { + return this.angle; + } +} +oimo.dynamics.constraint.joint.RevoluteJointConfig = class oimo_dynamics_constraint_joint_RevoluteJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo.common.Vec3(1,0,0); + this.localAxis2 = new oimo.common.Vec3(1,0,0); + this.springDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + this.limitMotor = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var v; + var vX; + var vY; + var vZ; + var v1 = worldAxis; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localAxis1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldAxis; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localAxis2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + return this; + } +} +oimo.dynamics.constraint.joint.RotationalLimitMotor = class oimo_dynamics_constraint_joint_RotationalLimitMotor { + constructor() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorTorque = 0; + } + setLimits(lower,upper) { + this.lowerLimit = lower; + this.upperLimit = upper; + return this; + } + setMotor(speed,torque) { + this.motorSpeed = speed; + this.motorTorque = torque; + return this; + } + clone() { + var lm = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + lm.lowerLimit = this.lowerLimit; + lm.upperLimit = this.upperLimit; + lm.motorSpeed = this.motorSpeed; + lm.motorTorque = this.motorTorque; + return lm; + } +} +oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_joint_SphericalJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,0); + this._sd = config.springDamper.clone(); + } + getInfo(info,timeStep,isPositionPart) { + if(this._sd.frequency > 0 && isPositionPart) { + return; + } + var error; + var errorX; + var errorY; + var errorZ; + errorX = this._anchor2X - this._anchor1X; + errorY = this._anchor2Y - this._anchor1Y; + errorZ = this._anchor2Z - this._anchor1Z; + var cfm; + var erp; + if(this._sd.frequency > 0) { + var omega = 6.28318530717958 * this._sd.frequency; + var zeta = this._sd.dampingRatio; + if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { + zeta = oimo.common.Setting.minSpringDamperDampingRatio; + } + var h = timeStep.dt; + var c = 2 * zeta * omega; + var k = omega * omega; + if(this._sd.useSymplecticEuler) { + cfm = 1 / (h * c); + erp = k / c; + } else { + cfm = 1 / (h * (h * k + c)); + erp = k / (h * k + c); + } + cfm *= this._b1._invMass + this._b2._invMass; + } else { + cfm = 0; + erp = this.getErp(timeStep,isPositionPart); + } + var linearRhs; + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = errorX * erp; + linearRhsY = errorY * erp; + linearRhsZ = errorZ * erp; + var linRhsX = linearRhsX; + var linRhsY = linearRhsY; + var linRhsZ = linearRhsZ; + var crossR1; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR2; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + var row1 = row; + row1.rhs = linRhsX; + row1.cfm = cfm; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + var j = row1.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row1 = row2; + row1.rhs = linRhsY; + row1.cfm = cfm; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row1 = row3; + row1.rhs = linRhsZ; + row1.cfm = cfm; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getSpringDamper() { + return this._sd; + } +} +oimo.dynamics.constraint.joint.SphericalJointConfig = class oimo_dynamics_constraint_joint_SphericalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.springDamper = new oimo.dynamics.constraint.joint.SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor) { + this._init(rigidBody1,rigidBody2,worldAnchor); + return this; + } +} +oimo.dynamics.constraint.joint.SpringDamper = class oimo_dynamics_constraint_joint_SpringDamper { + constructor() { + this.frequency = 0; + this.dampingRatio = 0; + this.useSymplecticEuler = false; + } + setSpring(frequency,dampingRatio) { + this.frequency = frequency; + this.dampingRatio = dampingRatio; + return this; + } + setSymplecticEuler(useSymplecticEuler) { + this.useSymplecticEuler = useSymplecticEuler; + return this; + } + clone() { + var sd = new oimo.dynamics.constraint.joint.SpringDamper(); + sd.frequency = this.frequency; + sd.dampingRatio = this.dampingRatio; + sd.useSymplecticEuler = this.useSymplecticEuler; + return sd; + } +} +oimo.dynamics.constraint.joint.TranslationalLimitMotor = class oimo_dynamics_constraint_joint_TranslationalLimitMotor { + constructor() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorForce = 0; + } + setLimits(lower,upper) { + this.lowerLimit = lower; + this.upperLimit = upper; + return this; + } + setMotor(speed,force) { + this.motorSpeed = speed; + this.motorForce = force; + return this; + } + clone() { + var lm = new oimo.dynamics.constraint.joint.TranslationalLimitMotor(); + lm.lowerLimit = this.lowerLimit; + lm.upperLimit = this.upperLimit; + lm.motorSpeed = this.motorSpeed; + lm.motorForce = this.motorForce; + return lm; + } +} +oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_joint_UniversalJoint extends oimo.dynamics.constraint.joint.Joint { + constructor(config) { + super(config,oimo.dynamics.constraint.joint.JointType.UNIVERSAL); + var v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + var v1 = config.localAxis2; + this._localBasisZ2X = v1.x; + this._localBasisZ2Y = v1.y; + this._localBasisZ2Z = v1.z; + this.buildLocalBasesFromX1Z2(); + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._sd1 = config.springDamper1.clone(); + this._sd2 = config.springDamper2.clone(); + this._lm1 = config.limitMotor1.clone(); + this._lm2 = config.limitMotor2.clone(); + } + getInfo(info,timeStep,isPositionPart) { + var erp = this.getErp(timeStep,isPositionPart); + var linearRhs; + var linearRhsX; + var linearRhsY; + var linearRhsZ; + linearRhsX = this.linearErrorX * erp; + linearRhsY = this.linearErrorY * erp; + linearRhsZ = this.linearErrorZ * erp; + var linRhsX = linearRhsX; + var linRhsY = linearRhsY; + var linRhsZ = linearRhsZ; + var angRhsY = this._angleY * erp; + var crossR1; + var crossR100; + var crossR101; + var crossR102; + var crossR110; + var crossR111; + var crossR112; + var crossR120; + var crossR121; + var crossR122; + var crossR2; + var crossR200; + var crossR201; + var crossR202; + var crossR210; + var crossR211; + var crossR212; + var crossR220; + var crossR221; + var crossR222; + crossR100 = 0; + crossR101 = -this._relativeAnchor1Z; + crossR102 = this._relativeAnchor1Y; + crossR110 = this._relativeAnchor1Z; + crossR111 = 0; + crossR112 = -this._relativeAnchor1X; + crossR120 = -this._relativeAnchor1Y; + crossR121 = this._relativeAnchor1X; + crossR122 = 0; + crossR200 = 0; + crossR201 = -this._relativeAnchor2Z; + crossR202 = this._relativeAnchor2Y; + crossR210 = this._relativeAnchor2Z; + crossR211 = 0; + crossR212 = -this._relativeAnchor2X; + crossR220 = -this._relativeAnchor2Y; + crossR221 = this._relativeAnchor2X; + crossR222 = 0; + crossR100 = -crossR100; + crossR101 = -crossR101; + crossR102 = -crossR102; + crossR110 = -crossR110; + crossR111 = -crossR111; + crossR112 = -crossR112; + crossR120 = -crossR120; + crossR121 = -crossR121; + crossR122 = -crossR122; + crossR200 = -crossR200; + crossR201 = -crossR201; + crossR202 = -crossR202; + crossR210 = -crossR210; + crossR211 = -crossR211; + crossR212 = -crossR212; + crossR220 = -crossR220; + crossR221 = -crossR221; + crossR222 = -crossR222; + var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + var impulse = this._impulses[0]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + var row1 = row; + row1.rhs = linRhsX; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + var j = row1.jacobian; + j.lin1X = 1; + j.lin1Y = 0; + j.lin1Z = 0; + j.lin2X = 1; + j.lin2Y = 0; + j.lin2Z = 0; + j.ang1X = crossR100; + j.ang1Y = crossR101; + j.ang1Z = crossR102; + j.ang2X = crossR200; + j.ang2Y = crossR201; + j.ang2Z = crossR202; + var impulse1 = this._impulses[1]; + var row2 = info.rows[info.numRows++]; + var _this1 = row2.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse1; + row1 = row2; + row1.rhs = linRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 1; + j.lin1Z = 0; + j.lin2X = 0; + j.lin2Y = 1; + j.lin2Z = 0; + j.ang1X = crossR110; + j.ang1Y = crossR111; + j.ang1Z = crossR112; + j.ang2X = crossR210; + j.ang2Y = crossR211; + j.ang2Z = crossR212; + var impulse2 = this._impulses[2]; + var row3 = info.rows[info.numRows++]; + var _this2 = row3.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse2; + row1 = row3; + row1.rhs = linRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.lin1X = 0; + j.lin1Y = 0; + j.lin1Z = 1; + j.lin2X = 0; + j.lin2Y = 0; + j.lin2Z = 1; + j.ang1X = crossR120; + j.ang1Y = crossR121; + j.ang1Z = crossR122; + j.ang2X = crossR220; + j.ang2Y = crossR221; + j.ang2Z = crossR222; + if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { + var impulse3 = this._impulses[3]; + var row4 = info.rows[info.numRows++]; + var _this3 = row4.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse3; + row1 = row4; + this.setSolverInfoRowAngular(row1,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row1.jacobian; + j.ang1X = this._axisXX; + j.ang1Y = this._axisXY; + j.ang1Z = this._axisXZ; + j.ang2X = this._axisXX; + j.ang2Y = this._axisXY; + j.ang2Z = this._axisXZ; + } + if(!this.ySingular) { + var impulse4 = this._impulses[4]; + var row5 = info.rows[info.numRows++]; + var _this4 = row5.jacobian; + _this4.lin1X = 0; + _this4.lin1Y = 0; + _this4.lin1Z = 0; + _this4.lin2X = 0; + _this4.lin2Y = 0; + _this4.lin2Z = 0; + _this4.ang1X = 0; + _this4.ang1Y = 0; + _this4.ang1Z = 0; + _this4.ang2X = 0; + _this4.ang2Y = 0; + _this4.ang2Z = 0; + row5.rhs = 0; + row5.cfm = 0; + row5.minImpulse = 0; + row5.maxImpulse = 0; + row5.motorSpeed = 0; + row5.motorMaxImpulse = 0; + row5.impulse = null; + row5.impulse = impulse4; + row1 = row5; + row1.rhs = angRhsY; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; + j.ang1X = this._axisYX; + j.ang1Y = this._axisYY; + j.ang1Z = this._axisYZ; + j.ang2X = this._axisYX; + j.ang2Y = this._axisYY; + j.ang2Z = this._axisYZ; + } + if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { + var impulse5 = this._impulses[5]; + var row6 = info.rows[info.numRows++]; + var _this5 = row6.jacobian; + _this5.lin1X = 0; + _this5.lin1Y = 0; + _this5.lin1Z = 0; + _this5.lin2X = 0; + _this5.lin2Y = 0; + _this5.lin2Z = 0; + _this5.ang1X = 0; + _this5.ang1Y = 0; + _this5.ang1Z = 0; + _this5.ang2X = 0; + _this5.ang2Y = 0; + _this5.ang2Z = 0; + row6.rhs = 0; + row6.cfm = 0; + row6.minImpulse = 0; + row6.maxImpulse = 0; + row6.motorSpeed = 0; + row6.motorMaxImpulse = 0; + row6.impulse = null; + row6.impulse = impulse5; + row1 = row6; + this.setSolverInfoRowAngular(row1,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row1.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; + } + } + _syncAnchors() { + super._syncAnchors(); + var rot1; + var rot100; + var rot101; + var rot102; + var rot110; + var rot111; + var rot112; + var rot120; + var rot121; + var rot122; + var rot2; + var rot200; + var rot201; + var rot202; + var rot210; + var rot211; + var rot212; + var rot220; + var rot221; + var rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + var relRot; + var relRot00; + var relRot01; + var relRot02; + var relRot10; + var relRot11; + var relRot12; + var relRot20; + var relRot21; + var relRot22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__10 = rot101 * rot200 + rot111 * rot210 + rot121 * rot220; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__20 = rot102 * rot200 + rot112 * rot210 + rot122 * rot220; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot10 = __tmp__10; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot20 = __tmp__20; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + var angleAxisX; + var angleAxisXX; + var angleAxisXY; + var angleAxisXZ; + var angleAxisY; + var angleAxisYX; + var angleAxisYY; + var angleAxisYZ; + var angleAxisZ; + var angleAxisZX; + var angleAxisZY; + var angleAxisZZ; + angleAxisXX = this._basisX1X; + angleAxisXY = this._basisX1Y; + angleAxisXZ = this._basisX1Z; + angleAxisZX = this._basisZ2X; + angleAxisZY = this._basisZ2Y; + angleAxisZZ = this._basisZ2Z; + angleAxisYX = angleAxisZY * angleAxisXZ - angleAxisZZ * angleAxisXY; + angleAxisYY = angleAxisZZ * angleAxisXX - angleAxisZX * angleAxisXZ; + angleAxisYZ = angleAxisZX * angleAxisXY - angleAxisZY * angleAxisXX; + this._axisXX = angleAxisYY * angleAxisZZ - angleAxisYZ * angleAxisZY; + this._axisXY = angleAxisYZ * angleAxisZX - angleAxisYX * angleAxisZZ; + this._axisXZ = angleAxisYX * angleAxisZY - angleAxisYY * angleAxisZX; + this._axisYX = angleAxisYX; + this._axisYY = angleAxisYY; + this._axisYZ = angleAxisYZ; + this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; + this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; + this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; + var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisXX *= l; + this._axisXY *= l; + this._axisXZ *= l; + var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l1 > 0) { + l1 = 1 / Math.sqrt(l1); + } + this._axisYX *= l1; + this._axisYY *= l1; + this._axisYZ *= l1; + var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l2 > 0) { + l2 = 1 / Math.sqrt(l2); + } + this._axisZX *= l2; + this._axisZY *= l2; + this._axisZZ *= l2; + this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; + this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; + this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; + var rot11; + var rot1001; + var rot1011; + var rot1021; + var rot1101; + var rot1111; + var rot1121; + var rot1201; + var rot1211; + var rot1221; + var rot21; + var rot2001; + var rot2011; + var rot2021; + var rot2101; + var rot2111; + var rot2121; + var rot2201; + var rot2211; + var rot2221; + rot1001 = this._basisX1X; + rot1011 = this._basisY1X; + rot1021 = this._basisZ1X; + rot1101 = this._basisX1Y; + rot1111 = this._basisY1Y; + rot1121 = this._basisZ1Y; + rot1201 = this._basisX1Z; + rot1211 = this._basisY1Z; + rot1221 = this._basisZ1Z; + rot2001 = this._basisX2X; + rot2011 = this._basisY2X; + rot2021 = this._basisZ2X; + rot2101 = this._basisX2Y; + rot2111 = this._basisY2Y; + rot2121 = this._basisZ2Y; + rot2201 = this._basisX2Z; + rot2211 = this._basisY2Z; + rot2221 = this._basisZ2Z; + var relRot1; + var relRot001; + var relRot011; + var relRot021; + var relRot101; + var relRot111; + var relRot121; + var relRot201; + var relRot211; + var relRot221; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = rot1001 * rot2001 + rot1101 * rot2101 + rot1201 * rot2201; + __tmp__011 = rot1001 * rot2011 + rot1101 * rot2111 + rot1201 * rot2211; + __tmp__021 = rot1001 * rot2021 + rot1101 * rot2121 + rot1201 * rot2221; + __tmp__101 = rot1011 * rot2001 + rot1111 * rot2101 + rot1211 * rot2201; + __tmp__111 = rot1011 * rot2011 + rot1111 * rot2111 + rot1211 * rot2211; + __tmp__121 = rot1011 * rot2021 + rot1111 * rot2121 + rot1211 * rot2221; + __tmp__201 = rot1021 * rot2001 + rot1121 * rot2101 + rot1221 * rot2201; + __tmp__211 = rot1021 * rot2011 + rot1121 * rot2111 + rot1221 * rot2211; + __tmp__221 = rot1021 * rot2021 + rot1121 * rot2121 + rot1221 * rot2221; + relRot001 = __tmp__001; + relRot011 = __tmp__011; + relRot021 = __tmp__021; + relRot101 = __tmp__101; + relRot111 = __tmp__111; + relRot121 = __tmp__121; + relRot201 = __tmp__201; + relRot211 = __tmp__211; + relRot221 = __tmp__221; + var angles; + var anglesX; + var anglesY; + var anglesZ; + var sy = relRot021; + if(sy <= -1) { + var xSubZ = Math.atan2(relRot211,relRot111); + anglesX = xSubZ * 0.5; + anglesY = -1.570796326794895; + anglesZ = -xSubZ * 0.5; + } else if(sy >= 1) { + var xAddZ = Math.atan2(relRot211,relRot111); + anglesX = xAddZ * 0.5; + anglesY = 1.570796326794895; + anglesZ = xAddZ * 0.5; + } else { + var y = Math.asin(sy); + var x = Math.atan2(-relRot121,relRot221); + var z = Math.atan2(-relRot011,relRot001); + anglesX = x; + anglesY = y; + anglesZ = z; + } + this._angleX = anglesX; + this._angleY = anglesY; + this._angleZ = anglesZ; + this.linearErrorX = this._anchor2X - this._anchor1X; + this.linearErrorY = this._anchor2Y - this._anchor1Y; + this.linearErrorZ = this._anchor2Z - this._anchor1Z; + } + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); + this.getInfo(info,timeStep,false); + } + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); + this.getInfo(info,null,true); + } + getAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisX1X; + v1.y = this._basisX1Y; + v1.z = this._basisX1Z; + return v; + } + getAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._basisZ2X; + v1.y = this._basisZ2Y; + v1.z = this._basisZ2Z; + return v; + } + getAxis1To(axis) { + var v = axis; + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; + } + getAxis2To(axis) { + var v = axis; + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; + } + getLocalAxis1() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisX1X; + v1.y = this._localBasisX1Y; + v1.z = this._localBasisX1Z; + return v; + } + getLocalAxis2() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._localBasisZ2X; + v1.y = this._localBasisZ2Y; + v1.z = this._localBasisZ2Z; + return v; + } + getLocalAxis1To(axis) { + var v = axis; + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; + } + getLocalAxis2To(axis) { + var v = axis; + v.x = this._localBasisZ2X; + v.y = this._localBasisZ2Y; + v.z = this._localBasisZ2Z; + } + getSpringDamper1() { + return this._sd1; + } + getSpringDamper2() { + return this._sd2; + } + getLimitMotor1() { + return this._lm1; + } + getLimitMotor2() { + return this._lm2; + } + getAngle1() { + return this._angleX; + } + getAngle2() { + return this._angleZ; + } +} +oimo.dynamics.constraint.joint.UniversalJointConfig = class oimo_dynamics_constraint_joint_UniversalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo.common.Vec3(1,0,0); + this.localAxis2 = new oimo.common.Vec3(1,0,0); + this.springDamper1 = new oimo.dynamics.constraint.joint.SpringDamper(); + this.springDamper2 = new oimo.dynamics.constraint.joint.SpringDamper(); + this.limitMotor1 = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + this.limitMotor2 = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { + this._init(rigidBody1,rigidBody2,worldAnchor); + var v; + var vX; + var vY; + var vZ; + var v1 = worldAxis1; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = this.localAxis1; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + var v3; + var vX1; + var vY1; + var vZ1; + var v4 = worldAxis2; + vX1 = v4.x; + vY1 = v4.y; + vZ1 = v4.z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; + __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; + __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; + vX1 = __tmp__X1; + vY1 = __tmp__Y1; + vZ1 = __tmp__Z1; + var v5 = this.localAxis2; + v5.x = vX1; + v5.y = vY1; + v5.z = vZ1; + return this; + } +} +if(!oimo.dynamics.constraint.solver) oimo.dynamics.constraint.solver = {}; +oimo.dynamics.constraint.solver.ConstraintSolverType = class oimo_dynamics_constraint_solver_ConstraintSolverType { +} +if(!oimo.dynamics.constraint.solver.common) oimo.dynamics.constraint.solver.common = {}; +oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow = class oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow { + constructor() { + this.invMLinN1X = 0; + this.invMLinN1Y = 0; + this.invMLinN1Z = 0; + this.invMLinN2X = 0; + this.invMLinN2Y = 0; + this.invMLinN2Z = 0; + this.invMAngN1X = 0; + this.invMAngN1Y = 0; + this.invMAngN1Z = 0; + this.invMAngN2X = 0; + this.invMAngN2Y = 0; + this.invMAngN2Z = 0; + this.invMLinT1X = 0; + this.invMLinT1Y = 0; + this.invMLinT1Z = 0; + this.invMLinT2X = 0; + this.invMLinT2Y = 0; + this.invMLinT2Z = 0; + this.invMAngT1X = 0; + this.invMAngT1Y = 0; + this.invMAngT1Z = 0; + this.invMAngT2X = 0; + this.invMAngT2Y = 0; + this.invMAngT2Z = 0; + this.invMLinB1X = 0; + this.invMLinB1Y = 0; + this.invMLinB1Z = 0; + this.invMLinB2X = 0; + this.invMLinB2Y = 0; + this.invMLinB2Z = 0; + this.invMAngB1X = 0; + this.invMAngB1Y = 0; + this.invMAngB1Z = 0; + this.invMAngB2X = 0; + this.invMAngB2Y = 0; + this.invMAngB2Z = 0; + this.massN = 0; + this.massTB00 = 0; + this.massTB01 = 0; + this.massTB10 = 0; + this.massTB11 = 0; + } +} +oimo.dynamics.constraint.solver.common.JointSolverMassDataRow = class oimo_dynamics_constraint_solver_common_JointSolverMassDataRow { + constructor() { + this.invMLin1X = 0; + this.invMLin1Y = 0; + this.invMLin1Z = 0; + this.invMLin2X = 0; + this.invMLin2Y = 0; + this.invMLin2Z = 0; + this.invMAng1X = 0; + this.invMAng1Y = 0; + this.invMAng1Z = 0; + this.invMAng2X = 0; + this.invMAng2Y = 0; + this.invMAng2Z = 0; + this.mass = 0; + this.massWithoutCfm = 0; + } +} +if(!oimo.dynamics.constraint.solver.direct) oimo.dynamics.constraint.solver.direct = {}; +oimo.dynamics.constraint.solver.direct.Boundary = class oimo_dynamics_constraint_solver_direct_Boundary { + constructor(maxRows) { + var this1 = new Array(maxRows); + this.iBounded = this1; + var this2 = new Array(maxRows); + this.iUnbounded = this2; + var this3 = new Array(maxRows); + this.signs = this3; + var this4 = new Array(maxRows); + this.b = this4; + this.numBounded = 0; + this.numUnbounded = 0; + this.matrixId = 0; + } + init(buildInfo) { + this.numBounded = buildInfo.numBounded; + var _g = 0; + var _g1 = this.numBounded; + while(_g < _g1) { + var i = _g++; + this.iBounded[i] = buildInfo.iBounded[i]; + this.signs[i] = buildInfo.signs[i]; + } + this.numUnbounded = buildInfo.numUnbounded; + this.matrixId = 0; + var _g2 = 0; + var _g3 = this.numUnbounded; + while(_g2 < _g3) { + var i1 = _g2++; + var idx = buildInfo.iUnbounded[i1]; + this.iUnbounded[i1] = idx; + this.matrixId |= 1 << idx; + } + } + computeImpulses(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { + var _g = 0; + var _g1 = this.numUnbounded; + while(_g < _g1) { + var i = _g++; + var idx = this.iUnbounded[i]; + var row = info.rows[idx]; + var relVel = relVels[idx]; + this.b[idx] = row.rhs * impulseFactor - relVel - row.cfm * impulses[idx]; + } + var invMassWithoutCfm = mass._invMassWithoutCfm; + var _g2 = 0; + var _g3 = this.numBounded; + while(_g2 < _g3) { + var i1 = _g2++; + var idx1 = this.iBounded[i1]; + var sign = this.signs[i1]; + var row1 = info.rows[idx1]; + var oldImpulse = impulses[idx1]; + var impulse = sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0; + var dImpulse = impulse - oldImpulse; + dImpulses[idx1] = dImpulse; + if(dImpulse != 0) { + var _g21 = 0; + var _g31 = this.numUnbounded; + while(_g21 < _g31) { + var j = _g21++; + var idx2 = this.iUnbounded[j]; + var dRelVel = invMassWithoutCfm[idx1][idx2] * dImpulse; + var _g22 = idx2; + var _g32 = this.b; + _g32[_g22] = _g32[_g22] - dRelVel; + } + } + } + var indices = this.iUnbounded; + var n = this.numUnbounded; + var id = 0; + var _g4 = 0; + var _g11 = n; + while(_g4 < _g11) { + var i2 = _g4++; + id |= 1 << indices[i2]; + } + var massMatrix; + if(mass._cacheComputed[id]) { + massMatrix = mass._cachedSubmatrices[id]; + } else { + mass.computeSubmatrix(id,indices,n); + mass._cacheComputed[id] = true; + massMatrix = mass._cachedSubmatrices[id]; + } + var ok = true; + var _g41 = 0; + var _g5 = this.numUnbounded; + while(_g41 < _g5) { + var i3 = _g41++; + var idx3 = this.iUnbounded[i3]; + var row2 = info.rows[idx3]; + var oldImpulse1 = impulses[idx3]; + var impulse1 = oldImpulse1; + var _g42 = 0; + var _g51 = this.numUnbounded; + while(_g42 < _g51) { + var j1 = _g42++; + var idx21 = this.iUnbounded[j1]; + impulse1 += this.b[idx21] * massMatrix[i3][j1]; + } + if(impulse1 < row2.minImpulse - oimo.common.Setting.directMlcpSolverEps || impulse1 > row2.maxImpulse + oimo.common.Setting.directMlcpSolverEps) { + ok = false; + break; + } + dImpulses[idx3] = impulse1 - oldImpulse1; + } + if(noCheck) { + return true; + } + if(!ok) { + return false; + } + var _g6 = 0; + var _g7 = this.numBounded; + while(_g6 < _g7) { + var i4 = _g6++; + var idx4 = this.iBounded[i4]; + var row3 = info.rows[idx4]; + var sign1 = this.signs[i4]; + var error = 0; + var newImpulse = impulses[idx4] + dImpulses[idx4]; + var relVel1 = relVels[idx4]; + var _g61 = 0; + var _g71 = info.numRows; + while(_g61 < _g71) { + var j2 = _g61++; + relVel1 += invMassWithoutCfm[idx4][j2] * dImpulses[j2]; + } + error = row3.rhs * impulseFactor - relVel1 - row3.cfm * newImpulse; + if(sign1 < 0 && error > oimo.common.Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo.common.Setting.directMlcpSolverEps) { + ok = false; + break; + } + } + return ok; + } +} +oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo = class oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo { + constructor(size) { + this.size = size; + this.numBounded = 0; + var this1 = new Array(size); + this.iBounded = this1; + var this2 = new Array(size); + this.signs = this2; + this.numUnbounded = 0; + var this3 = new Array(size); + this.iUnbounded = this3; + } +} +oimo.dynamics.constraint.solver.direct.BoundaryBuilder = class oimo_dynamics_constraint_solver_direct_BoundaryBuilder { + constructor(maxRows) { + this.maxRows = maxRows; + this.numBoundaries = 0; + var this1 = new Array(1 << maxRows); + this.boundaries = this1; + this.bbInfo = new oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo(maxRows); + } + buildBoundariesRecursive(info,i) { + if(i == info.numRows) { + if(this.boundaries[this.numBoundaries] == null) { + this.boundaries[this.numBoundaries] = new oimo.dynamics.constraint.solver.direct.Boundary(this.maxRows); + } + this.boundaries[this.numBoundaries++].init(this.bbInfo); + return; + } + var row = info.rows[i]; + var lowerLimitEnabled = row.minImpulse > -1e65536; + var upperLimitEnabled = row.maxImpulse < 1e65536; + var disabled = row.minImpulse == 0 && row.maxImpulse == 0; + if(disabled) { + var _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = 0; + _this.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + return; + } + var _this1 = this.bbInfo; + _this1.iUnbounded[_this1.numUnbounded] = i; + _this1.numUnbounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numUnbounded--; + if(lowerLimitEnabled) { + var _this2 = this.bbInfo; + _this2.iBounded[_this2.numBounded] = i; + _this2.signs[_this2.numBounded] = -1; + _this2.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + } + if(upperLimitEnabled) { + var _this3 = this.bbInfo; + _this3.iBounded[_this3.numBounded] = i; + _this3.signs[_this3.numBounded] = 1; + _this3.numBounded++; + this.buildBoundariesRecursive(info,i + 1); + this.bbInfo.numBounded--; + } + } + buildBoundaries(info) { + this.numBoundaries = 0; + var _this = this.bbInfo; + _this.numBounded = 0; + _this.numUnbounded = 0; + this.buildBoundariesRecursive(info,0); + } +} +oimo.dynamics.constraint.solver.direct.BoundarySelector = class oimo_dynamics_constraint_solver_direct_BoundarySelector { + constructor(n) { + this.n = n; + var this1 = new Array(n); + this.indices = this1; + var this2 = new Array(n); + this.tmpIndices = this2; + var _g = 0; + var _g1 = n; + while(_g < _g1) { + var i = _g++; + this.indices[i] = i; + } + } + getIndex(i) { + return this.indices[i]; + } + select(index) { + var i = 0; + while(this.indices[i] != index) ++i; + while(i > 0) { + var tmp = this.indices[i]; + this.indices[i] = this.indices[i - 1]; + this.indices[i - 1] = tmp; + --i; + } + } + setSize(size) { + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = this.n; + while(_g < _g1) { + var i = _g++; + var idx = this.indices[i]; + if(idx < size) { + this.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + this.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = this.indices; + this.indices = this.tmpIndices; + this.tmpIndices = tmp; + } +} +oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(joint) { + super(); + this.joint = joint; + this.info = new oimo.dynamics.constraint.info.joint.JointSolverInfo(); + var maxRows = oimo.common.Setting.maxJacobianRows; + this.massMatrix = new oimo.dynamics.constraint.solver.direct.MassMatrix(maxRows); + this.boundaryBuilder = new oimo.dynamics.constraint.solver.direct.BoundaryBuilder(maxRows); + var this1 = new Array(maxRows); + this.massData = this1; + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) { + var i = _g++; + this.massData[i] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); + } + var numMaxBoundaries = this.boundaryBuilder.boundaries.length; + this.velBoundarySelector = new oimo.dynamics.constraint.solver.direct.BoundarySelector(numMaxBoundaries); + this.posBoundarySelector = new oimo.dynamics.constraint.solver.direct.BoundarySelector(numMaxBoundaries); + var this2 = new Array(maxRows); + this.relVels = this2; + var this3 = new Array(maxRows); + this.impulses = this3; + var this4 = new Array(maxRows); + this.dImpulses = this4; + var this5 = new Array(maxRows); + this.dTotalImpulses = this5; + var _g2 = 0; + var _g3 = maxRows; + while(_g2 < _g3) { + var i1 = _g2++; + this.relVels[i1] = 0; + this.impulses[i1] = 0; + this.dImpulses[i1] = 0; + this.dTotalImpulses[i1] = 0; + } + } + preSolveVelocity(timeStep) { + this.joint._syncAnchors(); + this.joint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.velBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var i = _g++; + var idx = _this2.indices[i]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + } + warmStart(timeStep) { + var factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; + factor *= timeStep.dtRatio; + if(factor <= 0) { + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var _this = row.impulse; + _this.impulse = 0; + _this.impulseM = 0; + _this.impulseP = 0; + } + return; + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var imp = row1.impulse; + var impulse = imp.impulse * factor; + if(impulse < row1.minImpulse) { + impulse = row1.minImpulse; + } else if(impulse > row1.maxImpulse) { + impulse = row1.maxImpulse; + } + imp.impulse = impulse; + if(row1.motorMaxImpulse > 0) { + var impulseM = imp.impulseM * factor; + var max = row1.motorMaxImpulse; + if(impulseM < -max) { + impulseM = -max; + } else if(impulseM > max) { + impulseM = max; + } + imp.impulseM = impulseM; + } else { + imp.impulseM = 0; + } + this.dImpulses[i1] = imp.impulse + imp.impulseM; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g3 = 0; + var _g12 = this.info.numRows; + while(_g3 < _g12) { + var i2 = _g3++; + var row2 = this.info.rows[i2]; + var j = row2.jacobian; + var md = this.massData[i2]; + var imp1 = impulses[i2]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp1; + lv1Y += md.invMLin1Y * imp1; + lv1Z += md.invMLin1Z * imp1; + lv2X += md.invMLin2X * -imp1; + lv2Y += md.invMLin2Y * -imp1; + lv2Z += md.invMLin2Z * -imp1; + linearSet = true; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp1; + av1Y += md.invMAng1Y * imp1; + av1Z += md.invMAng1Z * imp1; + av2X += md.invMAng2X * -imp1; + av2Y += md.invMAng2Y * -imp1; + av2Z += md.invMAng2Z * -imp1; + angularSet = true; + } + } + if(linearSet) { + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + } + if(angularSet) { + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + } + solveVelocity() { + var numRows = this.info.numRows; + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var j = row.jacobian; + var relVel = 0; + relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + this.relVels[i] = relVel; + this.impulses[i] = imp.impulse; + this.dTotalImpulses[i] = 0; + } + var invMass = this.massMatrix._invMassWithoutCfm; + var _g2 = 0; + var _g3 = numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var imp1 = row1.impulse; + var md = this.massData[i1]; + if(row1.motorMaxImpulse > 0) { + var oldImpulseM = imp1.impulseM; + var impulseM = oldImpulseM + md.massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); + var maxImpulseM = row1.motorMaxImpulse; + if(impulseM < -maxImpulseM) { + impulseM = -maxImpulseM; + } else if(impulseM > maxImpulseM) { + impulseM = maxImpulseM; + } + imp1.impulseM = impulseM; + var dImpulseM = impulseM - oldImpulseM; + this.dTotalImpulses[i1] = dImpulseM; + var _g21 = 0; + var _g31 = numRows; + while(_g21 < _g31) { + var j1 = _g21++; + var _g22 = j1; + var _g32 = this.relVels; + _g32[_g22] = _g32[_g22] + dImpulseM * invMass[i1][j1]; + } + } + } + var solved = false; + var _g4 = 0; + var _g5 = this.boundaryBuilder.numBoundaries; + while(_g4 < _g5) { + var i2 = _g4++; + var idx = this.velBoundarySelector.indices[i2]; + var b = this.boundaryBuilder.boundaries[idx]; + if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { + var _g41 = 0; + var _g51 = numRows; + while(_g41 < _g51) { + var j2 = _g41++; + var row2 = this.info.rows[j2]; + var imp2 = row2.impulse; + var dimp = this.dImpulses[j2]; + imp2.impulse += dimp; + var _g42 = j2; + var _g52 = this.dTotalImpulses; + _g52[_g42] = _g52[_g42] + dimp; + } + var impulses = this.dTotalImpulses; + var linearSet = false; + var angularSet = false; + var lv11; + var lv1X1; + var lv1Y1; + var lv1Z1; + var lv21; + var lv2X1; + var lv2Y1; + var lv2Z1; + var av11; + var av1X1; + var av1Y1; + var av1Z1; + var av21; + var av2X1; + var av2Y1; + var av2Z1; + lv1X1 = this._b1._velX; + lv1Y1 = this._b1._velY; + lv1Z1 = this._b1._velZ; + lv2X1 = this._b2._velX; + lv2Y1 = this._b2._velY; + lv2Z1 = this._b2._velZ; + av1X1 = this._b1._angVelX; + av1Y1 = this._b1._angVelY; + av1Z1 = this._b1._angVelZ; + av2X1 = this._b2._angVelX; + av2Y1 = this._b2._angVelY; + av2Z1 = this._b2._angVelZ; + var _g6 = 0; + var _g11 = this.info.numRows; + while(_g6 < _g11) { + var i3 = _g6++; + var row3 = this.info.rows[i3]; + var j3 = row3.jacobian; + var md1 = this.massData[i3]; + var imp3 = impulses[i3]; + if((j3.flag & 1) != 0) { + lv1X1 += md1.invMLin1X * imp3; + lv1Y1 += md1.invMLin1Y * imp3; + lv1Z1 += md1.invMLin1Z * imp3; + lv2X1 += md1.invMLin2X * -imp3; + lv2Y1 += md1.invMLin2Y * -imp3; + lv2Z1 += md1.invMLin2Z * -imp3; + linearSet = true; + } + if((j3.flag & 2) != 0) { + av1X1 += md1.invMAng1X * imp3; + av1Y1 += md1.invMAng1Y * imp3; + av1Z1 += md1.invMAng1Z * imp3; + av2X1 += md1.invMAng2X * -imp3; + av2Y1 += md1.invMAng2Y * -imp3; + av2Z1 += md1.invMAng2Z * -imp3; + angularSet = true; + } + } + if(linearSet) { + this._b1._velX = lv1X1; + this._b1._velY = lv1Y1; + this._b1._velZ = lv1Z1; + this._b2._velX = lv2X1; + this._b2._velY = lv2Y1; + this._b2._velZ = lv2Z1; + } + if(angularSet) { + this._b1._angVelX = av1X1; + this._b1._angVelY = av1Y1; + this._b1._angVelZ = av1Z1; + this._b2._angVelX = av2X1; + this._b2._angVelY = av2Y1; + this._b2._angVelZ = av2Z1; + } + var _this = this.velBoundarySelector; + var i4 = 0; + while(_this.indices[i4] != idx) ++i4; + while(i4 > 0) { + var tmp = _this.indices[i4]; + _this.indices[i4] = _this.indices[i4 - 1]; + _this.indices[i4 - 1] = tmp; + --i4; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:335:","could not find solution. (velocity)"); + return; + } + } + postSolveVelocity(timeStep) { + var lin; + var linX; + var linY; + var linZ; + var ang; + var angX; + var angY; + var angZ; + linX = 0; + linY = 0; + linZ = 0; + angX = 0; + angY = 0; + angZ = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var j = row.jacobian; + if((j.flag & 1) != 0) { + linX += j.lin1X * imp.impulse; + linY += j.lin1Y * imp.impulse; + linZ += j.lin1Z * imp.impulse; + } else if((j.flag & 2) != 0) { + angX += j.ang1X * imp.impulse; + angY += j.ang1Y * imp.impulse; + angZ += j.ang1Z * imp.impulse; + } + } + this.joint._appliedForceX = linX * timeStep.invDt; + this.joint._appliedForceY = linY * timeStep.invDt; + this.joint._appliedForceZ = linZ * timeStep.invDt; + this.joint._appliedTorqueX = angX * timeStep.invDt; + this.joint._appliedTorqueY = angY * timeStep.invDt; + this.joint._appliedTorqueZ = angZ * timeStep.invDt; + } + preSolvePosition(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.posBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var i = _g++; + var idx = _this2.indices[i]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + this.info.rows[i1].impulse.impulseP = 0; + } + } + solvePositionSplitImpulse() { + var numRows = this.info.numRows; + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + var _g1 = numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var j = row.jacobian; + var relVel = 0; + relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + this.relVels[i] = relVel; + this.impulses[i] = imp.impulseP; + } + var solved = false; + var _g2 = 0; + var _g3 = this.boundaryBuilder.numBoundaries; + while(_g2 < _g3) { + var i1 = _g2++; + var idx = this.posBoundarySelector.indices[i1]; + var b = this.boundaryBuilder.boundaries[idx]; + if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionSplitImpulseBaumgarte,false)) { + var _g21 = 0; + var _g31 = numRows; + while(_g21 < _g31) { + var j1 = _g21++; + var row1 = this.info.rows[j1]; + var imp1 = row1.impulse; + var dimp = this.dImpulses[j1]; + imp1.impulseP += dimp; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv11; + var lv1X1; + var lv1Y1; + var lv1Z1; + var lv21; + var lv2X1; + var lv2Y1; + var lv2Z1; + var av11; + var av1X1; + var av1Y1; + var av1Z1; + var av21; + var av2X1; + var av2Y1; + var av2Z1; + lv1X1 = this._b1._pseudoVelX; + lv1Y1 = this._b1._pseudoVelY; + lv1Z1 = this._b1._pseudoVelZ; + lv2X1 = this._b2._pseudoVelX; + lv2Y1 = this._b2._pseudoVelY; + lv2Z1 = this._b2._pseudoVelZ; + av1X1 = this._b1._angPseudoVelX; + av1Y1 = this._b1._angPseudoVelY; + av1Z1 = this._b1._angPseudoVelZ; + av2X1 = this._b2._angPseudoVelX; + av2Y1 = this._b2._angPseudoVelY; + av2Z1 = this._b2._angPseudoVelZ; + var _g4 = 0; + var _g11 = this.info.numRows; + while(_g4 < _g11) { + var i2 = _g4++; + var row2 = this.info.rows[i2]; + var j2 = row2.jacobian; + var md = this.massData[i2]; + var imp2 = impulses[i2]; + if((j2.flag & 1) != 0) { + lv1X1 += md.invMLin1X * imp2; + lv1Y1 += md.invMLin1Y * imp2; + lv1Z1 += md.invMLin1Z * imp2; + lv2X1 += md.invMLin2X * -imp2; + lv2Y1 += md.invMLin2Y * -imp2; + lv2Z1 += md.invMLin2Z * -imp2; + linearSet = true; + } + if((j2.flag & 2) != 0) { + av1X1 += md.invMAng1X * imp2; + av1Y1 += md.invMAng1Y * imp2; + av1Z1 += md.invMAng1Z * imp2; + av2X1 += md.invMAng2X * -imp2; + av2Y1 += md.invMAng2Y * -imp2; + av2Z1 += md.invMAng2Z * -imp2; + angularSet = true; + } + } + if(linearSet) { + this._b1._pseudoVelX = lv1X1; + this._b1._pseudoVelY = lv1Y1; + this._b1._pseudoVelZ = lv1Z1; + this._b2._pseudoVelX = lv2X1; + this._b2._pseudoVelY = lv2Y1; + this._b2._pseudoVelZ = lv2Z1; + } + if(angularSet) { + this._b1._angPseudoVelX = av1X1; + this._b1._angPseudoVelY = av1Y1; + this._b1._angPseudoVelZ = av1Z1; + this._b2._angPseudoVelX = av2X1; + this._b2._angPseudoVelY = av2Y1; + this._b2._angPseudoVelZ = av2Z1; + } + var _this = this.posBoundarySelector; + var i3 = 0; + while(_this.indices[i3] != idx) ++i3; + while(i3 > 0) { + var tmp = _this.indices[i3]; + _this.indices[i3] = _this.indices[i3 - 1]; + _this.indices[i3 - 1] = tmp; + --i3; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:450:","could not find solution. (split impulse)"); + return; + } + } + solvePositionNgs(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + this.massMatrix.computeInvMass(this.info,this.massData); + var _this = this.boundaryBuilder; + _this.numBoundaries = 0; + var _this1 = _this.bbInfo; + _this1.numBounded = 0; + _this1.numUnbounded = 0; + _this.buildBoundariesRecursive(this.info,0); + var _this2 = this.posBoundarySelector; + var size = this.boundaryBuilder.numBoundaries; + var numSmaller = 0; + var numGreater = 0; + var _g = 0; + var _g1 = _this2.n; + while(_g < _g1) { + var i = _g++; + var idx = _this2.indices[i]; + if(idx < size) { + _this2.tmpIndices[numSmaller] = idx; + ++numSmaller; + } else { + _this2.tmpIndices[size + numGreater] = idx; + ++numGreater; + } + } + var tmp = _this2.indices; + _this2.indices = _this2.tmpIndices; + _this2.tmpIndices = tmp; + var numRows = this.info.numRows; + var _g2 = 0; + var _g11 = numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row = this.info.rows[i1]; + var imp = row.impulse; + var j = row.jacobian; + this.relVels[i1] = 0; + this.impulses[i1] = imp.impulseP; + } + var solved = false; + var _g21 = 0; + var _g3 = this.boundaryBuilder.numBoundaries; + while(_g21 < _g3) { + var i2 = _g21++; + var idx1 = this.posBoundarySelector.indices[i2]; + var b = this.boundaryBuilder.boundaries[idx1]; + if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionNgsBaumgarte,false)) { + var _g22 = 0; + var _g31 = numRows; + while(_g22 < _g31) { + var j1 = _g22++; + var row1 = this.info.rows[j1]; + var imp1 = row1.impulse; + var dimp = this.dImpulses[j1]; + imp1.impulseP += dimp; + } + var impulses = this.dImpulses; + var linearSet = false; + var angularSet = false; + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g4 = 0; + var _g12 = this.info.numRows; + while(_g4 < _g12) { + var i3 = _g4++; + var row2 = this.info.rows[i3]; + var j2 = row2.jacobian; + var md = this.massData[i3]; + var imp2 = impulses[i3]; + if((j2.flag & 1) != 0) { + lv1X += md.invMLin1X * imp2; + lv1Y += md.invMLin1Y * imp2; + lv1Z += md.invMLin1Z * imp2; + lv2X += md.invMLin2X * -imp2; + lv2Y += md.invMLin2Y * -imp2; + lv2Z += md.invMLin2Z * -imp2; + linearSet = true; + } + if((j2.flag & 2) != 0) { + av1X += md.invMAng1X * imp2; + av1Y += md.invMAng1Y * imp2; + av1Z += md.invMAng1Z * imp2; + av2X += md.invMAng2X * -imp2; + av2Y += md.invMAng2Y * -imp2; + av2Z += md.invMAng2Z * -imp2; + angularSet = true; + } + } + if(linearSet) { + var _this3 = this._b1; + _this3._transform._positionX += lv1X; + _this3._transform._positionY += lv1Y; + _this3._transform._positionZ += lv1Z; + var _this4 = this._b2; + _this4._transform._positionX += lv2X; + _this4._transform._positionY += lv2Y; + _this4._transform._positionZ += lv2Z; + } + if(angularSet) { + var _this5 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxis; + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dq; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var q; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this5._transform._rotation00; + var e11 = _this5._transform._rotation11; + var e22 = _this5._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + qY = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + qZ = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; + qZ = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qW = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; + qZ = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; + qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; + qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this5._transform._rotation00 = 1 - yy - zz; + _this5._transform._rotation01 = xy - wz; + _this5._transform._rotation02 = xz + wy; + _this5._transform._rotation10 = xy + wz; + _this5._transform._rotation11 = 1 - xx - zz; + _this5._transform._rotation12 = yz - wx; + _this5._transform._rotation20 = xz - wy; + _this5._transform._rotation21 = yz + wx; + _this5._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this5._transform._rotation00 * _this5._invLocalInertia00 + _this5._transform._rotation01 * _this5._invLocalInertia10 + _this5._transform._rotation02 * _this5._invLocalInertia20; + __tmp__01 = _this5._transform._rotation00 * _this5._invLocalInertia01 + _this5._transform._rotation01 * _this5._invLocalInertia11 + _this5._transform._rotation02 * _this5._invLocalInertia21; + __tmp__02 = _this5._transform._rotation00 * _this5._invLocalInertia02 + _this5._transform._rotation01 * _this5._invLocalInertia12 + _this5._transform._rotation02 * _this5._invLocalInertia22; + __tmp__10 = _this5._transform._rotation10 * _this5._invLocalInertia00 + _this5._transform._rotation11 * _this5._invLocalInertia10 + _this5._transform._rotation12 * _this5._invLocalInertia20; + __tmp__11 = _this5._transform._rotation10 * _this5._invLocalInertia01 + _this5._transform._rotation11 * _this5._invLocalInertia11 + _this5._transform._rotation12 * _this5._invLocalInertia21; + __tmp__12 = _this5._transform._rotation10 * _this5._invLocalInertia02 + _this5._transform._rotation11 * _this5._invLocalInertia12 + _this5._transform._rotation12 * _this5._invLocalInertia22; + __tmp__20 = _this5._transform._rotation20 * _this5._invLocalInertia00 + _this5._transform._rotation21 * _this5._invLocalInertia10 + _this5._transform._rotation22 * _this5._invLocalInertia20; + __tmp__21 = _this5._transform._rotation20 * _this5._invLocalInertia01 + _this5._transform._rotation21 * _this5._invLocalInertia11 + _this5._transform._rotation22 * _this5._invLocalInertia21; + __tmp__22 = _this5._transform._rotation20 * _this5._invLocalInertia02 + _this5._transform._rotation21 * _this5._invLocalInertia12 + _this5._transform._rotation22 * _this5._invLocalInertia22; + _this5._invInertia00 = __tmp__00; + _this5._invInertia01 = __tmp__01; + _this5._invInertia02 = __tmp__02; + _this5._invInertia10 = __tmp__10; + _this5._invInertia11 = __tmp__11; + _this5._invInertia12 = __tmp__12; + _this5._invInertia20 = __tmp__20; + _this5._invInertia21 = __tmp__21; + _this5._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this5._invInertia00 * _this5._transform._rotation00 + _this5._invInertia01 * _this5._transform._rotation01 + _this5._invInertia02 * _this5._transform._rotation02; + __tmp__011 = _this5._invInertia00 * _this5._transform._rotation10 + _this5._invInertia01 * _this5._transform._rotation11 + _this5._invInertia02 * _this5._transform._rotation12; + __tmp__021 = _this5._invInertia00 * _this5._transform._rotation20 + _this5._invInertia01 * _this5._transform._rotation21 + _this5._invInertia02 * _this5._transform._rotation22; + __tmp__101 = _this5._invInertia10 * _this5._transform._rotation00 + _this5._invInertia11 * _this5._transform._rotation01 + _this5._invInertia12 * _this5._transform._rotation02; + __tmp__111 = _this5._invInertia10 * _this5._transform._rotation10 + _this5._invInertia11 * _this5._transform._rotation11 + _this5._invInertia12 * _this5._transform._rotation12; + __tmp__121 = _this5._invInertia10 * _this5._transform._rotation20 + _this5._invInertia11 * _this5._transform._rotation21 + _this5._invInertia12 * _this5._transform._rotation22; + __tmp__201 = _this5._invInertia20 * _this5._transform._rotation00 + _this5._invInertia21 * _this5._transform._rotation01 + _this5._invInertia22 * _this5._transform._rotation02; + __tmp__211 = _this5._invInertia20 * _this5._transform._rotation10 + _this5._invInertia21 * _this5._transform._rotation11 + _this5._invInertia22 * _this5._transform._rotation12; + __tmp__221 = _this5._invInertia20 * _this5._transform._rotation20 + _this5._invInertia21 * _this5._transform._rotation21 + _this5._invInertia22 * _this5._transform._rotation22; + _this5._invInertia00 = __tmp__001; + _this5._invInertia01 = __tmp__011; + _this5._invInertia02 = __tmp__021; + _this5._invInertia10 = __tmp__101; + _this5._invInertia11 = __tmp__111; + _this5._invInertia12 = __tmp__121; + _this5._invInertia20 = __tmp__201; + _this5._invInertia21 = __tmp__211; + _this5._invInertia22 = __tmp__221; + _this5._invInertia00 *= _this5._rotFactor.x; + _this5._invInertia01 *= _this5._rotFactor.x; + _this5._invInertia02 *= _this5._rotFactor.x; + _this5._invInertia10 *= _this5._rotFactor.y; + _this5._invInertia11 *= _this5._rotFactor.y; + _this5._invInertia12 *= _this5._rotFactor.y; + _this5._invInertia20 *= _this5._rotFactor.z; + _this5._invInertia21 *= _this5._rotFactor.z; + _this5._invInertia22 *= _this5._rotFactor.z; + var _this6 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxis1; + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dq1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var q1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this6._transform._rotation00; + var e111 = _this6._transform._rotation11; + var e221 = _this6._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + qY1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + qZ1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; + qZ1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qW1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; + qZ1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; + qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; + qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this6._transform._rotation00 = 1 - yy1 - zz1; + _this6._transform._rotation01 = xy1 - wz1; + _this6._transform._rotation02 = xz1 + wy1; + _this6._transform._rotation10 = xy1 + wz1; + _this6._transform._rotation11 = 1 - xx1 - zz1; + _this6._transform._rotation12 = yz1 - wx1; + _this6._transform._rotation20 = xz1 - wy1; + _this6._transform._rotation21 = yz1 + wx1; + _this6._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this6._transform._rotation00 * _this6._invLocalInertia00 + _this6._transform._rotation01 * _this6._invLocalInertia10 + _this6._transform._rotation02 * _this6._invLocalInertia20; + __tmp__012 = _this6._transform._rotation00 * _this6._invLocalInertia01 + _this6._transform._rotation01 * _this6._invLocalInertia11 + _this6._transform._rotation02 * _this6._invLocalInertia21; + __tmp__022 = _this6._transform._rotation00 * _this6._invLocalInertia02 + _this6._transform._rotation01 * _this6._invLocalInertia12 + _this6._transform._rotation02 * _this6._invLocalInertia22; + __tmp__102 = _this6._transform._rotation10 * _this6._invLocalInertia00 + _this6._transform._rotation11 * _this6._invLocalInertia10 + _this6._transform._rotation12 * _this6._invLocalInertia20; + __tmp__112 = _this6._transform._rotation10 * _this6._invLocalInertia01 + _this6._transform._rotation11 * _this6._invLocalInertia11 + _this6._transform._rotation12 * _this6._invLocalInertia21; + __tmp__122 = _this6._transform._rotation10 * _this6._invLocalInertia02 + _this6._transform._rotation11 * _this6._invLocalInertia12 + _this6._transform._rotation12 * _this6._invLocalInertia22; + __tmp__202 = _this6._transform._rotation20 * _this6._invLocalInertia00 + _this6._transform._rotation21 * _this6._invLocalInertia10 + _this6._transform._rotation22 * _this6._invLocalInertia20; + __tmp__212 = _this6._transform._rotation20 * _this6._invLocalInertia01 + _this6._transform._rotation21 * _this6._invLocalInertia11 + _this6._transform._rotation22 * _this6._invLocalInertia21; + __tmp__222 = _this6._transform._rotation20 * _this6._invLocalInertia02 + _this6._transform._rotation21 * _this6._invLocalInertia12 + _this6._transform._rotation22 * _this6._invLocalInertia22; + _this6._invInertia00 = __tmp__002; + _this6._invInertia01 = __tmp__012; + _this6._invInertia02 = __tmp__022; + _this6._invInertia10 = __tmp__102; + _this6._invInertia11 = __tmp__112; + _this6._invInertia12 = __tmp__122; + _this6._invInertia20 = __tmp__202; + _this6._invInertia21 = __tmp__212; + _this6._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this6._invInertia00 * _this6._transform._rotation00 + _this6._invInertia01 * _this6._transform._rotation01 + _this6._invInertia02 * _this6._transform._rotation02; + __tmp__013 = _this6._invInertia00 * _this6._transform._rotation10 + _this6._invInertia01 * _this6._transform._rotation11 + _this6._invInertia02 * _this6._transform._rotation12; + __tmp__023 = _this6._invInertia00 * _this6._transform._rotation20 + _this6._invInertia01 * _this6._transform._rotation21 + _this6._invInertia02 * _this6._transform._rotation22; + __tmp__103 = _this6._invInertia10 * _this6._transform._rotation00 + _this6._invInertia11 * _this6._transform._rotation01 + _this6._invInertia12 * _this6._transform._rotation02; + __tmp__113 = _this6._invInertia10 * _this6._transform._rotation10 + _this6._invInertia11 * _this6._transform._rotation11 + _this6._invInertia12 * _this6._transform._rotation12; + __tmp__123 = _this6._invInertia10 * _this6._transform._rotation20 + _this6._invInertia11 * _this6._transform._rotation21 + _this6._invInertia12 * _this6._transform._rotation22; + __tmp__203 = _this6._invInertia20 * _this6._transform._rotation00 + _this6._invInertia21 * _this6._transform._rotation01 + _this6._invInertia22 * _this6._transform._rotation02; + __tmp__213 = _this6._invInertia20 * _this6._transform._rotation10 + _this6._invInertia21 * _this6._transform._rotation11 + _this6._invInertia22 * _this6._transform._rotation12; + __tmp__223 = _this6._invInertia20 * _this6._transform._rotation20 + _this6._invInertia21 * _this6._transform._rotation21 + _this6._invInertia22 * _this6._transform._rotation22; + _this6._invInertia00 = __tmp__003; + _this6._invInertia01 = __tmp__013; + _this6._invInertia02 = __tmp__023; + _this6._invInertia10 = __tmp__103; + _this6._invInertia11 = __tmp__113; + _this6._invInertia12 = __tmp__123; + _this6._invInertia20 = __tmp__203; + _this6._invInertia21 = __tmp__213; + _this6._invInertia22 = __tmp__223; + _this6._invInertia00 *= _this6._rotFactor.x; + _this6._invInertia01 *= _this6._rotFactor.x; + _this6._invInertia02 *= _this6._rotFactor.x; + _this6._invInertia10 *= _this6._rotFactor.y; + _this6._invInertia11 *= _this6._rotFactor.y; + _this6._invInertia12 *= _this6._rotFactor.y; + _this6._invInertia20 *= _this6._rotFactor.z; + _this6._invInertia21 *= _this6._rotFactor.z; + _this6._invInertia22 *= _this6._rotFactor.z; + } + var _this7 = this.posBoundarySelector; + var i4 = 0; + while(_this7.indices[i4] != idx1) ++i4; + while(i4 > 0) { + var tmp1 = _this7.indices[i4]; + _this7.indices[i4] = _this7.indices[i4 - 1]; + _this7.indices[i4 - 1] = tmp1; + --i4; + } + solved = true; + break; + } + } + if(!solved) { + console.log("src/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.hx:502:","could not find solution. (NGS)"); + return; + } + } + postSolve() { + this.joint._syncAnchors(); + this.joint._checkDestruction(); + } +} +oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constraint_solver_direct_MassMatrix { + constructor(size) { + this._size = size; + var this1 = new Array(this._size); + this.tmpMatrix = this1; + var this2 = new Array(this._size); + this._invMass = this2; + var this3 = new Array(this._size); + this._invMassWithoutCfm = this3; + var _g = 0; + var _g1 = this._size; + while(_g < _g1) { + var i = _g++; + var this4 = this.tmpMatrix; + var this5 = new Array(this._size); + this4[i] = this5; + var this6 = this._invMass; + var this7 = new Array(this._size); + this6[i] = this7; + var this8 = this._invMassWithoutCfm; + var this9 = new Array(this._size); + this8[i] = this9; + var _g2 = 0; + var _g11 = this._size; + while(_g2 < _g11) { + var j = _g2++; + this.tmpMatrix[i][j] = 0; + this._invMass[i][j] = 0; + this._invMassWithoutCfm[i][j] = 0; + } + } + this._maxSubmatrixId = 1 << this._size; + var this10 = new Array(this._maxSubmatrixId); + this._cacheComputed = this10; + var this11 = new Array(this._maxSubmatrixId); + this._cachedSubmatrices = this11; + var _g21 = 0; + var _g3 = this._maxSubmatrixId; + while(_g21 < _g3) { + var i1 = _g21++; + var t = i1; + t = (t & 85) + (t >> 1 & 85); + t = (t & 51) + (t >> 2 & 51); + t = (t & 15) + (t >> 4 & 15); + var matrixSize = t; + var this12 = new Array(matrixSize); + var subMatrix = this12; + var _g22 = 0; + var _g31 = matrixSize; + while(_g22 < _g31) { + var j1 = _g22++; + var this13 = new Array(matrixSize); + subMatrix[j1] = this13; + var _g23 = 0; + var _g32 = matrixSize; + while(_g23 < _g32) { + var k = _g23++; + subMatrix[j1][k] = 0; + } + } + this._cacheComputed[i1] = false; + this._cachedSubmatrices[i1] = subMatrix; + } + } + computeSubmatrix(id,indices,size) { + var _g = 0; + var _g1 = size; + while(_g < _g1) { + var i = _g++; + var ii = indices[i]; + var _g2 = 0; + var _g11 = size; + while(_g2 < _g11) { + var j = _g2++; + this.tmpMatrix[i][j] = this._invMass[ii][indices[j]]; + } + } + var src = this.tmpMatrix; + var dst = this._cachedSubmatrices[id]; + var srci; + var dsti; + var srcj; + var dstj; + var diag; + switch(size) { + case 4: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + break; + case 5: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srci[4] = srci[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srci = src[4]; + dsti = dst[4]; + diag = 1 / srci[4]; + dsti[4] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + dsti = dst[4]; + dst[0][4] = dsti[0]; + dst[1][4] = dsti[1]; + dst[2][4] = dsti[2]; + dst[3][4] = dsti[3]; + break; + case 6: + srci = src[0]; + dsti = dst[0]; + diag = 1 / srci[0]; + dsti[0] = diag; + srci[1] = srci[1] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = -diag * srcj[0]; + srcj[1] = srcj[1] - srci[1] * srcj[0]; + srcj[2] = srcj[2] - srci[2] * srcj[0]; + srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[5] = srcj[5] - srci[5] * srcj[0]; + srci = src[1]; + dsti = dst[1]; + diag = 1 / srci[1]; + dsti[1] = diag; + dsti[0] = dsti[0] * diag; + srci[2] = srci[2] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[1] = -diag * srcj[1]; + srcj[2] = srcj[2] - srci[2] * srcj[1]; + srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[5] = srcj[5] - srci[5] * srcj[1]; + srci = src[2]; + dsti = dst[2]; + diag = 1 / srci[2]; + dsti[2] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + srci[3] = srci[3] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[2]; + dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[2] = -diag * srcj[2]; + srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[5] = srcj[5] - srci[5] * srcj[2]; + srci = src[3]; + dsti = dst[3]; + diag = 1 / srci[3]; + dsti[3] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + srci[4] = srci[4] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[3] = -diag * srcj[3]; + srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[5] = srcj[5] - srci[5] * srcj[3]; + srci = src[4]; + dsti = dst[4]; + diag = 1 / srci[4]; + dsti[4] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + srci[5] = srci[5] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj = src[5]; + dstj = dst[5]; + dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[4] = -diag * srcj[4]; + srcj[5] = srcj[5] - srci[5] * srcj[4]; + srci = src[5]; + dsti = dst[5]; + diag = 1 / srci[5]; + dsti[5] = diag; + dsti[0] = dsti[0] * diag; + dsti[1] = dsti[1] * diag; + dsti[2] = dsti[2] * diag; + dsti[3] = dsti[3] * diag; + dsti[4] = dsti[4] * diag; + srcj = src[0]; + dstj = dst[0]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + srcj = src[1]; + dstj = dst[1]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + srcj = src[2]; + dstj = dst[2]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + srcj = src[3]; + dstj = dst[3]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[3] = dstj[3] - dsti[3] * srcj[5]; + srcj = src[4]; + dstj = dst[4]; + dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[3] = dstj[3] - dsti[3] * srcj[5]; + dstj[4] = dstj[4] - dsti[4] * srcj[5]; + dsti = dst[1]; + dst[0][1] = dsti[0]; + dsti = dst[2]; + dst[0][2] = dsti[0]; + dst[1][2] = dsti[1]; + dsti = dst[3]; + dst[0][3] = dsti[0]; + dst[1][3] = dsti[1]; + dst[2][3] = dsti[2]; + dsti = dst[4]; + dst[0][4] = dsti[0]; + dst[1][4] = dsti[1]; + dst[2][4] = dsti[2]; + dst[3][4] = dsti[3]; + dsti = dst[5]; + dst[0][5] = dsti[0]; + dst[1][5] = dsti[1]; + dst[2][5] = dsti[2]; + dst[3][5] = dsti[3]; + dst[4][5] = dsti[4]; + break; + default: + var _g21 = 0; + var _g3 = size; + while(_g21 < _g3) { + var i1 = _g21++; + srci = src[i1]; + dsti = dst[i1]; + var diag1 = 1 / srci[i1]; + dsti[i1] = diag1; + var _g22 = 0; + var _g31 = i1; + while(_g22 < _g31) { + var j1 = _g22++; + dsti[j1] = dsti[j1] * diag1; + } + var _g4 = i1 + 1; + var _g5 = size; + while(_g4 < _g5) { + var j2 = _g4++; + srci[j2] = srci[j2] * diag1; + } + var _g6 = 0; + var _g7 = i1; + while(_g6 < _g7) { + var j3 = _g6++; + srcj = src[j3]; + dstj = dst[j3]; + var _g61 = 0; + var _g71 = j3 + 1; + while(_g61 < _g71) { + var k = _g61++; + dstj[k] = dstj[k] - dsti[k] * srcj[i1]; + } + var _g8 = i1 + 1; + var _g9 = size; + while(_g8 < _g9) { + var k1 = _g8++; + srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; + } + } + var _g81 = i1 + 1; + var _g91 = size; + while(_g81 < _g91) { + var j4 = _g81++; + srcj = src[j4]; + dstj = dst[j4]; + var _g82 = 0; + var _g92 = i1; + while(_g82 < _g92) { + var k2 = _g82++; + dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; + } + dstj[i1] = -diag1 * srcj[i1]; + var _g10 = i1 + 1; + var _g111 = size; + while(_g10 < _g111) { + var k3 = _g10++; + srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; + } + } + } + var _g41 = 1; + var _g51 = size; + while(_g41 < _g51) { + var i2 = _g41++; + dsti = dst[i2]; + var _g42 = 0; + var _g52 = i2; + while(_g42 < _g52) { + var j5 = _g42++; + dst[j5][i2] = dsti[j5]; + } + } + } + } + computeInvMass(info,massData) { + var invMass = this._invMass; + var invMassWithoutCfm = this._invMassWithoutCfm; + var numRows = info.numRows; + var b1 = info.b1; + var b2 = info.b2; + var invM1 = b1._invMass; + var invM2 = b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = b1._invInertia00; + invI101 = b1._invInertia01; + invI102 = b1._invInertia02; + invI110 = b1._invInertia10; + invI111 = b1._invInertia11; + invI112 = b1._invInertia12; + invI120 = b1._invInertia20; + invI121 = b1._invInertia21; + invI122 = b1._invInertia22; + invI200 = b2._invInertia00; + invI201 = b2._invInertia01; + invI202 = b2._invInertia02; + invI210 = b2._invInertia10; + invI211 = b2._invInertia11; + invI212 = b2._invInertia12; + invI220 = b2._invInertia20; + invI221 = b2._invInertia21; + invI222 = b2._invInertia22; + var _g = 0; + var _g1 = numRows; + while(_g < _g1) { + var i = _g++; + var j = info.rows[i].jacobian; + var md = massData[i]; + j.updateSparsity(); + if((j.flag & 1) != 0) { + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + } else { + md.invMLin1X = 0; + md.invMLin1Y = 0; + md.invMLin1Z = 0; + md.invMLin2X = 0; + md.invMLin2Y = 0; + md.invMLin2Z = 0; + } + if((j.flag & 2) != 0) { + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + } else { + md.invMAng1X = 0; + md.invMAng1Y = 0; + md.invMAng1Z = 0; + md.invMAng2X = 0; + md.invMAng2Y = 0; + md.invMAng2Z = 0; + } + } + var _g2 = 0; + var _g3 = numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var j1 = info.rows[i1].jacobian; + var _g21 = i1; + var _g31 = numRows; + while(_g21 < _g31) { + var j2 = _g21++; + var j21 = info.rows[j2].jacobian; + var md2 = massData[j2]; + var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); + if(i1 == j2) { + invMass[i1][j2] = val + info.rows[i1].cfm; + invMassWithoutCfm[i1][j2] = val; + md2.mass = val + info.rows[i1].cfm; + md2.massWithoutCfm = val; + if(md2.mass != 0) { + md2.mass = 1 / md2.mass; + } + if(md2.massWithoutCfm != 0) { + md2.massWithoutCfm = 1 / md2.massWithoutCfm; + } + } else { + invMass[i1][j2] = val; + invMass[j2][i1] = val; + invMassWithoutCfm[i1][j2] = val; + invMassWithoutCfm[j2][i1] = val; + } + } + } + var _g4 = 0; + var _g11 = this._maxSubmatrixId; + while(_g4 < _g11) { + var i2 = _g4++; + this._cacheComputed[i2] = false; + } + } +} +if(!oimo.dynamics.constraint.solver.pgs) oimo.dynamics.constraint.solver.pgs = {}; +oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(constraint) { + super(); + this.constraint = constraint; + this.info = new oimo.dynamics.constraint.info.contact.ContactSolverInfo(); + var this1 = new Array(oimo.common.Setting.maxManifoldPoints); + this.massData = this1; + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) { + var i = _g++; + this.massData[i] = new oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow(); + } + } + preSolveVelocity(timeStep) { + this.constraint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + var jt = row.jacobianT; + var jb = row.jacobianB; + md.invMLinT1X = jt.lin1X * invM1; + md.invMLinT1Y = jt.lin1Y * invM1; + md.invMLinT1Z = jt.lin1Z * invM1; + md.invMLinT2X = jt.lin2X * invM2; + md.invMLinT2Y = jt.lin2Y * invM2; + md.invMLinT2Z = jt.lin2Z * invM2; + md.invMLinB1X = jb.lin1X * invM1; + md.invMLinB1Y = jb.lin1Y * invM1; + md.invMLinB1Z = jb.lin1Z * invM1; + md.invMLinB2X = jb.lin2X * invM2; + md.invMLinB2Y = jb.lin2Y * invM2; + md.invMLinB2Z = jb.lin2Z * invM2; + var __tmp__X2; + var __tmp__Y2; + var __tmp__Z2; + __tmp__X2 = invI100 * jt.ang1X + invI101 * jt.ang1Y + invI102 * jt.ang1Z; + __tmp__Y2 = invI110 * jt.ang1X + invI111 * jt.ang1Y + invI112 * jt.ang1Z; + __tmp__Z2 = invI120 * jt.ang1X + invI121 * jt.ang1Y + invI122 * jt.ang1Z; + md.invMAngT1X = __tmp__X2; + md.invMAngT1Y = __tmp__Y2; + md.invMAngT1Z = __tmp__Z2; + var __tmp__X3; + var __tmp__Y3; + var __tmp__Z3; + __tmp__X3 = invI200 * jt.ang2X + invI201 * jt.ang2Y + invI202 * jt.ang2Z; + __tmp__Y3 = invI210 * jt.ang2X + invI211 * jt.ang2Y + invI212 * jt.ang2Z; + __tmp__Z3 = invI220 * jt.ang2X + invI221 * jt.ang2Y + invI222 * jt.ang2Z; + md.invMAngT2X = __tmp__X3; + md.invMAngT2Y = __tmp__Y3; + md.invMAngT2Z = __tmp__Z3; + var __tmp__X4; + var __tmp__Y4; + var __tmp__Z4; + __tmp__X4 = invI100 * jb.ang1X + invI101 * jb.ang1Y + invI102 * jb.ang1Z; + __tmp__Y4 = invI110 * jb.ang1X + invI111 * jb.ang1Y + invI112 * jb.ang1Z; + __tmp__Z4 = invI120 * jb.ang1X + invI121 * jb.ang1Y + invI122 * jb.ang1Z; + md.invMAngB1X = __tmp__X4; + md.invMAngB1Y = __tmp__Y4; + md.invMAngB1Z = __tmp__Z4; + var __tmp__X5; + var __tmp__Y5; + var __tmp__Z5; + __tmp__X5 = invI200 * jb.ang2X + invI201 * jb.ang2Y + invI202 * jb.ang2Z; + __tmp__Y5 = invI210 * jb.ang2X + invI211 * jb.ang2Y + invI212 * jb.ang2Z; + __tmp__Z5 = invI220 * jb.ang2X + invI221 * jb.ang2Y + invI222 * jb.ang2Z; + md.invMAngB2X = __tmp__X5; + md.invMAngB2Y = __tmp__Y5; + md.invMAngB2Z = __tmp__Z5; + var invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); + var invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); + var invMassTB10 = invMassTB01; + var invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); + var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB10; + if(invDet != 0) { + invDet = 1 / invDet; + } + md.massTB00 = invMassTB11 * invDet; + md.massTB01 = -invMassTB01 * invDet; + md.massTB10 = -invMassTB10 * invDet; + md.massTB11 = invMassTB00 * invDet; + } + } + warmStart(timeStep) { + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var md = this.massData[i]; + var jt = row.jacobianT; + var jb = row.jacobianB; + var impulseN = imp.impulseN; + var impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; + var impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; + imp.impulseT = impulseT; + imp.impulseB = impulseB; + imp.impulseN *= timeStep.dtRatio; + imp.impulseT *= timeStep.dtRatio; + imp.impulseB *= timeStep.dtRatio; + lv1X += md.invMLinN1X * impulseN; + lv1Y += md.invMLinN1Y * impulseN; + lv1Z += md.invMLinN1Z * impulseN; + lv1X += md.invMLinT1X * impulseT; + lv1Y += md.invMLinT1Y * impulseT; + lv1Z += md.invMLinT1Z * impulseT; + lv1X += md.invMLinB1X * impulseB; + lv1Y += md.invMLinB1Y * impulseB; + lv1Z += md.invMLinB1Z * impulseB; + lv2X += md.invMLinN2X * -impulseN; + lv2Y += md.invMLinN2Y * -impulseN; + lv2Z += md.invMLinN2Z * -impulseN; + lv2X += md.invMLinT2X * -impulseT; + lv2Y += md.invMLinT2Y * -impulseT; + lv2Z += md.invMLinT2Z * -impulseT; + lv2X += md.invMLinB2X * -impulseB; + lv2Y += md.invMLinB2Y * -impulseB; + lv2Z += md.invMLinB2Z * -impulseB; + av1X += md.invMAngN1X * impulseN; + av1Y += md.invMAngN1Y * impulseN; + av1Z += md.invMAngN1Z * impulseN; + av1X += md.invMAngT1X * impulseT; + av1Y += md.invMAngT1Y * impulseT; + av1Z += md.invMAngT1Z * impulseT; + av1X += md.invMAngB1X * impulseB; + av1Y += md.invMAngB1Y * impulseB; + av1Z += md.invMAngB1Z * impulseB; + av2X += md.invMAngN2X * -impulseN; + av2Y += md.invMAngN2Y * -impulseN; + av2Z += md.invMAngN2Z * -impulseN; + av2X += md.invMAngT2X * -impulseT; + av2Y += md.invMAngT2Y * -impulseT; + av2Z += md.invMAngT2Z * -impulseT; + av2X += md.invMAngB2X * -impulseB; + av2Y += md.invMAngB2Y * -impulseB; + av2Z += md.invMAngB2Z * -impulseB; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + solveVelocity() { + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var rvt = 0; + var j = row.jacobianT; + rvt += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvt -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvt += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvt -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var rvb = 0; + j = row.jacobianB; + rvb += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvb -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvb += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvb -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); + var impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); + var oldImpulseT = imp.impulseT; + var oldImpulseB = imp.impulseB; + imp.impulseT += impulseT; + imp.impulseB += impulseB; + var maxImpulse = row.friction * imp.impulseN; + if(maxImpulse == 0) { + imp.impulseT = 0; + imp.impulseB = 0; + } else { + var impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; + if(impulseLengthSq > maxImpulse * maxImpulse) { + var invL = maxImpulse / Math.sqrt(impulseLengthSq); + imp.impulseT *= invL; + imp.impulseB *= invL; + } + } + impulseT = imp.impulseT - oldImpulseT; + impulseB = imp.impulseB - oldImpulseB; + lv1X += md.invMLinT1X * impulseT; + lv1Y += md.invMLinT1Y * impulseT; + lv1Z += md.invMLinT1Z * impulseT; + lv1X += md.invMLinB1X * impulseB; + lv1Y += md.invMLinB1Y * impulseB; + lv1Z += md.invMLinB1Z * impulseB; + lv2X += md.invMLinT2X * -impulseT; + lv2Y += md.invMLinT2Y * -impulseT; + lv2Z += md.invMLinT2Z * -impulseT; + lv2X += md.invMLinB2X * -impulseB; + lv2Y += md.invMLinB2Y * -impulseB; + lv2Z += md.invMLinB2Z * -impulseB; + av1X += md.invMAngT1X * impulseT; + av1Y += md.invMAngT1Y * impulseT; + av1Z += md.invMAngT1Z * impulseT; + av1X += md.invMAngB1X * impulseB; + av1Y += md.invMAngB1Y * impulseB; + av1Z += md.invMAngB1Z * impulseB; + av2X += md.invMAngT2X * -impulseT; + av2Y += md.invMAngT2Y * -impulseT; + av2Z += md.invMAngT2Z * -impulseT; + av2X += md.invMAngB2X * -impulseB; + av2Y += md.invMAngB2Y * -impulseB; + av2Z += md.invMAngB2Z * -impulseB; + } + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp1 = row1.impulse; + var rvn = 0; + var j1 = row1.jacobianN; + rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseN = (row1.rhs - rvn) * md1.massN; + var oldImpulseN = imp1.impulseN; + imp1.impulseN += impulseN; + if(imp1.impulseN < 0) { + imp1.impulseN = 0; + } + impulseN = imp1.impulseN - oldImpulseN; + lv1X += md1.invMLinN1X * impulseN; + lv1Y += md1.invMLinN1Y * impulseN; + lv1Z += md1.invMLinN1Z * impulseN; + lv2X += md1.invMLinN2X * -impulseN; + lv2Y += md1.invMLinN2Y * -impulseN; + lv2Z += md1.invMLinN2Z * -impulseN; + av1X += md1.invMAngN1X * impulseN; + av1Y += md1.invMAngN1Y * impulseN; + av1Z += md1.invMAngN1Z * impulseN; + av2X += md1.invMAngN2X * -impulseN; + av2Y += md1.invMAngN2Y * -impulseN; + av2Z += md1.invMAngN2Z * -impulseN; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + preSolvePosition(timeStep) { + this.constraint._syncManifold(); + this.constraint._getPositionSolverInfo(this.info); + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + this.info.rows[i1].impulse.impulseP = 0; + } + } + solvePositionSplitImpulse() { + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobianN; + var rvn = 0; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs - rvn) * md.massN * oimo.common.Setting.positionSplitImpulseBaumgarte; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < 0) { + imp.impulseP = 0; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md.invMLinN1X * impulseP; + lv1Y += md.invMLinN1Y * impulseP; + lv1Z += md.invMLinN1Z * impulseP; + lv2X += md.invMLinN2X * -impulseP; + lv2Y += md.invMLinN2Y * -impulseP; + lv2Z += md.invMLinN2Z * -impulseP; + av1X += md.invMAngN1X * impulseP; + av1Y += md.invMAngN1Y * impulseP; + av1Z += md.invMAngN1Z * impulseP; + av2X += md.invMAngN2X * -impulseP; + av2Y += md.invMAngN2Y * -impulseP; + av2Z += md.invMAngN2Z * -impulseP; + } + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + solvePositionNgs(timeStep) { + this.constraint._syncManifold(); + this.constraint._getPositionSolverInfo(this.info); + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobianN; + md.invMLinN1X = j.lin1X * invM1; + md.invMLinN1Y = j.lin1Y * invM1; + md.invMLinN1Z = j.lin1Z * invM1; + md.invMLinN2X = j.lin2X * invM2; + md.invMLinN2Y = j.lin2Y * invM2; + md.invMLinN2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAngN1X = __tmp__X; + md.invMAngN1Y = __tmp__Y; + md.invMAngN1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAngN2X = __tmp__X1; + md.invMAngN2Y = __tmp__Y1; + md.invMAngN2Z = __tmp__Z1; + md.massN = invM1 + invM2 + (md.invMAngN1X * j.ang1X + md.invMAngN1Y * j.ang1Y + md.invMAngN1Z * j.ang1Z) + (md.invMAngN2X * j.ang2X + md.invMAngN2Y * j.ang2Y + md.invMAngN2Z * j.ang2Z); + if(md.massN != 0) { + md.massN = 1 / md.massN; + } + } + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp = row1.impulse; + var j1 = row1.jacobianN; + var rvn = 0; + rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseP = (row1.rhs - rvn) * md1.massN * oimo.common.Setting.positionNgsBaumgarte; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < 0) { + imp.impulseP = 0; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md1.invMLinN1X * impulseP; + lv1Y += md1.invMLinN1Y * impulseP; + lv1Z += md1.invMLinN1Z * impulseP; + lv2X += md1.invMLinN2X * -impulseP; + lv2Y += md1.invMLinN2Y * -impulseP; + lv2Z += md1.invMLinN2Z * -impulseP; + av1X += md1.invMAngN1X * impulseP; + av1Y += md1.invMAngN1Y * impulseP; + av1Z += md1.invMAngN1Z * impulseP; + av2X += md1.invMAngN2X * -impulseP; + av2Y += md1.invMAngN2Y * -impulseP; + av2Z += md1.invMAngN2Z * -impulseP; + } + var _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + var _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; + var _this2 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxis; + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dq; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var q; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this2._transform._rotation00; + var e11 = _this2._transform._rotation11; + var e22 = _this2._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this2._transform._rotation00 = 1 - yy - zz; + _this2._transform._rotation01 = xy - wz; + _this2._transform._rotation02 = xz + wy; + _this2._transform._rotation10 = xy + wz; + _this2._transform._rotation11 = 1 - xx - zz; + _this2._transform._rotation12 = yz - wx; + _this2._transform._rotation20 = xz - wy; + _this2._transform._rotation21 = yz + wx; + _this2._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; + __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; + __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; + __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; + __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; + __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; + __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; + __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; + __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; + _this2._invInertia00 = __tmp__00; + _this2._invInertia01 = __tmp__01; + _this2._invInertia02 = __tmp__02; + _this2._invInertia10 = __tmp__10; + _this2._invInertia11 = __tmp__11; + _this2._invInertia12 = __tmp__12; + _this2._invInertia20 = __tmp__20; + _this2._invInertia21 = __tmp__21; + _this2._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; + __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; + __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; + __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; + __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; + __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; + __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; + __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; + __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; + _this2._invInertia00 = __tmp__001; + _this2._invInertia01 = __tmp__011; + _this2._invInertia02 = __tmp__021; + _this2._invInertia10 = __tmp__101; + _this2._invInertia11 = __tmp__111; + _this2._invInertia12 = __tmp__121; + _this2._invInertia20 = __tmp__201; + _this2._invInertia21 = __tmp__211; + _this2._invInertia22 = __tmp__221; + _this2._invInertia00 *= _this2._rotFactor.x; + _this2._invInertia01 *= _this2._rotFactor.x; + _this2._invInertia02 *= _this2._rotFactor.x; + _this2._invInertia10 *= _this2._rotFactor.y; + _this2._invInertia11 *= _this2._rotFactor.y; + _this2._invInertia12 *= _this2._rotFactor.y; + _this2._invInertia20 *= _this2._rotFactor.z; + _this2._invInertia21 *= _this2._rotFactor.z; + _this2._invInertia22 *= _this2._rotFactor.z; + var _this3 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxis1; + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dq1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var q1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this3._transform._rotation00; + var e111 = _this3._transform._rotation11; + var e221 = _this3._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this3._transform._rotation00 = 1 - yy1 - zz1; + _this3._transform._rotation01 = xy1 - wz1; + _this3._transform._rotation02 = xz1 + wy1; + _this3._transform._rotation10 = xy1 + wz1; + _this3._transform._rotation11 = 1 - xx1 - zz1; + _this3._transform._rotation12 = yz1 - wx1; + _this3._transform._rotation20 = xz1 - wy1; + _this3._transform._rotation21 = yz1 + wx1; + _this3._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; + __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; + __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; + __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; + __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; + __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; + __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; + __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; + __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; + _this3._invInertia00 = __tmp__002; + _this3._invInertia01 = __tmp__012; + _this3._invInertia02 = __tmp__022; + _this3._invInertia10 = __tmp__102; + _this3._invInertia11 = __tmp__112; + _this3._invInertia12 = __tmp__122; + _this3._invInertia20 = __tmp__202; + _this3._invInertia21 = __tmp__212; + _this3._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; + __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; + __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; + __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; + __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; + __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; + __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; + __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; + __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; + _this3._invInertia00 = __tmp__003; + _this3._invInertia01 = __tmp__013; + _this3._invInertia02 = __tmp__023; + _this3._invInertia10 = __tmp__103; + _this3._invInertia11 = __tmp__113; + _this3._invInertia12 = __tmp__123; + _this3._invInertia20 = __tmp__203; + _this3._invInertia21 = __tmp__213; + _this3._invInertia22 = __tmp__223; + _this3._invInertia00 *= _this3._rotFactor.x; + _this3._invInertia01 *= _this3._rotFactor.x; + _this3._invInertia02 *= _this3._rotFactor.x; + _this3._invInertia10 *= _this3._rotFactor.y; + _this3._invInertia11 *= _this3._rotFactor.y; + _this3._invInertia12 *= _this3._rotFactor.y; + _this3._invInertia20 *= _this3._rotFactor.z; + _this3._invInertia21 *= _this3._rotFactor.z; + _this3._invInertia22 *= _this3._rotFactor.z; + } + postSolve() { + var lin1; + var lin1X; + var lin1Y; + var lin1Z; + var ang1; + var ang1X; + var ang1Y; + var ang1Z; + var ang2; + var ang2X; + var ang2Y; + var ang2Z; + lin1X = 0; + lin1Y = 0; + lin1Z = 0; + ang1X = 0; + ang1Y = 0; + ang1Z = 0; + ang2X = 0; + ang2Y = 0; + ang2Z = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var jn = row.jacobianN; + var jt = row.jacobianT; + var jb = row.jacobianB; + var impN = imp.impulseN; + var impT = imp.impulseT; + var impB = imp.impulseB; + var impulseL; + var impulseLX; + var impulseLY; + var impulseLZ; + impulseLX = 0; + impulseLY = 0; + impulseLZ = 0; + impulseLX += jt.lin1X * impT; + impulseLY += jt.lin1Y * impT; + impulseLZ += jt.lin1Z * impT; + impulseLX += jb.lin1X * impB; + impulseLY += jb.lin1Y * impB; + impulseLZ += jb.lin1Z * impB; + imp.impulseLX = impulseLX; + imp.impulseLY = impulseLY; + imp.impulseLZ = impulseLZ; + lin1X += jn.lin1X * impN; + lin1Y += jn.lin1Y * impN; + lin1Z += jn.lin1Z * impN; + ang1X += jn.ang1X * impN; + ang1Y += jn.ang1Y * impN; + ang1Z += jn.ang1Z * impN; + ang2X += jn.ang2X * impN; + ang2Y += jn.ang2Y * impN; + ang2Z += jn.ang2Z * impN; + lin1X += jt.lin1X * impT; + lin1Y += jt.lin1Y * impT; + lin1Z += jt.lin1Z * impT; + ang1X += jt.ang1X * impT; + ang1Y += jt.ang1Y * impT; + ang1Z += jt.ang1Z * impT; + ang2X += jt.ang2X * impT; + ang2Y += jt.ang2Y * impT; + ang2Z += jt.ang2Z * impT; + lin1X += jb.lin1X * impB; + lin1Y += jb.lin1Y * impB; + lin1Z += jb.lin1Z * impB; + ang1X += jb.ang1X * impB; + ang1Y += jb.ang1Y * impB; + ang1Z += jb.ang1Z * impB; + ang2X += jb.ang2X * impB; + ang2Y += jb.ang2Y * impB; + ang2Z += jb.ang2Z * impB; + } + this._b1._linearContactImpulseX += lin1X; + this._b1._linearContactImpulseY += lin1Y; + this._b1._linearContactImpulseZ += lin1Z; + this._b1._angularContactImpulseX += ang1X; + this._b1._angularContactImpulseY += ang1Y; + this._b1._angularContactImpulseZ += ang1Z; + this._b2._linearContactImpulseX -= lin1X; + this._b2._linearContactImpulseY -= lin1Y; + this._b2._linearContactImpulseZ -= lin1Z; + this._b2._angularContactImpulseX -= ang2X; + this._b2._angularContactImpulseY -= ang2Y; + this._b2._angularContactImpulseZ -= ang2Z; + this.constraint._syncManifold(); + } +} +oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver extends oimo.dynamics.constraint.ConstraintSolver { + constructor(joint) { + super(); + this.joint = joint; + this.info = new oimo.dynamics.constraint.info.joint.JointSolverInfo(); + var this1 = new Array(oimo.common.Setting.maxJacobianRows); + this.massData = this1; + var _g = 0; + var _g1 = this.massData.length; + while(_g < _g1) { + var i = _g++; + this.massData[i] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); + } + } + preSolveVelocity(timeStep) { + this.joint._syncAnchors(); + this.joint._getVelocitySolverInfo(timeStep,this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var j = row.jacobian; + j.updateSparsity(); + if((j.flag & 1) != 0) { + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + } else { + md.invMLin1X = 0; + md.invMLin1Y = 0; + md.invMLin1Z = 0; + md.invMLin2X = 0; + md.invMLin2Y = 0; + md.invMLin2Z = 0; + } + if((j.flag & 2) != 0) { + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + } else { + md.invMAng1X = 0; + md.invMAng1Y = 0; + md.invMAng1Z = 0; + md.invMAng2X = 0; + md.invMAng2Y = 0; + md.invMAng2Z = 0; + } + md.massWithoutCfm = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + md.mass = md.massWithoutCfm + row.cfm; + if(md.massWithoutCfm != 0) { + md.massWithoutCfm = 1 / md.massWithoutCfm; + } + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + } + warmStart(timeStep) { + var factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; + factor *= timeStep.dtRatio; + if(factor <= 0) { + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var _this = row.impulse; + _this.impulse = 0; + _this.impulseM = 0; + _this.impulseP = 0; + } + return; + } + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md = this.massData[i1]; + var imp = row1.impulse; + var j = row1.jacobian; + imp.impulse *= factor; + imp.impulseM *= factor; + var impulse = imp.impulse + imp.impulseM; + lv1X += md.invMLin1X * impulse; + lv1Y += md.invMLin1Y * impulse; + lv1Z += md.invMLin1Z * impulse; + lv2X += md.invMLin2X * -impulse; + lv2Y += md.invMLin2Y * -impulse; + lv2Z += md.invMLin2Z * -impulse; + av1X += md.invMAng1X * impulse; + av1Y += md.invMAng1Y * impulse; + av1Z += md.invMAng1Z * impulse; + av2X += md.invMAng2X * -impulse; + av2Y += md.invMAng2Y * -impulse; + av2Z += md.invMAng2Z * -impulse; + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + solveVelocity() { + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + if(row.motorMaxImpulse == 0) { + continue; + } + var rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; + var oldImpulseM = imp.impulseM; + imp.impulseM += impulseM; + if(imp.impulseM < -row.motorMaxImpulse) { + imp.impulseM = -row.motorMaxImpulse; + } else if(imp.impulseM > row.motorMaxImpulse) { + imp.impulseM = row.motorMaxImpulse; + } + impulseM = imp.impulseM - oldImpulseM; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * impulseM; + lv1Y += md.invMLin1Y * impulseM; + lv1Z += md.invMLin1Z * impulseM; + lv2X += md.invMLin2X * -impulseM; + lv2Y += md.invMLin2Y * -impulseM; + lv2Z += md.invMLin2Z * -impulseM; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * impulseM; + av1Y += md.invMAng1Y * impulseM; + av1Z += md.invMAng1Z * impulseM; + av2X += md.invMAng2X * -impulseM; + av2Y += md.invMAng2Y * -impulseM; + av2Z += md.invMAng2Z * -impulseM; + } + } + var _g2 = 0; + var _g3 = this.info.numRows; + while(_g2 < _g3) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp1 = row1.impulse; + var j1 = row1.jacobian; + var rv1 = 0; + rv1 += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rv1 -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rv1 += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rv1 -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulse = (row1.rhs - rv1 - imp1.impulse * row1.cfm) * md1.mass; + var oldImpulse = imp1.impulse; + imp1.impulse += impulse; + if(imp1.impulse < row1.minImpulse) { + imp1.impulse = row1.minImpulse; + } else if(imp1.impulse > row1.maxImpulse) { + imp1.impulse = row1.maxImpulse; + } + impulse = imp1.impulse - oldImpulse; + if((j1.flag & 1) != 0) { + lv1X += md1.invMLin1X * impulse; + lv1Y += md1.invMLin1Y * impulse; + lv1Z += md1.invMLin1Z * impulse; + lv2X += md1.invMLin2X * -impulse; + lv2Y += md1.invMLin2Y * -impulse; + lv2Z += md1.invMLin2Z * -impulse; + } + if((j1.flag & 2) != 0) { + av1X += md1.invMAng1X * impulse; + av1Y += md1.invMAng1Y * impulse; + av1Z += md1.invMAng1Z * impulse; + av2X += md1.invMAng2X * -impulse; + av2Y += md1.invMAng2Y * -impulse; + av2Z += md1.invMAng2Z * -impulse; + } + } + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + postSolveVelocity(timeStep) { + var lin; + var linX; + var linY; + var linZ; + var ang; + var angX; + var angY; + var angZ; + linX = 0; + linY = 0; + linZ = 0; + angX = 0; + angY = 0; + angZ = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + var j = row.jacobian; + if((j.flag & 1) != 0) { + linX += j.lin1X * imp.impulse; + linY += j.lin1Y * imp.impulse; + linZ += j.lin1Z * imp.impulse; + } else if((j.flag & 2) != 0) { + angX += j.ang1X * imp.impulse; + angY += j.ang1Y * imp.impulse; + angZ += j.ang1Z * imp.impulse; + } + } + this.joint._appliedForceX = linX * timeStep.invDt; + this.joint._appliedForceY = linY * timeStep.invDt; + this.joint._appliedForceZ = linZ * timeStep.invDt; + this.joint._appliedTorqueX = angX * timeStep.invDt; + this.joint._appliedTorqueY = angY * timeStep.invDt; + this.joint._appliedTorqueZ = angZ * timeStep.invDt; + } + preSolvePosition(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + md.mass = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + this.info.rows[i1].impulse.impulseP = 0; + } + } + solvePositionSplitImpulse() { + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + var rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs * oimo.common.Setting.positionSplitImpulseBaumgarte - rv) * md.mass; + var oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < row.minImpulse) { + imp.impulseP = row.minImpulse; + } else if(imp.impulseP > row.maxImpulse) { + imp.impulseP = row.maxImpulse; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md.invMLin1X * impulseP; + lv1Y += md.invMLin1Y * impulseP; + lv1Z += md.invMLin1Z * impulseP; + lv2X += md.invMLin2X * -impulseP; + lv2Y += md.invMLin2Y * -impulseP; + lv2Z += md.invMLin2Z * -impulseP; + av1X += md.invMAng1X * impulseP; + av1Y += md.invMAng1Y * impulseP; + av1Z += md.invMAng1Z * impulseP; + av2X += md.invMAng2X * -impulseP; + av2Y += md.invMAng2Y * -impulseP; + av2Z += md.invMAng2Z * -impulseP; + } + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + solvePositionNgs(timeStep) { + this.joint._syncAnchors(); + this.joint._getPositionSolverInfo(this.info); + this._b1 = this.info.b1; + this._b2 = this.info.b2; + var invM1 = this._b1._invMass; + var invM2 = this._b2._invMass; + var invI1; + var invI100; + var invI101; + var invI102; + var invI110; + var invI111; + var invI112; + var invI120; + var invI121; + var invI122; + var invI2; + var invI200; + var invI201; + var invI202; + var invI210; + var invI211; + var invI212; + var invI220; + var invI221; + var invI222; + invI100 = this._b1._invInertia00; + invI101 = this._b1._invInertia01; + invI102 = this._b1._invInertia02; + invI110 = this._b1._invInertia10; + invI111 = this._b1._invInertia11; + invI112 = this._b1._invInertia12; + invI120 = this._b1._invInertia20; + invI121 = this._b1._invInertia21; + invI122 = this._b1._invInertia22; + invI200 = this._b2._invInertia00; + invI201 = this._b2._invInertia01; + invI202 = this._b2._invInertia02; + invI210 = this._b2._invInertia10; + invI211 = this._b2._invInertia11; + invI212 = this._b2._invInertia12; + invI220 = this._b2._invInertia20; + invI221 = this._b2._invInertia21; + invI222 = this._b2._invInertia22; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + md.invMLin1X = j.lin1X * invM1; + md.invMLin1Y = j.lin1Y * invM1; + md.invMLin1Z = j.lin1Z * invM1; + md.invMLin2X = j.lin2X * invM2; + md.invMLin2Y = j.lin2Y * invM2; + md.invMLin2Z = j.lin2Z * invM2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; + __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; + __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; + md.invMAng1X = __tmp__X; + md.invMAng1Y = __tmp__Y; + md.invMAng1Z = __tmp__Z; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; + __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; + __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; + md.invMAng2X = __tmp__X1; + md.invMAng2Y = __tmp__Y1; + md.invMAng2Z = __tmp__Z1; + md.mass = md.invMLin1X * j.lin1X + md.invMLin1Y * j.lin1Y + md.invMLin1Z * j.lin1Z + (md.invMLin2X * j.lin2X + md.invMLin2Y * j.lin2Y + md.invMLin2Z * j.lin2Z) + (md.invMAng1X * j.ang1X + md.invMAng1Y * j.ang1Y + md.invMAng1Z * j.ang1Z) + (md.invMAng2X * j.ang2X + md.invMAng2Y * j.ang2Y + md.invMAng2Z * j.ang2Z); + if(md.mass != 0) { + md.mass = 1 / md.mass; + } + } + var lv1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2; + var lv2X; + var lv2Y; + var lv2Z; + var av1; + var av1X; + var av1Y; + var av1Z; + var av2; + var av2X; + var av2Y; + var av2Z; + lv1X = 0; + lv1Y = 0; + lv1Z = 0; + lv2X = 0; + lv2Y = 0; + lv2Z = 0; + av1X = 0; + av1Y = 0; + av1Z = 0; + av2X = 0; + av2Y = 0; + av2Z = 0; + var _g2 = 0; + var _g11 = this.info.numRows; + while(_g2 < _g11) { + var i1 = _g2++; + var row1 = this.info.rows[i1]; + var md1 = this.massData[i1]; + var imp1 = row1.impulse; + var j1 = row1.jacobian; + var rv = 0; + rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; + rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; + rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; + rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; + var impulseP = (row1.rhs * oimo.common.Setting.positionNgsBaumgarte - rv) * md1.mass; + var oldImpulseP = imp1.impulseP; + imp1.impulseP += impulseP; + if(imp1.impulseP < row1.minImpulse) { + imp1.impulseP = row1.minImpulse; + } else if(imp1.impulseP > row1.maxImpulse) { + imp1.impulseP = row1.maxImpulse; + } + impulseP = imp1.impulseP - oldImpulseP; + lv1X += md1.invMLin1X * impulseP; + lv1Y += md1.invMLin1Y * impulseP; + lv1Z += md1.invMLin1Z * impulseP; + lv2X += md1.invMLin2X * -impulseP; + lv2Y += md1.invMLin2Y * -impulseP; + lv2Z += md1.invMLin2Z * -impulseP; + av1X += md1.invMAng1X * impulseP; + av1Y += md1.invMAng1Y * impulseP; + av1Z += md1.invMAng1Z * impulseP; + av2X += md1.invMAng2X * -impulseP; + av2Y += md1.invMAng2Y * -impulseP; + av2Z += md1.invMAng2Z * -impulseP; + } + var _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + var _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; + var _this2 = this._b1; + var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxis; + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av1X * rotationToSinAxisFactor; + sinAxisY = av1Y * rotationToSinAxisFactor; + sinAxisZ = av1Z * rotationToSinAxisFactor; + var dq; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var q; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this2._transform._rotation00; + var e11 = _this2._transform._rotation11; + var e22 = _this2._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this2._transform._rotation00 = 1 - yy - zz; + _this2._transform._rotation01 = xy - wz; + _this2._transform._rotation02 = xz + wy; + _this2._transform._rotation10 = xy + wz; + _this2._transform._rotation11 = 1 - xx - zz; + _this2._transform._rotation12 = yz - wx; + _this2._transform._rotation20 = xz - wy; + _this2._transform._rotation21 = yz + wx; + _this2._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; + __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; + __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; + __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; + __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; + __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; + __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; + __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; + __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; + _this2._invInertia00 = __tmp__00; + _this2._invInertia01 = __tmp__01; + _this2._invInertia02 = __tmp__02; + _this2._invInertia10 = __tmp__10; + _this2._invInertia11 = __tmp__11; + _this2._invInertia12 = __tmp__12; + _this2._invInertia20 = __tmp__20; + _this2._invInertia21 = __tmp__21; + _this2._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; + __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; + __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; + __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; + __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; + __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; + __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; + __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; + __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; + _this2._invInertia00 = __tmp__001; + _this2._invInertia01 = __tmp__011; + _this2._invInertia02 = __tmp__021; + _this2._invInertia10 = __tmp__101; + _this2._invInertia11 = __tmp__111; + _this2._invInertia12 = __tmp__121; + _this2._invInertia20 = __tmp__201; + _this2._invInertia21 = __tmp__211; + _this2._invInertia22 = __tmp__221; + _this2._invInertia00 *= _this2._rotFactor.x; + _this2._invInertia01 *= _this2._rotFactor.x; + _this2._invInertia02 *= _this2._rotFactor.x; + _this2._invInertia10 *= _this2._rotFactor.y; + _this2._invInertia11 *= _this2._rotFactor.y; + _this2._invInertia12 *= _this2._rotFactor.y; + _this2._invInertia20 *= _this2._rotFactor.z; + _this2._invInertia21 *= _this2._rotFactor.z; + _this2._invInertia22 *= _this2._rotFactor.z; + var _this3 = this._b2; + var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta1 = theta1 * 0.5; + var rotationToSinAxisFactor1; + var cosHalfTheta1; + if(halfTheta1 < 0.5) { + var ht21 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); + cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; + cosHalfTheta1 = Math.cos(halfTheta1); + } + var sinAxis1; + var sinAxisX1; + var sinAxisY1; + var sinAxisZ1; + sinAxisX1 = av2X * rotationToSinAxisFactor1; + sinAxisY1 = av2Y * rotationToSinAxisFactor1; + sinAxisZ1 = av2Z * rotationToSinAxisFactor1; + var dq1; + var dqX1; + var dqY1; + var dqZ1; + var dqW1; + dqX1 = sinAxisX1; + dqY1 = sinAxisY1; + dqZ1 = sinAxisZ1; + dqW1 = cosHalfTheta1; + var q1; + var qX1; + var qY1; + var qZ1; + var qW1; + var e001 = _this3._transform._rotation00; + var e111 = _this3._transform._rotation11; + var e221 = _this3._transform._rotation22; + var t1 = e001 + e111 + e221; + var s1; + if(t1 > 0) { + s1 = Math.sqrt(t1 + 1); + qW1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } else if(e001 > e111) { + if(e001 > e221) { + s1 = Math.sqrt(e001 - e111 - e221 + 1); + qX1 = 0.5 * s1; + s1 = 0.5 / s1; + qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + } else if(e111 > e221) { + s1 = Math.sqrt(e111 - e221 - e001 + 1); + qY1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + } else { + s1 = Math.sqrt(e221 - e001 - e111 + 1); + qZ1 = 0.5 * s1; + s1 = 0.5 / s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; + } + qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; + qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; + qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; + qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; + var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + if(l1 > 1e-32) { + l1 = 1 / Math.sqrt(l1); + } + qX1 *= l1; + qY1 *= l1; + qZ1 *= l1; + qW1 *= l1; + var x1 = qX1; + var y1 = qY1; + var z1 = qZ1; + var w1 = qW1; + var x21 = 2 * x1; + var y21 = 2 * y1; + var z21 = 2 * z1; + var xx1 = x1 * x21; + var yy1 = y1 * y21; + var zz1 = z1 * z21; + var xy1 = x1 * y21; + var yz1 = y1 * z21; + var xz1 = x1 * z21; + var wx1 = w1 * x21; + var wy1 = w1 * y21; + var wz1 = w1 * z21; + _this3._transform._rotation00 = 1 - yy1 - zz1; + _this3._transform._rotation01 = xy1 - wz1; + _this3._transform._rotation02 = xz1 + wy1; + _this3._transform._rotation10 = xy1 + wz1; + _this3._transform._rotation11 = 1 - xx1 - zz1; + _this3._transform._rotation12 = yz1 - wx1; + _this3._transform._rotation20 = xz1 - wy1; + _this3._transform._rotation21 = yz1 + wx1; + _this3._transform._rotation22 = 1 - xx1 - yy1; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; + __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; + __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; + __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; + __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; + __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; + __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; + __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; + __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; + _this3._invInertia00 = __tmp__002; + _this3._invInertia01 = __tmp__012; + _this3._invInertia02 = __tmp__022; + _this3._invInertia10 = __tmp__102; + _this3._invInertia11 = __tmp__112; + _this3._invInertia12 = __tmp__122; + _this3._invInertia20 = __tmp__202; + _this3._invInertia21 = __tmp__212; + _this3._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; + __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; + __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; + __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; + __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; + __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; + __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; + __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; + __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; + _this3._invInertia00 = __tmp__003; + _this3._invInertia01 = __tmp__013; + _this3._invInertia02 = __tmp__023; + _this3._invInertia10 = __tmp__103; + _this3._invInertia11 = __tmp__113; + _this3._invInertia12 = __tmp__123; + _this3._invInertia20 = __tmp__203; + _this3._invInertia21 = __tmp__213; + _this3._invInertia22 = __tmp__223; + _this3._invInertia00 *= _this3._rotFactor.x; + _this3._invInertia01 *= _this3._rotFactor.x; + _this3._invInertia02 *= _this3._rotFactor.x; + _this3._invInertia10 *= _this3._rotFactor.y; + _this3._invInertia11 *= _this3._rotFactor.y; + _this3._invInertia12 *= _this3._rotFactor.y; + _this3._invInertia20 *= _this3._rotFactor.z; + _this3._invInertia21 *= _this3._rotFactor.z; + _this3._invInertia22 *= _this3._rotFactor.z; + } + postSolve() { + this.joint._syncAnchors(); + this.joint._checkDestruction(); + } +} +if(!oimo.dynamics.rigidbody) oimo.dynamics.rigidbody = {}; +oimo.dynamics.rigidbody.MassData = class oimo_dynamics_rigidbody_MassData { + constructor() { + this.mass = 0; + this.localInertia = new oimo.common.Mat3(); + } +} +oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { + constructor(config) { + this._next = null; + this._prev = null; + this._shapeList = null; + this._shapeListLast = null; + this._numShapes = 0; + this._contactLinkList = null; + this._contactLinkListLast = null; + this._numContactLinks = 0; + this._jointLinkList = null; + this._jointLinkListLast = null; + this._numJointLinks = 0; + var v = config.linearVelocity; + this._velX = v.x; + this._velY = v.y; + this._velZ = v.z; + var v1 = config.angularVelocity; + this._angVelX = v1.x; + this._angVelY = v1.y; + this._angVelZ = v1.z; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + this._ptransform = new oimo.common.Transform(); + this._transform = new oimo.common.Transform(); + var v2 = config.position; + this._ptransform._positionX = v2.x; + this._ptransform._positionY = v2.y; + this._ptransform._positionZ = v2.z; + var m = config.rotation; + this._ptransform._rotation00 = m.e00; + this._ptransform._rotation01 = m.e01; + this._ptransform._rotation02 = m.e02; + this._ptransform._rotation10 = m.e10; + this._ptransform._rotation11 = m.e11; + this._ptransform._rotation12 = m.e12; + this._ptransform._rotation20 = m.e20; + this._ptransform._rotation21 = m.e21; + this._ptransform._rotation22 = m.e22; + var dst = this._transform; + var src = this._ptransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + this._type = config.type; + this._sleepTime = 0; + this._sleeping = false; + this._autoSleep = config.autoSleep; + this._mass = 0; + this._invMass = 0; + this._localInertia00 = 0; + this._localInertia01 = 0; + this._localInertia02 = 0; + this._localInertia10 = 0; + this._localInertia11 = 0; + this._localInertia12 = 0; + this._localInertia20 = 0; + this._localInertia21 = 0; + this._localInertia22 = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + this._invInertia00 = 0; + this._invInertia01 = 0; + this._invInertia02 = 0; + this._invInertia10 = 0; + this._invInertia11 = 0; + this._invInertia12 = 0; + this._invInertia20 = 0; + this._invInertia21 = 0; + this._invInertia22 = 0; + this._linearDamping = config.linearDamping; + this._angularDamping = config.angularDamping; + this._forceX = 0; + this._forceY = 0; + this._forceZ = 0; + this._torqueX = 0; + this._torqueY = 0; + this._torqueZ = 0; + this._linearContactImpulseX = 0; + this._linearContactImpulseY = 0; + this._linearContactImpulseZ = 0; + this._angularContactImpulseX = 0; + this._angularContactImpulseY = 0; + this._angularContactImpulseZ = 0; + this._rotFactor = new oimo.common.Vec3(1,1,1); + this._addedToIsland = false; + this._gravityScale = 1; + this._world = null; + } + _integrate(dt) { + switch(this._type) { + case 1: + this._velX = 0; + this._velY = 0; + this._velZ = 0; + this._angVelX = 0; + this._angVelY = 0; + this._angVelZ = 0; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + break; + case 0:case 2: + var translation; + var translationX; + var translationY; + var translationZ; + var rotation; + var rotationX; + var rotationY; + var rotationZ; + translationX = this._velX * dt; + translationY = this._velY * dt; + translationZ = this._velZ * dt; + rotationX = this._angVelX * dt; + rotationY = this._angVelY * dt; + rotationZ = this._angVelZ * dt; + var translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; + var rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; + if(translationLengthSq == 0 && rotationLengthSq == 0) { + return; + } + if(translationLengthSq > oimo.common.Setting.maxTranslationPerStep * oimo.common.Setting.maxTranslationPerStep) { + var l = oimo.common.Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); + this._velX *= l; + this._velY *= l; + this._velZ *= l; + translationX *= l; + translationY *= l; + translationZ *= l; + } + if(rotationLengthSq > oimo.common.Setting.maxRotationPerStep * oimo.common.Setting.maxRotationPerStep) { + var l1 = oimo.common.Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); + this._angVelX *= l1; + this._angVelY *= l1; + this._angVelZ *= l1; + rotationX *= l1; + rotationY *= l1; + rotationZ *= l1; + } + this._transform._positionX += translationX; + this._transform._positionY += translationY; + this._transform._positionZ += translationZ; + var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxis; + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = rotationX * rotationToSinAxisFactor; + sinAxisY = rotationY * rotationToSinAxisFactor; + sinAxisZ = rotationZ * rotationToSinAxisFactor; + var dq; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var q; + var qX; + var qY; + var qZ; + var qW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation21 - this._transform._rotation12) * s; + qY = (this._transform._rotation02 - this._transform._rotation20) * s; + qZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation02 + this._transform._rotation20) * s; + qW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l2 = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l2 > 1e-32) { + l2 = 1 / Math.sqrt(l2); + } + qX *= l2; + qY *= l2; + qZ *= l2; + qW *= l2; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + break; + } + } + _integratePseudoVelocity() { + var pseudoVelLengthSq = this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ; + var angPseudoVelLengthSq = this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ; + if(pseudoVelLengthSq == 0 && angPseudoVelLengthSq == 0) { + return; + } + switch(this._type) { + case 1: + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + break; + case 0:case 2: + var translation; + var translationX; + var translationY; + var translationZ; + var rotation; + var rotationX; + var rotationY; + var rotationZ; + translationX = this._pseudoVelX; + translationY = this._pseudoVelY; + translationZ = this._pseudoVelZ; + rotationX = this._angPseudoVelX; + rotationY = this._angPseudoVelY; + rotationZ = this._angPseudoVelZ; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + this._transform._positionX += translationX; + this._transform._positionY += translationY; + this._transform._positionZ += translationZ; + var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxis; + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = rotationX * rotationToSinAxisFactor; + sinAxisY = rotationY * rotationToSinAxisFactor; + sinAxisZ = rotationZ * rotationToSinAxisFactor; + var dq; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var q; + var qX; + var qY; + var qZ; + var qW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation21 - this._transform._rotation12) * s; + qY = (this._transform._rotation02 - this._transform._rotation20) * s; + qZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation02 + this._transform._rotation20) * s; + qW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + break; + } + } + updateMass() { + var totalInertia; + var totalInertia00; + var totalInertia01; + var totalInertia02; + var totalInertia10; + var totalInertia11; + var totalInertia12; + var totalInertia20; + var totalInertia21; + var totalInertia22; + totalInertia00 = 0; + totalInertia01 = 0; + totalInertia02 = 0; + totalInertia10 = 0; + totalInertia11 = 0; + totalInertia12 = 0; + totalInertia20 = 0; + totalInertia21 = 0; + totalInertia22 = 0; + var totalMass = 0; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var g = s._geom; + g._updateMass(); + var mass = s._density * g._volume; + var inertia; + var inertia00; + var inertia01; + var inertia02; + var inertia10; + var inertia11; + var inertia12; + var inertia20; + var inertia21; + var inertia22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = s._localTransform._rotation00 * g._inertiaCoeff00 + s._localTransform._rotation01 * g._inertiaCoeff10 + s._localTransform._rotation02 * g._inertiaCoeff20; + __tmp__01 = s._localTransform._rotation00 * g._inertiaCoeff01 + s._localTransform._rotation01 * g._inertiaCoeff11 + s._localTransform._rotation02 * g._inertiaCoeff21; + __tmp__02 = s._localTransform._rotation00 * g._inertiaCoeff02 + s._localTransform._rotation01 * g._inertiaCoeff12 + s._localTransform._rotation02 * g._inertiaCoeff22; + __tmp__10 = s._localTransform._rotation10 * g._inertiaCoeff00 + s._localTransform._rotation11 * g._inertiaCoeff10 + s._localTransform._rotation12 * g._inertiaCoeff20; + __tmp__11 = s._localTransform._rotation10 * g._inertiaCoeff01 + s._localTransform._rotation11 * g._inertiaCoeff11 + s._localTransform._rotation12 * g._inertiaCoeff21; + __tmp__12 = s._localTransform._rotation10 * g._inertiaCoeff02 + s._localTransform._rotation11 * g._inertiaCoeff12 + s._localTransform._rotation12 * g._inertiaCoeff22; + __tmp__20 = s._localTransform._rotation20 * g._inertiaCoeff00 + s._localTransform._rotation21 * g._inertiaCoeff10 + s._localTransform._rotation22 * g._inertiaCoeff20; + __tmp__21 = s._localTransform._rotation20 * g._inertiaCoeff01 + s._localTransform._rotation21 * g._inertiaCoeff11 + s._localTransform._rotation22 * g._inertiaCoeff21; + __tmp__22 = s._localTransform._rotation20 * g._inertiaCoeff02 + s._localTransform._rotation21 * g._inertiaCoeff12 + s._localTransform._rotation22 * g._inertiaCoeff22; + inertia00 = __tmp__00; + inertia01 = __tmp__01; + inertia02 = __tmp__02; + inertia10 = __tmp__10; + inertia11 = __tmp__11; + inertia12 = __tmp__12; + inertia20 = __tmp__20; + inertia21 = __tmp__21; + inertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = inertia00 * s._localTransform._rotation00 + inertia01 * s._localTransform._rotation01 + inertia02 * s._localTransform._rotation02; + __tmp__011 = inertia00 * s._localTransform._rotation10 + inertia01 * s._localTransform._rotation11 + inertia02 * s._localTransform._rotation12; + __tmp__021 = inertia00 * s._localTransform._rotation20 + inertia01 * s._localTransform._rotation21 + inertia02 * s._localTransform._rotation22; + __tmp__101 = inertia10 * s._localTransform._rotation00 + inertia11 * s._localTransform._rotation01 + inertia12 * s._localTransform._rotation02; + __tmp__111 = inertia10 * s._localTransform._rotation10 + inertia11 * s._localTransform._rotation11 + inertia12 * s._localTransform._rotation12; + __tmp__121 = inertia10 * s._localTransform._rotation20 + inertia11 * s._localTransform._rotation21 + inertia12 * s._localTransform._rotation22; + __tmp__201 = inertia20 * s._localTransform._rotation00 + inertia21 * s._localTransform._rotation01 + inertia22 * s._localTransform._rotation02; + __tmp__211 = inertia20 * s._localTransform._rotation10 + inertia21 * s._localTransform._rotation11 + inertia22 * s._localTransform._rotation12; + __tmp__221 = inertia20 * s._localTransform._rotation20 + inertia21 * s._localTransform._rotation21 + inertia22 * s._localTransform._rotation22; + inertia00 = __tmp__001; + inertia01 = __tmp__011; + inertia02 = __tmp__021; + inertia10 = __tmp__101; + inertia11 = __tmp__111; + inertia12 = __tmp__121; + inertia20 = __tmp__201; + inertia21 = __tmp__211; + inertia22 = __tmp__221; + inertia00 *= mass; + inertia01 *= mass; + inertia02 *= mass; + inertia10 *= mass; + inertia11 *= mass; + inertia12 *= mass; + inertia20 *= mass; + inertia21 *= mass; + inertia22 *= mass; + var cogInertia; + var cogInertia00; + var cogInertia01; + var cogInertia02; + var cogInertia10; + var cogInertia11; + var cogInertia12; + var cogInertia20; + var cogInertia21; + var cogInertia22; + var xx = s._localTransform._positionX * s._localTransform._positionX; + var yy = s._localTransform._positionY * s._localTransform._positionY; + var zz = s._localTransform._positionZ * s._localTransform._positionZ; + var xy = -s._localTransform._positionX * s._localTransform._positionY; + var yz = -s._localTransform._positionY * s._localTransform._positionZ; + var zx = -s._localTransform._positionZ * s._localTransform._positionX; + cogInertia00 = yy + zz; + cogInertia01 = xy; + cogInertia02 = zx; + cogInertia10 = xy; + cogInertia11 = xx + zz; + cogInertia12 = yz; + cogInertia20 = zx; + cogInertia21 = yz; + cogInertia22 = xx + yy; + inertia00 += cogInertia00 * mass; + inertia01 += cogInertia01 * mass; + inertia02 += cogInertia02 * mass; + inertia10 += cogInertia10 * mass; + inertia11 += cogInertia11 * mass; + inertia12 += cogInertia12 * mass; + inertia20 += cogInertia20 * mass; + inertia21 += cogInertia21 * mass; + inertia22 += cogInertia22 * mass; + totalMass += mass; + totalInertia00 += inertia00; + totalInertia01 += inertia01; + totalInertia02 += inertia02; + totalInertia10 += inertia10; + totalInertia11 += inertia11; + totalInertia12 += inertia12; + totalInertia20 += inertia20; + totalInertia21 += inertia21; + totalInertia22 += inertia22; + s = n; + } + this._mass = totalMass; + this._localInertia00 = totalInertia00; + this._localInertia01 = totalInertia01; + this._localInertia02 = totalInertia02; + this._localInertia10 = totalInertia10; + this._localInertia11 = totalInertia11; + this._localInertia12 = totalInertia12; + this._localInertia20 = totalInertia20; + this._localInertia21 = totalInertia21; + this._localInertia22 = totalInertia22; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + if(this._mass > 0 && det > 0 && this._type == 0) { + this._invMass = 1 / this._mass; + var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; + var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; + var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; + var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; + var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; + var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; + var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + if(d < -1e-32 || d > 1e-32) { + d = 1 / d; + } + this._invLocalInertia00 = d001 * d; + this._invLocalInertia01 = -d10 * d; + this._invLocalInertia02 = d20 * d; + this._invLocalInertia10 = -d011 * d; + this._invLocalInertia11 = d11 * d; + this._invLocalInertia12 = -d21 * d; + this._invLocalInertia20 = d021 * d; + this._invLocalInertia21 = -d12 * d; + this._invLocalInertia22 = d22 * d; + this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; + this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; + this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; + this._invLocalInertiaWithoutRotFactor10 = this._invLocalInertia10; + this._invLocalInertiaWithoutRotFactor11 = this._invLocalInertia11; + this._invLocalInertiaWithoutRotFactor12 = this._invLocalInertia12; + this._invLocalInertiaWithoutRotFactor20 = this._invLocalInertia20; + this._invLocalInertiaWithoutRotFactor21 = this._invLocalInertia21; + this._invLocalInertiaWithoutRotFactor22 = this._invLocalInertia22; + this._invLocalInertia00 = this._invLocalInertiaWithoutRotFactor00 * this._rotFactor.x; + this._invLocalInertia01 = this._invLocalInertiaWithoutRotFactor01 * this._rotFactor.x; + this._invLocalInertia02 = this._invLocalInertiaWithoutRotFactor02 * this._rotFactor.x; + this._invLocalInertia10 = this._invLocalInertiaWithoutRotFactor10 * this._rotFactor.y; + this._invLocalInertia11 = this._invLocalInertiaWithoutRotFactor11 * this._rotFactor.y; + this._invLocalInertia12 = this._invLocalInertiaWithoutRotFactor12 * this._rotFactor.y; + this._invLocalInertia20 = this._invLocalInertiaWithoutRotFactor20 * this._rotFactor.z; + this._invLocalInertia21 = this._invLocalInertiaWithoutRotFactor21 * this._rotFactor.z; + this._invLocalInertia22 = this._invLocalInertiaWithoutRotFactor22 * this._rotFactor.z; + } else { + this._invMass = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + if(this._type == 0) { + this._type = 1; + } + } + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__012 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__022 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__102 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__112 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__122 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__202 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__212 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__222 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__013 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__023 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__103 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__113 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__123 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__203 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__213 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__223 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__003; + this._invInertia01 = __tmp__013; + this._invInertia02 = __tmp__023; + this._invInertia10 = __tmp__103; + this._invInertia11 = __tmp__113; + this._invInertia12 = __tmp__123; + this._invInertia20 = __tmp__203; + this._invInertia21 = __tmp__213; + this._invInertia22 = __tmp__223; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + getPosition() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._transform._positionX; + v1.y = this._transform._positionY; + v1.z = this._transform._positionZ; + return v; + } + getPositionTo(position) { + var v = position; + v.x = this._transform._positionX; + v.y = this._transform._positionY; + v.z = this._transform._positionZ; + } + setPosition(position) { + var v = position; + this._transform._positionX = v.x; + this._transform._positionY = v.y; + this._transform._positionZ = v.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v1 = s.displacement; + v1.x = dX; + v1.y = dY; + v1.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + translate(translation) { + var diff; + var diffX; + var diffY; + var diffZ; + var v = translation; + diffX = v.x; + diffY = v.y; + diffZ = v.z; + this._transform._positionX += diffX; + this._transform._positionY += diffY; + this._transform._positionZ += diffZ; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v1 = s.displacement; + v1.x = dX; + v1.y = dY; + v1.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + getRotation() { + var m = new oimo.common.Mat3(); + var m1 = m; + m1.e00 = this._transform._rotation00; + m1.e01 = this._transform._rotation01; + m1.e02 = this._transform._rotation02; + m1.e10 = this._transform._rotation10; + m1.e11 = this._transform._rotation11; + m1.e12 = this._transform._rotation12; + m1.e20 = this._transform._rotation20; + m1.e21 = this._transform._rotation21; + m1.e22 = this._transform._rotation22; + return m; + } + getRotationTo(rotation) { + var m = rotation; + m.e00 = this._transform._rotation00; + m.e01 = this._transform._rotation01; + m.e02 = this._transform._rotation02; + m.e10 = this._transform._rotation10; + m.e11 = this._transform._rotation11; + m.e12 = this._transform._rotation12; + m.e20 = this._transform._rotation20; + m.e21 = this._transform._rotation21; + m.e22 = this._transform._rotation22; + } + setRotation(rotation) { + var m = rotation; + this._transform._rotation00 = m.e00; + this._transform._rotation01 = m.e01; + this._transform._rotation02 = m.e02; + this._transform._rotation10 = m.e10; + this._transform._rotation11 = m.e11; + this._transform._rotation12 = m.e12; + this._transform._rotation20 = m.e20; + this._transform._rotation21 = m.e21; + this._transform._rotation22 = m.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + setRotationXyz(eulerAngles) { + var xyz; + var xyzX; + var xyzY; + var xyzZ; + var v = eulerAngles; + xyzX = v.x; + xyzY = v.y; + xyzZ = v.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + this._transform._rotation00 = cy * cz; + this._transform._rotation01 = -cy * sz; + this._transform._rotation02 = sy; + this._transform._rotation10 = cx * sz + cz * sx * sy; + this._transform._rotation11 = cx * cz - sx * sy * sz; + this._transform._rotation12 = -cy * sx; + this._transform._rotation20 = sx * sz - cx * cz * sy; + this._transform._rotation21 = cz * sx + cx * sy * sz; + this._transform._rotation22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v1 = s.displacement; + v1.x = dX; + v1.y = dY; + v1.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + rotate(rotation) { + var rot; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + var m = rotation; + rot00 = m.e00; + rot01 = m.e01; + rot02 = m.e02; + rot10 = m.e10; + rot11 = m.e11; + rot12 = m.e12; + rot20 = m.e20; + rot21 = m.e21; + rot22 = m.e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; + __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; + __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; + __tmp__10 = rot10 * this._transform._rotation00 + rot11 * this._transform._rotation10 + rot12 * this._transform._rotation20; + __tmp__11 = rot10 * this._transform._rotation01 + rot11 * this._transform._rotation11 + rot12 * this._transform._rotation21; + __tmp__12 = rot10 * this._transform._rotation02 + rot11 * this._transform._rotation12 + rot12 * this._transform._rotation22; + __tmp__20 = rot20 * this._transform._rotation00 + rot21 * this._transform._rotation10 + rot22 * this._transform._rotation20; + __tmp__21 = rot20 * this._transform._rotation01 + rot21 * this._transform._rotation11 + rot22 * this._transform._rotation21; + __tmp__22 = rot20 * this._transform._rotation02 + rot21 * this._transform._rotation12 + rot22 * this._transform._rotation22; + this._transform._rotation00 = __tmp__00; + this._transform._rotation01 = __tmp__01; + this._transform._rotation02 = __tmp__02; + this._transform._rotation10 = __tmp__10; + this._transform._rotation11 = __tmp__11; + this._transform._rotation12 = __tmp__12; + this._transform._rotation20 = __tmp__20; + this._transform._rotation21 = __tmp__21; + this._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + rotateXyz(eulerAngles) { + var xyz; + var xyzX; + var xyzY; + var xyzZ; + var rot; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + var v = eulerAngles; + xyzX = v.x; + xyzY = v.y; + xyzZ = v.z; + var sx = Math.sin(xyzX); + var sy = Math.sin(xyzY); + var sz = Math.sin(xyzZ); + var cx = Math.cos(xyzX); + var cy = Math.cos(xyzY); + var cz = Math.cos(xyzZ); + rot00 = cy * cz; + rot01 = -cy * sz; + rot02 = sy; + rot10 = cx * sz + cz * sx * sy; + rot11 = cx * cz - sx * sy * sz; + rot12 = -cy * sx; + rot20 = sx * sz - cx * cz * sy; + rot21 = cz * sx + cx * sy * sz; + rot22 = cx * cy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; + __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; + __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; + __tmp__10 = rot10 * this._transform._rotation00 + rot11 * this._transform._rotation10 + rot12 * this._transform._rotation20; + __tmp__11 = rot10 * this._transform._rotation01 + rot11 * this._transform._rotation11 + rot12 * this._transform._rotation21; + __tmp__12 = rot10 * this._transform._rotation02 + rot11 * this._transform._rotation12 + rot12 * this._transform._rotation22; + __tmp__20 = rot20 * this._transform._rotation00 + rot21 * this._transform._rotation10 + rot22 * this._transform._rotation20; + __tmp__21 = rot20 * this._transform._rotation01 + rot21 * this._transform._rotation11 + rot22 * this._transform._rotation21; + __tmp__22 = rot20 * this._transform._rotation02 + rot21 * this._transform._rotation12 + rot22 * this._transform._rotation22; + this._transform._rotation00 = __tmp__00; + this._transform._rotation01 = __tmp__01; + this._transform._rotation02 = __tmp__02; + this._transform._rotation10 = __tmp__10; + this._transform._rotation11 = __tmp__11; + this._transform._rotation12 = __tmp__12; + this._transform._rotation20 = __tmp__20; + this._transform._rotation21 = __tmp__21; + this._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__002; + this._invInertia01 = __tmp__012; + this._invInertia02 = __tmp__022; + this._invInertia10 = __tmp__102; + this._invInertia11 = __tmp__112; + this._invInertia12 = __tmp__122; + this._invInertia20 = __tmp__202; + this._invInertia21 = __tmp__212; + this._invInertia22 = __tmp__222; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v1 = s.displacement; + v1.x = dX; + v1.y = dY; + v1.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + getOrientation() { + var q = new oimo.common.Quat(); + var iq; + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation21 - this._transform._rotation12) * s; + iqY = (this._transform._rotation02 - this._transform._rotation20) * s; + iqZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation02 + this._transform._rotation20) * s; + iqW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + var q1 = q; + q1.x = iqX; + q1.y = iqY; + q1.z = iqZ; + q1.w = iqW; + return q; + } + getOrientationTo(orientation) { + var iq; + var iqX; + var iqY; + var iqZ; + var iqW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + iqW = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation21 - this._transform._rotation12) * s; + iqY = (this._transform._rotation02 - this._transform._rotation20) * s; + iqZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + iqX = 0.5 * s; + s = 0.5 / s; + iqY = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation02 + this._transform._rotation20) * s; + iqW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + iqY = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation01 + this._transform._rotation10) * s; + iqZ = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + iqZ = 0.5 * s; + s = 0.5 / s; + iqX = (this._transform._rotation02 + this._transform._rotation20) * s; + iqY = (this._transform._rotation12 + this._transform._rotation21) * s; + iqW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + var q = orientation; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; + } + setOrientation(quaternion) { + var q; + var qX; + var qY; + var qZ; + var qW; + var q1 = quaternion; + qX = q1.x; + qY = q1.y; + qZ = q1.z; + qW = q1.w; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + getTransform() { + var _this = this._transform; + var tf = new oimo.common.Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + getTransformTo(transform) { + var transform1 = this._transform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + setTransform(transform) { + this._transform._positionX = transform._positionX; + this._transform._positionY = transform._positionY; + this._transform._positionZ = transform._positionZ; + this._transform._rotation00 = transform._rotation00; + this._transform._rotation01 = transform._rotation01; + this._transform._rotation02 = transform._rotation02; + this._transform._rotation10 = transform._rotation10; + this._transform._rotation11 = transform._rotation11; + this._transform._rotation12 = transform._rotation12; + this._transform._rotation20 = transform._rotation20; + this._transform._rotation21 = transform._rotation21; + this._transform._rotation22 = transform._rotation22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + var dst = this._ptransform; + var src = this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__002; + dst1._rotation01 = __tmp__012; + dst1._rotation02 = __tmp__022; + dst1._rotation10 = __tmp__102; + dst1._rotation11 = __tmp__112; + dst1._rotation12 = __tmp__122; + dst1._rotation20 = __tmp__202; + dst1._rotation21 = __tmp__212; + dst1._rotation22 = __tmp__222; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += src2._positionX; + dst1._positionY += src2._positionY; + dst1._positionZ += src2._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__003; + dst2._rotation01 = __tmp__013; + dst2._rotation02 = __tmp__023; + dst2._rotation10 = __tmp__103; + dst2._rotation11 = __tmp__113; + dst2._rotation12 = __tmp__123; + dst2._rotation20 = __tmp__203; + dst2._rotation21 = __tmp__213; + dst2._rotation22 = __tmp__223; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += src21._positionX; + dst2._positionY += src21._positionY; + dst2._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + this._sleeping = false; + this._sleepTime = 0; + } + getMass() { + return this._mass; + } + getLocalInertia() { + var m = new oimo.common.Mat3(); + var m1 = m; + m1.e00 = this._localInertia00; + m1.e01 = this._localInertia01; + m1.e02 = this._localInertia02; + m1.e10 = this._localInertia10; + m1.e11 = this._localInertia11; + m1.e12 = this._localInertia12; + m1.e20 = this._localInertia20; + m1.e21 = this._localInertia21; + m1.e22 = this._localInertia22; + return m; + } + getLocalInertiaTo(inertia) { + var m = inertia; + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + } + getMassData() { + var md = new oimo.dynamics.rigidbody.MassData(); + md.mass = this._mass; + var m = md.localInertia; + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + return md; + } + getMassDataTo(massData) { + massData.mass = this._mass; + var m = massData.localInertia; + m.e00 = this._localInertia00; + m.e01 = this._localInertia01; + m.e02 = this._localInertia02; + m.e10 = this._localInertia10; + m.e11 = this._localInertia11; + m.e12 = this._localInertia12; + m.e20 = this._localInertia20; + m.e21 = this._localInertia21; + m.e22 = this._localInertia22; + } + setMassData(massData) { + this._mass = massData.mass; + var m = massData.localInertia; + this._localInertia00 = m.e00; + this._localInertia01 = m.e01; + this._localInertia02 = m.e02; + this._localInertia10 = m.e10; + this._localInertia11 = m.e11; + this._localInertia12 = m.e12; + this._localInertia20 = m.e20; + this._localInertia21 = m.e21; + this._localInertia22 = m.e22; + var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + if(this._mass > 0 && det > 0 && this._type == 0) { + this._invMass = 1 / this._mass; + var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; + var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; + var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; + var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; + var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; + var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; + var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + if(d < -1e-32 || d > 1e-32) { + d = 1 / d; + } + this._invLocalInertia00 = d001 * d; + this._invLocalInertia01 = -d10 * d; + this._invLocalInertia02 = d20 * d; + this._invLocalInertia10 = -d011 * d; + this._invLocalInertia11 = d11 * d; + this._invLocalInertia12 = -d21 * d; + this._invLocalInertia20 = d021 * d; + this._invLocalInertia21 = -d12 * d; + this._invLocalInertia22 = d22 * d; + this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; + this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; + this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; + this._invLocalInertiaWithoutRotFactor10 = this._invLocalInertia10; + this._invLocalInertiaWithoutRotFactor11 = this._invLocalInertia11; + this._invLocalInertiaWithoutRotFactor12 = this._invLocalInertia12; + this._invLocalInertiaWithoutRotFactor20 = this._invLocalInertia20; + this._invLocalInertiaWithoutRotFactor21 = this._invLocalInertia21; + this._invLocalInertiaWithoutRotFactor22 = this._invLocalInertia22; + this._invLocalInertia00 = this._invLocalInertiaWithoutRotFactor00 * this._rotFactor.x; + this._invLocalInertia01 = this._invLocalInertiaWithoutRotFactor01 * this._rotFactor.x; + this._invLocalInertia02 = this._invLocalInertiaWithoutRotFactor02 * this._rotFactor.x; + this._invLocalInertia10 = this._invLocalInertiaWithoutRotFactor10 * this._rotFactor.y; + this._invLocalInertia11 = this._invLocalInertiaWithoutRotFactor11 * this._rotFactor.y; + this._invLocalInertia12 = this._invLocalInertiaWithoutRotFactor12 * this._rotFactor.y; + this._invLocalInertia20 = this._invLocalInertiaWithoutRotFactor20 * this._rotFactor.z; + this._invLocalInertia21 = this._invLocalInertiaWithoutRotFactor21 * this._rotFactor.z; + this._invLocalInertia22 = this._invLocalInertiaWithoutRotFactor22 * this._rotFactor.z; + } else { + this._invMass = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + if(this._type == 0) { + this._type = 1; + } + } + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + getRotationFactor() { + var _this = this._rotFactor; + return new oimo.common.Vec3(_this.x,_this.y,_this.z); + } + setRotationFactor(rotationFactor) { + var _this = this._rotFactor; + _this.x = rotationFactor.x; + _this.y = rotationFactor.y; + _this.z = rotationFactor.z; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + this._sleeping = false; + this._sleepTime = 0; + } + getLinearVelocity() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._velX; + v1.y = this._velY; + v1.z = this._velZ; + return v; + } + getLinearVelocityTo(linearVelocity) { + var v = linearVelocity; + v.x = this._velX; + v.y = this._velY; + v.z = this._velZ; + } + setLinearVelocity(linearVelocity) { + if(this._type == 1) { + this._velX = 0; + this._velY = 0; + this._velZ = 0; + } else { + var v = linearVelocity; + this._velX = v.x; + this._velY = v.y; + this._velZ = v.z; + } + this._sleeping = false; + this._sleepTime = 0; + } + getAngularVelocity() { + var v = new oimo.common.Vec3(); + var v1 = v; + v1.x = this._angVelX; + v1.y = this._angVelY; + v1.z = this._angVelZ; + return v; + } + getAngularVelocityTo(angularVelocity) { + var v = angularVelocity; + v.x = this._velX; + v.y = this._velY; + v.z = this._velZ; + } + setAngularVelocity(angularVelocity) { + if(this._type == 1) { + this._angVelX = 0; + this._angVelY = 0; + this._angVelZ = 0; + } else { + var v = angularVelocity; + this._angVelX = v.x; + this._angVelY = v.y; + this._angVelZ = v.z; + } + this._sleeping = false; + this._sleepTime = 0; + } + addLinearVelocity(linearVelocityChange) { + if(this._type != 1) { + var d; + var dX; + var dY; + var dZ; + var v = linearVelocityChange; + dX = v.x; + dY = v.y; + dZ = v.z; + this._velX += dX; + this._velY += dY; + this._velZ += dZ; + } + this._sleeping = false; + this._sleepTime = 0; + } + addAngularVelocity(angularVelocityChange) { + if(this._type != 1) { + var d; + var dX; + var dY; + var dZ; + var v = angularVelocityChange; + dX = v.x; + dY = v.y; + dZ = v.z; + this._angVelX += dX; + this._angVelY += dY; + this._angVelZ += dZ; + } + this._sleeping = false; + this._sleepTime = 0; + } + applyImpulse(impulse,positionInWorld) { + var imp; + var impX; + var impY; + var impZ; + var v = impulse; + impX = v.x; + impY = v.y; + impZ = v.z; + this._velX += impX * this._invMass; + this._velY += impY * this._invMass; + this._velZ += impZ * this._invMass; + var aimp; + var aimpX; + var aimpY; + var aimpZ; + var pos; + var posX; + var posY; + var posZ; + var v1 = positionInWorld; + posX = v1.x; + posY = v1.y; + posZ = v1.z; + posX -= this._transform._positionX; + posY -= this._transform._positionY; + posZ -= this._transform._positionZ; + aimpX = posY * impZ - posZ * impY; + aimpY = posZ * impX - posX * impZ; + aimpZ = posX * impY - posY * impX; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._invInertia00 * aimpX + this._invInertia01 * aimpY + this._invInertia02 * aimpZ; + __tmp__Y = this._invInertia10 * aimpX + this._invInertia11 * aimpY + this._invInertia12 * aimpZ; + __tmp__Z = this._invInertia20 * aimpX + this._invInertia21 * aimpY + this._invInertia22 * aimpZ; + aimpX = __tmp__X; + aimpY = __tmp__Y; + aimpZ = __tmp__Z; + this._angVelX += aimpX; + this._angVelY += aimpY; + this._angVelZ += aimpZ; + this._sleeping = false; + this._sleepTime = 0; + } + applyLinearImpulse(impulse) { + var imp; + var impX; + var impY; + var impZ; + var v = impulse; + impX = v.x; + impY = v.y; + impZ = v.z; + this._velX += impX * this._invMass; + this._velY += impY * this._invMass; + this._velZ += impZ * this._invMass; + this._sleeping = false; + this._sleepTime = 0; + } + applyAngularImpulse(impulse) { + var imp; + var impX; + var impY; + var impZ; + var v = impulse; + impX = v.x; + impY = v.y; + impZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._invInertia00 * impX + this._invInertia01 * impY + this._invInertia02 * impZ; + __tmp__Y = this._invInertia10 * impX + this._invInertia11 * impY + this._invInertia12 * impZ; + __tmp__Z = this._invInertia20 * impX + this._invInertia21 * impY + this._invInertia22 * impZ; + impX = __tmp__X; + impY = __tmp__Y; + impZ = __tmp__Z; + this._angVelX += impX; + this._angVelY += impY; + this._angVelZ += impZ; + this._sleeping = false; + this._sleepTime = 0; + } + applyForce(force,positionInWorld) { + var iforce; + var iforceX; + var iforceY; + var iforceZ; + var v = force; + iforceX = v.x; + iforceY = v.y; + iforceZ = v.z; + this._forceX += iforceX; + this._forceY += iforceY; + this._forceZ += iforceZ; + var itorque; + var itorqueX; + var itorqueY; + var itorqueZ; + var pos; + var posX; + var posY; + var posZ; + var v1 = positionInWorld; + posX = v1.x; + posY = v1.y; + posZ = v1.z; + posX -= this._transform._positionX; + posY -= this._transform._positionY; + posZ -= this._transform._positionZ; + itorqueX = posY * iforceZ - posZ * iforceY; + itorqueY = posZ * iforceX - posX * iforceZ; + itorqueZ = posX * iforceY - posY * iforceX; + this._torqueX += itorqueX; + this._torqueY += itorqueY; + this._torqueZ += itorqueZ; + this._sleeping = false; + this._sleepTime = 0; + } + applyForceToCenter(force) { + var iforce; + var iforceX; + var iforceY; + var iforceZ; + var v = force; + iforceX = v.x; + iforceY = v.y; + iforceZ = v.z; + this._forceX += iforceX; + this._forceY += iforceY; + this._forceZ += iforceZ; + this._sleeping = false; + this._sleepTime = 0; + } + applyTorque(torque) { + var itorque; + var itorqueX; + var itorqueY; + var itorqueZ; + var v = torque; + itorqueX = v.x; + itorqueY = v.y; + itorqueZ = v.z; + this._torqueX += itorqueX; + this._torqueY += itorqueY; + this._torqueZ += itorqueZ; + this._sleeping = false; + this._sleepTime = 0; + } + getLinearContactImpulse() { + var res = new oimo.common.Vec3(); + var v = res; + v.x = this._linearContactImpulseX; + v.y = this._linearContactImpulseY; + v.z = this._linearContactImpulseZ; + return res; + } + getLinearContactImpulseTo(linearContactImpulse) { + var v = linearContactImpulse; + v.x = this._linearContactImpulseX; + v.y = this._linearContactImpulseY; + v.z = this._linearContactImpulseZ; + } + getAngularContactImpulse() { + var res = new oimo.common.Vec3(); + var v = res; + v.x = this._angularContactImpulseX; + v.y = this._angularContactImpulseY; + v.z = this._angularContactImpulseZ; + return res; + } + getAngularContactImpulseTo(angularContactImpulse) { + var v = angularContactImpulse; + v.x = this._angularContactImpulseX; + v.y = this._angularContactImpulseY; + v.z = this._angularContactImpulseZ; + } + getGravityScale() { + return this._gravityScale; + } + setGravityScale(gravityScale) { + this._gravityScale = gravityScale; + this._sleeping = false; + this._sleepTime = 0; + } + getLocalPoint(worldPoint) { + var v; + var vX; + var vY; + var vZ; + var v1 = worldPoint; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + vX -= this._transform._positionX; + vY -= this._transform._positionY; + vZ -= this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo.common.Vec3(); + var v2 = res; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return res; + } + getLocalPointTo(worldPoint,localPoint) { + var v; + var vX; + var vY; + var vZ; + var v1 = worldPoint; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + vX -= this._transform._positionX; + vY -= this._transform._positionY; + vZ -= this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = localPoint; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + } + getLocalVector(worldVector) { + var v; + var vX; + var vY; + var vZ; + var v1 = worldVector; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo.common.Vec3(); + var v2 = res; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return res; + } + getLocalVectorTo(worldVector,localVector) { + var v; + var vX; + var vY; + var vZ; + var v1 = worldVector; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; + __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; + __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = localVector; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + } + getWorldPoint(localPoint) { + var v; + var vX; + var vY; + var vZ; + var v1 = localPoint; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += this._transform._positionX; + vY += this._transform._positionY; + vZ += this._transform._positionZ; + var res = new oimo.common.Vec3(); + var v2 = res; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return res; + } + getWorldPointTo(localPoint,worldPoint) { + var v; + var vX; + var vY; + var vZ; + var v1 = localPoint; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += this._transform._positionX; + vY += this._transform._positionY; + vZ += this._transform._positionZ; + var v2 = worldPoint; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + } + getWorldVector(localVector) { + var v; + var vX; + var vY; + var vZ; + var v1 = localVector; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var res = new oimo.common.Vec3(); + var v2 = res; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + return res; + } + getWorldVectorTo(localVector,worldVector) { + var v; + var vX; + var vY; + var vZ; + var v1 = localVector; + vX = v1.x; + vY = v1.y; + vZ = v1.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; + __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; + __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + var v2 = worldVector; + v2.x = vX; + v2.y = vY; + v2.z = vZ; + } + getNumShapes() { + return this._numShapes; + } + getShapeList() { + return this._shapeList; + } + getNumContectLinks() { + return this._numContactLinks; + } + getContactLinkList() { + return this._contactLinkList; + } + getNumJointLinks() { + return this._numJointLinks; + } + getJointLinkList() { + return this._jointLinkList; + } + addShape(shape) { + if(this._shapeList == null) { + this._shapeList = shape; + this._shapeListLast = shape; + } else { + this._shapeListLast._next = shape; + shape._prev = this._shapeListLast; + this._shapeListLast = shape; + } + this._numShapes++; + shape._rigidBody = this; + if(this._world != null) { + var _this = this._world; + shape._proxy = _this._broadPhase.createProxy(shape,shape._aabb); + shape._id = _this._shapeIdCount++; + _this._numShapes++; + } + this.updateMass(); + var s = this._shapeList; + while(s != null) { + var n = s._next; + var dst = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += src2._positionX; + dst._positionY += src2._positionY; + dst._positionZ += src2._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src21._positionX; + dst1._positionY += src21._positionY; + dst1._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + removeShape(shape) { + var prev = shape._prev; + var next = shape._next; + if(prev != null) { + prev._next = next; + } + if(next != null) { + next._prev = prev; + } + if(shape == this._shapeList) { + this._shapeList = this._shapeList._next; + } + if(shape == this._shapeListLast) { + this._shapeListLast = this._shapeListLast._prev; + } + shape._next = null; + shape._prev = null; + this._numShapes--; + shape._rigidBody = null; + if(this._world != null) { + var _this = this._world; + _this._broadPhase.destroyProxy(shape._proxy); + shape._proxy = null; + shape._id = -1; + var cl = shape._rigidBody._contactLinkList; + while(cl != null) { + var n = cl._next; + var c = cl._contact; + if(c._s1 == shape || c._s2 == shape) { + var _this1 = cl._other; + _this1._sleeping = false; + _this1._sleepTime = 0; + var _this2 = _this._contactManager; + var prev1 = c._prev; + var next1 = c._next; + if(prev1 != null) { + prev1._next = next1; + } + if(next1 != null) { + next1._prev = prev1; + } + if(c == _this2._contactList) { + _this2._contactList = _this2._contactList._next; + } + if(c == _this2._contactListLast) { + _this2._contactListLast = _this2._contactListLast._prev; + } + c._next = null; + c._prev = null; + if(c._touching) { + var cc1 = c._s1._contactCallback; + var cc2 = c._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } + } + var prev2 = c._link1._prev; + var next2 = c._link1._next; + if(prev2 != null) { + prev2._next = next2; + } + if(next2 != null) { + next2._prev = prev2; + } + if(c._link1 == c._b1._contactLinkList) { + c._b1._contactLinkList = c._b1._contactLinkList._next; + } + if(c._link1 == c._b1._contactLinkListLast) { + c._b1._contactLinkListLast = c._b1._contactLinkListLast._prev; + } + c._link1._next = null; + c._link1._prev = null; + var prev3 = c._link2._prev; + var next3 = c._link2._next; + if(prev3 != null) { + prev3._next = next3; + } + if(next3 != null) { + next3._prev = prev3; + } + if(c._link2 == c._b2._contactLinkList) { + c._b2._contactLinkList = c._b2._contactLinkList._next; + } + if(c._link2 == c._b2._contactLinkListLast) { + c._b2._contactLinkListLast = c._b2._contactLinkListLast._prev; + } + c._link2._next = null; + c._link2._prev = null; + c._b1._numContactLinks--; + c._b2._numContactLinks--; + c._link1._other = null; + c._link2._other = null; + c._link1._contact = null; + c._link2._contact = null; + c._s1 = null; + c._s2 = null; + c._b1 = null; + c._b2 = null; + c._touching = false; + c._cachedDetectorData._clear(); + c._manifold._clear(); + c._detector = null; + var _this3 = c._contactConstraint; + _this3._s1 = null; + _this3._s2 = null; + _this3._b1 = null; + _this3._b2 = null; + _this3._tf1 = null; + _this3._tf2 = null; + c._next = _this2._contactPool; + _this2._contactPool = c; + _this2._numContacts--; + } + cl = n; + } + _this._numShapes--; + } + this.updateMass(); + var s = this._shapeList; + while(s != null) { + var n1 = s._next; + var dst = s._ptransform; + var src1 = s._localTransform; + var src2 = this._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += src2._positionX; + dst._positionY += src2._positionY; + dst._positionZ += src2._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var src21 = this._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src21._positionX; + dst1._positionY += src21._positionY; + dst1._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n1; + } + } + getType() { + return this._type; + } + setType(type) { + this._type = type; + this.updateMass(); + } + wakeUp() { + this._sleeping = false; + this._sleepTime = 0; + } + sleep() { + this._sleeping = true; + this._sleepTime = 0; + } + isSleeping() { + return this._sleeping; + } + getSleepTime() { + return this._sleepTime; + } + setAutoSleep(autoSleepEnabled) { + this._autoSleep = autoSleepEnabled; + this._sleeping = false; + this._sleepTime = 0; + } + getLinearDamping() { + return this._linearDamping; + } + setLinearDamping(damping) { + this._linearDamping = damping; + } + getAngularDamping() { + return this._angularDamping; + } + setAngularDamping(damping) { + this._angularDamping = damping; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.rigidbody.RigidBodyConfig = class oimo_dynamics_rigidbody_RigidBodyConfig { + constructor() { + this.position = new oimo.common.Vec3(); + this.rotation = new oimo.common.Mat3(); + this.linearVelocity = new oimo.common.Vec3(); + this.angularVelocity = new oimo.common.Vec3(); + this.type = 0; + this.autoSleep = true; + this.linearDamping = 0; + this.angularDamping = 0; + } +} +oimo.dynamics.rigidbody.RigidBodyType = class oimo_dynamics_rigidbody_RigidBodyType { +} +oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { + constructor(config) { + this._id = -1; + this._localTransform = new oimo.common.Transform(); + this._ptransform = new oimo.common.Transform(); + this._transform = new oimo.common.Transform(); + var v = config.position; + this._localTransform._positionX = v.x; + this._localTransform._positionY = v.y; + this._localTransform._positionZ = v.z; + var m = config.rotation; + this._localTransform._rotation00 = m.e00; + this._localTransform._rotation01 = m.e01; + this._localTransform._rotation02 = m.e02; + this._localTransform._rotation10 = m.e10; + this._localTransform._rotation11 = m.e11; + this._localTransform._rotation12 = m.e12; + this._localTransform._rotation20 = m.e20; + this._localTransform._rotation21 = m.e21; + this._localTransform._rotation22 = m.e22; + var dst = this._ptransform; + var src = this._localTransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var dst1 = this._transform; + var src1 = this._localTransform; + dst1._positionX = src1._positionX; + dst1._positionY = src1._positionY; + dst1._positionZ = src1._positionZ; + dst1._rotation00 = src1._rotation00; + dst1._rotation01 = src1._rotation01; + dst1._rotation02 = src1._rotation02; + dst1._rotation10 = src1._rotation10; + dst1._rotation11 = src1._rotation11; + dst1._rotation12 = src1._rotation12; + dst1._rotation20 = src1._rotation20; + dst1._rotation21 = src1._rotation21; + dst1._rotation22 = src1._rotation22; + this._restitution = config.restitution; + this._friction = config.friction; + this._density = config.density; + this._geom = config.geometry; + this._collisionGroup = config.collisionGroup; + this._collisionMask = config.collisionMask; + this._contactCallback = config.contactCallback; + this._aabb = new oimo.collision.geometry.Aabb(); + this._proxy = null; + this.displacement = new oimo.common.Vec3(); + } + getFriction() { + return this._friction; + } + setFriction(friction) { + this._friction = friction; + } + getRestitution() { + return this._restitution; + } + setRestitution(restitution) { + this._restitution = restitution; + } + getLocalTransform() { + var _this = this._localTransform; + var tf = new oimo.common.Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + getLocalTransformTo(transform) { + var transform1 = this._localTransform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + getTransform() { + var _this = this._transform; + var tf = new oimo.common.Transform(); + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; + return tf; + } + getTransformTo(transform) { + var transform1 = this._transform; + transform._positionX = transform1._positionX; + transform._positionY = transform1._positionY; + transform._positionZ = transform1._positionZ; + transform._rotation00 = transform1._rotation00; + transform._rotation01 = transform1._rotation01; + transform._rotation02 = transform1._rotation02; + transform._rotation10 = transform1._rotation10; + transform._rotation11 = transform1._rotation11; + transform._rotation12 = transform1._rotation12; + transform._rotation20 = transform1._rotation20; + transform._rotation21 = transform1._rotation21; + transform._rotation22 = transform1._rotation22; + } + setLocalTransform(transform) { + var _this = this._localTransform; + _this._positionX = transform._positionX; + _this._positionY = transform._positionY; + _this._positionZ = transform._positionZ; + _this._rotation00 = transform._rotation00; + _this._rotation01 = transform._rotation01; + _this._rotation02 = transform._rotation02; + _this._rotation10 = transform._rotation10; + _this._rotation11 = transform._rotation11; + _this._rotation12 = transform._rotation12; + _this._rotation20 = transform._rotation20; + _this._rotation21 = transform._rotation21; + _this._rotation22 = transform._rotation22; + if(this._rigidBody != null) { + var _this1 = this._rigidBody; + _this1.updateMass(); + var s = _this1._shapeList; + while(s != null) { + var n = s._next; + var dst = s._ptransform; + var src1 = s._localTransform; + var src2 = _this1._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += src2._positionX; + dst._positionY += src2._positionY; + dst._positionZ += src2._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var src21 = _this1._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src21._positionX; + dst1._positionY += src21._positionY; + dst1._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + getDensity() { + return this._density; + } + setDensity(density) { + this._density = density; + if(this._rigidBody != null) { + var _this = this._rigidBody; + _this.updateMass(); + var s = _this._shapeList; + while(s != null) { + var n = s._next; + var dst = s._ptransform; + var src1 = s._localTransform; + var src2 = _this._ptransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; + __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; + __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; + __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; + __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; + __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; + __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; + __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; + __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; + __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; + __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += src2._positionX; + dst._positionY += src2._positionY; + dst._positionZ += src2._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var src21 = _this._transform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; + __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; + __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; + __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; + __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; + __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; + __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; + __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; + __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; + __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; + __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += src21._positionX; + dst1._positionY += src21._positionY; + dst1._positionZ += src21._positionZ; + var min; + var minX; + var minY; + var minZ; + var max; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var d; + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + } + getAabb() { + return this._aabb.clone(); + } + getAabbTo(aabb) { + aabb.copyFrom(this._aabb); + } + getGeometry() { + return this._geom; + } + getRigidBody() { + return this._rigidBody; + } + getCollisionGroup() { + return this._collisionGroup; + } + setCollisionGroup(collisionGroup) { + this._collisionGroup = collisionGroup; + } + getCollisionMask() { + return this._collisionMask; + } + setCollisionMask(collisionMask) { + this._collisionMask = collisionMask; + } + getContactCallback() { + return this._contactCallback; + } + setContactCallback(callback) { + this._contactCallback = callback; + } + getPrev() { + return this._prev; + } + getNext() { + return this._next; + } +} +oimo.dynamics.rigidbody.ShapeConfig = class oimo_dynamics_rigidbody_ShapeConfig { + constructor() { + this.position = new oimo.common.Vec3(); + this.rotation = new oimo.common.Mat3(); + this.friction = oimo.common.Setting.defaultFriction; + this.restitution = oimo.common.Setting.defaultRestitution; + this.density = oimo.common.Setting.defaultDensity; + this.collisionGroup = oimo.common.Setting.defaultCollisionGroup; + this.collisionMask = oimo.common.Setting.defaultCollisionMask; + this.geometry = null; + this.contactCallback = null; + } +} +if(!oimo.m) oimo.m = {}; +oimo.m.M = class oimo_m_M { +} +oimo.collision.broadphase.BroadPhaseType._BRUTE_FORCE = 1; +oimo.collision.broadphase.BroadPhaseType._BVH = 2; +oimo.collision.broadphase.BroadPhaseType.BRUTE_FORCE = 1; +oimo.collision.broadphase.BroadPhaseType.BVH = 2; +oimo.collision.broadphase.bvh.BvhInsertionStrategy.SIMPLE = 0; +oimo.collision.broadphase.bvh.BvhInsertionStrategy.MINIMIZE_SURFACE_AREA = 1; +oimo.collision.geometry.GeometryType._SPHERE = 0; +oimo.collision.geometry.GeometryType._BOX = 1; +oimo.collision.geometry.GeometryType._CYLINDER = 2; +oimo.collision.geometry.GeometryType._CONE = 3; +oimo.collision.geometry.GeometryType._CAPSULE = 4; +oimo.collision.geometry.GeometryType._CONVEX_HULL = 5; +oimo.collision.geometry.GeometryType._CONVEX_MIN = 0; +oimo.collision.geometry.GeometryType._CONVEX_MAX = 5; +oimo.collision.geometry.GeometryType.SPHERE = 0; +oimo.collision.geometry.GeometryType.BOX = 1; +oimo.collision.geometry.GeometryType.CYLINDER = 2; +oimo.collision.geometry.GeometryType.CONE = 3; +oimo.collision.geometry.GeometryType.CAPSULE = 4; +oimo.collision.geometry.GeometryType.CONVEX_HULL = 5; +oimo.collision.narrowphase.detector.BoxBoxDetector.EDGE_BIAS_MULT = 1.0; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.OK = 0; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.INVALID_TRIANGLE = 1; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.NO_ADJACENT_PAIR_INDEX = 2; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.NO_ADJACENT_TRIANGLE = 3; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.EDGE_LOOP_BROKEN = 4; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.NO_OUTER_TRIANGLE = 5; +oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState.TRIANGLE_INVISIBLE = 6; +oimo.collision.narrowphase.detector.gjkepa.EpaTriangle.count = 0; +oimo.common.Vec3.numCreations = 0; +oimo.common.Setting.defaultFriction = 0.2; +oimo.common.Setting.defaultRestitution = 0.2; +oimo.common.Setting.defaultDensity = 1; +oimo.common.Setting.defaultCollisionGroup = 1; +oimo.common.Setting.defaultCollisionMask = 1; +oimo.common.Setting.maxTranslationPerStep = 20; +oimo.common.Setting.maxRotationPerStep = 3.14159265358979; +oimo.common.Setting.bvhProxyPadding = 0.1; +oimo.common.Setting.bvhIncrementalCollisionThreshold = 0.45; +oimo.common.Setting.defaultGJKMargin = 0.05; +oimo.common.Setting.enableGJKCaching = true; +oimo.common.Setting.maxEPAVertices = 128; +oimo.common.Setting.maxEPAPolyhedronFaces = 128; +oimo.common.Setting.contactEnableBounceThreshold = 0.5; +oimo.common.Setting.velocityBaumgarte = 0.2; +oimo.common.Setting.positionSplitImpulseBaumgarte = 0.4; +oimo.common.Setting.positionNgsBaumgarte = 1.0; +oimo.common.Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold = 0.05; +oimo.common.Setting.defaultContactPositionCorrectionAlgorithm = 0; +oimo.common.Setting.alternativeContactPositionCorrectionAlgorithm = 1; +oimo.common.Setting.contactPersistenceThreshold = 0.05; +oimo.common.Setting.maxManifoldPoints = 4; +oimo.common.Setting.defaultJointConstraintSolverType = 0; +oimo.common.Setting.defaultJointPositionCorrectionAlgorithm = 0; +oimo.common.Setting.jointWarmStartingFactorForBaungarte = 0.8; +oimo.common.Setting.jointWarmStartingFactor = 0.95; +oimo.common.Setting.minSpringDamperDampingRatio = 1e-6; +oimo.common.Setting.minRagdollMaxSwingAngle = 1e-6; +oimo.common.Setting.maxJacobianRows = 6; +oimo.common.Setting.directMlcpSolverEps = 1e-9; +oimo.common.Setting.islandInitialRigidBodyArraySize = 128; +oimo.common.Setting.islandInitialConstraintArraySize = 128; +oimo.common.Setting.sleepingVelocityThreshold = 0.2; +oimo.common.Setting.sleepingAngularVelocityThreshold = 0.5; +oimo.common.Setting.sleepingTimeThreshold = 1.0; +oimo.common.Setting.disableSleeping = false; +oimo.common.Setting.linearSlop = 0.005; +oimo.common.Setting.angularSlop = 0.0174532925199432781; +oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance = new oimo.collision.narrowphase.detector.gjkepa.GjkEpa(); +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._SUCCEEDED = 0; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._GJK_FAILED_TO_MAKE_TETRAHEDRON = 1; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._GJK_DID_NOT_CONVERGE = 2; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._EPA_FAILED_TO_INIT = 257; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._EPA_FAILED_TO_ADD_VERTEX = 258; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._EPA_DID_NOT_CONVERGE = 259; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.SUCCEEDED = 0; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.GJK_FAILED_TO_MAKE_TETRAHEDRON = 1; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.GJK_DID_NOT_CONVERGE = 2; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_INIT = 257; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX = 258; +oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_DID_NOT_CONVERGE = 259; +oimo.common.Mat3.numCreations = 0; +oimo.common.Mat4.numCreations = 0; +oimo.common.MathUtil.POSITIVE_INFINITY = 1e65536; +oimo.common.MathUtil.NEGATIVE_INFINITY = -1e65536; +oimo.common.MathUtil.PI = 3.14159265358979; +oimo.common.MathUtil.TWO_PI = 6.28318530717958; +oimo.common.MathUtil.HALF_PI = 1.570796326794895; +oimo.common.MathUtil.TO_RADIANS = 0.0174532925199432781; +oimo.common.MathUtil.TO_DEGREES = 57.2957795130823797; +oimo.common.Quat.numCreations = 0; +oimo.dynamics.common.DebugDraw.SPHERE_PHI_DIVISION = 8; +oimo.dynamics.common.DebugDraw.SPHERE_THETA_DIVISION = 4; +oimo.dynamics.common.DebugDraw.CIRCLE_THETA_DIVISION = 8; +oimo.dynamics.common.Performance.broadPhaseCollisionTime = 0; +oimo.dynamics.common.Performance.narrowPhaseCollisionTime = 0; +oimo.dynamics.common.Performance.dynamicsTime = 0; +oimo.dynamics.common.Performance.totalTime = 0; +oimo.dynamics.constraint.PositionCorrectionAlgorithm._BAUMGARTE = 0; +oimo.dynamics.constraint.PositionCorrectionAlgorithm._SPLIT_IMPULSE = 1; +oimo.dynamics.constraint.PositionCorrectionAlgorithm._NGS = 2; +oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE = 0; +oimo.dynamics.constraint.PositionCorrectionAlgorithm.SPLIT_IMPULSE = 1; +oimo.dynamics.constraint.PositionCorrectionAlgorithm.NGS = 2; +oimo.dynamics.constraint.info.JacobianRow.BIT_LINEAR_SET = 1; +oimo.dynamics.constraint.info.JacobianRow.BIT_ANGULAR_SET = 2; +oimo.dynamics.constraint.joint.JointType._SPHERICAL = 0; +oimo.dynamics.constraint.joint.JointType._REVOLUTE = 1; +oimo.dynamics.constraint.joint.JointType._CYLINDRICAL = 2; +oimo.dynamics.constraint.joint.JointType._PRISMATIC = 3; +oimo.dynamics.constraint.joint.JointType._UNIVERSAL = 4; +oimo.dynamics.constraint.joint.JointType._RAGDOLL = 5; +oimo.dynamics.constraint.joint.JointType._GENERIC = 6; +oimo.dynamics.constraint.joint.JointType.SPHERICAL = 0; +oimo.dynamics.constraint.joint.JointType.REVOLUTE = 1; +oimo.dynamics.constraint.joint.JointType.CYLINDRICAL = 2; +oimo.dynamics.constraint.joint.JointType.PRISMATIC = 3; +oimo.dynamics.constraint.joint.JointType.UNIVERSAL = 4; +oimo.dynamics.constraint.joint.JointType.RAGDOLL = 5; +oimo.dynamics.constraint.joint.JointType.GENERIC = 6; +oimo.dynamics.constraint.solver.ConstraintSolverType._ITERATIVE = 0; +oimo.dynamics.constraint.solver.ConstraintSolverType._DIRECT = 1; +oimo.dynamics.constraint.solver.ConstraintSolverType.ITERATIVE = 0; +oimo.dynamics.constraint.solver.ConstraintSolverType.DIRECT = 1; +oimo.dynamics.rigidbody.RigidBodyType._DYNAMIC = 0; +oimo.dynamics.rigidbody.RigidBodyType._STATIC = 1; +oimo.dynamics.rigidbody.RigidBodyType._KINEMATIC = 2; +oimo.dynamics.rigidbody.RigidBodyType.DYNAMIC = 0; +oimo.dynamics.rigidbody.RigidBodyType.STATIC = 1; +oimo.dynamics.rigidbody.RigidBodyType.KINEMATIC = 2; +`export {oimo}; \ No newline at end of file diff --git a/build-js-ts.hxml b/build-js-ts.hxml new file mode 100644 index 0000000..0bb7996 --- /dev/null +++ b/build-js-ts.hxml @@ -0,0 +1,26 @@ +-cp exports/src +-cp src +-main export.ts.Export +-lib hxtsdgen +-D hxtsdgen_namespaced +-D hxtsdgen_enums_ts +-D hxtsdgen_types_ts +-js bin/js_modules/OimoPhysics.js +-D js-es=6 +-D js_unflatten +-D js_classic +-D shallow-expose + +# +# +# +# After build you will need to edit generated JS file: +# Remove all lines before `var oimo = oimo || {};` +# Replace last two lines `export.ts.Export.main(); +# var Export = $hx_exports["Export"];` +# with next: `export {oimo};` +# Remove Export class from OimoPhysics.d.ts +# +# +# +# \ No newline at end of file diff --git a/exports/src/export/ts/Export.hx b/exports/src/export/ts/Export.hx new file mode 100644 index 0000000..7b567a1 --- /dev/null +++ b/exports/src/export/ts/Export.hx @@ -0,0 +1,247 @@ +package export.ts; + +import oimo.dynamics.common.DebugDraw; +import oimo.collision.broadphase.BroadPhase; +import oimo.collision.geometry.Geometry; +import oimo.collision.geometry.ConvexGeometry; +import oimo.collision.broadphase.BroadPhaseProxyCallback; +import oimo.collision.broadphase.BroadPhaseType; +import oimo.collision.broadphase.Proxy; +import oimo.collision.broadphase.ProxyPair; +import oimo.collision.broadphase.bruteforce.BruteForceBroadPhase; +import oimo.collision.broadphase.bvh.BvhBroadPhase; +import oimo.collision.broadphase.bvh.BvhInsertionStrategy; +import oimo.collision.broadphase.bvh.BvhNode; +import oimo.collision.broadphase.bvh.BvhProxy; +import oimo.collision.broadphase.bvh.BvhStrategy; +import oimo.collision.broadphase.bvh.BvhTree; +import oimo.collision.geometry.Aabb; +import oimo.collision.geometry.BoxGeometry; +import oimo.collision.geometry.CapsuleGeometry; +import oimo.collision.geometry.ConeGeometry; +import oimo.collision.geometry.ConvexHullGeometry; +import oimo.collision.geometry.CylinderGeometry; +import oimo.collision.geometry.GeometryType; +import oimo.collision.geometry.RayCastHit; +import oimo.collision.geometry.SphereGeometry; +import oimo.collision.narrowphase.CollisionMatrix; +import oimo.collision.narrowphase.DetectorResult; +import oimo.collision.narrowphase.DetectorResultPoint; +import oimo.collision.narrowphase.detector.Detector; +import oimo.collision.narrowphase.detector.BoxBoxDetector; +import oimo.collision.narrowphase.detector.BoxBoxDetectorMacro; +import oimo.collision.narrowphase.detector.CachedDetectorData; +import oimo.collision.narrowphase.detector.CapsuleCapsuleDetector; +import oimo.collision.narrowphase.detector.GjkEpaDetector; +import oimo.collision.narrowphase.detector.SphereBoxDetector; +import oimo.collision.narrowphase.detector.SphereCapsuleDetector; +import oimo.collision.narrowphase.detector.SphereSphereDetector; +import oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron; +import oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedronState; +import oimo.collision.narrowphase.detector.gjkepa.EpaTriangle; +import oimo.collision.narrowphase.detector.gjkepa.EpaVertex; +import oimo.collision.narrowphase.detector.gjkepa.GjkCache; +import oimo.common.Vec3; +import oimo.common.Transform; +import oimo.common.Setting; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpa; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpaLog; +import oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState; +import oimo.collision.narrowphase.detector.gjkepa.SimplexUtil; +import oimo.common.Mat3; +import oimo.common.Mat4; +import oimo.common.MathUtil; +import oimo.common.Pool; +import oimo.common.Quat; +import oimo.dynamics.Contact; +import oimo.dynamics.ContactLink; +import oimo.dynamics.ContactManager; +import oimo.dynamics.Island; +import oimo.dynamics.TimeStep; +import oimo.dynamics.World; +import oimo.dynamics.callback.AabbTestCallback; +import oimo.dynamics.callback.ContactCallback; +import oimo.dynamics.callback.RayCastCallback; +import oimo.dynamics.callback.RayCastClosest; +import oimo.dynamics.common.DebugDrawStyle; +import oimo.dynamics.common.Performance; +import oimo.dynamics.constraint.ConstraintSolver; +import oimo.dynamics.constraint.PositionCorrectionAlgorithm; +import oimo.dynamics.constraint.contact.ContactConstraint; +import oimo.dynamics.constraint.contact.ContactImpulse; +import oimo.dynamics.constraint.contact.Manifold; +import oimo.dynamics.constraint.contact.ManifoldPoint; +import oimo.dynamics.constraint.contact.ManifoldUpdater; +import oimo.dynamics.constraint.info.JacobianRow; +import oimo.dynamics.constraint.info.contact.ContactSolverInfo; +import oimo.dynamics.constraint.info.contact.ContactSolverInfoRow; +import oimo.dynamics.constraint.info.joint.JointSolverInfo; +import oimo.dynamics.constraint.info.joint.JointSolverInfoRow; +import oimo.dynamics.constraint.joint.BasisTracker; +import oimo.dynamics.constraint.joint.Joint; +import oimo.dynamics.constraint.joint.CylindricalJoint; +import oimo.dynamics.constraint.joint.JointConfig; +import oimo.dynamics.constraint.joint.CylindricalJointConfig; +import oimo.dynamics.constraint.joint.GenericJoint; +import oimo.dynamics.constraint.joint.GenericJointConfig; +import oimo.dynamics.constraint.joint.JointImpulse; +import oimo.dynamics.constraint.joint.JointLink; +import oimo.dynamics.constraint.joint.JointMacro; +import oimo.dynamics.constraint.joint.JointType; +import oimo.dynamics.constraint.joint.PrismaticJoint; +import oimo.dynamics.constraint.joint.PrismaticJointConfig; +import oimo.dynamics.constraint.joint.RagdollJoint; +import oimo.dynamics.constraint.joint.RagdollJointConfig; +import oimo.dynamics.constraint.joint.RevoluteJoint; +import oimo.dynamics.constraint.joint.RevoluteJointConfig; +import oimo.dynamics.constraint.joint.RotationalLimitMotor; +import oimo.dynamics.constraint.joint.SphericalJoint; +import oimo.dynamics.constraint.joint.SphericalJointConfig; +import oimo.dynamics.constraint.joint.SpringDamper; +import oimo.dynamics.constraint.joint.TranslationalLimitMotor; +import oimo.dynamics.constraint.joint.UniversalJoint; +import oimo.dynamics.constraint.joint.UniversalJointConfig; +import oimo.dynamics.constraint.solver.ConstraintSolverType; +import oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow; +import oimo.dynamics.constraint.solver.common.JointSolverMassDataRow; +import oimo.dynamics.constraint.solver.direct.Boundary; +import oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo; +import oimo.dynamics.constraint.solver.direct.BoundaryBuilder; +import oimo.dynamics.constraint.solver.direct.BoundarySelector; +import oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver; +import oimo.dynamics.constraint.solver.direct.MassMatrix; +import oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver; +import oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver; +import oimo.dynamics.rigidbody.MassData; +import oimo.dynamics.rigidbody.RigidBody; +import oimo.dynamics.rigidbody.RigidBodyConfig; +import oimo.dynamics.rigidbody.RigidBodyType; +import oimo.dynamics.rigidbody.Shape; +import oimo.dynamics.rigidbody.ShapeConfig; + +/** + * this class just imports all the classes in the library + */ +@:expose('Export') +class Export { + public var _DebugDraw: DebugDraw; + public var _BroadPhase: BroadPhase; + public var _Geometry: Geometry; + public var _ConvexGeometry: ConvexGeometry; + public var _BroadPhaseProxyCallback: BroadPhaseProxyCallback; + public var _BroadPhaseType: BroadPhaseType; + public var _Proxy: Proxy; + public var _ProxyPair: ProxyPair; + public var _BruteForceBroadPhase: BruteForceBroadPhase; + public var _BvhBroadPhase: BvhBroadPhase; + public var _BvhInsertionStrategy: BvhInsertionStrategy; + public var _BvhNode: BvhNode; + public var _BvhProxy: BvhProxy; + public var _BvhStrategy: BvhStrategy; + public var _BvhTree: BvhTree; + public var _Aabb: Aabb; + public var _BoxGeometry: BoxGeometry; + public var _CapsuleGeometry: CapsuleGeometry; + public var _ConeGeometry: ConeGeometry; + public var _ConvexHullGeometry: ConvexHullGeometry; + public var _CylinderGeometry: CylinderGeometry; + public var _GeometryType: GeometryType; + public var _RayCastHit: RayCastHit; + public var _SphereGeometry: SphereGeometry; + public var _CollisionMatrix: CollisionMatrix; + public var _DetectorResult: DetectorResult; + public var _DetectorResultPoint: DetectorResultPoint; + public var _Detector: Detector; + public var _BoxBoxDetector: BoxBoxDetector; + public var _BoxBoxDetectorMacro: BoxBoxDetectorMacro; + public var _CachedDetectorData: CachedDetectorData; + public var _CapsuleCapsuleDetector: CapsuleCapsuleDetector; + public var _GjkEpaDetector: GjkEpaDetector; + public var _SphereBoxDetector: SphereBoxDetector; + public var _SphereCapsuleDetector: SphereCapsuleDetector; + public var _SphereSphereDetector: SphereSphereDetector; + public var _EpaPolyhedron: EpaPolyhedron; + public var _EpaPolyhedronState: EpaPolyhedronState; + public var _EpaTriangle: EpaTriangle; + public var _EpaVertex: EpaVertex; + public var _GjkCache: GjkCache; + public var _Vec3: Vec3; + public var _Transform: Transform; + public var _Setting: Setting; + public var _GjkEpa: GjkEpa; + public var _GjkEpaLog: GjkEpaLog; + public var _GjkEpaResultState: GjkEpaResultState; + public var _SimplexUtil: SimplexUtil; + public var _Mat3: Mat3; + public var _Mat4: Mat4; + public var _MathUtil: MathUtil; + public var _Pool: Pool; + public var _Quat: Quat; + public var _Contact: Contact; + public var _ContactLink: ContactLink; + public var _ContactManager: ContactManager; + public var _Island: Island; + public var _TimeStep: TimeStep; + public var _World: World; + public var _AabbTestCallback: AabbTestCallback; + public var _ContactCallback: ContactCallback; + public var _RayCastCallback: RayCastCallback; + public var _RayCastClosest: RayCastClosest; + public var _DebugDrawStyle: DebugDrawStyle; + public var _Performance: Performance; + public var _ConstraintSolver: ConstraintSolver; + public var _PositionCorrectionAlgorithm: PositionCorrectionAlgorithm; + public var _ContactConstraint: ContactConstraint; + public var _ContactImpulse: ContactImpulse; + public var _Manifold: Manifold; + public var _ManifoldPoint: ManifoldPoint; + public var _ManifoldUpdater: ManifoldUpdater; + public var _JacobianRow: JacobianRow; + public var _ContactSolverInfo: ContactSolverInfo; + public var _ContactSolverInfoRow: ContactSolverInfoRow; + public var _JointSolverInfo: JointSolverInfo; + public var _JointSolverInfoRow: JointSolverInfoRow; + public var _BasisTracker: BasisTracker; + public var _Joint: Joint; + public var _CylindricalJoint: CylindricalJoint; + public var _JointConfig: JointConfig; + public var _CylindricalJointConfig: CylindricalJointConfig; + public var _GenericJoint: GenericJoint; + public var _GenericJointConfig: GenericJointConfig; + public var _JointImpulse: JointImpulse; + public var _JointLink: JointLink; + public var _JointMacro: JointMacro; + public var _JointType: JointType; + public var _PrismaticJoint: PrismaticJoint; + public var _PrismaticJointConfig: PrismaticJointConfig; + public var _RagdollJoint: RagdollJoint; + public var _RagdollJointConfig: RagdollJointConfig; + public var _RevoluteJoint: RevoluteJoint; + public var _RevoluteJointConfig: RevoluteJointConfig; + public var _RotationalLimitMotor: RotationalLimitMotor; + public var _SphericalJoint: SphericalJoint; + public var _SphericalJointConfig: SphericalJointConfig; + public var _SpringDamper: SpringDamper; + public var _TranslationalLimitMotor: TranslationalLimitMotor; + public var _UniversalJoint: UniversalJoint; + public var _UniversalJointConfig: UniversalJointConfig; + public var _ConstraintSolverType: ConstraintSolverType; + public var _ContactSolverMassDataRow: ContactSolverMassDataRow; + public var _JointSolverMassDataRow: JointSolverMassDataRow; + public var _Boundary: Boundary; + public var _BoundaryBuildInfo: BoundaryBuildInfo; + public var _BoundaryBuilder: BoundaryBuilder; + public var _BoundarySelector: BoundarySelector; + public var _DirectJointConstraintSolver: DirectJointConstraintSolver; + public var _MassMatrix: MassMatrix; + public var _PgsContactConstraintSolver: PgsContactConstraintSolver; + public var _PgsJointConstraintSolver: PgsJointConstraintSolver; + public var _MassData: MassData; + public var _RigidBody: RigidBody; + public var _RigidBodyConfig: RigidBodyConfig; + public var _RigidBodyType: RigidBodyType; + public var _Shape: Shape; + public var _ShapeConfig: ShapeConfig; + + static function main() {} +} From 90a4ed55b09899a02329b6e7cb1e90ef76f41c67 Mon Sep 17 00:00:00 2001 From: saharan Date: Mon, 2 Mar 2020 19:50:46 +0900 Subject: [PATCH 04/13] removing extra `` ` `` --- bin/js_modules/OimoPhysics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/js_modules/OimoPhysics.js b/bin/js_modules/OimoPhysics.js index ba6dec5..bb0a490 100644 --- a/bin/js_modules/OimoPhysics.js +++ b/bin/js_modules/OimoPhysics.js @@ -54878,4 +54878,4 @@ oimo.dynamics.rigidbody.RigidBodyType._KINEMATIC = 2; oimo.dynamics.rigidbody.RigidBodyType.DYNAMIC = 0; oimo.dynamics.rigidbody.RigidBodyType.STATIC = 1; oimo.dynamics.rigidbody.RigidBodyType.KINEMATIC = 2; -`export {oimo}; \ No newline at end of file +export {oimo}; \ No newline at end of file From af547e604aedfaef59301062eb69c70d7826bd71 Mon Sep 17 00:00:00 2001 From: Oleksii Maksymov Date: Mon, 2 Mar 2020 13:29:41 +0200 Subject: [PATCH 05/13] Added package.json --- bin/js_modules/package.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bin/js_modules/package.json diff --git a/bin/js_modules/package.json b/bin/js_modules/package.json new file mode 100644 index 0000000..8dc1cc1 --- /dev/null +++ b/bin/js_modules/package.json @@ -0,0 +1,26 @@ +{ + "name": "oimophysics", + "version": "1.2.2", + "description": "A lightweight 3D physics engine.", + "main": "OimoPhysics.js", + "typings": "OimoPhysics.d.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/saharan/OimoPhysics.git" + }, + "keywords": [ + "oimo", + "physics", + "oimophysics", + "oimo.js" + ], + "author": "saharan", + "license": "MIT", + "bugs": { + "url": "https://github.com/saharan/OimoPhysics/issues" + }, + "homepage": "https://github.com/saharan/OimoPhysics#readme" +} \ No newline at end of file From d4cfee9c90488257279aba7b2ea7c7d8f6c7c88d Mon Sep 17 00:00:00 2001 From: saharan Date: Mon, 2 Mar 2020 22:09:54 +0900 Subject: [PATCH 06/13] moving package.json --- README.md | 11 +++++++++-- bin/js_modules/package.json => package.json | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) rename bin/js_modules/package.json => package.json (85%) diff --git a/README.md b/README.md index d477d39..2535fbd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ OimoPhysics 1.2.1 + +![License: MIT](https://img.shields.io/badge/License-MIT-green.svg) [![npm version](https://badge.fury.io/js/oimophysics.svg)](https://badge.fury.io/js/oimophysics) + --- A lightweight 3D physics engine. + ## [API Documentation](https://saharan.github.io/OimoPhysics/) ## Demos @@ -10,12 +14,15 @@ A lightweight 3D physics engine. * Press `E` or `Q` to change demos * Click or tap texts on the left to control -## Features +## Platforms * Written in Haxe * Exported as JavaScript (see [bin/js/](./bin/js)) * Public classes and methods are exposed through `window.OIMO`. * e.g. `new OIMO.Vec3(1, 2, 3)` to create an instance of `Vec3` class. -* Rigid body motion types +* Exported as a Node.js module with TypeScript declarations (see [package.json](./package.json) and [bin/js_modules](./bin/js_modules)) + +## Features +* Rigid body with motion types * Dynamic * Static * Kinematic diff --git a/bin/js_modules/package.json b/package.json similarity index 85% rename from bin/js_modules/package.json rename to package.json index 8dc1cc1..c65f5b9 100644 --- a/bin/js_modules/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "oimophysics", "version": "1.2.2", "description": "A lightweight 3D physics engine.", - "main": "OimoPhysics.js", - "typings": "OimoPhysics.d.ts", + "main": "./bin/js_modules/OimoPhysics.js", + "typings": "./bin/js_modules/OimoPhysics.d.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, From 3fd78e4f42537377ab32719e48396377745b1153 Mon Sep 17 00:00:00 2001 From: saharan Date: Mon, 2 Mar 2020 22:11:19 +0900 Subject: [PATCH 07/13] edit README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 2535fbd..725c95d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ OimoPhysics 1.2.1 - -![License: MIT](https://img.shields.io/badge/License-MIT-green.svg) [![npm version](https://badge.fury.io/js/oimophysics.svg)](https://badge.fury.io/js/oimophysics) - --- A lightweight 3D physics engine. +![License: MIT](https://img.shields.io/badge/License-MIT-green.svg) [![npm version](https://badge.fury.io/js/oimophysics.svg)](https://badge.fury.io/js/oimophysics) ## [API Documentation](https://saharan.github.io/OimoPhysics/) From 1e9fe7b54770e7815b2a86d9c47a919a244d3b5c Mon Sep 17 00:00:00 2001 From: saharan Date: Mon, 2 Mar 2020 22:17:40 +0900 Subject: [PATCH 08/13] making it 1.2.2 --- README.md | 2 +- bin/js/OimoPhysics.js | 2 +- bin/js/OimoPhysics.min.js | 2 +- build-doc.hxml | 2 +- docs/404.html | 2 +- docs/index.html | 2 +- docs/oimo/collision/broadphase/BroadPhase.html | 2 +- docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html | 2 +- docs/oimo/collision/broadphase/BroadPhaseType.html | 2 +- docs/oimo/collision/broadphase/Proxy.html | 2 +- docs/oimo/collision/broadphase/ProxyPair.html | 2 +- .../collision/broadphase/bruteforce/BruteForceBroadPhase.html | 2 +- docs/oimo/collision/broadphase/bruteforce/index.html | 2 +- docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html | 2 +- docs/oimo/collision/broadphase/bvh/index.html | 2 +- docs/oimo/collision/broadphase/index.html | 2 +- docs/oimo/collision/geometry/Aabb.html | 2 +- docs/oimo/collision/geometry/BoxGeometry.html | 2 +- docs/oimo/collision/geometry/CapsuleGeometry.html | 2 +- docs/oimo/collision/geometry/ConeGeometry.html | 2 +- docs/oimo/collision/geometry/ConvexGeometry.html | 2 +- docs/oimo/collision/geometry/ConvexHullGeometry.html | 2 +- docs/oimo/collision/geometry/CylinderGeometry.html | 2 +- docs/oimo/collision/geometry/Geometry.html | 2 +- docs/oimo/collision/geometry/GeometryType.html | 2 +- docs/oimo/collision/geometry/RayCastHit.html | 2 +- docs/oimo/collision/geometry/SphereGeometry.html | 2 +- docs/oimo/collision/geometry/index.html | 2 +- docs/oimo/collision/index.html | 2 +- docs/oimo/collision/narrowphase/CollisionMatrix.html | 2 +- docs/oimo/collision/narrowphase/DetectorResult.html | 2 +- docs/oimo/collision/narrowphase/DetectorResultPoint.html | 2 +- docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html | 2 +- .../collision/narrowphase/detector/CapsuleCapsuleDetector.html | 2 +- docs/oimo/collision/narrowphase/detector/Detector.html | 2 +- docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html | 2 +- docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html | 2 +- .../collision/narrowphase/detector/SphereCapsuleDetector.html | 2 +- .../collision/narrowphase/detector/SphereSphereDetector.html | 2 +- docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html | 2 +- .../narrowphase/detector/gjkepa/GjkEpaResultState.html | 2 +- .../oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html | 2 +- docs/oimo/collision/narrowphase/detector/gjkepa/index.html | 2 +- docs/oimo/collision/narrowphase/detector/index.html | 2 +- docs/oimo/collision/narrowphase/index.html | 2 +- docs/oimo/common/Mat3.html | 2 +- docs/oimo/common/Mat4.html | 2 +- docs/oimo/common/MathUtil.html | 2 +- docs/oimo/common/Pool.html | 2 +- docs/oimo/common/Quat.html | 2 +- docs/oimo/common/Setting.html | 2 +- docs/oimo/common/Transform.html | 2 +- docs/oimo/common/Vec3.html | 2 +- docs/oimo/common/index.html | 2 +- docs/oimo/dynamics/Contact.html | 2 +- docs/oimo/dynamics/ContactLink.html | 2 +- docs/oimo/dynamics/ContactManager.html | 2 +- docs/oimo/dynamics/TimeStep.html | 2 +- docs/oimo/dynamics/World.html | 2 +- docs/oimo/dynamics/callback/AabbTestCallback.html | 2 +- docs/oimo/dynamics/callback/ContactCallback.html | 2 +- docs/oimo/dynamics/callback/RayCastCallback.html | 2 +- docs/oimo/dynamics/callback/RayCastClosest.html | 2 +- docs/oimo/dynamics/callback/index.html | 2 +- docs/oimo/dynamics/common/DebugDraw.html | 2 +- docs/oimo/dynamics/common/DebugDrawStyle.html | 2 +- docs/oimo/dynamics/common/Performance.html | 2 +- docs/oimo/dynamics/common/index.html | 2 +- docs/oimo/dynamics/constraint/ConstraintSolver.html | 2 +- docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html | 2 +- docs/oimo/dynamics/constraint/contact/ContactConstraint.html | 2 +- docs/oimo/dynamics/constraint/contact/Manifold.html | 2 +- docs/oimo/dynamics/constraint/contact/ManifoldPoint.html | 2 +- docs/oimo/dynamics/constraint/contact/index.html | 2 +- docs/oimo/dynamics/constraint/index.html | 2 +- docs/oimo/dynamics/constraint/joint/CylindricalJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/GenericJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/GenericJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/Joint.html | 2 +- docs/oimo/dynamics/constraint/joint/JointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/JointLink.html | 2 +- docs/oimo/dynamics/constraint/joint/JointType.html | 2 +- docs/oimo/dynamics/constraint/joint/PrismaticJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/RagdollJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/RevoluteJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html | 2 +- docs/oimo/dynamics/constraint/joint/SphericalJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/SpringDamper.html | 2 +- .../oimo/dynamics/constraint/joint/TranslationalLimitMotor.html | 2 +- docs/oimo/dynamics/constraint/joint/UniversalJoint.html | 2 +- docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html | 2 +- docs/oimo/dynamics/constraint/joint/index.html | 2 +- docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html | 2 +- .../constraint/solver/direct/DirectJointConstraintSolver.html | 2 +- docs/oimo/dynamics/constraint/solver/direct/index.html | 2 +- docs/oimo/dynamics/constraint/solver/index.html | 2 +- .../constraint/solver/pgs/PgsContactConstraintSolver.html | 2 +- .../constraint/solver/pgs/PgsJointConstraintSolver.html | 2 +- docs/oimo/dynamics/constraint/solver/pgs/index.html | 2 +- docs/oimo/dynamics/index.html | 2 +- docs/oimo/dynamics/rigidbody/MassData.html | 2 +- docs/oimo/dynamics/rigidbody/RigidBody.html | 2 +- docs/oimo/dynamics/rigidbody/RigidBodyConfig.html | 2 +- docs/oimo/dynamics/rigidbody/RigidBodyType.html | 2 +- docs/oimo/dynamics/rigidbody/Shape.html | 2 +- docs/oimo/dynamics/rigidbody/ShapeConfig.html | 2 +- docs/oimo/dynamics/rigidbody/index.html | 2 +- docs/oimo/index.html | 2 +- 113 files changed, 113 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 725c95d..9371f5d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -OimoPhysics 1.2.1 +OimoPhysics 1.2.2 --- A lightweight 3D physics engine. diff --git a/bin/js/OimoPhysics.js b/bin/js/OimoPhysics.js index b2e8b06..ddbda7b 100644 --- a/bin/js/OimoPhysics.js +++ b/bin/js/OimoPhysics.js @@ -1,5 +1,5 @@ /* - * OimoPhysics 1.2.1 (c) 2020 saharan, The MIT License + * OimoPhysics 1.2.2 (c) 2020 saharan, The MIT License */ (function ($global) { "use strict"; function $extend(from, fields) { diff --git a/bin/js/OimoPhysics.min.js b/bin/js/OimoPhysics.min.js index 187fc94..a729854 100644 --- a/bin/js/OimoPhysics.min.js +++ b/bin/js/OimoPhysics.min.js @@ -1 +1 @@ -/* OimoPhysics 1.2.1 (c) 2020 saharan, The MIT License */ 'use strict';(function(){function Qj(){this.position=new n;this.rotation=new I;this.friction=F.defaultFriction;this.restitution=F.defaultRestitution;this.density=F.defaultDensity;this.collisionGroup=F.defaultCollisionGroup;this.collisionMask=F.defaultCollisionMask;this.contactCallback=this.geometry=null}function Ka(a){this.Ic=-1;this.ha=new Ua;this.ja=new Ua;this.a=new Ua;var b=a.position;this.ha.v=b.x;this.ha.A=b.y;this.ha.B=b.z;b=a.rotation;this.ha.o=b.e00;this.ha.f=b.e01;this.ha.h=b.e02;this.ha.i=b.e10;this.ha.m=b.e11;this.ha.j=b.e12;this.ha.l=b.e20;this.ha.g=b.e21;this.ha.s=b.e22;var b=this.ja,e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;b=this.a;e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Ak=a.restitution;this.pk=a.friction;this.Vk=a.density;this.Fb=a.geometry;this.kk=a.collisionGroup;this.lk=a.collisionMask;this.im=a.contactCallback;this.u=new eb;this.ub=null;this.mc=new n}function Qe(){}function Rj(){this.position=new n;this.rotation=new I;this.linearVelocity=new n;this.angularVelocity=new n;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0}function x(a){this.Yi=this.Gc=this.ia=this.M=null;this.Rg=0;this.ic=this.Mb=null;this.Ne=0;this.ff=this.Me=null;this.Ah=0;var b=a.linearVelocity;this.jb=b.x;this.kb=b.y;this.lb=b.z;b=a.angularVelocity;this.nb=b.x;this.ob=b.y;this.pb=b.z;this.jd=this.hd=this.gd=this.td=this.sd=this.rd=0;this.ja=new Ua;this.a=new Ua;b=a.position;this.ja.v=b.x;this.ja.A=b.y;this.ja.B=b.z;b=a.rotation;this.ja.o=b.e00;this.ja.f=b.e01;this.ja.h=b.e02;this.ja.i=b.e10;this.ja.m=b.e11;this.ja.j=b.e12;this.ja.l=b.e20;this.ja.g=b.e21;this.ja.s=b.e22;var b=this.a,e=this.ja;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Jb=a.type;this.wb=0;this.Bb=!1;this.Tk=a.autoSleep;this.$=this.Z=this.Y=this.X=this.W=this.V=this.U=this.T=this.S=this.Si=this.Ri=this.Qi=this.Pi=this.Oi=this.Ni=this.Mi=this.Li=this.Ki=this.$a=this.Za=this.Ya=this.Xa=this.Wa=this.Va=this.Ua=this.Ta=this.Sa=this.ae=this.$d=this.Zd=this.Yd=this.Xd=this.Wd=this.Vd=this.Ud=this.Td=this.qb=this.Lf=0;this.sk=a.linearDamping;this.hk=a.angularDamping;this.th=this.sh=this.rh=this.yh=this.xh=this.wh=this.Qf=this.Pf=this.Of=this.ci=this.bi=this.ai=0;this.O=new n(1,1,1);this.lg=!1;this.vh=1;this.jc=null}function fj(){this.mass=0;this.localInertia=new I}function Rb(a){Ob.call(this);this.ga=a;this.info=new gj;this.Wb=Array(F.maxJacobianRows);a=0;for(var b=this.Wb.length;a>1&85);d=(d&51)+(d>>2&51);d=(d&15)+(d>>4&15);c=Array(d);for(f=0;fb.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20)?b=!0:(b=a.localBasis2,b=0>b.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20));b&&console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed");var e,d,c,f,h,l,g,k,m,p,r,q,t,A,L,u,z;k=a.localBasis1;b=k.e00;e=k.e01;d=k.e02;c=k.e10;f=k.e11;h=k.e12;l=k.e20;g=k.e21;k=k.e22;z=a.localBasis2;m=z.e00;p=z.e01;r=z.e02;q=z.e10;t=z.e11;A=z.e12;L=z.e20;u=z.e21;z=z.e22;this.Ma=b;this.Na=c;this.Oa=l;this.sc=e;this.tc=f;this.uc=g;this.Pc=d;this.Qc=h;this.Rc=k;this.Sb=m;this.Tb=q;this.Ub=L;this.gi=p;this.hi=t;this.ii=u;this.nd=r;this.od=A;this.pd=z;this.cm=this.translationY=this.translationX=this.Bf=this.qh=this.Af=0;this.fk=this.ek=this.dk=!1;this.qg=Array(3);this.Rf=Array(3);this.pg=Array(3);this.Tg=Array(3);this.qg[0]=a.translationalLimitMotors[0].clone();this.qg[1]=a.translationalLimitMotors[1].clone();this.qg[2]=a.translationalLimitMotors[2].clone();this.Rf[0]=a.translationalSpringDampers[0].clone();this.Rf[1]=a.translationalSpringDampers[1].clone();this.Rf[2]=a.translationalSpringDampers[2].clone();this.pg[0]=a.rotationalLimitMotors[0].clone();this.pg[1]=a.rotationalLimitMotors[1].clone();this.pg[2]=a.rotationalLimitMotors[2].clone();this.Tg[0]=a.rotationalSpringDampers[0].clone();this.Tg[1]=a.rotationalSpringDampers[1].clone();this.Tg[2]=a.rotationalSpringDampers[2].clone()}function wf(){Gb.call(this);this.localAxis1=new n(1,0,0);this.localAxis2=new n(1,0,0);this.translationalLimitMotor=new tc;this.translationalSpringDamper=new Hb;this.rotationalLimitMotor=new $b;this.rotationalSpringDamper=new Hb}function Gb(){this.rigidBody2=this.rigidBody1=null;this.localAnchor1=new n;this.localAnchor2=new n;this.allowCollision=!1;this.solverType=F.defaultJointConstraintSolverType;this.positionCorrectionAlgorithm=F.defaultJointPositionCorrectionAlgorithm;this.breakTorque=this.breakForce=0}function Fb(a){N.call(this,a,2);var b=a.localAxis1;this.Ma=b.x;this.Na=b.y;this.Oa=b.z;b=a.localAxis2;this.Sb=b.x;this.Tb=b.y;this.Ub=b.z;this.Al();this.Yf=this.Xf=this.Bg=this.Se=this.Re=this.angle=0;this.N=new Ui(this);this.ul=a.translationalSpringDamper.clone();this.tl=a.translationalLimitMotor.clone();this.nl=a.rotationalSpringDamper.clone();this.ml=a.rotationalLimitMotor.clone()}function N(a,b){this.rb=new qc(this);this.sb=new qc(this);this.Sg=F.defaultJointPositionCorrectionAlgorithm;this.Jb=b;this.jc=null;this.C=a.rigidBody1;this.D=a.rigidBody2;this.Sk=a.allowCollision;this.nj=a.breakForce;this.oj=a.breakTorque;switch(a.solverType){case 0:this.Ck=new Rb(this);break;case 1:this.Ck=new Wb(this)}b=a.localAnchor1;this.sj=b.x;this.tj=b.y;this.uj=b.z;a=a.localAnchor2;this.vj=a.x;this.wj=a.y;this.xj=a.z;this.pd=this.od=this.nd=this.ii=this.hi=this.gi=this.Ub=this.Tb=this.Sb=this.Rc=this.Qc=this.Pc=this.uc=this.tc=this.sc=this.Oa=this.Na=this.Ma=this.zf=this.yf=this.xf=this.wf=this.vf=this.uf=this.fc=this.ec=this.dc=this.cc=this.bc=this.ac=0;this.Eb=Array(F.maxJacobianRows);a=0;for(b=F.maxJacobianRows;aa;){var b=a++,e=b&&4!=b?8:1;this.Nk[b]=Array(e);this.Yh[b]=Array(e);this.Pk[b]=Array(e);for(e=0;8>e;){var d=e++,c=.7853981633974475*b,f=.7853981633974475*d;this.Nk[b][d]=new n(Math.sin(c)*Math.cos(f),Math.cos(c),-Math.sin(c)*Math.sin(f));this.Yh[b][d]=new n;this.Pk[b][d]=new n}}this.Mj=Array(8);this.vm=Array(8);this.Ee=Array(8);this.af=Array(8);this.fg=Array(8);for(a=0;8>a;)b=a++,this.Mj[b]=new n(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.vm[b]=new n(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.Ee[b]=new n,this.af[b]=new n,this.fg[b]=new n;this.style=new wj}function hf(){this.position=new n;this.normal=new n;this.shape=null;this.fraction=1;this.position.R();this.normal.R();this.hit=!1}function Ni(){}function xj(){}function yj(){}function Vi(){this.u=new eb;this.sn=null}function ij(){this.dj=new Oi;this.Jj=new Ua;this.Bg=new n;this.R=new n;this.wm=this.Lj=null}function Pi(){this.dj=new Oi;this.Jj=new n;this.end=new n;this.Lj=null}function Ca(a,b){null==a&&(a=2);switch(a){case 1:this.hc=new pc;break;case 2:this.hc=new Kb}this.Hi=new De(this.hc);null==b&&(b=new n(0,-9.80665,0));this.Xk=new n(b.x,b.y,b.z);this.Ti=this.di=this.Xi=this.Nf=null;this.xk=this.jl=this.Rg=this.yj=0;this.ll=10;this.kl=5;this.zk=new Pi;this.qj=new ij;this.Qk=new Vi;this.Ng=new zj;this.hf=Array(F.islandInitialConstraintArraySize);this.Fh=Array(F.islandInitialRigidBodyArraySize);this.ji=new Aj;this.ra=new Nb;this.om=0}function Aj(){this.invDt=this.dt=0;this.dtRatio=1}function zj(){this.cg=Array(F.islandInitialRigidBodyArraySize);this.dg=Array(F.islandInitialConstraintArraySize);this.Xh=Array(F.islandInitialConstraintArraySize);this.Wh=Array(F.islandInitialConstraintArraySize);this.Oh=this.Ph=this.bg=this.ag=0}function De(a){this.hc=a;this.tn=new hi;this.Ui=0}function Zb(){this.ad=this.me=this.M=this.ia=null}function ac(){this.ia=this.M=null;this.rb=new Zb;this.sb=new Zb;this.$h=this.D=this.C=this.Fc=this.Ec=null;this.pj=new Bj;this.un=new jf;this.Bk=this.rk=!1;this.Ia=new Tb;this.qm=new uj(this.Ia);this.ef=new Uc(this.Ia);this.Hh=!1}function wa(a,b,e,d){null==d&&(d=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=d;wa.numCreations++}function Nb(){this.c=Array(256);this.b=0;this.bb=Array(256);this.cb=0;this.eg=Array(256);this.Ag=0;this.le=Array(256);this.re=0}function pa(){}function J(a,b,e,d,c,f,h,l,g,k,m,p,r,q,t,A){null==A&&(A=1);null==t&&(t=0);null==q&&(q=0);null==r&&(r=0);null==p&&(p=0);null==m&&(m=1);null==k&&(k=0);null==g&&(g=0);null==l&&(l=0);null==h&&(h=0);null==f&&(f=1);null==c&&(c=0);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=d;this.e10=c;this.e11=f;this.e12=h;this.e13=l;this.e20=g;this.e21=k;this.e22=m;this.e23=p;this.e30=r;this.e31=q;this.e32=t;this.e33=A;J.numCreations++}function I(a,b,e,d,c,f,h,l,g){null==g&&(g=1);null==l&&(l=0);null==h&&(h=0);null==f&&(f=0);null==c&&(c=1);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=d;this.e11=c;this.e12=f;this.e20=h;this.e21=l;this.e22=g;I.numCreations++}function Pc(){}function dc(){}function lb(){this.La=Array(4);this.eb=Array(4);this.ib=Array(4);this.Ij=Array(3);this.Ij[0]=new n(1,0,0);this.Ij[1]=new n(0,1,0);this.Ij[2]=new n(0,0,1);this.Jo=new n;this.Ko=new n;this.Co=new n;this.Bo=new n;this.Io=new Ua;this.La[0]=new n;this.eb[0]=new n;this.ib[0]=new n;this.La[1]=new n;this.eb[1]=new n;this.ib[1]=new n;this.La[2]=new n;this.eb[2]=new n;this.ib[2]=new n;this.La[3]=new n;this.eb[3]=new n;this.ib[3]=new n;this.dir=new n;this.closest=new n;this.closestPoint1=new n;this.closestPoint2=new n;this.ih=new Cj}function F(){}function Ua(){this.B=this.A=this.v=0;this.o=1;this.i=this.h=this.f=0;this.m=1;this.g=this.l=this.j=0;this.s=1}function n(a,b,e){null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;n.numCreations++}function Dj(){this.$l=new n}function te(){this.Rd=new n;this.eb=new n;this.ib=new n}function Ee(){this.id=++Ee.Kb;this.ia=this.M=null;this.wk=new n;this.sl=this.nk=0;this.Gj=!1;this.Ca=Array(3);this.Hb=Array(3);this.Ib=Array(3);this.zi=new n;this.Sc=Array(3);this.Sc[0]=1;this.Sc[1]=2;this.Sc[2]=0}function Cj(){this.Ca=Array(F.maxEPAVertices);this.Gi=new n;this.We=0;this.cd=this.Cd=null;this.Bh=0;this.jf=this.Qe=null}function ii(){this.oh=!1}function ji(a){this.oh=a}function ki(a){this.oh=a}function li(){this.oh=!1}function mi(){this.oh=!1}function Bj(){}function Ej(){this.gc=this.fd=this.Rj=this.w=0;this.Xb=Array(8);this.Gb=Array(8);this.Xb[0]=new kc;this.Gb[0]=new kc;this.Xb[1]=new kc;this.Gb[1]=new kc;this.Xb[2]=new kc;this.Gb[2]=new kc;this.Xb[3]=new kc;this.Gb[3]=new kc;this.Xb[4]=new kc;this.Gb[4]=new kc;this.Xb[5]=new kc;this.Gb[5]=new kc;this.Xb[6]=new kc;this.Gb[6]=new kc;this.Xb[7]=new kc;this.Gb[7]=new kc}function kc(){this.Ra=this.Qa=this.Pa=this.y=this.x=0}function ni(){this.oh=!1;this.Xg=new Ej}function lc(a){this.oh=a}function Fj(){this.position1=new n;this.position2=new n;this.id=this.depth=0}function jf(){this.numPoints=0;this.normal=new n;this.points=Array(F.maxManifoldPoints);this.incremental=!1;for(var a=0,b=F.maxManifoldPoints;a.2*a&&(this.Rb=.2*a)}function eb(){this.ma=this.la=this.ka=this.pa=this.oa=this.na=0}function Gj(){this.Nb=null;this.yk=0;this.Zi=new Hj;this.qf=this.zg=this.qd=null;this.zi=Array(1024)}function Hj(){this.mm=0;this.ik=!1}function Wi(a,b){Qc.call(this,a,b);this.ei=null;this.zh=!1}function oi(){this.ng=this.og=this.M=null;this.F=Array(2);this.Ja=0;this.Ea=null;this.P=0;this.ub=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function Kb(){ub.call(this,2);this.qk=!0;this.ye=new Gj;this.rf=Array(1024);this.$f=0}function pc(){ub.call(this,1);this.qk=!1}function ve(){this.Dh=this.Ch=null}function Qc(a,b){this.userData=a;this.Ic=b;this.M=this.ia=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function pi(){}function we(){}function Xi(){Qa.call(this,-1);this.min=new n;this.max=new n}function jj(){Qa.call(this,-1)}function Qa(a){wc.call(this,a);this.Rb=F.defaultGJKMargin;this.rm=!1}function wc(a){this.Jb=a;this.Sf=0}function ub(a){this.Jb=a;this.Vi=0;this.pe=this.gf=this.Oe=null;this.qk=!1;this.Dj=0;this.Eh=null;this.lm=0;this.mk=new jj;this.u=new Xi;this.rg=new Ua;this.R=new n;this.dj=new Oi}function Ij(){}function gb(a,b){a=Object.create(a);for(var e in b)a[e]=b[e];b.toString!==Object.prototype.toString&&(a.toString=b.toString);return a}Ij.lc=function(){window.OIMO={};window.OIMO.DebugDraw=Mg;window.OIMO.BroadPhase=ub;ub.prototype.createProxy=ub.prototype.ni;ub.prototype.destroyProxy=ub.prototype.oi;ub.prototype.moveProxy=ub.prototype.Qd;ub.prototype.isOverlapping=ub.prototype.Kb;ub.prototype.collectPairs=ub.prototype.$i;ub.prototype.getProxyPairList=ub.prototype.wa;ub.prototype.isIncremental=ub.prototype.Cb;ub.prototype.getTestCount=ub.prototype.mb;ub.prototype.rayCast=ub.prototype.ke;ub.prototype.convexCast=ub.prototype.Vf;ub.prototype.aabbTest=ub.prototype.Ih;window.OIMO.Geometry=wc;wc.prototype.getType=wc.prototype.mb;wc.prototype.getVolume=wc.prototype.wa;wc.prototype.rayCast=wc.prototype.ke;window.OIMO.ConvexGeometry=Qa;Qa.prototype.getGjkMergin=Qa.prototype.Xn;Qa.prototype.setGjkMergin=Qa.prototype.Go;Qa.prototype.computeLocalSupportingVertex=Qa.prototype.he;Qa.prototype.rayCast=Qa.prototype.ke;window.OIMO.BroadPhaseProxyCallback=we;we.prototype.process=we.prototype.process;window.OIMO.BroadPhaseType=pi;window.OIMO.Proxy=Qc;Qc.prototype.getId=Qc.prototype.Cb;Qc.prototype.getFatAabb=Qc.prototype.wa;Qc.prototype.getFatAabbTo=Qc.prototype.mb;window.OIMO.ProxyPair=ve;ve.prototype.getProxy1=ve.prototype.wa;ve.prototype.getProxy2=ve.prototype.mb;ve.prototype.getNext=ve.prototype.Cb;window.OIMO.BruteForceBroadPhase=pc;pc.prototype.createProxy=pc.prototype.ni;pc.prototype.destroyProxy=pc.prototype.oi;pc.prototype.moveProxy=pc.prototype.Qd;pc.prototype.collectPairs=pc.prototype.$i;pc.prototype.rayCast=pc.prototype.ke;pc.prototype.convexCast=pc.prototype.Vf;pc.prototype.aabbTest=pc.prototype.Ih;window.OIMO.BvhBroadPhase=Kb;Kb.prototype.createProxy=Kb.prototype.ni;Kb.prototype.destroyProxy=Kb.prototype.oi;Kb.prototype.moveProxy=Kb.prototype.Qd;Kb.prototype.collectPairs=Kb.prototype.$i;Kb.prototype.rayCast=Kb.prototype.ke;Kb.prototype.convexCast=Kb.prototype.Vf;Kb.prototype.aabbTest=Kb.prototype.Ih;Kb.prototype.getTreeBalance=Kb.prototype.so;window.OIMO.Aabb=eb;eb.prototype.init=eb.prototype.Aa;eb.prototype.getMin=eb.prototype.Uc;eb.prototype.getMinTo=eb.prototype.Vc;eb.prototype.setMin=eb.prototype.ie;eb.prototype.getMax=eb.prototype.Dc;eb.prototype.getMaxTo=eb.prototype.Hc;eb.prototype.setMax=eb.prototype.vd;eb.prototype.getCenter=eb.prototype.Cb;eb.prototype.getCenterTo=eb.prototype.Kb;eb.prototype.getExtents=eb.prototype.kc;eb.prototype.getExtentsTo=eb.prototype.lc;eb.prototype.combine=eb.prototype.wa;eb.prototype.combined=eb.prototype.mb;eb.prototype.overlap=eb.prototype.Wc;eb.prototype.getIntersection=eb.prototype.wc;eb.prototype.getIntersectionTo=eb.prototype.xc;eb.prototype.copyFrom=eb.prototype.qe;eb.prototype.clone=eb.prototype.clone;window.OIMO.BoxGeometry=Hd;Hd.prototype.getHalfExtents=Hd.prototype.Yn;Hd.prototype.getHalfExtentsTo=Hd.prototype.Zn;Hd.prototype.computeLocalSupportingVertex=Hd.prototype.he;window.OIMO.CapsuleGeometry=Wc;Wc.prototype.getRadius=Wc.prototype.pi;Wc.prototype.getHalfHeight=Wc.prototype.Pj;Wc.prototype.computeLocalSupportingVertex=Wc.prototype.he;window.OIMO.ConeGeometry=Fe;Fe.prototype.getRadius=Fe.prototype.pi;Fe.prototype.getHalfHeight=Fe.prototype.Pj;Fe.prototype.computeLocalSupportingVertex=Fe.prototype.he;window.OIMO.ConvexHullGeometry=kf;kf.prototype.getVertices=kf.prototype.wo;kf.prototype.computeLocalSupportingVertex=kf.prototype.he;window.OIMO.CylinderGeometry=Qd;Qd.prototype.getRadius=Qd.prototype.pi;Qd.prototype.getHalfHeight=Qd.prototype.Pj;Qd.prototype.computeLocalSupportingVertex=Qd.prototype.he;window.OIMO.GeometryType=bc;window.OIMO.RayCastHit=Oi;window.OIMO.SphereGeometry=ue;ue.prototype.getRadius=ue.prototype.pi;ue.prototype.computeLocalSupportingVertex=ue.prototype.he;window.OIMO.CollisionMatrix=hi;hi.prototype.getDetector=hi.prototype.wa;window.OIMO.DetectorResult=jf;jf.prototype.getMaxDepth=jf.prototype.Em;jf.prototype.clear=jf.prototype.clear;window.OIMO.DetectorResultPoint=Fj;window.OIMO.Detector=lc;lc.prototype.detect=lc.prototype.zm;window.OIMO.BoxBoxDetector=ni;window.OIMO.CapsuleCapsuleDetector=mi;window.OIMO.GjkEpaDetector=li;window.OIMO.SphereBoxDetector=ki;window.OIMO.SphereCapsuleDetector=ji;window.OIMO.SphereSphereDetector=ii;window.OIMO.Vec3=n;n.prototype.init=n.prototype.Aa;n.prototype.zero=n.prototype.R;n.prototype.add=n.prototype.ie;n.prototype.add3=n.prototype.wa;n.prototype.addScaled=n.prototype.Cb;n.prototype.sub=n.prototype.cf;n.prototype.sub3=n.prototype.jg;n.prototype.scale=n.prototype.Ke;n.prototype.scale3=n.prototype.hg;n.prototype.dot=n.prototype.Ge;n.prototype.cross=n.prototype.kc;n.prototype.addEq=n.prototype.Fe;n.prototype.add3Eq=n.prototype.mb;n.prototype.addScaledEq=n.prototype.Kb;n.prototype.subEq=n.prototype.gg;n.prototype.sub3Eq=n.prototype.kg;n.prototype.scaleEq=n.prototype.bf;n.prototype.scale3Eq=n.prototype.ig;n.prototype.crossEq=n.prototype.lc;n.prototype.mulMat3=n.prototype.wc;n.prototype.mulMat4=n.prototype.Dc;n.prototype.mulTransform=n.prototype.Uc;n.prototype.mulMat3Eq=n.prototype.xc;n.prototype.mulMat4Eq=n.prototype.Hc;n.prototype.mulTransformEq=n.prototype.Vc;n.prototype.length=n.prototype.length;n.prototype.lengthSq=n.prototype.He;n.prototype.normalized=n.prototype.Je;n.prototype.normalize=n.prototype.Ie;n.prototype.negate=n.prototype.Wc;n.prototype.negateEq=n.prototype.vd;n.prototype.copyFrom=n.prototype.qe;n.prototype.clone=n.prototype.clone;n.prototype.toString=n.prototype.toString;window.OIMO.Transform=Ua;Ua.prototype.identity=Ua.prototype.rg;Ua.prototype.getPosition=Ua.prototype.Cb;Ua.prototype.getPositionTo=Ua.prototype.Kb;Ua.prototype.setPosition=Ua.prototype.Hc;Ua.prototype.translate=Ua.prototype.Wc;Ua.prototype.getRotation=Ua.prototype.kc;Ua.prototype.getRotationTo=Ua.prototype.lc;Ua.prototype.setRotation=Ua.prototype.Uc;Ua.prototype.setRotationXyz=Ua.prototype.Vc;Ua.prototype.rotate=Ua.prototype.wc;Ua.prototype.rotateXyz=Ua.prototype.xc;Ua.prototype.getOrientation=Ua.prototype.wa;Ua.prototype.getOrientationTo=Ua.prototype.mb;Ua.prototype.setOrientation=Ua.prototype.Dc;Ua.prototype.clone=Ua.prototype.clone;Ua.prototype.copyFrom=Ua.prototype.qe;window.OIMO.Setting=F;window.OIMO.GjkEpa=lb;lb.prototype.computeClosestPoints=lb.prototype.wa;lb.prototype.computeDistance=lb.prototype.mb;lb.prototype.convexCast=lb.prototype.Vf;lb.prototype.rayCast=lb.prototype.ke;lb.getInstance=lb.kc;window.OIMO.GjkEpaResultState=dc;window.OIMO.SimplexUtil=Pc;Pc.projectOrigin2=Pc.wc;Pc.projectOrigin3=Pc.xc;Pc.projectOrigin4=Pc.Dc;window.OIMO.Mat3=I;I.prototype.init=I.prototype.Aa;I.prototype.identity=I.prototype.rg;I.prototype.add=I.prototype.Dc;I.prototype.sub=I.prototype.ig;I.prototype.scale=I.prototype.gg;I.prototype.mul=I.prototype.He;I.prototype.addEq=I.prototype.Hc;I.prototype.subEq=I.prototype.jg;I.prototype.scaleEq=I.prototype.hg;I.prototype.mulEq=I.prototype.Ie;I.prototype.prependScale=I.prototype.bf;I.prototype.appendScale=I.prototype.Wc;I.prototype.prependRotation=I.prototype.Je;I.prototype.appendRotation=I.prototype.Uc;I.prototype.prependScaleEq=I.prototype.cf;I.prototype.appendScaleEq=I.prototype.vd;I.prototype.prependRotationEq=I.prototype.Ke;I.prototype.appendRotationEq=I.prototype.Vc;I.prototype.transpose=I.prototype.Di;I.prototype.transposeEq=I.prototype.Ei;I.prototype.determinant=I.prototype.ie;I.prototype.trace=I.prototype.ph;I.prototype.inverse=I.prototype.Fe;I.prototype.inverseEq=I.prototype.Ge;I.prototype.toArray=I.prototype.kg;I.prototype.copyFrom=I.prototype.qe;I.prototype.clone=I.prototype.clone;I.prototype.fromQuat=I.prototype.Cb;I.prototype.toQuat=I.prototype.gk;I.prototype.fromEulerXyz=I.prototype.mb;I.prototype.toEulerXyz=I.prototype.Fi;I.prototype.getRow=I.prototype.wc;I.prototype.getCol=I.prototype.kc;I.prototype.getRowTo=I.prototype.xc;I.prototype.getColTo=I.prototype.lc;I.prototype.fromRows=I.prototype.Kb;I.prototype.fromCols=I.prototype.wa;I.prototype.toString=I.prototype.toString;window.OIMO.Mat4=J;J.prototype.init=J.prototype.Aa;J.prototype.identity=J.prototype.rg;J.prototype.add=J.prototype.kc;J.prototype.sub=J.prototype.gg;J.prototype.scale=J.prototype.bf;J.prototype.mul=J.prototype.ie;J.prototype.addEq=J.prototype.lc;J.prototype.subEq=J.prototype.hg;J.prototype.scaleEq=J.prototype.cf;J.prototype.mulEq=J.prototype.Fe;J.prototype.prependScale=J.prototype.Je;J.prototype.appendScale=J.prototype.Dc;J.prototype.prependRotation=J.prototype.He;J.prototype.appendRotation=J.prototype.wc;J.prototype.prependTranslation=J.prototype.Ei;J.prototype.appendTranslation=J.prototype.wa;J.prototype.prependScaleEq=J.prototype.Ke;J.prototype.appendScaleEq=J.prototype.Hc;J.prototype.prependRotationEq=J.prototype.Ie;J.prototype.appendRotationEq=J.prototype.xc;J.prototype.prependTranslationEq=J.prototype.Fi;J.prototype.appendTranslationEq=J.prototype.mb;J.prototype.transpose=J.prototype.kg;J.prototype.transposeEq=J.prototype.ph;J.prototype.determinant=J.prototype.Uc;J.prototype.trace=J.prototype.jg;J.prototype.inverse=J.prototype.Wc;J.prototype.inverseEq=J.prototype.vd;J.prototype.lookAt=J.prototype.Kb;J.prototype.perspective=J.prototype.Ge;J.prototype.ortho=J.prototype.Di;J.prototype.toArray=J.prototype.ig;J.prototype.copyFrom=J.prototype.qe;J.prototype.fromMat3=J.prototype.Vc;J.prototype.fromTransform=J.prototype.Cb;J.prototype.clone=J.prototype.clone;J.prototype.toString=J.prototype.toString;window.OIMO.MathUtil=pa;pa.abs=pa.abs;pa.sin=pa.sin;pa.cos=pa.cos;pa.tan=pa.tan;pa.asin=pa.asin;pa.acos=pa.acos;pa.atan=pa.atan;pa.safeAsin=pa.ie;pa.safeAcos=pa.vd;pa.atan2=pa.atan2;pa.sqrt=pa.sqrt;pa.clamp=pa.Cb;pa.rand=pa.Hc;pa.randIn=pa.Uc;pa.randVec3In=pa.Wc;pa.randVec3=pa.Vc;window.OIMO.Pool=Nb;Nb.prototype.vec3=Nb.prototype.Dc;Nb.prototype.mat3=Nb.prototype.lc;Nb.prototype.mat4=Nb.prototype.wc;Nb.prototype.quat=Nb.prototype.xc;Nb.prototype.dispose=Nb.prototype.wa;Nb.prototype.disposeVec3=Nb.prototype.kc;Nb.prototype.disposeMat3=Nb.prototype.mb;Nb.prototype.disposeMat4=Nb.prototype.Cb;Nb.prototype.disposeQuat=Nb.prototype.Kb;window.OIMO.Quat=wa;wa.prototype.identity=wa.prototype.rg;wa.prototype.init=wa.prototype.Aa;wa.prototype.add=wa.prototype.wa;wa.prototype.sub=wa.prototype.Hc;wa.prototype.scale=wa.prototype.xc;wa.prototype.addEq=wa.prototype.mb;wa.prototype.subEq=wa.prototype.Uc;wa.prototype.scaleEq=wa.prototype.Dc;wa.prototype.length=wa.prototype.length;wa.prototype.lengthSq=wa.prototype.kc;wa.prototype.dot=wa.prototype.Cb;wa.prototype.normalized=wa.prototype.wc;wa.prototype.normalize=wa.prototype.lc;wa.prototype.setArc=wa.prototype.Vc;wa.prototype.slerp=wa.prototype.Wc;wa.prototype.copyFrom=wa.prototype.qe;wa.prototype.clone=wa.prototype.clone;wa.prototype.fromMat3=wa.prototype.Kb;wa.prototype.toMat3=wa.prototype.vd;wa.prototype.toString=wa.prototype.toString;window.OIMO.Contact=ac;ac.prototype.getShape1=ac.prototype.kc;ac.prototype.getShape2=ac.prototype.lc;ac.prototype.isTouching=ac.prototype.Kk;ac.prototype.getManifold=ac.prototype.mb;ac.prototype.getContactConstraint=ac.prototype.wa;ac.prototype.getPrev=ac.prototype.Kb;ac.prototype.getNext=ac.prototype.Cb;window.OIMO.ContactLink=Zb;Zb.prototype.getContact=Zb.prototype.wa;Zb.prototype.getOther=Zb.prototype.Cb;Zb.prototype.getPrev=Zb.prototype.Kb;Zb.prototype.getNext=Zb.prototype.mb;window.OIMO.ContactManager=De;De.prototype.getNumContacts=De.prototype.mb;De.prototype.getContactList=De.prototype.wa;window.OIMO.TimeStep=Aj;window.OIMO.World=Ca;Ca.prototype.step=Ca.prototype.Fe;Ca.prototype.addRigidBody=Ca.prototype.mb;Ca.prototype.removeRigidBody=Ca.prototype.Ge;Ca.prototype.addJoint=Ca.prototype.wa;Ca.prototype.removeJoint=Ca.prototype.bm;Ca.prototype.setDebugDraw=Ca.prototype.He;Ca.prototype.getDebugDraw=Ca.prototype.lc;Ca.prototype.debugDraw=Ca.prototype.Cb;Ca.prototype.rayCast=Ca.prototype.ke;Ca.prototype.convexCast=Ca.prototype.Vf;Ca.prototype.aabbTest=Ca.prototype.Ih;Ca.prototype.getRigidBodyList=Ca.prototype.vd;Ca.prototype.getJointList=Ca.prototype.xc;Ca.prototype.getBroadPhase=Ca.prototype.Kb;Ca.prototype.getContactManager=Ca.prototype.kc;Ca.prototype.getNumRigidBodies=Ca.prototype.Vc;Ca.prototype.getNumJoints=Ca.prototype.Hc;Ca.prototype.getNumShapes=Ca.prototype.ie;Ca.prototype.getNumIslands=Ca.prototype.Dc;Ca.prototype.getNumVelocityIterations=Ca.prototype.Wc;Ca.prototype.setNumVelocityIterations=Ca.prototype.Ke;Ca.prototype.getNumPositionIterations=Ca.prototype.Uc;Ca.prototype.setNumPositionIterations=Ca.prototype.Je;Ca.prototype.getGravity=Ca.prototype.wc;Ca.prototype.setGravity=Ca.prototype.Ie;window.OIMO.AabbTestCallback=yj;window.OIMO.ContactCallback=xj;window.OIMO.RayCastCallback=Ni;window.OIMO.RayCastClosest=hf;hf.prototype.clear=hf.prototype.clear;hf.prototype.process=hf.prototype.process;window.OIMO.DebugDrawStyle=wj;window.OIMO.Performance=Ce;window.OIMO.ConstraintSolver=Ob;Ob.prototype.preSolveVelocity=Ob.prototype.Qh;Ob.prototype.warmStart=Ob.prototype.Zh;Ob.prototype.solveVelocity=Ob.prototype.Vh;Ob.prototype.postSolveVelocity=Ob.prototype.cj;Ob.prototype.preSolvePosition=Ob.prototype.jh;Ob.prototype.solvePositionSplitImpulse=Ob.prototype.Uh;Ob.prototype.solvePositionNgs=Ob.prototype.Th;Ob.prototype.postSolve=Ob.prototype.postSolve;window.OIMO.PositionCorrectionAlgorithm=jc;window.OIMO.ContactConstraint=Uc;Uc.prototype.getShape1=Uc.prototype.mb;Uc.prototype.getShape2=Uc.prototype.Cb;Uc.prototype.getManifold=Uc.prototype.wa;Uc.prototype.isTouching=Uc.prototype.Kk;window.OIMO.Manifold=Tb;Tb.prototype.getNormal=Tb.prototype.Cb;Tb.prototype.getNormalTo=Tb.prototype.Kb;Tb.prototype.getTangent=Tb.prototype.wc;Tb.prototype.getTangentTo=Tb.prototype.xc;Tb.prototype.getBinormal=Tb.prototype.wa;Tb.prototype.getBinormalTo=Tb.prototype.mb;Tb.prototype.getPoints=Tb.prototype.lc;Tb.prototype.getNumPoints=Tb.prototype.kc;window.OIMO.ManifoldPoint=Lb;Lb.prototype.getPosition1=Lb.prototype.Kb;Lb.prototype.getPosition1To=Lb.prototype.kc;Lb.prototype.getPosition2=Lb.prototype.lc;Lb.prototype.getPosition2To=Lb.prototype.wc;Lb.prototype.getDepth=Lb.prototype.mb;Lb.prototype.isWarmStarted=Lb.prototype.Dc;Lb.prototype.getNormalImpulse=Lb.prototype.Cb;Lb.prototype.getTangentImpulse=Lb.prototype.xc;Lb.prototype.getBinormalImpulse=Lb.prototype.wa;Lb.prototype.isEnabled=Lb.prototype.Hc;window.OIMO.Joint=N;N.prototype.getRigidBody1=N.prototype.Ke;N.prototype.getRigidBody2=N.prototype.bf;N.prototype.getType=N.prototype.hg;N.prototype.getAnchor1=N.prototype.mb;N.prototype.getAnchor2=N.prototype.Kb;N.prototype.getAnchor1To=N.prototype.Cb;N.prototype.getAnchor2To=N.prototype.kc;N.prototype.getLocalAnchor1=N.prototype.Fe;N.prototype.getLocalAnchor2=N.prototype.He;N.prototype.getLocalAnchor1To=N.prototype.Ge;N.prototype.getLocalAnchor2To=N.prototype.Ie;N.prototype.getBasis1=N.prototype.Hc;N.prototype.getBasis2=N.prototype.Vc;N.prototype.getBasis1To=N.prototype.Uc;N.prototype.getBasis2To=N.prototype.Wc;N.prototype.getAllowCollision=N.prototype.wa;N.prototype.setAllowCollision=N.prototype.ig;N.prototype.getBreakForce=N.prototype.vd;N.prototype.setBreakForce=N.prototype.jg;N.prototype.getBreakTorque=N.prototype.ie;N.prototype.setBreakTorque=N.prototype.kg;N.prototype.getPositionCorrectionAlgorithm=N.prototype.Je;N.prototype.setPositionCorrectionAlgorithm=N.prototype.ph;N.prototype.getAppliedForce=N.prototype.lc;N.prototype.getAppliedForceTo=N.prototype.wc;N.prototype.getAppliedTorque=N.prototype.xc;N.prototype.getAppliedTorqueTo=N.prototype.Dc;N.prototype.getPrev=N.prototype.gg;N.prototype.getNext=N.prototype.cf;window.OIMO.CylindricalJoint=Fb;Fb.prototype.getAxis1=Fb.prototype.Zg;Fb.prototype.getAxis2=Fb.prototype.ah;Fb.prototype.getAxis1To=Fb.prototype.$g;Fb.prototype.getAxis2To=Fb.prototype.bh;Fb.prototype.getLocalAxis1=Fb.prototype.dh;Fb.prototype.getLocalAxis2=Fb.prototype.fh;Fb.prototype.getLocalAxis1To=Fb.prototype.eh;Fb.prototype.getLocalAxis2To=Fb.prototype.gh;Fb.prototype.getTranslationalSpringDamper=Fb.prototype.po;Fb.prototype.getRotationalSpringDamper=Fb.prototype.eo;Fb.prototype.getTranslationalLimitMotor=Fb.prototype.no;Fb.prototype.getRotationalLimitMotor=Fb.prototype.bo;Fb.prototype.getAngle=Fb.prototype.Gl;Fb.prototype.getTranslation=Fb.prototype.Jl;window.OIMO.JointConfig=Gb;window.OIMO.CylindricalJointConfig=wf;wf.prototype.init=wf.prototype.Aa;window.OIMO.GenericJoint=Sb;Sb.prototype.getAxisX=Sb.prototype.Un;Sb.prototype.getAxisY=Sb.prototype.Vn;Sb.prototype.getAxisZ=Sb.prototype.Wn;Sb.prototype.getTranslationalSpringDampers=Sb.prototype.qo;Sb.prototype.getRotationalSpringDampers=Sb.prototype.fo;Sb.prototype.getTranslationalLimitMotors=Sb.prototype.oo;Sb.prototype.getRotationalLimitMotors=Sb.prototype.co;Sb.prototype.getAngles=Sb.prototype.Tn;Sb.prototype.getTranslations=Sb.prototype.ro;window.OIMO.GenericJointConfig=Lg;Lg.prototype.init=Lg.prototype.Aa;window.OIMO.JointLink=qc;qc.prototype.getContact=qc.prototype.wa;qc.prototype.getOther=qc.prototype.Cb;qc.prototype.getPrev=qc.prototype.Kb;qc.prototype.getNext=qc.prototype.mb;window.OIMO.JointType=Mb;window.OIMO.PrismaticJoint=Jb;Jb.prototype.getAxis1=Jb.prototype.Zg;Jb.prototype.getAxis2=Jb.prototype.ah;Jb.prototype.getAxis1To=Jb.prototype.$g;Jb.prototype.getAxis2To=Jb.prototype.bh;Jb.prototype.getLocalAxis1=Jb.prototype.dh;Jb.prototype.getLocalAxis2=Jb.prototype.fh;Jb.prototype.getLocalAxis1To=Jb.prototype.eh;Jb.prototype.getLocalAxis2To=Jb.prototype.gh;Jb.prototype.getSpringDamper=Jb.prototype.Qj;Jb.prototype.getLimitMotor=Jb.prototype.Il;Jb.prototype.getTranslation=Jb.prototype.Jl;window.OIMO.PrismaticJointConfig=Kg;Kg.prototype.init=Kg.prototype.Aa;window.OIMO.RagdollJoint=pb;pb.prototype.getAxis1=pb.prototype.Zg;pb.prototype.getAxis2=pb.prototype.ah;pb.prototype.getAxis1To=pb.prototype.$g;pb.prototype.getAxis2To=pb.prototype.bh;pb.prototype.getLocalAxis1=pb.prototype.dh;pb.prototype.getLocalAxis2=pb.prototype.fh;pb.prototype.getLocalAxis1To=pb.prototype.eh;pb.prototype.getLocalAxis2To=pb.prototype.gh;pb.prototype.getTwistSpringDamper=pb.prototype.vo;pb.prototype.getTwistLimitMotor=pb.prototype.uo;pb.prototype.getSwingSpringDamper=pb.prototype.mo;pb.prototype.getSwingAxis=pb.prototype.ko;pb.prototype.getSwingAxisTo=pb.prototype.lo;pb.prototype.getSwingAngle=pb.prototype.jo;pb.prototype.getTwistAngle=pb.prototype.to;window.OIMO.RagdollJointConfig=Jg;Jg.prototype.init=Jg.prototype.Aa;window.OIMO.RevoluteJoint=Qb;Qb.prototype.getAxis1=Qb.prototype.Zg;Qb.prototype.getAxis2=Qb.prototype.ah;Qb.prototype.getAxis1To=Qb.prototype.$g;Qb.prototype.getAxis2To=Qb.prototype.bh;Qb.prototype.getLocalAxis1=Qb.prototype.dh;Qb.prototype.getLocalAxis2=Qb.prototype.fh;Qb.prototype.getLocalAxis1To=Qb.prototype.eh;Qb.prototype.getLocalAxis2To=Qb.prototype.gh;Qb.prototype.getSpringDamper=Qb.prototype.Qj;Qb.prototype.getLimitMotor=Qb.prototype.Il;Qb.prototype.getAngle=Qb.prototype.Gl;window.OIMO.RevoluteJointConfig=ff;ff.prototype.init=ff.prototype.Aa;window.OIMO.RotationalLimitMotor=$b;$b.prototype.setLimits=$b.prototype.mh;$b.prototype.setMotor=$b.prototype.wa;$b.prototype.clone=$b.prototype.clone;window.OIMO.SphericalJoint=se;se.prototype.getSpringDamper=se.prototype.Qj;window.OIMO.SphericalJointConfig=Lf;Lf.prototype.init=Lf.prototype.Aa;window.OIMO.SpringDamper=Hb;Hb.prototype.setSpring=Hb.prototype.wa;Hb.prototype.setSymplecticEuler=Hb.prototype.mb;Hb.prototype.clone=Hb.prototype.clone;window.OIMO.TranslationalLimitMotor=tc;tc.prototype.setLimits=tc.prototype.mh;tc.prototype.setMotor=tc.prototype.wa;tc.prototype.clone=tc.prototype.clone;window.OIMO.UniversalJoint=Bb;Bb.prototype.getAxis1=Bb.prototype.Zg;Bb.prototype.getAxis2=Bb.prototype.ah;Bb.prototype.getAxis1To=Bb.prototype.$g;Bb.prototype.getAxis2To=Bb.prototype.bh;Bb.prototype.getLocalAxis1=Bb.prototype.dh;Bb.prototype.getLocalAxis2=Bb.prototype.fh;Bb.prototype.getLocalAxis1To=Bb.prototype.eh;Bb.prototype.getLocalAxis2To=Bb.prototype.gh;Bb.prototype.getSpringDamper1=Bb.prototype.ho;Bb.prototype.getSpringDamper2=Bb.prototype.io;Bb.prototype.getLimitMotor1=Bb.prototype.$n;Bb.prototype.getLimitMotor2=Bb.prototype.ao;Bb.prototype.getAngle1=Bb.prototype.Rn;Bb.prototype.getAngle2=Bb.prototype.Sn;window.OIMO.UniversalJointConfig=Kf;Kf.prototype.init=Kf.prototype.Aa;window.OIMO.ConstraintSolverType=vf;window.OIMO.DirectJointConstraintSolver=Wb;Wb.prototype.preSolveVelocity=Wb.prototype.Qh;Wb.prototype.warmStart=Wb.prototype.Zh;Wb.prototype.solveVelocity=Wb.prototype.Vh;Wb.prototype.postSolveVelocity=Wb.prototype.cj;Wb.prototype.preSolvePosition=Wb.prototype.jh;Wb.prototype.solvePositionSplitImpulse=Wb.prototype.Uh;Wb.prototype.solvePositionNgs=Wb.prototype.Th;Wb.prototype.postSolve=Wb.prototype.postSolve;window.OIMO.PgsContactConstraintSolver=Pb;Pb.prototype.preSolveVelocity=Pb.prototype.Qh;Pb.prototype.warmStart=Pb.prototype.Zh;Pb.prototype.solveVelocity=Pb.prototype.Vh;Pb.prototype.preSolvePosition=Pb.prototype.jh;Pb.prototype.solvePositionSplitImpulse=Pb.prototype.Uh;Pb.prototype.solvePositionNgs=Pb.prototype.Th;Pb.prototype.postSolve=Pb.prototype.postSolve;window.OIMO.PgsJointConstraintSolver=Rb;Rb.prototype.preSolveVelocity=Rb.prototype.Qh;Rb.prototype.warmStart=Rb.prototype.Zh;Rb.prototype.solveVelocity=Rb.prototype.Vh;Rb.prototype.postSolveVelocity=Rb.prototype.cj;Rb.prototype.preSolvePosition=Rb.prototype.jh;Rb.prototype.solvePositionSplitImpulse=Rb.prototype.Uh;Rb.prototype.solvePositionNgs=Rb.prototype.Th;Rb.prototype.postSolve=Rb.prototype.postSolve;window.OIMO.MassData=fj;window.OIMO.RigidBody=x;x.prototype.getPosition=x.prototype.Om;x.prototype.getPositionTo=x.prototype.Pm;x.prototype.setPosition=x.prototype.Po;x.prototype.translate=x.prototype.cn;x.prototype.getRotation=x.prototype.Vm;x.prototype.getRotationTo=x.prototype.Wm;x.prototype.setRotation=x.prototype.Qo;x.prototype.setRotationXyz=x.prototype.Ro;x.prototype.rotate=x.prototype.Ho;x.prototype.rotateXyz=x.prototype.Mo;x.prototype.getOrientation=x.prototype.Mm;x.prototype.getOrientationTo=x.prototype.Nm;x.prototype.setOrientation=x.prototype.No;x.prototype.getTransform=x.prototype.Xm;x.prototype.getTransformTo=x.prototype.Ym;x.prototype.setTransform=x.prototype.So;x.prototype.getMass=x.prototype.ph;x.prototype.getLocalInertia=x.prototype.cf;x.prototype.getLocalInertiaTo=x.prototype.gg;x.prototype.getMassData=x.prototype.Di;x.prototype.getMassDataTo=x.prototype.Ei;x.prototype.setMassData=x.prototype.ln;x.prototype.getRotationFactor=x.prototype.fm;x.prototype.setRotationFactor=x.prototype.mn;x.prototype.getLinearVelocity=x.prototype.Ke;x.prototype.getLinearVelocityTo=x.prototype.bf;x.prototype.setLinearVelocity=x.prototype.kn;x.prototype.getAngularVelocity=x.prototype.Wc;x.prototype.getAngularVelocityTo=x.prototype.vd;x.prototype.setAngularVelocity=x.prototype.fn;x.prototype.addLinearVelocity=x.prototype.mb;x.prototype.addAngularVelocity=x.prototype.wa;x.prototype.applyImpulse=x.prototype.wc;x.prototype.applyLinearImpulse=x.prototype.xc;x.prototype.applyAngularImpulse=x.prototype.Kb;x.prototype.applyForce=x.prototype.kc;x.prototype.applyForceToCenter=x.prototype.lc;x.prototype.applyTorque=x.prototype.Dc;x.prototype.getLinearContactImpulse=x.prototype.He;x.prototype.getLinearContactImpulseTo=x.prototype.Ie;x.prototype.getAngularContactImpulse=x.prototype.Hc;x.prototype.getAngularContactImpulseTo=x.prototype.Uc;x.prototype.getGravityScale=x.prototype.Fe;x.prototype.setGravityScale=x.prototype.hn;x.prototype.getLocalPoint=x.prototype.hg;x.prototype.getLocalPointTo=x.prototype.ig;x.prototype.getLocalVector=x.prototype.jg;x.prototype.getLocalVectorTo=x.prototype.kg;x.prototype.getWorldPoint=x.prototype.um;x.prototype.getWorldPointTo=x.prototype.ym;x.prototype.getWorldVector=x.prototype.Am;x.prototype.getWorldVectorTo=x.prototype.Bm;x.prototype.getNumShapes=x.prototype.Jm;x.prototype.getShapeList=x.prototype.sm;x.prototype.getNumContectLinks=x.prototype.Fi;x.prototype.getContactLinkList=x.prototype.ie;x.prototype.getNumJointLinks=x.prototype.gk;x.prototype.getJointLinkList=x.prototype.Ge;x.prototype.addShape=x.prototype.Cb;x.prototype.removeShape=x.prototype.dn;x.prototype.getType=x.prototype.Eo;x.prototype.setType=x.prototype.nn;x.prototype.wakeUp=x.prototype.pn;x.prototype.sleep=x.prototype.on;x.prototype.isSleeping=x.prototype.Dm;x.prototype.getSleepTime=x.prototype.tm;x.prototype.setAutoSleep=x.prototype.gn;x.prototype.getLinearDamping=x.prototype.Je;x.prototype.setLinearDamping=x.prototype.jn;x.prototype.getAngularDamping=x.prototype.Vc;x.prototype.setAngularDamping=x.prototype.en;x.prototype.getPrev=x.prototype.Um;x.prototype.getNext=x.prototype.Im;window.OIMO.RigidBodyConfig=Rj;window.OIMO.RigidBodyType=Qe;window.OIMO.Shape=Ka;Ka.prototype.getFriction=Ka.prototype.wc;Ka.prototype.setFriction=Ka.prototype.Ke;Ka.prototype.getRestitution=Ka.prototype.Uc;Ka.prototype.setRestitution=Ka.prototype.cf;Ka.prototype.getLocalTransform=Ka.prototype.Dc;Ka.prototype.getLocalTransformTo=Ka.prototype.Hc;Ka.prototype.getTransform=Ka.prototype.ie;Ka.prototype.getTransformTo=Ka.prototype.Fe;Ka.prototype.setLocalTransform=Ka.prototype.bf;Ka.prototype.getDensity=Ka.prototype.lc;Ka.prototype.setDensity=Ka.prototype.Je;Ka.prototype.getAabb=Ka.prototype.wa;Ka.prototype.getAabbTo=Ka.prototype.mb;Ka.prototype.getGeometry=Ka.prototype.xc;Ka.prototype.getRigidBody=Ka.prototype.Vc;Ka.prototype.getCollisionGroup=Ka.prototype.Cb;Ka.prototype.setCollisionGroup=Ka.prototype.Ge;Ka.prototype.getCollisionMask=Ka.prototype.Kb;Ka.prototype.setCollisionMask=Ka.prototype.He;Ka.prototype.getContactCallback=Ka.prototype.kc;Ka.prototype.setContactCallback=Ka.prototype.Ie;Ka.prototype.getPrev=Ka.prototype.vd;Ka.prototype.getNext=Ka.prototype.Wc;window.OIMO.ShapeConfig=Qj};ub.prototype={ni:function(){return null},oi:function(){},Qd:function(){},Kb:function(a,b){return a.Jb.J&&a.Kb.K&&a.Lb.L:!1},$i:function(){},wa:function(){return this.pe},Cb:function(){return this.qk},mb:function(){return this.Dj},ke:function(){},Vf:function(){},Ih:function(){}};wc.prototype={Xe:function(){},Lb:function(){},Wi:function(){return!1},mb:function(){return this.Jb},wa:function(){return this.Sf},ke:function(a,b,e,d){var c,f,h,l;c=a.x;f=a.y;a=a.z;h=b.x;l=b.y;b=b.z;c-=e.v;f-=e.A;a-=e.B;h-=e.v;l-=e.A;b-=e.B;if(this.Wi(e.o*c+e.i*f+e.l*a,e.f*c+e.m*f+e.g*a,e.h*c+e.j*f+e.s*a,e.o*h+e.i*l+e.l*b,e.f*h+e.m*l+e.g*b,e.h*h+e.j*l+e.s*b,d)){var g,k;b=d.position;c=b.x;f=b.y;h=b.z;b=d.normal;l=b.x;g=b.y;k=b.z;var m,p;m=e.o*c+e.f*f+e.h*h;p=e.i*c+e.m*f+e.j*h;h=e.l*c+e.g*f+e.s*h;b=e.o*l+e.f*g+e.h*k;a=e.i*l+e.m*g+e.j*k;l=e.l*l+e.g*g+e.s*k;c=m+e.v;f=p+e.A;h+=e.B;e=d.position;e.x=c;e.y=f;e.z=h;d=d.normal;d.x=b;d.y=a;d.z=l;return!0}return!1}};Qa.wa=wc;Qa.prototype=gb(wc.prototype,{Xn:function(){return this.Rb},Go:function(a){0>a&&(a=0);this.Rb=a},he:function(){},ke:function(a,b,e,d){return this.rm?lb.mb.ke(this,e,a,b,d):wc.prototype.ke.call(this,a,b,e,d)}});jj.wa=Qa;jj.prototype=gb(Qa.prototype,{Aa:function(a,b,e){this.Kn=a;var d,c,f;d=e.x;c=e.y;f=e.z;var h;e=b.o*d+b.i*c+b.l*f;h=b.f*d+b.m*c+b.g*f;b=b.h*d+b.j*c+b.s*f;d=this.Xl=new n;d.x=e;d.y=h;d.z=b;this.Rb=a.Rb},he:function(a,b){this.Kn.he(a,b);var e=this.Xl;0e.J&&a.Ke.K&&a.Le.L){var c=this.Eh;null!=c?(this.Eh=c.M,c.M=null):c=new ve;null!=this.pe&&(c.M=this.pe);this.pe=c;c.Ch=a;c.Dh=e}e=d}a=b}},ke:function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;for(var l=this.Oe;null!=l;){var g=l.M,k=d,m=c,p=a,r=f,q=h,t=b,A=l.J,L=l.K,u=l.L,z=l.G,n=l.H,D=l.I;if(A>(k>r?k:r)||z<(k(m>q?m:q)||n<(m(p>t?p:t)||D<(pr?-r:r,y=0>q?-q:q,B=0>Ib?-Ib:Ib,E=.5*(z-A),K=.5*(n-L),H=.5*(D-u),k=k-.5*(z+A),m=m-.5*(n+L),p=p-.5*(D+u),u=m*Ib-p*q;0<(0>u?-u:u)-(K*B+H*y)?p=!0:(p=p*r-k*Ib,p=0<(0>p?-p:p)-(H*t+E*B));p?r=!0:(r=k*q-m*r,r=0<(0>r?-r:r)-(E*y+K*t));r=r?!1:!0}r&&e.process(l);l=g}},Vf:function(a,b,e,d){for(var c=this.Oe;null!=c;){var f=c.M,h=this.u.min;h.x=c.J;h.y=c.K;h.z=c.L;h=this.u.max;h.x=c.G;h.y=c.H;h.z=c.I;this.mk.Aa(a,b,e);h=lb.mb;0==h.Nj(this.mk,this.u,b,this.rg,null,!1)&&0>=h.distance&&d.process(c);c=f}},Ih:function(a,b){for(var e=this.Oe;null!=e;){var d=e.M;a.nae.J&&a.oae.K&&a.pae.L&&b.process(e);e=d}}});Kb.wa=ub;Kb.prototype=gb(ub.prototype,{Kh:function(a,b){this.Dj++;var e=0==a.P,d=0==b.P;a==b?e||(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):a.Jb.J&&a.Kb.K&&a.Lb.L&&(e&&d?(e=this.Eh,null!=e?(this.Eh=e.M,e.M=null):e=new ve,null!=this.pe&&(e.M=this.pe),this.pe=e,e.Ch=a.ub,e.Dh=b.ub):d||a.P>b.P?(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):(this.Kh(b.F[0],a),this.Kh(b.F[1],a)))},am:function(a,b,e,d,c,f,h,l){var g=a.J,k=a.K,m=a.L,p=a.G,r=a.H,q=a.I,t;if(g>(b>c?b:c)||p<(b(e>f?e:f)||r<(e(d>h?d:h)||q<(dA?-A:A;var z=0>L?-L:L,n=0>u?-u:u,D=.5*(p-g),Ib=.5*(r-k),y=.5*(q-m),g=b-.5*(p+g),k=e-.5*(r+k),m=d-.5*(q+m),q=k*u-m*L;0<(0>q?-q:q)-(Ib*n+y*z)?n=!0:(u=m*A-g*u,n=0<(0>u?-u:u)-(y*t+D*n));n?t=!0:(A=g*L-k*A,t=0<(0>A?-A:A)-(D*z+Ib*t));t=t?!1:!0}t&&(0==a.P?l.process(a.ub):(this.am(a.F[0],b,e,d,c,f,h,l),this.am(a.F[1],b,e,d,c,f,h,l)))},El:function(a,b,e,d,c){var f=this.u.min;f.x=a.J;f.y=a.K;f.z=a.L;f=this.u.max;f.x=a.G;f.y=a.H;f.z=a.I;this.mk.Aa(b,e,d);f=lb.mb;0==f.Nj(this.mk,this.u,e,this.rg,null,!1)&&0>=f.distance&&(0==a.P?c.process(a.ub):(this.El(a.F[0],b,e,d,c),this.El(a.F[1],b,e,d,c)))},yl:function(a,b,e){a.Jb.na&&a.Kb.oa&&a.Lb.pa&&(0==a.P?e.process(a.ub):(this.yl(a.F[0],b,e),this.yl(a.F[1],b,e)))},ni:function(a,b){a=new Wi(a,this.lm++);this.Vi++;null==this.Oe?this.Oe=a:(this.gf.M=a,a.ia=this.gf);this.gf=a;a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;b=this.ye;var e=b.qd;null!=e?(b.qd=e.M,e.M=null):e=new oi;var d=e;d.ub=a;a.ei=d;d.J=a.J;d.K=a.K;d.L=a.L;d.G=a.G;d.H=a.H;d.I=a.I;b.yk++;null==b.zg?b.zg=d:(b.qf.ng=d,d.og=b.qf);b.qf=d;if(null==b.Nb)b.Nb=d;else{for(var c=b.Nb;0e.P)){var d=e.Ea,f=e.F[0],h=e.F[1],l=f.P-h.P,c=e.Ja;1l.P?(f.F[1]=e,e.Ea=f,e.Ja=1,e.F[0]=l,l.Ea=e,l.Ja=0):(f.F[0]=e,e.Ea=f,e.Ja=0,e.F[0]=h,h.Ea=e,h.Ja=0),h=f.F[0],l=f.F[1],f.J=h.Jl.G?h.G:l.G,f.H=h.H>l.H?h.H:l.H,f.I=h.I>l.I?h.I:l.I,h=f.F[0].P,l=f.F[1].P,f.P=(h>l?h:l)+1,h=e.F[0],l=e.F[1],e.J=h.Jl.G?h.G:l.G,e.H=h.H>l.H?h.H:l.H,e.I=h.I>l.I?h.I:l.I,h=e.F[0].P,l=e.F[1].P,e.P=(h>l?h:l)+1,null!=d?(d.F[c]=f,f.Ea=d,f.Ja=c):(b.Nb=f,f.Ea=null),e=f):-1>l&&(f=h.F[0],l=h.F[1],f.P>l.P?(h.F[1]=e,e.Ea=h,e.Ja=1,e.F[1]=l,l.Ea=e,l.Ja=1):(h.F[0]=e,e.Ea=h,e.Ja=0,e.F[1]=f,f.Ea=e,f.Ja=1),f=h.F[0],l=h.F[1],h.J=f.Jl.G?f.G:l.G,h.H=f.H>l.H?f.H:l.H,h.I=f.I>l.I?f.I:l.I,f=h.F[0].P,l=h.F[1].P,h.P=(f>l?f:l)+1,f=e.F[0],l=e.F[1],e.J=f.Jl.G?f.G:l.G,e.H=f.H>l.H?f.H:l.H,e.I=f.I>l.I?f.I:l.I,f=e.F[0].P,l=e.F[1].P,e.P=(f>l?f:l)+1,null!=d?(d.F[c]=h,h.Ea=d,h.Ja=c):(b.Nb=h,h.Ea=null),e=h)}d=e.F[0].P;c=e.F[1].P;e.P=(d>c?d:c)+1;d=e.F[0];c=e.F[1];e.J=d.Jc.G?d.G:c.G;e.H=d.H>c.H?d.H:c.H;e.I=d.I>c.I?d.I:c.I;e=e.Ea}}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){b=Array(this.$f<<1);e=0;for(d=this.$f;ed.P)){var c=d.Ea,h=d.F[0],l=d.F[1],g=h.P-l.P,f=d.Ja;1g.P?(h.F[1]=d,d.Ea=h,d.Ja=1,d.F[0]=g,g.Ea=d,g.Ja=0):(h.F[0]=d,d.Ea=h,d.Ja=0,d.F[0]=l,l.Ea=d,l.Ja=0),l=h.F[0],g=h.F[1],h.J=l.Jg.G?l.G:g.G,h.H=l.H>g.H?l.H:g.H,h.I=l.I>g.I?l.I:g.I,l=h.F[0].P,g=h.F[1].P,h.P=(l>g?l:g)+1,l=d.F[0],g=d.F[1],d.J=l.Jg.G?l.G:g.G,d.H=l.H>g.H?l.H:g.H,d.I=l.I>g.I?l.I:g.I,l=d.F[0].P,g=d.F[1].P,d.P=(l>g?l:g)+1,null!=c?(c.F[f]=h,h.Ea=c,h.Ja=f):(b.Nb=h,h.Ea=null),d=h):-1>g&&(h=l.F[0],g=l.F[1],h.P>g.P?(l.F[1]=d,d.Ea=l,d.Ja=1,d.F[1]=g,g.Ea=d,g.Ja=1):(l.F[0]=d,d.Ea=l,d.Ja=0,d.F[1]=h,h.Ea=d,h.Ja=1),h=l.F[0],g=l.F[1],l.J=h.Jg.G?h.G:g.G,l.H=h.H>g.H?h.H:g.H,l.I=h.I>g.I?h.I:g.I,h=l.F[0].P,g=l.F[1].P,l.P=(h>g?h:g)+1,h=d.F[0],g=d.F[1],d.J=h.Jg.G?h.G:g.G,d.H=h.H>g.H?h.H:g.H,d.I=h.I>g.I?h.I:g.I,h=d.F[0].P,g=d.F[1].P,d.P=(h>g?h:g)+1,null!=c?(c.F[f]=l,l.Ea=c,l.Ja=f):(b.Nb=l,l.Ea=null),d=l)}c=d.F[0].P;f=d.F[1].P;d.P=(c>f?c:f)+1;c=d.F[0];f=d.F[1];d.J=c.Jf.G?c.G:f.G;d.H=c.H>f.H?c.H:f.H;d.I=c.I>f.I?c.I:f.I;d=d.Ea}}}a.ei=null;e.F[0]=null;e.F[1]=null;e.Ja=0;e.Ea=null;e.P=0;e.ub=null;e.M=b.qd;b.qd=e;a.userData=null;a.M=null;a.ia=null;a.zh&&(a.zh=!1)},Qd:function(a,b,e){if(!(a.J<=b.na&&a.G>=b.ka&&a.K<=b.oa&&a.H>=b.la&&a.L<=b.pa&&a.I>=b.ma)){a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;if(null!=e){var d;b=e.x;d=e.y;e=e.z;a.J+=0b?0:b;a.H+=0>d?0:d;a.I+=0>e?0:e}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){e=Array(this.$f<<1);b=0;for(d=this.$f;bthis.Vi)){for(var b=this.$f/this.Vit.P)){var A=t.Ea,L=t.F[0],u=t.F[1],z=L.P-u.P,n=t.Ja;if(1Ib.P){L.F[1]=t;t.Ea=L;t.Ja=1;t.F[0]=Ib;Ib.Ea=t;Ib.Ja=0;var y=L.F[0],B=L.F[1];L.J=y.JB.G?y.G:B.G;L.H=y.H>B.H?y.H:B.H;L.I=y.I>B.I?y.I:B.I;var E=L.F[0].P,K=L.F[1].P;L.P=(E>K?E:K)+1;var H=t.F[0],mc=t.F[1];t.J=H.Jmc.G?H.G:mc.G;t.H=H.H>mc.H?H.H:mc.H;t.I=H.I>mc.I?H.I:mc.I;var R=t.F[0].P,x=t.F[1].P;t.P=(R>x?R:x)+1}else{L.F[0]=t;t.Ea=L;t.Ja=0;t.F[0]=D;D.Ea=t;D.Ja=0;var X=L.F[0],dd=L.F[1];L.J=X.Jdd.G?X.G:dd.G;L.H=X.H>dd.H?X.H:dd.H;L.I=X.I>dd.I?X.I:dd.I;var Da=L.F[0].P,qa=L.F[1].P;L.P=(Da>qa?Da:qa)+1;var Ub=t.F[0],ya=t.F[1];t.J=Ub.Jya.G?Ub.G:ya.G;t.H=Ub.H>ya.H?Ub.H:ya.H;t.I=Ub.I>ya.I?Ub.I:ya.I;var Jj=t.F[0].P,Ea=t.F[1].P;t.P=(Jj>Ea?Jj:Ea)+1}null!=A?(A.F[n]=L,L.Ea=A,L.Ja=n):(h.Nb=L,L.Ea=null);t=L}else if(-1>z){var O=u.F[0],sa=u.F[1];if(O.P>sa.P){u.F[1]=t;t.Ea=u;t.Ja=1;t.F[1]=sa;sa.Ea=t;sa.Ja=1;var ba=u.F[0],za=u.F[1];u.J=ba.Jza.G?ba.G:za.G;u.H=ba.H>za.H?ba.H:za.H;u.I=ba.I>za.I?ba.I:za.I;var Ta=u.F[0].P,C=u.F[1].P;u.P=(Ta>C?Ta:C)+1;var Aa=t.F[0],na=t.F[1];t.J=Aa.Jna.G?Aa.G:na.G;t.H=Aa.H>na.H?Aa.H:na.H;t.I=Aa.I>na.I?Aa.I:na.I;var La=t.F[0].P,Ba=t.F[1].P;t.P=(La>Ba?La:Ba)+1}else{u.F[0]=t;t.Ea=u;t.Ja=0;t.F[1]=O;O.Ea=t;O.Ja=1;var ta=u.F[0],S=u.F[1];u.J=ta.JS.G?ta.G:S.G;u.H=ta.H>S.H?ta.H:S.H;u.I=ta.I>S.I?ta.I:S.I;var ha=u.F[0].P,ea=u.F[1].P;u.P=(ha>ea?ha:ea)+1;var da=t.F[0],M=t.F[1];t.J=da.JM.G?da.G:M.G;t.H=da.H>M.H?da.H:M.H;t.I=da.I>M.I?da.I:M.I;var T=t.F[0].P,w=t.F[1].P;t.P=(T>w?T:w)+1}null!=A?(A.F[n]=u,u.Ea=A,u.Ja=n):(h.Nb=u,u.Ea=null);t=u}}var V=t.F[0].P,ia=t.F[1].P;t.P=(V>ia?V:ia)+1;var Y=t.F[0],oa=t.F[1];t.J=Y.Joa.G?Y.G:oa.G;t.H=Y.H>oa.H?Y.H:oa.H;t.I=Y.I>oa.I?Y.I:oa.I;t=t.Ea}}}f.ei=null;l.M=null;l.Ja=0;l.F[0]=null;l.F[1]=null;l.Ja=0;l.Ea=null;l.P=0;l.ub=null;l.M=h.qd;h.qd=l;var ua=this.ye,ca=ua.qd;null!=ca?(ua.qd=ca.M,ca.M=null):ca=new oi;var Ma=ca;Ma.ub=f;f.ei=Ma;Ma.J=f.J;Ma.K=f.K;Ma.L=f.L;Ma.G=f.G;Ma.H=f.H;Ma.I=f.I;ua.yk++;null==ua.zg?ua.zg=Ma:(ua.qf.ng=Ma,Ma.og=ua.qf);ua.qf=Ma;if(null==ua.Nb)ua.Nb=Ma;else{for(var va=ua.Nb;0Q.P)){var ja=Q.Ea,Ga=Q.F[0],P=Q.F[1],Ya=Ga.P-P.P,N=Q.Ja;if(1J.P){Ga.F[1]=Q;Q.Ea=Ga;Q.Ja=1;Q.F[0]=J;J.Ea=Q;J.Ja=0;var Vb=Ga.F[0],Ab=Ga.F[1];Ga.J=Vb.JAb.G?Vb.G:Ab.G;Ga.H=Vb.H>Ab.H?Vb.H:Ab.H;Ga.I=Vb.I>Ab.I?Vb.I:Ab.I;var ib=Ga.F[0].P,hb=Ga.F[1].P;Ga.P=(ib>hb?ib:hb)+1;var ka=Q.F[0],Ia=Q.F[1];Q.J=ka.JIa.G?ka.G:Ia.G;Q.H=ka.H>Ia.H?ka.H:Ia.H;Q.I=ka.I>Ia.I?ka.I:Ia.I;var ab=Q.F[0].P,bb=Q.F[1].P;Q.P=(ab>bb?ab:bb)+1}else{Ga.F[0]=Q;Q.Ea=Ga;Q.Ja=0;Q.F[0]=wb;wb.Ea=Q;wb.Ja=0;var Wa=Ga.F[0],Va=Ga.F[1];Ga.J=Wa.JVa.G?Wa.G:Va.G;Ga.H=Wa.H>Va.H?Wa.H:Va.H;Ga.I=Wa.I>Va.I?Wa.I:Va.I;var qb=Ga.F[0].P,kb=Ga.F[1].P;Ga.P=(qb>kb?qb:kb)+1;var Sa=Q.F[0],Na=Q.F[1];Q.J=Sa.JNa.G?Sa.G:Na.G;Q.H=Sa.H>Na.H?Sa.H:Na.H;Q.I=Sa.I>Na.I?Sa.I:Na.I;var Za=Q.F[0].P,vb=Q.F[1].P;Q.P=(Za>vb?Za:vb)+1}null!=ja?(ja.F[N]=Ga,Ga.Ea=ja,Ga.Ja=N):(ua.Nb=Ga,Ga.Ea=null);Q=Ga}else if(-1>Ya){var mb=P.F[0],xb=P.F[1];if(mb.P>xb.P){P.F[1]=Q;Q.Ea=P;Q.Ja=1;Q.F[1]=xb;xb.Ea=Q;xb.Ja=1;var nb=P.F[0],fb=P.F[1];P.J=nb.Jfb.G?nb.G:fb.G;P.H=nb.H>fb.H?nb.H:fb.H;P.I=nb.I>fb.I?nb.I:fb.I;var Re=P.F[0].P,Db=P.F[1].P;P.P=(Re>Db?Re:Db)+1;var G=Q.F[0],sb=Q.F[1];Q.J=G.Jsb.G?G.G:sb.G;Q.H=G.H>sb.H?G.H:sb.H;Q.I=G.I>sb.I?G.I:sb.I;var jb=Q.F[0].P,Xb=Q.F[1].P;Q.P=(jb>Xb?jb:Xb)+1}else{P.F[0]=Q;Q.Ea=P;Q.Ja=0;Q.F[1]=mb;mb.Ea=Q;mb.Ja=1;var ob=P.F[0],cb=P.F[1];P.J=ob.Jcb.G?ob.G:cb.G;P.H=ob.H>cb.H?ob.H:cb.H;P.I=ob.I>cb.I?ob.I:cb.I;var zb=P.F[0].P,Xa=P.F[1].P;P.P=(zb>Xa?zb:Xa)+1;var tb=Q.F[0],v=Q.F[1];Q.J=tb.Jv.G?tb.G:v.G;Q.H=tb.H>v.H?tb.H:v.H;Q.I=tb.I>v.I?tb.I:v.I;var W=Q.F[0].P,U=Q.F[1].P;Q.P=(W>U?W:U)+1}null!=ja?(ja.F[N]=P,P.Ea=ja,P.Ja=N):(ua.Nb=P,P.Ea=null);Q=P}}var db=Q.F[0].P,cc=Q.F[1].P;Q.P=(db>cc?db:cc)+1;var Ra=Q.F[0],Ha=Q.F[1];Q.J=Ra.JHa.G?Ra.G:Ha.G;Q.H=Ra.H>Ha.H?Ra.H:Ha.H;Q.I=Ra.I>Ha.I?Ra.I:Ha.I;Q=Q.Ea}}b&&this.Kh(this.ye.Nb,f.ei);f.zh=!1}this.rf[c]=null}b||this.Kh(this.ye.Nb,this.ye.Nb);this.$f=0}},ke:function(a,b,e){null!=this.ye.Nb&&this.am(this.ye.Nb,a.x,a.y,a.z,b.x,b.y,b.z,e)},Vf:function(a,b,e,d){null!=this.ye.Nb&&this.El(this.ye.Nb,a,b,e,d)},Ih:function(a,b){null!=this.ye.Nb&&this.yl(this.ye.Nb,a,b)},so:function(){return this.ye.An()}});Wi.wa=Qc;Wi.prototype=gb(Qc.prototype,{});Hj.prototype={jm:function(a,b){switch(this.mm){case 0:var e,d,c;e=b.J+b.G;d=b.K+b.H;c=b.L+b.I;var f=a.F[0];a=a.F[1];var h,l,g;h=f.J+f.G;b=f.K+f.H;f=f.L+f.I;l=a.J+a.G;g=a.K+a.H;a=a.L+a.I;h-=e;b-=d;f-=c;l-=e;g-=d;a-=c;return h*h+b*b+f*fb.G?a.G:b.G;r=a.H>b.H?a.H:b.H;g=a.I>b.I?a.I:b.I;c=r-p;l=g-l;e=2*((d-e)*(c+l)+c*l);c=2*e;a=2*(e-2*((a.G-a.J)*(k+m)+k*m));e=f.Jb.G?f.G:b.G;r=f.H>b.H?f.H:b.H;g=f.I>b.I?f.I:b.I;0==f.P?(f=r-p,l=g-l,f=a+2*((d-e)*(f+l)+f*l)):(k=r-p,l=g-l,g=f.H-f.K,m=f.I-f.L,f=a+(2*((d-e)*(k+l)+k*l)-2*((f.G-f.J)*(g+m)+g*m)));e=h.Jb.G?h.G:b.G;r=h.H>b.H?h.H:b.H;g=h.I>b.I?h.I:b.I;0==h.P?(h=r-p,b=g-l,e=a+2*((d-e)*(h+b)+h*b)):(b=r-p,l=g-l,g=h.H-h.K,k=h.I-h.L,e=a+(2*((d-e)*(b+l)+b*l)-2*((h.G-h.J)*(g+k)+g*k)));return cb&&(b=-b);return b+this.Hl(a.F[0])+this.Hl(a.F[1])}};eb.prototype={Aa:function(a,b){this.na=a.x;this.oa=a.y;this.pa=a.z;this.ka=b.x;this.la=b.y;this.ma=b.z;return this},Uc:function(){var a=new n;a.x=this.na;a.y=this.oa;a.z=this.pa;return a},Vc:function(a){a.x=this.na;a.y=this.oa;a.z=this.pa},ie:function(a){this.na=a.x;this.oa=a.y;this.pa=a.z;return this},Dc:function(){var a=new n;a.x=this.ka;a.y=this.la;a.z=this.ma;return a},Hc:function(a){a.x=this.ka;a.y=this.la;a.z=this.ma},vd:function(a){this.ka=a.x;this.la=a.y;this.ma=a.z;return this},Cb:function(){var a=new n,b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},Kb:function(a){var b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d},kc:function(){var a=new n,b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},lc:function(a){var b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d},wa:function(a){this.na=this.naa.ka?this.ka:a.ka;this.la=this.la>a.la?this.la:a.la;this.ma=this.ma>a.ma?this.ma:a.ma;return this},mb:function(a){var b=new eb;b.na=this.naa.ka?this.ka:a.ka;b.la=this.la>a.la?this.la:a.la;b.ma=this.ma>a.ma?this.ma:a.ma;return b},Wc:function(a){return this.naa.na&&this.oaa.oa&&this.paa.pa:!1},wc:function(a){var b=new eb;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaa.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaf?-f:f)+(0>l?-l:l)+(0>k?-k:k);h=(0>h?-h:h)+(0>g?-g:g)+(0>m?-m:m);e=(0>e?-e:e)+(0>d?-d:d)+(0>c?-c:c);a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-e;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+e},he:function(a,b){var e,d,c;c=d=e=this.Rb;e=ed){if(a<=-l||a>=l)return!1}else{var L=1/d,u=(-l-a)*L,l=(l-a)*L;u>l&&(L=u,u=l,l=L);0l&&(q=l)}if(-1E-6c){if(b<=-g||b>=g)return!1}else u=1/c,l=(-g-b)*u,g=(g-b)*u,l>g&&(u=l,l=g,g=u),0g&&(t=g);if(-1E-6f){if(e<=-k||e>=k)return!1}else l=1/f,g=(-k-e)*l,k=(k-e)*l,g>k&&(l=g,g=k,k=l),0k&&(A=k);if(1<=m||1<=p||1<=r||0>=q||0>=t||0>=A)return!1;k=m;m=0;p>k&&(k=p,m=1);r>k&&(k=r,m=2);tq||!k)return!1;switch(m){case 0:h.normal.Aa(0f?-f:f)*this.Db;h=(0>h?-h:h)*this.Db;l=(0>l?-l:l)*this.Db;e+=f;d+=h;c+=l;a.na=b.v-e;a.oa=b.A-d;a.pa=b.B-c;a.ka=b.v+e;a.la=b.A+d;a.ma=b.B+c},he:function(a,b){0q)return!1;if(0=(-r+q)/p)return!1}else{if(0<=m)return!1;m=0}p=b+(c-b)*m;if(p>-l&&pp?-l:l;t=a-0;l=b-g;k=e-0;a=d-a;b=c-b;e=f-e;p=a*a+b*b+e*e;r=t*a+l*b+k*e;m=t*t+l*l+k*k-this.ab*this.ab;q=r*r-p*m;if(0>q)return!1;f=(-r-Math.sqrt(q))/p;if(0>f||1p?g:p;h=k>r?k:r;f=m>q?m:q;g=ge?l:e);a.la=b.A+(h>d?h:d);a.ma=b.B+(f>c?f:c)},he:function(a,b){var e=a.x,d=a.y,c=a.z;0this.Mk*this.Mk*(e*e+d*d+c*c)?(b.Aa(0,this.Db-this.Rb/this.Mk,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,d=e*e+a*a,c=2*this.Db,c=(c-this.Rb)/c*this.ab-this.Rb/this.Dk,0>c&&(c=0),d=0c&&(c=0),b.x=e*d,b.y=-c,b.z=a*d)},Wi:function(a,b,e,d,c,f,h){var l=this.Db;d-=a;c-=b;f-=e;var g=0,k=1;if(-1E-6c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,m=(l-b)*m;if(p>m)var r=p,p=m,m=r;0m&&(k=m)}if(1<=g||0>=k)return!1;b-=l;var r=this.Dk*this.Dk,m=r*(d*d+c*c+f*f)-c*c,p=r*(a*d+b*c+e*f)-b*c,r=r*(a*a+b*b+e*e)-b*b,q=p*p-m*r;if(m){if(0>q)return!1;q=Math.sqrt(q);if(0>m)if(0=p)return!1}else{if(r=(-p-q)/m,p=1,1<=r)return!1}else if(r=(-p-q)/m,p=(-p+q)/m,1<=r||0>=p)return!1}else if(m=-r/(2*p),0=m)return!1}else if(r=m,p=1,1<=m)return!1;b+=l;if(p<=g||k<=r)return!1;if(rd&&(d=k);mc&&(c=m);gf&&(f=g)}h=d-a;l=c-b;k=f-e;this.Sf=h*l*k;a=.25*((a+d)*(a+d)+(b+c)*(b+c)+(e+f)*(e+f));h=h*h*.25;l=l*l*.25;k=k*k*.25;this.Dg=.3333333333333333*(l+k)+a;this.Gg=this.Fg=this.Eg=0;this.Hg=.3333333333333333*(k+h)+a;this.Kg=this.Jg=this.Ig=0;this.Lg=.3333333333333333*(h+l)+a},Lb:function(a,b){var e,d,c,f,h,l,g,k,m;m=k=g=this.Rb;var p,r,q;e=this.Ca[0];p=e.x;r=e.y;q=e.z;d=b.o*p+b.f*r+b.h*q;e=b.i*p+b.m*r+b.j*q;c=b.l*p+b.g*r+b.s*q;p=d+b.v;r=e+b.A;q=c+b.B;e=p;d=r;c=q;f=p;h=r;l=q;for(var t=1,A=this.We;tp?f:p;h=h>r?h:r;l=l>q?l:q}a.na=e-g;a.oa=d-k;a.pa=c-m;a.ka=f+g;a.la=h+k;a.ma=l+m},he:function(a,b){for(var e=this.Ca[0],e=e.x*a.x+e.y*a.y+e.z*a.z,d=0,c=1,f=this.We;ce&&(e=l,d=h)}a=this.Ca[d];b.x=a.x;b.y=a.y;b.z=a.z}});Qd.wa=Qa;Qd.prototype=gb(Qa.prototype,{pi:function(){return this.ab},Pj:function(){return this.Db},Xe:function(){var a=this.ab*this.ab,b=this.Db*this.Db*4;this.Sf=3.14159265358979*a*this.Db*2;this.Dg=.08333333333333333*(3*a+b);this.Gg=this.Fg=this.Eg=0;this.Hg=.5*a;this.Kg=this.Jg=this.Ig=0;this.Lg=.08333333333333333*(3*a+b)},Lb:function(a,b){var e,d,c,f,h,l;e=b.f;d=b.m;c=b.g;e=0>e?-e:e;d=0>d?-d:d;c=0>c?-c:c;f=Math.sqrt(1-e*e);h=Math.sqrt(1-d*d);l=Math.sqrt(1-c*c);f*=this.ab;h*=this.ab;l*=this.ab;e*=this.Db;d*=this.Db;c*=this.Db;f+=e;h+=d;l+=c;a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-l;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+l},he:function(a,b){var e=a.x,d=a.z,c=e*e+d*d,f=this.ab-this.Rb;0>f&&(f=0);c=0f&&(f=0);b.x=e*c;b.y=0c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,l=(l-b)*m;p>l&&(m=p,p=l,l=m);0l&&(k=l)}if(1<=g||0>=k)return!1;var l=d*d+f*f,p=a*d+e*f,m=a*a+e*e-this.ab*this.ab,r=p*p-l*m;if(0>r)return!1;if(0=l)return!1}else{if(0<=m)return!1;m=0;l=1}if(l<=g||k<=m)return!1;if(mk)return!1;f=(-g-Math.sqrt(k))/f;if(0>f||1a&&(a=this.points[d].depth)}return a},clear:function(){for(var a=this.numPoints=0,b=this.points;aPa&&(Pa=-Pa);0>Fa&&(Fa=-Fa);0>Q&&(Q=-Q);var aa=Pa+Fa+Q,fa=L*q+u*t+z*A,N=Z+aa,ja=0>fa,Ga=ja?-fa:fa;if(GaP&&(Y=P,oa=0,ca=L,Ma=u,va=z,ua=ja?-1:1);var Z=ya,Ya=n*S+D*ha+Ib*ea,J=n*da+D*M+Ib*T,wb=n*w+D*V+Ib*ia;0>Ya&&(Ya=-Ya);0>J&&(J=-J);0>wb&&(wb=-wb);var aa=Ya+J+wb,fa=n*q+D*t+Ib*A,ec=Z+aa,Vb=0>fa,Ab=Vb?-fa:fa;if(Abhb&&(hb=-hb);0>ka&&(ka=-ka);0>Ia&&(Ia=-Ia);var aa=hb+ka+Ia,fa=y*q+B*t+E*A,ab=Z+aa,bb=0>fa,Wa=bb?-fa:fa;if(WaF.linearSlop?Y-F.linearSlop:0,qb=K*ba+H*za+mc*Ta,kb=K*C+H*Aa+mc*na,Sa=K*La+H*Ba+mc*ta;0>qb&&(qb=-qb);0>kb&&(kb=-kb);0>Sa&&(Sa=-Sa);var Z=qb+kb+Sa,aa=Ea,fa=K*q+H*t+mc*A,Na=Z+aa,Za=0>fa,vb=Za?-fa:fa;if(vbxb&&(xb=-xb);0>nb&&(nb=-nb);0>fb&&(fb=-fb);var Z=xb+nb+fb,aa=O,fa=R*q+x*t+X*A,Re=Z+aa,Db=0>fa,G=Db?-fa:fa;if(Gjb&&(jb=-jb);0>Xb&&(Xb=-Xb);0>ob&&(ob=-ob);var Z=jb+Xb+ob,aa=sa,fa=dd*q+Da*t+qa*A,cb=Z+aa,zb=0>fa,Xa=zb?-fa:fa;if(XaF.linearSlop?Y-F.linearSlop:0,v,W,U;v=u*mc-z*H;W=z*K-L*mc;U=L*H-u*K;if(v||W||U){var db=v*v+W*W+U*U;0cc&&(cc=-cc);0>Ra&&(Ra=-Ra);var Z=cc+Ra,Ha=v*da+W*M+U*T,rb=v*w+W*V+U*ia;0>Ha&&(Ha=-Ha);0>rb&&(rb=-rb);var aa=Ha+rb,fa=v*q+W*t+U*A,yb=Z+aa,Cb=0>fa,la=Cb?-fa:fa;if(lama&&(ma=-ma);0>Ja&&(Ja=-Ja);var Z=ma+Ja,$a=v*S+W*ha+U*ea,Oa=v*w+W*V+U*ia;0>$a&&($a=-$a);0>Oa&&(Oa=-Oa);var aa=$a+Oa,fa=v*q+W*t+U*A,nc=Z+aa,xa=0>fa,Fc=xa?-fa:fa;if(Fcoj&&(oj=-oj);0>pa&&(pa=-pa);var Z=oj+pa,Ca=v*S+W*ha+U*ea,xd=v*da+W*M+U*T;0>Ca&&(Ca=-Ca);0>xd&&(xd=-xd);var aa=Ca+xd,fa=v*q+W*t+U*A,Kj=Z+aa,Ka=0>fa,de=Ka?-fa:fa;if(deoc&&(oc=-oc);0>Id&&(Id=-Id);var Z=oc+Id,$d=v*da+W*M+U*T,rc=v*w+W*V+U*ia;0>$d&&($d=-$d);0>rc&&(rc=-rc);var aa=$d+rc,fa=v*q+W*t+U*A,Jc=Z+aa,Ua=0>fa,eb=Ua?-fa:fa;if(ebuc&&(uc=-uc);0>gc&&(gc=-gc);var Z=uc+gc,Xc=v*S+W*ha+U*ea,Eb=v*w+W*V+U*ia;0>Xc&&(Xc=-Xc);0>Eb&&(Eb=-Eb);var aa=Xc+Eb,fa=v*q+W*t+U*A,Ng=Z+aa,qi=0>fa,gb=qi?-fa:fa;if(gbic&&(ic=-ic);0>Og&&(Og=-Og);var Z=ic+Og,pb=v*S+W*ha+U*ea,Bb=v*da+W*M+U*T;0>pb&&(pb=-pb);0>Bb&&(Bb=-Bb);var aa=pb+Bb,fa=v*q+W*t+U*A,Pg=Z+aa,sc=0>fa,Jd=sc?-fa:fa;if(JdZg&&(Zg=-Zg);0>vc&&(vc=-vc);var Z=Zg+vc,Fb=v*da+W*M+U*T,ub=v*w+W*V+U*ia;0>Fb&&(Fb=-Fb);0>ub&&(ub=-ub);var aa=Fb+ub,fa=v*q+W*t+U*A,Ob=Z+aa,Mj=0>fa,Qi=Mj?-fa:fa;if(QiHb&&(Hb=-Hb);0>Lb&&(Lb=-Lb);var Z=Hb+Lb,yf=v*S+W*ha+U*ea,Gb=v*w+W*V+U*ia;0>yf&&(yf=-yf);0>Gb&&(Gb=-Gb);var aa=yf+Gb,fa=v*q+W*t+U*A,Nb=Z+aa,Nj=0>fa,ri=Nj?-fa:fa;if(riSb&&(Sb=-Sb);0>fd&&(fd=-fd);var Z=Sb+fd,Rc=v*S+W*ha+U*ea,zc=v*da+W*M+U*T;0>Rc&&(Rc=-Rc);0>zc&&(zc=-zc);var aa=Rc+zc,fa=v*q+W*t+U*A,gd=Z+aa,Yc=0>fa,od=Yc?-fa:fa;if(odua){ke=-ke;le=-le;me=-me;Cd=-Cd;Dd=-Dd;hd=-hd;$c=Kd;Sc=ee;ld=Td;Kd=qd;ee=Ud;Td=Ld;qd=$c;Ud=Sc;Ld=ld;var Ue=Md;Md=ne;ne=Ue}ke+=l;le+=g;me+=k;var ad=1,Ed=0,id=Cd*K+Dd*H+hd*mc;id-F.contactPersistenceThreshold&&(bc?this.Wg(a,ge,rd,Vd,Wd,qe,he,wd,fe):this.Wg(a,Wd,qe,he,ge,rd,Vd,wd,fe))}}}}}}}}}});Ej.prototype={clip:function(){for(var a=0,b=this.fd;a=f){var h=this.Gb[this.gc++];h.x=d.x;h.y=d.y;h.Pa=d.Pa;h.Qa=d.Qa;h.Ra=d.Ra;c/=c-f;f=this.Gb[this.gc++];f.x=d.x+(e.x-d.x)*c;f.y=d.y+(e.y-d.y)*c;f.Pa=d.Pa+(e.Pa-d.Pa)*c;f.Qa=d.Qa+(e.Qa-d.Qa)*c;f.Ra=d.Ra+(e.Ra-d.Ra)*c}else 0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0this.fd)){for(var a=-Infinity,b=Infinity,e=-Infinity,d=Infinity,c=null,f=null,h=null,l=null,g=0,k=this.fd;ga&&(a=p,c=m);pe&&(e=r,h=m);rp?0:p>r?1:p/r):p=0,r=p*Ib+n,0>r?(r=0,p=0>k?0:k>D?1:k/D):r>z?(r=1,p=Ib+k,p=0>p?0:p>D?1:p/D):r/=z):(r=0,p=0>k?0:k>D?1:k/D):(p=0,r=0>n?0:n>z?1:n/z):r=p=0;q+=f*p;t+=L*p;A+=c*p;h+=m*r;l+=u*r;d+=g*r;L=q-h;f=t-l;r=A-d;p=L*L+f*f+r*r;p>=(b+e)*(b+e)||(p=Math.sqrt(p),0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},mb:function(a){var b,e,d,c;b=this.o;e=this.m;d=this.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},Dc:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.o=1-g-d;this.f=k-c;this.h=b+h;this.i=k+c;this.m=1-a-d;this.j=e-f;this.l=b-h;this.g=e+f;this.s=1-a-g;return this},clone:function(){var a=new Ua;a.v=this.v;a.A=this.A;a.B=this.B;a.o=this.o;a.f=this.f;a.h=this.h;a.i=this.i;a.m=this.m;a.j=this.j;a.l=this.l;a.g=this.g;a.s=this.s;return a},qe:function(a){this.v=a.v;this.A=a.A;this.B=a.B;this.o=a.o;this.f=a.f;this.h=a.h;this.i=a.i;this.m=a.m;this.j=a.j;this.l=a.l;this.g=a.g;this.s=a.s;return this}};lb.kc=function(){return lb.mb};lb.prototype={Nj:function(a,b,e,d,c,f){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var h=this.La,l=this.eb,g=this.ib,k=this.closest,m=this.dir;null!=c?(null==c.Ji&&(c.Ji=new Dj),this.yo(c.Ji)):m.R();if(!(m.x*m.x+m.y*m.y+m.z*m.z)){var p,r,q;p=d.v-e.v;r=d.A-e.A;q=d.B-e.B;m.x=p;m.y=r;m.z=q;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.Aa(1,0,0)}this.Ba=0;this.Tf(!1);this.Uf(!1);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;for(var u=0;40>u;){var z=0;switch(this.Ba){case 1:var n=h[0];k.x=n.x;k.y=n.y;k.z=n.z;z=1;break;case 2:var D,Ib,y,B,E,K,H=h[0];D=H.x;Ib=H.y;y=H.z;var mc=h[1];B=mc.x;E=mc.y;K=mc.z;var R,x,X;R=B-D;x=E-Ib;X=K-y;var F=R*D+x*Ib+X*y,F=-F/(R*R+x*x+X*X);if(0>F)k.x=D,k.y=Ib,k.z=y,z=1;else if(1O*oa+sa*ua+ba*ca){var P,Ya,Yg,wb,ec,Vb;P=ya.x;Ya=ya.y;Yg=ya.z;wb=N.x;ec=N.y;Vb=N.z;var Ab,ib,hb;Ab=wb-P;ib=ec-Ya;hb=Vb-Yg;var ka=Ab*P+ib*Ya+hb*Yg,ka=-ka/(Ab*Ab+ib*ib+hb*hb),Ia;if(0>ka)k.x=P,k.y=Ya,k.z=Yg,Ia=1;else if(1za*Ma+Ta*va+C*Z){var Va,qb,kb,Sa,Na,Za;Va=N.x;qb=N.y;kb=N.z;Sa=Ea.x;Na=Ea.y;Za=Ea.z;var vb,mb,xb;vb=Sa-Va;mb=Na-qb;xb=Za-kb;var nb=vb*Va+mb*qb+xb*kb,nb=-nb/(vb*vb+mb*mb+xb*xb),fb;if(0>nb)k.x=Va,k.y=qb,k.z=kb,fb=1;else if(1aa||sbAa*Pa+na*Fa+La*Q){var jb,Xb,ob,cb,zb,Xa;jb=ya.x;Xb=ya.y;ob=ya.z;cb=Ea.x;zb=Ea.y;Xa=Ea.z;var tb,v,W;tb=cb-jb;v=zb-Xb;W=Xa-ob;var U=tb*jb+v*Xb+W*ob,U=-U/(tb*tb+v*v+W*W),db;if(0>U)k.x=jb,k.y=Xb,k.z=ob,db=1;else if(1aa||rb(Ja*gc+$a*Xc+Oa*Eb)*Pg){var vc,Jb,Ob,Hb,Lb,Qi,Gb,Qb,Sb,Nb,yf,lb,Rb,Kb,ri,kd,dc,Wb;vc=la.x;Jb=la.y;Ob=la.z;Hb=ra.x;Lb=ra.y;Qi=ra.z;Gb=ga.x;Qb=ga.y;Sb=ga.z;Nb=Hb-vc;yf=Lb-Jb;lb=Qi-Ob;Rb=Gb-Hb;Kb=Qb-Lb;ri=Sb-Qi;kd=vc-Gb;dc=Jb-Qb;Wb=Ob-Sb;var fd,Rc,zc;fd=yf*ri-lb*Kb;Rc=lb*Rb-Nb*ri;zc=Nb*Kb-yf*Rb;var gd,Yc,od,Mb,Tb,pc,Zc,Kc,Lc;gd=yf*zc-lb*Rc;Yc=lb*fd-Nb*zc;od=Nb*Rc-yf*fd;Mb=Kb*zc-ri*Rc;Tb=ri*fd-Rb*zc;pc=Rb*Rc-Kb*fd;Zc=dc*zc-Wb*Rc;Kc=Wb*fd-kd*zc;Lc=kd*Rc-dc*fd;var xc=-1,Cc,Dc,pd,yd=0;pd=Dc=Cc=0;if(0>vc*gd+Jb*Yc+Ob*od){var sd,td,zd,$g,Pb,$b;sd=la.x;td=la.y;zd=la.z;$g=ra.x;Pb=ra.y;$b=ra.z;var ac,bc,kc;ac=$g-sd;bc=Pb-td;kc=$b-zd;var Sd=ac*sd+bc*td+kc*zd,Sd=-Sd/(ac*ac+bc*bc+kc*kc),ie;if(0>Sd)k.x=sd,k.y=td,k.z=zd,ie=1;else if(1Hb*Mb+Lb*Tb+Qi*pc){var tc,qc,Zb,Ge,He,Se;tc=ra.x;qc=ra.y;Zb=ra.z;Ge=ga.x;He=ga.y;Se=ga.z;var Te,Ie,Je;Te=Ge-tc;Ie=He-qc;Je=Se-Zb;var ae=Te*tc+Ie*qc+Je*Zb,ae=-ae/(Te*Te+Ie*Ie+Je*Je),xe;if(0>ae)k.x=tc,k.y=qc,k.z=Zb,xe=1;else if(1xc||QcGb*Zc+Qb*Kc+Sb*Lc){var wc,Ad,Bd,ud,ke,le;wc=la.x;Ad=la.y;Bd=la.z;ud=ga.x;ke=ga.y;le=ga.z;var me,Cd,Dd;me=ud-wc;Cd=ke-Ad;Dd=le-Bd;var hd=me*wc+Cd*Ad+Dd*Bd,hd=-hd/(me*me+Cd*Cd+Dd*Dd),Kd;if(0>hd)k.x=wc,k.y=Ad,k.z=Bd,Kd=1;else if(1xc||Ud(Ja*Ng+$a*qi+Oa*pb)*Pg){var Ue,ad,Ed,id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf;Ue=la.x;ad=la.y;Ed=la.z;id=ga.x;bd=ga.y;cd=ga.z;Vc=ma.x;Mc=ma.y;Nc=ma.z;Ec=id-Ue;yc=bd-ad;Bc=cd-Ed;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ue-Vc;oe=ad-Mc;lf=Ed-Nc;var md,Fd,ed;md=yc*Hc-Bc*Tc;Fd=Bc*Ac-Ec*Hc;ed=Ec*Tc-yc*Ac;var vd,jd,nd,mf,Uc,Pc,ve,we,Ri;vd=yc*ed-Bc*Fd;jd=Bc*md-Ec*ed;nd=Ec*Fd-yc*md;mf=Tc*ed-Hc*Fd;Uc=Hc*md-Ac*ed;Pc=Ac*Fd-Tc*md;ve=oe*ed-lf*Fd;we=lf*md-Oc*ed;Ri=Oc*Fd-oe*md;var fe=-1,pe,ge,rd,Vd=0;rd=ge=pe=0;if(0>Ue*vd+ad*jd+Ed*nd){var wd,Wd,qe,he,zf,sh;wd=la.x;Wd=la.y;qe=la.z;he=ga.x;zf=ga.y;sh=ga.z;var tg,ug,vg;tg=he-wd;ug=zf-Wd;vg=sh-qe;var Ke=tg*wd+ug*Wd+vg*qe,Ke=-Ke/(tg*tg+ug*ug+vg*vg),Ve;if(0>Ke)k.x=wd,k.y=Wd,k.z=qe,Ve=1;else if(1id*mf+bd*Uc+cd*Pc){var Nf,Of,gg,Pf,Qf,Rf;Nf=ga.x;Of=ga.y;gg=ga.z;Pf=ma.x;Qf=ma.y;Rf=ma.z;var Sf,Tf,Af;Sf=Pf-Nf;Tf=Qf-Of;Af=Rf-gg;var ye=Sf*Nf+Tf*Of+Af*gg,ye=-ye/(Sf*Sf+Tf*Tf+Af*Af),nf;if(0>ye)k.x=Nf,k.y=Of,k.z=gg,nf=1;else if(1fe||CeVc*ve+Mc*we+Nc*Ri){var wg,xg,Xd,Nd,Od,yg;wg=la.x;xg=la.y;Xd=la.z;Nd=ma.x;Od=ma.y;yg=ma.z;var zg,Ag,Bg;zg=Nd-wg;Ag=Od-xg;Bg=yg-Xd;var pf=zg*wg+Ag*xg+Bg*Xd,pf=-pf/(zg*zg+Ag*Ag+Bg*Bg),Vf;if(0>pf)k.x=wg,k.y=xg,k.z=Xd,Vf=1;else if(1fe||Wfsc||Cg(Ja*Qa+$a*xf+Oa*ic)*Pg){var Le,Xe,Xf,Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg;Le=la.x;Xe=la.y;Xf=la.z;Yf=ra.x;Zf=ra.y;$f=ra.z;Cf=ma.x;Df=ma.y;Ef=ma.z;Me=Yf-Le;Ff=Zf-Xe;jg=$f-Xf;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Le-Cf;Hf=Xe-Df;kg=Xf-Ef;var be,ce,Pd;be=Ff*Ye-jg*bg;ce=jg*ag-Me*Ye;Pd=Me*bg-Ff*ag;var Yd,Zd,Gd,Oj,Qd,Fe,Wc,Hd,Qg;Yd=Ff*Pd-jg*ce;Zd=jg*be-Me*Pd;Gd=Me*ce-Ff*be;Oj=bg*Pd-Ye*ce;Qd=Ye*be-ag*Pd;Fe=ag*ce-bg*be;Wc=Hf*Pd-kg*ce;Hd=kg*be-Gf*Pd;Qg=Gf*ce-Hf*be;var Ze=-1,rf,cg,re,sf=0;re=cg=rf=0;if(0>Le*Yd+Xe*Zd+Xf*Gd){var ze,Ae,tf,$e,If,Dg;ze=la.x;Ae=la.y;tf=la.z;$e=ra.x;If=ra.y;Dg=ra.z;var Eg,Fg,Gg;Eg=$e-ze;Fg=If-Ae;Gg=Dg-tf;var af=Eg*ze+Fg*Ae+Gg*tf,af=-af/(Eg*Eg+Fg*Fg+Gg*Gg),bf;if(0>af)k.x=ze,k.y=Ae,k.z=tf,bf=1;else if(1Yf*Oj+Zf*Qd+$f*Fe){var kj,lj,mj,th,uh,vh;kj=ra.x;lj=ra.y;mj=ra.z;th=ma.x;uh=ma.y;vh=ma.z;var wh,xh,yh;wh=th-kj;xh=uh-lj;yh=vh-mj;var mg=wh*kj+xh*lj+yh*mj,mg=-mg/(wh*wh+xh*xh+yh*yh),ah;if(0>mg)k.x=kj,k.y=lj,k.z=mj,ah=1;else if(1Ze||gfCf*Wc+Df*Hd+Ef*Qg){var ui,vi,wi,zh,Ah,Bh;ui=la.x;vi=la.y;wi=la.z;zh=ma.x;Ah=ma.y;Bh=ma.z;var Ch,Dh,Eh;Ch=zh-ui;Dh=Ah-vi;Eh=Bh-wi;var ng=Ch*ui+Dh*vi+Eh*wi,ng=-ng/(Ch*Ch+Dh*Dh+Eh*Eh),Rg;if(0>ng)k.x=ui,k.y=vi,k.z=wi,Rg=1;else if(1Ze||hfsc||jf(nc*Og+xa*Bb+Fc*Fb)*Pg){var Hg,Sg,Ai,dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh;Hg=ra.x;Sg=ra.y;Ai=ra.z;dh=ga.x;eh=ga.y;fh=ga.z;Gh=ma.x;Hh=ma.y;Ih=ma.z;gh=dh-Hg;hh=eh-Sg;ih=fh-Ai;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=Hg-Gh;Kh=Sg-Hh;Lh=Ai-Ih;var Ne,Oe,Pe;Ne=hh*Vg-ih*Ug;Oe=ih*Tg-gh*Vg;Pe=gh*Ug-hh*Tg;var cf,df,ef,ue,kf,te,vf,Kf,Lf;cf=hh*Pe-ih*Oe;df=ih*Ne-gh*Pe;ef=gh*Oe-hh*Ne;ue=Ug*Pe-Vg*Oe;kf=Vg*Ne-Tg*Pe;te=Tg*Oe-Ug*Ne;vf=Kh*Pe-Lh*Oe;Kf=Lh*Ne-Jh*Pe;Lf=Jh*Oe-Kh*Ne;var Wg=-1,jh,kh,uf,Ig=0;uf=kh=jh=0;if(0>Hg*cf+Sg*df+Ai*ef){var og,pg,lh,Mh,Nh,Oh;og=ra.x;pg=ra.y;lh=ra.z;Mh=ga.x;Nh=ga.y;Oh=ga.z;var Ph,Qh,Rh;Ph=Mh-og;Qh=Nh-pg;Rh=Oh-lh;var qg=Ph*og+Qh*pg+Rh*lh,qg=-qg/(Ph*Ph+Qh*Qh+Rh*Rh),mh;if(0>qg)k.x=og,k.y=pg,k.z=lh,mh=1;else if(1dh*ue+eh*kf+fh*te){var Ci,Di,Ei,Sh,Th,Uh;Ci=ga.x;Di=ga.y;Ei=ga.z;Sh=ma.x;Th=ma.y;Uh=ma.z;var Vh,Wh,Xh;Vh=Sh-Ci;Wh=Th-Di;Xh=Uh-Ei;var rg=Vh*Ci+Wh*Di+Xh*Ei,rg=-rg/(Vh*Vh+Wh*Wh+Xh*Xh),oh;if(0>rg)k.x=Ci,k.y=Di,k.z=Ei,oh=1;else if(1Wg||seGh*vf+Hh*Kf+Ih*Lf){var Gi,Hi,Ii,Yh,Zh,$h;Gi=ra.x;Hi=ra.y;Ii=ra.z;Yh=ma.x;Zh=ma.y;$h=ma.z;var ai,bi,ci;ai=Yh-Gi;bi=Zh-Hi;ci=$h-Ii;var sg=ai*Gi+bi*Hi+ci*Ii,sg=-sg/(ai*ai+bi*bi+ci*ci),Xg;if(0>sg)k.x=Gi,k.y=Hi,k.z=Ii,Xg=1;else if(1Wg||ffsc||bjk.x*k.x+k.y*k.y+k.z*k.z){if(!f)return this.distance=0;switch(this.Ba){case 1:this.Ao();break;case 2:this.Wl();break;case 3:this.dm()}if(4==this.Ba){var ei=this.Ln(a,b,e,d,h,l,g);if(0!=ei)return this.distance=0,ei;this.distance=-this.depth;return 0}this.distance=0;return 1}this.an(z);m.x=k.x;m.y=k.y;m.z=k.z;m.x=-m.x;m.y=-m.y;m.z=-m.z;this.Tf(!1);this.Uf(!1);var Jf=this.La[this.Ba],cj=this.eb[this.Ba];Jf.x=cj.x;Jf.y=cj.y;Jf.z=cj.z;var Be=this.ib[this.Ba];Jf.x-=Be.x;Jf.y-=Be.y;Jf.z-=Be.z;if(1E-8>m.x*m.x+m.y*m.y+m.z*m.z)throw Error("!?");var rh=h[this.Ba];if(1E-8>rh.x*m.x+rh.y*m.y+rh.z*m.z-(k.x*m.x+k.y*m.y+k.z*m.z))return this.Km(),this.distance=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),null!=c&&null!=c.Ji&&this.Fo(c.Ji),0;this.Ba++;++u}return 2},xm:function(a,b,e,d,c,f,h){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var l=this.La,g=this.closest,k=this.dir,m,p,r;m=d.v-e.v;p=d.A-e.A;r=d.B-e.B;k.x=m;k.y=p;k.z=r;1E-6>k.x*k.x+k.y*k.y+k.z*k.z&&k.Aa(1,0,0);this.Ba=0;if(null!=this.Kj)this.Tf(!0);else{var q=this.eb[this.Ba];q.x=this.oc.v;q.y=this.oc.A;q.z=this.oc.B}this.Uf(!0);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;var u=0,z=0,n=this.Co,D=this.Bo;n.R();D.x=f.x;D.y=f.y;D.z=f.z;D.x-=c.x;D.y-=c.y;for(D.z-=c.z;40>u;){var Ib=0;switch(this.Ba){case 1:var y=l[0];g.x=y.x;g.y=y.y;g.z=y.z;Ib=1;break;case 2:var B,E,K,H,mc,R,x=l[0];B=x.x;E=x.y;K=x.z;var X=l[1];H=X.x;mc=X.y;R=X.z;var F,Da,qa;F=H-B;Da=mc-E;qa=R-K;var I=F*B+Da*E+qa*K,I=-I/(F*F+Da*Da+qa*qa);if(0>I)g.x=B,g.y=E,g.z=K,Ib=1;else if(1za*Ma+J*va+C*Z){var wb,ec,Vb,Ab,ib,hb;wb=O.x;ec=O.y;Vb=O.z;Ab=sa.x;ib=sa.y;hb=sa.z;var ka,Ia,ab;ka=Ab-wb;Ia=ib-ec;ab=hb-Vb;var bb=ka*wb+Ia*ec+ab*Vb,bb=-bb/(ka*ka+Ia*Ia+ab*ab),Wa;if(0>bb)g.x=wb,g.y=ec,g.z=Vb,Wa=1;else if(1Aa*Pa+na*Fa+La*Q){var Sa,Na,Za,vb,mb,xb;Sa=sa.x;Na=sa.y;Za=sa.z;vb=ba.x;mb=ba.y;xb=ba.z;var nb,fb,Re;nb=vb-Sa;fb=mb-Na;Re=xb-Za;var Db=nb*Sa+fb*Na+Re*Za,Db=-Db/(nb*nb+fb*fb+Re*Re),G;if(0>Db)g.x=Sa,g.y=Na,g.z=Za,G=1;else if(1ja||obBa*aa+ta*fa+S*Rd){var cb,zb,Xa,tb,v,W;cb=O.x;zb=O.y;Xa=O.z;tb=ba.x;v=ba.y;W=ba.z;var U,db,cc;U=tb-cb;db=v-zb;cc=W-Xa;var Ra=U*cb+db*zb+cc*Xa,Ra=-Ra/(U*U+db*db+cc*cc),Ha;if(0>Ra)g.x=cb,g.y=zb,g.z=Xa,Ha=1;else if(1ja||la(nc*Ng+xa*qi+Fc*Bb)*Hb){var Sb,Nb,lb,Rb,Kb,dc,Wb,yf,ac,bc,Pb,$b,kd,Mb,Tb,fd,Rc,zc;Sb=ma.x;Nb=ma.y;lb=ma.z;Rb=Ja.x;Kb=Ja.y;dc=Ja.z;Wb=$a.x;yf=$a.y;ac=$a.z;bc=Rb-Sb;Pb=Kb-Nb;$b=dc-lb;kd=Wb-Rb;Mb=yf-Kb;Tb=ac-dc;fd=Sb-Wb;Rc=Nb-yf;zc=lb-ac;var gd,Yc,od;gd=Pb*Tb-$b*Mb;Yc=$b*kd-bc*Tb;od=bc*Mb-Pb*kd;var pc,kc,tc,Zc,Kc,Lc,xc,Cc,Dc;pc=Pb*od-$b*Yc;kc=$b*gd-bc*od;tc=bc*Yc-Pb*gd;Zc=Mb*od-Tb*Yc;Kc=Tb*gd-kd*od;Lc=kd*Yc-Mb*gd;xc=Rc*od-zc*Yc;Cc=zc*gd-fd*od;Dc=fd*Yc-Rc*gd;var pd=-1,yd,sd,td,zd=0;td=sd=yd=0;if(0>Sb*pc+Nb*kc+lb*tc){var qc,Zb,lc,jc,Qc,wc;qc=ma.x;Zb=ma.y;lc=ma.z;jc=Ja.x;Qc=Ja.y;wc=Ja.z;var Sd,ie,Uc;Sd=jc-qc;ie=Qc-Zb;Uc=wc-lc;var je=Sd*qc+ie*Zb+Uc*lc,je=-je/(Sd*Sd+ie*ie+Uc*Uc),Pc;if(0>je)g.x=qc,g.y=Zb,g.z=lc,Pc=1;else if(1Rb*Zc+Kb*Kc+dc*Lc){var Ge,He,Se,Te,Ie,Je;Ge=Ja.x;He=Ja.y;Se=Ja.z;Te=$a.x;Ie=$a.y;Je=$a.z;var ae,xe,$c;ae=Te-Ge;xe=Ie-He;$c=Je-Se;var Sc=ae*Ge+xe*He+$c*Se,Sc=-Sc/(ae*ae+xe*xe+$c*$c),ld;if(0>Sc)g.x=Ge,g.y=He,g.z=Se,ld=1;else if(1pd||BdWb*xc+yf*Cc+ac*Dc){var ud,ke,le,me,Cd,Dd;ud=ma.x;ke=ma.y;le=ma.z;me=$a.x;Cd=$a.y;Dd=$a.z;var hd,Kd,ee;hd=me-ud;Kd=Cd-ke;ee=Dd-le;var Td=hd*ud+Kd*ke+ee*le,Td=-Td/(hd*hd+Kd*Kd+ee*ee),qd;if(0>Td)g.x=ud,g.y=ke,g.z=le,qd=1;else if(1pd||ne(nc*Fb+xa*xf+Fc*ic)*Hb){var id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf,md,Fd,ed;id=ma.x;bd=ma.y;cd=ma.z;Vc=$a.x;Mc=$a.y;Nc=$a.z;Ec=Oa.x;yc=Oa.y;Bc=Oa.z;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ec-Vc;oe=yc-Mc;lf=Bc-Nc;md=id-Ec;Fd=bd-yc;ed=cd-Bc;var vd,jd,nd;vd=Tc*lf-Hc*oe;jd=Hc*Oc-Ac*lf;nd=Ac*oe-Tc*Oc;var mf,Fe,Wc,Hd,Ee,Ri,fe,pe,ge;mf=Tc*nd-Hc*jd;Fe=Hc*vd-Ac*nd;Wc=Ac*jd-Tc*vd;Hd=oe*nd-lf*jd;Ee=lf*vd-Oc*nd;Ri=Oc*jd-oe*vd;fe=Fd*nd-ed*jd;pe=ed*vd-md*nd;ge=md*jd-Fd*vd;var rd=-1,Vd,wd,Wd,qe=0;Wd=wd=Vd=0;if(0>id*mf+bd*Fe+cd*Wc){var he,zf,sh,tg,ug,vg;he=ma.x;zf=ma.y;sh=ma.z;tg=$a.x;ug=$a.y;vg=$a.z;var Ke,Ve,Mf;Ke=tg-he;Ve=ug-zf;Mf=vg-sh;var eg=Ke*he+Ve*zf+Mf*sh,eg=-eg/(Ke*Ke+Ve*Ve+Mf*Mf),fg;if(0>eg)g.x=he,g.y=zf,g.z=sh,fg=1;else if(1Vc*Hd+Mc*Ee+Nc*Ri){var Pf,Qf,Rf,Sf,Tf,Af;Pf=$a.x;Qf=$a.y;Rf=$a.z;Sf=Oa.x;Tf=Oa.y;Af=Oa.z;var ye,nf,Uf;ye=Sf-Pf;nf=Tf-Qf;Uf=Af-Rf;var of=ye*Pf+nf*Qf+Uf*Rf,of=-of/(ye*ye+nf*nf+Uf*Uf),hg;if(0>of)g.x=Pf,g.y=Qf,g.z=Rf,hg=1;else if(1rd||XdEc*fe+yc*pe+Bc*ge){var Nd,Od,yg,zg,Ag,Bg;Nd=ma.x;Od=ma.y;yg=ma.z;zg=Oa.x;Ag=Oa.y;Bg=Oa.z;var pf,Vf,si;pf=zg-Nd;Vf=Ag-Od;si=Bg-yg;var ig=pf*Nd+Vf*Od+si*yg,ig=-ig/(pf*pf+Vf*Vf+si*si),ti;if(0>ig)g.x=Nd,g.y=Od,g.z=yg,ti=1;else if(1rd||qfGc||Xf(nc*Og+xa*Jb+Fc*Ob)*Hb){var Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg,be,ce,Pd;Yf=ma.x;Zf=ma.y;$f=ma.z;Cf=Ja.x;Df=Ja.y;Ef=Ja.z;Me=Oa.x;Ff=Oa.y;jg=Oa.z;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Me-Cf;Hf=Ff-Df;kg=jg-Ef;be=Yf-Me;ce=Zf-Ff;Pd=$f-jg;var Yd,Zd,Gd;Yd=bg*kg-Ye*Hf;Zd=Ye*Gf-ag*kg;Gd=ag*Hf-bg*Gf;var gf,hf,jf,ue,kf,Qg,Ze,rf,cg;gf=bg*Gd-Ye*Zd;hf=Ye*Yd-ag*Gd;jf=ag*Zd-bg*Yd;ue=Hf*Gd-kg*Zd;kf=kg*Yd-Gf*Gd;Qg=Gf*Zd-Hf*Yd;Ze=ce*Gd-Pd*Zd;rf=Pd*Yd-be*Gd;cg=be*Zd-ce*Yd;var re=-1,sf,ze,Ae,tf=0;Ae=ze=sf=0;if(0>Yf*gf+Zf*hf+$f*jf){var $e,If,Dg,Eg,Fg,Gg;$e=ma.x;If=ma.y;Dg=ma.z;Eg=Ja.x;Fg=Ja.y;Gg=Ja.z;var af,bf,dg;af=Eg-$e;bf=Fg-If;dg=Gg-Dg;var lg=af*$e+bf*If+dg*Dg,lg=-lg/(af*af+bf*bf+dg*dg),te;if(0>lg)g.x=$e,g.y=If,g.z=Dg,te=1;else if(1Cf*ue+Df*kf+Ef*Qg){var th,uh,vh,wh,xh,yh;th=Ja.x;uh=Ja.y;vh=Ja.z;wh=Oa.x;xh=Oa.y;yh=Oa.z;var mg,ah,se;mg=wh-th;ah=xh-uh;se=yh-vh;var bh=mg*th+ah*uh+se*vh,bh=-bh/(mg*mg+ah*ah+se*se),ff;if(0>bh)g.x=th,g.y=uh,g.z=vh,ff=1;else if(1re||wiMe*Ze+Ff*rf+jg*cg){var zh,Ah,Bh,Ch,Dh,Eh;zh=ma.x;Ah=ma.y;Bh=ma.z;Ch=Oa.x;Dh=Oa.y;Eh=Oa.z;var ng,Rg,xi;ng=Ch-zh;Rg=Dh-Ah;xi=Eh-Bh;var ch=ng*zh+Rg*Ah+xi*Bh,ch=-ch/(ng*ng+Rg*Rg+xi*xi),yi;if(0>ch)g.x=zh,g.y=Ah,g.z=Bh,yi=1;else if(1re||ziGc||Ai(wa*Pg+pa*sc+Ca*Jd)*Hb){var dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh,Ne,Oe,Pe;dh=Ja.x;eh=Ja.y;fh=Ja.z;Gh=$a.x;Hh=$a.y;Ih=$a.z;gh=Oa.x;hh=Oa.y;ih=Oa.z;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=gh-Gh;Kh=hh-Hh;Lh=ih-Ih;Ne=dh-gh;Oe=eh-hh;Pe=fh-ih;var cf,df,ef;cf=Ug*Lh-Vg*Kh;df=Vg*Jh-Tg*Lh;ef=Tg*Kh-Ug*Jh;var Mg,hi,ji,ki,ni,pi,Wg,jh,kh;Mg=Ug*ef-Vg*df;hi=Vg*cf-Tg*ef;ji=Tg*df-Ug*cf;ki=Kh*ef-Lh*df;ni=Lh*cf-Jh*ef;pi=Jh*df-Kh*cf;Wg=Oe*ef-Pe*df;jh=Pe*cf-Ne*ef;kh=Ne*df-Oe*cf;var uf=-1,Ig,og,pg,lh=0;pg=og=Ig=0;if(0>dh*Mg+eh*hi+fh*ji){var Mh,Nh,Oh,Ph,Qh,Rh;Mh=Ja.x;Nh=Ja.y;Oh=Ja.z;Ph=$a.x;Qh=$a.y;Rh=$a.z;var qg,mh,Bi;qg=Ph-Mh;mh=Qh-Nh;Bi=Rh-Oh;var nh=qg*Mh+mh*Nh+Bi*Oh,nh=-nh/(qg*qg+mh*mh+Bi*Bi),Si;if(0>nh)g.x=Mh,g.y=Nh,g.z=Oh,Si=1;else if(1Gh*ki+Hh*ni+Ih*pi){var Sh,Th,Uh,Vh,Wh,Xh;Sh=$a.x;Th=$a.y;Uh=$a.z;Vh=Oa.x;Wh=Oa.y;Xh=Oa.z;var rg,oh,Fi;rg=Vh-Sh;oh=Wh-Th;Fi=Xh-Uh;var ph=rg*Sh+oh*Th+Fi*Uh,ph=-ph/(rg*rg+oh*oh+Fi*Fi),Ti;if(0>ph)g.x=Sh,g.y=Th,g.z=Uh,Ti=1;else if(1uf||Iigh*Wg+hh*jh+ih*kh){var Yh,Zh,$h,ai,bi,ci;Yh=Ja.x;Zh=Ja.y;$h=Ja.z;ai=Oa.x;bi=Oa.y;ci=Oa.z;var sg,Xg,Ji;sg=ai-Yh;Xg=bi-Zh;Ji=ci-$h;var qh=sg*Yh+Xg*Zh+Ji*$h,qh=-qh/(sg*sg+Xg*Xg+Ji*Ji),Ki;if(0>qh)g.x=Yh,g.y=Zh,g.z=$h,Ki=1;else if(1uf||LiGc||cjg.x*g.x+g.y*g.y+g.z*g.z){if(!z||4==this.Ba){h.fraction=z;break}this.Km();h.fraction=z;var Be=h.normal;Be.x=k.x;Be.y=k.y;Be.z=k.z;var rh=Math.sqrt(Be.x*Be.x+Be.y*Be.y+Be.z*Be.z);0k.x*k.x+k.y*k.y+k.z*k.z)throw Error("!?");var Mi=l[this.Ba],Ui=Mi.x*k.x+Mi.y*k.y+Mi.z*k.z;if(0>Ui){if(0<=D.x*k.x+D.y*k.y+D.z*k.z)break;var nj=Ui/(D.x*k.x+D.y*k.y+D.z*k.z),z=z+nj;if(1<=z)break;n.x+=D.x*nj;n.y+=D.y*nj;n.z+=D.z*nj;for(var Vi=0,ij=this.Ba+1;Vifj*fj+gj*gj+hj*hj){Wi=!0;break}}Wi||this.Ba++;++u}return!1},Km:function(){switch(this.Ba){case 1:var a=this.closestPoint1,b=this.eb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,d=this.ib[0];e.x=d.x;e.y=d.y;e.z=d.z;break;case 2:var c,f,h,l=this.closest;c=l.x;f=l.y;h=l.z;var g,k,m,p,r,q,t,A,L,u,n,fc,D,Ib,y,B,E,K,H=this.La[0];g=H.x;k=H.y;m=H.z;var mc=this.eb[0];p=mc.x;r=mc.y;q=mc.z;var R=this.ib[0];t=R.x;A=R.y;L=R.z;var x=this.La[1];u=x.x;n=x.y;fc=x.z;var X=this.eb[1];D=X.x;Ib=X.y;y=X.z;var F=this.ib[1];B=F.x;E=F.y;K=F.z;var I,qa,N;I=u-g;qa=n-k;N=fc-m;var ya=I*I+qa*qa+N*N;ya&&(ya=1/ya);var J=((c-g)*I+(f-k)*qa+(h-m)*N)*ya,Ea,O,sa,ba,za,Ta,C,Aa,na;Ea=D-p;O=Ib-r;sa=y-q;ba=p+Ea*J;za=r+O*J;Ta=q+sa*J;Ea=B-t;O=E-A;sa=K-L;C=t+Ea*J;Aa=A+O*J;na=L+sa*J;var La=this.closestPoint1;La.x=ba;La.y=za;La.z=Ta;var Ba=this.closestPoint2;Ba.x=C;Ba.y=Aa;Ba.z=na;break;case 3:var ta,S,ha,ea=this.closest;ta=ea.x;S=ea.y;ha=ea.z;var da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab=this.La[0];da=Ab.x;M=Ab.y;T=Ab.z;var ib=this.eb[0];w=ib.x;V=ib.y;ia=ib.z;var hb=this.ib[0];Y=hb.x;oa=hb.y;ua=hb.z;var ka=this.La[1];ca=ka.x;Ma=ka.y;va=ka.z;var Ia=this.eb[1];Z=Ia.x;Pa=Ia.y;Fa=Ia.z;var ab=this.ib[1];Q=ab.x;aa=ab.y;fa=ab.z;var bb=this.La[2];Rd=bb.x;ja=bb.y;Ga=bb.z;var Wa=this.eb[2];P=Wa.x;Ya=Wa.y;wa=Wa.z;var Va=this.ib[2];wb=Va.x;ec=Va.y;Vb=Va.z;var qb,kb,Sa,Na,Za,vb,mb,xb,nb;qb=ca-da;kb=Ma-M;Sa=va-T;Na=Rd-da;Za=ja-M;vb=Ga-T;mb=ta-da;xb=S-M;nb=ha-T;var fb=qb*qb+kb*kb+Sa*Sa,pa=qb*Na+kb*Za+Sa*vb,Db=Na*Na+Za*Za+vb*vb,G=qb*mb+kb*xb+Sa*nb,sb=Na*mb+Za*xb+vb*nb,jb=fb*Db-pa*pa;jb&&(jb=1/jb);var Xb=(G*Db-sb*pa)*jb,ob=(-G*pa+sb*fb)*jb,cb,zb,Xa,tb,v,W,U,db,cc;cb=Z-w;zb=Pa-V;Xa=Fa-ia;tb=w+cb*Xb;v=V+zb*Xb;W=ia+Xa*Xb;cb=P-w;zb=Ya-V;Xa=wa-ia;tb+=cb*ob;v+=zb*ob;W+=Xa*ob;cb=Q-Y;zb=aa-oa;Xa=fa-ua;U=Y+cb*Xb;db=oa+zb*Xb;cc=ua+Xa*Xb;cb=wb-Y;zb=ec-oa;Xa=Vb-ua;U+=cb*ob;db+=zb*ob;cc+=Xa*ob;var Ra=this.closestPoint1;Ra.x=tb;Ra.y=v;Ra.z=W;var Ha=this.closestPoint2;Ha.x=U;Ha.y=db;Ha.z=cc;break;default:throw Error("!?");}},yo:function(a){var b=this.dir;a=a.$l;b.x=a.x;b.y=a.y;b.z=a.z},Fo:function(a){a=a.$l;var b=this.closest;a.x=b.x;a.y=b.y;a.z=b.z;a.x=-a.x;a.y=-a.y;a.z=-a.z},an:function(a){this.Ba=a;this.Ba=(this.Ba&5)+(this.Ba>>1&5);this.Ba=(this.Ba&3)+(this.Ba>>2&3);switch(a){case 2:a=this.La[0];var b=this.La[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[1];a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.La[1];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 8:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a=this.La[2];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[2];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[2];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.La[0],b=this.La[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.eb[0],b=this.eb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.ib[0],b=this.ib[3],a.x=b.x,a.y=b.y,a.z=b.z}},Tf:function(a){var b,e,d,c,f,h;h=this.dir;c=h.x;f=h.y;h=h.z;var l;e=this.oc.o*c+this.oc.i*f+this.oc.l*h;l=this.oc.f*c+this.oc.m*f+this.oc.g*h;b=this.oc.h*c+this.oc.j*f+this.oc.s*h;d=this.dir;d.x=e;d.y=l;d.z=b;this.Kj.he(this.dir,this.eb[this.Ba]);a&&(a=this.dir,b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=this.dir,e=this.Ij[a++];b.x=e.x;b.y=e.y;b.z=e.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--;b=this.dir;b.x=-b.x;b.y=-b.y;b.z=-b.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--}},Wl:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;e=e.z;var d,c,f,h,l,g;f=this.La[0];d=f.x;c=f.y;f=f.z;g=this.La[1];h=g.x;l=g.y;g=g.z;d-=h;c-=l;f-=g;for(l=0;3>l;){var k,m;g=this.Ij[l++];h=g.x;k=g.y;m=g.z;g=c*m-f*k;m=f*h-d*m;h=d*k-c*h;k=this.dir;k.x=g;k.y=m;k.z=h;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--;g=this.dir;g.x=-g.x;g.y=-g.y;g.z=-g.z;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--}d=this.dir;d.x=a;d.y=b;d.z=e},dm:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;for(e=e.z;;){var d,c,f,h,l,g,k,m,p;f=this.La[0];d=f.x;c=f.y;f=f.z;m=this.La[1];h=m.x;l=m.y;g=m.z;p=this.La[2];k=p.x;m=p.y;p=p.z;h-=d;l-=c;g-=f;d=k-d;c=m-c;m=p-f;f=l*m-g*c;m=g*d-h*m;c=h*c-l*d;h=this.dir;h.x=f;h.y=m;h.z=c;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;c=this.dir;c.x=-c.x;c.y=-c.y;c.z=-c.z;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;break}c=this.dir;c.x=a;c.y=b;c.z=e},Lm:function(){var a=this.La[2].x-this.La[0].x,b=this.La[2].y-this.La[0].y,e=this.La[2].z-this.La[0].z,d=this.La[3].x-this.La[0].x,c=this.La[3].y-this.La[0].y,f=this.La[3].z-this.La[0].z,a=(this.La[1].x-this.La[0].x)*(b*f-e*c)-(this.La[1].y-this.La[0].y)*(a*f-e*d)+(this.La[1].z-this.La[0].z)*(a*c-b*d);return 1E-12a},Ln:function(a,b,e,d,c,f,h){for(var l=this.ih;0x;){for(var R=this.ih.Cd,F=Infinity,X=null;null!=R;)R.nkE.x*C.x+E.y*C.y+E.z*C.z-(za.x*Ta.x+za.y*Ta.y+za.z*Ta.z)||39==x){var Aa=this.closest,na=this.dir;Aa.x=na.x;Aa.y=na.y;Aa.z=na.z;var La=this.dir,Ba=O.Rd,ta=this.dir,S=(La.x*Ba.x+La.y*Ba.y+La.z*Ba.z)/(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z);Aa.x*=S;Aa.y*=S;Aa.z*=S;var ha,ea,da,M=this.closest;ha=M.x;ea=M.y;da=M.z;var T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab,ib,hb=O.Rd;T=hb.x;w=hb.y;V=hb.z;var ka=O.eb;ia=ka.x;Y=ka.y;oa=ka.z;var Ia=O.ib;ua=Ia.x;ca=Ia.y;Ma=Ia.z;var ab=sa.Rd;va=ab.x;Z=ab.y;Pa=ab.z;var bb=sa.eb;Fa=bb.x;Q=bb.y;aa=bb.z;var Wa=sa.ib;fa=Wa.x;Rd=Wa.y;ja=Wa.z;var Va=ba.Rd;Ga=Va.x;P=Va.y;Ya=Va.z;var qb=ba.eb;wa=qb.x;wb=qb.y;ec=qb.z;var kb=ba.ib;Vb=kb.x;Ab=kb.y;ib=kb.z;var Sa,Na,Za,vb,mb,xb,nb,fb,pa;Sa=va-T;Na=Z-w;Za=Pa-V;vb=Ga-T;mb=P-w;xb=Ya-V;nb=ha-T;fb=ea-w;pa=da-V;var Db=Sa*Sa+Na*Na+Za*Za,G=Sa*vb+Na*mb+Za*xb,sb=vb*vb+mb*mb+xb*xb,jb=Sa*nb+Na*fb+Za*pa,Xb=vb*nb+mb*fb+xb*pa,ob=Db*sb-G*G;ob&&(ob=1/ob);var cb=(jb*sb-Xb*G)*ob,zb=(-jb*G+Xb*Db)*ob,Xa,tb,v,W,U,db,cc,Ra,Ha;Xa=Fa-ia;tb=Q-Y;v=aa-oa;W=ia+Xa*cb;U=Y+tb*cb;db=oa+v*cb;Xa=wa-ia;tb=wb-Y;v=ec-oa;W+=Xa*zb;U+=tb*zb;db+=v*zb;Xa=fa-ua;tb=Rd-ca;v=ja-Ma;cc=ua+Xa*cb;Ra=ca+tb*cb;Ha=Ma+v*cb;Xa=Vb-ua;tb=Ab-ca;v=ib-Ma;cc+=Xa*zb;Ra+=tb*zb;Ha+=v*zb;var rb=this.closestPoint1;rb.x=W;rb.y=U;rb.z=db;var yb=this.closestPoint2;yb.x=cc;yb.y=Ra;yb.z=Ha;var Cb=this.closest;this.depth=Math.sqrt(Cb.x*Cb.x+Cb.y*Cb.y+Cb.z*Cb.z);return dc.SUCCEEDED}var la=this.ih,ra=la.jf;null!=ra?(la.jf=ra.M,ra.M=null):ra=new te;var ga=ra.Aa(E,K,H);if(!this.ih.qn(ga,I))return dc.EPA_FAILED_TO_ADD_VERTEX;++x}return dc.EPA_DID_NOT_CONVERGE},wa:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!0)},mb:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!1)},Vf:function(a,b,e,d,c,f,h){return this.xm(a,b,e,d,c,f,h)},ke:function(a,b,e,d,c){var f=this.Io;f.v=e.x;f.A=e.y;f.B=e.z;var h=this.Jo,l=this.Ko;h.x=d.x;h.y=d.y;h.z=d.z;h.x-=e.x;h.y-=e.y;h.z-=e.z;l.R();return this.xm(null,a,f,b,h,l,c)}};Pc.wc=function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;var l,g,k;l=f-d;g=h-c;k=b-a;var m;m=-(l*d+g*c+k*a)/(l*l+g*g+k*k);if(0>m)return e.x=d,e.y=c,e.z=a,1;if(1c*(t*E-A*B)+f*(A*y-q*E)+h*(q*B-t*y)){K=a.x;H=a.y;x=a.z;R=b.x;F=b.y;q=b.z;var X;t=R-K;A=F-H;X=q-x;var I;I=-(t*K+A*H+X*x)/(t*t+A*A+X*X);0>I?(d.x=K,d.y=H,d.z=x,K=1):1l*(u*E-n*B)+g*(n*y-L*E)+k*(L*B-u*y)&&(l=b.x,g=b.y,b=b.z,k=e.x,L=e.y,u=e.z,n=k-l,q=L-g,t=u-b,A=-(n*l+q*g+t*b)/(n*n+q*q+t*t),0>A?(d.x=l,d.y=g,d.z=b,b=1):1K||lm*(D*E-Ib*B)+p*(Ib*y-fc*E)+r*(fc*B-D*y)&&(m=a.x,p=a.y,a=a.z,r=e.x,fc=e.y,e=e.z,D=r-m,Ib=fc-p,b=e-a,l=-(D*m+Ib*p+b*a)/(D*D+Ib*Ib+b*b),0>l?(d.x=m,d.y=p,d.z=a,e=1):1K||a(f*Da+h*qa+l*J)*Aa){var ha,ea,da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q;ha=a.x;ea=a.y;da=a.z;M=b.x;T=b.y;w=b.z;V=e.x;ia=e.y;Y=e.z;oa=M-ha;ua=T-ea;ca=w-da;Ma=V-M;va=ia-T;Z=Y-w;Pa=ha-V;Fa=ea-ia;Q=da-Y;var aa,fa,Rd;aa=ua*Z-ca*va;fa=ca*Ma-oa*Z;Rd=oa*va-ua*Ma;var ja,Ga,P,Ya,wa,wb,ec,Vb,Ab;ja=ua*Rd-ca*fa;Ga=ca*aa-oa*Rd;P=oa*fa-ua*aa;Ya=va*Rd-Z*fa;wa=Z*aa-Ma*Rd;wb=Ma*fa-va*aa;ec=Fa*Rd-Q*fa;Vb=Q*aa-Pa*Rd;Ab=Pa*fa-Fa*aa;var ib=-1,hb,ka,Ia,ab=0;Ia=ka=hb=0;if(0>ha*ja+ea*Ga+da*P){var bb,Wa,Va,qb,kb,Sa;bb=a.x;Wa=a.y;Va=a.z;qb=b.x;kb=b.y;Sa=b.z;var Na,Za,vb;Na=qb-bb;Za=kb-Wa;vb=Sa-Va;var mb=Na*bb+Za*Wa+vb*Va,mb=-mb/(Na*Na+Za*Za+vb*vb),xb;if(0>mb)c.x=bb,c.y=Wa,c.z=Va,xb=1;else if(1M*Ya+T*wa+w*wb){var Db,G,sb,jb,Xb,ob;Db=b.x;G=b.y;sb=b.z;jb=e.x;Xb=e.y;ob=e.z;var cb,zb,Xa;cb=jb-Db;zb=Xb-G;Xa=ob-sb;var tb=cb*Db+zb*G+Xa*sb,tb=-tb/(cb*cb+zb*zb+Xa*Xa),v;if(0>tb)c.x=Db,c.y=G,c.z=sb,v=1;else if(1ib||ccV*ec+ia*Vb+Y*Ab){var Ra,Ha,rb,yb,Cb,la;Ra=a.x;Ha=a.y;rb=a.z;yb=e.x;Cb=e.y;la=e.z;var ra,ga,ma;ra=yb-Ra;ga=Cb-Ha;ma=la-rb;var Ja=ra*Ra+ga*Ha+ma*rb,Ja=-Ja/(ra*ra+ga*ga+ma*ma),$a;if(0>Ja)c.x=Ra,c.y=Ha,c.z=rb,$a=1;else if(1ib||Fc(f*ya+h*pa+l*Ea)*Aa){var gb,ub,xd,pb,Qa,de,Ic,Yb,oc,Id,$d,rc,Jc,Bb,Fb,Jb,hc,uc;gb=a.x;ub=a.y;xd=a.z;pb=e.x;Qa=e.y;de=e.z;Ic=d.x;Yb=d.y;oc=d.z;Id=pb-gb;$d=Qa-ub;rc=de-xd;Jc=Ic-pb;Bb=Yb-Qa;Fb=oc-de;Jb=gb-Ic;hc=ub-Yb;uc=xd-oc;var gc,Xc,Eb;gc=$d*Fb-rc*Bb;Xc=rc*Jc-Id*Fb;Eb=Id*Bb-$d*Jc;var Ng,Lb,Gb,Ob,xf,ic,Hb,Qb,Sb;Ng=$d*Eb-rc*Xc;Lb=rc*gc-Id*Eb;Gb=Id*Xc-$d*gc;Ob=Bb*Eb-Fb*Xc;xf=Fb*gc-Jc*Eb;ic=Jc*Xc-Bb*gc;Hb=hc*Eb-uc*Xc;Qb=uc*gc-Jb*Eb;Sb=Jb*Xc-hc*gc;var Nb=-1,sc,Jd,lb,Gc=0;lb=Jd=sc=0;if(0>gb*Ng+ub*Lb+xd*Gb){var Rb,vc,Kb,dc,bc,Pb;Rb=a.x;vc=a.y;Kb=a.z;dc=e.x;bc=e.y;Pb=e.z;var Wb,$b,Mb;Wb=dc-Rb;$b=bc-vc;Mb=Pb-Kb;var Tb=Wb*Rb+$b*vc+Mb*Kb,Tb=-Tb/(Wb*Wb+$b*$b+Mb*Mb),ac;if(0>Tb)c.x=Rb,c.y=vc,c.z=Kb,ac=1;else if(1pb*Ob+Qa*xf+de*ic){var kc,lc,kd,tc,jc,fd;kc=e.x;lc=e.y;kd=e.z;tc=d.x;jc=d.y;fd=d.z;var Rc,zc,gd;Rc=tc-kc;zc=jc-lc;gd=fd-kd;var Yc=Rc*kc+zc*lc+gd*kd,Yc=-Yc/(Rc*Rc+zc*zc+gd*gd),od;if(0>Yc)c.x=kc,c.y=lc,c.z=kd,od=1;else if(1Nb||ZcIc*Hb+Yb*Qb+oc*Sb){var Kc,Lc,xc,Cc,Dc,pd;Kc=a.x;Lc=a.y;xc=a.z;Cc=d.x;Dc=d.y;pd=d.z;var yd,sd,td;yd=Cc-Kc;sd=Dc-Lc;td=pd-xc;var zd=yd*Kc+sd*Lc+td*xc,zd=-zd/(yd*yd+sd*sd+td*td),Pc;if(0>zd)c.x=Kc,c.y=Lc,c.z=xc,Pc=1;else if(1Nb||Dena||Fe(f*O+h*sa+l*ba)*Aa){var je,Wc,Hd,se,te,Ge,He,Se,Te,Ie,Je,ae,xe,$c,Sc,ld,Ee,Qe;je=a.x;Wc=a.y;Hd=a.z;se=b.x;te=b.y;Ge=b.z;He=d.x;Se=d.y;Te=d.z;Ie=se-je;Je=te-Wc;ae=Ge-Hd;xe=He-se;$c=Se-te;Sc=Te-Ge;ld=je-He;Ee=Wc-Se;Qe=Hd-Te;var Ad,Bd,ud;Ad=Je*Sc-ae*$c;Bd=ae*xe-Ie*Sc;ud=Ie*$c-Je*xe;var ke,le,me,Cd,Dd,hd,Kd,ee,Td;ke=Je*ud-ae*Bd;le=ae*Ad-Ie*ud;me=Ie*Bd-Je*Ad;Cd=$c*ud-Sc*Bd;Dd=Sc*Ad-xe*ud;hd=xe*Bd-$c*Ad;Kd=Ee*ud-Qe*Bd;ee=Qe*Ad-ld*ud;Td=ld*Bd-Ee*Ad;var qd=-1,Ud,Ld,Md,ne=0;Md=Ld=Ud=0;if(0>je*ke+Wc*le+Hd*me){var Ue,ad,Ed,id,bd,cd;Ue=a.x;ad=a.y;Ed=a.z;id=b.x;bd=b.y;cd=b.z;var Vc,Mc,Nc;Vc=id-Ue;Mc=bd-ad;Nc=cd-Ed;var Ec=Vc*Ue+Mc*ad+Nc*Ed,Ec=-Ec/(Vc*Vc+Mc*Mc+Nc*Nc),yc;if(0>Ec)c.x=Ue,c.y=ad,c.z=Ed,yc=1;else if(1se*Cd+te*Dd+Ge*hd){var Hc,Oc,oe,lf,md,Fd;Hc=b.x;Oc=b.y;oe=b.z;lf=d.x;md=d.y;Fd=d.z;var ed,vd,jd;ed=lf-Hc;vd=md-Oc;jd=Fd-oe;var nd=ed*Hc+vd*Oc+jd*oe,nd=-nd/(ed*ed+vd*vd+jd*jd),mf;if(0>nd)c.x=Hc,c.y=Oc,c.z=oe,mf=1;else if(1qd||jfHe*Kd+Se*ee+Te*Td){var ue,fe,pe,ge,rd,Vd;ue=a.x;fe=a.y;pe=a.z;ge=d.x;rd=d.y;Vd=d.z;var wd,Wd,qe;wd=ge-ue;Wd=rd-fe;qe=Vd-pe;var he=wd*ue+Wd*fe+qe*pe,he=-he/(wd*wd+Wd*Wd+qe*qe),zf;if(0>he)c.x=ue,c.y=fe,c.z=pe,zf=1;else if(1qd||vgna||eg(g*za+k*Ta+m*C)*Aa){var fg,Nf,Of,gg,Pf,Qf,Rf,Sf,Tf,Af,ye,nf,Uf,of,hg,vf,wg,xg;fg=b.x;Nf=b.y;Of=b.z;gg=e.x;Pf=e.y;Qf=e.z;Rf=d.x;Sf=d.y;Tf=d.z;Af=gg-fg;ye=Pf-Nf;nf=Qf-Of;Uf=Rf-gg;of=Sf-Pf;hg=Tf-Qf;vf=fg-Rf;wg=Nf-Sf;xg=Of-Tf;var Xd,Nd,Od;Xd=ye*hg-nf*of;Nd=nf*Uf-Af*hg;Od=Af*of-ye*Uf;var yg,zg,Ag,Bg,pf,Vf,Kf,ig,Lf;yg=ye*Od-nf*Nd;zg=nf*Xd-Af*Od;Ag=Af*Nd-ye*Xd;Bg=of*Od-hg*Nd;pf=hg*Xd-Uf*Od;Vf=Uf*Nd-of*Xd;Kf=wg*Od-xg*Nd;ig=xg*Xd-vf*Od;Lf=vf*Nd-wg*Xd;var Wf=-1,Bf,We,qf,Cg=0;qf=We=Bf=0;if(0>fg*yg+Nf*zg+Of*Ag){var Le,Xe,Xf,Yf,Zf,$f;Le=b.x;Xe=b.y;Xf=b.z;Yf=e.x;Zf=e.y;$f=e.z;var Cf,Df,Ef;Cf=Yf-Le;Df=Zf-Xe;Ef=$f-Xf;var Me=Cf*Le+Df*Xe+Ef*Xf,Me=-Me/(Cf*Cf+Df*Df+Ef*Ef),Ff;if(0>Me)c.x=Le,c.y=Xe,c.z=Xf,Ff=1;else if(1gg*Bg+Pf*pf+Qf*Vf){var Ye,Gf,Hf,kg,be,ce;Ye=e.x;Gf=e.y;Hf=e.z;kg=d.x;be=d.y;ce=d.z;var Pd,Yd,Zd;Pd=kg-Ye;Yd=be-Gf;Zd=ce-Hf;var Gd=Pd*Ye+Yd*Gf+Zd*Hf,Gd=-Gd/(Pd*Pd+Yd*Yd+Zd*Zd),wf;if(0>Gd)c.x=Ye,c.y=Gf,c.z=Hf,wf=1;else if(1Wf||MgRf*Kf+Sf*ig+Tf*Lf){var Qg,Ze,rf,cg,re,sf;Qg=b.x;Ze=b.y;rf=b.z;cg=d.x;re=d.y;sf=d.z;var ze,Ae,tf;ze=cg-Qg;Ae=re-Ze;tf=sf-rf;var $e=ze*Qg+Ae*Ze+tf*rf,$e=-$e/(ze*ze+Ae*Ae+tf*tf),If;if(0>$e)c.x=Qg,c.y=Ze,c.z=rf,If=1;else if(1<$e)c.x=cg,c.y=re,c.z=sf,If=2;else{var Dg,Eg,Fg;Dg=Qg+ze*$e;Eg=Ze+Ae*$e;Fg=rf+tf*$e;c.x=Dg;c.y=Eg;c.z=Fg;If=3}var Gg=c.x*c.x+c.y*c.y+c.z*c.z;if(0>Wf||Ggna||lge?b>d?(b=Math.sqrt(b-e-d+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b,a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a},mb:function(a){var b=Math.sin(a.x),e=Math.sin(a.y),d=Math.sin(a.z),c=Math.cos(a.x),f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*d;this.e02=e;this.e10=c*d+a*b*e;this.e11=c*a-b*e*d;this.e12=-f*b;this.e20=b*d-c*a*e;this.e21=a*b+c*e*d;this.e22=c*f;return this},Fi:function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,1.570796326794895,.5*a)):new n(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))},wc:function(a){return 0==a?new n(this.e00,this.e01,this.e02):1==a?new n(this.e10,this.e11,this.e12):2==a?new n(this.e20,this.e21,this.e22):null},kc:function(a){return 0==a?new n(this.e00,this.e10,this.e20):1==a?new n(this.e01,this.e11,this.e21):2==a?new n(this.e02,this.e12,this.e22):null},xc:function(a,b){0==a?b.Aa(this.e00,this.e01,this.e02):1==a?b.Aa(this.e10,this.e11,this.e12):2==a?b.Aa(this.e20,this.e21,this.e22):b.R()},lc:function(a,b){0==a?b.Aa(this.e00,this.e10,this.e20):1==a?b.Aa(this.e01,this.e11,this.e21):2==a?b.Aa(this.e02,this.e12,this.e22):b.R()},Kb:function(a,b,e){this.e00=a.x;this.e01=a.y;this.e02=a.z;this.e10=b.x;this.e11=b.y;this.e12=b.z;this.e20=e.x;this.e21=e.y;this.e22=e.z;return this},wa:function(a,b,e){this.e00=a.x;this.e01=b.x;this.e02=e.x;this.e10=a.y;this.e11=b.y;this.e12=e.y;this.e20=a.z;this.e21=b.z;this.e22=e.z;return this},toString:function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};pa.vd=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};pa.atan2=function(a,b){return Math.atan2(a,b)};pa.sqrt=function(a){return Math.sqrt(a)};pa.Cb=function(a,b,e){return ae?e:a};pa.Hc=function(){return Math.random()};pa.Uc=function(a,b){return a+Math.random()*(b-a)};pa.Wc=function(a,b){return new n(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};pa.Vc=function(){return new n(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};Nb.prototype={Dc:function(){return 0==this.b?new n:this.c[--this.b]},lc:function(){return 0==this.cb?new I:this.bb[--this.cb]},wc:function(){return 0==this.Ag?new J:this.eg[--this.Ag]},xc:function(){return 0==this.re?new wa:this.le[--this.re]},wa:function(a,b,e,d){if(null!=a){a.R();if(this.b==this.c.length){for(var c=Array(this.b<<1),f=0,h=this.b;ff?(f=-f,e=-a.x,d=-a.y,c=-a.z,a=-a.w):(e=a.x,d=a.y,c=a.z,a=a.w);if(.999999e?b>d?(b=Math.sqrt(b-e-d+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this},vd:function(){var a=new I,b=this.x,e=this.y,d=this.z,c=this.w,f=2*b,h=2*e,l=2*d,g=b*f,k=e*h,d=d*l,m=b*h,e=e*l,b=b*l,f=c*f,h=c*h,c=c*l;a.e00=1-k-d;a.e01=m-c;a.e02=b+h;a.e10=m+c;a.e11=1-g-d;a.e12=e-f;a.e20=b-h;a.e21=e+f;a.e22=1-g-k;return a},toString:function(){return"Quat["+(0F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?F.alternativeContactPositionCorrectionAlgorithm:F.defaultContactPositionCorrectionAlgorithm,a.incremental?this.qm.xo(a,this.C.a,this.D.a):this.qm.Lo(a,this.C.a,this.D.a)):this.Ia.df()}},kc:function(){return this.Ec},lc:function(){return this.Fc},Kk:function(){return this.Hh},mb:function(){return this.Ia},wa:function(){return this.ef},Kb:function(){return this.ia},Cb:function(){return this.M}};Zb.prototype={wa:function(){return this.me},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};De.prototype={On:function(){for(var a=this.hc.pe;null!=a;){for(var b=a.M;;){var e;a.Ch.Icg.J&&l.Kg.K&&l.Lg.L&&this.$m(d,c))){d=b.ia;c=b.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b==this.je&&(this.je=this.je.M);b==this.Le&&(this.Le=this.Le.ia);b.M=null;b.ia=null;d=b.rb.ia;c=b.rb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.rb==b.C.Mb&&(b.C.Mb=b.C.Mb.M);b.rb==b.C.ic&&(b.C.ic=b.C.ic.ia);b.rb.M=null;b.rb.ia=null;d=b.sb.ia;c=b.sb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.sb==b.D.Mb&&(b.D.Mb=b.D.Mb.M);b.sb==b.D.ic&&(b.D.ic=b.D.ic.ia);b.sb.M=null;b.sb.ia=null;b.C.Ne--;b.D.Ne--;b.rb.ad=null;b.sb.ad=null;b.rb.me=null;b.sb.me=null;b.Ec=null;b.Fc=null;b.C=null;b.D=null;b.Hh=!1;b.pj.df();b.Ia.df();b.$h=null;d=b.ef;d.Ec=null;d.Fc=null;d.C=null;d.D=null;d.Ej=null;d.Fj=null;b.M=this.Cg;this.Cg=b;this.Ui--;break}b.Bk=!(f.nah.na&&f.oah.oa&&f.pah.pa);break}b=e}},$m:function(a,b){var e=a.Vb,d=b.Vb;if(e==d||0!=e.Jb&&0!=d.Jb||!(a.kk&b.lk&&b.kk&a.lk))return!1;e.AhF.sleepingTimeThreshold&&(b.Bb=!0,b.wb=0)):b.wb=0;if(!b.Bb){if(0==b.Jb){var e=a*b.sk,d=e*e,e=1/(1+e+d*(.5+.16666666666666666*e+.041666666666666664*d)),d=a*b.hk,c=d*d,d=1/(1+d+c*(.5+.16666666666666666*d+.041666666666666664*c)),f,h,l,c=this.Fm*b.vh;f=this.Gm*b.vh;h=this.Hm*b.vh;c+=b.ai*b.qb;f+=b.bi*b.qb;h+=b.ci*b.qb;var g,k;g=b.S*b.Of+b.T*b.Pf+b.U*b.Qf;k=b.V*b.Of+b.W*b.Pf+b.X*b.Qf;l=b.Y*b.Of+b.Z*b.Pf+b.$*b.Qf;b.jb+=c*a;b.kb+=f*a;b.lb+=h*a;b.jb*=e;b.kb*=e;b.lb*=e;b.nb+=g*a;b.ob+=k*a;b.pb+=l*a;b.nb*=d;b.ob*=d;b.pb*=d}b.nm(a);for(a=b.Gc;null!=a;){e=a.M;c=b.ja;d=b.a;f=a.ja;h=a.ha;var m,p,r,q,t,A;l=c.o*h.o+c.f*h.i+c.h*h.l;g=c.o*h.f+c.f*h.m+c.h*h.g;k=c.o*h.h+c.f*h.j+c.h*h.s;m=c.i*h.o+c.m*h.i+c.j*h.l;p=c.i*h.f+c.m*h.m+c.j*h.g;r=c.i*h.h+c.m*h.j+c.j*h.s;q=c.l*h.o+c.g*h.i+c.s*h.l;t=c.l*h.f+c.g*h.m+c.s*h.g;A=c.l*h.h+c.g*h.j+c.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=p;f.j=r;f.l=q;f.g=t;f.s=A;l=c.o*h.v+c.f*h.A+c.h*h.B;g=c.i*h.v+c.m*h.A+c.j*h.B;h=c.l*h.v+c.g*h.A+c.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=c.v;f.A+=c.A;f.B+=c.B;c=a.a;f=a.ha;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;r=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=r;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;a.Fb.Lb(a.u,a.ja);d=a.u.na;c=a.u.oa;f=a.u.pa;h=a.u.ka;l=a.u.la;g=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=da.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;a.u.ma=g>a.u.ma?g:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,c=a.a.A-a.ja.A,f=a.a.B-a.ja.B,h=a.mc,h.x=d,h.y=c,h.z=f,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=e}}},Dn:function(a,b,e){for(var d=a.dt,c=!0,f=0,h=this.ag;fb.u.ka?g:b.u.ka;b.u.la=k>b.u.la?k:b.u.la;b.u.ma=m>b.u.ma?m:b.u.ma;null!=b.ub&&(f=b.a.v-b.ja.v,h=b.a.A-b.ja.A,l=b.a.B-b.ja.B,g=b.mc,g.x=f,g.y=h,g.z=l,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=c}}}};Ca.prototype={xl:function(){var a=Date.now()/1E3;this.Hi.xl();Ce.broadPhaseCollisionTime=1E3*(Date.now()/1E3-a);for(var a=Date.now()/1E3,b=this.Hi.je;null!=b;){var e=b.M;b.Bk||b.Fn();b=e}Ce.narrowPhaseCollisionTime=1E3*(Date.now()/1E3-a)},Cn:function(){var a=Date.now()/1E3;if(F.disableSleeping)for(var b=this.Nf;null!=b;)b.Bb=!1,b.wb=0,b=b.M;if(this.Fh.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var c=this.ra,f=0==c.b?new n:c.c[--c.b],c=this.ra,c=0==c.b?new n:c.c[--c.b];f.x=b.J;f.y=b.K;f.z=b.L;c.x=b.G;c.y=b.H;c.z=b.I;a.aabb(f,c,d);var h=this.ra;if(null!=f){f.R();if(h.b==h.c.length){for(var l=Array(h.b<<1),g=0,k=h.b;gF.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2:e.Bb?b.sleepingShapeColor1:e.wb>F.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1);if(a.drawShapes){var k=l.Fb,m=l.a;switch(k.Jb){case 0:a.sphere(m,k.ab,f);break;case 1:var p=k,r=this.ra,q=0==r.b?new n:r.c[--r.b],t=q;t.x=p.Te;t.y=p.Ue;t.z=p.Ve;a.box(m,q,f);var A=this.ra;if(null!=q){q.R();if(A.b==A.c.length){for(var L=Array(A.b<<1),u=0,z=A.b;ul?a.ellipse(b,e,d,f,f,g):a.arc(b,e,d,f,f,h,l,!0,g)}},km:function(a,b,e,d,c){if(dr;){r++;var q=Math.cos(g)*f,t=Math.sin(g)*h,A=Math.sqrt(q*q+t*t),L=Math.sin(.5*A),u=Math.cos(.5*A),z=k.R();z.x+=d.x*q;z.y+=d.y*q;z.z+=d.z*q;z.x+=c.x*t;z.y+=c.y*t;z.z+=c.z*t;q=1/A*L;k.x*=q;k.y*=q;k.z*=q;m.x=k.x;m.y=k.y;m.z=k.z;m.w=u;var fc=m.x,D=m.y,L=m.z,t=m.w,x=2*fc,y=2*D,A=2*L,u=fc*x,q=D*y,L=L*A,z=fc*y,D=D*A,fc=fc*A,x=t*x,y=t*y,t=t*A;p.e00=1-q-L;p.e01=z-t;p.e02=fc+y;p.e10=z+t;p.e11=1-u-L;p.e12=D-x;p.e20=fc-y;p.e21=D+x;p.e22=1-u-q;u=this.ra;u=0==u.b?new n:u.c[--u.b];u.x+=e.x*l;u.y+=e.y*l;u.z+=e.z*l;q=u.x*p.e10+u.y*p.e11+u.z*p.e12;t=u.x*p.e20+u.y*p.e21+u.z*p.e22;u.x=u.x*p.e00+u.y*p.e01+u.z*p.e02;u.y=q;u.z=t;u.x+=b.x;u.y+=b.y;u.z+=b.z;q=this.ra;if(null!=a){a.R();if(q.b==q.c.length){t=Array(q.b<<1);A=0;for(L=q.b;Ab||5e&&(e=-e);(d=e/.5235987755982984+.5|0)||(d=1);e=f;h=(h-f)/d;c=this.p;c=0==c.b?new n:c.c[--c.b];c.x=a.x;c.y=a.y;c.z=a.z;var g=Math.cos(f);c.x+=l.x*g;c.y+=l.y*g;c.z+=l.z*g;f=Math.sin(f);c.x+=b.x*f;c.y+=b.y*f;c.z+=b.z*f;f=c;for(c=0;cda;){var M=da++,T=this.fg[M],w=this.Mj[M];T.x=w.x;T.y=w.y;T.z=w.z;T.x*=ha;T.y*=ha;T.z*=ha;T.y+=ea;var V=this.fg[M],ia=V.x*q.e10+V.y*q.e11+V.z*q.e12,Y=V.x*q.e20+V.y*q.e21+V.z*q.e22;V.x=V.x*q.e00+V.y*q.e01+V.z*q.e02;V.y=ia;V.z=Y;var oa=this.Ee[M],ua=this.vm[M];oa.x=ua.x;oa.y=ua.y;oa.z=ua.z;oa.x*=ha;oa.y*=ha;oa.z*=ha;oa.y+=ea;var ca=this.Ee[M],Ma=ca.x*q.e10+ca.y*q.e11+ca.z*q.e12,va=ca.x*q.e20+ca.y*q.e21+ca.z*q.e22;ca.x=ca.x*q.e00+ca.y*q.e01+ca.z*q.e02;ca.y=Ma;ca.z=va;var Z=this.af[M],Pa=this.Mj[M];Z.x=Pa.x;Z.y=Pa.y;Z.z=Pa.z;var Fa=Z.x*q.e10+Z.y*q.e11+Z.z*q.e12,Q=Z.x*q.e20+Z.y*q.e21+Z.z*q.e22;Z.x=Z.x*q.e00+Z.y*q.e01+Z.z*q.e02;Z.y=Fa;Z.z=Q;Z.x*=b;Z.y*=b;Z.z*=b;Z.x+=p.x;Z.y+=p.y;Z.z+=p.z;var aa=this.af[M],fa=-e;aa.x+=l.x*fa;aa.y+=l.y*fa;aa.z+=l.z*fa}for(var wa=0;8>wa;){wa++;var ja=this.p,Ga=0==ja.b?new n:ja.c[--ja.b];Ga.x=l.x;Ga.y=l.y;Ga.z=l.z;var P=Ga;P.x=-P.x;P.y=-P.y;P.z=-P.z;var Ya=this.p;if(null!=P){P.R();if(Ya.b==Ya.c.length){for(var Ca=Array(Ya.b<<1),wb=0,ec=Ya.b;wbAb;){var ib=Ab++,hb=this.fg[ib],ka=this.Mj[ib];hb.x=ka.x;hb.y=ka.y;hb.z=ka.z;var Ia=hb.x*q.e10+hb.y*q.e11+hb.z*q.e12,ab=hb.x*q.e20+hb.y*q.e21+hb.z*q.e22;hb.x=hb.x*q.e00+hb.y*q.e01+hb.z*q.e02;hb.y=Ia;hb.z=ab;var bb=this.Ee[ib],Wa=this.fg[ib];bb.x=Wa.x;bb.y=Wa.y;bb.z=Wa.z;bb.x*=b;bb.y*=b;bb.z*=b;bb.x+=p.x;bb.y+=p.y;bb.z+=p.z;var Va=this.af[ib],qb=this.Ee[ib];Va.x=qb.x;Va.y=qb.y;Va.z=qb.z;var kb=this.Ee[ib];kb.x+=l.x*e;kb.y+=l.y*e;kb.z+=l.z*e;var Sa=this.af[ib],Na=-e;Sa.x+=l.x*Na;Sa.y+=l.y*Na;Sa.z+=l.z*Na}for(var Za=0;8>Za;){var vb=Za++,mb=A,xb=this.Ee[vb],nb=this.Ee[(vb+1)%8],fb=l,mb=u,xb=this.af[(vb+1)%8],nb=this.af[vb],Ka=this.p,Db=0==Ka.b?new n:Ka.c[--Ka.b];Db.x=l.x;Db.y=l.y;Db.z=l.z;var G=Db;G.x=-G.x;G.y=-G.y;G.z=-G.z;var fb=G,sb=this.p;if(null!=G){G.R();if(sb.b==sb.c.length){for(var jb=Array(sb.b<<1),Xb=0,ob=sb.b;XbL;)for(var u=L++,z=this.Yh[u].length,fc=0;fcK;){var H=K++;if(!H)for(var F=0;3>F;)for(var R=F++,N=this.Yh[R].length,X=0;Xpa;)for(var ya=pa++,wa=this.Yh[ya].length,Ea=0;EaTa;){var C=Ta++,Aa,na,La,Ba,ta,S,ha,ea;H?3==H?this.wireframe?(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C]):(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C],ta=A[4][0],S=A[H][(C+1)%8],ha=A[H][C]):this.wireframe?(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C]):(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C],Ba=t[H+1][(C+1)%8],ta=A[H][C],S=A[H][(C+1)%8],ha=A[H+1][C],ea=A[H+1][(C+1)%8],this.rect(Aa,La,Ba,na,ta,ha,ea,S,d)):this.wireframe?(Aa=t[0][0],na=t[1][C]):(Aa=t[0][0],na=t[1][C],La=t[1][(C+1)%8],ta=A[0][0],S=A[1][C],ha=A[1][(C+1)%8])}}var da=this.p,M=0==da.b?new n:da.c[--da.b];M.x=p.x;M.y=p.y;M.z=p.z;M.x+=l.x*e;M.y+=l.y*e;M.z+=l.z*e;var T=this.p,w=0==T.b?new n:T.c[--T.b];w.x=p.x;w.y=p.y;w.z=p.z;var V=-e;w.x+=l.x*V;w.y+=l.y*V;w.z+=l.z*V;if(this.wireframe){var ia=this.p,Y=0==ia.b?new n:ia.c[--ia.b];Y.x=M.x;Y.y=M.y;Y.z=M.z;var oa=-b;Y.x+=f.x*oa;Y.y+=f.y*oa;Y.z+=f.z*oa;Y.x+=0*k.x;Y.y+=0*k.y;Y.z+=0*k.z;var ua=this.p,ca=0==ua.b?new n:ua.c[--ua.b];ca.x=M.x;ca.y=M.y;ca.z=M.z;ca.x+=f.x*b;ca.y+=f.y*b;ca.z+=f.z*b;ca.x+=0*k.x;ca.y+=0*k.y;ca.z+=0*k.z;var Ma=this.p,va=0==Ma.b?new n:Ma.c[--Ma.b];va.x=M.x;va.y=M.y;va.z=M.z;va.x+=0*f.x;va.y+=0*f.y;va.z+=0*f.z;var Z=-b;va.x+=k.x*Z;va.y+=k.y*Z;va.z+=k.z*Z;var Pa=this.p,Fa=0==Pa.b?new n:Pa.c[--Pa.b];Fa.x=M.x;Fa.y=M.y;Fa.z=M.z;Fa.x+=0*f.x;Fa.y+=0*f.y;Fa.z+=0*f.z;Fa.x+=k.x*b;Fa.y+=k.y*b;Fa.z+=k.z*b;var Q=this.p,aa=0==Q.b?new n:Q.c[--Q.b];aa.x=w.x;aa.y=w.y;aa.z=w.z;var fa=-b;aa.x+=f.x*fa;aa.y+=f.y*fa;aa.z+=f.z*fa;aa.x+=0*k.x;aa.y+=0*k.y;aa.z+=0*k.z;var Ca=this.p,ja=0==Ca.b?new n:Ca.c[--Ca.b];ja.x=w.x;ja.y=w.y;ja.z=w.z;ja.x+=f.x*b;ja.y+=f.y*b;ja.z+=f.z*b;ja.x+=0*k.x;ja.y+=0*k.y;ja.z+=0*k.z;var Ga=this.p,P=0==Ga.b?new n:Ga.c[--Ga.b];P.x=w.x;P.y=w.y;P.z=w.z;P.x+=0*f.x;P.y+=0*f.y;P.z+=0*f.z;var Ya=-b;P.x+=k.x*Ya;P.y+=k.y*Ya;P.z+=k.z*Ya;var Ka=this.p,wb=0==Ka.b?new n:Ka.c[--Ka.b];wb.x=w.x;wb.y=w.y;wb.z=w.z;wb.x+=0*f.x;wb.y+=0*f.y;wb.z+=0*f.z;wb.x+=k.x*b;wb.y+=k.y*b;wb.z+=k.z*b;this.ellipse(M,f,k,b,b,d);this.ellipse(w,f,k,b,b,d);var ec=this.p;if(null!=Y){Y.R();if(ec.b==ec.c.length){for(var Vb=Array(ec.b<<1),Ab=0,ib=ec.b;Abyb;){var Cb=yb++,la=this.fg[Cb],ra=this.Mj[Cb];la.x=ra.x;la.y=ra.y;la.z=ra.z;var ga=la.x*q.e10+la.y*q.e11+la.z*q.e12,ma=la.x*q.e20+la.y*q.e21+la.z*q.e22;la.x=la.x*q.e00+la.y*q.e01+la.z*q.e02;la.y=ga;la.z=ma;var Ja=this.Ee[Cb],$a=this.fg[Cb];Ja.x=$a.x;Ja.y=$a.y;Ja.z=$a.z;Ja.x*=b;Ja.y*=b;Ja.z*=b;Ja.x+=p.x;Ja.y+=p.y;Ja.z+=p.z;var Oa=this.af[Cb],nc=this.Ee[Cb];Oa.x=nc.x;Oa.y=nc.y;Oa.z=nc.z;var xa=this.Ee[Cb];xa.x+=l.x*e;xa.y+=l.y*e;xa.z+=l.z*e;var Fc=this.af[Cb],eb=-e;Fc.x+=l.x*eb;Fc.y+=l.y*eb;Fc.z+=l.z*eb}for(var gb=0;8>gb;){var pb=gb++,Qa=this.fg[pb],ub=this.fg[(pb+1)%8];this.rect(this.Ee[pb],this.af[pb],this.af[(pb+1)%8],this.Ee[(pb+1)%8],Qa,Qa,ub,ub,d)}}var lb=this.p;if(null!=M){M.R();if(lb.b==lb.c.length){for(var Bb=Array(lb.b<<1),Fb=0,Nb=lb.b;Fbh;)for(var l=h++,g=this.Yh[l].length,k=0;kb;)for(h=b++,l=0;8>l;){var t=l++,A;h&&3!=h&&!this.wireframe&&(g=a[h][t],k=a[h][(t+1)%8],m=a[h+1][t],p=a[h+1][(t+1)%8],r=f[h][t],q=f[h][(t+1)%8],A=f[h+1][t],t=f[h+1][(t+1)%8],this.rect(g,m,p,k,r,A,t,q,e))}e=this.p;if(null!=c){c.R();if(e.b==e.c.length){a=Array(e.b<<1);f=0;for(b=e.b;fA.Oc)A.mg=!0,A=A.ne,A.dd=0,A.Kc=0,A.Jc=0,A.vb=0,A.mf=0,A.nf=0,A.pf=0;else{A.mg=!1;var L=b.rows[b.Da++];L.friction=p;L.Ka=0;var u=L.yg;u.sa=e;u.ta=d;u.ua=c;u.xa=e;u.ya=d;u.za=c;u.aa=A.zb*c-A.Ab*d;u.ba=A.Ab*e-A.yb*c;u.ca=A.yb*d-A.zb*e;u.da=A.Zb*c-A.$b*d;u.ea=A.$b*e-A.Yb*c;u.fa=A.Yb*d-A.Zb*e;u=L.Zj;u.sa=f;u.ta=h;u.ua=l;u.xa=f;u.ya=h;u.za=l;u.aa=A.zb*l-A.Ab*h;u.ba=A.Ab*f-A.yb*l;u.ca=A.yb*h-A.zb*f;u.da=A.Zb*l-A.$b*h;u.ea=A.$b*f-A.Yb*l;u.fa=A.Yb*h-A.Zb*f;u=L.Yj;u.sa=g;u.ta=k;u.ua=m;u.xa=g;u.ya=k;u.za=m;u.aa=A.zb*m-A.Ab*k;u.ba=A.Ab*g-A.yb*m;u.ca=A.yb*k-A.zb*g;u.da=A.Zb*m-A.$b*k;u.ea=A.$b*g-A.Yb*m;u.fa=A.Yb*k-A.Zb*g;u=L.yg;u=u.sa*this.C.jb+u.ta*this.C.kb+u.ua*this.C.lb+(u.aa*this.C.nb+u.ba*this.C.ob+u.ca*this.C.pb)-(u.xa*this.D.jb+u.ya*this.D.kb+u.za*this.D.lb+(u.da*this.D.nb+u.ea*this.D.ob+u.fa*this.D.pb));L.Fa=u<-F.contactEnableBounceThreshold&&!A.kf?-u*r:0;this.Sg==jc.BAUMGARTE&&A.Oc>F.linearSlop&&(u=(A.Oc-F.linearSlop)*F.velocityBaumgarte*a.invDt,L.Fal.Fa&&(l.Fa=0);l.qa=h.ne}}},rl:function(){this.Ia.pm(this.Ej,this.Fj)},mb:function(){return this.Ec},Cb:function(){return this.Fc},wa:function(){return this.Ia},Kk:function(){for(var a=0,b=this.Ia.oe;aF.contactPersistenceThreshold?this.Zm(a):(e+=this.Ia.Og*-c,d+=this.Ia.Pg*-c,b+=this.Ia.Qg*-c,e*e+d*d+b*b>F.contactPersistenceThreshold*F.contactPersistenceThreshold&&this.Zm(a))}},Zm:function(a){var b=--this.Ia.oe;if(a!=b){var e=this.Ia.Bc[a];this.Ia.Bc[a]=this.Ia.Bc[b];this.Ia.Bc[b]=e}a=this.Ia.Bc[b];a.Ff=0;a.Gf=0;a.Hf=0;a.If=0;a.Jf=0;a.Kf=0;a.yb=0;a.zb=0;a.Ab=0;a.Yb=0;a.Zb=0;a.$b=0;a.be=0;a.ce=0;a.de=0;a.ee=0;a.fe=0;a.ge=0;a.Oc=0;b=a.ne;b.dd=0;b.Kc=0;b.Jc=0;b.vb=0;b.mf=0;b.nf=0;b.pf=0;a.kf=!1;a.mg=!1;a.Ic=-1},Gn:function(a,b,e){var d=this.Ia.oe;if(d==F.maxManifoldPoints){var d=this.Ia.Bc[this.Nn(a,b,e)],c=a.position1;d.be=c.x;d.ce=c.y;d.de=c.z;c=a.position2;d.ee=c.x;d.fe=c.y;d.ge=c.z;d.yb=d.be-b.v;d.zb=d.ce-b.A;d.Ab=d.de-b.B;d.Yb=d.ee-e.v;d.Zb=d.fe-e.A;d.$b=d.ge-e.B;var f,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab;f=b.f*d.yb+b.m*d.zb+b.g*d.Ab;b=b.h*d.yb+b.j*d.zb+b.s*d.Ab;d.Ff=c;d.Gf=f;d.Hf=b;b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b;c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b;e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b;d.If=b;d.Jf=c;d.Kf=e;d.Oc=a.depth;e=d.ne;e.dd=0;e.Kc=0;e.Jc=0;e.vb=0;e.mf=0;e.nf=0;e.pf=0;d.Ic=a.id;d.kf=!1;d.mg=!1}else d=this.Ia.Bc[d],c=a.position1,d.be=c.x,d.ce=c.y,d.de=c.z,c=a.position2,d.ee=c.x,d.fe=c.y,d.ge=c.z,d.yb=d.be-b.v,d.zb=d.ce-b.A,d.Ab=d.de-b.B,d.Yb=d.ee-e.v,d.Zb=d.fe-e.A,d.$b=d.ge-e.B,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab,f=b.f*d.yb+b.m*d.zb+b.g*d.Ab,b=b.h*d.yb+b.j*d.zb+b.s*d.Ab,d.Ff=c,d.Gf=f,d.Hf=b,b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b,c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b,e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b,d.If=b,d.Jf=c,d.Kf=e,d.Oc=a.depth,e=d.ne,e.dd=0,e.Kc=0,e.Jc=0,e.vb=0,e.mf=0,e.nf=0,e.pf=0,d.Ic=a.id,d.kf=!1,d.mg=!1,this.Ia.oe++},Nn:function(a,b){var e=this.Ia.Bc[0],d=this.Ia.Bc[1],c=this.Ia.Bc[2],f=this.Ia.Bc[3],h=e.Oc,l=0;d.Oc>h&&(h=d.Oc,l=1);c.Oc>h&&(h=c.Oc,l=2);f.Oc>h&&(h=f.Oc,l=3);var g,k,m,p=a.position1;g=p.x;k=p.y;m=p.z;g-=b.v;k-=b.A;m-=b.B;var r=d.yb,q=d.zb,t=d.Ab,A=c.yb,L=c.zb,u=c.Ab,n=f.yb,x=f.zb,D=f.Ab,F,y,B,E,K,H,N,R,I,X,J,Da,qa,pa,ya,wa,Ea,O;F=A-r;y=L-q;B=u-t;E=g-n;K=k-x;H=m-D;N=n-r;R=x-q;I=D-t;X=g-A;J=k-L;Da=m-u;qa=g-r;pa=k-q;ya=m-t;wa=n-A;Ea=x-L;O=D-u;var sa,ba,za,Ta,C,Aa,na,La,Ba;sa=y*H-B*K;ba=B*E-F*H;za=F*K-y*E;Ta=R*Da-I*J;C=I*X-N*Da;Aa=N*J-R*X;na=pa*O-ya*Ea;La=ya*wa-qa*O;Ba=qa*Ea-pa*wa;var ta=sa*sa+ba*ba+za*za,S=Ta*Ta+C*C+Aa*Aa,ha=na*na+La*La+Ba*Ba,ea=e.yb,da=e.zb,M=e.Ab,T=c.yb,w=c.zb,V=c.Ab,ia=f.yb,Y=f.zb,oa=f.Ab,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Ca,ja,Ga,P,Ya,Ka,wb,Ua;ua=T-ea;ca=w-da;Ma=V-M;va=g-ia;Z=k-Y;Pa=m-oa;Fa=ia-ea;Q=Y-da;aa=oa-M;fa=g-T;Ca=k-w;ja=m-V;Ga=g-ea;P=k-da;Ya=m-M;Ka=ia-T;wb=Y-w;Ua=oa-V;var Vb,Ab,ib,hb,ka,Ia,ab,bb,Wa;Vb=ca*Pa-Ma*Z;Ab=Ma*va-ua*Pa;ib=ua*Z-ca*va;hb=Q*ja-aa*Ca;ka=aa*fa-Fa*ja;Ia=Fa*Ca-Q*fa;ab=P*Ua-Ya*wb;bb=Ya*Ka-Ga*Ua;Wa=Ga*wb-P*Ka;var Va=Vb*Vb+Ab*Ab+ib*ib,qb=hb*hb+ka*ka+Ia*Ia,kb=ab*ab+bb*bb+Wa*Wa,Sa=Va>qb?Va>kb?Va:kb:qb>kb?qb:kb,Na=e.yb,Za=e.zb,vb=e.Ab,mb=d.yb,xb=d.zb,nb=d.Ab,fb=f.yb,gb=f.zb,Db=f.Ab,G,sb,jb,Xb,ob,cb,zb,Xa,tb,v,W,U,db,cc,Ra,Ha,rb,yb;G=mb-Na;sb=xb-Za;jb=nb-vb;Xb=g-fb;ob=k-gb;cb=m-Db;zb=fb-Na;Xa=gb-Za;tb=Db-vb;v=g-mb;W=k-xb;U=m-nb;db=g-Na;cc=k-Za;Ra=m-vb;Ha=fb-mb;rb=gb-xb;yb=Db-nb;var Cb,la,ra,ga,ma,Ja,$a,Oa,eb;Cb=sb*cb-jb*ob;la=jb*Xb-G*cb;ra=G*ob-sb*Xb;ga=Xa*U-tb*W;ma=tb*v-zb*U;Ja=zb*W-Xa*v;$a=cc*yb-Ra*rb;Oa=Ra*Ha-db*yb;eb=db*rb-cc*Ha;var xa=Cb*Cb+la*la+ra*ra,pb=ga*ga+ma*ma+Ja*Ja,lb=$a*$a+Oa*Oa+eb*eb,Qa=xa>pb?xa>lb?xa:lb:pb>lb?pb:lb,ub=e.yb,Bb=e.zb,Fb=e.Ab,Hb=d.yb,Kb=d.zb,Lb=d.Ab,Nb=c.yb,Ic=c.zb,Yb=c.Ab,oc,Mb,Pb,rc,Jc,Gb,Qb,Jb,hc,uc,gc,Ob,Eb,Rb,Sb,Tb,$b,Zb;oc=Hb-ub;Mb=Kb-Bb;Pb=Lb-Fb;rc=g-Nb;Jc=k-Ic;Gb=m-Yb;Qb=Nb-ub;Jb=Ic-Bb;hc=Yb-Fb;uc=g-Hb;gc=k-Kb;Ob=m-Lb;Eb=g-ub;Rb=k-Bb;Sb=m-Fb;Tb=Nb-Hb;$b=Ic-Kb;Zb=Yb-Lb;var ic,bc,Wb,ac,dc,sc,kc,lc,Gc;ic=Mb*Gb-Pb*Jc;bc=Pb*rc-oc*Gb;Wb=oc*Jc-Mb*rc;ac=Jb*Ob-hc*gc;dc=hc*uc-Qb*Ob;sc=Qb*gc-Jb*uc;kc=Rb*Zb-Sb*$b;lc=Sb*Tb-Eb*Zb;Gc=Eb*$b-Rb*Tb;var pc=ic*ic+bc*bc+Wb*Wb,vc=ac*ac+dc*dc+sc*sc,qc=kc*kc+lc*lc+Gc*Gc,tc=pc>vc?pc>qc?pc:qc:vc>qc?vc:qc,jc=ta>S?ta>ha?ta:ha:S>ha?S:ha,wc=0;if(Sa>jc&&1!=l||!l)jc=Sa,wc=1;Qa>jc&&2!=l&&(jc=Qa,wc=2);tc>jc&&3!=l&&(jc=tc,wc=3);return wc},Qn:function(a,b,e){for(var d=F.contactPersistenceThreshold*F.contactPersistenceThreshold,c=-1,f=0,h=this.Ia.oe;fe?(a=this.Ma,b=this.Na,d=this.Oa,e=a*a,c=b*b,f=d*d,ed?(a=this.Ma,b=this.Na,e=this.Oa,d=a*a,c=b*b,f=e*e,dg?b=k=e=0:f==g?(e=-Infinity,k=Infinity,b-=f):bg?(e=0,k=Infinity,b=b-g-l,0>b&&(b=0)):b=k=e=0;a.Ha=e;a.Ga=k;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},nh:function(a,b,e,d,c,f,h){var l=F.angularSlop;if(h)c=0,h=1;else{if(0e?b=g=k=0:f==e?(k=-Infinity,g=Infinity,b-=f):be?(k=0,g=Infinity,b=b-e-l,0>b&&(b=0)):b=g=k=0;a.Ha=k;a.Ga=g;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},Mh:function(a,b){return b?1:this.Sg==jc.BAUMGARTE?a.invDt*F.velocityBaumgarte:0},Yg:function(a,b,e){var d=(this.C.S*a+this.C.T*b+this.C.U*e)*a+(this.C.V*a+this.C.W*b+this.C.X*e)*b+(this.C.Y*a+this.C.Z*b+this.C.$*e)*e,c=(this.D.S*a+this.D.T*b+this.D.U*e)*a+(this.D.V*a+this.D.W*b+this.D.X*e)*b+(this.D.Y*a+this.D.Z*b+this.D.$*e)*e;if(0this.nj*this.nj?this.jc.bm(this):0this.oj*this.oj&&this.jc.bm(this)},Ke:function(){return this.C},bf:function(){return this.D},hg:function(){return this.Jb},mb:function(){var a=new n;a.x=this.uf;a.y=this.vf;a.z=this.wf;return a},Kb:function(){var a=new n;a.x=this.xf;a.y=this.yf;a.z=this.zf;return a},Cb:function(a){a.x=this.uf;a.y=this.vf;a.z=this.wf},kc:function(a){a.x=this.xf;a.y=this.yf;a.z=this.zf},Fe:function(){var a=new n;a.x=this.sj;a.y=this.tj;a.z=this.uj;return a},He:function(){var a=new n;a.x=this.vj;a.y=this.wj;a.z=this.xj;return a},Ge:function(a){a.x=this.sj;a.y=this.tj;a.z=this.uj},Ie:function(a){a.x=this.vj;a.y=this.wj;a.z=this.xj},Hc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Vc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Uc:function(a){var b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},Wc:function(a){var b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},wa:function(){return this.Sk},ig:function(a){this.Sk=a},vd:function(){return this.nj},jg:function(a){this.nj=a},ie:function(){return this.oj},kg:function(a){this.oj=a},Je:function(){return this.Sg},ph:function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.Sg=a},lc:function(){var a=new n;a.x=this.ej;a.y=this.fj;a.z=this.gj;return a},wc:function(a){a.x=this.ej;a.y=this.fj;a.z=this.gj},xc:function(){var a=new n;a.x=this.hj;a.y=this.ij;a.z=this.jj;return a},Dc:function(a){a.x=this.hj;a.y=this.ij;a.z=this.jj},gg:function(){return this.ia},cf:function(){return this.M}};Fb.wa=N;Fb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Re*d,d=this.Se*d,l,g=this.Yg(this.N.pc,this.N.qc,this.N.rc);if(0>=this.ul.frequency||!e){l=this.Eb[0];var k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=null;k.qa=l;this.ak(k,this.Bg,this.tl,1/(this.C.qb+this.D.qb),this.ul,b,e);l=k.va;l.sa=this.N.pc;l.ta=this.N.qc;l.ua=this.N.rc;l.xa=this.N.pc;l.ya=this.N.qc;l.za=this.N.rc;l.aa=this.bc*this.N.rc-this.cc*this.N.qc;l.ba=this.cc*this.N.pc-this.ac*this.N.rc;l.ca=this.ac*this.N.qc-this.bc*this.N.pc;l.da=this.ec*this.N.rc-this.fc*this.N.qc;l.ea=this.fc*this.N.pc-this.dc*this.N.rc;l.fa=this.dc*this.N.qc-this.ec*this.N.pc}l=this.Eb[1];k=a.rows[a.Da++];m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=l;k.Fa=c;k.Ka=0;k.Ha=-Infinity;k.Ga=Infinity;l=k.va;l.sa=this.N.yc;l.ta=this.N.zc;l.ua=this.N.Ac;l.xa=this.N.yc;l.ya=this.N.zc;l.za=this.N.Ac;l.aa=this.bc*this.N.Ac-this.cc*this.N.zc;l.ba=this.cc*this.N.yc-this.ac*this.N.Ac;l.ca=this.ac*this.N.zc-this.bc*this.N.yc;l.da=this.ec*this.N.Ac-this.fc*this.N.zc;l.ea=this.fc*this.N.yc-this.dc*this.N.Ac;l.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];l=a.rows[a.Da++];k=l.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;l.Fa=0;l.Ka=0;l.Ha=0;l.Ga=0;l.motorSpeed=0;l.tb=0;l.qa=c;l.Fa=f;l.Ka=0;l.Ha=-Infinity;l.Ga=Infinity;l=l.va;l.sa=this.N.Lc;l.ta=this.N.Mc;l.ua=this.N.Nc;l.xa=this.N.Lc;l.ya=this.N.Mc;l.za=this.N.Nc;l.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;l.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;l.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;l.da=this.ec*this.N.Nc-this.fc*this.N.Mc;l.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;l.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;if(0>=this.nl.frequency||!e)f=this.Eb[3],c=a.rows[a.Da++],l=c.va,l.sa=0,l.ta=0,l.ua=0,l.xa=0,l.ya=0,l.za=0,l.aa=0,l.ba=0,l.ca=0,l.da=0,l.ea=0,l.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.angle,this.ml,g,this.nl,b,e),l=c.va,l.aa=this.N.pc,l.ba=this.N.qc,l.ca=this.N.rc,l.da=this.N.pc,l.ea=this.N.qc,l.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=h;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;l=e.va;l.aa=this.N.yc;l.ba=this.N.zc;l.ca=this.N.Ac;l.da=this.N.yc;l.ea=this.N.zc;l.fa=this.N.Ac;h=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=h;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;l=a.va;l.aa=this.N.Lc;l.ba=this.N.Mc;l.ca=this.N.Nc;l.da=this.N.Lc;l.ea=this.N.Mc;l.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>pb*this.N.pc+xa*this.N.qc+lb*this.N.rc&&(this.angle=-this.angle);var Qa,ub,Bb;Qa=this.xf-this.uf;ub=this.yf-this.vf;Bb=this.zf-this.wf;this.Bg=Qa*this.N.pc+ub*this.N.qc+Bb*this.N.rc;this.Xf=Qa*this.N.yc+ub*this.N.zc+Bb*this.N.Ac;this.Yf=Qa*this.N.Lc+ub*this.N.Mc+Bb*this.N.Nc},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},po:function(){return this.ul},eo:function(){return this.nl},no:function(){return this.tl},bo:function(){return this.ml},Gl:function(){return this.angle},Jl:function(){return this.Bg}});Gb.prototype={Mg:function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var d=this.rigidBody1;a=this.localAnchor1;var c,f,h;c=e.x;f=e.y;h=e.z;c-=d.a.v;f-=d.a.A;h-=d.a.B;var l;b=d.a.o*c+d.a.i*f+d.a.l*h;l=d.a.f*c+d.a.m*f+d.a.g*h;d=d.a.h*c+d.a.j*f+d.a.s*h;a.x=b;a.y=l;a.z=d;b=this.rigidBody2;a=this.localAnchor2;l=e.x;d=e.y;f=e.z;l-=b.a.v;d-=b.a.A;f-=b.a.B;e=b.a.o*l+b.a.i*d+b.a.l*f;c=b.a.f*l+b.a.m*d+b.a.g*f;b=b.a.h*l+b.a.j*d+b.a.s*f;a.x=e;a.y=c;a.z=b}};wf.wa=Gb;wf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});Sb.wa=N;Sb.prototype=gb(N.prototype,{ud:function(a,b,e){var d,c=1/(this.C.qb+this.D.qb),f=this.Yg(this.wd,this.xd,this.yd),h=this.Yg(this.kd,this.ld,this.md),l=this.Yg(this.zd,this.Ad,this.Bd);if(0>=this.Rf[0].frequency||!e){d=this.Eb[0];var g=a.rows[a.Da++],k=g.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;g.Fa=0;g.Ka=0;g.Ha=0;g.Ga=0;g.motorSpeed=0;g.tb=0;g.qa=d;this.ak(g,this.translationX,this.qg[0],c,this.Rf[0],b,e);d=g.va;d.sa=this.fb;d.ta=this.gb;d.ua=this.hb;d.xa=this.fb;d.ya=this.gb;d.za=this.hb;d.aa=this.bc*this.hb-this.cc*this.gb;d.ba=this.cc*this.fb-this.ac*this.hb;d.ca=this.ac*this.gb-this.bc*this.fb;d.da=this.ec*this.hb-this.fc*this.gb;d.ea=this.fc*this.fb-this.dc*this.hb;d.fa=this.dc*this.gb-this.ec*this.fb}if(0>=this.Rf[1].frequency||!e)d=this.Eb[1],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.translationY,this.qg[1],c,this.Rf[1],b,e),d=g.va,d.sa=this.Xc,d.ta=this.Yc,d.ua=this.Zc,d.xa=this.Xc,d.ya=this.Yc,d.za=this.Zc,d.aa=this.bc*this.Zc-this.cc*this.Yc,d.ba=this.cc*this.Xc-this.ac*this.Zc,d.ca=this.ac*this.Yc-this.bc*this.Xc,d.da=this.ec*this.Zc-this.fc*this.Yc,d.ea=this.fc*this.Xc-this.dc*this.Zc,d.fa=this.dc*this.Yc-this.ec*this.Xc;if(0>=this.Rf[2].frequency||!e)d=this.Eb[2],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.cm,this.qg[2],c,this.Rf[2],b,e),d=g.va,d.sa=this.ve,d.ta=this.we,d.ua=this.xe,d.xa=this.ve,d.ya=this.we,d.za=this.xe,d.aa=this.bc*this.xe-this.cc*this.we,d.ba=this.cc*this.ve-this.ac*this.xe,d.ca=this.ac*this.we-this.bc*this.ve,d.da=this.ec*this.xe-this.fc*this.we,d.ea=this.fc*this.ve-this.dc*this.xe,d.fa=this.dc*this.we-this.ec*this.ve;this.dk||!(0>=this.Tg[0].frequency)&&e||(c=this.Eb[3],d=a.rows[a.Da++],g=d.va,g.sa=0,g.ta=0,g.ua=0,g.xa=0,g.ya=0,g.za=0,g.aa=0,g.ba=0,g.ca=0,g.da=0,g.ea=0,g.fa=0,d.Fa=0,d.Ka=0,d.Ha=0,d.Ga=0,d.motorSpeed=0,d.tb=0,d.qa=c,this.nh(d,this.Af,this.pg[0],f,this.Tg[0],b,e),d=d.va,d.aa=this.wd,d.ba=this.xd,d.ca=this.yd,d.da=this.wd,d.ea=this.xd,d.fa=this.yd);this.ek||!(0>=this.Tg[1].frequency)&&e||(f=this.Eb[4],c=a.rows[a.Da++],d=c.va,d.sa=0,d.ta=0,d.ua=0,d.xa=0,d.ya=0,d.za=0,d.aa=0,d.ba=0,d.ca=0,d.da=0,d.ea=0,d.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.qh,this.pg[1],h,this.Tg[1],b,e),d=c.va,d.aa=this.kd,d.ba=this.ld,d.ca=this.md,d.da=this.kd,d.ea=this.ld,d.fa=this.md);this.fk||!(0>=this.Tg[2].frequency)&&e||(h=this.Eb[5],a=a.rows[a.Da++],f=a.va,f.sa=0,f.ta=0,f.ua=0,f.xa=0,f.ya=0,f.za=0,f.aa=0,f.ba=0,f.ca=0,f.da=0,f.ea=0,f.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=h,this.nh(a,this.Bf,this.pg[2],l,this.Tg[2],b,e),d=a.va,d.aa=this.zd,d.ba=this.Ad,d.ca=this.Bd,d.da=this.zd,d.ea=this.Ad,d.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;a=this.xf-this.uf;b=this.yf-this.vf;e=this.zf-this.wf;this.translationX=a*this.fb+b*this.gb+e*this.hb;this.translationY=a*this.Xc+b*this.Yc+e*this.Zc;this.cm=a*this.ve+b*this.we+e*this.xe},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Un:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},Vn:function(){var a=new n;a.x=this.kd;a.y=this.ld;a.z=this.md;return a},Wn:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},qo:function(){return this.Rf.slice(0)},fo:function(){return this.Rf.slice(0)},oo:function(){return this.qg.slice(0)},co:function(){return this.pg.slice(0)},Tn:function(){return new n(this.Af,this.qh,this.Bf)},ro:function(){return new n(this.translationX,this.translationY,this.cm)}});Lg.wa=Gb;Lg.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);var f=a.a;b=b.a;var h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B;h=d.e00;l=d.e01;g=d.e02;k=d.e10;m=d.e11;p=d.e12;r=d.e20;q=d.e21;t=d.e22;A=c.e00;n=c.e01;u=c.e02;z=c.e10;x=c.e11;D=c.e12;F=c.e20;y=c.e21;B=c.e22;var E,K;c=f.o*h+f.i*k+f.l*r;d=f.o*l+f.i*m+f.l*q;a=f.o*g+f.i*p+f.l*t;e=f.f*h+f.m*k+f.g*r;E=f.f*l+f.m*m+f.g*q;K=f.f*g+f.m*p+f.g*t;h=f.h*h+f.j*k+f.s*r;l=f.h*l+f.j*m+f.s*q;k=f.h*g+f.j*p+f.s*t;f=b.o*A+b.i*z+b.l*F;g=b.o*n+b.i*x+b.l*y;p=b.o*u+b.i*D+b.l*B;m=b.f*A+b.m*z+b.g*F;q=b.f*n+b.m*x+b.g*y;t=b.f*u+b.m*D+b.g*B;A=b.h*A+b.j*z+b.s*F;n=b.h*n+b.j*x+b.s*y;b=b.h*u+b.j*D+b.s*B;u=this.localBasis1;u.e00=c;u.e01=d;u.e02=a;u.e10=e;u.e11=E;u.e12=K;u.e20=h;u.e21=l;u.e22=k;c=this.localBasis2;c.e00=f;c.e01=g;c.e02=p;c.e10=m;c.e11=q;c.e12=t;c.e20=A;c.e21=n;c.e22=b;return this}});qc.prototype={wa:function(){return this.gl},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};Jb.wa=N;Jb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Jh*d,l=this.Re*d,d=this.Se*d;if(0>=this.Pe.frequency||!e){var g=this.Eb[0],k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=g;this.ak(k,this.Bg,this.fi,1/(this.C.qb+this.D.qb),this.Pe,b,e);b=k.va;b.sa=this.N.pc;b.ta=this.N.qc;b.ua=this.N.rc;b.xa=this.N.pc;b.ya=this.N.qc;b.za=this.N.rc;b.aa=this.bc*this.N.rc-this.cc*this.N.qc;b.ba=this.cc*this.N.pc-this.ac*this.N.rc;b.ca=this.ac*this.N.qc-this.bc*this.N.pc;b.da=this.ec*this.N.rc-this.fc*this.N.qc;b.ea=this.fc*this.N.pc-this.dc*this.N.rc;b.fa=this.dc*this.N.qc-this.ec*this.N.pc}b=this.Eb[1];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=c;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;b=e.va;b.sa=this.N.yc;b.ta=this.N.zc;b.ua=this.N.Ac;b.xa=this.N.yc;b.ya=this.N.zc;b.za=this.N.Ac;b.aa=this.bc*this.N.Ac-this.cc*this.N.zc;b.ba=this.cc*this.N.yc-this.ac*this.N.Ac;b.ca=this.ac*this.N.zc-this.bc*this.N.yc;b.da=this.ec*this.N.Ac-this.fc*this.N.zc;b.ea=this.fc*this.N.yc-this.dc*this.N.Ac;b.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];b=a.rows[a.Da++];e=b.va;e.sa=0;e.ta=0;e.ua=0;e.xa=0;e.ya=0;e.za=0;e.aa=0;e.ba=0;e.ca=0;e.da=0;e.ea=0;e.fa=0;b.Fa=0;b.Ka=0;b.Ha=0;b.Ga=0;b.motorSpeed=0;b.tb=0;b.qa=c;b.Fa=f;b.Ka=0;b.Ha=-Infinity;b.Ga=Infinity;b=b.va;b.sa=this.N.Lc;b.ta=this.N.Mc;b.ua=this.N.Nc;b.xa=this.N.Lc;b.ya=this.N.Mc;b.za=this.N.Nc;b.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;b.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;b.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;b.da=this.ec*this.N.Nc-this.fc*this.N.Mc;b.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;b.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;f=this.Eb[3];c=a.rows[a.Da++];b=c.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;c.Fa=0;c.Ka=0;c.Ha=0;c.Ga=0;c.motorSpeed=0;c.tb=0;c.qa=f;c.Fa=h;c.Ka=0;c.Ha=-Infinity;c.Ga=Infinity;b=c.va;b.aa=1;b.ba=0;b.ca=0;b.da=1;b.ea=0;b.fa=0;h=this.Eb[4];f=a.rows[a.Da++];c=f.va;c.sa=0;c.ta=0;c.ua=0;c.xa=0;c.ya=0;c.za=0;c.aa=0;c.ba=0;c.ca=0;c.da=0;c.ea=0;c.fa=0;f.Fa=0;f.Ka=0;f.Ha=0;f.Ga=0;f.motorSpeed=0;f.tb=0;f.qa=h;f.Fa=l;f.Ka=0;f.Ha=-Infinity;f.Ga=Infinity;b=f.va;b.aa=0;b.ba=1;b.ca=0;b.da=0;b.ea=1;b.fa=0;l=this.Eb[5];a=a.rows[a.Da++];h=a.va;h.sa=0;h.ta=0;h.ua=0;h.xa=0;h.ya=0;h.za=0;h.aa=0;h.ba=0;h.ca=0;h.da=0;h.ea=0;h.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;b=a.va;b.aa=0;b.ba=0;b.ca=1;b.da=0;b.ea=0;b.fa=1},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qbJb?Gb>gc?(Eb=Math.sqrt(Gb-Jb-gc+1),Sb=.5*Eb,Eb=.5/Eb,Tb=(Yb+Qb)*Eb,hc=(oc+Ob)*Eb,uc=(Rb-rc)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb):Jb>gc?(Eb=Math.sqrt(Jb-gc-Gb+1),Tb=.5*Eb,Eb=.5/Eb,Sb=(Yb+Qb)*Eb,hc=(rc+Rb)*Eb,uc=(oc-Ob)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb);var Zb=uc,bc=2*(-1>=Zb?3.14159265358979:1<=Zb?0:Math.acos(Zb));this.Jh=Sb;this.Re=Tb;this.Se=hc;var Wb=this.Jh*this.Jh+this.Re*this.Re+this.Se*this.Se;0=this.ql.frequency||!e)&&(h=this.Eb[3],p=a.rows[a.Da++],r=p.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,p.Fa=0,p.Ka=0,p.Ha=0,p.Ga=0,p.motorSpeed=0,p.tb=0,p.qa=h,this.nh(p,this.bk,this.Fl,x,this.ql,b,e),c=p.va,c.aa=this.Be,c.ba=this.Ce,c.ca=this.De,c.da=this.Be,c.ea=this.Ce,c.fa=this.De);if(0>=this.wl.frequency||!e)x=this.Eb[4],a=a.rows[a.Da++],h=a.va,h.sa=0,h.ta=0,h.ua=0,h.xa=0,h.ya=0,h.za=0,h.aa=0,h.ba=0,h.ca=0,h.da=0,h.ea=0,h.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=x,this.nh(a,this.Hj,this.vl,d,this.wl,b,e),c=a.va,c.aa=this.Ai,c.ba=this.Bi,c.ca=this.Ci,c.da=this.Ai,c.ea=this.Bi,c.fa=this.Ci},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f;a=this.fb;b=this.gb;e=this.hb;d=this.Ob;c=this.Pb;f=this.Qb;var h,l,g,k,m,p,r,q,t;h=this.fb;l=this.Xc;g=this.ve;k=this.gb;m=this.Yc;p=this.we;r=this.hb;q=this.Zc;t=this.xe;var A,n,u,z,x,D,F,y;D=a*d+b*c+e*f;-.999999999>D?(x=a*a,d=b*b,c=e*e,x=z?3.14159265358979:1<=z?0:Math.acos(z));z=A;y=u;u=a*this.se+x*this.te+D*this.ue;B=b*this.se+d*this.te+f*this.ue;A=e*this.se+c*this.te+F*this.ue;this.Hj=Math.atan2(this.ve*u+this.we*B+this.xe*A,this.Xc*u+this.Yc*B+this.Zc*A);this.Ai=this.fb+this.Ob;this.Bi=this.gb+this.Pb;this.Ci=this.hb+this.Qb;A=this.Ai*this.Ai+this.Bi*this.Bi+this.Ci*this.Ci;0=this.Pe.frequency||!e)h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.angle,this.fi,D,this.Pe,b,e),c=r.va,c.aa=this.N.pc,c.ba=this.N.qc,c.ca=this.N.rc,c.da=this.N.pc,c.ea=this.N.qc,c.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];D=e.va;D.sa=0;D.ta=0;D.ua=0;D.xa=0;D.ya=0;D.za=0;D.aa=0;D.ba=0;D.ca=0;D.da=0;D.ea=0;D.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=l;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;c=e.va;c.aa=this.N.yc;c.ba=this.N.zc;c.ca=this.N.Ac;c.da=this.N.yc;c.ea=this.N.zc;c.fa=this.N.Ac;l=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;c=a.va;c.aa=this.N.Lc;c.ba=this.N.Mc;c.ca=this.N.Nc;c.da=this.N.Lc;c.ea=this.N.Mc;c.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>Qa*this.N.pc+xa*this.N.qc+ub*this.N.rc&&(this.angle=-this.angle);this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},Qj:function(){return this.Pe},Il:function(){return this.fi},Gl:function(){return this.angle}});ff.wa=Gb;ff.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});$b.prototype={mh:function(a,b){this.lowerLimit=a;this.upperLimit=b;return this},wa:function(a,b){this.motorSpeed=a;this.motorTorque=b;return this},clone:function(){var a=new $b;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed=this.motorSpeed;a.motorTorque=this.motorTorque;return a}};se.wa=N;se.prototype=gb(N.prototype,{ud:function(a,b,e){if(!(0=this.ol.frequency)&&e||(h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.Af,this.hl,D,this.ol,b,e),c=r.va,c.aa=this.wd,c.ba=this.xd,c.ca=this.yd,c.da=this.wd,c.ea=this.xd,c.fa=this.yd);this.ek||(D=this.Eb[4],h=a.rows[a.Da++],r=h.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,h.Fa=0,h.Ka=0,h.Ha=0,h.Ga=0,h.motorSpeed=0,h.tb=0,h.qa=D,h.Fa=l,h.Ka=0,h.Ha=-Infinity,h.Ga=Infinity,c=h.va,c.aa=this.kd,c.ba=this.ld,c.ca=this.md,c.da=this.kd,c.ea=this.ld,c.fa=this.md);this.fk||!(0>=this.pl.frequency)&&e||(l=this.Eb[5],a=a.rows[a.Da++],D=a.va,D.sa=0,D.ta=0,D.ua=0,D.xa=0,D.ya=0,D.za=0,D.aa=0,D.ba=0,D.ca=0,D.da=0,D.ea=0,D.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=l,this.nh(a,this.Bf,this.il,d,this.pl,b,e),c=a.va,c.aa=this.zd,c.ba=this.Ad,c.ca=this.Bd,c.da=this.zd,c.ea=this.Ad,c.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Cf;a.y=this.Df;a.z=this.Ef},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.nd;a.y=this.od;a.z=this.pd;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.nd;a.y=this.od;a.z=this.pd},ho:function(){return this.ol},io:function(){return this.pl},$n:function(){return this.hl},ao:function(){return this.il},Rn:function(){return this.Af},Sn:function(){return this.Bf}});Kf.wa=Gb;Kf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);e=this.localAxis1;var f,h,l;f=d.x;h=d.y;l=d.z;var g;d=a.a.o*f+a.a.i*h+a.a.l*l;g=a.a.f*f+a.a.m*h+a.a.g*l;a=a.a.h*f+a.a.j*h+a.a.s*l;e.x=d;e.y=g;e.z=a;a=this.localAxis2;e=c.x;f=c.y;d=c.z;c=b.a.o*e+b.a.i*f+b.a.l*d;h=b.a.f*e+b.a.m*f+b.a.g*d;b=b.a.h*e+b.a.j*f+b.a.s*d;a.x=c;a.y=h;a.z=b;return this}});tj.prototype={Aa:function(a){this.ed=a.ed;for(var b=0,e=this.ed;bp?r.Ha:0q.Ga+F.directMlcpSolverEps){b=!1;break}c[r]=A-t}if(h)return!0;if(!b)return!1;h=0;for(g=this.ed;hp&&k>F.directMlcpSolverEps||0e.Ga;0==e.Ha&&0==e.Ga?(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=0,c.ed++,this.mi(a,b+1),this.lf.ed--):(e=this.lf,e.hh[e.Ae]=b,e.Ae++,this.mi(a,b+1),this.lf.Ae--,d&&(d=this.lf,d.Nh[d.ed]=b,d.Sh[d.ed]=-1,d.ed++,this.mi(a,b+1),this.lf.ed--),c&&(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=1,c.ed++,this.mi(a,b+1),this.lf.ed--))}}};Mi.prototype={};Wb.wa=Ob;Wb.prototype=gb(Ob.prototype,{Qh:function(a){this.ga.bd();this.ga.Sd(a,this.info);this.C=this.info.Ye;this.D=this.info.Ze;this.yi.Dl(this.info,this.Wb);a=this.$e;a.sf=0;var b=a.lf;b.ed=0;b.Ae=0;a.mi(this.info,0);a=this.em;for(var b=this.$e.sf,e=0,d=0,c=0,f=a.n;c=b)for(b=0,a=this.info.Da;bc.Ga&&(h=c.Ga);f.qa=h;0c&&(h=c),f.Dd=h):f.Dd=0;this.Wf[d]=f.qa+f.Dd}var b=this.Wf,e=a=!1,l,g,k,m,p,r,q,t,d=this.C.jb,f=this.C.kb,c=this.C.lb,h=this.D.jb;l=this.D.kb;g=this.D.lb;k=this.C.nb;m=this.C.ob;p=this.C.pb;r=this.D.nb;q=this.D.ob;t=this.D.pb;for(var A=0,n=this.info.Da;Al&&(h=l),c.Dd=h,c=h-f,this.Oj[d]=c,f=0;fna){var ta=na*na;La=.5*(1-.16666666666666666*ta+ta*ta*.008333333333333333);Ba=1-.5*ta+ta*ta*.041666666666666664}else La=Math.sin(na)/Aa,Ba=Math.cos(na);var S,ha,ea;S=N*La;ha=X*La;ea=pa*La;var da,M,T,w;da=S;M=ha;T=ea;w=Ba;var V,ia,Y,oa,ua=C.a.o,ca=C.a.m,Ma=C.a.s,va=ua+ca+Ma,Z;0ca?ua>Ma?(Z=Math.sqrt(ua-ca-Ma+1),V=.5*Z,Z=.5/Z,ia=(C.a.f+C.a.i)*Z,Y=(C.a.h+C.a.l)*Z,oa=(C.a.g-C.a.j)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z):ca>Ma?(Z=Math.sqrt(ca-Ma-ua+1),ia=.5*Z,Z=.5/Z,V=(C.a.f+C.a.i)*Z,Y=(C.a.j+C.a.g)*Z,oa=(C.a.h-C.a.l)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z);V=w*V+da*oa+M*Y-T*ia;ia=w*ia-da*Y+M*oa+T*V;Y=w*Y+da*ia-M*V+T*oa;oa=w*oa-da*V-M*ia-T*Y;var Pa=V*V+ia*ia+Y*Y+oa*oa;1E-32jb){var cb=jb*jb;lb=.5*(1-.16666666666666666*cb+cb*cb*.008333333333333333);ob=1-.5*cb+cb*cb*.041666666666666664}else lb=Math.sin(jb)/sb,ob=Math.cos(jb);var zb,Xa,tb;zb=Da*lb;Xa=qa*lb;tb=wa*lb;var v,W,U,db;v=zb;W=Xa;U=tb;db=ob;var Qa,Ra,Ha,rb,yb=G.a.o,Cb=G.a.m,la=G.a.s,ra=yb+Cb+la,ga;0Cb?yb>la?(ga=Math.sqrt(yb-Cb-la+1),Qa=.5*ga,ga=.5/ga,Ra=(G.a.f+G.a.i)*ga,Ha=(G.a.h+G.a.l)*ga,rb=(G.a.g-G.a.j)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga):Cb>la?(ga=Math.sqrt(Cb-la-yb+1),Ra=.5*ga,ga=.5/ga,Qa=(G.a.f+G.a.i)*ga,Ha=(G.a.j+G.a.g)*ga,rb=(G.a.h-G.a.l)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga);Qa=db*Qa+v*rb+W*Ha-U*Ra;Ra=db*Ra-v*Ha+W*rb+U*Qa;Ha=db*Ha+v*Ra-W*Qa+U*rb;rb=db*rb-v*Qa-W*Ra-U*Ha;var ma=Qa*Qa+Ra*Ra+Ha*Ha+rb*rb;1E-32n*n&&(n/=Math.sqrt(z),x.Kc*=n,x.Jc*=n)):(x.Kc=0,x.Jc=0);z=x.Kc-u;D=x.Jc-F;a+=t.Ql*z;b+=t.Rl*z;e+=t.Sl*z;a+=t.Kl*D;b+=t.Ll*D;e+=t.Ml*D;d+=t.Tl*-z;c+=t.Ul*-z;f+=t.Vl*-z;d+=t.Nl*-D;c+=t.Ol*-D;f+=t.Pl*-D;h+=t.Sj*z;l+=t.Tj*z;g+=t.Uj*z;h+=t.Ek*D;l+=t.Fk*D;g+=t.Gk*D;k+=t.Vj*-z;m+=t.Wj*-z;p+=t.Xj*-z;k+=t.Hk*-D;m+=t.Ik*-D;p+=t.Jk*-D}r=0;for(q=this.info.Da;rx.dd&&(x.dd=0),n=x.dd-u,a+=t.si*n,b+=t.ti*n,e+=t.ui*n,d+=t.vi*-n,c+=t.wi*-n,f+=t.xi*-n,h+=t.sg*n,l+=t.tg*n,g+=t.ug*n,k+=t.vg*-n,m+=t.wg*-n,p+=t.xg*-n;this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},jh:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,F;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;F=this.D.$;for(var D=0,I=this.info.Da;Dx.vb&&(x.vb=0);n=x.vb-u;a+=t.si*n;b+=t.ti*n;e+=t.ui*n;d+=t.vi*-n;c+=t.wi*-n;f+=t.xi*-n;h+=t.sg*n;l+=t.tg*n;g+=t.ug*n;k+=t.vg*-n;m+=t.wg*-n;p+=t.xg*-n}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,I;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;I=this.D.$;for(var D=0,J=this.info.Da;Dta.vb&&(ta.vb=0);ea=ta.vb-da;wa+=Ba.si*ea;Da+=Ba.ti*ea;qa+=Ba.ui*ea;Ca+=Ba.vi*-ea;ya+=Ba.wi*-ea;Ka+=Ba.xi*-ea;Ea+=Ba.sg*ea;O+=Ba.tg*ea;sa+=Ba.ug*ea;ba+=Ba.vg*-ea;za+=Ba.wg*-ea;Ta+=Ba.xg*-ea}var M=this.C;M.a.v+=wa;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ca;T.a.A+=ya;T.a.B+=Ka;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Qa=w.a.m,ja=w.a.s,Ga=fa+Qa+ja,P;0Qa?fa>ja?(P=Math.sqrt(fa-Qa-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Qa>ja?(P=Math.sqrt(Qa-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Fb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Fb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Fb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Hb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Gb=la*la+ra*ra+ga*ga+ma*ma;1E-32=b)for(b=0,a=this.info.Da;bx.tb&&(F.Dd=x.tb);z=F.Dd-I;u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z);u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z)}}r=0;for(q=this.info.Da;rx.Ga&&(F.qa=x.Ga),z=F.qa-I,u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z),u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z);this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},cj:function(a){for(var b,e,d,c,f,h,l=h=f=c=d=e=b=0,g=this.info.Da;lx.Ga&&(I.vb=x.Ga);u=I.vb-z;a+=n.Kd*u;b+=n.Ld*u;e+=n.Md*u;d+=n.Nd*-u;c+=n.Od*-u;f+=n.Pd*-u;h+=n.Ed*u;l+=n.Fd*u;g+=n.Gd*u;k+=n.Hd*-u;m+=n.Id*-u;p+=n.Jd*-u}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.ga.bd();this.ga.$c(this.info);this.C=this.info.Ye;this.D=this.info.Ze;var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,n,t,x,I,u,z,J;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;n=this.D.U;t=this.D.V;x=this.D.W;I=this.D.X;u=this.D.Y;z=this.D.Z;J=this.D.$;for(var D=0,N=this.info.Da;DLa.Ga&&(ta.vb=La.Ga);ea=ta.vb-da;Ca+=Ba.Kd*ea;Da+=Ba.Ld*ea;qa+=Ba.Md*ea;Ka+=Ba.Nd*-ea;ya+=Ba.Od*-ea;Qa+=Ba.Pd*-ea;Ea+=Ba.Ed*ea;O+=Ba.Fd*ea;sa+=Ba.Gd*ea;ba+=Ba.Hd*-ea;za+=Ba.Id*-ea;Ta+=Ba.Jd*-ea}var M=this.C;M.a.v+=Ca;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ka;T.a.A+=ya;T.a.B+=Qa;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Ua=w.a.m,ja=w.a.s,Ga=fa+Ua+ja,P;0Ua?fa>ja?(P=Math.sqrt(fa-Ua-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Ua>ja?(P=Math.sqrt(Ua-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Gb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Gb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Gb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Jb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Hb=la*la+ra*ra+ga*ga+ma*ma;1E-32F.maxTranslationPerStep*F.maxTranslationPerStep&&(h=F.maxTranslationPerStep/Math.sqrt(h),this.jb*=h,this.kb*=h,this.lb*=h,b*=h,e*=h,d*=h);l>F.maxRotationPerStep*F.maxRotationPerStep&&(l=F.maxRotationPerStep/Math.sqrt(l),this.nb*=l,this.ob*=l,this.pb*=l,c*=l,f*=l,a*=l);this.a.v+=b;this.a.A+=e;this.a.B+=d;b=Math.sqrt(c*c+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));c*=b;f*=b;a*=b;b=e;e=this.a.o;d=this.a.m;var l=this.a.s,h=e+d+l,g;0d?e>l?(g=Math.sqrt(e-d-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,d=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):d>l?(g=Math.sqrt(d-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,d=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+c*e+f*d-a*l;l=b*l-c*d+f*e+a*h;d=b*d+c*l-f*h+a*e;e=b*e-c*h-f*l-a*d;a=h*h+l*l+d*d+e*e;1E-32b?(b*=b,a=.5*(1-.16666666666666666*b+b*b*.008333333333333333),b=1-.5*b+b*b*.041666666666666664):(a=Math.sin(b)/a,b=Math.cos(b));d*=a;c*=a;f*=a;a=b;var h,l;b=this.a.o;e=this.a.m;l=this.a.s;h=b+e+l;var g;0e?b>l?(g=Math.sqrt(b-e-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,e=(this.a.h+this.a.l)*g,b=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g):e>l?(g=Math.sqrt(e-l-b+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,e=(this.a.j+this.a.g)*g,b=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g);h=a*h+d*b+c*e-f*l;l=a*l-d*e+c*b+f*h;e=a*e+d*l-c*h+f*b;b=a*b-d*h-c*l-f*e;c=h*h+l*l+e*e+b*b;1E-32d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},cn:function(a){var b,e;b=a.x;e=a.y;a=a.z;this.a.v+=b;this.a.A+=e;this.a.B+=a;b=this.ja;e=this.a;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;for(b=this.Gc;null!=b;){e=b.M;var d=this.ja;a=this.a;var c=b.ja,f=b.ha,h,l,g,k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=b.a;c=b.ha;f=a.o*c.o+a.f*c.i+a.h*c.l;h=a.o*c.f+a.f*c.m+a.h*c.g;l=a.o*c.h+a.f*c.j+a.h*c.s;g=a.i*c.o+a.m*c.i+a.j*c.l;k=a.i*c.f+a.m*c.m+a.j*c.g;m=a.i*c.h+a.m*c.j+a.j*c.s;p=a.l*c.o+a.g*c.i+a.s*c.l;n=a.l*c.f+a.g*c.m+a.s*c.g;q=a.l*c.h+a.g*c.j+a.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=a.o*c.v+a.f*c.A+a.h*c.B;h=a.i*c.v+a.m*c.A+a.j*c.B;c=a.l*c.v+a.g*c.A+a.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=a.v;d.A+=a.A;d.B+=a.B;b.Fb.Lb(b.u,b.ja);a=b.u.na;d=b.u.oa;c=b.u.pa;f=b.u.ka;h=b.u.la;l=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=ab.u.ka?f:b.u.ka;b.u.la=h>b.u.la?h:b.u.la;b.u.ma=l>b.u.ma?l:b.u.ma;null!=b.ub&&(a=b.a.v-b.ja.v,d=b.a.A-b.ja.A,c=b.a.B-b.ja.B,f=b.mc,f.x=a,f.y=d,f.z=c,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}this.Bb=!1;this.wb=0},Vm:function(){var a=new I;a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s;return a},Wm:function(a){a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s},Qo:function(a){this.a.o=a.e00;this.a.f=a.e01;this.a.h=a.e02;this.a.i=a.e10;this.a.m=a.e11;this.a.j=a.e12;this.a.l=a.e20;this.a.g=a.e21;this.a.s=a.e22;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},Ro:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;a=Math.sin(b);var c=Math.sin(e),f=Math.sin(d);b=Math.cos(b);e=Math.cos(e);d=Math.cos(d);this.a.o=e*d;this.a.f=-e*f;this.a.h=c;this.a.i=b*f+d*a*c;this.a.m=b*d-a*c*f;this.a.j=-e*a;this.a.l=a*f-b*d*c;this.a.g=d*a+b*c*f;this.a.s=b*e;var h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;c=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;f=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;e=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;b=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;c=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;f=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;e=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;b=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;c=this.a;a.v=c.v;a.A=c.A;a.B=c.B;a.o=c.o;a.f=c.f;a.h=c.h;a.i=c.i;a.m=c.m;a.j=c.j;a.l=c.l;a.g=c.g;a.s=c.s;for(a=this.Gc;null!=a;){c=a.M;e=this.ja;f=this.a;d=a.ja;b=a.ha;var k,m,p,n,q,t;h=e.o*b.o+e.f*b.i+e.h*b.l;l=e.o*b.f+e.f*b.m+e.h*b.g;g=e.o*b.h+e.f*b.j+e.h*b.s;k=e.i*b.o+e.m*b.i+e.j*b.l;m=e.i*b.f+e.m*b.m+e.j*b.g;p=e.i*b.h+e.m*b.j+e.j*b.s;n=e.l*b.o+e.g*b.i+e.s*b.l;q=e.l*b.f+e.g*b.m+e.s*b.g;t=e.l*b.h+e.g*b.j+e.s*b.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=e.o*b.v+e.f*b.A+e.h*b.B;l=e.i*b.v+e.m*b.A+e.j*b.B;b=e.l*b.v+e.g*b.A+e.s*b.B;d.v=h;d.A=l;d.B=b;d.v+=e.v;d.A+=e.A;d.B+=e.B;e=a.a;d=a.ha;b=f.o*d.o+f.f*d.i+f.h*d.l;h=f.o*d.f+f.f*d.m+f.h*d.g;l=f.o*d.h+f.f*d.j+f.h*d.s;g=f.i*d.o+f.m*d.i+f.j*d.l;k=f.i*d.f+f.m*d.m+f.j*d.g;m=f.i*d.h+f.m*d.j+f.j*d.s;p=f.l*d.o+f.g*d.i+f.s*d.l;n=f.l*d.f+f.g*d.m+f.s*d.g;q=f.l*d.h+f.g*d.j+f.s*d.s;e.o=b;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=p;e.g=n;e.s=q;b=f.o*d.v+f.f*d.A+f.h*d.B;h=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;e.v=b;e.A=h;e.B=d;e.v+=f.v;e.A+=f.A;e.B+=f.B;a.Fb.Lb(a.u,a.ja);f=a.u.na;e=a.u.oa;d=a.u.pa;b=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=fa.u.ka?b:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(f=a.a.v-a.ja.v,e=a.a.A-a.ja.A,d=a.a.B-a.ja.B,b=a.mc,b.x=f,b.y=e,b.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=c}this.Bb=!1;this.wb=0},Ho:function(a){var b,e,d,c,f,h,l,g,k;b=a.e00;e=a.e01;d=a.e02;c=a.e10;f=a.e11;h=a.e12;l=a.e20;g=a.e21;k=a.e22;var m;a=b*this.a.o+e*this.a.i+d*this.a.l;m=b*this.a.f+e*this.a.m+d*this.a.g;b=b*this.a.h+e*this.a.j+d*this.a.s;e=c*this.a.o+f*this.a.i+h*this.a.l;d=c*this.a.f+f*this.a.m+h*this.a.g;c=c*this.a.h+f*this.a.j+h*this.a.s;f=l*this.a.o+g*this.a.i+k*this.a.l;h=l*this.a.f+g*this.a.m+k*this.a.g;l=l*this.a.h+g*this.a.j+k*this.a.s;this.a.o=a;this.a.f=m;this.a.h=b;this.a.i=e;this.a.m=d;this.a.j=c;this.a.l=f;this.a.g=h;this.a.s=l;l=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;a=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;m=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;k=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;c=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;f=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;h=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;l=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;a=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;m=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;k=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;c=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;f=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;h=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;l=this.ja;g=this.a;l.v=g.v;l.A=g.A;l.B=g.B;l.o=g.o;l.f=g.f;l.h=g.h;l.i=g.i;l.m=g.m;l.j=g.j;l.l=g.l;l.g=g.g;l.s=g.s;for(l=this.Gc;null!=l;){g=l.M;m=this.ja;a=this.a;k=l.ja;c=l.ha;var p,n,q,t;f=m.o*c.o+m.f*c.i+m.h*c.l;h=m.o*c.f+m.f*c.m+m.h*c.g;b=m.o*c.h+m.f*c.j+m.h*c.s;e=m.i*c.o+m.m*c.i+m.j*c.l;d=m.i*c.f+m.m*c.m+m.j*c.g;p=m.i*c.h+m.m*c.j+m.j*c.s;n=m.l*c.o+m.g*c.i+m.s*c.l;q=m.l*c.f+m.g*c.m+m.s*c.g;t=m.l*c.h+m.g*c.j+m.s*c.s;k.o=f;k.f=h;k.h=b;k.i=e;k.m=d;k.j=p;k.l=n;k.g=q;k.s=t;f=m.o*c.v+m.f*c.A+m.h*c.B;h=m.i*c.v+m.m*c.A+m.j*c.B;c=m.l*c.v+m.g*c.A+m.s*c.B;k.v=f;k.A=h;k.B=c;k.v+=m.v;k.A+=m.A;k.B+=m.B;m=l.a;k=l.ha;c=a.o*k.o+a.f*k.i+a.h*k.l;f=a.o*k.f+a.f*k.m+a.h*k.g;h=a.o*k.h+a.f*k.j+a.h*k.s;b=a.i*k.o+a.m*k.i+a.j*k.l;e=a.i*k.f+a.m*k.m+a.j*k.g;d=a.i*k.h+a.m*k.j+a.j*k.s;p=a.l*k.o+a.g*k.i+a.s*k.l;n=a.l*k.f+a.g*k.m+a.s*k.g;q=a.l*k.h+a.g*k.j+a.s*k.s;m.o=c;m.f=f;m.h=h;m.i=b;m.m=e;m.j=d;m.l=p;m.g=n;m.s=q;c=a.o*k.v+a.f*k.A+a.h*k.B;f=a.i*k.v+a.m*k.A+a.j*k.B;k=a.l*k.v+a.g*k.A+a.s*k.B;m.v=c;m.A=f;m.B=k;m.v+=a.v;m.A+=a.A;m.B+=a.B;l.Fb.Lb(l.u,l.ja);a=l.u.na;m=l.u.oa;k=l.u.pa;c=l.u.ka;f=l.u.la;h=l.u.ma;l.Fb.Lb(l.u,l.a);l.u.na=al.u.ka?c:l.u.ka;l.u.la=f>l.u.la?f:l.u.la;l.u.ma=h>l.u.ma?h:l.u.ma;null!=l.ub&&(a=l.a.v-l.ja.v,m=l.a.A-l.ja.A,k=l.a.B-l.ja.B,c=l.mc,c.x=a,c.y=m,c.z=k,l.Vb.jc.hc.Qd(l.ub,l.u,l.mc));l=g}this.Bb=!1;this.wb=0},Mo:function(a){var b,e,d,c,f,h,l;b=a.x;e=a.y;a=a.z;h=Math.sin(b);var g=Math.sin(e),k=Math.sin(a),m=Math.cos(b);l=Math.cos(e);var p=Math.cos(a);d=l*p;c=-l*k;a=m*k+p*h*g;b=m*p-h*g*k;f=-l*h;e=h*k-m*p*g;h=p*h+m*g*k;l*=m;k=d*this.a.o+c*this.a.i+g*this.a.l;m=d*this.a.f+c*this.a.m+g*this.a.g;g=d*this.a.h+c*this.a.j+g*this.a.s;d=a*this.a.o+b*this.a.i+f*this.a.l;c=a*this.a.f+b*this.a.m+f*this.a.g;a=a*this.a.h+b*this.a.j+f*this.a.s;b=e*this.a.o+h*this.a.i+l*this.a.l;f=e*this.a.f+h*this.a.m+l*this.a.g;e=e*this.a.h+h*this.a.j+l*this.a.s;this.a.o=k;this.a.f=m;this.a.h=g;this.a.i=d;this.a.m=c;this.a.j=a;this.a.l=b;this.a.g=f;this.a.s=e;e=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;a=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;b=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;f=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;h=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;g=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;k=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;m=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;l=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;e=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;a=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;b=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;f=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;h=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;g=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;k=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;m=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;l=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;e=this.ja;a=this.a;e.v=a.v;e.A=a.A;e.B=a.B;e.o=a.o;e.f=a.f;e.h=a.h;e.i=a.i;e.m=a.m;e.j=a.j;e.l=a.l;e.g=a.g;e.s=a.s;for(e=this.Gc;null!=e;){a=e.M;f=this.ja;b=this.a;h=e.ja;var g=e.ha,n,q,t,k=f.o*g.o+f.f*g.i+f.h*g.l,m=f.o*g.f+f.f*g.m+f.h*g.g;l=f.o*g.h+f.f*g.j+f.h*g.s;d=f.i*g.o+f.m*g.i+f.j*g.l;c=f.i*g.f+f.m*g.m+f.j*g.g;p=f.i*g.h+f.m*g.j+f.j*g.s;n=f.l*g.o+f.g*g.i+f.s*g.l;q=f.l*g.f+f.g*g.m+f.s*g.g;t=f.l*g.h+f.g*g.j+f.s*g.s;h.o=k;h.f=m;h.h=l;h.i=d;h.m=c;h.j=p;h.l=n;h.g=q;h.s=t;k=f.o*g.v+f.f*g.A+f.h*g.B;m=f.i*g.v+f.m*g.A+f.j*g.B;g=f.l*g.v+f.g*g.A+f.s*g.B;h.v=k;h.A=m;h.B=g;h.v+=f.v;h.A+=f.A;h.B+=f.B;f=e.a;h=e.ha;g=b.o*h.o+b.f*h.i+b.h*h.l;k=b.o*h.f+b.f*h.m+b.h*h.g;m=b.o*h.h+b.f*h.j+b.h*h.s;l=b.i*h.o+b.m*h.i+b.j*h.l;d=b.i*h.f+b.m*h.m+b.j*h.g;c=b.i*h.h+b.m*h.j+b.j*h.s;p=b.l*h.o+b.g*h.i+b.s*h.l;n=b.l*h.f+b.g*h.m+b.s*h.g;q=b.l*h.h+b.g*h.j+b.s*h.s;f.o=g;f.f=k;f.h=m;f.i=l;f.m=d;f.j=c;f.l=p;f.g=n;f.s=q;g=b.o*h.v+b.f*h.A+b.h*h.B;k=b.i*h.v+b.m*h.A+b.j*h.B;h=b.l*h.v+b.g*h.A+b.s*h.B;f.v=g;f.A=k;f.B=h;f.v+=b.v;f.A+=b.A;f.B+=b.B;e.Fb.Lb(e.u,e.ja);b=e.u.na;f=e.u.oa;h=e.u.pa;g=e.u.ka;k=e.u.la;m=e.u.ma;e.Fb.Lb(e.u,e.a);e.u.na=be.u.ka?g:e.u.ka;e.u.la=k>e.u.la?k:e.u.la;e.u.ma=m>e.u.ma?m:e.u.ma;null!=e.ub&&(b=e.a.v-e.ja.v,f=e.a.A-e.ja.A,h=e.a.B-e.ja.B,g=e.mc,g.x=b,g.y=f,g.z=h,e.Vb.jc.hc.Qd(e.ub,e.u,e.mc));e=a}this.Bb=!1;this.wb=0},Mm:function(){var a=new wa,b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},Nm:function(a){var b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},No:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.a.o=1-g-d;this.a.f=k-c;this.a.h=b+h;this.a.i=k+c;this.a.m=1-a-d;this.a.j=e-f;this.a.l=b-h;this.a.g=e+f;this.a.s=1-a-g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;l=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;k=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;e=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;c=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;l=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;k=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;e=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;g=this.a;a.v=g.v;a.A=g.A;a.B=g.B;a.o=g.o;a.f=g.f;a.h=g.h;a.i=g.i;a.m=g.m;a.j=g.j;a.l=g.l;a.g=g.g;a.s=g.s;for(a=this.Gc;null!=a;){g=a.M;l=this.ja;c=this.a;d=a.ja;var k=a.ha,m,p,n,q,t,h=l.o*k.o+l.f*k.i+l.h*k.l;e=l.o*k.f+l.f*k.m+l.h*k.g;b=l.o*k.h+l.f*k.j+l.h*k.s;f=l.i*k.o+l.m*k.i+l.j*k.l;m=l.i*k.f+l.m*k.m+l.j*k.g;p=l.i*k.h+l.m*k.j+l.j*k.s;n=l.l*k.o+l.g*k.i+l.s*k.l;q=l.l*k.f+l.g*k.m+l.s*k.g;t=l.l*k.h+l.g*k.j+l.s*k.s;d.o=h;d.f=e;d.h=b;d.i=f;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=l.o*k.v+l.f*k.A+l.h*k.B;e=l.i*k.v+l.m*k.A+l.j*k.B;k=l.l*k.v+l.g*k.A+l.s*k.B;d.v=h;d.A=e;d.B=k;d.v+=l.v;d.A+=l.A;d.B+=l.B;l=a.a;d=a.ha;k=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;e=c.o*d.h+c.f*d.j+c.h*d.s;b=c.i*d.o+c.m*d.i+c.j*d.l;f=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;p=c.l*d.o+c.g*d.i+c.s*d.l;n=c.l*d.f+c.g*d.m+c.s*d.g;q=c.l*d.h+c.g*d.j+c.s*d.s;l.o=k;l.f=h;l.h=e;l.i=b;l.m=f;l.j=m;l.l=p;l.g=n;l.s=q;k=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;l.v=k;l.A=h;l.B=d;l.v+=c.v;l.A+=c.A;l.B+=c.B;a.Fb.Lb(a.u,a.ja);c=a.u.na;l=a.u.oa;d=a.u.pa;k=a.u.ka;h=a.u.la;e=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ca.u.ka?k:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=e>a.u.ma?e:a.u.ma;null!=a.ub&&(c=a.a.v-a.ja.v,l=a.a.A-a.ja.A,d=a.a.B-a.ja.B,k=a.mc,k.x=c,k.y=l,k.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=g}this.Bb=!1;this.wb=0},Xm:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Ym:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},So:function(a){this.a.v=a.v;this.a.A=a.A;this.a.B=a.B;this.a.o=a.o;this.a.f=a.f;this.a.h=a.h;this.a.i=a.i;this.a.m=a.m;this.a.j=a.j;this.a.l=a.l;this.a.g=a.g;this.a.s=a.s;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},ph:function(){return this.Lf},cf:function(){var a=new I;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae;return a},gg:function(a){a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},Di:function(){var a=new fj;a.mass=this.Lf;var b=a.localInertia;b.e00=this.Td;b.e01=this.Ud;b.e02=this.Vd;b.e10=this.Wd;b.e11=this.Xd;b.e12=this.Yd;b.e20=this.Zd;b.e21=this.$d;b.e22=this.ae;return a},Ei:function(a){a.mass=this.Lf;a=a.localInertia;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},ln:function(a){this.Lf=a.mass;a=a.localInertia;this.Td=a.e00;this.Ud=a.e01;this.Vd=a.e02;this.Wd=a.e10;this.Xd=a.e11;this.Yd=a.e12;this.Zd=a.e20;this.$d=a.e21;this.ae=a.e22;if(0d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},dn:function(a){var b=a.ia,e=a.M;null!=b&&(b.M=e);null!=e&&(e.ia=b);a==this.Gc&&(this.Gc=this.Gc.M);a==this.Yi&&(this.Yi=this.Yi.ia);a.M=null;a.ia=null;this.Rg--;a.Vb=null;if(null!=this.jc){b=this.jc;b.hc.oi(a.ub);a.ub=null;a.Ic=-1;for(var d=a.Vb.Mb;null!=d;){var e=d.M,c=d.me;if(c.Ec==a||c.Fc==a){d=d.ad;d.Bb=!1;d.wb=0;var d=b.Hi,f=c.ia,h=c.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c==d.je&&(d.je=d.je.M);c==d.Le&&(d.Le=d.Le.ia);c.M=null;c.ia=null;f=c.rb.ia;h=c.rb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.rb==c.C.Mb&&(c.C.Mb=c.C.Mb.M);c.rb==c.C.ic&&(c.C.ic=c.C.ic.ia);c.rb.M=null;c.rb.ia=null;f=c.sb.ia;h=c.sb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.sb==c.D.Mb&&(c.D.Mb=c.D.Mb.M);c.sb==c.D.ic&&(c.D.ic=c.D.ic.ia);c.sb.M=null;c.sb.ia=null;c.C.Ne--;c.D.Ne--;c.rb.ad=null;c.sb.ad=null;c.rb.me=null;c.sb.me=null;c.Ec=null;c.Fc=null;c.C=null;c.D=null;c.Hh=!1;c.pj.df();c.Ia.df();c.$h=null;f=c.ef;f.Ec=null;f.Fc=null;f.C=null;f.D=null;f.Ej=null;f.Fj=null;c.M=d.Cg;d.Cg=c;d.Ui--}d=e}b.Rg--}this.ck();for(a=this.Gc;null!=a;){var b=a.M,c=this.ja,e=this.a,d=a.ja,f=a.ha,l,g,k,m,n,r,q,t,h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;c=a.a;d=a.ha;f=e.o*d.o+e.f*d.i+e.h*d.l;h=e.o*d.f+e.f*d.m+e.h*d.g;l=e.o*d.h+e.f*d.j+e.h*d.s;g=e.i*d.o+e.m*d.i+e.j*d.l;k=e.i*d.f+e.m*d.m+e.j*d.g;m=e.i*d.h+e.m*d.j+e.j*d.s;n=e.l*d.o+e.g*d.i+e.s*d.l;r=e.l*d.f+e.g*d.m+e.s*d.g;q=e.l*d.h+e.g*d.j+e.s*d.s;c.o=f;c.f=h;c.h=l;c.i=g;c.m=k;c.j=m;c.l=n;c.g=r;c.s=q;f=e.o*d.v+e.f*d.A+e.h*d.B;h=e.i*d.v+e.m*d.A+e.j*d.B;d=e.l*d.v+e.g*d.A+e.s*d.B;c.v=f;c.A=h;c.B=d;c.v+=e.v;c.A+=e.A;c.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;c=a.u.oa;d=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,c=a.a.A-a.ja.A,d=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=c,f.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},Eo:function(){return this.Jb},nn:function(a){this.Jb=a;this.ck()},pn:function(){this.Bb=!1;this.wb=0},on:function(){this.Bb=!0;this.wb=0},Dm:function(){return this.Bb},tm:function(){return this.wb},gn:function(a){this.Tk=a;this.Bb=!1;this.wb=0},Je:function(){return this.sk},jn:function(a){this.sk=a},Vc:function(){return this.hk},en:function(a){this.hk=a},Um:function(){return this.ia},Im:function(){return this.M}};Ka.prototype={wc:function(){return this.pk},Ke:function(a){this.pk=a},Uc:function(){return this.Ak},cf:function(a){this.Ak=a},Dc:function(){var a=this.ha,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Hc:function(a){var b=this.ha;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},ie:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Fe:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},bf:function(a){var b=this.ha;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;if(null!=this.Vb)for(a=this.Vb,a.ck(),b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}},lc:function(){return this.Vk},Je:function(a){this.Vk=a;if(null!=this.Vb){a=this.Vb;a.ck();for(var b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}}},wa:function(){return this.u.clone()},mb:function(a){a.qe(this.u)},xc:function(){return this.Fb},Vc:function(){return this.Vb},Cb:function(){return this.kk},Ge:function(a){this.kk=a},Kb:function(){return this.lk},He:function(a){this.lk=a},kc:function(){return this.im},Ie:function(a){this.im=a},vd:function(){return this.ia},Wc:function(){return this.M}};pi.gg=1;pi.hg=2;pi.BRUTE_FORCE=1;pi.BVH=2;bc.Pm=0;bc.cf=1;bc.Ei=2;bc.jg=3;bc.ig=4;bc.kg=5;bc.Di=0;bc.ph=5;bc.SPHERE=0;bc.BOX=1;bc.CYLINDER=2;bc.CONE=3;bc.CAPSULE=4;bc.CONVEX_HULL=5;ni.Ie=1;Ee.Kb=0;n.numCreations=0;F.defaultFriction=.2;F.defaultRestitution=.2;F.defaultDensity=1;F.defaultCollisionGroup=1;F.defaultCollisionMask=1;F.maxTranslationPerStep=20;F.maxRotationPerStep=3.14159265358979;F.bvhProxyPadding=.1;F.bvhIncrementalCollisionThreshold=.45;F.defaultGJKMargin=.05;F.enableGJKCaching=!0;F.maxEPAVertices=128;F.maxEPAPolyhedronFaces=128;F.contactEnableBounceThreshold=.5;F.velocityBaumgarte=.2;F.positionSplitImpulseBaumgarte=.4;F.positionNgsBaumgarte=1;F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;F.defaultContactPositionCorrectionAlgorithm=0;F.alternativeContactPositionCorrectionAlgorithm=1;F.contactPersistenceThreshold=.05;F.maxManifoldPoints=4;F.defaultJointConstraintSolverType=0;F.defaultJointPositionCorrectionAlgorithm=0;F.jointWarmStartingFactorForBaungarte=.8;F.jointWarmStartingFactor=.95;F.minSpringDamperDampingRatio=1E-6;F.minRagdollMaxSwingAngle=1E-6;F.maxJacobianRows=6;F.directMlcpSolverEps=1E-9;F.islandInitialRigidBodyArraySize=128;F.islandInitialConstraintArraySize=128;F.sleepingVelocityThreshold=.2;F.sleepingAngularVelocityThreshold=.5;F.sleepingTimeThreshold=1;F.disableSleeping=!1;F.linearSlop=.005;F.angularSlop=.017453292519943278;lb.mb=new lb;dc.Xm=0;dc.Bm=1;dc.Am=2;dc.um=257;dc.tm=258;dc.sm=259;dc.SUCCEEDED=0;dc.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;dc.GJK_DID_NOT_CONVERGE=2;dc.EPA_FAILED_TO_INIT=257;dc.EPA_FAILED_TO_ADD_VERTEX=258;dc.EPA_DID_NOT_CONVERGE=259;I.numCreations=0;J.numCreations=0;pa.POSITIVE_INFINITY=Infinity;pa.NEGATIVE_INFINITY=-Infinity;pa.PI=3.14159265358979;pa.TWO_PI=6.28318530717958;pa.HALF_PI=1.570796326794895;pa.TO_RADIANS=.017453292519943278;pa.TO_DEGREES=57.29577951308238;wa.numCreations=0;Mg.Je=8;Mg.Ke=4;Mg.He=8;Ce.broadPhaseCollisionTime=0;Ce.narrowPhaseCollisionTime=0;Ce.dynamicsTime=0;Ce.totalTime=0;jc.bf=0;jc.Vm=1;jc.Jm=2;jc.BAUMGARTE=0;jc.SPLIT_IMPULSE=1;jc.NGS=2;gf.Ge=1;gf.Fe=2;Mb.Um=0;Mb.Om=1;Mb.Fi=2;Mb.Mm=3;Mb.Ym=4;Mb.Nm=5;Mb.ym=6;Mb.SPHERICAL=0;Mb.REVOLUTE=1;Mb.CYLINDRICAL=2;Mb.PRISMATIC=3;Mb.UNIVERSAL=4;Mb.RAGDOLL=5;Mb.GENERIC=6;vf.Dm=0;vf.gk=1;vf.ITERATIVE=0;vf.DIRECT=1;Qe.fm=0;Qe.Wm=1;Qe.Im=2;Qe.DYNAMIC=0;Qe.STATIC=1;Qe.KINEMATIC=2;Ij.lc()})({}); +/* OimoPhysics 1.2.2 (c) 2020 saharan, The MIT License */ 'use strict';(function(){function Qj(){this.position=new n;this.rotation=new I;this.friction=F.defaultFriction;this.restitution=F.defaultRestitution;this.density=F.defaultDensity;this.collisionGroup=F.defaultCollisionGroup;this.collisionMask=F.defaultCollisionMask;this.contactCallback=this.geometry=null}function Ka(a){this.Ic=-1;this.ha=new Ua;this.ja=new Ua;this.a=new Ua;var b=a.position;this.ha.v=b.x;this.ha.A=b.y;this.ha.B=b.z;b=a.rotation;this.ha.o=b.e00;this.ha.f=b.e01;this.ha.h=b.e02;this.ha.i=b.e10;this.ha.m=b.e11;this.ha.j=b.e12;this.ha.l=b.e20;this.ha.g=b.e21;this.ha.s=b.e22;var b=this.ja,e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;b=this.a;e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Ak=a.restitution;this.pk=a.friction;this.Vk=a.density;this.Fb=a.geometry;this.kk=a.collisionGroup;this.lk=a.collisionMask;this.im=a.contactCallback;this.u=new eb;this.ub=null;this.mc=new n}function Qe(){}function Rj(){this.position=new n;this.rotation=new I;this.linearVelocity=new n;this.angularVelocity=new n;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0}function x(a){this.Yi=this.Gc=this.ia=this.M=null;this.Rg=0;this.ic=this.Mb=null;this.Ne=0;this.ff=this.Me=null;this.Ah=0;var b=a.linearVelocity;this.jb=b.x;this.kb=b.y;this.lb=b.z;b=a.angularVelocity;this.nb=b.x;this.ob=b.y;this.pb=b.z;this.jd=this.hd=this.gd=this.td=this.sd=this.rd=0;this.ja=new Ua;this.a=new Ua;b=a.position;this.ja.v=b.x;this.ja.A=b.y;this.ja.B=b.z;b=a.rotation;this.ja.o=b.e00;this.ja.f=b.e01;this.ja.h=b.e02;this.ja.i=b.e10;this.ja.m=b.e11;this.ja.j=b.e12;this.ja.l=b.e20;this.ja.g=b.e21;this.ja.s=b.e22;var b=this.a,e=this.ja;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Jb=a.type;this.wb=0;this.Bb=!1;this.Tk=a.autoSleep;this.$=this.Z=this.Y=this.X=this.W=this.V=this.U=this.T=this.S=this.Si=this.Ri=this.Qi=this.Pi=this.Oi=this.Ni=this.Mi=this.Li=this.Ki=this.$a=this.Za=this.Ya=this.Xa=this.Wa=this.Va=this.Ua=this.Ta=this.Sa=this.ae=this.$d=this.Zd=this.Yd=this.Xd=this.Wd=this.Vd=this.Ud=this.Td=this.qb=this.Lf=0;this.sk=a.linearDamping;this.hk=a.angularDamping;this.th=this.sh=this.rh=this.yh=this.xh=this.wh=this.Qf=this.Pf=this.Of=this.ci=this.bi=this.ai=0;this.O=new n(1,1,1);this.lg=!1;this.vh=1;this.jc=null}function fj(){this.mass=0;this.localInertia=new I}function Rb(a){Ob.call(this);this.ga=a;this.info=new gj;this.Wb=Array(F.maxJacobianRows);a=0;for(var b=this.Wb.length;a>1&85);d=(d&51)+(d>>2&51);d=(d&15)+(d>>4&15);c=Array(d);for(f=0;fb.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20)?b=!0:(b=a.localBasis2,b=0>b.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20));b&&console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed");var e,d,c,f,h,l,g,k,m,p,r,q,t,A,L,u,z;k=a.localBasis1;b=k.e00;e=k.e01;d=k.e02;c=k.e10;f=k.e11;h=k.e12;l=k.e20;g=k.e21;k=k.e22;z=a.localBasis2;m=z.e00;p=z.e01;r=z.e02;q=z.e10;t=z.e11;A=z.e12;L=z.e20;u=z.e21;z=z.e22;this.Ma=b;this.Na=c;this.Oa=l;this.sc=e;this.tc=f;this.uc=g;this.Pc=d;this.Qc=h;this.Rc=k;this.Sb=m;this.Tb=q;this.Ub=L;this.gi=p;this.hi=t;this.ii=u;this.nd=r;this.od=A;this.pd=z;this.cm=this.translationY=this.translationX=this.Bf=this.qh=this.Af=0;this.fk=this.ek=this.dk=!1;this.qg=Array(3);this.Rf=Array(3);this.pg=Array(3);this.Tg=Array(3);this.qg[0]=a.translationalLimitMotors[0].clone();this.qg[1]=a.translationalLimitMotors[1].clone();this.qg[2]=a.translationalLimitMotors[2].clone();this.Rf[0]=a.translationalSpringDampers[0].clone();this.Rf[1]=a.translationalSpringDampers[1].clone();this.Rf[2]=a.translationalSpringDampers[2].clone();this.pg[0]=a.rotationalLimitMotors[0].clone();this.pg[1]=a.rotationalLimitMotors[1].clone();this.pg[2]=a.rotationalLimitMotors[2].clone();this.Tg[0]=a.rotationalSpringDampers[0].clone();this.Tg[1]=a.rotationalSpringDampers[1].clone();this.Tg[2]=a.rotationalSpringDampers[2].clone()}function wf(){Gb.call(this);this.localAxis1=new n(1,0,0);this.localAxis2=new n(1,0,0);this.translationalLimitMotor=new tc;this.translationalSpringDamper=new Hb;this.rotationalLimitMotor=new $b;this.rotationalSpringDamper=new Hb}function Gb(){this.rigidBody2=this.rigidBody1=null;this.localAnchor1=new n;this.localAnchor2=new n;this.allowCollision=!1;this.solverType=F.defaultJointConstraintSolverType;this.positionCorrectionAlgorithm=F.defaultJointPositionCorrectionAlgorithm;this.breakTorque=this.breakForce=0}function Fb(a){N.call(this,a,2);var b=a.localAxis1;this.Ma=b.x;this.Na=b.y;this.Oa=b.z;b=a.localAxis2;this.Sb=b.x;this.Tb=b.y;this.Ub=b.z;this.Al();this.Yf=this.Xf=this.Bg=this.Se=this.Re=this.angle=0;this.N=new Ui(this);this.ul=a.translationalSpringDamper.clone();this.tl=a.translationalLimitMotor.clone();this.nl=a.rotationalSpringDamper.clone();this.ml=a.rotationalLimitMotor.clone()}function N(a,b){this.rb=new qc(this);this.sb=new qc(this);this.Sg=F.defaultJointPositionCorrectionAlgorithm;this.Jb=b;this.jc=null;this.C=a.rigidBody1;this.D=a.rigidBody2;this.Sk=a.allowCollision;this.nj=a.breakForce;this.oj=a.breakTorque;switch(a.solverType){case 0:this.Ck=new Rb(this);break;case 1:this.Ck=new Wb(this)}b=a.localAnchor1;this.sj=b.x;this.tj=b.y;this.uj=b.z;a=a.localAnchor2;this.vj=a.x;this.wj=a.y;this.xj=a.z;this.pd=this.od=this.nd=this.ii=this.hi=this.gi=this.Ub=this.Tb=this.Sb=this.Rc=this.Qc=this.Pc=this.uc=this.tc=this.sc=this.Oa=this.Na=this.Ma=this.zf=this.yf=this.xf=this.wf=this.vf=this.uf=this.fc=this.ec=this.dc=this.cc=this.bc=this.ac=0;this.Eb=Array(F.maxJacobianRows);a=0;for(b=F.maxJacobianRows;aa;){var b=a++,e=b&&4!=b?8:1;this.Nk[b]=Array(e);this.Yh[b]=Array(e);this.Pk[b]=Array(e);for(e=0;8>e;){var d=e++,c=.7853981633974475*b,f=.7853981633974475*d;this.Nk[b][d]=new n(Math.sin(c)*Math.cos(f),Math.cos(c),-Math.sin(c)*Math.sin(f));this.Yh[b][d]=new n;this.Pk[b][d]=new n}}this.Mj=Array(8);this.vm=Array(8);this.Ee=Array(8);this.af=Array(8);this.fg=Array(8);for(a=0;8>a;)b=a++,this.Mj[b]=new n(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.vm[b]=new n(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.Ee[b]=new n,this.af[b]=new n,this.fg[b]=new n;this.style=new wj}function hf(){this.position=new n;this.normal=new n;this.shape=null;this.fraction=1;this.position.R();this.normal.R();this.hit=!1}function Ni(){}function xj(){}function yj(){}function Vi(){this.u=new eb;this.sn=null}function ij(){this.dj=new Oi;this.Jj=new Ua;this.Bg=new n;this.R=new n;this.wm=this.Lj=null}function Pi(){this.dj=new Oi;this.Jj=new n;this.end=new n;this.Lj=null}function Ca(a,b){null==a&&(a=2);switch(a){case 1:this.hc=new pc;break;case 2:this.hc=new Kb}this.Hi=new De(this.hc);null==b&&(b=new n(0,-9.80665,0));this.Xk=new n(b.x,b.y,b.z);this.Ti=this.di=this.Xi=this.Nf=null;this.xk=this.jl=this.Rg=this.yj=0;this.ll=10;this.kl=5;this.zk=new Pi;this.qj=new ij;this.Qk=new Vi;this.Ng=new zj;this.hf=Array(F.islandInitialConstraintArraySize);this.Fh=Array(F.islandInitialRigidBodyArraySize);this.ji=new Aj;this.ra=new Nb;this.om=0}function Aj(){this.invDt=this.dt=0;this.dtRatio=1}function zj(){this.cg=Array(F.islandInitialRigidBodyArraySize);this.dg=Array(F.islandInitialConstraintArraySize);this.Xh=Array(F.islandInitialConstraintArraySize);this.Wh=Array(F.islandInitialConstraintArraySize);this.Oh=this.Ph=this.bg=this.ag=0}function De(a){this.hc=a;this.tn=new hi;this.Ui=0}function Zb(){this.ad=this.me=this.M=this.ia=null}function ac(){this.ia=this.M=null;this.rb=new Zb;this.sb=new Zb;this.$h=this.D=this.C=this.Fc=this.Ec=null;this.pj=new Bj;this.un=new jf;this.Bk=this.rk=!1;this.Ia=new Tb;this.qm=new uj(this.Ia);this.ef=new Uc(this.Ia);this.Hh=!1}function wa(a,b,e,d){null==d&&(d=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=d;wa.numCreations++}function Nb(){this.c=Array(256);this.b=0;this.bb=Array(256);this.cb=0;this.eg=Array(256);this.Ag=0;this.le=Array(256);this.re=0}function pa(){}function J(a,b,e,d,c,f,h,l,g,k,m,p,r,q,t,A){null==A&&(A=1);null==t&&(t=0);null==q&&(q=0);null==r&&(r=0);null==p&&(p=0);null==m&&(m=1);null==k&&(k=0);null==g&&(g=0);null==l&&(l=0);null==h&&(h=0);null==f&&(f=1);null==c&&(c=0);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=d;this.e10=c;this.e11=f;this.e12=h;this.e13=l;this.e20=g;this.e21=k;this.e22=m;this.e23=p;this.e30=r;this.e31=q;this.e32=t;this.e33=A;J.numCreations++}function I(a,b,e,d,c,f,h,l,g){null==g&&(g=1);null==l&&(l=0);null==h&&(h=0);null==f&&(f=0);null==c&&(c=1);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=d;this.e11=c;this.e12=f;this.e20=h;this.e21=l;this.e22=g;I.numCreations++}function Pc(){}function dc(){}function lb(){this.La=Array(4);this.eb=Array(4);this.ib=Array(4);this.Ij=Array(3);this.Ij[0]=new n(1,0,0);this.Ij[1]=new n(0,1,0);this.Ij[2]=new n(0,0,1);this.Jo=new n;this.Ko=new n;this.Co=new n;this.Bo=new n;this.Io=new Ua;this.La[0]=new n;this.eb[0]=new n;this.ib[0]=new n;this.La[1]=new n;this.eb[1]=new n;this.ib[1]=new n;this.La[2]=new n;this.eb[2]=new n;this.ib[2]=new n;this.La[3]=new n;this.eb[3]=new n;this.ib[3]=new n;this.dir=new n;this.closest=new n;this.closestPoint1=new n;this.closestPoint2=new n;this.ih=new Cj}function F(){}function Ua(){this.B=this.A=this.v=0;this.o=1;this.i=this.h=this.f=0;this.m=1;this.g=this.l=this.j=0;this.s=1}function n(a,b,e){null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;n.numCreations++}function Dj(){this.$l=new n}function te(){this.Rd=new n;this.eb=new n;this.ib=new n}function Ee(){this.id=++Ee.Kb;this.ia=this.M=null;this.wk=new n;this.sl=this.nk=0;this.Gj=!1;this.Ca=Array(3);this.Hb=Array(3);this.Ib=Array(3);this.zi=new n;this.Sc=Array(3);this.Sc[0]=1;this.Sc[1]=2;this.Sc[2]=0}function Cj(){this.Ca=Array(F.maxEPAVertices);this.Gi=new n;this.We=0;this.cd=this.Cd=null;this.Bh=0;this.jf=this.Qe=null}function ii(){this.oh=!1}function ji(a){this.oh=a}function ki(a){this.oh=a}function li(){this.oh=!1}function mi(){this.oh=!1}function Bj(){}function Ej(){this.gc=this.fd=this.Rj=this.w=0;this.Xb=Array(8);this.Gb=Array(8);this.Xb[0]=new kc;this.Gb[0]=new kc;this.Xb[1]=new kc;this.Gb[1]=new kc;this.Xb[2]=new kc;this.Gb[2]=new kc;this.Xb[3]=new kc;this.Gb[3]=new kc;this.Xb[4]=new kc;this.Gb[4]=new kc;this.Xb[5]=new kc;this.Gb[5]=new kc;this.Xb[6]=new kc;this.Gb[6]=new kc;this.Xb[7]=new kc;this.Gb[7]=new kc}function kc(){this.Ra=this.Qa=this.Pa=this.y=this.x=0}function ni(){this.oh=!1;this.Xg=new Ej}function lc(a){this.oh=a}function Fj(){this.position1=new n;this.position2=new n;this.id=this.depth=0}function jf(){this.numPoints=0;this.normal=new n;this.points=Array(F.maxManifoldPoints);this.incremental=!1;for(var a=0,b=F.maxManifoldPoints;a.2*a&&(this.Rb=.2*a)}function eb(){this.ma=this.la=this.ka=this.pa=this.oa=this.na=0}function Gj(){this.Nb=null;this.yk=0;this.Zi=new Hj;this.qf=this.zg=this.qd=null;this.zi=Array(1024)}function Hj(){this.mm=0;this.ik=!1}function Wi(a,b){Qc.call(this,a,b);this.ei=null;this.zh=!1}function oi(){this.ng=this.og=this.M=null;this.F=Array(2);this.Ja=0;this.Ea=null;this.P=0;this.ub=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function Kb(){ub.call(this,2);this.qk=!0;this.ye=new Gj;this.rf=Array(1024);this.$f=0}function pc(){ub.call(this,1);this.qk=!1}function ve(){this.Dh=this.Ch=null}function Qc(a,b){this.userData=a;this.Ic=b;this.M=this.ia=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function pi(){}function we(){}function Xi(){Qa.call(this,-1);this.min=new n;this.max=new n}function jj(){Qa.call(this,-1)}function Qa(a){wc.call(this,a);this.Rb=F.defaultGJKMargin;this.rm=!1}function wc(a){this.Jb=a;this.Sf=0}function ub(a){this.Jb=a;this.Vi=0;this.pe=this.gf=this.Oe=null;this.qk=!1;this.Dj=0;this.Eh=null;this.lm=0;this.mk=new jj;this.u=new Xi;this.rg=new Ua;this.R=new n;this.dj=new Oi}function Ij(){}function gb(a,b){a=Object.create(a);for(var e in b)a[e]=b[e];b.toString!==Object.prototype.toString&&(a.toString=b.toString);return a}Ij.lc=function(){window.OIMO={};window.OIMO.DebugDraw=Mg;window.OIMO.BroadPhase=ub;ub.prototype.createProxy=ub.prototype.ni;ub.prototype.destroyProxy=ub.prototype.oi;ub.prototype.moveProxy=ub.prototype.Qd;ub.prototype.isOverlapping=ub.prototype.Kb;ub.prototype.collectPairs=ub.prototype.$i;ub.prototype.getProxyPairList=ub.prototype.wa;ub.prototype.isIncremental=ub.prototype.Cb;ub.prototype.getTestCount=ub.prototype.mb;ub.prototype.rayCast=ub.prototype.ke;ub.prototype.convexCast=ub.prototype.Vf;ub.prototype.aabbTest=ub.prototype.Ih;window.OIMO.Geometry=wc;wc.prototype.getType=wc.prototype.mb;wc.prototype.getVolume=wc.prototype.wa;wc.prototype.rayCast=wc.prototype.ke;window.OIMO.ConvexGeometry=Qa;Qa.prototype.getGjkMergin=Qa.prototype.Xn;Qa.prototype.setGjkMergin=Qa.prototype.Go;Qa.prototype.computeLocalSupportingVertex=Qa.prototype.he;Qa.prototype.rayCast=Qa.prototype.ke;window.OIMO.BroadPhaseProxyCallback=we;we.prototype.process=we.prototype.process;window.OIMO.BroadPhaseType=pi;window.OIMO.Proxy=Qc;Qc.prototype.getId=Qc.prototype.Cb;Qc.prototype.getFatAabb=Qc.prototype.wa;Qc.prototype.getFatAabbTo=Qc.prototype.mb;window.OIMO.ProxyPair=ve;ve.prototype.getProxy1=ve.prototype.wa;ve.prototype.getProxy2=ve.prototype.mb;ve.prototype.getNext=ve.prototype.Cb;window.OIMO.BruteForceBroadPhase=pc;pc.prototype.createProxy=pc.prototype.ni;pc.prototype.destroyProxy=pc.prototype.oi;pc.prototype.moveProxy=pc.prototype.Qd;pc.prototype.collectPairs=pc.prototype.$i;pc.prototype.rayCast=pc.prototype.ke;pc.prototype.convexCast=pc.prototype.Vf;pc.prototype.aabbTest=pc.prototype.Ih;window.OIMO.BvhBroadPhase=Kb;Kb.prototype.createProxy=Kb.prototype.ni;Kb.prototype.destroyProxy=Kb.prototype.oi;Kb.prototype.moveProxy=Kb.prototype.Qd;Kb.prototype.collectPairs=Kb.prototype.$i;Kb.prototype.rayCast=Kb.prototype.ke;Kb.prototype.convexCast=Kb.prototype.Vf;Kb.prototype.aabbTest=Kb.prototype.Ih;Kb.prototype.getTreeBalance=Kb.prototype.so;window.OIMO.Aabb=eb;eb.prototype.init=eb.prototype.Aa;eb.prototype.getMin=eb.prototype.Uc;eb.prototype.getMinTo=eb.prototype.Vc;eb.prototype.setMin=eb.prototype.ie;eb.prototype.getMax=eb.prototype.Dc;eb.prototype.getMaxTo=eb.prototype.Hc;eb.prototype.setMax=eb.prototype.vd;eb.prototype.getCenter=eb.prototype.Cb;eb.prototype.getCenterTo=eb.prototype.Kb;eb.prototype.getExtents=eb.prototype.kc;eb.prototype.getExtentsTo=eb.prototype.lc;eb.prototype.combine=eb.prototype.wa;eb.prototype.combined=eb.prototype.mb;eb.prototype.overlap=eb.prototype.Wc;eb.prototype.getIntersection=eb.prototype.wc;eb.prototype.getIntersectionTo=eb.prototype.xc;eb.prototype.copyFrom=eb.prototype.qe;eb.prototype.clone=eb.prototype.clone;window.OIMO.BoxGeometry=Hd;Hd.prototype.getHalfExtents=Hd.prototype.Yn;Hd.prototype.getHalfExtentsTo=Hd.prototype.Zn;Hd.prototype.computeLocalSupportingVertex=Hd.prototype.he;window.OIMO.CapsuleGeometry=Wc;Wc.prototype.getRadius=Wc.prototype.pi;Wc.prototype.getHalfHeight=Wc.prototype.Pj;Wc.prototype.computeLocalSupportingVertex=Wc.prototype.he;window.OIMO.ConeGeometry=Fe;Fe.prototype.getRadius=Fe.prototype.pi;Fe.prototype.getHalfHeight=Fe.prototype.Pj;Fe.prototype.computeLocalSupportingVertex=Fe.prototype.he;window.OIMO.ConvexHullGeometry=kf;kf.prototype.getVertices=kf.prototype.wo;kf.prototype.computeLocalSupportingVertex=kf.prototype.he;window.OIMO.CylinderGeometry=Qd;Qd.prototype.getRadius=Qd.prototype.pi;Qd.prototype.getHalfHeight=Qd.prototype.Pj;Qd.prototype.computeLocalSupportingVertex=Qd.prototype.he;window.OIMO.GeometryType=bc;window.OIMO.RayCastHit=Oi;window.OIMO.SphereGeometry=ue;ue.prototype.getRadius=ue.prototype.pi;ue.prototype.computeLocalSupportingVertex=ue.prototype.he;window.OIMO.CollisionMatrix=hi;hi.prototype.getDetector=hi.prototype.wa;window.OIMO.DetectorResult=jf;jf.prototype.getMaxDepth=jf.prototype.Em;jf.prototype.clear=jf.prototype.clear;window.OIMO.DetectorResultPoint=Fj;window.OIMO.Detector=lc;lc.prototype.detect=lc.prototype.zm;window.OIMO.BoxBoxDetector=ni;window.OIMO.CapsuleCapsuleDetector=mi;window.OIMO.GjkEpaDetector=li;window.OIMO.SphereBoxDetector=ki;window.OIMO.SphereCapsuleDetector=ji;window.OIMO.SphereSphereDetector=ii;window.OIMO.Vec3=n;n.prototype.init=n.prototype.Aa;n.prototype.zero=n.prototype.R;n.prototype.add=n.prototype.ie;n.prototype.add3=n.prototype.wa;n.prototype.addScaled=n.prototype.Cb;n.prototype.sub=n.prototype.cf;n.prototype.sub3=n.prototype.jg;n.prototype.scale=n.prototype.Ke;n.prototype.scale3=n.prototype.hg;n.prototype.dot=n.prototype.Ge;n.prototype.cross=n.prototype.kc;n.prototype.addEq=n.prototype.Fe;n.prototype.add3Eq=n.prototype.mb;n.prototype.addScaledEq=n.prototype.Kb;n.prototype.subEq=n.prototype.gg;n.prototype.sub3Eq=n.prototype.kg;n.prototype.scaleEq=n.prototype.bf;n.prototype.scale3Eq=n.prototype.ig;n.prototype.crossEq=n.prototype.lc;n.prototype.mulMat3=n.prototype.wc;n.prototype.mulMat4=n.prototype.Dc;n.prototype.mulTransform=n.prototype.Uc;n.prototype.mulMat3Eq=n.prototype.xc;n.prototype.mulMat4Eq=n.prototype.Hc;n.prototype.mulTransformEq=n.prototype.Vc;n.prototype.length=n.prototype.length;n.prototype.lengthSq=n.prototype.He;n.prototype.normalized=n.prototype.Je;n.prototype.normalize=n.prototype.Ie;n.prototype.negate=n.prototype.Wc;n.prototype.negateEq=n.prototype.vd;n.prototype.copyFrom=n.prototype.qe;n.prototype.clone=n.prototype.clone;n.prototype.toString=n.prototype.toString;window.OIMO.Transform=Ua;Ua.prototype.identity=Ua.prototype.rg;Ua.prototype.getPosition=Ua.prototype.Cb;Ua.prototype.getPositionTo=Ua.prototype.Kb;Ua.prototype.setPosition=Ua.prototype.Hc;Ua.prototype.translate=Ua.prototype.Wc;Ua.prototype.getRotation=Ua.prototype.kc;Ua.prototype.getRotationTo=Ua.prototype.lc;Ua.prototype.setRotation=Ua.prototype.Uc;Ua.prototype.setRotationXyz=Ua.prototype.Vc;Ua.prototype.rotate=Ua.prototype.wc;Ua.prototype.rotateXyz=Ua.prototype.xc;Ua.prototype.getOrientation=Ua.prototype.wa;Ua.prototype.getOrientationTo=Ua.prototype.mb;Ua.prototype.setOrientation=Ua.prototype.Dc;Ua.prototype.clone=Ua.prototype.clone;Ua.prototype.copyFrom=Ua.prototype.qe;window.OIMO.Setting=F;window.OIMO.GjkEpa=lb;lb.prototype.computeClosestPoints=lb.prototype.wa;lb.prototype.computeDistance=lb.prototype.mb;lb.prototype.convexCast=lb.prototype.Vf;lb.prototype.rayCast=lb.prototype.ke;lb.getInstance=lb.kc;window.OIMO.GjkEpaResultState=dc;window.OIMO.SimplexUtil=Pc;Pc.projectOrigin2=Pc.wc;Pc.projectOrigin3=Pc.xc;Pc.projectOrigin4=Pc.Dc;window.OIMO.Mat3=I;I.prototype.init=I.prototype.Aa;I.prototype.identity=I.prototype.rg;I.prototype.add=I.prototype.Dc;I.prototype.sub=I.prototype.ig;I.prototype.scale=I.prototype.gg;I.prototype.mul=I.prototype.He;I.prototype.addEq=I.prototype.Hc;I.prototype.subEq=I.prototype.jg;I.prototype.scaleEq=I.prototype.hg;I.prototype.mulEq=I.prototype.Ie;I.prototype.prependScale=I.prototype.bf;I.prototype.appendScale=I.prototype.Wc;I.prototype.prependRotation=I.prototype.Je;I.prototype.appendRotation=I.prototype.Uc;I.prototype.prependScaleEq=I.prototype.cf;I.prototype.appendScaleEq=I.prototype.vd;I.prototype.prependRotationEq=I.prototype.Ke;I.prototype.appendRotationEq=I.prototype.Vc;I.prototype.transpose=I.prototype.Di;I.prototype.transposeEq=I.prototype.Ei;I.prototype.determinant=I.prototype.ie;I.prototype.trace=I.prototype.ph;I.prototype.inverse=I.prototype.Fe;I.prototype.inverseEq=I.prototype.Ge;I.prototype.toArray=I.prototype.kg;I.prototype.copyFrom=I.prototype.qe;I.prototype.clone=I.prototype.clone;I.prototype.fromQuat=I.prototype.Cb;I.prototype.toQuat=I.prototype.gk;I.prototype.fromEulerXyz=I.prototype.mb;I.prototype.toEulerXyz=I.prototype.Fi;I.prototype.getRow=I.prototype.wc;I.prototype.getCol=I.prototype.kc;I.prototype.getRowTo=I.prototype.xc;I.prototype.getColTo=I.prototype.lc;I.prototype.fromRows=I.prototype.Kb;I.prototype.fromCols=I.prototype.wa;I.prototype.toString=I.prototype.toString;window.OIMO.Mat4=J;J.prototype.init=J.prototype.Aa;J.prototype.identity=J.prototype.rg;J.prototype.add=J.prototype.kc;J.prototype.sub=J.prototype.gg;J.prototype.scale=J.prototype.bf;J.prototype.mul=J.prototype.ie;J.prototype.addEq=J.prototype.lc;J.prototype.subEq=J.prototype.hg;J.prototype.scaleEq=J.prototype.cf;J.prototype.mulEq=J.prototype.Fe;J.prototype.prependScale=J.prototype.Je;J.prototype.appendScale=J.prototype.Dc;J.prototype.prependRotation=J.prototype.He;J.prototype.appendRotation=J.prototype.wc;J.prototype.prependTranslation=J.prototype.Ei;J.prototype.appendTranslation=J.prototype.wa;J.prototype.prependScaleEq=J.prototype.Ke;J.prototype.appendScaleEq=J.prototype.Hc;J.prototype.prependRotationEq=J.prototype.Ie;J.prototype.appendRotationEq=J.prototype.xc;J.prototype.prependTranslationEq=J.prototype.Fi;J.prototype.appendTranslationEq=J.prototype.mb;J.prototype.transpose=J.prototype.kg;J.prototype.transposeEq=J.prototype.ph;J.prototype.determinant=J.prototype.Uc;J.prototype.trace=J.prototype.jg;J.prototype.inverse=J.prototype.Wc;J.prototype.inverseEq=J.prototype.vd;J.prototype.lookAt=J.prototype.Kb;J.prototype.perspective=J.prototype.Ge;J.prototype.ortho=J.prototype.Di;J.prototype.toArray=J.prototype.ig;J.prototype.copyFrom=J.prototype.qe;J.prototype.fromMat3=J.prototype.Vc;J.prototype.fromTransform=J.prototype.Cb;J.prototype.clone=J.prototype.clone;J.prototype.toString=J.prototype.toString;window.OIMO.MathUtil=pa;pa.abs=pa.abs;pa.sin=pa.sin;pa.cos=pa.cos;pa.tan=pa.tan;pa.asin=pa.asin;pa.acos=pa.acos;pa.atan=pa.atan;pa.safeAsin=pa.ie;pa.safeAcos=pa.vd;pa.atan2=pa.atan2;pa.sqrt=pa.sqrt;pa.clamp=pa.Cb;pa.rand=pa.Hc;pa.randIn=pa.Uc;pa.randVec3In=pa.Wc;pa.randVec3=pa.Vc;window.OIMO.Pool=Nb;Nb.prototype.vec3=Nb.prototype.Dc;Nb.prototype.mat3=Nb.prototype.lc;Nb.prototype.mat4=Nb.prototype.wc;Nb.prototype.quat=Nb.prototype.xc;Nb.prototype.dispose=Nb.prototype.wa;Nb.prototype.disposeVec3=Nb.prototype.kc;Nb.prototype.disposeMat3=Nb.prototype.mb;Nb.prototype.disposeMat4=Nb.prototype.Cb;Nb.prototype.disposeQuat=Nb.prototype.Kb;window.OIMO.Quat=wa;wa.prototype.identity=wa.prototype.rg;wa.prototype.init=wa.prototype.Aa;wa.prototype.add=wa.prototype.wa;wa.prototype.sub=wa.prototype.Hc;wa.prototype.scale=wa.prototype.xc;wa.prototype.addEq=wa.prototype.mb;wa.prototype.subEq=wa.prototype.Uc;wa.prototype.scaleEq=wa.prototype.Dc;wa.prototype.length=wa.prototype.length;wa.prototype.lengthSq=wa.prototype.kc;wa.prototype.dot=wa.prototype.Cb;wa.prototype.normalized=wa.prototype.wc;wa.prototype.normalize=wa.prototype.lc;wa.prototype.setArc=wa.prototype.Vc;wa.prototype.slerp=wa.prototype.Wc;wa.prototype.copyFrom=wa.prototype.qe;wa.prototype.clone=wa.prototype.clone;wa.prototype.fromMat3=wa.prototype.Kb;wa.prototype.toMat3=wa.prototype.vd;wa.prototype.toString=wa.prototype.toString;window.OIMO.Contact=ac;ac.prototype.getShape1=ac.prototype.kc;ac.prototype.getShape2=ac.prototype.lc;ac.prototype.isTouching=ac.prototype.Kk;ac.prototype.getManifold=ac.prototype.mb;ac.prototype.getContactConstraint=ac.prototype.wa;ac.prototype.getPrev=ac.prototype.Kb;ac.prototype.getNext=ac.prototype.Cb;window.OIMO.ContactLink=Zb;Zb.prototype.getContact=Zb.prototype.wa;Zb.prototype.getOther=Zb.prototype.Cb;Zb.prototype.getPrev=Zb.prototype.Kb;Zb.prototype.getNext=Zb.prototype.mb;window.OIMO.ContactManager=De;De.prototype.getNumContacts=De.prototype.mb;De.prototype.getContactList=De.prototype.wa;window.OIMO.TimeStep=Aj;window.OIMO.World=Ca;Ca.prototype.step=Ca.prototype.Fe;Ca.prototype.addRigidBody=Ca.prototype.mb;Ca.prototype.removeRigidBody=Ca.prototype.Ge;Ca.prototype.addJoint=Ca.prototype.wa;Ca.prototype.removeJoint=Ca.prototype.bm;Ca.prototype.setDebugDraw=Ca.prototype.He;Ca.prototype.getDebugDraw=Ca.prototype.lc;Ca.prototype.debugDraw=Ca.prototype.Cb;Ca.prototype.rayCast=Ca.prototype.ke;Ca.prototype.convexCast=Ca.prototype.Vf;Ca.prototype.aabbTest=Ca.prototype.Ih;Ca.prototype.getRigidBodyList=Ca.prototype.vd;Ca.prototype.getJointList=Ca.prototype.xc;Ca.prototype.getBroadPhase=Ca.prototype.Kb;Ca.prototype.getContactManager=Ca.prototype.kc;Ca.prototype.getNumRigidBodies=Ca.prototype.Vc;Ca.prototype.getNumJoints=Ca.prototype.Hc;Ca.prototype.getNumShapes=Ca.prototype.ie;Ca.prototype.getNumIslands=Ca.prototype.Dc;Ca.prototype.getNumVelocityIterations=Ca.prototype.Wc;Ca.prototype.setNumVelocityIterations=Ca.prototype.Ke;Ca.prototype.getNumPositionIterations=Ca.prototype.Uc;Ca.prototype.setNumPositionIterations=Ca.prototype.Je;Ca.prototype.getGravity=Ca.prototype.wc;Ca.prototype.setGravity=Ca.prototype.Ie;window.OIMO.AabbTestCallback=yj;window.OIMO.ContactCallback=xj;window.OIMO.RayCastCallback=Ni;window.OIMO.RayCastClosest=hf;hf.prototype.clear=hf.prototype.clear;hf.prototype.process=hf.prototype.process;window.OIMO.DebugDrawStyle=wj;window.OIMO.Performance=Ce;window.OIMO.ConstraintSolver=Ob;Ob.prototype.preSolveVelocity=Ob.prototype.Qh;Ob.prototype.warmStart=Ob.prototype.Zh;Ob.prototype.solveVelocity=Ob.prototype.Vh;Ob.prototype.postSolveVelocity=Ob.prototype.cj;Ob.prototype.preSolvePosition=Ob.prototype.jh;Ob.prototype.solvePositionSplitImpulse=Ob.prototype.Uh;Ob.prototype.solvePositionNgs=Ob.prototype.Th;Ob.prototype.postSolve=Ob.prototype.postSolve;window.OIMO.PositionCorrectionAlgorithm=jc;window.OIMO.ContactConstraint=Uc;Uc.prototype.getShape1=Uc.prototype.mb;Uc.prototype.getShape2=Uc.prototype.Cb;Uc.prototype.getManifold=Uc.prototype.wa;Uc.prototype.isTouching=Uc.prototype.Kk;window.OIMO.Manifold=Tb;Tb.prototype.getNormal=Tb.prototype.Cb;Tb.prototype.getNormalTo=Tb.prototype.Kb;Tb.prototype.getTangent=Tb.prototype.wc;Tb.prototype.getTangentTo=Tb.prototype.xc;Tb.prototype.getBinormal=Tb.prototype.wa;Tb.prototype.getBinormalTo=Tb.prototype.mb;Tb.prototype.getPoints=Tb.prototype.lc;Tb.prototype.getNumPoints=Tb.prototype.kc;window.OIMO.ManifoldPoint=Lb;Lb.prototype.getPosition1=Lb.prototype.Kb;Lb.prototype.getPosition1To=Lb.prototype.kc;Lb.prototype.getPosition2=Lb.prototype.lc;Lb.prototype.getPosition2To=Lb.prototype.wc;Lb.prototype.getDepth=Lb.prototype.mb;Lb.prototype.isWarmStarted=Lb.prototype.Dc;Lb.prototype.getNormalImpulse=Lb.prototype.Cb;Lb.prototype.getTangentImpulse=Lb.prototype.xc;Lb.prototype.getBinormalImpulse=Lb.prototype.wa;Lb.prototype.isEnabled=Lb.prototype.Hc;window.OIMO.Joint=N;N.prototype.getRigidBody1=N.prototype.Ke;N.prototype.getRigidBody2=N.prototype.bf;N.prototype.getType=N.prototype.hg;N.prototype.getAnchor1=N.prototype.mb;N.prototype.getAnchor2=N.prototype.Kb;N.prototype.getAnchor1To=N.prototype.Cb;N.prototype.getAnchor2To=N.prototype.kc;N.prototype.getLocalAnchor1=N.prototype.Fe;N.prototype.getLocalAnchor2=N.prototype.He;N.prototype.getLocalAnchor1To=N.prototype.Ge;N.prototype.getLocalAnchor2To=N.prototype.Ie;N.prototype.getBasis1=N.prototype.Hc;N.prototype.getBasis2=N.prototype.Vc;N.prototype.getBasis1To=N.prototype.Uc;N.prototype.getBasis2To=N.prototype.Wc;N.prototype.getAllowCollision=N.prototype.wa;N.prototype.setAllowCollision=N.prototype.ig;N.prototype.getBreakForce=N.prototype.vd;N.prototype.setBreakForce=N.prototype.jg;N.prototype.getBreakTorque=N.prototype.ie;N.prototype.setBreakTorque=N.prototype.kg;N.prototype.getPositionCorrectionAlgorithm=N.prototype.Je;N.prototype.setPositionCorrectionAlgorithm=N.prototype.ph;N.prototype.getAppliedForce=N.prototype.lc;N.prototype.getAppliedForceTo=N.prototype.wc;N.prototype.getAppliedTorque=N.prototype.xc;N.prototype.getAppliedTorqueTo=N.prototype.Dc;N.prototype.getPrev=N.prototype.gg;N.prototype.getNext=N.prototype.cf;window.OIMO.CylindricalJoint=Fb;Fb.prototype.getAxis1=Fb.prototype.Zg;Fb.prototype.getAxis2=Fb.prototype.ah;Fb.prototype.getAxis1To=Fb.prototype.$g;Fb.prototype.getAxis2To=Fb.prototype.bh;Fb.prototype.getLocalAxis1=Fb.prototype.dh;Fb.prototype.getLocalAxis2=Fb.prototype.fh;Fb.prototype.getLocalAxis1To=Fb.prototype.eh;Fb.prototype.getLocalAxis2To=Fb.prototype.gh;Fb.prototype.getTranslationalSpringDamper=Fb.prototype.po;Fb.prototype.getRotationalSpringDamper=Fb.prototype.eo;Fb.prototype.getTranslationalLimitMotor=Fb.prototype.no;Fb.prototype.getRotationalLimitMotor=Fb.prototype.bo;Fb.prototype.getAngle=Fb.prototype.Gl;Fb.prototype.getTranslation=Fb.prototype.Jl;window.OIMO.JointConfig=Gb;window.OIMO.CylindricalJointConfig=wf;wf.prototype.init=wf.prototype.Aa;window.OIMO.GenericJoint=Sb;Sb.prototype.getAxisX=Sb.prototype.Un;Sb.prototype.getAxisY=Sb.prototype.Vn;Sb.prototype.getAxisZ=Sb.prototype.Wn;Sb.prototype.getTranslationalSpringDampers=Sb.prototype.qo;Sb.prototype.getRotationalSpringDampers=Sb.prototype.fo;Sb.prototype.getTranslationalLimitMotors=Sb.prototype.oo;Sb.prototype.getRotationalLimitMotors=Sb.prototype.co;Sb.prototype.getAngles=Sb.prototype.Tn;Sb.prototype.getTranslations=Sb.prototype.ro;window.OIMO.GenericJointConfig=Lg;Lg.prototype.init=Lg.prototype.Aa;window.OIMO.JointLink=qc;qc.prototype.getContact=qc.prototype.wa;qc.prototype.getOther=qc.prototype.Cb;qc.prototype.getPrev=qc.prototype.Kb;qc.prototype.getNext=qc.prototype.mb;window.OIMO.JointType=Mb;window.OIMO.PrismaticJoint=Jb;Jb.prototype.getAxis1=Jb.prototype.Zg;Jb.prototype.getAxis2=Jb.prototype.ah;Jb.prototype.getAxis1To=Jb.prototype.$g;Jb.prototype.getAxis2To=Jb.prototype.bh;Jb.prototype.getLocalAxis1=Jb.prototype.dh;Jb.prototype.getLocalAxis2=Jb.prototype.fh;Jb.prototype.getLocalAxis1To=Jb.prototype.eh;Jb.prototype.getLocalAxis2To=Jb.prototype.gh;Jb.prototype.getSpringDamper=Jb.prototype.Qj;Jb.prototype.getLimitMotor=Jb.prototype.Il;Jb.prototype.getTranslation=Jb.prototype.Jl;window.OIMO.PrismaticJointConfig=Kg;Kg.prototype.init=Kg.prototype.Aa;window.OIMO.RagdollJoint=pb;pb.prototype.getAxis1=pb.prototype.Zg;pb.prototype.getAxis2=pb.prototype.ah;pb.prototype.getAxis1To=pb.prototype.$g;pb.prototype.getAxis2To=pb.prototype.bh;pb.prototype.getLocalAxis1=pb.prototype.dh;pb.prototype.getLocalAxis2=pb.prototype.fh;pb.prototype.getLocalAxis1To=pb.prototype.eh;pb.prototype.getLocalAxis2To=pb.prototype.gh;pb.prototype.getTwistSpringDamper=pb.prototype.vo;pb.prototype.getTwistLimitMotor=pb.prototype.uo;pb.prototype.getSwingSpringDamper=pb.prototype.mo;pb.prototype.getSwingAxis=pb.prototype.ko;pb.prototype.getSwingAxisTo=pb.prototype.lo;pb.prototype.getSwingAngle=pb.prototype.jo;pb.prototype.getTwistAngle=pb.prototype.to;window.OIMO.RagdollJointConfig=Jg;Jg.prototype.init=Jg.prototype.Aa;window.OIMO.RevoluteJoint=Qb;Qb.prototype.getAxis1=Qb.prototype.Zg;Qb.prototype.getAxis2=Qb.prototype.ah;Qb.prototype.getAxis1To=Qb.prototype.$g;Qb.prototype.getAxis2To=Qb.prototype.bh;Qb.prototype.getLocalAxis1=Qb.prototype.dh;Qb.prototype.getLocalAxis2=Qb.prototype.fh;Qb.prototype.getLocalAxis1To=Qb.prototype.eh;Qb.prototype.getLocalAxis2To=Qb.prototype.gh;Qb.prototype.getSpringDamper=Qb.prototype.Qj;Qb.prototype.getLimitMotor=Qb.prototype.Il;Qb.prototype.getAngle=Qb.prototype.Gl;window.OIMO.RevoluteJointConfig=ff;ff.prototype.init=ff.prototype.Aa;window.OIMO.RotationalLimitMotor=$b;$b.prototype.setLimits=$b.prototype.mh;$b.prototype.setMotor=$b.prototype.wa;$b.prototype.clone=$b.prototype.clone;window.OIMO.SphericalJoint=se;se.prototype.getSpringDamper=se.prototype.Qj;window.OIMO.SphericalJointConfig=Lf;Lf.prototype.init=Lf.prototype.Aa;window.OIMO.SpringDamper=Hb;Hb.prototype.setSpring=Hb.prototype.wa;Hb.prototype.setSymplecticEuler=Hb.prototype.mb;Hb.prototype.clone=Hb.prototype.clone;window.OIMO.TranslationalLimitMotor=tc;tc.prototype.setLimits=tc.prototype.mh;tc.prototype.setMotor=tc.prototype.wa;tc.prototype.clone=tc.prototype.clone;window.OIMO.UniversalJoint=Bb;Bb.prototype.getAxis1=Bb.prototype.Zg;Bb.prototype.getAxis2=Bb.prototype.ah;Bb.prototype.getAxis1To=Bb.prototype.$g;Bb.prototype.getAxis2To=Bb.prototype.bh;Bb.prototype.getLocalAxis1=Bb.prototype.dh;Bb.prototype.getLocalAxis2=Bb.prototype.fh;Bb.prototype.getLocalAxis1To=Bb.prototype.eh;Bb.prototype.getLocalAxis2To=Bb.prototype.gh;Bb.prototype.getSpringDamper1=Bb.prototype.ho;Bb.prototype.getSpringDamper2=Bb.prototype.io;Bb.prototype.getLimitMotor1=Bb.prototype.$n;Bb.prototype.getLimitMotor2=Bb.prototype.ao;Bb.prototype.getAngle1=Bb.prototype.Rn;Bb.prototype.getAngle2=Bb.prototype.Sn;window.OIMO.UniversalJointConfig=Kf;Kf.prototype.init=Kf.prototype.Aa;window.OIMO.ConstraintSolverType=vf;window.OIMO.DirectJointConstraintSolver=Wb;Wb.prototype.preSolveVelocity=Wb.prototype.Qh;Wb.prototype.warmStart=Wb.prototype.Zh;Wb.prototype.solveVelocity=Wb.prototype.Vh;Wb.prototype.postSolveVelocity=Wb.prototype.cj;Wb.prototype.preSolvePosition=Wb.prototype.jh;Wb.prototype.solvePositionSplitImpulse=Wb.prototype.Uh;Wb.prototype.solvePositionNgs=Wb.prototype.Th;Wb.prototype.postSolve=Wb.prototype.postSolve;window.OIMO.PgsContactConstraintSolver=Pb;Pb.prototype.preSolveVelocity=Pb.prototype.Qh;Pb.prototype.warmStart=Pb.prototype.Zh;Pb.prototype.solveVelocity=Pb.prototype.Vh;Pb.prototype.preSolvePosition=Pb.prototype.jh;Pb.prototype.solvePositionSplitImpulse=Pb.prototype.Uh;Pb.prototype.solvePositionNgs=Pb.prototype.Th;Pb.prototype.postSolve=Pb.prototype.postSolve;window.OIMO.PgsJointConstraintSolver=Rb;Rb.prototype.preSolveVelocity=Rb.prototype.Qh;Rb.prototype.warmStart=Rb.prototype.Zh;Rb.prototype.solveVelocity=Rb.prototype.Vh;Rb.prototype.postSolveVelocity=Rb.prototype.cj;Rb.prototype.preSolvePosition=Rb.prototype.jh;Rb.prototype.solvePositionSplitImpulse=Rb.prototype.Uh;Rb.prototype.solvePositionNgs=Rb.prototype.Th;Rb.prototype.postSolve=Rb.prototype.postSolve;window.OIMO.MassData=fj;window.OIMO.RigidBody=x;x.prototype.getPosition=x.prototype.Om;x.prototype.getPositionTo=x.prototype.Pm;x.prototype.setPosition=x.prototype.Po;x.prototype.translate=x.prototype.cn;x.prototype.getRotation=x.prototype.Vm;x.prototype.getRotationTo=x.prototype.Wm;x.prototype.setRotation=x.prototype.Qo;x.prototype.setRotationXyz=x.prototype.Ro;x.prototype.rotate=x.prototype.Ho;x.prototype.rotateXyz=x.prototype.Mo;x.prototype.getOrientation=x.prototype.Mm;x.prototype.getOrientationTo=x.prototype.Nm;x.prototype.setOrientation=x.prototype.No;x.prototype.getTransform=x.prototype.Xm;x.prototype.getTransformTo=x.prototype.Ym;x.prototype.setTransform=x.prototype.So;x.prototype.getMass=x.prototype.ph;x.prototype.getLocalInertia=x.prototype.cf;x.prototype.getLocalInertiaTo=x.prototype.gg;x.prototype.getMassData=x.prototype.Di;x.prototype.getMassDataTo=x.prototype.Ei;x.prototype.setMassData=x.prototype.ln;x.prototype.getRotationFactor=x.prototype.fm;x.prototype.setRotationFactor=x.prototype.mn;x.prototype.getLinearVelocity=x.prototype.Ke;x.prototype.getLinearVelocityTo=x.prototype.bf;x.prototype.setLinearVelocity=x.prototype.kn;x.prototype.getAngularVelocity=x.prototype.Wc;x.prototype.getAngularVelocityTo=x.prototype.vd;x.prototype.setAngularVelocity=x.prototype.fn;x.prototype.addLinearVelocity=x.prototype.mb;x.prototype.addAngularVelocity=x.prototype.wa;x.prototype.applyImpulse=x.prototype.wc;x.prototype.applyLinearImpulse=x.prototype.xc;x.prototype.applyAngularImpulse=x.prototype.Kb;x.prototype.applyForce=x.prototype.kc;x.prototype.applyForceToCenter=x.prototype.lc;x.prototype.applyTorque=x.prototype.Dc;x.prototype.getLinearContactImpulse=x.prototype.He;x.prototype.getLinearContactImpulseTo=x.prototype.Ie;x.prototype.getAngularContactImpulse=x.prototype.Hc;x.prototype.getAngularContactImpulseTo=x.prototype.Uc;x.prototype.getGravityScale=x.prototype.Fe;x.prototype.setGravityScale=x.prototype.hn;x.prototype.getLocalPoint=x.prototype.hg;x.prototype.getLocalPointTo=x.prototype.ig;x.prototype.getLocalVector=x.prototype.jg;x.prototype.getLocalVectorTo=x.prototype.kg;x.prototype.getWorldPoint=x.prototype.um;x.prototype.getWorldPointTo=x.prototype.ym;x.prototype.getWorldVector=x.prototype.Am;x.prototype.getWorldVectorTo=x.prototype.Bm;x.prototype.getNumShapes=x.prototype.Jm;x.prototype.getShapeList=x.prototype.sm;x.prototype.getNumContectLinks=x.prototype.Fi;x.prototype.getContactLinkList=x.prototype.ie;x.prototype.getNumJointLinks=x.prototype.gk;x.prototype.getJointLinkList=x.prototype.Ge;x.prototype.addShape=x.prototype.Cb;x.prototype.removeShape=x.prototype.dn;x.prototype.getType=x.prototype.Eo;x.prototype.setType=x.prototype.nn;x.prototype.wakeUp=x.prototype.pn;x.prototype.sleep=x.prototype.on;x.prototype.isSleeping=x.prototype.Dm;x.prototype.getSleepTime=x.prototype.tm;x.prototype.setAutoSleep=x.prototype.gn;x.prototype.getLinearDamping=x.prototype.Je;x.prototype.setLinearDamping=x.prototype.jn;x.prototype.getAngularDamping=x.prototype.Vc;x.prototype.setAngularDamping=x.prototype.en;x.prototype.getPrev=x.prototype.Um;x.prototype.getNext=x.prototype.Im;window.OIMO.RigidBodyConfig=Rj;window.OIMO.RigidBodyType=Qe;window.OIMO.Shape=Ka;Ka.prototype.getFriction=Ka.prototype.wc;Ka.prototype.setFriction=Ka.prototype.Ke;Ka.prototype.getRestitution=Ka.prototype.Uc;Ka.prototype.setRestitution=Ka.prototype.cf;Ka.prototype.getLocalTransform=Ka.prototype.Dc;Ka.prototype.getLocalTransformTo=Ka.prototype.Hc;Ka.prototype.getTransform=Ka.prototype.ie;Ka.prototype.getTransformTo=Ka.prototype.Fe;Ka.prototype.setLocalTransform=Ka.prototype.bf;Ka.prototype.getDensity=Ka.prototype.lc;Ka.prototype.setDensity=Ka.prototype.Je;Ka.prototype.getAabb=Ka.prototype.wa;Ka.prototype.getAabbTo=Ka.prototype.mb;Ka.prototype.getGeometry=Ka.prototype.xc;Ka.prototype.getRigidBody=Ka.prototype.Vc;Ka.prototype.getCollisionGroup=Ka.prototype.Cb;Ka.prototype.setCollisionGroup=Ka.prototype.Ge;Ka.prototype.getCollisionMask=Ka.prototype.Kb;Ka.prototype.setCollisionMask=Ka.prototype.He;Ka.prototype.getContactCallback=Ka.prototype.kc;Ka.prototype.setContactCallback=Ka.prototype.Ie;Ka.prototype.getPrev=Ka.prototype.vd;Ka.prototype.getNext=Ka.prototype.Wc;window.OIMO.ShapeConfig=Qj};ub.prototype={ni:function(){return null},oi:function(){},Qd:function(){},Kb:function(a,b){return a.Jb.J&&a.Kb.K&&a.Lb.L:!1},$i:function(){},wa:function(){return this.pe},Cb:function(){return this.qk},mb:function(){return this.Dj},ke:function(){},Vf:function(){},Ih:function(){}};wc.prototype={Xe:function(){},Lb:function(){},Wi:function(){return!1},mb:function(){return this.Jb},wa:function(){return this.Sf},ke:function(a,b,e,d){var c,f,h,l;c=a.x;f=a.y;a=a.z;h=b.x;l=b.y;b=b.z;c-=e.v;f-=e.A;a-=e.B;h-=e.v;l-=e.A;b-=e.B;if(this.Wi(e.o*c+e.i*f+e.l*a,e.f*c+e.m*f+e.g*a,e.h*c+e.j*f+e.s*a,e.o*h+e.i*l+e.l*b,e.f*h+e.m*l+e.g*b,e.h*h+e.j*l+e.s*b,d)){var g,k;b=d.position;c=b.x;f=b.y;h=b.z;b=d.normal;l=b.x;g=b.y;k=b.z;var m,p;m=e.o*c+e.f*f+e.h*h;p=e.i*c+e.m*f+e.j*h;h=e.l*c+e.g*f+e.s*h;b=e.o*l+e.f*g+e.h*k;a=e.i*l+e.m*g+e.j*k;l=e.l*l+e.g*g+e.s*k;c=m+e.v;f=p+e.A;h+=e.B;e=d.position;e.x=c;e.y=f;e.z=h;d=d.normal;d.x=b;d.y=a;d.z=l;return!0}return!1}};Qa.wa=wc;Qa.prototype=gb(wc.prototype,{Xn:function(){return this.Rb},Go:function(a){0>a&&(a=0);this.Rb=a},he:function(){},ke:function(a,b,e,d){return this.rm?lb.mb.ke(this,e,a,b,d):wc.prototype.ke.call(this,a,b,e,d)}});jj.wa=Qa;jj.prototype=gb(Qa.prototype,{Aa:function(a,b,e){this.Kn=a;var d,c,f;d=e.x;c=e.y;f=e.z;var h;e=b.o*d+b.i*c+b.l*f;h=b.f*d+b.m*c+b.g*f;b=b.h*d+b.j*c+b.s*f;d=this.Xl=new n;d.x=e;d.y=h;d.z=b;this.Rb=a.Rb},he:function(a,b){this.Kn.he(a,b);var e=this.Xl;0e.J&&a.Ke.K&&a.Le.L){var c=this.Eh;null!=c?(this.Eh=c.M,c.M=null):c=new ve;null!=this.pe&&(c.M=this.pe);this.pe=c;c.Ch=a;c.Dh=e}e=d}a=b}},ke:function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;for(var l=this.Oe;null!=l;){var g=l.M,k=d,m=c,p=a,r=f,q=h,t=b,A=l.J,L=l.K,u=l.L,z=l.G,n=l.H,D=l.I;if(A>(k>r?k:r)||z<(k(m>q?m:q)||n<(m(p>t?p:t)||D<(pr?-r:r,y=0>q?-q:q,B=0>Ib?-Ib:Ib,E=.5*(z-A),K=.5*(n-L),H=.5*(D-u),k=k-.5*(z+A),m=m-.5*(n+L),p=p-.5*(D+u),u=m*Ib-p*q;0<(0>u?-u:u)-(K*B+H*y)?p=!0:(p=p*r-k*Ib,p=0<(0>p?-p:p)-(H*t+E*B));p?r=!0:(r=k*q-m*r,r=0<(0>r?-r:r)-(E*y+K*t));r=r?!1:!0}r&&e.process(l);l=g}},Vf:function(a,b,e,d){for(var c=this.Oe;null!=c;){var f=c.M,h=this.u.min;h.x=c.J;h.y=c.K;h.z=c.L;h=this.u.max;h.x=c.G;h.y=c.H;h.z=c.I;this.mk.Aa(a,b,e);h=lb.mb;0==h.Nj(this.mk,this.u,b,this.rg,null,!1)&&0>=h.distance&&d.process(c);c=f}},Ih:function(a,b){for(var e=this.Oe;null!=e;){var d=e.M;a.nae.J&&a.oae.K&&a.pae.L&&b.process(e);e=d}}});Kb.wa=ub;Kb.prototype=gb(ub.prototype,{Kh:function(a,b){this.Dj++;var e=0==a.P,d=0==b.P;a==b?e||(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):a.Jb.J&&a.Kb.K&&a.Lb.L&&(e&&d?(e=this.Eh,null!=e?(this.Eh=e.M,e.M=null):e=new ve,null!=this.pe&&(e.M=this.pe),this.pe=e,e.Ch=a.ub,e.Dh=b.ub):d||a.P>b.P?(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):(this.Kh(b.F[0],a),this.Kh(b.F[1],a)))},am:function(a,b,e,d,c,f,h,l){var g=a.J,k=a.K,m=a.L,p=a.G,r=a.H,q=a.I,t;if(g>(b>c?b:c)||p<(b(e>f?e:f)||r<(e(d>h?d:h)||q<(dA?-A:A;var z=0>L?-L:L,n=0>u?-u:u,D=.5*(p-g),Ib=.5*(r-k),y=.5*(q-m),g=b-.5*(p+g),k=e-.5*(r+k),m=d-.5*(q+m),q=k*u-m*L;0<(0>q?-q:q)-(Ib*n+y*z)?n=!0:(u=m*A-g*u,n=0<(0>u?-u:u)-(y*t+D*n));n?t=!0:(A=g*L-k*A,t=0<(0>A?-A:A)-(D*z+Ib*t));t=t?!1:!0}t&&(0==a.P?l.process(a.ub):(this.am(a.F[0],b,e,d,c,f,h,l),this.am(a.F[1],b,e,d,c,f,h,l)))},El:function(a,b,e,d,c){var f=this.u.min;f.x=a.J;f.y=a.K;f.z=a.L;f=this.u.max;f.x=a.G;f.y=a.H;f.z=a.I;this.mk.Aa(b,e,d);f=lb.mb;0==f.Nj(this.mk,this.u,e,this.rg,null,!1)&&0>=f.distance&&(0==a.P?c.process(a.ub):(this.El(a.F[0],b,e,d,c),this.El(a.F[1],b,e,d,c)))},yl:function(a,b,e){a.Jb.na&&a.Kb.oa&&a.Lb.pa&&(0==a.P?e.process(a.ub):(this.yl(a.F[0],b,e),this.yl(a.F[1],b,e)))},ni:function(a,b){a=new Wi(a,this.lm++);this.Vi++;null==this.Oe?this.Oe=a:(this.gf.M=a,a.ia=this.gf);this.gf=a;a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;b=this.ye;var e=b.qd;null!=e?(b.qd=e.M,e.M=null):e=new oi;var d=e;d.ub=a;a.ei=d;d.J=a.J;d.K=a.K;d.L=a.L;d.G=a.G;d.H=a.H;d.I=a.I;b.yk++;null==b.zg?b.zg=d:(b.qf.ng=d,d.og=b.qf);b.qf=d;if(null==b.Nb)b.Nb=d;else{for(var c=b.Nb;0e.P)){var d=e.Ea,f=e.F[0],h=e.F[1],l=f.P-h.P,c=e.Ja;1l.P?(f.F[1]=e,e.Ea=f,e.Ja=1,e.F[0]=l,l.Ea=e,l.Ja=0):(f.F[0]=e,e.Ea=f,e.Ja=0,e.F[0]=h,h.Ea=e,h.Ja=0),h=f.F[0],l=f.F[1],f.J=h.Jl.G?h.G:l.G,f.H=h.H>l.H?h.H:l.H,f.I=h.I>l.I?h.I:l.I,h=f.F[0].P,l=f.F[1].P,f.P=(h>l?h:l)+1,h=e.F[0],l=e.F[1],e.J=h.Jl.G?h.G:l.G,e.H=h.H>l.H?h.H:l.H,e.I=h.I>l.I?h.I:l.I,h=e.F[0].P,l=e.F[1].P,e.P=(h>l?h:l)+1,null!=d?(d.F[c]=f,f.Ea=d,f.Ja=c):(b.Nb=f,f.Ea=null),e=f):-1>l&&(f=h.F[0],l=h.F[1],f.P>l.P?(h.F[1]=e,e.Ea=h,e.Ja=1,e.F[1]=l,l.Ea=e,l.Ja=1):(h.F[0]=e,e.Ea=h,e.Ja=0,e.F[1]=f,f.Ea=e,f.Ja=1),f=h.F[0],l=h.F[1],h.J=f.Jl.G?f.G:l.G,h.H=f.H>l.H?f.H:l.H,h.I=f.I>l.I?f.I:l.I,f=h.F[0].P,l=h.F[1].P,h.P=(f>l?f:l)+1,f=e.F[0],l=e.F[1],e.J=f.Jl.G?f.G:l.G,e.H=f.H>l.H?f.H:l.H,e.I=f.I>l.I?f.I:l.I,f=e.F[0].P,l=e.F[1].P,e.P=(f>l?f:l)+1,null!=d?(d.F[c]=h,h.Ea=d,h.Ja=c):(b.Nb=h,h.Ea=null),e=h)}d=e.F[0].P;c=e.F[1].P;e.P=(d>c?d:c)+1;d=e.F[0];c=e.F[1];e.J=d.Jc.G?d.G:c.G;e.H=d.H>c.H?d.H:c.H;e.I=d.I>c.I?d.I:c.I;e=e.Ea}}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){b=Array(this.$f<<1);e=0;for(d=this.$f;ed.P)){var c=d.Ea,h=d.F[0],l=d.F[1],g=h.P-l.P,f=d.Ja;1g.P?(h.F[1]=d,d.Ea=h,d.Ja=1,d.F[0]=g,g.Ea=d,g.Ja=0):(h.F[0]=d,d.Ea=h,d.Ja=0,d.F[0]=l,l.Ea=d,l.Ja=0),l=h.F[0],g=h.F[1],h.J=l.Jg.G?l.G:g.G,h.H=l.H>g.H?l.H:g.H,h.I=l.I>g.I?l.I:g.I,l=h.F[0].P,g=h.F[1].P,h.P=(l>g?l:g)+1,l=d.F[0],g=d.F[1],d.J=l.Jg.G?l.G:g.G,d.H=l.H>g.H?l.H:g.H,d.I=l.I>g.I?l.I:g.I,l=d.F[0].P,g=d.F[1].P,d.P=(l>g?l:g)+1,null!=c?(c.F[f]=h,h.Ea=c,h.Ja=f):(b.Nb=h,h.Ea=null),d=h):-1>g&&(h=l.F[0],g=l.F[1],h.P>g.P?(l.F[1]=d,d.Ea=l,d.Ja=1,d.F[1]=g,g.Ea=d,g.Ja=1):(l.F[0]=d,d.Ea=l,d.Ja=0,d.F[1]=h,h.Ea=d,h.Ja=1),h=l.F[0],g=l.F[1],l.J=h.Jg.G?h.G:g.G,l.H=h.H>g.H?h.H:g.H,l.I=h.I>g.I?h.I:g.I,h=l.F[0].P,g=l.F[1].P,l.P=(h>g?h:g)+1,h=d.F[0],g=d.F[1],d.J=h.Jg.G?h.G:g.G,d.H=h.H>g.H?h.H:g.H,d.I=h.I>g.I?h.I:g.I,h=d.F[0].P,g=d.F[1].P,d.P=(h>g?h:g)+1,null!=c?(c.F[f]=l,l.Ea=c,l.Ja=f):(b.Nb=l,l.Ea=null),d=l)}c=d.F[0].P;f=d.F[1].P;d.P=(c>f?c:f)+1;c=d.F[0];f=d.F[1];d.J=c.Jf.G?c.G:f.G;d.H=c.H>f.H?c.H:f.H;d.I=c.I>f.I?c.I:f.I;d=d.Ea}}}a.ei=null;e.F[0]=null;e.F[1]=null;e.Ja=0;e.Ea=null;e.P=0;e.ub=null;e.M=b.qd;b.qd=e;a.userData=null;a.M=null;a.ia=null;a.zh&&(a.zh=!1)},Qd:function(a,b,e){if(!(a.J<=b.na&&a.G>=b.ka&&a.K<=b.oa&&a.H>=b.la&&a.L<=b.pa&&a.I>=b.ma)){a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;if(null!=e){var d;b=e.x;d=e.y;e=e.z;a.J+=0b?0:b;a.H+=0>d?0:d;a.I+=0>e?0:e}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){e=Array(this.$f<<1);b=0;for(d=this.$f;bthis.Vi)){for(var b=this.$f/this.Vit.P)){var A=t.Ea,L=t.F[0],u=t.F[1],z=L.P-u.P,n=t.Ja;if(1Ib.P){L.F[1]=t;t.Ea=L;t.Ja=1;t.F[0]=Ib;Ib.Ea=t;Ib.Ja=0;var y=L.F[0],B=L.F[1];L.J=y.JB.G?y.G:B.G;L.H=y.H>B.H?y.H:B.H;L.I=y.I>B.I?y.I:B.I;var E=L.F[0].P,K=L.F[1].P;L.P=(E>K?E:K)+1;var H=t.F[0],mc=t.F[1];t.J=H.Jmc.G?H.G:mc.G;t.H=H.H>mc.H?H.H:mc.H;t.I=H.I>mc.I?H.I:mc.I;var R=t.F[0].P,x=t.F[1].P;t.P=(R>x?R:x)+1}else{L.F[0]=t;t.Ea=L;t.Ja=0;t.F[0]=D;D.Ea=t;D.Ja=0;var X=L.F[0],dd=L.F[1];L.J=X.Jdd.G?X.G:dd.G;L.H=X.H>dd.H?X.H:dd.H;L.I=X.I>dd.I?X.I:dd.I;var Da=L.F[0].P,qa=L.F[1].P;L.P=(Da>qa?Da:qa)+1;var Ub=t.F[0],ya=t.F[1];t.J=Ub.Jya.G?Ub.G:ya.G;t.H=Ub.H>ya.H?Ub.H:ya.H;t.I=Ub.I>ya.I?Ub.I:ya.I;var Jj=t.F[0].P,Ea=t.F[1].P;t.P=(Jj>Ea?Jj:Ea)+1}null!=A?(A.F[n]=L,L.Ea=A,L.Ja=n):(h.Nb=L,L.Ea=null);t=L}else if(-1>z){var O=u.F[0],sa=u.F[1];if(O.P>sa.P){u.F[1]=t;t.Ea=u;t.Ja=1;t.F[1]=sa;sa.Ea=t;sa.Ja=1;var ba=u.F[0],za=u.F[1];u.J=ba.Jza.G?ba.G:za.G;u.H=ba.H>za.H?ba.H:za.H;u.I=ba.I>za.I?ba.I:za.I;var Ta=u.F[0].P,C=u.F[1].P;u.P=(Ta>C?Ta:C)+1;var Aa=t.F[0],na=t.F[1];t.J=Aa.Jna.G?Aa.G:na.G;t.H=Aa.H>na.H?Aa.H:na.H;t.I=Aa.I>na.I?Aa.I:na.I;var La=t.F[0].P,Ba=t.F[1].P;t.P=(La>Ba?La:Ba)+1}else{u.F[0]=t;t.Ea=u;t.Ja=0;t.F[1]=O;O.Ea=t;O.Ja=1;var ta=u.F[0],S=u.F[1];u.J=ta.JS.G?ta.G:S.G;u.H=ta.H>S.H?ta.H:S.H;u.I=ta.I>S.I?ta.I:S.I;var ha=u.F[0].P,ea=u.F[1].P;u.P=(ha>ea?ha:ea)+1;var da=t.F[0],M=t.F[1];t.J=da.JM.G?da.G:M.G;t.H=da.H>M.H?da.H:M.H;t.I=da.I>M.I?da.I:M.I;var T=t.F[0].P,w=t.F[1].P;t.P=(T>w?T:w)+1}null!=A?(A.F[n]=u,u.Ea=A,u.Ja=n):(h.Nb=u,u.Ea=null);t=u}}var V=t.F[0].P,ia=t.F[1].P;t.P=(V>ia?V:ia)+1;var Y=t.F[0],oa=t.F[1];t.J=Y.Joa.G?Y.G:oa.G;t.H=Y.H>oa.H?Y.H:oa.H;t.I=Y.I>oa.I?Y.I:oa.I;t=t.Ea}}}f.ei=null;l.M=null;l.Ja=0;l.F[0]=null;l.F[1]=null;l.Ja=0;l.Ea=null;l.P=0;l.ub=null;l.M=h.qd;h.qd=l;var ua=this.ye,ca=ua.qd;null!=ca?(ua.qd=ca.M,ca.M=null):ca=new oi;var Ma=ca;Ma.ub=f;f.ei=Ma;Ma.J=f.J;Ma.K=f.K;Ma.L=f.L;Ma.G=f.G;Ma.H=f.H;Ma.I=f.I;ua.yk++;null==ua.zg?ua.zg=Ma:(ua.qf.ng=Ma,Ma.og=ua.qf);ua.qf=Ma;if(null==ua.Nb)ua.Nb=Ma;else{for(var va=ua.Nb;0Q.P)){var ja=Q.Ea,Ga=Q.F[0],P=Q.F[1],Ya=Ga.P-P.P,N=Q.Ja;if(1J.P){Ga.F[1]=Q;Q.Ea=Ga;Q.Ja=1;Q.F[0]=J;J.Ea=Q;J.Ja=0;var Vb=Ga.F[0],Ab=Ga.F[1];Ga.J=Vb.JAb.G?Vb.G:Ab.G;Ga.H=Vb.H>Ab.H?Vb.H:Ab.H;Ga.I=Vb.I>Ab.I?Vb.I:Ab.I;var ib=Ga.F[0].P,hb=Ga.F[1].P;Ga.P=(ib>hb?ib:hb)+1;var ka=Q.F[0],Ia=Q.F[1];Q.J=ka.JIa.G?ka.G:Ia.G;Q.H=ka.H>Ia.H?ka.H:Ia.H;Q.I=ka.I>Ia.I?ka.I:Ia.I;var ab=Q.F[0].P,bb=Q.F[1].P;Q.P=(ab>bb?ab:bb)+1}else{Ga.F[0]=Q;Q.Ea=Ga;Q.Ja=0;Q.F[0]=wb;wb.Ea=Q;wb.Ja=0;var Wa=Ga.F[0],Va=Ga.F[1];Ga.J=Wa.JVa.G?Wa.G:Va.G;Ga.H=Wa.H>Va.H?Wa.H:Va.H;Ga.I=Wa.I>Va.I?Wa.I:Va.I;var qb=Ga.F[0].P,kb=Ga.F[1].P;Ga.P=(qb>kb?qb:kb)+1;var Sa=Q.F[0],Na=Q.F[1];Q.J=Sa.JNa.G?Sa.G:Na.G;Q.H=Sa.H>Na.H?Sa.H:Na.H;Q.I=Sa.I>Na.I?Sa.I:Na.I;var Za=Q.F[0].P,vb=Q.F[1].P;Q.P=(Za>vb?Za:vb)+1}null!=ja?(ja.F[N]=Ga,Ga.Ea=ja,Ga.Ja=N):(ua.Nb=Ga,Ga.Ea=null);Q=Ga}else if(-1>Ya){var mb=P.F[0],xb=P.F[1];if(mb.P>xb.P){P.F[1]=Q;Q.Ea=P;Q.Ja=1;Q.F[1]=xb;xb.Ea=Q;xb.Ja=1;var nb=P.F[0],fb=P.F[1];P.J=nb.Jfb.G?nb.G:fb.G;P.H=nb.H>fb.H?nb.H:fb.H;P.I=nb.I>fb.I?nb.I:fb.I;var Re=P.F[0].P,Db=P.F[1].P;P.P=(Re>Db?Re:Db)+1;var G=Q.F[0],sb=Q.F[1];Q.J=G.Jsb.G?G.G:sb.G;Q.H=G.H>sb.H?G.H:sb.H;Q.I=G.I>sb.I?G.I:sb.I;var jb=Q.F[0].P,Xb=Q.F[1].P;Q.P=(jb>Xb?jb:Xb)+1}else{P.F[0]=Q;Q.Ea=P;Q.Ja=0;Q.F[1]=mb;mb.Ea=Q;mb.Ja=1;var ob=P.F[0],cb=P.F[1];P.J=ob.Jcb.G?ob.G:cb.G;P.H=ob.H>cb.H?ob.H:cb.H;P.I=ob.I>cb.I?ob.I:cb.I;var zb=P.F[0].P,Xa=P.F[1].P;P.P=(zb>Xa?zb:Xa)+1;var tb=Q.F[0],v=Q.F[1];Q.J=tb.Jv.G?tb.G:v.G;Q.H=tb.H>v.H?tb.H:v.H;Q.I=tb.I>v.I?tb.I:v.I;var W=Q.F[0].P,U=Q.F[1].P;Q.P=(W>U?W:U)+1}null!=ja?(ja.F[N]=P,P.Ea=ja,P.Ja=N):(ua.Nb=P,P.Ea=null);Q=P}}var db=Q.F[0].P,cc=Q.F[1].P;Q.P=(db>cc?db:cc)+1;var Ra=Q.F[0],Ha=Q.F[1];Q.J=Ra.JHa.G?Ra.G:Ha.G;Q.H=Ra.H>Ha.H?Ra.H:Ha.H;Q.I=Ra.I>Ha.I?Ra.I:Ha.I;Q=Q.Ea}}b&&this.Kh(this.ye.Nb,f.ei);f.zh=!1}this.rf[c]=null}b||this.Kh(this.ye.Nb,this.ye.Nb);this.$f=0}},ke:function(a,b,e){null!=this.ye.Nb&&this.am(this.ye.Nb,a.x,a.y,a.z,b.x,b.y,b.z,e)},Vf:function(a,b,e,d){null!=this.ye.Nb&&this.El(this.ye.Nb,a,b,e,d)},Ih:function(a,b){null!=this.ye.Nb&&this.yl(this.ye.Nb,a,b)},so:function(){return this.ye.An()}});Wi.wa=Qc;Wi.prototype=gb(Qc.prototype,{});Hj.prototype={jm:function(a,b){switch(this.mm){case 0:var e,d,c;e=b.J+b.G;d=b.K+b.H;c=b.L+b.I;var f=a.F[0];a=a.F[1];var h,l,g;h=f.J+f.G;b=f.K+f.H;f=f.L+f.I;l=a.J+a.G;g=a.K+a.H;a=a.L+a.I;h-=e;b-=d;f-=c;l-=e;g-=d;a-=c;return h*h+b*b+f*fb.G?a.G:b.G;r=a.H>b.H?a.H:b.H;g=a.I>b.I?a.I:b.I;c=r-p;l=g-l;e=2*((d-e)*(c+l)+c*l);c=2*e;a=2*(e-2*((a.G-a.J)*(k+m)+k*m));e=f.Jb.G?f.G:b.G;r=f.H>b.H?f.H:b.H;g=f.I>b.I?f.I:b.I;0==f.P?(f=r-p,l=g-l,f=a+2*((d-e)*(f+l)+f*l)):(k=r-p,l=g-l,g=f.H-f.K,m=f.I-f.L,f=a+(2*((d-e)*(k+l)+k*l)-2*((f.G-f.J)*(g+m)+g*m)));e=h.Jb.G?h.G:b.G;r=h.H>b.H?h.H:b.H;g=h.I>b.I?h.I:b.I;0==h.P?(h=r-p,b=g-l,e=a+2*((d-e)*(h+b)+h*b)):(b=r-p,l=g-l,g=h.H-h.K,k=h.I-h.L,e=a+(2*((d-e)*(b+l)+b*l)-2*((h.G-h.J)*(g+k)+g*k)));return cb&&(b=-b);return b+this.Hl(a.F[0])+this.Hl(a.F[1])}};eb.prototype={Aa:function(a,b){this.na=a.x;this.oa=a.y;this.pa=a.z;this.ka=b.x;this.la=b.y;this.ma=b.z;return this},Uc:function(){var a=new n;a.x=this.na;a.y=this.oa;a.z=this.pa;return a},Vc:function(a){a.x=this.na;a.y=this.oa;a.z=this.pa},ie:function(a){this.na=a.x;this.oa=a.y;this.pa=a.z;return this},Dc:function(){var a=new n;a.x=this.ka;a.y=this.la;a.z=this.ma;return a},Hc:function(a){a.x=this.ka;a.y=this.la;a.z=this.ma},vd:function(a){this.ka=a.x;this.la=a.y;this.ma=a.z;return this},Cb:function(){var a=new n,b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},Kb:function(a){var b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d},kc:function(){var a=new n,b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},lc:function(a){var b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d},wa:function(a){this.na=this.naa.ka?this.ka:a.ka;this.la=this.la>a.la?this.la:a.la;this.ma=this.ma>a.ma?this.ma:a.ma;return this},mb:function(a){var b=new eb;b.na=this.naa.ka?this.ka:a.ka;b.la=this.la>a.la?this.la:a.la;b.ma=this.ma>a.ma?this.ma:a.ma;return b},Wc:function(a){return this.naa.na&&this.oaa.oa&&this.paa.pa:!1},wc:function(a){var b=new eb;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaa.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaf?-f:f)+(0>l?-l:l)+(0>k?-k:k);h=(0>h?-h:h)+(0>g?-g:g)+(0>m?-m:m);e=(0>e?-e:e)+(0>d?-d:d)+(0>c?-c:c);a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-e;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+e},he:function(a,b){var e,d,c;c=d=e=this.Rb;e=ed){if(a<=-l||a>=l)return!1}else{var L=1/d,u=(-l-a)*L,l=(l-a)*L;u>l&&(L=u,u=l,l=L);0l&&(q=l)}if(-1E-6c){if(b<=-g||b>=g)return!1}else u=1/c,l=(-g-b)*u,g=(g-b)*u,l>g&&(u=l,l=g,g=u),0g&&(t=g);if(-1E-6f){if(e<=-k||e>=k)return!1}else l=1/f,g=(-k-e)*l,k=(k-e)*l,g>k&&(l=g,g=k,k=l),0k&&(A=k);if(1<=m||1<=p||1<=r||0>=q||0>=t||0>=A)return!1;k=m;m=0;p>k&&(k=p,m=1);r>k&&(k=r,m=2);tq||!k)return!1;switch(m){case 0:h.normal.Aa(0f?-f:f)*this.Db;h=(0>h?-h:h)*this.Db;l=(0>l?-l:l)*this.Db;e+=f;d+=h;c+=l;a.na=b.v-e;a.oa=b.A-d;a.pa=b.B-c;a.ka=b.v+e;a.la=b.A+d;a.ma=b.B+c},he:function(a,b){0q)return!1;if(0=(-r+q)/p)return!1}else{if(0<=m)return!1;m=0}p=b+(c-b)*m;if(p>-l&&pp?-l:l;t=a-0;l=b-g;k=e-0;a=d-a;b=c-b;e=f-e;p=a*a+b*b+e*e;r=t*a+l*b+k*e;m=t*t+l*l+k*k-this.ab*this.ab;q=r*r-p*m;if(0>q)return!1;f=(-r-Math.sqrt(q))/p;if(0>f||1p?g:p;h=k>r?k:r;f=m>q?m:q;g=ge?l:e);a.la=b.A+(h>d?h:d);a.ma=b.B+(f>c?f:c)},he:function(a,b){var e=a.x,d=a.y,c=a.z;0this.Mk*this.Mk*(e*e+d*d+c*c)?(b.Aa(0,this.Db-this.Rb/this.Mk,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,d=e*e+a*a,c=2*this.Db,c=(c-this.Rb)/c*this.ab-this.Rb/this.Dk,0>c&&(c=0),d=0c&&(c=0),b.x=e*d,b.y=-c,b.z=a*d)},Wi:function(a,b,e,d,c,f,h){var l=this.Db;d-=a;c-=b;f-=e;var g=0,k=1;if(-1E-6c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,m=(l-b)*m;if(p>m)var r=p,p=m,m=r;0m&&(k=m)}if(1<=g||0>=k)return!1;b-=l;var r=this.Dk*this.Dk,m=r*(d*d+c*c+f*f)-c*c,p=r*(a*d+b*c+e*f)-b*c,r=r*(a*a+b*b+e*e)-b*b,q=p*p-m*r;if(m){if(0>q)return!1;q=Math.sqrt(q);if(0>m)if(0=p)return!1}else{if(r=(-p-q)/m,p=1,1<=r)return!1}else if(r=(-p-q)/m,p=(-p+q)/m,1<=r||0>=p)return!1}else if(m=-r/(2*p),0=m)return!1}else if(r=m,p=1,1<=m)return!1;b+=l;if(p<=g||k<=r)return!1;if(rd&&(d=k);mc&&(c=m);gf&&(f=g)}h=d-a;l=c-b;k=f-e;this.Sf=h*l*k;a=.25*((a+d)*(a+d)+(b+c)*(b+c)+(e+f)*(e+f));h=h*h*.25;l=l*l*.25;k=k*k*.25;this.Dg=.3333333333333333*(l+k)+a;this.Gg=this.Fg=this.Eg=0;this.Hg=.3333333333333333*(k+h)+a;this.Kg=this.Jg=this.Ig=0;this.Lg=.3333333333333333*(h+l)+a},Lb:function(a,b){var e,d,c,f,h,l,g,k,m;m=k=g=this.Rb;var p,r,q;e=this.Ca[0];p=e.x;r=e.y;q=e.z;d=b.o*p+b.f*r+b.h*q;e=b.i*p+b.m*r+b.j*q;c=b.l*p+b.g*r+b.s*q;p=d+b.v;r=e+b.A;q=c+b.B;e=p;d=r;c=q;f=p;h=r;l=q;for(var t=1,A=this.We;tp?f:p;h=h>r?h:r;l=l>q?l:q}a.na=e-g;a.oa=d-k;a.pa=c-m;a.ka=f+g;a.la=h+k;a.ma=l+m},he:function(a,b){for(var e=this.Ca[0],e=e.x*a.x+e.y*a.y+e.z*a.z,d=0,c=1,f=this.We;ce&&(e=l,d=h)}a=this.Ca[d];b.x=a.x;b.y=a.y;b.z=a.z}});Qd.wa=Qa;Qd.prototype=gb(Qa.prototype,{pi:function(){return this.ab},Pj:function(){return this.Db},Xe:function(){var a=this.ab*this.ab,b=this.Db*this.Db*4;this.Sf=3.14159265358979*a*this.Db*2;this.Dg=.08333333333333333*(3*a+b);this.Gg=this.Fg=this.Eg=0;this.Hg=.5*a;this.Kg=this.Jg=this.Ig=0;this.Lg=.08333333333333333*(3*a+b)},Lb:function(a,b){var e,d,c,f,h,l;e=b.f;d=b.m;c=b.g;e=0>e?-e:e;d=0>d?-d:d;c=0>c?-c:c;f=Math.sqrt(1-e*e);h=Math.sqrt(1-d*d);l=Math.sqrt(1-c*c);f*=this.ab;h*=this.ab;l*=this.ab;e*=this.Db;d*=this.Db;c*=this.Db;f+=e;h+=d;l+=c;a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-l;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+l},he:function(a,b){var e=a.x,d=a.z,c=e*e+d*d,f=this.ab-this.Rb;0>f&&(f=0);c=0f&&(f=0);b.x=e*c;b.y=0c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,l=(l-b)*m;p>l&&(m=p,p=l,l=m);0l&&(k=l)}if(1<=g||0>=k)return!1;var l=d*d+f*f,p=a*d+e*f,m=a*a+e*e-this.ab*this.ab,r=p*p-l*m;if(0>r)return!1;if(0=l)return!1}else{if(0<=m)return!1;m=0;l=1}if(l<=g||k<=m)return!1;if(mk)return!1;f=(-g-Math.sqrt(k))/f;if(0>f||1a&&(a=this.points[d].depth)}return a},clear:function(){for(var a=this.numPoints=0,b=this.points;aPa&&(Pa=-Pa);0>Fa&&(Fa=-Fa);0>Q&&(Q=-Q);var aa=Pa+Fa+Q,fa=L*q+u*t+z*A,N=Z+aa,ja=0>fa,Ga=ja?-fa:fa;if(GaP&&(Y=P,oa=0,ca=L,Ma=u,va=z,ua=ja?-1:1);var Z=ya,Ya=n*S+D*ha+Ib*ea,J=n*da+D*M+Ib*T,wb=n*w+D*V+Ib*ia;0>Ya&&(Ya=-Ya);0>J&&(J=-J);0>wb&&(wb=-wb);var aa=Ya+J+wb,fa=n*q+D*t+Ib*A,ec=Z+aa,Vb=0>fa,Ab=Vb?-fa:fa;if(Abhb&&(hb=-hb);0>ka&&(ka=-ka);0>Ia&&(Ia=-Ia);var aa=hb+ka+Ia,fa=y*q+B*t+E*A,ab=Z+aa,bb=0>fa,Wa=bb?-fa:fa;if(WaF.linearSlop?Y-F.linearSlop:0,qb=K*ba+H*za+mc*Ta,kb=K*C+H*Aa+mc*na,Sa=K*La+H*Ba+mc*ta;0>qb&&(qb=-qb);0>kb&&(kb=-kb);0>Sa&&(Sa=-Sa);var Z=qb+kb+Sa,aa=Ea,fa=K*q+H*t+mc*A,Na=Z+aa,Za=0>fa,vb=Za?-fa:fa;if(vbxb&&(xb=-xb);0>nb&&(nb=-nb);0>fb&&(fb=-fb);var Z=xb+nb+fb,aa=O,fa=R*q+x*t+X*A,Re=Z+aa,Db=0>fa,G=Db?-fa:fa;if(Gjb&&(jb=-jb);0>Xb&&(Xb=-Xb);0>ob&&(ob=-ob);var Z=jb+Xb+ob,aa=sa,fa=dd*q+Da*t+qa*A,cb=Z+aa,zb=0>fa,Xa=zb?-fa:fa;if(XaF.linearSlop?Y-F.linearSlop:0,v,W,U;v=u*mc-z*H;W=z*K-L*mc;U=L*H-u*K;if(v||W||U){var db=v*v+W*W+U*U;0cc&&(cc=-cc);0>Ra&&(Ra=-Ra);var Z=cc+Ra,Ha=v*da+W*M+U*T,rb=v*w+W*V+U*ia;0>Ha&&(Ha=-Ha);0>rb&&(rb=-rb);var aa=Ha+rb,fa=v*q+W*t+U*A,yb=Z+aa,Cb=0>fa,la=Cb?-fa:fa;if(lama&&(ma=-ma);0>Ja&&(Ja=-Ja);var Z=ma+Ja,$a=v*S+W*ha+U*ea,Oa=v*w+W*V+U*ia;0>$a&&($a=-$a);0>Oa&&(Oa=-Oa);var aa=$a+Oa,fa=v*q+W*t+U*A,nc=Z+aa,xa=0>fa,Fc=xa?-fa:fa;if(Fcoj&&(oj=-oj);0>pa&&(pa=-pa);var Z=oj+pa,Ca=v*S+W*ha+U*ea,xd=v*da+W*M+U*T;0>Ca&&(Ca=-Ca);0>xd&&(xd=-xd);var aa=Ca+xd,fa=v*q+W*t+U*A,Kj=Z+aa,Ka=0>fa,de=Ka?-fa:fa;if(deoc&&(oc=-oc);0>Id&&(Id=-Id);var Z=oc+Id,$d=v*da+W*M+U*T,rc=v*w+W*V+U*ia;0>$d&&($d=-$d);0>rc&&(rc=-rc);var aa=$d+rc,fa=v*q+W*t+U*A,Jc=Z+aa,Ua=0>fa,eb=Ua?-fa:fa;if(ebuc&&(uc=-uc);0>gc&&(gc=-gc);var Z=uc+gc,Xc=v*S+W*ha+U*ea,Eb=v*w+W*V+U*ia;0>Xc&&(Xc=-Xc);0>Eb&&(Eb=-Eb);var aa=Xc+Eb,fa=v*q+W*t+U*A,Ng=Z+aa,qi=0>fa,gb=qi?-fa:fa;if(gbic&&(ic=-ic);0>Og&&(Og=-Og);var Z=ic+Og,pb=v*S+W*ha+U*ea,Bb=v*da+W*M+U*T;0>pb&&(pb=-pb);0>Bb&&(Bb=-Bb);var aa=pb+Bb,fa=v*q+W*t+U*A,Pg=Z+aa,sc=0>fa,Jd=sc?-fa:fa;if(JdZg&&(Zg=-Zg);0>vc&&(vc=-vc);var Z=Zg+vc,Fb=v*da+W*M+U*T,ub=v*w+W*V+U*ia;0>Fb&&(Fb=-Fb);0>ub&&(ub=-ub);var aa=Fb+ub,fa=v*q+W*t+U*A,Ob=Z+aa,Mj=0>fa,Qi=Mj?-fa:fa;if(QiHb&&(Hb=-Hb);0>Lb&&(Lb=-Lb);var Z=Hb+Lb,yf=v*S+W*ha+U*ea,Gb=v*w+W*V+U*ia;0>yf&&(yf=-yf);0>Gb&&(Gb=-Gb);var aa=yf+Gb,fa=v*q+W*t+U*A,Nb=Z+aa,Nj=0>fa,ri=Nj?-fa:fa;if(riSb&&(Sb=-Sb);0>fd&&(fd=-fd);var Z=Sb+fd,Rc=v*S+W*ha+U*ea,zc=v*da+W*M+U*T;0>Rc&&(Rc=-Rc);0>zc&&(zc=-zc);var aa=Rc+zc,fa=v*q+W*t+U*A,gd=Z+aa,Yc=0>fa,od=Yc?-fa:fa;if(odua){ke=-ke;le=-le;me=-me;Cd=-Cd;Dd=-Dd;hd=-hd;$c=Kd;Sc=ee;ld=Td;Kd=qd;ee=Ud;Td=Ld;qd=$c;Ud=Sc;Ld=ld;var Ue=Md;Md=ne;ne=Ue}ke+=l;le+=g;me+=k;var ad=1,Ed=0,id=Cd*K+Dd*H+hd*mc;id-F.contactPersistenceThreshold&&(bc?this.Wg(a,ge,rd,Vd,Wd,qe,he,wd,fe):this.Wg(a,Wd,qe,he,ge,rd,Vd,wd,fe))}}}}}}}}}});Ej.prototype={clip:function(){for(var a=0,b=this.fd;a=f){var h=this.Gb[this.gc++];h.x=d.x;h.y=d.y;h.Pa=d.Pa;h.Qa=d.Qa;h.Ra=d.Ra;c/=c-f;f=this.Gb[this.gc++];f.x=d.x+(e.x-d.x)*c;f.y=d.y+(e.y-d.y)*c;f.Pa=d.Pa+(e.Pa-d.Pa)*c;f.Qa=d.Qa+(e.Qa-d.Qa)*c;f.Ra=d.Ra+(e.Ra-d.Ra)*c}else 0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0this.fd)){for(var a=-Infinity,b=Infinity,e=-Infinity,d=Infinity,c=null,f=null,h=null,l=null,g=0,k=this.fd;ga&&(a=p,c=m);pe&&(e=r,h=m);rp?0:p>r?1:p/r):p=0,r=p*Ib+n,0>r?(r=0,p=0>k?0:k>D?1:k/D):r>z?(r=1,p=Ib+k,p=0>p?0:p>D?1:p/D):r/=z):(r=0,p=0>k?0:k>D?1:k/D):(p=0,r=0>n?0:n>z?1:n/z):r=p=0;q+=f*p;t+=L*p;A+=c*p;h+=m*r;l+=u*r;d+=g*r;L=q-h;f=t-l;r=A-d;p=L*L+f*f+r*r;p>=(b+e)*(b+e)||(p=Math.sqrt(p),0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},mb:function(a){var b,e,d,c;b=this.o;e=this.m;d=this.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},Dc:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.o=1-g-d;this.f=k-c;this.h=b+h;this.i=k+c;this.m=1-a-d;this.j=e-f;this.l=b-h;this.g=e+f;this.s=1-a-g;return this},clone:function(){var a=new Ua;a.v=this.v;a.A=this.A;a.B=this.B;a.o=this.o;a.f=this.f;a.h=this.h;a.i=this.i;a.m=this.m;a.j=this.j;a.l=this.l;a.g=this.g;a.s=this.s;return a},qe:function(a){this.v=a.v;this.A=a.A;this.B=a.B;this.o=a.o;this.f=a.f;this.h=a.h;this.i=a.i;this.m=a.m;this.j=a.j;this.l=a.l;this.g=a.g;this.s=a.s;return this}};lb.kc=function(){return lb.mb};lb.prototype={Nj:function(a,b,e,d,c,f){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var h=this.La,l=this.eb,g=this.ib,k=this.closest,m=this.dir;null!=c?(null==c.Ji&&(c.Ji=new Dj),this.yo(c.Ji)):m.R();if(!(m.x*m.x+m.y*m.y+m.z*m.z)){var p,r,q;p=d.v-e.v;r=d.A-e.A;q=d.B-e.B;m.x=p;m.y=r;m.z=q;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.Aa(1,0,0)}this.Ba=0;this.Tf(!1);this.Uf(!1);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;for(var u=0;40>u;){var z=0;switch(this.Ba){case 1:var n=h[0];k.x=n.x;k.y=n.y;k.z=n.z;z=1;break;case 2:var D,Ib,y,B,E,K,H=h[0];D=H.x;Ib=H.y;y=H.z;var mc=h[1];B=mc.x;E=mc.y;K=mc.z;var R,x,X;R=B-D;x=E-Ib;X=K-y;var F=R*D+x*Ib+X*y,F=-F/(R*R+x*x+X*X);if(0>F)k.x=D,k.y=Ib,k.z=y,z=1;else if(1O*oa+sa*ua+ba*ca){var P,Ya,Yg,wb,ec,Vb;P=ya.x;Ya=ya.y;Yg=ya.z;wb=N.x;ec=N.y;Vb=N.z;var Ab,ib,hb;Ab=wb-P;ib=ec-Ya;hb=Vb-Yg;var ka=Ab*P+ib*Ya+hb*Yg,ka=-ka/(Ab*Ab+ib*ib+hb*hb),Ia;if(0>ka)k.x=P,k.y=Ya,k.z=Yg,Ia=1;else if(1za*Ma+Ta*va+C*Z){var Va,qb,kb,Sa,Na,Za;Va=N.x;qb=N.y;kb=N.z;Sa=Ea.x;Na=Ea.y;Za=Ea.z;var vb,mb,xb;vb=Sa-Va;mb=Na-qb;xb=Za-kb;var nb=vb*Va+mb*qb+xb*kb,nb=-nb/(vb*vb+mb*mb+xb*xb),fb;if(0>nb)k.x=Va,k.y=qb,k.z=kb,fb=1;else if(1aa||sbAa*Pa+na*Fa+La*Q){var jb,Xb,ob,cb,zb,Xa;jb=ya.x;Xb=ya.y;ob=ya.z;cb=Ea.x;zb=Ea.y;Xa=Ea.z;var tb,v,W;tb=cb-jb;v=zb-Xb;W=Xa-ob;var U=tb*jb+v*Xb+W*ob,U=-U/(tb*tb+v*v+W*W),db;if(0>U)k.x=jb,k.y=Xb,k.z=ob,db=1;else if(1aa||rb(Ja*gc+$a*Xc+Oa*Eb)*Pg){var vc,Jb,Ob,Hb,Lb,Qi,Gb,Qb,Sb,Nb,yf,lb,Rb,Kb,ri,kd,dc,Wb;vc=la.x;Jb=la.y;Ob=la.z;Hb=ra.x;Lb=ra.y;Qi=ra.z;Gb=ga.x;Qb=ga.y;Sb=ga.z;Nb=Hb-vc;yf=Lb-Jb;lb=Qi-Ob;Rb=Gb-Hb;Kb=Qb-Lb;ri=Sb-Qi;kd=vc-Gb;dc=Jb-Qb;Wb=Ob-Sb;var fd,Rc,zc;fd=yf*ri-lb*Kb;Rc=lb*Rb-Nb*ri;zc=Nb*Kb-yf*Rb;var gd,Yc,od,Mb,Tb,pc,Zc,Kc,Lc;gd=yf*zc-lb*Rc;Yc=lb*fd-Nb*zc;od=Nb*Rc-yf*fd;Mb=Kb*zc-ri*Rc;Tb=ri*fd-Rb*zc;pc=Rb*Rc-Kb*fd;Zc=dc*zc-Wb*Rc;Kc=Wb*fd-kd*zc;Lc=kd*Rc-dc*fd;var xc=-1,Cc,Dc,pd,yd=0;pd=Dc=Cc=0;if(0>vc*gd+Jb*Yc+Ob*od){var sd,td,zd,$g,Pb,$b;sd=la.x;td=la.y;zd=la.z;$g=ra.x;Pb=ra.y;$b=ra.z;var ac,bc,kc;ac=$g-sd;bc=Pb-td;kc=$b-zd;var Sd=ac*sd+bc*td+kc*zd,Sd=-Sd/(ac*ac+bc*bc+kc*kc),ie;if(0>Sd)k.x=sd,k.y=td,k.z=zd,ie=1;else if(1Hb*Mb+Lb*Tb+Qi*pc){var tc,qc,Zb,Ge,He,Se;tc=ra.x;qc=ra.y;Zb=ra.z;Ge=ga.x;He=ga.y;Se=ga.z;var Te,Ie,Je;Te=Ge-tc;Ie=He-qc;Je=Se-Zb;var ae=Te*tc+Ie*qc+Je*Zb,ae=-ae/(Te*Te+Ie*Ie+Je*Je),xe;if(0>ae)k.x=tc,k.y=qc,k.z=Zb,xe=1;else if(1xc||QcGb*Zc+Qb*Kc+Sb*Lc){var wc,Ad,Bd,ud,ke,le;wc=la.x;Ad=la.y;Bd=la.z;ud=ga.x;ke=ga.y;le=ga.z;var me,Cd,Dd;me=ud-wc;Cd=ke-Ad;Dd=le-Bd;var hd=me*wc+Cd*Ad+Dd*Bd,hd=-hd/(me*me+Cd*Cd+Dd*Dd),Kd;if(0>hd)k.x=wc,k.y=Ad,k.z=Bd,Kd=1;else if(1xc||Ud(Ja*Ng+$a*qi+Oa*pb)*Pg){var Ue,ad,Ed,id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf;Ue=la.x;ad=la.y;Ed=la.z;id=ga.x;bd=ga.y;cd=ga.z;Vc=ma.x;Mc=ma.y;Nc=ma.z;Ec=id-Ue;yc=bd-ad;Bc=cd-Ed;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ue-Vc;oe=ad-Mc;lf=Ed-Nc;var md,Fd,ed;md=yc*Hc-Bc*Tc;Fd=Bc*Ac-Ec*Hc;ed=Ec*Tc-yc*Ac;var vd,jd,nd,mf,Uc,Pc,ve,we,Ri;vd=yc*ed-Bc*Fd;jd=Bc*md-Ec*ed;nd=Ec*Fd-yc*md;mf=Tc*ed-Hc*Fd;Uc=Hc*md-Ac*ed;Pc=Ac*Fd-Tc*md;ve=oe*ed-lf*Fd;we=lf*md-Oc*ed;Ri=Oc*Fd-oe*md;var fe=-1,pe,ge,rd,Vd=0;rd=ge=pe=0;if(0>Ue*vd+ad*jd+Ed*nd){var wd,Wd,qe,he,zf,sh;wd=la.x;Wd=la.y;qe=la.z;he=ga.x;zf=ga.y;sh=ga.z;var tg,ug,vg;tg=he-wd;ug=zf-Wd;vg=sh-qe;var Ke=tg*wd+ug*Wd+vg*qe,Ke=-Ke/(tg*tg+ug*ug+vg*vg),Ve;if(0>Ke)k.x=wd,k.y=Wd,k.z=qe,Ve=1;else if(1id*mf+bd*Uc+cd*Pc){var Nf,Of,gg,Pf,Qf,Rf;Nf=ga.x;Of=ga.y;gg=ga.z;Pf=ma.x;Qf=ma.y;Rf=ma.z;var Sf,Tf,Af;Sf=Pf-Nf;Tf=Qf-Of;Af=Rf-gg;var ye=Sf*Nf+Tf*Of+Af*gg,ye=-ye/(Sf*Sf+Tf*Tf+Af*Af),nf;if(0>ye)k.x=Nf,k.y=Of,k.z=gg,nf=1;else if(1fe||CeVc*ve+Mc*we+Nc*Ri){var wg,xg,Xd,Nd,Od,yg;wg=la.x;xg=la.y;Xd=la.z;Nd=ma.x;Od=ma.y;yg=ma.z;var zg,Ag,Bg;zg=Nd-wg;Ag=Od-xg;Bg=yg-Xd;var pf=zg*wg+Ag*xg+Bg*Xd,pf=-pf/(zg*zg+Ag*Ag+Bg*Bg),Vf;if(0>pf)k.x=wg,k.y=xg,k.z=Xd,Vf=1;else if(1fe||Wfsc||Cg(Ja*Qa+$a*xf+Oa*ic)*Pg){var Le,Xe,Xf,Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg;Le=la.x;Xe=la.y;Xf=la.z;Yf=ra.x;Zf=ra.y;$f=ra.z;Cf=ma.x;Df=ma.y;Ef=ma.z;Me=Yf-Le;Ff=Zf-Xe;jg=$f-Xf;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Le-Cf;Hf=Xe-Df;kg=Xf-Ef;var be,ce,Pd;be=Ff*Ye-jg*bg;ce=jg*ag-Me*Ye;Pd=Me*bg-Ff*ag;var Yd,Zd,Gd,Oj,Qd,Fe,Wc,Hd,Qg;Yd=Ff*Pd-jg*ce;Zd=jg*be-Me*Pd;Gd=Me*ce-Ff*be;Oj=bg*Pd-Ye*ce;Qd=Ye*be-ag*Pd;Fe=ag*ce-bg*be;Wc=Hf*Pd-kg*ce;Hd=kg*be-Gf*Pd;Qg=Gf*ce-Hf*be;var Ze=-1,rf,cg,re,sf=0;re=cg=rf=0;if(0>Le*Yd+Xe*Zd+Xf*Gd){var ze,Ae,tf,$e,If,Dg;ze=la.x;Ae=la.y;tf=la.z;$e=ra.x;If=ra.y;Dg=ra.z;var Eg,Fg,Gg;Eg=$e-ze;Fg=If-Ae;Gg=Dg-tf;var af=Eg*ze+Fg*Ae+Gg*tf,af=-af/(Eg*Eg+Fg*Fg+Gg*Gg),bf;if(0>af)k.x=ze,k.y=Ae,k.z=tf,bf=1;else if(1Yf*Oj+Zf*Qd+$f*Fe){var kj,lj,mj,th,uh,vh;kj=ra.x;lj=ra.y;mj=ra.z;th=ma.x;uh=ma.y;vh=ma.z;var wh,xh,yh;wh=th-kj;xh=uh-lj;yh=vh-mj;var mg=wh*kj+xh*lj+yh*mj,mg=-mg/(wh*wh+xh*xh+yh*yh),ah;if(0>mg)k.x=kj,k.y=lj,k.z=mj,ah=1;else if(1Ze||gfCf*Wc+Df*Hd+Ef*Qg){var ui,vi,wi,zh,Ah,Bh;ui=la.x;vi=la.y;wi=la.z;zh=ma.x;Ah=ma.y;Bh=ma.z;var Ch,Dh,Eh;Ch=zh-ui;Dh=Ah-vi;Eh=Bh-wi;var ng=Ch*ui+Dh*vi+Eh*wi,ng=-ng/(Ch*Ch+Dh*Dh+Eh*Eh),Rg;if(0>ng)k.x=ui,k.y=vi,k.z=wi,Rg=1;else if(1Ze||hfsc||jf(nc*Og+xa*Bb+Fc*Fb)*Pg){var Hg,Sg,Ai,dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh;Hg=ra.x;Sg=ra.y;Ai=ra.z;dh=ga.x;eh=ga.y;fh=ga.z;Gh=ma.x;Hh=ma.y;Ih=ma.z;gh=dh-Hg;hh=eh-Sg;ih=fh-Ai;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=Hg-Gh;Kh=Sg-Hh;Lh=Ai-Ih;var Ne,Oe,Pe;Ne=hh*Vg-ih*Ug;Oe=ih*Tg-gh*Vg;Pe=gh*Ug-hh*Tg;var cf,df,ef,ue,kf,te,vf,Kf,Lf;cf=hh*Pe-ih*Oe;df=ih*Ne-gh*Pe;ef=gh*Oe-hh*Ne;ue=Ug*Pe-Vg*Oe;kf=Vg*Ne-Tg*Pe;te=Tg*Oe-Ug*Ne;vf=Kh*Pe-Lh*Oe;Kf=Lh*Ne-Jh*Pe;Lf=Jh*Oe-Kh*Ne;var Wg=-1,jh,kh,uf,Ig=0;uf=kh=jh=0;if(0>Hg*cf+Sg*df+Ai*ef){var og,pg,lh,Mh,Nh,Oh;og=ra.x;pg=ra.y;lh=ra.z;Mh=ga.x;Nh=ga.y;Oh=ga.z;var Ph,Qh,Rh;Ph=Mh-og;Qh=Nh-pg;Rh=Oh-lh;var qg=Ph*og+Qh*pg+Rh*lh,qg=-qg/(Ph*Ph+Qh*Qh+Rh*Rh),mh;if(0>qg)k.x=og,k.y=pg,k.z=lh,mh=1;else if(1dh*ue+eh*kf+fh*te){var Ci,Di,Ei,Sh,Th,Uh;Ci=ga.x;Di=ga.y;Ei=ga.z;Sh=ma.x;Th=ma.y;Uh=ma.z;var Vh,Wh,Xh;Vh=Sh-Ci;Wh=Th-Di;Xh=Uh-Ei;var rg=Vh*Ci+Wh*Di+Xh*Ei,rg=-rg/(Vh*Vh+Wh*Wh+Xh*Xh),oh;if(0>rg)k.x=Ci,k.y=Di,k.z=Ei,oh=1;else if(1Wg||seGh*vf+Hh*Kf+Ih*Lf){var Gi,Hi,Ii,Yh,Zh,$h;Gi=ra.x;Hi=ra.y;Ii=ra.z;Yh=ma.x;Zh=ma.y;$h=ma.z;var ai,bi,ci;ai=Yh-Gi;bi=Zh-Hi;ci=$h-Ii;var sg=ai*Gi+bi*Hi+ci*Ii,sg=-sg/(ai*ai+bi*bi+ci*ci),Xg;if(0>sg)k.x=Gi,k.y=Hi,k.z=Ii,Xg=1;else if(1Wg||ffsc||bjk.x*k.x+k.y*k.y+k.z*k.z){if(!f)return this.distance=0;switch(this.Ba){case 1:this.Ao();break;case 2:this.Wl();break;case 3:this.dm()}if(4==this.Ba){var ei=this.Ln(a,b,e,d,h,l,g);if(0!=ei)return this.distance=0,ei;this.distance=-this.depth;return 0}this.distance=0;return 1}this.an(z);m.x=k.x;m.y=k.y;m.z=k.z;m.x=-m.x;m.y=-m.y;m.z=-m.z;this.Tf(!1);this.Uf(!1);var Jf=this.La[this.Ba],cj=this.eb[this.Ba];Jf.x=cj.x;Jf.y=cj.y;Jf.z=cj.z;var Be=this.ib[this.Ba];Jf.x-=Be.x;Jf.y-=Be.y;Jf.z-=Be.z;if(1E-8>m.x*m.x+m.y*m.y+m.z*m.z)throw Error("!?");var rh=h[this.Ba];if(1E-8>rh.x*m.x+rh.y*m.y+rh.z*m.z-(k.x*m.x+k.y*m.y+k.z*m.z))return this.Km(),this.distance=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),null!=c&&null!=c.Ji&&this.Fo(c.Ji),0;this.Ba++;++u}return 2},xm:function(a,b,e,d,c,f,h){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var l=this.La,g=this.closest,k=this.dir,m,p,r;m=d.v-e.v;p=d.A-e.A;r=d.B-e.B;k.x=m;k.y=p;k.z=r;1E-6>k.x*k.x+k.y*k.y+k.z*k.z&&k.Aa(1,0,0);this.Ba=0;if(null!=this.Kj)this.Tf(!0);else{var q=this.eb[this.Ba];q.x=this.oc.v;q.y=this.oc.A;q.z=this.oc.B}this.Uf(!0);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;var u=0,z=0,n=this.Co,D=this.Bo;n.R();D.x=f.x;D.y=f.y;D.z=f.z;D.x-=c.x;D.y-=c.y;for(D.z-=c.z;40>u;){var Ib=0;switch(this.Ba){case 1:var y=l[0];g.x=y.x;g.y=y.y;g.z=y.z;Ib=1;break;case 2:var B,E,K,H,mc,R,x=l[0];B=x.x;E=x.y;K=x.z;var X=l[1];H=X.x;mc=X.y;R=X.z;var F,Da,qa;F=H-B;Da=mc-E;qa=R-K;var I=F*B+Da*E+qa*K,I=-I/(F*F+Da*Da+qa*qa);if(0>I)g.x=B,g.y=E,g.z=K,Ib=1;else if(1za*Ma+J*va+C*Z){var wb,ec,Vb,Ab,ib,hb;wb=O.x;ec=O.y;Vb=O.z;Ab=sa.x;ib=sa.y;hb=sa.z;var ka,Ia,ab;ka=Ab-wb;Ia=ib-ec;ab=hb-Vb;var bb=ka*wb+Ia*ec+ab*Vb,bb=-bb/(ka*ka+Ia*Ia+ab*ab),Wa;if(0>bb)g.x=wb,g.y=ec,g.z=Vb,Wa=1;else if(1Aa*Pa+na*Fa+La*Q){var Sa,Na,Za,vb,mb,xb;Sa=sa.x;Na=sa.y;Za=sa.z;vb=ba.x;mb=ba.y;xb=ba.z;var nb,fb,Re;nb=vb-Sa;fb=mb-Na;Re=xb-Za;var Db=nb*Sa+fb*Na+Re*Za,Db=-Db/(nb*nb+fb*fb+Re*Re),G;if(0>Db)g.x=Sa,g.y=Na,g.z=Za,G=1;else if(1ja||obBa*aa+ta*fa+S*Rd){var cb,zb,Xa,tb,v,W;cb=O.x;zb=O.y;Xa=O.z;tb=ba.x;v=ba.y;W=ba.z;var U,db,cc;U=tb-cb;db=v-zb;cc=W-Xa;var Ra=U*cb+db*zb+cc*Xa,Ra=-Ra/(U*U+db*db+cc*cc),Ha;if(0>Ra)g.x=cb,g.y=zb,g.z=Xa,Ha=1;else if(1ja||la(nc*Ng+xa*qi+Fc*Bb)*Hb){var Sb,Nb,lb,Rb,Kb,dc,Wb,yf,ac,bc,Pb,$b,kd,Mb,Tb,fd,Rc,zc;Sb=ma.x;Nb=ma.y;lb=ma.z;Rb=Ja.x;Kb=Ja.y;dc=Ja.z;Wb=$a.x;yf=$a.y;ac=$a.z;bc=Rb-Sb;Pb=Kb-Nb;$b=dc-lb;kd=Wb-Rb;Mb=yf-Kb;Tb=ac-dc;fd=Sb-Wb;Rc=Nb-yf;zc=lb-ac;var gd,Yc,od;gd=Pb*Tb-$b*Mb;Yc=$b*kd-bc*Tb;od=bc*Mb-Pb*kd;var pc,kc,tc,Zc,Kc,Lc,xc,Cc,Dc;pc=Pb*od-$b*Yc;kc=$b*gd-bc*od;tc=bc*Yc-Pb*gd;Zc=Mb*od-Tb*Yc;Kc=Tb*gd-kd*od;Lc=kd*Yc-Mb*gd;xc=Rc*od-zc*Yc;Cc=zc*gd-fd*od;Dc=fd*Yc-Rc*gd;var pd=-1,yd,sd,td,zd=0;td=sd=yd=0;if(0>Sb*pc+Nb*kc+lb*tc){var qc,Zb,lc,jc,Qc,wc;qc=ma.x;Zb=ma.y;lc=ma.z;jc=Ja.x;Qc=Ja.y;wc=Ja.z;var Sd,ie,Uc;Sd=jc-qc;ie=Qc-Zb;Uc=wc-lc;var je=Sd*qc+ie*Zb+Uc*lc,je=-je/(Sd*Sd+ie*ie+Uc*Uc),Pc;if(0>je)g.x=qc,g.y=Zb,g.z=lc,Pc=1;else if(1Rb*Zc+Kb*Kc+dc*Lc){var Ge,He,Se,Te,Ie,Je;Ge=Ja.x;He=Ja.y;Se=Ja.z;Te=$a.x;Ie=$a.y;Je=$a.z;var ae,xe,$c;ae=Te-Ge;xe=Ie-He;$c=Je-Se;var Sc=ae*Ge+xe*He+$c*Se,Sc=-Sc/(ae*ae+xe*xe+$c*$c),ld;if(0>Sc)g.x=Ge,g.y=He,g.z=Se,ld=1;else if(1pd||BdWb*xc+yf*Cc+ac*Dc){var ud,ke,le,me,Cd,Dd;ud=ma.x;ke=ma.y;le=ma.z;me=$a.x;Cd=$a.y;Dd=$a.z;var hd,Kd,ee;hd=me-ud;Kd=Cd-ke;ee=Dd-le;var Td=hd*ud+Kd*ke+ee*le,Td=-Td/(hd*hd+Kd*Kd+ee*ee),qd;if(0>Td)g.x=ud,g.y=ke,g.z=le,qd=1;else if(1pd||ne(nc*Fb+xa*xf+Fc*ic)*Hb){var id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf,md,Fd,ed;id=ma.x;bd=ma.y;cd=ma.z;Vc=$a.x;Mc=$a.y;Nc=$a.z;Ec=Oa.x;yc=Oa.y;Bc=Oa.z;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ec-Vc;oe=yc-Mc;lf=Bc-Nc;md=id-Ec;Fd=bd-yc;ed=cd-Bc;var vd,jd,nd;vd=Tc*lf-Hc*oe;jd=Hc*Oc-Ac*lf;nd=Ac*oe-Tc*Oc;var mf,Fe,Wc,Hd,Ee,Ri,fe,pe,ge;mf=Tc*nd-Hc*jd;Fe=Hc*vd-Ac*nd;Wc=Ac*jd-Tc*vd;Hd=oe*nd-lf*jd;Ee=lf*vd-Oc*nd;Ri=Oc*jd-oe*vd;fe=Fd*nd-ed*jd;pe=ed*vd-md*nd;ge=md*jd-Fd*vd;var rd=-1,Vd,wd,Wd,qe=0;Wd=wd=Vd=0;if(0>id*mf+bd*Fe+cd*Wc){var he,zf,sh,tg,ug,vg;he=ma.x;zf=ma.y;sh=ma.z;tg=$a.x;ug=$a.y;vg=$a.z;var Ke,Ve,Mf;Ke=tg-he;Ve=ug-zf;Mf=vg-sh;var eg=Ke*he+Ve*zf+Mf*sh,eg=-eg/(Ke*Ke+Ve*Ve+Mf*Mf),fg;if(0>eg)g.x=he,g.y=zf,g.z=sh,fg=1;else if(1Vc*Hd+Mc*Ee+Nc*Ri){var Pf,Qf,Rf,Sf,Tf,Af;Pf=$a.x;Qf=$a.y;Rf=$a.z;Sf=Oa.x;Tf=Oa.y;Af=Oa.z;var ye,nf,Uf;ye=Sf-Pf;nf=Tf-Qf;Uf=Af-Rf;var of=ye*Pf+nf*Qf+Uf*Rf,of=-of/(ye*ye+nf*nf+Uf*Uf),hg;if(0>of)g.x=Pf,g.y=Qf,g.z=Rf,hg=1;else if(1rd||XdEc*fe+yc*pe+Bc*ge){var Nd,Od,yg,zg,Ag,Bg;Nd=ma.x;Od=ma.y;yg=ma.z;zg=Oa.x;Ag=Oa.y;Bg=Oa.z;var pf,Vf,si;pf=zg-Nd;Vf=Ag-Od;si=Bg-yg;var ig=pf*Nd+Vf*Od+si*yg,ig=-ig/(pf*pf+Vf*Vf+si*si),ti;if(0>ig)g.x=Nd,g.y=Od,g.z=yg,ti=1;else if(1rd||qfGc||Xf(nc*Og+xa*Jb+Fc*Ob)*Hb){var Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg,be,ce,Pd;Yf=ma.x;Zf=ma.y;$f=ma.z;Cf=Ja.x;Df=Ja.y;Ef=Ja.z;Me=Oa.x;Ff=Oa.y;jg=Oa.z;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Me-Cf;Hf=Ff-Df;kg=jg-Ef;be=Yf-Me;ce=Zf-Ff;Pd=$f-jg;var Yd,Zd,Gd;Yd=bg*kg-Ye*Hf;Zd=Ye*Gf-ag*kg;Gd=ag*Hf-bg*Gf;var gf,hf,jf,ue,kf,Qg,Ze,rf,cg;gf=bg*Gd-Ye*Zd;hf=Ye*Yd-ag*Gd;jf=ag*Zd-bg*Yd;ue=Hf*Gd-kg*Zd;kf=kg*Yd-Gf*Gd;Qg=Gf*Zd-Hf*Yd;Ze=ce*Gd-Pd*Zd;rf=Pd*Yd-be*Gd;cg=be*Zd-ce*Yd;var re=-1,sf,ze,Ae,tf=0;Ae=ze=sf=0;if(0>Yf*gf+Zf*hf+$f*jf){var $e,If,Dg,Eg,Fg,Gg;$e=ma.x;If=ma.y;Dg=ma.z;Eg=Ja.x;Fg=Ja.y;Gg=Ja.z;var af,bf,dg;af=Eg-$e;bf=Fg-If;dg=Gg-Dg;var lg=af*$e+bf*If+dg*Dg,lg=-lg/(af*af+bf*bf+dg*dg),te;if(0>lg)g.x=$e,g.y=If,g.z=Dg,te=1;else if(1Cf*ue+Df*kf+Ef*Qg){var th,uh,vh,wh,xh,yh;th=Ja.x;uh=Ja.y;vh=Ja.z;wh=Oa.x;xh=Oa.y;yh=Oa.z;var mg,ah,se;mg=wh-th;ah=xh-uh;se=yh-vh;var bh=mg*th+ah*uh+se*vh,bh=-bh/(mg*mg+ah*ah+se*se),ff;if(0>bh)g.x=th,g.y=uh,g.z=vh,ff=1;else if(1re||wiMe*Ze+Ff*rf+jg*cg){var zh,Ah,Bh,Ch,Dh,Eh;zh=ma.x;Ah=ma.y;Bh=ma.z;Ch=Oa.x;Dh=Oa.y;Eh=Oa.z;var ng,Rg,xi;ng=Ch-zh;Rg=Dh-Ah;xi=Eh-Bh;var ch=ng*zh+Rg*Ah+xi*Bh,ch=-ch/(ng*ng+Rg*Rg+xi*xi),yi;if(0>ch)g.x=zh,g.y=Ah,g.z=Bh,yi=1;else if(1re||ziGc||Ai(wa*Pg+pa*sc+Ca*Jd)*Hb){var dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh,Ne,Oe,Pe;dh=Ja.x;eh=Ja.y;fh=Ja.z;Gh=$a.x;Hh=$a.y;Ih=$a.z;gh=Oa.x;hh=Oa.y;ih=Oa.z;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=gh-Gh;Kh=hh-Hh;Lh=ih-Ih;Ne=dh-gh;Oe=eh-hh;Pe=fh-ih;var cf,df,ef;cf=Ug*Lh-Vg*Kh;df=Vg*Jh-Tg*Lh;ef=Tg*Kh-Ug*Jh;var Mg,hi,ji,ki,ni,pi,Wg,jh,kh;Mg=Ug*ef-Vg*df;hi=Vg*cf-Tg*ef;ji=Tg*df-Ug*cf;ki=Kh*ef-Lh*df;ni=Lh*cf-Jh*ef;pi=Jh*df-Kh*cf;Wg=Oe*ef-Pe*df;jh=Pe*cf-Ne*ef;kh=Ne*df-Oe*cf;var uf=-1,Ig,og,pg,lh=0;pg=og=Ig=0;if(0>dh*Mg+eh*hi+fh*ji){var Mh,Nh,Oh,Ph,Qh,Rh;Mh=Ja.x;Nh=Ja.y;Oh=Ja.z;Ph=$a.x;Qh=$a.y;Rh=$a.z;var qg,mh,Bi;qg=Ph-Mh;mh=Qh-Nh;Bi=Rh-Oh;var nh=qg*Mh+mh*Nh+Bi*Oh,nh=-nh/(qg*qg+mh*mh+Bi*Bi),Si;if(0>nh)g.x=Mh,g.y=Nh,g.z=Oh,Si=1;else if(1Gh*ki+Hh*ni+Ih*pi){var Sh,Th,Uh,Vh,Wh,Xh;Sh=$a.x;Th=$a.y;Uh=$a.z;Vh=Oa.x;Wh=Oa.y;Xh=Oa.z;var rg,oh,Fi;rg=Vh-Sh;oh=Wh-Th;Fi=Xh-Uh;var ph=rg*Sh+oh*Th+Fi*Uh,ph=-ph/(rg*rg+oh*oh+Fi*Fi),Ti;if(0>ph)g.x=Sh,g.y=Th,g.z=Uh,Ti=1;else if(1uf||Iigh*Wg+hh*jh+ih*kh){var Yh,Zh,$h,ai,bi,ci;Yh=Ja.x;Zh=Ja.y;$h=Ja.z;ai=Oa.x;bi=Oa.y;ci=Oa.z;var sg,Xg,Ji;sg=ai-Yh;Xg=bi-Zh;Ji=ci-$h;var qh=sg*Yh+Xg*Zh+Ji*$h,qh=-qh/(sg*sg+Xg*Xg+Ji*Ji),Ki;if(0>qh)g.x=Yh,g.y=Zh,g.z=$h,Ki=1;else if(1uf||LiGc||cjg.x*g.x+g.y*g.y+g.z*g.z){if(!z||4==this.Ba){h.fraction=z;break}this.Km();h.fraction=z;var Be=h.normal;Be.x=k.x;Be.y=k.y;Be.z=k.z;var rh=Math.sqrt(Be.x*Be.x+Be.y*Be.y+Be.z*Be.z);0k.x*k.x+k.y*k.y+k.z*k.z)throw Error("!?");var Mi=l[this.Ba],Ui=Mi.x*k.x+Mi.y*k.y+Mi.z*k.z;if(0>Ui){if(0<=D.x*k.x+D.y*k.y+D.z*k.z)break;var nj=Ui/(D.x*k.x+D.y*k.y+D.z*k.z),z=z+nj;if(1<=z)break;n.x+=D.x*nj;n.y+=D.y*nj;n.z+=D.z*nj;for(var Vi=0,ij=this.Ba+1;Vifj*fj+gj*gj+hj*hj){Wi=!0;break}}Wi||this.Ba++;++u}return!1},Km:function(){switch(this.Ba){case 1:var a=this.closestPoint1,b=this.eb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,d=this.ib[0];e.x=d.x;e.y=d.y;e.z=d.z;break;case 2:var c,f,h,l=this.closest;c=l.x;f=l.y;h=l.z;var g,k,m,p,r,q,t,A,L,u,n,fc,D,Ib,y,B,E,K,H=this.La[0];g=H.x;k=H.y;m=H.z;var mc=this.eb[0];p=mc.x;r=mc.y;q=mc.z;var R=this.ib[0];t=R.x;A=R.y;L=R.z;var x=this.La[1];u=x.x;n=x.y;fc=x.z;var X=this.eb[1];D=X.x;Ib=X.y;y=X.z;var F=this.ib[1];B=F.x;E=F.y;K=F.z;var I,qa,N;I=u-g;qa=n-k;N=fc-m;var ya=I*I+qa*qa+N*N;ya&&(ya=1/ya);var J=((c-g)*I+(f-k)*qa+(h-m)*N)*ya,Ea,O,sa,ba,za,Ta,C,Aa,na;Ea=D-p;O=Ib-r;sa=y-q;ba=p+Ea*J;za=r+O*J;Ta=q+sa*J;Ea=B-t;O=E-A;sa=K-L;C=t+Ea*J;Aa=A+O*J;na=L+sa*J;var La=this.closestPoint1;La.x=ba;La.y=za;La.z=Ta;var Ba=this.closestPoint2;Ba.x=C;Ba.y=Aa;Ba.z=na;break;case 3:var ta,S,ha,ea=this.closest;ta=ea.x;S=ea.y;ha=ea.z;var da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab=this.La[0];da=Ab.x;M=Ab.y;T=Ab.z;var ib=this.eb[0];w=ib.x;V=ib.y;ia=ib.z;var hb=this.ib[0];Y=hb.x;oa=hb.y;ua=hb.z;var ka=this.La[1];ca=ka.x;Ma=ka.y;va=ka.z;var Ia=this.eb[1];Z=Ia.x;Pa=Ia.y;Fa=Ia.z;var ab=this.ib[1];Q=ab.x;aa=ab.y;fa=ab.z;var bb=this.La[2];Rd=bb.x;ja=bb.y;Ga=bb.z;var Wa=this.eb[2];P=Wa.x;Ya=Wa.y;wa=Wa.z;var Va=this.ib[2];wb=Va.x;ec=Va.y;Vb=Va.z;var qb,kb,Sa,Na,Za,vb,mb,xb,nb;qb=ca-da;kb=Ma-M;Sa=va-T;Na=Rd-da;Za=ja-M;vb=Ga-T;mb=ta-da;xb=S-M;nb=ha-T;var fb=qb*qb+kb*kb+Sa*Sa,pa=qb*Na+kb*Za+Sa*vb,Db=Na*Na+Za*Za+vb*vb,G=qb*mb+kb*xb+Sa*nb,sb=Na*mb+Za*xb+vb*nb,jb=fb*Db-pa*pa;jb&&(jb=1/jb);var Xb=(G*Db-sb*pa)*jb,ob=(-G*pa+sb*fb)*jb,cb,zb,Xa,tb,v,W,U,db,cc;cb=Z-w;zb=Pa-V;Xa=Fa-ia;tb=w+cb*Xb;v=V+zb*Xb;W=ia+Xa*Xb;cb=P-w;zb=Ya-V;Xa=wa-ia;tb+=cb*ob;v+=zb*ob;W+=Xa*ob;cb=Q-Y;zb=aa-oa;Xa=fa-ua;U=Y+cb*Xb;db=oa+zb*Xb;cc=ua+Xa*Xb;cb=wb-Y;zb=ec-oa;Xa=Vb-ua;U+=cb*ob;db+=zb*ob;cc+=Xa*ob;var Ra=this.closestPoint1;Ra.x=tb;Ra.y=v;Ra.z=W;var Ha=this.closestPoint2;Ha.x=U;Ha.y=db;Ha.z=cc;break;default:throw Error("!?");}},yo:function(a){var b=this.dir;a=a.$l;b.x=a.x;b.y=a.y;b.z=a.z},Fo:function(a){a=a.$l;var b=this.closest;a.x=b.x;a.y=b.y;a.z=b.z;a.x=-a.x;a.y=-a.y;a.z=-a.z},an:function(a){this.Ba=a;this.Ba=(this.Ba&5)+(this.Ba>>1&5);this.Ba=(this.Ba&3)+(this.Ba>>2&3);switch(a){case 2:a=this.La[0];var b=this.La[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[1];a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.La[1];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 8:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a=this.La[2];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[2];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[2];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.La[0],b=this.La[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.eb[0],b=this.eb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.ib[0],b=this.ib[3],a.x=b.x,a.y=b.y,a.z=b.z}},Tf:function(a){var b,e,d,c,f,h;h=this.dir;c=h.x;f=h.y;h=h.z;var l;e=this.oc.o*c+this.oc.i*f+this.oc.l*h;l=this.oc.f*c+this.oc.m*f+this.oc.g*h;b=this.oc.h*c+this.oc.j*f+this.oc.s*h;d=this.dir;d.x=e;d.y=l;d.z=b;this.Kj.he(this.dir,this.eb[this.Ba]);a&&(a=this.dir,b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=this.dir,e=this.Ij[a++];b.x=e.x;b.y=e.y;b.z=e.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--;b=this.dir;b.x=-b.x;b.y=-b.y;b.z=-b.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--}},Wl:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;e=e.z;var d,c,f,h,l,g;f=this.La[0];d=f.x;c=f.y;f=f.z;g=this.La[1];h=g.x;l=g.y;g=g.z;d-=h;c-=l;f-=g;for(l=0;3>l;){var k,m;g=this.Ij[l++];h=g.x;k=g.y;m=g.z;g=c*m-f*k;m=f*h-d*m;h=d*k-c*h;k=this.dir;k.x=g;k.y=m;k.z=h;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--;g=this.dir;g.x=-g.x;g.y=-g.y;g.z=-g.z;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--}d=this.dir;d.x=a;d.y=b;d.z=e},dm:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;for(e=e.z;;){var d,c,f,h,l,g,k,m,p;f=this.La[0];d=f.x;c=f.y;f=f.z;m=this.La[1];h=m.x;l=m.y;g=m.z;p=this.La[2];k=p.x;m=p.y;p=p.z;h-=d;l-=c;g-=f;d=k-d;c=m-c;m=p-f;f=l*m-g*c;m=g*d-h*m;c=h*c-l*d;h=this.dir;h.x=f;h.y=m;h.z=c;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;c=this.dir;c.x=-c.x;c.y=-c.y;c.z=-c.z;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;break}c=this.dir;c.x=a;c.y=b;c.z=e},Lm:function(){var a=this.La[2].x-this.La[0].x,b=this.La[2].y-this.La[0].y,e=this.La[2].z-this.La[0].z,d=this.La[3].x-this.La[0].x,c=this.La[3].y-this.La[0].y,f=this.La[3].z-this.La[0].z,a=(this.La[1].x-this.La[0].x)*(b*f-e*c)-(this.La[1].y-this.La[0].y)*(a*f-e*d)+(this.La[1].z-this.La[0].z)*(a*c-b*d);return 1E-12a},Ln:function(a,b,e,d,c,f,h){for(var l=this.ih;0x;){for(var R=this.ih.Cd,F=Infinity,X=null;null!=R;)R.nkE.x*C.x+E.y*C.y+E.z*C.z-(za.x*Ta.x+za.y*Ta.y+za.z*Ta.z)||39==x){var Aa=this.closest,na=this.dir;Aa.x=na.x;Aa.y=na.y;Aa.z=na.z;var La=this.dir,Ba=O.Rd,ta=this.dir,S=(La.x*Ba.x+La.y*Ba.y+La.z*Ba.z)/(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z);Aa.x*=S;Aa.y*=S;Aa.z*=S;var ha,ea,da,M=this.closest;ha=M.x;ea=M.y;da=M.z;var T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab,ib,hb=O.Rd;T=hb.x;w=hb.y;V=hb.z;var ka=O.eb;ia=ka.x;Y=ka.y;oa=ka.z;var Ia=O.ib;ua=Ia.x;ca=Ia.y;Ma=Ia.z;var ab=sa.Rd;va=ab.x;Z=ab.y;Pa=ab.z;var bb=sa.eb;Fa=bb.x;Q=bb.y;aa=bb.z;var Wa=sa.ib;fa=Wa.x;Rd=Wa.y;ja=Wa.z;var Va=ba.Rd;Ga=Va.x;P=Va.y;Ya=Va.z;var qb=ba.eb;wa=qb.x;wb=qb.y;ec=qb.z;var kb=ba.ib;Vb=kb.x;Ab=kb.y;ib=kb.z;var Sa,Na,Za,vb,mb,xb,nb,fb,pa;Sa=va-T;Na=Z-w;Za=Pa-V;vb=Ga-T;mb=P-w;xb=Ya-V;nb=ha-T;fb=ea-w;pa=da-V;var Db=Sa*Sa+Na*Na+Za*Za,G=Sa*vb+Na*mb+Za*xb,sb=vb*vb+mb*mb+xb*xb,jb=Sa*nb+Na*fb+Za*pa,Xb=vb*nb+mb*fb+xb*pa,ob=Db*sb-G*G;ob&&(ob=1/ob);var cb=(jb*sb-Xb*G)*ob,zb=(-jb*G+Xb*Db)*ob,Xa,tb,v,W,U,db,cc,Ra,Ha;Xa=Fa-ia;tb=Q-Y;v=aa-oa;W=ia+Xa*cb;U=Y+tb*cb;db=oa+v*cb;Xa=wa-ia;tb=wb-Y;v=ec-oa;W+=Xa*zb;U+=tb*zb;db+=v*zb;Xa=fa-ua;tb=Rd-ca;v=ja-Ma;cc=ua+Xa*cb;Ra=ca+tb*cb;Ha=Ma+v*cb;Xa=Vb-ua;tb=Ab-ca;v=ib-Ma;cc+=Xa*zb;Ra+=tb*zb;Ha+=v*zb;var rb=this.closestPoint1;rb.x=W;rb.y=U;rb.z=db;var yb=this.closestPoint2;yb.x=cc;yb.y=Ra;yb.z=Ha;var Cb=this.closest;this.depth=Math.sqrt(Cb.x*Cb.x+Cb.y*Cb.y+Cb.z*Cb.z);return dc.SUCCEEDED}var la=this.ih,ra=la.jf;null!=ra?(la.jf=ra.M,ra.M=null):ra=new te;var ga=ra.Aa(E,K,H);if(!this.ih.qn(ga,I))return dc.EPA_FAILED_TO_ADD_VERTEX;++x}return dc.EPA_DID_NOT_CONVERGE},wa:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!0)},mb:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!1)},Vf:function(a,b,e,d,c,f,h){return this.xm(a,b,e,d,c,f,h)},ke:function(a,b,e,d,c){var f=this.Io;f.v=e.x;f.A=e.y;f.B=e.z;var h=this.Jo,l=this.Ko;h.x=d.x;h.y=d.y;h.z=d.z;h.x-=e.x;h.y-=e.y;h.z-=e.z;l.R();return this.xm(null,a,f,b,h,l,c)}};Pc.wc=function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;var l,g,k;l=f-d;g=h-c;k=b-a;var m;m=-(l*d+g*c+k*a)/(l*l+g*g+k*k);if(0>m)return e.x=d,e.y=c,e.z=a,1;if(1c*(t*E-A*B)+f*(A*y-q*E)+h*(q*B-t*y)){K=a.x;H=a.y;x=a.z;R=b.x;F=b.y;q=b.z;var X;t=R-K;A=F-H;X=q-x;var I;I=-(t*K+A*H+X*x)/(t*t+A*A+X*X);0>I?(d.x=K,d.y=H,d.z=x,K=1):1l*(u*E-n*B)+g*(n*y-L*E)+k*(L*B-u*y)&&(l=b.x,g=b.y,b=b.z,k=e.x,L=e.y,u=e.z,n=k-l,q=L-g,t=u-b,A=-(n*l+q*g+t*b)/(n*n+q*q+t*t),0>A?(d.x=l,d.y=g,d.z=b,b=1):1K||lm*(D*E-Ib*B)+p*(Ib*y-fc*E)+r*(fc*B-D*y)&&(m=a.x,p=a.y,a=a.z,r=e.x,fc=e.y,e=e.z,D=r-m,Ib=fc-p,b=e-a,l=-(D*m+Ib*p+b*a)/(D*D+Ib*Ib+b*b),0>l?(d.x=m,d.y=p,d.z=a,e=1):1K||a(f*Da+h*qa+l*J)*Aa){var ha,ea,da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q;ha=a.x;ea=a.y;da=a.z;M=b.x;T=b.y;w=b.z;V=e.x;ia=e.y;Y=e.z;oa=M-ha;ua=T-ea;ca=w-da;Ma=V-M;va=ia-T;Z=Y-w;Pa=ha-V;Fa=ea-ia;Q=da-Y;var aa,fa,Rd;aa=ua*Z-ca*va;fa=ca*Ma-oa*Z;Rd=oa*va-ua*Ma;var ja,Ga,P,Ya,wa,wb,ec,Vb,Ab;ja=ua*Rd-ca*fa;Ga=ca*aa-oa*Rd;P=oa*fa-ua*aa;Ya=va*Rd-Z*fa;wa=Z*aa-Ma*Rd;wb=Ma*fa-va*aa;ec=Fa*Rd-Q*fa;Vb=Q*aa-Pa*Rd;Ab=Pa*fa-Fa*aa;var ib=-1,hb,ka,Ia,ab=0;Ia=ka=hb=0;if(0>ha*ja+ea*Ga+da*P){var bb,Wa,Va,qb,kb,Sa;bb=a.x;Wa=a.y;Va=a.z;qb=b.x;kb=b.y;Sa=b.z;var Na,Za,vb;Na=qb-bb;Za=kb-Wa;vb=Sa-Va;var mb=Na*bb+Za*Wa+vb*Va,mb=-mb/(Na*Na+Za*Za+vb*vb),xb;if(0>mb)c.x=bb,c.y=Wa,c.z=Va,xb=1;else if(1M*Ya+T*wa+w*wb){var Db,G,sb,jb,Xb,ob;Db=b.x;G=b.y;sb=b.z;jb=e.x;Xb=e.y;ob=e.z;var cb,zb,Xa;cb=jb-Db;zb=Xb-G;Xa=ob-sb;var tb=cb*Db+zb*G+Xa*sb,tb=-tb/(cb*cb+zb*zb+Xa*Xa),v;if(0>tb)c.x=Db,c.y=G,c.z=sb,v=1;else if(1ib||ccV*ec+ia*Vb+Y*Ab){var Ra,Ha,rb,yb,Cb,la;Ra=a.x;Ha=a.y;rb=a.z;yb=e.x;Cb=e.y;la=e.z;var ra,ga,ma;ra=yb-Ra;ga=Cb-Ha;ma=la-rb;var Ja=ra*Ra+ga*Ha+ma*rb,Ja=-Ja/(ra*ra+ga*ga+ma*ma),$a;if(0>Ja)c.x=Ra,c.y=Ha,c.z=rb,$a=1;else if(1ib||Fc(f*ya+h*pa+l*Ea)*Aa){var gb,ub,xd,pb,Qa,de,Ic,Yb,oc,Id,$d,rc,Jc,Bb,Fb,Jb,hc,uc;gb=a.x;ub=a.y;xd=a.z;pb=e.x;Qa=e.y;de=e.z;Ic=d.x;Yb=d.y;oc=d.z;Id=pb-gb;$d=Qa-ub;rc=de-xd;Jc=Ic-pb;Bb=Yb-Qa;Fb=oc-de;Jb=gb-Ic;hc=ub-Yb;uc=xd-oc;var gc,Xc,Eb;gc=$d*Fb-rc*Bb;Xc=rc*Jc-Id*Fb;Eb=Id*Bb-$d*Jc;var Ng,Lb,Gb,Ob,xf,ic,Hb,Qb,Sb;Ng=$d*Eb-rc*Xc;Lb=rc*gc-Id*Eb;Gb=Id*Xc-$d*gc;Ob=Bb*Eb-Fb*Xc;xf=Fb*gc-Jc*Eb;ic=Jc*Xc-Bb*gc;Hb=hc*Eb-uc*Xc;Qb=uc*gc-Jb*Eb;Sb=Jb*Xc-hc*gc;var Nb=-1,sc,Jd,lb,Gc=0;lb=Jd=sc=0;if(0>gb*Ng+ub*Lb+xd*Gb){var Rb,vc,Kb,dc,bc,Pb;Rb=a.x;vc=a.y;Kb=a.z;dc=e.x;bc=e.y;Pb=e.z;var Wb,$b,Mb;Wb=dc-Rb;$b=bc-vc;Mb=Pb-Kb;var Tb=Wb*Rb+$b*vc+Mb*Kb,Tb=-Tb/(Wb*Wb+$b*$b+Mb*Mb),ac;if(0>Tb)c.x=Rb,c.y=vc,c.z=Kb,ac=1;else if(1pb*Ob+Qa*xf+de*ic){var kc,lc,kd,tc,jc,fd;kc=e.x;lc=e.y;kd=e.z;tc=d.x;jc=d.y;fd=d.z;var Rc,zc,gd;Rc=tc-kc;zc=jc-lc;gd=fd-kd;var Yc=Rc*kc+zc*lc+gd*kd,Yc=-Yc/(Rc*Rc+zc*zc+gd*gd),od;if(0>Yc)c.x=kc,c.y=lc,c.z=kd,od=1;else if(1Nb||ZcIc*Hb+Yb*Qb+oc*Sb){var Kc,Lc,xc,Cc,Dc,pd;Kc=a.x;Lc=a.y;xc=a.z;Cc=d.x;Dc=d.y;pd=d.z;var yd,sd,td;yd=Cc-Kc;sd=Dc-Lc;td=pd-xc;var zd=yd*Kc+sd*Lc+td*xc,zd=-zd/(yd*yd+sd*sd+td*td),Pc;if(0>zd)c.x=Kc,c.y=Lc,c.z=xc,Pc=1;else if(1Nb||Dena||Fe(f*O+h*sa+l*ba)*Aa){var je,Wc,Hd,se,te,Ge,He,Se,Te,Ie,Je,ae,xe,$c,Sc,ld,Ee,Qe;je=a.x;Wc=a.y;Hd=a.z;se=b.x;te=b.y;Ge=b.z;He=d.x;Se=d.y;Te=d.z;Ie=se-je;Je=te-Wc;ae=Ge-Hd;xe=He-se;$c=Se-te;Sc=Te-Ge;ld=je-He;Ee=Wc-Se;Qe=Hd-Te;var Ad,Bd,ud;Ad=Je*Sc-ae*$c;Bd=ae*xe-Ie*Sc;ud=Ie*$c-Je*xe;var ke,le,me,Cd,Dd,hd,Kd,ee,Td;ke=Je*ud-ae*Bd;le=ae*Ad-Ie*ud;me=Ie*Bd-Je*Ad;Cd=$c*ud-Sc*Bd;Dd=Sc*Ad-xe*ud;hd=xe*Bd-$c*Ad;Kd=Ee*ud-Qe*Bd;ee=Qe*Ad-ld*ud;Td=ld*Bd-Ee*Ad;var qd=-1,Ud,Ld,Md,ne=0;Md=Ld=Ud=0;if(0>je*ke+Wc*le+Hd*me){var Ue,ad,Ed,id,bd,cd;Ue=a.x;ad=a.y;Ed=a.z;id=b.x;bd=b.y;cd=b.z;var Vc,Mc,Nc;Vc=id-Ue;Mc=bd-ad;Nc=cd-Ed;var Ec=Vc*Ue+Mc*ad+Nc*Ed,Ec=-Ec/(Vc*Vc+Mc*Mc+Nc*Nc),yc;if(0>Ec)c.x=Ue,c.y=ad,c.z=Ed,yc=1;else if(1se*Cd+te*Dd+Ge*hd){var Hc,Oc,oe,lf,md,Fd;Hc=b.x;Oc=b.y;oe=b.z;lf=d.x;md=d.y;Fd=d.z;var ed,vd,jd;ed=lf-Hc;vd=md-Oc;jd=Fd-oe;var nd=ed*Hc+vd*Oc+jd*oe,nd=-nd/(ed*ed+vd*vd+jd*jd),mf;if(0>nd)c.x=Hc,c.y=Oc,c.z=oe,mf=1;else if(1qd||jfHe*Kd+Se*ee+Te*Td){var ue,fe,pe,ge,rd,Vd;ue=a.x;fe=a.y;pe=a.z;ge=d.x;rd=d.y;Vd=d.z;var wd,Wd,qe;wd=ge-ue;Wd=rd-fe;qe=Vd-pe;var he=wd*ue+Wd*fe+qe*pe,he=-he/(wd*wd+Wd*Wd+qe*qe),zf;if(0>he)c.x=ue,c.y=fe,c.z=pe,zf=1;else if(1qd||vgna||eg(g*za+k*Ta+m*C)*Aa){var fg,Nf,Of,gg,Pf,Qf,Rf,Sf,Tf,Af,ye,nf,Uf,of,hg,vf,wg,xg;fg=b.x;Nf=b.y;Of=b.z;gg=e.x;Pf=e.y;Qf=e.z;Rf=d.x;Sf=d.y;Tf=d.z;Af=gg-fg;ye=Pf-Nf;nf=Qf-Of;Uf=Rf-gg;of=Sf-Pf;hg=Tf-Qf;vf=fg-Rf;wg=Nf-Sf;xg=Of-Tf;var Xd,Nd,Od;Xd=ye*hg-nf*of;Nd=nf*Uf-Af*hg;Od=Af*of-ye*Uf;var yg,zg,Ag,Bg,pf,Vf,Kf,ig,Lf;yg=ye*Od-nf*Nd;zg=nf*Xd-Af*Od;Ag=Af*Nd-ye*Xd;Bg=of*Od-hg*Nd;pf=hg*Xd-Uf*Od;Vf=Uf*Nd-of*Xd;Kf=wg*Od-xg*Nd;ig=xg*Xd-vf*Od;Lf=vf*Nd-wg*Xd;var Wf=-1,Bf,We,qf,Cg=0;qf=We=Bf=0;if(0>fg*yg+Nf*zg+Of*Ag){var Le,Xe,Xf,Yf,Zf,$f;Le=b.x;Xe=b.y;Xf=b.z;Yf=e.x;Zf=e.y;$f=e.z;var Cf,Df,Ef;Cf=Yf-Le;Df=Zf-Xe;Ef=$f-Xf;var Me=Cf*Le+Df*Xe+Ef*Xf,Me=-Me/(Cf*Cf+Df*Df+Ef*Ef),Ff;if(0>Me)c.x=Le,c.y=Xe,c.z=Xf,Ff=1;else if(1gg*Bg+Pf*pf+Qf*Vf){var Ye,Gf,Hf,kg,be,ce;Ye=e.x;Gf=e.y;Hf=e.z;kg=d.x;be=d.y;ce=d.z;var Pd,Yd,Zd;Pd=kg-Ye;Yd=be-Gf;Zd=ce-Hf;var Gd=Pd*Ye+Yd*Gf+Zd*Hf,Gd=-Gd/(Pd*Pd+Yd*Yd+Zd*Zd),wf;if(0>Gd)c.x=Ye,c.y=Gf,c.z=Hf,wf=1;else if(1Wf||MgRf*Kf+Sf*ig+Tf*Lf){var Qg,Ze,rf,cg,re,sf;Qg=b.x;Ze=b.y;rf=b.z;cg=d.x;re=d.y;sf=d.z;var ze,Ae,tf;ze=cg-Qg;Ae=re-Ze;tf=sf-rf;var $e=ze*Qg+Ae*Ze+tf*rf,$e=-$e/(ze*ze+Ae*Ae+tf*tf),If;if(0>$e)c.x=Qg,c.y=Ze,c.z=rf,If=1;else if(1<$e)c.x=cg,c.y=re,c.z=sf,If=2;else{var Dg,Eg,Fg;Dg=Qg+ze*$e;Eg=Ze+Ae*$e;Fg=rf+tf*$e;c.x=Dg;c.y=Eg;c.z=Fg;If=3}var Gg=c.x*c.x+c.y*c.y+c.z*c.z;if(0>Wf||Ggna||lge?b>d?(b=Math.sqrt(b-e-d+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b,a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a},mb:function(a){var b=Math.sin(a.x),e=Math.sin(a.y),d=Math.sin(a.z),c=Math.cos(a.x),f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*d;this.e02=e;this.e10=c*d+a*b*e;this.e11=c*a-b*e*d;this.e12=-f*b;this.e20=b*d-c*a*e;this.e21=a*b+c*e*d;this.e22=c*f;return this},Fi:function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,1.570796326794895,.5*a)):new n(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))},wc:function(a){return 0==a?new n(this.e00,this.e01,this.e02):1==a?new n(this.e10,this.e11,this.e12):2==a?new n(this.e20,this.e21,this.e22):null},kc:function(a){return 0==a?new n(this.e00,this.e10,this.e20):1==a?new n(this.e01,this.e11,this.e21):2==a?new n(this.e02,this.e12,this.e22):null},xc:function(a,b){0==a?b.Aa(this.e00,this.e01,this.e02):1==a?b.Aa(this.e10,this.e11,this.e12):2==a?b.Aa(this.e20,this.e21,this.e22):b.R()},lc:function(a,b){0==a?b.Aa(this.e00,this.e10,this.e20):1==a?b.Aa(this.e01,this.e11,this.e21):2==a?b.Aa(this.e02,this.e12,this.e22):b.R()},Kb:function(a,b,e){this.e00=a.x;this.e01=a.y;this.e02=a.z;this.e10=b.x;this.e11=b.y;this.e12=b.z;this.e20=e.x;this.e21=e.y;this.e22=e.z;return this},wa:function(a,b,e){this.e00=a.x;this.e01=b.x;this.e02=e.x;this.e10=a.y;this.e11=b.y;this.e12=e.y;this.e20=a.z;this.e21=b.z;this.e22=e.z;return this},toString:function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};pa.vd=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};pa.atan2=function(a,b){return Math.atan2(a,b)};pa.sqrt=function(a){return Math.sqrt(a)};pa.Cb=function(a,b,e){return ae?e:a};pa.Hc=function(){return Math.random()};pa.Uc=function(a,b){return a+Math.random()*(b-a)};pa.Wc=function(a,b){return new n(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};pa.Vc=function(){return new n(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};Nb.prototype={Dc:function(){return 0==this.b?new n:this.c[--this.b]},lc:function(){return 0==this.cb?new I:this.bb[--this.cb]},wc:function(){return 0==this.Ag?new J:this.eg[--this.Ag]},xc:function(){return 0==this.re?new wa:this.le[--this.re]},wa:function(a,b,e,d){if(null!=a){a.R();if(this.b==this.c.length){for(var c=Array(this.b<<1),f=0,h=this.b;ff?(f=-f,e=-a.x,d=-a.y,c=-a.z,a=-a.w):(e=a.x,d=a.y,c=a.z,a=a.w);if(.999999e?b>d?(b=Math.sqrt(b-e-d+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this},vd:function(){var a=new I,b=this.x,e=this.y,d=this.z,c=this.w,f=2*b,h=2*e,l=2*d,g=b*f,k=e*h,d=d*l,m=b*h,e=e*l,b=b*l,f=c*f,h=c*h,c=c*l;a.e00=1-k-d;a.e01=m-c;a.e02=b+h;a.e10=m+c;a.e11=1-g-d;a.e12=e-f;a.e20=b-h;a.e21=e+f;a.e22=1-g-k;return a},toString:function(){return"Quat["+(0F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?F.alternativeContactPositionCorrectionAlgorithm:F.defaultContactPositionCorrectionAlgorithm,a.incremental?this.qm.xo(a,this.C.a,this.D.a):this.qm.Lo(a,this.C.a,this.D.a)):this.Ia.df()}},kc:function(){return this.Ec},lc:function(){return this.Fc},Kk:function(){return this.Hh},mb:function(){return this.Ia},wa:function(){return this.ef},Kb:function(){return this.ia},Cb:function(){return this.M}};Zb.prototype={wa:function(){return this.me},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};De.prototype={On:function(){for(var a=this.hc.pe;null!=a;){for(var b=a.M;;){var e;a.Ch.Icg.J&&l.Kg.K&&l.Lg.L&&this.$m(d,c))){d=b.ia;c=b.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b==this.je&&(this.je=this.je.M);b==this.Le&&(this.Le=this.Le.ia);b.M=null;b.ia=null;d=b.rb.ia;c=b.rb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.rb==b.C.Mb&&(b.C.Mb=b.C.Mb.M);b.rb==b.C.ic&&(b.C.ic=b.C.ic.ia);b.rb.M=null;b.rb.ia=null;d=b.sb.ia;c=b.sb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.sb==b.D.Mb&&(b.D.Mb=b.D.Mb.M);b.sb==b.D.ic&&(b.D.ic=b.D.ic.ia);b.sb.M=null;b.sb.ia=null;b.C.Ne--;b.D.Ne--;b.rb.ad=null;b.sb.ad=null;b.rb.me=null;b.sb.me=null;b.Ec=null;b.Fc=null;b.C=null;b.D=null;b.Hh=!1;b.pj.df();b.Ia.df();b.$h=null;d=b.ef;d.Ec=null;d.Fc=null;d.C=null;d.D=null;d.Ej=null;d.Fj=null;b.M=this.Cg;this.Cg=b;this.Ui--;break}b.Bk=!(f.nah.na&&f.oah.oa&&f.pah.pa);break}b=e}},$m:function(a,b){var e=a.Vb,d=b.Vb;if(e==d||0!=e.Jb&&0!=d.Jb||!(a.kk&b.lk&&b.kk&a.lk))return!1;e.AhF.sleepingTimeThreshold&&(b.Bb=!0,b.wb=0)):b.wb=0;if(!b.Bb){if(0==b.Jb){var e=a*b.sk,d=e*e,e=1/(1+e+d*(.5+.16666666666666666*e+.041666666666666664*d)),d=a*b.hk,c=d*d,d=1/(1+d+c*(.5+.16666666666666666*d+.041666666666666664*c)),f,h,l,c=this.Fm*b.vh;f=this.Gm*b.vh;h=this.Hm*b.vh;c+=b.ai*b.qb;f+=b.bi*b.qb;h+=b.ci*b.qb;var g,k;g=b.S*b.Of+b.T*b.Pf+b.U*b.Qf;k=b.V*b.Of+b.W*b.Pf+b.X*b.Qf;l=b.Y*b.Of+b.Z*b.Pf+b.$*b.Qf;b.jb+=c*a;b.kb+=f*a;b.lb+=h*a;b.jb*=e;b.kb*=e;b.lb*=e;b.nb+=g*a;b.ob+=k*a;b.pb+=l*a;b.nb*=d;b.ob*=d;b.pb*=d}b.nm(a);for(a=b.Gc;null!=a;){e=a.M;c=b.ja;d=b.a;f=a.ja;h=a.ha;var m,p,r,q,t,A;l=c.o*h.o+c.f*h.i+c.h*h.l;g=c.o*h.f+c.f*h.m+c.h*h.g;k=c.o*h.h+c.f*h.j+c.h*h.s;m=c.i*h.o+c.m*h.i+c.j*h.l;p=c.i*h.f+c.m*h.m+c.j*h.g;r=c.i*h.h+c.m*h.j+c.j*h.s;q=c.l*h.o+c.g*h.i+c.s*h.l;t=c.l*h.f+c.g*h.m+c.s*h.g;A=c.l*h.h+c.g*h.j+c.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=p;f.j=r;f.l=q;f.g=t;f.s=A;l=c.o*h.v+c.f*h.A+c.h*h.B;g=c.i*h.v+c.m*h.A+c.j*h.B;h=c.l*h.v+c.g*h.A+c.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=c.v;f.A+=c.A;f.B+=c.B;c=a.a;f=a.ha;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;r=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=r;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;a.Fb.Lb(a.u,a.ja);d=a.u.na;c=a.u.oa;f=a.u.pa;h=a.u.ka;l=a.u.la;g=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=da.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;a.u.ma=g>a.u.ma?g:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,c=a.a.A-a.ja.A,f=a.a.B-a.ja.B,h=a.mc,h.x=d,h.y=c,h.z=f,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=e}}},Dn:function(a,b,e){for(var d=a.dt,c=!0,f=0,h=this.ag;fb.u.ka?g:b.u.ka;b.u.la=k>b.u.la?k:b.u.la;b.u.ma=m>b.u.ma?m:b.u.ma;null!=b.ub&&(f=b.a.v-b.ja.v,h=b.a.A-b.ja.A,l=b.a.B-b.ja.B,g=b.mc,g.x=f,g.y=h,g.z=l,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=c}}}};Ca.prototype={xl:function(){var a=Date.now()/1E3;this.Hi.xl();Ce.broadPhaseCollisionTime=1E3*(Date.now()/1E3-a);for(var a=Date.now()/1E3,b=this.Hi.je;null!=b;){var e=b.M;b.Bk||b.Fn();b=e}Ce.narrowPhaseCollisionTime=1E3*(Date.now()/1E3-a)},Cn:function(){var a=Date.now()/1E3;if(F.disableSleeping)for(var b=this.Nf;null!=b;)b.Bb=!1,b.wb=0,b=b.M;if(this.Fh.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var c=this.ra,f=0==c.b?new n:c.c[--c.b],c=this.ra,c=0==c.b?new n:c.c[--c.b];f.x=b.J;f.y=b.K;f.z=b.L;c.x=b.G;c.y=b.H;c.z=b.I;a.aabb(f,c,d);var h=this.ra;if(null!=f){f.R();if(h.b==h.c.length){for(var l=Array(h.b<<1),g=0,k=h.b;gF.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2:e.Bb?b.sleepingShapeColor1:e.wb>F.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1);if(a.drawShapes){var k=l.Fb,m=l.a;switch(k.Jb){case 0:a.sphere(m,k.ab,f);break;case 1:var p=k,r=this.ra,q=0==r.b?new n:r.c[--r.b],t=q;t.x=p.Te;t.y=p.Ue;t.z=p.Ve;a.box(m,q,f);var A=this.ra;if(null!=q){q.R();if(A.b==A.c.length){for(var L=Array(A.b<<1),u=0,z=A.b;ul?a.ellipse(b,e,d,f,f,g):a.arc(b,e,d,f,f,h,l,!0,g)}},km:function(a,b,e,d,c){if(dr;){r++;var q=Math.cos(g)*f,t=Math.sin(g)*h,A=Math.sqrt(q*q+t*t),L=Math.sin(.5*A),u=Math.cos(.5*A),z=k.R();z.x+=d.x*q;z.y+=d.y*q;z.z+=d.z*q;z.x+=c.x*t;z.y+=c.y*t;z.z+=c.z*t;q=1/A*L;k.x*=q;k.y*=q;k.z*=q;m.x=k.x;m.y=k.y;m.z=k.z;m.w=u;var fc=m.x,D=m.y,L=m.z,t=m.w,x=2*fc,y=2*D,A=2*L,u=fc*x,q=D*y,L=L*A,z=fc*y,D=D*A,fc=fc*A,x=t*x,y=t*y,t=t*A;p.e00=1-q-L;p.e01=z-t;p.e02=fc+y;p.e10=z+t;p.e11=1-u-L;p.e12=D-x;p.e20=fc-y;p.e21=D+x;p.e22=1-u-q;u=this.ra;u=0==u.b?new n:u.c[--u.b];u.x+=e.x*l;u.y+=e.y*l;u.z+=e.z*l;q=u.x*p.e10+u.y*p.e11+u.z*p.e12;t=u.x*p.e20+u.y*p.e21+u.z*p.e22;u.x=u.x*p.e00+u.y*p.e01+u.z*p.e02;u.y=q;u.z=t;u.x+=b.x;u.y+=b.y;u.z+=b.z;q=this.ra;if(null!=a){a.R();if(q.b==q.c.length){t=Array(q.b<<1);A=0;for(L=q.b;Ab||5e&&(e=-e);(d=e/.5235987755982984+.5|0)||(d=1);e=f;h=(h-f)/d;c=this.p;c=0==c.b?new n:c.c[--c.b];c.x=a.x;c.y=a.y;c.z=a.z;var g=Math.cos(f);c.x+=l.x*g;c.y+=l.y*g;c.z+=l.z*g;f=Math.sin(f);c.x+=b.x*f;c.y+=b.y*f;c.z+=b.z*f;f=c;for(c=0;cda;){var M=da++,T=this.fg[M],w=this.Mj[M];T.x=w.x;T.y=w.y;T.z=w.z;T.x*=ha;T.y*=ha;T.z*=ha;T.y+=ea;var V=this.fg[M],ia=V.x*q.e10+V.y*q.e11+V.z*q.e12,Y=V.x*q.e20+V.y*q.e21+V.z*q.e22;V.x=V.x*q.e00+V.y*q.e01+V.z*q.e02;V.y=ia;V.z=Y;var oa=this.Ee[M],ua=this.vm[M];oa.x=ua.x;oa.y=ua.y;oa.z=ua.z;oa.x*=ha;oa.y*=ha;oa.z*=ha;oa.y+=ea;var ca=this.Ee[M],Ma=ca.x*q.e10+ca.y*q.e11+ca.z*q.e12,va=ca.x*q.e20+ca.y*q.e21+ca.z*q.e22;ca.x=ca.x*q.e00+ca.y*q.e01+ca.z*q.e02;ca.y=Ma;ca.z=va;var Z=this.af[M],Pa=this.Mj[M];Z.x=Pa.x;Z.y=Pa.y;Z.z=Pa.z;var Fa=Z.x*q.e10+Z.y*q.e11+Z.z*q.e12,Q=Z.x*q.e20+Z.y*q.e21+Z.z*q.e22;Z.x=Z.x*q.e00+Z.y*q.e01+Z.z*q.e02;Z.y=Fa;Z.z=Q;Z.x*=b;Z.y*=b;Z.z*=b;Z.x+=p.x;Z.y+=p.y;Z.z+=p.z;var aa=this.af[M],fa=-e;aa.x+=l.x*fa;aa.y+=l.y*fa;aa.z+=l.z*fa}for(var wa=0;8>wa;){wa++;var ja=this.p,Ga=0==ja.b?new n:ja.c[--ja.b];Ga.x=l.x;Ga.y=l.y;Ga.z=l.z;var P=Ga;P.x=-P.x;P.y=-P.y;P.z=-P.z;var Ya=this.p;if(null!=P){P.R();if(Ya.b==Ya.c.length){for(var Ca=Array(Ya.b<<1),wb=0,ec=Ya.b;wbAb;){var ib=Ab++,hb=this.fg[ib],ka=this.Mj[ib];hb.x=ka.x;hb.y=ka.y;hb.z=ka.z;var Ia=hb.x*q.e10+hb.y*q.e11+hb.z*q.e12,ab=hb.x*q.e20+hb.y*q.e21+hb.z*q.e22;hb.x=hb.x*q.e00+hb.y*q.e01+hb.z*q.e02;hb.y=Ia;hb.z=ab;var bb=this.Ee[ib],Wa=this.fg[ib];bb.x=Wa.x;bb.y=Wa.y;bb.z=Wa.z;bb.x*=b;bb.y*=b;bb.z*=b;bb.x+=p.x;bb.y+=p.y;bb.z+=p.z;var Va=this.af[ib],qb=this.Ee[ib];Va.x=qb.x;Va.y=qb.y;Va.z=qb.z;var kb=this.Ee[ib];kb.x+=l.x*e;kb.y+=l.y*e;kb.z+=l.z*e;var Sa=this.af[ib],Na=-e;Sa.x+=l.x*Na;Sa.y+=l.y*Na;Sa.z+=l.z*Na}for(var Za=0;8>Za;){var vb=Za++,mb=A,xb=this.Ee[vb],nb=this.Ee[(vb+1)%8],fb=l,mb=u,xb=this.af[(vb+1)%8],nb=this.af[vb],Ka=this.p,Db=0==Ka.b?new n:Ka.c[--Ka.b];Db.x=l.x;Db.y=l.y;Db.z=l.z;var G=Db;G.x=-G.x;G.y=-G.y;G.z=-G.z;var fb=G,sb=this.p;if(null!=G){G.R();if(sb.b==sb.c.length){for(var jb=Array(sb.b<<1),Xb=0,ob=sb.b;XbL;)for(var u=L++,z=this.Yh[u].length,fc=0;fcK;){var H=K++;if(!H)for(var F=0;3>F;)for(var R=F++,N=this.Yh[R].length,X=0;Xpa;)for(var ya=pa++,wa=this.Yh[ya].length,Ea=0;EaTa;){var C=Ta++,Aa,na,La,Ba,ta,S,ha,ea;H?3==H?this.wireframe?(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C]):(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C],ta=A[4][0],S=A[H][(C+1)%8],ha=A[H][C]):this.wireframe?(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C]):(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C],Ba=t[H+1][(C+1)%8],ta=A[H][C],S=A[H][(C+1)%8],ha=A[H+1][C],ea=A[H+1][(C+1)%8],this.rect(Aa,La,Ba,na,ta,ha,ea,S,d)):this.wireframe?(Aa=t[0][0],na=t[1][C]):(Aa=t[0][0],na=t[1][C],La=t[1][(C+1)%8],ta=A[0][0],S=A[1][C],ha=A[1][(C+1)%8])}}var da=this.p,M=0==da.b?new n:da.c[--da.b];M.x=p.x;M.y=p.y;M.z=p.z;M.x+=l.x*e;M.y+=l.y*e;M.z+=l.z*e;var T=this.p,w=0==T.b?new n:T.c[--T.b];w.x=p.x;w.y=p.y;w.z=p.z;var V=-e;w.x+=l.x*V;w.y+=l.y*V;w.z+=l.z*V;if(this.wireframe){var ia=this.p,Y=0==ia.b?new n:ia.c[--ia.b];Y.x=M.x;Y.y=M.y;Y.z=M.z;var oa=-b;Y.x+=f.x*oa;Y.y+=f.y*oa;Y.z+=f.z*oa;Y.x+=0*k.x;Y.y+=0*k.y;Y.z+=0*k.z;var ua=this.p,ca=0==ua.b?new n:ua.c[--ua.b];ca.x=M.x;ca.y=M.y;ca.z=M.z;ca.x+=f.x*b;ca.y+=f.y*b;ca.z+=f.z*b;ca.x+=0*k.x;ca.y+=0*k.y;ca.z+=0*k.z;var Ma=this.p,va=0==Ma.b?new n:Ma.c[--Ma.b];va.x=M.x;va.y=M.y;va.z=M.z;va.x+=0*f.x;va.y+=0*f.y;va.z+=0*f.z;var Z=-b;va.x+=k.x*Z;va.y+=k.y*Z;va.z+=k.z*Z;var Pa=this.p,Fa=0==Pa.b?new n:Pa.c[--Pa.b];Fa.x=M.x;Fa.y=M.y;Fa.z=M.z;Fa.x+=0*f.x;Fa.y+=0*f.y;Fa.z+=0*f.z;Fa.x+=k.x*b;Fa.y+=k.y*b;Fa.z+=k.z*b;var Q=this.p,aa=0==Q.b?new n:Q.c[--Q.b];aa.x=w.x;aa.y=w.y;aa.z=w.z;var fa=-b;aa.x+=f.x*fa;aa.y+=f.y*fa;aa.z+=f.z*fa;aa.x+=0*k.x;aa.y+=0*k.y;aa.z+=0*k.z;var Ca=this.p,ja=0==Ca.b?new n:Ca.c[--Ca.b];ja.x=w.x;ja.y=w.y;ja.z=w.z;ja.x+=f.x*b;ja.y+=f.y*b;ja.z+=f.z*b;ja.x+=0*k.x;ja.y+=0*k.y;ja.z+=0*k.z;var Ga=this.p,P=0==Ga.b?new n:Ga.c[--Ga.b];P.x=w.x;P.y=w.y;P.z=w.z;P.x+=0*f.x;P.y+=0*f.y;P.z+=0*f.z;var Ya=-b;P.x+=k.x*Ya;P.y+=k.y*Ya;P.z+=k.z*Ya;var Ka=this.p,wb=0==Ka.b?new n:Ka.c[--Ka.b];wb.x=w.x;wb.y=w.y;wb.z=w.z;wb.x+=0*f.x;wb.y+=0*f.y;wb.z+=0*f.z;wb.x+=k.x*b;wb.y+=k.y*b;wb.z+=k.z*b;this.ellipse(M,f,k,b,b,d);this.ellipse(w,f,k,b,b,d);var ec=this.p;if(null!=Y){Y.R();if(ec.b==ec.c.length){for(var Vb=Array(ec.b<<1),Ab=0,ib=ec.b;Abyb;){var Cb=yb++,la=this.fg[Cb],ra=this.Mj[Cb];la.x=ra.x;la.y=ra.y;la.z=ra.z;var ga=la.x*q.e10+la.y*q.e11+la.z*q.e12,ma=la.x*q.e20+la.y*q.e21+la.z*q.e22;la.x=la.x*q.e00+la.y*q.e01+la.z*q.e02;la.y=ga;la.z=ma;var Ja=this.Ee[Cb],$a=this.fg[Cb];Ja.x=$a.x;Ja.y=$a.y;Ja.z=$a.z;Ja.x*=b;Ja.y*=b;Ja.z*=b;Ja.x+=p.x;Ja.y+=p.y;Ja.z+=p.z;var Oa=this.af[Cb],nc=this.Ee[Cb];Oa.x=nc.x;Oa.y=nc.y;Oa.z=nc.z;var xa=this.Ee[Cb];xa.x+=l.x*e;xa.y+=l.y*e;xa.z+=l.z*e;var Fc=this.af[Cb],eb=-e;Fc.x+=l.x*eb;Fc.y+=l.y*eb;Fc.z+=l.z*eb}for(var gb=0;8>gb;){var pb=gb++,Qa=this.fg[pb],ub=this.fg[(pb+1)%8];this.rect(this.Ee[pb],this.af[pb],this.af[(pb+1)%8],this.Ee[(pb+1)%8],Qa,Qa,ub,ub,d)}}var lb=this.p;if(null!=M){M.R();if(lb.b==lb.c.length){for(var Bb=Array(lb.b<<1),Fb=0,Nb=lb.b;Fbh;)for(var l=h++,g=this.Yh[l].length,k=0;kb;)for(h=b++,l=0;8>l;){var t=l++,A;h&&3!=h&&!this.wireframe&&(g=a[h][t],k=a[h][(t+1)%8],m=a[h+1][t],p=a[h+1][(t+1)%8],r=f[h][t],q=f[h][(t+1)%8],A=f[h+1][t],t=f[h+1][(t+1)%8],this.rect(g,m,p,k,r,A,t,q,e))}e=this.p;if(null!=c){c.R();if(e.b==e.c.length){a=Array(e.b<<1);f=0;for(b=e.b;fA.Oc)A.mg=!0,A=A.ne,A.dd=0,A.Kc=0,A.Jc=0,A.vb=0,A.mf=0,A.nf=0,A.pf=0;else{A.mg=!1;var L=b.rows[b.Da++];L.friction=p;L.Ka=0;var u=L.yg;u.sa=e;u.ta=d;u.ua=c;u.xa=e;u.ya=d;u.za=c;u.aa=A.zb*c-A.Ab*d;u.ba=A.Ab*e-A.yb*c;u.ca=A.yb*d-A.zb*e;u.da=A.Zb*c-A.$b*d;u.ea=A.$b*e-A.Yb*c;u.fa=A.Yb*d-A.Zb*e;u=L.Zj;u.sa=f;u.ta=h;u.ua=l;u.xa=f;u.ya=h;u.za=l;u.aa=A.zb*l-A.Ab*h;u.ba=A.Ab*f-A.yb*l;u.ca=A.yb*h-A.zb*f;u.da=A.Zb*l-A.$b*h;u.ea=A.$b*f-A.Yb*l;u.fa=A.Yb*h-A.Zb*f;u=L.Yj;u.sa=g;u.ta=k;u.ua=m;u.xa=g;u.ya=k;u.za=m;u.aa=A.zb*m-A.Ab*k;u.ba=A.Ab*g-A.yb*m;u.ca=A.yb*k-A.zb*g;u.da=A.Zb*m-A.$b*k;u.ea=A.$b*g-A.Yb*m;u.fa=A.Yb*k-A.Zb*g;u=L.yg;u=u.sa*this.C.jb+u.ta*this.C.kb+u.ua*this.C.lb+(u.aa*this.C.nb+u.ba*this.C.ob+u.ca*this.C.pb)-(u.xa*this.D.jb+u.ya*this.D.kb+u.za*this.D.lb+(u.da*this.D.nb+u.ea*this.D.ob+u.fa*this.D.pb));L.Fa=u<-F.contactEnableBounceThreshold&&!A.kf?-u*r:0;this.Sg==jc.BAUMGARTE&&A.Oc>F.linearSlop&&(u=(A.Oc-F.linearSlop)*F.velocityBaumgarte*a.invDt,L.Fal.Fa&&(l.Fa=0);l.qa=h.ne}}},rl:function(){this.Ia.pm(this.Ej,this.Fj)},mb:function(){return this.Ec},Cb:function(){return this.Fc},wa:function(){return this.Ia},Kk:function(){for(var a=0,b=this.Ia.oe;aF.contactPersistenceThreshold?this.Zm(a):(e+=this.Ia.Og*-c,d+=this.Ia.Pg*-c,b+=this.Ia.Qg*-c,e*e+d*d+b*b>F.contactPersistenceThreshold*F.contactPersistenceThreshold&&this.Zm(a))}},Zm:function(a){var b=--this.Ia.oe;if(a!=b){var e=this.Ia.Bc[a];this.Ia.Bc[a]=this.Ia.Bc[b];this.Ia.Bc[b]=e}a=this.Ia.Bc[b];a.Ff=0;a.Gf=0;a.Hf=0;a.If=0;a.Jf=0;a.Kf=0;a.yb=0;a.zb=0;a.Ab=0;a.Yb=0;a.Zb=0;a.$b=0;a.be=0;a.ce=0;a.de=0;a.ee=0;a.fe=0;a.ge=0;a.Oc=0;b=a.ne;b.dd=0;b.Kc=0;b.Jc=0;b.vb=0;b.mf=0;b.nf=0;b.pf=0;a.kf=!1;a.mg=!1;a.Ic=-1},Gn:function(a,b,e){var d=this.Ia.oe;if(d==F.maxManifoldPoints){var d=this.Ia.Bc[this.Nn(a,b,e)],c=a.position1;d.be=c.x;d.ce=c.y;d.de=c.z;c=a.position2;d.ee=c.x;d.fe=c.y;d.ge=c.z;d.yb=d.be-b.v;d.zb=d.ce-b.A;d.Ab=d.de-b.B;d.Yb=d.ee-e.v;d.Zb=d.fe-e.A;d.$b=d.ge-e.B;var f,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab;f=b.f*d.yb+b.m*d.zb+b.g*d.Ab;b=b.h*d.yb+b.j*d.zb+b.s*d.Ab;d.Ff=c;d.Gf=f;d.Hf=b;b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b;c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b;e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b;d.If=b;d.Jf=c;d.Kf=e;d.Oc=a.depth;e=d.ne;e.dd=0;e.Kc=0;e.Jc=0;e.vb=0;e.mf=0;e.nf=0;e.pf=0;d.Ic=a.id;d.kf=!1;d.mg=!1}else d=this.Ia.Bc[d],c=a.position1,d.be=c.x,d.ce=c.y,d.de=c.z,c=a.position2,d.ee=c.x,d.fe=c.y,d.ge=c.z,d.yb=d.be-b.v,d.zb=d.ce-b.A,d.Ab=d.de-b.B,d.Yb=d.ee-e.v,d.Zb=d.fe-e.A,d.$b=d.ge-e.B,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab,f=b.f*d.yb+b.m*d.zb+b.g*d.Ab,b=b.h*d.yb+b.j*d.zb+b.s*d.Ab,d.Ff=c,d.Gf=f,d.Hf=b,b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b,c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b,e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b,d.If=b,d.Jf=c,d.Kf=e,d.Oc=a.depth,e=d.ne,e.dd=0,e.Kc=0,e.Jc=0,e.vb=0,e.mf=0,e.nf=0,e.pf=0,d.Ic=a.id,d.kf=!1,d.mg=!1,this.Ia.oe++},Nn:function(a,b){var e=this.Ia.Bc[0],d=this.Ia.Bc[1],c=this.Ia.Bc[2],f=this.Ia.Bc[3],h=e.Oc,l=0;d.Oc>h&&(h=d.Oc,l=1);c.Oc>h&&(h=c.Oc,l=2);f.Oc>h&&(h=f.Oc,l=3);var g,k,m,p=a.position1;g=p.x;k=p.y;m=p.z;g-=b.v;k-=b.A;m-=b.B;var r=d.yb,q=d.zb,t=d.Ab,A=c.yb,L=c.zb,u=c.Ab,n=f.yb,x=f.zb,D=f.Ab,F,y,B,E,K,H,N,R,I,X,J,Da,qa,pa,ya,wa,Ea,O;F=A-r;y=L-q;B=u-t;E=g-n;K=k-x;H=m-D;N=n-r;R=x-q;I=D-t;X=g-A;J=k-L;Da=m-u;qa=g-r;pa=k-q;ya=m-t;wa=n-A;Ea=x-L;O=D-u;var sa,ba,za,Ta,C,Aa,na,La,Ba;sa=y*H-B*K;ba=B*E-F*H;za=F*K-y*E;Ta=R*Da-I*J;C=I*X-N*Da;Aa=N*J-R*X;na=pa*O-ya*Ea;La=ya*wa-qa*O;Ba=qa*Ea-pa*wa;var ta=sa*sa+ba*ba+za*za,S=Ta*Ta+C*C+Aa*Aa,ha=na*na+La*La+Ba*Ba,ea=e.yb,da=e.zb,M=e.Ab,T=c.yb,w=c.zb,V=c.Ab,ia=f.yb,Y=f.zb,oa=f.Ab,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Ca,ja,Ga,P,Ya,Ka,wb,Ua;ua=T-ea;ca=w-da;Ma=V-M;va=g-ia;Z=k-Y;Pa=m-oa;Fa=ia-ea;Q=Y-da;aa=oa-M;fa=g-T;Ca=k-w;ja=m-V;Ga=g-ea;P=k-da;Ya=m-M;Ka=ia-T;wb=Y-w;Ua=oa-V;var Vb,Ab,ib,hb,ka,Ia,ab,bb,Wa;Vb=ca*Pa-Ma*Z;Ab=Ma*va-ua*Pa;ib=ua*Z-ca*va;hb=Q*ja-aa*Ca;ka=aa*fa-Fa*ja;Ia=Fa*Ca-Q*fa;ab=P*Ua-Ya*wb;bb=Ya*Ka-Ga*Ua;Wa=Ga*wb-P*Ka;var Va=Vb*Vb+Ab*Ab+ib*ib,qb=hb*hb+ka*ka+Ia*Ia,kb=ab*ab+bb*bb+Wa*Wa,Sa=Va>qb?Va>kb?Va:kb:qb>kb?qb:kb,Na=e.yb,Za=e.zb,vb=e.Ab,mb=d.yb,xb=d.zb,nb=d.Ab,fb=f.yb,gb=f.zb,Db=f.Ab,G,sb,jb,Xb,ob,cb,zb,Xa,tb,v,W,U,db,cc,Ra,Ha,rb,yb;G=mb-Na;sb=xb-Za;jb=nb-vb;Xb=g-fb;ob=k-gb;cb=m-Db;zb=fb-Na;Xa=gb-Za;tb=Db-vb;v=g-mb;W=k-xb;U=m-nb;db=g-Na;cc=k-Za;Ra=m-vb;Ha=fb-mb;rb=gb-xb;yb=Db-nb;var Cb,la,ra,ga,ma,Ja,$a,Oa,eb;Cb=sb*cb-jb*ob;la=jb*Xb-G*cb;ra=G*ob-sb*Xb;ga=Xa*U-tb*W;ma=tb*v-zb*U;Ja=zb*W-Xa*v;$a=cc*yb-Ra*rb;Oa=Ra*Ha-db*yb;eb=db*rb-cc*Ha;var xa=Cb*Cb+la*la+ra*ra,pb=ga*ga+ma*ma+Ja*Ja,lb=$a*$a+Oa*Oa+eb*eb,Qa=xa>pb?xa>lb?xa:lb:pb>lb?pb:lb,ub=e.yb,Bb=e.zb,Fb=e.Ab,Hb=d.yb,Kb=d.zb,Lb=d.Ab,Nb=c.yb,Ic=c.zb,Yb=c.Ab,oc,Mb,Pb,rc,Jc,Gb,Qb,Jb,hc,uc,gc,Ob,Eb,Rb,Sb,Tb,$b,Zb;oc=Hb-ub;Mb=Kb-Bb;Pb=Lb-Fb;rc=g-Nb;Jc=k-Ic;Gb=m-Yb;Qb=Nb-ub;Jb=Ic-Bb;hc=Yb-Fb;uc=g-Hb;gc=k-Kb;Ob=m-Lb;Eb=g-ub;Rb=k-Bb;Sb=m-Fb;Tb=Nb-Hb;$b=Ic-Kb;Zb=Yb-Lb;var ic,bc,Wb,ac,dc,sc,kc,lc,Gc;ic=Mb*Gb-Pb*Jc;bc=Pb*rc-oc*Gb;Wb=oc*Jc-Mb*rc;ac=Jb*Ob-hc*gc;dc=hc*uc-Qb*Ob;sc=Qb*gc-Jb*uc;kc=Rb*Zb-Sb*$b;lc=Sb*Tb-Eb*Zb;Gc=Eb*$b-Rb*Tb;var pc=ic*ic+bc*bc+Wb*Wb,vc=ac*ac+dc*dc+sc*sc,qc=kc*kc+lc*lc+Gc*Gc,tc=pc>vc?pc>qc?pc:qc:vc>qc?vc:qc,jc=ta>S?ta>ha?ta:ha:S>ha?S:ha,wc=0;if(Sa>jc&&1!=l||!l)jc=Sa,wc=1;Qa>jc&&2!=l&&(jc=Qa,wc=2);tc>jc&&3!=l&&(jc=tc,wc=3);return wc},Qn:function(a,b,e){for(var d=F.contactPersistenceThreshold*F.contactPersistenceThreshold,c=-1,f=0,h=this.Ia.oe;fe?(a=this.Ma,b=this.Na,d=this.Oa,e=a*a,c=b*b,f=d*d,ed?(a=this.Ma,b=this.Na,e=this.Oa,d=a*a,c=b*b,f=e*e,dg?b=k=e=0:f==g?(e=-Infinity,k=Infinity,b-=f):bg?(e=0,k=Infinity,b=b-g-l,0>b&&(b=0)):b=k=e=0;a.Ha=e;a.Ga=k;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},nh:function(a,b,e,d,c,f,h){var l=F.angularSlop;if(h)c=0,h=1;else{if(0e?b=g=k=0:f==e?(k=-Infinity,g=Infinity,b-=f):be?(k=0,g=Infinity,b=b-e-l,0>b&&(b=0)):b=g=k=0;a.Ha=k;a.Ga=g;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},Mh:function(a,b){return b?1:this.Sg==jc.BAUMGARTE?a.invDt*F.velocityBaumgarte:0},Yg:function(a,b,e){var d=(this.C.S*a+this.C.T*b+this.C.U*e)*a+(this.C.V*a+this.C.W*b+this.C.X*e)*b+(this.C.Y*a+this.C.Z*b+this.C.$*e)*e,c=(this.D.S*a+this.D.T*b+this.D.U*e)*a+(this.D.V*a+this.D.W*b+this.D.X*e)*b+(this.D.Y*a+this.D.Z*b+this.D.$*e)*e;if(0this.nj*this.nj?this.jc.bm(this):0this.oj*this.oj&&this.jc.bm(this)},Ke:function(){return this.C},bf:function(){return this.D},hg:function(){return this.Jb},mb:function(){var a=new n;a.x=this.uf;a.y=this.vf;a.z=this.wf;return a},Kb:function(){var a=new n;a.x=this.xf;a.y=this.yf;a.z=this.zf;return a},Cb:function(a){a.x=this.uf;a.y=this.vf;a.z=this.wf},kc:function(a){a.x=this.xf;a.y=this.yf;a.z=this.zf},Fe:function(){var a=new n;a.x=this.sj;a.y=this.tj;a.z=this.uj;return a},He:function(){var a=new n;a.x=this.vj;a.y=this.wj;a.z=this.xj;return a},Ge:function(a){a.x=this.sj;a.y=this.tj;a.z=this.uj},Ie:function(a){a.x=this.vj;a.y=this.wj;a.z=this.xj},Hc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Vc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Uc:function(a){var b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},Wc:function(a){var b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},wa:function(){return this.Sk},ig:function(a){this.Sk=a},vd:function(){return this.nj},jg:function(a){this.nj=a},ie:function(){return this.oj},kg:function(a){this.oj=a},Je:function(){return this.Sg},ph:function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.Sg=a},lc:function(){var a=new n;a.x=this.ej;a.y=this.fj;a.z=this.gj;return a},wc:function(a){a.x=this.ej;a.y=this.fj;a.z=this.gj},xc:function(){var a=new n;a.x=this.hj;a.y=this.ij;a.z=this.jj;return a},Dc:function(a){a.x=this.hj;a.y=this.ij;a.z=this.jj},gg:function(){return this.ia},cf:function(){return this.M}};Fb.wa=N;Fb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Re*d,d=this.Se*d,l,g=this.Yg(this.N.pc,this.N.qc,this.N.rc);if(0>=this.ul.frequency||!e){l=this.Eb[0];var k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=null;k.qa=l;this.ak(k,this.Bg,this.tl,1/(this.C.qb+this.D.qb),this.ul,b,e);l=k.va;l.sa=this.N.pc;l.ta=this.N.qc;l.ua=this.N.rc;l.xa=this.N.pc;l.ya=this.N.qc;l.za=this.N.rc;l.aa=this.bc*this.N.rc-this.cc*this.N.qc;l.ba=this.cc*this.N.pc-this.ac*this.N.rc;l.ca=this.ac*this.N.qc-this.bc*this.N.pc;l.da=this.ec*this.N.rc-this.fc*this.N.qc;l.ea=this.fc*this.N.pc-this.dc*this.N.rc;l.fa=this.dc*this.N.qc-this.ec*this.N.pc}l=this.Eb[1];k=a.rows[a.Da++];m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=l;k.Fa=c;k.Ka=0;k.Ha=-Infinity;k.Ga=Infinity;l=k.va;l.sa=this.N.yc;l.ta=this.N.zc;l.ua=this.N.Ac;l.xa=this.N.yc;l.ya=this.N.zc;l.za=this.N.Ac;l.aa=this.bc*this.N.Ac-this.cc*this.N.zc;l.ba=this.cc*this.N.yc-this.ac*this.N.Ac;l.ca=this.ac*this.N.zc-this.bc*this.N.yc;l.da=this.ec*this.N.Ac-this.fc*this.N.zc;l.ea=this.fc*this.N.yc-this.dc*this.N.Ac;l.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];l=a.rows[a.Da++];k=l.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;l.Fa=0;l.Ka=0;l.Ha=0;l.Ga=0;l.motorSpeed=0;l.tb=0;l.qa=c;l.Fa=f;l.Ka=0;l.Ha=-Infinity;l.Ga=Infinity;l=l.va;l.sa=this.N.Lc;l.ta=this.N.Mc;l.ua=this.N.Nc;l.xa=this.N.Lc;l.ya=this.N.Mc;l.za=this.N.Nc;l.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;l.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;l.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;l.da=this.ec*this.N.Nc-this.fc*this.N.Mc;l.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;l.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;if(0>=this.nl.frequency||!e)f=this.Eb[3],c=a.rows[a.Da++],l=c.va,l.sa=0,l.ta=0,l.ua=0,l.xa=0,l.ya=0,l.za=0,l.aa=0,l.ba=0,l.ca=0,l.da=0,l.ea=0,l.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.angle,this.ml,g,this.nl,b,e),l=c.va,l.aa=this.N.pc,l.ba=this.N.qc,l.ca=this.N.rc,l.da=this.N.pc,l.ea=this.N.qc,l.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=h;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;l=e.va;l.aa=this.N.yc;l.ba=this.N.zc;l.ca=this.N.Ac;l.da=this.N.yc;l.ea=this.N.zc;l.fa=this.N.Ac;h=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=h;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;l=a.va;l.aa=this.N.Lc;l.ba=this.N.Mc;l.ca=this.N.Nc;l.da=this.N.Lc;l.ea=this.N.Mc;l.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>pb*this.N.pc+xa*this.N.qc+lb*this.N.rc&&(this.angle=-this.angle);var Qa,ub,Bb;Qa=this.xf-this.uf;ub=this.yf-this.vf;Bb=this.zf-this.wf;this.Bg=Qa*this.N.pc+ub*this.N.qc+Bb*this.N.rc;this.Xf=Qa*this.N.yc+ub*this.N.zc+Bb*this.N.Ac;this.Yf=Qa*this.N.Lc+ub*this.N.Mc+Bb*this.N.Nc},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},po:function(){return this.ul},eo:function(){return this.nl},no:function(){return this.tl},bo:function(){return this.ml},Gl:function(){return this.angle},Jl:function(){return this.Bg}});Gb.prototype={Mg:function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var d=this.rigidBody1;a=this.localAnchor1;var c,f,h;c=e.x;f=e.y;h=e.z;c-=d.a.v;f-=d.a.A;h-=d.a.B;var l;b=d.a.o*c+d.a.i*f+d.a.l*h;l=d.a.f*c+d.a.m*f+d.a.g*h;d=d.a.h*c+d.a.j*f+d.a.s*h;a.x=b;a.y=l;a.z=d;b=this.rigidBody2;a=this.localAnchor2;l=e.x;d=e.y;f=e.z;l-=b.a.v;d-=b.a.A;f-=b.a.B;e=b.a.o*l+b.a.i*d+b.a.l*f;c=b.a.f*l+b.a.m*d+b.a.g*f;b=b.a.h*l+b.a.j*d+b.a.s*f;a.x=e;a.y=c;a.z=b}};wf.wa=Gb;wf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});Sb.wa=N;Sb.prototype=gb(N.prototype,{ud:function(a,b,e){var d,c=1/(this.C.qb+this.D.qb),f=this.Yg(this.wd,this.xd,this.yd),h=this.Yg(this.kd,this.ld,this.md),l=this.Yg(this.zd,this.Ad,this.Bd);if(0>=this.Rf[0].frequency||!e){d=this.Eb[0];var g=a.rows[a.Da++],k=g.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;g.Fa=0;g.Ka=0;g.Ha=0;g.Ga=0;g.motorSpeed=0;g.tb=0;g.qa=d;this.ak(g,this.translationX,this.qg[0],c,this.Rf[0],b,e);d=g.va;d.sa=this.fb;d.ta=this.gb;d.ua=this.hb;d.xa=this.fb;d.ya=this.gb;d.za=this.hb;d.aa=this.bc*this.hb-this.cc*this.gb;d.ba=this.cc*this.fb-this.ac*this.hb;d.ca=this.ac*this.gb-this.bc*this.fb;d.da=this.ec*this.hb-this.fc*this.gb;d.ea=this.fc*this.fb-this.dc*this.hb;d.fa=this.dc*this.gb-this.ec*this.fb}if(0>=this.Rf[1].frequency||!e)d=this.Eb[1],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.translationY,this.qg[1],c,this.Rf[1],b,e),d=g.va,d.sa=this.Xc,d.ta=this.Yc,d.ua=this.Zc,d.xa=this.Xc,d.ya=this.Yc,d.za=this.Zc,d.aa=this.bc*this.Zc-this.cc*this.Yc,d.ba=this.cc*this.Xc-this.ac*this.Zc,d.ca=this.ac*this.Yc-this.bc*this.Xc,d.da=this.ec*this.Zc-this.fc*this.Yc,d.ea=this.fc*this.Xc-this.dc*this.Zc,d.fa=this.dc*this.Yc-this.ec*this.Xc;if(0>=this.Rf[2].frequency||!e)d=this.Eb[2],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.cm,this.qg[2],c,this.Rf[2],b,e),d=g.va,d.sa=this.ve,d.ta=this.we,d.ua=this.xe,d.xa=this.ve,d.ya=this.we,d.za=this.xe,d.aa=this.bc*this.xe-this.cc*this.we,d.ba=this.cc*this.ve-this.ac*this.xe,d.ca=this.ac*this.we-this.bc*this.ve,d.da=this.ec*this.xe-this.fc*this.we,d.ea=this.fc*this.ve-this.dc*this.xe,d.fa=this.dc*this.we-this.ec*this.ve;this.dk||!(0>=this.Tg[0].frequency)&&e||(c=this.Eb[3],d=a.rows[a.Da++],g=d.va,g.sa=0,g.ta=0,g.ua=0,g.xa=0,g.ya=0,g.za=0,g.aa=0,g.ba=0,g.ca=0,g.da=0,g.ea=0,g.fa=0,d.Fa=0,d.Ka=0,d.Ha=0,d.Ga=0,d.motorSpeed=0,d.tb=0,d.qa=c,this.nh(d,this.Af,this.pg[0],f,this.Tg[0],b,e),d=d.va,d.aa=this.wd,d.ba=this.xd,d.ca=this.yd,d.da=this.wd,d.ea=this.xd,d.fa=this.yd);this.ek||!(0>=this.Tg[1].frequency)&&e||(f=this.Eb[4],c=a.rows[a.Da++],d=c.va,d.sa=0,d.ta=0,d.ua=0,d.xa=0,d.ya=0,d.za=0,d.aa=0,d.ba=0,d.ca=0,d.da=0,d.ea=0,d.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.qh,this.pg[1],h,this.Tg[1],b,e),d=c.va,d.aa=this.kd,d.ba=this.ld,d.ca=this.md,d.da=this.kd,d.ea=this.ld,d.fa=this.md);this.fk||!(0>=this.Tg[2].frequency)&&e||(h=this.Eb[5],a=a.rows[a.Da++],f=a.va,f.sa=0,f.ta=0,f.ua=0,f.xa=0,f.ya=0,f.za=0,f.aa=0,f.ba=0,f.ca=0,f.da=0,f.ea=0,f.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=h,this.nh(a,this.Bf,this.pg[2],l,this.Tg[2],b,e),d=a.va,d.aa=this.zd,d.ba=this.Ad,d.ca=this.Bd,d.da=this.zd,d.ea=this.Ad,d.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;a=this.xf-this.uf;b=this.yf-this.vf;e=this.zf-this.wf;this.translationX=a*this.fb+b*this.gb+e*this.hb;this.translationY=a*this.Xc+b*this.Yc+e*this.Zc;this.cm=a*this.ve+b*this.we+e*this.xe},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Un:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},Vn:function(){var a=new n;a.x=this.kd;a.y=this.ld;a.z=this.md;return a},Wn:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},qo:function(){return this.Rf.slice(0)},fo:function(){return this.Rf.slice(0)},oo:function(){return this.qg.slice(0)},co:function(){return this.pg.slice(0)},Tn:function(){return new n(this.Af,this.qh,this.Bf)},ro:function(){return new n(this.translationX,this.translationY,this.cm)}});Lg.wa=Gb;Lg.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);var f=a.a;b=b.a;var h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B;h=d.e00;l=d.e01;g=d.e02;k=d.e10;m=d.e11;p=d.e12;r=d.e20;q=d.e21;t=d.e22;A=c.e00;n=c.e01;u=c.e02;z=c.e10;x=c.e11;D=c.e12;F=c.e20;y=c.e21;B=c.e22;var E,K;c=f.o*h+f.i*k+f.l*r;d=f.o*l+f.i*m+f.l*q;a=f.o*g+f.i*p+f.l*t;e=f.f*h+f.m*k+f.g*r;E=f.f*l+f.m*m+f.g*q;K=f.f*g+f.m*p+f.g*t;h=f.h*h+f.j*k+f.s*r;l=f.h*l+f.j*m+f.s*q;k=f.h*g+f.j*p+f.s*t;f=b.o*A+b.i*z+b.l*F;g=b.o*n+b.i*x+b.l*y;p=b.o*u+b.i*D+b.l*B;m=b.f*A+b.m*z+b.g*F;q=b.f*n+b.m*x+b.g*y;t=b.f*u+b.m*D+b.g*B;A=b.h*A+b.j*z+b.s*F;n=b.h*n+b.j*x+b.s*y;b=b.h*u+b.j*D+b.s*B;u=this.localBasis1;u.e00=c;u.e01=d;u.e02=a;u.e10=e;u.e11=E;u.e12=K;u.e20=h;u.e21=l;u.e22=k;c=this.localBasis2;c.e00=f;c.e01=g;c.e02=p;c.e10=m;c.e11=q;c.e12=t;c.e20=A;c.e21=n;c.e22=b;return this}});qc.prototype={wa:function(){return this.gl},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};Jb.wa=N;Jb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Jh*d,l=this.Re*d,d=this.Se*d;if(0>=this.Pe.frequency||!e){var g=this.Eb[0],k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=g;this.ak(k,this.Bg,this.fi,1/(this.C.qb+this.D.qb),this.Pe,b,e);b=k.va;b.sa=this.N.pc;b.ta=this.N.qc;b.ua=this.N.rc;b.xa=this.N.pc;b.ya=this.N.qc;b.za=this.N.rc;b.aa=this.bc*this.N.rc-this.cc*this.N.qc;b.ba=this.cc*this.N.pc-this.ac*this.N.rc;b.ca=this.ac*this.N.qc-this.bc*this.N.pc;b.da=this.ec*this.N.rc-this.fc*this.N.qc;b.ea=this.fc*this.N.pc-this.dc*this.N.rc;b.fa=this.dc*this.N.qc-this.ec*this.N.pc}b=this.Eb[1];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=c;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;b=e.va;b.sa=this.N.yc;b.ta=this.N.zc;b.ua=this.N.Ac;b.xa=this.N.yc;b.ya=this.N.zc;b.za=this.N.Ac;b.aa=this.bc*this.N.Ac-this.cc*this.N.zc;b.ba=this.cc*this.N.yc-this.ac*this.N.Ac;b.ca=this.ac*this.N.zc-this.bc*this.N.yc;b.da=this.ec*this.N.Ac-this.fc*this.N.zc;b.ea=this.fc*this.N.yc-this.dc*this.N.Ac;b.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];b=a.rows[a.Da++];e=b.va;e.sa=0;e.ta=0;e.ua=0;e.xa=0;e.ya=0;e.za=0;e.aa=0;e.ba=0;e.ca=0;e.da=0;e.ea=0;e.fa=0;b.Fa=0;b.Ka=0;b.Ha=0;b.Ga=0;b.motorSpeed=0;b.tb=0;b.qa=c;b.Fa=f;b.Ka=0;b.Ha=-Infinity;b.Ga=Infinity;b=b.va;b.sa=this.N.Lc;b.ta=this.N.Mc;b.ua=this.N.Nc;b.xa=this.N.Lc;b.ya=this.N.Mc;b.za=this.N.Nc;b.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;b.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;b.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;b.da=this.ec*this.N.Nc-this.fc*this.N.Mc;b.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;b.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;f=this.Eb[3];c=a.rows[a.Da++];b=c.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;c.Fa=0;c.Ka=0;c.Ha=0;c.Ga=0;c.motorSpeed=0;c.tb=0;c.qa=f;c.Fa=h;c.Ka=0;c.Ha=-Infinity;c.Ga=Infinity;b=c.va;b.aa=1;b.ba=0;b.ca=0;b.da=1;b.ea=0;b.fa=0;h=this.Eb[4];f=a.rows[a.Da++];c=f.va;c.sa=0;c.ta=0;c.ua=0;c.xa=0;c.ya=0;c.za=0;c.aa=0;c.ba=0;c.ca=0;c.da=0;c.ea=0;c.fa=0;f.Fa=0;f.Ka=0;f.Ha=0;f.Ga=0;f.motorSpeed=0;f.tb=0;f.qa=h;f.Fa=l;f.Ka=0;f.Ha=-Infinity;f.Ga=Infinity;b=f.va;b.aa=0;b.ba=1;b.ca=0;b.da=0;b.ea=1;b.fa=0;l=this.Eb[5];a=a.rows[a.Da++];h=a.va;h.sa=0;h.ta=0;h.ua=0;h.xa=0;h.ya=0;h.za=0;h.aa=0;h.ba=0;h.ca=0;h.da=0;h.ea=0;h.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;b=a.va;b.aa=0;b.ba=0;b.ca=1;b.da=0;b.ea=0;b.fa=1},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qbJb?Gb>gc?(Eb=Math.sqrt(Gb-Jb-gc+1),Sb=.5*Eb,Eb=.5/Eb,Tb=(Yb+Qb)*Eb,hc=(oc+Ob)*Eb,uc=(Rb-rc)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb):Jb>gc?(Eb=Math.sqrt(Jb-gc-Gb+1),Tb=.5*Eb,Eb=.5/Eb,Sb=(Yb+Qb)*Eb,hc=(rc+Rb)*Eb,uc=(oc-Ob)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb);var Zb=uc,bc=2*(-1>=Zb?3.14159265358979:1<=Zb?0:Math.acos(Zb));this.Jh=Sb;this.Re=Tb;this.Se=hc;var Wb=this.Jh*this.Jh+this.Re*this.Re+this.Se*this.Se;0=this.ql.frequency||!e)&&(h=this.Eb[3],p=a.rows[a.Da++],r=p.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,p.Fa=0,p.Ka=0,p.Ha=0,p.Ga=0,p.motorSpeed=0,p.tb=0,p.qa=h,this.nh(p,this.bk,this.Fl,x,this.ql,b,e),c=p.va,c.aa=this.Be,c.ba=this.Ce,c.ca=this.De,c.da=this.Be,c.ea=this.Ce,c.fa=this.De);if(0>=this.wl.frequency||!e)x=this.Eb[4],a=a.rows[a.Da++],h=a.va,h.sa=0,h.ta=0,h.ua=0,h.xa=0,h.ya=0,h.za=0,h.aa=0,h.ba=0,h.ca=0,h.da=0,h.ea=0,h.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=x,this.nh(a,this.Hj,this.vl,d,this.wl,b,e),c=a.va,c.aa=this.Ai,c.ba=this.Bi,c.ca=this.Ci,c.da=this.Ai,c.ea=this.Bi,c.fa=this.Ci},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f;a=this.fb;b=this.gb;e=this.hb;d=this.Ob;c=this.Pb;f=this.Qb;var h,l,g,k,m,p,r,q,t;h=this.fb;l=this.Xc;g=this.ve;k=this.gb;m=this.Yc;p=this.we;r=this.hb;q=this.Zc;t=this.xe;var A,n,u,z,x,D,F,y;D=a*d+b*c+e*f;-.999999999>D?(x=a*a,d=b*b,c=e*e,x=z?3.14159265358979:1<=z?0:Math.acos(z));z=A;y=u;u=a*this.se+x*this.te+D*this.ue;B=b*this.se+d*this.te+f*this.ue;A=e*this.se+c*this.te+F*this.ue;this.Hj=Math.atan2(this.ve*u+this.we*B+this.xe*A,this.Xc*u+this.Yc*B+this.Zc*A);this.Ai=this.fb+this.Ob;this.Bi=this.gb+this.Pb;this.Ci=this.hb+this.Qb;A=this.Ai*this.Ai+this.Bi*this.Bi+this.Ci*this.Ci;0=this.Pe.frequency||!e)h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.angle,this.fi,D,this.Pe,b,e),c=r.va,c.aa=this.N.pc,c.ba=this.N.qc,c.ca=this.N.rc,c.da=this.N.pc,c.ea=this.N.qc,c.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];D=e.va;D.sa=0;D.ta=0;D.ua=0;D.xa=0;D.ya=0;D.za=0;D.aa=0;D.ba=0;D.ca=0;D.da=0;D.ea=0;D.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=l;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;c=e.va;c.aa=this.N.yc;c.ba=this.N.zc;c.ca=this.N.Ac;c.da=this.N.yc;c.ea=this.N.zc;c.fa=this.N.Ac;l=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;c=a.va;c.aa=this.N.Lc;c.ba=this.N.Mc;c.ca=this.N.Nc;c.da=this.N.Lc;c.ea=this.N.Mc;c.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>Qa*this.N.pc+xa*this.N.qc+ub*this.N.rc&&(this.angle=-this.angle);this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},Qj:function(){return this.Pe},Il:function(){return this.fi},Gl:function(){return this.angle}});ff.wa=Gb;ff.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});$b.prototype={mh:function(a,b){this.lowerLimit=a;this.upperLimit=b;return this},wa:function(a,b){this.motorSpeed=a;this.motorTorque=b;return this},clone:function(){var a=new $b;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed=this.motorSpeed;a.motorTorque=this.motorTorque;return a}};se.wa=N;se.prototype=gb(N.prototype,{ud:function(a,b,e){if(!(0=this.ol.frequency)&&e||(h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.Af,this.hl,D,this.ol,b,e),c=r.va,c.aa=this.wd,c.ba=this.xd,c.ca=this.yd,c.da=this.wd,c.ea=this.xd,c.fa=this.yd);this.ek||(D=this.Eb[4],h=a.rows[a.Da++],r=h.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,h.Fa=0,h.Ka=0,h.Ha=0,h.Ga=0,h.motorSpeed=0,h.tb=0,h.qa=D,h.Fa=l,h.Ka=0,h.Ha=-Infinity,h.Ga=Infinity,c=h.va,c.aa=this.kd,c.ba=this.ld,c.ca=this.md,c.da=this.kd,c.ea=this.ld,c.fa=this.md);this.fk||!(0>=this.pl.frequency)&&e||(l=this.Eb[5],a=a.rows[a.Da++],D=a.va,D.sa=0,D.ta=0,D.ua=0,D.xa=0,D.ya=0,D.za=0,D.aa=0,D.ba=0,D.ca=0,D.da=0,D.ea=0,D.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=l,this.nh(a,this.Bf,this.il,d,this.pl,b,e),c=a.va,c.aa=this.zd,c.ba=this.Ad,c.ca=this.Bd,c.da=this.zd,c.ea=this.Ad,c.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Cf;a.y=this.Df;a.z=this.Ef},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.nd;a.y=this.od;a.z=this.pd;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.nd;a.y=this.od;a.z=this.pd},ho:function(){return this.ol},io:function(){return this.pl},$n:function(){return this.hl},ao:function(){return this.il},Rn:function(){return this.Af},Sn:function(){return this.Bf}});Kf.wa=Gb;Kf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);e=this.localAxis1;var f,h,l;f=d.x;h=d.y;l=d.z;var g;d=a.a.o*f+a.a.i*h+a.a.l*l;g=a.a.f*f+a.a.m*h+a.a.g*l;a=a.a.h*f+a.a.j*h+a.a.s*l;e.x=d;e.y=g;e.z=a;a=this.localAxis2;e=c.x;f=c.y;d=c.z;c=b.a.o*e+b.a.i*f+b.a.l*d;h=b.a.f*e+b.a.m*f+b.a.g*d;b=b.a.h*e+b.a.j*f+b.a.s*d;a.x=c;a.y=h;a.z=b;return this}});tj.prototype={Aa:function(a){this.ed=a.ed;for(var b=0,e=this.ed;bp?r.Ha:0q.Ga+F.directMlcpSolverEps){b=!1;break}c[r]=A-t}if(h)return!0;if(!b)return!1;h=0;for(g=this.ed;hp&&k>F.directMlcpSolverEps||0e.Ga;0==e.Ha&&0==e.Ga?(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=0,c.ed++,this.mi(a,b+1),this.lf.ed--):(e=this.lf,e.hh[e.Ae]=b,e.Ae++,this.mi(a,b+1),this.lf.Ae--,d&&(d=this.lf,d.Nh[d.ed]=b,d.Sh[d.ed]=-1,d.ed++,this.mi(a,b+1),this.lf.ed--),c&&(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=1,c.ed++,this.mi(a,b+1),this.lf.ed--))}}};Mi.prototype={};Wb.wa=Ob;Wb.prototype=gb(Ob.prototype,{Qh:function(a){this.ga.bd();this.ga.Sd(a,this.info);this.C=this.info.Ye;this.D=this.info.Ze;this.yi.Dl(this.info,this.Wb);a=this.$e;a.sf=0;var b=a.lf;b.ed=0;b.Ae=0;a.mi(this.info,0);a=this.em;for(var b=this.$e.sf,e=0,d=0,c=0,f=a.n;c=b)for(b=0,a=this.info.Da;bc.Ga&&(h=c.Ga);f.qa=h;0c&&(h=c),f.Dd=h):f.Dd=0;this.Wf[d]=f.qa+f.Dd}var b=this.Wf,e=a=!1,l,g,k,m,p,r,q,t,d=this.C.jb,f=this.C.kb,c=this.C.lb,h=this.D.jb;l=this.D.kb;g=this.D.lb;k=this.C.nb;m=this.C.ob;p=this.C.pb;r=this.D.nb;q=this.D.ob;t=this.D.pb;for(var A=0,n=this.info.Da;Al&&(h=l),c.Dd=h,c=h-f,this.Oj[d]=c,f=0;fna){var ta=na*na;La=.5*(1-.16666666666666666*ta+ta*ta*.008333333333333333);Ba=1-.5*ta+ta*ta*.041666666666666664}else La=Math.sin(na)/Aa,Ba=Math.cos(na);var S,ha,ea;S=N*La;ha=X*La;ea=pa*La;var da,M,T,w;da=S;M=ha;T=ea;w=Ba;var V,ia,Y,oa,ua=C.a.o,ca=C.a.m,Ma=C.a.s,va=ua+ca+Ma,Z;0ca?ua>Ma?(Z=Math.sqrt(ua-ca-Ma+1),V=.5*Z,Z=.5/Z,ia=(C.a.f+C.a.i)*Z,Y=(C.a.h+C.a.l)*Z,oa=(C.a.g-C.a.j)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z):ca>Ma?(Z=Math.sqrt(ca-Ma-ua+1),ia=.5*Z,Z=.5/Z,V=(C.a.f+C.a.i)*Z,Y=(C.a.j+C.a.g)*Z,oa=(C.a.h-C.a.l)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z);V=w*V+da*oa+M*Y-T*ia;ia=w*ia-da*Y+M*oa+T*V;Y=w*Y+da*ia-M*V+T*oa;oa=w*oa-da*V-M*ia-T*Y;var Pa=V*V+ia*ia+Y*Y+oa*oa;1E-32jb){var cb=jb*jb;lb=.5*(1-.16666666666666666*cb+cb*cb*.008333333333333333);ob=1-.5*cb+cb*cb*.041666666666666664}else lb=Math.sin(jb)/sb,ob=Math.cos(jb);var zb,Xa,tb;zb=Da*lb;Xa=qa*lb;tb=wa*lb;var v,W,U,db;v=zb;W=Xa;U=tb;db=ob;var Qa,Ra,Ha,rb,yb=G.a.o,Cb=G.a.m,la=G.a.s,ra=yb+Cb+la,ga;0Cb?yb>la?(ga=Math.sqrt(yb-Cb-la+1),Qa=.5*ga,ga=.5/ga,Ra=(G.a.f+G.a.i)*ga,Ha=(G.a.h+G.a.l)*ga,rb=(G.a.g-G.a.j)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga):Cb>la?(ga=Math.sqrt(Cb-la-yb+1),Ra=.5*ga,ga=.5/ga,Qa=(G.a.f+G.a.i)*ga,Ha=(G.a.j+G.a.g)*ga,rb=(G.a.h-G.a.l)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga);Qa=db*Qa+v*rb+W*Ha-U*Ra;Ra=db*Ra-v*Ha+W*rb+U*Qa;Ha=db*Ha+v*Ra-W*Qa+U*rb;rb=db*rb-v*Qa-W*Ra-U*Ha;var ma=Qa*Qa+Ra*Ra+Ha*Ha+rb*rb;1E-32n*n&&(n/=Math.sqrt(z),x.Kc*=n,x.Jc*=n)):(x.Kc=0,x.Jc=0);z=x.Kc-u;D=x.Jc-F;a+=t.Ql*z;b+=t.Rl*z;e+=t.Sl*z;a+=t.Kl*D;b+=t.Ll*D;e+=t.Ml*D;d+=t.Tl*-z;c+=t.Ul*-z;f+=t.Vl*-z;d+=t.Nl*-D;c+=t.Ol*-D;f+=t.Pl*-D;h+=t.Sj*z;l+=t.Tj*z;g+=t.Uj*z;h+=t.Ek*D;l+=t.Fk*D;g+=t.Gk*D;k+=t.Vj*-z;m+=t.Wj*-z;p+=t.Xj*-z;k+=t.Hk*-D;m+=t.Ik*-D;p+=t.Jk*-D}r=0;for(q=this.info.Da;rx.dd&&(x.dd=0),n=x.dd-u,a+=t.si*n,b+=t.ti*n,e+=t.ui*n,d+=t.vi*-n,c+=t.wi*-n,f+=t.xi*-n,h+=t.sg*n,l+=t.tg*n,g+=t.ug*n,k+=t.vg*-n,m+=t.wg*-n,p+=t.xg*-n;this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},jh:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,F;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;F=this.D.$;for(var D=0,I=this.info.Da;Dx.vb&&(x.vb=0);n=x.vb-u;a+=t.si*n;b+=t.ti*n;e+=t.ui*n;d+=t.vi*-n;c+=t.wi*-n;f+=t.xi*-n;h+=t.sg*n;l+=t.tg*n;g+=t.ug*n;k+=t.vg*-n;m+=t.wg*-n;p+=t.xg*-n}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,I;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;I=this.D.$;for(var D=0,J=this.info.Da;Dta.vb&&(ta.vb=0);ea=ta.vb-da;wa+=Ba.si*ea;Da+=Ba.ti*ea;qa+=Ba.ui*ea;Ca+=Ba.vi*-ea;ya+=Ba.wi*-ea;Ka+=Ba.xi*-ea;Ea+=Ba.sg*ea;O+=Ba.tg*ea;sa+=Ba.ug*ea;ba+=Ba.vg*-ea;za+=Ba.wg*-ea;Ta+=Ba.xg*-ea}var M=this.C;M.a.v+=wa;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ca;T.a.A+=ya;T.a.B+=Ka;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Qa=w.a.m,ja=w.a.s,Ga=fa+Qa+ja,P;0Qa?fa>ja?(P=Math.sqrt(fa-Qa-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Qa>ja?(P=Math.sqrt(Qa-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Fb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Fb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Fb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Hb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Gb=la*la+ra*ra+ga*ga+ma*ma;1E-32=b)for(b=0,a=this.info.Da;bx.tb&&(F.Dd=x.tb);z=F.Dd-I;u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z);u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z)}}r=0;for(q=this.info.Da;rx.Ga&&(F.qa=x.Ga),z=F.qa-I,u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z),u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z);this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},cj:function(a){for(var b,e,d,c,f,h,l=h=f=c=d=e=b=0,g=this.info.Da;lx.Ga&&(I.vb=x.Ga);u=I.vb-z;a+=n.Kd*u;b+=n.Ld*u;e+=n.Md*u;d+=n.Nd*-u;c+=n.Od*-u;f+=n.Pd*-u;h+=n.Ed*u;l+=n.Fd*u;g+=n.Gd*u;k+=n.Hd*-u;m+=n.Id*-u;p+=n.Jd*-u}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.ga.bd();this.ga.$c(this.info);this.C=this.info.Ye;this.D=this.info.Ze;var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,n,t,x,I,u,z,J;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;n=this.D.U;t=this.D.V;x=this.D.W;I=this.D.X;u=this.D.Y;z=this.D.Z;J=this.D.$;for(var D=0,N=this.info.Da;DLa.Ga&&(ta.vb=La.Ga);ea=ta.vb-da;Ca+=Ba.Kd*ea;Da+=Ba.Ld*ea;qa+=Ba.Md*ea;Ka+=Ba.Nd*-ea;ya+=Ba.Od*-ea;Qa+=Ba.Pd*-ea;Ea+=Ba.Ed*ea;O+=Ba.Fd*ea;sa+=Ba.Gd*ea;ba+=Ba.Hd*-ea;za+=Ba.Id*-ea;Ta+=Ba.Jd*-ea}var M=this.C;M.a.v+=Ca;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ka;T.a.A+=ya;T.a.B+=Qa;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Ua=w.a.m,ja=w.a.s,Ga=fa+Ua+ja,P;0Ua?fa>ja?(P=Math.sqrt(fa-Ua-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Ua>ja?(P=Math.sqrt(Ua-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Gb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Gb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Gb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Jb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Hb=la*la+ra*ra+ga*ga+ma*ma;1E-32F.maxTranslationPerStep*F.maxTranslationPerStep&&(h=F.maxTranslationPerStep/Math.sqrt(h),this.jb*=h,this.kb*=h,this.lb*=h,b*=h,e*=h,d*=h);l>F.maxRotationPerStep*F.maxRotationPerStep&&(l=F.maxRotationPerStep/Math.sqrt(l),this.nb*=l,this.ob*=l,this.pb*=l,c*=l,f*=l,a*=l);this.a.v+=b;this.a.A+=e;this.a.B+=d;b=Math.sqrt(c*c+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));c*=b;f*=b;a*=b;b=e;e=this.a.o;d=this.a.m;var l=this.a.s,h=e+d+l,g;0d?e>l?(g=Math.sqrt(e-d-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,d=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):d>l?(g=Math.sqrt(d-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,d=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+c*e+f*d-a*l;l=b*l-c*d+f*e+a*h;d=b*d+c*l-f*h+a*e;e=b*e-c*h-f*l-a*d;a=h*h+l*l+d*d+e*e;1E-32b?(b*=b,a=.5*(1-.16666666666666666*b+b*b*.008333333333333333),b=1-.5*b+b*b*.041666666666666664):(a=Math.sin(b)/a,b=Math.cos(b));d*=a;c*=a;f*=a;a=b;var h,l;b=this.a.o;e=this.a.m;l=this.a.s;h=b+e+l;var g;0e?b>l?(g=Math.sqrt(b-e-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,e=(this.a.h+this.a.l)*g,b=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g):e>l?(g=Math.sqrt(e-l-b+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,e=(this.a.j+this.a.g)*g,b=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g);h=a*h+d*b+c*e-f*l;l=a*l-d*e+c*b+f*h;e=a*e+d*l-c*h+f*b;b=a*b-d*h-c*l-f*e;c=h*h+l*l+e*e+b*b;1E-32d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},cn:function(a){var b,e;b=a.x;e=a.y;a=a.z;this.a.v+=b;this.a.A+=e;this.a.B+=a;b=this.ja;e=this.a;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;for(b=this.Gc;null!=b;){e=b.M;var d=this.ja;a=this.a;var c=b.ja,f=b.ha,h,l,g,k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=b.a;c=b.ha;f=a.o*c.o+a.f*c.i+a.h*c.l;h=a.o*c.f+a.f*c.m+a.h*c.g;l=a.o*c.h+a.f*c.j+a.h*c.s;g=a.i*c.o+a.m*c.i+a.j*c.l;k=a.i*c.f+a.m*c.m+a.j*c.g;m=a.i*c.h+a.m*c.j+a.j*c.s;p=a.l*c.o+a.g*c.i+a.s*c.l;n=a.l*c.f+a.g*c.m+a.s*c.g;q=a.l*c.h+a.g*c.j+a.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=a.o*c.v+a.f*c.A+a.h*c.B;h=a.i*c.v+a.m*c.A+a.j*c.B;c=a.l*c.v+a.g*c.A+a.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=a.v;d.A+=a.A;d.B+=a.B;b.Fb.Lb(b.u,b.ja);a=b.u.na;d=b.u.oa;c=b.u.pa;f=b.u.ka;h=b.u.la;l=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=ab.u.ka?f:b.u.ka;b.u.la=h>b.u.la?h:b.u.la;b.u.ma=l>b.u.ma?l:b.u.ma;null!=b.ub&&(a=b.a.v-b.ja.v,d=b.a.A-b.ja.A,c=b.a.B-b.ja.B,f=b.mc,f.x=a,f.y=d,f.z=c,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}this.Bb=!1;this.wb=0},Vm:function(){var a=new I;a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s;return a},Wm:function(a){a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s},Qo:function(a){this.a.o=a.e00;this.a.f=a.e01;this.a.h=a.e02;this.a.i=a.e10;this.a.m=a.e11;this.a.j=a.e12;this.a.l=a.e20;this.a.g=a.e21;this.a.s=a.e22;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},Ro:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;a=Math.sin(b);var c=Math.sin(e),f=Math.sin(d);b=Math.cos(b);e=Math.cos(e);d=Math.cos(d);this.a.o=e*d;this.a.f=-e*f;this.a.h=c;this.a.i=b*f+d*a*c;this.a.m=b*d-a*c*f;this.a.j=-e*a;this.a.l=a*f-b*d*c;this.a.g=d*a+b*c*f;this.a.s=b*e;var h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;c=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;f=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;e=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;b=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;c=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;f=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;e=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;b=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;c=this.a;a.v=c.v;a.A=c.A;a.B=c.B;a.o=c.o;a.f=c.f;a.h=c.h;a.i=c.i;a.m=c.m;a.j=c.j;a.l=c.l;a.g=c.g;a.s=c.s;for(a=this.Gc;null!=a;){c=a.M;e=this.ja;f=this.a;d=a.ja;b=a.ha;var k,m,p,n,q,t;h=e.o*b.o+e.f*b.i+e.h*b.l;l=e.o*b.f+e.f*b.m+e.h*b.g;g=e.o*b.h+e.f*b.j+e.h*b.s;k=e.i*b.o+e.m*b.i+e.j*b.l;m=e.i*b.f+e.m*b.m+e.j*b.g;p=e.i*b.h+e.m*b.j+e.j*b.s;n=e.l*b.o+e.g*b.i+e.s*b.l;q=e.l*b.f+e.g*b.m+e.s*b.g;t=e.l*b.h+e.g*b.j+e.s*b.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=e.o*b.v+e.f*b.A+e.h*b.B;l=e.i*b.v+e.m*b.A+e.j*b.B;b=e.l*b.v+e.g*b.A+e.s*b.B;d.v=h;d.A=l;d.B=b;d.v+=e.v;d.A+=e.A;d.B+=e.B;e=a.a;d=a.ha;b=f.o*d.o+f.f*d.i+f.h*d.l;h=f.o*d.f+f.f*d.m+f.h*d.g;l=f.o*d.h+f.f*d.j+f.h*d.s;g=f.i*d.o+f.m*d.i+f.j*d.l;k=f.i*d.f+f.m*d.m+f.j*d.g;m=f.i*d.h+f.m*d.j+f.j*d.s;p=f.l*d.o+f.g*d.i+f.s*d.l;n=f.l*d.f+f.g*d.m+f.s*d.g;q=f.l*d.h+f.g*d.j+f.s*d.s;e.o=b;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=p;e.g=n;e.s=q;b=f.o*d.v+f.f*d.A+f.h*d.B;h=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;e.v=b;e.A=h;e.B=d;e.v+=f.v;e.A+=f.A;e.B+=f.B;a.Fb.Lb(a.u,a.ja);f=a.u.na;e=a.u.oa;d=a.u.pa;b=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=fa.u.ka?b:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(f=a.a.v-a.ja.v,e=a.a.A-a.ja.A,d=a.a.B-a.ja.B,b=a.mc,b.x=f,b.y=e,b.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=c}this.Bb=!1;this.wb=0},Ho:function(a){var b,e,d,c,f,h,l,g,k;b=a.e00;e=a.e01;d=a.e02;c=a.e10;f=a.e11;h=a.e12;l=a.e20;g=a.e21;k=a.e22;var m;a=b*this.a.o+e*this.a.i+d*this.a.l;m=b*this.a.f+e*this.a.m+d*this.a.g;b=b*this.a.h+e*this.a.j+d*this.a.s;e=c*this.a.o+f*this.a.i+h*this.a.l;d=c*this.a.f+f*this.a.m+h*this.a.g;c=c*this.a.h+f*this.a.j+h*this.a.s;f=l*this.a.o+g*this.a.i+k*this.a.l;h=l*this.a.f+g*this.a.m+k*this.a.g;l=l*this.a.h+g*this.a.j+k*this.a.s;this.a.o=a;this.a.f=m;this.a.h=b;this.a.i=e;this.a.m=d;this.a.j=c;this.a.l=f;this.a.g=h;this.a.s=l;l=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;a=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;m=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;k=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;c=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;f=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;h=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;l=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;a=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;m=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;k=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;c=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;f=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;h=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;l=this.ja;g=this.a;l.v=g.v;l.A=g.A;l.B=g.B;l.o=g.o;l.f=g.f;l.h=g.h;l.i=g.i;l.m=g.m;l.j=g.j;l.l=g.l;l.g=g.g;l.s=g.s;for(l=this.Gc;null!=l;){g=l.M;m=this.ja;a=this.a;k=l.ja;c=l.ha;var p,n,q,t;f=m.o*c.o+m.f*c.i+m.h*c.l;h=m.o*c.f+m.f*c.m+m.h*c.g;b=m.o*c.h+m.f*c.j+m.h*c.s;e=m.i*c.o+m.m*c.i+m.j*c.l;d=m.i*c.f+m.m*c.m+m.j*c.g;p=m.i*c.h+m.m*c.j+m.j*c.s;n=m.l*c.o+m.g*c.i+m.s*c.l;q=m.l*c.f+m.g*c.m+m.s*c.g;t=m.l*c.h+m.g*c.j+m.s*c.s;k.o=f;k.f=h;k.h=b;k.i=e;k.m=d;k.j=p;k.l=n;k.g=q;k.s=t;f=m.o*c.v+m.f*c.A+m.h*c.B;h=m.i*c.v+m.m*c.A+m.j*c.B;c=m.l*c.v+m.g*c.A+m.s*c.B;k.v=f;k.A=h;k.B=c;k.v+=m.v;k.A+=m.A;k.B+=m.B;m=l.a;k=l.ha;c=a.o*k.o+a.f*k.i+a.h*k.l;f=a.o*k.f+a.f*k.m+a.h*k.g;h=a.o*k.h+a.f*k.j+a.h*k.s;b=a.i*k.o+a.m*k.i+a.j*k.l;e=a.i*k.f+a.m*k.m+a.j*k.g;d=a.i*k.h+a.m*k.j+a.j*k.s;p=a.l*k.o+a.g*k.i+a.s*k.l;n=a.l*k.f+a.g*k.m+a.s*k.g;q=a.l*k.h+a.g*k.j+a.s*k.s;m.o=c;m.f=f;m.h=h;m.i=b;m.m=e;m.j=d;m.l=p;m.g=n;m.s=q;c=a.o*k.v+a.f*k.A+a.h*k.B;f=a.i*k.v+a.m*k.A+a.j*k.B;k=a.l*k.v+a.g*k.A+a.s*k.B;m.v=c;m.A=f;m.B=k;m.v+=a.v;m.A+=a.A;m.B+=a.B;l.Fb.Lb(l.u,l.ja);a=l.u.na;m=l.u.oa;k=l.u.pa;c=l.u.ka;f=l.u.la;h=l.u.ma;l.Fb.Lb(l.u,l.a);l.u.na=al.u.ka?c:l.u.ka;l.u.la=f>l.u.la?f:l.u.la;l.u.ma=h>l.u.ma?h:l.u.ma;null!=l.ub&&(a=l.a.v-l.ja.v,m=l.a.A-l.ja.A,k=l.a.B-l.ja.B,c=l.mc,c.x=a,c.y=m,c.z=k,l.Vb.jc.hc.Qd(l.ub,l.u,l.mc));l=g}this.Bb=!1;this.wb=0},Mo:function(a){var b,e,d,c,f,h,l;b=a.x;e=a.y;a=a.z;h=Math.sin(b);var g=Math.sin(e),k=Math.sin(a),m=Math.cos(b);l=Math.cos(e);var p=Math.cos(a);d=l*p;c=-l*k;a=m*k+p*h*g;b=m*p-h*g*k;f=-l*h;e=h*k-m*p*g;h=p*h+m*g*k;l*=m;k=d*this.a.o+c*this.a.i+g*this.a.l;m=d*this.a.f+c*this.a.m+g*this.a.g;g=d*this.a.h+c*this.a.j+g*this.a.s;d=a*this.a.o+b*this.a.i+f*this.a.l;c=a*this.a.f+b*this.a.m+f*this.a.g;a=a*this.a.h+b*this.a.j+f*this.a.s;b=e*this.a.o+h*this.a.i+l*this.a.l;f=e*this.a.f+h*this.a.m+l*this.a.g;e=e*this.a.h+h*this.a.j+l*this.a.s;this.a.o=k;this.a.f=m;this.a.h=g;this.a.i=d;this.a.m=c;this.a.j=a;this.a.l=b;this.a.g=f;this.a.s=e;e=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;a=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;b=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;f=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;h=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;g=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;k=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;m=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;l=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;e=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;a=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;b=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;f=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;h=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;g=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;k=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;m=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;l=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;e=this.ja;a=this.a;e.v=a.v;e.A=a.A;e.B=a.B;e.o=a.o;e.f=a.f;e.h=a.h;e.i=a.i;e.m=a.m;e.j=a.j;e.l=a.l;e.g=a.g;e.s=a.s;for(e=this.Gc;null!=e;){a=e.M;f=this.ja;b=this.a;h=e.ja;var g=e.ha,n,q,t,k=f.o*g.o+f.f*g.i+f.h*g.l,m=f.o*g.f+f.f*g.m+f.h*g.g;l=f.o*g.h+f.f*g.j+f.h*g.s;d=f.i*g.o+f.m*g.i+f.j*g.l;c=f.i*g.f+f.m*g.m+f.j*g.g;p=f.i*g.h+f.m*g.j+f.j*g.s;n=f.l*g.o+f.g*g.i+f.s*g.l;q=f.l*g.f+f.g*g.m+f.s*g.g;t=f.l*g.h+f.g*g.j+f.s*g.s;h.o=k;h.f=m;h.h=l;h.i=d;h.m=c;h.j=p;h.l=n;h.g=q;h.s=t;k=f.o*g.v+f.f*g.A+f.h*g.B;m=f.i*g.v+f.m*g.A+f.j*g.B;g=f.l*g.v+f.g*g.A+f.s*g.B;h.v=k;h.A=m;h.B=g;h.v+=f.v;h.A+=f.A;h.B+=f.B;f=e.a;h=e.ha;g=b.o*h.o+b.f*h.i+b.h*h.l;k=b.o*h.f+b.f*h.m+b.h*h.g;m=b.o*h.h+b.f*h.j+b.h*h.s;l=b.i*h.o+b.m*h.i+b.j*h.l;d=b.i*h.f+b.m*h.m+b.j*h.g;c=b.i*h.h+b.m*h.j+b.j*h.s;p=b.l*h.o+b.g*h.i+b.s*h.l;n=b.l*h.f+b.g*h.m+b.s*h.g;q=b.l*h.h+b.g*h.j+b.s*h.s;f.o=g;f.f=k;f.h=m;f.i=l;f.m=d;f.j=c;f.l=p;f.g=n;f.s=q;g=b.o*h.v+b.f*h.A+b.h*h.B;k=b.i*h.v+b.m*h.A+b.j*h.B;h=b.l*h.v+b.g*h.A+b.s*h.B;f.v=g;f.A=k;f.B=h;f.v+=b.v;f.A+=b.A;f.B+=b.B;e.Fb.Lb(e.u,e.ja);b=e.u.na;f=e.u.oa;h=e.u.pa;g=e.u.ka;k=e.u.la;m=e.u.ma;e.Fb.Lb(e.u,e.a);e.u.na=be.u.ka?g:e.u.ka;e.u.la=k>e.u.la?k:e.u.la;e.u.ma=m>e.u.ma?m:e.u.ma;null!=e.ub&&(b=e.a.v-e.ja.v,f=e.a.A-e.ja.A,h=e.a.B-e.ja.B,g=e.mc,g.x=b,g.y=f,g.z=h,e.Vb.jc.hc.Qd(e.ub,e.u,e.mc));e=a}this.Bb=!1;this.wb=0},Mm:function(){var a=new wa,b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},Nm:function(a){var b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},No:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.a.o=1-g-d;this.a.f=k-c;this.a.h=b+h;this.a.i=k+c;this.a.m=1-a-d;this.a.j=e-f;this.a.l=b-h;this.a.g=e+f;this.a.s=1-a-g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;l=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;k=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;e=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;c=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;l=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;k=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;e=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;g=this.a;a.v=g.v;a.A=g.A;a.B=g.B;a.o=g.o;a.f=g.f;a.h=g.h;a.i=g.i;a.m=g.m;a.j=g.j;a.l=g.l;a.g=g.g;a.s=g.s;for(a=this.Gc;null!=a;){g=a.M;l=this.ja;c=this.a;d=a.ja;var k=a.ha,m,p,n,q,t,h=l.o*k.o+l.f*k.i+l.h*k.l;e=l.o*k.f+l.f*k.m+l.h*k.g;b=l.o*k.h+l.f*k.j+l.h*k.s;f=l.i*k.o+l.m*k.i+l.j*k.l;m=l.i*k.f+l.m*k.m+l.j*k.g;p=l.i*k.h+l.m*k.j+l.j*k.s;n=l.l*k.o+l.g*k.i+l.s*k.l;q=l.l*k.f+l.g*k.m+l.s*k.g;t=l.l*k.h+l.g*k.j+l.s*k.s;d.o=h;d.f=e;d.h=b;d.i=f;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=l.o*k.v+l.f*k.A+l.h*k.B;e=l.i*k.v+l.m*k.A+l.j*k.B;k=l.l*k.v+l.g*k.A+l.s*k.B;d.v=h;d.A=e;d.B=k;d.v+=l.v;d.A+=l.A;d.B+=l.B;l=a.a;d=a.ha;k=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;e=c.o*d.h+c.f*d.j+c.h*d.s;b=c.i*d.o+c.m*d.i+c.j*d.l;f=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;p=c.l*d.o+c.g*d.i+c.s*d.l;n=c.l*d.f+c.g*d.m+c.s*d.g;q=c.l*d.h+c.g*d.j+c.s*d.s;l.o=k;l.f=h;l.h=e;l.i=b;l.m=f;l.j=m;l.l=p;l.g=n;l.s=q;k=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;l.v=k;l.A=h;l.B=d;l.v+=c.v;l.A+=c.A;l.B+=c.B;a.Fb.Lb(a.u,a.ja);c=a.u.na;l=a.u.oa;d=a.u.pa;k=a.u.ka;h=a.u.la;e=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ca.u.ka?k:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=e>a.u.ma?e:a.u.ma;null!=a.ub&&(c=a.a.v-a.ja.v,l=a.a.A-a.ja.A,d=a.a.B-a.ja.B,k=a.mc,k.x=c,k.y=l,k.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=g}this.Bb=!1;this.wb=0},Xm:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Ym:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},So:function(a){this.a.v=a.v;this.a.A=a.A;this.a.B=a.B;this.a.o=a.o;this.a.f=a.f;this.a.h=a.h;this.a.i=a.i;this.a.m=a.m;this.a.j=a.j;this.a.l=a.l;this.a.g=a.g;this.a.s=a.s;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},ph:function(){return this.Lf},cf:function(){var a=new I;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae;return a},gg:function(a){a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},Di:function(){var a=new fj;a.mass=this.Lf;var b=a.localInertia;b.e00=this.Td;b.e01=this.Ud;b.e02=this.Vd;b.e10=this.Wd;b.e11=this.Xd;b.e12=this.Yd;b.e20=this.Zd;b.e21=this.$d;b.e22=this.ae;return a},Ei:function(a){a.mass=this.Lf;a=a.localInertia;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},ln:function(a){this.Lf=a.mass;a=a.localInertia;this.Td=a.e00;this.Ud=a.e01;this.Vd=a.e02;this.Wd=a.e10;this.Xd=a.e11;this.Yd=a.e12;this.Zd=a.e20;this.$d=a.e21;this.ae=a.e22;if(0d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},dn:function(a){var b=a.ia,e=a.M;null!=b&&(b.M=e);null!=e&&(e.ia=b);a==this.Gc&&(this.Gc=this.Gc.M);a==this.Yi&&(this.Yi=this.Yi.ia);a.M=null;a.ia=null;this.Rg--;a.Vb=null;if(null!=this.jc){b=this.jc;b.hc.oi(a.ub);a.ub=null;a.Ic=-1;for(var d=a.Vb.Mb;null!=d;){var e=d.M,c=d.me;if(c.Ec==a||c.Fc==a){d=d.ad;d.Bb=!1;d.wb=0;var d=b.Hi,f=c.ia,h=c.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c==d.je&&(d.je=d.je.M);c==d.Le&&(d.Le=d.Le.ia);c.M=null;c.ia=null;f=c.rb.ia;h=c.rb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.rb==c.C.Mb&&(c.C.Mb=c.C.Mb.M);c.rb==c.C.ic&&(c.C.ic=c.C.ic.ia);c.rb.M=null;c.rb.ia=null;f=c.sb.ia;h=c.sb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.sb==c.D.Mb&&(c.D.Mb=c.D.Mb.M);c.sb==c.D.ic&&(c.D.ic=c.D.ic.ia);c.sb.M=null;c.sb.ia=null;c.C.Ne--;c.D.Ne--;c.rb.ad=null;c.sb.ad=null;c.rb.me=null;c.sb.me=null;c.Ec=null;c.Fc=null;c.C=null;c.D=null;c.Hh=!1;c.pj.df();c.Ia.df();c.$h=null;f=c.ef;f.Ec=null;f.Fc=null;f.C=null;f.D=null;f.Ej=null;f.Fj=null;c.M=d.Cg;d.Cg=c;d.Ui--}d=e}b.Rg--}this.ck();for(a=this.Gc;null!=a;){var b=a.M,c=this.ja,e=this.a,d=a.ja,f=a.ha,l,g,k,m,n,r,q,t,h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;c=a.a;d=a.ha;f=e.o*d.o+e.f*d.i+e.h*d.l;h=e.o*d.f+e.f*d.m+e.h*d.g;l=e.o*d.h+e.f*d.j+e.h*d.s;g=e.i*d.o+e.m*d.i+e.j*d.l;k=e.i*d.f+e.m*d.m+e.j*d.g;m=e.i*d.h+e.m*d.j+e.j*d.s;n=e.l*d.o+e.g*d.i+e.s*d.l;r=e.l*d.f+e.g*d.m+e.s*d.g;q=e.l*d.h+e.g*d.j+e.s*d.s;c.o=f;c.f=h;c.h=l;c.i=g;c.m=k;c.j=m;c.l=n;c.g=r;c.s=q;f=e.o*d.v+e.f*d.A+e.h*d.B;h=e.i*d.v+e.m*d.A+e.j*d.B;d=e.l*d.v+e.g*d.A+e.s*d.B;c.v=f;c.A=h;c.B=d;c.v+=e.v;c.A+=e.A;c.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;c=a.u.oa;d=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,c=a.a.A-a.ja.A,d=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=c,f.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},Eo:function(){return this.Jb},nn:function(a){this.Jb=a;this.ck()},pn:function(){this.Bb=!1;this.wb=0},on:function(){this.Bb=!0;this.wb=0},Dm:function(){return this.Bb},tm:function(){return this.wb},gn:function(a){this.Tk=a;this.Bb=!1;this.wb=0},Je:function(){return this.sk},jn:function(a){this.sk=a},Vc:function(){return this.hk},en:function(a){this.hk=a},Um:function(){return this.ia},Im:function(){return this.M}};Ka.prototype={wc:function(){return this.pk},Ke:function(a){this.pk=a},Uc:function(){return this.Ak},cf:function(a){this.Ak=a},Dc:function(){var a=this.ha,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Hc:function(a){var b=this.ha;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},ie:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Fe:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},bf:function(a){var b=this.ha;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;if(null!=this.Vb)for(a=this.Vb,a.ck(),b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}},lc:function(){return this.Vk},Je:function(a){this.Vk=a;if(null!=this.Vb){a=this.Vb;a.ck();for(var b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}}},wa:function(){return this.u.clone()},mb:function(a){a.qe(this.u)},xc:function(){return this.Fb},Vc:function(){return this.Vb},Cb:function(){return this.kk},Ge:function(a){this.kk=a},Kb:function(){return this.lk},He:function(a){this.lk=a},kc:function(){return this.im},Ie:function(a){this.im=a},vd:function(){return this.ia},Wc:function(){return this.M}};pi.gg=1;pi.hg=2;pi.BRUTE_FORCE=1;pi.BVH=2;bc.Pm=0;bc.cf=1;bc.Ei=2;bc.jg=3;bc.ig=4;bc.kg=5;bc.Di=0;bc.ph=5;bc.SPHERE=0;bc.BOX=1;bc.CYLINDER=2;bc.CONE=3;bc.CAPSULE=4;bc.CONVEX_HULL=5;ni.Ie=1;Ee.Kb=0;n.numCreations=0;F.defaultFriction=.2;F.defaultRestitution=.2;F.defaultDensity=1;F.defaultCollisionGroup=1;F.defaultCollisionMask=1;F.maxTranslationPerStep=20;F.maxRotationPerStep=3.14159265358979;F.bvhProxyPadding=.1;F.bvhIncrementalCollisionThreshold=.45;F.defaultGJKMargin=.05;F.enableGJKCaching=!0;F.maxEPAVertices=128;F.maxEPAPolyhedronFaces=128;F.contactEnableBounceThreshold=.5;F.velocityBaumgarte=.2;F.positionSplitImpulseBaumgarte=.4;F.positionNgsBaumgarte=1;F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;F.defaultContactPositionCorrectionAlgorithm=0;F.alternativeContactPositionCorrectionAlgorithm=1;F.contactPersistenceThreshold=.05;F.maxManifoldPoints=4;F.defaultJointConstraintSolverType=0;F.defaultJointPositionCorrectionAlgorithm=0;F.jointWarmStartingFactorForBaungarte=.8;F.jointWarmStartingFactor=.95;F.minSpringDamperDampingRatio=1E-6;F.minRagdollMaxSwingAngle=1E-6;F.maxJacobianRows=6;F.directMlcpSolverEps=1E-9;F.islandInitialRigidBodyArraySize=128;F.islandInitialConstraintArraySize=128;F.sleepingVelocityThreshold=.2;F.sleepingAngularVelocityThreshold=.5;F.sleepingTimeThreshold=1;F.disableSleeping=!1;F.linearSlop=.005;F.angularSlop=.017453292519943278;lb.mb=new lb;dc.Xm=0;dc.Bm=1;dc.Am=2;dc.um=257;dc.tm=258;dc.sm=259;dc.SUCCEEDED=0;dc.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;dc.GJK_DID_NOT_CONVERGE=2;dc.EPA_FAILED_TO_INIT=257;dc.EPA_FAILED_TO_ADD_VERTEX=258;dc.EPA_DID_NOT_CONVERGE=259;I.numCreations=0;J.numCreations=0;pa.POSITIVE_INFINITY=Infinity;pa.NEGATIVE_INFINITY=-Infinity;pa.PI=3.14159265358979;pa.TWO_PI=6.28318530717958;pa.HALF_PI=1.570796326794895;pa.TO_RADIANS=.017453292519943278;pa.TO_DEGREES=57.29577951308238;wa.numCreations=0;Mg.Je=8;Mg.Ke=4;Mg.He=8;Ce.broadPhaseCollisionTime=0;Ce.narrowPhaseCollisionTime=0;Ce.dynamicsTime=0;Ce.totalTime=0;jc.bf=0;jc.Vm=1;jc.Jm=2;jc.BAUMGARTE=0;jc.SPLIT_IMPULSE=1;jc.NGS=2;gf.Ge=1;gf.Fe=2;Mb.Um=0;Mb.Om=1;Mb.Fi=2;Mb.Mm=3;Mb.Ym=4;Mb.Nm=5;Mb.ym=6;Mb.SPHERICAL=0;Mb.REVOLUTE=1;Mb.CYLINDRICAL=2;Mb.PRISMATIC=3;Mb.UNIVERSAL=4;Mb.RAGDOLL=5;Mb.GENERIC=6;vf.Dm=0;vf.gk=1;vf.ITERATIVE=0;vf.DIRECT=1;Qe.fm=0;Qe.Wm=1;Qe.Im=2;Qe.DYNAMIC=0;Qe.STATIC=1;Qe.KINEMATIC=2;Ij.lc()})({}); diff --git a/build-doc.hxml b/build-doc.hxml index 82ca62f..5cf9dab 100644 --- a/build-doc.hxml +++ b/build-doc.hxml @@ -4,4 +4,4 @@ -main export.Export --interp -xml docs/doc.xml --cmd haxelib run dox -i docs/doc.xml -o docs -in "oimo.(collision|common|dynamics)" -ex "oimo.dynamics.constraint.(info|solver.common)" --title "OimoPhysics API documentation" -D website https://github.com/saharan/OimoPhysics -D source-path https://github.com/saharan/OimoPhysics/tree/master/src/ -D description "OimoPhysics API Documentation" -D version 1.2.1 +-cmd haxelib run dox -i docs/doc.xml -o docs -in "oimo.(collision|common|dynamics)" -ex "oimo.dynamics.constraint.(info|solver.common)" --title "OimoPhysics API documentation" -D website https://github.com/saharan/OimoPhysics -D source-path https://github.com/saharan/OimoPhysics/tree/master/src/ -D description "OimoPhysics API Documentation" -D version 1.2.2 diff --git a/docs/404.html b/docs/404.html index f25abc3..e7c2afd 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -File not found - OimoPhysics API documentation

404 Page not found

Page not found, sorry.

\ No newline at end of file +File not found - OimoPhysics API documentation

404 Page not found

Page not found, sorry.

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index db9a0b5..d672f20 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

top level version 1.2.1

OimoPhysics API Documentation

oimo
\ No newline at end of file +

top level version 1.2.2

OimoPhysics API Documentation

oimo
\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhase.html b/docs/oimo/collision/broadphase/BroadPhase.html index 660d5af..ec9ed1b 100644 --- a/docs/oimo/collision/broadphase/BroadPhase.html +++ b/docs/oimo/collision/broadphase/BroadPhase.html @@ -19,4 +19,4 @@ than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

moveProxy (proxy:Proxy, aabb:Aabb, displacement:Vec3):Void

Moves the proxy proxy to the axis-aligned bounding box aabb. displacement is the difference between current and previous center of the AABB. This is used for predicting movement of the proxy.

rayCast (begin:Vec3, end:Vec3, callback:BroadPhaseProxyCallback):Void

Performs a ray casting. callback.process is called for all proxies the line segment -from begin to end intersects.

\ No newline at end of file +from begin to end intersects.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html index cadf449..c1ffe6b 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html +++ b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

A callback class for queries in a broad phase.

Constructor

new ()

Default constructor.

Methods

process (proxy:Proxy):Void

This is called every time a broad phase algorithm reports a proxy proxy.

\ No newline at end of file +

A callback class for queries in a broad phase.

Constructor

new ()

Default constructor.

Methods

process (proxy:Proxy):Void

This is called every time a broad phase algorithm reports a proxy proxy.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseType.html b/docs/oimo/collision/broadphase/BroadPhaseType.html index ffc7452..1fd9410 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseType.html +++ b/docs/oimo/collision/broadphase/BroadPhaseType.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

Types of broad-phase algorithms.

Static variables

@:value(_BRUTE_FORCE)staticread onlyBRUTE_FORCE:Int = _BRUTE_FORCE

The brute force algorithm searches all the possible pairs of the proxies every time. -This is very slow and so users should not choose this algorithm without exceptional reasons.

@:value(_BVH)staticread onlyBVH:Int = _BVH

The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

\ No newline at end of file +This is very slow and so users should not choose this algorithm without exceptional reasons.

@:value(_BVH)staticread onlyBVH:Int = _BVH

The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/Proxy.html b/docs/oimo/collision/broadphase/Proxy.html index c5c9e45..36b36d3 100644 --- a/docs/oimo/collision/broadphase/Proxy.html +++ b/docs/oimo/collision/broadphase/Proxy.html @@ -13,4 +13,4 @@ a proxy through BroadPhase class.

Variables

userData:Any

Extra field that users can use for their own purposes. Do not modify this property if you use the physics part of the library, as the physics part of the library uses this property for connecting proxies and shapes of rigid bodies.

Methods

getFatAabb ():Aabb

Returns the fat AABB of the proxy.

getFatAabbTo (aabb:Aabb):Void

Sets aabb to the fat AABB of the proxy.

-

This does not create a new instance of Aabb.

getId ():Int

Returns the unique id of the proxy.

\ No newline at end of file +

This does not create a new instance of Aabb.

getId ():Int

Returns the unique id of the proxy.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/ProxyPair.html b/docs/oimo/collision/broadphase/ProxyPair.html index f0b8677..c8a36c3 100644 --- a/docs/oimo/collision/broadphase/ProxyPair.html +++ b/docs/oimo/collision/broadphase/ProxyPair.html @@ -8,4 +8,4 @@ float: none; text-shadow: 0 0 0 transparent;

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

Methods

getNext ():ProxyPair

Returns the next pair.

getProxy1 ():Proxy

Returns the first proxy of the pair.

getProxy2 ():Proxy

Returns the second proxy of the pair.

\ No newline at end of file +as linked list of ProxyPair.

Methods

getNext ():ProxyPair

Returns the next pair.

getProxy1 ():Proxy

Returns the first proxy of the pair.

getProxy2 ():Proxy

Returns the second proxy of the pair.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html index f49b43a..ab21b7a 100644 --- a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html +++ b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html @@ -9,4 +9,4 @@

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

Methods

Inherited Variables

Inherited Methods

Defined by BroadPhase

inlinegetProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inlinegetTestCount ():Int

Returns the number of broad-phase AABB tests.

inlineisIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such pairs are guaranteed to be separated.

inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/index.html b/docs/oimo/collision/broadphase/bruteforce/index.html index 704c686..bd5489e 100644 --- a/docs/oimo/collision/broadphase/bruteforce/index.html +++ b/docs/oimo/collision/broadphase/bruteforce/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.collision.broadphase.bruteforce

OimoPhysics API Documentation

..
BruteForceBroadPhase

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

\ No newline at end of file +

oimo.collision.broadphase.bruteforce

OimoPhysics API Documentation

..
BruteForceBroadPhase

Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html index a6ddee9..7b37ccd 100644 --- a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html +++ b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html @@ -11,4 +11,4 @@ Average time complexity is O(NlogN) or lower.

Methods

inlinegetTreeBalance ():Int

Returns the balance of the bounding volume tree.

Inherited Variables

Inherited Methods

Defined by BroadPhase

inlinegetProxyPairList ():ProxyPair

Returns the linked list of collected pairs of proxies.

inlinegetTestCount ():Int

Returns the number of broad-phase AABB tests.

inlineisIncremental ():Bool

Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such pairs are guaranteed to be separated.

inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/index.html b/docs/oimo/collision/broadphase/bvh/index.html index 231069a..55b5810 100644 --- a/docs/oimo/collision/broadphase/bvh/index.html +++ b/docs/oimo/collision/broadphase/bvh/index.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

oimo.collision.broadphase.bvh

OimoPhysics API Documentation

..
BvhBroadPhase

The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). -Average time complexity is O(NlogN) or lower.

\ No newline at end of file +Average time complexity is O(NlogN) or lower.

\ No newline at end of file diff --git a/docs/oimo/collision/broadphase/index.html b/docs/oimo/collision/broadphase/index.html index e7b001d..138f93d 100644 --- a/docs/oimo/collision/broadphase/index.html +++ b/docs/oimo/collision/broadphase/index.html @@ -9,4 +9,4 @@

oimo.collision.broadphase

OimoPhysics API Documentation

..
bruteforce
bvh
BroadPhase

The abstract class of a broad-phase collision detection algorithm.

BroadPhaseProxyCallback

A callback class for queries in a broad phase.

BroadPhaseType

Types of broad-phase algorithms.

Proxy

A proxy is an object that can be added to a broad-phase collision detection algorithm. Users of the collision part of the library can move an axis-aligned bounding box of a proxy through BroadPhase class.

ProxyPair

A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

\ No newline at end of file +as linked list of ProxyPair.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/Aabb.html b/docs/oimo/collision/geometry/Aabb.html index 33b171f..4927c37 100644 --- a/docs/oimo/collision/geometry/Aabb.html +++ b/docs/oimo/collision/geometry/Aabb.html @@ -12,4 +12,4 @@

This does not create a new instance of Aabb.

inlinegetMax ():Vec3

Returns the maximum point of the axis-aligned bounding box.

inlinegetMaxTo (max:Vec3):Void

Sets the maximum point of the axis-aligned bounding box to max.

This does not create a new instance of Vec3.

inlinegetMin ():Vec3

Returns the minimum point of the axis-aligned bounding box.

inlinegetMinTo (min:Vec3):Void

Sets the minimum point of the axis-aligned bounding box to min.

This does not create a new instance of Vec3.

inlineinit (min:Vec3, max:Vec3):Aabb

Sets the minimum and maximum point and returns this.

-

Equivallent to setMin(min).setMax(max).

inlineoverlap (other:Aabb):Bool

Returns whether this and other intersect.

inlinesetMax (max:Vec3):Aabb

Sets the maximum point of the axis-aligned bounding box to max and returns this.

inlinesetMin (min:Vec3):Aabb

Sets the minimum point of the axis-aligned bounding box to min and returns this.

\ No newline at end of file +

Equivallent to setMin(min).setMax(max).

inlineoverlap (other:Aabb):Bool

Returns whether this and other intersect.

inlinesetMax (max:Vec3):Aabb

Sets the maximum point of the axis-aligned bounding box to max and returns this.

inlinesetMin (min:Vec3):Aabb

Sets the minimum point of the axis-aligned bounding box to min and returns this.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/BoxGeometry.html b/docs/oimo/collision/geometry/BoxGeometry.html index b719fc0..98f3670 100644 --- a/docs/oimo/collision/geometry/BoxGeometry.html +++ b/docs/oimo/collision/geometry/BoxGeometry.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A box collision geometry.

Constructor

new (halfExtents:Vec3)

Creates a box collision geometry of half-extents halfExtents.

Methods

inlinegetHalfExtents ():Vec3

Returns the half-extents of the box.

inlinegetHalfExtentsTo (halfExtents:Vec3):Void

Sets halfExtents to the half-extents of the box.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/CapsuleGeometry.html b/docs/oimo/collision/geometry/CapsuleGeometry.html index 406dfae..7ac4cee 100644 --- a/docs/oimo/collision/geometry/CapsuleGeometry.html +++ b/docs/oimo/collision/geometry/CapsuleGeometry.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A capsule collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a capsule collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the capsule.

inlinegetRadius ():Float

Returns the radius of the capsule.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConeGeometry.html b/docs/oimo/collision/geometry/ConeGeometry.html index 30799bc..6e382d8 100644 --- a/docs/oimo/collision/geometry/ConeGeometry.html +++ b/docs/oimo/collision/geometry/ConeGeometry.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A cone collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cone collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the cone.

inlinegetRadius ():Float

Returns the radius of the cone.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexGeometry.html b/docs/oimo/collision/geometry/ConvexGeometry.html index 338908c..162e12e 100644 --- a/docs/oimo/collision/geometry/ConvexGeometry.html +++ b/docs/oimo/collision/geometry/ConvexGeometry.html @@ -9,4 +9,4 @@

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

Methods

computeLocalSupportingVertex (dir:Vec3, out:Vec3):Void

Computes supporting vertex of the "core" of the geometry in local coordinates. Note that the direction vector dir might not be normalized. out is set to the computed supporting vertex.

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Inherited Variables

Inherited Methods

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexHullGeometry.html b/docs/oimo/collision/geometry/ConvexHullGeometry.html index b4524a1..5dd69a9 100644 --- a/docs/oimo/collision/geometry/ConvexHullGeometry.html +++ b/docs/oimo/collision/geometry/ConvexHullGeometry.html @@ -9,4 +9,4 @@ text-shadow: 0 0 0 transparent;

A convex hull collision geometry. A convex hull of the vertices is the smallest convex polyhedron which contains all vertices.

Constructor

new (vertices:Array<Vec3>)

Creates a convex hull collision geometry of the vertices vertices.

Methods

inlinegetVertices ():Vector<Vec3>

Returns the vertices of the convex hull.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/CylinderGeometry.html b/docs/oimo/collision/geometry/CylinderGeometry.html index 358f6de..70e8c87 100644 --- a/docs/oimo/collision/geometry/CylinderGeometry.html +++ b/docs/oimo/collision/geometry/CylinderGeometry.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A cylinder collision geometry aligned with the y-axis.

Constructor

new (radius:Float, halfHeight:Float)

Creates a cylinder collision geometry of radius radius and half-height halfHeight.

Methods

inlinegetHalfHeight ():Float

Returns the half-height of the cylinder.

inlinegetRadius ():Float

Returns the radius of the cylinder.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/Geometry.html b/docs/oimo/collision/geometry/Geometry.html index 3d5eea4..204ee66 100644 --- a/docs/oimo/collision/geometry/Geometry.html +++ b/docs/oimo/collision/geometry/Geometry.html @@ -9,4 +9,4 @@

Abstract collision geometry.

Methods

inlinegetType ():Int

Returns the type of the collision geometry.

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

rayCast (begin:Vec3, end:Vec3, transform:Transform, hit:RayCastHit):Bool

Performs ray casting. Returns true and sets the result information to hit if the line segment from begin to end and the geometry transformed by transform -intersect. Returns false if the line segment and the geometry do not intersect.

\ No newline at end of file +intersect. Returns false if the line segment and the geometry do not intersect.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/GeometryType.html b/docs/oimo/collision/geometry/GeometryType.html index 1f62238..c778ccb 100644 --- a/docs/oimo/collision/geometry/GeometryType.html +++ b/docs/oimo/collision/geometry/GeometryType.html @@ -12,4 +12,4 @@

See ConeGeometry.

@:value(_CONVEX_HULL)staticread onlyCONVEX_HULL:Int = _CONVEX_HULL

Represents a convex hull collision geometry.

See ConvexHullGeometry.

@:value(_CYLINDER)staticread onlyCYLINDER:Int = _CYLINDER

Represents a cylinder collision geometry.

See CylinderGeometry.

@:value(_SPHERE)staticread onlySPHERE:Int = _SPHERE

Represents a sphere collision geometry.

-

See SphereGeometry.

\ No newline at end of file +

See SphereGeometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/RayCastHit.html b/docs/oimo/collision/geometry/RayCastHit.html index 510c0ba..a8e125d 100644 --- a/docs/oimo/collision/geometry/RayCastHit.html +++ b/docs/oimo/collision/geometry/RayCastHit.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

A single ray cast hit data.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

\ No newline at end of file +

A single ray cast hit data.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/SphereGeometry.html b/docs/oimo/collision/geometry/SphereGeometry.html index 782b13e..8adc179 100644 --- a/docs/oimo/collision/geometry/SphereGeometry.html +++ b/docs/oimo/collision/geometry/SphereGeometry.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A sphere collision geometry.

Constructor

new (radius:Float)

Creates a sphere collision geometry of radius radius.

Methods

inlinegetRadius ():Float

Returns the radius of the sphere.

Inherited Variables

Inherited Methods

Defined by ConvexGeometry

inlinegetGjkMergin ():Float

Returns the GJK mergin around the "core" of the convex geometry.

inlinesetGjkMergin (gjkMergin:Float):Void

Sets the GJK mergin around the "core" to gjkMergin.

Defined by Geometry

inlinegetType ():Int

Returns the type of the collision geometry.

-

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file +

See GeometryType for details.

inlinegetVolume ():Float

Returns the volume of the collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/geometry/index.html b/docs/oimo/collision/geometry/index.html index d144b40..77fabad 100644 --- a/docs/oimo/collision/geometry/index.html +++ b/docs/oimo/collision/geometry/index.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

oimo.collision.geometry

OimoPhysics API Documentation

..
Aabb

The axis-aligned bounding box.

BoxGeometry

A box collision geometry.

CapsuleGeometry

A capsule collision geometry aligned with the y-axis.

ConeGeometry

A cone collision geometry aligned with the y-axis.

ConvexGeometry

Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

ConvexHullGeometry

A convex hull collision geometry. A convex hull of the vertices is the smallest convex -polyhedron which contains all vertices.

CylinderGeometry

A cylinder collision geometry aligned with the y-axis.

Geometry

Abstract collision geometry.

GeometryType

The list of collision geometry types.

RayCastHit

A single ray cast hit data.

SphereGeometry

A sphere collision geometry.

\ No newline at end of file +polyhedron which contains all vertices.

CylinderGeometry

A cylinder collision geometry aligned with the y-axis.

Geometry

Abstract collision geometry.

GeometryType

The list of collision geometry types.

RayCastHit

A single ray cast hit data.

SphereGeometry

A sphere collision geometry.

\ No newline at end of file diff --git a/docs/oimo/collision/index.html b/docs/oimo/collision/index.html index 5079834..abbc710 100644 --- a/docs/oimo/collision/index.html +++ b/docs/oimo/collision/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.collision

OimoPhysics API Documentation

..
broadphase
geometry
narrowphase
\ No newline at end of file +

oimo.collision

OimoPhysics API Documentation

..
broadphase
geometry
narrowphase
\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/CollisionMatrix.html b/docs/oimo/collision/narrowphase/CollisionMatrix.html index 39bfd5f..5f9b91b 100644 --- a/docs/oimo/collision/narrowphase/CollisionMatrix.html +++ b/docs/oimo/collision/narrowphase/CollisionMatrix.html @@ -9,4 +9,4 @@ text-shadow: 0 0 0 transparent;

CollisionMatrix provides corresponding collision detector for a pair of two geometries of given types.

Methods

inlinegetDetector (geomType1:Int, geomType2:Int):Detector

Returns an appropriate collision detector of two geometries of types geomType1 and geomType2.

-

This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

\ No newline at end of file +

This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResult.html b/docs/oimo/collision/narrowphase/DetectorResult.html index dadeb1f..d26b39f 100644 --- a/docs/oimo/collision/narrowphase/DetectorResult.html +++ b/docs/oimo/collision/narrowphase/DetectorResult.html @@ -10,4 +10,4 @@

The result of narrow-phase collision detection. This is used for generating contact points of a contact constraint at once or incrementally.

Constructor

new ()

Default constructor.

Variables

incremental:Bool

Whether the result points are to be used for incremental menifold update.

normal:Vec3

The normal vector of the contact plane.

numPoints:Int

The number of the result points.

points:Vector<DetectorResultPoint>

The result points. Note that only the first DetectorResult.numPoints points are computed by the collision detector.

Methods

inlineclear ():Void

Cleans up the result data.

getMaxDepth ():Float

Returns the maximum depth of the result points. Returns 0.0 if no result -points are available.

\ No newline at end of file +points are available.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResultPoint.html b/docs/oimo/collision/narrowphase/DetectorResultPoint.html index 3355cd0..1eff868 100644 --- a/docs/oimo/collision/narrowphase/DetectorResultPoint.html +++ b/docs/oimo/collision/narrowphase/DetectorResultPoint.html @@ -11,4 +11,4 @@

The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for each collision geometry and the amount of the overlap.

Variables

depth:Float

The amount of the overlap. This becomes negative if two geometries are -separate.

id:Int

The identification of the result point.

position1:Vec3

The first collision geometry's closest point.

position2:Vec3

The second collision geometry's closest point.

\ No newline at end of file +separate.

id:Int

The identification of the result point.

position1:Vec3

The first collision geometry's closest point.

position2:Vec3

The second collision geometry's closest point.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html index eb1b3a0..728e69a 100644 --- a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

Box vs Box detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html index acf93df..eb75968 100644 --- a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

Capsule vs Capsule detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/Detector.html b/docs/oimo/collision/narrowphase/detector/Detector.html index 95b8ff5..2f0851e 100644 --- a/docs/oimo/collision/narrowphase/detector/Detector.html +++ b/docs/oimo/collision/narrowphase/detector/Detector.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

Interface of a collision detector for narrow-phase collision detection.

Methods

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html index c4be9c1..4b37c2f 100644 --- a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html +++ b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

General convex collision detector using GJK/EPA

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html index a35f897..3ac08cc 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html @@ -10,4 +10,4 @@ first and second argument of SphereBoxDetector.detect. If swapped is false, the collision detector expects SphereGeometry and BoxGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html index ff7d781..acd351d 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html @@ -10,4 +10,4 @@ first and second argument of SphereCapsuleDetector.detect. If swapped is false, the collision detector expects SphereGeometry and CapsuleGeometry instead.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html index a5187fa..a6c223c 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

Sphere vs Sphere detector.

Constructor

new ()

Default constructor.

Inherited Variables

Inherited Methods

Defined by Detector

detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

\ No newline at end of file +of collision detection in some detectors.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html index d0f7493..f2d7ec6 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html @@ -23,4 +23,4 @@

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

rayCast (c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

Performs ray cansting against the convex geometry c with transform tf. Returns true and sets the result information to hit if the line segment from begin to end intersects the convex geometry. Otherwise returns false.

-

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

Static methods

staticinlinegetInstance ():GjkEpa

Returns an instance of GjkEpa.

\ No newline at end of file +

Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

Static methods

staticinlinegetInstance ():GjkEpa

Returns an instance of GjkEpa.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html index 33a6928..23f4a33 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

The list of the state of a result of GjkEpa.computeClosestPoints.

Static variables

@:value(_EPA_DID_NOT_CONVERGE)staticread onlyEPA_DID_NOT_CONVERGE:Int = _EPA_DID_NOT_CONVERGE

EPA iterations did not converge in time.

@:value(_EPA_FAILED_TO_ADD_VERTEX)staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int = _EPA_FAILED_TO_ADD_VERTEX

Failed to add a new vertex to the polyhedron in EPA computation.

@:value(_EPA_FAILED_TO_INIT)staticread onlyEPA_FAILED_TO_INIT:Int = _EPA_FAILED_TO_INIT

Failed to construct initial polyhedron in EPA construction.

@:value(_GJK_DID_NOT_CONVERGE)staticread onlyGJK_DID_NOT_CONVERGE:Int = _GJK_DID_NOT_CONVERGE

GJK iterations did not converge in time.

@:value(_GJK_FAILED_TO_MAKE_TETRAHEDRON)staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int = _GJK_FAILED_TO_MAKE_TETRAHEDRON

Failed to construct a tetrahedron enclosing the origin in GJK computation.

@:value(_SUCCEEDED)staticread onlySUCCEEDED:Int = _SUCCEEDED

GJK/EPA computation is successfully finished.

\ No newline at end of file +

The list of the state of a result of GjkEpa.computeClosestPoints.

Static variables

@:value(_EPA_DID_NOT_CONVERGE)staticread onlyEPA_DID_NOT_CONVERGE:Int = _EPA_DID_NOT_CONVERGE

EPA iterations did not converge in time.

@:value(_EPA_FAILED_TO_ADD_VERTEX)staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int = _EPA_FAILED_TO_ADD_VERTEX

Failed to add a new vertex to the polyhedron in EPA computation.

@:value(_EPA_FAILED_TO_INIT)staticread onlyEPA_FAILED_TO_INIT:Int = _EPA_FAILED_TO_INIT

Failed to construct initial polyhedron in EPA construction.

@:value(_GJK_DID_NOT_CONVERGE)staticread onlyGJK_DID_NOT_CONVERGE:Int = _GJK_DID_NOT_CONVERGE

GJK iterations did not converge in time.

@:value(_GJK_FAILED_TO_MAKE_TETRAHEDRON)staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int = _GJK_FAILED_TO_MAKE_TETRAHEDRON

Failed to construct a tetrahedron enclosing the origin in GJK computation.

@:value(_SUCCEEDED)staticread onlySUCCEEDED:Int = _SUCCEEDED

GJK/EPA computation is successfully finished.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html index a801c52..1f2b5f5 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html @@ -9,4 +9,4 @@

Simplex utilities for GJK/EPA computations.

Static methods

staticinlineprojectOrigin2 (vec1:Vec3, vec2:Vec3, out:Vec3):Int

Sets out to the minimum length point on the line (vec1, vec2) and returns the index of the voronoi region.

staticinlineprojectOrigin3 (vec1:Vec3, vec2:Vec3, vec3:Vec3, out:Vec3):Int

Sets out to the minimum length point on the triangle (vec1, vec2, vec3) and returns the index of the voronoi region.

staticinlineprojectOrigin4 (vec1:Vec3, vec2:Vec3, vec3:Vec3, vec4:Vec3, out:Vec3):Int

Sets out to the minimum length point on the tetrahedron (vec1, vec2, vec3, vec4) -and returns the index of the voronoi region.

\ No newline at end of file +and returns the index of the voronoi region.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html index 673ddab..6135500 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.collision.narrowphase.detector.gjkepa

OimoPhysics API Documentation

..
GjkEpa

GJK algorithm and EPA for narrow-phase collision detection.

GjkEpaResultState

The list of the state of a result of GjkEpa.computeClosestPoints.

SimplexUtil

Simplex utilities for GJK/EPA computations.

\ No newline at end of file +

oimo.collision.narrowphase.detector.gjkepa

OimoPhysics API Documentation

..
GjkEpa

GJK algorithm and EPA for narrow-phase collision detection.

GjkEpaResultState

The list of the state of a result of GjkEpa.computeClosestPoints.

SimplexUtil

Simplex utilities for GJK/EPA computations.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/index.html b/docs/oimo/collision/narrowphase/detector/index.html index 0c641b1..e43c549 100644 --- a/docs/oimo/collision/narrowphase/detector/index.html +++ b/docs/oimo/collision/narrowphase/detector/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.collision.narrowphase.detector

OimoPhysics API Documentation

..
gjkepa
BoxBoxDetector

Box vs Box detector.

CapsuleCapsuleDetector

Capsule vs Capsule detector.

Detector

Interface of a collision detector for narrow-phase collision detection.

GjkEpaDetector

General convex collision detector using GJK/EPA

SphereBoxDetector

Sphere vs Box collision detector.

SphereCapsuleDetector

Sphere vs Capsule detector.

SphereSphereDetector

Sphere vs Sphere detector.

\ No newline at end of file +

oimo.collision.narrowphase.detector

OimoPhysics API Documentation

..
gjkepa
BoxBoxDetector

Box vs Box detector.

CapsuleCapsuleDetector

Capsule vs Capsule detector.

Detector

Interface of a collision detector for narrow-phase collision detection.

GjkEpaDetector

General convex collision detector using GJK/EPA

SphereBoxDetector

Sphere vs Box collision detector.

SphereCapsuleDetector

Sphere vs Capsule detector.

SphereSphereDetector

Sphere vs Sphere detector.

\ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/index.html b/docs/oimo/collision/narrowphase/index.html index 12a469e..6c95a0e 100644 --- a/docs/oimo/collision/narrowphase/index.html +++ b/docs/oimo/collision/narrowphase/index.html @@ -10,4 +10,4 @@ two geometries of given types.

DetectorResult

The result of narrow-phase collision detection. This is used for generating contact points of a contact constraint at once or incrementally.

DetectorResultPoint

The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for -each collision geometry and the amount of the overlap.

\ No newline at end of file +each collision geometry and the amount of the overlap.

\ No newline at end of file diff --git a/docs/oimo/common/Mat3.html b/docs/oimo/common/Mat3.html index ea6bd2e..86152cb 100644 --- a/docs/oimo/common/Mat3.html +++ b/docs/oimo/common/Mat3.html @@ -35,4 +35,4 @@ Otherwise, the array is arranged in row-major order.

inlinetoEulerXyz ():Vec3

Returns a vector (angleX, angleY, angleZ) represents the Euler angles of this matrix. Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. Note that angleX, angleY, and angleZ are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.

inlinetoQuat ():Quat

Returns a quaternion which represents this matrix.

-

This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat3

Returns the transposed matrix.

inlinetransposeEq ():Mat3

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file +

This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat3

Returns the transposed matrix.

inlinetransposeEq ():Mat3

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/Mat4.html b/docs/oimo/common/Mat4.html index a30e783..028602e 100644 --- a/docs/oimo/common/Mat4.html +++ b/docs/oimo/common/Mat4.html @@ -45,4 +45,4 @@

Where translation matrix is a matrix which translates sx, sy and sz along the x-axis, y-axis and z-axis respectively.

inlinescale (s:Float):Mat4

Returns this * s

inlinescaleEq (s:Float):Mat4

Sets this matrix to this * s and returns this.

inlinesub (m:Mat4):Mat4

Returns this - m

inlinesubEq (m:Mat4):Mat4

Sets this matrix to this - m and returns this.

@:value({ columnMajor : false })inlinetoArray (columnMajor:Bool = false):Array<Float>

Returns an array of the elements of this matrix.

If columnMajor is true, the array is arranged in column-major order. -Otherwise, the array is arranged in row-major order.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat4

Returns the transposed matrix.

inlinetransposeEq ():Mat4

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file +Otherwise, the array is arranged in row-major order.

toString ():String

Returns the string representation of the matrix.

inlinetrace ():Float

Returns the trace.

inlinetranspose ():Mat4

Returns the transposed matrix.

inlinetransposeEq ():Mat4

Sets this matrix to the transposed matrix and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/MathUtil.html b/docs/oimo/common/MathUtil.html index 9274ccb..42feb19 100644 --- a/docs/oimo/common/MathUtil.html +++ b/docs/oimo/common/MathUtil.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

This class provides mathematical operations for internal purposes.

Static variables

@:value(PI / 2)staticinlineread onlyHALF_PI:Float = PI / 2

Shorthand for PI / 2.

@:value(-1e65536)staticinlineread onlyNEGATIVE_INFINITY:Float = -1e65536

Negative infinity.

@:value(3.14159265358979)staticinlineread onlyPI:Float = 3.14159265358979

The ratio of the circumference of a circle to its diameter.

@:value(1e65536)staticinlineread onlyPOSITIVE_INFINITY:Float = 1e65536

Positive infinity.

@:value(180 / PI)staticinlineread onlyTO_DEGREES:Float = 180 / PI

Shorthand for 180 / PI.

@:value(PI / 180)staticinlineread onlyTO_RADIANS:Float = PI / 180

Shorthand for PI / 180.

@:value(PI * 2)staticinlineread onlyTWO_PI:Float = PI * 2

Shorthand for PI * 2.

Static methods

staticinlineabs (x:Float):Float

Returns the absolute value of x.

staticinlineacos (x:Float):Float

Returns Math.acos(x).

staticinlineasin (x:Float):Float

Returns Math.asin(x).

staticinlineatan (x:Float):Float

Returns Math.atan(x).

staticinlineatan2 (y:Float, x:Float):Float

Returns Math.atan2(y, x)

staticinlineclamp (x:Float, min:Float, max:Float):Float

Returns a clamped value of x from min to max.

staticinlinecos (x:Float):Float

Returns Math.cos(x).

staticinlinerand ():Float

Returns Math.random().

staticinlinerandIn (min:Float, max:Float):Float

Returns a random value from min inclusive to max exclusive.

staticinlinerandVec3 ():Vec3

Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

staticinlinerandVec3In (min:Float, max:Float):Vec3

Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

staticinlinesafeAcos (x:Float):Float

Returns Math.acos(clamp(-1, x, 1)). This never returns NaN as long as x is not NaN.

staticinlinesafeAsin (x:Float):Float

Returns Math.asin(clamp(-1, x, 1)). -This never returns NaN as long as x is not NaN.

staticinlinesin (x:Float):Float

Returns Math.sin(x).

staticinlinesqrt (x:Float):Float

Returns Math.sqrt(x).

staticinlinetan (x:Float):Float

Returns Math.tan(x).

\ No newline at end of file +This never returns NaN as long as x is not NaN.

staticinlinesin (x:Float):Float

Returns Math.sin(x).

staticinlinesqrt (x:Float):Float

Returns Math.sqrt(x).

staticinlinetan (x:Float):Float

Returns Math.tan(x).

\ No newline at end of file diff --git a/docs/oimo/common/Pool.html b/docs/oimo/common/Pool.html index e72eb34..7e8bcdf 100644 --- a/docs/oimo/common/Pool.html +++ b/docs/oimo/common/Pool.html @@ -10,4 +10,4 @@ not create a new instance.

inlinemat4 ():Mat4

Returns a Mat4 object. If an unused object of Vec3 is pooled, this does not create a new instance.

inlinequat ():Quat

Returns a Quat object. If an unused object of Quat is pooled, this does not create a new instance.

inlinevec3 ():Vec3

Returns a Vec3 object. If an unused object of Vec3 is pooled, this does -not create a new instance.

\ No newline at end of file +not create a new instance.

\ No newline at end of file diff --git a/docs/oimo/common/Quat.html b/docs/oimo/common/Quat.html index 77185ed..ef45eaa 100644 --- a/docs/oimo/common/Quat.html +++ b/docs/oimo/common/Quat.html @@ -11,4 +11,4 @@

If the length is zero, this quaternion is set to zero quaternion.

inlinenormalized ():Quat

Returns the normalized quaternion.

If the length is zero, zero quaterinon is returned.

inlinescale (s:Float):Quat

Returns this * s.

inlinescaleEq (s:Float):Quat

Sets this quaternion to this * s and returns this.

setArc (v1:Vec3, v2:Vec3):Quat

Sets this quaternion to the quaternion representing the shortest arc rotation from v1 to v2, and return this.

slerp (q:Quat, t:Float):Quat

Returns the spherical linear interpolation between two quaternions this and q with interpolation paraeter t. -Both quaternions this and q must be normalized.

inlinesub (q:Quat):Quat

Returns this - v.

inlinesubEq (q:Quat):Quat

Sets this quaternion to this - v and returns this.

inlinetoMat3 ():Mat3

Returns a rotation matrix which represents this quaternion.

inlinetoString ():String

Returns the string representation of the quaternion.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file +Both quaternions this and q must be normalized.

inlinesub (q:Quat):Quat

Returns this - v.

inlinesubEq (q:Quat):Quat

Sets this quaternion to this - v and returns this.

inlinetoMat3 ():Mat3

Returns a rotation matrix which represents this quaternion.

inlinetoString ():String

Returns the string representation of the quaternion.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/Setting.html b/docs/oimo/common/Setting.html index d832bed..1f95526 100644 --- a/docs/oimo/common/Setting.html +++ b/docs/oimo/common/Setting.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

Setting provides advenced parameters used by the physics simulation.

Static variables

@:value(PositionCorrectionAlgorithm._SPLIT_IMPULSE)staticalternativeContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._SPLIT_IMPULSE

@:value(1 * MathUtil.TO_RADIANS)staticangularSlop:Float = 1 * MathUtil.TO_RADIANS

@:value(0.45)staticbvhIncrementalCollisionThreshold:Float = 0.45

@:value(0.1)staticbvhProxyPadding:Float = 0.1

@:value(0.5)staticcontactEnableBounceThreshold:Float = 0.5

@:value(0.05)staticcontactPersistenceThreshold:Float = 0.05

@:value(1)staticdefaultCollisionGroup:Int = 1

@:value(1)staticdefaultCollisionMask:Int = 1

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(1)staticdefaultDensity:Float = 1

@:value(0.2)staticdefaultFriction:Float = 0.2

@:value(0.05)staticdefaultGJKMargin:Float = 0.05

@:value(ConstraintSolverType._ITERATIVE)staticdefaultJointConstraintSolverType:Int = ConstraintSolverType._ITERATIVE

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultJointPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(0.2)staticdefaultRestitution:Float = 0.2

@:value(1e-9)staticdirectMlcpSolverEps:Float = 1e-9

@:value(false)staticdisableSleeping:Bool = false

@:value(true)staticenableGJKCaching:Bool = true

@:value(128)staticislandInitialConstraintArraySize:Int = 128

@:value(128)staticislandInitialRigidBodyArraySize:Int = 128

@:value(0.95)staticjointWarmStartingFactor:Float = 0.95

@:value(0.8)staticjointWarmStartingFactorForBaungarte:Float = 0.8

@:value(0.005)staticlinearSlop:Float = 0.005

@:value(128)staticmaxEPAPolyhedronFaces:Int = 128

@:value(128)staticmaxEPAVertices:Int = 128

@:value(6)staticmaxJacobianRows:Int = 6

@:value(4)staticmaxManifoldPoints:Int = 4

@:value(MathUtil.PI)staticmaxRotationPerStep:Float = MathUtil.PI

@:value(20)staticmaxTranslationPerStep:Float = 20

@:value(1e-6)staticminRagdollMaxSwingAngle:Float = 1e-6

@:value(1e-6)staticminSpringDamperDampingRatio:Float = 1e-6

@:value(1.0)staticpositionNgsBaumgarte:Float = 1.0

@:value(0.4)staticpositionSplitImpulseBaumgarte:Float = 0.4

@:value(0.5)staticsleepingAngularVelocityThreshold:Float = 0.5

@:value(1.0)staticsleepingTimeThreshold:Float = 1.0

@:value(0.2)staticsleepingVelocityThreshold:Float = 0.2

@:value(0.2)staticvelocityBaumgarte:Float = 0.2

\ No newline at end of file +

Setting provides advenced parameters used by the physics simulation.

Static variables

@:value(PositionCorrectionAlgorithm._SPLIT_IMPULSE)staticalternativeContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._SPLIT_IMPULSE

@:value(1 * MathUtil.TO_RADIANS)staticangularSlop:Float = 1 * MathUtil.TO_RADIANS

@:value(0.45)staticbvhIncrementalCollisionThreshold:Float = 0.45

@:value(0.1)staticbvhProxyPadding:Float = 0.1

@:value(0.5)staticcontactEnableBounceThreshold:Float = 0.5

@:value(0.05)staticcontactPersistenceThreshold:Float = 0.05

@:value(1)staticdefaultCollisionGroup:Int = 1

@:value(1)staticdefaultCollisionMask:Int = 1

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(1)staticdefaultDensity:Float = 1

@:value(0.2)staticdefaultFriction:Float = 0.2

@:value(0.05)staticdefaultGJKMargin:Float = 0.05

@:value(ConstraintSolverType._ITERATIVE)staticdefaultJointConstraintSolverType:Int = ConstraintSolverType._ITERATIVE

@:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultJointPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

@:value(0.2)staticdefaultRestitution:Float = 0.2

@:value(1e-9)staticdirectMlcpSolverEps:Float = 1e-9

@:value(false)staticdisableSleeping:Bool = false

@:value(true)staticenableGJKCaching:Bool = true

@:value(128)staticislandInitialConstraintArraySize:Int = 128

@:value(128)staticislandInitialRigidBodyArraySize:Int = 128

@:value(0.95)staticjointWarmStartingFactor:Float = 0.95

@:value(0.8)staticjointWarmStartingFactorForBaungarte:Float = 0.8

@:value(0.005)staticlinearSlop:Float = 0.005

@:value(128)staticmaxEPAPolyhedronFaces:Int = 128

@:value(128)staticmaxEPAVertices:Int = 128

@:value(6)staticmaxJacobianRows:Int = 6

@:value(4)staticmaxManifoldPoints:Int = 4

@:value(MathUtil.PI)staticmaxRotationPerStep:Float = MathUtil.PI

@:value(20)staticmaxTranslationPerStep:Float = 20

@:value(1e-6)staticminRagdollMaxSwingAngle:Float = 1e-6

@:value(1e-6)staticminSpringDamperDampingRatio:Float = 1e-6

@:value(1.0)staticpositionNgsBaumgarte:Float = 1.0

@:value(0.4)staticpositionSplitImpulseBaumgarte:Float = 0.4

@:value(0.5)staticsleepingAngularVelocityThreshold:Float = 0.5

@:value(1.0)staticsleepingTimeThreshold:Float = 1.0

@:value(0.2)staticsleepingVelocityThreshold:Float = 0.2

@:value(0.2)staticvelocityBaumgarte:Float = 0.2

\ No newline at end of file diff --git a/docs/oimo/common/Transform.html b/docs/oimo/common/Transform.html index 8b2abe6..bd83cc7 100644 --- a/docs/oimo/common/Transform.html +++ b/docs/oimo/common/Transform.html @@ -9,4 +9,4 @@

Transform class provides a set of translation and rotation.

Constructor

new ()

Creates a new identical transform.

Methods

inlineclone ():Transform

Returns a clone of the transformation.

inlinecopyFrom (transform:Transform):Transform

Sets the transformation to transform and returns this.

inlinegetOrientation ():Quat

Returns the rotation as a quaternion.

inlinegetOrientationTo (orientation:Quat):Void

Sets orientation to the quaternion representing the rotation.

This does not create a new instance of Quat.

inlinegetPosition ():Vec3

Returns the position of the transformation.

inlinegetPositionTo (position:Vec3):Void

Sets position to the position of the transformation.

This does not create a new instance of Vec3.

inlinegetRotation ():Mat3

Returns the rotation matrix.

inlinegetRotationTo (out:Mat3):Void

Sets out to the rotation matrix.

-

This does not create a new instance of Mat3.

inlineidentity ():Transform

Sets the transformation to identity and returns this.

inlinerotate (rotation:Mat3):Void

Applies rotation by the rotation matrix rotation.

inlinerotateXyz (eulerAngles:Vec3):Void

Applies the rotation by Euler angles eulerAngles in radians.

inlinesetOrientation (quaternion:Quat):Transform

Sets the rotation from a quaternion quaternion and returns this.

inlinesetPosition (position:Vec3):Transform

Sets the position of the transformation to position and returns this.

inlinesetRotation (rotation:Mat3):Transform

Sets the rotation matrix to rotation and returns this.

inlinesetRotationXyz (eulerAngles:Vec3):Void

Sets the rotation by Euler angles eulerAngles in radians.

inlinetranslate (translation:Vec3):Void

Translates the position by translation.

\ No newline at end of file +

This does not create a new instance of Mat3.

inlineidentity ():Transform

Sets the transformation to identity and returns this.

inlinerotate (rotation:Mat3):Void

Applies rotation by the rotation matrix rotation.

inlinerotateXyz (eulerAngles:Vec3):Void

Applies the rotation by Euler angles eulerAngles in radians.

inlinesetOrientation (quaternion:Quat):Transform

Sets the rotation from a quaternion quaternion and returns this.

inlinesetPosition (position:Vec3):Transform

Sets the position of the transformation to position and returns this.

inlinesetRotation (rotation:Mat3):Transform

Sets the rotation matrix to rotation and returns this.

inlinesetRotationXyz (eulerAngles:Vec3):Void

Sets the rotation by Euler angles eulerAngles in radians.

inlinetranslate (translation:Vec3):Void

Translates the position by translation.

\ No newline at end of file diff --git a/docs/oimo/common/Vec3.html b/docs/oimo/common/Vec3.html index 4374aba..113b43e 100644 --- a/docs/oimo/common/Vec3.html +++ b/docs/oimo/common/Vec3.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

3D vector class.

Constructor

@:value({ z : 0, y : 0, x : 0 })inlinenew (x:Float = 0, y:Float = 0, z:Float = 0)

Creates a new vector. The vector is zero vector by default.

Variables

x:Float

The x-value of the vector.

y:Float

The y-value of the vector.

z:Float

The z-value of the vector.

Methods

inlineadd (v:Vec3):Vec3

Returns this + v.

inlineadd3 (vx:Float, vy:Float, vz:Float):Vec3

Returns (this.x + vx, this.y + vy, this.z + vz).

inlineadd3Eq (vx:Float, vy:Float, vz:Float):Vec3

Sets this vector to (this.x + vx, this.y + vy, this.z + vz) and returns this.

inlineaddEq (v:Vec3):Vec3

Sets this vector to this + v and returns this.

inlineaddScaled (v:Vec3, s:Float):Vec3

Returns this + v * s.

inlineaddScaledEq (v:Vec3, s:Float):Vec3

Sets this vector to this + v * s and returns this.

inlineclone ():Vec3

Returns a clone of the vector.

inlinecopyFrom (v:Vec3):Vec3

Copies values from v and returns this.

inlinecross (v:Vec3):Vec3

Returns the cross product of this and v.

inlinecrossEq (v:Vec3):Vec3

Sets this vector to the cross product of this and s, and returns this.

inlinedot (v:Vec3):Float

Returns the dot product of this and v.

init (x:Float, y:Float, z:Float):Vec3

Sets all values at once and returns this.

inlinelength ():Float

Returns the length of the vector.

inlinelengthSq ():Float

Returns the squared length of the vector.

inlinemulMat3 (m:Mat3):Vec3

Returns the transformed vector by m.

inlinemulMat3Eq (m:Mat3):Vec3

Sets this vector to the transformed vector by m and returns this.

inlinemulMat4 (m:Mat4):Vec3

Returns the transformed vector by m.

inlinemulMat4Eq (m:Mat4):Vec3

Sets this vector to the transformed vector by m and returns this.

inlinemulTransform (tf:Transform):Vec3

Returns the transformed vector by tf.

inlinemulTransformEq (tf:Transform):Vec3

Sets this vector to the transformed vector by tf and returns this.

inlinenegate ():Vec3

Returns the nagated vector.

inlinenegateEq ():Vec3

Negate the vector and returns this.

inlinenormalize ():Vec3

Normalize this vector and returns this.

If the length is zero, this vector is set to zero vector.

inlinenormalized ():Vec3

Returns the normalized vector.

-

If the length is zero, zero vector is returned.

inlinescale (s:Float):Vec3

Returns this * s.

inlinescale3 (sx:Float, sy:Float, sz:Float):Vec3

Returns (this.x * sx, this.y * sy, this.z * sz).

inlinescale3Eq (sx:Float, sy:Float, sz:Float):Vec3

Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

inlinescaleEq (s:Float):Vec3

Sets this vector to this * s and returns this.

inlinesub (v:Vec3):Vec3

Returns this - v.

inlinesub3 (vx:Float, vy:Float, vz:Float):Vec3

Returns (this.x - vx, this.y - vy, this.z - vz).

inlinesub3Eq (vx:Float, vy:Float, vz:Float):Vec3

Sets this vector to (this.x - vx, this.y - vy, this.z - vz) and returns this.

inlinesubEq (v:Vec3):Vec3

Sets this vector to this - v and returns this.

toString ():String

Returns the string representation of the vector.

zero ():Vec3

Sets this vector to zero vector and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file +

If the length is zero, zero vector is returned.

inlinescale (s:Float):Vec3

Returns this * s.

inlinescale3 (sx:Float, sy:Float, sz:Float):Vec3

Returns (this.x * sx, this.y * sy, this.z * sz).

inlinescale3Eq (sx:Float, sy:Float, sz:Float):Vec3

Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

inlinescaleEq (s:Float):Vec3

Sets this vector to this * s and returns this.

inlinesub (v:Vec3):Vec3

Returns this - v.

inlinesub3 (vx:Float, vy:Float, vz:Float):Vec3

Returns (this.x - vx, this.y - vy, this.z - vz).

inlinesub3Eq (vx:Float, vy:Float, vz:Float):Vec3

Sets this vector to (this.x - vx, this.y - vy, this.z - vz) and returns this.

inlinesubEq (v:Vec3):Vec3

Sets this vector to this - v and returns this.

toString ():String

Returns the string representation of the vector.

zero ():Vec3

Sets this vector to zero vector and returns this.

Static variables

@:value(0)staticnumCreations:Int = 0

The number of instance creation.

\ No newline at end of file diff --git a/docs/oimo/common/index.html b/docs/oimo/common/index.html index 4beed28..6a0403e 100644 --- a/docs/oimo/common/index.html +++ b/docs/oimo/common/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.common

OimoPhysics API Documentation

..
Mat3

3x3 Matrix class.

Mat4

4x4 Matrix class.

MathUtil

This class provides mathematical operations for internal purposes.

Pool

The object pool system of Vec3, Mat3, Mat4, and Quat.

Quat

Quaternion class.

Setting

Setting provides advenced parameters used by the physics simulation.

Transform

Transform class provides a set of translation and rotation.

Vec3

3D vector class.

\ No newline at end of file +

oimo.common

OimoPhysics API Documentation

..
Mat3

3x3 Matrix class.

Mat4

4x4 Matrix class.

MathUtil

This class provides mathematical operations for internal purposes.

Pool

The object pool system of Vec3, Mat3, Mat4, and Quat.

Quat

Quaternion class.

Setting

Setting provides advenced parameters used by the physics simulation.

Transform

Transform class provides a set of translation and rotation.

Vec3

3D vector class.

\ No newline at end of file diff --git a/docs/oimo/dynamics/Contact.html b/docs/oimo/dynamics/Contact.html index 4daef28..141599e 100644 --- a/docs/oimo/dynamics/Contact.html +++ b/docs/oimo/dynamics/Contact.html @@ -12,4 +12,4 @@

As AABBs are larger than its shapes, shapes of a contact don't always touching or colliding though their AABBs are overlapping.

Methods

inlinegetContactConstraint ():ContactConstraint

Returns the contact constraint.

inlinegetManifold ():Manifold

Returns the contact manifold.

inlinegetNext ():Contact

Returns the next contact in the world.

If the next contact does not exist, null will be returned.

inlinegetPrev ():Contact

Returns the previous contact in the world.

-

If the previous contact does not exist, null will be returned.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

inlineisTouching ():Bool

Returns whether the shapes are touching.

\ No newline at end of file +

If the previous contact does not exist, null will be returned.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

inlineisTouching ():Bool

Returns whether the shapes are touching.

\ No newline at end of file diff --git a/docs/oimo/dynamics/ContactLink.html b/docs/oimo/dynamics/ContactLink.html index 3e4c8cc..e69d9d9 100644 --- a/docs/oimo/dynamics/ContactLink.html +++ b/docs/oimo/dynamics/ContactLink.html @@ -13,4 +13,4 @@ See also JointLink.

Methods

inlinegetContact ():Contact

Returns the contact of the link.

inlinegetNext ():ContactLink

Returns the next contact link in the rigid body.

If the next one does not exist, null will be returned.

inlinegetOther ():RigidBody

Returns the other rigid body of the link. This provides a quick access from a rigid body to the other one of the contact.

inlinegetPrev ():ContactLink

Returns the previous contact link in the rigid body.

-

If the previous one does not exist, null will be returned.

\ No newline at end of file +

If the previous one does not exist, null will be returned.

\ No newline at end of file diff --git a/docs/oimo/dynamics/ContactManager.html b/docs/oimo/dynamics/ContactManager.html index f2ddb61..5bb2c5a 100644 --- a/docs/oimo/dynamics/ContactManager.html +++ b/docs/oimo/dynamics/ContactManager.html @@ -10,4 +10,4 @@ text-shadow: 0 0 0 transparent;

The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and -is destroyed when they end overlapping.

Methods

inlinegetContactList ():Contact

Returns the linked list of the contacts in the world.

inlinegetNumContacts ():Int

Returns the number of the contacts in the world.

\ No newline at end of file +is destroyed when they end overlapping.

Methods

inlinegetContactList ():Contact

Returns the linked list of the contacts in the world.

inlinegetNumContacts ():Int

Returns the number of the contacts in the world.

\ No newline at end of file diff --git a/docs/oimo/dynamics/TimeStep.html b/docs/oimo/dynamics/TimeStep.html index de01784..6335d91 100644 --- a/docs/oimo/dynamics/TimeStep.html +++ b/docs/oimo/dynamics/TimeStep.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

Information of time-step sizes of the simulation.

Variables

dt:Float

The time step of simulation.

dtRatio:Float

The ratio of time steps. Defined by current time step divided by previous -time step.

invDt:Float

The inverse time step of simulation, equivalent to simulation FPS.

\ No newline at end of file +time step.

invDt:Float

The inverse time step of simulation, equivalent to simulation FPS.

\ No newline at end of file diff --git a/docs/oimo/dynamics/World.html b/docs/oimo/dynamics/World.html index 2fa0299..f02cb47 100644 --- a/docs/oimo/dynamics/World.html +++ b/docs/oimo/dynamics/World.html @@ -13,4 +13,4 @@ AABB and aabb intersect.

addJoint (joint:Joint):Void

Adds the joint joint to the simulation world.

addRigidBody (rigidBody:RigidBody):Void

Adds the rigid body rigidBody to the simulation world.

convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning transform begin.

debugDraw ():Void

Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

inlinegetBroadPhase ():BroadPhase

Returns the broad-phase collision detection algorithm.

inlinegetContactManager ():ContactManager

Returns the contact manager.

inlinegetDebugDraw ():DebugDraw

Returns the debug draw interface.

inlinegetGravity ():Vec3

Returns the gravitational acceleration of the simulation world.

inlinegetJointList ():Joint

Returns the list of the joints added to the world.

inlinegetNumIslands ():Int

Returns the number of simulation islands.

inlinegetNumJoints ():Int

Returns the number of the joints added to the world.

inlinegetNumPositionIterations ():Int

Returns the number of position iterations of constraint solvers.

inlinegetNumRigidBodies ():Int

Returns the number of the rigid bodies added to the world.

inlinegetNumShapes ():Int

Returns the number of the shapes added to the world.

inlinegetNumVelocityIterations ():Int

Returns the number of velocity iterations of constraint solvers.

inlinegetRigidBodyList ():RigidBody

Returns the list of the rigid bodies added to the world.

rayCast (begin:Vec3, end:Vec3, callback:RayCastCallback):Void

Performs a ray casting. callback.process is called for all shapes the ray -from begin to end hits.

removeJoint (joint:Joint):Void

Removes the joint joint from the simulation world.

removeRigidBody (rigidBody:RigidBody):Void

Removes the rigid body rigidBody from the simulation world.

inlinesetDebugDraw (debugDraw:DebugDraw):Void

Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

inlinesetGravity (gravity:Vec3):Void

Sets the gravitational acceleration of the simulation world to gravity.

inlinesetNumPositionIterations (numPositionIterations:Int):Void

Sets the number of position iterations of constraint solvers to numPositionIterations.

inlinesetNumVelocityIterations (numVelocityIterations:Int):Void

Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

step (timeStep:Float):Void

Advances the simulation by the time step timeStep.

\ No newline at end of file +from begin to end hits.

removeJoint (joint:Joint):Void

Removes the joint joint from the simulation world.

removeRigidBody (rigidBody:RigidBody):Void

Removes the rigid body rigidBody from the simulation world.

inlinesetDebugDraw (debugDraw:DebugDraw):Void

Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

inlinesetGravity (gravity:Vec3):Void

Sets the gravitational acceleration of the simulation world to gravity.

inlinesetNumPositionIterations (numPositionIterations:Int):Void

Sets the number of position iterations of constraint solvers to numPositionIterations.

inlinesetNumVelocityIterations (numVelocityIterations:Int):Void

Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

step (timeStep:Float):Void

Advances the simulation by the time step timeStep.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/AabbTestCallback.html b/docs/oimo/dynamics/callback/AabbTestCallback.html index 5377aaa..3b2ec79 100644 --- a/docs/oimo/dynamics/callback/AabbTestCallback.html +++ b/docs/oimo/dynamics/callback/AabbTestCallback.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A callback interface for aabb tests in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape):Void

This is called every time the world detects a shape shape that -the query aabb intersects.

\ No newline at end of file +the query aabb intersects.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/ContactCallback.html b/docs/oimo/dynamics/callback/ContactCallback.html index 6b8b9f7..718d357 100644 --- a/docs/oimo/dynamics/callback/ContactCallback.html +++ b/docs/oimo/dynamics/callback/ContactCallback.html @@ -12,4 +12,4 @@ the two shapes.

endContact (c:Contact):Void

This is called when two shapes end touching each other. c is the contact of the two shapes.

postSolve (c:Contact):Void

This is called every frame after velocity solver iterations while two shapes are touching. c is the contact for the two shapes.

preSolve (c:Contact):Void

This is called every frame before velocity solver iterations while two shapes -are touching. c is the contact for the two shapes.

\ No newline at end of file +are touching. c is the contact for the two shapes.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastCallback.html b/docs/oimo/dynamics/callback/RayCastCallback.html index 31387f8..fbb0659 100644 --- a/docs/oimo/dynamics/callback/RayCastCallback.html +++ b/docs/oimo/dynamics/callback/RayCastCallback.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A callback class for ray casts in a world.

Constructor

new ()

Default constructor.

Methods

process (shape:Shape, hit:RayCastHit):Void

This is called every time the world detects a shape shape that -the ray intersects with the hit data hit.

\ No newline at end of file +the ray intersects with the hit data hit.

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastClosest.html b/docs/oimo/dynamics/callback/RayCastClosest.html index 5c7300a..0ee706a 100644 --- a/docs/oimo/dynamics/callback/RayCastClosest.html +++ b/docs/oimo/dynamics/callback/RayCastClosest.html @@ -10,4 +10,4 @@ text-shadow: 0 0 0 transparent;

A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

hit:Bool

Whether the ray hit any shape in the world.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

shape:Shape

The shape the ray hit.

Methods

inlineclear ():Void

Clears the result data.

Inherited Variables

Inherited Methods

\ No newline at end of file +RayCastClosest.clear if used once or more before.

Constructor

new ()

Default constructor.

Variables

fraction:Float

The ratio of the position the ray hit from the start point to the end point.

hit:Bool

Whether the ray hit any shape in the world.

normal:Vec3

The normal vector of the surface the ray hit.

position:Vec3

The position the ray hit at.

shape:Shape

The shape the ray hit.

Methods

inlineclear ():Void

Clears the result data.

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/callback/index.html b/docs/oimo/dynamics/callback/index.html index 38e8b38..1d91af4 100644 --- a/docs/oimo/dynamics/callback/index.html +++ b/docs/oimo/dynamics/callback/index.html @@ -9,4 +9,4 @@

oimo.dynamics.callback

OimoPhysics API Documentation

..
AabbTestCallback

A callback interface for aabb tests in a world.

ContactCallback

A callback class for contact events. Contact events between two shapes will occur in following order:

RayCastCallback

A callback class for ray casts in a world.

RayCastClosest

A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

\ No newline at end of file +RayCastClosest.clear if used once or more before.

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDraw.html b/docs/oimo/dynamics/common/DebugDraw.html index a56ca14..e3e2104 100644 --- a/docs/oimo/dynamics/common/DebugDraw.html +++ b/docs/oimo/dynamics/common/DebugDraw.html @@ -64,4 +64,4 @@

color is the color of the sphere.

triangle (v1:Vec3, v2:Vec3, v3:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, color:Vec3):Void

Draws a triangle.

v1, v2, v3 are the triangle's vertices in CCW order.

n1, n2, n3 are the normals of the triangle's vertices in CCW order.

-

color is the color of the triangle.

\ No newline at end of file +

color is the color of the triangle.

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDrawStyle.html b/docs/oimo/dynamics/common/DebugDrawStyle.html index 55d0576..769472f 100644 --- a/docs/oimo/dynamics/common/DebugDrawStyle.html +++ b/docs/oimo/dynamics/common/DebugDrawStyle.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

Style settings of the debug draw.

Constructor

new ()

Default constructor.

Variables

@:value(new Vec3(1.0, 0.1, 0.1))aabbColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.0, 0.0))basisColorX:Vec3 = new Vec3(1.0, 0.0, 0.0)

@:value(new Vec3(0.0, 1.0, 0.0))basisColorY:Vec3 = new Vec3(0.0, 1.0, 0.0)

@:value(new Vec3(0.0, 0.0, 1.0))basisColorZ:Vec3 = new Vec3(0.0, 0.0, 1.0)

@:value(0.5)basisLength:Float = 0.5

@:value(new Vec3(0.4, 0.4, 0.4))bvhNodeColor:Vec3 = new Vec3(0.4, 0.4, 0.4)

@:value(new Vec3(0.2, 0.2, 1.0))contactBinormalColor:Vec3 = new Vec3(0.2, 0.2, 1.0)

@:value(0.5)contactBinormalLength:Float = 0.5

@:value(new Vec3(1.0, 0.1, 0.1))contactColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.6, 0.1))contactColor2:Vec3 = new Vec3(1.0, 0.6, 0.1)

@:value(new Vec3(0.1, 0.8, 0.6))contactColor3:Vec3 = new Vec3(0.1, 0.8, 0.6)

@:value(new Vec3(0.8, 0.1, 1.0))contactColor4:Vec3 = new Vec3(0.8, 0.1, 1.0)

@:value(new Vec3(1.0, 0.1, 0.1))contactNormalColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(0.5)contactNormalLength:Float = 0.5

@:value(new Vec3(0.1, 0.8, 0.1))contactTangentColor:Vec3 = new Vec3(0.1, 0.8, 0.1)

@:value(0.5)contactTangentLength:Float = 0.5

@:value(new Vec3(0.5, 0.1, 0.1))disabledContactColor:Vec3 = new Vec3(0.5, 0.1, 0.1)

@:value(new Vec3(1.0, 0.1, 0.1))jointErrorColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(0.8, 0.8, 0.8))jointLineColor:Vec3 = new Vec3(0.8, 0.8, 0.8)

@:value(0.3)jointRotationalConstraintRadius:Float = 0.3

@:value(new Vec3(1.0, 0.5, 0.1))kinematicShapeColor:Vec3 = new Vec3(1.0, 0.5, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))newContactColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))pairColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(0.7, 0.2, 0.4))shapeColor1:Vec3 = new Vec3(0.7, 0.2, 0.4)

@:value(new Vec3(1.0, 0.8, 0.1))shapeColor2:Vec3 = new Vec3(1.0, 0.8, 0.1)

@:value(new Vec3(0.3, 0.3, 0.8))sleepingShapeColor1:Vec3 = new Vec3(0.3, 0.3, 0.8)

@:value(new Vec3(0.2, 0.8, 0.5))sleepingShapeColor2:Vec3 = new Vec3(0.2, 0.8, 0.5)

@:value(new Vec3(0.5, 0.25, 0.6))sleepyShapeColor1:Vec3 = new Vec3(0.5, 0.25, 0.6)

@:value(new Vec3(0.6, 0.8, 0.3))sleepyShapeColor2:Vec3 = new Vec3(0.6, 0.8, 0.3)

@:value(new Vec3(0.7, 0.7, 0.7))staticShapeColor:Vec3 = new Vec3(0.7, 0.7, 0.7)

\ No newline at end of file +

Style settings of the debug draw.

Constructor

new ()

Default constructor.

Variables

@:value(new Vec3(1.0, 0.1, 0.1))aabbColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.0, 0.0))basisColorX:Vec3 = new Vec3(1.0, 0.0, 0.0)

@:value(new Vec3(0.0, 1.0, 0.0))basisColorY:Vec3 = new Vec3(0.0, 1.0, 0.0)

@:value(new Vec3(0.0, 0.0, 1.0))basisColorZ:Vec3 = new Vec3(0.0, 0.0, 1.0)

@:value(0.5)basisLength:Float = 0.5

@:value(new Vec3(0.4, 0.4, 0.4))bvhNodeColor:Vec3 = new Vec3(0.4, 0.4, 0.4)

@:value(new Vec3(0.2, 0.2, 1.0))contactBinormalColor:Vec3 = new Vec3(0.2, 0.2, 1.0)

@:value(0.5)contactBinormalLength:Float = 0.5

@:value(new Vec3(1.0, 0.1, 0.1))contactColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(1.0, 0.6, 0.1))contactColor2:Vec3 = new Vec3(1.0, 0.6, 0.1)

@:value(new Vec3(0.1, 0.8, 0.6))contactColor3:Vec3 = new Vec3(0.1, 0.8, 0.6)

@:value(new Vec3(0.8, 0.1, 1.0))contactColor4:Vec3 = new Vec3(0.8, 0.1, 1.0)

@:value(new Vec3(1.0, 0.1, 0.1))contactNormalColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(0.5)contactNormalLength:Float = 0.5

@:value(new Vec3(0.1, 0.8, 0.1))contactTangentColor:Vec3 = new Vec3(0.1, 0.8, 0.1)

@:value(0.5)contactTangentLength:Float = 0.5

@:value(new Vec3(0.5, 0.1, 0.1))disabledContactColor:Vec3 = new Vec3(0.5, 0.1, 0.1)

@:value(new Vec3(1.0, 0.1, 0.1))jointErrorColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

@:value(new Vec3(0.8, 0.8, 0.8))jointLineColor:Vec3 = new Vec3(0.8, 0.8, 0.8)

@:value(0.3)jointRotationalConstraintRadius:Float = 0.3

@:value(new Vec3(1.0, 0.5, 0.1))kinematicShapeColor:Vec3 = new Vec3(1.0, 0.5, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))newContactColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(1.0, 1.0, 0.1))pairColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

@:value(new Vec3(0.7, 0.2, 0.4))shapeColor1:Vec3 = new Vec3(0.7, 0.2, 0.4)

@:value(new Vec3(1.0, 0.8, 0.1))shapeColor2:Vec3 = new Vec3(1.0, 0.8, 0.1)

@:value(new Vec3(0.3, 0.3, 0.8))sleepingShapeColor1:Vec3 = new Vec3(0.3, 0.3, 0.8)

@:value(new Vec3(0.2, 0.8, 0.5))sleepingShapeColor2:Vec3 = new Vec3(0.2, 0.8, 0.5)

@:value(new Vec3(0.5, 0.25, 0.6))sleepyShapeColor1:Vec3 = new Vec3(0.5, 0.25, 0.6)

@:value(new Vec3(0.6, 0.8, 0.3))sleepyShapeColor2:Vec3 = new Vec3(0.6, 0.8, 0.3)

@:value(new Vec3(0.7, 0.7, 0.7))staticShapeColor:Vec3 = new Vec3(0.7, 0.7, 0.7)

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/Performance.html b/docs/oimo/dynamics/common/Performance.html index 9850411..1af0256 100644 --- a/docs/oimo/dynamics/common/Performance.html +++ b/docs/oimo/dynamics/common/Performance.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

Performance

Static variables

@:value(0)staticbroadPhaseCollisionTime:Float = 0

@:value(0)staticdynamicsTime:Float = 0

@:value(0)staticnarrowPhaseCollisionTime:Float = 0

@:value(0)statictotalTime:Float = 0

\ No newline at end of file +

Performance

Static variables

@:value(0)staticbroadPhaseCollisionTime:Float = 0

@:value(0)staticdynamicsTime:Float = 0

@:value(0)staticnarrowPhaseCollisionTime:Float = 0

@:value(0)statictotalTime:Float = 0

\ No newline at end of file diff --git a/docs/oimo/dynamics/common/index.html b/docs/oimo/dynamics/common/index.html index e5906eb..38a2c26 100644 --- a/docs/oimo/dynamics/common/index.html +++ b/docs/oimo/dynamics/common/index.html @@ -8,4 +8,4 @@ text-shadow: 0 0 0 transparent;

oimo.dynamics.common

OimoPhysics API Documentation

..
DebugDraw

The interface of debug drawer. This provides graphical information of a physics world for debugging softwares. Users should override at least three methods DebugDraw.point, -DebugDraw.triangle, DebugDraw.line.

DebugDrawStyle

Style settings of the debug draw.

Performance

Performance

\ No newline at end of file +DebugDraw.triangle, DebugDraw.line.

DebugDrawStyle

Style settings of the debug draw.

Performance

Performance

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/ConstraintSolver.html b/docs/oimo/dynamics/constraint/ConstraintSolver.html index 23f3009..aeab641 100644 --- a/docs/oimo/dynamics/constraint/ConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/ConstraintSolver.html @@ -10,4 +10,4 @@ for computing time-depending data.

preSolvePosition (timeStep:TimeStep):Void

Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step information timeStep is given for computing time-depending data.

This may not be called depending on position correction algorithm.

preSolveVelocity (timeStep:TimeStep):Void

Prepares for velocity iteration. Time step information timeStep is given for -computing time-depending data.

solvePositionNgs (timeStep:TimeStep):Void

Performs single position iteration (nonlinear Gauss-Seidel)

solvePositionSplitImpulse ():Void

Performs single position iteration (split impulse)

solveVelocity ():Void

Performs single velocity iteration.

warmStart (timeStep:TimeStep):Void

Applies initial impulses.

\ No newline at end of file +computing time-depending data.

solvePositionNgs (timeStep:TimeStep):Void

Performs single position iteration (nonlinear Gauss-Seidel)

solvePositionSplitImpulse ():Void

Performs single position iteration (split impulse)

solveVelocity ():Void

Performs single velocity iteration.

warmStart (timeStep:TimeStep):Void

Applies initial impulses.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html index 6a6a989..fb565a3 100644 --- a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html +++ b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

The list of the algorithms for position corretion.

Static variables

@:value(_BAUMGARTE)staticread onlyBAUMGARTE:Int = _BAUMGARTE

Baumgarte stabilizaiton. Fastest but introduces extra energy.

@:value(_NGS)staticread onlyNGS:Int = _NGS

Nonlinear Gauss-Seidel method. Slow but stable.

@:value(_SPLIT_IMPULSE)staticread onlySPLIT_IMPULSE:Int = _SPLIT_IMPULSE

Use split impulse and pseudo velocity. Fast enough and does not introduce extra -energy, but somewhat unstable, especially for joints.

\ No newline at end of file +energy, but somewhat unstable, especially for joints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html index cb579f5..713fa61 100644 --- a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html +++ b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html @@ -10,4 +10,4 @@ text-shadow: 0 0 0 transparent;

A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and -contact impulses. See Manifold for more information.

Methods

inlinegetManifold ():Manifold

Returns the contact manifold.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

isTouching ():Bool

Returns whether the two rigid bodies are touching.

\ No newline at end of file +contact impulses. See Manifold for more information.

Methods

inlinegetManifold ():Manifold

Returns the contact manifold.

inlinegetShape1 ():Shape

Returns the first shape of the contact.

inlinegetShape2 ():Shape

Returns the second shape of the contact.

isTouching ():Bool

Returns whether the two rigid bodies are touching.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/Manifold.html b/docs/oimo/dynamics/constraint/contact/Manifold.html index 05e8f1a..92f985f 100644 --- a/docs/oimo/dynamics/constraint/contact/Manifold.html +++ b/docs/oimo/dynamics/constraint/contact/Manifold.html @@ -17,4 +17,4 @@ be disabled (see ManifoldPoint.isEnabled).

inlinegetTangent ():Vec3

Returns the tangent vector of the contact manifold. The tangent vector has unit length and is perpendicular to the normal vector.

inlinegetTangentTo (tangent:Vec3):Void

Sets tangent to the tangent vector of the contact manifold. The tangent vector has unit length and is perpendicular to the normal vector.

-

This does not create a new instance of Vec3.

\ No newline at end of file +

This does not create a new instance of Vec3.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html index e5a96f6..6046e5a 100644 --- a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html +++ b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html @@ -11,4 +11,4 @@ data (position, overlap depth, impulse, etc...) for collision response.

Methods

inlinegetBinormalImpulse ():Float

Returns the binormal impulse of the manifold point.

inlinegetDepth ():Float

Returns the amount of the overlap. If the manifold point is separate, a negative value is returned.

inlinegetNormalImpulse ():Float

Returns the normal impulse of the manifold point.

inlinegetPosition1 ():Vec3

Returns the first rigid body's manifold point in world coordinate.

inlinegetPosition1To (position:Vec3):Void

Sets position to the first rigid body's manifold point in world coordinate. This does not create a new instance of Vec3.

inlinegetPosition2 ():Vec3

Returns the second rigid body's manifold point in world coordinate.

inlinegetPosition2To (position:Vec3):Void

Sets position to the second rigid body's manifold point in world coordinate. -This does not create a new instance of Vec3.

inlinegetTangentImpulse ():Float

Returns the tangent impulse of the manifold point.

inlineisEnabled ():Bool

Returns whether the manifold point is enabled.

inlineisWarmStarted ():Bool

Returns whether the manifold point has existed for more than two steps.

\ No newline at end of file +This does not create a new instance of Vec3.

inlinegetTangentImpulse ():Float

Returns the tangent impulse of the manifold point.

inlineisEnabled ():Bool

Returns whether the manifold point is enabled.

inlineisWarmStarted ():Bool

Returns whether the manifold point has existed for more than two steps.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/index.html b/docs/oimo/dynamics/constraint/contact/index.html index f6d1a8f..a71c08e 100644 --- a/docs/oimo/dynamics/constraint/contact/index.html +++ b/docs/oimo/dynamics/constraint/contact/index.html @@ -9,4 +9,4 @@

oimo.dynamics.constraint.contact

OimoPhysics API Documentation

..
ContactConstraint

A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and contact impulses. See Manifold for more information.

Manifold

A contact manifold holds collision data of a pair of shapes.

ManifoldPoint

A manifold point is a contact point in a contact manifold. This holds detailed collision -data (position, overlap depth, impulse, etc...) for collision response.

\ No newline at end of file +data (position, overlap depth, impulse, etc...) for collision response.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/index.html b/docs/oimo/dynamics/constraint/index.html index f170623..1d1abb4 100644 --- a/docs/oimo/dynamics/constraint/index.html +++ b/docs/oimo/dynamics/constraint/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.dynamics.constraint

OimoPhysics API Documentation

..
contact
joint
solver
ConstraintSolver

The base class of all constarint solvers.

PositionCorrectionAlgorithm

The list of the algorithms for position corretion.

\ No newline at end of file +

oimo.dynamics.constraint

OimoPhysics API Documentation

..
contact
joint
solver
ConstraintSolver

The base class of all constarint solvers.

PositionCorrectionAlgorithm

The list of the algorithms for position corretion.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html index 6cae1ff..96ef856 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html @@ -35,4 +35,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html index 6a54ccf..4a091ea 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html @@ -11,4 +11,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJoint.html b/docs/oimo/dynamics/constraint/joint/GenericJoint.html index 8642986..5df0f17 100644 --- a/docs/oimo/dynamics/constraint/joint/GenericJoint.html +++ b/docs/oimo/dynamics/constraint/joint/GenericJoint.html @@ -31,4 +31,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html index 1433398..cd33dbc 100644 --- a/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html @@ -11,4 +11,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/Joint.html b/docs/oimo/dynamics/constraint/joint/Joint.html index c40901e..1fe167e 100644 --- a/docs/oimo/dynamics/constraint/joint/Joint.html +++ b/docs/oimo/dynamics/constraint/joint/Joint.html @@ -25,4 +25,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointConfig.html b/docs/oimo/dynamics/constraint/joint/JointConfig.html index dcb1071..9e10348 100644 --- a/docs/oimo/dynamics/constraint/joint/JointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/JointConfig.html @@ -12,4 +12,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

\ No newline at end of file +

See ConstraintSolverType for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointLink.html b/docs/oimo/dynamics/constraint/joint/JointLink.html index c7ae677..5fb1e7a 100644 --- a/docs/oimo/dynamics/constraint/joint/JointLink.html +++ b/docs/oimo/dynamics/constraint/joint/JointLink.html @@ -13,4 +13,4 @@ See also ContactLink.

Methods

getContact ():Joint

Returns the contact the rigid body is attached to.

getNext ():JointLink

Returns the next joint link in the rigid body.

If the previous one does not exist, null will be returned.

getOther ():RigidBody

Returns the other rigid body attached to the constraint. This provides a quick access from a rigid body to the other one attached to the constraint.

getPrev ():JointLink

Returns the previous joint link in the rigid body.

-

If the previous one does not exist, null will be returned.

\ No newline at end of file +

If the previous one does not exist, null will be returned.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointType.html b/docs/oimo/dynamics/constraint/joint/JointType.html index 3e764a9..8a782d6 100644 --- a/docs/oimo/dynamics/constraint/joint/JointType.html +++ b/docs/oimo/dynamics/constraint/joint/JointType.html @@ -13,4 +13,4 @@

See RagdollJoint for details.

@:value(_REVOLUTE)staticread onlyREVOLUTE:Int = _REVOLUTE

Represents a revolute joint.

See RevoluteJoint for details.

@:value(_SPHERICAL)staticread onlySPHERICAL:Int = _SPHERICAL

Represents a spherical joint.

See SphericalJoint for details.

@:value(_UNIVERSAL)staticread onlyUNIVERSAL:Int = _UNIVERSAL

Represents a universal joint.

-

See UniversalJoint for details.

\ No newline at end of file +

See UniversalJoint for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html index c5ab406..ea0c4dc 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html @@ -35,4 +35,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html index 4375039..18c13c1 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html @@ -11,4 +11,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html index 5980af4..ea0698e 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html @@ -46,4 +46,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html index f84b386..7a56631 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html @@ -16,4 +16,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html index 876e29c..db0d0e2 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html @@ -35,4 +35,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html index 0741e17..02f8b56 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html @@ -11,4 +11,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html index 77dd651..3557d08 100644 --- a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html @@ -11,4 +11,4 @@

The motor is disabled if motorTorque <= 0.

upperLimit:Float

The upper bound of the limit in radians.

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():RotationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):RotationalLimitMotor

Sets limit properties at once and returns this. this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, torque:Float):RotationalLimitMotor

Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorTorque is set to torque.

\ No newline at end of file +this.motorSpeed is set to speed, and this.motorTorque is set to torque.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html index 4e5db07..9936598 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html @@ -27,4 +27,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html index 36f4e72..de0b1f0 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html @@ -10,4 +10,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SpringDamper.html b/docs/oimo/dynamics/constraint/joint/SpringDamper.html index 905f2b1..61aab47 100644 --- a/docs/oimo/dynamics/constraint/joint/SpringDamper.html +++ b/docs/oimo/dynamics/constraint/joint/SpringDamper.html @@ -11,4 +11,4 @@ Set 0.0 to disable the spring and make the constraint totally rigid.

useSymplecticEuler:Bool

Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. Note that symplectic Euler method conserves energy better than implicit Euler method does, but the constraint will be unstable under the high frequency.

Methods

clone ():SpringDamper

Returns a clone of the object.

setSpring (frequency:Float, dampingRatio:Float):SpringDamper

Sets spring and damper parameters at once and returns this. -this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

setSymplecticEuler (useSymplecticEuler:Bool):SpringDamper

\ No newline at end of file +this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

setSymplecticEuler (useSymplecticEuler:Bool):SpringDamper

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html index 7f7d5c9..d3655a7 100644 --- a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html @@ -11,4 +11,4 @@

The motor is disabled if motorForce <= 0.

motorSpeed:Float

The target speed of the motor in usually meters per second.

upperLimit:Float

The upper bound of the limit in usually meters.

The limit is disabled if lowerLimit > upperLimit.

Methods

clone ():TranslationalLimitMotor

Returns a clone of the object.

setLimits (lower:Float, upper:Float):TranslationalLimitMotor

Sets limit properties at once and returns this. this.lowerLimit is set to lower, and this.upperLimit is set to upper.

setMotor (speed:Float, force:Float):TranslationalLimitMotor

Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorForce is set to force.

\ No newline at end of file +this.motorSpeed is set to speed, and this.motorForce is set to force.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html index 8f2f97e..824a20f 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html @@ -35,4 +35,4 @@

See JointType for details.

inlinesetAllowCollision (allowCollision:Bool):Void

Sets whether to allow the connected rigid bodies to collide each other.

inlinesetBreakForce (breakForce:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetBreakTorque (breakTorque:Float):Void

Sets the magnitude of the constraint force at which the joint will be destroyed.

Set 0 for unbreakable joints.

inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

-

See PositionCorrectionAlgorithm for details.

\ No newline at end of file +

See PositionCorrectionAlgorithm for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html index 9742024..a816813 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html @@ -11,4 +11,4 @@

Set 0 for unbreakable joints.

breakTorque:Float

The joint will be destroyed when magnitude of the constraint torque exceeds the value.

Set 0 for unbreakable joints.

localAnchor1:Vec3

The local position of the first rigid body's anchor point.

localAnchor2:Vec3

The local position of the second rigid body's anchor point.

positionCorrectionAlgorithm:Int

The type of the position correction algorithm for the joint.

See PositionCorrectionAlgorithm for details.

rigidBody1:RigidBody

The first rigid body attached to the joint.

rigidBody2:RigidBody

The second rigid body attached to the joint.

solverType:Int

The type of the constraint solver for the joint.

-

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file +

See ConstraintSolverType for details.

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/index.html b/docs/oimo/dynamics/constraint/joint/index.html index 95bfb6c..7cc1382 100644 --- a/docs/oimo/dynamics/constraint/joint/index.html +++ b/docs/oimo/dynamics/constraint/joint/index.html @@ -41,4 +41,4 @@ to each other. Rigid bodies can rotate along their constraint axes, but cannot along the direction perpendicular to two constraint axes. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects -of the two rotational constraints.

UniversalJointConfig

A universal joint config is used for constructions of universal joints.

\ No newline at end of file +of the two rotational constraints.

UniversalJointConfig

A universal joint config is used for constructions of universal joints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html index 7db407c..8151f08 100644 --- a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html +++ b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

The list of the constraint solvers.

Static variables

@:value(_DIRECT)staticread onlyDIRECT:Int = _DIRECT

Direct constraint solver. Very stable but not suitable for a situation where fast -computation is required.

@:value(_ITERATIVE)staticread onlyITERATIVE:Int = _ITERATIVE

Iterative constraint solver. Fast and stable enough for common usages.

\ No newline at end of file +computation is required.

@:value(_ITERATIVE)staticread onlyITERATIVE:Int = _ITERATIVE

Iterative constraint solver. Fast and stable enough for common usages.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html index 43b2f64..0d6d6c3 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html @@ -8,4 +8,4 @@ float: none; text-shadow: 0 0 0 transparent;

The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file +joint constraints.

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/index.html b/docs/oimo/dynamics/constraint/solver/direct/index.html index a2338ce..36c9f59 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/index.html +++ b/docs/oimo/dynamics/constraint/solver/direct/index.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

oimo.dynamics.constraint.solver.direct

OimoPhysics API Documentation

..
DirectJointConstraintSolver

The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

\ No newline at end of file +joint constraints.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/index.html b/docs/oimo/dynamics/constraint/solver/index.html index 2eb201c..487cd21 100644 --- a/docs/oimo/dynamics/constraint/solver/index.html +++ b/docs/oimo/dynamics/constraint/solver/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.dynamics.constraint.solver

OimoPhysics API Documentation

..
direct
pgs
ConstraintSolverType

The list of the constraint solvers.

\ No newline at end of file +

oimo.dynamics.constraint.solver

OimoPhysics API Documentation

..
direct
pgs
ConstraintSolverType

The list of the constraint solvers.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html index 6060b16..81d76f4 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html @@ -7,4 +7,4 @@ float: none; text-shadow: 0 0 0 transparent;

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

Defined by ConstraintSolver

postSolveVelocity (timeStep:TimeStep):Void

Performs post-processes of velocity part. Time step information timeStep is given -for computing time-depending data.

\ No newline at end of file +for computing time-depending data.

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html index c911f96..d9bf294 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file +

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

Methods

Inherited Variables

Inherited Methods

\ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/index.html b/docs/oimo/dynamics/constraint/solver/pgs/index.html index 9bded93..0bab4a6 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/index.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo.dynamics.constraint.solver.pgs

OimoPhysics API Documentation

..
PgsContactConstraintSolver

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

PgsJointConstraintSolver

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

\ No newline at end of file +

oimo.dynamics.constraint.solver.pgs

OimoPhysics API Documentation

..
PgsContactConstraintSolver

A contact constraint solver using projected Gauss-Seidel (sequential impulse).

PgsJointConstraintSolver

A joint constraint solver using projected Gauss-Seidel (sequential impulse).

\ No newline at end of file diff --git a/docs/oimo/dynamics/index.html b/docs/oimo/dynamics/index.html index 5eb84e1..ed93019 100644 --- a/docs/oimo/dynamics/index.html +++ b/docs/oimo/dynamics/index.html @@ -12,4 +12,4 @@ See also JointLink.

ContactManager

The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and is destroyed when they end overlapping.

TimeStep

Information of time-step sizes of the simulation.

World

The physics simulation world. This manages entire the dynamic simulation. You can add -rigid bodies and joints to the world to simulate them.

\ No newline at end of file +rigid bodies and joints to the world to simulate them.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/MassData.html b/docs/oimo/dynamics/rigidbody/MassData.html index 2319686..10e9255 100644 --- a/docs/oimo/dynamics/rigidbody/MassData.html +++ b/docs/oimo/dynamics/rigidbody/MassData.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

This class holds mass and moment of inertia for a rigid body.

Constructor

new ()

Default constructor.

Variables

localInertia:Mat3

Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

mass:Float

Mass. 0 for a non-dynamic rigid body.

\ No newline at end of file +

This class holds mass and moment of inertia for a rigid body.

Constructor

new ()

Default constructor.

Variables

localInertia:Mat3

Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

mass:Float

Mass. 0 for a non-dynamic rigid body.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBody.html b/docs/oimo/dynamics/rigidbody/RigidBody.html index a71e480..775def6 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBody.html +++ b/docs/oimo/dynamics/rigidbody/RigidBody.html @@ -46,4 +46,4 @@

This does not keep any references to transform.

setType (type:Int):Void

Sets the rigid body's type of behaviour.

See RigidBodyType class for details.

inlinesleep ():Void

Sets the rigid body's sleep flag true.

This also resets the sleeping timer of the rigid body.

inlinetranslate (translation:Vec3):Void

Translates the position of the rigid body by translation.

inlinewakeUp ():Void

Sets the rigid body's sleep flag false.

-

This also resets the sleeping timer of the rigid body.

\ No newline at end of file +

This also resets the sleeping timer of the rigid body.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html index d5b1592..a779890 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html @@ -13,4 +13,4 @@ this class.

Constructor

new ()

Default constructor.

Variables

angularDamping:Float

The damping coefficient of the angular velocity. Set positive values to gradually reduce the angular velocity.

angularVelocity:Vec3

The initial value of the rigid body's angular velocity.

autoSleep:Bool

Whether to automatically sleep the rigid body when it stops moving for a certain period of time, namely Setting.sleepingTimeThreshold.

linearDamping:Float

The damping coefficient of the linear velocity. Set positive values to -gradually reduce the linear velocity.

linearVelocity:Vec3

The initial value of the rigid body's linear velocity.

position:Vec3

The world position of the rigid body's center of gravity.

rotation:Mat3

The rotation matrix of the rigid body.

type:Int

The rigid body's motion type. See RigidBodyType for details.

\ No newline at end of file +gradually reduce the linear velocity.

linearVelocity:Vec3

The initial value of the rigid body's linear velocity.

position:Vec3

The world position of the rigid body's center of gravity.

rotation:Mat3

The rotation matrix of the rigid body.

type:Int

The rigid body's motion type. See RigidBodyType for details.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyType.html b/docs/oimo/dynamics/rigidbody/RigidBodyType.html index 97834c6..1624714 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyType.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyType.html @@ -11,4 +11,4 @@ that it can have non-zero linear and angular velocities. This is useful for overlapping rigid bodies to pre-computed motions.

@:value(_STATIC)staticread onlySTATIC:Int = _STATIC

Represents a static rigid body. A static rigid body has zero velocities and infinite mass and inertia tensor. The rigid body is not affected by any force or impulse, such as gravity, -constraints, or external forces or impulses added by an user.

\ No newline at end of file +constraints, or external forces or impulses added by an user.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/Shape.html b/docs/oimo/dynamics/rigidbody/Shape.html index 73709c7..a9b53b3 100644 --- a/docs/oimo/dynamics/rigidbody/Shape.html +++ b/docs/oimo/dynamics/rigidbody/Shape.html @@ -21,4 +21,4 @@ rigid body.

inlinegetTransform ():Transform

Returns the world transform of the shape.

inlinegetTransformTo (transform:Transform):Void

Sets transform to the world transform of the shape.

This does not create a new instance of Transform.

inlinesetCollisionGroup (collisionGroup:Int):Void

Sets the shape's collision group bits to collisionGroup.

inlinesetCollisionMask (collisionMask:Int):Void

Sets the shape's collision mask bits to collisionMask.

inlinesetContactCallback (callback:ContactCallback):Void

Sets the contact callback of the shape to callback.

inlinesetDensity (density:Float):Void

Sets the density of the shape to density.

This affects the parent rigid body's mass data.

inlinesetFriction (friction:Float):Void

Sets the coefficient of friction to friction.

inlinesetLocalTransform (transform:Transform):Void

Sets the shape's transform to transform relative to the parent rigid body's transform.

-

This affects the parent rigid body's mass data.

inlinesetRestitution (restitution:Float):Void

Sets the coefficient of restitution to restitution.

\ No newline at end of file +

This affects the parent rigid body's mass data.

inlinesetRestitution (restitution:Float):Void

Sets the coefficient of restitution to restitution.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/ShapeConfig.html b/docs/oimo/dynamics/rigidbody/ShapeConfig.html index 593ab01..399b498 100644 --- a/docs/oimo/dynamics/rigidbody/ShapeConfig.html +++ b/docs/oimo/dynamics/rigidbody/ShapeConfig.html @@ -20,4 +20,4 @@ shape1.collisionGroup & shape2.collisionMask and shape2.collisionGroup & shape1.collisionMask are not zero.

contactCallback:ContactCallback

The contact callback of the shape. The callback methods are called when contact events the shape is involved occurred.

density:Float

The density of the shape, usually in Kg/m^3.

friction:Float

The coefficient of friction of the shape.

geometry:Geometry

The collision geometry of the shape.

position:Vec3

The shape's local position relative to the parent rigid body's origin.

restitution:Float

The coefficient of restitution of the shape.

rotation:Mat3

The shape's local rotation matrix relative to the parent rigid body's -rotation.

\ No newline at end of file +rotation.

\ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/index.html b/docs/oimo/dynamics/rigidbody/index.html index c93d473..3230454 100644 --- a/docs/oimo/dynamics/rigidbody/index.html +++ b/docs/oimo/dynamics/rigidbody/index.html @@ -16,4 +16,4 @@ with some physical properties such as coefficients of friction and restitution. The collision geometry can locally be transformed relative to the parent rigid body's center of gravity.

ShapeConfig

A shape configuration is used for construction of shapes. An instance of this class can safely be reused as a shape will not have any references -of a field of this class.

\ No newline at end of file +of a field of this class.

\ No newline at end of file diff --git a/docs/oimo/index.html b/docs/oimo/index.html index e07c210..d881332 100644 --- a/docs/oimo/index.html +++ b/docs/oimo/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

oimo

OimoPhysics API Documentation

..
collision
common
dynamics
\ No newline at end of file +

oimo

OimoPhysics API Documentation

..
collision
common
dynamics
\ No newline at end of file From 2ed1fc7c2f04bf3a37fbd741f79071b64314fd5f Mon Sep 17 00:00:00 2001 From: saharan Date: Mon, 2 Mar 2020 22:34:25 +0900 Subject: [PATCH 09/13] edit README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9371f5d..428c111 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A lightweight 3D physics engine. * Exported as JavaScript (see [bin/js/](./bin/js)) * Public classes and methods are exposed through `window.OIMO`. * e.g. `new OIMO.Vec3(1, 2, 3)` to create an instance of `Vec3` class. -* Exported as a Node.js module with TypeScript declarations (see [package.json](./package.json) and [bin/js_modules](./bin/js_modules)) +* Exported as JavaScript (module) with TypeScript Declaration (see [package.json](./package.json) and [bin/js_modules](./bin/js_modules)) ## Features * Rigid body with motion types From 2da651ca30ab8bd1e031caec1e32df938554b0e4 Mon Sep 17 00:00:00 2001 From: shr Date: Thu, 22 Apr 2021 03:14:15 +0900 Subject: [PATCH 10/13] modified hxml and cleaned up the exported js file --- bin/js_modules/OimoPhysics.d.ts | 2 +- bin/js_modules/OimoPhysics.js | 57493 +++++++++++------------------- build-js-ts.hxml | 1 + 3 files changed, 19844 insertions(+), 37652 deletions(-) diff --git a/bin/js_modules/OimoPhysics.d.ts b/bin/js_modules/OimoPhysics.d.ts index 953cbbd..0b66561 100644 --- a/bin/js_modules/OimoPhysics.d.ts +++ b/bin/js_modules/OimoPhysics.d.ts @@ -5697,4 +5697,4 @@ export namespace oimo.dynamics.rigidbody { */ static readonly KINEMATIC: number; } -} \ No newline at end of file +} diff --git a/bin/js_modules/OimoPhysics.js b/bin/js_modules/OimoPhysics.js index bb0a490..10e2c56 100644 --- a/bin/js_modules/OimoPhysics.js +++ b/bin/js_modules/OimoPhysics.js @@ -1,3 +1,4 @@ +// Generated by Haxe 4.2.0 var oimo = oimo || {}; if(!oimo.collision) oimo.collision = {}; if(!oimo.collision.broadphase) oimo.collision.broadphase = {}; @@ -70,40 +71,36 @@ oimo.collision.geometry.Geometry = class oimo_collision_geometry_Geometry { return this._volume; } rayCast(begin,end,transform,hit) { - var beginLocal; - var beginLocalX; - var beginLocalY; - var beginLocalZ; - var endLocal; - var endLocalX; - var endLocalY; - var endLocalZ; - var v = begin; - beginLocalX = v.x; - beginLocalY = v.y; - beginLocalZ = v.z; - var v1 = end; - endLocalX = v1.x; - endLocalY = v1.y; - endLocalZ = v1.z; + let beginLocalX; + let beginLocalY; + let beginLocalZ; + let endLocalX; + let endLocalY; + let endLocalZ; + beginLocalX = begin.x; + beginLocalY = begin.y; + beginLocalZ = begin.z; + endLocalX = end.x; + endLocalY = end.y; + endLocalZ = end.z; beginLocalX -= transform._positionX; beginLocalY -= transform._positionY; beginLocalZ -= transform._positionZ; endLocalX -= transform._positionX; endLocalY -= transform._positionY; endLocalZ -= transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = transform._rotation00 * beginLocalX + transform._rotation10 * beginLocalY + transform._rotation20 * beginLocalZ; __tmp__Y = transform._rotation01 * beginLocalX + transform._rotation11 * beginLocalY + transform._rotation21 * beginLocalZ; __tmp__Z = transform._rotation02 * beginLocalX + transform._rotation12 * beginLocalY + transform._rotation22 * beginLocalZ; beginLocalX = __tmp__X; beginLocalY = __tmp__Y; beginLocalZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; __tmp__Y1 = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; __tmp__Z1 = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; @@ -111,51 +108,49 @@ oimo.collision.geometry.Geometry = class oimo_collision_geometry_Geometry { endLocalY = __tmp__Y1; endLocalZ = __tmp__Z1; if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { - var localPos; - var localPosX; - var localPosY; - var localPosZ; - var localNormal; - var localNormalX; - var localNormalY; - var localNormalZ; - var v2 = hit.position; - localPosX = v2.x; - localPosY = v2.y; - localPosZ = v2.z; - var v3 = hit.normal; - localNormalX = v3.x; - localNormalY = v3.y; - localNormalZ = v3.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; - __tmp__Y2 = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; - __tmp__Z2 = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; - localPosX = __tmp__X2; - localPosY = __tmp__Y2; - localPosZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; - __tmp__Y3 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; - __tmp__Z3 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; - localNormalX = __tmp__X3; - localNormalY = __tmp__Y3; - localNormalZ = __tmp__Z3; + let localPosX; + let localPosY; + let localPosZ; + let localNormalX; + let localNormalY; + let localNormalZ; + let v = hit.position; + localPosX = v.x; + localPosY = v.y; + localPosZ = v.z; + let v1 = hit.normal; + localNormalX = v1.x; + localNormalY = v1.y; + localNormalZ = v1.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; + __tmp__Y = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; + __tmp__Z = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; + localPosX = __tmp__X; + localPosY = __tmp__Y; + localPosZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; + __tmp__Y1 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; + __tmp__Z1 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; + localNormalX = __tmp__X1; + localNormalY = __tmp__Y1; + localNormalZ = __tmp__Z1; localPosX += transform._positionX; localPosY += transform._positionY; localPosZ += transform._positionZ; - var v4 = hit.position; - v4.x = localPosX; - v4.y = localPosY; - v4.z = localPosZ; - var v5 = hit.normal; - v5.x = localNormalX; - v5.y = localNormalY; - v5.z = localNormalZ; + let v2 = hit.position; + v2.x = localPosX; + v2.y = localPosY; + v2.z = localPosZ; + let v3 = hit.normal; + v3.x = localNormalX; + v3.y = localNormalY; + v3.z = localNormalZ; return true; } return false; @@ -193,21 +188,18 @@ oimo.collision.broadphase._BroadPhase.ConvexSweepGeometry = class oimo_collision } init(c,transform,translation) { this.c = c; - var tr; - var trX; - var trY; - var trZ; - var v = translation; - trX = v.x; - trY = v.y; - trZ = v.z; - var localTr; - var localTrX; - var localTrY; - var localTrZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let trX; + let trY; + let trZ; + trX = translation.x; + trY = translation.y; + trZ = translation.z; + let localTrX; + let localTrY; + let localTrZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = transform._rotation00 * trX + transform._rotation10 * trY + transform._rotation20 * trZ; __tmp__Y = transform._rotation01 * trX + transform._rotation11 * trY + transform._rotation21 * trZ; __tmp__Z = transform._rotation02 * trX + transform._rotation12 * trY + transform._rotation22 * trZ; @@ -215,23 +207,20 @@ oimo.collision.broadphase._BroadPhase.ConvexSweepGeometry = class oimo_collision localTrY = __tmp__Y; localTrZ = __tmp__Z; this.localTranslation = new oimo.common.Vec3(); - var v1 = this.localTranslation; - v1.x = localTrX; - v1.y = localTrY; - v1.z = localTrZ; + let v = this.localTranslation; + v.x = localTrX; + v.y = localTrY; + v.z = localTrZ; this._gjkMargin = c._gjkMargin; } computeLocalSupportingVertex(dir,out) { this.c.computeLocalSupportingVertex(dir,out); - var v = this.localTranslation; + let v = this.localTranslation; if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { - var v1 = this.localTranslation; - var tx = out.x + v1.x; - var ty = out.y + v1.y; - var tz = out.z + v1.z; - out.x = tx; - out.y = ty; - out.z = tz; + let v = this.localTranslation; + out.x += v.x; + out.y += v.y; + out.z += v.z; } } } @@ -272,7 +261,7 @@ oimo.collision.broadphase.Proxy = class oimo_collision_broadphase_Proxy { return this._id; } getFatAabb() { - var aabb = new oimo.collision.geometry.Aabb(); + let aabb = new oimo.collision.geometry.Aabb(); aabb._minX = this._aabbMinX; aabb._minY = this._aabbMinY; aabb._minZ = this._aabbMinZ; @@ -312,7 +301,7 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision this._incremental = false; } createProxy(userData,aabb) { - var proxy = new oimo.collision.broadphase.Proxy(userData,this._idCount++); + let proxy = new oimo.collision.broadphase.Proxy(userData,this._idCount++); this._numProxies++; if(this._proxyList == null) { this._proxyList = proxy; @@ -332,8 +321,8 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision } destroyProxy(proxy) { this._numProxies--; - var prev = proxy._prev; - var next = proxy._next; + let prev = proxy._prev; + let next = proxy._next; if(prev != null) { prev._next = next; } @@ -359,7 +348,7 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision proxy._aabbMaxZ = aabb._maxZ; } collectPairs() { - var p = this._proxyPairList; + let p = this._proxyPairList; if(p != null) { while(true) { p._p1 = null; @@ -374,22 +363,22 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision this._proxyPairList = null; } this._testCount = 0; - var p1 = this._proxyList; + let p1 = this._proxyList; while(p1 != null) { - var n = p1._next; - var p2 = p1._next; + let n = p1._next; + let p2 = p1._next; while(p2 != null) { - var n1 = p2._next; + let n = p2._next; this._testCount++; if(p1._aabbMinX < p2._aabbMaxX && p1._aabbMaxX > p2._aabbMinX && p1._aabbMinY < p2._aabbMaxY && p1._aabbMaxY > p2._aabbMinY && p1._aabbMinZ < p2._aabbMaxZ && p1._aabbMaxZ > p2._aabbMinZ) { - var first = this._proxyPairPool; + let first = this._proxyPairPool; if(first != null) { this._proxyPairPool = first._next; first._next = null; } else { first = new oimo.collision.broadphase.ProxyPair(); } - var pp = first; + let pp = first; if(this._proxyPairList == null) { this._proxyPairList = pp; } else { @@ -399,101 +388,67 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision pp._p1 = p1; pp._p2 = p2; } - p2 = n1; + p2 = n; } p1 = n; } } rayCast(begin,end,callback) { - var p1; - var p1X; - var p1Y; - var p1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - var dir; - var dirX; - var dirY; - var dirZ; - var v = begin; - p1X = v.x; - p1Y = v.y; - p1Z = v.z; - var v1 = end; - p2X = v1.x; - p2Y = v1.y; - p2Z = v1.z; - dirX = p2X - p1X; - dirY = p2Y - p1Y; - dirZ = p2Z - p1Z; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; - minX = p1X < p2X ? p1X : p2X; - minY = p1Y < p2Y ? p1Y : p2Y; - minZ = p1Z < p2Z ? p1Z : p2Z; - maxX = p1X > p2X ? p1X : p2X; - maxY = p1Y > p2Y ? p1Y : p2Y; - maxZ = p1Z > p2Z ? p1Z : p2Z; - var p = this._proxyList; + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; + let p = this._proxyList; while(p != null) { - var n = p._next; - var x1 = p1X; - var y1 = p1Y; - var z1 = p1Z; - var x2 = p2X; - var y2 = p2Y; - var z2 = p2Z; - var sminx = x1 < x2 ? x1 : x2; - var sminy = y1 < y2 ? y1 : y2; - var sminz = z1 < z2 ? z1 : z2; - var smaxx = x1 > x2 ? x1 : x2; - var smaxy = y1 > y2 ? y1 : y2; - var smaxz = z1 > z2 ? z1 : z2; - var pminx = p._aabbMinX; - var pminy = p._aabbMinY; - var pminz = p._aabbMinZ; - var pmaxx = p._aabbMaxX; - var pmaxy = p._aabbMaxY; - var pmaxz = p._aabbMaxZ; - var tmp; - if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + let n = p._next; + let x1 = p1X; + let y1 = p1Y; + let z1 = p1Z; + let x2 = p2X; + let y2 = p2Y; + let z2 = p2Z; + let pminx = p._aabbMinX; + let pminy = p._aabbMinY; + let pminz = p._aabbMinZ; + let pmaxx = p._aabbMaxX; + let pmaxy = p._aabbMaxY; + let pmaxz = p._aabbMaxZ; + let tmp; + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { - var dx = x2 - x1; - var dy = y2 - y1; - var dz = z2 - z1; - var adx = dx < 0 ? -dx : dx; - var ady = dy < 0 ? -dy : dy; - var adz = dz < 0 ? -dz : dz; - var pextx = (pmaxx - pminx) * 0.5; - var pexty = (pmaxy - pminy) * 0.5; - var pextz = (pmaxz - pminz) * 0.5; - var pcntx = (pmaxx + pminx) * 0.5; - var pcnty = (pmaxy + pminy) * 0.5; - var pcntz = (pmaxz + pminz) * 0.5; - var cpx = x1 - pcntx; - var cpy = y1 - pcnty; - var cpz = z1 - pcntz; - var tmp1; - var tmp2; - var x = cpy * dz - cpz * dy; + let dx = x2 - x1; + let dy = y2 - y1; + let dz = z2 - z1; + let adx = dx < 0 ? -dx : dx; + let ady = dy < 0 ? -dy : dy; + let adz = dz < 0 ? -dz : dz; + let pextx = (pmaxx - pminx) * 0.5; + let pexty = (pmaxy - pminy) * 0.5; + let pextz = (pmaxz - pminz) * 0.5; + let cpx = x1 - (pmaxx + pminx) * 0.5; + let cpy = y1 - (pmaxy + pminy) * 0.5; + let cpz = z1 - (pmaxz + pminz) * 0.5; + let tmp1; + let tmp2; + let x = cpy * dz - cpz * dy; if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { - var x3 = cpz * dx - cpx * dz; - tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + let x = cpz * dx - cpx * dz; + tmp2 = (x < 0 ? -x : x) - (pextz * adx + pextx * adz) > 0; } else { tmp2 = true; } if(!tmp2) { - var x4 = cpx * dy - cpy * dx; - tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + let x = cpx * dy - cpy * dx; + tmp1 = (x < 0 ? -x : x) - (pextx * ady + pexty * adx) > 0; } else { tmp1 = true; } @@ -506,19 +461,19 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision } } convexCast(convex,begin,translation,callback) { - var p = this._proxyList; + let p = this._proxyList; while(p != null) { - var n = p._next; - var v = this._aabb.min; + let n = p._next; + let v = this._aabb.min; v.x = p._aabbMinX; v.y = p._aabbMinY; v.z = p._aabbMinZ; - var v1 = this._aabb.max; + let v1 = this._aabb.max; v1.x = p._aabbMaxX; v1.y = p._aabbMaxY; v1.z = p._aabbMaxZ; this._convexSweep.init(convex,begin,translation); - var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + let gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; if(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0) { callback.process(p); } @@ -526,9 +481,9 @@ oimo.collision.broadphase.bruteforce.BruteForceBroadPhase = class oimo_collision } } aabbTest(aabb,callback) { - var p = this._proxyList; + let p = this._proxyList; while(p != null) { - var n = p._next; + let n = p._next; if(aabb._minX < p._aabbMaxX && aabb._maxX > p._aabbMinX && aabb._minY < p._aabbMaxY && aabb._maxY > p._aabbMinY && aabb._minZ < p._aabbMaxZ && aabb._maxZ > p._aabbMinZ) { callback.process(p); } @@ -542,14 +497,13 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv super(2); this._incremental = true; this._tree = new oimo.collision.broadphase.bvh.BvhTree(); - var this1 = new Array(1024); - this.movedProxies = this1; + this.movedProxies = new Array(1024); this.numMovedProxies = 0; } collide(n1,n2) { this._testCount++; - var l1 = n1._height == 0; - var l2 = n2._height == 0; + let l1 = n1._height == 0; + let l2 = n2._height == 0; if(n1 == n2) { if(l1) { return; @@ -562,24 +516,22 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv return; } if(l1 && l2) { - var p1 = n1._proxy; - var p2 = n2._proxy; - var first = this._proxyPairPool; + let first = this._proxyPairPool; if(first != null) { this._proxyPairPool = first._next; first._next = null; } else { first = new oimo.collision.broadphase.ProxyPair(); } - var pp = first; + let pp = first; if(this._proxyPairList == null) { this._proxyPairList = pp; } else { pp._next = this._proxyPairList; this._proxyPairList = pp; } - pp._p1 = p1; - pp._p2 = p2; + pp._p1 = n1._proxy; + pp._p2 = n2._proxy; return; } if(l2 || n1._height > n2._height) { @@ -591,69 +543,46 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } } rayCastRecursive(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { - var p1; - var p1X; - var p1Y; - var p1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - p1X = _p1X; - p1Y = _p1Y; - p1Z = _p1Z; - p2X = _p2X; - p2Y = _p2Y; - p2Z = _p2Z; - var x1 = p1X; - var y1 = p1Y; - var z1 = p1Z; - var x2 = p2X; - var y2 = p2Y; - var z2 = p2Z; - var sminx = x1 < x2 ? x1 : x2; - var sminy = y1 < y2 ? y1 : y2; - var sminz = z1 < z2 ? z1 : z2; - var smaxx = x1 > x2 ? x1 : x2; - var smaxy = y1 > y2 ? y1 : y2; - var smaxz = z1 > z2 ? z1 : z2; - var pminx = node._aabbMinX; - var pminy = node._aabbMinY; - var pminz = node._aabbMinZ; - var pmaxx = node._aabbMaxX; - var pmaxy = node._aabbMaxY; - var pmaxz = node._aabbMaxZ; - var tmp; - if(pminx > smaxx || pmaxx < sminx || pminy > smaxy || pmaxy < sminy || pminz > smaxz || pmaxz < sminz) { + let x1 = _p1X; + let y1 = _p1Y; + let z1 = _p1Z; + let x2 = _p2X; + let y2 = _p2Y; + let z2 = _p2Z; + let pminx = node._aabbMinX; + let pminy = node._aabbMinY; + let pminz = node._aabbMinZ; + let pmaxx = node._aabbMaxX; + let pmaxy = node._aabbMaxY; + let pmaxz = node._aabbMaxZ; + let tmp; + if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { - var dx = x2 - x1; - var dy = y2 - y1; - var dz = z2 - z1; - var adx = dx < 0 ? -dx : dx; - var ady = dy < 0 ? -dy : dy; - var adz = dz < 0 ? -dz : dz; - var pextx = (pmaxx - pminx) * 0.5; - var pexty = (pmaxy - pminy) * 0.5; - var pextz = (pmaxz - pminz) * 0.5; - var pcntx = (pmaxx + pminx) * 0.5; - var pcnty = (pmaxy + pminy) * 0.5; - var pcntz = (pmaxz + pminz) * 0.5; - var cpx = x1 - pcntx; - var cpy = y1 - pcnty; - var cpz = z1 - pcntz; - var tmp1; - var tmp2; - var x = cpy * dz - cpz * dy; + let dx = x2 - x1; + let dy = y2 - y1; + let dz = z2 - z1; + let adx = dx < 0 ? -dx : dx; + let ady = dy < 0 ? -dy : dy; + let adz = dz < 0 ? -dz : dz; + let pextx = (pmaxx - pminx) * 0.5; + let pexty = (pmaxy - pminy) * 0.5; + let pextz = (pmaxz - pminz) * 0.5; + let cpx = x1 - (pmaxx + pminx) * 0.5; + let cpy = y1 - (pmaxy + pminy) * 0.5; + let cpz = z1 - (pmaxz + pminz) * 0.5; + let tmp1; + let tmp2; + let x = cpy * dz - cpz * dy; if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { - var x3 = cpz * dx - cpx * dz; - tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + let x = cpz * dx - cpx * dz; + tmp2 = (x < 0 ? -x : x) - (pextz * adx + pextx * adz) > 0; } else { tmp2 = true; } if(!tmp2) { - var x4 = cpx * dy - cpy * dx; - tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + let x = cpx * dy - cpy * dx; + tmp1 = (x < 0 ? -x : x) - (pextx * ady + pexty * adx) > 0; } else { tmp1 = true; } @@ -666,20 +595,20 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv callback.process(node._proxy); return; } - this.rayCastRecursive(node._children[0],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); - this.rayCastRecursive(node._children[1],p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); + this.rayCastRecursive(node._children[0],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); + this.rayCastRecursive(node._children[1],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); } convexCastRecursive(node,convex,begin,translation,callback) { - var v = this._aabb.min; + let v = this._aabb.min; v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = this._aabb.max; + let v1 = this._aabb.max; v1.x = node._aabbMaxX; v1.y = node._aabbMaxY; v1.z = node._aabbMaxZ; this._convexSweep.init(convex,begin,translation); - var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + let gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; if(!(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0)) { return; } @@ -702,7 +631,7 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv this.aabbTestRecursive(node._children[1],aabb,callback); } createProxy(userData,aabb) { - var p = new oimo.collision.broadphase.bvh.BvhProxy(userData,this._idCount++); + let p = new oimo.collision.broadphase.bvh.BvhProxy(userData,this._idCount++); this._numProxies++; if(this._proxyList == null) { this._proxyList = p; @@ -712,73 +641,28 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv p._prev = this._proxyListLast; this._proxyListLast = p; } - var displacement = null; p._aabbMinX = aabb._minX; p._aabbMinY = aabb._minY; p._aabbMinZ = aabb._minZ; p._aabbMaxX = aabb._maxX; p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; - var padding = oimo.common.Setting.bvhProxyPadding; - var paddingVec; - var paddingVecX; - var paddingVecY; - var paddingVecZ; - paddingVecX = padding; - paddingVecY = padding; - paddingVecZ = padding; - p._aabbMinX -= paddingVecX; - p._aabbMinY -= paddingVecY; - p._aabbMinZ -= paddingVecZ; - p._aabbMaxX += paddingVecX; - p._aabbMaxY += paddingVecY; - p._aabbMaxZ += paddingVecZ; - if(displacement != null) { - var d; - var dX; - var dY; - var dZ; - var zero; - var zeroX; - var zeroY; - var zeroZ; - var addToMin; - var addToMinX; - var addToMinY; - var addToMinZ; - var addToMax; - var addToMaxX; - var addToMaxY; - var addToMaxZ; - zeroX = 0; - zeroY = 0; - zeroZ = 0; - var v = displacement; - dX = v.x; - dY = v.y; - dZ = v.z; - addToMinX = zeroX < dX ? zeroX : dX; - addToMinY = zeroY < dY ? zeroY : dY; - addToMinZ = zeroZ < dZ ? zeroZ : dZ; - addToMaxX = zeroX > dX ? zeroX : dX; - addToMaxY = zeroY > dY ? zeroY : dY; - addToMaxZ = zeroZ > dZ ? zeroZ : dZ; - p._aabbMinX += addToMinX; - p._aabbMinY += addToMinY; - p._aabbMinZ += addToMinZ; - p._aabbMaxX += addToMaxX; - p._aabbMaxY += addToMaxY; - p._aabbMaxZ += addToMaxZ; - } - var _this = this._tree; - var first = _this._nodePool; + let padding = oimo.common.Setting.bvhProxyPadding; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; + let _this = this._tree; + let first = _this._nodePool; if(first != null) { _this._nodePool = first._next; first._next = null; } else { first = new oimo.collision.broadphase.bvh.BvhNode(); } - var leaf = first; + let leaf = first; leaf._proxy = p; p._leaf = leaf; leaf._aabbMinX = p._aabbMinX; @@ -799,86 +683,79 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv if(_this._root == null) { _this._root = leaf; } else { - var sibling = _this._root; + let sibling = _this._root; while(sibling._height > 0) { - var nextStep = _this._strategy._decideInsertion(sibling,leaf); + let nextStep = _this._strategy._decideInsertion(sibling,leaf); if(nextStep == -1) { break; } else { sibling = sibling._children[nextStep]; } } - var parent = sibling._parent; - var first1 = _this._nodePool; - if(first1 != null) { - _this._nodePool = first1._next; - first1._next = null; + let parent = sibling._parent; + let first = _this._nodePool; + if(first != null) { + _this._nodePool = first._next; + first._next = null; } else { - first1 = new oimo.collision.broadphase.bvh.BvhNode(); + first = new oimo.collision.broadphase.bvh.BvhNode(); } - var node = first1; + let node = first; if(parent == null) { _this._root = node; } else { - var index = sibling._childIndex; + let index = sibling._childIndex; parent._children[index] = node; node._parent = parent; node._childIndex = index; } - var index1 = sibling._childIndex; - node._children[index1] = sibling; + let index = sibling._childIndex; + node._children[index] = sibling; sibling._parent = node; - sibling._childIndex = index1; - var index2 = sibling._childIndex ^ 1; - node._children[index2] = leaf; + sibling._childIndex = index; + let index1 = sibling._childIndex ^ 1; + node._children[index1] = leaf; leaf._parent = node; - leaf._childIndex = index2; + leaf._childIndex = index1; while(node != null) { if(_this._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { - node = node; - } else { - var p1 = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; - var nodeIndex = node._childIndex; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + let ll = l._children[0]; + let lr = l._children[1]; + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -887,32 +764,32 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p1 != null) { - p1._children[nodeIndex] = l; - l._parent = p1; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; l._childIndex = nodeIndex; } else { _this._root = l; @@ -920,39 +797,37 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + let rl = r._children[0]; + let rr = r._children[1]; + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -960,67 +835,63 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p1 != null) { - p1._children[nodeIndex] = r; - r._parent = p1; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; r._childIndex = nodeIndex; } else { _this._root = r; r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newLength = this.numMovedProxies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.numMovedProxies; + let newArray = new Array(this.numMovedProxies << 1); + let _g = 0; + let _g1 = this.numMovedProxies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1032,8 +903,8 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } destroyProxy(proxy) { this._numProxies--; - var prev = proxy._prev; - var next = proxy._next; + let prev = proxy._prev; + let next = proxy._next; if(prev != null) { prev._next = next; } @@ -1048,12 +919,12 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } proxy._next = null; proxy._prev = null; - var bvhProxy = proxy; - var _this = this._tree; - var leaf = bvhProxy._leaf; + let bvhProxy = proxy; + let _this = this._tree; + let leaf = bvhProxy._leaf; _this._numLeaves--; - var prev1 = leaf._prevLeaf; - var next1 = leaf._nextLeaf; + let prev1 = leaf._prevLeaf; + let next1 = leaf._nextLeaf; if(prev1 != null) { prev1._nextLeaf = next1; } @@ -1071,9 +942,9 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv if(_this._root == leaf) { _this._root = null; } else { - var parent = leaf._parent; - var sibling = parent._children[leaf._childIndex ^ 1]; - var grandParent = parent._parent; + let parent = leaf._parent; + let sibling = parent._children[leaf._childIndex ^ 1]; + let grandParent = parent._parent; if(grandParent == null) { sibling._parent = null; sibling._childIndex = 0; @@ -1090,7 +961,7 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv _this._nodePool = parent; } else { sibling._parent = grandParent; - var index = parent._childIndex; + let index = parent._childIndex; grandParent._children[index] = sibling; sibling._parent = grandParent; sibling._childIndex = index; @@ -1104,53 +975,46 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv parent._proxy = null; parent._next = _this._nodePool; _this._nodePool = parent; - var node = grandParent; + let node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { - node = node; - } else { - var p = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; - var nodeIndex = node._childIndex; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + let ll = l._children[0]; + let lr = l._children[1]; + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -1159,28 +1023,28 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } if(p != null) { p._children[nodeIndex] = l; @@ -1192,39 +1056,37 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + let rl = r._children[0]; + let rr = r._children[1]; + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -1232,28 +1094,28 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } if(p != null) { p._children[nodeIndex] = r; @@ -1264,22 +1126,20 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } @@ -1303,7 +1163,7 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } } moveProxy(proxy,aabb,displacement) { - var p = proxy; + let p = proxy; if(p._aabbMinX <= aabb._minX && p._aabbMaxX >= aabb._maxX && p._aabbMinY <= aabb._minY && p._aabbMaxY >= aabb._maxY && p._aabbMinZ <= aabb._minZ && p._aabbMaxZ >= aabb._maxZ) { return; } @@ -1313,44 +1173,32 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv p._aabbMaxX = aabb._maxX; p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; - var padding = oimo.common.Setting.bvhProxyPadding; - var paddingVec; - var paddingVecX; - var paddingVecY; - var paddingVecZ; - paddingVecX = padding; - paddingVecY = padding; - paddingVecZ = padding; - p._aabbMinX -= paddingVecX; - p._aabbMinY -= paddingVecY; - p._aabbMinZ -= paddingVecZ; - p._aabbMaxX += paddingVecX; - p._aabbMaxY += paddingVecY; - p._aabbMaxZ += paddingVecZ; + let padding = oimo.common.Setting.bvhProxyPadding; + p._aabbMinX -= padding; + p._aabbMinY -= padding; + p._aabbMinZ -= padding; + p._aabbMaxX += padding; + p._aabbMaxY += padding; + p._aabbMaxZ += padding; if(displacement != null) { - var d; - var dX; - var dY; - var dZ; - var zero; - var zeroX; - var zeroY; - var zeroZ; - var addToMin; - var addToMinX; - var addToMinY; - var addToMinZ; - var addToMax; - var addToMaxX; - var addToMaxY; - var addToMaxZ; + let dX; + let dY; + let dZ; + let zeroX; + let zeroY; + let zeroZ; + let addToMinX; + let addToMinY; + let addToMinZ; + let addToMaxX; + let addToMaxY; + let addToMaxZ; zeroX = 0; zeroY = 0; zeroZ = 0; - var v = displacement; - dX = v.x; - dY = v.y; - dZ = v.z; + dX = displacement.x; + dY = displacement.y; + dZ = displacement.z; addToMinX = zeroX < dX ? zeroX : dX; addToMinY = zeroY < dY ? zeroY : dY; addToMinZ = zeroZ < dZ ? zeroZ : dZ; @@ -1367,13 +1215,11 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newLength = this.numMovedProxies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.numMovedProxies; + let newArray = new Array(this.numMovedProxies << 1); + let _g = 0; + let _g1 = this.numMovedProxies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1383,7 +1229,7 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv } } collectPairs() { - var p = this._proxyPairList; + let p = this._proxyPairList; if(p != null) { while(true) { p._p1 = null; @@ -1401,77 +1247,42 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv if(this._numProxies < 2) { return; } - var topDown = false; - if(topDown) { - while(this.numMovedProxies > 0) this.movedProxies[--this.numMovedProxies] = null; - var _this = this._tree; - if(_this._root != null) { - if(_this._root != null) { - _this.decomposeRecursive(_this._root); - _this._root = null; - } - while(_this.tmp.length < _this._numLeaves) { - var newLength = _this.tmp.length << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this.tmp.length; - while(_g < _g1) { - var i = _g++; - newArray[i] = _this.tmp[i]; - _this.tmp[i] = null; - } - _this.tmp = newArray; - } - var idx = 0; - var leaf = _this.leafList; - while(leaf != null) { - var n = leaf._nextLeaf; - _this.tmp[idx] = leaf; - ++idx; - leaf = n; - } - _this._root = _this.buildTopDownRecursive(_this.tmp,0,_this._numLeaves); - } - this.collide(this._tree._root,this._tree._root); - return; - } - var incrementalCollision = this.numMovedProxies / this._numProxies < oimo.common.Setting.bvhIncrementalCollisionThreshold; - var _g2 = 0; - var _g11 = this.numMovedProxies; - while(_g2 < _g11) { - var i1 = _g2++; - var p1 = this.movedProxies[i1]; - if(p1._moved) { - var _this1 = this._tree; - var leaf1 = p1._leaf; - _this1._numLeaves--; - var prev = leaf1._prevLeaf; - var next = leaf1._nextLeaf; + let incrementalCollision = this.numMovedProxies / this._numProxies < oimo.common.Setting.bvhIncrementalCollisionThreshold; + let _g = 0; + let _g1 = this.numMovedProxies; + while(_g < _g1) { + let i = _g++; + let p = this.movedProxies[i]; + if(p._moved) { + let _this = this._tree; + let leaf = p._leaf; + _this._numLeaves--; + let prev = leaf._prevLeaf; + let next = leaf._nextLeaf; if(prev != null) { prev._nextLeaf = next; } if(next != null) { next._prevLeaf = prev; } - if(leaf1 == _this1.leafList) { - _this1.leafList = _this1.leafList._nextLeaf; + if(leaf == _this.leafList) { + _this.leafList = _this.leafList._nextLeaf; } - if(leaf1 == _this1.leafListLast) { - _this1.leafListLast = _this1.leafListLast._prevLeaf; + if(leaf == _this.leafListLast) { + _this.leafListLast = _this.leafListLast._prevLeaf; } - leaf1._nextLeaf = null; - leaf1._prevLeaf = null; - if(_this1._root == leaf1) { - _this1._root = null; + leaf._nextLeaf = null; + leaf._prevLeaf = null; + if(_this._root == leaf) { + _this._root = null; } else { - var parent = leaf1._parent; - var sibling = parent._children[leaf1._childIndex ^ 1]; - var grandParent = parent._parent; + let parent = leaf._parent; + let sibling = parent._children[leaf._childIndex ^ 1]; + let grandParent = parent._parent; if(grandParent == null) { sibling._parent = null; sibling._childIndex = 0; - _this1._root = sibling; + _this._root = sibling; parent._next = null; parent._childIndex = 0; parent._children[0] = null; @@ -1480,11 +1291,11 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv parent._parent = null; parent._height = 0; parent._proxy = null; - parent._next = _this1._nodePool; - _this1._nodePool = parent; + parent._next = _this._nodePool; + _this._nodePool = parent; } else { sibling._parent = grandParent; - var index = parent._childIndex; + let index = parent._childIndex; grandParent._children[index] = sibling; sibling._parent = grandParent; sibling._childIndex = index; @@ -1496,55 +1307,48 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv parent._parent = null; parent._height = 0; parent._proxy = null; - parent._next = _this1._nodePool; - _this1._nodePool = parent; - var node = grandParent; + parent._next = _this._nodePool; + _this._nodePool = parent; + let node = grandParent; while(node != null) { - if(_this1._strategy._balancingEnabled) { - var nh = node._height; - if(nh < 2) { - node = node; - } else { - var p2 = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var lh = l._height; - var rh = r._height; - var balance = lh - rh; - var nodeIndex = node._childIndex; + if(_this._strategy._balancingEnabled) { + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; - var llh = ll._height; - var lrh = lr._height; - if(llh > lrh) { + let ll = l._children[0]; + let lr = l._children[1]; + if(ll._height > lr._height) { l._children[1] = node; node._parent = l; node._childIndex = 1; node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -1553,72 +1357,70 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = l; - l._parent = p2; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; l._childIndex = nodeIndex; } else { - _this1._root = l; + _this._root = l; l._parent = null; } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; - var rlh = rl._height; - var rrh = rr._height; - if(rlh > rrh) { + let rl = r._children[0]; + let rr = r._children[1]; + if(rl._height > rr._height) { r._children[1] = node; node._parent = r; node._childIndex = 1; node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -1626,316 +1428,303 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = r; - r._parent = p2; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; r._childIndex = nodeIndex; } else { - _this1._root = r; + _this._root = r; r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } } - p1._leaf = null; - leaf1._next = null; - leaf1._childIndex = 0; - leaf1._children[0] = null; - leaf1._children[1] = null; - leaf1._childIndex = 0; - leaf1._parent = null; - leaf1._height = 0; - leaf1._proxy = null; - leaf1._next = _this1._nodePool; - _this1._nodePool = leaf1; - var _this2 = this._tree; - var first = _this2._nodePool; + p._leaf = null; + leaf._next = null; + leaf._childIndex = 0; + leaf._children[0] = null; + leaf._children[1] = null; + leaf._childIndex = 0; + leaf._parent = null; + leaf._height = 0; + leaf._proxy = null; + leaf._next = _this._nodePool; + _this._nodePool = leaf; + let _this1 = this._tree; + let first = _this1._nodePool; if(first != null) { - _this2._nodePool = first._next; + _this1._nodePool = first._next; first._next = null; } else { first = new oimo.collision.broadphase.bvh.BvhNode(); } - var leaf2 = first; - leaf2._proxy = p1; - p1._leaf = leaf2; - leaf2._aabbMinX = p1._aabbMinX; - leaf2._aabbMinY = p1._aabbMinY; - leaf2._aabbMinZ = p1._aabbMinZ; - leaf2._aabbMaxX = p1._aabbMaxX; - leaf2._aabbMaxY = p1._aabbMaxY; - leaf2._aabbMaxZ = p1._aabbMaxZ; - _this2._numLeaves++; - if(_this2.leafList == null) { - _this2.leafList = leaf2; - _this2.leafListLast = leaf2; + let leaf1 = first; + leaf1._proxy = p; + p._leaf = leaf1; + leaf1._aabbMinX = p._aabbMinX; + leaf1._aabbMinY = p._aabbMinY; + leaf1._aabbMinZ = p._aabbMinZ; + leaf1._aabbMaxX = p._aabbMaxX; + leaf1._aabbMaxY = p._aabbMaxY; + leaf1._aabbMaxZ = p._aabbMaxZ; + _this1._numLeaves++; + if(_this1.leafList == null) { + _this1.leafList = leaf1; + _this1.leafListLast = leaf1; } else { - _this2.leafListLast._nextLeaf = leaf2; - leaf2._prevLeaf = _this2.leafListLast; - _this2.leafListLast = leaf2; + _this1.leafListLast._nextLeaf = leaf1; + leaf1._prevLeaf = _this1.leafListLast; + _this1.leafListLast = leaf1; } - if(_this2._root == null) { - _this2._root = leaf2; + if(_this1._root == null) { + _this1._root = leaf1; } else { - var sibling1 = _this2._root; - while(sibling1._height > 0) { - var nextStep = _this2._strategy._decideInsertion(sibling1,leaf2); + let sibling = _this1._root; + while(sibling._height > 0) { + let nextStep = _this1._strategy._decideInsertion(sibling,leaf1); if(nextStep == -1) { break; } else { - sibling1 = sibling1._children[nextStep]; + sibling = sibling._children[nextStep]; } } - var parent1 = sibling1._parent; - var first1 = _this2._nodePool; - if(first1 != null) { - _this2._nodePool = first1._next; - first1._next = null; + let parent = sibling._parent; + let first = _this1._nodePool; + if(first != null) { + _this1._nodePool = first._next; + first._next = null; } else { - first1 = new oimo.collision.broadphase.bvh.BvhNode(); + first = new oimo.collision.broadphase.bvh.BvhNode(); } - var node1 = first1; - if(parent1 == null) { - _this2._root = node1; + let node = first; + if(parent == null) { + _this1._root = node; } else { - var index1 = sibling1._childIndex; - parent1._children[index1] = node1; - node1._parent = parent1; - node1._childIndex = index1; - } - var index2 = sibling1._childIndex; - node1._children[index2] = sibling1; - sibling1._parent = node1; - sibling1._childIndex = index2; - var index3 = sibling1._childIndex ^ 1; - node1._children[index3] = leaf2; - leaf2._parent = node1; - leaf2._childIndex = index3; - while(node1 != null) { - if(_this2._strategy._balancingEnabled) { - var nh1 = node1._height; - if(nh1 < 2) { - node1 = node1; - } else { - var p3 = node1._parent; - var l1 = node1._children[0]; - var r1 = node1._children[1]; - var lh1 = l1._height; - var rh1 = r1._height; - var balance1 = lh1 - rh1; - var nodeIndex1 = node1._childIndex; - if(balance1 > 1) { - var ll1 = l1._children[0]; - var lr1 = l1._children[1]; - var llh1 = ll1._height; - var lrh1 = lr1._height; - if(llh1 > lrh1) { - l1._children[1] = node1; - node1._parent = l1; - node1._childIndex = 1; - node1._children[0] = lr1; - lr1._parent = node1; - lr1._childIndex = 0; - var c19 = l1._children[0]; - var c29 = l1._children[1]; - l1._aabbMinX = c19._aabbMinX < c29._aabbMinX ? c19._aabbMinX : c29._aabbMinX; - l1._aabbMinY = c19._aabbMinY < c29._aabbMinY ? c19._aabbMinY : c29._aabbMinY; - l1._aabbMinZ = c19._aabbMinZ < c29._aabbMinZ ? c19._aabbMinZ : c29._aabbMinZ; - l1._aabbMaxX = c19._aabbMaxX > c29._aabbMaxX ? c19._aabbMaxX : c29._aabbMaxX; - l1._aabbMaxY = c19._aabbMaxY > c29._aabbMaxY ? c19._aabbMaxY : c29._aabbMaxY; - l1._aabbMaxZ = c19._aabbMaxZ > c29._aabbMaxZ ? c19._aabbMaxZ : c29._aabbMaxZ; - var h19 = l1._children[0]._height; - var h29 = l1._children[1]._height; - l1._height = (h19 > h29 ? h19 : h29) + 1; - var c110 = node1._children[0]; - var c210 = node1._children[1]; - node1._aabbMinX = c110._aabbMinX < c210._aabbMinX ? c110._aabbMinX : c210._aabbMinX; - node1._aabbMinY = c110._aabbMinY < c210._aabbMinY ? c110._aabbMinY : c210._aabbMinY; - node1._aabbMinZ = c110._aabbMinZ < c210._aabbMinZ ? c110._aabbMinZ : c210._aabbMinZ; - node1._aabbMaxX = c110._aabbMaxX > c210._aabbMaxX ? c110._aabbMaxX : c210._aabbMaxX; - node1._aabbMaxY = c110._aabbMaxY > c210._aabbMaxY ? c110._aabbMaxY : c210._aabbMaxY; - node1._aabbMaxZ = c110._aabbMaxZ > c210._aabbMaxZ ? c110._aabbMaxZ : c210._aabbMaxZ; - var h110 = node1._children[0]._height; - var h210 = node1._children[1]._height; - node1._height = (h110 > h210 ? h110 : h210) + 1; + let index = sibling._childIndex; + parent._children[index] = node; + node._parent = parent; + node._childIndex = index; + } + let index = sibling._childIndex; + node._children[index] = sibling; + sibling._parent = node; + sibling._childIndex = index; + let index1 = sibling._childIndex ^ 1; + node._children[index1] = leaf1; + leaf1._parent = node; + leaf1._childIndex = index1; + while(node != null) { + if(_this1._strategy._balancingEnabled) { + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; + if(balance > 1) { + let ll = l._children[0]; + let lr = l._children[1]; + if(ll._height > lr._height) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { - l1._children[0] = node1; - node1._parent = l1; - node1._childIndex = 0; - node1._children[0] = ll1; - ll1._parent = node1; - ll1._childIndex = 0; - var c111 = l1._children[0]; - var c211 = l1._children[1]; - l1._aabbMinX = c111._aabbMinX < c211._aabbMinX ? c111._aabbMinX : c211._aabbMinX; - l1._aabbMinY = c111._aabbMinY < c211._aabbMinY ? c111._aabbMinY : c211._aabbMinY; - l1._aabbMinZ = c111._aabbMinZ < c211._aabbMinZ ? c111._aabbMinZ : c211._aabbMinZ; - l1._aabbMaxX = c111._aabbMaxX > c211._aabbMaxX ? c111._aabbMaxX : c211._aabbMaxX; - l1._aabbMaxY = c111._aabbMaxY > c211._aabbMaxY ? c111._aabbMaxY : c211._aabbMaxY; - l1._aabbMaxZ = c111._aabbMaxZ > c211._aabbMaxZ ? c111._aabbMaxZ : c211._aabbMaxZ; - var h111 = l1._children[0]._height; - var h211 = l1._children[1]._height; - l1._height = (h111 > h211 ? h111 : h211) + 1; - var c112 = node1._children[0]; - var c212 = node1._children[1]; - node1._aabbMinX = c112._aabbMinX < c212._aabbMinX ? c112._aabbMinX : c212._aabbMinX; - node1._aabbMinY = c112._aabbMinY < c212._aabbMinY ? c112._aabbMinY : c212._aabbMinY; - node1._aabbMinZ = c112._aabbMinZ < c212._aabbMinZ ? c112._aabbMinZ : c212._aabbMinZ; - node1._aabbMaxX = c112._aabbMaxX > c212._aabbMaxX ? c112._aabbMaxX : c212._aabbMaxX; - node1._aabbMaxY = c112._aabbMaxY > c212._aabbMaxY ? c112._aabbMaxY : c212._aabbMaxY; - node1._aabbMaxZ = c112._aabbMaxZ > c212._aabbMaxZ ? c112._aabbMaxZ : c212._aabbMaxZ; - var h112 = node1._children[0]._height; - var h212 = node1._children[1]._height; - node1._height = (h112 > h212 ? h112 : h212) + 1; + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = l1; - l1._parent = p3; - l1._childIndex = nodeIndex1; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; + l._childIndex = nodeIndex; } else { - _this2._root = l1; - l1._parent = null; + _this1._root = l; + l._parent = null; } - node1 = l1; - } else if(balance1 < -1) { - var rl1 = r1._children[0]; - var rr1 = r1._children[1]; - var rlh1 = rl1._height; - var rrh1 = rr1._height; - if(rlh1 > rrh1) { - r1._children[1] = node1; - node1._parent = r1; - node1._childIndex = 1; - node1._children[1] = rr1; - rr1._parent = node1; - rr1._childIndex = 1; - var c113 = r1._children[0]; - var c213 = r1._children[1]; - r1._aabbMinX = c113._aabbMinX < c213._aabbMinX ? c113._aabbMinX : c213._aabbMinX; - r1._aabbMinY = c113._aabbMinY < c213._aabbMinY ? c113._aabbMinY : c213._aabbMinY; - r1._aabbMinZ = c113._aabbMinZ < c213._aabbMinZ ? c113._aabbMinZ : c213._aabbMinZ; - r1._aabbMaxX = c113._aabbMaxX > c213._aabbMaxX ? c113._aabbMaxX : c213._aabbMaxX; - r1._aabbMaxY = c113._aabbMaxY > c213._aabbMaxY ? c113._aabbMaxY : c213._aabbMaxY; - r1._aabbMaxZ = c113._aabbMaxZ > c213._aabbMaxZ ? c113._aabbMaxZ : c213._aabbMaxZ; - var h113 = r1._children[0]._height; - var h213 = r1._children[1]._height; - r1._height = (h113 > h213 ? h113 : h213) + 1; - var c114 = node1._children[0]; - var c214 = node1._children[1]; - node1._aabbMinX = c114._aabbMinX < c214._aabbMinX ? c114._aabbMinX : c214._aabbMinX; - node1._aabbMinY = c114._aabbMinY < c214._aabbMinY ? c114._aabbMinY : c214._aabbMinY; - node1._aabbMinZ = c114._aabbMinZ < c214._aabbMinZ ? c114._aabbMinZ : c214._aabbMinZ; - node1._aabbMaxX = c114._aabbMaxX > c214._aabbMaxX ? c114._aabbMaxX : c214._aabbMaxX; - node1._aabbMaxY = c114._aabbMaxY > c214._aabbMaxY ? c114._aabbMaxY : c214._aabbMaxY; - node1._aabbMaxZ = c114._aabbMaxZ > c214._aabbMaxZ ? c114._aabbMaxZ : c214._aabbMaxZ; - var h114 = node1._children[0]._height; - var h214 = node1._children[1]._height; - node1._height = (h114 > h214 ? h114 : h214) + 1; + node = l; + } else if(balance < -1) { + let rl = r._children[0]; + let rr = r._children[1]; + if(rl._height > rr._height) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { - r1._children[0] = node1; - node1._parent = r1; - node1._childIndex = 0; - node1._children[1] = rl1; - rl1._parent = node1; - rl1._childIndex = 1; - var c115 = r1._children[0]; - var c215 = r1._children[1]; - r1._aabbMinX = c115._aabbMinX < c215._aabbMinX ? c115._aabbMinX : c215._aabbMinX; - r1._aabbMinY = c115._aabbMinY < c215._aabbMinY ? c115._aabbMinY : c215._aabbMinY; - r1._aabbMinZ = c115._aabbMinZ < c215._aabbMinZ ? c115._aabbMinZ : c215._aabbMinZ; - r1._aabbMaxX = c115._aabbMaxX > c215._aabbMaxX ? c115._aabbMaxX : c215._aabbMaxX; - r1._aabbMaxY = c115._aabbMaxY > c215._aabbMaxY ? c115._aabbMaxY : c215._aabbMaxY; - r1._aabbMaxZ = c115._aabbMaxZ > c215._aabbMaxZ ? c115._aabbMaxZ : c215._aabbMaxZ; - var h115 = r1._children[0]._height; - var h215 = r1._children[1]._height; - r1._height = (h115 > h215 ? h115 : h215) + 1; - var c116 = node1._children[0]; - var c216 = node1._children[1]; - node1._aabbMinX = c116._aabbMinX < c216._aabbMinX ? c116._aabbMinX : c216._aabbMinX; - node1._aabbMinY = c116._aabbMinY < c216._aabbMinY ? c116._aabbMinY : c216._aabbMinY; - node1._aabbMinZ = c116._aabbMinZ < c216._aabbMinZ ? c116._aabbMinZ : c216._aabbMinZ; - node1._aabbMaxX = c116._aabbMaxX > c216._aabbMaxX ? c116._aabbMaxX : c216._aabbMaxX; - node1._aabbMaxY = c116._aabbMaxY > c216._aabbMaxY ? c116._aabbMaxY : c216._aabbMaxY; - node1._aabbMaxZ = c116._aabbMaxZ > c216._aabbMaxZ ? c116._aabbMaxZ : c216._aabbMaxZ; - var h116 = node1._children[0]._height; - var h216 = node1._children[1]._height; - node1._height = (h116 > h216 ? h116 : h216) + 1; + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = r1; - r1._parent = p3; - r1._childIndex = nodeIndex1; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; + r._childIndex = nodeIndex; } else { - _this2._root = r1; - r1._parent = null; + _this1._root = r; + r._parent = null; } - node1 = r1; - } else { - node1 = node1; + node = r; } } } - var h117 = node1._children[0]._height; - var h217 = node1._children[1]._height; - node1._height = (h117 > h217 ? h117 : h217) + 1; - var c117 = node1._children[0]; - var c217 = node1._children[1]; - node1._aabbMinX = c117._aabbMinX < c217._aabbMinX ? c117._aabbMinX : c217._aabbMinX; - node1._aabbMinY = c117._aabbMinY < c217._aabbMinY ? c117._aabbMinY : c217._aabbMinY; - node1._aabbMinZ = c117._aabbMinZ < c217._aabbMinZ ? c117._aabbMinZ : c217._aabbMinZ; - node1._aabbMaxX = c117._aabbMaxX > c217._aabbMaxX ? c117._aabbMaxX : c217._aabbMaxX; - node1._aabbMaxY = c117._aabbMaxY > c217._aabbMaxY ? c117._aabbMaxY : c217._aabbMaxY; - node1._aabbMaxZ = c117._aabbMaxZ > c217._aabbMaxZ ? c117._aabbMaxZ : c217._aabbMaxZ; - node1 = node1._parent; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + node = node._parent; } } if(incrementalCollision) { - this.collide(this._tree._root,p1._leaf); + this.collide(this._tree._root,p._leaf); } - p1._moved = false; + p._moved = false; } - this.movedProxies[i1] = null; + this.movedProxies[i] = null; } if(!incrementalCollision) { this.collide(this._tree._root,this._tree._root); @@ -1946,22 +1735,18 @@ oimo.collision.broadphase.bvh.BvhBroadPhase = class oimo_collision_broadphase_bv if(this._tree._root == null) { return; } - var p1; - var p1X; - var p1Y; - var p1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - var v = begin; - p1X = v.x; - p1Y = v.y; - p1Z = v.z; - var v1 = end; - p2X = v1.x; - p2Y = v1.y; - p2Z = v1.z; + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; + p1X = begin.x; + p1Y = begin.y; + p1Z = begin.z; + p2X = end.x; + p2Y = end.y; + p2Z = end.z; this.rayCastRecursive(this._tree._root,p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); } convexCast(convex,begin,translation,callback) { @@ -1987,8 +1772,7 @@ oimo.collision.broadphase.bvh.BvhNode = class oimo_collision_broadphase_bvh_BvhN this._next = null; this._prevLeaf = null; this._nextLeaf = null; - var this1 = new Array(2); - this._children = this1; + this._children = new Array(2); this._childIndex = 0; this._parent = null; this._height = 0; @@ -2016,23 +1800,20 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ _decideInsertion(currentNode,leaf) { switch(this._insertionStrategy) { case 0: - var center; - var centerX; - var centerY; - var centerZ; + let centerX; + let centerY; + let centerZ; centerX = leaf._aabbMinX + leaf._aabbMaxX; centerY = leaf._aabbMinY + leaf._aabbMaxY; centerZ = leaf._aabbMinZ + leaf._aabbMaxZ; - var c1 = currentNode._children[0]; - var c2 = currentNode._children[1]; - var diff1; - var diff1X; - var diff1Y; - var diff1Z; - var diff2; - var diff2X; - var diff2Y; - var diff2Z; + let c1 = currentNode._children[0]; + let c2 = currentNode._children[1]; + let diff1X; + let diff1Y; + let diff1Z; + let diff2X; + let diff2Y; + let diff2Z; diff1X = c1._aabbMinX + c1._aabbMaxX; diff1Y = c1._aabbMinY + c1._aabbMaxY; diff1Z = c1._aabbMinZ + c1._aabbMaxZ; @@ -2045,42 +1826,35 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ diff2X -= centerX; diff2Y -= centerY; diff2Z -= centerZ; - var dist1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; - var dist2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; - if(dist1 < dist2) { + if(diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z < diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z) { return 0; } else { return 1; } break; case 1: - var c11 = currentNode._children[0]; - var c21 = currentNode._children[1]; - var ex = currentNode._aabbMaxX - currentNode._aabbMinX; - var ey = currentNode._aabbMaxY - currentNode._aabbMinY; - var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; - var oldArea = (ex * (ey + ez) + ey * ez) * 2; - var combinedMin; - var combinedMinX; - var combinedMinY; - var combinedMinZ; - var combinedMax; - var combinedMaxX; - var combinedMaxY; - var combinedMaxZ; + let c11 = currentNode._children[0]; + let c21 = currentNode._children[1]; + let ey = currentNode._aabbMaxY - currentNode._aabbMinY; + let ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; + let combinedMinX; + let combinedMinY; + let combinedMinZ; + let combinedMaxX; + let combinedMaxY; + let combinedMaxZ; combinedMinX = currentNode._aabbMinX < leaf._aabbMinX ? currentNode._aabbMinX : leaf._aabbMinX; combinedMinY = currentNode._aabbMinY < leaf._aabbMinY ? currentNode._aabbMinY : leaf._aabbMinY; combinedMinZ = currentNode._aabbMinZ < leaf._aabbMinZ ? currentNode._aabbMinZ : leaf._aabbMinZ; combinedMaxX = currentNode._aabbMaxX > leaf._aabbMaxX ? currentNode._aabbMaxX : leaf._aabbMaxX; combinedMaxY = currentNode._aabbMaxY > leaf._aabbMaxY ? currentNode._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = currentNode._aabbMaxZ > leaf._aabbMaxZ ? currentNode._aabbMaxZ : leaf._aabbMaxZ; - var ex1 = combinedMaxX - combinedMinX; - var ey1 = combinedMaxY - combinedMinY; - var ez1 = combinedMaxZ - combinedMinZ; - var newArea = (ex1 * (ey1 + ez1) + ey1 * ez1) * 2; - var creatingCost = newArea * 2; - var incrementalCost = (newArea - oldArea) * 2; - var descendingCost1 = incrementalCost; + let ey1 = combinedMaxY - combinedMinY; + let ez1 = combinedMaxZ - combinedMinZ; + let newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; + let creatingCost = newArea * 2; + let incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; + let descendingCost1 = incrementalCost; combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; @@ -2088,20 +1862,17 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; if(c11._height == 0) { - var ex2 = combinedMaxX - combinedMinX; - var ey2 = combinedMaxY - combinedMinY; - var ez2 = combinedMaxZ - combinedMinZ; - descendingCost1 += (ex2 * (ey2 + ez2) + ey2 * ez2) * 2; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ex3 = combinedMaxX - combinedMinX; - var ey3 = combinedMaxY - combinedMinY; - var ez3 = combinedMaxZ - combinedMinZ; - var ex4 = c11._aabbMaxX - c11._aabbMinX; - var ey4 = c11._aabbMaxY - c11._aabbMinY; - var ez4 = c11._aabbMaxZ - c11._aabbMinZ; - descendingCost1 += (ex3 * (ey3 + ez3) + ey3 * ez3) * 2 - (ex4 * (ey4 + ez4) + ey4 * ez4) * 2; - } - var descendingCost2 = incrementalCost; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + let ey1 = c11._aabbMaxY - c11._aabbMinY; + let ez1 = c11._aabbMaxZ - c11._aabbMinZ; + descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); + } + let descendingCost2 = incrementalCost; combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; @@ -2109,18 +1880,15 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; if(c21._height == 0) { - var ex5 = combinedMaxX - combinedMinX; - var ey5 = combinedMaxY - combinedMinY; - var ez5 = combinedMaxZ - combinedMinZ; - descendingCost2 += (ex5 * (ey5 + ez5) + ey5 * ez5) * 2; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ex6 = combinedMaxX - combinedMinX; - var ey6 = combinedMaxY - combinedMinY; - var ez6 = combinedMaxZ - combinedMinZ; - var ex7 = c21._aabbMaxX - c21._aabbMinX; - var ey7 = c21._aabbMaxY - c21._aabbMinY; - var ez7 = c21._aabbMaxZ - c21._aabbMinZ; - descendingCost2 += (ex6 * (ey6 + ez6) + ey6 * ez6) * 2 - (ex7 * (ey7 + ez7) + ey7 * ez7) * 2; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + let ey1 = c21._aabbMaxY - c21._aabbMinY; + let ez1 = c21._aabbMaxZ - c21._aabbMinZ; + descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } if(creatingCost < descendingCost1) { if(creatingCost < descendingCost2) { @@ -2140,19 +1908,16 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ } } _splitLeaves(leaves,from,until) { - var invN = 1.0 / (until - from); - var centerMean; - var centerMeanX; - var centerMeanY; - var centerMeanZ; + let invN = 1.0 / (until - from); + let centerMeanX; + let centerMeanY; + let centerMeanZ; centerMeanX = 0; centerMeanY = 0; centerMeanZ = 0; - var _g = from; - var _g1 = until; - while(_g < _g1) { - var i = _g++; - var leaf = leaves[i]; + let _g = from; + while(_g < until) { + let leaf = leaves[_g++]; leaf._tmpX = leaf._aabbMaxX + leaf._aabbMinX; leaf._tmpY = leaf._aabbMaxY + leaf._aabbMinY; leaf._tmpZ = leaf._aabbMaxZ + leaf._aabbMinZ; @@ -2163,25 +1928,21 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ centerMeanX *= invN; centerMeanY *= invN; centerMeanZ *= invN; - var variance; - var varianceX; - var varianceY; - var varianceZ; + let varianceX; + let varianceY; + let varianceZ; varianceX = 0; varianceY = 0; varianceZ = 0; - var _g2 = from; - var _g3 = until; - while(_g2 < _g3) { - var i1 = _g2++; - var leaf1 = leaves[i1]; - var diff; - var diffX; - var diffY; - var diffZ; - diffX = leaf1._tmpX - centerMeanX; - diffY = leaf1._tmpY - centerMeanY; - diffZ = leaf1._tmpZ - centerMeanZ; + let _g1 = from; + while(_g1 < until) { + let leaf = leaves[_g1++]; + let diffX; + let diffY; + let diffZ; + diffX = leaf._tmpX - centerMeanX; + diffY = leaf._tmpY - centerMeanY; + diffZ = leaf._tmpZ - centerMeanZ; diffX *= diffX; diffY *= diffY; diffZ *= diffZ; @@ -2189,114 +1950,66 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ varianceY += diffY; varianceZ += diffZ; } - var varX = varianceX; - var varY = varianceY; - var varZ = varianceZ; - var l = from; - var r = until - 1; + let varX = varianceX; + let varY = varianceY; + let varZ = varianceZ; + let l = from; + let r = until - 1; if(varX > varY) { if(varX > varZ) { - var mean = centerMeanX; + let mean = centerMeanX; while(true) { - while(true) { - var leaf2 = leaves[l]; - if(leaf2._tmpX <= mean) { - break; - } - ++l; - } - while(true) { - var leaf3 = leaves[r]; - if(leaf3._tmpX >= mean) { - break; - } - --r; - } + while(!(leaves[l]._tmpX <= mean)) ++l; + while(!(leaves[r]._tmpX >= mean)) --r; if(l >= r) { break; } - var tmp = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; leaves[r] = tmp; ++l; --r; } } else { - var mean1 = centerMeanZ; + let mean = centerMeanZ; while(true) { - while(true) { - var leaf4 = leaves[l]; - if(leaf4._tmpZ <= mean1) { - break; - } - ++l; - } - while(true) { - var leaf5 = leaves[r]; - if(leaf5._tmpZ >= mean1) { - break; - } - --r; - } + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp1 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp1; + leaves[r] = tmp; ++l; --r; } } } else if(varY > varZ) { - var mean2 = centerMeanY; + let mean = centerMeanY; while(true) { - while(true) { - var leaf6 = leaves[l]; - if(leaf6._tmpY <= mean2) { - break; - } - ++l; - } - while(true) { - var leaf7 = leaves[r]; - if(leaf7._tmpY >= mean2) { - break; - } - --r; - } + while(!(leaves[l]._tmpY <= mean)) ++l; + while(!(leaves[r]._tmpY >= mean)) --r; if(l >= r) { break; } - var tmp2 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp2; + leaves[r] = tmp; ++l; --r; } } else { - var mean3 = centerMeanZ; + let mean = centerMeanZ; while(true) { - while(true) { - var leaf8 = leaves[l]; - if(leaf8._tmpZ <= mean3) { - break; - } - ++l; - } - while(true) { - var leaf9 = leaves[r]; - if(leaf9._tmpZ >= mean3) { - break; - } - --r; - } + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp3 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp3; + leaves[r] = tmp; ++l; --r; } @@ -2312,8 +2025,7 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT this._nodePool = null; this.leafList = null; this.leafListLast = null; - var this1 = new Array(1024); - this.tmp = this1; + this.tmp = new Array(1024); } _print(root,indent) { if(indent == null) { @@ -2326,41 +2038,35 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:39:",indent + root._proxy._id); } else { this._print(root._children[0],indent + " "); - var tmp; - var size; - var sizeX; - var sizeY; - var sizeZ; + let tmp; + let sizeX; + let sizeY; + let sizeZ; sizeX = root._aabbMaxX - root._aabbMinX; sizeY = root._aabbMaxY - root._aabbMinY; sizeZ = root._aabbMaxZ - root._aabbMinZ; - var x = sizeX; - var y = sizeY; - var z = sizeZ; - if(x * (y + z) + y * z > 0) { - var size1; - var sizeX1; - var sizeY1; - var sizeZ1; - sizeX1 = root._aabbMaxX - root._aabbMinX; - sizeY1 = root._aabbMaxY - root._aabbMinY; - sizeZ1 = root._aabbMaxZ - root._aabbMinZ; - var x1 = sizeX1; - var y1 = sizeY1; - var z1 = sizeZ1; - tmp = ((x1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + let y = sizeY; + let z = sizeZ; + if(sizeX * (y + z) + y * z > 0) { + let sizeX; + let sizeY; + let sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + let y = sizeY; + let z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 + 0.5 | 0) / 1000; } else { - var size2; - var sizeX2; - var sizeY2; - var sizeZ2; - sizeX2 = root._aabbMaxX - root._aabbMinX; - sizeY2 = root._aabbMaxY - root._aabbMinY; - sizeZ2 = root._aabbMaxZ - root._aabbMinZ; - var x2 = sizeX2; - var y2 = sizeY2; - var z2 = sizeZ2; - tmp = ((x2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + let sizeX; + let sizeY; + let sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + let y = sizeY; + let z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 - 0.5 | 0) / 1000; } console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); this._print(root._children[1],indent + " "); @@ -2371,8 +2077,8 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT } deleteRecursive(root) { if(root._height == 0) { - var prev = root._prevLeaf; - var next = root._nextLeaf; + let prev = root._prevLeaf; + let next = root._nextLeaf; if(prev != null) { prev._nextLeaf = next; } @@ -2433,10 +2139,9 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT this._nodePool = root; } buildTopDownRecursive(leaves,from,until) { - var num = until - from; - if(num == 1) { - var leaf = leaves[from]; - var proxy = leaf._proxy; + if(until - from == 1) { + let leaf = leaves[from]; + let proxy = leaf._proxy; leaf._aabbMinX = proxy._aabbMinX; leaf._aabbMinY = proxy._aabbMinY; leaf._aabbMinZ = proxy._aabbMinZ; @@ -2445,33 +2150,33 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT leaf._aabbMaxZ = proxy._aabbMaxZ; return leaf; } - var splitAt = this._strategy._splitLeaves(leaves,from,until); - var child1 = this.buildTopDownRecursive(leaves,from,splitAt); - var child2 = this.buildTopDownRecursive(leaves,splitAt,until); - var first = this._nodePool; + let splitAt = this._strategy._splitLeaves(leaves,from,until); + let child1 = this.buildTopDownRecursive(leaves,from,splitAt); + let child2 = this.buildTopDownRecursive(leaves,splitAt,until); + let first = this._nodePool; if(first != null) { this._nodePool = first._next; first._next = null; } else { first = new oimo.collision.broadphase.bvh.BvhNode(); } - var parent = first; + let parent = first; parent._children[0] = child1; child1._parent = parent; child1._childIndex = 0; parent._children[1] = child2; child2._parent = parent; child2._childIndex = 1; - var c1 = parent._children[0]; - var c2 = parent._children[1]; + let c1 = parent._children[0]; + let c2 = parent._children[1]; parent._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; parent._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; parent._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; parent._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; parent._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; parent._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = parent._children[0]._height; - var h2 = parent._children[1]._height; + let h1 = parent._children[0]._height; + let h2 = parent._children[1]._height; parent._height = (h1 > h2 ? h1 : h2) + 1; return parent; } @@ -2479,7 +2184,7 @@ oimo.collision.broadphase.bvh.BvhTree = class oimo_collision_broadphase_bvh_BvhT if(root == null || root._height == 0) { return 0; } - var balance = root._children[0]._height - root._children[1]._height; + let balance = root._children[0]._height - root._children[1]._height; if(balance < 0) { balance = -balance; } @@ -2496,125 +2201,109 @@ oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { this._maxZ = 0; } init(min,max) { - var v = min; - this._minX = v.x; - this._minY = v.y; - this._minZ = v.z; - var v1 = max; - this._maxX = v1.x; - this._maxY = v1.y; - this._maxZ = v1.z; + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; return this; } getMin() { - var min = new oimo.common.Vec3(); - var v = min; - v.x = this._minX; - v.y = this._minY; - v.z = this._minZ; + let min = new oimo.common.Vec3(); + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; return min; } getMinTo(min) { - var v = min; - v.x = this._minX; - v.y = this._minY; - v.z = this._minZ; + min.x = this._minX; + min.y = this._minY; + min.z = this._minZ; } setMin(min) { - var v = min; - this._minX = v.x; - this._minY = v.y; - this._minZ = v.z; + this._minX = min.x; + this._minY = min.y; + this._minZ = min.z; return this; } getMax() { - var max = new oimo.common.Vec3(); - var v = max; - v.x = this._maxX; - v.y = this._maxY; - v.z = this._maxZ; + let max = new oimo.common.Vec3(); + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; return max; } getMaxTo(max) { - var v = max; - v.x = this._maxX; - v.y = this._maxY; - v.z = this._maxZ; + max.x = this._maxX; + max.y = this._maxY; + max.z = this._maxZ; } setMax(max) { - var v = max; - this._maxX = v.x; - this._maxY = v.y; - this._maxZ = v.z; + this._maxX = max.x; + this._maxY = max.y; + this._maxZ = max.z; return this; } getCenter() { - var v = new oimo.common.Vec3(); - var c; - var cX; - var cY; - var cZ; + let v = new oimo.common.Vec3(); + let cX; + let cY; + let cZ; cX = this._minX + this._maxX; cY = this._minY + this._maxY; cZ = this._minZ + this._maxZ; cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v1 = v; - v1.x = cX; - v1.y = cY; - v1.z = cZ; + v.x = cX; + v.y = cY; + v.z = cZ; return v; } getCenterTo(center) { - var c; - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._minX + this._maxX; cY = this._minY + this._maxY; cZ = this._minZ + this._maxZ; cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v = center; - v.x = cX; - v.y = cY; - v.z = cZ; + center.x = cX; + center.y = cY; + center.z = cZ; } getExtents() { - var v = new oimo.common.Vec3(); - var c; - var cX; - var cY; - var cZ; + let v = new oimo.common.Vec3(); + let cX; + let cY; + let cZ; cX = this._maxX - this._minX; cY = this._maxY - this._minY; cZ = this._maxZ - this._minZ; cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v1 = v; - v1.x = cX; - v1.y = cY; - v1.z = cZ; + v.x = cX; + v.y = cY; + v.z = cZ; return v; } getExtentsTo(halfExtents) { - var c; - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._maxX - this._minX; cY = this._maxY - this._minY; cZ = this._maxZ - this._minZ; cX *= 0.5; cY *= 0.5; cZ *= 0.5; - var v = halfExtents; - v.x = cX; - v.y = cY; - v.z = cZ; + halfExtents.x = cX; + halfExtents.y = cY; + halfExtents.z = cZ; } combine(other) { this._minX = this._minX < other._minX ? this._minX : other._minX; @@ -2626,7 +2315,7 @@ oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { return this; } combined(other) { - var aabb = new oimo.collision.geometry.Aabb(); + let aabb = new oimo.collision.geometry.Aabb(); aabb._minX = this._minX < other._minX ? this._minX : other._minX; aabb._minY = this._minY < other._minY ? this._minY : other._minY; aabb._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; @@ -2643,7 +2332,7 @@ oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { } } getIntersection(other) { - var aabb = new oimo.collision.geometry.Aabb(); + let aabb = new oimo.collision.geometry.Aabb(); aabb._minX = this._minX > other._minX ? this._minX : other._minX; aabb._minY = this._minY > other._minY ? this._minY : other._minY; aabb._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; @@ -2670,7 +2359,7 @@ oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { return this; } clone() { - var aabb = new oimo.collision.geometry.Aabb(); + let aabb = new oimo.collision.geometry.Aabb(); aabb._minX = this._minX; aabb._minY = this._minY; aabb._minZ = this._minZ; @@ -2683,10 +2372,9 @@ oimo.collision.geometry.Aabb = class oimo_collision_geometry_Aabb { oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry extends oimo.collision.geometry.ConvexGeometry { constructor(halfExtents) { super(1); - var v = halfExtents; - this._halfExtentsX = v.x; - this._halfExtentsY = v.y; - this._halfExtentsZ = v.z; + this._halfExtentsX = halfExtents.x; + this._halfExtentsY = halfExtents.y; + this._halfExtentsZ = halfExtents.z; this._halfAxisXX = halfExtents.x; this._halfAxisXY = 0; this._halfAxisXZ = 0; @@ -2697,97 +2385,108 @@ oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry this._halfAxisZY = 0; this._halfAxisZZ = halfExtents.z; this._updateMass(); - var minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; + let minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; if(this._gjkMargin > minHalfExtents * 0.2) { this._gjkMargin = minHalfExtents * 0.2; } } getHalfExtents() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._halfExtentsX; - v1.y = this._halfExtentsY; - v1.z = this._halfExtentsZ; - return v; - } - getHalfExtentsTo(halfExtents) { - var v = halfExtents; + let v = new oimo.common.Vec3(); v.x = this._halfExtentsX; v.y = this._halfExtentsY; v.z = this._halfExtentsZ; + return v; + } + getHalfExtentsTo(halfExtents) { + halfExtents.x = this._halfExtentsX; + halfExtents.y = this._halfExtentsY; + halfExtents.z = this._halfExtentsZ; } _updateMass() { this._volume = 8 * (this._halfExtentsX * this._halfExtentsY * this._halfExtentsZ); - var sq; - var sqX; - var sqY; - var sqZ; + let sqX; + let sqY; + let sqZ; sqX = this._halfExtentsX * this._halfExtentsX; sqY = this._halfExtentsY * this._halfExtentsY; sqZ = this._halfExtentsZ * this._halfExtentsZ; - this._inertiaCoeff00 = 0.333333333333333315 * (sqY + sqZ); + this._inertiaCoeff00 = 0.33333333333333331 * (sqY + sqZ); this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; this._inertiaCoeff10 = 0; - this._inertiaCoeff11 = 0.333333333333333315 * (sqZ + sqX); + this._inertiaCoeff11 = 0.33333333333333331 * (sqZ + sqX); this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; - this._inertiaCoeff22 = 0.333333333333333315 * (sqX + sqY); + this._inertiaCoeff22 = 0.33333333333333331 * (sqX + sqY); } _computeAabb(aabb,tf) { - var tfx; - var tfxX; - var tfxY; - var tfxZ; - var tfy; - var tfyX; - var tfyY; - var tfyZ; - var tfz; - var tfzX; - var tfzY; - var tfzZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let tfxX; + let tfxY; + let tfxZ; + let tfyX; + let tfyY; + let tfyZ; + let tfzX; + let tfzY; + let tfzZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * this._halfAxisXX + tf._rotation01 * this._halfAxisXY + tf._rotation02 * this._halfAxisXZ; __tmp__Y = tf._rotation10 * this._halfAxisXX + tf._rotation11 * this._halfAxisXY + tf._rotation12 * this._halfAxisXZ; __tmp__Z = tf._rotation20 * this._halfAxisXX + tf._rotation21 * this._halfAxisXY + tf._rotation22 * this._halfAxisXZ; tfxX = __tmp__X; tfxY = __tmp__Y; tfxZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; __tmp__Y1 = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; __tmp__Z1 = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; tfyX = __tmp__X1; tfyY = __tmp__Y1; tfyZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; __tmp__Y2 = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; __tmp__Z2 = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; tfzX = __tmp__X2; tfzY = __tmp__Y2; tfzZ = __tmp__Z2; - tfxX = tfxX < 0 ? -tfxX : tfxX; - tfxY = tfxY < 0 ? -tfxY : tfxY; - tfxZ = tfxZ < 0 ? -tfxZ : tfxZ; - tfyX = tfyX < 0 ? -tfyX : tfyX; - tfyY = tfyY < 0 ? -tfyY : tfyY; - tfyZ = tfyZ < 0 ? -tfyZ : tfyZ; - tfzX = tfzX < 0 ? -tfzX : tfzX; - tfzY = tfzY < 0 ? -tfzY : tfzY; - tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; - var tfs; - var tfsX; - var tfsY; - var tfsZ; + if(tfxX < 0) { + tfxX = -tfxX; + } + if(tfxY < 0) { + tfxY = -tfxY; + } + if(tfxZ < 0) { + tfxZ = -tfxZ; + } + if(tfyX < 0) { + tfyX = -tfyX; + } + if(tfyY < 0) { + tfyY = -tfyY; + } + if(tfyZ < 0) { + tfyZ = -tfyZ; + } + if(tfzX < 0) { + tfzX = -tfzX; + } + if(tfzY < 0) { + tfzY = -tfzY; + } + if(tfzZ < 0) { + tfzZ = -tfzZ; + } + let tfsX; + let tfsY; + let tfsZ; tfsX = tfxX + tfyX; tfsY = tfxY + tfyY; tfsZ = tfxZ + tfyZ; @@ -2802,20 +2501,24 @@ oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry aabb._maxZ = tf._positionZ + tfsZ; } computeLocalSupportingVertex(dir,out) { - var gjkMargins; - var gjkMarginsX; - var gjkMarginsY; - var gjkMarginsZ; - var coreExtents; - var coreExtentsX; - var coreExtentsY; - var coreExtentsZ; + let gjkMarginsX; + let gjkMarginsY; + let gjkMarginsZ; + let coreExtentsX; + let coreExtentsY; + let coreExtentsZ; gjkMarginsX = this._gjkMargin; gjkMarginsY = this._gjkMargin; gjkMarginsZ = this._gjkMargin; - gjkMarginsX = gjkMarginsX < this._halfExtentsX ? gjkMarginsX : this._halfExtentsX; - gjkMarginsY = gjkMarginsY < this._halfExtentsY ? gjkMarginsY : this._halfExtentsY; - gjkMarginsZ = gjkMarginsZ < this._halfExtentsZ ? gjkMarginsZ : this._halfExtentsZ; + if(!(gjkMarginsX < this._halfExtentsX)) { + gjkMarginsX = this._halfExtentsX; + } + if(!(gjkMarginsY < this._halfExtentsY)) { + gjkMarginsY = this._halfExtentsY; + } + if(!(gjkMarginsZ < this._halfExtentsZ)) { + gjkMarginsZ = this._halfExtentsZ; + } coreExtentsX = this._halfExtentsX - gjkMarginsX; coreExtentsY = this._halfExtentsY - gjkMarginsY; coreExtentsZ = this._halfExtentsZ - gjkMarginsZ; @@ -2824,34 +2527,28 @@ oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry out.z = dir.z > 0 ? coreExtentsZ : -coreExtentsZ; } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; - var halfW = this._halfExtentsX; - var halfH = this._halfExtentsY; - var halfD = this._halfExtentsZ; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; - var tminx = 0; - var tminy = 0; - var tminz = 0; - var tmaxx = 1; - var tmaxy = 1; - var tmaxz = 1; + let halfW = this._halfExtentsX; + let halfH = this._halfExtentsY; + let halfD = this._halfExtentsZ; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminx = 0; + let tminy = 0; + let tminz = 0; + let tmaxx = 1; + let tmaxy = 1; + let tmaxz = 1; if(dx > -1e-6 && dx < 1e-6) { - if(p1x <= -halfW || p1x >= halfW) { + if(beginX <= -halfW || beginX >= halfW) { return false; } } else { - var invDx = 1 / dx; - var t1 = (-halfW - p1x) * invDx; - var t2 = (halfW - p1x) * invDx; + let invDx = 1 / dx; + let t1 = (-halfW - beginX) * invDx; + let t2 = (halfW - beginX) * invDx; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -2863,51 +2560,51 @@ oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry } } if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { - var invDy = 1 / dy; - var t11 = (-halfH - p1y) * invDy; - var t21 = (halfH - p1y) * invDy; - if(t11 > t21) { - var tmp1 = t11; - t11 = t21; - t21 = tmp1; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; + if(t1 > t2) { + let tmp = t1; + t1 = t2; + t2 = tmp; } - if(t11 > 0) { - tminy = t11; + if(t1 > 0) { + tminy = t1; } - if(t21 < 1) { - tmaxy = t21; + if(t2 < 1) { + tmaxy = t2; } } if(dz > -1e-6 && dz < 1e-6) { - if(p1z <= -halfD || p1z >= halfD) { + if(beginZ <= -halfD || beginZ >= halfD) { return false; } } else { - var invDz = 1 / dz; - var t12 = (-halfD - p1z) * invDz; - var t22 = (halfD - p1z) * invDz; - if(t12 > t22) { - var tmp2 = t12; - t12 = t22; - t22 = tmp2; + let invDz = 1 / dz; + let t1 = (-halfD - beginZ) * invDz; + let t2 = (halfD - beginZ) * invDz; + if(t1 > t2) { + let tmp = t1; + t1 = t2; + t2 = tmp; } - if(t12 > 0) { - tminz = t12; + if(t1 > 0) { + tminz = t1; } - if(t22 < 1) { - tmaxz = t22; + if(t2 < 1) { + tmaxz = t2; } } if(tminx >= 1 || tminy >= 1 || tminz >= 1 || tmaxx <= 0 || tmaxy <= 0 || tmaxz <= 0) { return false; } - var min = tminx; - var max = tmaxx; - var hitDirection = 0; + let min = tminx; + let max = tmaxx; + let hitDirection = 0; if(tminy > min) { min = tminy; hitDirection = 1; @@ -2939,7 +2636,7 @@ oimo.collision.geometry.BoxGeometry = class oimo_collision_geometry_BoxGeometry hit.normal.init(0,0,dz > 0 ? -1 : 1); break; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -2959,42 +2656,45 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG return this._halfHeight; } _updateMass() { - var r2 = this._radius * this._radius; - var hh2 = this._halfHeight * this._halfHeight; - var cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; - var sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; + let r2 = this._radius * this._radius; + let hh2 = this._halfHeight * this._halfHeight; + let cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; + let sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; this._volume = cylinderVolume + sphereVolume; - var invVolume = this._volume == 0 ? 0 : 1 / this._volume; - var inertiaY = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); - var inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); + let invVolume = this._volume == 0 ? 0 : 1 / this._volume; + let inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); this._inertiaCoeff00 = inertiaXZ; this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; this._inertiaCoeff10 = 0; - this._inertiaCoeff11 = inertiaY; + this._inertiaCoeff11 = invVolume * (cylinderVolume * r2 * 0.5 + sphereVolume * r2 * 0.4); this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; this._inertiaCoeff22 = inertiaXZ; } _computeAabb(aabb,tf) { - var radVec; - var radVecX; - var radVecY; - var radVecZ; + let radVecX; + let radVecY; + let radVecZ; radVecX = this._radius; radVecY = this._radius; radVecZ = this._radius; - var axis; - var axisX; - var axisY; - var axisZ; + let axisX; + let axisY; + let axisZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axisX *= this._halfHeight; axisY *= this._halfHeight; axisZ *= this._halfHeight; @@ -3016,28 +2716,20 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG } } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; - var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; - var tminxz = 0; - var tmaxxz = 1; - var a = dx * dx + dz * dz; - var b = p1x * dx + p1z * dz; - var c = p1x * p1x + p1z * p1z - this._radius * this._radius; - var D = b * b - a * c; + let halfH = this._halfHeight; + let dx = endX - beginX; + let dz = endZ - beginZ; + let tminxz = 0; + let tmaxxz = 1; + let a = dx * dx + dz * dz; + let b = beginX * dx + beginZ * dz; + let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + let D = b * b - a * c; if(D < 0) { return false; } - var t; if(a > 0) { - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; tmaxxz = (-b + sqrtD) / a; if(tminxz >= 1 || tmaxxz <= 0) { @@ -3050,47 +2742,40 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG tminxz = 0; tmaxxz = 1; } - var crossY = p1y + dy * tminxz; - var min; + let crossY = beginY + (endY - beginY) * tminxz; + let min; if(crossY > -halfH && crossY < halfH) { if(tminxz > 0) { min = tminxz; - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - hit.position.init(p1x + min * dx,crossY,p1z + min * dz); + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + hit.position.init(beginX + min * dx,crossY,beginZ + min * dz); hit.fraction = min; return true; } return false; } - var sphereY = crossY < 0 ? -halfH : halfH; - var spherePos; - var spherePosX; - var spherePosY; - var spherePosZ; - var sphereToBegin; - var sphereToBeginX; - var sphereToBeginY; - var sphereToBeginZ; + let spherePosX; + let spherePosY; + let spherePosZ; + let sphereToBeginX; + let sphereToBeginY; + let sphereToBeginZ; spherePosX = 0; - spherePosY = sphereY; + spherePosY = crossY < 0 ? -halfH : halfH; spherePosZ = 0; sphereToBeginX = beginX - spherePosX; sphereToBeginY = beginY - spherePosY; sphereToBeginZ = beginZ - spherePosZ; - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = endX - beginX; dY = endY - beginY; dZ = endZ - beginZ; @@ -3101,22 +2786,20 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG if(D < 0) { return false; } - var t1 = (-b - Math.sqrt(D)) / a; - if(t1 < 0 || t1 > 1) { + let t = (-b - Math.sqrt(D)) / a; + if(t < 0 || t > 1) { return false; } - var hitPos; - var hitPosX; - var hitPosY; - var hitPosZ; - var hitNormal; - var hitNormalX; - var hitNormalY; - var hitNormalZ; - hitPosX = sphereToBeginX + dX * t1; - hitPosY = sphereToBeginY + dY * t1; - hitPosZ = sphereToBeginZ + dZ * t1; - var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + let hitPosX; + let hitPosY; + let hitPosZ; + let hitNormalX; + let hitNormalY; + let hitNormalZ; + hitPosX = sphereToBeginX + dX * t; + hitPosY = sphereToBeginY + dY * t; + hitPosZ = sphereToBeginZ + dZ * t; + let l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -3126,15 +2809,15 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG hitPosX += spherePosX; hitPosY += spherePosY; hitPosZ += spherePosZ; - var v = hit.position; + let v = hit.position; v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; + let v1 = hit.normal; v1.x = hitNormalX; v1.y = hitNormalY; v1.z = hitNormalZ; - hit.fraction = t1; + hit.fraction = t; return true; } } @@ -3154,8 +2837,8 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr return this._halfHeight; } _updateMass() { - var r2 = this._radius * this._radius; - var h2 = this._halfHeight * this._halfHeight * 4; + let r2 = this._radius * this._radius; + let h2 = this._halfHeight * this._halfHeight * 4; this._volume = 3.14159265358979 * r2 * this._halfHeight * 2 / 3; this._inertiaCoeff00 = 0.05 * (3 * r2 + 2 * h2); this._inertiaCoeff01 = 0; @@ -3168,48 +2851,39 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr this._inertiaCoeff22 = 0.05 * (3 * r2 + 2 * h2); } _computeAabb(aabb,tf) { - var axis; - var axisX; - var axisY; - var axisZ; - var axis2; - var axis2X; - var axis2Y; - var axis2Z; - var eh; - var ehX; - var ehY; - var ehZ; - var er; - var erX; - var erY; - var erZ; + let axisX; + let axisY; + let axisZ; + let axis2X; + let axis2Y; + let axis2Z; + let ehX; + let ehY; + let ehZ; + let erX; + let erY; + let erZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; - var axis2x = axis2X; - var axis2y = axis2Y; - var axis2z = axis2Z; - erX = Math.sqrt(1 - axis2x); - erY = Math.sqrt(1 - axis2y); - erZ = Math.sqrt(1 - axis2z); + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); erX *= this._radius; erY *= this._radius; erZ *= this._radius; ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var rmin; - var rminX; - var rminY; - var rminZ; - var rmax; - var rmaxX; - var rmaxY; - var rmaxZ; + let rminX; + let rminY; + let rminZ; + let rmaxX; + let rmaxY; + let rmaxZ; rminX = -ehX; rminY = -ehY; rminZ = -ehZ; @@ -3222,26 +2896,36 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr rmaxX += erX; rmaxY += erY; rmaxZ += erZ; - var max; - var maxX; - var maxY; - var maxZ; - var min; - var minX; - var minY; - var minZ; + let maxX; + let maxY; + let maxZ; + let minX; + let minY; + let minZ; maxX = rminX > rmaxX ? rminX : rmaxX; maxY = rminY > rmaxY ? rminY : rmaxY; maxZ = rminZ > rmaxZ ? rminZ : rmaxZ; - maxX = maxX > ehX ? maxX : ehX; - maxY = maxY > ehY ? maxY : ehY; - maxZ = maxZ > ehZ ? maxZ : ehZ; + if(!(maxX > ehX)) { + maxX = ehX; + } + if(!(maxY > ehY)) { + maxY = ehY; + } + if(!(maxZ > ehZ)) { + maxZ = ehZ; + } minX = rminX < rmaxX ? rminX : rmaxX; minY = rminY < rmaxY ? rminY : rmaxY; minZ = rminZ < rmaxZ ? rminZ : rmaxZ; - minX = minX < ehX ? minX : ehX; - minY = minY < ehY ? minY : ehY; - minZ = minZ < ehZ ? minZ : ehZ; + if(!(minX < ehX)) { + minX = ehX; + } + if(!(minY < ehY)) { + minY = ehY; + } + if(!(minZ < ehZ)) { + minZ = ehZ; + } aabb._minX = tf._positionX + minX; aabb._minY = tf._positionY + minY; aabb._minZ = tf._positionZ + minZ; @@ -3250,9 +2934,9 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr aabb._maxZ = tf._positionZ + maxZ; } computeLocalSupportingVertex(dir,out) { - var dx = dir.x; - var dy = dir.y; - var dz = dir.z; + let dx = dir.x; + let dy = dir.y; + let dz = dir.z; if(dy > 0 && dy * dy > this.sinTheta * this.sinTheta * (dx * dx + dy * dy + dz * dz)) { out.init(0,this._halfHeight - this._gjkMargin / this.sinTheta,0); if(out.y < 0) { @@ -3260,16 +2944,16 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr } return; } - var rx = dir.x; - var rz = dir.z; - var len = rx * rx + rz * rz; - var height = 2 * this._halfHeight; - var coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; + let rx = dir.x; + let rz = dir.z; + let len = rx * rx + rz * rz; + let height = 2 * this._halfHeight; + let coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; if(coreRadius < 0) { coreRadius = 0; } - var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; - var coreHalfHeight = this._halfHeight - this._gjkMargin; + let invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + let coreHalfHeight = this._halfHeight - this._gjkMargin; if(coreHalfHeight < 0) { coreHalfHeight = 0; } @@ -3278,28 +2962,23 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr out.z = rz * invLen; } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; - var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; - var tminy = 0; - var tmaxy = 1; + let p1y = beginY; + let halfH = this._halfHeight; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminy = 0; + let tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { - var invDy = 1 / dy; - var t1 = (-halfH - p1y) * invDy; - var t2 = (halfH - p1y) * invDy; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -3313,19 +2992,19 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr if(tminy >= 1 || tmaxy <= 0) { return false; } - var tminxz = 0; - var tmaxxz = 0; - p1y -= halfH; - var cos2 = this.cosTheta * this.cosTheta; - var a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; - var b = cos2 * (p1x * dx + p1y * dy + p1z * dz) - p1y * dy; - var c = cos2 * (p1x * p1x + p1y * p1y + p1z * p1z) - p1y * p1y; - var D = b * b - a * c; + let tminxz = 0; + let tmaxxz = 0; + p1y = beginY - halfH; + let cos2 = this.cosTheta * this.cosTheta; + let a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; + let b = cos2 * (beginX * dx + p1y * dy + beginZ * dz) - p1y * dy; + let c = cos2 * (beginX * beginX + p1y * p1y + beginZ * beginZ) - p1y * p1y; + let D = b * b - a * c; if(a != 0) { if(D < 0) { return false; } - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); if(a < 0) { if(dy > 0) { tminxz = 0; @@ -3348,7 +3027,7 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr } } } else { - var t = -c / (2 * b); + let t = -c / (2 * b); if(b > 0) { tminxz = 0; tmaxxz = t; @@ -3364,7 +3043,7 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr } } p1y += halfH; - var min; + let min; if(tmaxxz <= tminy || tmaxy <= tminxz) { return false; } @@ -3379,28 +3058,21 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr if(min == 0) { return false; } - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - var _this1 = _this; - var s = this.cosTheta; - var tx1 = _this1.x * s; - var ty1 = _this1.y * s; - var tz1 = _this1.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + let s = this.cosTheta; + _this.x *= s; + _this.y *= s; + _this.z *= s; hit.normal.y += this.sinTheta; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,p1y + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -3409,14 +3081,12 @@ oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_Conve constructor(vertices) { super(5); this._numVertices = vertices.length; - var this1 = new Array(this._numVertices); - this._vertices = this1; - var this2 = new Array(this._numVertices); - this._tmpVertices = this2; - var _g = 0; - var _g1 = this._numVertices; + this._vertices = new Array(this._numVertices); + this._tmpVertices = new Array(this._numVertices); + let _g = 0; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; + let i = _g++; this._vertices[i] = vertices[i]; this._tmpVertices[i] = new oimo.common.Vec3(); } @@ -3437,19 +3107,19 @@ oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_Conve this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 1; - var minx = this._vertices[0].x; - var miny = this._vertices[0].y; - var minz = this._vertices[0].z; - var maxx = this._vertices[0].x; - var maxy = this._vertices[0].y; - var maxz = this._vertices[0].z; - var _g = 1; - var _g1 = this._numVertices; + let minx = this._vertices[0].x; + let miny = this._vertices[0].y; + let minz = this._vertices[0].z; + let maxx = this._vertices[0].x; + let maxy = this._vertices[0].y; + let maxz = this._vertices[0].z; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; - var vx = this._vertices[i].x; - var vy = this._vertices[i].y; - var vz = this._vertices[i].z; + let i = _g++; + let vx = this._vertices[i].x; + let vy = this._vertices[i].y; + let vz = this._vertices[i].z; if(vx < minx) { minx = vx; } else if(vx > maxx) { @@ -3466,55 +3136,50 @@ oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_Conve maxz = vz; } } - var sizex = maxx - minx; - var sizey = maxy - miny; - var sizez = maxz - minz; + let sizex = maxx - minx; + let sizey = maxy - miny; + let sizez = maxz - minz; this._volume = sizex * sizey * sizez; - var diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; + let diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; sizex = sizex * sizex * 0.25; sizey = sizey * sizey * 0.25; sizez = sizez * sizez * 0.25; - this._inertiaCoeff00 = 0.333333333333333315 * (sizey + sizez) + diffCog; + this._inertiaCoeff00 = 0.33333333333333331 * (sizey + sizez) + diffCog; this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; this._inertiaCoeff10 = 0; - this._inertiaCoeff11 = 0.333333333333333315 * (sizez + sizex) + diffCog; + this._inertiaCoeff11 = 0.33333333333333331 * (sizez + sizex) + diffCog; this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; - this._inertiaCoeff22 = 0.333333333333333315 * (sizex + sizey) + diffCog; + this._inertiaCoeff22 = 0.33333333333333331 * (sizex + sizey) + diffCog; } _computeAabb(aabb,tf) { - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; - var margin; - var marginX; - var marginY; - var marginZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; + let marginX; + let marginY; + let marginZ; marginX = this._gjkMargin; marginY = this._gjkMargin; marginZ = this._gjkMargin; - var localV; - var localVX; - var localVY; - var localVZ; - var v = this._vertices[0]; + let localVX; + let localVY; + let localVZ; + let v = this._vertices[0]; localVX = v.x; localVY = v.y; localVZ = v.z; - var worldV; - var worldVX; - var worldVY; - var worldVZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let worldVX; + let worldVY; + let worldVZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; @@ -3530,32 +3195,43 @@ oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_Conve maxX = worldVX; maxY = worldVY; maxZ = worldVZ; - var _g = 1; - var _g1 = this._numVertices; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; - var v1 = this._vertices[i]; - localVX = v1.x; - localVY = v1.y; - localVZ = v1.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; - __tmp__Y1 = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; - __tmp__Z1 = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; - worldVX = __tmp__X1; - worldVY = __tmp__Y1; - worldVZ = __tmp__Z1; + let v = this._vertices[_g++]; + localVX = v.x; + localVY = v.y; + localVZ = v.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X; + worldVY = __tmp__Y; + worldVZ = __tmp__Z; worldVX += tf._positionX; worldVY += tf._positionY; worldVZ += tf._positionZ; - minX = minX < worldVX ? minX : worldVX; - minY = minY < worldVY ? minY : worldVY; - minZ = minZ < worldVZ ? minZ : worldVZ; - maxX = maxX > worldVX ? maxX : worldVX; - maxY = maxY > worldVY ? maxY : worldVY; - maxZ = maxZ > worldVZ ? maxZ : worldVZ; + if(!(minX < worldVX)) { + minX = worldVX; + } + if(!(minY < worldVY)) { + minY = worldVY; + } + if(!(minZ < worldVZ)) { + minZ = worldVZ; + } + if(!(maxX > worldVX)) { + maxX = worldVX; + } + if(!(maxY > worldVY)) { + maxY = worldVY; + } + if(!(maxZ > worldVZ)) { + maxZ = worldVZ; + } } aabb._minX = minX - marginX; aabb._minY = minY - marginY; @@ -3565,21 +3241,21 @@ oimo.collision.geometry.ConvexHullGeometry = class oimo_collision_geometry_Conve aabb._maxZ = maxZ + marginZ; } computeLocalSupportingVertex(dir,out) { - var _this = this._vertices[0]; - var maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; - var maxIndex = 0; - var _g = 1; - var _g1 = this._numVertices; + let _this = this._vertices[0]; + let maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; + let maxIndex = 0; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; - var _this1 = this._vertices[i]; - var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; + let i = _g++; + let _this = this._vertices[i]; + let dot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; if(dot > maxDot) { maxDot = dot; maxIndex = i; } } - var v = this._vertices[maxIndex]; + let v = this._vertices[maxIndex]; out.x = v.x; out.y = v.y; out.z = v.z; @@ -3599,10 +3275,10 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde return this._halfHeight; } _updateMass() { - var r2 = this._radius * this._radius; - var h2 = this._halfHeight * this._halfHeight * 4; + let r2 = this._radius * this._radius; + let h2 = this._halfHeight * this._halfHeight * 4; this._volume = 3.14159265358979 * r2 * this._halfHeight * 2; - this._inertiaCoeff00 = 0.0833333333333333287 * (3 * r2 + h2); + this._inertiaCoeff00 = 0.083333333333333329 * (3 * r2 + h2); this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; this._inertiaCoeff10 = 0; @@ -3610,50 +3286,48 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde this._inertiaCoeff12 = 0; this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; - this._inertiaCoeff22 = 0.0833333333333333287 * (3 * r2 + h2); + this._inertiaCoeff22 = 0.083333333333333329 * (3 * r2 + h2); } _computeAabb(aabb,tf) { - var axis; - var axisX; - var axisY; - var axisZ; - var axis2; - var axis2X; - var axis2Y; - var axis2Z; - var eh; - var ehX; - var ehY; - var ehZ; - var er; - var erX; - var erY; - var erZ; + let axisX; + let axisY; + let axisZ; + let axis2X; + let axis2Y; + let axis2Z; + let ehX; + let ehY; + let ehZ; + let erX; + let erY; + let erZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; - var axis2x = axis2X; - var axis2y = axis2Y; - var axis2z = axis2Z; - erX = Math.sqrt(1 - axis2x); - erY = Math.sqrt(1 - axis2y); - erZ = Math.sqrt(1 - axis2z); + erX = Math.sqrt(1 - axis2X); + erY = Math.sqrt(1 - axis2Y); + erZ = Math.sqrt(1 - axis2Z); erX *= this._radius; erY *= this._radius; erZ *= this._radius; ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var max; - var maxX; - var maxY; - var maxZ; + let maxX; + let maxY; + let maxZ; maxX = erX + ehX; maxY = erY + ehY; maxZ = erZ + ehZ; @@ -3665,15 +3339,15 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde aabb._maxZ = tf._positionZ + maxZ; } computeLocalSupportingVertex(dir,out) { - var rx = dir.x; - var rz = dir.z; - var len = rx * rx + rz * rz; - var coreRadius = this._radius - this._gjkMargin; + let rx = dir.x; + let rz = dir.z; + let len = rx * rx + rz * rz; + let coreRadius = this._radius - this._gjkMargin; if(coreRadius < 0) { coreRadius = 0; } - var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; - var coreHeight = this._halfHeight - this._gjkMargin; + let invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + let coreHeight = this._halfHeight - this._gjkMargin; if(coreHeight < 0) { coreHeight = 0; } @@ -3682,28 +3356,22 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde out.z = rz * invLen; } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1x = beginX; - var p1y = beginY; - var p1z = beginZ; - var p2x = endX; - var p2y = endY; - var p2z = endZ; - var halfH = this._halfHeight; - var dx = p2x - p1x; - var dy = p2y - p1y; - var dz = p2z - p1z; - var tminy = 0; - var tmaxy = 1; + let halfH = this._halfHeight; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminy = 0; + let tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { - if(p1y <= -halfH || p1y >= halfH) { + if(beginY <= -halfH || beginY >= halfH) { return false; } } else { - var invDy = 1 / dy; - var t1 = (-halfH - p1y) * invDy; - var t2 = (halfH - p1y) * invDy; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -3717,18 +3385,17 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde if(tminy >= 1 || tmaxy <= 0) { return false; } - var tminxz = 0; - var tmaxxz = 1; - var a = dx * dx + dz * dz; - var b = p1x * dx + p1z * dz; - var c = p1x * p1x + p1z * p1z - this._radius * this._radius; - var D = b * b - a * c; + let tminxz = 0; + let tmaxxz = 1; + let a = dx * dx + dz * dz; + let b = beginX * dx + beginZ * dz; + let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + let D = b * b - a * c; if(D < 0) { return false; } - var t; if(a > 0) { - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; tmaxxz = (-b + sqrtD) / a; if(tminxz >= 1 || tmaxxz <= 0) { @@ -3741,7 +3408,7 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde tminxz = 0; tmaxxz = 1; } - var min; + let min; if(tmaxxz <= tminy || tmaxy <= tminxz) { return false; } @@ -3756,19 +3423,16 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde if(min == 0) { return false; } - var _this = hit.normal.init(p1x + dx * min,0,p1z + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; } - hit.position.init(p1x + min * dx,p1y + min * dy,p1z + min * dz); + hit.position.init(beginX + min * dx,beginY + min * dy,beginZ + min * dz); hit.fraction = min; return true; } @@ -3793,7 +3457,7 @@ oimo.collision.geometry.SphereGeometry = class oimo_collision_geometry_SphereGeo return this._radius; } _updateMass() { - this._volume = 4.18879020478638608 * this._radius * this._radius * this._radius; + this._volume = 4.1887902047863861 * this._radius * this._radius * this._radius; this._inertiaCoeff00 = 0.4 * this._radius * this._radius; this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; @@ -3805,10 +3469,9 @@ oimo.collision.geometry.SphereGeometry = class oimo_collision_geometry_SphereGeo this._inertiaCoeff22 = 0.4 * this._radius * this._radius; } _computeAabb(aabb,tf) { - var radVec; - var radVecX; - var radVecY; - var radVecZ; + let radVecX; + let radVecY; + let radVecZ; radVecX = this._radius; radVecY = this._radius; radVecZ = this._radius; @@ -3823,47 +3486,43 @@ oimo.collision.geometry.SphereGeometry = class oimo_collision_geometry_SphereGeo out.zero(); } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = endX - beginX; dY = endY - beginY; dZ = endZ - beginZ; - var a = dX * dX + dY * dY + dZ * dZ; - var b = beginX * dX + beginY * dY + beginZ * dZ; - var c = beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius; - var D = b * b - a * c; + let a = dX * dX + dY * dY + dZ * dZ; + let b = beginX * dX + beginY * dY + beginZ * dZ; + let D = b * b - a * (beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius); if(D < 0) { return false; } - var t = (-b - Math.sqrt(D)) / a; + let t = (-b - Math.sqrt(D)) / a; if(t < 0 || t > 1) { return false; } - var hitPos; - var hitPosX; - var hitPosY; - var hitPosZ; - var hitNormal; - var hitNormalX; - var hitNormalY; - var hitNormalZ; + let hitPosX; + let hitPosY; + let hitPosZ; + let hitNormalX; + let hitNormalY; + let hitNormalZ; hitPosX = beginX + dX * t; hitPosY = beginY + dY * t; hitPosZ = beginZ + dZ * t; - var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + let l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; if(l > 0) { l = 1 / Math.sqrt(l); } hitNormalX = hitPosX * l; hitNormalY = hitPosY * l; hitNormalZ = hitPosZ * l; - var v = hit.position; + let v = hit.position; v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; + let v1 = hit.normal; v1.x = hitNormalX; v1.y = hitNormalY; v1.z = hitNormalZ; @@ -3874,69 +3533,50 @@ oimo.collision.geometry.SphereGeometry = class oimo_collision_geometry_SphereGeo if(!oimo.collision.narrowphase) oimo.collision.narrowphase = {}; oimo.collision.narrowphase.CollisionMatrix = class oimo_collision_narrowphase_CollisionMatrix { constructor() { - var this1 = new Array(8); - this.detectors = this1; - var this2 = this.detectors; - var this3 = new Array(8); - this2[0] = this3; - var this4 = this.detectors; - var this5 = new Array(8); - this4[1] = this5; - var this6 = this.detectors; - var this7 = new Array(8); - this6[2] = this7; - var this8 = this.detectors; - var this9 = new Array(8); - this8[3] = this9; - var this10 = this.detectors; - var this11 = new Array(8); - this10[4] = this11; - var this12 = this.detectors; - var this13 = new Array(8); - this12[5] = this13; - var gjkEpaDetector = new oimo.collision.narrowphase.detector.GjkEpaDetector(); - var sp = 0; - var bo = 1; - var cy = 2; - var co = 3; - var ca = 4; - var ch = 5; - this.detectors[sp][sp] = new oimo.collision.narrowphase.detector.SphereSphereDetector(); - this.detectors[sp][bo] = new oimo.collision.narrowphase.detector.SphereBoxDetector(false); - this.detectors[sp][cy] = gjkEpaDetector; - this.detectors[sp][co] = gjkEpaDetector; - this.detectors[sp][ca] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(false); - this.detectors[sp][ch] = gjkEpaDetector; - this.detectors[bo][sp] = new oimo.collision.narrowphase.detector.SphereBoxDetector(true); - this.detectors[bo][bo] = new oimo.collision.narrowphase.detector.BoxBoxDetector(); - this.detectors[bo][cy] = gjkEpaDetector; - this.detectors[bo][co] = gjkEpaDetector; - this.detectors[bo][ca] = gjkEpaDetector; - this.detectors[bo][ch] = gjkEpaDetector; - this.detectors[cy][sp] = gjkEpaDetector; - this.detectors[cy][bo] = gjkEpaDetector; - this.detectors[cy][cy] = gjkEpaDetector; - this.detectors[cy][co] = gjkEpaDetector; - this.detectors[cy][ca] = gjkEpaDetector; - this.detectors[cy][ch] = gjkEpaDetector; - this.detectors[co][sp] = gjkEpaDetector; - this.detectors[co][bo] = gjkEpaDetector; - this.detectors[co][cy] = gjkEpaDetector; - this.detectors[co][co] = gjkEpaDetector; - this.detectors[co][ca] = gjkEpaDetector; - this.detectors[co][ch] = gjkEpaDetector; - this.detectors[ca][sp] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(true); - this.detectors[ca][bo] = gjkEpaDetector; - this.detectors[ca][cy] = gjkEpaDetector; - this.detectors[ca][co] = gjkEpaDetector; - this.detectors[ca][ca] = new oimo.collision.narrowphase.detector.CapsuleCapsuleDetector(); - this.detectors[ca][ch] = gjkEpaDetector; - this.detectors[ch][sp] = gjkEpaDetector; - this.detectors[ch][bo] = gjkEpaDetector; - this.detectors[ch][cy] = gjkEpaDetector; - this.detectors[ch][co] = gjkEpaDetector; - this.detectors[ch][ca] = gjkEpaDetector; - this.detectors[ch][ch] = gjkEpaDetector; + this.detectors = new Array(8); + this.detectors[0] = new Array(8); + this.detectors[1] = new Array(8); + this.detectors[2] = new Array(8); + this.detectors[3] = new Array(8); + this.detectors[4] = new Array(8); + this.detectors[5] = new Array(8); + let gjkEpaDetector = new oimo.collision.narrowphase.detector.GjkEpaDetector(); + this.detectors[0][0] = new oimo.collision.narrowphase.detector.SphereSphereDetector(); + this.detectors[0][1] = new oimo.collision.narrowphase.detector.SphereBoxDetector(false); + this.detectors[0][2] = gjkEpaDetector; + this.detectors[0][3] = gjkEpaDetector; + this.detectors[0][4] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(false); + this.detectors[0][5] = gjkEpaDetector; + this.detectors[1][0] = new oimo.collision.narrowphase.detector.SphereBoxDetector(true); + this.detectors[1][1] = new oimo.collision.narrowphase.detector.BoxBoxDetector(); + this.detectors[1][2] = gjkEpaDetector; + this.detectors[1][3] = gjkEpaDetector; + this.detectors[1][4] = gjkEpaDetector; + this.detectors[1][5] = gjkEpaDetector; + this.detectors[2][0] = gjkEpaDetector; + this.detectors[2][1] = gjkEpaDetector; + this.detectors[2][2] = gjkEpaDetector; + this.detectors[2][3] = gjkEpaDetector; + this.detectors[2][4] = gjkEpaDetector; + this.detectors[2][5] = gjkEpaDetector; + this.detectors[3][0] = gjkEpaDetector; + this.detectors[3][1] = gjkEpaDetector; + this.detectors[3][2] = gjkEpaDetector; + this.detectors[3][3] = gjkEpaDetector; + this.detectors[3][4] = gjkEpaDetector; + this.detectors[3][5] = gjkEpaDetector; + this.detectors[4][0] = new oimo.collision.narrowphase.detector.SphereCapsuleDetector(true); + this.detectors[4][1] = gjkEpaDetector; + this.detectors[4][2] = gjkEpaDetector; + this.detectors[4][3] = gjkEpaDetector; + this.detectors[4][4] = new oimo.collision.narrowphase.detector.CapsuleCapsuleDetector(); + this.detectors[4][5] = gjkEpaDetector; + this.detectors[5][0] = gjkEpaDetector; + this.detectors[5][1] = gjkEpaDetector; + this.detectors[5][2] = gjkEpaDetector; + this.detectors[5][3] = gjkEpaDetector; + this.detectors[5][4] = gjkEpaDetector; + this.detectors[5][5] = gjkEpaDetector; } getDetector(geomType1,geomType2) { return this.detectors[geomType1][geomType2]; @@ -3946,22 +3586,18 @@ oimo.collision.narrowphase.DetectorResult = class oimo_collision_narrowphase_Det constructor() { this.numPoints = 0; this.normal = new oimo.common.Vec3(); - var this1 = new Array(oimo.common.Setting.maxManifoldPoints); - this.points = this1; + this.points = new Array(oimo.common.Setting.maxManifoldPoints); this.incremental = false; - var _g = 0; - var _g1 = oimo.common.Setting.maxManifoldPoints; - while(_g < _g1) { - var i = _g++; - this.points[i] = new oimo.collision.narrowphase.DetectorResultPoint(); - } + let _g = 0; + let _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) this.points[_g++] = new oimo.collision.narrowphase.DetectorResultPoint(); } getMaxDepth() { - var max = 0; - var _g = 0; - var _g1 = this.numPoints; + let max = 0; + let _g = 0; + let _g1 = this.numPoints; while(_g < _g1) { - var i = _g++; + let i = _g++; if(this.points[i].depth > max) { max = this.points[i].depth; } @@ -3970,10 +3606,10 @@ oimo.collision.narrowphase.DetectorResult = class oimo_collision_narrowphase_Det } clear() { this.numPoints = 0; - var _g = 0; - var _g1 = this.points; + let _g = 0; + let _g1 = this.points; while(_g < _g1.length) { - var p = _g1[_g]; + let p = _g1[_g]; ++_g; p.position1.zero(); p.position2.zero(); @@ -3997,52 +3633,49 @@ oimo.collision.narrowphase.detector.Detector = class oimo_collision_narrowphase_ this.swapped = swapped; } setNormal(result,nX,nY,nZ) { - var v = result.normal; + let v = result.normal; v.x = nX; v.y = nY; v.z = nZ; if(this.swapped) { - var _this = result.normal; - var tx = -_this.x; - var ty = -_this.y; - var tz = -_this.z; - _this.x = tx; - _this.y = ty; - _this.z = tz; + let _this = result.normal; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; } } addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { - var p = result.points[result.numPoints++]; + let p = result.points[result.numPoints++]; p.depth = depth; p.id = id; if(this.swapped) { - var v = p.position1; + let v = p.position1; v.x = pos2X; v.y = pos2Y; v.z = pos2Z; - var v1 = p.position2; + let v1 = p.position2; v1.x = pos1X; v1.y = pos1Y; v1.z = pos1Z; } else { - var v2 = p.position1; - v2.x = pos1X; - v2.y = pos1Y; - v2.z = pos1Z; - var v3 = p.position2; - v3.x = pos2X; - v3.y = pos2Y; - v3.z = pos2Z; + let v = p.position1; + v.x = pos1X; + v.y = pos1Y; + v.z = pos1Z; + let v1 = p.position2; + v1.x = pos2X; + v1.y = pos2Y; + v1.z = pos2Z; } } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { } detect(result,geom1,geom2,transform1,transform2,cachedData) { result.numPoints = 0; - var _g = 0; - var _g1 = result.points; + let _g = 0; + let _g1 = result.points; while(_g < _g1.length) { - var p = _g1[_g]; + let p = _g1[_g]; ++_g; p.position1.zero(); p.position2.zero(); @@ -4063,21 +3696,18 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow this.clipper = new oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper(); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var b1 = geom1; - var b2 = geom2; + let b1 = geom1; + let b2 = geom2; result.incremental = false; - var c1; - var c1X; - var c1Y; - var c1Z; - var c2; - var c2X; - var c2Y; - var c2Z; - var c12; - var c12X; - var c12Y; - var c12Z; + let c1X; + let c1Y; + let c1Z; + let c2X; + let c2Y; + let c2Z; + let c12X; + let c12Y; + let c12Z; c1X = tf1._positionX; c1Y = tf1._positionY; c1Z = tf1._positionZ; @@ -4087,30 +3717,24 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow c12X = c2X - c1X; c12Y = c2Y - c1Y; c12Z = c2Z - c1Z; - var x1; - var x1X; - var x1Y; - var x1Z; - var y1; - var y1X; - var y1Y; - var y1Z; - var z1; - var z1X; - var z1Y; - var z1Z; - var x2; - var x2X; - var x2Y; - var x2Z; - var y2; - var y2X; - var y2Y; - var y2Z; - var z2; - var z2X; - var z2Y; - var z2Z; + let x1X; + let x1Y; + let x1Z; + let y1X; + let y1Y; + let y1Z; + let z1X; + let z1Y; + let z1Z; + let x2X; + let x2Y; + let x2Z; + let y2X; + let y2Y; + let y2Z; + let z2X; + let z2Y; + let z2Z; x1X = tf1._rotation00; x1Y = tf1._rotation10; x1Z = tf1._rotation20; @@ -4129,36 +3753,30 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow z2X = tf2._rotation02; z2Y = tf2._rotation12; z2Z = tf2._rotation22; - var w1 = b1._halfExtentsX; - var h1 = b1._halfExtentsY; - var d1 = b1._halfExtentsZ; - var w2 = b2._halfExtentsX; - var h2 = b2._halfExtentsY; - var d2 = b2._halfExtentsZ; - var sx1; - var sx1X; - var sx1Y; - var sx1Z; - var sy1; - var sy1X; - var sy1Y; - var sy1Z; - var sz1; - var sz1X; - var sz1Y; - var sz1Z; - var sx2; - var sx2X; - var sx2Y; - var sx2Z; - var sy2; - var sy2X; - var sy2Y; - var sy2Z; - var sz2; - var sz2X; - var sz2Y; - var sz2Z; + let w1 = b1._halfExtentsX; + let h1 = b1._halfExtentsY; + let d1 = b1._halfExtentsZ; + let w2 = b2._halfExtentsX; + let h2 = b2._halfExtentsY; + let d2 = b2._halfExtentsZ; + let sx1X; + let sx1Y; + let sx1Z; + let sy1X; + let sy1Y; + let sy1Z; + let sz1X; + let sz1Y; + let sz1Z; + let sx2X; + let sx2Y; + let sx2Z; + let sy2X; + let sy2Y; + let sy2Z; + let sz2X; + let sz2Y; + let sz2Z; sx1X = x1X * w1; sx1Y = x1Y * w1; sx1Z = x1Z * w1; @@ -4177,22 +3795,19 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow sz2X = z2X * d2; sz2Y = z2Y * d2; sz2Z = z2Z * d2; - var projSum; - var projC12Abs; - var mDepth = 1e65536; - var mId = -1; - var mSign = 0; - var mAxis; - var mAxisX; - var mAxisY; - var mAxisZ; + let mDepth = 1e65536; + let mId = -1; + let mSign = 0; + let mAxisX; + let mAxisY; + let mAxisZ; mAxisX = 0; mAxisY = 0; mAxisZ = 0; - var proj1 = w1; - var dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; - var dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; - var dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; + let proj1 = w1; + let dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; + let dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; + let dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; if(dx < 0) { dx = -dx; } @@ -4202,14 +3817,14 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow if(dz < 0) { dz = -dz; } - var proj2 = dx + dy + dz; - var projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; - var sum = proj1 + proj2; - var neg = projC12 < 0; - var abs = neg ? -projC12 : projC12; + let proj2 = dx + dy + dz; + let projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; if(abs < sum) { - var depth = sum - abs; - if(depth < mDepth) { + let depth = sum - abs; + if(depth < 1e65536) { mDepth = depth; mId = 0; mAxisX = x1X; @@ -4221,9 +3836,9 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow return; } proj1 = h1; - var dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; - var dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; - var dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; + let dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; + let dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; + let dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; if(dx1 < 0) { dx1 = -dx1; } @@ -4235,13 +3850,13 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } proj2 = dx1 + dy1 + dz1; projC12 = y1X * c12X + y1Y * c12Y + y1Z * c12Z; - var sum1 = proj1 + proj2; - var neg1 = projC12 < 0; - var abs1 = neg1 ? -projC12 : projC12; + let sum1 = proj1 + proj2; + let neg1 = projC12 < 0; + let abs1 = neg1 ? -projC12 : projC12; if(abs1 < sum1) { - var depth1 = sum1 - abs1; - if(depth1 < mDepth) { - mDepth = depth1; + let depth = sum1 - abs1; + if(depth < mDepth) { + mDepth = depth; mId = 1; mAxisX = y1X; mAxisY = y1Y; @@ -4252,9 +3867,9 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow return; } proj1 = d1; - var dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; - var dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; - var dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; + let dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; + let dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; + let dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; if(dx2 < 0) { dx2 = -dx2; } @@ -4266,13 +3881,13 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } proj2 = dx2 + dy2 + dz2; projC12 = z1X * c12X + z1Y * c12Y + z1Z * c12Z; - var sum2 = proj1 + proj2; - var neg2 = projC12 < 0; - var abs2 = neg2 ? -projC12 : projC12; + let sum2 = proj1 + proj2; + let neg2 = projC12 < 0; + let abs2 = neg2 ? -projC12 : projC12; if(abs2 < sum2) { - var depth2 = sum2 - abs2; - if(depth2 < mDepth) { - mDepth = depth2; + let depth = sum2 - abs2; + if(depth < mDepth) { + mDepth = depth; mId = 2; mAxisX = z1X; mAxisY = z1Y; @@ -4287,9 +3902,9 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } else { mDepth = 0; } - var dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; - var dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; - var dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; + let dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; + let dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; + let dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; if(dx3 < 0) { dx3 = -dx3; } @@ -4302,13 +3917,13 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow proj1 = dx3 + dy3 + dz3; proj2 = w2; projC12 = x2X * c12X + x2Y * c12Y + x2Z * c12Z; - var sum3 = proj1 + proj2; - var neg3 = projC12 < 0; - var abs3 = neg3 ? -projC12 : projC12; + let sum3 = proj1 + proj2; + let neg3 = projC12 < 0; + let abs3 = neg3 ? -projC12 : projC12; if(abs3 < sum3) { - var depth3 = sum3 - abs3; - if(depth3 < mDepth) { - mDepth = depth3; + let depth = sum3 - abs3; + if(depth < mDepth) { + mDepth = depth; mId = 3; mAxisX = x2X; mAxisY = x2Y; @@ -4318,9 +3933,9 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } else { return; } - var dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; - var dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; - var dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; + let dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; + let dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; + let dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; if(dx4 < 0) { dx4 = -dx4; } @@ -4333,13 +3948,13 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow proj1 = dx4 + dy4 + dz4; proj2 = h2; projC12 = y2X * c12X + y2Y * c12Y + y2Z * c12Z; - var sum4 = proj1 + proj2; - var neg4 = projC12 < 0; - var abs4 = neg4 ? -projC12 : projC12; + let sum4 = proj1 + proj2; + let neg4 = projC12 < 0; + let abs4 = neg4 ? -projC12 : projC12; if(abs4 < sum4) { - var depth4 = sum4 - abs4; - if(depth4 < mDepth) { - mDepth = depth4; + let depth = sum4 - abs4; + if(depth < mDepth) { + mDepth = depth; mId = 4; mAxisX = y2X; mAxisY = y2Y; @@ -4349,9 +3964,9 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } else { return; } - var dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; - var dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; - var dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; + let dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; + let dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; + let dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; if(dx5 < 0) { dx5 = -dx5; } @@ -4364,13 +3979,13 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow proj1 = dx5 + dy5 + dz5; proj2 = d2; projC12 = z2X * c12X + z2Y * c12Y + z2Z * c12Z; - var sum5 = proj1 + proj2; - var neg5 = projC12 < 0; - var abs5 = neg5 ? -projC12 : projC12; + let sum5 = proj1 + proj2; + let neg5 = projC12 < 0; + let abs5 = neg5 ? -projC12 : projC12; if(abs5 < sum5) { - var depth5 = sum5 - abs5; - if(depth5 < mDepth) { - mDepth = depth5; + let depth = sum5 - abs5; + if(depth < mDepth) { + mDepth = depth; mId = 5; mAxisX = z2X; mAxisY = z2Y; @@ -4385,52 +4000,51 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } else { mDepth = 0; } - var edgeAxis; - var edgeAxisX; - var edgeAxisY; - var edgeAxisZ; + let edgeAxisX; + let edgeAxisY; + let edgeAxisZ; edgeAxisX = x1Y * x2Z - x1Z * x2Y; edgeAxisY = x1Z * x2X - x1X * x2Z; edgeAxisZ = x1X * x2Y - x1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; if(l > 0) { l = 1 / Math.sqrt(l); } edgeAxisX *= l; edgeAxisY *= l; edgeAxisZ *= l; - var dx6 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy6 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx6 < 0) { - dx6 = -dx6; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy6 < 0) { - dy6 = -dy6; + if(dy < 0) { + dy = -dy; } - proj1 = dx6 + dy6; - var dx7 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy7 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx7 < 0) { - dx7 = -dx7; + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; } - if(dy7 < 0) { - dy7 = -dy7; + if(dy1 < 0) { + dy1 = -dy1; } - proj2 = dx7 + dy7; + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum6 = proj1 + proj2; - var neg6 = projC12 < 0; - var abs6 = neg6 ? -projC12 : projC12; - if(abs6 < sum6) { - var depth6 = sum6 - abs6; - if(depth6 < mDepth) { - mDepth = depth6; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 6; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg6 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4440,44 +4054,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = x1Z * y2X - x1X * y2Z; edgeAxisZ = x1X * y2Y - x1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l1 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - edgeAxisX *= l1; - edgeAxisY *= l1; - edgeAxisZ *= l1; - var dx8 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy8 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx8 < 0) { - dx8 = -dx8; - } - if(dy8 < 0) { - dy8 = -dy8; - } - proj1 = dx8 + dy8; - var dx9 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy9 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx9 < 0) { - dx9 = -dx9; - } - if(dy9 < 0) { - dy9 = -dy9; - } - proj2 = dx9 + dy9; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum7 = proj1 + proj2; - var neg7 = projC12 < 0; - var abs7 = neg7 ? -projC12 : projC12; - if(abs7 < sum7) { - var depth7 = sum7 - abs7; - if(depth7 < mDepth) { - mDepth = depth7; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 7; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg7 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4487,91 +4101,91 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = x1Z * z2X - x1X * z2Z; edgeAxisZ = x1X * z2Y - x1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l2 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - edgeAxisX *= l2; - edgeAxisY *= l2; - edgeAxisZ *= l2; - var dx10 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy10 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx10 < 0) { - dx10 = -dx10; - } - if(dy10 < 0) { - dy10 = -dy10; - } - proj1 = dx10 + dy10; - var dx11 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy11 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx11 < 0) { - dx11 = -dx11; - } - if(dy11 < 0) { - dy11 = -dy11; - } - proj2 = dx11 + dy11; - projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum8 = proj1 + proj2; - var neg8 = projC12 < 0; - var abs8 = neg8 ? -projC12 : projC12; - if(abs8 < sum8) { - var depth8 = sum8 - abs8; - if(depth8 < mDepth) { - mDepth = depth8; - mId = 8; - mAxisX = edgeAxisX; - mAxisY = edgeAxisY; - mAxisZ = edgeAxisZ; - mSign = neg8 ? -1 : 1; - } - } else { - return; - } + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; + mId = 8; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg ? -1 : 1; + } + } else { + return; + } } edgeAxisX = y1Y * x2Z - y1Z * x2Y; edgeAxisY = y1Z * x2X - y1X * x2Z; edgeAxisZ = y1X * x2Y - y1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l3 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - edgeAxisX *= l3; - edgeAxisY *= l3; - edgeAxisZ *= l3; - var dx12 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy12 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx12 < 0) { - dx12 = -dx12; - } - if(dy12 < 0) { - dy12 = -dy12; - } - proj1 = dx12 + dy12; - var dx13 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy13 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx13 < 0) { - dx13 = -dx13; - } - if(dy13 < 0) { - dy13 = -dy13; - } - proj2 = dx13 + dy13; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum9 = proj1 + proj2; - var neg9 = projC12 < 0; - var abs9 = neg9 ? -projC12 : projC12; - if(abs9 < sum9) { - var depth9 = sum9 - abs9; - if(depth9 < mDepth) { - mDepth = depth9; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 9; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg9 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4581,44 +4195,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = y1Z * y2X - y1X * y2Z; edgeAxisZ = y1X * y2Y - y1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l4 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - edgeAxisX *= l4; - edgeAxisY *= l4; - edgeAxisZ *= l4; - var dx14 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy14 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx14 < 0) { - dx14 = -dx14; - } - if(dy14 < 0) { - dy14 = -dy14; - } - proj1 = dx14 + dy14; - var dx15 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy15 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx15 < 0) { - dx15 = -dx15; - } - if(dy15 < 0) { - dy15 = -dy15; - } - proj2 = dx15 + dy15; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum10 = proj1 + proj2; - var neg10 = projC12 < 0; - var abs10 = neg10 ? -projC12 : projC12; - if(abs10 < sum10) { - var depth10 = sum10 - abs10; - if(depth10 < mDepth) { - mDepth = depth10; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 10; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg10 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4628,44 +4242,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = y1Z * z2X - y1X * z2Z; edgeAxisZ = y1X * z2Y - y1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l5 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); - } - edgeAxisX *= l5; - edgeAxisY *= l5; - edgeAxisZ *= l5; - var dx16 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy16 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx16 < 0) { - dx16 = -dx16; - } - if(dy16 < 0) { - dy16 = -dy16; - } - proj1 = dx16 + dy16; - var dx17 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy17 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx17 < 0) { - dx17 = -dx17; - } - if(dy17 < 0) { - dy17 = -dy17; - } - proj2 = dx17 + dy17; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum11 = proj1 + proj2; - var neg11 = projC12 < 0; - var abs11 = neg11 ? -projC12 : projC12; - if(abs11 < sum11) { - var depth11 = sum11 - abs11; - if(depth11 < mDepth) { - mDepth = depth11; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 11; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg11 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4675,44 +4289,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = z1Z * x2X - z1X * x2Z; edgeAxisZ = z1X * x2Y - z1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l6 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l6 > 0) { - l6 = 1 / Math.sqrt(l6); - } - edgeAxisX *= l6; - edgeAxisY *= l6; - edgeAxisZ *= l6; - var dx18 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy18 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx18 < 0) { - dx18 = -dx18; - } - if(dy18 < 0) { - dy18 = -dy18; - } - proj1 = dx18 + dy18; - var dx19 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy19 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx19 < 0) { - dx19 = -dx19; - } - if(dy19 < 0) { - dy19 = -dy19; - } - proj2 = dx19 + dy19; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum12 = proj1 + proj2; - var neg12 = projC12 < 0; - var abs12 = neg12 ? -projC12 : projC12; - if(abs12 < sum12) { - var depth12 = sum12 - abs12; - if(depth12 < mDepth) { - mDepth = depth12; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 12; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg12 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4722,44 +4336,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = z1Z * y2X - z1X * y2Z; edgeAxisZ = z1X * y2Y - z1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l7 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l7 > 0) { - l7 = 1 / Math.sqrt(l7); - } - edgeAxisX *= l7; - edgeAxisY *= l7; - edgeAxisZ *= l7; - var dx20 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy20 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx20 < 0) { - dx20 = -dx20; - } - if(dy20 < 0) { - dy20 = -dy20; - } - proj1 = dx20 + dy20; - var dx21 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy21 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx21 < 0) { - dx21 = -dx21; - } - if(dy21 < 0) { - dy21 = -dy21; - } - proj2 = dx21 + dy21; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum13 = proj1 + proj2; - var neg13 = projC12 < 0; - var abs13 = neg13 ? -projC12 : projC12; - if(abs13 < sum13) { - var depth13 = sum13 - abs13; - if(depth13 < mDepth) { - mDepth = depth13; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 13; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg13 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4769,44 +4383,44 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow edgeAxisY = z1Z * z2X - z1X * z2Z; edgeAxisZ = z1X * z2Y - z1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l8 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l8 > 0) { - l8 = 1 / Math.sqrt(l8); - } - edgeAxisX *= l8; - edgeAxisY *= l8; - edgeAxisZ *= l8; - var dx22 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy22 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx22 < 0) { - dx22 = -dx22; - } - if(dy22 < 0) { - dy22 = -dy22; - } - proj1 = dx22 + dy22; - var dx23 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy23 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx23 < 0) { - dx23 = -dx23; - } - if(dy23 < 0) { - dy23 = -dy23; - } - proj2 = dx23 + dy23; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum14 = proj1 + proj2; - var neg14 = projC12 < 0; - var abs14 = neg14 ? -projC12 : projC12; - if(abs14 < sum14) { - var depth14 = sum14 - abs14; - if(depth14 < mDepth) { - mDepth = depth14; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 14; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg14 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4816,32 +4430,27 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow mAxisX *= mSign; mAxisY *= mSign; mAxisZ *= mSign; - var id1 = (mId - 6) / 3 | 0; - var id2 = mId - 6 - id1 * 3; - var p1; - var p1X; - var p1Y; - var p1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - var d11; - var d1X; - var d1Y; - var d1Z; - var d21; - var d2X; - var d2Y; - var d2Z; + let id1 = (mId - 6) / 3 | 0; + let id2 = mId - 6 - id1 * 3; + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; + let d1X; + let d1Y; + let d1Z; + let d2X; + let d2Y; + let d2Z; switch(id1) { case 0: d1X = x1X; d1Y = x1Y; d1Z = x1Z; - var signX = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; - var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; - if(signX) { + let signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0) { if(signY) { p1X = sy1X + sz1X; p1Y = sy1Y + sz1Y; @@ -4868,9 +4477,8 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow d1X = y1X; d1Y = y1Y; d1Z = y1Z; - var signX1 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; - var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; - if(signX1) { + let signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY1) { p1X = sx1X + sz1X; p1Y = sx1Y + sz1Y; @@ -4897,9 +4505,8 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow d1X = z1X; d1Y = z1Y; d1Z = z1Z; - var signX2 = sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0; - var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; - if(signX2) { + let signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY2) { p1X = sx1X + sy1X; p1Y = sx1Y + sy1Y; @@ -4930,9 +4537,8 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow d2X = x2X; d2Y = x2Y; d2Z = x2Z; - var signX3 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; - var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; - if(signX3) { + let signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0) { if(signY3) { p2X = sy2X + sz2X; p2Y = sy2Y + sz2Y; @@ -4959,9 +4565,8 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow d2X = y2X; d2Y = y2Y; d2Z = y2Z; - var signX4 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; - var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; - if(signX4) { + let signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY4) { p2X = sx2X + sz2X; p2Y = sx2Y + sz2Y; @@ -4988,9 +4593,8 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow d2X = z2X; d2Y = z2Y; d2Z = z2Z; - var signX5 = sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0; - var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; - if(signX5) { + let signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY5) { p2X = sx2X + sy2X; p2Y = sx2Y + sy2Y; @@ -5016,37 +4620,33 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow p2X = c2X - p2X; p2Y = c2Y - p2Y; p2Z = c2Z - p2Z; - var r; - var rX; - var rY; - var rZ; + let rX; + let rY; + let rZ; rX = p1X - p2X; rY = p1Y - p2Y; rZ = p1Z - p2Z; - var dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; - var dot1r = d1X * rX + d1Y * rY + d1Z * rZ; - var dot2r = d2X * rX + d2Y * rY + d2Z * rZ; - var invDet = 1 / (1 - dot12 * dot12); - var t1 = (dot12 * dot2r - dot1r) * invDet; - var t2 = (dot2r - dot12 * dot1r) * invDet; - var cp1; - var cp1X; - var cp1Y; - var cp1Z; - var cp2; - var cp2X; - var cp2Y; - var cp2Z; + let dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + let dot1r = d1X * rX + d1Y * rY + d1Z * rZ; + let dot2r = d2X * rX + d2Y * rY + d2Z * rZ; + let invDet = 1 / (1 - dot12 * dot12); + let t1 = (dot12 * dot2r - dot1r) * invDet; + let t2 = (dot2r - dot12 * dot1r) * invDet; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; cp1X = p1X + d1X * t1; cp1Y = p1Y + d1Y * t1; cp1Z = p1Z + d1Z * t1; cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var normal; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = -mAxisX; normalY = -mAxisY; normalZ = -mAxisZ; @@ -5054,28 +4654,27 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow this.addPoint(result,cp1X,cp1Y,cp1Z,cp2X,cp2Y,cp2Z,mDepth,4); return; } - var tmp; - var tmpX; - var tmpY; - var tmpZ; - var swapped; + let tmpX; + let tmpY; + let tmpZ; + let swapped; if(mId >= 3) { mSign = -mSign; c12X = -c12X; c12Y = -c12Y; c12Z = -c12Z; - var tmp1 = b1; + let tmp = b1; b1 = b2; - b2 = tmp1; - var tmp2 = w1; + b2 = tmp; + let tmp1 = w1; w1 = w2; - w2 = tmp2; - var tmp3 = h1; + w2 = tmp1; + let tmp2 = h1; h1 = h2; - h2 = tmp3; - var tmp4 = d1; + h2 = tmp2; + let tmp3 = d1; d1 = d2; - d2 = tmp4; + d2 = tmp3; tmpX = c1X; tmpY = c1Y; tmpZ = c1Z; @@ -5144,24 +4743,20 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow } else { swapped = false; } - var refCenter; - var refCenterX; - var refCenterY; - var refCenterZ; - var refNormal; - var refNormalX; - var refNormalY; - var refNormalZ; - var refX; - var refXX; - var refXY; - var refXZ; - var refY; - var refYX; - var refYY; - var refYZ; - var refW; - var refH; + let refCenterX; + let refCenterY; + let refCenterZ; + let refNormalX; + let refNormalY; + let refNormalZ; + let refXX; + let refXY; + let refXZ; + let refYX; + let refYY; + let refYZ; + let refW; + let refH; switch(mId) { case 0: refCenterX = sx1X; @@ -5227,16 +4822,16 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow refYX = tmpX; refYY = tmpY; refYZ = tmpZ; - var tmp5 = refW; + let tmp = refW; refW = refH; - refH = tmp5; + refH = tmp; } refCenterX += c1X; refCenterY += c1Y; refCenterZ += c1Z; - var minIncDot = 1; - var incId = 0; - var incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; + let minIncDot = 1; + let incId = 0; + let incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; if(incDot < minIncDot) { minIncDot = incDot; incId = 0; @@ -5263,22 +4858,18 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow minIncDot = -incDot; incId = 5; } - var incV1; - var incV1X; - var incV1Y; - var incV1Z; - var incV2; - var incV2X; - var incV2Y; - var incV2Z; - var incV3; - var incV3X; - var incV3Y; - var incV3Z; - var incV4; - var incV4X; - var incV4Y; - var incV4Z; + let incV1X; + let incV1Y; + let incV1Z; + let incV2X; + let incV2Y; + let incV2Z; + let incV3X; + let incV3Y; + let incV3Z; + let incV4X; + let incV4Y; + let incV4Z; switch(incId) { case 0: incV1X = sx2X + sy2X; @@ -5466,34 +5057,34 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow incV4X += c12X; incV4Y += c12Y; incV4Z += c12Z; - var _this = this.clipper; + let _this = this.clipper; _this.w = refW; _this.h = refH; _this.numVertices = 0; _this.numTmpVertices = 0; - var _this1 = this.clipper; - var _this2 = _this1.vertices[_this1.numVertices++]; + let _this1 = this.clipper; + let _this2 = _this1.vertices[_this1.numVertices++]; _this2.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; _this2.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; _this2.wx = incV1X; _this2.wy = incV1Y; _this2.wz = incV1Z; - var _this3 = this.clipper; - var _this4 = _this3.vertices[_this3.numVertices++]; + let _this3 = this.clipper; + let _this4 = _this3.vertices[_this3.numVertices++]; _this4.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; _this4.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; _this4.wx = incV2X; _this4.wy = incV2Y; _this4.wz = incV2Z; - var _this5 = this.clipper; - var _this6 = _this5.vertices[_this5.numVertices++]; + let _this5 = this.clipper; + let _this6 = _this5.vertices[_this5.numVertices++]; _this6.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; _this6.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; _this6.wx = incV3X; _this6.wy = incV3Y; _this6.wz = incV3Z; - var _this7 = this.clipper; - var _this8 = _this7.vertices[_this7.numVertices++]; + let _this7 = this.clipper; + let _this8 = _this7.vertices[_this7.numVertices++]; _this8.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; _this8.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; _this8.wx = incV4X; @@ -5501,55 +5092,51 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow _this8.wz = incV4Z; this.clipper.clip(); this.clipper.reduce(); - var normal1; - var normalX1; - var normalY1; - var normalZ1; + let normalX; + let normalY; + let normalZ; if(swapped) { - normalX1 = refNormalX; - normalY1 = refNormalY; - normalZ1 = refNormalZ; + normalX = refNormalX; + normalY = refNormalY; + normalZ = refNormalZ; } else { - normalX1 = -refNormalX; - normalY1 = -refNormalY; - normalZ1 = -refNormalZ; + normalX = -refNormalX; + normalY = -refNormalY; + normalZ = -refNormalZ; } - this.setNormal(result,normalX1,normalY1,normalZ1); - var _g = 0; - var _g1 = this.clipper.numVertices; + this.setNormal(result,normalX,normalY,normalZ); + let _g = 0; + let _g1 = this.clipper.numVertices; while(_g < _g1) { - var i = _g++; - var v = this.clipper.vertices[i]; - var clippedVertex; - var clippedVertexX; - var clippedVertexY; - var clippedVertexZ; + let i = _g++; + let v = this.clipper.vertices[i]; + let clippedVertexX; + let clippedVertexY; + let clippedVertexZ; clippedVertexX = v.wx; clippedVertexY = v.wy; clippedVertexZ = v.wz; clippedVertexX += c1X; clippedVertexY += c1Y; clippedVertexZ += c1Z; - var clippedVertexToRefCenter; - var clippedVertexToRefCenterX; - var clippedVertexToRefCenterY; - var clippedVertexToRefCenterZ; + let clippedVertexToRefCenterX; + let clippedVertexToRefCenterY; + let clippedVertexToRefCenterZ; clippedVertexToRefCenterX = refCenterX - clippedVertexX; clippedVertexToRefCenterY = refCenterY - clippedVertexY; clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; - var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; - var clippedVertexOnRefFace; - var clippedVertexOnRefFaceX; - var clippedVertexOnRefFaceY; - var clippedVertexOnRefFaceZ; - clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth15; - clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth15; - clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth15; - if(depth15 > -oimo.common.Setting.contactPersistenceThreshold) { + let depth = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; + let clippedVertexOnRefFaceX; + let clippedVertexOnRefFaceY; + let clippedVertexOnRefFaceZ; + clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth; + clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth; + clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth; + if(depth > -oimo.common.Setting.contactPersistenceThreshold) { if(swapped) { - this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth15,i); + this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth,i); } else { - this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth15,i); + this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth,i); } } } @@ -5571,10 +5158,8 @@ oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_col this.h = 0; this.numVertices = 0; this.numTmpVertices = 0; - var this1 = new Array(8); - this.vertices = this1; - var this2 = new Array(8); - this.tmpVertices = this2; + this.vertices = new Array(8); + this.tmpVertices = new Array(8); this.vertices[0] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); this.tmpVertices[0] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); this.vertices[1] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); @@ -5593,178 +5178,178 @@ oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_col this.tmpVertices[7] = new oimo.collision.narrowphase.detector._BoxBoxDetector.IncidentVertex(); } clip() { - var _g = 0; - var _g1 = this.numVertices; + let _g = 0; + let _g1 = this.numVertices; while(_g < _g1) { - var i = _g++; - var v1 = this.vertices[i]; - var v2 = this.vertices[(i + 1) % this.numVertices]; - var s1 = this.w + v1.x; - var s2 = this.w + v2.x; + let i = _g++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.w + v1.x; + let s2 = this.w + v2.x; if(s1 > 0 && s2 > 0) { - var _this = this.tmpVertices[this.numTmpVertices++]; + let _this = this.tmpVertices[this.numTmpVertices++]; _this.x = v1.x; _this.y = v1.y; _this.wx = v1.wx; _this.wy = v1.wy; _this.wz = v1.wz; } else if(s1 > 0 && s2 <= 0) { - var _this1 = this.tmpVertices[this.numTmpVertices++]; - _this1.x = v1.x; - _this1.y = v1.y; - _this1.wx = v1.wx; - _this1.wy = v1.wy; - _this1.wz = v1.wz; - var t = s1 / (s1 - s2); - var _this2 = this.tmpVertices[this.numTmpVertices++]; - _this2.x = v1.x + (v2.x - v1.x) * t; - _this2.y = v1.y + (v2.y - v1.y) * t; - _this2.wx = v1.wx + (v2.wx - v1.wx) * t; - _this2.wy = v1.wy + (v2.wy - v1.wy) * t; - _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; } else if(s1 <= 0 && s2 > 0) { - var t1 = s1 / (s1 - s2); - var _this3 = this.tmpVertices[this.numTmpVertices++]; - _this3.x = v1.x + (v2.x - v1.x) * t1; - _this3.y = v1.y + (v2.y - v1.y) * t1; - _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; - _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; - _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; } } - var tmp = this.vertices; + let tmp = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g2 = 0; - var _g11 = this.numVertices; - while(_g2 < _g11) { - var i1 = _g2++; - var v11 = this.vertices[i1]; - var v21 = this.vertices[(i1 + 1) % this.numVertices]; - var s11 = this.w - v11.x; - var s21 = this.w - v21.x; - if(s11 > 0 && s21 > 0) { - var _this4 = this.tmpVertices[this.numTmpVertices++]; - _this4.x = v11.x; - _this4.y = v11.y; - _this4.wx = v11.wx; - _this4.wy = v11.wy; - _this4.wz = v11.wz; - } else if(s11 > 0 && s21 <= 0) { - var _this5 = this.tmpVertices[this.numTmpVertices++]; - _this5.x = v11.x; - _this5.y = v11.y; - _this5.wx = v11.wx; - _this5.wy = v11.wy; - _this5.wz = v11.wz; - var t2 = s11 / (s11 - s21); - var _this6 = this.tmpVertices[this.numTmpVertices++]; - _this6.x = v11.x + (v21.x - v11.x) * t2; - _this6.y = v11.y + (v21.y - v11.y) * t2; - _this6.wx = v11.wx + (v21.wx - v11.wx) * t2; - _this6.wy = v11.wy + (v21.wy - v11.wy) * t2; - _this6.wz = v11.wz + (v21.wz - v11.wz) * t2; - } else if(s11 <= 0 && s21 > 0) { - var t3 = s11 / (s11 - s21); - var _this7 = this.tmpVertices[this.numTmpVertices++]; - _this7.x = v11.x + (v21.x - v11.x) * t3; - _this7.y = v11.y + (v21.y - v11.y) * t3; - _this7.wx = v11.wx + (v21.wx - v11.wx) * t3; - _this7.wy = v11.wy + (v21.wy - v11.wy) * t3; - _this7.wz = v11.wz + (v21.wz - v11.wz) * t3; - } - } - var tmp1 = this.vertices; + let _g2 = 0; + let _g3 = this.numVertices; + while(_g2 < _g3) { + let i = _g2++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.w - v1.x; + let s2 = this.w - v2.x; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp1 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp1; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g3 = 0; - var _g12 = this.numVertices; - while(_g3 < _g12) { - var i2 = _g3++; - var v12 = this.vertices[i2]; - var v22 = this.vertices[(i2 + 1) % this.numVertices]; - var s12 = this.h + v12.y; - var s22 = this.h + v22.y; - if(s12 > 0 && s22 > 0) { - var _this8 = this.tmpVertices[this.numTmpVertices++]; - _this8.x = v12.x; - _this8.y = v12.y; - _this8.wx = v12.wx; - _this8.wy = v12.wy; - _this8.wz = v12.wz; - } else if(s12 > 0 && s22 <= 0) { - var _this9 = this.tmpVertices[this.numTmpVertices++]; - _this9.x = v12.x; - _this9.y = v12.y; - _this9.wx = v12.wx; - _this9.wy = v12.wy; - _this9.wz = v12.wz; - var t4 = s12 / (s12 - s22); - var _this10 = this.tmpVertices[this.numTmpVertices++]; - _this10.x = v12.x + (v22.x - v12.x) * t4; - _this10.y = v12.y + (v22.y - v12.y) * t4; - _this10.wx = v12.wx + (v22.wx - v12.wx) * t4; - _this10.wy = v12.wy + (v22.wy - v12.wy) * t4; - _this10.wz = v12.wz + (v22.wz - v12.wz) * t4; - } else if(s12 <= 0 && s22 > 0) { - var t5 = s12 / (s12 - s22); - var _this11 = this.tmpVertices[this.numTmpVertices++]; - _this11.x = v12.x + (v22.x - v12.x) * t5; - _this11.y = v12.y + (v22.y - v12.y) * t5; - _this11.wx = v12.wx + (v22.wx - v12.wx) * t5; - _this11.wy = v12.wy + (v22.wy - v12.wy) * t5; - _this11.wz = v12.wz + (v22.wz - v12.wz) * t5; - } - } - var tmp2 = this.vertices; + let _g4 = 0; + let _g5 = this.numVertices; + while(_g4 < _g5) { + let i = _g4++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.h + v1.y; + let s2 = this.h + v2.y; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp2 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp2; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g4 = 0; - var _g13 = this.numVertices; - while(_g4 < _g13) { - var i3 = _g4++; - var v13 = this.vertices[i3]; - var v23 = this.vertices[(i3 + 1) % this.numVertices]; - var s13 = this.h - v13.y; - var s23 = this.h - v23.y; - if(s13 > 0 && s23 > 0) { - var _this12 = this.tmpVertices[this.numTmpVertices++]; - _this12.x = v13.x; - _this12.y = v13.y; - _this12.wx = v13.wx; - _this12.wy = v13.wy; - _this12.wz = v13.wz; - } else if(s13 > 0 && s23 <= 0) { - var _this13 = this.tmpVertices[this.numTmpVertices++]; - _this13.x = v13.x; - _this13.y = v13.y; - _this13.wx = v13.wx; - _this13.wy = v13.wy; - _this13.wz = v13.wz; - var t6 = s13 / (s13 - s23); - var _this14 = this.tmpVertices[this.numTmpVertices++]; - _this14.x = v13.x + (v23.x - v13.x) * t6; - _this14.y = v13.y + (v23.y - v13.y) * t6; - _this14.wx = v13.wx + (v23.wx - v13.wx) * t6; - _this14.wy = v13.wy + (v23.wy - v13.wy) * t6; - _this14.wz = v13.wz + (v23.wz - v13.wz) * t6; - } else if(s13 <= 0 && s23 > 0) { - var t7 = s13 / (s13 - s23); - var _this15 = this.tmpVertices[this.numTmpVertices++]; - _this15.x = v13.x + (v23.x - v13.x) * t7; - _this15.y = v13.y + (v23.y - v13.y) * t7; - _this15.wx = v13.wx + (v23.wx - v13.wx) * t7; - _this15.wy = v13.wy + (v23.wy - v13.wy) * t7; - _this15.wz = v13.wz + (v23.wz - v13.wz) * t7; - } - } - var tmp3 = this.vertices; + let _g6 = 0; + let _g7 = this.numVertices; + while(_g6 < _g7) { + let i = _g6++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.h - v1.y; + let s2 = this.h - v2.y; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp3 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp3; this.numVertices = this.numTmpVertices; @@ -5774,25 +5359,24 @@ oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_col if(this.numVertices < 4) { return; } - var max1 = -1e65536; - var min1 = 1e65536; - var max2 = -1e65536; - var min2 = 1e65536; - var max1V = null; - var min1V = null; - var max2V = null; - var min2V = null; - var e1x = 1; - var e1y = 1; - var e2x = -1; - var e2y = 1; - var _g = 0; - var _g1 = this.numVertices; + let max1 = -1e65536; + let min1 = 1e65536; + let max2 = -1e65536; + let min2 = 1e65536; + let max1V = null; + let min1V = null; + let max2V = null; + let min2V = null; + let e1x = 1; + let e1y = 1; + let e2x = -1; + let e2y = 1; + let _g = 0; + let _g1 = this.numVertices; while(_g < _g1) { - var i = _g++; - var v = this.vertices[i]; - var dot1 = v.x * e1x + v.y * e1y; - var dot2 = v.x * e2x + v.y * e2y; + let v = this.vertices[_g++]; + let dot1 = v.x * e1x + v.y * e1y; + let dot2 = v.x * e2x + v.y * e2y; if(dot1 > max1) { max1 = dot1; max1V = v; @@ -5810,31 +5394,31 @@ oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_col min2V = v; } } - var _this = this.tmpVertices[this.numTmpVertices++]; + let _this = this.tmpVertices[this.numTmpVertices++]; _this.x = max1V.x; _this.y = max1V.y; _this.wx = max1V.wx; _this.wy = max1V.wy; _this.wz = max1V.wz; - var _this1 = this.tmpVertices[this.numTmpVertices++]; + let _this1 = this.tmpVertices[this.numTmpVertices++]; _this1.x = max2V.x; _this1.y = max2V.y; _this1.wx = max2V.wx; _this1.wy = max2V.wy; _this1.wz = max2V.wz; - var _this2 = this.tmpVertices[this.numTmpVertices++]; + let _this2 = this.tmpVertices[this.numTmpVertices++]; _this2.x = min1V.x; _this2.y = min1V.y; _this2.wx = min1V.wx; _this2.wy = min1V.wy; _this2.wz = min1V.wz; - var _this3 = this.tmpVertices[this.numTmpVertices++]; + let _this3 = this.tmpVertices[this.numTmpVertices++]; _this3.x = min2V.x; _this3.y = min2V.y; _this3.wx = min2V.wx; _this3.wy = min2V.wy; _this3.wz = min2V.wz; - var tmp = this.vertices; + let tmp = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; @@ -5857,43 +5441,37 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio super(false); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var c1 = geom1; - var c2 = geom2; + let c1 = geom1; + let c2 = geom2; result.incremental = false; - var axis1; - var axis1X; - var axis1Y; - var axis1Z; - var axis2; - var axis2X; - var axis2Y; - var axis2Z; + let axis1X; + let axis1Y; + let axis1Z; + let axis2X; + let axis2Y; + let axis2Z; axis1X = tf1._rotation01; axis1Y = tf1._rotation11; axis1Z = tf1._rotation21; axis2X = tf2._rotation01; axis2Y = tf2._rotation11; axis2Z = tf2._rotation21; - var hh1 = c1._halfHeight; - var hh2 = c2._halfHeight; - var r1 = c1._radius; - var r2 = c2._radius; - var p1; - var p1X; - var p1Y; - var p1Z; - var q1; - var q1X; - var q1Y; - var q1Z; - var p2; - var p2X; - var p2Y; - var p2Z; - var q2; - var q2X; - var q2Y; - var q2Z; + let hh1 = c1._halfHeight; + let hh2 = c2._halfHeight; + let r1 = c1._radius; + let r2 = c2._radius; + let p1X; + let p1Y; + let p1Z; + let q1X; + let q1Y; + let q1Z; + let p2X; + let p2Y; + let p2Z; + let q2X; + let q2Y; + let q2Z; p1X = tf1._positionX + axis1X * -hh1; p1Y = tf1._positionY + axis1Y * -hh1; p1Z = tf1._positionZ + axis1Z * -hh1; @@ -5906,59 +5484,56 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12; - var p12X; - var p12Y; - var p12Z; + let p12X; + let p12Y; + let p12Z; p12X = p1X - p2X; p12Y = p1Y - p2Y; p12Z = p1Z - p2Z; - var d1; - var d1X; - var d1Y; - var d1Z; - var d2; - var d2X; - var d2Y; - var d2Z; + let d1X; + let d1Y; + let d1Z; + let d2X; + let d2Y; + let d2Z; d1X = q1X - p1X; d1Y = q1Y - p1Y; d1Z = q1Z - p1Z; d2X = q2X - p2X; d2Y = q2Y - p2Y; d2Z = q2Z - p2Z; - var p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); - var p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; - var d11 = hh1 * hh1 * 4; - var d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; - var d22 = hh2 * hh2 * 4; - var t1; - var t2; + let p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); + let p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + let d11 = hh1 * hh1 * 4; + let d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + let d22 = hh2 * hh2 * 4; + let t1; + let t2; if(d11 == 0 && d22 == 0) { t1 = 0; t2 = 0; } else if(d11 == 0) { t1 = 0; t2 = p12d2; - if(t2 < 0) { + if(p12d2 < 0) { t2 = 0; - } else if(t2 > d22) { + } else if(p12d2 > d22) { t2 = 1; } else { - t2 /= d22; + t2 = p12d2 / d22; } } else if(d22 == 0) { t2 = 0; t1 = p21d1; - if(t1 < 0) { + if(p21d1 < 0) { t1 = 0; - } else if(t1 > d11) { + } else if(p21d1 > d11) { t1 = 1; } else { - t1 /= d11; + t1 = p21d1 / d11; } } else { - var det = d11 * d22 - d12 * d12; + let det = d11 * d22 - d12 * d12; if(det == 0) { t1 = 0; } else { @@ -5975,12 +5550,12 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio if(t2 < 0) { t2 = 0; t1 = p21d1; - if(t1 < 0) { + if(p21d1 < 0) { t1 = 0; - } else if(t1 > d11) { + } else if(p21d1 > d11) { t1 = 1; } else { - t1 /= d11; + t1 = p21d1 / d11; } } else if(t2 > d22) { t2 = 1; @@ -5996,36 +5571,32 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio t2 /= d22; } } - var cp1; - var cp1X; - var cp1Y; - var cp1Z; - var cp2; - var cp2X; - var cp2Y; - var cp2Z; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; cp1X = p1X + d1X * t1; cp1Y = p1Y + d1Y * t1; cp1Z = p1Z + d1Z * t1; cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = cp1X - cp2X; dY = cp1Y - cp2Y; dZ = cp1Z - cp2Z; - var len2 = dX * dX + dY * dY + dZ * dZ; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var n; - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6036,14 +5607,12 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; - var pos1X; - var pos1Y; - var pos1Z; - var pos2; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = cp1X + nX * -r1; pos1Y = cp1Y + nY * -r1; pos1Z = cp1Z + nZ * -r1; @@ -6058,40 +5627,35 @@ oimo.collision.narrowphase.detector.GjkEpaDetector = class oimo_collision_narrow super(false); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; - var g1 = geom1; - var g2 = geom2; - var status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo.common.Setting.enableGJKCaching ? cachedData : null,true); + let gjkEpa = oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; + let g1 = geom1; + let g2 = geom2; + let status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo.common.Setting.enableGJKCaching ? cachedData : null,true); result.incremental = true; if(status != oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.SUCCEEDED) { console.log("src/oimo/collision/narrowphase/detector/GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); return; } - var margin1 = g1._gjkMargin; - var margin2 = g2._gjkMargin; - if(gjkEpa.distance > margin1 + margin2) { + if(gjkEpa.distance > g1._gjkMargin + g2._gjkMargin) { return; } - var pos1; - var pos1X; - var pos1Y; - var pos1Z; - var pos2; - var pos2X; - var pos2Y; - var pos2Z; - var v = gjkEpa.closestPoint1; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; + let v = gjkEpa.closestPoint1; pos1X = v.x; pos1Y = v.y; pos1Z = v.z; - var v1 = gjkEpa.closestPoint2; + let v1 = gjkEpa.closestPoint2; pos2X = v1.x; pos2Y = v1.y; pos2Z = v1.z; - var normal; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = pos1X - pos2X; normalY = pos1Y - pos2Y; normalZ = pos1Z - pos2Z; @@ -6103,7 +5667,7 @@ oimo.collision.narrowphase.detector.GjkEpaDetector = class oimo_collision_narrow normalY = -normalY; normalZ = -normalZ; } - var l = normalX * normalX + normalY * normalY + normalZ * normalZ; + let l = normalX * normalX + normalY * normalY + normalZ * normalZ; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -6125,68 +5689,59 @@ oimo.collision.narrowphase.detector.SphereBoxDetector = class oimo_collision_nar super(swapped); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var s = geom1; - var b = geom2; + let b = geom2; result.incremental = false; - var halfExt; - var halfExtX; - var halfExtY; - var halfExtZ; - var negHalfExt; - var negHalfExtX; - var negHalfExtY; - var negHalfExtZ; + let halfExtX; + let halfExtY; + let halfExtZ; + let negHalfExtX; + let negHalfExtY; + let negHalfExtZ; halfExtX = b._halfExtentsX; halfExtY = b._halfExtentsY; halfExtZ = b._halfExtentsZ; negHalfExtX = -halfExtX; negHalfExtY = -halfExtY; negHalfExtZ = -halfExtZ; - var r = s._radius; - var boxToSphere; - var boxToSphereX; - var boxToSphereY; - var boxToSphereZ; + let r = geom1._radius; + let boxToSphereX; + let boxToSphereY; + let boxToSphereZ; boxToSphereX = tf1._positionX - tf2._positionX; boxToSphereY = tf1._positionY - tf2._positionY; boxToSphereZ = tf1._positionZ - tf2._positionZ; - var boxToSphereInBox; - var boxToSphereInBoxX; - var boxToSphereInBoxY; - var boxToSphereInBoxZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let boxToSphereInBoxX; + let boxToSphereInBoxY; + let boxToSphereInBoxZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf2._rotation00 * boxToSphereX + tf2._rotation10 * boxToSphereY + tf2._rotation20 * boxToSphereZ; __tmp__Y = tf2._rotation01 * boxToSphereX + tf2._rotation11 * boxToSphereY + tf2._rotation21 * boxToSphereZ; __tmp__Z = tf2._rotation02 * boxToSphereX + tf2._rotation12 * boxToSphereY + tf2._rotation22 * boxToSphereZ; boxToSphereInBoxX = __tmp__X; boxToSphereInBoxY = __tmp__Y; boxToSphereInBoxZ = __tmp__Z; - var insideBox = negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ; - if(insideBox) { - var sphereToBoxSurface; - var sphereToBoxSurfaceX; - var sphereToBoxSurfaceY; - var sphereToBoxSurfaceZ; + if(negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ) { + let sphereToBoxSurfaceX; + let sphereToBoxSurfaceY; + let sphereToBoxSurfaceZ; sphereToBoxSurfaceX = boxToSphereInBoxX < 0 ? -boxToSphereInBoxX : boxToSphereInBoxX; sphereToBoxSurfaceY = boxToSphereInBoxY < 0 ? -boxToSphereInBoxY : boxToSphereInBoxY; sphereToBoxSurfaceZ = boxToSphereInBoxZ < 0 ? -boxToSphereInBoxZ : boxToSphereInBoxZ; sphereToBoxSurfaceX = halfExtX - sphereToBoxSurfaceX; sphereToBoxSurfaceY = halfExtY - sphereToBoxSurfaceY; sphereToBoxSurfaceZ = halfExtZ - sphereToBoxSurfaceZ; - var normalInBox; - var normalInBoxX; - var normalInBoxY; - var normalInBoxZ; - var distX = sphereToBoxSurfaceX; - var distY = sphereToBoxSurfaceY; - var distZ = sphereToBoxSurfaceZ; - var depth; - var projectionMask; - var projectionMaskX; - var projectionMaskY; - var projectionMaskZ; + let normalInBoxX; + let normalInBoxY; + let normalInBoxZ; + let distX = sphereToBoxSurfaceX; + let distY = sphereToBoxSurfaceY; + let distZ = sphereToBoxSurfaceZ; + let depth; + let projectionMaskX; + let projectionMaskY; + let projectionMaskZ; if(distX < distY) { if(distX < distZ) { if(boxToSphereInBoxX > 0) { @@ -6246,58 +5801,52 @@ oimo.collision.narrowphase.detector.SphereBoxDetector = class oimo_collision_nar projectionMaskZ = 0; depth = distZ; } - var base; - var baseX; - var baseY; - var baseZ; + let baseX; + let baseY; + let baseZ; baseX = projectionMaskX * boxToSphereInBoxX; baseY = projectionMaskY * boxToSphereInBoxY; baseZ = projectionMaskZ * boxToSphereInBoxZ; - var boxToClosestPointInBox; - var boxToClosestPointInBoxX; - var boxToClosestPointInBoxY; - var boxToClosestPointInBoxZ; + let boxToClosestPointInBoxX; + let boxToClosestPointInBoxY; + let boxToClosestPointInBoxZ; boxToClosestPointInBoxX = normalInBoxX * halfExtX; boxToClosestPointInBoxY = normalInBoxY * halfExtY; boxToClosestPointInBoxZ = normalInBoxZ * halfExtZ; boxToClosestPointInBoxX += baseX; boxToClosestPointInBoxY += baseY; boxToClosestPointInBoxZ += baseZ; - var boxToClosestPoint; - var boxToClosestPointX; - var boxToClosestPointY; - var boxToClosestPointZ; - var normal; - var normalX; - var normalY; - var normalZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; - __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; - __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; - boxToClosestPointX = __tmp__X1; - boxToClosestPointY = __tmp__Y1; - boxToClosestPointZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; - __tmp__Y2 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; - __tmp__Z2 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; - normalX = __tmp__X2; - normalY = __tmp__Y2; - normalZ = __tmp__Z2; + let boxToClosestPointX; + let boxToClosestPointY; + let boxToClosestPointZ; + let normalX; + let normalY; + let normalZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X; + boxToClosestPointY = __tmp__Y; + boxToClosestPointZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; + __tmp__Y1 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; + __tmp__Z1 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; + normalX = __tmp__X1; + normalY = __tmp__Y1; + normalZ = __tmp__Z1; this.setNormal(result,normalX,normalY,normalZ); - var pos1; - var pos1X; - var pos1Y; - var pos1Z; - var pos2; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = tf1._positionX + normalX * -r; pos1Y = tf1._positionY + normalY * -r; pos1Z = tf1._positionZ + normalZ * -r; @@ -6307,95 +5856,86 @@ oimo.collision.narrowphase.detector.SphereBoxDetector = class oimo_collision_nar this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); return; } - var boxToClosestPointInBox1; - var boxToClosestPointInBoxX1; - var boxToClosestPointInBoxY1; - var boxToClosestPointInBoxZ1; - var eps = 1e-9; - var epsVec; - var epsVecX; - var epsVecY; - var epsVecZ; - epsVecX = eps; - epsVecY = eps; - epsVecZ = eps; - halfExtX -= epsVecX; - halfExtY -= epsVecY; - halfExtZ -= epsVecZ; - negHalfExtX += epsVecX; - negHalfExtY += epsVecY; - negHalfExtZ += epsVecZ; - boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; - boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; - boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; - boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; - boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; - boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; - var closestPointToSphereInBox; - var closestPointToSphereInBoxX; - var closestPointToSphereInBoxY; - var closestPointToSphereInBoxZ; - closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX1; - closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY1; - closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ1; - var dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; + let boxToClosestPointInBoxX; + let boxToClosestPointInBoxY; + let boxToClosestPointInBoxZ; + halfExtX -= 1e-9; + halfExtY -= 1e-9; + halfExtZ -= 1e-9; + negHalfExtX += 1e-9; + negHalfExtY += 1e-9; + negHalfExtZ += 1e-9; + boxToClosestPointInBoxX = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; + boxToClosestPointInBoxY = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; + boxToClosestPointInBoxZ = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; + if(!(boxToClosestPointInBoxX > negHalfExtX)) { + boxToClosestPointInBoxX = negHalfExtX; + } + if(!(boxToClosestPointInBoxY > negHalfExtY)) { + boxToClosestPointInBoxY = negHalfExtY; + } + if(!(boxToClosestPointInBoxZ > negHalfExtZ)) { + boxToClosestPointInBoxZ = negHalfExtZ; + } + let closestPointToSphereInBoxX; + let closestPointToSphereInBoxY; + let closestPointToSphereInBoxZ; + closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX; + closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY; + closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ; + let dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; if(dist >= r * r) { return; } dist = Math.sqrt(dist); - var boxToClosestPoint1; - var boxToClosestPointX1; - var boxToClosestPointY1; - var boxToClosestPointZ1; - var closestPointToSphere; - var closestPointToSphereX; - var closestPointToSphereY; - var closestPointToSphereZ; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * boxToClosestPointInBoxX1 + tf2._rotation01 * boxToClosestPointInBoxY1 + tf2._rotation02 * boxToClosestPointInBoxZ1; - __tmp__Y3 = tf2._rotation10 * boxToClosestPointInBoxX1 + tf2._rotation11 * boxToClosestPointInBoxY1 + tf2._rotation12 * boxToClosestPointInBoxZ1; - __tmp__Z3 = tf2._rotation20 * boxToClosestPointInBoxX1 + tf2._rotation21 * boxToClosestPointInBoxY1 + tf2._rotation22 * boxToClosestPointInBoxZ1; - boxToClosestPointX1 = __tmp__X3; - boxToClosestPointY1 = __tmp__Y3; - boxToClosestPointZ1 = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; - __tmp__Y4 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; - __tmp__Z4 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; - closestPointToSphereX = __tmp__X4; - closestPointToSphereY = __tmp__Y4; - closestPointToSphereZ = __tmp__Z4; - var normal1; - var normalX1; - var normalY1; - var normalZ1; - var l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; + let boxToClosestPointX; + let boxToClosestPointY; + let boxToClosestPointZ; + let closestPointToSphereX; + let closestPointToSphereY; + let closestPointToSphereZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X1; + boxToClosestPointY = __tmp__Y1; + boxToClosestPointZ = __tmp__Z1; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; + __tmp__X2 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; + __tmp__Y2 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; + __tmp__Z2 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; + closestPointToSphereX = __tmp__X2; + closestPointToSphereY = __tmp__Y2; + closestPointToSphereZ = __tmp__Z2; + let normalX; + let normalY; + let normalZ; + let l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; if(l > 0) { l = 1 / Math.sqrt(l); } - normalX1 = closestPointToSphereX * l; - normalY1 = closestPointToSphereY * l; - normalZ1 = closestPointToSphereZ * l; - this.setNormal(result,normalX1,normalY1,normalZ1); - var pos11; - var pos1X1; - var pos1Y1; - var pos1Z1; - var pos21; - var pos2X1; - var pos2Y1; - var pos2Z1; - pos1X1 = tf1._positionX + normalX1 * -r; - pos1Y1 = tf1._positionY + normalY1 * -r; - pos1Z1 = tf1._positionZ + normalZ1 * -r; - pos2X1 = tf2._positionX + boxToClosestPointX1; - pos2Y1 = tf2._positionY + boxToClosestPointY1; - pos2Z1 = tf2._positionZ + boxToClosestPointZ1; - this.addPoint(result,pos1X1,pos1Y1,pos1Z1,pos2X1,pos2Y1,pos2Z1,r - dist,0); + normalX = closestPointToSphereX * l; + normalY = closestPointToSphereY * l; + normalZ = closestPointToSphereZ * l; + this.setNormal(result,normalX,normalY,normalZ); + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; + pos1X = tf1._positionX + normalX * -r; + pos1Y = tf1._positionY + normalY * -r; + pos1Z = tf1._positionZ + normalZ * -r; + pos2X = tf2._positionX + boxToClosestPointX; + pos2Y = tf2._positionY + boxToClosestPointY; + pos2Z = tf2._positionZ + boxToClosestPointZ; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r - dist,0); } } oimo.collision.narrowphase.detector.SphereCapsuleDetector = class oimo_collision_narrowphase_detector_SphereCapsuleDetector extends oimo.collision.narrowphase.detector.Detector { @@ -6403,56 +5943,49 @@ oimo.collision.narrowphase.detector.SphereCapsuleDetector = class oimo_collision super(swapped); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var s1 = geom1; - var c2 = geom2; + let c2 = geom2; result.incremental = false; - var hh2 = c2._halfHeight; - var r1 = s1._radius; - var r2 = c2._radius; - var axis2; - var axis2X; - var axis2Y; - var axis2Z; + let hh2 = c2._halfHeight; + let r1 = geom1._radius; + let r2 = c2._radius; + let axis2X; + let axis2Y; + let axis2Z; axis2X = tf2._rotation01; axis2Y = tf2._rotation11; axis2Z = tf2._rotation21; - var cp1; - var cp1X; - var cp1Y; - var cp1Z; + let cp1X; + let cp1Y; + let cp1Z; cp1X = tf1._positionX; cp1Y = tf1._positionY; cp1Z = tf1._positionZ; - var p2; - var p2X; - var p2Y; - var p2Z; - var q2; - var q2X; - var q2Y; - var q2Z; + let p2X; + let p2Y; + let p2Z; + let q2X; + let q2Y; + let q2Z; p2X = tf2._positionX + axis2X * -hh2; p2Y = tf2._positionY + axis2Y * -hh2; p2Z = tf2._positionZ + axis2Z * -hh2; q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12; - var p12X; - var p12Y; - var p12Z; + let p12X; + let p12Y; + let p12Z; p12X = cp1X - p2X; p12Y = cp1Y - p2Y; p12Z = cp1Z - p2Z; - var d2; - var d2X; - var d2Y; - var d2Z; + let d2X; + let d2Y; + let d2Z; d2X = q2X - p2X; d2Y = q2Y - p2Y; d2Z = q2Z - p2Z; - var d22 = hh2 * hh2 * 4; - var t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + let d22 = hh2 * hh2 * 4; + let t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; if(t < 0) { t = 0; } else if(t > d22) { @@ -6460,29 +5993,26 @@ oimo.collision.narrowphase.detector.SphereCapsuleDetector = class oimo_collision } else { t /= d22; } - var cp2; - var cp2X; - var cp2Y; - var cp2Z; + let cp2X; + let cp2Y; + let cp2Z; cp2X = p2X + d2X * t; cp2Y = p2Y + d2Y * t; cp2Z = p2Z + d2Z * t; - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = cp1X - cp2X; dY = cp1Y - cp2Y; dZ = cp1Z - cp2Z; - var len2 = dX * dX + dY * dY + dZ * dZ; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var n; - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6493,14 +6023,12 @@ oimo.collision.narrowphase.detector.SphereCapsuleDetector = class oimo_collision nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; - var pos1X; - var pos1Y; - var pos1Z; - var pos2; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = cp1X + nX * -r1; pos1Y = cp1Y + nY * -r1; pos1Z = cp1Z + nZ * -r1; @@ -6515,27 +6043,23 @@ oimo.collision.narrowphase.detector.SphereSphereDetector = class oimo_collision_ super(false); } detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { - var s1 = geom1; - var s2 = geom2; result.incremental = false; - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = tf1._positionX - tf2._positionX; dY = tf1._positionY - tf2._positionY; dZ = tf1._positionZ - tf2._positionZ; - var r1 = s1._radius; - var r2 = s2._radius; - var len2 = dX * dX + dY * dY + dZ * dZ; + let r1 = geom1._radius; + let r2 = geom2._radius; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var n; - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6546,14 +6070,12 @@ oimo.collision.narrowphase.detector.SphereSphereDetector = class oimo_collision_ nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1; - var pos1X; - var pos1Y; - var pos1Z; - var pos2; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = tf1._positionX + nX * -r1; pos1Y = tf1._positionY + nY * -r1; pos1Z = tf1._positionZ + nZ * -r1; @@ -6566,8 +6088,7 @@ oimo.collision.narrowphase.detector.SphereSphereDetector = class oimo_collision_ if(!oimo.collision.narrowphase.detector.gjkepa) oimo.collision.narrowphase.detector.gjkepa = {}; oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron { constructor() { - var this1 = new Array(oimo.common.Setting.maxEPAVertices); - this._vertices = this1; + this._vertices = new Array(oimo.common.Setting.maxEPAVertices); this._center = new oimo.common.Vec3(); this._numVertices = 0; this._triangleList = null; @@ -6579,9 +6100,8 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ dumpHoleEdge(first) { } validate() { - var t = this._triangleList; + let t = this._triangleList; while(t != null) { - var n = t._next; t._vertices[0]._tmpEdgeLoopOuterTriangle = null; t._vertices[0]._tmpEdgeLoopNext = null; if(t._adjacentPairIndex[0] == -1) { @@ -6612,7 +6132,7 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ this._status = 3; return false; } - t = n; + t = t._next; } return true; } @@ -6621,84 +6141,74 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ return; } base._tmpDfsId = id; - var _this = base.tmp; + let _this = base.tmp; _this.x = from.x; _this.y = from.y; _this.z = from.z; - var _this1 = _this; - var v = base._vertices[0].v; - var tx = _this1.x - v.x; - var ty = _this1.y - v.y; - var tz = _this1.z - v.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; - var _this2 = base.tmp; - var v1 = base._normal; - base._tmpDfsVisible = _this2.x * v1.x + _this2.y * v1.y + _this2.z * v1.z > 0; + let v = base._vertices[0].v; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + let _this1 = base.tmp; + let v1 = base._normal; + base._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(!base._tmpDfsVisible) { this._status = 6; return; } - var _g = 0; + let _g = 0; while(_g < 3) { - var i = _g++; - var t = base._adjacentTriangles[i]; + let i = _g++; + let t = base._adjacentTriangles[i]; if(t == null) { continue; } - var _this3 = t.tmp; - _this3.x = from.x; - _this3.y = from.y; - _this3.z = from.z; - var _this4 = _this3; - var v2 = t._vertices[0].v; - var tx1 = _this4.x - v2.x; - var ty1 = _this4.y - v2.y; - var tz1 = _this4.z - v2.z; - _this4.x = tx1; - _this4.y = ty1; - _this4.z = tz1; - var _this5 = t.tmp; - var v3 = t._normal; - t._tmpDfsVisible = _this5.x * v3.x + _this5.y * v3.y + _this5.z * v3.z > 0; + let _this = t.tmp; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + let v = t._vertices[0].v; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + let _this1 = t.tmp; + let v1 = t._normal; + t._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(t._tmpDfsVisible) { this.findEdgeLoop(id,t,from); } else { - var i2 = base._nextIndex[i]; - var v11 = base._vertices[i]; - var v21 = base._vertices[i2]; - v11._tmpEdgeLoopNext = v21; - v11._tmpEdgeLoopOuterTriangle = t; + let v1 = base._vertices[i]; + v1._tmpEdgeLoopNext = base._vertices[base._nextIndex[i]]; + v1._tmpEdgeLoopOuterTriangle = t; } } - var triangle = base._adjacentTriangles[0]; + let triangle = base._adjacentTriangles[0]; if(triangle != null) { - var pairIndex = base._adjacentPairIndex[0]; + let pairIndex = base._adjacentPairIndex[0]; triangle._adjacentTriangles[pairIndex] = null; triangle._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[0] = null; base._adjacentPairIndex[0] = -1; } - var triangle1 = base._adjacentTriangles[1]; + let triangle1 = base._adjacentTriangles[1]; if(triangle1 != null) { - var pairIndex1 = base._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + let pairIndex = base._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex] = null; + triangle1._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[1] = null; base._adjacentPairIndex[1] = -1; } - var triangle2 = base._adjacentTriangles[2]; + let triangle2 = base._adjacentTriangles[2]; if(triangle2 != null) { - var pairIndex2 = base._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + let pairIndex = base._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex] = null; + triangle2._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[2] = null; base._adjacentPairIndex[2] = -1; } this._numTriangles--; - var prev = base._prev; - var next = base._next; + let prev = base._prev; + let next = base._next; if(prev != null) { prev._next = next; } @@ -6724,100 +6234,68 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ this._vertices[1] = v2; this._vertices[2] = v3; this._vertices[3] = v4; - var _this = this._center; - var v = v1.v; + let _this = this._center; + let v = v1.v; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = _this; - var v5 = v2.v; - var tx = _this1.x + v5.x; - var ty = _this1.y + v5.y; - var tz = _this1.z + v5.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; - var _this2 = _this1; - var v6 = v3.v; - var tx1 = _this2.x + v6.x; - var ty1 = _this2.y + v6.y; - var tz1 = _this2.z + v6.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; - var _this3 = _this2; - var v7 = v4.v; - var tx2 = _this3.x + v7.x; - var ty2 = _this3.y + v7.y; - var tz2 = _this3.z + v7.z; - _this3.x = tx2; - _this3.y = ty2; - _this3.z = tz2; - var _this4 = _this3; - var tx3 = _this4.x * 0.25; - var ty3 = _this4.y * 0.25; - var tz3 = _this4.z * 0.25; - _this4.x = tx3; - _this4.y = ty3; - _this4.z = tz3; - var first = this._trianglePool; + let v5 = v2.v; + _this.x += v5.x; + _this.y += v5.y; + _this.z += v5.z; + let v6 = v3.v; + _this.x += v6.x; + _this.y += v6.y; + _this.z += v6.z; + let v7 = v4.v; + _this.x += v7.x; + _this.y += v7.y; + _this.z += v7.z; + _this.x *= 0.25; + _this.y *= 0.25; + _this.z *= 0.25; + let first = this._trianglePool; if(first != null) { this._trianglePool = first._next; first._next = null; } else { first = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); } - var t1 = first; - var first1 = this._trianglePool; + let t1 = first; + let first1 = this._trianglePool; if(first1 != null) { this._trianglePool = first1._next; first1._next = null; } else { first1 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); } - var t2 = first1; - var first2 = this._trianglePool; + let t2 = first1; + let first2 = this._trianglePool; if(first2 != null) { this._trianglePool = first2._next; first2._next = null; } else { first2 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); } - var t3 = first2; - var first3 = this._trianglePool; + let t3 = first2; + let first3 = this._trianglePool; if(first3 != null) { this._trianglePool = first3._next; first3._next = null; } else { first3 = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); } - var t4 = first3; - var autoCheck = true; - if(autoCheck == null) { - autoCheck = false; - } - if(!t1.init(v1,v2,v3,this._center,autoCheck)) { + let t4 = first3; + if(!t1.init(v1,v2,v3,this._center,true)) { this._status = 1; } - var autoCheck1 = true; - if(autoCheck1 == null) { - autoCheck1 = false; - } - if(!t2.init(v1,v2,v4,this._center,autoCheck1)) { + if(!t2.init(v1,v2,v4,this._center,true)) { this._status = 1; } - var autoCheck2 = true; - if(autoCheck2 == null) { - autoCheck2 = false; - } - if(!t3.init(v1,v3,v4,this._center,autoCheck2)) { + if(!t3.init(v1,v3,v4,this._center,true)) { this._status = 1; } - var autoCheck3 = true; - if(autoCheck3 == null) { - autoCheck3 = false; - } - if(!t4.init(v2,v3,v4,this._center,autoCheck3)) { + if(!t4.init(v2,v3,v4,this._center,true)) { this._status = 1; } if(!t1.setAdjacentTriangle(t2)) { @@ -6878,15 +6356,14 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ } _addVertex(vertex,base) { this._vertices[this._numVertices++] = vertex; - var v1 = base._vertices[0]; + let v1 = base._vertices[0]; this.findEdgeLoop(this._numVertices,base,vertex.v); if(this._status != 0) { return false; } - var v = v1; - var firstV = v1; - var prevT = null; - var firstT = null; + let v = v1; + let prevT = null; + let firstT = null; while(true) { if(v._tmpEdgeLoopNext == null) { this._dumpAsObjModel(); @@ -6897,14 +6374,14 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ this._status = 5; return false; } - var first = this._trianglePool; + let first = this._trianglePool; if(first != null) { this._trianglePool = first._next; first._next = null; } else { first = new oimo.collision.narrowphase.detector.gjkepa.EpaTriangle(); } - var t = first; + let t = first; if(firstT == null) { firstT = t; } @@ -6933,7 +6410,7 @@ oimo.collision.narrowphase.detector.gjkepa.EpaPolyhedron = class oimo_collision_ } prevT = t; v = v._tmpEdgeLoopNext; - if(!(v != firstV)) { + if(!(v != v1)) { break; } } @@ -6960,15 +6437,11 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na this._distanceSq = 0; this._tmpDfsId = 0; this._tmpDfsVisible = false; - var this1 = new Array(3); - this._vertices = this1; - var this2 = new Array(3); - this._adjacentTriangles = this2; - var this3 = new Array(3); - this._adjacentPairIndex = this3; + this._vertices = new Array(3); + this._adjacentTriangles = new Array(3); + this._adjacentPairIndex = new Array(3); this.tmp = new oimo.common.Vec3(); - var this4 = new Array(3); - this._nextIndex = this4; + this._nextIndex = new Array(3); this._nextIndex[0] = 1; this._nextIndex[1] = 2; this._nextIndex[2] = 0; @@ -6977,50 +6450,42 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na if(autoCheck == null) { autoCheck = false; } - var v1; - var v1X; - var v1Y; - var v1Z; - var v2; - var v2X; - var v2Y; - var v2Z; - var v3; - var v3X; - var v3Y; - var v3Z; - var vc; - var vcX; - var vcY; - var vcZ; - var v = vertex1.v; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let vcX; + let vcY; + let vcZ; + let v = vertex1.v; v1X = v.x; v1Y = v.y; v1Z = v.z; - var v4 = vertex2.v; - v2X = v4.x; - v2Y = v4.y; - v2Z = v4.z; - var v5 = vertex3.v; - v3X = v5.x; - v3Y = v5.y; - v3Z = v5.z; - var v6 = center; - vcX = v6.x; - vcY = v6.y; - vcZ = v6.z; - var v12; - var v12X; - var v12Y; - var v12Z; - var v13; - var v13X; - var v13Y; - var v13Z; - var vc1; - var vc1X; - var vc1Y; - var vc1Z; + let v1 = vertex2.v; + v2X = v1.x; + v2Y = v1.y; + v2Z = v1.z; + let v2 = vertex3.v; + v3X = v2.x; + v3Y = v2.y; + v3Z = v2.z; + vcX = center.x; + vcY = center.y; + vcZ = center.z; + let v12X; + let v12Y; + let v12Z; + let v13X; + let v13Y; + let v13Z; + let vc1X; + let vc1Y; + let vc1Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -7030,18 +6495,16 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na vc1X = v1X - vcX; vc1Y = v1Y - vcY; vc1Z = v1Z - vcZ; - var inor; - var inorX; - var inorY; - var inorZ; + let inorX; + let inorY; + let inorZ; inorX = v12Y * v13Z - v12Z * v13Y; inorY = v12Z * v13X - v12X * v13Z; inorZ = v12X * v13Y - v12Y * v13X; - var inverted = false; - var d = vc1X * inorX + vc1Y * inorY + vc1Z * inorZ; - if(d < 0) { + let inverted = false; + if(vc1X * inorX + vc1Y * inorY + vc1Z * inorZ < 0) { if(autoCheck) { - var tmp = vertex2; + let tmp = vertex2; vertex2 = vertex3; vertex3 = tmp; inorX *= -1; @@ -7054,50 +6517,41 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na this._vertices[0] = vertex1; this._vertices[1] = vertex2; this._vertices[2] = vertex3; - var v7 = this._normal; - v7.x = inorX; - v7.y = inorY; - v7.z = inorZ; - var vec1 = vertex1.v; - var vec2 = vertex2.v; - var vec3 = vertex3.v; - var out = this.tmp; - var v11; - var v1X1; - var v1Y1; - var v1Z1; - var v21; - var v2X1; - var v2Y1; - var v2Z1; - var v31; - var v3X1; - var v3Y1; - var v3Z1; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - var v23; - var v23X; - var v23Y; - var v23Z; - var v311; - var v31X; - var v31Y; - var v31Z; - var v8 = vec1; - v1X1 = v8.x; - v1Y1 = v8.y; - v1Z1 = v8.z; - var v9 = vec2; - v2X1 = v9.x; - v2Y1 = v9.y; - v2Z1 = v9.z; - var v10 = vec3; - v3X1 = v10.x; - v3Y1 = v10.y; - v3Z1 = v10.z; + let v3 = this._normal; + v3.x = inorX; + v3.y = inorY; + v3.z = inorZ; + let vec1 = vertex1.v; + let vec2 = vertex2.v; + let vec3 = vertex3.v; + let out = this.tmp; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X1; + let v3Y1; + let v3Z1; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X1 = vec3.x; + v3Y1 = vec3.y; + v3Z1 = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -7107,25 +6561,21 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na v31X = v1X1 - v3X1; v31Y = v1Y1 - v3Y1; v31Z = v1Z1 - v3Z1; - var n; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; - var n12X; - var n12Y; - var n12Z; - var n23; - var n23X; - var n23Y; - var n23Z; - var n31; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -7135,233 +6585,176 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; - var mind = -1; - var minv; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v14; - var v1X2; - var v1Y2; - var v1Z2; - var v22; - var v2X2; - var v2Y2; - var v2Z2; - var v15 = vec1; - v1X2 = v15.x; - v1Y2 = v15.y; - v1Z2 = v15.z; - var v16 = vec2; - v2X2 = v16.x; - v2Y2 = v16.y; - v2Z2 = v16.z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / d1; - var b; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v17 = out; - v17.x = v1X2; - v17.y = v1Y2; - v17.z = v1Z2; - b = 1; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; } else if(t > 1) { - var v18 = out; - v18.x = v2X2; - v18.y = v2Y2; - v18.z = v2Z2; - b = 2; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var p; - var pX; - var pY; - var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; - var v19 = out; - v19.x = pX; - v19.y = pY; - v19.z = pZ; - b = 3; - } - var d2 = out.x * out.x + out.y * out.y + out.z * out.z; - mini = b; - mind = d2; - var v20 = out; - minvX = v20.x; - minvY = v20.y; - minvZ = v20.z; - } - if(d23 < 0) { - var v110; - var v1X3; - var v1Y3; - var v1Z3; - var v24; - var v2X3; - var v2Y3; - var v2Z3; - var v25 = vec2; - v1X3 = v25.x; - v1Y3 = v25.y; - v1Z3 = v25.z; - var v26 = vec3; - v2X3 = v26.x; - v2Y3 = v26.y; - v2Z3 = v26.z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / d3; - var b1; - if(t1 < 0) { - var v27 = out; - v27.x = v1X3; - v27.y = v1Y3; - v27.z = v1Z3; - b1 = 1; - } else if(t1 > 1) { - var v28 = out; - v28.x = v2X3; - v28.y = v2Y3; - v28.z = v2Z3; - b1 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var p1; - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - var v29 = out; - v29.x = pX1; - v29.y = pY1; - v29.z = pZ1; - b1 = 3; - } - var d4 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d4 < mind) { - mini = b1 << 1; - mind = d4; - var v30 = out; - minvX = v30.x; - minvY = v30.y; - minvZ = v30.z; - } - } - if(d31 < 0) { - var v111; - var v1X4; - var v1Y4; - var v1Z4; - var v210; - var v2X4; - var v2Y4; - var v2Z4; - var v32 = vec1; - v1X4 = v32.x; - v1Y4 = v32.y; - v1Z4 = v32.z; - var v33 = vec3; - v2X4 = v33.x; - v2Y4 = v33.y; - v2Z4 = v33.z; - var v124; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / d5; - var b2; - if(t2 < 0) { - var v34 = out; - v34.x = v1X4; - v34.y = v1Y4; - v34.z = v1Z4; - b2 = 1; - } else if(t2 > 1) { - var v35 = out; - v35.x = v2X4; - v35.y = v2Y4; - v35.z = v2Z4; - b2 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var p2; - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - var v36 = out; - v36.x = pX2; - v36.y = pY2; - v36.z = pZ2; - b2 = 3; - } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d6 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v37 = out; - minvX = v37.x; - minvY = v37.y; - minvZ = v37.z; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v38 = out; - v38.x = minvX; - v38.y = minvY; - v38.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v39 = out; - v39.x = minvX; - v39.y = minvY; - v39.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; } - var _this = this.tmp; + let _this = this.tmp; this._distanceSq = _this.x * _this.x + _this.y * _this.y + _this.z * _this.z; this._adjacentTriangles[0] = null; this._adjacentTriangles[1] = null; @@ -7372,82 +6765,64 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na return !inverted; } setAdjacentTriangle(triangle) { - var count = 0; - var i2 = this._nextIndex[0]; - var j2 = this._nextIndex[0]; - if(this._vertices[0] == triangle._vertices[j2] && this._vertices[i2] == triangle._vertices[0]) { + let count = 0; + if(this._vertices[0] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[0]] == triangle._vertices[0]) { this._adjacentTriangles[0] = triangle; this._adjacentPairIndex[0] = 0; triangle._adjacentTriangles[0] = this; triangle._adjacentPairIndex[0] = 0; - ++count; + count = 1; } - var i21 = this._nextIndex[0]; - var j21 = this._nextIndex[1]; - if(this._vertices[0] == triangle._vertices[j21] && this._vertices[i21] == triangle._vertices[1]) { + if(this._vertices[0] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[0]] == triangle._vertices[1]) { this._adjacentTriangles[0] = triangle; this._adjacentPairIndex[0] = 1; triangle._adjacentTriangles[1] = this; triangle._adjacentPairIndex[1] = 0; ++count; } - var i22 = this._nextIndex[0]; - var j22 = this._nextIndex[2]; - if(this._vertices[0] == triangle._vertices[j22] && this._vertices[i22] == triangle._vertices[2]) { + if(this._vertices[0] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[0]] == triangle._vertices[2]) { this._adjacentTriangles[0] = triangle; this._adjacentPairIndex[0] = 2; triangle._adjacentTriangles[2] = this; triangle._adjacentPairIndex[2] = 0; ++count; } - var i23 = this._nextIndex[1]; - var j23 = this._nextIndex[0]; - if(this._vertices[1] == triangle._vertices[j23] && this._vertices[i23] == triangle._vertices[0]) { + if(this._vertices[1] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[1]] == triangle._vertices[0]) { this._adjacentTriangles[1] = triangle; this._adjacentPairIndex[1] = 0; triangle._adjacentTriangles[0] = this; triangle._adjacentPairIndex[0] = 1; ++count; } - var i24 = this._nextIndex[1]; - var j24 = this._nextIndex[1]; - if(this._vertices[1] == triangle._vertices[j24] && this._vertices[i24] == triangle._vertices[1]) { + if(this._vertices[1] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[1]] == triangle._vertices[1]) { this._adjacentTriangles[1] = triangle; this._adjacentPairIndex[1] = 1; triangle._adjacentTriangles[1] = this; triangle._adjacentPairIndex[1] = 1; ++count; } - var i25 = this._nextIndex[1]; - var j25 = this._nextIndex[2]; - if(this._vertices[1] == triangle._vertices[j25] && this._vertices[i25] == triangle._vertices[2]) { + if(this._vertices[1] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[1]] == triangle._vertices[2]) { this._adjacentTriangles[1] = triangle; this._adjacentPairIndex[1] = 2; triangle._adjacentTriangles[2] = this; triangle._adjacentPairIndex[2] = 1; ++count; } - var i26 = this._nextIndex[2]; - var j26 = this._nextIndex[0]; - if(this._vertices[2] == triangle._vertices[j26] && this._vertices[i26] == triangle._vertices[0]) { + if(this._vertices[2] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[2]] == triangle._vertices[0]) { this._adjacentTriangles[2] = triangle; this._adjacentPairIndex[2] = 0; triangle._adjacentTriangles[0] = this; triangle._adjacentPairIndex[0] = 2; ++count; } - var i27 = this._nextIndex[2]; - var j27 = this._nextIndex[1]; - if(this._vertices[2] == triangle._vertices[j27] && this._vertices[i27] == triangle._vertices[1]) { + if(this._vertices[2] == triangle._vertices[this._nextIndex[1]] && this._vertices[this._nextIndex[2]] == triangle._vertices[1]) { this._adjacentTriangles[2] = triangle; this._adjacentPairIndex[2] = 1; triangle._adjacentTriangles[1] = this; triangle._adjacentPairIndex[1] = 2; ++count; } - var i28 = this._nextIndex[2]; - var j28 = this._nextIndex[2]; - if(this._vertices[2] == triangle._vertices[j28] && this._vertices[i28] == triangle._vertices[2]) { + if(this._vertices[2] == triangle._vertices[this._nextIndex[2]] && this._vertices[this._nextIndex[2]] == triangle._vertices[2]) { this._adjacentTriangles[2] = triangle; this._adjacentPairIndex[2] = 2; triangle._adjacentTriangles[2] = this; @@ -7460,27 +6835,27 @@ oimo.collision.narrowphase.detector.gjkepa.EpaTriangle = class oimo_collision_na return true; } removeAdjacentTriangles() { - var triangle = this._adjacentTriangles[0]; + let triangle = this._adjacentTriangles[0]; if(triangle != null) { - var pairIndex = this._adjacentPairIndex[0]; + let pairIndex = this._adjacentPairIndex[0]; triangle._adjacentTriangles[pairIndex] = null; triangle._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[0] = null; this._adjacentPairIndex[0] = -1; } - var triangle1 = this._adjacentTriangles[1]; + let triangle1 = this._adjacentTriangles[1]; if(triangle1 != null) { - var pairIndex1 = this._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + let pairIndex = this._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex] = null; + triangle1._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[1] = null; this._adjacentPairIndex[1] = -1; } - var triangle2 = this._adjacentTriangles[2]; + let triangle2 = this._adjacentTriangles[2]; if(triangle2 != null) { - var pairIndex2 = this._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + let pairIndex = this._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex] = null; + triangle2._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[2] = null; this._adjacentPairIndex[2] = -1; } @@ -7512,15 +6887,15 @@ oimo.collision.narrowphase.detector.gjkepa.EpaVertex = class oimo_collision_narr this.w2 = new oimo.common.Vec3(); } init(v,w1,w2) { - var _this = this.v; + let _this = this.v; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1; + let _this1 = this.w1; _this1.x = w1.x; _this1.y = w1.y; _this1.z = w1.z; - var _this2 = this.w2; + let _this2 = this.w2; _this2.x = w2.x; _this2.y = w2.y; _this2.z = w2.z; @@ -7567,12 +6942,9 @@ oimo.common.Vec3 = class oimo_common_Vec3 { return this; } zero() { - var tx = 0; - var ty = 0; - var tz = 0; - this.x = tx; - this.y = ty; - this.z = tz; + this.x = 0; + this.y = 0; + this.z = 0; return this; } add(v) { @@ -7603,75 +6975,53 @@ oimo.common.Vec3 = class oimo_common_Vec3 { return new oimo.common.Vec3(this.y * v.z - this.z * v.y,this.z * v.x - this.x * v.z,this.x * v.y - this.y * v.x); } addEq(v) { - var tx = this.x + v.x; - var ty = this.y + v.y; - var tz = this.z + v.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x += v.x; + this.y += v.y; + this.z += v.z; return this; } add3Eq(vx,vy,vz) { - var tx = this.x + vx; - var ty = this.y + vy; - var tz = this.z + vz; - this.x = tx; - this.y = ty; - this.z = tz; + this.x += vx; + this.y += vy; + this.z += vz; return this; } addScaledEq(v,s) { - var tx = this.x + v.x * s; - var ty = this.y + v.y * s; - var tz = this.z + v.z * s; - this.x = tx; - this.y = ty; - this.z = tz; + this.x += v.x * s; + this.y += v.y * s; + this.z += v.z * s; return this; } subEq(v) { - var tx = this.x - v.x; - var ty = this.y - v.y; - var tz = this.z - v.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x -= v.x; + this.y -= v.y; + this.z -= v.z; return this; } sub3Eq(vx,vy,vz) { - var tx = this.x - vx; - var ty = this.y - vy; - var tz = this.z - vz; - this.x = tx; - this.y = ty; - this.z = tz; + this.x -= vx; + this.y -= vy; + this.z -= vz; return this; } scaleEq(s) { - var tx = this.x * s; - var ty = this.y * s; - var tz = this.z * s; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= s; + this.y *= s; + this.z *= s; return this; } scale3Eq(sx,sy,sz) { - var tx = this.x * sx; - var ty = this.y * sy; - var tz = this.z * sz; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= sx; + this.y *= sy; + this.z *= sz; return this; } crossEq(v) { - var tx = this.y * v.z - this.z * v.y; - var ty = this.z * v.x - this.x * v.z; - var tz = this.x * v.y - this.y * v.x; - this.x = tx; - this.y = ty; - this.z = tz; + let y = this.z * v.x - this.x * v.z; + let z = this.x * v.y - this.y * v.x; + this.x = this.y * v.z - this.z * v.y; + this.y = y; + this.z = z; return this; } mulMat3(m) { @@ -7681,17 +7031,15 @@ oimo.common.Vec3 = class oimo_common_Vec3 { return new oimo.common.Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03,this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13,this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23); } mulTransform(tf) { - var v; - var vX; - var vY; - var vZ; - var v1 = this; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = this.x; + vY = this.y; + vZ = this.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; @@ -7701,43 +7049,38 @@ oimo.common.Vec3 = class oimo_common_Vec3 { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var res = new oimo.common.Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + let res = new oimo.common.Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; return res; } mulMat3Eq(m) { - var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; - var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; - var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; - this.x = tx; - this.y = ty; - this.z = tz; + let y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; + let z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; + this.y = y; + this.z = z; return this; } mulMat4Eq(m) { - var tx = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; - var ty = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; - var tz = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; - this.x = tx; - this.y = ty; - this.z = tz; + let y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; + let z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; + this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; + this.y = y; + this.z = z; return this; } mulTransformEq(tf) { - var v; - var vX; - var vY; - var vZ; - var v1 = this; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = this.x; + vY = this.y; + vZ = this.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; @@ -7747,10 +7090,9 @@ oimo.common.Vec3 = class oimo_common_Vec3 { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var v2 = this; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + this.x = vX; + this.y = vY; + this.z = vZ; return this; } length() { @@ -7760,35 +7102,29 @@ oimo.common.Vec3 = class oimo_common_Vec3 { return this.x * this.x + this.y * this.y + this.z * this.z; } normalized() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); if(invLen > 0) { invLen = 1 / invLen; } return new oimo.common.Vec3(this.x * invLen,this.y * invLen,this.z * invLen); } normalize() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = this.x * invLen; - var ty = this.y * invLen; - var tz = this.z * invLen; - this.x = tx; - this.y = ty; - this.z = tz; + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; return this; } negate() { return new oimo.common.Vec3(-this.x,-this.y,-this.z); } negateEq() { - var tx = -this.x; - var ty = -this.y; - var tz = -this.z; - this.x = tx; - this.y = ty; - this.z = tz; + this.x = -this.x; + this.y = -this.y; + this.z = -this.z; return this; } copyFrom(v) { @@ -7835,93 +7171,83 @@ oimo.common.Transform = class oimo_common_Transform { return this; } getPosition() { - var position = new oimo.common.Vec3(); - var v = position; - v.x = this._positionX; - v.y = this._positionY; - v.z = this._positionZ; + let position = new oimo.common.Vec3(); + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; return position; } getPositionTo(position) { - var v = position; - v.x = this._positionX; - v.y = this._positionY; - v.z = this._positionZ; + position.x = this._positionX; + position.y = this._positionY; + position.z = this._positionZ; } setPosition(position) { - var v = position; - this._positionX = v.x; - this._positionY = v.y; - this._positionZ = v.z; + this._positionX = position.x; + this._positionY = position.y; + this._positionZ = position.z; return this; } translate(translation) { - var diff; - var diffX; - var diffY; - var diffZ; - var v = translation; - diffX = v.x; - diffY = v.y; - diffZ = v.z; + let diffX; + let diffY; + let diffZ; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; this._positionX += diffX; this._positionY += diffY; this._positionZ += diffZ; } getRotation() { - var rotation = new oimo.common.Mat3(); - var m = rotation; - m.e00 = this._rotation00; - m.e01 = this._rotation01; - m.e02 = this._rotation02; - m.e10 = this._rotation10; - m.e11 = this._rotation11; - m.e12 = this._rotation12; - m.e20 = this._rotation20; - m.e21 = this._rotation21; - m.e22 = this._rotation22; + let rotation = new oimo.common.Mat3(); + rotation.e00 = this._rotation00; + rotation.e01 = this._rotation01; + rotation.e02 = this._rotation02; + rotation.e10 = this._rotation10; + rotation.e11 = this._rotation11; + rotation.e12 = this._rotation12; + rotation.e20 = this._rotation20; + rotation.e21 = this._rotation21; + rotation.e22 = this._rotation22; return rotation; } getRotationTo(out) { - var m = out; - m.e00 = this._rotation00; - m.e01 = this._rotation01; - m.e02 = this._rotation02; - m.e10 = this._rotation10; - m.e11 = this._rotation11; - m.e12 = this._rotation12; - m.e20 = this._rotation20; - m.e21 = this._rotation21; - m.e22 = this._rotation22; + out.e00 = this._rotation00; + out.e01 = this._rotation01; + out.e02 = this._rotation02; + out.e10 = this._rotation10; + out.e11 = this._rotation11; + out.e12 = this._rotation12; + out.e20 = this._rotation20; + out.e21 = this._rotation21; + out.e22 = this._rotation22; } setRotation(rotation) { - var m = rotation; - this._rotation00 = m.e00; - this._rotation01 = m.e01; - this._rotation02 = m.e02; - this._rotation10 = m.e10; - this._rotation11 = m.e11; - this._rotation12 = m.e12; - this._rotation20 = m.e20; - this._rotation21 = m.e21; - this._rotation22 = m.e22; + this._rotation00 = rotation.e00; + this._rotation01 = rotation.e01; + this._rotation02 = rotation.e02; + this._rotation10 = rotation.e10; + this._rotation11 = rotation.e11; + this._rotation12 = rotation.e12; + this._rotation20 = rotation.e20; + this._rotation21 = rotation.e21; + this._rotation22 = rotation.e22; return this; } setRotationXyz(eulerAngles) { - var xyz; - var xyzX; - var xyzY; - var xyzZ; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let xyzX; + let xyzY; + let xyzZ; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); this._rotation00 = cy * cz; this._rotation01 = -cy * sz; this._rotation02 = sy; @@ -7933,35 +7259,33 @@ oimo.common.Transform = class oimo_common_Transform { this._rotation22 = cx * cy; } rotate(rotation) { - var rot; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; - var m = rotation; - rot00 = m.e00; - rot01 = m.e01; - rot02 = m.e02; - rot10 = m.e10; - rot11 = m.e11; - rot12 = m.e12; - rot20 = m.e20; - rot21 = m.e21; - rot22 = m.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; @@ -7982,30 +7306,27 @@ oimo.common.Transform = class oimo_common_Transform { this._rotation22 = __tmp__22; } rotateXyz(eulerAngles) { - var xyz; - var xyzX; - var xyzY; - var xyzZ; - var rot; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let xyzX; + let xyzY; + let xyzZ; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); rot00 = cy * cz; rot01 = -cy * sz; rot02 = sy; @@ -8015,15 +7336,15 @@ oimo.common.Transform = class oimo_common_Transform { rot20 = sx * sz - cx * cz * sy; rot21 = cz * sx + cx * sy * sz; rot22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; @@ -8044,17 +7365,16 @@ oimo.common.Transform = class oimo_common_Transform { this._rotation22 = __tmp__22; } getOrientation() { - var q = new oimo.common.Quat(); - var iq; - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._rotation00; - var e11 = this._rotation11; - var e22 = this._rotation22; - var t = e00 + e11 + e22; - var s; + let q = new oimo.common.Quat(); + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._rotation00; + let e11 = this._rotation11; + let e22 = this._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -8093,24 +7413,22 @@ oimo.common.Transform = class oimo_common_Transform { iqY = (this._rotation12 + this._rotation21) * s; iqW = (this._rotation10 - this._rotation01) * s; } - var q1 = q; - q1.x = iqX; - q1.y = iqY; - q1.z = iqZ; - q1.w = iqW; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; return q; } getOrientationTo(orientation) { - var iq; - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._rotation00; - var e11 = this._rotation11; - var e22 = this._rotation22; - var t = e00 + e11 + e22; - var s; + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._rotation00; + let e11 = this._rotation11; + let e22 = this._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -8149,39 +7467,36 @@ oimo.common.Transform = class oimo_common_Transform { iqY = (this._rotation12 + this._rotation21) * s; iqW = (this._rotation10 - this._rotation01) * s; } - var q = orientation; - q.x = iqX; - q.y = iqY; - q.z = iqZ; - q.w = iqW; + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; } setOrientation(quaternion) { - var q; - var qX; - var qY; - var qZ; - var qW; - var q1 = quaternion; - qX = q1.x; - qY = q1.y; - qZ = q1.z; - qW = q1.w; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let qX; + let qY; + let qZ; + let qW; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._rotation00 = 1 - yy - zz; this._rotation01 = xy - wz; this._rotation02 = xz + wy; @@ -8194,7 +7509,7 @@ oimo.common.Transform = class oimo_common_Transform { return this; } clone() { - var tf = new oimo.common.Transform(); + let tf = new oimo.common.Transform(); tf._positionX = this._positionX; tf._positionY = this._positionY; tf._positionZ = this._positionZ; @@ -8229,14 +7544,10 @@ oimo.common.Setting = class oimo_common_Setting { } oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowphase_detector_gjkepa_GjkEpa { constructor() { - var this1 = new Array(4); - this.s = this1; - var this2 = new Array(4); - this.w1 = this2; - var this3 = new Array(4); - this.w2 = this3; - var this4 = new Array(3); - this.baseDirs = this4; + this.s = new Array(4); + this.w1 = new Array(4); + this.w2 = new Array(4); + this.baseDirs = new Array(3); this.baseDirs[0] = new oimo.common.Vec3(1,0,0); this.baseDirs[1] = new oimo.common.Vec3(0,1,0); this.baseDirs[2] = new oimo.common.Vec3(0,0,1); @@ -8268,11 +7579,11 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp this.c2 = c2; this.tf1 = tf1; this.tf2 = tf2; - var s = this.s; - var w1 = this.w1; - var w2 = this.w2; - var closest = this.closest; - var dir = this.dir; + let s = this.s; + let w1 = this.w1; + let w2 = this.w2; + let closest = this.closest; + let dir = this.dir; if(cache != null) { if(cache._gjkCache == null) { cache._gjkCache = new oimo.collision.narrowphase.detector.gjkepa.GjkCache(); @@ -8282,17 +7593,15 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp dir.zero(); } if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z == 0) { - var firstDir; - var firstDirX; - var firstDirY; - var firstDirZ; + let firstDirX; + let firstDirY; + let firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; - var v = dir; - v.x = firstDirX; - v.y = firstDirY; - v.z = firstDirZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { dir.init(1,0,0); } @@ -8300,128 +7609,104 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp this.simplexSize = 0; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; - _this.x = v1.x; - _this.y = v1.y; - _this.z = v1.z; - var _this1 = _this; - var v2 = this.w2[this.simplexSize]; - var tx = _this1.x - v2.x; - var ty = _this1.y - v2.y; - var tz = _this1.z - v2.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + let _this = this.s[this.simplexSize]; + let v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let v1 = this.w2[this.simplexSize]; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; this.simplexSize = 1; - var count = 0; - var max = 40; - var eps = 1e-4; - var eps2 = eps * eps; - while(count < max) { - var v3 = 0; + let count = 0; + while(count < 40) { + let v = 0; switch(this.simplexSize) { case 1: - var v4 = s[0]; - closest.x = v4.x; - closest.y = v4.y; - closest.z = v4.z; - v3 = 1; + let v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: - var v11; - var v1X; - var v1Y; - var v1Z; - var v21; - var v2X; - var v2Y; - var v2Z; - var v5 = s[0]; - v1X = v5.x; - v1Y = v5.y; - v1Z = v5.z; - var v6 = s[1]; - v2X = v6.x; - v2Y = v6.y; - v2Z = v6.z; - var v12; - var v12X; - var v12Y; - var v12Z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + let v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; + let v12X; + let v12Y; + let v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v7 = closest; - v7.x = v1X; - v7.y = v1Y; - v7.z = v1Z; - v3 = 1; + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v = 1; } else if(t > 1) { - var v8 = closest; - v8.x = v2X; - v8.y = v2Y; - v8.z = v2Z; - v3 = 2; + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v = 2; } else { - var p; - var pX; - var pY; - var pZ; + let pX; + let pY; + let pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v9 = closest; - v9.x = pX; - v9.y = pY; - v9.z = pZ; - v3 = 3; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v = 3; } break; case 3: - var vec1 = s[0]; - var vec2 = s[1]; - var vec3 = s[2]; - var v13; - var v1X1; - var v1Y1; - var v1Z1; - var v22; - var v2X1; - var v2Y1; - var v2Z1; - var v31; - var v3X; - var v3Y; - var v3Z; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - var v23; - var v23X; - var v23Y; - var v23Z; - var v311; - var v31X; - var v31Y; - var v31Z; - var v10 = vec1; - v1X1 = v10.x; - v1Y1 = v10.y; - v1Z1 = v10.z; - var v14 = vec2; - v2X1 = v14.x; - v2Y1 = v14.y; - v2Z1 = v14.z; - var v15 = vec3; - v3X = v15.x; - v3Y = v15.y; - v3Z = v15.z; + let vec1 = s[0]; + let vec2 = s[1]; + let vec3 = s[2]; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X; + let v3Y; + let v3Z; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -8431,25 +7716,21 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var n; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; - var n12X; - var n12Y; - var n12Z; - var n23; - var n23X; - var n23Y; - var n23Z; - var n31; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -8459,1624 +7740,1327 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; - var mind = -1; - var minv; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v16; - var v1X2; - var v1Y2; - var v1Z2; - var v24; - var v2X2; - var v2Y2; - var v2Z2; - var v17 = vec1; - v1X2 = v17.x; - v1Y2 = v17.y; - v1Z2 = v17.z; - var v18 = vec2; - v2X2 = v18.x; - v2Y2 = v18.y; - v2Z2 = v18.z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d1; - var b; - if(t1 < 0) { - var v19 = closest; - v19.x = v1X2; - v19.y = v1Y2; - v19.z = v1Z2; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; b = 1; - } else if(t1 > 1) { - var v20 = closest; - v20.x = v2X2; - v20.y = v2Y2; - v20.z = v2Z2; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; b = 2; } else { - var p1; - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - var v25 = closest; - v25.x = pX1; - v25.y = pY1; - v25.z = pZ1; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini = b; - mind = d2; - var v26 = closest; - minvX = v26.x; - minvY = v26.y; - minvZ = v26.z; - } - if(d23 < 0) { - var v110; - var v1X3; - var v1Y3; - var v1Z3; - var v27; - var v2X3; - var v2Y3; - var v2Z3; - var v28 = vec2; - v1X3 = v28.x; - v1Y3 = v28.y; - v1Z3 = v28.z; - var v29 = vec3; - v2X3 = v29.x; - v2Y3 = v29.y; - v2Z3 = v29.z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d3; - var b1; - if(t2 < 0) { - var v30 = closest; - v30.x = v1X3; - v30.y = v1Y3; - v30.z = v1Z3; - b1 = 1; - } else if(t2 > 1) { - var v32 = closest; - v32.x = v2X3; - v32.y = v2Y3; - v32.z = v2Z3; - b1 = 2; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p2; - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - var v33 = closest; - v33.x = pX2; - v33.y = pY2; - v33.z = pZ2; - b1 = 3; - } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d4 < mind) { - mini = b1 << 1; - mind = d4; - var v34 = closest; - minvX = v34.x; - minvY = v34.y; - minvZ = v34.z; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - } - if(d31 < 0) { - var v111; - var v1X4; - var v1Y4; - var v1Z4; - var v210; - var v2X4; - var v2Y4; - var v2Z4; - var v35 = vec1; - v1X4 = v35.x; - v1Y4 = v35.y; - v1Z4 = v35.z; - var v36 = vec3; - v2X4 = v36.x; - v2Y4 = v36.y; - v2Z4 = v36.z; - var v124; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; - var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / d5; - var b2; - if(t3 < 0) { - var v37 = closest; - v37.x = v1X4; - v37.y = v1Y4; - v37.z = v1Z4; - b2 = 1; - } else if(t3 > 1) { - var v38 = closest; - v38.x = v2X4; - v38.y = v2Y4; - v38.z = v2Z4; - b2 = 2; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p3; - var pX3; - var pY3; - var pZ3; - pX3 = v1X4 + v12X4 * t3; - pY3 = v1Y4 + v12Y4 * t3; - pZ3 = v1Z4 + v12Z4 * t3; - var v39 = closest; - v39.x = pX3; - v39.y = pY3; - v39.z = pZ3; - b2 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d6 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v40 = closest; - minvX = v40.x; - minvY = v40.y; - minvZ = v40.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } if(mind > 0) { - var v41 = closest; - v41.x = minvX; - v41.y = minvY; - v41.z = minvZ; - v3 = mini; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v = mini; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v42 = closest; - v42.x = minvX; - v42.y = minvY; - v42.z = minvZ; - v3 = 7; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v = 7; } break; case 4: - var vec11 = s[0]; - var vec21 = s[1]; - var vec31 = s[2]; - var vec4 = s[3]; - var v112; - var v1X5; - var v1Y5; - var v1Z5; - var v211; - var v2X5; - var v2Y5; - var v2Z5; - var v310; - var v3X1; - var v3Y1; - var v3Z1; - var v43; - var v4X; - var v4Y; - var v4Z; - var v125; - var v12X5; - var v12Y5; - var v12Z5; - var v131; - var v13X; - var v13Y; - var v13Z; - var v141; - var v14X; - var v14Y; - var v14Z; - var v231; - var v23X1; - var v23Y1; - var v23Z1; - var v241; - var v24X; - var v24Y; - var v24Z; - var v341; - var v34X; - var v34Y; - var v34Z; - var v44 = vec11; - v1X5 = v44.x; - v1Y5 = v44.y; - v1Z5 = v44.z; - var v45 = vec21; - v2X5 = v45.x; - v2Y5 = v45.y; - v2Z5 = v45.z; - var v46 = vec31; - v3X1 = v46.x; - v3Y1 = v46.y; - v3Z1 = v46.z; - var v47 = vec4; - v4X = v47.x; - v4Y = v47.y; - v4Z = v47.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v13X = v3X1 - v1X5; - v13Y = v3Y1 - v1Y5; - v13Z = v3Z1 - v1Z5; - v14X = v4X - v1X5; - v14Y = v4Y - v1Y5; - v14Z = v4Z - v1Z5; - v23X1 = v3X1 - v2X5; - v23Y1 = v3Y1 - v2Y5; - v23Z1 = v3Z1 - v2Z5; - v24X = v4X - v2X5; - v24Y = v4Y - v2Y5; - v24Z = v4Z - v2Z5; - v34X = v4X - v3X1; - v34Y = v4Y - v3Y1; - v34Z = v4Z - v3Z1; - var rev; - var n123; - var n123X; - var n123Y; - var n123Z; - var n134; - var n134X; - var n134Y; - var n134Z; - var n142; - var n142X; - var n142Y; - var n142Z; - var n243; - var n243X; - var n243Y; - var n243Z; - var n1; - var nX1; - var nY1; - var nZ1; - n123X = v12Y5 * v13Z - v12Z5 * v13Y; - n123Y = v12Z5 * v13X - v12X5 * v13Z; - n123Z = v12X5 * v13Y - v12Y5 * v13X; + let vec11 = s[0]; + let vec21 = s[1]; + let vec31 = s[2]; + let vec4 = s[3]; + let v1X2; + let v1Y2; + let v1Z2; + let v2X2; + let v2Y2; + let v2Z2; + let v3X1; + let v3Y1; + let v3Z1; + let v4X; + let v4Y; + let v4Z; + let v12X2; + let v12Y2; + let v12Z2; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X1; + let v23Y1; + let v23Z1; + let v24X; + let v24Y; + let v24Z; + v1X2 = vec11.x; + v1Y2 = vec11.y; + v1Z2 = vec11.z; + v2X2 = vec21.x; + v2Y2 = vec21.y; + v2Z2 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + v13X = v3X1 - v1X2; + v13Y = v3Y1 - v1Y2; + v13Z = v3Z1 - v1Z2; + v14X = v4X - v1X2; + v14Y = v4Y - v1Y2; + v14Z = v4Z - v1Z2; + v23X1 = v3X1 - v2X2; + v23Y1 = v3Y1 - v2Y2; + v23Z1 = v3Z1 - v2Z2; + v24X = v4X - v2X2; + v24Y = v4Y - v2Y2; + v24Z = v4Z - v2Z2; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; + n123X = v12Y2 * v13Z - v12Z2 * v13Y; + n123Y = v12Z2 * v13X - v12X2 * v13Z; + n123Z = v12X2 * v13Y - v12Y2 * v13X; n134X = v13Y * v14Z - v13Z * v14Y; n134Y = v13Z * v14X - v13X * v14Z; n134Z = v13X * v14Y - v13Y * v14X; - n142X = v14Y * v12Z5 - v14Z * v12Y5; - n142Y = v14Z * v12X5 - v14X * v12Z5; - n142Z = v14X * v12Y5 - v14Y * v12X5; + n142X = v14Y * v12Z2 - v14Z * v12Y2; + n142Y = v14Z * v12X2 - v14X * v12Z2; + n142Z = v14X * v12Y2 - v14Y * v12X2; n243X = v24Y * v23Z1 - v24Z * v23Y1; n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; - var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; - var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; - var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; - var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; - var mind1 = -1; - var minv1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; + let sign = v12X2 * n243X + v12Y2 * n243Y + v12Z2 * n243Z > 0 ? 1 : -1; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d123 * sign < 0) { - var v113; - var v1X6; - var v1Y6; - var v1Z6; - var v212; - var v2X6; - var v2Y6; - var v2Z6; - var v312; - var v3X2; - var v3Y2; - var v3Z2; - var v126; - var v12X6; - var v12Y6; - var v12Z6; - var v232; - var v23X2; - var v23Y2; - var v23Z2; - var v313; - var v31X1; - var v31Y1; - var v31Z1; - var v48 = vec11; - v1X6 = v48.x; - v1Y6 = v48.y; - v1Z6 = v48.z; - var v49 = vec21; - v2X6 = v49.x; - v2Y6 = v49.y; - v2Z6 = v49.z; - var v50 = vec31; - v3X2 = v50.x; - v3Y2 = v50.y; - v3Z2 = v50.z; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - v23X2 = v3X2 - v2X6; - v23Y2 = v3Y2 - v2Y6; - v23Z2 = v3Z2 - v2Z6; - v31X1 = v1X6 - v3X2; - v31Y1 = v1Y6 - v3Y2; - v31Z1 = v1Z6 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n121; - var n12X1; - var n12Y1; - var n12Z1; - var n231; - var n23X1; - var n23Y1; - var n23Z1; - var n311; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; - n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; - n12Z1 = v12X6 * nY2 - v12Y6 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; - var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; - var mind2 = -1; - var minv2; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(d121 < 0) { - var v114; - var v1X7; - var v1Y7; - var v1Z7; - var v213; - var v2X7; - var v2Y7; - var v2Z7; - var v51 = vec11; - v1X7 = v51.x; - v1Y7 = v51.y; - v1Z7 = v51.z; - var v52 = vec21; - v2X7 = v52.x; - v2Y7 = v52.y; - v2Z7 = v52.z; - var v127; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d7; - var b3; - if(t4 < 0) { - var v53 = closest; - v53.x = v1X7; - v53.y = v1Y7; - v53.z = v1Z7; - b3 = 1; - } else if(t4 > 1) { - var v54 = closest; - v54.x = v2X7; - v54.y = v2Y7; - v54.z = v2Z7; - b3 = 2; + if((v1X2 * n123X + v1Y2 * n123Y + v1Z2 * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec31.x; + v3Y = vec31.y; + v3Z = vec31.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p4; - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - var v55 = closest; - v55.x = pX4; - v55.y = pY4; - v55.z = pZ4; - b3 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini2 = b3; - mind2 = d8; - var v56 = closest; - minvX2 = v56.x; - minvY2 = v56.y; - minvZ2 = v56.z; - } - if(d231 < 0) { - var v115; - var v1X8; - var v1Y8; - var v1Z8; - var v214; - var v2X8; - var v2Y8; - var v2Z8; - var v57 = vec21; - v1X8 = v57.x; - v1Y8 = v57.y; - v1Z8 = v57.z; - var v58 = vec31; - v2X8 = v58.x; - v2Y8 = v58.y; - v2Z8 = v58.z; - var v128; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d9; - var b4; - if(t5 < 0) { - var v59 = closest; - v59.x = v1X8; - v59.y = v1Y8; - v59.z = v1Z8; - b4 = 1; - } else if(t5 > 1) { - var v60 = closest; - v60.x = v2X8; - v60.y = v2Y8; - v60.z = v2Z8; - b4 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p5; - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - var v61 = closest; - v61.x = pX5; - v61.y = pY5; - v61.z = pZ5; - b4 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d10 < mind2) { - mini2 = b4 << 1; - mind2 = d10; - var v62 = closest; - minvX2 = v62.x; - minvY2 = v62.y; - minvZ2 = v62.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d311 < 0) { - var v116; - var v1X9; - var v1Y9; - var v1Z9; - var v215; - var v2X9; - var v2Y9; - var v2Z9; - var v63 = vec11; - v1X9 = v63.x; - v1Y9 = v63.y; - v1Z9 = v63.z; - var v64 = vec31; - v2X9 = v64.x; - v2Y9 = v64.y; - v2Z9 = v64.z; - var v129; - var v12X9; - var v12Y9; - var v12Z9; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; - var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / d11; - var b5; - if(t6 < 0) { - var v65 = closest; - v65.x = v1X9; - v65.y = v1Y9; - v65.z = v1Z9; - b5 = 1; - } else if(t6 > 1) { - var v66 = closest; - v66.x = v2X9; - v66.y = v2Y9; - v66.z = v2Z9; - b5 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p6; - var pX6; - var pY6; - var pZ6; - pX6 = v1X9 + v12X9 * t6; - pY6 = v1Y9 + v12Y9 * t6; - pZ6 = v1Z9 + v12Z9 * t6; - var v67 = closest; - v67.x = pX6; - v67.y = pY6; - v67.z = pZ6; - b5 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d13 < mind2) { - mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d13; - var v68 = closest; - minvX2 = v68.x; - minvY2 = v68.y; - minvZ2 = v68.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b6; - if(mind2 > 0) { - var v69 = closest; - v69.x = minvX2; - v69.y = minvY2; - v69.z = minvZ2; - b6 = mini2; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v70 = closest; - v70.x = minvX2; - v70.y = minvY2; - v70.z = minvZ2; - b6 = 7; - } - var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini1 = b6; - mind1 = d14; - var v71 = closest; - minvX1 = v71.x; - minvY1 = v71.y; - minvZ1 = v71.z; - } - if(d134 * sign < 0) { - var v117; - var v1X10; - var v1Y10; - var v1Z10; - var v216; - var v2X10; - var v2Y10; - var v2Z10; - var v314; - var v3X3; - var v3Y3; - var v3Z3; - var v1210; - var v12X10; - var v12Y10; - var v12Z10; - var v233; - var v23X3; - var v23Y3; - var v23Z3; - var v315; - var v31X2; - var v31Y2; - var v31Z2; - var v72 = vec11; - v1X10 = v72.x; - v1Y10 = v72.y; - v1Z10 = v72.z; - var v73 = vec31; - v2X10 = v73.x; - v2Y10 = v73.y; - v2Z10 = v73.z; - var v74 = vec4; - v3X3 = v74.x; - v3Y3 = v74.y; - v3Z3 = v74.z; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - v23X3 = v3X3 - v2X10; - v23Y3 = v3Y3 - v2Y10; - v23Z3 = v3Z3 - v2Z10; - v31X2 = v1X10 - v3X3; - v31Y2 = v1Y10 - v3Y3; - v31Z2 = v1Z10 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n122; - var n12X2; - var n12Y2; - var n12Z2; - var n232; - var n23X2; - var n23Y2; - var n23Z2; - var n312; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; - n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; - n12Z2 = v12X10 * nY3 - v12Y10 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; - var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; - var mind3 = -1; - var minv3; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(d122 < 0) { - var v118; - var v1X11; - var v1Y11; - var v1Z11; - var v217; - var v2X11; - var v2Y11; - var v2Z11; - var v75 = vec11; - v1X11 = v75.x; - v1Y11 = v75.y; - v1Z11 = v75.z; - var v76 = vec31; - v2X11 = v76.x; - v2Y11 = v76.y; - v2Z11 = v76.z; - var v1211; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d15; - var b7; - if(t7 < 0) { - var v77 = closest; - v77.x = v1X11; - v77.y = v1Y11; - v77.z = v1Z11; - b7 = 1; - } else if(t7 > 1) { - var v78 = closest; - v78.x = v2X11; - v78.y = v2Y11; - v78.z = v2Z11; - b7 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + mini1 = b; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X2 * n134X + v1Y2 * n134Y + v1Z2 * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p7; - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - var v79 = closest; - v79.x = pX7; - v79.y = pY7; - v79.z = pZ7; - b7 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini3 = b7; - mind3 = d16; - var v80 = closest; - minvX3 = v80.x; - minvY3 = v80.y; - minvZ3 = v80.z; - } - if(d232 < 0) { - var v119; - var v1X12; - var v1Y12; - var v1Z12; - var v218; - var v2X12; - var v2Y12; - var v2Z12; - var v81 = vec31; - v1X12 = v81.x; - v1Y12 = v81.y; - v1Z12 = v81.z; - var v82 = vec4; - v2X12 = v82.x; - v2Y12 = v82.y; - v2Z12 = v82.z; - var v1212; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d17; - var b8; - if(t8 < 0) { - var v83 = closest; - v83.x = v1X12; - v83.y = v1Y12; - v83.z = v1Z12; - b8 = 1; - } else if(t8 > 1) { - var v84 = closest; - v84.x = v2X12; - v84.y = v2Y12; - v84.z = v2Z12; - b8 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p8; - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - var v85 = closest; - v85.x = pX8; - v85.y = pY8; - v85.z = pZ8; - b8 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d18 < mind3) { - mini3 = b8 << 1; - mind3 = d18; - var v86 = closest; - minvX3 = v86.x; - minvY3 = v86.y; - minvZ3 = v86.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d312 < 0) { - var v120; - var v1X13; - var v1Y13; - var v1Z13; - var v219; - var v2X13; - var v2Y13; - var v2Z13; - var v87 = vec11; - v1X13 = v87.x; - v1Y13 = v87.y; - v1Z13 = v87.z; - var v88 = vec4; - v2X13 = v88.x; - v2Y13 = v88.y; - v2Z13 = v88.z; - var v1213; - var v12X13; - var v12Y13; - var v12Z13; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; - var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / d19; - var b9; - if(t9 < 0) { - var v89 = closest; - v89.x = v1X13; - v89.y = v1Y13; - v89.z = v1Z13; - b9 = 1; - } else if(t9 > 1) { - var v90 = closest; - v90.x = v2X13; - v90.y = v2Y13; - v90.z = v2Z13; - b9 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p9; - var pX9; - var pY9; - var pZ9; - pX9 = v1X13 + v12X13 * t9; - pY9 = v1Y13 + v12Y13 * t9; - pZ9 = v1Z13 + v12Z13 * t9; - var v91 = closest; - v91.x = pX9; - v91.y = pY9; - v91.z = pZ9; - b9 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d20 < mind3) { - mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d20; - var v92 = closest; - minvX3 = v92.x; - minvY3 = v92.y; - minvZ3 = v92.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b10; - if(mind3 > 0) { - var v93 = closest; - v93.x = minvX3; - v93.y = minvY3; - v93.z = minvZ3; - b10 = mini3; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v94 = closest; - v94.x = minvX3; - v94.y = minvY3; - v94.z = minvZ3; - b10 = 7; - } - var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d21 < mind1) { - mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d21; - var v95 = closest; - minvX1 = v95.x; - minvY1 = v95.y; - minvZ1 = v95.z; - } - } - if(d142 * sign < 0) { - var v130; - var v1X14; - var v1Y14; - var v1Z14; - var v220; - var v2X14; - var v2Y14; - var v2Z14; - var v316; - var v3X4; - var v3Y4; - var v3Z4; - var v1214; - var v12X14; - var v12Y14; - var v12Z14; - var v234; - var v23X4; - var v23Y4; - var v23Z4; - var v317; - var v31X3; - var v31Y3; - var v31Z3; - var v96 = vec11; - v1X14 = v96.x; - v1Y14 = v96.y; - v1Z14 = v96.z; - var v97 = vec21; - v2X14 = v97.x; - v2Y14 = v97.y; - v2Z14 = v97.z; - var v98 = vec4; - v3X4 = v98.x; - v3Y4 = v98.y; - v3Z4 = v98.z; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - v23X4 = v3X4 - v2X14; - v23Y4 = v3Y4 - v2Y14; - v23Z4 = v3Z4 - v2Z14; - v31X3 = v1X14 - v3X4; - v31Y3 = v1Y14 - v3Y4; - v31Z3 = v1Z14 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n124; - var n12X3; - var n12Y3; - var n12Z3; - var n233; - var n23X3; - var n23Y3; - var n23Z3; - var n313; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; - n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; - n12Z3 = v12X14 * nY4 - v12Y14 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; - var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; - var mind4 = -1; - var minv4; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(d124 < 0) { - var v132; - var v1X15; - var v1Y15; - var v1Z15; - var v221; - var v2X15; - var v2Y15; - var v2Z15; - var v99 = vec11; - v1X15 = v99.x; - v1Y15 = v99.y; - v1Z15 = v99.z; - var v100 = vec21; - v2X15 = v100.x; - v2Y15 = v100.y; - v2Z15 = v100.z; - var v1215; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d22; - var b11; - if(t10 < 0) { - var v101 = closest; - v101.x = v1X15; - v101.y = v1Y15; - v101.z = v1Z15; - b11 = 1; - } else if(t10 > 1) { - var v102 = closest; - v102.x = v2X15; - v102.y = v2Y15; - v102.z = v2Z15; - b11 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 6) << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v1X2 * n142X + v1Y2 * n142Y + v1Z2 * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p10; - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - var v103 = closest; - v103.x = pX10; - v103.y = pY10; - v103.z = pZ10; - b11 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini4 = b11; - mind4 = d24; - var v104 = closest; - minvX4 = v104.x; - minvY4 = v104.y; - minvZ4 = v104.z; - } - if(d233 < 0) { - var v133; - var v1X16; - var v1Y16; - var v1Z16; - var v222; - var v2X16; - var v2Y16; - var v2Z16; - var v105 = vec21; - v1X16 = v105.x; - v1Y16 = v105.y; - v1Z16 = v105.z; - var v106 = vec4; - v2X16 = v106.x; - v2Y16 = v106.y; - v2Z16 = v106.z; - var v1216; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d25; - var b12; - if(t11 < 0) { - var v107 = closest; - v107.x = v1X16; - v107.y = v1Y16; - v107.z = v1Z16; - b12 = 1; - } else if(t11 > 1) { - var v108 = closest; - v108.x = v2X16; - v108.y = v2Y16; - v108.z = v2Z16; - b12 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p11; - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - var v109 = closest; - v109.x = pX11; - v109.y = pY11; - v109.z = pZ11; - b12 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d26 < mind4) { - mini4 = b12 << 1; - mind4 = d26; - var v134 = closest; - minvX4 = v134.x; - minvY4 = v134.y; - minvZ4 = v134.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d313 < 0) { - var v135; - var v1X17; - var v1Y17; - var v1Z17; - var v223; - var v2X17; - var v2Y17; - var v2Z17; - var v136 = vec11; - v1X17 = v136.x; - v1Y17 = v136.y; - v1Z17 = v136.z; - var v137 = vec4; - v2X17 = v137.x; - v2Y17 = v137.y; - v2Z17 = v137.z; - var v1217; - var v12X17; - var v12Y17; - var v12Z17; - v12X17 = v2X17 - v1X17; - v12Y17 = v2Y17 - v1Y17; - v12Z17 = v2Z17 - v1Z17; - var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; - var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / d27; - var b13; - if(t12 < 0) { - var v138 = closest; - v138.x = v1X17; - v138.y = v1Y17; - v138.z = v1Z17; - b13 = 1; - } else if(t12 > 1) { - var v139 = closest; - v139.x = v2X17; - v139.y = v2Y17; - v139.z = v2Z17; - b13 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p12; - var pX12; - var pY12; - var pZ12; - pX12 = v1X17 + v12X17 * t12; - pY12 = v1Y17 + v12Y17 * t12; - pZ12 = v1Z17 + v12Z17 * t12; - var v140 = closest; - v140.x = pX12; - v140.y = pY12; - v140.z = pZ12; - b13 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d28 < mind4) { - mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d28; - var v142 = closest; - minvX4 = v142.x; - minvY4 = v142.y; - minvZ4 = v142.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b14; - if(mind4 > 0) { - var v143 = closest; - v143.x = minvX4; - v143.y = minvY4; - v143.z = minvZ4; - b14 = mini4; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v144 = closest; - v144.x = minvX4; - v144.y = minvY4; - v144.z = minvZ4; - b14 = 7; - } - var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d29 < mind1) { - mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d29; - var v145 = closest; - minvX1 = v145.x; - minvY1 = v145.y; - minvZ1 = v145.z; - } - } - if(d243 * sign < 0) { - var v146; - var v1X18; - var v1Y18; - var v1Z18; - var v224; - var v2X18; - var v2Y18; - var v2Z18; - var v318; - var v3X5; - var v3Y5; - var v3Z5; - var v1218; - var v12X18; - var v12Y18; - var v12Z18; - var v235; - var v23X5; - var v23Y5; - var v23Z5; - var v319; - var v31X4; - var v31Y4; - var v31Z4; - var v147 = vec21; - v1X18 = v147.x; - v1Y18 = v147.y; - v1Z18 = v147.z; - var v148 = vec31; - v2X18 = v148.x; - v2Y18 = v148.y; - v2Z18 = v148.z; - var v149 = vec4; - v3X5 = v149.x; - v3Y5 = v149.y; - v3Z5 = v149.z; - v12X18 = v2X18 - v1X18; - v12Y18 = v2Y18 - v1Y18; - v12Z18 = v2Z18 - v1Z18; - v23X5 = v3X5 - v2X18; - v23Y5 = v3Y5 - v2Y18; - v23Z5 = v3Z5 - v2Z18; - v31X4 = v1X18 - v3X5; - v31Y4 = v1Y18 - v3Y5; - v31Z4 = v1Z18 - v3Z5; - var n5; - var nX5; - var nY5; - var nZ5; - nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n125; - var n12X4; - var n12Y4; - var n12Z4; - var n234; - var n23X4; - var n23Y4; - var n23Z4; - var n314; - var n31X4; - var n31Y4; - var n31Z4; - n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; - n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; - n12Z4 = v12X18 * nY5 - v12Y18 * nX5; - n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; - n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; - n23Z4 = v23X5 * nY5 - v23Y5 * nX5; - n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; - n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; - n31Z4 = v31X4 * nY5 - v31Y4 * nX5; - var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; - var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; - var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; - var mind5 = -1; - var minv5; - var minvX5; - var minvY5; - var minvZ5; - var mini5 = 0; - minvX5 = 0; - minvY5 = 0; - minvZ5 = 0; - if(d125 < 0) { - var v150; - var v1X19; - var v1Y19; - var v1Z19; - var v225; - var v2X19; - var v2Y19; - var v2Z19; - var v151 = vec21; - v1X19 = v151.x; - v1Y19 = v151.y; - v1Z19 = v151.z; - var v152 = vec31; - v2X19 = v152.x; - v2Y19 = v152.y; - v2Z19 = v152.z; - var v1219; - var v12X19; - var v12Y19; - var v12Z19; - v12X19 = v2X19 - v1X19; - v12Y19 = v2Y19 - v1Y19; - v12Z19 = v2Z19 - v1Z19; - var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; - var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / d30; - var b15; - if(t13 < 0) { - var v153 = closest; - v153.x = v1X19; - v153.y = v1Y19; - v153.z = v1Z19; - b15 = 1; - } else if(t13 > 1) { - var v154 = closest; - v154.x = v2X19; - v154.y = v2Y19; - v154.z = v2Z19; - b15 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 3 | (b & 4) << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v2X2 * n243X + v2Y2 * n243Y + v2Z2 * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p13; - var pX13; - var pY13; - var pZ13; - pX13 = v1X19 + v12X19 * t13; - pY13 = v1Y19 + v12Y19 * t13; - pZ13 = v1Z19 + v12Z19 * t13; - var v155 = closest; - v155.x = pX13; - v155.y = pY13; - v155.z = pZ13; - b15 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini5 = b15; - mind5 = d32; - var v156 = closest; - minvX5 = v156.x; - minvY5 = v156.y; - minvZ5 = v156.z; - } - if(d234 < 0) { - var v157; - var v1X20; - var v1Y20; - var v1Z20; - var v226; - var v2X20; - var v2Y20; - var v2Z20; - var v158 = vec31; - v1X20 = v158.x; - v1Y20 = v158.y; - v1Z20 = v158.z; - var v159 = vec4; - v2X20 = v159.x; - v2Y20 = v159.y; - v2Z20 = v159.z; - var v1220; - var v12X20; - var v12Y20; - var v12Z20; - v12X20 = v2X20 - v1X20; - v12Y20 = v2Y20 - v1Y20; - v12Z20 = v2Z20 - v1Z20; - var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; - var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / d33; - var b16; - if(t14 < 0) { - var v160 = closest; - v160.x = v1X20; - v160.y = v1Y20; - v160.z = v1Z20; - b16 = 1; - } else if(t14 > 1) { - var v161 = closest; - v161.x = v2X20; - v161.y = v2Y20; - v161.z = v2Z20; - b16 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p14; - var pX14; - var pY14; - var pZ14; - pX14 = v1X20 + v12X20 * t14; - pY14 = v1Y20 + v12Y20 * t14; - pZ14 = v1Z20 + v12Z20 * t14; - var v162 = closest; - v162.x = pX14; - v162.y = pY14; - v162.z = pZ14; - b16 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d34 < mind5) { - mini5 = b16 << 1; - mind5 = d34; - var v163 = closest; - minvX5 = v163.x; - minvY5 = v163.y; - minvZ5 = v163.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d314 < 0) { - var v164; - var v1X21; - var v1Y21; - var v1Z21; - var v227; - var v2X21; - var v2Y21; - var v2Z21; - var v165 = vec21; - v1X21 = v165.x; - v1Y21 = v165.y; - v1Z21 = v165.z; - var v166 = vec4; - v2X21 = v166.x; - v2Y21 = v166.y; - v2Z21 = v166.z; - var v1221; - var v12X21; - var v12Y21; - var v12Z21; - v12X21 = v2X21 - v1X21; - v12Y21 = v2Y21 - v1Y21; - v12Z21 = v2Z21 - v1Z21; - var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; - var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / d35; - var b17; - if(t15 < 0) { - var v167 = closest; - v167.x = v1X21; - v167.y = v1Y21; - v167.z = v1Z21; - b17 = 1; - } else if(t15 > 1) { - var v168 = closest; - v168.x = v2X21; - v168.y = v2Y21; - v168.z = v2Z21; - b17 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p15; - var pX15; - var pY15; - var pZ15; - pX15 = v1X21 + v12X21 * t15; - pY15 = v1Y21 + v12Y21 * t15; - pZ15 = v1Z21 + v12Z21 * t15; - var v169 = closest; - v169.x = pX15; - v169.y = pY15; - v169.z = pZ15; - b17 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d36 < mind5) { - mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d36; - var v170 = closest; - minvX5 = v170.x; - minvY5 = v170.y; - minvZ5 = v170.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b18; - if(mind5 > 0) { - var v171 = closest; - v171.x = minvX5; - v171.y = minvY5; - v171.z = minvZ5; - b18 = mini5; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX5 *= l5; - nY5 *= l5; - nZ5 *= l5; - var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; - var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - l24 = dn4 / l24; - minvX5 = nX5 * l24; - minvY5 = nY5 * l24; - minvZ5 = nZ5 * l24; - var v172 = closest; - v172.x = minvX5; - v172.y = minvY5; - v172.z = minvZ5; - b18 = 7; - } - var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d37 < mind1) { - mini1 = b18 << 1; - mind1 = d37; - var v173 = closest; - minvX1 = v173.x; - minvY1 = v173.y; - minvZ1 = v173.z; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } if(mind1 > 0) { - var v174 = closest; - v174.x = minvX1; - v174.y = minvY1; - v174.z = minvZ1; - v3 = mini1; + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v = mini1; } else { closest.zero(); - v3 = 15; + v = 15; } break; } - if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(!useEpa) { this.distance = 0; return 0; @@ -10093,7 +9077,7 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp break; } if(this.simplexSize == 4) { - var epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); + let epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); if(epaState != 0) { this.distance = 0; return epaState; @@ -10104,39 +9088,29 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp this.distance = 0; return 1; } - this.shrinkSimplex(v3); + this.shrinkSimplex(v); dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; - var _this2 = dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; - var v175 = this.w1[this.simplexSize]; - _this3.x = v175.x; - _this3.y = v175.y; - _this3.z = v175.z; - var _this4 = _this3; - var v176 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v176.x; - var ty2 = _this4.y - v176.y; - var tz2 = _this4.z - v176.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; - if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var d110 = closest.x * dir.x + closest.y * dir.y + closest.z * dir.z; - var _this5 = s[this.simplexSize]; - var d210 = _this5.x * dir.x + _this5.y * dir.y + _this5.z * dir.z; - if(d210 - d110 < eps2) { + let _this1 = s[this.simplexSize]; + if(_this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { this.interpolateClosestPoints(); this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); if(cache != null && cache._gjkCache != null) { @@ -10154,22 +9128,18 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp this.c2 = c2; this.tf1 = tf1; this.tf2 = tf2; - var s = this.s; - var w1 = this.w1; - var w2 = this.w2; - var closest = this.closest; - var dir = this.dir; - var firstDir; - var firstDirX; - var firstDirY; - var firstDirZ; + let s = this.s; + let closest = this.closest; + let dir = this.dir; + let firstDirX; + let firstDirY; + let firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; - var v = dir; - v.x = firstDirX; - v.y = firstDirY; - v.z = firstDirZ; + dir.x = firstDirX; + dir.y = firstDirY; + dir.z = firstDirZ; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-6) { dir.init(1,0,0); } @@ -10177,148 +9147,120 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v1 = this.w1[this.simplexSize]; - v1.x = this.tf1._positionX; - v1.y = this.tf1._positionY; - v1.z = this.tf1._positionZ; + let v = this.w1[this.simplexSize]; + v.x = this.tf1._positionX; + v.y = this.tf1._positionY; + v.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this = this.s[this.simplexSize]; - var v2 = this.w1[this.simplexSize]; - _this.x = v2.x; - _this.y = v2.y; - _this.z = v2.z; - var _this1 = _this; - var v3 = this.w2[this.simplexSize]; - var tx = _this1.x - v3.x; - var ty = _this1.y - v3.y; - var tz = _this1.z - v3.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + let _this = this.s[this.simplexSize]; + let v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let v1 = this.w2[this.simplexSize]; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; this.simplexSize = 1; - var count = 0; - var max = 40; - var lambda = 0.0; - var rayX = this.rayX; - var rayR = this.rayR; + let count = 0; + let lambda = 0.0; + let rayX = this.rayX; + let rayR = this.rayR; rayX.zero(); rayR.x = tl2.x; rayR.y = tl2.y; rayR.z = tl2.z; - var _this2 = rayR; - var tx1 = _this2.x - tl1.x; - var ty1 = _this2.y - tl1.y; - var tz1 = _this2.z - tl1.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; - var eps = 1e-4; - var eps2 = eps * eps; - while(count < max) { - var v4 = 0; + rayR.x -= tl1.x; + rayR.y -= tl1.y; + rayR.z -= tl1.z; + while(count < 40) { + let v = 0; switch(this.simplexSize) { case 1: - var v5 = s[0]; - closest.x = v5.x; - closest.y = v5.y; - closest.z = v5.z; - v4 = 1; + let v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: - var v11; - var v1X; - var v1Y; - var v1Z; - var v21; - var v2X; - var v2Y; - var v2Z; - var v6 = s[0]; - v1X = v6.x; - v1Y = v6.y; - v1Z = v6.z; - var v7 = s[1]; - v2X = v7.x; - v2Y = v7.y; - v2Z = v7.z; - var v12; - var v12X; - var v12Y; - var v12Z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + let v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; + let v12X; + let v12Y; + let v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v8 = closest; - v8.x = v1X; - v8.y = v1Y; - v8.z = v1Z; - v4 = 1; + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + v = 1; } else if(t > 1) { - var v9 = closest; - v9.x = v2X; - v9.y = v2Y; - v9.z = v2Z; - v4 = 2; + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + v = 2; } else { - var p; - var pX; - var pY; - var pZ; + let pX; + let pY; + let pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v10 = closest; - v10.x = pX; - v10.y = pY; - v10.z = pZ; - v4 = 3; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + v = 3; } break; case 3: - var vec1 = s[0]; - var vec2 = s[1]; - var vec3 = s[2]; - var v13; - var v1X1; - var v1Y1; - var v1Z1; - var v22; - var v2X1; - var v2Y1; - var v2Z1; - var v31; - var v3X; - var v3Y; - var v3Z; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - var v23; - var v23X; - var v23Y; - var v23Z; - var v311; - var v31X; - var v31Y; - var v31Z; - var v14 = vec1; - v1X1 = v14.x; - v1Y1 = v14.y; - v1Z1 = v14.z; - var v15 = vec2; - v2X1 = v15.x; - v2Y1 = v15.y; - v2Z1 = v15.z; - var v16 = vec3; - v3X = v16.x; - v3Y = v16.y; - v3Z = v16.z; + let vec1 = s[0]; + let vec2 = s[1]; + let vec3 = s[2]; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X; + let v3Y; + let v3Z; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X1 = v2X1 - v1X1; v12Y1 = v2Y1 - v1Y1; v12Z1 = v2Z1 - v1Z1; @@ -10328,25 +9270,21 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var n; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12; - var n12X; - var n12Y; - var n12Z; - var n23; - var n23X; - var n23Y; - var n23Z; - var n31; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -10356,1743 +9294,1419 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; - var mind = -1; - var minv; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v17; - var v1X2; - var v1Y2; - var v1Z2; - var v24; - var v2X2; - var v2Y2; - var v2Z2; - var v18 = vec1; - v1X2 = v18.x; - v1Y2 = v18.y; - v1Z2 = v18.z; - var v19 = vec2; - v2X2 = v19.x; - v2Y2 = v19.y; - v2Z2 = v19.z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var d1 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d1; - var b; - if(t1 < 0) { - var v20 = closest; - v20.x = v1X2; - v20.y = v1Y2; - v20.z = v1Z2; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; b = 1; - } else if(t1 > 1) { - var v25 = closest; - v25.x = v2X2; - v25.y = v2Y2; - v25.z = v2Z2; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; b = 2; } else { - var p1; - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - var v26 = closest; - v26.x = pX1; - v26.y = pY1; - v26.z = pZ1; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; mini = b; - mind = d2; - var v27 = closest; - minvX = v27.x; - minvY = v27.y; - minvZ = v27.z; - } - if(d23 < 0) { - var v110; - var v1X3; - var v1Y3; - var v1Z3; - var v28; - var v2X3; - var v2Y3; - var v2Z3; - var v29 = vec2; - v1X3 = v29.x; - v1Y3 = v29.y; - v1Z3 = v29.z; - var v30 = vec3; - v2X3 = v30.x; - v2Y3 = v30.y; - v2Z3 = v30.z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var d3 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d3; - var b1; - if(t2 < 0) { - var v32 = closest; - v32.x = v1X3; - v32.y = v1Y3; - v32.z = v1Z3; - b1 = 1; - } else if(t2 > 1) { - var v33 = closest; - v33.x = v2X3; - v33.y = v2Y3; - v33.z = v2Z3; - b1 = 2; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p2; - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - var v34 = closest; - v34.x = pX2; - v34.y = pY2; - v34.z = pZ2; - b1 = 3; - } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d4 < mind) { - mini = b1 << 1; - mind = d4; - var v35 = closest; - minvX = v35.x; - minvY = v35.y; - minvZ = v35.z; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - } - if(d31 < 0) { - var v111; - var v1X4; - var v1Y4; - var v1Z4; - var v210; - var v2X4; - var v2Y4; - var v2Z4; - var v36 = vec1; - v1X4 = v36.x; - v1Y4 = v36.y; - v1Z4 = v36.z; - var v37 = vec3; - v2X4 = v37.x; - v2Y4 = v37.y; - v2Z4 = v37.z; - var v124; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var d5 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; - var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / d5; - var b2; - if(t3 < 0) { - var v38 = closest; - v38.x = v1X4; - v38.y = v1Y4; - v38.z = v1Z4; - b2 = 1; - } else if(t3 > 1) { - var v39 = closest; - v39.x = v2X4; - v39.y = v2Y4; - v39.z = v2Z4; - b2 = 2; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p3; - var pX3; - var pY3; - var pZ3; - pX3 = v1X4 + v12X4 * t3; - pY3 = v1Y4 + v12Y4 * t3; - pZ3 = v1Z4 + v12Z4 * t3; - var v40 = closest; - v40.x = pX3; - v40.y = pY3; - v40.z = pZ3; - b2 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d6 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d6; - var v41 = closest; - minvX = v41.x; - minvY = v41.y; - minvZ = v41.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } if(mind > 0) { - var v42 = closest; - v42.x = minvX; - v42.y = minvY; - v42.z = minvZ; - v4 = mini; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v = mini; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var dn = v1X1 * nX + v1Y1 * nY + v1Z1 * nZ; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v43 = closest; - v43.x = minvX; - v43.y = minvY; - v43.z = minvZ; - v4 = 7; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + v = 7; } break; case 4: - var vec11 = s[0]; - var vec21 = s[1]; - var vec31 = s[2]; - var vec4 = s[3]; - var v112; - var v1X5; - var v1Y5; - var v1Z5; - var v211; - var v2X5; - var v2Y5; - var v2Z5; - var v310; - var v3X1; - var v3Y1; - var v3Z1; - var v44; - var v4X; - var v4Y; - var v4Z; - var v125; - var v12X5; - var v12Y5; - var v12Z5; - var v131; - var v13X; - var v13Y; - var v13Z; - var v141; - var v14X; - var v14Y; - var v14Z; - var v231; - var v23X1; - var v23Y1; - var v23Z1; - var v241; - var v24X; - var v24Y; - var v24Z; - var v341; - var v34X; - var v34Y; - var v34Z; - var v45 = vec11; - v1X5 = v45.x; - v1Y5 = v45.y; - v1Z5 = v45.z; - var v46 = vec21; - v2X5 = v46.x; - v2Y5 = v46.y; - v2Z5 = v46.z; - var v47 = vec31; - v3X1 = v47.x; - v3Y1 = v47.y; - v3Z1 = v47.z; - var v48 = vec4; - v4X = v48.x; - v4Y = v48.y; - v4Z = v48.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v13X = v3X1 - v1X5; - v13Y = v3Y1 - v1Y5; - v13Z = v3Z1 - v1Z5; - v14X = v4X - v1X5; - v14Y = v4Y - v1Y5; - v14Z = v4Z - v1Z5; - v23X1 = v3X1 - v2X5; - v23Y1 = v3Y1 - v2Y5; - v23Z1 = v3Z1 - v2Z5; - v24X = v4X - v2X5; - v24Y = v4Y - v2Y5; - v24Z = v4Z - v2Z5; - v34X = v4X - v3X1; - v34Y = v4Y - v3Y1; - v34Z = v4Z - v3Z1; - var rev; - var n123; - var n123X; - var n123Y; - var n123Z; - var n134; - var n134X; - var n134Y; - var n134Z; - var n142; - var n142X; - var n142Y; - var n142Z; - var n243; - var n243X; - var n243Y; - var n243Z; - var n1; - var nX1; - var nY1; - var nZ1; - n123X = v12Y5 * v13Z - v12Z5 * v13Y; - n123Y = v12Z5 * v13X - v12X5 * v13Z; - n123Z = v12X5 * v13Y - v12Y5 * v13X; + let vec11 = s[0]; + let vec21 = s[1]; + let vec31 = s[2]; + let vec4 = s[3]; + let v1X2; + let v1Y2; + let v1Z2; + let v2X2; + let v2Y2; + let v2Z2; + let v3X1; + let v3Y1; + let v3Z1; + let v4X; + let v4Y; + let v4Z; + let v12X2; + let v12Y2; + let v12Z2; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X1; + let v23Y1; + let v23Z1; + let v24X; + let v24Y; + let v24Z; + v1X2 = vec11.x; + v1Y2 = vec11.y; + v1Z2 = vec11.z; + v2X2 = vec21.x; + v2Y2 = vec21.y; + v2Z2 = vec21.z; + v3X1 = vec31.x; + v3Y1 = vec31.y; + v3Z1 = vec31.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + v13X = v3X1 - v1X2; + v13Y = v3Y1 - v1Y2; + v13Z = v3Z1 - v1Z2; + v14X = v4X - v1X2; + v14Y = v4Y - v1Y2; + v14Z = v4Z - v1Z2; + v23X1 = v3X1 - v2X2; + v23Y1 = v3Y1 - v2Y2; + v23Z1 = v3Z1 - v2Z2; + v24X = v4X - v2X2; + v24Y = v4Y - v2Y2; + v24Z = v4Z - v2Z2; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; + n123X = v12Y2 * v13Z - v12Z2 * v13Y; + n123Y = v12Z2 * v13X - v12X2 * v13Z; + n123Z = v12X2 * v13Y - v12Y2 * v13X; n134X = v13Y * v14Z - v13Z * v14Y; n134Y = v13Z * v14X - v13X * v14Z; n134Z = v13X * v14Y - v13Y * v14X; - n142X = v14Y * v12Z5 - v14Z * v12Y5; - n142Y = v14Z * v12X5 - v14X * v12Z5; - n142Z = v14X * v12Y5 - v14Y * v12X5; + n142X = v14Y * v12Z2 - v14Z * v12Y2; + n142Y = v14Z * v12X2 - v14X * v12Z2; + n142Z = v14X * v12Y2 - v14Y * v12X2; n243X = v24Y * v23Z1 - v24Z * v23Y1; n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; - var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var d123 = v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z; - var d134 = v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z; - var d142 = v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z; - var d243 = v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z; - var mind1 = -1; - var minv1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; + let sign = v12X2 * n243X + v12Y2 * n243Y + v12Z2 * n243Z > 0 ? 1 : -1; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d123 * sign < 0) { - var v113; - var v1X6; - var v1Y6; - var v1Z6; - var v212; - var v2X6; - var v2Y6; - var v2Z6; - var v312; - var v3X2; - var v3Y2; - var v3Z2; - var v126; - var v12X6; - var v12Y6; - var v12Z6; - var v232; - var v23X2; - var v23Y2; - var v23Z2; - var v313; - var v31X1; - var v31Y1; - var v31Z1; - var v49 = vec11; - v1X6 = v49.x; - v1Y6 = v49.y; - v1Z6 = v49.z; - var v50 = vec21; - v2X6 = v50.x; - v2Y6 = v50.y; - v2Z6 = v50.z; - var v51 = vec31; - v3X2 = v51.x; - v3Y2 = v51.y; - v3Z2 = v51.z; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - v23X2 = v3X2 - v2X6; - v23Y2 = v3Y2 - v2Y6; - v23Z2 = v3Z2 - v2Z6; - v31X1 = v1X6 - v3X2; - v31Y1 = v1Y6 - v3Y2; - v31Z1 = v1Z6 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY2 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ2 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n121; - var n12X1; - var n12Y1; - var n12Z1; - var n231; - var n23X1; - var n23Y1; - var n23Z1; - var n311; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y6 * nZ2 - v12Z6 * nY2; - n12Y1 = v12Z6 * nX2 - v12X6 * nZ2; - n12Z1 = v12X6 * nY2 - v12Y6 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1; - var d231 = v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; - var mind2 = -1; - var minv2; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(d121 < 0) { - var v114; - var v1X7; - var v1Y7; - var v1Z7; - var v213; - var v2X7; - var v2Y7; - var v2Z7; - var v52 = vec11; - v1X7 = v52.x; - v1Y7 = v52.y; - v1Z7 = v52.z; - var v53 = vec21; - v2X7 = v53.x; - v2Y7 = v53.y; - v2Z7 = v53.z; - var v127; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var d7 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d7; - var b3; - if(t4 < 0) { - var v54 = closest; - v54.x = v1X7; - v54.y = v1Y7; - v54.z = v1Z7; - b3 = 1; - } else if(t4 > 1) { - var v55 = closest; - v55.x = v2X7; - v55.y = v2Y7; - v55.z = v2Z7; - b3 = 2; + if((v1X2 * n123X + v1Y2 * n123Y + v1Z2 * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec31.x; + v3Y = vec31.y; + v3Z = vec31.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p4; - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - var v56 = closest; - v56.x = pX4; - v56.y = pY4; - v56.z = pZ4; - b3 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini2 = b3; - mind2 = d8; - var v57 = closest; - minvX2 = v57.x; - minvY2 = v57.y; - minvZ2 = v57.z; - } - if(d231 < 0) { - var v115; - var v1X8; - var v1Y8; - var v1Z8; - var v214; - var v2X8; - var v2Y8; - var v2Z8; - var v58 = vec21; - v1X8 = v58.x; - v1Y8 = v58.y; - v1Z8 = v58.z; - var v59 = vec31; - v2X8 = v59.x; - v2Y8 = v59.y; - v2Z8 = v59.z; - var v128; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var d9 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d9; - var b4; - if(t5 < 0) { - var v60 = closest; - v60.x = v1X8; - v60.y = v1Y8; - v60.z = v1Z8; - b4 = 1; - } else if(t5 > 1) { - var v61 = closest; - v61.x = v2X8; - v61.y = v2Y8; - v61.z = v2Z8; - b4 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p5; - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - var v62 = closest; - v62.x = pX5; - v62.y = pY5; - v62.z = pZ5; - b4 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d10 < mind2) { - mini2 = b4 << 1; - mind2 = d10; - var v63 = closest; - minvX2 = v63.x; - minvY2 = v63.y; - minvZ2 = v63.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d311 < 0) { - var v116; - var v1X9; - var v1Y9; - var v1Z9; - var v215; - var v2X9; - var v2Y9; - var v2Z9; - var v64 = vec11; - v1X9 = v64.x; - v1Y9 = v64.y; - v1Z9 = v64.z; - var v65 = vec31; - v2X9 = v65.x; - v2Y9 = v65.y; - v2Z9 = v65.z; - var v129; - var v12X9; - var v12Y9; - var v12Z9; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - var d11 = v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9; - var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / d11; - var b5; - if(t6 < 0) { - var v66 = closest; - v66.x = v1X9; - v66.y = v1Y9; - v66.z = v1Z9; - b5 = 1; - } else if(t6 > 1) { - var v67 = closest; - v67.x = v2X9; - v67.y = v2Y9; - v67.z = v2Z9; - b5 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p6; - var pX6; - var pY6; - var pZ6; - pX6 = v1X9 + v12X9 * t6; - pY6 = v1Y9 + v12Y9 * t6; - pZ6 = v1Z9 + v12Z9 * t6; - var v68 = closest; - v68.x = pX6; - v68.y = pY6; - v68.z = pZ6; - b5 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d13 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d13 < mind2) { - mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d13; - var v69 = closest; - minvX2 = v69.x; - minvY2 = v69.y; - minvZ2 = v69.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b6; - if(mind2 > 0) { - var v70 = closest; - v70.x = minvX2; - v70.y = minvY2; - v70.z = minvZ2; - b6 = mini2; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X6 * nX2 + v1Y6 * nY2 + v1Z6 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v71 = closest; - v71.x = minvX2; - v71.y = minvY2; - v71.z = minvZ2; - b6 = 7; - } - var d14 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini1 = b6; - mind1 = d14; - var v72 = closest; - minvX1 = v72.x; - minvY1 = v72.y; - minvZ1 = v72.z; - } - if(d134 * sign < 0) { - var v117; - var v1X10; - var v1Y10; - var v1Z10; - var v216; - var v2X10; - var v2Y10; - var v2Z10; - var v314; - var v3X3; - var v3Y3; - var v3Z3; - var v1210; - var v12X10; - var v12Y10; - var v12Z10; - var v233; - var v23X3; - var v23Y3; - var v23Z3; - var v315; - var v31X2; - var v31Y2; - var v31Z2; - var v73 = vec11; - v1X10 = v73.x; - v1Y10 = v73.y; - v1Z10 = v73.z; - var v74 = vec31; - v2X10 = v74.x; - v2Y10 = v74.y; - v2Z10 = v74.z; - var v75 = vec4; - v3X3 = v75.x; - v3Y3 = v75.y; - v3Z3 = v75.z; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - v23X3 = v3X3 - v2X10; - v23Y3 = v3Y3 - v2Y10; - v23Z3 = v3Z3 - v2Z10; - v31X2 = v1X10 - v3X3; - v31Y2 = v1Y10 - v3Y3; - v31Z2 = v1Z10 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY3 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ3 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n122; - var n12X2; - var n12Y2; - var n12Z2; - var n232; - var n23X2; - var n23Y2; - var n23Z2; - var n312; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y10 * nZ3 - v12Z10 * nY3; - n12Y2 = v12Z10 * nX3 - v12X10 * nZ3; - n12Z2 = v12X10 * nY3 - v12Y10 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2; - var d232 = v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; - var mind3 = -1; - var minv3; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(d122 < 0) { - var v118; - var v1X11; - var v1Y11; - var v1Z11; - var v217; - var v2X11; - var v2Y11; - var v2Z11; - var v76 = vec11; - v1X11 = v76.x; - v1Y11 = v76.y; - v1Z11 = v76.z; - var v77 = vec31; - v2X11 = v77.x; - v2Y11 = v77.y; - v2Z11 = v77.z; - var v1211; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var d15 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d15; - var b7; - if(t7 < 0) { - var v78 = closest; - v78.x = v1X11; - v78.y = v1Y11; - v78.z = v1Z11; - b7 = 1; - } else if(t7 > 1) { - var v79 = closest; - v79.x = v2X11; - v79.y = v2Y11; - v79.z = v2Z11; - b7 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + mini1 = b; + mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + if((v1X2 * n134X + v1Y2 * n134Y + v1Z2 * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p7; - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - var v80 = closest; - v80.x = pX7; - v80.y = pY7; - v80.z = pZ7; - b7 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d16 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini3 = b7; - mind3 = d16; - var v81 = closest; - minvX3 = v81.x; - minvY3 = v81.y; - minvZ3 = v81.z; - } - if(d232 < 0) { - var v119; - var v1X12; - var v1Y12; - var v1Z12; - var v218; - var v2X12; - var v2Y12; - var v2Z12; - var v82 = vec31; - v1X12 = v82.x; - v1Y12 = v82.y; - v1Z12 = v82.z; - var v83 = vec4; - v2X12 = v83.x; - v2Y12 = v83.y; - v2Z12 = v83.z; - var v1212; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var d17 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d17; - var b8; - if(t8 < 0) { - var v84 = closest; - v84.x = v1X12; - v84.y = v1Y12; - v84.z = v1Z12; - b8 = 1; - } else if(t8 > 1) { - var v85 = closest; - v85.x = v2X12; - v85.y = v2Y12; - v85.z = v2Z12; - b8 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p8; - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - var v86 = closest; - v86.x = pX8; - v86.y = pY8; - v86.z = pZ8; - b8 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d18 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d18 < mind3) { - mini3 = b8 << 1; - mind3 = d18; - var v87 = closest; - minvX3 = v87.x; - minvY3 = v87.y; - minvZ3 = v87.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d312 < 0) { - var v120; - var v1X13; - var v1Y13; - var v1Z13; - var v219; - var v2X13; - var v2Y13; - var v2Z13; - var v88 = vec11; - v1X13 = v88.x; - v1Y13 = v88.y; - v1Z13 = v88.z; - var v89 = vec4; - v2X13 = v89.x; - v2Y13 = v89.y; - v2Z13 = v89.z; - var v1213; - var v12X13; - var v12Y13; - var v12Z13; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - var d19 = v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13; - var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / d19; - var b9; - if(t9 < 0) { - var v90 = closest; - v90.x = v1X13; - v90.y = v1Y13; - v90.z = v1Z13; - b9 = 1; - } else if(t9 > 1) { - var v91 = closest; - v91.x = v2X13; - v91.y = v2Y13; - v91.z = v2Z13; - b9 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p9; - var pX9; - var pY9; - var pZ9; - pX9 = v1X13 + v12X13 * t9; - pY9 = v1Y13 + v12Y13 * t9; - pZ9 = v1Z13 + v12Z13 * t9; - var v92 = closest; - v92.x = pX9; - v92.y = pY9; - v92.z = pZ9; - b9 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d20 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d20 < mind3) { - mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d20; - var v93 = closest; - minvX3 = v93.x; - minvY3 = v93.y; - minvZ3 = v93.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b10; - if(mind3 > 0) { - var v94 = closest; - v94.x = minvX3; - v94.y = minvY3; - v94.z = minvZ3; - b10 = mini3; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X10 * nX3 + v1Y10 * nY3 + v1Z10 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v95 = closest; - v95.x = minvX3; - v95.y = minvY3; - v95.z = minvZ3; - b10 = 7; - } - var d21 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d21 < mind1) { - mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d21; - var v96 = closest; - minvX1 = v96.x; - minvY1 = v96.y; - minvZ1 = v96.z; - } - } - if(d142 * sign < 0) { - var v130; - var v1X14; - var v1Y14; - var v1Z14; - var v220; - var v2X14; - var v2Y14; - var v2Z14; - var v316; - var v3X4; - var v3Y4; - var v3Z4; - var v1214; - var v12X14; - var v12Y14; - var v12Z14; - var v234; - var v23X4; - var v23Y4; - var v23Z4; - var v317; - var v31X3; - var v31Y3; - var v31Z3; - var v97 = vec11; - v1X14 = v97.x; - v1Y14 = v97.y; - v1Z14 = v97.z; - var v98 = vec21; - v2X14 = v98.x; - v2Y14 = v98.y; - v2Z14 = v98.z; - var v99 = vec4; - v3X4 = v99.x; - v3Y4 = v99.y; - v3Z4 = v99.z; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - v23X4 = v3X4 - v2X14; - v23Y4 = v3Y4 - v2Y14; - v23Z4 = v3Z4 - v2Z14; - v31X3 = v1X14 - v3X4; - v31Y3 = v1Y14 - v3Y4; - v31Z3 = v1Z14 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY4 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ4 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n124; - var n12X3; - var n12Y3; - var n12Z3; - var n233; - var n23X3; - var n23Y3; - var n23Z3; - var n313; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y14 * nZ4 - v12Z14 * nY4; - n12Y3 = v12Z14 * nX4 - v12X14 * nZ4; - n12Z3 = v12X14 * nY4 - v12Y14 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3; - var d233 = v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; - var mind4 = -1; - var minv4; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(d124 < 0) { - var v132; - var v1X15; - var v1Y15; - var v1Z15; - var v221; - var v2X15; - var v2Y15; - var v2Z15; - var v100 = vec11; - v1X15 = v100.x; - v1Y15 = v100.y; - v1Z15 = v100.z; - var v101 = vec21; - v2X15 = v101.x; - v2Y15 = v101.y; - v2Z15 = v101.z; - var v1215; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var d22 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d22; - var b11; - if(t10 < 0) { - var v102 = closest; - v102.x = v1X15; - v102.y = v1Y15; - v102.z = v1Z15; - b11 = 1; - } else if(t10 > 1) { - var v103 = closest; - v103.x = v2X15; - v103.y = v2Y15; - v103.z = v2Z15; - b11 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 6) << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v1X2 * n142X + v1Y2 * n142Y + v1Z2 * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p10; - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - var v104 = closest; - v104.x = pX10; - v104.y = pY10; - v104.z = pZ10; - b11 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d24 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini4 = b11; - mind4 = d24; - var v105 = closest; - minvX4 = v105.x; - minvY4 = v105.y; - minvZ4 = v105.z; - } - if(d233 < 0) { - var v133; - var v1X16; - var v1Y16; - var v1Z16; - var v222; - var v2X16; - var v2Y16; - var v2Z16; - var v106 = vec21; - v1X16 = v106.x; - v1Y16 = v106.y; - v1Z16 = v106.z; - var v107 = vec4; - v2X16 = v107.x; - v2Y16 = v107.y; - v2Z16 = v107.z; - var v1216; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var d25 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d25; - var b12; - if(t11 < 0) { - var v108 = closest; - v108.x = v1X16; - v108.y = v1Y16; - v108.z = v1Z16; - b12 = 1; - } else if(t11 > 1) { - var v109 = closest; - v109.x = v2X16; - v109.y = v2Y16; - v109.z = v2Z16; - b12 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p11; - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - var v134 = closest; - v134.x = pX11; - v134.y = pY11; - v134.z = pZ11; - b12 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d26 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d26 < mind4) { - mini4 = b12 << 1; - mind4 = d26; - var v135 = closest; - minvX4 = v135.x; - minvY4 = v135.y; - minvZ4 = v135.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d313 < 0) { - var v136; - var v1X17; - var v1Y17; - var v1Z17; - var v223; - var v2X17; - var v2Y17; - var v2Z17; - var v137 = vec11; - v1X17 = v137.x; - v1Y17 = v137.y; - v1Z17 = v137.z; - var v138 = vec4; - v2X17 = v138.x; - v2Y17 = v138.y; - v2Z17 = v138.z; - var v1217; - var v12X17; - var v12Y17; - var v12Z17; - v12X17 = v2X17 - v1X17; - v12Y17 = v2Y17 - v1Y17; - v12Z17 = v2Z17 - v1Z17; - var d27 = v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17; - var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / d27; - var b13; - if(t12 < 0) { - var v139 = closest; - v139.x = v1X17; - v139.y = v1Y17; - v139.z = v1Z17; - b13 = 1; - } else if(t12 > 1) { - var v140 = closest; - v140.x = v2X17; - v140.y = v2Y17; - v140.z = v2Z17; - b13 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p12; - var pX12; - var pY12; - var pZ12; - pX12 = v1X17 + v12X17 * t12; - pY12 = v1Y17 + v12Y17 * t12; - pZ12 = v1Z17 + v12Z17 * t12; - var v142 = closest; - v142.x = pX12; - v142.y = pY12; - v142.z = pZ12; - b13 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d28 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d28 < mind4) { - mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d28; - var v143 = closest; - minvX4 = v143.x; - minvY4 = v143.y; - minvZ4 = v143.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b14; - if(mind4 > 0) { - var v144 = closest; - v144.x = minvX4; - v144.y = minvY4; - v144.z = minvZ4; - b14 = mini4; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X14 * nX4 + v1Y14 * nY4 + v1Z14 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v145 = closest; - v145.x = minvX4; - v145.y = minvY4; - v145.z = minvZ4; - b14 = 7; - } - var d29 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d29 < mind1) { - mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d29; - var v146 = closest; - minvX1 = v146.x; - minvY1 = v146.y; - minvZ1 = v146.z; - } - } - if(d243 * sign < 0) { - var v147; - var v1X18; - var v1Y18; - var v1Z18; - var v224; - var v2X18; - var v2Y18; - var v2Z18; - var v318; - var v3X5; - var v3Y5; - var v3Z5; - var v1218; - var v12X18; - var v12Y18; - var v12Z18; - var v235; - var v23X5; - var v23Y5; - var v23Z5; - var v319; - var v31X4; - var v31Y4; - var v31Z4; - var v148 = vec21; - v1X18 = v148.x; - v1Y18 = v148.y; - v1Z18 = v148.z; - var v149 = vec31; - v2X18 = v149.x; - v2Y18 = v149.y; - v2Z18 = v149.z; - var v150 = vec4; - v3X5 = v150.x; - v3Y5 = v150.y; - v3Z5 = v150.z; - v12X18 = v2X18 - v1X18; - v12Y18 = v2Y18 - v1Y18; - v12Z18 = v2Z18 - v1Z18; - v23X5 = v3X5 - v2X18; - v23Y5 = v3Y5 - v2Y18; - v23Z5 = v3Z5 - v2Z18; - v31X4 = v1X18 - v3X5; - v31Y4 = v1Y18 - v3Y5; - v31Z4 = v1Z18 - v3Z5; - var n5; - var nX5; - var nY5; - var nZ5; - nX5 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY5 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ5 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n125; - var n12X4; - var n12Y4; - var n12Z4; - var n234; - var n23X4; - var n23Y4; - var n23Z4; - var n314; - var n31X4; - var n31Y4; - var n31Z4; - n12X4 = v12Y18 * nZ5 - v12Z18 * nY5; - n12Y4 = v12Z18 * nX5 - v12X18 * nZ5; - n12Z4 = v12X18 * nY5 - v12Y18 * nX5; - n23X4 = v23Y5 * nZ5 - v23Z5 * nY5; - n23Y4 = v23Z5 * nX5 - v23X5 * nZ5; - n23Z4 = v23X5 * nY5 - v23Y5 * nX5; - n31X4 = v31Y4 * nZ5 - v31Z4 * nY5; - n31Y4 = v31Z4 * nX5 - v31X4 * nZ5; - n31Z4 = v31X4 * nY5 - v31Y4 * nX5; - var d125 = v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4; - var d234 = v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4; - var d314 = v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4; - var mind5 = -1; - var minv5; - var minvX5; - var minvY5; - var minvZ5; - var mini5 = 0; - minvX5 = 0; - minvY5 = 0; - minvZ5 = 0; - if(d125 < 0) { - var v151; - var v1X19; - var v1Y19; - var v1Z19; - var v225; - var v2X19; - var v2Y19; - var v2Z19; - var v152 = vec21; - v1X19 = v152.x; - v1Y19 = v152.y; - v1Z19 = v152.z; - var v153 = vec31; - v2X19 = v153.x; - v2Y19 = v153.y; - v2Z19 = v153.z; - var v1219; - var v12X19; - var v12Y19; - var v12Z19; - v12X19 = v2X19 - v1X19; - v12Y19 = v2Y19 - v1Y19; - v12Z19 = v2Z19 - v1Z19; - var d30 = v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19; - var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / d30; - var b15; - if(t13 < 0) { - var v154 = closest; - v154.x = v1X19; - v154.y = v1Y19; - v154.z = v1Z19; - b15 = 1; - } else if(t13 > 1) { - var v155 = closest; - v155.x = v2X19; - v155.y = v2Y19; - v155.z = v2Z19; - b15 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 3 | (b & 4) << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; + } + } + if((v2X2 * n243X + v2Y2 * n243Y + v2Z2 * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p13; - var pX13; - var pY13; - var pZ13; - pX13 = v1X19 + v12X19 * t13; - pY13 = v1Y19 + v12Y19 * t13; - pZ13 = v1Z19 + v12Z19 * t13; - var v156 = closest; - v156.x = pX13; - v156.y = pY13; - v156.z = pZ13; - b15 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d32 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - mini5 = b15; - mind5 = d32; - var v157 = closest; - minvX5 = v157.x; - minvY5 = v157.y; - minvZ5 = v157.z; - } - if(d234 < 0) { - var v158; - var v1X20; - var v1Y20; - var v1Z20; - var v226; - var v2X20; - var v2Y20; - var v2Z20; - var v159 = vec31; - v1X20 = v159.x; - v1Y20 = v159.y; - v1Z20 = v159.z; - var v160 = vec4; - v2X20 = v160.x; - v2Y20 = v160.y; - v2Z20 = v160.z; - var v1220; - var v12X20; - var v12Y20; - var v12Z20; - v12X20 = v2X20 - v1X20; - v12Y20 = v2Y20 - v1Y20; - v12Z20 = v2Z20 - v1Z20; - var d33 = v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20; - var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / d33; - var b16; - if(t14 < 0) { - var v161 = closest; - v161.x = v1X20; - v161.y = v1Y20; - v161.z = v1Z20; - b16 = 1; - } else if(t14 > 1) { - var v162 = closest; - v162.x = v2X20; - v162.y = v2Y20; - v162.z = v2Z20; - b16 = 2; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p14; - var pX14; - var pY14; - var pZ14; - pX14 = v1X20 + v12X20 * t14; - pY14 = v1Y20 + v12Y20 * t14; - pZ14 = v1Z20 + v12Z20 * t14; - var v163 = closest; - v163.x = pX14; - v163.y = pY14; - v163.z = pZ14; - b16 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d34 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d34 < mind5) { - mini5 = b16 << 1; - mind5 = d34; - var v164 = closest; - minvX5 = v164.x; - minvY5 = v164.y; - minvZ5 = v164.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(d314 < 0) { - var v165; - var v1X21; - var v1Y21; - var v1Z21; - var v227; - var v2X21; - var v2Y21; - var v2Z21; - var v166 = vec21; - v1X21 = v166.x; - v1Y21 = v166.y; - v1Z21 = v166.z; - var v167 = vec4; - v2X21 = v167.x; - v2Y21 = v167.y; - v2Z21 = v167.z; - var v1221; - var v12X21; - var v12Y21; - var v12Z21; - v12X21 = v2X21 - v1X21; - v12Y21 = v2Y21 - v1Y21; - v12Z21 = v2Z21 - v1Z21; - var d35 = v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21; - var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / d35; - var b17; - if(t15 < 0) { - var v168 = closest; - v168.x = v1X21; - v168.y = v1Y21; - v168.z = v1Z21; - b17 = 1; - } else if(t15 > 1) { - var v169 = closest; - v169.x = v2X21; - v169.y = v2Y21; - v169.z = v2Z21; - b17 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var p15; - var pX15; - var pY15; - var pZ15; - pX15 = v1X21 + v12X21 * t15; - pY15 = v1Y21 + v12Y21 * t15; - pZ15 = v1Z21 + v12Z21 * t15; - var v170 = closest; - v170.x = pX15; - v170.y = pY15; - v170.z = pZ15; - b17 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d36 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d36 < mind5) { - mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d36; - var v171 = closest; - minvX5 = v171.x; - minvY5 = v171.y; - minvZ5 = v171.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b18; - if(mind5 > 0) { - var v172 = closest; - v172.x = minvX5; - v172.y = minvY5; - v172.z = minvZ5; - b18 = mini5; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l5 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX5 *= l5; - nY5 *= l5; - nZ5 *= l5; - var dn4 = v1X18 * nX5 + v1Y18 * nY5 + v1Z18 * nZ5; - var l24 = nX5 * nX5 + nY5 * nY5 + nZ5 * nZ5; - l24 = dn4 / l24; - minvX5 = nX5 * l24; - minvY5 = nY5 * l24; - minvZ5 = nZ5 * l24; - var v173 = closest; - v173.x = minvX5; - v173.y = minvY5; - v173.z = minvZ5; - b18 = 7; - } - var d37 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d37 < mind1) { - mini1 = b18 << 1; - mind1 = d37; - var v174 = closest; - minvX1 = v174.x; - minvY1 = v174.y; - minvZ1 = v174.z; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; + } + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = closest.x; + minvY1 = closest.y; + minvZ1 = closest.z; } } if(mind1 > 0) { - var v175 = closest; - v175.x = minvX1; - v175.y = minvY1; - v175.z = minvZ1; - v4 = mini1; + closest.x = minvX1; + closest.y = minvY1; + closest.z = minvZ1; + v = mini1; } else { closest.zero(); - v4 = 15; + v = 15; } break; } - this.shrinkSimplex(v4); - if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < eps2) { + this.shrinkSimplex(v); + if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(lambda == 0 || this.simplexSize == 4) { hit.fraction = lambda; return false; } this.interpolateClosestPoints(); hit.fraction = lambda; - var _this3 = hit.normal; - _this3.x = dir.x; - _this3.y = dir.y; - _this3.z = dir.z; - var _this4 = _this3; - var invLen = Math.sqrt(_this4.x * _this4.x + _this4.y * _this4.y + _this4.z * _this4.z); + let _this = hit.normal; + _this.x = dir.x; + _this.y = dir.y; + _this.z = dir.z; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx2 = _this4.x * invLen; - var ty2 = _this4.y * invLen; - var tz2 = _this4.z * invLen; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; - var _this5 = hit.position; - var v176 = this.closestPoint1; - _this5.x = v176.x; - _this5.y = v176.y; - _this5.z = v176.z; - var _this6 = _this5; - var tx3 = _this6.x + tl1.x * lambda; - var ty3 = _this6.y + tl1.y * lambda; - var tz3 = _this6.z + tl1.z * lambda; - _this6.x = tx3; - _this6.y = ty3; - _this6.z = tz3; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + let _this1 = hit.position; + let v = this.closestPoint1; + _this1.x = v.x; + _this1.y = v.y; + _this1.z = v.z; + _this1.x += tl1.x * lambda; + _this1.y += tl1.y * lambda; + _this1.z += tl1.z * lambda; return true; } dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; - var _this7 = dir; - var tx4 = -_this7.x; - var ty4 = -_this7.y; - var tz4 = -_this7.z; - _this7.x = tx4; - _this7.y = ty4; - _this7.z = tz4; + dir.x = -dir.x; + dir.y = -dir.y; + dir.z = -dir.z; if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v177 = this.w1[this.simplexSize]; - v177.x = this.tf1._positionX; - v177.y = this.tf1._positionY; - v177.z = this.tf1._positionZ; + let v = this.w1[this.simplexSize]; + v.x = this.tf1._positionX; + v.y = this.tf1._positionY; + v.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this8 = this.s[this.simplexSize]; - var v178 = this.w1[this.simplexSize]; - _this8.x = v178.x; - _this8.y = v178.y; - _this8.z = v178.z; - var _this9 = _this8; - var v179 = this.w2[this.simplexSize]; - var tx5 = _this9.x - v179.x; - var ty5 = _this9.y - v179.y; - var tz5 = _this9.z - v179.z; - _this9.x = tx5; - _this9.y = ty5; - _this9.z = tz5; - var _this10 = s[this.simplexSize]; - var tx6 = _this10.x - rayX.x; - var ty6 = _this10.y - rayX.y; - var tz6 = _this10.z - rayX.z; - _this10.x = tx6; - _this10.y = ty6; - _this10.z = tz6; - if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < eps2) { + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; + let _this1 = s[this.simplexSize]; + _this1.x -= rayX.x; + _this1.y -= rayX.y; + _this1.z -= rayX.z; + if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var p16 = s[this.simplexSize]; - var n6 = dir; - var pn = p16.x * n6.x + p16.y * n6.y + p16.z * n6.z; + let p = s[this.simplexSize]; + let pn = p.x * dir.x + p.y * dir.y + p.z * dir.z; if(pn < 0) { - if(rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z >= 0) { + if(rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z >= 0) { return false; } - var dLambda = pn / (rayR.x * n6.x + rayR.y * n6.y + rayR.z * n6.z); + let dLambda = pn / (rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z); lambda += dLambda; if(lambda >= 1) { return false; } - var tx7 = rayX.x + rayR.x * dLambda; - var ty7 = rayX.y + rayR.y * dLambda; - var tz7 = rayX.z + rayR.z * dLambda; - rayX.x = tx7; - rayX.y = ty7; - rayX.z = tz7; - var _g1 = 0; - var _g2 = this.simplexSize + 1; - while(_g1 < _g2) { - var i = _g1++; - var _this11 = s[i]; - var s1 = -dLambda; - var tx8 = _this11.x + rayR.x * s1; - var ty8 = _this11.y + rayR.y * s1; - var tz8 = _this11.z + rayR.z * s1; - _this11.x = tx8; - _this11.y = ty8; - _this11.z = tz8; - } - } - var duplicate = false; - var _g11 = 0; - var _g21 = this.simplexSize; - while(_g11 < _g21) { - var i1 = _g11++; - var dx = s[i1].x - s[this.simplexSize].x; - var dy = s[i1].y - s[this.simplexSize].y; - var dz = s[i1].z - s[this.simplexSize].z; - if(dx * dx + dy * dy + dz * dz < eps2) { + rayX.x += rayR.x * dLambda; + rayX.y += rayR.y * dLambda; + rayX.z += rayR.z * dLambda; + let _g = 0; + let _g1 = this.simplexSize + 1; + while(_g < _g1) { + let _this = s[_g++]; + let s1 = -dLambda; + _this.x += rayR.x * s1; + _this.y += rayR.y * s1; + _this.z += rayR.z * s1; + } + } + let duplicate = false; + let _g = 0; + let _g1 = this.simplexSize; + while(_g < _g1) { + let i = _g++; + let dx = s[i].x - s[this.simplexSize].x; + let dy = s[i].y - s[this.simplexSize].y; + let dz = s[i].z - s[this.simplexSize].z; + if(dx * dx + dy * dy + dz * dz < 1e-008) { duplicate = true; break; } @@ -12107,129 +10721,93 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp interpolateClosestPoints() { switch(this.simplexSize) { case 1: - var _this = this.closestPoint1; - var v = this.w1[0]; + let _this = this.closestPoint1; + let v = this.w1[0]; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.closestPoint2; - var v1 = this.w2[0]; + let _this1 = this.closestPoint2; + let v1 = this.w2[0]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; break; case 2: - var c; - var cX; - var cY; - var cZ; - var v2 = this.closest; + let cX; + let cY; + let cZ; + let v2 = this.closest; cX = v2.x; cY = v2.y; cZ = v2.z; - var s0; - var s0X; - var s0Y; - var s0Z; - var w10; - var w10X; - var w10Y; - var w10Z; - var w20; - var w20X; - var w20Y; - var w20Z; - var s1; - var s1X; - var s1Y; - var s1Z; - var w11; - var w11X; - var w11Y; - var w11Z; - var w21; - var w21X; - var w21Y; - var w21Z; - var s2; - var s2X; - var s2Y; - var s2Z; - var w12; - var w12X; - var w12Y; - var w12Z; - var w22; - var w22X; - var w22Y; - var w22Z; - var v3 = this.s[0]; + let s0X; + let s0Y; + let s0Z; + let w10X; + let w10Y; + let w10Z; + let w20X; + let w20Y; + let w20Z; + let s1X; + let s1Y; + let s1Z; + let w11X; + let w11Y; + let w11Z; + let w21X; + let w21Y; + let w21Z; + let v3 = this.s[0]; s0X = v3.x; s0Y = v3.y; s0Z = v3.z; - var v4 = this.w1[0]; + let v4 = this.w1[0]; w10X = v4.x; w10Y = v4.y; w10Z = v4.z; - var v5 = this.w2[0]; + let v5 = this.w2[0]; w20X = v5.x; w20Y = v5.y; w20Z = v5.z; - var v6 = this.s[1]; + let v6 = this.s[1]; s1X = v6.x; s1Y = v6.y; s1Z = v6.z; - var v7 = this.w1[1]; + let v7 = this.w1[1]; w11X = v7.x; w11Y = v7.y; w11Z = v7.z; - var v8 = this.w2[1]; + let v8 = this.w2[1]; w21X = v8.x; w21Y = v8.y; w21Z = v8.z; - var v9 = this.s[2]; - s2X = v9.x; - s2Y = v9.y; - s2Z = v9.z; - var v10 = this.w1[2]; - w12X = v10.x; - w12Y = v10.y; - w12Z = v10.z; - var v11 = this.w2[2]; - w22X = v11.x; - w22Y = v11.y; - w22Z = v11.z; - var s01; - var s01X; - var s01Y; - var s01Z; + let s01X; + let s01Y; + let s01Z; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; - var invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + let invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; if(invDet != 0) { invDet = 1 / invDet; } - var s0c; - var s0cX; - var s0cY; - var s0cZ; + let s0cX; + let s0cY; + let s0cZ; s0cX = cX - s0X; s0cY = cY - s0Y; s0cZ = cZ - s0Z; - var t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; - var diff; - var diffX; - var diffY; - var diffZ; - var cp1; - var cp1X; - var cp1Y; - var cp1Z; - var cp2; - var cp2X; - var cp2Y; - var cp2Z; + let t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; + let diffX; + let diffY; + let diffZ; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; diffX = w11X - w10X; diffY = w11Y - w10Y; diffZ = w11Z - w10Z; @@ -12242,149 +10820,133 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp cp2X = w20X + diffX * t; cp2Y = w20Y + diffY * t; cp2Z = w20Z + diffZ * t; - var v12 = this.closestPoint1; - v12.x = cp1X; - v12.y = cp1Y; - v12.z = cp1Z; - var v13 = this.closestPoint2; - v13.x = cp2X; - v13.y = cp2Y; - v13.z = cp2Z; + let v9 = this.closestPoint1; + v9.x = cp1X; + v9.y = cp1Y; + v9.z = cp1Z; + let v10 = this.closestPoint2; + v10.x = cp2X; + v10.y = cp2Y; + v10.z = cp2Z; break; case 3: - var c1; - var cX1; - var cY1; - var cZ1; - var v14 = this.closest; - cX1 = v14.x; - cY1 = v14.y; - cZ1 = v14.z; - var s02; - var s0X1; - var s0Y1; - var s0Z1; - var w101; - var w10X1; - var w10Y1; - var w10Z1; - var w201; - var w20X1; - var w20Y1; - var w20Z1; - var s11; - var s1X1; - var s1Y1; - var s1Z1; - var w111; - var w11X1; - var w11Y1; - var w11Z1; - var w211; - var w21X1; - var w21Y1; - var w21Z1; - var s21; - var s2X1; - var s2Y1; - var s2Z1; - var w121; - var w12X1; - var w12Y1; - var w12Z1; - var w221; - var w22X1; - var w22Y1; - var w22Z1; - var v15 = this.s[0]; - s0X1 = v15.x; - s0Y1 = v15.y; - s0Z1 = v15.z; - var v16 = this.w1[0]; - w10X1 = v16.x; - w10Y1 = v16.y; - w10Z1 = v16.z; - var v17 = this.w2[0]; - w20X1 = v17.x; - w20Y1 = v17.y; - w20Z1 = v17.z; - var v18 = this.s[1]; - s1X1 = v18.x; - s1Y1 = v18.y; - s1Z1 = v18.z; - var v19 = this.w1[1]; - w11X1 = v19.x; - w11Y1 = v19.y; - w11Z1 = v19.z; - var v20 = this.w2[1]; - w21X1 = v20.x; - w21Y1 = v20.y; - w21Z1 = v20.z; - var v21 = this.s[2]; - s2X1 = v21.x; - s2Y1 = v21.y; - s2Z1 = v21.z; - var v22 = this.w1[2]; - w12X1 = v22.x; - w12Y1 = v22.y; - w12Z1 = v22.z; - var v23 = this.w2[2]; - w22X1 = v23.x; - w22Y1 = v23.y; - w22Z1 = v23.z; - var s011; - var s01X1; - var s01Y1; - var s01Z1; - var s021; - var s02X; - var s02Y; - var s02Z; - var s0c1; - var s0cX1; - var s0cY1; - var s0cZ1; + let cX1; + let cY1; + let cZ1; + let v11 = this.closest; + cX1 = v11.x; + cY1 = v11.y; + cZ1 = v11.z; + let s0X1; + let s0Y1; + let s0Z1; + let w10X1; + let w10Y1; + let w10Z1; + let w20X1; + let w20Y1; + let w20Z1; + let s1X1; + let s1Y1; + let s1Z1; + let w11X1; + let w11Y1; + let w11Z1; + let w21X1; + let w21Y1; + let w21Z1; + let s2X; + let s2Y; + let s2Z; + let w12X; + let w12Y; + let w12Z; + let w22X; + let w22Y; + let w22Z; + let v12 = this.s[0]; + s0X1 = v12.x; + s0Y1 = v12.y; + s0Z1 = v12.z; + let v13 = this.w1[0]; + w10X1 = v13.x; + w10Y1 = v13.y; + w10Z1 = v13.z; + let v14 = this.w2[0]; + w20X1 = v14.x; + w20Y1 = v14.y; + w20Z1 = v14.z; + let v15 = this.s[1]; + s1X1 = v15.x; + s1Y1 = v15.y; + s1Z1 = v15.z; + let v16 = this.w1[1]; + w11X1 = v16.x; + w11Y1 = v16.y; + w11Z1 = v16.z; + let v17 = this.w2[1]; + w21X1 = v17.x; + w21Y1 = v17.y; + w21Z1 = v17.z; + let v18 = this.s[2]; + s2X = v18.x; + s2Y = v18.y; + s2Z = v18.z; + let v19 = this.w1[2]; + w12X = v19.x; + w12Y = v19.y; + w12Z = v19.z; + let v20 = this.w2[2]; + w22X = v20.x; + w22Y = v20.y; + w22Z = v20.z; + let s01X1; + let s01Y1; + let s01Z1; + let s02X; + let s02Y; + let s02Z; + let s0cX1; + let s0cY1; + let s0cZ1; s01X1 = s1X1 - s0X1; s01Y1 = s1Y1 - s0Y1; s01Z1 = s1Z1 - s0Z1; - s02X = s2X1 - s0X1; - s02Y = s2Y1 - s0Y1; - s02Z = s2Z1 - s0Z1; + s02X = s2X - s0X1; + s02Y = s2Y - s0Y1; + s02Z = s2Z - s0Z1; s0cX1 = cX1 - s0X1; s0cY1 = cY1 - s0Y1; s0cZ1 = cZ1 - s0Z1; - var d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; - var d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; - var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; - var d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; - var d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; - var invDet1 = d11 * d22 - d12 * d12; + let d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; + let d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; + let d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + let d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; + let d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; + let invDet1 = d11 * d22 - d12 * d12; if(invDet1 != 0) { invDet1 = 1 / invDet1; } - var s = (d1c * d22 - d2c * d12) * invDet1; - var t1 = (-d1c * d12 + d2c * d11) * invDet1; - var diff1; - var diffX1; - var diffY1; - var diffZ1; - var cp11; - var cp1X1; - var cp1Y1; - var cp1Z1; - var cp21; - var cp2X1; - var cp2Y1; - var cp2Z1; + let s = (d1c * d22 - d2c * d12) * invDet1; + let t1 = (-d1c * d12 + d2c * d11) * invDet1; + let diffX1; + let diffY1; + let diffZ1; + let cp1X1; + let cp1Y1; + let cp1Z1; + let cp2X1; + let cp2Y1; + let cp2Z1; diffX1 = w11X1 - w10X1; diffY1 = w11Y1 - w10Y1; diffZ1 = w11Z1 - w10Z1; cp1X1 = w10X1 + diffX1 * s; cp1Y1 = w10Y1 + diffY1 * s; cp1Z1 = w10Z1 + diffZ1 * s; - diffX1 = w12X1 - w10X1; - diffY1 = w12Y1 - w10Y1; - diffZ1 = w12Z1 - w10Z1; + diffX1 = w12X - w10X1; + diffY1 = w12Y - w10Y1; + diffZ1 = w12Z - w10Z1; cp1X1 += diffX1 * t1; cp1Y1 += diffY1 * t1; cp1Z1 += diffZ1 * t1; @@ -12394,45 +10956,41 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp cp2X1 = w20X1 + diffX1 * s; cp2Y1 = w20Y1 + diffY1 * s; cp2Z1 = w20Z1 + diffZ1 * s; - diffX1 = w22X1 - w20X1; - diffY1 = w22Y1 - w20Y1; - diffZ1 = w22Z1 - w20Z1; + diffX1 = w22X - w20X1; + diffY1 = w22Y - w20Y1; + diffZ1 = w22Z - w20Z1; cp2X1 += diffX1 * t1; cp2Y1 += diffY1 * t1; cp2Z1 += diffZ1 * t1; - var v24 = this.closestPoint1; - v24.x = cp1X1; - v24.y = cp1Y1; - v24.z = cp1Z1; - var v25 = this.closestPoint2; - v25.x = cp2X1; - v25.y = cp2Y1; - v25.z = cp2Z1; + let v21 = this.closestPoint1; + v21.x = cp1X1; + v21.y = cp1Y1; + v21.z = cp1Z1; + let v22 = this.closestPoint2; + v22.x = cp2X1; + v22.y = cp2Y1; + v22.z = cp2Z1; break; default: throw new Error("!?"); } } loadCache(gjkCache) { - var _this = this.dir; - var v = gjkCache.prevClosestDir; + let _this = this.dir; + let v = gjkCache.prevClosestDir; _this.x = v.x; _this.y = v.y; _this.z = v.z; } saveCache(gjkCache) { - var _this = gjkCache.prevClosestDir; - var v = this.closest; + let _this = gjkCache.prevClosestDir; + let v = this.closest; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = _this; - var tx = -_this1.x; - var ty = -_this1.y; - var tz = -_this1.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + _this.x = -_this.x; + _this.y = -_this.y; + _this.z = -_this.z; } shrinkSimplex(vertexBits) { this.simplexSize = vertexBits; @@ -12440,203 +10998,203 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp this.simplexSize = (this.simplexSize & 3) + (this.simplexSize >> 2 & 3); switch(vertexBits) { case 2: - var _this = this.s[0]; - var v = this.s[1]; + let _this = this.s[0]; + let v = this.s[1]; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1[0]; - var v1 = this.w1[1]; + let _this1 = this.w1[0]; + let v1 = this.w1[1]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; - var _this2 = this.w2[0]; - var v2 = this.w2[1]; + let _this2 = this.w2[0]; + let v2 = this.w2[1]; _this2.x = v2.x; _this2.y = v2.y; _this2.z = v2.z; break; case 4: - var _this3 = this.s[0]; - var v3 = this.s[2]; + let _this3 = this.s[0]; + let v3 = this.s[2]; _this3.x = v3.x; _this3.y = v3.y; _this3.z = v3.z; - var _this4 = this.w1[0]; - var v4 = this.w1[2]; + let _this4 = this.w1[0]; + let v4 = this.w1[2]; _this4.x = v4.x; _this4.y = v4.y; _this4.z = v4.z; - var _this5 = this.w2[0]; - var v5 = this.w2[2]; + let _this5 = this.w2[0]; + let v5 = this.w2[2]; _this5.x = v5.x; _this5.y = v5.y; _this5.z = v5.z; break; case 5: - var _this6 = this.s[1]; - var v6 = this.s[2]; + let _this6 = this.s[1]; + let v6 = this.s[2]; _this6.x = v6.x; _this6.y = v6.y; _this6.z = v6.z; - var _this7 = this.w1[1]; - var v7 = this.w1[2]; + let _this7 = this.w1[1]; + let v7 = this.w1[2]; _this7.x = v7.x; _this7.y = v7.y; _this7.z = v7.z; - var _this8 = this.w2[1]; - var v8 = this.w2[2]; + let _this8 = this.w2[1]; + let v8 = this.w2[2]; _this8.x = v8.x; _this8.y = v8.y; _this8.z = v8.z; break; case 6: - var _this9 = this.s[0]; - var v9 = this.s[2]; + let _this9 = this.s[0]; + let v9 = this.s[2]; _this9.x = v9.x; _this9.y = v9.y; _this9.z = v9.z; - var _this10 = this.w1[0]; - var v10 = this.w1[2]; + let _this10 = this.w1[0]; + let v10 = this.w1[2]; _this10.x = v10.x; _this10.y = v10.y; _this10.z = v10.z; - var _this11 = this.w2[0]; - var v11 = this.w2[2]; + let _this11 = this.w2[0]; + let v11 = this.w2[2]; _this11.x = v11.x; _this11.y = v11.y; _this11.z = v11.z; break; case 8: - var _this12 = this.s[0]; - var v12 = this.s[3]; + let _this12 = this.s[0]; + let v12 = this.s[3]; _this12.x = v12.x; _this12.y = v12.y; _this12.z = v12.z; - var _this13 = this.w1[0]; - var v13 = this.w1[3]; + let _this13 = this.w1[0]; + let v13 = this.w1[3]; _this13.x = v13.x; _this13.y = v13.y; _this13.z = v13.z; - var _this14 = this.w2[0]; - var v14 = this.w2[3]; + let _this14 = this.w2[0]; + let v14 = this.w2[3]; _this14.x = v14.x; _this14.y = v14.y; _this14.z = v14.z; break; case 9: - var _this15 = this.s[1]; - var v15 = this.s[3]; + let _this15 = this.s[1]; + let v15 = this.s[3]; _this15.x = v15.x; _this15.y = v15.y; _this15.z = v15.z; - var _this16 = this.w1[1]; - var v16 = this.w1[3]; + let _this16 = this.w1[1]; + let v16 = this.w1[3]; _this16.x = v16.x; _this16.y = v16.y; _this16.z = v16.z; - var _this17 = this.w2[1]; - var v17 = this.w2[3]; + let _this17 = this.w2[1]; + let v17 = this.w2[3]; _this17.x = v17.x; _this17.y = v17.y; _this17.z = v17.z; break; case 10: - var _this18 = this.s[0]; - var v18 = this.s[3]; + let _this18 = this.s[0]; + let v18 = this.s[3]; _this18.x = v18.x; _this18.y = v18.y; _this18.z = v18.z; - var _this19 = this.w1[0]; - var v19 = this.w1[3]; + let _this19 = this.w1[0]; + let v19 = this.w1[3]; _this19.x = v19.x; _this19.y = v19.y; _this19.z = v19.z; - var _this20 = this.w2[0]; - var v20 = this.w2[3]; + let _this20 = this.w2[0]; + let v20 = this.w2[3]; _this20.x = v20.x; _this20.y = v20.y; _this20.z = v20.z; break; case 11: - var _this21 = this.s[2]; - var v21 = this.s[3]; + let _this21 = this.s[2]; + let v21 = this.s[3]; _this21.x = v21.x; _this21.y = v21.y; _this21.z = v21.z; - var _this22 = this.w1[2]; - var v22 = this.w1[3]; + let _this22 = this.w1[2]; + let v22 = this.w1[3]; _this22.x = v22.x; _this22.y = v22.y; _this22.z = v22.z; - var _this23 = this.w2[2]; - var v23 = this.w2[3]; + let _this23 = this.w2[2]; + let v23 = this.w2[3]; _this23.x = v23.x; _this23.y = v23.y; _this23.z = v23.z; break; case 12: - var _this24 = this.s[0]; - var v24 = this.s[2]; + let _this24 = this.s[0]; + let v24 = this.s[2]; _this24.x = v24.x; _this24.y = v24.y; _this24.z = v24.z; - var _this25 = this.w1[0]; - var v25 = this.w1[2]; + let _this25 = this.w1[0]; + let v25 = this.w1[2]; _this25.x = v25.x; _this25.y = v25.y; _this25.z = v25.z; - var _this26 = this.w2[0]; - var v26 = this.w2[2]; + let _this26 = this.w2[0]; + let v26 = this.w2[2]; _this26.x = v26.x; _this26.y = v26.y; _this26.z = v26.z; - var _this27 = this.s[1]; - var v27 = this.s[3]; + let _this27 = this.s[1]; + let v27 = this.s[3]; _this27.x = v27.x; _this27.y = v27.y; _this27.z = v27.z; - var _this28 = this.w1[1]; - var v28 = this.w1[3]; + let _this28 = this.w1[1]; + let v28 = this.w1[3]; _this28.x = v28.x; _this28.y = v28.y; _this28.z = v28.z; - var _this29 = this.w2[1]; - var v29 = this.w2[3]; + let _this29 = this.w2[1]; + let v29 = this.w2[3]; _this29.x = v29.x; _this29.y = v29.y; _this29.z = v29.z; break; case 13: - var _this30 = this.s[1]; - var v30 = this.s[3]; + let _this30 = this.s[1]; + let v30 = this.s[3]; _this30.x = v30.x; _this30.y = v30.y; _this30.z = v30.z; - var _this31 = this.w1[1]; - var v31 = this.w1[3]; + let _this31 = this.w1[1]; + let v31 = this.w1[3]; _this31.x = v31.x; _this31.y = v31.y; _this31.z = v31.z; - var _this32 = this.w2[1]; - var v32 = this.w2[3]; + let _this32 = this.w2[1]; + let v32 = this.w2[3]; _this32.x = v32.x; _this32.y = v32.y; _this32.z = v32.z; break; case 14: - var _this33 = this.s[0]; - var v33 = this.s[3]; + let _this33 = this.s[0]; + let v33 = this.s[3]; _this33.x = v33.x; _this33.y = v33.y; _this33.z = v33.z; - var _this34 = this.w1[0]; - var v34 = this.w1[3]; + let _this34 = this.w1[0]; + let v34 = this.w1[3]; _this34.x = v34.x; _this34.y = v34.y; _this34.z = v34.z; - var _this35 = this.w2[0]; - var v35 = this.w2[3]; + let _this35 = this.w2[0]; + let v35 = this.w2[3]; _this35.x = v35.x; _this35.y = v35.y; _this35.z = v35.z; @@ -12644,69 +11202,59 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp } } computeWitnessPoint1(addMargin) { - var tmp; - var tmpX; - var tmpY; - var tmpZ; - var idir; - var idirX; - var idirY; - var idirZ; - var v = this.dir; + let tmpX; + let tmpY; + let tmpZ; + let idirX; + let idirY; + let idirZ; + let v = this.dir; idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir1; - var ldir1X; - var ldir1Y; - var ldir1Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ldir1X; + let ldir1Y; + let ldir1Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this.tf1._rotation00 * idirX + this.tf1._rotation10 * idirY + this.tf1._rotation20 * idirZ; __tmp__Y = this.tf1._rotation01 * idirX + this.tf1._rotation11 * idirY + this.tf1._rotation21 * idirZ; __tmp__Z = this.tf1._rotation02 * idirX + this.tf1._rotation12 * idirY + this.tf1._rotation22 * idirZ; ldir1X = __tmp__X; ldir1Y = __tmp__Y; ldir1Z = __tmp__Z; - var iw1; - var iw1X; - var iw1Y; - var iw1Z; - var v1 = this.dir; + let iw1X; + let iw1Y; + let iw1Z; + let v1 = this.dir; v1.x = ldir1X; v1.y = ldir1Y; v1.z = ldir1Z; this.c1.computeLocalSupportingVertex(this.dir,this.w1[this.simplexSize]); if(addMargin) { - var _this = this.dir; - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = this.dir; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - var _this1 = this.w1[this.simplexSize]; - var v2 = this.dir; - var s = this.c1._gjkMargin; - var tx1 = _this1.x + v2.x * s; - var ty1 = _this1.y + v2.y * s; - var tz1 = _this1.z + v2.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; - } - var v3 = this.w1[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + let _this1 = this.w1[this.simplexSize]; + let v = this.dir; + let s = this.c1._gjkMargin; + _this1.x += v.x * s; + _this1.y += v.y * s; + _this1.z += v.z * s; + } + let v2 = this.w1[this.simplexSize]; + tmpX = v2.x; + tmpY = v2.y; + tmpZ = v2.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; __tmp__Y1 = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; __tmp__Z1 = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; @@ -12716,35 +11264,32 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp iw1X += this.tf1._positionX; iw1Y += this.tf1._positionY; iw1Z += this.tf1._positionZ; - var v4 = this.w1[this.simplexSize]; - v4.x = iw1X; - v4.y = iw1Y; - v4.z = iw1Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; + let v3 = this.w1[this.simplexSize]; + v3.x = iw1X; + v3.y = iw1Y; + v3.z = iw1Z; + let v4 = this.dir; + v4.x = idirX; + v4.y = idirY; + v4.z = idirZ; } computeWitnessPoint2(addMargin) { - var tmp; - var tmpX; - var tmpY; - var tmpZ; - var idir; - var idirX; - var idirY; - var idirZ; - var v = this.dir; + let tmpX; + let tmpY; + let tmpZ; + let idirX; + let idirY; + let idirZ; + let v = this.dir; idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir2; - var ldir2X; - var ldir2Y; - var ldir2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ldir2X; + let ldir2Y; + let ldir2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this.tf2._rotation00 * idirX + this.tf2._rotation10 * idirY + this.tf2._rotation20 * idirZ; __tmp__Y = this.tf2._rotation01 * idirX + this.tf2._rotation11 * idirY + this.tf2._rotation21 * idirZ; __tmp__Z = this.tf2._rotation02 * idirX + this.tf2._rotation12 * idirY + this.tf2._rotation22 * idirZ; @@ -12754,44 +11299,37 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp ldir2X = -ldir2X; ldir2Y = -ldir2Y; ldir2Z = -ldir2Z; - var iw2; - var iw2X; - var iw2Y; - var iw2Z; - var v1 = this.dir; + let iw2X; + let iw2Y; + let iw2Z; + let v1 = this.dir; v1.x = ldir2X; v1.y = ldir2Y; v1.z = ldir2Z; this.c2.computeLocalSupportingVertex(this.dir,this.w2[this.simplexSize]); if(addMargin) { - var _this = this.dir; - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = this.dir; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - var _this1 = this.w2[this.simplexSize]; - var v2 = this.dir; - var s = this.c2._gjkMargin; - var tx1 = _this1.x + v2.x * s; - var ty1 = _this1.y + v2.y * s; - var tz1 = _this1.z + v2.z * s; - _this1.x = tx1; - _this1.y = ty1; - _this1.z = tz1; - } - var v3 = this.w2[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + let _this1 = this.w2[this.simplexSize]; + let v = this.dir; + let s = this.c2._gjkMargin; + _this1.x += v.x * s; + _this1.y += v.y * s; + _this1.z += v.z * s; + } + let v2 = this.w2[this.simplexSize]; + tmpX = v2.x; + tmpY = v2.y; + tmpZ = v2.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; __tmp__Y1 = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; __tmp__Z1 = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; @@ -12801,67 +11339,55 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp iw2X += this.tf2._positionX; iw2Y += this.tf2._positionY; iw2Z += this.tf2._positionZ; - var v4 = this.w2[this.simplexSize]; - v4.x = iw2X; - v4.y = iw2Y; - v4.z = iw2Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; + let v3 = this.w2[this.simplexSize]; + v3.x = iw2X; + v3.y = iw2Y; + v3.z = iw2Z; + let v4 = this.dir; + v4.x = idirX; + v4.y = idirY; + v4.z = idirZ; } pointToTetrahedron() { - var _g = 0; + let _g = 0; while(_g < 3) { - var i = _g++; - var _this = this.dir; - var v = this.baseDirs[i]; + let _this = this.dir; + let v = this.baseDirs[_g++]; _this.x = v.x; _this.y = v.y; _this.z = v.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this1 = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; + let _this1 = this.s[this.simplexSize]; + let v1 = this.w1[this.simplexSize]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; - var _this2 = _this1; - var v2 = this.w2[this.simplexSize]; - var tx = _this2.x - v2.x; - var ty = _this2.y - v2.y; - var tz = _this2.z - v2.z; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; + let v2 = this.w2[this.simplexSize]; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; this.simplexSize++; this.lineToTetrahedron(); if(this.simplexSize == 4) { break; } this.simplexSize--; - var _this3 = this.dir; - var tx1 = -_this3.x; - var ty1 = -_this3.y; - var tz1 = -_this3.z; - _this3.x = tx1; - _this3.y = ty1; - _this3.z = tz1; + let _this2 = this.dir; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this4 = this.s[this.simplexSize]; - var v3 = this.w1[this.simplexSize]; - _this4.x = v3.x; - _this4.y = v3.y; - _this4.z = v3.z; - var _this5 = _this4; - var v4 = this.w2[this.simplexSize]; - var tx2 = _this5.x - v4.x; - var ty2 = _this5.y - v4.y; - var tz2 = _this5.z - v4.z; - _this5.x = tx2; - _this5.y = ty2; - _this5.z = tz2; + let _this3 = this.s[this.simplexSize]; + let v3 = this.w1[this.simplexSize]; + _this3.x = v3.x; + _this3.y = v3.y; + _this3.z = v3.z; + let v4 = this.w2[this.simplexSize]; + _this3.x -= v4.x; + _this3.y -= v4.y; + _this3.z -= v4.z; this.simplexSize++; this.lineToTetrahedron(); if(this.simplexSize == 4) { @@ -12871,102 +11397,84 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp } } lineToTetrahedron() { - var oldDir; - var oldDirX; - var oldDirY; - var oldDirZ; - var v = this.dir; + let oldDirX; + let oldDirY; + let oldDirZ; + let v = this.dir; oldDirX = v.x; oldDirY = v.y; oldDirZ = v.z; - var s0; - var s0X; - var s0Y; - var s0Z; - var s1; - var s1X; - var s1Y; - var s1Z; - var lineDir; - var lineDirX; - var lineDirY; - var lineDirZ; - var v1 = this.s[0]; + let s0X; + let s0Y; + let s0Z; + let s1X; + let s1Y; + let s1Z; + let lineDirX; + let lineDirY; + let lineDirZ; + let v1 = this.s[0]; s0X = v1.x; s0Y = v1.y; s0Z = v1.z; - var v2 = this.s[1]; + let v2 = this.s[1]; s1X = v2.x; s1Y = v2.y; s1Z = v2.z; lineDirX = s0X - s1X; lineDirY = s0Y - s1Y; lineDirZ = s0Z - s1Z; - var _g = 0; + let _g = 0; while(_g < 3) { - var i = _g++; - var baseDir; - var baseDirX; - var baseDirY; - var baseDirZ; - var v3 = this.baseDirs[i]; - baseDirX = v3.x; - baseDirY = v3.y; - baseDirZ = v3.z; - var newDir; - var newDirX; - var newDirY; - var newDirZ; + let baseDirX; + let baseDirY; + let baseDirZ; + let v = this.baseDirs[_g++]; + baseDirX = v.x; + baseDirY = v.y; + baseDirZ = v.z; + let newDirX; + let newDirY; + let newDirZ; newDirX = lineDirY * baseDirZ - lineDirZ * baseDirY; newDirY = lineDirZ * baseDirX - lineDirX * baseDirZ; newDirZ = lineDirX * baseDirY - lineDirY * baseDirX; - var v4 = this.dir; - v4.x = newDirX; - v4.y = newDirY; - v4.z = newDirZ; + let v1 = this.dir; + v1.x = newDirX; + v1.y = newDirY; + v1.z = newDirZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var _this1 = _this; - var v6 = this.w2[this.simplexSize]; - var tx = _this1.x - v6.x; - var ty = _this1.y - v6.y; - var tz = _this1.z - v6.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + let _this = this.s[this.simplexSize]; + let v2 = this.w1[this.simplexSize]; + _this.x = v2.x; + _this.y = v2.y; + _this.z = v2.z; + let v3 = this.w2[this.simplexSize]; + _this.x -= v3.x; + _this.y -= v3.y; + _this.z -= v3.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { break; } this.simplexSize--; - var _this2 = this.dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + let _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this3.x = v7.x; - _this3.y = v7.y; - _this3.z = v7.z; - var _this4 = _this3; - var v8 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v8.x; - var ty2 = _this4.y - v8.y; - var tz2 = _this4.z - v8.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; + let _this2 = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this2.x = v4.x; + _this2.y = v4.y; + _this2.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this2.x -= v5.x; + _this2.y -= v5.y; + _this2.z -= v5.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { @@ -12974,137 +11482,114 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp } this.simplexSize--; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; + let v3 = this.dir; + v3.x = oldDirX; + v3.y = oldDirY; + v3.z = oldDirZ; } triangleToTetrahedron() { - var oldDir; - var oldDirX; - var oldDirY; - var oldDirZ; - var v = this.dir; + let oldDirX; + let oldDirY; + let oldDirZ; + let v = this.dir; oldDirX = v.x; oldDirY = v.y; oldDirZ = v.z; while(true) { - var s0; - var s0X; - var s0Y; - var s0Z; - var s1; - var s1X; - var s1Y; - var s1Z; - var s2; - var s2X; - var s2Y; - var s2Z; - var s01; - var s01X; - var s01Y; - var s01Z; - var s02; - var s02X; - var s02Y; - var s02Z; - var v1 = this.s[0]; - s0X = v1.x; - s0Y = v1.y; - s0Z = v1.z; - var v2 = this.s[1]; - s1X = v2.x; - s1Y = v2.y; - s1Z = v2.z; - var v3 = this.s[2]; - s2X = v3.x; - s2Y = v3.y; - s2Z = v3.z; + let s0X; + let s0Y; + let s0Z; + let s1X; + let s1Y; + let s1Z; + let s2X; + let s2Y; + let s2Z; + let s01X; + let s01Y; + let s01Z; + let s02X; + let s02Y; + let s02Z; + let v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + let v1 = this.s[1]; + s1X = v1.x; + s1Y = v1.y; + s1Z = v1.z; + let v2 = this.s[2]; + s2X = v2.x; + s2Y = v2.y; + s2Z = v2.z; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; s02X = s2X - s0X; s02Y = s2Y - s0Y; s02Z = s2Z - s0Z; - var n; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = s01Y * s02Z - s01Z * s02Y; nY = s01Z * s02X - s01X * s02Z; nZ = s01X * s02Y - s01Y * s02X; - var v4 = this.dir; - v4.x = nX; - v4.y = nY; - v4.z = nZ; + let v3 = this.dir; + v3.x = nX; + v3.y = nY; + v3.z = nZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var _this1 = _this; - var v6 = this.w2[this.simplexSize]; - var tx = _this1.x - v6.x; - var ty = _this1.y - v6.y; - var tz = _this1.z - v6.z; - _this1.x = tx; - _this1.y = ty; - _this1.z = tz; + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; } this.simplexSize--; - var _this2 = this.dir; - var tx1 = -_this2.x; - var ty1 = -_this2.y; - var tz1 = -_this2.z; - _this2.x = tx1; - _this2.y = ty1; - _this2.z = tz1; + let _this1 = this.dir; + _this1.x = -_this1.x; + _this1.y = -_this1.y; + _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this3.x = v7.x; - _this3.y = v7.y; - _this3.z = v7.z; - var _this4 = _this3; - var v8 = this.w2[this.simplexSize]; - var tx2 = _this4.x - v8.x; - var ty2 = _this4.y - v8.y; - var tz2 = _this4.z - v8.z; - _this4.x = tx2; - _this4.y = ty2; - _this4.z = tz2; + let _this2 = this.s[this.simplexSize]; + let v6 = this.w1[this.simplexSize]; + _this2.x = v6.x; + _this2.y = v6.y; + _this2.z = v6.z; + let v7 = this.w2[this.simplexSize]; + _this2.x -= v7.x; + _this2.y -= v7.y; + _this2.z -= v7.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; } this.simplexSize--; - if(!false) { - break; - } + break; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; + let v1 = this.dir; + v1.x = oldDirX; + v1.y = oldDirY; + v1.z = oldDirZ; } isValidTetrahedron() { - var e00 = this.s[1].x - this.s[0].x; - var e01 = this.s[1].y - this.s[0].y; - var e02 = this.s[1].z - this.s[0].z; - var e10 = this.s[2].x - this.s[0].x; - var e11 = this.s[2].y - this.s[0].y; - var e12 = this.s[2].z - this.s[0].z; - var e20 = this.s[3].x - this.s[0].x; - var e21 = this.s[3].y - this.s[0].y; - var e22 = this.s[3].z - this.s[0].z; - var det = e00 * (e11 * e22 - e12 * e21) - e01 * (e10 * e22 - e12 * e20) + e02 * (e10 * e21 - e11 * e20); + let e10 = this.s[2].x - this.s[0].x; + let e11 = this.s[2].y - this.s[0].y; + let e12 = this.s[2].z - this.s[0].z; + let e20 = this.s[3].x - this.s[0].x; + let e21 = this.s[3].y - this.s[0].y; + let e22 = this.s[3].z - this.s[0].z; + let det = (this.s[1].x - this.s[0].x) * (e11 * e22 - e12 * e21) - (this.s[1].y - this.s[0].y) * (e10 * e22 - e12 * e20) + (this.s[1].z - this.s[0].z) * (e10 * e21 - e11 * e20); if(!(det > 1e-12)) { return det < -1e-12; } else { @@ -13112,12 +11597,12 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp } } computeDepth(convex1,convex2,tf1,tf2,initialPolyhedron,initialPolyhedron1,initialPolyhedron2) { - var _this = this.polyhedron; + let _this = this.polyhedron; while(_this._numTriangles > 0) { - var t = _this._triangleList; + let t = _this._triangleList; _this._numTriangles--; - var prev = t._prev; - var next = t._next; + let prev = t._prev; + let next = t._next; if(prev != null) { prev._next = next; } @@ -13137,41 +11622,41 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp _this._trianglePool = t; } while(_this._numVertices > 0) { - var v = _this._vertices[--_this._numVertices]; + let v = _this._vertices[--_this._numVertices]; v.removeReferences(); v._next = _this._vertexPool; _this._vertexPool = v; } - var tmp = this.polyhedron; - var _this1 = this.polyhedron; - var first = _this1._vertexPool; + let tmp = this.polyhedron; + let _this1 = this.polyhedron; + let first = _this1._vertexPool; if(first != null) { _this1._vertexPool = first._next; first._next = null; } else { first = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); } - var tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); - var _this2 = this.polyhedron; - var first1 = _this2._vertexPool; + let tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); + let _this2 = this.polyhedron; + let first1 = _this2._vertexPool; if(first1 != null) { _this2._vertexPool = first1._next; first1._next = null; } else { first1 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); } - var tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); - var _this3 = this.polyhedron; - var first2 = _this3._vertexPool; + let tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); + let _this3 = this.polyhedron; + let first2 = _this3._vertexPool; if(first2 != null) { _this3._vertexPool = first2._next; first2._next = null; } else { first2 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); } - var tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); - var _this4 = this.polyhedron; - var first3 = _this4._vertexPool; + let tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); + let _this4 = this.polyhedron; + let first3 = _this4._vertexPool; if(first3 != null) { _this4._vertexPool = first3._next; first3._next = null; @@ -13182,172 +11667,143 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_INIT; } this.simplexSize = 0; - var supportingVertex = this.s[0]; - var witness1 = this.w1[0]; - var witness2 = this.w2[0]; - var count = 0; - var maxIterations = 40; - while(count < maxIterations) { - var f = this.polyhedron._triangleList; - var mind = 1e65536; - var minf = null; + let supportingVertex = this.s[0]; + let witness1 = this.w1[0]; + let witness2 = this.w2[0]; + let count = 0; + while(count < 40) { + let f = this.polyhedron._triangleList; + let mind = 1e65536; + let minf = null; while(f != null) { - var n = f._next; if(f._distanceSq < mind) { mind = f._distanceSq; minf = f; } - f = n; + f = f._next; } - var face = minf; - var _this5 = this.dir; - var v1 = face._normal; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var _this6 = _this5; - var invLen = Math.sqrt(_this6.x * _this6.x + _this6.y * _this6.y + _this6.z * _this6.z); + let face = minf; + let _this = this.dir; + let v = face._normal; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this6.x * invLen; - var ty = _this6.y * invLen; - var tz = _this6.z * invLen; - _this6.x = tx; - _this6.y = ty; - _this6.z = tz; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this7 = this.s[this.simplexSize]; - var v2 = this.w1[this.simplexSize]; - _this7.x = v2.x; - _this7.y = v2.y; - _this7.z = v2.z; - var _this8 = _this7; - var v3 = this.w2[this.simplexSize]; - var tx1 = _this8.x - v3.x; - var ty1 = _this8.y - v3.y; - var tz1 = _this8.z - v3.z; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; - var v0 = face._vertices[0]; - var v11 = face._vertices[1]; - var v21 = face._vertices[2]; - var _this9 = v0.v; - var v4 = this.dir; - var dot1 = _this9.x * v4.x + _this9.y * v4.y + _this9.z * v4.z; - var v5 = this.dir; - var dot2 = supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z; - if(dot2 - dot1 < 1e-6 || count == maxIterations - 1) { - var _this10 = this.closest; - var v6 = this.dir; - _this10.x = v6.x; - _this10.y = v6.y; - _this10.z = v6.z; - var _this11 = _this10; - var _this12 = this.dir; - var v7 = v0.v; - var _this13 = this.dir; - var s = (_this12.x * v7.x + _this12.y * v7.y + _this12.z * v7.z) / (_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); - var tx2 = _this11.x * s; - var ty2 = _this11.y * s; - var tz2 = _this11.z * s; - _this11.x = tx2; - _this11.y = ty2; - _this11.z = tz2; - var c; - var cX; - var cY; - var cZ; - var v8 = this.closest; - cX = v8.x; - cY = v8.y; - cZ = v8.z; - var s0; - var s0X; - var s0Y; - var s0Z; - var w10; - var w10X; - var w10Y; - var w10Z; - var w20; - var w20X; - var w20Y; - var w20Z; - var s1; - var s1X; - var s1Y; - var s1Z; - var w11; - var w11X; - var w11Y; - var w11Z; - var w21; - var w21X; - var w21Y; - var w21Z; - var s2; - var s2X; - var s2Y; - var s2Z; - var w12; - var w12X; - var w12Y; - var w12Z; - var w22; - var w22X; - var w22Y; - var w22Z; - var v9 = v0.v; - s0X = v9.x; - s0Y = v9.y; - s0Z = v9.z; - var v10 = v0.w1; - w10X = v10.x; - w10Y = v10.y; - w10Z = v10.z; - var v12 = v0.w2; - w20X = v12.x; - w20Y = v12.y; - w20Z = v12.z; - var v13 = v11.v; - s1X = v13.x; - s1Y = v13.y; - s1Z = v13.z; - var v14 = v11.w1; - w11X = v14.x; - w11Y = v14.y; - w11Z = v14.z; - var v15 = v11.w2; - w21X = v15.x; - w21Y = v15.y; - w21Z = v15.z; - var v16 = v21.v; - s2X = v16.x; - s2Y = v16.y; - s2Z = v16.z; - var v17 = v21.w1; - w12X = v17.x; - w12Y = v17.y; - w12Z = v17.z; - var v18 = v21.w2; - w22X = v18.x; - w22Y = v18.y; - w22Z = v18.z; - var s01; - var s01X; - var s01Y; - var s01Z; - var s02; - var s02X; - var s02Y; - var s02Z; - var s0c; - var s0cX; - var s0cY; - var s0cZ; + let _this1 = this.s[this.simplexSize]; + let v1 = this.w1[this.simplexSize]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + let v2 = this.w2[this.simplexSize]; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; + let v0 = face._vertices[0]; + let v11 = face._vertices[1]; + let v21 = face._vertices[2]; + let _this2 = v0.v; + let v3 = this.dir; + let v4 = this.dir; + if(supportingVertex.x * v4.x + supportingVertex.y * v4.y + supportingVertex.z * v4.z - (_this2.x * v3.x + _this2.y * v3.y + _this2.z * v3.z) < 1e-6 || count == 39) { + let _this = this.closest; + let v = this.dir; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let _this1 = this.dir; + let v1 = v0.v; + let _this2 = this.dir; + let s = (_this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z) / (_this2.x * _this2.x + _this2.y * _this2.y + _this2.z * _this2.z); + _this.x *= s; + _this.y *= s; + _this.z *= s; + let cX; + let cY; + let cZ; + let v2 = this.closest; + cX = v2.x; + cY = v2.y; + cZ = v2.z; + let s0X; + let s0Y; + let s0Z; + let w10X; + let w10Y; + let w10Z; + let w20X; + let w20Y; + let w20Z; + let s1X; + let s1Y; + let s1Z; + let w11X; + let w11Y; + let w11Z; + let w21X; + let w21Y; + let w21Z; + let s2X; + let s2Y; + let s2Z; + let w12X; + let w12Y; + let w12Z; + let w22X; + let w22Y; + let w22Z; + let v3 = v0.v; + s0X = v3.x; + s0Y = v3.y; + s0Z = v3.z; + let v4 = v0.w1; + w10X = v4.x; + w10Y = v4.y; + w10Z = v4.z; + let v5 = v0.w2; + w20X = v5.x; + w20Y = v5.y; + w20Z = v5.z; + let v6 = v11.v; + s1X = v6.x; + s1Y = v6.y; + s1Z = v6.z; + let v7 = v11.w1; + w11X = v7.x; + w11Y = v7.y; + w11Z = v7.z; + let v8 = v11.w2; + w21X = v8.x; + w21Y = v8.y; + w21Z = v8.z; + let v9 = v21.v; + s2X = v9.x; + s2Y = v9.y; + s2Z = v9.z; + let v10 = v21.w1; + w12X = v10.x; + w12Y = v10.y; + w12Z = v10.z; + let v12 = v21.w2; + w22X = v12.x; + w22Y = v12.y; + w22Z = v12.z; + let s01X; + let s01Y; + let s01Z; + let s02X; + let s02Y; + let s02Z; + let s0cX; + let s0cY; + let s0cZ; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; @@ -13357,74 +11813,71 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp s0cX = cX - s0X; s0cY = cY - s0Y; s0cZ = cZ - s0Z; - var d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; - var d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; - var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; - var d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; - var d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; - var invDet = d11 * d22 - d12 * d12; + let d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + let d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; + let d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + let d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; + let d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; + let invDet = d11 * d22 - d12 * d12; if(invDet != 0) { invDet = 1 / invDet; } - var s3 = (d1c * d22 - d2c * d12) * invDet; - var t1 = (-d1c * d12 + d2c * d11) * invDet; - var diff; - var diffX; - var diffY; - var diffZ; - var cp1; - var cp1X; - var cp1Y; - var cp1Z; - var cp2; - var cp2X; - var cp2Y; - var cp2Z; + let s1 = (d1c * d22 - d2c * d12) * invDet; + let t = (-d1c * d12 + d2c * d11) * invDet; + let diffX; + let diffY; + let diffZ; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; diffX = w11X - w10X; diffY = w11Y - w10Y; diffZ = w11Z - w10Z; - cp1X = w10X + diffX * s3; - cp1Y = w10Y + diffY * s3; - cp1Z = w10Z + diffZ * s3; + cp1X = w10X + diffX * s1; + cp1Y = w10Y + diffY * s1; + cp1Z = w10Z + diffZ * s1; diffX = w12X - w10X; diffY = w12Y - w10Y; diffZ = w12Z - w10Z; - cp1X += diffX * t1; - cp1Y += diffY * t1; - cp1Z += diffZ * t1; + cp1X += diffX * t; + cp1Y += diffY * t; + cp1Z += diffZ * t; diffX = w21X - w20X; diffY = w21Y - w20Y; diffZ = w21Z - w20Z; - cp2X = w20X + diffX * s3; - cp2Y = w20Y + diffY * s3; - cp2Z = w20Z + diffZ * s3; + cp2X = w20X + diffX * s1; + cp2Y = w20Y + diffY * s1; + cp2Z = w20Z + diffZ * s1; diffX = w22X - w20X; diffY = w22Y - w20Y; diffZ = w22Z - w20Z; - cp2X += diffX * t1; - cp2Y += diffY * t1; - cp2Z += diffZ * t1; - var v19 = this.closestPoint1; - v19.x = cp1X; - v19.y = cp1Y; - v19.z = cp1Z; - var v20 = this.closestPoint2; - v20.x = cp2X; - v20.y = cp2Y; - v20.z = cp2Z; - var _this14 = this.closest; - this.depth = Math.sqrt(_this14.x * _this14.x + _this14.y * _this14.y + _this14.z * _this14.z); + cp2X += diffX * t; + cp2Y += diffY * t; + cp2Z += diffZ * t; + let v13 = this.closestPoint1; + v13.x = cp1X; + v13.y = cp1Y; + v13.z = cp1Z; + let v14 = this.closestPoint2; + v14.x = cp2X; + v14.y = cp2Y; + v14.z = cp2Z; + let _this3 = this.closest; + this.depth = Math.sqrt(_this3.x * _this3.x + _this3.y * _this3.y + _this3.z * _this3.z); return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.SUCCEEDED; } - var _this15 = this.polyhedron; - var first4 = _this15._vertexPool; - if(first4 != null) { - _this15._vertexPool = first4._next; - first4._next = null; + let _this3 = this.polyhedron; + let first = _this3._vertexPool; + if(first != null) { + _this3._vertexPool = first._next; + first._next = null; } else { - first4 = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); + first = new oimo.collision.narrowphase.detector.gjkepa.EpaVertex(); } - var epaVertex = first4.init(supportingVertex,witness1,witness2); + let epaVertex = first.init(supportingVertex,witness1,witness2); if(!this.polyhedron._addVertex(epaVertex,face)) { return oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; } @@ -13442,26 +11895,20 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpa = class oimo_collision_narrowp return this.convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit); } rayCast(c,tf,begin,end,hit) { - var tf1 = this.tempTransform; - var tf2 = tf; - var v = begin; - tf1._positionX = v.x; - tf1._positionY = v.y; - tf1._positionZ = v.z; - var tl1 = this.tl1; - var tl2 = this.tl2; + let tf1 = this.tempTransform; + tf1._positionX = begin.x; + tf1._positionY = begin.y; + tf1._positionZ = begin.z; + let tl1 = this.tl1; + let tl2 = this.tl2; tl1.x = end.x; tl1.y = end.y; tl1.z = end.z; - var _this = tl1; - var tx = _this.x - begin.x; - var ty = _this.y - begin.y; - var tz = _this.z - begin.z; - _this.x = tx; - _this.y = ty; - _this.z = tz; + tl1.x -= begin.x; + tl1.y -= begin.y; + tl1.z -= begin.z; tl2.zero(); - return this.convexCastImpl(null,c,tf1,tf2,tl1,tl2,hit); + return this.convexCastImpl(null,c,tf1,tf,tl1,tl2,hit); } static getInstance() { return oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance; @@ -13473,96 +11920,77 @@ oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState = class oimo_collis } oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_narrowphase_detector_gjkepa_SimplexUtil { static projectOrigin2(vec1,vec2,out) { - var v1; - var v1X; - var v1Y; - var v1Z; - var v2; - var v2X; - var v2Y; - var v2Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v3 = vec2; - v2X = v3.x; - v2Y = v3.y; - v2Z = v3.z; - var v12; - var v12X; - var v12Y; - var v12Z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var d = v12X * v12X + v12Y * v12Y + v12Z * v12Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / d; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - var v4 = out; - v4.x = v1X; - v4.y = v1Y; - v4.z = v1Z; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; return 1; } if(t > 1) { - var v5 = out; - v5.x = v2X; - v5.y = v2Y; - v5.z = v2Z; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; return 2; } - var p; - var pX; - var pY; - var pZ; + let pX; + let pY; + let pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; - var v6 = out; - v6.x = pX; - v6.y = pY; - v6.z = pZ; + out.x = pX; + out.y = pY; + out.z = pZ; return 3; } static projectOrigin3(vec1,vec2,vec3,out) { - var v1; - var v1X; - var v1Y; - var v1Z; - var v2; - var v2X; - var v2Y; - var v2Z; - var v3; - var v3X; - var v3Y; - var v3Z; - var v12; - var v12X; - var v12Y; - var v12Z; - var v23; - var v23X; - var v23Y; - var v23Z; - var v31; - var v31X; - var v31Y; - var v31Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v4 = vec2; - v2X = v4.x; - v2Y = v4.y; - v2Z = v4.z; - var v5 = vec3; - v3X = v5.x; - v3Y = v5.y; - v3Z = v5.z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -13572,25 +12000,21 @@ oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_na v31X = v1X - v3X; v31Y = v1Y - v3Y; v31Z = v1Z - v3Z; - var n; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y * v23Z - v12Z * v23Y; nY = v12Z * v23X - v12X * v23Z; nZ = v12X * v23Y - v12Y * v23X; - var n12; - var n12X; - var n12Y; - var n12Z; - var n23; - var n23X; - var n23Y; - var n23Z; - var n31; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y * nZ - v12Z * nY; n12Y = v12Z * nX - v12X * nZ; n12Z = v12X * nY - v12Y * nX; @@ -13600,291 +12024,233 @@ oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_na n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var d12 = v1X * n12X + v1Y * n12Y + v1Z * n12Z; - var d23 = v2X * n23X + v2Y * n23Y + v2Z * n23Z; - var d31 = v3X * n31X + v3Y * n31Y + v3Z * n31Z; - var mind = -1; - var minv; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; - if(d12 < 0) { - var v11; - var v1X1; - var v1Y1; - var v1Z1; - var v21; - var v2X1; - var v2Y1; - var v2Z1; - var v6 = vec1; - v1X1 = v6.x; - v1Y1 = v6.y; - v1Z1 = v6.z; - var v7 = vec2; - v2X1 = v7.x; - v2Y1 = v7.y; - v2Z1 = v7.z; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - var d = v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1; - var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; - t = -t / d; - var b; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; if(t < 0) { - var v8 = out; - v8.x = v1X1; - v8.y = v1Y1; - v8.z = v1Z1; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; b = 1; } else if(t > 1) { - var v9 = out; - v9.x = v2X1; - v9.y = v2Y1; - v9.z = v2Z1; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; b = 2; } else { - var p; - var pX; - var pY; - var pZ; - pX = v1X1 + v12X1 * t; - pY = v1Y1 + v12Y1 * t; - pZ = v1Z1 + v12Z1 * t; - var v10 = out; - v10.x = pX; - v10.y = pY; - v10.z = pZ; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; b = 3; } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; mini = b; - mind = d1; - var v13 = out; - minvX = v13.x; - minvY = v13.y; - minvZ = v13.z; - } - if(d23 < 0) { - var v14; - var v1X2; - var v1Y2; - var v1Z2; - var v22; - var v2X2; - var v2Y2; - var v2Z2; - var v15 = vec2; - v1X2 = v15.x; - v1Y2 = v15.y; - v1Z2 = v15.z; - var v16 = vec3; - v2X2 = v16.x; - v2Y2 = v16.y; - v2Z2 = v16.z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var d2 = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / d2; - var b1; - if(t1 < 0) { - var v17 = out; - v17.x = v1X2; - v17.y = v1Y2; - v17.z = v1Z2; - b1 = 1; - } else if(t1 > 1) { - var v18 = out; - v18.x = v2X2; - v18.y = v2Y2; - v18.z = v2Z2; - b1 = 2; - } else { - var p1; - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - var v19 = out; - v19.x = pX1; - v19.y = pY1; - v19.z = pZ1; - b1 = 3; - } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d3 < mind) { - mini = b1 << 1; - mind = d3; - var v20 = out; - minvX = v20.x; - minvY = v20.y; - minvZ = v20.z; - } - } - if(d31 < 0) { - var v110; - var v1X3; - var v1Y3; - var v1Z3; - var v24; - var v2X3; - var v2Y3; - var v2Z3; - var v25 = vec1; - v1X3 = v25.x; - v1Y3 = v25.y; - v1Z3 = v25.z; - var v26 = vec3; - v2X3 = v26.x; - v2Y3 = v26.y; - v2Z3 = v26.z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var d4 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / d4; - var b2; - if(t2 < 0) { - var v27 = out; - v27.x = v1X3; - v27.y = v1Y3; - v27.z = v1Z3; - b2 = 1; - } else if(t2 > 1) { - var v28 = out; - v28.x = v2X3; - v28.y = v2Y3; - v28.z = v2Z3; - b2 = 2; - } else { - var p2; - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - var v29 = out; - v29.x = pX2; - v29.y = pY2; - v29.z = pZ2; - b2 = 3; - } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d5 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d5; - var v30 = out; - minvX = v30.x; - minvY = v30.y; - minvZ = v30.z; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v32 = out; - v32.x = minvX; - v32.y = minvY; - v32.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return mini; } - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var dn = v1X * nX + v1Y * nY + v1Z * nZ; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = dn / l2; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; - var v33 = out; - v33.x = minvX; - v33.y = minvY; - v33.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return 7; } static projectOrigin4(vec1,vec2,vec3,vec4,out) { - var v1; - var v1X; - var v1Y; - var v1Z; - var v2; - var v2X; - var v2Y; - var v2Z; - var v3; - var v3X; - var v3Y; - var v3Z; - var v4; - var v4X; - var v4Y; - var v4Z; - var v12; - var v12X; - var v12Y; - var v12Z; - var v13; - var v13X; - var v13Y; - var v13Z; - var v14; - var v14X; - var v14Y; - var v14Z; - var v23; - var v23X; - var v23Y; - var v23Z; - var v24; - var v24X; - var v24Y; - var v24Z; - var v34; - var v34X; - var v34Y; - var v34Z; - var v = vec1; - v1X = v.x; - v1Y = v.y; - v1Z = v.z; - var v5 = vec2; - v2X = v5.x; - v2Y = v5.y; - v2Z = v5.z; - var v6 = vec3; - v3X = v6.x; - v3Y = v6.y; - v3Z = v6.z; - var v7 = vec4; - v4X = v7.x; - v4Y = v7.y; - v4Z = v7.z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v4X; + let v4Y; + let v4Z; + let v12X; + let v12Y; + let v12Z; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X; + let v23Y; + let v23Z; + let v24X; + let v24Y; + let v24Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -13900,30 +12266,18 @@ oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_na v24X = v4X - v2X; v24Y = v4Y - v2Y; v24Z = v4Z - v2Z; - v34X = v4X - v3X; - v34Y = v4Y - v3Y; - v34Z = v4Z - v3Z; - var rev; - var n123; - var n123X; - var n123Y; - var n123Z; - var n134; - var n134X; - var n134Y; - var n134Z; - var n142; - var n142X; - var n142Y; - var n142Z; - var n243; - var n243X; - var n243Y; - var n243Z; - var n; - var nX; - var nY; - var nZ; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; n123X = v12Y * v13Z - v12Z * v13Y; n123Y = v12Z * v13X - v12X * v13Z; n123Z = v12X * v13Y - v12Y * v13X; @@ -13936,1275 +12290,1048 @@ oimo.collision.narrowphase.detector.gjkepa.SimplexUtil = class oimo_collision_na n243X = v24Y * v23Z - v24Z * v23Y; n243Y = v24Z * v23X - v24X * v23Z; n243Z = v24X * v23Y - v24Y * v23X; - var sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; - var d123 = v1X * n123X + v1Y * n123Y + v1Z * n123Z; - var d134 = v1X * n134X + v1Y * n134Y + v1Z * n134Z; - var d142 = v1X * n142X + v1Y * n142Y + v1Z * n142Z; - var d243 = v2X * n243X + v2Y * n243Y + v2Z * n243Z; - var mind = -1; - var minv; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; - if(d123 * sign < 0) { - var v11; - var v1X1; - var v1Y1; - var v1Z1; - var v21; - var v2X1; - var v2Y1; - var v2Z1; - var v31; - var v3X1; - var v3Y1; - var v3Z1; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - var v231; - var v23X1; - var v23Y1; - var v23Z1; - var v311; - var v31X; - var v31Y; - var v31Z; - var v8 = vec1; - v1X1 = v8.x; - v1Y1 = v8.y; - v1Z1 = v8.z; - var v9 = vec2; - v2X1 = v9.x; - v2Y1 = v9.y; - v2Z1 = v9.z; - var v10 = vec3; - v3X1 = v10.x; - v3Y1 = v10.y; - v3Z1 = v10.z; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - v23X1 = v3X1 - v2X1; - v23Y1 = v3Y1 - v2Y1; - v23Z1 = v3Z1 - v2Z1; - v31X = v1X1 - v3X1; - v31Y = v1Y1 - v3Y1; - v31Z = v1Z1 - v3Z1; - var n1; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y1 * v23Z1 - v12Z1 * v23Y1; - nY1 = v12Z1 * v23X1 - v12X1 * v23Z1; - nZ1 = v12X1 * v23Y1 - v12Y1 * v23X1; - var n12; - var n12X; - var n12Y; - var n12Z; - var n23; - var n23X; - var n23Y; - var n23Z; - var n31; - var n31X; - var n31Y; - var n31Z; - n12X = v12Y1 * nZ1 - v12Z1 * nY1; - n12Y = v12Z1 * nX1 - v12X1 * nZ1; - n12Z = v12X1 * nY1 - v12Y1 * nX1; - n23X = v23Y1 * nZ1 - v23Z1 * nY1; - n23Y = v23Z1 * nX1 - v23X1 * nZ1; - n23Z = v23X1 * nY1 - v23Y1 * nX1; - n31X = v31Y * nZ1 - v31Z * nY1; - n31Y = v31Z * nX1 - v31X * nZ1; - n31Z = v31X * nY1 - v31Y * nX1; - var d12 = v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z; - var d23 = v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z; - var d31 = v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z; - var mind1 = -1; - var minv1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; + if((v1X * n123X + v1Y * n123Y + v1Z * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if(d12 < 0) { - var v15; - var v1X2; - var v1Y2; - var v1Z2; - var v22; - var v2X2; - var v2Y2; - var v2Z2; - var v16 = vec1; - v1X2 = v16.x; - v1Y2 = v16.y; - v1Z2 = v16.z; - var v17 = vec2; - v2X2 = v17.x; - v2Y2 = v17.y; - v2Z2 = v17.z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var d = v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / d; - var b; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; if(t < 0) { - var v18 = out; - v18.x = v1X2; - v18.y = v1Y2; - v18.z = v1Z2; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; b = 1; } else if(t > 1) { - var v19 = out; - v19.x = v2X2; - v19.y = v2Y2; - v19.z = v2Z2; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; b = 2; } else { - var p; - var pX; - var pY; - var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; - var v20 = out; - v20.x = pX; - v20.y = pY; - v20.z = pZ; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; b = 3; } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; mini1 = b; - mind1 = d1; - var v25 = out; - minvX1 = v25.x; - minvY1 = v25.y; - minvZ1 = v25.z; - } - if(d23 < 0) { - var v110; - var v1X3; - var v1Y3; - var v1Z3; - var v26; - var v2X3; - var v2Y3; - var v2Z3; - var v27 = vec2; - v1X3 = v27.x; - v1Y3 = v27.y; - v1Z3 = v27.z; - var v28 = vec3; - v2X3 = v28.x; - v2Y3 = v28.y; - v2Z3 = v28.z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var d2 = v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / d2; - var b1; - if(t1 < 0) { - var v29 = out; - v29.x = v1X3; - v29.y = v1Y3; - v29.z = v1Z3; - b1 = 1; - } else if(t1 > 1) { - var v30 = out; - v30.x = v2X3; - v30.y = v2Y3; - v30.z = v2Z3; - b1 = 2; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p1; - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - var v32 = out; - v32.x = pX1; - v32.y = pY1; - v32.z = pZ1; - b1 = 3; - } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d3 < mind1) { - mini1 = b1 << 1; - mind1 = d3; - var v33 = out; - minvX1 = v33.x; - minvY1 = v33.y; - minvZ1 = v33.z; - } - } - if(d31 < 0) { - var v111; - var v1X4; - var v1Y4; - var v1Z4; - var v210; - var v2X4; - var v2Y4; - var v2Z4; - var v35 = vec1; - v1X4 = v35.x; - v1Y4 = v35.y; - v1Z4 = v35.z; - var v36 = vec3; - v2X4 = v36.x; - v2Y4 = v36.y; - v2Z4 = v36.z; - var v124; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var d4 = v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / d4; - var b2; - if(t2 < 0) { - var v37 = out; - v37.x = v1X4; - v37.y = v1Y4; - v37.z = v1Z4; - b2 = 1; - } else if(t2 > 1) { - var v38 = out; - v38.x = v2X4; - v38.y = v2Y4; - v38.z = v2Z4; - b2 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p2; - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - var v39 = out; - v39.x = pX2; - v39.y = pY2; - v39.z = pZ2; - b2 = 3; - } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d5 < mind1) { - mini1 = b2 & 1 | (b2 & 2) << 1; - mind1 = d5; - var v40 = out; - minvX1 = v40.x; - minvY1 = v40.y; - minvZ1 = v40.z; - } - } - var b3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; if(mind1 > 0) { - var v41 = out; - v41.x = minvX1; - v41.y = minvY1; - v41.z = minvZ1; - b3 = mini1; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var l = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } - nX1 *= l; - nY1 *= l; - nZ1 *= l; - var dn = v1X1 * nX1 + v1Y1 * nY1 + v1Z1 * nZ1; - var l2 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l2 = dn / l2; - minvX1 = nX1 * l2; - minvY1 = nY1 * l2; - minvZ1 = nZ1 * l2; - var v42 = out; - v42.x = minvX1; - v42.y = minvY1; - v42.z = minvZ1; - b3 = 7; - } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; - mini = b3; - mind = d6; - var v43 = out; - minvX = v43.x; - minvY = v43.y; - minvZ = v43.z; - } - if(d134 * sign < 0) { - var v112; - var v1X5; - var v1Y5; - var v1Z5; - var v211; - var v2X5; - var v2Y5; - var v2Z5; - var v310; - var v3X2; - var v3Y2; - var v3Z2; - var v125; - var v12X5; - var v12Y5; - var v12Z5; - var v232; - var v23X2; - var v23Y2; - var v23Z2; - var v312; - var v31X1; - var v31Y1; - var v31Z1; - var v44 = vec1; - v1X5 = v44.x; - v1Y5 = v44.y; - v1Z5 = v44.z; - var v45 = vec3; - v2X5 = v45.x; - v2Y5 = v45.y; - v2Z5 = v45.z; - var v46 = vec4; - v3X2 = v46.x; - v3Y2 = v46.y; - v3Z2 = v46.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v23X2 = v3X2 - v2X5; - v23Y2 = v3Y2 - v2Y5; - v23Z2 = v3Z2 - v2Z5; - v31X1 = v1X5 - v3X2; - v31Y1 = v1Y5 - v3Y2; - v31Z1 = v1Z5 - v3Z2; - var n2; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y5 * v23Z2 - v12Z5 * v23Y2; - nY2 = v12Z5 * v23X2 - v12X5 * v23Z2; - nZ2 = v12X5 * v23Y2 - v12Y5 * v23X2; - var n121; - var n12X1; - var n12Y1; - var n12Z1; - var n231; - var n23X1; - var n23Y1; - var n23Z1; - var n311; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y5 * nZ2 - v12Z5 * nY2; - n12Y1 = v12Z5 * nX2 - v12X5 * nZ2; - n12Z1 = v12X5 * nY2 - v12Y5 * nX2; - n23X1 = v23Y2 * nZ2 - v23Z2 * nY2; - n23Y1 = v23Z2 * nX2 - v23X2 * nZ2; - n23Z1 = v23X2 * nY2 - v23Y2 * nX2; - n31X1 = v31Y1 * nZ2 - v31Z1 * nY2; - n31Y1 = v31Z1 * nX2 - v31X1 * nZ2; - n31Z1 = v31X1 * nY2 - v31Y1 * nX2; - var d121 = v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1; - var d231 = v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1; - var d311 = v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1; - var mind2 = -1; - var minv2; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(d121 < 0) { - var v113; - var v1X6; - var v1Y6; - var v1Z6; - var v212; - var v2X6; - var v2Y6; - var v2Z6; - var v47 = vec1; - v1X6 = v47.x; - v1Y6 = v47.y; - v1Z6 = v47.z; - var v48 = vec3; - v2X6 = v48.x; - v2Y6 = v48.y; - v2Z6 = v48.z; - var v126; - var v12X6; - var v12Y6; - var v12Z6; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - var d7 = v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6; - var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; - t3 = -t3 / d7; - var b4; - if(t3 < 0) { - var v49 = out; - v49.x = v1X6; - v49.y = v1Y6; - v49.z = v1Z6; - b4 = 1; - } else if(t3 > 1) { - var v50 = out; - v50.x = v2X6; - v50.y = v2Y6; - v50.z = v2Z6; - b4 = 2; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + mini = b; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p3; - var pX3; - var pY3; - var pZ3; - pX3 = v1X6 + v12X6 * t3; - pY3 = v1Y6 + v12Y6 * t3; - pZ3 = v1Z6 + v12Z6 * t3; - var v51 = out; - v51.x = pX3; - v51.y = pY3; - v51.z = pZ3; - b4 = 3; - } - var d8 = out.x * out.x + out.y * out.y + out.z * out.z; - mini2 = b4; - mind2 = d8; - var v52 = out; - minvX2 = v52.x; - minvY2 = v52.y; - minvZ2 = v52.z; - } - if(d231 < 0) { - var v114; - var v1X7; - var v1Y7; - var v1Z7; - var v213; - var v2X7; - var v2Y7; - var v2Z7; - var v53 = vec3; - v1X7 = v53.x; - v1Y7 = v53.y; - v1Z7 = v53.z; - var v54 = vec4; - v2X7 = v54.x; - v2Y7 = v54.y; - v2Z7 = v54.z; - var v127; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var d9 = v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / d9; - var b5; - if(t4 < 0) { - var v55 = out; - v55.x = v1X7; - v55.y = v1Y7; - v55.z = v1Z7; - b5 = 1; - } else if(t4 > 1) { - var v56 = out; - v56.x = v2X7; - v56.y = v2Y7; - v56.z = v2Z7; - b5 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec3.x; + v1Y = vec3.y; + v1Z = vec3.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p4; - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - var v57 = out; - v57.x = pX4; - v57.y = pY4; - v57.z = pZ4; - b5 = 3; - } - var d10 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d10 < mind2) { - mini2 = b5 << 1; - mind2 = d10; - var v58 = out; - minvX2 = v58.x; - minvY2 = v58.y; - minvZ2 = v58.z; - } - } - if(d311 < 0) { - var v115; - var v1X8; - var v1Y8; - var v1Z8; - var v214; - var v2X8; - var v2Y8; - var v2Z8; - var v59 = vec1; - v1X8 = v59.x; - v1Y8 = v59.y; - v1Z8 = v59.z; - var v60 = vec4; - v2X8 = v60.x; - v2Y8 = v60.y; - v2Z8 = v60.z; - var v128; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var d11 = v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / d11; - var b6; - if(t5 < 0) { - var v61 = out; - v61.x = v1X8; - v61.y = v1Y8; - v61.z = v1Z8; - b6 = 1; - } else if(t5 > 1) { - var v62 = out; - v62.x = v2X8; - v62.y = v2Y8; - v62.z = v2Z8; - b6 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p5; - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - var v63 = out; - v63.x = pX5; - v63.y = pY5; - v63.z = pZ5; - b6 = 3; - } - var d13 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d13 < mind2) { - mini2 = b6 & 1 | (b6 & 2) << 1; - mind2 = d13; - var v64 = out; - minvX2 = v64.x; - minvY2 = v64.y; - minvZ2 = v64.z; - } - } - var b7; - if(mind2 > 0) { - var v65 = out; - v65.x = minvX2; - v65.y = minvY2; - v65.z = minvZ2; - b7 = mini2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var l1 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - nX2 *= l1; - nY2 *= l1; - nZ2 *= l1; - var dn1 = v1X5 * nX2 + v1Y5 * nY2 + v1Z5 * nZ2; - var l21 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l21 = dn1 / l21; - minvX2 = nX2 * l21; - minvY2 = nY2 * l21; - minvZ2 = nZ2 * l21; - var v66 = out; - v66.x = minvX2; - v66.y = minvY2; - v66.z = minvZ2; - b7 = 7; - } - var d14 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d14 < mind) { - mini = b7 & 1 | (b7 & 6) << 1; - mind = d14; - var v67 = out; - minvX = v67.x; - minvY = v67.y; - minvZ = v67.z; - } - } - if(d142 * sign < 0) { - var v116; - var v1X9; - var v1Y9; - var v1Z9; - var v215; - var v2X9; - var v2Y9; - var v2Z9; - var v313; - var v3X3; - var v3Y3; - var v3Z3; - var v129; - var v12X9; - var v12Y9; - var v12Z9; - var v233; - var v23X3; - var v23Y3; - var v23Z3; - var v314; - var v31X2; - var v31Y2; - var v31Z2; - var v68 = vec1; - v1X9 = v68.x; - v1Y9 = v68.y; - v1Z9 = v68.z; - var v69 = vec2; - v2X9 = v69.x; - v2Y9 = v69.y; - v2Z9 = v69.z; - var v70 = vec4; - v3X3 = v70.x; - v3Y3 = v70.y; - v3Z3 = v70.z; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - v23X3 = v3X3 - v2X9; - v23Y3 = v3Y3 - v2Y9; - v23Z3 = v3Z3 - v2Z9; - v31X2 = v1X9 - v3X3; - v31Y2 = v1Y9 - v3Y3; - v31Z2 = v1Z9 - v3Z3; - var n3; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y9 * v23Z3 - v12Z9 * v23Y3; - nY3 = v12Z9 * v23X3 - v12X9 * v23Z3; - nZ3 = v12X9 * v23Y3 - v12Y9 * v23X3; - var n122; - var n12X2; - var n12Y2; - var n12Z2; - var n232; - var n23X2; - var n23Y2; - var n23Z2; - var n312; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y9 * nZ3 - v12Z9 * nY3; - n12Y2 = v12Z9 * nX3 - v12X9 * nZ3; - n12Z2 = v12X9 * nY3 - v12Y9 * nX3; - n23X2 = v23Y3 * nZ3 - v23Z3 * nY3; - n23Y2 = v23Z3 * nX3 - v23X3 * nZ3; - n23Z2 = v23X3 * nY3 - v23Y3 * nX3; - n31X2 = v31Y2 * nZ3 - v31Z2 * nY3; - n31Y2 = v31Z2 * nX3 - v31X2 * nZ3; - n31Z2 = v31X2 * nY3 - v31Y2 * nX3; - var d122 = v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2; - var d232 = v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2; - var d312 = v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2; - var mind3 = -1; - var minv3; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(d122 < 0) { - var v117; - var v1X10; - var v1Y10; - var v1Z10; - var v216; - var v2X10; - var v2Y10; - var v2Z10; - var v71 = vec1; - v1X10 = v71.x; - v1Y10 = v71.y; - v1Z10 = v71.z; - var v72 = vec2; - v2X10 = v72.x; - v2Y10 = v72.y; - v2Z10 = v72.z; - var v1210; - var v12X10; - var v12Y10; - var v12Z10; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - var d15 = v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10; - var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; - t6 = -t6 / d15; - var b8; - if(t6 < 0) { - var v73 = out; - v73.x = v1X10; - v73.y = v1Y10; - v73.z = v1Z10; - b8 = 1; - } else if(t6 > 1) { - var v74 = out; - v74.x = v2X10; - v74.y = v2Y10; - v74.z = v2Z10; - b8 = 2; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 6) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p6; - var pX6; - var pY6; - var pZ6; - pX6 = v1X10 + v12X10 * t6; - pY6 = v1Y10 + v12Y10 * t6; - pZ6 = v1Z10 + v12Z10 * t6; - var v75 = out; - v75.x = pX6; - v75.y = pY6; - v75.z = pZ6; - b8 = 3; - } - var d16 = out.x * out.x + out.y * out.y + out.z * out.z; - mini3 = b8; - mind3 = d16; - var v76 = out; - minvX3 = v76.x; - minvY3 = v76.y; - minvZ3 = v76.z; - } - if(d232 < 0) { - var v118; - var v1X11; - var v1Y11; - var v1Z11; - var v217; - var v2X11; - var v2Y11; - var v2Z11; - var v77 = vec2; - v1X11 = v77.x; - v1Y11 = v77.y; - v1Z11 = v77.z; - var v78 = vec4; - v2X11 = v78.x; - v2Y11 = v78.y; - v2Z11 = v78.z; - var v1211; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var d17 = v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / d17; - var b9; - if(t7 < 0) { - var v79 = out; - v79.x = v1X11; - v79.y = v1Y11; - v79.z = v1Z11; - b9 = 1; - } else if(t7 > 1) { - var v80 = out; - v80.x = v2X11; - v80.y = v2Y11; - v80.z = v2Z11; - b9 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p7; - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - var v81 = out; - v81.x = pX7; - v81.y = pY7; - v81.z = pZ7; - b9 = 3; - } - var d18 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d18 < mind3) { - mini3 = b9 << 1; - mind3 = d18; - var v82 = out; - minvX3 = v82.x; - minvY3 = v82.y; - minvZ3 = v82.z; - } - } - if(d312 < 0) { - var v119; - var v1X12; - var v1Y12; - var v1Z12; - var v218; - var v2X12; - var v2Y12; - var v2Z12; - var v83 = vec1; - v1X12 = v83.x; - v1Y12 = v83.y; - v1Z12 = v83.z; - var v84 = vec4; - v2X12 = v84.x; - v2Y12 = v84.y; - v2Z12 = v84.z; - var v1212; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var d19 = v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / d19; - var b10; - if(t8 < 0) { - var v85 = out; - v85.x = v1X12; - v85.y = v1Y12; - v85.z = v1Z12; - b10 = 1; - } else if(t8 > 1) { - var v86 = out; - v86.x = v2X12; - v86.y = v2Y12; - v86.z = v2Z12; - b10 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p8; - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - var v87 = out; - v87.x = pX8; - v87.y = pY8; - v87.z = pZ8; - b10 = 3; - } - var d20 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d20 < mind3) { - mini3 = b10 & 1 | (b10 & 2) << 1; - mind3 = d20; - var v88 = out; - minvX3 = v88.x; - minvY3 = v88.y; - minvZ3 = v88.z; - } - } - var b11; - if(mind3 > 0) { - var v89 = out; - v89.x = minvX3; - v89.y = minvY3; - v89.z = minvZ3; - b11 = mini3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var l3 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - nX3 *= l3; - nY3 *= l3; - nZ3 *= l3; - var dn2 = v1X9 * nX3 + v1Y9 * nY3 + v1Z9 * nZ3; - var l22 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l22 = dn2 / l22; - minvX3 = nX3 * l22; - minvY3 = nY3 * l22; - minvZ3 = nZ3 * l22; - var v90 = out; - v90.x = minvX3; - v90.y = minvY3; - v90.z = minvZ3; - b11 = 7; - } - var d21 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d21 < mind) { - mini = b11 & 3 | (b11 & 4) << 1; - mind = d21; - var v91 = out; - minvX = v91.x; - minvY = v91.y; - minvZ = v91.z; - } - } - if(d243 * sign < 0) { - var v120; - var v1X13; - var v1Y13; - var v1Z13; - var v219; - var v2X13; - var v2Y13; - var v2Z13; - var v315; - var v3X4; - var v3Y4; - var v3Z4; - var v1213; - var v12X13; - var v12Y13; - var v12Z13; - var v234; - var v23X4; - var v23Y4; - var v23Z4; - var v316; - var v31X3; - var v31Y3; - var v31Z3; - var v92 = vec2; - v1X13 = v92.x; - v1Y13 = v92.y; - v1Z13 = v92.z; - var v93 = vec3; - v2X13 = v93.x; - v2Y13 = v93.y; - v2Z13 = v93.z; - var v94 = vec4; - v3X4 = v94.x; - v3Y4 = v94.y; - v3Z4 = v94.z; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - v23X4 = v3X4 - v2X13; - v23Y4 = v3Y4 - v2Y13; - v23Z4 = v3Z4 - v2Z13; - v31X3 = v1X13 - v3X4; - v31Y3 = v1Y13 - v3Y4; - v31Z3 = v1Z13 - v3Z4; - var n4; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y13 * v23Z4 - v12Z13 * v23Y4; - nY4 = v12Z13 * v23X4 - v12X13 * v23Z4; - nZ4 = v12X13 * v23Y4 - v12Y13 * v23X4; - var n124; - var n12X3; - var n12Y3; - var n12Z3; - var n233; - var n23X3; - var n23Y3; - var n23Z3; - var n313; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y13 * nZ4 - v12Z13 * nY4; - n12Y3 = v12Z13 * nX4 - v12X13 * nZ4; - n12Z3 = v12X13 * nY4 - v12Y13 * nX4; - n23X3 = v23Y4 * nZ4 - v23Z4 * nY4; - n23Y3 = v23Z4 * nX4 - v23X4 * nZ4; - n23Z3 = v23X4 * nY4 - v23Y4 * nX4; - n31X3 = v31Y3 * nZ4 - v31Z3 * nY4; - n31Y3 = v31Z3 * nX4 - v31X3 * nZ4; - n31Z3 = v31X3 * nY4 - v31Y3 * nX4; - var d124 = v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3; - var d233 = v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3; - var d313 = v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3; - var mind4 = -1; - var minv4; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(d124 < 0) { - var v130; - var v1X14; - var v1Y14; - var v1Z14; - var v220; - var v2X14; - var v2Y14; - var v2Z14; - var v95 = vec2; - v1X14 = v95.x; - v1Y14 = v95.y; - v1Z14 = v95.z; - var v96 = vec3; - v2X14 = v96.x; - v2Y14 = v96.y; - v2Z14 = v96.z; - var v1214; - var v12X14; - var v12Y14; - var v12Z14; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - var d22 = v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14; - var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; - t9 = -t9 / d22; - var b12; - if(t9 < 0) { - var v97 = out; - v97.x = v1X14; - v97.y = v1Y14; - v97.z = v1Z14; - b12 = 1; - } else if(t9 > 1) { - var v98 = out; - v98.x = v2X14; - v98.y = v2Y14; - v98.z = v2Z14; - b12 = 2; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 3 | (b & 4) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p9; - var pX9; - var pY9; - var pZ9; - pX9 = v1X14 + v12X14 * t9; - pY9 = v1Y14 + v12Y14 * t9; - pZ9 = v1Z14 + v12Z14 * t9; - var v99 = out; - v99.x = pX9; - v99.y = pY9; - v99.z = pZ9; - b12 = 3; - } - var d24 = out.x * out.x + out.y * out.y + out.z * out.z; - mini4 = b12; - mind4 = d24; - var v100 = out; - minvX4 = v100.x; - minvY4 = v100.y; - minvZ4 = v100.z; - } - if(d233 < 0) { - var v131; - var v1X15; - var v1Y15; - var v1Z15; - var v221; - var v2X15; - var v2Y15; - var v2Z15; - var v101 = vec3; - v1X15 = v101.x; - v1Y15 = v101.y; - v1Z15 = v101.z; - var v102 = vec4; - v2X15 = v102.x; - v2Y15 = v102.y; - v2Z15 = v102.z; - var v1215; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var d25 = v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / d25; - var b13; - if(t10 < 0) { - var v103 = out; - v103.x = v1X15; - v103.y = v1Y15; - v103.z = v1Z15; - b13 = 1; - } else if(t10 > 1) { - var v104 = out; - v104.x = v2X15; - v104.y = v2Y15; - v104.z = v2Z15; - b13 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec3.x; + v1Y = vec3.y; + v1Z = vec3.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p10; - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - var v105 = out; - v105.x = pX10; - v105.y = pY10; - v105.z = pZ10; - b13 = 3; - } - var d26 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d26 < mind4) { - mini4 = b13 << 1; - mind4 = d26; - var v106 = out; - minvX4 = v106.x; - minvY4 = v106.y; - minvZ4 = v106.z; - } - } - if(d313 < 0) { - var v132; - var v1X16; - var v1Y16; - var v1Z16; - var v222; - var v2X16; - var v2Y16; - var v2Z16; - var v107 = vec2; - v1X16 = v107.x; - v1Y16 = v107.y; - v1Z16 = v107.z; - var v108 = vec4; - v2X16 = v108.x; - v2Y16 = v108.y; - v2Z16 = v108.z; - var v1216; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var d27 = v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / d27; - var b14; - if(t11 < 0) { - var v109 = out; - v109.x = v1X16; - v109.y = v1Y16; - v109.z = v1Z16; - b14 = 1; - } else if(t11 > 1) { - var v133 = out; - v133.x = v2X16; - v133.y = v2Y16; - v133.z = v2Z16; - b14 = 2; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var p11; - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - var v134 = out; - v134.x = pX11; - v134.y = pY11; - v134.z = pZ11; - b14 = 3; - } - var d28 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d28 < mind4) { - mini4 = b14 & 1 | (b14 & 2) << 1; - mind4 = d28; - var v135 = out; - minvX4 = v135.x; - minvY4 = v135.y; - minvZ4 = v135.z; - } - } - var b15; - if(mind4 > 0) { - var v136 = out; - v136.x = minvX4; - v136.y = minvY4; - v136.z = minvZ4; - b15 = mini4; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var l4 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - nX4 *= l4; - nY4 *= l4; - nZ4 *= l4; - var dn3 = v1X13 * nX4 + v1Y13 * nY4 + v1Z13 * nZ4; - var l23 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l23 = dn3 / l23; - minvX4 = nX4 * l23; - minvY4 = nY4 * l23; - minvZ4 = nZ4 * l23; - var v137 = out; - v137.x = minvX4; - v137.y = minvY4; - v137.z = minvZ4; - b15 = 7; - } - var d29 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d29 < mind) { - mini = b15 << 1; - mind = d29; - var v138 = out; - minvX = v138.x; - minvY = v138.y; - minvZ = v138.z; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; } } if(mind > 0) { - var v139 = out; - v139.x = minvX; - v139.y = minvY; - v139.z = minvZ; + out.x = minvX; + out.y = minvY; + out.z = minvZ; return mini; } out.zero(); @@ -15264,24 +13391,15 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return this; } identity() { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; return this; } add(m) { @@ -15297,87 +13415,59 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return new oimo.common.Mat3(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22); } addEq(m) { - var t00 = this.e00 + m.e00; - var t01 = this.e01 + m.e01; - var t02 = this.e02 + m.e02; - var t10 = this.e10 + m.e10; - var t11 = this.e11 + m.e11; - var t12 = this.e12 + m.e12; - var t20 = this.e20 + m.e20; - var t21 = this.e21 + m.e21; - var t22 = this.e22 + m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; return this; } subEq(m) { - var t00 = this.e00 - m.e00; - var t01 = this.e01 - m.e01; - var t02 = this.e02 - m.e02; - var t10 = this.e10 - m.e10; - var t11 = this.e11 - m.e11; - var t12 = this.e12 - m.e12; - var t20 = this.e20 - m.e20; - var t21 = this.e21 - m.e21; - var t22 = this.e22 - m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; return this; } scaleEq(s) { - var t00 = this.e00 * s; - var t01 = this.e01 * s; - var t02 = this.e02 * s; - var t10 = this.e10 * s; - var t11 = this.e11 * s; - var t12 = this.e12 * s; - var t20 = this.e20 * s; - var t21 = this.e21 * s; - var t22 = this.e22 * s; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; return this; } mulEq(m) { - var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; - var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; - var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; - var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; - var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; - var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; - var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; - var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; - var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + let e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; + let e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; + let e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; + let e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; + let e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; + let e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; + let e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; + let e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; return this; } prependScale(sx,sy,sz) { @@ -15387,165 +13477,135 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return new oimo.common.Mat3(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e20 * sx,this.e21 * sy,this.e22 * sz); } prependRotation(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo.common.Mat3(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22); } appendRotation(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo.common.Mat3(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22); } prependScaleEq(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sx; - var t02 = this.e02 * sx; - var t10 = this.e10 * sy; - var t11 = this.e11 * sy; - var t12 = this.e12 * sy; - var t20 = this.e20 * sz; - var t21 = this.e21 * sz; - var t22 = this.e22 * sz; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; return this; } appendScaleEq(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sy; - var t02 = this.e02 * sz; - var t10 = this.e10 * sx; - var t11 = this.e11 * sy; - var t12 = this.e12 * sz; - var t20 = this.e20 * sx; - var t21 = this.e21 * sy; - var t22 = this.e22 * sz; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; return this; } prependRotationEq(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; - var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; - var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; - var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + let e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + let e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + let e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + let e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + let e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; return this; } appendRotationEq(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; - var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; - var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; - var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + let e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + let e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + let e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + let e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + let e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; return this; } transpose() { return new oimo.common.Mat3(this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22); } transposeEq() { - var t00 = this.e00; - var t01 = this.e10; - var t02 = this.e20; - var t10 = this.e01; - var t11 = this.e11; - var t12 = this.e21; - var t20 = this.e02; - var t21 = this.e12; - var t22 = this.e22; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + let e10 = this.e01; + let e20 = this.e02; + let e21 = this.e12; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; return this; } determinant() { @@ -15555,51 +13615,35 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return this.e00 + this.e11 + this.e22; } inverse() { - var d00 = this.e11 * this.e22 - this.e12 * this.e21; - var d01 = this.e10 * this.e22 - this.e12 * this.e20; - var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var d10 = this.e01 * this.e22 - this.e02 * this.e21; - var d11 = this.e00 * this.e22 - this.e02 * this.e20; - var d12 = this.e00 * this.e21 - this.e01 * this.e20; - var d20 = this.e01 * this.e12 - this.e02 * this.e11; - var d21 = this.e00 * this.e12 - this.e02 * this.e10; - var d22 = this.e00 * this.e11 - this.e01 * this.e10; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + let d00 = this.e11 * this.e22 - this.e12 * this.e21; + let d01 = this.e10 * this.e22 - this.e12 * this.e20; + let d02 = this.e10 * this.e21 - this.e11 * this.e20; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } - return new oimo.common.Mat3(d00 * invDet,-d10 * invDet,d20 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet); + return new oimo.common.Mat3(d00 * invDet,-(this.e01 * this.e22 - this.e02 * this.e21) * invDet,(this.e01 * this.e12 - this.e02 * this.e11) * invDet,-d01 * invDet,(this.e00 * this.e22 - this.e02 * this.e20) * invDet,-(this.e00 * this.e12 - this.e02 * this.e10) * invDet,d02 * invDet,-(this.e00 * this.e21 - this.e01 * this.e20) * invDet,(this.e00 * this.e11 - this.e01 * this.e10) * invDet); } inverseEq() { - var d00 = this.e11 * this.e22 - this.e12 * this.e21; - var d01 = this.e10 * this.e22 - this.e12 * this.e20; - var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var d10 = this.e01 * this.e22 - this.e02 * this.e21; - var d11 = this.e00 * this.e22 - this.e02 * this.e20; - var d12 = this.e00 * this.e21 - this.e01 * this.e20; - var d20 = this.e01 * this.e12 - this.e02 * this.e11; - var d21 = this.e00 * this.e12 - this.e02 * this.e10; - var d22 = this.e00 * this.e11 - this.e01 * this.e10; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + let d00 = this.e11 * this.e22 - this.e12 * this.e21; + let d01 = this.e10 * this.e22 - this.e12 * this.e20; + let d02 = this.e10 * this.e21 - this.e11 * this.e20; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } - var t00 = d00 * invDet; - var t01 = -d10 * invDet; - var t02 = d20 * invDet; - var t10 = -d01 * invDet; - var t11 = d11 * invDet; - var t12 = -d21 * invDet; - var t20 = d02 * invDet; - var t21 = -d12 * invDet; - var t22 = d22 * invDet; - this.e00 = t00; - this.e01 = t01; + let t02 = (this.e01 * this.e12 - this.e02 * this.e11) * invDet; + let t11 = (this.e00 * this.e22 - this.e02 * this.e20) * invDet; + let t12 = -(this.e00 * this.e12 - this.e02 * this.e10) * invDet; + let t21 = -(this.e00 * this.e21 - this.e01 * this.e20) * invDet; + let t22 = (this.e00 * this.e11 - this.e01 * this.e10) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * this.e22 - this.e02 * this.e21) * invDet; this.e02 = t02; - this.e10 = t10; + this.e10 = -d01 * invDet; this.e11 = t11; this.e12 = t12; - this.e20 = t20; + this.e20 = d02 * invDet; this.e21 = t21; this.e22 = t22; return this; @@ -15630,22 +13674,22 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return new oimo.common.Mat3(this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22); } fromQuat(q) { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = q.x; + let y = q.y; + let z = q.z; + let w = q.w; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this.e00 = 1 - yy - zz; this.e01 = xy - wz; this.e02 = xz + wy; @@ -15658,12 +13702,12 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return this; } toQuat() { - var _this = new oimo.common.Quat(); - var e00 = this.e00; - var e11 = this.e11; - var e22 = this.e22; - var t = e00 + e11 + e22; - var s; + let _this = new oimo.common.Quat(); + let e00 = this.e00; + let e11 = this.e11; + let e22 = this.e22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); _this.w = 0.5 * s; @@ -15705,46 +13749,34 @@ oimo.common.Mat3 = class oimo_common_Mat3 { return _this; } fromEulerXyz(eulerAngles) { - var sx = Math.sin(eulerAngles.x); - var sy = Math.sin(eulerAngles.y); - var sz = Math.sin(eulerAngles.z); - var cx = Math.cos(eulerAngles.x); - var cy = Math.cos(eulerAngles.y); - var cz = Math.cos(eulerAngles.z); - var t00 = cy * cz; - var t01 = -cy * sz; - var t02 = sy; - var t10 = cx * sz + cz * sx * sy; - var t11 = cx * cz - sx * sy * sz; - var t12 = -cy * sx; - var t20 = sx * sz - cx * cz * sy; - var t21 = cz * sx + cx * sy * sz; - var t22 = cx * cy; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + let sx = Math.sin(eulerAngles.x); + let sy = Math.sin(eulerAngles.y); + let sz = Math.sin(eulerAngles.z); + let cx = Math.cos(eulerAngles.x); + let cy = Math.cos(eulerAngles.y); + let cz = Math.cos(eulerAngles.z); + this.e00 = cy * cz; + this.e01 = -cy * sz; + this.e02 = sy; + this.e10 = cx * sz + cz * sx * sy; + this.e11 = cx * cz - sx * sy * sz; + this.e12 = -cy * sx; + this.e20 = sx * sz - cx * cz * sy; + this.e21 = cz * sx + cx * sy * sz; + this.e22 = cx * cy; return this; } toEulerXyz() { - var sy = this.e02; + let sy = this.e02; if(sy <= -1) { - var xSubZ = Math.atan2(this.e21,this.e11); + let xSubZ = Math.atan2(this.e21,this.e11); return new oimo.common.Vec3(xSubZ * 0.5,-1.570796326794895,-xSubZ * 0.5); } if(sy >= 1) { - var xAddZ = Math.atan2(this.e21,this.e11); + let xAddZ = Math.atan2(this.e21,this.e11); return new oimo.common.Vec3(xAddZ * 0.5,1.570796326794895,xAddZ * 0.5); } - var y = Math.asin(sy); - var x = Math.atan2(-this.e12,this.e22); - var z = Math.atan2(-this.e01,this.e00); - return new oimo.common.Vec3(x,y,z); + return new oimo.common.Vec3(Math.atan2(-this.e12,this.e22),Math.asin(sy),Math.atan2(-this.e01,this.e00)); } getRow(index) { if(index == 0) { @@ -15791,45 +13823,27 @@ oimo.common.Mat3 = class oimo_common_Mat3 { } } fromRows(row0,row1,row2) { - var t00 = row0.x; - var t01 = row0.y; - var t02 = row0.z; - var t10 = row1.x; - var t11 = row1.y; - var t12 = row1.z; - var t20 = row2.x; - var t21 = row2.y; - var t22 = row2.z; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = row0.x; + this.e01 = row0.y; + this.e02 = row0.z; + this.e10 = row1.x; + this.e11 = row1.y; + this.e12 = row1.z; + this.e20 = row2.x; + this.e21 = row2.y; + this.e22 = row2.z; return this; } fromCols(col0,col1,col2) { - var t00 = col0.x; - var t01 = col1.x; - var t02 = col2.x; - var t10 = col0.y; - var t11 = col1.y; - var t12 = col2.y; - var t20 = col0.z; - var t21 = col1.z; - var t22 = col2.z; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; + this.e00 = col0.x; + this.e01 = col1.x; + this.e02 = col2.x; + this.e10 = col0.y; + this.e11 = col1.y; + this.e12 = col2.y; + this.e20 = col0.z; + this.e21 = col1.z; + this.e22 = col2.z; return this; } toString() { @@ -15924,38 +13938,22 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return this; } identity() { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t03 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t13 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 = 1; + this.e01 = 0; + this.e02 = 0; + this.e03 = 0; + this.e10 = 0; + this.e11 = 1; + this.e12 = 0; + this.e13 = 0; + this.e20 = 0; + this.e21 = 0; + this.e22 = 1; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } add(m) { @@ -15971,143 +13969,94 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return new oimo.common.Mat4(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32,this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32,this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32,this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33,this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30,this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31,this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32,this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33); } addEq(m) { - var t00 = this.e00 + m.e00; - var t01 = this.e01 + m.e01; - var t02 = this.e02 + m.e02; - var t03 = this.e03 + m.e03; - var t10 = this.e10 + m.e10; - var t11 = this.e11 + m.e11; - var t12 = this.e12 + m.e12; - var t13 = this.e13 + m.e13; - var t20 = this.e20 + m.e20; - var t21 = this.e21 + m.e21; - var t22 = this.e22 + m.e22; - var t23 = this.e23 + m.e23; - var t30 = this.e30 + m.e30; - var t31 = this.e31 + m.e31; - var t32 = this.e32 + m.e32; - var t33 = this.e33 + m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 += m.e00; + this.e01 += m.e01; + this.e02 += m.e02; + this.e03 += m.e03; + this.e10 += m.e10; + this.e11 += m.e11; + this.e12 += m.e12; + this.e13 += m.e13; + this.e20 += m.e20; + this.e21 += m.e21; + this.e22 += m.e22; + this.e23 += m.e23; + this.e30 += m.e30; + this.e31 += m.e31; + this.e32 += m.e32; + this.e33 += m.e33; return this; } subEq(m) { - var t00 = this.e00 - m.e00; - var t01 = this.e01 - m.e01; - var t02 = this.e02 - m.e02; - var t03 = this.e03 - m.e03; - var t10 = this.e10 - m.e10; - var t11 = this.e11 - m.e11; - var t12 = this.e12 - m.e12; - var t13 = this.e13 - m.e13; - var t20 = this.e20 - m.e20; - var t21 = this.e21 - m.e21; - var t22 = this.e22 - m.e22; - var t23 = this.e23 - m.e23; - var t30 = this.e30 - m.e30; - var t31 = this.e31 - m.e31; - var t32 = this.e32 - m.e32; - var t33 = this.e33 - m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 -= m.e00; + this.e01 -= m.e01; + this.e02 -= m.e02; + this.e03 -= m.e03; + this.e10 -= m.e10; + this.e11 -= m.e11; + this.e12 -= m.e12; + this.e13 -= m.e13; + this.e20 -= m.e20; + this.e21 -= m.e21; + this.e22 -= m.e22; + this.e23 -= m.e23; + this.e30 -= m.e30; + this.e31 -= m.e31; + this.e32 -= m.e32; + this.e33 -= m.e33; return this; } scaleEq(s) { - var t00 = this.e00 * s; - var t01 = this.e01 * s; - var t02 = this.e02 * s; - var t03 = this.e03 * s; - var t10 = this.e10 * s; - var t11 = this.e11 * s; - var t12 = this.e12 * s; - var t13 = this.e13 * s; - var t20 = this.e20 * s; - var t21 = this.e21 * s; - var t22 = this.e22 * s; - var t23 = this.e23 * s; - var t30 = this.e30 * s; - var t31 = this.e31 * s; - var t32 = this.e32 * s; - var t33 = this.e33 * s; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= s; + this.e01 *= s; + this.e02 *= s; + this.e03 *= s; + this.e10 *= s; + this.e11 *= s; + this.e12 *= s; + this.e13 *= s; + this.e20 *= s; + this.e21 *= s; + this.e22 *= s; + this.e23 *= s; + this.e30 *= s; + this.e31 *= s; + this.e32 *= s; + this.e33 *= s; return this; } mulEq(m) { - var t00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; - var t01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; - var t02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; - var t03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; - var t10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; - var t11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; - var t12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; - var t13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; - var t20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; - var t21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; - var t22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; - var t23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; - var t30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; - var t31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; - var t32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; - var t33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + let e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; + let e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; + let e03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; + let e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; + let e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; + let e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; + let e13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; + let e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; + let e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; + let e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; + let e23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; + let e30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; + let e31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; + let e32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; + let e33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; + this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; return this; } prependScale(sx,sy,sz) { @@ -16117,33 +14066,33 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return new oimo.common.Mat4(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e03,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e13,this.e20 * sx,this.e21 * sy,this.e22 * sz,this.e23,this.e30 * sx,this.e31 * sy,this.e32 * sz,this.e33); } prependRotation(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo.common.Mat4(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r00 * this.e03 + r01 * this.e13 + r02 * this.e23,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r10 * this.e03 + r11 * this.e13 + r12 * this.e23,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22,r20 * this.e03 + r21 * this.e13 + r22 * this.e23,this.e30,this.e31,this.e32,this.e33); } appendRotation(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo.common.Mat4(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e03,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e13,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22,this.e23,this.e30 * r00 + this.e31 * r10 + this.e32 * r20,this.e30 * r01 + this.e31 * r11 + this.e32 * r21,this.e30 * r02 + this.e31 * r12 + this.e32 * r22,this.e33); } prependTranslation(tx,ty,tz) { @@ -16153,409 +14102,289 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return new oimo.common.Mat4(this.e00,this.e01,this.e02,this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03,this.e10,this.e11,this.e12,this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13,this.e20,this.e21,this.e22,this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23,this.e30,this.e31,this.e32,this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33); } prependScaleEq(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sx; - var t02 = this.e02 * sx; - var t03 = this.e03 * sx; - var t10 = this.e10 * sy; - var t11 = this.e11 * sy; - var t12 = this.e12 * sy; - var t13 = this.e13 * sy; - var t20 = this.e20 * sz; - var t21 = this.e21 * sz; - var t22 = this.e22 * sz; - var t23 = this.e23 * sz; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= sx; + this.e01 *= sx; + this.e02 *= sx; + this.e03 *= sx; + this.e10 *= sy; + this.e11 *= sy; + this.e12 *= sy; + this.e13 *= sy; + this.e20 *= sz; + this.e21 *= sz; + this.e22 *= sz; + this.e23 *= sz; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } appendScaleEq(sx,sy,sz) { - var t00 = this.e00 * sx; - var t01 = this.e01 * sy; - var t02 = this.e02 * sz; - var t03 = this.e03; - var t10 = this.e10 * sx; - var t11 = this.e11 * sy; - var t12 = this.e12 * sz; - var t13 = this.e13; - var t20 = this.e20 * sx; - var t21 = this.e21 * sy; - var t22 = this.e22 * sz; - var t23 = this.e23; - var t30 = this.e30 * sx; - var t31 = this.e31 * sy; - var t32 = this.e32 * sz; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 *= sx; + this.e01 *= sy; + this.e02 *= sz; + this.e03 = this.e03; + this.e10 *= sx; + this.e11 *= sy; + this.e12 *= sz; + this.e13 = this.e13; + this.e20 *= sx; + this.e21 *= sy; + this.e22 *= sz; + this.e23 = this.e23; + this.e30 *= sx; + this.e31 *= sy; + this.e32 *= sz; + this.e33 = this.e33; return this; } prependRotationEq(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var t00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; - var t01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; - var t02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; - var t03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; - var t10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var t11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var t12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var t13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; - var t20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var t21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var t22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; - var t23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + let e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + let e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + let e13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; + let e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + let e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + let e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + let e23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; + this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; + this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; + this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; + this.e03 = r00 * this.e03 + r01 * this.e13 + r02 * this.e23; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } appendRotationEq(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var t00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; - var t01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var t02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var t03 = this.e03; - var t10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; - var t11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var t12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var t13 = this.e13; - var t20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; - var t21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var t22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; - var t23 = this.e23; - var t30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; - var t31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; - var t32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + let e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + let e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + let e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + let e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + let e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + let e31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; + let e32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; + this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; + this.e01 = e01; + this.e02 = e02; + this.e03 = this.e03; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; + this.e11 = e11; + this.e12 = e12; + this.e13 = this.e13; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; + this.e21 = e21; + this.e22 = e22; + this.e23 = this.e23; + this.e30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; return this; } prependTranslationEq(tx,ty,tz) { - var t00 = this.e00 + tx * this.e30; - var t01 = this.e01 + tx * this.e31; - var t02 = this.e02 + tx * this.e32; - var t03 = this.e03 + tx * this.e33; - var t10 = this.e10 + ty * this.e30; - var t11 = this.e11 + ty * this.e31; - var t12 = this.e12 + ty * this.e32; - var t13 = this.e13 + ty * this.e33; - var t20 = this.e20 + tz * this.e30; - var t21 = this.e21 + tz * this.e31; - var t22 = this.e22 + tz * this.e32; - var t23 = this.e23 + tz * this.e33; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 += tx * this.e30; + this.e01 += tx * this.e31; + this.e02 += tx * this.e32; + this.e03 += tx * this.e33; + this.e10 += ty * this.e30; + this.e11 += ty * this.e31; + this.e12 += ty * this.e32; + this.e13 += ty * this.e33; + this.e20 += tz * this.e30; + this.e21 += tz * this.e31; + this.e22 += tz * this.e32; + this.e23 += tz * this.e33; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = this.e33; return this; } appendTranslationEq(tx,ty,tz) { - var t00 = this.e00; - var t01 = this.e01; - var t02 = this.e02; - var t03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; - var t10 = this.e10; - var t11 = this.e11; - var t12 = this.e12; - var t13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; - var t20 = this.e20; - var t21 = this.e21; - var t22 = this.e22; - var t23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; - var t30 = this.e30; - var t31 = this.e31; - var t32 = this.e32; - var t33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + let e03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; + let e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; + let e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; + let e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; + this.e00 = this.e00; + this.e01 = this.e01; + this.e02 = this.e02; + this.e03 = e03; + this.e10 = this.e10; + this.e11 = this.e11; + this.e12 = this.e12; + this.e13 = e13; + this.e20 = this.e20; + this.e21 = this.e21; + this.e22 = this.e22; + this.e23 = e23; + this.e30 = this.e30; + this.e31 = this.e31; + this.e32 = this.e32; + this.e33 = e33; return this; } transpose() { return new oimo.common.Mat4(this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33); } transposeEq() { - var t00 = this.e00; - var t01 = this.e10; - var t02 = this.e20; - var t03 = this.e30; - var t10 = this.e01; - var t11 = this.e11; - var t12 = this.e21; - var t13 = this.e31; - var t20 = this.e02; - var t21 = this.e12; - var t22 = this.e22; - var t23 = this.e32; - var t30 = this.e03; - var t31 = this.e13; - var t32 = this.e23; - var t33 = this.e33; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + let e10 = this.e01; + let e20 = this.e02; + let e21 = this.e12; + let e30 = this.e03; + let e31 = this.e13; + let e32 = this.e23; + this.e00 = this.e00; + this.e01 = this.e10; + this.e02 = this.e20; + this.e03 = this.e30; + this.e10 = e10; + this.e11 = this.e11; + this.e12 = this.e21; + this.e13 = this.e31; + this.e20 = e20; + this.e21 = e21; + this.e22 = this.e22; + this.e23 = this.e32; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = this.e33; return this; } determinant() { - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; return this.e00 * (this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12) - this.e01 * (this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02) + this.e02 * (this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01) - this.e03 * (this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01); } trace() { return this.e00 + this.e11 + this.e22 + this.e33; } inverse() { - var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; - var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; - var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; - var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; - var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; - var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; - var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; - var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; - var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; - var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; - var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; - var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; - var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; - var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; - var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; - var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; - var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; - var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; - var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; - var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; - var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + let d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + let d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + let d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + let d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + let d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + let d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + let d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + let d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + let d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + let d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } - return new oimo.common.Mat4(d00 * invDet,-d10 * invDet,d20 * invDet,-d30 * invDet,-d01 * invDet,d11 * invDet,-d21 * invDet,d31 * invDet,d02 * invDet,-d12 * invDet,d22 * invDet,-d32 * invDet,-d03 * invDet,d13 * invDet,-d23 * invDet,d33 * invDet); + return new oimo.common.Mat4(d00 * invDet,-(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet,(this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet,-(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet,-d01 * invDet,(this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet,-(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet,(this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet,d02 * invDet,-(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet,(this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet,-(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet,-d03 * invDet,(this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet,-(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet,(this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet); } inverseEq() { - var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; - var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; - var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; - var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; - var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; - var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; - var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; - var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; - var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; - var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var d10 = this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12; - var d11 = this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02; - var d12 = this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01; - var d13 = this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01; - var d20 = this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12; - var d21 = this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02; - var d22 = this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01; - var d23 = this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01; - var d30 = this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12; - var d31 = this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02; - var d32 = this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01; - var d33 = this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + let d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + let d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + let d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + let d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + let d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + let d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + let d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + let d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + let d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + let d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } - var t00 = d00 * invDet; - var t01 = -d10 * invDet; - var t02 = d20 * invDet; - var t03 = -d30 * invDet; - var t10 = -d01 * invDet; - var t11 = d11 * invDet; - var t12 = -d21 * invDet; - var t13 = d31 * invDet; - var t20 = d02 * invDet; - var t21 = -d12 * invDet; - var t22 = d22 * invDet; - var t23 = -d32 * invDet; - var t30 = -d03 * invDet; - var t31 = d13 * invDet; - var t32 = -d23 * invDet; - var t33 = d33 * invDet; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; + let t11 = (this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet; + let t21 = -(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet; + let t23 = -(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet; + let t31 = (this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet; + let t32 = -(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet; + let t33 = (this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet; + this.e00 = d00 * invDet; + this.e01 = -(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet; + this.e02 = (this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet; + this.e03 = -(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet; + this.e10 = -d01 * invDet; this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; + this.e12 = -(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet; + this.e13 = (this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet; + this.e20 = d02 * invDet; this.e21 = t21; - this.e22 = t22; + this.e22 = (this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet; this.e23 = t23; - this.e30 = t30; + this.e30 = -d03 * invDet; this.e31 = t31; this.e32 = t32; this.e33 = t33; return this; } lookAt(eyeX,eyeY,eyeZ,atX,atY,atZ,upX,upY,upZ) { - var zx = eyeX - atX; - var zy = eyeY - atY; - var zz = eyeZ - atZ; - var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + let zx = eyeX - atX; + let zy = eyeY - atY; + let zz = eyeZ - atZ; + let tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); zx *= tmp; zy *= tmp; zz *= tmp; - var xx = upY * zz - upZ * zy; - var xy = upZ * zx - upX * zz; - var xz = upX * zy - upY * zx; + let xx = upY * zz - upZ * zy; + let xy = upZ * zx - upX * zz; + let xz = upX * zy - upY * zx; tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); xx *= tmp; xy *= tmp; xz *= tmp; - var yx = zy * xz - zz * xy; - var yy = zz * xx - zx * xz; - var yz = zx * xy - zy * xx; + let yx = zy * xz - zz * xy; + let yy = zz * xx - zx * xz; + let yz = zx * xy - zy * xx; this.e00 = xx; this.e01 = xy; this.e02 = xz; @@ -16575,8 +14404,8 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return this; } perspective(fovY,aspect,near,far) { - var h = 1 / Math.tan(fovY * 0.5); - var fnf = far / (near - far); + let h = 1 / Math.tan(fovY * 0.5); + let fnf = far / (near - far); this.e00 = h / aspect; this.e01 = 0; this.e02 = 0; @@ -16596,7 +14425,7 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return this; } ortho(width,height,near,far) { - var nf = 1 / (near - far); + let nf = 1 / (near - far); this.e00 = 2 / width; this.e01 = 0; this.e02 = 0; @@ -16645,58 +14474,41 @@ oimo.common.Mat4 = class oimo_common_Mat4 { return this; } fromMat3(m) { - var t00 = m.e00; - var t01 = m.e01; - var t02 = m.e02; - var t03 = 0; - var t10 = m.e10; - var t11 = m.e11; - var t12 = m.e12; - var t13 = 0; - var t20 = m.e20; - var t21 = m.e21; - var t22 = m.e22; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - this.e00 = t00; - this.e01 = t01; - this.e02 = t02; - this.e03 = t03; - this.e10 = t10; - this.e11 = t11; - this.e12 = t12; - this.e13 = t13; - this.e20 = t20; - this.e21 = t21; - this.e22 = t22; - this.e23 = t23; - this.e30 = t30; - this.e31 = t31; - this.e32 = t32; - this.e33 = t33; + this.e00 = m.e00; + this.e01 = m.e01; + this.e02 = m.e02; + this.e03 = 0; + this.e10 = m.e10; + this.e11 = m.e11; + this.e12 = m.e12; + this.e13 = 0; + this.e20 = m.e20; + this.e21 = m.e21; + this.e22 = m.e22; + this.e23 = 0; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } fromTransform(transform) { - var m = this; - m.e00 = transform._rotation00; - m.e01 = transform._rotation01; - m.e02 = transform._rotation02; - m.e10 = transform._rotation10; - m.e11 = transform._rotation11; - m.e12 = transform._rotation12; - m.e20 = transform._rotation20; - m.e21 = transform._rotation21; - m.e22 = transform._rotation22; - m.e03 = transform._positionX; - m.e13 = transform._positionY; - m.e23 = transform._positionZ; - m.e30 = 0; - m.e31 = 0; - m.e32 = 0; - m.e33 = 1; + this.e00 = transform._rotation00; + this.e01 = transform._rotation01; + this.e02 = transform._rotation02; + this.e10 = transform._rotation10; + this.e11 = transform._rotation11; + this.e12 = transform._rotation12; + this.e20 = transform._rotation20; + this.e21 = transform._rotation21; + this.e22 = transform._rotation22; + this.e03 = transform._positionX; + this.e13 = transform._positionY; + this.e23 = transform._positionZ; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } clone() { @@ -16780,17 +14592,13 @@ oimo.common.MathUtil = class oimo_common_MathUtil { } oimo.common.Pool = class oimo_common_Pool { constructor() { - var this1 = new Array(256); - this.stackVec3 = this1; + this.stackVec3 = new Array(256); this.sizeVec3 = 0; - var this2 = new Array(256); - this.stackMat3 = this2; + this.stackMat3 = new Array(256); this.sizeMat3 = 0; - var this3 = new Array(256); - this.stackMat4 = this3; + this.stackMat4 = new Array(256); this.sizeMat4 = 0; - var this4 = new Array(256); - this.stackQuat = this4; + this.stackQuat = new Array(256); this.sizeQuat = 0; } vec3() { @@ -16825,13 +14633,11 @@ oimo.common.Pool = class oimo_common_Pool { if(vec3 != null) { vec3.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newLength = this.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.sizeVec3; + let newArray = new Array(this.sizeVec3 << 1); + let _g = 0; + let _g1 = this.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -16840,108 +14646,73 @@ oimo.common.Pool = class oimo_common_Pool { this.stackVec3[this.sizeVec3++] = vec3; } if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; + mat3.e00 = 1; + mat3.e01 = 0; + mat3.e02 = 0; + mat3.e10 = 0; + mat3.e11 = 1; + mat3.e12 = 0; + mat3.e20 = 0; + mat3.e21 = 0; + mat3.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newLength1 = this.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = this.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.stackMat3[i1]; - this.stackMat3[i1] = null; - } - this.stackMat3 = newArray1; + let newArray = new Array(this.sizeMat3 << 1); + let _g = 0; + let _g1 = this.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackMat3[i]; + this.stackMat3[i] = null; + } + this.stackMat3 = newArray; } this.stackMat3[this.sizeMat3++] = mat3; } if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; + mat4.e00 = 1; + mat4.e01 = 0; + mat4.e02 = 0; + mat4.e03 = 0; + mat4.e10 = 0; + mat4.e11 = 1; + mat4.e12 = 0; + mat4.e13 = 0; + mat4.e20 = 0; + mat4.e21 = 0; + mat4.e22 = 1; + mat4.e23 = 0; + mat4.e30 = 0; + mat4.e31 = 0; + mat4.e32 = 0; + mat4.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newLength2 = this.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = this.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.stackMat4[i2]; - this.stackMat4[i2] = null; - } - this.stackMat4 = newArray2; + let newArray = new Array(this.sizeMat4 << 1); + let _g = 0; + let _g1 = this.sizeMat4; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackMat4[i]; + this.stackMat4[i] = null; + } + this.stackMat4 = newArray; } this.stackMat4[this.sizeMat4++] = mat4; } if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; + quat.x = 0; + quat.y = 0; + quat.z = 0; + quat.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newLength3 = this.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = this.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = this.stackQuat[i3]; - this.stackQuat[i3] = null; - } - this.stackQuat = newArray3; + let newArray = new Array(this.sizeQuat << 1); + let _g = 0; + let _g1 = this.sizeQuat; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackQuat[i]; + this.stackQuat[i] = null; + } + this.stackQuat = newArray; } this.stackQuat[this.sizeQuat++] = quat; } @@ -16949,13 +14720,11 @@ oimo.common.Pool = class oimo_common_Pool { disposeVec3(v) { v.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newLength = this.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.sizeVec3; + let newArray = new Array(this.sizeVec3 << 1); + let _g = 0; + let _g1 = this.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -16964,32 +14733,21 @@ oimo.common.Pool = class oimo_common_Pool { this.stackVec3[this.sizeVec3++] = v; } disposeMat3(m) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newLength = this.sizeMat3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.sizeMat3; + let newArray = new Array(this.sizeMat3 << 1); + let _g = 0; + let _g1 = this.sizeMat3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackMat3[i]; this.stackMat3[i] = null; } @@ -16998,46 +14756,28 @@ oimo.common.Pool = class oimo_common_Pool { this.stackMat3[this.sizeMat3++] = m; } disposeMat4(m) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t03 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t13 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - m.e00 = t00; - m.e01 = t01; - m.e02 = t02; - m.e03 = t03; - m.e10 = t10; - m.e11 = t11; - m.e12 = t12; - m.e13 = t13; - m.e20 = t20; - m.e21 = t21; - m.e22 = t22; - m.e23 = t23; - m.e30 = t30; - m.e31 = t31; - m.e32 = t32; - m.e33 = t33; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e03 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e13 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + m.e23 = 0; + m.e30 = 0; + m.e31 = 0; + m.e32 = 0; + m.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newLength = this.sizeMat4 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.sizeMat4; + let newArray = new Array(this.sizeMat4 << 1); + let _g = 0; + let _g1 = this.sizeMat4; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackMat4[i]; this.stackMat4[i] = null; } @@ -17046,22 +14786,16 @@ oimo.common.Pool = class oimo_common_Pool { this.stackMat4[this.sizeMat4++] = m; } disposeQuat(q) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - q.x = tx; - q.y = ty; - q.z = tz; - q.w = tw; + q.x = 0; + q.y = 0; + q.z = 0; + q.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newLength = this.sizeQuat << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.sizeQuat; + let newArray = new Array(this.sizeQuat << 1); + let _g = 0; + let _g1 = this.sizeQuat; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackQuat[i]; this.stackQuat[i] = null; } @@ -17091,14 +14825,10 @@ oimo.common.Quat = class oimo_common_Quat { oimo.common.Quat.numCreations++; } identity() { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; return this; } init(x,y,z,w) { @@ -17118,36 +14848,24 @@ oimo.common.Quat = class oimo_common_Quat { return new oimo.common.Quat(this.x * s,this.y * s,this.z * s,this.w * s); } addEq(q) { - var tx = this.x + q.x; - var ty = this.y + q.y; - var tz = this.z + q.z; - var tw = this.w + q.w; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x += q.x; + this.y += q.y; + this.z += q.z; + this.w += q.w; return this; } subEq(q) { - var tx = this.x - q.x; - var ty = this.y - q.y; - var tz = this.z - q.z; - var tw = this.w - q.w; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x -= q.x; + this.y -= q.y; + this.z -= q.z; + this.w -= q.w; return this; } scaleEq(s) { - var tx = this.x * s; - var ty = this.y * s; - var tz = this.z * s; - var tw = this.w * s; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x *= s; + this.y *= s; + this.z *= s; + this.w *= s; return this; } length() { @@ -17160,35 +14878,31 @@ oimo.common.Quat = class oimo_common_Quat { return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; } normalized() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); if(invLen > 0) { invLen = 1 / invLen; } return new oimo.common.Quat(this.x * invLen,this.y * invLen,this.z * invLen,this.w * invLen); } normalize() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); if(invLen > 0) { invLen = 1 / invLen; } - var tx = this.x * invLen; - var ty = this.y * invLen; - var tz = this.z * invLen; - var tw = this.w * invLen; - this.x = tx; - this.y = ty; - this.z = tz; - this.w = tw; + this.x *= invLen; + this.y *= invLen; + this.z *= invLen; + this.w *= invLen; return this; } setArc(v1,v2) { - var x1 = v1.x; - var y1 = v1.y; - var z1 = v1.z; - var x2 = v2.x; - var y2 = v2.y; - var z2 = v2.z; - var d = x1 * x2 + y1 * y2 + z1 * z2; + let x1 = v1.x; + let y1 = v1.y; + let z1 = v1.z; + let x2 = v2.x; + let y2 = v2.y; + let z2 = v2.z; + let d = x1 * x2 + y1 * y2 + z1 * z2; this.w = Math.sqrt((1 + d) * 0.5); if(this.w == 0) { x2 = x1 * x1; @@ -17220,20 +14934,17 @@ oimo.common.Quat = class oimo_common_Quat { return this; } d = 0.5 / this.w; - var cx = y1 * z2 - z1 * y2; - var cy = z1 * x2 - x1 * z2; - var cz = x1 * y2 - y1 * x2; - this.x = cx * d; - this.y = cy * d; - this.z = cz * d; + this.x = (y1 * z2 - z1 * y2) * d; + this.y = (z1 * x2 - x1 * z2) * d; + this.z = (x1 * y2 - y1 * x2) * d; return this; } slerp(q,t) { - var qx; - var qy; - var qz; - var qw; - var d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + let qx; + let qy; + let qz; + let qw; + let d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; if(d < 0) { d = -d; qx = -q.x; @@ -17247,33 +14958,29 @@ oimo.common.Quat = class oimo_common_Quat { qw = q.w; } if(d > 0.999999) { - var _this = new oimo.common.Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); + let _this = new oimo.common.Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); if(invLen > 0) { invLen = 1 / invLen; } - var tx = _this.x * invLen; - var ty = _this.y * invLen; - var tz = _this.z * invLen; - var tw = _this.w * invLen; - _this.x = tx; - _this.y = ty; - _this.z = tz; - _this.w = tw; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + _this.w *= invLen; return _this; } - var theta = t * Math.acos(d); + let theta = t * Math.acos(d); qx -= this.x * d; qy -= this.y * d; qz -= this.z * d; qw -= this.w * d; - var invLen1 = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); - qx *= invLen1; - qy *= invLen1; - qz *= invLen1; - qw *= invLen1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let invLen = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); + qx *= invLen; + qy *= invLen; + qz *= invLen; + qw *= invLen; + let sin = Math.sin(theta); + let cos = Math.cos(theta); return new oimo.common.Quat(this.x * cos + qx * sin,this.y * cos + qy * sin,this.z * cos + qz * sin,this.w * cos + qw * sin); } copyFrom(q) { @@ -17287,11 +14994,11 @@ oimo.common.Quat = class oimo_common_Quat { return new oimo.common.Quat(this.x,this.y,this.z,this.w); } fromMat3(m) { - var e00 = m.e00; - var e11 = m.e11; - var e22 = m.e22; - var t = e00 + e11 + e22; - var s; + let e00 = m.e00; + let e11 = m.e11; + let e22 = m.e22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); this.w = 0.5 * s; @@ -17333,23 +15040,23 @@ oimo.common.Quat = class oimo_common_Quat { return this; } toMat3() { - var _this = new oimo.common.Mat3(); - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let _this = new oimo.common.Mat3(); + let x = this.x; + let y = this.y; + let z = this.z; + let w = this.w; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this.e00 = 1 - yy - zz; _this.e01 = xy - wz; _this.e02 = xz + wy; @@ -17390,11 +15097,10 @@ oimo.dynamics.Contact = class oimo_dynamics_Contact { if(this._detector == null) { return; } - var ptouching = this._touching; - var result = this._detectorResult; + let ptouching = this._touching; + let result = this._detectorResult; this._detector.detect(result,this._s1._geom,this._s2._geom,this._s1._transform,this._s2._transform,this._cachedDetectorData); - var num = result.numPoints; - this._touching = num > 0; + this._touching = result.numPoints > 0; if(this._touching) { this._manifold._buildBasis(result.normal); if(result.getMaxDepth() > oimo.common.Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold) { @@ -17411,8 +15117,8 @@ oimo.dynamics.Contact = class oimo_dynamics_Contact { this._manifold._clear(); } if(this._touching && !ptouching) { - var cc1 = this._s1._contactCallback; - var cc2 = this._s2._contactCallback; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; if(cc1 == cc2) { cc2 = null; } @@ -17424,35 +15130,35 @@ oimo.dynamics.Contact = class oimo_dynamics_Contact { } } if(!this._touching && ptouching) { - var cc11 = this._s1._contactCallback; - var cc21 = this._s2._contactCallback; - if(cc11 == cc21) { - cc21 = null; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; } - if(cc11 != null) { - cc11.endContact(this); + if(cc1 != null) { + cc1.endContact(this); } - if(cc21 != null) { - cc21.endContact(this); + if(cc2 != null) { + cc2.endContact(this); } } if(this._touching) { - var cc12 = this._s1._contactCallback; - var cc22 = this._s2._contactCallback; - if(cc12 == cc22) { - cc22 = null; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; } - if(cc12 != null) { - cc12.preSolve(this); + if(cc1 != null) { + cc1.preSolve(this); } - if(cc22 != null) { - cc22.preSolve(this); + if(cc2 != null) { + cc2.preSolve(this); } } } _postSolve() { - var cc1 = this._s1._contactCallback; - var cc2 = this._s2._contactCallback; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; if(cc1 == cc2) { cc2 = null; } @@ -17512,12 +15218,12 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { this._numContacts = 0; } createContacts() { - var pp = this._broadPhase._proxyPairList; + let pp = this._broadPhase._proxyPairList; while(pp != null) { - var n = pp._next; + let n = pp._next; while(true) { - var s1; - var s2; + let s1; + let s2; if(pp._p1._id < pp._p2._id) { s1 = pp._p1.userData; s2 = pp._p2.userData; @@ -17528,77 +15234,74 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { if(!this.shouldCollide(s1,s2)) { break; } - var b1 = s1._rigidBody; - var b2 = s2._rigidBody; - var n1 = b1._numContactLinks; - var n2 = b2._numContactLinks; - var l; - if(n1 < n2) { + let b1 = s1._rigidBody; + let b2 = s2._rigidBody; + let l; + if(b1._numContactLinks < b2._numContactLinks) { l = b1._contactLinkList; } else { l = b2._contactLinkList; } - var id1 = s1._id; - var id2 = s2._id; - var found = false; + let id1 = s1._id; + let id2 = s2._id; + let found = false; while(l != null) { - var n3 = l._next; - var c = l._contact; + let c = l._contact; if(c._s1._id == id1 && c._s2._id == id2) { c._latest = true; found = true; break; } - l = n3; + l = l._next; } if(!found) { - var first = this._contactPool; + let first = this._contactPool; if(first != null) { this._contactPool = first._next; first._next = null; } else { first = new oimo.dynamics.Contact(); } - var c1 = first; + let c = first; if(this._contactList == null) { - this._contactList = c1; - this._contactListLast = c1; + this._contactList = c; + this._contactListLast = c; } else { - this._contactListLast._next = c1; - c1._prev = this._contactListLast; - this._contactListLast = c1; - } - c1._latest = true; - var detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; - c1._s1 = s1; - c1._s2 = s2; - c1._b1 = s1._rigidBody; - c1._b2 = s2._rigidBody; - c1._touching = false; - if(c1._b1._contactLinkList == null) { - c1._b1._contactLinkList = c1._link1; - c1._b1._contactLinkListLast = c1._link1; + this._contactListLast._next = c; + c._prev = this._contactListLast; + this._contactListLast = c; + } + c._latest = true; + let detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; + c._s1 = s1; + c._s2 = s2; + c._b1 = s1._rigidBody; + c._b2 = s2._rigidBody; + c._touching = false; + if(c._b1._contactLinkList == null) { + c._b1._contactLinkList = c._link1; + c._b1._contactLinkListLast = c._link1; } else { - c1._b1._contactLinkListLast._next = c1._link1; - c1._link1._prev = c1._b1._contactLinkListLast; - c1._b1._contactLinkListLast = c1._link1; + c._b1._contactLinkListLast._next = c._link1; + c._link1._prev = c._b1._contactLinkListLast; + c._b1._contactLinkListLast = c._link1; } - if(c1._b2._contactLinkList == null) { - c1._b2._contactLinkList = c1._link2; - c1._b2._contactLinkListLast = c1._link2; + if(c._b2._contactLinkList == null) { + c._b2._contactLinkList = c._link2; + c._b2._contactLinkListLast = c._link2; } else { - c1._b2._contactLinkListLast._next = c1._link2; - c1._link2._prev = c1._b2._contactLinkListLast; - c1._b2._contactLinkListLast = c1._link2; - } - c1._b1._numContactLinks++; - c1._b2._numContactLinks++; - c1._link1._other = c1._b2; - c1._link2._other = c1._b1; - c1._link1._contact = c1; - c1._link2._contact = c1; - c1._detector = detector; - var _this = c1._contactConstraint; + c._b2._contactLinkListLast._next = c._link2; + c._link2._prev = c._b2._contactLinkListLast; + c._b2._contactLinkListLast = c._link2; + } + c._b1._numContactLinks++; + c._b2._numContactLinks++; + c._link1._other = c._b2; + c._link2._other = c._b1; + c._link1._contact = c; + c._link2._contact = c; + c._detector = detector; + let _this = c._contactConstraint; _this._s1 = s1; _this._s2 = s2; _this._b1 = _this._s1._rigidBody; @@ -17607,18 +15310,16 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { _this._tf2 = _this._b2._transform; this._numContacts++; } - if(!false) { - break; - } + break; } pp = n; } } destroyOutdatedContacts() { - var incremental = this._broadPhase._incremental; - var c = this._contactList; + let incremental = this._broadPhase._incremental; + let c = this._contactList; while(c != null) { - var n = c._next; + let n = c._next; while(true) { if(c._latest) { c._latest = false; @@ -17626,8 +15327,8 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { break; } if(!incremental) { - var prev = c._prev; - var next = c._next; + let prev = c._prev; + let next = c._next; if(prev != null) { prev._next = next; } @@ -17643,8 +15344,8 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; - var cc2 = c._s2._contactCallback; + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; if(cc1 == cc2) { cc2 = null; } @@ -17655,8 +15356,8 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { cc2.endContact(c); } } - var prev1 = c._link1._prev; - var next1 = c._link1._next; + let prev1 = c._link1._prev; + let next1 = c._link1._next; if(prev1 != null) { prev1._next = next1; } @@ -17671,8 +15372,8 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { } c._link1._next = null; c._link1._prev = null; - var prev2 = c._link2._prev; - var next2 = c._link2._next; + let prev2 = c._link2._prev; + let next2 = c._link2._next; if(prev2 != null) { prev2._next = next2; } @@ -17701,7 +15402,7 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this = c._contactConstraint; + let _this = c._contactConstraint; _this._s1 = null; _this._s2 = null; _this._b1 = null; @@ -17713,28 +15414,26 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { this._numContacts--; break; } - var s1 = c._s1; - var s2 = c._s2; - var r1 = s1._rigidBody; - var r2 = s2._rigidBody; - var active1 = !r1._sleeping && r1._type != 1; - var active2 = !r2._sleeping && r2._type != 1; - if(!active1 && !active2) { + let s1 = c._s1; + let s2 = c._s2; + let r1 = s1._rigidBody; + let r2 = s2._rigidBody; + if(!(!r1._sleeping && r1._type != 1) && !(!r2._sleeping && r2._type != 1)) { c._shouldBeSkipped = true; break; } - var aabb1 = s1._aabb; - var aabb2 = s2._aabb; - var proxy1 = s1._proxy; - var proxy2 = s2._proxy; + let aabb1 = s1._aabb; + let aabb2 = s2._aabb; + let proxy1 = s1._proxy; + let proxy2 = s2._proxy; if(!(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ && proxy1._aabbMaxZ > proxy2._aabbMinZ) || !this.shouldCollide(s1,s2)) { - var prev3 = c._prev; - var next3 = c._next; - if(prev3 != null) { - prev3._next = next3; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next3 != null) { - next3._prev = prev3; + if(next != null) { + next._prev = prev; } if(c == this._contactList) { this._contactList = this._contactList._next; @@ -17745,25 +15444,25 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { c._next = null; c._prev = null; if(c._touching) { - var cc11 = c._s1._contactCallback; - var cc21 = c._s2._contactCallback; - if(cc11 == cc21) { - cc21 = null; + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; } - if(cc11 != null) { - cc11.endContact(c); + if(cc1 != null) { + cc1.endContact(c); } - if(cc21 != null) { - cc21.endContact(c); + if(cc2 != null) { + cc2.endContact(c); } } - var prev4 = c._link1._prev; - var next4 = c._link1._next; - if(prev4 != null) { - prev4._next = next4; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next4 != null) { - next4._prev = prev4; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -17773,13 +15472,13 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { } c._link1._next = null; c._link1._prev = null; - var prev5 = c._link2._prev; - var next5 = c._link2._next; - if(prev5 != null) { - prev5._next = next5; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next5 != null) { - next5._prev = prev5; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -17803,30 +15502,27 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this1 = c._contactConstraint; - _this1._s1 = null; - _this1._s2 = null; - _this1._b1 = null; - _this1._b2 = null; - _this1._tf1 = null; - _this1._tf2 = null; + let _this = c._contactConstraint; + _this._s1 = null; + _this._s2 = null; + _this._b1 = null; + _this._b2 = null; + _this._tf1 = null; + _this._tf2 = null; c._next = this._contactPool; this._contactPool = c; this._numContacts--; break; } - var aabbOverlapping = aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ; - c._shouldBeSkipped = !aabbOverlapping; - if(!false) { - break; - } + c._shouldBeSkipped = !(aabb1._minX < aabb2._maxX && aabb1._maxX > aabb2._minX && aabb1._minY < aabb2._maxY && aabb1._maxY > aabb2._minY && aabb1._minZ < aabb2._maxZ && aabb1._maxZ > aabb2._minZ); + break; } c = n; } } shouldCollide(s1,s2) { - var r1 = s1._rigidBody; - var r2 = s2._rigidBody; + let r1 = s1._rigidBody; + let r2 = s2._rigidBody; if(r1 == r2) { return false; } @@ -17836,8 +15532,8 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { if((s1._collisionGroup & s2._collisionMask) == 0 || (s2._collisionGroup & s1._collisionMask) == 0) { return false; } - var jl; - var other; + let jl; + let other; if(r1._numJointLinks < r2._numJointLinks) { jl = r1._jointLinkList; other = r2; @@ -17846,11 +15542,10 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { other = r1; } while(jl != null) { - var n = jl._next; if(jl._other == other && !jl._joint._allowCollision) { return false; } - jl = n; + jl = jl._next; } return true; } @@ -17860,9 +15555,9 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { this.destroyOutdatedContacts(); } _postSolve() { - var c = this._contactList; + let c = this._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(c._touching) { c._postSolve(); } @@ -17878,14 +15573,10 @@ oimo.dynamics.ContactManager = class oimo_dynamics_ContactManager { } oimo.dynamics.Island = class oimo_dynamics_Island { constructor() { - var this1 = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); - this.rigidBodies = this1; - var this2 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); - this.solvers = this2; - var this3 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); - this.solversSi = this3; - var this4 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); - this.solversNgs = this4; + this.rigidBodies = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); + this.solvers = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this.solversSi = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this.solversNgs = new Array(oimo.common.Setting.islandInitialConstraintArraySize); this.numRigidBodies = 0; this.numSolvers = 0; this.numSolversSi = 0; @@ -17899,13 +15590,11 @@ oimo.dynamics.Island = class oimo_dynamics_Island { } _addRigidBody(rigidBody) { if(this.numRigidBodies == this.rigidBodies.length) { - var newLength = this.numRigidBodies << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.numRigidBodies; + let newArray = new Array(this.numRigidBodies << 1); + let _g = 0; + let _g1 = this.numRigidBodies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.rigidBodies[i]; this.rigidBodies[i] = null; } @@ -17916,13 +15605,11 @@ oimo.dynamics.Island = class oimo_dynamics_Island { } _addConstraintSolver(solver,positionCorrection) { if(this.numSolvers == this.solvers.length) { - var newLength = this.numSolvers << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this.numSolvers; + let newArray = new Array(this.numSolvers << 1); + let _g = 0; + let _g1 = this.numSolvers; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.solvers[i]; this.solvers[i] = null; } @@ -17932,41 +15619,37 @@ oimo.dynamics.Island = class oimo_dynamics_Island { this.solvers[this.numSolvers++] = solver; if(positionCorrection == oimo.dynamics.constraint.PositionCorrectionAlgorithm.SPLIT_IMPULSE) { if(this.numSolversSi == this.solversSi.length) { - var newLength1 = this.numSolversSi << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = this.numSolversSi; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.solversSi[i1]; - this.solversSi[i1] = null; - } - this.solversSi = newArray1; + let newArray = new Array(this.numSolversSi << 1); + let _g = 0; + let _g1 = this.numSolversSi; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.solversSi[i]; + this.solversSi[i] = null; + } + this.solversSi = newArray; } this.solversSi[this.numSolversSi++] = solver; } if(positionCorrection == oimo.dynamics.constraint.PositionCorrectionAlgorithm.NGS) { if(this.numSolversNgs == this.solversNgs.length) { - var newLength2 = this.numSolversNgs << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = this.numSolversNgs; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.solversNgs[i2]; - this.solversNgs[i2] = null; - } - this.solversNgs = newArray2; + let newArray = new Array(this.numSolversNgs << 1); + let _g = 0; + let _g1 = this.numSolversNgs; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.solversNgs[i]; + this.solversNgs[i] = null; + } + this.solversNgs = newArray; } this.solversNgs[this.numSolversNgs++] = solver; } } _stepSingleRigidBody(timeStep,rb) { - var dt = timeStep.dt; - var dst = rb._ptransform; - var src = rb._transform; + let dt = timeStep.dt; + let dst = rb._ptransform; + let src = rb._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -17996,29 +15679,27 @@ oimo.dynamics.Island = class oimo_dynamics_Island { } if(!rb._sleeping) { if(rb._type == 0) { - var x = dt * rb._linearDamping; - var x2 = x * x; - var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.166666666666666657 + x2 * 0.0416666666666666644)); - var x1 = dt * rb._angularDamping; - var x21 = x1 * x1; - var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.166666666666666657 + x21 * 0.0416666666666666644)); - var linAcc; - var linAccX; - var linAccY; - var linAccZ; - var angAcc; - var angAccX; - var angAccY; - var angAccZ; + let x = dt * rb._linearDamping; + let x2 = x * x; + let linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + let x1 = dt * rb._angularDamping; + let x21 = x1 * x1; + let angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + let linAccX; + let linAccY; + let linAccZ; + let angAccX; + let angAccY; + let angAccZ; linAccX = this.gravityX * rb._gravityScale; linAccY = this.gravityY * rb._gravityScale; linAccZ = this.gravityZ * rb._gravityScale; linAccX += rb._forceX * rb._invMass; linAccY += rb._forceY * rb._invMass; linAccZ += rb._forceZ * rb._invMass; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; @@ -18039,101 +15720,99 @@ oimo.dynamics.Island = class oimo_dynamics_Island { rb._angVelZ *= angScale; } rb._integrate(dt); - var s = rb._shapeList; + let s = rb._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = rb._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let n = s._next; + let tf1 = rb._ptransform; + let tf2 = rb._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = rb._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -18149,14 +15828,13 @@ oimo.dynamics.Island = class oimo_dynamics_Island { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -18167,15 +15845,14 @@ oimo.dynamics.Island = class oimo_dynamics_Island { } } _step(timeStep,numVelocityIterations,numPositionIterations) { - var dt = timeStep.dt; - var sleepIsland = true; - var _g = 0; - var _g1 = this.numRigidBodies; + let dt = timeStep.dt; + let sleepIsland = true; + let _g = 0; + let _g1 = this.numRigidBodies; while(_g < _g1) { - var i = _g++; - var rb = this.rigidBodies[i]; - var dst = rb._ptransform; - var src = rb._transform; + let rb = this.rigidBodies[_g++]; + let dst = rb._ptransform; + let src = rb._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -18204,29 +15881,27 @@ oimo.dynamics.Island = class oimo_dynamics_Island { sleepIsland = false; } if(rb._type == 0) { - var x = dt * rb._linearDamping; - var x2 = x * x; - var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.166666666666666657 + x2 * 0.0416666666666666644)); - var x1 = dt * rb._angularDamping; - var x21 = x1 * x1; - var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.166666666666666657 + x21 * 0.0416666666666666644)); - var linAcc; - var linAccX; - var linAccY; - var linAccZ; - var angAcc; - var angAccX; - var angAccY; - var angAccZ; + let x = dt * rb._linearDamping; + let x2 = x * x; + let linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + let x1 = dt * rb._angularDamping; + let x21 = x1 * x1; + let angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + let linAccX; + let linAccY; + let linAccZ; + let angAccX; + let angAccY; + let angAccZ; linAccX = this.gravityX * rb._gravityScale; linAccY = this.gravityY * rb._gravityScale; linAccZ = this.gravityZ * rb._gravityScale; linAccX += rb._forceX * rb._invMass; linAccY += rb._forceY * rb._invMass; linAccZ += rb._forceZ * rb._invMass; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; @@ -18248,237 +15923,185 @@ oimo.dynamics.Island = class oimo_dynamics_Island { } } if(sleepIsland) { - var _g2 = 0; - var _g3 = this.numRigidBodies; - while(_g2 < _g3) { - var i1 = _g2++; - var rb1 = this.rigidBodies[i1]; - rb1._sleeping = true; - rb1._sleepTime = 0; + let _g = 0; + let _g1 = this.numRigidBodies; + while(_g < _g1) { + let rb = this.rigidBodies[_g++]; + rb._sleeping = true; + rb._sleepTime = 0; } return; } - var _g21 = 0; - var _g31 = this.numSolvers; - while(_g21 < _g31) { - var i2 = _g21++; - var s = this.solvers[i2]; - s.preSolveVelocity(timeStep); - } - var _g4 = 0; - var _g5 = this.numSolvers; - while(_g4 < _g5) { - var i3 = _g4++; - var s1 = this.solvers[i3]; - s1.warmStart(timeStep); - } - var _g6 = 0; - var _g7 = numVelocityIterations; - while(_g6 < _g7) { - var t = _g6++; - var _g61 = 0; - var _g71 = this.numSolvers; - while(_g61 < _g71) { - var i4 = _g61++; - var s2 = this.solvers[i4]; - s2.solveVelocity(); - } - } - var _g8 = 0; - var _g9 = this.numSolvers; - while(_g8 < _g9) { - var i5 = _g8++; - var s3 = this.solvers[i5]; - s3.postSolveVelocity(timeStep); - } - var _g10 = 0; - var _g11 = this.numRigidBodies; - while(_g10 < _g11) { - var i6 = _g10++; - var rb2 = this.rigidBodies[i6]; - rb2._integrate(dt); - } - var _g12 = 0; - var _g13 = this.numSolversSi; - while(_g12 < _g13) { - var i7 = _g12++; - var s4 = this.solversSi[i7]; - s4.preSolvePosition(timeStep); - } - var _g14 = 0; - var _g15 = numPositionIterations; - while(_g14 < _g15) { - var t1 = _g14++; - var _g141 = 0; - var _g151 = this.numSolversSi; - while(_g141 < _g151) { - var i8 = _g141++; - var s5 = this.solversSi[i8]; - s5.solvePositionSplitImpulse(); - } - } - var _g16 = 0; - var _g17 = this.numRigidBodies; - while(_g16 < _g17) { - var i9 = _g16++; - var rb3 = this.rigidBodies[i9]; - rb3._integratePseudoVelocity(); - } - var _g18 = 0; - var _g19 = this.numSolversNgs; - while(_g18 < _g19) { - var i10 = _g18++; - var s6 = this.solversNgs[i10]; - s6.preSolvePosition(timeStep); - } - var _g20 = 0; - var _g211 = numPositionIterations; - while(_g20 < _g211) { - var t2 = _g20++; - var _g201 = 0; - var _g212 = this.numSolversNgs; - while(_g201 < _g212) { - var i11 = _g201++; - var s7 = this.solversNgs[i11]; - s7.solvePositionNgs(timeStep); - } - } - var _g22 = 0; - var _g23 = this.numSolvers; - while(_g22 < _g23) { - var i12 = _g22++; - var s8 = this.solvers[i12]; - s8.postSolve(); - } - var _g24 = 0; - var _g25 = this.numRigidBodies; - while(_g24 < _g25) { - var i13 = _g24++; - var rb4 = this.rigidBodies[i13]; - var s9 = rb4._shapeList; - while(s9 != null) { - var n = s9._next; - var dst1 = s9._ptransform; - var src1 = s9._localTransform; - var src2 = rb4._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y1 = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z1 = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let _g2 = 0; + let _g3 = this.numSolvers; + while(_g2 < _g3) this.solvers[_g2++].preSolveVelocity(timeStep); + let _g4 = 0; + let _g5 = this.numSolvers; + while(_g4 < _g5) this.solvers[_g4++].warmStart(timeStep); + let _g6 = 0; + while(_g6 < numVelocityIterations) { + ++_g6; + let _g = 0; + let _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].solveVelocity(); + } + let _g7 = 0; + let _g8 = this.numSolvers; + while(_g7 < _g8) this.solvers[_g7++].postSolveVelocity(timeStep); + let _g9 = 0; + let _g10 = this.numRigidBodies; + while(_g9 < _g10) this.rigidBodies[_g9++]._integrate(dt); + let _g11 = 0; + let _g12 = this.numSolversSi; + while(_g11 < _g12) this.solversSi[_g11++].preSolvePosition(timeStep); + let _g13 = 0; + while(_g13 < numPositionIterations) { + ++_g13; + let _g = 0; + let _g1 = this.numSolversSi; + while(_g < _g1) this.solversSi[_g++].solvePositionSplitImpulse(); + } + let _g14 = 0; + let _g15 = this.numRigidBodies; + while(_g14 < _g15) this.rigidBodies[_g14++]._integratePseudoVelocity(); + let _g16 = 0; + let _g17 = this.numSolversNgs; + while(_g16 < _g17) this.solversNgs[_g16++].preSolvePosition(timeStep); + let _g18 = 0; + while(_g18 < numPositionIterations) { + ++_g18; + let _g = 0; + let _g1 = this.numSolversNgs; + while(_g < _g1) this.solversNgs[_g++].solvePositionNgs(timeStep); + } + let _g19 = 0; + let _g20 = this.numSolvers; + while(_g19 < _g20) this.solvers[_g19++].postSolve(); + let _g21 = 0; + let _g22 = this.numRigidBodies; + while(_g21 < _g22) { + let rb = this.rigidBodies[_g21++]; + let s = rb._shapeList; + while(s != null) { + let n = s._next; + let tf1 = rb._ptransform; + let tf2 = rb._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s9._transform; - var src11 = s9._localTransform; - var src21 = rb4._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y2 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z2 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; - s9._geom._computeAabb(s9._aabb,s9._ptransform); - minX = s9._aabb._minX; - minY = s9._aabb._minY; - minZ = s9._aabb._minZ; - maxX = s9._aabb._maxX; - maxY = s9._aabb._maxY; - maxZ = s9._aabb._maxZ; - s9._geom._computeAabb(s9._aabb,s9._transform); - s9._aabb._minX = minX < s9._aabb._minX ? minX : s9._aabb._minX; - s9._aabb._minY = minY < s9._aabb._minY ? minY : s9._aabb._minY; - s9._aabb._minZ = minZ < s9._aabb._minZ ? minZ : s9._aabb._minZ; - s9._aabb._maxX = maxX > s9._aabb._maxX ? maxX : s9._aabb._maxX; - s9._aabb._maxY = maxY > s9._aabb._maxY ? maxY : s9._aabb._maxY; - s9._aabb._maxZ = maxZ > s9._aabb._maxZ ? maxZ : s9._aabb._maxZ; - if(s9._proxy != null) { - var d; - var dX; - var dY; - var dZ; - dX = s9._transform._positionX - s9._ptransform._positionX; - dY = s9._transform._positionY - s9._ptransform._positionY; - dZ = s9._transform._positionZ - s9._ptransform._positionZ; - var v = s9.displacement; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + let dX; + let dY; + let dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s9._rigidBody._world._broadPhase.moveProxy(s9._proxy,s9._aabb,s9.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s9 = n; + s = n; } } } @@ -18522,123 +16145,110 @@ oimo.dynamics.World = class oimo_dynamics_World { this._convexCastWrapper = new oimo.dynamics._World.ConvexCastWrapper(); this._aabbTestWrapper = new oimo.dynamics._World.AabbTestWrapper(); this._island = new oimo.dynamics.Island(); - var this1 = new Array(oimo.common.Setting.islandInitialConstraintArraySize); - this._solversInIslands = this1; - var this2 = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); - this._rigidBodyStack = this2; + this._solversInIslands = new Array(oimo.common.Setting.islandInitialConstraintArraySize); + this._rigidBodyStack = new Array(oimo.common.Setting.islandInitialRigidBodyArraySize); this._timeStep = new oimo.dynamics.TimeStep(); this._pool = new oimo.common.Pool(); this._shapeIdCount = 0; } _updateContacts() { - var st = Date.now() / 1000; + let st = HxOverrides.now() / 1000; this._contactManager._updateContacts(); - var en = Date.now() / 1000; - oimo.dynamics.common.Performance.broadPhaseCollisionTime = (en - st) * 1000; - var st1 = Date.now() / 1000; - var c = this._contactManager._contactList; + oimo.dynamics.common.Performance.broadPhaseCollisionTime = (HxOverrides.now() / 1000 - st) * 1000; + let st1 = HxOverrides.now() / 1000; + let c = this._contactManager._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(!c._shouldBeSkipped) { c._updateManifold(); } c = n; } - var en1 = Date.now() / 1000; - oimo.dynamics.common.Performance.narrowPhaseCollisionTime = (en1 - st1) * 1000; + oimo.dynamics.common.Performance.narrowPhaseCollisionTime = (HxOverrides.now() / 1000 - st1) * 1000; } _solveIslands() { - var st = Date.now() / 1000; + let st = HxOverrides.now() / 1000; if(oimo.common.Setting.disableSleeping) { - var b = this._rigidBodyList; + let b = this._rigidBodyList; while(b != null) { - var n = b._next; b._sleeping = false; b._sleepTime = 0; - b = n; + b = b._next; } } if(this._rigidBodyStack.length < this._numRigidBodies) { - var newStackSize = this._rigidBodyStack.length << 1; + let newStackSize = this._rigidBodyStack.length << 1; while(newStackSize < this._numRigidBodies) newStackSize <<= 1; - var this1 = new Array(newStackSize); - this._rigidBodyStack = this1; + this._rigidBodyStack = new Array(newStackSize); } this._numIslands = 0; - var _this = this._island; - var v = this._gravity; - _this.gravityX = v.x; - _this.gravityY = v.y; - _this.gravityZ = v.z; - var b1 = this._rigidBodyList; + let _this = this._island; + let gravity = this._gravity; + _this.gravityX = gravity.x; + _this.gravityY = gravity.y; + _this.gravityZ = gravity.z; + let b = this._rigidBodyList; this._numSolversInIslands = 0; - while(b1 != null) { - var n1 = b1._next; - while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { - if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { - this._island._stepSingleRigidBody(this._timeStep,b1); + while(b != null) { + let n = b._next; + while(!(b._addedToIsland || b._sleeping || b._type == 1)) { + if(b._numContactLinks == 0 && b._numJointLinks == 0) { + this._island._stepSingleRigidBody(this._timeStep,b); this._numIslands++; break; } - this.buildIsland(b1); + this.buildIsland(b); this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); this._island._clear(); this._numIslands++; - if(!false) { - break; - } + break; } - b1 = n1; + b = n; } this._contactManager._postSolve(); - b1 = this._rigidBodyList; - while(b1 != null) { - var n2 = b1._next; - b1._addedToIsland = false; - b1 = n2; - } - b1 = this._rigidBodyList; - while(b1 != null) { - var n3 = b1._next; - b1._forceX = 0; - b1._forceY = 0; - b1._forceZ = 0; - b1._torqueX = 0; - b1._torqueY = 0; - b1._torqueZ = 0; - b1 = n3; + b = this._rigidBodyList; + while(b != null) { + b._addedToIsland = false; + b = b._next; + } + b = this._rigidBodyList; + while(b != null) { + b._forceX = 0; + b._forceY = 0; + b._forceZ = 0; + b._torqueX = 0; + b._torqueY = 0; + b._torqueZ = 0; + b = b._next; } while(this._numSolversInIslands > 0) { this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; this._solversInIslands[this._numSolversInIslands] = null; } - var en = Date.now() / 1000; - oimo.dynamics.common.Performance.dynamicsTime = (en - st) * 1000; + oimo.dynamics.common.Performance.dynamicsTime = (HxOverrides.now() / 1000 - st) * 1000; } buildIsland(base) { - var stackCount = 1; + let stackCount = 1; this._island._addRigidBody(base); this._rigidBodyStack[0] = base; while(stackCount > 0) { - var rb = this._rigidBodyStack[--stackCount]; + let rb = this._rigidBodyStack[--stackCount]; this._rigidBodyStack[stackCount] = null; if(rb._type == 1) { continue; } - var cl = rb._contactLinkList; + let cl = rb._contactLinkList; while(cl != null) { - var n = cl._next; - var cc = cl._contact._contactConstraint; - var ccs = cl._contact._contactConstraint._solver; + let n = cl._next; + let cc = cl._contact._contactConstraint; + let ccs = cl._contact._contactConstraint._solver; if(cc.isTouching() && !ccs._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newLength = this._numSolversInIslands << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = this._numSolversInIslands; + let newArray = new Array(this._numSolversInIslands << 1); + let _g = 0; + let _g1 = this._numSolversInIslands; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this._solversInIslands[i]; this._solversInIslands[i] = null; } @@ -18646,7 +16256,7 @@ oimo.dynamics.World = class oimo_dynamics_World { } this._solversInIslands[this._numSolversInIslands++] = ccs; this._island._addConstraintSolver(ccs,cc._positionCorrectionAlgorithm); - var other = cl._other; + let other = cl._other; if(!other._addedToIsland) { this._island._addRigidBody(other); this._rigidBodyStack[stackCount++] = other; @@ -18654,34 +16264,32 @@ oimo.dynamics.World = class oimo_dynamics_World { } cl = n; } - var jl = rb._jointLinkList; + let jl = rb._jointLinkList; while(jl != null) { - var n1 = jl._next; - var j = jl._joint; - var js1 = j._solver; + let n = jl._next; + let j = jl._joint; + let js1 = j._solver; if(!js1._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newLength1 = this._numSolversInIslands << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = this._numSolversInIslands; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this._solversInIslands[i1]; - this._solversInIslands[i1] = null; + let newArray = new Array(this._numSolversInIslands << 1); + let _g = 0; + let _g1 = this._numSolversInIslands; + while(_g < _g1) { + let i = _g++; + newArray[i] = this._solversInIslands[i]; + this._solversInIslands[i] = null; } - this._solversInIslands = newArray1; + this._solversInIslands = newArray; } this._solversInIslands[this._numSolversInIslands++] = js1; this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); - var other1 = jl._other; - if(!other1._addedToIsland) { - this._island._addRigidBody(other1); - this._rigidBodyStack[stackCount++] = other1; + let other = jl._other; + if(!other._addedToIsland) { + this._island._addRigidBody(other); + this._rigidBodyStack[stackCount++] = other; } } - jl = n1; + jl = n; } } } @@ -18695,33 +16303,28 @@ oimo.dynamics.World = class oimo_dynamics_World { return; } if(level >= d.drawBvhMinLevel && level <= d.drawBvhMaxLevel) { - var _this = this._pool; - var min = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var max = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var v = min; + let _this = this._pool; + let min = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let max = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = min; v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = max; + let v1 = max; v1.x = node._aabbMaxX; v1.y = node._aabbMaxY; v1.z = node._aabbMaxZ; d.aabb(min,max,color); - var _this2 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this2 = this._pool; if(min != null) { min.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newLength = _this2.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this2.sizeVec3; + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -18729,260 +16332,43 @@ oimo.dynamics.World = class oimo_dynamics_World { } _this2.stackVec3[_this2.sizeVec3++] = min; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this2.sizeMat3 == _this2.stackMat3.length) { - var newLength1 = _this2.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this2.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this2.stackMat3[i1]; - _this2.stackMat3[i1] = null; - } - _this2.stackMat3 = newArray1; - } - _this2.stackMat3[_this2.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this2.sizeMat4 == _this2.stackMat4.length) { - var newLength2 = _this2.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this2.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this2.stackMat4[i2]; - _this2.stackMat4[i2] = null; - } - _this2.stackMat4 = newArray2; - } - _this2.stackMat4[_this2.sizeMat4++] = mat4; - } - if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; - if(_this2.sizeQuat == _this2.stackQuat.length) { - var newLength3 = _this2.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this2.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this2.stackQuat[i3]; - _this2.stackQuat[i3] = null; - } - _this2.stackQuat = newArray3; - } - _this2.stackQuat[_this2.sizeQuat++] = quat; - } - var _this3 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this3 = this._pool; if(max != null) { max.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength4 = _this3.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this3.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this3.stackVec3[i4]; - _this3.stackVec3[i4] = null; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this3.stackVec3 = newArray4; + _this3.stackVec3 = newArray; } _this3.stackVec3[_this3.sizeVec3++] = max; } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this3.sizeMat3 == _this3.stackMat3.length) { - var newLength5 = _this3.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this3.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this3.stackMat3[i5]; - _this3.stackMat3[i5] = null; - } - _this3.stackMat3 = newArray5; - } - _this3.stackMat3[_this3.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this3.sizeMat4 == _this3.stackMat4.length) { - var newLength6 = _this3.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this3.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this3.stackMat4[i6]; - _this3.stackMat4[i6] = null; - } - _this3.stackMat4 = newArray6; - } - _this3.stackMat4[_this3.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx1 = 0; - var ty1 = 0; - var tz1 = 0; - var tw1 = 1; - quat1.x = tx1; - quat1.y = ty1; - quat1.z = tz1; - quat1.w = tw1; - if(_this3.sizeQuat == _this3.stackQuat.length) { - var newLength7 = _this3.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this3.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this3.stackQuat[i7]; - _this3.stackQuat[i7] = null; - } - _this3.stackQuat = newArray7; - } - _this3.stackQuat[_this3.sizeQuat++] = quat1; - } } this._drawBvhNode(d,node._children[0],level + 1,color); this._drawBvhNode(d,node._children[1],level + 1,color); } _drawRigidBodies(d) { - var style = d.style; - var r = this._rigidBodyList; + let style = d.style; + let r = this._rigidBodyList; while(r != null) { - var n = r._next; + let n = r._next; if(d.drawBases) { - var style1 = d.style; - d.basis(r._transform,style1.basisLength,style1.basisColorX,style1.basisColorY,style1.basisColorZ); + let style = d.style; + d.basis(r._transform,style.basisLength,style.basisColorX,style.basisColorY,style.basisColorZ); } - var shapeColor = null; - var isDynamic = r._type == 0; + let shapeColor = null; + let isDynamic = r._type == 0; if(!isDynamic) { shapeColor = r._type == 2 ? style.kinematicShapeColor : style.staticShapeColor; } - var s = r._shapeList; + let s = r._shapeList; while(s != null) { - var n1 = s._next; + let n = s._next; if(isDynamic) { if((s._id & 1) == 0) { shapeColor = r._sleeping ? style.sleepingShapeColor1 : r._sleepTime > oimo.common.Setting.sleepingTimeThreshold ? style.sleepyShapeColor1 : style.shapeColor1; @@ -18991,35 +16377,30 @@ oimo.dynamics.World = class oimo_dynamics_World { } } if(d.drawShapes) { - var geom = s._geom; - var tf = s._transform; + let geom = s._geom; + let tf = s._transform; switch(geom._type) { case 0: d.sphere(tf,geom._radius,shapeColor); break; case 1: - var g = geom; - var _this = this._pool; - var hx = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var v = hx; + let g = geom; + let _this = this._pool; + let hx = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let v = hx; v.x = g._halfExtentsX; v.y = g._halfExtentsY; v.z = g._halfExtentsZ; d.box(tf,hx,shapeColor); - var _this1 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this1 = this._pool; if(hx != null) { hx.zero(); if(_this1.sizeVec3 == _this1.stackVec3.length) { - var newLength = _this1.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this1.sizeVec3; + let newArray = new Array(_this1.sizeVec3 << 1); + let _g = 0; + let _g1 = _this1.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this1.stackVec3[i]; _this1.stackVec3[i] = null; } @@ -19027,145 +16408,39 @@ oimo.dynamics.World = class oimo_dynamics_World { } _this1.stackVec3[_this1.sizeVec3++] = hx; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this1.sizeMat3 == _this1.stackMat3.length) { - var newLength1 = _this1.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this1.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this1.stackMat3[i1]; - _this1.stackMat3[i1] = null; - } - _this1.stackMat3 = newArray1; - } - _this1.stackMat3[_this1.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this1.sizeMat4 == _this1.stackMat4.length) { - var newLength2 = _this1.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this1.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this1.stackMat4[i2]; - _this1.stackMat4[i2] = null; - } - _this1.stackMat4 = newArray2; - } - _this1.stackMat4[_this1.sizeMat4++] = mat4; - } - if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; - if(_this1.sizeQuat == _this1.stackQuat.length) { - var newLength3 = _this1.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this1.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this1.stackQuat[i3]; - _this1.stackQuat[i3] = null; - } - _this1.stackQuat = newArray3; - } - _this1.stackQuat[_this1.sizeQuat++] = quat; - } break; case 2: - var g1 = geom; + let g1 = geom; d.cylinder(tf,g1._radius,g1._halfHeight,shapeColor); break; case 3: - var g2 = geom; + let g2 = geom; d.cone(tf,g2._radius,g2._halfHeight,shapeColor); break; case 4: - var g3 = geom; + let g3 = geom; d.capsule(tf,g3._radius,g3._halfHeight,shapeColor); break; case 5: - var g4 = geom; - var n2 = g4._numVertices; - var _this2 = this._pool; - var v1 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this._pool; - var v2 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this._pool; - var v3 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var _this5 = this._pool; - var v12 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - var _this6 = this._pool; - var v13 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var _this7 = this._pool; - var normal = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; - var _this8 = this._pool; - var m = _this8.sizeMat3 == 0 ? new oimo.common.Mat3() : _this8.stackMat3[--_this8.sizeMat3]; - var _this9 = this._pool; - var o = _this9.sizeVec3 == 0 ? new oimo.common.Vec3() : _this9.stackVec3[--_this9.sizeVec3]; - var m1 = m; + let g4 = geom; + let n = g4._numVertices; + let _this2 = this._pool; + let v1 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let v2 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let v3 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let _this5 = this._pool; + let v12 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this6 = this._pool; + let v13 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let _this7 = this._pool; + let normal = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + let _this8 = this._pool; + let m = _this8.sizeMat3 == 0 ? new oimo.common.Mat3() : _this8.stackMat3[--_this8.sizeMat3]; + let _this9 = this._pool; + let o = _this9.sizeVec3 == 0 ? new oimo.common.Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -19175,1477 +16450,341 @@ oimo.dynamics.World = class oimo_dynamics_World { m1.e20 = tf._rotation20; m1.e21 = tf._rotation21; m1.e22 = tf._rotation22; - var v4 = o; + let v4 = o; v4.x = tf._positionX; v4.y = tf._positionY; v4.z = tf._positionZ; - var _g5 = 0; - var _g14 = n2; - while(_g5 < _g14) { - var i4 = _g5++; - var _this10 = g4._tmpVertices[i4]; - var v5 = g4._vertices[i4]; - _this10.x = v5.x; - _this10.y = v5.y; - _this10.z = v5.z; - var _this11 = _this10; - var tx1 = _this11.x * m.e00 + _this11.y * m.e01 + _this11.z * m.e02; - var ty1 = _this11.x * m.e10 + _this11.y * m.e11 + _this11.z * m.e12; - var tz1 = _this11.x * m.e20 + _this11.y * m.e21 + _this11.z * m.e22; - _this11.x = tx1; - _this11.y = ty1; - _this11.z = tz1; - var _this12 = _this11; - var tx2 = _this12.x + o.x; - var ty2 = _this12.y + o.y; - var tz2 = _this12.z + o.z; - _this12.x = tx2; - _this12.y = ty2; - _this12.z = tz2; + let _g = 0; + while(_g < n) { + let i = _g++; + let _this = g4._tmpVertices[i]; + let v = g4._vertices[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; } - if(n2 > 30) { - var _g21 = 0; - var _g31 = n2; - while(_g21 < _g31) { - var i5 = _g21++; - var v6 = g4._tmpVertices[i5]; - v1.x = v6.x; - v1.y = v6.y; - v1.z = v6.z; - var v7 = g4._tmpVertices[(i5 + 1) % n2]; - v2.x = v7.x; - v2.y = v7.y; - v2.z = v7.z; + if(n > 30) { + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let v3 = g4._tmpVertices[(i + 1) % n]; + v2.x = v3.x; + v2.y = v3.y; + v2.z = v3.z; d.line(v1,v2,shapeColor); } - } else if(this._debugDraw.wireframe || n2 > 10) { - var _g22 = 0; - var _g32 = n2; - while(_g22 < _g32) { - var i6 = _g22++; - var v8 = g4._tmpVertices[i6]; - v1.x = v8.x; - v1.y = v8.y; - v1.z = v8.z; - var _g23 = 0; - var _g33 = i6; - while(_g23 < _g33) { - var j = _g23++; - var v9 = g4._tmpVertices[j]; - v2.x = v9.x; - v2.y = v9.y; - v2.z = v9.z; + } else if(this._debugDraw.wireframe || n > 10) { + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let _g1 = 0; + while(_g1 < i) { + let v = g4._tmpVertices[_g1++]; + v2.x = v.x; + v2.y = v.y; + v2.z = v.z; d.line(v1,v2,shapeColor); } } } else { - var _g24 = 0; - var _g34 = n2; - while(_g24 < _g34) { - var i7 = _g24++; - var v10 = g4._tmpVertices[i7]; - v1.x = v10.x; - v1.y = v10.y; - v1.z = v10.z; - var _g25 = 0; - var _g35 = i7; - while(_g25 < _g35) { - var j1 = _g25++; - var v11 = g4._tmpVertices[j1]; - v2.x = v11.x; - v2.y = v11.y; - v2.z = v11.z; - var _g26 = 0; - var _g36 = j1; - while(_g26 < _g36) { - var k = _g26++; - var v14 = g4._tmpVertices[k]; - v3.x = v14.x; - v3.y = v14.y; - v3.z = v14.z; + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let _g1 = 0; + while(_g1 < i) { + let j = _g1++; + let v = g4._tmpVertices[j]; + v2.x = v.x; + v2.y = v.y; + v2.z = v.z; + let _g = 0; + while(_g < j) { + let v = g4._tmpVertices[_g++]; + v3.x = v.x; + v3.y = v.y; + v3.z = v.z; v12.x = v2.x; v12.y = v2.y; v12.z = v2.z; - var _this13 = v12; - var tx3 = _this13.x - v1.x; - var ty3 = _this13.y - v1.y; - var tz3 = _this13.z - v1.z; - _this13.x = tx3; - _this13.y = ty3; - _this13.z = tz3; + let _this = v12; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; v13.x = v3.x; v13.y = v3.y; v13.z = v3.z; - var _this14 = v13; - var tx4 = _this14.x - v1.x; - var ty4 = _this14.y - v1.y; - var tz4 = _this14.z - v1.z; - _this14.x = tx4; - _this14.y = ty4; - _this14.z = tz4; + let _this1 = v13; + _this1.x -= v1.x; + _this1.y -= v1.y; + _this1.z -= v1.z; normal.x = v12.x; normal.y = v12.y; normal.z = v12.z; - var _this15 = normal; - var tx5 = _this15.y * v13.z - _this15.z * v13.y; - var ty5 = _this15.z * v13.x - _this15.x * v13.z; - var tz5 = _this15.x * v13.y - _this15.y * v13.x; - _this15.x = tx5; - _this15.y = ty5; - _this15.z = tz5; - var _this16 = _this15; - var invLen = Math.sqrt(_this16.x * _this16.x + _this16.y * _this16.y + _this16.z * _this16.z); + let _this2 = normal; + let y = _this2.z * v13.x - _this2.x * v13.z; + let z = _this2.x * v13.y - _this2.y * v13.x; + _this2.x = _this2.y * v13.z - _this2.z * v13.y; + _this2.y = y; + _this2.z = z; + let invLen = Math.sqrt(_this2.x * _this2.x + _this2.y * _this2.y + _this2.z * _this2.z); if(invLen > 0) { invLen = 1 / invLen; } - var tx6 = _this16.x * invLen; - var ty6 = _this16.y * invLen; - var tz6 = _this16.z * invLen; - _this16.x = tx6; - _this16.y = ty6; - _this16.z = tz6; + _this2.x *= invLen; + _this2.y *= invLen; + _this2.z *= invLen; d.triangle(v1,v2,v3,normal,normal,normal,shapeColor); - var tx7 = -normal.x; - var ty7 = -normal.y; - var tz7 = -normal.z; - normal.x = tx7; - normal.y = ty7; - normal.z = tz7; + normal.x = -normal.x; + normal.y = -normal.y; + normal.z = -normal.z; d.triangle(v1,v3,v2,normal,normal,normal,shapeColor); } } } } - var _this17 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this10 = this._pool; if(v1 != null) { v1.zero(); - if(_this17.sizeVec3 == _this17.stackVec3.length) { - var newLength4 = _this17.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g6 = 0; - var _g15 = _this17.sizeVec3; - while(_g6 < _g15) { - var i8 = _g6++; - newArray4[i8] = _this17.stackVec3[i8]; - _this17.stackVec3[i8] = null; - } - _this17.stackVec3 = newArray4; - } - _this17.stackVec3[_this17.sizeVec3++] = v1; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this17.sizeMat3 == _this17.stackMat3.length) { - var newLength5 = _this17.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g7 = 0; - var _g16 = _this17.sizeMat3; - while(_g7 < _g16) { - var i9 = _g7++; - newArray5[i9] = _this17.stackMat3[i9]; - _this17.stackMat3[i9] = null; - } - _this17.stackMat3 = newArray5; - } - _this17.stackMat3[_this17.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this17.sizeMat4 == _this17.stackMat4.length) { - var newLength6 = _this17.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g8 = 0; - var _g17 = _this17.sizeMat4; - while(_g8 < _g17) { - var i10 = _g8++; - newArray6[i10] = _this17.stackMat4[i10]; - _this17.stackMat4[i10] = null; - } - _this17.stackMat4 = newArray6; - } - _this17.stackMat4[_this17.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx8 = 0; - var ty8 = 0; - var tz8 = 0; - var tw1 = 1; - quat1.x = tx8; - quat1.y = ty8; - quat1.z = tz8; - quat1.w = tw1; - if(_this17.sizeQuat == _this17.stackQuat.length) { - var newLength7 = _this17.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g9 = 0; - var _g18 = _this17.sizeQuat; - while(_g9 < _g18) { - var i11 = _g9++; - newArray7[i11] = _this17.stackQuat[i11]; - _this17.stackQuat[i11] = null; + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this17.stackQuat = newArray7; + _this10.stackVec3 = newArray; } - _this17.stackQuat[_this17.sizeQuat++] = quat1; + _this10.stackVec3[_this10.sizeVec3++] = v1; } - var _this18 = this._pool; - var mat32 = null; - var mat42 = null; - var quat2 = null; + let _this11 = this._pool; if(v2 != null) { v2.zero(); - if(_this18.sizeVec3 == _this18.stackVec3.length) { - var newLength8 = _this18.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g10 = 0; - var _g19 = _this18.sizeVec3; - while(_g10 < _g19) { - var i12 = _g10++; - newArray8[i12] = _this18.stackVec3[i12]; - _this18.stackVec3[i12] = null; - } - _this18.stackVec3 = newArray8; - } - _this18.stackVec3[_this18.sizeVec3++] = v2; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this18.sizeMat3 == _this18.stackMat3.length) { - var newLength9 = _this18.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g20 = 0; - var _g110 = _this18.sizeMat3; - while(_g20 < _g110) { - var i13 = _g20++; - newArray9[i13] = _this18.stackMat3[i13]; - _this18.stackMat3[i13] = null; - } - _this18.stackMat3 = newArray9; - } - _this18.stackMat3[_this18.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this18.sizeMat4 == _this18.stackMat4.length) { - var newLength10 = _this18.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g27 = 0; - var _g111 = _this18.sizeMat4; - while(_g27 < _g111) { - var i14 = _g27++; - newArray10[i14] = _this18.stackMat4[i14]; - _this18.stackMat4[i14] = null; - } - _this18.stackMat4 = newArray10; - } - _this18.stackMat4[_this18.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx9 = 0; - var ty9 = 0; - var tz9 = 0; - var tw2 = 1; - quat2.x = tx9; - quat2.y = ty9; - quat2.z = tz9; - quat2.w = tw2; - if(_this18.sizeQuat == _this18.stackQuat.length) { - var newLength11 = _this18.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g28 = 0; - var _g112 = _this18.sizeQuat; - while(_g28 < _g112) { - var i15 = _g28++; - newArray11[i15] = _this18.stackQuat[i15]; - _this18.stackQuat[i15] = null; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this18.stackQuat = newArray11; + _this11.stackVec3 = newArray; } - _this18.stackQuat[_this18.sizeQuat++] = quat2; + _this11.stackVec3[_this11.sizeVec3++] = v2; } - var _this19 = this._pool; - var mat33 = null; - var mat43 = null; - var quat3 = null; + let _this12 = this._pool; if(v3 != null) { v3.zero(); - if(_this19.sizeVec3 == _this19.stackVec3.length) { - var newLength12 = _this19.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g29 = 0; - var _g113 = _this19.sizeVec3; - while(_g29 < _g113) { - var i16 = _g29++; - newArray12[i16] = _this19.stackVec3[i16]; - _this19.stackVec3[i16] = null; - } - _this19.stackVec3 = newArray12; - } - _this19.stackVec3[_this19.sizeVec3++] = v3; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this19.sizeMat3 == _this19.stackMat3.length) { - var newLength13 = _this19.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g30 = 0; - var _g114 = _this19.sizeMat3; - while(_g30 < _g114) { - var i17 = _g30++; - newArray13[i17] = _this19.stackMat3[i17]; - _this19.stackMat3[i17] = null; - } - _this19.stackMat3 = newArray13; - } - _this19.stackMat3[_this19.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this19.sizeMat4 == _this19.stackMat4.length) { - var newLength14 = _this19.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g37 = 0; - var _g115 = _this19.sizeMat4; - while(_g37 < _g115) { - var i18 = _g37++; - newArray14[i18] = _this19.stackMat4[i18]; - _this19.stackMat4[i18] = null; - } - _this19.stackMat4 = newArray14; - } - _this19.stackMat4[_this19.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx10 = 0; - var ty10 = 0; - var tz10 = 0; - var tw3 = 1; - quat3.x = tx10; - quat3.y = ty10; - quat3.z = tz10; - quat3.w = tw3; - if(_this19.sizeQuat == _this19.stackQuat.length) { - var newLength15 = _this19.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g38 = 0; - var _g116 = _this19.sizeQuat; - while(_g38 < _g116) { - var i19 = _g38++; - newArray15[i19] = _this19.stackQuat[i19]; - _this19.stackQuat[i19] = null; + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this19.stackQuat = newArray15; + _this12.stackVec3 = newArray; } - _this19.stackQuat[_this19.sizeQuat++] = quat3; + _this12.stackVec3[_this12.sizeVec3++] = v3; } - var _this20 = this._pool; - var mat34 = null; - var mat44 = null; - var quat4 = null; + let _this13 = this._pool; if(v12 != null) { v12.zero(); - if(_this20.sizeVec3 == _this20.stackVec3.length) { - var newLength16 = _this20.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g39 = 0; - var _g117 = _this20.sizeVec3; - while(_g39 < _g117) { - var i20 = _g39++; - newArray16[i20] = _this20.stackVec3[i20]; - _this20.stackVec3[i20] = null; - } - _this20.stackVec3 = newArray16; - } - _this20.stackVec3[_this20.sizeVec3++] = v12; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this20.sizeMat3 == _this20.stackMat3.length) { - var newLength17 = _this20.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g40 = 0; - var _g118 = _this20.sizeMat3; - while(_g40 < _g118) { - var i21 = _g40++; - newArray17[i21] = _this20.stackMat3[i21]; - _this20.stackMat3[i21] = null; - } - _this20.stackMat3 = newArray17; - } - _this20.stackMat3[_this20.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this20.sizeMat4 == _this20.stackMat4.length) { - var newLength18 = _this20.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g41 = 0; - var _g119 = _this20.sizeMat4; - while(_g41 < _g119) { - var i22 = _g41++; - newArray18[i22] = _this20.stackMat4[i22]; - _this20.stackMat4[i22] = null; - } - _this20.stackMat4 = newArray18; - } - _this20.stackMat4[_this20.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx11 = 0; - var ty11 = 0; - var tz11 = 0; - var tw4 = 1; - quat4.x = tx11; - quat4.y = ty11; - quat4.z = tz11; - quat4.w = tw4; - if(_this20.sizeQuat == _this20.stackQuat.length) { - var newLength19 = _this20.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g42 = 0; - var _g120 = _this20.sizeQuat; - while(_g42 < _g120) { - var i23 = _g42++; - newArray19[i23] = _this20.stackQuat[i23]; - _this20.stackQuat[i23] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this20.stackQuat = newArray19; + _this13.stackVec3 = newArray; } - _this20.stackQuat[_this20.sizeQuat++] = quat4; + _this13.stackVec3[_this13.sizeVec3++] = v12; } - var _this21 = this._pool; - var mat35 = null; - var mat45 = null; - var quat5 = null; + let _this14 = this._pool; if(v13 != null) { v13.zero(); - if(_this21.sizeVec3 == _this21.stackVec3.length) { - var newLength20 = _this21.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g43 = 0; - var _g121 = _this21.sizeVec3; - while(_g43 < _g121) { - var i24 = _g43++; - newArray20[i24] = _this21.stackVec3[i24]; - _this21.stackVec3[i24] = null; - } - _this21.stackVec3 = newArray20; - } - _this21.stackVec3[_this21.sizeVec3++] = v13; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this21.sizeMat3 == _this21.stackMat3.length) { - var newLength21 = _this21.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g44 = 0; - var _g122 = _this21.sizeMat3; - while(_g44 < _g122) { - var i25 = _g44++; - newArray21[i25] = _this21.stackMat3[i25]; - _this21.stackMat3[i25] = null; - } - _this21.stackMat3 = newArray21; - } - _this21.stackMat3[_this21.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this21.sizeMat4 == _this21.stackMat4.length) { - var newLength22 = _this21.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g45 = 0; - var _g123 = _this21.sizeMat4; - while(_g45 < _g123) { - var i26 = _g45++; - newArray22[i26] = _this21.stackMat4[i26]; - _this21.stackMat4[i26] = null; - } - _this21.stackMat4 = newArray22; - } - _this21.stackMat4[_this21.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx12 = 0; - var ty12 = 0; - var tz12 = 0; - var tw5 = 1; - quat5.x = tx12; - quat5.y = ty12; - quat5.z = tz12; - quat5.w = tw5; - if(_this21.sizeQuat == _this21.stackQuat.length) { - var newLength23 = _this21.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g46 = 0; - var _g124 = _this21.sizeQuat; - while(_g46 < _g124) { - var i27 = _g46++; - newArray23[i27] = _this21.stackQuat[i27]; - _this21.stackQuat[i27] = null; + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this21.stackQuat = newArray23; + _this14.stackVec3 = newArray; } - _this21.stackQuat[_this21.sizeQuat++] = quat5; + _this14.stackVec3[_this14.sizeVec3++] = v13; } - var _this22 = this._pool; - var mat36 = null; - var mat46 = null; - var quat6 = null; + let _this15 = this._pool; if(normal != null) { normal.zero(); - if(_this22.sizeVec3 == _this22.stackVec3.length) { - var newLength24 = _this22.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g47 = 0; - var _g125 = _this22.sizeVec3; - while(_g47 < _g125) { - var i28 = _g47++; - newArray24[i28] = _this22.stackVec3[i28]; - _this22.stackVec3[i28] = null; - } - _this22.stackVec3 = newArray24; - } - _this22.stackVec3[_this22.sizeVec3++] = normal; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this22.sizeMat3 == _this22.stackMat3.length) { - var newLength25 = _this22.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g48 = 0; - var _g126 = _this22.sizeMat3; - while(_g48 < _g126) { - var i29 = _g48++; - newArray25[i29] = _this22.stackMat3[i29]; - _this22.stackMat3[i29] = null; - } - _this22.stackMat3 = newArray25; - } - _this22.stackMat3[_this22.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this22.sizeMat4 == _this22.stackMat4.length) { - var newLength26 = _this22.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g49 = 0; - var _g127 = _this22.sizeMat4; - while(_g49 < _g127) { - var i30 = _g49++; - newArray26[i30] = _this22.stackMat4[i30]; - _this22.stackMat4[i30] = null; - } - _this22.stackMat4 = newArray26; - } - _this22.stackMat4[_this22.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx13 = 0; - var ty13 = 0; - var tz13 = 0; - var tw6 = 1; - quat6.x = tx13; - quat6.y = ty13; - quat6.z = tz13; - quat6.w = tw6; - if(_this22.sizeQuat == _this22.stackQuat.length) { - var newLength27 = _this22.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g50 = 0; - var _g128 = _this22.sizeQuat; - while(_g50 < _g128) { - var i31 = _g50++; - newArray27[i31] = _this22.stackQuat[i31]; - _this22.stackQuat[i31] = null; - } - _this22.stackQuat = newArray27; - } - _this22.stackQuat[_this22.sizeQuat++] = quat6; - } - var _this23 = this._pool; - var vec3 = null; - var mat47 = null; - var quat7 = null; - if(vec3 != null) { - vec3.zero(); - if(_this23.sizeVec3 == _this23.stackVec3.length) { - var newLength28 = _this23.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g51 = 0; - var _g129 = _this23.sizeVec3; - while(_g51 < _g129) { - var i32 = _g51++; - newArray28[i32] = _this23.stackVec3[i32]; - _this23.stackVec3[i32] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this23.stackVec3 = newArray28; + _this15.stackVec3 = newArray; } - _this23.stackVec3[_this23.sizeVec3++] = vec3; + _this15.stackVec3[_this15.sizeVec3++] = normal; } + let _this16 = this._pool; if(m != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - m.e00 = t0014; - m.e01 = t0114; - m.e02 = t0214; - m.e10 = t1014; - m.e11 = t1114; - m.e12 = t1214; - m.e20 = t2014; - m.e21 = t2114; - m.e22 = t2214; - if(_this23.sizeMat3 == _this23.stackMat3.length) { - var newLength29 = _this23.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g52 = 0; - var _g130 = _this23.sizeMat3; - while(_g52 < _g130) { - var i33 = _g52++; - newArray29[i33] = _this23.stackMat3[i33]; - _this23.stackMat3[i33] = null; - } - _this23.stackMat3 = newArray29; - } - _this23.stackMat3[_this23.sizeMat3++] = m; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this23.sizeMat4 == _this23.stackMat4.length) { - var newLength30 = _this23.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g53 = 0; - var _g131 = _this23.sizeMat4; - while(_g53 < _g131) { - var i34 = _g53++; - newArray30[i34] = _this23.stackMat4[i34]; - _this23.stackMat4[i34] = null; - } - _this23.stackMat4 = newArray30; - } - _this23.stackMat4[_this23.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx14 = 0; - var ty14 = 0; - var tz14 = 0; - var tw7 = 1; - quat7.x = tx14; - quat7.y = ty14; - quat7.z = tz14; - quat7.w = tw7; - if(_this23.sizeQuat == _this23.stackQuat.length) { - var newLength31 = _this23.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g54 = 0; - var _g132 = _this23.sizeQuat; - while(_g54 < _g132) { - var i35 = _g54++; - newArray31[i35] = _this23.stackQuat[i35]; - _this23.stackQuat[i35] = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this16.sizeMat3 == _this16.stackMat3.length) { + let newArray = new Array(_this16.sizeMat3 << 1); + let _g = 0; + let _g1 = _this16.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackMat3[i]; + _this16.stackMat3[i] = null; } - _this23.stackQuat = newArray31; + _this16.stackMat3 = newArray; } - _this23.stackQuat[_this23.sizeQuat++] = quat7; + _this16.stackMat3[_this16.sizeMat3++] = m; } - var _this24 = this._pool; - var mat37 = null; - var mat48 = null; - var quat8 = null; + let _this17 = this._pool; if(o != null) { o.zero(); - if(_this24.sizeVec3 == _this24.stackVec3.length) { - var newLength32 = _this24.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g55 = 0; - var _g133 = _this24.sizeVec3; - while(_g55 < _g133) { - var i36 = _g55++; - newArray32[i36] = _this24.stackVec3[i36]; - _this24.stackVec3[i36] = null; - } - _this24.stackVec3 = newArray32; - } - _this24.stackVec3[_this24.sizeVec3++] = o; - } - if(mat37 != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - mat37.e00 = t0016; - mat37.e01 = t0116; - mat37.e02 = t0216; - mat37.e10 = t1016; - mat37.e11 = t1116; - mat37.e12 = t1216; - mat37.e20 = t2016; - mat37.e21 = t2116; - mat37.e22 = t2216; - if(_this24.sizeMat3 == _this24.stackMat3.length) { - var newLength33 = _this24.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g56 = 0; - var _g134 = _this24.sizeMat3; - while(_g56 < _g134) { - var i37 = _g56++; - newArray33[i37] = _this24.stackMat3[i37]; - _this24.stackMat3[i37] = null; - } - _this24.stackMat3 = newArray33; - } - _this24.stackMat3[_this24.sizeMat3++] = mat37; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this24.sizeMat4 == _this24.stackMat4.length) { - var newLength34 = _this24.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g57 = 0; - var _g135 = _this24.sizeMat4; - while(_g57 < _g135) { - var i38 = _g57++; - newArray34[i38] = _this24.stackMat4[i38]; - _this24.stackMat4[i38] = null; - } - _this24.stackMat4 = newArray34; - } - _this24.stackMat4[_this24.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx15 = 0; - var ty15 = 0; - var tz15 = 0; - var tw8 = 1; - quat8.x = tx15; - quat8.y = ty15; - quat8.z = tz15; - quat8.w = tw8; - if(_this24.sizeQuat == _this24.stackQuat.length) { - var newLength35 = _this24.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g58 = 0; - var _g136 = _this24.sizeQuat; - while(_g58 < _g136) { - var i39 = _g58++; - newArray35[i39] = _this24.stackQuat[i39]; - _this24.stackQuat[i39] = null; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; } - _this24.stackQuat = newArray35; + _this17.stackVec3 = newArray; } - _this24.stackQuat[_this24.sizeQuat++] = quat8; + _this17.stackVec3[_this17.sizeVec3++] = o; } break; } } if(d.drawAabbs) { - var aabb = s._aabb; - var color = style.aabbColor; - var _this25 = this._pool; - var min = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - var _this26 = this._pool; - var max = _this26.sizeVec3 == 0 ? new oimo.common.Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - var v15 = min; - v15.x = aabb._minX; - v15.y = aabb._minY; - v15.z = aabb._minZ; - var v16 = max; - v16.x = aabb._maxX; - v16.y = aabb._maxY; - v16.z = aabb._maxZ; + let aabb = s._aabb; + let color = style.aabbColor; + let _this = this._pool; + let min = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let max = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = min; + v.x = aabb._minX; + v.y = aabb._minY; + v.z = aabb._minZ; + let v1 = max; + v1.x = aabb._maxX; + v1.y = aabb._maxY; + v1.z = aabb._maxZ; d.aabb(min,max,color); - var _this27 = this._pool; - var mat38 = null; - var mat49 = null; - var quat9 = null; + let _this2 = this._pool; if(min != null) { min.zero(); - if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newLength36 = _this27.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g59 = 0; - var _g137 = _this27.sizeVec3; - while(_g59 < _g137) { - var i40 = _g59++; - newArray36[i40] = _this27.stackVec3[i40]; - _this27.stackVec3[i40] = null; - } - _this27.stackVec3 = newArray36; - } - _this27.stackVec3[_this27.sizeVec3++] = min; - } - if(mat38 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat38.e00 = t0018; - mat38.e01 = t0118; - mat38.e02 = t0218; - mat38.e10 = t1018; - mat38.e11 = t1118; - mat38.e12 = t1218; - mat38.e20 = t2018; - mat38.e21 = t2118; - mat38.e22 = t2218; - if(_this27.sizeMat3 == _this27.stackMat3.length) { - var newLength37 = _this27.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g60 = 0; - var _g138 = _this27.sizeMat3; - while(_g60 < _g138) { - var i41 = _g60++; - newArray37[i41] = _this27.stackMat3[i41]; - _this27.stackMat3[i41] = null; - } - _this27.stackMat3 = newArray37; - } - _this27.stackMat3[_this27.sizeMat3++] = mat38; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this27.sizeMat4 == _this27.stackMat4.length) { - var newLength38 = _this27.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g61 = 0; - var _g139 = _this27.sizeMat4; - while(_g61 < _g139) { - var i42 = _g61++; - newArray38[i42] = _this27.stackMat4[i42]; - _this27.stackMat4[i42] = null; - } - _this27.stackMat4 = newArray38; - } - _this27.stackMat4[_this27.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx16 = 0; - var ty16 = 0; - var tz16 = 0; - var tw9 = 1; - quat9.x = tx16; - quat9.y = ty16; - quat9.z = tz16; - quat9.w = tw9; - if(_this27.sizeQuat == _this27.stackQuat.length) { - var newLength39 = _this27.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g62 = 0; - var _g140 = _this27.sizeQuat; - while(_g62 < _g140) { - var i43 = _g62++; - newArray39[i43] = _this27.stackQuat[i43]; - _this27.stackQuat[i43] = null; + if(_this2.sizeVec3 == _this2.stackVec3.length) { + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this27.stackQuat = newArray39; + _this2.stackVec3 = newArray; } - _this27.stackQuat[_this27.sizeQuat++] = quat9; + _this2.stackVec3[_this2.sizeVec3++] = min; } - var _this28 = this._pool; - var mat39 = null; - var mat410 = null; - var quat10 = null; + let _this3 = this._pool; if(max != null) { max.zero(); - if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newLength40 = _this28.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g63 = 0; - var _g141 = _this28.sizeVec3; - while(_g63 < _g141) { - var i44 = _g63++; - newArray40[i44] = _this28.stackVec3[i44]; - _this28.stackVec3[i44] = null; - } - _this28.stackVec3 = newArray40; - } - _this28.stackVec3[_this28.sizeVec3++] = max; - } - if(mat39 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat39.e00 = t0020; - mat39.e01 = t0120; - mat39.e02 = t0220; - mat39.e10 = t1020; - mat39.e11 = t1120; - mat39.e12 = t1220; - mat39.e20 = t2020; - mat39.e21 = t2120; - mat39.e22 = t2220; - if(_this28.sizeMat3 == _this28.stackMat3.length) { - var newLength41 = _this28.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g64 = 0; - var _g142 = _this28.sizeMat3; - while(_g64 < _g142) { - var i45 = _g64++; - newArray41[i45] = _this28.stackMat3[i45]; - _this28.stackMat3[i45] = null; - } - _this28.stackMat3 = newArray41; - } - _this28.stackMat3[_this28.sizeMat3++] = mat39; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this28.sizeMat4 == _this28.stackMat4.length) { - var newLength42 = _this28.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g65 = 0; - var _g143 = _this28.sizeMat4; - while(_g65 < _g143) { - var i46 = _g65++; - newArray42[i46] = _this28.stackMat4[i46]; - _this28.stackMat4[i46] = null; - } - _this28.stackMat4 = newArray42; - } - _this28.stackMat4[_this28.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx17 = 0; - var ty17 = 0; - var tz17 = 0; - var tw10 = 1; - quat10.x = tx17; - quat10.y = ty17; - quat10.z = tz17; - quat10.w = tw10; - if(_this28.sizeQuat == _this28.stackQuat.length) { - var newLength43 = _this28.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g66 = 0; - var _g144 = _this28.sizeQuat; - while(_g66 < _g144) { - var i47 = _g66++; - newArray43[i47] = _this28.stackQuat[i47]; - _this28.stackQuat[i47] = null; + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this28.stackQuat = newArray43; + _this3.stackVec3 = newArray; } - _this28.stackQuat[_this28.sizeQuat++] = quat10; + _this3.stackVec3[_this3.sizeVec3++] = max; } } - s = n1; + s = n; } r = n; } } _drawConstraints(d) { - var style = d.style; + let style = d.style; if(d.drawPairs || d.drawContacts) { - var c = this._contactManager._contactList; + let c = this._contactManager._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(d.drawPairs) { - var color = style.pairColor; - var _this = this._pool; - var v1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var v2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var v = v1; + let color = style.pairColor; + let _this = this._pool; + let v1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let v2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = v1; v.x = c._s1._transform._positionX; v.y = c._s1._transform._positionY; v.z = c._s1._transform._positionZ; - var v3 = v2; + let v3 = v2; v3.x = c._s2._transform._positionX; v3.y = c._s2._transform._positionY; v3.z = c._s2._transform._positionZ; d.line(v1,v2,color); - var _this2 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this2 = this._pool; if(v1 != null) { v1.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newLength = _this2.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this2.sizeVec3; + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -20653,980 +16792,196 @@ oimo.dynamics.World = class oimo_dynamics_World { } _this2.stackVec3[_this2.sizeVec3++] = v1; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this2.sizeMat3 == _this2.stackMat3.length) { - var newLength1 = _this2.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this2.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this2.stackMat3[i1]; - _this2.stackMat3[i1] = null; - } - _this2.stackMat3 = newArray1; - } - _this2.stackMat3[_this2.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this2.sizeMat4 == _this2.stackMat4.length) { - var newLength2 = _this2.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this2.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this2.stackMat4[i2]; - _this2.stackMat4[i2] = null; - } - _this2.stackMat4 = newArray2; - } - _this2.stackMat4[_this2.sizeMat4++] = mat4; - } - if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; - if(_this2.sizeQuat == _this2.stackQuat.length) { - var newLength3 = _this2.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this2.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this2.stackQuat[i3]; - _this2.stackQuat[i3] = null; - } - _this2.stackQuat = newArray3; - } - _this2.stackQuat[_this2.sizeQuat++] = quat; - } - var _this3 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this3 = this._pool; if(v2 != null) { v2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength4 = _this3.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this3.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this3.stackVec3[i4]; - _this3.stackVec3[i4] = null; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this3.stackVec3 = newArray4; + _this3.stackVec3 = newArray; } _this3.stackVec3[_this3.sizeVec3++] = v2; } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this3.sizeMat3 == _this3.stackMat3.length) { - var newLength5 = _this3.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this3.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this3.stackMat3[i5]; - _this3.stackMat3[i5] = null; - } - _this3.stackMat3 = newArray5; - } - _this3.stackMat3[_this3.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this3.sizeMat4 == _this3.stackMat4.length) { - var newLength6 = _this3.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this3.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this3.stackMat4[i6]; - _this3.stackMat4[i6] = null; - } - _this3.stackMat4 = newArray6; - } - _this3.stackMat4[_this3.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx1 = 0; - var ty1 = 0; - var tz1 = 0; - var tw1 = 1; - quat1.x = tx1; - quat1.y = ty1; - quat1.z = tz1; - quat1.w = tw1; - if(_this3.sizeQuat == _this3.stackQuat.length) { - var newLength7 = _this3.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this3.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this3.stackQuat[i7]; - _this3.stackQuat[i7] = null; - } - _this3.stackQuat = newArray7; - } - _this3.stackQuat[_this3.sizeQuat++] = quat1; - } } if(d.drawContacts) { - var cc = c._contactConstraint; - var ps = c._contactConstraint._manifold._points; - var _g9 = 0; - var _g18 = c._contactConstraint._manifold._numPoints; - while(_g9 < _g18) { - var i8 = _g9++; - var p = ps[i8]; - var style1 = d.style; - var tf1 = cc._s1._transform; - var tf2 = cc._s2._transform; - var _this4 = this._pool; - var pos1 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var _this5 = this._pool; - var pos2 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - var _this6 = this._pool; - var normal = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var _this7 = this._pool; - var tangent = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; - var _this8 = this._pool; - var binormal = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - var v4 = pos1; - v4.x = p._pos1X; - v4.y = p._pos1Y; - v4.z = p._pos1Z; - var v5 = pos2; - v5.x = p._pos2X; - v5.y = p._pos2Y; - v5.z = p._pos2Z; - var v6 = normal; - v6.x = cc._manifold._normalX; - v6.y = cc._manifold._normalY; - v6.z = cc._manifold._normalZ; - var v7 = tangent; - v7.x = cc._manifold._tangentX; - v7.y = cc._manifold._tangentY; - v7.z = cc._manifold._tangentZ; - var v8 = binormal; - v8.x = cc._manifold._binormalX; - v8.y = cc._manifold._binormalY; - v8.z = cc._manifold._binormalZ; + let cc = c._contactConstraint; + let ps = c._contactConstraint._manifold._points; + let _g = 0; + let _g1 = c._contactConstraint._manifold._numPoints; + while(_g < _g1) { + let p = ps[_g++]; + let style = d.style; + let _this = this._pool; + let pos1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let pos2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this._pool; + let normal = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let tangent = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let binormal = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let v = pos1; + v.x = p._pos1X; + v.y = p._pos1Y; + v.z = p._pos1Z; + let v1 = pos2; + v1.x = p._pos2X; + v1.y = p._pos2Y; + v1.z = p._pos2Z; + let v2 = normal; + v2.x = cc._manifold._normalX; + v2.y = cc._manifold._normalY; + v2.z = cc._manifold._normalZ; + let v3 = tangent; + v3.x = cc._manifold._tangentX; + v3.y = cc._manifold._tangentY; + v3.z = cc._manifold._tangentZ; + let v4 = binormal; + v4.x = cc._manifold._binormalX; + v4.y = cc._manifold._binormalY; + v4.z = cc._manifold._binormalZ; if(p._disabled) { - d.point(pos1,style1.disabledContactColor); - d.point(pos2,style1.disabledContactColor); - d.line(pos1,pos2,style1.disabledContactColor); + d.point(pos1,style.disabledContactColor); + d.point(pos2,style.disabledContactColor); + d.line(pos1,pos2,style.disabledContactColor); } else if(p._warmStarted) { - var color1; + let color; switch(p._id & 3) { case 0: - color1 = style1.contactColor; + color = style.contactColor; break; case 1: - color1 = style1.contactColor2; + color = style.contactColor2; break; case 2: - color1 = style1.contactColor3; + color = style.contactColor3; break; default: - color1 = style1.contactColor4; + color = style.contactColor4; } - d.point(pos1,color1); - d.point(pos2,color1); - d.line(pos1,pos2,style1.contactColor); + d.point(pos1,color); + d.point(pos2,color); + d.line(pos1,pos2,style.contactColor); } else { - d.point(pos1,style1.newContactColor); - d.point(pos2,style1.newContactColor); - d.line(pos1,pos2,style1.newContactColor); + d.point(pos1,style.newContactColor); + d.point(pos2,style.newContactColor); + d.line(pos1,pos2,style.newContactColor); } pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this9 = pos2; - var s = style1.contactNormalLength; - var tx2 = _this9.x + normal.x * s; - var ty2 = _this9.y + normal.y * s; - var tz2 = _this9.z + normal.z * s; - _this9.x = tx2; - _this9.y = ty2; - _this9.z = tz2; - d.line(pos1,pos2,style1.contactNormalColor); + let _this5 = pos2; + let s = style.contactNormalLength; + _this5.x += normal.x * s; + _this5.y += normal.y * s; + _this5.z += normal.z * s; + d.line(pos1,pos2,style.contactNormalColor); if(d.drawContactBases) { pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this10 = pos2; - var s1 = style1.contactTangentLength; - var tx3 = _this10.x + tangent.x * s1; - var ty3 = _this10.y + tangent.y * s1; - var tz3 = _this10.z + tangent.z * s1; - _this10.x = tx3; - _this10.y = ty3; - _this10.z = tz3; - d.line(pos1,pos2,style1.contactTangentColor); + let _this = pos2; + let s = style.contactTangentLength; + _this.x += tangent.x * s; + _this.y += tangent.y * s; + _this.z += tangent.z * s; + d.line(pos1,pos2,style.contactTangentColor); pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this11 = pos2; - var s2 = style1.contactBinormalLength; - var tx4 = _this11.x + binormal.x * s2; - var ty4 = _this11.y + binormal.y * s2; - var tz4 = _this11.z + binormal.z * s2; - _this11.x = tx4; - _this11.y = ty4; - _this11.z = tz4; - d.line(pos1,pos2,style1.contactBinormalColor); + let _this1 = pos2; + let s1 = style.contactBinormalLength; + _this1.x += binormal.x * s1; + _this1.y += binormal.y * s1; + _this1.z += binormal.z * s1; + d.line(pos1,pos2,style.contactBinormalColor); } - var _this12 = this._pool; - var mat32 = null; - var mat42 = null; - var quat2 = null; + let _this6 = this._pool; if(pos1 != null) { pos1.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength8 = _this12.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g10 = 0; - var _g19 = _this12.sizeVec3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray8[i9] = _this12.stackVec3[i9]; - _this12.stackVec3[i9] = null; - } - _this12.stackVec3 = newArray8; - } - _this12.stackVec3[_this12.sizeVec3++] = pos1; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this12.sizeMat3 == _this12.stackMat3.length) { - var newLength9 = _this12.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g20 = 0; - var _g110 = _this12.sizeMat3; - while(_g20 < _g110) { - var i10 = _g20++; - newArray9[i10] = _this12.stackMat3[i10]; - _this12.stackMat3[i10] = null; - } - _this12.stackMat3 = newArray9; - } - _this12.stackMat3[_this12.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this12.sizeMat4 == _this12.stackMat4.length) { - var newLength10 = _this12.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g21 = 0; - var _g111 = _this12.sizeMat4; - while(_g21 < _g111) { - var i11 = _g21++; - newArray10[i11] = _this12.stackMat4[i11]; - _this12.stackMat4[i11] = null; - } - _this12.stackMat4 = newArray10; - } - _this12.stackMat4[_this12.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx5 = 0; - var ty5 = 0; - var tz5 = 0; - var tw2 = 1; - quat2.x = tx5; - quat2.y = ty5; - quat2.z = tz5; - quat2.w = tw2; - if(_this12.sizeQuat == _this12.stackQuat.length) { - var newLength11 = _this12.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g22 = 0; - var _g112 = _this12.sizeQuat; - while(_g22 < _g112) { - var i12 = _g22++; - newArray11[i12] = _this12.stackQuat[i12]; - _this12.stackQuat[i12] = null; + if(_this6.sizeVec3 == _this6.stackVec3.length) { + let newArray = new Array(_this6.sizeVec3 << 1); + let _g = 0; + let _g1 = _this6.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this6.stackVec3[i]; + _this6.stackVec3[i] = null; } - _this12.stackQuat = newArray11; + _this6.stackVec3 = newArray; } - _this12.stackQuat[_this12.sizeQuat++] = quat2; + _this6.stackVec3[_this6.sizeVec3++] = pos1; } - var _this13 = this._pool; - var mat33 = null; - var mat43 = null; - var quat3 = null; + let _this7 = this._pool; if(pos2 != null) { pos2.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength12 = _this13.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g23 = 0; - var _g113 = _this13.sizeVec3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray12[i13] = _this13.stackVec3[i13]; - _this13.stackVec3[i13] = null; - } - _this13.stackVec3 = newArray12; - } - _this13.stackVec3[_this13.sizeVec3++] = pos2; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this13.sizeMat3 == _this13.stackMat3.length) { - var newLength13 = _this13.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g24 = 0; - var _g114 = _this13.sizeMat3; - while(_g24 < _g114) { - var i14 = _g24++; - newArray13[i14] = _this13.stackMat3[i14]; - _this13.stackMat3[i14] = null; - } - _this13.stackMat3 = newArray13; - } - _this13.stackMat3[_this13.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this13.sizeMat4 == _this13.stackMat4.length) { - var newLength14 = _this13.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g25 = 0; - var _g115 = _this13.sizeMat4; - while(_g25 < _g115) { - var i15 = _g25++; - newArray14[i15] = _this13.stackMat4[i15]; - _this13.stackMat4[i15] = null; - } - _this13.stackMat4 = newArray14; - } - _this13.stackMat4[_this13.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw3 = 1; - quat3.x = tx6; - quat3.y = ty6; - quat3.z = tz6; - quat3.w = tw3; - if(_this13.sizeQuat == _this13.stackQuat.length) { - var newLength15 = _this13.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g26 = 0; - var _g116 = _this13.sizeQuat; - while(_g26 < _g116) { - var i16 = _g26++; - newArray15[i16] = _this13.stackQuat[i16]; - _this13.stackQuat[i16] = null; + if(_this7.sizeVec3 == _this7.stackVec3.length) { + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this13.stackQuat = newArray15; + _this7.stackVec3 = newArray; } - _this13.stackQuat[_this13.sizeQuat++] = quat3; + _this7.stackVec3[_this7.sizeVec3++] = pos2; } - var _this14 = this._pool; - var mat34 = null; - var mat44 = null; - var quat4 = null; + let _this8 = this._pool; if(normal != null) { normal.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength16 = _this14.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g27 = 0; - var _g117 = _this14.sizeVec3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray16[i17] = _this14.stackVec3[i17]; - _this14.stackVec3[i17] = null; - } - _this14.stackVec3 = newArray16; - } - _this14.stackVec3[_this14.sizeVec3++] = normal; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this14.sizeMat3 == _this14.stackMat3.length) { - var newLength17 = _this14.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g28 = 0; - var _g118 = _this14.sizeMat3; - while(_g28 < _g118) { - var i18 = _g28++; - newArray17[i18] = _this14.stackMat3[i18]; - _this14.stackMat3[i18] = null; - } - _this14.stackMat3 = newArray17; - } - _this14.stackMat3[_this14.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this14.sizeMat4 == _this14.stackMat4.length) { - var newLength18 = _this14.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g29 = 0; - var _g119 = _this14.sizeMat4; - while(_g29 < _g119) { - var i19 = _g29++; - newArray18[i19] = _this14.stackMat4[i19]; - _this14.stackMat4[i19] = null; - } - _this14.stackMat4 = newArray18; - } - _this14.stackMat4[_this14.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx7 = 0; - var ty7 = 0; - var tz7 = 0; - var tw4 = 1; - quat4.x = tx7; - quat4.y = ty7; - quat4.z = tz7; - quat4.w = tw4; - if(_this14.sizeQuat == _this14.stackQuat.length) { - var newLength19 = _this14.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g30 = 0; - var _g120 = _this14.sizeQuat; - while(_g30 < _g120) { - var i20 = _g30++; - newArray19[i20] = _this14.stackQuat[i20]; - _this14.stackQuat[i20] = null; + if(_this8.sizeVec3 == _this8.stackVec3.length) { + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; } - _this14.stackQuat = newArray19; + _this8.stackVec3 = newArray; } - _this14.stackQuat[_this14.sizeQuat++] = quat4; + _this8.stackVec3[_this8.sizeVec3++] = normal; } - var _this15 = this._pool; - var mat35 = null; - var mat45 = null; - var quat5 = null; + let _this9 = this._pool; if(tangent != null) { tangent.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength20 = _this15.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g31 = 0; - var _g121 = _this15.sizeVec3; - while(_g31 < _g121) { - var i21 = _g31++; - newArray20[i21] = _this15.stackVec3[i21]; - _this15.stackVec3[i21] = null; - } - _this15.stackVec3 = newArray20; - } - _this15.stackVec3[_this15.sizeVec3++] = tangent; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this15.sizeMat3 == _this15.stackMat3.length) { - var newLength21 = _this15.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g32 = 0; - var _g122 = _this15.sizeMat3; - while(_g32 < _g122) { - var i22 = _g32++; - newArray21[i22] = _this15.stackMat3[i22]; - _this15.stackMat3[i22] = null; - } - _this15.stackMat3 = newArray21; - } - _this15.stackMat3[_this15.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this15.sizeMat4 == _this15.stackMat4.length) { - var newLength22 = _this15.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g33 = 0; - var _g123 = _this15.sizeMat4; - while(_g33 < _g123) { - var i23 = _g33++; - newArray22[i23] = _this15.stackMat4[i23]; - _this15.stackMat4[i23] = null; - } - _this15.stackMat4 = newArray22; - } - _this15.stackMat4[_this15.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx8 = 0; - var ty8 = 0; - var tz8 = 0; - var tw5 = 1; - quat5.x = tx8; - quat5.y = ty8; - quat5.z = tz8; - quat5.w = tw5; - if(_this15.sizeQuat == _this15.stackQuat.length) { - var newLength23 = _this15.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g34 = 0; - var _g124 = _this15.sizeQuat; - while(_g34 < _g124) { - var i24 = _g34++; - newArray23[i24] = _this15.stackQuat[i24]; - _this15.stackQuat[i24] = null; + if(_this9.sizeVec3 == _this9.stackVec3.length) { + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; } - _this15.stackQuat = newArray23; + _this9.stackVec3 = newArray; } - _this15.stackQuat[_this15.sizeQuat++] = quat5; + _this9.stackVec3[_this9.sizeVec3++] = tangent; } - var _this16 = this._pool; - var mat36 = null; - var mat46 = null; - var quat6 = null; + let _this10 = this._pool; if(binormal != null) { binormal.zero(); - if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newLength24 = _this16.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g35 = 0; - var _g125 = _this16.sizeVec3; - while(_g35 < _g125) { - var i25 = _g35++; - newArray24[i25] = _this16.stackVec3[i25]; - _this16.stackVec3[i25] = null; - } - _this16.stackVec3 = newArray24; - } - _this16.stackVec3[_this16.sizeVec3++] = binormal; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this16.sizeMat3 == _this16.stackMat3.length) { - var newLength25 = _this16.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g36 = 0; - var _g126 = _this16.sizeMat3; - while(_g36 < _g126) { - var i26 = _g36++; - newArray25[i26] = _this16.stackMat3[i26]; - _this16.stackMat3[i26] = null; - } - _this16.stackMat3 = newArray25; - } - _this16.stackMat3[_this16.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this16.sizeMat4 == _this16.stackMat4.length) { - var newLength26 = _this16.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g37 = 0; - var _g127 = _this16.sizeMat4; - while(_g37 < _g127) { - var i27 = _g37++; - newArray26[i27] = _this16.stackMat4[i27]; - _this16.stackMat4[i27] = null; - } - _this16.stackMat4 = newArray26; - } - _this16.stackMat4[_this16.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx9 = 0; - var ty9 = 0; - var tz9 = 0; - var tw6 = 1; - quat6.x = tx9; - quat6.y = ty9; - quat6.z = tz9; - quat6.w = tw6; - if(_this16.sizeQuat == _this16.stackQuat.length) { - var newLength27 = _this16.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g38 = 0; - var _g128 = _this16.sizeQuat; - while(_g38 < _g128) { - var i28 = _g38++; - newArray27[i28] = _this16.stackQuat[i28]; - _this16.stackQuat[i28] = null; + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this16.stackQuat = newArray27; + _this10.stackVec3 = newArray; } - _this16.stackQuat[_this16.sizeQuat++] = quat6; + _this10.stackVec3[_this10.sizeVec3++] = binormal; } } } @@ -21634,69 +16989,69 @@ oimo.dynamics.World = class oimo_dynamics_World { } } if(d.drawJoints) { - var j = this._jointList; + let j = this._jointList; while(j != null) { - var n1 = j._next; - var _this17 = this._pool; - var p1 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - var _this18 = this._pool; - var p2 = _this18.sizeVec3 == 0 ? new oimo.common.Vec3() : _this18.stackVec3[--_this18.sizeVec3]; - var v9 = p1; - v9.x = j._b1._transform._positionX; - v9.y = j._b1._transform._positionY; - v9.z = j._b1._transform._positionZ; - var v10 = p2; - v10.x = j._b2._transform._positionX; - v10.y = j._b2._transform._positionY; - v10.z = j._b2._transform._positionZ; - var _this19 = this._pool; - var anchor1 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - var _this20 = this._pool; - var anchor2 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - var _this21 = this._pool; - var basisX1 = _this21.sizeVec3 == 0 ? new oimo.common.Vec3() : _this21.stackVec3[--_this21.sizeVec3]; - var _this22 = this._pool; - var basisY1 = _this22.sizeVec3 == 0 ? new oimo.common.Vec3() : _this22.stackVec3[--_this22.sizeVec3]; - var _this23 = this._pool; - var basisZ1 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - var _this24 = this._pool; - var basisX2 = _this24.sizeVec3 == 0 ? new oimo.common.Vec3() : _this24.stackVec3[--_this24.sizeVec3]; - var _this25 = this._pool; - var basisY2 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - var _this26 = this._pool; - var basisZ2 = _this26.sizeVec3 == 0 ? new oimo.common.Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - var v11 = anchor1; - v11.x = j._anchor1X; - v11.y = j._anchor1Y; - v11.z = j._anchor1Z; - var v12 = anchor2; - v12.x = j._anchor2X; - v12.y = j._anchor2Y; - v12.z = j._anchor2Z; - var v13 = basisX1; - v13.x = j._basisX1X; - v13.y = j._basisX1Y; - v13.z = j._basisX1Z; - var v14 = basisY1; - v14.x = j._basisY1X; - v14.y = j._basisY1Y; - v14.z = j._basisY1Z; - var v15 = basisZ1; - v15.x = j._basisZ1X; - v15.y = j._basisZ1Y; - v15.z = j._basisZ1Z; - var v16 = basisX2; - v16.x = j._basisX2X; - v16.y = j._basisX2Y; - v16.z = j._basisX2Z; - var v17 = basisY2; - v17.x = j._basisY2X; - v17.y = j._basisY2Y; - v17.z = j._basisY2Z; - var v18 = basisZ2; - v18.x = j._basisZ2X; - v18.y = j._basisZ2Y; - v18.z = j._basisZ2Z; + let n = j._next; + let _this = this._pool; + let p1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let p2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = p1; + v.x = j._b1._transform._positionX; + v.y = j._b1._transform._positionY; + v.z = j._b1._transform._positionZ; + let v1 = p2; + v1.x = j._b2._transform._positionX; + v1.y = j._b2._transform._positionY; + v1.z = j._b2._transform._positionZ; + let _this2 = this._pool; + let anchor1 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let anchor2 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let basisX1 = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let _this5 = this._pool; + let basisY1 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this6 = this._pool; + let basisZ1 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let _this7 = this._pool; + let basisX2 = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + let _this8 = this._pool; + let basisY2 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this9 = this._pool; + let basisZ2 = _this9.sizeVec3 == 0 ? new oimo.common.Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + let v2 = anchor1; + v2.x = j._anchor1X; + v2.y = j._anchor1Y; + v2.z = j._anchor1Z; + let v3 = anchor2; + v3.x = j._anchor2X; + v3.y = j._anchor2Y; + v3.z = j._anchor2Z; + let v4 = basisX1; + v4.x = j._basisX1X; + v4.y = j._basisX1Y; + v4.z = j._basisX1Z; + let v5 = basisY1; + v5.x = j._basisY1X; + v5.y = j._basisY1Y; + v5.z = j._basisY1Z; + let v6 = basisZ1; + v6.x = j._basisZ1X; + v6.y = j._basisZ1Y; + v6.z = j._basisZ1Z; + let v7 = basisX2; + v7.x = j._basisX2X; + v7.y = j._basisX2Y; + v7.z = j._basisX2Z; + let v8 = basisY2; + v8.x = j._basisY2X; + v8.y = j._basisY2Y; + v8.z = j._basisY2Z; + let v9 = basisZ2; + v9.x = j._basisZ2X; + v9.y = j._basisZ2Y; + v9.z = j._basisZ2Z; d.line(p1,anchor1,d.style.jointLineColor); d.line(p2,anchor2,d.style.jointLineColor); if(d.drawJointLimits) { @@ -21704,1643 +17059,293 @@ oimo.dynamics.World = class oimo_dynamics_World { case 0: break; case 1: - var radius = d.style.jointRotationalConstraintRadius; - var color2 = d.style.jointLineColor; - var lm = j._lm; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,radius,lm.lowerLimit,lm.upperLimit,color2); + let lm = j._lm; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,lm.lowerLimit,lm.upperLimit,d.style.jointLineColor); break; case 2: - var j1 = j; - var radius1 = d.style.jointRotationalConstraintRadius; - var color3 = d.style.jointLineColor; - var rlm = j1._rotLm; - var tlm = j1._translLm; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,radius1,rlm.lowerLimit,rlm.upperLimit,color3); - this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color3); + let j1 = j; + let color = d.style.jointLineColor; + let rlm = j1._rotLm; + let tlm = j1._translLm; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color); break; case 3: - var radius2 = d.style.jointRotationalConstraintRadius; - var color4 = d.style.jointLineColor; - var lm1 = j._lm; - this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,color4); + let lm1 = j._lm; + this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,d.style.jointLineColor); break; case 4: - var j2 = j; - var radius3 = d.style.jointRotationalConstraintRadius; - var color5 = d.style.jointLineColor; - var lm11 = j2._lm1; - var lm2 = j2._lm2; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius3,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color5); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius3,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color5); + let j2 = j; + let radius = d.style.jointRotationalConstraintRadius; + let color1 = d.style.jointLineColor; + let lm11 = j2._lm1; + let lm2 = j2._lm2; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color1); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color1); break; case 5: - var j3 = j; - var radius4 = d.style.jointRotationalConstraintRadius; - var color6 = d.style.jointLineColor; - var lm3 = j3._twistLm; - this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius4,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color6); - this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius4,color6); - var _this27 = this._pool; - var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = anchor2.x; - _this28.y = anchor2.y; - _this28.z = anchor2.z; - var _this29 = _this28; - var tx10 = _this29.x + basisX2.x * radius4; - var ty10 = _this29.y + basisX2.y * radius4; - var tz10 = _this29.z + basisX2.z * radius4; - _this29.x = tx10; - _this29.y = ty10; - _this29.z = tz10; - var to = _this29; - d.line(anchor2,to,color6); - var _this30 = this._pool; - var mat37 = null; - var mat47 = null; - var quat7 = null; - if(to != null) { - to.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newLength28 = _this30.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g39 = 0; - var _g129 = _this30.sizeVec3; - while(_g39 < _g129) { - var i29 = _g39++; - newArray28[i29] = _this30.stackVec3[i29]; - _this30.stackVec3[i29] = null; - } - _this30.stackVec3 = newArray28; - } - _this30.stackVec3[_this30.sizeVec3++] = to; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this30.sizeMat3 == _this30.stackMat3.length) { - var newLength29 = _this30.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g40 = 0; - var _g130 = _this30.sizeMat3; - while(_g40 < _g130) { - var i30 = _g40++; - newArray29[i30] = _this30.stackMat3[i30]; - _this30.stackMat3[i30] = null; - } - _this30.stackMat3 = newArray29; - } - _this30.stackMat3[_this30.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this30.sizeMat4 == _this30.stackMat4.length) { - var newLength30 = _this30.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g41 = 0; - var _g131 = _this30.sizeMat4; - while(_g41 < _g131) { - var i31 = _g41++; - newArray30[i31] = _this30.stackMat4[i31]; - _this30.stackMat4[i31] = null; - } - _this30.stackMat4 = newArray30; - } - _this30.stackMat4[_this30.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx11 = 0; - var ty11 = 0; - var tz11 = 0; - var tw7 = 1; - quat7.x = tx11; - quat7.y = ty11; - quat7.z = tz11; - quat7.w = tw7; - if(_this30.sizeQuat == _this30.stackQuat.length) { - var newLength31 = _this30.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g42 = 0; - var _g132 = _this30.sizeQuat; - while(_g42 < _g132) { - var i32 = _g42++; - newArray31[i32] = _this30.stackQuat[i32]; - _this30.stackQuat[i32] = null; + let j3 = j; + let radius1 = d.style.jointRotationalConstraintRadius; + let color2 = d.style.jointLineColor; + let lm3 = j3._twistLm; + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color2); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color2); + let _this10 = this._pool; + let _this11 = _this10.sizeVec3 == 0 ? new oimo.common.Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = anchor2.x; + _this11.y = anchor2.y; + _this11.z = anchor2.z; + let _this12 = _this11; + _this12.x += basisX2.x * radius1; + _this12.y += basisX2.y * radius1; + _this12.z += basisX2.z * radius1; + d.line(anchor2,_this12,color2); + let _this13 = this._pool; + if(_this12 != null) { + _this12.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this30.stackQuat = newArray31; + _this13.stackVec3 = newArray; } - _this30.stackQuat[_this30.sizeQuat++] = quat7; + _this13.stackVec3[_this13.sizeVec3++] = _this12; } break; case 6: - var j4 = j; - var radius5 = d.style.jointRotationalConstraintRadius; - var color7 = d.style.jointLineColor; - var txlm = j4._translLms[0]; - var tylm = j4._translLms[1]; - var tzlm = j4._translLms[2]; - var rxlm = j4._rotLms[0]; - var rylm = j4._rotLms[1]; - var rzlm = j4._rotLms[2]; - this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,txlm,tylm,tzlm,color7); - var _this31 = this._pool; - var rotYAxis = _this31.sizeVec3 == 0 ? new oimo.common.Vec3() : _this31.stackVec3[--_this31.sizeVec3]; - var v19 = rotYAxis; - v19.x = j4._axisYX; - v19.y = j4._axisYY; - v19.z = j4._axisYZ; - var _this32 = this._pool; - var _this33 = _this32.sizeVec3 == 0 ? new oimo.common.Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = basisX1.x; - _this33.y = basisX1.y; - _this33.z = basisX1.z; - var rotYBasisX = _this33; - var _this34 = this._pool; - var _this35 = _this34.sizeVec3 == 0 ? new oimo.common.Vec3() : _this34.stackVec3[--_this34.sizeVec3]; - _this35.x = basisX1.x; - _this35.y = basisX1.y; - _this35.z = basisX1.z; - var _this36 = _this35; - var tx12 = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; - var ty12 = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; - var tz12 = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; - _this36.x = tx12; - _this36.y = ty12; - _this36.z = tz12; - var rotYBasisY = _this36; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius5,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color7); - this._drawRotationalLimit(d,anchor2,rotYBasisX,rotYBasisY,rotYBasisX,radius5,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color7); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius5,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color7); + let j4 = j; + let radius2 = d.style.jointRotationalConstraintRadius; + let color3 = d.style.jointLineColor; + let rxlm = j4._rotLms[0]; + let rylm = j4._rotLms[1]; + let rzlm = j4._rotLms[2]; + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color3); + let _this14 = this._pool; + let rotYAxis = _this14.sizeVec3 == 0 ? new oimo.common.Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + let v10 = rotYAxis; + v10.x = j4._axisYX; + v10.y = j4._axisYY; + v10.z = j4._axisYZ; + let _this15 = this._pool; + let _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = basisX1.x; + _this16.y = basisX1.y; + _this16.z = basisX1.z; + let rotYBasisX = _this16; + let _this17 = this._pool; + let _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = basisX1.x; + _this18.y = basisX1.y; + _this18.z = basisX1.z; + let _this19 = _this18; + let y = _this19.z * rotYAxis.x - _this19.x * rotYAxis.z; + let z = _this19.x * rotYAxis.y - _this19.y * rotYAxis.x; + _this19.x = _this19.y * rotYAxis.z - _this19.z * rotYAxis.y; + _this19.y = y; + _this19.z = z; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color3); + this._drawRotationalLimit(d,anchor2,rotYBasisX,_this19,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color3); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color3); break; } } d.line(anchor1,anchor2,d.style.jointErrorColor); - var _this37 = this._pool; - var mat38 = null; - var mat48 = null; - var quat8 = null; + let _this20 = this._pool; if(p1 != null) { p1.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newLength32 = _this37.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g43 = 0; - var _g133 = _this37.sizeVec3; - while(_g43 < _g133) { - var i33 = _g43++; - newArray32[i33] = _this37.stackVec3[i33]; - _this37.stackVec3[i33] = null; - } - _this37.stackVec3 = newArray32; - } - _this37.stackVec3[_this37.sizeVec3++] = p1; - } - if(mat38 != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - mat38.e00 = t0016; - mat38.e01 = t0116; - mat38.e02 = t0216; - mat38.e10 = t1016; - mat38.e11 = t1116; - mat38.e12 = t1216; - mat38.e20 = t2016; - mat38.e21 = t2116; - mat38.e22 = t2216; - if(_this37.sizeMat3 == _this37.stackMat3.length) { - var newLength33 = _this37.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g44 = 0; - var _g134 = _this37.sizeMat3; - while(_g44 < _g134) { - var i34 = _g44++; - newArray33[i34] = _this37.stackMat3[i34]; - _this37.stackMat3[i34] = null; - } - _this37.stackMat3 = newArray33; - } - _this37.stackMat3[_this37.sizeMat3++] = mat38; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this37.sizeMat4 == _this37.stackMat4.length) { - var newLength34 = _this37.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g45 = 0; - var _g135 = _this37.sizeMat4; - while(_g45 < _g135) { - var i35 = _g45++; - newArray34[i35] = _this37.stackMat4[i35]; - _this37.stackMat4[i35] = null; - } - _this37.stackMat4 = newArray34; - } - _this37.stackMat4[_this37.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx13 = 0; - var ty13 = 0; - var tz13 = 0; - var tw8 = 1; - quat8.x = tx13; - quat8.y = ty13; - quat8.z = tz13; - quat8.w = tw8; - if(_this37.sizeQuat == _this37.stackQuat.length) { - var newLength35 = _this37.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g46 = 0; - var _g136 = _this37.sizeQuat; - while(_g46 < _g136) { - var i36 = _g46++; - newArray35[i36] = _this37.stackQuat[i36]; - _this37.stackQuat[i36] = null; + if(_this20.sizeVec3 == _this20.stackVec3.length) { + let newArray = new Array(_this20.sizeVec3 << 1); + let _g = 0; + let _g1 = _this20.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this20.stackVec3[i]; + _this20.stackVec3[i] = null; } - _this37.stackQuat = newArray35; + _this20.stackVec3 = newArray; } - _this37.stackQuat[_this37.sizeQuat++] = quat8; + _this20.stackVec3[_this20.sizeVec3++] = p1; } - var _this38 = this._pool; - var mat39 = null; - var mat49 = null; - var quat9 = null; + let _this21 = this._pool; if(p2 != null) { p2.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newLength36 = _this38.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g47 = 0; - var _g137 = _this38.sizeVec3; - while(_g47 < _g137) { - var i37 = _g47++; - newArray36[i37] = _this38.stackVec3[i37]; - _this38.stackVec3[i37] = null; - } - _this38.stackVec3 = newArray36; - } - _this38.stackVec3[_this38.sizeVec3++] = p2; - } - if(mat39 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat39.e00 = t0018; - mat39.e01 = t0118; - mat39.e02 = t0218; - mat39.e10 = t1018; - mat39.e11 = t1118; - mat39.e12 = t1218; - mat39.e20 = t2018; - mat39.e21 = t2118; - mat39.e22 = t2218; - if(_this38.sizeMat3 == _this38.stackMat3.length) { - var newLength37 = _this38.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g48 = 0; - var _g138 = _this38.sizeMat3; - while(_g48 < _g138) { - var i38 = _g48++; - newArray37[i38] = _this38.stackMat3[i38]; - _this38.stackMat3[i38] = null; - } - _this38.stackMat3 = newArray37; - } - _this38.stackMat3[_this38.sizeMat3++] = mat39; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this38.sizeMat4 == _this38.stackMat4.length) { - var newLength38 = _this38.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g49 = 0; - var _g139 = _this38.sizeMat4; - while(_g49 < _g139) { - var i39 = _g49++; - newArray38[i39] = _this38.stackMat4[i39]; - _this38.stackMat4[i39] = null; - } - _this38.stackMat4 = newArray38; - } - _this38.stackMat4[_this38.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx14 = 0; - var ty14 = 0; - var tz14 = 0; - var tw9 = 1; - quat9.x = tx14; - quat9.y = ty14; - quat9.z = tz14; - quat9.w = tw9; - if(_this38.sizeQuat == _this38.stackQuat.length) { - var newLength39 = _this38.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g50 = 0; - var _g140 = _this38.sizeQuat; - while(_g50 < _g140) { - var i40 = _g50++; - newArray39[i40] = _this38.stackQuat[i40]; - _this38.stackQuat[i40] = null; + if(_this21.sizeVec3 == _this21.stackVec3.length) { + let newArray = new Array(_this21.sizeVec3 << 1); + let _g = 0; + let _g1 = _this21.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this21.stackVec3[i]; + _this21.stackVec3[i] = null; } - _this38.stackQuat = newArray39; + _this21.stackVec3 = newArray; } - _this38.stackQuat[_this38.sizeQuat++] = quat9; + _this21.stackVec3[_this21.sizeVec3++] = p2; } - var _this39 = this._pool; - var mat310 = null; - var mat410 = null; - var quat10 = null; + let _this22 = this._pool; if(anchor1 != null) { anchor1.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newLength40 = _this39.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g51 = 0; - var _g141 = _this39.sizeVec3; - while(_g51 < _g141) { - var i41 = _g51++; - newArray40[i41] = _this39.stackVec3[i41]; - _this39.stackVec3[i41] = null; - } - _this39.stackVec3 = newArray40; - } - _this39.stackVec3[_this39.sizeVec3++] = anchor1; - } - if(mat310 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat310.e00 = t0020; - mat310.e01 = t0120; - mat310.e02 = t0220; - mat310.e10 = t1020; - mat310.e11 = t1120; - mat310.e12 = t1220; - mat310.e20 = t2020; - mat310.e21 = t2120; - mat310.e22 = t2220; - if(_this39.sizeMat3 == _this39.stackMat3.length) { - var newLength41 = _this39.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g52 = 0; - var _g142 = _this39.sizeMat3; - while(_g52 < _g142) { - var i42 = _g52++; - newArray41[i42] = _this39.stackMat3[i42]; - _this39.stackMat3[i42] = null; - } - _this39.stackMat3 = newArray41; - } - _this39.stackMat3[_this39.sizeMat3++] = mat310; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this39.sizeMat4 == _this39.stackMat4.length) { - var newLength42 = _this39.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g53 = 0; - var _g143 = _this39.sizeMat4; - while(_g53 < _g143) { - var i43 = _g53++; - newArray42[i43] = _this39.stackMat4[i43]; - _this39.stackMat4[i43] = null; - } - _this39.stackMat4 = newArray42; - } - _this39.stackMat4[_this39.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx15 = 0; - var ty15 = 0; - var tz15 = 0; - var tw10 = 1; - quat10.x = tx15; - quat10.y = ty15; - quat10.z = tz15; - quat10.w = tw10; - if(_this39.sizeQuat == _this39.stackQuat.length) { - var newLength43 = _this39.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g54 = 0; - var _g144 = _this39.sizeQuat; - while(_g54 < _g144) { - var i44 = _g54++; - newArray43[i44] = _this39.stackQuat[i44]; - _this39.stackQuat[i44] = null; + if(_this22.sizeVec3 == _this22.stackVec3.length) { + let newArray = new Array(_this22.sizeVec3 << 1); + let _g = 0; + let _g1 = _this22.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this22.stackVec3[i]; + _this22.stackVec3[i] = null; } - _this39.stackQuat = newArray43; + _this22.stackVec3 = newArray; } - _this39.stackQuat[_this39.sizeQuat++] = quat10; + _this22.stackVec3[_this22.sizeVec3++] = anchor1; } - var _this40 = this._pool; - var mat311 = null; - var mat411 = null; - var quat11 = null; + let _this23 = this._pool; if(anchor2 != null) { anchor2.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newLength44 = _this40.sizeVec3 << 1; - var this45 = new Array(newLength44); - var newArray44 = this45; - var _g55 = 0; - var _g145 = _this40.sizeVec3; - while(_g55 < _g145) { - var i45 = _g55++; - newArray44[i45] = _this40.stackVec3[i45]; - _this40.stackVec3[i45] = null; - } - _this40.stackVec3 = newArray44; - } - _this40.stackVec3[_this40.sizeVec3++] = anchor2; - } - if(mat311 != null) { - var t0022 = 1; - var t0122 = 0; - var t0222 = 0; - var t1022 = 0; - var t1122 = 1; - var t1222 = 0; - var t2022 = 0; - var t2122 = 0; - var t2222 = 1; - mat311.e00 = t0022; - mat311.e01 = t0122; - mat311.e02 = t0222; - mat311.e10 = t1022; - mat311.e11 = t1122; - mat311.e12 = t1222; - mat311.e20 = t2022; - mat311.e21 = t2122; - mat311.e22 = t2222; - if(_this40.sizeMat3 == _this40.stackMat3.length) { - var newLength45 = _this40.sizeMat3 << 1; - var this46 = new Array(newLength45); - var newArray45 = this46; - var _g56 = 0; - var _g146 = _this40.sizeMat3; - while(_g56 < _g146) { - var i46 = _g56++; - newArray45[i46] = _this40.stackMat3[i46]; - _this40.stackMat3[i46] = null; - } - _this40.stackMat3 = newArray45; - } - _this40.stackMat3[_this40.sizeMat3++] = mat311; - } - if(mat411 != null) { - var t0023 = 1; - var t0123 = 0; - var t0223 = 0; - var t0311 = 0; - var t1023 = 0; - var t1123 = 1; - var t1223 = 0; - var t1311 = 0; - var t2023 = 0; - var t2123 = 0; - var t2223 = 1; - var t2311 = 0; - var t3011 = 0; - var t3111 = 0; - var t3211 = 0; - var t3311 = 1; - mat411.e00 = t0023; - mat411.e01 = t0123; - mat411.e02 = t0223; - mat411.e03 = t0311; - mat411.e10 = t1023; - mat411.e11 = t1123; - mat411.e12 = t1223; - mat411.e13 = t1311; - mat411.e20 = t2023; - mat411.e21 = t2123; - mat411.e22 = t2223; - mat411.e23 = t2311; - mat411.e30 = t3011; - mat411.e31 = t3111; - mat411.e32 = t3211; - mat411.e33 = t3311; - if(_this40.sizeMat4 == _this40.stackMat4.length) { - var newLength46 = _this40.sizeMat4 << 1; - var this47 = new Array(newLength46); - var newArray46 = this47; - var _g57 = 0; - var _g147 = _this40.sizeMat4; - while(_g57 < _g147) { - var i47 = _g57++; - newArray46[i47] = _this40.stackMat4[i47]; - _this40.stackMat4[i47] = null; - } - _this40.stackMat4 = newArray46; - } - _this40.stackMat4[_this40.sizeMat4++] = mat411; - } - if(quat11 != null) { - var tx16 = 0; - var ty16 = 0; - var tz16 = 0; - var tw11 = 1; - quat11.x = tx16; - quat11.y = ty16; - quat11.z = tz16; - quat11.w = tw11; - if(_this40.sizeQuat == _this40.stackQuat.length) { - var newLength47 = _this40.sizeQuat << 1; - var this48 = new Array(newLength47); - var newArray47 = this48; - var _g58 = 0; - var _g148 = _this40.sizeQuat; - while(_g58 < _g148) { - var i48 = _g58++; - newArray47[i48] = _this40.stackQuat[i48]; - _this40.stackQuat[i48] = null; + if(_this23.sizeVec3 == _this23.stackVec3.length) { + let newArray = new Array(_this23.sizeVec3 << 1); + let _g = 0; + let _g1 = _this23.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this23.stackVec3[i]; + _this23.stackVec3[i] = null; } - _this40.stackQuat = newArray47; + _this23.stackVec3 = newArray; } - _this40.stackQuat[_this40.sizeQuat++] = quat11; + _this23.stackVec3[_this23.sizeVec3++] = anchor2; } - var _this41 = this._pool; - var mat312 = null; - var mat412 = null; - var quat12 = null; + let _this24 = this._pool; if(basisX1 != null) { basisX1.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newLength48 = _this41.sizeVec3 << 1; - var this49 = new Array(newLength48); - var newArray48 = this49; - var _g59 = 0; - var _g149 = _this41.sizeVec3; - while(_g59 < _g149) { - var i49 = _g59++; - newArray48[i49] = _this41.stackVec3[i49]; - _this41.stackVec3[i49] = null; - } - _this41.stackVec3 = newArray48; - } - _this41.stackVec3[_this41.sizeVec3++] = basisX1; - } - if(mat312 != null) { - var t0024 = 1; - var t0124 = 0; - var t0224 = 0; - var t1024 = 0; - var t1124 = 1; - var t1224 = 0; - var t2024 = 0; - var t2124 = 0; - var t2224 = 1; - mat312.e00 = t0024; - mat312.e01 = t0124; - mat312.e02 = t0224; - mat312.e10 = t1024; - mat312.e11 = t1124; - mat312.e12 = t1224; - mat312.e20 = t2024; - mat312.e21 = t2124; - mat312.e22 = t2224; - if(_this41.sizeMat3 == _this41.stackMat3.length) { - var newLength49 = _this41.sizeMat3 << 1; - var this50 = new Array(newLength49); - var newArray49 = this50; - var _g60 = 0; - var _g150 = _this41.sizeMat3; - while(_g60 < _g150) { - var i50 = _g60++; - newArray49[i50] = _this41.stackMat3[i50]; - _this41.stackMat3[i50] = null; - } - _this41.stackMat3 = newArray49; - } - _this41.stackMat3[_this41.sizeMat3++] = mat312; - } - if(mat412 != null) { - var t0025 = 1; - var t0125 = 0; - var t0225 = 0; - var t0312 = 0; - var t1025 = 0; - var t1125 = 1; - var t1225 = 0; - var t1312 = 0; - var t2025 = 0; - var t2125 = 0; - var t2225 = 1; - var t2312 = 0; - var t3012 = 0; - var t3112 = 0; - var t3212 = 0; - var t3312 = 1; - mat412.e00 = t0025; - mat412.e01 = t0125; - mat412.e02 = t0225; - mat412.e03 = t0312; - mat412.e10 = t1025; - mat412.e11 = t1125; - mat412.e12 = t1225; - mat412.e13 = t1312; - mat412.e20 = t2025; - mat412.e21 = t2125; - mat412.e22 = t2225; - mat412.e23 = t2312; - mat412.e30 = t3012; - mat412.e31 = t3112; - mat412.e32 = t3212; - mat412.e33 = t3312; - if(_this41.sizeMat4 == _this41.stackMat4.length) { - var newLength50 = _this41.sizeMat4 << 1; - var this51 = new Array(newLength50); - var newArray50 = this51; - var _g61 = 0; - var _g151 = _this41.sizeMat4; - while(_g61 < _g151) { - var i51 = _g61++; - newArray50[i51] = _this41.stackMat4[i51]; - _this41.stackMat4[i51] = null; - } - _this41.stackMat4 = newArray50; - } - _this41.stackMat4[_this41.sizeMat4++] = mat412; - } - if(quat12 != null) { - var tx17 = 0; - var ty17 = 0; - var tz17 = 0; - var tw12 = 1; - quat12.x = tx17; - quat12.y = ty17; - quat12.z = tz17; - quat12.w = tw12; - if(_this41.sizeQuat == _this41.stackQuat.length) { - var newLength51 = _this41.sizeQuat << 1; - var this52 = new Array(newLength51); - var newArray51 = this52; - var _g62 = 0; - var _g152 = _this41.sizeQuat; - while(_g62 < _g152) { - var i52 = _g62++; - newArray51[i52] = _this41.stackQuat[i52]; - _this41.stackQuat[i52] = null; + if(_this24.sizeVec3 == _this24.stackVec3.length) { + let newArray = new Array(_this24.sizeVec3 << 1); + let _g = 0; + let _g1 = _this24.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this24.stackVec3[i]; + _this24.stackVec3[i] = null; } - _this41.stackQuat = newArray51; + _this24.stackVec3 = newArray; } - _this41.stackQuat[_this41.sizeQuat++] = quat12; + _this24.stackVec3[_this24.sizeVec3++] = basisX1; } - var _this42 = this._pool; - var mat313 = null; - var mat413 = null; - var quat13 = null; + let _this25 = this._pool; if(basisY1 != null) { basisY1.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newLength52 = _this42.sizeVec3 << 1; - var this53 = new Array(newLength52); - var newArray52 = this53; - var _g63 = 0; - var _g153 = _this42.sizeVec3; - while(_g63 < _g153) { - var i53 = _g63++; - newArray52[i53] = _this42.stackVec3[i53]; - _this42.stackVec3[i53] = null; - } - _this42.stackVec3 = newArray52; - } - _this42.stackVec3[_this42.sizeVec3++] = basisY1; - } - if(mat313 != null) { - var t0026 = 1; - var t0126 = 0; - var t0226 = 0; - var t1026 = 0; - var t1126 = 1; - var t1226 = 0; - var t2026 = 0; - var t2126 = 0; - var t2226 = 1; - mat313.e00 = t0026; - mat313.e01 = t0126; - mat313.e02 = t0226; - mat313.e10 = t1026; - mat313.e11 = t1126; - mat313.e12 = t1226; - mat313.e20 = t2026; - mat313.e21 = t2126; - mat313.e22 = t2226; - if(_this42.sizeMat3 == _this42.stackMat3.length) { - var newLength53 = _this42.sizeMat3 << 1; - var this54 = new Array(newLength53); - var newArray53 = this54; - var _g64 = 0; - var _g154 = _this42.sizeMat3; - while(_g64 < _g154) { - var i54 = _g64++; - newArray53[i54] = _this42.stackMat3[i54]; - _this42.stackMat3[i54] = null; - } - _this42.stackMat3 = newArray53; - } - _this42.stackMat3[_this42.sizeMat3++] = mat313; - } - if(mat413 != null) { - var t0027 = 1; - var t0127 = 0; - var t0227 = 0; - var t0313 = 0; - var t1027 = 0; - var t1127 = 1; - var t1227 = 0; - var t1313 = 0; - var t2027 = 0; - var t2127 = 0; - var t2227 = 1; - var t2313 = 0; - var t3013 = 0; - var t3113 = 0; - var t3213 = 0; - var t3313 = 1; - mat413.e00 = t0027; - mat413.e01 = t0127; - mat413.e02 = t0227; - mat413.e03 = t0313; - mat413.e10 = t1027; - mat413.e11 = t1127; - mat413.e12 = t1227; - mat413.e13 = t1313; - mat413.e20 = t2027; - mat413.e21 = t2127; - mat413.e22 = t2227; - mat413.e23 = t2313; - mat413.e30 = t3013; - mat413.e31 = t3113; - mat413.e32 = t3213; - mat413.e33 = t3313; - if(_this42.sizeMat4 == _this42.stackMat4.length) { - var newLength54 = _this42.sizeMat4 << 1; - var this55 = new Array(newLength54); - var newArray54 = this55; - var _g65 = 0; - var _g155 = _this42.sizeMat4; - while(_g65 < _g155) { - var i55 = _g65++; - newArray54[i55] = _this42.stackMat4[i55]; - _this42.stackMat4[i55] = null; - } - _this42.stackMat4 = newArray54; - } - _this42.stackMat4[_this42.sizeMat4++] = mat413; - } - if(quat13 != null) { - var tx18 = 0; - var ty18 = 0; - var tz18 = 0; - var tw13 = 1; - quat13.x = tx18; - quat13.y = ty18; - quat13.z = tz18; - quat13.w = tw13; - if(_this42.sizeQuat == _this42.stackQuat.length) { - var newLength55 = _this42.sizeQuat << 1; - var this56 = new Array(newLength55); - var newArray55 = this56; - var _g66 = 0; - var _g156 = _this42.sizeQuat; - while(_g66 < _g156) { - var i56 = _g66++; - newArray55[i56] = _this42.stackQuat[i56]; - _this42.stackQuat[i56] = null; + if(_this25.sizeVec3 == _this25.stackVec3.length) { + let newArray = new Array(_this25.sizeVec3 << 1); + let _g = 0; + let _g1 = _this25.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this25.stackVec3[i]; + _this25.stackVec3[i] = null; } - _this42.stackQuat = newArray55; + _this25.stackVec3 = newArray; } - _this42.stackQuat[_this42.sizeQuat++] = quat13; + _this25.stackVec3[_this25.sizeVec3++] = basisY1; } - var _this43 = this._pool; - var mat314 = null; - var mat414 = null; - var quat14 = null; + let _this26 = this._pool; if(basisZ1 != null) { basisZ1.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newLength56 = _this43.sizeVec3 << 1; - var this57 = new Array(newLength56); - var newArray56 = this57; - var _g67 = 0; - var _g157 = _this43.sizeVec3; - while(_g67 < _g157) { - var i57 = _g67++; - newArray56[i57] = _this43.stackVec3[i57]; - _this43.stackVec3[i57] = null; - } - _this43.stackVec3 = newArray56; - } - _this43.stackVec3[_this43.sizeVec3++] = basisZ1; - } - if(mat314 != null) { - var t0028 = 1; - var t0128 = 0; - var t0228 = 0; - var t1028 = 0; - var t1128 = 1; - var t1228 = 0; - var t2028 = 0; - var t2128 = 0; - var t2228 = 1; - mat314.e00 = t0028; - mat314.e01 = t0128; - mat314.e02 = t0228; - mat314.e10 = t1028; - mat314.e11 = t1128; - mat314.e12 = t1228; - mat314.e20 = t2028; - mat314.e21 = t2128; - mat314.e22 = t2228; - if(_this43.sizeMat3 == _this43.stackMat3.length) { - var newLength57 = _this43.sizeMat3 << 1; - var this58 = new Array(newLength57); - var newArray57 = this58; - var _g68 = 0; - var _g158 = _this43.sizeMat3; - while(_g68 < _g158) { - var i58 = _g68++; - newArray57[i58] = _this43.stackMat3[i58]; - _this43.stackMat3[i58] = null; - } - _this43.stackMat3 = newArray57; - } - _this43.stackMat3[_this43.sizeMat3++] = mat314; - } - if(mat414 != null) { - var t0029 = 1; - var t0129 = 0; - var t0229 = 0; - var t0314 = 0; - var t1029 = 0; - var t1129 = 1; - var t1229 = 0; - var t1314 = 0; - var t2029 = 0; - var t2129 = 0; - var t2229 = 1; - var t2314 = 0; - var t3014 = 0; - var t3114 = 0; - var t3214 = 0; - var t3314 = 1; - mat414.e00 = t0029; - mat414.e01 = t0129; - mat414.e02 = t0229; - mat414.e03 = t0314; - mat414.e10 = t1029; - mat414.e11 = t1129; - mat414.e12 = t1229; - mat414.e13 = t1314; - mat414.e20 = t2029; - mat414.e21 = t2129; - mat414.e22 = t2229; - mat414.e23 = t2314; - mat414.e30 = t3014; - mat414.e31 = t3114; - mat414.e32 = t3214; - mat414.e33 = t3314; - if(_this43.sizeMat4 == _this43.stackMat4.length) { - var newLength58 = _this43.sizeMat4 << 1; - var this59 = new Array(newLength58); - var newArray58 = this59; - var _g69 = 0; - var _g159 = _this43.sizeMat4; - while(_g69 < _g159) { - var i59 = _g69++; - newArray58[i59] = _this43.stackMat4[i59]; - _this43.stackMat4[i59] = null; - } - _this43.stackMat4 = newArray58; - } - _this43.stackMat4[_this43.sizeMat4++] = mat414; - } - if(quat14 != null) { - var tx19 = 0; - var ty19 = 0; - var tz19 = 0; - var tw14 = 1; - quat14.x = tx19; - quat14.y = ty19; - quat14.z = tz19; - quat14.w = tw14; - if(_this43.sizeQuat == _this43.stackQuat.length) { - var newLength59 = _this43.sizeQuat << 1; - var this60 = new Array(newLength59); - var newArray59 = this60; - var _g70 = 0; - var _g160 = _this43.sizeQuat; - while(_g70 < _g160) { - var i60 = _g70++; - newArray59[i60] = _this43.stackQuat[i60]; - _this43.stackQuat[i60] = null; + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; } - _this43.stackQuat = newArray59; + _this26.stackVec3 = newArray; } - _this43.stackQuat[_this43.sizeQuat++] = quat14; + _this26.stackVec3[_this26.sizeVec3++] = basisZ1; } - var _this44 = this._pool; - var mat315 = null; - var mat415 = null; - var quat15 = null; + let _this27 = this._pool; if(basisX2 != null) { basisX2.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newLength60 = _this44.sizeVec3 << 1; - var this61 = new Array(newLength60); - var newArray60 = this61; - var _g71 = 0; - var _g161 = _this44.sizeVec3; - while(_g71 < _g161) { - var i61 = _g71++; - newArray60[i61] = _this44.stackVec3[i61]; - _this44.stackVec3[i61] = null; - } - _this44.stackVec3 = newArray60; - } - _this44.stackVec3[_this44.sizeVec3++] = basisX2; - } - if(mat315 != null) { - var t0030 = 1; - var t0130 = 0; - var t0230 = 0; - var t1030 = 0; - var t1130 = 1; - var t1230 = 0; - var t2030 = 0; - var t2130 = 0; - var t2230 = 1; - mat315.e00 = t0030; - mat315.e01 = t0130; - mat315.e02 = t0230; - mat315.e10 = t1030; - mat315.e11 = t1130; - mat315.e12 = t1230; - mat315.e20 = t2030; - mat315.e21 = t2130; - mat315.e22 = t2230; - if(_this44.sizeMat3 == _this44.stackMat3.length) { - var newLength61 = _this44.sizeMat3 << 1; - var this62 = new Array(newLength61); - var newArray61 = this62; - var _g72 = 0; - var _g162 = _this44.sizeMat3; - while(_g72 < _g162) { - var i62 = _g72++; - newArray61[i62] = _this44.stackMat3[i62]; - _this44.stackMat3[i62] = null; - } - _this44.stackMat3 = newArray61; - } - _this44.stackMat3[_this44.sizeMat3++] = mat315; - } - if(mat415 != null) { - var t0031 = 1; - var t0131 = 0; - var t0231 = 0; - var t0315 = 0; - var t1031 = 0; - var t1131 = 1; - var t1231 = 0; - var t1315 = 0; - var t2031 = 0; - var t2131 = 0; - var t2231 = 1; - var t2315 = 0; - var t3015 = 0; - var t3115 = 0; - var t3215 = 0; - var t3315 = 1; - mat415.e00 = t0031; - mat415.e01 = t0131; - mat415.e02 = t0231; - mat415.e03 = t0315; - mat415.e10 = t1031; - mat415.e11 = t1131; - mat415.e12 = t1231; - mat415.e13 = t1315; - mat415.e20 = t2031; - mat415.e21 = t2131; - mat415.e22 = t2231; - mat415.e23 = t2315; - mat415.e30 = t3015; - mat415.e31 = t3115; - mat415.e32 = t3215; - mat415.e33 = t3315; - if(_this44.sizeMat4 == _this44.stackMat4.length) { - var newLength62 = _this44.sizeMat4 << 1; - var this63 = new Array(newLength62); - var newArray62 = this63; - var _g73 = 0; - var _g163 = _this44.sizeMat4; - while(_g73 < _g163) { - var i63 = _g73++; - newArray62[i63] = _this44.stackMat4[i63]; - _this44.stackMat4[i63] = null; - } - _this44.stackMat4 = newArray62; - } - _this44.stackMat4[_this44.sizeMat4++] = mat415; - } - if(quat15 != null) { - var tx20 = 0; - var ty20 = 0; - var tz20 = 0; - var tw15 = 1; - quat15.x = tx20; - quat15.y = ty20; - quat15.z = tz20; - quat15.w = tw15; - if(_this44.sizeQuat == _this44.stackQuat.length) { - var newLength63 = _this44.sizeQuat << 1; - var this64 = new Array(newLength63); - var newArray63 = this64; - var _g74 = 0; - var _g164 = _this44.sizeQuat; - while(_g74 < _g164) { - var i64 = _g74++; - newArray63[i64] = _this44.stackQuat[i64]; - _this44.stackQuat[i64] = null; + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; } - _this44.stackQuat = newArray63; + _this27.stackVec3 = newArray; } - _this44.stackQuat[_this44.sizeQuat++] = quat15; + _this27.stackVec3[_this27.sizeVec3++] = basisX2; } - var _this45 = this._pool; - var mat316 = null; - var mat416 = null; - var quat16 = null; + let _this28 = this._pool; if(basisY2 != null) { basisY2.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength64 = _this45.sizeVec3 << 1; - var this65 = new Array(newLength64); - var newArray64 = this65; - var _g75 = 0; - var _g165 = _this45.sizeVec3; - while(_g75 < _g165) { - var i65 = _g75++; - newArray64[i65] = _this45.stackVec3[i65]; - _this45.stackVec3[i65] = null; - } - _this45.stackVec3 = newArray64; - } - _this45.stackVec3[_this45.sizeVec3++] = basisY2; - } - if(mat316 != null) { - var t0032 = 1; - var t0132 = 0; - var t0232 = 0; - var t1032 = 0; - var t1132 = 1; - var t1232 = 0; - var t2032 = 0; - var t2132 = 0; - var t2232 = 1; - mat316.e00 = t0032; - mat316.e01 = t0132; - mat316.e02 = t0232; - mat316.e10 = t1032; - mat316.e11 = t1132; - mat316.e12 = t1232; - mat316.e20 = t2032; - mat316.e21 = t2132; - mat316.e22 = t2232; - if(_this45.sizeMat3 == _this45.stackMat3.length) { - var newLength65 = _this45.sizeMat3 << 1; - var this66 = new Array(newLength65); - var newArray65 = this66; - var _g76 = 0; - var _g166 = _this45.sizeMat3; - while(_g76 < _g166) { - var i66 = _g76++; - newArray65[i66] = _this45.stackMat3[i66]; - _this45.stackMat3[i66] = null; - } - _this45.stackMat3 = newArray65; - } - _this45.stackMat3[_this45.sizeMat3++] = mat316; - } - if(mat416 != null) { - var t0033 = 1; - var t0133 = 0; - var t0233 = 0; - var t0316 = 0; - var t1033 = 0; - var t1133 = 1; - var t1233 = 0; - var t1316 = 0; - var t2033 = 0; - var t2133 = 0; - var t2233 = 1; - var t2316 = 0; - var t3016 = 0; - var t3116 = 0; - var t3216 = 0; - var t3316 = 1; - mat416.e00 = t0033; - mat416.e01 = t0133; - mat416.e02 = t0233; - mat416.e03 = t0316; - mat416.e10 = t1033; - mat416.e11 = t1133; - mat416.e12 = t1233; - mat416.e13 = t1316; - mat416.e20 = t2033; - mat416.e21 = t2133; - mat416.e22 = t2233; - mat416.e23 = t2316; - mat416.e30 = t3016; - mat416.e31 = t3116; - mat416.e32 = t3216; - mat416.e33 = t3316; - if(_this45.sizeMat4 == _this45.stackMat4.length) { - var newLength66 = _this45.sizeMat4 << 1; - var this67 = new Array(newLength66); - var newArray66 = this67; - var _g77 = 0; - var _g167 = _this45.sizeMat4; - while(_g77 < _g167) { - var i67 = _g77++; - newArray66[i67] = _this45.stackMat4[i67]; - _this45.stackMat4[i67] = null; - } - _this45.stackMat4 = newArray66; - } - _this45.stackMat4[_this45.sizeMat4++] = mat416; - } - if(quat16 != null) { - var tx21 = 0; - var ty21 = 0; - var tz21 = 0; - var tw16 = 1; - quat16.x = tx21; - quat16.y = ty21; - quat16.z = tz21; - quat16.w = tw16; - if(_this45.sizeQuat == _this45.stackQuat.length) { - var newLength67 = _this45.sizeQuat << 1; - var this68 = new Array(newLength67); - var newArray67 = this68; - var _g78 = 0; - var _g168 = _this45.sizeQuat; - while(_g78 < _g168) { - var i68 = _g78++; - newArray67[i68] = _this45.stackQuat[i68]; - _this45.stackQuat[i68] = null; + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; } - _this45.stackQuat = newArray67; + _this28.stackVec3 = newArray; } - _this45.stackQuat[_this45.sizeQuat++] = quat16; + _this28.stackVec3[_this28.sizeVec3++] = basisY2; } - var _this46 = this._pool; - var mat317 = null; - var mat417 = null; - var quat17 = null; + let _this29 = this._pool; if(basisZ2 != null) { basisZ2.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength68 = _this46.sizeVec3 << 1; - var this69 = new Array(newLength68); - var newArray68 = this69; - var _g79 = 0; - var _g169 = _this46.sizeVec3; - while(_g79 < _g169) { - var i69 = _g79++; - newArray68[i69] = _this46.stackVec3[i69]; - _this46.stackVec3[i69] = null; - } - _this46.stackVec3 = newArray68; - } - _this46.stackVec3[_this46.sizeVec3++] = basisZ2; - } - if(mat317 != null) { - var t0034 = 1; - var t0134 = 0; - var t0234 = 0; - var t1034 = 0; - var t1134 = 1; - var t1234 = 0; - var t2034 = 0; - var t2134 = 0; - var t2234 = 1; - mat317.e00 = t0034; - mat317.e01 = t0134; - mat317.e02 = t0234; - mat317.e10 = t1034; - mat317.e11 = t1134; - mat317.e12 = t1234; - mat317.e20 = t2034; - mat317.e21 = t2134; - mat317.e22 = t2234; - if(_this46.sizeMat3 == _this46.stackMat3.length) { - var newLength69 = _this46.sizeMat3 << 1; - var this70 = new Array(newLength69); - var newArray69 = this70; - var _g80 = 0; - var _g170 = _this46.sizeMat3; - while(_g80 < _g170) { - var i70 = _g80++; - newArray69[i70] = _this46.stackMat3[i70]; - _this46.stackMat3[i70] = null; - } - _this46.stackMat3 = newArray69; - } - _this46.stackMat3[_this46.sizeMat3++] = mat317; - } - if(mat417 != null) { - var t0035 = 1; - var t0135 = 0; - var t0235 = 0; - var t0317 = 0; - var t1035 = 0; - var t1135 = 1; - var t1235 = 0; - var t1317 = 0; - var t2035 = 0; - var t2135 = 0; - var t2235 = 1; - var t2317 = 0; - var t3017 = 0; - var t3117 = 0; - var t3217 = 0; - var t3317 = 1; - mat417.e00 = t0035; - mat417.e01 = t0135; - mat417.e02 = t0235; - mat417.e03 = t0317; - mat417.e10 = t1035; - mat417.e11 = t1135; - mat417.e12 = t1235; - mat417.e13 = t1317; - mat417.e20 = t2035; - mat417.e21 = t2135; - mat417.e22 = t2235; - mat417.e23 = t2317; - mat417.e30 = t3017; - mat417.e31 = t3117; - mat417.e32 = t3217; - mat417.e33 = t3317; - if(_this46.sizeMat4 == _this46.stackMat4.length) { - var newLength70 = _this46.sizeMat4 << 1; - var this71 = new Array(newLength70); - var newArray70 = this71; - var _g81 = 0; - var _g171 = _this46.sizeMat4; - while(_g81 < _g171) { - var i71 = _g81++; - newArray70[i71] = _this46.stackMat4[i71]; - _this46.stackMat4[i71] = null; - } - _this46.stackMat4 = newArray70; - } - _this46.stackMat4[_this46.sizeMat4++] = mat417; - } - if(quat17 != null) { - var tx22 = 0; - var ty22 = 0; - var tz22 = 0; - var tw17 = 1; - quat17.x = tx22; - quat17.y = ty22; - quat17.z = tz22; - quat17.w = tw17; - if(_this46.sizeQuat == _this46.stackQuat.length) { - var newLength71 = _this46.sizeQuat << 1; - var this72 = new Array(newLength71); - var newArray71 = this72; - var _g82 = 0; - var _g172 = _this46.sizeQuat; - while(_g82 < _g172) { - var i72 = _g82++; - newArray71[i72] = _this46.stackQuat[i72]; - _this46.stackQuat[i72] = null; + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this46.stackQuat = newArray71; + _this29.stackVec3 = newArray; } - _this46.stackQuat[_this46.sizeQuat++] = quat17; + _this29.stackVec3[_this29.sizeVec3++] = basisZ2; } - j = n1; + j = n; } } } _drawRotationalLimit(d,center,ex,ey,needle,radius,min,max,color) { if(min != max) { - var _this = this._pool; - var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this = this._pool; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; - var tx = _this2.x + needle.x * radius; - var ty = _this2.y + needle.y * radius; - var tz = _this2.z + needle.z * radius; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; - var to = _this2; - d.line(center,to,color); - var _this3 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; - if(to != null) { - to.zero(); + let _this2 = _this1; + _this2.x += needle.x * radius; + _this2.y += needle.y * radius; + _this2.z += needle.z * radius; + d.line(center,_this2,color); + let _this3 = this._pool; + if(_this2 != null) { + _this2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newLength = _this3.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this3.sizeVec3; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this3.stackVec3[i]; _this3.stackVec3[i] = null; } _this3.stackVec3 = newArray; } - _this3.stackVec3[_this3.sizeVec3++] = to; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this3.sizeMat3 == _this3.stackMat3.length) { - var newLength1 = _this3.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this3.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this3.stackMat3[i1]; - _this3.stackMat3[i1] = null; - } - _this3.stackMat3 = newArray1; - } - _this3.stackMat3[_this3.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this3.sizeMat4 == _this3.stackMat4.length) { - var newLength2 = _this3.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this3.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this3.stackMat4[i2]; - _this3.stackMat4[i2] = null; - } - _this3.stackMat4 = newArray2; - } - _this3.stackMat4[_this3.sizeMat4++] = mat4; - } - if(quat != null) { - var tx1 = 0; - var ty1 = 0; - var tz1 = 0; - var tw = 1; - quat.x = tx1; - quat.y = ty1; - quat.z = tz1; - quat.w = tw; - if(_this3.sizeQuat == _this3.stackQuat.length) { - var newLength3 = _this3.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this3.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this3.stackQuat[i3]; - _this3.stackQuat[i3] = null; - } - _this3.stackQuat = newArray3; - } - _this3.stackQuat[_this3.sizeQuat++] = quat; + _this3.stackVec3[_this3.sizeVec3++] = _this2; } if(min > max) { d.ellipse(center,ex,ey,radius,radius,color); @@ -23351,1607 +17356,388 @@ oimo.dynamics.World = class oimo_dynamics_World { } _drawTranslationalLimit(d,center,ex,min,max,color) { if(min < max) { - var _this = this._pool; - var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this = this._pool; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; - var tx = _this2.x + ex.x * min; - var ty = _this2.y + ex.y * min; - var tz = _this2.z + ex.z * min; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; - var lower = _this2; - var _this3 = this._pool; - var _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this2 = _this1; + _this2.x += ex.x * min; + _this2.y += ex.y * min; + _this2.z += ex.z * min; + let _this3 = this._pool; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = center.x; _this4.y = center.y; _this4.z = center.z; - var _this5 = _this4; - var tx1 = _this5.x + ex.x * max; - var ty1 = _this5.y + ex.y * max; - var tz1 = _this5.z + ex.z * max; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var upper = _this5; - d.line(lower,upper,color); - var _this6 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; - if(lower != null) { - lower.zero(); + let _this5 = _this4; + _this5.x += ex.x * max; + _this5.y += ex.y * max; + _this5.z += ex.z * max; + d.line(_this2,_this5,color); + let _this6 = this._pool; + if(_this2 != null) { + _this2.zero(); if(_this6.sizeVec3 == _this6.stackVec3.length) { - var newLength = _this6.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this6.sizeVec3; + let newArray = new Array(_this6.sizeVec3 << 1); + let _g = 0; + let _g1 = _this6.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this6.stackVec3[i]; _this6.stackVec3[i] = null; } _this6.stackVec3 = newArray; } - _this6.stackVec3[_this6.sizeVec3++] = lower; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this6.sizeMat3 == _this6.stackMat3.length) { - var newLength1 = _this6.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this6.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this6.stackMat3[i1]; - _this6.stackMat3[i1] = null; - } - _this6.stackMat3 = newArray1; - } - _this6.stackMat3[_this6.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this6.sizeMat4 == _this6.stackMat4.length) { - var newLength2 = _this6.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this6.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this6.stackMat4[i2]; - _this6.stackMat4[i2] = null; - } - _this6.stackMat4 = newArray2; - } - _this6.stackMat4[_this6.sizeMat4++] = mat4; - } - if(quat != null) { - var tx2 = 0; - var ty2 = 0; - var tz2 = 0; - var tw = 1; - quat.x = tx2; - quat.y = ty2; - quat.z = tz2; - quat.w = tw; - if(_this6.sizeQuat == _this6.stackQuat.length) { - var newLength3 = _this6.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this6.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this6.stackQuat[i3]; - _this6.stackQuat[i3] = null; - } - _this6.stackQuat = newArray3; - } - _this6.stackQuat[_this6.sizeQuat++] = quat; + _this6.stackVec3[_this6.sizeVec3++] = _this2; } - var _this7 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(upper != null) { - upper.zero(); + let _this7 = this._pool; + if(_this5 != null) { + _this5.zero(); if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newLength4 = _this7.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this7.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this7.stackVec3[i4]; - _this7.stackVec3[i4] = null; - } - _this7.stackVec3 = newArray4; - } - _this7.stackVec3[_this7.sizeVec3++] = upper; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this7.sizeMat3 == _this7.stackMat3.length) { - var newLength5 = _this7.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this7.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this7.stackMat3[i5]; - _this7.stackMat3[i5] = null; - } - _this7.stackMat3 = newArray5; - } - _this7.stackMat3[_this7.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this7.sizeMat4 == _this7.stackMat4.length) { - var newLength6 = _this7.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this7.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this7.stackMat4[i6]; - _this7.stackMat4[i6] = null; - } - _this7.stackMat4 = newArray6; - } - _this7.stackMat4[_this7.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx3 = 0; - var ty3 = 0; - var tz3 = 0; - var tw1 = 1; - quat1.x = tx3; - quat1.y = ty3; - quat1.z = tz3; - quat1.w = tw1; - if(_this7.sizeQuat == _this7.stackQuat.length) { - var newLength7 = _this7.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this7.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this7.stackQuat[i7]; - _this7.stackQuat[i7] = null; + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this7.stackQuat = newArray7; + _this7.stackVec3 = newArray; } - _this7.stackQuat[_this7.sizeQuat++] = quat1; + _this7.stackVec3[_this7.sizeVec3++] = _this5; } } } _drawTranslationalLimit3D(d,center,ex,ey,ez,xlm,ylm,zlm,color) { - var minx = xlm.lowerLimit; - var maxx = xlm.upperLimit; - var miny = ylm.lowerLimit; - var maxy = ylm.upperLimit; - var minz = zlm.lowerLimit; - var maxz = zlm.upperLimit; - var _this = this._pool; - var lower = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var upper = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this._pool; - var _this3 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let minx = xlm.lowerLimit; + let maxx = xlm.upperLimit; + let miny = ylm.lowerLimit; + let maxy = ylm.upperLimit; + let minz = zlm.lowerLimit; + let maxz = zlm.upperLimit; + let _this = this._pool; + if(_this.sizeVec3 == 0) { + new oimo.common.Vec3(); + } else { + --_this.sizeVec3; + } + let _this1 = this._pool; + if(_this1.sizeVec3 == 0) { + new oimo.common.Vec3(); + } else { + --_this1.sizeVec3; + } + let _this2 = this._pool; + let _this3 = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; _this3.x = center.x; _this3.y = center.y; _this3.z = center.z; - var _this4 = _this3; - var tx = _this4.x + ex.x * minx; - var ty = _this4.y + ex.y * minx; - var tz = _this4.z + ex.z * minx; - _this4.x = tx; - _this4.y = ty; - _this4.z = tz; - var _this5 = _this4; - var tx1 = _this5.x + ey.x * miny; - var ty1 = _this5.y + ey.y * miny; - var tz1 = _this5.z + ey.z * miny; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var _this6 = _this5; - var tx2 = _this6.x + ez.x * minz; - var ty2 = _this6.y + ez.y * minz; - var tz2 = _this6.z + ez.z * minz; - _this6.x = tx2; - _this6.y = ty2; - _this6.z = tz2; - var xyz = _this6; - var _this7 = this._pool; - var _this8 = _this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]; - _this8.x = center.x; - _this8.y = center.y; - _this8.z = center.z; - var _this9 = _this8; - var tx3 = _this9.x + ex.x * minx; - var ty3 = _this9.y + ex.y * minx; - var tz3 = _this9.z + ex.z * minx; - _this9.x = tx3; - _this9.y = ty3; - _this9.z = tz3; - var _this10 = _this9; - var tx4 = _this10.x + ey.x * miny; - var ty4 = _this10.y + ey.y * miny; - var tz4 = _this10.z + ey.z * miny; - _this10.x = tx4; - _this10.y = ty4; - _this10.z = tz4; - var _this11 = _this10; - var tx5 = _this11.x + ez.x * maxz; - var ty5 = _this11.y + ez.y * maxz; - var tz5 = _this11.z + ez.z * maxz; - _this11.x = tx5; - _this11.y = ty5; - _this11.z = tz5; - var xyZ = _this11; - var _this12 = this._pool; - var _this13 = _this12.sizeVec3 == 0 ? new oimo.common.Vec3() : _this12.stackVec3[--_this12.sizeVec3]; - _this13.x = center.x; - _this13.y = center.y; - _this13.z = center.z; - var _this14 = _this13; - var tx6 = _this14.x + ex.x * minx; - var ty6 = _this14.y + ex.y * minx; - var tz6 = _this14.z + ex.z * minx; - _this14.x = tx6; - _this14.y = ty6; - _this14.z = tz6; - var _this15 = _this14; - var tx7 = _this15.x + ey.x * maxy; - var ty7 = _this15.y + ey.y * maxy; - var tz7 = _this15.z + ey.z * maxy; - _this15.x = tx7; - _this15.y = ty7; - _this15.z = tz7; - var _this16 = _this15; - var tx8 = _this16.x + ez.x * minz; - var ty8 = _this16.y + ez.y * minz; - var tz8 = _this16.z + ez.z * minz; - _this16.x = tx8; - _this16.y = ty8; - _this16.z = tz8; - var xYz = _this16; - var _this17 = this._pool; - var _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + let _this4 = _this3; + _this4.x += ex.x * minx; + _this4.y += ex.y * minx; + _this4.z += ex.z * minx; + _this4.x += ey.x * miny; + _this4.y += ey.y * miny; + _this4.z += ey.z * miny; + _this4.x += ez.x * minz; + _this4.y += ez.y * minz; + _this4.z += ez.z * minz; + let _this5 = this._pool; + let _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = center.x; + _this6.y = center.y; + _this6.z = center.z; + let _this7 = _this6; + _this7.x += ex.x * minx; + _this7.y += ex.y * minx; + _this7.z += ex.z * minx; + _this7.x += ey.x * miny; + _this7.y += ey.y * miny; + _this7.z += ey.z * miny; + _this7.x += ez.x * maxz; + _this7.y += ez.y * maxz; + _this7.z += ez.z * maxz; + let _this8 = this._pool; + let _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = center.x; + _this9.y = center.y; + _this9.z = center.z; + let _this10 = _this9; + _this10.x += ex.x * minx; + _this10.y += ex.y * minx; + _this10.z += ex.z * minx; + _this10.x += ey.x * maxy; + _this10.y += ey.y * maxy; + _this10.z += ey.z * maxy; + _this10.x += ez.x * minz; + _this10.y += ez.y * minz; + _this10.z += ez.z * minz; + let _this11 = this._pool; + let _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = center.x; + _this12.y = center.y; + _this12.z = center.z; + let _this13 = _this12; + _this13.x += ex.x * minx; + _this13.y += ex.y * minx; + _this13.z += ex.z * minx; + _this13.x += ey.x * maxy; + _this13.y += ey.y * maxy; + _this13.z += ey.z * maxy; + _this13.x += ez.x * maxz; + _this13.y += ez.y * maxz; + _this13.z += ez.z * maxz; + let _this14 = this._pool; + let _this15 = _this14.sizeVec3 == 0 ? new oimo.common.Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = center.x; + _this15.y = center.y; + _this15.z = center.z; + let _this16 = _this15; + _this16.x += ex.x * maxx; + _this16.y += ex.y * maxx; + _this16.z += ex.z * maxx; + _this16.x += ey.x * miny; + _this16.y += ey.y * miny; + _this16.z += ey.z * miny; + _this16.x += ez.x * minz; + _this16.y += ez.y * minz; + _this16.z += ez.z * minz; + let _this17 = this._pool; + let _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; _this18.x = center.x; _this18.y = center.y; _this18.z = center.z; - var _this19 = _this18; - var tx9 = _this19.x + ex.x * minx; - var ty9 = _this19.y + ex.y * minx; - var tz9 = _this19.z + ex.z * minx; - _this19.x = tx9; - _this19.y = ty9; - _this19.z = tz9; - var _this20 = _this19; - var tx10 = _this20.x + ey.x * maxy; - var ty10 = _this20.y + ey.y * maxy; - var tz10 = _this20.z + ey.z * maxy; - _this20.x = tx10; - _this20.y = ty10; - _this20.z = tz10; - var _this21 = _this20; - var tx11 = _this21.x + ez.x * maxz; - var ty11 = _this21.y + ez.y * maxz; - var tz11 = _this21.z + ez.z * maxz; - _this21.x = tx11; - _this21.y = ty11; - _this21.z = tz11; - var xYZ = _this21; - var _this22 = this._pool; - var _this23 = _this22.sizeVec3 == 0 ? new oimo.common.Vec3() : _this22.stackVec3[--_this22.sizeVec3]; - _this23.x = center.x; - _this23.y = center.y; - _this23.z = center.z; - var _this24 = _this23; - var tx12 = _this24.x + ex.x * maxx; - var ty12 = _this24.y + ex.y * maxx; - var tz12 = _this24.z + ex.z * maxx; - _this24.x = tx12; - _this24.y = ty12; - _this24.z = tz12; - var _this25 = _this24; - var tx13 = _this25.x + ey.x * miny; - var ty13 = _this25.y + ey.y * miny; - var tz13 = _this25.z + ey.z * miny; - _this25.x = tx13; - _this25.y = ty13; - _this25.z = tz13; - var _this26 = _this25; - var tx14 = _this26.x + ez.x * minz; - var ty14 = _this26.y + ez.y * minz; - var tz14 = _this26.z + ez.z * minz; - _this26.x = tx14; - _this26.y = ty14; - _this26.z = tz14; - var Xyz = _this26; - var _this27 = this._pool; - var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = center.x; - _this28.y = center.y; - _this28.z = center.z; - var _this29 = _this28; - var tx15 = _this29.x + ex.x * maxx; - var ty15 = _this29.y + ex.y * maxx; - var tz15 = _this29.z + ex.z * maxx; - _this29.x = tx15; - _this29.y = ty15; - _this29.z = tz15; - var _this30 = _this29; - var tx16 = _this30.x + ey.x * miny; - var ty16 = _this30.y + ey.y * miny; - var tz16 = _this30.z + ey.z * miny; - _this30.x = tx16; - _this30.y = ty16; - _this30.z = tz16; - var _this31 = _this30; - var tx17 = _this31.x + ez.x * maxz; - var ty17 = _this31.y + ez.y * maxz; - var tz17 = _this31.z + ez.z * maxz; - _this31.x = tx17; - _this31.y = ty17; - _this31.z = tz17; - var XyZ = _this31; - var _this32 = this._pool; - var _this33 = _this32.sizeVec3 == 0 ? new oimo.common.Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = center.x; - _this33.y = center.y; - _this33.z = center.z; - var _this34 = _this33; - var tx18 = _this34.x + ex.x * maxx; - var ty18 = _this34.y + ex.y * maxx; - var tz18 = _this34.z + ex.z * maxx; - _this34.x = tx18; - _this34.y = ty18; - _this34.z = tz18; - var _this35 = _this34; - var tx19 = _this35.x + ey.x * maxy; - var ty19 = _this35.y + ey.y * maxy; - var tz19 = _this35.z + ey.z * maxy; - _this35.x = tx19; - _this35.y = ty19; - _this35.z = tz19; - var _this36 = _this35; - var tx20 = _this36.x + ez.x * minz; - var ty20 = _this36.y + ez.y * minz; - var tz20 = _this36.z + ez.z * minz; - _this36.x = tx20; - _this36.y = ty20; - _this36.z = tz20; - var XYz = _this36; - var _this37 = this._pool; - var _this38 = _this37.sizeVec3 == 0 ? new oimo.common.Vec3() : _this37.stackVec3[--_this37.sizeVec3]; - _this38.x = center.x; - _this38.y = center.y; - _this38.z = center.z; - var _this39 = _this38; - var tx21 = _this39.x + ex.x * maxx; - var ty21 = _this39.y + ex.y * maxx; - var tz21 = _this39.z + ex.z * maxx; - _this39.x = tx21; - _this39.y = ty21; - _this39.z = tz21; - var _this40 = _this39; - var tx22 = _this40.x + ey.x * maxy; - var ty22 = _this40.y + ey.y * maxy; - var tz22 = _this40.z + ey.z * maxy; - _this40.x = tx22; - _this40.y = ty22; - _this40.z = tz22; - var _this41 = _this40; - var tx23 = _this41.x + ez.x * maxz; - var ty23 = _this41.y + ez.y * maxz; - var tz23 = _this41.z + ez.z * maxz; - _this41.x = tx23; - _this41.y = ty23; - _this41.z = tz23; - var XYZ = _this41; - d.line(xyz,Xyz,color); - d.line(xYz,XYz,color); - d.line(xyZ,XyZ,color); - d.line(xYZ,XYZ,color); - d.line(xyz,xYz,color); - d.line(Xyz,XYz,color); - d.line(xyZ,xYZ,color); - d.line(XyZ,XYZ,color); - d.line(xyz,xyZ,color); - d.line(Xyz,XyZ,color); - d.line(xYz,xYZ,color); - d.line(XYz,XYZ,color); - var _this42 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; - if(xyz != null) { - xyz.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newLength = _this42.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this42.sizeVec3; + let _this19 = _this18; + _this19.x += ex.x * maxx; + _this19.y += ex.y * maxx; + _this19.z += ex.z * maxx; + _this19.x += ey.x * miny; + _this19.y += ey.y * miny; + _this19.z += ey.z * miny; + _this19.x += ez.x * maxz; + _this19.y += ez.y * maxz; + _this19.z += ez.z * maxz; + let _this20 = this._pool; + let _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = center.x; + _this21.y = center.y; + _this21.z = center.z; + let _this22 = _this21; + _this22.x += ex.x * maxx; + _this22.y += ex.y * maxx; + _this22.z += ex.z * maxx; + _this22.x += ey.x * maxy; + _this22.y += ey.y * maxy; + _this22.z += ey.z * maxy; + _this22.x += ez.x * minz; + _this22.y += ez.y * minz; + _this22.z += ez.z * minz; + let _this23 = this._pool; + let _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = center.x; + _this24.y = center.y; + _this24.z = center.z; + let _this25 = _this24; + _this25.x += ex.x * maxx; + _this25.y += ex.y * maxx; + _this25.z += ex.z * maxx; + _this25.x += ey.x * maxy; + _this25.y += ey.y * maxy; + _this25.z += ey.z * maxy; + _this25.x += ez.x * maxz; + _this25.y += ez.y * maxz; + _this25.z += ez.z * maxz; + d.line(_this4,_this16,color); + d.line(_this10,_this22,color); + d.line(_this7,_this19,color); + d.line(_this13,_this25,color); + d.line(_this4,_this10,color); + d.line(_this16,_this22,color); + d.line(_this7,_this13,color); + d.line(_this19,_this25,color); + d.line(_this4,_this7,color); + d.line(_this16,_this19,color); + d.line(_this10,_this13,color); + d.line(_this22,_this25,color); + let _this26 = this._pool; + if(_this4 != null) { + _this4.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this42.stackVec3[i]; - _this42.stackVec3[i] = null; + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; } - _this42.stackVec3 = newArray; + _this26.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = xyz; + _this26.stackVec3[_this26.sizeVec3++] = _this4; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this42.sizeMat3 == _this42.stackMat3.length) { - var newLength1 = _this42.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this42.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this42.stackMat3[i1]; - _this42.stackMat3[i1] = null; - } - _this42.stackMat3 = newArray1; - } - _this42.stackMat3[_this42.sizeMat3++] = mat3; + let _this27 = this._pool; + if(_this7 != null) { + _this7.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; + } + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = _this7; } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this42.sizeMat4 == _this42.stackMat4.length) { - var newLength2 = _this42.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this42.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this42.stackMat4[i2]; - _this42.stackMat4[i2] = null; - } - _this42.stackMat4 = newArray2; - } - _this42.stackMat4[_this42.sizeMat4++] = mat4; + let _this28 = this._pool; + if(_this10 != null) { + _this10.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; + } + _this28.stackVec3 = newArray; + } + _this28.stackVec3[_this28.sizeVec3++] = _this10; } - if(quat != null) { - var tx24 = 0; - var ty24 = 0; - var tz24 = 0; - var tw = 1; - quat.x = tx24; - quat.y = ty24; - quat.z = tz24; - quat.w = tw; - if(_this42.sizeQuat == _this42.stackQuat.length) { - var newLength3 = _this42.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this42.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this42.stackQuat[i3]; - _this42.stackQuat[i3] = null; - } - _this42.stackQuat = newArray3; - } - _this42.stackQuat[_this42.sizeQuat++] = quat; - } - var _this43 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(xyZ != null) { - xyZ.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newLength4 = _this43.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this43.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this43.stackVec3[i4]; - _this43.stackVec3[i4] = null; - } - _this43.stackVec3 = newArray4; - } - _this43.stackVec3[_this43.sizeVec3++] = xyZ; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this43.sizeMat3 == _this43.stackMat3.length) { - var newLength5 = _this43.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this43.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this43.stackMat3[i5]; - _this43.stackMat3[i5] = null; - } - _this43.stackMat3 = newArray5; - } - _this43.stackMat3[_this43.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this43.sizeMat4 == _this43.stackMat4.length) { - var newLength6 = _this43.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this43.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this43.stackMat4[i6]; - _this43.stackMat4[i6] = null; - } - _this43.stackMat4 = newArray6; - } - _this43.stackMat4[_this43.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx25 = 0; - var ty25 = 0; - var tz25 = 0; - var tw1 = 1; - quat1.x = tx25; - quat1.y = ty25; - quat1.z = tz25; - quat1.w = tw1; - if(_this43.sizeQuat == _this43.stackQuat.length) { - var newLength7 = _this43.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this43.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this43.stackQuat[i7]; - _this43.stackQuat[i7] = null; - } - _this43.stackQuat = newArray7; - } - _this43.stackQuat[_this43.sizeQuat++] = quat1; - } - var _this44 = this._pool; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(xYz != null) { - xYz.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newLength8 = _this44.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this44.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this44.stackVec3[i8]; - _this44.stackVec3[i8] = null; - } - _this44.stackVec3 = newArray8; - } - _this44.stackVec3[_this44.sizeVec3++] = xYz; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this44.sizeMat3 == _this44.stackMat3.length) { - var newLength9 = _this44.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this44.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this44.stackMat3[i9]; - _this44.stackMat3[i9] = null; - } - _this44.stackMat3 = newArray9; - } - _this44.stackMat3[_this44.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this44.sizeMat4 == _this44.stackMat4.length) { - var newLength10 = _this44.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this44.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this44.stackMat4[i10]; - _this44.stackMat4[i10] = null; - } - _this44.stackMat4 = newArray10; - } - _this44.stackMat4[_this44.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx26 = 0; - var ty26 = 0; - var tz26 = 0; - var tw2 = 1; - quat2.x = tx26; - quat2.y = ty26; - quat2.z = tz26; - quat2.w = tw2; - if(_this44.sizeQuat == _this44.stackQuat.length) { - var newLength11 = _this44.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this44.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this44.stackQuat[i11]; - _this44.stackQuat[i11] = null; - } - _this44.stackQuat = newArray11; - } - _this44.stackQuat[_this44.sizeQuat++] = quat2; - } - var _this45 = this._pool; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(xYZ != null) { - xYZ.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength12 = _this45.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this45.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this45.stackVec3[i12]; - _this45.stackVec3[i12] = null; - } - _this45.stackVec3 = newArray12; - } - _this45.stackVec3[_this45.sizeVec3++] = xYZ; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this45.sizeMat3 == _this45.stackMat3.length) { - var newLength13 = _this45.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this45.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this45.stackMat3[i13]; - _this45.stackMat3[i13] = null; - } - _this45.stackMat3 = newArray13; - } - _this45.stackMat3[_this45.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this45.sizeMat4 == _this45.stackMat4.length) { - var newLength14 = _this45.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this45.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this45.stackMat4[i14]; - _this45.stackMat4[i14] = null; - } - _this45.stackMat4 = newArray14; - } - _this45.stackMat4[_this45.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx27 = 0; - var ty27 = 0; - var tz27 = 0; - var tw3 = 1; - quat3.x = tx27; - quat3.y = ty27; - quat3.z = tz27; - quat3.w = tw3; - if(_this45.sizeQuat == _this45.stackQuat.length) { - var newLength15 = _this45.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this45.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this45.stackQuat[i15]; - _this45.stackQuat[i15] = null; - } - _this45.stackQuat = newArray15; - } - _this45.stackQuat[_this45.sizeQuat++] = quat3; - } - var _this46 = this._pool; - var mat34 = null; - var mat44 = null; - var quat4 = null; - if(Xyz != null) { - Xyz.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength16 = _this46.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g26 = 0; - var _g116 = _this46.sizeVec3; - while(_g26 < _g116) { - var i16 = _g26++; - newArray16[i16] = _this46.stackVec3[i16]; - _this46.stackVec3[i16] = null; - } - _this46.stackVec3 = newArray16; - } - _this46.stackVec3[_this46.sizeVec3++] = Xyz; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this46.sizeMat3 == _this46.stackMat3.length) { - var newLength17 = _this46.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g27 = 0; - var _g117 = _this46.sizeMat3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray17[i17] = _this46.stackMat3[i17]; - _this46.stackMat3[i17] = null; - } - _this46.stackMat3 = newArray17; - } - _this46.stackMat3[_this46.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this46.sizeMat4 == _this46.stackMat4.length) { - var newLength18 = _this46.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g28 = 0; - var _g118 = _this46.sizeMat4; - while(_g28 < _g118) { - var i18 = _g28++; - newArray18[i18] = _this46.stackMat4[i18]; - _this46.stackMat4[i18] = null; - } - _this46.stackMat4 = newArray18; - } - _this46.stackMat4[_this46.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx28 = 0; - var ty28 = 0; - var tz28 = 0; - var tw4 = 1; - quat4.x = tx28; - quat4.y = ty28; - quat4.z = tz28; - quat4.w = tw4; - if(_this46.sizeQuat == _this46.stackQuat.length) { - var newLength19 = _this46.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g29 = 0; - var _g119 = _this46.sizeQuat; - while(_g29 < _g119) { - var i19 = _g29++; - newArray19[i19] = _this46.stackQuat[i19]; - _this46.stackQuat[i19] = null; - } - _this46.stackQuat = newArray19; - } - _this46.stackQuat[_this46.sizeQuat++] = quat4; - } - var _this47 = this._pool; - var mat35 = null; - var mat45 = null; - var quat5 = null; - if(XyZ != null) { - XyZ.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newLength20 = _this47.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g30 = 0; - var _g120 = _this47.sizeVec3; - while(_g30 < _g120) { - var i20 = _g30++; - newArray20[i20] = _this47.stackVec3[i20]; - _this47.stackVec3[i20] = null; - } - _this47.stackVec3 = newArray20; - } - _this47.stackVec3[_this47.sizeVec3++] = XyZ; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this47.sizeMat3 == _this47.stackMat3.length) { - var newLength21 = _this47.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g31 = 0; - var _g121 = _this47.sizeMat3; - while(_g31 < _g121) { - var i21 = _g31++; - newArray21[i21] = _this47.stackMat3[i21]; - _this47.stackMat3[i21] = null; - } - _this47.stackMat3 = newArray21; - } - _this47.stackMat3[_this47.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this47.sizeMat4 == _this47.stackMat4.length) { - var newLength22 = _this47.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g32 = 0; - var _g122 = _this47.sizeMat4; - while(_g32 < _g122) { - var i22 = _g32++; - newArray22[i22] = _this47.stackMat4[i22]; - _this47.stackMat4[i22] = null; - } - _this47.stackMat4 = newArray22; - } - _this47.stackMat4[_this47.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx29 = 0; - var ty29 = 0; - var tz29 = 0; - var tw5 = 1; - quat5.x = tx29; - quat5.y = ty29; - quat5.z = tz29; - quat5.w = tw5; - if(_this47.sizeQuat == _this47.stackQuat.length) { - var newLength23 = _this47.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g33 = 0; - var _g123 = _this47.sizeQuat; - while(_g33 < _g123) { - var i23 = _g33++; - newArray23[i23] = _this47.stackQuat[i23]; - _this47.stackQuat[i23] = null; - } - _this47.stackQuat = newArray23; - } - _this47.stackQuat[_this47.sizeQuat++] = quat5; - } - var _this48 = this._pool; - var mat36 = null; - var mat46 = null; - var quat6 = null; - if(XYz != null) { - XYz.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newLength24 = _this48.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g34 = 0; - var _g124 = _this48.sizeVec3; - while(_g34 < _g124) { - var i24 = _g34++; - newArray24[i24] = _this48.stackVec3[i24]; - _this48.stackVec3[i24] = null; - } - _this48.stackVec3 = newArray24; - } - _this48.stackVec3[_this48.sizeVec3++] = XYz; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this48.sizeMat3 == _this48.stackMat3.length) { - var newLength25 = _this48.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g35 = 0; - var _g125 = _this48.sizeMat3; - while(_g35 < _g125) { - var i25 = _g35++; - newArray25[i25] = _this48.stackMat3[i25]; - _this48.stackMat3[i25] = null; - } - _this48.stackMat3 = newArray25; - } - _this48.stackMat3[_this48.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this48.sizeMat4 == _this48.stackMat4.length) { - var newLength26 = _this48.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g36 = 0; - var _g126 = _this48.sizeMat4; - while(_g36 < _g126) { - var i26 = _g36++; - newArray26[i26] = _this48.stackMat4[i26]; - _this48.stackMat4[i26] = null; - } - _this48.stackMat4 = newArray26; - } - _this48.stackMat4[_this48.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx30 = 0; - var ty30 = 0; - var tz30 = 0; - var tw6 = 1; - quat6.x = tx30; - quat6.y = ty30; - quat6.z = tz30; - quat6.w = tw6; - if(_this48.sizeQuat == _this48.stackQuat.length) { - var newLength27 = _this48.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g37 = 0; - var _g127 = _this48.sizeQuat; - while(_g37 < _g127) { - var i27 = _g37++; - newArray27[i27] = _this48.stackQuat[i27]; - _this48.stackQuat[i27] = null; - } - _this48.stackQuat = newArray27; - } - _this48.stackQuat[_this48.sizeQuat++] = quat6; - } - var _this49 = this._pool; - var mat37 = null; - var mat47 = null; - var quat7 = null; - if(XYZ != null) { - XYZ.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newLength28 = _this49.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g38 = 0; - var _g128 = _this49.sizeVec3; - while(_g38 < _g128) { - var i28 = _g38++; - newArray28[i28] = _this49.stackVec3[i28]; - _this49.stackVec3[i28] = null; - } - _this49.stackVec3 = newArray28; - } - _this49.stackVec3[_this49.sizeVec3++] = XYZ; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this49.sizeMat3 == _this49.stackMat3.length) { - var newLength29 = _this49.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g39 = 0; - var _g129 = _this49.sizeMat3; - while(_g39 < _g129) { - var i29 = _g39++; - newArray29[i29] = _this49.stackMat3[i29]; - _this49.stackMat3[i29] = null; - } - _this49.stackMat3 = newArray29; - } - _this49.stackMat3[_this49.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this49.sizeMat4 == _this49.stackMat4.length) { - var newLength30 = _this49.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g40 = 0; - var _g130 = _this49.sizeMat4; - while(_g40 < _g130) { - var i30 = _g40++; - newArray30[i30] = _this49.stackMat4[i30]; - _this49.stackMat4[i30] = null; - } - _this49.stackMat4 = newArray30; - } - _this49.stackMat4[_this49.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx31 = 0; - var ty31 = 0; - var tz31 = 0; - var tw7 = 1; - quat7.x = tx31; - quat7.y = ty31; - quat7.z = tz31; - quat7.w = tw7; - if(_this49.sizeQuat == _this49.stackQuat.length) { - var newLength31 = _this49.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g41 = 0; - var _g131 = _this49.sizeQuat; - while(_g41 < _g131) { - var i31 = _g41++; - newArray31[i31] = _this49.stackQuat[i31]; - _this49.stackQuat[i31] = null; - } - _this49.stackQuat = newArray31; - } - _this49.stackQuat[_this49.sizeQuat++] = quat7; + let _this29 = this._pool; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; + } + _this29.stackVec3 = newArray; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + let _this30 = this._pool; + if(_this16 != null) { + _this16.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; + } + _this30.stackVec3 = newArray; + } + _this30.stackVec3[_this30.sizeVec3++] = _this16; + } + let _this31 = this._pool; + if(_this19 != null) { + _this19.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; + } + _this31.stackVec3 = newArray; + } + _this31.stackVec3[_this31.sizeVec3++] = _this19; + } + let _this32 = this._pool; + if(_this22 != null) { + _this22.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; + } + _this32.stackVec3 = newArray; + } + _this32.stackVec3[_this32.sizeVec3++] = _this22; + } + let _this33 = this._pool; + if(_this25 != null) { + _this25.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; + } + _this33.stackVec3 = newArray; + } + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } _drawEllipseOnSphere(d,center,normal,x,y,radiansX,radiansY,radius,color) { - var n = 16; - var theta = 0; - var dTheta = 6.28318530717958 / n; - var _this = this._pool; - var rotVec = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var rotQ = _this1.sizeQuat == 0 ? new oimo.common.Quat() : _this1.stackQuat[--_this1.sizeQuat]; - var _this2 = this._pool; - var rotM = _this2.sizeMat3 == 0 ? new oimo.common.Mat3() : _this2.stackMat3[--_this2.sizeMat3]; - var _this3 = this._pool; - var prevV = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _g = 0; - var _g1 = n + 1; - while(_g < _g1) { - var i = _g++; - var rx = Math.cos(theta) * radiansX; - var ry = Math.sin(theta) * radiansY; - var halfRotAng = Math.sqrt(rx * rx + ry * ry); - var rotSin = Math.sin(halfRotAng * 0.5); - var rotCos = Math.cos(halfRotAng * 0.5); - var _this4 = rotVec.zero(); - var tx = _this4.x + x.x * rx; - var ty = _this4.y + x.y * rx; - var tz = _this4.z + x.z * rx; - _this4.x = tx; - _this4.y = ty; - _this4.z = tz; - var _this5 = _this4; - var tx1 = _this5.x + y.x * ry; - var ty1 = _this5.y + y.y * ry; - var tz1 = _this5.z + y.z * ry; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var s = 1 / halfRotAng * rotSin; - var tx2 = rotVec.x * s; - var ty2 = rotVec.y * s; - var tz2 = rotVec.z * s; - rotVec.x = tx2; - rotVec.y = ty2; - rotVec.z = tz2; + let theta = 0; + let _this = this._pool; + let rotVec = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let rotQ = _this1.sizeQuat == 0 ? new oimo.common.Quat() : _this1.stackQuat[--_this1.sizeQuat]; + let _this2 = this._pool; + let rotM = _this2.sizeMat3 == 0 ? new oimo.common.Mat3() : _this2.stackMat3[--_this2.sizeMat3]; + let _this3 = this._pool; + let prevV = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _g = 0; + while(_g < 17) { + let i = _g++; + let rx = Math.cos(theta) * radiansX; + let ry = Math.sin(theta) * radiansY; + let halfRotAng = Math.sqrt(rx * rx + ry * ry); + let rotSin = Math.sin(halfRotAng * 0.5); + let rotCos = Math.cos(halfRotAng * 0.5); + let _this = rotVec.zero(); + _this.x += x.x * rx; + _this.y += x.y * rx; + _this.z += x.z * rx; + _this.x += y.x * ry; + _this.y += y.y * ry; + _this.z += y.z * ry; + let s = 1 / halfRotAng * rotSin; + rotVec.x *= s; + rotVec.y *= s; + rotVec.z *= s; rotQ.x = rotVec.x; rotQ.y = rotVec.y; rotQ.z = rotVec.z; rotQ.w = rotCos; - var x1 = rotQ.x; - var y1 = rotQ.y; - var z = rotQ.z; - var w = rotQ.w; - var x2 = 2 * x1; - var y2 = 2 * y1; - var z2 = 2 * z; - var xx = x1 * x2; - var yy = y1 * y2; - var zz = z * z2; - var xy = x1 * y2; - var yz = y1 * z2; - var xz = x1 * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x1 = rotQ.x; + let y1 = rotQ.y; + let z = rotQ.z; + let w = rotQ.w; + let x2 = 2 * x1; + let y2 = 2 * y1; + let z2 = 2 * z; + let xx = x1 * x2; + let yy = y1 * y2; + let zz = z * z2; + let xy = x1 * y2; + let yz = y1 * z2; + let xz = x1 * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; rotM.e00 = 1 - yy - zz; rotM.e01 = xy - wz; rotM.e02 = xz + wy; @@ -24961,668 +17747,116 @@ oimo.dynamics.World = class oimo_dynamics_World { rotM.e20 = xz - wy; rotM.e21 = yz + wx; rotM.e22 = 1 - xx - yy; - var _this6 = this._pool; - var _this7 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var tx3 = _this7.x + normal.x * radius; - var ty3 = _this7.y + normal.y * radius; - var tz3 = _this7.z + normal.z * radius; - _this7.x = tx3; - _this7.y = ty3; - _this7.z = tz3; - var v = _this7; - var tx4 = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; - var ty4 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; - var tz4 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; - v.x = tx4; - v.y = ty4; - v.z = tz4; - var _this8 = v; - var tx5 = _this8.x + center.x; - var ty5 = _this8.y + center.y; - var tz5 = _this8.z + center.z; - _this8.x = tx5; - _this8.y = ty5; - _this8.z = tz5; + let _this1 = this._pool; + let _this2 = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x += normal.x * radius; + _this2.y += normal.y * radius; + _this2.z += normal.z * radius; + let v = _this2; + let y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; + let z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; + v.x = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; + v.y = y3; + v.z = z1; + v.x += center.x; + v.y += center.y; + v.z += center.z; if(i >= 1) { d.line(prevV,v,color); } - var _this9 = this._pool; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this3 = this._pool; if(prevV != null) { prevV.zero(); - if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newLength = _this9.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g2 = 0; - var _g11 = _this9.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray[i1] = _this9.stackVec3[i1]; - _this9.stackVec3[i1] = null; - } - _this9.stackVec3 = newArray; - } - _this9.stackVec3[_this9.sizeVec3++] = prevV; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newLength1 = _this9.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g3 = 0; - var _g12 = _this9.sizeMat3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray1[i2] = _this9.stackMat3[i2]; - _this9.stackMat3[i2] = null; - } - _this9.stackMat3 = newArray1; - } - _this9.stackMat3[_this9.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this9.sizeMat4 == _this9.stackMat4.length) { - var newLength2 = _this9.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g4 = 0; - var _g13 = _this9.sizeMat4; - while(_g4 < _g13) { - var i3 = _g4++; - newArray2[i3] = _this9.stackMat4[i3]; - _this9.stackMat4[i3] = null; - } - _this9.stackMat4 = newArray2; - } - _this9.stackMat4[_this9.sizeMat4++] = mat4; - } - if(quat != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw = 1; - quat.x = tx6; - quat.y = ty6; - quat.z = tz6; - quat.w = tw; - if(_this9.sizeQuat == _this9.stackQuat.length) { - var newLength3 = _this9.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g5 = 0; - var _g14 = _this9.sizeQuat; - while(_g5 < _g14) { - var i4 = _g5++; - newArray3[i4] = _this9.stackQuat[i4]; - _this9.stackQuat[i4] = null; + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this9.stackQuat = newArray3; + _this3.stackVec3 = newArray; } - _this9.stackQuat[_this9.sizeQuat++] = quat; + _this3.stackVec3[_this3.sizeVec3++] = prevV; } prevV = v; - theta += dTheta; + theta += 0.39269908169872375; } - var _this10 = this._pool; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this4 = this._pool; if(rotVec != null) { rotVec.zero(); - if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength4 = _this10.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g6 = 0; - var _g15 = _this10.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray4[i5] = _this10.stackVec3[i5]; - _this10.stackVec3[i5] = null; - } - _this10.stackVec3 = newArray4; - } - _this10.stackVec3[_this10.sizeVec3++] = rotVec; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this10.sizeMat3 == _this10.stackMat3.length) { - var newLength5 = _this10.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g7 = 0; - var _g16 = _this10.sizeMat3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray5[i6] = _this10.stackMat3[i6]; - _this10.stackMat3[i6] = null; - } - _this10.stackMat3 = newArray5; - } - _this10.stackMat3[_this10.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this10.sizeMat4 == _this10.stackMat4.length) { - var newLength6 = _this10.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g8 = 0; - var _g17 = _this10.sizeMat4; - while(_g8 < _g17) { - var i7 = _g8++; - newArray6[i7] = _this10.stackMat4[i7]; - _this10.stackMat4[i7] = null; - } - _this10.stackMat4 = newArray6; - } - _this10.stackMat4[_this10.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx7 = 0; - var ty7 = 0; - var tz7 = 0; - var tw1 = 1; - quat1.x = tx7; - quat1.y = ty7; - quat1.z = tz7; - quat1.w = tw1; - if(_this10.sizeQuat == _this10.stackQuat.length) { - var newLength7 = _this10.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g9 = 0; - var _g18 = _this10.sizeQuat; - while(_g9 < _g18) { - var i8 = _g9++; - newArray7[i8] = _this10.stackQuat[i8]; - _this10.stackQuat[i8] = null; - } - _this10.stackQuat = newArray7; - } - _this10.stackQuat[_this10.sizeQuat++] = quat1; - } - var _this11 = this._pool; - var vec3 = null; - var mat32 = null; - var mat42 = null; - if(vec3 != null) { - vec3.zero(); - if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newLength8 = _this11.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g10 = 0; - var _g19 = _this11.sizeVec3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray8[i9] = _this11.stackVec3[i9]; - _this11.stackVec3[i9] = null; - } - _this11.stackVec3 = newArray8; - } - _this11.stackVec3[_this11.sizeVec3++] = vec3; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this11.sizeMat3 == _this11.stackMat3.length) { - var newLength9 = _this11.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g20 = 0; - var _g110 = _this11.sizeMat3; - while(_g20 < _g110) { - var i10 = _g20++; - newArray9[i10] = _this11.stackMat3[i10]; - _this11.stackMat3[i10] = null; - } - _this11.stackMat3 = newArray9; - } - _this11.stackMat3[_this11.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this11.sizeMat4 == _this11.stackMat4.length) { - var newLength10 = _this11.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g21 = 0; - var _g111 = _this11.sizeMat4; - while(_g21 < _g111) { - var i11 = _g21++; - newArray10[i11] = _this11.stackMat4[i11]; - _this11.stackMat4[i11] = null; - } - _this11.stackMat4 = newArray10; - } - _this11.stackMat4[_this11.sizeMat4++] = mat42; + if(_this4.sizeVec3 == _this4.stackVec3.length) { + let newArray = new Array(_this4.sizeVec3 << 1); + let _g = 0; + let _g1 = _this4.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this4.stackVec3[i]; + _this4.stackVec3[i] = null; + } + _this4.stackVec3 = newArray; + } + _this4.stackVec3[_this4.sizeVec3++] = rotVec; } + let _this5 = this._pool; if(rotQ != null) { - var tx8 = 0; - var ty8 = 0; - var tz8 = 0; - var tw2 = 1; - rotQ.x = tx8; - rotQ.y = ty8; - rotQ.z = tz8; - rotQ.w = tw2; - if(_this11.sizeQuat == _this11.stackQuat.length) { - var newLength11 = _this11.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g22 = 0; - var _g112 = _this11.sizeQuat; - while(_g22 < _g112) { - var i12 = _g22++; - newArray11[i12] = _this11.stackQuat[i12]; - _this11.stackQuat[i12] = null; - } - _this11.stackQuat = newArray11; - } - _this11.stackQuat[_this11.sizeQuat++] = rotQ; - } - var _this12 = this._pool; - var vec31 = null; - var mat43 = null; - var quat2 = null; - if(vec31 != null) { - vec31.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength12 = _this12.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g23 = 0; - var _g113 = _this12.sizeVec3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray12[i13] = _this12.stackVec3[i13]; - _this12.stackVec3[i13] = null; + rotQ.x = 0; + rotQ.y = 0; + rotQ.z = 0; + rotQ.w = 1; + if(_this5.sizeQuat == _this5.stackQuat.length) { + let newArray = new Array(_this5.sizeQuat << 1); + let _g = 0; + let _g1 = _this5.sizeQuat; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this5.stackQuat[i]; + _this5.stackQuat[i] = null; } - _this12.stackVec3 = newArray12; + _this5.stackQuat = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = vec31; + _this5.stackQuat[_this5.sizeQuat++] = rotQ; } + let _this6 = this._pool; if(rotM != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - rotM.e00 = t006; - rotM.e01 = t016; - rotM.e02 = t026; - rotM.e10 = t106; - rotM.e11 = t116; - rotM.e12 = t126; - rotM.e20 = t206; - rotM.e21 = t216; - rotM.e22 = t226; - if(_this12.sizeMat3 == _this12.stackMat3.length) { - var newLength13 = _this12.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g24 = 0; - var _g114 = _this12.sizeMat3; - while(_g24 < _g114) { - var i14 = _g24++; - newArray13[i14] = _this12.stackMat3[i14]; - _this12.stackMat3[i14] = null; - } - _this12.stackMat3 = newArray13; - } - _this12.stackMat3[_this12.sizeMat3++] = rotM; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this12.sizeMat4 == _this12.stackMat4.length) { - var newLength14 = _this12.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g25 = 0; - var _g115 = _this12.sizeMat4; - while(_g25 < _g115) { - var i15 = _g25++; - newArray14[i15] = _this12.stackMat4[i15]; - _this12.stackMat4[i15] = null; - } - _this12.stackMat4 = newArray14; - } - _this12.stackMat4[_this12.sizeMat4++] = mat43; - } - if(quat2 != null) { - var tx9 = 0; - var ty9 = 0; - var tz9 = 0; - var tw3 = 1; - quat2.x = tx9; - quat2.y = ty9; - quat2.z = tz9; - quat2.w = tw3; - if(_this12.sizeQuat == _this12.stackQuat.length) { - var newLength15 = _this12.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g26 = 0; - var _g116 = _this12.sizeQuat; - while(_g26 < _g116) { - var i16 = _g26++; - newArray15[i16] = _this12.stackQuat[i16]; - _this12.stackQuat[i16] = null; - } - _this12.stackQuat = newArray15; - } - _this12.stackQuat[_this12.sizeQuat++] = quat2; - } - var _this13 = this._pool; - var mat33 = null; - var mat44 = null; - var quat3 = null; + rotM.e00 = 1; + rotM.e01 = 0; + rotM.e02 = 0; + rotM.e10 = 0; + rotM.e11 = 1; + rotM.e12 = 0; + rotM.e20 = 0; + rotM.e21 = 0; + rotM.e22 = 1; + if(_this6.sizeMat3 == _this6.stackMat3.length) { + let newArray = new Array(_this6.sizeMat3 << 1); + let _g = 0; + let _g1 = _this6.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this6.stackMat3[i]; + _this6.stackMat3[i] = null; + } + _this6.stackMat3 = newArray; + } + _this6.stackMat3[_this6.sizeMat3++] = rotM; + } + let _this7 = this._pool; if(prevV != null) { prevV.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength16 = _this13.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g27 = 0; - var _g117 = _this13.sizeVec3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray16[i17] = _this13.stackVec3[i17]; - _this13.stackVec3[i17] = null; - } - _this13.stackVec3 = newArray16; - } - _this13.stackVec3[_this13.sizeVec3++] = prevV; - } - if(mat33 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat33.e00 = t008; - mat33.e01 = t018; - mat33.e02 = t028; - mat33.e10 = t108; - mat33.e11 = t118; - mat33.e12 = t128; - mat33.e20 = t208; - mat33.e21 = t218; - mat33.e22 = t228; - if(_this13.sizeMat3 == _this13.stackMat3.length) { - var newLength17 = _this13.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g28 = 0; - var _g118 = _this13.sizeMat3; - while(_g28 < _g118) { - var i18 = _g28++; - newArray17[i18] = _this13.stackMat3[i18]; - _this13.stackMat3[i18] = null; - } - _this13.stackMat3 = newArray17; - } - _this13.stackMat3[_this13.sizeMat3++] = mat33; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this13.sizeMat4 == _this13.stackMat4.length) { - var newLength18 = _this13.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g29 = 0; - var _g119 = _this13.sizeMat4; - while(_g29 < _g119) { - var i19 = _g29++; - newArray18[i19] = _this13.stackMat4[i19]; - _this13.stackMat4[i19] = null; - } - _this13.stackMat4 = newArray18; - } - _this13.stackMat4[_this13.sizeMat4++] = mat44; - } - if(quat3 != null) { - var tx10 = 0; - var ty10 = 0; - var tz10 = 0; - var tw4 = 1; - quat3.x = tx10; - quat3.y = ty10; - quat3.z = tz10; - quat3.w = tw4; - if(_this13.sizeQuat == _this13.stackQuat.length) { - var newLength19 = _this13.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g30 = 0; - var _g120 = _this13.sizeQuat; - while(_g30 < _g120) { - var i20 = _g30++; - newArray19[i20] = _this13.stackQuat[i20]; - _this13.stackQuat[i20] = null; - } - _this13.stackQuat = newArray19; - } - _this13.stackQuat[_this13.sizeQuat++] = quat3; + if(_this7.sizeVec3 == _this7.stackVec3.length) { + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; + } + _this7.stackVec3 = newArray; + } + _this7.stackVec3[_this7.sizeVec3++] = prevV; } } step(timeStep) { @@ -25631,11 +17865,10 @@ oimo.dynamics.World = class oimo_dynamics_World { } this._timeStep.dt = timeStep; this._timeStep.invDt = 1 / timeStep; - var st = Date.now() / 1000; + let st = HxOverrides.now() / 1000; this._updateContacts(); this._solveIslands(); - var en = Date.now() / 1000; - oimo.dynamics.common.Performance.totalTime = (en - st) * 1000; + oimo.dynamics.common.Performance.totalTime = (HxOverrides.now() / 1000 - st) * 1000; } addRigidBody(rigidBody) { if(rigidBody._world != null) { @@ -25650,9 +17883,9 @@ oimo.dynamics.World = class oimo_dynamics_World { this._rigidBodyListLast = rigidBody; } rigidBody._world = this; - var s = rigidBody._shapeList; + let s = rigidBody._shapeList; while(s != null) { - var n = s._next; + let n = s._next; s._proxy = this._broadPhase.createProxy(s,s._aabb); s._id = this._shapeIdCount++; this._numShapes++; @@ -25664,8 +17897,8 @@ oimo.dynamics.World = class oimo_dynamics_World { if(rigidBody._world != this) { throw new Error("The rigid body doesn't belong to the world."); } - var prev = rigidBody._prev; - var next = rigidBody._next; + let prev = rigidBody._prev; + let next = rigidBody._next; if(prev != null) { prev._next = next; } @@ -25681,28 +17914,28 @@ oimo.dynamics.World = class oimo_dynamics_World { rigidBody._next = null; rigidBody._prev = null; rigidBody._world = null; - var s = rigidBody._shapeList; + let s = rigidBody._shapeList; while(s != null) { - var n = s._next; + let n = s._next; this._broadPhase.destroyProxy(s._proxy); s._proxy = null; s._id = -1; - var cl = s._rigidBody._contactLinkList; + let cl = s._rigidBody._contactLinkList; while(cl != null) { - var n1 = cl._next; - var c = cl._contact; + let n = cl._next; + let c = cl._contact; if(c._s1 == s || c._s2 == s) { - var _this = cl._other; + let _this = cl._other; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + let _this1 = this._contactManager; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this1._contactList) { _this1._contactList = _this1._contactList._next; @@ -25713,8 +17946,8 @@ oimo.dynamics.World = class oimo_dynamics_World { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; - var cc2 = c._s2._contactCallback; + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; if(cc1 == cc2) { cc2 = null; } @@ -25725,13 +17958,13 @@ oimo.dynamics.World = class oimo_dynamics_World { cc2.endContact(c); } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -25741,13 +17974,13 @@ oimo.dynamics.World = class oimo_dynamics_World { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -25771,7 +18004,7 @@ oimo.dynamics.World = class oimo_dynamics_World { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this2 = c._contactConstraint; + let _this2 = c._contactConstraint; _this2._s1 = null; _this2._s2 = null; _this2._b1 = null; @@ -25782,7 +18015,7 @@ oimo.dynamics.World = class oimo_dynamics_World { _this1._contactPool = c; _this1._numContacts--; } - cl = n1; + cl = n; } this._numShapes--; s = n; @@ -25822,10 +18055,10 @@ oimo.dynamics.World = class oimo_dynamics_World { } joint._b1._numJointLinks++; joint._b2._numJointLinks++; - var _this = joint._b1; + let _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; + let _this1 = joint._b2; _this1._sleeping = false; _this1._sleepTime = 0; joint._syncAnchors(); @@ -25835,8 +18068,8 @@ oimo.dynamics.World = class oimo_dynamics_World { if(joint._world != this) { throw new Error("The joint doesn't belong to the world."); } - var prev = joint._prev; - var next = joint._next; + let prev = joint._prev; + let next = joint._next; if(prev != null) { prev._next = next; } @@ -25852,8 +18085,8 @@ oimo.dynamics.World = class oimo_dynamics_World { joint._next = null; joint._prev = null; joint._world = null; - var prev1 = joint._link1._prev; - var next1 = joint._link1._next; + let prev1 = joint._link1._prev; + let next1 = joint._link1._next; if(prev1 != null) { prev1._next = next1; } @@ -25868,8 +18101,8 @@ oimo.dynamics.World = class oimo_dynamics_World { } joint._link1._next = null; joint._link1._prev = null; - var prev2 = joint._link2._prev; - var next2 = joint._link2._next; + let prev2 = joint._link2._prev; + let next2 = joint._link2._next; if(prev2 != null) { prev2._next = next2; } @@ -25888,10 +18121,10 @@ oimo.dynamics.World = class oimo_dynamics_World { joint._link2._other = null; joint._b1._numJointLinks--; joint._b2._numJointLinks--; - var _this = joint._b1; + let _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; + let _this1 = joint._b2; _this1._sleeping = false; _this1._sleepTime = 0; this._numJoints--; @@ -25905,19 +18138,18 @@ oimo.dynamics.World = class oimo_dynamics_World { debugDraw() { if(this._debugDraw != null) { if(this._broadPhase._type == 2) { - var bvhBroadPhase = this._broadPhase; - this._drawBvh(this._debugDraw,bvhBroadPhase._tree); + this._drawBvh(this._debugDraw,this._broadPhase._tree); } this._drawRigidBodies(this._debugDraw); this._drawConstraints(this._debugDraw); } } rayCast(begin,end,callback) { - var _this = this._rayCastWrapper.begin; + let _this = this._rayCastWrapper.begin; _this.x = begin.x; _this.y = begin.y; _this.z = begin.z; - var _this1 = this._rayCastWrapper.end; + let _this1 = this._rayCastWrapper.end; _this1.x = end.x; _this1.y = end.y; _this1.z = end.z; @@ -25926,7 +18158,7 @@ oimo.dynamics.World = class oimo_dynamics_World { } convexCast(convex,begin,translation,callback) { this._convexCastWrapper.convex = convex; - var _this = this._convexCastWrapper.begin; + let _this = this._convexCastWrapper.begin; _this._positionX = begin._positionX; _this._positionY = begin._positionY; _this._positionZ = begin._positionZ; @@ -25939,7 +18171,7 @@ oimo.dynamics.World = class oimo_dynamics_World { _this._rotation20 = begin._rotation20; _this._rotation21 = begin._rotation21; _this._rotation22 = begin._rotation22; - var _this1 = this._convexCastWrapper.translation; + let _this1 = this._convexCastWrapper.translation; _this1.x = translation.x; _this1.y = translation.y; _this1.z = translation.z; @@ -25991,7 +18223,7 @@ oimo.dynamics.World = class oimo_dynamics_World { return this._gravity; } setGravity(gravity) { - var _this = this._gravity; + let _this = this._gravity; _this.x = gravity.x; _this.y = gravity.y; _this.z = gravity.z; @@ -26007,7 +18239,7 @@ oimo.dynamics._World.RayCastWrapper = class oimo_dynamics__$World_RayCastWrapper this.callback = null; } process(proxy) { - var shape = proxy.userData; + let shape = proxy.userData; if(shape._geom.rayCast(this.begin,this.end,shape._transform,this.rayCastHit)) { this.callback.process(shape,this.rayCastHit); } @@ -26024,13 +18256,12 @@ oimo.dynamics._World.ConvexCastWrapper = class oimo_dynamics__$World_ConvexCastW this.convex = null; } process(proxy) { - var shape = proxy.userData; - var type = shape._geom._type; + let shape = proxy.userData; + let type = shape._geom._type; if(type < 0 || type > 5) { return; } - var geom = shape._geom; - if(oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance.convexCast(this.convex,geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { + if(oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance.convexCast(this.convex,shape._geom,this.begin,shape._transform,this.translation,this.zero,this.rayCastHit)) { this.callback.process(shape,this.rayCastHit); } } @@ -26042,8 +18273,8 @@ oimo.dynamics._World.AabbTestWrapper = class oimo_dynamics__$World_AabbTestWrapp this._callback = null; } process(proxy) { - var shape = proxy.userData; - var shapeAabb = shape._aabb; + let shape = proxy.userData; + let shapeAabb = shape._aabb; if(shapeAabb._minX < this._aabb._maxX && shapeAabb._maxX > this._aabb._minX && shapeAabb._minY < this._aabb._maxY && shapeAabb._maxY > this._aabb._minY && shapeAabb._minZ < this._aabb._maxZ && shapeAabb._maxZ > this._aabb._minZ) { this._callback.process(shape); } @@ -26097,13 +18328,13 @@ oimo.dynamics.callback.RayCastClosest = class oimo_dynamics_callback_RayCastClos this.shape = shape; this.hit = true; this.fraction = hit.fraction; - var _this = this.position; - var v = hit.position; + let _this = this.position; + let v = hit.position; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.normal; - var v1 = hit.normal; + let _this1 = this.normal; + let v1 = hit.normal; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; @@ -26125,80 +18356,59 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { this.drawContacts = false; this.drawJoints = true; this.drawJointLimits = false; - var nt = 4; - var dt = 3.14159265358979 / nt; - var np = 8; - var dp = 6.28318530717958 / np; - var this1 = new Array(nt + 1); - this.sphereCoords = this1; - var this2 = new Array(nt + 1); - this.tmpSphereVerts = this2; - var this3 = new Array(nt + 1); - this.tmpSphereNorms = this3; - var _g = 0; - var _g1 = nt + 1; - while(_g < _g1) { - var i = _g++; - var num = i == 0 || i == nt ? 1 : np; - var this4 = this.sphereCoords; - var this5 = new Array(num); - this4[i] = this5; - var this6 = this.tmpSphereVerts; - var this7 = new Array(num); - this6[i] = this7; - var this8 = this.tmpSphereNorms; - var this9 = new Array(num); - this8[i] = this9; - var _g2 = 0; - var _g11 = np; - while(_g2 < _g11) { - var j = _g2++; - var theta = i * dt; - var phi = j * dp; + this.sphereCoords = new Array(5); + this.tmpSphereVerts = new Array(5); + this.tmpSphereNorms = new Array(5); + let _g = 0; + while(_g < 5) { + let i = _g++; + let num = i == 0 || i == 4 ? 1 : 8; + this.sphereCoords[i] = new Array(num); + this.tmpSphereVerts[i] = new Array(num); + this.tmpSphereNorms[i] = new Array(num); + let _g1 = 0; + while(_g1 < 8) { + let j = _g1++; + let theta = i * 0.7853981633974475; + let phi = j * 0.7853981633974475; this.sphereCoords[i][j] = new oimo.common.Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); this.tmpSphereVerts[i][j] = new oimo.common.Vec3(); this.tmpSphereNorms[i][j] = new oimo.common.Vec3(); } } - var this10 = new Array(8); - this.circleCoords = this10; - var this11 = new Array(8); - this.circleCoordsShift = this11; - var this12 = new Array(8); - this.tmpCircleVerts1 = this12; - var this13 = new Array(8); - this.tmpCircleVerts2 = this13; - var this14 = new Array(8); - this.tmpCircleNorms = this14; - var td = 0.785398163397447502; - var _g3 = 0; - while(_g3 < 8) { - var i1 = _g3++; - this.circleCoords[i1] = new oimo.common.Vec3(Math.cos(i1 * td),0,-Math.sin(i1 * td)); - this.circleCoordsShift[i1] = new oimo.common.Vec3(Math.cos((i1 + 0.5) * td),0,-Math.sin((i1 + 0.5) * td)); - this.tmpCircleVerts1[i1] = new oimo.common.Vec3(); - this.tmpCircleVerts2[i1] = new oimo.common.Vec3(); - this.tmpCircleNorms[i1] = new oimo.common.Vec3(); + this.circleCoords = new Array(8); + this.circleCoordsShift = new Array(8); + this.tmpCircleVerts1 = new Array(8); + this.tmpCircleVerts2 = new Array(8); + this.tmpCircleNorms = new Array(8); + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + this.circleCoords[i] = new oimo.common.Vec3(Math.cos(i * 0.7853981633974475),0,-Math.sin(i * 0.7853981633974475)); + this.circleCoordsShift[i] = new oimo.common.Vec3(Math.cos((i + 0.5) * 0.7853981633974475),0,-Math.sin((i + 0.5) * 0.7853981633974475)); + this.tmpCircleVerts1[i] = new oimo.common.Vec3(); + this.tmpCircleVerts2[i] = new oimo.common.Vec3(); + this.tmpCircleNorms[i] = new oimo.common.Vec3(); } this.style = new oimo.dynamics.common.DebugDrawStyle(); } aabb(min,max,color) { - var _this = this.p; - var v1 = (_this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); - var _this1 = this.p; - var v2 = (_this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); - var _this2 = this.p; - var v3 = (_this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); - var _this3 = this.p; - var v4 = (_this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); - var _this4 = this.p; - var v5 = (_this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); - var _this5 = this.p; - var v6 = (_this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); - var _this6 = this.p; - var v7 = (_this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); - var _this7 = this.p; - var v8 = (_this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); + let _this = this.p; + let v1 = (_this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); + let _this1 = this.p; + let v2 = (_this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); + let _this2 = this.p; + let v3 = (_this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); + let _this3 = this.p; + let v4 = (_this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); + let _this4 = this.p; + let v5 = (_this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); + let _this5 = this.p; + let v6 = (_this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); + let _this6 = this.p; + let v7 = (_this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); + let _this7 = this.p; + let v8 = (_this7.sizeVec3 == 0 ? new oimo.common.Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); this.line(v1,v2,color); this.line(v3,v4,color); this.line(v5,v6,color); @@ -26211,20 +18421,15 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { this.line(v2,v6,color); this.line(v3,v7,color); this.line(v4,v8,color); - var _this8 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this8 = this.p; if(v1 != null) { v1.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newLength = _this8.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this8.sizeVec3; + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -26232,1018 +18437,135 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { } _this8.stackVec3[_this8.sizeVec3++] = v1; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this8.sizeMat3 == _this8.stackMat3.length) { - var newLength1 = _this8.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this8.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this8.stackMat3[i1]; - _this8.stackMat3[i1] = null; - } - _this8.stackMat3 = newArray1; - } - _this8.stackMat3[_this8.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this8.sizeMat4 == _this8.stackMat4.length) { - var newLength2 = _this8.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this8.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this8.stackMat4[i2]; - _this8.stackMat4[i2] = null; - } - _this8.stackMat4 = newArray2; - } - _this8.stackMat4[_this8.sizeMat4++] = mat4; - } - if(quat != null) { - var tx = 0; - var ty = 0; - var tz = 0; - var tw = 1; - quat.x = tx; - quat.y = ty; - quat.z = tz; - quat.w = tw; - if(_this8.sizeQuat == _this8.stackQuat.length) { - var newLength3 = _this8.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this8.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this8.stackQuat[i3]; - _this8.stackQuat[i3] = null; - } - _this8.stackQuat = newArray3; - } - _this8.stackQuat[_this8.sizeQuat++] = quat; - } - var _this9 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this9 = this.p; if(v2 != null) { v2.zero(); if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newLength4 = _this9.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this9.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this9.stackVec3[i4]; - _this9.stackVec3[i4] = null; - } - _this9.stackVec3 = newArray4; + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; + } + _this9.stackVec3 = newArray; } _this9.stackVec3[_this9.sizeVec3++] = v2; } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newLength5 = _this9.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this9.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this9.stackMat3[i5]; - _this9.stackMat3[i5] = null; - } - _this9.stackMat3 = newArray5; - } - _this9.stackMat3[_this9.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this9.sizeMat4 == _this9.stackMat4.length) { - var newLength6 = _this9.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this9.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this9.stackMat4[i6]; - _this9.stackMat4[i6] = null; - } - _this9.stackMat4 = newArray6; - } - _this9.stackMat4[_this9.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx1 = 0; - var ty1 = 0; - var tz1 = 0; - var tw1 = 1; - quat1.x = tx1; - quat1.y = ty1; - quat1.z = tz1; - quat1.w = tw1; - if(_this9.sizeQuat == _this9.stackQuat.length) { - var newLength7 = _this9.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this9.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this9.stackQuat[i7]; - _this9.stackQuat[i7] = null; - } - _this9.stackQuat = newArray7; - } - _this9.stackQuat[_this9.sizeQuat++] = quat1; - } - var _this10 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; + let _this10 = this.p; if(v3 != null) { v3.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength8 = _this10.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this10.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this10.stackVec3[i8]; - _this10.stackVec3[i8] = null; - } - _this10.stackVec3 = newArray8; - } + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; + } + _this10.stackVec3 = newArray; + } _this10.stackVec3[_this10.sizeVec3++] = v3; } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this10.sizeMat3 == _this10.stackMat3.length) { - var newLength9 = _this10.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this10.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this10.stackMat3[i9]; - _this10.stackMat3[i9] = null; - } - _this10.stackMat3 = newArray9; - } - _this10.stackMat3[_this10.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this10.sizeMat4 == _this10.stackMat4.length) { - var newLength10 = _this10.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this10.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this10.stackMat4[i10]; - _this10.stackMat4[i10] = null; - } - _this10.stackMat4 = newArray10; - } - _this10.stackMat4[_this10.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx2 = 0; - var ty2 = 0; - var tz2 = 0; - var tw2 = 1; - quat2.x = tx2; - quat2.y = ty2; - quat2.z = tz2; - quat2.w = tw2; - if(_this10.sizeQuat == _this10.stackQuat.length) { - var newLength11 = _this10.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this10.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this10.stackQuat[i11]; - _this10.stackQuat[i11] = null; - } - _this10.stackQuat = newArray11; - } - _this10.stackQuat[_this10.sizeQuat++] = quat2; - } - var _this11 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; + let _this11 = this.p; if(v4 != null) { v4.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newLength12 = _this11.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this11.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this11.stackVec3[i12]; - _this11.stackVec3[i12] = null; - } - _this11.stackVec3 = newArray12; + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; } _this11.stackVec3[_this11.sizeVec3++] = v4; } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this11.sizeMat3 == _this11.stackMat3.length) { - var newLength13 = _this11.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this11.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this11.stackMat3[i13]; - _this11.stackMat3[i13] = null; - } - _this11.stackMat3 = newArray13; - } - _this11.stackMat3[_this11.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this11.sizeMat4 == _this11.stackMat4.length) { - var newLength14 = _this11.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this11.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this11.stackMat4[i14]; - _this11.stackMat4[i14] = null; - } - _this11.stackMat4 = newArray14; - } - _this11.stackMat4[_this11.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx3 = 0; - var ty3 = 0; - var tz3 = 0; - var tw3 = 1; - quat3.x = tx3; - quat3.y = ty3; - quat3.z = tz3; - quat3.w = tw3; - if(_this11.sizeQuat == _this11.stackQuat.length) { - var newLength15 = _this11.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this11.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this11.stackQuat[i15]; - _this11.stackQuat[i15] = null; - } - _this11.stackQuat = newArray15; - } - _this11.stackQuat[_this11.sizeQuat++] = quat3; - } - var _this12 = this.p; - var mat34 = null; - var mat44 = null; - var quat4 = null; + let _this12 = this.p; if(v5 != null) { v5.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength16 = _this12.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g26 = 0; - var _g116 = _this12.sizeVec3; - while(_g26 < _g116) { - var i16 = _g26++; - newArray16[i16] = _this12.stackVec3[i16]; - _this12.stackVec3[i16] = null; - } - _this12.stackVec3 = newArray16; + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; } _this12.stackVec3[_this12.sizeVec3++] = v5; } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this12.sizeMat3 == _this12.stackMat3.length) { - var newLength17 = _this12.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g27 = 0; - var _g117 = _this12.sizeMat3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray17[i17] = _this12.stackMat3[i17]; - _this12.stackMat3[i17] = null; - } - _this12.stackMat3 = newArray17; - } - _this12.stackMat3[_this12.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this12.sizeMat4 == _this12.stackMat4.length) { - var newLength18 = _this12.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g28 = 0; - var _g118 = _this12.sizeMat4; - while(_g28 < _g118) { - var i18 = _g28++; - newArray18[i18] = _this12.stackMat4[i18]; - _this12.stackMat4[i18] = null; - } - _this12.stackMat4 = newArray18; - } - _this12.stackMat4[_this12.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx4 = 0; - var ty4 = 0; - var tz4 = 0; - var tw4 = 1; - quat4.x = tx4; - quat4.y = ty4; - quat4.z = tz4; - quat4.w = tw4; - if(_this12.sizeQuat == _this12.stackQuat.length) { - var newLength19 = _this12.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g29 = 0; - var _g119 = _this12.sizeQuat; - while(_g29 < _g119) { - var i19 = _g29++; - newArray19[i19] = _this12.stackQuat[i19]; - _this12.stackQuat[i19] = null; - } - _this12.stackQuat = newArray19; - } - _this12.stackQuat[_this12.sizeQuat++] = quat4; - } - var _this13 = this.p; - var mat35 = null; - var mat45 = null; - var quat5 = null; + let _this13 = this.p; if(v6 != null) { v6.zero(); if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newLength20 = _this13.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g30 = 0; - var _g120 = _this13.sizeVec3; - while(_g30 < _g120) { - var i20 = _g30++; - newArray20[i20] = _this13.stackVec3[i20]; - _this13.stackVec3[i20] = null; - } - _this13.stackVec3 = newArray20; + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; + } + _this13.stackVec3 = newArray; } _this13.stackVec3[_this13.sizeVec3++] = v6; } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this13.sizeMat3 == _this13.stackMat3.length) { - var newLength21 = _this13.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g31 = 0; - var _g121 = _this13.sizeMat3; - while(_g31 < _g121) { - var i21 = _g31++; - newArray21[i21] = _this13.stackMat3[i21]; - _this13.stackMat3[i21] = null; - } - _this13.stackMat3 = newArray21; - } - _this13.stackMat3[_this13.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this13.sizeMat4 == _this13.stackMat4.length) { - var newLength22 = _this13.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g32 = 0; - var _g122 = _this13.sizeMat4; - while(_g32 < _g122) { - var i22 = _g32++; - newArray22[i22] = _this13.stackMat4[i22]; - _this13.stackMat4[i22] = null; - } - _this13.stackMat4 = newArray22; - } - _this13.stackMat4[_this13.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx5 = 0; - var ty5 = 0; - var tz5 = 0; - var tw5 = 1; - quat5.x = tx5; - quat5.y = ty5; - quat5.z = tz5; - quat5.w = tw5; - if(_this13.sizeQuat == _this13.stackQuat.length) { - var newLength23 = _this13.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g33 = 0; - var _g123 = _this13.sizeQuat; - while(_g33 < _g123) { - var i23 = _g33++; - newArray23[i23] = _this13.stackQuat[i23]; - _this13.stackQuat[i23] = null; - } - _this13.stackQuat = newArray23; - } - _this13.stackQuat[_this13.sizeQuat++] = quat5; - } - var _this14 = this.p; - var mat36 = null; - var mat46 = null; - var quat6 = null; + let _this14 = this.p; if(v7 != null) { v7.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength24 = _this14.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g34 = 0; - var _g124 = _this14.sizeVec3; - while(_g34 < _g124) { - var i24 = _g34++; - newArray24[i24] = _this14.stackVec3[i24]; - _this14.stackVec3[i24] = null; - } - _this14.stackVec3 = newArray24; + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; + } + _this14.stackVec3 = newArray; } _this14.stackVec3[_this14.sizeVec3++] = v7; } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this14.sizeMat3 == _this14.stackMat3.length) { - var newLength25 = _this14.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g35 = 0; - var _g125 = _this14.sizeMat3; - while(_g35 < _g125) { - var i25 = _g35++; - newArray25[i25] = _this14.stackMat3[i25]; - _this14.stackMat3[i25] = null; - } - _this14.stackMat3 = newArray25; - } - _this14.stackMat3[_this14.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this14.sizeMat4 == _this14.stackMat4.length) { - var newLength26 = _this14.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g36 = 0; - var _g126 = _this14.sizeMat4; - while(_g36 < _g126) { - var i26 = _g36++; - newArray26[i26] = _this14.stackMat4[i26]; - _this14.stackMat4[i26] = null; - } - _this14.stackMat4 = newArray26; - } - _this14.stackMat4[_this14.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw6 = 1; - quat6.x = tx6; - quat6.y = ty6; - quat6.z = tz6; - quat6.w = tw6; - if(_this14.sizeQuat == _this14.stackQuat.length) { - var newLength27 = _this14.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g37 = 0; - var _g127 = _this14.sizeQuat; - while(_g37 < _g127) { - var i27 = _g37++; - newArray27[i27] = _this14.stackQuat[i27]; - _this14.stackQuat[i27] = null; - } - _this14.stackQuat = newArray27; - } - _this14.stackQuat[_this14.sizeQuat++] = quat6; - } - var _this15 = this.p; - var mat37 = null; - var mat47 = null; - var quat7 = null; + let _this15 = this.p; if(v8 != null) { v8.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength28 = _this15.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g38 = 0; - var _g128 = _this15.sizeVec3; - while(_g38 < _g128) { - var i28 = _g38++; - newArray28[i28] = _this15.stackVec3[i28]; - _this15.stackVec3[i28] = null; - } - _this15.stackVec3 = newArray28; + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; + } + _this15.stackVec3 = newArray; } _this15.stackVec3[_this15.sizeVec3++] = v8; } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this15.sizeMat3 == _this15.stackMat3.length) { - var newLength29 = _this15.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g39 = 0; - var _g129 = _this15.sizeMat3; - while(_g39 < _g129) { - var i29 = _g39++; - newArray29[i29] = _this15.stackMat3[i29]; - _this15.stackMat3[i29] = null; - } - _this15.stackMat3 = newArray29; - } - _this15.stackMat3[_this15.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this15.sizeMat4 == _this15.stackMat4.length) { - var newLength30 = _this15.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g40 = 0; - var _g130 = _this15.sizeMat4; - while(_g40 < _g130) { - var i30 = _g40++; - newArray30[i30] = _this15.stackMat4[i30]; - _this15.stackMat4[i30] = null; - } - _this15.stackMat4 = newArray30; - } - _this15.stackMat4[_this15.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx7 = 0; - var ty7 = 0; - var tz7 = 0; - var tw7 = 1; - quat7.x = tx7; - quat7.y = ty7; - quat7.z = tz7; - quat7.w = tw7; - if(_this15.sizeQuat == _this15.stackQuat.length) { - var newLength31 = _this15.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g41 = 0; - var _g131 = _this15.sizeQuat; - while(_g41 < _g131) { - var i31 = _g41++; - newArray31[i31] = _this15.stackQuat[i31]; - _this15.stackQuat[i31] = null; - } - _this15.stackQuat = newArray31; - } - _this15.stackQuat[_this15.sizeQuat++] = quat7; - } } basis(transform,length,colorX,colorY,colorZ) { - var _this = this.p; - var pos = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var rot = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; - var _this2 = this.p; - var ex = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var ey = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var ez = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var v = pos; + let _this = this.p; + let pos = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let rot = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + let _this2 = this.p; + let ex = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let ey = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let ez = _this4.sizeVec3 == 0 ? new oimo.common.Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let v = pos; v.x = transform._positionX; v.y = transform._positionY; v.z = transform._positionZ; - var m = rot; + let m = rot; m.e00 = transform._rotation00; m.e01 = transform._rotation01; m.e02 = transform._rotation02; @@ -27256,62 +18578,39 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { ex.init(rot.e00,rot.e10,rot.e20); ey.init(rot.e01,rot.e11,rot.e21); ez.init(rot.e02,rot.e12,rot.e22); - var tx = ex.x * length; - var ty = ex.y * length; - var tz = ex.z * length; - ex.x = tx; - ex.y = ty; - ex.z = tz; - var _this5 = ex; - var tx1 = _this5.x + pos.x; - var ty1 = _this5.y + pos.y; - var tz1 = _this5.z + pos.z; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var tx2 = ey.x * length; - var ty2 = ey.y * length; - var tz2 = ey.z * length; - ey.x = tx2; - ey.y = ty2; - ey.z = tz2; - var _this6 = ey; - var tx3 = _this6.x + pos.x; - var ty3 = _this6.y + pos.y; - var tz3 = _this6.z + pos.z; - _this6.x = tx3; - _this6.y = ty3; - _this6.z = tz3; - var tx4 = ez.x * length; - var ty4 = ez.y * length; - var tz4 = ez.z * length; - ez.x = tx4; - ez.y = ty4; - ez.z = tz4; - var _this7 = ez; - var tx5 = _this7.x + pos.x; - var ty5 = _this7.y + pos.y; - var tz5 = _this7.z + pos.z; - _this7.x = tx5; - _this7.y = ty5; - _this7.z = tz5; + ex.x *= length; + ex.y *= length; + ex.z *= length; + let _this5 = ex; + _this5.x += pos.x; + _this5.y += pos.y; + _this5.z += pos.z; + ey.x *= length; + ey.y *= length; + ey.z *= length; + let _this6 = ey; + _this6.x += pos.x; + _this6.y += pos.y; + _this6.z += pos.z; + ez.x *= length; + ez.y *= length; + ez.z *= length; + let _this7 = ez; + _this7.x += pos.x; + _this7.y += pos.y; + _this7.z += pos.z; this.line(pos,ex,colorX); this.line(pos,ey,colorY); this.line(pos,ez,colorZ); - var _this8 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this8 = this.p; if(pos != null) { pos.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newLength = _this8.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this8.sizeVec3; + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -27319,1247 +18618,237 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { } _this8.stackVec3[_this8.sizeVec3++] = pos; } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this8.sizeMat3 == _this8.stackMat3.length) { - var newLength1 = _this8.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this8.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this8.stackMat3[i1]; - _this8.stackMat3[i1] = null; - } - _this8.stackMat3 = newArray1; - } - _this8.stackMat3[_this8.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this8.sizeMat4 == _this8.stackMat4.length) { - var newLength2 = _this8.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this8.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this8.stackMat4[i2]; - _this8.stackMat4[i2] = null; - } - _this8.stackMat4 = newArray2; - } - _this8.stackMat4[_this8.sizeMat4++] = mat4; - } - if(quat != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw = 1; - quat.x = tx6; - quat.y = ty6; - quat.z = tz6; - quat.w = tw; - if(_this8.sizeQuat == _this8.stackQuat.length) { - var newLength3 = _this8.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this8.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this8.stackQuat[i3]; - _this8.stackQuat[i3] = null; - } - _this8.stackQuat = newArray3; - } - _this8.stackQuat[_this8.sizeQuat++] = quat; - } - var _this9 = this.p; - var vec3 = null; - var mat41 = null; - var quat1 = null; - if(vec3 != null) { - vec3.zero(); - if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newLength4 = _this9.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this9.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this9.stackVec3[i4]; - _this9.stackVec3[i4] = null; - } - _this9.stackVec3 = newArray4; - } - _this9.stackVec3[_this9.sizeVec3++] = vec3; - } + let _this9 = this.p; if(rot != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - rot.e00 = t002; - rot.e01 = t012; - rot.e02 = t022; - rot.e10 = t102; - rot.e11 = t112; - rot.e12 = t122; - rot.e20 = t202; - rot.e21 = t212; - rot.e22 = t222; + rot.e00 = 1; + rot.e01 = 0; + rot.e02 = 0; + rot.e10 = 0; + rot.e11 = 1; + rot.e12 = 0; + rot.e20 = 0; + rot.e21 = 0; + rot.e22 = 1; if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newLength5 = _this9.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this9.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this9.stackMat3[i5]; - _this9.stackMat3[i5] = null; - } - _this9.stackMat3 = newArray5; + let newArray = new Array(_this9.sizeMat3 << 1); + let _g = 0; + let _g1 = _this9.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackMat3[i]; + _this9.stackMat3[i] = null; + } + _this9.stackMat3 = newArray; } _this9.stackMat3[_this9.sizeMat3++] = rot; } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this9.sizeMat4 == _this9.stackMat4.length) { - var newLength6 = _this9.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this9.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this9.stackMat4[i6]; - _this9.stackMat4[i6] = null; - } - _this9.stackMat4 = newArray6; - } - _this9.stackMat4[_this9.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx7 = 0; - var ty7 = 0; - var tz7 = 0; - var tw1 = 1; - quat1.x = tx7; - quat1.y = ty7; - quat1.z = tz7; - quat1.w = tw1; - if(_this9.sizeQuat == _this9.stackQuat.length) { - var newLength7 = _this9.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this9.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this9.stackQuat[i7]; - _this9.stackQuat[i7] = null; - } - _this9.stackQuat = newArray7; - } - _this9.stackQuat[_this9.sizeQuat++] = quat1; - } - var _this10 = this.p; - var mat31 = null; - var mat42 = null; - var quat2 = null; + let _this10 = this.p; if(ex != null) { ex.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newLength8 = _this10.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this10.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this10.stackVec3[i8]; - _this10.stackVec3[i8] = null; - } - _this10.stackVec3 = newArray8; + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; + } + _this10.stackVec3 = newArray; } _this10.stackVec3[_this10.sizeVec3++] = ex; } - if(mat31 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat31.e00 = t004; - mat31.e01 = t014; - mat31.e02 = t024; - mat31.e10 = t104; - mat31.e11 = t114; - mat31.e12 = t124; - mat31.e20 = t204; - mat31.e21 = t214; - mat31.e22 = t224; - if(_this10.sizeMat3 == _this10.stackMat3.length) { - var newLength9 = _this10.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this10.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this10.stackMat3[i9]; - _this10.stackMat3[i9] = null; - } - _this10.stackMat3 = newArray9; - } - _this10.stackMat3[_this10.sizeMat3++] = mat31; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this10.sizeMat4 == _this10.stackMat4.length) { - var newLength10 = _this10.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this10.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this10.stackMat4[i10]; - _this10.stackMat4[i10] = null; - } - _this10.stackMat4 = newArray10; - } - _this10.stackMat4[_this10.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx8 = 0; - var ty8 = 0; - var tz8 = 0; - var tw2 = 1; - quat2.x = tx8; - quat2.y = ty8; - quat2.z = tz8; - quat2.w = tw2; - if(_this10.sizeQuat == _this10.stackQuat.length) { - var newLength11 = _this10.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this10.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this10.stackQuat[i11]; - _this10.stackQuat[i11] = null; - } - _this10.stackQuat = newArray11; - } - _this10.stackQuat[_this10.sizeQuat++] = quat2; - } - var _this11 = this.p; - var mat32 = null; - var mat43 = null; - var quat3 = null; + let _this11 = this.p; if(ey != null) { ey.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newLength12 = _this11.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this11.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this11.stackVec3[i12]; - _this11.stackVec3[i12] = null; - } - _this11.stackVec3 = newArray12; + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; } _this11.stackVec3[_this11.sizeVec3++] = ey; } - if(mat32 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat32.e00 = t006; - mat32.e01 = t016; - mat32.e02 = t026; - mat32.e10 = t106; - mat32.e11 = t116; - mat32.e12 = t126; - mat32.e20 = t206; - mat32.e21 = t216; - mat32.e22 = t226; - if(_this11.sizeMat3 == _this11.stackMat3.length) { - var newLength13 = _this11.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this11.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this11.stackMat3[i13]; - _this11.stackMat3[i13] = null; - } - _this11.stackMat3 = newArray13; - } - _this11.stackMat3[_this11.sizeMat3++] = mat32; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this11.sizeMat4 == _this11.stackMat4.length) { - var newLength14 = _this11.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this11.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this11.stackMat4[i14]; - _this11.stackMat4[i14] = null; - } - _this11.stackMat4 = newArray14; - } - _this11.stackMat4[_this11.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx9 = 0; - var ty9 = 0; - var tz9 = 0; - var tw3 = 1; - quat3.x = tx9; - quat3.y = ty9; - quat3.z = tz9; - quat3.w = tw3; - if(_this11.sizeQuat == _this11.stackQuat.length) { - var newLength15 = _this11.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this11.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this11.stackQuat[i15]; - _this11.stackQuat[i15] = null; - } - _this11.stackQuat = newArray15; - } - _this11.stackQuat[_this11.sizeQuat++] = quat3; - } - var _this12 = this.p; - var mat33 = null; - var mat44 = null; - var quat4 = null; + let _this12 = this.p; if(ez != null) { ez.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newLength16 = _this12.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g26 = 0; - var _g116 = _this12.sizeVec3; - while(_g26 < _g116) { - var i16 = _g26++; - newArray16[i16] = _this12.stackVec3[i16]; - _this12.stackVec3[i16] = null; - } - _this12.stackVec3 = newArray16; + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; } _this12.stackVec3[_this12.sizeVec3++] = ez; } - if(mat33 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat33.e00 = t008; - mat33.e01 = t018; - mat33.e02 = t028; - mat33.e10 = t108; - mat33.e11 = t118; - mat33.e12 = t128; - mat33.e20 = t208; - mat33.e21 = t218; - mat33.e22 = t228; - if(_this12.sizeMat3 == _this12.stackMat3.length) { - var newLength17 = _this12.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g27 = 0; - var _g117 = _this12.sizeMat3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray17[i17] = _this12.stackMat3[i17]; - _this12.stackMat3[i17] = null; - } - _this12.stackMat3 = newArray17; - } - _this12.stackMat3[_this12.sizeMat3++] = mat33; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this12.sizeMat4 == _this12.stackMat4.length) { - var newLength18 = _this12.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g28 = 0; - var _g118 = _this12.sizeMat4; - while(_g28 < _g118) { - var i18 = _g28++; - newArray18[i18] = _this12.stackMat4[i18]; - _this12.stackMat4[i18] = null; - } - _this12.stackMat4 = newArray18; - } - _this12.stackMat4[_this12.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx10 = 0; - var ty10 = 0; - var tz10 = 0; - var tw4 = 1; - quat4.x = tx10; - quat4.y = ty10; - quat4.z = tz10; - quat4.w = tw4; - if(_this12.sizeQuat == _this12.stackQuat.length) { - var newLength19 = _this12.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g29 = 0; - var _g119 = _this12.sizeQuat; - while(_g29 < _g119) { - var i19 = _g29++; - newArray19[i19] = _this12.stackQuat[i19]; - _this12.stackQuat[i19] = null; - } - _this12.stackQuat = newArray19; - } - _this12.stackQuat[_this12.sizeQuat++] = quat4; - } } ellipse(center,ex,ey,radiusX,radiusY,color) { this.arc(center,ex,ey,radiusX,radiusY,0,6.28318530717958,false,color); } arc(center,ex,ey,radiusX,radiusY,startAngle,endAngle,drawSector,color) { - var _this = this.p; - var _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = ex.x; _this1.y = ex.y; _this1.z = ex.z; - var _this2 = _this1; - var tx = _this2.x * radiusX; - var ty = _this2.y * radiusX; - var tz = _this2.z * radiusX; - _this2.x = tx; - _this2.y = ty; - _this2.z = tz; + let _this2 = _this1; + _this2.x *= radiusX; + _this2.y *= radiusX; + _this2.z *= radiusX; ex = _this2; - var _this3 = this.p; - var _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = ey.x; _this4.y = ey.y; _this4.z = ey.z; - var _this5 = _this4; - var tx1 = _this5.x * radiusY; - var ty1 = _this5.y * radiusY; - var tz1 = _this5.z * radiusY; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; + let _this5 = _this4; + _this5.x *= radiusY; + _this5.y *= radiusY; + _this5.z *= radiusY; ey = _this5; - var step = 0.523598775598298372; - var angDiff = endAngle - startAngle; + let angDiff = endAngle - startAngle; if(angDiff < 0) { angDiff = -angDiff; } - var n = angDiff / step + 0.5 | 0; + let n = angDiff / 0.52359877559829837 + 0.5 | 0; if(n == 0) { n = 1; } - var theta = startAngle; - var dt = (endAngle - startAngle) / n; - var _this6 = this.p; - var _this7 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let theta = startAngle; + let dt = (endAngle - startAngle) / n; + let _this6 = this.p; + let _this7 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; _this7.x = center.x; _this7.y = center.y; _this7.z = center.z; - var _this8 = _this7; - var s = Math.cos(theta); - var tx2 = _this8.x + ex.x * s; - var ty2 = _this8.y + ex.y * s; - var tz2 = _this8.z + ex.z * s; - _this8.x = tx2; - _this8.y = ty2; - _this8.z = tz2; - var _this9 = _this8; - var s1 = Math.sin(theta); - var tx3 = _this9.x + ey.x * s1; - var ty3 = _this9.y + ey.y * s1; - var tz3 = _this9.z + ey.z * s1; - _this9.x = tx3; - _this9.y = ty3; - _this9.z = tz3; - var v = _this9; - var prevV = v; + let _this8 = _this7; + let s = Math.cos(startAngle); + _this8.x += _this2.x * s; + _this8.y += _this2.y * s; + _this8.z += _this2.z * s; + let s1 = Math.sin(startAngle); + _this8.x += _this5.x * s1; + _this8.y += _this5.y * s1; + _this8.z += _this5.z * s1; + let prevV = _this8; if(drawSector) { - this.line(center,prevV,color); + this.line(center,_this8,color); } - var _g = 0; - var _g1 = n; + let _g = 0; + let _g1 = n; while(_g < _g1) { - var i = _g++; + ++_g; theta += dt; - var _this10 = this.p; - var _this11 = _this10.sizeVec3 == 0 ? new oimo.common.Vec3() : _this10.stackVec3[--_this10.sizeVec3]; - _this11.x = center.x; - _this11.y = center.y; - _this11.z = center.z; - var _this12 = _this11; - var s2 = Math.cos(theta); - var tx4 = _this12.x + ex.x * s2; - var ty4 = _this12.y + ex.y * s2; - var tz4 = _this12.z + ex.z * s2; - _this12.x = tx4; - _this12.y = ty4; - _this12.z = tz4; - var _this13 = _this12; - var s3 = Math.sin(theta); - var tx5 = _this13.x + ey.x * s3; - var ty5 = _this13.y + ey.y * s3; - var tz5 = _this13.z + ey.z * s3; - _this13.x = tx5; - _this13.y = ty5; - _this13.z = tz5; - var v1 = _this13; - var v2 = v1; - this.line(prevV,v2,color); - var _this14 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + let _this3 = _this1; + let s = Math.cos(theta); + _this3.x += _this2.x * s; + _this3.y += _this2.y * s; + _this3.z += _this2.z * s; + let s1 = Math.sin(theta); + _this3.x += _this5.x * s1; + _this3.y += _this5.y * s1; + _this3.z += _this5.z * s1; + this.line(prevV,_this3,color); + let _this4 = this.p; if(prevV != null) { prevV.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newLength = _this14.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g2 = 0; - var _g11 = _this14.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray[i1] = _this14.stackVec3[i1]; - _this14.stackVec3[i1] = null; - } - _this14.stackVec3 = newArray; - } - _this14.stackVec3[_this14.sizeVec3++] = prevV; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this14.sizeMat3 == _this14.stackMat3.length) { - var newLength1 = _this14.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g3 = 0; - var _g12 = _this14.sizeMat3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray1[i2] = _this14.stackMat3[i2]; - _this14.stackMat3[i2] = null; - } - _this14.stackMat3 = newArray1; - } - _this14.stackMat3[_this14.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this14.sizeMat4 == _this14.stackMat4.length) { - var newLength2 = _this14.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g4 = 0; - var _g13 = _this14.sizeMat4; - while(_g4 < _g13) { - var i3 = _g4++; - newArray2[i3] = _this14.stackMat4[i3]; - _this14.stackMat4[i3] = null; - } - _this14.stackMat4 = newArray2; - } - _this14.stackMat4[_this14.sizeMat4++] = mat4; - } - if(quat != null) { - var tx6 = 0; - var ty6 = 0; - var tz6 = 0; - var tw = 1; - quat.x = tx6; - quat.y = ty6; - quat.z = tz6; - quat.w = tw; - if(_this14.sizeQuat == _this14.stackQuat.length) { - var newLength3 = _this14.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g5 = 0; - var _g14 = _this14.sizeQuat; - while(_g5 < _g14) { - var i4 = _g5++; - newArray3[i4] = _this14.stackQuat[i4]; - _this14.stackQuat[i4] = null; + if(_this4.sizeVec3 == _this4.stackVec3.length) { + let newArray = new Array(_this4.sizeVec3 << 1); + let _g = 0; + let _g1 = _this4.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this4.stackVec3[i]; + _this4.stackVec3[i] = null; } - _this14.stackQuat = newArray3; + _this4.stackVec3 = newArray; } - _this14.stackQuat[_this14.sizeQuat++] = quat; + _this4.stackVec3[_this4.sizeVec3++] = prevV; } - prevV = v2; + prevV = _this3; } if(drawSector) { this.line(center,prevV,color); } - var _this15 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; + let _this9 = this.p; if(prevV != null) { prevV.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newLength4 = _this15.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g6 = 0; - var _g15 = _this15.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray4[i5] = _this15.stackVec3[i5]; - _this15.stackVec3[i5] = null; - } - _this15.stackVec3 = newArray4; - } - _this15.stackVec3[_this15.sizeVec3++] = prevV; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this15.sizeMat3 == _this15.stackMat3.length) { - var newLength5 = _this15.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g7 = 0; - var _g16 = _this15.sizeMat3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray5[i6] = _this15.stackMat3[i6]; - _this15.stackMat3[i6] = null; - } - _this15.stackMat3 = newArray5; - } - _this15.stackMat3[_this15.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this15.sizeMat4 == _this15.stackMat4.length) { - var newLength6 = _this15.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g8 = 0; - var _g17 = _this15.sizeMat4; - while(_g8 < _g17) { - var i7 = _g8++; - newArray6[i7] = _this15.stackMat4[i7]; - _this15.stackMat4[i7] = null; - } - _this15.stackMat4 = newArray6; - } - _this15.stackMat4[_this15.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx7 = 0; - var ty7 = 0; - var tz7 = 0; - var tw1 = 1; - quat1.x = tx7; - quat1.y = ty7; - quat1.z = tz7; - quat1.w = tw1; - if(_this15.sizeQuat == _this15.stackQuat.length) { - var newLength7 = _this15.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g9 = 0; - var _g18 = _this15.sizeQuat; - while(_g9 < _g18) { - var i8 = _g9++; - newArray7[i8] = _this15.stackQuat[i8]; - _this15.stackQuat[i8] = null; - } - _this15.stackQuat = newArray7; - } - _this15.stackQuat[_this15.sizeQuat++] = quat1; - } - var _this16 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(ex != null) { - ex.zero(); - if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newLength8 = _this16.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g10 = 0; - var _g19 = _this16.sizeVec3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray8[i9] = _this16.stackVec3[i9]; - _this16.stackVec3[i9] = null; - } - _this16.stackVec3 = newArray8; - } - _this16.stackVec3[_this16.sizeVec3++] = ex; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this16.sizeMat3 == _this16.stackMat3.length) { - var newLength9 = _this16.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g20 = 0; - var _g110 = _this16.sizeMat3; - while(_g20 < _g110) { - var i10 = _g20++; - newArray9[i10] = _this16.stackMat3[i10]; - _this16.stackMat3[i10] = null; - } - _this16.stackMat3 = newArray9; - } - _this16.stackMat3[_this16.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this16.sizeMat4 == _this16.stackMat4.length) { - var newLength10 = _this16.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g21 = 0; - var _g111 = _this16.sizeMat4; - while(_g21 < _g111) { - var i11 = _g21++; - newArray10[i11] = _this16.stackMat4[i11]; - _this16.stackMat4[i11] = null; - } - _this16.stackMat4 = newArray10; - } - _this16.stackMat4[_this16.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx8 = 0; - var ty8 = 0; - var tz8 = 0; - var tw2 = 1; - quat2.x = tx8; - quat2.y = ty8; - quat2.z = tz8; - quat2.w = tw2; - if(_this16.sizeQuat == _this16.stackQuat.length) { - var newLength11 = _this16.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g22 = 0; - var _g112 = _this16.sizeQuat; - while(_g22 < _g112) { - var i12 = _g22++; - newArray11[i12] = _this16.stackQuat[i12]; - _this16.stackQuat[i12] = null; - } - _this16.stackQuat = newArray11; - } - _this16.stackQuat[_this16.sizeQuat++] = quat2; - } - var _this17 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(ey != null) { - ey.zero(); - if(_this17.sizeVec3 == _this17.stackVec3.length) { - var newLength12 = _this17.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g23 = 0; - var _g113 = _this17.sizeVec3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray12[i13] = _this17.stackVec3[i13]; - _this17.stackVec3[i13] = null; - } - _this17.stackVec3 = newArray12; - } - _this17.stackVec3[_this17.sizeVec3++] = ey; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this17.sizeMat3 == _this17.stackMat3.length) { - var newLength13 = _this17.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g24 = 0; - var _g114 = _this17.sizeMat3; - while(_g24 < _g114) { - var i14 = _g24++; - newArray13[i14] = _this17.stackMat3[i14]; - _this17.stackMat3[i14] = null; - } - _this17.stackMat3 = newArray13; - } - _this17.stackMat3[_this17.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this17.sizeMat4 == _this17.stackMat4.length) { - var newLength14 = _this17.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g25 = 0; - var _g115 = _this17.sizeMat4; - while(_g25 < _g115) { - var i15 = _g25++; - newArray14[i15] = _this17.stackMat4[i15]; - _this17.stackMat4[i15] = null; - } - _this17.stackMat4 = newArray14; - } - _this17.stackMat4[_this17.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx9 = 0; - var ty9 = 0; - var tz9 = 0; - var tw3 = 1; - quat3.x = tx9; - quat3.y = ty9; - quat3.z = tz9; - quat3.w = tw3; - if(_this17.sizeQuat == _this17.stackQuat.length) { - var newLength15 = _this17.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g26 = 0; - var _g116 = _this17.sizeQuat; - while(_g26 < _g116) { - var i16 = _g26++; - newArray15[i16] = _this17.stackQuat[i16]; - _this17.stackQuat[i16] = null; - } - _this17.stackQuat = newArray15; - } - _this17.stackQuat[_this17.sizeQuat++] = quat3; + if(_this9.sizeVec3 == _this9.stackVec3.length) { + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; + } + _this9.stackVec3 = newArray; + } + _this9.stackVec3[_this9.sizeVec3++] = prevV; + } + let _this10 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; + } + _this10.stackVec3 = newArray; + } + _this10.stackVec3[_this10.sizeVec3++] = _this2; + } + let _this11 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this5; } } cone(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -28572,1774 +18861,379 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; - var tx = _this7.x + ey.x * halfHeight; - var ty = _this7.y + ey.y * halfHeight; - var tz = _this7.z + ey.z * halfHeight; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var top = _this7; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - var s = -halfHeight; - var tx1 = _this10.x + ey.x * s; - var ty1 = _this10.y + ey.y * s; - var tz1 = _this10.z + ey.z * s; - _this10.x = tx1; - _this10.y = ty1; - _this10.z = tz1; - var bottom = _this10; + let _this10 = _this9; + let s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = bottom.x; - _this12.y = bottom.y; - _this12.z = bottom.z; - var _this13 = _this12; - var s1 = -radius; - var tx2 = _this13.x + ex.x * s1; - var ty2 = _this13.y + ex.y * s1; - var tz2 = _this13.z + ex.z * s1; - _this13.x = tx2; - _this13.y = ty2; - _this13.z = tz2; - var _this14 = _this13; - var tx3 = _this14.x + ez.x * 0; - var ty3 = _this14.y + ez.y * 0; - var tz3 = _this14.z + ez.z * 0; - _this14.x = tx3; - _this14.y = ty3; - _this14.z = tz3; - var bottom1 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = bottom.x; - _this16.y = bottom.y; - _this16.z = bottom.z; - var _this17 = _this16; - var tx4 = _this17.x + ex.x * radius; - var ty4 = _this17.y + ex.y * radius; - var tz4 = _this17.z + ex.z * radius; - _this17.x = tx4; - _this17.y = ty4; - _this17.z = tz4; - var _this18 = _this17; - var tx5 = _this18.x + ez.x * 0; - var ty5 = _this18.y + ez.y * 0; - var tz5 = _this18.z + ez.z * 0; - _this18.x = tx5; - _this18.y = ty5; - _this18.z = tz5; - var bottom2 = _this18; - var _this19 = this.p; - var _this20 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - _this20.x = bottom.x; - _this20.y = bottom.y; - _this20.z = bottom.z; - var _this21 = _this20; - var tx6 = _this21.x + ex.x * 0; - var ty6 = _this21.y + ex.y * 0; - var tz6 = _this21.z + ex.z * 0; - _this21.x = tx6; - _this21.y = ty6; - _this21.z = tz6; - var _this22 = _this21; - var s2 = -radius; - var tx7 = _this22.x + ez.x * s2; - var ty7 = _this22.y + ez.y * s2; - var tz7 = _this22.z + ez.z * s2; - _this22.x = tx7; - _this22.y = ty7; - _this22.z = tz7; - var bottom3 = _this22; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = bottom.x; - _this24.y = bottom.y; - _this24.z = bottom.z; - var _this25 = _this24; - var tx8 = _this25.x + ex.x * 0; - var ty8 = _this25.y + ex.y * 0; - var tz8 = _this25.z + ex.z * 0; - _this25.x = tx8; - _this25.y = ty8; - _this25.z = tz8; - var _this26 = _this25; - var tx9 = _this26.x + ez.x * radius; - var ty9 = _this26.y + ez.y * radius; - var tz9 = _this26.z + ez.z * radius; - _this26.x = tx9; - _this26.y = ty9; - _this26.z = tz9; - var bottom4 = _this26; - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top,bottom1,color); - this.line(top,bottom2,color); - this.line(top,bottom3,color); - this.line(top,bottom4,color); - var _this27 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; - if(bottom1 != null) { - bottom1.zero(); - if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newLength = _this27.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this27.sizeVec3; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this10.x; + _this1.y = _this10.y; + _this1.z = _this10.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this10.x; + _this4.y = _this10.y; + _this4.z = _this10.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this10.x; + _this8.y = _this10.y; + _this8.z = _this10.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this10.x; + _this12.y = _this10.y; + _this12.z = _this10.z; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; + this.ellipse(_this10,ex,ez,radius,radius,color); + this.line(_this7,_this2,color); + this.line(_this7,_this5,color); + this.line(_this7,_this9,color); + this.line(_this7,_this13,color); + let _this14 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this27.stackVec3[i]; - _this27.stackVec3[i] = null; - } - _this27.stackVec3 = newArray; - } - _this27.stackVec3[_this27.sizeVec3++] = bottom1; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this27.sizeMat3 == _this27.stackMat3.length) { - var newLength1 = _this27.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this27.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this27.stackMat3[i1]; - _this27.stackMat3[i1] = null; + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this27.stackMat3 = newArray1; - } - _this27.stackMat3[_this27.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this27.sizeMat4 == _this27.stackMat4.length) { - var newLength2 = _this27.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this27.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this27.stackMat4[i2]; - _this27.stackMat4[i2] = null; - } - _this27.stackMat4 = newArray2; - } - _this27.stackMat4[_this27.sizeMat4++] = mat4; - } - if(quat != null) { - var tx10 = 0; - var ty10 = 0; - var tz10 = 0; - var tw = 1; - quat.x = tx10; - quat.y = ty10; - quat.z = tz10; - quat.w = tw; - if(_this27.sizeQuat == _this27.stackQuat.length) { - var newLength3 = _this27.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this27.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this27.stackQuat[i3]; - _this27.stackQuat[i3] = null; - } - _this27.stackQuat = newArray3; + _this14.stackVec3 = newArray; } - _this27.stackQuat[_this27.sizeQuat++] = quat; + _this14.stackVec3[_this14.sizeVec3++] = _this2; } - var _this28 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(bottom2 != null) { - bottom2.zero(); - if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newLength4 = _this28.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this28.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this28.stackVec3[i4]; - _this28.stackVec3[i4] = null; - } - _this28.stackVec3 = newArray4; - } - _this28.stackVec3[_this28.sizeVec3++] = bottom2; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this28.sizeMat3 == _this28.stackMat3.length) { - var newLength5 = _this28.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this28.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this28.stackMat3[i5]; - _this28.stackMat3[i5] = null; - } - _this28.stackMat3 = newArray5; - } - _this28.stackMat3[_this28.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this28.sizeMat4 == _this28.stackMat4.length) { - var newLength6 = _this28.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this28.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this28.stackMat4[i6]; - _this28.stackMat4[i6] = null; - } - _this28.stackMat4 = newArray6; - } - _this28.stackMat4[_this28.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx11 = 0; - var ty11 = 0; - var tz11 = 0; - var tw1 = 1; - quat1.x = tx11; - quat1.y = ty11; - quat1.z = tz11; - quat1.w = tw1; - if(_this28.sizeQuat == _this28.stackQuat.length) { - var newLength7 = _this28.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this28.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this28.stackQuat[i7]; - _this28.stackQuat[i7] = null; + let _this15 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this28.stackQuat = newArray7; + _this15.stackVec3 = newArray; } - _this28.stackQuat[_this28.sizeQuat++] = quat1; + _this15.stackVec3[_this15.sizeVec3++] = _this5; } - var _this29 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(bottom3 != null) { - bottom3.zero(); - if(_this29.sizeVec3 == _this29.stackVec3.length) { - var newLength8 = _this29.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this29.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this29.stackVec3[i8]; - _this29.stackVec3[i8] = null; - } - _this29.stackVec3 = newArray8; - } - _this29.stackVec3[_this29.sizeVec3++] = bottom3; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this29.sizeMat3 == _this29.stackMat3.length) { - var newLength9 = _this29.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this29.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this29.stackMat3[i9]; - _this29.stackMat3[i9] = null; - } - _this29.stackMat3 = newArray9; - } - _this29.stackMat3[_this29.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this29.sizeMat4 == _this29.stackMat4.length) { - var newLength10 = _this29.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this29.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this29.stackMat4[i10]; - _this29.stackMat4[i10] = null; - } - _this29.stackMat4 = newArray10; - } - _this29.stackMat4[_this29.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx12 = 0; - var ty12 = 0; - var tz12 = 0; - var tw2 = 1; - quat2.x = tx12; - quat2.y = ty12; - quat2.z = tz12; - quat2.w = tw2; - if(_this29.sizeQuat == _this29.stackQuat.length) { - var newLength11 = _this29.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this29.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this29.stackQuat[i11]; - _this29.stackQuat[i11] = null; + let _this16 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; } - _this29.stackQuat = newArray11; + _this16.stackVec3 = newArray; } - _this29.stackQuat[_this29.sizeQuat++] = quat2; + _this16.stackVec3[_this16.sizeVec3++] = _this9; } - var _this30 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(bottom4 != null) { - bottom4.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newLength12 = _this30.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this30.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this30.stackVec3[i12]; - _this30.stackVec3[i12] = null; - } - _this30.stackVec3 = newArray12; - } - _this30.stackVec3[_this30.sizeVec3++] = bottom4; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this30.sizeMat3 == _this30.stackMat3.length) { - var newLength13 = _this30.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this30.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this30.stackMat3[i13]; - _this30.stackMat3[i13] = null; - } - _this30.stackMat3 = newArray13; - } - _this30.stackMat3[_this30.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this30.sizeMat4 == _this30.stackMat4.length) { - var newLength14 = _this30.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this30.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this30.stackMat4[i14]; - _this30.stackMat4[i14] = null; - } - _this30.stackMat4 = newArray14; - } - _this30.stackMat4[_this30.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx13 = 0; - var ty13 = 0; - var tz13 = 0; - var tw3 = 1; - quat3.x = tx13; - quat3.y = ty13; - quat3.z = tz13; - quat3.w = tw3; - if(_this30.sizeQuat == _this30.stackQuat.length) { - var newLength15 = _this30.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this30.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this30.stackQuat[i15]; - _this30.stackQuat[i15] = null; + let _this17 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; } - _this30.stackQuat = newArray15; + _this17.stackVec3 = newArray; } - _this30.stackQuat[_this30.sizeQuat++] = quat3; + _this17.stackVec3[_this17.sizeVec3++] = _this13; } } else { - var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); - var cos = 2 * halfHeight * invDenom; - var sin = radius * invDenom; - var invDenom2 = 1 / Math.sqrt(2 * (1 + cos)); - var _g26 = 0; - while(_g26 < 8) { - var i16 = _g26++; - var _this31 = this.tmpCircleNorms[i16]; - var v1 = this.circleCoords[i16]; - _this31.x = v1.x; - _this31.y = v1.y; - _this31.z = v1.z; - var _this32 = _this31; - var tx14 = _this32.x * cos; - var ty14 = _this32.y * cos; - var tz14 = _this32.z * cos; - _this32.x = tx14; - _this32.y = ty14; - _this32.z = tz14; - _this32.y += sin; - var _this33 = this.tmpCircleNorms[i16]; - var tx15 = _this33.x * m.e00 + _this33.y * m.e01 + _this33.z * m.e02; - var ty15 = _this33.x * m.e10 + _this33.y * m.e11 + _this33.z * m.e12; - var tz15 = _this33.x * m.e20 + _this33.y * m.e21 + _this33.z * m.e22; - _this33.x = tx15; - _this33.y = ty15; - _this33.z = tz15; - var _this34 = this.tmpCircleVerts1[i16]; - var v2 = this.circleCoordsShift[i16]; - _this34.x = v2.x; - _this34.y = v2.y; - _this34.z = v2.z; - var _this35 = _this34; - var tx16 = _this35.x * cos; - var ty16 = _this35.y * cos; - var tz16 = _this35.z * cos; - _this35.x = tx16; - _this35.y = ty16; - _this35.z = tz16; - _this35.y += sin; - var _this36 = this.tmpCircleVerts1[i16]; - var tx17 = _this36.x * m.e00 + _this36.y * m.e01 + _this36.z * m.e02; - var ty17 = _this36.x * m.e10 + _this36.y * m.e11 + _this36.z * m.e12; - var tz17 = _this36.x * m.e20 + _this36.y * m.e21 + _this36.z * m.e22; - _this36.x = tx17; - _this36.y = ty17; - _this36.z = tz17; - var _this37 = this.tmpCircleVerts2[i16]; - var v3 = this.circleCoords[i16]; - _this37.x = v3.x; - _this37.y = v3.y; - _this37.z = v3.z; - var _this38 = _this37; - var tx18 = _this38.x * m.e00 + _this38.y * m.e01 + _this38.z * m.e02; - var ty18 = _this38.x * m.e10 + _this38.y * m.e11 + _this38.z * m.e12; - var tz18 = _this38.x * m.e20 + _this38.y * m.e21 + _this38.z * m.e22; - _this38.x = tx18; - _this38.y = ty18; - _this38.z = tz18; - var _this39 = _this38; - var tx19 = _this39.x * radius; - var ty19 = _this39.y * radius; - var tz19 = _this39.z * radius; - _this39.x = tx19; - _this39.y = ty19; - _this39.z = tz19; - var _this40 = _this39; - var tx20 = _this40.x + o.x; - var ty20 = _this40.y + o.y; - var tz20 = _this40.z + o.z; - _this40.x = tx20; - _this40.y = ty20; - _this40.z = tz20; - var _this41 = this.tmpCircleVerts2[i16]; - var s3 = -halfHeight; - var tx21 = _this41.x + ey.x * s3; - var ty21 = _this41.y + ey.y * s3; - var tz21 = _this41.z + ey.z * s3; - _this41.x = tx21; - _this41.y = ty21; - _this41.z = tz21; - } - var _g116 = 0; - while(_g116 < 8) { - var i17 = _g116++; - var v11 = top; - var v21 = this.tmpCircleVerts2[i17]; - var v31 = this.tmpCircleVerts2[(i17 + 1) % 8]; - var n1 = this.tmpCircleVerts1[i17]; - var n2 = this.tmpCircleNorms[i17]; - var n3 = this.tmpCircleNorms[(i17 + 1) % 8]; - this.triangle(v11,v21,v31,n1,n2,n3,color); - v11 = bottom; - v21 = this.tmpCircleVerts2[(i17 + 1) % 8]; - v31 = this.tmpCircleVerts2[i17]; - var _this42 = this.p; - var _this43 = _this42.sizeVec3 == 0 ? new oimo.common.Vec3() : _this42.stackVec3[--_this42.sizeVec3]; - _this43.x = ey.x; - _this43.y = ey.y; - _this43.z = ey.z; - var _this44 = _this43; - var tx22 = -_this44.x; - var ty22 = -_this44.y; - var tz22 = -_this44.z; - _this44.x = tx22; - _this44.y = ty22; - _this44.z = tz22; - n1 = _this44; - this.triangle(v11,v21,v31,n1,n1,n1,color); - var _this45 = this.p; - var mat34 = null; - var mat44 = null; - var quat4 = null; - if(n1 != null) { - n1.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength16 = _this45.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g27 = 0; - var _g117 = _this45.sizeVec3; - while(_g27 < _g117) { - var i18 = _g27++; - newArray16[i18] = _this45.stackVec3[i18]; - _this45.stackVec3[i18] = null; - } - _this45.stackVec3 = newArray16; - } - _this45.stackVec3[_this45.sizeVec3++] = n1; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this45.sizeMat3 == _this45.stackMat3.length) { - var newLength17 = _this45.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g28 = 0; - var _g118 = _this45.sizeMat3; - while(_g28 < _g118) { - var i19 = _g28++; - newArray17[i19] = _this45.stackMat3[i19]; - _this45.stackMat3[i19] = null; - } - _this45.stackMat3 = newArray17; - } - _this45.stackMat3[_this45.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this45.sizeMat4 == _this45.stackMat4.length) { - var newLength18 = _this45.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g29 = 0; - var _g119 = _this45.sizeMat4; - while(_g29 < _g119) { - var i20 = _g29++; - newArray18[i20] = _this45.stackMat4[i20]; - _this45.stackMat4[i20] = null; - } - _this45.stackMat4 = newArray18; - } - _this45.stackMat4[_this45.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx23 = 0; - var ty23 = 0; - var tz23 = 0; - var tw4 = 1; - quat4.x = tx23; - quat4.y = ty23; - quat4.z = tz23; - quat4.w = tw4; - if(_this45.sizeQuat == _this45.stackQuat.length) { - var newLength19 = _this45.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g30 = 0; - var _g120 = _this45.sizeQuat; - while(_g30 < _g120) { - var i21 = _g30++; - newArray19[i21] = _this45.stackQuat[i21]; - _this45.stackQuat[i21] = null; + let invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + let cos = 2 * halfHeight * invDenom; + let sin = radius * invDenom; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= cos; + _this.y *= cos; + _this.z *= cos; + _this.y += sin; + let _this1 = this.tmpCircleNorms[i]; + let y = _this1.x * m.e10 + _this1.y * m.e11 + _this1.z * m.e12; + let z = _this1.x * m.e20 + _this1.y * m.e21 + _this1.z * m.e22; + _this1.x = _this1.x * m.e00 + _this1.y * m.e01 + _this1.z * m.e02; + _this1.y = y; + _this1.z = z; + let _this2 = this.tmpCircleVerts1[i]; + let v1 = this.circleCoordsShift[i]; + _this2.x = v1.x; + _this2.y = v1.y; + _this2.z = v1.z; + _this2.x *= cos; + _this2.y *= cos; + _this2.z *= cos; + _this2.y += sin; + let _this3 = this.tmpCircleVerts1[i]; + let y1 = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; + let z1 = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; + _this3.x = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; + _this3.y = y1; + _this3.z = z1; + let _this4 = this.tmpCircleVerts2[i]; + let v2 = this.circleCoords[i]; + _this4.x = v2.x; + _this4.y = v2.y; + _this4.z = v2.z; + let y2 = _this4.x * m.e10 + _this4.y * m.e11 + _this4.z * m.e12; + let z2 = _this4.x * m.e20 + _this4.y * m.e21 + _this4.z * m.e22; + _this4.x = _this4.x * m.e00 + _this4.y * m.e01 + _this4.z * m.e02; + _this4.y = y2; + _this4.z = z2; + _this4.x *= radius; + _this4.y *= radius; + _this4.z *= radius; + _this4.x += o.x; + _this4.y += o.y; + _this4.z += o.z; + let _this5 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this5.x += ey.x * s; + _this5.y += ey.y * s; + _this5.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let v2 = this.tmpCircleVerts2[i]; + let v3 = this.tmpCircleVerts2[(i + 1) % 8]; + let n1 = this.tmpCircleVerts1[i]; + this.triangle(_this7,v2,v3,n1,this.tmpCircleNorms[i],this.tmpCircleNorms[(i + 1) % 8],color); + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ey.x; + _this1.y = ey.y; + _this1.z = ey.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); + let _this3 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this45.stackQuat = newArray19; + _this3.stackVec3 = newArray; } - _this45.stackQuat[_this45.sizeQuat++] = quat4; - } - } - } - var _this46 = this.p; - var mat35 = null; - var mat45 = null; - var quat5 = null; - if(top != null) { - top.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength20 = _this46.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g31 = 0; - var _g121 = _this46.sizeVec3; - while(_g31 < _g121) { - var i22 = _g31++; - newArray20[i22] = _this46.stackVec3[i22]; - _this46.stackVec3[i22] = null; - } - _this46.stackVec3 = newArray20; - } - _this46.stackVec3[_this46.sizeVec3++] = top; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this46.sizeMat3 == _this46.stackMat3.length) { - var newLength21 = _this46.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g32 = 0; - var _g122 = _this46.sizeMat3; - while(_g32 < _g122) { - var i23 = _g32++; - newArray21[i23] = _this46.stackMat3[i23]; - _this46.stackMat3[i23] = null; - } - _this46.stackMat3 = newArray21; - } - _this46.stackMat3[_this46.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this46.sizeMat4 == _this46.stackMat4.length) { - var newLength22 = _this46.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g33 = 0; - var _g123 = _this46.sizeMat4; - while(_g33 < _g123) { - var i24 = _g33++; - newArray22[i24] = _this46.stackMat4[i24]; - _this46.stackMat4[i24] = null; - } - _this46.stackMat4 = newArray22; - } - _this46.stackMat4[_this46.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx24 = 0; - var ty24 = 0; - var tz24 = 0; - var tw5 = 1; - quat5.x = tx24; - quat5.y = ty24; - quat5.z = tz24; - quat5.w = tw5; - if(_this46.sizeQuat == _this46.stackQuat.length) { - var newLength23 = _this46.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g34 = 0; - var _g124 = _this46.sizeQuat; - while(_g34 < _g124) { - var i25 = _g34++; - newArray23[i25] = _this46.stackQuat[i25]; - _this46.stackQuat[i25] = null; - } - _this46.stackQuat = newArray23; - } - _this46.stackQuat[_this46.sizeQuat++] = quat5; - } - var _this47 = this.p; - var mat36 = null; - var mat46 = null; - var quat6 = null; - if(bottom != null) { - bottom.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newLength24 = _this47.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g35 = 0; - var _g125 = _this47.sizeVec3; - while(_g35 < _g125) { - var i26 = _g35++; - newArray24[i26] = _this47.stackVec3[i26]; - _this47.stackVec3[i26] = null; - } - _this47.stackVec3 = newArray24; - } - _this47.stackVec3[_this47.sizeVec3++] = bottom; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this47.sizeMat3 == _this47.stackMat3.length) { - var newLength25 = _this47.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g36 = 0; - var _g126 = _this47.sizeMat3; - while(_g36 < _g126) { - var i27 = _g36++; - newArray25[i27] = _this47.stackMat3[i27]; - _this47.stackMat3[i27] = null; - } - _this47.stackMat3 = newArray25; - } - _this47.stackMat3[_this47.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this47.sizeMat4 == _this47.stackMat4.length) { - var newLength26 = _this47.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g37 = 0; - var _g127 = _this47.sizeMat4; - while(_g37 < _g127) { - var i28 = _g37++; - newArray26[i28] = _this47.stackMat4[i28]; - _this47.stackMat4[i28] = null; - } - _this47.stackMat4 = newArray26; - } - _this47.stackMat4[_this47.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx25 = 0; - var ty25 = 0; - var tz25 = 0; - var tw6 = 1; - quat6.x = tx25; - quat6.y = ty25; - quat6.z = tz25; - quat6.w = tw6; - if(_this47.sizeQuat == _this47.stackQuat.length) { - var newLength27 = _this47.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g38 = 0; - var _g128 = _this47.sizeQuat; - while(_g38 < _g128) { - var i29 = _g38++; - newArray27[i29] = _this47.stackQuat[i29]; - _this47.stackQuat[i29] = null; - } - _this47.stackQuat = newArray27; - } - _this47.stackQuat[_this47.sizeQuat++] = quat6; - } - var _this48 = this.p; - var mat37 = null; - var mat47 = null; - var quat7 = null; + _this3.stackVec3[_this3.sizeVec3++] = _this2; + } + } + } + let _this11 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this7; + } + let _this12 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = _this10; + } + let _this13 = this.p; if(o != null) { o.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newLength28 = _this48.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g39 = 0; - var _g129 = _this48.sizeVec3; - while(_g39 < _g129) { - var i30 = _g39++; - newArray28[i30] = _this48.stackVec3[i30]; - _this48.stackVec3[i30] = null; - } - _this48.stackVec3 = newArray28; - } - _this48.stackVec3[_this48.sizeVec3++] = o; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this48.sizeMat3 == _this48.stackMat3.length) { - var newLength29 = _this48.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g40 = 0; - var _g130 = _this48.sizeMat3; - while(_g40 < _g130) { - var i31 = _g40++; - newArray29[i31] = _this48.stackMat3[i31]; - _this48.stackMat3[i31] = null; - } - _this48.stackMat3 = newArray29; - } - _this48.stackMat3[_this48.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this48.sizeMat4 == _this48.stackMat4.length) { - var newLength30 = _this48.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g41 = 0; - var _g131 = _this48.sizeMat4; - while(_g41 < _g131) { - var i32 = _g41++; - newArray30[i32] = _this48.stackMat4[i32]; - _this48.stackMat4[i32] = null; - } - _this48.stackMat4 = newArray30; - } - _this48.stackMat4[_this48.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx26 = 0; - var ty26 = 0; - var tz26 = 0; - var tw7 = 1; - quat7.x = tx26; - quat7.y = ty26; - quat7.z = tz26; - quat7.w = tw7; - if(_this48.sizeQuat == _this48.stackQuat.length) { - var newLength31 = _this48.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g42 = 0; - var _g132 = _this48.sizeQuat; - while(_g42 < _g132) { - var i33 = _g42++; - newArray31[i33] = _this48.stackQuat[i33]; - _this48.stackQuat[i33] = null; - } - _this48.stackQuat = newArray31; - } - _this48.stackQuat[_this48.sizeQuat++] = quat7; - } - var _this49 = this.p; - var vec3 = null; - var mat48 = null; - var quat8 = null; - if(vec3 != null) { - vec3.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newLength32 = _this49.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g43 = 0; - var _g133 = _this49.sizeVec3; - while(_g43 < _g133) { - var i34 = _g43++; - newArray32[i34] = _this49.stackVec3[i34]; - _this49.stackVec3[i34] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this49.stackVec3 = newArray32; + _this13.stackVec3 = newArray; } - _this49.stackVec3[_this49.sizeVec3++] = vec3; + _this13.stackVec3[_this13.sizeVec3++] = o; } + let _this14 = this.p; if(m != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - m.e00 = t0016; - m.e01 = t0116; - m.e02 = t0216; - m.e10 = t1016; - m.e11 = t1116; - m.e12 = t1216; - m.e20 = t2016; - m.e21 = t2116; - m.e22 = t2216; - if(_this49.sizeMat3 == _this49.stackMat3.length) { - var newLength33 = _this49.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g44 = 0; - var _g134 = _this49.sizeMat3; - while(_g44 < _g134) { - var i35 = _g44++; - newArray33[i35] = _this49.stackMat3[i35]; - _this49.stackMat3[i35] = null; - } - _this49.stackMat3 = newArray33; - } - _this49.stackMat3[_this49.sizeMat3++] = m; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this49.sizeMat4 == _this49.stackMat4.length) { - var newLength34 = _this49.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g45 = 0; - var _g135 = _this49.sizeMat4; - while(_g45 < _g135) { - var i36 = _g45++; - newArray34[i36] = _this49.stackMat4[i36]; - _this49.stackMat4[i36] = null; - } - _this49.stackMat4 = newArray34; - } - _this49.stackMat4[_this49.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx27 = 0; - var ty27 = 0; - var tz27 = 0; - var tw8 = 1; - quat8.x = tx27; - quat8.y = ty27; - quat8.z = tz27; - quat8.w = tw8; - if(_this49.sizeQuat == _this49.stackQuat.length) { - var newLength35 = _this49.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g46 = 0; - var _g136 = _this49.sizeQuat; - while(_g46 < _g136) { - var i37 = _g46++; - newArray35[i37] = _this49.stackQuat[i37]; - _this49.stackQuat[i37] = null; - } - _this49.stackQuat = newArray35; - } - _this49.stackQuat[_this49.sizeQuat++] = quat8; - } - var _this50 = this.p; - var mat38 = null; - var mat49 = null; - var quat9 = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; + } + _this14.stackMat3 = newArray; + } + _this14.stackMat3[_this14.sizeMat3++] = m; + } + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this50.sizeVec3 == _this50.stackVec3.length) { - var newLength36 = _this50.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g47 = 0; - var _g137 = _this50.sizeVec3; - while(_g47 < _g137) { - var i38 = _g47++; - newArray36[i38] = _this50.stackVec3[i38]; - _this50.stackVec3[i38] = null; - } - _this50.stackVec3 = newArray36; - } - _this50.stackVec3[_this50.sizeVec3++] = ex; - } - if(mat38 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat38.e00 = t0018; - mat38.e01 = t0118; - mat38.e02 = t0218; - mat38.e10 = t1018; - mat38.e11 = t1118; - mat38.e12 = t1218; - mat38.e20 = t2018; - mat38.e21 = t2118; - mat38.e22 = t2218; - if(_this50.sizeMat3 == _this50.stackMat3.length) { - var newLength37 = _this50.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g48 = 0; - var _g138 = _this50.sizeMat3; - while(_g48 < _g138) { - var i39 = _g48++; - newArray37[i39] = _this50.stackMat3[i39]; - _this50.stackMat3[i39] = null; - } - _this50.stackMat3 = newArray37; - } - _this50.stackMat3[_this50.sizeMat3++] = mat38; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this50.sizeMat4 == _this50.stackMat4.length) { - var newLength38 = _this50.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g49 = 0; - var _g139 = _this50.sizeMat4; - while(_g49 < _g139) { - var i40 = _g49++; - newArray38[i40] = _this50.stackMat4[i40]; - _this50.stackMat4[i40] = null; - } - _this50.stackMat4 = newArray38; - } - _this50.stackMat4[_this50.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx28 = 0; - var ty28 = 0; - var tz28 = 0; - var tw9 = 1; - quat9.x = tx28; - quat9.y = ty28; - quat9.z = tz28; - quat9.w = tw9; - if(_this50.sizeQuat == _this50.stackQuat.length) { - var newLength39 = _this50.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g50 = 0; - var _g140 = _this50.sizeQuat; - while(_g50 < _g140) { - var i41 = _g50++; - newArray39[i41] = _this50.stackQuat[i41]; - _this50.stackQuat[i41] = null; - } - _this50.stackQuat = newArray39; - } - _this50.stackQuat[_this50.sizeQuat++] = quat9; - } - var _this51 = this.p; - var mat39 = null; - var mat410 = null; - var quat10 = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; + } + _this15.stackVec3 = newArray; + } + _this15.stackVec3[_this15.sizeVec3++] = ex; + } + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newLength40 = _this51.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g51 = 0; - var _g141 = _this51.sizeVec3; - while(_g51 < _g141) { - var i42 = _g51++; - newArray40[i42] = _this51.stackVec3[i42]; - _this51.stackVec3[i42] = null; - } - _this51.stackVec3 = newArray40; - } - _this51.stackVec3[_this51.sizeVec3++] = ey; - } - if(mat39 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat39.e00 = t0020; - mat39.e01 = t0120; - mat39.e02 = t0220; - mat39.e10 = t1020; - mat39.e11 = t1120; - mat39.e12 = t1220; - mat39.e20 = t2020; - mat39.e21 = t2120; - mat39.e22 = t2220; - if(_this51.sizeMat3 == _this51.stackMat3.length) { - var newLength41 = _this51.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g52 = 0; - var _g142 = _this51.sizeMat3; - while(_g52 < _g142) { - var i43 = _g52++; - newArray41[i43] = _this51.stackMat3[i43]; - _this51.stackMat3[i43] = null; - } - _this51.stackMat3 = newArray41; - } - _this51.stackMat3[_this51.sizeMat3++] = mat39; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this51.sizeMat4 == _this51.stackMat4.length) { - var newLength42 = _this51.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g53 = 0; - var _g143 = _this51.sizeMat4; - while(_g53 < _g143) { - var i44 = _g53++; - newArray42[i44] = _this51.stackMat4[i44]; - _this51.stackMat4[i44] = null; - } - _this51.stackMat4 = newArray42; - } - _this51.stackMat4[_this51.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx29 = 0; - var ty29 = 0; - var tz29 = 0; - var tw10 = 1; - quat10.x = tx29; - quat10.y = ty29; - quat10.z = tz29; - quat10.w = tw10; - if(_this51.sizeQuat == _this51.stackQuat.length) { - var newLength43 = _this51.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g54 = 0; - var _g144 = _this51.sizeQuat; - while(_g54 < _g144) { - var i45 = _g54++; - newArray43[i45] = _this51.stackQuat[i45]; - _this51.stackQuat[i45] = null; - } - _this51.stackQuat = newArray43; - } - _this51.stackQuat[_this51.sizeQuat++] = quat10; - } - var _this52 = this.p; - var mat310 = null; - var mat411 = null; - var quat11 = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; + } + _this16.stackVec3 = newArray; + } + _this16.stackVec3[_this16.sizeVec3++] = ey; + } + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newLength44 = _this52.sizeVec3 << 1; - var this45 = new Array(newLength44); - var newArray44 = this45; - var _g55 = 0; - var _g145 = _this52.sizeVec3; - while(_g55 < _g145) { - var i46 = _g55++; - newArray44[i46] = _this52.stackVec3[i46]; - _this52.stackVec3[i46] = null; - } - _this52.stackVec3 = newArray44; - } - _this52.stackVec3[_this52.sizeVec3++] = ez; - } - if(mat310 != null) { - var t0022 = 1; - var t0122 = 0; - var t0222 = 0; - var t1022 = 0; - var t1122 = 1; - var t1222 = 0; - var t2022 = 0; - var t2122 = 0; - var t2222 = 1; - mat310.e00 = t0022; - mat310.e01 = t0122; - mat310.e02 = t0222; - mat310.e10 = t1022; - mat310.e11 = t1122; - mat310.e12 = t1222; - mat310.e20 = t2022; - mat310.e21 = t2122; - mat310.e22 = t2222; - if(_this52.sizeMat3 == _this52.stackMat3.length) { - var newLength45 = _this52.sizeMat3 << 1; - var this46 = new Array(newLength45); - var newArray45 = this46; - var _g56 = 0; - var _g146 = _this52.sizeMat3; - while(_g56 < _g146) { - var i47 = _g56++; - newArray45[i47] = _this52.stackMat3[i47]; - _this52.stackMat3[i47] = null; - } - _this52.stackMat3 = newArray45; - } - _this52.stackMat3[_this52.sizeMat3++] = mat310; - } - if(mat411 != null) { - var t0023 = 1; - var t0123 = 0; - var t0223 = 0; - var t0311 = 0; - var t1023 = 0; - var t1123 = 1; - var t1223 = 0; - var t1311 = 0; - var t2023 = 0; - var t2123 = 0; - var t2223 = 1; - var t2311 = 0; - var t3011 = 0; - var t3111 = 0; - var t3211 = 0; - var t3311 = 1; - mat411.e00 = t0023; - mat411.e01 = t0123; - mat411.e02 = t0223; - mat411.e03 = t0311; - mat411.e10 = t1023; - mat411.e11 = t1123; - mat411.e12 = t1223; - mat411.e13 = t1311; - mat411.e20 = t2023; - mat411.e21 = t2123; - mat411.e22 = t2223; - mat411.e23 = t2311; - mat411.e30 = t3011; - mat411.e31 = t3111; - mat411.e32 = t3211; - mat411.e33 = t3311; - if(_this52.sizeMat4 == _this52.stackMat4.length) { - var newLength46 = _this52.sizeMat4 << 1; - var this47 = new Array(newLength46); - var newArray46 = this47; - var _g57 = 0; - var _g147 = _this52.sizeMat4; - while(_g57 < _g147) { - var i48 = _g57++; - newArray46[i48] = _this52.stackMat4[i48]; - _this52.stackMat4[i48] = null; - } - _this52.stackMat4 = newArray46; - } - _this52.stackMat4[_this52.sizeMat4++] = mat411; - } - if(quat11 != null) { - var tx30 = 0; - var ty30 = 0; - var tz30 = 0; - var tw11 = 1; - quat11.x = tx30; - quat11.y = ty30; - quat11.z = tz30; - quat11.w = tw11; - if(_this52.sizeQuat == _this52.stackQuat.length) { - var newLength47 = _this52.sizeQuat << 1; - var this48 = new Array(newLength47); - var newArray47 = this48; - var _g58 = 0; - var _g148 = _this52.sizeQuat; - while(_g58 < _g148) { - var i49 = _g58++; - newArray47[i49] = _this52.stackQuat[i49]; - _this52.stackQuat[i49] = null; - } - _this52.stackQuat = newArray47; - } - _this52.stackQuat[_this52.sizeQuat++] = quat11; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; } } cylinder(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -30352,2345 +19246,483 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; - var tx = _this7.x + ey.x * halfHeight; - var ty = _this7.y + ey.y * halfHeight; - var tz = _this7.z + ey.z * halfHeight; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var top = _this7; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - var s = -halfHeight; - var tx1 = _this10.x + ey.x * s; - var ty1 = _this10.y + ey.y * s; - var tz1 = _this10.z + ey.z * s; - _this10.x = tx1; - _this10.y = ty1; - _this10.z = tz1; - var bottom = _this10; + let _this10 = _this9; + let s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = top.x; - _this12.y = top.y; - _this12.z = top.z; - var _this13 = _this12; - var s1 = -radius; - var tx2 = _this13.x + ex.x * s1; - var ty2 = _this13.y + ex.y * s1; - var tz2 = _this13.z + ex.z * s1; - _this13.x = tx2; - _this13.y = ty2; - _this13.z = tz2; - var _this14 = _this13; - var tx3 = _this14.x + ez.x * 0; - var ty3 = _this14.y + ez.y * 0; - var tz3 = _this14.z + ez.z * 0; - _this14.x = tx3; - _this14.y = ty3; - _this14.z = tz3; - var top1 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = top.x; - _this16.y = top.y; - _this16.z = top.z; - var _this17 = _this16; - var tx4 = _this17.x + ex.x * radius; - var ty4 = _this17.y + ex.y * radius; - var tz4 = _this17.z + ex.z * radius; - _this17.x = tx4; - _this17.y = ty4; - _this17.z = tz4; - var _this18 = _this17; - var tx5 = _this18.x + ez.x * 0; - var ty5 = _this18.y + ez.y * 0; - var tz5 = _this18.z + ez.z * 0; - _this18.x = tx5; - _this18.y = ty5; - _this18.z = tz5; - var top2 = _this18; - var _this19 = this.p; - var _this20 = _this19.sizeVec3 == 0 ? new oimo.common.Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - _this20.x = top.x; - _this20.y = top.y; - _this20.z = top.z; - var _this21 = _this20; - var tx6 = _this21.x + ex.x * 0; - var ty6 = _this21.y + ex.y * 0; - var tz6 = _this21.z + ex.z * 0; - _this21.x = tx6; - _this21.y = ty6; - _this21.z = tz6; - var _this22 = _this21; - var s2 = -radius; - var tx7 = _this22.x + ez.x * s2; - var ty7 = _this22.y + ez.y * s2; - var tz7 = _this22.z + ez.z * s2; - _this22.x = tx7; - _this22.y = ty7; - _this22.z = tz7; - var top3 = _this22; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = top.x; - _this24.y = top.y; - _this24.z = top.z; - var _this25 = _this24; - var tx8 = _this25.x + ex.x * 0; - var ty8 = _this25.y + ex.y * 0; - var tz8 = _this25.z + ex.z * 0; - _this25.x = tx8; - _this25.y = ty8; - _this25.z = tz8; - var _this26 = _this25; - var tx9 = _this26.x + ez.x * radius; - var ty9 = _this26.y + ez.y * radius; - var tz9 = _this26.z + ez.z * radius; - _this26.x = tx9; - _this26.y = ty9; - _this26.z = tz9; - var top4 = _this26; - var _this27 = this.p; - var _this28 = _this27.sizeVec3 == 0 ? new oimo.common.Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = bottom.x; - _this28.y = bottom.y; - _this28.z = bottom.z; - var _this29 = _this28; - var s3 = -radius; - var tx10 = _this29.x + ex.x * s3; - var ty10 = _this29.y + ex.y * s3; - var tz10 = _this29.z + ex.z * s3; - _this29.x = tx10; - _this29.y = ty10; - _this29.z = tz10; - var _this30 = _this29; - var tx11 = _this30.x + ez.x * 0; - var ty11 = _this30.y + ez.y * 0; - var tz11 = _this30.z + ez.z * 0; - _this30.x = tx11; - _this30.y = ty11; - _this30.z = tz11; - var bottom1 = _this30; - var _this31 = this.p; - var _this32 = _this31.sizeVec3 == 0 ? new oimo.common.Vec3() : _this31.stackVec3[--_this31.sizeVec3]; - _this32.x = bottom.x; - _this32.y = bottom.y; - _this32.z = bottom.z; - var _this33 = _this32; - var tx12 = _this33.x + ex.x * radius; - var ty12 = _this33.y + ex.y * radius; - var tz12 = _this33.z + ex.z * radius; - _this33.x = tx12; - _this33.y = ty12; - _this33.z = tz12; - var _this34 = _this33; - var tx13 = _this34.x + ez.x * 0; - var ty13 = _this34.y + ez.y * 0; - var tz13 = _this34.z + ez.z * 0; - _this34.x = tx13; - _this34.y = ty13; - _this34.z = tz13; - var bottom2 = _this34; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo.common.Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = bottom.x; - _this36.y = bottom.y; - _this36.z = bottom.z; - var _this37 = _this36; - var tx14 = _this37.x + ex.x * 0; - var ty14 = _this37.y + ex.y * 0; - var tz14 = _this37.z + ex.z * 0; - _this37.x = tx14; - _this37.y = ty14; - _this37.z = tz14; - var _this38 = _this37; - var s4 = -radius; - var tx15 = _this38.x + ez.x * s4; - var ty15 = _this38.y + ez.y * s4; - var tz15 = _this38.z + ez.z * s4; - _this38.x = tx15; - _this38.y = ty15; - _this38.z = tz15; - var bottom3 = _this38; - var _this39 = this.p; - var _this40 = _this39.sizeVec3 == 0 ? new oimo.common.Vec3() : _this39.stackVec3[--_this39.sizeVec3]; - _this40.x = bottom.x; - _this40.y = bottom.y; - _this40.z = bottom.z; - var _this41 = _this40; - var tx16 = _this41.x + ex.x * 0; - var ty16 = _this41.y + ex.y * 0; - var tz16 = _this41.z + ex.z * 0; - _this41.x = tx16; - _this41.y = ty16; - _this41.z = tz16; - var _this42 = _this41; - var tx17 = _this42.x + ez.x * radius; - var ty17 = _this42.y + ez.y * radius; - var tz17 = _this42.z + ez.z * radius; - _this42.x = tx17; - _this42.y = ty17; - _this42.z = tz17; - var bottom4 = _this42; - this.ellipse(top,ex,ez,radius,radius,color); - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top1,bottom1,color); - this.line(top2,bottom2,color); - this.line(top3,bottom3,color); - this.line(top4,bottom4,color); - var _this43 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; - if(top1 != null) { - top1.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newLength = _this43.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this43.sizeVec3; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this7.x; + _this1.y = _this7.y; + _this1.z = _this7.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this7.x; + _this4.y = _this7.y; + _this4.z = _this7.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this7.x; + _this8.y = _this7.y; + _this8.z = _this7.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this7.x; + _this12.y = _this7.y; + _this12.z = _this7.z; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo.common.Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + let _this16 = _this15; + let s2 = -radius; + _this16.x += ex.x * s2; + _this16.y += ex.y * s2; + _this16.z += ex.z * s2; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + let _this19 = _this18; + _this19.x += ex.x * radius; + _this19.y += ex.y * radius; + _this19.z += ex.z * radius; + _this19.x += ez.x * 0; + _this19.y += ez.y * 0; + _this19.z += ez.z * 0; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + let _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + let s3 = -radius; + _this22.x += ez.x * s3; + _this22.y += ez.y * s3; + _this22.z += ez.z * s3; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; + let _this25 = _this24; + _this25.x += ex.x * 0; + _this25.y += ex.y * 0; + _this25.z += ex.z * 0; + _this25.x += ez.x * radius; + _this25.y += ez.y * radius; + _this25.z += ez.z * radius; + this.ellipse(_this7,ex,ez,radius,radius,color); + this.ellipse(_this10,ex,ez,radius,radius,color); + this.line(_this2,_this16,color); + this.line(_this5,_this19,color); + this.line(_this9,_this22,color); + this.line(_this13,_this25,color); + let _this26 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this43.stackVec3[i]; - _this43.stackVec3[i] = null; - } - _this43.stackVec3 = newArray; - } - _this43.stackVec3[_this43.sizeVec3++] = top1; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this43.sizeMat3 == _this43.stackMat3.length) { - var newLength1 = _this43.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this43.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this43.stackMat3[i1]; - _this43.stackMat3[i1] = null; - } - _this43.stackMat3 = newArray1; - } - _this43.stackMat3[_this43.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this43.sizeMat4 == _this43.stackMat4.length) { - var newLength2 = _this43.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this43.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this43.stackMat4[i2]; - _this43.stackMat4[i2] = null; - } - _this43.stackMat4 = newArray2; - } - _this43.stackMat4[_this43.sizeMat4++] = mat4; - } - if(quat != null) { - var tx18 = 0; - var ty18 = 0; - var tz18 = 0; - var tw = 1; - quat.x = tx18; - quat.y = ty18; - quat.z = tz18; - quat.w = tw; - if(_this43.sizeQuat == _this43.stackQuat.length) { - var newLength3 = _this43.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this43.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this43.stackQuat[i3]; - _this43.stackQuat[i3] = null; - } - _this43.stackQuat = newArray3; - } - _this43.stackQuat[_this43.sizeQuat++] = quat; - } - var _this44 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(top2 != null) { - top2.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newLength4 = _this44.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this44.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this44.stackVec3[i4]; - _this44.stackVec3[i4] = null; - } - _this44.stackVec3 = newArray4; - } - _this44.stackVec3[_this44.sizeVec3++] = top2; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this44.sizeMat3 == _this44.stackMat3.length) { - var newLength5 = _this44.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this44.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this44.stackMat3[i5]; - _this44.stackMat3[i5] = null; - } - _this44.stackMat3 = newArray5; - } - _this44.stackMat3[_this44.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this44.sizeMat4 == _this44.stackMat4.length) { - var newLength6 = _this44.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this44.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this44.stackMat4[i6]; - _this44.stackMat4[i6] = null; - } - _this44.stackMat4 = newArray6; - } - _this44.stackMat4[_this44.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx19 = 0; - var ty19 = 0; - var tz19 = 0; - var tw1 = 1; - quat1.x = tx19; - quat1.y = ty19; - quat1.z = tz19; - quat1.w = tw1; - if(_this44.sizeQuat == _this44.stackQuat.length) { - var newLength7 = _this44.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this44.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this44.stackQuat[i7]; - _this44.stackQuat[i7] = null; + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; } - _this44.stackQuat = newArray7; - } - _this44.stackQuat[_this44.sizeQuat++] = quat1; - } - var _this45 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(top3 != null) { - top3.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newLength8 = _this45.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this45.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this45.stackVec3[i8]; - _this45.stackVec3[i8] = null; - } - _this45.stackVec3 = newArray8; - } - _this45.stackVec3[_this45.sizeVec3++] = top3; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this45.sizeMat3 == _this45.stackMat3.length) { - var newLength9 = _this45.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this45.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this45.stackMat3[i9]; - _this45.stackMat3[i9] = null; - } - _this45.stackMat3 = newArray9; - } - _this45.stackMat3[_this45.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this45.sizeMat4 == _this45.stackMat4.length) { - var newLength10 = _this45.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this45.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this45.stackMat4[i10]; - _this45.stackMat4[i10] = null; - } - _this45.stackMat4 = newArray10; - } - _this45.stackMat4[_this45.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx20 = 0; - var ty20 = 0; - var tz20 = 0; - var tw2 = 1; - quat2.x = tx20; - quat2.y = ty20; - quat2.z = tz20; - quat2.w = tw2; - if(_this45.sizeQuat == _this45.stackQuat.length) { - var newLength11 = _this45.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this45.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this45.stackQuat[i11]; - _this45.stackQuat[i11] = null; - } - _this45.stackQuat = newArray11; - } - _this45.stackQuat[_this45.sizeQuat++] = quat2; - } - var _this46 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(top4 != null) { - top4.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newLength12 = _this46.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this46.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this46.stackVec3[i12]; - _this46.stackVec3[i12] = null; - } - _this46.stackVec3 = newArray12; - } - _this46.stackVec3[_this46.sizeVec3++] = top4; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this46.sizeMat3 == _this46.stackMat3.length) { - var newLength13 = _this46.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this46.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this46.stackMat3[i13]; - _this46.stackMat3[i13] = null; - } - _this46.stackMat3 = newArray13; - } - _this46.stackMat3[_this46.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this46.sizeMat4 == _this46.stackMat4.length) { - var newLength14 = _this46.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this46.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this46.stackMat4[i14]; - _this46.stackMat4[i14] = null; - } - _this46.stackMat4 = newArray14; - } - _this46.stackMat4[_this46.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx21 = 0; - var ty21 = 0; - var tz21 = 0; - var tw3 = 1; - quat3.x = tx21; - quat3.y = ty21; - quat3.z = tz21; - quat3.w = tw3; - if(_this46.sizeQuat == _this46.stackQuat.length) { - var newLength15 = _this46.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this46.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this46.stackQuat[i15]; - _this46.stackQuat[i15] = null; - } - _this46.stackQuat = newArray15; - } - _this46.stackQuat[_this46.sizeQuat++] = quat3; - } - var _this47 = this.p; - var mat34 = null; - var mat44 = null; - var quat4 = null; - if(bottom1 != null) { - bottom1.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newLength16 = _this47.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g26 = 0; - var _g116 = _this47.sizeVec3; - while(_g26 < _g116) { - var i16 = _g26++; - newArray16[i16] = _this47.stackVec3[i16]; - _this47.stackVec3[i16] = null; - } - _this47.stackVec3 = newArray16; - } - _this47.stackVec3[_this47.sizeVec3++] = bottom1; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this47.sizeMat3 == _this47.stackMat3.length) { - var newLength17 = _this47.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g27 = 0; - var _g117 = _this47.sizeMat3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray17[i17] = _this47.stackMat3[i17]; - _this47.stackMat3[i17] = null; - } - _this47.stackMat3 = newArray17; - } - _this47.stackMat3[_this47.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this47.sizeMat4 == _this47.stackMat4.length) { - var newLength18 = _this47.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g28 = 0; - var _g118 = _this47.sizeMat4; - while(_g28 < _g118) { - var i18 = _g28++; - newArray18[i18] = _this47.stackMat4[i18]; - _this47.stackMat4[i18] = null; - } - _this47.stackMat4 = newArray18; - } - _this47.stackMat4[_this47.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx22 = 0; - var ty22 = 0; - var tz22 = 0; - var tw4 = 1; - quat4.x = tx22; - quat4.y = ty22; - quat4.z = tz22; - quat4.w = tw4; - if(_this47.sizeQuat == _this47.stackQuat.length) { - var newLength19 = _this47.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g29 = 0; - var _g119 = _this47.sizeQuat; - while(_g29 < _g119) { - var i19 = _g29++; - newArray19[i19] = _this47.stackQuat[i19]; - _this47.stackQuat[i19] = null; - } - _this47.stackQuat = newArray19; - } - _this47.stackQuat[_this47.sizeQuat++] = quat4; - } - var _this48 = this.p; - var mat35 = null; - var mat45 = null; - var quat5 = null; - if(bottom2 != null) { - bottom2.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newLength20 = _this48.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g30 = 0; - var _g120 = _this48.sizeVec3; - while(_g30 < _g120) { - var i20 = _g30++; - newArray20[i20] = _this48.stackVec3[i20]; - _this48.stackVec3[i20] = null; - } - _this48.stackVec3 = newArray20; - } - _this48.stackVec3[_this48.sizeVec3++] = bottom2; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this48.sizeMat3 == _this48.stackMat3.length) { - var newLength21 = _this48.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g31 = 0; - var _g121 = _this48.sizeMat3; - while(_g31 < _g121) { - var i21 = _g31++; - newArray21[i21] = _this48.stackMat3[i21]; - _this48.stackMat3[i21] = null; - } - _this48.stackMat3 = newArray21; - } - _this48.stackMat3[_this48.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this48.sizeMat4 == _this48.stackMat4.length) { - var newLength22 = _this48.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g32 = 0; - var _g122 = _this48.sizeMat4; - while(_g32 < _g122) { - var i22 = _g32++; - newArray22[i22] = _this48.stackMat4[i22]; - _this48.stackMat4[i22] = null; - } - _this48.stackMat4 = newArray22; - } - _this48.stackMat4[_this48.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx23 = 0; - var ty23 = 0; - var tz23 = 0; - var tw5 = 1; - quat5.x = tx23; - quat5.y = ty23; - quat5.z = tz23; - quat5.w = tw5; - if(_this48.sizeQuat == _this48.stackQuat.length) { - var newLength23 = _this48.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g33 = 0; - var _g123 = _this48.sizeQuat; - while(_g33 < _g123) { - var i23 = _g33++; - newArray23[i23] = _this48.stackQuat[i23]; - _this48.stackQuat[i23] = null; - } - _this48.stackQuat = newArray23; - } - _this48.stackQuat[_this48.sizeQuat++] = quat5; - } - var _this49 = this.p; - var mat36 = null; - var mat46 = null; - var quat6 = null; - if(bottom3 != null) { - bottom3.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newLength24 = _this49.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g34 = 0; - var _g124 = _this49.sizeVec3; - while(_g34 < _g124) { - var i24 = _g34++; - newArray24[i24] = _this49.stackVec3[i24]; - _this49.stackVec3[i24] = null; - } - _this49.stackVec3 = newArray24; - } - _this49.stackVec3[_this49.sizeVec3++] = bottom3; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this49.sizeMat3 == _this49.stackMat3.length) { - var newLength25 = _this49.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g35 = 0; - var _g125 = _this49.sizeMat3; - while(_g35 < _g125) { - var i25 = _g35++; - newArray25[i25] = _this49.stackMat3[i25]; - _this49.stackMat3[i25] = null; + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this2; + } + let _this27 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; } - _this49.stackMat3 = newArray25; - } - _this49.stackMat3[_this49.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this49.sizeMat4 == _this49.stackMat4.length) { - var newLength26 = _this49.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g36 = 0; - var _g126 = _this49.sizeMat4; - while(_g36 < _g126) { - var i26 = _g36++; - newArray26[i26] = _this49.stackMat4[i26]; - _this49.stackMat4[i26] = null; + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = _this5; + } + let _this28 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; } - _this49.stackMat4 = newArray26; - } - _this49.stackMat4[_this49.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx24 = 0; - var ty24 = 0; - var tz24 = 0; - var tw6 = 1; - quat6.x = tx24; - quat6.y = ty24; - quat6.z = tz24; - quat6.w = tw6; - if(_this49.sizeQuat == _this49.stackQuat.length) { - var newLength27 = _this49.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g37 = 0; - var _g127 = _this49.sizeQuat; - while(_g37 < _g127) { - var i27 = _g37++; - newArray27[i27] = _this49.stackQuat[i27]; - _this49.stackQuat[i27] = null; + _this28.stackVec3 = newArray; + } + _this28.stackVec3[_this28.sizeVec3++] = _this9; + } + let _this29 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this49.stackQuat = newArray27; - } - _this49.stackQuat[_this49.sizeQuat++] = quat6; - } - var _this50 = this.p; - var mat37 = null; - var mat47 = null; - var quat7 = null; - if(bottom4 != null) { - bottom4.zero(); - if(_this50.sizeVec3 == _this50.stackVec3.length) { - var newLength28 = _this50.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g38 = 0; - var _g128 = _this50.sizeVec3; - while(_g38 < _g128) { - var i28 = _g38++; - newArray28[i28] = _this50.stackVec3[i28]; - _this50.stackVec3[i28] = null; + _this29.stackVec3 = newArray; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + let _this30 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this50.stackVec3 = newArray28; - } - _this50.stackVec3[_this50.sizeVec3++] = bottom4; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this50.sizeMat3 == _this50.stackMat3.length) { - var newLength29 = _this50.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g39 = 0; - var _g129 = _this50.sizeMat3; - while(_g39 < _g129) { - var i29 = _g39++; - newArray29[i29] = _this50.stackMat3[i29]; - _this50.stackMat3[i29] = null; + _this30.stackVec3 = newArray; + } + _this30.stackVec3[_this30.sizeVec3++] = _this16; + } + let _this31 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this50.stackMat3 = newArray29; - } - _this50.stackMat3[_this50.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this50.sizeMat4 == _this50.stackMat4.length) { - var newLength30 = _this50.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g40 = 0; - var _g130 = _this50.sizeMat4; - while(_g40 < _g130) { - var i30 = _g40++; - newArray30[i30] = _this50.stackMat4[i30]; - _this50.stackMat4[i30] = null; + _this31.stackVec3 = newArray; + } + _this31.stackVec3[_this31.sizeVec3++] = _this19; + } + let _this32 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this50.stackMat4 = newArray30; - } - _this50.stackMat4[_this50.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx25 = 0; - var ty25 = 0; - var tz25 = 0; - var tw7 = 1; - quat7.x = tx25; - quat7.y = ty25; - quat7.z = tz25; - quat7.w = tw7; - if(_this50.sizeQuat == _this50.stackQuat.length) { - var newLength31 = _this50.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g41 = 0; - var _g131 = _this50.sizeQuat; - while(_g41 < _g131) { - var i31 = _g41++; - newArray31[i31] = _this50.stackQuat[i31]; - _this50.stackQuat[i31] = null; + _this32.stackVec3 = newArray; + } + _this32.stackVec3[_this32.sizeVec3++] = _this22; + } + let _this33 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this50.stackQuat = newArray31; + _this33.stackVec3 = newArray; } - _this50.stackQuat[_this50.sizeQuat++] = quat7; + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } else { - var _g42 = 0; - while(_g42 < 8) { - var i32 = _g42++; - var _this51 = this.tmpCircleNorms[i32]; - var v1 = this.circleCoords[i32]; - _this51.x = v1.x; - _this51.y = v1.y; - _this51.z = v1.z; - var _this52 = _this51; - var tx26 = _this52.x * m.e00 + _this52.y * m.e01 + _this52.z * m.e02; - var ty26 = _this52.x * m.e10 + _this52.y * m.e11 + _this52.z * m.e12; - var tz26 = _this52.x * m.e20 + _this52.y * m.e21 + _this52.z * m.e22; - _this52.x = tx26; - _this52.y = ty26; - _this52.z = tz26; - var _this53 = this.tmpCircleVerts1[i32]; - var v2 = this.tmpCircleNorms[i32]; - _this53.x = v2.x; - _this53.y = v2.y; - _this53.z = v2.z; - var _this54 = _this53; - var tx27 = _this54.x * radius; - var ty27 = _this54.y * radius; - var tz27 = _this54.z * radius; - _this54.x = tx27; - _this54.y = ty27; - _this54.z = tz27; - var _this55 = _this54; - var tx28 = _this55.x + o.x; - var ty28 = _this55.y + o.y; - var tz28 = _this55.z + o.z; - _this55.x = tx28; - _this55.y = ty28; - _this55.z = tz28; - var _this56 = this.tmpCircleVerts2[i32]; - var v3 = this.tmpCircleVerts1[i32]; - _this56.x = v3.x; - _this56.y = v3.y; - _this56.z = v3.z; - var _this57 = this.tmpCircleVerts1[i32]; - var tx29 = _this57.x + ey.x * halfHeight; - var ty29 = _this57.y + ey.y * halfHeight; - var tz29 = _this57.z + ey.z * halfHeight; - _this57.x = tx29; - _this57.y = ty29; - _this57.z = tz29; - var _this58 = this.tmpCircleVerts2[i32]; - var s5 = -halfHeight; - var tx30 = _this58.x + ey.x * s5; - var ty30 = _this58.y + ey.y * s5; - var tz30 = _this58.z + ey.z * s5; - _this58.x = tx30; - _this58.y = ty30; - _this58.z = tz30; - } - var _g132 = 0; - while(_g132 < 8) { - var i33 = _g132++; - var n3; - var n4; - var v11 = top; - var v21 = this.tmpCircleVerts1[i33]; - var v31 = this.tmpCircleVerts1[(i33 + 1) % 8]; - var n1 = ey; - this.triangle(v11,v21,v31,n1,n1,n1,color); - v11 = bottom; - v21 = this.tmpCircleVerts2[(i33 + 1) % 8]; - v31 = this.tmpCircleVerts2[i33]; - var _this59 = this.p; - var _this60 = _this59.sizeVec3 == 0 ? new oimo.common.Vec3() : _this59.stackVec3[--_this59.sizeVec3]; - _this60.x = ey.x; - _this60.y = ey.y; - _this60.z = ey.z; - var _this61 = _this60; - var tx31 = -_this61.x; - var ty31 = -_this61.y; - var tz31 = -_this61.z; - _this61.x = tx31; - _this61.y = ty31; - _this61.z = tz31; - n1 = _this61; - this.triangle(v11,v21,v31,n1,n1,n1,color); - var _this62 = this.p; - var mat38 = null; - var mat48 = null; - var quat8 = null; - if(n1 != null) { - n1.zero(); - if(_this62.sizeVec3 == _this62.stackVec3.length) { - var newLength32 = _this62.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g43 = 0; - var _g133 = _this62.sizeVec3; - while(_g43 < _g133) { - var i34 = _g43++; - newArray32[i34] = _this62.stackVec3[i34]; - _this62.stackVec3[i34] = null; - } - _this62.stackVec3 = newArray32; - } - _this62.stackVec3[_this62.sizeVec3++] = n1; - } - if(mat38 != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - mat38.e00 = t0016; - mat38.e01 = t0116; - mat38.e02 = t0216; - mat38.e10 = t1016; - mat38.e11 = t1116; - mat38.e12 = t1216; - mat38.e20 = t2016; - mat38.e21 = t2116; - mat38.e22 = t2216; - if(_this62.sizeMat3 == _this62.stackMat3.length) { - var newLength33 = _this62.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g44 = 0; - var _g134 = _this62.sizeMat3; - while(_g44 < _g134) { - var i35 = _g44++; - newArray33[i35] = _this62.stackMat3[i35]; - _this62.stackMat3[i35] = null; - } - _this62.stackMat3 = newArray33; - } - _this62.stackMat3[_this62.sizeMat3++] = mat38; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this62.sizeMat4 == _this62.stackMat4.length) { - var newLength34 = _this62.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g45 = 0; - var _g135 = _this62.sizeMat4; - while(_g45 < _g135) { - var i36 = _g45++; - newArray34[i36] = _this62.stackMat4[i36]; - _this62.stackMat4[i36] = null; - } - _this62.stackMat4 = newArray34; - } - _this62.stackMat4[_this62.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx32 = 0; - var ty32 = 0; - var tz32 = 0; - var tw8 = 1; - quat8.x = tx32; - quat8.y = ty32; - quat8.z = tz32; - quat8.w = tw8; - if(_this62.sizeQuat == _this62.stackQuat.length) { - var newLength35 = _this62.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g46 = 0; - var _g136 = _this62.sizeQuat; - while(_g46 < _g136) { - var i37 = _g46++; - newArray35[i37] = _this62.stackQuat[i37]; - _this62.stackQuat[i37] = null; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = this.tmpCircleVerts1[i]; + let v1 = this.tmpCircleNorms[i]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + let _this2 = this.tmpCircleVerts2[i]; + let v2 = this.tmpCircleVerts1[i]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + let _this3 = this.tmpCircleVerts1[i]; + _this3.x += ey.x * halfHeight; + _this3.y += ey.y * halfHeight; + _this3.z += ey.z * halfHeight; + let _this4 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this4.x += ey.x * s; + _this4.y += ey.y * s; + _this4.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let v1 = _this7; + let v2 = this.tmpCircleVerts1[i]; + let v3 = this.tmpCircleVerts1[(i + 1) % 8]; + let n1 = ey; + this.triangle(_this7,v2,v3,n1,n1,n1,color); + v1 = _this10; + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ey.x; + _this1.y = ey.y; + _this1.z = ey.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); + let _this3 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this62.stackQuat = newArray35; + _this3.stackVec3 = newArray; } - _this62.stackQuat[_this62.sizeQuat++] = quat8; - } - v11 = this.tmpCircleVerts1[i33]; - v21 = this.tmpCircleVerts2[i33]; - v31 = this.tmpCircleVerts2[(i33 + 1) % 8]; - var v4 = this.tmpCircleVerts1[(i33 + 1) % 8]; - n1 = this.tmpCircleNorms[i33]; - var n2 = this.tmpCircleNorms[(i33 + 1) % 8]; - this.rect(v11,v21,v31,v4,n1,n1,n2,n2,color); - } - } - var _this63 = this.p; - var mat39 = null; - var mat49 = null; - var quat9 = null; - if(top != null) { - top.zero(); - if(_this63.sizeVec3 == _this63.stackVec3.length) { - var newLength36 = _this63.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g47 = 0; - var _g137 = _this63.sizeVec3; - while(_g47 < _g137) { - var i38 = _g47++; - newArray36[i38] = _this63.stackVec3[i38]; - _this63.stackVec3[i38] = null; - } - _this63.stackVec3 = newArray36; - } - _this63.stackVec3[_this63.sizeVec3++] = top; - } - if(mat39 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat39.e00 = t0018; - mat39.e01 = t0118; - mat39.e02 = t0218; - mat39.e10 = t1018; - mat39.e11 = t1118; - mat39.e12 = t1218; - mat39.e20 = t2018; - mat39.e21 = t2118; - mat39.e22 = t2218; - if(_this63.sizeMat3 == _this63.stackMat3.length) { - var newLength37 = _this63.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g48 = 0; - var _g138 = _this63.sizeMat3; - while(_g48 < _g138) { - var i39 = _g48++; - newArray37[i39] = _this63.stackMat3[i39]; - _this63.stackMat3[i39] = null; - } - _this63.stackMat3 = newArray37; - } - _this63.stackMat3[_this63.sizeMat3++] = mat39; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this63.sizeMat4 == _this63.stackMat4.length) { - var newLength38 = _this63.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g49 = 0; - var _g139 = _this63.sizeMat4; - while(_g49 < _g139) { - var i40 = _g49++; - newArray38[i40] = _this63.stackMat4[i40]; - _this63.stackMat4[i40] = null; - } - _this63.stackMat4 = newArray38; - } - _this63.stackMat4[_this63.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx33 = 0; - var ty33 = 0; - var tz33 = 0; - var tw9 = 1; - quat9.x = tx33; - quat9.y = ty33; - quat9.z = tz33; - quat9.w = tw9; - if(_this63.sizeQuat == _this63.stackQuat.length) { - var newLength39 = _this63.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g50 = 0; - var _g140 = _this63.sizeQuat; - while(_g50 < _g140) { - var i41 = _g50++; - newArray39[i41] = _this63.stackQuat[i41]; - _this63.stackQuat[i41] = null; - } - _this63.stackQuat = newArray39; - } - _this63.stackQuat[_this63.sizeQuat++] = quat9; - } - var _this64 = this.p; - var mat310 = null; - var mat410 = null; - var quat10 = null; - if(bottom != null) { - bottom.zero(); - if(_this64.sizeVec3 == _this64.stackVec3.length) { - var newLength40 = _this64.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g51 = 0; - var _g141 = _this64.sizeVec3; - while(_g51 < _g141) { - var i42 = _g51++; - newArray40[i42] = _this64.stackVec3[i42]; - _this64.stackVec3[i42] = null; - } - _this64.stackVec3 = newArray40; - } - _this64.stackVec3[_this64.sizeVec3++] = bottom; - } - if(mat310 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat310.e00 = t0020; - mat310.e01 = t0120; - mat310.e02 = t0220; - mat310.e10 = t1020; - mat310.e11 = t1120; - mat310.e12 = t1220; - mat310.e20 = t2020; - mat310.e21 = t2120; - mat310.e22 = t2220; - if(_this64.sizeMat3 == _this64.stackMat3.length) { - var newLength41 = _this64.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g52 = 0; - var _g142 = _this64.sizeMat3; - while(_g52 < _g142) { - var i43 = _g52++; - newArray41[i43] = _this64.stackMat3[i43]; - _this64.stackMat3[i43] = null; - } - _this64.stackMat3 = newArray41; - } - _this64.stackMat3[_this64.sizeMat3++] = mat310; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this64.sizeMat4 == _this64.stackMat4.length) { - var newLength42 = _this64.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g53 = 0; - var _g143 = _this64.sizeMat4; - while(_g53 < _g143) { - var i44 = _g53++; - newArray42[i44] = _this64.stackMat4[i44]; - _this64.stackMat4[i44] = null; - } - _this64.stackMat4 = newArray42; - } - _this64.stackMat4[_this64.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx34 = 0; - var ty34 = 0; - var tz34 = 0; - var tw10 = 1; - quat10.x = tx34; - quat10.y = ty34; - quat10.z = tz34; - quat10.w = tw10; - if(_this64.sizeQuat == _this64.stackQuat.length) { - var newLength43 = _this64.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g54 = 0; - var _g144 = _this64.sizeQuat; - while(_g54 < _g144) { - var i45 = _g54++; - newArray43[i45] = _this64.stackQuat[i45]; - _this64.stackQuat[i45] = null; - } - _this64.stackQuat = newArray43; - } - _this64.stackQuat[_this64.sizeQuat++] = quat10; - } - var _this65 = this.p; - var mat311 = null; - var mat411 = null; - var quat11 = null; + _this3.stackVec3[_this3.sizeVec3++] = _this2; + } + v1 = this.tmpCircleVerts1[i]; + v2 = this.tmpCircleVerts2[i]; + v3 = this.tmpCircleVerts2[(i + 1) % 8]; + n1 = this.tmpCircleNorms[i]; + let n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(v1,v2,v3,this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); + } + } + let _this11 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this7; + } + let _this12 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = _this10; + } + let _this13 = this.p; if(o != null) { o.zero(); - if(_this65.sizeVec3 == _this65.stackVec3.length) { - var newLength44 = _this65.sizeVec3 << 1; - var this45 = new Array(newLength44); - var newArray44 = this45; - var _g55 = 0; - var _g145 = _this65.sizeVec3; - while(_g55 < _g145) { - var i46 = _g55++; - newArray44[i46] = _this65.stackVec3[i46]; - _this65.stackVec3[i46] = null; - } - _this65.stackVec3 = newArray44; - } - _this65.stackVec3[_this65.sizeVec3++] = o; - } - if(mat311 != null) { - var t0022 = 1; - var t0122 = 0; - var t0222 = 0; - var t1022 = 0; - var t1122 = 1; - var t1222 = 0; - var t2022 = 0; - var t2122 = 0; - var t2222 = 1; - mat311.e00 = t0022; - mat311.e01 = t0122; - mat311.e02 = t0222; - mat311.e10 = t1022; - mat311.e11 = t1122; - mat311.e12 = t1222; - mat311.e20 = t2022; - mat311.e21 = t2122; - mat311.e22 = t2222; - if(_this65.sizeMat3 == _this65.stackMat3.length) { - var newLength45 = _this65.sizeMat3 << 1; - var this46 = new Array(newLength45); - var newArray45 = this46; - var _g56 = 0; - var _g146 = _this65.sizeMat3; - while(_g56 < _g146) { - var i47 = _g56++; - newArray45[i47] = _this65.stackMat3[i47]; - _this65.stackMat3[i47] = null; - } - _this65.stackMat3 = newArray45; - } - _this65.stackMat3[_this65.sizeMat3++] = mat311; - } - if(mat411 != null) { - var t0023 = 1; - var t0123 = 0; - var t0223 = 0; - var t0311 = 0; - var t1023 = 0; - var t1123 = 1; - var t1223 = 0; - var t1311 = 0; - var t2023 = 0; - var t2123 = 0; - var t2223 = 1; - var t2311 = 0; - var t3011 = 0; - var t3111 = 0; - var t3211 = 0; - var t3311 = 1; - mat411.e00 = t0023; - mat411.e01 = t0123; - mat411.e02 = t0223; - mat411.e03 = t0311; - mat411.e10 = t1023; - mat411.e11 = t1123; - mat411.e12 = t1223; - mat411.e13 = t1311; - mat411.e20 = t2023; - mat411.e21 = t2123; - mat411.e22 = t2223; - mat411.e23 = t2311; - mat411.e30 = t3011; - mat411.e31 = t3111; - mat411.e32 = t3211; - mat411.e33 = t3311; - if(_this65.sizeMat4 == _this65.stackMat4.length) { - var newLength46 = _this65.sizeMat4 << 1; - var this47 = new Array(newLength46); - var newArray46 = this47; - var _g57 = 0; - var _g147 = _this65.sizeMat4; - while(_g57 < _g147) { - var i48 = _g57++; - newArray46[i48] = _this65.stackMat4[i48]; - _this65.stackMat4[i48] = null; - } - _this65.stackMat4 = newArray46; - } - _this65.stackMat4[_this65.sizeMat4++] = mat411; - } - if(quat11 != null) { - var tx35 = 0; - var ty35 = 0; - var tz35 = 0; - var tw11 = 1; - quat11.x = tx35; - quat11.y = ty35; - quat11.z = tz35; - quat11.w = tw11; - if(_this65.sizeQuat == _this65.stackQuat.length) { - var newLength47 = _this65.sizeQuat << 1; - var this48 = new Array(newLength47); - var newArray47 = this48; - var _g58 = 0; - var _g148 = _this65.sizeQuat; - while(_g58 < _g148) { - var i49 = _g58++; - newArray47[i49] = _this65.stackQuat[i49]; - _this65.stackQuat[i49] = null; - } - _this65.stackQuat = newArray47; - } - _this65.stackQuat[_this65.sizeQuat++] = quat11; - } - var _this66 = this.p; - var vec3 = null; - var mat412 = null; - var quat12 = null; - if(vec3 != null) { - vec3.zero(); - if(_this66.sizeVec3 == _this66.stackVec3.length) { - var newLength48 = _this66.sizeVec3 << 1; - var this49 = new Array(newLength48); - var newArray48 = this49; - var _g59 = 0; - var _g149 = _this66.sizeVec3; - while(_g59 < _g149) { - var i50 = _g59++; - newArray48[i50] = _this66.stackVec3[i50]; - _this66.stackVec3[i50] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this66.stackVec3 = newArray48; + _this13.stackVec3 = newArray; } - _this66.stackVec3[_this66.sizeVec3++] = vec3; + _this13.stackVec3[_this13.sizeVec3++] = o; } + let _this14 = this.p; if(m != null) { - var t0024 = 1; - var t0124 = 0; - var t0224 = 0; - var t1024 = 0; - var t1124 = 1; - var t1224 = 0; - var t2024 = 0; - var t2124 = 0; - var t2224 = 1; - m.e00 = t0024; - m.e01 = t0124; - m.e02 = t0224; - m.e10 = t1024; - m.e11 = t1124; - m.e12 = t1224; - m.e20 = t2024; - m.e21 = t2124; - m.e22 = t2224; - if(_this66.sizeMat3 == _this66.stackMat3.length) { - var newLength49 = _this66.sizeMat3 << 1; - var this50 = new Array(newLength49); - var newArray49 = this50; - var _g60 = 0; - var _g150 = _this66.sizeMat3; - while(_g60 < _g150) { - var i51 = _g60++; - newArray49[i51] = _this66.stackMat3[i51]; - _this66.stackMat3[i51] = null; - } - _this66.stackMat3 = newArray49; - } - _this66.stackMat3[_this66.sizeMat3++] = m; - } - if(mat412 != null) { - var t0025 = 1; - var t0125 = 0; - var t0225 = 0; - var t0312 = 0; - var t1025 = 0; - var t1125 = 1; - var t1225 = 0; - var t1312 = 0; - var t2025 = 0; - var t2125 = 0; - var t2225 = 1; - var t2312 = 0; - var t3012 = 0; - var t3112 = 0; - var t3212 = 0; - var t3312 = 1; - mat412.e00 = t0025; - mat412.e01 = t0125; - mat412.e02 = t0225; - mat412.e03 = t0312; - mat412.e10 = t1025; - mat412.e11 = t1125; - mat412.e12 = t1225; - mat412.e13 = t1312; - mat412.e20 = t2025; - mat412.e21 = t2125; - mat412.e22 = t2225; - mat412.e23 = t2312; - mat412.e30 = t3012; - mat412.e31 = t3112; - mat412.e32 = t3212; - mat412.e33 = t3312; - if(_this66.sizeMat4 == _this66.stackMat4.length) { - var newLength50 = _this66.sizeMat4 << 1; - var this51 = new Array(newLength50); - var newArray50 = this51; - var _g61 = 0; - var _g151 = _this66.sizeMat4; - while(_g61 < _g151) { - var i52 = _g61++; - newArray50[i52] = _this66.stackMat4[i52]; - _this66.stackMat4[i52] = null; - } - _this66.stackMat4 = newArray50; - } - _this66.stackMat4[_this66.sizeMat4++] = mat412; - } - if(quat12 != null) { - var tx36 = 0; - var ty36 = 0; - var tz36 = 0; - var tw12 = 1; - quat12.x = tx36; - quat12.y = ty36; - quat12.z = tz36; - quat12.w = tw12; - if(_this66.sizeQuat == _this66.stackQuat.length) { - var newLength51 = _this66.sizeQuat << 1; - var this52 = new Array(newLength51); - var newArray51 = this52; - var _g62 = 0; - var _g152 = _this66.sizeQuat; - while(_g62 < _g152) { - var i53 = _g62++; - newArray51[i53] = _this66.stackQuat[i53]; - _this66.stackQuat[i53] = null; - } - _this66.stackQuat = newArray51; - } - _this66.stackQuat[_this66.sizeQuat++] = quat12; - } - var _this67 = this.p; - var mat312 = null; - var mat413 = null; - var quat13 = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; + } + _this14.stackMat3 = newArray; + } + _this14.stackMat3[_this14.sizeMat3++] = m; + } + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this67.sizeVec3 == _this67.stackVec3.length) { - var newLength52 = _this67.sizeVec3 << 1; - var this53 = new Array(newLength52); - var newArray52 = this53; - var _g63 = 0; - var _g153 = _this67.sizeVec3; - while(_g63 < _g153) { - var i54 = _g63++; - newArray52[i54] = _this67.stackVec3[i54]; - _this67.stackVec3[i54] = null; - } - _this67.stackVec3 = newArray52; - } - _this67.stackVec3[_this67.sizeVec3++] = ex; - } - if(mat312 != null) { - var t0026 = 1; - var t0126 = 0; - var t0226 = 0; - var t1026 = 0; - var t1126 = 1; - var t1226 = 0; - var t2026 = 0; - var t2126 = 0; - var t2226 = 1; - mat312.e00 = t0026; - mat312.e01 = t0126; - mat312.e02 = t0226; - mat312.e10 = t1026; - mat312.e11 = t1126; - mat312.e12 = t1226; - mat312.e20 = t2026; - mat312.e21 = t2126; - mat312.e22 = t2226; - if(_this67.sizeMat3 == _this67.stackMat3.length) { - var newLength53 = _this67.sizeMat3 << 1; - var this54 = new Array(newLength53); - var newArray53 = this54; - var _g64 = 0; - var _g154 = _this67.sizeMat3; - while(_g64 < _g154) { - var i55 = _g64++; - newArray53[i55] = _this67.stackMat3[i55]; - _this67.stackMat3[i55] = null; - } - _this67.stackMat3 = newArray53; - } - _this67.stackMat3[_this67.sizeMat3++] = mat312; - } - if(mat413 != null) { - var t0027 = 1; - var t0127 = 0; - var t0227 = 0; - var t0313 = 0; - var t1027 = 0; - var t1127 = 1; - var t1227 = 0; - var t1313 = 0; - var t2027 = 0; - var t2127 = 0; - var t2227 = 1; - var t2313 = 0; - var t3013 = 0; - var t3113 = 0; - var t3213 = 0; - var t3313 = 1; - mat413.e00 = t0027; - mat413.e01 = t0127; - mat413.e02 = t0227; - mat413.e03 = t0313; - mat413.e10 = t1027; - mat413.e11 = t1127; - mat413.e12 = t1227; - mat413.e13 = t1313; - mat413.e20 = t2027; - mat413.e21 = t2127; - mat413.e22 = t2227; - mat413.e23 = t2313; - mat413.e30 = t3013; - mat413.e31 = t3113; - mat413.e32 = t3213; - mat413.e33 = t3313; - if(_this67.sizeMat4 == _this67.stackMat4.length) { - var newLength54 = _this67.sizeMat4 << 1; - var this55 = new Array(newLength54); - var newArray54 = this55; - var _g65 = 0; - var _g155 = _this67.sizeMat4; - while(_g65 < _g155) { - var i56 = _g65++; - newArray54[i56] = _this67.stackMat4[i56]; - _this67.stackMat4[i56] = null; - } - _this67.stackMat4 = newArray54; - } - _this67.stackMat4[_this67.sizeMat4++] = mat413; - } - if(quat13 != null) { - var tx37 = 0; - var ty37 = 0; - var tz37 = 0; - var tw13 = 1; - quat13.x = tx37; - quat13.y = ty37; - quat13.z = tz37; - quat13.w = tw13; - if(_this67.sizeQuat == _this67.stackQuat.length) { - var newLength55 = _this67.sizeQuat << 1; - var this56 = new Array(newLength55); - var newArray55 = this56; - var _g66 = 0; - var _g156 = _this67.sizeQuat; - while(_g66 < _g156) { - var i57 = _g66++; - newArray55[i57] = _this67.stackQuat[i57]; - _this67.stackQuat[i57] = null; - } - _this67.stackQuat = newArray55; - } - _this67.stackQuat[_this67.sizeQuat++] = quat13; - } - var _this68 = this.p; - var mat313 = null; - var mat414 = null; - var quat14 = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; + } + _this15.stackVec3 = newArray; + } + _this15.stackVec3[_this15.sizeVec3++] = ex; + } + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this68.sizeVec3 == _this68.stackVec3.length) { - var newLength56 = _this68.sizeVec3 << 1; - var this57 = new Array(newLength56); - var newArray56 = this57; - var _g67 = 0; - var _g157 = _this68.sizeVec3; - while(_g67 < _g157) { - var i58 = _g67++; - newArray56[i58] = _this68.stackVec3[i58]; - _this68.stackVec3[i58] = null; - } - _this68.stackVec3 = newArray56; - } - _this68.stackVec3[_this68.sizeVec3++] = ey; - } - if(mat313 != null) { - var t0028 = 1; - var t0128 = 0; - var t0228 = 0; - var t1028 = 0; - var t1128 = 1; - var t1228 = 0; - var t2028 = 0; - var t2128 = 0; - var t2228 = 1; - mat313.e00 = t0028; - mat313.e01 = t0128; - mat313.e02 = t0228; - mat313.e10 = t1028; - mat313.e11 = t1128; - mat313.e12 = t1228; - mat313.e20 = t2028; - mat313.e21 = t2128; - mat313.e22 = t2228; - if(_this68.sizeMat3 == _this68.stackMat3.length) { - var newLength57 = _this68.sizeMat3 << 1; - var this58 = new Array(newLength57); - var newArray57 = this58; - var _g68 = 0; - var _g158 = _this68.sizeMat3; - while(_g68 < _g158) { - var i59 = _g68++; - newArray57[i59] = _this68.stackMat3[i59]; - _this68.stackMat3[i59] = null; - } - _this68.stackMat3 = newArray57; - } - _this68.stackMat3[_this68.sizeMat3++] = mat313; - } - if(mat414 != null) { - var t0029 = 1; - var t0129 = 0; - var t0229 = 0; - var t0314 = 0; - var t1029 = 0; - var t1129 = 1; - var t1229 = 0; - var t1314 = 0; - var t2029 = 0; - var t2129 = 0; - var t2229 = 1; - var t2314 = 0; - var t3014 = 0; - var t3114 = 0; - var t3214 = 0; - var t3314 = 1; - mat414.e00 = t0029; - mat414.e01 = t0129; - mat414.e02 = t0229; - mat414.e03 = t0314; - mat414.e10 = t1029; - mat414.e11 = t1129; - mat414.e12 = t1229; - mat414.e13 = t1314; - mat414.e20 = t2029; - mat414.e21 = t2129; - mat414.e22 = t2229; - mat414.e23 = t2314; - mat414.e30 = t3014; - mat414.e31 = t3114; - mat414.e32 = t3214; - mat414.e33 = t3314; - if(_this68.sizeMat4 == _this68.stackMat4.length) { - var newLength58 = _this68.sizeMat4 << 1; - var this59 = new Array(newLength58); - var newArray58 = this59; - var _g69 = 0; - var _g159 = _this68.sizeMat4; - while(_g69 < _g159) { - var i60 = _g69++; - newArray58[i60] = _this68.stackMat4[i60]; - _this68.stackMat4[i60] = null; - } - _this68.stackMat4 = newArray58; - } - _this68.stackMat4[_this68.sizeMat4++] = mat414; - } - if(quat14 != null) { - var tx38 = 0; - var ty38 = 0; - var tz38 = 0; - var tw14 = 1; - quat14.x = tx38; - quat14.y = ty38; - quat14.z = tz38; - quat14.w = tw14; - if(_this68.sizeQuat == _this68.stackQuat.length) { - var newLength59 = _this68.sizeQuat << 1; - var this60 = new Array(newLength59); - var newArray59 = this60; - var _g70 = 0; - var _g160 = _this68.sizeQuat; - while(_g70 < _g160) { - var i61 = _g70++; - newArray59[i61] = _this68.stackQuat[i61]; - _this68.stackQuat[i61] = null; - } - _this68.stackQuat = newArray59; - } - _this68.stackQuat[_this68.sizeQuat++] = quat14; - } - var _this69 = this.p; - var mat314 = null; - var mat415 = null; - var quat15 = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; + } + _this16.stackVec3 = newArray; + } + _this16.stackVec3[_this16.sizeVec3++] = ey; + } + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength60 = _this69.sizeVec3 << 1; - var this61 = new Array(newLength60); - var newArray60 = this61; - var _g71 = 0; - var _g161 = _this69.sizeVec3; - while(_g71 < _g161) { - var i62 = _g71++; - newArray60[i62] = _this69.stackVec3[i62]; - _this69.stackVec3[i62] = null; - } - _this69.stackVec3 = newArray60; - } - _this69.stackVec3[_this69.sizeVec3++] = ez; - } - if(mat314 != null) { - var t0030 = 1; - var t0130 = 0; - var t0230 = 0; - var t1030 = 0; - var t1130 = 1; - var t1230 = 0; - var t2030 = 0; - var t2130 = 0; - var t2230 = 1; - mat314.e00 = t0030; - mat314.e01 = t0130; - mat314.e02 = t0230; - mat314.e10 = t1030; - mat314.e11 = t1130; - mat314.e12 = t1230; - mat314.e20 = t2030; - mat314.e21 = t2130; - mat314.e22 = t2230; - if(_this69.sizeMat3 == _this69.stackMat3.length) { - var newLength61 = _this69.sizeMat3 << 1; - var this62 = new Array(newLength61); - var newArray61 = this62; - var _g72 = 0; - var _g162 = _this69.sizeMat3; - while(_g72 < _g162) { - var i63 = _g72++; - newArray61[i63] = _this69.stackMat3[i63]; - _this69.stackMat3[i63] = null; - } - _this69.stackMat3 = newArray61; - } - _this69.stackMat3[_this69.sizeMat3++] = mat314; - } - if(mat415 != null) { - var t0031 = 1; - var t0131 = 0; - var t0231 = 0; - var t0315 = 0; - var t1031 = 0; - var t1131 = 1; - var t1231 = 0; - var t1315 = 0; - var t2031 = 0; - var t2131 = 0; - var t2231 = 1; - var t2315 = 0; - var t3015 = 0; - var t3115 = 0; - var t3215 = 0; - var t3315 = 1; - mat415.e00 = t0031; - mat415.e01 = t0131; - mat415.e02 = t0231; - mat415.e03 = t0315; - mat415.e10 = t1031; - mat415.e11 = t1131; - mat415.e12 = t1231; - mat415.e13 = t1315; - mat415.e20 = t2031; - mat415.e21 = t2131; - mat415.e22 = t2231; - mat415.e23 = t2315; - mat415.e30 = t3015; - mat415.e31 = t3115; - mat415.e32 = t3215; - mat415.e33 = t3315; - if(_this69.sizeMat4 == _this69.stackMat4.length) { - var newLength62 = _this69.sizeMat4 << 1; - var this63 = new Array(newLength62); - var newArray62 = this63; - var _g73 = 0; - var _g163 = _this69.sizeMat4; - while(_g73 < _g163) { - var i64 = _g73++; - newArray62[i64] = _this69.stackMat4[i64]; - _this69.stackMat4[i64] = null; - } - _this69.stackMat4 = newArray62; - } - _this69.stackMat4[_this69.sizeMat4++] = mat415; - } - if(quat15 != null) { - var tx39 = 0; - var ty39 = 0; - var tz39 = 0; - var tw15 = 1; - quat15.x = tx39; - quat15.y = ty39; - quat15.z = tz39; - quat15.w = tw15; - if(_this69.sizeQuat == _this69.stackQuat.length) { - var newLength63 = _this69.sizeQuat << 1; - var this64 = new Array(newLength63); - var newArray63 = this64; - var _g74 = 0; - var _g164 = _this69.sizeQuat; - while(_g74 < _g164) { - var i65 = _g74++; - newArray63[i65] = _this69.stackQuat[i65]; - _this69.stackQuat[i65] = null; - } - _this69.stackQuat = newArray63; - } - _this69.stackQuat[_this69.sizeQuat++] = quat15; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; } } capsule(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -32703,2361 +19735,574 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var nt = 4; - var np = 8; - var vs = this.tmpSphereVerts; - var ns = this.tmpSphereNorms; - var _g = 0; - var _g1 = nt + 1; - while(_g < _g1) { - var i2 = _g++; - var n = this.tmpSphereVerts[i2].length; - var _g2 = 0; - var _g11 = n; - while(_g2 < _g11) { - var j2 = _g2++; - var _this5 = ns[i2][j2]; - var v1 = this.sphereCoords[i2][j2]; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var _this6 = _this5; - var tx = _this6.x * m.e00 + _this6.y * m.e01 + _this6.z * m.e02; - var ty = _this6.x * m.e10 + _this6.y * m.e11 + _this6.z * m.e12; - var tz = _this6.x * m.e20 + _this6.y * m.e21 + _this6.z * m.e22; - _this6.x = tx; - _this6.y = ty; - _this6.z = tz; - } - } - var _g21 = 0; - var _g3 = nt; - while(_g21 < _g3) { - var i = _g21++; + let vs = this.tmpSphereVerts; + let ns = this.tmpSphereNorms; + let _g = 0; + while(_g < 5) { + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; + while(_g1 < n) { + let j2 = _g1++; + let _this = ns[i2][j2]; + let v = this.sphereCoords[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + } + } + let _g1 = 0; + while(_g1 < 4) { + let i = _g1++; if(i == 0) { - var half = nt >> 1; - var _g22 = 0; - var _g31 = half + 1; - while(_g22 < _g31) { - var i21 = _g22++; - var n1 = this.tmpSphereVerts[i21].length; - var _g23 = 0; - var _g32 = n1; - while(_g23 < _g32) { - var j21 = _g23++; - var _this7 = vs[i21][j21]; - var v2 = ns[i21][j21]; - _this7.x = v2.x; - _this7.y = v2.y; - _this7.z = v2.z; - var _this8 = _this7; - var tx1 = _this8.x * radius; - var ty1 = _this8.y * radius; - var tz1 = _this8.z * radius; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; - var _this9 = _this8; - var tx2 = _this9.x + o.x; - var ty2 = _this9.y + o.y; - var tz2 = _this9.z + o.z; - _this9.x = tx2; - _this9.y = ty2; - _this9.z = tz2; - var _this10 = _this9; - var tx3 = _this10.x + ey.x * halfHeight; - var ty3 = _this10.y + ey.y * halfHeight; - var tz3 = _this10.z + ey.z * halfHeight; - _this10.x = tx3; - _this10.y = ty3; - _this10.z = tz3; - } - } - } - if(i == nt >> 1) { - var half1 = nt >> 1; - var _g24 = half1; - var _g33 = nt + 1; - while(_g24 < _g33) { - var i22 = _g24++; - var n2 = this.tmpSphereVerts[i22].length; - var _g25 = 0; - var _g34 = n2; - while(_g25 < _g34) { - var j22 = _g25++; - var _this11 = vs[i22][j22]; - var v3 = ns[i22][j22]; - _this11.x = v3.x; - _this11.y = v3.y; - _this11.z = v3.z; - var _this12 = _this11; - var tx4 = _this12.x * radius; - var ty4 = _this12.y * radius; - var tz4 = _this12.z * radius; - _this12.x = tx4; - _this12.y = ty4; - _this12.z = tz4; - var _this13 = _this12; - var tx5 = _this13.x + o.x; - var ty5 = _this13.y + o.y; - var tz5 = _this13.z + o.z; - _this13.x = tx5; - _this13.y = ty5; - _this13.z = tz5; - var _this14 = _this13; - var s = -halfHeight; - var tx6 = _this14.x + ey.x * s; - var ty6 = _this14.y + ey.y * s; - var tz6 = _this14.z + ey.z * s; - _this14.x = tx6; - _this14.y = ty6; - _this14.z = tz6; - } - } - } - var _g26 = 0; - var _g35 = np; - while(_g26 < _g35) { - var j = _g26++; - var v11; - var v21; - var v31; - var v4; - var n11; - var n21; - var n3; - var n4; + let _g = 0; + while(_g < 3) { + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; + while(_g1 < n) { + let j2 = _g1++; + let _this = vs[i2][j2]; + let v = ns[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= radius; + _this.y *= radius; + _this.z *= radius; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; + } + } + } + if(i == 2) { + let _g = 2; + while(_g < 5) { + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; + while(_g1 < n) { + let j2 = _g1++; + let _this = vs[i2][j2]; + let v = ns[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= radius; + _this.y *= radius; + _this.z *= radius; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; + let s = -halfHeight; + _this.x += ey.x * s; + _this.y += ey.y * s; + _this.z += ey.z * s; + } + } + } + let _g = 0; + while(_g < 8) { + let j = _g++; + let v1; + let v2; + let v3; + let v4; + let n1; + let n2; + let n3; + let n4; if(i == 0) { if(this.wireframe) { - v11 = vs[0][0]; - v21 = vs[1][j]; - this.line(v11,v21,color); + v1 = vs[0][0]; + v2 = vs[1][j]; + this.line(v1,v2,color); } else { - v11 = vs[0][0]; - v21 = vs[1][j]; - v31 = vs[1][(j + 1) % np]; - n11 = ns[0][0]; - n21 = ns[1][j]; - n3 = ns[1][(j + 1) % np]; - this.triangle(v11,v21,v31,n11,n21,n3,color); + v1 = vs[0][0]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; + n1 = ns[0][0]; + n2 = ns[1][j]; + n3 = ns[1][(j + 1) % 8]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } - } else if(i == nt - 1) { + } else if(i == 3) { if(this.wireframe) { - v11 = vs[nt][0]; - v21 = vs[i][(j + 1) % np]; - v31 = vs[i][j]; - this.line(v11,v21,color); - this.line(v21,v31,color); + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v1,v2,color); + this.line(v2,v3,color); } else { - v11 = vs[nt][0]; - v21 = vs[i][(j + 1) % np]; - v31 = vs[i][j]; - n11 = ns[nt][0]; - n21 = ns[i][(j + 1) % np]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + n1 = ns[4][0]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i][j]; - this.triangle(v11,v21,v31,n11,n21,n3,color); + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(this.wireframe) { - v11 = vs[i][j]; - v21 = vs[i][(j + 1) % np]; - v31 = vs[i + 1][j]; - this.line(v11,v21,color); - this.line(v11,v31,color); + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v1,v2,color); + this.line(v1,v3,color); } else { - v11 = vs[i][j]; - v21 = vs[i][(j + 1) % np]; - v31 = vs[i + 1][j]; - v4 = vs[i + 1][(j + 1) % np]; - n11 = ns[i][j]; - n21 = ns[i][(j + 1) % np]; + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % 8]; + n1 = ns[i][j]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i + 1][j]; - n4 = ns[i + 1][(j + 1) % np]; - this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); - } - } - } - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = o.x; - _this16.y = o.y; - _this16.z = o.z; - var _this17 = _this16; - var tx7 = _this17.x + ey.x * halfHeight; - var ty7 = _this17.y + ey.y * halfHeight; - var tz7 = _this17.z + ey.z * halfHeight; - _this17.x = tx7; - _this17.y = ty7; - _this17.z = tz7; - var top = _this17; - var _this18 = this.p; - var _this19 = _this18.sizeVec3 == 0 ? new oimo.common.Vec3() : _this18.stackVec3[--_this18.sizeVec3]; - _this19.x = o.x; - _this19.y = o.y; - _this19.z = o.z; - var _this20 = _this19; - var s1 = -halfHeight; - var tx8 = _this20.x + ey.x * s1; - var ty8 = _this20.y + ey.y * s1; - var tz8 = _this20.z + ey.z * s1; - _this20.x = tx8; - _this20.y = ty8; - _this20.z = tz8; - var bottom = _this20; + n4 = ns[i + 1][(j + 1) % 8]; + this.rect(v1,v3,v4,v2,n1,n3,n4,n2,color); + } + } + } + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + let _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + let _this10 = _this9; + let s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { - var _this21 = this.p; - var _this22 = _this21.sizeVec3 == 0 ? new oimo.common.Vec3() : _this21.stackVec3[--_this21.sizeVec3]; - _this22.x = top.x; - _this22.y = top.y; - _this22.z = top.z; - var _this23 = _this22; - var s2 = -radius; - var tx9 = _this23.x + ex.x * s2; - var ty9 = _this23.y + ex.y * s2; - var tz9 = _this23.z + ex.z * s2; - _this23.x = tx9; - _this23.y = ty9; - _this23.z = tz9; - var _this24 = _this23; - var tx10 = _this24.x + ez.x * 0; - var ty10 = _this24.y + ez.y * 0; - var tz10 = _this24.z + ez.z * 0; - _this24.x = tx10; - _this24.y = ty10; - _this24.z = tz10; - var top1 = _this24; - var _this25 = this.p; - var _this26 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - _this26.x = top.x; - _this26.y = top.y; - _this26.z = top.z; - var _this27 = _this26; - var tx11 = _this27.x + ex.x * radius; - var ty11 = _this27.y + ex.y * radius; - var tz11 = _this27.z + ex.z * radius; - _this27.x = tx11; - _this27.y = ty11; - _this27.z = tz11; - var _this28 = _this27; - var tx12 = _this28.x + ez.x * 0; - var ty12 = _this28.y + ez.y * 0; - var tz12 = _this28.z + ez.z * 0; - _this28.x = tx12; - _this28.y = ty12; - _this28.z = tz12; - var top2 = _this28; - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo.common.Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = top.x; - _this30.y = top.y; - _this30.z = top.z; - var _this31 = _this30; - var tx13 = _this31.x + ex.x * 0; - var ty13 = _this31.y + ex.y * 0; - var tz13 = _this31.z + ex.z * 0; - _this31.x = tx13; - _this31.y = ty13; - _this31.z = tz13; - var _this32 = _this31; - var s3 = -radius; - var tx14 = _this32.x + ez.x * s3; - var ty14 = _this32.y + ez.y * s3; - var tz14 = _this32.z + ez.z * s3; - _this32.x = tx14; - _this32.y = ty14; - _this32.z = tz14; - var top3 = _this32; - var _this33 = this.p; - var _this34 = _this33.sizeVec3 == 0 ? new oimo.common.Vec3() : _this33.stackVec3[--_this33.sizeVec3]; - _this34.x = top.x; - _this34.y = top.y; - _this34.z = top.z; - var _this35 = _this34; - var tx15 = _this35.x + ex.x * 0; - var ty15 = _this35.y + ex.y * 0; - var tz15 = _this35.z + ex.z * 0; - _this35.x = tx15; - _this35.y = ty15; - _this35.z = tz15; - var _this36 = _this35; - var tx16 = _this36.x + ez.x * radius; - var ty16 = _this36.y + ez.y * radius; - var tz16 = _this36.z + ez.z * radius; - _this36.x = tx16; - _this36.y = ty16; - _this36.z = tz16; - var top4 = _this36; - var _this37 = this.p; - var _this38 = _this37.sizeVec3 == 0 ? new oimo.common.Vec3() : _this37.stackVec3[--_this37.sizeVec3]; - _this38.x = bottom.x; - _this38.y = bottom.y; - _this38.z = bottom.z; - var _this39 = _this38; - var s4 = -radius; - var tx17 = _this39.x + ex.x * s4; - var ty17 = _this39.y + ex.y * s4; - var tz17 = _this39.z + ex.z * s4; - _this39.x = tx17; - _this39.y = ty17; - _this39.z = tz17; - var _this40 = _this39; - var tx18 = _this40.x + ez.x * 0; - var ty18 = _this40.y + ez.y * 0; - var tz18 = _this40.z + ez.z * 0; - _this40.x = tx18; - _this40.y = ty18; - _this40.z = tz18; - var bottom1 = _this40; - var _this41 = this.p; - var _this42 = _this41.sizeVec3 == 0 ? new oimo.common.Vec3() : _this41.stackVec3[--_this41.sizeVec3]; - _this42.x = bottom.x; - _this42.y = bottom.y; - _this42.z = bottom.z; - var _this43 = _this42; - var tx19 = _this43.x + ex.x * radius; - var ty19 = _this43.y + ex.y * radius; - var tz19 = _this43.z + ex.z * radius; - _this43.x = tx19; - _this43.y = ty19; - _this43.z = tz19; - var _this44 = _this43; - var tx20 = _this44.x + ez.x * 0; - var ty20 = _this44.y + ez.y * 0; - var tz20 = _this44.z + ez.z * 0; - _this44.x = tx20; - _this44.y = ty20; - _this44.z = tz20; - var bottom2 = _this44; - var _this45 = this.p; - var _this46 = _this45.sizeVec3 == 0 ? new oimo.common.Vec3() : _this45.stackVec3[--_this45.sizeVec3]; - _this46.x = bottom.x; - _this46.y = bottom.y; - _this46.z = bottom.z; - var _this47 = _this46; - var tx21 = _this47.x + ex.x * 0; - var ty21 = _this47.y + ex.y * 0; - var tz21 = _this47.z + ex.z * 0; - _this47.x = tx21; - _this47.y = ty21; - _this47.z = tz21; - var _this48 = _this47; - var s5 = -radius; - var tx22 = _this48.x + ez.x * s5; - var ty22 = _this48.y + ez.y * s5; - var tz22 = _this48.z + ez.z * s5; - _this48.x = tx22; - _this48.y = ty22; - _this48.z = tz22; - var bottom3 = _this48; - var _this49 = this.p; - var _this50 = _this49.sizeVec3 == 0 ? new oimo.common.Vec3() : _this49.stackVec3[--_this49.sizeVec3]; - _this50.x = bottom.x; - _this50.y = bottom.y; - _this50.z = bottom.z; - var _this51 = _this50; - var tx23 = _this51.x + ex.x * 0; - var ty23 = _this51.y + ex.y * 0; - var tz23 = _this51.z + ex.z * 0; - _this51.x = tx23; - _this51.y = ty23; - _this51.z = tz23; - var _this52 = _this51; - var tx24 = _this52.x + ez.x * radius; - var ty24 = _this52.y + ez.y * radius; - var tz24 = _this52.z + ez.z * radius; - _this52.x = tx24; - _this52.y = ty24; - _this52.z = tz24; - var bottom4 = _this52; - this.ellipse(top,ex,ez,radius,radius,color); - this.ellipse(bottom,ex,ez,radius,radius,color); - this.line(top1,bottom1,color); - this.line(top2,bottom2,color); - this.line(top3,bottom3,color); - this.line(top4,bottom4,color); - var _this53 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; - if(top1 != null) { - top1.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newLength = _this53.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g4 = 0; - var _g12 = _this53.sizeVec3; - while(_g4 < _g12) { - var i1 = _g4++; - newArray[i1] = _this53.stackVec3[i1]; - _this53.stackVec3[i1] = null; - } - _this53.stackVec3 = newArray; - } - _this53.stackVec3[_this53.sizeVec3++] = top1; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this53.sizeMat3 == _this53.stackMat3.length) { - var newLength1 = _this53.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g5 = 0; - var _g13 = _this53.sizeMat3; - while(_g5 < _g13) { - var i3 = _g5++; - newArray1[i3] = _this53.stackMat3[i3]; - _this53.stackMat3[i3] = null; - } - _this53.stackMat3 = newArray1; - } - _this53.stackMat3[_this53.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this53.sizeMat4 == _this53.stackMat4.length) { - var newLength2 = _this53.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g6 = 0; - var _g14 = _this53.sizeMat4; - while(_g6 < _g14) { - var i4 = _g6++; - newArray2[i4] = _this53.stackMat4[i4]; - _this53.stackMat4[i4] = null; - } - _this53.stackMat4 = newArray2; - } - _this53.stackMat4[_this53.sizeMat4++] = mat4; - } - if(quat != null) { - var tx25 = 0; - var ty25 = 0; - var tz25 = 0; - var tw = 1; - quat.x = tx25; - quat.y = ty25; - quat.z = tz25; - quat.w = tw; - if(_this53.sizeQuat == _this53.stackQuat.length) { - var newLength3 = _this53.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g7 = 0; - var _g15 = _this53.sizeQuat; - while(_g7 < _g15) { - var i5 = _g7++; - newArray3[i5] = _this53.stackQuat[i5]; - _this53.stackQuat[i5] = null; - } - _this53.stackQuat = newArray3; - } - _this53.stackQuat[_this53.sizeQuat++] = quat; - } - var _this54 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(top2 != null) { - top2.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newLength4 = _this54.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g8 = 0; - var _g16 = _this54.sizeVec3; - while(_g8 < _g16) { - var i6 = _g8++; - newArray4[i6] = _this54.stackVec3[i6]; - _this54.stackVec3[i6] = null; - } - _this54.stackVec3 = newArray4; - } - _this54.stackVec3[_this54.sizeVec3++] = top2; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this54.sizeMat3 == _this54.stackMat3.length) { - var newLength5 = _this54.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g9 = 0; - var _g17 = _this54.sizeMat3; - while(_g9 < _g17) { - var i7 = _g9++; - newArray5[i7] = _this54.stackMat3[i7]; - _this54.stackMat3[i7] = null; - } - _this54.stackMat3 = newArray5; - } - _this54.stackMat3[_this54.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this54.sizeMat4 == _this54.stackMat4.length) { - var newLength6 = _this54.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g10 = 0; - var _g18 = _this54.sizeMat4; - while(_g10 < _g18) { - var i8 = _g10++; - newArray6[i8] = _this54.stackMat4[i8]; - _this54.stackMat4[i8] = null; - } - _this54.stackMat4 = newArray6; - } - _this54.stackMat4[_this54.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx26 = 0; - var ty26 = 0; - var tz26 = 0; - var tw1 = 1; - quat1.x = tx26; - quat1.y = ty26; - quat1.z = tz26; - quat1.w = tw1; - if(_this54.sizeQuat == _this54.stackQuat.length) { - var newLength7 = _this54.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g19 = 0; - var _g110 = _this54.sizeQuat; - while(_g19 < _g110) { - var i9 = _g19++; - newArray7[i9] = _this54.stackQuat[i9]; - _this54.stackQuat[i9] = null; - } - _this54.stackQuat = newArray7; - } - _this54.stackQuat[_this54.sizeQuat++] = quat1; - } - var _this55 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(top3 != null) { - top3.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newLength8 = _this55.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g20 = 0; - var _g111 = _this55.sizeVec3; - while(_g20 < _g111) { - var i10 = _g20++; - newArray8[i10] = _this55.stackVec3[i10]; - _this55.stackVec3[i10] = null; - } - _this55.stackVec3 = newArray8; - } - _this55.stackVec3[_this55.sizeVec3++] = top3; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this55.sizeMat3 == _this55.stackMat3.length) { - var newLength9 = _this55.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g27 = 0; - var _g112 = _this55.sizeMat3; - while(_g27 < _g112) { - var i11 = _g27++; - newArray9[i11] = _this55.stackMat3[i11]; - _this55.stackMat3[i11] = null; - } - _this55.stackMat3 = newArray9; - } - _this55.stackMat3[_this55.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this55.sizeMat4 == _this55.stackMat4.length) { - var newLength10 = _this55.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g28 = 0; - var _g113 = _this55.sizeMat4; - while(_g28 < _g113) { - var i12 = _g28++; - newArray10[i12] = _this55.stackMat4[i12]; - _this55.stackMat4[i12] = null; - } - _this55.stackMat4 = newArray10; - } - _this55.stackMat4[_this55.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx27 = 0; - var ty27 = 0; - var tz27 = 0; - var tw2 = 1; - quat2.x = tx27; - quat2.y = ty27; - quat2.z = tz27; - quat2.w = tw2; - if(_this55.sizeQuat == _this55.stackQuat.length) { - var newLength11 = _this55.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g29 = 0; - var _g114 = _this55.sizeQuat; - while(_g29 < _g114) { - var i13 = _g29++; - newArray11[i13] = _this55.stackQuat[i13]; - _this55.stackQuat[i13] = null; - } - _this55.stackQuat = newArray11; - } - _this55.stackQuat[_this55.sizeQuat++] = quat2; - } - var _this56 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(top4 != null) { - top4.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newLength12 = _this56.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g30 = 0; - var _g115 = _this56.sizeVec3; - while(_g30 < _g115) { - var i14 = _g30++; - newArray12[i14] = _this56.stackVec3[i14]; - _this56.stackVec3[i14] = null; - } - _this56.stackVec3 = newArray12; - } - _this56.stackVec3[_this56.sizeVec3++] = top4; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this56.sizeMat3 == _this56.stackMat3.length) { - var newLength13 = _this56.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g36 = 0; - var _g116 = _this56.sizeMat3; - while(_g36 < _g116) { - var i15 = _g36++; - newArray13[i15] = _this56.stackMat3[i15]; - _this56.stackMat3[i15] = null; - } - _this56.stackMat3 = newArray13; - } - _this56.stackMat3[_this56.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this56.sizeMat4 == _this56.stackMat4.length) { - var newLength14 = _this56.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g37 = 0; - var _g117 = _this56.sizeMat4; - while(_g37 < _g117) { - var i16 = _g37++; - newArray14[i16] = _this56.stackMat4[i16]; - _this56.stackMat4[i16] = null; - } - _this56.stackMat4 = newArray14; - } - _this56.stackMat4[_this56.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx28 = 0; - var ty28 = 0; - var tz28 = 0; - var tw3 = 1; - quat3.x = tx28; - quat3.y = ty28; - quat3.z = tz28; - quat3.w = tw3; - if(_this56.sizeQuat == _this56.stackQuat.length) { - var newLength15 = _this56.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g38 = 0; - var _g118 = _this56.sizeQuat; - while(_g38 < _g118) { - var i17 = _g38++; - newArray15[i17] = _this56.stackQuat[i17]; - _this56.stackQuat[i17] = null; - } - _this56.stackQuat = newArray15; - } - _this56.stackQuat[_this56.sizeQuat++] = quat3; - } - var _this57 = this.p; - var mat34 = null; - var mat44 = null; - var quat4 = null; - if(bottom1 != null) { - bottom1.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newLength16 = _this57.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g39 = 0; - var _g119 = _this57.sizeVec3; - while(_g39 < _g119) { - var i18 = _g39++; - newArray16[i18] = _this57.stackVec3[i18]; - _this57.stackVec3[i18] = null; - } - _this57.stackVec3 = newArray16; - } - _this57.stackVec3[_this57.sizeVec3++] = bottom1; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this57.sizeMat3 == _this57.stackMat3.length) { - var newLength17 = _this57.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g40 = 0; - var _g120 = _this57.sizeMat3; - while(_g40 < _g120) { - var i19 = _g40++; - newArray17[i19] = _this57.stackMat3[i19]; - _this57.stackMat3[i19] = null; - } - _this57.stackMat3 = newArray17; - } - _this57.stackMat3[_this57.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this57.sizeMat4 == _this57.stackMat4.length) { - var newLength18 = _this57.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g41 = 0; - var _g121 = _this57.sizeMat4; - while(_g41 < _g121) { - var i20 = _g41++; - newArray18[i20] = _this57.stackMat4[i20]; - _this57.stackMat4[i20] = null; - } - _this57.stackMat4 = newArray18; - } - _this57.stackMat4[_this57.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx29 = 0; - var ty29 = 0; - var tz29 = 0; - var tw4 = 1; - quat4.x = tx29; - quat4.y = ty29; - quat4.z = tz29; - quat4.w = tw4; - if(_this57.sizeQuat == _this57.stackQuat.length) { - var newLength19 = _this57.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g42 = 0; - var _g122 = _this57.sizeQuat; - while(_g42 < _g122) { - var i23 = _g42++; - newArray19[i23] = _this57.stackQuat[i23]; - _this57.stackQuat[i23] = null; - } - _this57.stackQuat = newArray19; - } - _this57.stackQuat[_this57.sizeQuat++] = quat4; - } - var _this58 = this.p; - var mat35 = null; - var mat45 = null; - var quat5 = null; - if(bottom2 != null) { - bottom2.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newLength20 = _this58.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g43 = 0; - var _g123 = _this58.sizeVec3; - while(_g43 < _g123) { - var i24 = _g43++; - newArray20[i24] = _this58.stackVec3[i24]; - _this58.stackVec3[i24] = null; - } - _this58.stackVec3 = newArray20; - } - _this58.stackVec3[_this58.sizeVec3++] = bottom2; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this58.sizeMat3 == _this58.stackMat3.length) { - var newLength21 = _this58.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g44 = 0; - var _g124 = _this58.sizeMat3; - while(_g44 < _g124) { - var i25 = _g44++; - newArray21[i25] = _this58.stackMat3[i25]; - _this58.stackMat3[i25] = null; - } - _this58.stackMat3 = newArray21; - } - _this58.stackMat3[_this58.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this58.sizeMat4 == _this58.stackMat4.length) { - var newLength22 = _this58.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g45 = 0; - var _g125 = _this58.sizeMat4; - while(_g45 < _g125) { - var i26 = _g45++; - newArray22[i26] = _this58.stackMat4[i26]; - _this58.stackMat4[i26] = null; - } - _this58.stackMat4 = newArray22; - } - _this58.stackMat4[_this58.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx30 = 0; - var ty30 = 0; - var tz30 = 0; - var tw5 = 1; - quat5.x = tx30; - quat5.y = ty30; - quat5.z = tz30; - quat5.w = tw5; - if(_this58.sizeQuat == _this58.stackQuat.length) { - var newLength23 = _this58.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g46 = 0; - var _g126 = _this58.sizeQuat; - while(_g46 < _g126) { - var i27 = _g46++; - newArray23[i27] = _this58.stackQuat[i27]; - _this58.stackQuat[i27] = null; - } - _this58.stackQuat = newArray23; - } - _this58.stackQuat[_this58.sizeQuat++] = quat5; - } - var _this59 = this.p; - var mat36 = null; - var mat46 = null; - var quat6 = null; - if(bottom3 != null) { - bottom3.zero(); - if(_this59.sizeVec3 == _this59.stackVec3.length) { - var newLength24 = _this59.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g47 = 0; - var _g127 = _this59.sizeVec3; - while(_g47 < _g127) { - var i28 = _g47++; - newArray24[i28] = _this59.stackVec3[i28]; - _this59.stackVec3[i28] = null; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this7.x; + _this1.y = _this7.y; + _this1.z = _this7.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this7.x; + _this4.y = _this7.y; + _this4.z = _this7.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this7.x; + _this8.y = _this7.y; + _this8.z = _this7.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this7.x; + _this12.y = _this7.y; + _this12.z = _this7.z; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo.common.Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + let _this16 = _this15; + let s2 = -radius; + _this16.x += ex.x * s2; + _this16.y += ex.y * s2; + _this16.z += ex.z * s2; + _this16.x += ez.x * 0; + _this16.y += ez.y * 0; + _this16.z += ez.z * 0; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + let _this19 = _this18; + _this19.x += ex.x * radius; + _this19.y += ex.y * radius; + _this19.z += ex.z * radius; + _this19.x += ez.x * 0; + _this19.y += ez.y * 0; + _this19.z += ez.z * 0; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + let _this22 = _this21; + _this22.x += ex.x * 0; + _this22.y += ex.y * 0; + _this22.z += ex.z * 0; + let s3 = -radius; + _this22.x += ez.x * s3; + _this22.y += ez.y * s3; + _this22.z += ez.z * s3; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = _this10.x; + _this24.y = _this10.y; + _this24.z = _this10.z; + let _this25 = _this24; + _this25.x += ex.x * 0; + _this25.y += ex.y * 0; + _this25.z += ex.z * 0; + _this25.x += ez.x * radius; + _this25.y += ez.y * radius; + _this25.z += ez.z * radius; + this.ellipse(_this7,ex,ez,radius,radius,color); + this.ellipse(_this10,ex,ez,radius,radius,color); + this.line(_this2,_this16,color); + this.line(_this5,_this19,color); + this.line(_this9,_this22,color); + this.line(_this13,_this25,color); + let _this26 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; } - _this59.stackVec3 = newArray24; - } - _this59.stackVec3[_this59.sizeVec3++] = bottom3; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this59.sizeMat3 == _this59.stackMat3.length) { - var newLength25 = _this59.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g48 = 0; - var _g128 = _this59.sizeMat3; - while(_g48 < _g128) { - var i29 = _g48++; - newArray25[i29] = _this59.stackMat3[i29]; - _this59.stackMat3[i29] = null; + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this2; + } + let _this27 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; } - _this59.stackMat3 = newArray25; - } - _this59.stackMat3[_this59.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this59.sizeMat4 == _this59.stackMat4.length) { - var newLength26 = _this59.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g49 = 0; - var _g129 = _this59.sizeMat4; - while(_g49 < _g129) { - var i30 = _g49++; - newArray26[i30] = _this59.stackMat4[i30]; - _this59.stackMat4[i30] = null; + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = _this5; + } + let _this28 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; } - _this59.stackMat4 = newArray26; - } - _this59.stackMat4[_this59.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx31 = 0; - var ty31 = 0; - var tz31 = 0; - var tw6 = 1; - quat6.x = tx31; - quat6.y = ty31; - quat6.z = tz31; - quat6.w = tw6; - if(_this59.sizeQuat == _this59.stackQuat.length) { - var newLength27 = _this59.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g50 = 0; - var _g130 = _this59.sizeQuat; - while(_g50 < _g130) { - var i31 = _g50++; - newArray27[i31] = _this59.stackQuat[i31]; - _this59.stackQuat[i31] = null; + _this28.stackVec3 = newArray; + } + _this28.stackVec3[_this28.sizeVec3++] = _this9; + } + let _this29 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this59.stackQuat = newArray27; - } - _this59.stackQuat[_this59.sizeQuat++] = quat6; - } - var _this60 = this.p; - var mat37 = null; - var mat47 = null; - var quat7 = null; - if(bottom4 != null) { - bottom4.zero(); - if(_this60.sizeVec3 == _this60.stackVec3.length) { - var newLength28 = _this60.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g51 = 0; - var _g131 = _this60.sizeVec3; - while(_g51 < _g131) { - var i32 = _g51++; - newArray28[i32] = _this60.stackVec3[i32]; - _this60.stackVec3[i32] = null; + _this29.stackVec3 = newArray; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + let _this30 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this60.stackVec3 = newArray28; - } - _this60.stackVec3[_this60.sizeVec3++] = bottom4; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this60.sizeMat3 == _this60.stackMat3.length) { - var newLength29 = _this60.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g52 = 0; - var _g132 = _this60.sizeMat3; - while(_g52 < _g132) { - var i33 = _g52++; - newArray29[i33] = _this60.stackMat3[i33]; - _this60.stackMat3[i33] = null; + _this30.stackVec3 = newArray; + } + _this30.stackVec3[_this30.sizeVec3++] = _this16; + } + let _this31 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this60.stackMat3 = newArray29; - } - _this60.stackMat3[_this60.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this60.sizeMat4 == _this60.stackMat4.length) { - var newLength30 = _this60.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g53 = 0; - var _g133 = _this60.sizeMat4; - while(_g53 < _g133) { - var i34 = _g53++; - newArray30[i34] = _this60.stackMat4[i34]; - _this60.stackMat4[i34] = null; + _this31.stackVec3 = newArray; + } + _this31.stackVec3[_this31.sizeVec3++] = _this19; + } + let _this32 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this60.stackMat4 = newArray30; - } - _this60.stackMat4[_this60.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx32 = 0; - var ty32 = 0; - var tz32 = 0; - var tw7 = 1; - quat7.x = tx32; - quat7.y = ty32; - quat7.z = tz32; - quat7.w = tw7; - if(_this60.sizeQuat == _this60.stackQuat.length) { - var newLength31 = _this60.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g54 = 0; - var _g134 = _this60.sizeQuat; - while(_g54 < _g134) { - var i35 = _g54++; - newArray31[i35] = _this60.stackQuat[i35]; - _this60.stackQuat[i35] = null; + _this32.stackVec3 = newArray; + } + _this32.stackVec3[_this32.sizeVec3++] = _this22; + } + let _this33 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this60.stackQuat = newArray31; + _this33.stackVec3 = newArray; } - _this60.stackQuat[_this60.sizeQuat++] = quat7; + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } else { - var _g410 = 0; - while(_g410 < 8) { - var i36 = _g410++; - var _this61 = this.tmpCircleNorms[i36]; - var v5 = this.circleCoords[i36]; - _this61.x = v5.x; - _this61.y = v5.y; - _this61.z = v5.z; - var _this62 = _this61; - var tx33 = _this62.x * m.e00 + _this62.y * m.e01 + _this62.z * m.e02; - var ty33 = _this62.x * m.e10 + _this62.y * m.e11 + _this62.z * m.e12; - var tz33 = _this62.x * m.e20 + _this62.y * m.e21 + _this62.z * m.e22; - _this62.x = tx33; - _this62.y = ty33; - _this62.z = tz33; - var _this63 = this.tmpCircleVerts1[i36]; - var v6 = this.tmpCircleNorms[i36]; - _this63.x = v6.x; - _this63.y = v6.y; - _this63.z = v6.z; - var _this64 = _this63; - var tx34 = _this64.x * radius; - var ty34 = _this64.y * radius; - var tz34 = _this64.z * radius; - _this64.x = tx34; - _this64.y = ty34; - _this64.z = tz34; - var _this65 = _this64; - var tx35 = _this65.x + o.x; - var ty35 = _this65.y + o.y; - var tz35 = _this65.z + o.z; - _this65.x = tx35; - _this65.y = ty35; - _this65.z = tz35; - var _this66 = this.tmpCircleVerts2[i36]; - var v7 = this.tmpCircleVerts1[i36]; - _this66.x = v7.x; - _this66.y = v7.y; - _this66.z = v7.z; - var _this67 = this.tmpCircleVerts1[i36]; - var tx36 = _this67.x + ey.x * halfHeight; - var ty36 = _this67.y + ey.y * halfHeight; - var tz36 = _this67.z + ey.z * halfHeight; - _this67.x = tx36; - _this67.y = ty36; - _this67.z = tz36; - var _this68 = this.tmpCircleVerts2[i36]; - var s6 = -halfHeight; - var tx37 = _this68.x + ey.x * s6; - var ty37 = _this68.y + ey.y * s6; - var tz37 = _this68.z + ey.z * s6; - _this68.x = tx37; - _this68.y = ty37; - _this68.z = tz37; - } - var _g55 = 0; - while(_g55 < 8) { - var i37 = _g55++; - var v12 = this.tmpCircleVerts1[i37]; - var v22 = this.tmpCircleVerts2[i37]; - var v32 = this.tmpCircleVerts2[(i37 + 1) % 8]; - var v41 = this.tmpCircleVerts1[(i37 + 1) % 8]; - var n12 = this.tmpCircleNorms[i37]; - var n22 = this.tmpCircleNorms[(i37 + 1) % 8]; - this.rect(v12,v22,v32,v41,n12,n12,n22,n22,color); - } - } - var _this69 = this.p; - var mat38 = null; - var mat48 = null; - var quat8 = null; - if(top != null) { - top.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength32 = _this69.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g56 = 0; - var _g135 = _this69.sizeVec3; - while(_g56 < _g135) { - var i38 = _g56++; - newArray32[i38] = _this69.stackVec3[i38]; - _this69.stackVec3[i38] = null; - } - _this69.stackVec3 = newArray32; - } - _this69.stackVec3[_this69.sizeVec3++] = top; - } - if(mat38 != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - mat38.e00 = t0016; - mat38.e01 = t0116; - mat38.e02 = t0216; - mat38.e10 = t1016; - mat38.e11 = t1116; - mat38.e12 = t1216; - mat38.e20 = t2016; - mat38.e21 = t2116; - mat38.e22 = t2216; - if(_this69.sizeMat3 == _this69.stackMat3.length) { - var newLength33 = _this69.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g57 = 0; - var _g136 = _this69.sizeMat3; - while(_g57 < _g136) { - var i39 = _g57++; - newArray33[i39] = _this69.stackMat3[i39]; - _this69.stackMat3[i39] = null; - } - _this69.stackMat3 = newArray33; - } - _this69.stackMat3[_this69.sizeMat3++] = mat38; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this69.sizeMat4 == _this69.stackMat4.length) { - var newLength34 = _this69.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g58 = 0; - var _g137 = _this69.sizeMat4; - while(_g58 < _g137) { - var i40 = _g58++; - newArray34[i40] = _this69.stackMat4[i40]; - _this69.stackMat4[i40] = null; - } - _this69.stackMat4 = newArray34; - } - _this69.stackMat4[_this69.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx38 = 0; - var ty38 = 0; - var tz38 = 0; - var tw8 = 1; - quat8.x = tx38; - quat8.y = ty38; - quat8.z = tz38; - quat8.w = tw8; - if(_this69.sizeQuat == _this69.stackQuat.length) { - var newLength35 = _this69.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g59 = 0; - var _g138 = _this69.sizeQuat; - while(_g59 < _g138) { - var i41 = _g59++; - newArray35[i41] = _this69.stackQuat[i41]; - _this69.stackQuat[i41] = null; - } - _this69.stackQuat = newArray35; - } - _this69.stackQuat[_this69.sizeQuat++] = quat8; - } - var _this70 = this.p; - var mat39 = null; - var mat49 = null; - var quat9 = null; - if(bottom != null) { - bottom.zero(); - if(_this70.sizeVec3 == _this70.stackVec3.length) { - var newLength36 = _this70.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g60 = 0; - var _g139 = _this70.sizeVec3; - while(_g60 < _g139) { - var i42 = _g60++; - newArray36[i42] = _this70.stackVec3[i42]; - _this70.stackVec3[i42] = null; - } - _this70.stackVec3 = newArray36; - } - _this70.stackVec3[_this70.sizeVec3++] = bottom; - } - if(mat39 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat39.e00 = t0018; - mat39.e01 = t0118; - mat39.e02 = t0218; - mat39.e10 = t1018; - mat39.e11 = t1118; - mat39.e12 = t1218; - mat39.e20 = t2018; - mat39.e21 = t2118; - mat39.e22 = t2218; - if(_this70.sizeMat3 == _this70.stackMat3.length) { - var newLength37 = _this70.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g61 = 0; - var _g140 = _this70.sizeMat3; - while(_g61 < _g140) { - var i43 = _g61++; - newArray37[i43] = _this70.stackMat3[i43]; - _this70.stackMat3[i43] = null; - } - _this70.stackMat3 = newArray37; - } - _this70.stackMat3[_this70.sizeMat3++] = mat39; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this70.sizeMat4 == _this70.stackMat4.length) { - var newLength38 = _this70.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g62 = 0; - var _g141 = _this70.sizeMat4; - while(_g62 < _g141) { - var i44 = _g62++; - newArray38[i44] = _this70.stackMat4[i44]; - _this70.stackMat4[i44] = null; - } - _this70.stackMat4 = newArray38; - } - _this70.stackMat4[_this70.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx39 = 0; - var ty39 = 0; - var tz39 = 0; - var tw9 = 1; - quat9.x = tx39; - quat9.y = ty39; - quat9.z = tz39; - quat9.w = tw9; - if(_this70.sizeQuat == _this70.stackQuat.length) { - var newLength39 = _this70.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g63 = 0; - var _g142 = _this70.sizeQuat; - while(_g63 < _g142) { - var i45 = _g63++; - newArray39[i45] = _this70.stackQuat[i45]; - _this70.stackQuat[i45] = null; - } - _this70.stackQuat = newArray39; - } - _this70.stackQuat[_this70.sizeQuat++] = quat9; - } - var _this71 = this.p; - var mat310 = null; - var mat410 = null; - var quat10 = null; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = this.tmpCircleVerts1[i]; + let v1 = this.tmpCircleNorms[i]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + let _this2 = this.tmpCircleVerts2[i]; + let v2 = this.tmpCircleVerts1[i]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + let _this3 = this.tmpCircleVerts1[i]; + _this3.x += ey.x * halfHeight; + _this3.y += ey.y * halfHeight; + _this3.z += ey.z * halfHeight; + let _this4 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this4.x += ey.x * s; + _this4.y += ey.y * s; + _this4.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let n1 = this.tmpCircleNorms[i]; + let n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(this.tmpCircleVerts1[i],this.tmpCircleVerts2[i],this.tmpCircleVerts2[(i + 1) % 8],this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); + } + } + let _this11 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this7; + } + let _this12 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; + } + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = _this10; + } + let _this13 = this.p; if(o != null) { o.zero(); - if(_this71.sizeVec3 == _this71.stackVec3.length) { - var newLength40 = _this71.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g64 = 0; - var _g143 = _this71.sizeVec3; - while(_g64 < _g143) { - var i46 = _g64++; - newArray40[i46] = _this71.stackVec3[i46]; - _this71.stackVec3[i46] = null; - } - _this71.stackVec3 = newArray40; - } - _this71.stackVec3[_this71.sizeVec3++] = o; - } - if(mat310 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat310.e00 = t0020; - mat310.e01 = t0120; - mat310.e02 = t0220; - mat310.e10 = t1020; - mat310.e11 = t1120; - mat310.e12 = t1220; - mat310.e20 = t2020; - mat310.e21 = t2120; - mat310.e22 = t2220; - if(_this71.sizeMat3 == _this71.stackMat3.length) { - var newLength41 = _this71.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g65 = 0; - var _g144 = _this71.sizeMat3; - while(_g65 < _g144) { - var i47 = _g65++; - newArray41[i47] = _this71.stackMat3[i47]; - _this71.stackMat3[i47] = null; - } - _this71.stackMat3 = newArray41; - } - _this71.stackMat3[_this71.sizeMat3++] = mat310; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this71.sizeMat4 == _this71.stackMat4.length) { - var newLength42 = _this71.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g66 = 0; - var _g145 = _this71.sizeMat4; - while(_g66 < _g145) { - var i48 = _g66++; - newArray42[i48] = _this71.stackMat4[i48]; - _this71.stackMat4[i48] = null; - } - _this71.stackMat4 = newArray42; - } - _this71.stackMat4[_this71.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx40 = 0; - var ty40 = 0; - var tz40 = 0; - var tw10 = 1; - quat10.x = tx40; - quat10.y = ty40; - quat10.z = tz40; - quat10.w = tw10; - if(_this71.sizeQuat == _this71.stackQuat.length) { - var newLength43 = _this71.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g67 = 0; - var _g146 = _this71.sizeQuat; - while(_g67 < _g146) { - var i49 = _g67++; - newArray43[i49] = _this71.stackQuat[i49]; - _this71.stackQuat[i49] = null; - } - _this71.stackQuat = newArray43; - } - _this71.stackQuat[_this71.sizeQuat++] = quat10; - } - var _this72 = this.p; - var vec3 = null; - var mat411 = null; - var quat11 = null; - if(vec3 != null) { - vec3.zero(); - if(_this72.sizeVec3 == _this72.stackVec3.length) { - var newLength44 = _this72.sizeVec3 << 1; - var this45 = new Array(newLength44); - var newArray44 = this45; - var _g68 = 0; - var _g147 = _this72.sizeVec3; - while(_g68 < _g147) { - var i50 = _g68++; - newArray44[i50] = _this72.stackVec3[i50]; - _this72.stackVec3[i50] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this72.stackVec3 = newArray44; + _this13.stackVec3 = newArray; } - _this72.stackVec3[_this72.sizeVec3++] = vec3; + _this13.stackVec3[_this13.sizeVec3++] = o; } + let _this14 = this.p; if(m != null) { - var t0022 = 1; - var t0122 = 0; - var t0222 = 0; - var t1022 = 0; - var t1122 = 1; - var t1222 = 0; - var t2022 = 0; - var t2122 = 0; - var t2222 = 1; - m.e00 = t0022; - m.e01 = t0122; - m.e02 = t0222; - m.e10 = t1022; - m.e11 = t1122; - m.e12 = t1222; - m.e20 = t2022; - m.e21 = t2122; - m.e22 = t2222; - if(_this72.sizeMat3 == _this72.stackMat3.length) { - var newLength45 = _this72.sizeMat3 << 1; - var this46 = new Array(newLength45); - var newArray45 = this46; - var _g69 = 0; - var _g148 = _this72.sizeMat3; - while(_g69 < _g148) { - var i51 = _g69++; - newArray45[i51] = _this72.stackMat3[i51]; - _this72.stackMat3[i51] = null; - } - _this72.stackMat3 = newArray45; - } - _this72.stackMat3[_this72.sizeMat3++] = m; - } - if(mat411 != null) { - var t0023 = 1; - var t0123 = 0; - var t0223 = 0; - var t0311 = 0; - var t1023 = 0; - var t1123 = 1; - var t1223 = 0; - var t1311 = 0; - var t2023 = 0; - var t2123 = 0; - var t2223 = 1; - var t2311 = 0; - var t3011 = 0; - var t3111 = 0; - var t3211 = 0; - var t3311 = 1; - mat411.e00 = t0023; - mat411.e01 = t0123; - mat411.e02 = t0223; - mat411.e03 = t0311; - mat411.e10 = t1023; - mat411.e11 = t1123; - mat411.e12 = t1223; - mat411.e13 = t1311; - mat411.e20 = t2023; - mat411.e21 = t2123; - mat411.e22 = t2223; - mat411.e23 = t2311; - mat411.e30 = t3011; - mat411.e31 = t3111; - mat411.e32 = t3211; - mat411.e33 = t3311; - if(_this72.sizeMat4 == _this72.stackMat4.length) { - var newLength46 = _this72.sizeMat4 << 1; - var this47 = new Array(newLength46); - var newArray46 = this47; - var _g70 = 0; - var _g149 = _this72.sizeMat4; - while(_g70 < _g149) { - var i52 = _g70++; - newArray46[i52] = _this72.stackMat4[i52]; - _this72.stackMat4[i52] = null; - } - _this72.stackMat4 = newArray46; - } - _this72.stackMat4[_this72.sizeMat4++] = mat411; - } - if(quat11 != null) { - var tx41 = 0; - var ty41 = 0; - var tz41 = 0; - var tw11 = 1; - quat11.x = tx41; - quat11.y = ty41; - quat11.z = tz41; - quat11.w = tw11; - if(_this72.sizeQuat == _this72.stackQuat.length) { - var newLength47 = _this72.sizeQuat << 1; - var this48 = new Array(newLength47); - var newArray47 = this48; - var _g71 = 0; - var _g150 = _this72.sizeQuat; - while(_g71 < _g150) { - var i53 = _g71++; - newArray47[i53] = _this72.stackQuat[i53]; - _this72.stackQuat[i53] = null; - } - _this72.stackQuat = newArray47; - } - _this72.stackQuat[_this72.sizeQuat++] = quat11; - } - var _this73 = this.p; - var mat311 = null; - var mat412 = null; - var quat12 = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; + } + _this14.stackMat3 = newArray; + } + _this14.stackMat3[_this14.sizeMat3++] = m; + } + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this73.sizeVec3 == _this73.stackVec3.length) { - var newLength48 = _this73.sizeVec3 << 1; - var this49 = new Array(newLength48); - var newArray48 = this49; - var _g72 = 0; - var _g151 = _this73.sizeVec3; - while(_g72 < _g151) { - var i54 = _g72++; - newArray48[i54] = _this73.stackVec3[i54]; - _this73.stackVec3[i54] = null; - } - _this73.stackVec3 = newArray48; - } - _this73.stackVec3[_this73.sizeVec3++] = ex; - } - if(mat311 != null) { - var t0024 = 1; - var t0124 = 0; - var t0224 = 0; - var t1024 = 0; - var t1124 = 1; - var t1224 = 0; - var t2024 = 0; - var t2124 = 0; - var t2224 = 1; - mat311.e00 = t0024; - mat311.e01 = t0124; - mat311.e02 = t0224; - mat311.e10 = t1024; - mat311.e11 = t1124; - mat311.e12 = t1224; - mat311.e20 = t2024; - mat311.e21 = t2124; - mat311.e22 = t2224; - if(_this73.sizeMat3 == _this73.stackMat3.length) { - var newLength49 = _this73.sizeMat3 << 1; - var this50 = new Array(newLength49); - var newArray49 = this50; - var _g73 = 0; - var _g152 = _this73.sizeMat3; - while(_g73 < _g152) { - var i55 = _g73++; - newArray49[i55] = _this73.stackMat3[i55]; - _this73.stackMat3[i55] = null; - } - _this73.stackMat3 = newArray49; - } - _this73.stackMat3[_this73.sizeMat3++] = mat311; - } - if(mat412 != null) { - var t0025 = 1; - var t0125 = 0; - var t0225 = 0; - var t0312 = 0; - var t1025 = 0; - var t1125 = 1; - var t1225 = 0; - var t1312 = 0; - var t2025 = 0; - var t2125 = 0; - var t2225 = 1; - var t2312 = 0; - var t3012 = 0; - var t3112 = 0; - var t3212 = 0; - var t3312 = 1; - mat412.e00 = t0025; - mat412.e01 = t0125; - mat412.e02 = t0225; - mat412.e03 = t0312; - mat412.e10 = t1025; - mat412.e11 = t1125; - mat412.e12 = t1225; - mat412.e13 = t1312; - mat412.e20 = t2025; - mat412.e21 = t2125; - mat412.e22 = t2225; - mat412.e23 = t2312; - mat412.e30 = t3012; - mat412.e31 = t3112; - mat412.e32 = t3212; - mat412.e33 = t3312; - if(_this73.sizeMat4 == _this73.stackMat4.length) { - var newLength50 = _this73.sizeMat4 << 1; - var this51 = new Array(newLength50); - var newArray50 = this51; - var _g74 = 0; - var _g153 = _this73.sizeMat4; - while(_g74 < _g153) { - var i56 = _g74++; - newArray50[i56] = _this73.stackMat4[i56]; - _this73.stackMat4[i56] = null; - } - _this73.stackMat4 = newArray50; - } - _this73.stackMat4[_this73.sizeMat4++] = mat412; - } - if(quat12 != null) { - var tx42 = 0; - var ty42 = 0; - var tz42 = 0; - var tw12 = 1; - quat12.x = tx42; - quat12.y = ty42; - quat12.z = tz42; - quat12.w = tw12; - if(_this73.sizeQuat == _this73.stackQuat.length) { - var newLength51 = _this73.sizeQuat << 1; - var this52 = new Array(newLength51); - var newArray51 = this52; - var _g75 = 0; - var _g154 = _this73.sizeQuat; - while(_g75 < _g154) { - var i57 = _g75++; - newArray51[i57] = _this73.stackQuat[i57]; - _this73.stackQuat[i57] = null; - } - _this73.stackQuat = newArray51; - } - _this73.stackQuat[_this73.sizeQuat++] = quat12; - } - var _this74 = this.p; - var mat312 = null; - var mat413 = null; - var quat13 = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; + } + _this15.stackVec3 = newArray; + } + _this15.stackVec3[_this15.sizeVec3++] = ex; + } + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this74.sizeVec3 == _this74.stackVec3.length) { - var newLength52 = _this74.sizeVec3 << 1; - var this53 = new Array(newLength52); - var newArray52 = this53; - var _g76 = 0; - var _g155 = _this74.sizeVec3; - while(_g76 < _g155) { - var i58 = _g76++; - newArray52[i58] = _this74.stackVec3[i58]; - _this74.stackVec3[i58] = null; - } - _this74.stackVec3 = newArray52; - } - _this74.stackVec3[_this74.sizeVec3++] = ey; - } - if(mat312 != null) { - var t0026 = 1; - var t0126 = 0; - var t0226 = 0; - var t1026 = 0; - var t1126 = 1; - var t1226 = 0; - var t2026 = 0; - var t2126 = 0; - var t2226 = 1; - mat312.e00 = t0026; - mat312.e01 = t0126; - mat312.e02 = t0226; - mat312.e10 = t1026; - mat312.e11 = t1126; - mat312.e12 = t1226; - mat312.e20 = t2026; - mat312.e21 = t2126; - mat312.e22 = t2226; - if(_this74.sizeMat3 == _this74.stackMat3.length) { - var newLength53 = _this74.sizeMat3 << 1; - var this54 = new Array(newLength53); - var newArray53 = this54; - var _g77 = 0; - var _g156 = _this74.sizeMat3; - while(_g77 < _g156) { - var i59 = _g77++; - newArray53[i59] = _this74.stackMat3[i59]; - _this74.stackMat3[i59] = null; - } - _this74.stackMat3 = newArray53; - } - _this74.stackMat3[_this74.sizeMat3++] = mat312; - } - if(mat413 != null) { - var t0027 = 1; - var t0127 = 0; - var t0227 = 0; - var t0313 = 0; - var t1027 = 0; - var t1127 = 1; - var t1227 = 0; - var t1313 = 0; - var t2027 = 0; - var t2127 = 0; - var t2227 = 1; - var t2313 = 0; - var t3013 = 0; - var t3113 = 0; - var t3213 = 0; - var t3313 = 1; - mat413.e00 = t0027; - mat413.e01 = t0127; - mat413.e02 = t0227; - mat413.e03 = t0313; - mat413.e10 = t1027; - mat413.e11 = t1127; - mat413.e12 = t1227; - mat413.e13 = t1313; - mat413.e20 = t2027; - mat413.e21 = t2127; - mat413.e22 = t2227; - mat413.e23 = t2313; - mat413.e30 = t3013; - mat413.e31 = t3113; - mat413.e32 = t3213; - mat413.e33 = t3313; - if(_this74.sizeMat4 == _this74.stackMat4.length) { - var newLength54 = _this74.sizeMat4 << 1; - var this55 = new Array(newLength54); - var newArray54 = this55; - var _g78 = 0; - var _g157 = _this74.sizeMat4; - while(_g78 < _g157) { - var i60 = _g78++; - newArray54[i60] = _this74.stackMat4[i60]; - _this74.stackMat4[i60] = null; - } - _this74.stackMat4 = newArray54; - } - _this74.stackMat4[_this74.sizeMat4++] = mat413; - } - if(quat13 != null) { - var tx43 = 0; - var ty43 = 0; - var tz43 = 0; - var tw13 = 1; - quat13.x = tx43; - quat13.y = ty43; - quat13.z = tz43; - quat13.w = tw13; - if(_this74.sizeQuat == _this74.stackQuat.length) { - var newLength55 = _this74.sizeQuat << 1; - var this56 = new Array(newLength55); - var newArray55 = this56; - var _g79 = 0; - var _g158 = _this74.sizeQuat; - while(_g79 < _g158) { - var i61 = _g79++; - newArray55[i61] = _this74.stackQuat[i61]; - _this74.stackQuat[i61] = null; - } - _this74.stackQuat = newArray55; - } - _this74.stackQuat[_this74.sizeQuat++] = quat13; - } - var _this75 = this.p; - var mat313 = null; - var mat414 = null; - var quat14 = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; + } + _this16.stackVec3 = newArray; + } + _this16.stackVec3[_this16.sizeVec3++] = ey; + } + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this75.sizeVec3 == _this75.stackVec3.length) { - var newLength56 = _this75.sizeVec3 << 1; - var this57 = new Array(newLength56); - var newArray56 = this57; - var _g80 = 0; - var _g159 = _this75.sizeVec3; - while(_g80 < _g159) { - var i62 = _g80++; - newArray56[i62] = _this75.stackVec3[i62]; - _this75.stackVec3[i62] = null; - } - _this75.stackVec3 = newArray56; - } - _this75.stackVec3[_this75.sizeVec3++] = ez; - } - if(mat313 != null) { - var t0028 = 1; - var t0128 = 0; - var t0228 = 0; - var t1028 = 0; - var t1128 = 1; - var t1228 = 0; - var t2028 = 0; - var t2128 = 0; - var t2228 = 1; - mat313.e00 = t0028; - mat313.e01 = t0128; - mat313.e02 = t0228; - mat313.e10 = t1028; - mat313.e11 = t1128; - mat313.e12 = t1228; - mat313.e20 = t2028; - mat313.e21 = t2128; - mat313.e22 = t2228; - if(_this75.sizeMat3 == _this75.stackMat3.length) { - var newLength57 = _this75.sizeMat3 << 1; - var this58 = new Array(newLength57); - var newArray57 = this58; - var _g81 = 0; - var _g160 = _this75.sizeMat3; - while(_g81 < _g160) { - var i63 = _g81++; - newArray57[i63] = _this75.stackMat3[i63]; - _this75.stackMat3[i63] = null; - } - _this75.stackMat3 = newArray57; - } - _this75.stackMat3[_this75.sizeMat3++] = mat313; - } - if(mat414 != null) { - var t0029 = 1; - var t0129 = 0; - var t0229 = 0; - var t0314 = 0; - var t1029 = 0; - var t1129 = 1; - var t1229 = 0; - var t1314 = 0; - var t2029 = 0; - var t2129 = 0; - var t2229 = 1; - var t2314 = 0; - var t3014 = 0; - var t3114 = 0; - var t3214 = 0; - var t3314 = 1; - mat414.e00 = t0029; - mat414.e01 = t0129; - mat414.e02 = t0229; - mat414.e03 = t0314; - mat414.e10 = t1029; - mat414.e11 = t1129; - mat414.e12 = t1229; - mat414.e13 = t1314; - mat414.e20 = t2029; - mat414.e21 = t2129; - mat414.e22 = t2229; - mat414.e23 = t2314; - mat414.e30 = t3014; - mat414.e31 = t3114; - mat414.e32 = t3214; - mat414.e33 = t3314; - if(_this75.sizeMat4 == _this75.stackMat4.length) { - var newLength58 = _this75.sizeMat4 << 1; - var this59 = new Array(newLength58); - var newArray58 = this59; - var _g82 = 0; - var _g161 = _this75.sizeMat4; - while(_g82 < _g161) { - var i64 = _g82++; - newArray58[i64] = _this75.stackMat4[i64]; - _this75.stackMat4[i64] = null; - } - _this75.stackMat4 = newArray58; - } - _this75.stackMat4[_this75.sizeMat4++] = mat414; - } - if(quat14 != null) { - var tx44 = 0; - var ty44 = 0; - var tz44 = 0; - var tw14 = 1; - quat14.x = tx44; - quat14.y = ty44; - quat14.z = tz44; - quat14.w = tw14; - if(_this75.sizeQuat == _this75.stackQuat.length) { - var newLength59 = _this75.sizeQuat << 1; - var this60 = new Array(newLength59); - var newArray59 = this60; - var _g83 = 0; - var _g162 = _this75.sizeQuat; - while(_g83 < _g162) { - var i65 = _g83++; - newArray59[i65] = _this75.stackQuat[i65]; - _this75.stackQuat[i65] = null; - } - _this75.stackQuat = newArray59; - } - _this75.stackQuat[_this75.sizeQuat++] = quat14; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; } } sphere(tf,radius,color) { - var _this = this.p; - var o = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var m = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; - var v = o; + let _this = this.p; + let o = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let m = _this1.sizeMat3 == 0 ? new oimo.common.Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -35067,388 +20312,158 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { m1.e20 = tf._rotation20; m1.e21 = tf._rotation21; m1.e22 = tf._rotation22; - var nt = 4; - var np = 8; - var vs = this.tmpSphereVerts; - var ns = this.tmpSphereNorms; - var _g = 0; - var _g1 = nt + 1; - while(_g < _g1) { - var i = _g++; - var n = this.tmpSphereVerts[i].length; - var _g2 = 0; - var _g11 = n; - while(_g2 < _g11) { - var j = _g2++; - var _this2 = ns[i][j]; - var v1 = this.sphereCoords[i][j]; - _this2.x = v1.x; - _this2.y = v1.y; - _this2.z = v1.z; - var _this3 = _this2; - var tx = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; - var ty = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; - var tz = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; - _this3.x = tx; - _this3.y = ty; - _this3.z = tz; - var _this4 = vs[i][j]; - var v2 = ns[i][j]; - _this4.x = v2.x; - _this4.y = v2.y; - _this4.z = v2.z; - var _this5 = _this4; - var tx1 = _this5.x * radius; - var ty1 = _this5.y * radius; - var tz1 = _this5.z * radius; - _this5.x = tx1; - _this5.y = ty1; - _this5.z = tz1; - var _this6 = _this5; - var tx2 = _this6.x + o.x; - var ty2 = _this6.y + o.y; - var tz2 = _this6.z + o.z; - _this6.x = tx2; - _this6.y = ty2; - _this6.z = tz2; - } - } - var _g21 = 0; - var _g3 = nt; - while(_g21 < _g3) { - var i1 = _g21++; - var _g22 = 0; - var _g31 = np; - while(_g22 < _g31) { - var j1 = _g22++; - var v11; - var v21; - var v3; - var v4; - var n1; - var n2; - var n3; - var n4; - if(i1 == 0) { + let vs = this.tmpSphereVerts; + let ns = this.tmpSphereNorms; + let _g = 0; + while(_g < 5) { + let i = _g++; + let n = this.tmpSphereVerts[i].length; + let _g1 = 0; + while(_g1 < n) { + let j = _g1++; + let _this = ns[i][j]; + let v = this.sphereCoords[i][j]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = vs[i][j]; + let v1 = ns[i][j]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + } + } + let _g1 = 0; + while(_g1 < 4) { + let i = _g1++; + let _g = 0; + while(_g < 8) { + let j = _g++; + let v1; + let v2; + let v3; + let v4; + let n1; + let n2; + let n3; + let n4; + if(i == 0) { if(this.wireframe) { - v11 = vs[0][0]; - v21 = vs[1][j1]; - this.line(v11,v21,color); + v1 = vs[0][0]; + v2 = vs[1][j]; + this.line(v1,v2,color); } else { - v11 = vs[0][0]; - v21 = vs[1][j1]; - v3 = vs[1][(j1 + 1) % np]; + v1 = vs[0][0]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; n1 = ns[0][0]; - n2 = ns[1][j1]; - n3 = ns[1][(j1 + 1) % np]; - this.triangle(v11,v21,v3,n1,n2,n3,color); + n2 = ns[1][j]; + n3 = ns[1][(j + 1) % 8]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } - } else if(i1 == nt - 1) { + } else if(i == 3) { if(this.wireframe) { - v11 = vs[nt][0]; - v21 = vs[i1][(j1 + 1) % np]; - v3 = vs[i1][j1]; - this.line(v11,v21,color); - this.line(v21,v3,color); + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v1,v2,color); + this.line(v2,v3,color); } else { - v11 = vs[nt][0]; - v21 = vs[i1][(j1 + 1) % np]; - v3 = vs[i1][j1]; - n1 = ns[nt][0]; - n2 = ns[i1][(j1 + 1) % np]; - n3 = ns[i1][j1]; - this.triangle(v11,v21,v3,n1,n2,n3,color); + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + n1 = ns[4][0]; + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i][j]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(this.wireframe) { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % np]; - v3 = vs[i1 + 1][j1]; - this.line(v11,v21,color); - this.line(v11,v3,color); + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v1,v2,color); + this.line(v1,v3,color); } else { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % np]; - v3 = vs[i1 + 1][j1]; - v4 = vs[i1 + 1][(j1 + 1) % np]; - n1 = ns[i1][j1]; - n2 = ns[i1][(j1 + 1) % np]; - n3 = ns[i1 + 1][j1]; - n4 = ns[i1 + 1][(j1 + 1) % np]; - this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); - } - } - } - var _this7 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; - if(o != null) { - o.zero(); - if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newLength = _this7.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g4 = 0; - var _g12 = _this7.sizeVec3; - while(_g4 < _g12) { - var i2 = _g4++; - newArray[i2] = _this7.stackVec3[i2]; - _this7.stackVec3[i2] = null; + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % 8]; + n1 = ns[i][j]; + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i + 1][j]; + n4 = ns[i + 1][(j + 1) % 8]; + this.rect(v1,v3,v4,v2,n1,n3,n4,n2,color); } - _this7.stackVec3 = newArray; } - _this7.stackVec3[_this7.sizeVec3++] = o; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this7.sizeMat3 == _this7.stackMat3.length) { - var newLength1 = _this7.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g5 = 0; - var _g13 = _this7.sizeMat3; - while(_g5 < _g13) { - var i3 = _g5++; - newArray1[i3] = _this7.stackMat3[i3]; - _this7.stackMat3[i3] = null; - } - _this7.stackMat3 = newArray1; - } - _this7.stackMat3[_this7.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this7.sizeMat4 == _this7.stackMat4.length) { - var newLength2 = _this7.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g6 = 0; - var _g14 = _this7.sizeMat4; - while(_g6 < _g14) { - var i4 = _g6++; - newArray2[i4] = _this7.stackMat4[i4]; - _this7.stackMat4[i4] = null; - } - _this7.stackMat4 = newArray2; - } - _this7.stackMat4[_this7.sizeMat4++] = mat4; } - if(quat != null) { - var tx3 = 0; - var ty3 = 0; - var tz3 = 0; - var tw = 1; - quat.x = tx3; - quat.y = ty3; - quat.z = tz3; - quat.w = tw; - if(_this7.sizeQuat == _this7.stackQuat.length) { - var newLength3 = _this7.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g7 = 0; - var _g15 = _this7.sizeQuat; - while(_g7 < _g15) { - var i5 = _g7++; - newArray3[i5] = _this7.stackQuat[i5]; - _this7.stackQuat[i5] = null; - } - _this7.stackQuat = newArray3; - } - _this7.stackQuat[_this7.sizeQuat++] = quat; - } - var _this8 = this.p; - var vec3 = null; - var mat41 = null; - var quat1 = null; - if(vec3 != null) { - vec3.zero(); - if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newLength4 = _this8.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g8 = 0; - var _g16 = _this8.sizeVec3; - while(_g8 < _g16) { - var i6 = _g8++; - newArray4[i6] = _this8.stackVec3[i6]; - _this8.stackVec3[i6] = null; + let _this2 = this.p; + if(o != null) { + o.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this8.stackVec3 = newArray4; + _this2.stackVec3 = newArray; } - _this8.stackVec3[_this8.sizeVec3++] = vec3; + _this2.stackVec3[_this2.sizeVec3++] = o; } + let _this3 = this.p; if(m != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - m.e00 = t002; - m.e01 = t012; - m.e02 = t022; - m.e10 = t102; - m.e11 = t112; - m.e12 = t122; - m.e20 = t202; - m.e21 = t212; - m.e22 = t222; - if(_this8.sizeMat3 == _this8.stackMat3.length) { - var newLength5 = _this8.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g9 = 0; - var _g17 = _this8.sizeMat3; - while(_g9 < _g17) { - var i7 = _g9++; - newArray5[i7] = _this8.stackMat3[i7]; - _this8.stackMat3[i7] = null; - } - _this8.stackMat3 = newArray5; - } - _this8.stackMat3[_this8.sizeMat3++] = m; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this8.sizeMat4 == _this8.stackMat4.length) { - var newLength6 = _this8.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g10 = 0; - var _g18 = _this8.sizeMat4; - while(_g10 < _g18) { - var i8 = _g10++; - newArray6[i8] = _this8.stackMat4[i8]; - _this8.stackMat4[i8] = null; - } - _this8.stackMat4 = newArray6; - } - _this8.stackMat4[_this8.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx4 = 0; - var ty4 = 0; - var tz4 = 0; - var tw1 = 1; - quat1.x = tx4; - quat1.y = ty4; - quat1.z = tz4; - quat1.w = tw1; - if(_this8.sizeQuat == _this8.stackQuat.length) { - var newLength7 = _this8.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g19 = 0; - var _g110 = _this8.sizeQuat; - while(_g19 < _g110) { - var i9 = _g19++; - newArray7[i9] = _this8.stackQuat[i9]; - _this8.stackQuat[i9] = null; - } - _this8.stackQuat = newArray7; - } - _this8.stackQuat[_this8.sizeQuat++] = quat1; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this3.sizeMat3 == _this3.stackMat3.length) { + let newArray = new Array(_this3.sizeMat3 << 1); + let _g = 0; + let _g1 = _this3.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackMat3[i]; + _this3.stackMat3[i] = null; + } + _this3.stackMat3 = newArray; + } + _this3.stackMat3[_this3.sizeMat3++] = m; } } box(tf,halfExtents,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo.common.Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo.common.Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo.common.Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -35461,2328 +20476,452 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var hx = halfExtents.x; - var hy = halfExtents.y; - var hz = halfExtents.z; - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let hx = halfExtents.x; + let hy = halfExtents.y; + let hz = halfExtents.z; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo.common.Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; - var s = -hx; - var tx = _this7.x + ex.x * s; - var ty = _this7.y + ex.y * s; - var tz = _this7.z + ex.z * s; - _this7.x = tx; - _this7.y = ty; - _this7.z = tz; - var _this8 = _this7; - var s1 = -hy; - var tx1 = _this8.x + ey.x * s1; - var ty1 = _this8.y + ey.y * s1; - var tz1 = _this8.z + ey.z * s1; - _this8.x = tx1; - _this8.y = ty1; - _this8.z = tz1; - var _this9 = _this8; - var s2 = -hz; - var tx2 = _this9.x + ez.x * s2; - var ty2 = _this9.y + ez.y * s2; - var tz2 = _this9.z + ez.z * s2; - _this9.x = tx2; - _this9.y = ty2; - _this9.z = tz2; - var v1 = _this9; - var _this10 = this.p; - var _this11 = _this10.sizeVec3 == 0 ? new oimo.common.Vec3() : _this10.stackVec3[--_this10.sizeVec3]; - _this11.x = o.x; - _this11.y = o.y; - _this11.z = o.z; - var _this12 = _this11; - var s3 = -hx; - var tx3 = _this12.x + ex.x * s3; - var ty3 = _this12.y + ex.y * s3; - var tz3 = _this12.z + ex.z * s3; - _this12.x = tx3; - _this12.y = ty3; - _this12.z = tz3; - var _this13 = _this12; - var s4 = -hy; - var tx4 = _this13.x + ey.x * s4; - var ty4 = _this13.y + ey.y * s4; - var tz4 = _this13.z + ey.z * s4; - _this13.x = tx4; - _this13.y = ty4; - _this13.z = tz4; - var _this14 = _this13; - var tx5 = _this14.x + ez.x * hz; - var ty5 = _this14.y + ez.y * hz; - var tz5 = _this14.z + ez.z * hz; - _this14.x = tx5; - _this14.y = ty5; - _this14.z = tz5; - var v2 = _this14; - var _this15 = this.p; - var _this16 = _this15.sizeVec3 == 0 ? new oimo.common.Vec3() : _this15.stackVec3[--_this15.sizeVec3]; - _this16.x = o.x; - _this16.y = o.y; - _this16.z = o.z; - var _this17 = _this16; - var s5 = -hx; - var tx6 = _this17.x + ex.x * s5; - var ty6 = _this17.y + ex.y * s5; - var tz6 = _this17.z + ex.z * s5; - _this17.x = tx6; - _this17.y = ty6; - _this17.z = tz6; - var _this18 = _this17; - var tx7 = _this18.x + ey.x * hy; - var ty7 = _this18.y + ey.y * hy; - var tz7 = _this18.z + ey.z * hy; - _this18.x = tx7; - _this18.y = ty7; - _this18.z = tz7; - var _this19 = _this18; - var s6 = -hz; - var tx8 = _this19.x + ez.x * s6; - var ty8 = _this19.y + ez.y * s6; - var tz8 = _this19.z + ez.z * s6; - _this19.x = tx8; - _this19.y = ty8; - _this19.z = tz8; - var v3 = _this19; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + let _this7 = _this6; + let s = -hx; + _this7.x += ex.x * s; + _this7.y += ex.y * s; + _this7.z += ex.z * s; + let s1 = -hy; + _this7.x += ey.x * s1; + _this7.y += ey.y * s1; + _this7.z += ey.z * s1; + let s2 = -hz; + _this7.x += ez.x * s2; + _this7.y += ez.y * s2; + _this7.z += ez.z * s2; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo.common.Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = o.x; + _this9.y = o.y; + _this9.z = o.z; + let _this10 = _this9; + let s3 = -hx; + _this10.x += ex.x * s3; + _this10.y += ex.y * s3; + _this10.z += ex.z * s3; + let s4 = -hy; + _this10.x += ey.x * s4; + _this10.y += ey.y * s4; + _this10.z += ey.z * s4; + _this10.x += ez.x * hz; + _this10.y += ez.y * hz; + _this10.z += ez.z * hz; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo.common.Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = o.x; + _this12.y = o.y; + _this12.z = o.z; + let _this13 = _this12; + let s5 = -hx; + _this13.x += ex.x * s5; + _this13.y += ex.y * s5; + _this13.z += ex.z * s5; + _this13.x += ey.x * hy; + _this13.y += ey.y * hy; + _this13.z += ey.z * hy; + let s6 = -hz; + _this13.x += ez.x * s6; + _this13.y += ez.y * s6; + _this13.z += ez.z * s6; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo.common.Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = o.x; + _this15.y = o.y; + _this15.z = o.z; + let _this16 = _this15; + let s7 = -hx; + _this16.x += ex.x * s7; + _this16.y += ex.y * s7; + _this16.z += ex.z * s7; + _this16.x += ey.x * hy; + _this16.y += ey.y * hy; + _this16.z += ey.z * hy; + _this16.x += ez.x * hz; + _this16.y += ez.y * hz; + _this16.z += ez.z * hz; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo.common.Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = o.x; + _this18.y = o.y; + _this18.z = o.z; + let _this19 = _this18; + _this19.x += ex.x * hx; + _this19.y += ex.y * hx; + _this19.z += ex.z * hx; + let s8 = -hy; + _this19.x += ey.x * s8; + _this19.y += ey.y * s8; + _this19.z += ey.z * s8; + let s9 = -hz; + _this19.x += ez.x * s9; + _this19.y += ez.y * s9; + _this19.z += ez.z * s9; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo.common.Vec3() : _this20.stackVec3[--_this20.sizeVec3]; _this21.x = o.x; _this21.y = o.y; _this21.z = o.z; - var _this22 = _this21; - var s7 = -hx; - var tx9 = _this22.x + ex.x * s7; - var ty9 = _this22.y + ex.y * s7; - var tz9 = _this22.z + ex.z * s7; - _this22.x = tx9; - _this22.y = ty9; - _this22.z = tz9; - var _this23 = _this22; - var tx10 = _this23.x + ey.x * hy; - var ty10 = _this23.y + ey.y * hy; - var tz10 = _this23.z + ey.z * hy; - _this23.x = tx10; - _this23.y = ty10; - _this23.z = tz10; - var _this24 = _this23; - var tx11 = _this24.x + ez.x * hz; - var ty11 = _this24.y + ez.y * hz; - var tz11 = _this24.z + ez.z * hz; - _this24.x = tx11; - _this24.y = ty11; - _this24.z = tz11; - var v4 = _this24; - var _this25 = this.p; - var _this26 = _this25.sizeVec3 == 0 ? new oimo.common.Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - _this26.x = o.x; - _this26.y = o.y; - _this26.z = o.z; - var _this27 = _this26; - var tx12 = _this27.x + ex.x * hx; - var ty12 = _this27.y + ex.y * hx; - var tz12 = _this27.z + ex.z * hx; - _this27.x = tx12; - _this27.y = ty12; - _this27.z = tz12; - var _this28 = _this27; - var s8 = -hy; - var tx13 = _this28.x + ey.x * s8; - var ty13 = _this28.y + ey.y * s8; - var tz13 = _this28.z + ey.z * s8; - _this28.x = tx13; - _this28.y = ty13; - _this28.z = tz13; - var _this29 = _this28; - var s9 = -hz; - var tx14 = _this29.x + ez.x * s9; - var ty14 = _this29.y + ez.y * s9; - var tz14 = _this29.z + ez.z * s9; - _this29.x = tx14; - _this29.y = ty14; - _this29.z = tz14; - var v5 = _this29; - var _this30 = this.p; - var _this31 = _this30.sizeVec3 == 0 ? new oimo.common.Vec3() : _this30.stackVec3[--_this30.sizeVec3]; - _this31.x = o.x; - _this31.y = o.y; - _this31.z = o.z; - var _this32 = _this31; - var tx15 = _this32.x + ex.x * hx; - var ty15 = _this32.y + ex.y * hx; - var tz15 = _this32.z + ex.z * hx; - _this32.x = tx15; - _this32.y = ty15; - _this32.z = tz15; - var _this33 = _this32; - var s10 = -hy; - var tx16 = _this33.x + ey.x * s10; - var ty16 = _this33.y + ey.y * s10; - var tz16 = _this33.z + ey.z * s10; - _this33.x = tx16; - _this33.y = ty16; - _this33.z = tz16; - var _this34 = _this33; - var tx17 = _this34.x + ez.x * hz; - var ty17 = _this34.y + ez.y * hz; - var tz17 = _this34.z + ez.z * hz; - _this34.x = tx17; - _this34.y = ty17; - _this34.z = tz17; - var v6 = _this34; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo.common.Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = o.x; - _this36.y = o.y; - _this36.z = o.z; - var _this37 = _this36; - var tx18 = _this37.x + ex.x * hx; - var ty18 = _this37.y + ex.y * hx; - var tz18 = _this37.z + ex.z * hx; - _this37.x = tx18; - _this37.y = ty18; - _this37.z = tz18; - var _this38 = _this37; - var tx19 = _this38.x + ey.x * hy; - var ty19 = _this38.y + ey.y * hy; - var tz19 = _this38.z + ey.z * hy; - _this38.x = tx19; - _this38.y = ty19; - _this38.z = tz19; - var _this39 = _this38; - var s11 = -hz; - var tx20 = _this39.x + ez.x * s11; - var ty20 = _this39.y + ez.y * s11; - var tz20 = _this39.z + ez.z * s11; - _this39.x = tx20; - _this39.y = ty20; - _this39.z = tz20; - var v7 = _this39; - var _this40 = this.p; - var _this41 = _this40.sizeVec3 == 0 ? new oimo.common.Vec3() : _this40.stackVec3[--_this40.sizeVec3]; - _this41.x = o.x; - _this41.y = o.y; - _this41.z = o.z; - var _this42 = _this41; - var tx21 = _this42.x + ex.x * hx; - var ty21 = _this42.y + ex.y * hx; - var tz21 = _this42.z + ex.z * hx; - _this42.x = tx21; - _this42.y = ty21; - _this42.z = tz21; - var _this43 = _this42; - var tx22 = _this43.x + ey.x * hy; - var ty22 = _this43.y + ey.y * hy; - var tz22 = _this43.z + ey.z * hy; - _this43.x = tx22; - _this43.y = ty22; - _this43.z = tz22; - var _this44 = _this43; - var tx23 = _this44.x + ez.x * hz; - var ty23 = _this44.y + ez.y * hz; - var tz23 = _this44.z + ez.z * hz; - _this44.x = tx23; - _this44.y = ty23; - _this44.z = tz23; - var v8 = _this44; + let _this22 = _this21; + _this22.x += ex.x * hx; + _this22.y += ex.y * hx; + _this22.z += ex.z * hx; + let s10 = -hy; + _this22.x += ey.x * s10; + _this22.y += ey.y * s10; + _this22.z += ey.z * s10; + _this22.x += ez.x * hz; + _this22.y += ez.y * hz; + _this22.z += ez.z * hz; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo.common.Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + _this24.x = o.x; + _this24.y = o.y; + _this24.z = o.z; + let _this25 = _this24; + _this25.x += ex.x * hx; + _this25.y += ex.y * hx; + _this25.z += ex.z * hx; + _this25.x += ey.x * hy; + _this25.y += ey.y * hy; + _this25.z += ey.z * hy; + let s11 = -hz; + _this25.x += ez.x * s11; + _this25.y += ez.y * s11; + _this25.z += ez.z * s11; + let _this26 = this.p; + let _this27 = _this26.sizeVec3 == 0 ? new oimo.common.Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + _this27.x = o.x; + _this27.y = o.y; + _this27.z = o.z; + let _this28 = _this27; + _this28.x += ex.x * hx; + _this28.y += ex.y * hx; + _this28.z += ex.z * hx; + _this28.x += ey.x * hy; + _this28.y += ey.y * hy; + _this28.z += ey.z * hy; + _this28.x += ez.x * hz; + _this28.y += ez.y * hz; + _this28.z += ez.z * hz; if(this.wireframe) { - this.line(v1,v2,color); - this.line(v3,v4,color); - this.line(v5,v6,color); - this.line(v7,v8,color); - this.line(v1,v3,color); - this.line(v2,v4,color); - this.line(v5,v7,color); - this.line(v6,v8,color); - this.line(v1,v5,color); - this.line(v2,v6,color); - this.line(v3,v7,color); - this.line(v4,v8,color); + this.line(_this7,_this10,color); + this.line(_this13,_this16,color); + this.line(_this19,_this22,color); + this.line(_this25,_this28,color); + this.line(_this7,_this13,color); + this.line(_this10,_this16,color); + this.line(_this19,_this25,color); + this.line(_this22,_this28,color); + this.line(_this7,_this19,color); + this.line(_this10,_this22,color); + this.line(_this13,_this25,color); + this.line(_this16,_this28,color); } else { - var _this45 = this.p; - var _this46 = _this45.sizeVec3 == 0 ? new oimo.common.Vec3() : _this45.stackVec3[--_this45.sizeVec3]; - _this46.x = ex.x; - _this46.y = ex.y; - _this46.z = ex.z; - var _this47 = _this46; - var tx24 = -_this47.x; - var ty24 = -_this47.y; - var tz24 = -_this47.z; - _this47.x = tx24; - _this47.y = ty24; - _this47.z = tz24; - var nex = _this47; - var _this48 = this.p; - var _this49 = _this48.sizeVec3 == 0 ? new oimo.common.Vec3() : _this48.stackVec3[--_this48.sizeVec3]; - _this49.x = ey.x; - _this49.y = ey.y; - _this49.z = ey.z; - var _this50 = _this49; - var tx25 = -_this50.x; - var ty25 = -_this50.y; - var tz25 = -_this50.z; - _this50.x = tx25; - _this50.y = ty25; - _this50.z = tz25; - var ney = _this50; - var _this51 = this.p; - var _this52 = _this51.sizeVec3 == 0 ? new oimo.common.Vec3() : _this51.stackVec3[--_this51.sizeVec3]; - _this52.x = ez.x; - _this52.y = ez.y; - _this52.z = ez.z; - var _this53 = _this52; - var tx26 = -_this53.x; - var ty26 = -_this53.y; - var tz26 = -_this53.z; - _this53.x = tx26; - _this53.y = ty26; - _this53.z = tz26; - var nez = _this53; - this.rect(v1,v2,v4,v3,nex,nex,nex,nex,color); - this.rect(v5,v7,v8,v6,ex,ex,ex,ex,color); - this.rect(v1,v5,v6,v2,ney,ney,ney,ney,color); - this.rect(v3,v4,v8,v7,ey,ey,ey,ey,color); - this.rect(v1,v3,v7,v5,nez,nez,nez,nez,color); - this.rect(v2,v6,v8,v4,ez,ez,ez,ez,color); - var _this54 = this.p; - var mat3 = null; - var mat4 = null; - var quat = null; - if(nex != null) { - nex.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newLength = _this54.sizeVec3 << 1; - var this1 = new Array(newLength); - var newArray = this1; - var _g = 0; - var _g1 = _this54.sizeVec3; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo.common.Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ex.x; + _this1.y = ex.y; + _this1.z = ex.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = ey.x; + _this4.y = ey.y; + _this4.z = ey.z; + let _this5 = _this4; + _this5.x = -_this5.x; + _this5.y = -_this5.y; + _this5.z = -_this5.z; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo.common.Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = ez.x; + _this8.y = ez.y; + _this8.z = ez.z; + let _this9 = _this8; + _this9.x = -_this9.x; + _this9.y = -_this9.y; + _this9.z = -_this9.z; + this.rect(_this7,_this10,_this16,_this13,_this2,_this2,_this2,_this2,color); + this.rect(_this19,_this25,_this28,_this22,ex,ex,ex,ex,color); + this.rect(_this7,_this19,_this22,_this10,_this5,_this5,_this5,_this5,color); + this.rect(_this13,_this16,_this28,_this25,ey,ey,ey,ey,color); + this.rect(_this7,_this13,_this25,_this19,_this9,_this9,_this9,_this9,color); + this.rect(_this10,_this22,_this28,_this16,ez,ez,ez,ez,color); + let _this11 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this54.stackVec3[i]; - _this54.stackVec3[i] = null; - } - _this54.stackVec3 = newArray; - } - _this54.stackVec3[_this54.sizeVec3++] = nex; - } - if(mat3 != null) { - var t00 = 1; - var t01 = 0; - var t02 = 0; - var t10 = 0; - var t11 = 1; - var t12 = 0; - var t20 = 0; - var t21 = 0; - var t22 = 1; - mat3.e00 = t00; - mat3.e01 = t01; - mat3.e02 = t02; - mat3.e10 = t10; - mat3.e11 = t11; - mat3.e12 = t12; - mat3.e20 = t20; - mat3.e21 = t21; - mat3.e22 = t22; - if(_this54.sizeMat3 == _this54.stackMat3.length) { - var newLength1 = _this54.sizeMat3 << 1; - var this2 = new Array(newLength1); - var newArray1 = this2; - var _g2 = 0; - var _g11 = _this54.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this54.stackMat3[i1]; - _this54.stackMat3[i1] = null; - } - _this54.stackMat3 = newArray1; - } - _this54.stackMat3[_this54.sizeMat3++] = mat3; - } - if(mat4 != null) { - var t001 = 1; - var t011 = 0; - var t021 = 0; - var t03 = 0; - var t101 = 0; - var t111 = 1; - var t121 = 0; - var t13 = 0; - var t201 = 0; - var t211 = 0; - var t221 = 1; - var t23 = 0; - var t30 = 0; - var t31 = 0; - var t32 = 0; - var t33 = 1; - mat4.e00 = t001; - mat4.e01 = t011; - mat4.e02 = t021; - mat4.e03 = t03; - mat4.e10 = t101; - mat4.e11 = t111; - mat4.e12 = t121; - mat4.e13 = t13; - mat4.e20 = t201; - mat4.e21 = t211; - mat4.e22 = t221; - mat4.e23 = t23; - mat4.e30 = t30; - mat4.e31 = t31; - mat4.e32 = t32; - mat4.e33 = t33; - if(_this54.sizeMat4 == _this54.stackMat4.length) { - var newLength2 = _this54.sizeMat4 << 1; - var this3 = new Array(newLength2); - var newArray2 = this3; - var _g3 = 0; - var _g12 = _this54.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this54.stackMat4[i2]; - _this54.stackMat4[i2] = null; + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this54.stackMat4 = newArray2; - } - _this54.stackMat4[_this54.sizeMat4++] = mat4; - } - if(quat != null) { - var tx27 = 0; - var ty27 = 0; - var tz27 = 0; - var tw = 1; - quat.x = tx27; - quat.y = ty27; - quat.z = tz27; - quat.w = tw; - if(_this54.sizeQuat == _this54.stackQuat.length) { - var newLength3 = _this54.sizeQuat << 1; - var this4 = new Array(newLength3); - var newArray3 = this4; - var _g4 = 0; - var _g13 = _this54.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this54.stackQuat[i3]; - _this54.stackQuat[i3] = null; - } - _this54.stackQuat = newArray3; - } - _this54.stackQuat[_this54.sizeQuat++] = quat; - } - var _this55 = this.p; - var mat31 = null; - var mat41 = null; - var quat1 = null; - if(ney != null) { - ney.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newLength4 = _this55.sizeVec3 << 1; - var this5 = new Array(newLength4); - var newArray4 = this5; - var _g5 = 0; - var _g14 = _this55.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this55.stackVec3[i4]; - _this55.stackVec3[i4] = null; - } - _this55.stackVec3 = newArray4; - } - _this55.stackVec3[_this55.sizeVec3++] = ney; - } - if(mat31 != null) { - var t002 = 1; - var t012 = 0; - var t022 = 0; - var t102 = 0; - var t112 = 1; - var t122 = 0; - var t202 = 0; - var t212 = 0; - var t222 = 1; - mat31.e00 = t002; - mat31.e01 = t012; - mat31.e02 = t022; - mat31.e10 = t102; - mat31.e11 = t112; - mat31.e12 = t122; - mat31.e20 = t202; - mat31.e21 = t212; - mat31.e22 = t222; - if(_this55.sizeMat3 == _this55.stackMat3.length) { - var newLength5 = _this55.sizeMat3 << 1; - var this6 = new Array(newLength5); - var newArray5 = this6; - var _g6 = 0; - var _g15 = _this55.sizeMat3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this55.stackMat3[i5]; - _this55.stackMat3[i5] = null; - } - _this55.stackMat3 = newArray5; - } - _this55.stackMat3[_this55.sizeMat3++] = mat31; - } - if(mat41 != null) { - var t003 = 1; - var t013 = 0; - var t023 = 0; - var t031 = 0; - var t103 = 0; - var t113 = 1; - var t123 = 0; - var t131 = 0; - var t203 = 0; - var t213 = 0; - var t223 = 1; - var t231 = 0; - var t301 = 0; - var t311 = 0; - var t321 = 0; - var t331 = 1; - mat41.e00 = t003; - mat41.e01 = t013; - mat41.e02 = t023; - mat41.e03 = t031; - mat41.e10 = t103; - mat41.e11 = t113; - mat41.e12 = t123; - mat41.e13 = t131; - mat41.e20 = t203; - mat41.e21 = t213; - mat41.e22 = t223; - mat41.e23 = t231; - mat41.e30 = t301; - mat41.e31 = t311; - mat41.e32 = t321; - mat41.e33 = t331; - if(_this55.sizeMat4 == _this55.stackMat4.length) { - var newLength6 = _this55.sizeMat4 << 1; - var this7 = new Array(newLength6); - var newArray6 = this7; - var _g7 = 0; - var _g16 = _this55.sizeMat4; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this55.stackMat4[i6]; - _this55.stackMat4[i6] = null; - } - _this55.stackMat4 = newArray6; - } - _this55.stackMat4[_this55.sizeMat4++] = mat41; - } - if(quat1 != null) { - var tx28 = 0; - var ty28 = 0; - var tz28 = 0; - var tw1 = 1; - quat1.x = tx28; - quat1.y = ty28; - quat1.z = tz28; - quat1.w = tw1; - if(_this55.sizeQuat == _this55.stackQuat.length) { - var newLength7 = _this55.sizeQuat << 1; - var this8 = new Array(newLength7); - var newArray7 = this8; - var _g8 = 0; - var _g17 = _this55.sizeQuat; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this55.stackQuat[i7]; - _this55.stackQuat[i7] = null; - } - _this55.stackQuat = newArray7; - } - _this55.stackQuat[_this55.sizeQuat++] = quat1; - } - var _this56 = this.p; - var mat32 = null; - var mat42 = null; - var quat2 = null; - if(nez != null) { - nez.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newLength8 = _this56.sizeVec3 << 1; - var this9 = new Array(newLength8); - var newArray8 = this9; - var _g9 = 0; - var _g18 = _this56.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this56.stackVec3[i8]; - _this56.stackVec3[i8] = null; - } - _this56.stackVec3 = newArray8; - } - _this56.stackVec3[_this56.sizeVec3++] = nez; - } - if(mat32 != null) { - var t004 = 1; - var t014 = 0; - var t024 = 0; - var t104 = 0; - var t114 = 1; - var t124 = 0; - var t204 = 0; - var t214 = 0; - var t224 = 1; - mat32.e00 = t004; - mat32.e01 = t014; - mat32.e02 = t024; - mat32.e10 = t104; - mat32.e11 = t114; - mat32.e12 = t124; - mat32.e20 = t204; - mat32.e21 = t214; - mat32.e22 = t224; - if(_this56.sizeMat3 == _this56.stackMat3.length) { - var newLength9 = _this56.sizeMat3 << 1; - var this10 = new Array(newLength9); - var newArray9 = this10; - var _g10 = 0; - var _g19 = _this56.sizeMat3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this56.stackMat3[i9]; - _this56.stackMat3[i9] = null; - } - _this56.stackMat3 = newArray9; - } - _this56.stackMat3[_this56.sizeMat3++] = mat32; - } - if(mat42 != null) { - var t005 = 1; - var t015 = 0; - var t025 = 0; - var t032 = 0; - var t105 = 0; - var t115 = 1; - var t125 = 0; - var t132 = 0; - var t205 = 0; - var t215 = 0; - var t225 = 1; - var t232 = 0; - var t302 = 0; - var t312 = 0; - var t322 = 0; - var t332 = 1; - mat42.e00 = t005; - mat42.e01 = t015; - mat42.e02 = t025; - mat42.e03 = t032; - mat42.e10 = t105; - mat42.e11 = t115; - mat42.e12 = t125; - mat42.e13 = t132; - mat42.e20 = t205; - mat42.e21 = t215; - mat42.e22 = t225; - mat42.e23 = t232; - mat42.e30 = t302; - mat42.e31 = t312; - mat42.e32 = t322; - mat42.e33 = t332; - if(_this56.sizeMat4 == _this56.stackMat4.length) { - var newLength10 = _this56.sizeMat4 << 1; - var this11 = new Array(newLength10); - var newArray10 = this11; - var _g20 = 0; - var _g110 = _this56.sizeMat4; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this56.stackMat4[i10]; - _this56.stackMat4[i10] = null; + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this2; + } + let _this12 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this56.stackMat4 = newArray10; - } - _this56.stackMat4[_this56.sizeMat4++] = mat42; - } - if(quat2 != null) { - var tx29 = 0; - var ty29 = 0; - var tz29 = 0; - var tw2 = 1; - quat2.x = tx29; - quat2.y = ty29; - quat2.z = tz29; - quat2.w = tw2; - if(_this56.sizeQuat == _this56.stackQuat.length) { - var newLength11 = _this56.sizeQuat << 1; - var this12 = new Array(newLength11); - var newArray11 = this12; - var _g21 = 0; - var _g111 = _this56.sizeQuat; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this56.stackQuat[i11]; - _this56.stackQuat[i11] = null; + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = _this5; + } + let _this14 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this56.stackQuat = newArray11; + _this14.stackVec3 = newArray; } - _this56.stackQuat[_this56.sizeQuat++] = quat2; + _this14.stackVec3[_this14.sizeVec3++] = _this9; } } - var _this57 = this.p; - var mat33 = null; - var mat43 = null; - var quat3 = null; - if(v1 != null) { - v1.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newLength12 = _this57.sizeVec3 << 1; - var this13 = new Array(newLength12); - var newArray12 = this13; - var _g22 = 0; - var _g112 = _this57.sizeVec3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this57.stackVec3[i12]; - _this57.stackVec3[i12] = null; - } - _this57.stackVec3 = newArray12; - } - _this57.stackVec3[_this57.sizeVec3++] = v1; - } - if(mat33 != null) { - var t006 = 1; - var t016 = 0; - var t026 = 0; - var t106 = 0; - var t116 = 1; - var t126 = 0; - var t206 = 0; - var t216 = 0; - var t226 = 1; - mat33.e00 = t006; - mat33.e01 = t016; - mat33.e02 = t026; - mat33.e10 = t106; - mat33.e11 = t116; - mat33.e12 = t126; - mat33.e20 = t206; - mat33.e21 = t216; - mat33.e22 = t226; - if(_this57.sizeMat3 == _this57.stackMat3.length) { - var newLength13 = _this57.sizeMat3 << 1; - var this14 = new Array(newLength13); - var newArray13 = this14; - var _g23 = 0; - var _g113 = _this57.sizeMat3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this57.stackMat3[i13]; - _this57.stackMat3[i13] = null; - } - _this57.stackMat3 = newArray13; - } - _this57.stackMat3[_this57.sizeMat3++] = mat33; - } - if(mat43 != null) { - var t007 = 1; - var t017 = 0; - var t027 = 0; - var t033 = 0; - var t107 = 0; - var t117 = 1; - var t127 = 0; - var t133 = 0; - var t207 = 0; - var t217 = 0; - var t227 = 1; - var t233 = 0; - var t303 = 0; - var t313 = 0; - var t323 = 0; - var t333 = 1; - mat43.e00 = t007; - mat43.e01 = t017; - mat43.e02 = t027; - mat43.e03 = t033; - mat43.e10 = t107; - mat43.e11 = t117; - mat43.e12 = t127; - mat43.e13 = t133; - mat43.e20 = t207; - mat43.e21 = t217; - mat43.e22 = t227; - mat43.e23 = t233; - mat43.e30 = t303; - mat43.e31 = t313; - mat43.e32 = t323; - mat43.e33 = t333; - if(_this57.sizeMat4 == _this57.stackMat4.length) { - var newLength14 = _this57.sizeMat4 << 1; - var this15 = new Array(newLength14); - var newArray14 = this15; - var _g24 = 0; - var _g114 = _this57.sizeMat4; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this57.stackMat4[i14]; - _this57.stackMat4[i14] = null; - } - _this57.stackMat4 = newArray14; - } - _this57.stackMat4[_this57.sizeMat4++] = mat43; - } - if(quat3 != null) { - var tx30 = 0; - var ty30 = 0; - var tz30 = 0; - var tw3 = 1; - quat3.x = tx30; - quat3.y = ty30; - quat3.z = tz30; - quat3.w = tw3; - if(_this57.sizeQuat == _this57.stackQuat.length) { - var newLength15 = _this57.sizeQuat << 1; - var this16 = new Array(newLength15); - var newArray15 = this16; - var _g25 = 0; - var _g115 = _this57.sizeQuat; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this57.stackQuat[i15]; - _this57.stackQuat[i15] = null; - } - _this57.stackQuat = newArray15; - } - _this57.stackQuat[_this57.sizeQuat++] = quat3; - } - var _this58 = this.p; - var mat34 = null; - var mat44 = null; - var quat4 = null; - if(v2 != null) { - v2.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newLength16 = _this58.sizeVec3 << 1; - var this17 = new Array(newLength16); - var newArray16 = this17; - var _g26 = 0; - var _g116 = _this58.sizeVec3; - while(_g26 < _g116) { - var i16 = _g26++; - newArray16[i16] = _this58.stackVec3[i16]; - _this58.stackVec3[i16] = null; - } - _this58.stackVec3 = newArray16; - } - _this58.stackVec3[_this58.sizeVec3++] = v2; - } - if(mat34 != null) { - var t008 = 1; - var t018 = 0; - var t028 = 0; - var t108 = 0; - var t118 = 1; - var t128 = 0; - var t208 = 0; - var t218 = 0; - var t228 = 1; - mat34.e00 = t008; - mat34.e01 = t018; - mat34.e02 = t028; - mat34.e10 = t108; - mat34.e11 = t118; - mat34.e12 = t128; - mat34.e20 = t208; - mat34.e21 = t218; - mat34.e22 = t228; - if(_this58.sizeMat3 == _this58.stackMat3.length) { - var newLength17 = _this58.sizeMat3 << 1; - var this18 = new Array(newLength17); - var newArray17 = this18; - var _g27 = 0; - var _g117 = _this58.sizeMat3; - while(_g27 < _g117) { - var i17 = _g27++; - newArray17[i17] = _this58.stackMat3[i17]; - _this58.stackMat3[i17] = null; - } - _this58.stackMat3 = newArray17; - } - _this58.stackMat3[_this58.sizeMat3++] = mat34; - } - if(mat44 != null) { - var t009 = 1; - var t019 = 0; - var t029 = 0; - var t034 = 0; - var t109 = 0; - var t119 = 1; - var t129 = 0; - var t134 = 0; - var t209 = 0; - var t219 = 0; - var t229 = 1; - var t234 = 0; - var t304 = 0; - var t314 = 0; - var t324 = 0; - var t334 = 1; - mat44.e00 = t009; - mat44.e01 = t019; - mat44.e02 = t029; - mat44.e03 = t034; - mat44.e10 = t109; - mat44.e11 = t119; - mat44.e12 = t129; - mat44.e13 = t134; - mat44.e20 = t209; - mat44.e21 = t219; - mat44.e22 = t229; - mat44.e23 = t234; - mat44.e30 = t304; - mat44.e31 = t314; - mat44.e32 = t324; - mat44.e33 = t334; - if(_this58.sizeMat4 == _this58.stackMat4.length) { - var newLength18 = _this58.sizeMat4 << 1; - var this19 = new Array(newLength18); - var newArray18 = this19; - var _g28 = 0; - var _g118 = _this58.sizeMat4; - while(_g28 < _g118) { - var i18 = _g28++; - newArray18[i18] = _this58.stackMat4[i18]; - _this58.stackMat4[i18] = null; - } - _this58.stackMat4 = newArray18; - } - _this58.stackMat4[_this58.sizeMat4++] = mat44; - } - if(quat4 != null) { - var tx31 = 0; - var ty31 = 0; - var tz31 = 0; - var tw4 = 1; - quat4.x = tx31; - quat4.y = ty31; - quat4.z = tz31; - quat4.w = tw4; - if(_this58.sizeQuat == _this58.stackQuat.length) { - var newLength19 = _this58.sizeQuat << 1; - var this20 = new Array(newLength19); - var newArray19 = this20; - var _g29 = 0; - var _g119 = _this58.sizeQuat; - while(_g29 < _g119) { - var i19 = _g29++; - newArray19[i19] = _this58.stackQuat[i19]; - _this58.stackQuat[i19] = null; - } - _this58.stackQuat = newArray19; - } - _this58.stackQuat[_this58.sizeQuat++] = quat4; - } - var _this59 = this.p; - var mat35 = null; - var mat45 = null; - var quat5 = null; - if(v3 != null) { - v3.zero(); - if(_this59.sizeVec3 == _this59.stackVec3.length) { - var newLength20 = _this59.sizeVec3 << 1; - var this21 = new Array(newLength20); - var newArray20 = this21; - var _g30 = 0; - var _g120 = _this59.sizeVec3; - while(_g30 < _g120) { - var i20 = _g30++; - newArray20[i20] = _this59.stackVec3[i20]; - _this59.stackVec3[i20] = null; - } - _this59.stackVec3 = newArray20; - } - _this59.stackVec3[_this59.sizeVec3++] = v3; - } - if(mat35 != null) { - var t0010 = 1; - var t0110 = 0; - var t0210 = 0; - var t1010 = 0; - var t1110 = 1; - var t1210 = 0; - var t2010 = 0; - var t2110 = 0; - var t2210 = 1; - mat35.e00 = t0010; - mat35.e01 = t0110; - mat35.e02 = t0210; - mat35.e10 = t1010; - mat35.e11 = t1110; - mat35.e12 = t1210; - mat35.e20 = t2010; - mat35.e21 = t2110; - mat35.e22 = t2210; - if(_this59.sizeMat3 == _this59.stackMat3.length) { - var newLength21 = _this59.sizeMat3 << 1; - var this22 = new Array(newLength21); - var newArray21 = this22; - var _g31 = 0; - var _g121 = _this59.sizeMat3; - while(_g31 < _g121) { - var i21 = _g31++; - newArray21[i21] = _this59.stackMat3[i21]; - _this59.stackMat3[i21] = null; - } - _this59.stackMat3 = newArray21; - } - _this59.stackMat3[_this59.sizeMat3++] = mat35; - } - if(mat45 != null) { - var t0011 = 1; - var t0111 = 0; - var t0211 = 0; - var t035 = 0; - var t1011 = 0; - var t1111 = 1; - var t1211 = 0; - var t135 = 0; - var t2011 = 0; - var t2111 = 0; - var t2211 = 1; - var t235 = 0; - var t305 = 0; - var t315 = 0; - var t325 = 0; - var t335 = 1; - mat45.e00 = t0011; - mat45.e01 = t0111; - mat45.e02 = t0211; - mat45.e03 = t035; - mat45.e10 = t1011; - mat45.e11 = t1111; - mat45.e12 = t1211; - mat45.e13 = t135; - mat45.e20 = t2011; - mat45.e21 = t2111; - mat45.e22 = t2211; - mat45.e23 = t235; - mat45.e30 = t305; - mat45.e31 = t315; - mat45.e32 = t325; - mat45.e33 = t335; - if(_this59.sizeMat4 == _this59.stackMat4.length) { - var newLength22 = _this59.sizeMat4 << 1; - var this23 = new Array(newLength22); - var newArray22 = this23; - var _g32 = 0; - var _g122 = _this59.sizeMat4; - while(_g32 < _g122) { - var i22 = _g32++; - newArray22[i22] = _this59.stackMat4[i22]; - _this59.stackMat4[i22] = null; - } - _this59.stackMat4 = newArray22; - } - _this59.stackMat4[_this59.sizeMat4++] = mat45; - } - if(quat5 != null) { - var tx32 = 0; - var ty32 = 0; - var tz32 = 0; - var tw5 = 1; - quat5.x = tx32; - quat5.y = ty32; - quat5.z = tz32; - quat5.w = tw5; - if(_this59.sizeQuat == _this59.stackQuat.length) { - var newLength23 = _this59.sizeQuat << 1; - var this24 = new Array(newLength23); - var newArray23 = this24; - var _g33 = 0; - var _g123 = _this59.sizeQuat; - while(_g33 < _g123) { - var i23 = _g33++; - newArray23[i23] = _this59.stackQuat[i23]; - _this59.stackQuat[i23] = null; - } - _this59.stackQuat = newArray23; - } - _this59.stackQuat[_this59.sizeQuat++] = quat5; - } - var _this60 = this.p; - var mat36 = null; - var mat46 = null; - var quat6 = null; - if(v4 != null) { - v4.zero(); - if(_this60.sizeVec3 == _this60.stackVec3.length) { - var newLength24 = _this60.sizeVec3 << 1; - var this25 = new Array(newLength24); - var newArray24 = this25; - var _g34 = 0; - var _g124 = _this60.sizeVec3; - while(_g34 < _g124) { - var i24 = _g34++; - newArray24[i24] = _this60.stackVec3[i24]; - _this60.stackVec3[i24] = null; - } - _this60.stackVec3 = newArray24; - } - _this60.stackVec3[_this60.sizeVec3++] = v4; - } - if(mat36 != null) { - var t0012 = 1; - var t0112 = 0; - var t0212 = 0; - var t1012 = 0; - var t1112 = 1; - var t1212 = 0; - var t2012 = 0; - var t2112 = 0; - var t2212 = 1; - mat36.e00 = t0012; - mat36.e01 = t0112; - mat36.e02 = t0212; - mat36.e10 = t1012; - mat36.e11 = t1112; - mat36.e12 = t1212; - mat36.e20 = t2012; - mat36.e21 = t2112; - mat36.e22 = t2212; - if(_this60.sizeMat3 == _this60.stackMat3.length) { - var newLength25 = _this60.sizeMat3 << 1; - var this26 = new Array(newLength25); - var newArray25 = this26; - var _g35 = 0; - var _g125 = _this60.sizeMat3; - while(_g35 < _g125) { - var i25 = _g35++; - newArray25[i25] = _this60.stackMat3[i25]; - _this60.stackMat3[i25] = null; - } - _this60.stackMat3 = newArray25; - } - _this60.stackMat3[_this60.sizeMat3++] = mat36; - } - if(mat46 != null) { - var t0013 = 1; - var t0113 = 0; - var t0213 = 0; - var t036 = 0; - var t1013 = 0; - var t1113 = 1; - var t1213 = 0; - var t136 = 0; - var t2013 = 0; - var t2113 = 0; - var t2213 = 1; - var t236 = 0; - var t306 = 0; - var t316 = 0; - var t326 = 0; - var t336 = 1; - mat46.e00 = t0013; - mat46.e01 = t0113; - mat46.e02 = t0213; - mat46.e03 = t036; - mat46.e10 = t1013; - mat46.e11 = t1113; - mat46.e12 = t1213; - mat46.e13 = t136; - mat46.e20 = t2013; - mat46.e21 = t2113; - mat46.e22 = t2213; - mat46.e23 = t236; - mat46.e30 = t306; - mat46.e31 = t316; - mat46.e32 = t326; - mat46.e33 = t336; - if(_this60.sizeMat4 == _this60.stackMat4.length) { - var newLength26 = _this60.sizeMat4 << 1; - var this27 = new Array(newLength26); - var newArray26 = this27; - var _g36 = 0; - var _g126 = _this60.sizeMat4; - while(_g36 < _g126) { - var i26 = _g36++; - newArray26[i26] = _this60.stackMat4[i26]; - _this60.stackMat4[i26] = null; - } - _this60.stackMat4 = newArray26; - } - _this60.stackMat4[_this60.sizeMat4++] = mat46; - } - if(quat6 != null) { - var tx33 = 0; - var ty33 = 0; - var tz33 = 0; - var tw6 = 1; - quat6.x = tx33; - quat6.y = ty33; - quat6.z = tz33; - quat6.w = tw6; - if(_this60.sizeQuat == _this60.stackQuat.length) { - var newLength27 = _this60.sizeQuat << 1; - var this28 = new Array(newLength27); - var newArray27 = this28; - var _g37 = 0; - var _g127 = _this60.sizeQuat; - while(_g37 < _g127) { - var i27 = _g37++; - newArray27[i27] = _this60.stackQuat[i27]; - _this60.stackQuat[i27] = null; - } - _this60.stackQuat = newArray27; - } - _this60.stackQuat[_this60.sizeQuat++] = quat6; - } - var _this61 = this.p; - var mat37 = null; - var mat47 = null; - var quat7 = null; - if(v5 != null) { - v5.zero(); - if(_this61.sizeVec3 == _this61.stackVec3.length) { - var newLength28 = _this61.sizeVec3 << 1; - var this29 = new Array(newLength28); - var newArray28 = this29; - var _g38 = 0; - var _g128 = _this61.sizeVec3; - while(_g38 < _g128) { - var i28 = _g38++; - newArray28[i28] = _this61.stackVec3[i28]; - _this61.stackVec3[i28] = null; - } - _this61.stackVec3 = newArray28; - } - _this61.stackVec3[_this61.sizeVec3++] = v5; - } - if(mat37 != null) { - var t0014 = 1; - var t0114 = 0; - var t0214 = 0; - var t1014 = 0; - var t1114 = 1; - var t1214 = 0; - var t2014 = 0; - var t2114 = 0; - var t2214 = 1; - mat37.e00 = t0014; - mat37.e01 = t0114; - mat37.e02 = t0214; - mat37.e10 = t1014; - mat37.e11 = t1114; - mat37.e12 = t1214; - mat37.e20 = t2014; - mat37.e21 = t2114; - mat37.e22 = t2214; - if(_this61.sizeMat3 == _this61.stackMat3.length) { - var newLength29 = _this61.sizeMat3 << 1; - var this30 = new Array(newLength29); - var newArray29 = this30; - var _g39 = 0; - var _g129 = _this61.sizeMat3; - while(_g39 < _g129) { - var i29 = _g39++; - newArray29[i29] = _this61.stackMat3[i29]; - _this61.stackMat3[i29] = null; - } - _this61.stackMat3 = newArray29; - } - _this61.stackMat3[_this61.sizeMat3++] = mat37; - } - if(mat47 != null) { - var t0015 = 1; - var t0115 = 0; - var t0215 = 0; - var t037 = 0; - var t1015 = 0; - var t1115 = 1; - var t1215 = 0; - var t137 = 0; - var t2015 = 0; - var t2115 = 0; - var t2215 = 1; - var t237 = 0; - var t307 = 0; - var t317 = 0; - var t327 = 0; - var t337 = 1; - mat47.e00 = t0015; - mat47.e01 = t0115; - mat47.e02 = t0215; - mat47.e03 = t037; - mat47.e10 = t1015; - mat47.e11 = t1115; - mat47.e12 = t1215; - mat47.e13 = t137; - mat47.e20 = t2015; - mat47.e21 = t2115; - mat47.e22 = t2215; - mat47.e23 = t237; - mat47.e30 = t307; - mat47.e31 = t317; - mat47.e32 = t327; - mat47.e33 = t337; - if(_this61.sizeMat4 == _this61.stackMat4.length) { - var newLength30 = _this61.sizeMat4 << 1; - var this31 = new Array(newLength30); - var newArray30 = this31; - var _g40 = 0; - var _g130 = _this61.sizeMat4; - while(_g40 < _g130) { - var i30 = _g40++; - newArray30[i30] = _this61.stackMat4[i30]; - _this61.stackMat4[i30] = null; - } - _this61.stackMat4 = newArray30; - } - _this61.stackMat4[_this61.sizeMat4++] = mat47; - } - if(quat7 != null) { - var tx34 = 0; - var ty34 = 0; - var tz34 = 0; - var tw7 = 1; - quat7.x = tx34; - quat7.y = ty34; - quat7.z = tz34; - quat7.w = tw7; - if(_this61.sizeQuat == _this61.stackQuat.length) { - var newLength31 = _this61.sizeQuat << 1; - var this32 = new Array(newLength31); - var newArray31 = this32; - var _g41 = 0; - var _g131 = _this61.sizeQuat; - while(_g41 < _g131) { - var i31 = _g41++; - newArray31[i31] = _this61.stackQuat[i31]; - _this61.stackQuat[i31] = null; - } - _this61.stackQuat = newArray31; - } - _this61.stackQuat[_this61.sizeQuat++] = quat7; - } - var _this62 = this.p; - var mat38 = null; - var mat48 = null; - var quat8 = null; - if(v6 != null) { - v6.zero(); - if(_this62.sizeVec3 == _this62.stackVec3.length) { - var newLength32 = _this62.sizeVec3 << 1; - var this33 = new Array(newLength32); - var newArray32 = this33; - var _g42 = 0; - var _g132 = _this62.sizeVec3; - while(_g42 < _g132) { - var i32 = _g42++; - newArray32[i32] = _this62.stackVec3[i32]; - _this62.stackVec3[i32] = null; - } - _this62.stackVec3 = newArray32; - } - _this62.stackVec3[_this62.sizeVec3++] = v6; - } - if(mat38 != null) { - var t0016 = 1; - var t0116 = 0; - var t0216 = 0; - var t1016 = 0; - var t1116 = 1; - var t1216 = 0; - var t2016 = 0; - var t2116 = 0; - var t2216 = 1; - mat38.e00 = t0016; - mat38.e01 = t0116; - mat38.e02 = t0216; - mat38.e10 = t1016; - mat38.e11 = t1116; - mat38.e12 = t1216; - mat38.e20 = t2016; - mat38.e21 = t2116; - mat38.e22 = t2216; - if(_this62.sizeMat3 == _this62.stackMat3.length) { - var newLength33 = _this62.sizeMat3 << 1; - var this34 = new Array(newLength33); - var newArray33 = this34; - var _g43 = 0; - var _g133 = _this62.sizeMat3; - while(_g43 < _g133) { - var i33 = _g43++; - newArray33[i33] = _this62.stackMat3[i33]; - _this62.stackMat3[i33] = null; - } - _this62.stackMat3 = newArray33; - } - _this62.stackMat3[_this62.sizeMat3++] = mat38; - } - if(mat48 != null) { - var t0017 = 1; - var t0117 = 0; - var t0217 = 0; - var t038 = 0; - var t1017 = 0; - var t1117 = 1; - var t1217 = 0; - var t138 = 0; - var t2017 = 0; - var t2117 = 0; - var t2217 = 1; - var t238 = 0; - var t308 = 0; - var t318 = 0; - var t328 = 0; - var t338 = 1; - mat48.e00 = t0017; - mat48.e01 = t0117; - mat48.e02 = t0217; - mat48.e03 = t038; - mat48.e10 = t1017; - mat48.e11 = t1117; - mat48.e12 = t1217; - mat48.e13 = t138; - mat48.e20 = t2017; - mat48.e21 = t2117; - mat48.e22 = t2217; - mat48.e23 = t238; - mat48.e30 = t308; - mat48.e31 = t318; - mat48.e32 = t328; - mat48.e33 = t338; - if(_this62.sizeMat4 == _this62.stackMat4.length) { - var newLength34 = _this62.sizeMat4 << 1; - var this35 = new Array(newLength34); - var newArray34 = this35; - var _g44 = 0; - var _g134 = _this62.sizeMat4; - while(_g44 < _g134) { - var i34 = _g44++; - newArray34[i34] = _this62.stackMat4[i34]; - _this62.stackMat4[i34] = null; - } - _this62.stackMat4 = newArray34; - } - _this62.stackMat4[_this62.sizeMat4++] = mat48; - } - if(quat8 != null) { - var tx35 = 0; - var ty35 = 0; - var tz35 = 0; - var tw8 = 1; - quat8.x = tx35; - quat8.y = ty35; - quat8.z = tz35; - quat8.w = tw8; - if(_this62.sizeQuat == _this62.stackQuat.length) { - var newLength35 = _this62.sizeQuat << 1; - var this36 = new Array(newLength35); - var newArray35 = this36; - var _g45 = 0; - var _g135 = _this62.sizeQuat; - while(_g45 < _g135) { - var i35 = _g45++; - newArray35[i35] = _this62.stackQuat[i35]; - _this62.stackQuat[i35] = null; - } - _this62.stackQuat = newArray35; - } - _this62.stackQuat[_this62.sizeQuat++] = quat8; - } - var _this63 = this.p; - var mat39 = null; - var mat49 = null; - var quat9 = null; - if(v7 != null) { - v7.zero(); - if(_this63.sizeVec3 == _this63.stackVec3.length) { - var newLength36 = _this63.sizeVec3 << 1; - var this37 = new Array(newLength36); - var newArray36 = this37; - var _g46 = 0; - var _g136 = _this63.sizeVec3; - while(_g46 < _g136) { - var i36 = _g46++; - newArray36[i36] = _this63.stackVec3[i36]; - _this63.stackVec3[i36] = null; - } - _this63.stackVec3 = newArray36; - } - _this63.stackVec3[_this63.sizeVec3++] = v7; - } - if(mat39 != null) { - var t0018 = 1; - var t0118 = 0; - var t0218 = 0; - var t1018 = 0; - var t1118 = 1; - var t1218 = 0; - var t2018 = 0; - var t2118 = 0; - var t2218 = 1; - mat39.e00 = t0018; - mat39.e01 = t0118; - mat39.e02 = t0218; - mat39.e10 = t1018; - mat39.e11 = t1118; - mat39.e12 = t1218; - mat39.e20 = t2018; - mat39.e21 = t2118; - mat39.e22 = t2218; - if(_this63.sizeMat3 == _this63.stackMat3.length) { - var newLength37 = _this63.sizeMat3 << 1; - var this38 = new Array(newLength37); - var newArray37 = this38; - var _g47 = 0; - var _g137 = _this63.sizeMat3; - while(_g47 < _g137) { - var i37 = _g47++; - newArray37[i37] = _this63.stackMat3[i37]; - _this63.stackMat3[i37] = null; - } - _this63.stackMat3 = newArray37; - } - _this63.stackMat3[_this63.sizeMat3++] = mat39; - } - if(mat49 != null) { - var t0019 = 1; - var t0119 = 0; - var t0219 = 0; - var t039 = 0; - var t1019 = 0; - var t1119 = 1; - var t1219 = 0; - var t139 = 0; - var t2019 = 0; - var t2119 = 0; - var t2219 = 1; - var t239 = 0; - var t309 = 0; - var t319 = 0; - var t329 = 0; - var t339 = 1; - mat49.e00 = t0019; - mat49.e01 = t0119; - mat49.e02 = t0219; - mat49.e03 = t039; - mat49.e10 = t1019; - mat49.e11 = t1119; - mat49.e12 = t1219; - mat49.e13 = t139; - mat49.e20 = t2019; - mat49.e21 = t2119; - mat49.e22 = t2219; - mat49.e23 = t239; - mat49.e30 = t309; - mat49.e31 = t319; - mat49.e32 = t329; - mat49.e33 = t339; - if(_this63.sizeMat4 == _this63.stackMat4.length) { - var newLength38 = _this63.sizeMat4 << 1; - var this39 = new Array(newLength38); - var newArray38 = this39; - var _g48 = 0; - var _g138 = _this63.sizeMat4; - while(_g48 < _g138) { - var i38 = _g48++; - newArray38[i38] = _this63.stackMat4[i38]; - _this63.stackMat4[i38] = null; - } - _this63.stackMat4 = newArray38; - } - _this63.stackMat4[_this63.sizeMat4++] = mat49; - } - if(quat9 != null) { - var tx36 = 0; - var ty36 = 0; - var tz36 = 0; - var tw9 = 1; - quat9.x = tx36; - quat9.y = ty36; - quat9.z = tz36; - quat9.w = tw9; - if(_this63.sizeQuat == _this63.stackQuat.length) { - var newLength39 = _this63.sizeQuat << 1; - var this40 = new Array(newLength39); - var newArray39 = this40; - var _g49 = 0; - var _g139 = _this63.sizeQuat; - while(_g49 < _g139) { - var i39 = _g49++; - newArray39[i39] = _this63.stackQuat[i39]; - _this63.stackQuat[i39] = null; - } - _this63.stackQuat = newArray39; - } - _this63.stackQuat[_this63.sizeQuat++] = quat9; - } - var _this64 = this.p; - var mat310 = null; - var mat410 = null; - var quat10 = null; - if(v8 != null) { - v8.zero(); - if(_this64.sizeVec3 == _this64.stackVec3.length) { - var newLength40 = _this64.sizeVec3 << 1; - var this41 = new Array(newLength40); - var newArray40 = this41; - var _g50 = 0; - var _g140 = _this64.sizeVec3; - while(_g50 < _g140) { - var i40 = _g50++; - newArray40[i40] = _this64.stackVec3[i40]; - _this64.stackVec3[i40] = null; - } - _this64.stackVec3 = newArray40; - } - _this64.stackVec3[_this64.sizeVec3++] = v8; - } - if(mat310 != null) { - var t0020 = 1; - var t0120 = 0; - var t0220 = 0; - var t1020 = 0; - var t1120 = 1; - var t1220 = 0; - var t2020 = 0; - var t2120 = 0; - var t2220 = 1; - mat310.e00 = t0020; - mat310.e01 = t0120; - mat310.e02 = t0220; - mat310.e10 = t1020; - mat310.e11 = t1120; - mat310.e12 = t1220; - mat310.e20 = t2020; - mat310.e21 = t2120; - mat310.e22 = t2220; - if(_this64.sizeMat3 == _this64.stackMat3.length) { - var newLength41 = _this64.sizeMat3 << 1; - var this42 = new Array(newLength41); - var newArray41 = this42; - var _g51 = 0; - var _g141 = _this64.sizeMat3; - while(_g51 < _g141) { - var i41 = _g51++; - newArray41[i41] = _this64.stackMat3[i41]; - _this64.stackMat3[i41] = null; - } - _this64.stackMat3 = newArray41; - } - _this64.stackMat3[_this64.sizeMat3++] = mat310; - } - if(mat410 != null) { - var t0021 = 1; - var t0121 = 0; - var t0221 = 0; - var t0310 = 0; - var t1021 = 0; - var t1121 = 1; - var t1221 = 0; - var t1310 = 0; - var t2021 = 0; - var t2121 = 0; - var t2221 = 1; - var t2310 = 0; - var t3010 = 0; - var t3110 = 0; - var t3210 = 0; - var t3310 = 1; - mat410.e00 = t0021; - mat410.e01 = t0121; - mat410.e02 = t0221; - mat410.e03 = t0310; - mat410.e10 = t1021; - mat410.e11 = t1121; - mat410.e12 = t1221; - mat410.e13 = t1310; - mat410.e20 = t2021; - mat410.e21 = t2121; - mat410.e22 = t2221; - mat410.e23 = t2310; - mat410.e30 = t3010; - mat410.e31 = t3110; - mat410.e32 = t3210; - mat410.e33 = t3310; - if(_this64.sizeMat4 == _this64.stackMat4.length) { - var newLength42 = _this64.sizeMat4 << 1; - var this43 = new Array(newLength42); - var newArray42 = this43; - var _g52 = 0; - var _g142 = _this64.sizeMat4; - while(_g52 < _g142) { - var i42 = _g52++; - newArray42[i42] = _this64.stackMat4[i42]; - _this64.stackMat4[i42] = null; - } - _this64.stackMat4 = newArray42; - } - _this64.stackMat4[_this64.sizeMat4++] = mat410; - } - if(quat10 != null) { - var tx37 = 0; - var ty37 = 0; - var tz37 = 0; - var tw10 = 1; - quat10.x = tx37; - quat10.y = ty37; - quat10.z = tz37; - quat10.w = tw10; - if(_this64.sizeQuat == _this64.stackQuat.length) { - var newLength43 = _this64.sizeQuat << 1; - var this44 = new Array(newLength43); - var newArray43 = this44; - var _g53 = 0; - var _g143 = _this64.sizeQuat; - while(_g53 < _g143) { - var i43 = _g53++; - newArray43[i43] = _this64.stackQuat[i43]; - _this64.stackQuat[i43] = null; - } - _this64.stackQuat = newArray43; - } - _this64.stackQuat[_this64.sizeQuat++] = quat10; - } - var _this65 = this.p; - var mat311 = null; - var mat411 = null; - var quat11 = null; + let _this29 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; + } + _this29.stackVec3 = newArray; + } + _this29.stackVec3[_this29.sizeVec3++] = _this7; + } + let _this30 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; + } + _this30.stackVec3 = newArray; + } + _this30.stackVec3[_this30.sizeVec3++] = _this10; + } + let _this31 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; + } + _this31.stackVec3 = newArray; + } + _this31.stackVec3[_this31.sizeVec3++] = _this13; + } + let _this32 = this.p; + if(_this16 != null) { + _this16.zero(); + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; + } + _this32.stackVec3 = newArray; + } + _this32.stackVec3[_this32.sizeVec3++] = _this16; + } + let _this33 = this.p; + if(_this19 != null) { + _this19.zero(); + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; + } + _this33.stackVec3 = newArray; + } + _this33.stackVec3[_this33.sizeVec3++] = _this19; + } + let _this34 = this.p; + if(_this22 != null) { + _this22.zero(); + if(_this34.sizeVec3 == _this34.stackVec3.length) { + let newArray = new Array(_this34.sizeVec3 << 1); + let _g = 0; + let _g1 = _this34.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this34.stackVec3[i]; + _this34.stackVec3[i] = null; + } + _this34.stackVec3 = newArray; + } + _this34.stackVec3[_this34.sizeVec3++] = _this22; + } + let _this35 = this.p; + if(_this25 != null) { + _this25.zero(); + if(_this35.sizeVec3 == _this35.stackVec3.length) { + let newArray = new Array(_this35.sizeVec3 << 1); + let _g = 0; + let _g1 = _this35.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this35.stackVec3[i]; + _this35.stackVec3[i] = null; + } + _this35.stackVec3 = newArray; + } + _this35.stackVec3[_this35.sizeVec3++] = _this25; + } + let _this36 = this.p; + if(_this28 != null) { + _this28.zero(); + if(_this36.sizeVec3 == _this36.stackVec3.length) { + let newArray = new Array(_this36.sizeVec3 << 1); + let _g = 0; + let _g1 = _this36.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this36.stackVec3[i]; + _this36.stackVec3[i] = null; + } + _this36.stackVec3 = newArray; + } + _this36.stackVec3[_this36.sizeVec3++] = _this28; + } + let _this37 = this.p; if(o != null) { o.zero(); - if(_this65.sizeVec3 == _this65.stackVec3.length) { - var newLength44 = _this65.sizeVec3 << 1; - var this45 = new Array(newLength44); - var newArray44 = this45; - var _g54 = 0; - var _g144 = _this65.sizeVec3; - while(_g54 < _g144) { - var i44 = _g54++; - newArray44[i44] = _this65.stackVec3[i44]; - _this65.stackVec3[i44] = null; - } - _this65.stackVec3 = newArray44; - } - _this65.stackVec3[_this65.sizeVec3++] = o; - } - if(mat311 != null) { - var t0022 = 1; - var t0122 = 0; - var t0222 = 0; - var t1022 = 0; - var t1122 = 1; - var t1222 = 0; - var t2022 = 0; - var t2122 = 0; - var t2222 = 1; - mat311.e00 = t0022; - mat311.e01 = t0122; - mat311.e02 = t0222; - mat311.e10 = t1022; - mat311.e11 = t1122; - mat311.e12 = t1222; - mat311.e20 = t2022; - mat311.e21 = t2122; - mat311.e22 = t2222; - if(_this65.sizeMat3 == _this65.stackMat3.length) { - var newLength45 = _this65.sizeMat3 << 1; - var this46 = new Array(newLength45); - var newArray45 = this46; - var _g55 = 0; - var _g145 = _this65.sizeMat3; - while(_g55 < _g145) { - var i45 = _g55++; - newArray45[i45] = _this65.stackMat3[i45]; - _this65.stackMat3[i45] = null; - } - _this65.stackMat3 = newArray45; - } - _this65.stackMat3[_this65.sizeMat3++] = mat311; - } - if(mat411 != null) { - var t0023 = 1; - var t0123 = 0; - var t0223 = 0; - var t0311 = 0; - var t1023 = 0; - var t1123 = 1; - var t1223 = 0; - var t1311 = 0; - var t2023 = 0; - var t2123 = 0; - var t2223 = 1; - var t2311 = 0; - var t3011 = 0; - var t3111 = 0; - var t3211 = 0; - var t3311 = 1; - mat411.e00 = t0023; - mat411.e01 = t0123; - mat411.e02 = t0223; - mat411.e03 = t0311; - mat411.e10 = t1023; - mat411.e11 = t1123; - mat411.e12 = t1223; - mat411.e13 = t1311; - mat411.e20 = t2023; - mat411.e21 = t2123; - mat411.e22 = t2223; - mat411.e23 = t2311; - mat411.e30 = t3011; - mat411.e31 = t3111; - mat411.e32 = t3211; - mat411.e33 = t3311; - if(_this65.sizeMat4 == _this65.stackMat4.length) { - var newLength46 = _this65.sizeMat4 << 1; - var this47 = new Array(newLength46); - var newArray46 = this47; - var _g56 = 0; - var _g146 = _this65.sizeMat4; - while(_g56 < _g146) { - var i46 = _g56++; - newArray46[i46] = _this65.stackMat4[i46]; - _this65.stackMat4[i46] = null; - } - _this65.stackMat4 = newArray46; - } - _this65.stackMat4[_this65.sizeMat4++] = mat411; - } - if(quat11 != null) { - var tx38 = 0; - var ty38 = 0; - var tz38 = 0; - var tw11 = 1; - quat11.x = tx38; - quat11.y = ty38; - quat11.z = tz38; - quat11.w = tw11; - if(_this65.sizeQuat == _this65.stackQuat.length) { - var newLength47 = _this65.sizeQuat << 1; - var this48 = new Array(newLength47); - var newArray47 = this48; - var _g57 = 0; - var _g147 = _this65.sizeQuat; - while(_g57 < _g147) { - var i47 = _g57++; - newArray47[i47] = _this65.stackQuat[i47]; - _this65.stackQuat[i47] = null; - } - _this65.stackQuat = newArray47; - } - _this65.stackQuat[_this65.sizeQuat++] = quat11; - } - var _this66 = this.p; - var vec3 = null; - var mat412 = null; - var quat12 = null; - if(vec3 != null) { - vec3.zero(); - if(_this66.sizeVec3 == _this66.stackVec3.length) { - var newLength48 = _this66.sizeVec3 << 1; - var this49 = new Array(newLength48); - var newArray48 = this49; - var _g58 = 0; - var _g148 = _this66.sizeVec3; - while(_g58 < _g148) { - var i48 = _g58++; - newArray48[i48] = _this66.stackVec3[i48]; - _this66.stackVec3[i48] = null; + if(_this37.sizeVec3 == _this37.stackVec3.length) { + let newArray = new Array(_this37.sizeVec3 << 1); + let _g = 0; + let _g1 = _this37.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this37.stackVec3[i]; + _this37.stackVec3[i] = null; } - _this66.stackVec3 = newArray48; + _this37.stackVec3 = newArray; } - _this66.stackVec3[_this66.sizeVec3++] = vec3; + _this37.stackVec3[_this37.sizeVec3++] = o; } + let _this38 = this.p; if(m != null) { - var t0024 = 1; - var t0124 = 0; - var t0224 = 0; - var t1024 = 0; - var t1124 = 1; - var t1224 = 0; - var t2024 = 0; - var t2124 = 0; - var t2224 = 1; - m.e00 = t0024; - m.e01 = t0124; - m.e02 = t0224; - m.e10 = t1024; - m.e11 = t1124; - m.e12 = t1224; - m.e20 = t2024; - m.e21 = t2124; - m.e22 = t2224; - if(_this66.sizeMat3 == _this66.stackMat3.length) { - var newLength49 = _this66.sizeMat3 << 1; - var this50 = new Array(newLength49); - var newArray49 = this50; - var _g59 = 0; - var _g149 = _this66.sizeMat3; - while(_g59 < _g149) { - var i49 = _g59++; - newArray49[i49] = _this66.stackMat3[i49]; - _this66.stackMat3[i49] = null; - } - _this66.stackMat3 = newArray49; - } - _this66.stackMat3[_this66.sizeMat3++] = m; - } - if(mat412 != null) { - var t0025 = 1; - var t0125 = 0; - var t0225 = 0; - var t0312 = 0; - var t1025 = 0; - var t1125 = 1; - var t1225 = 0; - var t1312 = 0; - var t2025 = 0; - var t2125 = 0; - var t2225 = 1; - var t2312 = 0; - var t3012 = 0; - var t3112 = 0; - var t3212 = 0; - var t3312 = 1; - mat412.e00 = t0025; - mat412.e01 = t0125; - mat412.e02 = t0225; - mat412.e03 = t0312; - mat412.e10 = t1025; - mat412.e11 = t1125; - mat412.e12 = t1225; - mat412.e13 = t1312; - mat412.e20 = t2025; - mat412.e21 = t2125; - mat412.e22 = t2225; - mat412.e23 = t2312; - mat412.e30 = t3012; - mat412.e31 = t3112; - mat412.e32 = t3212; - mat412.e33 = t3312; - if(_this66.sizeMat4 == _this66.stackMat4.length) { - var newLength50 = _this66.sizeMat4 << 1; - var this51 = new Array(newLength50); - var newArray50 = this51; - var _g60 = 0; - var _g150 = _this66.sizeMat4; - while(_g60 < _g150) { - var i50 = _g60++; - newArray50[i50] = _this66.stackMat4[i50]; - _this66.stackMat4[i50] = null; - } - _this66.stackMat4 = newArray50; - } - _this66.stackMat4[_this66.sizeMat4++] = mat412; - } - if(quat12 != null) { - var tx39 = 0; - var ty39 = 0; - var tz39 = 0; - var tw12 = 1; - quat12.x = tx39; - quat12.y = ty39; - quat12.z = tz39; - quat12.w = tw12; - if(_this66.sizeQuat == _this66.stackQuat.length) { - var newLength51 = _this66.sizeQuat << 1; - var this52 = new Array(newLength51); - var newArray51 = this52; - var _g61 = 0; - var _g151 = _this66.sizeQuat; - while(_g61 < _g151) { - var i51 = _g61++; - newArray51[i51] = _this66.stackQuat[i51]; - _this66.stackQuat[i51] = null; - } - _this66.stackQuat = newArray51; - } - _this66.stackQuat[_this66.sizeQuat++] = quat12; - } - var _this67 = this.p; - var mat312 = null; - var mat413 = null; - var quat13 = null; + m.e00 = 1; + m.e01 = 0; + m.e02 = 0; + m.e10 = 0; + m.e11 = 1; + m.e12 = 0; + m.e20 = 0; + m.e21 = 0; + m.e22 = 1; + if(_this38.sizeMat3 == _this38.stackMat3.length) { + let newArray = new Array(_this38.sizeMat3 << 1); + let _g = 0; + let _g1 = _this38.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this38.stackMat3[i]; + _this38.stackMat3[i] = null; + } + _this38.stackMat3 = newArray; + } + _this38.stackMat3[_this38.sizeMat3++] = m; + } + let _this39 = this.p; if(ex != null) { ex.zero(); - if(_this67.sizeVec3 == _this67.stackVec3.length) { - var newLength52 = _this67.sizeVec3 << 1; - var this53 = new Array(newLength52); - var newArray52 = this53; - var _g62 = 0; - var _g152 = _this67.sizeVec3; - while(_g62 < _g152) { - var i52 = _g62++; - newArray52[i52] = _this67.stackVec3[i52]; - _this67.stackVec3[i52] = null; - } - _this67.stackVec3 = newArray52; - } - _this67.stackVec3[_this67.sizeVec3++] = ex; - } - if(mat312 != null) { - var t0026 = 1; - var t0126 = 0; - var t0226 = 0; - var t1026 = 0; - var t1126 = 1; - var t1226 = 0; - var t2026 = 0; - var t2126 = 0; - var t2226 = 1; - mat312.e00 = t0026; - mat312.e01 = t0126; - mat312.e02 = t0226; - mat312.e10 = t1026; - mat312.e11 = t1126; - mat312.e12 = t1226; - mat312.e20 = t2026; - mat312.e21 = t2126; - mat312.e22 = t2226; - if(_this67.sizeMat3 == _this67.stackMat3.length) { - var newLength53 = _this67.sizeMat3 << 1; - var this54 = new Array(newLength53); - var newArray53 = this54; - var _g63 = 0; - var _g153 = _this67.sizeMat3; - while(_g63 < _g153) { - var i53 = _g63++; - newArray53[i53] = _this67.stackMat3[i53]; - _this67.stackMat3[i53] = null; - } - _this67.stackMat3 = newArray53; - } - _this67.stackMat3[_this67.sizeMat3++] = mat312; - } - if(mat413 != null) { - var t0027 = 1; - var t0127 = 0; - var t0227 = 0; - var t0313 = 0; - var t1027 = 0; - var t1127 = 1; - var t1227 = 0; - var t1313 = 0; - var t2027 = 0; - var t2127 = 0; - var t2227 = 1; - var t2313 = 0; - var t3013 = 0; - var t3113 = 0; - var t3213 = 0; - var t3313 = 1; - mat413.e00 = t0027; - mat413.e01 = t0127; - mat413.e02 = t0227; - mat413.e03 = t0313; - mat413.e10 = t1027; - mat413.e11 = t1127; - mat413.e12 = t1227; - mat413.e13 = t1313; - mat413.e20 = t2027; - mat413.e21 = t2127; - mat413.e22 = t2227; - mat413.e23 = t2313; - mat413.e30 = t3013; - mat413.e31 = t3113; - mat413.e32 = t3213; - mat413.e33 = t3313; - if(_this67.sizeMat4 == _this67.stackMat4.length) { - var newLength54 = _this67.sizeMat4 << 1; - var this55 = new Array(newLength54); - var newArray54 = this55; - var _g64 = 0; - var _g154 = _this67.sizeMat4; - while(_g64 < _g154) { - var i54 = _g64++; - newArray54[i54] = _this67.stackMat4[i54]; - _this67.stackMat4[i54] = null; - } - _this67.stackMat4 = newArray54; - } - _this67.stackMat4[_this67.sizeMat4++] = mat413; - } - if(quat13 != null) { - var tx40 = 0; - var ty40 = 0; - var tz40 = 0; - var tw13 = 1; - quat13.x = tx40; - quat13.y = ty40; - quat13.z = tz40; - quat13.w = tw13; - if(_this67.sizeQuat == _this67.stackQuat.length) { - var newLength55 = _this67.sizeQuat << 1; - var this56 = new Array(newLength55); - var newArray55 = this56; - var _g65 = 0; - var _g155 = _this67.sizeQuat; - while(_g65 < _g155) { - var i55 = _g65++; - newArray55[i55] = _this67.stackQuat[i55]; - _this67.stackQuat[i55] = null; - } - _this67.stackQuat = newArray55; - } - _this67.stackQuat[_this67.sizeQuat++] = quat13; - } - var _this68 = this.p; - var mat313 = null; - var mat414 = null; - var quat14 = null; + if(_this39.sizeVec3 == _this39.stackVec3.length) { + let newArray = new Array(_this39.sizeVec3 << 1); + let _g = 0; + let _g1 = _this39.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this39.stackVec3[i]; + _this39.stackVec3[i] = null; + } + _this39.stackVec3 = newArray; + } + _this39.stackVec3[_this39.sizeVec3++] = ex; + } + let _this40 = this.p; if(ey != null) { ey.zero(); - if(_this68.sizeVec3 == _this68.stackVec3.length) { - var newLength56 = _this68.sizeVec3 << 1; - var this57 = new Array(newLength56); - var newArray56 = this57; - var _g66 = 0; - var _g156 = _this68.sizeVec3; - while(_g66 < _g156) { - var i56 = _g66++; - newArray56[i56] = _this68.stackVec3[i56]; - _this68.stackVec3[i56] = null; - } - _this68.stackVec3 = newArray56; - } - _this68.stackVec3[_this68.sizeVec3++] = ey; - } - if(mat313 != null) { - var t0028 = 1; - var t0128 = 0; - var t0228 = 0; - var t1028 = 0; - var t1128 = 1; - var t1228 = 0; - var t2028 = 0; - var t2128 = 0; - var t2228 = 1; - mat313.e00 = t0028; - mat313.e01 = t0128; - mat313.e02 = t0228; - mat313.e10 = t1028; - mat313.e11 = t1128; - mat313.e12 = t1228; - mat313.e20 = t2028; - mat313.e21 = t2128; - mat313.e22 = t2228; - if(_this68.sizeMat3 == _this68.stackMat3.length) { - var newLength57 = _this68.sizeMat3 << 1; - var this58 = new Array(newLength57); - var newArray57 = this58; - var _g67 = 0; - var _g157 = _this68.sizeMat3; - while(_g67 < _g157) { - var i57 = _g67++; - newArray57[i57] = _this68.stackMat3[i57]; - _this68.stackMat3[i57] = null; - } - _this68.stackMat3 = newArray57; - } - _this68.stackMat3[_this68.sizeMat3++] = mat313; - } - if(mat414 != null) { - var t0029 = 1; - var t0129 = 0; - var t0229 = 0; - var t0314 = 0; - var t1029 = 0; - var t1129 = 1; - var t1229 = 0; - var t1314 = 0; - var t2029 = 0; - var t2129 = 0; - var t2229 = 1; - var t2314 = 0; - var t3014 = 0; - var t3114 = 0; - var t3214 = 0; - var t3314 = 1; - mat414.e00 = t0029; - mat414.e01 = t0129; - mat414.e02 = t0229; - mat414.e03 = t0314; - mat414.e10 = t1029; - mat414.e11 = t1129; - mat414.e12 = t1229; - mat414.e13 = t1314; - mat414.e20 = t2029; - mat414.e21 = t2129; - mat414.e22 = t2229; - mat414.e23 = t2314; - mat414.e30 = t3014; - mat414.e31 = t3114; - mat414.e32 = t3214; - mat414.e33 = t3314; - if(_this68.sizeMat4 == _this68.stackMat4.length) { - var newLength58 = _this68.sizeMat4 << 1; - var this59 = new Array(newLength58); - var newArray58 = this59; - var _g68 = 0; - var _g158 = _this68.sizeMat4; - while(_g68 < _g158) { - var i58 = _g68++; - newArray58[i58] = _this68.stackMat4[i58]; - _this68.stackMat4[i58] = null; - } - _this68.stackMat4 = newArray58; - } - _this68.stackMat4[_this68.sizeMat4++] = mat414; - } - if(quat14 != null) { - var tx41 = 0; - var ty41 = 0; - var tz41 = 0; - var tw14 = 1; - quat14.x = tx41; - quat14.y = ty41; - quat14.z = tz41; - quat14.w = tw14; - if(_this68.sizeQuat == _this68.stackQuat.length) { - var newLength59 = _this68.sizeQuat << 1; - var this60 = new Array(newLength59); - var newArray59 = this60; - var _g69 = 0; - var _g159 = _this68.sizeQuat; - while(_g69 < _g159) { - var i59 = _g69++; - newArray59[i59] = _this68.stackQuat[i59]; - _this68.stackQuat[i59] = null; - } - _this68.stackQuat = newArray59; - } - _this68.stackQuat[_this68.sizeQuat++] = quat14; - } - var _this69 = this.p; - var mat314 = null; - var mat415 = null; - var quat15 = null; + if(_this40.sizeVec3 == _this40.stackVec3.length) { + let newArray = new Array(_this40.sizeVec3 << 1); + let _g = 0; + let _g1 = _this40.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this40.stackVec3[i]; + _this40.stackVec3[i] = null; + } + _this40.stackVec3 = newArray; + } + _this40.stackVec3[_this40.sizeVec3++] = ey; + } + let _this41 = this.p; if(ez != null) { ez.zero(); - if(_this69.sizeVec3 == _this69.stackVec3.length) { - var newLength60 = _this69.sizeVec3 << 1; - var this61 = new Array(newLength60); - var newArray60 = this61; - var _g70 = 0; - var _g160 = _this69.sizeVec3; - while(_g70 < _g160) { - var i60 = _g70++; - newArray60[i60] = _this69.stackVec3[i60]; - _this69.stackVec3[i60] = null; - } - _this69.stackVec3 = newArray60; - } - _this69.stackVec3[_this69.sizeVec3++] = ez; - } - if(mat314 != null) { - var t0030 = 1; - var t0130 = 0; - var t0230 = 0; - var t1030 = 0; - var t1130 = 1; - var t1230 = 0; - var t2030 = 0; - var t2130 = 0; - var t2230 = 1; - mat314.e00 = t0030; - mat314.e01 = t0130; - mat314.e02 = t0230; - mat314.e10 = t1030; - mat314.e11 = t1130; - mat314.e12 = t1230; - mat314.e20 = t2030; - mat314.e21 = t2130; - mat314.e22 = t2230; - if(_this69.sizeMat3 == _this69.stackMat3.length) { - var newLength61 = _this69.sizeMat3 << 1; - var this62 = new Array(newLength61); - var newArray61 = this62; - var _g71 = 0; - var _g161 = _this69.sizeMat3; - while(_g71 < _g161) { - var i61 = _g71++; - newArray61[i61] = _this69.stackMat3[i61]; - _this69.stackMat3[i61] = null; - } - _this69.stackMat3 = newArray61; - } - _this69.stackMat3[_this69.sizeMat3++] = mat314; - } - if(mat415 != null) { - var t0031 = 1; - var t0131 = 0; - var t0231 = 0; - var t0315 = 0; - var t1031 = 0; - var t1131 = 1; - var t1231 = 0; - var t1315 = 0; - var t2031 = 0; - var t2131 = 0; - var t2231 = 1; - var t2315 = 0; - var t3015 = 0; - var t3115 = 0; - var t3215 = 0; - var t3315 = 1; - mat415.e00 = t0031; - mat415.e01 = t0131; - mat415.e02 = t0231; - mat415.e03 = t0315; - mat415.e10 = t1031; - mat415.e11 = t1131; - mat415.e12 = t1231; - mat415.e13 = t1315; - mat415.e20 = t2031; - mat415.e21 = t2131; - mat415.e22 = t2231; - mat415.e23 = t2315; - mat415.e30 = t3015; - mat415.e31 = t3115; - mat415.e32 = t3215; - mat415.e33 = t3315; - if(_this69.sizeMat4 == _this69.stackMat4.length) { - var newLength62 = _this69.sizeMat4 << 1; - var this63 = new Array(newLength62); - var newArray62 = this63; - var _g72 = 0; - var _g162 = _this69.sizeMat4; - while(_g72 < _g162) { - var i62 = _g72++; - newArray62[i62] = _this69.stackMat4[i62]; - _this69.stackMat4[i62] = null; - } - _this69.stackMat4 = newArray62; - } - _this69.stackMat4[_this69.sizeMat4++] = mat415; - } - if(quat15 != null) { - var tx42 = 0; - var ty42 = 0; - var tz42 = 0; - var tw15 = 1; - quat15.x = tx42; - quat15.y = ty42; - quat15.z = tz42; - quat15.w = tw15; - if(_this69.sizeQuat == _this69.stackQuat.length) { - var newLength63 = _this69.sizeQuat << 1; - var this64 = new Array(newLength63); - var newArray63 = this64; - var _g73 = 0; - var _g163 = _this69.sizeQuat; - while(_g73 < _g163) { - var i63 = _g73++; - newArray63[i63] = _this69.stackQuat[i63]; - _this69.stackQuat[i63] = null; - } - _this69.stackQuat = newArray63; - } - _this69.stackQuat[_this69.sizeQuat++] = quat15; + if(_this41.sizeVec3 == _this41.stackVec3.length) { + let newArray = new Array(_this41.sizeVec3 << 1); + let _g = 0; + let _g1 = _this41.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this41.stackVec3[i]; + _this41.stackVec3[i] = null; + } + _this41.stackVec3 = newArray; + } + _this41.stackVec3[_this41.sizeVec3++] = ez; } } rect(v1,v2,v3,v4,n1,n2,n3,n4,color) { @@ -37867,18 +21006,15 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra _getVelocitySolverInfo(timeStep,info) { info.b1 = this._b1; info.b2 = this._b2; - var normal; - var normalX; - var normalY; - var normalZ; - var tangent; - var tangentX; - var tangentY; - var tangentZ; - var binormal; - var binormalX; - var binormalY; - var binormalZ; + let normalX; + let normalY; + let normalZ; + let tangentX; + let tangentY; + let tangentZ; + let binormalX; + let binormalY; + let binormalZ; normalX = this._manifold._normalX; normalY = this._manifold._normalY; normalZ = this._manifold._normalZ; @@ -37888,25 +21024,16 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra binormalX = this._manifold._binormalX; binormalY = this._manifold._binormalY; binormalZ = this._manifold._binormalZ; - var friction = Math.sqrt(this._s1._friction * this._s2._friction); - var restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); - var num = this._manifold._numPoints; + let friction = Math.sqrt(this._s1._friction * this._s2._friction); + let restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); + let num = this._manifold._numPoints; info.numRows = 0; - var posDiff; - var posDiffX; - var posDiffY; - var posDiffZ; - posDiffX = this._tf1._positionX - this._tf2._positionX; - posDiffY = this._tf1._positionY - this._tf2._positionY; - posDiffZ = this._tf1._positionZ - this._tf2._positionZ; - var _g = 0; - var _g1 = num; - while(_g < _g1) { - var i = _g++; - var p = this._manifold._points[i]; + let _g = 0; + while(_g < num) { + let p = this._manifold._points[_g++]; if(p._depth < 0) { p._disabled = true; - var _this = p._impulse; + let _this = p._impulse; _this.impulseN = 0; _this.impulseT = 0; _this.impulseB = 0; @@ -37918,10 +21045,10 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra } else { p._disabled = false; } - var row = info.rows[info.numRows++]; + let row = info.rows[info.numRows++]; row.friction = friction; row.cfm = 0; - var j = row.jacobianN; + let j = row.jacobianN; j.lin1X = normalX; j.lin1Y = normalY; j.lin1Z = normalZ; @@ -37961,7 +21088,7 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra j.ang2Y = p._relPos2Z * binormalX - p._relPos2X * binormalZ; j.ang2Z = p._relPos2X * binormalY - p._relPos2Y * binormalX; j = row.jacobianN; - var rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); + let rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); if(rvn < -oimo.common.Setting.contactEnableBounceThreshold && !p._warmStarted) { row.rhs = -rvn * restitution; } else { @@ -37969,21 +21096,21 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra } if(this._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE) { if(p._depth > oimo.common.Setting.linearSlop) { - var minRhs = (p._depth - oimo.common.Setting.linearSlop) * oimo.common.Setting.velocityBaumgarte * timeStep.invDt; + let minRhs = (p._depth - oimo.common.Setting.linearSlop) * oimo.common.Setting.velocityBaumgarte * timeStep.invDt; if(row.rhs < minRhs) { row.rhs = minRhs; } } } if(!p._warmStarted) { - var _this1 = p._impulse; - _this1.impulseN = 0; - _this1.impulseT = 0; - _this1.impulseB = 0; - _this1.impulseP = 0; - _this1.impulseLX = 0; - _this1.impulseLY = 0; - _this1.impulseLZ = 0; + let _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; } row.impulse = p._impulse; } @@ -37991,25 +21118,22 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra _getPositionSolverInfo(info) { info.b1 = this._b1; info.b2 = this._b2; - var normal; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = this._manifold._normalX; normalY = this._manifold._normalY; normalZ = this._manifold._normalZ; - var num = this._manifold._numPoints; + let num = this._manifold._numPoints; info.numRows = 0; - var _g = 0; - var _g1 = num; - while(_g < _g1) { - var i = _g++; - var p = this._manifold._points[i]; + let _g = 0; + while(_g < num) { + let p = this._manifold._points[_g++]; if(p._disabled) { continue; } - var row = info.rows[info.numRows++]; - var j = row.jacobianN; + let row = info.rows[info.numRows++]; + let j = row.jacobianN; j.lin1X = normalX; j.lin1Y = normalY; j.lin1Z = normalZ; @@ -38042,13 +21166,10 @@ oimo.dynamics.constraint.contact.ContactConstraint = class oimo_dynamics_constra return this._manifold; } isTouching() { - var _g = 0; - var _g1 = this._manifold._numPoints; - while(_g < _g1) { - var i = _g++; - if(this._manifold._points[i]._depth >= 0) { - return true; - } + let _g = 0; + let _g1 = this._manifold._numPoints; + while(_g < _g1) if(this._manifold._points[_g++]._depth >= 0) { + return true; } return false; } @@ -38084,21 +21205,16 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta this._binormalY = 0; this._binormalZ = 0; this._numPoints = 0; - var this1 = new Array(oimo.common.Setting.maxManifoldPoints); - this._points = this1; - var _g = 0; - var _g1 = oimo.common.Setting.maxManifoldPoints; - while(_g < _g1) { - var i = _g++; - this._points[i] = new oimo.dynamics.constraint.contact.ManifoldPoint(); - } + this._points = new Array(oimo.common.Setting.maxManifoldPoints); + let _g = 0; + let _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) this._points[_g++] = new oimo.dynamics.constraint.contact.ManifoldPoint(); } _clear() { - var _g = 0; - var _g1 = this._numPoints; + let _g = 0; + let _g1 = this._numPoints; while(_g < _g1) { - var i = _g++; - var _this = this._points[i]; + let _this = this._points[_g++]; _this._localPos1X = 0; _this._localPos1Y = 0; _this._localPos1Z = 0; @@ -38118,7 +21234,7 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta _this._pos2Y = 0; _this._pos2Z = 0; _this._depth = 0; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -38133,25 +21249,24 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta this._numPoints = 0; } _buildBasis(normal) { - var v = normal; - this._normalX = v.x; - this._normalY = v.y; - this._normalZ = v.z; - var nx = normal.x; - var ny = normal.y; - var nz = normal.z; - var nx2 = nx * nx; - var ny2 = ny * ny; - var nz2 = nz * nz; - var tx; - var ty; - var tz; - var bx; - var by; - var bz; + this._normalX = normal.x; + this._normalY = normal.y; + this._normalZ = normal.z; + let nx = normal.x; + let ny = normal.y; + let nz = normal.z; + let nx2 = nx * nx; + let ny2 = ny * ny; + let nz2 = nz * nz; + let tx; + let ty; + let tz; + let bx; + let by; + let bz; if(nx2 < ny2) { if(nx2 < nz2) { - var invL = 1 / Math.sqrt(ny2 + nz2); + let invL = 1 / Math.sqrt(ny2 + nz2); tx = 0; ty = -nz * invL; tz = ny * invL; @@ -38159,26 +21274,26 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta by = -nx * tz; bz = nx * ty; } else { - var invL1 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL1; - ty = nx * invL1; + let invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; bz = nx * ty - ny * tx; } } else if(ny2 < nz2) { - var invL2 = 1 / Math.sqrt(nx2 + nz2); - tx = nz * invL2; + let invL = 1 / Math.sqrt(nx2 + nz2); + tx = nz * invL; ty = 0; - tz = -nx * invL2; + tz = -nx * invL; bx = ny * tz; by = nz * tx - nx * tz; bz = -ny * tx; } else { - var invL3 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL3; - ty = nx * invL3; + let invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; @@ -38192,23 +21307,22 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta this._binormalZ = bz; } _updateDepthsAndPositions(tf1,tf2) { - var _g = 0; - var _g1 = this._numPoints; + let _g = 0; + let _g1 = this._numPoints; while(_g < _g1) { - var i = _g++; - var p = this._points[i]; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let p = this._points[_g++]; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; p._relPos1X = __tmp__X; p._relPos1Y = __tmp__Y; p._relPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; @@ -38221,58 +21335,50 @@ oimo.dynamics.constraint.contact.Manifold = class oimo_dynamics_constraint_conta p._pos2X = p._relPos2X + tf2._positionX; p._pos2Y = p._relPos2Y + tf2._positionY; p._pos2Z = p._relPos2Z + tf2._positionZ; - var diff; - var diffX; - var diffY; - var diffZ; + let diffX; + let diffY; + let diffZ; diffX = p._pos1X - p._pos2X; diffY = p._pos1Y - p._pos2Y; diffZ = p._pos1Z - p._pos2Z; - var dotN = diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ; - p._depth = -dotN; + p._depth = -(diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ); } } getNormal() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._normalX; - v1.y = this._normalY; - v1.z = this._normalZ; - return v; - } - getNormalTo(normal) { - var v = normal; + let v = new oimo.common.Vec3(); v.x = this._normalX; v.y = this._normalY; v.z = this._normalZ; - } - getTangent() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._tangentX; - v1.y = this._tangentY; - v1.z = this._tangentZ; return v; } - getTangentTo(tangent) { - var v = tangent; + getNormalTo(normal) { + normal.x = this._normalX; + normal.y = this._normalY; + normal.z = this._normalZ; + } + getTangent() { + let v = new oimo.common.Vec3(); v.x = this._tangentX; v.y = this._tangentY; v.z = this._tangentZ; - } - getBinormal() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._binormalX; - v1.y = this._binormalY; - v1.z = this._binormalZ; return v; } - getBinormalTo(binormal) { - var v = binormal; + getTangentTo(tangent) { + tangent.x = this._tangentX; + tangent.y = this._tangentY; + tangent.z = this._tangentZ; + } + getBinormal() { + let v = new oimo.common.Vec3(); v.x = this._binormalX; v.y = this._binormalY; v.z = this._binormalZ; + return v; + } + getBinormalTo(binormal) { + binormal.x = this._binormalX; + binormal.y = this._binormalY; + binormal.z = this._binormalZ; } getPoints() { return this._points; @@ -38308,32 +21414,28 @@ oimo.dynamics.constraint.contact.ManifoldPoint = class oimo_dynamics_constraint_ this._id = -1; } getPosition1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._pos1X; - v1.y = this._pos1Y; - v1.z = this._pos1Z; - return v; - } - getPosition1To(position) { - var v = position; + let v = new oimo.common.Vec3(); v.x = this._pos1X; v.y = this._pos1Y; v.z = this._pos1Z; - } - getPosition2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._pos2X; - v1.y = this._pos2Y; - v1.z = this._pos2Z; return v; } - getPosition2To(position) { - var v = position; + getPosition1To(position) { + position.x = this._pos1X; + position.y = this._pos1Y; + position.z = this._pos1Z; + } + getPosition2() { + let v = new oimo.common.Vec3(); v.x = this._pos2X; v.y = this._pos2Y; v.z = this._pos2Z; + return v; + } + getPosition2To(position) { + position.x = this._pos2X; + position.y = this._pos2Y; + position.z = this._pos2Z; } getDepth() { return this._depth; @@ -38358,28 +21460,22 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain constructor(manifold) { this._manifold = manifold; this.numOldPoints = 0; - var this1 = new Array(oimo.common.Setting.maxManifoldPoints); - this.oldPoints = this1; - var _g = 0; - var _g1 = oimo.common.Setting.maxManifoldPoints; - while(_g < _g1) { - var i = _g++; - this.oldPoints[i] = new oimo.dynamics.constraint.contact.ManifoldPoint(); - } + this.oldPoints = new Array(oimo.common.Setting.maxManifoldPoints); + let _g = 0; + let _g1 = oimo.common.Setting.maxManifoldPoints; + while(_g < _g1) this.oldPoints[_g++] = new oimo.dynamics.constraint.contact.ManifoldPoint(); } removeOutdatedPoints() { - var num = this._manifold._numPoints; - var index = num; + let index = this._manifold._numPoints; while(--index >= 0) { - var p = this._manifold._points[index]; - var diff; - var diffX; - var diffY; - var diffZ; + let p = this._manifold._points[index]; + let diffX; + let diffY; + let diffZ; diffX = p._pos1X - p._pos2X; diffY = p._pos1Y - p._pos2Y; diffZ = p._pos1Z - p._pos2Z; - var dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; + let dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; if(dotN > oimo.common.Setting.contactPersistenceThreshold) { this.removeManifoldPoint(index); continue; @@ -38394,13 +21490,13 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain } } removeManifoldPoint(index) { - var lastIndex = --this._manifold._numPoints; + let lastIndex = --this._manifold._numPoints; if(index != lastIndex) { - var tmp = this._manifold._points[index]; + let tmp = this._manifold._points[index]; this._manifold._points[index] = this._manifold._points[lastIndex]; this._manifold._points[lastIndex] = tmp; } - var _this = this._manifold._points[lastIndex]; + let _this = this._manifold._points[lastIndex]; _this._localPos1X = 0; _this._localPos1Y = 0; _this._localPos1Z = 0; @@ -38420,7 +21516,7 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._pos2Y = 0; _this._pos2Z = 0; _this._depth = 0; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -38433,15 +21529,15 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._id = -1; } addManifoldPoint(point,tf1,tf2) { - var num = this._manifold._numPoints; + let num = this._manifold._numPoints; if(num == oimo.common.Setting.maxManifoldPoints) { - var targetIndex = this.computeTargetIndex(point,tf1,tf2); - var _this = this._manifold._points[targetIndex]; - var v = point.position1; + let targetIndex = this.computeTargetIndex(point,tf1,tf2); + let _this = this._manifold._points[targetIndex]; + let v = point.position1; _this._pos1X = v.x; _this._pos1Y = v.y; _this._pos1Z = v.z; - var v1 = point.position2; + let v1 = point.position2; _this._pos2X = v1.x; _this._pos2Y = v1.y; _this._pos2Z = v1.z; @@ -38451,18 +21547,18 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._relPos2X = _this._pos2X - tf2._positionX; _this._relPos2Y = _this._pos2Y - tf2._positionY; _this._relPos2Z = _this._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; _this._localPos1X = __tmp__X; _this._localPos1Y = __tmp__Y; _this._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; @@ -38470,7 +21566,7 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._localPos2Y = __tmp__Y1; _this._localPos2Z = __tmp__Z1; _this._depth = point.depth; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -38483,60 +21579,60 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._disabled = false; return; } - var _this2 = this._manifold._points[num]; - var v2 = point.position1; - _this2._pos1X = v2.x; - _this2._pos1Y = v2.y; - _this2._pos1Z = v2.z; - var v3 = point.position2; - _this2._pos2X = v3.x; - _this2._pos2Y = v3.y; - _this2._pos2Z = v3.z; - _this2._relPos1X = _this2._pos1X - tf1._positionX; - _this2._relPos1Y = _this2._pos1Y - tf1._positionY; - _this2._relPos1Z = _this2._pos1Z - tf1._positionZ; - _this2._relPos2X = _this2._pos2X - tf2._positionX; - _this2._relPos2Y = _this2._pos2Y - tf2._positionY; - _this2._relPos2Z = _this2._pos2Z - tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * _this2._relPos1X + tf1._rotation10 * _this2._relPos1Y + tf1._rotation20 * _this2._relPos1Z; - __tmp__Y2 = tf1._rotation01 * _this2._relPos1X + tf1._rotation11 * _this2._relPos1Y + tf1._rotation21 * _this2._relPos1Z; - __tmp__Z2 = tf1._rotation02 * _this2._relPos1X + tf1._rotation12 * _this2._relPos1Y + tf1._rotation22 * _this2._relPos1Z; - _this2._localPos1X = __tmp__X2; - _this2._localPos1Y = __tmp__Y2; - _this2._localPos1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * _this2._relPos2X + tf2._rotation10 * _this2._relPos2Y + tf2._rotation20 * _this2._relPos2Z; - __tmp__Y3 = tf2._rotation01 * _this2._relPos2X + tf2._rotation11 * _this2._relPos2Y + tf2._rotation21 * _this2._relPos2Z; - __tmp__Z3 = tf2._rotation02 * _this2._relPos2X + tf2._rotation12 * _this2._relPos2Y + tf2._rotation22 * _this2._relPos2Z; - _this2._localPos2X = __tmp__X3; - _this2._localPos2Y = __tmp__Y3; - _this2._localPos2Z = __tmp__Z3; - _this2._depth = point.depth; - var _this3 = _this2._impulse; - _this3.impulseN = 0; - _this3.impulseT = 0; - _this3.impulseB = 0; - _this3.impulseP = 0; - _this3.impulseLX = 0; - _this3.impulseLY = 0; - _this3.impulseLZ = 0; - _this2._id = point.id; - _this2._warmStarted = false; - _this2._disabled = false; + let _this = this._manifold._points[num]; + let v = point.position1; + _this._pos1X = v.x; + _this._pos1Y = v.y; + _this._pos1Z = v.z; + let v1 = point.position2; + _this._pos2X = v1.x; + _this._pos2Y = v1.y; + _this._pos2Z = v1.z; + _this._relPos1X = _this._pos1X - tf1._positionX; + _this._relPos1Y = _this._pos1Y - tf1._positionY; + _this._relPos1Z = _this._pos1Z - tf1._positionZ; + _this._relPos2X = _this._pos2X - tf2._positionX; + _this._relPos2Y = _this._pos2Y - tf2._positionY; + _this._relPos2Z = _this._pos2Z - tf2._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; + __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; + __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; + _this._localPos1X = __tmp__X; + _this._localPos1Y = __tmp__Y; + _this._localPos1Z = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X1; + _this._localPos2Y = __tmp__Y1; + _this._localPos2Z = __tmp__Z1; + _this._depth = point.depth; + let _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._id = point.id; + _this._warmStarted = false; + _this._disabled = false; this._manifold._numPoints++; } computeTargetIndex(newPoint,tf1,tf2) { - var p1 = this._manifold._points[0]; - var p2 = this._manifold._points[1]; - var p3 = this._manifold._points[2]; - var p4 = this._manifold._points[3]; - var maxDepth = p1._depth; - var maxDepthIndex = 0; + let p1 = this._manifold._points[0]; + let p2 = this._manifold._points[1]; + let p3 = this._manifold._points[2]; + let p4 = this._manifold._points[3]; + let maxDepth = p1._depth; + let maxDepthIndex = 0; if(p2._depth > maxDepth) { maxDepth = p2._depth; maxDepthIndex = 1; @@ -38549,50 +21645,43 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain maxDepth = p4._depth; maxDepthIndex = 3; } - var rp1; - var rp1X; - var rp1Y; - var rp1Z; - var v = newPoint.position1; + let rp1X; + let rp1Y; + let rp1Z; + let v = newPoint.position1; rp1X = v.x; rp1Y = v.y; rp1Z = v.z; rp1X -= tf1._positionX; rp1Y -= tf1._positionY; rp1Z -= tf1._positionZ; - var p1X = p2._relPos1X; - var p1Y = p2._relPos1Y; - var p1Z = p2._relPos1Z; - var p2X = p3._relPos1X; - var p2Y = p3._relPos1Y; - var p2Z = p3._relPos1Z; - var p3X = p4._relPos1X; - var p3Y = p4._relPos1Y; - var p3Z = p4._relPos1Z; - var v12; - var v12X; - var v12Y; - var v12Z; - var v34; - var v34X; - var v34Y; - var v34Z; - var v13; - var v13X; - var v13Y; - var v13Z; - var v24; - var v24X; - var v24Y; - var v24Z; - var v14; - var v14X; - var v14Y; - var v14Z; - var v23; - var v23X; - var v23Y; - var v23Z; + let p1X = p2._relPos1X; + let p1Y = p2._relPos1Y; + let p1Z = p2._relPos1Z; + let p2X = p3._relPos1X; + let p2Y = p3._relPos1Y; + let p2Z = p3._relPos1Z; + let p3X = p4._relPos1X; + let p3Y = p4._relPos1Y; + let p3Z = p4._relPos1Z; + let v12X; + let v12Y; + let v12Z; + let v34X; + let v34Y; + let v34Z; + let v13X; + let v13Y; + let v13Z; + let v24X; + let v24Y; + let v24Z; + let v14X; + let v14Y; + let v14Z; + let v23X; + let v23Y; + let v23Z; v12X = p2X - p1X; v12Y = p2Y - p1Y; v12Z = p2Z - p1Z; @@ -38611,18 +21700,15 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain v23X = p3X - p2X; v23Y = p3Y - p2Y; v23Z = p3Z - p2Z; - var cross1; - var cross1X; - var cross1Y; - var cross1Z; - var cross2; - var cross2X; - var cross2Y; - var cross2Z; - var cross3; - var cross3X; - var cross3Y; - var cross3Z; + let cross1X; + let cross1Y; + let cross1Z; + let cross2X; + let cross2Y; + let cross2Z; + let cross3X; + let cross3Y; + let cross3Z; cross1X = v12Y * v34Z - v12Z * v34Y; cross1Y = v12Z * v34X - v12X * v34Z; cross1Z = v12X * v34Y - v12Y * v34X; @@ -38632,43 +21718,36 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain cross3X = v14Y * v23Z - v14Z * v23Y; cross3Y = v14Z * v23X - v14X * v23Z; cross3Z = v14X * v23Y - v14Y * v23X; - var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; - var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; - var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; - var a11 = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; - var p1X1 = p1._relPos1X; - var p1Y1 = p1._relPos1Y; - var p1Z1 = p1._relPos1Z; - var p2X1 = p3._relPos1X; - var p2Y1 = p3._relPos1Y; - var p2Z1 = p3._relPos1Z; - var p3X1 = p4._relPos1X; - var p3Y1 = p4._relPos1Y; - var p3Z1 = p4._relPos1Z; - var v121; - var v12X1; - var v12Y1; - var v12Z1; - var v341; - var v34X1; - var v34Y1; - var v34Z1; - var v131; - var v13X1; - var v13Y1; - var v13Z1; - var v241; - var v24X1; - var v24Y1; - var v24Z1; - var v141; - var v14X1; - var v14Y1; - var v14Z1; - var v231; - var v23X1; - var v23Y1; - var v23Z1; + let a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + let a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + let a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + let p1X1 = p1._relPos1X; + let p1Y1 = p1._relPos1Y; + let p1Z1 = p1._relPos1Z; + let p2X1 = p3._relPos1X; + let p2Y1 = p3._relPos1Y; + let p2Z1 = p3._relPos1Z; + let p3X1 = p4._relPos1X; + let p3Y1 = p4._relPos1Y; + let p3Z1 = p4._relPos1Z; + let v12X1; + let v12Y1; + let v12Z1; + let v34X1; + let v34Y1; + let v34Z1; + let v13X1; + let v13Y1; + let v13Z1; + let v24X1; + let v24Y1; + let v24Z1; + let v14X1; + let v14Y1; + let v14Z1; + let v23X1; + let v23Y1; + let v23Z1; v12X1 = p2X1 - p1X1; v12Y1 = p2Y1 - p1Y1; v12Z1 = p2Z1 - p1Z1; @@ -38687,18 +21766,15 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain v23X1 = p3X1 - p2X1; v23Y1 = p3Y1 - p2Y1; v23Z1 = p3Z1 - p2Z1; - var cross11; - var cross1X1; - var cross1Y1; - var cross1Z1; - var cross21; - var cross2X1; - var cross2Y1; - var cross2Z1; - var cross31; - var cross3X1; - var cross3Y1; - var cross3Z1; + let cross1X1; + let cross1Y1; + let cross1Z1; + let cross2X1; + let cross2Y1; + let cross2Z1; + let cross3X1; + let cross3Y1; + let cross3Z1; cross1X1 = v12Y1 * v34Z1 - v12Z1 * v34Y1; cross1Y1 = v12Z1 * v34X1 - v12X1 * v34Z1; cross1Z1 = v12X1 * v34Y1 - v12Y1 * v34X1; @@ -38708,43 +21784,37 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; - var a12 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; - var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; - var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; - var a22 = a12 > a21 ? a12 > a31 ? a12 : a31 : a21 > a31 ? a21 : a31; - var p1X2 = p1._relPos1X; - var p1Y2 = p1._relPos1Y; - var p1Z2 = p1._relPos1Z; - var p2X2 = p2._relPos1X; - var p2Y2 = p2._relPos1Y; - var p2Z2 = p2._relPos1Z; - var p3X2 = p4._relPos1X; - var p3Y2 = p4._relPos1Y; - var p3Z2 = p4._relPos1Z; - var v122; - var v12X2; - var v12Y2; - var v12Z2; - var v342; - var v34X2; - var v34Y2; - var v34Z2; - var v132; - var v13X2; - var v13Y2; - var v13Z2; - var v242; - var v24X2; - var v24Y2; - var v24Z2; - var v142; - var v14X2; - var v14Y2; - var v14Z2; - var v232; - var v23X2; - var v23Y2; - var v23Z2; + let a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; + let a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; + let a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; + let a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; + let p1X2 = p1._relPos1X; + let p1Y2 = p1._relPos1Y; + let p1Z2 = p1._relPos1Z; + let p2X2 = p2._relPos1X; + let p2Y2 = p2._relPos1Y; + let p2Z2 = p2._relPos1Z; + let p3X2 = p4._relPos1X; + let p3Y2 = p4._relPos1Y; + let p3Z2 = p4._relPos1Z; + let v12X2; + let v12Y2; + let v12Z2; + let v34X2; + let v34Y2; + let v34Z2; + let v13X2; + let v13Y2; + let v13Z2; + let v24X2; + let v24Y2; + let v24Z2; + let v14X2; + let v14Y2; + let v14Z2; + let v23X2; + let v23Y2; + let v23Z2; v12X2 = p2X2 - p1X2; v12Y2 = p2Y2 - p1Y2; v12Z2 = p2Z2 - p1Z2; @@ -38763,18 +21833,15 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain v23X2 = p3X2 - p2X2; v23Y2 = p3Y2 - p2Y2; v23Z2 = p3Z2 - p2Z2; - var cross12; - var cross1X2; - var cross1Y2; - var cross1Z2; - var cross22; - var cross2X2; - var cross2Y2; - var cross2Z2; - var cross32; - var cross3X2; - var cross3Y2; - var cross3Z2; + let cross1X2; + let cross1Y2; + let cross1Z2; + let cross2X2; + let cross2Y2; + let cross2Z2; + let cross3X2; + let cross3Y2; + let cross3Z2; cross1X2 = v12Y2 * v34Z2 - v12Z2 * v34Y2; cross1Y2 = v12Z2 * v34X2 - v12X2 * v34Z2; cross1Z2 = v12X2 * v34Y2 - v12Y2 * v34X2; @@ -38784,43 +21851,37 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; - var a13 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; - var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; - var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; - var a33 = a13 > a23 ? a13 > a32 ? a13 : a32 : a23 > a32 ? a23 : a32; - var p1X3 = p1._relPos1X; - var p1Y3 = p1._relPos1Y; - var p1Z3 = p1._relPos1Z; - var p2X3 = p2._relPos1X; - var p2Y3 = p2._relPos1Y; - var p2Z3 = p2._relPos1Z; - var p3X3 = p3._relPos1X; - var p3Y3 = p3._relPos1Y; - var p3Z3 = p3._relPos1Z; - var v123; - var v12X3; - var v12Y3; - var v12Z3; - var v343; - var v34X3; - var v34Y3; - var v34Z3; - var v133; - var v13X3; - var v13Y3; - var v13Z3; - var v243; - var v24X3; - var v24Y3; - var v24Z3; - var v143; - var v14X3; - var v14Y3; - var v14Z3; - var v233; - var v23X3; - var v23Y3; - var v23Z3; + let a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; + let a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; + let a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; + let a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; + let p1X3 = p1._relPos1X; + let p1Y3 = p1._relPos1Y; + let p1Z3 = p1._relPos1Z; + let p2X3 = p2._relPos1X; + let p2Y3 = p2._relPos1Y; + let p2Z3 = p2._relPos1Z; + let p3X3 = p3._relPos1X; + let p3Y3 = p3._relPos1Y; + let p3Z3 = p3._relPos1Z; + let v12X3; + let v12Y3; + let v12Z3; + let v34X3; + let v34Y3; + let v34Z3; + let v13X3; + let v13Y3; + let v13Z3; + let v24X3; + let v24Y3; + let v24Z3; + let v14X3; + let v14Y3; + let v14Z3; + let v23X3; + let v23Y3; + let v23Z3; v12X3 = p2X3 - p1X3; v12Y3 = p2Y3 - p1Y3; v12Z3 = p2Z3 - p1Z3; @@ -38839,18 +21900,15 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain v23X3 = p3X3 - p2X3; v23Y3 = p3Y3 - p2Y3; v23Z3 = p3Z3 - p2Z3; - var cross13; - var cross1X3; - var cross1Y3; - var cross1Z3; - var cross23; - var cross2X3; - var cross2Y3; - var cross2Z3; - var cross33; - var cross3X3; - var cross3Y3; - var cross3Z3; + let cross1X3; + let cross1Y3; + let cross1Z3; + let cross2X3; + let cross2Y3; + let cross2Z3; + let cross3X3; + let cross3Y3; + let cross3Z3; cross1X3 = v12Y3 * v34Z3 - v12Z3 * v34Y3; cross1Y3 = v12Z3 * v34X3 - v12X3 * v34Z3; cross1Z3 = v12X3 * v34Y3 - v12Y3 * v34X3; @@ -38860,12 +21918,12 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; - var a14 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; - var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; - var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; - var a4 = a14 > a24 ? a14 > a34 ? a14 : a34 : a24 > a34 ? a24 : a34; - var max = a11; - var target = 0; + let a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; + let a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; + let a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; + let a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; + let max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; + let target = 0; if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { max = a22; target = 1; @@ -38881,24 +21939,22 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain return target; } computeRelativePositions(tf1,tf2) { - var num = this._manifold._numPoints; - var _g = 0; - var _g1 = num; - while(_g < _g1) { - var i = _g++; - var p = this._manifold._points[i]; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let num = this._manifold._numPoints; + let _g = 0; + while(_g < num) { + let p = this._manifold._points[_g++]; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; p._relPos1X = __tmp__X; p._relPos1Y = __tmp__Y; p._relPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; @@ -38909,26 +21965,24 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain } } findNearestContactPointIndex(target,tf1,tf2) { - var nearestSq = oimo.common.Setting.contactPersistenceThreshold * oimo.common.Setting.contactPersistenceThreshold; - var idx = -1; - var _g = 0; - var _g1 = this._manifold._numPoints; + let nearestSq = oimo.common.Setting.contactPersistenceThreshold * oimo.common.Setting.contactPersistenceThreshold; + let idx = -1; + let _g = 0; + let _g1 = this._manifold._numPoints; while(_g < _g1) { - var i = _g++; - var mp = this._manifold._points[i]; - var rp1; - var rp1X; - var rp1Y; - var rp1Z; - var rp2; - var rp2X; - var rp2Y; - var rp2Z; - var v = target.position1; + let i = _g++; + let mp = this._manifold._points[i]; + let rp1X; + let rp1Y; + let rp1Z; + let rp2X; + let rp2Y; + let rp2Z; + let v = target.position1; rp1X = v.x; rp1Y = v.y; rp1Z = v.z; - var v1 = target.position2; + let v1 = target.position2; rp2X = v1.x; rp2Y = v1.y; rp2Z = v1.z; @@ -38938,23 +21992,21 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain rp2X -= tf2._positionX; rp2Y -= tf2._positionY; rp2Z -= tf2._positionZ; - var diff1; - var diff1X; - var diff1Y; - var diff1Z; - var diff2; - var diff2X; - var diff2Y; - var diff2Z; + let diff1X; + let diff1Y; + let diff1Z; + let diff2X; + let diff2Y; + let diff2Z; diff1X = mp._relPos1X - rp1X; diff1Y = mp._relPos1Y - rp1Y; diff1Z = mp._relPos1Z - rp1Z; diff2X = mp._relPos2X - rp2X; diff2Y = mp._relPos2Y - rp2Y; diff2Z = mp._relPos2Z - rp2Z; - var sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; - var sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; - var d = sq1 < sq2 ? sq1 : sq2; + let sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; + let sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; + let d = sq1 < sq2 ? sq1 : sq2; if(d < nearestSq) { nearestSq = d; idx = i; @@ -38964,12 +22016,12 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain } totalUpdate(result,tf1,tf2) { this.numOldPoints = this._manifold._numPoints; - var _g = 0; - var _g1 = this.numOldPoints; + let _g = 0; + let _g1 = this.numOldPoints; while(_g < _g1) { - var i = _g++; - var _this = this.oldPoints[i]; - var cp = this._manifold._points[i]; + let i = _g++; + let _this = this.oldPoints[i]; + let cp = this._manifold._points[i]; _this._localPos1X = cp._localPos1X; _this._localPos1Y = cp._localPos1Y; _this._localPos1Z = cp._localPos1Z; @@ -38994,19 +22046,18 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain _this._warmStarted = cp._warmStarted; _this._disabled = false; } - var num = result.numPoints; + let num = result.numPoints; this._manifold._numPoints = num; - var _g2 = 0; - var _g11 = num; - while(_g2 < _g11) { - var i1 = _g2++; - var p = this._manifold._points[i1]; - var ref = result.points[i1]; - var v = ref.position1; + let _g2 = 0; + while(_g2 < num) { + let i = _g2++; + let p = this._manifold._points[i]; + let ref = result.points[i]; + let v = ref.position1; p._pos1X = v.x; p._pos1Y = v.y; p._pos1Z = v.z; - var v1 = ref.position2; + let v1 = ref.position2; p._pos2X = v1.x; p._pos2Y = v1.y; p._pos2Z = v1.z; @@ -39016,18 +22067,18 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain p._relPos2X = p._pos2X - tf2._positionX; p._relPos2Y = p._pos2Y - tf2._positionY; p._relPos2Z = p._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._relPos1X + tf1._rotation10 * p._relPos1Y + tf1._rotation20 * p._relPos1Z; __tmp__Y = tf1._rotation01 * p._relPos1X + tf1._rotation11 * p._relPos1Y + tf1._rotation21 * p._relPos1Z; __tmp__Z = tf1._rotation02 * p._relPos1X + tf1._rotation12 * p._relPos1Y + tf1._rotation22 * p._relPos1Z; p._localPos1X = __tmp__X; p._localPos1Y = __tmp__Y; p._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._relPos2X + tf2._rotation10 * p._relPos2Y + tf2._rotation20 * p._relPos2Z; __tmp__Y1 = tf2._rotation01 * p._relPos2X + tf2._rotation11 * p._relPos2Y + tf2._rotation21 * p._relPos2Z; __tmp__Z1 = tf2._rotation02 * p._relPos2X + tf2._rotation12 * p._relPos2Y + tf2._rotation22 * p._relPos2Z; @@ -39035,22 +22086,21 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain p._localPos2Y = __tmp__Y1; p._localPos2Z = __tmp__Z1; p._depth = ref.depth; - var _this1 = p._impulse; - _this1.impulseN = 0; - _this1.impulseT = 0; - _this1.impulseB = 0; - _this1.impulseP = 0; - _this1.impulseLX = 0; - _this1.impulseLY = 0; - _this1.impulseLZ = 0; + let _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; p._id = ref.id; p._warmStarted = false; p._disabled = false; - var _g3 = 0; - var _g12 = this.numOldPoints; - while(_g3 < _g12) { - var i2 = _g3++; - var ocp = this.oldPoints[i2]; + let _g = 0; + let _g1 = this.numOldPoints; + while(_g < _g1) { + let ocp = this.oldPoints[_g++]; if(p._id == ocp._id) { p._impulse.copyFrom(ocp._impulse); p._warmStarted = true; @@ -39061,23 +22111,20 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain } incrementalUpdate(result,tf1,tf2) { this._manifold._updateDepthsAndPositions(tf1,tf2); - var _g = 0; - var _g1 = this._manifold._numPoints; - while(_g < _g1) { - var i = _g++; - this._manifold._points[i]._warmStarted = true; - } - var newPoint = result.points[0]; - var index = this.findNearestContactPointIndex(newPoint,tf1,tf2); + let _g = 0; + let _g1 = this._manifold._numPoints; + while(_g < _g1) this._manifold._points[_g++]._warmStarted = true; + let newPoint = result.points[0]; + let index = this.findNearestContactPointIndex(newPoint,tf1,tf2); if(index == -1) { this.addManifoldPoint(newPoint,tf1,tf2); } else { - var cp = this._manifold._points[index]; - var v = newPoint.position1; + let cp = this._manifold._points[index]; + let v = newPoint.position1; cp._pos1X = v.x; cp._pos1Y = v.y; cp._pos1Z = v.z; - var v1 = newPoint.position2; + let v1 = newPoint.position2; cp._pos2X = v1.x; cp._pos2Y = v1.y; cp._pos2Z = v1.z; @@ -39087,18 +22134,18 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain cp._relPos2X = cp._pos2X - tf2._positionX; cp._relPos2Y = cp._pos2Y - tf2._positionY; cp._relPos2Z = cp._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * cp._relPos1X + tf1._rotation10 * cp._relPos1Y + tf1._rotation20 * cp._relPos1Z; __tmp__Y = tf1._rotation01 * cp._relPos1X + tf1._rotation11 * cp._relPos1Y + tf1._rotation21 * cp._relPos1Z; __tmp__Z = tf1._rotation02 * cp._relPos1X + tf1._rotation12 * cp._relPos1Y + tf1._rotation22 * cp._relPos1Z; cp._localPos1X = __tmp__X; cp._localPos1Y = __tmp__Y; cp._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; __tmp__Y1 = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; __tmp__Z1 = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; @@ -39143,14 +22190,10 @@ oimo.dynamics.constraint.info.contact.ContactSolverInfo = class oimo_dynamics_co this.b1 = null; this.b2 = null; this.numRows = 0; - var this1 = new Array(oimo.common.Setting.maxManifoldPoints); - this.rows = this1; - var _g = 0; - var _g1 = this.rows.length; - while(_g < _g1) { - var i = _g++; - this.rows[i] = new oimo.dynamics.constraint.info.contact.ContactSolverInfoRow(); - } + this.rows = new Array(oimo.common.Setting.maxManifoldPoints); + let _g = 0; + let _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo.dynamics.constraint.info.contact.ContactSolverInfoRow(); } } oimo.dynamics.constraint.info.contact.ContactSolverInfoRow = class oimo_dynamics_constraint_info_contact_ContactSolverInfoRow { @@ -39170,14 +22213,10 @@ oimo.dynamics.constraint.info.joint.JointSolverInfo = class oimo_dynamics_constr this.b1 = null; this.b2 = null; this.numRows = 0; - var this1 = new Array(oimo.common.Setting.maxJacobianRows); - this.rows = this1; - var _g = 0; - var _g1 = this.rows.length; - while(_g < _g1) { - var i = _g++; - this.rows[i] = new oimo.dynamics.constraint.info.joint.JointSolverInfoRow(); - } + this.rows = new Array(oimo.common.Setting.maxJacobianRows); + let _g = 0; + let _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo.dynamics.constraint.info.joint.JointSolverInfoRow(); } } oimo.dynamics.constraint.info.joint.JointSolverInfoRow = class oimo_dynamics_constraint_info_joint_JointSolverInfoRow { @@ -39227,11 +22266,11 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._solver = new oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver(this); break; } - var v = config.localAnchor1; + let v = config.localAnchor1; this._localAnchor1X = v.x; this._localAnchor1Y = v.y; this._localAnchor1Z = v.z; - var v1 = config.localAnchor2; + let v1 = config.localAnchor2; this._localAnchor2X = v1.x; this._localAnchor2Y = v1.y; this._localAnchor2Z = v1.z; @@ -39265,14 +22304,10 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ2X = 0; this._localBasisZ2Y = 0; this._localBasisZ2Z = 0; - var this1 = new Array(oimo.common.Setting.maxJacobianRows); - this._impulses = this1; - var _g1 = 0; - var _g2 = oimo.common.Setting.maxJacobianRows; - while(_g1 < _g2) { - var i = _g1++; - this._impulses[i] = new oimo.dynamics.constraint.joint.JointImpulse(); - } + this._impulses = new Array(oimo.common.Setting.maxJacobianRows); + let _g = 0; + let _g1 = oimo.common.Setting.maxJacobianRows; + while(_g < _g1) this._impulses[_g++] = new oimo.dynamics.constraint.joint.JointImpulse(); } buildLocalBasesFromX() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { @@ -39280,7 +22315,7 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -39293,62 +22328,60 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; - } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + let l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; + } + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } slerpQX = vX; @@ -39356,13 +22389,13 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join slerpQZ = vZ; slerpQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -39372,22 +22405,22 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join slerpQZ = cZ; slerpQW = w; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -39397,60 +22430,60 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x21 = x1 * x1; + let y21 = y1 * y1; + let z21 = z1 * z1; + let d1; + if(x21 < y21) { + if(x21 < z21) { + d1 = 1 / Math.sqrt(y21 + z21); this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; + this._localBasisY1Y = z1 * d1; + this._localBasisY1Z = -y1 * d1; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY1X = y1 * d1; + this._localBasisY1Y = -x1 * d1; this._localBasisY1Z = 0; } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; + } else if(y21 < z21) { + d1 = 1 / Math.sqrt(z21 + x21); + this._localBasisY1X = -z1 * d1; this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; + this._localBasisY1Z = x1 * d1; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY1X = y1 * d1; + this._localBasisY1Y = -x1 * d1; this._localBasisY1Z = 0; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; this._localBasisY2X = __tmp__X1; this._localBasisY2Y = __tmp__Y1; this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; @@ -39464,7 +22497,7 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -39477,13 +22510,13 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; @@ -39492,13 +22525,13 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -39526,59 +22559,59 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l2; - this._localBasisZ1Y *= l2; - this._localBasisZ1Z *= l2; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; } if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { - var x11 = this._localBasisX2X; - var y11 = this._localBasisX2Y; - var z11 = this._localBasisX2Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d1; - if(x21 < y21) { - if(x21 < z21) { - d1 = 1 / Math.sqrt(y21 + z21); + let x1 = this._localBasisX2X; + let y1 = this._localBasisX2Y; + let z1 = this._localBasisX2Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); this._localBasisY2X = 0; - this._localBasisY2Y = z11 * d1; - this._localBasisY2Z = -y11 * d1; + this._localBasisY2Y = z1 * d; + this._localBasisY2Z = -y1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } - } else if(y21 < z21) { - d1 = 1 / Math.sqrt(z21 + x21); - this._localBasisY2X = -z11 * d1; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY2X = -z1 * d; this._localBasisY2Y = 0; - this._localBasisY2Z = x11 * d1; + this._localBasisY2Z = x1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; } else { - var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ2X *= l3; - this._localBasisZ2Y *= l3; - this._localBasisZ2Z *= l3; + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; @@ -39590,7 +22623,7 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -39603,48 +22636,43 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ2Y = 0; this._localBasisZ2Z = 1; } else { - var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisZ2X *= l1; - this._localBasisZ2Y *= l1; - this._localBasisZ2Z *= l1; - } - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var worldX1; - var worldX1X; - var worldX1Y; - var worldX1Z; - var worldZ1; - var worldZ1X; - var worldZ1Y; - var worldZ1Z; - var worldY; - var worldYX; - var worldYY; - var worldYZ; - var worldX2; - var worldX2X; - var worldX2Y; - var worldX2Z; - var worldZ2; - var worldZ2X; - var worldZ2Y; - var worldZ2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; + } + let tf1 = this._b1._transform; + let tf2 = this._b2._transform; + let worldX1X; + let worldX1Y; + let worldX1Z; + let worldZ1X; + let worldZ1Y; + let worldZ1Z; + let worldYX; + let worldYY; + let worldYZ; + let worldX2X; + let worldX2Y; + let worldX2Z; + let worldZ2X; + let worldZ2Y; + let worldZ2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; worldX1X = __tmp__X; worldX1Y = __tmp__Y; worldX1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; @@ -39655,13 +22683,13 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { - var x1 = worldX1X; - var y1 = worldX1Y; - var z1 = worldX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = worldX1X; + let y1 = worldX1Y; + let z1 = worldX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -39692,54 +22720,54 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; this._localBasisX1X = __tmp__X2; this._localBasisX1Y = __tmp__Y2; this._localBasisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; this._localBasisY1X = __tmp__X3; this._localBasisY1Y = __tmp__Y3; this._localBasisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; this._localBasisZ1X = __tmp__X4; this._localBasisZ1Y = __tmp__Y4; this._localBasisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; this._localBasisX2X = __tmp__X5; this._localBasisX2Y = __tmp__Y5; this._localBasisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; + let __tmp__X6; + let __tmp__Y6; + let __tmp__Z6; __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; this._localBasisY2X = __tmp__X6; this._localBasisY2Y = __tmp__Y6; this._localBasisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; + let __tmp__X7; + let __tmp__Y7; + let __tmp__Z7; __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; @@ -39753,7 +22781,7 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -39765,13 +22793,13 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -39799,65 +22827,63 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l1; - this._localBasisZ1Y *= l1; - this._localBasisZ1Z *= l1; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; } - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d1 < -0.999999999) { - var vX; - var vY; - var vZ; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d2; - if(x21 < y21) { - if(x21 < z21) { - d2 = 1 / Math.sqrt(y21 + z21); + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z11 * d2; - vZ = -y11 * d2; + vY = z1 * d; + vZ = -y1 * d; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } - } else if(y21 < z21) { - d2 = 1 / Math.sqrt(z21 + x21); - vX = -z11 * d2; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x11 * d2; + vZ = x1 * d; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } slerpQX = vX; @@ -39865,38 +22891,38 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join slerpQZ = vZ; slerpQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d1) * 0.5); - d1 = 0.5 / w; - cX *= d1; - cY *= d1; - cZ *= d1; + let w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; slerpQX = cX; slerpQY = cY; slerpQZ = cZ; slerpQW = w; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x22 = 2 * x; - var y22 = 2 * y; - var z22 = 2 * z; - var xx = x * x22; - var yy = y * y22; - var zz = z * z22; - var xy = x * y22; - var yz = y * z22; - var xz = x * z22; - var wx = w1 * x22; - var wy = w1 * y22; - var wz = w1 * z22; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -39906,27 +22932,27 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; this._localBasisY2X = __tmp__X1; this._localBasisY2Y = __tmp__Y1; this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; @@ -39935,23 +22961,23 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._localBasisZ2Z = __tmp__Z2; } setSolverInfoRowLinear(row,diff,lm,mass,sd,timeStep,isPositionPart) { - var cfmFactor; - var erp; - var slop = oimo.common.Setting.linearSlop; + let cfmFactor; + let erp; + let slop = oimo.common.Setting.linearSlop; if(isPositionPart) { cfmFactor = 0; erp = 1; } else { if(sd.frequency > 0) { slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; + let omega = 6.28318530717958 * sd.frequency; + let zeta = sd.dampingRatio; if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { zeta = oimo.common.Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(sd.useSymplecticEuler) { cfmFactor = 1 / (h * c); erp = k / c; @@ -39971,11 +22997,11 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join row.motorMaxImpulse = 0; } } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var minImp; - var maxImp; - var error; + let lower = lm.lowerLimit; + let upper = lm.upperLimit; + let minImp; + let maxImp; + let error; if(lower > upper) { minImp = 0; maxImp = 0; @@ -40003,30 +23029,29 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join maxImp = 0; error = 0; } - var invMass = mass == 0 ? 0 : 1 / mass; row.minImpulse = minImp; row.maxImpulse = maxImp; - row.cfm = cfmFactor * invMass; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); row.rhs = error * erp; } setSolverInfoRowAngular(row,diff,lm,mass,sd,timeStep,isPositionPart) { - var cfmFactor; - var erp; - var slop = oimo.common.Setting.angularSlop; + let cfmFactor; + let erp; + let slop = oimo.common.Setting.angularSlop; if(isPositionPart) { cfmFactor = 0; erp = 1; } else { if(sd.frequency > 0) { slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; + let omega = 6.28318530717958 * sd.frequency; + let zeta = sd.dampingRatio; if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { zeta = oimo.common.Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(sd.useSymplecticEuler) { cfmFactor = 1 / (h * c); erp = k / c; @@ -40046,15 +23071,15 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join row.motorMaxImpulse = 0; } } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var mid = (lower + upper) * 0.5; + let lower = lm.lowerLimit; + let upper = lm.upperLimit; + let mid = (lower + upper) * 0.5; diff -= mid; diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; diff += mid; - var minImp; - var maxImp; - var error; + let minImp; + let maxImp; + let error; if(lower > upper) { minImp = 0; maxImp = 0; @@ -40082,10 +23107,9 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join maxImp = 0; error = 0; } - var invMass = mass == 0 ? 0 : 1 / mass; row.minImpulse = minImp; row.maxImpulse = maxImp; - row.cfm = cfmFactor * invMass; + row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); row.rhs = error * erp; } getErp(timeStep,isPositionPart) { @@ -40098,38 +23122,35 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join } } computeEffectiveInertiaMoment(axisX,axisY,axisZ) { - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ia1X; + let ia1Y; + let ia1Z; + let ia2X; + let ia2Y; + let ia2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; ia2X = __tmp__X1; ia2Y = __tmp__Y1; ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; + let invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; + let invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = rsq - dot * dot; + let dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; + let projsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z - dot * dot; if(projsq > 0) { if(this._b1._invMass > 0) { invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); @@ -40139,12 +23160,11 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join } } if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = rsq1 - dot1 * dot1; - if(projsq1 > 0) { + let dot = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + let projsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -40157,38 +23177,36 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join } } computeEffectiveInertiaMoment2(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { - var ia1; - var ia1X; - var ia1Y; - var ia1Z; - var ia2; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ia1X; + let ia1Y; + let ia1Z; + let ia2X; + let ia2Y; + let ia2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._b1._invInertia00 * axis1X + this._b1._invInertia01 * axis1Y + this._b1._invInertia02 * axis1Z; __tmp__Y = this._b1._invInertia10 * axis1X + this._b1._invInertia11 * axis1Y + this._b1._invInertia12 * axis1Z; __tmp__Z = this._b1._invInertia20 * axis1X + this._b1._invInertia21 * axis1Y + this._b1._invInertia22 * axis1Z; ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; ia2X = __tmp__X1; ia2Y = __tmp__Y1; ia2Z = __tmp__Z1; - var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; - var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; + let invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; + let invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; - var projsq = rsq * rsq - dot * dot; + let rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + let dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; + let projsq = rsq * rsq - dot * dot; if(projsq > 0) { if(this._b1._invMass > 0) { invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); @@ -40198,12 +23216,12 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join } } if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; - var projsq1 = rsq1 * rsq1 - dot1 * dot1; - if(projsq1 > 0) { + let rsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + let dot = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + let projsq = rsq * rsq - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -40216,20 +23234,20 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join } } _syncAnchors() { - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let tf1 = this._b1._transform; + let tf2 = this._b2._transform; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; this._relativeAnchor1X = __tmp__X; this._relativeAnchor1Y = __tmp__Y; this._relativeAnchor1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; @@ -40242,54 +23260,54 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._anchor2X = this._relativeAnchor2X + tf2._positionX; this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; this._basisX1X = __tmp__X2; this._basisX1Y = __tmp__Y2; this._basisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; this._basisY1X = __tmp__X3; this._basisY1Y = __tmp__Y3; this._basisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; this._basisZ1X = __tmp__X4; this._basisZ1Y = __tmp__Y4; this._basisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; this._basisX2X = __tmp__X5; this._basisX2Y = __tmp__Y5; this._basisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; + let __tmp__X6; + let __tmp__Y6; + let __tmp__Z6; __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; this._basisY2X = __tmp__X6; this._basisY2Y = __tmp__Y6; this._basisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; + let __tmp__X7; + let __tmp__Y7; + let __tmp__Z7; __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; @@ -40308,9 +23326,8 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join info.numRows = 0; } _checkDestruction() { - var forceSq = this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ; - var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; - if(this._breakForce > 0 && forceSq > this._breakForce * this._breakForce) { + let torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; + if(this._breakForce > 0 && this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ > this._breakForce * this._breakForce) { this._world.removeJoint(this); return; } @@ -40329,73 +23346,64 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join return this._type; } getAnchor1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._anchor1X; - v1.y = this._anchor1Y; - v1.z = this._anchor1Z; - return v; - } - getAnchor2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._anchor2X; - v1.y = this._anchor2Y; - v1.z = this._anchor2Z; - return v; - } - getAnchor1To(anchor) { - var v = anchor; + let v = new oimo.common.Vec3(); v.x = this._anchor1X; v.y = this._anchor1Y; v.z = this._anchor1Z; + return v; } - getAnchor2To(anchor) { - var v = anchor; + getAnchor2() { + let v = new oimo.common.Vec3(); v.x = this._anchor2X; v.y = this._anchor2Y; v.z = this._anchor2Z; - } - getLocalAnchor1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localAnchor1X; - v1.y = this._localAnchor1Y; - v1.z = this._localAnchor1Z; return v; } - getLocalAnchor2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localAnchor2X; - v1.y = this._localAnchor2Y; - v1.z = this._localAnchor2Z; - return v; + getAnchor1To(anchor) { + anchor.x = this._anchor1X; + anchor.y = this._anchor1Y; + anchor.z = this._anchor1Z; } - getLocalAnchor1To(localAnchor) { - var v = localAnchor; + getAnchor2To(anchor) { + anchor.x = this._anchor2X; + anchor.y = this._anchor2Y; + anchor.z = this._anchor2Z; + } + getLocalAnchor1() { + let v = new oimo.common.Vec3(); v.x = this._localAnchor1X; v.y = this._localAnchor1Y; v.z = this._localAnchor1Z; + return v; } - getLocalAnchor2To(localAnchor) { - var v = localAnchor; + getLocalAnchor2() { + let v = new oimo.common.Vec3(); v.x = this._localAnchor2X; v.y = this._localAnchor2Y; v.z = this._localAnchor2Z; + return v; + } + getLocalAnchor1To(localAnchor) { + localAnchor.x = this._localAnchor1X; + localAnchor.y = this._localAnchor1Y; + localAnchor.z = this._localAnchor1Z; + } + getLocalAnchor2To(localAnchor) { + localAnchor.x = this._localAnchor2X; + localAnchor.y = this._localAnchor2Y; + localAnchor.z = this._localAnchor2Z; } getBasis1() { - var m = new oimo.common.Mat3(); - var b; - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + let m = new oimo.common.Mat3(); + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX1X; b01 = this._basisY1X; b02 = this._basisZ1X; @@ -40405,30 +23413,28 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join b20 = this._basisX1Z; b21 = this._basisY1Z; b22 = this._basisZ1Z; - var m1 = m; - m1.e00 = b00; - m1.e01 = b01; - m1.e02 = b02; - m1.e10 = b10; - m1.e11 = b11; - m1.e12 = b12; - m1.e20 = b20; - m1.e21 = b21; - m1.e22 = b22; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; return m; } getBasis2() { - var m = new oimo.common.Mat3(); - var b; - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + let m = new oimo.common.Mat3(); + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX2X; b01 = this._basisY2X; b02 = this._basisZ2X; @@ -40438,29 +23444,27 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join b20 = this._basisX2Z; b21 = this._basisY2Z; b22 = this._basisZ2Z; - var m1 = m; - m1.e00 = b00; - m1.e01 = b01; - m1.e02 = b02; - m1.e10 = b10; - m1.e11 = b11; - m1.e12 = b12; - m1.e20 = b20; - m1.e21 = b21; - m1.e22 = b22; + m.e00 = b00; + m.e01 = b01; + m.e02 = b02; + m.e10 = b10; + m.e11 = b11; + m.e12 = b12; + m.e20 = b20; + m.e21 = b21; + m.e22 = b22; return m; } getBasis1To(basis) { - var b; - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX1X; b01 = this._basisY1X; b02 = this._basisZ1X; @@ -40470,28 +23474,26 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join b20 = this._basisX1Z; b21 = this._basisY1Z; b22 = this._basisZ1Z; - var m = basis; - m.e00 = b00; - m.e01 = b01; - m.e02 = b02; - m.e10 = b10; - m.e11 = b11; - m.e12 = b12; - m.e20 = b20; - m.e21 = b21; - m.e22 = b22; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; } getBasis2To(basis) { - var b; - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX2X; b01 = this._basisY2X; b02 = this._basisZ2X; @@ -40501,16 +23503,15 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join b20 = this._basisX2Z; b21 = this._basisY2Z; b22 = this._basisZ2Z; - var m = basis; - m.e00 = b00; - m.e01 = b01; - m.e02 = b02; - m.e10 = b10; - m.e11 = b11; - m.e12 = b12; - m.e20 = b20; - m.e21 = b21; - m.e22 = b22; + basis.e00 = b00; + basis.e01 = b01; + basis.e02 = b02; + basis.e10 = b10; + basis.e11 = b11; + basis.e12 = b12; + basis.e20 = b20; + basis.e21 = b21; + basis.e22 = b22; } getAllowCollision() { return this._allowCollision; @@ -40543,32 +23544,28 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join this._positionCorrectionAlgorithm = positionCorrectionAlgorithm; } getAppliedForce() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._appliedForceX; - v1.y = this._appliedForceY; - v1.z = this._appliedForceZ; - return v; - } - getAppliedForceTo(appliedForce) { - var v = appliedForce; + let v = new oimo.common.Vec3(); v.x = this._appliedForceX; v.y = this._appliedForceY; v.z = this._appliedForceZ; - } - getAppliedTorque() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._appliedTorqueX; - v1.y = this._appliedTorqueY; - v1.z = this._appliedTorqueZ; return v; } - getAppliedTorqueTo(appliedTorque) { - var v = appliedTorque; + getAppliedForceTo(appliedForce) { + appliedForce.x = this._appliedForceX; + appliedForce.y = this._appliedForceY; + appliedForce.z = this._appliedForceZ; + } + getAppliedTorque() { + let v = new oimo.common.Vec3(); v.x = this._appliedTorqueX; v.y = this._appliedTorqueY; v.z = this._appliedTorqueZ; + return v; + } + getAppliedTorqueTo(appliedTorque) { + appliedTorque.x = this._appliedTorqueX; + appliedTorque.y = this._appliedTorqueY; + appliedTorque.z = this._appliedTorqueZ; } getPrev() { return this._prev; @@ -40580,11 +23577,11 @@ oimo.dynamics.constraint.joint.Joint = class oimo_dynamics_constraint_joint_Join oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint_joint_CylindricalJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,2); - var v = config.localAxis1; + let v = config.localAxis1; this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; + let v1 = config.localAxis2; this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; @@ -40602,19 +23599,18 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint this._rotLm = config.rotationalLimitMotor.clone(); } getInfo(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linRhsY = this.linearErrorY * erp; - var linRhsZ = this.linearErrorZ * erp; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var row; - var j; - var translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); - var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + let erp = this.getErp(timeStep,isPositionPart); + let linRhsY = this.linearErrorY * erp; + let linRhsZ = this.linearErrorZ * erp; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let j; + let translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + let rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); if(this._translSd.frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row1 = info.rows[info.numRows++]; - var _this = row1.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -40627,15 +23623,14 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint _this.ang2X = 0; _this.ang2Y = 0; _this.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse; - row = row1; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowLinear(row,this.translation,this._translLm,translationalMotorMass,this._translSd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; @@ -40651,30 +23646,29 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row = row2; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; row.rhs = linRhsY; row.cfm = 0; row.minImpulse = -1e65536; @@ -40692,35 +23686,34 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row = row3; - row.rhs = linRhsZ; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; + let impulse1 = this._impulses[2]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; @@ -40734,30 +23727,29 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; if(this._rotSd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row = row4; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowAngular(row,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); j = row.jacobian; j.ang1X = this._basis.xX; @@ -40767,70 +23759,68 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint j.ang2Y = this._basis.xY; j.ang2Z = this._basis.xZ; } - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row = row5; - row.rhs = angRhsY; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; + let impulse2 = this._impulses[4]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = angRhsY; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; j.ang2X = this._basis.yX; j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row = row6; - row.rhs = angRhsZ; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; + let impulse3 = this._impulses[5]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsZ; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -40840,87 +23830,78 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint } _syncAnchors() { super._syncAnchors(); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var q; - var qX; - var qY; - var qZ; - var qW; - var idQ; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newX; - var newXX; - var newXY; - var newXZ; - var newY; - var newYX; - var newYY; - var newYZ; - var newZ; - var newZX; - var newZY; - var newZZ; - var prevX; - var prevXX; - var prevXY; - var prevXZ; - var prevY; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -40928,13 +23909,13 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -40948,18 +23929,14 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -40968,19 +23945,19 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -40989,7 +23966,7 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -40998,21 +23975,21 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -41022,22 +23999,22 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -41047,9 +24024,9 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -41062,78 +24039,78 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -41143,9 +24120,9 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -41156,42 +24133,42 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -41207,43 +24184,40 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var angError; - var angErrorX; - var angErrorY; - var angErrorZ; + let angErrorX; + let angErrorY; + let angErrorZ; angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + let cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + let theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + let l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCross; - var perpCrossX; - var perpCrossY; - var perpCrossZ; + let perpCrossX; + let perpCrossY; + let perpCrossZ; perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } - var anchorDiff; - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -41260,60 +24234,52 @@ oimo.dynamics.constraint.joint.CylindricalJoint = class oimo_dynamics_constraint this.getInfo(info,null,true); } getAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } getAxis1To(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } getAxis2To(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } getLocalAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } getLocalAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } getLocalAxis1To(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } getLocalAxis2To(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } getTranslationalSpringDamper() { return this._translSd; @@ -41349,56 +24315,52 @@ oimo.dynamics.constraint.joint.JointConfig = class oimo_dynamics_constraint_join _init(rb1,rb2,worldAnchor) { this.rigidBody1 = rb1; this.rigidBody2 = rb2; - var _this = this.rigidBody1; - var v; - var vX; - var vY; - var vZ; - var v1 = worldAnchor; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + let _this = this.rigidBody1; + let localPoint = this.localAnchor1; + let vX; + let vY; + let vZ; + vX = worldAnchor.x; + vY = worldAnchor.y; + vZ = worldAnchor.z; vX -= _this._transform._positionX; vY -= _this._transform._positionY; vZ -= _this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAnchor1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var _this1 = this.rigidBody2; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAnchor; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; + let _this1 = this.rigidBody2; + let localPoint1 = this.localAnchor2; + let vX1; + let vY1; + let vZ1; + vX1 = worldAnchor.x; + vY1 = worldAnchor.y; + vZ1 = worldAnchor.z; vX1 -= _this1._transform._positionX; vY1 -= _this1._transform._positionY; vZ1 -= _this1._transform._positionZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAnchor2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localPoint1.x = vX1; + localPoint1.y = vY1; + localPoint1.z = vZ1; } } oimo.dynamics.constraint.joint.CylindricalJointConfig = class oimo_dynamics_constraint_joint_CylindricalJointConfig extends oimo.dynamics.constraint.joint.JointConfig { @@ -41413,86 +24375,80 @@ oimo.dynamics.constraint.joint.CylindricalJointConfig = class oimo_dynamics_cons } init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } } oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joint_GenericJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,oimo.dynamics.constraint.joint.JointType.GENERIC); - var tmp; - var _this = config.localBasis1; + let tmp; + let _this = config.localBasis1; if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { - var _this1 = config.localBasis2; - tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; + let _this = config.localBasis2; + tmp = _this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0; } else { tmp = true; } if(tmp) { console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:50:","[warning] joint basis must be right handed"); } - var lb1; - var lb100; - var lb101; - var lb102; - var lb110; - var lb111; - var lb112; - var lb120; - var lb121; - var lb122; - var lb2; - var lb200; - var lb201; - var lb202; - var lb210; - var lb211; - var lb212; - var lb220; - var lb221; - var lb222; - var m = config.localBasis1; + let lb100; + let lb101; + let lb102; + let lb110; + let lb111; + let lb112; + let lb120; + let lb121; + let lb122; + let lb200; + let lb201; + let lb202; + let lb210; + let lb211; + let lb212; + let lb220; + let lb221; + let lb222; + let m = config.localBasis1; lb100 = m.e00; lb101 = m.e01; lb102 = m.e02; @@ -41502,7 +24458,7 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi lb120 = m.e20; lb121 = m.e21; lb122 = m.e22; - var m1 = config.localBasis2; + let m1 = config.localBasis2; lb200 = m1.e00; lb201 = m1.e01; lb202 = m1.e02; @@ -41539,14 +24495,10 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi this.xSingular = false; this.ySingular = false; this.zSingular = false; - var this1 = new Array(3); - this._translLms = this1; - var this2 = new Array(3); - this._translSds = this2; - var this3 = new Array(3); - this._rotLms = this3; - var this4 = new Array(3); - this._rotSds = this4; + this._translLms = new Array(3); + this._translSds = new Array(3); + this._rotLms = new Array(3); + this._rotSds = new Array(3); this._translLms[0] = config.translationalLimitMotors[0].clone(); this._translLms[1] = config.translationalLimitMotors[1].clone(); this._translLms[2] = config.translationalLimitMotors[2].clone(); @@ -41561,16 +24513,15 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi this._rotSds[2] = config.rotationalSpringDampers[2].clone(); } getInfo(info,timeStep,isPositionPart) { - var row; - var j; - var translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); - var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); - var motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); - var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + let j; + let translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + let motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + let motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); + let motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); if(this._translSds[0].frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row1 = info.rows[info.numRows++]; - var _this = row1.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -41583,15 +24534,14 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi _this.ang2X = 0; _this.ang2Y = 0; _this.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse; - row = row1; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowLinear(row,this.translationX,this._translLms[0],translMotorMass,this._translSds[0],timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basisX1X; @@ -41608,30 +24558,29 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; } if(this._translSds[1].frequency <= 0 || !isPositionPart) { - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row = row2; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowLinear(row,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basisY1X; @@ -41648,30 +24597,29 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; } if(this._translSds[2].frequency <= 0 || !isPositionPart) { - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row = row3; + let impulse = this._impulses[2]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowLinear(row,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basisZ1X; @@ -41688,30 +24636,29 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; } if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row = row4; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowAngular(row,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); j = row.jacobian; j.ang1X = this._axisXX; @@ -41722,30 +24669,29 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi j.ang2Z = this._axisXZ; } if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row = row5; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowAngular(row,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); j = row.jacobian; j.ang1X = this._axisYX; @@ -41756,30 +24702,29 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row = row6; + let impulse = this._impulses[5]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; this.setSolverInfoRowAngular(row,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); j = row.jacobian; j.ang1X = this._axisZX; @@ -41792,93 +24737,15 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi } _syncAnchors() { super._syncAnchors(); - var rot1; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot2; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; - rot100 = this._basisX1X; - rot101 = this._basisY1X; - rot102 = this._basisZ1X; - rot110 = this._basisX1Y; - rot111 = this._basisY1Y; - rot112 = this._basisZ1Y; - rot120 = this._basisX1Z; - rot121 = this._basisY1Z; - rot122 = this._basisZ1Z; - rot200 = this._basisX2X; - rot201 = this._basisY2X; - rot202 = this._basisZ2X; - rot210 = this._basisX2Y; - rot211 = this._basisY2Y; - rot212 = this._basisZ2Y; - rot220 = this._basisX2Z; - rot221 = this._basisY2Z; - rot222 = this._basisZ2Z; - var relRot; - var relRot00; - var relRot01; - var relRot02; - var relRot10; - var relRot11; - var relRot12; - var relRot20; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; - __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; - __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; - __tmp__10 = rot101 * rot200 + rot111 * rot210 + rot121 * rot220; - __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; - __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; - __tmp__20 = rot102 * rot200 + rot112 * rot210 + rot122 * rot220; - __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; - __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; - relRot00 = __tmp__00; - relRot01 = __tmp__01; - relRot02 = __tmp__02; - relRot10 = __tmp__10; - relRot11 = __tmp__11; - relRot12 = __tmp__12; - relRot20 = __tmp__20; - relRot21 = __tmp__21; - relRot22 = __tmp__22; - var angleAxisX; - var angleAxisXX; - var angleAxisXY; - var angleAxisXZ; - var angleAxisY; - var angleAxisYX; - var angleAxisYY; - var angleAxisYZ; - var angleAxisZ; - var angleAxisZX; - var angleAxisZY; - var angleAxisZZ; + let angleAxisXX; + let angleAxisXY; + let angleAxisXZ; + let angleAxisYX; + let angleAxisYY; + let angleAxisYZ; + let angleAxisZX; + let angleAxisZY; + let angleAxisZZ; angleAxisXX = this._basisX1X; angleAxisXY = this._basisX1Y; angleAxisXZ = this._basisX1Z; @@ -41897,21 +24764,21 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; - var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + let l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; if(l > 0) { l = 1 / Math.sqrt(l); } this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + let l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } this._axisYX *= l1; this._axisYY *= l1; this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + let l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; if(l2 > 0) { l2 = 1 / Math.sqrt(l2); } @@ -41921,111 +24788,95 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; - var rot11; - var rot1001; - var rot1011; - var rot1021; - var rot1101; - var rot1111; - var rot1121; - var rot1201; - var rot1211; - var rot1221; - var rot21; - var rot2001; - var rot2011; - var rot2021; - var rot2101; - var rot2111; - var rot2121; - var rot2201; - var rot2211; - var rot2221; - rot1001 = this._basisX1X; - rot1011 = this._basisY1X; - rot1021 = this._basisZ1X; - rot1101 = this._basisX1Y; - rot1111 = this._basisY1Y; - rot1121 = this._basisZ1Y; - rot1201 = this._basisX1Z; - rot1211 = this._basisY1Z; - rot1221 = this._basisZ1Z; - rot2001 = this._basisX2X; - rot2011 = this._basisY2X; - rot2021 = this._basisZ2X; - rot2101 = this._basisX2Y; - rot2111 = this._basisY2Y; - rot2121 = this._basisZ2Y; - rot2201 = this._basisX2Z; - rot2211 = this._basisY2Z; - rot2221 = this._basisZ2Z; - var relRot1; - var relRot001; - var relRot011; - var relRot021; - var relRot101; - var relRot111; - var relRot121; - var relRot201; - var relRot211; - var relRot221; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = rot1001 * rot2001 + rot1101 * rot2101 + rot1201 * rot2201; - __tmp__011 = rot1001 * rot2011 + rot1101 * rot2111 + rot1201 * rot2211; - __tmp__021 = rot1001 * rot2021 + rot1101 * rot2121 + rot1201 * rot2221; - __tmp__101 = rot1011 * rot2001 + rot1111 * rot2101 + rot1211 * rot2201; - __tmp__111 = rot1011 * rot2011 + rot1111 * rot2111 + rot1211 * rot2211; - __tmp__121 = rot1011 * rot2021 + rot1111 * rot2121 + rot1211 * rot2221; - __tmp__201 = rot1021 * rot2001 + rot1121 * rot2101 + rot1221 * rot2201; - __tmp__211 = rot1021 * rot2011 + rot1121 * rot2111 + rot1221 * rot2211; - __tmp__221 = rot1021 * rot2021 + rot1121 * rot2121 + rot1221 * rot2221; - relRot001 = __tmp__001; - relRot011 = __tmp__011; - relRot021 = __tmp__021; - relRot101 = __tmp__101; - relRot111 = __tmp__111; - relRot121 = __tmp__121; - relRot201 = __tmp__201; - relRot211 = __tmp__211; - relRot221 = __tmp__221; - var angles; - var anglesX; - var anglesY; - var anglesZ; - var sy = relRot021; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + let relRot00; + let relRot01; + let relRot02; + let relRot11; + let relRot12; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__11; + let __tmp__12; + let __tmp__21; + let __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + let anglesX; + let anglesY; + let anglesZ; + let sy = relRot02; if(sy <= -1) { - var xSubZ = Math.atan2(relRot211,relRot111); + let xSubZ = Math.atan2(relRot21,relRot11); anglesX = xSubZ * 0.5; anglesY = -1.570796326794895; anglesZ = -xSubZ * 0.5; } else if(sy >= 1) { - var xAddZ = Math.atan2(relRot211,relRot111); + let xAddZ = Math.atan2(relRot21,relRot11); anglesX = xAddZ * 0.5; anglesY = 1.570796326794895; anglesZ = xAddZ * 0.5; } else { - var y = Math.asin(sy); - var x = Math.atan2(-relRot121,relRot221); - var z = Math.atan2(-relRot011,relRot001); - anglesX = x; - anglesY = y; - anglesZ = z; + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); } this._angleX = anglesX; this._angleY = anglesY; this._angleZ = anglesZ; - var anchorDiff; - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -42042,27 +24893,24 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi this.getInfo(info,null,true); } getAxisX() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxisY() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._axisYX; - v1.y = this._axisYY; - v1.z = this._axisYZ; + let v = new oimo.common.Vec3(); + v.x = this._axisYX; + v.y = this._axisYY; + v.z = this._axisYZ; return v; } getAxisZ() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisZ2X; - v1.y = this._basisZ2Y; - v1.z = this._basisZ2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; return v; } getTranslationalSpringDampers() { @@ -42089,12 +24937,12 @@ oimo.dynamics.constraint.joint.GenericJointConfig = class oimo_dynamics_constrai super(); this.localBasis1 = new oimo.common.Mat3(); this.localBasis2 = new oimo.common.Mat3(); - var _g = []; + let _g = []; _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); _g.push(new oimo.dynamics.constraint.joint.TranslationalLimitMotor().setLimits(0,0)); this.translationalLimitMotors = _g; - var _g1 = []; + let _g1 = []; _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); _g1.push(new oimo.dynamics.constraint.joint.RotationalLimitMotor().setLimits(0,0)); @@ -42104,77 +24952,71 @@ oimo.dynamics.constraint.joint.GenericJointConfig = class oimo_dynamics_constrai } init(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var tf1 = rigidBody1._transform; - var tf2 = rigidBody2._transform; - var wb1; - var wb100; - var wb101; - var wb102; - var wb110; - var wb111; - var wb112; - var wb120; - var wb121; - var wb122; - var wb2; - var wb200; - var wb201; - var wb202; - var wb210; - var wb211; - var wb212; - var wb220; - var wb221; - var wb222; - var lb1; - var lb100; - var lb101; - var lb102; - var lb110; - var lb111; - var lb112; - var lb120; - var lb121; - var lb122; - var lb2; - var lb200; - var lb201; - var lb202; - var lb210; - var lb211; - var lb212; - var lb220; - var lb221; - var lb222; - var m = worldBasis1; - wb100 = m.e00; - wb101 = m.e01; - wb102 = m.e02; - wb110 = m.e10; - wb111 = m.e11; - wb112 = m.e12; - wb120 = m.e20; - wb121 = m.e21; - wb122 = m.e22; - var m1 = worldBasis2; - wb200 = m1.e00; - wb201 = m1.e01; - wb202 = m1.e02; - wb210 = m1.e10; - wb211 = m1.e11; - wb212 = m1.e12; - wb220 = m1.e20; - wb221 = m1.e21; - wb222 = m1.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let tf1 = rigidBody1._transform; + let tf2 = rigidBody2._transform; + let wb100; + let wb101; + let wb102; + let wb110; + let wb111; + let wb112; + let wb120; + let wb121; + let wb122; + let wb200; + let wb201; + let wb202; + let wb210; + let wb211; + let wb212; + let wb220; + let wb221; + let wb222; + let lb100; + let lb101; + let lb102; + let lb110; + let lb111; + let lb112; + let lb120; + let lb121; + let lb122; + let lb200; + let lb201; + let lb202; + let lb210; + let lb211; + let lb212; + let lb220; + let lb221; + let lb222; + wb100 = worldBasis1.e00; + wb101 = worldBasis1.e01; + wb102 = worldBasis1.e02; + wb110 = worldBasis1.e10; + wb111 = worldBasis1.e11; + wb112 = worldBasis1.e12; + wb120 = worldBasis1.e20; + wb121 = worldBasis1.e21; + wb122 = worldBasis1.e22; + wb200 = worldBasis2.e00; + wb201 = worldBasis2.e01; + wb202 = worldBasis2.e02; + wb210 = worldBasis2.e10; + wb211 = worldBasis2.e11; + wb212 = worldBasis2.e12; + wb220 = worldBasis2.e20; + wb221 = worldBasis2.e21; + wb222 = worldBasis2.e22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * wb100 + tf1._rotation10 * wb110 + tf1._rotation20 * wb120; __tmp__01 = tf1._rotation00 * wb101 + tf1._rotation10 * wb111 + tf1._rotation20 * wb121; __tmp__02 = tf1._rotation00 * wb102 + tf1._rotation10 * wb112 + tf1._rotation20 * wb122; @@ -42193,15 +25035,15 @@ oimo.dynamics.constraint.joint.GenericJointConfig = class oimo_dynamics_constrai lb120 = __tmp__20; lb121 = __tmp__21; lb122 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; @@ -42220,26 +25062,26 @@ oimo.dynamics.constraint.joint.GenericJointConfig = class oimo_dynamics_constrai lb220 = __tmp__201; lb221 = __tmp__211; lb222 = __tmp__221; - var m2 = this.localBasis1; - m2.e00 = lb100; - m2.e01 = lb101; - m2.e02 = lb102; - m2.e10 = lb110; - m2.e11 = lb111; - m2.e12 = lb112; - m2.e20 = lb120; - m2.e21 = lb121; - m2.e22 = lb122; - var m3 = this.localBasis2; - m3.e00 = lb200; - m3.e01 = lb201; - m3.e02 = lb202; - m3.e10 = lb210; - m3.e11 = lb211; - m3.e12 = lb212; - m3.e20 = lb220; - m3.e21 = lb221; - m3.e22 = lb222; + let m = this.localBasis1; + m.e00 = lb100; + m.e01 = lb101; + m.e02 = lb102; + m.e10 = lb110; + m.e11 = lb111; + m.e12 = lb112; + m.e20 = lb120; + m.e21 = lb121; + m.e22 = lb122; + let m1 = this.localBasis2; + m1.e00 = lb200; + m1.e01 = lb201; + m1.e02 = lb202; + m1.e10 = lb210; + m1.e11 = lb211; + m1.e12 = lb212; + m1.e20 = lb220; + m1.e21 = lb221; + m1.e22 = lb222; return this; } } @@ -42274,11 +25116,11 @@ oimo.dynamics.constraint.joint.JointType = class oimo_dynamics_constraint_joint_ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_joint_PrismaticJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,oimo.dynamics.constraint.joint.JointType.PRISMATIC); - var v = config.localAxis1; + let v = config.localAxis1; this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; + let v1 = config.localAxis2; this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; @@ -42294,19 +25136,17 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j this._lm = config.limitMotor.clone(); } getInfo(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linRhsY = this.linearErrorY * erp; - var linRhsZ = this.linearErrorZ * erp; - var angRhsX = this.angularErrorX * erp; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var row; - var j; - var motorMass = 1 / (this._b1._invMass + this._b2._invMass); + let erp = this.getErp(timeStep,isPositionPart); + let linRhsY = this.linearErrorY * erp; + let linRhsZ = this.linearErrorZ * erp; + let angRhsX = this.angularErrorX * erp; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let j; if(this._sd.frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row1 = info.rows[info.numRows++]; - var _this = row1.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -42319,16 +25159,15 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j _this.ang2X = 0; _this.ang2Y = 0; _this.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse; - row = row1; - this.setSolverInfoRowLinear(row,this.translation,this._lm,motorMass,this._sd,timeStep,isPositionPart); + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translation,this._lm,1 / (this._b1._invMass + this._b2._invMass),this._sd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; j.lin1Y = this._basis.xY; @@ -42343,30 +25182,29 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row = row2; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; row.rhs = linRhsY; row.cfm = 0; row.minImpulse = -1e65536; @@ -42384,35 +25222,34 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row = row3; - row.rhs = linRhsZ; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; + let impulse1 = this._impulses[2]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; + _this1.lin1X = 0; + _this1.lin1Y = 0; + _this1.lin1Z = 0; + _this1.lin2X = 0; + _this1.lin2Y = 0; + _this1.lin2Z = 0; + _this1.ang1X = 0; + _this1.ang1Y = 0; + _this1.ang1Z = 0; + _this1.ang2X = 0; + _this1.ang2Y = 0; + _this1.ang2Z = 0; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linRhsZ; + row1.cfm = 0; + row1.minImpulse = -1e65536; + row1.maxImpulse = 1e65536; + j = row1.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; @@ -42425,9 +25262,43 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; + let impulse2 = this._impulses[3]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; + _this2.lin1X = 0; + _this2.lin1Y = 0; + _this2.lin1Z = 0; + _this2.lin2X = 0; + _this2.lin2Y = 0; + _this2.lin2Z = 0; + _this2.ang1X = 0; + _this2.ang1Y = 0; + _this2.ang1Z = 0; + _this2.ang2X = 0; + _this2.ang2Y = 0; + _this2.ang2Z = 0; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = angRhsX; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; + j.ang1X = 1; + j.ang1Y = 0; + j.ang1Z = 0; + j.ang2X = 1; + j.ang2Y = 0; + j.ang2Z = 0; + let impulse3 = this._impulses[4]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -42440,29 +25311,28 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j _this3.ang2X = 0; _this3.ang2Y = 0; _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row = row4; - row.rhs = angRhsX; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; - j.ang1X = 1; - j.ang1Y = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsY; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; + j.ang1X = 0; + j.ang1Y = 1; j.ang1Z = 0; - j.ang2X = 1; - j.ang2Y = 0; + j.ang2X = 0; + j.ang2Y = 1; j.ang2Z = 0; - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + let impulse4 = this._impulses[5]; + let row4 = info.rows[info.numRows++]; + let _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -42475,55 +25345,19 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row = row5; - row.rhs = angRhsY; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; - j.ang1X = 0; - j.ang1Y = 1; - j.ang1Z = 0; - j.ang2X = 0; - j.ang2Y = 1; - j.ang2Z = 0; - var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row = row6; - row.rhs = angRhsZ; - row.cfm = 0; - row.minImpulse = -1e65536; - row.maxImpulse = 1e65536; - j = row.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsZ; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = 0; j.ang1Y = 0; j.ang1Z = 1; @@ -42533,87 +25367,78 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j } _syncAnchors() { super._syncAnchors(); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var q; - var qX; - var qY; - var qZ; - var qW; - var idQ; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newX; - var newXX; - var newXY; - var newXZ; - var newY; - var newYX; - var newYY; - var newYZ; - var newZ; - var newZX; - var newZY; - var newZZ; - var prevX; - var prevXX; - var prevXY; - var prevXZ; - var prevY; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -42621,13 +25446,13 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -42641,18 +25466,14 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -42661,19 +25482,19 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -42682,7 +25503,7 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -42691,21 +25512,21 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -42715,22 +25536,22 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -42740,9 +25561,9 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -42755,78 +25576,78 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -42836,9 +25657,9 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -42849,42 +25670,42 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -42900,26 +25721,24 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var rot1; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot2; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; rot100 = this._basisX1X; rot101 = this._basisY1X; rot102 = this._basisZ1X; @@ -42938,25 +25757,24 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot; - var relRot00; - var relRot01; - var relRot02; - var relRot10; - var relRot11; - var relRot12; - var relRot20; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let relRot00; + let relRot01; + let relRot02; + let relRot10; + let relRot11; + let relRot12; + let relRot20; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot200 * rot100 + rot201 * rot101 + rot202 * rot102; __tmp__01 = rot200 * rot110 + rot201 * rot111 + rot202 * rot112; __tmp__02 = rot200 * rot120 + rot201 * rot121 + rot202 * rot122; @@ -42975,16 +25793,15 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j relRot20 = __tmp__20; relRot21 = __tmp__21; relRot22 = __tmp__22; - var relQ; - var relQX; - var relQY; - var relQZ; - var relQW; - var e00 = relRot00; - var e11 = relRot11; - var e22 = relRot22; - var t = e00 + e11 + e22; - var s; + let relQX; + let relQY; + let relQZ; + let relQW; + let e00 = relRot00; + let e11 = relRot11; + let e22 = relRot22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); relQW = 0.5 * s; @@ -43023,25 +25840,24 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j relQY = (relRot12 + relRot21) * s; relQW = (relRot10 - relRot01) * s; } - var cosHalfTheta = relQW; - var theta1 = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; + let cosHalfTheta = relQW; + let theta = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; this.angularErrorX = relQX; this.angularErrorY = relQY; this.angularErrorZ = relQZ; - var l3 = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - this.angularErrorX *= l3; - this.angularErrorY *= l3; - this.angularErrorZ *= l3; - this.angularErrorX *= theta1; - this.angularErrorY *= theta1; - this.angularErrorZ *= theta1; - var anchorDiff; - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let l = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this.angularErrorX *= l; + this.angularErrorY *= l; + this.angularErrorZ *= l; + this.angularErrorX *= theta; + this.angularErrorY *= theta; + this.angularErrorZ *= theta; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -43058,60 +25874,52 @@ oimo.dynamics.constraint.joint.PrismaticJoint = class oimo_dynamics_constraint_j this.getInfo(info,null,true); } getAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } getAxis1To(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } getAxis2To(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } getLocalAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } getLocalAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } getLocalAxis1To(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } getLocalAxis2To(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } getSpringDamper() { return this._sd; @@ -43133,63 +25941,59 @@ oimo.dynamics.constraint.joint.PrismaticJointConfig = class oimo_dynamics_constr } init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } } oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joint_RagdollJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,oimo.dynamics.constraint.joint.JointType.RAGDOLL); - var v = config.localTwistAxis1; + let v = config.localTwistAxis1; this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localSwingAxis1; + let v1 = config.localSwingAxis1; this._localBasisY1X = v1.x; this._localBasisY1Y = v1.y; this._localBasisY1Z = v1.z; - var v2 = config.localTwistAxis2; + let v2 = config.localTwistAxis2; this._localBasisX2X = v2.x; this._localBasisX2Y = v2.y; this._localBasisX2Z = v2.z; @@ -43219,37 +26023,31 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi this.twistAxisZ = 0; } getInfo(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhs; - var linearRhsX; - var linearRhsY; - var linearRhsZ; + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -43286,11 +26084,11 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); - var twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); + let twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -43311,12 +26109,11 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -43329,9 +26126,9 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -43344,16 +26141,15 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = 0; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; @@ -43370,9 +26166,9 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -43385,20 +26181,19 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -43412,32 +26207,31 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi j.ang2Y = crossR221; j.ang2Z = crossR222; if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - this.setSolverInfoRowAngular(row1,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); - j = row1.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.swingAxisX; j.ang1Y = this.swingAxisY; j.ang1Z = this.swingAxisZ; @@ -43446,32 +26240,31 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi j.ang2Z = this.swingAxisZ; } if(this._twistSd.frequency <= 0 || !isPositionPart) { - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - this.setSolverInfoRowAngular(row1,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); - j = row1.jacobian; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.twistAxisX; j.ang1Y = this.twistAxisY; j.ang1Z = this.twistAxisZ; @@ -43482,42 +26275,27 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi } _syncAnchors() { super._syncAnchors(); - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var axis1; - var axis1X; - var axis1Y; - var axis1Z; - var axis2; - var axis2X; - var axis2Y; - var axis2Z; + let axis1X; + let axis1Y; + let axis1Z; + let axis2X; + let axis2Y; + let axis2Z; axis1X = this._basisX1X; axis1Y = this._basisX1Y; axis1Z = this._basisX1Z; axis2X = this._basisX2X; axis2Y = this._basisX2Y; axis2Z = this._basisX2Z; - var basis1Mat; - var basis1Mat00; - var basis1Mat01; - var basis1Mat02; - var basis1Mat10; - var basis1Mat11; - var basis1Mat12; - var basis1Mat20; - var basis1Mat21; - var basis1Mat22; - var basis2Mat; - var basis2Mat00; - var basis2Mat01; - var basis2Mat02; - var basis2Mat10; - var basis2Mat11; - var basis2Mat12; - var basis2Mat20; - var basis2Mat21; - var basis2Mat22; + let basis1Mat00; + let basis1Mat01; + let basis1Mat02; + let basis1Mat10; + let basis1Mat11; + let basis1Mat12; + let basis1Mat20; + let basis1Mat21; + let basis1Mat22; basis1Mat00 = this._basisX1X; basis1Mat01 = this._basisY1X; basis1Mat02 = this._basisZ1X; @@ -43527,67 +26305,55 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi basis1Mat20 = this._basisX1Z; basis1Mat21 = this._basisY1Z; basis1Mat22 = this._basisZ1Z; - basis2Mat00 = this._basisX2X; - basis2Mat01 = this._basisY2X; - basis2Mat02 = this._basisZ2X; - basis2Mat10 = this._basisX2Y; - basis2Mat11 = this._basisY2Y; - basis2Mat12 = this._basisZ2Y; - basis2Mat20 = this._basisX2Z; - basis2Mat21 = this._basisY2Z; - basis2Mat22 = this._basisZ2Z; - var swingQ; - var swingQX; - var swingQY; - var swingQZ; - var swingQW; - var swingM; - var swingM00; - var swingM01; - var swingM02; - var swingM10; - var swingM11; - var swingM12; - var swingM20; - var swingM21; - var swingM22; - var swingV; - var swingVX; - var swingVY; - var swingVZ; - var d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; + let swingQX; + let swingQY; + let swingQZ; + let swingQW; + let swingM00; + let swingM01; + let swingM02; + let swingM10; + let swingM11; + let swingM12; + let swingM20; + let swingM21; + let swingM22; + let swingVX; + let swingVY; + let swingVZ; + let d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = axis1X; - var y1 = axis1Y; - var z1 = axis1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = axis1X; + let y1 = axis1Y; + let z1 = axis1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } swingQX = vX; @@ -43595,13 +26361,13 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi swingQZ = vZ; swingQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = axis1Y * axis2Z - axis1Z * axis2Y; cY = axis1Z * axis2X - axis1X * axis2Z; cZ = axis1X * axis2Y - axis1Y * axis2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -43611,22 +26377,22 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi swingQZ = cZ; swingQW = w; } - var x = swingQX; - var y = swingQY; - var z = swingQZ; - var w1 = swingQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = swingQX; + let y = swingQY; + let z = swingQZ; + let w = swingQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; swingM00 = 1 - yy - zz; swingM01 = xy - wz; swingM02 = xz + wy; @@ -43640,93 +26406,90 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi swingVX = swingQX; swingVY = swingQY; swingVZ = swingQZ; - var basisY2In1; - var basisY2In1X; - var basisY2In1Y; - var basisY2In1Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let basisY2In1X; + let basisY2In1Y; + let basisY2In1Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = swingM00 * this._basisY2X + swingM10 * this._basisY2Y + swingM20 * this._basisY2Z; __tmp__Y = swingM01 * this._basisY2X + swingM11 * this._basisY2Y + swingM21 * this._basisY2Z; __tmp__Z = swingM02 * this._basisY2X + swingM12 * this._basisY2Y + swingM22 * this._basisY2Z; basisY2In1X = __tmp__X; basisY2In1Y = __tmp__Y; basisY2In1Z = __tmp__Z; - var yCoord = this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z; - var zCoord = this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z; - this._twistAngle = Math.atan2(zCoord,yCoord); + this._twistAngle = Math.atan2(this._basisZ1X * basisY2In1X + this._basisZ1Y * basisY2In1Y + this._basisZ1Z * basisY2In1Z,this._basisY1X * basisY2In1X + this._basisY1Y * basisY2In1Y + this._basisY1Z * basisY2In1Z); this.twistAxisX = this._basisX1X + this._basisX2X; this.twistAxisY = this._basisX1Y + this._basisX2Y; this.twistAxisZ = this._basisX1Z + this._basisX2Z; - var l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; + let l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; if(l > 0) { l = 1 / Math.sqrt(l); } this.twistAxisX *= l; this.twistAxisY *= l; this.twistAxisZ *= l; - var invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); + let invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); if(invLen > 0) { invLen = 1 / invLen; } swingVX *= invLen * this._swingAngle; swingVY *= invLen * this._swingAngle; swingVZ *= invLen * this._swingAngle; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; swingVX = __tmp__X1; swingVY = __tmp__Y1; swingVZ = __tmp__Z1; - var x3 = swingVY; - var y3 = swingVZ; - var a = this._maxSwingAngle1; - var b = this._maxSwingAngle2; - var invA2 = 1 / (a * a); - var invB2 = 1 / (b * b); - var w2 = x3 * x3 * invA2 + y3 * y3 * invB2; - if(w2 == 0) { + let x1 = swingVY; + let y1 = swingVZ; + let a = this._maxSwingAngle1; + let b = this._maxSwingAngle2; + let invA2 = 1 / (a * a); + let invB2 = 1 / (b * b); + let w1 = x1 * x1 * invA2 + y1 * y1 * invB2; + if(w1 == 0) { this.swingAxisX = 0; this.swingAxisY = 0; this.swingAxisZ = 0; this.swingError = 0; } else { - var t = Math.sqrt(1 / w2); - var x0 = x3 * t; - var y0 = y3 * t; - var nx = x0 * invA2; - var ny = y0 * invB2; + let t = Math.sqrt(1 / w1); + let x0 = x1 * t; + let y0 = y1 * t; + let nx = x0 * invA2; + let ny = y0 * invB2; invLen = 1 / Math.sqrt(nx * nx + ny * ny); nx *= invLen; ny *= invLen; - var depth = (x3 - x0) * nx + (y3 - y0) * ny; + let depth = (x1 - x0) * nx + (y1 - y0) * ny; if(depth > 0) { this.swingError = depth; this.swingAxisX = 0; this.swingAxisY = nx; this.swingAxisZ = ny; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; - __tmp__Y2 = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; - __tmp__Z2 = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; - this.swingAxisX = __tmp__X2; - this.swingAxisY = __tmp__Y2; - this.swingAxisZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; - __tmp__Y3 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; - __tmp__Z3 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; - this.swingAxisX = __tmp__X3; - this.swingAxisY = __tmp__Y3; - this.swingAxisZ = __tmp__Z3; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; + __tmp__Y = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; + __tmp__Z = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; + this.swingAxisX = __tmp__X; + this.swingAxisY = __tmp__Y; + this.swingAxisZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; + __tmp__Y1 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; + __tmp__Z1 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; + this.swingAxisX = __tmp__X1; + this.swingAxisY = __tmp__Y1; + this.swingAxisZ = __tmp__Z1; } else { this.swingError = 0; } @@ -43744,60 +26507,52 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi this.getInfo(info,null,true); } getAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } getAxis1To(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } getAxis2To(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } getLocalAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } getLocalAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } getLocalAxis1To(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } getLocalAxis2To(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } getTwistSpringDamper() { return this._twistSd; @@ -43809,18 +26564,16 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi return this._swingSd; } getSwingAxis() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this.swingAxisX; - v1.y = this.swingAxisY; - v1.z = this.swingAxisZ; - return v; - } - getSwingAxisTo(axis) { - var v = axis; + let v = new oimo.common.Vec3(); v.x = this.swingAxisX; v.y = this.swingAxisY; v.z = this.swingAxisZ; + return v; + } + getSwingAxisTo(axis) { + axis.x = this.swingAxisX; + axis.y = this.swingAxisY; + axis.z = this.swingAxisZ; } getSwingAngle() { return this._swingAngle; @@ -43843,80 +26596,74 @@ oimo.dynamics.constraint.joint.RagdollJointConfig = class oimo_dynamics_constrai } init(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldTwistAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localVector = this.localTwistAxis1; + let vX; + let vY; + let vZ; + vX = worldTwistAxis.x; + vY = worldTwistAxis.y; + vZ = worldTwistAxis.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localTwistAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldTwistAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + let localVector1 = this.localTwistAxis2; + let vX1; + let vY1; + let vZ1; + vX1 = worldTwistAxis.x; + vY1 = worldTwistAxis.y; + vZ1 = worldTwistAxis.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localTwistAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; - var v6; - var vX2; - var vY2; - var vZ2; - var v7 = worldSwingAxis; - vX2 = v7.x; - vY2 = v7.y; - vZ2 = v7.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; + let localVector2 = this.localSwingAxis1; + let vX2; + let vY2; + let vZ2; + vX2 = worldSwingAxis.x; + vY2 = worldSwingAxis.y; + vZ2 = worldSwingAxis.z; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = rigidBody1._transform._rotation00 * vX2 + rigidBody1._transform._rotation10 * vY2 + rigidBody1._transform._rotation20 * vZ2; __tmp__Y2 = rigidBody1._transform._rotation01 * vX2 + rigidBody1._transform._rotation11 * vY2 + rigidBody1._transform._rotation21 * vZ2; __tmp__Z2 = rigidBody1._transform._rotation02 * vX2 + rigidBody1._transform._rotation12 * vY2 + rigidBody1._transform._rotation22 * vZ2; vX2 = __tmp__X2; vY2 = __tmp__Y2; vZ2 = __tmp__Z2; - var v8 = this.localSwingAxis1; - v8.x = vX2; - v8.y = vY2; - v8.z = vZ2; + localVector2.x = vX2; + localVector2.y = vY2; + localVector2.z = vZ2; return this; } } oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_joint_RevoluteJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,1); - var v = config.localAxis1; + let v = config.localAxis1; this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; + let v1 = config.localAxis2; this._localBasisX2X = v1.x; this._localBasisX2Y = v1.y; this._localBasisX2Z = v1.z; @@ -43929,39 +26676,33 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo this._lm = config.limitMotor.clone(); } getInfo(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhs; - var linearRhsX; - var linearRhsY; - var linearRhsZ; + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -43998,10 +26739,10 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -44022,12 +26763,11 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -44040,9 +26780,9 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -44055,16 +26795,15 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = 0; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; @@ -44081,9 +26820,9 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -44096,20 +26835,19 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -44123,32 +26861,31 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo j.ang2Y = crossR221; j.ang2Z = crossR222; if(this._sd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - this.setSolverInfoRowAngular(row1,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); - j = row1.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -44156,9 +26893,43 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo j.ang2Y = this._basis.xY; j.ang2Z = this._basis.xZ; } - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; + let impulse3 = this._impulses[4]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsY; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + let impulse4 = this._impulses[5]; + let row4 = info.rows[info.numRows++]; + let _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -44171,55 +26942,19 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo _this4.ang2X = 0; _this4.ang2Y = 0; _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - row1.rhs = angRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; - j.ang1X = this._basis.yX; - j.ang1Y = this._basis.yY; - j.ang1Z = this._basis.yZ; - j.ang2X = this._basis.yX; - j.ang2Y = this._basis.yY; - j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row1 = row6; - row1.rhs = angRhsZ; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + row4.rhs = 0; + row4.cfm = 0; + row4.minImpulse = 0; + row4.maxImpulse = 0; + row4.motorSpeed = 0; + row4.motorMaxImpulse = 0; + row4.impulse = null; + row4.impulse = impulse4; + row4.rhs = angRhsZ; + row4.cfm = 0; + row4.minImpulse = -1e65536; + row4.maxImpulse = 1e65536; + j = row4.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -44229,87 +26964,78 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo } _syncAnchors() { super._syncAnchors(); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var q; - var qX; - var qY; - var qZ; - var qW; - var idQ; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQ; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newX; - var newXX; - var newXY; - var newXZ; - var newY; - var newYX; - var newYY; - var newYZ; - var newZ; - var newZX; - var newZY; - var newZZ; - var prevX; - var prevXX; - var prevXY; - var prevXZ; - var prevY; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -44317,13 +27043,13 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -44337,18 +27063,14 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo idQY = 0; idQZ = 0; idQW = 1; - var qx; - var qy; - var qz; - var qw; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -44357,19 +27079,19 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -44378,7 +27100,7 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -44387,21 +27109,21 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -44411,22 +27133,22 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -44436,9 +27158,9 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -44451,78 +27173,78 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -44532,9 +27254,9 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -44545,42 +27267,42 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -44596,36 +27318,34 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var angError; - var angErrorX; - var angErrorY; - var angErrorZ; + let angErrorX; + let angErrorY; + let angErrorZ; angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + let cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + let theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + let l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCross; - var perpCrossX; - var perpCrossY; - var perpCrossZ; + let perpCrossX; + let perpCrossY; + let perpCrossZ; perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } @@ -44642,60 +27362,52 @@ oimo.dynamics.constraint.joint.RevoluteJoint = class oimo_dynamics_constraint_jo this.getInfo(info,null,true); } getAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX2X; - v1.y = this._basisX2Y; - v1.z = this._basisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX2X; + v.y = this._basisX2Y; + v.z = this._basisX2Z; return v; } getAxis1To(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } getAxis2To(axis) { - var v = axis; - v.x = this._basisX2X; - v.y = this._basisX2Y; - v.z = this._basisX2Z; + axis.x = this._basisX2X; + axis.y = this._basisX2Y; + axis.z = this._basisX2Z; } getLocalAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } getLocalAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX2X; - v1.y = this._localBasisX2Y; - v1.z = this._localBasisX2Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX2X; + v.y = this._localBasisX2Y; + v.z = this._localBasisX2Z; return v; } getLocalAxis1To(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } getLocalAxis2To(axis) { - var v = axis; - v.x = this._localBasisX2X; - v.y = this._localBasisX2Y; - v.z = this._localBasisX2Z; + axis.x = this._localBasisX2X; + axis.y = this._localBasisX2Y; + axis.z = this._localBasisX2Z; } getSpringDamper() { return this._sd; @@ -44717,48 +27429,44 @@ oimo.dynamics.constraint.joint.RevoluteJointConfig = class oimo_dynamics_constra } init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldAxis; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAxis; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; + vX1 = worldAxis.x; + vY1 = worldAxis.y; + vZ1 = worldAxis.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } } @@ -44779,7 +27487,7 @@ oimo.dynamics.constraint.joint.RotationalLimitMotor = class oimo_dynamics_constr return this; } clone() { - var lm = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); + let lm = new oimo.dynamics.constraint.joint.RotationalLimitMotor(); lm.lowerLimit = this.lowerLimit; lm.upperLimit = this.upperLimit; lm.motorSpeed = this.motorSpeed; @@ -44796,24 +27504,23 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j if(this._sd.frequency > 0 && isPositionPart) { return; } - var error; - var errorX; - var errorY; - var errorZ; + let errorX; + let errorY; + let errorZ; errorX = this._anchor2X - this._anchor1X; errorY = this._anchor2Y - this._anchor1Y; errorZ = this._anchor2Z - this._anchor1Z; - var cfm; - var erp; + let cfm; + let erp; if(this._sd.frequency > 0) { - var omega = 6.28318530717958 * this._sd.frequency; - var zeta = this._sd.dampingRatio; + let omega = 6.28318530717958 * this._sd.frequency; + let zeta = this._sd.dampingRatio; if(zeta < oimo.common.Setting.minSpringDamperDampingRatio) { zeta = oimo.common.Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(this._sd.useSymplecticEuler) { cfm = 1 / (h * c); erp = k / c; @@ -44826,36 +27533,30 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j cfm = 0; erp = this.getErp(timeStep,isPositionPart); } - var linearRhs; - var linearRhsX; - var linearRhsY; - var linearRhsZ; + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = errorX * erp; linearRhsY = errorY * erp; linearRhsZ = errorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -44892,9 +27593,9 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -44915,12 +27616,11 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = cfm; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = cfm; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -44933,9 +27633,9 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -44948,16 +27648,15 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = cfm; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; @@ -44974,9 +27673,9 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -44989,20 +27688,19 @@ oimo.dynamics.constraint.joint.SphericalJoint = class oimo_dynamics_constraint_j _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = cfm; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = cfm; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -45054,7 +27752,7 @@ oimo.dynamics.constraint.joint.SpringDamper = class oimo_dynamics_constraint_joi return this; } clone() { - var sd = new oimo.dynamics.constraint.joint.SpringDamper(); + let sd = new oimo.dynamics.constraint.joint.SpringDamper(); sd.frequency = this.frequency; sd.dampingRatio = this.dampingRatio; sd.useSymplecticEuler = this.useSymplecticEuler; @@ -45078,7 +27776,7 @@ oimo.dynamics.constraint.joint.TranslationalLimitMotor = class oimo_dynamics_con return this; } clone() { - var lm = new oimo.dynamics.constraint.joint.TranslationalLimitMotor(); + let lm = new oimo.dynamics.constraint.joint.TranslationalLimitMotor(); lm.lowerLimit = this.lowerLimit; lm.upperLimit = this.upperLimit; lm.motorSpeed = this.motorSpeed; @@ -45089,11 +27787,11 @@ oimo.dynamics.constraint.joint.TranslationalLimitMotor = class oimo_dynamics_con oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_joint_UniversalJoint extends oimo.dynamics.constraint.joint.Joint { constructor(config) { super(config,oimo.dynamics.constraint.joint.JointType.UNIVERSAL); - var v = config.localAxis1; + let v = config.localAxis1; this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; + let v1 = config.localAxis2; this._localBasisZ2X = v1.x; this._localBasisZ2Y = v1.y; this._localBasisZ2Z = v1.z; @@ -45110,38 +27808,32 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j this._lm2 = config.limitMotor2.clone(); } getInfo(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhs; - var linearRhsX; - var linearRhsY; - var linearRhsZ; + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var linRhsX = linearRhsX; - var linRhsY = linearRhsY; - var linRhsZ = linearRhsZ; - var angRhsY = this._angleY * erp; - var crossR1; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR2; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let angRhsY = this._angleY * erp; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -45178,11 +27870,11 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); - var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + let motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -45203,12 +27895,11 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - var row1 = row; - row1.rhs = linRhsX; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - var j = row1.jacobian; + row.rhs = linearRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -45221,9 +27912,9 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row2 = info.rows[info.numRows++]; - var _this1 = row2.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -45236,16 +27927,15 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j _this1.ang2X = 0; _this1.ang2Y = 0; _this1.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse1; - row1 = row2; - row1.rhs = linRhsY; + row1.rhs = 0; + row1.cfm = 0; + row1.minImpulse = 0; + row1.maxImpulse = 0; + row1.motorSpeed = 0; + row1.motorMaxImpulse = 0; + row1.impulse = null; + row1.impulse = impulse1; + row1.rhs = linearRhsY; row1.cfm = 0; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; @@ -45262,9 +27952,9 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row3 = info.rows[info.numRows++]; - var _this2 = row3.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -45277,20 +27967,19 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j _this2.ang2X = 0; _this2.ang2Y = 0; _this2.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse2; - row1 = row3; - row1.rhs = linRhsZ; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + row2.rhs = 0; + row2.cfm = 0; + row2.minImpulse = 0; + row2.maxImpulse = 0; + row2.motorSpeed = 0; + row2.motorMaxImpulse = 0; + row2.impulse = null; + row2.impulse = impulse2; + row2.rhs = linearRhsZ; + row2.cfm = 0; + row2.minImpulse = -1e65536; + row2.maxImpulse = 1e65536; + j = row2.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -45304,32 +27993,31 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j j.ang2Y = crossR221; j.ang2Z = crossR222; if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row4 = info.rows[info.numRows++]; - var _this3 = row4.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse3; - row1 = row4; - this.setSolverInfoRowAngular(row1,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); - j = row1.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -45338,35 +28026,34 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j j.ang2Z = this._axisXZ; } if(!this.ySingular) { - var impulse4 = this._impulses[4]; - var row5 = info.rows[info.numRows++]; - var _this4 = row5.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse4; - row1 = row5; - row1.rhs = angRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -45375,129 +28062,50 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row6 = info.rows[info.numRows++]; - var _this5 = row6.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row6.rhs = 0; - row6.cfm = 0; - row6.minImpulse = 0; - row6.maxImpulse = 0; - row6.motorSpeed = 0; - row6.motorMaxImpulse = 0; - row6.impulse = null; - row6.impulse = impulse5; - row1 = row6; - this.setSolverInfoRowAngular(row1,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); - j = row1.jacobian; - j.ang1X = this._axisZX; - j.ang1Y = this._axisZY; - j.ang1Z = this._axisZZ; - j.ang2X = this._axisZX; - j.ang2Y = this._axisZY; - j.ang2Z = this._axisZZ; - } - } - _syncAnchors() { - super._syncAnchors(); - var rot1; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot2; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; - rot100 = this._basisX1X; - rot101 = this._basisY1X; - rot102 = this._basisZ1X; - rot110 = this._basisX1Y; - rot111 = this._basisY1Y; - rot112 = this._basisZ1Y; - rot120 = this._basisX1Z; - rot121 = this._basisY1Z; - rot122 = this._basisZ1Z; - rot200 = this._basisX2X; - rot201 = this._basisY2X; - rot202 = this._basisZ2X; - rot210 = this._basisX2Y; - rot211 = this._basisY2Y; - rot212 = this._basisZ2Y; - rot220 = this._basisX2Z; - rot221 = this._basisY2Z; - rot222 = this._basisZ2Z; - var relRot; - var relRot00; - var relRot01; - var relRot02; - var relRot10; - var relRot11; - var relRot12; - var relRot20; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; - __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; - __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; - __tmp__10 = rot101 * rot200 + rot111 * rot210 + rot121 * rot220; - __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; - __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; - __tmp__20 = rot102 * rot200 + rot112 * rot210 + rot122 * rot220; - __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; - __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; - relRot00 = __tmp__00; - relRot01 = __tmp__01; - relRot02 = __tmp__02; - relRot10 = __tmp__10; - relRot11 = __tmp__11; - relRot12 = __tmp__12; - relRot20 = __tmp__20; - relRot21 = __tmp__21; - relRot22 = __tmp__22; - var angleAxisX; - var angleAxisXX; - var angleAxisXY; - var angleAxisXZ; - var angleAxisY; - var angleAxisYX; - var angleAxisYY; - var angleAxisYZ; - var angleAxisZ; - var angleAxisZX; - var angleAxisZY; - var angleAxisZZ; + let impulse = this._impulses[5]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._axisZX; + j.ang1Y = this._axisZY; + j.ang1Z = this._axisZZ; + j.ang2X = this._axisZX; + j.ang2Y = this._axisZY; + j.ang2Z = this._axisZZ; + } + } + _syncAnchors() { + super._syncAnchors(); + let angleAxisXX; + let angleAxisXY; + let angleAxisXZ; + let angleAxisYX; + let angleAxisYY; + let angleAxisYZ; + let angleAxisZX; + let angleAxisZY; + let angleAxisZZ; angleAxisXX = this._basisX1X; angleAxisXY = this._basisX1Y; angleAxisXZ = this._basisX1Z; @@ -45516,21 +28124,21 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; - var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + let l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; if(l > 0) { l = 1 / Math.sqrt(l); } this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + let l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } this._axisYX *= l1; this._axisYY *= l1; this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + let l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; if(l2 > 0) { l2 = 1 / Math.sqrt(l2); } @@ -45540,103 +28148,88 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; - var rot11; - var rot1001; - var rot1011; - var rot1021; - var rot1101; - var rot1111; - var rot1121; - var rot1201; - var rot1211; - var rot1221; - var rot21; - var rot2001; - var rot2011; - var rot2021; - var rot2101; - var rot2111; - var rot2121; - var rot2201; - var rot2211; - var rot2221; - rot1001 = this._basisX1X; - rot1011 = this._basisY1X; - rot1021 = this._basisZ1X; - rot1101 = this._basisX1Y; - rot1111 = this._basisY1Y; - rot1121 = this._basisZ1Y; - rot1201 = this._basisX1Z; - rot1211 = this._basisY1Z; - rot1221 = this._basisZ1Z; - rot2001 = this._basisX2X; - rot2011 = this._basisY2X; - rot2021 = this._basisZ2X; - rot2101 = this._basisX2Y; - rot2111 = this._basisY2Y; - rot2121 = this._basisZ2Y; - rot2201 = this._basisX2Z; - rot2211 = this._basisY2Z; - rot2221 = this._basisZ2Z; - var relRot1; - var relRot001; - var relRot011; - var relRot021; - var relRot101; - var relRot111; - var relRot121; - var relRot201; - var relRot211; - var relRot221; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = rot1001 * rot2001 + rot1101 * rot2101 + rot1201 * rot2201; - __tmp__011 = rot1001 * rot2011 + rot1101 * rot2111 + rot1201 * rot2211; - __tmp__021 = rot1001 * rot2021 + rot1101 * rot2121 + rot1201 * rot2221; - __tmp__101 = rot1011 * rot2001 + rot1111 * rot2101 + rot1211 * rot2201; - __tmp__111 = rot1011 * rot2011 + rot1111 * rot2111 + rot1211 * rot2211; - __tmp__121 = rot1011 * rot2021 + rot1111 * rot2121 + rot1211 * rot2221; - __tmp__201 = rot1021 * rot2001 + rot1121 * rot2101 + rot1221 * rot2201; - __tmp__211 = rot1021 * rot2011 + rot1121 * rot2111 + rot1221 * rot2211; - __tmp__221 = rot1021 * rot2021 + rot1121 * rot2121 + rot1221 * rot2221; - relRot001 = __tmp__001; - relRot011 = __tmp__011; - relRot021 = __tmp__021; - relRot101 = __tmp__101; - relRot111 = __tmp__111; - relRot121 = __tmp__121; - relRot201 = __tmp__201; - relRot211 = __tmp__211; - relRot221 = __tmp__221; - var angles; - var anglesX; - var anglesY; - var anglesZ; - var sy = relRot021; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; + rot100 = this._basisX1X; + rot101 = this._basisY1X; + rot102 = this._basisZ1X; + rot110 = this._basisX1Y; + rot111 = this._basisY1Y; + rot112 = this._basisZ1Y; + rot120 = this._basisX1Z; + rot121 = this._basisY1Z; + rot122 = this._basisZ1Z; + rot200 = this._basisX2X; + rot201 = this._basisY2X; + rot202 = this._basisZ2X; + rot210 = this._basisX2Y; + rot211 = this._basisY2Y; + rot212 = this._basisZ2Y; + rot220 = this._basisX2Z; + rot221 = this._basisY2Z; + rot222 = this._basisZ2Z; + let relRot00; + let relRot01; + let relRot02; + let relRot11; + let relRot12; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__11; + let __tmp__12; + let __tmp__21; + let __tmp__22; + __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; + __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; + __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; + __tmp__11 = rot101 * rot201 + rot111 * rot211 + rot121 * rot221; + __tmp__12 = rot101 * rot202 + rot111 * rot212 + rot121 * rot222; + __tmp__21 = rot102 * rot201 + rot112 * rot211 + rot122 * rot221; + __tmp__22 = rot102 * rot202 + rot112 * rot212 + rot122 * rot222; + relRot00 = __tmp__00; + relRot01 = __tmp__01; + relRot02 = __tmp__02; + relRot11 = __tmp__11; + relRot12 = __tmp__12; + relRot21 = __tmp__21; + relRot22 = __tmp__22; + let anglesX; + let anglesY; + let anglesZ; + let sy = relRot02; if(sy <= -1) { - var xSubZ = Math.atan2(relRot211,relRot111); + let xSubZ = Math.atan2(relRot21,relRot11); anglesX = xSubZ * 0.5; anglesY = -1.570796326794895; anglesZ = -xSubZ * 0.5; } else if(sy >= 1) { - var xAddZ = Math.atan2(relRot211,relRot111); + let xAddZ = Math.atan2(relRot21,relRot11); anglesX = xAddZ * 0.5; anglesY = 1.570796326794895; anglesZ = xAddZ * 0.5; } else { - var y = Math.asin(sy); - var x = Math.atan2(-relRot121,relRot221); - var z = Math.atan2(-relRot011,relRot001); - anglesX = x; - anglesY = y; - anglesZ = z; + anglesX = Math.atan2(-relRot12,relRot22); + anglesY = Math.asin(sy); + anglesZ = Math.atan2(-relRot01,relRot00); } this._angleX = anglesX; this._angleY = anglesY; @@ -45654,60 +28247,52 @@ oimo.dynamics.constraint.joint.UniversalJoint = class oimo_dynamics_constraint_j this.getInfo(info,null,true); } getAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisX1X; - v1.y = this._basisX1Y; - v1.z = this._basisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._basisX1X; + v.y = this._basisX1Y; + v.z = this._basisX1Z; return v; } getAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._basisZ2X; - v1.y = this._basisZ2Y; - v1.z = this._basisZ2Z; + let v = new oimo.common.Vec3(); + v.x = this._basisZ2X; + v.y = this._basisZ2Y; + v.z = this._basisZ2Z; return v; } getAxis1To(axis) { - var v = axis; - v.x = this._basisX1X; - v.y = this._basisX1Y; - v.z = this._basisX1Z; + axis.x = this._basisX1X; + axis.y = this._basisX1Y; + axis.z = this._basisX1Z; } getAxis2To(axis) { - var v = axis; - v.x = this._basisZ2X; - v.y = this._basisZ2Y; - v.z = this._basisZ2Z; + axis.x = this._basisZ2X; + axis.y = this._basisZ2Y; + axis.z = this._basisZ2Z; } getLocalAxis1() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisX1X; - v1.y = this._localBasisX1Y; - v1.z = this._localBasisX1Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisX1X; + v.y = this._localBasisX1Y; + v.z = this._localBasisX1Z; return v; } getLocalAxis2() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._localBasisZ2X; - v1.y = this._localBasisZ2Y; - v1.z = this._localBasisZ2Z; + let v = new oimo.common.Vec3(); + v.x = this._localBasisZ2X; + v.y = this._localBasisZ2Y; + v.z = this._localBasisZ2Z; return v; } getLocalAxis1To(axis) { - var v = axis; - v.x = this._localBasisX1X; - v.y = this._localBasisX1Y; - v.z = this._localBasisX1Z; + axis.x = this._localBasisX1X; + axis.y = this._localBasisX1Y; + axis.z = this._localBasisX1Z; } getLocalAxis2To(axis) { - var v = axis; - v.x = this._localBasisZ2X; - v.y = this._localBasisZ2Y; - v.z = this._localBasisZ2Z; + axis.x = this._localBasisZ2X; + axis.y = this._localBasisZ2Y; + axis.z = this._localBasisZ2Z; } getSpringDamper1() { return this._sd1; @@ -45740,48 +28325,44 @@ oimo.dynamics.constraint.joint.UniversalJointConfig = class oimo_dynamics_constr } init(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var v; - var vX; - var vY; - var vZ; - var v1 = worldAxis1; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; + vX = worldAxis1.x; + vY = worldAxis1.y; + vZ = worldAxis1.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = this.localAxis1; - v2.x = vX; - v2.y = vY; - v2.z = vZ; - var v3; - var vX1; - var vY1; - var vZ1; - var v4 = worldAxis2; - vX1 = v4.x; - vY1 = v4.y; - vZ1 = v4.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; + vX1 = worldAxis2.x; + vY1 = worldAxis2.y; + vZ1 = worldAxis2.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; vX1 = __tmp__X1; vY1 = __tmp__Y1; vZ1 = __tmp__Z1; - var v5 = this.localAxis2; - v5.x = vX1; - v5.y = vY1; - v5.z = vZ1; + localVector1.x = vX1; + localVector1.y = vY1; + localVector1.z = vZ1; return this; } } @@ -45855,83 +28436,67 @@ oimo.dynamics.constraint.solver.common.JointSolverMassDataRow = class oimo_dynam if(!oimo.dynamics.constraint.solver.direct) oimo.dynamics.constraint.solver.direct = {}; oimo.dynamics.constraint.solver.direct.Boundary = class oimo_dynamics_constraint_solver_direct_Boundary { constructor(maxRows) { - var this1 = new Array(maxRows); - this.iBounded = this1; - var this2 = new Array(maxRows); - this.iUnbounded = this2; - var this3 = new Array(maxRows); - this.signs = this3; - var this4 = new Array(maxRows); - this.b = this4; + this.iBounded = new Array(maxRows); + this.iUnbounded = new Array(maxRows); + this.signs = new Array(maxRows); + this.b = new Array(maxRows); this.numBounded = 0; this.numUnbounded = 0; this.matrixId = 0; } init(buildInfo) { this.numBounded = buildInfo.numBounded; - var _g = 0; - var _g1 = this.numBounded; + let _g = 0; + let _g1 = this.numBounded; while(_g < _g1) { - var i = _g++; + let i = _g++; this.iBounded[i] = buildInfo.iBounded[i]; this.signs[i] = buildInfo.signs[i]; } this.numUnbounded = buildInfo.numUnbounded; this.matrixId = 0; - var _g2 = 0; - var _g3 = this.numUnbounded; + let _g2 = 0; + let _g3 = this.numUnbounded; while(_g2 < _g3) { - var i1 = _g2++; - var idx = buildInfo.iUnbounded[i1]; - this.iUnbounded[i1] = idx; + let i = _g2++; + let idx = buildInfo.iUnbounded[i]; + this.iUnbounded[i] = idx; this.matrixId |= 1 << idx; } } computeImpulses(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { - var _g = 0; - var _g1 = this.numUnbounded; + let _g = 0; + let _g1 = this.numUnbounded; while(_g < _g1) { - var i = _g++; - var idx = this.iUnbounded[i]; - var row = info.rows[idx]; - var relVel = relVels[idx]; - this.b[idx] = row.rhs * impulseFactor - relVel - row.cfm * impulses[idx]; - } - var invMassWithoutCfm = mass._invMassWithoutCfm; - var _g2 = 0; - var _g3 = this.numBounded; + let idx = this.iUnbounded[_g++]; + let row = info.rows[idx]; + this.b[idx] = row.rhs * impulseFactor - relVels[idx] - row.cfm * impulses[idx]; + } + let invMassWithoutCfm = mass._invMassWithoutCfm; + let _g2 = 0; + let _g3 = this.numBounded; while(_g2 < _g3) { - var i1 = _g2++; - var idx1 = this.iBounded[i1]; - var sign = this.signs[i1]; - var row1 = info.rows[idx1]; - var oldImpulse = impulses[idx1]; - var impulse = sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0; - var dImpulse = impulse - oldImpulse; - dImpulses[idx1] = dImpulse; + let i = _g2++; + let idx = this.iBounded[i]; + let sign = this.signs[i]; + let row = info.rows[idx]; + let dImpulse = (sign < 0 ? row.minImpulse : sign > 0 ? row.maxImpulse : 0) - impulses[idx]; + dImpulses[idx] = dImpulse; if(dImpulse != 0) { - var _g21 = 0; - var _g31 = this.numUnbounded; - while(_g21 < _g31) { - var j = _g21++; - var idx2 = this.iUnbounded[j]; - var dRelVel = invMassWithoutCfm[idx1][idx2] * dImpulse; - var _g22 = idx2; - var _g32 = this.b; - _g32[_g22] = _g32[_g22] - dRelVel; - } - } - } - var indices = this.iUnbounded; - var n = this.numUnbounded; - var id = 0; - var _g4 = 0; - var _g11 = n; - while(_g4 < _g11) { - var i2 = _g4++; - id |= 1 << indices[i2]; - } - var massMatrix; + let _g = 0; + let _g1 = this.numUnbounded; + while(_g < _g1) { + let idx2 = this.iUnbounded[_g++]; + this.b[idx2] -= invMassWithoutCfm[idx][idx2] * dImpulse; + } + } + } + let indices = this.iUnbounded; + let n = this.numUnbounded; + let id = 0; + let _g4 = 0; + while(_g4 < n) id |= 1 << indices[_g4++]; + let massMatrix; if(mass._cacheComputed[id]) { massMatrix = mass._cachedSubmatrices[id]; } else { @@ -45939,27 +28504,26 @@ oimo.dynamics.constraint.solver.direct.Boundary = class oimo_dynamics_constraint mass._cacheComputed[id] = true; massMatrix = mass._cachedSubmatrices[id]; } - var ok = true; - var _g41 = 0; - var _g5 = this.numUnbounded; - while(_g41 < _g5) { - var i3 = _g41++; - var idx3 = this.iUnbounded[i3]; - var row2 = info.rows[idx3]; - var oldImpulse1 = impulses[idx3]; - var impulse1 = oldImpulse1; - var _g42 = 0; - var _g51 = this.numUnbounded; - while(_g42 < _g51) { - var j1 = _g42++; - var idx21 = this.iUnbounded[j1]; - impulse1 += this.b[idx21] * massMatrix[i3][j1]; - } - if(impulse1 < row2.minImpulse - oimo.common.Setting.directMlcpSolverEps || impulse1 > row2.maxImpulse + oimo.common.Setting.directMlcpSolverEps) { + let ok = true; + let _g5 = 0; + let _g6 = this.numUnbounded; + while(_g5 < _g6) { + let i = _g5++; + let idx = this.iUnbounded[i]; + let row = info.rows[idx]; + let oldImpulse = impulses[idx]; + let impulse = oldImpulse; + let _g = 0; + let _g1 = this.numUnbounded; + while(_g < _g1) { + let j = _g++; + impulse += this.b[this.iUnbounded[j]] * massMatrix[i][j]; + } + if(impulse < row.minImpulse - oimo.common.Setting.directMlcpSolverEps || impulse > row.maxImpulse + oimo.common.Setting.directMlcpSolverEps) { ok = false; break; } - dImpulses[idx3] = impulse1 - oldImpulse1; + dImpulses[idx] = impulse - oldImpulse; } if(noCheck) { return true; @@ -45967,24 +28531,24 @@ oimo.dynamics.constraint.solver.direct.Boundary = class oimo_dynamics_constraint if(!ok) { return false; } - var _g6 = 0; - var _g7 = this.numBounded; - while(_g6 < _g7) { - var i4 = _g6++; - var idx4 = this.iBounded[i4]; - var row3 = info.rows[idx4]; - var sign1 = this.signs[i4]; - var error = 0; - var newImpulse = impulses[idx4] + dImpulses[idx4]; - var relVel1 = relVels[idx4]; - var _g61 = 0; - var _g71 = info.numRows; - while(_g61 < _g71) { - var j2 = _g61++; - relVel1 += invMassWithoutCfm[idx4][j2] * dImpulses[j2]; - } - error = row3.rhs * impulseFactor - relVel1 - row3.cfm * newImpulse; - if(sign1 < 0 && error > oimo.common.Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo.common.Setting.directMlcpSolverEps) { + let _g7 = 0; + let _g8 = this.numBounded; + while(_g7 < _g8) { + let i = _g7++; + let idx = this.iBounded[i]; + let row = info.rows[idx]; + let sign = this.signs[i]; + let error = 0; + let newImpulse = impulses[idx] + dImpulses[idx]; + let relVel = relVels[idx]; + let _g = 0; + let _g1 = info.numRows; + while(_g < _g1) { + let j = _g++; + relVel += invMassWithoutCfm[idx][j] * dImpulses[j]; + } + error = row.rhs * impulseFactor - relVel - row.cfm * newImpulse; + if(sign < 0 && error > oimo.common.Setting.directMlcpSolverEps || sign > 0 && error < -oimo.common.Setting.directMlcpSolverEps) { ok = false; break; } @@ -45996,21 +28560,17 @@ oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo = class oimo_dynamics_c constructor(size) { this.size = size; this.numBounded = 0; - var this1 = new Array(size); - this.iBounded = this1; - var this2 = new Array(size); - this.signs = this2; + this.iBounded = new Array(size); + this.signs = new Array(size); this.numUnbounded = 0; - var this3 = new Array(size); - this.iUnbounded = this3; + this.iUnbounded = new Array(size); } } oimo.dynamics.constraint.solver.direct.BoundaryBuilder = class oimo_dynamics_constraint_solver_direct_BoundaryBuilder { constructor(maxRows) { this.maxRows = maxRows; this.numBoundaries = 0; - var this1 = new Array(1 << maxRows); - this.boundaries = this1; + this.boundaries = new Array(1 << maxRows); this.bbInfo = new oimo.dynamics.constraint.solver.direct.BoundaryBuildInfo(maxRows); } buildBoundariesRecursive(info,i) { @@ -46021,12 +28581,11 @@ oimo.dynamics.constraint.solver.direct.BoundaryBuilder = class oimo_dynamics_con this.boundaries[this.numBoundaries++].init(this.bbInfo); return; } - var row = info.rows[i]; - var lowerLimitEnabled = row.minImpulse > -1e65536; - var upperLimitEnabled = row.maxImpulse < 1e65536; - var disabled = row.minImpulse == 0 && row.maxImpulse == 0; - if(disabled) { - var _this = this.bbInfo; + let row = info.rows[i]; + let lowerLimitEnabled = row.minImpulse > -1e65536; + let upperLimitEnabled = row.maxImpulse < 1e65536; + if(row.minImpulse == 0 && row.maxImpulse == 0) { + let _this = this.bbInfo; _this.iBounded[_this.numBounded] = i; _this.signs[_this.numBounded] = 0; _this.numBounded++; @@ -46034,31 +28593,31 @@ oimo.dynamics.constraint.solver.direct.BoundaryBuilder = class oimo_dynamics_con this.bbInfo.numBounded--; return; } - var _this1 = this.bbInfo; - _this1.iUnbounded[_this1.numUnbounded] = i; - _this1.numUnbounded++; + let _this = this.bbInfo; + _this.iUnbounded[_this.numUnbounded] = i; + _this.numUnbounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numUnbounded--; if(lowerLimitEnabled) { - var _this2 = this.bbInfo; - _this2.iBounded[_this2.numBounded] = i; - _this2.signs[_this2.numBounded] = -1; - _this2.numBounded++; + let _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = -1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } if(upperLimitEnabled) { - var _this3 = this.bbInfo; - _this3.iBounded[_this3.numBounded] = i; - _this3.signs[_this3.numBounded] = 1; - _this3.numBounded++; + let _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = 1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } } buildBoundaries(info) { this.numBoundaries = 0; - var _this = this.bbInfo; + let _this = this.bbInfo; _this.numBounded = 0; _this.numUnbounded = 0; this.buildBoundariesRecursive(info,0); @@ -46067,14 +28626,11 @@ oimo.dynamics.constraint.solver.direct.BoundaryBuilder = class oimo_dynamics_con oimo.dynamics.constraint.solver.direct.BoundarySelector = class oimo_dynamics_constraint_solver_direct_BoundarySelector { constructor(n) { this.n = n; - var this1 = new Array(n); - this.indices = this1; - var this2 = new Array(n); - this.tmpIndices = this2; - var _g = 0; - var _g1 = n; - while(_g < _g1) { - var i = _g++; + this.indices = new Array(n); + this.tmpIndices = new Array(n); + let _g = 0; + while(_g < n) { + let i = _g++; this.indices[i] = i; } } @@ -46082,23 +28638,22 @@ oimo.dynamics.constraint.solver.direct.BoundarySelector = class oimo_dynamics_co return this.indices[i]; } select(index) { - var i = 0; + let i = 0; while(this.indices[i] != index) ++i; while(i > 0) { - var tmp = this.indices[i]; + let tmp = this.indices[i]; this.indices[i] = this.indices[i - 1]; this.indices[i - 1] = tmp; --i; } } setSize(size) { - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = this.n; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = this.n; while(_g < _g1) { - var i = _g++; - var idx = this.indices[i]; + let idx = this.indices[_g++]; if(idx < size) { this.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -46107,7 +28662,7 @@ oimo.dynamics.constraint.solver.direct.BoundarySelector = class oimo_dynamics_co ++numGreater; } } - var tmp = this.indices; + let tmp = this.indices; this.indices = this.tmpIndices; this.tmpIndices = tmp; } @@ -46117,36 +28672,27 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ super(); this.joint = joint; this.info = new oimo.dynamics.constraint.info.joint.JointSolverInfo(); - var maxRows = oimo.common.Setting.maxJacobianRows; + let maxRows = oimo.common.Setting.maxJacobianRows; this.massMatrix = new oimo.dynamics.constraint.solver.direct.MassMatrix(maxRows); this.boundaryBuilder = new oimo.dynamics.constraint.solver.direct.BoundaryBuilder(maxRows); - var this1 = new Array(maxRows); - this.massData = this1; - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) { - var i = _g++; - this.massData[i] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); - } - var numMaxBoundaries = this.boundaryBuilder.boundaries.length; + this.massData = new Array(maxRows); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); + let numMaxBoundaries = this.boundaryBuilder.boundaries.length; this.velBoundarySelector = new oimo.dynamics.constraint.solver.direct.BoundarySelector(numMaxBoundaries); this.posBoundarySelector = new oimo.dynamics.constraint.solver.direct.BoundarySelector(numMaxBoundaries); - var this2 = new Array(maxRows); - this.relVels = this2; - var this3 = new Array(maxRows); - this.impulses = this3; - var this4 = new Array(maxRows); - this.dImpulses = this4; - var this5 = new Array(maxRows); - this.dTotalImpulses = this5; - var _g2 = 0; - var _g3 = maxRows; - while(_g2 < _g3) { - var i1 = _g2++; - this.relVels[i1] = 0; - this.impulses[i1] = 0; - this.dImpulses[i1] = 0; - this.dTotalImpulses[i1] = 0; + this.relVels = new Array(maxRows); + this.impulses = new Array(maxRows); + this.dImpulses = new Array(maxRows); + this.dTotalImpulses = new Array(maxRows); + let _g2 = 0; + while(_g2 < maxRows) { + let i = _g2++; + this.relVels[i] = 0; + this.impulses[i] = 0; + this.dImpulses[i] = 0; + this.dTotalImpulses[i] = 0; } } preSolveVelocity(timeStep) { @@ -46155,21 +28701,20 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.velBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.velBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var i = _g++; - var idx = _this2.indices[i]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -46178,42 +28723,40 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; } warmStart(timeStep) { - var factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; + let factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var _this = row.impulse; + let _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var imp = row1.impulse; - var impulse = imp.impulse * factor; - if(impulse < row1.minImpulse) { - impulse = row1.minImpulse; - } else if(impulse > row1.maxImpulse) { - impulse = row1.maxImpulse; + let _g = 0; + let _g1 = this.info.numRows; + while(_g < _g1) { + let i = _g++; + let row = this.info.rows[i]; + let imp = row.impulse; + let impulse = imp.impulse * factor; + if(impulse < row.minImpulse) { + impulse = row.minImpulse; + } else if(impulse > row.maxImpulse) { + impulse = row.maxImpulse; } imp.impulse = impulse; - if(row1.motorMaxImpulse > 0) { - var impulseM = imp.impulseM * factor; - var max = row1.motorMaxImpulse; + if(row.motorMaxImpulse > 0) { + let impulseM = imp.impulseM * factor; + let max = row.motorMaxImpulse; if(impulseM < -max) { impulseM = -max; } else if(impulseM > max) { @@ -46223,27 +28766,23 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ } else { imp.impulseM = 0; } - this.dImpulses[i1] = imp.impulse + imp.impulseM; - } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + this.dImpulses[i] = imp.impulse + imp.impulseM; + } + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -46256,30 +28795,29 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g3 = 0; - var _g12 = this.info.numRows; - while(_g3 < _g12) { - var i2 = _g3++; - var row2 = this.info.rows[i2]; - var j = row2.jacobian; - var md = this.massData[i2]; - var imp1 = impulses[i2]; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; if((j.flag & 1) != 0) { - lv1X += md.invMLin1X * imp1; - lv1Y += md.invMLin1Y * imp1; - lv1Z += md.invMLin1Z * imp1; - lv2X += md.invMLin2X * -imp1; - lv2Y += md.invMLin2Y * -imp1; - lv2Z += md.invMLin2Z * -imp1; + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } if((j.flag & 2) != 0) { - av1X += md.invMAng1X * imp1; - av1Y += md.invMAng1Y * imp1; - av1Z += md.invMAng1Z * imp1; - av2X += md.invMAng2X * -imp1; - av2Y += md.invMAng2Y * -imp1; - av2Z += md.invMAng2Z * -imp1; + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } @@ -46301,23 +28839,19 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ } } solveVelocity() { - var numRows = this.info.numRows; - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let numRows = this.info.numRows; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -46330,154 +28864,135 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = numRows; - while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var j = row.jacobian; - var relVel = 0; + let _g = 0; + while(_g < numRows) { + let i = _g++; + let row = this.info.rows[i]; + let j = row.jacobian; + let relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; this.relVels[i] = relVel; - this.impulses[i] = imp.impulse; + this.impulses[i] = row.impulse.impulse; this.dTotalImpulses[i] = 0; } - var invMass = this.massMatrix._invMassWithoutCfm; - var _g2 = 0; - var _g3 = numRows; - while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var imp1 = row1.impulse; - var md = this.massData[i1]; - if(row1.motorMaxImpulse > 0) { - var oldImpulseM = imp1.impulseM; - var impulseM = oldImpulseM + md.massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); - var maxImpulseM = row1.motorMaxImpulse; + let invMass = this.massMatrix._invMassWithoutCfm; + let _g1 = 0; + while(_g1 < numRows) { + let i = _g1++; + let row = this.info.rows[i]; + let imp = row.impulse; + if(row.motorMaxImpulse > 0) { + let oldImpulseM = imp.impulseM; + let impulseM = oldImpulseM + this.massData[i].massWithoutCfm * (-row.motorSpeed - this.relVels[i]); + let maxImpulseM = row.motorMaxImpulse; if(impulseM < -maxImpulseM) { impulseM = -maxImpulseM; } else if(impulseM > maxImpulseM) { impulseM = maxImpulseM; } - imp1.impulseM = impulseM; - var dImpulseM = impulseM - oldImpulseM; - this.dTotalImpulses[i1] = dImpulseM; - var _g21 = 0; - var _g31 = numRows; - while(_g21 < _g31) { - var j1 = _g21++; - var _g22 = j1; - var _g32 = this.relVels; - _g32[_g22] = _g32[_g22] + dImpulseM * invMass[i1][j1]; + imp.impulseM = impulseM; + let dImpulseM = impulseM - oldImpulseM; + this.dTotalImpulses[i] = dImpulseM; + let _g = 0; + while(_g < numRows) { + let j = _g++; + this.relVels[j] += dImpulseM * invMass[i][j]; } } } - var solved = false; - var _g4 = 0; - var _g5 = this.boundaryBuilder.numBoundaries; - while(_g4 < _g5) { - var i2 = _g4++; - var idx = this.velBoundarySelector.indices[i2]; - var b = this.boundaryBuilder.boundaries[idx]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { - var _g41 = 0; - var _g51 = numRows; - while(_g41 < _g51) { - var j2 = _g41++; - var row2 = this.info.rows[j2]; - var imp2 = row2.impulse; - var dimp = this.dImpulses[j2]; - imp2.impulse += dimp; - var _g42 = j2; - var _g52 = this.dTotalImpulses; - _g52[_g42] = _g52[_g42] + dimp; - } - var impulses = this.dTotalImpulses; - var linearSet = false; - var angularSet = false; - var lv11; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv21; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av11; - var av1X1; - var av1Y1; - var av1Z1; - var av21; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._velX; - lv1Y1 = this._b1._velY; - lv1Z1 = this._b1._velZ; - lv2X1 = this._b2._velX; - lv2Y1 = this._b2._velY; - lv2Z1 = this._b2._velZ; - av1X1 = this._b1._angVelX; - av1Y1 = this._b1._angVelY; - av1Z1 = this._b1._angVelZ; - av2X1 = this._b2._angVelX; - av2Y1 = this._b2._angVelY; - av2Z1 = this._b2._angVelZ; - var _g6 = 0; - var _g11 = this.info.numRows; - while(_g6 < _g11) { - var i3 = _g6++; - var row3 = this.info.rows[i3]; - var j3 = row3.jacobian; - var md1 = this.massData[i3]; - var imp3 = impulses[i3]; - if((j3.flag & 1) != 0) { - lv1X1 += md1.invMLin1X * imp3; - lv1Y1 += md1.invMLin1Y * imp3; - lv1Z1 += md1.invMLin1Z * imp3; - lv2X1 += md1.invMLin2X * -imp3; - lv2Y1 += md1.invMLin2Y * -imp3; - lv2Z1 += md1.invMLin2Z * -imp3; + let solved = false; + let _g2 = 0; + let _g3 = this.boundaryBuilder.numBoundaries; + while(_g2 < _g3) { + let idx = this.velBoundarySelector.indices[_g2++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { + let _g = 0; + while(_g < numRows) { + let j = _g++; + let dimp = this.dImpulses[j]; + this.info.rows[j].impulse.impulse += dimp; + this.dTotalImpulses[j] += dimp; + } + let impulses = this.dTotalImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j3.flag & 2) != 0) { - av1X1 += md1.invMAng1X * imp3; - av1Y1 += md1.invMAng1Y * imp3; - av1Z1 += md1.invMAng1Z * imp3; - av2X1 += md1.invMAng2X * -imp3; - av2Y1 += md1.invMAng2Y * -imp3; - av2Z1 += md1.invMAng2Z * -imp3; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._velX = lv1X1; - this._b1._velY = lv1Y1; - this._b1._velZ = lv1Z1; - this._b2._velX = lv2X1; - this._b2._velY = lv2Y1; - this._b2._velZ = lv2Z1; + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; } if(angularSet) { - this._b1._angVelX = av1X1; - this._b1._angVelY = av1Y1; - this._b1._angVelZ = av1Z1; - this._b2._angVelX = av2X1; - this._b2._angVelY = av2Y1; - this._b2._angVelZ = av2Z1; - } - var _this = this.velBoundarySelector; - var i4 = 0; - while(_this.indices[i4] != idx) ++i4; - while(i4 > 0) { - var tmp = _this.indices[i4]; - _this.indices[i4] = _this.indices[i4 - 1]; - _this.indices[i4 - 1] = tmp; - --i4; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + let _this = this.velBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -46489,27 +29004,24 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ } } postSolveVelocity(timeStep) { - var lin; - var linX; - var linY; - var linZ; - var ang; - var angX; - var angY; - var angZ; + let linX; + let linY; + let linZ; + let angX; + let angY; + let angZ; linX = 0; linY = 0; linZ = 0; angX = 0; angY = 0; angZ = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var j = row.jacobian; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let j = row.jacobian; if((j.flag & 1) != 0) { linX += j.lin1X * imp.impulse; linY += j.lin1Y * imp.impulse; @@ -46533,21 +29045,20 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.posBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var i = _g++; - var idx = _this2.indices[i]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -46556,34 +29067,27 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - this.info.rows[i1].impulse.impulseP = 0; - } + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; } solvePositionSplitImpulse() { - var numRows = this.info.numRows; - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let numRows = this.info.numRows; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -46596,120 +29100,107 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; - var _g1 = numRows; - while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var j = row.jacobian; - var relVel = 0; + let _g = 0; + while(_g < numRows) { + let i = _g++; + let row = this.info.rows[i]; + let j = row.jacobian; + let relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; relVel -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; this.relVels[i] = relVel; - this.impulses[i] = imp.impulseP; + this.impulses[i] = row.impulse.impulseP; } - var solved = false; - var _g2 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g2 < _g3) { - var i1 = _g2++; - var idx = this.posBoundarySelector.indices[i1]; - var b = this.boundaryBuilder.boundaries[idx]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionSplitImpulseBaumgarte,false)) { - var _g21 = 0; - var _g31 = numRows; - while(_g21 < _g31) { - var j1 = _g21++; - var row1 = this.info.rows[j1]; - var imp1 = row1.impulse; - var dimp = this.dImpulses[j1]; - imp1.impulseP += dimp; - } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv11; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv21; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av11; - var av1X1; - var av1Y1; - var av1Z1; - var av21; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._pseudoVelX; - lv1Y1 = this._b1._pseudoVelY; - lv1Z1 = this._b1._pseudoVelZ; - lv2X1 = this._b2._pseudoVelX; - lv2Y1 = this._b2._pseudoVelY; - lv2Z1 = this._b2._pseudoVelZ; - av1X1 = this._b1._angPseudoVelX; - av1Y1 = this._b1._angPseudoVelY; - av1Z1 = this._b1._angPseudoVelZ; - av2X1 = this._b2._angPseudoVelX; - av2Y1 = this._b2._angPseudoVelY; - av2Z1 = this._b2._angPseudoVelZ; - var _g4 = 0; - var _g11 = this.info.numRows; - while(_g4 < _g11) { - var i2 = _g4++; - var row2 = this.info.rows[i2]; - var j2 = row2.jacobian; - var md = this.massData[i2]; - var imp2 = impulses[i2]; - if((j2.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp2; - lv1Y1 += md.invMLin1Y * imp2; - lv1Z1 += md.invMLin1Z * imp2; - lv2X1 += md.invMLin2X * -imp2; - lv2Y1 += md.invMLin2Y * -imp2; - lv2Z1 += md.invMLin2Z * -imp2; + let solved = false; + let _g1 = 0; + let _g2 = this.boundaryBuilder.numBoundaries; + while(_g1 < _g2) { + let idx = this.posBoundarySelector.indices[_g1++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionSplitImpulseBaumgarte,false)) { + let _g = 0; + while(_g < numRows) { + let j = _g++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; + } + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j2.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp2; - av1Y1 += md.invMAng1Y * imp2; - av1Z1 += md.invMAng1Z * imp2; - av2X1 += md.invMAng2X * -imp2; - av2Y1 += md.invMAng2Y * -imp2; - av2Z1 += md.invMAng2Z * -imp2; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._pseudoVelX = lv1X1; - this._b1._pseudoVelY = lv1Y1; - this._b1._pseudoVelZ = lv1Z1; - this._b2._pseudoVelX = lv2X1; - this._b2._pseudoVelY = lv2Y1; - this._b2._pseudoVelZ = lv2Z1; + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; } if(angularSet) { - this._b1._angPseudoVelX = av1X1; - this._b1._angPseudoVelY = av1Y1; - this._b1._angPseudoVelZ = av1Z1; - this._b2._angPseudoVelX = av2X1; - this._b2._angPseudoVelY = av2Y1; - this._b2._angPseudoVelZ = av2Z1; - } - var _this = this.posBoundarySelector; - var i3 = 0; - while(_this.indices[i3] != idx) ++i3; - while(i3 > 0) { - var tmp = _this.indices[i3]; - _this.indices[i3] = _this.indices[i3 - 1]; - _this.indices[i3 - 1] = tmp; - --i3; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + let _this = this.posBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -46726,21 +29217,20 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.posBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var i = _g++; - var idx = _this2.indices[i]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -46749,56 +29239,43 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; - var numRows = this.info.numRows; - var _g2 = 0; - var _g11 = numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row = this.info.rows[i1]; - var imp = row.impulse; - var j = row.jacobian; - this.relVels[i1] = 0; - this.impulses[i1] = imp.impulseP; - } - var solved = false; - var _g21 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g21 < _g3) { - var i2 = _g21++; - var idx1 = this.posBoundarySelector.indices[i2]; - var b = this.boundaryBuilder.boundaries[idx1]; - if(b.computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionNgsBaumgarte,false)) { - var _g22 = 0; - var _g31 = numRows; - while(_g22 < _g31) { - var j1 = _g22++; - var row1 = this.info.rows[j1]; - var imp1 = row1.impulse; - var dimp = this.dImpulses[j1]; - imp1.impulseP += dimp; - } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let numRows = this.info.numRows; + let _g2 = 0; + while(_g2 < numRows) { + let i = _g2++; + let imp = this.info.rows[i].impulse; + this.relVels[i] = 0; + this.impulses[i] = imp.impulseP; + } + let solved = false; + let _g3 = 0; + let _g4 = this.boundaryBuilder.numBoundaries; + while(_g3 < _g4) { + let idx = this.posBoundarySelector.indices[_g3++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo.common.Setting.positionNgsBaumgarte,false)) { + let _g = 0; + while(_g < numRows) { + let j = _g++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; + } + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -46811,126 +29288,122 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ av2X = 0; av2Y = 0; av2Z = 0; - var _g4 = 0; - var _g12 = this.info.numRows; - while(_g4 < _g12) { - var i3 = _g4++; - var row2 = this.info.rows[i3]; - var j2 = row2.jacobian; - var md = this.massData[i3]; - var imp2 = impulses[i3]; - if((j2.flag & 1) != 0) { - lv1X += md.invMLin1X * imp2; - lv1Y += md.invMLin1Y * imp2; - lv1Z += md.invMLin1Z * imp2; - lv2X += md.invMLin2X * -imp2; - lv2Y += md.invMLin2Y * -imp2; - lv2Z += md.invMLin2Z * -imp2; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j2.flag & 2) != 0) { - av1X += md.invMAng1X * imp2; - av1Y += md.invMAng1Y * imp2; - av1Z += md.invMAng1Z * imp2; - av2X += md.invMAng2X * -imp2; - av2Y += md.invMAng2Y * -imp2; - av2Z += md.invMAng2Z * -imp2; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - var _this3 = this._b1; - _this3._transform._positionX += lv1X; - _this3._transform._positionY += lv1Y; - _this3._transform._positionZ += lv1Z; - var _this4 = this._b2; - _this4._transform._positionX += lv2X; - _this4._transform._positionY += lv2Y; - _this4._transform._positionZ += lv2Z; + let _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + let _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; } if(angularSet) { - var _this5 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + let ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this5._transform._rotation00; - var e11 = _this5._transform._rotation11; - var e22 = _this5._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this._transform._rotation00; + let e11 = _this._transform._rotation11; + let e22 = _this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; - qY = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; - qZ = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; } else if(e00 > e11) { if(e00 > e22) { s = Math.sqrt(e00 - e11 - e22 + 1); qX = 0.5 * s; s = 0.5 / s; - qY = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qW = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } } else if(e11 > e22) { s = Math.sqrt(e11 - e22 - e00 + 1); qY = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -46938,176 +29411,173 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - _this5._transform._rotation00 = 1 - yy - zz; - _this5._transform._rotation01 = xy - wz; - _this5._transform._rotation02 = xz + wy; - _this5._transform._rotation10 = xy + wz; - _this5._transform._rotation11 = 1 - xx - zz; - _this5._transform._rotation12 = yz - wx; - _this5._transform._rotation20 = xz - wy; - _this5._transform._rotation21 = yz + wx; - _this5._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = _this5._transform._rotation00 * _this5._invLocalInertia00 + _this5._transform._rotation01 * _this5._invLocalInertia10 + _this5._transform._rotation02 * _this5._invLocalInertia20; - __tmp__01 = _this5._transform._rotation00 * _this5._invLocalInertia01 + _this5._transform._rotation01 * _this5._invLocalInertia11 + _this5._transform._rotation02 * _this5._invLocalInertia21; - __tmp__02 = _this5._transform._rotation00 * _this5._invLocalInertia02 + _this5._transform._rotation01 * _this5._invLocalInertia12 + _this5._transform._rotation02 * _this5._invLocalInertia22; - __tmp__10 = _this5._transform._rotation10 * _this5._invLocalInertia00 + _this5._transform._rotation11 * _this5._invLocalInertia10 + _this5._transform._rotation12 * _this5._invLocalInertia20; - __tmp__11 = _this5._transform._rotation10 * _this5._invLocalInertia01 + _this5._transform._rotation11 * _this5._invLocalInertia11 + _this5._transform._rotation12 * _this5._invLocalInertia21; - __tmp__12 = _this5._transform._rotation10 * _this5._invLocalInertia02 + _this5._transform._rotation11 * _this5._invLocalInertia12 + _this5._transform._rotation12 * _this5._invLocalInertia22; - __tmp__20 = _this5._transform._rotation20 * _this5._invLocalInertia00 + _this5._transform._rotation21 * _this5._invLocalInertia10 + _this5._transform._rotation22 * _this5._invLocalInertia20; - __tmp__21 = _this5._transform._rotation20 * _this5._invLocalInertia01 + _this5._transform._rotation21 * _this5._invLocalInertia11 + _this5._transform._rotation22 * _this5._invLocalInertia21; - __tmp__22 = _this5._transform._rotation20 * _this5._invLocalInertia02 + _this5._transform._rotation21 * _this5._invLocalInertia12 + _this5._transform._rotation22 * _this5._invLocalInertia22; - _this5._invInertia00 = __tmp__00; - _this5._invInertia01 = __tmp__01; - _this5._invInertia02 = __tmp__02; - _this5._invInertia10 = __tmp__10; - _this5._invInertia11 = __tmp__11; - _this5._invInertia12 = __tmp__12; - _this5._invInertia20 = __tmp__20; - _this5._invInertia21 = __tmp__21; - _this5._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = _this5._invInertia00 * _this5._transform._rotation00 + _this5._invInertia01 * _this5._transform._rotation01 + _this5._invInertia02 * _this5._transform._rotation02; - __tmp__011 = _this5._invInertia00 * _this5._transform._rotation10 + _this5._invInertia01 * _this5._transform._rotation11 + _this5._invInertia02 * _this5._transform._rotation12; - __tmp__021 = _this5._invInertia00 * _this5._transform._rotation20 + _this5._invInertia01 * _this5._transform._rotation21 + _this5._invInertia02 * _this5._transform._rotation22; - __tmp__101 = _this5._invInertia10 * _this5._transform._rotation00 + _this5._invInertia11 * _this5._transform._rotation01 + _this5._invInertia12 * _this5._transform._rotation02; - __tmp__111 = _this5._invInertia10 * _this5._transform._rotation10 + _this5._invInertia11 * _this5._transform._rotation11 + _this5._invInertia12 * _this5._transform._rotation12; - __tmp__121 = _this5._invInertia10 * _this5._transform._rotation20 + _this5._invInertia11 * _this5._transform._rotation21 + _this5._invInertia12 * _this5._transform._rotation22; - __tmp__201 = _this5._invInertia20 * _this5._transform._rotation00 + _this5._invInertia21 * _this5._transform._rotation01 + _this5._invInertia22 * _this5._transform._rotation02; - __tmp__211 = _this5._invInertia20 * _this5._transform._rotation10 + _this5._invInertia21 * _this5._transform._rotation11 + _this5._invInertia22 * _this5._transform._rotation12; - __tmp__221 = _this5._invInertia20 * _this5._transform._rotation20 + _this5._invInertia21 * _this5._transform._rotation21 + _this5._invInertia22 * _this5._transform._rotation22; - _this5._invInertia00 = __tmp__001; - _this5._invInertia01 = __tmp__011; - _this5._invInertia02 = __tmp__021; - _this5._invInertia10 = __tmp__101; - _this5._invInertia11 = __tmp__111; - _this5._invInertia12 = __tmp__121; - _this5._invInertia20 = __tmp__201; - _this5._invInertia21 = __tmp__211; - _this5._invInertia22 = __tmp__221; - _this5._invInertia00 *= _this5._rotFactor.x; - _this5._invInertia01 *= _this5._rotFactor.x; - _this5._invInertia02 *= _this5._rotFactor.x; - _this5._invInertia10 *= _this5._rotFactor.y; - _this5._invInertia11 *= _this5._rotFactor.y; - _this5._invInertia12 *= _this5._rotFactor.y; - _this5._invInertia20 *= _this5._rotFactor.z; - _this5._invInertia21 *= _this5._rotFactor.z; - _this5._invInertia22 *= _this5._rotFactor.z; - var _this6 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__011 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__021 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__101 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__111 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__121 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__201 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__211 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__221 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__001; + _this._invInertia01 = __tmp__011; + _this._invInertia02 = __tmp__021; + _this._invInertia10 = __tmp__101; + _this._invInertia11 = __tmp__111; + _this._invInertia12 = __tmp__121; + _this._invInertia20 = __tmp__201; + _this._invInertia21 = __tmp__211; + _this._invInertia22 = __tmp__221; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; + let _this1 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this6._transform._rotation00; - var e111 = _this6._transform._rotation11; - var e221 = _this6._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this1._transform._rotation00; + let e111 = _this1._transform._rotation11; + let e221 = _this1._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; - qY1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; - qZ1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation21 - _this1._transform._rotation12) * s1; + qY1 = (_this1._transform._rotation02 - _this1._transform._rotation20) * s1; + qZ1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } else if(e001 > e111) { if(e001 > e221) { s1 = Math.sqrt(e001 - e111 - e221 + 1); qX1 = 0.5 * s1; s1 = 0.5 / s1; - qY1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qW1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + qY1 = (_this1._transform._rotation01 + _this1._transform._rotation10) * s1; + qZ1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qW1 = (_this1._transform._rotation21 - _this1._transform._rotation12) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qY1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } } else if(e111 > e221) { s1 = Math.sqrt(e111 - e221 - e001 + 1); qY1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + qX1 = (_this1._transform._rotation01 + _this1._transform._rotation10) * s1; + qZ1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation02 - _this1._transform._rotation20) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qY1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -47115,103 +29585,103 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; - _this6._transform._rotation00 = 1 - yy1 - zz1; - _this6._transform._rotation01 = xy1 - wz1; - _this6._transform._rotation02 = xz1 + wy1; - _this6._transform._rotation10 = xy1 + wz1; - _this6._transform._rotation11 = 1 - xx1 - zz1; - _this6._transform._rotation12 = yz1 - wx1; - _this6._transform._rotation20 = xz1 - wy1; - _this6._transform._rotation21 = yz1 + wx1; - _this6._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = _this6._transform._rotation00 * _this6._invLocalInertia00 + _this6._transform._rotation01 * _this6._invLocalInertia10 + _this6._transform._rotation02 * _this6._invLocalInertia20; - __tmp__012 = _this6._transform._rotation00 * _this6._invLocalInertia01 + _this6._transform._rotation01 * _this6._invLocalInertia11 + _this6._transform._rotation02 * _this6._invLocalInertia21; - __tmp__022 = _this6._transform._rotation00 * _this6._invLocalInertia02 + _this6._transform._rotation01 * _this6._invLocalInertia12 + _this6._transform._rotation02 * _this6._invLocalInertia22; - __tmp__102 = _this6._transform._rotation10 * _this6._invLocalInertia00 + _this6._transform._rotation11 * _this6._invLocalInertia10 + _this6._transform._rotation12 * _this6._invLocalInertia20; - __tmp__112 = _this6._transform._rotation10 * _this6._invLocalInertia01 + _this6._transform._rotation11 * _this6._invLocalInertia11 + _this6._transform._rotation12 * _this6._invLocalInertia21; - __tmp__122 = _this6._transform._rotation10 * _this6._invLocalInertia02 + _this6._transform._rotation11 * _this6._invLocalInertia12 + _this6._transform._rotation12 * _this6._invLocalInertia22; - __tmp__202 = _this6._transform._rotation20 * _this6._invLocalInertia00 + _this6._transform._rotation21 * _this6._invLocalInertia10 + _this6._transform._rotation22 * _this6._invLocalInertia20; - __tmp__212 = _this6._transform._rotation20 * _this6._invLocalInertia01 + _this6._transform._rotation21 * _this6._invLocalInertia11 + _this6._transform._rotation22 * _this6._invLocalInertia21; - __tmp__222 = _this6._transform._rotation20 * _this6._invLocalInertia02 + _this6._transform._rotation21 * _this6._invLocalInertia12 + _this6._transform._rotation22 * _this6._invLocalInertia22; - _this6._invInertia00 = __tmp__002; - _this6._invInertia01 = __tmp__012; - _this6._invInertia02 = __tmp__022; - _this6._invInertia10 = __tmp__102; - _this6._invInertia11 = __tmp__112; - _this6._invInertia12 = __tmp__122; - _this6._invInertia20 = __tmp__202; - _this6._invInertia21 = __tmp__212; - _this6._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = _this6._invInertia00 * _this6._transform._rotation00 + _this6._invInertia01 * _this6._transform._rotation01 + _this6._invInertia02 * _this6._transform._rotation02; - __tmp__013 = _this6._invInertia00 * _this6._transform._rotation10 + _this6._invInertia01 * _this6._transform._rotation11 + _this6._invInertia02 * _this6._transform._rotation12; - __tmp__023 = _this6._invInertia00 * _this6._transform._rotation20 + _this6._invInertia01 * _this6._transform._rotation21 + _this6._invInertia02 * _this6._transform._rotation22; - __tmp__103 = _this6._invInertia10 * _this6._transform._rotation00 + _this6._invInertia11 * _this6._transform._rotation01 + _this6._invInertia12 * _this6._transform._rotation02; - __tmp__113 = _this6._invInertia10 * _this6._transform._rotation10 + _this6._invInertia11 * _this6._transform._rotation11 + _this6._invInertia12 * _this6._transform._rotation12; - __tmp__123 = _this6._invInertia10 * _this6._transform._rotation20 + _this6._invInertia11 * _this6._transform._rotation21 + _this6._invInertia12 * _this6._transform._rotation22; - __tmp__203 = _this6._invInertia20 * _this6._transform._rotation00 + _this6._invInertia21 * _this6._transform._rotation01 + _this6._invInertia22 * _this6._transform._rotation02; - __tmp__213 = _this6._invInertia20 * _this6._transform._rotation10 + _this6._invInertia21 * _this6._transform._rotation11 + _this6._invInertia22 * _this6._transform._rotation12; - __tmp__223 = _this6._invInertia20 * _this6._transform._rotation20 + _this6._invInertia21 * _this6._transform._rotation21 + _this6._invInertia22 * _this6._transform._rotation22; - _this6._invInertia00 = __tmp__003; - _this6._invInertia01 = __tmp__013; - _this6._invInertia02 = __tmp__023; - _this6._invInertia10 = __tmp__103; - _this6._invInertia11 = __tmp__113; - _this6._invInertia12 = __tmp__123; - _this6._invInertia20 = __tmp__203; - _this6._invInertia21 = __tmp__213; - _this6._invInertia22 = __tmp__223; - _this6._invInertia00 *= _this6._rotFactor.x; - _this6._invInertia01 *= _this6._rotFactor.x; - _this6._invInertia02 *= _this6._rotFactor.x; - _this6._invInertia10 *= _this6._rotFactor.y; - _this6._invInertia11 *= _this6._rotFactor.y; - _this6._invInertia12 *= _this6._rotFactor.y; - _this6._invInertia20 *= _this6._rotFactor.z; - _this6._invInertia21 *= _this6._rotFactor.z; - _this6._invInertia22 *= _this6._rotFactor.z; - } - var _this7 = this.posBoundarySelector; - var i4 = 0; - while(_this7.indices[i4] != idx1) ++i4; - while(i4 > 0) { - var tmp1 = _this7.indices[i4]; - _this7.indices[i4] = _this7.indices[i4 - 1]; - _this7.indices[i4 - 1] = tmp1; - --i4; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; + _this1._transform._rotation00 = 1 - yy1 - zz1; + _this1._transform._rotation01 = xy1 - wz1; + _this1._transform._rotation02 = xz1 + wy1; + _this1._transform._rotation10 = xy1 + wz1; + _this1._transform._rotation11 = 1 - xx1 - zz1; + _this1._transform._rotation12 = yz1 - wx1; + _this1._transform._rotation20 = xz1 - wy1; + _this1._transform._rotation21 = yz1 + wx1; + _this1._transform._rotation22 = 1 - xx1 - yy1; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; + __tmp__002 = _this1._transform._rotation00 * _this1._invLocalInertia00 + _this1._transform._rotation01 * _this1._invLocalInertia10 + _this1._transform._rotation02 * _this1._invLocalInertia20; + __tmp__012 = _this1._transform._rotation00 * _this1._invLocalInertia01 + _this1._transform._rotation01 * _this1._invLocalInertia11 + _this1._transform._rotation02 * _this1._invLocalInertia21; + __tmp__022 = _this1._transform._rotation00 * _this1._invLocalInertia02 + _this1._transform._rotation01 * _this1._invLocalInertia12 + _this1._transform._rotation02 * _this1._invLocalInertia22; + __tmp__102 = _this1._transform._rotation10 * _this1._invLocalInertia00 + _this1._transform._rotation11 * _this1._invLocalInertia10 + _this1._transform._rotation12 * _this1._invLocalInertia20; + __tmp__112 = _this1._transform._rotation10 * _this1._invLocalInertia01 + _this1._transform._rotation11 * _this1._invLocalInertia11 + _this1._transform._rotation12 * _this1._invLocalInertia21; + __tmp__122 = _this1._transform._rotation10 * _this1._invLocalInertia02 + _this1._transform._rotation11 * _this1._invLocalInertia12 + _this1._transform._rotation12 * _this1._invLocalInertia22; + __tmp__202 = _this1._transform._rotation20 * _this1._invLocalInertia00 + _this1._transform._rotation21 * _this1._invLocalInertia10 + _this1._transform._rotation22 * _this1._invLocalInertia20; + __tmp__212 = _this1._transform._rotation20 * _this1._invLocalInertia01 + _this1._transform._rotation21 * _this1._invLocalInertia11 + _this1._transform._rotation22 * _this1._invLocalInertia21; + __tmp__222 = _this1._transform._rotation20 * _this1._invLocalInertia02 + _this1._transform._rotation21 * _this1._invLocalInertia12 + _this1._transform._rotation22 * _this1._invLocalInertia22; + _this1._invInertia00 = __tmp__002; + _this1._invInertia01 = __tmp__012; + _this1._invInertia02 = __tmp__022; + _this1._invInertia10 = __tmp__102; + _this1._invInertia11 = __tmp__112; + _this1._invInertia12 = __tmp__122; + _this1._invInertia20 = __tmp__202; + _this1._invInertia21 = __tmp__212; + _this1._invInertia22 = __tmp__222; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; + __tmp__003 = _this1._invInertia00 * _this1._transform._rotation00 + _this1._invInertia01 * _this1._transform._rotation01 + _this1._invInertia02 * _this1._transform._rotation02; + __tmp__013 = _this1._invInertia00 * _this1._transform._rotation10 + _this1._invInertia01 * _this1._transform._rotation11 + _this1._invInertia02 * _this1._transform._rotation12; + __tmp__023 = _this1._invInertia00 * _this1._transform._rotation20 + _this1._invInertia01 * _this1._transform._rotation21 + _this1._invInertia02 * _this1._transform._rotation22; + __tmp__103 = _this1._invInertia10 * _this1._transform._rotation00 + _this1._invInertia11 * _this1._transform._rotation01 + _this1._invInertia12 * _this1._transform._rotation02; + __tmp__113 = _this1._invInertia10 * _this1._transform._rotation10 + _this1._invInertia11 * _this1._transform._rotation11 + _this1._invInertia12 * _this1._transform._rotation12; + __tmp__123 = _this1._invInertia10 * _this1._transform._rotation20 + _this1._invInertia11 * _this1._transform._rotation21 + _this1._invInertia12 * _this1._transform._rotation22; + __tmp__203 = _this1._invInertia20 * _this1._transform._rotation00 + _this1._invInertia21 * _this1._transform._rotation01 + _this1._invInertia22 * _this1._transform._rotation02; + __tmp__213 = _this1._invInertia20 * _this1._transform._rotation10 + _this1._invInertia21 * _this1._transform._rotation11 + _this1._invInertia22 * _this1._transform._rotation12; + __tmp__223 = _this1._invInertia20 * _this1._transform._rotation20 + _this1._invInertia21 * _this1._transform._rotation21 + _this1._invInertia22 * _this1._transform._rotation22; + _this1._invInertia00 = __tmp__003; + _this1._invInertia01 = __tmp__013; + _this1._invInertia02 = __tmp__023; + _this1._invInertia10 = __tmp__103; + _this1._invInertia11 = __tmp__113; + _this1._invInertia12 = __tmp__123; + _this1._invInertia20 = __tmp__203; + _this1._invInertia21 = __tmp__213; + _this1._invInertia22 = __tmp__223; + _this1._invInertia00 *= _this1._rotFactor.x; + _this1._invInertia01 *= _this1._rotFactor.x; + _this1._invInertia02 *= _this1._rotFactor.x; + _this1._invInertia10 *= _this1._rotFactor.y; + _this1._invInertia11 *= _this1._rotFactor.y; + _this1._invInertia12 *= _this1._rotFactor.y; + _this1._invInertia20 *= _this1._rotFactor.z; + _this1._invInertia21 *= _this1._rotFactor.z; + _this1._invInertia22 *= _this1._rotFactor.z; + } + let _this = this.posBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -47230,179 +29700,159 @@ oimo.dynamics.constraint.solver.direct.DirectJointConstraintSolver = class oimo_ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constraint_solver_direct_MassMatrix { constructor(size) { this._size = size; - var this1 = new Array(this._size); - this.tmpMatrix = this1; - var this2 = new Array(this._size); - this._invMass = this2; - var this3 = new Array(this._size); - this._invMassWithoutCfm = this3; - var _g = 0; - var _g1 = this._size; + this.tmpMatrix = new Array(this._size); + this._invMass = new Array(this._size); + this._invMassWithoutCfm = new Array(this._size); + let _g = 0; + let _g1 = this._size; while(_g < _g1) { - var i = _g++; - var this4 = this.tmpMatrix; - var this5 = new Array(this._size); - this4[i] = this5; - var this6 = this._invMass; - var this7 = new Array(this._size); - this6[i] = this7; - var this8 = this._invMassWithoutCfm; - var this9 = new Array(this._size); - this8[i] = this9; - var _g2 = 0; - var _g11 = this._size; - while(_g2 < _g11) { - var j = _g2++; + let i = _g++; + this.tmpMatrix[i] = new Array(this._size); + this._invMass[i] = new Array(this._size); + this._invMassWithoutCfm[i] = new Array(this._size); + let _g1 = 0; + let _g2 = this._size; + while(_g1 < _g2) { + let j = _g1++; this.tmpMatrix[i][j] = 0; this._invMass[i][j] = 0; this._invMassWithoutCfm[i][j] = 0; } } this._maxSubmatrixId = 1 << this._size; - var this10 = new Array(this._maxSubmatrixId); - this._cacheComputed = this10; - var this11 = new Array(this._maxSubmatrixId); - this._cachedSubmatrices = this11; - var _g21 = 0; - var _g3 = this._maxSubmatrixId; - while(_g21 < _g3) { - var i1 = _g21++; - var t = i1; - t = (t & 85) + (t >> 1 & 85); + this._cacheComputed = new Array(this._maxSubmatrixId); + this._cachedSubmatrices = new Array(this._maxSubmatrixId); + let _g2 = 0; + let _g3 = this._maxSubmatrixId; + while(_g2 < _g3) { + let i = _g2++; + let t = i; + t = (i & 85) + (i >> 1 & 85); t = (t & 51) + (t >> 2 & 51); t = (t & 15) + (t >> 4 & 15); - var matrixSize = t; - var this12 = new Array(matrixSize); - var subMatrix = this12; - var _g22 = 0; - var _g31 = matrixSize; - while(_g22 < _g31) { - var j1 = _g22++; - var this13 = new Array(matrixSize); - subMatrix[j1] = this13; - var _g23 = 0; - var _g32 = matrixSize; - while(_g23 < _g32) { - var k = _g23++; - subMatrix[j1][k] = 0; - } - } - this._cacheComputed[i1] = false; - this._cachedSubmatrices[i1] = subMatrix; + let matrixSize = t; + let subMatrix = new Array(matrixSize); + let _g = 0; + while(_g < matrixSize) { + let j = _g++; + subMatrix[j] = new Array(matrixSize); + let _g1 = 0; + while(_g1 < matrixSize) subMatrix[j][_g1++] = 0; + } + this._cacheComputed[i] = false; + this._cachedSubmatrices[i] = subMatrix; } } computeSubmatrix(id,indices,size) { - var _g = 0; - var _g1 = size; - while(_g < _g1) { - var i = _g++; - var ii = indices[i]; - var _g2 = 0; - var _g11 = size; - while(_g2 < _g11) { - var j = _g2++; + let _g = 0; + while(_g < size) { + let i = _g++; + let ii = indices[i]; + let _g1 = 0; + while(_g1 < size) { + let j = _g1++; this.tmpMatrix[i][j] = this._invMass[ii][indices[j]]; } } - var src = this.tmpMatrix; - var dst = this._cachedSubmatrices[id]; - var srci; - var dsti; - var srcj; - var dstj; - var diag; + let src = this.tmpMatrix; + let dst = this._cachedSubmatrices[id]; + let srci; + let dsti; + let srcj; + let dstj; + let diag; switch(size) { case 4: srci = src[0]; dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -47418,162 +29868,162 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -47594,261 +30044,261 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[5]; dstj = dst[5]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dstj[4] = -diag * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srci = src[5]; dsti = dst[5]; diag = 1 / srci[5]; dsti[5] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - dsti[4] = dsti[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + dsti[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; - dstj[4] = dstj[4] - dsti[4] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; + dstj[4] -= dsti[4] * srcj[5]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -47871,108 +30321,90 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai dst[4][5] = dsti[4]; break; default: - var _g21 = 0; - var _g3 = size; - while(_g21 < _g3) { - var i1 = _g21++; - srci = src[i1]; - dsti = dst[i1]; - var diag1 = 1 / srci[i1]; - dsti[i1] = diag1; - var _g22 = 0; - var _g31 = i1; - while(_g22 < _g31) { - var j1 = _g22++; - dsti[j1] = dsti[j1] * diag1; - } - var _g4 = i1 + 1; - var _g5 = size; - while(_g4 < _g5) { - var j2 = _g4++; - srci[j2] = srci[j2] * diag1; - } - var _g6 = 0; - var _g7 = i1; - while(_g6 < _g7) { - var j3 = _g6++; - srcj = src[j3]; - dstj = dst[j3]; - var _g61 = 0; - var _g71 = j3 + 1; - while(_g61 < _g71) { - var k = _g61++; - dstj[k] = dstj[k] - dsti[k] * srcj[i1]; + let _g1 = 0; + while(_g1 < size) { + let i = _g1++; + srci = src[i]; + dsti = dst[i]; + let diag = 1 / srci[i]; + dsti[i] = diag; + let _g = 0; + while(_g < i) dsti[_g++] *= diag; + let _g2 = i + 1; + while(_g2 < size) srci[_g2++] *= diag; + let _g3 = 0; + while(_g3 < i) { + let j = _g3++; + srcj = src[j]; + dstj = dst[j]; + let _g = 0; + let _g1 = j + 1; + while(_g < _g1) { + let k = _g++; + dstj[k] -= dsti[k] * srcj[i]; } - var _g8 = i1 + 1; - var _g9 = size; - while(_g8 < _g9) { - var k1 = _g8++; - srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; + let _g2 = i + 1; + while(_g2 < size) { + let k = _g2++; + srcj[k] -= srci[k] * srcj[i]; } } - var _g81 = i1 + 1; - var _g91 = size; - while(_g81 < _g91) { - var j4 = _g81++; - srcj = src[j4]; - dstj = dst[j4]; - var _g82 = 0; - var _g92 = i1; - while(_g82 < _g92) { - var k2 = _g82++; - dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; + let _g4 = i + 1; + while(_g4 < size) { + let j = _g4++; + srcj = src[j]; + dstj = dst[j]; + let _g = 0; + while(_g < i) { + let k = _g++; + dstj[k] -= dsti[k] * srcj[i]; } - dstj[i1] = -diag1 * srcj[i1]; - var _g10 = i1 + 1; - var _g111 = size; - while(_g10 < _g111) { - var k3 = _g10++; - srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; + dstj[i] = -diag * srcj[i]; + let _g1 = i + 1; + while(_g1 < size) { + let k = _g1++; + srcj[k] -= srci[k] * srcj[i]; } } } - var _g41 = 1; - var _g51 = size; - while(_g41 < _g51) { - var i2 = _g41++; - dsti = dst[i2]; - var _g42 = 0; - var _g52 = i2; - while(_g42 < _g52) { - var j5 = _g42++; - dst[j5][i2] = dsti[j5]; + let _g2 = 1; + while(_g2 < size) { + let i = _g2++; + dsti = dst[i]; + let _g = 0; + while(_g < i) { + let j = _g++; + dst[j][i] = dsti[j]; } } } } computeInvMass(info,massData) { - var invMass = this._invMass; - var invMassWithoutCfm = this._invMassWithoutCfm; - var numRows = info.numRows; - var b1 = info.b1; - var b2 = info.b2; - var invM1 = b1._invMass; - var invM2 = b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invMass = this._invMass; + let invMassWithoutCfm = this._invMassWithoutCfm; + let numRows = info.numRows; + let b1 = info.b1; + let b2 = info.b2; + let invM1 = b1._invMass; + let invM2 = b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = b1._invInertia00; invI101 = b1._invInertia01; invI102 = b1._invInertia02; @@ -47991,12 +30423,11 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai invI220 = b2._invInertia20; invI221 = b2._invInertia21; invI222 = b2._invInertia22; - var _g = 0; - var _g1 = numRows; - while(_g < _g1) { - var i = _g++; - var j = info.rows[i].jacobian; - var md = massData[i]; + let _g = 0; + while(_g < numRows) { + let i = _g++; + let j = info.rows[i].jacobian; + let md = massData[i]; j.updateSparsity(); if((j.flag & 1) != 0) { md.invMLin1X = j.lin1X * invM1; @@ -48014,18 +30445,18 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai md.invMLin2Z = 0; } if((j.flag & 2) != 0) { - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -48041,22 +30472,19 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai md.invMAng2Z = 0; } } - var _g2 = 0; - var _g3 = numRows; - while(_g2 < _g3) { - var i1 = _g2++; - var j1 = info.rows[i1].jacobian; - var _g21 = i1; - var _g31 = numRows; - while(_g21 < _g31) { - var j2 = _g21++; - var j21 = info.rows[j2].jacobian; - var md2 = massData[j2]; - var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); - if(i1 == j2) { - invMass[i1][j2] = val + info.rows[i1].cfm; - invMassWithoutCfm[i1][j2] = val; - md2.mass = val + info.rows[i1].cfm; + let _g1 = 0; + while(_g1 < numRows) { + let i = _g1++; + let j1 = info.rows[i].jacobian; + let _g = i; + while(_g < numRows) { + let j = _g++; + let md2 = massData[j]; + let val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); + if(i == j) { + invMass[i][j] = val + info.rows[i].cfm; + invMassWithoutCfm[i][j] = val; + md2.mass = val + info.rows[i].cfm; md2.massWithoutCfm = val; if(md2.mass != 0) { md2.mass = 1 / md2.mass; @@ -48065,19 +30493,16 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai md2.massWithoutCfm = 1 / md2.massWithoutCfm; } } else { - invMass[i1][j2] = val; - invMass[j2][i1] = val; - invMassWithoutCfm[i1][j2] = val; - invMassWithoutCfm[j2][i1] = val; + invMass[i][j] = val; + invMass[j][i] = val; + invMassWithoutCfm[i][j] = val; + invMassWithoutCfm[j][i] = val; } } } - var _g4 = 0; - var _g11 = this._maxSubmatrixId; - while(_g4 < _g11) { - var i2 = _g4++; - this._cacheComputed[i2] = false; - } + let _g2 = 0; + let _g3 = this._maxSubmatrixId; + while(_g2 < _g3) this._cacheComputed[_g2++] = false; } } if(!oimo.dynamics.constraint.solver.pgs) oimo.dynamics.constraint.solver.pgs = {}; @@ -48086,41 +30511,35 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna super(); this.constraint = constraint; this.info = new oimo.dynamics.constraint.info.contact.ContactSolverInfo(); - var this1 = new Array(oimo.common.Setting.maxManifoldPoints); - this.massData = this1; - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) { - var i = _g++; - this.massData[i] = new oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow(); - } + this.massData = new Array(oimo.common.Setting.maxManifoldPoints); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo.dynamics.constraint.solver.common.ContactSolverMassDataRow(); } preSolveVelocity(timeStep) { this.constraint._getVelocitySolverInfo(timeStep,this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -48139,31 +30558,31 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobianN; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let j = row.jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -48174,8 +30593,8 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna if(md.massN != 0) { md.massN = 1 / md.massN; } - var jt = row.jacobianT; - var jb = row.jacobianB; + let jt = row.jacobianT; + let jb = row.jacobianB; md.invMLinT1X = jt.lin1X * invM1; md.invMLinT1Y = jt.lin1Y * invM1; md.invMLinT1Z = jt.lin1Z * invM1; @@ -48188,73 +30607,68 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna md.invMLinB2X = jb.lin2X * invM2; md.invMLinB2Y = jb.lin2Y * invM2; md.invMLinB2Z = jb.lin2Z * invM2; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = invI100 * jt.ang1X + invI101 * jt.ang1Y + invI102 * jt.ang1Z; __tmp__Y2 = invI110 * jt.ang1X + invI111 * jt.ang1Y + invI112 * jt.ang1Z; __tmp__Z2 = invI120 * jt.ang1X + invI121 * jt.ang1Y + invI122 * jt.ang1Z; md.invMAngT1X = __tmp__X2; md.invMAngT1Y = __tmp__Y2; md.invMAngT1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = invI200 * jt.ang2X + invI201 * jt.ang2Y + invI202 * jt.ang2Z; __tmp__Y3 = invI210 * jt.ang2X + invI211 * jt.ang2Y + invI212 * jt.ang2Z; __tmp__Z3 = invI220 * jt.ang2X + invI221 * jt.ang2Y + invI222 * jt.ang2Z; md.invMAngT2X = __tmp__X3; md.invMAngT2Y = __tmp__Y3; md.invMAngT2Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = invI100 * jb.ang1X + invI101 * jb.ang1Y + invI102 * jb.ang1Z; __tmp__Y4 = invI110 * jb.ang1X + invI111 * jb.ang1Y + invI112 * jb.ang1Z; __tmp__Z4 = invI120 * jb.ang1X + invI121 * jb.ang1Y + invI122 * jb.ang1Z; md.invMAngB1X = __tmp__X4; md.invMAngB1Y = __tmp__Y4; md.invMAngB1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = invI200 * jb.ang2X + invI201 * jb.ang2Y + invI202 * jb.ang2Z; __tmp__Y5 = invI210 * jb.ang2X + invI211 * jb.ang2Y + invI212 * jb.ang2Z; __tmp__Z5 = invI220 * jb.ang2X + invI221 * jb.ang2Y + invI222 * jb.ang2Z; md.invMAngB2X = __tmp__X5; md.invMAngB2Y = __tmp__Y5; md.invMAngB2Z = __tmp__Z5; - var invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); - var invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); - var invMassTB10 = invMassTB01; - var invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); - var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB10; + let invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); + let invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); + let invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); + let invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB01; if(invDet != 0) { invDet = 1 / invDet; } md.massTB00 = invMassTB11 * invDet; md.massTB01 = -invMassTB01 * invDet; - md.massTB10 = -invMassTB10 * invDet; + md.massTB10 = -invMassTB01 * invDet; md.massTB11 = invMassTB00 * invDet; } } warmStart(timeStep) { - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -48267,18 +30681,18 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var md = this.massData[i]; - var jt = row.jacobianT; - var jb = row.jacobianB; - var impulseN = imp.impulseN; - var impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; - var impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; + let i = _g++; + let row = this.info.rows[i]; + let imp = row.impulse; + let md = this.massData[i]; + let jt = row.jacobianT; + let jb = row.jacobianB; + let impulseN = imp.impulseN; + let impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; + let impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; imp.impulseT = impulseT; imp.impulseB = impulseB; imp.impulseN *= timeStep.dtRatio; @@ -48335,22 +30749,18 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna this._b2._angVelZ = av2Z; } solveVelocity() { - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -48363,39 +30773,39 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var rvt = 0; - var j = row.jacobianT; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let rvt = 0; + let j = row.jacobianT; rvt += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvt -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvt += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvt -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var rvb = 0; + let rvb = 0; j = row.jacobianB; rvb += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvb -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvb += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvb -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); - var impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); - var oldImpulseT = imp.impulseT; - var oldImpulseB = imp.impulseB; + let impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); + let impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); + let oldImpulseT = imp.impulseT; + let oldImpulseB = imp.impulseB; imp.impulseT += impulseT; imp.impulseB += impulseB; - var maxImpulse = row.friction * imp.impulseN; + let maxImpulse = row.friction * imp.impulseN; if(maxImpulse == 0) { imp.impulseT = 0; imp.impulseB = 0; } else { - var impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; + let impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; if(impulseLengthSq > maxImpulse * maxImpulse) { - var invL = maxImpulse / Math.sqrt(impulseLengthSq); + let invL = maxImpulse / Math.sqrt(impulseLengthSq); imp.impulseT *= invL; imp.impulseB *= invL; } @@ -48427,38 +30837,38 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna av2Y += md.invMAngB2Y * -impulseB; av2Z += md.invMAngB2Z * -impulseB; } - var _g2 = 0; - var _g3 = this.info.numRows; + let _g2 = 0; + let _g3 = this.info.numRows; while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var rvn = 0; - var j1 = row1.jacobianN; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseN = (row1.rhs - rvn) * md1.massN; - var oldImpulseN = imp1.impulseN; - imp1.impulseN += impulseN; - if(imp1.impulseN < 0) { - imp1.impulseN = 0; - } - impulseN = imp1.impulseN - oldImpulseN; - lv1X += md1.invMLinN1X * impulseN; - lv1Y += md1.invMLinN1Y * impulseN; - lv1Z += md1.invMLinN1Z * impulseN; - lv2X += md1.invMLinN2X * -impulseN; - lv2Y += md1.invMLinN2Y * -impulseN; - lv2Z += md1.invMLinN2Z * -impulseN; - av1X += md1.invMAngN1X * impulseN; - av1Y += md1.invMAngN1Y * impulseN; - av1Z += md1.invMAngN1Z * impulseN; - av2X += md1.invMAngN2X * -impulseN; - av2Y += md1.invMAngN2Y * -impulseN; - av2Z += md1.invMAngN2Z * -impulseN; + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let rvn = 0; + let j = row.jacobianN; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseN = (row.rhs - rvn) * md.massN; + let oldImpulseN = imp.impulseN; + imp.impulseN += impulseN; + if(imp.impulseN < 0) { + imp.impulseN = 0; + } + impulseN = imp.impulseN - oldImpulseN; + lv1X += md.invMLinN1X * impulseN; + lv1Y += md.invMLinN1Y * impulseN; + lv1Z += md.invMLinN1Z * impulseN; + lv2X += md.invMLinN2X * -impulseN; + lv2Y += md.invMLinN2Y * -impulseN; + lv2Z += md.invMLinN2Z * -impulseN; + av1X += md.invMAngN1X * impulseN; + av1Y += md.invMAngN1Y * impulseN; + av1Z += md.invMAngN1Z * impulseN; + av2X += md.invMAngN2X * -impulseN; + av2Y += md.invMAngN2Y * -impulseN; + av2Z += md.invMAngN2Z * -impulseN; } this._b1._velX = lv1X; this._b1._velY = lv1Y; @@ -48476,28 +30886,26 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna preSolvePosition(timeStep) { this.constraint._syncManifold(); this.constraint._getPositionSolverInfo(this.info); - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -48516,31 +30924,30 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobianN; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -48552,30 +30959,23 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna md.massN = 1 / md.massN; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - this.info.rows[i1].impulse.impulseP = 0; - } + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; } solvePositionSplitImpulse() { - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -48588,21 +30988,21 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobianN; - var rvn = 0; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobianN; + let rvn = 0; rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseP = (row.rhs - rvn) * md.massN * oimo.common.Setting.positionSplitImpulseBaumgarte; - var oldImpulseP = imp.impulseP; + let impulseP = (row.rhs - rvn) * md.massN * oimo.common.Setting.positionSplitImpulseBaumgarte; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { imp.impulseP = 0; @@ -48637,28 +31037,26 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna solvePositionNgs(timeStep) { this.constraint._syncManifold(); this.constraint._getPositionSolverInfo(this.info); - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -48677,31 +31075,30 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobianN; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -48713,22 +31110,18 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna md.massN = 1 / md.massN; } } - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -48741,86 +31134,83 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp = row1.impulse; - var j1 = row1.jacobianN; - var rvn = 0; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row1.rhs - rvn) * md1.massN * oimo.common.Setting.positionNgsBaumgarte; - var oldImpulseP = imp.impulseP; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobianN; + let rvn = 0; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseP = (row.rhs - rvn) * md.massN * oimo.common.Setting.positionNgsBaumgarte; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { imp.impulseP = 0; } impulseP = imp.impulseP - oldImpulseP; - lv1X += md1.invMLinN1X * impulseP; - lv1Y += md1.invMLinN1Y * impulseP; - lv1Z += md1.invMLinN1Z * impulseP; - lv2X += md1.invMLinN2X * -impulseP; - lv2Y += md1.invMLinN2Y * -impulseP; - lv2Z += md1.invMLinN2Z * -impulseP; - av1X += md1.invMAngN1X * impulseP; - av1Y += md1.invMAngN1Y * impulseP; - av1Z += md1.invMAngN1Z * impulseP; - av2X += md1.invMAngN2X * -impulseP; - av2Y += md1.invMAngN2Y * -impulseP; - av2Z += md1.invMAngN2Z * -impulseP; - } - var _this = this._b1; + lv1X += md.invMLinN1X * impulseP; + lv1Y += md.invMLinN1Y * impulseP; + lv1Z += md.invMLinN1Z * impulseP; + lv2X += md.invMLinN2X * -impulseP; + lv2Y += md.invMLinN2Y * -impulseP; + lv2Z += md.invMLinN2Z * -impulseP; + av1X += md.invMAngN1X * impulseP; + av1Y += md.invMAngN1Y * impulseP; + av1Z += md.invMAngN1Z * impulseP; + av2X += md.invMAngN2X * -impulseP; + av2Y += md.invMAngN2Y * -impulseP; + av2Z += md.invMAngN2Z * -impulseP; + } + let _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; + let _this1 = this._b2; _this1._transform._positionX += lv2X; _this1._transform._positionY += lv2Y; _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this2 = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + let ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this2._transform._rotation00; + let e11 = _this2._transform._rotation11; + let e22 = _this2._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -48863,7 +31253,7 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -48871,22 +31261,22 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this2._transform._rotation00 = 1 - yy - zz; _this2._transform._rotation01 = xy - wz; _this2._transform._rotation02 = xz + wy; @@ -48896,15 +31286,15 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this2._transform._rotation20 = xz - wy; _this2._transform._rotation21 = yz + wx; _this2._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; @@ -48923,15 +31313,15 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this2._invInertia20 = __tmp__20; _this2._invInertia21 = __tmp__21; _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; @@ -48959,45 +31349,42 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this2._invInertia20 *= _this2._rotFactor.z; _this2._invInertia21 *= _this2._rotFactor.z; _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let _this3 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this3._transform._rotation00; + let e111 = _this3._transform._rotation11; + let e221 = _this3._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; @@ -49040,7 +31427,7 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -49048,22 +31435,22 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; _this3._transform._rotation00 = 1 - yy1 - zz1; _this3._transform._rotation01 = xy1 - wz1; _this3._transform._rotation02 = xz1 + wy1; @@ -49073,15 +31460,15 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this3._transform._rotation20 = xz1 - wy1; _this3._transform._rotation21 = yz1 + wx1; _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; @@ -49100,15 +31487,15 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this3._invInertia20 = __tmp__202; _this3._invInertia21 = __tmp__212; _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; @@ -49138,18 +31525,15 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna _this3._invInertia22 *= _this3._rotFactor.z; } postSolve() { - var lin1; - var lin1X; - var lin1Y; - var lin1Z; - var ang1; - var ang1X; - var ang1Y; - var ang1Z; - var ang2; - var ang2X; - var ang2Y; - var ang2Z; + let lin1X; + let lin1Y; + let lin1Z; + let ang1X; + let ang1Y; + let ang1Z; + let ang2X; + let ang2Y; + let ang2Z; lin1X = 0; lin1Y = 0; lin1Z = 0; @@ -49159,22 +31543,20 @@ oimo.dynamics.constraint.solver.pgs.PgsContactConstraintSolver = class oimo_dyna ang2X = 0; ang2Y = 0; ang2Z = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var jn = row.jacobianN; - var jt = row.jacobianT; - var jb = row.jacobianB; - var impN = imp.impulseN; - var impT = imp.impulseT; - var impB = imp.impulseB; - var impulseL; - var impulseLX; - var impulseLY; - var impulseLZ; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let jn = row.jacobianN; + let jt = row.jacobianT; + let jb = row.jacobianB; + let impN = imp.impulseN; + let impT = imp.impulseT; + let impB = imp.impulseB; + let impulseLX; + let impulseLY; + let impulseLZ; impulseLX = 0; impulseLY = 0; impulseLZ = 0; @@ -49235,42 +31617,36 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami super(); this.joint = joint; this.info = new oimo.dynamics.constraint.info.joint.JointSolverInfo(); - var this1 = new Array(oimo.common.Setting.maxJacobianRows); - this.massData = this1; - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) { - var i = _g++; - this.massData[i] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); - } + this.massData = new Array(oimo.common.Setting.maxJacobianRows); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo.dynamics.constraint.solver.common.JointSolverMassDataRow(); } preSolveVelocity(timeStep) { this.joint._syncAnchors(); this.joint._getVelocitySolverInfo(timeStep,this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -49289,13 +31665,13 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobian; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let j = row.jacobian; j.updateSparsity(); if((j.flag & 1) != 0) { md.invMLin1X = j.lin1X * invM1; @@ -49313,18 +31689,18 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami md.invMLin2Z = 0; } if((j.flag & 2) != 0) { - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -49350,37 +31726,31 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami } } warmStart(timeStep) { - var factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; + let factor = this.joint._positionCorrectionAlgorithm == oimo.dynamics.constraint.PositionCorrectionAlgorithm.BAUMGARTE ? oimo.common.Setting.jointWarmStartingFactorForBaungarte : oimo.common.Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var _this = row.impulse; + let _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -49393,17 +31763,15 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md = this.massData[i1]; - var imp = row1.impulse; - var j = row1.jacobian; + let _g = 0; + let _g1 = this.info.numRows; + while(_g < _g1) { + let i = _g++; + let md = this.massData[i]; + let imp = this.info.rows[i].impulse; imp.impulse *= factor; imp.impulseM *= factor; - var impulse = imp.impulse + imp.impulseM; + let impulse = imp.impulse + imp.impulseM; lv1X += md.invMLin1X * impulse; lv1Y += md.invMLin1Y * impulse; lv1Z += md.invMLin1Z * impulse; @@ -49431,22 +31799,18 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami this._b2._angVelZ = av2Z; } solveVelocity() { - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -49459,24 +31823,24 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; if(row.motorMaxImpulse == 0) { continue; } - var rv = 0; + let rv = 0; rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; - var oldImpulseM = imp.impulseM; + let impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; + let oldImpulseM = imp.impulseM; imp.impulseM += impulseM; if(imp.impulseM < -row.motorMaxImpulse) { imp.impulseM = -row.motorMaxImpulse; @@ -49501,43 +31865,43 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami av2Z += md.invMAng2Z * -impulseM; } } - var _g2 = 0; - var _g3 = this.info.numRows; + let _g2 = 0; + let _g3 = this.info.numRows; while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var j1 = row1.jacobian; - var rv1 = 0; - rv1 += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv1 -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv1 += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv1 -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulse = (row1.rhs - rv1 - imp1.impulse * row1.cfm) * md1.mass; - var oldImpulse = imp1.impulse; - imp1.impulse += impulse; - if(imp1.impulse < row1.minImpulse) { - imp1.impulse = row1.minImpulse; - } else if(imp1.impulse > row1.maxImpulse) { - imp1.impulse = row1.maxImpulse; - } - impulse = imp1.impulse - oldImpulse; - if((j1.flag & 1) != 0) { - lv1X += md1.invMLin1X * impulse; - lv1Y += md1.invMLin1Y * impulse; - lv1Z += md1.invMLin1Z * impulse; - lv2X += md1.invMLin2X * -impulse; - lv2Y += md1.invMLin2Y * -impulse; - lv2Z += md1.invMLin2Z * -impulse; - } - if((j1.flag & 2) != 0) { - av1X += md1.invMAng1X * impulse; - av1Y += md1.invMAng1Y * impulse; - av1Z += md1.invMAng1Z * impulse; - av2X += md1.invMAng2X * -impulse; - av2Y += md1.invMAng2Y * -impulse; - av2Z += md1.invMAng2Z * -impulse; + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulse = (row.rhs - rv - imp.impulse * row.cfm) * md.mass; + let oldImpulse = imp.impulse; + imp.impulse += impulse; + if(imp.impulse < row.minImpulse) { + imp.impulse = row.minImpulse; + } else if(imp.impulse > row.maxImpulse) { + imp.impulse = row.maxImpulse; + } + impulse = imp.impulse - oldImpulse; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * impulse; + lv1Y += md.invMLin1Y * impulse; + lv1Z += md.invMLin1Z * impulse; + lv2X += md.invMLin2X * -impulse; + lv2Y += md.invMLin2Y * -impulse; + lv2Z += md.invMLin2Z * -impulse; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * impulse; + av1Y += md.invMAng1Y * impulse; + av1Z += md.invMAng1Z * impulse; + av2X += md.invMAng2X * -impulse; + av2Y += md.invMAng2Y * -impulse; + av2Z += md.invMAng2Z * -impulse; } } this._b1._velX = lv1X; @@ -49554,27 +31918,24 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami this._b2._angVelZ = av2Z; } postSolveVelocity(timeStep) { - var lin; - var linX; - var linY; - var linZ; - var ang; - var angX; - var angY; - var angZ; + let linX; + let linY; + let linZ; + let angX; + let angY; + let angZ; linX = 0; linY = 0; linZ = 0; angX = 0; angY = 0; angZ = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var j = row.jacobian; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let j = row.jacobian; if((j.flag & 1) != 0) { linX += j.lin1X * imp.impulse; linY += j.lin1Y * imp.impulse; @@ -49597,28 +31958,26 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -49637,32 +31996,30 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; md.invMLin2X = j.lin2X * invM2; md.invMLin2Y = j.lin2Y * invM2; md.invMLin2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -49674,30 +32031,23 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami md.mass = 1 / md.mass; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - this.info.rows[i1].impulse.impulseP = 0; - } + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; } solvePositionSplitImpulse() { - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -49710,21 +32060,21 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; - var rv = 0; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseP = (row.rhs * oimo.common.Setting.positionSplitImpulseBaumgarte - rv) * md.mass; - var oldImpulseP = imp.impulseP; + let impulseP = (row.rhs * oimo.common.Setting.positionSplitImpulseBaumgarte - rv) * md.mass; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < row.minImpulse) { imp.impulseP = row.minImpulse; @@ -49763,28 +32113,26 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI1; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI2; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -49803,32 +32151,30 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; md.invMLin2X = j.lin2X * invM2; md.invMLin2Y = j.lin2Y * invM2; md.invMLin2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -49840,22 +32186,18 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami md.mass = 1 / md.mass; } } - var lv1; - var lv1X; - var lv1Y; - var lv1Z; - var lv2; - var lv2X; - var lv2Y; - var lv2Z; - var av1; - var av1X; - var av1Y; - var av1Z; - var av2; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -49868,88 +32210,85 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var j1 = row1.jacobian; - var rv = 0; - rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row1.rhs * oimo.common.Setting.positionNgsBaumgarte - rv) * md1.mass; - var oldImpulseP = imp1.impulseP; - imp1.impulseP += impulseP; - if(imp1.impulseP < row1.minImpulse) { - imp1.impulseP = row1.minImpulse; - } else if(imp1.impulseP > row1.maxImpulse) { - imp1.impulseP = row1.maxImpulse; - } - impulseP = imp1.impulseP - oldImpulseP; - lv1X += md1.invMLin1X * impulseP; - lv1Y += md1.invMLin1Y * impulseP; - lv1Z += md1.invMLin1Z * impulseP; - lv2X += md1.invMLin2X * -impulseP; - lv2Y += md1.invMLin2Y * -impulseP; - lv2Z += md1.invMLin2Z * -impulseP; - av1X += md1.invMAng1X * impulseP; - av1Y += md1.invMAng1Y * impulseP; - av1Z += md1.invMAng1Z * impulseP; - av2X += md1.invMAng2X * -impulseP; - av2Y += md1.invMAng2Y * -impulseP; - av2Z += md1.invMAng2Z * -impulseP; - } - var _this = this._b1; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseP = (row.rhs * oimo.common.Setting.positionNgsBaumgarte - rv) * md.mass; + let oldImpulseP = imp.impulseP; + imp.impulseP += impulseP; + if(imp.impulseP < row.minImpulse) { + imp.impulseP = row.minImpulse; + } else if(imp.impulseP > row.maxImpulse) { + imp.impulseP = row.maxImpulse; + } + impulseP = imp.impulseP - oldImpulseP; + lv1X += md.invMLin1X * impulseP; + lv1Y += md.invMLin1Y * impulseP; + lv1Z += md.invMLin1Z * impulseP; + lv2X += md.invMLin2X * -impulseP; + lv2Y += md.invMLin2Y * -impulseP; + lv2Z += md.invMLin2Z * -impulseP; + av1X += md.invMAng1X * impulseP; + av1Y += md.invMAng1Y * impulseP; + av1Z += md.invMAng1Z * impulseP; + av2X += md.invMAng2X * -impulseP; + av2Y += md.invMAng2Y * -impulseP; + av2Z += md.invMAng2Z * -impulseP; + } + let _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; + let _this1 = this._b2; _this1._transform._positionX += lv2X; _this1._transform._positionY += lv2Y; _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this2 = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + let ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dq; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this2._transform._rotation00; + let e11 = _this2._transform._rotation11; + let e22 = _this2._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -49992,7 +32331,7 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -50000,22 +32339,22 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this2._transform._rotation00 = 1 - yy - zz; _this2._transform._rotation01 = xy - wz; _this2._transform._rotation02 = xz + wy; @@ -50025,15 +32364,15 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami _this2._transform._rotation20 = xz - wy; _this2._transform._rotation21 = yz + wx; _this2._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; @@ -50052,15 +32391,15 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami _this2._invInertia20 = __tmp__20; _this2._invInertia21 = __tmp__21; _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; @@ -50088,45 +32427,42 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami _this2._invInertia20 *= _this2._rotFactor.z; _this2._invInertia21 *= _this2._rotFactor.z; _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let _this3 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.166666666666666657 + ht21 * ht21 * 0.00833333333333333322); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.0416666666666666644; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxis1; - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dq1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var q1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this3._transform._rotation00; + let e111 = _this3._transform._rotation11; + let e221 = _this3._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; @@ -50169,7 +32505,7 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -50177,22 +32513,22 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; _this3._transform._rotation00 = 1 - yy1 - zz1; _this3._transform._rotation01 = xy1 - wz1; _this3._transform._rotation02 = xz1 + wy1; @@ -50202,15 +32538,15 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami _this3._transform._rotation20 = xz1 - wy1; _this3._transform._rotation21 = yz1 + wx1; _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; @@ -50229,15 +32565,15 @@ oimo.dynamics.constraint.solver.pgs.PgsJointConstraintSolver = class oimo_dynami _this3._invInertia20 = __tmp__202; _this3._invInertia21 = __tmp__212; _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; @@ -50291,11 +32627,11 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._jointLinkList = null; this._jointLinkListLast = null; this._numJointLinks = 0; - var v = config.linearVelocity; + let v = config.linearVelocity; this._velX = v.x; this._velY = v.y; this._velZ = v.z; - var v1 = config.angularVelocity; + let v1 = config.angularVelocity; this._angVelX = v1.x; this._angVelY = v1.y; this._angVelZ = v1.z; @@ -50307,11 +32643,11 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._angPseudoVelZ = 0; this._ptransform = new oimo.common.Transform(); this._transform = new oimo.common.Transform(); - var v2 = config.position; + let v2 = config.position; this._ptransform._positionX = v2.x; this._ptransform._positionY = v2.y; this._ptransform._positionZ = v2.z; - var m = config.rotation; + let m = config.rotation; this._ptransform._rotation00 = m.e00; this._ptransform._rotation01 = m.e01; this._ptransform._rotation02 = m.e02; @@ -50321,8 +32657,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._ptransform._rotation20 = m.e20; this._ptransform._rotation21 = m.e21; this._ptransform._rotation22 = m.e22; - var dst = this._transform; - var src = this._ptransform; + let dst = this._transform; + let src = this._ptransform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -50413,27 +32749,25 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._angPseudoVelZ = 0; break; case 0:case 2: - var translation; - var translationX; - var translationY; - var translationZ; - var rotation; - var rotationX; - var rotationY; - var rotationZ; + let translationX; + let translationY; + let translationZ; + let rotationX; + let rotationY; + let rotationZ; translationX = this._velX * dt; translationY = this._velY * dt; translationZ = this._velZ * dt; rotationX = this._angVelX * dt; rotationY = this._angVelY * dt; rotationZ = this._angVelZ * dt; - var translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; - var rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; + let translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; + let rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; if(translationLengthSq == 0 && rotationLengthSq == 0) { return; } if(translationLengthSq > oimo.common.Setting.maxTranslationPerStep * oimo.common.Setting.maxTranslationPerStep) { - var l = oimo.common.Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); + let l = oimo.common.Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); this._velX *= l; this._velY *= l; this._velZ *= l; @@ -50442,55 +32776,52 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { translationZ *= l; } if(rotationLengthSq > oimo.common.Setting.maxRotationPerStep * oimo.common.Setting.maxRotationPerStep) { - var l1 = oimo.common.Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); - this._angVelX *= l1; - this._angVelY *= l1; - this._angVelZ *= l1; - rotationX *= l1; - rotationY *= l1; - rotationZ *= l1; + let l = oimo.common.Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); + this._angVelX *= l; + this._angVelY *= l; + this._angVelZ *= l; + rotationX *= l; + rotationY *= l; + rotationZ *= l; } this._transform._positionX += translationX; this._transform._positionY += translationY; this._transform._positionZ += translationZ; - var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + let ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dq; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; - var qX; - var qY; - var qZ; - var qW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -50533,30 +32864,30 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l2 = qX * qX + qY * qY + qZ * qZ + qW * qW; - if(l2 > 1e-32) { - l2 = 1 / Math.sqrt(l2); - } - qX *= l2; - qY *= l2; - qZ *= l2; - qW *= l2; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -50566,15 +32897,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -50593,15 +32924,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -50633,9 +32964,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } } _integratePseudoVelocity() { - var pseudoVelLengthSq = this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ; - var angPseudoVelLengthSq = this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ; - if(pseudoVelLengthSq == 0 && angPseudoVelLengthSq == 0) { + if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { return; } switch(this._type) { @@ -50648,14 +32977,12 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._angPseudoVelZ = 0; break; case 0:case 2: - var translation; - var translationX; - var translationY; - var translationZ; - var rotation; - var rotationX; - var rotationY; - var rotationZ; + let translationX; + let translationY; + let translationZ; + let rotationX; + let rotationY; + let rotationZ; translationX = this._pseudoVelX; translationY = this._pseudoVelY; translationZ = this._pseudoVelZ; @@ -50671,44 +32998,41 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._positionX += translationX; this._transform._positionY += translationY; this._transform._positionZ += translationZ; - var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.166666666666666657 + ht2 * ht2 * 0.00833333333333333322); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.0416666666666666644; + let ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxis; - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dq; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var q; - var qX; - var qY; - var qZ; - var qW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -50751,7 +33075,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -50759,22 +33083,22 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -50784,15 +33108,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -50811,15 +33135,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -50851,16 +33175,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } } updateMass() { - var totalInertia; - var totalInertia00; - var totalInertia01; - var totalInertia02; - var totalInertia10; - var totalInertia11; - var totalInertia12; - var totalInertia20; - var totalInertia21; - var totalInertia22; + let totalInertia00; + let totalInertia01; + let totalInertia02; + let totalInertia10; + let totalInertia11; + let totalInertia12; + let totalInertia20; + let totalInertia21; + let totalInertia22; totalInertia00 = 0; totalInertia01 = 0; totalInertia02 = 0; @@ -50870,32 +33193,31 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { totalInertia20 = 0; totalInertia21 = 0; totalInertia22 = 0; - var totalMass = 0; - var s = this._shapeList; + let totalMass = 0; + let s = this._shapeList; while(s != null) { - var n = s._next; - var g = s._geom; + let n = s._next; + let g = s._geom; g._updateMass(); - var mass = s._density * g._volume; - var inertia; - var inertia00; - var inertia01; - var inertia02; - var inertia10; - var inertia11; - var inertia12; - var inertia20; - var inertia21; - var inertia22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let mass = s._density * g._volume; + let inertia00; + let inertia01; + let inertia02; + let inertia10; + let inertia11; + let inertia12; + let inertia20; + let inertia21; + let inertia22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = s._localTransform._rotation00 * g._inertiaCoeff00 + s._localTransform._rotation01 * g._inertiaCoeff10 + s._localTransform._rotation02 * g._inertiaCoeff20; __tmp__01 = s._localTransform._rotation00 * g._inertiaCoeff01 + s._localTransform._rotation01 * g._inertiaCoeff11 + s._localTransform._rotation02 * g._inertiaCoeff21; __tmp__02 = s._localTransform._rotation00 * g._inertiaCoeff02 + s._localTransform._rotation01 * g._inertiaCoeff12 + s._localTransform._rotation02 * g._inertiaCoeff22; @@ -50914,15 +33236,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { inertia20 = __tmp__20; inertia21 = __tmp__21; inertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = inertia00 * s._localTransform._rotation00 + inertia01 * s._localTransform._rotation01 + inertia02 * s._localTransform._rotation02; __tmp__011 = inertia00 * s._localTransform._rotation10 + inertia01 * s._localTransform._rotation11 + inertia02 * s._localTransform._rotation12; __tmp__021 = inertia00 * s._localTransform._rotation20 + inertia01 * s._localTransform._rotation21 + inertia02 * s._localTransform._rotation22; @@ -50950,22 +33272,21 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { inertia20 *= mass; inertia21 *= mass; inertia22 *= mass; - var cogInertia; - var cogInertia00; - var cogInertia01; - var cogInertia02; - var cogInertia10; - var cogInertia11; - var cogInertia12; - var cogInertia20; - var cogInertia21; - var cogInertia22; - var xx = s._localTransform._positionX * s._localTransform._positionX; - var yy = s._localTransform._positionY * s._localTransform._positionY; - var zz = s._localTransform._positionZ * s._localTransform._positionZ; - var xy = -s._localTransform._positionX * s._localTransform._positionY; - var yz = -s._localTransform._positionY * s._localTransform._positionZ; - var zx = -s._localTransform._positionZ * s._localTransform._positionX; + let cogInertia00; + let cogInertia01; + let cogInertia02; + let cogInertia10; + let cogInertia11; + let cogInertia12; + let cogInertia20; + let cogInertia21; + let cogInertia22; + let xx = s._localTransform._positionX * s._localTransform._positionX; + let yy = s._localTransform._positionY * s._localTransform._positionY; + let zz = s._localTransform._positionZ * s._localTransform._positionZ; + let xy = -s._localTransform._positionX * s._localTransform._positionY; + let yz = -s._localTransform._positionY * s._localTransform._positionZ; + let zx = -s._localTransform._positionZ * s._localTransform._positionX; cogInertia00 = yy + zz; cogInertia01 = xy; cogInertia02 = zx; @@ -51006,34 +33327,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._localInertia20 = totalInertia20; this._localInertia21 = totalInertia21; this._localInertia22 = totalInertia22; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; - if(this._mass > 0 && det > 0 && this._type == 0) { + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; - var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; - var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; - var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; - var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; - var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; - var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + let d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + let d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + let d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + let d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } - this._invLocalInertia00 = d001 * d; - this._invLocalInertia01 = -d10 * d; - this._invLocalInertia02 = d20 * d; - this._invLocalInertia10 = -d011 * d; - this._invLocalInertia11 = d11 * d; - this._invLocalInertia12 = -d21 * d; - this._invLocalInertia20 = d021 * d; - this._invLocalInertia21 = -d12 * d; - this._invLocalInertia22 = d22 * d; + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; @@ -51076,60 +33387,60 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._type = 1; } } - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__012 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__022 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__102 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__112 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__122 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__202 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__212 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__222 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; - this._invInertia00 = __tmp__002; - this._invInertia01 = __tmp__012; - this._invInertia02 = __tmp__022; - this._invInertia10 = __tmp__102; - this._invInertia11 = __tmp__112; - this._invInertia12 = __tmp__122; - this._invInertia20 = __tmp__202; - this._invInertia21 = __tmp__212; - this._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__013 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__023 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__103 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__113 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__123 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__203 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__213 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__223 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__003; - this._invInertia01 = __tmp__013; - this._invInertia02 = __tmp__023; - this._invInertia10 = __tmp__103; - this._invInertia11 = __tmp__113; - this._invInertia12 = __tmp__123; - this._invInertia20 = __tmp__203; - this._invInertia21 = __tmp__213; - this._invInertia22 = __tmp__223; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -51143,26 +33454,23 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getPosition() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._transform._positionX; - v1.y = this._transform._positionY; - v1.z = this._transform._positionZ; - return v; - } - getPositionTo(position) { - var v = position; + let v = new oimo.common.Vec3(); v.x = this._transform._positionX; v.y = this._transform._positionY; v.z = this._transform._positionZ; + return v; + } + getPositionTo(position) { + position.x = this._transform._positionX; + position.y = this._transform._positionY; + position.z = this._transform._positionZ; } setPosition(position) { - var v = position; - this._transform._positionX = v.x; - this._transform._positionY = v.y; - this._transform._positionZ = v.z; - var dst = this._ptransform; - var src = this._transform; + this._transform._positionX = position.x; + this._transform._positionY = position.y; + this._transform._positionZ = position.z; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -51175,101 +33483,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -51285,17 +33591,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + let v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -51304,19 +33609,17 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } translate(translation) { - var diff; - var diffX; - var diffY; - var diffZ; - var v = translation; - diffX = v.x; - diffY = v.y; - diffZ = v.z; + let diffX; + let diffY; + let diffZ; + diffX = translation.x; + diffY = translation.y; + diffZ = translation.z; this._transform._positionX += diffX; this._transform._positionY += diffY; this._transform._positionZ += diffZ; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -51329,101 +33632,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -51439,17 +33740,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + let v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -51458,21 +33758,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getRotation() { - var m = new oimo.common.Mat3(); - var m1 = m; - m1.e00 = this._transform._rotation00; - m1.e01 = this._transform._rotation01; - m1.e02 = this._transform._rotation02; - m1.e10 = this._transform._rotation10; - m1.e11 = this._transform._rotation11; - m1.e12 = this._transform._rotation12; - m1.e20 = this._transform._rotation20; - m1.e21 = this._transform._rotation21; - m1.e22 = this._transform._rotation22; - return m; - } - getRotationTo(rotation) { - var m = rotation; + let m = new oimo.common.Mat3(); m.e00 = this._transform._rotation00; m.e01 = this._transform._rotation01; m.e02 = this._transform._rotation02; @@ -51482,27 +33768,38 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { m.e20 = this._transform._rotation20; m.e21 = this._transform._rotation21; m.e22 = this._transform._rotation22; + return m; + } + getRotationTo(rotation) { + rotation.e00 = this._transform._rotation00; + rotation.e01 = this._transform._rotation01; + rotation.e02 = this._transform._rotation02; + rotation.e10 = this._transform._rotation10; + rotation.e11 = this._transform._rotation11; + rotation.e12 = this._transform._rotation12; + rotation.e20 = this._transform._rotation20; + rotation.e21 = this._transform._rotation21; + rotation.e22 = this._transform._rotation22; } setRotation(rotation) { - var m = rotation; - this._transform._rotation00 = m.e00; - this._transform._rotation01 = m.e01; - this._transform._rotation02 = m.e02; - this._transform._rotation10 = m.e10; - this._transform._rotation11 = m.e11; - this._transform._rotation12 = m.e12; - this._transform._rotation20 = m.e20; - this._transform._rotation21 = m.e21; - this._transform._rotation22 = m.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + this._transform._rotation00 = rotation.e00; + this._transform._rotation01 = rotation.e01; + this._transform._rotation02 = rotation.e02; + this._transform._rotation10 = rotation.e10; + this._transform._rotation11 = rotation.e11; + this._transform._rotation12 = rotation.e12; + this._transform._rotation20 = rotation.e20; + this._transform._rotation21 = rotation.e21; + this._transform._rotation22 = rotation.e22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -51521,15 +33818,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -51557,8 +33854,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -51571,101 +33868,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -51681,14 +33976,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -51700,20 +33994,18 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } setRotationXyz(eulerAngles) { - var xyz; - var xyzX; - var xyzY; - var xyzZ; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let xyzX; + let xyzY; + let xyzZ; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); this._transform._rotation00 = cy * cz; this._transform._rotation01 = -cy * sz; this._transform._rotation02 = sy; @@ -51723,15 +34015,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = sx * sz - cx * cz * sy; this._transform._rotation21 = cz * sx + cx * sy * sz; this._transform._rotation22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -51750,15 +34042,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -51786,8 +34078,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -51800,101 +34092,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -51910,17 +34200,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + let v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -51929,35 +34218,33 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } rotate(rotation) { - var rot; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; - var m = rotation; - rot00 = m.e00; - rot01 = m.e01; - rot02 = m.e02; - rot10 = m.e10; - rot11 = m.e11; - rot12 = m.e12; - rot20 = m.e20; - rot21 = m.e21; - rot22 = m.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; + rot00 = rotation.e00; + rot01 = rotation.e01; + rot02 = rotation.e02; + rot10 = rotation.e10; + rot11 = rotation.e11; + rot12 = rotation.e12; + rot20 = rotation.e20; + rot21 = rotation.e21; + rot22 = rotation.e22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; @@ -51976,15 +34263,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -52003,15 +34290,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__201; this._invInertia21 = __tmp__211; this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -52039,8 +34326,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -52053,101 +34340,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -52163,14 +34448,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -52182,30 +34466,27 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } rotateXyz(eulerAngles) { - var xyz; - var xyzX; - var xyzY; - var xyzZ; - var rot; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; - var v = eulerAngles; - xyzX = v.x; - xyzY = v.y; - xyzZ = v.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let xyzX; + let xyzY; + let xyzZ; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; + xyzX = eulerAngles.x; + xyzY = eulerAngles.y; + xyzZ = eulerAngles.z; + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); rot00 = cy * cz; rot01 = -cy * sz; rot02 = sy; @@ -52215,15 +34496,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { rot20 = sx * sz - cx * cz * sy; rot21 = cz * sx + cx * sy * sz; rot22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; @@ -52242,15 +34523,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -52269,15 +34550,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__201; this._invInertia21 = __tmp__211; this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -52305,8 +34586,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -52319,101 +34600,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__013 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__023 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__103 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__113 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__123 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__203 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__213 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__223 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__014 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__024 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__104 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__114 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__124 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__204 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__214 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__224 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -52429,17 +34708,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v1 = s.displacement; - v1.x = dX; - v1.y = dY; - v1.z = dZ; + let v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } s = n; @@ -52448,17 +34726,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getOrientation() { - var q = new oimo.common.Quat(); - var iq; - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let q = new oimo.common.Quat(); + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -52497,24 +34774,22 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { iqY = (this._transform._rotation12 + this._transform._rotation21) * s; iqW = (this._transform._rotation10 - this._transform._rotation01) * s; } - var q1 = q; - q1.x = iqX; - q1.y = iqY; - q1.z = iqZ; - q1.w = iqW; + q.x = iqX; + q.y = iqY; + q.z = iqZ; + q.w = iqW; return q; } getOrientationTo(orientation) { - var iq; - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -52553,39 +34828,36 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { iqY = (this._transform._rotation12 + this._transform._rotation21) * s; iqW = (this._transform._rotation10 - this._transform._rotation01) * s; } - var q = orientation; - q.x = iqX; - q.y = iqY; - q.z = iqZ; - q.w = iqW; + orientation.x = iqX; + orientation.y = iqY; + orientation.z = iqZ; + orientation.w = iqW; } setOrientation(quaternion) { - var q; - var qX; - var qY; - var qZ; - var qW; - var q1 = quaternion; - qX = q1.x; - qY = q1.y; - qZ = q1.z; - qW = q1.w; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let qX; + let qY; + let qZ; + let qW; + qX = quaternion.x; + qY = quaternion.y; + qZ = quaternion.z; + qW = quaternion.w; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -52595,15 +34867,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -52622,15 +34894,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -52658,8 +34930,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -52672,101 +34944,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -52782,14 +35052,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -52801,8 +35070,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getTransform() { - var _this = this._transform; - var tf = new oimo.common.Transform(); + let _this = this._transform; + let tf = new oimo.common.Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -52818,7 +35087,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { return tf; } getTransformTo(transform) { - var transform1 = this._transform; + let transform1 = this._transform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -52845,15 +35114,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._transform._rotation20 = transform._rotation20; this._transform._rotation21 = transform._rotation21; this._transform._rotation22 = transform._rotation22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -52872,15 +35141,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -52908,8 +35177,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -52922,101 +35191,99 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__012 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__022 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__102 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__112 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__122 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__202 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__212 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__222 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += src2._positionX; - dst1._positionY += src2._positionY; - dst1._positionZ += src2._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__013 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__023 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__103 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__113 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__123 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__203 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__213 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__223 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += src21._positionX; - dst2._positionY += src21._positionY; - dst2._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -53032,14 +35299,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -53054,21 +35320,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { return this._mass; } getLocalInertia() { - var m = new oimo.common.Mat3(); - var m1 = m; - m1.e00 = this._localInertia00; - m1.e01 = this._localInertia01; - m1.e02 = this._localInertia02; - m1.e10 = this._localInertia10; - m1.e11 = this._localInertia11; - m1.e12 = this._localInertia12; - m1.e20 = this._localInertia20; - m1.e21 = this._localInertia21; - m1.e22 = this._localInertia22; - return m; - } - getLocalInertiaTo(inertia) { - var m = inertia; + let m = new oimo.common.Mat3(); m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -53078,11 +35330,23 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { m.e20 = this._localInertia20; m.e21 = this._localInertia21; m.e22 = this._localInertia22; + return m; + } + getLocalInertiaTo(inertia) { + inertia.e00 = this._localInertia00; + inertia.e01 = this._localInertia01; + inertia.e02 = this._localInertia02; + inertia.e10 = this._localInertia10; + inertia.e11 = this._localInertia11; + inertia.e12 = this._localInertia12; + inertia.e20 = this._localInertia20; + inertia.e21 = this._localInertia21; + inertia.e22 = this._localInertia22; } getMassData() { - var md = new oimo.dynamics.rigidbody.MassData(); + let md = new oimo.dynamics.rigidbody.MassData(); md.mass = this._mass; - var m = md.localInertia; + let m = md.localInertia; m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -53096,7 +35360,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } getMassDataTo(massData) { massData.mass = this._mass; - var m = massData.localInertia; + let m = massData.localInertia; m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -53109,7 +35373,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } setMassData(massData) { this._mass = massData.mass; - var m = massData.localInertia; + let m = massData.localInertia; this._localInertia00 = m.e00; this._localInertia01 = m.e01; this._localInertia02 = m.e02; @@ -53119,34 +35383,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._localInertia20 = m.e20; this._localInertia21 = m.e21; this._localInertia22 = m.e22; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var det = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; - if(this._mass > 0 && det > 0 && this._type == 0) { + if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d001 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d011 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d021 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d10 = this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21; - var d11 = this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20; - var d12 = this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20; - var d20 = this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11; - var d21 = this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10; - var d22 = this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10; - var d = this._localInertia00 * d001 - this._localInertia01 * d011 + this._localInertia02 * d021; + let d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + let d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + let d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + let d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } - this._invLocalInertia00 = d001 * d; - this._invLocalInertia01 = -d10 * d; - this._invLocalInertia02 = d20 * d; - this._invLocalInertia10 = -d011 * d; - this._invLocalInertia11 = d11 * d; - this._invLocalInertia12 = -d21 * d; - this._invLocalInertia20 = d021 * d; - this._invLocalInertia21 = -d12 * d; - this._invLocalInertia22 = d22 * d; + this._invLocalInertia00 = d00 * d; + this._invLocalInertia01 = -(this._localInertia01 * this._localInertia22 - this._localInertia02 * this._localInertia21) * d; + this._invLocalInertia02 = (this._localInertia01 * this._localInertia12 - this._localInertia02 * this._localInertia11) * d; + this._invLocalInertia10 = -d01 * d; + this._invLocalInertia11 = (this._localInertia00 * this._localInertia22 - this._localInertia02 * this._localInertia20) * d; + this._invLocalInertia12 = -(this._localInertia00 * this._localInertia12 - this._localInertia02 * this._localInertia10) * d; + this._invLocalInertia20 = d02 * d; + this._invLocalInertia21 = -(this._localInertia00 * this._localInertia21 - this._localInertia01 * this._localInertia20) * d; + this._invLocalInertia22 = (this._localInertia00 * this._localInertia11 - this._localInertia01 * this._localInertia10) * d; this._invLocalInertiaWithoutRotFactor00 = this._invLocalInertia00; this._invLocalInertiaWithoutRotFactor01 = this._invLocalInertia01; this._invLocalInertiaWithoutRotFactor02 = this._invLocalInertia02; @@ -53189,15 +35443,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._type = 1; } } - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -53216,15 +35470,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -53256,23 +35510,23 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getRotationFactor() { - var _this = this._rotFactor; + let _this = this._rotFactor; return new oimo.common.Vec3(_this.x,_this.y,_this.z); } setRotationFactor(rotationFactor) { - var _this = this._rotFactor; + let _this = this._rotFactor; _this.x = rotationFactor.x; _this.y = rotationFactor.y; _this.z = rotationFactor.z; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -53291,15 +35545,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -53331,18 +35585,16 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getLinearVelocity() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._velX; - v1.y = this._velY; - v1.z = this._velZ; - return v; - } - getLinearVelocityTo(linearVelocity) { - var v = linearVelocity; + let v = new oimo.common.Vec3(); v.x = this._velX; v.y = this._velY; v.z = this._velZ; + return v; + } + getLinearVelocityTo(linearVelocity) { + linearVelocity.x = this._velX; + linearVelocity.y = this._velY; + linearVelocity.z = this._velZ; } setLinearVelocity(linearVelocity) { if(this._type == 1) { @@ -53350,27 +35602,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._velY = 0; this._velZ = 0; } else { - var v = linearVelocity; - this._velX = v.x; - this._velY = v.y; - this._velZ = v.z; + this._velX = linearVelocity.x; + this._velY = linearVelocity.y; + this._velZ = linearVelocity.z; } this._sleeping = false; this._sleepTime = 0; } getAngularVelocity() { - var v = new oimo.common.Vec3(); - var v1 = v; - v1.x = this._angVelX; - v1.y = this._angVelY; - v1.z = this._angVelZ; + let v = new oimo.common.Vec3(); + v.x = this._angVelX; + v.y = this._angVelY; + v.z = this._angVelZ; return v; } getAngularVelocityTo(angularVelocity) { - var v = angularVelocity; - v.x = this._velX; - v.y = this._velY; - v.z = this._velZ; + angularVelocity.x = this._velX; + angularVelocity.y = this._velY; + angularVelocity.z = this._velZ; } setAngularVelocity(angularVelocity) { if(this._type == 1) { @@ -53378,24 +35627,21 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._angVelY = 0; this._angVelZ = 0; } else { - var v = angularVelocity; - this._angVelX = v.x; - this._angVelY = v.y; - this._angVelZ = v.z; + this._angVelX = angularVelocity.x; + this._angVelY = angularVelocity.y; + this._angVelZ = angularVelocity.z; } this._sleeping = false; this._sleepTime = 0; } addLinearVelocity(linearVelocityChange) { if(this._type != 1) { - var d; - var dX; - var dY; - var dZ; - var v = linearVelocityChange; - dX = v.x; - dY = v.y; - dZ = v.z; + let dX; + let dY; + let dZ; + dX = linearVelocityChange.x; + dY = linearVelocityChange.y; + dZ = linearVelocityChange.z; this._velX += dX; this._velY += dY; this._velZ += dZ; @@ -53405,14 +35651,12 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } addAngularVelocity(angularVelocityChange) { if(this._type != 1) { - var d; - var dX; - var dY; - var dZ; - var v = angularVelocityChange; - dX = v.x; - dY = v.y; - dZ = v.z; + let dX; + let dY; + let dZ; + dX = angularVelocityChange.x; + dY = angularVelocityChange.y; + dZ = angularVelocityChange.z; this._angVelX += dX; this._angVelY += dY; this._angVelZ += dZ; @@ -53421,38 +35665,33 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyImpulse(impulse,positionInWorld) { - var imp; - var impX; - var impY; - var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; + let impX; + let impY; + let impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; this._velX += impX * this._invMass; this._velY += impY * this._invMass; this._velZ += impZ * this._invMass; - var aimp; - var aimpX; - var aimpY; - var aimpZ; - var pos; - var posX; - var posY; - var posZ; - var v1 = positionInWorld; - posX = v1.x; - posY = v1.y; - posZ = v1.z; + let aimpX; + let aimpY; + let aimpZ; + let posX; + let posY; + let posZ; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; posX -= this._transform._positionX; posY -= this._transform._positionY; posZ -= this._transform._positionZ; aimpX = posY * impZ - posZ * impY; aimpY = posZ * impX - posX * impZ; aimpZ = posX * impY - posY * impX; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._invInertia00 * aimpX + this._invInertia01 * aimpY + this._invInertia02 * aimpZ; __tmp__Y = this._invInertia10 * aimpX + this._invInertia11 * aimpY + this._invInertia12 * aimpZ; __tmp__Z = this._invInertia20 * aimpX + this._invInertia21 * aimpY + this._invInertia22 * aimpZ; @@ -53466,14 +35705,12 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyLinearImpulse(impulse) { - var imp; - var impX; - var impY; - var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; + let impX; + let impY; + let impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; this._velX += impX * this._invMass; this._velY += impY * this._invMass; this._velZ += impZ * this._invMass; @@ -53481,17 +35718,15 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyAngularImpulse(impulse) { - var imp; - var impX; - var impY; - var impZ; - var v = impulse; - impX = v.x; - impY = v.y; - impZ = v.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let impX; + let impY; + let impZ; + impX = impulse.x; + impY = impulse.y; + impZ = impulse.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._invInertia00 * impX + this._invInertia01 * impY + this._invInertia02 * impZ; __tmp__Y = this._invInertia10 * impX + this._invInertia11 * impY + this._invInertia12 * impZ; __tmp__Z = this._invInertia20 * impX + this._invInertia21 * impY + this._invInertia22 * impZ; @@ -53505,29 +35740,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyForce(force,positionInWorld) { - var iforce; - var iforceX; - var iforceY; - var iforceZ; - var v = force; - iforceX = v.x; - iforceY = v.y; - iforceZ = v.z; + let iforceX; + let iforceY; + let iforceZ; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; this._forceX += iforceX; this._forceY += iforceY; this._forceZ += iforceZ; - var itorque; - var itorqueX; - var itorqueY; - var itorqueZ; - var pos; - var posX; - var posY; - var posZ; - var v1 = positionInWorld; - posX = v1.x; - posY = v1.y; - posZ = v1.z; + let itorqueX; + let itorqueY; + let itorqueZ; + let posX; + let posY; + let posZ; + posX = positionInWorld.x; + posY = positionInWorld.y; + posZ = positionInWorld.z; posX -= this._transform._positionX; posY -= this._transform._positionY; posZ -= this._transform._positionZ; @@ -53541,14 +35771,12 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyForceToCenter(force) { - var iforce; - var iforceX; - var iforceY; - var iforceZ; - var v = force; - iforceX = v.x; - iforceY = v.y; - iforceZ = v.z; + let iforceX; + let iforceY; + let iforceZ; + iforceX = force.x; + iforceY = force.y; + iforceZ = force.z; this._forceX += iforceX; this._forceY += iforceY; this._forceZ += iforceZ; @@ -53556,14 +35784,12 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } applyTorque(torque) { - var itorque; - var itorqueX; - var itorqueY; - var itorqueZ; - var v = torque; - itorqueX = v.x; - itorqueY = v.y; - itorqueZ = v.z; + let itorqueX; + let itorqueY; + let itorqueZ; + itorqueX = torque.x; + itorqueY = torque.y; + itorqueZ = torque.z; this._torqueX += itorqueX; this._torqueY += itorqueY; this._torqueZ += itorqueZ; @@ -53571,32 +35797,28 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getLinearContactImpulse() { - var res = new oimo.common.Vec3(); - var v = res; - v.x = this._linearContactImpulseX; - v.y = this._linearContactImpulseY; - v.z = this._linearContactImpulseZ; + let res = new oimo.common.Vec3(); + res.x = this._linearContactImpulseX; + res.y = this._linearContactImpulseY; + res.z = this._linearContactImpulseZ; return res; } getLinearContactImpulseTo(linearContactImpulse) { - var v = linearContactImpulse; - v.x = this._linearContactImpulseX; - v.y = this._linearContactImpulseY; - v.z = this._linearContactImpulseZ; + linearContactImpulse.x = this._linearContactImpulseX; + linearContactImpulse.y = this._linearContactImpulseY; + linearContactImpulse.z = this._linearContactImpulseZ; } getAngularContactImpulse() { - var res = new oimo.common.Vec3(); - var v = res; - v.x = this._angularContactImpulseX; - v.y = this._angularContactImpulseY; - v.z = this._angularContactImpulseZ; + let res = new oimo.common.Vec3(); + res.x = this._angularContactImpulseX; + res.y = this._angularContactImpulseY; + res.z = this._angularContactImpulseZ; return res; } getAngularContactImpulseTo(angularContactImpulse) { - var v = angularContactImpulse; - v.x = this._angularContactImpulseX; - v.y = this._angularContactImpulseY; - v.z = this._angularContactImpulseZ; + angularContactImpulse.x = this._angularContactImpulseX; + angularContactImpulse.y = this._angularContactImpulseY; + angularContactImpulse.z = this._angularContactImpulseZ; } getGravityScale() { return this._gravityScale; @@ -53607,119 +35829,105 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._sleepTime = 0; } getLocalPoint(worldPoint) { - var v; - var vX; - var vY; - var vZ; - var v1 = worldPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + let vX; + let vY; + let vZ; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo.common.Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + let res = new oimo.common.Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; return res; } getLocalPointTo(worldPoint,localPoint) { - var v; - var vX; - var vY; - var vZ; - var v1 = worldPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; + let vX; + let vY; + let vZ; + vX = worldPoint.x; + vY = worldPoint.y; + vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = localPoint; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; } getLocalVector(worldVector) { - var v; - var vX; - var vY; - var vZ; - var v1 = worldVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo.common.Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + let res = new oimo.common.Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; return res; } getLocalVectorTo(worldVector,localVector) { - var v; - var vX; - var vY; - var vZ; - var v1 = worldVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = worldVector.x; + vY = worldVector.y; + vZ = worldVector.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = localVector; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; } getWorldPoint(localPoint) { - var v; - var vX; - var vY; - var vZ; - var v1 = localPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; @@ -53729,25 +35937,22 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { vX += this._transform._positionX; vY += this._transform._positionY; vZ += this._transform._positionZ; - var res = new oimo.common.Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + let res = new oimo.common.Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; return res; } getWorldPointTo(localPoint,worldPoint) { - var v; - var vX; - var vY; - var vZ; - var v1 = localPoint; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = localPoint.x; + vY = localPoint.y; + vZ = localPoint.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; @@ -53757,58 +35962,51 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { vX += this._transform._positionX; vY += this._transform._positionY; vZ += this._transform._positionZ; - var v2 = worldPoint; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + worldPoint.x = vX; + worldPoint.y = vY; + worldPoint.z = vZ; } getWorldVector(localVector) { - var v; - var vX; - var vY; - var vZ; - var v1 = localVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo.common.Vec3(); - var v2 = res; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + let res = new oimo.common.Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; return res; } getWorldVectorTo(localVector,worldVector) { - var v; - var vX; - var vY; - var vZ; - var v1 = localVector; - vX = v1.x; - vY = v1.y; - vZ = v1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let vX; + let vY; + let vZ; + vX = localVector.x; + vY = localVector.y; + vZ = localVector.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var v2 = worldVector; - v2.x = vX; - v2.y = vY; - v2.z = vZ; + worldVector.x = vX; + worldVector.y = vY; + worldVector.z = vZ; } getNumShapes() { return this._numShapes; @@ -53840,36 +36038,37 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._numShapes++; shape._rigidBody = this; if(this._world != null) { - var _this = this._world; + let _this = this._world; shape._proxy = _this._broadPhase.createProxy(shape,shape._aabb); shape._id = _this._shapeIdCount++; _this._numShapes++; } this.updateMass(); - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var dst = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -53879,39 +36078,38 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -53921,26 +36119,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -53956,14 +36152,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -53973,8 +36168,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } } removeShape(shape) { - var prev = shape._prev; - var next = shape._next; + let prev = shape._prev; + let next = shape._next; if(prev != null) { prev._next = next; } @@ -53992,26 +36187,26 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { this._numShapes--; shape._rigidBody = null; if(this._world != null) { - var _this = this._world; + let _this = this._world; _this._broadPhase.destroyProxy(shape._proxy); shape._proxy = null; shape._id = -1; - var cl = shape._rigidBody._contactLinkList; + let cl = shape._rigidBody._contactLinkList; while(cl != null) { - var n = cl._next; - var c = cl._contact; + let n = cl._next; + let c = cl._contact; if(c._s1 == shape || c._s2 == shape) { - var _this1 = cl._other; + let _this1 = cl._other; _this1._sleeping = false; _this1._sleepTime = 0; - var _this2 = _this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + let _this2 = _this._contactManager; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this2._contactList) { _this2._contactList = _this2._contactList._next; @@ -54022,8 +36217,8 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { c._next = null; c._prev = null; if(c._touching) { - var cc1 = c._s1._contactCallback; - var cc2 = c._s2._contactCallback; + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; if(cc1 == cc2) { cc2 = null; } @@ -54034,13 +36229,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { cc2.endContact(c); } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -54050,13 +36245,13 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -54080,7 +36275,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this3 = c._contactConstraint; + let _this3 = c._contactConstraint; _this3._s1 = null; _this3._s2 = null; _this3._b1 = null; @@ -54096,30 +36291,31 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { _this._numShapes--; } this.updateMass(); - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n1 = s._next; - var dst = s._ptransform; - var src1 = s._localTransform; - var src2 = this._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -54129,39 +36325,38 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var src21 = this._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -54171,26 +36366,24 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -54206,20 +36399,19 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s = n1; + s = n; } } getType() { @@ -54287,11 +36479,11 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { this._localTransform = new oimo.common.Transform(); this._ptransform = new oimo.common.Transform(); this._transform = new oimo.common.Transform(); - var v = config.position; + let v = config.position; this._localTransform._positionX = v.x; this._localTransform._positionY = v.y; this._localTransform._positionZ = v.z; - var m = config.rotation; + let m = config.rotation; this._localTransform._rotation00 = m.e00; this._localTransform._rotation01 = m.e01; this._localTransform._rotation02 = m.e02; @@ -54301,8 +36493,8 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { this._localTransform._rotation20 = m.e20; this._localTransform._rotation21 = m.e21; this._localTransform._rotation22 = m.e22; - var dst = this._ptransform; - var src = this._localTransform; + let dst = this._ptransform; + let src = this._localTransform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -54315,8 +36507,8 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var dst1 = this._transform; - var src1 = this._localTransform; + let dst1 = this._transform; + let src1 = this._localTransform; dst1._positionX = src1._positionX; dst1._positionY = src1._positionY; dst1._positionZ = src1._positionZ; @@ -54353,8 +36545,8 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { this._restitution = restitution; } getLocalTransform() { - var _this = this._localTransform; - var tf = new oimo.common.Transform(); + let _this = this._localTransform; + let tf = new oimo.common.Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -54370,7 +36562,7 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { return tf; } getLocalTransformTo(transform) { - var transform1 = this._localTransform; + let transform1 = this._localTransform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -54385,8 +36577,8 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { transform._rotation22 = transform1._rotation22; } getTransform() { - var _this = this._transform; - var tf = new oimo.common.Transform(); + let _this = this._transform; + let tf = new oimo.common.Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -54402,7 +36594,7 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { return tf; } getTransformTo(transform) { - var transform1 = this._transform; + let transform1 = this._transform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -54417,7 +36609,7 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { transform._rotation22 = transform1._rotation22; } setLocalTransform(transform) { - var _this = this._localTransform; + let _this = this._localTransform; _this._positionX = transform._positionX; _this._positionY = transform._positionY; _this._positionZ = transform._positionZ; @@ -54431,32 +36623,33 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { _this._rotation21 = transform._rotation21; _this._rotation22 = transform._rotation22; if(this._rigidBody != null) { - var _this1 = this._rigidBody; - _this1.updateMass(); - var s = _this1._shapeList; + let _this = this._rigidBody; + _this.updateMass(); + let s = _this._shapeList; while(s != null) { - var n = s._next; - var dst = s._ptransform; - var src1 = s._localTransform; - var src2 = _this1._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + let n = s._next; + let tf1 = _this._ptransform; + let tf2 = _this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -54466,39 +36659,38 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var src21 = _this1._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -54508,26 +36700,24 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -54543,14 +36733,13 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -54566,32 +36755,33 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { setDensity(density) { this._density = density; if(this._rigidBody != null) { - var _this = this._rigidBody; + let _this = this._rigidBody; _this.updateMass(); - var s = _this._shapeList; + let s = _this._shapeList; while(s != null) { - var n = s._next; - var dst = s._ptransform; - var src1 = s._localTransform; - var src2 = _this._ptransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = src2._rotation00 * src1._rotation00 + src2._rotation01 * src1._rotation10 + src2._rotation02 * src1._rotation20; - __tmp__01 = src2._rotation00 * src1._rotation01 + src2._rotation01 * src1._rotation11 + src2._rotation02 * src1._rotation21; - __tmp__02 = src2._rotation00 * src1._rotation02 + src2._rotation01 * src1._rotation12 + src2._rotation02 * src1._rotation22; - __tmp__10 = src2._rotation10 * src1._rotation00 + src2._rotation11 * src1._rotation10 + src2._rotation12 * src1._rotation20; - __tmp__11 = src2._rotation10 * src1._rotation01 + src2._rotation11 * src1._rotation11 + src2._rotation12 * src1._rotation21; - __tmp__12 = src2._rotation10 * src1._rotation02 + src2._rotation11 * src1._rotation12 + src2._rotation12 * src1._rotation22; - __tmp__20 = src2._rotation20 * src1._rotation00 + src2._rotation21 * src1._rotation10 + src2._rotation22 * src1._rotation20; - __tmp__21 = src2._rotation20 * src1._rotation01 + src2._rotation21 * src1._rotation11 + src2._rotation22 * src1._rotation21; - __tmp__22 = src2._rotation20 * src1._rotation02 + src2._rotation21 * src1._rotation12 + src2._rotation22 * src1._rotation22; + let n = s._next; + let tf1 = _this._ptransform; + let tf2 = _this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; dst._rotation00 = __tmp__00; dst._rotation01 = __tmp__01; dst._rotation02 = __tmp__02; @@ -54601,39 +36791,38 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; - __tmp__X = src2._rotation00 * src1._positionX + src2._rotation01 * src1._positionY + src2._rotation02 * src1._positionZ; - __tmp__Y = src2._rotation10 * src1._positionX + src2._rotation11 * src1._positionY + src2._rotation12 * src1._positionZ; - __tmp__Z = src2._rotation20 * src1._positionX + src2._rotation21 * src1._positionY + src2._rotation22 * src1._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; dst._positionX = __tmp__X; dst._positionY = __tmp__Y; dst._positionZ = __tmp__Z; - dst._positionX += src2._positionX; - dst._positionY += src2._positionY; - dst._positionZ += src2._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var src21 = _this._transform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = src21._rotation00 * src11._rotation00 + src21._rotation01 * src11._rotation10 + src21._rotation02 * src11._rotation20; - __tmp__011 = src21._rotation00 * src11._rotation01 + src21._rotation01 * src11._rotation11 + src21._rotation02 * src11._rotation21; - __tmp__021 = src21._rotation00 * src11._rotation02 + src21._rotation01 * src11._rotation12 + src21._rotation02 * src11._rotation22; - __tmp__101 = src21._rotation10 * src11._rotation00 + src21._rotation11 * src11._rotation10 + src21._rotation12 * src11._rotation20; - __tmp__111 = src21._rotation10 * src11._rotation01 + src21._rotation11 * src11._rotation11 + src21._rotation12 * src11._rotation21; - __tmp__121 = src21._rotation10 * src11._rotation02 + src21._rotation11 * src11._rotation12 + src21._rotation12 * src11._rotation22; - __tmp__201 = src21._rotation20 * src11._rotation00 + src21._rotation21 * src11._rotation10 + src21._rotation22 * src11._rotation20; - __tmp__211 = src21._rotation20 * src11._rotation01 + src21._rotation21 * src11._rotation11 + src21._rotation22 * src11._rotation21; - __tmp__221 = src21._rotation20 * src11._rotation02 + src21._rotation21 * src11._rotation12 + src21._rotation22 * src11._rotation22; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; dst1._rotation00 = __tmp__001; dst1._rotation01 = __tmp__011; dst1._rotation02 = __tmp__021; @@ -54643,26 +36832,24 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = src21._rotation00 * src11._positionX + src21._rotation01 * src11._positionY + src21._rotation02 * src11._positionZ; - __tmp__Y1 = src21._rotation10 * src11._positionX + src21._rotation11 * src11._positionY + src21._rotation12 * src11._positionZ; - __tmp__Z1 = src21._rotation20 * src11._positionX + src21._rotation21 * src11._positionY + src21._rotation22 * src11._positionZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; dst1._positionX = __tmp__X1; dst1._positionY = __tmp__Y1; dst1._positionZ = __tmp__Z1; - dst1._positionX += src21._positionX; - dst1._positionY += src21._positionY; - dst1._positionZ += src21._positionZ; - var min; - var minX; - var minY; - var minZ; - var max; - var maxX; - var maxY; - var maxZ; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -54678,14 +36865,13 @@ oimo.dynamics.rigidbody.Shape = class oimo_dynamics_rigidbody_Shape { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var d; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -54748,6 +36934,11 @@ oimo.dynamics.rigidbody.ShapeConfig = class oimo_dynamics_rigidbody_ShapeConfig if(!oimo.m) oimo.m = {}; oimo.m.M = class oimo_m_M { } +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +{ +} oimo.collision.broadphase.BroadPhaseType._BRUTE_FORCE = 1; oimo.collision.broadphase.BroadPhaseType._BVH = 2; oimo.collision.broadphase.BroadPhaseType.BRUTE_FORCE = 1; @@ -54815,7 +37006,7 @@ oimo.common.Setting.sleepingAngularVelocityThreshold = 0.5; oimo.common.Setting.sleepingTimeThreshold = 1.0; oimo.common.Setting.disableSleeping = false; oimo.common.Setting.linearSlop = 0.005; -oimo.common.Setting.angularSlop = 0.0174532925199432781; +oimo.common.Setting.angularSlop = 0.017453292519943278; oimo.collision.narrowphase.detector.gjkepa.GjkEpa.instance = new oimo.collision.narrowphase.detector.gjkepa.GjkEpa(); oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._SUCCEEDED = 0; oimo.collision.narrowphase.detector.gjkepa.GjkEpaResultState._GJK_FAILED_TO_MAKE_TETRAHEDRON = 1; @@ -54836,8 +37027,8 @@ oimo.common.MathUtil.NEGATIVE_INFINITY = -1e65536; oimo.common.MathUtil.PI = 3.14159265358979; oimo.common.MathUtil.TWO_PI = 6.28318530717958; oimo.common.MathUtil.HALF_PI = 1.570796326794895; -oimo.common.MathUtil.TO_RADIANS = 0.0174532925199432781; -oimo.common.MathUtil.TO_DEGREES = 57.2957795130823797; +oimo.common.MathUtil.TO_RADIANS = 0.017453292519943278; +oimo.common.MathUtil.TO_DEGREES = 57.29577951308238; oimo.common.Quat.numCreations = 0; oimo.dynamics.common.DebugDraw.SPHERE_PHI_DIVISION = 8; oimo.dynamics.common.DebugDraw.SPHERE_THETA_DIVISION = 4; @@ -54878,4 +37069,4 @@ oimo.dynamics.rigidbody.RigidBodyType._KINEMATIC = 2; oimo.dynamics.rigidbody.RigidBodyType.DYNAMIC = 0; oimo.dynamics.rigidbody.RigidBodyType.STATIC = 1; oimo.dynamics.rigidbody.RigidBodyType.KINEMATIC = 2; -export {oimo}; \ No newline at end of file +export {oimo}; diff --git a/build-js-ts.hxml b/build-js-ts.hxml index 0bb7996..a714a33 100644 --- a/build-js-ts.hxml +++ b/build-js-ts.hxml @@ -2,6 +2,7 @@ -cp src -main export.ts.Export -lib hxtsdgen +-D analyzer-optimize -D hxtsdgen_namespaced -D hxtsdgen_enums_ts -D hxtsdgen_types_ts From 5237483058aac6c4347194023cf0feab217e0b68 Mon Sep 17 00:00:00 2001 From: Evgeniy Date: Thu, 13 May 2021 17:01:15 +0300 Subject: [PATCH 11/13] fixed alerts in OimoPhysics.js --- .gitignore | 8 ++ bin/js_modules/OimoPhysics.js | 177 +++++++++++++++++----------------- 2 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a60c9ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.DS_Store +*.swp +.project +.idea/ +.vscode/ +npm-debug.log +.jshintrc +.vs/ diff --git a/bin/js_modules/OimoPhysics.js b/bin/js_modules/OimoPhysics.js index 10e2c56..3c4eb49 100644 --- a/bin/js_modules/OimoPhysics.js +++ b/bin/js_modules/OimoPhysics.js @@ -1854,7 +1854,7 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ let newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; let creatingCost = newArea * 2; let incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; - let descendingCost1 = incrementalCost; + let descendingCost1; combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; @@ -1872,7 +1872,7 @@ oimo.collision.broadphase.bvh.BvhStrategy = class oimo_collision_broadphase_bvh_ let ez1 = c11._aabbMaxZ - c11._aabbMinZ; descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } - let descendingCost2 = incrementalCost; + let descendingCost2; combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; @@ -2720,7 +2720,7 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG let dx = endX - beginX; let dz = endZ - beginZ; let tminxz = 0; - let tmaxxz = 1; + let tmaxxz; let a = dx * dx + dz * dz; let b = beginX * dx + beginZ * dz; let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; @@ -2740,7 +2740,6 @@ oimo.collision.geometry.CapsuleGeometry = class oimo_collision_geometry_CapsuleG return false; } tminxz = 0; - tmaxxz = 1; } let crossY = beginY + (endY - beginY) * tminxz; let min; @@ -2962,7 +2961,7 @@ oimo.collision.geometry.ConeGeometry = class oimo_collision_geometry_ConeGeometr out.z = rz * invLen; } _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { - let p1y = beginY; + let p1y; let halfH = this._halfHeight; let dx = endX - beginX; let dy = endY - beginY; @@ -3386,7 +3385,7 @@ oimo.collision.geometry.CylinderGeometry = class oimo_collision_geometry_Cylinde return false; } let tminxz = 0; - let tmaxxz = 1; + let tmaxxz; let a = dx * dx + dz * dz; let b = beginX * dx + beginZ * dz; let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; @@ -4663,27 +4662,27 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow c12X = -c12X; c12Y = -c12Y; c12Z = -c12Z; - let tmp = b1; - b1 = b2; - b2 = tmp; - let tmp1 = w1; + + + + w1 = w2; - w2 = tmp1; - let tmp2 = h1; + + h1 = h2; - h2 = tmp2; - let tmp3 = d1; + + d1 = d2; - d2 = tmp3; - tmpX = c1X; - tmpY = c1Y; - tmpZ = c1Z; + + + + c1X = c2X; c1Y = c2Y; c1Z = c2Z; - c2X = tmpX; - c2Y = tmpY; - c2Z = tmpZ; + + + tmpX = x1X; tmpY = x1Y; tmpZ = x1Z; @@ -4855,7 +4854,7 @@ oimo.collision.narrowphase.detector.BoxBoxDetector = class oimo_collision_narrow incId = 4; } if(-incDot < minIncDot) { - minIncDot = -incDot; + incId = 5; } let incV1X; @@ -5514,7 +5513,7 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio t2 = 0; } else if(d11 == 0) { t1 = 0; - t2 = p12d2; + if(p12d2 < 0) { t2 = 0; } else if(p12d2 > d22) { @@ -5524,7 +5523,7 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio } } else if(d22 == 0) { t2 = 0; - t1 = p21d1; + if(p21d1 < 0) { t1 = 0; } else if(p21d1 > d11) { @@ -5549,7 +5548,7 @@ oimo.collision.narrowphase.detector.CapsuleCapsuleDetector = class oimo_collisio t2 = t1 * d12 + p12d2; if(t2 < 0) { t2 = 0; - t1 = p21d1; + if(p21d1 < 0) { t1 = 0; } else if(p21d1 > d11) { @@ -13597,15 +13596,15 @@ oimo.common.Mat3 = class oimo_common_Mat3 { let e10 = this.e01; let e20 = this.e02; let e21 = this.e12; - this.e00 = this.e00; + this.e01 = this.e10; this.e02 = this.e20; this.e10 = e10; - this.e11 = this.e11; + this.e12 = this.e21; this.e20 = e20; this.e21 = e21; - this.e22 = this.e22; + return this; } determinant() { @@ -14114,29 +14113,29 @@ oimo.common.Mat4 = class oimo_common_Mat4 { this.e21 *= sz; this.e22 *= sz; this.e23 *= sz; - this.e30 = this.e30; - this.e31 = this.e31; - this.e32 = this.e32; - this.e33 = this.e33; + + + + return this; } appendScaleEq(sx,sy,sz) { this.e00 *= sx; this.e01 *= sy; this.e02 *= sz; - this.e03 = this.e03; + this.e10 *= sx; this.e11 *= sy; this.e12 *= sz; - this.e13 = this.e13; + this.e20 *= sx; this.e21 *= sy; this.e22 *= sz; - this.e23 = this.e23; + this.e30 *= sx; this.e31 *= sy; this.e32 *= sz; - this.e33 = this.e33; + return this; } prependRotationEq(rad,axisX,axisY,axisZ) { @@ -14172,10 +14171,10 @@ oimo.common.Mat4 = class oimo_common_Mat4 { this.e21 = e21; this.e22 = e22; this.e23 = e23; - this.e30 = this.e30; - this.e31 = this.e31; - this.e32 = this.e32; - this.e33 = this.e33; + + + + return this; } appendRotationEq(rad,axisX,axisY,axisZ) { @@ -14202,19 +14201,19 @@ oimo.common.Mat4 = class oimo_common_Mat4 { this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; this.e01 = e01; this.e02 = e02; - this.e03 = this.e03; + this.e10 = this.e10 * r00 + this.e11 * r10 + this.e12 * r20; this.e11 = e11; this.e12 = e12; - this.e13 = this.e13; + this.e20 = this.e20 * r00 + this.e21 * r10 + this.e22 * r20; this.e21 = e21; this.e22 = e22; - this.e23 = this.e23; + this.e30 = this.e30 * r00 + this.e31 * r10 + this.e32 * r20; this.e31 = e31; this.e32 = e32; - this.e33 = this.e33; + return this; } prependTranslationEq(tx,ty,tz) { @@ -14230,10 +14229,10 @@ oimo.common.Mat4 = class oimo_common_Mat4 { this.e21 += tz * this.e31; this.e22 += tz * this.e32; this.e23 += tz * this.e33; - this.e30 = this.e30; - this.e31 = this.e31; - this.e32 = this.e32; - this.e33 = this.e33; + + + + return this; } appendTranslationEq(tx,ty,tz) { @@ -14241,21 +14240,25 @@ oimo.common.Mat4 = class oimo_common_Mat4 { let e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; let e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; let e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; - this.e00 = this.e00; - this.e01 = this.e01; - this.e02 = this.e02; + + + + this.e03 = e03; - this.e10 = this.e10; - this.e11 = this.e11; - this.e12 = this.e12; + + + + this.e13 = e13; - this.e20 = this.e20; - this.e21 = this.e21; - this.e22 = this.e22; + + + + this.e23 = e23; - this.e30 = this.e30; - this.e31 = this.e31; - this.e32 = this.e32; + + + + this.e33 = e33; return this; } @@ -14269,22 +14272,22 @@ oimo.common.Mat4 = class oimo_common_Mat4 { let e30 = this.e03; let e31 = this.e13; let e32 = this.e23; - this.e00 = this.e00; + this.e01 = this.e10; this.e02 = this.e20; this.e03 = this.e30; this.e10 = e10; - this.e11 = this.e11; + this.e12 = this.e21; this.e13 = this.e31; this.e20 = e20; this.e21 = e21; - this.e22 = this.e22; + this.e23 = this.e32; this.e30 = e30; this.e31 = e31; this.e32 = e32; - this.e33 = this.e33; + return this; } determinant() { @@ -16152,10 +16155,10 @@ oimo.dynamics.World = class oimo_dynamics_World { this._shapeIdCount = 0; } _updateContacts() { - let st = HxOverrides.now() / 1000; + let st = Date.now() / 1000; this._contactManager._updateContacts(); - oimo.dynamics.common.Performance.broadPhaseCollisionTime = (HxOverrides.now() / 1000 - st) * 1000; - let st1 = HxOverrides.now() / 1000; + oimo.dynamics.common.Performance.broadPhaseCollisionTime = (Date.now() / 1000 - st) * 1000; + let st1 = Date.now() / 1000; let c = this._contactManager._contactList; while(c != null) { let n = c._next; @@ -16164,10 +16167,10 @@ oimo.dynamics.World = class oimo_dynamics_World { } c = n; } - oimo.dynamics.common.Performance.narrowPhaseCollisionTime = (HxOverrides.now() / 1000 - st1) * 1000; + oimo.dynamics.common.Performance.narrowPhaseCollisionTime = (Date.now() / 1000 - st1) * 1000; } _solveIslands() { - let st = HxOverrides.now() / 1000; + let st = Date.now() / 1000; if(oimo.common.Setting.disableSleeping) { let b = this._rigidBodyList; while(b != null) { @@ -16225,7 +16228,7 @@ oimo.dynamics.World = class oimo_dynamics_World { this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; this._solversInIslands[this._numSolversInIslands] = null; } - oimo.dynamics.common.Performance.dynamicsTime = (HxOverrides.now() / 1000 - st) * 1000; + oimo.dynamics.common.Performance.dynamicsTime = (Date.now() / 1000 - st) * 1000; } buildIsland(base) { let stackCount = 1; @@ -17865,10 +17868,10 @@ oimo.dynamics.World = class oimo_dynamics_World { } this._timeStep.dt = timeStep; this._timeStep.invDt = 1 / timeStep; - let st = HxOverrides.now() / 1000; + let st = Date.now() / 1000; this._updateContacts(); this._solveIslands(); - oimo.dynamics.common.Performance.totalTime = (HxOverrides.now() / 1000 - st) * 1000; + oimo.dynamics.common.Performance.totalTime = (Date.now() / 1000 - st) * 1000; } addRigidBody(rigidBody) { if(rigidBody._world != null) { @@ -18704,7 +18707,7 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { _this2.x *= radiusX; _this2.y *= radiusX; _this2.z *= radiusX; - ex = _this2; + let _this3 = this.p; let _this4 = _this3.sizeVec3 == 0 ? new oimo.common.Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = ey.x; @@ -18714,7 +18717,7 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { _this5.x *= radiusY; _this5.y *= radiusY; _this5.z *= radiusY; - ey = _this5; + let angDiff = endAngle - startAngle; if(angDiff < 0) { angDiff = -angDiff; @@ -19077,7 +19080,7 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { _this2.x = -_this2.x; _this2.y = -_this2.y; _this2.z = -_this2.z; - n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); let _this3 = this.p; if(_this2 != null) { @@ -19543,12 +19546,12 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { let _g1 = 0; while(_g1 < 8) { let i = _g1++; - let v1 = _this7; + let v1; let v2 = this.tmpCircleVerts1[i]; let v3 = this.tmpCircleVerts1[(i + 1) % 8]; let n1 = ey; this.triangle(_this7,v2,v3,n1,n1,n1,color); - v1 = _this10; + v2 = this.tmpCircleVerts2[(i + 1) % 8]; v3 = this.tmpCircleVerts2[i]; let _this = this.p; @@ -19560,7 +19563,7 @@ oimo.dynamics.common.DebugDraw = class oimo_dynamics_common_DebugDraw { _this2.x = -_this2.x; _this2.y = -_this2.y; _this2.z = -_this2.z; - n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); let _this3 = this.p; if(_this2 != null) { @@ -21642,7 +21645,7 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain maxDepthIndex = 2; } if(p4._depth > maxDepth) { - maxDepth = p4._depth; + maxDepthIndex = 3; } let rp1X; @@ -21933,7 +21936,7 @@ oimo.dynamics.constraint.contact.ManifoldUpdater = class oimo_dynamics_constrain target = 2; } if(a4 > max && maxDepthIndex != 3) { - max = a4; + target = 3; } return target; @@ -26436,13 +26439,13 @@ oimo.dynamics.constraint.joint.RagdollJoint = class oimo_dynamics_constraint_joi swingVX *= invLen * this._swingAngle; swingVY *= invLen * this._swingAngle; swingVZ *= invLen * this._swingAngle; - let __tmp__X1; + let __tmp__Y1; let __tmp__Z1; - __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; + __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; - swingVX = __tmp__X1; + swingVY = __tmp__Y1; swingVZ = __tmp__Z1; let x1 = swingVY; @@ -29726,7 +29729,7 @@ oimo.dynamics.constraint.solver.direct.MassMatrix = class oimo_dynamics_constrai let _g3 = this._maxSubmatrixId; while(_g2 < _g3) { let i = _g2++; - let t = i; + let t; t = (i & 85) + (i >> 1 & 85); t = (t & 51) + (t >> 2 & 51); t = (t & 15) + (t >> 4 & 15); @@ -36934,11 +36937,7 @@ oimo.dynamics.rigidbody.ShapeConfig = class oimo_dynamics_rigidbody_ShapeConfig if(!oimo.m) oimo.m = {}; oimo.m.M = class oimo_m_M { } -if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { - HxOverrides.now = performance.now.bind(performance); -} -{ -} + oimo.collision.broadphase.BroadPhaseType._BRUTE_FORCE = 1; oimo.collision.broadphase.BroadPhaseType._BVH = 2; oimo.collision.broadphase.BroadPhaseType.BRUTE_FORCE = 1; From 5009102ddd9f00fec1fedd6fdd46985e32a3ac0c Mon Sep 17 00:00:00 2001 From: Evgeniy Date: Mon, 17 May 2021 18:50:45 +0300 Subject: [PATCH 12/13] added index d.ts --- bin/js_modules/index.d.ts | 36 ++++++++++++++++++++++++++++++++ bin/js_modules/index.js | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 bin/js_modules/index.d.ts create mode 100644 bin/js_modules/index.js diff --git a/bin/js_modules/index.d.ts b/bin/js_modules/index.d.ts new file mode 100644 index 0000000..736a2ce --- /dev/null +++ b/bin/js_modules/index.d.ts @@ -0,0 +1,36 @@ +import {oimo} from './OimoPhysics.js'; + +export const World: oimo.dynamics.World; +export const RigidBodyType: oimo.dynamics.rigidbody.RigidBodyType; +export const RigidBodyConfig: oimo.dynamics.rigidbody.RigidBodyConfig; +export const ShapeConfig: oimo.dynamics.rigidbody.ShapeConfig; +export const RigidBody: oimo.dynamics.rigidbody.RigidBody; +export const Shape: oimo.dynamics.rigidbody.Shape; +export const SphericalJoint: oimo.dynamics.constraint.joint.SphericalJoint; +export const RevoluteJointConfig: oimo.dynamics.constraint.joint.RevoluteJointConfig; +export const UniversalJointConfig: oimo.dynamics.constraint.joint.UniversalJointConfig; +export const CylindricalJoint: oimo.dynamics.constraint.joint.CylindricalJoint; +export const PrismaticJoint: oimo.dynamics.constraint.joint.PrismaticJoint; +export const PrismaticJointConfig: oimo.dynamics.constraint.joint.PrismaticJointConfig; +export const RevoluteJoint: oimo.dynamics.constraint.joint.RevoluteJoint; +export const RagdollJoint: oimo.dynamics.constraint.joint.RagdollJoint; +export const CylindricalJointConfig: oimo.dynamics.constraint.joint.CylindricalJointConfig; +export const SphericalJointConfig: oimo.dynamics.constraint.joint.SphericalJointConfig; +export const RagdollJointConfig: oimo.dynamics.constraint.joint.RagdollJointConfig; +export const SpringDamper: oimo.dynamics.constraint.joint.SpringDamper; +export const TranslationalLimitMotor: oimo.dynamics.constraint.joint.TranslationalLimitMotor; +export const RotationalLimitMotor: oimo.dynamics.constraint.joint.RotationalLimitMotor; +export const UniversalJoint: oimo.dynamics.constraint.joint.UniversalJoint; +export const Vec3: oimo.common.Vec3; +export const Quat: oimo.common.Quat; +export const Mat3: oimo.common.Mat3; +export const MathUtil: oimo.common.MathUtil; +export const Transform: oimo.common.Transform; +export const OCapsuleGeometry: oimo.collision.geometry.CapsuleGeometry; +export const OConvexHullGeometry: oimo.collision.geometry.ConvexHullGeometry; +export const OBoxGeometry: oimo.collision.geometry.BoxGeometry; +export const OSphereGeometry: oimo.collision.geometry.SphereGeometry; +export const OCylinderGeometry: oimo.collision.geometry.CylinderGeometry; +export const OConeGeometry: oimo.collision.geometry.ConeGeometry; +export const OGeometry: oimo.collision.geometry.Geometry; +export const RayCastClosest: oimo.dynamics.callback.RayCastClosest; diff --git a/bin/js_modules/index.js b/bin/js_modules/index.js new file mode 100644 index 0000000..0bf5789 --- /dev/null +++ b/bin/js_modules/index.js @@ -0,0 +1,43 @@ +import {oimo} from './OimoPhysics.js'; + +// dynamics +export const World = oimo.dynamics.World; +export const RigidBodyType = oimo.dynamics.rigidbody.RigidBodyType; +export const RigidBodyConfig = oimo.dynamics.rigidbody.RigidBodyConfig; +export const ShapeConfig = oimo.dynamics.rigidbody.ShapeConfig; +export const RigidBody = oimo.dynamics.rigidbody.RigidBody; +export const Shape = oimo.dynamics.rigidbody.Shape; +export const SphericalJoint = oimo.dynamics.constraint.joint.SphericalJoint; +export const RevoluteJointConfig = oimo.dynamics.constraint.joint.RevoluteJointConfig; +export const UniversalJointConfig = oimo.dynamics.constraint.joint.UniversalJointConfig; +export const CylindricalJoint = oimo.dynamics.constraint.joint.CylindricalJoint; +export const PrismaticJoint = oimo.dynamics.constraint.joint.PrismaticJoint; +export const PrismaticJointConfig = oimo.dynamics.constraint.joint.PrismaticJointConfig; +export const RevoluteJoint = oimo.dynamics.constraint.joint.RevoluteJoint; +export const RagdollJoint = oimo.dynamics.constraint.joint.RagdollJoint; +export const CylindricalJointConfig = oimo.dynamics.constraint.joint.CylindricalJointConfig; +export const SphericalJointConfig = oimo.dynamics.constraint.joint.SphericalJointConfig; +export const RagdollJointConfig = oimo.dynamics.constraint.joint.RagdollJointConfig; +export const SpringDamper = oimo.dynamics.constraint.joint.SpringDamper; +export const TranslationalLimitMotor = oimo.dynamics.constraint.joint.TranslationalLimitMotor; +export const RotationalLimitMotor = oimo.dynamics.constraint.joint.RotationalLimitMotor; +export const UniversalJoint = oimo.dynamics.constraint.joint.UniversalJoint; + +// common +export const Vec3 = oimo.common.Vec3; +export const Quat = oimo.common.Quat; +export const Mat3 = oimo.common.Mat3; +export const MathUtil = oimo.common.MathUtil; +export const Transform = oimo.common.Transform; + +// collision +export const OCapsuleGeometry = oimo.collision.geometry.CapsuleGeometry; +export const OConvexHullGeometry = oimo.collision.geometry.ConvexHullGeometry; +export const OBoxGeometry = oimo.collision.geometry.BoxGeometry; +export const OSphereGeometry = oimo.collision.geometry.SphereGeometry; +export const OCylinderGeometry = oimo.collision.geometry.CylinderGeometry; +export const OConeGeometry = oimo.collision.geometry.ConeGeometry; +export const OGeometry = oimo.collision.geometry.Geometry; + +// callback +export const RayCastClosest = oimo.dynamics.callback.RayCastClosest; From 3b298fb5422222276a71b5fae2b9e3cadebca997 Mon Sep 17 00:00:00 2001 From: shr Date: Tue, 25 Jan 2022 01:02:50 +0900 Subject: [PATCH 13/13] update for 1.2.2 --- .gitignore | 4 + README.md | 2 +- bin/js/OimoPhysics.js | 38997 ++++++++-------- bin/js/OimoPhysics.min.js | 840 +- bin/js/externs.js | 277 - bin/js_modules/OimoPhysics.d.ts | 18 +- bin/js_modules/OimoPhysics.js | 34 +- build-js.hxml | 5 + demos/bin/js/demos.js | 27733 +++++------ docs/404.html | 2 +- docs/doc.xml | 1096 +- docs/haxe-nav.css | 216 +- docs/highlighter.css | 67 +- docs/index.html | 2 +- docs/index.js | 156 +- docs/nav.js | 2 +- .../oimo/collision/broadphase/BroadPhase.html | 18 +- .../broadphase/BroadPhaseProxyCallback.html | 2 +- .../collision/broadphase/BroadPhaseType.html | 4 +- docs/oimo/collision/broadphase/Proxy.html | 8 +- docs/oimo/collision/broadphase/ProxyPair.html | 4 +- .../bruteforce/BruteForceBroadPhase.html | 6 +- .../broadphase/bruteforce/index.html | 2 +- .../broadphase/bvh/BvhBroadPhase.html | 8 +- docs/oimo/collision/broadphase/bvh/index.html | 4 +- docs/oimo/collision/broadphase/index.html | 4 +- docs/oimo/collision/geometry/Aabb.html | 14 +- docs/oimo/collision/geometry/BoxGeometry.html | 4 +- .../collision/geometry/CapsuleGeometry.html | 4 +- .../oimo/collision/geometry/ConeGeometry.html | 4 +- .../collision/geometry/ConvexGeometry.html | 6 +- .../geometry/ConvexHullGeometry.html | 6 +- .../collision/geometry/CylinderGeometry.html | 4 +- docs/oimo/collision/geometry/Geometry.html | 6 +- .../oimo/collision/geometry/GeometryType.html | 14 +- docs/oimo/collision/geometry/RayCastHit.html | 2 +- .../collision/geometry/SphereGeometry.html | 4 +- docs/oimo/collision/geometry/index.html | 4 +- docs/oimo/collision/index.html | 2 +- .../narrowphase/CollisionMatrix.html | 6 +- .../collision/narrowphase/DetectorResult.html | 8 +- .../narrowphase/DetectorResultPoint.html | 6 +- .../narrowphase/detector/BoxBoxDetector.html | 4 +- .../detector/CapsuleCapsuleDetector.html | 4 +- .../narrowphase/detector/Detector.html | 4 +- .../narrowphase/detector/GjkEpaDetector.html | 4 +- .../detector/SphereBoxDetector.html | 6 +- .../detector/SphereCapsuleDetector.html | 6 +- .../detector/SphereSphereDetector.html | 4 +- .../narrowphase/detector/gjkepa/GjkEpa.html | 14 +- .../detector/gjkepa/GjkEpaResultState.html | 2 +- .../detector/gjkepa/SimplexUtil.html | 8 +- .../narrowphase/detector/gjkepa/index.html | 2 +- .../collision/narrowphase/detector/index.html | 2 +- docs/oimo/collision/narrowphase/index.html | 4 +- docs/oimo/common/Mat3.html | 40 +- docs/oimo/common/Mat4.html | 42 +- docs/oimo/common/MathUtil.html | 6 +- docs/oimo/common/Pool.html | 10 +- docs/oimo/common/Quat.html | 12 +- docs/oimo/common/Setting.html | 2 +- docs/oimo/common/Transform.html | 8 +- docs/oimo/common/Vec3.html | 6 +- docs/oimo/common/index.html | 2 +- docs/oimo/dynamics/Contact.html | 8 +- docs/oimo/dynamics/ContactLink.html | 10 +- docs/oimo/dynamics/ContactManager.html | 4 +- docs/oimo/dynamics/TimeStep.html | 4 +- docs/oimo/dynamics/World.html | 12 +- .../dynamics/callback/AabbTestCallback.html | 4 +- .../dynamics/callback/ContactCallback.html | 12 +- .../dynamics/callback/RayCastCallback.html | 4 +- .../dynamics/callback/RayCastClosest.html | 4 +- docs/oimo/dynamics/callback/index.html | 4 +- docs/oimo/dynamics/common/DebugDraw.html | 36 +- docs/oimo/dynamics/common/DebugDrawStyle.html | 2 +- docs/oimo/dynamics/common/Performance.html | 2 +- docs/oimo/dynamics/common/index.html | 4 +- .../dynamics/constraint/ConstraintSolver.html | 8 +- .../PositionCorrectionAlgorithm.html | 4 +- .../constraint/contact/ContactConstraint.html | 4 +- .../dynamics/constraint/contact/Manifold.html | 16 +- .../constraint/contact/ManifoldPoint.html | 10 +- .../dynamics/constraint/contact/index.html | 4 +- docs/oimo/dynamics/constraint/index.html | 2 +- .../constraint/joint/CylindricalJoint.html | 46 +- .../joint/CylindricalJointConfig.html | 12 +- .../constraint/joint/GenericJoint.html | 38 +- .../constraint/joint/GenericJointConfig.html | 12 +- .../oimo/dynamics/constraint/joint/Joint.html | 38 +- .../constraint/joint/JointConfig.html | 12 +- .../dynamics/constraint/joint/JointLink.html | 10 +- .../dynamics/constraint/joint/JointType.html | 16 +- .../constraint/joint/PrismaticJoint.html | 46 +- .../joint/PrismaticJointConfig.html | 12 +- .../constraint/joint/RagdollJoint.html | 48 +- .../constraint/joint/RagdollJointConfig.html | 18 +- .../constraint/joint/RevoluteJoint.html | 46 +- .../constraint/joint/RevoluteJointConfig.html | 12 +- .../joint/RotationalLimitMotor.html | 12 +- .../constraint/joint/SphericalJoint.html | 38 +- .../joint/SphericalJointConfig.html | 10 +- .../constraint/joint/SpringDamper.html | 10 +- .../joint/TranslationalLimitMotor.html | 12 +- .../constraint/joint/UniversalJoint.html | 46 +- .../joint/UniversalJointConfig.html | 12 +- .../oimo/dynamics/constraint/joint/index.html | 4 +- .../solver/ConstraintSolverType.html | 4 +- .../direct/DirectJointConstraintSolver.html | 4 +- .../constraint/solver/direct/index.html | 4 +- .../dynamics/constraint/solver/index.html | 2 +- .../pgs/PgsContactConstraintSolver.html | 4 +- .../solver/pgs/PgsJointConstraintSolver.html | 2 +- .../dynamics/constraint/solver/pgs/index.html | 2 +- docs/oimo/dynamics/index.html | 4 +- docs/oimo/dynamics/rigidbody/MassData.html | 2 +- docs/oimo/dynamics/rigidbody/RigidBody.html | 64 +- .../dynamics/rigidbody/RigidBodyConfig.html | 10 +- .../dynamics/rigidbody/RigidBodyType.html | 8 +- docs/oimo/dynamics/rigidbody/Shape.html | 22 +- docs/oimo/dynamics/rigidbody/ShapeConfig.html | 12 +- docs/oimo/dynamics/rigidbody/index.html | 4 +- docs/oimo/index.html | 2 +- docs/styles.css | 538 +- exports/src/export/js/Export.hx | 13 +- minify-js.sh | 1 + .../narrowphase/detector/BoxBoxDetector.hx | 111 +- .../dynamics/constraint/joint/GenericJoint.hx | 2 +- src/oimo/dynamics/rigidbody/RigidBody.hx | 116 +- src/oimo/m/B.hx | 22 +- 130 files changed, 36534 insertions(+), 34884 deletions(-) create mode 100644 .gitignore delete mode 100644 bin/js/externs.js create mode 100644 minify-js.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82e82f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/js_externs.txt +/js_exports.txt +/js_imports.txt +/compiler.jar diff --git a/README.md b/README.md index 428c111..d8acaa8 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ A lightweight 3D physics engine. * Convex casting ## Compilations -Haxe 4.0.0 or later is required. (recommended: Haxe 4.0.5 or later) +Haxe 4.2.0 or later is required. (recommended: Haxe 4.2.4 or later) * Use `build-js.hxml` to compile for JavaScript library. * Use `build-js-demos.hxml` to compile JavaScript demos. * Use `build-doc.hxml` to generate API documentation. [dox](https://github.com/HaxeFoundation/dox) is required. diff --git a/bin/js/OimoPhysics.js b/bin/js/OimoPhysics.js index ddbda7b..af3887a 100644 --- a/bin/js/OimoPhysics.js +++ b/bin/js/OimoPhysics.js @@ -1,26 +1,15 @@ -/* - * OimoPhysics 1.2.2 (c) 2020 saharan, The MIT License - */ +/* OimoPhysics 1.2.2 (c) 2022 saharan, The MIT License */ +// Generated by Haxe 4.2.2 (function ($global) { "use strict"; -function $extend(from, fields) { - var proto = Object.create(from); - for (var name in fields) proto[name] = fields[name]; - if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; - return proto; +class HxOverrides { + static now() { + return Date.now(); + } } -var HxOverrides = function() { }; -HxOverrides.iter = function(a) { - return { cur : 0, arr : a, hasNext : function() { - return this.cur < this.arr.length; - }, next : function() { - return this.arr[this.cur++]; - }}; -}; -var export_js_Export = function() { }; -export_js_Export.main = function() { - +class export_js_Export { + static main() { + window["OIMO"] = {}; - window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; window["OIMO"]["BroadPhase"] = oimo_collision_broadphase_BroadPhase; oimo_collision_broadphase_BroadPhase.prototype["createProxy"] = oimo_collision_broadphase_BroadPhase.prototype.createProxy; oimo_collision_broadphase_BroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_BroadPhase.prototype.destroyProxy; @@ -365,6 +354,7 @@ export_js_Export.main = function() { window["OIMO"]["RayCastClosest"] = oimo_dynamics_callback_RayCastClosest; oimo_dynamics_callback_RayCastClosest.prototype["clear"] = oimo_dynamics_callback_RayCastClosest.prototype.clear; oimo_dynamics_callback_RayCastClosest.prototype["process"] = oimo_dynamics_callback_RayCastClosest.prototype.process; + window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; window["OIMO"]["DebugDrawStyle"] = oimo_dynamics_common_DebugDrawStyle; window["OIMO"]["Performance"] = oimo_dynamics_common_Performance; window["OIMO"]["ConstraintSolver"] = oimo_dynamics_constraint_ConstraintSolver; @@ -630,7 +620,7 @@ export_js_Export.main = function() { oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVectorTo; oimo_dynamics_rigidbody_RigidBody.prototype["getNumShapes"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumShapes; oimo_dynamics_rigidbody_RigidBody.prototype["getShapeList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getShapeList; - oimo_dynamics_rigidbody_RigidBody.prototype["getNumContectLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContectLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumContactLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContactLinks; oimo_dynamics_rigidbody_RigidBody.prototype["getContactLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getContactLinkList; oimo_dynamics_rigidbody_RigidBody.prototype["getNumJointLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumJointLinks; oimo_dynamics_rigidbody_RigidBody.prototype["getJointLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getJointLinkList; @@ -677,81 +667,94 @@ export_js_Export.main = function() { oimo_dynamics_rigidbody_Shape.prototype["getNext"] = oimo_dynamics_rigidbody_Shape.prototype.getNext; window["OIMO"]["ShapeConfig"] = oimo_dynamics_rigidbody_ShapeConfig; ; -}; -var oimo_collision_broadphase_BroadPhase = function(type) { - this._type = type; - this._numProxies = 0; - this._proxyList = null; - this._proxyListLast = null; - this._proxyPairList = null; - this._incremental = false; - this._testCount = 0; - this._proxyPairPool = null; - this._idCount = 0; - this._convexSweep = new oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry(); - this._aabb = new oimo_collision_broadphase__$BroadPhase_AabbGeometry(); - this.identity = new oimo_common_Transform(); - this.zero = new oimo_common_Vec3(); - this.rayCastHit = new oimo_collision_geometry_RayCastHit(); -}; -oimo_collision_broadphase_BroadPhase.prototype = { - createProxy: function(userData,aabb) { + } +} +class haxe_iterators_ArrayIterator { + constructor(array) { + this.current = 0; + this.array = array; + } + hasNext() { + return this.current < this.array.length; + } + next() { + return this.array[this.current++]; + } +} +class oimo_collision_broadphase_BroadPhase { + constructor(type) { + this._type = type; + this._numProxies = 0; + this._proxyList = null; + this._proxyListLast = null; + this._proxyPairList = null; + this._incremental = false; + this._testCount = 0; + this._proxyPairPool = null; + this._idCount = 0; + this._convexSweep = new oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry(); + this._aabb = new oimo_collision_broadphase__$BroadPhase_AabbGeometry(); + this.identity = new oimo_common_Transform(); + this.zero = new oimo_common_Vec3(); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); + } + createProxy(userData,aabb) { return null; } - ,destroyProxy: function(proxy) { + destroyProxy(proxy) { } - ,moveProxy: function(proxy,aabb,displacement) { + moveProxy(proxy,aabb,displacement) { } - ,isOverlapping: function(proxy1,proxy2) { + isOverlapping(proxy1,proxy2) { if(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ) { return proxy1._aabbMaxZ > proxy2._aabbMinZ; } else { return false; } } - ,collectPairs: function() { + collectPairs() { } - ,getProxyPairList: function() { + getProxyPairList() { return this._proxyPairList; } - ,isIncremental: function() { + isIncremental() { return this._incremental; } - ,getTestCount: function() { + getTestCount() { return this._testCount; } - ,rayCast: function(begin,end,callback) { + rayCast(begin,end,callback) { + } + convexCast(convex,begin,translation,callback) { } - ,convexCast: function(convex,begin,translation,callback) { + aabbTest(aabb,callback) { } - ,aabbTest: function(aabb,callback) { +} +class oimo_collision_geometry_Geometry { + constructor(type) { + this._type = type; + this._volume = 0; } -}; -var oimo_collision_geometry_Geometry = function(type) { - this._type = type; - this._volume = 0; -}; -oimo_collision_geometry_Geometry.prototype = { - _updateMass: function() { + _updateMass() { } - ,_computeAabb: function(aabb,tf) { + _computeAabb(aabb,tf) { } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { return false; } - ,getType: function() { + getType() { return this._type; } - ,getVolume: function() { + getVolume() { return this._volume; } - ,rayCast: function(begin,end,transform,hit) { - var beginLocalX; - var beginLocalY; - var beginLocalZ; - var endLocalX; - var endLocalY; - var endLocalZ; + rayCast(begin,end,transform,hit) { + let beginLocalX; + let beginLocalY; + let beginLocalZ; + let endLocalX; + let endLocalY; + let endLocalZ; beginLocalX = begin.x; beginLocalY = begin.y; beginLocalZ = begin.z; @@ -764,18 +767,18 @@ oimo_collision_geometry_Geometry.prototype = { endLocalX -= transform._positionX; endLocalY -= transform._positionY; endLocalZ -= transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = transform._rotation00 * beginLocalX + transform._rotation10 * beginLocalY + transform._rotation20 * beginLocalZ; __tmp__Y = transform._rotation01 * beginLocalX + transform._rotation11 * beginLocalY + transform._rotation21 * beginLocalZ; __tmp__Z = transform._rotation02 * beginLocalX + transform._rotation12 * beginLocalY + transform._rotation22 * beginLocalZ; beginLocalX = __tmp__X; beginLocalY = __tmp__Y; beginLocalZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; __tmp__Y1 = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; __tmp__Z1 = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; @@ -783,46 +786,46 @@ oimo_collision_geometry_Geometry.prototype = { endLocalY = __tmp__Y1; endLocalZ = __tmp__Z1; if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { - var localPosX; - var localPosY; - var localPosZ; - var localNormalX; - var localNormalY; - var localNormalZ; - var v = hit.position; + let localPosX; + let localPosY; + let localPosZ; + let localNormalX; + let localNormalY; + let localNormalZ; + let v = hit.position; localPosX = v.x; localPosY = v.y; localPosZ = v.z; - var v1 = hit.normal; + let v1 = hit.normal; localNormalX = v1.x; localNormalY = v1.y; localNormalZ = v1.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; - __tmp__Y2 = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; - __tmp__Z2 = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; - localPosX = __tmp__X2; - localPosY = __tmp__Y2; - localPosZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; - __tmp__Y3 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; - __tmp__Z3 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; - localNormalX = __tmp__X3; - localNormalY = __tmp__Y3; - localNormalZ = __tmp__Z3; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; + __tmp__Y = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; + __tmp__Z = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; + localPosX = __tmp__X; + localPosY = __tmp__Y; + localPosZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; + __tmp__Y1 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; + __tmp__Z1 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; + localNormalX = __tmp__X1; + localNormalY = __tmp__Y1; + localNormalZ = __tmp__Z1; localPosX += transform._positionX; localPosY += transform._positionY; localPosZ += transform._positionZ; - var v2 = hit.position; + let v2 = hit.position; v2.x = localPosX; v2.y = localPosY; v2.z = localPosZ; - var v3 = hit.normal; + let v3 = hit.normal; v3.x = localNormalX; v3.y = localNormalY; v3.z = localNormalZ; @@ -830,52 +833,50 @@ oimo_collision_geometry_Geometry.prototype = { } return false; } -}; -var oimo_collision_geometry_ConvexGeometry = function(type) { - oimo_collision_geometry_Geometry.call(this,type); - this._gjkMargin = oimo_common_Setting.defaultGJKMargin; - this._useGjkRayCast = false; -}; -oimo_collision_geometry_ConvexGeometry.__super__ = oimo_collision_geometry_Geometry; -oimo_collision_geometry_ConvexGeometry.prototype = $extend(oimo_collision_geometry_Geometry.prototype,{ - getGjkMergin: function() { +} +class oimo_collision_geometry_ConvexGeometry extends oimo_collision_geometry_Geometry { + constructor(type) { + super(type); + this._gjkMargin = oimo_common_Setting.defaultGJKMargin; + this._useGjkRayCast = false; + } + getGjkMergin() { return this._gjkMargin; } - ,setGjkMergin: function(gjkMergin) { + setGjkMergin(gjkMergin) { if(gjkMergin < 0) { gjkMergin = 0; } this._gjkMargin = gjkMergin; } - ,computeLocalSupportingVertex: function(dir,out) { + computeLocalSupportingVertex(dir,out) { } - ,rayCast: function(begin,end,transform,hit) { + rayCast(begin,end,transform,hit) { if(this._useGjkRayCast) { return oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance.rayCast(this,transform,begin,end,hit); } else { - return oimo_collision_geometry_Geometry.prototype.rayCast.call(this,begin,end,transform,hit); + return super.rayCast(begin,end,transform,hit); } } -}); -var oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry = function() { - oimo_collision_geometry_ConvexGeometry.call(this,-1); -}; -oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - init: function(c,transform,translation) { +} +class oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor() { + super(-1); + } + init(c,transform,translation) { this.c = c; - var trX; - var trY; - var trZ; + let trX; + let trY; + let trZ; trX = translation.x; trY = translation.y; trZ = translation.z; - var localTrX; - var localTrY; - var localTrZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let localTrX; + let localTrY; + let localTrZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = transform._rotation00 * trX + transform._rotation10 * trY + transform._rotation20 * trZ; __tmp__Y = transform._rotation01 * trX + transform._rotation11 * trY + transform._rotation21 * trZ; __tmp__Z = transform._rotation02 * trX + transform._rotation12 * trY + transform._rotation22 * trZ; @@ -883,61 +884,61 @@ oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(o localTrY = __tmp__Y; localTrZ = __tmp__Z; this.localTranslation = new oimo_common_Vec3(); - var v = this.localTranslation; + let v = this.localTranslation; v.x = localTrX; v.y = localTrY; v.z = localTrZ; this._gjkMargin = c._gjkMargin; } - ,computeLocalSupportingVertex: function(dir,out) { + computeLocalSupportingVertex(dir,out) { this.c.computeLocalSupportingVertex(dir,out); - var v = this.localTranslation; + let v = this.localTranslation; if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { - var v1 = this.localTranslation; - out.x += v1.x; - out.y += v1.y; - out.z += v1.z; - } - } -}); -var oimo_collision_broadphase__$BroadPhase_AabbGeometry = function() { - oimo_collision_geometry_ConvexGeometry.call(this,-1); - this.min = new oimo_common_Vec3(); - this.max = new oimo_common_Vec3(); -}; -oimo_collision_broadphase__$BroadPhase_AabbGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_broadphase__$BroadPhase_AabbGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - computeLocalSupportingVertex: function(dir,out) { + let v = this.localTranslation; + out.x += v.x; + out.y += v.y; + out.z += v.z; + } + } +} +class oimo_collision_broadphase__$BroadPhase_AabbGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor() { + super(-1); + this.min = new oimo_common_Vec3(); + this.max = new oimo_common_Vec3(); + } + computeLocalSupportingVertex(dir,out) { out.x = dir.x > 0 ? this.max.x : this.min.x; out.y = dir.y > 0 ? this.max.y : this.min.y; out.z = dir.z > 0 ? this.max.z : this.min.z; } -}); -var oimo_collision_broadphase_BroadPhaseProxyCallback = function() { -}; -oimo_collision_broadphase_BroadPhaseProxyCallback.prototype = { - process: function(proxy) { - } -}; -var oimo_collision_broadphase_BroadPhaseType = function() { }; -var oimo_collision_broadphase_Proxy = function(userData,id) { - this.userData = userData; - this._id = id; - this._prev = null; - this._next = null; - this._aabbMinX = 0; - this._aabbMinY = 0; - this._aabbMinZ = 0; - this._aabbMaxX = 0; - this._aabbMaxY = 0; - this._aabbMaxZ = 0; -}; -oimo_collision_broadphase_Proxy.prototype = { - getId: function() { +} +class oimo_collision_broadphase_BroadPhaseProxyCallback { + constructor() { + } + process(proxy) { + } +} +class oimo_collision_broadphase_BroadPhaseType { +} +class oimo_collision_broadphase_Proxy { + constructor(userData,id) { + this.userData = userData; + this._id = id; + this._prev = null; + this._next = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; + } + getId() { return this._id; } - ,getFatAabb: function() { - var aabb = new oimo_collision_geometry_Aabb(); + getFatAabb() { + let aabb = new oimo_collision_geometry_Aabb(); aabb._minX = this._aabbMinX; aabb._minY = this._aabbMinY; aabb._minZ = this._aabbMinZ; @@ -946,7 +947,7 @@ oimo_collision_broadphase_Proxy.prototype = { aabb._maxZ = this._aabbMaxZ; return aabb; } - ,getFatAabbTo: function(aabb) { + getFatAabbTo(aabb) { aabb._minX = this._aabbMinX; aabb._minY = this._aabbMinY; aabb._minZ = this._aabbMinZ; @@ -954,30 +955,29 @@ oimo_collision_broadphase_Proxy.prototype = { aabb._maxY = this._aabbMaxY; aabb._maxZ = this._aabbMaxZ; } -}; -var oimo_collision_broadphase_ProxyPair = function() { - this._p1 = null; - this._p2 = null; -}; -oimo_collision_broadphase_ProxyPair.prototype = { - getProxy1: function() { +} +class oimo_collision_broadphase_ProxyPair { + constructor() { + this._p1 = null; + this._p2 = null; + } + getProxy1() { return this._p1; } - ,getProxy2: function() { + getProxy2() { return this._p2; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_collision_broadphase_bruteforce_BruteForceBroadPhase = function() { - oimo_collision_broadphase_BroadPhase.call(this,1); - this._incremental = false; -}; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.__super__ = oimo_collision_broadphase_BroadPhase; -oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oimo_collision_broadphase_BroadPhase.prototype,{ - createProxy: function(userData,aabb) { - var proxy = new oimo_collision_broadphase_Proxy(userData,this._idCount++); +} +class oimo_collision_broadphase_bruteforce_BruteForceBroadPhase extends oimo_collision_broadphase_BroadPhase { + constructor() { + super(1); + this._incremental = false; + } + createProxy(userData,aabb) { + let proxy = new oimo_collision_broadphase_Proxy(userData,this._idCount++); this._numProxies++; if(this._proxyList == null) { this._proxyList = proxy; @@ -995,10 +995,10 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi proxy._aabbMaxZ = aabb._maxZ; return proxy; } - ,destroyProxy: function(proxy) { + destroyProxy(proxy) { this._numProxies--; - var prev = proxy._prev; - var next = proxy._next; + let prev = proxy._prev; + let next = proxy._next; if(prev != null) { prev._next = next; } @@ -1015,7 +1015,7 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi proxy._prev = null; proxy.userData = null; } - ,moveProxy: function(proxy,aabb,dislacement) { + moveProxy(proxy,aabb,dislacement) { proxy._aabbMinX = aabb._minX; proxy._aabbMinY = aabb._minY; proxy._aabbMinZ = aabb._minZ; @@ -1023,8 +1023,8 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi proxy._aabbMaxY = aabb._maxY; proxy._aabbMaxZ = aabb._maxZ; } - ,collectPairs: function() { - var p = this._proxyPairList; + collectPairs() { + let p = this._proxyPairList; if(p != null) { while(true) { p._p1 = null; @@ -1039,22 +1039,22 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi this._proxyPairList = null; } this._testCount = 0; - var p1 = this._proxyList; + let p1 = this._proxyList; while(p1 != null) { - var n = p1._next; - var p2 = p1._next; + let n = p1._next; + let p2 = p1._next; while(p2 != null) { - var n1 = p2._next; + let n = p2._next; this._testCount++; if(p1._aabbMinX < p2._aabbMaxX && p1._aabbMaxX > p2._aabbMinX && p1._aabbMinY < p2._aabbMaxY && p1._aabbMaxY > p2._aabbMinY && p1._aabbMinZ < p2._aabbMaxZ && p1._aabbMaxZ > p2._aabbMinZ) { - var first = this._proxyPairPool; + let first = this._proxyPairPool; if(first != null) { this._proxyPairPool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_ProxyPair(); } - var pp = first; + let pp = first; if(this._proxyPairList == null) { this._proxyPairList = pp; } else { @@ -1064,67 +1064,67 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi pp._p1 = p1; pp._p2 = p2; } - p2 = n1; + p2 = n; } p1 = n; } } - ,rayCast: function(begin,end,callback) { - var p1X; - var p1Y; - var p1Z; - var p2X; - var p2Y; - var p2Z; + rayCast(begin,end,callback) { + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; p1X = begin.x; p1Y = begin.y; p1Z = begin.z; p2X = end.x; p2Y = end.y; p2Z = end.z; - var p = this._proxyList; + let p = this._proxyList; while(p != null) { - var n = p._next; - var x1 = p1X; - var y1 = p1Y; - var z1 = p1Z; - var x2 = p2X; - var y2 = p2Y; - var z2 = p2Z; - var pminx = p._aabbMinX; - var pminy = p._aabbMinY; - var pminz = p._aabbMinZ; - var pmaxx = p._aabbMaxX; - var pmaxy = p._aabbMaxY; - var pmaxz = p._aabbMaxZ; - var tmp; + let n = p._next; + let x1 = p1X; + let y1 = p1Y; + let z1 = p1Z; + let x2 = p2X; + let y2 = p2Y; + let z2 = p2Z; + let pminx = p._aabbMinX; + let pminy = p._aabbMinY; + let pminz = p._aabbMinZ; + let pmaxx = p._aabbMaxX; + let pmaxy = p._aabbMaxY; + let pmaxz = p._aabbMaxZ; + let tmp; if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { - var dx = x2 - x1; - var dy = y2 - y1; - var dz = z2 - z1; - var adx = dx < 0 ? -dx : dx; - var ady = dy < 0 ? -dy : dy; - var adz = dz < 0 ? -dz : dz; - var pextx = (pmaxx - pminx) * 0.5; - var pexty = (pmaxy - pminy) * 0.5; - var pextz = (pmaxz - pminz) * 0.5; - var cpx = x1 - (pmaxx + pminx) * 0.5; - var cpy = y1 - (pmaxy + pminy) * 0.5; - var cpz = z1 - (pmaxz + pminz) * 0.5; - var tmp1; - var tmp2; - var x = cpy * dz - cpz * dy; + let dx = x2 - x1; + let dy = y2 - y1; + let dz = z2 - z1; + let adx = dx < 0 ? -dx : dx; + let ady = dy < 0 ? -dy : dy; + let adz = dz < 0 ? -dz : dz; + let pextx = (pmaxx - pminx) * 0.5; + let pexty = (pmaxy - pminy) * 0.5; + let pextz = (pmaxz - pminz) * 0.5; + let cpx = x1 - (pmaxx + pminx) * 0.5; + let cpy = y1 - (pmaxy + pminy) * 0.5; + let cpz = z1 - (pmaxz + pminz) * 0.5; + let tmp1; + let tmp2; + let x = cpy * dz - cpz * dy; if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { - var x3 = cpz * dx - cpx * dz; - tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + let x = cpz * dx - cpx * dz; + tmp2 = (x < 0 ? -x : x) - (pextz * adx + pextx * adz) > 0; } else { tmp2 = true; } if(!tmp2) { - var x4 = cpx * dy - cpy * dx; - tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + let x = cpx * dy - cpy * dx; + tmp1 = (x < 0 ? -x : x) - (pextx * ady + pexty * adx) > 0; } else { tmp1 = true; } @@ -1136,50 +1136,49 @@ oimo_collision_broadphase_bruteforce_BruteForceBroadPhase.prototype = $extend(oi p = n; } } - ,convexCast: function(convex,begin,translation,callback) { - var p = this._proxyList; + convexCast(convex,begin,translation,callback) { + let p = this._proxyList; while(p != null) { - var n = p._next; - var v = this._aabb.min; + let n = p._next; + let v = this._aabb.min; v.x = p._aabbMinX; v.y = p._aabbMinY; v.z = p._aabbMinZ; - var v1 = this._aabb.max; + let v1 = this._aabb.max; v1.x = p._aabbMaxX; v1.y = p._aabbMaxY; v1.z = p._aabbMaxZ; this._convexSweep.init(convex,begin,translation); - var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + let gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; if(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0) { callback.process(p); } p = n; } } - ,aabbTest: function(aabb,callback) { - var p = this._proxyList; + aabbTest(aabb,callback) { + let p = this._proxyList; while(p != null) { - var n = p._next; + let n = p._next; if(aabb._minX < p._aabbMaxX && aabb._maxX > p._aabbMinX && aabb._minY < p._aabbMaxY && aabb._maxY > p._aabbMinY && aabb._minZ < p._aabbMaxZ && aabb._maxZ > p._aabbMinZ) { callback.process(p); } p = n; } } -}); -var oimo_collision_broadphase_bvh_BvhBroadPhase = function() { - oimo_collision_broadphase_BroadPhase.call(this,2); - this._incremental = true; - this._tree = new oimo_collision_broadphase_bvh_BvhTree(); - this.movedProxies = new Array(1024); - this.numMovedProxies = 0; -}; -oimo_collision_broadphase_bvh_BvhBroadPhase.__super__ = oimo_collision_broadphase_BroadPhase; -oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_broadphase_BroadPhase.prototype,{ - collide: function(n1,n2) { +} +class oimo_collision_broadphase_bvh_BvhBroadPhase extends oimo_collision_broadphase_BroadPhase { + constructor() { + super(2); + this._incremental = true; + this._tree = new oimo_collision_broadphase_bvh_BvhTree(); + this.movedProxies = new Array(1024); + this.numMovedProxies = 0; + } + collide(n1,n2) { this._testCount++; - var l1 = n1._height == 0; - var l2 = n2._height == 0; + let l1 = n1._height == 0; + let l2 = n2._height == 0; if(n1 == n2) { if(l1) { return; @@ -1192,14 +1191,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b return; } if(l1 && l2) { - var first = this._proxyPairPool; + let first = this._proxyPairPool; if(first != null) { this._proxyPairPool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_ProxyPair(); } - var pp = first; + let pp = first; if(this._proxyPairList == null) { this._proxyPairList = pp; } else { @@ -1218,47 +1217,47 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b this.collide(n2._children[1],n1); } } - ,rayCastRecursive: function(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { - var x1 = _p1X; - var y1 = _p1Y; - var z1 = _p1Z; - var x2 = _p2X; - var y2 = _p2Y; - var z2 = _p2Z; - var pminx = node._aabbMinX; - var pminy = node._aabbMinY; - var pminz = node._aabbMinZ; - var pmaxx = node._aabbMaxX; - var pmaxy = node._aabbMaxY; - var pmaxz = node._aabbMaxZ; - var tmp; + rayCastRecursive(node,_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback) { + let x1 = _p1X; + let y1 = _p1Y; + let z1 = _p1Z; + let x2 = _p2X; + let y2 = _p2Y; + let z2 = _p2Z; + let pminx = node._aabbMinX; + let pminy = node._aabbMinY; + let pminz = node._aabbMinZ; + let pmaxx = node._aabbMaxX; + let pmaxy = node._aabbMaxY; + let pmaxz = node._aabbMaxZ; + let tmp; if(pminx > (x1 > x2 ? x1 : x2) || pmaxx < (x1 < x2 ? x1 : x2) || pminy > (y1 > y2 ? y1 : y2) || pmaxy < (y1 < y2 ? y1 : y2) || pminz > (z1 > z2 ? z1 : z2) || pmaxz < (z1 < z2 ? z1 : z2)) { tmp = false; } else { - var dx = x2 - x1; - var dy = y2 - y1; - var dz = z2 - z1; - var adx = dx < 0 ? -dx : dx; - var ady = dy < 0 ? -dy : dy; - var adz = dz < 0 ? -dz : dz; - var pextx = (pmaxx - pminx) * 0.5; - var pexty = (pmaxy - pminy) * 0.5; - var pextz = (pmaxz - pminz) * 0.5; - var cpx = x1 - (pmaxx + pminx) * 0.5; - var cpy = y1 - (pmaxy + pminy) * 0.5; - var cpz = z1 - (pmaxz + pminz) * 0.5; - var tmp1; - var tmp2; - var x = cpy * dz - cpz * dy; + let dx = x2 - x1; + let dy = y2 - y1; + let dz = z2 - z1; + let adx = dx < 0 ? -dx : dx; + let ady = dy < 0 ? -dy : dy; + let adz = dz < 0 ? -dz : dz; + let pextx = (pmaxx - pminx) * 0.5; + let pexty = (pmaxy - pminy) * 0.5; + let pextz = (pmaxz - pminz) * 0.5; + let cpx = x1 - (pmaxx + pminx) * 0.5; + let cpy = y1 - (pmaxy + pminy) * 0.5; + let cpz = z1 - (pmaxz + pminz) * 0.5; + let tmp1; + let tmp2; + let x = cpy * dz - cpz * dy; if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { - var x3 = cpz * dx - cpx * dz; - tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + let x = cpz * dx - cpx * dz; + tmp2 = (x < 0 ? -x : x) - (pextz * adx + pextx * adz) > 0; } else { tmp2 = true; } if(!tmp2) { - var x4 = cpx * dy - cpy * dx; - tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + let x = cpx * dy - cpy * dx; + tmp1 = (x < 0 ? -x : x) - (pextx * ady + pexty * adx) > 0; } else { tmp1 = true; } @@ -1274,17 +1273,17 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b this.rayCastRecursive(node._children[0],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); this.rayCastRecursive(node._children[1],_p1X,_p1Y,_p1Z,_p2X,_p2Y,_p2Z,callback); } - ,convexCastRecursive: function(node,convex,begin,translation,callback) { - var v = this._aabb.min; + convexCastRecursive(node,convex,begin,translation,callback) { + let v = this._aabb.min; v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = this._aabb.max; + let v1 = this._aabb.max; v1.x = node._aabbMaxX; v1.y = node._aabbMaxY; v1.z = node._aabbMaxZ; this._convexSweep.init(convex,begin,translation); - var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + let gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; if(!(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0)) { return; } @@ -1295,7 +1294,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b this.convexCastRecursive(node._children[0],convex,begin,translation,callback); this.convexCastRecursive(node._children[1],convex,begin,translation,callback); } - ,aabbTestRecursive: function(node,aabb,callback) { + aabbTestRecursive(node,aabb,callback) { if(!(node._aabbMinX < aabb._maxX && node._aabbMaxX > aabb._minX && node._aabbMinY < aabb._maxY && node._aabbMaxY > aabb._minY && node._aabbMinZ < aabb._maxZ && node._aabbMaxZ > aabb._minZ)) { return; } @@ -1306,8 +1305,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b this.aabbTestRecursive(node._children[0],aabb,callback); this.aabbTestRecursive(node._children[1],aabb,callback); } - ,createProxy: function(userData,aabb) { - var p = new oimo_collision_broadphase_bvh_BvhProxy(userData,this._idCount++); + createProxy(userData,aabb) { + let p = new oimo_collision_broadphase_bvh_BvhProxy(userData,this._idCount++); this._numProxies++; if(this._proxyList == null) { this._proxyList = p; @@ -1323,22 +1322,22 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p._aabbMaxX = aabb._maxX; p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; - var padding = oimo_common_Setting.bvhProxyPadding; + let padding = oimo_common_Setting.bvhProxyPadding; p._aabbMinX -= padding; p._aabbMinY -= padding; p._aabbMinZ -= padding; p._aabbMaxX += padding; p._aabbMaxY += padding; p._aabbMaxZ += padding; - var _this = this._tree; - var first = _this._nodePool; + let _this = this._tree; + let first = _this._nodePool; if(first != null) { _this._nodePool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_bvh_BvhNode(); } - var leaf = first; + let leaf = first; leaf._proxy = p; p._leaf = leaf; leaf._aabbMinX = p._aabbMinX; @@ -1359,53 +1358,51 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(_this._root == null) { _this._root = leaf; } else { - var sibling = _this._root; + let sibling = _this._root; while(sibling._height > 0) { - var nextStep = _this._strategy._decideInsertion(sibling,leaf); + let nextStep = _this._strategy._decideInsertion(sibling,leaf); if(nextStep == -1) { break; } else { sibling = sibling._children[nextStep]; } } - var parent = sibling._parent; - var first1 = _this._nodePool; - if(first1 != null) { - _this._nodePool = first1._next; - first1._next = null; + let parent = sibling._parent; + let first = _this._nodePool; + if(first != null) { + _this._nodePool = first._next; + first._next = null; } else { - first1 = new oimo_collision_broadphase_bvh_BvhNode(); + first = new oimo_collision_broadphase_bvh_BvhNode(); } - var node = first1; + let node = first; if(parent == null) { _this._root = node; } else { - var index = sibling._childIndex; + let index = sibling._childIndex; parent._children[index] = node; node._parent = parent; node._childIndex = index; } - var index1 = sibling._childIndex; - node._children[index1] = sibling; + let index = sibling._childIndex; + node._children[index] = sibling; sibling._parent = node; - sibling._childIndex = index1; - var index2 = sibling._childIndex ^ 1; - node._children[index2] = leaf; + sibling._childIndex = index; + let index1 = sibling._childIndex ^ 1; + node._children[index1] = leaf; leaf._parent = node; - leaf._childIndex = index2; + leaf._childIndex = index1; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { - var p1 = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var balance = l._height - r._height; - var nodeIndex = node._childIndex; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; + let ll = l._children[0]; + let lr = l._children[1]; if(ll._height > lr._height) { l._children[1] = node; node._parent = l; @@ -1413,27 +1410,27 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -1442,32 +1439,32 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p1 != null) { - p1._children[nodeIndex] = l; - l._parent = p1; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; l._childIndex = nodeIndex; } else { _this._root = l; @@ -1475,8 +1472,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; + let rl = r._children[0]; + let rr = r._children[1]; if(rl._height > rr._height) { r._children[1] = node; node._parent = r; @@ -1484,28 +1481,28 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -1513,65 +1510,63 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p1 != null) { - p1._children[nodeIndex] = r; - r._parent = p1; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; r._childIndex = nodeIndex; } else { _this._root = r; r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newArray = new Array(this.numMovedProxies << 1); - var _g = 0; - var _g1 = this.numMovedProxies; + let newArray = new Array(this.numMovedProxies << 1); + let _g = 0; + let _g1 = this.numMovedProxies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1581,10 +1576,10 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } return p; } - ,destroyProxy: function(proxy) { + destroyProxy(proxy) { this._numProxies--; - var prev = proxy._prev; - var next = proxy._next; + let prev = proxy._prev; + let next = proxy._next; if(prev != null) { prev._next = next; } @@ -1599,12 +1594,12 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } proxy._next = null; proxy._prev = null; - var bvhProxy = proxy; - var _this = this._tree; - var leaf = bvhProxy._leaf; + let bvhProxy = proxy; + let _this = this._tree; + let leaf = bvhProxy._leaf; _this._numLeaves--; - var prev1 = leaf._prevLeaf; - var next1 = leaf._nextLeaf; + let prev1 = leaf._prevLeaf; + let next1 = leaf._nextLeaf; if(prev1 != null) { prev1._nextLeaf = next1; } @@ -1622,9 +1617,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(_this._root == leaf) { _this._root = null; } else { - var parent = leaf._parent; - var sibling = parent._children[leaf._childIndex ^ 1]; - var grandParent = parent._parent; + let parent = leaf._parent; + let sibling = parent._children[leaf._childIndex ^ 1]; + let grandParent = parent._parent; if(grandParent == null) { sibling._parent = null; sibling._childIndex = 0; @@ -1641,7 +1636,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b _this._nodePool = parent; } else { sibling._parent = grandParent; - var index = parent._childIndex; + let index = parent._childIndex; grandParent._children[index] = sibling; sibling._parent = grandParent; sibling._childIndex = index; @@ -1655,20 +1650,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b parent._proxy = null; parent._next = _this._nodePool; _this._nodePool = parent; - var node = grandParent; + let node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { - var p = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var balance = l._height - r._height; - var nodeIndex = node._childIndex; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; + let ll = l._children[0]; + let lr = l._children[1]; if(ll._height > lr._height) { l._children[1] = node; node._parent = l; @@ -1676,27 +1669,27 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -1705,28 +1698,28 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } if(p != null) { p._children[nodeIndex] = l; @@ -1738,8 +1731,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; + let rl = r._children[0]; + let rr = r._children[1]; if(rl._height > rr._height) { r._children[1] = node; node._parent = r; @@ -1747,28 +1740,28 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -1776,28 +1769,28 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } if(p != null) { p._children[nodeIndex] = r; @@ -1808,22 +1801,20 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } @@ -1846,8 +1837,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b bvhProxy._moved = false; } } - ,moveProxy: function(proxy,aabb,displacement) { - var p = proxy; + moveProxy(proxy,aabb,displacement) { + let p = proxy; if(p._aabbMinX <= aabb._minX && p._aabbMaxX >= aabb._maxX && p._aabbMinY <= aabb._minY && p._aabbMaxY >= aabb._maxY && p._aabbMinZ <= aabb._minZ && p._aabbMaxZ >= aabb._maxZ) { return; } @@ -1857,7 +1848,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p._aabbMaxX = aabb._maxX; p._aabbMaxY = aabb._maxY; p._aabbMaxZ = aabb._maxZ; - var padding = oimo_common_Setting.bvhProxyPadding; + let padding = oimo_common_Setting.bvhProxyPadding; p._aabbMinX -= padding; p._aabbMinY -= padding; p._aabbMinZ -= padding; @@ -1865,18 +1856,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p._aabbMaxY += padding; p._aabbMaxZ += padding; if(displacement != null) { - var dX; - var dY; - var dZ; - var zeroX; - var zeroY; - var zeroZ; - var addToMinX; - var addToMinY; - var addToMinZ; - var addToMaxX; - var addToMaxY; - var addToMaxZ; + let dX; + let dY; + let dZ; + let zeroX; + let zeroY; + let zeroZ; + let addToMinX; + let addToMinY; + let addToMinZ; + let addToMaxX; + let addToMaxY; + let addToMaxZ; zeroX = 0; zeroY = 0; zeroZ = 0; @@ -1899,11 +1890,11 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(!p._moved) { p._moved = true; if(this.movedProxies.length == this.numMovedProxies) { - var newArray = new Array(this.numMovedProxies << 1); - var _g = 0; - var _g1 = this.numMovedProxies; + let newArray = new Array(this.numMovedProxies << 1); + let _g = 0; + let _g1 = this.numMovedProxies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.movedProxies[i]; this.movedProxies[i] = null; } @@ -1912,8 +1903,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b this.movedProxies[this.numMovedProxies++] = p; } } - ,collectPairs: function() { - var p = this._proxyPairList; + collectPairs() { + let p = this._proxyPairList; if(p != null) { while(true) { p._p1 = null; @@ -1931,18 +1922,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(this._numProxies < 2) { return; } - var incrementalCollision = this.numMovedProxies / this._numProxies < oimo_common_Setting.bvhIncrementalCollisionThreshold; - var _g = 0; - var _g1 = this.numMovedProxies; + let incrementalCollision = this.numMovedProxies / this._numProxies < oimo_common_Setting.bvhIncrementalCollisionThreshold; + let _g = 0; + let _g1 = this.numMovedProxies; while(_g < _g1) { - var i = _g++; - var p1 = this.movedProxies[i]; - if(p1._moved) { - var _this = this._tree; - var leaf = p1._leaf; + let i = _g++; + let p = this.movedProxies[i]; + if(p._moved) { + let _this = this._tree; + let leaf = p._leaf; _this._numLeaves--; - var prev = leaf._prevLeaf; - var next = leaf._nextLeaf; + let prev = leaf._prevLeaf; + let next = leaf._nextLeaf; if(prev != null) { prev._nextLeaf = next; } @@ -1960,9 +1951,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(_this._root == leaf) { _this._root = null; } else { - var parent = leaf._parent; - var sibling = parent._children[leaf._childIndex ^ 1]; - var grandParent = parent._parent; + let parent = leaf._parent; + let sibling = parent._children[leaf._childIndex ^ 1]; + let grandParent = parent._parent; if(grandParent == null) { sibling._parent = null; sibling._childIndex = 0; @@ -1979,7 +1970,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b _this._nodePool = parent; } else { sibling._parent = grandParent; - var index = parent._childIndex; + let index = parent._childIndex; grandParent._children[index] = sibling; sibling._parent = grandParent; sibling._childIndex = index; @@ -1993,20 +1984,18 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b parent._proxy = null; parent._next = _this._nodePool; _this._nodePool = parent; - var node = grandParent; + let node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { - var p2 = node._parent; - var l = node._children[0]; - var r = node._children[1]; - var balance = l._height - r._height; - var nodeIndex = node._childIndex; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; if(balance > 1) { - var ll = l._children[0]; - var lr = l._children[1]; + let ll = l._children[0]; + let lr = l._children[1]; if(ll._height > lr._height) { l._children[1] = node; node._parent = l; @@ -2014,27 +2003,27 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = lr; lr._parent = node; lr._childIndex = 0; - var c1 = l._children[0]; - var c2 = l._children[1]; + let c1 = l._children[0]; + let c2 = l._children[1]; l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = l._children[0]._height; - var h2 = l._children[1]._height; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; l._height = (h1 > h2 ? h1 : h2) + 1; - var c11 = node._children[0]; - var c21 = node._children[1]; + let c11 = node._children[0]; + let c21 = node._children[1]; node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; - var h11 = node._children[0]._height; - var h21 = node._children[1]._height; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; node._height = (h11 > h21 ? h11 : h21) + 1; } else { l._children[0] = node; @@ -2043,32 +2032,32 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[0] = ll; ll._parent = node; ll._childIndex = 0; - var c12 = l._children[0]; - var c22 = l._children[1]; - l._aabbMinX = c12._aabbMinX < c22._aabbMinX ? c12._aabbMinX : c22._aabbMinX; - l._aabbMinY = c12._aabbMinY < c22._aabbMinY ? c12._aabbMinY : c22._aabbMinY; - l._aabbMinZ = c12._aabbMinZ < c22._aabbMinZ ? c12._aabbMinZ : c22._aabbMinZ; - l._aabbMaxX = c12._aabbMaxX > c22._aabbMaxX ? c12._aabbMaxX : c22._aabbMaxX; - l._aabbMaxY = c12._aabbMaxY > c22._aabbMaxY ? c12._aabbMaxY : c22._aabbMaxY; - l._aabbMaxZ = c12._aabbMaxZ > c22._aabbMaxZ ? c12._aabbMaxZ : c22._aabbMaxZ; - var h12 = l._children[0]._height; - var h22 = l._children[1]._height; - l._height = (h12 > h22 ? h12 : h22) + 1; - var c13 = node._children[0]; - var c23 = node._children[1]; - node._aabbMinX = c13._aabbMinX < c23._aabbMinX ? c13._aabbMinX : c23._aabbMinX; - node._aabbMinY = c13._aabbMinY < c23._aabbMinY ? c13._aabbMinY : c23._aabbMinY; - node._aabbMinZ = c13._aabbMinZ < c23._aabbMinZ ? c13._aabbMinZ : c23._aabbMinZ; - node._aabbMaxX = c13._aabbMaxX > c23._aabbMaxX ? c13._aabbMaxX : c23._aabbMaxX; - node._aabbMaxY = c13._aabbMaxY > c23._aabbMaxY ? c13._aabbMaxY : c23._aabbMaxY; - node._aabbMaxZ = c13._aabbMaxZ > c23._aabbMaxZ ? c13._aabbMaxZ : c23._aabbMaxZ; - var h13 = node._children[0]._height; - var h23 = node._children[1]._height; - node._height = (h13 > h23 ? h13 : h23) + 1; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = l; - l._parent = p2; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; l._childIndex = nodeIndex; } else { _this._root = l; @@ -2076,8 +2065,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } node = l; } else if(balance < -1) { - var rl = r._children[0]; - var rr = r._children[1]; + let rl = r._children[0]; + let rr = r._children[1]; if(rl._height > rr._height) { r._children[1] = node; node._parent = r; @@ -2085,28 +2074,28 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rr; rr._parent = node; rr._childIndex = 1; - var c14 = r._children[0]; - var c24 = r._children[1]; - r._aabbMinX = c14._aabbMinX < c24._aabbMinX ? c14._aabbMinX : c24._aabbMinX; - r._aabbMinY = c14._aabbMinY < c24._aabbMinY ? c14._aabbMinY : c24._aabbMinY; - r._aabbMinZ = c14._aabbMinZ < c24._aabbMinZ ? c14._aabbMinZ : c24._aabbMinZ; - r._aabbMaxX = c14._aabbMaxX > c24._aabbMaxX ? c14._aabbMaxX : c24._aabbMaxX; - r._aabbMaxY = c14._aabbMaxY > c24._aabbMaxY ? c14._aabbMaxY : c24._aabbMaxY; - r._aabbMaxZ = c14._aabbMaxZ > c24._aabbMaxZ ? c14._aabbMaxZ : c24._aabbMaxZ; - var h14 = r._children[0]._height; - var h24 = r._children[1]._height; - r._height = (h14 > h24 ? h14 : h24) + 1; - var c15 = node._children[0]; - var c25 = node._children[1]; - node._aabbMinX = c15._aabbMinX < c25._aabbMinX ? c15._aabbMinX : c25._aabbMinX; - node._aabbMinY = c15._aabbMinY < c25._aabbMinY ? c15._aabbMinY : c25._aabbMinY; - node._aabbMinZ = c15._aabbMinZ < c25._aabbMinZ ? c15._aabbMinZ : c25._aabbMinZ; - node._aabbMaxX = c15._aabbMaxX > c25._aabbMaxX ? c15._aabbMaxX : c25._aabbMaxX; - node._aabbMaxY = c15._aabbMaxY > c25._aabbMaxY ? c15._aabbMaxY : c25._aabbMaxY; - node._aabbMaxZ = c15._aabbMaxZ > c25._aabbMaxZ ? c15._aabbMaxZ : c25._aabbMaxZ; - var h15 = node._children[0]._height; - var h25 = node._children[1]._height; - node._height = (h15 > h25 ? h15 : h25) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { r._children[0] = node; node._parent = r; @@ -2114,59 +2103,57 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._children[1] = rl; rl._parent = node; rl._childIndex = 1; - var c16 = r._children[0]; - var c26 = r._children[1]; - r._aabbMinX = c16._aabbMinX < c26._aabbMinX ? c16._aabbMinX : c26._aabbMinX; - r._aabbMinY = c16._aabbMinY < c26._aabbMinY ? c16._aabbMinY : c26._aabbMinY; - r._aabbMinZ = c16._aabbMinZ < c26._aabbMinZ ? c16._aabbMinZ : c26._aabbMinZ; - r._aabbMaxX = c16._aabbMaxX > c26._aabbMaxX ? c16._aabbMaxX : c26._aabbMaxX; - r._aabbMaxY = c16._aabbMaxY > c26._aabbMaxY ? c16._aabbMaxY : c26._aabbMaxY; - r._aabbMaxZ = c16._aabbMaxZ > c26._aabbMaxZ ? c16._aabbMaxZ : c26._aabbMaxZ; - var h16 = r._children[0]._height; - var h26 = r._children[1]._height; - r._height = (h16 > h26 ? h16 : h26) + 1; - var c17 = node._children[0]; - var c27 = node._children[1]; - node._aabbMinX = c17._aabbMinX < c27._aabbMinX ? c17._aabbMinX : c27._aabbMinX; - node._aabbMinY = c17._aabbMinY < c27._aabbMinY ? c17._aabbMinY : c27._aabbMinY; - node._aabbMinZ = c17._aabbMinZ < c27._aabbMinZ ? c17._aabbMinZ : c27._aabbMinZ; - node._aabbMaxX = c17._aabbMaxX > c27._aabbMaxX ? c17._aabbMaxX : c27._aabbMaxX; - node._aabbMaxY = c17._aabbMaxY > c27._aabbMaxY ? c17._aabbMaxY : c27._aabbMaxY; - node._aabbMaxZ = c17._aabbMaxZ > c27._aabbMaxZ ? c17._aabbMaxZ : c27._aabbMaxZ; - var h17 = node._children[0]._height; - var h27 = node._children[1]._height; - node._height = (h17 > h27 ? h17 : h27) + 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = r; - r._parent = p2; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; r._childIndex = nodeIndex; } else { _this._root = r; r._parent = null; } node = r; - } else { - node = node; } } } - var h18 = node._children[0]._height; - var h28 = node._children[1]._height; - node._height = (h18 > h28 ? h18 : h28) + 1; - var c18 = node._children[0]; - var c28 = node._children[1]; - node._aabbMinX = c18._aabbMinX < c28._aabbMinX ? c18._aabbMinX : c28._aabbMinX; - node._aabbMinY = c18._aabbMinY < c28._aabbMinY ? c18._aabbMinY : c28._aabbMinY; - node._aabbMinZ = c18._aabbMinZ < c28._aabbMinZ ? c18._aabbMinZ : c28._aabbMinZ; - node._aabbMaxX = c18._aabbMaxX > c28._aabbMaxX ? c18._aabbMaxX : c28._aabbMaxX; - node._aabbMaxY = c18._aabbMaxY > c28._aabbMaxY ? c18._aabbMaxY : c28._aabbMaxY; - node._aabbMaxZ = c18._aabbMaxZ > c28._aabbMaxZ ? c18._aabbMaxZ : c28._aabbMaxZ; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; node = node._parent; } } } - p1._leaf = null; + p._leaf = null; leaf._next = null; leaf._childIndex = 0; leaf._children[0] = null; @@ -2177,23 +2164,23 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b leaf._proxy = null; leaf._next = _this._nodePool; _this._nodePool = leaf; - var _this1 = this._tree; - var first = _this1._nodePool; + let _this1 = this._tree; + let first = _this1._nodePool; if(first != null) { _this1._nodePool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_bvh_BvhNode(); } - var leaf1 = first; - leaf1._proxy = p1; - p1._leaf = leaf1; - leaf1._aabbMinX = p1._aabbMinX; - leaf1._aabbMinY = p1._aabbMinY; - leaf1._aabbMinZ = p1._aabbMinZ; - leaf1._aabbMaxX = p1._aabbMaxX; - leaf1._aabbMaxY = p1._aabbMaxY; - leaf1._aabbMaxZ = p1._aabbMaxZ; + let leaf1 = first; + leaf1._proxy = p; + p._leaf = leaf1; + leaf1._aabbMinX = p._aabbMinX; + leaf1._aabbMinY = p._aabbMinY; + leaf1._aabbMinZ = p._aabbMinZ; + leaf1._aabbMaxX = p._aabbMaxX; + leaf1._aabbMaxY = p._aabbMaxY; + leaf1._aabbMaxZ = p._aabbMaxZ; _this1._numLeaves++; if(_this1.leafList == null) { _this1.leafList = leaf1; @@ -2206,215 +2193,211 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b if(_this1._root == null) { _this1._root = leaf1; } else { - var sibling1 = _this1._root; - while(sibling1._height > 0) { - var nextStep = _this1._strategy._decideInsertion(sibling1,leaf1); + let sibling = _this1._root; + while(sibling._height > 0) { + let nextStep = _this1._strategy._decideInsertion(sibling,leaf1); if(nextStep == -1) { break; } else { - sibling1 = sibling1._children[nextStep]; + sibling = sibling._children[nextStep]; } } - var parent1 = sibling1._parent; - var first1 = _this1._nodePool; - if(first1 != null) { - _this1._nodePool = first1._next; - first1._next = null; + let parent = sibling._parent; + let first = _this1._nodePool; + if(first != null) { + _this1._nodePool = first._next; + first._next = null; } else { - first1 = new oimo_collision_broadphase_bvh_BvhNode(); + first = new oimo_collision_broadphase_bvh_BvhNode(); } - var node1 = first1; - if(parent1 == null) { - _this1._root = node1; + let node = first; + if(parent == null) { + _this1._root = node; } else { - var index1 = sibling1._childIndex; - parent1._children[index1] = node1; - node1._parent = parent1; - node1._childIndex = index1; + let index = sibling._childIndex; + parent._children[index] = node; + node._parent = parent; + node._childIndex = index; } - var index2 = sibling1._childIndex; - node1._children[index2] = sibling1; - sibling1._parent = node1; - sibling1._childIndex = index2; - var index3 = sibling1._childIndex ^ 1; - node1._children[index3] = leaf1; - leaf1._parent = node1; - leaf1._childIndex = index3; - while(node1 != null) { + let index = sibling._childIndex; + node._children[index] = sibling; + sibling._parent = node; + sibling._childIndex = index; + let index1 = sibling._childIndex ^ 1; + node._children[index1] = leaf1; + leaf1._parent = node; + leaf1._childIndex = index1; + while(node != null) { if(_this1._strategy._balancingEnabled) { - if(node1._height < 2) { - node1 = node1; - } else { - var p3 = node1._parent; - var l1 = node1._children[0]; - var r1 = node1._children[1]; - var balance1 = l1._height - r1._height; - var nodeIndex1 = node1._childIndex; - if(balance1 > 1) { - var ll1 = l1._children[0]; - var lr1 = l1._children[1]; - if(ll1._height > lr1._height) { - l1._children[1] = node1; - node1._parent = l1; - node1._childIndex = 1; - node1._children[0] = lr1; - lr1._parent = node1; - lr1._childIndex = 0; - var c19 = l1._children[0]; - var c29 = l1._children[1]; - l1._aabbMinX = c19._aabbMinX < c29._aabbMinX ? c19._aabbMinX : c29._aabbMinX; - l1._aabbMinY = c19._aabbMinY < c29._aabbMinY ? c19._aabbMinY : c29._aabbMinY; - l1._aabbMinZ = c19._aabbMinZ < c29._aabbMinZ ? c19._aabbMinZ : c29._aabbMinZ; - l1._aabbMaxX = c19._aabbMaxX > c29._aabbMaxX ? c19._aabbMaxX : c29._aabbMaxX; - l1._aabbMaxY = c19._aabbMaxY > c29._aabbMaxY ? c19._aabbMaxY : c29._aabbMaxY; - l1._aabbMaxZ = c19._aabbMaxZ > c29._aabbMaxZ ? c19._aabbMaxZ : c29._aabbMaxZ; - var h19 = l1._children[0]._height; - var h29 = l1._children[1]._height; - l1._height = (h19 > h29 ? h19 : h29) + 1; - var c110 = node1._children[0]; - var c210 = node1._children[1]; - node1._aabbMinX = c110._aabbMinX < c210._aabbMinX ? c110._aabbMinX : c210._aabbMinX; - node1._aabbMinY = c110._aabbMinY < c210._aabbMinY ? c110._aabbMinY : c210._aabbMinY; - node1._aabbMinZ = c110._aabbMinZ < c210._aabbMinZ ? c110._aabbMinZ : c210._aabbMinZ; - node1._aabbMaxX = c110._aabbMaxX > c210._aabbMaxX ? c110._aabbMaxX : c210._aabbMaxX; - node1._aabbMaxY = c110._aabbMaxY > c210._aabbMaxY ? c110._aabbMaxY : c210._aabbMaxY; - node1._aabbMaxZ = c110._aabbMaxZ > c210._aabbMaxZ ? c110._aabbMaxZ : c210._aabbMaxZ; - var h110 = node1._children[0]._height; - var h210 = node1._children[1]._height; - node1._height = (h110 > h210 ? h110 : h210) + 1; + if(node._height >= 2) { + let p = node._parent; + let l = node._children[0]; + let r = node._children[1]; + let balance = l._height - r._height; + let nodeIndex = node._childIndex; + if(balance > 1) { + let ll = l._children[0]; + let lr = l._children[1]; + if(ll._height > lr._height) { + l._children[1] = node; + node._parent = l; + node._childIndex = 1; + node._children[0] = lr; + lr._parent = node; + lr._childIndex = 0; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { - l1._children[0] = node1; - node1._parent = l1; - node1._childIndex = 0; - node1._children[0] = ll1; - ll1._parent = node1; - ll1._childIndex = 0; - var c111 = l1._children[0]; - var c211 = l1._children[1]; - l1._aabbMinX = c111._aabbMinX < c211._aabbMinX ? c111._aabbMinX : c211._aabbMinX; - l1._aabbMinY = c111._aabbMinY < c211._aabbMinY ? c111._aabbMinY : c211._aabbMinY; - l1._aabbMinZ = c111._aabbMinZ < c211._aabbMinZ ? c111._aabbMinZ : c211._aabbMinZ; - l1._aabbMaxX = c111._aabbMaxX > c211._aabbMaxX ? c111._aabbMaxX : c211._aabbMaxX; - l1._aabbMaxY = c111._aabbMaxY > c211._aabbMaxY ? c111._aabbMaxY : c211._aabbMaxY; - l1._aabbMaxZ = c111._aabbMaxZ > c211._aabbMaxZ ? c111._aabbMaxZ : c211._aabbMaxZ; - var h111 = l1._children[0]._height; - var h211 = l1._children[1]._height; - l1._height = (h111 > h211 ? h111 : h211) + 1; - var c112 = node1._children[0]; - var c212 = node1._children[1]; - node1._aabbMinX = c112._aabbMinX < c212._aabbMinX ? c112._aabbMinX : c212._aabbMinX; - node1._aabbMinY = c112._aabbMinY < c212._aabbMinY ? c112._aabbMinY : c212._aabbMinY; - node1._aabbMinZ = c112._aabbMinZ < c212._aabbMinZ ? c112._aabbMinZ : c212._aabbMinZ; - node1._aabbMaxX = c112._aabbMaxX > c212._aabbMaxX ? c112._aabbMaxX : c212._aabbMaxX; - node1._aabbMaxY = c112._aabbMaxY > c212._aabbMaxY ? c112._aabbMaxY : c212._aabbMaxY; - node1._aabbMaxZ = c112._aabbMaxZ > c212._aabbMaxZ ? c112._aabbMaxZ : c212._aabbMaxZ; - var h112 = node1._children[0]._height; - var h212 = node1._children[1]._height; - node1._height = (h112 > h212 ? h112 : h212) + 1; + l._children[0] = node; + node._parent = l; + node._childIndex = 0; + node._children[0] = ll; + ll._parent = node; + ll._childIndex = 0; + let c1 = l._children[0]; + let c2 = l._children[1]; + l._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + l._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + l._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + l._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + l._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + l._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = l._children[0]._height; + let h2 = l._children[1]._height; + l._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = l1; - l1._parent = p3; - l1._childIndex = nodeIndex1; + if(p != null) { + p._children[nodeIndex] = l; + l._parent = p; + l._childIndex = nodeIndex; } else { - _this1._root = l1; - l1._parent = null; + _this1._root = l; + l._parent = null; } - node1 = l1; - } else if(balance1 < -1) { - var rl1 = r1._children[0]; - var rr1 = r1._children[1]; - if(rl1._height > rr1._height) { - r1._children[1] = node1; - node1._parent = r1; - node1._childIndex = 1; - node1._children[1] = rr1; - rr1._parent = node1; - rr1._childIndex = 1; - var c113 = r1._children[0]; - var c213 = r1._children[1]; - r1._aabbMinX = c113._aabbMinX < c213._aabbMinX ? c113._aabbMinX : c213._aabbMinX; - r1._aabbMinY = c113._aabbMinY < c213._aabbMinY ? c113._aabbMinY : c213._aabbMinY; - r1._aabbMinZ = c113._aabbMinZ < c213._aabbMinZ ? c113._aabbMinZ : c213._aabbMinZ; - r1._aabbMaxX = c113._aabbMaxX > c213._aabbMaxX ? c113._aabbMaxX : c213._aabbMaxX; - r1._aabbMaxY = c113._aabbMaxY > c213._aabbMaxY ? c113._aabbMaxY : c213._aabbMaxY; - r1._aabbMaxZ = c113._aabbMaxZ > c213._aabbMaxZ ? c113._aabbMaxZ : c213._aabbMaxZ; - var h113 = r1._children[0]._height; - var h213 = r1._children[1]._height; - r1._height = (h113 > h213 ? h113 : h213) + 1; - var c114 = node1._children[0]; - var c214 = node1._children[1]; - node1._aabbMinX = c114._aabbMinX < c214._aabbMinX ? c114._aabbMinX : c214._aabbMinX; - node1._aabbMinY = c114._aabbMinY < c214._aabbMinY ? c114._aabbMinY : c214._aabbMinY; - node1._aabbMinZ = c114._aabbMinZ < c214._aabbMinZ ? c114._aabbMinZ : c214._aabbMinZ; - node1._aabbMaxX = c114._aabbMaxX > c214._aabbMaxX ? c114._aabbMaxX : c214._aabbMaxX; - node1._aabbMaxY = c114._aabbMaxY > c214._aabbMaxY ? c114._aabbMaxY : c214._aabbMaxY; - node1._aabbMaxZ = c114._aabbMaxZ > c214._aabbMaxZ ? c114._aabbMaxZ : c214._aabbMaxZ; - var h114 = node1._children[0]._height; - var h214 = node1._children[1]._height; - node1._height = (h114 > h214 ? h114 : h214) + 1; + node = l; + } else if(balance < -1) { + let rl = r._children[0]; + let rr = r._children[1]; + if(rl._height > rr._height) { + r._children[1] = node; + node._parent = r; + node._childIndex = 1; + node._children[1] = rr; + rr._parent = node; + rr._childIndex = 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } else { - r1._children[0] = node1; - node1._parent = r1; - node1._childIndex = 0; - node1._children[1] = rl1; - rl1._parent = node1; - rl1._childIndex = 1; - var c115 = r1._children[0]; - var c215 = r1._children[1]; - r1._aabbMinX = c115._aabbMinX < c215._aabbMinX ? c115._aabbMinX : c215._aabbMinX; - r1._aabbMinY = c115._aabbMinY < c215._aabbMinY ? c115._aabbMinY : c215._aabbMinY; - r1._aabbMinZ = c115._aabbMinZ < c215._aabbMinZ ? c115._aabbMinZ : c215._aabbMinZ; - r1._aabbMaxX = c115._aabbMaxX > c215._aabbMaxX ? c115._aabbMaxX : c215._aabbMaxX; - r1._aabbMaxY = c115._aabbMaxY > c215._aabbMaxY ? c115._aabbMaxY : c215._aabbMaxY; - r1._aabbMaxZ = c115._aabbMaxZ > c215._aabbMaxZ ? c115._aabbMaxZ : c215._aabbMaxZ; - var h115 = r1._children[0]._height; - var h215 = r1._children[1]._height; - r1._height = (h115 > h215 ? h115 : h215) + 1; - var c116 = node1._children[0]; - var c216 = node1._children[1]; - node1._aabbMinX = c116._aabbMinX < c216._aabbMinX ? c116._aabbMinX : c216._aabbMinX; - node1._aabbMinY = c116._aabbMinY < c216._aabbMinY ? c116._aabbMinY : c216._aabbMinY; - node1._aabbMinZ = c116._aabbMinZ < c216._aabbMinZ ? c116._aabbMinZ : c216._aabbMinZ; - node1._aabbMaxX = c116._aabbMaxX > c216._aabbMaxX ? c116._aabbMaxX : c216._aabbMaxX; - node1._aabbMaxY = c116._aabbMaxY > c216._aabbMaxY ? c116._aabbMaxY : c216._aabbMaxY; - node1._aabbMaxZ = c116._aabbMaxZ > c216._aabbMaxZ ? c116._aabbMaxZ : c216._aabbMaxZ; - var h116 = node1._children[0]._height; - var h216 = node1._children[1]._height; - node1._height = (h116 > h216 ? h116 : h216) + 1; + r._children[0] = node; + node._parent = r; + node._childIndex = 0; + node._children[1] = rl; + rl._parent = node; + rl._childIndex = 1; + let c1 = r._children[0]; + let c2 = r._children[1]; + r._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + r._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + r._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + r._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + r._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + r._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + let h1 = r._children[0]._height; + let h2 = r._children[1]._height; + r._height = (h1 > h2 ? h1 : h2) + 1; + let c11 = node._children[0]; + let c21 = node._children[1]; + node._aabbMinX = c11._aabbMinX < c21._aabbMinX ? c11._aabbMinX : c21._aabbMinX; + node._aabbMinY = c11._aabbMinY < c21._aabbMinY ? c11._aabbMinY : c21._aabbMinY; + node._aabbMinZ = c11._aabbMinZ < c21._aabbMinZ ? c11._aabbMinZ : c21._aabbMinZ; + node._aabbMaxX = c11._aabbMaxX > c21._aabbMaxX ? c11._aabbMaxX : c21._aabbMaxX; + node._aabbMaxY = c11._aabbMaxY > c21._aabbMaxY ? c11._aabbMaxY : c21._aabbMaxY; + node._aabbMaxZ = c11._aabbMaxZ > c21._aabbMaxZ ? c11._aabbMaxZ : c21._aabbMaxZ; + let h11 = node._children[0]._height; + let h21 = node._children[1]._height; + node._height = (h11 > h21 ? h11 : h21) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = r1; - r1._parent = p3; - r1._childIndex = nodeIndex1; + if(p != null) { + p._children[nodeIndex] = r; + r._parent = p; + r._childIndex = nodeIndex; } else { - _this1._root = r1; - r1._parent = null; + _this1._root = r; + r._parent = null; } - node1 = r1; - } else { - node1 = node1; + node = r; } } } - var h117 = node1._children[0]._height; - var h217 = node1._children[1]._height; - node1._height = (h117 > h217 ? h117 : h217) + 1; - var c117 = node1._children[0]; - var c217 = node1._children[1]; - node1._aabbMinX = c117._aabbMinX < c217._aabbMinX ? c117._aabbMinX : c217._aabbMinX; - node1._aabbMinY = c117._aabbMinY < c217._aabbMinY ? c117._aabbMinY : c217._aabbMinY; - node1._aabbMinZ = c117._aabbMinZ < c217._aabbMinZ ? c117._aabbMinZ : c217._aabbMinZ; - node1._aabbMaxX = c117._aabbMaxX > c217._aabbMaxX ? c117._aabbMaxX : c217._aabbMaxX; - node1._aabbMaxY = c117._aabbMaxY > c217._aabbMaxY ? c117._aabbMaxY : c217._aabbMaxY; - node1._aabbMaxZ = c117._aabbMaxZ > c217._aabbMaxZ ? c117._aabbMaxZ : c217._aabbMaxZ; - node1 = node1._parent; + let h1 = node._children[0]._height; + let h2 = node._children[1]._height; + node._height = (h1 > h2 ? h1 : h2) + 1; + let c1 = node._children[0]; + let c2 = node._children[1]; + node._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; + node._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; + node._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; + node._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; + node._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; + node._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; + node = node._parent; } } if(incrementalCollision) { - this.collide(this._tree._root,p1._leaf); + this.collide(this._tree._root,p._leaf); } - p1._moved = false; + p._moved = false; } this.movedProxies[i] = null; } @@ -2423,16 +2406,16 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } this.numMovedProxies = 0; } - ,rayCast: function(begin,end,callback) { + rayCast(begin,end,callback) { if(this._tree._root == null) { return; } - var p1X; - var p1Y; - var p1Z; - var p2X; - var p2Y; - var p2Z; + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; p1X = begin.x; p1Y = begin.y; p1Z = begin.z; @@ -2441,69 +2424,71 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b p2Z = end.z; this.rayCastRecursive(this._tree._root,p1X,p1Y,p1Z,p2X,p2Y,p2Z,callback); } - ,convexCast: function(convex,begin,translation,callback) { + convexCast(convex,begin,translation,callback) { if(this._tree._root == null) { return; } this.convexCastRecursive(this._tree._root,convex,begin,translation,callback); } - ,aabbTest: function(aabb,callback) { + aabbTest(aabb,callback) { if(this._tree._root == null) { return; } this.aabbTestRecursive(this._tree._root,aabb,callback); } - ,getTreeBalance: function() { + getTreeBalance() { return this._tree._getBalance(); } -}); -var oimo_collision_broadphase_bvh_BvhInsertionStrategy = function() { }; -var oimo_collision_broadphase_bvh_BvhNode = function() { - this._next = null; - this._prevLeaf = null; - this._nextLeaf = null; - this._children = new Array(2); - this._childIndex = 0; - this._parent = null; - this._height = 0; - this._proxy = null; - this._aabbMinX = 0; - this._aabbMinY = 0; - this._aabbMinZ = 0; - this._aabbMaxX = 0; - this._aabbMaxY = 0; - this._aabbMaxZ = 0; -}; -var oimo_collision_broadphase_bvh_BvhProxy = function(userData,id) { - oimo_collision_broadphase_Proxy.call(this,userData,id); - this._leaf = null; - this._moved = false; -}; -oimo_collision_broadphase_bvh_BvhProxy.__super__ = oimo_collision_broadphase_Proxy; -oimo_collision_broadphase_bvh_BvhProxy.prototype = $extend(oimo_collision_broadphase_Proxy.prototype,{ -}); -var oimo_collision_broadphase_bvh_BvhStrategy = function() { - this._insertionStrategy = 0; - this._balancingEnabled = false; -}; -oimo_collision_broadphase_bvh_BvhStrategy.prototype = { - _decideInsertion: function(currentNode,leaf) { +} +class oimo_collision_broadphase_bvh_BvhInsertionStrategy { +} +class oimo_collision_broadphase_bvh_BvhNode { + constructor() { + this._next = null; + this._prevLeaf = null; + this._nextLeaf = null; + this._children = new Array(2); + this._childIndex = 0; + this._parent = null; + this._height = 0; + this._proxy = null; + this._aabbMinX = 0; + this._aabbMinY = 0; + this._aabbMinZ = 0; + this._aabbMaxX = 0; + this._aabbMaxY = 0; + this._aabbMaxZ = 0; + } +} +class oimo_collision_broadphase_bvh_BvhProxy extends oimo_collision_broadphase_Proxy { + constructor(userData,id) { + super(userData,id); + this._leaf = null; + this._moved = false; + } +} +class oimo_collision_broadphase_bvh_BvhStrategy { + constructor() { + this._insertionStrategy = 0; + this._balancingEnabled = false; + } + _decideInsertion(currentNode,leaf) { switch(this._insertionStrategy) { case 0: - var centerX; - var centerY; - var centerZ; + let centerX; + let centerY; + let centerZ; centerX = leaf._aabbMinX + leaf._aabbMaxX; centerY = leaf._aabbMinY + leaf._aabbMaxY; centerZ = leaf._aabbMinZ + leaf._aabbMaxZ; - var c1 = currentNode._children[0]; - var c2 = currentNode._children[1]; - var diff1X; - var diff1Y; - var diff1Z; - var diff2X; - var diff2Y; - var diff2Z; + let c1 = currentNode._children[0]; + let c2 = currentNode._children[1]; + let diff1X; + let diff1Y; + let diff1Z; + let diff2X; + let diff2Y; + let diff2Z; diff1X = c1._aabbMinX + c1._aabbMaxX; diff1Y = c1._aabbMinY + c1._aabbMaxY; diff1Z = c1._aabbMinZ + c1._aabbMaxZ; @@ -2523,28 +2508,28 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } break; case 1: - var c11 = currentNode._children[0]; - var c21 = currentNode._children[1]; - var ey = currentNode._aabbMaxY - currentNode._aabbMinY; - var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; - var combinedMinX; - var combinedMinY; - var combinedMinZ; - var combinedMaxX; - var combinedMaxY; - var combinedMaxZ; + let c11 = currentNode._children[0]; + let c21 = currentNode._children[1]; + let ey = currentNode._aabbMaxY - currentNode._aabbMinY; + let ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; + let combinedMinX; + let combinedMinY; + let combinedMinZ; + let combinedMaxX; + let combinedMaxY; + let combinedMaxZ; combinedMinX = currentNode._aabbMinX < leaf._aabbMinX ? currentNode._aabbMinX : leaf._aabbMinX; combinedMinY = currentNode._aabbMinY < leaf._aabbMinY ? currentNode._aabbMinY : leaf._aabbMinY; combinedMinZ = currentNode._aabbMinZ < leaf._aabbMinZ ? currentNode._aabbMinZ : leaf._aabbMinZ; combinedMaxX = currentNode._aabbMaxX > leaf._aabbMaxX ? currentNode._aabbMaxX : leaf._aabbMaxX; combinedMaxY = currentNode._aabbMaxY > leaf._aabbMaxY ? currentNode._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = currentNode._aabbMaxZ > leaf._aabbMaxZ ? currentNode._aabbMaxZ : leaf._aabbMaxZ; - var ey1 = combinedMaxY - combinedMinY; - var ez1 = combinedMaxZ - combinedMinZ; - var newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; - var creatingCost = newArea * 2; - var incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; - var descendingCost1 = incrementalCost; + let ey1 = combinedMaxY - combinedMinY; + let ez1 = combinedMaxZ - combinedMinZ; + let newArea = ((combinedMaxX - combinedMinX) * (ey1 + ez1) + ey1 * ez1) * 2; + let creatingCost = newArea * 2; + let incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; + let descendingCost1 = incrementalCost; combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; @@ -2552,17 +2537,17 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; if(c11._height == 0) { - var ey2 = combinedMaxY - combinedMinY; - var ez2 = combinedMaxZ - combinedMinZ; - descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey2 + ez2) + ey2 * ez2) * 2; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ey3 = combinedMaxY - combinedMinY; - var ez3 = combinedMaxZ - combinedMinZ; - var ey4 = c11._aabbMaxY - c11._aabbMinY; - var ez4 = c11._aabbMaxZ - c11._aabbMinZ; - descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey3 + ez3) + ey3 * ez3) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey4 + ez4) + ey4 * ez4) * 2); + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + let ey1 = c11._aabbMaxY - c11._aabbMinY; + let ez1 = c11._aabbMaxZ - c11._aabbMinZ; + descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } - var descendingCost2 = incrementalCost; + let descendingCost2 = incrementalCost; combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; @@ -2570,15 +2555,15 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; if(c21._height == 0) { - var ey5 = combinedMaxY - combinedMinY; - var ez5 = combinedMaxZ - combinedMinZ; - descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey5 + ez5) + ey5 * ez5) * 2; + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ey6 = combinedMaxY - combinedMinY; - var ez6 = combinedMaxZ - combinedMinZ; - var ey7 = c21._aabbMaxY - c21._aabbMinY; - var ez7 = c21._aabbMaxZ - c21._aabbMinZ; - descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey6 + ez6) + ey6 * ez6) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey7 + ez7) + ey7 * ez7) * 2); + let ey = combinedMaxY - combinedMinY; + let ez = combinedMaxZ - combinedMinZ; + let ey1 = c21._aabbMaxY - c21._aabbMinY; + let ez1 = c21._aabbMaxZ - c21._aabbMinZ; + descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } if(creatingCost < descendingCost1) { if(creatingCost < descendingCost2) { @@ -2597,17 +2582,17 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { return -1; } } - ,_splitLeaves: function(leaves,from,until) { - var invN = 1.0 / (until - from); - var centerMeanX; - var centerMeanY; - var centerMeanZ; + _splitLeaves(leaves,from,until) { + let invN = 1.0 / (until - from); + let centerMeanX; + let centerMeanY; + let centerMeanZ; centerMeanX = 0; centerMeanY = 0; centerMeanZ = 0; - var _g = from; + let _g = from; while(_g < until) { - var leaf = leaves[_g++]; + let leaf = leaves[_g++]; leaf._tmpX = leaf._aabbMaxX + leaf._aabbMinX; leaf._tmpY = leaf._aabbMaxY + leaf._aabbMinY; leaf._tmpZ = leaf._aabbMaxZ + leaf._aabbMinZ; @@ -2618,21 +2603,21 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { centerMeanX *= invN; centerMeanY *= invN; centerMeanZ *= invN; - var varianceX; - var varianceY; - var varianceZ; + let varianceX; + let varianceY; + let varianceZ; varianceX = 0; varianceY = 0; varianceZ = 0; - var _g2 = from; - while(_g2 < until) { - var leaf1 = leaves[_g2++]; - var diffX; - var diffY; - var diffZ; - diffX = leaf1._tmpX - centerMeanX; - diffY = leaf1._tmpY - centerMeanY; - diffZ = leaf1._tmpZ - centerMeanZ; + let _g1 = from; + while(_g1 < until) { + let leaf = leaves[_g1++]; + let diffX; + let diffY; + let diffZ; + diffX = leaf._tmpX - centerMeanX; + diffY = leaf._tmpY - centerMeanY; + diffZ = leaf._tmpZ - centerMeanZ; diffX *= diffX; diffY *= diffY; diffZ *= diffZ; @@ -2640,84 +2625,84 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { varianceY += diffY; varianceZ += diffZ; } - var varX = varianceX; - var varY = varianceY; - var varZ = varianceZ; - var l = from; - var r = until - 1; + let varX = varianceX; + let varY = varianceY; + let varZ = varianceZ; + let l = from; + let r = until - 1; if(varX > varY) { if(varX > varZ) { - var mean = centerMeanX; + let mean = centerMeanX; while(true) { while(!(leaves[l]._tmpX <= mean)) ++l; while(!(leaves[r]._tmpX >= mean)) --r; if(l >= r) { break; } - var tmp = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; leaves[r] = tmp; ++l; --r; } } else { - var mean1 = centerMeanZ; + let mean = centerMeanZ; while(true) { - while(!(leaves[l]._tmpZ <= mean1)) ++l; - while(!(leaves[r]._tmpZ >= mean1)) --r; + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp1 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp1; + leaves[r] = tmp; ++l; --r; } } } else if(varY > varZ) { - var mean2 = centerMeanY; + let mean = centerMeanY; while(true) { - while(!(leaves[l]._tmpY <= mean2)) ++l; - while(!(leaves[r]._tmpY >= mean2)) --r; + while(!(leaves[l]._tmpY <= mean)) ++l; + while(!(leaves[r]._tmpY >= mean)) --r; if(l >= r) { break; } - var tmp2 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp2; + leaves[r] = tmp; ++l; --r; } } else { - var mean3 = centerMeanZ; + let mean = centerMeanZ; while(true) { - while(!(leaves[l]._tmpZ <= mean3)) ++l; - while(!(leaves[r]._tmpZ >= mean3)) --r; + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp3 = leaves[l]; + let tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp3; + leaves[r] = tmp; ++l; --r; } } return l; } -}; -var oimo_collision_broadphase_bvh_BvhTree = function() { - this._root = null; - this._numLeaves = 0; - this._strategy = new oimo_collision_broadphase_bvh_BvhStrategy(); - this._nodePool = null; - this.leafList = null; - this.leafListLast = null; - this.tmp = new Array(1024); -}; -oimo_collision_broadphase_bvh_BvhTree.prototype = { - _print: function(root,indent) { +} +class oimo_collision_broadphase_bvh_BvhTree { + constructor() { + this._root = null; + this._numLeaves = 0; + this._strategy = new oimo_collision_broadphase_bvh_BvhStrategy(); + this._nodePool = null; + this.leafList = null; + this.leafListLast = null; + this.tmp = new Array(1024); + } + _print(root,indent) { if(indent == null) { indent = ""; } @@ -2728,47 +2713,47 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:39:",indent + root._proxy._id); } else { this._print(root._children[0],indent + " "); - var tmp; - var sizeX; - var sizeY; - var sizeZ; + let tmp; + let sizeX; + let sizeY; + let sizeZ; sizeX = root._aabbMaxX - root._aabbMinX; sizeY = root._aabbMaxY - root._aabbMinY; sizeZ = root._aabbMaxZ - root._aabbMinZ; - var y = sizeY; - var z = sizeZ; + let y = sizeY; + let z = sizeZ; if(sizeX * (y + z) + y * z > 0) { - var sizeX1; - var sizeY1; - var sizeZ1; - sizeX1 = root._aabbMaxX - root._aabbMinX; - sizeY1 = root._aabbMaxY - root._aabbMinY; - sizeZ1 = root._aabbMaxZ - root._aabbMinZ; - var y1 = sizeY1; - var z1 = sizeZ1; - tmp = ((sizeX1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + let sizeX; + let sizeY; + let sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + let y = sizeY; + let z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 + 0.5 | 0) / 1000; } else { - var sizeX2; - var sizeY2; - var sizeZ2; - sizeX2 = root._aabbMaxX - root._aabbMinX; - sizeY2 = root._aabbMaxY - root._aabbMinY; - sizeZ2 = root._aabbMaxZ - root._aabbMinZ; - var y2 = sizeY2; - var z2 = sizeZ2; - tmp = ((sizeX2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + let sizeX; + let sizeY; + let sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + let y = sizeY; + let z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 - 0.5 | 0) / 1000; } console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); this._print(root._children[1],indent + " "); } } - ,_getBalance: function() { + _getBalance() { return this.getBalanceRecursive(this._root); } - ,deleteRecursive: function(root) { + deleteRecursive(root) { if(root._height == 0) { - var prev = root._prevLeaf; - var next = root._nextLeaf; + let prev = root._prevLeaf; + let next = root._nextLeaf; if(prev != null) { prev._nextLeaf = next; } @@ -2809,7 +2794,7 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { root._next = this._nodePool; this._nodePool = root; } - ,decomposeRecursive: function(root) { + decomposeRecursive(root) { if(root._height == 0) { root._childIndex = 0; root._parent = null; @@ -2828,10 +2813,10 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { root._next = this._nodePool; this._nodePool = root; } - ,buildTopDownRecursive: function(leaves,from,until) { + buildTopDownRecursive(leaves,from,until) { if(until - from == 1) { - var leaf = leaves[from]; - var proxy = leaf._proxy; + let leaf = leaves[from]; + let proxy = leaf._proxy; leaf._aabbMinX = proxy._aabbMinX; leaf._aabbMinY = proxy._aabbMinY; leaf._aabbMinZ = proxy._aabbMinZ; @@ -2840,57 +2825,57 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { leaf._aabbMaxZ = proxy._aabbMaxZ; return leaf; } - var splitAt = this._strategy._splitLeaves(leaves,from,until); - var child1 = this.buildTopDownRecursive(leaves,from,splitAt); - var child2 = this.buildTopDownRecursive(leaves,splitAt,until); - var first = this._nodePool; + let splitAt = this._strategy._splitLeaves(leaves,from,until); + let child1 = this.buildTopDownRecursive(leaves,from,splitAt); + let child2 = this.buildTopDownRecursive(leaves,splitAt,until); + let first = this._nodePool; if(first != null) { this._nodePool = first._next; first._next = null; } else { first = new oimo_collision_broadphase_bvh_BvhNode(); } - var parent = first; + let parent = first; parent._children[0] = child1; child1._parent = parent; child1._childIndex = 0; parent._children[1] = child2; child2._parent = parent; child2._childIndex = 1; - var c1 = parent._children[0]; - var c2 = parent._children[1]; + let c1 = parent._children[0]; + let c2 = parent._children[1]; parent._aabbMinX = c1._aabbMinX < c2._aabbMinX ? c1._aabbMinX : c2._aabbMinX; parent._aabbMinY = c1._aabbMinY < c2._aabbMinY ? c1._aabbMinY : c2._aabbMinY; parent._aabbMinZ = c1._aabbMinZ < c2._aabbMinZ ? c1._aabbMinZ : c2._aabbMinZ; parent._aabbMaxX = c1._aabbMaxX > c2._aabbMaxX ? c1._aabbMaxX : c2._aabbMaxX; parent._aabbMaxY = c1._aabbMaxY > c2._aabbMaxY ? c1._aabbMaxY : c2._aabbMaxY; parent._aabbMaxZ = c1._aabbMaxZ > c2._aabbMaxZ ? c1._aabbMaxZ : c2._aabbMaxZ; - var h1 = parent._children[0]._height; - var h2 = parent._children[1]._height; + let h1 = parent._children[0]._height; + let h2 = parent._children[1]._height; parent._height = (h1 > h2 ? h1 : h2) + 1; return parent; } - ,getBalanceRecursive: function(root) { + getBalanceRecursive(root) { if(root == null || root._height == 0) { return 0; } - var balance = root._children[0]._height - root._children[1]._height; + let balance = root._children[0]._height - root._children[1]._height; if(balance < 0) { balance = -balance; } return balance + this.getBalanceRecursive(root._children[0]) + this.getBalanceRecursive(root._children[1]); } -}; -var oimo_collision_geometry_Aabb = function() { - this._minX = 0; - this._minY = 0; - this._minZ = 0; - this._maxX = 0; - this._maxY = 0; - this._maxZ = 0; -}; -oimo_collision_geometry_Aabb.prototype = { - init: function(min,max) { +} +class oimo_collision_geometry_Aabb { + constructor() { + this._minX = 0; + this._minY = 0; + this._minZ = 0; + this._maxX = 0; + this._maxY = 0; + this._maxZ = 0; + } + init(min,max) { this._minX = min.x; this._minY = min.y; this._minZ = min.z; @@ -2899,47 +2884,47 @@ oimo_collision_geometry_Aabb.prototype = { this._maxZ = max.z; return this; } - ,getMin: function() { - var min = new oimo_common_Vec3(); + getMin() { + let min = new oimo_common_Vec3(); min.x = this._minX; min.y = this._minY; min.z = this._minZ; return min; } - ,getMinTo: function(min) { + getMinTo(min) { min.x = this._minX; min.y = this._minY; min.z = this._minZ; } - ,setMin: function(min) { + setMin(min) { this._minX = min.x; this._minY = min.y; this._minZ = min.z; return this; } - ,getMax: function() { - var max = new oimo_common_Vec3(); + getMax() { + let max = new oimo_common_Vec3(); max.x = this._maxX; max.y = this._maxY; max.z = this._maxZ; return max; } - ,getMaxTo: function(max) { + getMaxTo(max) { max.x = this._maxX; max.y = this._maxY; max.z = this._maxZ; } - ,setMax: function(max) { + setMax(max) { this._maxX = max.x; this._maxY = max.y; this._maxZ = max.z; return this; } - ,getCenter: function() { - var v = new oimo_common_Vec3(); - var cX; - var cY; - var cZ; + getCenter() { + let v = new oimo_common_Vec3(); + let cX; + let cY; + let cZ; cX = this._minX + this._maxX; cY = this._minY + this._maxY; cZ = this._minZ + this._maxZ; @@ -2951,10 +2936,10 @@ oimo_collision_geometry_Aabb.prototype = { v.z = cZ; return v; } - ,getCenterTo: function(center) { - var cX; - var cY; - var cZ; + getCenterTo(center) { + let cX; + let cY; + let cZ; cX = this._minX + this._maxX; cY = this._minY + this._maxY; cZ = this._minZ + this._maxZ; @@ -2965,11 +2950,11 @@ oimo_collision_geometry_Aabb.prototype = { center.y = cY; center.z = cZ; } - ,getExtents: function() { - var v = new oimo_common_Vec3(); - var cX; - var cY; - var cZ; + getExtents() { + let v = new oimo_common_Vec3(); + let cX; + let cY; + let cZ; cX = this._maxX - this._minX; cY = this._maxY - this._minY; cZ = this._maxZ - this._minZ; @@ -2981,10 +2966,10 @@ oimo_collision_geometry_Aabb.prototype = { v.z = cZ; return v; } - ,getExtentsTo: function(halfExtents) { - var cX; - var cY; - var cZ; + getExtentsTo(halfExtents) { + let cX; + let cY; + let cZ; cX = this._maxX - this._minX; cY = this._maxY - this._minY; cZ = this._maxZ - this._minZ; @@ -2995,7 +2980,7 @@ oimo_collision_geometry_Aabb.prototype = { halfExtents.y = cY; halfExtents.z = cZ; } - ,combine: function(other) { + combine(other) { this._minX = this._minX < other._minX ? this._minX : other._minX; this._minY = this._minY < other._minY ? this._minY : other._minY; this._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; @@ -3004,8 +2989,8 @@ oimo_collision_geometry_Aabb.prototype = { this._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; return this; } - ,combined: function(other) { - var aabb = new oimo_collision_geometry_Aabb(); + combined(other) { + let aabb = new oimo_collision_geometry_Aabb(); aabb._minX = this._minX < other._minX ? this._minX : other._minX; aabb._minY = this._minY < other._minY ? this._minY : other._minY; aabb._minZ = this._minZ < other._minZ ? this._minZ : other._minZ; @@ -3014,15 +2999,15 @@ oimo_collision_geometry_Aabb.prototype = { aabb._maxZ = this._maxZ > other._maxZ ? this._maxZ : other._maxZ; return aabb; } - ,overlap: function(other) { + overlap(other) { if(this._minX < other._maxX && this._maxX > other._minX && this._minY < other._maxY && this._maxY > other._minY && this._minZ < other._maxZ) { return this._maxZ > other._minZ; } else { return false; } } - ,getIntersection: function(other) { - var aabb = new oimo_collision_geometry_Aabb(); + getIntersection(other) { + let aabb = new oimo_collision_geometry_Aabb(); aabb._minX = this._minX > other._minX ? this._minX : other._minX; aabb._minY = this._minY > other._minY ? this._minY : other._minY; aabb._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; @@ -3031,7 +3016,7 @@ oimo_collision_geometry_Aabb.prototype = { aabb._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; return aabb; } - ,getIntersectionTo: function(other,intersection) { + getIntersectionTo(other,intersection) { intersection._minX = this._minX > other._minX ? this._minX : other._minX; intersection._minY = this._minY > other._minY ? this._minY : other._minY; intersection._minZ = this._minZ > other._minZ ? this._minZ : other._minZ; @@ -3039,7 +3024,7 @@ oimo_collision_geometry_Aabb.prototype = { intersection._maxY = this._maxY < other._maxY ? this._maxY : other._maxY; intersection._maxZ = this._maxZ < other._maxZ ? this._maxZ : other._maxZ; } - ,copyFrom: function(aabb) { + copyFrom(aabb) { this._minX = aabb._minX; this._minY = aabb._minY; this._minZ = aabb._minZ; @@ -3048,8 +3033,8 @@ oimo_collision_geometry_Aabb.prototype = { this._maxZ = aabb._maxZ; return this; } - ,clone: function() { - var aabb = new oimo_collision_geometry_Aabb(); + clone() { + let aabb = new oimo_collision_geometry_Aabb(); aabb._minX = this._minX; aabb._minY = this._minY; aabb._minZ = this._minZ; @@ -3058,46 +3043,45 @@ oimo_collision_geometry_Aabb.prototype = { aabb._maxZ = this._maxZ; return aabb; } -}; -var oimo_collision_geometry_BoxGeometry = function(halfExtents) { - oimo_collision_geometry_ConvexGeometry.call(this,1); - this._halfExtentsX = halfExtents.x; - this._halfExtentsY = halfExtents.y; - this._halfExtentsZ = halfExtents.z; - this._halfAxisXX = halfExtents.x; - this._halfAxisXY = 0; - this._halfAxisXZ = 0; - this._halfAxisYX = 0; - this._halfAxisYY = halfExtents.y; - this._halfAxisYZ = 0; - this._halfAxisZX = 0; - this._halfAxisZY = 0; - this._halfAxisZZ = halfExtents.z; - this._updateMass(); - var minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; - if(this._gjkMargin > minHalfExtents * 0.2) { - this._gjkMargin = minHalfExtents * 0.2; - } -}; -oimo_collision_geometry_BoxGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getHalfExtents: function() { - var v = new oimo_common_Vec3(); +} +class oimo_collision_geometry_BoxGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(halfExtents) { + super(1); + this._halfExtentsX = halfExtents.x; + this._halfExtentsY = halfExtents.y; + this._halfExtentsZ = halfExtents.z; + this._halfAxisXX = halfExtents.x; + this._halfAxisXY = 0; + this._halfAxisXZ = 0; + this._halfAxisYX = 0; + this._halfAxisYY = halfExtents.y; + this._halfAxisYZ = 0; + this._halfAxisZX = 0; + this._halfAxisZY = 0; + this._halfAxisZZ = halfExtents.z; + this._updateMass(); + let minHalfExtents = halfExtents.x < halfExtents.y ? halfExtents.z < halfExtents.x ? halfExtents.z : halfExtents.x : halfExtents.z < halfExtents.y ? halfExtents.z : halfExtents.y; + if(this._gjkMargin > minHalfExtents * 0.2) { + this._gjkMargin = minHalfExtents * 0.2; + } + } + getHalfExtents() { + let v = new oimo_common_Vec3(); v.x = this._halfExtentsX; v.y = this._halfExtentsY; v.z = this._halfExtentsZ; return v; } - ,getHalfExtentsTo: function(halfExtents) { + getHalfExtentsTo(halfExtents) { halfExtents.x = this._halfExtentsX; halfExtents.y = this._halfExtentsY; halfExtents.z = this._halfExtentsZ; } - ,_updateMass: function() { + _updateMass() { this._volume = 8 * (this._halfExtentsX * this._halfExtentsY * this._halfExtentsZ); - var sqX; - var sqY; - var sqZ; + let sqX; + let sqY; + let sqZ; sqX = this._halfExtentsX * this._halfExtentsX; sqY = this._halfExtentsY * this._halfExtentsY; sqZ = this._halfExtentsZ * this._halfExtentsZ; @@ -3111,55 +3095,73 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 0.33333333333333331 * (sqX + sqY); } - ,_computeAabb: function(aabb,tf) { - var tfxX; - var tfxY; - var tfxZ; - var tfyX; - var tfyY; - var tfyZ; - var tfzX; - var tfzY; - var tfzZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + _computeAabb(aabb,tf) { + let tfxX; + let tfxY; + let tfxZ; + let tfyX; + let tfyY; + let tfyZ; + let tfzX; + let tfzY; + let tfzZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * this._halfAxisXX + tf._rotation01 * this._halfAxisXY + tf._rotation02 * this._halfAxisXZ; __tmp__Y = tf._rotation10 * this._halfAxisXX + tf._rotation11 * this._halfAxisXY + tf._rotation12 * this._halfAxisXZ; __tmp__Z = tf._rotation20 * this._halfAxisXX + tf._rotation21 * this._halfAxisXY + tf._rotation22 * this._halfAxisXZ; tfxX = __tmp__X; tfxY = __tmp__Y; tfxZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; __tmp__Y1 = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; __tmp__Z1 = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; tfyX = __tmp__X1; tfyY = __tmp__Y1; tfyZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; __tmp__Y2 = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; __tmp__Z2 = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; tfzX = __tmp__X2; tfzY = __tmp__Y2; tfzZ = __tmp__Z2; - tfxX = tfxX < 0 ? -tfxX : tfxX; - tfxY = tfxY < 0 ? -tfxY : tfxY; - tfxZ = tfxZ < 0 ? -tfxZ : tfxZ; - tfyX = tfyX < 0 ? -tfyX : tfyX; - tfyY = tfyY < 0 ? -tfyY : tfyY; - tfyZ = tfyZ < 0 ? -tfyZ : tfyZ; - tfzX = tfzX < 0 ? -tfzX : tfzX; - tfzY = tfzY < 0 ? -tfzY : tfzY; - tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; - var tfsX; - var tfsY; - var tfsZ; + if(tfxX < 0) { + tfxX = -tfxX; + } + if(tfxY < 0) { + tfxY = -tfxY; + } + if(tfxZ < 0) { + tfxZ = -tfxZ; + } + if(tfyX < 0) { + tfyX = -tfyX; + } + if(tfyY < 0) { + tfyY = -tfyY; + } + if(tfyZ < 0) { + tfyZ = -tfyZ; + } + if(tfzX < 0) { + tfzX = -tfzX; + } + if(tfzY < 0) { + tfzY = -tfzY; + } + if(tfzZ < 0) { + tfzZ = -tfzZ; + } + let tfsX; + let tfsY; + let tfsZ; tfsX = tfxX + tfyX; tfsY = tfxY + tfyY; tfsZ = tfxZ + tfyZ; @@ -3173,19 +3175,25 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ aabb._maxY = tf._positionY + tfsY; aabb._maxZ = tf._positionZ + tfsZ; } - ,computeLocalSupportingVertex: function(dir,out) { - var gjkMarginsX; - var gjkMarginsY; - var gjkMarginsZ; - var coreExtentsX; - var coreExtentsY; - var coreExtentsZ; + computeLocalSupportingVertex(dir,out) { + let gjkMarginsX; + let gjkMarginsY; + let gjkMarginsZ; + let coreExtentsX; + let coreExtentsY; + let coreExtentsZ; gjkMarginsX = this._gjkMargin; gjkMarginsY = this._gjkMargin; gjkMarginsZ = this._gjkMargin; - gjkMarginsX = gjkMarginsX < this._halfExtentsX ? gjkMarginsX : this._halfExtentsX; - gjkMarginsY = gjkMarginsY < this._halfExtentsY ? gjkMarginsY : this._halfExtentsY; - gjkMarginsZ = gjkMarginsZ < this._halfExtentsZ ? gjkMarginsZ : this._halfExtentsZ; + if(!(gjkMarginsX < this._halfExtentsX)) { + gjkMarginsX = this._halfExtentsX; + } + if(!(gjkMarginsY < this._halfExtentsY)) { + gjkMarginsY = this._halfExtentsY; + } + if(!(gjkMarginsZ < this._halfExtentsZ)) { + gjkMarginsZ = this._halfExtentsZ; + } coreExtentsX = this._halfExtentsX - gjkMarginsX; coreExtentsY = this._halfExtentsY - gjkMarginsY; coreExtentsZ = this._halfExtentsZ - gjkMarginsZ; @@ -3193,29 +3201,29 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ out.y = dir.y > 0 ? coreExtentsY : -coreExtentsY; out.z = dir.z > 0 ? coreExtentsZ : -coreExtentsZ; } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var halfW = this._halfExtentsX; - var halfH = this._halfExtentsY; - var halfD = this._halfExtentsZ; - var dx = endX - beginX; - var dy = endY - beginY; - var dz = endZ - beginZ; - var tminx = 0; - var tminy = 0; - var tminz = 0; - var tmaxx = 1; - var tmaxy = 1; - var tmaxz = 1; + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + let halfW = this._halfExtentsX; + let halfH = this._halfExtentsY; + let halfD = this._halfExtentsZ; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminx = 0; + let tminy = 0; + let tminz = 0; + let tmaxx = 1; + let tmaxy = 1; + let tmaxz = 1; if(dx > -1e-6 && dx < 1e-6) { if(beginX <= -halfW || beginX >= halfW) { return false; } } else { - var invDx = 1 / dx; - var t1 = (-halfW - beginX) * invDx; - var t2 = (halfW - beginX) * invDx; + let invDx = 1 / dx; + let t1 = (-halfW - beginX) * invDx; + let t2 = (halfW - beginX) * invDx; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -3231,19 +3239,19 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ return false; } } else { - var invDy = 1 / dy; - var t11 = (-halfH - beginY) * invDy; - var t21 = (halfH - beginY) * invDy; - if(t11 > t21) { - var tmp1 = t11; - t11 = t21; - t21 = tmp1; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; + if(t1 > t2) { + let tmp = t1; + t1 = t2; + t2 = tmp; } - if(t11 > 0) { - tminy = t11; + if(t1 > 0) { + tminy = t1; } - if(t21 < 1) { - tmaxy = t21; + if(t2 < 1) { + tmaxy = t2; } } if(dz > -1e-6 && dz < 1e-6) { @@ -3251,27 +3259,27 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ return false; } } else { - var invDz = 1 / dz; - var t12 = (-halfD - beginZ) * invDz; - var t22 = (halfD - beginZ) * invDz; - if(t12 > t22) { - var tmp2 = t12; - t12 = t22; - t22 = tmp2; + let invDz = 1 / dz; + let t1 = (-halfD - beginZ) * invDz; + let t2 = (halfD - beginZ) * invDz; + if(t1 > t2) { + let tmp = t1; + t1 = t2; + t2 = tmp; } - if(t12 > 0) { - tminz = t12; + if(t1 > 0) { + tminz = t1; } - if(t22 < 1) { - tmaxz = t22; + if(t2 < 1) { + tmaxz = t2; } } if(tminx >= 1 || tminy >= 1 || tminz >= 1 || tmaxx <= 0 || tmaxy <= 0 || tmaxz <= 0) { return false; } - var min = tminx; - var max = tmaxx; - var hitDirection = 0; + let min = tminx; + let max = tmaxx; + let hitDirection = 0; if(tminy > min) { min = tminy; hitDirection = 1; @@ -3307,30 +3315,29 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ hit.fraction = min; return true; } -}); -var oimo_collision_geometry_CapsuleGeometry = function(radius,halfHeight) { - oimo_collision_geometry_ConvexGeometry.call(this,4); - this._radius = radius; - this._halfHeight = halfHeight; - this._gjkMargin = this._radius; - this._updateMass(); -}; -oimo_collision_geometry_CapsuleGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getRadius: function() { +} +class oimo_collision_geometry_CapsuleGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(radius,halfHeight) { + super(4); + this._radius = radius; + this._halfHeight = halfHeight; + this._gjkMargin = this._radius; + this._updateMass(); + } + getRadius() { return this._radius; } - ,getHalfHeight: function() { + getHalfHeight() { return this._halfHeight; } - ,_updateMass: function() { - var r2 = this._radius * this._radius; - var hh2 = this._halfHeight * this._halfHeight; - var cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; - var sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; + _updateMass() { + let r2 = this._radius * this._radius; + let hh2 = this._halfHeight * this._halfHeight; + let cylinderVolume = 6.28318530717958 * r2 * this._halfHeight; + let sphereVolume = 3.14159265358979 * r2 * this._radius * 4 / 3; this._volume = cylinderVolume + sphereVolume; - var invVolume = this._volume == 0 ? 0 : 1 / this._volume; - var inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); + let invVolume = this._volume == 0 ? 0 : 1 / this._volume; + let inertiaXZ = invVolume * (cylinderVolume * (r2 * 0.25 + hh2 / 3) + sphereVolume * (r2 * 0.4 + this._halfHeight * this._radius * 0.75 + hh2)); this._inertiaCoeff00 = inertiaXZ; this._inertiaCoeff01 = 0; this._inertiaCoeff02 = 0; @@ -3341,22 +3348,28 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome this._inertiaCoeff21 = 0; this._inertiaCoeff22 = inertiaXZ; } - ,_computeAabb: function(aabb,tf) { - var radVecX; - var radVecY; - var radVecZ; + _computeAabb(aabb,tf) { + let radVecX; + let radVecY; + let radVecZ; radVecX = this._radius; radVecY = this._radius; radVecZ = this._radius; - var axisX; - var axisY; - var axisZ; + let axisX; + let axisY; + let axisZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axisX *= this._halfHeight; axisY *= this._halfHeight; axisZ *= this._halfHeight; @@ -3370,28 +3383,28 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome aabb._maxY = tf._positionY + radVecY; aabb._maxZ = tf._positionZ + radVecZ; } - ,computeLocalSupportingVertex: function(dir,out) { + computeLocalSupportingVertex(dir,out) { if(dir.y > 0) { out.init(0,this._halfHeight,0); } else { out.init(0,-this._halfHeight,0); } } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var halfH = this._halfHeight; - var dx = endX - beginX; - var dz = endZ - beginZ; - var tminxz = 0; - var tmaxxz = 1; - var a = dx * dx + dz * dz; - var b = beginX * dx + beginZ * dz; - var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; - var D = b * b - a * c; + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + let halfH = this._halfHeight; + let dx = endX - beginX; + let dz = endZ - beginZ; + let tminxz = 0; + let tmaxxz = 1; + let a = dx * dx + dz * dz; + let b = beginX * dx + beginZ * dz; + let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + let D = b * b - a * c; if(D < 0) { return false; } if(a > 0) { - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; tmaxxz = (-b + sqrtD) / a; if(tminxz >= 1 || tmaxxz <= 0) { @@ -3404,13 +3417,13 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome tminxz = 0; tmaxxz = 1; } - var crossY = beginY + (endY - beginY) * tminxz; - var min; + let crossY = beginY + (endY - beginY) * tminxz; + let min; if(crossY > -halfH && crossY < halfH) { if(tminxz > 0) { min = tminxz; - var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } @@ -3423,21 +3436,21 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome } return false; } - var spherePosX; - var spherePosY; - var spherePosZ; - var sphereToBeginX; - var sphereToBeginY; - var sphereToBeginZ; + let spherePosX; + let spherePosY; + let spherePosZ; + let sphereToBeginX; + let sphereToBeginY; + let sphereToBeginZ; spherePosX = 0; spherePosY = crossY < 0 ? -halfH : halfH; spherePosZ = 0; sphereToBeginX = beginX - spherePosX; sphereToBeginY = beginY - spherePosY; sphereToBeginZ = beginZ - spherePosZ; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = endX - beginX; dY = endY - beginY; dZ = endZ - beginZ; @@ -3448,20 +3461,20 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome if(D < 0) { return false; } - var t = (-b - Math.sqrt(D)) / a; + let t = (-b - Math.sqrt(D)) / a; if(t < 0 || t > 1) { return false; } - var hitPosX; - var hitPosY; - var hitPosZ; - var hitNormalX; - var hitNormalY; - var hitNormalZ; + let hitPosX; + let hitPosY; + let hitPosZ; + let hitNormalX; + let hitNormalY; + let hitNormalZ; hitPosX = sphereToBeginX + dX * t; hitPosY = sphereToBeginY + dY * t; hitPosZ = sphereToBeginZ + dZ * t; - var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + let l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -3471,37 +3484,36 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome hitPosX += spherePosX; hitPosY += spherePosY; hitPosZ += spherePosZ; - var v = hit.position; + let v = hit.position; v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; + let v1 = hit.normal; v1.x = hitNormalX; v1.y = hitNormalY; v1.z = hitNormalZ; hit.fraction = t; return true; } -}); -var oimo_collision_geometry_ConeGeometry = function(radius,halfHeight) { - oimo_collision_geometry_ConvexGeometry.call(this,3); - this._radius = radius; - this._halfHeight = halfHeight; - this.sinTheta = radius / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); - this.cosTheta = 2 * halfHeight / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); - this._updateMass(); -}; -oimo_collision_geometry_ConeGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getRadius: function() { +} +class oimo_collision_geometry_ConeGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(radius,halfHeight) { + super(3); + this._radius = radius; + this._halfHeight = halfHeight; + this.sinTheta = radius / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this.cosTheta = 2 * halfHeight / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + this._updateMass(); + } + getRadius() { return this._radius; } - ,getHalfHeight: function() { + getHalfHeight() { return this._halfHeight; } - ,_updateMass: function() { - var r2 = this._radius * this._radius; - var h2 = this._halfHeight * this._halfHeight * 4; + _updateMass() { + let r2 = this._radius * this._radius; + let h2 = this._halfHeight * this._halfHeight * 4; this._volume = 3.14159265358979 * r2 * this._halfHeight * 2 / 3; this._inertiaCoeff00 = 0.05 * (3 * r2 + 2 * h2); this._inertiaCoeff01 = 0; @@ -3513,19 +3525,19 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 0.05 * (3 * r2 + 2 * h2); } - ,_computeAabb: function(aabb,tf) { - var axisX; - var axisY; - var axisZ; - var axis2X; - var axis2Y; - var axis2Z; - var ehX; - var ehY; - var ehZ; - var erX; - var erY; - var erZ; + _computeAabb(aabb,tf) { + let axisX; + let axisY; + let axisZ; + let axis2X; + let axis2Y; + let axis2Z; + let ehX; + let ehY; + let ehZ; + let erX; + let erY; + let erZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; @@ -3541,12 +3553,12 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var rminX; - var rminY; - var rminZ; - var rmaxX; - var rmaxY; - var rmaxZ; + let rminX; + let rminY; + let rminZ; + let rmaxX; + let rmaxY; + let rmaxZ; rminX = -ehX; rminY = -ehY; rminZ = -ehZ; @@ -3559,24 +3571,36 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry rmaxX += erX; rmaxY += erY; rmaxZ += erZ; - var maxX; - var maxY; - var maxZ; - var minX; - var minY; - var minZ; + let maxX; + let maxY; + let maxZ; + let minX; + let minY; + let minZ; maxX = rminX > rmaxX ? rminX : rmaxX; maxY = rminY > rmaxY ? rminY : rmaxY; maxZ = rminZ > rmaxZ ? rminZ : rmaxZ; - maxX = maxX > ehX ? maxX : ehX; - maxY = maxY > ehY ? maxY : ehY; - maxZ = maxZ > ehZ ? maxZ : ehZ; + if(!(maxX > ehX)) { + maxX = ehX; + } + if(!(maxY > ehY)) { + maxY = ehY; + } + if(!(maxZ > ehZ)) { + maxZ = ehZ; + } minX = rminX < rmaxX ? rminX : rmaxX; minY = rminY < rmaxY ? rminY : rmaxY; minZ = rminZ < rmaxZ ? rminZ : rmaxZ; - minX = minX < ehX ? minX : ehX; - minY = minY < ehY ? minY : ehY; - minZ = minZ < ehZ ? minZ : ehZ; + if(!(minX < ehX)) { + minX = ehX; + } + if(!(minY < ehY)) { + minY = ehY; + } + if(!(minZ < ehZ)) { + minZ = ehZ; + } aabb._minX = tf._positionX + minX; aabb._minY = tf._positionY + minY; aabb._minZ = tf._positionZ + minZ; @@ -3584,10 +3608,10 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry aabb._maxY = tf._positionY + maxY; aabb._maxZ = tf._positionZ + maxZ; } - ,computeLocalSupportingVertex: function(dir,out) { - var dx = dir.x; - var dy = dir.y; - var dz = dir.z; + computeLocalSupportingVertex(dir,out) { + let dx = dir.x; + let dy = dir.y; + let dz = dir.z; if(dy > 0 && dy * dy > this.sinTheta * this.sinTheta * (dx * dx + dy * dy + dz * dz)) { out.init(0,this._halfHeight - this._gjkMargin / this.sinTheta,0); if(out.y < 0) { @@ -3595,16 +3619,16 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry } return; } - var rx = dir.x; - var rz = dir.z; - var len = rx * rx + rz * rz; - var height = 2 * this._halfHeight; - var coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; + let rx = dir.x; + let rz = dir.z; + let len = rx * rx + rz * rz; + let height = 2 * this._halfHeight; + let coreRadius = (height - this._gjkMargin) / height * this._radius - this._gjkMargin / this.cosTheta; if(coreRadius < 0) { coreRadius = 0; } - var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; - var coreHalfHeight = this._halfHeight - this._gjkMargin; + let invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + let coreHalfHeight = this._halfHeight - this._gjkMargin; if(coreHalfHeight < 0) { coreHalfHeight = 0; } @@ -3612,24 +3636,24 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry out.y = -coreHalfHeight; out.z = rz * invLen; } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var p1y = beginY; - var halfH = this._halfHeight; - var dx = endX - beginX; - var dy = endY - beginY; - var dz = endZ - beginZ; - var tminy = 0; - var tmaxy = 1; + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + let p1y = beginY; + let halfH = this._halfHeight; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminy = 0; + let tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { if(beginY <= -halfH || beginY >= halfH) { return false; } } else { - var invDy = 1 / dy; - var t1 = (-halfH - beginY) * invDy; - var t2 = (halfH - beginY) * invDy; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -3643,19 +3667,19 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry if(tminy >= 1 || tmaxy <= 0) { return false; } - var tminxz = 0; - var tmaxxz = 0; + let tminxz = 0; + let tmaxxz = 0; p1y = beginY - halfH; - var cos2 = this.cosTheta * this.cosTheta; - var a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; - var b = cos2 * (beginX * dx + p1y * dy + beginZ * dz) - p1y * dy; - var c = cos2 * (beginX * beginX + p1y * p1y + beginZ * beginZ) - p1y * p1y; - var D = b * b - a * c; + let cos2 = this.cosTheta * this.cosTheta; + let a = cos2 * (dx * dx + dy * dy + dz * dz) - dy * dy; + let b = cos2 * (beginX * dx + p1y * dy + beginZ * dz) - p1y * dy; + let c = cos2 * (beginX * beginX + p1y * p1y + beginZ * beginZ) - p1y * p1y; + let D = b * b - a * c; if(a != 0) { if(D < 0) { return false; } - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); if(a < 0) { if(dy > 0) { tminxz = 0; @@ -3678,7 +3702,7 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry } } } else { - var t = -c / (2 * b); + let t = -c / (2 * b); if(b > 0) { tminxz = 0; tmaxxz = t; @@ -3694,7 +3718,7 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry } } p1y += halfH; - var min; + let min; if(tmaxxz <= tminy || tmaxy <= tminxz) { return false; } @@ -3709,15 +3733,15 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry if(min == 0) { return false; } - var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } _this.x *= invLen; _this.y *= invLen; _this.z *= invLen; - var s = this.cosTheta; + let s = this.cosTheta; _this.x *= s; _this.y *= s; _this.z *= s; @@ -3727,28 +3751,27 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry hit.fraction = min; return true; } -}); -var oimo_collision_geometry_ConvexHullGeometry = function(vertices) { - oimo_collision_geometry_ConvexGeometry.call(this,5); - this._numVertices = vertices.length; - this._vertices = new Array(this._numVertices); - this._tmpVertices = new Array(this._numVertices); - var _g = 0; - var _g1 = this._numVertices; - while(_g < _g1) { - var i = _g++; - this._vertices[i] = vertices[i]; - this._tmpVertices[i] = new oimo_common_Vec3(); - } - this._useGjkRayCast = true; - this._updateMass(); -}; -oimo_collision_geometry_ConvexHullGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getVertices: function() { +} +class oimo_collision_geometry_ConvexHullGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(vertices) { + super(5); + this._numVertices = vertices.length; + this._vertices = new Array(this._numVertices); + this._tmpVertices = new Array(this._numVertices); + let _g = 0; + let _g1 = this._numVertices; + while(_g < _g1) { + let i = _g++; + this._vertices[i] = vertices[i]; + this._tmpVertices[i] = new oimo_common_Vec3(); + } + this._useGjkRayCast = true; + this._updateMass(); + } + getVertices() { return this._vertices; } - ,_updateMass: function() { + _updateMass() { this._volume = 1; this._inertiaCoeff00 = 1; this._inertiaCoeff01 = 0; @@ -3759,19 +3782,19 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge this._inertiaCoeff20 = 0; this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 1; - var minx = this._vertices[0].x; - var miny = this._vertices[0].y; - var minz = this._vertices[0].z; - var maxx = this._vertices[0].x; - var maxy = this._vertices[0].y; - var maxz = this._vertices[0].z; - var _g = 1; - var _g1 = this._numVertices; + let minx = this._vertices[0].x; + let miny = this._vertices[0].y; + let minz = this._vertices[0].z; + let maxx = this._vertices[0].x; + let maxy = this._vertices[0].y; + let maxz = this._vertices[0].z; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; - var vx = this._vertices[i].x; - var vy = this._vertices[i].y; - var vz = this._vertices[i].z; + let i = _g++; + let vx = this._vertices[i].x; + let vy = this._vertices[i].y; + let vz = this._vertices[i].z; if(vx < minx) { minx = vx; } else if(vx > maxx) { @@ -3788,11 +3811,11 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge maxz = vz; } } - var sizex = maxx - minx; - var sizey = maxy - miny; - var sizez = maxz - minz; + let sizex = maxx - minx; + let sizey = maxy - miny; + let sizez = maxz - minz; this._volume = sizex * sizey * sizez; - var diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; + let diffCog = ((minx + maxx) * (minx + maxx) + (miny + maxy) * (miny + maxy) + (minz + maxz) * (minz + maxz)) * 0.25; sizex = sizex * sizex * 0.25; sizey = sizey * sizey * 0.25; sizez = sizez * sizez * 0.25; @@ -3806,32 +3829,32 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 0.33333333333333331 * (sizex + sizey) + diffCog; } - ,_computeAabb: function(aabb,tf) { - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; - var marginX; - var marginY; - var marginZ; + _computeAabb(aabb,tf) { + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; + let marginX; + let marginY; + let marginZ; marginX = this._gjkMargin; marginY = this._gjkMargin; marginZ = this._gjkMargin; - var localVX; - var localVY; - var localVZ; - var v = this._vertices[0]; + let localVX; + let localVY; + let localVZ; + let v = this._vertices[0]; localVX = v.x; localVY = v.y; localVZ = v.z; - var worldVX; - var worldVY; - var worldVZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let worldVX; + let worldVY; + let worldVZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; @@ -3847,31 +3870,43 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge maxX = worldVX; maxY = worldVY; maxZ = worldVZ; - var _g = 1; - var _g1 = this._numVertices; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var v1 = this._vertices[_g++]; - localVX = v1.x; - localVY = v1.y; - localVZ = v1.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; - __tmp__Y1 = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; - __tmp__Z1 = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; - worldVX = __tmp__X1; - worldVY = __tmp__Y1; - worldVZ = __tmp__Z1; + let v = this._vertices[_g++]; + localVX = v.x; + localVY = v.y; + localVZ = v.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X; + worldVY = __tmp__Y; + worldVZ = __tmp__Z; worldVX += tf._positionX; worldVY += tf._positionY; worldVZ += tf._positionZ; - minX = minX < worldVX ? minX : worldVX; - minY = minY < worldVY ? minY : worldVY; - minZ = minZ < worldVZ ? minZ : worldVZ; - maxX = maxX > worldVX ? maxX : worldVX; - maxY = maxY > worldVY ? maxY : worldVY; - maxZ = maxZ > worldVZ ? maxZ : worldVZ; + if(!(minX < worldVX)) { + minX = worldVX; + } + if(!(minY < worldVY)) { + minY = worldVY; + } + if(!(minZ < worldVZ)) { + minZ = worldVZ; + } + if(!(maxX > worldVX)) { + maxX = worldVX; + } + if(!(maxY > worldVY)) { + maxY = worldVY; + } + if(!(maxZ > worldVZ)) { + maxZ = worldVZ; + } } aabb._minX = minX - marginX; aabb._minY = minY - marginY; @@ -3880,44 +3915,43 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge aabb._maxY = maxY + marginY; aabb._maxZ = maxZ + marginZ; } - ,computeLocalSupportingVertex: function(dir,out) { - var _this = this._vertices[0]; - var maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; - var maxIndex = 0; - var _g = 1; - var _g1 = this._numVertices; + computeLocalSupportingVertex(dir,out) { + let _this = this._vertices[0]; + let maxDot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; + let maxIndex = 0; + let _g = 1; + let _g1 = this._numVertices; while(_g < _g1) { - var i = _g++; - var _this1 = this._vertices[i]; - var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; + let i = _g++; + let _this = this._vertices[i]; + let dot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; if(dot > maxDot) { maxDot = dot; maxIndex = i; } } - var v = this._vertices[maxIndex]; + let v = this._vertices[maxIndex]; out.x = v.x; out.y = v.y; out.z = v.z; } -}); -var oimo_collision_geometry_CylinderGeometry = function(radius,halfHeight) { - oimo_collision_geometry_ConvexGeometry.call(this,2); - this._radius = radius; - this._halfHeight = halfHeight; - this._updateMass(); -}; -oimo_collision_geometry_CylinderGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getRadius: function() { +} +class oimo_collision_geometry_CylinderGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(radius,halfHeight) { + super(2); + this._radius = radius; + this._halfHeight = halfHeight; + this._updateMass(); + } + getRadius() { return this._radius; } - ,getHalfHeight: function() { + getHalfHeight() { return this._halfHeight; } - ,_updateMass: function() { - var r2 = this._radius * this._radius; - var h2 = this._halfHeight * this._halfHeight * 4; + _updateMass() { + let r2 = this._radius * this._radius; + let h2 = this._halfHeight * this._halfHeight * 4; this._volume = 3.14159265358979 * r2 * this._halfHeight * 2; this._inertiaCoeff00 = 0.083333333333333329 * (3 * r2 + h2); this._inertiaCoeff01 = 0; @@ -3929,25 +3963,31 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 0.083333333333333329 * (3 * r2 + h2); } - ,_computeAabb: function(aabb,tf) { - var axisX; - var axisY; - var axisZ; - var axis2X; - var axis2Y; - var axis2Z; - var ehX; - var ehY; - var ehZ; - var erX; - var erY; - var erZ; + _computeAabb(aabb,tf) { + let axisX; + let axisY; + let axisZ; + let axis2X; + let axis2Y; + let axis2Z; + let ehX; + let ehY; + let ehZ; + let erX; + let erY; + let erZ; axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; @@ -3960,9 +4000,9 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom ehX = axisX * this._halfHeight; ehY = axisY * this._halfHeight; ehZ = axisZ * this._halfHeight; - var maxX; - var maxY; - var maxZ; + let maxX; + let maxY; + let maxZ; maxX = erX + ehX; maxY = erY + ehY; maxZ = erZ + ehZ; @@ -3973,16 +4013,16 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom aabb._maxY = tf._positionY + maxY; aabb._maxZ = tf._positionZ + maxZ; } - ,computeLocalSupportingVertex: function(dir,out) { - var rx = dir.x; - var rz = dir.z; - var len = rx * rx + rz * rz; - var coreRadius = this._radius - this._gjkMargin; + computeLocalSupportingVertex(dir,out) { + let rx = dir.x; + let rz = dir.z; + let len = rx * rx + rz * rz; + let coreRadius = this._radius - this._gjkMargin; if(coreRadius < 0) { coreRadius = 0; } - var invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; - var coreHeight = this._halfHeight - this._gjkMargin; + let invLen = len > 0 ? coreRadius / Math.sqrt(len) : 0; + let coreHeight = this._halfHeight - this._gjkMargin; if(coreHeight < 0) { coreHeight = 0; } @@ -3990,23 +4030,23 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom out.y = dir.y > 0 ? coreHeight : -coreHeight; out.z = rz * invLen; } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var halfH = this._halfHeight; - var dx = endX - beginX; - var dy = endY - beginY; - var dz = endZ - beginZ; - var tminy = 0; - var tmaxy = 1; + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + let halfH = this._halfHeight; + let dx = endX - beginX; + let dy = endY - beginY; + let dz = endZ - beginZ; + let tminy = 0; + let tmaxy = 1; if(dy > -1e-6 && dy < 1e-6) { if(beginY <= -halfH || beginY >= halfH) { return false; } } else { - var invDy = 1 / dy; - var t1 = (-halfH - beginY) * invDy; - var t2 = (halfH - beginY) * invDy; + let invDy = 1 / dy; + let t1 = (-halfH - beginY) * invDy; + let t2 = (halfH - beginY) * invDy; if(t1 > t2) { - var tmp = t1; + let tmp = t1; t1 = t2; t2 = tmp; } @@ -4020,17 +4060,17 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom if(tminy >= 1 || tmaxy <= 0) { return false; } - var tminxz = 0; - var tmaxxz = 1; - var a = dx * dx + dz * dz; - var b = beginX * dx + beginZ * dz; - var c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; - var D = b * b - a * c; + let tminxz = 0; + let tmaxxz = 1; + let a = dx * dx + dz * dz; + let b = beginX * dx + beginZ * dz; + let c = beginX * beginX + beginZ * beginZ - this._radius * this._radius; + let D = b * b - a * c; if(D < 0) { return false; } if(a > 0) { - var sqrtD = Math.sqrt(D); + let sqrtD = Math.sqrt(D); tminxz = (-b - sqrtD) / a; tmaxxz = (-b + sqrtD) / a; if(tminxz >= 1 || tmaxxz <= 0) { @@ -4043,7 +4083,7 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom tminxz = 0; tmaxxz = 1; } - var min; + let min; if(tmaxxz <= tminy || tmaxy <= tminxz) { return false; } @@ -4058,8 +4098,8 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom if(min == 0) { return false; } - var _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = hit.normal.init(beginX + dx * min,0,beginZ + dz * min); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } @@ -4071,25 +4111,27 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom hit.fraction = min; return true; } -}); -var oimo_collision_geometry_GeometryType = function() { }; -var oimo_collision_geometry_RayCastHit = function() { - this.position = new oimo_common_Vec3(); - this.normal = new oimo_common_Vec3(); - this.fraction = 0; -}; -var oimo_collision_geometry_SphereGeometry = function(radius) { - oimo_collision_geometry_ConvexGeometry.call(this,0); - this._radius = radius; - this._gjkMargin = this._radius; - this._updateMass(); -}; -oimo_collision_geometry_SphereGeometry.__super__ = oimo_collision_geometry_ConvexGeometry; -oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geometry_ConvexGeometry.prototype,{ - getRadius: function() { +} +class oimo_collision_geometry_GeometryType { +} +class oimo_collision_geometry_RayCastHit { + constructor() { + this.position = new oimo_common_Vec3(); + this.normal = new oimo_common_Vec3(); + this.fraction = 0; + } +} +class oimo_collision_geometry_SphereGeometry extends oimo_collision_geometry_ConvexGeometry { + constructor(radius) { + super(0); + this._radius = radius; + this._gjkMargin = this._radius; + this._updateMass(); + } + getRadius() { return this._radius; } - ,_updateMass: function() { + _updateMass() { this._volume = 4.1887902047863861 * this._radius * this._radius * this._radius; this._inertiaCoeff00 = 0.4 * this._radius * this._radius; this._inertiaCoeff01 = 0; @@ -4101,10 +4143,10 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet this._inertiaCoeff21 = 0; this._inertiaCoeff22 = 0.4 * this._radius * this._radius; } - ,_computeAabb: function(aabb,tf) { - var radVecX; - var radVecY; - var radVecZ; + _computeAabb(aabb,tf) { + let radVecX; + let radVecY; + let radVecZ; radVecX = this._radius; radVecY = this._radius; radVecZ = this._radius; @@ -4115,133 +4157,133 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet aabb._maxY = tf._positionY + radVecY; aabb._maxZ = tf._positionZ + radVecZ; } - ,computeLocalSupportingVertex: function(dir,out) { + computeLocalSupportingVertex(dir,out) { out.zero(); } - ,_rayCastLocal: function(beginX,beginY,beginZ,endX,endY,endZ,hit) { - var dX; - var dY; - var dZ; + _rayCastLocal(beginX,beginY,beginZ,endX,endY,endZ,hit) { + let dX; + let dY; + let dZ; dX = endX - beginX; dY = endY - beginY; dZ = endZ - beginZ; - var a = dX * dX + dY * dY + dZ * dZ; - var b = beginX * dX + beginY * dY + beginZ * dZ; - var D = b * b - a * (beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius); + let a = dX * dX + dY * dY + dZ * dZ; + let b = beginX * dX + beginY * dY + beginZ * dZ; + let D = b * b - a * (beginX * beginX + beginY * beginY + beginZ * beginZ - this._radius * this._radius); if(D < 0) { return false; } - var t = (-b - Math.sqrt(D)) / a; + let t = (-b - Math.sqrt(D)) / a; if(t < 0 || t > 1) { return false; } - var hitPosX; - var hitPosY; - var hitPosZ; - var hitNormalX; - var hitNormalY; - var hitNormalZ; + let hitPosX; + let hitPosY; + let hitPosZ; + let hitNormalX; + let hitNormalY; + let hitNormalZ; hitPosX = beginX + dX * t; hitPosY = beginY + dY * t; hitPosZ = beginZ + dZ * t; - var l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; + let l = hitPosX * hitPosX + hitPosY * hitPosY + hitPosZ * hitPosZ; if(l > 0) { l = 1 / Math.sqrt(l); } hitNormalX = hitPosX * l; hitNormalY = hitPosY * l; hitNormalZ = hitPosZ * l; - var v = hit.position; + let v = hit.position; v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; + let v1 = hit.normal; v1.x = hitNormalX; v1.y = hitNormalY; v1.z = hitNormalZ; hit.fraction = t; return true; } -}); -var oimo_collision_narrowphase_CollisionMatrix = function() { - this.detectors = new Array(8); - this.detectors[0] = new Array(8); - this.detectors[1] = new Array(8); - this.detectors[2] = new Array(8); - this.detectors[3] = new Array(8); - this.detectors[4] = new Array(8); - this.detectors[5] = new Array(8); - var gjkEpaDetector = new oimo_collision_narrowphase_detector_GjkEpaDetector(); - this.detectors[0][0] = new oimo_collision_narrowphase_detector_SphereSphereDetector(); - this.detectors[0][1] = new oimo_collision_narrowphase_detector_SphereBoxDetector(false); - this.detectors[0][2] = gjkEpaDetector; - this.detectors[0][3] = gjkEpaDetector; - this.detectors[0][4] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(false); - this.detectors[0][5] = gjkEpaDetector; - this.detectors[1][0] = new oimo_collision_narrowphase_detector_SphereBoxDetector(true); - this.detectors[1][1] = new oimo_collision_narrowphase_detector_BoxBoxDetector(); - this.detectors[1][2] = gjkEpaDetector; - this.detectors[1][3] = gjkEpaDetector; - this.detectors[1][4] = gjkEpaDetector; - this.detectors[1][5] = gjkEpaDetector; - this.detectors[2][0] = gjkEpaDetector; - this.detectors[2][1] = gjkEpaDetector; - this.detectors[2][2] = gjkEpaDetector; - this.detectors[2][3] = gjkEpaDetector; - this.detectors[2][4] = gjkEpaDetector; - this.detectors[2][5] = gjkEpaDetector; - this.detectors[3][0] = gjkEpaDetector; - this.detectors[3][1] = gjkEpaDetector; - this.detectors[3][2] = gjkEpaDetector; - this.detectors[3][3] = gjkEpaDetector; - this.detectors[3][4] = gjkEpaDetector; - this.detectors[3][5] = gjkEpaDetector; - this.detectors[4][0] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(true); - this.detectors[4][1] = gjkEpaDetector; - this.detectors[4][2] = gjkEpaDetector; - this.detectors[4][3] = gjkEpaDetector; - this.detectors[4][4] = new oimo_collision_narrowphase_detector_CapsuleCapsuleDetector(); - this.detectors[4][5] = gjkEpaDetector; - this.detectors[5][0] = gjkEpaDetector; - this.detectors[5][1] = gjkEpaDetector; - this.detectors[5][2] = gjkEpaDetector; - this.detectors[5][3] = gjkEpaDetector; - this.detectors[5][4] = gjkEpaDetector; - this.detectors[5][5] = gjkEpaDetector; -}; -oimo_collision_narrowphase_CollisionMatrix.prototype = { - getDetector: function(geomType1,geomType2) { +} +class oimo_collision_narrowphase_CollisionMatrix { + constructor() { + this.detectors = new Array(8); + this.detectors[0] = new Array(8); + this.detectors[1] = new Array(8); + this.detectors[2] = new Array(8); + this.detectors[3] = new Array(8); + this.detectors[4] = new Array(8); + this.detectors[5] = new Array(8); + let gjkEpaDetector = new oimo_collision_narrowphase_detector_GjkEpaDetector(); + this.detectors[0][0] = new oimo_collision_narrowphase_detector_SphereSphereDetector(); + this.detectors[0][1] = new oimo_collision_narrowphase_detector_SphereBoxDetector(false); + this.detectors[0][2] = gjkEpaDetector; + this.detectors[0][3] = gjkEpaDetector; + this.detectors[0][4] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(false); + this.detectors[0][5] = gjkEpaDetector; + this.detectors[1][0] = new oimo_collision_narrowphase_detector_SphereBoxDetector(true); + this.detectors[1][1] = new oimo_collision_narrowphase_detector_BoxBoxDetector(); + this.detectors[1][2] = gjkEpaDetector; + this.detectors[1][3] = gjkEpaDetector; + this.detectors[1][4] = gjkEpaDetector; + this.detectors[1][5] = gjkEpaDetector; + this.detectors[2][0] = gjkEpaDetector; + this.detectors[2][1] = gjkEpaDetector; + this.detectors[2][2] = gjkEpaDetector; + this.detectors[2][3] = gjkEpaDetector; + this.detectors[2][4] = gjkEpaDetector; + this.detectors[2][5] = gjkEpaDetector; + this.detectors[3][0] = gjkEpaDetector; + this.detectors[3][1] = gjkEpaDetector; + this.detectors[3][2] = gjkEpaDetector; + this.detectors[3][3] = gjkEpaDetector; + this.detectors[3][4] = gjkEpaDetector; + this.detectors[3][5] = gjkEpaDetector; + this.detectors[4][0] = new oimo_collision_narrowphase_detector_SphereCapsuleDetector(true); + this.detectors[4][1] = gjkEpaDetector; + this.detectors[4][2] = gjkEpaDetector; + this.detectors[4][3] = gjkEpaDetector; + this.detectors[4][4] = new oimo_collision_narrowphase_detector_CapsuleCapsuleDetector(); + this.detectors[4][5] = gjkEpaDetector; + this.detectors[5][0] = gjkEpaDetector; + this.detectors[5][1] = gjkEpaDetector; + this.detectors[5][2] = gjkEpaDetector; + this.detectors[5][3] = gjkEpaDetector; + this.detectors[5][4] = gjkEpaDetector; + this.detectors[5][5] = gjkEpaDetector; + } + getDetector(geomType1,geomType2) { return this.detectors[geomType1][geomType2]; } -}; -var oimo_collision_narrowphase_DetectorResult = function() { - this.numPoints = 0; - this.normal = new oimo_common_Vec3(); - this.points = new Array(oimo_common_Setting.maxManifoldPoints); - this.incremental = false; - var _g = 0; - var _g1 = oimo_common_Setting.maxManifoldPoints; - while(_g < _g1) this.points[_g++] = new oimo_collision_narrowphase_DetectorResultPoint(); -}; -oimo_collision_narrowphase_DetectorResult.prototype = { - getMaxDepth: function() { - var max = 0; - var _g = 0; - var _g1 = this.numPoints; +} +class oimo_collision_narrowphase_DetectorResult { + constructor() { + this.numPoints = 0; + this.normal = new oimo_common_Vec3(); + this.points = new Array(oimo_common_Setting.maxManifoldPoints); + this.incremental = false; + let _g = 0; + let _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.points[_g++] = new oimo_collision_narrowphase_DetectorResultPoint(); + } + getMaxDepth() { + let max = 0; + let _g = 0; + let _g1 = this.numPoints; while(_g < _g1) { - var i = _g++; + let i = _g++; if(this.points[i].depth > max) { max = this.points[i].depth; } } return max; } - ,clear: function() { + clear() { this.numPoints = 0; - var _g = 0; - var _g1 = this.points; + let _g = 0; + let _g1 = this.points; while(_g < _g1.length) { - var p = _g1[_g]; + let p = _g1[_g]; ++_g; p.position1.zero(); p.position2.zero(); @@ -4250,61 +4292,63 @@ oimo_collision_narrowphase_DetectorResult.prototype = { } this.normal.zero(); } -}; -var oimo_collision_narrowphase_DetectorResultPoint = function() { - this.position1 = new oimo_common_Vec3(); - this.position2 = new oimo_common_Vec3(); - this.depth = 0; - this.id = 0; -}; -var oimo_collision_narrowphase_detector_Detector = function(swapped) { - this.swapped = swapped; -}; -oimo_collision_narrowphase_detector_Detector.prototype = { - setNormal: function(result,nX,nY,nZ) { - var v = result.normal; +} +class oimo_collision_narrowphase_DetectorResultPoint { + constructor() { + this.position1 = new oimo_common_Vec3(); + this.position2 = new oimo_common_Vec3(); + this.depth = 0; + this.id = 0; + } +} +class oimo_collision_narrowphase_detector_Detector { + constructor(swapped) { + this.swapped = swapped; + } + setNormal(result,nX,nY,nZ) { + let v = result.normal; v.x = nX; v.y = nY; v.z = nZ; if(this.swapped) { - var _this = result.normal; + let _this = result.normal; _this.x = -_this.x; _this.y = -_this.y; _this.z = -_this.z; } } - ,addPoint: function(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { - var p = result.points[result.numPoints++]; + addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,id) { + let p = result.points[result.numPoints++]; p.depth = depth; p.id = id; if(this.swapped) { - var v = p.position1; + let v = p.position1; v.x = pos2X; v.y = pos2Y; v.z = pos2Z; - var v1 = p.position2; + let v1 = p.position2; v1.x = pos1X; v1.y = pos1Y; v1.z = pos1Z; } else { - var v2 = p.position1; - v2.x = pos1X; - v2.y = pos1Y; - v2.z = pos1Z; - var v3 = p.position2; - v3.x = pos2X; - v3.y = pos2Y; - v3.z = pos2Z; + let v = p.position1; + v.x = pos1X; + v.y = pos1Y; + v.z = pos1Z; + let v1 = p.position2; + v1.x = pos2X; + v1.y = pos2Y; + v1.z = pos2Z; } } - ,detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { } - ,detect: function(result,geom1,geom2,transform1,transform2,cachedData) { + detect(result,geom1,geom2,transform1,transform2,cachedData) { result.numPoints = 0; - var _g = 0; - var _g1 = result.points; + let _g = 0; + let _g1 = result.points; while(_g < _g1.length) { - var p = _g1[_g]; + let p = _g1[_g]; ++_g; p.position1.zero(); p.position2.zero(); @@ -4318,26 +4362,25 @@ oimo_collision_narrowphase_detector_Detector.prototype = { this.detectImpl(result,geom1,geom2,transform1,transform2,cachedData); } } -}; -var oimo_collision_narrowphase_detector_BoxBoxDetector = function() { - oimo_collision_narrowphase_detector_Detector.call(this,false); - this.clipper = new oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper(); -}; -oimo_collision_narrowphase_detector_BoxBoxDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var b1 = geom1; - var b2 = geom2; +} +class oimo_collision_narrowphase_detector_BoxBoxDetector extends oimo_collision_narrowphase_detector_Detector { + constructor() { + super(false); + this.clipper = new oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper(); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + let b1 = geom1; + let b2 = geom2; result.incremental = false; - var c1X; - var c1Y; - var c1Z; - var c2X; - var c2Y; - var c2Z; - var c12X; - var c12Y; - var c12Z; + let c1X; + let c1Y; + let c1Z; + let c2X; + let c2Y; + let c2Z; + let c12X; + let c12Y; + let c12Z; c1X = tf1._positionX; c1Y = tf1._positionY; c1Z = tf1._positionZ; @@ -4347,24 +4390,24 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll c12X = c2X - c1X; c12Y = c2Y - c1Y; c12Z = c2Z - c1Z; - var x1X; - var x1Y; - var x1Z; - var y1X; - var y1Y; - var y1Z; - var z1X; - var z1Y; - var z1Z; - var x2X; - var x2Y; - var x2Z; - var y2X; - var y2Y; - var y2Z; - var z2X; - var z2Y; - var z2Z; + let x1X; + let x1Y; + let x1Z; + let y1X; + let y1Y; + let y1Z; + let z1X; + let z1Y; + let z1Z; + let x2X; + let x2Y; + let x2Z; + let y2X; + let y2Y; + let y2Z; + let z2X; + let z2Y; + let z2Z; x1X = tf1._rotation00; x1Y = tf1._rotation10; x1Z = tf1._rotation20; @@ -4383,30 +4426,30 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll z2X = tf2._rotation02; z2Y = tf2._rotation12; z2Z = tf2._rotation22; - var w1 = b1._halfExtentsX; - var h1 = b1._halfExtentsY; - var d1 = b1._halfExtentsZ; - var w2 = b2._halfExtentsX; - var h2 = b2._halfExtentsY; - var d2 = b2._halfExtentsZ; - var sx1X; - var sx1Y; - var sx1Z; - var sy1X; - var sy1Y; - var sy1Z; - var sz1X; - var sz1Y; - var sz1Z; - var sx2X; - var sx2Y; - var sx2Z; - var sy2X; - var sy2Y; - var sy2Z; - var sz2X; - var sz2Y; - var sz2Z; + let w1 = b1._halfExtentsX; + let h1 = b1._halfExtentsY; + let d1 = b1._halfExtentsZ; + let w2 = b2._halfExtentsX; + let h2 = b2._halfExtentsY; + let d2 = b2._halfExtentsZ; + let sx1X; + let sx1Y; + let sx1Z; + let sy1X; + let sy1Y; + let sy1Z; + let sz1X; + let sz1Y; + let sz1Z; + let sx2X; + let sx2Y; + let sx2Z; + let sy2X; + let sy2Y; + let sy2Z; + let sz2X; + let sz2Y; + let sz2Z; sx1X = x1X * w1; sx1Y = x1Y * w1; sx1Z = x1Z * w1; @@ -4425,19 +4468,19 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll sz2X = z2X * d2; sz2Y = z2Y * d2; sz2Z = z2Z * d2; - var mDepth = 1e65536; - var mId = -1; - var mSign = 0; - var mAxisX; - var mAxisY; - var mAxisZ; + let mDepth = 1e65536; + let mId = -1; + let mSign = 0; + let mAxisX; + let mAxisY; + let mAxisZ; mAxisX = 0; mAxisY = 0; mAxisZ = 0; - var proj1 = w1; - var dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; - var dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; - var dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; + let proj1 = w1; + let dx = x1X * sx2X + x1Y * sx2Y + x1Z * sx2Z; + let dy = x1X * sy2X + x1Y * sy2Y + x1Z * sy2Z; + let dz = x1X * sz2X + x1Y * sz2Y + x1Z * sz2Z; if(dx < 0) { dx = -dx; } @@ -4447,13 +4490,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll if(dz < 0) { dz = -dz; } - var proj2 = dx + dy + dz; - var projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; - var sum = proj1 + proj2; - var neg = projC12 < 0; - var abs = neg ? -projC12 : projC12; + let proj2 = dx + dy + dz; + let projC12 = x1X * c12X + x1Y * c12Y + x1Z * c12Z; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; if(abs < sum) { - var depth = sum - abs; + let depth = sum - abs; if(depth < 1e65536) { mDepth = depth; mId = 0; @@ -4466,9 +4509,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll return; } proj1 = h1; - var dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; - var dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; - var dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; + let dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; + let dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; + let dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; if(dx1 < 0) { dx1 = -dx1; } @@ -4480,13 +4523,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } proj2 = dx1 + dy1 + dz1; projC12 = y1X * c12X + y1Y * c12Y + y1Z * c12Z; - var sum1 = proj1 + proj2; - var neg1 = projC12 < 0; - var abs1 = neg1 ? -projC12 : projC12; + let sum1 = proj1 + proj2; + let neg1 = projC12 < 0; + let abs1 = neg1 ? -projC12 : projC12; if(abs1 < sum1) { - var depth1 = sum1 - abs1; - if(depth1 < mDepth) { - mDepth = depth1; + let depth = sum1 - abs1; + if(depth < mDepth) { + mDepth = depth; mId = 1; mAxisX = y1X; mAxisY = y1Y; @@ -4497,9 +4540,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll return; } proj1 = d1; - var dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; - var dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; - var dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; + let dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; + let dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; + let dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; if(dx2 < 0) { dx2 = -dx2; } @@ -4511,13 +4554,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } proj2 = dx2 + dy2 + dz2; projC12 = z1X * c12X + z1Y * c12Y + z1Z * c12Z; - var sum2 = proj1 + proj2; - var neg2 = projC12 < 0; - var abs2 = neg2 ? -projC12 : projC12; + let sum2 = proj1 + proj2; + let neg2 = projC12 < 0; + let abs2 = neg2 ? -projC12 : projC12; if(abs2 < sum2) { - var depth2 = sum2 - abs2; - if(depth2 < mDepth) { - mDepth = depth2; + let depth = sum2 - abs2; + if(depth < mDepth) { + mDepth = depth; mId = 2; mAxisX = z1X; mAxisY = z1Y; @@ -4532,9 +4575,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { mDepth = 0; } - var dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; - var dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; - var dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; + let dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; + let dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; + let dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; if(dx3 < 0) { dx3 = -dx3; } @@ -4547,13 +4590,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll proj1 = dx3 + dy3 + dz3; proj2 = w2; projC12 = x2X * c12X + x2Y * c12Y + x2Z * c12Z; - var sum3 = proj1 + proj2; - var neg3 = projC12 < 0; - var abs3 = neg3 ? -projC12 : projC12; + let sum3 = proj1 + proj2; + let neg3 = projC12 < 0; + let abs3 = neg3 ? -projC12 : projC12; if(abs3 < sum3) { - var depth3 = sum3 - abs3; - if(depth3 < mDepth) { - mDepth = depth3; + let depth = sum3 - abs3; + if(depth < mDepth) { + mDepth = depth; mId = 3; mAxisX = x2X; mAxisY = x2Y; @@ -4563,9 +4606,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { return; } - var dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; - var dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; - var dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; + let dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; + let dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; + let dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; if(dx4 < 0) { dx4 = -dx4; } @@ -4578,13 +4621,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll proj1 = dx4 + dy4 + dz4; proj2 = h2; projC12 = y2X * c12X + y2Y * c12Y + y2Z * c12Z; - var sum4 = proj1 + proj2; - var neg4 = projC12 < 0; - var abs4 = neg4 ? -projC12 : projC12; + let sum4 = proj1 + proj2; + let neg4 = projC12 < 0; + let abs4 = neg4 ? -projC12 : projC12; if(abs4 < sum4) { - var depth4 = sum4 - abs4; - if(depth4 < mDepth) { - mDepth = depth4; + let depth = sum4 - abs4; + if(depth < mDepth) { + mDepth = depth; mId = 4; mAxisX = y2X; mAxisY = y2Y; @@ -4594,9 +4637,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { return; } - var dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; - var dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; - var dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; + let dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; + let dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; + let dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; if(dx5 < 0) { dx5 = -dx5; } @@ -4609,13 +4652,13 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll proj1 = dx5 + dy5 + dz5; proj2 = d2; projC12 = z2X * c12X + z2Y * c12Y + z2Z * c12Z; - var sum5 = proj1 + proj2; - var neg5 = projC12 < 0; - var abs5 = neg5 ? -projC12 : projC12; + let sum5 = proj1 + proj2; + let neg5 = projC12 < 0; + let abs5 = neg5 ? -projC12 : projC12; if(abs5 < sum5) { - var depth5 = sum5 - abs5; - if(depth5 < mDepth) { - mDepth = depth5; + let depth = sum5 - abs5; + if(depth < mDepth) { + mDepth = depth; mId = 5; mAxisX = z2X; mAxisY = z2Y; @@ -4630,51 +4673,51 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { mDepth = 0; } - var edgeAxisX; - var edgeAxisY; - var edgeAxisZ; + let edgeAxisX; + let edgeAxisY; + let edgeAxisZ; edgeAxisX = x1Y * x2Z - x1Z * x2Y; edgeAxisY = x1Z * x2X - x1X * x2Z; edgeAxisZ = x1X * x2Y - x1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; if(l > 0) { l = 1 / Math.sqrt(l); } edgeAxisX *= l; edgeAxisY *= l; edgeAxisZ *= l; - var dx6 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy6 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx6 < 0) { - dx6 = -dx6; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy6 < 0) { - dy6 = -dy6; + if(dy < 0) { + dy = -dy; } - proj1 = dx6 + dy6; - var dx7 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy7 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx7 < 0) { - dx7 = -dx7; + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; } - if(dy7 < 0) { - dy7 = -dy7; + if(dy1 < 0) { + dy1 = -dy1; } - proj2 = dx7 + dy7; + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum6 = proj1 + proj2; - var neg6 = projC12 < 0; - var abs6 = neg6 ? -projC12 : projC12; - if(abs6 < sum6) { - var depth6 = sum6 - abs6; - if(depth6 < mDepth) { - mDepth = depth6; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 6; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg6 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4684,44 +4727,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = x1Z * y2X - x1X * y2Z; edgeAxisZ = x1X * y2Y - x1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l1 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - edgeAxisX *= l1; - edgeAxisY *= l1; - edgeAxisZ *= l1; - var dx8 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy8 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx8 < 0) { - dx8 = -dx8; - } - if(dy8 < 0) { - dy8 = -dy8; - } - proj1 = dx8 + dy8; - var dx9 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy9 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx9 < 0) { - dx9 = -dx9; - } - if(dy9 < 0) { - dy9 = -dy9; - } - proj2 = dx9 + dy9; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum7 = proj1 + proj2; - var neg7 = projC12 < 0; - var abs7 = neg7 ? -projC12 : projC12; - if(abs7 < sum7) { - var depth7 = sum7 - abs7; - if(depth7 < mDepth) { - mDepth = depth7; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 7; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg7 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4731,44 +4774,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = x1Z * z2X - x1X * z2Z; edgeAxisZ = x1X * z2Y - x1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l2 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - edgeAxisX *= l2; - edgeAxisY *= l2; - edgeAxisZ *= l2; - var dx10 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy10 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx10 < 0) { - dx10 = -dx10; - } - if(dy10 < 0) { - dy10 = -dy10; - } - proj1 = dx10 + dy10; - var dx11 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy11 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx11 < 0) { - dx11 = -dx11; - } - if(dy11 < 0) { - dy11 = -dy11; - } - proj2 = dx11 + dy11; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum8 = proj1 + proj2; - var neg8 = projC12 < 0; - var abs8 = neg8 ? -projC12 : projC12; - if(abs8 < sum8) { - var depth8 = sum8 - abs8; - if(depth8 < mDepth) { - mDepth = depth8; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 8; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg8 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4778,44 +4821,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * x2X - y1X * x2Z; edgeAxisZ = y1X * x2Y - y1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l3 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - edgeAxisX *= l3; - edgeAxisY *= l3; - edgeAxisZ *= l3; - var dx12 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy12 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx12 < 0) { - dx12 = -dx12; - } - if(dy12 < 0) { - dy12 = -dy12; - } - proj1 = dx12 + dy12; - var dx13 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy13 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx13 < 0) { - dx13 = -dx13; - } - if(dy13 < 0) { - dy13 = -dy13; - } - proj2 = dx13 + dy13; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum9 = proj1 + proj2; - var neg9 = projC12 < 0; - var abs9 = neg9 ? -projC12 : projC12; - if(abs9 < sum9) { - var depth9 = sum9 - abs9; - if(depth9 < mDepth) { - mDepth = depth9; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 9; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg9 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4825,44 +4868,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * y2X - y1X * y2Z; edgeAxisZ = y1X * y2Y - y1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l4 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - edgeAxisX *= l4; - edgeAxisY *= l4; - edgeAxisZ *= l4; - var dx14 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy14 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx14 < 0) { - dx14 = -dx14; - } - if(dy14 < 0) { - dy14 = -dy14; - } - proj1 = dx14 + dy14; - var dx15 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy15 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx15 < 0) { - dx15 = -dx15; - } - if(dy15 < 0) { - dy15 = -dy15; - } - proj2 = dx15 + dy15; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum10 = proj1 + proj2; - var neg10 = projC12 < 0; - var abs10 = neg10 ? -projC12 : projC12; - if(abs10 < sum10) { - var depth10 = sum10 - abs10; - if(depth10 < mDepth) { - mDepth = depth10; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 10; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg10 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4872,45 +4915,45 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * z2X - y1X * z2Z; edgeAxisZ = y1X * z2Y - y1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l5 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); - } - edgeAxisX *= l5; - edgeAxisY *= l5; - edgeAxisZ *= l5; - var dx16 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy16 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx16 < 0) { - dx16 = -dx16; - } - if(dy16 < 0) { - dy16 = -dy16; - } - proj1 = dx16 + dy16; - var dx17 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy17 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx17 < 0) { - dx17 = -dx17; - } - if(dy17 < 0) { - dy17 = -dy17; - } - proj2 = dx17 + dy17; - projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum11 = proj1 + proj2; - var neg11 = projC12 < 0; - var abs11 = neg11 ? -projC12 : projC12; - if(abs11 < sum11) { - var depth11 = sum11 - abs11; - if(depth11 < mDepth) { - mDepth = depth11; - mId = 11; - mAxisX = edgeAxisX; - mAxisY = edgeAxisY; - mAxisZ = edgeAxisZ; - mSign = neg11 ? -1 : 1; - } + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; + projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; + mId = 11; + mAxisX = edgeAxisX; + mAxisY = edgeAxisY; + mAxisZ = edgeAxisZ; + mSign = neg ? -1 : 1; + } } else { return; } @@ -4919,44 +4962,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * x2X - z1X * x2Z; edgeAxisZ = z1X * x2Y - z1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l6 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l6 > 0) { - l6 = 1 / Math.sqrt(l6); - } - edgeAxisX *= l6; - edgeAxisY *= l6; - edgeAxisZ *= l6; - var dx18 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy18 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx18 < 0) { - dx18 = -dx18; - } - if(dy18 < 0) { - dy18 = -dy18; - } - proj1 = dx18 + dy18; - var dx19 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy19 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx19 < 0) { - dx19 = -dx19; - } - if(dy19 < 0) { - dy19 = -dy19; - } - proj2 = dx19 + dy19; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum12 = proj1 + proj2; - var neg12 = projC12 < 0; - var abs12 = neg12 ? -projC12 : projC12; - if(abs12 < sum12) { - var depth12 = sum12 - abs12; - if(depth12 < mDepth) { - mDepth = depth12; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 12; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg12 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -4966,44 +5009,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * y2X - z1X * y2Z; edgeAxisZ = z1X * y2Y - z1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l7 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l7 > 0) { - l7 = 1 / Math.sqrt(l7); - } - edgeAxisX *= l7; - edgeAxisY *= l7; - edgeAxisZ *= l7; - var dx20 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy20 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx20 < 0) { - dx20 = -dx20; - } - if(dy20 < 0) { - dy20 = -dy20; - } - proj1 = dx20 + dy20; - var dx21 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy21 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx21 < 0) { - dx21 = -dx21; - } - if(dy21 < 0) { - dy21 = -dy21; - } - proj2 = dx21 + dy21; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum13 = proj1 + proj2; - var neg13 = projC12 < 0; - var abs13 = neg13 ? -projC12 : projC12; - if(abs13 < sum13) { - var depth13 = sum13 - abs13; - if(depth13 < mDepth) { - mDepth = depth13; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 13; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg13 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -5013,44 +5056,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * z2X - z1X * z2Z; edgeAxisZ = z1X * z2Y - z1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l8 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l8 > 0) { - l8 = 1 / Math.sqrt(l8); - } - edgeAxisX *= l8; - edgeAxisY *= l8; - edgeAxisZ *= l8; - var dx22 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy22 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx22 < 0) { - dx22 = -dx22; - } - if(dy22 < 0) { - dy22 = -dy22; - } - proj1 = dx22 + dy22; - var dx23 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy23 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx23 < 0) { - dx23 = -dx23; - } - if(dy23 < 0) { - dy23 = -dy23; - } - proj2 = dx23 + dy23; + let l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + let dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + let dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + let dx1 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + let dy1 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx1 < 0) { + dx1 = -dx1; + } + if(dy1 < 0) { + dy1 = -dy1; + } + proj2 = dx1 + dy1; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum14 = proj1 + proj2; - var neg14 = projC12 < 0; - var abs14 = neg14 ? -projC12 : projC12; - if(abs14 < sum14) { - var depth14 = sum14 - abs14; - if(depth14 < mDepth) { - mDepth = depth14; + let sum = proj1 + proj2; + let neg = projC12 < 0; + let abs = neg ? -projC12 : projC12; + if(abs < sum) { + let depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 14; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg14 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -5060,26 +5103,26 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll mAxisX *= mSign; mAxisY *= mSign; mAxisZ *= mSign; - var id1 = (mId - 6) / 3 | 0; - var id2 = mId - 6 - id1 * 3; - var p1X; - var p1Y; - var p1Z; - var p2X; - var p2Y; - var p2Z; - var d1X; - var d1Y; - var d1Z; - var d2X; - var d2Y; - var d2Z; + let id1 = (mId - 6) / 3 | 0; + let id2 = mId - 6 - id1 * 3; + let p1X; + let p1Y; + let p1Z; + let p2X; + let p2Y; + let p2Z; + let d1X; + let d1Y; + let d1Z; + let d2X; + let d2Y; + let d2Z; switch(id1) { case 0: d1X = x1X; d1Y = x1Y; d1Z = x1Z; - var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + let signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; if(sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0) { if(signY) { p1X = sy1X + sz1X; @@ -5107,7 +5150,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = y1X; d1Y = y1Y; d1Z = y1Z; - var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + let signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY1) { p1X = sx1X + sz1X; @@ -5135,7 +5178,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = z1X; d1Y = z1Y; d1Z = z1Z; - var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + let signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { if(signY2) { p1X = sx1X + sy1X; @@ -5167,7 +5210,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = x2X; d2Y = x2Y; d2Z = x2Z; - var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + let signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; if(sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0) { if(signY3) { p2X = sy2X + sz2X; @@ -5195,7 +5238,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = y2X; d2Y = y2Y; d2Z = y2Z; - var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + let signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY4) { p2X = sx2X + sz2X; @@ -5223,7 +5266,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = z2X; d2Y = z2Y; d2Z = z2Z; - var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + let signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { if(signY5) { p2X = sx2X + sy2X; @@ -5250,33 +5293,33 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p2X = c2X - p2X; p2Y = c2Y - p2Y; p2Z = c2Z - p2Z; - var rX; - var rY; - var rZ; + let rX; + let rY; + let rZ; rX = p1X - p2X; rY = p1Y - p2Y; rZ = p1Z - p2Z; - var dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; - var dot1r = d1X * rX + d1Y * rY + d1Z * rZ; - var dot2r = d2X * rX + d2Y * rY + d2Z * rZ; - var invDet = 1 / (1 - dot12 * dot12); - var t1 = (dot12 * dot2r - dot1r) * invDet; - var t2 = (dot2r - dot12 * dot1r) * invDet; - var cp1X; - var cp1Y; - var cp1Z; - var cp2X; - var cp2Y; - var cp2Z; + let dot12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + let dot1r = d1X * rX + d1Y * rY + d1Z * rZ; + let dot2r = d2X * rX + d2Y * rY + d2Z * rZ; + let invDet = 1 / (1 - dot12 * dot12); + let t1 = (dot12 * dot2r - dot1r) * invDet; + let t2 = (dot2r - dot12 * dot1r) * invDet; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; cp1X = p1X + d1X * t1; cp1Y = p1Y + d1Y * t1; cp1Z = p1Z + d1Z * t1; cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = -mAxisX; normalY = -mAxisY; normalZ = -mAxisZ; @@ -5284,25 +5327,25 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll this.addPoint(result,cp1X,cp1Y,cp1Z,cp2X,cp2Y,cp2Z,mDepth,4); return; } - var tmpX; - var tmpY; - var tmpZ; - var swapped; + let tmpX; + let tmpY; + let tmpZ; + let swapped; if(mId >= 3) { mSign = -mSign; c12X = -c12X; c12Y = -c12Y; c12Z = -c12Z; - var tmp = b1; + let tmp = b1; b1 = b2; b2 = tmp; - var tmp1 = w1; + let tmp1 = w1; w1 = w2; w2 = tmp1; - var tmp2 = h1; + let tmp2 = h1; h1 = h2; h2 = tmp2; - var tmp3 = d1; + let tmp3 = d1; d1 = d2; d2 = tmp3; tmpX = c1X; @@ -5373,20 +5416,20 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { swapped = false; } - var refCenterX; - var refCenterY; - var refCenterZ; - var refNormalX; - var refNormalY; - var refNormalZ; - var refXX; - var refXY; - var refXZ; - var refYX; - var refYY; - var refYZ; - var refW; - var refH; + let refCenterX; + let refCenterY; + let refCenterZ; + let refNormalX; + let refNormalY; + let refNormalZ; + let refXX; + let refXY; + let refXZ; + let refYX; + let refYY; + let refYZ; + let refW; + let refH; switch(mId) { case 0: refCenterX = sx1X; @@ -5452,16 +5495,16 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll refYX = tmpX; refYY = tmpY; refYZ = tmpZ; - var tmp4 = refW; + let tmp = refW; refW = refH; - refH = tmp4; + refH = tmp; } refCenterX += c1X; refCenterY += c1Y; refCenterZ += c1Z; - var minIncDot = 1; - var incId = 0; - var incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; + let minIncDot = 1; + let incId = 0; + let incDot = refNormalX * x2X + refNormalY * x2Y + refNormalZ * x2Z; if(incDot < minIncDot) { minIncDot = incDot; incId = 0; @@ -5488,18 +5531,18 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll minIncDot = -incDot; incId = 5; } - var incV1X; - var incV1Y; - var incV1Z; - var incV2X; - var incV2Y; - var incV2Z; - var incV3X; - var incV3Y; - var incV3Z; - var incV4X; - var incV4Y; - var incV4Z; + let incV1X; + let incV1Y; + let incV1Z; + let incV2X; + let incV2Y; + let incV2Z; + let incV3X; + let incV3Y; + let incV3Z; + let incV4X; + let incV4Y; + let incV4Z; switch(incId) { case 0: incV1X = sx2X + sy2X; @@ -5687,34 +5730,34 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll incV4X += c12X; incV4Y += c12Y; incV4Z += c12Z; - var _this = this.clipper; + let _this = this.clipper; _this.w = refW; _this.h = refH; _this.numVertices = 0; _this.numTmpVertices = 0; - var _this1 = this.clipper; - var _this2 = _this1.vertices[_this1.numVertices++]; + let _this1 = this.clipper; + let _this2 = _this1.vertices[_this1.numVertices++]; _this2.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; _this2.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; _this2.wx = incV1X; _this2.wy = incV1Y; _this2.wz = incV1Z; - var _this3 = this.clipper; - var _this4 = _this3.vertices[_this3.numVertices++]; + let _this3 = this.clipper; + let _this4 = _this3.vertices[_this3.numVertices++]; _this4.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; _this4.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; _this4.wx = incV2X; _this4.wy = incV2Y; _this4.wz = incV2Z; - var _this5 = this.clipper; - var _this6 = _this5.vertices[_this5.numVertices++]; + let _this5 = this.clipper; + let _this6 = _this5.vertices[_this5.numVertices++]; _this6.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; _this6.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; _this6.wx = incV3X; _this6.wy = incV3Y; _this6.wz = incV3Z; - var _this7 = this.clipper; - var _this8 = _this7.vertices[_this7.numVertices++]; + let _this7 = this.clipper; + let _this8 = _this7.vertices[_this7.numVertices++]; _this8.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; _this8.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; _this8.wx = incV4X; @@ -5722,383 +5765,397 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll _this8.wz = incV4Z; this.clipper.clip(); this.clipper.reduce(); - var normalX1; - var normalY1; - var normalZ1; + let normalX; + let normalY; + let normalZ; if(swapped) { - normalX1 = refNormalX; - normalY1 = refNormalY; - normalZ1 = refNormalZ; + normalX = refNormalX; + normalY = refNormalY; + normalZ = refNormalZ; } else { - normalX1 = -refNormalX; - normalY1 = -refNormalY; - normalZ1 = -refNormalZ; + normalX = -refNormalX; + normalY = -refNormalY; + normalZ = -refNormalZ; } - this.setNormal(result,normalX1,normalY1,normalZ1); - var _g = 0; - var _g1 = this.clipper.numVertices; + this.setNormal(result,normalX,normalY,normalZ); + let _g = 0; + let _g1 = this.clipper.numVertices; while(_g < _g1) { - var i = _g++; - var v = this.clipper.vertices[i]; - var clippedVertexX; - var clippedVertexY; - var clippedVertexZ; + let i = _g++; + let v = this.clipper.vertices[i]; + let clippedVertexX; + let clippedVertexY; + let clippedVertexZ; clippedVertexX = v.wx; clippedVertexY = v.wy; clippedVertexZ = v.wz; clippedVertexX += c1X; clippedVertexY += c1Y; clippedVertexZ += c1Z; - var clippedVertexToRefCenterX; - var clippedVertexToRefCenterY; - var clippedVertexToRefCenterZ; + let clippedVertexToRefCenterX; + let clippedVertexToRefCenterY; + let clippedVertexToRefCenterZ; clippedVertexToRefCenterX = refCenterX - clippedVertexX; clippedVertexToRefCenterY = refCenterY - clippedVertexY; clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; - var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; - var clippedVertexOnRefFaceX; - var clippedVertexOnRefFaceY; - var clippedVertexOnRefFaceZ; - clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth15; - clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth15; - clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth15; - if(depth15 > -oimo_common_Setting.contactPersistenceThreshold) { + let depth = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; + let clippedVertexOnRefFaceX; + let clippedVertexOnRefFaceY; + let clippedVertexOnRefFaceZ; + clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth; + clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth; + clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth; + if(depth > -oimo_common_Setting.contactPersistenceThreshold) { if(swapped) { - this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth15,i); + this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth,i); } else { - this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth15,i); - } - } - } - } -}); -var oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex = function() { - this.x = 0; - this.y = 0; - this.wx = 0; - this.wy = 0; - this.wz = 0; -}; -var oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper = function() { - this.w = 0; - this.h = 0; - this.numVertices = 0; - this.numTmpVertices = 0; - this.vertices = new Array(8); - this.tmpVertices = new Array(8); - this.vertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.vertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); - this.tmpVertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); -}; -oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { - clip: function() { - var _g = 0; - var _g1 = this.numVertices; + this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth,i); + } + } + } + } +} +class oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex { + constructor() { + this.x = 0; + this.y = 0; + this.wx = 0; + this.wy = 0; + this.wz = 0; + } +} +class oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper { + constructor() { + this.w = 0; + this.h = 0; + this.numVertices = 0; + this.numTmpVertices = 0; + this.vertices = new Array(8); + this.tmpVertices = new Array(8); + this.vertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[0] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[1] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[2] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[3] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[4] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[5] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[6] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.vertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + this.tmpVertices[7] = new oimo_collision_narrowphase_detector__$BoxBoxDetector_IncidentVertex(); + } + clip() { + let _g = 0; + let _g1 = this.numVertices; while(_g < _g1) { - var i = _g++; - var v1 = this.vertices[i]; - var v2 = this.vertices[(i + 1) % this.numVertices]; - var s1 = this.w + v1.x; - var s2 = this.w + v2.x; + let i = _g++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.w + v1.x; + let s2 = this.w + v2.x; if(s1 > 0 && s2 > 0) { - var _this = this.tmpVertices[this.numTmpVertices++]; + let _this = this.tmpVertices[this.numTmpVertices++]; _this.x = v1.x; _this.y = v1.y; _this.wx = v1.wx; _this.wy = v1.wy; _this.wz = v1.wz; } else if(s1 > 0 && s2 <= 0) { - var _this1 = this.tmpVertices[this.numTmpVertices++]; - _this1.x = v1.x; - _this1.y = v1.y; - _this1.wx = v1.wx; - _this1.wy = v1.wy; - _this1.wz = v1.wz; - var t = s1 / (s1 - s2); - var _this2 = this.tmpVertices[this.numTmpVertices++]; - _this2.x = v1.x + (v2.x - v1.x) * t; - _this2.y = v1.y + (v2.y - v1.y) * t; - _this2.wx = v1.wx + (v2.wx - v1.wx) * t; - _this2.wy = v1.wy + (v2.wy - v1.wy) * t; - _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; } else if(s1 <= 0 && s2 > 0) { - var t1 = s1 / (s1 - s2); - var _this3 = this.tmpVertices[this.numTmpVertices++]; - _this3.x = v1.x + (v2.x - v1.x) * t1; - _this3.y = v1.y + (v2.y - v1.y) * t1; - _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; - _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; - _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; } } - var tmp = this.vertices; + let tmp = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g2 = 0; - var _g11 = this.numVertices; - while(_g2 < _g11) { - var i1 = _g2++; - var v11 = this.vertices[i1]; - var v21 = this.vertices[(i1 + 1) % this.numVertices]; - var s11 = this.w - v11.x; - var s21 = this.w - v21.x; - if(s11 > 0 && s21 > 0) { - var _this4 = this.tmpVertices[this.numTmpVertices++]; - _this4.x = v11.x; - _this4.y = v11.y; - _this4.wx = v11.wx; - _this4.wy = v11.wy; - _this4.wz = v11.wz; - } else if(s11 > 0 && s21 <= 0) { - var _this5 = this.tmpVertices[this.numTmpVertices++]; - _this5.x = v11.x; - _this5.y = v11.y; - _this5.wx = v11.wx; - _this5.wy = v11.wy; - _this5.wz = v11.wz; - var t2 = s11 / (s11 - s21); - var _this6 = this.tmpVertices[this.numTmpVertices++]; - _this6.x = v11.x + (v21.x - v11.x) * t2; - _this6.y = v11.y + (v21.y - v11.y) * t2; - _this6.wx = v11.wx + (v21.wx - v11.wx) * t2; - _this6.wy = v11.wy + (v21.wy - v11.wy) * t2; - _this6.wz = v11.wz + (v21.wz - v11.wz) * t2; - } else if(s11 <= 0 && s21 > 0) { - var t3 = s11 / (s11 - s21); - var _this7 = this.tmpVertices[this.numTmpVertices++]; - _this7.x = v11.x + (v21.x - v11.x) * t3; - _this7.y = v11.y + (v21.y - v11.y) * t3; - _this7.wx = v11.wx + (v21.wx - v11.wx) * t3; - _this7.wy = v11.wy + (v21.wy - v11.wy) * t3; - _this7.wz = v11.wz + (v21.wz - v11.wz) * t3; - } - } - var tmp1 = this.vertices; + let _g2 = 0; + let _g3 = this.numVertices; + while(_g2 < _g3) { + let i = _g2++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.w - v1.x; + let s2 = this.w - v2.x; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp1 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp1; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g3 = 0; - var _g12 = this.numVertices; - while(_g3 < _g12) { - var i2 = _g3++; - var v12 = this.vertices[i2]; - var v22 = this.vertices[(i2 + 1) % this.numVertices]; - var s12 = this.h + v12.y; - var s22 = this.h + v22.y; - if(s12 > 0 && s22 > 0) { - var _this8 = this.tmpVertices[this.numTmpVertices++]; - _this8.x = v12.x; - _this8.y = v12.y; - _this8.wx = v12.wx; - _this8.wy = v12.wy; - _this8.wz = v12.wz; - } else if(s12 > 0 && s22 <= 0) { - var _this9 = this.tmpVertices[this.numTmpVertices++]; - _this9.x = v12.x; - _this9.y = v12.y; - _this9.wx = v12.wx; - _this9.wy = v12.wy; - _this9.wz = v12.wz; - var t4 = s12 / (s12 - s22); - var _this10 = this.tmpVertices[this.numTmpVertices++]; - _this10.x = v12.x + (v22.x - v12.x) * t4; - _this10.y = v12.y + (v22.y - v12.y) * t4; - _this10.wx = v12.wx + (v22.wx - v12.wx) * t4; - _this10.wy = v12.wy + (v22.wy - v12.wy) * t4; - _this10.wz = v12.wz + (v22.wz - v12.wz) * t4; - } else if(s12 <= 0 && s22 > 0) { - var t5 = s12 / (s12 - s22); - var _this11 = this.tmpVertices[this.numTmpVertices++]; - _this11.x = v12.x + (v22.x - v12.x) * t5; - _this11.y = v12.y + (v22.y - v12.y) * t5; - _this11.wx = v12.wx + (v22.wx - v12.wx) * t5; - _this11.wy = v12.wy + (v22.wy - v12.wy) * t5; - _this11.wz = v12.wz + (v22.wz - v12.wz) * t5; - } - } - var tmp2 = this.vertices; + let _g4 = 0; + let _g5 = this.numVertices; + while(_g4 < _g5) { + let i = _g4++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.h + v1.y; + let s2 = this.h + v2.y; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp2 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp2; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g4 = 0; - var _g13 = this.numVertices; - while(_g4 < _g13) { - var i3 = _g4++; - var v13 = this.vertices[i3]; - var v23 = this.vertices[(i3 + 1) % this.numVertices]; - var s13 = this.h - v13.y; - var s23 = this.h - v23.y; - if(s13 > 0 && s23 > 0) { - var _this12 = this.tmpVertices[this.numTmpVertices++]; - _this12.x = v13.x; - _this12.y = v13.y; - _this12.wx = v13.wx; - _this12.wy = v13.wy; - _this12.wz = v13.wz; - } else if(s13 > 0 && s23 <= 0) { - var _this13 = this.tmpVertices[this.numTmpVertices++]; - _this13.x = v13.x; - _this13.y = v13.y; - _this13.wx = v13.wx; - _this13.wy = v13.wy; - _this13.wz = v13.wz; - var t6 = s13 / (s13 - s23); - var _this14 = this.tmpVertices[this.numTmpVertices++]; - _this14.x = v13.x + (v23.x - v13.x) * t6; - _this14.y = v13.y + (v23.y - v13.y) * t6; - _this14.wx = v13.wx + (v23.wx - v13.wx) * t6; - _this14.wy = v13.wy + (v23.wy - v13.wy) * t6; - _this14.wz = v13.wz + (v23.wz - v13.wz) * t6; - } else if(s13 <= 0 && s23 > 0) { - var t7 = s13 / (s13 - s23); - var _this15 = this.tmpVertices[this.numTmpVertices++]; - _this15.x = v13.x + (v23.x - v13.x) * t7; - _this15.y = v13.y + (v23.y - v13.y) * t7; - _this15.wx = v13.wx + (v23.wx - v13.wx) * t7; - _this15.wy = v13.wy + (v23.wy - v13.wy) * t7; - _this15.wz = v13.wz + (v23.wz - v13.wz) * t7; - } - } - var tmp3 = this.vertices; + let _g6 = 0; + let _g7 = this.numVertices; + while(_g6 < _g7) { + let i = _g6++; + let v1 = this.vertices[i]; + let v2 = this.vertices[(i + 1) % this.numVertices]; + let s1 = this.h - v1.y; + let s2 = this.h - v2.y; + if(s1 > 0 && s2 > 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + let t = s1 / (s1 - s2); + let _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x + (v2.x - v1.x) * t; + _this1.y = v1.y + (v2.y - v1.y) * t; + _this1.wx = v1.wx + (v2.wx - v1.wx) * t; + _this1.wy = v1.wy + (v2.wy - v1.wy) * t; + _this1.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + let t = s1 / (s1 - s2); + let _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x + (v2.x - v1.x) * t; + _this.y = v1.y + (v2.y - v1.y) * t; + _this.wx = v1.wx + (v2.wx - v1.wx) * t; + _this.wy = v1.wy + (v2.wy - v1.wy) * t; + _this.wz = v1.wz + (v2.wz - v1.wz) * t; + } + } + let tmp3 = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp3; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; } - ,reduce: function() { + reduce() { if(this.numVertices < 4) { return; } - var max1 = -1e65536; - var min1 = 1e65536; - var max2 = -1e65536; - var min2 = 1e65536; - var max1V = null; - var min1V = null; - var max2V = null; - var min2V = null; - var e1x = 1; - var e1y = 1; - var e2x = -1; - var e2y = 1; - var _g = 0; - var _g1 = this.numVertices; + let max1 = -1e65536; + let min1 = 1e65536; + let max2 = -1e65536; + let min2 = 1e65536; + let max1V = null; + let min1V = null; + let max2V = null; + let min2V = null; + let e1x = 1; + let e1y = 1; + let e2x = -1; + let e2y = 1; + let _g = 0; + let _g1 = this.numVertices; while(_g < _g1) { - var v = this.vertices[_g++]; - var dot1 = v.x * e1x + v.y * e1y; - var dot2 = v.x * e2x + v.y * e2y; - if(dot1 > max1) { + let i = _g++; + let v = this.vertices[i]; + let dot1 = v.x * e1x + v.y * e1y; + let dot2 = v.x * e2x + v.y * e2y; + if(i == 0) { max1 = dot1; max1V = v; - } - if(dot1 < min1) { min1 = dot1; min1V = v; - } - if(dot2 > max2) { max2 = dot2; max2V = v; - } - if(dot2 < min2) { min2 = dot2; min2V = v; + } else { + if(dot1 > max1) { + max1 = dot1; + max1V = v; + } + if(dot1 < min1) { + min1 = dot1; + min1V = v; + } + if(dot2 > max2) { + max2 = dot2; + max2V = v; + } + if(dot2 < min2) { + min2 = dot2; + min2V = v; + } } } - var _this = this.tmpVertices[this.numTmpVertices++]; + let _this = this.tmpVertices[this.numTmpVertices++]; _this.x = max1V.x; _this.y = max1V.y; _this.wx = max1V.wx; _this.wy = max1V.wy; _this.wz = max1V.wz; - var _this1 = this.tmpVertices[this.numTmpVertices++]; + let _this1 = this.tmpVertices[this.numTmpVertices++]; _this1.x = max2V.x; _this1.y = max2V.y; _this1.wx = max2V.wx; _this1.wy = max2V.wy; _this1.wz = max2V.wz; - var _this2 = this.tmpVertices[this.numTmpVertices++]; + let _this2 = this.tmpVertices[this.numTmpVertices++]; _this2.x = min1V.x; _this2.y = min1V.y; _this2.wx = min1V.wx; _this2.wy = min1V.wy; _this2.wz = min1V.wz; - var _this3 = this.tmpVertices[this.numTmpVertices++]; + let _this3 = this.tmpVertices[this.numTmpVertices++]; _this3.x = min2V.x; _this3.y = min2V.y; _this3.wx = min2V.wx; _this3.wy = min2V.wy; _this3.wz = min2V.wz; - var tmp = this.vertices; + let tmp = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; } -}; -var oimo_collision_narrowphase_detector_BoxBoxDetectorMacro = function() { }; -var oimo_collision_narrowphase_detector_CachedDetectorData = function() { -}; -oimo_collision_narrowphase_detector_CachedDetectorData.prototype = { - _clear: function() { +} +class oimo_collision_narrowphase_detector_BoxBoxDetectorMacro { +} +class oimo_collision_narrowphase_detector_CachedDetectorData { + constructor() { + } + _clear() { if(this._gjkCache != null) { this._gjkCache.clear(); } } -}; -var oimo_collision_narrowphase_detector_CapsuleCapsuleDetector = function() { - oimo_collision_narrowphase_detector_Detector.call(this,false); -}; -oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var c1 = geom1; - var c2 = geom2; +} +class oimo_collision_narrowphase_detector_CapsuleCapsuleDetector extends oimo_collision_narrowphase_detector_Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + let c1 = geom1; + let c2 = geom2; result.incremental = false; - var axis1X; - var axis1Y; - var axis1Z; - var axis2X; - var axis2Y; - var axis2Z; + let axis1X; + let axis1Y; + let axis1Z; + let axis2X; + let axis2Y; + let axis2Z; axis1X = tf1._rotation01; axis1Y = tf1._rotation11; axis1Z = tf1._rotation21; axis2X = tf2._rotation01; axis2Y = tf2._rotation11; axis2Z = tf2._rotation21; - var hh1 = c1._halfHeight; - var hh2 = c2._halfHeight; - var r1 = c1._radius; - var r2 = c2._radius; - var p1X; - var p1Y; - var p1Z; - var q1X; - var q1Y; - var q1Z; - var p2X; - var p2Y; - var p2Z; - var q2X; - var q2Y; - var q2Z; + let hh1 = c1._halfHeight; + let hh2 = c2._halfHeight; + let r1 = c1._radius; + let r2 = c2._radius; + let p1X; + let p1Y; + let p1Z; + let q1X; + let q1Y; + let q1Z; + let p2X; + let p2Y; + let p2Z; + let q2X; + let q2Y; + let q2Z; p1X = tf1._positionX + axis1X * -hh1; p1Y = tf1._positionY + axis1Y * -hh1; p1Z = tf1._positionZ + axis1Z * -hh1; @@ -6111,31 +6168,31 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12X; - var p12Y; - var p12Z; + let p12X; + let p12Y; + let p12Z; p12X = p1X - p2X; p12Y = p1Y - p2Y; p12Z = p1Z - p2Z; - var d1X; - var d1Y; - var d1Z; - var d2X; - var d2Y; - var d2Z; + let d1X; + let d1Y; + let d1Z; + let d2X; + let d2Y; + let d2Z; d1X = q1X - p1X; d1Y = q1Y - p1Y; d1Z = q1Z - p1Z; d2X = q2X - p2X; d2Y = q2Y - p2Y; d2Z = q2Z - p2Z; - var p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); - var p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; - var d11 = hh1 * hh1 * 4; - var d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; - var d22 = hh2 * hh2 * 4; - var t1; - var t2; + let p21d1 = -(p12X * d1X + p12Y * d1Y + p12Z * d1Z); + let p12d2 = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + let d11 = hh1 * hh1 * 4; + let d12 = d1X * d2X + d1Y * d2Y + d1Z * d2Z; + let d22 = hh2 * hh2 * 4; + let t1; + let t2; if(d11 == 0 && d22 == 0) { t1 = 0; t2 = 0; @@ -6160,7 +6217,7 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o t1 = p21d1 / d11; } } else { - var det = d11 * d22 - d12 * d12; + let det = d11 * d22 - d12 * d12; if(det == 0) { t1 = 0; } else { @@ -6198,32 +6255,32 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o t2 /= d22; } } - var cp1X; - var cp1Y; - var cp1Z; - var cp2X; - var cp2Y; - var cp2Z; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; cp1X = p1X + d1X * t1; cp1Y = p1Y + d1Y * t1; cp1Z = p1Z + d1Z * t1; cp2X = p2X + d2X * t2; cp2Y = p2Y + d2Y * t2; cp2Z = p2Z + d2Z * t2; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = cp1X - cp2X; dY = cp1Y - cp2Y; dZ = cp1Z - cp2Z; - var len2 = dX * dX + dY * dY + dZ * dZ; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6234,12 +6291,12 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1X; - var pos1Y; - var pos1Z; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = cp1X + nX * -r1; pos1Y = cp1Y + nY * -r1; pos1Z = cp1Z + nZ * -r1; @@ -6248,17 +6305,16 @@ oimo_collision_narrowphase_detector_CapsuleCapsuleDetector.prototype = $extend(o pos2Z = cp2Z + nZ * r2; this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); } -}); -var oimo_collision_narrowphase_detector_GjkEpaDetector = function() { - oimo_collision_narrowphase_detector_Detector.call(this,false); -}; -oimo_collision_narrowphase_detector_GjkEpaDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; - var g1 = geom1; - var g2 = geom2; - var status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo_common_Setting.enableGJKCaching ? cachedData : null,true); +} +class oimo_collision_narrowphase_detector_GjkEpaDetector extends oimo_collision_narrowphase_detector_Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + let gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; + let g1 = geom1; + let g2 = geom2; + let status = gjkEpa.computeClosestPointsImpl(g1,g2,tf1,tf2,oimo_common_Setting.enableGJKCaching ? cachedData : null,true); result.incremental = true; if(status != oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED) { console.log("src/oimo/collision/narrowphase/detector/GjkEpaDetector.hx:28:","GJK/EPA failed: status=" + status); @@ -6267,23 +6323,23 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll if(gjkEpa.distance > g1._gjkMargin + g2._gjkMargin) { return; } - var pos1X; - var pos1Y; - var pos1Z; - var pos2X; - var pos2Y; - var pos2Z; - var v = gjkEpa.closestPoint1; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; + let v = gjkEpa.closestPoint1; pos1X = v.x; pos1Y = v.y; pos1Z = v.z; - var v1 = gjkEpa.closestPoint2; + let v1 = gjkEpa.closestPoint2; pos2X = v1.x; pos2Y = v1.y; pos2Z = v1.z; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = pos1X - pos2X; normalY = pos1Y - pos2Y; normalZ = pos1Z - pos2Z; @@ -6295,7 +6351,7 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll normalY = -normalY; normalZ = -normalZ; } - var l = normalX * normalX + normalY * normalY + normalZ * normalZ; + let l = normalX * normalX + normalY * normalY + normalZ * normalZ; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -6311,40 +6367,39 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll pos2Z += normalZ * g2._gjkMargin; this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,g1._gjkMargin + g2._gjkMargin - gjkEpa.distance,0); } -}); -var oimo_collision_narrowphase_detector_SphereBoxDetector = function(swapped) { - oimo_collision_narrowphase_detector_Detector.call(this,swapped); -}; -oimo_collision_narrowphase_detector_SphereBoxDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var b = geom2; +} +class oimo_collision_narrowphase_detector_SphereBoxDetector extends oimo_collision_narrowphase_detector_Detector { + constructor(swapped) { + super(swapped); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + let b = geom2; result.incremental = false; - var halfExtX; - var halfExtY; - var halfExtZ; - var negHalfExtX; - var negHalfExtY; - var negHalfExtZ; + let halfExtX; + let halfExtY; + let halfExtZ; + let negHalfExtX; + let negHalfExtY; + let negHalfExtZ; halfExtX = b._halfExtentsX; halfExtY = b._halfExtentsY; halfExtZ = b._halfExtentsZ; negHalfExtX = -halfExtX; negHalfExtY = -halfExtY; negHalfExtZ = -halfExtZ; - var r = geom1._radius; - var boxToSphereX; - var boxToSphereY; - var boxToSphereZ; + let r = geom1._radius; + let boxToSphereX; + let boxToSphereY; + let boxToSphereZ; boxToSphereX = tf1._positionX - tf2._positionX; boxToSphereY = tf1._positionY - tf2._positionY; boxToSphereZ = tf1._positionZ - tf2._positionZ; - var boxToSphereInBoxX; - var boxToSphereInBoxY; - var boxToSphereInBoxZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let boxToSphereInBoxX; + let boxToSphereInBoxY; + let boxToSphereInBoxZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf2._rotation00 * boxToSphereX + tf2._rotation10 * boxToSphereY + tf2._rotation20 * boxToSphereZ; __tmp__Y = tf2._rotation01 * boxToSphereX + tf2._rotation11 * boxToSphereY + tf2._rotation21 * boxToSphereZ; __tmp__Z = tf2._rotation02 * boxToSphereX + tf2._rotation12 * boxToSphereY + tf2._rotation22 * boxToSphereZ; @@ -6352,25 +6407,25 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c boxToSphereInBoxY = __tmp__Y; boxToSphereInBoxZ = __tmp__Z; if(negHalfExtX < boxToSphereInBoxX && halfExtX > boxToSphereInBoxX && negHalfExtY < boxToSphereInBoxY && halfExtY > boxToSphereInBoxY && negHalfExtZ < boxToSphereInBoxZ && halfExtZ > boxToSphereInBoxZ) { - var sphereToBoxSurfaceX; - var sphereToBoxSurfaceY; - var sphereToBoxSurfaceZ; + let sphereToBoxSurfaceX; + let sphereToBoxSurfaceY; + let sphereToBoxSurfaceZ; sphereToBoxSurfaceX = boxToSphereInBoxX < 0 ? -boxToSphereInBoxX : boxToSphereInBoxX; sphereToBoxSurfaceY = boxToSphereInBoxY < 0 ? -boxToSphereInBoxY : boxToSphereInBoxY; sphereToBoxSurfaceZ = boxToSphereInBoxZ < 0 ? -boxToSphereInBoxZ : boxToSphereInBoxZ; sphereToBoxSurfaceX = halfExtX - sphereToBoxSurfaceX; sphereToBoxSurfaceY = halfExtY - sphereToBoxSurfaceY; sphereToBoxSurfaceZ = halfExtZ - sphereToBoxSurfaceZ; - var normalInBoxX; - var normalInBoxY; - var normalInBoxZ; - var distX = sphereToBoxSurfaceX; - var distY = sphereToBoxSurfaceY; - var distZ = sphereToBoxSurfaceZ; - var depth; - var projectionMaskX; - var projectionMaskY; - var projectionMaskZ; + let normalInBoxX; + let normalInBoxY; + let normalInBoxZ; + let distX = sphereToBoxSurfaceX; + let distY = sphereToBoxSurfaceY; + let distZ = sphereToBoxSurfaceZ; + let depth; + let projectionMaskX; + let projectionMaskY; + let projectionMaskZ; if(distX < distY) { if(distX < distZ) { if(boxToSphereInBoxX > 0) { @@ -6430,52 +6485,52 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c projectionMaskZ = 0; depth = distZ; } - var baseX; - var baseY; - var baseZ; + let baseX; + let baseY; + let baseZ; baseX = projectionMaskX * boxToSphereInBoxX; baseY = projectionMaskY * boxToSphereInBoxY; baseZ = projectionMaskZ * boxToSphereInBoxZ; - var boxToClosestPointInBoxX; - var boxToClosestPointInBoxY; - var boxToClosestPointInBoxZ; + let boxToClosestPointInBoxX; + let boxToClosestPointInBoxY; + let boxToClosestPointInBoxZ; boxToClosestPointInBoxX = normalInBoxX * halfExtX; boxToClosestPointInBoxY = normalInBoxY * halfExtY; boxToClosestPointInBoxZ = normalInBoxZ * halfExtZ; boxToClosestPointInBoxX += baseX; boxToClosestPointInBoxY += baseY; boxToClosestPointInBoxZ += baseZ; - var boxToClosestPointX; - var boxToClosestPointY; - var boxToClosestPointZ; - var normalX; - var normalY; - var normalZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; - __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; - __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; - boxToClosestPointX = __tmp__X1; - boxToClosestPointY = __tmp__Y1; - boxToClosestPointZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; - __tmp__Y2 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; - __tmp__Z2 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; - normalX = __tmp__X2; - normalY = __tmp__Y2; - normalZ = __tmp__Z2; + let boxToClosestPointX; + let boxToClosestPointY; + let boxToClosestPointZ; + let normalX; + let normalY; + let normalZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X; + boxToClosestPointY = __tmp__Y; + boxToClosestPointZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; + __tmp__Y1 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; + __tmp__Z1 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; + normalX = __tmp__X1; + normalY = __tmp__Y1; + normalZ = __tmp__Z1; this.setNormal(result,normalX,normalY,normalZ); - var pos1X; - var pos1Y; - var pos1Z; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = tf1._positionX + normalX * -r; pos1Y = tf1._positionY + normalY * -r; pos1Z = tf1._positionZ + normalZ * -r; @@ -6485,131 +6540,136 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); return; } - var boxToClosestPointInBoxX1; - var boxToClosestPointInBoxY1; - var boxToClosestPointInBoxZ1; + let boxToClosestPointInBoxX; + let boxToClosestPointInBoxY; + let boxToClosestPointInBoxZ; halfExtX -= 1e-9; halfExtY -= 1e-9; halfExtZ -= 1e-9; negHalfExtX += 1e-9; negHalfExtY += 1e-9; negHalfExtZ += 1e-9; - boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; - boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; - boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; - boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; - boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; - boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; - var closestPointToSphereInBoxX; - var closestPointToSphereInBoxY; - var closestPointToSphereInBoxZ; - closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX1; - closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY1; - closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ1; - var dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; + boxToClosestPointInBoxX = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; + boxToClosestPointInBoxY = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; + boxToClosestPointInBoxZ = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; + if(!(boxToClosestPointInBoxX > negHalfExtX)) { + boxToClosestPointInBoxX = negHalfExtX; + } + if(!(boxToClosestPointInBoxY > negHalfExtY)) { + boxToClosestPointInBoxY = negHalfExtY; + } + if(!(boxToClosestPointInBoxZ > negHalfExtZ)) { + boxToClosestPointInBoxZ = negHalfExtZ; + } + let closestPointToSphereInBoxX; + let closestPointToSphereInBoxY; + let closestPointToSphereInBoxZ; + closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX; + closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY; + closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ; + let dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; if(dist >= r * r) { return; } dist = Math.sqrt(dist); - var boxToClosestPointX1; - var boxToClosestPointY1; - var boxToClosestPointZ1; - var closestPointToSphereX; - var closestPointToSphereY; - var closestPointToSphereZ; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * boxToClosestPointInBoxX1 + tf2._rotation01 * boxToClosestPointInBoxY1 + tf2._rotation02 * boxToClosestPointInBoxZ1; - __tmp__Y3 = tf2._rotation10 * boxToClosestPointInBoxX1 + tf2._rotation11 * boxToClosestPointInBoxY1 + tf2._rotation12 * boxToClosestPointInBoxZ1; - __tmp__Z3 = tf2._rotation20 * boxToClosestPointInBoxX1 + tf2._rotation21 * boxToClosestPointInBoxY1 + tf2._rotation22 * boxToClosestPointInBoxZ1; - boxToClosestPointX1 = __tmp__X3; - boxToClosestPointY1 = __tmp__Y3; - boxToClosestPointZ1 = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; - __tmp__Y4 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; - __tmp__Z4 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; - closestPointToSphereX = __tmp__X4; - closestPointToSphereY = __tmp__Y4; - closestPointToSphereZ = __tmp__Z4; - var normalX1; - var normalY1; - var normalZ1; - var l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; + let boxToClosestPointX; + let boxToClosestPointY; + let boxToClosestPointZ; + let closestPointToSphereX; + let closestPointToSphereY; + let closestPointToSphereZ; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X1; + boxToClosestPointY = __tmp__Y1; + boxToClosestPointZ = __tmp__Z1; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; + __tmp__X2 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; + __tmp__Y2 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; + __tmp__Z2 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; + closestPointToSphereX = __tmp__X2; + closestPointToSphereY = __tmp__Y2; + closestPointToSphereZ = __tmp__Z2; + let normalX; + let normalY; + let normalZ; + let l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; if(l > 0) { l = 1 / Math.sqrt(l); } - normalX1 = closestPointToSphereX * l; - normalY1 = closestPointToSphereY * l; - normalZ1 = closestPointToSphereZ * l; - this.setNormal(result,normalX1,normalY1,normalZ1); - var pos1X1; - var pos1Y1; - var pos1Z1; - var pos2X1; - var pos2Y1; - var pos2Z1; - pos1X1 = tf1._positionX + normalX1 * -r; - pos1Y1 = tf1._positionY + normalY1 * -r; - pos1Z1 = tf1._positionZ + normalZ1 * -r; - pos2X1 = tf2._positionX + boxToClosestPointX1; - pos2Y1 = tf2._positionY + boxToClosestPointY1; - pos2Z1 = tf2._positionZ + boxToClosestPointZ1; - this.addPoint(result,pos1X1,pos1Y1,pos1Z1,pos2X1,pos2Y1,pos2Z1,r - dist,0); - } -}); -var oimo_collision_narrowphase_detector_SphereCapsuleDetector = function(swapped) { - oimo_collision_narrowphase_detector_Detector.call(this,swapped); -}; -oimo_collision_narrowphase_detector_SphereCapsuleDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { - var c2 = geom2; + normalX = closestPointToSphereX * l; + normalY = closestPointToSphereY * l; + normalZ = closestPointToSphereZ * l; + this.setNormal(result,normalX,normalY,normalZ); + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; + pos1X = tf1._positionX + normalX * -r; + pos1Y = tf1._positionY + normalY * -r; + pos1Z = tf1._positionZ + normalZ * -r; + pos2X = tf2._positionX + boxToClosestPointX; + pos2Y = tf2._positionY + boxToClosestPointY; + pos2Z = tf2._positionZ + boxToClosestPointZ; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r - dist,0); + } +} +class oimo_collision_narrowphase_detector_SphereCapsuleDetector extends oimo_collision_narrowphase_detector_Detector { + constructor(swapped) { + super(swapped); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { + let c2 = geom2; result.incremental = false; - var hh2 = c2._halfHeight; - var r1 = geom1._radius; - var r2 = c2._radius; - var axis2X; - var axis2Y; - var axis2Z; + let hh2 = c2._halfHeight; + let r1 = geom1._radius; + let r2 = c2._radius; + let axis2X; + let axis2Y; + let axis2Z; axis2X = tf2._rotation01; axis2Y = tf2._rotation11; axis2Z = tf2._rotation21; - var cp1X; - var cp1Y; - var cp1Z; + let cp1X; + let cp1Y; + let cp1Z; cp1X = tf1._positionX; cp1Y = tf1._positionY; cp1Z = tf1._positionZ; - var p2X; - var p2Y; - var p2Z; - var q2X; - var q2Y; - var q2Z; + let p2X; + let p2Y; + let p2Z; + let q2X; + let q2Y; + let q2Z; p2X = tf2._positionX + axis2X * -hh2; p2Y = tf2._positionY + axis2Y * -hh2; p2Z = tf2._positionZ + axis2Z * -hh2; q2X = tf2._positionX + axis2X * hh2; q2Y = tf2._positionY + axis2Y * hh2; q2Z = tf2._positionZ + axis2Z * hh2; - var p12X; - var p12Y; - var p12Z; + let p12X; + let p12Y; + let p12Z; p12X = cp1X - p2X; p12Y = cp1Y - p2Y; p12Z = cp1Z - p2Z; - var d2X; - var d2Y; - var d2Z; + let d2X; + let d2Y; + let d2Z; d2X = q2X - p2X; d2Y = q2Y - p2Y; d2Z = q2Z - p2Z; - var d22 = hh2 * hh2 * 4; - var t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; + let d22 = hh2 * hh2 * 4; + let t = p12X * d2X + p12Y * d2Y + p12Z * d2Z; if(t < 0) { t = 0; } else if(t > d22) { @@ -6617,26 +6677,26 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi } else { t /= d22; } - var cp2X; - var cp2Y; - var cp2Z; + let cp2X; + let cp2Y; + let cp2Z; cp2X = p2X + d2X * t; cp2Y = p2Y + d2Y * t; cp2Z = p2Z + d2Z * t; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = cp1X - cp2X; dY = cp1Y - cp2Y; dZ = cp1Z - cp2Z; - var len2 = dX * dX + dY * dY + dZ * dZ; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6647,12 +6707,12 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1X; - var pos1Y; - var pos1Z; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = cp1X + nX * -r1; pos1Y = cp1Y + nY * -r1; pos1Z = cp1Z + nZ * -r1; @@ -6661,30 +6721,29 @@ oimo_collision_narrowphase_detector_SphereCapsuleDetector.prototype = $extend(oi pos2Z = cp2Z + nZ * r2; this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); } -}); -var oimo_collision_narrowphase_detector_SphereSphereDetector = function() { - oimo_collision_narrowphase_detector_Detector.call(this,false); -}; -oimo_collision_narrowphase_detector_SphereSphereDetector.__super__ = oimo_collision_narrowphase_detector_Detector; -oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oimo_collision_narrowphase_detector_Detector.prototype,{ - detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { +} +class oimo_collision_narrowphase_detector_SphereSphereDetector extends oimo_collision_narrowphase_detector_Detector { + constructor() { + super(false); + } + detectImpl(result,geom1,geom2,tf1,tf2,cachedData) { result.incremental = false; - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = tf1._positionX - tf2._positionX; dY = tf1._positionY - tf2._positionY; dZ = tf1._positionZ - tf2._positionZ; - var r1 = geom1._radius; - var r2 = geom2._radius; - var len2 = dX * dX + dY * dY + dZ * dZ; + let r1 = geom1._radius; + let r2 = geom2._radius; + let len2 = dX * dX + dY * dY + dZ * dZ; if(len2 >= (r1 + r2) * (r1 + r2)) { return; } - var len = Math.sqrt(len2); - var nX; - var nY; - var nZ; + let len = Math.sqrt(len2); + let nX; + let nY; + let nZ; if(len > 0) { nX = dX * (1 / len); nY = dY * (1 / len); @@ -6695,12 +6754,12 @@ oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oim nZ = 0; } this.setNormal(result,nX,nY,nZ); - var pos1X; - var pos1Y; - var pos1Z; - var pos2X; - var pos2Y; - var pos2Z; + let pos1X; + let pos1Y; + let pos1Z; + let pos2X; + let pos2Y; + let pos2Z; pos1X = tf1._positionX + nX * -r1; pos1Y = tf1._positionY + nY * -r1; pos1Z = tf1._positionZ + nZ * -r1; @@ -6709,22 +6768,22 @@ oimo_collision_narrowphase_detector_SphereSphereDetector.prototype = $extend(oim pos2Z = tf2._positionZ + nZ * r2; this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r1 + r2 - len,0); } -}); -var oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron = function() { - this._vertices = new Array(oimo_common_Setting.maxEPAVertices); - this._center = new oimo_common_Vec3(); - this._numVertices = 0; - this._triangleList = null; - this._triangleListLast = null; - this._numTriangles = 0; - this._trianglePool = null; - this._vertexPool = null; -}; -oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { - dumpHoleEdge: function(first) { - } - ,validate: function() { - var t = this._triangleList; +} +class oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron { + constructor() { + this._vertices = new Array(oimo_common_Setting.maxEPAVertices); + this._center = new oimo_common_Vec3(); + this._numVertices = 0; + this._triangleList = null; + this._triangleListLast = null; + this._numTriangles = 0; + this._trianglePool = null; + this._vertexPool = null; + } + dumpHoleEdge(first) { + } + validate() { + let t = this._triangleList; while(t != null) { t._vertices[0]._tmpEdgeLoopOuterTriangle = null; t._vertices[0]._tmpEdgeLoopNext = null; @@ -6760,79 +6819,79 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { } return true; } - ,findEdgeLoop: function(id,base,from) { + findEdgeLoop(id,base,from) { if(base._tmpDfsId == id) { return; } base._tmpDfsId = id; - var _this = base.tmp; + let _this = base.tmp; _this.x = from.x; _this.y = from.y; _this.z = from.z; - var v = base._vertices[0].v; + let v = base._vertices[0].v; _this.x -= v.x; _this.y -= v.y; _this.z -= v.z; - var _this1 = base.tmp; - var v1 = base._normal; + let _this1 = base.tmp; + let v1 = base._normal; base._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(!base._tmpDfsVisible) { this._status = 6; return; } - var _g = 0; + let _g = 0; while(_g < 3) { - var i = _g++; - var t = base._adjacentTriangles[i]; + let i = _g++; + let t = base._adjacentTriangles[i]; if(t == null) { continue; } - var _this2 = t.tmp; - _this2.x = from.x; - _this2.y = from.y; - _this2.z = from.z; - var v2 = t._vertices[0].v; - _this2.x -= v2.x; - _this2.y -= v2.y; - _this2.z -= v2.z; - var _this3 = t.tmp; - var v3 = t._normal; - t._tmpDfsVisible = _this3.x * v3.x + _this3.y * v3.y + _this3.z * v3.z > 0; + let _this = t.tmp; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + let v = t._vertices[0].v; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + let _this1 = t.tmp; + let v1 = t._normal; + t._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(t._tmpDfsVisible) { this.findEdgeLoop(id,t,from); } else { - var v11 = base._vertices[i]; - v11._tmpEdgeLoopNext = base._vertices[base._nextIndex[i]]; - v11._tmpEdgeLoopOuterTriangle = t; + let v1 = base._vertices[i]; + v1._tmpEdgeLoopNext = base._vertices[base._nextIndex[i]]; + v1._tmpEdgeLoopOuterTriangle = t; } } - var triangle = base._adjacentTriangles[0]; + let triangle = base._adjacentTriangles[0]; if(triangle != null) { - var pairIndex = base._adjacentPairIndex[0]; + let pairIndex = base._adjacentPairIndex[0]; triangle._adjacentTriangles[pairIndex] = null; triangle._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[0] = null; base._adjacentPairIndex[0] = -1; } - var triangle1 = base._adjacentTriangles[1]; + let triangle1 = base._adjacentTriangles[1]; if(triangle1 != null) { - var pairIndex1 = base._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + let pairIndex = base._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex] = null; + triangle1._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[1] = null; base._adjacentPairIndex[1] = -1; } - var triangle2 = base._adjacentTriangles[2]; + let triangle2 = base._adjacentTriangles[2]; if(triangle2 != null) { - var pairIndex2 = base._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + let pairIndex = base._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex] = null; + triangle2._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[2] = null; base._adjacentPairIndex[2] = -1; } this._numTriangles--; - var prev = base._prev; - var next = base._next; + let prev = base._prev; + let next = base._next; if(prev != null) { prev._next = next; } @@ -6851,65 +6910,65 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { base._next = this._trianglePool; this._trianglePool = base; } - ,_init: function(v1,v2,v3,v4) { + _init(v1,v2,v3,v4) { this._status = 0; this._numVertices = 4; this._vertices[0] = v1; this._vertices[1] = v2; this._vertices[2] = v3; this._vertices[3] = v4; - var _this = this._center; - var v = v1.v; + let _this = this._center; + let v = v1.v; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var v5 = v2.v; + let v5 = v2.v; _this.x += v5.x; _this.y += v5.y; _this.z += v5.z; - var v6 = v3.v; + let v6 = v3.v; _this.x += v6.x; _this.y += v6.y; _this.z += v6.z; - var v7 = v4.v; + let v7 = v4.v; _this.x += v7.x; _this.y += v7.y; _this.z += v7.z; _this.x *= 0.25; _this.y *= 0.25; _this.z *= 0.25; - var first = this._trianglePool; + let first = this._trianglePool; if(first != null) { this._trianglePool = first._next; first._next = null; } else { first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t1 = first; - var first1 = this._trianglePool; + let t1 = first; + let first1 = this._trianglePool; if(first1 != null) { this._trianglePool = first1._next; first1._next = null; } else { first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t2 = first1; - var first2 = this._trianglePool; + let t2 = first1; + let first2 = this._trianglePool; if(first2 != null) { this._trianglePool = first2._next; first2._next = null; } else { first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t3 = first2; - var first3 = this._trianglePool; + let t3 = first2; + let first3 = this._trianglePool; if(first3 != null) { this._trianglePool = first3._next; first3._next = null; } else { first3 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t4 = first3; + let t4 = first3; if(!t1.init(v1,v2,v3,this._center,true)) { this._status = 1; } @@ -6978,18 +7037,19 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { } return this._status == 0; } - ,_addVertex: function(vertex,base) { + _addVertex(vertex,base) { this._vertices[this._numVertices++] = vertex; - var v1 = base._vertices[0]; + let v1 = base._vertices[0]; this.findEdgeLoop(this._numVertices,base,vertex.v); if(this._status != 0) { return false; } - var v = v1; - var prevT = null; - var firstT = null; + let v = v1; + let prevT = null; + let firstT = null; while(true) { if(v._tmpEdgeLoopNext == null) { + this._dumpAsObjModel(); this._status = 4; return false; } @@ -6997,14 +7057,14 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { this._status = 5; return false; } - var first = this._trianglePool; + let first = this._trianglePool; if(first != null) { this._trianglePool = first._next; first._next = null; } else { first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t = first; + let t = first; if(firstT == null) { firstT = t; } @@ -7046,68 +7106,69 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { return false; } } - ,_dumpAsObjModel: function() { - } -}; -var oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState = function() { }; -var oimo_collision_narrowphase_detector_gjkepa_EpaTriangle = function() { - this.id = ++oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.count; - this._next = null; - this._prev = null; - this._normal = new oimo_common_Vec3(); - this._distanceSq = 0; - this._tmpDfsId = 0; - this._tmpDfsVisible = false; - this._vertices = new Array(3); - this._adjacentTriangles = new Array(3); - this._adjacentPairIndex = new Array(3); - this.tmp = new oimo_common_Vec3(); - this._nextIndex = new Array(3); - this._nextIndex[0] = 1; - this._nextIndex[1] = 2; - this._nextIndex[2] = 0; -}; -oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { - init: function(vertex1,vertex2,vertex3,center,autoCheck) { + _dumpAsObjModel() { + } +} +class oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedronState { +} +class oimo_collision_narrowphase_detector_gjkepa_EpaTriangle { + constructor() { + this.id = ++oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.count; + this._next = null; + this._prev = null; + this._normal = new oimo_common_Vec3(); + this._distanceSq = 0; + this._tmpDfsId = 0; + this._tmpDfsVisible = false; + this._vertices = new Array(3); + this._adjacentTriangles = new Array(3); + this._adjacentPairIndex = new Array(3); + this.tmp = new oimo_common_Vec3(); + this._nextIndex = new Array(3); + this._nextIndex[0] = 1; + this._nextIndex[1] = 2; + this._nextIndex[2] = 0; + } + init(vertex1,vertex2,vertex3,center,autoCheck) { if(autoCheck == null) { autoCheck = false; } - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - var v3X; - var v3Y; - var v3Z; - var vcX; - var vcY; - var vcZ; - var v = vertex1.v; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let vcX; + let vcY; + let vcZ; + let v = vertex1.v; v1X = v.x; v1Y = v.y; v1Z = v.z; - var v1 = vertex2.v; + let v1 = vertex2.v; v2X = v1.x; v2Y = v1.y; v2Z = v1.z; - var v2 = vertex3.v; + let v2 = vertex3.v; v3X = v2.x; v3Y = v2.y; v3Z = v2.z; vcX = center.x; vcY = center.y; vcZ = center.z; - var v12X; - var v12Y; - var v12Z; - var v13X; - var v13Y; - var v13Z; - var vc1X; - var vc1Y; - var vc1Z; + let v12X; + let v12Y; + let v12Z; + let v13X; + let v13Y; + let v13Z; + let vc1X; + let vc1Y; + let vc1Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; @@ -7117,16 +7178,16 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { vc1X = v1X - vcX; vc1Y = v1Y - vcY; vc1Z = v1Z - vcZ; - var inorX; - var inorY; - var inorZ; + let inorX; + let inorY; + let inorZ; inorX = v12Y * v13Z - v12Z * v13Y; inorY = v12Z * v13X - v12X * v13Z; inorZ = v12X * v13Y - v12Y * v13X; - var inverted = false; + let inverted = false; if(vc1X * inorX + vc1Y * inorY + vc1Z * inorZ < 0) { if(autoCheck) { - var tmp = vertex2; + let tmp = vertex2; vertex2 = vertex3; vertex3 = tmp; inorX *= -1; @@ -7139,32 +7200,32 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._vertices[0] = vertex1; this._vertices[1] = vertex2; this._vertices[2] = vertex3; - var v3 = this._normal; + let v3 = this._normal; v3.x = inorX; v3.y = inorY; v3.z = inorZ; - var vec1 = vertex1.v; - var vec2 = vertex2.v; - var vec3 = vertex3.v; - var out = this.tmp; - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - var v3X1; - var v3Y1; - var v3Z1; - var v12X1; - var v12Y1; - var v12Z1; - var v23X; - var v23Y; - var v23Z; - var v31X; - var v31Y; - var v31Z; + let vec1 = vertex1.v; + let vec2 = vertex2.v; + let vec3 = vertex3.v; + let out = this.tmp; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X1; + let v3Y1; + let v3Z1; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; v1X1 = vec1.x; v1Y1 = vec1.y; v1Z1 = vec1.z; @@ -7183,21 +7244,21 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { v31X = v1X1 - v3X1; v31Y = v1Y1 - v3Y1; v31Z = v1Z1 - v3Z1; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12X; - var n12Y; - var n12Z; - var n23X; - var n23Y; - var n23Z; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -7207,49 +7268,49 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var mind = -1; - var minvX; - var minvY; - var minvZ; + let mind = -1; + let minvX; + let minvY; + let minvZ; minvX = 0; minvY = 0; minvZ = 0; if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec1.x; - v1Y2 = vec1.y; - v1Z2 = vec1.z; - v2X2 = vec2.x; - v2Y2 = vec2.y; - v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - out.x = v1X2; - out.y = v1Y2; - out.z = v1Z2; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; } else if(t > 1) { - out.x = v2X2; - out.y = v2Y2; - out.z = v2Z2; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var pX; - var pY; - var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; out.x = pX; out.y = pY; out.z = pZ; @@ -7260,46 +7321,46 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { minvZ = out.z; } if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - if(t1 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - } else if(t1 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; - } - var d = out.x * out.x + out.y * out.y + out.z * out.z; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; if(mind < 0 || d < mind) { mind = d; minvX = out.x; @@ -7308,48 +7369,48 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { } } if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - if(t2 < 0) { - out.x = v1X4; - out.y = v1Y4; - out.z = v1Z4; - } else if(t2 > 1) { - out.x = v2X4; - out.y = v2Y4; - out.z = v2Z4; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d1 < mind) { - mind = d1; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; minvX = out.x; minvY = out.y; minvZ = out.z; @@ -7360,14 +7421,14 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { out.y = minvY; out.z = minvZ; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var l2 = nX * nX + nY * nY + nZ * nZ; + let l2 = nX * nX + nY * nY + nZ * nZ; l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; @@ -7376,7 +7437,7 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { out.y = minvY; out.z = minvZ; } - var _this = this.tmp; + let _this = this.tmp; this._distanceSq = _this.x * _this.x + _this.y * _this.y + _this.z * _this.z; this._adjacentTriangles[0] = null; this._adjacentTriangles[1] = null; @@ -7386,8 +7447,8 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._adjacentPairIndex[2] = -1; return !inverted; } - ,setAdjacentTriangle: function(triangle) { - var count = 0; + setAdjacentTriangle(triangle) { + let count = 0; if(this._vertices[0] == triangle._vertices[this._nextIndex[0]] && this._vertices[this._nextIndex[0]] == triangle._vertices[0]) { this._adjacentTriangles[0] = triangle; this._adjacentPairIndex[0] = 0; @@ -7456,33 +7517,33 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { } return true; } - ,removeAdjacentTriangles: function() { - var triangle = this._adjacentTriangles[0]; + removeAdjacentTriangles() { + let triangle = this._adjacentTriangles[0]; if(triangle != null) { - var pairIndex = this._adjacentPairIndex[0]; + let pairIndex = this._adjacentPairIndex[0]; triangle._adjacentTriangles[pairIndex] = null; triangle._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[0] = null; this._adjacentPairIndex[0] = -1; } - var triangle1 = this._adjacentTriangles[1]; + let triangle1 = this._adjacentTriangles[1]; if(triangle1 != null) { - var pairIndex1 = this._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + let pairIndex = this._adjacentPairIndex[1]; + triangle1._adjacentTriangles[pairIndex] = null; + triangle1._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[1] = null; this._adjacentPairIndex[1] = -1; } - var triangle2 = this._adjacentTriangles[2]; + let triangle2 = this._adjacentTriangles[2]; if(triangle2 != null) { - var pairIndex2 = this._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + let pairIndex = this._adjacentPairIndex[2]; + triangle2._adjacentTriangles[pairIndex] = null; + triangle2._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[2] = null; this._adjacentPairIndex[2] = -1; } } - ,removeReferences: function() { + removeReferences() { this._next = null; this._prev = null; this._tmpDfsId = 0; @@ -7498,26 +7559,26 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._adjacentPairIndex[1] = 0; this._adjacentPairIndex[2] = 0; } - ,dump: function() { - } -}; -var oimo_collision_narrowphase_detector_gjkepa_EpaVertex = function() { - this.randId = Math.random() * 100000 | 0; - this.v = new oimo_common_Vec3(); - this.w1 = new oimo_common_Vec3(); - this.w2 = new oimo_common_Vec3(); -}; -oimo_collision_narrowphase_detector_gjkepa_EpaVertex.prototype = { - init: function(v,w1,w2) { - var _this = this.v; + dump() { + } +} +class oimo_collision_narrowphase_detector_gjkepa_EpaVertex { + constructor() { + this.randId = Math.random() * 100000 | 0; + this.v = new oimo_common_Vec3(); + this.w1 = new oimo_common_Vec3(); + this.w2 = new oimo_common_Vec3(); + } + init(v,w1,w2) { + let _this = this.v; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1; + let _this1 = this.w1; _this1.x = w1.x; _this1.y = w1.y; _this1.z = w1.z; - var _this2 = this.w2; + let _this2 = this.w2; _this2.x = w2.x; _this2.y = w2.y; _this2.z = w2.z; @@ -7526,142 +7587,141 @@ oimo_collision_narrowphase_detector_gjkepa_EpaVertex.prototype = { this._tmpEdgeLoopOuterTriangle = null; return this; } - ,removeReferences: function() { + removeReferences() { this._next = null; this._tmpEdgeLoopNext = null; this._tmpEdgeLoopOuterTriangle = null; } -}; -var oimo_collision_narrowphase_detector_gjkepa_GjkCache = function() { - this.prevClosestDir = new oimo_common_Vec3(); -}; -oimo_collision_narrowphase_detector_gjkepa_GjkCache.prototype = { - clear: function() { - this.prevClosestDir.zero(); - } -}; -var oimo_common_Vec3 = function(x,y,z) { - if(z == null) { - z = 0; +} +class oimo_collision_narrowphase_detector_gjkepa_GjkCache { + constructor() { + this.prevClosestDir = new oimo_common_Vec3(); } - if(y == null) { - y = 0; + clear() { + this.prevClosestDir.zero(); } - if(x == null) { - x = 0; +} +class oimo_common_Vec3 { + constructor(x,y,z) { + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + oimo_common_Vec3.numCreations++; } - this.x = x; - this.y = y; - this.z = z; - oimo_common_Vec3.numCreations++; -}; -oimo_common_Vec3.prototype = { - init: function(x,y,z) { + init(x,y,z) { this.x = x; this.y = y; this.z = z; return this; } - ,zero: function() { + zero() { this.x = 0; this.y = 0; this.z = 0; return this; } - ,add: function(v) { + add(v) { return new oimo_common_Vec3(this.x + v.x,this.y + v.y,this.z + v.z); } - ,add3: function(vx,vy,vz) { + add3(vx,vy,vz) { return new oimo_common_Vec3(this.x + vx,this.y + vy,this.z + vz); } - ,addScaled: function(v,s) { + addScaled(v,s) { return new oimo_common_Vec3(this.x + v.x * s,this.y + v.y * s,this.z + v.z * s); } - ,sub: function(v) { + sub(v) { return new oimo_common_Vec3(this.x - v.x,this.y - v.y,this.z - v.z); } - ,sub3: function(vx,vy,vz) { + sub3(vx,vy,vz) { return new oimo_common_Vec3(this.x - vx,this.y - vy,this.z - vz); } - ,scale: function(s) { + scale(s) { return new oimo_common_Vec3(this.x * s,this.y * s,this.z * s); } - ,scale3: function(sx,sy,sz) { + scale3(sx,sy,sz) { return new oimo_common_Vec3(this.x * sx,this.y * sy,this.z * sz); } - ,dot: function(v) { + dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z; } - ,cross: function(v) { + cross(v) { return new oimo_common_Vec3(this.y * v.z - this.z * v.y,this.z * v.x - this.x * v.z,this.x * v.y - this.y * v.x); } - ,addEq: function(v) { + addEq(v) { this.x += v.x; this.y += v.y; this.z += v.z; return this; } - ,add3Eq: function(vx,vy,vz) { + add3Eq(vx,vy,vz) { this.x += vx; this.y += vy; this.z += vz; return this; } - ,addScaledEq: function(v,s) { + addScaledEq(v,s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; return this; } - ,subEq: function(v) { + subEq(v) { this.x -= v.x; this.y -= v.y; this.z -= v.z; return this; } - ,sub3Eq: function(vx,vy,vz) { + sub3Eq(vx,vy,vz) { this.x -= vx; this.y -= vy; this.z -= vz; return this; } - ,scaleEq: function(s) { + scaleEq(s) { this.x *= s; this.y *= s; this.z *= s; return this; } - ,scale3Eq: function(sx,sy,sz) { + scale3Eq(sx,sy,sz) { this.x *= sx; this.y *= sy; this.z *= sz; return this; } - ,crossEq: function(v) { - var y = this.z * v.x - this.x * v.z; - var z = this.x * v.y - this.y * v.x; + crossEq(v) { + let y = this.z * v.x - this.x * v.z; + let z = this.x * v.y - this.y * v.x; this.x = this.y * v.z - this.z * v.y; this.y = y; this.z = z; return this; } - ,mulMat3: function(m) { + mulMat3(m) { return new oimo_common_Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02,this.x * m.e10 + this.y * m.e11 + this.z * m.e12,this.x * m.e20 + this.y * m.e21 + this.z * m.e22); } - ,mulMat4: function(m) { + mulMat4(m) { return new oimo_common_Vec3(this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03,this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13,this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23); } - ,mulTransform: function(tf) { - var vX; - var vY; - var vZ; - var v = this; - vX = v.x; - vY = v.y; - vZ = v.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + mulTransform(tf) { + let vX; + let vY; + let vZ; + vX = this.x; + vY = this.y; + vZ = this.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; @@ -7671,39 +7731,38 @@ oimo_common_Vec3.prototype = { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var res = new oimo_common_Vec3(); + let res = new oimo_common_Vec3(); res.x = vX; res.y = vY; res.z = vZ; return res; } - ,mulMat3Eq: function(m) { - var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; - var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; + mulMat3Eq(m) { + let y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12; + let z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22; this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02; this.y = y; this.z = z; return this; } - ,mulMat4Eq: function(m) { - var y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; - var z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; + mulMat4Eq(m) { + let y = this.x * m.e10 + this.y * m.e11 + this.z * m.e12 + m.e13; + let z = this.x * m.e20 + this.y * m.e21 + this.z * m.e22 + m.e23; this.x = this.x * m.e00 + this.y * m.e01 + this.z * m.e02 + m.e03; this.y = y; this.z = z; return this; } - ,mulTransformEq: function(tf) { - var vX; - var vY; - var vZ; - var v = this; - vX = v.x; - vY = v.y; - vZ = v.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + mulTransformEq(tf) { + let vX; + let vY; + let vZ; + vX = this.x; + vY = this.y; + vZ = this.z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf._rotation00 * vX + tf._rotation01 * vY + tf._rotation02 * vZ; __tmp__Y = tf._rotation10 * vX + tf._rotation11 * vY + tf._rotation12 * vZ; __tmp__Z = tf._rotation20 * vX + tf._rotation21 * vY + tf._rotation22 * vZ; @@ -7713,27 +7772,26 @@ oimo_common_Vec3.prototype = { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var v1 = this; - v1.x = vX; - v1.y = vY; - v1.z = vZ; + this.x = vX; + this.y = vY; + this.z = vZ; return this; } - ,length: function() { + length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); } - ,lengthSq: function() { + lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; } - ,normalized: function() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + normalized() { + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); if(invLen > 0) { invLen = 1 / invLen; } return new oimo_common_Vec3(this.x * invLen,this.y * invLen,this.z * invLen); } - ,normalize: function() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + normalize() { + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); if(invLen > 0) { invLen = 1 / invLen; } @@ -7742,44 +7800,44 @@ oimo_common_Vec3.prototype = { this.z *= invLen; return this; } - ,negate: function() { + negate() { return new oimo_common_Vec3(-this.x,-this.y,-this.z); } - ,negateEq: function() { + negateEq() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; } - ,copyFrom: function(v) { + copyFrom(v) { this.x = v.x; this.y = v.y; this.z = v.z; return this; } - ,clone: function() { + clone() { return new oimo_common_Vec3(this.x,this.y,this.z); } - ,toString: function() { + toString() { return "Vec3[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + "]"; } -}; -var oimo_common_Transform = function() { - this._positionX = 0; - this._positionY = 0; - this._positionZ = 0; - this._rotation00 = 1; - this._rotation01 = 0; - this._rotation02 = 0; - this._rotation10 = 0; - this._rotation11 = 1; - this._rotation12 = 0; - this._rotation20 = 0; - this._rotation21 = 0; - this._rotation22 = 1; -}; -oimo_common_Transform.prototype = { - identity: function() { +} +class oimo_common_Transform { + constructor() { + this._positionX = 0; + this._positionY = 0; + this._positionZ = 0; + this._rotation00 = 1; + this._rotation01 = 0; + this._rotation02 = 0; + this._rotation10 = 0; + this._rotation11 = 1; + this._rotation12 = 0; + this._rotation20 = 0; + this._rotation21 = 0; + this._rotation22 = 1; + } + identity() { this._positionX = 0; this._positionY = 0; this._positionZ = 0; @@ -7794,28 +7852,28 @@ oimo_common_Transform.prototype = { this._rotation22 = 1; return this; } - ,getPosition: function() { - var position = new oimo_common_Vec3(); + getPosition() { + let position = new oimo_common_Vec3(); position.x = this._positionX; position.y = this._positionY; position.z = this._positionZ; return position; } - ,getPositionTo: function(position) { + getPositionTo(position) { position.x = this._positionX; position.y = this._positionY; position.z = this._positionZ; } - ,setPosition: function(position) { + setPosition(position) { this._positionX = position.x; this._positionY = position.y; this._positionZ = position.z; return this; } - ,translate: function(translation) { - var diffX; - var diffY; - var diffZ; + translate(translation) { + let diffX; + let diffY; + let diffZ; diffX = translation.x; diffY = translation.y; diffZ = translation.z; @@ -7823,8 +7881,8 @@ oimo_common_Transform.prototype = { this._positionY += diffY; this._positionZ += diffZ; } - ,getRotation: function() { - var rotation = new oimo_common_Mat3(); + getRotation() { + let rotation = new oimo_common_Mat3(); rotation.e00 = this._rotation00; rotation.e01 = this._rotation01; rotation.e02 = this._rotation02; @@ -7836,7 +7894,7 @@ oimo_common_Transform.prototype = { rotation.e22 = this._rotation22; return rotation; } - ,getRotationTo: function(out) { + getRotationTo(out) { out.e00 = this._rotation00; out.e01 = this._rotation01; out.e02 = this._rotation02; @@ -7847,7 +7905,7 @@ oimo_common_Transform.prototype = { out.e21 = this._rotation21; out.e22 = this._rotation22; } - ,setRotation: function(rotation) { + setRotation(rotation) { this._rotation00 = rotation.e00; this._rotation01 = rotation.e01; this._rotation02 = rotation.e02; @@ -7859,19 +7917,19 @@ oimo_common_Transform.prototype = { this._rotation22 = rotation.e22; return this; } - ,setRotationXyz: function(eulerAngles) { - var xyzX; - var xyzY; - var xyzZ; + setRotationXyz(eulerAngles) { + let xyzX; + let xyzY; + let xyzZ; xyzX = eulerAngles.x; xyzY = eulerAngles.y; xyzZ = eulerAngles.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); this._rotation00 = cy * cz; this._rotation01 = -cy * sz; this._rotation02 = sy; @@ -7882,16 +7940,16 @@ oimo_common_Transform.prototype = { this._rotation21 = cz * sx + cx * sy * sz; this._rotation22 = cx * cy; } - ,rotate: function(rotation) { - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; + rotate(rotation) { + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; rot00 = rotation.e00; rot01 = rotation.e01; rot02 = rotation.e02; @@ -7901,15 +7959,15 @@ oimo_common_Transform.prototype = { rot20 = rotation.e20; rot21 = rotation.e21; rot22 = rotation.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; @@ -7929,28 +7987,28 @@ oimo_common_Transform.prototype = { this._rotation21 = __tmp__21; this._rotation22 = __tmp__22; } - ,rotateXyz: function(eulerAngles) { - var xyzX; - var xyzY; - var xyzZ; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; + rotateXyz(eulerAngles) { + let xyzX; + let xyzY; + let xyzZ; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; xyzX = eulerAngles.x; xyzY = eulerAngles.y; xyzZ = eulerAngles.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); rot00 = cy * cz; rot01 = -cy * sz; rot02 = sy; @@ -7960,15 +8018,15 @@ oimo_common_Transform.prototype = { rot20 = sx * sz - cx * cz * sy; rot21 = cz * sx + cx * sy * sz; rot22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._rotation00 + rot01 * this._rotation10 + rot02 * this._rotation20; __tmp__01 = rot00 * this._rotation01 + rot01 * this._rotation11 + rot02 * this._rotation21; __tmp__02 = rot00 * this._rotation02 + rot01 * this._rotation12 + rot02 * this._rotation22; @@ -7988,17 +8046,17 @@ oimo_common_Transform.prototype = { this._rotation21 = __tmp__21; this._rotation22 = __tmp__22; } - ,getOrientation: function() { - var q = new oimo_common_Quat(); - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._rotation00; - var e11 = this._rotation11; - var e22 = this._rotation22; - var t = e00 + e11 + e22; - var s; + getOrientation() { + let q = new oimo_common_Quat(); + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._rotation00; + let e11 = this._rotation11; + let e22 = this._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -8043,16 +8101,16 @@ oimo_common_Transform.prototype = { q.w = iqW; return q; } - ,getOrientationTo: function(orientation) { - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._rotation00; - var e11 = this._rotation11; - var e22 = this._rotation22; - var t = e00 + e11 + e22; - var s; + getOrientationTo(orientation) { + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._rotation00; + let e11 = this._rotation11; + let e22 = this._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -8096,31 +8154,31 @@ oimo_common_Transform.prototype = { orientation.z = iqZ; orientation.w = iqW; } - ,setOrientation: function(quaternion) { - var qX; - var qY; - var qZ; - var qW; + setOrientation(quaternion) { + let qX; + let qY; + let qZ; + let qW; qX = quaternion.x; qY = quaternion.y; qZ = quaternion.z; qW = quaternion.w; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._rotation00 = 1 - yy - zz; this._rotation01 = xy - wz; this._rotation02 = xz + wy; @@ -8132,8 +8190,8 @@ oimo_common_Transform.prototype = { this._rotation22 = 1 - xx - yy; return this; } - ,clone: function() { - var tf = new oimo_common_Transform(); + clone() { + let tf = new oimo_common_Transform(); tf._positionX = this._positionX; tf._positionY = this._positionY; tf._positionZ = this._positionZ; @@ -8148,7 +8206,7 @@ oimo_common_Transform.prototype = { tf._rotation22 = this._rotation22; return tf; } - ,copyFrom: function(transform) { + copyFrom(transform) { this._positionX = transform._positionX; this._positionY = transform._positionY; this._positionZ = transform._positionZ; @@ -8163,53 +8221,51 @@ oimo_common_Transform.prototype = { this._rotation22 = transform._rotation22; return this; } -}; -var oimo_common_Setting = function() { }; -var oimo_collision_narrowphase_detector_gjkepa_GjkEpa = function() { - this.s = new Array(4); - this.w1 = new Array(4); - this.w2 = new Array(4); - this.baseDirs = new Array(3); - this.baseDirs[0] = new oimo_common_Vec3(1,0,0); - this.baseDirs[1] = new oimo_common_Vec3(0,1,0); - this.baseDirs[2] = new oimo_common_Vec3(0,0,1); - this.tl1 = new oimo_common_Vec3(); - this.tl2 = new oimo_common_Vec3(); - this.rayX = new oimo_common_Vec3(); - this.rayR = new oimo_common_Vec3(); - this.tempTransform = new oimo_common_Transform(); - this.s[0] = new oimo_common_Vec3(); - this.w1[0] = new oimo_common_Vec3(); - this.w2[0] = new oimo_common_Vec3(); - this.s[1] = new oimo_common_Vec3(); - this.w1[1] = new oimo_common_Vec3(); - this.w2[1] = new oimo_common_Vec3(); - this.s[2] = new oimo_common_Vec3(); - this.w1[2] = new oimo_common_Vec3(); - this.w2[2] = new oimo_common_Vec3(); - this.s[3] = new oimo_common_Vec3(); - this.w1[3] = new oimo_common_Vec3(); - this.w2[3] = new oimo_common_Vec3(); - this.dir = new oimo_common_Vec3(); - this.closest = new oimo_common_Vec3(); - this.closestPoint1 = new oimo_common_Vec3(); - this.closestPoint2 = new oimo_common_Vec3(); - this.polyhedron = new oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron(); -}; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.getInstance = function() { - return oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; -}; -oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { - computeClosestPointsImpl: function(c1,c2,tf1,tf2,cache,useEpa) { +} +class oimo_common_Setting { +} +class oimo_collision_narrowphase_detector_gjkepa_GjkEpa { + constructor() { + this.s = new Array(4); + this.w1 = new Array(4); + this.w2 = new Array(4); + this.baseDirs = new Array(3); + this.baseDirs[0] = new oimo_common_Vec3(1,0,0); + this.baseDirs[1] = new oimo_common_Vec3(0,1,0); + this.baseDirs[2] = new oimo_common_Vec3(0,0,1); + this.tl1 = new oimo_common_Vec3(); + this.tl2 = new oimo_common_Vec3(); + this.rayX = new oimo_common_Vec3(); + this.rayR = new oimo_common_Vec3(); + this.tempTransform = new oimo_common_Transform(); + this.s[0] = new oimo_common_Vec3(); + this.w1[0] = new oimo_common_Vec3(); + this.w2[0] = new oimo_common_Vec3(); + this.s[1] = new oimo_common_Vec3(); + this.w1[1] = new oimo_common_Vec3(); + this.w2[1] = new oimo_common_Vec3(); + this.s[2] = new oimo_common_Vec3(); + this.w1[2] = new oimo_common_Vec3(); + this.w2[2] = new oimo_common_Vec3(); + this.s[3] = new oimo_common_Vec3(); + this.w1[3] = new oimo_common_Vec3(); + this.w2[3] = new oimo_common_Vec3(); + this.dir = new oimo_common_Vec3(); + this.closest = new oimo_common_Vec3(); + this.closestPoint1 = new oimo_common_Vec3(); + this.closestPoint2 = new oimo_common_Vec3(); + this.polyhedron = new oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron(); + } + computeClosestPointsImpl(c1,c2,tf1,tf2,cache,useEpa) { this.c1 = c1; this.c2 = c2; this.tf1 = tf1; this.tf2 = tf2; - var s = this.s; - var w1 = this.w1; - var w2 = this.w2; - var closest = this.closest; - var dir = this.dir; + let s = this.s; + let w1 = this.w1; + let w2 = this.w2; + let closest = this.closest; + let dir = this.dir; if(cache != null) { if(cache._gjkCache == null) { cache._gjkCache = new oimo_collision_narrowphase_detector_gjkepa_GjkCache(); @@ -8219,9 +8275,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { dir.zero(); } if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z == 0) { - var firstDirX; - var firstDirY; - var firstDirZ; + let firstDirX; + let firstDirY; + let firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; @@ -8235,95 +8291,95 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.simplexSize = 0; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v = this.w1[this.simplexSize]; + let _this = this.s[this.simplexSize]; + let v = this.w1[this.simplexSize]; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var v1 = this.w2[this.simplexSize]; + let v1 = this.w2[this.simplexSize]; _this.x -= v1.x; _this.y -= v1.y; _this.z -= v1.z; this.simplexSize = 1; - var count = 0; + let count = 0; while(count < 40) { - var v2 = 0; + let v = 0; switch(this.simplexSize) { case 1: - var v3 = s[0]; - closest.x = v3.x; - closest.y = v3.y; - closest.z = v3.z; - v2 = 1; + let v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - var v4 = s[0]; - v1X = v4.x; - v1Y = v4.y; - v1Z = v4.z; - var v5 = s[1]; - v2X = v5.x; - v2Y = v5.y; - v2Z = v5.z; - var v12X; - var v12Y; - var v12Z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + let v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; + let v12X; + let v12Y; + let v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { closest.x = v1X; closest.y = v1Y; closest.z = v1Z; - v2 = 1; + v = 1; } else if(t > 1) { closest.x = v2X; closest.y = v2Y; closest.z = v2Z; - v2 = 2; + v = 2; } else { - var pX; - var pY; - var pZ; + let pX; + let pY; + let pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; closest.x = pX; closest.y = pY; closest.z = pZ; - v2 = 3; + v = 3; } break; case 3: - var vec1 = s[0]; - var vec2 = s[1]; - var vec3 = s[2]; - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - var v3X; - var v3Y; - var v3Z; - var v12X1; - var v12Y1; - var v12Z1; - var v23X; - var v23Y; - var v23Z; - var v31X; - var v31Y; - var v31Z; + let vec1 = s[0]; + let vec2 = s[1]; + let vec3 = s[2]; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X; + let v3Y; + let v3Z; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; v1X1 = vec1.x; v1Y1 = vec1.y; v1Z1 = vec1.z; @@ -8342,21 +8398,21 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12X; - var n12Y; - var n12Z; - var n23X; - var n23Y; - var n23Z; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -8366,56 +8422,56 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var mind = -1; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec1.x; - v1Y2 = vec1.y; - v1Z2 = vec1.z; - v2X2 = vec2.x; - v2Y2 = vec2.y; - v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); - var b; - if(t1 < 0) { - closest.x = v1X2; - closest.y = v1Y2; - closest.z = v1Z2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; b = 1; - } else if(t1 > 1) { - closest.x = v2X2; - closest.y = v2Y2; - closest.z = v2Z2; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; b = 2; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - closest.x = pX1; - closest.y = pY1; - closest.z = pZ1; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; b = 3; } mini = b; @@ -8425,52 +8481,52 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvZ = closest.z; } if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b1; - if(t2 < 0) { - closest.x = v1X3; - closest.y = v1Y3; - closest.z = v1Z3; - b1 = 1; - } else if(t2 > 1) { - closest.x = v2X3; - closest.y = v2Y3; - closest.z = v2Z3; - b1 = 2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - closest.x = pX2; - closest.y = pY2; - closest.z = pZ2; - b1 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; if(mind < 0 || d < mind) { - mini = b1 << 1; + mini = b << 1; mind = d; minvX = closest.x; minvY = closest.y; @@ -8478,53 +8534,53 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } } if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - var b2; - if(t3 < 0) { - closest.x = v1X4; - closest.y = v1Y4; - closest.z = v1Z4; - b2 = 1; - } else if(t3 > 1) { - closest.x = v2X4; - closest.y = v2Y4; - closest.z = v2Z4; - b2 = 2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX3; - var pY3; - var pZ3; - pX3 = v1X4 + v12X4 * t3; - pY3 = v1Y4 + v12Y4 * t3; - pZ3 = v1Z4 + v12Z4 * t3; - closest.x = pX3; - closest.y = pY3; - closest.z = pZ3; - b2 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d1 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d1; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; minvX = closest.x; minvY = closest.y; minvZ = closest.z; @@ -8534,16 +8590,16 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v2 = mini; + v = mini; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var l2 = nX * nX + nY * nY + nZ * nZ; + let l2 = nX * nX + nY * nY + nZ * nZ; l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; @@ -8551,1125 +8607,1125 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v2 = 7; + v = 7; } break; case 4: - var vec11 = s[0]; - var vec21 = s[1]; - var vec31 = s[2]; - var vec4 = s[3]; - var v1X5; - var v1Y5; - var v1Z5; - var v2X5; - var v2Y5; - var v2Z5; - var v3X1; - var v3Y1; - var v3Z1; - var v4X; - var v4Y; - var v4Z; - var v12X5; - var v12Y5; - var v12Z5; - var v13X; - var v13Y; - var v13Z; - var v14X; - var v14Y; - var v14Z; - var v23X1; - var v23Y1; - var v23Z1; - var v24X; - var v24Y; - var v24Z; - v1X5 = vec11.x; - v1Y5 = vec11.y; - v1Z5 = vec11.z; - v2X5 = vec21.x; - v2Y5 = vec21.y; - v2Z5 = vec21.z; + let vec11 = s[0]; + let vec21 = s[1]; + let vec31 = s[2]; + let vec4 = s[3]; + let v1X2; + let v1Y2; + let v1Z2; + let v2X2; + let v2Y2; + let v2Z2; + let v3X1; + let v3Y1; + let v3Z1; + let v4X; + let v4Y; + let v4Z; + let v12X2; + let v12Y2; + let v12Z2; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X1; + let v23Y1; + let v23Z1; + let v24X; + let v24Y; + let v24Z; + v1X2 = vec11.x; + v1Y2 = vec11.y; + v1Z2 = vec11.z; + v2X2 = vec21.x; + v2Y2 = vec21.y; + v2Z2 = vec21.z; v3X1 = vec31.x; v3Y1 = vec31.y; v3Z1 = vec31.z; v4X = vec4.x; v4Y = vec4.y; v4Z = vec4.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v13X = v3X1 - v1X5; - v13Y = v3Y1 - v1Y5; - v13Z = v3Z1 - v1Z5; - v14X = v4X - v1X5; - v14Y = v4Y - v1Y5; - v14Z = v4Z - v1Z5; - v23X1 = v3X1 - v2X5; - v23Y1 = v3Y1 - v2Y5; - v23Z1 = v3Z1 - v2Z5; - v24X = v4X - v2X5; - v24Y = v4Y - v2Y5; - v24Z = v4Z - v2Z5; - var n123X; - var n123Y; - var n123Z; - var n134X; - var n134Y; - var n134Z; - var n142X; - var n142Y; - var n142Z; - var n243X; - var n243Y; - var n243Z; - n123X = v12Y5 * v13Z - v12Z5 * v13Y; - n123Y = v12Z5 * v13X - v12X5 * v13Z; - n123Z = v12X5 * v13Y - v12Y5 * v13X; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + v13X = v3X1 - v1X2; + v13Y = v3Y1 - v1Y2; + v13Z = v3Z1 - v1Z2; + v14X = v4X - v1X2; + v14Y = v4Y - v1Y2; + v14Z = v4Z - v1Z2; + v23X1 = v3X1 - v2X2; + v23Y1 = v3Y1 - v2Y2; + v23Z1 = v3Z1 - v2Z2; + v24X = v4X - v2X2; + v24Y = v4Y - v2Y2; + v24Z = v4Z - v2Z2; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; + n123X = v12Y2 * v13Z - v12Z2 * v13Y; + n123Y = v12Z2 * v13X - v12X2 * v13Z; + n123Z = v12X2 * v13Y - v12Y2 * v13X; n134X = v13Y * v14Z - v13Z * v14Y; n134Y = v13Z * v14X - v13X * v14Z; n134Z = v13X * v14Y - v13Y * v14X; - n142X = v14Y * v12Z5 - v14Z * v12Y5; - n142Y = v14Z * v12X5 - v14X * v12Z5; - n142Z = v14X * v12Y5 - v14Y * v12X5; + n142X = v14Y * v12Z2 - v14Z * v12Y2; + n142Y = v14Z * v12X2 - v14X * v12Z2; + n142Z = v14X * v12Y2 - v14Y * v12X2; n243X = v24Y * v23Z1 - v24Z * v23Y1; n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; - var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var mind1 = -1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; + let sign = v12X2 * n243X + v12Y2 * n243Y + v12Z2 * n243Z > 0 ? 1 : -1; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { - var v1X6; - var v1Y6; - var v1Z6; - var v2X6; - var v2Y6; - var v2Z6; - var v3X2; - var v3Y2; - var v3Z2; - var v12X6; - var v12Y6; - var v12Z6; - var v23X2; - var v23Y2; - var v23Z2; - var v31X1; - var v31Y1; - var v31Z1; - v1X6 = vec11.x; - v1Y6 = vec11.y; - v1Z6 = vec11.z; - v2X6 = vec21.x; - v2Y6 = vec21.y; - v2Z6 = vec21.z; - v3X2 = vec31.x; - v3Y2 = vec31.y; - v3Z2 = vec31.z; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - v23X2 = v3X2 - v2X6; - v23Y2 = v3Y2 - v2Y6; - v23Z2 = v3Z2 - v2Z6; - v31X1 = v1X6 - v3X2; - v31Y1 = v1Y6 - v3Y2; - v31Z1 = v1Z6 - v3Z2; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n12X1; - var n12Y1; - var n12Z1; - var n23X1; - var n23Y1; - var n23Z1; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; - n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; - n12Z1 = v12X6 * nY1 - v12Y6 * nX1; - n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; - n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; - n23Z1 = v23X2 * nY1 - v23Y2 * nX1; - n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; - n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; - n31Z1 = v31X1 * nY1 - v31Y1 * nX1; - var mind2 = -1; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { - var v1X7; - var v1Y7; - var v1Z7; - var v2X7; - var v2Y7; - var v2Z7; - v1X7 = vec11.x; - v1Y7 = vec11.y; - v1Z7 = vec11.z; - v2X7 = vec21.x; - v2Y7 = vec21.y; - v2Z7 = vec21.z; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); - var b3; - if(t4 < 0) { - closest.x = v1X7; - closest.y = v1Y7; - closest.z = v1Z7; - b3 = 1; - } else if(t4 > 1) { - closest.x = v2X7; - closest.y = v2Y7; - closest.z = v2Z7; - b3 = 2; + if((v1X2 * n123X + v1Y2 * n123Y + v1Z2 * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec31.x; + v3Y = vec31.y; + v3Z = vec31.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - closest.x = pX4; - closest.y = pY4; - closest.z = pZ4; - b3 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini2 = b3; - mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { - var v1X8; - var v1Y8; - var v1Z8; - var v2X8; - var v2Y8; - var v2Z8; - v1X8 = vec21.x; - v1Y8 = vec21.y; - v1Z8 = vec21.z; - v2X8 = vec31.x; - v2Y8 = vec31.y; - v2Z8 = vec31.z; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); - var b4; - if(t5 < 0) { - closest.x = v1X8; - closest.y = v1Y8; - closest.z = v1Z8; - b4 = 1; - } else if(t5 > 1) { - closest.x = v2X8; - closest.y = v2Y8; - closest.z = v2Z8; - b4 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - closest.x = pX5; - closest.y = pY5; - closest.z = pZ5; - b4 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d2 < mind2) { - mini2 = b4 << 1; - mind2 = d2; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { - var v1X9; - var v1Y9; - var v1Z9; - var v2X9; - var v2Y9; - var v2Z9; - v1X9 = vec11.x; - v1Y9 = vec11.y; - v1Z9 = vec11.z; - v2X9 = vec31.x; - v2Y9 = vec31.y; - v2Z9 = vec31.z; - var v12X9; - var v12Y9; - var v12Z9; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); - var b5; - if(t6 < 0) { - closest.x = v1X9; - closest.y = v1Y9; - closest.z = v1Z9; - b5 = 1; - } else if(t6 > 1) { - closest.x = v2X9; - closest.y = v2Y9; - closest.z = v2Z9; - b5 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX6; - var pY6; - var pZ6; - pX6 = v1X9 + v12X9 * t6; - pY6 = v1Y9 + v12Y9 * t6; - pZ6 = v1Z9 + v12Z9 * t6; - closest.x = pX6; - closest.y = pY6; - closest.z = pZ6; - b5 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d3 < mind2) { - mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d3; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b6; - if(mind2 > 0) { - closest.x = minvX2; - closest.y = minvY2; - closest.z = minvZ2; - b6 = mini2; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX1 *= l1; - nY1 *= l1; - nZ1 *= l1; - var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; - minvX2 = nX1 * l21; - minvY2 = nY1 * l21; - minvZ2 = nZ1 * l21; - closest.x = minvX2; - closest.y = minvY2; - closest.z = minvZ2; - b6 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - mini1 = b6; + mini1 = b; mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } - if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { - var v1X10; - var v1Y10; - var v1Z10; - var v2X10; - var v2Y10; - var v2Z10; - var v3X3; - var v3Y3; - var v3Z3; - var v12X10; - var v12Y10; - var v12Z10; - var v23X3; - var v23Y3; - var v23Z3; - var v31X2; - var v31Y2; - var v31Z2; - v1X10 = vec11.x; - v1Y10 = vec11.y; - v1Z10 = vec11.z; - v2X10 = vec31.x; - v2Y10 = vec31.y; - v2Z10 = vec31.z; - v3X3 = vec4.x; - v3Y3 = vec4.y; - v3Z3 = vec4.z; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - v23X3 = v3X3 - v2X10; - v23Y3 = v3Y3 - v2Y10; - v23Z3 = v3Z3 - v2Z10; - v31X2 = v1X10 - v3X3; - v31Y2 = v1Y10 - v3Y3; - v31Z2 = v1Z10 - v3Z3; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n12X2; - var n12Y2; - var n12Z2; - var n23X2; - var n23Y2; - var n23Z2; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; - n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; - n12Z2 = v12X10 * nY2 - v12Y10 * nX2; - n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; - n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; - n23Z2 = v23X3 * nY2 - v23Y3 * nX2; - n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; - n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; - n31Z2 = v31X2 * nY2 - v31Y2 * nX2; - var mind3 = -1; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { - var v1X11; - var v1Y11; - var v1Z11; - var v2X11; - var v2Y11; - var v2Z11; - v1X11 = vec11.x; - v1Y11 = vec11.y; - v1Z11 = vec11.z; - v2X11 = vec31.x; - v2Y11 = vec31.y; - v2Z11 = vec31.z; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); - var b7; - if(t7 < 0) { - closest.x = v1X11; - closest.y = v1Y11; - closest.z = v1Z11; - b7 = 1; - } else if(t7 > 1) { - closest.x = v2X11; - closest.y = v2Y11; - closest.z = v2Z11; - b7 = 2; + if((v1X2 * n134X + v1Y2 * n134Y + v1Z2 * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - closest.x = pX7; - closest.y = pY7; - closest.z = pZ7; - b7 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini3 = b7; - mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { - var v1X12; - var v1Y12; - var v1Z12; - var v2X12; - var v2Y12; - var v2Z12; - v1X12 = vec31.x; - v1Y12 = vec31.y; - v1Z12 = vec31.z; - v2X12 = vec4.x; - v2Y12 = vec4.y; - v2Z12 = vec4.z; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); - var b8; - if(t8 < 0) { - closest.x = v1X12; - closest.y = v1Y12; - closest.z = v1Z12; - b8 = 1; - } else if(t8 > 1) { - closest.x = v2X12; - closest.y = v2Y12; - closest.z = v2Z12; - b8 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - closest.x = pX8; - closest.y = pY8; - closest.z = pZ8; - b8 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d4 < mind3) { - mini3 = b8 << 1; - mind3 = d4; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { - var v1X13; - var v1Y13; - var v1Z13; - var v2X13; - var v2Y13; - var v2Z13; - v1X13 = vec11.x; - v1Y13 = vec11.y; - v1Z13 = vec11.z; - v2X13 = vec4.x; - v2Y13 = vec4.y; - v2Z13 = vec4.z; - var v12X13; - var v12Y13; - var v12Z13; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); - var b9; - if(t9 < 0) { - closest.x = v1X13; - closest.y = v1Y13; - closest.z = v1Z13; - b9 = 1; - } else if(t9 > 1) { - closest.x = v2X13; - closest.y = v2Y13; - closest.z = v2Z13; - b9 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX9; - var pY9; - var pZ9; - pX9 = v1X13 + v12X13 * t9; - pY9 = v1Y13 + v12Y13 * t9; - pZ9 = v1Z13 + v12Z13 * t9; - closest.x = pX9; - closest.y = pY9; - closest.z = pZ9; - b9 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d5 < mind3) { - mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d5; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b10; - if(mind3 > 0) { - closest.x = minvX3; - closest.y = minvY3; - closest.z = minvZ3; - b10 = mini3; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX2 *= l3; - nY2 *= l3; - nZ2 *= l3; - var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; - minvX3 = nX2 * l22; - minvY3 = nY2 * l22; - minvZ3 = nZ2 * l22; - closest.x = minvX3; - closest.y = minvY3; - closest.z = minvZ3; - b10 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d6 < mind1) { - mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d6; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 6) << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } } - if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { - var v1X14; - var v1Y14; - var v1Z14; - var v2X14; - var v2Y14; - var v2Z14; - var v3X4; - var v3Y4; - var v3Z4; - var v12X14; - var v12Y14; - var v12Z14; - var v23X4; - var v23Y4; - var v23Z4; - var v31X3; - var v31Y3; - var v31Z3; - v1X14 = vec11.x; - v1Y14 = vec11.y; - v1Z14 = vec11.z; - v2X14 = vec21.x; - v2Y14 = vec21.y; - v2Z14 = vec21.z; - v3X4 = vec4.x; - v3Y4 = vec4.y; - v3Z4 = vec4.z; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - v23X4 = v3X4 - v2X14; - v23Y4 = v3Y4 - v2Y14; - v23Z4 = v3Z4 - v2Z14; - v31X3 = v1X14 - v3X4; - v31Y3 = v1Y14 - v3Y4; - v31Z3 = v1Z14 - v3Z4; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n12X3; - var n12Y3; - var n12Z3; - var n23X3; - var n23Y3; - var n23Z3; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; - n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; - n12Z3 = v12X14 * nY3 - v12Y14 * nX3; - n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; - n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; - n23Z3 = v23X4 * nY3 - v23Y4 * nX3; - n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; - n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; - n31Z3 = v31X3 * nY3 - v31Y3 * nX3; - var mind4 = -1; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { - var v1X15; - var v1Y15; - var v1Z15; - var v2X15; - var v2Y15; - var v2Z15; - v1X15 = vec11.x; - v1Y15 = vec11.y; - v1Z15 = vec11.z; - v2X15 = vec21.x; - v2Y15 = vec21.y; - v2Z15 = vec21.z; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); - var b11; - if(t10 < 0) { - closest.x = v1X15; - closest.y = v1Y15; - closest.z = v1Z15; - b11 = 1; - } else if(t10 > 1) { - closest.x = v2X15; - closest.y = v2Y15; - closest.z = v2Z15; - b11 = 2; + if((v1X2 * n142X + v1Y2 * n142Y + v1Z2 * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - closest.x = pX10; - closest.y = pY10; - closest.z = pZ10; - b11 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini4 = b11; - mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { - var v1X16; - var v1Y16; - var v1Z16; - var v2X16; - var v2Y16; - var v2Z16; - v1X16 = vec21.x; - v1Y16 = vec21.y; - v1Z16 = vec21.z; - v2X16 = vec4.x; - v2Y16 = vec4.y; - v2Z16 = vec4.z; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); - var b12; - if(t11 < 0) { - closest.x = v1X16; - closest.y = v1Y16; - closest.z = v1Z16; - b12 = 1; - } else if(t11 > 1) { - closest.x = v2X16; - closest.y = v2Y16; - closest.z = v2Z16; - b12 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - closest.x = pX11; - closest.y = pY11; - closest.z = pZ11; - b12 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d7 < mind4) { - mini4 = b12 << 1; - mind4 = d7; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { - var v1X17; - var v1Y17; - var v1Z17; - var v2X17; - var v2Y17; - var v2Z17; - v1X17 = vec11.x; - v1Y17 = vec11.y; - v1Z17 = vec11.z; - v2X17 = vec4.x; - v2Y17 = vec4.y; - v2Z17 = vec4.z; - var v12X17; - var v12Y17; - var v12Z17; - v12X17 = v2X17 - v1X17; - v12Y17 = v2Y17 - v1Y17; - v12Z17 = v2Z17 - v1Z17; - var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); - var b13; - if(t12 < 0) { - closest.x = v1X17; - closest.y = v1Y17; - closest.z = v1Z17; - b13 = 1; - } else if(t12 > 1) { - closest.x = v2X17; - closest.y = v2Y17; - closest.z = v2Z17; - b13 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX12; - var pY12; - var pZ12; - pX12 = v1X17 + v12X17 * t12; - pY12 = v1Y17 + v12Y17 * t12; - pZ12 = v1Z17 + v12Z17 * t12; - closest.x = pX12; - closest.y = pY12; - closest.z = pZ12; - b13 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d8 < mind4) { - mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d8; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b14; - if(mind4 > 0) { - closest.x = minvX4; - closest.y = minvY4; - closest.z = minvZ4; - b14 = mini4; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX3 *= l4; - nY3 *= l4; - nZ3 *= l4; - var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; - minvX4 = nX3 * l23; - minvY4 = nY3 * l23; - minvZ4 = nZ3 * l23; - closest.x = minvX4; - closest.y = minvY4; - closest.z = minvZ4; - b14 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d9 < mind1) { - mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d9; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 3 | (b & 4) << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } } - if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { - var v1X18; - var v1Y18; - var v1Z18; - var v2X18; - var v2Y18; - var v2Z18; - var v3X5; - var v3Y5; - var v3Z5; - var v12X18; - var v12Y18; - var v12Z18; - var v23X5; - var v23Y5; - var v23Z5; - var v31X4; - var v31Y4; - var v31Z4; - v1X18 = vec21.x; - v1Y18 = vec21.y; - v1Z18 = vec21.z; - v2X18 = vec31.x; - v2Y18 = vec31.y; - v2Z18 = vec31.z; - v3X5 = vec4.x; - v3Y5 = vec4.y; - v3Z5 = vec4.z; - v12X18 = v2X18 - v1X18; - v12Y18 = v2Y18 - v1Y18; - v12Z18 = v2Z18 - v1Z18; - v23X5 = v3X5 - v2X18; - v23Y5 = v3Y5 - v2Y18; - v23Z5 = v3Z5 - v2Z18; - v31X4 = v1X18 - v3X5; - v31Y4 = v1Y18 - v3Y5; - v31Z4 = v1Z18 - v3Z5; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n12X4; - var n12Y4; - var n12Z4; - var n23X4; - var n23Y4; - var n23Z4; - var n31X4; - var n31Y4; - var n31Z4; - n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; - n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; - n12Z4 = v12X18 * nY4 - v12Y18 * nX4; - n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; - n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; - n23Z4 = v23X5 * nY4 - v23Y5 * nX4; - n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; - n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; - n31Z4 = v31X4 * nY4 - v31Y4 * nX4; - var mind5 = -1; - var minvX5; - var minvY5; - var minvZ5; - var mini5 = 0; - minvX5 = 0; - minvY5 = 0; - minvZ5 = 0; - if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { - var v1X19; - var v1Y19; - var v1Z19; - var v2X19; - var v2Y19; - var v2Z19; - v1X19 = vec21.x; - v1Y19 = vec21.y; - v1Z19 = vec21.z; - v2X19 = vec31.x; - v2Y19 = vec31.y; - v2Z19 = vec31.z; - var v12X19; - var v12Y19; - var v12Z19; - v12X19 = v2X19 - v1X19; - v12Y19 = v2Y19 - v1Y19; - v12Z19 = v2Z19 - v1Z19; - var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); - var b15; - if(t13 < 0) { - closest.x = v1X19; - closest.y = v1Y19; - closest.z = v1Z19; - b15 = 1; - } else if(t13 > 1) { - closest.x = v2X19; - closest.y = v2Y19; - closest.z = v2Z19; - b15 = 2; + if((v2X2 * n243X + v2Y2 * n243Y + v2Z2 * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX13; - var pY13; - var pZ13; - pX13 = v1X19 + v12X19 * t13; - pY13 = v1Y19 + v12Y19 * t13; - pZ13 = v1Z19 + v12Z19 * t13; - closest.x = pX13; - closest.y = pY13; - closest.z = pZ13; - b15 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini5 = b15; - mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { - var v1X20; - var v1Y20; - var v1Z20; - var v2X20; - var v2Y20; - var v2Z20; - v1X20 = vec31.x; - v1Y20 = vec31.y; - v1Z20 = vec31.z; - v2X20 = vec4.x; - v2Y20 = vec4.y; - v2Z20 = vec4.z; - var v12X20; - var v12Y20; - var v12Z20; - v12X20 = v2X20 - v1X20; - v12Y20 = v2Y20 - v1Y20; - v12Z20 = v2Z20 - v1Z20; - var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); - var b16; - if(t14 < 0) { - closest.x = v1X20; - closest.y = v1Y20; - closest.z = v1Z20; - b16 = 1; - } else if(t14 > 1) { - closest.x = v2X20; - closest.y = v2Y20; - closest.z = v2Z20; - b16 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX14; - var pY14; - var pZ14; - pX14 = v1X20 + v12X20 * t14; - pY14 = v1Y20 + v12Y20 * t14; - pZ14 = v1Z20 + v12Z20 * t14; - closest.x = pX14; - closest.y = pY14; - closest.z = pZ14; - b16 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d10 < mind5) { - mini5 = b16 << 1; - mind5 = d10; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { - var v1X21; - var v1Y21; - var v1Z21; - var v2X21; - var v2Y21; - var v2Z21; - v1X21 = vec21.x; - v1Y21 = vec21.y; - v1Z21 = vec21.z; - v2X21 = vec4.x; - v2Y21 = vec4.y; - v2Z21 = vec4.z; - var v12X21; - var v12Y21; - var v12Z21; - v12X21 = v2X21 - v1X21; - v12Y21 = v2Y21 - v1Y21; - v12Z21 = v2Z21 - v1Z21; - var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); - var b17; - if(t15 < 0) { - closest.x = v1X21; - closest.y = v1Y21; - closest.z = v1Z21; - b17 = 1; - } else if(t15 > 1) { - closest.x = v2X21; - closest.y = v2Y21; - closest.z = v2Z21; - b17 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX15; - var pY15; - var pZ15; - pX15 = v1X21 + v12X21 * t15; - pY15 = v1Y21 + v12Y21 * t15; - pZ15 = v1Z21 + v12Z21 * t15; - closest.x = pX15; - closest.y = pY15; - closest.z = pZ15; - b17 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d11 < mind5) { - mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d11; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b18; - if(mind5 > 0) { - closest.x = minvX5; - closest.y = minvY5; - closest.z = minvZ5; - b18 = mini5; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX4 *= l5; - nY4 *= l5; - nZ4 *= l5; - var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; - minvX5 = nX4 * l24; - minvY5 = nY4 * l24; - minvZ5 = nZ4 * l24; - closest.x = minvX5; - closest.y = minvY5; - closest.z = minvZ5; - b18 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d12 < mind1) { - mini1 = b18 << 1; - mind1 = d12; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; @@ -9679,10 +9735,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX1; closest.y = minvY1; closest.z = minvZ1; - v2 = mini1; + v = mini1; } else { closest.zero(); - v2 = 15; + v = 15; } break; } @@ -9703,7 +9759,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { break; } if(this.simplexSize == 4) { - var epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); + let epaState = this.computeDepth(c1,c2,tf1,tf2,s,w1,w2); if(epaState != 0) { this.distance = 0; return epaState; @@ -9714,7 +9770,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.distance = 0; return 1; } - this.shrinkSimplex(v2); + this.shrinkSimplex(v); dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; @@ -9723,20 +9779,20 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { dir.z = -dir.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this1 = this.s[this.simplexSize]; - var v6 = this.w1[this.simplexSize]; - _this1.x = v6.x; - _this1.y = v6.y; - _this1.z = v6.z; - var v7 = this.w2[this.simplexSize]; - _this1.x -= v7.x; - _this1.y -= v7.y; - _this1.z -= v7.z; + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var _this2 = s[this.simplexSize]; - if(_this2.x * dir.x + _this2.y * dir.y + _this2.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { + let _this1 = s[this.simplexSize]; + if(_this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { this.interpolateClosestPoints(); this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); if(cache != null && cache._gjkCache != null) { @@ -9749,17 +9805,17 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } return 2; } - ,convexCastImpl: function(c1,c2,tf1,tf2,tl1,tl2,hit) { + convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit) { this.c1 = c1; this.c2 = c2; this.tf1 = tf1; this.tf2 = tf2; - var s = this.s; - var closest = this.closest; - var dir = this.dir; - var firstDirX; - var firstDirY; - var firstDirZ; + let s = this.s; + let closest = this.closest; + let dir = this.dir; + let firstDirX; + let firstDirY; + let firstDirZ; firstDirX = tf2._positionX - tf1._positionX; firstDirY = tf2._positionY - tf1._positionY; firstDirZ = tf2._positionZ - tf1._positionZ; @@ -9773,26 +9829,26 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v = this.w1[this.simplexSize]; + let v = this.w1[this.simplexSize]; v.x = this.tf1._positionX; v.y = this.tf1._positionY; v.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; - _this.x = v1.x; - _this.y = v1.y; - _this.z = v1.z; - var v2 = this.w2[this.simplexSize]; - _this.x -= v2.x; - _this.y -= v2.y; - _this.z -= v2.z; + let _this = this.s[this.simplexSize]; + let v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let v1 = this.w2[this.simplexSize]; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; this.simplexSize = 1; - var count = 0; - var lambda = 0.0; - var rayX = this.rayX; - var rayR = this.rayR; + let count = 0; + let lambda = 0.0; + let rayX = this.rayX; + let rayR = this.rayR; rayX.zero(); rayR.x = tl2.x; rayR.y = tl2.y; @@ -9801,83 +9857,83 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { rayR.y -= tl1.y; rayR.z -= tl1.z; while(count < 40) { - var v3 = 0; + let v = 0; switch(this.simplexSize) { case 1: - var v4 = s[0]; - closest.x = v4.x; - closest.y = v4.y; - closest.z = v4.z; - v3 = 1; + let v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - var v5 = s[0]; - v1X = v5.x; - v1Y = v5.y; - v1Z = v5.z; - var v6 = s[1]; - v2X = v6.x; - v2Y = v6.y; - v2Z = v6.z; - var v12X; - var v12Y; - var v12Z; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + let v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; + let v12X; + let v12Y; + let v12Z; v12X = v2X - v1X; v12Y = v2Y - v1Y; v12Z = v2Z - v1Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { closest.x = v1X; closest.y = v1Y; closest.z = v1Z; - v3 = 1; + v = 1; } else if(t > 1) { closest.x = v2X; closest.y = v2Y; closest.z = v2Z; - v3 = 2; + v = 2; } else { - var pX; - var pY; - var pZ; + let pX; + let pY; + let pZ; pX = v1X + v12X * t; pY = v1Y + v12Y * t; pZ = v1Z + v12Z * t; closest.x = pX; closest.y = pY; closest.z = pZ; - v3 = 3; + v = 3; } break; case 3: - var vec1 = s[0]; - var vec2 = s[1]; - var vec3 = s[2]; - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - var v3X; - var v3Y; - var v3Z; - var v12X1; - var v12Y1; - var v12Z1; - var v23X; - var v23Y; - var v23Z; - var v31X; - var v31Y; - var v31Z; + let vec1 = s[0]; + let vec2 = s[1]; + let vec3 = s[2]; + let v1X1; + let v1Y1; + let v1Z1; + let v2X1; + let v2Y1; + let v2Z1; + let v3X; + let v3Y; + let v3Z; + let v12X1; + let v12Y1; + let v12Z1; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; v1X1 = vec1.x; v1Y1 = vec1.y; v1Z1 = vec1.z; @@ -9896,21 +9952,21 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { v31X = v1X1 - v3X; v31Y = v1Y1 - v3Y; v31Z = v1Z1 - v3Z; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = v12Y1 * v23Z - v12Z1 * v23Y; nY = v12Z1 * v23X - v12X1 * v23Z; nZ = v12X1 * v23Y - v12Y1 * v23X; - var n12X; - var n12Y; - var n12Z; - var n23X; - var n23Y; - var n23Z; - var n31X; - var n31Y; - var n31Z; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; n12X = v12Y1 * nZ - v12Z1 * nY; n12Y = v12Z1 * nX - v12X1 * nZ; n12Z = v12X1 * nY - v12Y1 * nX; @@ -9920,56 +9976,56 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; - var mind = -1; - var minvX; - var minvY; - var minvZ; - var mini = 0; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; minvX = 0; minvY = 0; minvZ = 0; if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec1.x; - v1Y2 = vec1.y; - v1Z2 = vec1.z; - v2X2 = vec2.x; - v2Y2 = vec2.y; - v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); - var b; - if(t1 < 0) { - closest.x = v1X2; - closest.y = v1Y2; - closest.z = v1Z2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; b = 1; - } else if(t1 > 1) { - closest.x = v2X2; - closest.y = v2Y2; - closest.z = v2Z2; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; b = 2; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - closest.x = pX1; - closest.y = pY1; - closest.z = pZ1; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; b = 3; } mini = b; @@ -9979,52 +10035,52 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { minvZ = closest.z; } if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b1; - if(t2 < 0) { - closest.x = v1X3; - closest.y = v1Y3; - closest.z = v1Z3; - b1 = 1; - } else if(t2 > 1) { - closest.x = v2X3; - closest.y = v2Y3; - closest.z = v2Z3; - b1 = 2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - closest.x = pX2; - closest.y = pY2; - closest.z = pZ2; - b1 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; if(mind < 0 || d < mind) { - mini = b1 << 1; + mini = b << 1; mind = d; minvX = closest.x; minvY = closest.y; @@ -10032,53 +10088,53 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } } if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t3 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t3 = -t3 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - var b2; - if(t3 < 0) { - closest.x = v1X4; - closest.y = v1Y4; - closest.z = v1Z4; - b2 = 1; - } else if(t3 > 1) { - closest.x = v2X4; - closest.y = v2Y4; - closest.z = v2Z4; - b2 = 2; + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX3; - var pY3; - var pZ3; - pX3 = v1X4 + v12X4 * t3; - pY3 = v1Y4 + v12Y4 * t3; - pZ3 = v1Z4 + v12Z4 * t3; - closest.x = pX3; - closest.y = pY3; - closest.z = pZ3; - b2 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind < 0 || d1 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d1; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; minvX = closest.x; minvY = closest.y; minvZ = closest.z; @@ -10088,16 +10144,16 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v3 = mini; + v = mini; } else { - var l = nX * nX + nY * nY + nZ * nZ; + let l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { l = 1 / Math.sqrt(l); } nX *= l; nY *= l; nZ *= l; - var l2 = nX * nX + nY * nY + nZ * nZ; + let l2 = nX * nX + nY * nY + nZ * nZ; l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; minvX = nX * l2; minvY = nY * l2; @@ -10105,1125 +10161,1125 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v3 = 7; + v = 7; } break; case 4: - var vec11 = s[0]; - var vec21 = s[1]; - var vec31 = s[2]; - var vec4 = s[3]; - var v1X5; - var v1Y5; - var v1Z5; - var v2X5; - var v2Y5; - var v2Z5; - var v3X1; - var v3Y1; - var v3Z1; - var v4X; - var v4Y; - var v4Z; - var v12X5; - var v12Y5; - var v12Z5; - var v13X; - var v13Y; - var v13Z; - var v14X; - var v14Y; - var v14Z; - var v23X1; - var v23Y1; - var v23Z1; - var v24X; - var v24Y; - var v24Z; - v1X5 = vec11.x; - v1Y5 = vec11.y; - v1Z5 = vec11.z; - v2X5 = vec21.x; - v2Y5 = vec21.y; - v2Z5 = vec21.z; + let vec11 = s[0]; + let vec21 = s[1]; + let vec31 = s[2]; + let vec4 = s[3]; + let v1X2; + let v1Y2; + let v1Z2; + let v2X2; + let v2Y2; + let v2Z2; + let v3X1; + let v3Y1; + let v3Z1; + let v4X; + let v4Y; + let v4Z; + let v12X2; + let v12Y2; + let v12Z2; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X1; + let v23Y1; + let v23Z1; + let v24X; + let v24Y; + let v24Z; + v1X2 = vec11.x; + v1Y2 = vec11.y; + v1Z2 = vec11.z; + v2X2 = vec21.x; + v2Y2 = vec21.y; + v2Z2 = vec21.z; v3X1 = vec31.x; v3Y1 = vec31.y; v3Z1 = vec31.z; v4X = vec4.x; v4Y = vec4.y; v4Z = vec4.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v13X = v3X1 - v1X5; - v13Y = v3Y1 - v1Y5; - v13Z = v3Z1 - v1Z5; - v14X = v4X - v1X5; - v14Y = v4Y - v1Y5; - v14Z = v4Z - v1Z5; - v23X1 = v3X1 - v2X5; - v23Y1 = v3Y1 - v2Y5; - v23Z1 = v3Z1 - v2Z5; - v24X = v4X - v2X5; - v24Y = v4Y - v2Y5; - v24Z = v4Z - v2Z5; - var n123X; - var n123Y; - var n123Z; - var n134X; - var n134Y; - var n134Z; - var n142X; - var n142Y; - var n142Z; - var n243X; - var n243Y; - var n243Z; - n123X = v12Y5 * v13Z - v12Z5 * v13Y; - n123Y = v12Z5 * v13X - v12X5 * v13Z; - n123Z = v12X5 * v13Y - v12Y5 * v13X; + v12X2 = v2X2 - v1X2; + v12Y2 = v2Y2 - v1Y2; + v12Z2 = v2Z2 - v1Z2; + v13X = v3X1 - v1X2; + v13Y = v3Y1 - v1Y2; + v13Z = v3Z1 - v1Z2; + v14X = v4X - v1X2; + v14Y = v4Y - v1Y2; + v14Z = v4Z - v1Z2; + v23X1 = v3X1 - v2X2; + v23Y1 = v3Y1 - v2Y2; + v23Z1 = v3Z1 - v2Z2; + v24X = v4X - v2X2; + v24Y = v4Y - v2Y2; + v24Z = v4Z - v2Z2; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; + n123X = v12Y2 * v13Z - v12Z2 * v13Y; + n123Y = v12Z2 * v13X - v12X2 * v13Z; + n123Z = v12X2 * v13Y - v12Y2 * v13X; n134X = v13Y * v14Z - v13Z * v14Y; n134Y = v13Z * v14X - v13X * v14Z; n134Z = v13X * v14Y - v13Y * v14X; - n142X = v14Y * v12Z5 - v14Z * v12Y5; - n142Y = v14Z * v12X5 - v14X * v12Z5; - n142Z = v14X * v12Y5 - v14Y * v12X5; + n142X = v14Y * v12Z2 - v14Z * v12Y2; + n142Y = v14Z * v12X2 - v14X * v12Z2; + n142Z = v14X * v12Y2 - v14Y * v12X2; n243X = v24Y * v23Z1 - v24Z * v23Y1; n243Y = v24Z * v23X1 - v24X * v23Z1; n243Z = v24X * v23Y1 - v24Y * v23X1; - var sign = v12X5 * n243X + v12Y5 * n243Y + v12Z5 * n243Z > 0 ? 1 : -1; - var mind1 = -1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; + let sign = v12X2 * n243X + v12Y2 * n243Y + v12Z2 * n243Z > 0 ? 1 : -1; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; minvX1 = 0; minvY1 = 0; minvZ1 = 0; - if((v1X5 * n123X + v1Y5 * n123Y + v1Z5 * n123Z) * sign < 0) { - var v1X6; - var v1Y6; - var v1Z6; - var v2X6; - var v2Y6; - var v2Z6; - var v3X2; - var v3Y2; - var v3Z2; - var v12X6; - var v12Y6; - var v12Z6; - var v23X2; - var v23Y2; - var v23Z2; - var v31X1; - var v31Y1; - var v31Z1; - v1X6 = vec11.x; - v1Y6 = vec11.y; - v1Z6 = vec11.z; - v2X6 = vec21.x; - v2Y6 = vec21.y; - v2Z6 = vec21.z; - v3X2 = vec31.x; - v3Y2 = vec31.y; - v3Z2 = vec31.z; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - v23X2 = v3X2 - v2X6; - v23Y2 = v3Y2 - v2Y6; - v23Z2 = v3Z2 - v2Z6; - v31X1 = v1X6 - v3X2; - v31Y1 = v1Y6 - v3Y2; - v31Z1 = v1Z6 - v3Z2; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y6 * v23Z2 - v12Z6 * v23Y2; - nY1 = v12Z6 * v23X2 - v12X6 * v23Z2; - nZ1 = v12X6 * v23Y2 - v12Y6 * v23X2; - var n12X1; - var n12Y1; - var n12Z1; - var n23X1; - var n23Y1; - var n23Z1; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y6 * nZ1 - v12Z6 * nY1; - n12Y1 = v12Z6 * nX1 - v12X6 * nZ1; - n12Z1 = v12X6 * nY1 - v12Y6 * nX1; - n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; - n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; - n23Z1 = v23X2 * nY1 - v23Y2 * nX1; - n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; - n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; - n31Z1 = v31X1 * nY1 - v31Y1 * nX1; - var mind2 = -1; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(v1X6 * n12X1 + v1Y6 * n12Y1 + v1Z6 * n12Z1 < 0) { - var v1X7; - var v1Y7; - var v1Z7; - var v2X7; - var v2Y7; - var v2Z7; - v1X7 = vec11.x; - v1Y7 = vec11.y; - v1Z7 = vec11.z; - v2X7 = vec21.x; - v2Y7 = vec21.y; - v2Z7 = vec21.z; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); - var b3; - if(t4 < 0) { - closest.x = v1X7; - closest.y = v1Y7; - closest.z = v1Z7; - b3 = 1; - } else if(t4 > 1) { - closest.x = v2X7; - closest.y = v2Y7; - closest.z = v2Z7; - b3 = 2; + if((v1X2 * n123X + v1Y2 * n123Y + v1Z2 * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec31.x; + v3Y = vec31.y; + v3Z = vec31.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - closest.x = pX4; - closest.y = pY4; - closest.z = pZ4; - b3 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini2 = b3; - mind2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X6 * n23X1 + v2Y6 * n23Y1 + v2Z6 * n23Z1 < 0) { - var v1X8; - var v1Y8; - var v1Z8; - var v2X8; - var v2Y8; - var v2Z8; - v1X8 = vec21.x; - v1Y8 = vec21.y; - v1Z8 = vec21.z; - v2X8 = vec31.x; - v2Y8 = vec31.y; - v2Z8 = vec31.z; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); - var b4; - if(t5 < 0) { - closest.x = v1X8; - closest.y = v1Y8; - closest.z = v1Z8; - b4 = 1; - } else if(t5 > 1) { - closest.x = v2X8; - closest.y = v2Y8; - closest.z = v2Z8; - b4 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - closest.x = pX5; - closest.y = pY5; - closest.z = pZ5; - b4 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d2 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d2 < mind2) { - mini2 = b4 << 1; - mind2 = d2; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { - var v1X9; - var v1Y9; - var v1Z9; - var v2X9; - var v2Y9; - var v2Z9; - v1X9 = vec11.x; - v1Y9 = vec11.y; - v1Z9 = vec11.z; - v2X9 = vec31.x; - v2Y9 = vec31.y; - v2Z9 = vec31.z; - var v12X9; - var v12Y9; - var v12Z9; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - var t6 = v12X9 * v1X9 + v12Y9 * v1Y9 + v12Z9 * v1Z9; - t6 = -t6 / (v12X9 * v12X9 + v12Y9 * v12Y9 + v12Z9 * v12Z9); - var b5; - if(t6 < 0) { - closest.x = v1X9; - closest.y = v1Y9; - closest.z = v1Z9; - b5 = 1; - } else if(t6 > 1) { - closest.x = v2X9; - closest.y = v2Y9; - closest.z = v2Z9; - b5 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX6; - var pY6; - var pZ6; - pX6 = v1X9 + v12X9 * t6; - pY6 = v1Y9 + v12Y9 * t6; - pZ6 = v1Z9 + v12Z9 * t6; - closest.x = pX6; - closest.y = pY6; - closest.z = pZ6; - b5 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind2 < 0 || d3 < mind2) { - mini2 = b5 & 1 | (b5 & 2) << 1; - mind2 = d3; - minvX2 = closest.x; - minvY2 = closest.y; - minvZ2 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b6; - if(mind2 > 0) { - closest.x = minvX2; - closest.y = minvY2; - closest.z = minvZ2; - b6 = mini2; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX1 *= l1; - nY1 *= l1; - nZ1 *= l1; - var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l21 = (v1X6 * nX1 + v1Y6 * nY1 + v1Z6 * nZ1) / l21; - minvX2 = nX1 * l21; - minvY2 = nY1 * l21; - minvZ2 = nZ1 * l21; - closest.x = minvX2; - closest.y = minvY2; - closest.z = minvZ2; - b6 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - mini1 = b6; + mini1 = b; mind1 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } - if((v1X5 * n134X + v1Y5 * n134Y + v1Z5 * n134Z) * sign < 0) { - var v1X10; - var v1Y10; - var v1Z10; - var v2X10; - var v2Y10; - var v2Z10; - var v3X3; - var v3Y3; - var v3Z3; - var v12X10; - var v12Y10; - var v12Z10; - var v23X3; - var v23Y3; - var v23Z3; - var v31X2; - var v31Y2; - var v31Z2; - v1X10 = vec11.x; - v1Y10 = vec11.y; - v1Z10 = vec11.z; - v2X10 = vec31.x; - v2Y10 = vec31.y; - v2Z10 = vec31.z; - v3X3 = vec4.x; - v3Y3 = vec4.y; - v3Z3 = vec4.z; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - v23X3 = v3X3 - v2X10; - v23Y3 = v3Y3 - v2Y10; - v23Z3 = v3Z3 - v2Z10; - v31X2 = v1X10 - v3X3; - v31Y2 = v1Y10 - v3Y3; - v31Z2 = v1Z10 - v3Z3; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y10 * v23Z3 - v12Z10 * v23Y3; - nY2 = v12Z10 * v23X3 - v12X10 * v23Z3; - nZ2 = v12X10 * v23Y3 - v12Y10 * v23X3; - var n12X2; - var n12Y2; - var n12Z2; - var n23X2; - var n23Y2; - var n23Z2; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y10 * nZ2 - v12Z10 * nY2; - n12Y2 = v12Z10 * nX2 - v12X10 * nZ2; - n12Z2 = v12X10 * nY2 - v12Y10 * nX2; - n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; - n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; - n23Z2 = v23X3 * nY2 - v23Y3 * nX2; - n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; - n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; - n31Z2 = v31X2 * nY2 - v31Y2 * nX2; - var mind3 = -1; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(v1X10 * n12X2 + v1Y10 * n12Y2 + v1Z10 * n12Z2 < 0) { - var v1X11; - var v1Y11; - var v1Z11; - var v2X11; - var v2Y11; - var v2Z11; - v1X11 = vec11.x; - v1Y11 = vec11.y; - v1Z11 = vec11.z; - v2X11 = vec31.x; - v2Y11 = vec31.y; - v2Z11 = vec31.z; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); - var b7; - if(t7 < 0) { - closest.x = v1X11; - closest.y = v1Y11; - closest.z = v1Z11; - b7 = 1; - } else if(t7 > 1) { - closest.x = v2X11; - closest.y = v2Y11; - closest.z = v2Z11; - b7 = 2; + if((v1X2 * n134X + v1Y2 * n134Y + v1Z2 * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - closest.x = pX7; - closest.y = pY7; - closest.z = pZ7; - b7 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini3 = b7; - mind3 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X10 * n23X2 + v2Y10 * n23Y2 + v2Z10 * n23Z2 < 0) { - var v1X12; - var v1Y12; - var v1Z12; - var v2X12; - var v2Y12; - var v2Z12; - v1X12 = vec31.x; - v1Y12 = vec31.y; - v1Z12 = vec31.z; - v2X12 = vec4.x; - v2Y12 = vec4.y; - v2Z12 = vec4.z; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); - var b8; - if(t8 < 0) { - closest.x = v1X12; - closest.y = v1Y12; - closest.z = v1Z12; - b8 = 1; - } else if(t8 > 1) { - closest.x = v2X12; - closest.y = v2Y12; - closest.z = v2Z12; - b8 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - closest.x = pX8; - closest.y = pY8; - closest.z = pZ8; - b8 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d4 < mind3) { - mini3 = b8 << 1; - mind3 = d4; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { - var v1X13; - var v1Y13; - var v1Z13; - var v2X13; - var v2Y13; - var v2Z13; - v1X13 = vec11.x; - v1Y13 = vec11.y; - v1Z13 = vec11.z; - v2X13 = vec4.x; - v2Y13 = vec4.y; - v2Z13 = vec4.z; - var v12X13; - var v12Y13; - var v12Z13; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - var t9 = v12X13 * v1X13 + v12Y13 * v1Y13 + v12Z13 * v1Z13; - t9 = -t9 / (v12X13 * v12X13 + v12Y13 * v12Y13 + v12Z13 * v12Z13); - var b9; - if(t9 < 0) { - closest.x = v1X13; - closest.y = v1Y13; - closest.z = v1Z13; - b9 = 1; - } else if(t9 > 1) { - closest.x = v2X13; - closest.y = v2Y13; - closest.z = v2Z13; - b9 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX9; - var pY9; - var pZ9; - pX9 = v1X13 + v12X13 * t9; - pY9 = v1Y13 + v12Y13 * t9; - pZ9 = v1Z13 + v12Z13 * t9; - closest.x = pX9; - closest.y = pY9; - closest.z = pZ9; - b9 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind3 < 0 || d5 < mind3) { - mini3 = b9 & 1 | (b9 & 2) << 1; - mind3 = d5; - minvX3 = closest.x; - minvY3 = closest.y; - minvZ3 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b10; - if(mind3 > 0) { - closest.x = minvX3; - closest.y = minvY3; - closest.z = minvZ3; - b10 = mini3; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX2 *= l3; - nY2 *= l3; - nZ2 *= l3; - var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l22 = (v1X10 * nX2 + v1Y10 * nY2 + v1Z10 * nZ2) / l22; - minvX3 = nX2 * l22; - minvY3 = nY2 * l22; - minvZ3 = nZ2 * l22; - closest.x = minvX3; - closest.y = minvY3; - closest.z = minvZ3; - b10 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d6 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d6 < mind1) { - mini1 = b10 & 1 | (b10 & 6) << 1; - mind1 = d6; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 6) << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } } - if((v1X5 * n142X + v1Y5 * n142Y + v1Z5 * n142Z) * sign < 0) { - var v1X14; - var v1Y14; - var v1Z14; - var v2X14; - var v2Y14; - var v2Z14; - var v3X4; - var v3Y4; - var v3Z4; - var v12X14; - var v12Y14; - var v12Z14; - var v23X4; - var v23Y4; - var v23Z4; - var v31X3; - var v31Y3; - var v31Z3; - v1X14 = vec11.x; - v1Y14 = vec11.y; - v1Z14 = vec11.z; - v2X14 = vec21.x; - v2Y14 = vec21.y; - v2Z14 = vec21.z; - v3X4 = vec4.x; - v3Y4 = vec4.y; - v3Z4 = vec4.z; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - v23X4 = v3X4 - v2X14; - v23Y4 = v3Y4 - v2Y14; - v23Z4 = v3Z4 - v2Z14; - v31X3 = v1X14 - v3X4; - v31Y3 = v1Y14 - v3Y4; - v31Z3 = v1Z14 - v3Z4; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y14 * v23Z4 - v12Z14 * v23Y4; - nY3 = v12Z14 * v23X4 - v12X14 * v23Z4; - nZ3 = v12X14 * v23Y4 - v12Y14 * v23X4; - var n12X3; - var n12Y3; - var n12Z3; - var n23X3; - var n23Y3; - var n23Z3; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y14 * nZ3 - v12Z14 * nY3; - n12Y3 = v12Z14 * nX3 - v12X14 * nZ3; - n12Z3 = v12X14 * nY3 - v12Y14 * nX3; - n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; - n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; - n23Z3 = v23X4 * nY3 - v23Y4 * nX3; - n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; - n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; - n31Z3 = v31X3 * nY3 - v31Y3 * nX3; - var mind4 = -1; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(v1X14 * n12X3 + v1Y14 * n12Y3 + v1Z14 * n12Z3 < 0) { - var v1X15; - var v1Y15; - var v1Z15; - var v2X15; - var v2Y15; - var v2Z15; - v1X15 = vec11.x; - v1Y15 = vec11.y; - v1Z15 = vec11.z; - v2X15 = vec21.x; - v2Y15 = vec21.y; - v2Z15 = vec21.z; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); - var b11; - if(t10 < 0) { - closest.x = v1X15; - closest.y = v1Y15; - closest.z = v1Z15; - b11 = 1; - } else if(t10 > 1) { - closest.x = v2X15; - closest.y = v2Y15; - closest.z = v2Z15; - b11 = 2; + if((v1X2 * n142X + v1Y2 * n142Y + v1Z2 * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec21.x; + v2Y = vec21.y; + v2Z = vec21.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - closest.x = pX10; - closest.y = pY10; - closest.z = pZ10; - b11 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini4 = b11; - mind4 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X14 * n23X3 + v2Y14 * n23Y3 + v2Z14 * n23Z3 < 0) { - var v1X16; - var v1Y16; - var v1Z16; - var v2X16; - var v2Y16; - var v2Z16; - v1X16 = vec21.x; - v1Y16 = vec21.y; - v1Z16 = vec21.z; - v2X16 = vec4.x; - v2Y16 = vec4.y; - v2Z16 = vec4.z; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); - var b12; - if(t11 < 0) { - closest.x = v1X16; - closest.y = v1Y16; - closest.z = v1Z16; - b12 = 1; - } else if(t11 > 1) { - closest.x = v2X16; - closest.y = v2Y16; - closest.z = v2Z16; - b12 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - closest.x = pX11; - closest.y = pY11; - closest.z = pZ11; - b12 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d7 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d7 < mind4) { - mini4 = b12 << 1; - mind4 = d7; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { - var v1X17; - var v1Y17; - var v1Z17; - var v2X17; - var v2Y17; - var v2Z17; - v1X17 = vec11.x; - v1Y17 = vec11.y; - v1Z17 = vec11.z; - v2X17 = vec4.x; - v2Y17 = vec4.y; - v2Z17 = vec4.z; - var v12X17; - var v12Y17; - var v12Z17; - v12X17 = v2X17 - v1X17; - v12Y17 = v2Y17 - v1Y17; - v12Z17 = v2Z17 - v1Z17; - var t12 = v12X17 * v1X17 + v12Y17 * v1Y17 + v12Z17 * v1Z17; - t12 = -t12 / (v12X17 * v12X17 + v12Y17 * v12Y17 + v12Z17 * v12Z17); - var b13; - if(t12 < 0) { - closest.x = v1X17; - closest.y = v1Y17; - closest.z = v1Z17; - b13 = 1; - } else if(t12 > 1) { - closest.x = v2X17; - closest.y = v2Y17; - closest.z = v2Z17; - b13 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec11.x; + v1Y = vec11.y; + v1Z = vec11.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX12; - var pY12; - var pZ12; - pX12 = v1X17 + v12X17 * t12; - pY12 = v1Y17 + v12Y17 * t12; - pZ12 = v1Z17 + v12Z17 * t12; - closest.x = pX12; - closest.y = pY12; - closest.z = pZ12; - b13 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d8 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind4 < 0 || d8 < mind4) { - mini4 = b13 & 1 | (b13 & 2) << 1; - mind4 = d8; - minvX4 = closest.x; - minvY4 = closest.y; - minvZ4 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b14; - if(mind4 > 0) { - closest.x = minvX4; - closest.y = minvY4; - closest.z = minvZ4; - b14 = mini4; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX3 *= l4; - nY3 *= l4; - nZ3 *= l4; - var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l23 = (v1X14 * nX3 + v1Y14 * nY3 + v1Z14 * nZ3) / l23; - minvX4 = nX3 * l23; - minvY4 = nY3 * l23; - minvZ4 = nZ3 * l23; - closest.x = minvX4; - closest.y = minvY4; - closest.z = minvZ4; - b14 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d9 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d9 < mind1) { - mini1 = b14 & 3 | (b14 & 4) << 1; - mind1 = d9; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 3 | (b & 4) << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; } } - if((v2X5 * n243X + v2Y5 * n243Y + v2Z5 * n243Z) * sign < 0) { - var v1X18; - var v1Y18; - var v1Z18; - var v2X18; - var v2Y18; - var v2Z18; - var v3X5; - var v3Y5; - var v3Z5; - var v12X18; - var v12Y18; - var v12Z18; - var v23X5; - var v23Y5; - var v23Z5; - var v31X4; - var v31Y4; - var v31Z4; - v1X18 = vec21.x; - v1Y18 = vec21.y; - v1Z18 = vec21.z; - v2X18 = vec31.x; - v2Y18 = vec31.y; - v2Z18 = vec31.z; - v3X5 = vec4.x; - v3Y5 = vec4.y; - v3Z5 = vec4.z; - v12X18 = v2X18 - v1X18; - v12Y18 = v2Y18 - v1Y18; - v12Z18 = v2Z18 - v1Z18; - v23X5 = v3X5 - v2X18; - v23Y5 = v3Y5 - v2Y18; - v23Z5 = v3Z5 - v2Z18; - v31X4 = v1X18 - v3X5; - v31Y4 = v1Y18 - v3Y5; - v31Z4 = v1Z18 - v3Z5; - var nX4; - var nY4; - var nZ4; - nX4 = v12Y18 * v23Z5 - v12Z18 * v23Y5; - nY4 = v12Z18 * v23X5 - v12X18 * v23Z5; - nZ4 = v12X18 * v23Y5 - v12Y18 * v23X5; - var n12X4; - var n12Y4; - var n12Z4; - var n23X4; - var n23Y4; - var n23Z4; - var n31X4; - var n31Y4; - var n31Z4; - n12X4 = v12Y18 * nZ4 - v12Z18 * nY4; - n12Y4 = v12Z18 * nX4 - v12X18 * nZ4; - n12Z4 = v12X18 * nY4 - v12Y18 * nX4; - n23X4 = v23Y5 * nZ4 - v23Z5 * nY4; - n23Y4 = v23Z5 * nX4 - v23X5 * nZ4; - n23Z4 = v23X5 * nY4 - v23Y5 * nX4; - n31X4 = v31Y4 * nZ4 - v31Z4 * nY4; - n31Y4 = v31Z4 * nX4 - v31X4 * nZ4; - n31Z4 = v31X4 * nY4 - v31Y4 * nX4; - var mind5 = -1; - var minvX5; - var minvY5; - var minvZ5; - var mini5 = 0; - minvX5 = 0; - minvY5 = 0; - minvZ5 = 0; - if(v1X18 * n12X4 + v1Y18 * n12Y4 + v1Z18 * n12Z4 < 0) { - var v1X19; - var v1Y19; - var v1Z19; - var v2X19; - var v2Y19; - var v2Z19; - v1X19 = vec21.x; - v1Y19 = vec21.y; - v1Z19 = vec21.z; - v2X19 = vec31.x; - v2Y19 = vec31.y; - v2Z19 = vec31.z; - var v12X19; - var v12Y19; - var v12Z19; - v12X19 = v2X19 - v1X19; - v12Y19 = v2Y19 - v1Y19; - v12Z19 = v2Z19 - v1Z19; - var t13 = v12X19 * v1X19 + v12Y19 * v1Y19 + v12Z19 * v1Z19; - t13 = -t13 / (v12X19 * v12X19 + v12Y19 * v12Y19 + v12Z19 * v12Z19); - var b15; - if(t13 < 0) { - closest.x = v1X19; - closest.y = v1Y19; - closest.z = v1Z19; - b15 = 1; - } else if(t13 > 1) { - closest.x = v2X19; - closest.y = v2Y19; - closest.z = v2Z19; - b15 = 2; + if((v2X2 * n243X + v2Y2 * n243Y + v2Z2 * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec31.x; + v2Y = vec31.y; + v2Z = vec31.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX13; - var pY13; - var pZ13; - pX13 = v1X19 + v12X19 * t13; - pY13 = v1Y19 + v12Y19 * t13; - pZ13 = v1Z19 + v12Z19 * t13; - closest.x = pX13; - closest.y = pY13; - closest.z = pZ13; - b15 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - mini5 = b15; - mind5 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + mini = b; + mind = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } - if(v2X18 * n23X4 + v2Y18 * n23Y4 + v2Z18 * n23Z4 < 0) { - var v1X20; - var v1Y20; - var v1Z20; - var v2X20; - var v2Y20; - var v2Z20; - v1X20 = vec31.x; - v1Y20 = vec31.y; - v1Z20 = vec31.z; - v2X20 = vec4.x; - v2Y20 = vec4.y; - v2Z20 = vec4.z; - var v12X20; - var v12Y20; - var v12Z20; - v12X20 = v2X20 - v1X20; - v12Y20 = v2Y20 - v1Y20; - v12Z20 = v2Z20 - v1Z20; - var t14 = v12X20 * v1X20 + v12Y20 * v1Y20 + v12Z20 * v1Z20; - t14 = -t14 / (v12X20 * v12X20 + v12Y20 * v12Y20 + v12Z20 * v12Z20); - var b16; - if(t14 < 0) { - closest.x = v1X20; - closest.y = v1Y20; - closest.z = v1Z20; - b16 = 1; - } else if(t14 > 1) { - closest.x = v2X20; - closest.y = v2Y20; - closest.z = v2Z20; - b16 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec31.x; + v1Y = vec31.y; + v1Z = vec31.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX14; - var pY14; - var pZ14; - pX14 = v1X20 + v12X20 * t14; - pY14 = v1Y20 + v12Y20 * t14; - pZ14 = v1Z20 + v12Z20 * t14; - closest.x = pX14; - closest.y = pY14; - closest.z = pZ14; - b16 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d10 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d10 < mind5) { - mini5 = b16 << 1; - mind5 = d10; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - if(v3X5 * n31X4 + v3Y5 * n31Y4 + v3Z5 * n31Z4 < 0) { - var v1X21; - var v1Y21; - var v1Z21; - var v2X21; - var v2Y21; - var v2Z21; - v1X21 = vec21.x; - v1Y21 = vec21.y; - v1Z21 = vec21.z; - v2X21 = vec4.x; - v2Y21 = vec4.y; - v2Z21 = vec4.z; - var v12X21; - var v12Y21; - var v12Z21; - v12X21 = v2X21 - v1X21; - v12Y21 = v2Y21 - v1Y21; - v12Z21 = v2Z21 - v1Z21; - var t15 = v12X21 * v1X21 + v12Y21 * v1Y21 + v12Z21 * v1Z21; - t15 = -t15 / (v12X21 * v12X21 + v12Y21 * v12Y21 + v12Z21 * v12Z21); - var b17; - if(t15 < 0) { - closest.x = v1X21; - closest.y = v1Y21; - closest.z = v1Z21; - b17 = 1; - } else if(t15 > 1) { - closest.x = v2X21; - closest.y = v2Y21; - closest.z = v2Z21; - b17 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec21.x; + v1Y = vec21.y; + v1Z = vec21.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + closest.x = v1X; + closest.y = v1Y; + closest.z = v1Z; + b = 1; + } else if(t > 1) { + closest.x = v2X; + closest.y = v2Y; + closest.z = v2Z; + b = 2; } else { - var pX15; - var pY15; - var pZ15; - pX15 = v1X21 + v12X21 * t15; - pY15 = v1Y21 + v12Y21 * t15; - pZ15 = v1Z21 + v12Z21 * t15; - closest.x = pX15; - closest.y = pY15; - closest.z = pZ15; - b17 = 3; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + closest.x = pX; + closest.y = pY; + closest.z = pZ; + b = 3; } - var d11 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind5 < 0 || d11 < mind5) { - mini5 = b17 & 1 | (b17 & 2) << 1; - mind5 = d11; - minvX5 = closest.x; - minvY5 = closest.y; - minvZ5 = closest.z; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = closest.x; + minvY = closest.y; + minvZ = closest.z; } } - var b18; - if(mind5 > 0) { - closest.x = minvX5; - closest.y = minvY5; - closest.z = minvZ5; - b18 = mini5; + let b; + if(mind > 0) { + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = mini; } else { - var l5 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - nX4 *= l5; - nY4 *= l5; - nZ4 *= l5; - var l24 = nX4 * nX4 + nY4 * nY4 + nZ4 * nZ4; - l24 = (v1X18 * nX4 + v1Y18 * nY4 + v1Z18 * nZ4) / l24; - minvX5 = nX4 * l24; - minvY5 = nY4 * l24; - minvZ5 = nZ4 * l24; - closest.x = minvX5; - closest.y = minvY5; - closest.z = minvZ5; - b18 = 7; + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + closest.x = minvX; + closest.y = minvY; + closest.z = minvZ; + b = 7; } - var d12 = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; - if(mind1 < 0 || d12 < mind1) { - mini1 = b18 << 1; - mind1 = d12; + let d = closest.x * closest.x + closest.y * closest.y + closest.z * closest.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; minvX1 = closest.x; minvY1 = closest.y; minvZ1 = closest.z; @@ -11233,14 +11289,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX1; closest.y = minvY1; closest.z = minvZ1; - v3 = mini1; + v = mini1; } else { closest.zero(); - v3 = 15; + v = 15; } break; } - this.shrinkSimplex(v3); + this.shrinkSimplex(v); if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(lambda == 0 || this.simplexSize == 4) { hit.fraction = lambda; @@ -11248,25 +11304,25 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } this.interpolateClosestPoints(); hit.fraction = lambda; - var _this1 = hit.normal; - _this1.x = dir.x; - _this1.y = dir.y; - _this1.z = dir.z; - var invLen = Math.sqrt(_this1.x * _this1.x + _this1.y * _this1.y + _this1.z * _this1.z); + let _this = hit.normal; + _this.x = dir.x; + _this.y = dir.y; + _this.z = dir.z; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - _this1.x *= invLen; - _this1.y *= invLen; - _this1.z *= invLen; - var _this2 = hit.position; - var v7 = this.closestPoint1; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - _this2.x += tl1.x * lambda; - _this2.y += tl1.y * lambda; - _this2.z += tl1.z * lambda; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + let _this1 = hit.position; + let v = this.closestPoint1; + _this1.x = v.x; + _this1.y = v.y; + _this1.z = v.z; + _this1.x += tl1.x * lambda; + _this1.y += tl1.y * lambda; + _this1.z += tl1.z * lambda; return true; } dir.x = closest.x; @@ -11278,35 +11334,35 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v8 = this.w1[this.simplexSize]; - v8.x = this.tf1._positionX; - v8.y = this.tf1._positionY; - v8.z = this.tf1._positionZ; + let v = this.w1[this.simplexSize]; + v.x = this.tf1._positionX; + v.y = this.tf1._positionY; + v.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this3 = this.s[this.simplexSize]; - var v9 = this.w1[this.simplexSize]; - _this3.x = v9.x; - _this3.y = v9.y; - _this3.z = v9.z; - var v10 = this.w2[this.simplexSize]; - _this3.x -= v10.x; - _this3.y -= v10.y; - _this3.z -= v10.z; - var _this4 = s[this.simplexSize]; - _this4.x -= rayX.x; - _this4.y -= rayX.y; - _this4.z -= rayX.z; + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; + let _this1 = s[this.simplexSize]; + _this1.x -= rayX.x; + _this1.y -= rayX.y; + _this1.z -= rayX.z; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var p = s[this.simplexSize]; - var pn = p.x * dir.x + p.y * dir.y + p.z * dir.z; + let p = s[this.simplexSize]; + let pn = p.x * dir.x + p.y * dir.y + p.z * dir.z; if(pn < 0) { if(rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z >= 0) { return false; } - var dLambda = pn / (rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z); + let dLambda = pn / (rayR.x * dir.x + rayR.y * dir.y + rayR.z * dir.z); lambda += dLambda; if(lambda >= 1) { return false; @@ -11314,24 +11370,24 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { rayX.x += rayR.x * dLambda; rayX.y += rayR.y * dLambda; rayX.z += rayR.z * dLambda; - var _g1 = 0; - var _g2 = this.simplexSize + 1; - while(_g1 < _g2) { - var _this5 = s[_g1++]; - var s1 = -dLambda; - _this5.x += rayR.x * s1; - _this5.y += rayR.y * s1; - _this5.z += rayR.z * s1; - } - } - var duplicate = false; - var _g11 = 0; - var _g21 = this.simplexSize; - while(_g11 < _g21) { - var i = _g11++; - var dx = s[i].x - s[this.simplexSize].x; - var dy = s[i].y - s[this.simplexSize].y; - var dz = s[i].z - s[this.simplexSize].z; + let _g = 0; + let _g1 = this.simplexSize + 1; + while(_g < _g1) { + let _this = s[_g++]; + let s1 = -dLambda; + _this.x += rayR.x * s1; + _this.y += rayR.y * s1; + _this.z += rayR.z * s1; + } + } + let duplicate = false; + let _g = 0; + let _g1 = this.simplexSize; + while(_g < _g1) { + let i = _g++; + let dx = s[i].x - s[this.simplexSize].x; + let dy = s[i].y - s[this.simplexSize].y; + let dz = s[i].z - s[this.simplexSize].z; if(dx * dx + dy * dy + dz * dz < 1e-008) { duplicate = true; break; @@ -11344,96 +11400,96 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } return false; } - ,interpolateClosestPoints: function() { + interpolateClosestPoints() { switch(this.simplexSize) { case 1: - var _this = this.closestPoint1; - var v = this.w1[0]; + let _this = this.closestPoint1; + let v = this.w1[0]; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.closestPoint2; - var v1 = this.w2[0]; + let _this1 = this.closestPoint2; + let v1 = this.w2[0]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; break; case 2: - var cX; - var cY; - var cZ; - var v2 = this.closest; + let cX; + let cY; + let cZ; + let v2 = this.closest; cX = v2.x; cY = v2.y; cZ = v2.z; - var s0X; - var s0Y; - var s0Z; - var w10X; - var w10Y; - var w10Z; - var w20X; - var w20Y; - var w20Z; - var s1X; - var s1Y; - var s1Z; - var w11X; - var w11Y; - var w11Z; - var w21X; - var w21Y; - var w21Z; - var v3 = this.s[0]; + let s0X; + let s0Y; + let s0Z; + let w10X; + let w10Y; + let w10Z; + let w20X; + let w20Y; + let w20Z; + let s1X; + let s1Y; + let s1Z; + let w11X; + let w11Y; + let w11Z; + let w21X; + let w21Y; + let w21Z; + let v3 = this.s[0]; s0X = v3.x; s0Y = v3.y; s0Z = v3.z; - var v4 = this.w1[0]; + let v4 = this.w1[0]; w10X = v4.x; w10Y = v4.y; w10Z = v4.z; - var v5 = this.w2[0]; + let v5 = this.w2[0]; w20X = v5.x; w20Y = v5.y; w20Z = v5.z; - var v6 = this.s[1]; + let v6 = this.s[1]; s1X = v6.x; s1Y = v6.y; s1Z = v6.z; - var v7 = this.w1[1]; + let v7 = this.w1[1]; w11X = v7.x; w11Y = v7.y; w11Z = v7.z; - var v8 = this.w2[1]; + let v8 = this.w2[1]; w21X = v8.x; w21Y = v8.y; w21Z = v8.z; - var s01X; - var s01Y; - var s01Z; + let s01X; + let s01Y; + let s01Z; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; - var invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + let invDet = s01X * s01X + s01Y * s01Y + s01Z * s01Z; if(invDet != 0) { invDet = 1 / invDet; } - var s0cX; - var s0cY; - var s0cZ; + let s0cX; + let s0cY; + let s0cZ; s0cX = cX - s0X; s0cY = cY - s0Y; s0cZ = cZ - s0Z; - var t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; - var diffX; - var diffY; - var diffZ; - var cp1X; - var cp1Y; - var cp1Z; - var cp2X; - var cp2Y; - var cp2Z; + let t = (s0cX * s01X + s0cY * s01Y + s0cZ * s01Z) * invDet; + let diffX; + let diffY; + let diffZ; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; diffX = w11X - w10X; diffY = w11Y - w10Y; diffZ = w11Z - w10Z; @@ -11446,95 +11502,95 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp2X = w20X + diffX * t; cp2Y = w20Y + diffY * t; cp2Z = w20Z + diffZ * t; - var v9 = this.closestPoint1; + let v9 = this.closestPoint1; v9.x = cp1X; v9.y = cp1Y; v9.z = cp1Z; - var v10 = this.closestPoint2; + let v10 = this.closestPoint2; v10.x = cp2X; v10.y = cp2Y; v10.z = cp2Z; break; case 3: - var cX1; - var cY1; - var cZ1; - var v11 = this.closest; + let cX1; + let cY1; + let cZ1; + let v11 = this.closest; cX1 = v11.x; cY1 = v11.y; cZ1 = v11.z; - var s0X1; - var s0Y1; - var s0Z1; - var w10X1; - var w10Y1; - var w10Z1; - var w20X1; - var w20Y1; - var w20Z1; - var s1X1; - var s1Y1; - var s1Z1; - var w11X1; - var w11Y1; - var w11Z1; - var w21X1; - var w21Y1; - var w21Z1; - var s2X; - var s2Y; - var s2Z; - var w12X; - var w12Y; - var w12Z; - var w22X; - var w22Y; - var w22Z; - var v12 = this.s[0]; + let s0X1; + let s0Y1; + let s0Z1; + let w10X1; + let w10Y1; + let w10Z1; + let w20X1; + let w20Y1; + let w20Z1; + let s1X1; + let s1Y1; + let s1Z1; + let w11X1; + let w11Y1; + let w11Z1; + let w21X1; + let w21Y1; + let w21Z1; + let s2X; + let s2Y; + let s2Z; + let w12X; + let w12Y; + let w12Z; + let w22X; + let w22Y; + let w22Z; + let v12 = this.s[0]; s0X1 = v12.x; s0Y1 = v12.y; s0Z1 = v12.z; - var v13 = this.w1[0]; + let v13 = this.w1[0]; w10X1 = v13.x; w10Y1 = v13.y; w10Z1 = v13.z; - var v14 = this.w2[0]; + let v14 = this.w2[0]; w20X1 = v14.x; w20Y1 = v14.y; w20Z1 = v14.z; - var v15 = this.s[1]; + let v15 = this.s[1]; s1X1 = v15.x; s1Y1 = v15.y; s1Z1 = v15.z; - var v16 = this.w1[1]; + let v16 = this.w1[1]; w11X1 = v16.x; w11Y1 = v16.y; w11Z1 = v16.z; - var v17 = this.w2[1]; + let v17 = this.w2[1]; w21X1 = v17.x; w21Y1 = v17.y; w21Z1 = v17.z; - var v18 = this.s[2]; + let v18 = this.s[2]; s2X = v18.x; s2Y = v18.y; s2Z = v18.z; - var v19 = this.w1[2]; + let v19 = this.w1[2]; w12X = v19.x; w12Y = v19.y; w12Z = v19.z; - var v20 = this.w2[2]; + let v20 = this.w2[2]; w22X = v20.x; w22Y = v20.y; w22Z = v20.z; - var s01X1; - var s01Y1; - var s01Z1; - var s02X; - var s02Y; - var s02Z; - var s0cX1; - var s0cY1; - var s0cZ1; + let s01X1; + let s01Y1; + let s01Z1; + let s02X; + let s02Y; + let s02Z; + let s0cX1; + let s0cY1; + let s0cZ1; s01X1 = s1X1 - s0X1; s01Y1 = s1Y1 - s0Y1; s01Z1 = s1Z1 - s0Z1; @@ -11544,26 +11600,26 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { s0cX1 = cX1 - s0X1; s0cY1 = cY1 - s0Y1; s0cZ1 = cZ1 - s0Z1; - var d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; - var d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; - var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; - var d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; - var d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; - var invDet1 = d11 * d22 - d12 * d12; + let d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; + let d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; + let d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + let d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; + let d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; + let invDet1 = d11 * d22 - d12 * d12; if(invDet1 != 0) { invDet1 = 1 / invDet1; } - var s = (d1c * d22 - d2c * d12) * invDet1; - var t1 = (-d1c * d12 + d2c * d11) * invDet1; - var diffX1; - var diffY1; - var diffZ1; - var cp1X1; - var cp1Y1; - var cp1Z1; - var cp2X1; - var cp2Y1; - var cp2Z1; + let s = (d1c * d22 - d2c * d12) * invDet1; + let t1 = (-d1c * d12 + d2c * d11) * invDet1; + let diffX1; + let diffY1; + let diffZ1; + let cp1X1; + let cp1Y1; + let cp1Z1; + let cp2X1; + let cp2Y1; + let cp2Z1; diffX1 = w11X1 - w10X1; diffY1 = w11Y1 - w10Y1; diffZ1 = w11Z1 - w10Z1; @@ -11588,11 +11644,11 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp2X1 += diffX1 * t1; cp2Y1 += diffY1 * t1; cp2Z1 += diffZ1 * t1; - var v21 = this.closestPoint1; + let v21 = this.closestPoint1; v21.x = cp1X1; v21.y = cp1Y1; v21.z = cp1Z1; - var v22 = this.closestPoint2; + let v22 = this.closestPoint2; v22.x = cp2X1; v22.y = cp2Y1; v22.z = cp2Z1; @@ -11601,16 +11657,16 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { throw new Error("!?"); } } - ,loadCache: function(gjkCache) { - var _this = this.dir; - var v = gjkCache.prevClosestDir; + loadCache(gjkCache) { + let _this = this.dir; + let v = gjkCache.prevClosestDir; _this.x = v.x; _this.y = v.y; _this.z = v.z; } - ,saveCache: function(gjkCache) { - var _this = gjkCache.prevClosestDir; - var v = this.closest; + saveCache(gjkCache) { + let _this = gjkCache.prevClosestDir; + let v = this.closest; _this.x = v.x; _this.y = v.y; _this.z = v.z; @@ -11618,269 +11674,269 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.y = -_this.y; _this.z = -_this.z; } - ,shrinkSimplex: function(vertexBits) { + shrinkSimplex(vertexBits) { this.simplexSize = vertexBits; this.simplexSize = (this.simplexSize & 5) + (this.simplexSize >> 1 & 5); this.simplexSize = (this.simplexSize & 3) + (this.simplexSize >> 2 & 3); switch(vertexBits) { case 2: - var _this = this.s[0]; - var v = this.s[1]; + let _this = this.s[0]; + let v = this.s[1]; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1[0]; - var v1 = this.w1[1]; + let _this1 = this.w1[0]; + let v1 = this.w1[1]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; - var _this2 = this.w2[0]; - var v2 = this.w2[1]; + let _this2 = this.w2[0]; + let v2 = this.w2[1]; _this2.x = v2.x; _this2.y = v2.y; _this2.z = v2.z; break; case 4: - var _this3 = this.s[0]; - var v3 = this.s[2]; + let _this3 = this.s[0]; + let v3 = this.s[2]; _this3.x = v3.x; _this3.y = v3.y; _this3.z = v3.z; - var _this4 = this.w1[0]; - var v4 = this.w1[2]; + let _this4 = this.w1[0]; + let v4 = this.w1[2]; _this4.x = v4.x; _this4.y = v4.y; _this4.z = v4.z; - var _this5 = this.w2[0]; - var v5 = this.w2[2]; + let _this5 = this.w2[0]; + let v5 = this.w2[2]; _this5.x = v5.x; _this5.y = v5.y; _this5.z = v5.z; break; case 5: - var _this6 = this.s[1]; - var v6 = this.s[2]; + let _this6 = this.s[1]; + let v6 = this.s[2]; _this6.x = v6.x; _this6.y = v6.y; _this6.z = v6.z; - var _this7 = this.w1[1]; - var v7 = this.w1[2]; + let _this7 = this.w1[1]; + let v7 = this.w1[2]; _this7.x = v7.x; _this7.y = v7.y; _this7.z = v7.z; - var _this8 = this.w2[1]; - var v8 = this.w2[2]; + let _this8 = this.w2[1]; + let v8 = this.w2[2]; _this8.x = v8.x; _this8.y = v8.y; _this8.z = v8.z; break; case 6: - var _this9 = this.s[0]; - var v9 = this.s[2]; + let _this9 = this.s[0]; + let v9 = this.s[2]; _this9.x = v9.x; _this9.y = v9.y; _this9.z = v9.z; - var _this10 = this.w1[0]; - var v10 = this.w1[2]; + let _this10 = this.w1[0]; + let v10 = this.w1[2]; _this10.x = v10.x; _this10.y = v10.y; _this10.z = v10.z; - var _this11 = this.w2[0]; - var v11 = this.w2[2]; + let _this11 = this.w2[0]; + let v11 = this.w2[2]; _this11.x = v11.x; _this11.y = v11.y; _this11.z = v11.z; break; case 8: - var _this12 = this.s[0]; - var v12 = this.s[3]; + let _this12 = this.s[0]; + let v12 = this.s[3]; _this12.x = v12.x; _this12.y = v12.y; _this12.z = v12.z; - var _this13 = this.w1[0]; - var v13 = this.w1[3]; + let _this13 = this.w1[0]; + let v13 = this.w1[3]; _this13.x = v13.x; _this13.y = v13.y; _this13.z = v13.z; - var _this14 = this.w2[0]; - var v14 = this.w2[3]; + let _this14 = this.w2[0]; + let v14 = this.w2[3]; _this14.x = v14.x; _this14.y = v14.y; _this14.z = v14.z; break; case 9: - var _this15 = this.s[1]; - var v15 = this.s[3]; + let _this15 = this.s[1]; + let v15 = this.s[3]; _this15.x = v15.x; _this15.y = v15.y; _this15.z = v15.z; - var _this16 = this.w1[1]; - var v16 = this.w1[3]; + let _this16 = this.w1[1]; + let v16 = this.w1[3]; _this16.x = v16.x; _this16.y = v16.y; _this16.z = v16.z; - var _this17 = this.w2[1]; - var v17 = this.w2[3]; + let _this17 = this.w2[1]; + let v17 = this.w2[3]; _this17.x = v17.x; _this17.y = v17.y; _this17.z = v17.z; break; case 10: - var _this18 = this.s[0]; - var v18 = this.s[3]; + let _this18 = this.s[0]; + let v18 = this.s[3]; _this18.x = v18.x; _this18.y = v18.y; _this18.z = v18.z; - var _this19 = this.w1[0]; - var v19 = this.w1[3]; + let _this19 = this.w1[0]; + let v19 = this.w1[3]; _this19.x = v19.x; _this19.y = v19.y; _this19.z = v19.z; - var _this20 = this.w2[0]; - var v20 = this.w2[3]; + let _this20 = this.w2[0]; + let v20 = this.w2[3]; _this20.x = v20.x; _this20.y = v20.y; _this20.z = v20.z; break; case 11: - var _this21 = this.s[2]; - var v21 = this.s[3]; + let _this21 = this.s[2]; + let v21 = this.s[3]; _this21.x = v21.x; _this21.y = v21.y; _this21.z = v21.z; - var _this22 = this.w1[2]; - var v22 = this.w1[3]; + let _this22 = this.w1[2]; + let v22 = this.w1[3]; _this22.x = v22.x; _this22.y = v22.y; _this22.z = v22.z; - var _this23 = this.w2[2]; - var v23 = this.w2[3]; + let _this23 = this.w2[2]; + let v23 = this.w2[3]; _this23.x = v23.x; _this23.y = v23.y; _this23.z = v23.z; break; case 12: - var _this24 = this.s[0]; - var v24 = this.s[2]; + let _this24 = this.s[0]; + let v24 = this.s[2]; _this24.x = v24.x; _this24.y = v24.y; _this24.z = v24.z; - var _this25 = this.w1[0]; - var v25 = this.w1[2]; + let _this25 = this.w1[0]; + let v25 = this.w1[2]; _this25.x = v25.x; _this25.y = v25.y; _this25.z = v25.z; - var _this26 = this.w2[0]; - var v26 = this.w2[2]; + let _this26 = this.w2[0]; + let v26 = this.w2[2]; _this26.x = v26.x; _this26.y = v26.y; _this26.z = v26.z; - var _this27 = this.s[1]; - var v27 = this.s[3]; + let _this27 = this.s[1]; + let v27 = this.s[3]; _this27.x = v27.x; _this27.y = v27.y; _this27.z = v27.z; - var _this28 = this.w1[1]; - var v28 = this.w1[3]; + let _this28 = this.w1[1]; + let v28 = this.w1[3]; _this28.x = v28.x; _this28.y = v28.y; _this28.z = v28.z; - var _this29 = this.w2[1]; - var v29 = this.w2[3]; + let _this29 = this.w2[1]; + let v29 = this.w2[3]; _this29.x = v29.x; _this29.y = v29.y; _this29.z = v29.z; break; case 13: - var _this30 = this.s[1]; - var v30 = this.s[3]; + let _this30 = this.s[1]; + let v30 = this.s[3]; _this30.x = v30.x; _this30.y = v30.y; _this30.z = v30.z; - var _this31 = this.w1[1]; - var v31 = this.w1[3]; + let _this31 = this.w1[1]; + let v31 = this.w1[3]; _this31.x = v31.x; _this31.y = v31.y; _this31.z = v31.z; - var _this32 = this.w2[1]; - var v32 = this.w2[3]; + let _this32 = this.w2[1]; + let v32 = this.w2[3]; _this32.x = v32.x; _this32.y = v32.y; _this32.z = v32.z; break; case 14: - var _this33 = this.s[0]; - var v33 = this.s[3]; + let _this33 = this.s[0]; + let v33 = this.s[3]; _this33.x = v33.x; _this33.y = v33.y; _this33.z = v33.z; - var _this34 = this.w1[0]; - var v34 = this.w1[3]; + let _this34 = this.w1[0]; + let v34 = this.w1[3]; _this34.x = v34.x; _this34.y = v34.y; _this34.z = v34.z; - var _this35 = this.w2[0]; - var v35 = this.w2[3]; + let _this35 = this.w2[0]; + let v35 = this.w2[3]; _this35.x = v35.x; _this35.y = v35.y; _this35.z = v35.z; break; } } - ,computeWitnessPoint1: function(addMargin) { - var tmpX; - var tmpY; - var tmpZ; - var idirX; - var idirY; - var idirZ; - var v = this.dir; + computeWitnessPoint1(addMargin) { + let tmpX; + let tmpY; + let tmpZ; + let idirX; + let idirY; + let idirZ; + let v = this.dir; idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir1X; - var ldir1Y; - var ldir1Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ldir1X; + let ldir1Y; + let ldir1Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this.tf1._rotation00 * idirX + this.tf1._rotation10 * idirY + this.tf1._rotation20 * idirZ; __tmp__Y = this.tf1._rotation01 * idirX + this.tf1._rotation11 * idirY + this.tf1._rotation21 * idirZ; __tmp__Z = this.tf1._rotation02 * idirX + this.tf1._rotation12 * idirY + this.tf1._rotation22 * idirZ; ldir1X = __tmp__X; ldir1Y = __tmp__Y; ldir1Z = __tmp__Z; - var iw1X; - var iw1Y; - var iw1Z; - var v1 = this.dir; + let iw1X; + let iw1Y; + let iw1Z; + let v1 = this.dir; v1.x = ldir1X; v1.y = ldir1Y; v1.z = ldir1Z; this.c1.computeLocalSupportingVertex(this.dir,this.w1[this.simplexSize]); if(addMargin) { - var _this = this.dir; - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = this.dir; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } _this.x *= invLen; _this.y *= invLen; _this.z *= invLen; - var _this1 = this.w1[this.simplexSize]; - var v2 = this.dir; - var s = this.c1._gjkMargin; - _this1.x += v2.x * s; - _this1.y += v2.y * s; - _this1.z += v2.z * s; - } - var v3 = this.w1[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let _this1 = this.w1[this.simplexSize]; + let v = this.dir; + let s = this.c1._gjkMargin; + _this1.x += v.x * s; + _this1.y += v.y * s; + _this1.z += v.z * s; + } + let v2 = this.w1[this.simplexSize]; + tmpX = v2.x; + tmpY = v2.y; + tmpZ = v2.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; __tmp__Y1 = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; __tmp__Z1 = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; @@ -11890,32 +11946,32 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { iw1X += this.tf1._positionX; iw1Y += this.tf1._positionY; iw1Z += this.tf1._positionZ; - var v4 = this.w1[this.simplexSize]; - v4.x = iw1X; - v4.y = iw1Y; - v4.z = iw1Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; - } - ,computeWitnessPoint2: function(addMargin) { - var tmpX; - var tmpY; - var tmpZ; - var idirX; - var idirY; - var idirZ; - var v = this.dir; + let v3 = this.w1[this.simplexSize]; + v3.x = iw1X; + v3.y = iw1Y; + v3.z = iw1Z; + let v4 = this.dir; + v4.x = idirX; + v4.y = idirY; + v4.z = idirZ; + } + computeWitnessPoint2(addMargin) { + let tmpX; + let tmpY; + let tmpZ; + let idirX; + let idirY; + let idirZ; + let v = this.dir; idirX = v.x; idirY = v.y; idirZ = v.z; - var ldir2X; - var ldir2Y; - var ldir2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let ldir2X; + let ldir2Y; + let ldir2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this.tf2._rotation00 * idirX + this.tf2._rotation10 * idirY + this.tf2._rotation20 * idirZ; __tmp__Y = this.tf2._rotation01 * idirX + this.tf2._rotation11 * idirY + this.tf2._rotation21 * idirZ; __tmp__Z = this.tf2._rotation02 * idirX + this.tf2._rotation12 * idirY + this.tf2._rotation22 * idirZ; @@ -11925,37 +11981,37 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { ldir2X = -ldir2X; ldir2Y = -ldir2Y; ldir2Z = -ldir2Z; - var iw2X; - var iw2Y; - var iw2Z; - var v1 = this.dir; + let iw2X; + let iw2Y; + let iw2Z; + let v1 = this.dir; v1.x = ldir2X; v1.y = ldir2Y; v1.z = ldir2Z; this.c2.computeLocalSupportingVertex(this.dir,this.w2[this.simplexSize]); if(addMargin) { - var _this = this.dir; - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); + let _this = this.dir; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } _this.x *= invLen; _this.y *= invLen; _this.z *= invLen; - var _this1 = this.w2[this.simplexSize]; - var v2 = this.dir; - var s = this.c2._gjkMargin; - _this1.x += v2.x * s; - _this1.y += v2.y * s; - _this1.z += v2.z * s; - } - var v3 = this.w2[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let _this1 = this.w2[this.simplexSize]; + let v = this.dir; + let s = this.c2._gjkMargin; + _this1.x += v.x * s; + _this1.y += v.y * s; + _this1.z += v.z * s; + } + let v2 = this.w2[this.simplexSize]; + tmpX = v2.x; + tmpY = v2.y; + tmpZ = v2.z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; __tmp__Y1 = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; __tmp__Z1 = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; @@ -11965,31 +12021,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { iw2X += this.tf2._positionX; iw2Y += this.tf2._positionY; iw2Z += this.tf2._positionZ; - var v4 = this.w2[this.simplexSize]; - v4.x = iw2X; - v4.y = iw2Y; - v4.z = iw2Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; - } - ,pointToTetrahedron: function() { - var _g = 0; + let v3 = this.w2[this.simplexSize]; + v3.x = iw2X; + v3.y = iw2Y; + v3.z = iw2Z; + let v4 = this.dir; + v4.x = idirX; + v4.y = idirY; + v4.z = idirZ; + } + pointToTetrahedron() { + let _g = 0; while(_g < 3) { - var _this = this.dir; - var v = this.baseDirs[_g++]; + let _this = this.dir; + let v = this.baseDirs[_g++]; _this.x = v.x; _this.y = v.y; _this.z = v.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this1 = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; + let _this1 = this.s[this.simplexSize]; + let v1 = this.w1[this.simplexSize]; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; - var v2 = this.w2[this.simplexSize]; + let v2 = this.w2[this.simplexSize]; _this1.x -= v2.x; _this1.y -= v2.y; _this1.z -= v2.z; @@ -11999,18 +12055,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { break; } this.simplexSize--; - var _this2 = this.dir; + let _this2 = this.dir; _this2.x = -_this2.x; _this2.y = -_this2.y; _this2.z = -_this2.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this3 = this.s[this.simplexSize]; - var v3 = this.w1[this.simplexSize]; + let _this3 = this.s[this.simplexSize]; + let v3 = this.w1[this.simplexSize]; _this3.x = v3.x; _this3.y = v3.y; _this3.z = v3.z; - var v4 = this.w2[this.simplexSize]; + let v4 = this.w2[this.simplexSize]; _this3.x -= v4.x; _this3.y -= v4.y; _this3.z -= v4.z; @@ -12022,85 +12078,85 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.simplexSize--; } } - ,lineToTetrahedron: function() { - var oldDirX; - var oldDirY; - var oldDirZ; - var v = this.dir; + lineToTetrahedron() { + let oldDirX; + let oldDirY; + let oldDirZ; + let v = this.dir; oldDirX = v.x; oldDirY = v.y; oldDirZ = v.z; - var s0X; - var s0Y; - var s0Z; - var s1X; - var s1Y; - var s1Z; - var lineDirX; - var lineDirY; - var lineDirZ; - var v1 = this.s[0]; + let s0X; + let s0Y; + let s0Z; + let s1X; + let s1Y; + let s1Z; + let lineDirX; + let lineDirY; + let lineDirZ; + let v1 = this.s[0]; s0X = v1.x; s0Y = v1.y; s0Z = v1.z; - var v2 = this.s[1]; + let v2 = this.s[1]; s1X = v2.x; s1Y = v2.y; s1Z = v2.z; lineDirX = s0X - s1X; lineDirY = s0Y - s1Y; lineDirZ = s0Z - s1Z; - var _g = 0; + let _g = 0; while(_g < 3) { - var baseDirX; - var baseDirY; - var baseDirZ; - var v3 = this.baseDirs[_g++]; - baseDirX = v3.x; - baseDirY = v3.y; - baseDirZ = v3.z; - var newDirX; - var newDirY; - var newDirZ; + let baseDirX; + let baseDirY; + let baseDirZ; + let v = this.baseDirs[_g++]; + baseDirX = v.x; + baseDirY = v.y; + baseDirZ = v.z; + let newDirX; + let newDirY; + let newDirZ; newDirX = lineDirY * baseDirZ - lineDirZ * baseDirY; newDirY = lineDirZ * baseDirX - lineDirX * baseDirZ; newDirZ = lineDirX * baseDirY - lineDirY * baseDirX; - var v4 = this.dir; - v4.x = newDirX; - v4.y = newDirY; - v4.z = newDirZ; + let v1 = this.dir; + v1.x = newDirX; + v1.y = newDirY; + v1.z = newDirZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var v6 = this.w2[this.simplexSize]; - _this.x -= v6.x; - _this.y -= v6.y; - _this.z -= v6.z; + let _this = this.s[this.simplexSize]; + let v2 = this.w1[this.simplexSize]; + _this.x = v2.x; + _this.y = v2.y; + _this.z = v2.z; + let v3 = this.w2[this.simplexSize]; + _this.x -= v3.x; + _this.y -= v3.y; + _this.z -= v3.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { break; } this.simplexSize--; - var _this1 = this.dir; + let _this1 = this.dir; _this1.x = -_this1.x; _this1.y = -_this1.y; _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this2 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - var v8 = this.w2[this.simplexSize]; - _this2.x -= v8.x; - _this2.y -= v8.y; - _this2.z -= v8.z; + let _this2 = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this2.x = v4.x; + _this2.y = v4.y; + _this2.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this2.x -= v5.x; + _this2.y -= v5.y; + _this2.z -= v5.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { @@ -12108,94 +12164,94 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } this.simplexSize--; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; + let v3 = this.dir; + v3.x = oldDirX; + v3.y = oldDirY; + v3.z = oldDirZ; } - ,triangleToTetrahedron: function() { - var oldDirX; - var oldDirY; - var oldDirZ; - var v = this.dir; + triangleToTetrahedron() { + let oldDirX; + let oldDirY; + let oldDirZ; + let v = this.dir; oldDirX = v.x; oldDirY = v.y; oldDirZ = v.z; while(true) { - var s0X; - var s0Y; - var s0Z; - var s1X; - var s1Y; - var s1Z; - var s2X; - var s2Y; - var s2Z; - var s01X; - var s01Y; - var s01Z; - var s02X; - var s02Y; - var s02Z; - var v1 = this.s[0]; - s0X = v1.x; - s0Y = v1.y; - s0Z = v1.z; - var v2 = this.s[1]; - s1X = v2.x; - s1Y = v2.y; - s1Z = v2.z; - var v3 = this.s[2]; - s2X = v3.x; - s2Y = v3.y; - s2Z = v3.z; + let s0X; + let s0Y; + let s0Z; + let s1X; + let s1Y; + let s1Z; + let s2X; + let s2Y; + let s2Z; + let s01X; + let s01Y; + let s01Z; + let s02X; + let s02Y; + let s02Z; + let v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + let v1 = this.s[1]; + s1X = v1.x; + s1Y = v1.y; + s1Z = v1.z; + let v2 = this.s[2]; + s2X = v2.x; + s2Y = v2.y; + s2Z = v2.z; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; s02X = s2X - s0X; s02Y = s2Y - s0Y; s02Z = s2Z - s0Z; - var nX; - var nY; - var nZ; + let nX; + let nY; + let nZ; nX = s01Y * s02Z - s01Z * s02Y; nY = s01Z * s02X - s01X * s02Z; nZ = s01X * s02Y - s01Y * s02X; - var v4 = this.dir; - v4.x = nX; - v4.y = nY; - v4.z = nZ; + let v3 = this.dir; + v3.x = nX; + v3.y = nY; + v3.z = nZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var v6 = this.w2[this.simplexSize]; - _this.x -= v6.x; - _this.y -= v6.y; - _this.z -= v6.z; + let _this = this.s[this.simplexSize]; + let v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + let v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; } this.simplexSize--; - var _this1 = this.dir; + let _this1 = this.dir; _this1.x = -_this1.x; _this1.y = -_this1.y; _this1.z = -_this1.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this2 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - var v8 = this.w2[this.simplexSize]; - _this2.x -= v8.x; - _this2.y -= v8.y; - _this2.z -= v8.z; + let _this2 = this.s[this.simplexSize]; + let v6 = this.w1[this.simplexSize]; + _this2.x = v6.x; + _this2.y = v6.y; + _this2.z = v6.z; + let v7 = this.w2[this.simplexSize]; + _this2.x -= v7.x; + _this2.y -= v7.y; + _this2.z -= v7.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; @@ -12203,32 +12259,32 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.simplexSize--; break; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; - } - ,isValidTetrahedron: function() { - var e10 = this.s[2].x - this.s[0].x; - var e11 = this.s[2].y - this.s[0].y; - var e12 = this.s[2].z - this.s[0].z; - var e20 = this.s[3].x - this.s[0].x; - var e21 = this.s[3].y - this.s[0].y; - var e22 = this.s[3].z - this.s[0].z; - var det = (this.s[1].x - this.s[0].x) * (e11 * e22 - e12 * e21) - (this.s[1].y - this.s[0].y) * (e10 * e22 - e12 * e20) + (this.s[1].z - this.s[0].z) * (e10 * e21 - e11 * e20); + let v1 = this.dir; + v1.x = oldDirX; + v1.y = oldDirY; + v1.z = oldDirZ; + } + isValidTetrahedron() { + let e10 = this.s[2].x - this.s[0].x; + let e11 = this.s[2].y - this.s[0].y; + let e12 = this.s[2].z - this.s[0].z; + let e20 = this.s[3].x - this.s[0].x; + let e21 = this.s[3].y - this.s[0].y; + let e22 = this.s[3].z - this.s[0].z; + let det = (this.s[1].x - this.s[0].x) * (e11 * e22 - e12 * e21) - (this.s[1].y - this.s[0].y) * (e10 * e22 - e12 * e20) + (this.s[1].z - this.s[0].z) * (e10 * e21 - e11 * e20); if(!(det > 1e-12)) { return det < -1e-12; } else { return true; } } - ,computeDepth: function(convex1,convex2,tf1,tf2,initialPolyhedron,initialPolyhedron1,initialPolyhedron2) { - var _this = this.polyhedron; + computeDepth(convex1,convex2,tf1,tf2,initialPolyhedron,initialPolyhedron1,initialPolyhedron2) { + let _this = this.polyhedron; while(_this._numTriangles > 0) { - var t = _this._triangleList; + let t = _this._triangleList; _this._numTriangles--; - var prev = t._prev; - var next = t._next; + let prev = t._prev; + let next = t._next; if(prev != null) { prev._next = next; } @@ -12248,41 +12304,41 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this._trianglePool = t; } while(_this._numVertices > 0) { - var v = _this._vertices[--_this._numVertices]; + let v = _this._vertices[--_this._numVertices]; v.removeReferences(); v._next = _this._vertexPool; _this._vertexPool = v; } - var tmp = this.polyhedron; - var _this1 = this.polyhedron; - var first = _this1._vertexPool; + let tmp = this.polyhedron; + let _this1 = this.polyhedron; + let first = _this1._vertexPool; if(first != null) { _this1._vertexPool = first._next; first._next = null; } else { first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - var tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); - var _this2 = this.polyhedron; - var first1 = _this2._vertexPool; + let tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); + let _this2 = this.polyhedron; + let first1 = _this2._vertexPool; if(first1 != null) { _this2._vertexPool = first1._next; first1._next = null; } else { first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - var tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); - var _this3 = this.polyhedron; - var first2 = _this3._vertexPool; + let tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); + let _this3 = this.polyhedron; + let first2 = _this3._vertexPool; if(first2 != null) { _this3._vertexPool = first2._next; first2._next = null; } else { first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - var tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); - var _this4 = this.polyhedron; - var first3 = _this4._vertexPool; + let tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); + let _this4 = this.polyhedron; + let first3 = _this4._vertexPool; if(first3 != null) { _this4._vertexPool = first3._next; first3._next = null; @@ -12293,14 +12349,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_INIT; } this.simplexSize = 0; - var supportingVertex = this.s[0]; - var witness1 = this.w1[0]; - var witness2 = this.w2[0]; - var count = 0; + let supportingVertex = this.s[0]; + let witness1 = this.w1[0]; + let witness2 = this.w2[0]; + let count = 0; while(count < 40) { - var f = this.polyhedron._triangleList; - var mind = 1e65536; - var minf = null; + let f = this.polyhedron._triangleList; + let mind = 1e65536; + let minf = null; while(f != null) { if(f._distanceSq < mind) { mind = f._distanceSq; @@ -12308,128 +12364,128 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } f = f._next; } - var face = minf; - var _this5 = this.dir; - var v1 = face._normal; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var invLen = Math.sqrt(_this5.x * _this5.x + _this5.y * _this5.y + _this5.z * _this5.z); + let face = minf; + let _this = this.dir; + let v = face._normal; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - _this5.x *= invLen; - _this5.y *= invLen; - _this5.z *= invLen; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this6 = this.s[this.simplexSize]; - var v2 = this.w1[this.simplexSize]; - _this6.x = v2.x; - _this6.y = v2.y; - _this6.z = v2.z; - var v3 = this.w2[this.simplexSize]; - _this6.x -= v3.x; - _this6.y -= v3.y; - _this6.z -= v3.z; - var v0 = face._vertices[0]; - var v11 = face._vertices[1]; - var v21 = face._vertices[2]; - var _this7 = v0.v; - var v4 = this.dir; - var v5 = this.dir; - if(supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z - (_this7.x * v4.x + _this7.y * v4.y + _this7.z * v4.z) < 1e-6 || count == 39) { - var _this8 = this.closest; - var v6 = this.dir; - _this8.x = v6.x; - _this8.y = v6.y; - _this8.z = v6.z; - var _this9 = this.dir; - var v7 = v0.v; - var _this10 = this.dir; - var s = (_this9.x * v7.x + _this9.y * v7.y + _this9.z * v7.z) / (_this10.x * _this10.x + _this10.y * _this10.y + _this10.z * _this10.z); - _this8.x *= s; - _this8.y *= s; - _this8.z *= s; - var cX; - var cY; - var cZ; - var v8 = this.closest; - cX = v8.x; - cY = v8.y; - cZ = v8.z; - var s0X; - var s0Y; - var s0Z; - var w10X; - var w10Y; - var w10Z; - var w20X; - var w20Y; - var w20Z; - var s1X; - var s1Y; - var s1Z; - var w11X; - var w11Y; - var w11Z; - var w21X; - var w21Y; - var w21Z; - var s2X; - var s2Y; - var s2Z; - var w12X; - var w12Y; - var w12Z; - var w22X; - var w22Y; - var w22Z; - var v9 = v0.v; - s0X = v9.x; - s0Y = v9.y; - s0Z = v9.z; - var v10 = v0.w1; - w10X = v10.x; - w10Y = v10.y; - w10Z = v10.z; - var v12 = v0.w2; - w20X = v12.x; - w20Y = v12.y; - w20Z = v12.z; - var v13 = v11.v; - s1X = v13.x; - s1Y = v13.y; - s1Z = v13.z; - var v14 = v11.w1; - w11X = v14.x; - w11Y = v14.y; - w11Z = v14.z; - var v15 = v11.w2; - w21X = v15.x; - w21Y = v15.y; - w21Z = v15.z; - var v16 = v21.v; - s2X = v16.x; - s2Y = v16.y; - s2Z = v16.z; - var v17 = v21.w1; - w12X = v17.x; - w12Y = v17.y; - w12Z = v17.z; - var v18 = v21.w2; - w22X = v18.x; - w22Y = v18.y; - w22Z = v18.z; - var s01X; - var s01Y; - var s01Z; - var s02X; - var s02Y; - var s02Z; - var s0cX; - var s0cY; - var s0cZ; + let _this1 = this.s[this.simplexSize]; + let v1 = this.w1[this.simplexSize]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + let v2 = this.w2[this.simplexSize]; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; + let v0 = face._vertices[0]; + let v11 = face._vertices[1]; + let v21 = face._vertices[2]; + let _this2 = v0.v; + let v3 = this.dir; + let v4 = this.dir; + if(supportingVertex.x * v4.x + supportingVertex.y * v4.y + supportingVertex.z * v4.z - (_this2.x * v3.x + _this2.y * v3.y + _this2.z * v3.z) < 1e-6 || count == 39) { + let _this = this.closest; + let v = this.dir; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let _this1 = this.dir; + let v1 = v0.v; + let _this2 = this.dir; + let s = (_this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z) / (_this2.x * _this2.x + _this2.y * _this2.y + _this2.z * _this2.z); + _this.x *= s; + _this.y *= s; + _this.z *= s; + let cX; + let cY; + let cZ; + let v2 = this.closest; + cX = v2.x; + cY = v2.y; + cZ = v2.z; + let s0X; + let s0Y; + let s0Z; + let w10X; + let w10Y; + let w10Z; + let w20X; + let w20Y; + let w20Z; + let s1X; + let s1Y; + let s1Z; + let w11X; + let w11Y; + let w11Z; + let w21X; + let w21Y; + let w21Z; + let s2X; + let s2Y; + let s2Z; + let w12X; + let w12Y; + let w12Z; + let w22X; + let w22Y; + let w22Z; + let v3 = v0.v; + s0X = v3.x; + s0Y = v3.y; + s0Z = v3.z; + let v4 = v0.w1; + w10X = v4.x; + w10Y = v4.y; + w10Z = v4.z; + let v5 = v0.w2; + w20X = v5.x; + w20Y = v5.y; + w20Z = v5.z; + let v6 = v11.v; + s1X = v6.x; + s1Y = v6.y; + s1Z = v6.z; + let v7 = v11.w1; + w11X = v7.x; + w11Y = v7.y; + w11Z = v7.z; + let v8 = v11.w2; + w21X = v8.x; + w21Y = v8.y; + w21Z = v8.z; + let v9 = v21.v; + s2X = v9.x; + s2Y = v9.y; + s2Z = v9.z; + let v10 = v21.w1; + w12X = v10.x; + w12Y = v10.y; + w12Z = v10.z; + let v12 = v21.w2; + w22X = v12.x; + w22Y = v12.y; + w22Z = v12.z; + let s01X; + let s01Y; + let s01Z; + let s02X; + let s02Y; + let s02Z; + let s0cX; + let s0cY; + let s0cZ; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; @@ -12439,26 +12495,26 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { s0cX = cX - s0X; s0cY = cY - s0Y; s0cZ = cZ - s0Z; - var d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; - var d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; - var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; - var d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; - var d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; - var invDet = d11 * d22 - d12 * d12; + let d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + let d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; + let d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; + let d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; + let d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; + let invDet = d11 * d22 - d12 * d12; if(invDet != 0) { invDet = 1 / invDet; } - var s1 = (d1c * d22 - d2c * d12) * invDet; - var t1 = (-d1c * d12 + d2c * d11) * invDet; - var diffX; - var diffY; - var diffZ; - var cp1X; - var cp1Y; - var cp1Z; - var cp2X; - var cp2Y; - var cp2Z; + let s1 = (d1c * d22 - d2c * d12) * invDet; + let t = (-d1c * d12 + d2c * d11) * invDet; + let diffX; + let diffY; + let diffZ; + let cp1X; + let cp1Y; + let cp1Z; + let cp2X; + let cp2Y; + let cp2Z; diffX = w11X - w10X; diffY = w11Y - w10Y; diffZ = w11Z - w10Z; @@ -12468,9 +12524,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { diffX = w12X - w10X; diffY = w12Y - w10Y; diffZ = w12Z - w10Z; - cp1X += diffX * t1; - cp1Y += diffY * t1; - cp1Z += diffZ * t1; + cp1X += diffX * t; + cp1Y += diffY * t; + cp1Z += diffZ * t; diffX = w21X - w20X; diffY = w21Y - w20Y; diffZ = w21Z - w20Z; @@ -12480,30 +12536,30 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { diffX = w22X - w20X; diffY = w22Y - w20Y; diffZ = w22Z - w20Z; - cp2X += diffX * t1; - cp2Y += diffY * t1; - cp2Z += diffZ * t1; - var v19 = this.closestPoint1; - v19.x = cp1X; - v19.y = cp1Y; - v19.z = cp1Z; - var v20 = this.closestPoint2; - v20.x = cp2X; - v20.y = cp2Y; - v20.z = cp2Z; - var _this11 = this.closest; - this.depth = Math.sqrt(_this11.x * _this11.x + _this11.y * _this11.y + _this11.z * _this11.z); + cp2X += diffX * t; + cp2Y += diffY * t; + cp2Z += diffZ * t; + let v13 = this.closestPoint1; + v13.x = cp1X; + v13.y = cp1Y; + v13.z = cp1Z; + let v14 = this.closestPoint2; + v14.x = cp2X; + v14.y = cp2Y; + v14.z = cp2Z; + let _this3 = this.closest; + this.depth = Math.sqrt(_this3.x * _this3.x + _this3.y * _this3.y + _this3.z * _this3.z); return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED; } - var _this12 = this.polyhedron; - var first4 = _this12._vertexPool; - if(first4 != null) { - _this12._vertexPool = first4._next; - first4._next = null; + let _this3 = this.polyhedron; + let first = _this3._vertexPool; + if(first != null) { + _this3._vertexPool = first._next; + first._next = null; } else { - first4 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - var epaVertex = first4.init(supportingVertex,witness1,witness2); + let epaVertex = first.init(supportingVertex,witness1,witness2); if(!this.polyhedron._addVertex(epaVertex,face)) { return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; } @@ -12511,22 +12567,22 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_DID_NOT_CONVERGE; } - ,computeClosestPoints: function(c1,c2,tf1,tf2,cache) { + computeClosestPoints(c1,c2,tf1,tf2,cache) { return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,true); } - ,computeDistance: function(c1,c2,tf1,tf2,cache) { + computeDistance(c1,c2,tf1,tf2,cache) { return this.computeClosestPointsImpl(c1,c2,tf1,tf2,cache,false); } - ,convexCast: function(c1,c2,tf1,tf2,tl1,tl2,hit) { + convexCast(c1,c2,tf1,tf2,tl1,tl2,hit) { return this.convexCastImpl(c1,c2,tf1,tf2,tl1,tl2,hit); } - ,rayCast: function(c,tf,begin,end,hit) { - var tf1 = this.tempTransform; + rayCast(c,tf,begin,end,hit) { + let tf1 = this.tempTransform; tf1._positionX = begin.x; tf1._positionY = begin.y; tf1._positionZ = begin.z; - var tl1 = this.tl1; - var tl2 = this.tl2; + let tl1 = this.tl1; + let tl2 = this.tl2; tl1.x = end.x; tl1.y = end.y; tl1.z = end.z; @@ -12536,1469 +12592,1475 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { tl2.zero(); return this.convexCastImpl(null,c,tf1,tf,tl1,tl2,hit); } -}; -var oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog = function() { }; -var oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState = function() { }; -var oimo_collision_narrowphase_detector_gjkepa_SimplexUtil = function() { }; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin2 = function(vec1,vec2,out) { - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - v1X = vec1.x; - v1Y = vec1.y; - v1Z = vec1.z; - v2X = vec2.x; - v2Y = vec2.y; - v2Z = vec2.z; - var v12X; - var v12Y; - var v12Z; - v12X = v2X - v1X; - v12Y = v2Y - v1Y; - v12Z = v2Z - v1Z; - var t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; - t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); - if(t < 0) { - out.x = v1X; - out.y = v1Y; - out.z = v1Z; - return 1; - } - if(t > 1) { - out.x = v2X; - out.y = v2Y; - out.z = v2Z; - return 2; + static getInstance() { + return oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; } - var pX; - var pY; - var pZ; - pX = v1X + v12X * t; - pY = v1Y + v12Y * t; - pZ = v1Z + v12Z * t; - out.x = pX; - out.y = pY; - out.z = pZ; - return 3; -}; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function(vec1,vec2,vec3,out) { - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - var v3X; - var v3Y; - var v3Z; - var v12X; - var v12Y; - var v12Z; - var v23X; - var v23Y; - var v23Z; - var v31X; - var v31Y; - var v31Z; - v1X = vec1.x; - v1Y = vec1.y; - v1Z = vec1.z; - v2X = vec2.x; - v2Y = vec2.y; - v2Z = vec2.z; - v3X = vec3.x; - v3Y = vec3.y; - v3Z = vec3.z; - v12X = v2X - v1X; - v12Y = v2Y - v1Y; - v12Z = v2Z - v1Z; - v23X = v3X - v2X; - v23Y = v3Y - v2Y; - v23Z = v3Z - v2Z; - v31X = v1X - v3X; - v31Y = v1Y - v3Y; - v31Z = v1Z - v3Z; - var nX; - var nY; - var nZ; - nX = v12Y * v23Z - v12Z * v23Y; - nY = v12Z * v23X - v12X * v23Z; - nZ = v12X * v23Y - v12Y * v23X; - var n12X; - var n12Y; - var n12Z; - var n23X; - var n23Y; - var n23Z; - var n31X; - var n31Y; - var n31Z; - n12X = v12Y * nZ - v12Z * nY; - n12Y = v12Z * nX - v12X * nZ; - n12Z = v12X * nY - v12Y * nX; - n23X = v23Y * nZ - v23Z * nY; - n23Y = v23Z * nX - v23X * nZ; - n23Z = v23X * nY - v23Y * nX; - n31X = v31Y * nZ - v31Z * nY; - n31Y = v31Z * nX - v31X * nZ; - n31Z = v31X * nY - v31Y * nX; - var mind = -1; - var minvX; - var minvY; - var minvZ; - var mini = 0; - minvX = 0; - minvY = 0; - minvZ = 0; - if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - v1X1 = vec1.x; - v1Y1 = vec1.y; - v1Z1 = vec1.z; - v2X1 = vec2.x; - v2Y1 = vec2.y; - v2Z1 = vec2.z; - var v12X1; - var v12Y1; - var v12Z1; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; - t = -t / (v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1); - var b; +} +class oimo_collision_narrowphase_detector_gjkepa_GjkEpaLog { +} +class oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState { +} +class oimo_collision_narrowphase_detector_gjkepa_SimplexUtil { + static projectOrigin2(vec1,vec2,out) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - out.x = v1X1; - out.y = v1Y1; - out.z = v1Z1; - b = 1; - } else if(t > 1) { - out.x = v2X1; - out.y = v2Y1; - out.z = v2Z1; - b = 2; - } else { - var pX; - var pY; - var pZ; - pX = v1X1 + v12X1 * t; - pY = v1Y1 + v12Y1 * t; - pZ = v1Z1 + v12Z1 * t; - out.x = pX; - out.y = pY; - out.z = pZ; - b = 3; - } - mini = b; - mind = out.x * out.x + out.y * out.y + out.z * out.z; - minvX = out.x; - minvY = out.y; - minvZ = out.z; - } - if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec2.x; - v1Y2 = vec2.y; - v1Z2 = vec2.z; - v2X2 = vec3.x; - v2Y2 = vec3.y; - v2Z2 = vec3.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); - var b1; - if(t1 < 0) { - out.x = v1X2; - out.y = v1Y2; - out.z = v1Z2; - b1 = 1; - } else if(t1 > 1) { - out.x = v2X2; - out.y = v2Y2; - out.z = v2Z2; - b1 = 2; - } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; - b1 = 3; - } - var d = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d < mind) { - mini = b1 << 1; - mind = d; - minvX = out.x; - minvY = out.y; - minvZ = out.z; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + return 1; } - } - if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec1.x; - v1Y3 = vec1.y; - v1Z3 = vec1.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b2; - if(t2 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - b2 = 1; - } else if(t2 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; - b2 = 2; - } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - b2 = 3; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d1 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d1; + if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + return 2; + } + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + return 3; + } + static projectOrigin3(vec1,vec2,vec3,out) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini = b; + mind = out.x * out.x + out.y * out.y + out.z * out.z; minvX = out.x; minvY = out.y; minvZ = out.z; } - } - if(mind > 0) { - out.x = minvX; - out.y = minvY; - out.z = minvZ; - return mini; - } - var l = nX * nX + nY * nY + nZ * nZ; - if(l > 0) { - l = 1 / Math.sqrt(l); - } - nX *= l; - nY *= l; - nZ *= l; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; - minvX = nX * l2; - minvY = nY * l2; - minvZ = nZ * l2; - out.x = minvX; - out.y = minvY; - out.z = minvZ; - return 7; -}; -oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function(vec1,vec2,vec3,vec4,out) { - var v1X; - var v1Y; - var v1Z; - var v2X; - var v2Y; - var v2Z; - var v3X; - var v3Y; - var v3Z; - var v4X; - var v4Y; - var v4Z; - var v12X; - var v12Y; - var v12Z; - var v13X; - var v13Y; - var v13Z; - var v14X; - var v14Y; - var v14Z; - var v23X; - var v23Y; - var v23Z; - var v24X; - var v24Y; - var v24Z; - v1X = vec1.x; - v1Y = vec1.y; - v1Z = vec1.z; - v2X = vec2.x; - v2Y = vec2.y; - v2Z = vec2.z; - v3X = vec3.x; - v3Y = vec3.y; - v3Z = vec3.z; - v4X = vec4.x; - v4Y = vec4.y; - v4Z = vec4.z; - v12X = v2X - v1X; - v12Y = v2Y - v1Y; - v12Z = v2Z - v1Z; - v13X = v3X - v1X; - v13Y = v3Y - v1Y; - v13Z = v3Z - v1Z; - v14X = v4X - v1X; - v14Y = v4Y - v1Y; - v14Z = v4Z - v1Z; - v23X = v3X - v2X; - v23Y = v3Y - v2Y; - v23Z = v3Z - v2Z; - v24X = v4X - v2X; - v24Y = v4Y - v2Y; - v24Z = v4Z - v2Z; - var n123X; - var n123Y; - var n123Z; - var n134X; - var n134Y; - var n134Z; - var n142X; - var n142Y; - var n142Z; - var n243X; - var n243Y; - var n243Z; - n123X = v12Y * v13Z - v12Z * v13Y; - n123Y = v12Z * v13X - v12X * v13Z; - n123Z = v12X * v13Y - v12Y * v13X; - n134X = v13Y * v14Z - v13Z * v14Y; - n134Y = v13Z * v14X - v13X * v14Z; - n134Z = v13X * v14Y - v13Y * v14X; - n142X = v14Y * v12Z - v14Z * v12Y; - n142Y = v14Z * v12X - v14X * v12Z; - n142Z = v14X * v12Y - v14Y * v12X; - n243X = v24Y * v23Z - v24Z * v23Y; - n243Y = v24Z * v23X - v24X * v23Z; - n243Z = v24X * v23Y - v24Y * v23X; - var sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; - var mind = -1; - var minvX; - var minvY; - var minvZ; - var mini = 0; - minvX = 0; - minvY = 0; - minvZ = 0; - if((v1X * n123X + v1Y * n123Y + v1Z * n123Z) * sign < 0) { - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - var v3X1; - var v3Y1; - var v3Z1; - var v12X1; - var v12Y1; - var v12Z1; - var v23X1; - var v23Y1; - var v23Z1; - var v31X; - var v31Y; - var v31Z; - v1X1 = vec1.x; - v1Y1 = vec1.y; - v1Z1 = vec1.z; - v2X1 = vec2.x; - v2Y1 = vec2.y; - v2Z1 = vec2.z; - v3X1 = vec3.x; - v3Y1 = vec3.y; - v3Z1 = vec3.z; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - v23X1 = v3X1 - v2X1; - v23Y1 = v3Y1 - v2Y1; - v23Z1 = v3Z1 - v2Z1; - v31X = v1X1 - v3X1; - v31Y = v1Y1 - v3Y1; - v31Z = v1Z1 - v3Z1; - var nX; - var nY; - var nZ; - nX = v12Y1 * v23Z1 - v12Z1 * v23Y1; - nY = v12Z1 * v23X1 - v12X1 * v23Z1; - nZ = v12X1 * v23Y1 - v12Y1 * v23X1; - var n12X; - var n12Y; - var n12Z; - var n23X; - var n23Y; - var n23Z; - var n31X; - var n31Y; - var n31Z; - n12X = v12Y1 * nZ - v12Z1 * nY; - n12Y = v12Z1 * nX - v12X1 * nZ; - n12Z = v12X1 * nY - v12Y1 * nX; - n23X = v23Y1 * nZ - v23Z1 * nY; - n23Y = v23Z1 * nX - v23X1 * nZ; - n23Z = v23X1 * nY - v23Y1 * nX; - n31X = v31Y * nZ - v31Z * nY; - n31Y = v31Z * nX - v31X * nZ; - n31Z = v31X * nY - v31Y * nX; - var mind1 = -1; - var minvX1; - var minvY1; - var minvZ1; - var mini1 = 0; - minvX1 = 0; - minvY1 = 0; - minvZ1 = 0; - if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec1.x; - v1Y2 = vec1.y; - v1Z2 = vec1.z; - v2X2 = vec2.x; - v2Y2 = vec2.y; - v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); - var b; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; if(t < 0) { - out.x = v1X2; - out.y = v1Y2; - out.z = v1Z2; + out.x = v1X; + out.y = v1Y; + out.z = v1Z; b = 1; } else if(t > 1) { - out.x = v2X2; - out.y = v2Y2; - out.z = v2Z2; + out.x = v2X; + out.y = v2Y; + out.z = v2Z; b = 2; } else { - var pX; - var pY; - var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; out.x = pX; out.y = pY; out.z = pZ; b = 3; } - mini1 = b; - mind1 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX1 = out.x; - minvY1 = out.y; - minvZ1 = out.z; + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } } - if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b1; - if(t1 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - b1 = 1; - } else if(t1 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; - b1 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; - b1 = 3; - } - var d = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d < mind1) { - mini1 = b1 << 1; - mind1 = d; + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(mind > 0) { + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return mini; + } + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX = nX * l2; + minvY = nY * l2; + minvZ = nZ * l2; + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return 7; + } + static projectOrigin4(vec1,vec2,vec3,vec4,out) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v4X; + let v4Y; + let v4Z; + let v12X; + let v12Y; + let v12Z; + let v13X; + let v13Y; + let v13Z; + let v14X; + let v14Y; + let v14Z; + let v23X; + let v23Y; + let v23Z; + let v24X; + let v24Y; + let v24Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v4X = vec4.x; + v4Y = vec4.y; + v4Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v13X = v3X - v1X; + v13Y = v3Y - v1Y; + v13Z = v3Z - v1Z; + v14X = v4X - v1X; + v14Y = v4Y - v1Y; + v14Z = v4Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v24X = v4X - v2X; + v24Y = v4Y - v2Y; + v24Z = v4Z - v2Z; + let n123X; + let n123Y; + let n123Z; + let n134X; + let n134Y; + let n134Z; + let n142X; + let n142Y; + let n142Z; + let n243X; + let n243Y; + let n243Z; + n123X = v12Y * v13Z - v12Z * v13Y; + n123Y = v12Z * v13X - v12X * v13Z; + n123Z = v12X * v13Y - v12Y * v13X; + n134X = v13Y * v14Z - v13Z * v14Y; + n134Y = v13Z * v14X - v13X * v14Z; + n134Z = v13X * v14Y - v13Y * v14X; + n142X = v14Y * v12Z - v14Z * v12Y; + n142Y = v14Z * v12X - v14X * v12Z; + n142Z = v14X * v12Y - v14Y * v12X; + n243X = v24Y * v23Z - v24Z * v23Y; + n243Y = v24Z * v23X - v24X * v23Z; + n243Z = v24X * v23Y - v24Y * v23X; + let sign = v12X * n243X + v12Y * n243Y + v12Z * n243Z > 0 ? 1 : -1; + let mind = -1; + let minvX; + let minvY; + let minvZ; + let mini = 0; + minvX = 0; + minvY = 0; + minvZ = 0; + if((v1X * n123X + v1Y * n123Y + v1Z * n123Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; minvX1 = out.x; minvY1 = out.y; minvZ1 = out.z; } - } - if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - var b2; - if(t2 < 0) { - out.x = v1X4; - out.y = v1Y4; - out.z = v1Z4; - b2 = 1; - } else if(t2 > 1) { - out.x = v2X4; - out.y = v2Y4; - out.z = v2Z4; - b2 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - b2 = 3; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d1 < mind1) { - mini1 = b2 & 1 | (b2 & 2) << 1; - mind1 = d1; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + mini = b; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; minvX1 = out.x; minvY1 = out.y; minvZ1 = out.z; } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec3.x; + v1Y = vec3.y; + v1Z = vec3.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; + } else { + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 6) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } } - var b3; - if(mind1 > 0) { - out.x = minvX1; - out.y = minvY1; - out.z = minvZ1; - b3 = mini1; - } else { - var l = nX * nX + nY * nY + nZ * nZ; - if(l > 0) { - l = 1 / Math.sqrt(l); + if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; } - nX *= l; - nY *= l; - nZ *= l; - var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; - minvX1 = nX * l2; - minvY1 = nY * l2; - minvZ1 = nZ * l2; - out.x = minvX1; - out.y = minvY1; - out.z = minvZ1; - b3 = 7; - } - mini = b3; - mind = out.x * out.x + out.y * out.y + out.z * out.z; - minvX = out.x; - minvY = out.y; - minvZ = out.z; - } - if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { - var v1X5; - var v1Y5; - var v1Z5; - var v2X5; - var v2Y5; - var v2Z5; - var v3X2; - var v3Y2; - var v3Z2; - var v12X5; - var v12Y5; - var v12Z5; - var v23X2; - var v23Y2; - var v23Z2; - var v31X1; - var v31Y1; - var v31Z1; - v1X5 = vec1.x; - v1Y5 = vec1.y; - v1Z5 = vec1.z; - v2X5 = vec3.x; - v2Y5 = vec3.y; - v2Z5 = vec3.z; - v3X2 = vec4.x; - v3Y2 = vec4.y; - v3Z2 = vec4.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v23X2 = v3X2 - v2X5; - v23Y2 = v3Y2 - v2Y5; - v23Z2 = v3Z2 - v2Z5; - v31X1 = v1X5 - v3X2; - v31Y1 = v1Y5 - v3Y2; - v31Z1 = v1Z5 - v3Z2; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y5 * v23Z2 - v12Z5 * v23Y2; - nY1 = v12Z5 * v23X2 - v12X5 * v23Z2; - nZ1 = v12X5 * v23Y2 - v12Y5 * v23X2; - var n12X1; - var n12Y1; - var n12Z1; - var n23X1; - var n23Y1; - var n23Z1; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y5 * nZ1 - v12Z5 * nY1; - n12Y1 = v12Z5 * nX1 - v12X5 * nZ1; - n12Z1 = v12X5 * nY1 - v12Y5 * nX1; - n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; - n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; - n23Z1 = v23X2 * nY1 - v23Y2 * nX1; - n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; - n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; - n31Z1 = v31X1 * nY1 - v31Y1 * nX1; - var mind2 = -1; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1 < 0) { - var v1X6; - var v1Y6; - var v1Z6; - var v2X6; - var v2Y6; - var v2Z6; - v1X6 = vec1.x; - v1Y6 = vec1.y; - v1Z6 = vec1.z; - v2X6 = vec3.x; - v2Y6 = vec3.y; - v2Z6 = vec3.z; - var v12X6; - var v12Y6; - var v12Z6; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; - t3 = -t3 / (v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6); - var b4; - if(t3 < 0) { - out.x = v1X6; - out.y = v1Y6; - out.z = v1Z6; - b4 = 1; - } else if(t3 > 1) { - out.x = v2X6; - out.y = v2Y6; - out.z = v2Z6; - b4 = 2; - } else { - var pX3; - var pY3; - var pZ3; - pX3 = v1X6 + v12X6 * t3; - pY3 = v1Y6 + v12Y6 * t3; - pZ3 = v1Z6 + v12Z6 * t3; - out.x = pX3; - out.y = pY3; - out.z = pZ3; - b4 = 3; - } - mini2 = b4; - mind2 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - if(v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1 < 0) { - var v1X7; - var v1Y7; - var v1Z7; - var v2X7; - var v2Y7; - var v2Z7; - v1X7 = vec3.x; - v1Y7 = vec3.y; - v1Z7 = vec3.z; - v2X7 = vec4.x; - v2Y7 = vec4.y; - v2Z7 = vec4.z; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); - var b5; - if(t4 < 0) { - out.x = v1X7; - out.y = v1Y7; - out.z = v1Z7; - b5 = 1; - } else if(t4 > 1) { - out.x = v2X7; - out.y = v2Y7; - out.z = v2Z7; - b5 = 2; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - out.x = pX4; - out.y = pY4; - out.z = pZ4; - b5 = 3; - } - var d2 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d2 < mind2) { - mini2 = b5 << 1; - mind2 = d2; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - } - if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { - var v1X8; - var v1Y8; - var v1Z8; - var v2X8; - var v2Y8; - var v2Z8; - v1X8 = vec1.x; - v1Y8 = vec1.y; - v1Z8 = vec1.z; - v2X8 = vec4.x; - v2Y8 = vec4.y; - v2Z8 = vec4.z; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); - var b6; - if(t5 < 0) { - out.x = v1X8; - out.y = v1Y8; - out.z = v1Z8; - b6 = 1; - } else if(t5 > 1) { - out.x = v2X8; - out.y = v2Y8; - out.z = v2Z8; - b6 = 2; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 3 | (b & 4) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + let v3X; + let v3Y; + let v3Z; + let v12X; + let v12Y; + let v12Z; + let v23X; + let v23Y; + let v23Z; + let v31X; + let v31Y; + let v31Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + let nX; + let nY; + let nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + let n12X; + let n12Y; + let n12Z; + let n23X; + let n23Y; + let n23Z; + let n31X; + let n31Y; + let n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + let mind1 = -1; + let minvX1; + let minvY1; + let minvZ1; + let mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec3.x; + v1Y = vec3.y; + v1Z = vec3.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + let v1X; + let v1Y; + let v1Z; + let v2X; + let v2Y; + let v2Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + let v12X; + let v12Y; + let v12Z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + let t = v12X * v1X + v12Y * v1Y + v12Z * v1Z; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + let b; + if(t < 0) { + out.x = v1X; + out.y = v1Y; + out.z = v1Z; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; + } else { + let pX; + let pY; + let pZ; + pX = v1X + v12X * t; + pY = v1Y + v12Y * t; + pZ = v1Z + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + let b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - out.x = pX5; - out.y = pY5; - out.z = pZ5; - b6 = 3; - } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d3 < mind2) { - mini2 = b6 & 1 | (b6 & 2) << 1; - mind2 = d3; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - } - var b7; - if(mind2 > 0) { - out.x = minvX2; - out.y = minvY2; - out.z = minvZ2; - b7 = mini2; - } else { - var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - nX1 *= l1; - nY1 *= l1; - nZ1 *= l1; - var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l21 = (v1X5 * nX1 + v1Y5 * nY1 + v1Z5 * nZ1) / l21; - minvX2 = nX1 * l21; - minvY2 = nY1 * l21; - minvZ2 = nZ1 * l21; - out.x = minvX2; - out.y = minvY2; - out.z = minvZ2; - b7 = 7; - } - var d4 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d4 < mind) { - mini = b7 & 1 | (b7 & 6) << 1; - mind = d4; - minvX = out.x; - minvY = out.y; - minvZ = out.z; + let l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + let l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + let d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if(mind > 0) { + out.x = minvX; + out.y = minvY; + out.z = minvZ; + return mini; } + out.zero(); + return 15; } - if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { - var v1X9; - var v1Y9; - var v1Z9; - var v2X9; - var v2Y9; - var v2Z9; - var v3X3; - var v3Y3; - var v3Z3; - var v12X9; - var v12Y9; - var v12Z9; - var v23X3; - var v23Y3; - var v23Z3; - var v31X2; - var v31Y2; - var v31Z2; - v1X9 = vec1.x; - v1Y9 = vec1.y; - v1Z9 = vec1.z; - v2X9 = vec2.x; - v2Y9 = vec2.y; - v2Z9 = vec2.z; - v3X3 = vec4.x; - v3Y3 = vec4.y; - v3Z3 = vec4.z; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - v23X3 = v3X3 - v2X9; - v23Y3 = v3Y3 - v2Y9; - v23Z3 = v3Z3 - v2Z9; - v31X2 = v1X9 - v3X3; - v31Y2 = v1Y9 - v3Y3; - v31Z2 = v1Z9 - v3Z3; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y9 * v23Z3 - v12Z9 * v23Y3; - nY2 = v12Z9 * v23X3 - v12X9 * v23Z3; - nZ2 = v12X9 * v23Y3 - v12Y9 * v23X3; - var n12X2; - var n12Y2; - var n12Z2; - var n23X2; - var n23Y2; - var n23Z2; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y9 * nZ2 - v12Z9 * nY2; - n12Y2 = v12Z9 * nX2 - v12X9 * nZ2; - n12Z2 = v12X9 * nY2 - v12Y9 * nX2; - n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; - n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; - n23Z2 = v23X3 * nY2 - v23Y3 * nX2; - n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; - n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; - n31Z2 = v31X2 * nY2 - v31Y2 * nX2; - var mind3 = -1; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2 < 0) { - var v1X10; - var v1Y10; - var v1Z10; - var v2X10; - var v2Y10; - var v2Z10; - v1X10 = vec1.x; - v1Y10 = vec1.y; - v1Z10 = vec1.z; - v2X10 = vec2.x; - v2Y10 = vec2.y; - v2Z10 = vec2.z; - var v12X10; - var v12Y10; - var v12Z10; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; - t6 = -t6 / (v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10); - var b8; - if(t6 < 0) { - out.x = v1X10; - out.y = v1Y10; - out.z = v1Z10; - b8 = 1; - } else if(t6 > 1) { - out.x = v2X10; - out.y = v2Y10; - out.z = v2Z10; - b8 = 2; - } else { - var pX6; - var pY6; - var pZ6; - pX6 = v1X10 + v12X10 * t6; - pY6 = v1Y10 + v12Y10 * t6; - pZ6 = v1Z10 + v12Z10 * t6; - out.x = pX6; - out.y = pY6; - out.z = pZ6; - b8 = 3; - } - mini3 = b8; - mind3 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; - } - if(v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2 < 0) { - var v1X11; - var v1Y11; - var v1Z11; - var v2X11; - var v2Y11; - var v2Z11; - v1X11 = vec2.x; - v1Y11 = vec2.y; - v1Z11 = vec2.z; - v2X11 = vec4.x; - v2Y11 = vec4.y; - v2Z11 = vec4.z; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); - var b9; - if(t7 < 0) { - out.x = v1X11; - out.y = v1Y11; - out.z = v1Z11; - b9 = 1; - } else if(t7 > 1) { - out.x = v2X11; - out.y = v2Y11; - out.z = v2Z11; - b9 = 2; - } else { - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - out.x = pX7; - out.y = pY7; - out.z = pZ7; - b9 = 3; - } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d5 < mind3) { - mini3 = b9 << 1; - mind3 = d5; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; - } - } - if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { - var v1X12; - var v1Y12; - var v1Z12; - var v2X12; - var v2Y12; - var v2Z12; - v1X12 = vec1.x; - v1Y12 = vec1.y; - v1Z12 = vec1.z; - v2X12 = vec4.x; - v2Y12 = vec4.y; - v2Z12 = vec4.z; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); - var b10; - if(t8 < 0) { - out.x = v1X12; - out.y = v1Y12; - out.z = v1Z12; - b10 = 1; - } else if(t8 > 1) { - out.x = v2X12; - out.y = v2Y12; - out.z = v2Z12; - b10 = 2; - } else { - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - out.x = pX8; - out.y = pY8; - out.z = pZ8; - b10 = 3; - } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d6 < mind3) { - mini3 = b10 & 1 | (b10 & 2) << 1; - mind3 = d6; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; - } - } - var b11; - if(mind3 > 0) { - out.x = minvX3; - out.y = minvY3; - out.z = minvZ3; - b11 = mini3; - } else { - var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - nX2 *= l3; - nY2 *= l3; - nZ2 *= l3; - var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l22 = (v1X9 * nX2 + v1Y9 * nY2 + v1Z9 * nZ2) / l22; - minvX3 = nX2 * l22; - minvY3 = nY2 * l22; - minvZ3 = nZ2 * l22; - out.x = minvX3; - out.y = minvY3; - out.z = minvZ3; - b11 = 7; - } - var d7 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d7 < mind) { - mini = b11 & 3 | (b11 & 4) << 1; - mind = d7; - minvX = out.x; - minvY = out.y; - minvZ = out.z; +} +class oimo_common_Mat3 { + constructor(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; } - } - if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { - var v1X13; - var v1Y13; - var v1Z13; - var v2X13; - var v2Y13; - var v2Z13; - var v3X4; - var v3Y4; - var v3Z4; - var v12X13; - var v12Y13; - var v12Z13; - var v23X4; - var v23Y4; - var v23Z4; - var v31X3; - var v31Y3; - var v31Z3; - v1X13 = vec2.x; - v1Y13 = vec2.y; - v1Z13 = vec2.z; - v2X13 = vec3.x; - v2Y13 = vec3.y; - v2Z13 = vec3.z; - v3X4 = vec4.x; - v3Y4 = vec4.y; - v3Z4 = vec4.z; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - v23X4 = v3X4 - v2X13; - v23Y4 = v3Y4 - v2Y13; - v23Z4 = v3Z4 - v2Z13; - v31X3 = v1X13 - v3X4; - v31Y3 = v1Y13 - v3Y4; - v31Z3 = v1Z13 - v3Z4; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y13 * v23Z4 - v12Z13 * v23Y4; - nY3 = v12Z13 * v23X4 - v12X13 * v23Z4; - nZ3 = v12X13 * v23Y4 - v12Y13 * v23X4; - var n12X3; - var n12Y3; - var n12Z3; - var n23X3; - var n23Y3; - var n23Z3; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y13 * nZ3 - v12Z13 * nY3; - n12Y3 = v12Z13 * nX3 - v12X13 * nZ3; - n12Z3 = v12X13 * nY3 - v12Y13 * nX3; - n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; - n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; - n23Z3 = v23X4 * nY3 - v23Y4 * nX3; - n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; - n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; - n31Z3 = v31X3 * nY3 - v31Y3 * nX3; - var mind4 = -1; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3 < 0) { - var v1X14; - var v1Y14; - var v1Z14; - var v2X14; - var v2Y14; - var v2Z14; - v1X14 = vec2.x; - v1Y14 = vec2.y; - v1Z14 = vec2.z; - v2X14 = vec3.x; - v2Y14 = vec3.y; - v2Z14 = vec3.z; - var v12X14; - var v12Y14; - var v12Z14; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; - t9 = -t9 / (v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14); - var b12; - if(t9 < 0) { - out.x = v1X14; - out.y = v1Y14; - out.z = v1Z14; - b12 = 1; - } else if(t9 > 1) { - out.x = v2X14; - out.y = v2Y14; - out.z = v2Z14; - b12 = 2; - } else { - var pX9; - var pY9; - var pZ9; - pX9 = v1X14 + v12X14 * t9; - pY9 = v1Y14 + v12Y14 * t9; - pZ9 = v1Z14 + v12Z14 * t9; - out.x = pX9; - out.y = pY9; - out.z = pZ9; - b12 = 3; - } - mini4 = b12; - mind4 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - if(v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3 < 0) { - var v1X15; - var v1Y15; - var v1Z15; - var v2X15; - var v2Y15; - var v2Z15; - v1X15 = vec3.x; - v1Y15 = vec3.y; - v1Z15 = vec3.z; - v2X15 = vec4.x; - v2Y15 = vec4.y; - v2Z15 = vec4.z; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); - var b13; - if(t10 < 0) { - out.x = v1X15; - out.y = v1Y15; - out.z = v1Z15; - b13 = 1; - } else if(t10 > 1) { - out.x = v2X15; - out.y = v2Y15; - out.z = v2Z15; - b13 = 2; - } else { - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - out.x = pX10; - out.y = pY10; - out.z = pZ10; - b13 = 3; - } - var d8 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d8 < mind4) { - mini4 = b13 << 1; - mind4 = d8; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - } - if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { - var v1X16; - var v1Y16; - var v1Z16; - var v2X16; - var v2Y16; - var v2Z16; - v1X16 = vec2.x; - v1Y16 = vec2.y; - v1Z16 = vec2.z; - v2X16 = vec4.x; - v2Y16 = vec4.y; - v2Z16 = vec4.z; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); - var b14; - if(t11 < 0) { - out.x = v1X16; - out.y = v1Y16; - out.z = v1Z16; - b14 = 1; - } else if(t11 > 1) { - out.x = v2X16; - out.y = v2Y16; - out.z = v2Z16; - b14 = 2; - } else { - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - out.x = pX11; - out.y = pY11; - out.z = pZ11; - b14 = 3; - } - var d9 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d9 < mind4) { - mini4 = b14 & 1 | (b14 & 2) << 1; - mind4 = d9; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - } - var b15; - if(mind4 > 0) { - out.x = minvX4; - out.y = minvY4; - out.z = minvZ4; - b15 = mini4; - } else { - var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - nX3 *= l4; - nY3 *= l4; - nZ3 *= l4; - var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l23 = (v1X13 * nX3 + v1Y13 * nY3 + v1Z13 * nZ3) / l23; - minvX4 = nX3 * l23; - minvY4 = nY3 * l23; - minvZ4 = nZ3 * l23; - out.x = minvX4; - out.y = minvY4; - out.z = minvZ4; - b15 = 7; - } - var d10 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d10 < mind) { - mini = b15 << 1; - mind = d10; - minvX = out.x; - minvY = out.y; - minvZ = out.z; + if(e00 == null) { + e00 = 1; } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + oimo_common_Mat3.numCreations++; } - if(mind > 0) { - out.x = minvX; - out.y = minvY; - out.z = minvZ; - return mini; - } - out.zero(); - return 15; -}; -var oimo_common_Mat3 = function(e00,e01,e02,e10,e11,e12,e20,e21,e22) { - if(e22 == null) { - e22 = 1; - } - if(e21 == null) { - e21 = 0; - } - if(e20 == null) { - e20 = 0; - } - if(e12 == null) { - e12 = 0; - } - if(e11 == null) { - e11 = 1; - } - if(e10 == null) { - e10 = 0; - } - if(e02 == null) { - e02 = 0; - } - if(e01 == null) { - e01 = 0; - } - if(e00 == null) { - e00 = 1; - } - this.e00 = e00; - this.e01 = e01; - this.e02 = e02; - this.e10 = e10; - this.e11 = e11; - this.e12 = e12; - this.e20 = e20; - this.e21 = e21; - this.e22 = e22; - oimo_common_Mat3.numCreations++; -}; -oimo_common_Mat3.prototype = { - init: function(e00,e01,e02,e10,e11,e12,e20,e21,e22) { + init(e00,e01,e02,e10,e11,e12,e20,e21,e22) { this.e00 = e00; this.e01 = e01; this.e02 = e02; @@ -14010,7 +14072,7 @@ oimo_common_Mat3.prototype = { this.e22 = e22; return this; } - ,identity: function() { + identity() { this.e00 = 1; this.e01 = 0; this.e02 = 0; @@ -14022,19 +14084,19 @@ oimo_common_Mat3.prototype = { this.e22 = 1; return this; } - ,add: function(m) { + add(m) { return new oimo_common_Mat3(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22); } - ,sub: function(m) { + sub(m) { return new oimo_common_Mat3(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22); } - ,scale: function(s) { + scale(s) { return new oimo_common_Mat3(this.e00 * s,this.e01 * s,this.e02 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e20 * s,this.e21 * s,this.e22 * s); } - ,mul: function(m) { + mul(m) { return new oimo_common_Mat3(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22); } - ,addEq: function(m) { + addEq(m) { this.e00 += m.e00; this.e01 += m.e01; this.e02 += m.e02; @@ -14046,7 +14108,7 @@ oimo_common_Mat3.prototype = { this.e22 += m.e22; return this; } - ,subEq: function(m) { + subEq(m) { this.e00 -= m.e00; this.e01 -= m.e01; this.e02 -= m.e02; @@ -14058,7 +14120,7 @@ oimo_common_Mat3.prototype = { this.e22 -= m.e22; return this; } - ,scaleEq: function(s) { + scaleEq(s) { this.e00 *= s; this.e01 *= s; this.e02 *= s; @@ -14070,15 +14132,15 @@ oimo_common_Mat3.prototype = { this.e22 *= s; return this; } - ,mulEq: function(m) { - var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; - var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; - var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; - var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; - var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; - var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; - var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; - var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; + mulEq(m) { + let e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21; + let e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22; + let e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20; + let e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21; + let e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22; + let e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20; + let e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21; + let e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22; this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20; this.e01 = e01; this.e02 = e02; @@ -14090,43 +14152,43 @@ oimo_common_Mat3.prototype = { this.e22 = e22; return this; } - ,prependScale: function(sx,sy,sz) { + prependScale(sx,sy,sz) { return new oimo_common_Mat3(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz); } - ,appendScale: function(sx,sy,sz) { + appendScale(sx,sy,sz) { return new oimo_common_Mat3(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e20 * sx,this.e21 * sy,this.e22 * sz); } - ,prependRotation: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + prependRotation(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo_common_Mat3(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22); } - ,appendRotation: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + appendRotation(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo_common_Mat3(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22); } - ,prependScaleEq: function(sx,sy,sz) { + prependScaleEq(sx,sy,sz) { this.e00 *= sx; this.e01 *= sx; this.e02 *= sx; @@ -14138,7 +14200,7 @@ oimo_common_Mat3.prototype = { this.e22 *= sz; return this; } - ,appendScaleEq: function(sx,sy,sz) { + appendScaleEq(sx,sy,sz) { this.e00 *= sx; this.e01 *= sy; this.e02 *= sz; @@ -14150,25 +14212,25 @@ oimo_common_Mat3.prototype = { this.e22 *= sz; return this; } - ,prependRotationEq: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + prependRotationEq(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + let e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + let e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + let e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + let e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + let e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; @@ -14180,25 +14242,25 @@ oimo_common_Mat3.prototype = { this.e22 = e22; return this; } - ,appendRotationEq: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + appendRotationEq(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + let e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + let e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + let e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + let e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + let e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; this.e01 = e01; this.e02 = e02; @@ -14210,13 +14272,13 @@ oimo_common_Mat3.prototype = { this.e22 = e22; return this; } - ,transpose: function() { + transpose() { return new oimo_common_Mat3(this.e00,this.e10,this.e20,this.e01,this.e11,this.e21,this.e02,this.e12,this.e22); } - ,transposeEq: function() { - var e10 = this.e01; - var e20 = this.e02; - var e21 = this.e12; + transposeEq() { + let e10 = this.e01; + let e20 = this.e02; + let e21 = this.e12; this.e00 = this.e00; this.e01 = this.e10; this.e02 = this.e20; @@ -14228,35 +14290,35 @@ oimo_common_Mat3.prototype = { this.e22 = this.e22; return this; } - ,determinant: function() { + determinant() { return this.e00 * (this.e11 * this.e22 - this.e12 * this.e21) - this.e01 * (this.e10 * this.e22 - this.e12 * this.e20) + this.e02 * (this.e10 * this.e21 - this.e11 * this.e20); } - ,trace: function() { + trace() { return this.e00 + this.e11 + this.e22; } - ,inverse: function() { - var d00 = this.e11 * this.e22 - this.e12 * this.e21; - var d01 = this.e10 * this.e22 - this.e12 * this.e20; - var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + inverse() { + let d00 = this.e11 * this.e22 - this.e12 * this.e21; + let d01 = this.e10 * this.e22 - this.e12 * this.e20; + let d02 = this.e10 * this.e21 - this.e11 * this.e20; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } return new oimo_common_Mat3(d00 * invDet,-(this.e01 * this.e22 - this.e02 * this.e21) * invDet,(this.e01 * this.e12 - this.e02 * this.e11) * invDet,-d01 * invDet,(this.e00 * this.e22 - this.e02 * this.e20) * invDet,-(this.e00 * this.e12 - this.e02 * this.e10) * invDet,d02 * invDet,-(this.e00 * this.e21 - this.e01 * this.e20) * invDet,(this.e00 * this.e11 - this.e01 * this.e10) * invDet); } - ,inverseEq: function() { - var d00 = this.e11 * this.e22 - this.e12 * this.e21; - var d01 = this.e10 * this.e22 - this.e12 * this.e20; - var d02 = this.e10 * this.e21 - this.e11 * this.e20; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; + inverseEq() { + let d00 = this.e11 * this.e22 - this.e12 * this.e21; + let d01 = this.e10 * this.e22 - this.e12 * this.e20; + let d02 = this.e10 * this.e21 - this.e11 * this.e20; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02; if(invDet != 0) { invDet = 1 / invDet; } - var t02 = (this.e01 * this.e12 - this.e02 * this.e11) * invDet; - var t11 = (this.e00 * this.e22 - this.e02 * this.e20) * invDet; - var t12 = -(this.e00 * this.e12 - this.e02 * this.e10) * invDet; - var t21 = -(this.e00 * this.e21 - this.e01 * this.e20) * invDet; - var t22 = (this.e00 * this.e11 - this.e01 * this.e10) * invDet; + let t02 = (this.e01 * this.e12 - this.e02 * this.e11) * invDet; + let t11 = (this.e00 * this.e22 - this.e02 * this.e20) * invDet; + let t12 = -(this.e00 * this.e12 - this.e02 * this.e10) * invDet; + let t21 = -(this.e00 * this.e21 - this.e01 * this.e20) * invDet; + let t22 = (this.e00 * this.e11 - this.e01 * this.e10) * invDet; this.e00 = d00 * invDet; this.e01 = -(this.e01 * this.e22 - this.e02 * this.e21) * invDet; this.e02 = t02; @@ -14268,7 +14330,7 @@ oimo_common_Mat3.prototype = { this.e22 = t22; return this; } - ,toArray: function(columnMajor) { + toArray(columnMajor) { if(columnMajor == null) { columnMajor = false; } @@ -14278,7 +14340,7 @@ oimo_common_Mat3.prototype = { return [this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22]; } } - ,copyFrom: function(m) { + copyFrom(m) { this.e00 = m.e00; this.e01 = m.e01; this.e02 = m.e02; @@ -14290,26 +14352,26 @@ oimo_common_Mat3.prototype = { this.e22 = m.e22; return this; } - ,clone: function() { + clone() { return new oimo_common_Mat3(this.e00,this.e01,this.e02,this.e10,this.e11,this.e12,this.e20,this.e21,this.e22); } - ,fromQuat: function(q) { - var x = q.x; - var y = q.y; - var z = q.z; - var w = q.w; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + fromQuat(q) { + let x = q.x; + let y = q.y; + let z = q.z; + let w = q.w; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this.e00 = 1 - yy - zz; this.e01 = xy - wz; this.e02 = xz + wy; @@ -14321,13 +14383,13 @@ oimo_common_Mat3.prototype = { this.e22 = 1 - xx - yy; return this; } - ,toQuat: function() { - var _this = new oimo_common_Quat(); - var e00 = this.e00; - var e11 = this.e11; - var e22 = this.e22; - var t = e00 + e11 + e22; - var s; + toQuat() { + let _this = new oimo_common_Quat(); + let e00 = this.e00; + let e11 = this.e11; + let e22 = this.e22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); _this.w = 0.5 * s; @@ -14368,13 +14430,13 @@ oimo_common_Mat3.prototype = { } return _this; } - ,fromEulerXyz: function(eulerAngles) { - var sx = Math.sin(eulerAngles.x); - var sy = Math.sin(eulerAngles.y); - var sz = Math.sin(eulerAngles.z); - var cx = Math.cos(eulerAngles.x); - var cy = Math.cos(eulerAngles.y); - var cz = Math.cos(eulerAngles.z); + fromEulerXyz(eulerAngles) { + let sx = Math.sin(eulerAngles.x); + let sy = Math.sin(eulerAngles.y); + let sz = Math.sin(eulerAngles.z); + let cx = Math.cos(eulerAngles.x); + let cy = Math.cos(eulerAngles.y); + let cz = Math.cos(eulerAngles.z); this.e00 = cy * cz; this.e01 = -cy * sz; this.e02 = sy; @@ -14386,19 +14448,19 @@ oimo_common_Mat3.prototype = { this.e22 = cx * cy; return this; } - ,toEulerXyz: function() { - var sy = this.e02; + toEulerXyz() { + let sy = this.e02; if(sy <= -1) { - var xSubZ = Math.atan2(this.e21,this.e11); + let xSubZ = Math.atan2(this.e21,this.e11); return new oimo_common_Vec3(xSubZ * 0.5,-1.570796326794895,-xSubZ * 0.5); } if(sy >= 1) { - var xAddZ = Math.atan2(this.e21,this.e11); + let xAddZ = Math.atan2(this.e21,this.e11); return new oimo_common_Vec3(xAddZ * 0.5,1.570796326794895,xAddZ * 0.5); } return new oimo_common_Vec3(Math.atan2(-this.e12,this.e22),Math.asin(sy),Math.atan2(-this.e01,this.e00)); } - ,getRow: function(index) { + getRow(index) { if(index == 0) { return new oimo_common_Vec3(this.e00,this.e01,this.e02); } else if(index == 1) { @@ -14409,7 +14471,7 @@ oimo_common_Mat3.prototype = { return null; } } - ,getCol: function(index) { + getCol(index) { if(index == 0) { return new oimo_common_Vec3(this.e00,this.e10,this.e20); } else if(index == 1) { @@ -14420,7 +14482,7 @@ oimo_common_Mat3.prototype = { return null; } } - ,getRowTo: function(index,dst) { + getRowTo(index,dst) { if(index == 0) { dst.init(this.e00,this.e01,this.e02); } else if(index == 1) { @@ -14431,7 +14493,7 @@ oimo_common_Mat3.prototype = { dst.zero(); } } - ,getColTo: function(index,dst) { + getColTo(index,dst) { if(index == 0) { dst.init(this.e00,this.e10,this.e20); } else if(index == 1) { @@ -14442,7 +14504,7 @@ oimo_common_Mat3.prototype = { dst.zero(); } } - ,fromRows: function(row0,row1,row2) { + fromRows(row0,row1,row2) { this.e00 = row0.x; this.e01 = row0.y; this.e02 = row0.z; @@ -14454,7 +14516,7 @@ oimo_common_Mat3.prototype = { this.e22 = row2.z; return this; } - ,fromCols: function(col0,col1,col2) { + fromCols(col0,col1,col2) { this.e00 = col0.x; this.e01 = col1.x; this.e02 = col2.x; @@ -14466,79 +14528,79 @@ oimo_common_Mat3.prototype = { this.e22 = col2.z; return this; } - ,toString: function() { + toString() { return "Mat3[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + "]"; } -}; -var oimo_common_Mat4 = function(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { - if(e33 == null) { - e33 = 1; - } - if(e32 == null) { - e32 = 0; - } - if(e31 == null) { - e31 = 0; - } - if(e30 == null) { - e30 = 0; - } - if(e23 == null) { - e23 = 0; - } - if(e22 == null) { - e22 = 1; - } - if(e21 == null) { - e21 = 0; - } - if(e20 == null) { - e20 = 0; - } - if(e13 == null) { - e13 = 0; - } - if(e12 == null) { - e12 = 0; - } - if(e11 == null) { - e11 = 1; - } - if(e10 == null) { - e10 = 0; - } - if(e03 == null) { - e03 = 0; - } - if(e02 == null) { - e02 = 0; - } - if(e01 == null) { - e01 = 0; - } - if(e00 == null) { - e00 = 1; +} +class oimo_common_Mat4 { + constructor(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + if(e33 == null) { + e33 = 1; + } + if(e32 == null) { + e32 = 0; + } + if(e31 == null) { + e31 = 0; + } + if(e30 == null) { + e30 = 0; + } + if(e23 == null) { + e23 = 0; + } + if(e22 == null) { + e22 = 1; + } + if(e21 == null) { + e21 = 0; + } + if(e20 == null) { + e20 = 0; + } + if(e13 == null) { + e13 = 0; + } + if(e12 == null) { + e12 = 0; + } + if(e11 == null) { + e11 = 1; + } + if(e10 == null) { + e10 = 0; + } + if(e03 == null) { + e03 = 0; + } + if(e02 == null) { + e02 = 0; + } + if(e01 == null) { + e01 = 0; + } + if(e00 == null) { + e00 = 1; + } + this.e00 = e00; + this.e01 = e01; + this.e02 = e02; + this.e03 = e03; + this.e10 = e10; + this.e11 = e11; + this.e12 = e12; + this.e13 = e13; + this.e20 = e20; + this.e21 = e21; + this.e22 = e22; + this.e23 = e23; + this.e30 = e30; + this.e31 = e31; + this.e32 = e32; + this.e33 = e33; + oimo_common_Mat4.numCreations++; } - this.e00 = e00; - this.e01 = e01; - this.e02 = e02; - this.e03 = e03; - this.e10 = e10; - this.e11 = e11; - this.e12 = e12; - this.e13 = e13; - this.e20 = e20; - this.e21 = e21; - this.e22 = e22; - this.e23 = e23; - this.e30 = e30; - this.e31 = e31; - this.e32 = e32; - this.e33 = e33; - oimo_common_Mat4.numCreations++; -}; -oimo_common_Mat4.prototype = { - init: function(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { + init(e00,e01,e02,e03,e10,e11,e12,e13,e20,e21,e22,e23,e30,e31,e32,e33) { this.e00 = e00; this.e01 = e01; this.e02 = e02; @@ -14557,7 +14619,7 @@ oimo_common_Mat4.prototype = { this.e33 = e33; return this; } - ,identity: function() { + identity() { this.e00 = 1; this.e01 = 0; this.e02 = 0; @@ -14576,19 +14638,19 @@ oimo_common_Mat4.prototype = { this.e33 = 1; return this; } - ,add: function(m) { + add(m) { return new oimo_common_Mat4(this.e00 + m.e00,this.e01 + m.e01,this.e02 + m.e02,this.e03 + m.e03,this.e10 + m.e10,this.e11 + m.e11,this.e12 + m.e12,this.e13 + m.e13,this.e20 + m.e20,this.e21 + m.e21,this.e22 + m.e22,this.e23 + m.e23,this.e30 + m.e30,this.e31 + m.e31,this.e32 + m.e32,this.e33 + m.e33); } - ,sub: function(m) { + sub(m) { return new oimo_common_Mat4(this.e00 - m.e00,this.e01 - m.e01,this.e02 - m.e02,this.e03 - m.e03,this.e10 - m.e10,this.e11 - m.e11,this.e12 - m.e12,this.e13 - m.e13,this.e20 - m.e20,this.e21 - m.e21,this.e22 - m.e22,this.e23 - m.e23,this.e30 - m.e30,this.e31 - m.e31,this.e32 - m.e32,this.e33 - m.e33); } - ,scale: function(s) { + scale(s) { return new oimo_common_Mat4(this.e00 * s,this.e01 * s,this.e02 * s,this.e03 * s,this.e10 * s,this.e11 * s,this.e12 * s,this.e13 * s,this.e20 * s,this.e21 * s,this.e22 * s,this.e23 * s,this.e30 * s,this.e31 * s,this.e32 * s,this.e33 * s); } - ,mul: function(m) { + mul(m) { return new oimo_common_Mat4(this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30,this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31,this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32,this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33,this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30,this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31,this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32,this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33,this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30,this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31,this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32,this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33,this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30,this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31,this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32,this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33); } - ,addEq: function(m) { + addEq(m) { this.e00 += m.e00; this.e01 += m.e01; this.e02 += m.e02; @@ -14607,7 +14669,7 @@ oimo_common_Mat4.prototype = { this.e33 += m.e33; return this; } - ,subEq: function(m) { + subEq(m) { this.e00 -= m.e00; this.e01 -= m.e01; this.e02 -= m.e02; @@ -14626,7 +14688,7 @@ oimo_common_Mat4.prototype = { this.e33 -= m.e33; return this; } - ,scaleEq: function(s) { + scaleEq(s) { this.e00 *= s; this.e01 *= s; this.e02 *= s; @@ -14645,22 +14707,22 @@ oimo_common_Mat4.prototype = { this.e33 *= s; return this; } - ,mulEq: function(m) { - var e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; - var e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; - var e03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; - var e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; - var e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; - var e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; - var e13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; - var e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; - var e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; - var e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; - var e23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; - var e30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; - var e31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; - var e32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; - var e33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; + mulEq(m) { + let e01 = this.e00 * m.e01 + this.e01 * m.e11 + this.e02 * m.e21 + this.e03 * m.e31; + let e02 = this.e00 * m.e02 + this.e01 * m.e12 + this.e02 * m.e22 + this.e03 * m.e32; + let e03 = this.e00 * m.e03 + this.e01 * m.e13 + this.e02 * m.e23 + this.e03 * m.e33; + let e10 = this.e10 * m.e00 + this.e11 * m.e10 + this.e12 * m.e20 + this.e13 * m.e30; + let e11 = this.e10 * m.e01 + this.e11 * m.e11 + this.e12 * m.e21 + this.e13 * m.e31; + let e12 = this.e10 * m.e02 + this.e11 * m.e12 + this.e12 * m.e22 + this.e13 * m.e32; + let e13 = this.e10 * m.e03 + this.e11 * m.e13 + this.e12 * m.e23 + this.e13 * m.e33; + let e20 = this.e20 * m.e00 + this.e21 * m.e10 + this.e22 * m.e20 + this.e23 * m.e30; + let e21 = this.e20 * m.e01 + this.e21 * m.e11 + this.e22 * m.e21 + this.e23 * m.e31; + let e22 = this.e20 * m.e02 + this.e21 * m.e12 + this.e22 * m.e22 + this.e23 * m.e32; + let e23 = this.e20 * m.e03 + this.e21 * m.e13 + this.e22 * m.e23 + this.e23 * m.e33; + let e30 = this.e30 * m.e00 + this.e31 * m.e10 + this.e32 * m.e20 + this.e33 * m.e30; + let e31 = this.e30 * m.e01 + this.e31 * m.e11 + this.e32 * m.e21 + this.e33 * m.e31; + let e32 = this.e30 * m.e02 + this.e31 * m.e12 + this.e32 * m.e22 + this.e33 * m.e32; + let e33 = this.e30 * m.e03 + this.e31 * m.e13 + this.e32 * m.e23 + this.e33 * m.e33; this.e00 = this.e00 * m.e00 + this.e01 * m.e10 + this.e02 * m.e20 + this.e03 * m.e30; this.e01 = e01; this.e02 = e02; @@ -14679,49 +14741,49 @@ oimo_common_Mat4.prototype = { this.e33 = e33; return this; } - ,prependScale: function(sx,sy,sz) { + prependScale(sx,sy,sz) { return new oimo_common_Mat4(this.e00 * sx,this.e01 * sx,this.e02 * sx,this.e03 * sx,this.e10 * sy,this.e11 * sy,this.e12 * sy,this.e13 * sy,this.e20 * sz,this.e21 * sz,this.e22 * sz,this.e23 * sz,this.e30,this.e31,this.e32,this.e33); } - ,appendScale: function(sx,sy,sz) { + appendScale(sx,sy,sz) { return new oimo_common_Mat4(this.e00 * sx,this.e01 * sy,this.e02 * sz,this.e03,this.e10 * sx,this.e11 * sy,this.e12 * sz,this.e13,this.e20 * sx,this.e21 * sy,this.e22 * sz,this.e23,this.e30 * sx,this.e31 * sy,this.e32 * sz,this.e33); } - ,prependRotation: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + prependRotation(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo_common_Mat4(r00 * this.e00 + r01 * this.e10 + r02 * this.e20,r00 * this.e01 + r01 * this.e11 + r02 * this.e21,r00 * this.e02 + r01 * this.e12 + r02 * this.e22,r00 * this.e03 + r01 * this.e13 + r02 * this.e23,r10 * this.e00 + r11 * this.e10 + r12 * this.e20,r10 * this.e01 + r11 * this.e11 + r12 * this.e21,r10 * this.e02 + r11 * this.e12 + r12 * this.e22,r10 * this.e03 + r11 * this.e13 + r12 * this.e23,r20 * this.e00 + r21 * this.e10 + r22 * this.e20,r20 * this.e01 + r21 * this.e11 + r22 * this.e21,r20 * this.e02 + r21 * this.e12 + r22 * this.e22,r20 * this.e03 + r21 * this.e13 + r22 * this.e23,this.e30,this.e31,this.e32,this.e33); } - ,appendRotation: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; + appendRotation(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; return new oimo_common_Mat4(this.e00 * r00 + this.e01 * r10 + this.e02 * r20,this.e00 * r01 + this.e01 * r11 + this.e02 * r21,this.e00 * r02 + this.e01 * r12 + this.e02 * r22,this.e03,this.e10 * r00 + this.e11 * r10 + this.e12 * r20,this.e10 * r01 + this.e11 * r11 + this.e12 * r21,this.e10 * r02 + this.e11 * r12 + this.e12 * r22,this.e13,this.e20 * r00 + this.e21 * r10 + this.e22 * r20,this.e20 * r01 + this.e21 * r11 + this.e22 * r21,this.e20 * r02 + this.e21 * r12 + this.e22 * r22,this.e23,this.e30 * r00 + this.e31 * r10 + this.e32 * r20,this.e30 * r01 + this.e31 * r11 + this.e32 * r21,this.e30 * r02 + this.e31 * r12 + this.e32 * r22,this.e33); } - ,prependTranslation: function(tx,ty,tz) { + prependTranslation(tx,ty,tz) { return new oimo_common_Mat4(this.e00 + tx * this.e30,this.e01 + tx * this.e31,this.e02 + tx * this.e32,this.e03 + tx * this.e33,this.e10 + ty * this.e30,this.e11 + ty * this.e31,this.e12 + ty * this.e32,this.e13 + ty * this.e33,this.e20 + tz * this.e30,this.e21 + tz * this.e31,this.e22 + tz * this.e32,this.e23 + tz * this.e33,this.e30,this.e31,this.e32,this.e33); } - ,appendTranslation: function(tx,ty,tz) { + appendTranslation(tx,ty,tz) { return new oimo_common_Mat4(this.e00,this.e01,this.e02,this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03,this.e10,this.e11,this.e12,this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13,this.e20,this.e21,this.e22,this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23,this.e30,this.e31,this.e32,this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33); } - ,prependScaleEq: function(sx,sy,sz) { + prependScaleEq(sx,sy,sz) { this.e00 *= sx; this.e01 *= sx; this.e02 *= sx; @@ -14740,7 +14802,7 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,appendScaleEq: function(sx,sy,sz) { + appendScaleEq(sx,sy,sz) { this.e00 *= sx; this.e01 *= sy; this.e02 *= sz; @@ -14759,27 +14821,27 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,prependRotationEq: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; - var e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; - var e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; - var e13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; - var e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; - var e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; - var e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; - var e23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; + prependRotationEq(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e10 = r10 * this.e00 + r11 * this.e10 + r12 * this.e20; + let e11 = r10 * this.e01 + r11 * this.e11 + r12 * this.e21; + let e12 = r10 * this.e02 + r11 * this.e12 + r12 * this.e22; + let e13 = r10 * this.e03 + r11 * this.e13 + r12 * this.e23; + let e20 = r20 * this.e00 + r21 * this.e10 + r22 * this.e20; + let e21 = r20 * this.e01 + r21 * this.e11 + r22 * this.e21; + let e22 = r20 * this.e02 + r21 * this.e12 + r22 * this.e22; + let e23 = r20 * this.e03 + r21 * this.e13 + r22 * this.e23; this.e00 = r00 * this.e00 + r01 * this.e10 + r02 * this.e20; this.e01 = r00 * this.e01 + r01 * this.e11 + r02 * this.e21; this.e02 = r00 * this.e02 + r01 * this.e12 + r02 * this.e22; @@ -14798,27 +14860,27 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,appendRotationEq: function(rad,axisX,axisY,axisZ) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var c1 = 1 - c; - var r00 = axisX * axisX * c1 + c; - var r01 = axisX * axisY * c1 - axisZ * s; - var r02 = axisX * axisZ * c1 + axisY * s; - var r10 = axisY * axisX * c1 + axisZ * s; - var r11 = axisY * axisY * c1 + c; - var r12 = axisY * axisZ * c1 - axisX * s; - var r20 = axisZ * axisX * c1 - axisY * s; - var r21 = axisZ * axisY * c1 + axisX * s; - var r22 = axisZ * axisZ * c1 + c; - var e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; - var e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; - var e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; - var e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; - var e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; - var e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; - var e31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; - var e32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; + appendRotationEq(rad,axisX,axisY,axisZ) { + let s = Math.sin(rad); + let c = Math.cos(rad); + let c1 = 1 - c; + let r00 = axisX * axisX * c1 + c; + let r01 = axisX * axisY * c1 - axisZ * s; + let r02 = axisX * axisZ * c1 + axisY * s; + let r10 = axisY * axisX * c1 + axisZ * s; + let r11 = axisY * axisY * c1 + c; + let r12 = axisY * axisZ * c1 - axisX * s; + let r20 = axisZ * axisX * c1 - axisY * s; + let r21 = axisZ * axisY * c1 + axisX * s; + let r22 = axisZ * axisZ * c1 + c; + let e01 = this.e00 * r01 + this.e01 * r11 + this.e02 * r21; + let e02 = this.e00 * r02 + this.e01 * r12 + this.e02 * r22; + let e11 = this.e10 * r01 + this.e11 * r11 + this.e12 * r21; + let e12 = this.e10 * r02 + this.e11 * r12 + this.e12 * r22; + let e21 = this.e20 * r01 + this.e21 * r11 + this.e22 * r21; + let e22 = this.e20 * r02 + this.e21 * r12 + this.e22 * r22; + let e31 = this.e30 * r01 + this.e31 * r11 + this.e32 * r21; + let e32 = this.e30 * r02 + this.e31 * r12 + this.e32 * r22; this.e00 = this.e00 * r00 + this.e01 * r10 + this.e02 * r20; this.e01 = e01; this.e02 = e02; @@ -14837,7 +14899,7 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,prependTranslationEq: function(tx,ty,tz) { + prependTranslationEq(tx,ty,tz) { this.e00 += tx * this.e30; this.e01 += tx * this.e31; this.e02 += tx * this.e32; @@ -14856,11 +14918,11 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,appendTranslationEq: function(tx,ty,tz) { - var e03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; - var e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; - var e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; - var e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; + appendTranslationEq(tx,ty,tz) { + let e03 = this.e00 * tx + this.e01 * ty + this.e02 * tz + this.e03; + let e13 = this.e10 * tx + this.e11 * ty + this.e12 * tz + this.e13; + let e23 = this.e20 * tx + this.e21 * ty + this.e22 * tz + this.e23; + let e33 = this.e30 * tx + this.e31 * ty + this.e32 * tz + this.e33; this.e00 = this.e00; this.e01 = this.e01; this.e02 = this.e02; @@ -14879,16 +14941,16 @@ oimo_common_Mat4.prototype = { this.e33 = e33; return this; } - ,transpose: function() { + transpose() { return new oimo_common_Mat4(this.e00,this.e10,this.e20,this.e30,this.e01,this.e11,this.e21,this.e31,this.e02,this.e12,this.e22,this.e32,this.e03,this.e13,this.e23,this.e33); } - ,transposeEq: function() { - var e10 = this.e01; - var e20 = this.e02; - var e21 = this.e12; - var e30 = this.e03; - var e31 = this.e13; - var e32 = this.e23; + transposeEq() { + let e10 = this.e01; + let e20 = this.e02; + let e21 = this.e12; + let e30 = this.e03; + let e31 = this.e13; + let e32 = this.e23; this.e00 = this.e00; this.e01 = this.e10; this.e02 = this.e20; @@ -14907,68 +14969,68 @@ oimo_common_Mat4.prototype = { this.e33 = this.e33; return this; } - ,determinant: function() { - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + determinant() { + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; return this.e00 * (this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12) - this.e01 * (this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02) + this.e02 * (this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01) - this.e03 * (this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01); } - ,trace: function() { + trace() { return this.e00 + this.e11 + this.e22 + this.e33; } - ,inverse: function() { - var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; - var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; - var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; - var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; - var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; - var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; - var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; - var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; - var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; - var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + inverse() { + let d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + let d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + let d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + let d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + let d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + let d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + let d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + let d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + let d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + let d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } return new oimo_common_Mat4(d00 * invDet,-(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet,(this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet,-(this.e21 * d01_23 - this.e22 * d01_13 + this.e23 * d01_12) * invDet,-d01 * invDet,(this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet,-(this.e30 * d01_23 - this.e32 * d01_03 + this.e33 * d01_02) * invDet,(this.e20 * d01_23 - this.e22 * d01_03 + this.e23 * d01_02) * invDet,d02 * invDet,-(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet,(this.e30 * d01_13 - this.e31 * d01_03 + this.e33 * d01_01) * invDet,-(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet,-d03 * invDet,(this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet,-(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet,(this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet); } - ,inverseEq: function() { - var d01_01 = this.e00 * this.e11 - this.e01 * this.e10; - var d01_02 = this.e00 * this.e12 - this.e02 * this.e10; - var d01_03 = this.e00 * this.e13 - this.e03 * this.e10; - var d01_12 = this.e01 * this.e12 - this.e02 * this.e11; - var d01_13 = this.e01 * this.e13 - this.e03 * this.e11; - var d01_23 = this.e02 * this.e13 - this.e03 * this.e12; - var d23_01 = this.e20 * this.e31 - this.e21 * this.e30; - var d23_02 = this.e20 * this.e32 - this.e22 * this.e30; - var d23_03 = this.e20 * this.e33 - this.e23 * this.e30; - var d23_12 = this.e21 * this.e32 - this.e22 * this.e31; - var d23_13 = this.e21 * this.e33 - this.e23 * this.e31; - var d23_23 = this.e22 * this.e33 - this.e23 * this.e32; - var d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; - var d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; - var d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; - var d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; - var invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; + inverseEq() { + let d01_01 = this.e00 * this.e11 - this.e01 * this.e10; + let d01_02 = this.e00 * this.e12 - this.e02 * this.e10; + let d01_03 = this.e00 * this.e13 - this.e03 * this.e10; + let d01_12 = this.e01 * this.e12 - this.e02 * this.e11; + let d01_13 = this.e01 * this.e13 - this.e03 * this.e11; + let d01_23 = this.e02 * this.e13 - this.e03 * this.e12; + let d23_01 = this.e20 * this.e31 - this.e21 * this.e30; + let d23_02 = this.e20 * this.e32 - this.e22 * this.e30; + let d23_03 = this.e20 * this.e33 - this.e23 * this.e30; + let d23_12 = this.e21 * this.e32 - this.e22 * this.e31; + let d23_13 = this.e21 * this.e33 - this.e23 * this.e31; + let d23_23 = this.e22 * this.e33 - this.e23 * this.e32; + let d00 = this.e11 * d23_23 - this.e12 * d23_13 + this.e13 * d23_12; + let d01 = this.e10 * d23_23 - this.e12 * d23_03 + this.e13 * d23_02; + let d02 = this.e10 * d23_13 - this.e11 * d23_03 + this.e13 * d23_01; + let d03 = this.e10 * d23_12 - this.e11 * d23_02 + this.e12 * d23_01; + let invDet = this.e00 * d00 - this.e01 * d01 + this.e02 * d02 - this.e03 * d03; if(invDet != 0) { invDet = 1 / invDet; } - var t11 = (this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet; - var t21 = -(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet; - var t23 = -(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet; - var t31 = (this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet; - var t32 = -(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet; - var t33 = (this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet; + let t11 = (this.e00 * d23_23 - this.e02 * d23_03 + this.e03 * d23_02) * invDet; + let t21 = -(this.e00 * d23_13 - this.e01 * d23_03 + this.e03 * d23_01) * invDet; + let t23 = -(this.e20 * d01_13 - this.e21 * d01_03 + this.e23 * d01_01) * invDet; + let t31 = (this.e00 * d23_12 - this.e01 * d23_02 + this.e02 * d23_01) * invDet; + let t32 = -(this.e30 * d01_12 - this.e31 * d01_02 + this.e32 * d01_01) * invDet; + let t33 = (this.e20 * d01_12 - this.e21 * d01_02 + this.e22 * d01_01) * invDet; this.e00 = d00 * invDet; this.e01 = -(this.e01 * d23_23 - this.e02 * d23_13 + this.e03 * d23_12) * invDet; this.e02 = (this.e31 * d01_23 - this.e32 * d01_13 + this.e33 * d01_12) * invDet; @@ -14987,24 +15049,24 @@ oimo_common_Mat4.prototype = { this.e33 = t33; return this; } - ,lookAt: function(eyeX,eyeY,eyeZ,atX,atY,atZ,upX,upY,upZ) { - var zx = eyeX - atX; - var zy = eyeY - atY; - var zz = eyeZ - atZ; - var tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); + lookAt(eyeX,eyeY,eyeZ,atX,atY,atZ,upX,upY,upZ) { + let zx = eyeX - atX; + let zy = eyeY - atY; + let zz = eyeZ - atZ; + let tmp = 1 / Math.sqrt(zx * zx + zy * zy + zz * zz); zx *= tmp; zy *= tmp; zz *= tmp; - var xx = upY * zz - upZ * zy; - var xy = upZ * zx - upX * zz; - var xz = upX * zy - upY * zx; + let xx = upY * zz - upZ * zy; + let xy = upZ * zx - upX * zz; + let xz = upX * zy - upY * zx; tmp = 1 / Math.sqrt(xx * xx + xy * xy + xz * xz); xx *= tmp; xy *= tmp; xz *= tmp; - var yx = zy * xz - zz * xy; - var yy = zz * xx - zx * xz; - var yz = zx * xy - zy * xx; + let yx = zy * xz - zz * xy; + let yy = zz * xx - zx * xz; + let yz = zx * xy - zy * xx; this.e00 = xx; this.e01 = xy; this.e02 = xz; @@ -15023,9 +15085,9 @@ oimo_common_Mat4.prototype = { this.e33 = 1; return this; } - ,perspective: function(fovY,aspect,near,far) { - var h = 1 / Math.tan(fovY * 0.5); - var fnf = far / (near - far); + perspective(fovY,aspect,near,far) { + let h = 1 / Math.tan(fovY * 0.5); + let fnf = far / (near - far); this.e00 = h / aspect; this.e01 = 0; this.e02 = 0; @@ -15044,8 +15106,8 @@ oimo_common_Mat4.prototype = { this.e33 = 0; return this; } - ,ortho: function(width,height,near,far) { - var nf = 1 / (near - far); + ortho(width,height,near,far) { + let nf = 1 / (near - far); this.e00 = 2 / width; this.e01 = 0; this.e02 = 0; @@ -15064,7 +15126,7 @@ oimo_common_Mat4.prototype = { this.e33 = 1; return this; } - ,toArray: function(columnMajor) { + toArray(columnMajor) { if(columnMajor == null) { columnMajor = false; } @@ -15074,7 +15136,7 @@ oimo_common_Mat4.prototype = { return [this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33]; } } - ,copyFrom: function(m) { + copyFrom(m) { this.e00 = m.e00; this.e01 = m.e01; this.e02 = m.e02; @@ -15093,7 +15155,7 @@ oimo_common_Mat4.prototype = { this.e33 = m.e33; return this; } - ,fromMat3: function(m) { + fromMat3(m) { this.e00 = m.e00; this.e01 = m.e01; this.e02 = m.e02; @@ -15112,152 +15174,152 @@ oimo_common_Mat4.prototype = { this.e33 = 1; return this; } - ,fromTransform: function(transform) { - var m = this; - m.e00 = transform._rotation00; - m.e01 = transform._rotation01; - m.e02 = transform._rotation02; - m.e10 = transform._rotation10; - m.e11 = transform._rotation11; - m.e12 = transform._rotation12; - m.e20 = transform._rotation20; - m.e21 = transform._rotation21; - m.e22 = transform._rotation22; - m.e03 = transform._positionX; - m.e13 = transform._positionY; - m.e23 = transform._positionZ; - m.e30 = 0; - m.e31 = 0; - m.e32 = 0; - m.e33 = 1; + fromTransform(transform) { + this.e00 = transform._rotation00; + this.e01 = transform._rotation01; + this.e02 = transform._rotation02; + this.e10 = transform._rotation10; + this.e11 = transform._rotation11; + this.e12 = transform._rotation12; + this.e20 = transform._rotation20; + this.e21 = transform._rotation21; + this.e22 = transform._rotation22; + this.e03 = transform._positionX; + this.e13 = transform._positionY; + this.e23 = transform._positionZ; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } - ,clone: function() { + clone() { return new oimo_common_Mat4(this.e00,this.e01,this.e02,this.e03,this.e10,this.e11,this.e12,this.e13,this.e20,this.e21,this.e22,this.e23,this.e30,this.e31,this.e32,this.e33); } - ,toString: function() { + toString() { return "Mat4[" + (this.e00 > 0 ? (this.e00 * 10000000 + 0.5 | 0) / 10000000 : (this.e00 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e01 > 0 ? (this.e01 * 10000000 + 0.5 | 0) / 10000000 : (this.e01 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e02 > 0 ? (this.e02 * 10000000 + 0.5 | 0) / 10000000 : (this.e02 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e03 > 0 ? (this.e03 * 10000000 + 0.5 | 0) / 10000000 : (this.e03 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e10 > 0 ? (this.e10 * 10000000 + 0.5 | 0) / 10000000 : (this.e10 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e11 > 0 ? (this.e11 * 10000000 + 0.5 | 0) / 10000000 : (this.e11 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e12 > 0 ? (this.e12 * 10000000 + 0.5 | 0) / 10000000 : (this.e12 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e13 > 0 ? (this.e13 * 10000000 + 0.5 | 0) / 10000000 : (this.e13 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e20 > 0 ? (this.e20 * 10000000 + 0.5 | 0) / 10000000 : (this.e20 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e21 > 0 ? (this.e21 * 10000000 + 0.5 | 0) / 10000000 : (this.e21 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e22 > 0 ? (this.e22 * 10000000 + 0.5 | 0) / 10000000 : (this.e22 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e23 > 0 ? (this.e23 * 10000000 + 0.5 | 0) / 10000000 : (this.e23 * 10000000 - 0.5 | 0) / 10000000) + ",\n" + " " + (this.e30 > 0 ? (this.e30 * 10000000 + 0.5 | 0) / 10000000 : (this.e30 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e31 > 0 ? (this.e31 * 10000000 + 0.5 | 0) / 10000000 : (this.e31 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e32 > 0 ? (this.e32 * 10000000 + 0.5 | 0) / 10000000 : (this.e32 * 10000000 - 0.5 | 0) / 10000000) + ", " + (this.e33 > 0 ? (this.e33 * 10000000 + 0.5 | 0) / 10000000 : (this.e33 * 10000000 - 0.5 | 0) / 10000000) + "]"; } -}; -var oimo_common_MathUtil = function() { }; -oimo_common_MathUtil.abs = function(x) { - if(x > 0) { - return x; - } else { - return -x; - } -}; -oimo_common_MathUtil.sin = function(x) { - return Math.sin(x); -}; -oimo_common_MathUtil.cos = function(x) { - return Math.cos(x); -}; -oimo_common_MathUtil.tan = function(x) { - return Math.tan(x); -}; -oimo_common_MathUtil.asin = function(x) { - return Math.asin(x); -}; -oimo_common_MathUtil.acos = function(x) { - return Math.acos(x); -}; -oimo_common_MathUtil.atan = function(x) { - return Math.atan(x); -}; -oimo_common_MathUtil.safeAsin = function(x) { - if(x <= -1) { - return -1.570796326794895; - } - if(x >= 1) { - return 1.570796326794895; - } - return Math.asin(x); -}; -oimo_common_MathUtil.safeAcos = function(x) { - if(x <= -1) { - return 3.14159265358979; - } - if(x >= 1) { - return 0; - } - return Math.acos(x); -}; -oimo_common_MathUtil.atan2 = function(y,x) { - return Math.atan2(y,x); -}; -oimo_common_MathUtil.sqrt = function(x) { - return Math.sqrt(x); -}; -oimo_common_MathUtil.clamp = function(x,min,max) { - if(x < min) { - return min; - } else if(x > max) { - return max; - } else { - return x; - } -}; -oimo_common_MathUtil.rand = function() { - return Math.random(); -}; -oimo_common_MathUtil.randIn = function(min,max) { - return min + Math.random() * (max - min); -}; -oimo_common_MathUtil.randVec3In = function(min,max) { - return new oimo_common_Vec3(min + Math.random() * (max - min),min + Math.random() * (max - min),min + Math.random() * (max - min)); -}; -oimo_common_MathUtil.randVec3 = function() { - return new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); -}; -var oimo_common_Pool = function() { - this.stackVec3 = new Array(256); - this.sizeVec3 = 0; - this.stackMat3 = new Array(256); - this.sizeMat3 = 0; - this.stackMat4 = new Array(256); - this.sizeMat4 = 0; - this.stackQuat = new Array(256); - this.sizeQuat = 0; -}; -oimo_common_Pool.prototype = { - vec3: function() { +} +class oimo_common_MathUtil { + static abs(x) { + if(x > 0) { + return x; + } else { + return -x; + } + } + static sin(x) { + return Math.sin(x); + } + static cos(x) { + return Math.cos(x); + } + static tan(x) { + return Math.tan(x); + } + static asin(x) { + return Math.asin(x); + } + static acos(x) { + return Math.acos(x); + } + static atan(x) { + return Math.atan(x); + } + static safeAsin(x) { + if(x <= -1) { + return -1.570796326794895; + } + if(x >= 1) { + return 1.570796326794895; + } + return Math.asin(x); + } + static safeAcos(x) { + if(x <= -1) { + return 3.14159265358979; + } + if(x >= 1) { + return 0; + } + return Math.acos(x); + } + static atan2(y,x) { + return Math.atan2(y,x); + } + static sqrt(x) { + return Math.sqrt(x); + } + static clamp(x,min,max) { + if(x < min) { + return min; + } else if(x > max) { + return max; + } else { + return x; + } + } + static rand() { + return Math.random(); + } + static randIn(min,max) { + return min + Math.random() * (max - min); + } + static randVec3In(min,max) { + return new oimo_common_Vec3(min + Math.random() * (max - min),min + Math.random() * (max - min),min + Math.random() * (max - min)); + } + static randVec3() { + return new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + } +} +class oimo_common_Pool { + constructor() { + this.stackVec3 = new Array(256); + this.sizeVec3 = 0; + this.stackMat3 = new Array(256); + this.sizeMat3 = 0; + this.stackMat4 = new Array(256); + this.sizeMat4 = 0; + this.stackQuat = new Array(256); + this.sizeQuat = 0; + } + vec3() { if(this.sizeVec3 == 0) { return new oimo_common_Vec3(); } else { return this.stackVec3[--this.sizeVec3]; } } - ,mat3: function() { + mat3() { if(this.sizeMat3 == 0) { return new oimo_common_Mat3(); } else { return this.stackMat3[--this.sizeMat3]; } } - ,mat4: function() { + mat4() { if(this.sizeMat4 == 0) { return new oimo_common_Mat4(); } else { return this.stackMat4[--this.sizeMat4]; } } - ,quat: function() { + quat() { if(this.sizeQuat == 0) { return new oimo_common_Quat(); } else { return this.stackQuat[--this.sizeQuat]; } } - ,dispose: function(vec3,mat3,mat4,quat) { + dispose(vec3,mat3,mat4,quat) { if(vec3 != null) { vec3.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newArray = new Array(this.sizeVec3 << 1); - var _g = 0; - var _g1 = this.sizeVec3; + let newArray = new Array(this.sizeVec3 << 1); + let _g = 0; + let _g1 = this.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -15276,15 +15338,15 @@ oimo_common_Pool.prototype = { mat3.e21 = 0; mat3.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newArray1 = new Array(this.sizeMat3 << 1); - var _g2 = 0; - var _g11 = this.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.stackMat3[i1]; - this.stackMat3[i1] = null; + let newArray = new Array(this.sizeMat3 << 1); + let _g = 0; + let _g1 = this.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackMat3[i]; + this.stackMat3[i] = null; } - this.stackMat3 = newArray1; + this.stackMat3 = newArray; } this.stackMat3[this.sizeMat3++] = mat3; } @@ -15306,15 +15368,15 @@ oimo_common_Pool.prototype = { mat4.e32 = 0; mat4.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newArray2 = new Array(this.sizeMat4 << 1); - var _g3 = 0; - var _g12 = this.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.stackMat4[i2]; - this.stackMat4[i2] = null; + let newArray = new Array(this.sizeMat4 << 1); + let _g = 0; + let _g1 = this.sizeMat4; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackMat4[i]; + this.stackMat4[i] = null; } - this.stackMat4 = newArray2; + this.stackMat4 = newArray; } this.stackMat4[this.sizeMat4++] = mat4; } @@ -15324,27 +15386,27 @@ oimo_common_Pool.prototype = { quat.z = 0; quat.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newArray3 = new Array(this.sizeQuat << 1); - var _g4 = 0; - var _g13 = this.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = this.stackQuat[i3]; - this.stackQuat[i3] = null; + let newArray = new Array(this.sizeQuat << 1); + let _g = 0; + let _g1 = this.sizeQuat; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.stackQuat[i]; + this.stackQuat[i] = null; } - this.stackQuat = newArray3; + this.stackQuat = newArray; } this.stackQuat[this.sizeQuat++] = quat; } } - ,disposeVec3: function(v) { + disposeVec3(v) { v.zero(); if(this.sizeVec3 == this.stackVec3.length) { - var newArray = new Array(this.sizeVec3 << 1); - var _g = 0; - var _g1 = this.sizeVec3; + let newArray = new Array(this.sizeVec3 << 1); + let _g = 0; + let _g1 = this.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackVec3[i]; this.stackVec3[i] = null; } @@ -15352,7 +15414,7 @@ oimo_common_Pool.prototype = { } this.stackVec3[this.sizeVec3++] = v; } - ,disposeMat3: function(m) { + disposeMat3(m) { m.e00 = 1; m.e01 = 0; m.e02 = 0; @@ -15363,11 +15425,11 @@ oimo_common_Pool.prototype = { m.e21 = 0; m.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newArray = new Array(this.sizeMat3 << 1); - var _g = 0; - var _g1 = this.sizeMat3; + let newArray = new Array(this.sizeMat3 << 1); + let _g = 0; + let _g1 = this.sizeMat3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackMat3[i]; this.stackMat3[i] = null; } @@ -15375,7 +15437,7 @@ oimo_common_Pool.prototype = { } this.stackMat3[this.sizeMat3++] = m; } - ,disposeMat4: function(m) { + disposeMat4(m) { m.e00 = 1; m.e01 = 0; m.e02 = 0; @@ -15393,11 +15455,11 @@ oimo_common_Pool.prototype = { m.e32 = 0; m.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newArray = new Array(this.sizeMat4 << 1); - var _g = 0; - var _g1 = this.sizeMat4; + let newArray = new Array(this.sizeMat4 << 1); + let _g = 0; + let _g1 = this.sizeMat4; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackMat4[i]; this.stackMat4[i] = null; } @@ -15405,17 +15467,17 @@ oimo_common_Pool.prototype = { } this.stackMat4[this.sizeMat4++] = m; } - ,disposeQuat: function(q) { + disposeQuat(q) { q.x = 0; q.y = 0; q.z = 0; q.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newArray = new Array(this.sizeQuat << 1); - var _g = 0; - var _g1 = this.sizeQuat; + let newArray = new Array(this.sizeQuat << 1); + let _g = 0; + let _g1 = this.sizeQuat; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.stackQuat[i]; this.stackQuat[i] = null; } @@ -15423,89 +15485,89 @@ oimo_common_Pool.prototype = { } this.stackQuat[this.sizeQuat++] = q; } -}; -var oimo_common_Quat = function(x,y,z,w) { - if(w == null) { - w = 1; - } - if(z == null) { - z = 0; - } - if(y == null) { - y = 0; - } - if(x == null) { - x = 0; +} +class oimo_common_Quat { + constructor(x,y,z,w) { + if(w == null) { + w = 1; + } + if(z == null) { + z = 0; + } + if(y == null) { + y = 0; + } + if(x == null) { + x = 0; + } + this.x = x; + this.y = y; + this.z = z; + this.w = w; + oimo_common_Quat.numCreations++; } - this.x = x; - this.y = y; - this.z = z; - this.w = w; - oimo_common_Quat.numCreations++; -}; -oimo_common_Quat.prototype = { - identity: function() { + identity() { this.x = 0; this.y = 0; this.z = 0; this.w = 1; return this; } - ,init: function(x,y,z,w) { + init(x,y,z,w) { this.x = x; this.y = y; this.z = z; this.w = w; return this; } - ,add: function(q) { + add(q) { return new oimo_common_Quat(this.x + q.x,this.y + q.y,this.z + q.z,this.w + q.w); } - ,sub: function(q) { + sub(q) { return new oimo_common_Quat(this.x - q.x,this.y - q.y,this.z - q.z,this.w - q.w); } - ,scale: function(s) { + scale(s) { return new oimo_common_Quat(this.x * s,this.y * s,this.z * s,this.w * s); } - ,addEq: function(q) { + addEq(q) { this.x += q.x; this.y += q.y; this.z += q.z; this.w += q.w; return this; } - ,subEq: function(q) { + subEq(q) { this.x -= q.x; this.y -= q.y; this.z -= q.z; this.w -= q.w; return this; } - ,scaleEq: function(s) { + scaleEq(s) { this.x *= s; this.y *= s; this.z *= s; this.w *= s; return this; } - ,length: function() { + length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); } - ,lengthSq: function() { + lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; } - ,dot: function(q) { + dot(q) { return this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; } - ,normalized: function() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + normalized() { + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); if(invLen > 0) { invLen = 1 / invLen; } return new oimo_common_Quat(this.x * invLen,this.y * invLen,this.z * invLen,this.w * invLen); } - ,normalize: function() { - var invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + normalize() { + let invLen = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); if(invLen > 0) { invLen = 1 / invLen; } @@ -15515,14 +15577,14 @@ oimo_common_Quat.prototype = { this.w *= invLen; return this; } - ,setArc: function(v1,v2) { - var x1 = v1.x; - var y1 = v1.y; - var z1 = v1.z; - var x2 = v2.x; - var y2 = v2.y; - var z2 = v2.z; - var d = x1 * x2 + y1 * y2 + z1 * z2; + setArc(v1,v2) { + let x1 = v1.x; + let y1 = v1.y; + let z1 = v1.z; + let x2 = v2.x; + let y2 = v2.y; + let z2 = v2.z; + let d = x1 * x2 + y1 * y2 + z1 * z2; this.w = Math.sqrt((1 + d) * 0.5); if(this.w == 0) { x2 = x1 * x1; @@ -15559,12 +15621,12 @@ oimo_common_Quat.prototype = { this.z = (x1 * y2 - y1 * x2) * d; return this; } - ,slerp: function(q,t) { - var qx; - var qy; - var qz; - var qw; - var d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; + slerp(q,t) { + let qx; + let qy; + let qz; + let qw; + let d = this.x * q.x + this.y * q.y + this.z * q.z + this.w * q.w; if(d < 0) { d = -d; qx = -q.x; @@ -15578,8 +15640,8 @@ oimo_common_Quat.prototype = { qw = q.w; } if(d > 0.999999) { - var _this = new oimo_common_Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); - var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); + let _this = new oimo_common_Quat(this.x + (qx - this.x) * t,this.y + (qy - this.y) * t,this.z + (qz - this.z) * t,this.w + (qw - this.w) * t); + let invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z + _this.w * _this.w); if(invLen > 0) { invLen = 1 / invLen; } @@ -15589,36 +15651,36 @@ oimo_common_Quat.prototype = { _this.w *= invLen; return _this; } - var theta = t * Math.acos(d); + let theta = t * Math.acos(d); qx -= this.x * d; qy -= this.y * d; qz -= this.z * d; qw -= this.w * d; - var invLen1 = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); - qx *= invLen1; - qy *= invLen1; - qz *= invLen1; - qw *= invLen1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let invLen = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); + qx *= invLen; + qy *= invLen; + qz *= invLen; + qw *= invLen; + let sin = Math.sin(theta); + let cos = Math.cos(theta); return new oimo_common_Quat(this.x * cos + qx * sin,this.y * cos + qy * sin,this.z * cos + qz * sin,this.w * cos + qw * sin); } - ,copyFrom: function(q) { + copyFrom(q) { this.x = q.x; this.y = q.y; this.z = q.z; this.w = q.w; return this; } - ,clone: function() { + clone() { return new oimo_common_Quat(this.x,this.y,this.z,this.w); } - ,fromMat3: function(m) { - var e00 = m.e00; - var e11 = m.e11; - var e22 = m.e22; - var t = e00 + e11 + e22; - var s; + fromMat3(m) { + let e00 = m.e00; + let e11 = m.e11; + let e22 = m.e22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); this.w = 0.5 * s; @@ -15659,24 +15721,24 @@ oimo_common_Quat.prototype = { } return this; } - ,toMat3: function() { - var _this = new oimo_common_Mat3(); - var x = this.x; - var y = this.y; - var z = this.z; - var w = this.w; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + toMat3() { + let _this = new oimo_common_Mat3(); + let x = this.x; + let y = this.y; + let z = this.z; + let w = this.w; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this.e00 = 1 - yy - zz; _this.e01 = xy - wz; _this.e02 = xz + wy; @@ -15688,36 +15750,36 @@ oimo_common_Quat.prototype = { _this.e22 = 1 - xx - yy; return _this; } - ,toString: function() { + toString() { return "Quat[" + (this.x > 0 ? (this.x * 10000000 + 0.5 | 0) / 10000000 : (this.x * 10000000 - 0.5 | 0) / 10000000) + " i,\n" + " " + (this.y > 0 ? (this.y * 10000000 + 0.5 | 0) / 10000000 : (this.y * 10000000 - 0.5 | 0) / 10000000) + " j,\n" + " " + (this.z > 0 ? (this.z * 10000000 + 0.5 | 0) / 10000000 : (this.z * 10000000 - 0.5 | 0) / 10000000) + " k,\n" + " " + (this.w > 0 ? (this.w * 10000000 + 0.5 | 0) / 10000000 : (this.w * 10000000 - 0.5 | 0) / 10000000) + "]"; } -}; -var oimo_dynamics_Contact = function() { - this._next = null; - this._prev = null; - this._link1 = new oimo_dynamics_ContactLink(); - this._link2 = new oimo_dynamics_ContactLink(); - this._s1 = null; - this._s2 = null; - this._b1 = null; - this._b2 = null; - this._detector = null; - this._cachedDetectorData = new oimo_collision_narrowphase_detector_CachedDetectorData(); - this._detectorResult = new oimo_collision_narrowphase_DetectorResult(); - this._latest = false; - this._shouldBeSkipped = false; - this._manifold = new oimo_dynamics_constraint_contact_Manifold(); - this._updater = new oimo_dynamics_constraint_contact_ManifoldUpdater(this._manifold); - this._contactConstraint = new oimo_dynamics_constraint_contact_ContactConstraint(this._manifold); - this._touching = false; -}; -oimo_dynamics_Contact.prototype = { - _updateManifold: function() { +} +class oimo_dynamics_Contact { + constructor() { + this._next = null; + this._prev = null; + this._link1 = new oimo_dynamics_ContactLink(); + this._link2 = new oimo_dynamics_ContactLink(); + this._s1 = null; + this._s2 = null; + this._b1 = null; + this._b2 = null; + this._detector = null; + this._cachedDetectorData = new oimo_collision_narrowphase_detector_CachedDetectorData(); + this._detectorResult = new oimo_collision_narrowphase_DetectorResult(); + this._latest = false; + this._shouldBeSkipped = false; + this._manifold = new oimo_dynamics_constraint_contact_Manifold(); + this._updater = new oimo_dynamics_constraint_contact_ManifoldUpdater(this._manifold); + this._contactConstraint = new oimo_dynamics_constraint_contact_ContactConstraint(this._manifold); + this._touching = false; + } + _updateManifold() { if(this._detector == null) { return; } - var ptouching = this._touching; - var result = this._detectorResult; + let ptouching = this._touching; + let result = this._detectorResult; this._detector.detect(result,this._s1._geom,this._s2._geom,this._s1._transform,this._s2._transform,this._cachedDetectorData); this._touching = result.numPoints > 0; if(this._touching) { @@ -15736,85 +15798,113 @@ oimo_dynamics_Contact.prototype = { this._manifold._clear(); } if(this._touching && !ptouching) { - var cc2 = this._s2._contactCallback; - if(this._s1._contactCallback == cc2) { + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.beginContact(this); + } + if(cc2 != null) { + cc2.beginContact(this); + } } if(!this._touching && ptouching) { - var cc21 = this._s2._contactCallback; - if(this._s1._contactCallback == cc21) { - cc21 = null; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(this); + } + if(cc2 != null) { + cc2.endContact(this); } } if(this._touching) { - var cc22 = this._s2._contactCallback; - if(this._s1._contactCallback == cc22) { - cc22 = null; + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.preSolve(this); + } + if(cc2 != null) { + cc2.preSolve(this); } } } - ,_postSolve: function() { - var cc2 = this._s2._contactCallback; - if(this._s1._contactCallback == cc2) { + _postSolve() { + let cc1 = this._s1._contactCallback; + let cc2 = this._s2._contactCallback; + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.postSolve(this); + } + if(cc2 != null) { + cc2.postSolve(this); + } } - ,getShape1: function() { + getShape1() { return this._s1; } - ,getShape2: function() { + getShape2() { return this._s2; } - ,isTouching: function() { + isTouching() { return this._touching; } - ,getManifold: function() { + getManifold() { return this._manifold; } - ,getContactConstraint: function() { + getContactConstraint() { return this._contactConstraint; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_ContactLink = function() { - this._prev = null; - this._next = null; - this._contact = null; - this._other = null; -}; -oimo_dynamics_ContactLink.prototype = { - getContact: function() { +} +class oimo_dynamics_ContactLink { + constructor() { + this._prev = null; + this._next = null; + this._contact = null; + this._other = null; + } + getContact() { return this._contact; } - ,getOther: function() { + getOther() { return this._other; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_ContactManager = function(broadPhase) { - this._broadPhase = broadPhase; - this._collisionMatrix = new oimo_collision_narrowphase_CollisionMatrix(); - this._numContacts = 0; -}; -oimo_dynamics_ContactManager.prototype = { - createContacts: function() { - var pp = this._broadPhase._proxyPairList; +} +class oimo_dynamics_ContactManager { + constructor(broadPhase) { + this._broadPhase = broadPhase; + this._collisionMatrix = new oimo_collision_narrowphase_CollisionMatrix(); + this._numContacts = 0; + } + createContacts() { + let pp = this._broadPhase._proxyPairList; while(pp != null) { - var n = pp._next; + let n = pp._next; while(true) { - var s1; - var s2; + let s1; + let s2; if(pp._p1._id < pp._p2._id) { s1 = pp._p1.userData; s2 = pp._p2.userData; @@ -15825,19 +15915,19 @@ oimo_dynamics_ContactManager.prototype = { if(!this.shouldCollide(s1,s2)) { break; } - var b1 = s1._rigidBody; - var b2 = s2._rigidBody; - var l; + let b1 = s1._rigidBody; + let b2 = s2._rigidBody; + let l; if(b1._numContactLinks < b2._numContactLinks) { l = b1._contactLinkList; } else { l = b2._contactLinkList; } - var id1 = s1._id; - var id2 = s2._id; - var found = false; + let id1 = s1._id; + let id2 = s2._id; + let found = false; while(l != null) { - var c = l._contact; + let c = l._contact; if(c._s1._id == id1 && c._s2._id == id2) { c._latest = true; found = true; @@ -15846,53 +15936,53 @@ oimo_dynamics_ContactManager.prototype = { l = l._next; } if(!found) { - var first = this._contactPool; + let first = this._contactPool; if(first != null) { this._contactPool = first._next; first._next = null; } else { first = new oimo_dynamics_Contact(); } - var c1 = first; + let c = first; if(this._contactList == null) { - this._contactList = c1; - this._contactListLast = c1; + this._contactList = c; + this._contactListLast = c; } else { - this._contactListLast._next = c1; - c1._prev = this._contactListLast; - this._contactListLast = c1; + this._contactListLast._next = c; + c._prev = this._contactListLast; + this._contactListLast = c; } - c1._latest = true; - var detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; - c1._s1 = s1; - c1._s2 = s2; - c1._b1 = s1._rigidBody; - c1._b2 = s2._rigidBody; - c1._touching = false; - if(c1._b1._contactLinkList == null) { - c1._b1._contactLinkList = c1._link1; - c1._b1._contactLinkListLast = c1._link1; + c._latest = true; + let detector = this._collisionMatrix.detectors[s1._geom._type][s2._geom._type]; + c._s1 = s1; + c._s2 = s2; + c._b1 = s1._rigidBody; + c._b2 = s2._rigidBody; + c._touching = false; + if(c._b1._contactLinkList == null) { + c._b1._contactLinkList = c._link1; + c._b1._contactLinkListLast = c._link1; } else { - c1._b1._contactLinkListLast._next = c1._link1; - c1._link1._prev = c1._b1._contactLinkListLast; - c1._b1._contactLinkListLast = c1._link1; + c._b1._contactLinkListLast._next = c._link1; + c._link1._prev = c._b1._contactLinkListLast; + c._b1._contactLinkListLast = c._link1; } - if(c1._b2._contactLinkList == null) { - c1._b2._contactLinkList = c1._link2; - c1._b2._contactLinkListLast = c1._link2; + if(c._b2._contactLinkList == null) { + c._b2._contactLinkList = c._link2; + c._b2._contactLinkListLast = c._link2; } else { - c1._b2._contactLinkListLast._next = c1._link2; - c1._link2._prev = c1._b2._contactLinkListLast; - c1._b2._contactLinkListLast = c1._link2; + c._b2._contactLinkListLast._next = c._link2; + c._link2._prev = c._b2._contactLinkListLast; + c._b2._contactLinkListLast = c._link2; } - c1._b1._numContactLinks++; - c1._b2._numContactLinks++; - c1._link1._other = c1._b2; - c1._link2._other = c1._b1; - c1._link1._contact = c1; - c1._link2._contact = c1; - c1._detector = detector; - var _this = c1._contactConstraint; + c._b1._numContactLinks++; + c._b2._numContactLinks++; + c._link1._other = c._b2; + c._link2._other = c._b1; + c._link1._contact = c; + c._link2._contact = c; + c._detector = detector; + let _this = c._contactConstraint; _this._s1 = s1; _this._s2 = s2; _this._b1 = _this._s1._rigidBody; @@ -15906,11 +15996,11 @@ oimo_dynamics_ContactManager.prototype = { pp = n; } } - ,destroyOutdatedContacts: function() { - var incremental = this._broadPhase._incremental; - var c = this._contactList; + destroyOutdatedContacts() { + let incremental = this._broadPhase._incremental; + let c = this._contactList; while(c != null) { - var n = c._next; + let n = c._next; while(true) { if(c._latest) { c._latest = false; @@ -15918,8 +16008,8 @@ oimo_dynamics_ContactManager.prototype = { break; } if(!incremental) { - var prev = c._prev; - var next = c._next; + let prev = c._prev; + let next = c._next; if(prev != null) { prev._next = next; } @@ -15935,13 +16025,20 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } - var prev1 = c._link1._prev; - var next1 = c._link1._next; + let prev1 = c._link1._prev; + let next1 = c._link1._next; if(prev1 != null) { prev1._next = next1; } @@ -15956,8 +16053,8 @@ oimo_dynamics_ContactManager.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev2 = c._link2._prev; - var next2 = c._link2._next; + let prev2 = c._link2._prev; + let next2 = c._link2._next; if(prev2 != null) { prev2._next = next2; } @@ -15986,7 +16083,7 @@ oimo_dynamics_ContactManager.prototype = { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this = c._contactConstraint; + let _this = c._contactConstraint; _this._s1 = null; _this._s2 = null; _this._b1 = null; @@ -15998,26 +16095,26 @@ oimo_dynamics_ContactManager.prototype = { this._numContacts--; break; } - var s1 = c._s1; - var s2 = c._s2; - var r1 = s1._rigidBody; - var r2 = s2._rigidBody; + let s1 = c._s1; + let s2 = c._s2; + let r1 = s1._rigidBody; + let r2 = s2._rigidBody; if(!(!r1._sleeping && r1._type != 1) && !(!r2._sleeping && r2._type != 1)) { c._shouldBeSkipped = true; break; } - var aabb1 = s1._aabb; - var aabb2 = s2._aabb; - var proxy1 = s1._proxy; - var proxy2 = s2._proxy; + let aabb1 = s1._aabb; + let aabb2 = s2._aabb; + let proxy1 = s1._proxy; + let proxy2 = s2._proxy; if(!(proxy1._aabbMinX < proxy2._aabbMaxX && proxy1._aabbMaxX > proxy2._aabbMinX && proxy1._aabbMinY < proxy2._aabbMaxY && proxy1._aabbMaxY > proxy2._aabbMinY && proxy1._aabbMinZ < proxy2._aabbMaxZ && proxy1._aabbMaxZ > proxy2._aabbMinZ) || !this.shouldCollide(s1,s2)) { - var prev3 = c._prev; - var next3 = c._next; - if(prev3 != null) { - prev3._next = next3; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next3 != null) { - next3._prev = prev3; + if(next != null) { + next._prev = prev; } if(c == this._contactList) { this._contactList = this._contactList._next; @@ -16028,18 +16125,25 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc21 = c._s2._contactCallback; - if(c._s1._contactCallback == cc21) { - cc21 = null; + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); } } - var prev4 = c._link1._prev; - var next4 = c._link1._next; - if(prev4 != null) { - prev4._next = next4; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next4 != null) { - next4._prev = prev4; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -16049,13 +16153,13 @@ oimo_dynamics_ContactManager.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev5 = c._link2._prev; - var next5 = c._link2._next; - if(prev5 != null) { - prev5._next = next5; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next5 != null) { - next5._prev = prev5; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -16079,13 +16183,13 @@ oimo_dynamics_ContactManager.prototype = { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this1 = c._contactConstraint; - _this1._s1 = null; - _this1._s2 = null; - _this1._b1 = null; - _this1._b2 = null; - _this1._tf1 = null; - _this1._tf2 = null; + let _this = c._contactConstraint; + _this._s1 = null; + _this._s2 = null; + _this._b1 = null; + _this._b2 = null; + _this._tf1 = null; + _this._tf2 = null; c._next = this._contactPool; this._contactPool = c; this._numContacts--; @@ -16097,9 +16201,9 @@ oimo_dynamics_ContactManager.prototype = { c = n; } } - ,shouldCollide: function(s1,s2) { - var r1 = s1._rigidBody; - var r2 = s2._rigidBody; + shouldCollide(s1,s2) { + let r1 = s1._rigidBody; + let r2 = s2._rigidBody; if(r1 == r2) { return false; } @@ -16109,8 +16213,8 @@ oimo_dynamics_ContactManager.prototype = { if((s1._collisionGroup & s2._collisionMask) == 0 || (s2._collisionGroup & s1._collisionMask) == 0) { return false; } - var jl; - var other; + let jl; + let other; if(r1._numJointLinks < r2._numJointLinks) { jl = r1._jointLinkList; other = r2; @@ -16126,52 +16230,52 @@ oimo_dynamics_ContactManager.prototype = { } return true; } - ,_updateContacts: function() { + _updateContacts() { this._broadPhase.collectPairs(); this.createContacts(); this.destroyOutdatedContacts(); } - ,_postSolve: function() { - var c = this._contactList; + _postSolve() { + let c = this._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(c._touching) { c._postSolve(); } c = n; } } - ,getNumContacts: function() { + getNumContacts() { return this._numContacts; } - ,getContactList: function() { + getContactList() { return this._contactList; } -}; -var oimo_dynamics_Island = function() { - this.rigidBodies = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); - this.solvers = new Array(oimo_common_Setting.islandInitialConstraintArraySize); - this.solversSi = new Array(oimo_common_Setting.islandInitialConstraintArraySize); - this.solversNgs = new Array(oimo_common_Setting.islandInitialConstraintArraySize); - this.numRigidBodies = 0; - this.numSolvers = 0; - this.numSolversSi = 0; - this.numSolversNgs = 0; -}; -oimo_dynamics_Island.prototype = { - _clear: function() { +} +class oimo_dynamics_Island { + constructor() { + this.rigidBodies = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); + this.solvers = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversSi = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.solversNgs = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this.numRigidBodies = 0; + this.numSolvers = 0; + this.numSolversSi = 0; + this.numSolversNgs = 0; + } + _clear() { while(this.numRigidBodies > 0) this.rigidBodies[--this.numRigidBodies] = null; while(this.numSolvers > 0) this.solvers[--this.numSolvers] = null; while(this.numSolversSi > 0) this.solversSi[--this.numSolversSi] = null; while(this.numSolversNgs > 0) this.solversNgs[--this.numSolversNgs] = null; } - ,_addRigidBody: function(rigidBody) { + _addRigidBody(rigidBody) { if(this.numRigidBodies == this.rigidBodies.length) { - var newArray = new Array(this.numRigidBodies << 1); - var _g = 0; - var _g1 = this.numRigidBodies; + let newArray = new Array(this.numRigidBodies << 1); + let _g = 0; + let _g1 = this.numRigidBodies; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.rigidBodies[i]; this.rigidBodies[i] = null; } @@ -16180,13 +16284,13 @@ oimo_dynamics_Island.prototype = { rigidBody._addedToIsland = true; this.rigidBodies[this.numRigidBodies++] = rigidBody; } - ,_addConstraintSolver: function(solver,positionCorrection) { + _addConstraintSolver(solver,positionCorrection) { if(this.numSolvers == this.solvers.length) { - var newArray = new Array(this.numSolvers << 1); - var _g = 0; - var _g1 = this.numSolvers; + let newArray = new Array(this.numSolvers << 1); + let _g = 0; + let _g1 = this.numSolvers; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this.solvers[i]; this.solvers[i] = null; } @@ -16196,37 +16300,37 @@ oimo_dynamics_Island.prototype = { this.solvers[this.numSolvers++] = solver; if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.SPLIT_IMPULSE) { if(this.numSolversSi == this.solversSi.length) { - var newArray1 = new Array(this.numSolversSi << 1); - var _g2 = 0; - var _g11 = this.numSolversSi; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.solversSi[i1]; - this.solversSi[i1] = null; + let newArray = new Array(this.numSolversSi << 1); + let _g = 0; + let _g1 = this.numSolversSi; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.solversSi[i]; + this.solversSi[i] = null; } - this.solversSi = newArray1; + this.solversSi = newArray; } this.solversSi[this.numSolversSi++] = solver; } if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.NGS) { if(this.numSolversNgs == this.solversNgs.length) { - var newArray2 = new Array(this.numSolversNgs << 1); - var _g3 = 0; - var _g12 = this.numSolversNgs; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.solversNgs[i2]; - this.solversNgs[i2] = null; + let newArray = new Array(this.numSolversNgs << 1); + let _g = 0; + let _g1 = this.numSolversNgs; + while(_g < _g1) { + let i = _g++; + newArray[i] = this.solversNgs[i]; + this.solversNgs[i] = null; } - this.solversNgs = newArray2; + this.solversNgs = newArray; } this.solversNgs[this.numSolversNgs++] = solver; } } - ,_stepSingleRigidBody: function(timeStep,rb) { - var dt = timeStep.dt; - var dst = rb._ptransform; - var src = rb._transform; + _stepSingleRigidBody(timeStep,rb) { + let dt = timeStep.dt; + let dst = rb._ptransform; + let src = rb._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -16256,27 +16360,27 @@ oimo_dynamics_Island.prototype = { } if(!rb._sleeping) { if(rb._type == 0) { - var x = dt * rb._linearDamping; - var x2 = x * x; - var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); - var x1 = dt * rb._angularDamping; - var x21 = x1 * x1; - var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); - var linAccX; - var linAccY; - var linAccZ; - var angAccX; - var angAccY; - var angAccZ; + let x = dt * rb._linearDamping; + let x2 = x * x; + let linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + let x1 = dt * rb._angularDamping; + let x21 = x1 * x1; + let angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + let linAccX; + let linAccY; + let linAccZ; + let angAccX; + let angAccY; + let angAccZ; linAccX = this.gravityX * rb._gravityScale; linAccY = this.gravityY * rb._gravityScale; linAccZ = this.gravityZ * rb._gravityScale; linAccX += rb._forceX * rb._invMass; linAccY += rb._forceY * rb._invMass; linAccZ += rb._forceZ * rb._invMass; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; @@ -16297,22 +16401,22 @@ oimo_dynamics_Island.prototype = { rb._angVelZ *= angScale; } rb._integrate(dt); - var s = rb._shapeList; + let s = rb._shapeList; while(s != null) { - var n = s._next; - var tf1 = rb._ptransform; - var tf2 = rb._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = rb._ptransform; + let tf2 = rb._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -16322,38 +16426,38 @@ oimo_dynamics_Island.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; - __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; - __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X1; - dst1._positionY = __tmp__Y1; - dst1._positionZ = __tmp__Z1; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -16363,33 +16467,33 @@ oimo_dynamics_Island.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; - __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; - __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -16405,13 +16509,13 @@ oimo_dynamics_Island.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -16421,15 +16525,15 @@ oimo_dynamics_Island.prototype = { } } } - ,_step: function(timeStep,numVelocityIterations,numPositionIterations) { - var dt = timeStep.dt; - var sleepIsland = true; - var _g = 0; - var _g1 = this.numRigidBodies; + _step(timeStep,numVelocityIterations,numPositionIterations) { + let dt = timeStep.dt; + let sleepIsland = true; + let _g = 0; + let _g1 = this.numRigidBodies; while(_g < _g1) { - var rb = this.rigidBodies[_g++]; - var dst = rb._ptransform; - var src = rb._transform; + let rb = this.rigidBodies[_g++]; + let dst = rb._ptransform; + let src = rb._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -16458,27 +16562,27 @@ oimo_dynamics_Island.prototype = { sleepIsland = false; } if(rb._type == 0) { - var x = dt * rb._linearDamping; - var x2 = x * x; - var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); - var x1 = dt * rb._angularDamping; - var x21 = x1 * x1; - var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); - var linAccX; - var linAccY; - var linAccZ; - var angAccX; - var angAccY; - var angAccZ; + let x = dt * rb._linearDamping; + let x2 = x * x; + let linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); + let x1 = dt * rb._angularDamping; + let x21 = x1 * x1; + let angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + let linAccX; + let linAccY; + let linAccZ; + let angAccX; + let angAccY; + let angAccZ; linAccX = this.gravityX * rb._gravityScale; linAccY = this.gravityY * rb._gravityScale; linAccZ = this.gravityZ * rb._gravityScale; linAccX += rb._forceX * rb._invMass; linAccY += rb._forceY * rb._invMass; linAccZ += rb._forceZ * rb._invMass; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rb._invInertia00 * rb._torqueX + rb._invInertia01 * rb._torqueY + rb._invInertia02 * rb._torqueZ; __tmp__Y = rb._invInertia10 * rb._torqueX + rb._invInertia11 * rb._torqueY + rb._invInertia12 * rb._torqueZ; __tmp__Z = rb._invInertia20 * rb._torqueX + rb._invInertia21 * rb._torqueY + rb._invInertia22 * rb._torqueZ; @@ -16500,80 +16604,80 @@ oimo_dynamics_Island.prototype = { } } if(sleepIsland) { - var _g2 = 0; - var _g3 = this.numRigidBodies; - while(_g2 < _g3) { - var rb1 = this.rigidBodies[_g2++]; - rb1._sleeping = true; - rb1._sleepTime = 0; + let _g = 0; + let _g1 = this.numRigidBodies; + while(_g < _g1) { + let rb = this.rigidBodies[_g++]; + rb._sleeping = true; + rb._sleepTime = 0; } return; } - var _g21 = 0; - var _g31 = this.numSolvers; - while(_g21 < _g31) this.solvers[_g21++].preSolveVelocity(timeStep); - var _g4 = 0; - var _g5 = this.numSolvers; + let _g2 = 0; + let _g3 = this.numSolvers; + while(_g2 < _g3) this.solvers[_g2++].preSolveVelocity(timeStep); + let _g4 = 0; + let _g5 = this.numSolvers; while(_g4 < _g5) this.solvers[_g4++].warmStart(timeStep); - var _g6 = 0; + let _g6 = 0; while(_g6 < numVelocityIterations) { ++_g6; - var _g61 = 0; - var _g7 = this.numSolvers; - while(_g61 < _g7) this.solvers[_g61++].solveVelocity(); - } - var _g8 = 0; - var _g9 = this.numSolvers; - while(_g8 < _g9) this.solvers[_g8++].postSolveVelocity(timeStep); - var _g10 = 0; - var _g11 = this.numRigidBodies; - while(_g10 < _g11) this.rigidBodies[_g10++]._integrate(dt); - var _g12 = 0; - var _g13 = this.numSolversSi; - while(_g12 < _g13) this.solversSi[_g12++].preSolvePosition(timeStep); - var _g14 = 0; - while(_g14 < numPositionIterations) { - ++_g14; - var _g141 = 0; - var _g15 = this.numSolversSi; - while(_g141 < _g15) this.solversSi[_g141++].solvePositionSplitImpulse(); - } - var _g16 = 0; - var _g17 = this.numRigidBodies; - while(_g16 < _g17) this.rigidBodies[_g16++]._integratePseudoVelocity(); - var _g18 = 0; - var _g19 = this.numSolversNgs; - while(_g18 < _g19) this.solversNgs[_g18++].preSolvePosition(timeStep); - var _g20 = 0; - while(_g20 < numPositionIterations) { - ++_g20; - var _g201 = 0; - var _g211 = this.numSolversNgs; - while(_g201 < _g211) this.solversNgs[_g201++].solvePositionNgs(timeStep); - } - var _g22 = 0; - var _g23 = this.numSolvers; - while(_g22 < _g23) this.solvers[_g22++].postSolve(); - var _g24 = 0; - var _g25 = this.numRigidBodies; - while(_g24 < _g25) { - var rb2 = this.rigidBodies[_g24++]; - var s = rb2._shapeList; + let _g = 0; + let _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].solveVelocity(); + } + let _g7 = 0; + let _g8 = this.numSolvers; + while(_g7 < _g8) this.solvers[_g7++].postSolveVelocity(timeStep); + let _g9 = 0; + let _g10 = this.numRigidBodies; + while(_g9 < _g10) this.rigidBodies[_g9++]._integrate(dt); + let _g11 = 0; + let _g12 = this.numSolversSi; + while(_g11 < _g12) this.solversSi[_g11++].preSolvePosition(timeStep); + let _g13 = 0; + while(_g13 < numPositionIterations) { + ++_g13; + let _g = 0; + let _g1 = this.numSolversSi; + while(_g < _g1) this.solversSi[_g++].solvePositionSplitImpulse(); + } + let _g14 = 0; + let _g15 = this.numRigidBodies; + while(_g14 < _g15) this.rigidBodies[_g14++]._integratePseudoVelocity(); + let _g16 = 0; + let _g17 = this.numSolversNgs; + while(_g16 < _g17) this.solversNgs[_g16++].preSolvePosition(timeStep); + let _g18 = 0; + while(_g18 < numPositionIterations) { + ++_g18; + let _g = 0; + let _g1 = this.numSolversNgs; + while(_g < _g1) this.solversNgs[_g++].solvePositionNgs(timeStep); + } + let _g19 = 0; + let _g20 = this.numSolvers; + while(_g19 < _g20) this.solvers[_g19++].postSolve(); + let _g21 = 0; + let _g22 = this.numRigidBodies; + while(_g21 < _g22) { + let rb = this.rigidBodies[_g21++]; + let s = rb._shapeList; while(s != null) { - var n = s._next; - var tf1 = rb2._ptransform; - var tf2 = rb2._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = rb._ptransform; + let tf2 = rb._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -16583,38 +16687,38 @@ oimo_dynamics_Island.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; - __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; - __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X1; - dst1._positionY = __tmp__Y1; - dst1._positionZ = __tmp__Z1; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -16624,33 +16728,33 @@ oimo_dynamics_Island.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; - __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; - __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -16666,13 +16770,13 @@ oimo_dynamics_Island.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -16682,69 +16786,71 @@ oimo_dynamics_Island.prototype = { } } } -}; -var oimo_dynamics_TimeStep = function() { - this.dt = 0; - this.invDt = 0; - this.dtRatio = 1; -}; -var oimo_dynamics_World = function(broadPhaseType,gravity) { - if(broadPhaseType == null) { - broadPhaseType = 2; - } - switch(broadPhaseType) { - case 1: - this._broadPhase = new oimo_collision_broadphase_bruteforce_BruteForceBroadPhase(); - break; - case 2: - this._broadPhase = new oimo_collision_broadphase_bvh_BvhBroadPhase(); - break; - } - this._contactManager = new oimo_dynamics_ContactManager(this._broadPhase); - if(gravity == null) { - gravity = new oimo_common_Vec3(0,-9.80665,0); - } - this._gravity = new oimo_common_Vec3(gravity.x,gravity.y,gravity.z); - this._rigidBodyList = null; - this._rigidBodyListLast = null; - this._jointList = null; - this._jointListLast = null; - this._numRigidBodies = 0; - this._numShapes = 0; - this._numJoints = 0; - this._numIslands = 0; - this._numVelocityIterations = 10; - this._numPositionIterations = 5; - this._rayCastWrapper = new oimo_dynamics__$World_RayCastWrapper(); - this._convexCastWrapper = new oimo_dynamics__$World_ConvexCastWrapper(); - this._aabbTestWrapper = new oimo_dynamics__$World_AabbTestWrapper(); - this._island = new oimo_dynamics_Island(); - this._solversInIslands = new Array(oimo_common_Setting.islandInitialConstraintArraySize); - this._rigidBodyStack = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); - this._timeStep = new oimo_dynamics_TimeStep(); - this._pool = new oimo_common_Pool(); - this._shapeIdCount = 0; -}; -oimo_dynamics_World.prototype = { - _updateContacts: function() { - var st = Date.now() / 1000; +} +class oimo_dynamics_TimeStep { + constructor() { + this.dt = 0; + this.invDt = 0; + this.dtRatio = 1; + } +} +class oimo_dynamics_World { + constructor(broadPhaseType,gravity) { + if(broadPhaseType == null) { + broadPhaseType = 2; + } + switch(broadPhaseType) { + case 1: + this._broadPhase = new oimo_collision_broadphase_bruteforce_BruteForceBroadPhase(); + break; + case 2: + this._broadPhase = new oimo_collision_broadphase_bvh_BvhBroadPhase(); + break; + } + this._contactManager = new oimo_dynamics_ContactManager(this._broadPhase); + if(gravity == null) { + gravity = new oimo_common_Vec3(0,-9.80665,0); + } + this._gravity = new oimo_common_Vec3(gravity.x,gravity.y,gravity.z); + this._rigidBodyList = null; + this._rigidBodyListLast = null; + this._jointList = null; + this._jointListLast = null; + this._numRigidBodies = 0; + this._numShapes = 0; + this._numJoints = 0; + this._numIslands = 0; + this._numVelocityIterations = 10; + this._numPositionIterations = 5; + this._rayCastWrapper = new oimo_dynamics__$World_RayCastWrapper(); + this._convexCastWrapper = new oimo_dynamics__$World_ConvexCastWrapper(); + this._aabbTestWrapper = new oimo_dynamics__$World_AabbTestWrapper(); + this._island = new oimo_dynamics_Island(); + this._solversInIslands = new Array(oimo_common_Setting.islandInitialConstraintArraySize); + this._rigidBodyStack = new Array(oimo_common_Setting.islandInitialRigidBodyArraySize); + this._timeStep = new oimo_dynamics_TimeStep(); + this._pool = new oimo_common_Pool(); + this._shapeIdCount = 0; + } + _updateContacts() { + let st = HxOverrides.now() / 1000; this._contactManager._updateContacts(); - oimo_dynamics_common_Performance.broadPhaseCollisionTime = (Date.now() / 1000 - st) * 1000; - var st1 = Date.now() / 1000; - var c = this._contactManager._contactList; + oimo_dynamics_common_Performance.broadPhaseCollisionTime = (HxOverrides.now() / 1000 - st) * 1000; + let st1 = HxOverrides.now() / 1000; + let c = this._contactManager._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(!c._shouldBeSkipped) { c._updateManifold(); } c = n; } - oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (Date.now() / 1000 - st1) * 1000; + oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (HxOverrides.now() / 1000 - st1) * 1000; } - ,_solveIslands: function() { - var st = Date.now() / 1000; + _solveIslands() { + let st = HxOverrides.now() / 1000; if(oimo_common_Setting.disableSleeping) { - var b = this._rigidBodyList; + let b = this._rigidBodyList; while(b != null) { b._sleeping = false; b._sleepTime = 0; @@ -16752,78 +16858,78 @@ oimo_dynamics_World.prototype = { } } if(this._rigidBodyStack.length < this._numRigidBodies) { - var newStackSize = this._rigidBodyStack.length << 1; + let newStackSize = this._rigidBodyStack.length << 1; while(newStackSize < this._numRigidBodies) newStackSize <<= 1; this._rigidBodyStack = new Array(newStackSize); } this._numIslands = 0; - var _this = this._island; - var gravity = this._gravity; + let _this = this._island; + let gravity = this._gravity; _this.gravityX = gravity.x; _this.gravityY = gravity.y; _this.gravityZ = gravity.z; - var b1 = this._rigidBodyList; + let b = this._rigidBodyList; this._numSolversInIslands = 0; - while(b1 != null) { - var n = b1._next; - while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { - if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { - this._island._stepSingleRigidBody(this._timeStep,b1); + while(b != null) { + let n = b._next; + while(!(b._addedToIsland || b._sleeping || b._type == 1)) { + if(b._numContactLinks == 0 && b._numJointLinks == 0) { + this._island._stepSingleRigidBody(this._timeStep,b); this._numIslands++; break; } - this.buildIsland(b1); + this.buildIsland(b); this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); this._island._clear(); this._numIslands++; break; } - b1 = n; + b = n; } this._contactManager._postSolve(); - b1 = this._rigidBodyList; - while(b1 != null) { - b1._addedToIsland = false; - b1 = b1._next; - } - b1 = this._rigidBodyList; - while(b1 != null) { - b1._forceX = 0; - b1._forceY = 0; - b1._forceZ = 0; - b1._torqueX = 0; - b1._torqueY = 0; - b1._torqueZ = 0; - b1 = b1._next; + b = this._rigidBodyList; + while(b != null) { + b._addedToIsland = false; + b = b._next; + } + b = this._rigidBodyList; + while(b != null) { + b._forceX = 0; + b._forceY = 0; + b._forceZ = 0; + b._torqueX = 0; + b._torqueY = 0; + b._torqueZ = 0; + b = b._next; } while(this._numSolversInIslands > 0) { this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; this._solversInIslands[this._numSolversInIslands] = null; } - oimo_dynamics_common_Performance.dynamicsTime = (Date.now() / 1000 - st) * 1000; + oimo_dynamics_common_Performance.dynamicsTime = (HxOverrides.now() / 1000 - st) * 1000; } - ,buildIsland: function(base) { - var stackCount = 1; + buildIsland(base) { + let stackCount = 1; this._island._addRigidBody(base); this._rigidBodyStack[0] = base; while(stackCount > 0) { - var rb = this._rigidBodyStack[--stackCount]; + let rb = this._rigidBodyStack[--stackCount]; this._rigidBodyStack[stackCount] = null; if(rb._type == 1) { continue; } - var cl = rb._contactLinkList; + let cl = rb._contactLinkList; while(cl != null) { - var n = cl._next; - var cc = cl._contact._contactConstraint; - var ccs = cl._contact._contactConstraint._solver; + let n = cl._next; + let cc = cl._contact._contactConstraint; + let ccs = cl._contact._contactConstraint._solver; if(cc.isTouching() && !ccs._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newArray = new Array(this._numSolversInIslands << 1); - var _g = 0; - var _g1 = this._numSolversInIslands; + let newArray = new Array(this._numSolversInIslands << 1); + let _g = 0; + let _g1 = this._numSolversInIslands; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = this._solversInIslands[i]; this._solversInIslands[i] = null; } @@ -16831,7 +16937,7 @@ oimo_dynamics_World.prototype = { } this._solversInIslands[this._numSolversInIslands++] = ccs; this._island._addConstraintSolver(ccs,cc._positionCorrectionAlgorithm); - var other = cl._other; + let other = cl._other; if(!other._addedToIsland) { this._island._addRigidBody(other); this._rigidBodyStack[stackCount++] = other; @@ -16839,67 +16945,67 @@ oimo_dynamics_World.prototype = { } cl = n; } - var jl = rb._jointLinkList; + let jl = rb._jointLinkList; while(jl != null) { - var n1 = jl._next; - var j = jl._joint; - var js1 = j._solver; - if(!js1._addedToIsland) { + let n = jl._next; + let j = jl._joint; + let js = j._solver; + if(!js._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { - var newArray1 = new Array(this._numSolversInIslands << 1); - var _g2 = 0; - var _g11 = this._numSolversInIslands; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this._solversInIslands[i1]; - this._solversInIslands[i1] = null; + let newArray = new Array(this._numSolversInIslands << 1); + let _g = 0; + let _g1 = this._numSolversInIslands; + while(_g < _g1) { + let i = _g++; + newArray[i] = this._solversInIslands[i]; + this._solversInIslands[i] = null; } - this._solversInIslands = newArray1; + this._solversInIslands = newArray; } - this._solversInIslands[this._numSolversInIslands++] = js1; - this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); - var other1 = jl._other; - if(!other1._addedToIsland) { - this._island._addRigidBody(other1); - this._rigidBodyStack[stackCount++] = other1; + this._solversInIslands[this._numSolversInIslands++] = js; + this._island._addConstraintSolver(js,j._positionCorrectionAlgorithm); + let other = jl._other; + if(!other._addedToIsland) { + this._island._addRigidBody(other); + this._rigidBodyStack[stackCount++] = other; } } - jl = n1; + jl = n; } } } - ,_drawBvh: function(d,tree) { + _drawBvh(d,tree) { if(d.drawBvh) { this._drawBvhNode(d,tree._root,0,d.style.bvhNodeColor); } } - ,_drawBvhNode: function(d,node,level,color) { + _drawBvhNode(d,node,level,color) { if(node == null) { return; } if(level >= d.drawBvhMinLevel && level <= d.drawBvhMaxLevel) { - var _this = this._pool; - var min = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var max = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var v = min; + let _this = this._pool; + let min = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let max = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = min; v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = max; + let v1 = max; v1.x = node._aabbMaxX; v1.y = node._aabbMaxY; v1.z = node._aabbMaxZ; d.aabb(min,max,color); - var _this2 = this._pool; + let _this2 = this._pool; if(min != null) { min.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newArray = new Array(_this2.sizeVec3 << 1); - var _g = 0; - var _g1 = _this2.sizeVec3; + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -16907,19 +17013,19 @@ oimo_dynamics_World.prototype = { } _this2.stackVec3[_this2.sizeVec3++] = min; } - var _this3 = this._pool; + let _this3 = this._pool; if(max != null) { max.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newArray1 = new Array(_this3.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this3.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this3.stackVec3[i1]; - _this3.stackVec3[i1] = null; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this3.stackVec3 = newArray1; + _this3.stackVec3 = newArray; } _this3.stackVec3[_this3.sizeVec3++] = max; } @@ -16927,23 +17033,23 @@ oimo_dynamics_World.prototype = { this._drawBvhNode(d,node._children[0],level + 1,color); this._drawBvhNode(d,node._children[1],level + 1,color); } - ,_drawRigidBodies: function(d) { - var style = d.style; - var r = this._rigidBodyList; + _drawRigidBodies(d) { + let style = d.style; + let r = this._rigidBodyList; while(r != null) { - var n = r._next; + let n = r._next; if(d.drawBases) { - var style1 = d.style; - d.basis(r._transform,style1.basisLength,style1.basisColorX,style1.basisColorY,style1.basisColorZ); + let style = d.style; + d.basis(r._transform,style.basisLength,style.basisColorX,style.basisColorY,style.basisColorZ); } - var shapeColor = null; - var isDynamic = r._type == 0; + let shapeColor = null; + let isDynamic = r._type == 0; if(!isDynamic) { shapeColor = r._type == 2 ? style.kinematicShapeColor : style.staticShapeColor; } - var s = r._shapeList; + let s = r._shapeList; while(s != null) { - var n1 = s._next; + let n = s._next; if(isDynamic) { if((s._id & 1) == 0) { shapeColor = r._sleeping ? style.sleepingShapeColor1 : r._sleepTime > oimo_common_Setting.sleepingTimeThreshold ? style.sleepyShapeColor1 : style.shapeColor1; @@ -16952,30 +17058,30 @@ oimo_dynamics_World.prototype = { } } if(d.drawShapes) { - var geom = s._geom; - var tf = s._transform; + let geom = s._geom; + let tf = s._transform; switch(geom._type) { case 0: d.sphere(tf,geom._radius,shapeColor); break; case 1: - var g = geom; - var _this = this._pool; - var hx = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var v = hx; + let g = geom; + let _this = this._pool; + let hx = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let v = hx; v.x = g._halfExtentsX; v.y = g._halfExtentsY; v.z = g._halfExtentsZ; d.box(tf,hx,shapeColor); - var _this1 = this._pool; + let _this1 = this._pool; if(hx != null) { hx.zero(); if(_this1.sizeVec3 == _this1.stackVec3.length) { - var newArray = new Array(_this1.sizeVec3 << 1); - var _g = 0; - var _g1 = _this1.sizeVec3; + let newArray = new Array(_this1.sizeVec3 << 1); + let _g = 0; + let _g1 = _this1.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this1.stackVec3[i]; _this1.stackVec3[i] = null; } @@ -16985,37 +17091,37 @@ oimo_dynamics_World.prototype = { } break; case 2: - var g1 = geom; + let g1 = geom; d.cylinder(tf,g1._radius,g1._halfHeight,shapeColor); break; case 3: - var g2 = geom; + let g2 = geom; d.cone(tf,g2._radius,g2._halfHeight,shapeColor); break; case 4: - var g3 = geom; + let g3 = geom; d.capsule(tf,g3._radius,g3._halfHeight,shapeColor); break; case 5: - var g4 = geom; - var n2 = g4._numVertices; - var _this2 = this._pool; - var v1 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this._pool; - var v2 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this._pool; - var v3 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var _this5 = this._pool; - var v12 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - var _this6 = this._pool; - var v13 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var _this7 = this._pool; - var normal = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; - var _this8 = this._pool; - var m = _this8.sizeMat3 == 0 ? new oimo_common_Mat3() : _this8.stackMat3[--_this8.sizeMat3]; - var _this9 = this._pool; - var o = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; - var m1 = m; + let g4 = geom; + let n = g4._numVertices; + let _this2 = this._pool; + let v1 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let v2 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let v3 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let _this5 = this._pool; + let v12 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this6 = this._pool; + let v13 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let _this7 = this._pool; + let normal = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + let _this8 = this._pool; + let m = _this8.sizeMat3 == 0 ? new oimo_common_Mat3() : _this8.stackMat3[--_this8.sizeMat3]; + let _this9 = this._pool; + let o = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -17025,211 +17131,215 @@ oimo_dynamics_World.prototype = { m1.e20 = tf._rotation20; m1.e21 = tf._rotation21; m1.e22 = tf._rotation22; - var v4 = o; + let v4 = o; v4.x = tf._positionX; v4.y = tf._positionY; v4.z = tf._positionZ; - var _g2 = 0; - while(_g2 < n2) { - var i1 = _g2++; - var _this10 = g4._tmpVertices[i1]; - var v5 = g4._vertices[i1]; - _this10.x = v5.x; - _this10.y = v5.y; - _this10.z = v5.z; - var y = _this10.x * m.e10 + _this10.y * m.e11 + _this10.z * m.e12; - var z = _this10.x * m.e20 + _this10.y * m.e21 + _this10.z * m.e22; - _this10.x = _this10.x * m.e00 + _this10.y * m.e01 + _this10.z * m.e02; - _this10.y = y; - _this10.z = z; - _this10.x += o.x; - _this10.y += o.y; - _this10.z += o.z; + let _g = 0; + while(_g < n) { + let i = _g++; + let _this = g4._tmpVertices[i]; + let v = g4._vertices[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; } - if(n2 > 30) { - var _g21 = 0; - while(_g21 < n2) { - var i2 = _g21++; - var v6 = g4._tmpVertices[i2]; - v1.x = v6.x; - v1.y = v6.y; - v1.z = v6.z; - var v7 = g4._tmpVertices[(i2 + 1) % n2]; - v2.x = v7.x; - v2.y = v7.y; - v2.z = v7.z; + if(n > 30) { + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let v3 = g4._tmpVertices[(i + 1) % n]; + v2.x = v3.x; + v2.y = v3.y; + v2.z = v3.z; + d.line(v1,v2,shapeColor); } - } else if(this._debugDraw.wireframe || n2 > 10) { - var _g22 = 0; - while(_g22 < n2) { - var i3 = _g22++; - var v8 = g4._tmpVertices[i3]; - v1.x = v8.x; - v1.y = v8.y; - v1.z = v8.z; - var _g23 = 0; - while(_g23 < i3) { - var v9 = g4._tmpVertices[_g23++]; - v2.x = v9.x; - v2.y = v9.y; - v2.z = v9.z; + } else if(this._debugDraw.wireframe || n > 10) { + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let _g1 = 0; + while(_g1 < i) { + let v = g4._tmpVertices[_g1++]; + v2.x = v.x; + v2.y = v.y; + v2.z = v.z; + d.line(v1,v2,shapeColor); } } } else { - var _g24 = 0; - while(_g24 < n2) { - var i4 = _g24++; - var v10 = g4._tmpVertices[i4]; - v1.x = v10.x; - v1.y = v10.y; - v1.z = v10.z; - var _g25 = 0; - while(_g25 < i4) { - var j = _g25++; - var v11 = g4._tmpVertices[j]; - v2.x = v11.x; - v2.y = v11.y; - v2.z = v11.z; - var _g26 = 0; - while(_g26 < j) { - var v14 = g4._tmpVertices[_g26++]; - v3.x = v14.x; - v3.y = v14.y; - v3.z = v14.z; + let _g = 0; + while(_g < n) { + let i = _g++; + let v = g4._tmpVertices[i]; + v1.x = v.x; + v1.y = v.y; + v1.z = v.z; + let _g1 = 0; + while(_g1 < i) { + let j = _g1++; + let v = g4._tmpVertices[j]; + v2.x = v.x; + v2.y = v.y; + v2.z = v.z; + let _g = 0; + while(_g < j) { + let v = g4._tmpVertices[_g++]; + v3.x = v.x; + v3.y = v.y; + v3.z = v.z; v12.x = v2.x; v12.y = v2.y; v12.z = v2.z; - var _this11 = v12; - _this11.x -= v1.x; - _this11.y -= v1.y; - _this11.z -= v1.z; + let _this = v12; + _this.x -= v1.x; + _this.y -= v1.y; + _this.z -= v1.z; v13.x = v3.x; v13.y = v3.y; v13.z = v3.z; - var _this12 = v13; - _this12.x -= v1.x; - _this12.y -= v1.y; - _this12.z -= v1.z; + let _this1 = v13; + _this1.x -= v1.x; + _this1.y -= v1.y; + _this1.z -= v1.z; normal.x = v12.x; normal.y = v12.y; normal.z = v12.z; - var _this13 = normal; - var y1 = _this13.z * v13.x - _this13.x * v13.z; - var z1 = _this13.x * v13.y - _this13.y * v13.x; - _this13.x = _this13.y * v13.z - _this13.z * v13.y; - _this13.y = y1; - _this13.z = z1; - var invLen = Math.sqrt(_this13.x * _this13.x + _this13.y * _this13.y + _this13.z * _this13.z); + let _this2 = normal; + let y = _this2.z * v13.x - _this2.x * v13.z; + let z = _this2.x * v13.y - _this2.y * v13.x; + _this2.x = _this2.y * v13.z - _this2.z * v13.y; + _this2.y = y; + _this2.z = z; + let invLen = Math.sqrt(_this2.x * _this2.x + _this2.y * _this2.y + _this2.z * _this2.z); if(invLen > 0) { invLen = 1 / invLen; } - _this13.x *= invLen; - _this13.y *= invLen; - _this13.z *= invLen; + _this2.x *= invLen; + _this2.y *= invLen; + _this2.z *= invLen; + d.triangle(v1,v2,v3,normal,normal,normal,shapeColor); normal.x = -normal.x; normal.y = -normal.y; normal.z = -normal.z; + d.triangle(v1,v3,v2,normal,normal,normal,shapeColor); } } } } - var _this14 = this._pool; + let _this10 = this._pool; if(v1 != null) { v1.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray1 = new Array(_this14.sizeVec3 << 1); - var _g3 = 0; - var _g11 = _this14.sizeVec3; - while(_g3 < _g11) { - var i5 = _g3++; - newArray1[i5] = _this14.stackVec3[i5]; - _this14.stackVec3[i5] = null; + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this14.stackVec3 = newArray1; + _this10.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = v1; + _this10.stackVec3[_this10.sizeVec3++] = v1; } - var _this15 = this._pool; + let _this11 = this._pool; if(v2 != null) { v2.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray2 = new Array(_this15.sizeVec3 << 1); - var _g4 = 0; - var _g12 = _this15.sizeVec3; - while(_g4 < _g12) { - var i6 = _g4++; - newArray2[i6] = _this15.stackVec3[i6]; - _this15.stackVec3[i6] = null; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this15.stackVec3 = newArray2; + _this11.stackVec3 = newArray; } - _this15.stackVec3[_this15.sizeVec3++] = v2; + _this11.stackVec3[_this11.sizeVec3++] = v2; } - var _this16 = this._pool; + let _this12 = this._pool; if(v3 != null) { v3.zero(); - if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newArray3 = new Array(_this16.sizeVec3 << 1); - var _g5 = 0; - var _g13 = _this16.sizeVec3; - while(_g5 < _g13) { - var i7 = _g5++; - newArray3[i7] = _this16.stackVec3[i7]; - _this16.stackVec3[i7] = null; + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this16.stackVec3 = newArray3; + _this12.stackVec3 = newArray; } - _this16.stackVec3[_this16.sizeVec3++] = v3; + _this12.stackVec3[_this12.sizeVec3++] = v3; } - var _this17 = this._pool; + let _this13 = this._pool; if(v12 != null) { v12.zero(); - if(_this17.sizeVec3 == _this17.stackVec3.length) { - var newArray4 = new Array(_this17.sizeVec3 << 1); - var _g6 = 0; - var _g14 = _this17.sizeVec3; - while(_g6 < _g14) { - var i8 = _g6++; - newArray4[i8] = _this17.stackVec3[i8]; - _this17.stackVec3[i8] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this17.stackVec3 = newArray4; + _this13.stackVec3 = newArray; } - _this17.stackVec3[_this17.sizeVec3++] = v12; + _this13.stackVec3[_this13.sizeVec3++] = v12; } - var _this18 = this._pool; + let _this14 = this._pool; if(v13 != null) { v13.zero(); - if(_this18.sizeVec3 == _this18.stackVec3.length) { - var newArray5 = new Array(_this18.sizeVec3 << 1); - var _g7 = 0; - var _g15 = _this18.sizeVec3; - while(_g7 < _g15) { - var i9 = _g7++; - newArray5[i9] = _this18.stackVec3[i9]; - _this18.stackVec3[i9] = null; + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this18.stackVec3 = newArray5; + _this14.stackVec3 = newArray; } - _this18.stackVec3[_this18.sizeVec3++] = v13; + _this14.stackVec3[_this14.sizeVec3++] = v13; } - var _this19 = this._pool; + let _this15 = this._pool; if(normal != null) { normal.zero(); - if(_this19.sizeVec3 == _this19.stackVec3.length) { - var newArray6 = new Array(_this19.sizeVec3 << 1); - var _g8 = 0; - var _g16 = _this19.sizeVec3; - while(_g8 < _g16) { - var i10 = _g8++; - newArray6[i10] = _this19.stackVec3[i10]; - _this19.stackVec3[i10] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this19.stackVec3 = newArray6; + _this15.stackVec3 = newArray; } - _this19.stackVec3[_this19.sizeVec3++] = normal; + _this15.stackVec3[_this15.sizeVec3++] = normal; } - var _this20 = this._pool; + let _this16 = this._pool; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -17240,119 +17350,122 @@ oimo_dynamics_World.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this20.sizeMat3 == _this20.stackMat3.length) { - var newArray7 = new Array(_this20.sizeMat3 << 1); - var _g9 = 0; - var _g17 = _this20.sizeMat3; - while(_g9 < _g17) { - var i11 = _g9++; - newArray7[i11] = _this20.stackMat3[i11]; - _this20.stackMat3[i11] = null; + if(_this16.sizeMat3 == _this16.stackMat3.length) { + let newArray = new Array(_this16.sizeMat3 << 1); + let _g = 0; + let _g1 = _this16.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackMat3[i]; + _this16.stackMat3[i] = null; } - _this20.stackMat3 = newArray7; + _this16.stackMat3 = newArray; } - _this20.stackMat3[_this20.sizeMat3++] = m; + _this16.stackMat3[_this16.sizeMat3++] = m; } - var _this21 = this._pool; + let _this17 = this._pool; if(o != null) { o.zero(); - if(_this21.sizeVec3 == _this21.stackVec3.length) { - var newArray8 = new Array(_this21.sizeVec3 << 1); - var _g10 = 0; - var _g18 = _this21.sizeVec3; - while(_g10 < _g18) { - var i12 = _g10++; - newArray8[i12] = _this21.stackVec3[i12]; - _this21.stackVec3[i12] = null; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; } - _this21.stackVec3 = newArray8; + _this17.stackVec3 = newArray; } - _this21.stackVec3[_this21.sizeVec3++] = o; + _this17.stackVec3[_this17.sizeVec3++] = o; } break; } } if(d.drawAabbs) { - var aabb = s._aabb; - var color = style.aabbColor; - var _this22 = this._pool; - var min = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; - var _this23 = this._pool; - var max = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - var v15 = min; - v15.x = aabb._minX; - v15.y = aabb._minY; - v15.z = aabb._minZ; - var v16 = max; - v16.x = aabb._maxX; - v16.y = aabb._maxY; - v16.z = aabb._maxZ; + let aabb = s._aabb; + let color = style.aabbColor; + let _this = this._pool; + let min = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let max = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = min; + v.x = aabb._minX; + v.y = aabb._minY; + v.z = aabb._minZ; + let v1 = max; + v1.x = aabb._maxX; + v1.y = aabb._maxY; + v1.z = aabb._maxZ; d.aabb(min,max,color); - var _this24 = this._pool; + let _this2 = this._pool; if(min != null) { min.zero(); - if(_this24.sizeVec3 == _this24.stackVec3.length) { - var newArray9 = new Array(_this24.sizeVec3 << 1); - var _g19 = 0; - var _g110 = _this24.sizeVec3; - while(_g19 < _g110) { - var i13 = _g19++; - newArray9[i13] = _this24.stackVec3[i13]; - _this24.stackVec3[i13] = null; + if(_this2.sizeVec3 == _this2.stackVec3.length) { + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this24.stackVec3 = newArray9; + _this2.stackVec3 = newArray; } - _this24.stackVec3[_this24.sizeVec3++] = min; + _this2.stackVec3[_this2.sizeVec3++] = min; } - var _this25 = this._pool; + let _this3 = this._pool; if(max != null) { max.zero(); - if(_this25.sizeVec3 == _this25.stackVec3.length) { - var newArray10 = new Array(_this25.sizeVec3 << 1); - var _g20 = 0; - var _g111 = _this25.sizeVec3; - while(_g20 < _g111) { - var i14 = _g20++; - newArray10[i14] = _this25.stackVec3[i14]; - _this25.stackVec3[i14] = null; + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this25.stackVec3 = newArray10; + _this3.stackVec3 = newArray; } - _this25.stackVec3[_this25.sizeVec3++] = max; + _this3.stackVec3[_this3.sizeVec3++] = max; } } - s = n1; + s = n; } r = n; } } - ,_drawConstraints: function(d) { + _drawConstraints(d) { + let style = d.style; if(d.drawPairs || d.drawContacts) { - var c = this._contactManager._contactList; + let c = this._contactManager._contactList; while(c != null) { - var n = c._next; + let n = c._next; if(d.drawPairs) { - var _this = this._pool; - var v1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var v2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var v = v1; + let color = style.pairColor; + let _this = this._pool; + let v1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let v2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = v1; v.x = c._s1._transform._positionX; v.y = c._s1._transform._positionY; v.z = c._s1._transform._positionZ; - var v3 = v2; + let v3 = v2; v3.x = c._s2._transform._positionX; v3.y = c._s2._transform._positionY; v3.z = c._s2._transform._positionZ; - var _this2 = this._pool; + d.line(v1,v2,color); + let _this2 = this._pool; if(v1 != null) { v1.zero(); if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newArray = new Array(_this2.sizeVec3 << 1); - var _g = 0; - var _g1 = _this2.sizeVec3; + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this2.stackVec3[i]; _this2.stackVec3[i] = null; } @@ -17360,184 +17473,196 @@ oimo_dynamics_World.prototype = { } _this2.stackVec3[_this2.sizeVec3++] = v1; } - var _this3 = this._pool; + let _this3 = this._pool; if(v2 != null) { v2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newArray1 = new Array(_this3.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this3.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this3.stackVec3[i1]; - _this3.stackVec3[i1] = null; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this3.stackVec3 = newArray1; + _this3.stackVec3 = newArray; } _this3.stackVec3[_this3.sizeVec3++] = v2; } } if(d.drawContacts) { - var cc = c._contactConstraint; - var ps = c._contactConstraint._manifold._points; - var _g3 = 0; - var _g12 = c._contactConstraint._manifold._numPoints; - while(_g3 < _g12) { - var p = ps[_g3++]; - var style = d.style; - var _this4 = this._pool; - var pos1 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var _this5 = this._pool; - var pos2 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - var _this6 = this._pool; - var normal = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - var _this7 = this._pool; - var tangent = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; - var _this8 = this._pool; - var binormal = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - var v4 = pos1; - v4.x = p._pos1X; - v4.y = p._pos1Y; - v4.z = p._pos1Z; - var v5 = pos2; - v5.x = p._pos2X; - v5.y = p._pos2Y; - v5.z = p._pos2Z; - var v6 = normal; - v6.x = cc._manifold._normalX; - v6.y = cc._manifold._normalY; - v6.z = cc._manifold._normalZ; - var v7 = tangent; - v7.x = cc._manifold._tangentX; - v7.y = cc._manifold._tangentY; - v7.z = cc._manifold._tangentZ; - var v8 = binormal; - v8.x = cc._manifold._binormalX; - v8.y = cc._manifold._binormalY; - v8.z = cc._manifold._binormalZ; - if(!p._disabled) { - if(p._warmStarted) { - var color; - switch(p._id & 3) { - case 0: - color = style.contactColor; - break; - case 1: - color = style.contactColor2; - break; - case 2: - color = style.contactColor3; - break; - default: - color = style.contactColor4; - } + let cc = c._contactConstraint; + let ps = c._contactConstraint._manifold._points; + let _g = 0; + let _g1 = c._contactConstraint._manifold._numPoints; + while(_g < _g1) { + let p = ps[_g++]; + let style = d.style; + let _this = this._pool; + let pos1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let pos2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this._pool; + let normal = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let tangent = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let binormal = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let v = pos1; + v.x = p._pos1X; + v.y = p._pos1Y; + v.z = p._pos1Z; + let v1 = pos2; + v1.x = p._pos2X; + v1.y = p._pos2Y; + v1.z = p._pos2Z; + let v2 = normal; + v2.x = cc._manifold._normalX; + v2.y = cc._manifold._normalY; + v2.z = cc._manifold._normalZ; + let v3 = tangent; + v3.x = cc._manifold._tangentX; + v3.y = cc._manifold._tangentY; + v3.z = cc._manifold._tangentZ; + let v4 = binormal; + v4.x = cc._manifold._binormalX; + v4.y = cc._manifold._binormalY; + v4.z = cc._manifold._binormalZ; + if(p._disabled) { + d.point(pos1,style.disabledContactColor); + d.point(pos2,style.disabledContactColor); + d.line(pos1,pos2,style.disabledContactColor); + } else if(p._warmStarted) { + let color; + switch(p._id & 3) { + case 0: + color = style.contactColor; + break; + case 1: + color = style.contactColor2; + break; + case 2: + color = style.contactColor3; + break; + default: + color = style.contactColor4; } + d.point(pos1,color); + d.point(pos2,color); + d.line(pos1,pos2,style.contactColor); + } else { + d.point(pos1,style.newContactColor); + d.point(pos2,style.newContactColor); + d.line(pos1,pos2,style.newContactColor); } pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this9 = pos2; - var s = style.contactNormalLength; - _this9.x += normal.x * s; - _this9.y += normal.y * s; - _this9.z += normal.z * s; + let _this5 = pos2; + let s = style.contactNormalLength; + _this5.x += normal.x * s; + _this5.y += normal.y * s; + _this5.z += normal.z * s; + d.line(pos1,pos2,style.contactNormalColor); if(d.drawContactBases) { pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this10 = pos2; - var s1 = style.contactTangentLength; - _this10.x += tangent.x * s1; - _this10.y += tangent.y * s1; - _this10.z += tangent.z * s1; + let _this = pos2; + let s = style.contactTangentLength; + _this.x += tangent.x * s; + _this.y += tangent.y * s; + _this.z += tangent.z * s; + d.line(pos1,pos2,style.contactTangentColor); pos2.x = pos1.x; pos2.y = pos1.y; pos2.z = pos1.z; - var _this11 = pos2; - var s2 = style.contactBinormalLength; - _this11.x += binormal.x * s2; - _this11.y += binormal.y * s2; - _this11.z += binormal.z * s2; + let _this1 = pos2; + let s1 = style.contactBinormalLength; + _this1.x += binormal.x * s1; + _this1.y += binormal.y * s1; + _this1.z += binormal.z * s1; + d.line(pos1,pos2,style.contactBinormalColor); } - var _this12 = this._pool; + let _this6 = this._pool; if(pos1 != null) { pos1.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray2 = new Array(_this12.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this12.sizeVec3; - while(_g4 < _g13) { - var i2 = _g4++; - newArray2[i2] = _this12.stackVec3[i2]; - _this12.stackVec3[i2] = null; + if(_this6.sizeVec3 == _this6.stackVec3.length) { + let newArray = new Array(_this6.sizeVec3 << 1); + let _g = 0; + let _g1 = _this6.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this6.stackVec3[i]; + _this6.stackVec3[i] = null; } - _this12.stackVec3 = newArray2; + _this6.stackVec3 = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = pos1; + _this6.stackVec3[_this6.sizeVec3++] = pos1; } - var _this13 = this._pool; + let _this7 = this._pool; if(pos2 != null) { pos2.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newArray3 = new Array(_this13.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this13.sizeVec3; - while(_g5 < _g14) { - var i3 = _g5++; - newArray3[i3] = _this13.stackVec3[i3]; - _this13.stackVec3[i3] = null; + if(_this7.sizeVec3 == _this7.stackVec3.length) { + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this13.stackVec3 = newArray3; + _this7.stackVec3 = newArray; } - _this13.stackVec3[_this13.sizeVec3++] = pos2; + _this7.stackVec3[_this7.sizeVec3++] = pos2; } - var _this14 = this._pool; + let _this8 = this._pool; if(normal != null) { normal.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray4 = new Array(_this14.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this14.sizeVec3; - while(_g6 < _g15) { - var i4 = _g6++; - newArray4[i4] = _this14.stackVec3[i4]; - _this14.stackVec3[i4] = null; + if(_this8.sizeVec3 == _this8.stackVec3.length) { + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; } - _this14.stackVec3 = newArray4; + _this8.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = normal; + _this8.stackVec3[_this8.sizeVec3++] = normal; } - var _this15 = this._pool; + let _this9 = this._pool; if(tangent != null) { tangent.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray5 = new Array(_this15.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this15.sizeVec3; - while(_g7 < _g16) { - var i5 = _g7++; - newArray5[i5] = _this15.stackVec3[i5]; - _this15.stackVec3[i5] = null; + if(_this9.sizeVec3 == _this9.stackVec3.length) { + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; } - _this15.stackVec3 = newArray5; + _this9.stackVec3 = newArray; } - _this15.stackVec3[_this15.sizeVec3++] = tangent; + _this9.stackVec3[_this9.sizeVec3++] = tangent; } - var _this16 = this._pool; + let _this10 = this._pool; if(binormal != null) { binormal.zero(); - if(_this16.sizeVec3 == _this16.stackVec3.length) { - var newArray6 = new Array(_this16.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this16.sizeVec3; - while(_g8 < _g17) { - var i6 = _g8++; - newArray6[i6] = _this16.stackVec3[i6]; - _this16.stackVec3[i6] = null; + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this16.stackVec3 = newArray6; + _this10.stackVec3 = newArray; } - _this16.stackVec3[_this16.sizeVec3++] = binormal; + _this10.stackVec3[_this10.sizeVec3++] = binormal; } } } @@ -17545,352 +17670,357 @@ oimo_dynamics_World.prototype = { } } if(d.drawJoints) { - var j = this._jointList; + let j = this._jointList; while(j != null) { - var n1 = j._next; - var _this17 = this._pool; - var p1 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - var _this18 = this._pool; - var p2 = _this18.sizeVec3 == 0 ? new oimo_common_Vec3() : _this18.stackVec3[--_this18.sizeVec3]; - var v9 = p1; - v9.x = j._b1._transform._positionX; - v9.y = j._b1._transform._positionY; - v9.z = j._b1._transform._positionZ; - var v10 = p2; - v10.x = j._b2._transform._positionX; - v10.y = j._b2._transform._positionY; - v10.z = j._b2._transform._positionZ; - var _this19 = this._pool; - var anchor1 = _this19.sizeVec3 == 0 ? new oimo_common_Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - var _this20 = this._pool; - var anchor2 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - var _this21 = this._pool; - var basisX1 = _this21.sizeVec3 == 0 ? new oimo_common_Vec3() : _this21.stackVec3[--_this21.sizeVec3]; - var _this22 = this._pool; - var basisY1 = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; - var _this23 = this._pool; - var basisZ1 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - var _this24 = this._pool; - var basisX2 = _this24.sizeVec3 == 0 ? new oimo_common_Vec3() : _this24.stackVec3[--_this24.sizeVec3]; - var _this25 = this._pool; - var basisY2 = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - var _this26 = this._pool; - var basisZ2 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - var v11 = anchor1; - v11.x = j._anchor1X; - v11.y = j._anchor1Y; - v11.z = j._anchor1Z; - var v12 = anchor2; - v12.x = j._anchor2X; - v12.y = j._anchor2Y; - v12.z = j._anchor2Z; - var v13 = basisX1; - v13.x = j._basisX1X; - v13.y = j._basisX1Y; - v13.z = j._basisX1Z; - var v14 = basisY1; - v14.x = j._basisY1X; - v14.y = j._basisY1Y; - v14.z = j._basisY1Z; - var v15 = basisZ1; - v15.x = j._basisZ1X; - v15.y = j._basisZ1Y; - v15.z = j._basisZ1Z; - var v16 = basisX2; - v16.x = j._basisX2X; - v16.y = j._basisX2Y; - v16.z = j._basisX2Z; - var v17 = basisY2; - v17.x = j._basisY2X; - v17.y = j._basisY2Y; - v17.z = j._basisY2Z; - var v18 = basisZ2; - v18.x = j._basisZ2X; - v18.y = j._basisZ2Y; - v18.z = j._basisZ2Z; + let n = j._next; + let _this = this._pool; + let p1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let p2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let v = p1; + v.x = j._b1._transform._positionX; + v.y = j._b1._transform._positionY; + v.z = j._b1._transform._positionZ; + let v1 = p2; + v1.x = j._b2._transform._positionX; + v1.y = j._b2._transform._positionY; + v1.z = j._b2._transform._positionZ; + let _this2 = this._pool; + let anchor1 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this._pool; + let anchor2 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this._pool; + let basisX1 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let _this5 = this._pool; + let basisY1 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this6 = this._pool; + let basisZ1 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let _this7 = this._pool; + let basisX2 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + let _this8 = this._pool; + let basisY2 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this9 = this._pool; + let basisZ2 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + let v2 = anchor1; + v2.x = j._anchor1X; + v2.y = j._anchor1Y; + v2.z = j._anchor1Z; + let v3 = anchor2; + v3.x = j._anchor2X; + v3.y = j._anchor2Y; + v3.z = j._anchor2Z; + let v4 = basisX1; + v4.x = j._basisX1X; + v4.y = j._basisX1Y; + v4.z = j._basisX1Z; + let v5 = basisY1; + v5.x = j._basisY1X; + v5.y = j._basisY1Y; + v5.z = j._basisY1Z; + let v6 = basisZ1; + v6.x = j._basisZ1X; + v6.y = j._basisZ1Y; + v6.z = j._basisZ1Z; + let v7 = basisX2; + v7.x = j._basisX2X; + v7.y = j._basisX2Y; + v7.z = j._basisX2Z; + let v8 = basisY2; + v8.x = j._basisY2X; + v8.y = j._basisY2Y; + v8.z = j._basisY2Z; + let v9 = basisZ2; + v9.x = j._basisZ2X; + v9.y = j._basisZ2Y; + v9.z = j._basisZ2Z; + d.line(p1,anchor1,d.style.jointLineColor); + d.line(p2,anchor2,d.style.jointLineColor); if(d.drawJointLimits) { switch(j._type) { case 0: break; case 1: - var lm = j._lm; + let lm = j._lm; this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,lm.lowerLimit,lm.upperLimit,d.style.jointLineColor); break; case 2: - var j1 = j; - var color1 = d.style.jointLineColor; - var rlm = j1._rotLm; - var tlm = j1._translLm; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color1); - this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color1); + let j1 = j; + let color = d.style.jointLineColor; + let rlm = j1._rotLm; + let tlm = j1._translLm; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color); break; case 3: - var lm1 = j._lm; + let lm1 = j._lm; this._drawTranslationalLimit(d,anchor1,basisX1,lm1.lowerLimit,lm1.upperLimit,d.style.jointLineColor); break; case 4: - var j2 = j; - var radius = d.style.jointRotationalConstraintRadius; - var color2 = d.style.jointLineColor; - var lm11 = j2._lm1; - var lm2 = j2._lm2; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color2); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color2); + let j2 = j; + let radius = d.style.jointRotationalConstraintRadius; + let color1 = d.style.jointLineColor; + let lm11 = j2._lm1; + let lm2 = j2._lm2; + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color1); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color1); break; case 5: - var j3 = j; - var radius1 = d.style.jointRotationalConstraintRadius; - var color3 = d.style.jointLineColor; - var lm3 = j3._twistLm; - this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color3); - this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color3); - var _this27 = this._pool; - var _this28 = _this27.sizeVec3 == 0 ? new oimo_common_Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = anchor2.x; - _this28.y = anchor2.y; - _this28.z = anchor2.z; - var _this29 = _this28; - _this29.x += basisX2.x * radius1; - _this29.y += basisX2.y * radius1; - _this29.z += basisX2.z * radius1; - var _this30 = this._pool; - if(_this29 != null) { - _this29.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newArray7 = new Array(_this30.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this30.sizeVec3; - while(_g9 < _g18) { - var i7 = _g9++; - newArray7[i7] = _this30.stackVec3[i7]; - _this30.stackVec3[i7] = null; + let j3 = j; + let radius1 = d.style.jointRotationalConstraintRadius; + let color2 = d.style.jointLineColor; + let lm3 = j3._twistLm; + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color2); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color2); + let _this10 = this._pool; + let _this11 = _this10.sizeVec3 == 0 ? new oimo_common_Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = anchor2.x; + _this11.y = anchor2.y; + _this11.z = anchor2.z; + let _this12 = _this11; + _this12.x += basisX2.x * radius1; + _this12.y += basisX2.y * radius1; + _this12.z += basisX2.z * radius1; + d.line(anchor2,_this12,color2); + let _this13 = this._pool; + if(_this12 != null) { + _this12.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this30.stackVec3 = newArray7; + _this13.stackVec3 = newArray; } - _this30.stackVec3[_this30.sizeVec3++] = _this29; + _this13.stackVec3[_this13.sizeVec3++] = _this12; } break; case 6: - var j4 = j; - var radius2 = d.style.jointRotationalConstraintRadius; - var color4 = d.style.jointLineColor; - var rxlm = j4._rotLms[0]; - var rylm = j4._rotLms[1]; - var rzlm = j4._rotLms[2]; - this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color4); - var _this31 = this._pool; - var rotYAxis = _this31.sizeVec3 == 0 ? new oimo_common_Vec3() : _this31.stackVec3[--_this31.sizeVec3]; - var v19 = rotYAxis; - v19.x = j4._axisYX; - v19.y = j4._axisYY; - v19.z = j4._axisYZ; - var _this32 = this._pool; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = basisX1.x; - _this33.y = basisX1.y; - _this33.z = basisX1.z; - var rotYBasisX = _this33; - var _this34 = this._pool; - var _this35 = _this34.sizeVec3 == 0 ? new oimo_common_Vec3() : _this34.stackVec3[--_this34.sizeVec3]; - _this35.x = basisX1.x; - _this35.y = basisX1.y; - _this35.z = basisX1.z; - var _this36 = _this35; - var y = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; - var z = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; - _this36.x = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; - _this36.y = y; - _this36.z = z; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color4); - this._drawRotationalLimit(d,anchor2,rotYBasisX,_this36,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color4); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color4); + let j4 = j; + let radius2 = d.style.jointRotationalConstraintRadius; + let color3 = d.style.jointLineColor; + let rxlm = j4._rotLms[0]; + let rylm = j4._rotLms[1]; + let rzlm = j4._rotLms[2]; + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color3); + let _this14 = this._pool; + let rotYAxis = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + let v10 = rotYAxis; + v10.x = j4._axisYX; + v10.y = j4._axisYY; + v10.z = j4._axisYZ; + let _this15 = this._pool; + let _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = basisX1.x; + _this16.y = basisX1.y; + _this16.z = basisX1.z; + let rotYBasisX = _this16; + let _this17 = this._pool; + let _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = basisX1.x; + _this18.y = basisX1.y; + _this18.z = basisX1.z; + let _this19 = _this18; + let y = _this19.z * rotYAxis.x - _this19.x * rotYAxis.z; + let z = _this19.x * rotYAxis.y - _this19.y * rotYAxis.x; + _this19.x = _this19.y * rotYAxis.z - _this19.z * rotYAxis.y; + _this19.y = y; + _this19.z = z; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color3); + this._drawRotationalLimit(d,anchor2,rotYBasisX,_this19,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color3); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color3); break; } } - var _this37 = this._pool; + d.line(anchor1,anchor2,d.style.jointErrorColor); + let _this20 = this._pool; if(p1 != null) { p1.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray8 = new Array(_this37.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this37.sizeVec3; - while(_g10 < _g19) { - var i8 = _g10++; - newArray8[i8] = _this37.stackVec3[i8]; - _this37.stackVec3[i8] = null; + if(_this20.sizeVec3 == _this20.stackVec3.length) { + let newArray = new Array(_this20.sizeVec3 << 1); + let _g = 0; + let _g1 = _this20.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this20.stackVec3[i]; + _this20.stackVec3[i] = null; } - _this37.stackVec3 = newArray8; + _this20.stackVec3 = newArray; } - _this37.stackVec3[_this37.sizeVec3++] = p1; + _this20.stackVec3[_this20.sizeVec3++] = p1; } - var _this38 = this._pool; + let _this21 = this._pool; if(p2 != null) { p2.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray9 = new Array(_this38.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this38.sizeVec3; - while(_g20 < _g110) { - var i9 = _g20++; - newArray9[i9] = _this38.stackVec3[i9]; - _this38.stackVec3[i9] = null; + if(_this21.sizeVec3 == _this21.stackVec3.length) { + let newArray = new Array(_this21.sizeVec3 << 1); + let _g = 0; + let _g1 = _this21.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this21.stackVec3[i]; + _this21.stackVec3[i] = null; } - _this38.stackVec3 = newArray9; + _this21.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = p2; + _this21.stackVec3[_this21.sizeVec3++] = p2; } - var _this39 = this._pool; + let _this22 = this._pool; if(anchor1 != null) { anchor1.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray10 = new Array(_this39.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this39.sizeVec3; - while(_g21 < _g111) { - var i10 = _g21++; - newArray10[i10] = _this39.stackVec3[i10]; - _this39.stackVec3[i10] = null; + if(_this22.sizeVec3 == _this22.stackVec3.length) { + let newArray = new Array(_this22.sizeVec3 << 1); + let _g = 0; + let _g1 = _this22.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this22.stackVec3[i]; + _this22.stackVec3[i] = null; } - _this39.stackVec3 = newArray10; + _this22.stackVec3 = newArray; } - _this39.stackVec3[_this39.sizeVec3++] = anchor1; + _this22.stackVec3[_this22.sizeVec3++] = anchor1; } - var _this40 = this._pool; + let _this23 = this._pool; if(anchor2 != null) { anchor2.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray11 = new Array(_this40.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this40.sizeVec3; - while(_g22 < _g112) { - var i11 = _g22++; - newArray11[i11] = _this40.stackVec3[i11]; - _this40.stackVec3[i11] = null; + if(_this23.sizeVec3 == _this23.stackVec3.length) { + let newArray = new Array(_this23.sizeVec3 << 1); + let _g = 0; + let _g1 = _this23.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this23.stackVec3[i]; + _this23.stackVec3[i] = null; } - _this40.stackVec3 = newArray11; + _this23.stackVec3 = newArray; } - _this40.stackVec3[_this40.sizeVec3++] = anchor2; + _this23.stackVec3[_this23.sizeVec3++] = anchor2; } - var _this41 = this._pool; + let _this24 = this._pool; if(basisX1 != null) { basisX1.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray12 = new Array(_this41.sizeVec3 << 1); - var _g23 = 0; - var _g113 = _this41.sizeVec3; - while(_g23 < _g113) { - var i12 = _g23++; - newArray12[i12] = _this41.stackVec3[i12]; - _this41.stackVec3[i12] = null; + if(_this24.sizeVec3 == _this24.stackVec3.length) { + let newArray = new Array(_this24.sizeVec3 << 1); + let _g = 0; + let _g1 = _this24.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this24.stackVec3[i]; + _this24.stackVec3[i] = null; } - _this41.stackVec3 = newArray12; + _this24.stackVec3 = newArray; } - _this41.stackVec3[_this41.sizeVec3++] = basisX1; + _this24.stackVec3[_this24.sizeVec3++] = basisX1; } - var _this42 = this._pool; + let _this25 = this._pool; if(basisY1 != null) { basisY1.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray13 = new Array(_this42.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this42.sizeVec3; - while(_g24 < _g114) { - var i13 = _g24++; - newArray13[i13] = _this42.stackVec3[i13]; - _this42.stackVec3[i13] = null; + if(_this25.sizeVec3 == _this25.stackVec3.length) { + let newArray = new Array(_this25.sizeVec3 << 1); + let _g = 0; + let _g1 = _this25.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this25.stackVec3[i]; + _this25.stackVec3[i] = null; } - _this42.stackVec3 = newArray13; + _this25.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = basisY1; + _this25.stackVec3[_this25.sizeVec3++] = basisY1; } - var _this43 = this._pool; + let _this26 = this._pool; if(basisZ1 != null) { basisZ1.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray14 = new Array(_this43.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this43.sizeVec3; - while(_g25 < _g115) { - var i14 = _g25++; - newArray14[i14] = _this43.stackVec3[i14]; - _this43.stackVec3[i14] = null; + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; } - _this43.stackVec3 = newArray14; + _this26.stackVec3 = newArray; } - _this43.stackVec3[_this43.sizeVec3++] = basisZ1; + _this26.stackVec3[_this26.sizeVec3++] = basisZ1; } - var _this44 = this._pool; + let _this27 = this._pool; if(basisX2 != null) { basisX2.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray15 = new Array(_this44.sizeVec3 << 1); - var _g26 = 0; - var _g116 = _this44.sizeVec3; - while(_g26 < _g116) { - var i15 = _g26++; - newArray15[i15] = _this44.stackVec3[i15]; - _this44.stackVec3[i15] = null; + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; } - _this44.stackVec3 = newArray15; + _this27.stackVec3 = newArray; } - _this44.stackVec3[_this44.sizeVec3++] = basisX2; + _this27.stackVec3[_this27.sizeVec3++] = basisX2; } - var _this45 = this._pool; + let _this28 = this._pool; if(basisY2 != null) { basisY2.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray16 = new Array(_this45.sizeVec3 << 1); - var _g27 = 0; - var _g117 = _this45.sizeVec3; - while(_g27 < _g117) { - var i16 = _g27++; - newArray16[i16] = _this45.stackVec3[i16]; - _this45.stackVec3[i16] = null; + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; } - _this45.stackVec3 = newArray16; + _this28.stackVec3 = newArray; } - _this45.stackVec3[_this45.sizeVec3++] = basisY2; + _this28.stackVec3[_this28.sizeVec3++] = basisY2; } - var _this46 = this._pool; + let _this29 = this._pool; if(basisZ2 != null) { basisZ2.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newArray17 = new Array(_this46.sizeVec3 << 1); - var _g28 = 0; - var _g118 = _this46.sizeVec3; - while(_g28 < _g118) { - var i17 = _g28++; - newArray17[i17] = _this46.stackVec3[i17]; - _this46.stackVec3[i17] = null; + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this46.stackVec3 = newArray17; + _this29.stackVec3 = newArray; } - _this46.stackVec3[_this46.sizeVec3++] = basisZ2; + _this29.stackVec3[_this29.sizeVec3++] = basisZ2; } - j = n1; + j = n; } } } - ,_drawRotationalLimit: function(d,center,ex,ey,needle,radius,min,max,color) { + _drawRotationalLimit(d,center,ex,ey,needle,radius,min,max,color) { if(min != max) { - var _this = this._pool; - var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this = this._pool; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; + let _this2 = _this1; _this2.x += needle.x * radius; _this2.y += needle.y * radius; _this2.z += needle.z * radius; - var _this3 = this._pool; + d.line(center,_this2,color); + let _this3 = this._pool; if(_this2 != null) { _this2.zero(); if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newArray = new Array(_this3.sizeVec3 << 1); - var _g = 0; - var _g1 = _this3.sizeVec3; + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this3.stackVec3[i]; _this3.stackVec3[i] = null; } @@ -17905,35 +18035,36 @@ oimo_dynamics_World.prototype = { } } } - ,_drawTranslationalLimit: function(d,center,ex,min,max,color) { + _drawTranslationalLimit(d,center,ex,min,max,color) { if(min < max) { - var _this = this._pool; - var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this = this._pool; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; + let _this2 = _this1; _this2.x += ex.x * min; _this2.y += ex.y * min; _this2.z += ex.z * min; - var _this3 = this._pool; - var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this3 = this._pool; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = center.x; _this4.y = center.y; _this4.z = center.z; - var _this5 = _this4; + let _this5 = _this4; _this5.x += ex.x * max; _this5.y += ex.y * max; _this5.z += ex.z * max; - var _this6 = this._pool; + d.line(_this2,_this5,color); + let _this6 = this._pool; if(_this2 != null) { _this2.zero(); if(_this6.sizeVec3 == _this6.stackVec3.length) { - var newArray = new Array(_this6.sizeVec3 << 1); - var _g = 0; - var _g1 = _this6.sizeVec3; + let newArray = new Array(_this6.sizeVec3 << 1); + let _g = 0; + let _g1 = _this6.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this6.stackVec3[i]; _this6.stackVec3[i] = null; } @@ -17941,49 +18072,49 @@ oimo_dynamics_World.prototype = { } _this6.stackVec3[_this6.sizeVec3++] = _this2; } - var _this7 = this._pool; + let _this7 = this._pool; if(_this5 != null) { _this5.zero(); if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newArray1 = new Array(_this7.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this7.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this7.stackVec3[i1]; - _this7.stackVec3[i1] = null; + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this7.stackVec3 = newArray1; + _this7.stackVec3 = newArray; } _this7.stackVec3[_this7.sizeVec3++] = _this5; } } } - ,_drawTranslationalLimit3D: function(d,center,ex,ey,ez,xlm,ylm,zlm,color) { - var minx = xlm.lowerLimit; - var maxx = xlm.upperLimit; - var miny = ylm.lowerLimit; - var maxy = ylm.upperLimit; - var minz = zlm.lowerLimit; - var maxz = zlm.upperLimit; - var _this = this._pool; + _drawTranslationalLimit3D(d,center,ex,ey,ez,xlm,ylm,zlm,color) { + let minx = xlm.lowerLimit; + let maxx = xlm.upperLimit; + let miny = ylm.lowerLimit; + let maxy = ylm.upperLimit; + let minz = zlm.lowerLimit; + let maxz = zlm.upperLimit; + let _this = this._pool; if(_this.sizeVec3 == 0) { new oimo_common_Vec3(); } else { --_this.sizeVec3; } - var _this1 = this._pool; + let _this1 = this._pool; if(_this1.sizeVec3 == 0) { new oimo_common_Vec3(); } else { --_this1.sizeVec3; } - var _this2 = this._pool; - var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this2 = this._pool; + let _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; _this3.x = center.x; _this3.y = center.y; _this3.z = center.z; - var _this4 = _this3; + let _this4 = _this3; _this4.x += ex.x * minx; _this4.y += ex.y * minx; _this4.z += ex.z * minx; @@ -17993,12 +18124,12 @@ oimo_dynamics_World.prototype = { _this4.x += ez.x * minz; _this4.y += ez.y * minz; _this4.z += ez.z * minz; - var _this5 = this._pool; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this5 = this._pool; + let _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = center.x; _this6.y = center.y; _this6.z = center.z; - var _this7 = _this6; + let _this7 = _this6; _this7.x += ex.x * minx; _this7.y += ex.y * minx; _this7.z += ex.z * minx; @@ -18008,12 +18139,12 @@ oimo_dynamics_World.prototype = { _this7.x += ez.x * maxz; _this7.y += ez.y * maxz; _this7.z += ez.z * maxz; - var _this8 = this._pool; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this8 = this._pool; + let _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = center.x; _this9.y = center.y; _this9.z = center.z; - var _this10 = _this9; + let _this10 = _this9; _this10.x += ex.x * minx; _this10.y += ex.y * minx; _this10.z += ex.z * minx; @@ -18023,12 +18154,12 @@ oimo_dynamics_World.prototype = { _this10.x += ez.x * minz; _this10.y += ez.y * minz; _this10.z += ez.z * minz; - var _this11 = this._pool; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + let _this11 = this._pool; + let _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; _this12.x = center.x; _this12.y = center.y; _this12.z = center.z; - var _this13 = _this12; + let _this13 = _this12; _this13.x += ex.x * minx; _this13.y += ex.y * minx; _this13.z += ex.z * minx; @@ -18038,12 +18169,12 @@ oimo_dynamics_World.prototype = { _this13.x += ez.x * maxz; _this13.y += ez.y * maxz; _this13.z += ez.z * maxz; - var _this14 = this._pool; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + let _this14 = this._pool; + let _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; _this15.x = center.x; _this15.y = center.y; _this15.z = center.z; - var _this16 = _this15; + let _this16 = _this15; _this16.x += ex.x * maxx; _this16.y += ex.y * maxx; _this16.z += ex.z * maxx; @@ -18053,12 +18184,12 @@ oimo_dynamics_World.prototype = { _this16.x += ez.x * minz; _this16.y += ez.y * minz; _this16.z += ez.z * minz; - var _this17 = this._pool; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + let _this17 = this._pool; + let _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; _this18.x = center.x; _this18.y = center.y; _this18.z = center.z; - var _this19 = _this18; + let _this19 = _this18; _this19.x += ex.x * maxx; _this19.y += ex.y * maxx; _this19.z += ex.z * maxx; @@ -18068,12 +18199,12 @@ oimo_dynamics_World.prototype = { _this19.x += ez.x * maxz; _this19.y += ez.y * maxz; _this19.z += ez.z * maxz; - var _this20 = this._pool; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + let _this20 = this._pool; + let _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; _this21.x = center.x; _this21.y = center.y; _this21.z = center.z; - var _this22 = _this21; + let _this22 = _this21; _this22.x += ex.x * maxx; _this22.y += ex.y * maxx; _this22.z += ex.z * maxx; @@ -18083,12 +18214,12 @@ oimo_dynamics_World.prototype = { _this22.x += ez.x * minz; _this22.y += ez.y * minz; _this22.z += ez.z * minz; - var _this23 = this._pool; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + let _this23 = this._pool; + let _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; _this24.x = center.x; _this24.y = center.y; _this24.z = center.z; - var _this25 = _this24; + let _this25 = _this24; _this25.x += ex.x * maxx; _this25.y += ex.y * maxx; _this25.z += ex.z * maxx; @@ -18098,15 +18229,27 @@ oimo_dynamics_World.prototype = { _this25.x += ez.x * maxz; _this25.y += ez.y * maxz; _this25.z += ez.z * maxz; - var _this26 = this._pool; + d.line(_this4,_this16,color); + d.line(_this10,_this22,color); + d.line(_this7,_this19,color); + d.line(_this13,_this25,color); + d.line(_this4,_this10,color); + d.line(_this16,_this22,color); + d.line(_this7,_this13,color); + d.line(_this19,_this25,color); + d.line(_this4,_this7,color); + d.line(_this16,_this19,color); + d.line(_this10,_this13,color); + d.line(_this22,_this25,color); + let _this26 = this._pool; if(_this4 != null) { _this4.zero(); if(_this26.sizeVec3 == _this26.stackVec3.length) { - var newArray = new Array(_this26.sizeVec3 << 1); - var _g = 0; - var _g1 = _this26.sizeVec3; + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this26.stackVec3[i]; _this26.stackVec3[i] = null; } @@ -18114,145 +18257,145 @@ oimo_dynamics_World.prototype = { } _this26.stackVec3[_this26.sizeVec3++] = _this4; } - var _this27 = this._pool; + let _this27 = this._pool; if(_this7 != null) { _this7.zero(); if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newArray1 = new Array(_this27.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this27.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this27.stackVec3[i1]; - _this27.stackVec3[i1] = null; + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; } - _this27.stackVec3 = newArray1; + _this27.stackVec3 = newArray; } _this27.stackVec3[_this27.sizeVec3++] = _this7; } - var _this28 = this._pool; + let _this28 = this._pool; if(_this10 != null) { _this10.zero(); if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newArray2 = new Array(_this28.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this28.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this28.stackVec3[i2]; - _this28.stackVec3[i2] = null; + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; } - _this28.stackVec3 = newArray2; + _this28.stackVec3 = newArray; } _this28.stackVec3[_this28.sizeVec3++] = _this10; } - var _this29 = this._pool; + let _this29 = this._pool; if(_this13 != null) { _this13.zero(); if(_this29.sizeVec3 == _this29.stackVec3.length) { - var newArray3 = new Array(_this29.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this29.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this29.stackVec3[i3]; - _this29.stackVec3[i3] = null; + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this29.stackVec3 = newArray3; + _this29.stackVec3 = newArray; } _this29.stackVec3[_this29.sizeVec3++] = _this13; } - var _this30 = this._pool; + let _this30 = this._pool; if(_this16 != null) { _this16.zero(); if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newArray4 = new Array(_this30.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this30.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this30.stackVec3[i4]; - _this30.stackVec3[i4] = null; + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this30.stackVec3 = newArray4; + _this30.stackVec3 = newArray; } _this30.stackVec3[_this30.sizeVec3++] = _this16; } - var _this31 = this._pool; + let _this31 = this._pool; if(_this19 != null) { _this19.zero(); if(_this31.sizeVec3 == _this31.stackVec3.length) { - var newArray5 = new Array(_this31.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this31.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this31.stackVec3[i5]; - _this31.stackVec3[i5] = null; + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this31.stackVec3 = newArray5; + _this31.stackVec3 = newArray; } _this31.stackVec3[_this31.sizeVec3++] = _this19; } - var _this32 = this._pool; + let _this32 = this._pool; if(_this22 != null) { _this22.zero(); if(_this32.sizeVec3 == _this32.stackVec3.length) { - var newArray6 = new Array(_this32.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this32.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this32.stackVec3[i6]; - _this32.stackVec3[i6] = null; + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this32.stackVec3 = newArray6; + _this32.stackVec3 = newArray; } _this32.stackVec3[_this32.sizeVec3++] = _this22; } - var _this33 = this._pool; + let _this33 = this._pool; if(_this25 != null) { _this25.zero(); if(_this33.sizeVec3 == _this33.stackVec3.length) { - var newArray7 = new Array(_this33.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this33.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this33.stackVec3[i7]; - _this33.stackVec3[i7] = null; + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this33.stackVec3 = newArray7; + _this33.stackVec3 = newArray; } _this33.stackVec3[_this33.sizeVec3++] = _this25; } } - ,_drawEllipseOnSphere: function(d,center,normal,x,y,radiansX,radiansY,radius,color) { - var theta = 0; - var _this = this._pool; - var rotVec = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var rotQ = _this1.sizeQuat == 0 ? new oimo_common_Quat() : _this1.stackQuat[--_this1.sizeQuat]; - var _this2 = this._pool; - var rotM = _this2.sizeMat3 == 0 ? new oimo_common_Mat3() : _this2.stackMat3[--_this2.sizeMat3]; - var _this3 = this._pool; - var prevV = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _g = 0; + _drawEllipseOnSphere(d,center,normal,x,y,radiansX,radiansY,radius,color) { + let theta = 0; + let _this = this._pool; + let rotVec = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this._pool; + let rotQ = _this1.sizeQuat == 0 ? new oimo_common_Quat() : _this1.stackQuat[--_this1.sizeQuat]; + let _this2 = this._pool; + let rotM = _this2.sizeMat3 == 0 ? new oimo_common_Mat3() : _this2.stackMat3[--_this2.sizeMat3]; + let _this3 = this._pool; + let prevV = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _g = 0; while(_g < 17) { - _g++; - var rx = Math.cos(theta) * radiansX; - var ry = Math.sin(theta) * radiansY; - var halfRotAng = Math.sqrt(rx * rx + ry * ry); - var rotSin = Math.sin(halfRotAng * 0.5); - var rotCos = Math.cos(halfRotAng * 0.5); - var _this4 = rotVec.zero(); - _this4.x += x.x * rx; - _this4.y += x.y * rx; - _this4.z += x.z * rx; - _this4.x += y.x * ry; - _this4.y += y.y * ry; - _this4.z += y.z * ry; - var s = 1 / halfRotAng * rotSin; + let i = _g++; + let rx = Math.cos(theta) * radiansX; + let ry = Math.sin(theta) * radiansY; + let halfRotAng = Math.sqrt(rx * rx + ry * ry); + let rotSin = Math.sin(halfRotAng * 0.5); + let rotCos = Math.cos(halfRotAng * 0.5); + let _this = rotVec.zero(); + _this.x += x.x * rx; + _this.y += x.y * rx; + _this.z += x.z * rx; + _this.x += y.x * ry; + _this.y += y.y * ry; + _this.z += y.z * ry; + let s = 1 / halfRotAng * rotSin; rotVec.x *= s; rotVec.y *= s; rotVec.z *= s; @@ -18260,22 +18403,22 @@ oimo_dynamics_World.prototype = { rotQ.y = rotVec.y; rotQ.z = rotVec.z; rotQ.w = rotCos; - var x1 = rotQ.x; - var y1 = rotQ.y; - var z = rotQ.z; - var w = rotQ.w; - var x2 = 2 * x1; - var y2 = 2 * y1; - var z2 = 2 * z; - var xx = x1 * x2; - var yy = y1 * y2; - var zz = z * z2; - var xy = x1 * y2; - var yz = y1 * z2; - var xz = x1 * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x1 = rotQ.x; + let y1 = rotQ.y; + let z = rotQ.z; + let w = rotQ.w; + let x2 = 2 * x1; + let y2 = 2 * y1; + let z2 = 2 * z; + let xx = x1 * x2; + let yy = y1 * y2; + let zz = z * z2; + let xy = x1 * y2; + let yz = y1 * z2; + let xz = x1 * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; rotM.e00 = 1 - yy - zz; rotM.e01 = xy - wz; rotM.e02 = xz + wy; @@ -18285,75 +18428,78 @@ oimo_dynamics_World.prototype = { rotM.e20 = xz - wy; rotM.e21 = yz + wx; rotM.e22 = 1 - xx - yy; - var _this5 = this._pool; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - _this6.x += normal.x * radius; - _this6.y += normal.y * radius; - _this6.z += normal.z * radius; - var v = _this6; - var y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; - var z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; + let _this1 = this._pool; + let _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x += normal.x * radius; + _this2.y += normal.y * radius; + _this2.z += normal.z * radius; + let v = _this2; + let y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; + let z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; v.x = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; v.y = y3; v.z = z1; v.x += center.x; v.y += center.y; v.z += center.z; - var _this7 = this._pool; + if(i >= 1) { + d.line(prevV,v,color); + } + let _this3 = this._pool; if(prevV != null) { prevV.zero(); - if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newArray = new Array(_this7.sizeVec3 << 1); - var _g1 = 0; - var _g11 = _this7.sizeVec3; - while(_g1 < _g11) { - var i = _g1++; - newArray[i] = _this7.stackVec3[i]; - _this7.stackVec3[i] = null; + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this7.stackVec3 = newArray; + _this3.stackVec3 = newArray; } - _this7.stackVec3[_this7.sizeVec3++] = prevV; + _this3.stackVec3[_this3.sizeVec3++] = prevV; } prevV = v; theta += 0.39269908169872375; } - var _this8 = this._pool; + let _this4 = this._pool; if(rotVec != null) { rotVec.zero(); - if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray1 = new Array(_this8.sizeVec3 << 1); - var _g2 = 0; - var _g12 = _this8.sizeVec3; - while(_g2 < _g12) { - var i1 = _g2++; - newArray1[i1] = _this8.stackVec3[i1]; - _this8.stackVec3[i1] = null; + if(_this4.sizeVec3 == _this4.stackVec3.length) { + let newArray = new Array(_this4.sizeVec3 << 1); + let _g = 0; + let _g1 = _this4.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this4.stackVec3[i]; + _this4.stackVec3[i] = null; } - _this8.stackVec3 = newArray1; + _this4.stackVec3 = newArray; } - _this8.stackVec3[_this8.sizeVec3++] = rotVec; + _this4.stackVec3[_this4.sizeVec3++] = rotVec; } - var _this9 = this._pool; + let _this5 = this._pool; if(rotQ != null) { rotQ.x = 0; rotQ.y = 0; rotQ.z = 0; rotQ.w = 1; - if(_this9.sizeQuat == _this9.stackQuat.length) { - var newArray2 = new Array(_this9.sizeQuat << 1); - var _g3 = 0; - var _g13 = _this9.sizeQuat; - while(_g3 < _g13) { - var i2 = _g3++; - newArray2[i2] = _this9.stackQuat[i2]; - _this9.stackQuat[i2] = null; + if(_this5.sizeQuat == _this5.stackQuat.length) { + let newArray = new Array(_this5.sizeQuat << 1); + let _g = 0; + let _g1 = _this5.sizeQuat; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this5.stackQuat[i]; + _this5.stackQuat[i] = null; } - _this9.stackQuat = newArray2; + _this5.stackQuat = newArray; } - _this9.stackQuat[_this9.sizeQuat++] = rotQ; + _this5.stackQuat[_this5.sizeQuat++] = rotQ; } - var _this10 = this._pool; + let _this6 = this._pool; if(rotM != null) { rotM.e00 = 1; rotM.e01 = 0; @@ -18364,48 +18510,48 @@ oimo_dynamics_World.prototype = { rotM.e20 = 0; rotM.e21 = 0; rotM.e22 = 1; - if(_this10.sizeMat3 == _this10.stackMat3.length) { - var newArray3 = new Array(_this10.sizeMat3 << 1); - var _g4 = 0; - var _g14 = _this10.sizeMat3; - while(_g4 < _g14) { - var i3 = _g4++; - newArray3[i3] = _this10.stackMat3[i3]; - _this10.stackMat3[i3] = null; + if(_this6.sizeMat3 == _this6.stackMat3.length) { + let newArray = new Array(_this6.sizeMat3 << 1); + let _g = 0; + let _g1 = _this6.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this6.stackMat3[i]; + _this6.stackMat3[i] = null; } - _this10.stackMat3 = newArray3; + _this6.stackMat3 = newArray; } - _this10.stackMat3[_this10.sizeMat3++] = rotM; + _this6.stackMat3[_this6.sizeMat3++] = rotM; } - var _this11 = this._pool; + let _this7 = this._pool; if(prevV != null) { prevV.zero(); - if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray4 = new Array(_this11.sizeVec3 << 1); - var _g5 = 0; - var _g15 = _this11.sizeVec3; - while(_g5 < _g15) { - var i4 = _g5++; - newArray4[i4] = _this11.stackVec3[i4]; - _this11.stackVec3[i4] = null; + if(_this7.sizeVec3 == _this7.stackVec3.length) { + let newArray = new Array(_this7.sizeVec3 << 1); + let _g = 0; + let _g1 = _this7.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this7.stackVec3[i]; + _this7.stackVec3[i] = null; } - _this11.stackVec3 = newArray4; + _this7.stackVec3 = newArray; } - _this11.stackVec3[_this11.sizeVec3++] = prevV; + _this7.stackVec3[_this7.sizeVec3++] = prevV; } } - ,step: function(timeStep) { + step(timeStep) { if(this._timeStep.dt > 0) { this._timeStep.dtRatio = timeStep / this._timeStep.dt; } this._timeStep.dt = timeStep; this._timeStep.invDt = 1 / timeStep; - var st = Date.now() / 1000; + let st = HxOverrides.now() / 1000; this._updateContacts(); this._solveIslands(); - oimo_dynamics_common_Performance.totalTime = (Date.now() / 1000 - st) * 1000; + oimo_dynamics_common_Performance.totalTime = (HxOverrides.now() / 1000 - st) * 1000; } - ,addRigidBody: function(rigidBody) { + addRigidBody(rigidBody) { if(rigidBody._world != null) { throw new Error("A rigid body cannot belong to multiple worlds."); } @@ -18418,9 +18564,9 @@ oimo_dynamics_World.prototype = { this._rigidBodyListLast = rigidBody; } rigidBody._world = this; - var s = rigidBody._shapeList; + let s = rigidBody._shapeList; while(s != null) { - var n = s._next; + let n = s._next; s._proxy = this._broadPhase.createProxy(s,s._aabb); s._id = this._shapeIdCount++; this._numShapes++; @@ -18428,12 +18574,12 @@ oimo_dynamics_World.prototype = { } this._numRigidBodies++; } - ,removeRigidBody: function(rigidBody) { + removeRigidBody(rigidBody) { if(rigidBody._world != this) { throw new Error("The rigid body doesn't belong to the world."); } - var prev = rigidBody._prev; - var next = rigidBody._next; + let prev = rigidBody._prev; + let next = rigidBody._next; if(prev != null) { prev._next = next; } @@ -18449,28 +18595,28 @@ oimo_dynamics_World.prototype = { rigidBody._next = null; rigidBody._prev = null; rigidBody._world = null; - var s = rigidBody._shapeList; + let s = rigidBody._shapeList; while(s != null) { - var n = s._next; + let n = s._next; this._broadPhase.destroyProxy(s._proxy); s._proxy = null; s._id = -1; - var cl = s._rigidBody._contactLinkList; + let cl = s._rigidBody._contactLinkList; while(cl != null) { - var n1 = cl._next; - var c = cl._contact; + let n = cl._next; + let c = cl._contact; if(c._s1 == s || c._s2 == s) { - var _this = cl._other; + let _this = cl._other; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + let _this1 = this._contactManager; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this1._contactList) { _this1._contactList = _this1._contactList._next; @@ -18481,18 +18627,25 @@ oimo_dynamics_World.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -18502,13 +18655,13 @@ oimo_dynamics_World.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -18532,7 +18685,7 @@ oimo_dynamics_World.prototype = { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this2 = c._contactConstraint; + let _this2 = c._contactConstraint; _this2._s1 = null; _this2._s2 = null; _this2._b1 = null; @@ -18543,14 +18696,14 @@ oimo_dynamics_World.prototype = { _this1._contactPool = c; _this1._numContacts--; } - cl = n1; + cl = n; } this._numShapes--; s = n; } this._numRigidBodies--; } - ,addJoint: function(joint) { + addJoint(joint) { if(joint._world != null) { throw new Error("A joint cannot belong to multiple worlds."); } @@ -18583,21 +18736,21 @@ oimo_dynamics_World.prototype = { } joint._b1._numJointLinks++; joint._b2._numJointLinks++; - var _this = joint._b1; + let _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; + let _this1 = joint._b2; _this1._sleeping = false; _this1._sleepTime = 0; joint._syncAnchors(); this._numJoints++; } - ,removeJoint: function(joint) { + removeJoint(joint) { if(joint._world != this) { throw new Error("The joint doesn't belong to the world."); } - var prev = joint._prev; - var next = joint._next; + let prev = joint._prev; + let next = joint._next; if(prev != null) { prev._next = next; } @@ -18613,8 +18766,8 @@ oimo_dynamics_World.prototype = { joint._next = null; joint._prev = null; joint._world = null; - var prev1 = joint._link1._prev; - var next1 = joint._link1._next; + let prev1 = joint._link1._prev; + let next1 = joint._link1._next; if(prev1 != null) { prev1._next = next1; } @@ -18629,8 +18782,8 @@ oimo_dynamics_World.prototype = { } joint._link1._next = null; joint._link1._prev = null; - var prev2 = joint._link2._prev; - var next2 = joint._link2._next; + let prev2 = joint._link2._prev; + let next2 = joint._link2._next; if(prev2 != null) { prev2._next = next2; } @@ -18649,21 +18802,21 @@ oimo_dynamics_World.prototype = { joint._link2._other = null; joint._b1._numJointLinks--; joint._b2._numJointLinks--; - var _this = joint._b1; + let _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; + let _this1 = joint._b2; _this1._sleeping = false; _this1._sleepTime = 0; this._numJoints--; } - ,setDebugDraw: function(debugDraw) { + setDebugDraw(debugDraw) { this._debugDraw = debugDraw; } - ,getDebugDraw: function() { + getDebugDraw() { return this._debugDraw; } - ,debugDraw: function() { + debugDraw() { if(this._debugDraw != null) { if(this._broadPhase._type == 2) { this._drawBvh(this._debugDraw,this._broadPhase._tree); @@ -18672,21 +18825,21 @@ oimo_dynamics_World.prototype = { this._drawConstraints(this._debugDraw); } } - ,rayCast: function(begin,end,callback) { - var _this = this._rayCastWrapper.begin; + rayCast(begin,end,callback) { + let _this = this._rayCastWrapper.begin; _this.x = begin.x; _this.y = begin.y; _this.z = begin.z; - var _this1 = this._rayCastWrapper.end; + let _this1 = this._rayCastWrapper.end; _this1.x = end.x; _this1.y = end.y; _this1.z = end.z; this._rayCastWrapper.callback = callback; this._broadPhase.rayCast(begin,end,this._rayCastWrapper); } - ,convexCast: function(convex,begin,translation,callback) { + convexCast(convex,begin,translation,callback) { this._convexCastWrapper.convex = convex; - var _this = this._convexCastWrapper.begin; + let _this = this._convexCastWrapper.begin; _this._positionX = begin._positionX; _this._positionY = begin._positionY; _this._positionZ = begin._positionZ; @@ -18699,94 +18852,92 @@ oimo_dynamics_World.prototype = { _this._rotation20 = begin._rotation20; _this._rotation21 = begin._rotation21; _this._rotation22 = begin._rotation22; - var _this1 = this._convexCastWrapper.translation; + let _this1 = this._convexCastWrapper.translation; _this1.x = translation.x; _this1.y = translation.y; _this1.z = translation.z; this._convexCastWrapper.callback = callback; this._broadPhase.convexCast(convex,begin,translation,this._convexCastWrapper); } - ,aabbTest: function(aabb,callback) { + aabbTest(aabb,callback) { this._aabbTestWrapper._aabb.copyFrom(aabb); this._aabbTestWrapper._callback = callback; this._broadPhase.aabbTest(aabb,this._aabbTestWrapper); } - ,getRigidBodyList: function() { + getRigidBodyList() { return this._rigidBodyList; } - ,getJointList: function() { + getJointList() { return this._jointList; } - ,getBroadPhase: function() { + getBroadPhase() { return this._broadPhase; } - ,getContactManager: function() { + getContactManager() { return this._contactManager; } - ,getNumRigidBodies: function() { + getNumRigidBodies() { return this._numRigidBodies; } - ,getNumJoints: function() { + getNumJoints() { return this._numJoints; } - ,getNumShapes: function() { + getNumShapes() { return this._numShapes; } - ,getNumIslands: function() { + getNumIslands() { return this._numIslands; } - ,getNumVelocityIterations: function() { + getNumVelocityIterations() { return this._numVelocityIterations; } - ,setNumVelocityIterations: function(numVelocityIterations) { + setNumVelocityIterations(numVelocityIterations) { this._numVelocityIterations = numVelocityIterations; } - ,getNumPositionIterations: function() { + getNumPositionIterations() { return this._numPositionIterations; } - ,setNumPositionIterations: function(numPositionIterations) { + setNumPositionIterations(numPositionIterations) { this._numPositionIterations = numPositionIterations; } - ,getGravity: function() { + getGravity() { return this._gravity; } - ,setGravity: function(gravity) { - var _this = this._gravity; + setGravity(gravity) { + let _this = this._gravity; _this.x = gravity.x; _this.y = gravity.y; _this.z = gravity.z; } -}; -var oimo_dynamics__$World_RayCastWrapper = function() { - oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); - this.rayCastHit = new oimo_collision_geometry_RayCastHit(); - this.begin = new oimo_common_Vec3(); - this.end = new oimo_common_Vec3(); - this.callback = null; -}; -oimo_dynamics__$World_RayCastWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; -oimo_dynamics__$World_RayCastWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ - process: function(proxy) { - var shape = proxy.userData; +} +class oimo_dynamics__$World_RayCastWrapper extends oimo_collision_broadphase_BroadPhaseProxyCallback { + constructor() { + super(); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); + this.begin = new oimo_common_Vec3(); + this.end = new oimo_common_Vec3(); + this.callback = null; + } + process(proxy) { + let shape = proxy.userData; if(shape._geom.rayCast(this.begin,this.end,shape._transform,this.rayCastHit)) { this.callback.process(shape,this.rayCastHit); } } -}); -var oimo_dynamics__$World_ConvexCastWrapper = function() { - oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); - this.rayCastHit = new oimo_collision_geometry_RayCastHit(); - this.begin = new oimo_common_Transform(); - this.translation = new oimo_common_Vec3(); - this.zero = new oimo_common_Vec3(); - this.callback = null; - this.convex = null; -}; -oimo_dynamics__$World_ConvexCastWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; -oimo_dynamics__$World_ConvexCastWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ - process: function(proxy) { - var shape = proxy.userData; - var type = shape._geom._type; +} +class oimo_dynamics__$World_ConvexCastWrapper extends oimo_collision_broadphase_BroadPhaseProxyCallback { + constructor() { + super(); + this.rayCastHit = new oimo_collision_geometry_RayCastHit(); + this.begin = new oimo_common_Transform(); + this.translation = new oimo_common_Vec3(); + this.zero = new oimo_common_Vec3(); + this.callback = null; + this.convex = null; + } + process(proxy) { + let shape = proxy.userData; + let type = shape._geom._type; if(type < 0 || type > 5) { return; } @@ -18794,155 +18945,169 @@ oimo_dynamics__$World_ConvexCastWrapper.prototype = $extend(oimo_collision_broad this.callback.process(shape,this.rayCastHit); } } -}); -var oimo_dynamics__$World_AabbTestWrapper = function() { - oimo_collision_broadphase_BroadPhaseProxyCallback.call(this); - this._aabb = new oimo_collision_geometry_Aabb(); - this._callback = null; -}; -oimo_dynamics__$World_AabbTestWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; -oimo_dynamics__$World_AabbTestWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ - process: function(proxy) { - var shapeAabb = proxy.userData._aabb; - } -}); -var oimo_dynamics_callback_AabbTestCallback = function() { -}; -oimo_dynamics_callback_AabbTestCallback.prototype = { - process: function(shape) { - } -}; -var oimo_dynamics_callback_ContactCallback = function() { -}; -oimo_dynamics_callback_ContactCallback.prototype = { - beginContact: function(c) { - } - ,preSolve: function(c) { - } - ,postSolve: function(c) { - } - ,endContact: function(c) { - } -}; -var oimo_dynamics_callback_RayCastCallback = function() { -}; -oimo_dynamics_callback_RayCastCallback.prototype = { - process: function(shape,hit) { - } -}; -var oimo_dynamics_callback_RayCastClosest = function() { - oimo_dynamics_callback_RayCastCallback.call(this); - this.position = new oimo_common_Vec3(); - this.normal = new oimo_common_Vec3(); - this.shape = null; - this.fraction = 1; - this.position.zero(); - this.normal.zero(); - this.hit = false; -}; -oimo_dynamics_callback_RayCastClosest.__super__ = oimo_dynamics_callback_RayCastCallback; -oimo_dynamics_callback_RayCastClosest.prototype = $extend(oimo_dynamics_callback_RayCastCallback.prototype,{ - clear: function() { +} +class oimo_dynamics__$World_AabbTestWrapper extends oimo_collision_broadphase_BroadPhaseProxyCallback { + constructor() { + super(); + this._aabb = new oimo_collision_geometry_Aabb(); + this._callback = null; + } + process(proxy) { + let shape = proxy.userData; + let shapeAabb = shape._aabb; + if(shapeAabb._minX < this._aabb._maxX && shapeAabb._maxX > this._aabb._minX && shapeAabb._minY < this._aabb._maxY && shapeAabb._maxY > this._aabb._minY && shapeAabb._minZ < this._aabb._maxZ && shapeAabb._maxZ > this._aabb._minZ) { + this._callback.process(shape); + } + } +} +class oimo_dynamics_callback_AabbTestCallback { + constructor() { + } + process(shape) { + } +} +class oimo_dynamics_callback_ContactCallback { + constructor() { + } + beginContact(c) { + } + preSolve(c) { + } + postSolve(c) { + } + endContact(c) { + } +} +class oimo_dynamics_callback_RayCastCallback { + constructor() { + } + process(shape,hit) { + } +} +class oimo_dynamics_callback_RayCastClosest extends oimo_dynamics_callback_RayCastCallback { + constructor() { + super(); + this.position = new oimo_common_Vec3(); + this.normal = new oimo_common_Vec3(); + this.shape = null; + this.fraction = 1; + this.position.zero(); + this.normal.zero(); + this.hit = false; + } + clear() { this.shape = null; this.fraction = 1; this.position.zero(); this.normal.zero(); this.hit = false; } - ,process: function(shape,hit) { + process(shape,hit) { if(hit.fraction < this.fraction) { this.shape = shape; this.hit = true; this.fraction = hit.fraction; - var _this = this.position; - var v = hit.position; + let _this = this.position; + let v = hit.position; _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.normal; - var v1 = hit.normal; + let _this1 = this.normal; + let v1 = hit.normal; _this1.x = v1.x; _this1.y = v1.y; _this1.z = v1.z; } } -}); -var oimo_dynamics_common_DebugDraw = function() { - this.p = new oimo_common_Pool(); - this.wireframe = false; - this.drawShapes = true; - this.drawBvh = false; - this.drawBvhMinLevel = 0; - this.drawBvhMaxLevel = 65536; - this.drawAabbs = false; - this.drawBases = false; - this.drawPairs = false; - this.drawContacts = false; - this.drawJoints = true; - this.drawJointLimits = false; - this.sphereCoords = new Array(5); - this.tmpSphereVerts = new Array(5); - this.tmpSphereNorms = new Array(5); - var _g = 0; - while(_g < 5) { - var i = _g++; - var num = i == 0 || i == 4 ? 1 : 8; - this.sphereCoords[i] = new Array(num); - this.tmpSphereVerts[i] = new Array(num); - this.tmpSphereNorms[i] = new Array(num); - var _g1 = 0; +} +class oimo_dynamics_common_DebugDraw { + constructor() { + this.p = new oimo_common_Pool(); + this.wireframe = false; + this.drawShapes = true; + this.drawBvh = false; + this.drawBvhMinLevel = 0; + this.drawBvhMaxLevel = 65536; + this.drawAabbs = false; + this.drawBases = false; + this.drawPairs = false; + this.drawContacts = false; + this.drawJoints = true; + this.drawJointLimits = false; + this.sphereCoords = new Array(5); + this.tmpSphereVerts = new Array(5); + this.tmpSphereNorms = new Array(5); + let _g = 0; + while(_g < 5) { + let i = _g++; + let num = i == 0 || i == 4 ? 1 : 8; + this.sphereCoords[i] = new Array(num); + this.tmpSphereVerts[i] = new Array(num); + this.tmpSphereNorms[i] = new Array(num); + let _g1 = 0; + while(_g1 < 8) { + let j = _g1++; + let theta = i * 0.7853981633974475; + let phi = j * 0.7853981633974475; + this.sphereCoords[i][j] = new oimo_common_Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); + this.tmpSphereVerts[i][j] = new oimo_common_Vec3(); + this.tmpSphereNorms[i][j] = new oimo_common_Vec3(); + } + } + this.circleCoords = new Array(8); + this.circleCoordsShift = new Array(8); + this.tmpCircleVerts1 = new Array(8); + this.tmpCircleVerts2 = new Array(8); + this.tmpCircleNorms = new Array(8); + let _g1 = 0; while(_g1 < 8) { - var j = _g1++; - var theta = i * 0.7853981633974475; - var phi = j * 0.7853981633974475; - this.sphereCoords[i][j] = new oimo_common_Vec3(Math.sin(theta) * Math.cos(phi),Math.cos(theta),-Math.sin(theta) * Math.sin(phi)); - this.tmpSphereVerts[i][j] = new oimo_common_Vec3(); - this.tmpSphereNorms[i][j] = new oimo_common_Vec3(); - } - } - this.circleCoords = new Array(8); - this.circleCoordsShift = new Array(8); - this.tmpCircleVerts1 = new Array(8); - this.tmpCircleVerts2 = new Array(8); - this.tmpCircleNorms = new Array(8); - var _g2 = 0; - while(_g2 < 8) { - var i1 = _g2++; - this.circleCoords[i1] = new oimo_common_Vec3(Math.cos(i1 * 0.7853981633974475),0,-Math.sin(i1 * 0.7853981633974475)); - this.circleCoordsShift[i1] = new oimo_common_Vec3(Math.cos((i1 + 0.5) * 0.7853981633974475),0,-Math.sin((i1 + 0.5) * 0.7853981633974475)); - this.tmpCircleVerts1[i1] = new oimo_common_Vec3(); - this.tmpCircleVerts2[i1] = new oimo_common_Vec3(); - this.tmpCircleNorms[i1] = new oimo_common_Vec3(); - } - this.style = new oimo_dynamics_common_DebugDrawStyle(); -}; -oimo_dynamics_common_DebugDraw.prototype = { - aabb: function(min,max,color) { - var _this = this.p; - var v1 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); - var _this1 = this.p; - var v2 = (_this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); - var _this2 = this.p; - var v3 = (_this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); - var _this3 = this.p; - var v4 = (_this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); - var _this4 = this.p; - var v5 = (_this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); - var _this5 = this.p; - var v6 = (_this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); - var _this6 = this.p; - var v7 = (_this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); - var _this7 = this.p; - var v8 = (_this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); - var _this8 = this.p; + let i = _g1++; + this.circleCoords[i] = new oimo_common_Vec3(Math.cos(i * 0.7853981633974475),0,-Math.sin(i * 0.7853981633974475)); + this.circleCoordsShift[i] = new oimo_common_Vec3(Math.cos((i + 0.5) * 0.7853981633974475),0,-Math.sin((i + 0.5) * 0.7853981633974475)); + this.tmpCircleVerts1[i] = new oimo_common_Vec3(); + this.tmpCircleVerts2[i] = new oimo_common_Vec3(); + this.tmpCircleNorms[i] = new oimo_common_Vec3(); + } + this.style = new oimo_dynamics_common_DebugDrawStyle(); + } + aabb(min,max,color) { + let _this = this.p; + let v1 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); + let _this1 = this.p; + let v2 = (_this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); + let _this2 = this.p; + let v3 = (_this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); + let _this3 = this.p; + let v4 = (_this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); + let _this4 = this.p; + let v5 = (_this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); + let _this5 = this.p; + let v6 = (_this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); + let _this6 = this.p; + let v7 = (_this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); + let _this7 = this.p; + let v8 = (_this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); + this.line(v1,v2,color); + this.line(v3,v4,color); + this.line(v5,v6,color); + this.line(v7,v8,color); + this.line(v1,v3,color); + this.line(v2,v4,color); + this.line(v5,v7,color); + this.line(v6,v8,color); + this.line(v1,v5,color); + this.line(v2,v6,color); + this.line(v3,v7,color); + this.line(v4,v8,color); + let _this8 = this.p; if(v1 != null) { v1.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray = new Array(_this8.sizeVec3 << 1); - var _g = 0; - var _g1 = _this8.sizeVec3; + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -18950,135 +19115,135 @@ oimo_dynamics_common_DebugDraw.prototype = { } _this8.stackVec3[_this8.sizeVec3++] = v1; } - var _this9 = this.p; + let _this9 = this.p; if(v2 != null) { v2.zero(); if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newArray1 = new Array(_this9.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this9.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this9.stackVec3[i1]; - _this9.stackVec3[i1] = null; + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; } - _this9.stackVec3 = newArray1; + _this9.stackVec3 = newArray; } _this9.stackVec3[_this9.sizeVec3++] = v2; } - var _this10 = this.p; + let _this10 = this.p; if(v3 != null) { v3.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newArray2 = new Array(_this10.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this10.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this10.stackVec3[i2]; - _this10.stackVec3[i2] = null; + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this10.stackVec3 = newArray2; + _this10.stackVec3 = newArray; } _this10.stackVec3[_this10.sizeVec3++] = v3; } - var _this11 = this.p; + let _this11 = this.p; if(v4 != null) { v4.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray3 = new Array(_this11.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this11.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this11.stackVec3[i3]; - _this11.stackVec3[i3] = null; + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this11.stackVec3 = newArray3; + _this11.stackVec3 = newArray; } _this11.stackVec3[_this11.sizeVec3++] = v4; } - var _this12 = this.p; + let _this12 = this.p; if(v5 != null) { v5.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray4 = new Array(_this12.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this12.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this12.stackVec3[i4]; - _this12.stackVec3[i4] = null; + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this12.stackVec3 = newArray4; + _this12.stackVec3 = newArray; } _this12.stackVec3[_this12.sizeVec3++] = v5; } - var _this13 = this.p; + let _this13 = this.p; if(v6 != null) { v6.zero(); if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newArray5 = new Array(_this13.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this13.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this13.stackVec3[i5]; - _this13.stackVec3[i5] = null; + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this13.stackVec3 = newArray5; + _this13.stackVec3 = newArray; } _this13.stackVec3[_this13.sizeVec3++] = v6; } - var _this14 = this.p; + let _this14 = this.p; if(v7 != null) { v7.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray6 = new Array(_this14.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this14.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this14.stackVec3[i6]; - _this14.stackVec3[i6] = null; + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this14.stackVec3 = newArray6; + _this14.stackVec3 = newArray; } _this14.stackVec3[_this14.sizeVec3++] = v7; } - var _this15 = this.p; + let _this15 = this.p; if(v8 != null) { v8.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray7 = new Array(_this15.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this15.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this15.stackVec3[i7]; - _this15.stackVec3[i7] = null; + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this15.stackVec3 = newArray7; + _this15.stackVec3 = newArray; } _this15.stackVec3[_this15.sizeVec3++] = v8; } } - ,basis: function(transform,length,colorX,colorY,colorZ) { - var _this = this.p; - var pos = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var rot = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; - var _this2 = this.p; - var ex = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var ey = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var ez = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; - var v = pos; + basis(transform,length,colorX,colorY,colorZ) { + let _this = this.p; + let pos = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let rot = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + let _this2 = this.p; + let ex = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let ey = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let ez = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + let v = pos; v.x = transform._positionX; v.y = transform._positionY; v.z = transform._positionZ; - var m = rot; + let m = rot; m.e00 = transform._rotation00; m.e01 = transform._rotation01; m.e02 = transform._rotation02; @@ -19094,33 +19259,36 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.x *= length; ex.y *= length; ex.z *= length; - var _this5 = ex; + let _this5 = ex; _this5.x += pos.x; _this5.y += pos.y; _this5.z += pos.z; ey.x *= length; ey.y *= length; ey.z *= length; - var _this6 = ey; + let _this6 = ey; _this6.x += pos.x; _this6.y += pos.y; _this6.z += pos.z; ez.x *= length; ez.y *= length; ez.z *= length; - var _this7 = ez; + let _this7 = ez; _this7.x += pos.x; _this7.y += pos.y; _this7.z += pos.z; - var _this8 = this.p; + this.line(pos,ex,colorX); + this.line(pos,ey,colorY); + this.line(pos,ez,colorZ); + let _this8 = this.p; if(pos != null) { pos.zero(); if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray = new Array(_this8.sizeVec3 << 1); - var _g = 0; - var _g1 = _this8.sizeVec3; + let newArray = new Array(_this8.sizeVec3 << 1); + let _g = 0; + let _g1 = _this8.sizeVec3; while(_g < _g1) { - var i = _g++; + let i = _g++; newArray[i] = _this8.stackVec3[i]; _this8.stackVec3[i] = null; } @@ -19128,7 +19296,7 @@ oimo_dynamics_common_DebugDraw.prototype = { } _this8.stackVec3[_this8.sizeVec3++] = pos; } - var _this9 = this.p; + let _this9 = this.p; if(rot != null) { rot.e00 = 1; rot.e01 = 0; @@ -19140,218 +19308,225 @@ oimo_dynamics_common_DebugDraw.prototype = { rot.e21 = 0; rot.e22 = 1; if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newArray1 = new Array(_this9.sizeMat3 << 1); - var _g2 = 0; - var _g11 = _this9.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this9.stackMat3[i1]; - _this9.stackMat3[i1] = null; + let newArray = new Array(_this9.sizeMat3 << 1); + let _g = 0; + let _g1 = _this9.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackMat3[i]; + _this9.stackMat3[i] = null; } - _this9.stackMat3 = newArray1; + _this9.stackMat3 = newArray; } _this9.stackMat3[_this9.sizeMat3++] = rot; } - var _this10 = this.p; + let _this10 = this.p; if(ex != null) { ex.zero(); if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newArray2 = new Array(_this10.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this10.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this10.stackVec3[i2]; - _this10.stackVec3[i2] = null; + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this10.stackVec3 = newArray2; + _this10.stackVec3 = newArray; } _this10.stackVec3[_this10.sizeVec3++] = ex; } - var _this11 = this.p; + let _this11 = this.p; if(ey != null) { ey.zero(); if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray3 = new Array(_this11.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this11.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this11.stackVec3[i3]; - _this11.stackVec3[i3] = null; + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this11.stackVec3 = newArray3; + _this11.stackVec3 = newArray; } _this11.stackVec3[_this11.sizeVec3++] = ey; } - var _this12 = this.p; + let _this12 = this.p; if(ez != null) { ez.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray4 = new Array(_this12.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this12.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this12.stackVec3[i4]; - _this12.stackVec3[i4] = null; + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this12.stackVec3 = newArray4; + _this12.stackVec3 = newArray; } _this12.stackVec3[_this12.sizeVec3++] = ez; } } - ,ellipse: function(center,ex,ey,radiusX,radiusY,color) { + ellipse(center,ex,ey,radiusX,radiusY,color) { this.arc(center,ex,ey,radiusX,radiusY,0,6.28318530717958,false,color); } - ,arc: function(center,ex,ey,radiusX,radiusY,startAngle,endAngle,drawSector,color) { - var _this = this.p; - var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + arc(center,ex,ey,radiusX,radiusY,startAngle,endAngle,drawSector,color) { + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; _this1.x = ex.x; _this1.y = ex.y; _this1.z = ex.z; - var _this2 = _this1; + let _this2 = _this1; _this2.x *= radiusX; _this2.y *= radiusX; _this2.z *= radiusX; ex = _this2; - var _this3 = this.p; - var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; _this4.x = ey.x; _this4.y = ey.y; _this4.z = ey.z; - var _this5 = _this4; + let _this5 = _this4; _this5.x *= radiusY; _this5.y *= radiusY; _this5.z *= radiusY; ey = _this5; - var angDiff = endAngle - startAngle; + let angDiff = endAngle - startAngle; if(angDiff < 0) { angDiff = -angDiff; } - var n = angDiff / 0.52359877559829837 + 0.5 | 0; + let n = angDiff / 0.52359877559829837 + 0.5 | 0; if(n == 0) { n = 1; } - var theta = startAngle; - var dt = (endAngle - startAngle) / n; - var _this6 = this.p; - var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + let theta = startAngle; + let dt = (endAngle - startAngle) / n; + let _this6 = this.p; + let _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; _this7.x = center.x; _this7.y = center.y; _this7.z = center.z; - var _this8 = _this7; - var s = Math.cos(startAngle); + let _this8 = _this7; + let s = Math.cos(startAngle); _this8.x += _this2.x * s; _this8.y += _this2.y * s; _this8.z += _this2.z * s; - var s1 = Math.sin(startAngle); + let s1 = Math.sin(startAngle); _this8.x += _this5.x * s1; _this8.y += _this5.y * s1; _this8.z += _this5.z * s1; - var prevV = _this8; - var _g = 0; - var _g1 = n; + let prevV = _this8; + if(drawSector) { + this.line(center,_this8,color); + } + let _g = 0; + let _g1 = n; while(_g < _g1) { ++_g; theta += dt; - var _this9 = this.p; - var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; - _this10.x = center.x; - _this10.y = center.y; - _this10.z = center.z; - var _this11 = _this10; - var s2 = Math.cos(theta); - _this11.x += _this2.x * s2; - _this11.y += _this2.y * s2; - _this11.z += _this2.z * s2; - var s3 = Math.sin(theta); - _this11.x += _this5.x * s3; - _this11.y += _this5.y * s3; - _this11.z += _this5.z * s3; - var _this12 = this.p; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + let _this3 = _this1; + let s = Math.cos(theta); + _this3.x += _this2.x * s; + _this3.y += _this2.y * s; + _this3.z += _this2.z * s; + let s1 = Math.sin(theta); + _this3.x += _this5.x * s1; + _this3.y += _this5.y * s1; + _this3.z += _this5.z * s1; + this.line(prevV,_this3,color); + let _this4 = this.p; if(prevV != null) { prevV.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray = new Array(_this12.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this12.sizeVec3; - while(_g2 < _g11) { - var i = _g2++; - newArray[i] = _this12.stackVec3[i]; - _this12.stackVec3[i] = null; + if(_this4.sizeVec3 == _this4.stackVec3.length) { + let newArray = new Array(_this4.sizeVec3 << 1); + let _g = 0; + let _g1 = _this4.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this4.stackVec3[i]; + _this4.stackVec3[i] = null; } - _this12.stackVec3 = newArray; + _this4.stackVec3 = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = prevV; + _this4.stackVec3[_this4.sizeVec3++] = prevV; } - prevV = _this11; + prevV = _this3; } - var _this13 = this.p; + if(drawSector) { + this.line(center,prevV,color); + } + let _this9 = this.p; if(prevV != null) { prevV.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newArray1 = new Array(_this13.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this13.sizeVec3; - while(_g3 < _g12) { - var i1 = _g3++; - newArray1[i1] = _this13.stackVec3[i1]; - _this13.stackVec3[i1] = null; + if(_this9.sizeVec3 == _this9.stackVec3.length) { + let newArray = new Array(_this9.sizeVec3 << 1); + let _g = 0; + let _g1 = _this9.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this9.stackVec3[i]; + _this9.stackVec3[i] = null; } - _this13.stackVec3 = newArray1; + _this9.stackVec3 = newArray; } - _this13.stackVec3[_this13.sizeVec3++] = prevV; + _this9.stackVec3[_this9.sizeVec3++] = prevV; } - var _this14 = this.p; + let _this10 = this.p; if(_this2 != null) { _this2.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray2 = new Array(_this14.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this14.sizeVec3; - while(_g4 < _g13) { - var i2 = _g4++; - newArray2[i2] = _this14.stackVec3[i2]; - _this14.stackVec3[i2] = null; + if(_this10.sizeVec3 == _this10.stackVec3.length) { + let newArray = new Array(_this10.sizeVec3 << 1); + let _g = 0; + let _g1 = _this10.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this14.stackVec3 = newArray2; + _this10.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = _this2; + _this10.stackVec3[_this10.sizeVec3++] = _this2; } - var _this15 = this.p; + let _this11 = this.p; if(_this5 != null) { _this5.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray3 = new Array(_this15.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this15.sizeVec3; - while(_g5 < _g14) { - var i3 = _g5++; - newArray3[i3] = _this15.stackVec3[i3]; - _this15.stackVec3[i3] = null; - } - _this15.stackVec3 = newArray3; - } - _this15.stackVec3[_this15.sizeVec3++] = _this5; - } - } - ,cone: function(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; + } + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this5; + } + } + cone(tf,radius,halfHeight,color) { + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -19364,285 +19539,291 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; + let _this7 = _this6; _this7.x += ey.x * halfHeight; _this7.y += ey.y * halfHeight; _this7.z += ey.z * halfHeight; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - var s = -halfHeight; + let _this10 = _this9; + let s = -halfHeight; _this10.x += ey.x * s; _this10.y += ey.y * s; _this10.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this10.x; + _this1.y = _this10.y; + _this1.z = _this10.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this10.x; + _this4.y = _this10.y; + _this4.z = _this10.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this10.x; + _this8.y = _this10.y; + _this8.z = _this10.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; _this12.x = _this10.x; _this12.y = _this10.y; _this12.z = _this10.z; - var _this13 = _this12; - var s1 = -radius; - _this13.x += ex.x * s1; - _this13.y += ex.y * s1; - _this13.z += ex.z * s1; - _this13.x += ez.x * 0; - _this13.y += ez.y * 0; - _this13.z += ez.z * 0; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = _this10.x; - _this15.y = _this10.y; - _this15.z = _this10.z; - var _this16 = _this15; - _this16.x += ex.x * radius; - _this16.y += ex.y * radius; - _this16.z += ex.z * radius; - _this16.x += ez.x * 0; - _this16.y += ez.y * 0; - _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = _this10.x; - _this18.y = _this10.y; - _this18.z = _this10.z; - var _this19 = _this18; - _this19.x += ex.x * 0; - _this19.y += ex.y * 0; - _this19.z += ex.z * 0; - var s2 = -radius; - _this19.x += ez.x * s2; - _this19.y += ez.y * s2; - _this19.z += ez.z * s2; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = _this10.x; - _this21.y = _this10.y; - _this21.z = _this10.z; - var _this22 = _this21; - _this22.x += ex.x * 0; - _this22.y += ex.y * 0; - _this22.z += ex.z * 0; - _this22.x += ez.x * radius; - _this22.y += ez.y * radius; - _this22.z += ez.z * radius; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; this.ellipse(_this10,ex,ez,radius,radius,color); - var _this23 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this23.sizeVec3 == _this23.stackVec3.length) { - var newArray = new Array(_this23.sizeVec3 << 1); - var _g = 0; - var _g1 = _this23.sizeVec3; + this.line(_this7,_this2,color); + this.line(_this7,_this5,color); + this.line(_this7,_this9,color); + this.line(_this7,_this13,color); + let _this14 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this23.stackVec3[i]; - _this23.stackVec3[i] = null; + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this23.stackVec3 = newArray; + _this14.stackVec3 = newArray; } - _this23.stackVec3[_this23.sizeVec3++] = _this13; + _this14.stackVec3[_this14.sizeVec3++] = _this2; } - var _this24 = this.p; - if(_this16 != null) { - _this16.zero(); - if(_this24.sizeVec3 == _this24.stackVec3.length) { - var newArray1 = new Array(_this24.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this24.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this24.stackVec3[i1]; - _this24.stackVec3[i1] = null; + let _this15 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this24.stackVec3 = newArray1; + _this15.stackVec3 = newArray; } - _this24.stackVec3[_this24.sizeVec3++] = _this16; + _this15.stackVec3[_this15.sizeVec3++] = _this5; } - var _this25 = this.p; - if(_this19 != null) { - _this19.zero(); - if(_this25.sizeVec3 == _this25.stackVec3.length) { - var newArray2 = new Array(_this25.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this25.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this25.stackVec3[i2]; - _this25.stackVec3[i2] = null; + let _this16 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; } - _this25.stackVec3 = newArray2; + _this16.stackVec3 = newArray; } - _this25.stackVec3[_this25.sizeVec3++] = _this19; + _this16.stackVec3[_this16.sizeVec3++] = _this9; } - var _this26 = this.p; - if(_this22 != null) { - _this22.zero(); - if(_this26.sizeVec3 == _this26.stackVec3.length) { - var newArray3 = new Array(_this26.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this26.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this26.stackVec3[i3]; - _this26.stackVec3[i3] = null; + let _this17 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; } - _this26.stackVec3 = newArray3; + _this17.stackVec3 = newArray; } - _this26.stackVec3[_this26.sizeVec3++] = _this22; + _this17.stackVec3[_this17.sizeVec3++] = _this13; } } else { - var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); - var cos = 2 * halfHeight * invDenom; - var sin = radius * invDenom; - var _g5 = 0; - while(_g5 < 8) { - var i4 = _g5++; - var _this27 = this.tmpCircleNorms[i4]; - var v1 = this.circleCoords[i4]; - _this27.x = v1.x; - _this27.y = v1.y; - _this27.z = v1.z; - _this27.x *= cos; - _this27.y *= cos; - _this27.z *= cos; - _this27.y += sin; - var _this28 = this.tmpCircleNorms[i4]; - var y = _this28.x * m.e10 + _this28.y * m.e11 + _this28.z * m.e12; - var z = _this28.x * m.e20 + _this28.y * m.e21 + _this28.z * m.e22; - _this28.x = _this28.x * m.e00 + _this28.y * m.e01 + _this28.z * m.e02; - _this28.y = y; - _this28.z = z; - var _this29 = this.tmpCircleVerts1[i4]; - var v2 = this.circleCoordsShift[i4]; - _this29.x = v2.x; - _this29.y = v2.y; - _this29.z = v2.z; - _this29.x *= cos; - _this29.y *= cos; - _this29.z *= cos; - _this29.y += sin; - var _this30 = this.tmpCircleVerts1[i4]; - var y1 = _this30.x * m.e10 + _this30.y * m.e11 + _this30.z * m.e12; - var z1 = _this30.x * m.e20 + _this30.y * m.e21 + _this30.z * m.e22; - _this30.x = _this30.x * m.e00 + _this30.y * m.e01 + _this30.z * m.e02; - _this30.y = y1; - _this30.z = z1; - var _this31 = this.tmpCircleVerts2[i4]; - var v3 = this.circleCoords[i4]; - _this31.x = v3.x; - _this31.y = v3.y; - _this31.z = v3.z; - var y2 = _this31.x * m.e10 + _this31.y * m.e11 + _this31.z * m.e12; - var z2 = _this31.x * m.e20 + _this31.y * m.e21 + _this31.z * m.e22; - _this31.x = _this31.x * m.e00 + _this31.y * m.e01 + _this31.z * m.e02; - _this31.y = y2; - _this31.z = z2; - _this31.x *= radius; - _this31.y *= radius; - _this31.z *= radius; - _this31.x += o.x; - _this31.y += o.y; - _this31.z += o.z; - var _this32 = this.tmpCircleVerts2[i4]; - var s3 = -halfHeight; - _this32.x += ey.x * s3; - _this32.y += ey.y * s3; - _this32.z += ey.z * s3; - } - var _g14 = 0; - while(_g14 < 8) { - var i5 = _g14++; - var v21 = this.tmpCircleVerts2[i5]; - var v31 = this.tmpCircleVerts2[(i5 + 1) % 8]; - var n1 = this.tmpCircleVerts1[i5]; - v21 = this.tmpCircleVerts2[(i5 + 1) % 8]; - v31 = this.tmpCircleVerts2[i5]; - var _this33 = this.p; - var _this34 = _this33.sizeVec3 == 0 ? new oimo_common_Vec3() : _this33.stackVec3[--_this33.sizeVec3]; - _this34.x = ey.x; - _this34.y = ey.y; - _this34.z = ey.z; - var _this35 = _this34; - _this35.x = -_this35.x; - _this35.y = -_this35.y; - _this35.z = -_this35.z; - n1 = _this35; - var _this36 = this.p; - if(_this35 != null) { - _this35.zero(); - if(_this36.sizeVec3 == _this36.stackVec3.length) { - var newArray4 = new Array(_this36.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this36.sizeVec3; - while(_g6 < _g15) { - var i6 = _g6++; - newArray4[i6] = _this36.stackVec3[i6]; - _this36.stackVec3[i6] = null; + let invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); + let cos = 2 * halfHeight * invDenom; + let sin = radius * invDenom; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= cos; + _this.y *= cos; + _this.z *= cos; + _this.y += sin; + let _this1 = this.tmpCircleNorms[i]; + let y = _this1.x * m.e10 + _this1.y * m.e11 + _this1.z * m.e12; + let z = _this1.x * m.e20 + _this1.y * m.e21 + _this1.z * m.e22; + _this1.x = _this1.x * m.e00 + _this1.y * m.e01 + _this1.z * m.e02; + _this1.y = y; + _this1.z = z; + let _this2 = this.tmpCircleVerts1[i]; + let v1 = this.circleCoordsShift[i]; + _this2.x = v1.x; + _this2.y = v1.y; + _this2.z = v1.z; + _this2.x *= cos; + _this2.y *= cos; + _this2.z *= cos; + _this2.y += sin; + let _this3 = this.tmpCircleVerts1[i]; + let y1 = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; + let z1 = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; + _this3.x = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; + _this3.y = y1; + _this3.z = z1; + let _this4 = this.tmpCircleVerts2[i]; + let v2 = this.circleCoords[i]; + _this4.x = v2.x; + _this4.y = v2.y; + _this4.z = v2.z; + let y2 = _this4.x * m.e10 + _this4.y * m.e11 + _this4.z * m.e12; + let z2 = _this4.x * m.e20 + _this4.y * m.e21 + _this4.z * m.e22; + _this4.x = _this4.x * m.e00 + _this4.y * m.e01 + _this4.z * m.e02; + _this4.y = y2; + _this4.z = z2; + _this4.x *= radius; + _this4.y *= radius; + _this4.z *= radius; + _this4.x += o.x; + _this4.y += o.y; + _this4.z += o.z; + let _this5 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this5.x += ey.x * s; + _this5.y += ey.y * s; + _this5.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let v2 = this.tmpCircleVerts2[i]; + let v3 = this.tmpCircleVerts2[(i + 1) % 8]; + let n1 = this.tmpCircleVerts1[i]; + this.triangle(_this7,v2,v3,n1,this.tmpCircleNorms[i],this.tmpCircleNorms[(i + 1) % 8],color); + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ey.x; + _this1.y = ey.y; + _this1.z = ey.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); + let _this3 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this36.stackVec3 = newArray4; + _this3.stackVec3 = newArray; } - _this36.stackVec3[_this36.sizeVec3++] = _this35; + _this3.stackVec3[_this3.sizeVec3++] = _this2; } } } - var _this37 = this.p; + let _this11 = this.p; if(_this7 != null) { _this7.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray5 = new Array(_this37.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this37.sizeVec3; - while(_g7 < _g16) { - var i7 = _g7++; - newArray5[i7] = _this37.stackVec3[i7]; - _this37.stackVec3[i7] = null; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this37.stackVec3 = newArray5; + _this11.stackVec3 = newArray; } - _this37.stackVec3[_this37.sizeVec3++] = _this7; + _this11.stackVec3[_this11.sizeVec3++] = _this7; } - var _this38 = this.p; + let _this12 = this.p; if(_this10 != null) { _this10.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray6 = new Array(_this38.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this38.sizeVec3; - while(_g8 < _g17) { - var i8 = _g8++; - newArray6[i8] = _this38.stackVec3[i8]; - _this38.stackVec3[i8] = null; + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this38.stackVec3 = newArray6; + _this12.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = _this10; + _this12.stackVec3[_this12.sizeVec3++] = _this10; } - var _this39 = this.p; + let _this13 = this.p; if(o != null) { o.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray7 = new Array(_this39.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this39.sizeVec3; - while(_g9 < _g18) { - var i9 = _g9++; - newArray7[i9] = _this39.stackVec3[i9]; - _this39.stackVec3[i9] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this39.stackVec3 = newArray7; + _this13.stackVec3 = newArray; } - _this39.stackVec3[_this39.sizeVec3++] = o; + _this13.stackVec3[_this13.sizeVec3++] = o; } - var _this40 = this.p; + let _this14 = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -19653,84 +19834,84 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this40.sizeMat3 == _this40.stackMat3.length) { - var newArray8 = new Array(_this40.sizeMat3 << 1); - var _g10 = 0; - var _g19 = _this40.sizeMat3; - while(_g10 < _g19) { - var i10 = _g10++; - newArray8[i10] = _this40.stackMat3[i10]; - _this40.stackMat3[i10] = null; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; } - _this40.stackMat3 = newArray8; + _this14.stackMat3 = newArray; } - _this40.stackMat3[_this40.sizeMat3++] = m; + _this14.stackMat3[_this14.sizeMat3++] = m; } - var _this41 = this.p; + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray9 = new Array(_this41.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this41.sizeVec3; - while(_g20 < _g110) { - var i11 = _g20++; - newArray9[i11] = _this41.stackVec3[i11]; - _this41.stackVec3[i11] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this41.stackVec3 = newArray9; + _this15.stackVec3 = newArray; } - _this41.stackVec3[_this41.sizeVec3++] = ex; + _this15.stackVec3[_this15.sizeVec3++] = ex; } - var _this42 = this.p; + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray10 = new Array(_this42.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this42.sizeVec3; - while(_g21 < _g111) { - var i12 = _g21++; - newArray10[i12] = _this42.stackVec3[i12]; - _this42.stackVec3[i12] = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; } - _this42.stackVec3 = newArray10; + _this16.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = ey; + _this16.stackVec3[_this16.sizeVec3++] = ey; } - var _this43 = this.p; + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray11 = new Array(_this43.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this43.sizeVec3; - while(_g22 < _g112) { - var i13 = _g22++; - newArray11[i13] = _this43.stackVec3[i13]; - _this43.stackVec3[i13] = null; - } - _this43.stackVec3 = newArray11; - } - _this43.stackVec3[_this43.sizeVec3++] = ez; - } - } - ,cylinder: function(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; + } + } + cylinder(tf,radius,halfHeight,color) { + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -19743,389 +19924,395 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; + let _this7 = _this6; _this7.x += ey.x * halfHeight; _this7.y += ey.y * halfHeight; _this7.z += ey.z * halfHeight; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - var s = -halfHeight; + let _this10 = _this9; + let s = -halfHeight; _this10.x += ey.x * s; _this10.y += ey.y * s; _this10.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this7.x; + _this1.y = _this7.y; + _this1.z = _this7.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this7.x; + _this4.y = _this7.y; + _this4.z = _this7.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this7.x; + _this8.y = _this7.y; + _this8.z = _this7.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; _this12.x = _this7.x; _this12.y = _this7.y; _this12.z = _this7.z; - var _this13 = _this12; - var s1 = -radius; - _this13.x += ex.x * s1; - _this13.y += ex.y * s1; - _this13.z += ex.z * s1; - _this13.x += ez.x * 0; - _this13.y += ez.y * 0; - _this13.z += ez.z * 0; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = _this7.x; - _this15.y = _this7.y; - _this15.z = _this7.z; - var _this16 = _this15; - _this16.x += ex.x * radius; - _this16.y += ex.y * radius; - _this16.z += ex.z * radius; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + _this15.x = _this10.x; + _this15.y = _this10.y; + _this15.z = _this10.z; + let _this16 = _this15; + let s2 = -radius; + _this16.x += ex.x * s2; + _this16.y += ex.y * s2; + _this16.z += ex.z * s2; _this16.x += ez.x * 0; _this16.y += ez.y * 0; _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = _this7.x; - _this18.y = _this7.y; - _this18.z = _this7.z; - var _this19 = _this18; - _this19.x += ex.x * 0; - _this19.y += ex.y * 0; - _this19.z += ex.z * 0; - var s2 = -radius; - _this19.x += ez.x * s2; - _this19.y += ez.y * s2; - _this19.z += ez.z * s2; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = _this7.x; - _this21.y = _this7.y; - _this21.z = _this7.z; - var _this22 = _this21; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = _this10.x; + _this18.y = _this10.y; + _this18.z = _this10.z; + let _this19 = _this18; + _this19.x += ex.x * radius; + _this19.y += ex.y * radius; + _this19.z += ex.z * radius; + _this19.x += ez.x * 0; + _this19.y += ez.y * 0; + _this19.z += ez.z * 0; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + _this21.x = _this10.x; + _this21.y = _this10.y; + _this21.z = _this10.z; + let _this22 = _this21; _this22.x += ex.x * 0; _this22.y += ex.y * 0; _this22.z += ex.z * 0; - _this22.x += ez.x * radius; - _this22.y += ez.y * radius; - _this22.z += ez.z * radius; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + let s3 = -radius; + _this22.x += ez.x * s3; + _this22.y += ez.y * s3; + _this22.z += ez.z * s3; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; _this24.x = _this10.x; _this24.y = _this10.y; _this24.z = _this10.z; - var _this25 = _this24; - var s3 = -radius; - _this25.x += ex.x * s3; - _this25.y += ex.y * s3; - _this25.z += ex.z * s3; - _this25.x += ez.x * 0; - _this25.y += ez.y * 0; - _this25.z += ez.z * 0; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - _this27.x = _this10.x; - _this27.y = _this10.y; - _this27.z = _this10.z; - var _this28 = _this27; - _this28.x += ex.x * radius; - _this28.y += ex.y * radius; - _this28.z += ex.z * radius; - _this28.x += ez.x * 0; - _this28.y += ez.y * 0; - _this28.z += ez.z * 0; - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = _this10.x; - _this30.y = _this10.y; - _this30.z = _this10.z; - var _this31 = _this30; - _this31.x += ex.x * 0; - _this31.y += ex.y * 0; - _this31.z += ex.z * 0; - var s4 = -radius; - _this31.x += ez.x * s4; - _this31.y += ez.y * s4; - _this31.z += ez.z * s4; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = _this10.x; - _this33.y = _this10.y; - _this33.z = _this10.z; - var _this34 = _this33; - _this34.x += ex.x * 0; - _this34.y += ex.y * 0; - _this34.z += ex.z * 0; - _this34.x += ez.x * radius; - _this34.y += ez.y * radius; - _this34.z += ez.z * radius; + let _this25 = _this24; + _this25.x += ex.x * 0; + _this25.y += ex.y * 0; + _this25.z += ex.z * 0; + _this25.x += ez.x * radius; + _this25.y += ez.y * radius; + _this25.z += ez.z * radius; this.ellipse(_this7,ex,ez,radius,radius,color); this.ellipse(_this10,ex,ez,radius,radius,color); - var _this35 = this.p; + this.line(_this2,_this16,color); + this.line(_this5,_this19,color); + this.line(_this9,_this22,color); + this.line(_this13,_this25,color); + let _this26 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; + } + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this2; + } + let _this27 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; + } + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = _this5; + } + let _this28 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; + } + _this28.stackVec3 = newArray; + } + _this28.stackVec3[_this28.sizeVec3++] = _this9; + } + let _this29 = this.p; if(_this13 != null) { _this13.zero(); - if(_this35.sizeVec3 == _this35.stackVec3.length) { - var newArray = new Array(_this35.sizeVec3 << 1); - var _g = 0; - var _g1 = _this35.sizeVec3; + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this35.stackVec3[i]; - _this35.stackVec3[i] = null; + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this35.stackVec3 = newArray; + _this29.stackVec3 = newArray; } - _this35.stackVec3[_this35.sizeVec3++] = _this13; + _this29.stackVec3[_this29.sizeVec3++] = _this13; } - var _this36 = this.p; + let _this30 = this.p; if(_this16 != null) { _this16.zero(); - if(_this36.sizeVec3 == _this36.stackVec3.length) { - var newArray1 = new Array(_this36.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this36.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this36.stackVec3[i1]; - _this36.stackVec3[i1] = null; + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this36.stackVec3 = newArray1; + _this30.stackVec3 = newArray; } - _this36.stackVec3[_this36.sizeVec3++] = _this16; + _this30.stackVec3[_this30.sizeVec3++] = _this16; } - var _this37 = this.p; + let _this31 = this.p; if(_this19 != null) { _this19.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray2 = new Array(_this37.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this37.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this37.stackVec3[i2]; - _this37.stackVec3[i2] = null; + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this37.stackVec3 = newArray2; + _this31.stackVec3 = newArray; } - _this37.stackVec3[_this37.sizeVec3++] = _this19; + _this31.stackVec3[_this31.sizeVec3++] = _this19; } - var _this38 = this.p; + let _this32 = this.p; if(_this22 != null) { _this22.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray3 = new Array(_this38.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this38.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this38.stackVec3[i3]; - _this38.stackVec3[i3] = null; + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this38.stackVec3 = newArray3; + _this32.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = _this22; + _this32.stackVec3[_this32.sizeVec3++] = _this22; } - var _this39 = this.p; + let _this33 = this.p; if(_this25 != null) { _this25.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray4 = new Array(_this39.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this39.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this39.stackVec3[i4]; - _this39.stackVec3[i4] = null; - } - _this39.stackVec3 = newArray4; - } - _this39.stackVec3[_this39.sizeVec3++] = _this25; - } - var _this40 = this.p; - if(_this28 != null) { - _this28.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray5 = new Array(_this40.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this40.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this40.stackVec3[i5]; - _this40.stackVec3[i5] = null; - } - _this40.stackVec3 = newArray5; - } - _this40.stackVec3[_this40.sizeVec3++] = _this28; - } - var _this41 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray6 = new Array(_this41.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this41.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this41.stackVec3[i6]; - _this41.stackVec3[i6] = null; - } - _this41.stackVec3 = newArray6; - } - _this41.stackVec3[_this41.sizeVec3++] = _this31; - } - var _this42 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray7 = new Array(_this42.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this42.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this42.stackVec3[i7]; - _this42.stackVec3[i7] = null; + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this42.stackVec3 = newArray7; + _this33.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = _this34; + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } else { - var _g9 = 0; - while(_g9 < 8) { - var i8 = _g9++; - var _this43 = this.tmpCircleNorms[i8]; - var v1 = this.circleCoords[i8]; - _this43.x = v1.x; - _this43.y = v1.y; - _this43.z = v1.z; - var y = _this43.x * m.e10 + _this43.y * m.e11 + _this43.z * m.e12; - var z = _this43.x * m.e20 + _this43.y * m.e21 + _this43.z * m.e22; - _this43.x = _this43.x * m.e00 + _this43.y * m.e01 + _this43.z * m.e02; - _this43.y = y; - _this43.z = z; - var _this44 = this.tmpCircleVerts1[i8]; - var v2 = this.tmpCircleNorms[i8]; - _this44.x = v2.x; - _this44.y = v2.y; - _this44.z = v2.z; - _this44.x *= radius; - _this44.y *= radius; - _this44.z *= radius; - _this44.x += o.x; - _this44.y += o.y; - _this44.z += o.z; - var _this45 = this.tmpCircleVerts2[i8]; - var v3 = this.tmpCircleVerts1[i8]; - _this45.x = v3.x; - _this45.y = v3.y; - _this45.z = v3.z; - var _this46 = this.tmpCircleVerts1[i8]; - _this46.x += ey.x * halfHeight; - _this46.y += ey.y * halfHeight; - _this46.z += ey.z * halfHeight; - var _this47 = this.tmpCircleVerts2[i8]; - var s5 = -halfHeight; - _this47.x += ey.x * s5; - _this47.y += ey.y * s5; - _this47.z += ey.z * s5; - } - var _g18 = 0; - while(_g18 < 8) { - var i9 = _g18++; - var v11 = _this7; - var v21 = this.tmpCircleVerts1[i9]; - var v31 = this.tmpCircleVerts1[(i9 + 1) % 8]; - var n1 = ey; - v11 = _this10; - v21 = this.tmpCircleVerts2[(i9 + 1) % 8]; - v31 = this.tmpCircleVerts2[i9]; - var _this48 = this.p; - var _this49 = _this48.sizeVec3 == 0 ? new oimo_common_Vec3() : _this48.stackVec3[--_this48.sizeVec3]; - _this49.x = ey.x; - _this49.y = ey.y; - _this49.z = ey.z; - var _this50 = _this49; - _this50.x = -_this50.x; - _this50.y = -_this50.y; - _this50.z = -_this50.z; - n1 = _this50; - var _this51 = this.p; - if(_this50 != null) { - _this50.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray8 = new Array(_this51.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this51.sizeVec3; - while(_g10 < _g19) { - var i10 = _g10++; - newArray8[i10] = _this51.stackVec3[i10]; - _this51.stackVec3[i10] = null; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = this.tmpCircleVerts1[i]; + let v1 = this.tmpCircleNorms[i]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + let _this2 = this.tmpCircleVerts2[i]; + let v2 = this.tmpCircleVerts1[i]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + let _this3 = this.tmpCircleVerts1[i]; + _this3.x += ey.x * halfHeight; + _this3.y += ey.y * halfHeight; + _this3.z += ey.z * halfHeight; + let _this4 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this4.x += ey.x * s; + _this4.y += ey.y * s; + _this4.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let v1 = _this7; + let v2 = this.tmpCircleVerts1[i]; + let v3 = this.tmpCircleVerts1[(i + 1) % 8]; + let n1 = ey; + this.triangle(_this7,v2,v3,n1,n1,n1,color); + v1 = _this10; + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ey.x; + _this1.y = ey.y; + _this1.z = ey.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + n1 = _this2; + this.triangle(_this10,v2,v3,_this2,_this2,_this2,color); + let _this3 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + let newArray = new Array(_this3.sizeVec3 << 1); + let _g = 0; + let _g1 = _this3.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackVec3[i]; + _this3.stackVec3[i] = null; } - _this51.stackVec3 = newArray8; + _this3.stackVec3 = newArray; } - _this51.stackVec3[_this51.sizeVec3++] = _this50; + _this3.stackVec3[_this3.sizeVec3++] = _this2; } - v11 = this.tmpCircleVerts1[i9]; - v21 = this.tmpCircleVerts2[i9]; - v31 = this.tmpCircleVerts2[(i9 + 1) % 8]; - n1 = this.tmpCircleNorms[i9]; - var n2 = this.tmpCircleNorms[(i9 + 1) % 8]; - this.rect(v11,v21,v31,this.tmpCircleVerts1[(i9 + 1) % 8],n1,n1,n2,n2,color); + v1 = this.tmpCircleVerts1[i]; + v2 = this.tmpCircleVerts2[i]; + v3 = this.tmpCircleVerts2[(i + 1) % 8]; + n1 = this.tmpCircleNorms[i]; + let n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(v1,v2,v3,this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); } } - var _this52 = this.p; + let _this11 = this.p; if(_this7 != null) { _this7.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray9 = new Array(_this52.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this52.sizeVec3; - while(_g20 < _g110) { - var i11 = _g20++; - newArray9[i11] = _this52.stackVec3[i11]; - _this52.stackVec3[i11] = null; + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this52.stackVec3 = newArray9; + _this11.stackVec3 = newArray; } - _this52.stackVec3[_this52.sizeVec3++] = _this7; + _this11.stackVec3[_this11.sizeVec3++] = _this7; } - var _this53 = this.p; + let _this12 = this.p; if(_this10 != null) { _this10.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray10 = new Array(_this53.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this53.sizeVec3; - while(_g21 < _g111) { - var i12 = _g21++; - newArray10[i12] = _this53.stackVec3[i12]; - _this53.stackVec3[i12] = null; + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this53.stackVec3 = newArray10; + _this12.stackVec3 = newArray; } - _this53.stackVec3[_this53.sizeVec3++] = _this10; + _this12.stackVec3[_this12.sizeVec3++] = _this10; } - var _this54 = this.p; + let _this13 = this.p; if(o != null) { o.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newArray11 = new Array(_this54.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this54.sizeVec3; - while(_g22 < _g112) { - var i13 = _g22++; - newArray11[i13] = _this54.stackVec3[i13]; - _this54.stackVec3[i13] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this54.stackVec3 = newArray11; + _this13.stackVec3 = newArray; } - _this54.stackVec3[_this54.sizeVec3++] = o; + _this13.stackVec3[_this13.sizeVec3++] = o; } - var _this55 = this.p; + let _this14 = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -20136,84 +20323,84 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this55.sizeMat3 == _this55.stackMat3.length) { - var newArray12 = new Array(_this55.sizeMat3 << 1); - var _g23 = 0; - var _g113 = _this55.sizeMat3; - while(_g23 < _g113) { - var i14 = _g23++; - newArray12[i14] = _this55.stackMat3[i14]; - _this55.stackMat3[i14] = null; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; } - _this55.stackMat3 = newArray12; + _this14.stackMat3 = newArray; } - _this55.stackMat3[_this55.sizeMat3++] = m; + _this14.stackMat3[_this14.sizeMat3++] = m; } - var _this56 = this.p; + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newArray13 = new Array(_this56.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this56.sizeVec3; - while(_g24 < _g114) { - var i15 = _g24++; - newArray13[i15] = _this56.stackVec3[i15]; - _this56.stackVec3[i15] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this56.stackVec3 = newArray13; + _this15.stackVec3 = newArray; } - _this56.stackVec3[_this56.sizeVec3++] = ex; + _this15.stackVec3[_this15.sizeVec3++] = ex; } - var _this57 = this.p; + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newArray14 = new Array(_this57.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this57.sizeVec3; - while(_g25 < _g115) { - var i16 = _g25++; - newArray14[i16] = _this57.stackVec3[i16]; - _this57.stackVec3[i16] = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; } - _this57.stackVec3 = newArray14; + _this16.stackVec3 = newArray; } - _this57.stackVec3[_this57.sizeVec3++] = ey; + _this16.stackVec3[_this16.sizeVec3++] = ey; } - var _this58 = this.p; + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newArray15 = new Array(_this58.sizeVec3 << 1); - var _g26 = 0; - var _g116 = _this58.sizeVec3; - while(_g26 < _g116) { - var i17 = _g26++; - newArray15[i17] = _this58.stackVec3[i17]; - _this58.stackVec3[i17] = null; - } - _this58.stackVec3 = newArray15; - } - _this58.stackVec3[_this58.sizeVec3++] = ez; - } - } - ,capsule: function(tf,radius,halfHeight,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; + } + } + capsule(tf,radius,halfHeight,color) { + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -20226,481 +20413,492 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var vs = this.tmpSphereVerts; - var ns = this.tmpSphereNorms; - var _g = 0; + let vs = this.tmpSphereVerts; + let ns = this.tmpSphereNorms; + let _g = 0; while(_g < 5) { - var i2 = _g++; - var n = this.tmpSphereVerts[i2].length; - var _g1 = 0; + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; while(_g1 < n) { - var j2 = _g1++; - var _this5 = ns[i2][j2]; - var v1 = this.sphereCoords[i2][j2]; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var y = _this5.x * m.e10 + _this5.y * m.e11 + _this5.z * m.e12; - var z = _this5.x * m.e20 + _this5.y * m.e21 + _this5.z * m.e22; - _this5.x = _this5.x * m.e00 + _this5.y * m.e01 + _this5.z * m.e02; - _this5.y = y; - _this5.z = z; - } - } - var _g2 = 0; - while(_g2 < 4) { - var i = _g2++; + let j2 = _g1++; + let _this = ns[i2][j2]; + let v = this.sphereCoords[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + } + } + let _g1 = 0; + while(_g1 < 4) { + let i = _g1++; if(i == 0) { - var _g21 = 0; - while(_g21 < 3) { - var i21 = _g21++; - var n1 = this.tmpSphereVerts[i21].length; - var _g22 = 0; - while(_g22 < n1) { - var j21 = _g22++; - var _this6 = vs[i21][j21]; - var v2 = ns[i21][j21]; - _this6.x = v2.x; - _this6.y = v2.y; - _this6.z = v2.z; - _this6.x *= radius; - _this6.y *= radius; - _this6.z *= radius; - _this6.x += o.x; - _this6.y += o.y; - _this6.z += o.z; - _this6.x += ey.x * halfHeight; - _this6.y += ey.y * halfHeight; - _this6.z += ey.z * halfHeight; + let _g = 0; + while(_g < 3) { + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; + while(_g1 < n) { + let j2 = _g1++; + let _this = vs[i2][j2]; + let v = ns[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= radius; + _this.y *= radius; + _this.z *= radius; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; } } } if(i == 2) { - var _g23 = 2; - while(_g23 < 5) { - var i22 = _g23++; - var n2 = this.tmpSphereVerts[i22].length; - var _g24 = 0; - while(_g24 < n2) { - var j22 = _g24++; - var _this7 = vs[i22][j22]; - var v3 = ns[i22][j22]; - _this7.x = v3.x; - _this7.y = v3.y; - _this7.z = v3.z; - _this7.x *= radius; - _this7.y *= radius; - _this7.z *= radius; - _this7.x += o.x; - _this7.y += o.y; - _this7.z += o.z; - var s = -halfHeight; - _this7.x += ey.x * s; - _this7.y += ey.y * s; - _this7.z += ey.z * s; + let _g = 2; + while(_g < 5) { + let i2 = _g++; + let n = this.tmpSphereVerts[i2].length; + let _g1 = 0; + while(_g1 < n) { + let j2 = _g1++; + let _this = vs[i2][j2]; + let v = ns[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= radius; + _this.y *= radius; + _this.z *= radius; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; + let s = -halfHeight; + _this.x += ey.x * s; + _this.y += ey.y * s; + _this.z += ey.z * s; } } } - var _g25 = 0; - while(_g25 < 8) { - var j = _g25++; - var v11; - var v21; - var v31; - var v4; - var n11; - var n21; - var n3; - var n4; + let _g = 0; + while(_g < 8) { + let j = _g++; + let v1; + let v2; + let v3; + let v4; + let n1; + let n2; + let n3; + let n4; if(i == 0) { if(this.wireframe) { - v11 = vs[0][0]; - v21 = vs[1][j]; + v1 = vs[0][0]; + v2 = vs[1][j]; + this.line(v1,v2,color); } else { - v11 = vs[0][0]; - v21 = vs[1][j]; - v31 = vs[1][(j + 1) % 8]; - n11 = ns[0][0]; - n21 = ns[1][j]; + v1 = vs[0][0]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; + n1 = ns[0][0]; + n2 = ns[1][j]; n3 = ns[1][(j + 1) % 8]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(i == 3) { if(this.wireframe) { - v11 = vs[4][0]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i][j]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v1,v2,color); + this.line(v2,v3,color); } else { - v11 = vs[4][0]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i][j]; - n11 = ns[4][0]; - n21 = ns[i][(j + 1) % 8]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + n1 = ns[4][0]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i][j]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(this.wireframe) { - v11 = vs[i][j]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i + 1][j]; + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v1,v2,color); + this.line(v1,v3,color); } else { - v11 = vs[i][j]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i + 1][j]; + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; v4 = vs[i + 1][(j + 1) % 8]; - n11 = ns[i][j]; - n21 = ns[i][(j + 1) % 8]; + n1 = ns[i][j]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i + 1][j]; n4 = ns[i + 1][(j + 1) % 8]; - this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); + this.rect(v1,v3,v4,v2,n1,n3,n4,n2,color); } } } - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = o.x; + _this6.y = o.y; + _this6.z = o.z; + let _this7 = _this6; + _this7.x += ey.x * halfHeight; + _this7.y += ey.y * halfHeight; + _this7.z += ey.z * halfHeight; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - _this10.x += ey.x * halfHeight; - _this10.y += ey.y * halfHeight; - _this10.z += ey.z * halfHeight; - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = o.x; - _this12.y = o.y; - _this12.z = o.z; - var _this13 = _this12; - var s1 = -halfHeight; - _this13.x += ey.x * s1; - _this13.y += ey.y * s1; - _this13.z += ey.z * s1; + let _this10 = _this9; + let s = -halfHeight; + _this10.x += ey.x * s; + _this10.y += ey.y * s; + _this10.z += ey.z * s; if(this.wireframe) { - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = _this7.x; + _this1.y = _this7.y; + _this1.z = _this7.z; + let _this2 = _this1; + let s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this7.x; + _this4.y = _this7.y; + _this4.z = _this7.z; + let _this5 = _this4; + _this5.x += ex.x * radius; + _this5.y += ex.y * radius; + _this5.z += ex.z * radius; + _this5.x += ez.x * 0; + _this5.y += ez.y * 0; + _this5.z += ez.z * 0; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = _this7.x; + _this8.y = _this7.y; + _this8.z = _this7.z; + let _this9 = _this8; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + let s1 = -radius; + _this9.x += ez.x * s1; + _this9.y += ez.y * s1; + _this9.z += ez.z * s1; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + _this12.x = _this7.x; + _this12.y = _this7.y; + _this12.z = _this7.z; + let _this13 = _this12; + _this13.x += ex.x * 0; + _this13.y += ex.y * 0; + _this13.z += ex.z * 0; + _this13.x += ez.x * radius; + _this13.y += ez.y * radius; + _this13.z += ez.z * radius; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; _this15.x = _this10.x; _this15.y = _this10.y; _this15.z = _this10.z; - var _this16 = _this15; - var s2 = -radius; + let _this16 = _this15; + let s2 = -radius; _this16.x += ex.x * s2; _this16.y += ex.y * s2; _this16.z += ex.z * s2; _this16.x += ez.x * 0; _this16.y += ez.y * 0; _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; _this18.x = _this10.x; _this18.y = _this10.y; _this18.z = _this10.z; - var _this19 = _this18; + let _this19 = _this18; _this19.x += ex.x * radius; _this19.y += ex.y * radius; _this19.z += ex.z * radius; _this19.x += ez.x * 0; _this19.y += ez.y * 0; _this19.z += ez.z * 0; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; _this21.x = _this10.x; _this21.y = _this10.y; _this21.z = _this10.z; - var _this22 = _this21; + let _this22 = _this21; _this22.x += ex.x * 0; _this22.y += ex.y * 0; _this22.z += ex.z * 0; - var s3 = -radius; + let s3 = -radius; _this22.x += ez.x * s3; _this22.y += ez.y * s3; _this22.z += ez.z * s3; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; _this24.x = _this10.x; _this24.y = _this10.y; _this24.z = _this10.z; - var _this25 = _this24; + let _this25 = _this24; _this25.x += ex.x * 0; _this25.y += ex.y * 0; _this25.z += ex.z * 0; _this25.x += ez.x * radius; _this25.y += ez.y * radius; _this25.z += ez.z * radius; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - _this27.x = _this13.x; - _this27.y = _this13.y; - _this27.z = _this13.z; - var _this28 = _this27; - var s4 = -radius; - _this28.x += ex.x * s4; - _this28.y += ex.y * s4; - _this28.z += ex.z * s4; - _this28.x += ez.x * 0; - _this28.y += ez.y * 0; - _this28.z += ez.z * 0; - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = _this13.x; - _this30.y = _this13.y; - _this30.z = _this13.z; - var _this31 = _this30; - _this31.x += ex.x * radius; - _this31.y += ex.y * radius; - _this31.z += ex.z * radius; - _this31.x += ez.x * 0; - _this31.y += ez.y * 0; - _this31.z += ez.z * 0; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = _this13.x; - _this33.y = _this13.y; - _this33.z = _this13.z; - var _this34 = _this33; - _this34.x += ex.x * 0; - _this34.y += ex.y * 0; - _this34.z += ex.z * 0; - var s5 = -radius; - _this34.x += ez.x * s5; - _this34.y += ez.y * s5; - _this34.z += ez.z * s5; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = _this13.x; - _this36.y = _this13.y; - _this36.z = _this13.z; - var _this37 = _this36; - _this37.x += ex.x * 0; - _this37.y += ex.y * 0; - _this37.z += ex.z * 0; - _this37.x += ez.x * radius; - _this37.y += ez.y * radius; - _this37.z += ez.z * radius; + this.ellipse(_this7,ex,ez,radius,radius,color); this.ellipse(_this10,ex,ez,radius,radius,color); - this.ellipse(_this13,ex,ez,radius,radius,color); - var _this38 = this.p; + this.line(_this2,_this16,color); + this.line(_this5,_this19,color); + this.line(_this9,_this22,color); + this.line(_this13,_this25,color); + let _this26 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this26.sizeVec3 == _this26.stackVec3.length) { + let newArray = new Array(_this26.sizeVec3 << 1); + let _g = 0; + let _g1 = _this26.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this26.stackVec3[i]; + _this26.stackVec3[i] = null; + } + _this26.stackVec3 = newArray; + } + _this26.stackVec3[_this26.sizeVec3++] = _this2; + } + let _this27 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this27.sizeVec3 == _this27.stackVec3.length) { + let newArray = new Array(_this27.sizeVec3 << 1); + let _g = 0; + let _g1 = _this27.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this27.stackVec3[i]; + _this27.stackVec3[i] = null; + } + _this27.stackVec3 = newArray; + } + _this27.stackVec3[_this27.sizeVec3++] = _this5; + } + let _this28 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this28.sizeVec3 == _this28.stackVec3.length) { + let newArray = new Array(_this28.sizeVec3 << 1); + let _g = 0; + let _g1 = _this28.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this28.stackVec3[i]; + _this28.stackVec3[i] = null; + } + _this28.stackVec3 = newArray; + } + _this28.stackVec3[_this28.sizeVec3++] = _this9; + } + let _this29 = this.p; + if(_this13 != null) { + _this13.zero(); + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; + } + _this29.stackVec3 = newArray; + } + _this29.stackVec3[_this29.sizeVec3++] = _this13; + } + let _this30 = this.p; if(_this16 != null) { _this16.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray = new Array(_this38.sizeVec3 << 1); - var _g3 = 0; - var _g11 = _this38.sizeVec3; - while(_g3 < _g11) { - var i1 = _g3++; - newArray[i1] = _this38.stackVec3[i1]; - _this38.stackVec3[i1] = null; + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this38.stackVec3 = newArray; + _this30.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = _this16; + _this30.stackVec3[_this30.sizeVec3++] = _this16; } - var _this39 = this.p; + let _this31 = this.p; if(_this19 != null) { _this19.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray1 = new Array(_this39.sizeVec3 << 1); - var _g4 = 0; - var _g12 = _this39.sizeVec3; - while(_g4 < _g12) { - var i3 = _g4++; - newArray1[i3] = _this39.stackVec3[i3]; - _this39.stackVec3[i3] = null; + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this39.stackVec3 = newArray1; + _this31.stackVec3 = newArray; } - _this39.stackVec3[_this39.sizeVec3++] = _this19; + _this31.stackVec3[_this31.sizeVec3++] = _this19; } - var _this40 = this.p; + let _this32 = this.p; if(_this22 != null) { _this22.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray2 = new Array(_this40.sizeVec3 << 1); - var _g5 = 0; - var _g13 = _this40.sizeVec3; - while(_g5 < _g13) { - var i4 = _g5++; - newArray2[i4] = _this40.stackVec3[i4]; - _this40.stackVec3[i4] = null; + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this40.stackVec3 = newArray2; + _this32.stackVec3 = newArray; } - _this40.stackVec3[_this40.sizeVec3++] = _this22; + _this32.stackVec3[_this32.sizeVec3++] = _this22; } - var _this41 = this.p; + let _this33 = this.p; if(_this25 != null) { _this25.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray3 = new Array(_this41.sizeVec3 << 1); - var _g6 = 0; - var _g14 = _this41.sizeVec3; - while(_g6 < _g14) { - var i5 = _g6++; - newArray3[i5] = _this41.stackVec3[i5]; - _this41.stackVec3[i5] = null; - } - _this41.stackVec3 = newArray3; - } - _this41.stackVec3[_this41.sizeVec3++] = _this25; - } - var _this42 = this.p; - if(_this28 != null) { - _this28.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray4 = new Array(_this42.sizeVec3 << 1); - var _g7 = 0; - var _g15 = _this42.sizeVec3; - while(_g7 < _g15) { - var i6 = _g7++; - newArray4[i6] = _this42.stackVec3[i6]; - _this42.stackVec3[i6] = null; - } - _this42.stackVec3 = newArray4; - } - _this42.stackVec3[_this42.sizeVec3++] = _this28; - } - var _this43 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray5 = new Array(_this43.sizeVec3 << 1); - var _g8 = 0; - var _g16 = _this43.sizeVec3; - while(_g8 < _g16) { - var i7 = _g8++; - newArray5[i7] = _this43.stackVec3[i7]; - _this43.stackVec3[i7] = null; - } - _this43.stackVec3 = newArray5; - } - _this43.stackVec3[_this43.sizeVec3++] = _this31; - } - var _this44 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray6 = new Array(_this44.sizeVec3 << 1); - var _g9 = 0; - var _g17 = _this44.sizeVec3; - while(_g9 < _g17) { - var i8 = _g9++; - newArray6[i8] = _this44.stackVec3[i8]; - _this44.stackVec3[i8] = null; - } - _this44.stackVec3 = newArray6; - } - _this44.stackVec3[_this44.sizeVec3++] = _this34; - } - var _this45 = this.p; - if(_this37 != null) { - _this37.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray7 = new Array(_this45.sizeVec3 << 1); - var _g10 = 0; - var _g18 = _this45.sizeVec3; - while(_g10 < _g18) { - var i9 = _g10++; - newArray7[i9] = _this45.stackVec3[i9]; - _this45.stackVec3[i9] = null; + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this45.stackVec3 = newArray7; + _this33.stackVec3 = newArray; } - _this45.stackVec3[_this45.sizeVec3++] = _this37; + _this33.stackVec3[_this33.sizeVec3++] = _this25; } } else { - var _g41 = 0; - while(_g41 < 8) { - var i10 = _g41++; - var _this46 = this.tmpCircleNorms[i10]; - var v5 = this.circleCoords[i10]; - _this46.x = v5.x; - _this46.y = v5.y; - _this46.z = v5.z; - var y1 = _this46.x * m.e10 + _this46.y * m.e11 + _this46.z * m.e12; - var z1 = _this46.x * m.e20 + _this46.y * m.e21 + _this46.z * m.e22; - _this46.x = _this46.x * m.e00 + _this46.y * m.e01 + _this46.z * m.e02; - _this46.y = y1; - _this46.z = z1; - var _this47 = this.tmpCircleVerts1[i10]; - var v6 = this.tmpCircleNorms[i10]; - _this47.x = v6.x; - _this47.y = v6.y; - _this47.z = v6.z; - _this47.x *= radius; - _this47.y *= radius; - _this47.z *= radius; - _this47.x += o.x; - _this47.y += o.y; - _this47.z += o.z; - var _this48 = this.tmpCircleVerts2[i10]; - var v7 = this.tmpCircleVerts1[i10]; - _this48.x = v7.x; - _this48.y = v7.y; - _this48.z = v7.z; - var _this49 = this.tmpCircleVerts1[i10]; - _this49.x += ey.x * halfHeight; - _this49.y += ey.y * halfHeight; - _this49.z += ey.z * halfHeight; - var _this50 = this.tmpCircleVerts2[i10]; - var s6 = -halfHeight; - _this50.x += ey.x * s6; - _this50.y += ey.y * s6; - _this50.z += ey.z * s6; - } - var _g51 = 0; - while(_g51 < 8) { - var i11 = _g51++; - var n12 = this.tmpCircleNorms[i11]; - var n22 = this.tmpCircleNorms[(i11 + 1) % 8]; - this.rect(this.tmpCircleVerts1[i11],this.tmpCircleVerts2[i11],this.tmpCircleVerts2[(i11 + 1) % 8],this.tmpCircleVerts1[(i11 + 1) % 8],n12,n12,n22,n22,color); - } - } - var _this51 = this.p; - if(_this10 != null) { - _this10.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray8 = new Array(_this51.sizeVec3 << 1); - var _g19 = 0; - var _g110 = _this51.sizeVec3; - while(_g19 < _g110) { - var i12 = _g19++; - newArray8[i12] = _this51.stackVec3[i12]; - _this51.stackVec3[i12] = null; + let _g = 0; + while(_g < 8) { + let i = _g++; + let _this = this.tmpCircleNorms[i]; + let v = this.circleCoords[i]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = this.tmpCircleVerts1[i]; + let v1 = this.tmpCircleNorms[i]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + let _this2 = this.tmpCircleVerts2[i]; + let v2 = this.tmpCircleVerts1[i]; + _this2.x = v2.x; + _this2.y = v2.y; + _this2.z = v2.z; + let _this3 = this.tmpCircleVerts1[i]; + _this3.x += ey.x * halfHeight; + _this3.y += ey.y * halfHeight; + _this3.z += ey.z * halfHeight; + let _this4 = this.tmpCircleVerts2[i]; + let s = -halfHeight; + _this4.x += ey.x * s; + _this4.y += ey.y * s; + _this4.z += ey.z * s; + } + let _g1 = 0; + while(_g1 < 8) { + let i = _g1++; + let n1 = this.tmpCircleNorms[i]; + let n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(this.tmpCircleVerts1[i],this.tmpCircleVerts2[i],this.tmpCircleVerts2[(i + 1) % 8],this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); + } + } + let _this11 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this51.stackVec3 = newArray8; + _this11.stackVec3 = newArray; } - _this51.stackVec3[_this51.sizeVec3++] = _this10; + _this11.stackVec3[_this11.sizeVec3++] = _this7; } - var _this52 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray9 = new Array(_this52.sizeVec3 << 1); - var _g20 = 0; - var _g111 = _this52.sizeVec3; - while(_g20 < _g111) { - var i13 = _g20++; - newArray9[i13] = _this52.stackVec3[i13]; - _this52.stackVec3[i13] = null; + let _this12 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this52.stackVec3 = newArray9; + _this12.stackVec3 = newArray; } - _this52.stackVec3[_this52.sizeVec3++] = _this13; + _this12.stackVec3[_this12.sizeVec3++] = _this10; } - var _this53 = this.p; + let _this13 = this.p; if(o != null) { o.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray10 = new Array(_this53.sizeVec3 << 1); - var _g26 = 0; - var _g112 = _this53.sizeVec3; - while(_g26 < _g112) { - var i14 = _g26++; - newArray10[i14] = _this53.stackVec3[i14]; - _this53.stackVec3[i14] = null; + if(_this13.sizeVec3 == _this13.stackVec3.length) { + let newArray = new Array(_this13.sizeVec3 << 1); + let _g = 0; + let _g1 = _this13.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this53.stackVec3 = newArray10; + _this13.stackVec3 = newArray; } - _this53.stackVec3[_this53.sizeVec3++] = o; + _this13.stackVec3[_this13.sizeVec3++] = o; } - var _this54 = this.p; + let _this14 = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -20711,78 +20909,78 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this54.sizeMat3 == _this54.stackMat3.length) { - var newArray11 = new Array(_this54.sizeMat3 << 1); - var _g27 = 0; - var _g113 = _this54.sizeMat3; - while(_g27 < _g113) { - var i15 = _g27++; - newArray11[i15] = _this54.stackMat3[i15]; - _this54.stackMat3[i15] = null; + if(_this14.sizeMat3 == _this14.stackMat3.length) { + let newArray = new Array(_this14.sizeMat3 << 1); + let _g = 0; + let _g1 = _this14.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackMat3[i]; + _this14.stackMat3[i] = null; } - _this54.stackMat3 = newArray11; + _this14.stackMat3 = newArray; } - _this54.stackMat3[_this54.sizeMat3++] = m; + _this14.stackMat3[_this14.sizeMat3++] = m; } - var _this55 = this.p; + let _this15 = this.p; if(ex != null) { ex.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newArray12 = new Array(_this55.sizeVec3 << 1); - var _g28 = 0; - var _g114 = _this55.sizeVec3; - while(_g28 < _g114) { - var i16 = _g28++; - newArray12[i16] = _this55.stackVec3[i16]; - _this55.stackVec3[i16] = null; + if(_this15.sizeVec3 == _this15.stackVec3.length) { + let newArray = new Array(_this15.sizeVec3 << 1); + let _g = 0; + let _g1 = _this15.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this15.stackVec3[i]; + _this15.stackVec3[i] = null; } - _this55.stackVec3 = newArray12; + _this15.stackVec3 = newArray; } - _this55.stackVec3[_this55.sizeVec3++] = ex; + _this15.stackVec3[_this15.sizeVec3++] = ex; } - var _this56 = this.p; + let _this16 = this.p; if(ey != null) { ey.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newArray13 = new Array(_this56.sizeVec3 << 1); - var _g29 = 0; - var _g115 = _this56.sizeVec3; - while(_g29 < _g115) { - var i17 = _g29++; - newArray13[i17] = _this56.stackVec3[i17]; - _this56.stackVec3[i17] = null; + if(_this16.sizeVec3 == _this16.stackVec3.length) { + let newArray = new Array(_this16.sizeVec3 << 1); + let _g = 0; + let _g1 = _this16.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this16.stackVec3[i]; + _this16.stackVec3[i] = null; } - _this56.stackVec3 = newArray13; + _this16.stackVec3 = newArray; } - _this56.stackVec3[_this56.sizeVec3++] = ey; + _this16.stackVec3[_this16.sizeVec3++] = ey; } - var _this57 = this.p; + let _this17 = this.p; if(ez != null) { ez.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newArray14 = new Array(_this57.sizeVec3 << 1); - var _g30 = 0; - var _g116 = _this57.sizeVec3; - while(_g30 < _g116) { - var i18 = _g30++; - newArray14[i18] = _this57.stackVec3[i18]; - _this57.stackVec3[i18] = null; - } - _this57.stackVec3 = newArray14; - } - _this57.stackVec3[_this57.sizeVec3++] = ez; - } - } - ,sphere: function(tf,radius,color) { - var _this = this.p; - var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var m = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; - var v = o; + if(_this17.sizeVec3 == _this17.stackVec3.length) { + let newArray = new Array(_this17.sizeVec3 << 1); + let _g = 0; + let _g1 = _this17.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this17.stackVec3[i]; + _this17.stackVec3[i] = null; + } + _this17.stackVec3 = newArray; + } + _this17.stackVec3[_this17.sizeVec3++] = ez; + } + } + sphere(tf,radius,color) { + let _this = this.p; + let o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let m = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -20792,111 +20990,118 @@ oimo_dynamics_common_DebugDraw.prototype = { m1.e20 = tf._rotation20; m1.e21 = tf._rotation21; m1.e22 = tf._rotation22; - var vs = this.tmpSphereVerts; - var ns = this.tmpSphereNorms; - var _g = 0; + let vs = this.tmpSphereVerts; + let ns = this.tmpSphereNorms; + let _g = 0; while(_g < 5) { - var i = _g++; - var n = this.tmpSphereVerts[i].length; - var _g1 = 0; + let i = _g++; + let n = this.tmpSphereVerts[i].length; + let _g1 = 0; while(_g1 < n) { - var j = _g1++; - var _this2 = ns[i][j]; - var v1 = this.sphereCoords[i][j]; - _this2.x = v1.x; - _this2.y = v1.y; - _this2.z = v1.z; - var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; - var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; - _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; - _this2.y = y; - _this2.z = z; - var _this3 = vs[i][j]; - var v2 = ns[i][j]; - _this3.x = v2.x; - _this3.y = v2.y; - _this3.z = v2.z; - _this3.x *= radius; - _this3.y *= radius; - _this3.z *= radius; - _this3.x += o.x; - _this3.y += o.y; - _this3.z += o.z; - } - } - var _g2 = 0; - while(_g2 < 4) { - var i1 = _g2++; - var _g21 = 0; - while(_g21 < 8) { - var j1 = _g21++; - var v11; - var v21; - var v3; - var v4; - var n1; - var n2; - var n3; - var n4; - if(i1 == 0) { + let j = _g1++; + let _this = ns[i][j]; + let v = this.sphereCoords[i][j]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + let y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + let z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + let _this1 = vs[i][j]; + let v1 = ns[i][j]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; + } + } + let _g1 = 0; + while(_g1 < 4) { + let i = _g1++; + let _g = 0; + while(_g < 8) { + let j = _g++; + let v1; + let v2; + let v3; + let v4; + let n1; + let n2; + let n3; + let n4; + if(i == 0) { if(this.wireframe) { - v11 = vs[0][0]; - v21 = vs[1][j1]; + v1 = vs[0][0]; + v2 = vs[1][j]; + this.line(v1,v2,color); } else { - v11 = vs[0][0]; - v21 = vs[1][j1]; - v3 = vs[1][(j1 + 1) % 8]; + v1 = vs[0][0]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; n1 = ns[0][0]; - n2 = ns[1][j1]; - n3 = ns[1][(j1 + 1) % 8]; + n2 = ns[1][j]; + n3 = ns[1][(j + 1) % 8]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } - } else if(i1 == 3) { + } else if(i == 3) { if(this.wireframe) { - v11 = vs[4][0]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1][j1]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v1,v2,color); + this.line(v2,v3,color); } else { - v11 = vs[4][0]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1][j1]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; n1 = ns[4][0]; - n2 = ns[i1][(j1 + 1) % 8]; - n3 = ns[i1][j1]; + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i][j]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(this.wireframe) { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1 + 1][j1]; + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v1,v2,color); + this.line(v1,v3,color); } else { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1 + 1][j1]; - v4 = vs[i1 + 1][(j1 + 1) % 8]; - n1 = ns[i1][j1]; - n2 = ns[i1][(j1 + 1) % 8]; - n3 = ns[i1 + 1][j1]; - n4 = ns[i1 + 1][(j1 + 1) % 8]; - this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % 8]; + n1 = ns[i][j]; + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i + 1][j]; + n4 = ns[i + 1][(j + 1) % 8]; + this.rect(v1,v3,v4,v2,n1,n3,n4,n2,color); } } } - var _this4 = this.p; + let _this2 = this.p; if(o != null) { o.zero(); - if(_this4.sizeVec3 == _this4.stackVec3.length) { - var newArray = new Array(_this4.sizeVec3 << 1); - var _g3 = 0; - var _g11 = _this4.sizeVec3; - while(_g3 < _g11) { - var i2 = _g3++; - newArray[i2] = _this4.stackVec3[i2]; - _this4.stackVec3[i2] = null; + if(_this2.sizeVec3 == _this2.stackVec3.length) { + let newArray = new Array(_this2.sizeVec3 << 1); + let _g = 0; + let _g1 = _this2.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this4.stackVec3 = newArray; + _this2.stackVec3 = newArray; } - _this4.stackVec3[_this4.sizeVec3++] = o; + _this2.stackVec3[_this2.sizeVec3++] = o; } - var _this5 = this.p; + let _this3 = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -20907,36 +21112,36 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this5.sizeMat3 == _this5.stackMat3.length) { - var newArray1 = new Array(_this5.sizeMat3 << 1); - var _g4 = 0; - var _g12 = _this5.sizeMat3; - while(_g4 < _g12) { - var i3 = _g4++; - newArray1[i3] = _this5.stackMat3[i3]; - _this5.stackMat3[i3] = null; - } - _this5.stackMat3 = newArray1; - } - _this5.stackMat3[_this5.sizeMat3++] = m; - } - } - ,box: function(tf,halfExtents,color) { - var _this = this.p; - var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; - var v = o; + if(_this3.sizeMat3 == _this3.stackMat3.length) { + let newArray = new Array(_this3.sizeMat3 << 1); + let _g = 0; + let _g1 = _this3.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this3.stackMat3[i]; + _this3.stackMat3[i] = null; + } + _this3.stackMat3 = newArray; + } + _this3.stackMat3[_this3.sizeMat3++] = m; + } + } + box(tf,halfExtents,color) { + let _this = this.p; + let ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + let _this1 = this.p; + let ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + let _this2 = this.p; + let ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + let _this3 = this.p; + let o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + let _this4 = this.p; + let m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + let v = o; v.x = tf._positionX; v.y = tf._positionY; v.z = tf._positionZ; - var m1 = m; + let m1 = m; m1.e00 = tf._rotation00; m1.e01 = tf._rotation01; m1.e02 = tf._rotation02; @@ -20949,68 +21154,68 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var hx = halfExtents.x; - var hy = halfExtents.y; - var hz = halfExtents.z; - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + let hx = halfExtents.x; + let hy = halfExtents.y; + let hz = halfExtents.z; + let _this5 = this.p; + let _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; - var s = -hx; + let _this7 = _this6; + let s = -hx; _this7.x += ex.x * s; _this7.y += ex.y * s; _this7.z += ex.z * s; - var s1 = -hy; + let s1 = -hy; _this7.x += ey.x * s1; _this7.y += ey.y * s1; _this7.z += ey.z * s1; - var s2 = -hz; + let s2 = -hz; _this7.x += ez.x * s2; _this7.y += ez.y * s2; _this7.z += ez.z * s2; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + let _this8 = this.p; + let _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; _this9.x = o.x; _this9.y = o.y; _this9.z = o.z; - var _this10 = _this9; - var s3 = -hx; + let _this10 = _this9; + let s3 = -hx; _this10.x += ex.x * s3; _this10.y += ex.y * s3; _this10.z += ex.z * s3; - var s4 = -hy; + let s4 = -hy; _this10.x += ey.x * s4; _this10.y += ey.y * s4; _this10.z += ey.z * s4; _this10.x += ez.x * hz; _this10.y += ez.y * hz; _this10.z += ez.z * hz; - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; + let _this11 = this.p; + let _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; _this12.x = o.x; _this12.y = o.y; _this12.z = o.z; - var _this13 = _this12; - var s5 = -hx; + let _this13 = _this12; + let s5 = -hx; _this13.x += ex.x * s5; _this13.y += ex.y * s5; _this13.z += ex.z * s5; _this13.x += ey.x * hy; _this13.y += ey.y * hy; _this13.z += ey.z * hy; - var s6 = -hz; + let s6 = -hz; _this13.x += ez.x * s6; _this13.y += ez.y * s6; _this13.z += ez.z * s6; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + let _this14 = this.p; + let _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; _this15.x = o.x; _this15.y = o.y; _this15.z = o.z; - var _this16 = _this15; - var s7 = -hx; + let _this16 = _this15; + let s7 = -hx; _this16.x += ex.x * s7; _this16.y += ex.y * s7; _this16.z += ex.z * s7; @@ -21020,61 +21225,61 @@ oimo_dynamics_common_DebugDraw.prototype = { _this16.x += ez.x * hz; _this16.y += ez.y * hz; _this16.z += ez.z * hz; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + let _this17 = this.p; + let _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; _this18.x = o.x; _this18.y = o.y; _this18.z = o.z; - var _this19 = _this18; + let _this19 = _this18; _this19.x += ex.x * hx; _this19.y += ex.y * hx; _this19.z += ex.z * hx; - var s8 = -hy; + let s8 = -hy; _this19.x += ey.x * s8; _this19.y += ey.y * s8; _this19.z += ey.z * s8; - var s9 = -hz; + let s9 = -hz; _this19.x += ez.x * s9; _this19.y += ez.y * s9; _this19.z += ez.z * s9; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; + let _this20 = this.p; + let _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; _this21.x = o.x; _this21.y = o.y; _this21.z = o.z; - var _this22 = _this21; + let _this22 = _this21; _this22.x += ex.x * hx; _this22.y += ex.y * hx; _this22.z += ex.z * hx; - var s10 = -hy; + let s10 = -hy; _this22.x += ey.x * s10; _this22.y += ey.y * s10; _this22.z += ey.z * s10; _this22.x += ez.x * hz; _this22.y += ez.y * hz; _this22.z += ez.z * hz; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; + let _this23 = this.p; + let _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; _this24.x = o.x; _this24.y = o.y; _this24.z = o.z; - var _this25 = _this24; + let _this25 = _this24; _this25.x += ex.x * hx; _this25.y += ex.y * hx; _this25.z += ex.z * hx; _this25.x += ey.x * hy; _this25.y += ey.y * hy; _this25.z += ey.z * hy; - var s11 = -hz; + let s11 = -hz; _this25.x += ez.x * s11; _this25.y += ez.y * s11; _this25.z += ez.z * s11; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; + let _this26 = this.p; + let _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; _this27.x = o.x; _this27.y = o.y; _this27.z = o.z; - var _this28 = _this27; + let _this28 = _this27; _this28.x += ex.x * hx; _this28.y += ex.y * hx; _this28.z += ex.z * hx; @@ -21084,234 +21289,247 @@ oimo_dynamics_common_DebugDraw.prototype = { _this28.x += ez.x * hz; _this28.y += ez.y * hz; _this28.z += ez.z * hz; - if(!this.wireframe) { - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = ex.x; - _this30.y = ex.y; - _this30.z = ex.z; - var _this31 = _this30; - _this31.x = -_this31.x; - _this31.y = -_this31.y; - _this31.z = -_this31.z; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = ey.x; - _this33.y = ey.y; - _this33.z = ey.z; - var _this34 = _this33; - _this34.x = -_this34.x; - _this34.y = -_this34.y; - _this34.z = -_this34.z; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = ez.x; - _this36.y = ez.y; - _this36.z = ez.z; - var _this37 = _this36; - _this37.x = -_this37.x; - _this37.y = -_this37.y; - _this37.z = -_this37.z; - this.rect(_this7,_this10,_this16,_this13,_this31,_this31,_this31,_this31,color); + if(this.wireframe) { + this.line(_this7,_this10,color); + this.line(_this13,_this16,color); + this.line(_this19,_this22,color); + this.line(_this25,_this28,color); + this.line(_this7,_this13,color); + this.line(_this10,_this16,color); + this.line(_this19,_this25,color); + this.line(_this22,_this28,color); + this.line(_this7,_this19,color); + this.line(_this10,_this22,color); + this.line(_this13,_this25,color); + this.line(_this16,_this28,color); + } else { + let _this = this.p; + let _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = ex.x; + _this1.y = ex.y; + _this1.z = ex.z; + let _this2 = _this1; + _this2.x = -_this2.x; + _this2.y = -_this2.y; + _this2.z = -_this2.z; + let _this3 = this.p; + let _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = ey.x; + _this4.y = ey.y; + _this4.z = ey.z; + let _this5 = _this4; + _this5.x = -_this5.x; + _this5.y = -_this5.y; + _this5.z = -_this5.z; + let _this6 = this.p; + let _this8 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this8.x = ez.x; + _this8.y = ez.y; + _this8.z = ez.z; + let _this9 = _this8; + _this9.x = -_this9.x; + _this9.y = -_this9.y; + _this9.z = -_this9.z; + this.rect(_this7,_this10,_this16,_this13,_this2,_this2,_this2,_this2,color); this.rect(_this19,_this25,_this28,_this22,ex,ex,ex,ex,color); - this.rect(_this7,_this19,_this22,_this10,_this34,_this34,_this34,_this34,color); + this.rect(_this7,_this19,_this22,_this10,_this5,_this5,_this5,_this5,color); this.rect(_this13,_this16,_this28,_this25,ey,ey,ey,ey,color); - this.rect(_this7,_this13,_this25,_this19,_this37,_this37,_this37,_this37,color); + this.rect(_this7,_this13,_this25,_this19,_this9,_this9,_this9,_this9,color); this.rect(_this10,_this22,_this28,_this16,ez,ez,ez,ez,color); - var _this38 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray = new Array(_this38.sizeVec3 << 1); - var _g = 0; - var _g1 = _this38.sizeVec3; + let _this11 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + let newArray = new Array(_this11.sizeVec3 << 1); + let _g = 0; + let _g1 = _this11.sizeVec3; while(_g < _g1) { - var i = _g++; - newArray[i] = _this38.stackVec3[i]; - _this38.stackVec3[i] = null; + let i = _g++; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this38.stackVec3 = newArray; - } - _this38.stackVec3[_this38.sizeVec3++] = _this31; - } - var _this39 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray1 = new Array(_this39.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this39.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this39.stackVec3[i1]; - _this39.stackVec3[i1] = null; + _this11.stackVec3 = newArray; + } + _this11.stackVec3[_this11.sizeVec3++] = _this2; + } + let _this12 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this12.sizeVec3 == _this12.stackVec3.length) { + let newArray = new Array(_this12.sizeVec3 << 1); + let _g = 0; + let _g1 = _this12.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this12.stackVec3[i]; + _this12.stackVec3[i] = null; } - _this39.stackVec3 = newArray1; - } - _this39.stackVec3[_this39.sizeVec3++] = _this34; - } - var _this40 = this.p; - if(_this37 != null) { - _this37.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray2 = new Array(_this40.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this40.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this40.stackVec3[i2]; - _this40.stackVec3[i2] = null; + _this12.stackVec3 = newArray; + } + _this12.stackVec3[_this12.sizeVec3++] = _this5; + } + let _this14 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this14.sizeVec3 == _this14.stackVec3.length) { + let newArray = new Array(_this14.sizeVec3 << 1); + let _g = 0; + let _g1 = _this14.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this14.stackVec3[i]; + _this14.stackVec3[i] = null; } - _this40.stackVec3 = newArray2; + _this14.stackVec3 = newArray; } - _this40.stackVec3[_this40.sizeVec3++] = _this37; + _this14.stackVec3[_this14.sizeVec3++] = _this9; } } - var _this41 = this.p; + let _this29 = this.p; if(_this7 != null) { _this7.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray3 = new Array(_this41.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this41.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this41.stackVec3[i3]; - _this41.stackVec3[i3] = null; + if(_this29.sizeVec3 == _this29.stackVec3.length) { + let newArray = new Array(_this29.sizeVec3 << 1); + let _g = 0; + let _g1 = _this29.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this29.stackVec3[i]; + _this29.stackVec3[i] = null; } - _this41.stackVec3 = newArray3; + _this29.stackVec3 = newArray; } - _this41.stackVec3[_this41.sizeVec3++] = _this7; + _this29.stackVec3[_this29.sizeVec3++] = _this7; } - var _this42 = this.p; + let _this30 = this.p; if(_this10 != null) { _this10.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray4 = new Array(_this42.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this42.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this42.stackVec3[i4]; - _this42.stackVec3[i4] = null; + if(_this30.sizeVec3 == _this30.stackVec3.length) { + let newArray = new Array(_this30.sizeVec3 << 1); + let _g = 0; + let _g1 = _this30.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this30.stackVec3[i]; + _this30.stackVec3[i] = null; } - _this42.stackVec3 = newArray4; + _this30.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = _this10; + _this30.stackVec3[_this30.sizeVec3++] = _this10; } - var _this43 = this.p; + let _this31 = this.p; if(_this13 != null) { _this13.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray5 = new Array(_this43.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this43.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this43.stackVec3[i5]; - _this43.stackVec3[i5] = null; + if(_this31.sizeVec3 == _this31.stackVec3.length) { + let newArray = new Array(_this31.sizeVec3 << 1); + let _g = 0; + let _g1 = _this31.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this31.stackVec3[i]; + _this31.stackVec3[i] = null; } - _this43.stackVec3 = newArray5; + _this31.stackVec3 = newArray; } - _this43.stackVec3[_this43.sizeVec3++] = _this13; + _this31.stackVec3[_this31.sizeVec3++] = _this13; } - var _this44 = this.p; + let _this32 = this.p; if(_this16 != null) { _this16.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray6 = new Array(_this44.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this44.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this44.stackVec3[i6]; - _this44.stackVec3[i6] = null; + if(_this32.sizeVec3 == _this32.stackVec3.length) { + let newArray = new Array(_this32.sizeVec3 << 1); + let _g = 0; + let _g1 = _this32.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this32.stackVec3[i]; + _this32.stackVec3[i] = null; } - _this44.stackVec3 = newArray6; + _this32.stackVec3 = newArray; } - _this44.stackVec3[_this44.sizeVec3++] = _this16; + _this32.stackVec3[_this32.sizeVec3++] = _this16; } - var _this45 = this.p; + let _this33 = this.p; if(_this19 != null) { _this19.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray7 = new Array(_this45.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this45.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this45.stackVec3[i7]; - _this45.stackVec3[i7] = null; + if(_this33.sizeVec3 == _this33.stackVec3.length) { + let newArray = new Array(_this33.sizeVec3 << 1); + let _g = 0; + let _g1 = _this33.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this33.stackVec3[i]; + _this33.stackVec3[i] = null; } - _this45.stackVec3 = newArray7; + _this33.stackVec3 = newArray; } - _this45.stackVec3[_this45.sizeVec3++] = _this19; + _this33.stackVec3[_this33.sizeVec3++] = _this19; } - var _this46 = this.p; + let _this34 = this.p; if(_this22 != null) { _this22.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newArray8 = new Array(_this46.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this46.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this46.stackVec3[i8]; - _this46.stackVec3[i8] = null; + if(_this34.sizeVec3 == _this34.stackVec3.length) { + let newArray = new Array(_this34.sizeVec3 << 1); + let _g = 0; + let _g1 = _this34.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this34.stackVec3[i]; + _this34.stackVec3[i] = null; } - _this46.stackVec3 = newArray8; + _this34.stackVec3 = newArray; } - _this46.stackVec3[_this46.sizeVec3++] = _this22; + _this34.stackVec3[_this34.sizeVec3++] = _this22; } - var _this47 = this.p; + let _this35 = this.p; if(_this25 != null) { _this25.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newArray9 = new Array(_this47.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this47.sizeVec3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this47.stackVec3[i9]; - _this47.stackVec3[i9] = null; + if(_this35.sizeVec3 == _this35.stackVec3.length) { + let newArray = new Array(_this35.sizeVec3 << 1); + let _g = 0; + let _g1 = _this35.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this35.stackVec3[i]; + _this35.stackVec3[i] = null; } - _this47.stackVec3 = newArray9; + _this35.stackVec3 = newArray; } - _this47.stackVec3[_this47.sizeVec3++] = _this25; + _this35.stackVec3[_this35.sizeVec3++] = _this25; } - var _this48 = this.p; + let _this36 = this.p; if(_this28 != null) { _this28.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newArray10 = new Array(_this48.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this48.sizeVec3; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this48.stackVec3[i10]; - _this48.stackVec3[i10] = null; + if(_this36.sizeVec3 == _this36.stackVec3.length) { + let newArray = new Array(_this36.sizeVec3 << 1); + let _g = 0; + let _g1 = _this36.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this36.stackVec3[i]; + _this36.stackVec3[i] = null; } - _this48.stackVec3 = newArray10; + _this36.stackVec3 = newArray; } - _this48.stackVec3[_this48.sizeVec3++] = _this28; + _this36.stackVec3[_this36.sizeVec3++] = _this28; } - var _this49 = this.p; + let _this37 = this.p; if(o != null) { o.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newArray11 = new Array(_this49.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this49.sizeVec3; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this49.stackVec3[i11]; - _this49.stackVec3[i11] = null; + if(_this37.sizeVec3 == _this37.stackVec3.length) { + let newArray = new Array(_this37.sizeVec3 << 1); + let _g = 0; + let _g1 = _this37.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this37.stackVec3[i]; + _this37.stackVec3[i] = null; } - _this49.stackVec3 = newArray11; + _this37.stackVec3 = newArray; } - _this49.stackVec3[_this49.sizeVec3++] = o; + _this37.stackVec3[_this37.sizeVec3++] = o; } - var _this50 = this.p; + let _this38 = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -21322,151 +21540,157 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this50.sizeMat3 == _this50.stackMat3.length) { - var newArray12 = new Array(_this50.sizeMat3 << 1); - var _g22 = 0; - var _g112 = _this50.sizeMat3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this50.stackMat3[i12]; - _this50.stackMat3[i12] = null; + if(_this38.sizeMat3 == _this38.stackMat3.length) { + let newArray = new Array(_this38.sizeMat3 << 1); + let _g = 0; + let _g1 = _this38.sizeMat3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this38.stackMat3[i]; + _this38.stackMat3[i] = null; } - _this50.stackMat3 = newArray12; + _this38.stackMat3 = newArray; } - _this50.stackMat3[_this50.sizeMat3++] = m; + _this38.stackMat3[_this38.sizeMat3++] = m; } - var _this51 = this.p; + let _this39 = this.p; if(ex != null) { ex.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray13 = new Array(_this51.sizeVec3 << 1); - var _g23 = 0; - var _g113 = _this51.sizeVec3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this51.stackVec3[i13]; - _this51.stackVec3[i13] = null; + if(_this39.sizeVec3 == _this39.stackVec3.length) { + let newArray = new Array(_this39.sizeVec3 << 1); + let _g = 0; + let _g1 = _this39.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this39.stackVec3[i]; + _this39.stackVec3[i] = null; } - _this51.stackVec3 = newArray13; + _this39.stackVec3 = newArray; } - _this51.stackVec3[_this51.sizeVec3++] = ex; + _this39.stackVec3[_this39.sizeVec3++] = ex; } - var _this52 = this.p; + let _this40 = this.p; if(ey != null) { ey.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray14 = new Array(_this52.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this52.sizeVec3; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this52.stackVec3[i14]; - _this52.stackVec3[i14] = null; + if(_this40.sizeVec3 == _this40.stackVec3.length) { + let newArray = new Array(_this40.sizeVec3 << 1); + let _g = 0; + let _g1 = _this40.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this40.stackVec3[i]; + _this40.stackVec3[i] = null; } - _this52.stackVec3 = newArray14; + _this40.stackVec3 = newArray; } - _this52.stackVec3[_this52.sizeVec3++] = ey; + _this40.stackVec3[_this40.sizeVec3++] = ey; } - var _this53 = this.p; + let _this41 = this.p; if(ez != null) { ez.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray15 = new Array(_this53.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this53.sizeVec3; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this53.stackVec3[i15]; - _this53.stackVec3[i15] = null; - } - _this53.stackVec3 = newArray15; - } - _this53.stackVec3[_this53.sizeVec3++] = ez; - } - } - ,rect: function(v1,v2,v3,v4,n1,n2,n3,n4,color) { - } - ,point: function(v,color) { - } - ,triangle: function(v1,v2,v3,n1,n2,n3,color) { - } - ,line: function(v1,v2,color) { - } -}; -var oimo_dynamics_common_DebugDrawStyle = function() { - this.basisColorZ = new oimo_common_Vec3(0.0,0.0,1.0); - this.basisColorY = new oimo_common_Vec3(0.0,1.0,0.0); - this.basisColorX = new oimo_common_Vec3(1.0,0.0,0.0); - this.basisLength = 0.5; - this.jointRotationalConstraintRadius = 0.3; - this.jointErrorColor = new oimo_common_Vec3(1.0,0.1,0.1); - this.jointLineColor = new oimo_common_Vec3(0.8,0.8,0.8); - this.contactBinormalLength = 0.5; - this.contactTangentLength = 0.5; - this.contactNormalLength = 0.5; - this.contactBinormalColor = new oimo_common_Vec3(0.2,0.2,1.0); - this.contactTangentColor = new oimo_common_Vec3(0.1,0.8,0.1); - this.contactNormalColor = new oimo_common_Vec3(1.0,0.1,0.1); - this.disabledContactColor = new oimo_common_Vec3(0.5,0.1,0.1); - this.newContactColor = new oimo_common_Vec3(1.0,1.0,0.1); - this.contactColor4 = new oimo_common_Vec3(0.8,0.1,1.0); - this.contactColor3 = new oimo_common_Vec3(0.1,0.8,0.6); - this.contactColor2 = new oimo_common_Vec3(1.0,0.6,0.1); - this.contactColor = new oimo_common_Vec3(1.0,0.1,0.1); - this.pairColor = new oimo_common_Vec3(1.0,1.0,0.1); - this.bvhNodeColor = new oimo_common_Vec3(0.4,0.4,0.4); - this.aabbColor = new oimo_common_Vec3(1.0,0.1,0.1); - this.kinematicShapeColor = new oimo_common_Vec3(1.0,0.5,0.1); - this.staticShapeColor = new oimo_common_Vec3(0.7,0.7,0.7); - this.sleepingShapeColor2 = new oimo_common_Vec3(0.2,0.8,0.5); - this.sleepingShapeColor1 = new oimo_common_Vec3(0.3,0.3,0.8); - this.sleepyShapeColor2 = new oimo_common_Vec3(0.6,0.8,0.3); - this.sleepyShapeColor1 = new oimo_common_Vec3(0.5,0.25,0.6); - this.shapeColor2 = new oimo_common_Vec3(1.0,0.8,0.1); - this.shapeColor1 = new oimo_common_Vec3(0.7,0.2,0.4); -}; -var oimo_dynamics_common_Performance = function() { }; -var oimo_dynamics_constraint_ConstraintSolver = function() { - this._b1 = null; - this._b2 = null; - this._addedToIsland = false; -}; -oimo_dynamics_constraint_ConstraintSolver.prototype = { - preSolveVelocity: function(timeStep) { - } - ,warmStart: function(timeStep) { - } - ,solveVelocity: function() { - } - ,postSolveVelocity: function(timeStep) { - } - ,preSolvePosition: function(timeStep) { - } - ,solvePositionSplitImpulse: function() { - } - ,solvePositionNgs: function(timeStep) { - } - ,postSolve: function() { - } -}; -var oimo_dynamics_constraint_PositionCorrectionAlgorithm = function() { }; -var oimo_dynamics_constraint_contact_ContactConstraint = function(manifold) { - this._solver = new oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver(this); - this._manifold = manifold; -}; -oimo_dynamics_constraint_contact_ContactConstraint.prototype = { - _getVelocitySolverInfo: function(timeStep,info) { + if(_this41.sizeVec3 == _this41.stackVec3.length) { + let newArray = new Array(_this41.sizeVec3 << 1); + let _g = 0; + let _g1 = _this41.sizeVec3; + while(_g < _g1) { + let i = _g++; + newArray[i] = _this41.stackVec3[i]; + _this41.stackVec3[i] = null; + } + _this41.stackVec3 = newArray; + } + _this41.stackVec3[_this41.sizeVec3++] = ez; + } + } + rect(v1,v2,v3,v4,n1,n2,n3,n4,color) { + this.triangle(v1,v2,v3,n1,n2,n3,color); + this.triangle(v1,v3,v4,n1,n3,n4,color); + } + point(v,color) { + } + triangle(v1,v2,v3,n1,n2,n3,color) { + } + line(v1,v2,color) { + } +} +class oimo_dynamics_common_DebugDrawStyle { + constructor() { + this.basisColorZ = new oimo_common_Vec3(0.0,0.0,1.0); + this.basisColorY = new oimo_common_Vec3(0.0,1.0,0.0); + this.basisColorX = new oimo_common_Vec3(1.0,0.0,0.0); + this.basisLength = 0.5; + this.jointRotationalConstraintRadius = 0.3; + this.jointErrorColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.jointLineColor = new oimo_common_Vec3(0.8,0.8,0.8); + this.contactBinormalLength = 0.5; + this.contactTangentLength = 0.5; + this.contactNormalLength = 0.5; + this.contactBinormalColor = new oimo_common_Vec3(0.2,0.2,1.0); + this.contactTangentColor = new oimo_common_Vec3(0.1,0.8,0.1); + this.contactNormalColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.disabledContactColor = new oimo_common_Vec3(0.5,0.1,0.1); + this.newContactColor = new oimo_common_Vec3(1.0,1.0,0.1); + this.contactColor4 = new oimo_common_Vec3(0.8,0.1,1.0); + this.contactColor3 = new oimo_common_Vec3(0.1,0.8,0.6); + this.contactColor2 = new oimo_common_Vec3(1.0,0.6,0.1); + this.contactColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.pairColor = new oimo_common_Vec3(1.0,1.0,0.1); + this.bvhNodeColor = new oimo_common_Vec3(0.4,0.4,0.4); + this.aabbColor = new oimo_common_Vec3(1.0,0.1,0.1); + this.kinematicShapeColor = new oimo_common_Vec3(1.0,0.5,0.1); + this.staticShapeColor = new oimo_common_Vec3(0.7,0.7,0.7); + this.sleepingShapeColor2 = new oimo_common_Vec3(0.2,0.8,0.5); + this.sleepingShapeColor1 = new oimo_common_Vec3(0.3,0.3,0.8); + this.sleepyShapeColor2 = new oimo_common_Vec3(0.6,0.8,0.3); + this.sleepyShapeColor1 = new oimo_common_Vec3(0.5,0.25,0.6); + this.shapeColor2 = new oimo_common_Vec3(1.0,0.8,0.1); + this.shapeColor1 = new oimo_common_Vec3(0.7,0.2,0.4); + } +} +class oimo_dynamics_common_Performance { +} +class oimo_dynamics_constraint_ConstraintSolver { + constructor() { + this._b1 = null; + this._b2 = null; + this._addedToIsland = false; + } + preSolveVelocity(timeStep) { + } + warmStart(timeStep) { + } + solveVelocity() { + } + postSolveVelocity(timeStep) { + } + preSolvePosition(timeStep) { + } + solvePositionSplitImpulse() { + } + solvePositionNgs(timeStep) { + } + postSolve() { + } +} +class oimo_dynamics_constraint_PositionCorrectionAlgorithm { +} +class oimo_dynamics_constraint_contact_ContactConstraint { + constructor(manifold) { + this._solver = new oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver(this); + this._manifold = manifold; + } + _getVelocitySolverInfo(timeStep,info) { info.b1 = this._b1; info.b2 = this._b2; - var normalX; - var normalY; - var normalZ; - var tangentX; - var tangentY; - var tangentZ; - var binormalX; - var binormalY; - var binormalZ; + let normalX; + let normalY; + let normalZ; + let tangentX; + let tangentY; + let tangentZ; + let binormalX; + let binormalY; + let binormalZ; normalX = this._manifold._normalX; normalY = this._manifold._normalY; normalZ = this._manifold._normalZ; @@ -21476,16 +21700,16 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { binormalX = this._manifold._binormalX; binormalY = this._manifold._binormalY; binormalZ = this._manifold._binormalZ; - var friction = Math.sqrt(this._s1._friction * this._s2._friction); - var restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); - var num = this._manifold._numPoints; + let friction = Math.sqrt(this._s1._friction * this._s2._friction); + let restitution = Math.sqrt(this._s1._restitution * this._s2._restitution); + let num = this._manifold._numPoints; info.numRows = 0; - var _g = 0; + let _g = 0; while(_g < num) { - var p = this._manifold._points[_g++]; + let p = this._manifold._points[_g++]; if(p._depth < 0) { p._disabled = true; - var _this = p._impulse; + let _this = p._impulse; _this.impulseN = 0; _this.impulseT = 0; _this.impulseB = 0; @@ -21497,10 +21721,10 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { } else { p._disabled = false; } - var row = info.rows[info.numRows++]; + let row = info.rows[info.numRows++]; row.friction = friction; row.cfm = 0; - var j = row.jacobianN; + let j = row.jacobianN; j.lin1X = normalX; j.lin1Y = normalY; j.lin1Z = normalZ; @@ -21540,7 +21764,7 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { j.ang2Y = p._relPos2Z * binormalX - p._relPos2X * binormalZ; j.ang2Z = p._relPos2X * binormalY - p._relPos2Y * binormalX; j = row.jacobianN; - var rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); + let rvn = j.lin1X * this._b1._velX + j.lin1Y * this._b1._velY + j.lin1Z * this._b1._velZ + (j.ang1X * this._b1._angVelX + j.ang1Y * this._b1._angVelY + j.ang1Z * this._b1._angVelZ) - (j.lin2X * this._b2._velX + j.lin2Y * this._b2._velY + j.lin2Z * this._b2._velZ + (j.ang2X * this._b2._angVelX + j.ang2Y * this._b2._angVelY + j.ang2Z * this._b2._angVelZ)); if(rvn < -oimo_common_Setting.contactEnableBounceThreshold && !p._warmStarted) { row.rhs = -rvn * restitution; } else { @@ -21548,44 +21772,44 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { } if(this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE) { if(p._depth > oimo_common_Setting.linearSlop) { - var minRhs = (p._depth - oimo_common_Setting.linearSlop) * oimo_common_Setting.velocityBaumgarte * timeStep.invDt; + let minRhs = (p._depth - oimo_common_Setting.linearSlop) * oimo_common_Setting.velocityBaumgarte * timeStep.invDt; if(row.rhs < minRhs) { row.rhs = minRhs; } } } if(!p._warmStarted) { - var _this1 = p._impulse; - _this1.impulseN = 0; - _this1.impulseT = 0; - _this1.impulseB = 0; - _this1.impulseP = 0; - _this1.impulseLX = 0; - _this1.impulseLY = 0; - _this1.impulseLZ = 0; + let _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; } row.impulse = p._impulse; } } - ,_getPositionSolverInfo: function(info) { + _getPositionSolverInfo(info) { info.b1 = this._b1; info.b2 = this._b2; - var normalX; - var normalY; - var normalZ; + let normalX; + let normalY; + let normalZ; normalX = this._manifold._normalX; normalY = this._manifold._normalY; normalZ = this._manifold._normalZ; - var num = this._manifold._numPoints; + let num = this._manifold._numPoints; info.numRows = 0; - var _g = 0; + let _g = 0; while(_g < num) { - var p = this._manifold._points[_g++]; + let p = this._manifold._points[_g++]; if(p._disabled) { continue; } - var row = info.rows[info.numRows++]; - var j = row.jacobianN; + let row = info.rows[info.numRows++]; + let j = row.jacobianN; j.lin1X = normalX; j.lin1Y = normalY; j.lin1Z = normalZ; @@ -21605,38 +21829,38 @@ oimo_dynamics_constraint_contact_ContactConstraint.prototype = { row.impulse = p._impulse; } } - ,_syncManifold: function() { + _syncManifold() { this._manifold._updateDepthsAndPositions(this._tf1,this._tf2); } - ,getShape1: function() { + getShape1() { return this._s1; } - ,getShape2: function() { + getShape2() { return this._s2; } - ,getManifold: function() { + getManifold() { return this._manifold; } - ,isTouching: function() { - var _g = 0; - var _g1 = this._manifold._numPoints; + isTouching() { + let _g = 0; + let _g1 = this._manifold._numPoints; while(_g < _g1) if(this._manifold._points[_g++]._depth >= 0) { return true; } return false; } -}; -var oimo_dynamics_constraint_contact_ContactImpulse = function() { - this.impulseN = 0; - this.impulseT = 0; - this.impulseB = 0; - this.impulseP = 0; - this.impulseLX = 0; - this.impulseLY = 0; - this.impulseLZ = 0; -}; -oimo_dynamics_constraint_contact_ContactImpulse.prototype = { - copyFrom: function(imp) { +} +class oimo_dynamics_constraint_contact_ContactImpulse { + constructor() { + this.impulseN = 0; + this.impulseT = 0; + this.impulseB = 0; + this.impulseP = 0; + this.impulseLX = 0; + this.impulseLY = 0; + this.impulseLZ = 0; + } + copyFrom(imp) { this.impulseN = imp.impulseN; this.impulseT = imp.impulseT; this.impulseB = imp.impulseB; @@ -21644,29 +21868,29 @@ oimo_dynamics_constraint_contact_ContactImpulse.prototype = { this.impulseLY = imp.impulseLY; this.impulseLZ = imp.impulseLZ; } -}; -var oimo_dynamics_constraint_contact_Manifold = function() { - this._normalX = 0; - this._normalY = 0; - this._normalZ = 0; - this._tangentX = 0; - this._tangentY = 0; - this._tangentZ = 0; - this._binormalX = 0; - this._binormalY = 0; - this._binormalZ = 0; - this._numPoints = 0; - this._points = new Array(oimo_common_Setting.maxManifoldPoints); - var _g = 0; - var _g1 = oimo_common_Setting.maxManifoldPoints; - while(_g < _g1) this._points[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); -}; -oimo_dynamics_constraint_contact_Manifold.prototype = { - _clear: function() { - var _g = 0; - var _g1 = this._numPoints; +} +class oimo_dynamics_constraint_contact_Manifold { + constructor() { + this._normalX = 0; + this._normalY = 0; + this._normalZ = 0; + this._tangentX = 0; + this._tangentY = 0; + this._tangentZ = 0; + this._binormalX = 0; + this._binormalY = 0; + this._binormalZ = 0; + this._numPoints = 0; + this._points = new Array(oimo_common_Setting.maxManifoldPoints); + let _g = 0; + let _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this._points[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); + } + _clear() { + let _g = 0; + let _g1 = this._numPoints; while(_g < _g1) { - var _this = this._points[_g++]; + let _this = this._points[_g++]; _this._localPos1X = 0; _this._localPos1Y = 0; _this._localPos1Z = 0; @@ -21686,7 +21910,7 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { _this._pos2Y = 0; _this._pos2Z = 0; _this._depth = 0; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -21700,25 +21924,25 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { } this._numPoints = 0; } - ,_buildBasis: function(normal) { + _buildBasis(normal) { this._normalX = normal.x; this._normalY = normal.y; this._normalZ = normal.z; - var nx = normal.x; - var ny = normal.y; - var nz = normal.z; - var nx2 = nx * nx; - var ny2 = ny * ny; - var nz2 = nz * nz; - var tx; - var ty; - var tz; - var bx; - var by; - var bz; + let nx = normal.x; + let ny = normal.y; + let nz = normal.z; + let nx2 = nx * nx; + let ny2 = ny * ny; + let nz2 = nz * nz; + let tx; + let ty; + let tz; + let bx; + let by; + let bz; if(nx2 < ny2) { if(nx2 < nz2) { - var invL = 1 / Math.sqrt(ny2 + nz2); + let invL = 1 / Math.sqrt(ny2 + nz2); tx = 0; ty = -nz * invL; tz = ny * invL; @@ -21726,26 +21950,26 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { by = -nx * tz; bz = nx * ty; } else { - var invL1 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL1; - ty = nx * invL1; + let invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; bz = nx * ty - ny * tx; } } else if(ny2 < nz2) { - var invL2 = 1 / Math.sqrt(nx2 + nz2); - tx = nz * invL2; + let invL = 1 / Math.sqrt(nx2 + nz2); + tx = nz * invL; ty = 0; - tz = -nx * invL2; + tz = -nx * invL; bx = ny * tz; by = nz * tx - nx * tz; bz = -ny * tx; } else { - var invL3 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL3; - ty = nx * invL3; + let invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; @@ -21758,23 +21982,23 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { this._binormalY = by; this._binormalZ = bz; } - ,_updateDepthsAndPositions: function(tf1,tf2) { - var _g = 0; - var _g1 = this._numPoints; + _updateDepthsAndPositions(tf1,tf2) { + let _g = 0; + let _g1 = this._numPoints; while(_g < _g1) { - var p = this._points[_g++]; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let p = this._points[_g++]; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; p._relPos1X = __tmp__X; p._relPos1Y = __tmp__Y; p._relPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; @@ -21787,147 +22011,147 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { p._pos2X = p._relPos2X + tf2._positionX; p._pos2Y = p._relPos2Y + tf2._positionY; p._pos2Z = p._relPos2Z + tf2._positionZ; - var diffX; - var diffY; - var diffZ; + let diffX; + let diffY; + let diffZ; diffX = p._pos1X - p._pos2X; diffY = p._pos1Y - p._pos2Y; diffZ = p._pos1Z - p._pos2Z; p._depth = -(diffX * this._normalX + diffY * this._normalY + diffZ * this._normalZ); } } - ,getNormal: function() { - var v = new oimo_common_Vec3(); + getNormal() { + let v = new oimo_common_Vec3(); v.x = this._normalX; v.y = this._normalY; v.z = this._normalZ; return v; } - ,getNormalTo: function(normal) { + getNormalTo(normal) { normal.x = this._normalX; normal.y = this._normalY; normal.z = this._normalZ; } - ,getTangent: function() { - var v = new oimo_common_Vec3(); + getTangent() { + let v = new oimo_common_Vec3(); v.x = this._tangentX; v.y = this._tangentY; v.z = this._tangentZ; return v; } - ,getTangentTo: function(tangent) { + getTangentTo(tangent) { tangent.x = this._tangentX; tangent.y = this._tangentY; tangent.z = this._tangentZ; } - ,getBinormal: function() { - var v = new oimo_common_Vec3(); + getBinormal() { + let v = new oimo_common_Vec3(); v.x = this._binormalX; v.y = this._binormalY; v.z = this._binormalZ; return v; } - ,getBinormalTo: function(binormal) { + getBinormalTo(binormal) { binormal.x = this._binormalX; binormal.y = this._binormalY; binormal.z = this._binormalZ; } - ,getPoints: function() { + getPoints() { return this._points; } - ,getNumPoints: function() { + getNumPoints() { return this._numPoints; } -}; -var oimo_dynamics_constraint_contact_ManifoldPoint = function() { - this._localPos1X = 0; - this._localPos1Y = 0; - this._localPos1Z = 0; - this._localPos2X = 0; - this._localPos2Y = 0; - this._localPos2Z = 0; - this._relPos1X = 0; - this._relPos1Y = 0; - this._relPos1Z = 0; - this._relPos2X = 0; - this._relPos2Y = 0; - this._relPos2Z = 0; - this._pos1X = 0; - this._pos1Y = 0; - this._pos1Z = 0; - this._pos2X = 0; - this._pos2Y = 0; - this._pos2Z = 0; - this._depth = 0; - this._impulse = new oimo_dynamics_constraint_contact_ContactImpulse(); - this._warmStarted = false; - this._disabled = false; - this._id = -1; -}; -oimo_dynamics_constraint_contact_ManifoldPoint.prototype = { - getPosition1: function() { - var v = new oimo_common_Vec3(); +} +class oimo_dynamics_constraint_contact_ManifoldPoint { + constructor() { + this._localPos1X = 0; + this._localPos1Y = 0; + this._localPos1Z = 0; + this._localPos2X = 0; + this._localPos2Y = 0; + this._localPos2Z = 0; + this._relPos1X = 0; + this._relPos1Y = 0; + this._relPos1Z = 0; + this._relPos2X = 0; + this._relPos2Y = 0; + this._relPos2Z = 0; + this._pos1X = 0; + this._pos1Y = 0; + this._pos1Z = 0; + this._pos2X = 0; + this._pos2Y = 0; + this._pos2Z = 0; + this._depth = 0; + this._impulse = new oimo_dynamics_constraint_contact_ContactImpulse(); + this._warmStarted = false; + this._disabled = false; + this._id = -1; + } + getPosition1() { + let v = new oimo_common_Vec3(); v.x = this._pos1X; v.y = this._pos1Y; v.z = this._pos1Z; return v; } - ,getPosition1To: function(position) { + getPosition1To(position) { position.x = this._pos1X; position.y = this._pos1Y; position.z = this._pos1Z; } - ,getPosition2: function() { - var v = new oimo_common_Vec3(); + getPosition2() { + let v = new oimo_common_Vec3(); v.x = this._pos2X; v.y = this._pos2Y; v.z = this._pos2Z; return v; } - ,getPosition2To: function(position) { + getPosition2To(position) { position.x = this._pos2X; position.y = this._pos2Y; position.z = this._pos2Z; } - ,getDepth: function() { + getDepth() { return this._depth; } - ,isWarmStarted: function() { + isWarmStarted() { return this._warmStarted; } - ,getNormalImpulse: function() { + getNormalImpulse() { return this._impulse.impulseN; } - ,getTangentImpulse: function() { + getTangentImpulse() { return this._impulse.impulseT; } - ,getBinormalImpulse: function() { + getBinormalImpulse() { return this._impulse.impulseB; } - ,isEnabled: function() { + isEnabled() { return !this._disabled; } -}; -var oimo_dynamics_constraint_contact_ManifoldUpdater = function(manifold) { - this._manifold = manifold; - this.numOldPoints = 0; - this.oldPoints = new Array(oimo_common_Setting.maxManifoldPoints); - var _g = 0; - var _g1 = oimo_common_Setting.maxManifoldPoints; - while(_g < _g1) this.oldPoints[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); -}; -oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { - removeOutdatedPoints: function() { - var index = this._manifold._numPoints; +} +class oimo_dynamics_constraint_contact_ManifoldUpdater { + constructor(manifold) { + this._manifold = manifold; + this.numOldPoints = 0; + this.oldPoints = new Array(oimo_common_Setting.maxManifoldPoints); + let _g = 0; + let _g1 = oimo_common_Setting.maxManifoldPoints; + while(_g < _g1) this.oldPoints[_g++] = new oimo_dynamics_constraint_contact_ManifoldPoint(); + } + removeOutdatedPoints() { + let index = this._manifold._numPoints; while(--index >= 0) { - var p = this._manifold._points[index]; - var diffX; - var diffY; - var diffZ; + let p = this._manifold._points[index]; + let diffX; + let diffY; + let diffZ; diffX = p._pos1X - p._pos2X; diffY = p._pos1Y - p._pos2Y; diffZ = p._pos1Z - p._pos2Z; - var dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; + let dotN = this._manifold._normalX * diffX + this._manifold._normalY * diffY + this._manifold._normalZ * diffZ; if(dotN > oimo_common_Setting.contactPersistenceThreshold) { this.removeManifoldPoint(index); continue; @@ -21941,14 +22165,14 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } } } - ,removeManifoldPoint: function(index) { - var lastIndex = --this._manifold._numPoints; + removeManifoldPoint(index) { + let lastIndex = --this._manifold._numPoints; if(index != lastIndex) { - var tmp = this._manifold._points[index]; + let tmp = this._manifold._points[index]; this._manifold._points[index] = this._manifold._points[lastIndex]; this._manifold._points[lastIndex] = tmp; } - var _this = this._manifold._points[lastIndex]; + let _this = this._manifold._points[lastIndex]; _this._localPos1X = 0; _this._localPos1Y = 0; _this._localPos1Z = 0; @@ -21968,7 +22192,7 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._pos2Y = 0; _this._pos2Z = 0; _this._depth = 0; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -21980,15 +22204,16 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._disabled = false; _this._id = -1; } - ,addManifoldPoint: function(point,tf1,tf2) { - var num = this._manifold._numPoints; + addManifoldPoint(point,tf1,tf2) { + let num = this._manifold._numPoints; if(num == oimo_common_Setting.maxManifoldPoints) { - var _this = this._manifold._points[this.computeTargetIndex(point,tf1,tf2)]; - var v = point.position1; + let targetIndex = this.computeTargetIndex(point,tf1,tf2); + let _this = this._manifold._points[targetIndex]; + let v = point.position1; _this._pos1X = v.x; _this._pos1Y = v.y; _this._pos1Z = v.z; - var v1 = point.position2; + let v1 = point.position2; _this._pos2X = v1.x; _this._pos2Y = v1.y; _this._pos2Z = v1.z; @@ -21998,18 +22223,18 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._relPos2X = _this._pos2X - tf2._positionX; _this._relPos2Y = _this._pos2Y - tf2._positionY; _this._relPos2Z = _this._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; _this._localPos1X = __tmp__X; _this._localPos1Y = __tmp__Y; _this._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; @@ -22017,7 +22242,7 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._localPos2Y = __tmp__Y1; _this._localPos2Z = __tmp__Z1; _this._depth = point.depth; - var _this1 = _this._impulse; + let _this1 = _this._impulse; _this1.impulseN = 0; _this1.impulseT = 0; _this1.impulseB = 0; @@ -22030,60 +22255,60 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._disabled = false; return; } - var _this2 = this._manifold._points[num]; - var v2 = point.position1; - _this2._pos1X = v2.x; - _this2._pos1Y = v2.y; - _this2._pos1Z = v2.z; - var v3 = point.position2; - _this2._pos2X = v3.x; - _this2._pos2Y = v3.y; - _this2._pos2Z = v3.z; - _this2._relPos1X = _this2._pos1X - tf1._positionX; - _this2._relPos1Y = _this2._pos1Y - tf1._positionY; - _this2._relPos1Z = _this2._pos1Z - tf1._positionZ; - _this2._relPos2X = _this2._pos2X - tf2._positionX; - _this2._relPos2Y = _this2._pos2Y - tf2._positionY; - _this2._relPos2Z = _this2._pos2Z - tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * _this2._relPos1X + tf1._rotation10 * _this2._relPos1Y + tf1._rotation20 * _this2._relPos1Z; - __tmp__Y2 = tf1._rotation01 * _this2._relPos1X + tf1._rotation11 * _this2._relPos1Y + tf1._rotation21 * _this2._relPos1Z; - __tmp__Z2 = tf1._rotation02 * _this2._relPos1X + tf1._rotation12 * _this2._relPos1Y + tf1._rotation22 * _this2._relPos1Z; - _this2._localPos1X = __tmp__X2; - _this2._localPos1Y = __tmp__Y2; - _this2._localPos1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * _this2._relPos2X + tf2._rotation10 * _this2._relPos2Y + tf2._rotation20 * _this2._relPos2Z; - __tmp__Y3 = tf2._rotation01 * _this2._relPos2X + tf2._rotation11 * _this2._relPos2Y + tf2._rotation21 * _this2._relPos2Z; - __tmp__Z3 = tf2._rotation02 * _this2._relPos2X + tf2._rotation12 * _this2._relPos2Y + tf2._rotation22 * _this2._relPos2Z; - _this2._localPos2X = __tmp__X3; - _this2._localPos2Y = __tmp__Y3; - _this2._localPos2Z = __tmp__Z3; - _this2._depth = point.depth; - var _this3 = _this2._impulse; - _this3.impulseN = 0; - _this3.impulseT = 0; - _this3.impulseB = 0; - _this3.impulseP = 0; - _this3.impulseLX = 0; - _this3.impulseLY = 0; - _this3.impulseLZ = 0; - _this2._id = point.id; - _this2._warmStarted = false; - _this2._disabled = false; + let _this = this._manifold._points[num]; + let v = point.position1; + _this._pos1X = v.x; + _this._pos1Y = v.y; + _this._pos1Z = v.z; + let v1 = point.position2; + _this._pos2X = v1.x; + _this._pos2Y = v1.y; + _this._pos2Z = v1.z; + _this._relPos1X = _this._pos1X - tf1._positionX; + _this._relPos1Y = _this._pos1Y - tf1._positionY; + _this._relPos1Z = _this._pos1Z - tf1._positionZ; + _this._relPos2X = _this._pos2X - tf2._positionX; + _this._relPos2Y = _this._pos2Y - tf2._positionY; + _this._relPos2Z = _this._pos2Z - tf2._positionZ; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; + __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; + __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; + _this._localPos1X = __tmp__X; + _this._localPos1Y = __tmp__Y; + _this._localPos1Z = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X1; + _this._localPos2Y = __tmp__Y1; + _this._localPos2Z = __tmp__Z1; + _this._depth = point.depth; + let _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._id = point.id; + _this._warmStarted = false; + _this._disabled = false; this._manifold._numPoints++; } - ,computeTargetIndex: function(newPoint,tf1,tf2) { - var p1 = this._manifold._points[0]; - var p2 = this._manifold._points[1]; - var p3 = this._manifold._points[2]; - var p4 = this._manifold._points[3]; - var maxDepth = p1._depth; - var maxDepthIndex = 0; + computeTargetIndex(newPoint,tf1,tf2) { + let p1 = this._manifold._points[0]; + let p2 = this._manifold._points[1]; + let p3 = this._manifold._points[2]; + let p4 = this._manifold._points[3]; + let maxDepth = p1._depth; + let maxDepthIndex = 0; if(p2._depth > maxDepth) { maxDepth = p2._depth; maxDepthIndex = 1; @@ -22096,43 +22321,43 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { maxDepth = p4._depth; maxDepthIndex = 3; } - var rp1X; - var rp1Y; - var rp1Z; - var v = newPoint.position1; + let rp1X; + let rp1Y; + let rp1Z; + let v = newPoint.position1; rp1X = v.x; rp1Y = v.y; rp1Z = v.z; rp1X -= tf1._positionX; rp1Y -= tf1._positionY; rp1Z -= tf1._positionZ; - var p1X = p2._relPos1X; - var p1Y = p2._relPos1Y; - var p1Z = p2._relPos1Z; - var p2X = p3._relPos1X; - var p2Y = p3._relPos1Y; - var p2Z = p3._relPos1Z; - var p3X = p4._relPos1X; - var p3Y = p4._relPos1Y; - var p3Z = p4._relPos1Z; - var v12X; - var v12Y; - var v12Z; - var v34X; - var v34Y; - var v34Z; - var v13X; - var v13Y; - var v13Z; - var v24X; - var v24Y; - var v24Z; - var v14X; - var v14Y; - var v14Z; - var v23X; - var v23Y; - var v23Z; + let p1X = p2._relPos1X; + let p1Y = p2._relPos1Y; + let p1Z = p2._relPos1Z; + let p2X = p3._relPos1X; + let p2Y = p3._relPos1Y; + let p2Z = p3._relPos1Z; + let p3X = p4._relPos1X; + let p3Y = p4._relPos1Y; + let p3Z = p4._relPos1Z; + let v12X; + let v12Y; + let v12Z; + let v34X; + let v34Y; + let v34Z; + let v13X; + let v13Y; + let v13Z; + let v24X; + let v24Y; + let v24Z; + let v14X; + let v14Y; + let v14Z; + let v23X; + let v23Y; + let v23Z; v12X = p2X - p1X; v12Y = p2Y - p1Y; v12Z = p2Z - p1Z; @@ -22151,15 +22376,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X = p3X - p2X; v23Y = p3Y - p2Y; v23Z = p3Z - p2Z; - var cross1X; - var cross1Y; - var cross1Z; - var cross2X; - var cross2Y; - var cross2Z; - var cross3X; - var cross3Y; - var cross3Z; + let cross1X; + let cross1Y; + let cross1Z; + let cross2X; + let cross2Y; + let cross2Z; + let cross3X; + let cross3Y; + let cross3Z; cross1X = v12Y * v34Z - v12Z * v34Y; cross1Y = v12Z * v34X - v12X * v34Z; cross1Z = v12X * v34Y - v12Y * v34X; @@ -22169,36 +22394,36 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X = v14Y * v23Z - v14Z * v23Y; cross3Y = v14Z * v23X - v14X * v23Z; cross3Z = v14X * v23Y - v14Y * v23X; - var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; - var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; - var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; - var p1X1 = p1._relPos1X; - var p1Y1 = p1._relPos1Y; - var p1Z1 = p1._relPos1Z; - var p2X1 = p3._relPos1X; - var p2Y1 = p3._relPos1Y; - var p2Z1 = p3._relPos1Z; - var p3X1 = p4._relPos1X; - var p3Y1 = p4._relPos1Y; - var p3Z1 = p4._relPos1Z; - var v12X1; - var v12Y1; - var v12Z1; - var v34X1; - var v34Y1; - var v34Z1; - var v13X1; - var v13Y1; - var v13Z1; - var v24X1; - var v24Y1; - var v24Z1; - var v14X1; - var v14Y1; - var v14Z1; - var v23X1; - var v23Y1; - var v23Z1; + let a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + let a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + let a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + let p1X1 = p1._relPos1X; + let p1Y1 = p1._relPos1Y; + let p1Z1 = p1._relPos1Z; + let p2X1 = p3._relPos1X; + let p2Y1 = p3._relPos1Y; + let p2Z1 = p3._relPos1Z; + let p3X1 = p4._relPos1X; + let p3Y1 = p4._relPos1Y; + let p3Z1 = p4._relPos1Z; + let v12X1; + let v12Y1; + let v12Z1; + let v34X1; + let v34Y1; + let v34Z1; + let v13X1; + let v13Y1; + let v13Z1; + let v24X1; + let v24Y1; + let v24Z1; + let v14X1; + let v14Y1; + let v14Z1; + let v23X1; + let v23Y1; + let v23Z1; v12X1 = p2X1 - p1X1; v12Y1 = p2Y1 - p1Y1; v12Z1 = p2Z1 - p1Z1; @@ -22217,15 +22442,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X1 = p3X1 - p2X1; v23Y1 = p3Y1 - p2Y1; v23Z1 = p3Z1 - p2Z1; - var cross1X1; - var cross1Y1; - var cross1Z1; - var cross2X1; - var cross2Y1; - var cross2Z1; - var cross3X1; - var cross3Y1; - var cross3Z1; + let cross1X1; + let cross1Y1; + let cross1Z1; + let cross2X1; + let cross2Y1; + let cross2Z1; + let cross3X1; + let cross3Y1; + let cross3Z1; cross1X1 = v12Y1 * v34Z1 - v12Z1 * v34Y1; cross1Y1 = v12Z1 * v34X1 - v12X1 * v34Z1; cross1Z1 = v12X1 * v34Y1 - v12Y1 * v34X1; @@ -22235,37 +22460,37 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; - var a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; - var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; - var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; - var a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; - var p1X2 = p1._relPos1X; - var p1Y2 = p1._relPos1Y; - var p1Z2 = p1._relPos1Z; - var p2X2 = p2._relPos1X; - var p2Y2 = p2._relPos1Y; - var p2Z2 = p2._relPos1Z; - var p3X2 = p4._relPos1X; - var p3Y2 = p4._relPos1Y; - var p3Z2 = p4._relPos1Z; - var v12X2; - var v12Y2; - var v12Z2; - var v34X2; - var v34Y2; - var v34Z2; - var v13X2; - var v13Y2; - var v13Z2; - var v24X2; - var v24Y2; - var v24Z2; - var v14X2; - var v14Y2; - var v14Z2; - var v23X2; - var v23Y2; - var v23Z2; + let a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; + let a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; + let a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; + let a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; + let p1X2 = p1._relPos1X; + let p1Y2 = p1._relPos1Y; + let p1Z2 = p1._relPos1Z; + let p2X2 = p2._relPos1X; + let p2Y2 = p2._relPos1Y; + let p2Z2 = p2._relPos1Z; + let p3X2 = p4._relPos1X; + let p3Y2 = p4._relPos1Y; + let p3Z2 = p4._relPos1Z; + let v12X2; + let v12Y2; + let v12Z2; + let v34X2; + let v34Y2; + let v34Z2; + let v13X2; + let v13Y2; + let v13Z2; + let v24X2; + let v24Y2; + let v24Z2; + let v14X2; + let v14Y2; + let v14Z2; + let v23X2; + let v23Y2; + let v23Z2; v12X2 = p2X2 - p1X2; v12Y2 = p2Y2 - p1Y2; v12Z2 = p2Z2 - p1Z2; @@ -22284,15 +22509,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X2 = p3X2 - p2X2; v23Y2 = p3Y2 - p2Y2; v23Z2 = p3Z2 - p2Z2; - var cross1X2; - var cross1Y2; - var cross1Z2; - var cross2X2; - var cross2Y2; - var cross2Z2; - var cross3X2; - var cross3Y2; - var cross3Z2; + let cross1X2; + let cross1Y2; + let cross1Z2; + let cross2X2; + let cross2Y2; + let cross2Z2; + let cross3X2; + let cross3Y2; + let cross3Z2; cross1X2 = v12Y2 * v34Z2 - v12Z2 * v34Y2; cross1Y2 = v12Z2 * v34X2 - v12X2 * v34Z2; cross1Z2 = v12X2 * v34Y2 - v12Y2 * v34X2; @@ -22302,37 +22527,37 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; - var a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; - var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; - var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; - var a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; - var p1X3 = p1._relPos1X; - var p1Y3 = p1._relPos1Y; - var p1Z3 = p1._relPos1Z; - var p2X3 = p2._relPos1X; - var p2Y3 = p2._relPos1Y; - var p2Z3 = p2._relPos1Z; - var p3X3 = p3._relPos1X; - var p3Y3 = p3._relPos1Y; - var p3Z3 = p3._relPos1Z; - var v12X3; - var v12Y3; - var v12Z3; - var v34X3; - var v34Y3; - var v34Z3; - var v13X3; - var v13Y3; - var v13Z3; - var v24X3; - var v24Y3; - var v24Z3; - var v14X3; - var v14Y3; - var v14Z3; - var v23X3; - var v23Y3; - var v23Z3; + let a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; + let a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; + let a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; + let a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; + let p1X3 = p1._relPos1X; + let p1Y3 = p1._relPos1Y; + let p1Z3 = p1._relPos1Z; + let p2X3 = p2._relPos1X; + let p2Y3 = p2._relPos1Y; + let p2Z3 = p2._relPos1Z; + let p3X3 = p3._relPos1X; + let p3Y3 = p3._relPos1Y; + let p3Z3 = p3._relPos1Z; + let v12X3; + let v12Y3; + let v12Z3; + let v34X3; + let v34Y3; + let v34Z3; + let v13X3; + let v13Y3; + let v13Z3; + let v24X3; + let v24Y3; + let v24Z3; + let v14X3; + let v14Y3; + let v14Z3; + let v23X3; + let v23Y3; + let v23Z3; v12X3 = p2X3 - p1X3; v12Y3 = p2Y3 - p1Y3; v12Z3 = p2Z3 - p1Z3; @@ -22351,15 +22576,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { v23X3 = p3X3 - p2X3; v23Y3 = p3Y3 - p2Y3; v23Z3 = p3Z3 - p2Z3; - var cross1X3; - var cross1Y3; - var cross1Z3; - var cross2X3; - var cross2Y3; - var cross2Z3; - var cross3X3; - var cross3Y3; - var cross3Z3; + let cross1X3; + let cross1Y3; + let cross1Z3; + let cross2X3; + let cross2Y3; + let cross2Z3; + let cross3X3; + let cross3Y3; + let cross3Z3; cross1X3 = v12Y3 * v34Z3 - v12Z3 * v34Y3; cross1Y3 = v12Z3 * v34X3 - v12X3 * v34Z3; cross1Z3 = v12X3 * v34Y3 - v12Y3 * v34X3; @@ -22369,12 +22594,12 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; - var a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; - var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; - var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; - var a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; - var max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; - var target = 0; + let a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; + let a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; + let a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; + let a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; + let max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; + let target = 0; if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { max = a22; target = 1; @@ -22389,23 +22614,23 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } return target; } - ,computeRelativePositions: function(tf1,tf2) { - var num = this._manifold._numPoints; - var _g = 0; + computeRelativePositions(tf1,tf2) { + let num = this._manifold._numPoints; + let _g = 0; while(_g < num) { - var p = this._manifold._points[_g++]; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let p = this._manifold._points[_g++]; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._localPos1X + tf1._rotation01 * p._localPos1Y + tf1._rotation02 * p._localPos1Z; __tmp__Y = tf1._rotation10 * p._localPos1X + tf1._rotation11 * p._localPos1Y + tf1._rotation12 * p._localPos1Z; __tmp__Z = tf1._rotation20 * p._localPos1X + tf1._rotation21 * p._localPos1Y + tf1._rotation22 * p._localPos1Z; p._relPos1X = __tmp__X; p._relPos1Y = __tmp__Y; p._relPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._localPos2X + tf2._rotation01 * p._localPos2Y + tf2._rotation02 * p._localPos2Z; __tmp__Y1 = tf2._rotation10 * p._localPos2X + tf2._rotation11 * p._localPos2Y + tf2._rotation12 * p._localPos2Z; __tmp__Z1 = tf2._rotation20 * p._localPos2X + tf2._rotation21 * p._localPos2Y + tf2._rotation22 * p._localPos2Z; @@ -22415,25 +22640,25 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { p._warmStarted = true; } } - ,findNearestContactPointIndex: function(target,tf1,tf2) { - var nearestSq = oimo_common_Setting.contactPersistenceThreshold * oimo_common_Setting.contactPersistenceThreshold; - var idx = -1; - var _g = 0; - var _g1 = this._manifold._numPoints; + findNearestContactPointIndex(target,tf1,tf2) { + let nearestSq = oimo_common_Setting.contactPersistenceThreshold * oimo_common_Setting.contactPersistenceThreshold; + let idx = -1; + let _g = 0; + let _g1 = this._manifold._numPoints; while(_g < _g1) { - var i = _g++; - var mp = this._manifold._points[i]; - var rp1X; - var rp1Y; - var rp1Z; - var rp2X; - var rp2Y; - var rp2Z; - var v = target.position1; + let i = _g++; + let mp = this._manifold._points[i]; + let rp1X; + let rp1Y; + let rp1Z; + let rp2X; + let rp2Y; + let rp2Z; + let v = target.position1; rp1X = v.x; rp1Y = v.y; rp1Z = v.z; - var v1 = target.position2; + let v1 = target.position2; rp2X = v1.x; rp2Y = v1.y; rp2Z = v1.z; @@ -22443,21 +22668,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { rp2X -= tf2._positionX; rp2Y -= tf2._positionY; rp2Z -= tf2._positionZ; - var diff1X; - var diff1Y; - var diff1Z; - var diff2X; - var diff2Y; - var diff2Z; + let diff1X; + let diff1Y; + let diff1Z; + let diff2X; + let diff2Y; + let diff2Z; diff1X = mp._relPos1X - rp1X; diff1Y = mp._relPos1Y - rp1Y; diff1Z = mp._relPos1Z - rp1Z; diff2X = mp._relPos2X - rp2X; diff2Y = mp._relPos2Y - rp2Y; diff2Z = mp._relPos2Z - rp2Z; - var sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; - var sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; - var d = sq1 < sq2 ? sq1 : sq2; + let sq1 = diff1X * diff1X + diff1Y * diff1Y + diff1Z * diff1Z; + let sq2 = diff2X * diff2X + diff2Y * diff2Y + diff2Z * diff2Z; + let d = sq1 < sq2 ? sq1 : sq2; if(d < nearestSq) { nearestSq = d; idx = i; @@ -22465,14 +22690,14 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } return idx; } - ,totalUpdate: function(result,tf1,tf2) { + totalUpdate(result,tf1,tf2) { this.numOldPoints = this._manifold._numPoints; - var _g = 0; - var _g1 = this.numOldPoints; + let _g = 0; + let _g1 = this.numOldPoints; while(_g < _g1) { - var i = _g++; - var _this = this.oldPoints[i]; - var cp = this._manifold._points[i]; + let i = _g++; + let _this = this.oldPoints[i]; + let cp = this._manifold._points[i]; _this._localPos1X = cp._localPos1X; _this._localPos1Y = cp._localPos1Y; _this._localPos1Z = cp._localPos1Z; @@ -22497,18 +22722,18 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._warmStarted = cp._warmStarted; _this._disabled = false; } - var num = result.numPoints; + let num = result.numPoints; this._manifold._numPoints = num; - var _g2 = 0; + let _g2 = 0; while(_g2 < num) { - var i1 = _g2++; - var p = this._manifold._points[i1]; - var ref = result.points[i1]; - var v = ref.position1; + let i = _g2++; + let p = this._manifold._points[i]; + let ref = result.points[i]; + let v = ref.position1; p._pos1X = v.x; p._pos1Y = v.y; p._pos1Z = v.z; - var v1 = ref.position2; + let v1 = ref.position2; p._pos2X = v1.x; p._pos2Y = v1.y; p._pos2Z = v1.z; @@ -22518,18 +22743,18 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { p._relPos2X = p._pos2X - tf2._positionX; p._relPos2Y = p._pos2Y - tf2._positionY; p._relPos2Z = p._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * p._relPos1X + tf1._rotation10 * p._relPos1Y + tf1._rotation20 * p._relPos1Z; __tmp__Y = tf1._rotation01 * p._relPos1X + tf1._rotation11 * p._relPos1Y + tf1._rotation21 * p._relPos1Z; __tmp__Z = tf1._rotation02 * p._relPos1X + tf1._rotation12 * p._relPos1Y + tf1._rotation22 * p._relPos1Z; p._localPos1X = __tmp__X; p._localPos1Y = __tmp__Y; p._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * p._relPos2X + tf2._rotation10 * p._relPos2Y + tf2._rotation20 * p._relPos2Z; __tmp__Y1 = tf2._rotation01 * p._relPos2X + tf2._rotation11 * p._relPos2Y + tf2._rotation21 * p._relPos2Z; __tmp__Z1 = tf2._rotation02 * p._relPos2X + tf2._rotation12 * p._relPos2Y + tf2._rotation22 * p._relPos2Z; @@ -22537,21 +22762,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { p._localPos2Y = __tmp__Y1; p._localPos2Z = __tmp__Z1; p._depth = ref.depth; - var _this1 = p._impulse; - _this1.impulseN = 0; - _this1.impulseT = 0; - _this1.impulseB = 0; - _this1.impulseP = 0; - _this1.impulseLX = 0; - _this1.impulseLY = 0; - _this1.impulseLZ = 0; + let _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; p._id = ref.id; p._warmStarted = false; p._disabled = false; - var _g3 = 0; - var _g11 = this.numOldPoints; - while(_g3 < _g11) { - var ocp = this.oldPoints[_g3++]; + let _g = 0; + let _g1 = this.numOldPoints; + while(_g < _g1) { + let ocp = this.oldPoints[_g++]; if(p._id == ocp._id) { p._impulse.copyFrom(ocp._impulse); p._warmStarted = true; @@ -22560,22 +22785,22 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } } } - ,incrementalUpdate: function(result,tf1,tf2) { + incrementalUpdate(result,tf1,tf2) { this._manifold._updateDepthsAndPositions(tf1,tf2); - var _g = 0; - var _g1 = this._manifold._numPoints; + let _g = 0; + let _g1 = this._manifold._numPoints; while(_g < _g1) this._manifold._points[_g++]._warmStarted = true; - var newPoint = result.points[0]; - var index = this.findNearestContactPointIndex(newPoint,tf1,tf2); + let newPoint = result.points[0]; + let index = this.findNearestContactPointIndex(newPoint,tf1,tf2); if(index == -1) { this.addManifoldPoint(newPoint,tf1,tf2); } else { - var cp = this._manifold._points[index]; - var v = newPoint.position1; + let cp = this._manifold._points[index]; + let v = newPoint.position1; cp._pos1X = v.x; cp._pos1Y = v.y; cp._pos1Z = v.z; - var v1 = newPoint.position2; + let v1 = newPoint.position2; cp._pos2X = v1.x; cp._pos2Y = v1.y; cp._pos2Z = v1.z; @@ -22585,18 +22810,18 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cp._relPos2X = cp._pos2X - tf2._positionX; cp._relPos2Y = cp._pos2Y - tf2._positionY; cp._relPos2Z = cp._pos2Z - tf2._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * cp._relPos1X + tf1._rotation10 * cp._relPos1Y + tf1._rotation20 * cp._relPos1Z; __tmp__Y = tf1._rotation01 * cp._relPos1X + tf1._rotation11 * cp._relPos1Y + tf1._rotation21 * cp._relPos1Z; __tmp__Z = tf1._rotation02 * cp._relPos1X + tf1._rotation12 * cp._relPos1Y + tf1._rotation22 * cp._relPos1Z; cp._localPos1X = __tmp__X; cp._localPos1Y = __tmp__Y; cp._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; __tmp__Y1 = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; __tmp__Z1 = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; @@ -22607,24 +22832,24 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } this.removeOutdatedPoints(); } -}; -var oimo_dynamics_constraint_info_JacobianRow = function() { - this.lin1X = 0; - this.lin1Y = 0; - this.lin1Z = 0; - this.lin2X = 0; - this.lin2Y = 0; - this.lin2Z = 0; - this.ang1X = 0; - this.ang1Y = 0; - this.ang1Z = 0; - this.ang2X = 0; - this.ang2Y = 0; - this.ang2Z = 0; - this.flag = 0; -}; -oimo_dynamics_constraint_info_JacobianRow.prototype = { - updateSparsity: function() { +} +class oimo_dynamics_constraint_info_JacobianRow { + constructor() { + this.lin1X = 0; + this.lin1Y = 0; + this.lin1Z = 0; + this.lin2X = 0; + this.lin2Y = 0; + this.lin2Z = 0; + this.ang1X = 0; + this.ang1Y = 0; + this.ang1Z = 0; + this.ang2X = 0; + this.ang2Y = 0; + this.ang2Z = 0; + this.flag = 0; + } + updateSparsity() { this.flag = 0; if(!(this.lin1X == 0 && this.lin1Y == 0 && this.lin1Z == 0) || !(this.lin2X == 0 && this.lin2Y == 0 && this.lin2Z == 0)) { this.flag |= 1; @@ -22633,126 +22858,136 @@ oimo_dynamics_constraint_info_JacobianRow.prototype = { this.flag |= 2; } } -}; -var oimo_dynamics_constraint_info_contact_ContactSolverInfo = function() { - this.b1 = null; - this.b2 = null; - this.numRows = 0; - this.rows = new Array(oimo_common_Setting.maxManifoldPoints); - var _g = 0; - var _g1 = this.rows.length; - while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_contact_ContactSolverInfoRow(); -}; -var oimo_dynamics_constraint_info_contact_ContactSolverInfoRow = function() { - this.jacobianN = new oimo_dynamics_constraint_info_JacobianRow(); - this.jacobianT = new oimo_dynamics_constraint_info_JacobianRow(); - this.jacobianB = new oimo_dynamics_constraint_info_JacobianRow(); - this.rhs = 0; - this.cfm = 0; - this.friction = 0; - this.impulse = null; -}; -var oimo_dynamics_constraint_info_joint_JointSolverInfo = function() { - this.b1 = null; - this.b2 = null; - this.numRows = 0; - this.rows = new Array(oimo_common_Setting.maxJacobianRows); - var _g = 0; - var _g1 = this.rows.length; - while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_joint_JointSolverInfoRow(); -}; -var oimo_dynamics_constraint_info_joint_JointSolverInfoRow = function() { - this.jacobian = new oimo_dynamics_constraint_info_JacobianRow(); - this.rhs = 0; - this.cfm = 0; - this.minImpulse = 0; - this.maxImpulse = 0; - this.motorSpeed = 0; - this.motorMaxImpulse = 0; - this.impulse = null; -}; -var oimo_dynamics_constraint_joint_BasisTracker = function(joint) { - this.joint = joint; - this.xX = 0; - this.xY = 0; - this.xZ = 0; - this.yX = 0; - this.yY = 0; - this.yZ = 0; - this.zX = 0; - this.zY = 0; - this.zZ = 0; -}; -var oimo_dynamics_constraint_joint_Joint = function(config,type) { - this._link1 = new oimo_dynamics_constraint_joint_JointLink(this); - this._link2 = new oimo_dynamics_constraint_joint_JointLink(this); - this._positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; - this._type = type; - this._world = null; - this._b1 = config.rigidBody1; - this._b2 = config.rigidBody2; - this._allowCollision = config.allowCollision; - this._breakForce = config.breakForce; - this._breakTorque = config.breakTorque; - switch(config.solverType) { - case 0: - this._solver = new oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver(this); - break; - case 1: - this._solver = new oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver(this); - break; - } - var v = config.localAnchor1; - this._localAnchor1X = v.x; - this._localAnchor1Y = v.y; - this._localAnchor1Z = v.z; - var v1 = config.localAnchor2; - this._localAnchor2X = v1.x; - this._localAnchor2Y = v1.y; - this._localAnchor2Z = v1.z; - this._relativeAnchor1X = 0; - this._relativeAnchor1Y = 0; - this._relativeAnchor1Z = 0; - this._relativeAnchor2X = 0; - this._relativeAnchor2Y = 0; - this._relativeAnchor2Z = 0; - this._anchor1X = 0; - this._anchor1Y = 0; - this._anchor1Z = 0; - this._anchor2X = 0; - this._anchor2Y = 0; - this._anchor2Z = 0; - this._localBasisX1X = 0; - this._localBasisX1Y = 0; - this._localBasisX1Z = 0; - this._localBasisY1X = 0; - this._localBasisY1Y = 0; - this._localBasisY1Z = 0; - this._localBasisZ1X = 0; - this._localBasisZ1Y = 0; - this._localBasisZ1Z = 0; - this._localBasisX2X = 0; - this._localBasisX2Y = 0; - this._localBasisX2Z = 0; - this._localBasisY2X = 0; - this._localBasisY2Y = 0; - this._localBasisY2Z = 0; - this._localBasisZ2X = 0; - this._localBasisZ2Y = 0; - this._localBasisZ2Z = 0; - this._impulses = new Array(oimo_common_Setting.maxJacobianRows); - var _g1 = 0; - var _g2 = oimo_common_Setting.maxJacobianRows; - while(_g1 < _g2) this._impulses[_g1++] = new oimo_dynamics_constraint_joint_JointImpulse(); -}; -oimo_dynamics_constraint_joint_Joint.prototype = { - buildLocalBasesFromX: function() { +} +class oimo_dynamics_constraint_info_contact_ContactSolverInfo { + constructor() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + this.rows = new Array(oimo_common_Setting.maxManifoldPoints); + let _g = 0; + let _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_contact_ContactSolverInfoRow(); + } +} +class oimo_dynamics_constraint_info_contact_ContactSolverInfoRow { + constructor() { + this.jacobianN = new oimo_dynamics_constraint_info_JacobianRow(); + this.jacobianT = new oimo_dynamics_constraint_info_JacobianRow(); + this.jacobianB = new oimo_dynamics_constraint_info_JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.friction = 0; + this.impulse = null; + } +} +class oimo_dynamics_constraint_info_joint_JointSolverInfo { + constructor() { + this.b1 = null; + this.b2 = null; + this.numRows = 0; + this.rows = new Array(oimo_common_Setting.maxJacobianRows); + let _g = 0; + let _g1 = this.rows.length; + while(_g < _g1) this.rows[_g++] = new oimo_dynamics_constraint_info_joint_JointSolverInfoRow(); + } +} +class oimo_dynamics_constraint_info_joint_JointSolverInfoRow { + constructor() { + this.jacobian = new oimo_dynamics_constraint_info_JacobianRow(); + this.rhs = 0; + this.cfm = 0; + this.minImpulse = 0; + this.maxImpulse = 0; + this.motorSpeed = 0; + this.motorMaxImpulse = 0; + this.impulse = null; + } +} +class oimo_dynamics_constraint_joint_BasisTracker { + constructor(joint) { + this.joint = joint; + this.xX = 0; + this.xY = 0; + this.xZ = 0; + this.yX = 0; + this.yY = 0; + this.yZ = 0; + this.zX = 0; + this.zY = 0; + this.zZ = 0; + } +} +class oimo_dynamics_constraint_joint_Joint { + constructor(config,type) { + this._link1 = new oimo_dynamics_constraint_joint_JointLink(this); + this._link2 = new oimo_dynamics_constraint_joint_JointLink(this); + this._positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; + this._type = type; + this._world = null; + this._b1 = config.rigidBody1; + this._b2 = config.rigidBody2; + this._allowCollision = config.allowCollision; + this._breakForce = config.breakForce; + this._breakTorque = config.breakTorque; + switch(config.solverType) { + case 0: + this._solver = new oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver(this); + break; + case 1: + this._solver = new oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver(this); + break; + } + let v = config.localAnchor1; + this._localAnchor1X = v.x; + this._localAnchor1Y = v.y; + this._localAnchor1Z = v.z; + let v1 = config.localAnchor2; + this._localAnchor2X = v1.x; + this._localAnchor2Y = v1.y; + this._localAnchor2Z = v1.z; + this._relativeAnchor1X = 0; + this._relativeAnchor1Y = 0; + this._relativeAnchor1Z = 0; + this._relativeAnchor2X = 0; + this._relativeAnchor2Y = 0; + this._relativeAnchor2Z = 0; + this._anchor1X = 0; + this._anchor1Y = 0; + this._anchor1Z = 0; + this._anchor2X = 0; + this._anchor2Y = 0; + this._anchor2Z = 0; + this._localBasisX1X = 0; + this._localBasisX1Y = 0; + this._localBasisX1Z = 0; + this._localBasisY1X = 0; + this._localBasisY1Y = 0; + this._localBasisY1Z = 0; + this._localBasisZ1X = 0; + this._localBasisZ1Y = 0; + this._localBasisZ1Z = 0; + this._localBasisX2X = 0; + this._localBasisX2Y = 0; + this._localBasisX2Z = 0; + this._localBasisY2X = 0; + this._localBasisY2Y = 0; + this._localBasisY2Z = 0; + this._localBasisZ2X = 0; + this._localBasisZ2Y = 0; + this._localBasisZ2Z = 0; + this._impulses = new Array(oimo_common_Setting.maxJacobianRows); + let _g = 0; + let _g1 = oimo_common_Setting.maxJacobianRows; + while(_g < _g1) this._impulses[_g++] = new oimo_dynamics_constraint_joint_JointImpulse(); + } + buildLocalBasesFromX() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { this._localBasisX1X = 1; this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -22765,60 +23000,60 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; - } - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + let l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; + } + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } slerpQX = vX; @@ -22826,13 +23061,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpQZ = vZ; slerpQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -22842,22 +23077,22 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpQZ = cZ; slerpQW = w; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -22867,60 +23102,60 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x21 = x1 * x1; + let y21 = y1 * y1; + let z21 = z1 * z1; + let d1; + if(x21 < y21) { + if(x21 < z21) { + d1 = 1 / Math.sqrt(y21 + z21); this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; + this._localBasisY1Y = z1 * d1; + this._localBasisY1Z = -y1 * d1; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY1X = y1 * d1; + this._localBasisY1Y = -x1 * d1; this._localBasisY1Z = 0; } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; + } else if(y21 < z21) { + d1 = 1 / Math.sqrt(z21 + x21); + this._localBasisY1X = -z1 * d1; this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; + this._localBasisY1Z = x1 * d1; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d1 = 1 / Math.sqrt(x21 + y21); + this._localBasisY1X = y1 * d1; + this._localBasisY1Y = -x1 * d1; this._localBasisY1Z = 0; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; this._localBasisY2X = __tmp__X1; this._localBasisY2Y = __tmp__Y1; this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; @@ -22928,13 +23163,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = __tmp__Y2; this._localBasisZ2Z = __tmp__Z2; } - ,buildLocalBasesFromXY: function() { + buildLocalBasesFromXY() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { this._localBasisX1X = 1; this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -22947,13 +23182,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; @@ -22962,13 +23197,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -22996,71 +23231,71 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l2; - this._localBasisZ1Y *= l2; - this._localBasisZ1Z *= l2; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; } if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { - var x11 = this._localBasisX2X; - var y11 = this._localBasisX2Y; - var z11 = this._localBasisX2Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d1; - if(x21 < y21) { - if(x21 < z21) { - d1 = 1 / Math.sqrt(y21 + z21); + let x1 = this._localBasisX2X; + let y1 = this._localBasisX2Y; + let z1 = this._localBasisX2Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); this._localBasisY2X = 0; - this._localBasisY2Y = z11 * d1; - this._localBasisY2Z = -y11 * d1; + this._localBasisY2Y = z1 * d; + this._localBasisY2Z = -y1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } - } else if(y21 < z21) { - d1 = 1 / Math.sqrt(z21 + x21); - this._localBasisY2X = -z11 * d1; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY2X = -z1 * d; this._localBasisY2Y = 0; - this._localBasisY2Z = x11 * d1; + this._localBasisY2Z = x1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; } else { - var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + let l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ2X *= l3; - this._localBasisZ2Y *= l3; - this._localBasisZ2Z *= l3; + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; } } - ,buildLocalBasesFromX1Z2: function() { + buildLocalBasesFromX1Z2() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { this._localBasisX1X = 1; this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -23073,43 +23308,43 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = 0; this._localBasisZ2Z = 1; } else { - var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._localBasisZ2X *= l1; - this._localBasisZ2Y *= l1; - this._localBasisZ2Z *= l1; - } - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var worldX1X; - var worldX1Y; - var worldX1Z; - var worldZ1X; - var worldZ1Y; - var worldZ1Z; - var worldYX; - var worldYY; - var worldYZ; - var worldX2X; - var worldX2Y; - var worldX2Z; - var worldZ2X; - var worldZ2Y; - var worldZ2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; + } + let tf1 = this._b1._transform; + let tf2 = this._b2._transform; + let worldX1X; + let worldX1Y; + let worldX1Z; + let worldZ1X; + let worldZ1Y; + let worldZ1Z; + let worldYX; + let worldYY; + let worldYZ; + let worldX2X; + let worldX2Y; + let worldX2Z; + let worldZ2X; + let worldZ2Y; + let worldZ2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; worldX1X = __tmp__X; worldX1Y = __tmp__Y; worldX1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; @@ -23120,13 +23355,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; if(worldYX * worldYX + worldYY * worldYY + worldYZ * worldYZ == 0) { - var x1 = worldX1X; - var y1 = worldX1Y; - var z1 = worldX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = worldX1X; + let y1 = worldX1Y; + let z1 = worldX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -23157,54 +23392,54 @@ oimo_dynamics_constraint_joint_Joint.prototype = { worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; this._localBasisX1X = __tmp__X2; this._localBasisX1Y = __tmp__Y2; this._localBasisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; this._localBasisY1X = __tmp__X3; this._localBasisY1Y = __tmp__Y3; this._localBasisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; this._localBasisZ1X = __tmp__X4; this._localBasisZ1Y = __tmp__Y4; this._localBasisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; this._localBasisX2X = __tmp__X5; this._localBasisX2Y = __tmp__Y5; this._localBasisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; + let __tmp__X6; + let __tmp__Y6; + let __tmp__Z6; __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; this._localBasisY2X = __tmp__X6; this._localBasisY2Y = __tmp__Y6; this._localBasisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; + let __tmp__X7; + let __tmp__Y7; + let __tmp__Z7; __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; @@ -23212,13 +23447,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = __tmp__Y7; this._localBasisZ2Z = __tmp__Z7; } - ,buildLocalBasesFromXY1X2: function() { + buildLocalBasesFromXY1X2() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { this._localBasisX1X = 1; this._localBasisX1Y = 0; this._localBasisX1Z = 0; } else { - var l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; + let l = this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z; if(l > 0) { l = 1 / Math.sqrt(l); } @@ -23230,13 +23465,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; if(this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z == 0) { - var x1 = this._localBasisX1X; - var y1 = this._localBasisX1Y; - var z1 = this._localBasisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { d = 1 / Math.sqrt(y2 + z2); @@ -23264,63 +23499,63 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + let l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l1; - this._localBasisZ1Y *= l1; - this._localBasisZ1Z *= l1; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; } - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d1 < -0.999999999) { - var vX; - var vY; - var vZ; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d2; - if(x21 < y21) { - if(x21 < z21) { - d2 = 1 / Math.sqrt(y21 + z21); + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = this._localBasisX1X; + let y1 = this._localBasisX1Y; + let z1 = this._localBasisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z11 * d2; - vZ = -y11 * d2; + vY = z1 * d; + vZ = -y1 * d; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } - } else if(y21 < z21) { - d2 = 1 / Math.sqrt(z21 + x21); - vX = -z11 * d2; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x11 * d2; + vZ = x1 * d; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } slerpQX = vX; @@ -23328,38 +23563,38 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpQZ = vZ; slerpQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d1) * 0.5); - d1 = 0.5 / w; - cX *= d1; - cY *= d1; - cZ *= d1; + let w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; slerpQX = cX; slerpQY = cY; slerpQZ = cZ; slerpQW = w; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x22 = 2 * x; - var y22 = 2 * y; - var z22 = 2 * z; - var xx = x * x22; - var yy = y * y22; - var zz = z * z22; - var xy = x * y22; - var yz = y * z22; - var xz = x * z22; - var wx = w1 * x22; - var wy = w1 * y22; - var wz = w1 * z22; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -23369,27 +23604,27 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * this._localBasisX1X + slerpM01 * this._localBasisX1Y + slerpM02 * this._localBasisX1Z; __tmp__Y = slerpM10 * this._localBasisX1X + slerpM11 * this._localBasisX1Y + slerpM12 * this._localBasisX1Z; __tmp__Z = slerpM20 * this._localBasisX1X + slerpM21 * this._localBasisX1Y + slerpM22 * this._localBasisX1Z; this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; this._localBasisY2X = __tmp__X1; this._localBasisY2Y = __tmp__Y1; this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; @@ -23397,24 +23632,24 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = __tmp__Y2; this._localBasisZ2Z = __tmp__Z2; } - ,setSolverInfoRowLinear: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { - var cfmFactor; - var erp; - var slop = oimo_common_Setting.linearSlop; + setSolverInfoRowLinear(row,diff,lm,mass,sd,timeStep,isPositionPart) { + let cfmFactor; + let erp; + let slop = oimo_common_Setting.linearSlop; if(isPositionPart) { cfmFactor = 0; erp = 1; } else { if(sd.frequency > 0) { slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; + let omega = 6.28318530717958 * sd.frequency; + let zeta = sd.dampingRatio; if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { zeta = oimo_common_Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(sd.useSymplecticEuler) { cfmFactor = 1 / (h * c); erp = k / c; @@ -23434,11 +23669,11 @@ oimo_dynamics_constraint_joint_Joint.prototype = { row.motorMaxImpulse = 0; } } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var minImp; - var maxImp; - var error; + let lower = lm.lowerLimit; + let upper = lm.upperLimit; + let minImp; + let maxImp; + let error; if(lower > upper) { minImp = 0; maxImp = 0; @@ -23471,24 +23706,24 @@ oimo_dynamics_constraint_joint_Joint.prototype = { row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); row.rhs = error * erp; } - ,setSolverInfoRowAngular: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { - var cfmFactor; - var erp; - var slop = oimo_common_Setting.angularSlop; + setSolverInfoRowAngular(row,diff,lm,mass,sd,timeStep,isPositionPart) { + let cfmFactor; + let erp; + let slop = oimo_common_Setting.angularSlop; if(isPositionPart) { cfmFactor = 0; erp = 1; } else { if(sd.frequency > 0) { slop = 0; - var omega = 6.28318530717958 * sd.frequency; - var zeta = sd.dampingRatio; + let omega = 6.28318530717958 * sd.frequency; + let zeta = sd.dampingRatio; if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { zeta = oimo_common_Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(sd.useSymplecticEuler) { cfmFactor = 1 / (h * c); erp = k / c; @@ -23508,15 +23743,15 @@ oimo_dynamics_constraint_joint_Joint.prototype = { row.motorMaxImpulse = 0; } } - var lower = lm.lowerLimit; - var upper = lm.upperLimit; - var mid = (lower + upper) * 0.5; + let lower = lm.lowerLimit; + let upper = lm.upperLimit; + let mid = (lower + upper) * 0.5; diff -= mid; diff = ((diff + 3.14159265358979) % 6.28318530717958 + 6.28318530717958) % 6.28318530717958 - 3.14159265358979; diff += mid; - var minImp; - var maxImp; - var error; + let minImp; + let maxImp; + let error; if(lower > upper) { minImp = 0; maxImp = 0; @@ -23549,7 +23784,7 @@ oimo_dynamics_constraint_joint_Joint.prototype = { row.cfm = cfmFactor * (mass == 0 ? 0 : 1 / mass); row.rhs = error * erp; } - ,getErp: function(timeStep,isPositionPart) { + getErp(timeStep,isPositionPart) { if(isPositionPart) { return 1; } else if(this._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE) { @@ -23558,36 +23793,36 @@ oimo_dynamics_constraint_joint_Joint.prototype = { return 0; } } - ,computeEffectiveInertiaMoment: function(axisX,axisY,axisZ) { - var ia1X; - var ia1Y; - var ia1Z; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + computeEffectiveInertiaMoment(axisX,axisY,axisZ) { + let ia1X; + let ia1Y; + let ia1Z; + let ia2X; + let ia2Y; + let ia2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._b1._invInertia00 * axisX + this._b1._invInertia01 * axisY + this._b1._invInertia02 * axisZ; __tmp__Y = this._b1._invInertia10 * axisX + this._b1._invInertia11 * axisY + this._b1._invInertia12 * axisZ; __tmp__Z = this._b1._invInertia20 * axisX + this._b1._invInertia21 * axisY + this._b1._invInertia22 * axisZ; ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; ia2X = __tmp__X1; ia2Y = __tmp__Y1; ia2Z = __tmp__Z1; - var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; - var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; + let invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; + let invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; if(invI1 > 0) { - var dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; - var projsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z - dot * dot; + let dot = axisX * this._relativeAnchor1X + axisY * this._relativeAnchor1Y + axisZ * this._relativeAnchor1Z; + let projsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z - dot * dot; if(projsq > 0) { if(this._b1._invMass > 0) { invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); @@ -23597,11 +23832,11 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } } if(invI2 > 0) { - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot1 * dot1; - if(projsq1 > 0) { + let dot = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + let projsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -23613,37 +23848,37 @@ oimo_dynamics_constraint_joint_Joint.prototype = { return 1 / (invI1 + invI2); } } - ,computeEffectiveInertiaMoment2: function(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { - var ia1X; - var ia1Y; - var ia1Z; - var ia2X; - var ia2Y; - var ia2Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + computeEffectiveInertiaMoment2(axis1X,axis1Y,axis1Z,axis2X,axis2Y,axis2Z) { + let ia1X; + let ia1Y; + let ia1Z; + let ia2X; + let ia2Y; + let ia2Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._b1._invInertia00 * axis1X + this._b1._invInertia01 * axis1Y + this._b1._invInertia02 * axis1Z; __tmp__Y = this._b1._invInertia10 * axis1X + this._b1._invInertia11 * axis1Y + this._b1._invInertia12 * axis1Z; __tmp__Z = this._b1._invInertia20 * axis1X + this._b1._invInertia21 * axis1Y + this._b1._invInertia22 * axis1Z; ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; ia2X = __tmp__X1; ia2Y = __tmp__Y1; ia2Z = __tmp__Z1; - var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; - var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; + let invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; + let invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; if(invI1 > 0) { - var rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; - var dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; - var projsq = rsq * rsq - dot * dot; + let rsq = this._relativeAnchor1X * this._relativeAnchor1X + this._relativeAnchor1Y * this._relativeAnchor1Y + this._relativeAnchor1Z * this._relativeAnchor1Z; + let dot = axis1X * this._relativeAnchor1X + axis1Y * this._relativeAnchor1Y + axis1Z * this._relativeAnchor1Z; + let projsq = rsq * rsq - dot * dot; if(projsq > 0) { if(this._b1._invMass > 0) { invI1 = 1 / (1 / invI1 + this._b1._mass * projsq); @@ -23653,12 +23888,12 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } } if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; - var projsq1 = rsq1 * rsq1 - dot1 * dot1; - if(projsq1 > 0) { + let rsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + let dot = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + let projsq = rsq * rsq - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -23670,21 +23905,21 @@ oimo_dynamics_constraint_joint_Joint.prototype = { return 1 / (invI1 + invI2); } } - ,_syncAnchors: function() { - var tf1 = this._b1._transform; - var tf2 = this._b2._transform; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + _syncAnchors() { + let tf1 = this._b1._transform; + let tf2 = this._b2._transform; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * this._localAnchor1X + tf1._rotation01 * this._localAnchor1Y + tf1._rotation02 * this._localAnchor1Z; __tmp__Y = tf1._rotation10 * this._localAnchor1X + tf1._rotation11 * this._localAnchor1Y + tf1._rotation12 * this._localAnchor1Z; __tmp__Z = tf1._rotation20 * this._localAnchor1X + tf1._rotation21 * this._localAnchor1Y + tf1._rotation22 * this._localAnchor1Z; this._relativeAnchor1X = __tmp__X; this._relativeAnchor1Y = __tmp__Y; this._relativeAnchor1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; @@ -23697,54 +23932,54 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._anchor2X = this._relativeAnchor2X + tf2._positionX; this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; this._basisX1X = __tmp__X2; this._basisX1Y = __tmp__Y2; this._basisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; this._basisY1X = __tmp__X3; this._basisY1Y = __tmp__Y3; this._basisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; this._basisZ1X = __tmp__X4; this._basisZ1Y = __tmp__Y4; this._basisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; this._basisX2X = __tmp__X5; this._basisX2Y = __tmp__Y5; this._basisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; + let __tmp__X6; + let __tmp__Y6; + let __tmp__Z6; __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; this._basisY2X = __tmp__X6; this._basisY2Y = __tmp__Y6; this._basisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; + let __tmp__X7; + let __tmp__Y7; + let __tmp__Z7; __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; @@ -23752,18 +23987,18 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._basisZ2Y = __tmp__Y7; this._basisZ2Z = __tmp__Z7; } - ,_getVelocitySolverInfo: function(timeStep,info) { + _getVelocitySolverInfo(timeStep,info) { info.b1 = this._b1; info.b2 = this._b2; info.numRows = 0; } - ,_getPositionSolverInfo: function(info) { + _getPositionSolverInfo(info) { info.b1 = this._b1; info.b2 = this._b2; info.numRows = 0; } - ,_checkDestruction: function() { - var torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; + _checkDestruction() { + let torqueSq = this._appliedTorqueX * this._appliedTorqueX + this._appliedTorqueY * this._appliedTorqueY + this._appliedTorqueZ * this._appliedTorqueZ; if(this._breakForce > 0 && this._appliedForceX * this._appliedForceX + this._appliedForceY * this._appliedForceY + this._appliedForceZ * this._appliedForceZ > this._breakForce * this._breakForce) { this._world.removeJoint(this); return; @@ -23773,74 +24008,74 @@ oimo_dynamics_constraint_joint_Joint.prototype = { return; } } - ,getRigidBody1: function() { + getRigidBody1() { return this._b1; } - ,getRigidBody2: function() { + getRigidBody2() { return this._b2; } - ,getType: function() { + getType() { return this._type; } - ,getAnchor1: function() { - var v = new oimo_common_Vec3(); + getAnchor1() { + let v = new oimo_common_Vec3(); v.x = this._anchor1X; v.y = this._anchor1Y; v.z = this._anchor1Z; return v; } - ,getAnchor2: function() { - var v = new oimo_common_Vec3(); + getAnchor2() { + let v = new oimo_common_Vec3(); v.x = this._anchor2X; v.y = this._anchor2Y; v.z = this._anchor2Z; return v; } - ,getAnchor1To: function(anchor) { + getAnchor1To(anchor) { anchor.x = this._anchor1X; anchor.y = this._anchor1Y; anchor.z = this._anchor1Z; } - ,getAnchor2To: function(anchor) { + getAnchor2To(anchor) { anchor.x = this._anchor2X; anchor.y = this._anchor2Y; anchor.z = this._anchor2Z; } - ,getLocalAnchor1: function() { - var v = new oimo_common_Vec3(); + getLocalAnchor1() { + let v = new oimo_common_Vec3(); v.x = this._localAnchor1X; v.y = this._localAnchor1Y; v.z = this._localAnchor1Z; return v; } - ,getLocalAnchor2: function() { - var v = new oimo_common_Vec3(); + getLocalAnchor2() { + let v = new oimo_common_Vec3(); v.x = this._localAnchor2X; v.y = this._localAnchor2Y; v.z = this._localAnchor2Z; return v; } - ,getLocalAnchor1To: function(localAnchor) { + getLocalAnchor1To(localAnchor) { localAnchor.x = this._localAnchor1X; localAnchor.y = this._localAnchor1Y; localAnchor.z = this._localAnchor1Z; } - ,getLocalAnchor2To: function(localAnchor) { + getLocalAnchor2To(localAnchor) { localAnchor.x = this._localAnchor2X; localAnchor.y = this._localAnchor2Y; localAnchor.z = this._localAnchor2Z; } - ,getBasis1: function() { - var m = new oimo_common_Mat3(); - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + getBasis1() { + let m = new oimo_common_Mat3(); + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX1X; b01 = this._basisY1X; b02 = this._basisZ1X; @@ -23861,17 +24096,17 @@ oimo_dynamics_constraint_joint_Joint.prototype = { m.e22 = b22; return m; } - ,getBasis2: function() { - var m = new oimo_common_Mat3(); - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + getBasis2() { + let m = new oimo_common_Mat3(); + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX2X; b01 = this._basisY2X; b02 = this._basisZ2X; @@ -23892,16 +24127,16 @@ oimo_dynamics_constraint_joint_Joint.prototype = { m.e22 = b22; return m; } - ,getBasis1To: function(basis) { - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + getBasis1To(basis) { + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX1X; b01 = this._basisY1X; b02 = this._basisZ1X; @@ -23921,16 +24156,16 @@ oimo_dynamics_constraint_joint_Joint.prototype = { basis.e21 = b21; basis.e22 = b22; } - ,getBasis2To: function(basis) { - var b00; - var b01; - var b02; - var b10; - var b11; - var b12; - var b20; - var b21; - var b22; + getBasis2To(basis) { + let b00; + let b01; + let b02; + let b10; + let b11; + let b12; + let b20; + let b21; + let b22; b00 = this._basisX2X; b01 = this._basisY2X; b02 = this._basisZ2X; @@ -23950,28 +24185,28 @@ oimo_dynamics_constraint_joint_Joint.prototype = { basis.e21 = b21; basis.e22 = b22; } - ,getAllowCollision: function() { + getAllowCollision() { return this._allowCollision; } - ,setAllowCollision: function(allowCollision) { + setAllowCollision(allowCollision) { this._allowCollision = allowCollision; } - ,getBreakForce: function() { + getBreakForce() { return this._breakForce; } - ,setBreakForce: function(breakForce) { + setBreakForce(breakForce) { this._breakForce = breakForce; } - ,getBreakTorque: function() { + getBreakTorque() { return this._breakTorque; } - ,setBreakTorque: function(breakTorque) { + setBreakTorque(breakTorque) { this._breakTorque = breakTorque; } - ,getPositionCorrectionAlgorithm: function() { + getPositionCorrectionAlgorithm() { return this._positionCorrectionAlgorithm; } - ,setPositionCorrectionAlgorithm: function(positionCorrectionAlgorithm) { + setPositionCorrectionAlgorithm(positionCorrectionAlgorithm) { switch(positionCorrectionAlgorithm) { case 0:case 1:case 2: break; @@ -23980,74 +24215,74 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } this._positionCorrectionAlgorithm = positionCorrectionAlgorithm; } - ,getAppliedForce: function() { - var v = new oimo_common_Vec3(); + getAppliedForce() { + let v = new oimo_common_Vec3(); v.x = this._appliedForceX; v.y = this._appliedForceY; v.z = this._appliedForceZ; return v; } - ,getAppliedForceTo: function(appliedForce) { + getAppliedForceTo(appliedForce) { appliedForce.x = this._appliedForceX; appliedForce.y = this._appliedForceY; appliedForce.z = this._appliedForceZ; } - ,getAppliedTorque: function() { - var v = new oimo_common_Vec3(); + getAppliedTorque() { + let v = new oimo_common_Vec3(); v.x = this._appliedTorqueX; v.y = this._appliedTorqueY; v.z = this._appliedTorqueZ; return v; } - ,getAppliedTorqueTo: function(appliedTorque) { + getAppliedTorqueTo(appliedTorque) { appliedTorque.x = this._appliedTorqueX; appliedTorque.y = this._appliedTorqueY; appliedTorque.z = this._appliedTorqueZ; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_constraint_joint_CylindricalJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,2); - var v = config.localAxis1; - this._localBasisX1X = v.x; - this._localBasisX1Y = v.y; - this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; - this.buildLocalBasesFromX(); - this.angle = 0; - this.angularErrorY = 0; - this.angularErrorZ = 0; - this.translation = 0; - this.linearErrorY = 0; - this.linearErrorZ = 0; - this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); - this._translSd = config.translationalSpringDamper.clone(); - this._translLm = config.translationalLimitMotor.clone(); - this._rotSd = config.rotationalSpringDamper.clone(); - this._rotLm = config.rotationalLimitMotor.clone(); -}; -oimo_dynamics_constraint_joint_CylindricalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linRhsY = this.linearErrorY * erp; - var linRhsZ = this.linearErrorZ * erp; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var j; - var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); +} +class oimo_dynamics_constraint_joint_CylindricalJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,2); + let v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + let v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this._translSd = config.translationalSpringDamper.clone(); + this._translLm = config.translationalLimitMotor.clone(); + this._rotSd = config.rotationalSpringDamper.clone(); + this._rotLm = config.rotationalLimitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + let erp = this.getErp(timeStep,isPositionPart); + let linRhsY = this.linearErrorY * erp; + let linRhsZ = this.linearErrorZ * erp; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let j; + let translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + let rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); if(this._translSd.frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -24068,7 +24303,7 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - this.setSolverInfoRowLinear(row,this.translation,this._translLm,1 / (this._b1._invMass + this._b2._invMass),this._translSd,timeStep,isPositionPart); + this.setSolverInfoRowLinear(row,this.translation,this._translLm,translationalMotorMass,this._translSd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; j.lin1Y = this._basis.xY; @@ -24083,9 +24318,49 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + let impulse1 = this._impulses[2]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -24106,26 +24381,59 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic row1.motorMaxImpulse = 0; row1.impulse = null; row1.impulse = impulse1; - row1.rhs = linRhsY; + row1.rhs = linRhsZ; row1.cfm = 0; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; j = row1.jacobian; - j.lin1X = this._basis.yX; - j.lin1Y = this._basis.yY; - j.lin1Z = this._basis.yZ; - j.lin2X = this._basis.yX; - j.lin2Y = this._basis.yY; - j.lin2Z = this._basis.yZ; - j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; - j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; - j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; - j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; - j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; - j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + if(this._rotSd.frequency <= 0 || !isPositionPart) { + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); + j = row.jacobian; + j.ang1X = this._basis.xX; + j.ang1Y = this._basis.xY; + j.ang1Z = this._basis.xZ; + j.ang2X = this._basis.xX; + j.ang2Y = this._basis.xY; + j.ang2Z = this._basis.xZ; + } + let impulse2 = this._impulses[4]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -24146,118 +24454,45 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic row2.motorMaxImpulse = 0; row2.impulse = null; row2.impulse = impulse2; - row2.rhs = linRhsZ; + row2.rhs = angRhsY; row2.cfm = 0; row2.minImpulse = -1e65536; row2.maxImpulse = 1e65536; j = row2.jacobian; - j.lin1X = this._basis.zX; - j.lin1Y = this._basis.zY; - j.lin1Z = this._basis.zZ; - j.lin2X = this._basis.zX; - j.lin2Y = this._basis.zY; - j.lin2Z = this._basis.zZ; - j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; - j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; - j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; - j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; - j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; - j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; - if(this._rotSd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); - j = row3.jacobian; - j.ang1X = this._basis.xX; - j.ang1Y = this._basis.xY; - j.ang1Z = this._basis.xZ; - j.ang2X = this._basis.xX; - j.ang2Y = this._basis.xY; - j.ang2Z = this._basis.xZ; - } - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; j.ang2X = this._basis.yX; j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; + let impulse3 = this._impulses[5]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsZ; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -24265,80 +24500,80 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._basis.zY; j.ang2Z = this._basis.zZ; } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var qX; - var qY; - var qZ; - var qW; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newXX; - var newXY; - var newXZ; - var newYX; - var newYY; - var newYZ; - var newZX; - var newZY; - var newZZ; - var prevXX; - var prevXY; - var prevXZ; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + _syncAnchors() { + super._syncAnchors(); + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -24346,13 +24581,13 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -24366,14 +24601,14 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic idQY = 0; idQZ = 0; idQW = 1; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -24382,19 +24617,19 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -24403,7 +24638,7 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -24412,21 +24647,21 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -24436,22 +24671,22 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -24461,9 +24696,9 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -24476,78 +24711,78 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -24557,9 +24792,9 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -24570,42 +24805,42 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -24621,40 +24856,40 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var angErrorX; - var angErrorY; - var angErrorZ; + let angErrorX; + let angErrorY; + let angErrorZ; angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + let cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + let theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + let l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCrossX; - var perpCrossY; - var perpCrossZ; + let perpCrossX; + let perpCrossY; + let perpCrossZ; perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -24662,110 +24897,110 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); + getAxis1() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxis2: function() { - var v = new oimo_common_Vec3(); + getAxis2() { + let v = new oimo_common_Vec3(); v.x = this._basisX2X; v.y = this._basisX2Y; v.z = this._basisX2Z; return v; } - ,getAxis1To: function(axis) { + getAxis1To(axis) { axis.x = this._basisX1X; axis.y = this._basisX1Y; axis.z = this._basisX1Z; } - ,getAxis2To: function(axis) { + getAxis2To(axis) { axis.x = this._basisX2X; axis.y = this._basisX2Y; axis.z = this._basisX2Z; } - ,getLocalAxis1: function() { - var v = new oimo_common_Vec3(); + getLocalAxis1() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX1X; v.y = this._localBasisX1Y; v.z = this._localBasisX1Z; return v; } - ,getLocalAxis2: function() { - var v = new oimo_common_Vec3(); + getLocalAxis2() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX2X; v.y = this._localBasisX2Y; v.z = this._localBasisX2Z; return v; } - ,getLocalAxis1To: function(axis) { + getLocalAxis1To(axis) { axis.x = this._localBasisX1X; axis.y = this._localBasisX1Y; axis.z = this._localBasisX1Z; } - ,getLocalAxis2To: function(axis) { + getLocalAxis2To(axis) { axis.x = this._localBasisX2X; axis.y = this._localBasisX2Y; axis.z = this._localBasisX2Z; } - ,getTranslationalSpringDamper: function() { + getTranslationalSpringDamper() { return this._translSd; } - ,getRotationalSpringDamper: function() { + getRotationalSpringDamper() { return this._rotSd; } - ,getTranslationalLimitMotor: function() { + getTranslationalLimitMotor() { return this._translLm; } - ,getRotationalLimitMotor: function() { + getRotationalLimitMotor() { return this._rotLm; } - ,getAngle: function() { + getAngle() { return this.angle; } - ,getTranslation: function() { + getTranslation() { return this.translation; } -}); -var oimo_dynamics_constraint_joint_JointConfig = function() { - this.rigidBody1 = null; - this.rigidBody2 = null; - this.localAnchor1 = new oimo_common_Vec3(); - this.localAnchor2 = new oimo_common_Vec3(); - this.allowCollision = false; - this.solverType = oimo_common_Setting.defaultJointConstraintSolverType; - this.positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; - this.breakForce = 0; - this.breakTorque = 0; -}; -oimo_dynamics_constraint_joint_JointConfig.prototype = { - _init: function(rb1,rb2,worldAnchor) { +} +class oimo_dynamics_constraint_joint_JointConfig { + constructor() { + this.rigidBody1 = null; + this.rigidBody2 = null; + this.localAnchor1 = new oimo_common_Vec3(); + this.localAnchor2 = new oimo_common_Vec3(); + this.allowCollision = false; + this.solverType = oimo_common_Setting.defaultJointConstraintSolverType; + this.positionCorrectionAlgorithm = oimo_common_Setting.defaultJointPositionCorrectionAlgorithm; + this.breakForce = 0; + this.breakTorque = 0; + } + _init(rb1,rb2,worldAnchor) { this.rigidBody1 = rb1; this.rigidBody2 = rb2; - var _this = this.rigidBody1; - var localPoint = this.localAnchor1; - var vX; - var vY; - var vZ; + let _this = this.rigidBody1; + let localPoint = this.localAnchor1; + let vX; + let vY; + let vZ; vX = worldAnchor.x; vY = worldAnchor.y; vZ = worldAnchor.z; vX -= _this._transform._positionX; vY -= _this._transform._positionY; vZ -= _this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; @@ -24775,20 +25010,20 @@ oimo_dynamics_constraint_joint_JointConfig.prototype = { localPoint.x = vX; localPoint.y = vY; localPoint.z = vZ; - var _this1 = this.rigidBody2; - var localPoint1 = this.localAnchor2; - var vX1; - var vY1; - var vZ1; + let _this1 = this.rigidBody2; + let localPoint1 = this.localAnchor2; + let vX1; + let vY1; + let vZ1; vX1 = worldAnchor.x; vY1 = worldAnchor.y; vZ1 = worldAnchor.z; vX1 -= _this1._transform._positionX; vY1 -= _this1._transform._positionY; vZ1 -= _this1._transform._positionZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; @@ -24799,30 +25034,29 @@ oimo_dynamics_constraint_joint_JointConfig.prototype = { localPoint1.y = vY1; localPoint1.z = vZ1; } -}; -var oimo_dynamics_constraint_joint_CylindricalJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localAxis1 = new oimo_common_Vec3(1,0,0); - this.localAxis2 = new oimo_common_Vec3(1,0,0); - this.translationalLimitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); - this.translationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); - this.rotationalLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); - this.rotationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); -}; -oimo_dynamics_constraint_joint_CylindricalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { +} +class oimo_dynamics_constraint_joint_CylindricalJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.translationalLimitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + this.translationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.rotationalLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.rotationalSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var localVector = this.localAxis1; - var vX; - var vY; - var vZ; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; vX = worldAxis.x; vY = worldAxis.y; vZ = worldAxis.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; @@ -24832,16 +25066,16 @@ oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_d localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; vX1 = worldAxis.x; vY1 = worldAxis.y; vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; @@ -24853,114 +25087,113 @@ oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_d localVector1.z = vZ1; return this; } -}); -var oimo_dynamics_constraint_joint_GenericJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.GENERIC); - var tmp; - var _this = config.localBasis1; - if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { - var _this1 = config.localBasis2; - tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; - } else { - tmp = true; - } - if(tmp) { - console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed"); - } - var lb100; - var lb101; - var lb102; - var lb110; - var lb111; - var lb112; - var lb120; - var lb121; - var lb122; - var lb200; - var lb201; - var lb202; - var lb210; - var lb211; - var lb212; - var lb220; - var lb221; - var lb222; - var m = config.localBasis1; - lb100 = m.e00; - lb101 = m.e01; - lb102 = m.e02; - lb110 = m.e10; - lb111 = m.e11; - lb112 = m.e12; - lb120 = m.e20; - lb121 = m.e21; - lb122 = m.e22; - var m1 = config.localBasis2; - lb200 = m1.e00; - lb201 = m1.e01; - lb202 = m1.e02; - lb210 = m1.e10; - lb211 = m1.e11; - lb212 = m1.e12; - lb220 = m1.e20; - lb221 = m1.e21; - lb222 = m1.e22; - this._localBasisX1X = lb100; - this._localBasisX1Y = lb110; - this._localBasisX1Z = lb120; - this._localBasisY1X = lb101; - this._localBasisY1Y = lb111; - this._localBasisY1Z = lb121; - this._localBasisZ1X = lb102; - this._localBasisZ1Y = lb112; - this._localBasisZ1Z = lb122; - this._localBasisX2X = lb200; - this._localBasisX2Y = lb210; - this._localBasisX2Z = lb220; - this._localBasisY2X = lb201; - this._localBasisY2Y = lb211; - this._localBasisY2Z = lb221; - this._localBasisZ2X = lb202; - this._localBasisZ2Y = lb212; - this._localBasisZ2Z = lb222; - this._angleX = 0; - this._angleY = 0; - this._angleZ = 0; - this.translationX = 0; - this.translationY = 0; - this.translationZ = 0; - this.xSingular = false; - this.ySingular = false; - this.zSingular = false; - this._translLms = new Array(3); - this._translSds = new Array(3); - this._rotLms = new Array(3); - this._rotSds = new Array(3); - this._translLms[0] = config.translationalLimitMotors[0].clone(); - this._translLms[1] = config.translationalLimitMotors[1].clone(); - this._translLms[2] = config.translationalLimitMotors[2].clone(); - this._translSds[0] = config.translationalSpringDampers[0].clone(); - this._translSds[1] = config.translationalSpringDampers[1].clone(); - this._translSds[2] = config.translationalSpringDampers[2].clone(); - this._rotLms[0] = config.rotationalLimitMotors[0].clone(); - this._rotLms[1] = config.rotationalLimitMotors[1].clone(); - this._rotLms[2] = config.rotationalLimitMotors[2].clone(); - this._rotSds[0] = config.rotationalSpringDampers[0].clone(); - this._rotSds[1] = config.rotationalSpringDampers[1].clone(); - this._rotSds[2] = config.rotationalSpringDampers[2].clone(); -}; -oimo_dynamics_constraint_joint_GenericJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var j; - var translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); - var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); - var motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); - var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); +} +class oimo_dynamics_constraint_joint_GenericJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,oimo_dynamics_constraint_joint_JointType.GENERIC); + let tmp; + let _this = config.localBasis1; + if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { + let _this = config.localBasis2; + tmp = _this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0; + } else { + tmp = true; + } + if(tmp) { + console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:50:","[warning] joint basis must be right handed"); + } + let lb100; + let lb101; + let lb102; + let lb110; + let lb111; + let lb112; + let lb120; + let lb121; + let lb122; + let lb200; + let lb201; + let lb202; + let lb210; + let lb211; + let lb212; + let lb220; + let lb221; + let lb222; + let m = config.localBasis1; + lb100 = m.e00; + lb101 = m.e01; + lb102 = m.e02; + lb110 = m.e10; + lb111 = m.e11; + lb112 = m.e12; + lb120 = m.e20; + lb121 = m.e21; + lb122 = m.e22; + let m1 = config.localBasis2; + lb200 = m1.e00; + lb201 = m1.e01; + lb202 = m1.e02; + lb210 = m1.e10; + lb211 = m1.e11; + lb212 = m1.e12; + lb220 = m1.e20; + lb221 = m1.e21; + lb222 = m1.e22; + this._localBasisX1X = lb100; + this._localBasisX1Y = lb110; + this._localBasisX1Z = lb120; + this._localBasisY1X = lb101; + this._localBasisY1Y = lb111; + this._localBasisY1Z = lb121; + this._localBasisZ1X = lb102; + this._localBasisZ1Y = lb112; + this._localBasisZ1Z = lb122; + this._localBasisX2X = lb200; + this._localBasisX2Y = lb210; + this._localBasisX2Z = lb220; + this._localBasisY2X = lb201; + this._localBasisY2Y = lb211; + this._localBasisY2Z = lb221; + this._localBasisZ2X = lb202; + this._localBasisZ2Y = lb212; + this._localBasisZ2Z = lb222; + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.translationX = 0; + this.translationY = 0; + this.translationZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._translLms = new Array(3); + this._translSds = new Array(3); + this._rotLms = new Array(3); + this._rotSds = new Array(3); + this._translLms[0] = config.translationalLimitMotors[0].clone(); + this._translLms[1] = config.translationalLimitMotors[1].clone(); + this._translLms[2] = config.translationalLimitMotors[2].clone(); + this._translSds[0] = config.translationalSpringDampers[0].clone(); + this._translSds[1] = config.translationalSpringDampers[1].clone(); + this._translSds[2] = config.translationalSpringDampers[2].clone(); + this._rotLms[0] = config.rotationalLimitMotors[0].clone(); + this._rotLms[1] = config.rotationalLimitMotors[1].clone(); + this._rotLms[2] = config.rotationalLimitMotors[2].clone(); + this._rotSds[0] = config.rotationalSpringDampers[0].clone(); + this._rotSds[1] = config.rotationalSpringDampers[1].clone(); + this._rotSds[2] = config.rotationalSpringDampers[2].clone(); + } + getInfo(info,timeStep,isPositionPart) { + let j; + let translMotorMass = 1 / (this._b1._invMass + this._b2._invMass); + let motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + let motorMassY = this.computeEffectiveInertiaMoment(this._axisYX,this._axisYY,this._axisYZ); + let motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); if(this._translSds[0].frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -24997,31 +25230,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; } if(this._translSds[1].frequency <= 0 || !isPositionPart) { - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - this.setSolverInfoRowLinear(row1,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); - j = row1.jacobian; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); + j = row.jacobian; j.lin1X = this._basisY1X; j.lin1Y = this._basisY1Y; j.lin1Z = this._basisY1Z; @@ -25036,31 +25269,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; } if(this._translSds[2].frequency <= 0 || !isPositionPart) { - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - this.setSolverInfoRowLinear(row2,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); - j = row2.jacobian; + let impulse = this._impulses[2]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); + j = row.jacobian; j.lin1X = this._basisZ1X; j.lin1Y = this._basisZ1Y; j.lin1Z = this._basisZ1Z; @@ -25075,31 +25308,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; } if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); - j = row3.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -25108,31 +25341,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._axisXZ; } if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - this.setSolverInfoRowAngular(row4,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); - j = row4.jacobian; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -25141,31 +25374,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - this.setSolverInfoRowAngular(row5,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); - j = row5.jacobian; + let impulse = this._impulses[5]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisZX; j.ang1Y = this._axisZY; j.ang1Z = this._axisZZ; @@ -25174,17 +25407,17 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._axisZZ; } } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var angleAxisXX; - var angleAxisXY; - var angleAxisXZ; - var angleAxisYX; - var angleAxisYY; - var angleAxisYZ; - var angleAxisZX; - var angleAxisZY; - var angleAxisZZ; + _syncAnchors() { + super._syncAnchors(); + let angleAxisXX; + let angleAxisXY; + let angleAxisXZ; + let angleAxisYX; + let angleAxisYY; + let angleAxisYZ; + let angleAxisZX; + let angleAxisZY; + let angleAxisZZ; angleAxisXX = this._basisX1X; angleAxisXY = this._basisX1Y; angleAxisXZ = this._basisX1Z; @@ -25203,21 +25436,21 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; - var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + let l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; if(l > 0) { l = 1 / Math.sqrt(l); } this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + let l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } this._axisYX *= l1; this._axisYY *= l1; this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + let l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; if(l2 > 0) { l2 = 1 / Math.sqrt(l2); } @@ -25227,24 +25460,24 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; rot100 = this._basisX1X; rot101 = this._basisY1X; rot102 = this._basisZ1X; @@ -25263,20 +25496,20 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot00; - var relRot01; - var relRot02; - var relRot11; - var relRot12; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__11; - var __tmp__12; - var __tmp__21; - var __tmp__22; + let relRot00; + let relRot01; + let relRot02; + let relRot11; + let relRot12; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__11; + let __tmp__12; + let __tmp__21; + let __tmp__22; __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; @@ -25291,17 +25524,17 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co relRot12 = __tmp__12; relRot21 = __tmp__21; relRot22 = __tmp__22; - var anglesX; - var anglesY; - var anglesZ; - var sy = relRot02; + let anglesX; + let anglesY; + let anglesZ; + let sy = relRot02; if(sy <= -1) { - var xSubZ = Math.atan2(relRot21,relRot11); + let xSubZ = Math.atan2(relRot21,relRot11); anglesX = xSubZ * 0.5; anglesY = -1.570796326794895; anglesZ = -xSubZ * 0.5; } else if(sy >= 1) { - var xAddZ = Math.atan2(relRot21,relRot11); + let xAddZ = Math.atan2(relRot21,relRot11); anglesX = xAddZ * 0.5; anglesY = 1.570796326794895; anglesZ = xAddZ * 0.5; @@ -25313,9 +25546,9 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co this._angleX = anglesX; this._angleY = anglesY; this._angleZ = anglesZ; - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -25323,113 +25556,112 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co this.translationY = anchorDiffX * this._basisY1X + anchorDiffY * this._basisY1Y + anchorDiffZ * this._basisY1Z; this.translationZ = anchorDiffX * this._basisZ1X + anchorDiffY * this._basisZ1Y + anchorDiffZ * this._basisZ1Z; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxisX: function() { - var v = new oimo_common_Vec3(); + getAxisX() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxisY: function() { - var v = new oimo_common_Vec3(); + getAxisY() { + let v = new oimo_common_Vec3(); v.x = this._axisYX; v.y = this._axisYY; v.z = this._axisYZ; return v; } - ,getAxisZ: function() { - var v = new oimo_common_Vec3(); + getAxisZ() { + let v = new oimo_common_Vec3(); v.x = this._basisZ2X; v.y = this._basisZ2Y; v.z = this._basisZ2Z; return v; } - ,getTranslationalSpringDampers: function() { + getTranslationalSpringDampers() { return this._translSds.slice(0); } - ,getRotationalSpringDampers: function() { - return this._translSds.slice(0); + getRotationalSpringDampers() { + return this._rotSds.slice(0); } - ,getTranslationalLimitMotors: function() { + getTranslationalLimitMotors() { return this._translLms.slice(0); } - ,getRotationalLimitMotors: function() { + getRotationalLimitMotors() { return this._rotLms.slice(0); } - ,getAngles: function() { + getAngles() { return new oimo_common_Vec3(this._angleX,this._angleY,this._angleZ); } - ,getTranslations: function() { + getTranslations() { return new oimo_common_Vec3(this.translationX,this.translationY,this.translationZ); } -}); -var oimo_dynamics_constraint_joint_GenericJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localBasis1 = new oimo_common_Mat3(); - this.localBasis2 = new oimo_common_Mat3(); - var _g = []; - _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); - _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); - _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); - this.translationalLimitMotors = _g; - var _g1 = []; - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - this.rotationalLimitMotors = _g1; - this.translationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; - this.rotationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; -}; -oimo_dynamics_constraint_joint_GenericJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { +} +class oimo_dynamics_constraint_joint_GenericJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localBasis1 = new oimo_common_Mat3(); + this.localBasis2 = new oimo_common_Mat3(); + let _g = []; + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); + this.translationalLimitMotors = _g; + let _g1 = []; + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + this.rotationalLimitMotors = _g1; + this.translationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; + this.rotationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; + } + init(rigidBody1,rigidBody2,worldAnchor,worldBasis1,worldBasis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var tf1 = rigidBody1._transform; - var tf2 = rigidBody2._transform; - var wb100; - var wb101; - var wb102; - var wb110; - var wb111; - var wb112; - var wb120; - var wb121; - var wb122; - var wb200; - var wb201; - var wb202; - var wb210; - var wb211; - var wb212; - var wb220; - var wb221; - var wb222; - var lb100; - var lb101; - var lb102; - var lb110; - var lb111; - var lb112; - var lb120; - var lb121; - var lb122; - var lb200; - var lb201; - var lb202; - var lb210; - var lb211; - var lb212; - var lb220; - var lb221; - var lb222; + let tf1 = rigidBody1._transform; + let tf2 = rigidBody2._transform; + let wb100; + let wb101; + let wb102; + let wb110; + let wb111; + let wb112; + let wb120; + let wb121; + let wb122; + let wb200; + let wb201; + let wb202; + let wb210; + let wb211; + let wb212; + let wb220; + let wb221; + let wb222; + let lb100; + let lb101; + let lb102; + let lb110; + let lb111; + let lb112; + let lb120; + let lb121; + let lb122; + let lb200; + let lb201; + let lb202; + let lb210; + let lb211; + let lb212; + let lb220; + let lb221; + let lb222; wb100 = worldBasis1.e00; wb101 = worldBasis1.e01; wb102 = worldBasis1.e02; @@ -25448,15 +25680,15 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam wb220 = worldBasis2.e20; wb221 = worldBasis2.e21; wb222 = worldBasis2.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * wb100 + tf1._rotation10 * wb110 + tf1._rotation20 * wb120; __tmp__01 = tf1._rotation00 * wb101 + tf1._rotation10 * wb111 + tf1._rotation20 * wb121; __tmp__02 = tf1._rotation00 * wb102 + tf1._rotation10 * wb112 + tf1._rotation20 * wb122; @@ -25475,15 +25707,15 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam lb120 = __tmp__20; lb121 = __tmp__21; lb122 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; @@ -25502,7 +25734,7 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam lb220 = __tmp__201; lb221 = __tmp__211; lb222 = __tmp__221; - var m = this.localBasis1; + let m = this.localBasis1; m.e00 = lb100; m.e01 = lb101; m.e02 = lb102; @@ -25512,7 +25744,7 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam m.e20 = lb120; m.e21 = lb121; m.e22 = lb122; - var m1 = this.localBasis2; + let m1 = this.localBasis2; m1.e00 = lb200; m1.e01 = lb201; m1.e02 = lb202; @@ -25524,66 +25756,69 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam m1.e22 = lb222; return this; } -}); -var oimo_dynamics_constraint_joint_JointImpulse = function() { - this.impulse = 0; - this.impulseM = 0; - this.impulseP = 0; -}; -var oimo_dynamics_constraint_joint_JointLink = function(joint) { - this._joint = joint; -}; -oimo_dynamics_constraint_joint_JointLink.prototype = { - getContact: function() { +} +class oimo_dynamics_constraint_joint_JointImpulse { + constructor() { + this.impulse = 0; + this.impulseM = 0; + this.impulseP = 0; + } +} +class oimo_dynamics_constraint_joint_JointLink { + constructor(joint) { + this._joint = joint; + } + getContact() { return this._joint; } - ,getOther: function() { + getOther() { return this._other; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_constraint_joint_JointMacro = function() { }; -var oimo_dynamics_constraint_joint_JointType = function() { }; -var oimo_dynamics_constraint_joint_PrismaticJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.PRISMATIC); - var v = config.localAxis1; - this._localBasisX1X = v.x; - this._localBasisX1Y = v.y; - this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; - this.buildLocalBasesFromX(); - this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); - this.translation = 0; - this.linearErrorY = 0; - this.linearErrorZ = 0; - this.angularErrorX = 0; - this.angularErrorY = 0; - this.angularErrorZ = 0; - this._sd = config.springDamper.clone(); - this._lm = config.limitMotor.clone(); -}; -oimo_dynamics_constraint_joint_PrismaticJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linRhsY = this.linearErrorY * erp; - var linRhsZ = this.linearErrorZ * erp; - var angRhsX = this.angularErrorX * erp; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var j; +} +class oimo_dynamics_constraint_joint_JointMacro { +} +class oimo_dynamics_constraint_joint_JointType { +} +class oimo_dynamics_constraint_joint_PrismaticJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,oimo_dynamics_constraint_joint_JointType.PRISMATIC); + let v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + let v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this.translation = 0; + this.linearErrorY = 0; + this.linearErrorZ = 0; + this.angularErrorX = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + let erp = this.getErp(timeStep,isPositionPart); + let linRhsY = this.linearErrorY * erp; + let linRhsZ = this.linearErrorZ * erp; + let angRhsX = this.angularErrorX * erp; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let j; if(this._sd.frequency <= 0 || !isPositionPart) { - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -25619,9 +25854,49 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse = this._impulses[1]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; + j.lin1X = this._basis.yX; + j.lin1Y = this._basis.yY; + j.lin1Z = this._basis.yZ; + j.lin2X = this._basis.yX; + j.lin2Y = this._basis.yY; + j.lin2Z = this._basis.yZ; + j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; + j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; + j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; + j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; + j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; + j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; + let impulse1 = this._impulses[2]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -25642,26 +25917,26 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ row1.motorMaxImpulse = 0; row1.impulse = null; row1.impulse = impulse1; - row1.rhs = linRhsY; + row1.rhs = linRhsZ; row1.cfm = 0; row1.minImpulse = -1e65536; row1.maxImpulse = 1e65536; j = row1.jacobian; - j.lin1X = this._basis.yX; - j.lin1Y = this._basis.yY; - j.lin1Z = this._basis.yZ; - j.lin2X = this._basis.yX; - j.lin2Y = this._basis.yY; - j.lin2Z = this._basis.yZ; - j.ang1X = this._relativeAnchor1Y * this._basis.yZ - this._relativeAnchor1Z * this._basis.yY; - j.ang1Y = this._relativeAnchor1Z * this._basis.yX - this._relativeAnchor1X * this._basis.yZ; - j.ang1Z = this._relativeAnchor1X * this._basis.yY - this._relativeAnchor1Y * this._basis.yX; - j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; - j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; - j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + j.lin1X = this._basis.zX; + j.lin1Y = this._basis.zY; + j.lin1Z = this._basis.zZ; + j.lin2X = this._basis.zX; + j.lin2Y = this._basis.zY; + j.lin2Z = this._basis.zZ; + j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; + j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; + j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; + j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; + j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; + j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; + let impulse2 = this._impulses[3]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -25682,26 +25957,20 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ row2.motorMaxImpulse = 0; row2.impulse = null; row2.impulse = impulse2; - row2.rhs = linRhsZ; + row2.rhs = angRhsX; row2.cfm = 0; row2.minImpulse = -1e65536; row2.maxImpulse = 1e65536; j = row2.jacobian; - j.lin1X = this._basis.zX; - j.lin1Y = this._basis.zY; - j.lin1Z = this._basis.zZ; - j.lin2X = this._basis.zX; - j.lin2Y = this._basis.zY; - j.lin2Z = this._basis.zZ; - j.ang1X = this._relativeAnchor1Y * this._basis.zZ - this._relativeAnchor1Z * this._basis.zY; - j.ang1Y = this._relativeAnchor1Z * this._basis.zX - this._relativeAnchor1X * this._basis.zZ; - j.ang1Z = this._relativeAnchor1X * this._basis.zY - this._relativeAnchor1Y * this._basis.zX; - j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; - j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; - j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; + j.ang1X = 1; + j.ang1Y = 0; + j.ang1Z = 0; + j.ang2X = 1; + j.ang2Y = 0; + j.ang2Z = 0; + let impulse3 = this._impulses[4]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; _this3.lin1X = 0; _this3.lin1Y = 0; _this3.lin1Z = 0; @@ -25722,20 +25991,20 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ row3.motorMaxImpulse = 0; row3.impulse = null; row3.impulse = impulse3; - row3.rhs = angRhsX; + row3.rhs = angRhsY; row3.cfm = 0; row3.minImpulse = -1e65536; row3.maxImpulse = 1e65536; j = row3.jacobian; - j.ang1X = 1; - j.ang1Y = 0; + j.ang1X = 0; + j.ang1Y = 1; j.ang1Z = 0; - j.ang2X = 1; - j.ang2Y = 0; + j.ang2X = 0; + j.ang2Y = 1; j.ang2Z = 0; - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; + let impulse4 = this._impulses[5]; + let row4 = info.rows[info.numRows++]; + let _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -25756,126 +26025,92 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ row4.motorMaxImpulse = 0; row4.impulse = null; row4.impulse = impulse4; - row4.rhs = angRhsY; + row4.rhs = angRhsZ; row4.cfm = 0; row4.minImpulse = -1e65536; row4.maxImpulse = 1e65536; j = row4.jacobian; j.ang1X = 0; - j.ang1Y = 1; - j.ang1Z = 0; - j.ang2X = 0; - j.ang2Y = 1; - j.ang2Z = 0; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; - j.ang1X = 0; j.ang1Y = 0; j.ang1Z = 1; j.ang2X = 0; j.ang2Y = 0; j.ang2Z = 1; } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var qX; - var qY; - var qZ; - var qW; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newXX; - var newXY; - var newXZ; - var newYX; - var newYY; - var newYZ; - var newZX; - var newZY; - var newZZ; - var prevXX; - var prevXY; - var prevXZ; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + _syncAnchors() { + super._syncAnchors(); + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -25883,13 +26118,13 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -25903,14 +26138,14 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ idQY = 0; idQZ = 0; idQW = 1; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -25919,19 +26154,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -25940,7 +26175,7 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -25949,21 +26184,21 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -25973,22 +26208,22 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -25998,9 +26233,9 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -26013,78 +26248,78 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -26094,9 +26329,9 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -26107,42 +26342,42 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -26158,24 +26393,24 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; rot100 = this._basisX1X; rot101 = this._basisY1X; rot102 = this._basisZ1X; @@ -26194,24 +26429,24 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot00; - var relRot01; - var relRot02; - var relRot10; - var relRot11; - var relRot12; - var relRot20; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let relRot00; + let relRot01; + let relRot02; + let relRot10; + let relRot11; + let relRot12; + let relRot20; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot200 * rot100 + rot201 * rot101 + rot202 * rot102; __tmp__01 = rot200 * rot110 + rot201 * rot111 + rot202 * rot112; __tmp__02 = rot200 * rot120 + rot201 * rot121 + rot202 * rot122; @@ -26230,15 +26465,15 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ relRot20 = __tmp__20; relRot21 = __tmp__21; relRot22 = __tmp__22; - var relQX; - var relQY; - var relQZ; - var relQW; - var e00 = relRot00; - var e11 = relRot11; - var e22 = relRot22; - var t = e00 + e11 + e22; - var s; + let relQX; + let relQY; + let relQZ; + let relQW; + let e00 = relRot00; + let e11 = relRot11; + let e22 = relRot22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); relQW = 0.5 * s; @@ -26277,24 +26512,24 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ relQY = (relRot12 + relRot21) * s; relQW = (relRot10 - relRot01) * s; } - var cosHalfTheta = relQW; - var theta1 = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; + let cosHalfTheta = relQW; + let theta = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; this.angularErrorX = relQX; this.angularErrorY = relQY; this.angularErrorZ = relQZ; - var l3 = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - this.angularErrorX *= l3; - this.angularErrorY *= l3; - this.angularErrorZ *= l3; - this.angularErrorX *= theta1; - this.angularErrorY *= theta1; - this.angularErrorZ *= theta1; - var anchorDiffX; - var anchorDiffY; - var anchorDiffZ; + let l = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this.angularErrorX *= l; + this.angularErrorY *= l; + this.angularErrorZ *= l; + this.angularErrorX *= theta; + this.angularErrorY *= theta; + this.angularErrorZ *= theta; + let anchorDiffX; + let anchorDiffY; + let anchorDiffZ; anchorDiffX = this._anchor2X - this._anchor1X; anchorDiffY = this._anchor2Y - this._anchor1Y; anchorDiffZ = this._anchor2Z - this._anchor1Z; @@ -26302,93 +26537,92 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ this.linearErrorY = anchorDiffX * this._basis.yX + anchorDiffY * this._basis.yY + anchorDiffZ * this._basis.yZ; this.linearErrorZ = anchorDiffX * this._basis.zX + anchorDiffY * this._basis.zY + anchorDiffZ * this._basis.zZ; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); + getAxis1() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxis2: function() { - var v = new oimo_common_Vec3(); + getAxis2() { + let v = new oimo_common_Vec3(); v.x = this._basisX2X; v.y = this._basisX2Y; v.z = this._basisX2Z; return v; } - ,getAxis1To: function(axis) { + getAxis1To(axis) { axis.x = this._basisX1X; axis.y = this._basisX1Y; axis.z = this._basisX1Z; } - ,getAxis2To: function(axis) { + getAxis2To(axis) { axis.x = this._basisX2X; axis.y = this._basisX2Y; axis.z = this._basisX2Z; } - ,getLocalAxis1: function() { - var v = new oimo_common_Vec3(); + getLocalAxis1() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX1X; v.y = this._localBasisX1Y; v.z = this._localBasisX1Z; return v; } - ,getLocalAxis2: function() { - var v = new oimo_common_Vec3(); + getLocalAxis2() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX2X; v.y = this._localBasisX2Y; v.z = this._localBasisX2Z; return v; } - ,getLocalAxis1To: function(axis) { + getLocalAxis1To(axis) { axis.x = this._localBasisX1X; axis.y = this._localBasisX1Y; axis.z = this._localBasisX1Z; } - ,getLocalAxis2To: function(axis) { + getLocalAxis2To(axis) { axis.x = this._localBasisX2X; axis.y = this._localBasisX2Y; axis.z = this._localBasisX2Z; } - ,getSpringDamper: function() { + getSpringDamper() { return this._sd; } - ,getLimitMotor: function() { + getLimitMotor() { return this._lm; } - ,getTranslation: function() { + getTranslation() { return this.translation; } -}); -var oimo_dynamics_constraint_joint_PrismaticJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localAxis1 = new oimo_common_Vec3(1,0,0); - this.localAxis2 = new oimo_common_Vec3(1,0,0); - this.limitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); - this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); -}; -oimo_dynamics_constraint_joint_PrismaticJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { +} +class oimo_dynamics_constraint_joint_PrismaticJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.limitMotor = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var localVector = this.localAxis1; - var vX; - var vY; - var vZ; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; vX = worldAxis.x; vY = worldAxis.y; vZ = worldAxis.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; @@ -26398,16 +26632,16 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dyn localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; vX1 = worldAxis.x; vY1 = worldAxis.y; vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; @@ -26419,74 +26653,73 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dyn localVector1.z = vZ1; return this; } -}); -var oimo_dynamics_constraint_joint_RagdollJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.RAGDOLL); - var v = config.localTwistAxis1; - this._localBasisX1X = v.x; - this._localBasisX1Y = v.y; - this._localBasisX1Z = v.z; - var v1 = config.localSwingAxis1; - this._localBasisY1X = v1.x; - this._localBasisY1Y = v1.y; - this._localBasisY1Z = v1.z; - var v2 = config.localTwistAxis2; - this._localBasisX2X = v2.x; - this._localBasisX2Y = v2.y; - this._localBasisX2Z = v2.z; - this.buildLocalBasesFromXY1X2(); - this._twistSd = config.twistSpringDamper.clone(); - this._twistLm = config.twistLimitMotor.clone(); - this._swingSd = config.swingSpringDamper.clone(); - this._maxSwingAngle1 = config.maxSwingAngle1; - this._maxSwingAngle2 = config.maxSwingAngle2; - if(this._maxSwingAngle1 < oimo_common_Setting.minRagdollMaxSwingAngle) { - this._maxSwingAngle1 = oimo_common_Setting.minRagdollMaxSwingAngle; - } - if(this._maxSwingAngle2 < oimo_common_Setting.minRagdollMaxSwingAngle) { - this._maxSwingAngle2 = oimo_common_Setting.minRagdollMaxSwingAngle; - } - this.dummySwingLm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); - this.dummySwingLm.lowerLimit = -1; - this.dummySwingLm.upperLimit = 0; - this._swingAngle = 0; - this._twistAngle = 0; - this.swingError = 0; - this.swingAxisX = 0; - this.swingAxisY = 0; - this.swingAxisZ = 0; - this.twistAxisX = 0; - this.twistAxisY = 0; - this.twistAxisZ = 0; -}; -oimo_dynamics_constraint_joint_RagdollJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhsX; - var linearRhsY; - var linearRhsZ; +} +class oimo_dynamics_constraint_joint_RagdollJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,oimo_dynamics_constraint_joint_JointType.RAGDOLL); + let v = config.localTwistAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + let v1 = config.localSwingAxis1; + this._localBasisY1X = v1.x; + this._localBasisY1Y = v1.y; + this._localBasisY1Z = v1.z; + let v2 = config.localTwistAxis2; + this._localBasisX2X = v2.x; + this._localBasisX2Y = v2.y; + this._localBasisX2Z = v2.z; + this.buildLocalBasesFromXY1X2(); + this._twistSd = config.twistSpringDamper.clone(); + this._twistLm = config.twistLimitMotor.clone(); + this._swingSd = config.swingSpringDamper.clone(); + this._maxSwingAngle1 = config.maxSwingAngle1; + this._maxSwingAngle2 = config.maxSwingAngle2; + if(this._maxSwingAngle1 < oimo_common_Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle1 = oimo_common_Setting.minRagdollMaxSwingAngle; + } + if(this._maxSwingAngle2 < oimo_common_Setting.minRagdollMaxSwingAngle) { + this._maxSwingAngle2 = oimo_common_Setting.minRagdollMaxSwingAngle; + } + this.dummySwingLm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.dummySwingLm.lowerLimit = -1; + this.dummySwingLm.upperLimit = 0; + this._swingAngle = 0; + this._twistAngle = 0; + this.swingError = 0; + this.swingAxisX = 0; + this.swingAxisY = 0; + this.swingAxisZ = 0; + this.twistAxisX = 0; + this.twistAxisY = 0; + this.twistAxisZ = 0; + } + getInfo(info,timeStep,isPositionPart) { + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -26523,11 +26756,11 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); - var twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let swingMass = this.computeEffectiveInertiaMoment(this.swingAxisX,this.swingAxisY,this.swingAxisZ); + let twistMass = this.computeEffectiveInertiaMoment(this._basisX2X,this._basisX2Y,this._basisX2Z); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -26552,7 +26785,7 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co row.cfm = 0; row.minImpulse = -1e65536; row.maxImpulse = 1e65536; - var j = row.jacobian; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -26565,9 +26798,9 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -26605,9 +26838,9 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -26646,31 +26879,31 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Y = crossR221; j.ang2Z = crossR222; if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); - j = row3.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.swingAxisX; j.ang1Y = this.swingAxisY; j.ang1Z = this.swingAxisZ; @@ -26679,31 +26912,31 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this.swingAxisZ; } if(this._twistSd.frequency <= 0 || !isPositionPart) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - this.setSolverInfoRowAngular(row4,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); - j = row4.jacobian; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.twistAxisX; j.ang1Y = this.twistAxisY; j.ang1Z = this.twistAxisZ; @@ -26712,29 +26945,29 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this.twistAxisZ; } } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var axis1X; - var axis1Y; - var axis1Z; - var axis2X; - var axis2Y; - var axis2Z; + _syncAnchors() { + super._syncAnchors(); + let axis1X; + let axis1Y; + let axis1Z; + let axis2X; + let axis2Y; + let axis2Z; axis1X = this._basisX1X; axis1Y = this._basisX1Y; axis1Z = this._basisX1Z; axis2X = this._basisX2X; axis2Y = this._basisX2Y; axis2Z = this._basisX2Z; - var basis1Mat00; - var basis1Mat01; - var basis1Mat02; - var basis1Mat10; - var basis1Mat11; - var basis1Mat12; - var basis1Mat20; - var basis1Mat21; - var basis1Mat22; + let basis1Mat00; + let basis1Mat01; + let basis1Mat02; + let basis1Mat10; + let basis1Mat11; + let basis1Mat12; + let basis1Mat20; + let basis1Mat21; + let basis1Mat22; basis1Mat00 = this._basisX1X; basis1Mat01 = this._basisY1X; basis1Mat02 = this._basisZ1X; @@ -26744,55 +26977,55 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co basis1Mat20 = this._basisX1Z; basis1Mat21 = this._basisY1Z; basis1Mat22 = this._basisZ1Z; - var swingQX; - var swingQY; - var swingQZ; - var swingQW; - var swingM00; - var swingM01; - var swingM02; - var swingM10; - var swingM11; - var swingM12; - var swingM20; - var swingM21; - var swingM22; - var swingVX; - var swingVY; - var swingVZ; - var d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; + let swingQX; + let swingQY; + let swingQZ; + let swingQW; + let swingM00; + let swingM01; + let swingM02; + let swingM10; + let swingM11; + let swingM12; + let swingM20; + let swingM21; + let swingM22; + let swingVX; + let swingVY; + let swingVZ; + let d = axis1X * axis2X + axis1Y * axis2Y + axis1Z * axis2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = axis1X; - var y1 = axis1Y; - var z1 = axis1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = axis1X; + let y1 = axis1Y; + let z1 = axis1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } swingQX = vX; @@ -26800,13 +27033,13 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co swingQZ = vZ; swingQW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = axis1Y * axis2Z - axis1Z * axis2Y; cY = axis1Z * axis2X - axis1X * axis2Z; cZ = axis1X * axis2Y - axis1Y * axis2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -26816,22 +27049,22 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co swingQZ = cZ; swingQW = w; } - var x = swingQX; - var y = swingQY; - var z = swingQZ; - var w1 = swingQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = swingQX; + let y = swingQY; + let z = swingQZ; + let w = swingQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; swingM00 = 1 - yy - zz; swingM01 = xy - wz; swingM02 = xz + wy; @@ -26845,12 +27078,12 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co swingVX = swingQX; swingVY = swingQY; swingVZ = swingQZ; - var basisY2In1X; - var basisY2In1Y; - var basisY2In1Z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let basisY2In1X; + let basisY2In1Y; + let basisY2In1Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = swingM00 * this._basisY2X + swingM10 * this._basisY2Y + swingM20 * this._basisY2Z; __tmp__Y = swingM01 * this._basisY2X + swingM11 * this._basisY2Y + swingM21 * this._basisY2Z; __tmp__Z = swingM02 * this._basisY2X + swingM12 * this._basisY2Y + swingM22 * this._basisY2Z; @@ -26861,74 +27094,74 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co this.twistAxisX = this._basisX1X + this._basisX2X; this.twistAxisY = this._basisX1Y + this._basisX2Y; this.twistAxisZ = this._basisX1Z + this._basisX2Z; - var l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; + let l = this.twistAxisX * this.twistAxisX + this.twistAxisY * this.twistAxisY + this.twistAxisZ * this.twistAxisZ; if(l > 0) { l = 1 / Math.sqrt(l); } this.twistAxisX *= l; this.twistAxisY *= l; this.twistAxisZ *= l; - var invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); + let invLen = Math.sqrt(swingVX * swingVX + swingVY * swingVY + swingVZ * swingVZ); if(invLen > 0) { invLen = 1 / invLen; } swingVX *= invLen * this._swingAngle; swingVY *= invLen * this._swingAngle; swingVZ *= invLen * this._swingAngle; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; swingVX = __tmp__X1; swingVY = __tmp__Y1; swingVZ = __tmp__Z1; - var x3 = swingVY; - var y3 = swingVZ; - var a = this._maxSwingAngle1; - var b = this._maxSwingAngle2; - var invA2 = 1 / (a * a); - var invB2 = 1 / (b * b); - var w2 = x3 * x3 * invA2 + y3 * y3 * invB2; - if(w2 == 0) { + let x1 = swingVY; + let y1 = swingVZ; + let a = this._maxSwingAngle1; + let b = this._maxSwingAngle2; + let invA2 = 1 / (a * a); + let invB2 = 1 / (b * b); + let w1 = x1 * x1 * invA2 + y1 * y1 * invB2; + if(w1 == 0) { this.swingAxisX = 0; this.swingAxisY = 0; this.swingAxisZ = 0; this.swingError = 0; } else { - var t = Math.sqrt(1 / w2); - var x0 = x3 * t; - var y0 = y3 * t; - var nx = x0 * invA2; - var ny = y0 * invB2; + let t = Math.sqrt(1 / w1); + let x0 = x1 * t; + let y0 = y1 * t; + let nx = x0 * invA2; + let ny = y0 * invB2; invLen = 1 / Math.sqrt(nx * nx + ny * ny); nx *= invLen; ny *= invLen; - var depth = (x3 - x0) * nx + (y3 - y0) * ny; + let depth = (x1 - x0) * nx + (y1 - y0) * ny; if(depth > 0) { this.swingError = depth; this.swingAxisX = 0; this.swingAxisY = nx; this.swingAxisZ = ny; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; - __tmp__Y2 = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; - __tmp__Z2 = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; - this.swingAxisX = __tmp__X2; - this.swingAxisY = __tmp__Y2; - this.swingAxisZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; - __tmp__Y3 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; - __tmp__Z3 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; - this.swingAxisX = __tmp__X3; - this.swingAxisY = __tmp__Y3; - this.swingAxisZ = __tmp__Z3; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; + __tmp__X = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; + __tmp__Y = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; + __tmp__Z = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; + this.swingAxisX = __tmp__X; + this.swingAxisY = __tmp__Y; + this.swingAxisZ = __tmp__Z; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; + __tmp__X1 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; + __tmp__Y1 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; + __tmp__Z1 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; + this.swingAxisX = __tmp__X1; + this.swingAxisY = __tmp__Y1; + this.swingAxisZ = __tmp__Z1; } else { this.swingError = 0; } @@ -26937,115 +27170,114 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co this.linearErrorY = this._anchor2Y - this._anchor1Y; this.linearErrorZ = this._anchor2Z - this._anchor1Z; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); + getAxis1() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxis2: function() { - var v = new oimo_common_Vec3(); + getAxis2() { + let v = new oimo_common_Vec3(); v.x = this._basisX2X; v.y = this._basisX2Y; v.z = this._basisX2Z; return v; } - ,getAxis1To: function(axis) { + getAxis1To(axis) { axis.x = this._basisX1X; axis.y = this._basisX1Y; axis.z = this._basisX1Z; } - ,getAxis2To: function(axis) { + getAxis2To(axis) { axis.x = this._basisX2X; axis.y = this._basisX2Y; axis.z = this._basisX2Z; } - ,getLocalAxis1: function() { - var v = new oimo_common_Vec3(); + getLocalAxis1() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX1X; v.y = this._localBasisX1Y; v.z = this._localBasisX1Z; return v; } - ,getLocalAxis2: function() { - var v = new oimo_common_Vec3(); + getLocalAxis2() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX2X; v.y = this._localBasisX2Y; v.z = this._localBasisX2Z; return v; } - ,getLocalAxis1To: function(axis) { + getLocalAxis1To(axis) { axis.x = this._localBasisX1X; axis.y = this._localBasisX1Y; axis.z = this._localBasisX1Z; } - ,getLocalAxis2To: function(axis) { + getLocalAxis2To(axis) { axis.x = this._localBasisX2X; axis.y = this._localBasisX2Y; axis.z = this._localBasisX2Z; } - ,getTwistSpringDamper: function() { + getTwistSpringDamper() { return this._twistSd; } - ,getTwistLimitMotor: function() { + getTwistLimitMotor() { return this._twistLm; } - ,getSwingSpringDamper: function() { + getSwingSpringDamper() { return this._swingSd; } - ,getSwingAxis: function() { - var v = new oimo_common_Vec3(); + getSwingAxis() { + let v = new oimo_common_Vec3(); v.x = this.swingAxisX; v.y = this.swingAxisY; v.z = this.swingAxisZ; return v; } - ,getSwingAxisTo: function(axis) { + getSwingAxisTo(axis) { axis.x = this.swingAxisX; axis.y = this.swingAxisY; axis.z = this.swingAxisZ; } - ,getSwingAngle: function() { + getSwingAngle() { return this._swingAngle; } - ,getTwistAngle: function() { + getTwistAngle() { return this._twistAngle; } -}); -var oimo_dynamics_constraint_joint_RagdollJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localTwistAxis1 = new oimo_common_Vec3(1,0,0); - this.localTwistAxis2 = new oimo_common_Vec3(1,0,0); - this.localSwingAxis1 = new oimo_common_Vec3(0,1,0); - this.twistSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); - this.swingSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); - this.twistLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); - this.maxSwingAngle1 = 3.14159265358979; - this.maxSwingAngle2 = 3.14159265358979; -}; -oimo_dynamics_constraint_joint_RagdollJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { +} +class oimo_dynamics_constraint_joint_RagdollJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localTwistAxis1 = new oimo_common_Vec3(1,0,0); + this.localTwistAxis2 = new oimo_common_Vec3(1,0,0); + this.localSwingAxis1 = new oimo_common_Vec3(0,1,0); + this.twistSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.swingSpringDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.twistLimitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.maxSwingAngle1 = 3.14159265358979; + this.maxSwingAngle2 = 3.14159265358979; + } + init(rigidBody1,rigidBody2,worldAnchor,worldTwistAxis,worldSwingAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var localVector = this.localTwistAxis1; - var vX; - var vY; - var vZ; + let localVector = this.localTwistAxis1; + let vX; + let vY; + let vZ; vX = worldTwistAxis.x; vY = worldTwistAxis.y; vZ = worldTwistAxis.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; @@ -27055,16 +27287,16 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localTwistAxis2; - var vX1; - var vY1; - var vZ1; + let localVector1 = this.localTwistAxis2; + let vX1; + let vY1; + let vZ1; vX1 = worldTwistAxis.x; vY1 = worldTwistAxis.y; vZ1 = worldTwistAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; @@ -27074,16 +27306,16 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam localVector1.x = vX1; localVector1.y = vY1; localVector1.z = vZ1; - var localVector2 = this.localSwingAxis1; - var vX2; - var vY2; - var vZ2; + let localVector2 = this.localSwingAxis1; + let vX2; + let vY2; + let vZ2; vX2 = worldSwingAxis.x; vY2 = worldSwingAxis.y; vZ2 = worldSwingAxis.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = rigidBody1._transform._rotation00 * vX2 + rigidBody1._transform._rotation10 * vY2 + rigidBody1._transform._rotation20 * vZ2; __tmp__Y2 = rigidBody1._transform._rotation01 * vX2 + rigidBody1._transform._rotation11 * vY2 + rigidBody1._transform._rotation21 * vZ2; __tmp__Z2 = rigidBody1._transform._rotation02 * vX2 + rigidBody1._transform._rotation12 * vY2 + rigidBody1._transform._rotation22 * vZ2; @@ -27095,55 +27327,54 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam localVector2.z = vZ2; return this; } -}); -var oimo_dynamics_constraint_joint_RevoluteJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,1); - var v = config.localAxis1; - this._localBasisX1X = v.x; - this._localBasisX1Y = v.y; - this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; - this.buildLocalBasesFromX(); - this.angle = 0; - this.angularErrorY = 0; - this.angularErrorZ = 0; - this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); - this._sd = config.springDamper.clone(); - this._lm = config.limitMotor.clone(); -}; -oimo_dynamics_constraint_joint_RevoluteJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhsX; - var linearRhsY; - var linearRhsZ; +} +class oimo_dynamics_constraint_joint_RevoluteJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,1); + let v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + let v1 = config.localAxis2; + this._localBasisX2X = v1.x; + this._localBasisX2Y = v1.y; + this._localBasisX2Z = v1.z; + this.buildLocalBasesFromX(); + this.angle = 0; + this.angularErrorY = 0; + this.angularErrorZ = 0; + this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); + this._sd = config.springDamper.clone(); + this._lm = config.limitMotor.clone(); + } + getInfo(info,timeStep,isPositionPart) { + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var angRhsY = this.angularErrorY * erp; - var angRhsZ = this.angularErrorZ * erp; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let angRhsY = this.angularErrorY * erp; + let angRhsZ = this.angularErrorZ * erp; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -27180,10 +27411,10 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let motorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -27208,7 +27439,7 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c row.cfm = 0; row.minImpulse = -1e65536; row.maxImpulse = 1e65536; - var j = row.jacobian; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -27221,9 +27452,9 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -27261,9 +27492,9 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -27302,31 +27533,31 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = crossR221; j.ang2Z = crossR222; if(this._sd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); - j = row3.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -27334,9 +27565,43 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = this._basis.xY; j.ang2Z = this._basis.xZ; } - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; + let impulse3 = this._impulses[4]; + let row3 = info.rows[info.numRows++]; + let _this3 = row3.jacobian; + _this3.lin1X = 0; + _this3.lin1Y = 0; + _this3.lin1Z = 0; + _this3.lin2X = 0; + _this3.lin2Y = 0; + _this3.lin2Z = 0; + _this3.ang1X = 0; + _this3.ang1Y = 0; + _this3.ang1Z = 0; + _this3.ang2X = 0; + _this3.ang2Y = 0; + _this3.ang2Z = 0; + row3.rhs = 0; + row3.cfm = 0; + row3.minImpulse = 0; + row3.maxImpulse = 0; + row3.motorSpeed = 0; + row3.motorMaxImpulse = 0; + row3.impulse = null; + row3.impulse = impulse3; + row3.rhs = angRhsY; + row3.cfm = 0; + row3.minImpulse = -1e65536; + row3.maxImpulse = 1e65536; + j = row3.jacobian; + j.ang1X = this._basis.yX; + j.ang1Y = this._basis.yY; + j.ang1Z = this._basis.yZ; + j.ang2X = this._basis.yX; + j.ang2Y = this._basis.yY; + j.ang2Z = this._basis.yZ; + let impulse4 = this._impulses[5]; + let row4 = info.rows[info.numRows++]; + let _this4 = row4.jacobian; _this4.lin1X = 0; _this4.lin1Y = 0; _this4.lin1Z = 0; @@ -27357,45 +27622,11 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c row4.motorMaxImpulse = 0; row4.impulse = null; row4.impulse = impulse4; - row4.rhs = angRhsY; + row4.rhs = angRhsZ; row4.cfm = 0; row4.minImpulse = -1e65536; row4.maxImpulse = 1e65536; j = row4.jacobian; - j.ang1X = this._basis.yX; - j.ang1Y = this._basis.yY; - j.ang1Z = this._basis.yZ; - j.ang2X = this._basis.yX; - j.ang2Y = this._basis.yY; - j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -27403,80 +27634,80 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = this._basis.zY; j.ang2Z = this._basis.zZ; } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var _this = this._basis; - var invM1 = _this.joint._b1._invMass; - var invM2 = _this.joint._b2._invMass; - var qX; - var qY; - var qZ; - var qW; - var idQX; - var idQY; - var idQZ; - var idQW; - var slerpQX; - var slerpQY; - var slerpQZ; - var slerpQW; - var slerpM00; - var slerpM01; - var slerpM02; - var slerpM10; - var slerpM11; - var slerpM12; - var slerpM20; - var slerpM21; - var slerpM22; - var newXX; - var newXY; - var newXZ; - var newYX; - var newYY; - var newYZ; - var newZX; - var newZY; - var newZZ; - var prevXX; - var prevXY; - var prevXZ; - var prevYX; - var prevYY; - var prevYZ; - var d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; + _syncAnchors() { + super._syncAnchors(); + let _this = this._basis; + let invM1 = _this.joint._b1._invMass; + let invM2 = _this.joint._b2._invMass; + let qX; + let qY; + let qZ; + let qW; + let idQX; + let idQY; + let idQZ; + let idQW; + let slerpQX; + let slerpQY; + let slerpQZ; + let slerpQW; + let slerpM00; + let slerpM01; + let slerpM02; + let slerpM10; + let slerpM11; + let slerpM12; + let slerpM20; + let slerpM21; + let slerpM22; + let newXX; + let newXY; + let newXZ; + let newYX; + let newYY; + let newYZ; + let newZX; + let newZY; + let newZZ; + let prevXX; + let prevXY; + let prevXZ; + let prevYX; + let prevYY; + let prevYZ; + let d = _this.joint._basisX1X * _this.joint._basisX2X + _this.joint._basisX1Y * _this.joint._basisX2Y + _this.joint._basisX1Z * _this.joint._basisX2Z; if(d < -0.999999999) { - var vX; - var vY; - var vZ; - var x1 = _this.joint._basisX1X; - var y1 = _this.joint._basisX1Y; - var z1 = _this.joint._basisX1Z; - var x2 = x1 * x1; - var y2 = y1 * y1; - var z2 = z1 * z1; - var d1; + let vX; + let vY; + let vZ; + let x1 = _this.joint._basisX1X; + let y1 = _this.joint._basisX1Y; + let z1 = _this.joint._basisX1Z; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; if(x2 < y2) { if(x2 < z2) { - d1 = 1 / Math.sqrt(y2 + z2); + d = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z1 * d1; - vZ = -y1 * d1; + vY = z1 * d; + vZ = -y1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } } else if(y2 < z2) { - d1 = 1 / Math.sqrt(z2 + x2); - vX = -z1 * d1; + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; vY = 0; - vZ = x1 * d1; + vZ = x1 * d; } else { - d1 = 1 / Math.sqrt(x2 + y2); - vX = y1 * d1; - vY = -x1 * d1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; vZ = 0; } qX = vX; @@ -27484,13 +27715,13 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c qZ = vZ; qW = 0; } else { - var cX; - var cY; - var cZ; + let cX; + let cY; + let cZ; cX = _this.joint._basisX1Y * _this.joint._basisX2Z - _this.joint._basisX1Z * _this.joint._basisX2Y; cY = _this.joint._basisX1Z * _this.joint._basisX2X - _this.joint._basisX1X * _this.joint._basisX2Z; cZ = _this.joint._basisX1X * _this.joint._basisX2Y - _this.joint._basisX1Y * _this.joint._basisX2X; - var w = Math.sqrt((1 + d) * 0.5); + let w = Math.sqrt((1 + d) * 0.5); d = 0.5 / w; cX *= d; cY *= d; @@ -27504,14 +27735,14 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c idQY = 0; idQZ = 0; idQW = 1; - var q1X; - var q1Y; - var q1Z; - var q1W; - var q2X; - var q2Y; - var q2Z; - var q2W; + let q1X; + let q1Y; + let q1Z; + let q1W; + let q2X; + let q2Y; + let q2Z; + let q2W; q1X = idQX; q1Y = idQY; q1Z = idQZ; @@ -27520,19 +27751,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + let d1 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d1 < 0) { + d1 = -d1; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { - var dqX; - var dqY; - var dqZ; - var dqW; + if(d1 > 0.999999) { + let dqX; + let dqY; + let dqZ; + let dqW; dqX = q2X - q1X; dqY = q2Y - q1Y; dqZ = q2Z - q1Z; @@ -27541,7 +27772,7 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c q2Y = q1Y + dqY * (invM1 / (invM1 + invM2)); q2Z = q1Z + dqZ * (invM1 / (invM1 + invM2)); q2W = q1W + dqW * (invM1 / (invM1 + invM2)); - var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -27550,21 +27781,21 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; - var sin = Math.sin(theta); - var cos = Math.cos(theta); + let theta = invM1 / (invM1 + invM2) * Math.acos(d1); + q2X += q1X * -d1; + q2Y += q1Y * -d1; + q2Z += q1Z * -d1; + q2W += q1W * -d1; + let l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; + let sin = Math.sin(theta); + let cos = Math.cos(theta); q1X *= cos; q1Y *= cos; q1Z *= cos; @@ -27574,22 +27805,22 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c slerpQZ = q1Z + q2Z * sin; slerpQW = q1W + q2W * sin; } - var x = slerpQX; - var y = slerpQY; - var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + let x = slerpQX; + let y = slerpQY; + let z = slerpQZ; + let w = slerpQW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -27599,9 +27830,9 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = slerpM00 * _this.joint._basisX1X + slerpM01 * _this.joint._basisX1Y + slerpM02 * _this.joint._basisX1Z; __tmp__Y = slerpM10 * _this.joint._basisX1X + slerpM11 * _this.joint._basisX1Y + slerpM12 * _this.joint._basisX1Z; __tmp__Z = slerpM20 * _this.joint._basisX1X + slerpM21 * _this.joint._basisX1Y + slerpM22 * _this.joint._basisX1Z; @@ -27614,78 +27845,78 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + let d2 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d2 < -0.999999999) { + let vX; + let vY; + let vZ; + let x1 = prevXX; + let y1 = prevXY; + let z1 = prevXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d; + vZ = -y1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d; + vY = 0; + vZ = x1 * d; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d = 1 / Math.sqrt(x2 + y2); + vX = y1 * d; + vY = -x1 * d; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; + let cX; + let cY; + let cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + let w = Math.sqrt((1 + d2) * 0.5); + d2 = 0.5 / w; + cX *= d2; + cY *= d2; + cZ *= d2; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + let x1 = slerpQX; + let y1 = slerpQY; + let z1 = slerpQZ; + let w1 = slerpQW; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; slerpM00 = 1 - yy1 - zz1; slerpM01 = xy1 - wz1; slerpM02 = xz1 + wy1; @@ -27695,9 +27926,9 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c slerpM20 = xz1 - wy1; slerpM21 = yz1 + wx1; slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; @@ -27708,42 +27939,42 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + let l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + let x1 = newXX; + let y1 = newXY; + let z1 = newXZ; + let x2 = x1 * x1; + let y2 = y1 * y1; + let z2 = z1 * z1; + let d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -27759,34 +27990,34 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c _this.zX = newZX; _this.zY = newZY; _this.zZ = newZZ; - var angErrorX; - var angErrorY; - var angErrorZ; + let angErrorX; + let angErrorY; + let angErrorZ; angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + let cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + let theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + let l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; - var perpCrossX; - var perpCrossY; - var perpCrossZ; + let perpCrossX; + let perpCrossY; + let perpCrossZ; perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } @@ -27794,93 +28025,92 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c this.linearErrorY = this._anchor2Y - this._anchor1Y; this.linearErrorZ = this._anchor2Z - this._anchor1Z; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); + getAxis1() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxis2: function() { - var v = new oimo_common_Vec3(); + getAxis2() { + let v = new oimo_common_Vec3(); v.x = this._basisX2X; v.y = this._basisX2Y; v.z = this._basisX2Z; return v; } - ,getAxis1To: function(axis) { + getAxis1To(axis) { axis.x = this._basisX1X; axis.y = this._basisX1Y; axis.z = this._basisX1Z; } - ,getAxis2To: function(axis) { + getAxis2To(axis) { axis.x = this._basisX2X; axis.y = this._basisX2Y; axis.z = this._basisX2Z; } - ,getLocalAxis1: function() { - var v = new oimo_common_Vec3(); + getLocalAxis1() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX1X; v.y = this._localBasisX1Y; v.z = this._localBasisX1Z; return v; } - ,getLocalAxis2: function() { - var v = new oimo_common_Vec3(); + getLocalAxis2() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX2X; v.y = this._localBasisX2Y; v.z = this._localBasisX2Z; return v; } - ,getLocalAxis1To: function(axis) { + getLocalAxis1To(axis) { axis.x = this._localBasisX1X; axis.y = this._localBasisX1Y; axis.z = this._localBasisX1Z; } - ,getLocalAxis2To: function(axis) { + getLocalAxis2To(axis) { axis.x = this._localBasisX2X; axis.y = this._localBasisX2Y; axis.z = this._localBasisX2Z; } - ,getSpringDamper: function() { + getSpringDamper() { return this._sd; } - ,getLimitMotor: function() { + getLimitMotor() { return this._lm; } - ,getAngle: function() { + getAngle() { return this.angle; } -}); -var oimo_dynamics_constraint_joint_RevoluteJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localAxis1 = new oimo_common_Vec3(1,0,0); - this.localAxis2 = new oimo_common_Vec3(1,0,0); - this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); - this.limitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); -}; -oimo_dynamics_constraint_joint_RevoluteJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis) { +} +class oimo_dynamics_constraint_joint_RevoluteJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + this.limitMotor = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis) { this._init(rigidBody1,rigidBody2,worldAnchor); - var localVector = this.localAxis1; - var vX; - var vY; - var vZ; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; vX = worldAxis.x; vY = worldAxis.y; vZ = worldAxis.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; @@ -27890,16 +28120,16 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dyna localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; vX1 = worldAxis.x; vY1 = worldAxis.y; vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; @@ -27911,59 +28141,58 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dyna localVector1.z = vZ1; return this; } -}); -var oimo_dynamics_constraint_joint_RotationalLimitMotor = function() { - this.lowerLimit = 1; - this.upperLimit = 0; - this.motorTorque = 0; -}; -oimo_dynamics_constraint_joint_RotationalLimitMotor.prototype = { - setLimits: function(lower,upper) { +} +class oimo_dynamics_constraint_joint_RotationalLimitMotor { + constructor() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorTorque = 0; + } + setLimits(lower,upper) { this.lowerLimit = lower; this.upperLimit = upper; return this; } - ,setMotor: function(speed,torque) { + setMotor(speed,torque) { this.motorSpeed = speed; this.motorTorque = torque; return this; } - ,clone: function() { - var lm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + clone() { + let lm = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); lm.lowerLimit = this.lowerLimit; lm.upperLimit = this.upperLimit; lm.motorSpeed = this.motorSpeed; lm.motorTorque = this.motorTorque; return lm; } -}; -var oimo_dynamics_constraint_joint_SphericalJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,0); - this._sd = config.springDamper.clone(); -}; -oimo_dynamics_constraint_joint_SphericalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { +} +class oimo_dynamics_constraint_joint_SphericalJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,0); + this._sd = config.springDamper.clone(); + } + getInfo(info,timeStep,isPositionPart) { if(this._sd.frequency > 0 && isPositionPart) { return; } - var errorX; - var errorY; - var errorZ; + let errorX; + let errorY; + let errorZ; errorX = this._anchor2X - this._anchor1X; errorY = this._anchor2Y - this._anchor1Y; errorZ = this._anchor2Z - this._anchor1Z; - var cfm; - var erp; + let cfm; + let erp; if(this._sd.frequency > 0) { - var omega = 6.28318530717958 * this._sd.frequency; - var zeta = this._sd.dampingRatio; + let omega = 6.28318530717958 * this._sd.frequency; + let zeta = this._sd.dampingRatio; if(zeta < oimo_common_Setting.minSpringDamperDampingRatio) { zeta = oimo_common_Setting.minSpringDamperDampingRatio; } - var h = timeStep.dt; - var c = 2 * zeta * omega; - var k = omega * omega; + let h = timeStep.dt; + let c = 2 * zeta * omega; + let k = omega * omega; if(this._sd.useSymplecticEuler) { cfm = 1 / (h * c); erp = k / c; @@ -27976,30 +28205,30 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ cfm = 0; erp = this.getErp(timeStep,isPositionPart); } - var linearRhsX; - var linearRhsY; - var linearRhsZ; + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = errorX * erp; linearRhsY = errorY * erp; linearRhsZ = errorZ * erp; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -28036,9 +28265,9 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -28063,7 +28292,7 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ row.cfm = cfm; row.minImpulse = -1e65536; row.maxImpulse = 1e65536; - var j = row.jacobian; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -28076,9 +28305,9 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -28116,9 +28345,9 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -28157,128 +28386,126 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR221; j.ang2Z = crossR222; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getSpringDamper: function() { + getSpringDamper() { return this._sd; } -}); -var oimo_dynamics_constraint_joint_SphericalJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); -}; -oimo_dynamics_constraint_joint_SphericalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_SphericalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor) { +} +class oimo_dynamics_constraint_joint_SphericalJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.springDamper = new oimo_dynamics_constraint_joint_SpringDamper(); + } + init(rigidBody1,rigidBody2,worldAnchor) { this._init(rigidBody1,rigidBody2,worldAnchor); return this; } -}); -var oimo_dynamics_constraint_joint_SpringDamper = function() { - this.frequency = 0; - this.dampingRatio = 0; - this.useSymplecticEuler = false; -}; -oimo_dynamics_constraint_joint_SpringDamper.prototype = { - setSpring: function(frequency,dampingRatio) { +} +class oimo_dynamics_constraint_joint_SpringDamper { + constructor() { + this.frequency = 0; + this.dampingRatio = 0; + this.useSymplecticEuler = false; + } + setSpring(frequency,dampingRatio) { this.frequency = frequency; this.dampingRatio = dampingRatio; return this; } - ,setSymplecticEuler: function(useSymplecticEuler) { + setSymplecticEuler(useSymplecticEuler) { this.useSymplecticEuler = useSymplecticEuler; return this; } - ,clone: function() { - var sd = new oimo_dynamics_constraint_joint_SpringDamper(); + clone() { + let sd = new oimo_dynamics_constraint_joint_SpringDamper(); sd.frequency = this.frequency; sd.dampingRatio = this.dampingRatio; sd.useSymplecticEuler = this.useSymplecticEuler; return sd; } -}; -var oimo_dynamics_constraint_joint_TranslationalLimitMotor = function() { - this.lowerLimit = 1; - this.upperLimit = 0; - this.motorForce = 0; -}; -oimo_dynamics_constraint_joint_TranslationalLimitMotor.prototype = { - setLimits: function(lower,upper) { +} +class oimo_dynamics_constraint_joint_TranslationalLimitMotor { + constructor() { + this.lowerLimit = 1; + this.upperLimit = 0; + this.motorForce = 0; + } + setLimits(lower,upper) { this.lowerLimit = lower; this.upperLimit = upper; return this; } - ,setMotor: function(speed,force) { + setMotor(speed,force) { this.motorSpeed = speed; this.motorForce = force; return this; } - ,clone: function() { - var lm = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); + clone() { + let lm = new oimo_dynamics_constraint_joint_TranslationalLimitMotor(); lm.lowerLimit = this.lowerLimit; lm.upperLimit = this.upperLimit; lm.motorSpeed = this.motorSpeed; lm.motorForce = this.motorForce; return lm; } -}; -var oimo_dynamics_constraint_joint_UniversalJoint = function(config) { - oimo_dynamics_constraint_joint_Joint.call(this,config,oimo_dynamics_constraint_joint_JointType.UNIVERSAL); - var v = config.localAxis1; - this._localBasisX1X = v.x; - this._localBasisX1Y = v.y; - this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisZ2X = v1.x; - this._localBasisZ2Y = v1.y; - this._localBasisZ2Z = v1.z; - this.buildLocalBasesFromX1Z2(); - this._angleX = 0; - this._angleY = 0; - this._angleZ = 0; - this.xSingular = false; - this.ySingular = false; - this.zSingular = false; - this._sd1 = config.springDamper1.clone(); - this._sd2 = config.springDamper2.clone(); - this._lm1 = config.limitMotor1.clone(); - this._lm2 = config.limitMotor2.clone(); -}; -oimo_dynamics_constraint_joint_UniversalJoint.__super__ = oimo_dynamics_constraint_joint_Joint; -oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_constraint_joint_Joint.prototype,{ - getInfo: function(info,timeStep,isPositionPart) { - var erp = this.getErp(timeStep,isPositionPart); - var linearRhsX; - var linearRhsY; - var linearRhsZ; +} +class oimo_dynamics_constraint_joint_UniversalJoint extends oimo_dynamics_constraint_joint_Joint { + constructor(config) { + super(config,oimo_dynamics_constraint_joint_JointType.UNIVERSAL); + let v = config.localAxis1; + this._localBasisX1X = v.x; + this._localBasisX1Y = v.y; + this._localBasisX1Z = v.z; + let v1 = config.localAxis2; + this._localBasisZ2X = v1.x; + this._localBasisZ2Y = v1.y; + this._localBasisZ2Z = v1.z; + this.buildLocalBasesFromX1Z2(); + this._angleX = 0; + this._angleY = 0; + this._angleZ = 0; + this.xSingular = false; + this.ySingular = false; + this.zSingular = false; + this._sd1 = config.springDamper1.clone(); + this._sd2 = config.springDamper2.clone(); + this._lm1 = config.limitMotor1.clone(); + this._lm2 = config.limitMotor2.clone(); + } + getInfo(info,timeStep,isPositionPart) { + let erp = this.getErp(timeStep,isPositionPart); + let linearRhsX; + let linearRhsY; + let linearRhsZ; linearRhsX = this.linearErrorX * erp; linearRhsY = this.linearErrorY * erp; linearRhsZ = this.linearErrorZ * erp; - var angRhsY = this._angleY * erp; - var crossR100; - var crossR101; - var crossR102; - var crossR110; - var crossR111; - var crossR112; - var crossR120; - var crossR121; - var crossR122; - var crossR200; - var crossR201; - var crossR202; - var crossR210; - var crossR211; - var crossR212; - var crossR220; - var crossR221; - var crossR222; + let angRhsY = this._angleY * erp; + let crossR100; + let crossR101; + let crossR102; + let crossR110; + let crossR111; + let crossR112; + let crossR120; + let crossR121; + let crossR122; + let crossR200; + let crossR201; + let crossR202; + let crossR210; + let crossR211; + let crossR212; + let crossR220; + let crossR221; + let crossR222; crossR100 = 0; crossR101 = -this._relativeAnchor1Z; crossR102 = this._relativeAnchor1Y; @@ -28315,11 +28542,11 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ crossR220 = -crossR220; crossR221 = -crossR221; crossR222 = -crossR222; - var motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); - var motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); - var impulse = this._impulses[0]; - var row = info.rows[info.numRows++]; - var _this = row.jacobian; + let motorMassX = this.computeEffectiveInertiaMoment(this._axisXX,this._axisXY,this._axisXZ); + let motorMassZ = this.computeEffectiveInertiaMoment(this._axisZX,this._axisZY,this._axisZZ); + let impulse = this._impulses[0]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; _this.lin1X = 0; _this.lin1Y = 0; _this.lin1Z = 0; @@ -28344,7 +28571,7 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ row.cfm = 0; row.minImpulse = -1e65536; row.maxImpulse = 1e65536; - var j = row.jacobian; + let j = row.jacobian; j.lin1X = 1; j.lin1Y = 0; j.lin1Z = 0; @@ -28357,9 +28584,9 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; + let impulse1 = this._impulses[1]; + let row1 = info.rows[info.numRows++]; + let _this1 = row1.jacobian; _this1.lin1X = 0; _this1.lin1Y = 0; _this1.lin1Z = 0; @@ -28397,9 +28624,9 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; + let impulse2 = this._impulses[2]; + let row2 = info.rows[info.numRows++]; + let _this2 = row2.jacobian; _this2.lin1X = 0; _this2.lin1Y = 0; _this2.lin1Z = 0; @@ -28438,31 +28665,31 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR221; j.ang2Z = crossR222; if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); - j = row3.jacobian; + let impulse = this._impulses[3]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -28471,34 +28698,34 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = this._axisXZ; } if(!this.ySingular) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; + let impulse = this._impulses[4]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -28507,31 +28734,31 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - this.setSolverInfoRowAngular(row5,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); - j = row5.jacobian; + let impulse = this._impulses[5]; + let row = info.rows[info.numRows++]; + let _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisZX; j.ang1Y = this._axisZY; j.ang1Z = this._axisZZ; @@ -28540,17 +28767,17 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = this._axisZZ; } } - ,_syncAnchors: function() { - oimo_dynamics_constraint_joint_Joint.prototype._syncAnchors.call(this); - var angleAxisXX; - var angleAxisXY; - var angleAxisXZ; - var angleAxisYX; - var angleAxisYY; - var angleAxisYZ; - var angleAxisZX; - var angleAxisZY; - var angleAxisZZ; + _syncAnchors() { + super._syncAnchors(); + let angleAxisXX; + let angleAxisXY; + let angleAxisXZ; + let angleAxisYX; + let angleAxisYY; + let angleAxisYZ; + let angleAxisZX; + let angleAxisZY; + let angleAxisZZ; angleAxisXX = this._basisX1X; angleAxisXY = this._basisX1Y; angleAxisXZ = this._basisX1Z; @@ -28569,21 +28796,21 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ this._axisZX = angleAxisXY * angleAxisYZ - angleAxisXZ * angleAxisYY; this._axisZY = angleAxisXZ * angleAxisYX - angleAxisXX * angleAxisYZ; this._axisZZ = angleAxisXX * angleAxisYY - angleAxisXY * angleAxisYX; - var l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; + let l = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ; if(l > 0) { l = 1 / Math.sqrt(l); } this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + let l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; if(l1 > 0) { l1 = 1 / Math.sqrt(l1); } this._axisYX *= l1; this._axisYY *= l1; this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + let l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; if(l2 > 0) { l2 = 1 / Math.sqrt(l2); } @@ -28593,24 +28820,24 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; - var rot100; - var rot101; - var rot102; - var rot110; - var rot111; - var rot112; - var rot120; - var rot121; - var rot122; - var rot200; - var rot201; - var rot202; - var rot210; - var rot211; - var rot212; - var rot220; - var rot221; - var rot222; + let rot100; + let rot101; + let rot102; + let rot110; + let rot111; + let rot112; + let rot120; + let rot121; + let rot122; + let rot200; + let rot201; + let rot202; + let rot210; + let rot211; + let rot212; + let rot220; + let rot221; + let rot222; rot100 = this._basisX1X; rot101 = this._basisY1X; rot102 = this._basisZ1X; @@ -28629,20 +28856,20 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ rot220 = this._basisX2Z; rot221 = this._basisY2Z; rot222 = this._basisZ2Z; - var relRot00; - var relRot01; - var relRot02; - var relRot11; - var relRot12; - var relRot21; - var relRot22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__11; - var __tmp__12; - var __tmp__21; - var __tmp__22; + let relRot00; + let relRot01; + let relRot02; + let relRot11; + let relRot12; + let relRot21; + let relRot22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__11; + let __tmp__12; + let __tmp__21; + let __tmp__22; __tmp__00 = rot100 * rot200 + rot110 * rot210 + rot120 * rot220; __tmp__01 = rot100 * rot201 + rot110 * rot211 + rot120 * rot221; __tmp__02 = rot100 * rot202 + rot110 * rot212 + rot120 * rot222; @@ -28657,17 +28884,17 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ relRot12 = __tmp__12; relRot21 = __tmp__21; relRot22 = __tmp__22; - var anglesX; - var anglesY; - var anglesZ; - var sy = relRot02; + let anglesX; + let anglesY; + let anglesZ; + let sy = relRot02; if(sy <= -1) { - var xSubZ = Math.atan2(relRot21,relRot11); + let xSubZ = Math.atan2(relRot21,relRot11); anglesX = xSubZ * 0.5; anglesY = -1.570796326794895; anglesZ = -xSubZ * 0.5; } else if(sy >= 1) { - var xAddZ = Math.atan2(relRot21,relRot11); + let xAddZ = Math.atan2(relRot21,relRot11); anglesX = xAddZ * 0.5; anglesY = 1.570796326794895; anglesZ = xAddZ * 0.5; @@ -28683,104 +28910,103 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ this.linearErrorY = this._anchor2Y - this._anchor1Y; this.linearErrorZ = this._anchor2Z - this._anchor1Z; } - ,_getVelocitySolverInfo: function(timeStep,info) { - oimo_dynamics_constraint_joint_Joint.prototype._getVelocitySolverInfo.call(this,timeStep,info); + _getVelocitySolverInfo(timeStep,info) { + super._getVelocitySolverInfo(timeStep,info); this.getInfo(info,timeStep,false); } - ,_getPositionSolverInfo: function(info) { - oimo_dynamics_constraint_joint_Joint.prototype._getPositionSolverInfo.call(this,info); + _getPositionSolverInfo(info) { + super._getPositionSolverInfo(info); this.getInfo(info,null,true); } - ,getAxis1: function() { - var v = new oimo_common_Vec3(); + getAxis1() { + let v = new oimo_common_Vec3(); v.x = this._basisX1X; v.y = this._basisX1Y; v.z = this._basisX1Z; return v; } - ,getAxis2: function() { - var v = new oimo_common_Vec3(); + getAxis2() { + let v = new oimo_common_Vec3(); v.x = this._basisZ2X; v.y = this._basisZ2Y; v.z = this._basisZ2Z; return v; } - ,getAxis1To: function(axis) { + getAxis1To(axis) { axis.x = this._basisX1X; axis.y = this._basisX1Y; axis.z = this._basisX1Z; } - ,getAxis2To: function(axis) { + getAxis2To(axis) { axis.x = this._basisZ2X; axis.y = this._basisZ2Y; axis.z = this._basisZ2Z; } - ,getLocalAxis1: function() { - var v = new oimo_common_Vec3(); + getLocalAxis1() { + let v = new oimo_common_Vec3(); v.x = this._localBasisX1X; v.y = this._localBasisX1Y; v.z = this._localBasisX1Z; return v; } - ,getLocalAxis2: function() { - var v = new oimo_common_Vec3(); + getLocalAxis2() { + let v = new oimo_common_Vec3(); v.x = this._localBasisZ2X; v.y = this._localBasisZ2Y; v.z = this._localBasisZ2Z; return v; } - ,getLocalAxis1To: function(axis) { + getLocalAxis1To(axis) { axis.x = this._localBasisX1X; axis.y = this._localBasisX1Y; axis.z = this._localBasisX1Z; } - ,getLocalAxis2To: function(axis) { + getLocalAxis2To(axis) { axis.x = this._localBasisZ2X; axis.y = this._localBasisZ2Y; axis.z = this._localBasisZ2Z; } - ,getSpringDamper1: function() { + getSpringDamper1() { return this._sd1; } - ,getSpringDamper2: function() { + getSpringDamper2() { return this._sd2; } - ,getLimitMotor1: function() { + getLimitMotor1() { return this._lm1; } - ,getLimitMotor2: function() { + getLimitMotor2() { return this._lm2; } - ,getAngle1: function() { + getAngle1() { return this._angleX; } - ,getAngle2: function() { + getAngle2() { return this._angleZ; } -}); -var oimo_dynamics_constraint_joint_UniversalJointConfig = function() { - oimo_dynamics_constraint_joint_JointConfig.call(this); - this.localAxis1 = new oimo_common_Vec3(1,0,0); - this.localAxis2 = new oimo_common_Vec3(1,0,0); - this.springDamper1 = new oimo_dynamics_constraint_joint_SpringDamper(); - this.springDamper2 = new oimo_dynamics_constraint_joint_SpringDamper(); - this.limitMotor1 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); - this.limitMotor2 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); -}; -oimo_dynamics_constraint_joint_UniversalJointConfig.__super__ = oimo_dynamics_constraint_joint_JointConfig; -oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dynamics_constraint_joint_JointConfig.prototype,{ - init: function(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { +} +class oimo_dynamics_constraint_joint_UniversalJointConfig extends oimo_dynamics_constraint_joint_JointConfig { + constructor() { + super(); + this.localAxis1 = new oimo_common_Vec3(1,0,0); + this.localAxis2 = new oimo_common_Vec3(1,0,0); + this.springDamper1 = new oimo_dynamics_constraint_joint_SpringDamper(); + this.springDamper2 = new oimo_dynamics_constraint_joint_SpringDamper(); + this.limitMotor1 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + this.limitMotor2 = new oimo_dynamics_constraint_joint_RotationalLimitMotor(); + } + init(rigidBody1,rigidBody2,worldAnchor,worldAxis1,worldAxis2) { this._init(rigidBody1,rigidBody2,worldAnchor); - var localVector = this.localAxis1; - var vX; - var vY; - var vZ; + let localVector = this.localAxis1; + let vX; + let vY; + let vZ; vX = worldAxis1.x; vY = worldAxis1.y; vZ = worldAxis1.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; @@ -28790,16 +29016,16 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dyn localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; + let localVector1 = this.localAxis2; + let vX1; + let vY1; + let vZ1; vX1 = worldAxis2.x; vY1 = worldAxis2.y; vZ1 = worldAxis2.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; @@ -28811,131 +29037,135 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dyn localVector1.z = vZ1; return this; } -}); -var oimo_dynamics_constraint_solver_ConstraintSolverType = function() { }; -var oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow = function() { - this.invMLinN1X = 0; - this.invMLinN1Y = 0; - this.invMLinN1Z = 0; - this.invMLinN2X = 0; - this.invMLinN2Y = 0; - this.invMLinN2Z = 0; - this.invMAngN1X = 0; - this.invMAngN1Y = 0; - this.invMAngN1Z = 0; - this.invMAngN2X = 0; - this.invMAngN2Y = 0; - this.invMAngN2Z = 0; - this.invMLinT1X = 0; - this.invMLinT1Y = 0; - this.invMLinT1Z = 0; - this.invMLinT2X = 0; - this.invMLinT2Y = 0; - this.invMLinT2Z = 0; - this.invMAngT1X = 0; - this.invMAngT1Y = 0; - this.invMAngT1Z = 0; - this.invMAngT2X = 0; - this.invMAngT2Y = 0; - this.invMAngT2Z = 0; - this.invMLinB1X = 0; - this.invMLinB1Y = 0; - this.invMLinB1Z = 0; - this.invMLinB2X = 0; - this.invMLinB2Y = 0; - this.invMLinB2Z = 0; - this.invMAngB1X = 0; - this.invMAngB1Y = 0; - this.invMAngB1Z = 0; - this.invMAngB2X = 0; - this.invMAngB2Y = 0; - this.invMAngB2Z = 0; - this.massN = 0; - this.massTB00 = 0; - this.massTB01 = 0; - this.massTB10 = 0; - this.massTB11 = 0; -}; -var oimo_dynamics_constraint_solver_common_JointSolverMassDataRow = function() { - this.invMLin1X = 0; - this.invMLin1Y = 0; - this.invMLin1Z = 0; - this.invMLin2X = 0; - this.invMLin2Y = 0; - this.invMLin2Z = 0; - this.invMAng1X = 0; - this.invMAng1Y = 0; - this.invMAng1Z = 0; - this.invMAng2X = 0; - this.invMAng2Y = 0; - this.invMAng2Z = 0; - this.mass = 0; - this.massWithoutCfm = 0; -}; -var oimo_dynamics_constraint_solver_direct_Boundary = function(maxRows) { - this.iBounded = new Array(maxRows); - this.iUnbounded = new Array(maxRows); - this.signs = new Array(maxRows); - this.b = new Array(maxRows); - this.numBounded = 0; - this.numUnbounded = 0; - this.matrixId = 0; -}; -oimo_dynamics_constraint_solver_direct_Boundary.prototype = { - init: function(buildInfo) { +} +class oimo_dynamics_constraint_solver_ConstraintSolverType { +} +class oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow { + constructor() { + this.invMLinN1X = 0; + this.invMLinN1Y = 0; + this.invMLinN1Z = 0; + this.invMLinN2X = 0; + this.invMLinN2Y = 0; + this.invMLinN2Z = 0; + this.invMAngN1X = 0; + this.invMAngN1Y = 0; + this.invMAngN1Z = 0; + this.invMAngN2X = 0; + this.invMAngN2Y = 0; + this.invMAngN2Z = 0; + this.invMLinT1X = 0; + this.invMLinT1Y = 0; + this.invMLinT1Z = 0; + this.invMLinT2X = 0; + this.invMLinT2Y = 0; + this.invMLinT2Z = 0; + this.invMAngT1X = 0; + this.invMAngT1Y = 0; + this.invMAngT1Z = 0; + this.invMAngT2X = 0; + this.invMAngT2Y = 0; + this.invMAngT2Z = 0; + this.invMLinB1X = 0; + this.invMLinB1Y = 0; + this.invMLinB1Z = 0; + this.invMLinB2X = 0; + this.invMLinB2Y = 0; + this.invMLinB2Z = 0; + this.invMAngB1X = 0; + this.invMAngB1Y = 0; + this.invMAngB1Z = 0; + this.invMAngB2X = 0; + this.invMAngB2Y = 0; + this.invMAngB2Z = 0; + this.massN = 0; + this.massTB00 = 0; + this.massTB01 = 0; + this.massTB10 = 0; + this.massTB11 = 0; + } +} +class oimo_dynamics_constraint_solver_common_JointSolverMassDataRow { + constructor() { + this.invMLin1X = 0; + this.invMLin1Y = 0; + this.invMLin1Z = 0; + this.invMLin2X = 0; + this.invMLin2Y = 0; + this.invMLin2Z = 0; + this.invMAng1X = 0; + this.invMAng1Y = 0; + this.invMAng1Z = 0; + this.invMAng2X = 0; + this.invMAng2Y = 0; + this.invMAng2Z = 0; + this.mass = 0; + this.massWithoutCfm = 0; + } +} +class oimo_dynamics_constraint_solver_direct_Boundary { + constructor(maxRows) { + this.iBounded = new Array(maxRows); + this.iUnbounded = new Array(maxRows); + this.signs = new Array(maxRows); + this.b = new Array(maxRows); + this.numBounded = 0; + this.numUnbounded = 0; + this.matrixId = 0; + } + init(buildInfo) { this.numBounded = buildInfo.numBounded; - var _g = 0; - var _g1 = this.numBounded; + let _g = 0; + let _g1 = this.numBounded; while(_g < _g1) { - var i = _g++; + let i = _g++; this.iBounded[i] = buildInfo.iBounded[i]; this.signs[i] = buildInfo.signs[i]; } this.numUnbounded = buildInfo.numUnbounded; this.matrixId = 0; - var _g2 = 0; - var _g3 = this.numUnbounded; + let _g2 = 0; + let _g3 = this.numUnbounded; while(_g2 < _g3) { - var i1 = _g2++; - var idx = buildInfo.iUnbounded[i1]; - this.iUnbounded[i1] = idx; + let i = _g2++; + let idx = buildInfo.iUnbounded[i]; + this.iUnbounded[i] = idx; this.matrixId |= 1 << idx; } } - ,computeImpulses: function(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { - var _g = 0; - var _g1 = this.numUnbounded; + computeImpulses(info,mass,relVels,impulses,dImpulses,impulseFactor,noCheck) { + let _g = 0; + let _g1 = this.numUnbounded; while(_g < _g1) { - var idx = this.iUnbounded[_g++]; - var row = info.rows[idx]; + let idx = this.iUnbounded[_g++]; + let row = info.rows[idx]; this.b[idx] = row.rhs * impulseFactor - relVels[idx] - row.cfm * impulses[idx]; } - var invMassWithoutCfm = mass._invMassWithoutCfm; - var _g2 = 0; - var _g3 = this.numBounded; + let invMassWithoutCfm = mass._invMassWithoutCfm; + let _g2 = 0; + let _g3 = this.numBounded; while(_g2 < _g3) { - var i = _g2++; - var idx1 = this.iBounded[i]; - var sign = this.signs[i]; - var row1 = info.rows[idx1]; - var dImpulse = (sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0) - impulses[idx1]; - dImpulses[idx1] = dImpulse; + let i = _g2++; + let idx = this.iBounded[i]; + let sign = this.signs[i]; + let row = info.rows[idx]; + let dImpulse = (sign < 0 ? row.minImpulse : sign > 0 ? row.maxImpulse : 0) - impulses[idx]; + dImpulses[idx] = dImpulse; if(dImpulse != 0) { - var _g21 = 0; - var _g31 = this.numUnbounded; - while(_g21 < _g31) { - var idx2 = this.iUnbounded[_g21++]; - var _g32 = this.b; - _g32[idx2] = _g32[idx2] - invMassWithoutCfm[idx1][idx2] * dImpulse; + let _g = 0; + let _g1 = this.numUnbounded; + while(_g < _g1) { + let idx2 = this.iUnbounded[_g++]; + this.b[idx2] -= invMassWithoutCfm[idx][idx2] * dImpulse; } } } - var indices = this.iUnbounded; - var n = this.numUnbounded; - var id = 0; - var _g4 = 0; + let indices = this.iUnbounded; + let n = this.numUnbounded; + let id = 0; + let _g4 = 0; while(_g4 < n) id |= 1 << indices[_g4++]; - var massMatrix; + let massMatrix; if(mass._cacheComputed[id]) { massMatrix = mass._cachedSubmatrices[id]; } else { @@ -28943,26 +29173,26 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { mass._cacheComputed[id] = true; massMatrix = mass._cachedSubmatrices[id]; } - var ok = true; - var _g41 = 0; - var _g5 = this.numUnbounded; - while(_g41 < _g5) { - var i1 = _g41++; - var idx3 = this.iUnbounded[i1]; - var row2 = info.rows[idx3]; - var oldImpulse = impulses[idx3]; - var impulse = oldImpulse; - var _g42 = 0; - var _g51 = this.numUnbounded; - while(_g42 < _g51) { - var j = _g42++; - impulse += this.b[this.iUnbounded[j]] * massMatrix[i1][j]; - } - if(impulse < row2.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row2.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { + let ok = true; + let _g5 = 0; + let _g6 = this.numUnbounded; + while(_g5 < _g6) { + let i = _g5++; + let idx = this.iUnbounded[i]; + let row = info.rows[idx]; + let oldImpulse = impulses[idx]; + let impulse = oldImpulse; + let _g = 0; + let _g1 = this.numUnbounded; + while(_g < _g1) { + let j = _g++; + impulse += this.b[this.iUnbounded[j]] * massMatrix[i][j]; + } + if(impulse < row.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { ok = false; break; } - dImpulses[idx3] = impulse - oldImpulse; + dImpulses[idx] = impulse - oldImpulse; } if(noCheck) { return true; @@ -28970,47 +29200,49 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { if(!ok) { return false; } - var _g6 = 0; - var _g7 = this.numBounded; - while(_g6 < _g7) { - var i2 = _g6++; - var idx4 = this.iBounded[i2]; - var row3 = info.rows[idx4]; - var sign1 = this.signs[i2]; - var error = 0; - var newImpulse = impulses[idx4] + dImpulses[idx4]; - var relVel = relVels[idx4]; - var _g61 = 0; - var _g71 = info.numRows; - while(_g61 < _g71) { - var j1 = _g61++; - relVel += invMassWithoutCfm[idx4][j1] * dImpulses[j1]; - } - error = row3.rhs * impulseFactor - relVel - row3.cfm * newImpulse; - if(sign1 < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { + let _g7 = 0; + let _g8 = this.numBounded; + while(_g7 < _g8) { + let i = _g7++; + let idx = this.iBounded[i]; + let row = info.rows[idx]; + let sign = this.signs[i]; + let error = 0; + let newImpulse = impulses[idx] + dImpulses[idx]; + let relVel = relVels[idx]; + let _g = 0; + let _g1 = info.numRows; + while(_g < _g1) { + let j = _g++; + relVel += invMassWithoutCfm[idx][j] * dImpulses[j]; + } + error = row.rhs * impulseFactor - relVel - row.cfm * newImpulse; + if(sign < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { ok = false; break; } } return ok; } -}; -var oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo = function(size) { - this.size = size; - this.numBounded = 0; - this.iBounded = new Array(size); - this.signs = new Array(size); - this.numUnbounded = 0; - this.iUnbounded = new Array(size); -}; -var oimo_dynamics_constraint_solver_direct_BoundaryBuilder = function(maxRows) { - this.maxRows = maxRows; - this.numBoundaries = 0; - this.boundaries = new Array(1 << maxRows); - this.bbInfo = new oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo(maxRows); -}; -oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { - buildBoundariesRecursive: function(info,i) { +} +class oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo { + constructor(size) { + this.size = size; + this.numBounded = 0; + this.iBounded = new Array(size); + this.signs = new Array(size); + this.numUnbounded = 0; + this.iUnbounded = new Array(size); + } +} +class oimo_dynamics_constraint_solver_direct_BoundaryBuilder { + constructor(maxRows) { + this.maxRows = maxRows; + this.numBoundaries = 0; + this.boundaries = new Array(1 << maxRows); + this.bbInfo = new oimo_dynamics_constraint_solver_direct_BoundaryBuildInfo(maxRows); + } + buildBoundariesRecursive(info,i) { if(i == info.numRows) { if(this.boundaries[this.numBoundaries] == null) { this.boundaries[this.numBoundaries] = new oimo_dynamics_constraint_solver_direct_Boundary(this.maxRows); @@ -29018,11 +29250,11 @@ oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { this.boundaries[this.numBoundaries++].init(this.bbInfo); return; } - var row = info.rows[i]; - var lowerLimitEnabled = row.minImpulse > -1e65536; - var upperLimitEnabled = row.maxImpulse < 1e65536; + let row = info.rows[i]; + let lowerLimitEnabled = row.minImpulse > -1e65536; + let upperLimitEnabled = row.maxImpulse < 1e65536; if(row.minImpulse == 0 && row.maxImpulse == 0) { - var _this = this.bbInfo; + let _this = this.bbInfo; _this.iBounded[_this.numBounded] = i; _this.signs[_this.numBounded] = 0; _this.numBounded++; @@ -29030,67 +29262,67 @@ oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { this.bbInfo.numBounded--; return; } - var _this1 = this.bbInfo; - _this1.iUnbounded[_this1.numUnbounded] = i; - _this1.numUnbounded++; + let _this = this.bbInfo; + _this.iUnbounded[_this.numUnbounded] = i; + _this.numUnbounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numUnbounded--; if(lowerLimitEnabled) { - var _this2 = this.bbInfo; - _this2.iBounded[_this2.numBounded] = i; - _this2.signs[_this2.numBounded] = -1; - _this2.numBounded++; + let _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = -1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } if(upperLimitEnabled) { - var _this3 = this.bbInfo; - _this3.iBounded[_this3.numBounded] = i; - _this3.signs[_this3.numBounded] = 1; - _this3.numBounded++; + let _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = 1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } } - ,buildBoundaries: function(info) { + buildBoundaries(info) { this.numBoundaries = 0; - var _this = this.bbInfo; + let _this = this.bbInfo; _this.numBounded = 0; _this.numUnbounded = 0; this.buildBoundariesRecursive(info,0); } -}; -var oimo_dynamics_constraint_solver_direct_BoundarySelector = function(n) { - this.n = n; - this.indices = new Array(n); - this.tmpIndices = new Array(n); - var _g = 0; - while(_g < n) { - var i = _g++; - this.indices[i] = i; - } -}; -oimo_dynamics_constraint_solver_direct_BoundarySelector.prototype = { - getIndex: function(i) { +} +class oimo_dynamics_constraint_solver_direct_BoundarySelector { + constructor(n) { + this.n = n; + this.indices = new Array(n); + this.tmpIndices = new Array(n); + let _g = 0; + while(_g < n) { + let i = _g++; + this.indices[i] = i; + } + } + getIndex(i) { return this.indices[i]; } - ,select: function(index) { - var i = 0; + select(index) { + let i = 0; while(this.indices[i] != index) ++i; while(i > 0) { - var tmp = this.indices[i]; + let tmp = this.indices[i]; this.indices[i] = this.indices[i - 1]; this.indices[i - 1] = tmp; --i; } } - ,setSize: function(size) { - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = this.n; + setSize(size) { + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = this.n; while(_g < _g1) { - var idx = this.indices[_g++]; + let idx = this.indices[_g++]; if(idx < size) { this.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -29099,60 +29331,59 @@ oimo_dynamics_constraint_solver_direct_BoundarySelector.prototype = { ++numGreater; } } - var tmp = this.indices; + let tmp = this.indices; this.indices = this.tmpIndices; this.tmpIndices = tmp; } -}; -var oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver = function(joint) { - oimo_dynamics_constraint_ConstraintSolver.call(this); - this.joint = joint; - this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); - var maxRows = oimo_common_Setting.maxJacobianRows; - this.massMatrix = new oimo_dynamics_constraint_solver_direct_MassMatrix(maxRows); - this.boundaryBuilder = new oimo_dynamics_constraint_solver_direct_BoundaryBuilder(maxRows); - this.massData = new Array(maxRows); - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); - var numMaxBoundaries = this.boundaryBuilder.boundaries.length; - this.velBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); - this.posBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); - this.relVels = new Array(maxRows); - this.impulses = new Array(maxRows); - this.dImpulses = new Array(maxRows); - this.dTotalImpulses = new Array(maxRows); - var _g2 = 0; - while(_g2 < maxRows) { - var i = _g2++; - this.relVels[i] = 0; - this.impulses[i] = 0; - this.dImpulses[i] = 0; - this.dTotalImpulses[i] = 0; - } -}; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; -oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ - preSolveVelocity: function(timeStep) { +} +class oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver extends oimo_dynamics_constraint_ConstraintSolver { + constructor(joint) { + super(); + this.joint = joint; + this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); + let maxRows = oimo_common_Setting.maxJacobianRows; + this.massMatrix = new oimo_dynamics_constraint_solver_direct_MassMatrix(maxRows); + this.boundaryBuilder = new oimo_dynamics_constraint_solver_direct_BoundaryBuilder(maxRows); + this.massData = new Array(maxRows); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); + let numMaxBoundaries = this.boundaryBuilder.boundaries.length; + this.velBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); + this.posBoundarySelector = new oimo_dynamics_constraint_solver_direct_BoundarySelector(numMaxBoundaries); + this.relVels = new Array(maxRows); + this.impulses = new Array(maxRows); + this.dImpulses = new Array(maxRows); + this.dTotalImpulses = new Array(maxRows); + let _g2 = 0; + while(_g2 < maxRows) { + let i = _g2++; + this.relVels[i] = 0; + this.impulses[i] = 0; + this.dImpulses[i] = 0; + this.dTotalImpulses[i] = 0; + } + } + preSolveVelocity(timeStep) { this.joint._syncAnchors(); this.joint._getVelocitySolverInfo(timeStep,this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.velBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.velBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -29161,31 +29392,31 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; } - ,warmStart: function(timeStep) { - var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + warmStart(timeStep) { + let factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var _this = this.info.rows[_g++].impulse; + let _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i = _g2++; - var row = this.info.rows[i]; - var imp = row.impulse; - var impulse = imp.impulse * factor; + let _g = 0; + let _g1 = this.info.numRows; + while(_g < _g1) { + let i = _g++; + let row = this.info.rows[i]; + let imp = row.impulse; + let impulse = imp.impulse * factor; if(impulse < row.minImpulse) { impulse = row.minImpulse; } else if(impulse > row.maxImpulse) { @@ -29193,8 +29424,8 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } imp.impulse = impulse; if(row.motorMaxImpulse > 0) { - var impulseM = imp.impulseM * factor; - var max = row.motorMaxImpulse; + let impulseM = imp.impulseM * factor; + let max = row.motorMaxImpulse; if(impulseM < -max) { impulseM = -max; } else if(impulseM > max) { @@ -29206,21 +29437,21 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } this.dImpulses[i] = imp.impulse + imp.impulseM; } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -29233,29 +29464,29 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g3 = 0; - var _g12 = this.info.numRows; - while(_g3 < _g12) { - var i1 = _g3++; - var j = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp1 = impulses[i1]; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; if((j.flag & 1) != 0) { - lv1X += md.invMLin1X * imp1; - lv1Y += md.invMLin1Y * imp1; - lv1Z += md.invMLin1Z * imp1; - lv2X += md.invMLin2X * -imp1; - lv2Y += md.invMLin2Y * -imp1; - lv2Z += md.invMLin2Z * -imp1; + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } if((j.flag & 2) != 0) { - av1X += md.invMAng1X * imp1; - av1Y += md.invMAng1Y * imp1; - av1Z += md.invMAng1Z * imp1; - av2X += md.invMAng2X * -imp1; - av2Y += md.invMAng2Y * -imp1; - av2Z += md.invMAng2Z * -imp1; + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } @@ -29276,20 +29507,20 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this._b2._angVelZ = av2Z; } } - ,solveVelocity: function() { - var numRows = this.info.numRows; - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + solveVelocity() { + let numRows = this.info.numRows; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -29302,12 +29533,12 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; + let _g = 0; while(_g < numRows) { - var i = _g++; - var row = this.info.rows[i]; - var j = row.jacobian; - var relVel = 0; + let i = _g++; + let row = this.info.rows[i]; + let j = row.jacobian; + let relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; @@ -29316,123 +29547,121 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this.impulses[i] = row.impulse.impulse; this.dTotalImpulses[i] = 0; } - var invMass = this.massMatrix._invMassWithoutCfm; - var _g2 = 0; - while(_g2 < numRows) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var imp = row1.impulse; - if(row1.motorMaxImpulse > 0) { - var oldImpulseM = imp.impulseM; - var impulseM = oldImpulseM + this.massData[i1].massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); - var maxImpulseM = row1.motorMaxImpulse; + let invMass = this.massMatrix._invMassWithoutCfm; + let _g1 = 0; + while(_g1 < numRows) { + let i = _g1++; + let row = this.info.rows[i]; + let imp = row.impulse; + if(row.motorMaxImpulse > 0) { + let oldImpulseM = imp.impulseM; + let impulseM = oldImpulseM + this.massData[i].massWithoutCfm * (-row.motorSpeed - this.relVels[i]); + let maxImpulseM = row.motorMaxImpulse; if(impulseM < -maxImpulseM) { impulseM = -maxImpulseM; } else if(impulseM > maxImpulseM) { impulseM = maxImpulseM; } imp.impulseM = impulseM; - var dImpulseM = impulseM - oldImpulseM; - this.dTotalImpulses[i1] = dImpulseM; - var _g21 = 0; - while(_g21 < numRows) { - var j1 = _g21++; - var _g3 = this.relVels; - _g3[j1] = _g3[j1] + dImpulseM * invMass[i1][j1]; + let dImpulseM = impulseM - oldImpulseM; + this.dTotalImpulses[i] = dImpulseM; + let _g = 0; + while(_g < numRows) { + let j = _g++; + this.relVels[j] += dImpulseM * invMass[i][j]; } } } - var solved = false; - var _g4 = 0; - var _g5 = this.boundaryBuilder.numBoundaries; - while(_g4 < _g5) { - var idx = this.velBoundarySelector.indices[_g4++]; + let solved = false; + let _g2 = 0; + let _g3 = this.boundaryBuilder.numBoundaries; + while(_g2 < _g3) { + let idx = this.velBoundarySelector.indices[_g2++]; if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { - var _g41 = 0; - while(_g41 < numRows) { - var j2 = _g41++; - var dimp = this.dImpulses[j2]; - this.info.rows[j2].impulse.impulse += dimp; - var _g51 = this.dTotalImpulses; - _g51[j2] = _g51[j2] + dimp; - } - var impulses = this.dTotalImpulses; - var linearSet = false; - var angularSet = false; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av1X1; - var av1Y1; - var av1Z1; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._velX; - lv1Y1 = this._b1._velY; - lv1Z1 = this._b1._velZ; - lv2X1 = this._b2._velX; - lv2Y1 = this._b2._velY; - lv2Z1 = this._b2._velZ; - av1X1 = this._b1._angVelX; - av1Y1 = this._b1._angVelY; - av1Z1 = this._b1._angVelZ; - av2X1 = this._b2._angVelX; - av2Y1 = this._b2._angVelY; - av2Z1 = this._b2._angVelZ; - var _g1 = 0; - var _g11 = this.info.numRows; - while(_g1 < _g11) { - var i2 = _g1++; - var j3 = this.info.rows[i2].jacobian; - var md = this.massData[i2]; - var imp1 = impulses[i2]; - if((j3.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp1; - lv1Y1 += md.invMLin1Y * imp1; - lv1Z1 += md.invMLin1Z * imp1; - lv2X1 += md.invMLin2X * -imp1; - lv2Y1 += md.invMLin2Y * -imp1; - lv2Z1 += md.invMLin2Z * -imp1; + let _g = 0; + while(_g < numRows) { + let j = _g++; + let dimp = this.dImpulses[j]; + this.info.rows[j].impulse.impulse += dimp; + this.dTotalImpulses[j] += dimp; + } + let impulses = this.dTotalImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j3.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp1; - av1Y1 += md.invMAng1Y * imp1; - av1Z1 += md.invMAng1Z * imp1; - av2X1 += md.invMAng2X * -imp1; - av2Y1 += md.invMAng2Y * -imp1; - av2Z1 += md.invMAng2Z * -imp1; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._velX = lv1X1; - this._b1._velY = lv1Y1; - this._b1._velZ = lv1Z1; - this._b2._velX = lv2X1; - this._b2._velY = lv2Y1; - this._b2._velZ = lv2Z1; + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; } if(angularSet) { - this._b1._angVelX = av1X1; - this._b1._angVelY = av1Y1; - this._b1._angVelZ = av1Z1; - this._b2._angVelX = av2X1; - this._b2._angVelY = av2Y1; - this._b2._angVelZ = av2Z1; - } - var _this = this.velBoundarySelector; - var i3 = 0; - while(_this.indices[i3] != idx) ++i3; - while(i3 > 0) { - var tmp = _this.indices[i3]; - _this.indices[i3] = _this.indices[i3 - 1]; - _this.indices[i3 - 1] = tmp; - --i3; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; + } + let _this = this.velBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -29443,25 +29672,25 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ return; } } - ,postSolveVelocity: function(timeStep) { - var linX; - var linY; - var linZ; - var angX; - var angY; - var angZ; + postSolveVelocity(timeStep) { + let linX; + let linY; + let linZ; + let angX; + let angY; + let angZ; linX = 0; linY = 0; linZ = 0; angX = 0; angY = 0; angZ = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var row = this.info.rows[_g++]; - var imp = row.impulse; - var j = row.jacobian; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let j = row.jacobian; if((j.flag & 1) != 0) { linX += j.lin1X * imp.impulse; linY += j.lin1Y * imp.impulse; @@ -29479,26 +29708,26 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this.joint._appliedTorqueY = angY * timeStep.invDt; this.joint._appliedTorqueZ = angZ * timeStep.invDt; } - ,preSolvePosition: function(timeStep) { + preSolvePosition(timeStep) { this.joint._syncAnchors(); this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.posBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -29507,27 +29736,27 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; - } - ,solvePositionSplitImpulse: function() { - var numRows = this.info.numRows; - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; + } + solvePositionSplitImpulse() { + let numRows = this.info.numRows; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -29540,12 +29769,12 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; + let _g = 0; while(_g < numRows) { - var i = _g++; - var row = this.info.rows[i]; - var j = row.jacobian; - var relVel = 0; + let i = _g++; + let row = this.info.rows[i]; + let j = row.jacobian; + let relVel = 0; relVel += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; relVel -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; relVel += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; @@ -29553,94 +29782,94 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this.relVels[i] = relVel; this.impulses[i] = row.impulse.impulseP; } - var solved = false; - var _g2 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g2 < _g3) { - var idx = this.posBoundarySelector.indices[_g2++]; + let solved = false; + let _g1 = 0; + let _g2 = this.boundaryBuilder.numBoundaries; + while(_g1 < _g2) { + let idx = this.posBoundarySelector.indices[_g1++]; if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionSplitImpulseBaumgarte,false)) { - var _g21 = 0; - while(_g21 < numRows) { - var j1 = _g21++; - this.info.rows[j1].impulse.impulseP += this.dImpulses[j1]; - } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av1X1; - var av1Y1; - var av1Z1; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._pseudoVelX; - lv1Y1 = this._b1._pseudoVelY; - lv1Z1 = this._b1._pseudoVelZ; - lv2X1 = this._b2._pseudoVelX; - lv2Y1 = this._b2._pseudoVelY; - lv2Z1 = this._b2._pseudoVelZ; - av1X1 = this._b1._angPseudoVelX; - av1Y1 = this._b1._angPseudoVelY; - av1Z1 = this._b1._angPseudoVelZ; - av2X1 = this._b2._angPseudoVelX; - av2Y1 = this._b2._angPseudoVelY; - av2Z1 = this._b2._angPseudoVelZ; - var _g1 = 0; - var _g11 = this.info.numRows; - while(_g1 < _g11) { - var i1 = _g1++; - var j2 = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp = impulses[i1]; - if((j2.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp; - lv1Y1 += md.invMLin1Y * imp; - lv1Z1 += md.invMLin1Z * imp; - lv2X1 += md.invMLin2X * -imp; - lv2Y1 += md.invMLin2Y * -imp; - lv2Z1 += md.invMLin2Z * -imp; + let _g = 0; + while(_g < numRows) { + let j = _g++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; + } + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j2.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp; - av1Y1 += md.invMAng1Y * imp; - av1Z1 += md.invMAng1Z * imp; - av2X1 += md.invMAng2X * -imp; - av2Y1 += md.invMAng2Y * -imp; - av2Z1 += md.invMAng2Z * -imp; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._pseudoVelX = lv1X1; - this._b1._pseudoVelY = lv1Y1; - this._b1._pseudoVelZ = lv1Z1; - this._b2._pseudoVelX = lv2X1; - this._b2._pseudoVelY = lv2Y1; - this._b2._pseudoVelZ = lv2Z1; + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; } if(angularSet) { - this._b1._angPseudoVelX = av1X1; - this._b1._angPseudoVelY = av1Y1; - this._b1._angPseudoVelZ = av1Z1; - this._b2._angPseudoVelX = av2X1; - this._b2._angPseudoVelY = av2Y1; - this._b2._angPseudoVelZ = av2Z1; - } - var _this = this.posBoundarySelector; - var i2 = 0; - while(_this.indices[i2] != idx) ++i2; - while(i2 > 0) { - var tmp = _this.indices[i2]; - _this.indices[i2] = _this.indices[i2 - 1]; - _this.indices[i2 - 1] = tmp; - --i2; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; + } + let _this = this.posBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -29651,26 +29880,26 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ return; } } - ,solvePositionNgs: function(timeStep) { + solvePositionNgs(timeStep) { this.joint._syncAnchors(); this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; this.massMatrix.computeInvMass(this.info,this.massData); - var _this = this.boundaryBuilder; + let _this = this.boundaryBuilder; _this.numBoundaries = 0; - var _this1 = _this.bbInfo; + let _this1 = _this.bbInfo; _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; - var size = this.boundaryBuilder.numBoundaries; - var numSmaller = 0; - var numGreater = 0; - var _g = 0; - var _g1 = _this2.n; + let _this2 = this.posBoundarySelector; + let size = this.boundaryBuilder.numBoundaries; + let numSmaller = 0; + let numGreater = 0; + let _g = 0; + let _g1 = _this2.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + let idx = _this2.indices[_g++]; if(idx < size) { _this2.tmpIndices[numSmaller] = idx; ++numSmaller; @@ -29679,43 +29908,43 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ ++numGreater; } } - var tmp = _this2.indices; + let tmp = _this2.indices; _this2.indices = _this2.tmpIndices; _this2.tmpIndices = tmp; - var numRows = this.info.numRows; - var _g2 = 0; + let numRows = this.info.numRows; + let _g2 = 0; while(_g2 < numRows) { - var i = _g2++; - var imp = this.info.rows[i].impulse; + let i = _g2++; + let imp = this.info.rows[i].impulse; this.relVels[i] = 0; this.impulses[i] = imp.impulseP; } - var solved = false; - var _g21 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g21 < _g3) { - var idx1 = this.posBoundarySelector.indices[_g21++]; - if(this.boundaryBuilder.boundaries[idx1].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { - var _g22 = 0; - while(_g22 < numRows) { - var j = _g22++; + let solved = false; + let _g3 = 0; + let _g4 = this.boundaryBuilder.numBoundaries; + while(_g3 < _g4) { + let idx = this.posBoundarySelector.indices[_g3++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { + let _g = 0; + while(_g < numRows) { + let j = _g++; this.info.rows[j].impulse.impulseP += this.dImpulses[j]; } - var impulses = this.dImpulses; - var linearSet = false; - var angularSet = false; - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let impulses = this.dImpulses; + let linearSet = false; + let angularSet = false; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -29728,122 +29957,122 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = 0; av2Y = 0; av2Z = 0; - var _g4 = 0; - var _g11 = this.info.numRows; - while(_g4 < _g11) { - var i1 = _g4++; - var j1 = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp1 = impulses[i1]; - if((j1.flag & 1) != 0) { - lv1X += md.invMLin1X * imp1; - lv1Y += md.invMLin1Y * imp1; - lv1Z += md.invMLin1Z * imp1; - lv2X += md.invMLin2X * -imp1; - lv2Y += md.invMLin2Y * -imp1; - lv2Z += md.invMLin2Z * -imp1; + let _g1 = 0; + let _g2 = this.info.numRows; + while(_g1 < _g2) { + let i = _g1++; + let j = this.info.rows[i].jacobian; + let md = this.massData[i]; + let imp = impulses[i]; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j1.flag & 2) != 0) { - av1X += md.invMAng1X * imp1; - av1Y += md.invMAng1Y * imp1; - av1Z += md.invMAng1Z * imp1; - av2X += md.invMAng2X * -imp1; - av2Y += md.invMAng2Y * -imp1; - av2Z += md.invMAng2Z * -imp1; + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - var _this3 = this._b1; - _this3._transform._positionX += lv1X; - _this3._transform._positionY += lv1Y; - _this3._transform._positionZ += lv1Z; - var _this4 = this._b2; - _this4._transform._positionX += lv2X; - _this4._transform._positionY += lv2Y; - _this4._transform._positionZ += lv2Z; + let _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + let _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; } if(angularSet) { - var _this5 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; + let ht2 = halfTheta * halfTheta; rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this5._transform._rotation00; - var e11 = _this5._transform._rotation11; - var e22 = _this5._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this._transform._rotation00; + let e11 = _this._transform._rotation11; + let e22 = _this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; - qY = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; - qZ = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; } else if(e00 > e11) { if(e00 > e22) { s = Math.sqrt(e00 - e11 - e22 + 1); qX = 0.5 * s; s = 0.5 / s; - qY = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qW = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } } else if(e11 > e22) { s = Math.sqrt(e11 - e22 - e00 + 1); qY = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -29851,173 +30080,173 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - _this5._transform._rotation00 = 1 - yy - zz; - _this5._transform._rotation01 = xy - wz; - _this5._transform._rotation02 = xz + wy; - _this5._transform._rotation10 = xy + wz; - _this5._transform._rotation11 = 1 - xx - zz; - _this5._transform._rotation12 = yz - wx; - _this5._transform._rotation20 = xz - wy; - _this5._transform._rotation21 = yz + wx; - _this5._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; - __tmp__00 = _this5._transform._rotation00 * _this5._invLocalInertia00 + _this5._transform._rotation01 * _this5._invLocalInertia10 + _this5._transform._rotation02 * _this5._invLocalInertia20; - __tmp__01 = _this5._transform._rotation00 * _this5._invLocalInertia01 + _this5._transform._rotation01 * _this5._invLocalInertia11 + _this5._transform._rotation02 * _this5._invLocalInertia21; - __tmp__02 = _this5._transform._rotation00 * _this5._invLocalInertia02 + _this5._transform._rotation01 * _this5._invLocalInertia12 + _this5._transform._rotation02 * _this5._invLocalInertia22; - __tmp__10 = _this5._transform._rotation10 * _this5._invLocalInertia00 + _this5._transform._rotation11 * _this5._invLocalInertia10 + _this5._transform._rotation12 * _this5._invLocalInertia20; - __tmp__11 = _this5._transform._rotation10 * _this5._invLocalInertia01 + _this5._transform._rotation11 * _this5._invLocalInertia11 + _this5._transform._rotation12 * _this5._invLocalInertia21; - __tmp__12 = _this5._transform._rotation10 * _this5._invLocalInertia02 + _this5._transform._rotation11 * _this5._invLocalInertia12 + _this5._transform._rotation12 * _this5._invLocalInertia22; - __tmp__20 = _this5._transform._rotation20 * _this5._invLocalInertia00 + _this5._transform._rotation21 * _this5._invLocalInertia10 + _this5._transform._rotation22 * _this5._invLocalInertia20; - __tmp__21 = _this5._transform._rotation20 * _this5._invLocalInertia01 + _this5._transform._rotation21 * _this5._invLocalInertia11 + _this5._transform._rotation22 * _this5._invLocalInertia21; - __tmp__22 = _this5._transform._rotation20 * _this5._invLocalInertia02 + _this5._transform._rotation21 * _this5._invLocalInertia12 + _this5._transform._rotation22 * _this5._invLocalInertia22; - _this5._invInertia00 = __tmp__00; - _this5._invInertia01 = __tmp__01; - _this5._invInertia02 = __tmp__02; - _this5._invInertia10 = __tmp__10; - _this5._invInertia11 = __tmp__11; - _this5._invInertia12 = __tmp__12; - _this5._invInertia20 = __tmp__20; - _this5._invInertia21 = __tmp__21; - _this5._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = _this5._invInertia00 * _this5._transform._rotation00 + _this5._invInertia01 * _this5._transform._rotation01 + _this5._invInertia02 * _this5._transform._rotation02; - __tmp__011 = _this5._invInertia00 * _this5._transform._rotation10 + _this5._invInertia01 * _this5._transform._rotation11 + _this5._invInertia02 * _this5._transform._rotation12; - __tmp__021 = _this5._invInertia00 * _this5._transform._rotation20 + _this5._invInertia01 * _this5._transform._rotation21 + _this5._invInertia02 * _this5._transform._rotation22; - __tmp__101 = _this5._invInertia10 * _this5._transform._rotation00 + _this5._invInertia11 * _this5._transform._rotation01 + _this5._invInertia12 * _this5._transform._rotation02; - __tmp__111 = _this5._invInertia10 * _this5._transform._rotation10 + _this5._invInertia11 * _this5._transform._rotation11 + _this5._invInertia12 * _this5._transform._rotation12; - __tmp__121 = _this5._invInertia10 * _this5._transform._rotation20 + _this5._invInertia11 * _this5._transform._rotation21 + _this5._invInertia12 * _this5._transform._rotation22; - __tmp__201 = _this5._invInertia20 * _this5._transform._rotation00 + _this5._invInertia21 * _this5._transform._rotation01 + _this5._invInertia22 * _this5._transform._rotation02; - __tmp__211 = _this5._invInertia20 * _this5._transform._rotation10 + _this5._invInertia21 * _this5._transform._rotation11 + _this5._invInertia22 * _this5._transform._rotation12; - __tmp__221 = _this5._invInertia20 * _this5._transform._rotation20 + _this5._invInertia21 * _this5._transform._rotation21 + _this5._invInertia22 * _this5._transform._rotation22; - _this5._invInertia00 = __tmp__001; - _this5._invInertia01 = __tmp__011; - _this5._invInertia02 = __tmp__021; - _this5._invInertia10 = __tmp__101; - _this5._invInertia11 = __tmp__111; - _this5._invInertia12 = __tmp__121; - _this5._invInertia20 = __tmp__201; - _this5._invInertia21 = __tmp__211; - _this5._invInertia22 = __tmp__221; - _this5._invInertia00 *= _this5._rotFactor.x; - _this5._invInertia01 *= _this5._rotFactor.x; - _this5._invInertia02 *= _this5._rotFactor.x; - _this5._invInertia10 *= _this5._rotFactor.y; - _this5._invInertia11 *= _this5._rotFactor.y; - _this5._invInertia12 *= _this5._rotFactor.y; - _this5._invInertia20 *= _this5._rotFactor.z; - _this5._invInertia21 *= _this5._rotFactor.z; - _this5._invInertia22 *= _this5._rotFactor.z; - var _this6 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__011 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__021 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__101 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__111 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__121 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__201 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__211 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__221 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__001; + _this._invInertia01 = __tmp__011; + _this._invInertia02 = __tmp__021; + _this._invInertia10 = __tmp__101; + _this._invInertia11 = __tmp__111; + _this._invInertia12 = __tmp__121; + _this._invInertia20 = __tmp__201; + _this._invInertia21 = __tmp__211; + _this._invInertia22 = __tmp__221; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; + let _this1 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this6._transform._rotation00; - var e111 = _this6._transform._rotation11; - var e221 = _this6._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this1._transform._rotation00; + let e111 = _this1._transform._rotation11; + let e221 = _this1._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; - qY1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; - qZ1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation21 - _this1._transform._rotation12) * s1; + qY1 = (_this1._transform._rotation02 - _this1._transform._rotation20) * s1; + qZ1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } else if(e001 > e111) { if(e001 > e221) { s1 = Math.sqrt(e001 - e111 - e221 + 1); qX1 = 0.5 * s1; s1 = 0.5 / s1; - qY1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qW1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + qY1 = (_this1._transform._rotation01 + _this1._transform._rotation10) * s1; + qZ1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qW1 = (_this1._transform._rotation21 - _this1._transform._rotation12) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qY1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } } else if(e111 > e221) { s1 = Math.sqrt(e111 - e221 - e001 + 1); qY1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + qX1 = (_this1._transform._rotation01 + _this1._transform._rotation10) * s1; + qZ1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation02 - _this1._transform._rotation20) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this1._transform._rotation02 + _this1._transform._rotation20) * s1; + qY1 = (_this1._transform._rotation12 + _this1._transform._rotation21) * s1; + qW1 = (_this1._transform._rotation10 - _this1._transform._rotation01) * s1; } qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -30025,103 +30254,103 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; - _this6._transform._rotation00 = 1 - yy1 - zz1; - _this6._transform._rotation01 = xy1 - wz1; - _this6._transform._rotation02 = xz1 + wy1; - _this6._transform._rotation10 = xy1 + wz1; - _this6._transform._rotation11 = 1 - xx1 - zz1; - _this6._transform._rotation12 = yz1 - wx1; - _this6._transform._rotation20 = xz1 - wy1; - _this6._transform._rotation21 = yz1 + wx1; - _this6._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = _this6._transform._rotation00 * _this6._invLocalInertia00 + _this6._transform._rotation01 * _this6._invLocalInertia10 + _this6._transform._rotation02 * _this6._invLocalInertia20; - __tmp__012 = _this6._transform._rotation00 * _this6._invLocalInertia01 + _this6._transform._rotation01 * _this6._invLocalInertia11 + _this6._transform._rotation02 * _this6._invLocalInertia21; - __tmp__022 = _this6._transform._rotation00 * _this6._invLocalInertia02 + _this6._transform._rotation01 * _this6._invLocalInertia12 + _this6._transform._rotation02 * _this6._invLocalInertia22; - __tmp__102 = _this6._transform._rotation10 * _this6._invLocalInertia00 + _this6._transform._rotation11 * _this6._invLocalInertia10 + _this6._transform._rotation12 * _this6._invLocalInertia20; - __tmp__112 = _this6._transform._rotation10 * _this6._invLocalInertia01 + _this6._transform._rotation11 * _this6._invLocalInertia11 + _this6._transform._rotation12 * _this6._invLocalInertia21; - __tmp__122 = _this6._transform._rotation10 * _this6._invLocalInertia02 + _this6._transform._rotation11 * _this6._invLocalInertia12 + _this6._transform._rotation12 * _this6._invLocalInertia22; - __tmp__202 = _this6._transform._rotation20 * _this6._invLocalInertia00 + _this6._transform._rotation21 * _this6._invLocalInertia10 + _this6._transform._rotation22 * _this6._invLocalInertia20; - __tmp__212 = _this6._transform._rotation20 * _this6._invLocalInertia01 + _this6._transform._rotation21 * _this6._invLocalInertia11 + _this6._transform._rotation22 * _this6._invLocalInertia21; - __tmp__222 = _this6._transform._rotation20 * _this6._invLocalInertia02 + _this6._transform._rotation21 * _this6._invLocalInertia12 + _this6._transform._rotation22 * _this6._invLocalInertia22; - _this6._invInertia00 = __tmp__002; - _this6._invInertia01 = __tmp__012; - _this6._invInertia02 = __tmp__022; - _this6._invInertia10 = __tmp__102; - _this6._invInertia11 = __tmp__112; - _this6._invInertia12 = __tmp__122; - _this6._invInertia20 = __tmp__202; - _this6._invInertia21 = __tmp__212; - _this6._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = _this6._invInertia00 * _this6._transform._rotation00 + _this6._invInertia01 * _this6._transform._rotation01 + _this6._invInertia02 * _this6._transform._rotation02; - __tmp__013 = _this6._invInertia00 * _this6._transform._rotation10 + _this6._invInertia01 * _this6._transform._rotation11 + _this6._invInertia02 * _this6._transform._rotation12; - __tmp__023 = _this6._invInertia00 * _this6._transform._rotation20 + _this6._invInertia01 * _this6._transform._rotation21 + _this6._invInertia02 * _this6._transform._rotation22; - __tmp__103 = _this6._invInertia10 * _this6._transform._rotation00 + _this6._invInertia11 * _this6._transform._rotation01 + _this6._invInertia12 * _this6._transform._rotation02; - __tmp__113 = _this6._invInertia10 * _this6._transform._rotation10 + _this6._invInertia11 * _this6._transform._rotation11 + _this6._invInertia12 * _this6._transform._rotation12; - __tmp__123 = _this6._invInertia10 * _this6._transform._rotation20 + _this6._invInertia11 * _this6._transform._rotation21 + _this6._invInertia12 * _this6._transform._rotation22; - __tmp__203 = _this6._invInertia20 * _this6._transform._rotation00 + _this6._invInertia21 * _this6._transform._rotation01 + _this6._invInertia22 * _this6._transform._rotation02; - __tmp__213 = _this6._invInertia20 * _this6._transform._rotation10 + _this6._invInertia21 * _this6._transform._rotation11 + _this6._invInertia22 * _this6._transform._rotation12; - __tmp__223 = _this6._invInertia20 * _this6._transform._rotation20 + _this6._invInertia21 * _this6._transform._rotation21 + _this6._invInertia22 * _this6._transform._rotation22; - _this6._invInertia00 = __tmp__003; - _this6._invInertia01 = __tmp__013; - _this6._invInertia02 = __tmp__023; - _this6._invInertia10 = __tmp__103; - _this6._invInertia11 = __tmp__113; - _this6._invInertia12 = __tmp__123; - _this6._invInertia20 = __tmp__203; - _this6._invInertia21 = __tmp__213; - _this6._invInertia22 = __tmp__223; - _this6._invInertia00 *= _this6._rotFactor.x; - _this6._invInertia01 *= _this6._rotFactor.x; - _this6._invInertia02 *= _this6._rotFactor.x; - _this6._invInertia10 *= _this6._rotFactor.y; - _this6._invInertia11 *= _this6._rotFactor.y; - _this6._invInertia12 *= _this6._rotFactor.y; - _this6._invInertia20 *= _this6._rotFactor.z; - _this6._invInertia21 *= _this6._rotFactor.z; - _this6._invInertia22 *= _this6._rotFactor.z; - } - var _this7 = this.posBoundarySelector; - var i2 = 0; - while(_this7.indices[i2] != idx1) ++i2; - while(i2 > 0) { - var tmp1 = _this7.indices[i2]; - _this7.indices[i2] = _this7.indices[i2 - 1]; - _this7.indices[i2 - 1] = tmp1; - --i2; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; + _this1._transform._rotation00 = 1 - yy1 - zz1; + _this1._transform._rotation01 = xy1 - wz1; + _this1._transform._rotation02 = xz1 + wy1; + _this1._transform._rotation10 = xy1 + wz1; + _this1._transform._rotation11 = 1 - xx1 - zz1; + _this1._transform._rotation12 = yz1 - wx1; + _this1._transform._rotation20 = xz1 - wy1; + _this1._transform._rotation21 = yz1 + wx1; + _this1._transform._rotation22 = 1 - xx1 - yy1; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; + __tmp__002 = _this1._transform._rotation00 * _this1._invLocalInertia00 + _this1._transform._rotation01 * _this1._invLocalInertia10 + _this1._transform._rotation02 * _this1._invLocalInertia20; + __tmp__012 = _this1._transform._rotation00 * _this1._invLocalInertia01 + _this1._transform._rotation01 * _this1._invLocalInertia11 + _this1._transform._rotation02 * _this1._invLocalInertia21; + __tmp__022 = _this1._transform._rotation00 * _this1._invLocalInertia02 + _this1._transform._rotation01 * _this1._invLocalInertia12 + _this1._transform._rotation02 * _this1._invLocalInertia22; + __tmp__102 = _this1._transform._rotation10 * _this1._invLocalInertia00 + _this1._transform._rotation11 * _this1._invLocalInertia10 + _this1._transform._rotation12 * _this1._invLocalInertia20; + __tmp__112 = _this1._transform._rotation10 * _this1._invLocalInertia01 + _this1._transform._rotation11 * _this1._invLocalInertia11 + _this1._transform._rotation12 * _this1._invLocalInertia21; + __tmp__122 = _this1._transform._rotation10 * _this1._invLocalInertia02 + _this1._transform._rotation11 * _this1._invLocalInertia12 + _this1._transform._rotation12 * _this1._invLocalInertia22; + __tmp__202 = _this1._transform._rotation20 * _this1._invLocalInertia00 + _this1._transform._rotation21 * _this1._invLocalInertia10 + _this1._transform._rotation22 * _this1._invLocalInertia20; + __tmp__212 = _this1._transform._rotation20 * _this1._invLocalInertia01 + _this1._transform._rotation21 * _this1._invLocalInertia11 + _this1._transform._rotation22 * _this1._invLocalInertia21; + __tmp__222 = _this1._transform._rotation20 * _this1._invLocalInertia02 + _this1._transform._rotation21 * _this1._invLocalInertia12 + _this1._transform._rotation22 * _this1._invLocalInertia22; + _this1._invInertia00 = __tmp__002; + _this1._invInertia01 = __tmp__012; + _this1._invInertia02 = __tmp__022; + _this1._invInertia10 = __tmp__102; + _this1._invInertia11 = __tmp__112; + _this1._invInertia12 = __tmp__122; + _this1._invInertia20 = __tmp__202; + _this1._invInertia21 = __tmp__212; + _this1._invInertia22 = __tmp__222; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; + __tmp__003 = _this1._invInertia00 * _this1._transform._rotation00 + _this1._invInertia01 * _this1._transform._rotation01 + _this1._invInertia02 * _this1._transform._rotation02; + __tmp__013 = _this1._invInertia00 * _this1._transform._rotation10 + _this1._invInertia01 * _this1._transform._rotation11 + _this1._invInertia02 * _this1._transform._rotation12; + __tmp__023 = _this1._invInertia00 * _this1._transform._rotation20 + _this1._invInertia01 * _this1._transform._rotation21 + _this1._invInertia02 * _this1._transform._rotation22; + __tmp__103 = _this1._invInertia10 * _this1._transform._rotation00 + _this1._invInertia11 * _this1._transform._rotation01 + _this1._invInertia12 * _this1._transform._rotation02; + __tmp__113 = _this1._invInertia10 * _this1._transform._rotation10 + _this1._invInertia11 * _this1._transform._rotation11 + _this1._invInertia12 * _this1._transform._rotation12; + __tmp__123 = _this1._invInertia10 * _this1._transform._rotation20 + _this1._invInertia11 * _this1._transform._rotation21 + _this1._invInertia12 * _this1._transform._rotation22; + __tmp__203 = _this1._invInertia20 * _this1._transform._rotation00 + _this1._invInertia21 * _this1._transform._rotation01 + _this1._invInertia22 * _this1._transform._rotation02; + __tmp__213 = _this1._invInertia20 * _this1._transform._rotation10 + _this1._invInertia21 * _this1._transform._rotation11 + _this1._invInertia22 * _this1._transform._rotation12; + __tmp__223 = _this1._invInertia20 * _this1._transform._rotation20 + _this1._invInertia21 * _this1._transform._rotation21 + _this1._invInertia22 * _this1._transform._rotation22; + _this1._invInertia00 = __tmp__003; + _this1._invInertia01 = __tmp__013; + _this1._invInertia02 = __tmp__023; + _this1._invInertia10 = __tmp__103; + _this1._invInertia11 = __tmp__113; + _this1._invInertia12 = __tmp__123; + _this1._invInertia20 = __tmp__203; + _this1._invInertia21 = __tmp__213; + _this1._invInertia22 = __tmp__223; + _this1._invInertia00 *= _this1._rotFactor.x; + _this1._invInertia01 *= _this1._rotFactor.x; + _this1._invInertia02 *= _this1._rotFactor.x; + _this1._invInertia10 *= _this1._rotFactor.y; + _this1._invInertia11 *= _this1._rotFactor.y; + _this1._invInertia12 *= _this1._rotFactor.y; + _this1._invInertia20 *= _this1._rotFactor.z; + _this1._invInertia21 *= _this1._rotFactor.z; + _this1._invInertia22 *= _this1._rotFactor.z; + } + let _this = this.posBoundarySelector; + let i = 0; + while(_this.indices[i] != idx) ++i; + while(i > 0) { + let tmp = _this.indices[i]; + _this.indices[i] = _this.indices[i - 1]; + _this.indices[i - 1] = tmp; + --i; } solved = true; break; @@ -30132,167 +30361,167 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ return; } } - ,postSolve: function() { + postSolve() { this.joint._syncAnchors(); this.joint._checkDestruction(); } -}); -var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { - this._size = size; - this.tmpMatrix = new Array(this._size); - this._invMass = new Array(this._size); - this._invMassWithoutCfm = new Array(this._size); - var _g = 0; - var _g1 = this._size; - while(_g < _g1) { - var i = _g++; - this.tmpMatrix[i] = new Array(this._size); - this._invMass[i] = new Array(this._size); - this._invMassWithoutCfm[i] = new Array(this._size); - var _g2 = 0; - var _g11 = this._size; - while(_g2 < _g11) { - var j = _g2++; - this.tmpMatrix[i][j] = 0; - this._invMass[i][j] = 0; - this._invMassWithoutCfm[i][j] = 0; - } - } - this._maxSubmatrixId = 1 << this._size; - this._cacheComputed = new Array(this._maxSubmatrixId); - this._cachedSubmatrices = new Array(this._maxSubmatrixId); - var _g21 = 0; - var _g3 = this._maxSubmatrixId; - while(_g21 < _g3) { - var i1 = _g21++; - var t = i1; - t = (i1 & 85) + (i1 >> 1 & 85); - t = (t & 51) + (t >> 2 & 51); - t = (t & 15) + (t >> 4 & 15); - var matrixSize = t; - var subMatrix = new Array(matrixSize); - var _g22 = 0; - while(_g22 < matrixSize) { - var j1 = _g22++; - subMatrix[j1] = new Array(matrixSize); - var _g23 = 0; - while(_g23 < matrixSize) subMatrix[j1][_g23++] = 0; - } - this._cacheComputed[i1] = false; - this._cachedSubmatrices[i1] = subMatrix; - } -}; -oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { - computeSubmatrix: function(id,indices,size) { - var _g = 0; +} +class oimo_dynamics_constraint_solver_direct_MassMatrix { + constructor(size) { + this._size = size; + this.tmpMatrix = new Array(this._size); + this._invMass = new Array(this._size); + this._invMassWithoutCfm = new Array(this._size); + let _g = 0; + let _g1 = this._size; + while(_g < _g1) { + let i = _g++; + this.tmpMatrix[i] = new Array(this._size); + this._invMass[i] = new Array(this._size); + this._invMassWithoutCfm[i] = new Array(this._size); + let _g1 = 0; + let _g2 = this._size; + while(_g1 < _g2) { + let j = _g1++; + this.tmpMatrix[i][j] = 0; + this._invMass[i][j] = 0; + this._invMassWithoutCfm[i][j] = 0; + } + } + this._maxSubmatrixId = 1 << this._size; + this._cacheComputed = new Array(this._maxSubmatrixId); + this._cachedSubmatrices = new Array(this._maxSubmatrixId); + let _g2 = 0; + let _g3 = this._maxSubmatrixId; + while(_g2 < _g3) { + let i = _g2++; + let t = i; + t = (i & 85) + (i >> 1 & 85); + t = (t & 51) + (t >> 2 & 51); + t = (t & 15) + (t >> 4 & 15); + let matrixSize = t; + let subMatrix = new Array(matrixSize); + let _g = 0; + while(_g < matrixSize) { + let j = _g++; + subMatrix[j] = new Array(matrixSize); + let _g1 = 0; + while(_g1 < matrixSize) subMatrix[j][_g1++] = 0; + } + this._cacheComputed[i] = false; + this._cachedSubmatrices[i] = subMatrix; + } + } + computeSubmatrix(id,indices,size) { + let _g = 0; while(_g < size) { - var i = _g++; - var ii = indices[i]; - var _g1 = 0; + let i = _g++; + let ii = indices[i]; + let _g1 = 0; while(_g1 < size) { - var j = _g1++; + let j = _g1++; this.tmpMatrix[i][j] = this._invMass[ii][indices[j]]; } } - var src = this.tmpMatrix; - var dst = this._cachedSubmatrices[id]; - var srci; - var dsti; - var srcj; - var dstj; - var diag; + let src = this.tmpMatrix; + let dst = this._cachedSubmatrices[id]; + let srci; + let dsti; + let srcj; + let dstj; + let diag; switch(size) { case 4: srci = src[0]; dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -30308,162 +30537,162 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -30484,261 +30713,261 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[5]; dstj = dst[5]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dstj[4] = -diag * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srci = src[5]; dsti = dst[5]; diag = 1 / srci[5]; dsti[5] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - dsti[4] = dsti[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + dsti[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; - dstj[4] = dstj[4] - dsti[4] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; + dstj[4] -= dsti[4] * srcj[5]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -30761,96 +30990,90 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dst[4][5] = dsti[4]; break; default: - var _g2 = 0; - while(_g2 < size) { - var i1 = _g2++; - srci = src[i1]; - dsti = dst[i1]; - var diag1 = 1 / srci[i1]; - dsti[i1] = diag1; - var _g21 = 0; - while(_g21 < i1) { - var j1 = _g21++; - dsti[j1] = dsti[j1] * diag1; - } - var _g4 = i1 + 1; - while(_g4 < size) { - var j2 = _g4++; - srci[j2] = srci[j2] * diag1; - } - var _g6 = 0; - while(_g6 < i1) { - var j3 = _g6++; - srcj = src[j3]; - dstj = dst[j3]; - var _g61 = 0; - var _g7 = j3 + 1; - while(_g61 < _g7) { - var k = _g61++; - dstj[k] = dstj[k] - dsti[k] * srcj[i1]; + let _g1 = 0; + while(_g1 < size) { + let i = _g1++; + srci = src[i]; + dsti = dst[i]; + let diag = 1 / srci[i]; + dsti[i] = diag; + let _g = 0; + while(_g < i) dsti[_g++] *= diag; + let _g2 = i + 1; + while(_g2 < size) srci[_g2++] *= diag; + let _g3 = 0; + while(_g3 < i) { + let j = _g3++; + srcj = src[j]; + dstj = dst[j]; + let _g = 0; + let _g1 = j + 1; + while(_g < _g1) { + let k = _g++; + dstj[k] -= dsti[k] * srcj[i]; } - var _g8 = i1 + 1; - while(_g8 < size) { - var k1 = _g8++; - srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; + let _g2 = i + 1; + while(_g2 < size) { + let k = _g2++; + srcj[k] -= srci[k] * srcj[i]; } } - var _g81 = i1 + 1; - while(_g81 < size) { - var j4 = _g81++; - srcj = src[j4]; - dstj = dst[j4]; - var _g82 = 0; - while(_g82 < i1) { - var k2 = _g82++; - dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; + let _g4 = i + 1; + while(_g4 < size) { + let j = _g4++; + srcj = src[j]; + dstj = dst[j]; + let _g = 0; + while(_g < i) { + let k = _g++; + dstj[k] -= dsti[k] * srcj[i]; } - dstj[i1] = -diag1 * srcj[i1]; - var _g10 = i1 + 1; - while(_g10 < size) { - var k3 = _g10++; - srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; + dstj[i] = -diag * srcj[i]; + let _g1 = i + 1; + while(_g1 < size) { + let k = _g1++; + srcj[k] -= srci[k] * srcj[i]; } } } - var _g41 = 1; - while(_g41 < size) { - var i2 = _g41++; - dsti = dst[i2]; - var _g42 = 0; - while(_g42 < i2) { - var j5 = _g42++; - dst[j5][i2] = dsti[j5]; - } - } - } - } - ,computeInvMass: function(info,massData) { - var invMass = this._invMass; - var invMassWithoutCfm = this._invMassWithoutCfm; - var numRows = info.numRows; - var b1 = info.b1; - var b2 = info.b2; - var invM1 = b1._invMass; - var invM2 = b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let _g2 = 1; + while(_g2 < size) { + let i = _g2++; + dsti = dst[i]; + let _g = 0; + while(_g < i) { + let j = _g++; + dst[j][i] = dsti[j]; + } + } + } + } + computeInvMass(info,massData) { + let invMass = this._invMass; + let invMassWithoutCfm = this._invMassWithoutCfm; + let numRows = info.numRows; + let b1 = info.b1; + let b2 = info.b2; + let invM1 = b1._invMass; + let invM2 = b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = b1._invInertia00; invI101 = b1._invInertia01; invI102 = b1._invInertia02; @@ -30869,11 +31092,11 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { invI220 = b2._invInertia20; invI221 = b2._invInertia21; invI222 = b2._invInertia22; - var _g = 0; + let _g = 0; while(_g < numRows) { - var i = _g++; - var j = info.rows[i].jacobian; - var md = massData[i]; + let i = _g++; + let j = info.rows[i].jacobian; + let md = massData[i]; j.updateSparsity(); if((j.flag & 1) != 0) { md.invMLin1X = j.lin1X * invM1; @@ -30891,18 +31114,18 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md.invMLin2Z = 0; } if((j.flag & 2) != 0) { - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -30918,19 +31141,19 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md.invMAng2Z = 0; } } - var _g2 = 0; - while(_g2 < numRows) { - var i1 = _g2++; - var j1 = info.rows[i1].jacobian; - var _g21 = i1; - while(_g21 < numRows) { - var j2 = _g21++; - var md2 = massData[j2]; - var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); - if(i1 == j2) { - invMass[i1][j2] = val + info.rows[i1].cfm; - invMassWithoutCfm[i1][j2] = val; - md2.mass = val + info.rows[i1].cfm; + let _g1 = 0; + while(_g1 < numRows) { + let i = _g1++; + let j1 = info.rows[i].jacobian; + let _g = i; + while(_g < numRows) { + let j = _g++; + let md2 = massData[j]; + let val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); + if(i == j) { + invMass[i][j] = val + info.rows[i].cfm; + invMassWithoutCfm[i][j] = val; + md2.mass = val + info.rows[i].cfm; md2.massWithoutCfm = val; if(md2.mass != 0) { md2.mass = 1 / md2.mass; @@ -30939,53 +31162,52 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md2.massWithoutCfm = 1 / md2.massWithoutCfm; } } else { - invMass[i1][j2] = val; - invMass[j2][i1] = val; - invMassWithoutCfm[i1][j2] = val; - invMassWithoutCfm[j2][i1] = val; - } - } - } - var _g1 = 0; - var _g11 = this._maxSubmatrixId; - while(_g1 < _g11) this._cacheComputed[_g1++] = false; - } -}; -var oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver = function(constraint) { - oimo_dynamics_constraint_ConstraintSolver.call(this); - this.constraint = constraint; - this.info = new oimo_dynamics_constraint_info_contact_ContactSolverInfo(); - this.massData = new Array(oimo_common_Setting.maxManifoldPoints); - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow(); -}; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; -oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ - preSolveVelocity: function(timeStep) { + invMass[i][j] = val; + invMass[j][i] = val; + invMassWithoutCfm[i][j] = val; + invMassWithoutCfm[j][i] = val; + } + } + } + let _g2 = 0; + let _g3 = this._maxSubmatrixId; + while(_g2 < _g3) this._cacheComputed[_g2++] = false; + } +} +class oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver extends oimo_dynamics_constraint_ConstraintSolver { + constructor(constraint) { + super(); + this.constraint = constraint; + this.info = new oimo_dynamics_constraint_info_contact_ContactSolverInfo(); + this.massData = new Array(oimo_common_Setting.maxManifoldPoints); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_ContactSolverMassDataRow(); + } + preSolveVelocity(timeStep) { this.constraint._getVelocitySolverInfo(timeStep,this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -31004,31 +31226,31 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobianN; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let j = row.jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -31039,8 +31261,8 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte if(md.massN != 0) { md.massN = 1 / md.massN; } - var jt = row.jacobianT; - var jb = row.jacobianB; + let jt = row.jacobianT; + let jb = row.jacobianB; md.invMLinT1X = jt.lin1X * invM1; md.invMLinT1Y = jt.lin1Y * invM1; md.invMLinT1Z = jt.lin1Z * invM1; @@ -31053,46 +31275,46 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.invMLinB2X = jb.lin2X * invM2; md.invMLinB2Y = jb.lin2Y * invM2; md.invMLinB2Z = jb.lin2Z * invM2; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; + let __tmp__X2; + let __tmp__Y2; + let __tmp__Z2; __tmp__X2 = invI100 * jt.ang1X + invI101 * jt.ang1Y + invI102 * jt.ang1Z; __tmp__Y2 = invI110 * jt.ang1X + invI111 * jt.ang1Y + invI112 * jt.ang1Z; __tmp__Z2 = invI120 * jt.ang1X + invI121 * jt.ang1Y + invI122 * jt.ang1Z; md.invMAngT1X = __tmp__X2; md.invMAngT1Y = __tmp__Y2; md.invMAngT1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; + let __tmp__X3; + let __tmp__Y3; + let __tmp__Z3; __tmp__X3 = invI200 * jt.ang2X + invI201 * jt.ang2Y + invI202 * jt.ang2Z; __tmp__Y3 = invI210 * jt.ang2X + invI211 * jt.ang2Y + invI212 * jt.ang2Z; __tmp__Z3 = invI220 * jt.ang2X + invI221 * jt.ang2Y + invI222 * jt.ang2Z; md.invMAngT2X = __tmp__X3; md.invMAngT2Y = __tmp__Y3; md.invMAngT2Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; + let __tmp__X4; + let __tmp__Y4; + let __tmp__Z4; __tmp__X4 = invI100 * jb.ang1X + invI101 * jb.ang1Y + invI102 * jb.ang1Z; __tmp__Y4 = invI110 * jb.ang1X + invI111 * jb.ang1Y + invI112 * jb.ang1Z; __tmp__Z4 = invI120 * jb.ang1X + invI121 * jb.ang1Y + invI122 * jb.ang1Z; md.invMAngB1X = __tmp__X4; md.invMAngB1Y = __tmp__Y4; md.invMAngB1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; + let __tmp__X5; + let __tmp__Y5; + let __tmp__Z5; __tmp__X5 = invI200 * jb.ang2X + invI201 * jb.ang2Y + invI202 * jb.ang2Z; __tmp__Y5 = invI210 * jb.ang2X + invI211 * jb.ang2Y + invI212 * jb.ang2Z; __tmp__Z5 = invI220 * jb.ang2X + invI221 * jb.ang2Y + invI222 * jb.ang2Z; md.invMAngB2X = __tmp__X5; md.invMAngB2Y = __tmp__Y5; md.invMAngB2Z = __tmp__Z5; - var invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); - var invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); - var invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); - var invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB01; + let invMassTB00 = invM1 + invM2 + (md.invMAngT1X * jt.ang1X + md.invMAngT1Y * jt.ang1Y + md.invMAngT1Z * jt.ang1Z) + (md.invMAngT2X * jt.ang2X + md.invMAngT2Y * jt.ang2Y + md.invMAngT2Z * jt.ang2Z); + let invMassTB01 = md.invMAngT1X * jb.ang1X + md.invMAngT1Y * jb.ang1Y + md.invMAngT1Z * jb.ang1Z + (md.invMAngT2X * jb.ang2X + md.invMAngT2Y * jb.ang2Y + md.invMAngT2Z * jb.ang2Z); + let invMassTB11 = invM1 + invM2 + (md.invMAngB1X * jb.ang1X + md.invMAngB1Y * jb.ang1Y + md.invMAngB1Z * jb.ang1Z) + (md.invMAngB2X * jb.ang2X + md.invMAngB2Y * jb.ang2Y + md.invMAngB2Z * jb.ang2Z); + let invDet = invMassTB00 * invMassTB11 - invMassTB01 * invMassTB01; if(invDet != 0) { invDet = 1 / invDet; } @@ -31102,19 +31324,19 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massTB11 = invMassTB00 * invDet; } } - ,warmStart: function(timeStep) { - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + warmStart(timeStep) { + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -31127,18 +31349,18 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var imp = row.impulse; - var md = this.massData[i]; - var jt = row.jacobianT; - var jb = row.jacobianB; - var impulseN = imp.impulseN; - var impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; - var impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; + let i = _g++; + let row = this.info.rows[i]; + let imp = row.impulse; + let md = this.massData[i]; + let jt = row.jacobianT; + let jb = row.jacobianB; + let impulseN = imp.impulseN; + let impulseT = imp.impulseLX * jt.lin1X + imp.impulseLY * jt.lin1Y + imp.impulseLZ * jt.lin1Z; + let impulseB = imp.impulseLX * jb.lin1X + imp.impulseLY * jb.lin1Y + imp.impulseLZ * jb.lin1Z; imp.impulseT = impulseT; imp.impulseB = impulseB; imp.impulseN *= timeStep.dtRatio; @@ -31194,19 +31416,19 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2._angVelY = av2Y; this._b2._angVelZ = av2Z; } - ,solveVelocity: function() { - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + solveVelocity() { + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -31219,39 +31441,39 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var rvt = 0; - var j = row.jacobianT; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let rvt = 0; + let j = row.jacobianT; rvt += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvt -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvt += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvt -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var rvb = 0; + let rvb = 0; j = row.jacobianB; rvb += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvb -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvb += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvb -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); - var impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); - var oldImpulseT = imp.impulseT; - var oldImpulseB = imp.impulseB; + let impulseT = -(rvt * md.massTB00 + rvb * md.massTB01); + let impulseB = -(rvt * md.massTB10 + rvb * md.massTB11); + let oldImpulseT = imp.impulseT; + let oldImpulseB = imp.impulseB; imp.impulseT += impulseT; imp.impulseB += impulseB; - var maxImpulse = row.friction * imp.impulseN; + let maxImpulse = row.friction * imp.impulseN; if(maxImpulse == 0) { imp.impulseT = 0; imp.impulseB = 0; } else { - var impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; + let impulseLengthSq = imp.impulseT * imp.impulseT + imp.impulseB * imp.impulseB; if(impulseLengthSq > maxImpulse * maxImpulse) { - var invL = maxImpulse / Math.sqrt(impulseLengthSq); + let invL = maxImpulse / Math.sqrt(impulseLengthSq); imp.impulseT *= invL; imp.impulseB *= invL; } @@ -31283,38 +31505,38 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2Y += md.invMAngB2Y * -impulseB; av2Z += md.invMAngB2Z * -impulseB; } - var _g2 = 0; - var _g3 = this.info.numRows; + let _g2 = 0; + let _g3 = this.info.numRows; while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var rvn = 0; - var j1 = row1.jacobianN; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseN = (row1.rhs - rvn) * md1.massN; - var oldImpulseN = imp1.impulseN; - imp1.impulseN += impulseN; - if(imp1.impulseN < 0) { - imp1.impulseN = 0; - } - impulseN = imp1.impulseN - oldImpulseN; - lv1X += md1.invMLinN1X * impulseN; - lv1Y += md1.invMLinN1Y * impulseN; - lv1Z += md1.invMLinN1Z * impulseN; - lv2X += md1.invMLinN2X * -impulseN; - lv2Y += md1.invMLinN2Y * -impulseN; - lv2Z += md1.invMLinN2Z * -impulseN; - av1X += md1.invMAngN1X * impulseN; - av1Y += md1.invMAngN1Y * impulseN; - av1Z += md1.invMAngN1Z * impulseN; - av2X += md1.invMAngN2X * -impulseN; - av2Y += md1.invMAngN2Y * -impulseN; - av2Z += md1.invMAngN2Z * -impulseN; + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let rvn = 0; + let j = row.jacobianN; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseN = (row.rhs - rvn) * md.massN; + let oldImpulseN = imp.impulseN; + imp.impulseN += impulseN; + if(imp.impulseN < 0) { + imp.impulseN = 0; + } + impulseN = imp.impulseN - oldImpulseN; + lv1X += md.invMLinN1X * impulseN; + lv1Y += md.invMLinN1Y * impulseN; + lv1Z += md.invMLinN1Z * impulseN; + lv2X += md.invMLinN2X * -impulseN; + lv2Y += md.invMLinN2Y * -impulseN; + lv2Z += md.invMLinN2Z * -impulseN; + av1X += md.invMAngN1X * impulseN; + av1Y += md.invMAngN1Y * impulseN; + av1Z += md.invMAngN1Z * impulseN; + av2X += md.invMAngN2X * -impulseN; + av2Y += md.invMAngN2Y * -impulseN; + av2Z += md.invMAngN2Z * -impulseN; } this._b1._velX = lv1X; this._b1._velY = lv1Y; @@ -31329,29 +31551,29 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2._angVelY = av2Y; this._b2._angVelZ = av2Z; } - ,preSolvePosition: function(timeStep) { + preSolvePosition(timeStep) { this.constraint._syncManifold(); this.constraint._getPositionSolverInfo(this.info); - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -31370,30 +31592,30 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var md = this.massData[i]; - var j = this.info.rows[i].jacobianN; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -31405,23 +31627,23 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massN = 1 / md.massN; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; - } - ,solvePositionSplitImpulse: function() { - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; + } + solvePositionSplitImpulse() { + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -31434,21 +31656,21 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobianN; - var rvn = 0; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobianN; + let rvn = 0; rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseP = (row.rhs - rvn) * md.massN * oimo_common_Setting.positionSplitImpulseBaumgarte; - var oldImpulseP = imp.impulseP; + let impulseP = (row.rhs - rvn) * md.massN * oimo_common_Setting.positionSplitImpulseBaumgarte; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { imp.impulseP = 0; @@ -31480,29 +31702,29 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2._angPseudoVelY = av2Y; this._b2._angPseudoVelZ = av2Z; } - ,solvePositionNgs: function(timeStep) { + solvePositionNgs(timeStep) { this.constraint._syncManifold(); this.constraint._getPositionSolverInfo(this.info); - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -31521,30 +31743,30 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var md = this.massData[i]; - var j = this.info.rows[i].jacobianN; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobianN; md.invMLinN1X = j.lin1X * invM1; md.invMLinN1Y = j.lin1Y * invM1; md.invMLinN1Z = j.lin1Z * invM1; md.invMLinN2X = j.lin2X * invM2; md.invMLinN2Y = j.lin2Y * invM2; md.invMLinN2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAngN1X = __tmp__X; md.invMAngN1Y = __tmp__Y; md.invMAngN1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -31556,18 +31778,18 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massN = 1 / md.massN; } } - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -31580,83 +31802,83 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp = row.impulse; - var j1 = row.jacobianN; - var rvn = 0; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row.rhs - rvn) * md1.massN * oimo_common_Setting.positionNgsBaumgarte; - var oldImpulseP = imp.impulseP; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobianN; + let rvn = 0; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseP = (row.rhs - rvn) * md.massN * oimo_common_Setting.positionNgsBaumgarte; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { imp.impulseP = 0; } impulseP = imp.impulseP - oldImpulseP; - lv1X += md1.invMLinN1X * impulseP; - lv1Y += md1.invMLinN1Y * impulseP; - lv1Z += md1.invMLinN1Z * impulseP; - lv2X += md1.invMLinN2X * -impulseP; - lv2Y += md1.invMLinN2Y * -impulseP; - lv2Z += md1.invMLinN2Z * -impulseP; - av1X += md1.invMAngN1X * impulseP; - av1Y += md1.invMAngN1Y * impulseP; - av1Z += md1.invMAngN1Z * impulseP; - av2X += md1.invMAngN2X * -impulseP; - av2Y += md1.invMAngN2Y * -impulseP; - av2Z += md1.invMAngN2Z * -impulseP; - } - var _this = this._b1; + lv1X += md.invMLinN1X * impulseP; + lv1Y += md.invMLinN1Y * impulseP; + lv1Z += md.invMLinN1Z * impulseP; + lv2X += md.invMLinN2X * -impulseP; + lv2Y += md.invMLinN2Y * -impulseP; + lv2Z += md.invMLinN2Z * -impulseP; + av1X += md.invMAngN1X * impulseP; + av1Y += md.invMAngN1Y * impulseP; + av1Z += md.invMAngN1Z * impulseP; + av2X += md.invMAngN2X * -impulseP; + av2Y += md.invMAngN2Y * -impulseP; + av2Z += md.invMAngN2Z * -impulseP; + } + let _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; + let _this1 = this._b2; _this1._transform._positionX += lv2X; _this1._transform._positionY += lv2Y; _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this2 = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; + let ht2 = halfTheta * halfTheta; rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this2._transform._rotation00; + let e11 = _this2._transform._rotation11; + let e22 = _this2._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -31699,7 +31921,7 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -31707,22 +31929,22 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this2._transform._rotation00 = 1 - yy - zz; _this2._transform._rotation01 = xy - wz; _this2._transform._rotation02 = xz + wy; @@ -31732,15 +31954,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this2._transform._rotation20 = xz - wy; _this2._transform._rotation21 = yz + wx; _this2._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; @@ -31759,15 +31981,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this2._invInertia20 = __tmp__20; _this2._invInertia21 = __tmp__21; _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; @@ -31795,42 +32017,42 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this2._invInertia20 *= _this2._rotFactor.z; _this2._invInertia21 *= _this2._rotFactor.z; _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let _this3 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this3._transform._rotation00; + let e111 = _this3._transform._rotation11; + let e221 = _this3._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; @@ -31873,7 +32095,7 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -31881,22 +32103,22 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; _this3._transform._rotation00 = 1 - yy1 - zz1; _this3._transform._rotation01 = xy1 - wz1; _this3._transform._rotation02 = xz1 + wy1; @@ -31906,15 +32128,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this3._transform._rotation20 = xz1 - wy1; _this3._transform._rotation21 = yz1 + wx1; _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; @@ -31933,15 +32155,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this3._invInertia20 = __tmp__202; _this3._invInertia21 = __tmp__212; _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; @@ -31970,16 +32192,16 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte _this3._invInertia21 *= _this3._rotFactor.z; _this3._invInertia22 *= _this3._rotFactor.z; } - ,postSolve: function() { - var lin1X; - var lin1Y; - var lin1Z; - var ang1X; - var ang1Y; - var ang1Z; - var ang2X; - var ang2Y; - var ang2Z; + postSolve() { + let lin1X; + let lin1Y; + let lin1Z; + let ang1X; + let ang1Y; + let ang1Z; + let ang2X; + let ang2Y; + let ang2Z; lin1X = 0; lin1Y = 0; lin1Z = 0; @@ -31989,20 +32211,20 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte ang2X = 0; ang2Y = 0; ang2Z = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var row = this.info.rows[_g++]; - var imp = row.impulse; - var jn = row.jacobianN; - var jt = row.jacobianT; - var jb = row.jacobianB; - var impN = imp.impulseN; - var impT = imp.impulseT; - var impB = imp.impulseB; - var impulseLX; - var impulseLY; - var impulseLZ; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let jn = row.jacobianN; + let jt = row.jacobianT; + let jb = row.jacobianB; + let impN = imp.impulseN; + let impT = imp.impulseT; + let impB = imp.impulseB; + let impulseLX; + let impulseLY; + let impulseLZ; impulseLX = 0; impulseLY = 0; impulseLZ = 0; @@ -32057,43 +32279,42 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte this._b2._angularContactImpulseZ -= ang2Z; this.constraint._syncManifold(); } -}); -var oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver = function(joint) { - oimo_dynamics_constraint_ConstraintSolver.call(this); - this.joint = joint; - this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); - this.massData = new Array(oimo_common_Setting.maxJacobianRows); - var _g = 0; - var _g1 = this.massData.length; - while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); -}; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.__super__ = oimo_dynamics_constraint_ConstraintSolver; -oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend(oimo_dynamics_constraint_ConstraintSolver.prototype,{ - preSolveVelocity: function(timeStep) { +} +class oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver extends oimo_dynamics_constraint_ConstraintSolver { + constructor(joint) { + super(); + this.joint = joint; + this.info = new oimo_dynamics_constraint_info_joint_JointSolverInfo(); + this.massData = new Array(oimo_common_Setting.maxJacobianRows); + let _g = 0; + let _g1 = this.massData.length; + while(_g < _g1) this.massData[_g++] = new oimo_dynamics_constraint_solver_common_JointSolverMassDataRow(); + } + preSolveVelocity(timeStep) { this.joint._syncAnchors(); this.joint._getVelocitySolverInfo(timeStep,this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -32112,13 +32333,13 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var j = row.jacobian; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let j = row.jacobian; j.updateSparsity(); if((j.flag & 1) != 0) { md.invMLin1X = j.lin1X * invM1; @@ -32136,18 +32357,18 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.invMLin2Z = 0; } if((j.flag & 2) != 0) { - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -32172,32 +32393,32 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend } } } - ,warmStart: function(timeStep) { - var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; + warmStart(timeStep) { + let factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; factor *= timeStep.dtRatio; if(factor <= 0) { - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var _this = this.info.rows[_g++].impulse; + let _this = this.info.rows[_g++].impulse; _this.impulse = 0; _this.impulseM = 0; _this.impulseP = 0; } return; } - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -32210,15 +32431,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i = _g2++; - var md = this.massData[i]; - var imp = this.info.rows[i].impulse; + let _g = 0; + let _g1 = this.info.numRows; + while(_g < _g1) { + let i = _g++; + let md = this.massData[i]; + let imp = this.info.rows[i].impulse; imp.impulse *= factor; imp.impulseM *= factor; - var impulse = imp.impulse + imp.impulseM; + let impulse = imp.impulse + imp.impulseM; lv1X += md.invMLin1X * impulse; lv1Y += md.invMLin1Y * impulse; lv1Z += md.invMLin1Z * impulse; @@ -32245,19 +32466,19 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2._angVelY = av2Y; this._b2._angVelZ = av2Z; } - ,solveVelocity: function() { - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + solveVelocity() { + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._velX; lv1Y = this._b1._velY; lv1Z = this._b1._velZ; @@ -32270,24 +32491,24 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; if(row.motorMaxImpulse == 0) { continue; } - var rv = 0; + let rv = 0; rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; - var oldImpulseM = imp.impulseM; + let impulseM = (-row.motorSpeed - rv) * md.massWithoutCfm; + let oldImpulseM = imp.impulseM; imp.impulseM += impulseM; if(imp.impulseM < -row.motorMaxImpulse) { imp.impulseM = -row.motorMaxImpulse; @@ -32312,43 +32533,43 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2Z += md.invMAng2Z * -impulseM; } } - var _g2 = 0; - var _g3 = this.info.numRows; + let _g2 = 0; + let _g3 = this.info.numRows; while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var j1 = row1.jacobian; - var rv1 = 0; - rv1 += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv1 -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv1 += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv1 -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulse = (row1.rhs - rv1 - imp1.impulse * row1.cfm) * md1.mass; - var oldImpulse = imp1.impulse; - imp1.impulse += impulse; - if(imp1.impulse < row1.minImpulse) { - imp1.impulse = row1.minImpulse; - } else if(imp1.impulse > row1.maxImpulse) { - imp1.impulse = row1.maxImpulse; - } - impulse = imp1.impulse - oldImpulse; - if((j1.flag & 1) != 0) { - lv1X += md1.invMLin1X * impulse; - lv1Y += md1.invMLin1Y * impulse; - lv1Z += md1.invMLin1Z * impulse; - lv2X += md1.invMLin2X * -impulse; - lv2Y += md1.invMLin2Y * -impulse; - lv2Z += md1.invMLin2Z * -impulse; - } - if((j1.flag & 2) != 0) { - av1X += md1.invMAng1X * impulse; - av1Y += md1.invMAng1Y * impulse; - av1Z += md1.invMAng1Z * impulse; - av2X += md1.invMAng2X * -impulse; - av2Y += md1.invMAng2Y * -impulse; - av2Z += md1.invMAng2Z * -impulse; + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulse = (row.rhs - rv - imp.impulse * row.cfm) * md.mass; + let oldImpulse = imp.impulse; + imp.impulse += impulse; + if(imp.impulse < row.minImpulse) { + imp.impulse = row.minImpulse; + } else if(imp.impulse > row.maxImpulse) { + imp.impulse = row.maxImpulse; + } + impulse = imp.impulse - oldImpulse; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * impulse; + lv1Y += md.invMLin1Y * impulse; + lv1Z += md.invMLin1Z * impulse; + lv2X += md.invMLin2X * -impulse; + lv2Y += md.invMLin2Y * -impulse; + lv2Z += md.invMLin2Z * -impulse; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * impulse; + av1Y += md.invMAng1Y * impulse; + av1Z += md.invMAng1Z * impulse; + av2X += md.invMAng2X * -impulse; + av2Y += md.invMAng2Y * -impulse; + av2Z += md.invMAng2Z * -impulse; } } this._b1._velX = lv1X; @@ -32364,25 +32585,25 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2._angVelY = av2Y; this._b2._angVelZ = av2Z; } - ,postSolveVelocity: function(timeStep) { - var linX; - var linY; - var linZ; - var angX; - var angY; - var angZ; + postSolveVelocity(timeStep) { + let linX; + let linY; + let linZ; + let angX; + let angY; + let angZ; linX = 0; linY = 0; linZ = 0; angX = 0; angY = 0; angZ = 0; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var row = this.info.rows[_g++]; - var imp = row.impulse; - var j = row.jacobian; + let row = this.info.rows[_g++]; + let imp = row.impulse; + let j = row.jacobian; if((j.flag & 1) != 0) { linX += j.lin1X * imp.impulse; linY += j.lin1Y * imp.impulse; @@ -32400,31 +32621,31 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this.joint._appliedTorqueY = angY * timeStep.invDt; this.joint._appliedTorqueZ = angZ * timeStep.invDt; } - ,preSolvePosition: function(timeStep) { + preSolvePosition(timeStep) { this.joint._syncAnchors(); this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -32443,30 +32664,30 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var md = this.massData[i]; - var j = this.info.rows[i].jacobian; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; md.invMLin2X = j.lin2X * invM2; md.invMLin2Y = j.lin2Y * invM2; md.invMLin2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -32478,23 +32699,23 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.mass = 1 / md.mass; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; - } - ,solvePositionSplitImpulse: function() { - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) this.info.rows[_g2++].impulse.impulseP = 0; + } + solvePositionSplitImpulse() { + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = this._b1._pseudoVelX; lv1Y = this._b1._pseudoVelY; lv1Z = this._b1._pseudoVelZ; @@ -32507,21 +32728,21 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angPseudoVelX; av2Y = this._b2._angPseudoVelY; av2Z = this._b2._angPseudoVelZ; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var row = this.info.rows[i]; - var md = this.massData[i]; - var imp = row.impulse; - var j = row.jacobian; - var rv = 0; + let i = _g++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; - var impulseP = (row.rhs * oimo_common_Setting.positionSplitImpulseBaumgarte - rv) * md.mass; - var oldImpulseP = imp.impulseP; + let impulseP = (row.rhs * oimo_common_Setting.positionSplitImpulseBaumgarte - rv) * md.mass; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < row.minImpulse) { imp.impulseP = row.minImpulse; @@ -32555,31 +32776,31 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend this._b2._angPseudoVelY = av2Y; this._b2._angPseudoVelZ = av2Z; } - ,solvePositionNgs: function(timeStep) { + solvePositionNgs(timeStep) { this.joint._syncAnchors(); this.joint._getPositionSolverInfo(this.info); this._b1 = this.info.b1; this._b2 = this.info.b2; - var invM1 = this._b1._invMass; - var invM2 = this._b2._invMass; - var invI100; - var invI101; - var invI102; - var invI110; - var invI111; - var invI112; - var invI120; - var invI121; - var invI122; - var invI200; - var invI201; - var invI202; - var invI210; - var invI211; - var invI212; - var invI220; - var invI221; - var invI222; + let invM1 = this._b1._invMass; + let invM2 = this._b2._invMass; + let invI100; + let invI101; + let invI102; + let invI110; + let invI111; + let invI112; + let invI120; + let invI121; + let invI122; + let invI200; + let invI201; + let invI202; + let invI210; + let invI211; + let invI212; + let invI220; + let invI221; + let invI222; invI100 = this._b1._invInertia00; invI101 = this._b1._invInertia01; invI102 = this._b1._invInertia02; @@ -32598,30 +32819,30 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend invI220 = this._b2._invInertia20; invI221 = this._b2._invInertia21; invI222 = this._b2._invInertia22; - var _g = 0; - var _g1 = this.info.numRows; + let _g = 0; + let _g1 = this.info.numRows; while(_g < _g1) { - var i = _g++; - var md = this.massData[i]; - var j = this.info.rows[i].jacobian; + let i = _g++; + let md = this.massData[i]; + let j = this.info.rows[i].jacobian; md.invMLin1X = j.lin1X * invM1; md.invMLin1Y = j.lin1Y * invM1; md.invMLin1Z = j.lin1Z * invM1; md.invMLin2X = j.lin2X * invM2; md.invMLin2Y = j.lin2Y * invM2; md.invMLin2Z = j.lin2Z * invM2; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = invI100 * j.ang1X + invI101 * j.ang1Y + invI102 * j.ang1Z; __tmp__Y = invI110 * j.ang1X + invI111 * j.ang1Y + invI112 * j.ang1Z; __tmp__Z = invI120 * j.ang1X + invI121 * j.ang1Y + invI122 * j.ang1Z; md.invMAng1X = __tmp__X; md.invMAng1Y = __tmp__Y; md.invMAng1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = invI200 * j.ang2X + invI201 * j.ang2Y + invI202 * j.ang2Z; __tmp__Y1 = invI210 * j.ang2X + invI211 * j.ang2Y + invI212 * j.ang2Z; __tmp__Z1 = invI220 * j.ang2X + invI221 * j.ang2Y + invI222 * j.ang2Z; @@ -32633,18 +32854,18 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.mass = 1 / md.mass; } } - var lv1X; - var lv1Y; - var lv1Z; - var lv2X; - var lv2Y; - var lv2Z; - var av1X; - var av1Y; - var av1Z; - var av2X; - var av2Y; - var av2Z; + let lv1X; + let lv1Y; + let lv1Z; + let lv2X; + let lv2Y; + let lv2Z; + let av1X; + let av1Y; + let av1Z; + let av2X; + let av2Y; + let av2Z; lv1X = 0; lv1Y = 0; lv1Z = 0; @@ -32657,21 +32878,21 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp = row.impulse; - var j1 = row.jacobian; - var rv = 0; - rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md1.mass; - var oldImpulseP = imp.impulseP; + let _g2 = 0; + let _g3 = this.info.numRows; + while(_g2 < _g3) { + let i = _g2++; + let row = this.info.rows[i]; + let md = this.massData[i]; + let imp = row.impulse; + let j = row.jacobian; + let rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + let impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md.mass; + let oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < row.minImpulse) { imp.impulseP = row.minImpulse; @@ -32679,63 +32900,63 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend imp.impulseP = row.maxImpulse; } impulseP = imp.impulseP - oldImpulseP; - lv1X += md1.invMLin1X * impulseP; - lv1Y += md1.invMLin1Y * impulseP; - lv1Z += md1.invMLin1Z * impulseP; - lv2X += md1.invMLin2X * -impulseP; - lv2Y += md1.invMLin2Y * -impulseP; - lv2Z += md1.invMLin2Z * -impulseP; - av1X += md1.invMAng1X * impulseP; - av1Y += md1.invMAng1Y * impulseP; - av1Z += md1.invMAng1Z * impulseP; - av2X += md1.invMAng2X * -impulseP; - av2Y += md1.invMAng2Y * -impulseP; - av2Z += md1.invMAng2Z * -impulseP; - } - var _this = this._b1; + lv1X += md.invMLin1X * impulseP; + lv1Y += md.invMLin1Y * impulseP; + lv1Z += md.invMLin1Z * impulseP; + lv2X += md.invMLin2X * -impulseP; + lv2Y += md.invMLin2Y * -impulseP; + lv2Z += md.invMLin2Z * -impulseP; + av1X += md.invMAng1X * impulseP; + av1Y += md.invMAng1Y * impulseP; + av1Z += md.invMAng1Z * impulseP; + av2X += md.invMAng2X * -impulseP; + av2Y += md.invMAng2Y * -impulseP; + av2Z += md.invMAng2Z * -impulseP; + } + let _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; + let _this1 = this._b2; _this1._transform._positionX += lv2X; _this1._transform._positionY += lv2Y; _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; - var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let _this2 = this._b1; + let theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; + let ht2 = halfTheta * halfTheta; rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = av1X * rotationToSinAxisFactor; sinAxisY = av1Y * rotationToSinAxisFactor; sinAxisZ = av1Z * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = _this2._transform._rotation00; + let e11 = _this2._transform._rotation11; + let e22 = _this2._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -32778,7 +32999,7 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -32786,22 +33007,22 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; _this2._transform._rotation00 = 1 - yy - zz; _this2._transform._rotation01 = xy - wz; _this2._transform._rotation02 = xz + wy; @@ -32811,15 +33032,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this2._transform._rotation20 = xz - wy; _this2._transform._rotation21 = yz + wx; _this2._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; @@ -32838,15 +33059,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this2._invInertia20 = __tmp__20; _this2._invInertia21 = __tmp__21; _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; @@ -32874,42 +33095,42 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this2._invInertia20 *= _this2._rotFactor.z; _this2._invInertia21 *= _this2._rotFactor.z; _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; + let _this3 = this._b2; + let theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + let halfTheta1 = theta1 * 0.5; + let rotationToSinAxisFactor1; + let cosHalfTheta1; if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + let ht2 = halfTheta1 * halfTheta1; + rotationToSinAxisFactor1 = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta1 = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; cosHalfTheta1 = Math.cos(halfTheta1); } - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; + let sinAxisX1; + let sinAxisY1; + let sinAxisZ1; sinAxisX1 = av2X * rotationToSinAxisFactor1; sinAxisY1 = av2Y * rotationToSinAxisFactor1; sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; + let dqX1; + let dqY1; + let dqZ1; + let dqW1; dqX1 = sinAxisX1; dqY1 = sinAxisY1; dqZ1 = sinAxisZ1; dqW1 = cosHalfTheta1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; + let qX1; + let qY1; + let qZ1; + let qW1; + let e001 = _this3._transform._rotation00; + let e111 = _this3._transform._rotation11; + let e221 = _this3._transform._rotation22; + let t1 = e001 + e111 + e221; + let s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; @@ -32952,7 +33173,7 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; + let l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; if(l1 > 1e-32) { l1 = 1 / Math.sqrt(l1); } @@ -32960,22 +33181,22 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend qY1 *= l1; qZ1 *= l1; qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; + let x1 = qX1; + let y1 = qY1; + let z1 = qZ1; + let w1 = qW1; + let x21 = 2 * x1; + let y21 = 2 * y1; + let z21 = 2 * z1; + let xx1 = x1 * x21; + let yy1 = y1 * y21; + let zz1 = z1 * z21; + let xy1 = x1 * y21; + let yz1 = y1 * z21; + let xz1 = x1 * z21; + let wx1 = w1 * x21; + let wy1 = w1 * y21; + let wz1 = w1 * z21; _this3._transform._rotation00 = 1 - yy1 - zz1; _this3._transform._rotation01 = xy1 - wz1; _this3._transform._rotation02 = xz1 + wy1; @@ -32985,15 +33206,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this3._transform._rotation20 = xz1 - wy1; _this3._transform._rotation21 = yz1 + wx1; _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; @@ -33012,15 +33233,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this3._invInertia20 = __tmp__202; _this3._invInertia21 = __tmp__212; _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; + let __tmp__003; + let __tmp__013; + let __tmp__023; + let __tmp__103; + let __tmp__113; + let __tmp__123; + let __tmp__203; + let __tmp__213; + let __tmp__223; __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; @@ -33049,134 +33270,136 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend _this3._invInertia21 *= _this3._rotFactor.z; _this3._invInertia22 *= _this3._rotFactor.z; } - ,postSolve: function() { + postSolve() { this.joint._syncAnchors(); this.joint._checkDestruction(); } -}); -var oimo_dynamics_rigidbody_MassData = function() { - this.mass = 0; - this.localInertia = new oimo_common_Mat3(); -}; -var oimo_dynamics_rigidbody_RigidBody = function(config) { - this._next = null; - this._prev = null; - this._shapeList = null; - this._shapeListLast = null; - this._numShapes = 0; - this._contactLinkList = null; - this._contactLinkListLast = null; - this._numContactLinks = 0; - this._jointLinkList = null; - this._jointLinkListLast = null; - this._numJointLinks = 0; - var v = config.linearVelocity; - this._velX = v.x; - this._velY = v.y; - this._velZ = v.z; - var v1 = config.angularVelocity; - this._angVelX = v1.x; - this._angVelY = v1.y; - this._angVelZ = v1.z; - this._pseudoVelX = 0; - this._pseudoVelY = 0; - this._pseudoVelZ = 0; - this._angPseudoVelX = 0; - this._angPseudoVelY = 0; - this._angPseudoVelZ = 0; - this._ptransform = new oimo_common_Transform(); - this._transform = new oimo_common_Transform(); - var v2 = config.position; - this._ptransform._positionX = v2.x; - this._ptransform._positionY = v2.y; - this._ptransform._positionZ = v2.z; - var m = config.rotation; - this._ptransform._rotation00 = m.e00; - this._ptransform._rotation01 = m.e01; - this._ptransform._rotation02 = m.e02; - this._ptransform._rotation10 = m.e10; - this._ptransform._rotation11 = m.e11; - this._ptransform._rotation12 = m.e12; - this._ptransform._rotation20 = m.e20; - this._ptransform._rotation21 = m.e21; - this._ptransform._rotation22 = m.e22; - var dst = this._transform; - var src = this._ptransform; - dst._positionX = src._positionX; - dst._positionY = src._positionY; - dst._positionZ = src._positionZ; - dst._rotation00 = src._rotation00; - dst._rotation01 = src._rotation01; - dst._rotation02 = src._rotation02; - dst._rotation10 = src._rotation10; - dst._rotation11 = src._rotation11; - dst._rotation12 = src._rotation12; - dst._rotation20 = src._rotation20; - dst._rotation21 = src._rotation21; - dst._rotation22 = src._rotation22; - this._type = config.type; - this._sleepTime = 0; - this._sleeping = false; - this._autoSleep = config.autoSleep; - this._mass = 0; - this._invMass = 0; - this._localInertia00 = 0; - this._localInertia01 = 0; - this._localInertia02 = 0; - this._localInertia10 = 0; - this._localInertia11 = 0; - this._localInertia12 = 0; - this._localInertia20 = 0; - this._localInertia21 = 0; - this._localInertia22 = 0; - this._invLocalInertia00 = 0; - this._invLocalInertia01 = 0; - this._invLocalInertia02 = 0; - this._invLocalInertia10 = 0; - this._invLocalInertia11 = 0; - this._invLocalInertia12 = 0; - this._invLocalInertia20 = 0; - this._invLocalInertia21 = 0; - this._invLocalInertia22 = 0; - this._invLocalInertiaWithoutRotFactor00 = 0; - this._invLocalInertiaWithoutRotFactor01 = 0; - this._invLocalInertiaWithoutRotFactor02 = 0; - this._invLocalInertiaWithoutRotFactor10 = 0; - this._invLocalInertiaWithoutRotFactor11 = 0; - this._invLocalInertiaWithoutRotFactor12 = 0; - this._invLocalInertiaWithoutRotFactor20 = 0; - this._invLocalInertiaWithoutRotFactor21 = 0; - this._invLocalInertiaWithoutRotFactor22 = 0; - this._invInertia00 = 0; - this._invInertia01 = 0; - this._invInertia02 = 0; - this._invInertia10 = 0; - this._invInertia11 = 0; - this._invInertia12 = 0; - this._invInertia20 = 0; - this._invInertia21 = 0; - this._invInertia22 = 0; - this._linearDamping = config.linearDamping; - this._angularDamping = config.angularDamping; - this._forceX = 0; - this._forceY = 0; - this._forceZ = 0; - this._torqueX = 0; - this._torqueY = 0; - this._torqueZ = 0; - this._linearContactImpulseX = 0; - this._linearContactImpulseY = 0; - this._linearContactImpulseZ = 0; - this._angularContactImpulseX = 0; - this._angularContactImpulseY = 0; - this._angularContactImpulseZ = 0; - this._rotFactor = new oimo_common_Vec3(1,1,1); - this._addedToIsland = false; - this._gravityScale = 1; - this._world = null; -}; -oimo_dynamics_rigidbody_RigidBody.prototype = { - _integrate: function(dt) { +} +class oimo_dynamics_rigidbody_MassData { + constructor() { + this.mass = 0; + this.localInertia = new oimo_common_Mat3(); + } +} +class oimo_dynamics_rigidbody_RigidBody { + constructor(config) { + this._next = null; + this._prev = null; + this._shapeList = null; + this._shapeListLast = null; + this._numShapes = 0; + this._contactLinkList = null; + this._contactLinkListLast = null; + this._numContactLinks = 0; + this._jointLinkList = null; + this._jointLinkListLast = null; + this._numJointLinks = 0; + let v = config.linearVelocity; + this._velX = v.x; + this._velY = v.y; + this._velZ = v.z; + let v1 = config.angularVelocity; + this._angVelX = v1.x; + this._angVelY = v1.y; + this._angVelZ = v1.z; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + this._ptransform = new oimo_common_Transform(); + this._transform = new oimo_common_Transform(); + let v2 = config.position; + this._ptransform._positionX = v2.x; + this._ptransform._positionY = v2.y; + this._ptransform._positionZ = v2.z; + let m = config.rotation; + this._ptransform._rotation00 = m.e00; + this._ptransform._rotation01 = m.e01; + this._ptransform._rotation02 = m.e02; + this._ptransform._rotation10 = m.e10; + this._ptransform._rotation11 = m.e11; + this._ptransform._rotation12 = m.e12; + this._ptransform._rotation20 = m.e20; + this._ptransform._rotation21 = m.e21; + this._ptransform._rotation22 = m.e22; + let dst = this._transform; + let src = this._ptransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + this._type = config.type; + this._sleepTime = 0; + this._sleeping = false; + this._autoSleep = config.autoSleep; + this._mass = 0; + this._invMass = 0; + this._localInertia00 = 0; + this._localInertia01 = 0; + this._localInertia02 = 0; + this._localInertia10 = 0; + this._localInertia11 = 0; + this._localInertia12 = 0; + this._localInertia20 = 0; + this._localInertia21 = 0; + this._localInertia22 = 0; + this._invLocalInertia00 = 0; + this._invLocalInertia01 = 0; + this._invLocalInertia02 = 0; + this._invLocalInertia10 = 0; + this._invLocalInertia11 = 0; + this._invLocalInertia12 = 0; + this._invLocalInertia20 = 0; + this._invLocalInertia21 = 0; + this._invLocalInertia22 = 0; + this._invLocalInertiaWithoutRotFactor00 = 0; + this._invLocalInertiaWithoutRotFactor01 = 0; + this._invLocalInertiaWithoutRotFactor02 = 0; + this._invLocalInertiaWithoutRotFactor10 = 0; + this._invLocalInertiaWithoutRotFactor11 = 0; + this._invLocalInertiaWithoutRotFactor12 = 0; + this._invLocalInertiaWithoutRotFactor20 = 0; + this._invLocalInertiaWithoutRotFactor21 = 0; + this._invLocalInertiaWithoutRotFactor22 = 0; + this._invInertia00 = 0; + this._invInertia01 = 0; + this._invInertia02 = 0; + this._invInertia10 = 0; + this._invInertia11 = 0; + this._invInertia12 = 0; + this._invInertia20 = 0; + this._invInertia21 = 0; + this._invInertia22 = 0; + this._linearDamping = config.linearDamping; + this._angularDamping = config.angularDamping; + this._forceX = 0; + this._forceY = 0; + this._forceZ = 0; + this._torqueX = 0; + this._torqueY = 0; + this._torqueZ = 0; + this._linearContactImpulseX = 0; + this._linearContactImpulseY = 0; + this._linearContactImpulseZ = 0; + this._angularContactImpulseX = 0; + this._angularContactImpulseY = 0; + this._angularContactImpulseZ = 0; + this._rotFactor = new oimo_common_Vec3(1,1,1); + this._addedToIsland = false; + this._gravityScale = 1; + this._world = null; + } + _integrate(dt) { switch(this._type) { case 1: this._velX = 0; @@ -33193,25 +33416,25 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._angPseudoVelZ = 0; break; case 0:case 2: - var translationX; - var translationY; - var translationZ; - var rotationX; - var rotationY; - var rotationZ; + let translationX; + let translationY; + let translationZ; + let rotationX; + let rotationY; + let rotationZ; translationX = this._velX * dt; translationY = this._velY * dt; translationZ = this._velZ * dt; rotationX = this._angVelX * dt; rotationY = this._angVelY * dt; rotationZ = this._angVelZ * dt; - var translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; - var rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; + let translationLengthSq = translationX * translationX + translationY * translationY + translationZ * translationZ; + let rotationLengthSq = rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ; if(translationLengthSq == 0 && rotationLengthSq == 0) { return; } if(translationLengthSq > oimo_common_Setting.maxTranslationPerStep * oimo_common_Setting.maxTranslationPerStep) { - var l = oimo_common_Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); + let l = oimo_common_Setting.maxTranslationPerStep / Math.sqrt(translationLengthSq); this._velX *= l; this._velY *= l; this._velZ *= l; @@ -33220,52 +33443,52 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { translationZ *= l; } if(rotationLengthSq > oimo_common_Setting.maxRotationPerStep * oimo_common_Setting.maxRotationPerStep) { - var l1 = oimo_common_Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); - this._angVelX *= l1; - this._angVelY *= l1; - this._angVelZ *= l1; - rotationX *= l1; - rotationY *= l1; - rotationZ *= l1; + let l = oimo_common_Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); + this._angVelX *= l; + this._angVelY *= l; + this._angVelZ *= l; + rotationX *= l; + rotationY *= l; + rotationZ *= l; } this._transform._positionX += translationX; this._transform._positionY += translationY; this._transform._positionZ += translationZ; - var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; + let ht2 = halfTheta * halfTheta; rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -33308,30 +33531,30 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l2 = qX * qX + qY * qY + qZ * qZ + qW * qW; - if(l2 > 1e-32) { - l2 = 1 / Math.sqrt(l2); - } - qX *= l2; - qY *= l2; - qZ *= l2; - qW *= l2; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -33341,15 +33564,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -33368,15 +33591,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -33407,7 +33630,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { break; } } - ,_integratePseudoVelocity: function() { + _integratePseudoVelocity() { if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { return; } @@ -33421,12 +33644,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._angPseudoVelZ = 0; break; case 0:case 2: - var translationX; - var translationY; - var translationZ; - var rotationX; - var rotationY; - var rotationZ; + let translationX; + let translationY; + let translationZ; + let rotationX; + let rotationY; + let rotationZ; translationX = this._pseudoVelX; translationY = this._pseudoVelY; translationZ = this._pseudoVelZ; @@ -33442,41 +33665,41 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._positionX += translationX; this._transform._positionY += translationY; this._transform._positionZ += translationZ; - var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; + let theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + let halfTheta = theta * 0.5; + let rotationToSinAxisFactor; + let cosHalfTheta; if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; + let ht2 = halfTheta * halfTheta; rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { rotationToSinAxisFactor = Math.sin(halfTheta) / theta; cosHalfTheta = Math.cos(halfTheta); } - var sinAxisX; - var sinAxisY; - var sinAxisZ; + let sinAxisX; + let sinAxisY; + let sinAxisZ; sinAxisX = rotationX * rotationToSinAxisFactor; sinAxisY = rotationY * rotationToSinAxisFactor; sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; + let dqX; + let dqY; + let dqZ; + let dqW; dqX = sinAxisX; dqY = sinAxisY; dqZ = sinAxisZ; dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + let qX; + let qY; + let qZ; + let qW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; @@ -33519,7 +33742,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + let l = qX * qX + qY * qY + qZ * qZ + qW * qW; if(l > 1e-32) { l = 1 / Math.sqrt(l); } @@ -33527,22 +33750,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { qY *= l; qZ *= l; qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -33552,15 +33775,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -33579,15 +33802,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -33618,16 +33841,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { break; } } - ,updateMass: function() { - var totalInertia00; - var totalInertia01; - var totalInertia02; - var totalInertia10; - var totalInertia11; - var totalInertia12; - var totalInertia20; - var totalInertia21; - var totalInertia22; + updateMass() { + let totalInertia00; + let totalInertia01; + let totalInertia02; + let totalInertia10; + let totalInertia11; + let totalInertia12; + let totalInertia20; + let totalInertia21; + let totalInertia22; totalInertia00 = 0; totalInertia01 = 0; totalInertia02 = 0; @@ -33637,31 +33860,31 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { totalInertia20 = 0; totalInertia21 = 0; totalInertia22 = 0; - var totalMass = 0; - var s = this._shapeList; + let totalMass = 0; + let s = this._shapeList; while(s != null) { - var n = s._next; - var g = s._geom; + let n = s._next; + let g = s._geom; g._updateMass(); - var mass = s._density * g._volume; - var inertia00; - var inertia01; - var inertia02; - var inertia10; - var inertia11; - var inertia12; - var inertia20; - var inertia21; - var inertia22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let mass = s._density * g._volume; + let inertia00; + let inertia01; + let inertia02; + let inertia10; + let inertia11; + let inertia12; + let inertia20; + let inertia21; + let inertia22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = s._localTransform._rotation00 * g._inertiaCoeff00 + s._localTransform._rotation01 * g._inertiaCoeff10 + s._localTransform._rotation02 * g._inertiaCoeff20; __tmp__01 = s._localTransform._rotation00 * g._inertiaCoeff01 + s._localTransform._rotation01 * g._inertiaCoeff11 + s._localTransform._rotation02 * g._inertiaCoeff21; __tmp__02 = s._localTransform._rotation00 * g._inertiaCoeff02 + s._localTransform._rotation01 * g._inertiaCoeff12 + s._localTransform._rotation02 * g._inertiaCoeff22; @@ -33680,15 +33903,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { inertia20 = __tmp__20; inertia21 = __tmp__21; inertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = inertia00 * s._localTransform._rotation00 + inertia01 * s._localTransform._rotation01 + inertia02 * s._localTransform._rotation02; __tmp__011 = inertia00 * s._localTransform._rotation10 + inertia01 * s._localTransform._rotation11 + inertia02 * s._localTransform._rotation12; __tmp__021 = inertia00 * s._localTransform._rotation20 + inertia01 * s._localTransform._rotation21 + inertia02 * s._localTransform._rotation22; @@ -33716,21 +33939,21 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { inertia20 *= mass; inertia21 *= mass; inertia22 *= mass; - var cogInertia00; - var cogInertia01; - var cogInertia02; - var cogInertia10; - var cogInertia11; - var cogInertia12; - var cogInertia20; - var cogInertia21; - var cogInertia22; - var xx = s._localTransform._positionX * s._localTransform._positionX; - var yy = s._localTransform._positionY * s._localTransform._positionY; - var zz = s._localTransform._positionZ * s._localTransform._positionZ; - var xy = -s._localTransform._positionX * s._localTransform._positionY; - var yz = -s._localTransform._positionY * s._localTransform._positionZ; - var zx = -s._localTransform._positionZ * s._localTransform._positionX; + let cogInertia00; + let cogInertia01; + let cogInertia02; + let cogInertia10; + let cogInertia11; + let cogInertia12; + let cogInertia20; + let cogInertia21; + let cogInertia22; + let xx = s._localTransform._positionX * s._localTransform._positionX; + let yy = s._localTransform._positionY * s._localTransform._positionY; + let zz = s._localTransform._positionZ * s._localTransform._positionZ; + let xy = -s._localTransform._positionX * s._localTransform._positionY; + let yz = -s._localTransform._positionY * s._localTransform._positionZ; + let zx = -s._localTransform._positionZ * s._localTransform._positionX; cogInertia00 = yy + zz; cogInertia01 = xy; cogInertia02 = zx; @@ -33773,10 +33996,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._localInertia22 = totalInertia22; if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + let d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + let d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + let d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + let d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } @@ -33831,60 +34054,60 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._type = 1; } } - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__012 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__022 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__102 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__112 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__122 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__202 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__212 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__222 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; - this._invInertia00 = __tmp__002; - this._invInertia01 = __tmp__012; - this._invInertia02 = __tmp__022; - this._invInertia10 = __tmp__102; - this._invInertia11 = __tmp__112; - this._invInertia12 = __tmp__122; - this._invInertia20 = __tmp__202; - this._invInertia21 = __tmp__212; - this._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__013 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__023 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__103 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__113 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__123 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__203 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__213 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__223 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__003; - this._invInertia01 = __tmp__013; - this._invInertia02 = __tmp__023; - this._invInertia10 = __tmp__103; - this._invInertia11 = __tmp__113; - this._invInertia12 = __tmp__123; - this._invInertia20 = __tmp__203; - this._invInertia21 = __tmp__213; - this._invInertia22 = __tmp__223; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__001; + this._invInertia01 = __tmp__011; + this._invInertia02 = __tmp__021; + this._invInertia10 = __tmp__101; + this._invInertia11 = __tmp__111; + this._invInertia12 = __tmp__121; + this._invInertia20 = __tmp__201; + this._invInertia21 = __tmp__211; + this._invInertia22 = __tmp__221; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -33897,24 +34120,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getPosition: function() { - var v = new oimo_common_Vec3(); + getPosition() { + let v = new oimo_common_Vec3(); v.x = this._transform._positionX; v.y = this._transform._positionY; v.z = this._transform._positionZ; return v; } - ,getPositionTo: function(position) { + getPositionTo(position) { position.x = this._transform._positionX; position.y = this._transform._positionY; position.z = this._transform._positionZ; } - ,setPosition: function(position) { + setPosition(position) { this._transform._positionX = position.x; this._transform._positionY = position.y; this._transform._positionZ = position.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -33927,22 +34150,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -33952,38 +34175,38 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -33993,33 +34216,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -34035,13 +34258,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -34052,18 +34275,18 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,translate: function(translation) { - var diffX; - var diffY; - var diffZ; + translate(translation) { + let diffX; + let diffY; + let diffZ; diffX = translation.x; diffY = translation.y; diffZ = translation.z; this._transform._positionX += diffX; this._transform._positionY += diffY; this._transform._positionZ += diffZ; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -34076,22 +34299,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -34101,38 +34324,38 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -34142,33 +34365,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -34184,13 +34407,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -34201,8 +34424,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getRotation: function() { - var m = new oimo_common_Mat3(); + getRotation() { + let m = new oimo_common_Mat3(); m.e00 = this._transform._rotation00; m.e01 = this._transform._rotation01; m.e02 = this._transform._rotation02; @@ -34214,7 +34437,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e22 = this._transform._rotation22; return m; } - ,getRotationTo: function(rotation) { + getRotationTo(rotation) { rotation.e00 = this._transform._rotation00; rotation.e01 = this._transform._rotation01; rotation.e02 = this._transform._rotation02; @@ -34225,7 +34448,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { rotation.e21 = this._transform._rotation21; rotation.e22 = this._transform._rotation22; } - ,setRotation: function(rotation) { + setRotation(rotation) { this._transform._rotation00 = rotation.e00; this._transform._rotation01 = rotation.e01; this._transform._rotation02 = rotation.e02; @@ -34235,15 +34458,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = rotation.e20; this._transform._rotation21 = rotation.e21; this._transform._rotation22 = rotation.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -34262,15 +34485,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -34298,8 +34521,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -34312,99 +34535,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -34420,13 +34643,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -34437,19 +34660,19 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,setRotationXyz: function(eulerAngles) { - var xyzX; - var xyzY; - var xyzZ; + setRotationXyz(eulerAngles) { + let xyzX; + let xyzY; + let xyzZ; xyzX = eulerAngles.x; xyzY = eulerAngles.y; xyzZ = eulerAngles.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); this._transform._rotation00 = cy * cz; this._transform._rotation01 = -cy * sz; this._transform._rotation02 = sy; @@ -34459,15 +34682,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = sx * sz - cx * cz * sy; this._transform._rotation21 = cz * sx + cx * sy * sz; this._transform._rotation22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -34486,15 +34709,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -34522,8 +34745,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -34536,99 +34759,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -34644,13 +34867,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -34661,16 +34884,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,rotate: function(rotation) { - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; + rotate(rotation) { + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; rot00 = rotation.e00; rot01 = rotation.e01; rot02 = rotation.e02; @@ -34680,15 +34903,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { rot20 = rotation.e20; rot21 = rotation.e21; rot22 = rotation.e22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; @@ -34707,15 +34930,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -34734,15 +34957,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__201; this._invInertia21 = __tmp__211; this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -34770,8 +34993,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -34784,99 +35007,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -34892,13 +35115,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -34909,28 +35132,28 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,rotateXyz: function(eulerAngles) { - var xyzX; - var xyzY; - var xyzZ; - var rot00; - var rot01; - var rot02; - var rot10; - var rot11; - var rot12; - var rot20; - var rot21; - var rot22; + rotateXyz(eulerAngles) { + let xyzX; + let xyzY; + let xyzZ; + let rot00; + let rot01; + let rot02; + let rot10; + let rot11; + let rot12; + let rot20; + let rot21; + let rot22; xyzX = eulerAngles.x; xyzY = eulerAngles.y; xyzZ = eulerAngles.z; - var sx = Math.sin(xyzX); - var sy = Math.sin(xyzY); - var sz = Math.sin(xyzZ); - var cx = Math.cos(xyzX); - var cy = Math.cos(xyzY); - var cz = Math.cos(xyzZ); + let sx = Math.sin(xyzX); + let sy = Math.sin(xyzY); + let sz = Math.sin(xyzZ); + let cx = Math.cos(xyzX); + let cy = Math.cos(xyzY); + let cz = Math.cos(xyzZ); rot00 = cy * cz; rot01 = -cy * sz; rot02 = sy; @@ -34940,15 +35163,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { rot20 = sx * sz - cx * cz * sy; rot21 = cz * sx + cx * sy * sz; rot22 = cx * cy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = rot00 * this._transform._rotation00 + rot01 * this._transform._rotation10 + rot02 * this._transform._rotation20; __tmp__01 = rot00 * this._transform._rotation01 + rot01 * this._transform._rotation11 + rot02 * this._transform._rotation21; __tmp__02 = rot00 * this._transform._rotation02 + rot01 * this._transform._rotation12 + rot02 * this._transform._rotation22; @@ -34967,15 +35190,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -34994,15 +35217,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__201; this._invInertia21 = __tmp__211; this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; + let __tmp__002; + let __tmp__012; + let __tmp__022; + let __tmp__102; + let __tmp__112; + let __tmp__122; + let __tmp__202; + let __tmp__212; + let __tmp__222; __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -35030,8 +35253,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -35044,99 +35267,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -35152,13 +35375,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -35169,17 +35392,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getOrientation: function() { - var q = new oimo_common_Quat(); - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + getOrientation() { + let q = new oimo_common_Quat(); + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -35224,16 +35447,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { q.w = iqW; return q; } - ,getOrientationTo: function(orientation) { - var iqX; - var iqY; - var iqZ; - var iqW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; + getOrientationTo(orientation) { + let iqX; + let iqY; + let iqZ; + let iqW; + let e00 = this._transform._rotation00; + let e11 = this._transform._rotation11; + let e22 = this._transform._rotation22; + let t = e00 + e11 + e22; + let s; if(t > 0) { s = Math.sqrt(t + 1); iqW = 0.5 * s; @@ -35277,31 +35500,31 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { orientation.z = iqZ; orientation.w = iqW; } - ,setOrientation: function(quaternion) { - var qX; - var qY; - var qZ; - var qW; + setOrientation(quaternion) { + let qX; + let qY; + let qZ; + let qW; qX = quaternion.x; qY = quaternion.y; qZ = quaternion.z; qW = quaternion.w; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + let x = qX; + let y = qY; + let z = qZ; + let w = qW; + let x2 = 2 * x; + let y2 = 2 * y; + let z2 = 2 * z; + let xx = x * x2; + let yy = y * y2; + let zz = z * z2; + let xy = x * y2; + let yz = y * z2; + let xz = x * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; this._transform._rotation00 = 1 - yy - zz; this._transform._rotation01 = xy - wz; this._transform._rotation02 = xz + wy; @@ -35311,15 +35534,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = xz - wy; this._transform._rotation21 = yz + wx; this._transform._rotation22 = 1 - xx - yy; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -35338,15 +35561,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -35374,8 +35597,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -35388,99 +35611,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -35496,13 +35719,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -35513,9 +35736,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getTransform: function() { - var _this = this._transform; - var tf = new oimo_common_Transform(); + getTransform() { + let _this = this._transform; + let tf = new oimo_common_Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -35530,8 +35753,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { tf._rotation22 = _this._rotation22; return tf; } - ,getTransformTo: function(transform) { - var transform1 = this._transform; + getTransformTo(transform) { + let transform1 = this._transform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -35545,7 +35768,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { transform._rotation21 = transform1._rotation21; transform._rotation22 = transform1._rotation22; } - ,setTransform: function(transform) { + setTransform(transform) { this._transform._positionX = transform._positionX; this._transform._positionY = transform._positionY; this._transform._positionZ = transform._positionZ; @@ -35558,15 +35781,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = transform._rotation20; this._transform._rotation21 = transform._rotation21; this._transform._rotation22 = transform._rotation22; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -35585,15 +35808,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -35621,8 +35844,8 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 *= this._rotFactor.z; this._invInertia21 *= this._rotFactor.z; this._invInertia22 *= this._rotFactor.z; - var dst = this._ptransform; - var src = this._transform; + let dst = this._ptransform; + let src = this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -35635,99 +35858,99 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst1 = s._ptransform; - var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; - var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -35743,13 +35966,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -35760,11 +35983,11 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getMass: function() { + getMass() { return this._mass; } - ,getLocalInertia: function() { - var m = new oimo_common_Mat3(); + getLocalInertia() { + let m = new oimo_common_Mat3(); m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -35776,7 +35999,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e22 = this._localInertia22; return m; } - ,getLocalInertiaTo: function(inertia) { + getLocalInertiaTo(inertia) { inertia.e00 = this._localInertia00; inertia.e01 = this._localInertia01; inertia.e02 = this._localInertia02; @@ -35787,10 +36010,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { inertia.e21 = this._localInertia21; inertia.e22 = this._localInertia22; } - ,getMassData: function() { - var md = new oimo_dynamics_rigidbody_MassData(); + getMassData() { + let md = new oimo_dynamics_rigidbody_MassData(); md.mass = this._mass; - var m = md.localInertia; + let m = md.localInertia; m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -35802,9 +36025,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e22 = this._localInertia22; return md; } - ,getMassDataTo: function(massData) { + getMassDataTo(massData) { massData.mass = this._mass; - var m = massData.localInertia; + let m = massData.localInertia; m.e00 = this._localInertia00; m.e01 = this._localInertia01; m.e02 = this._localInertia02; @@ -35815,9 +36038,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { m.e21 = this._localInertia21; m.e22 = this._localInertia22; } - ,setMassData: function(massData) { + setMassData(massData) { this._mass = massData.mass; - var m = massData.localInertia; + let m = massData.localInertia; this._localInertia00 = m.e00; this._localInertia01 = m.e01; this._localInertia02 = m.e02; @@ -35829,10 +36052,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._localInertia22 = m.e22; if(this._mass > 0 && this._localInertia00 * (this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21) - this._localInertia01 * (this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20) + this._localInertia02 * (this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20) > 0 && this._type == 0) { this._invMass = 1 / this._mass; - var d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; - var d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; - var d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; - var d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; + let d00 = this._localInertia11 * this._localInertia22 - this._localInertia12 * this._localInertia21; + let d01 = this._localInertia10 * this._localInertia22 - this._localInertia12 * this._localInertia20; + let d02 = this._localInertia10 * this._localInertia21 - this._localInertia11 * this._localInertia20; + let d = this._localInertia00 * d00 - this._localInertia01 * d01 + this._localInertia02 * d02; if(d < -1e-32 || d > 1e-32) { d = 1 / d; } @@ -35887,15 +36110,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._type = 1; } } - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -35914,15 +36137,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -35953,24 +36176,24 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getRotationFactor: function() { - var _this = this._rotFactor; + getRotationFactor() { + let _this = this._rotFactor; return new oimo_common_Vec3(_this.x,_this.y,_this.z); } - ,setRotationFactor: function(rotationFactor) { - var _this = this._rotFactor; + setRotationFactor(rotationFactor) { + let _this = this._rotFactor; _this.x = rotationFactor.x; _this.y = rotationFactor.y; _this.z = rotationFactor.z; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; @@ -35989,15 +36212,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; @@ -36028,19 +36251,19 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getLinearVelocity: function() { - var v = new oimo_common_Vec3(); + getLinearVelocity() { + let v = new oimo_common_Vec3(); v.x = this._velX; v.y = this._velY; v.z = this._velZ; return v; } - ,getLinearVelocityTo: function(linearVelocity) { + getLinearVelocityTo(linearVelocity) { linearVelocity.x = this._velX; linearVelocity.y = this._velY; linearVelocity.z = this._velZ; } - ,setLinearVelocity: function(linearVelocity) { + setLinearVelocity(linearVelocity) { if(this._type == 1) { this._velX = 0; this._velY = 0; @@ -36053,19 +36276,19 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getAngularVelocity: function() { - var v = new oimo_common_Vec3(); + getAngularVelocity() { + let v = new oimo_common_Vec3(); v.x = this._angVelX; v.y = this._angVelY; v.z = this._angVelZ; return v; } - ,getAngularVelocityTo: function(angularVelocity) { + getAngularVelocityTo(angularVelocity) { angularVelocity.x = this._velX; angularVelocity.y = this._velY; angularVelocity.z = this._velZ; } - ,setAngularVelocity: function(angularVelocity) { + setAngularVelocity(angularVelocity) { if(this._type == 1) { this._angVelX = 0; this._angVelY = 0; @@ -36078,11 +36301,11 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,addLinearVelocity: function(linearVelocityChange) { + addLinearVelocity(linearVelocityChange) { if(this._type != 1) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = linearVelocityChange.x; dY = linearVelocityChange.y; dZ = linearVelocityChange.z; @@ -36093,11 +36316,11 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,addAngularVelocity: function(angularVelocityChange) { + addAngularVelocity(angularVelocityChange) { if(this._type != 1) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = angularVelocityChange.x; dY = angularVelocityChange.y; dZ = angularVelocityChange.z; @@ -36108,22 +36331,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyImpulse: function(impulse,positionInWorld) { - var impX; - var impY; - var impZ; + applyImpulse(impulse,positionInWorld) { + let impX; + let impY; + let impZ; impX = impulse.x; impY = impulse.y; impZ = impulse.z; this._velX += impX * this._invMass; this._velY += impY * this._invMass; this._velZ += impZ * this._invMass; - var aimpX; - var aimpY; - var aimpZ; - var posX; - var posY; - var posZ; + let aimpX; + let aimpY; + let aimpZ; + let posX; + let posY; + let posZ; posX = positionInWorld.x; posY = positionInWorld.y; posZ = positionInWorld.z; @@ -36133,9 +36356,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { aimpX = posY * impZ - posZ * impY; aimpY = posZ * impX - posX * impZ; aimpZ = posX * impY - posY * impX; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._invInertia00 * aimpX + this._invInertia01 * aimpY + this._invInertia02 * aimpZ; __tmp__Y = this._invInertia10 * aimpX + this._invInertia11 * aimpY + this._invInertia12 * aimpZ; __tmp__Z = this._invInertia20 * aimpX + this._invInertia21 * aimpY + this._invInertia22 * aimpZ; @@ -36148,10 +36371,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyLinearImpulse: function(impulse) { - var impX; - var impY; - var impZ; + applyLinearImpulse(impulse) { + let impX; + let impY; + let impZ; impX = impulse.x; impY = impulse.y; impZ = impulse.z; @@ -36161,16 +36384,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyAngularImpulse: function(impulse) { - var impX; - var impY; - var impZ; + applyAngularImpulse(impulse) { + let impX; + let impY; + let impZ; impX = impulse.x; impY = impulse.y; impZ = impulse.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._invInertia00 * impX + this._invInertia01 * impY + this._invInertia02 * impZ; __tmp__Y = this._invInertia10 * impX + this._invInertia11 * impY + this._invInertia12 * impZ; __tmp__Z = this._invInertia20 * impX + this._invInertia21 * impY + this._invInertia22 * impZ; @@ -36183,22 +36406,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyForce: function(force,positionInWorld) { - var iforceX; - var iforceY; - var iforceZ; + applyForce(force,positionInWorld) { + let iforceX; + let iforceY; + let iforceZ; iforceX = force.x; iforceY = force.y; iforceZ = force.z; this._forceX += iforceX; this._forceY += iforceY; this._forceZ += iforceZ; - var itorqueX; - var itorqueY; - var itorqueZ; - var posX; - var posY; - var posZ; + let itorqueX; + let itorqueY; + let itorqueZ; + let posX; + let posY; + let posZ; posX = positionInWorld.x; posY = positionInWorld.y; posZ = positionInWorld.z; @@ -36214,10 +36437,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyForceToCenter: function(force) { - var iforceX; - var iforceY; - var iforceZ; + applyForceToCenter(force) { + let iforceX; + let iforceY; + let iforceZ; iforceX = force.x; iforceY = force.y; iforceZ = force.z; @@ -36227,10 +36450,10 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,applyTorque: function(torque) { - var itorqueX; - var itorqueY; - var itorqueZ; + applyTorque(torque) { + let itorqueX; + let itorqueY; + let itorqueZ; itorqueX = torque.x; itorqueY = torque.y; itorqueZ = torque.z; @@ -36240,76 +36463,76 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._sleeping = false; this._sleepTime = 0; } - ,getLinearContactImpulse: function() { - var res = new oimo_common_Vec3(); + getLinearContactImpulse() { + let res = new oimo_common_Vec3(); res.x = this._linearContactImpulseX; res.y = this._linearContactImpulseY; res.z = this._linearContactImpulseZ; return res; } - ,getLinearContactImpulseTo: function(linearContactImpulse) { + getLinearContactImpulseTo(linearContactImpulse) { linearContactImpulse.x = this._linearContactImpulseX; linearContactImpulse.y = this._linearContactImpulseY; linearContactImpulse.z = this._linearContactImpulseZ; } - ,getAngularContactImpulse: function() { - var res = new oimo_common_Vec3(); + getAngularContactImpulse() { + let res = new oimo_common_Vec3(); res.x = this._angularContactImpulseX; res.y = this._angularContactImpulseY; res.z = this._angularContactImpulseZ; return res; } - ,getAngularContactImpulseTo: function(angularContactImpulse) { + getAngularContactImpulseTo(angularContactImpulse) { angularContactImpulse.x = this._angularContactImpulseX; angularContactImpulse.y = this._angularContactImpulseY; angularContactImpulse.z = this._angularContactImpulseZ; } - ,getGravityScale: function() { + getGravityScale() { return this._gravityScale; } - ,setGravityScale: function(gravityScale) { + setGravityScale(gravityScale) { this._gravityScale = gravityScale; this._sleeping = false; this._sleepTime = 0; } - ,getLocalPoint: function(worldPoint) { - var vX; - var vY; - var vZ; + getLocalPoint(worldPoint) { + let vX; + let vY; + let vZ; vX = worldPoint.x; vY = worldPoint.y; vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo_common_Vec3(); + let res = new oimo_common_Vec3(); res.x = vX; res.y = vY; res.z = vZ; return res; } - ,getLocalPointTo: function(worldPoint,localPoint) { - var vX; - var vY; - var vZ; + getLocalPointTo(worldPoint,localPoint) { + let vX; + let vY; + let vZ; vX = worldPoint.x; vY = worldPoint.y; vZ = worldPoint.z; vX -= this._transform._positionX; vY -= this._transform._positionY; vZ -= this._transform._positionZ; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; @@ -36320,38 +36543,38 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { localPoint.y = vY; localPoint.z = vZ; } - ,getLocalVector: function(worldVector) { - var vX; - var vY; - var vZ; + getLocalVector(worldVector) { + let vX; + let vY; + let vZ; vX = worldVector.x; vY = worldVector.y; vZ = worldVector.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo_common_Vec3(); + let res = new oimo_common_Vec3(); res.x = vX; res.y = vY; res.z = vZ; return res; } - ,getLocalVectorTo: function(worldVector,localVector) { - var vX; - var vY; - var vZ; + getLocalVectorTo(worldVector,localVector) { + let vX; + let vY; + let vZ; vX = worldVector.x; vY = worldVector.y; vZ = worldVector.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation10 * vY + this._transform._rotation20 * vZ; __tmp__Y = this._transform._rotation01 * vX + this._transform._rotation11 * vY + this._transform._rotation21 * vZ; __tmp__Z = this._transform._rotation02 * vX + this._transform._rotation12 * vY + this._transform._rotation22 * vZ; @@ -36362,16 +36585,16 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { localVector.y = vY; localVector.z = vZ; } - ,getWorldPoint: function(localPoint) { - var vX; - var vY; - var vZ; + getWorldPoint(localPoint) { + let vX; + let vY; + let vZ; vX = localPoint.x; vY = localPoint.y; vZ = localPoint.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; @@ -36381,22 +36604,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { vX += this._transform._positionX; vY += this._transform._positionY; vZ += this._transform._positionZ; - var res = new oimo_common_Vec3(); + let res = new oimo_common_Vec3(); res.x = vX; res.y = vY; res.z = vZ; return res; } - ,getWorldPointTo: function(localPoint,worldPoint) { - var vX; - var vY; - var vZ; + getWorldPointTo(localPoint,worldPoint) { + let vX; + let vY; + let vZ; vX = localPoint.x; vY = localPoint.y; vZ = localPoint.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; @@ -36410,38 +36633,38 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { worldPoint.y = vY; worldPoint.z = vZ; } - ,getWorldVector: function(localVector) { - var vX; - var vY; - var vZ; + getWorldVector(localVector) { + let vX; + let vY; + let vZ; vX = localVector.x; vY = localVector.y; vZ = localVector.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; vX = __tmp__X; vY = __tmp__Y; vZ = __tmp__Z; - var res = new oimo_common_Vec3(); + let res = new oimo_common_Vec3(); res.x = vX; res.y = vY; res.z = vZ; return res; } - ,getWorldVectorTo: function(localVector,worldVector) { - var vX; - var vY; - var vZ; + getWorldVectorTo(localVector,worldVector) { + let vX; + let vY; + let vZ; vX = localVector.x; vY = localVector.y; vZ = localVector.z; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = this._transform._rotation00 * vX + this._transform._rotation01 * vY + this._transform._rotation02 * vZ; __tmp__Y = this._transform._rotation10 * vX + this._transform._rotation11 * vY + this._transform._rotation12 * vZ; __tmp__Z = this._transform._rotation20 * vX + this._transform._rotation21 * vY + this._transform._rotation22 * vZ; @@ -36452,25 +36675,25 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { worldVector.y = vY; worldVector.z = vZ; } - ,getNumShapes: function() { + getNumShapes() { return this._numShapes; } - ,getShapeList: function() { + getShapeList() { return this._shapeList; } - ,getNumContectLinks: function() { + getNumContactLinks() { return this._numContactLinks; } - ,getContactLinkList: function() { + getContactLinkList() { return this._contactLinkList; } - ,getNumJointLinks: function() { + getNumJointLinks() { return this._numJointLinks; } - ,getJointLinkList: function() { + getJointLinkList() { return this._jointLinkList; } - ,addShape: function(shape) { + addShape(shape) { if(this._shapeList == null) { this._shapeList = shape; this._shapeListLast = shape; @@ -36482,28 +36705,28 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._numShapes++; shape._rigidBody = this; if(this._world != null) { - var _this = this._world; + let _this = this._world; shape._proxy = _this._broadPhase.createProxy(shape,shape._aabb); shape._id = _this._shapeIdCount++; _this._numShapes++; } this.updateMass(); - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -36522,9 +36745,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; @@ -36534,17 +36757,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._positionX += tf1._positionX; dst._positionY += tf1._positionY; dst._positionZ += tf1._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -36563,9 +36786,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; @@ -36575,12 +36798,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst1._positionX += tf2._positionX; dst1._positionY += tf2._positionY; dst1._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -36596,13 +36819,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -36611,9 +36834,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s = n; } } - ,removeShape: function(shape) { - var prev = shape._prev; - var next = shape._next; + removeShape(shape) { + let prev = shape._prev; + let next = shape._next; if(prev != null) { prev._next = next; } @@ -36631,26 +36854,26 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._numShapes--; shape._rigidBody = null; if(this._world != null) { - var _this = this._world; + let _this = this._world; _this._broadPhase.destroyProxy(shape._proxy); shape._proxy = null; shape._id = -1; - var cl = shape._rigidBody._contactLinkList; + let cl = shape._rigidBody._contactLinkList; while(cl != null) { - var n = cl._next; - var c = cl._contact; + let n = cl._next; + let c = cl._contact; if(c._s1 == shape || c._s2 == shape) { - var _this1 = cl._other; + let _this1 = cl._other; _this1._sleeping = false; _this1._sleepTime = 0; - var _this2 = _this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + let _this2 = _this._contactManager; + let prev = c._prev; + let next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this2._contactList) { _this2._contactList = _this2._contactList._next; @@ -36661,18 +36884,25 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { c._next = null; c._prev = null; if(c._touching) { - var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + let cc1 = c._s1._contactCallback; + let cc2 = c._s2._contactCallback; + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + let prev1 = c._link1._prev; + let next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -36682,13 +36912,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + let prev2 = c._link2._prev; + let next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -36712,7 +36942,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { c._cachedDetectorData._clear(); c._manifold._clear(); c._detector = null; - var _this3 = c._contactConstraint; + let _this3 = c._contactConstraint; _this3._s1 = null; _this3._s2 = null; _this3._b1 = null; @@ -36728,22 +36958,22 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { _this._numShapes--; } this.updateMass(); - var s = this._shapeList; + let s = this._shapeList; while(s != null) { - var n1 = s._next; - var tf1 = this._ptransform; - var tf2 = this._transform; - var dst = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = this._ptransform; + let tf2 = this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -36762,9 +36992,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; @@ -36774,17 +37004,17 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst._positionX += tf1._positionX; dst._positionY += tf1._positionY; dst._positionZ += tf1._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -36803,9 +37033,9 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; @@ -36815,12 +37045,12 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { dst1._positionX += tf2._positionX; dst1._positionY += tf2._positionY; dst1._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -36836,151 +37066,154 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s = n1; + s = n; } } - ,getType: function() { + getType() { return this._type; } - ,setType: function(type) { + setType(type) { this._type = type; this.updateMass(); } - ,wakeUp: function() { + wakeUp() { this._sleeping = false; this._sleepTime = 0; } - ,sleep: function() { + sleep() { this._sleeping = true; this._sleepTime = 0; } - ,isSleeping: function() { + isSleeping() { return this._sleeping; } - ,getSleepTime: function() { + getSleepTime() { return this._sleepTime; } - ,setAutoSleep: function(autoSleepEnabled) { + setAutoSleep(autoSleepEnabled) { this._autoSleep = autoSleepEnabled; this._sleeping = false; this._sleepTime = 0; } - ,getLinearDamping: function() { + getLinearDamping() { return this._linearDamping; } - ,setLinearDamping: function(damping) { + setLinearDamping(damping) { this._linearDamping = damping; } - ,getAngularDamping: function() { + getAngularDamping() { return this._angularDamping; } - ,setAngularDamping: function(damping) { + setAngularDamping(damping) { this._angularDamping = damping; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_rigidbody_RigidBodyConfig = function() { - this.position = new oimo_common_Vec3(); - this.rotation = new oimo_common_Mat3(); - this.linearVelocity = new oimo_common_Vec3(); - this.angularVelocity = new oimo_common_Vec3(); - this.type = 0; - this.autoSleep = true; - this.linearDamping = 0; - this.angularDamping = 0; -}; -var oimo_dynamics_rigidbody_RigidBodyType = function() { }; -var oimo_dynamics_rigidbody_Shape = function(config) { - this._id = -1; - this._localTransform = new oimo_common_Transform(); - this._ptransform = new oimo_common_Transform(); - this._transform = new oimo_common_Transform(); - var v = config.position; - this._localTransform._positionX = v.x; - this._localTransform._positionY = v.y; - this._localTransform._positionZ = v.z; - var m = config.rotation; - this._localTransform._rotation00 = m.e00; - this._localTransform._rotation01 = m.e01; - this._localTransform._rotation02 = m.e02; - this._localTransform._rotation10 = m.e10; - this._localTransform._rotation11 = m.e11; - this._localTransform._rotation12 = m.e12; - this._localTransform._rotation20 = m.e20; - this._localTransform._rotation21 = m.e21; - this._localTransform._rotation22 = m.e22; - var dst = this._ptransform; - var src = this._localTransform; - dst._positionX = src._positionX; - dst._positionY = src._positionY; - dst._positionZ = src._positionZ; - dst._rotation00 = src._rotation00; - dst._rotation01 = src._rotation01; - dst._rotation02 = src._rotation02; - dst._rotation10 = src._rotation10; - dst._rotation11 = src._rotation11; - dst._rotation12 = src._rotation12; - dst._rotation20 = src._rotation20; - dst._rotation21 = src._rotation21; - dst._rotation22 = src._rotation22; - var dst1 = this._transform; - var src1 = this._localTransform; - dst1._positionX = src1._positionX; - dst1._positionY = src1._positionY; - dst1._positionZ = src1._positionZ; - dst1._rotation00 = src1._rotation00; - dst1._rotation01 = src1._rotation01; - dst1._rotation02 = src1._rotation02; - dst1._rotation10 = src1._rotation10; - dst1._rotation11 = src1._rotation11; - dst1._rotation12 = src1._rotation12; - dst1._rotation20 = src1._rotation20; - dst1._rotation21 = src1._rotation21; - dst1._rotation22 = src1._rotation22; - this._restitution = config.restitution; - this._friction = config.friction; - this._density = config.density; - this._geom = config.geometry; - this._collisionGroup = config.collisionGroup; - this._collisionMask = config.collisionMask; - this._contactCallback = config.contactCallback; - this._aabb = new oimo_collision_geometry_Aabb(); - this._proxy = null; - this.displacement = new oimo_common_Vec3(); -}; -oimo_dynamics_rigidbody_Shape.prototype = { - getFriction: function() { +} +class oimo_dynamics_rigidbody_RigidBodyConfig { + constructor() { + this.position = new oimo_common_Vec3(); + this.rotation = new oimo_common_Mat3(); + this.linearVelocity = new oimo_common_Vec3(); + this.angularVelocity = new oimo_common_Vec3(); + this.type = 0; + this.autoSleep = true; + this.linearDamping = 0; + this.angularDamping = 0; + } +} +class oimo_dynamics_rigidbody_RigidBodyType { +} +class oimo_dynamics_rigidbody_Shape { + constructor(config) { + this._id = -1; + this._localTransform = new oimo_common_Transform(); + this._ptransform = new oimo_common_Transform(); + this._transform = new oimo_common_Transform(); + let v = config.position; + this._localTransform._positionX = v.x; + this._localTransform._positionY = v.y; + this._localTransform._positionZ = v.z; + let m = config.rotation; + this._localTransform._rotation00 = m.e00; + this._localTransform._rotation01 = m.e01; + this._localTransform._rotation02 = m.e02; + this._localTransform._rotation10 = m.e10; + this._localTransform._rotation11 = m.e11; + this._localTransform._rotation12 = m.e12; + this._localTransform._rotation20 = m.e20; + this._localTransform._rotation21 = m.e21; + this._localTransform._rotation22 = m.e22; + let dst = this._ptransform; + let src = this._localTransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + let dst1 = this._transform; + let src1 = this._localTransform; + dst1._positionX = src1._positionX; + dst1._positionY = src1._positionY; + dst1._positionZ = src1._positionZ; + dst1._rotation00 = src1._rotation00; + dst1._rotation01 = src1._rotation01; + dst1._rotation02 = src1._rotation02; + dst1._rotation10 = src1._rotation10; + dst1._rotation11 = src1._rotation11; + dst1._rotation12 = src1._rotation12; + dst1._rotation20 = src1._rotation20; + dst1._rotation21 = src1._rotation21; + dst1._rotation22 = src1._rotation22; + this._restitution = config.restitution; + this._friction = config.friction; + this._density = config.density; + this._geom = config.geometry; + this._collisionGroup = config.collisionGroup; + this._collisionMask = config.collisionMask; + this._contactCallback = config.contactCallback; + this._aabb = new oimo_collision_geometry_Aabb(); + this._proxy = null; + this.displacement = new oimo_common_Vec3(); + } + getFriction() { return this._friction; } - ,setFriction: function(friction) { + setFriction(friction) { this._friction = friction; } - ,getRestitution: function() { + getRestitution() { return this._restitution; } - ,setRestitution: function(restitution) { + setRestitution(restitution) { this._restitution = restitution; } - ,getLocalTransform: function() { - var _this = this._localTransform; - var tf = new oimo_common_Transform(); + getLocalTransform() { + let _this = this._localTransform; + let tf = new oimo_common_Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -36995,8 +37228,8 @@ oimo_dynamics_rigidbody_Shape.prototype = { tf._rotation22 = _this._rotation22; return tf; } - ,getLocalTransformTo: function(transform) { - var transform1 = this._localTransform; + getLocalTransformTo(transform) { + let transform1 = this._localTransform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -37010,9 +37243,9 @@ oimo_dynamics_rigidbody_Shape.prototype = { transform._rotation21 = transform1._rotation21; transform._rotation22 = transform1._rotation22; } - ,getTransform: function() { - var _this = this._transform; - var tf = new oimo_common_Transform(); + getTransform() { + let _this = this._transform; + let tf = new oimo_common_Transform(); tf._positionX = _this._positionX; tf._positionY = _this._positionY; tf._positionZ = _this._positionZ; @@ -37027,8 +37260,8 @@ oimo_dynamics_rigidbody_Shape.prototype = { tf._rotation22 = _this._rotation22; return tf; } - ,getTransformTo: function(transform) { - var transform1 = this._transform; + getTransformTo(transform) { + let transform1 = this._transform; transform._positionX = transform1._positionX; transform._positionY = transform1._positionY; transform._positionZ = transform1._positionZ; @@ -37042,8 +37275,8 @@ oimo_dynamics_rigidbody_Shape.prototype = { transform._rotation21 = transform1._rotation21; transform._rotation22 = transform1._rotation22; } - ,setLocalTransform: function(transform) { - var _this = this._localTransform; + setLocalTransform(transform) { + let _this = this._localTransform; _this._positionX = transform._positionX; _this._positionY = transform._positionY; _this._positionZ = transform._positionZ; @@ -37057,24 +37290,24 @@ oimo_dynamics_rigidbody_Shape.prototype = { _this._rotation21 = transform._rotation21; _this._rotation22 = transform._rotation22; if(this._rigidBody != null) { - var _this1 = this._rigidBody; - _this1.updateMass(); - var s = _this1._shapeList; + let _this = this._rigidBody; + _this.updateMass(); + let s = _this._shapeList; while(s != null) { - var n = s._next; - var tf1 = _this1._ptransform; - var tf2 = _this1._transform; - var dst = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = _this._ptransform; + let tf2 = _this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -37093,9 +37326,9 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; @@ -37105,17 +37338,17 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst._positionX += tf1._positionX; dst._positionY += tf1._positionY; dst._positionZ += tf1._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -37134,9 +37367,9 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; @@ -37146,12 +37379,12 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst1._positionX += tf2._positionX; dst1._positionY += tf2._positionY; dst1._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -37167,13 +37400,13 @@ oimo_dynamics_rigidbody_Shape.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -37183,30 +37416,30 @@ oimo_dynamics_rigidbody_Shape.prototype = { } } } - ,getDensity: function() { + getDensity() { return this._density; } - ,setDensity: function(density) { + setDensity(density) { this._density = density; if(this._rigidBody != null) { - var _this = this._rigidBody; + let _this = this._rigidBody; _this.updateMass(); - var s = _this._shapeList; + let s = _this._shapeList; while(s != null) { - var n = s._next; - var tf1 = _this._ptransform; - var tf2 = _this._transform; - var dst = s._ptransform; - var src1 = s._localTransform; - var __tmp__00; - var __tmp__01; - var __tmp__02; - var __tmp__10; - var __tmp__11; - var __tmp__12; - var __tmp__20; - var __tmp__21; - var __tmp__22; + let n = s._next; + let tf1 = _this._ptransform; + let tf2 = _this._transform; + let dst = s._ptransform; + let src1 = s._localTransform; + let __tmp__00; + let __tmp__01; + let __tmp__02; + let __tmp__10; + let __tmp__11; + let __tmp__12; + let __tmp__20; + let __tmp__21; + let __tmp__22; __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; @@ -37225,9 +37458,9 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst._rotation20 = __tmp__20; dst._rotation21 = __tmp__21; dst._rotation22 = __tmp__22; - var __tmp__X; - var __tmp__Y; - var __tmp__Z; + let __tmp__X; + let __tmp__Y; + let __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; @@ -37237,17 +37470,17 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst._positionX += tf1._positionX; dst._positionY += tf1._positionY; dst._positionZ += tf1._positionZ; - var dst1 = s._transform; - var src11 = s._localTransform; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; + let dst1 = s._transform; + let src11 = s._localTransform; + let __tmp__001; + let __tmp__011; + let __tmp__021; + let __tmp__101; + let __tmp__111; + let __tmp__121; + let __tmp__201; + let __tmp__211; + let __tmp__221; __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; @@ -37266,9 +37499,9 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst1._rotation20 = __tmp__201; dst1._rotation21 = __tmp__211; dst1._rotation22 = __tmp__221; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; + let __tmp__X1; + let __tmp__Y1; + let __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; @@ -37278,12 +37511,12 @@ oimo_dynamics_rigidbody_Shape.prototype = { dst1._positionX += tf2._positionX; dst1._positionY += tf2._positionY; dst1._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; - var maxZ; + let minX; + let minY; + let minZ; + let maxX; + let maxY; + let maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; minY = s._aabb._minY; @@ -37299,13 +37532,13 @@ oimo_dynamics_rigidbody_Shape.prototype = { s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; if(s._proxy != null) { - var dX; - var dY; - var dZ; + let dX; + let dY; + let dZ; dX = s._transform._positionX - s._ptransform._positionX; dY = s._transform._positionY - s._ptransform._positionY; dZ = s._transform._positionZ - s._ptransform._positionZ; - var v = s.displacement; + let v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; @@ -37315,55 +37548,63 @@ oimo_dynamics_rigidbody_Shape.prototype = { } } } - ,getAabb: function() { + getAabb() { return this._aabb.clone(); } - ,getAabbTo: function(aabb) { + getAabbTo(aabb) { aabb.copyFrom(this._aabb); } - ,getGeometry: function() { + getGeometry() { return this._geom; } - ,getRigidBody: function() { + getRigidBody() { return this._rigidBody; } - ,getCollisionGroup: function() { + getCollisionGroup() { return this._collisionGroup; } - ,setCollisionGroup: function(collisionGroup) { + setCollisionGroup(collisionGroup) { this._collisionGroup = collisionGroup; } - ,getCollisionMask: function() { + getCollisionMask() { return this._collisionMask; } - ,setCollisionMask: function(collisionMask) { + setCollisionMask(collisionMask) { this._collisionMask = collisionMask; } - ,getContactCallback: function() { + getContactCallback() { return this._contactCallback; } - ,setContactCallback: function(callback) { + setContactCallback(callback) { this._contactCallback = callback; } - ,getPrev: function() { + getPrev() { return this._prev; } - ,getNext: function() { + getNext() { return this._next; } -}; -var oimo_dynamics_rigidbody_ShapeConfig = function() { - this.position = new oimo_common_Vec3(); - this.rotation = new oimo_common_Mat3(); - this.friction = oimo_common_Setting.defaultFriction; - this.restitution = oimo_common_Setting.defaultRestitution; - this.density = oimo_common_Setting.defaultDensity; - this.collisionGroup = oimo_common_Setting.defaultCollisionGroup; - this.collisionMask = oimo_common_Setting.defaultCollisionMask; - this.geometry = null; - this.contactCallback = null; -}; -var oimo_m_M = function() { }; +} +class oimo_dynamics_rigidbody_ShapeConfig { + constructor() { + this.position = new oimo_common_Vec3(); + this.rotation = new oimo_common_Mat3(); + this.friction = oimo_common_Setting.defaultFriction; + this.restitution = oimo_common_Setting.defaultRestitution; + this.density = oimo_common_Setting.defaultDensity; + this.collisionGroup = oimo_common_Setting.defaultCollisionGroup; + this.collisionMask = oimo_common_Setting.defaultCollisionMask; + this.geometry = null; + this.contactCallback = null; + } +} +class oimo_m_M { +} +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +{ +} oimo_collision_broadphase_BroadPhaseType._BRUTE_FORCE = 1; oimo_collision_broadphase_BroadPhaseType._BVH = 2; oimo_collision_broadphase_BroadPhaseType.BRUTE_FORCE = 1; diff --git a/bin/js/OimoPhysics.min.js b/bin/js/OimoPhysics.min.js index a729854..d0a9b0b 100644 --- a/bin/js/OimoPhysics.min.js +++ b/bin/js/OimoPhysics.min.js @@ -1 +1,839 @@ -/* OimoPhysics 1.2.2 (c) 2020 saharan, The MIT License */ 'use strict';(function(){function Qj(){this.position=new n;this.rotation=new I;this.friction=F.defaultFriction;this.restitution=F.defaultRestitution;this.density=F.defaultDensity;this.collisionGroup=F.defaultCollisionGroup;this.collisionMask=F.defaultCollisionMask;this.contactCallback=this.geometry=null}function Ka(a){this.Ic=-1;this.ha=new Ua;this.ja=new Ua;this.a=new Ua;var b=a.position;this.ha.v=b.x;this.ha.A=b.y;this.ha.B=b.z;b=a.rotation;this.ha.o=b.e00;this.ha.f=b.e01;this.ha.h=b.e02;this.ha.i=b.e10;this.ha.m=b.e11;this.ha.j=b.e12;this.ha.l=b.e20;this.ha.g=b.e21;this.ha.s=b.e22;var b=this.ja,e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;b=this.a;e=this.ha;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Ak=a.restitution;this.pk=a.friction;this.Vk=a.density;this.Fb=a.geometry;this.kk=a.collisionGroup;this.lk=a.collisionMask;this.im=a.contactCallback;this.u=new eb;this.ub=null;this.mc=new n}function Qe(){}function Rj(){this.position=new n;this.rotation=new I;this.linearVelocity=new n;this.angularVelocity=new n;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0}function x(a){this.Yi=this.Gc=this.ia=this.M=null;this.Rg=0;this.ic=this.Mb=null;this.Ne=0;this.ff=this.Me=null;this.Ah=0;var b=a.linearVelocity;this.jb=b.x;this.kb=b.y;this.lb=b.z;b=a.angularVelocity;this.nb=b.x;this.ob=b.y;this.pb=b.z;this.jd=this.hd=this.gd=this.td=this.sd=this.rd=0;this.ja=new Ua;this.a=new Ua;b=a.position;this.ja.v=b.x;this.ja.A=b.y;this.ja.B=b.z;b=a.rotation;this.ja.o=b.e00;this.ja.f=b.e01;this.ja.h=b.e02;this.ja.i=b.e10;this.ja.m=b.e11;this.ja.j=b.e12;this.ja.l=b.e20;this.ja.g=b.e21;this.ja.s=b.e22;var b=this.a,e=this.ja;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;this.Jb=a.type;this.wb=0;this.Bb=!1;this.Tk=a.autoSleep;this.$=this.Z=this.Y=this.X=this.W=this.V=this.U=this.T=this.S=this.Si=this.Ri=this.Qi=this.Pi=this.Oi=this.Ni=this.Mi=this.Li=this.Ki=this.$a=this.Za=this.Ya=this.Xa=this.Wa=this.Va=this.Ua=this.Ta=this.Sa=this.ae=this.$d=this.Zd=this.Yd=this.Xd=this.Wd=this.Vd=this.Ud=this.Td=this.qb=this.Lf=0;this.sk=a.linearDamping;this.hk=a.angularDamping;this.th=this.sh=this.rh=this.yh=this.xh=this.wh=this.Qf=this.Pf=this.Of=this.ci=this.bi=this.ai=0;this.O=new n(1,1,1);this.lg=!1;this.vh=1;this.jc=null}function fj(){this.mass=0;this.localInertia=new I}function Rb(a){Ob.call(this);this.ga=a;this.info=new gj;this.Wb=Array(F.maxJacobianRows);a=0;for(var b=this.Wb.length;a>1&85);d=(d&51)+(d>>2&51);d=(d&15)+(d>>4&15);c=Array(d);for(f=0;fb.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20)?b=!0:(b=a.localBasis2,b=0>b.e00*(b.e11*b.e22-b.e12*b.e21)-b.e01*(b.e10*b.e22-b.e12*b.e20)+b.e02*(b.e10*b.e21-b.e11*b.e20));b&&console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:46:","[warning] joint basis must be right handed");var e,d,c,f,h,l,g,k,m,p,r,q,t,A,L,u,z;k=a.localBasis1;b=k.e00;e=k.e01;d=k.e02;c=k.e10;f=k.e11;h=k.e12;l=k.e20;g=k.e21;k=k.e22;z=a.localBasis2;m=z.e00;p=z.e01;r=z.e02;q=z.e10;t=z.e11;A=z.e12;L=z.e20;u=z.e21;z=z.e22;this.Ma=b;this.Na=c;this.Oa=l;this.sc=e;this.tc=f;this.uc=g;this.Pc=d;this.Qc=h;this.Rc=k;this.Sb=m;this.Tb=q;this.Ub=L;this.gi=p;this.hi=t;this.ii=u;this.nd=r;this.od=A;this.pd=z;this.cm=this.translationY=this.translationX=this.Bf=this.qh=this.Af=0;this.fk=this.ek=this.dk=!1;this.qg=Array(3);this.Rf=Array(3);this.pg=Array(3);this.Tg=Array(3);this.qg[0]=a.translationalLimitMotors[0].clone();this.qg[1]=a.translationalLimitMotors[1].clone();this.qg[2]=a.translationalLimitMotors[2].clone();this.Rf[0]=a.translationalSpringDampers[0].clone();this.Rf[1]=a.translationalSpringDampers[1].clone();this.Rf[2]=a.translationalSpringDampers[2].clone();this.pg[0]=a.rotationalLimitMotors[0].clone();this.pg[1]=a.rotationalLimitMotors[1].clone();this.pg[2]=a.rotationalLimitMotors[2].clone();this.Tg[0]=a.rotationalSpringDampers[0].clone();this.Tg[1]=a.rotationalSpringDampers[1].clone();this.Tg[2]=a.rotationalSpringDampers[2].clone()}function wf(){Gb.call(this);this.localAxis1=new n(1,0,0);this.localAxis2=new n(1,0,0);this.translationalLimitMotor=new tc;this.translationalSpringDamper=new Hb;this.rotationalLimitMotor=new $b;this.rotationalSpringDamper=new Hb}function Gb(){this.rigidBody2=this.rigidBody1=null;this.localAnchor1=new n;this.localAnchor2=new n;this.allowCollision=!1;this.solverType=F.defaultJointConstraintSolverType;this.positionCorrectionAlgorithm=F.defaultJointPositionCorrectionAlgorithm;this.breakTorque=this.breakForce=0}function Fb(a){N.call(this,a,2);var b=a.localAxis1;this.Ma=b.x;this.Na=b.y;this.Oa=b.z;b=a.localAxis2;this.Sb=b.x;this.Tb=b.y;this.Ub=b.z;this.Al();this.Yf=this.Xf=this.Bg=this.Se=this.Re=this.angle=0;this.N=new Ui(this);this.ul=a.translationalSpringDamper.clone();this.tl=a.translationalLimitMotor.clone();this.nl=a.rotationalSpringDamper.clone();this.ml=a.rotationalLimitMotor.clone()}function N(a,b){this.rb=new qc(this);this.sb=new qc(this);this.Sg=F.defaultJointPositionCorrectionAlgorithm;this.Jb=b;this.jc=null;this.C=a.rigidBody1;this.D=a.rigidBody2;this.Sk=a.allowCollision;this.nj=a.breakForce;this.oj=a.breakTorque;switch(a.solverType){case 0:this.Ck=new Rb(this);break;case 1:this.Ck=new Wb(this)}b=a.localAnchor1;this.sj=b.x;this.tj=b.y;this.uj=b.z;a=a.localAnchor2;this.vj=a.x;this.wj=a.y;this.xj=a.z;this.pd=this.od=this.nd=this.ii=this.hi=this.gi=this.Ub=this.Tb=this.Sb=this.Rc=this.Qc=this.Pc=this.uc=this.tc=this.sc=this.Oa=this.Na=this.Ma=this.zf=this.yf=this.xf=this.wf=this.vf=this.uf=this.fc=this.ec=this.dc=this.cc=this.bc=this.ac=0;this.Eb=Array(F.maxJacobianRows);a=0;for(b=F.maxJacobianRows;aa;){var b=a++,e=b&&4!=b?8:1;this.Nk[b]=Array(e);this.Yh[b]=Array(e);this.Pk[b]=Array(e);for(e=0;8>e;){var d=e++,c=.7853981633974475*b,f=.7853981633974475*d;this.Nk[b][d]=new n(Math.sin(c)*Math.cos(f),Math.cos(c),-Math.sin(c)*Math.sin(f));this.Yh[b][d]=new n;this.Pk[b][d]=new n}}this.Mj=Array(8);this.vm=Array(8);this.Ee=Array(8);this.af=Array(8);this.fg=Array(8);for(a=0;8>a;)b=a++,this.Mj[b]=new n(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.vm[b]=new n(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.Ee[b]=new n,this.af[b]=new n,this.fg[b]=new n;this.style=new wj}function hf(){this.position=new n;this.normal=new n;this.shape=null;this.fraction=1;this.position.R();this.normal.R();this.hit=!1}function Ni(){}function xj(){}function yj(){}function Vi(){this.u=new eb;this.sn=null}function ij(){this.dj=new Oi;this.Jj=new Ua;this.Bg=new n;this.R=new n;this.wm=this.Lj=null}function Pi(){this.dj=new Oi;this.Jj=new n;this.end=new n;this.Lj=null}function Ca(a,b){null==a&&(a=2);switch(a){case 1:this.hc=new pc;break;case 2:this.hc=new Kb}this.Hi=new De(this.hc);null==b&&(b=new n(0,-9.80665,0));this.Xk=new n(b.x,b.y,b.z);this.Ti=this.di=this.Xi=this.Nf=null;this.xk=this.jl=this.Rg=this.yj=0;this.ll=10;this.kl=5;this.zk=new Pi;this.qj=new ij;this.Qk=new Vi;this.Ng=new zj;this.hf=Array(F.islandInitialConstraintArraySize);this.Fh=Array(F.islandInitialRigidBodyArraySize);this.ji=new Aj;this.ra=new Nb;this.om=0}function Aj(){this.invDt=this.dt=0;this.dtRatio=1}function zj(){this.cg=Array(F.islandInitialRigidBodyArraySize);this.dg=Array(F.islandInitialConstraintArraySize);this.Xh=Array(F.islandInitialConstraintArraySize);this.Wh=Array(F.islandInitialConstraintArraySize);this.Oh=this.Ph=this.bg=this.ag=0}function De(a){this.hc=a;this.tn=new hi;this.Ui=0}function Zb(){this.ad=this.me=this.M=this.ia=null}function ac(){this.ia=this.M=null;this.rb=new Zb;this.sb=new Zb;this.$h=this.D=this.C=this.Fc=this.Ec=null;this.pj=new Bj;this.un=new jf;this.Bk=this.rk=!1;this.Ia=new Tb;this.qm=new uj(this.Ia);this.ef=new Uc(this.Ia);this.Hh=!1}function wa(a,b,e,d){null==d&&(d=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=d;wa.numCreations++}function Nb(){this.c=Array(256);this.b=0;this.bb=Array(256);this.cb=0;this.eg=Array(256);this.Ag=0;this.le=Array(256);this.re=0}function pa(){}function J(a,b,e,d,c,f,h,l,g,k,m,p,r,q,t,A){null==A&&(A=1);null==t&&(t=0);null==q&&(q=0);null==r&&(r=0);null==p&&(p=0);null==m&&(m=1);null==k&&(k=0);null==g&&(g=0);null==l&&(l=0);null==h&&(h=0);null==f&&(f=1);null==c&&(c=0);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=d;this.e10=c;this.e11=f;this.e12=h;this.e13=l;this.e20=g;this.e21=k;this.e22=m;this.e23=p;this.e30=r;this.e31=q;this.e32=t;this.e33=A;J.numCreations++}function I(a,b,e,d,c,f,h,l,g){null==g&&(g=1);null==l&&(l=0);null==h&&(h=0);null==f&&(f=0);null==c&&(c=1);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=d;this.e11=c;this.e12=f;this.e20=h;this.e21=l;this.e22=g;I.numCreations++}function Pc(){}function dc(){}function lb(){this.La=Array(4);this.eb=Array(4);this.ib=Array(4);this.Ij=Array(3);this.Ij[0]=new n(1,0,0);this.Ij[1]=new n(0,1,0);this.Ij[2]=new n(0,0,1);this.Jo=new n;this.Ko=new n;this.Co=new n;this.Bo=new n;this.Io=new Ua;this.La[0]=new n;this.eb[0]=new n;this.ib[0]=new n;this.La[1]=new n;this.eb[1]=new n;this.ib[1]=new n;this.La[2]=new n;this.eb[2]=new n;this.ib[2]=new n;this.La[3]=new n;this.eb[3]=new n;this.ib[3]=new n;this.dir=new n;this.closest=new n;this.closestPoint1=new n;this.closestPoint2=new n;this.ih=new Cj}function F(){}function Ua(){this.B=this.A=this.v=0;this.o=1;this.i=this.h=this.f=0;this.m=1;this.g=this.l=this.j=0;this.s=1}function n(a,b,e){null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;n.numCreations++}function Dj(){this.$l=new n}function te(){this.Rd=new n;this.eb=new n;this.ib=new n}function Ee(){this.id=++Ee.Kb;this.ia=this.M=null;this.wk=new n;this.sl=this.nk=0;this.Gj=!1;this.Ca=Array(3);this.Hb=Array(3);this.Ib=Array(3);this.zi=new n;this.Sc=Array(3);this.Sc[0]=1;this.Sc[1]=2;this.Sc[2]=0}function Cj(){this.Ca=Array(F.maxEPAVertices);this.Gi=new n;this.We=0;this.cd=this.Cd=null;this.Bh=0;this.jf=this.Qe=null}function ii(){this.oh=!1}function ji(a){this.oh=a}function ki(a){this.oh=a}function li(){this.oh=!1}function mi(){this.oh=!1}function Bj(){}function Ej(){this.gc=this.fd=this.Rj=this.w=0;this.Xb=Array(8);this.Gb=Array(8);this.Xb[0]=new kc;this.Gb[0]=new kc;this.Xb[1]=new kc;this.Gb[1]=new kc;this.Xb[2]=new kc;this.Gb[2]=new kc;this.Xb[3]=new kc;this.Gb[3]=new kc;this.Xb[4]=new kc;this.Gb[4]=new kc;this.Xb[5]=new kc;this.Gb[5]=new kc;this.Xb[6]=new kc;this.Gb[6]=new kc;this.Xb[7]=new kc;this.Gb[7]=new kc}function kc(){this.Ra=this.Qa=this.Pa=this.y=this.x=0}function ni(){this.oh=!1;this.Xg=new Ej}function lc(a){this.oh=a}function Fj(){this.position1=new n;this.position2=new n;this.id=this.depth=0}function jf(){this.numPoints=0;this.normal=new n;this.points=Array(F.maxManifoldPoints);this.incremental=!1;for(var a=0,b=F.maxManifoldPoints;a.2*a&&(this.Rb=.2*a)}function eb(){this.ma=this.la=this.ka=this.pa=this.oa=this.na=0}function Gj(){this.Nb=null;this.yk=0;this.Zi=new Hj;this.qf=this.zg=this.qd=null;this.zi=Array(1024)}function Hj(){this.mm=0;this.ik=!1}function Wi(a,b){Qc.call(this,a,b);this.ei=null;this.zh=!1}function oi(){this.ng=this.og=this.M=null;this.F=Array(2);this.Ja=0;this.Ea=null;this.P=0;this.ub=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function Kb(){ub.call(this,2);this.qk=!0;this.ye=new Gj;this.rf=Array(1024);this.$f=0}function pc(){ub.call(this,1);this.qk=!1}function ve(){this.Dh=this.Ch=null}function Qc(a,b){this.userData=a;this.Ic=b;this.M=this.ia=null;this.I=this.H=this.G=this.L=this.K=this.J=0}function pi(){}function we(){}function Xi(){Qa.call(this,-1);this.min=new n;this.max=new n}function jj(){Qa.call(this,-1)}function Qa(a){wc.call(this,a);this.Rb=F.defaultGJKMargin;this.rm=!1}function wc(a){this.Jb=a;this.Sf=0}function ub(a){this.Jb=a;this.Vi=0;this.pe=this.gf=this.Oe=null;this.qk=!1;this.Dj=0;this.Eh=null;this.lm=0;this.mk=new jj;this.u=new Xi;this.rg=new Ua;this.R=new n;this.dj=new Oi}function Ij(){}function gb(a,b){a=Object.create(a);for(var e in b)a[e]=b[e];b.toString!==Object.prototype.toString&&(a.toString=b.toString);return a}Ij.lc=function(){window.OIMO={};window.OIMO.DebugDraw=Mg;window.OIMO.BroadPhase=ub;ub.prototype.createProxy=ub.prototype.ni;ub.prototype.destroyProxy=ub.prototype.oi;ub.prototype.moveProxy=ub.prototype.Qd;ub.prototype.isOverlapping=ub.prototype.Kb;ub.prototype.collectPairs=ub.prototype.$i;ub.prototype.getProxyPairList=ub.prototype.wa;ub.prototype.isIncremental=ub.prototype.Cb;ub.prototype.getTestCount=ub.prototype.mb;ub.prototype.rayCast=ub.prototype.ke;ub.prototype.convexCast=ub.prototype.Vf;ub.prototype.aabbTest=ub.prototype.Ih;window.OIMO.Geometry=wc;wc.prototype.getType=wc.prototype.mb;wc.prototype.getVolume=wc.prototype.wa;wc.prototype.rayCast=wc.prototype.ke;window.OIMO.ConvexGeometry=Qa;Qa.prototype.getGjkMergin=Qa.prototype.Xn;Qa.prototype.setGjkMergin=Qa.prototype.Go;Qa.prototype.computeLocalSupportingVertex=Qa.prototype.he;Qa.prototype.rayCast=Qa.prototype.ke;window.OIMO.BroadPhaseProxyCallback=we;we.prototype.process=we.prototype.process;window.OIMO.BroadPhaseType=pi;window.OIMO.Proxy=Qc;Qc.prototype.getId=Qc.prototype.Cb;Qc.prototype.getFatAabb=Qc.prototype.wa;Qc.prototype.getFatAabbTo=Qc.prototype.mb;window.OIMO.ProxyPair=ve;ve.prototype.getProxy1=ve.prototype.wa;ve.prototype.getProxy2=ve.prototype.mb;ve.prototype.getNext=ve.prototype.Cb;window.OIMO.BruteForceBroadPhase=pc;pc.prototype.createProxy=pc.prototype.ni;pc.prototype.destroyProxy=pc.prototype.oi;pc.prototype.moveProxy=pc.prototype.Qd;pc.prototype.collectPairs=pc.prototype.$i;pc.prototype.rayCast=pc.prototype.ke;pc.prototype.convexCast=pc.prototype.Vf;pc.prototype.aabbTest=pc.prototype.Ih;window.OIMO.BvhBroadPhase=Kb;Kb.prototype.createProxy=Kb.prototype.ni;Kb.prototype.destroyProxy=Kb.prototype.oi;Kb.prototype.moveProxy=Kb.prototype.Qd;Kb.prototype.collectPairs=Kb.prototype.$i;Kb.prototype.rayCast=Kb.prototype.ke;Kb.prototype.convexCast=Kb.prototype.Vf;Kb.prototype.aabbTest=Kb.prototype.Ih;Kb.prototype.getTreeBalance=Kb.prototype.so;window.OIMO.Aabb=eb;eb.prototype.init=eb.prototype.Aa;eb.prototype.getMin=eb.prototype.Uc;eb.prototype.getMinTo=eb.prototype.Vc;eb.prototype.setMin=eb.prototype.ie;eb.prototype.getMax=eb.prototype.Dc;eb.prototype.getMaxTo=eb.prototype.Hc;eb.prototype.setMax=eb.prototype.vd;eb.prototype.getCenter=eb.prototype.Cb;eb.prototype.getCenterTo=eb.prototype.Kb;eb.prototype.getExtents=eb.prototype.kc;eb.prototype.getExtentsTo=eb.prototype.lc;eb.prototype.combine=eb.prototype.wa;eb.prototype.combined=eb.prototype.mb;eb.prototype.overlap=eb.prototype.Wc;eb.prototype.getIntersection=eb.prototype.wc;eb.prototype.getIntersectionTo=eb.prototype.xc;eb.prototype.copyFrom=eb.prototype.qe;eb.prototype.clone=eb.prototype.clone;window.OIMO.BoxGeometry=Hd;Hd.prototype.getHalfExtents=Hd.prototype.Yn;Hd.prototype.getHalfExtentsTo=Hd.prototype.Zn;Hd.prototype.computeLocalSupportingVertex=Hd.prototype.he;window.OIMO.CapsuleGeometry=Wc;Wc.prototype.getRadius=Wc.prototype.pi;Wc.prototype.getHalfHeight=Wc.prototype.Pj;Wc.prototype.computeLocalSupportingVertex=Wc.prototype.he;window.OIMO.ConeGeometry=Fe;Fe.prototype.getRadius=Fe.prototype.pi;Fe.prototype.getHalfHeight=Fe.prototype.Pj;Fe.prototype.computeLocalSupportingVertex=Fe.prototype.he;window.OIMO.ConvexHullGeometry=kf;kf.prototype.getVertices=kf.prototype.wo;kf.prototype.computeLocalSupportingVertex=kf.prototype.he;window.OIMO.CylinderGeometry=Qd;Qd.prototype.getRadius=Qd.prototype.pi;Qd.prototype.getHalfHeight=Qd.prototype.Pj;Qd.prototype.computeLocalSupportingVertex=Qd.prototype.he;window.OIMO.GeometryType=bc;window.OIMO.RayCastHit=Oi;window.OIMO.SphereGeometry=ue;ue.prototype.getRadius=ue.prototype.pi;ue.prototype.computeLocalSupportingVertex=ue.prototype.he;window.OIMO.CollisionMatrix=hi;hi.prototype.getDetector=hi.prototype.wa;window.OIMO.DetectorResult=jf;jf.prototype.getMaxDepth=jf.prototype.Em;jf.prototype.clear=jf.prototype.clear;window.OIMO.DetectorResultPoint=Fj;window.OIMO.Detector=lc;lc.prototype.detect=lc.prototype.zm;window.OIMO.BoxBoxDetector=ni;window.OIMO.CapsuleCapsuleDetector=mi;window.OIMO.GjkEpaDetector=li;window.OIMO.SphereBoxDetector=ki;window.OIMO.SphereCapsuleDetector=ji;window.OIMO.SphereSphereDetector=ii;window.OIMO.Vec3=n;n.prototype.init=n.prototype.Aa;n.prototype.zero=n.prototype.R;n.prototype.add=n.prototype.ie;n.prototype.add3=n.prototype.wa;n.prototype.addScaled=n.prototype.Cb;n.prototype.sub=n.prototype.cf;n.prototype.sub3=n.prototype.jg;n.prototype.scale=n.prototype.Ke;n.prototype.scale3=n.prototype.hg;n.prototype.dot=n.prototype.Ge;n.prototype.cross=n.prototype.kc;n.prototype.addEq=n.prototype.Fe;n.prototype.add3Eq=n.prototype.mb;n.prototype.addScaledEq=n.prototype.Kb;n.prototype.subEq=n.prototype.gg;n.prototype.sub3Eq=n.prototype.kg;n.prototype.scaleEq=n.prototype.bf;n.prototype.scale3Eq=n.prototype.ig;n.prototype.crossEq=n.prototype.lc;n.prototype.mulMat3=n.prototype.wc;n.prototype.mulMat4=n.prototype.Dc;n.prototype.mulTransform=n.prototype.Uc;n.prototype.mulMat3Eq=n.prototype.xc;n.prototype.mulMat4Eq=n.prototype.Hc;n.prototype.mulTransformEq=n.prototype.Vc;n.prototype.length=n.prototype.length;n.prototype.lengthSq=n.prototype.He;n.prototype.normalized=n.prototype.Je;n.prototype.normalize=n.prototype.Ie;n.prototype.negate=n.prototype.Wc;n.prototype.negateEq=n.prototype.vd;n.prototype.copyFrom=n.prototype.qe;n.prototype.clone=n.prototype.clone;n.prototype.toString=n.prototype.toString;window.OIMO.Transform=Ua;Ua.prototype.identity=Ua.prototype.rg;Ua.prototype.getPosition=Ua.prototype.Cb;Ua.prototype.getPositionTo=Ua.prototype.Kb;Ua.prototype.setPosition=Ua.prototype.Hc;Ua.prototype.translate=Ua.prototype.Wc;Ua.prototype.getRotation=Ua.prototype.kc;Ua.prototype.getRotationTo=Ua.prototype.lc;Ua.prototype.setRotation=Ua.prototype.Uc;Ua.prototype.setRotationXyz=Ua.prototype.Vc;Ua.prototype.rotate=Ua.prototype.wc;Ua.prototype.rotateXyz=Ua.prototype.xc;Ua.prototype.getOrientation=Ua.prototype.wa;Ua.prototype.getOrientationTo=Ua.prototype.mb;Ua.prototype.setOrientation=Ua.prototype.Dc;Ua.prototype.clone=Ua.prototype.clone;Ua.prototype.copyFrom=Ua.prototype.qe;window.OIMO.Setting=F;window.OIMO.GjkEpa=lb;lb.prototype.computeClosestPoints=lb.prototype.wa;lb.prototype.computeDistance=lb.prototype.mb;lb.prototype.convexCast=lb.prototype.Vf;lb.prototype.rayCast=lb.prototype.ke;lb.getInstance=lb.kc;window.OIMO.GjkEpaResultState=dc;window.OIMO.SimplexUtil=Pc;Pc.projectOrigin2=Pc.wc;Pc.projectOrigin3=Pc.xc;Pc.projectOrigin4=Pc.Dc;window.OIMO.Mat3=I;I.prototype.init=I.prototype.Aa;I.prototype.identity=I.prototype.rg;I.prototype.add=I.prototype.Dc;I.prototype.sub=I.prototype.ig;I.prototype.scale=I.prototype.gg;I.prototype.mul=I.prototype.He;I.prototype.addEq=I.prototype.Hc;I.prototype.subEq=I.prototype.jg;I.prototype.scaleEq=I.prototype.hg;I.prototype.mulEq=I.prototype.Ie;I.prototype.prependScale=I.prototype.bf;I.prototype.appendScale=I.prototype.Wc;I.prototype.prependRotation=I.prototype.Je;I.prototype.appendRotation=I.prototype.Uc;I.prototype.prependScaleEq=I.prototype.cf;I.prototype.appendScaleEq=I.prototype.vd;I.prototype.prependRotationEq=I.prototype.Ke;I.prototype.appendRotationEq=I.prototype.Vc;I.prototype.transpose=I.prototype.Di;I.prototype.transposeEq=I.prototype.Ei;I.prototype.determinant=I.prototype.ie;I.prototype.trace=I.prototype.ph;I.prototype.inverse=I.prototype.Fe;I.prototype.inverseEq=I.prototype.Ge;I.prototype.toArray=I.prototype.kg;I.prototype.copyFrom=I.prototype.qe;I.prototype.clone=I.prototype.clone;I.prototype.fromQuat=I.prototype.Cb;I.prototype.toQuat=I.prototype.gk;I.prototype.fromEulerXyz=I.prototype.mb;I.prototype.toEulerXyz=I.prototype.Fi;I.prototype.getRow=I.prototype.wc;I.prototype.getCol=I.prototype.kc;I.prototype.getRowTo=I.prototype.xc;I.prototype.getColTo=I.prototype.lc;I.prototype.fromRows=I.prototype.Kb;I.prototype.fromCols=I.prototype.wa;I.prototype.toString=I.prototype.toString;window.OIMO.Mat4=J;J.prototype.init=J.prototype.Aa;J.prototype.identity=J.prototype.rg;J.prototype.add=J.prototype.kc;J.prototype.sub=J.prototype.gg;J.prototype.scale=J.prototype.bf;J.prototype.mul=J.prototype.ie;J.prototype.addEq=J.prototype.lc;J.prototype.subEq=J.prototype.hg;J.prototype.scaleEq=J.prototype.cf;J.prototype.mulEq=J.prototype.Fe;J.prototype.prependScale=J.prototype.Je;J.prototype.appendScale=J.prototype.Dc;J.prototype.prependRotation=J.prototype.He;J.prototype.appendRotation=J.prototype.wc;J.prototype.prependTranslation=J.prototype.Ei;J.prototype.appendTranslation=J.prototype.wa;J.prototype.prependScaleEq=J.prototype.Ke;J.prototype.appendScaleEq=J.prototype.Hc;J.prototype.prependRotationEq=J.prototype.Ie;J.prototype.appendRotationEq=J.prototype.xc;J.prototype.prependTranslationEq=J.prototype.Fi;J.prototype.appendTranslationEq=J.prototype.mb;J.prototype.transpose=J.prototype.kg;J.prototype.transposeEq=J.prototype.ph;J.prototype.determinant=J.prototype.Uc;J.prototype.trace=J.prototype.jg;J.prototype.inverse=J.prototype.Wc;J.prototype.inverseEq=J.prototype.vd;J.prototype.lookAt=J.prototype.Kb;J.prototype.perspective=J.prototype.Ge;J.prototype.ortho=J.prototype.Di;J.prototype.toArray=J.prototype.ig;J.prototype.copyFrom=J.prototype.qe;J.prototype.fromMat3=J.prototype.Vc;J.prototype.fromTransform=J.prototype.Cb;J.prototype.clone=J.prototype.clone;J.prototype.toString=J.prototype.toString;window.OIMO.MathUtil=pa;pa.abs=pa.abs;pa.sin=pa.sin;pa.cos=pa.cos;pa.tan=pa.tan;pa.asin=pa.asin;pa.acos=pa.acos;pa.atan=pa.atan;pa.safeAsin=pa.ie;pa.safeAcos=pa.vd;pa.atan2=pa.atan2;pa.sqrt=pa.sqrt;pa.clamp=pa.Cb;pa.rand=pa.Hc;pa.randIn=pa.Uc;pa.randVec3In=pa.Wc;pa.randVec3=pa.Vc;window.OIMO.Pool=Nb;Nb.prototype.vec3=Nb.prototype.Dc;Nb.prototype.mat3=Nb.prototype.lc;Nb.prototype.mat4=Nb.prototype.wc;Nb.prototype.quat=Nb.prototype.xc;Nb.prototype.dispose=Nb.prototype.wa;Nb.prototype.disposeVec3=Nb.prototype.kc;Nb.prototype.disposeMat3=Nb.prototype.mb;Nb.prototype.disposeMat4=Nb.prototype.Cb;Nb.prototype.disposeQuat=Nb.prototype.Kb;window.OIMO.Quat=wa;wa.prototype.identity=wa.prototype.rg;wa.prototype.init=wa.prototype.Aa;wa.prototype.add=wa.prototype.wa;wa.prototype.sub=wa.prototype.Hc;wa.prototype.scale=wa.prototype.xc;wa.prototype.addEq=wa.prototype.mb;wa.prototype.subEq=wa.prototype.Uc;wa.prototype.scaleEq=wa.prototype.Dc;wa.prototype.length=wa.prototype.length;wa.prototype.lengthSq=wa.prototype.kc;wa.prototype.dot=wa.prototype.Cb;wa.prototype.normalized=wa.prototype.wc;wa.prototype.normalize=wa.prototype.lc;wa.prototype.setArc=wa.prototype.Vc;wa.prototype.slerp=wa.prototype.Wc;wa.prototype.copyFrom=wa.prototype.qe;wa.prototype.clone=wa.prototype.clone;wa.prototype.fromMat3=wa.prototype.Kb;wa.prototype.toMat3=wa.prototype.vd;wa.prototype.toString=wa.prototype.toString;window.OIMO.Contact=ac;ac.prototype.getShape1=ac.prototype.kc;ac.prototype.getShape2=ac.prototype.lc;ac.prototype.isTouching=ac.prototype.Kk;ac.prototype.getManifold=ac.prototype.mb;ac.prototype.getContactConstraint=ac.prototype.wa;ac.prototype.getPrev=ac.prototype.Kb;ac.prototype.getNext=ac.prototype.Cb;window.OIMO.ContactLink=Zb;Zb.prototype.getContact=Zb.prototype.wa;Zb.prototype.getOther=Zb.prototype.Cb;Zb.prototype.getPrev=Zb.prototype.Kb;Zb.prototype.getNext=Zb.prototype.mb;window.OIMO.ContactManager=De;De.prototype.getNumContacts=De.prototype.mb;De.prototype.getContactList=De.prototype.wa;window.OIMO.TimeStep=Aj;window.OIMO.World=Ca;Ca.prototype.step=Ca.prototype.Fe;Ca.prototype.addRigidBody=Ca.prototype.mb;Ca.prototype.removeRigidBody=Ca.prototype.Ge;Ca.prototype.addJoint=Ca.prototype.wa;Ca.prototype.removeJoint=Ca.prototype.bm;Ca.prototype.setDebugDraw=Ca.prototype.He;Ca.prototype.getDebugDraw=Ca.prototype.lc;Ca.prototype.debugDraw=Ca.prototype.Cb;Ca.prototype.rayCast=Ca.prototype.ke;Ca.prototype.convexCast=Ca.prototype.Vf;Ca.prototype.aabbTest=Ca.prototype.Ih;Ca.prototype.getRigidBodyList=Ca.prototype.vd;Ca.prototype.getJointList=Ca.prototype.xc;Ca.prototype.getBroadPhase=Ca.prototype.Kb;Ca.prototype.getContactManager=Ca.prototype.kc;Ca.prototype.getNumRigidBodies=Ca.prototype.Vc;Ca.prototype.getNumJoints=Ca.prototype.Hc;Ca.prototype.getNumShapes=Ca.prototype.ie;Ca.prototype.getNumIslands=Ca.prototype.Dc;Ca.prototype.getNumVelocityIterations=Ca.prototype.Wc;Ca.prototype.setNumVelocityIterations=Ca.prototype.Ke;Ca.prototype.getNumPositionIterations=Ca.prototype.Uc;Ca.prototype.setNumPositionIterations=Ca.prototype.Je;Ca.prototype.getGravity=Ca.prototype.wc;Ca.prototype.setGravity=Ca.prototype.Ie;window.OIMO.AabbTestCallback=yj;window.OIMO.ContactCallback=xj;window.OIMO.RayCastCallback=Ni;window.OIMO.RayCastClosest=hf;hf.prototype.clear=hf.prototype.clear;hf.prototype.process=hf.prototype.process;window.OIMO.DebugDrawStyle=wj;window.OIMO.Performance=Ce;window.OIMO.ConstraintSolver=Ob;Ob.prototype.preSolveVelocity=Ob.prototype.Qh;Ob.prototype.warmStart=Ob.prototype.Zh;Ob.prototype.solveVelocity=Ob.prototype.Vh;Ob.prototype.postSolveVelocity=Ob.prototype.cj;Ob.prototype.preSolvePosition=Ob.prototype.jh;Ob.prototype.solvePositionSplitImpulse=Ob.prototype.Uh;Ob.prototype.solvePositionNgs=Ob.prototype.Th;Ob.prototype.postSolve=Ob.prototype.postSolve;window.OIMO.PositionCorrectionAlgorithm=jc;window.OIMO.ContactConstraint=Uc;Uc.prototype.getShape1=Uc.prototype.mb;Uc.prototype.getShape2=Uc.prototype.Cb;Uc.prototype.getManifold=Uc.prototype.wa;Uc.prototype.isTouching=Uc.prototype.Kk;window.OIMO.Manifold=Tb;Tb.prototype.getNormal=Tb.prototype.Cb;Tb.prototype.getNormalTo=Tb.prototype.Kb;Tb.prototype.getTangent=Tb.prototype.wc;Tb.prototype.getTangentTo=Tb.prototype.xc;Tb.prototype.getBinormal=Tb.prototype.wa;Tb.prototype.getBinormalTo=Tb.prototype.mb;Tb.prototype.getPoints=Tb.prototype.lc;Tb.prototype.getNumPoints=Tb.prototype.kc;window.OIMO.ManifoldPoint=Lb;Lb.prototype.getPosition1=Lb.prototype.Kb;Lb.prototype.getPosition1To=Lb.prototype.kc;Lb.prototype.getPosition2=Lb.prototype.lc;Lb.prototype.getPosition2To=Lb.prototype.wc;Lb.prototype.getDepth=Lb.prototype.mb;Lb.prototype.isWarmStarted=Lb.prototype.Dc;Lb.prototype.getNormalImpulse=Lb.prototype.Cb;Lb.prototype.getTangentImpulse=Lb.prototype.xc;Lb.prototype.getBinormalImpulse=Lb.prototype.wa;Lb.prototype.isEnabled=Lb.prototype.Hc;window.OIMO.Joint=N;N.prototype.getRigidBody1=N.prototype.Ke;N.prototype.getRigidBody2=N.prototype.bf;N.prototype.getType=N.prototype.hg;N.prototype.getAnchor1=N.prototype.mb;N.prototype.getAnchor2=N.prototype.Kb;N.prototype.getAnchor1To=N.prototype.Cb;N.prototype.getAnchor2To=N.prototype.kc;N.prototype.getLocalAnchor1=N.prototype.Fe;N.prototype.getLocalAnchor2=N.prototype.He;N.prototype.getLocalAnchor1To=N.prototype.Ge;N.prototype.getLocalAnchor2To=N.prototype.Ie;N.prototype.getBasis1=N.prototype.Hc;N.prototype.getBasis2=N.prototype.Vc;N.prototype.getBasis1To=N.prototype.Uc;N.prototype.getBasis2To=N.prototype.Wc;N.prototype.getAllowCollision=N.prototype.wa;N.prototype.setAllowCollision=N.prototype.ig;N.prototype.getBreakForce=N.prototype.vd;N.prototype.setBreakForce=N.prototype.jg;N.prototype.getBreakTorque=N.prototype.ie;N.prototype.setBreakTorque=N.prototype.kg;N.prototype.getPositionCorrectionAlgorithm=N.prototype.Je;N.prototype.setPositionCorrectionAlgorithm=N.prototype.ph;N.prototype.getAppliedForce=N.prototype.lc;N.prototype.getAppliedForceTo=N.prototype.wc;N.prototype.getAppliedTorque=N.prototype.xc;N.prototype.getAppliedTorqueTo=N.prototype.Dc;N.prototype.getPrev=N.prototype.gg;N.prototype.getNext=N.prototype.cf;window.OIMO.CylindricalJoint=Fb;Fb.prototype.getAxis1=Fb.prototype.Zg;Fb.prototype.getAxis2=Fb.prototype.ah;Fb.prototype.getAxis1To=Fb.prototype.$g;Fb.prototype.getAxis2To=Fb.prototype.bh;Fb.prototype.getLocalAxis1=Fb.prototype.dh;Fb.prototype.getLocalAxis2=Fb.prototype.fh;Fb.prototype.getLocalAxis1To=Fb.prototype.eh;Fb.prototype.getLocalAxis2To=Fb.prototype.gh;Fb.prototype.getTranslationalSpringDamper=Fb.prototype.po;Fb.prototype.getRotationalSpringDamper=Fb.prototype.eo;Fb.prototype.getTranslationalLimitMotor=Fb.prototype.no;Fb.prototype.getRotationalLimitMotor=Fb.prototype.bo;Fb.prototype.getAngle=Fb.prototype.Gl;Fb.prototype.getTranslation=Fb.prototype.Jl;window.OIMO.JointConfig=Gb;window.OIMO.CylindricalJointConfig=wf;wf.prototype.init=wf.prototype.Aa;window.OIMO.GenericJoint=Sb;Sb.prototype.getAxisX=Sb.prototype.Un;Sb.prototype.getAxisY=Sb.prototype.Vn;Sb.prototype.getAxisZ=Sb.prototype.Wn;Sb.prototype.getTranslationalSpringDampers=Sb.prototype.qo;Sb.prototype.getRotationalSpringDampers=Sb.prototype.fo;Sb.prototype.getTranslationalLimitMotors=Sb.prototype.oo;Sb.prototype.getRotationalLimitMotors=Sb.prototype.co;Sb.prototype.getAngles=Sb.prototype.Tn;Sb.prototype.getTranslations=Sb.prototype.ro;window.OIMO.GenericJointConfig=Lg;Lg.prototype.init=Lg.prototype.Aa;window.OIMO.JointLink=qc;qc.prototype.getContact=qc.prototype.wa;qc.prototype.getOther=qc.prototype.Cb;qc.prototype.getPrev=qc.prototype.Kb;qc.prototype.getNext=qc.prototype.mb;window.OIMO.JointType=Mb;window.OIMO.PrismaticJoint=Jb;Jb.prototype.getAxis1=Jb.prototype.Zg;Jb.prototype.getAxis2=Jb.prototype.ah;Jb.prototype.getAxis1To=Jb.prototype.$g;Jb.prototype.getAxis2To=Jb.prototype.bh;Jb.prototype.getLocalAxis1=Jb.prototype.dh;Jb.prototype.getLocalAxis2=Jb.prototype.fh;Jb.prototype.getLocalAxis1To=Jb.prototype.eh;Jb.prototype.getLocalAxis2To=Jb.prototype.gh;Jb.prototype.getSpringDamper=Jb.prototype.Qj;Jb.prototype.getLimitMotor=Jb.prototype.Il;Jb.prototype.getTranslation=Jb.prototype.Jl;window.OIMO.PrismaticJointConfig=Kg;Kg.prototype.init=Kg.prototype.Aa;window.OIMO.RagdollJoint=pb;pb.prototype.getAxis1=pb.prototype.Zg;pb.prototype.getAxis2=pb.prototype.ah;pb.prototype.getAxis1To=pb.prototype.$g;pb.prototype.getAxis2To=pb.prototype.bh;pb.prototype.getLocalAxis1=pb.prototype.dh;pb.prototype.getLocalAxis2=pb.prototype.fh;pb.prototype.getLocalAxis1To=pb.prototype.eh;pb.prototype.getLocalAxis2To=pb.prototype.gh;pb.prototype.getTwistSpringDamper=pb.prototype.vo;pb.prototype.getTwistLimitMotor=pb.prototype.uo;pb.prototype.getSwingSpringDamper=pb.prototype.mo;pb.prototype.getSwingAxis=pb.prototype.ko;pb.prototype.getSwingAxisTo=pb.prototype.lo;pb.prototype.getSwingAngle=pb.prototype.jo;pb.prototype.getTwistAngle=pb.prototype.to;window.OIMO.RagdollJointConfig=Jg;Jg.prototype.init=Jg.prototype.Aa;window.OIMO.RevoluteJoint=Qb;Qb.prototype.getAxis1=Qb.prototype.Zg;Qb.prototype.getAxis2=Qb.prototype.ah;Qb.prototype.getAxis1To=Qb.prototype.$g;Qb.prototype.getAxis2To=Qb.prototype.bh;Qb.prototype.getLocalAxis1=Qb.prototype.dh;Qb.prototype.getLocalAxis2=Qb.prototype.fh;Qb.prototype.getLocalAxis1To=Qb.prototype.eh;Qb.prototype.getLocalAxis2To=Qb.prototype.gh;Qb.prototype.getSpringDamper=Qb.prototype.Qj;Qb.prototype.getLimitMotor=Qb.prototype.Il;Qb.prototype.getAngle=Qb.prototype.Gl;window.OIMO.RevoluteJointConfig=ff;ff.prototype.init=ff.prototype.Aa;window.OIMO.RotationalLimitMotor=$b;$b.prototype.setLimits=$b.prototype.mh;$b.prototype.setMotor=$b.prototype.wa;$b.prototype.clone=$b.prototype.clone;window.OIMO.SphericalJoint=se;se.prototype.getSpringDamper=se.prototype.Qj;window.OIMO.SphericalJointConfig=Lf;Lf.prototype.init=Lf.prototype.Aa;window.OIMO.SpringDamper=Hb;Hb.prototype.setSpring=Hb.prototype.wa;Hb.prototype.setSymplecticEuler=Hb.prototype.mb;Hb.prototype.clone=Hb.prototype.clone;window.OIMO.TranslationalLimitMotor=tc;tc.prototype.setLimits=tc.prototype.mh;tc.prototype.setMotor=tc.prototype.wa;tc.prototype.clone=tc.prototype.clone;window.OIMO.UniversalJoint=Bb;Bb.prototype.getAxis1=Bb.prototype.Zg;Bb.prototype.getAxis2=Bb.prototype.ah;Bb.prototype.getAxis1To=Bb.prototype.$g;Bb.prototype.getAxis2To=Bb.prototype.bh;Bb.prototype.getLocalAxis1=Bb.prototype.dh;Bb.prototype.getLocalAxis2=Bb.prototype.fh;Bb.prototype.getLocalAxis1To=Bb.prototype.eh;Bb.prototype.getLocalAxis2To=Bb.prototype.gh;Bb.prototype.getSpringDamper1=Bb.prototype.ho;Bb.prototype.getSpringDamper2=Bb.prototype.io;Bb.prototype.getLimitMotor1=Bb.prototype.$n;Bb.prototype.getLimitMotor2=Bb.prototype.ao;Bb.prototype.getAngle1=Bb.prototype.Rn;Bb.prototype.getAngle2=Bb.prototype.Sn;window.OIMO.UniversalJointConfig=Kf;Kf.prototype.init=Kf.prototype.Aa;window.OIMO.ConstraintSolverType=vf;window.OIMO.DirectJointConstraintSolver=Wb;Wb.prototype.preSolveVelocity=Wb.prototype.Qh;Wb.prototype.warmStart=Wb.prototype.Zh;Wb.prototype.solveVelocity=Wb.prototype.Vh;Wb.prototype.postSolveVelocity=Wb.prototype.cj;Wb.prototype.preSolvePosition=Wb.prototype.jh;Wb.prototype.solvePositionSplitImpulse=Wb.prototype.Uh;Wb.prototype.solvePositionNgs=Wb.prototype.Th;Wb.prototype.postSolve=Wb.prototype.postSolve;window.OIMO.PgsContactConstraintSolver=Pb;Pb.prototype.preSolveVelocity=Pb.prototype.Qh;Pb.prototype.warmStart=Pb.prototype.Zh;Pb.prototype.solveVelocity=Pb.prototype.Vh;Pb.prototype.preSolvePosition=Pb.prototype.jh;Pb.prototype.solvePositionSplitImpulse=Pb.prototype.Uh;Pb.prototype.solvePositionNgs=Pb.prototype.Th;Pb.prototype.postSolve=Pb.prototype.postSolve;window.OIMO.PgsJointConstraintSolver=Rb;Rb.prototype.preSolveVelocity=Rb.prototype.Qh;Rb.prototype.warmStart=Rb.prototype.Zh;Rb.prototype.solveVelocity=Rb.prototype.Vh;Rb.prototype.postSolveVelocity=Rb.prototype.cj;Rb.prototype.preSolvePosition=Rb.prototype.jh;Rb.prototype.solvePositionSplitImpulse=Rb.prototype.Uh;Rb.prototype.solvePositionNgs=Rb.prototype.Th;Rb.prototype.postSolve=Rb.prototype.postSolve;window.OIMO.MassData=fj;window.OIMO.RigidBody=x;x.prototype.getPosition=x.prototype.Om;x.prototype.getPositionTo=x.prototype.Pm;x.prototype.setPosition=x.prototype.Po;x.prototype.translate=x.prototype.cn;x.prototype.getRotation=x.prototype.Vm;x.prototype.getRotationTo=x.prototype.Wm;x.prototype.setRotation=x.prototype.Qo;x.prototype.setRotationXyz=x.prototype.Ro;x.prototype.rotate=x.prototype.Ho;x.prototype.rotateXyz=x.prototype.Mo;x.prototype.getOrientation=x.prototype.Mm;x.prototype.getOrientationTo=x.prototype.Nm;x.prototype.setOrientation=x.prototype.No;x.prototype.getTransform=x.prototype.Xm;x.prototype.getTransformTo=x.prototype.Ym;x.prototype.setTransform=x.prototype.So;x.prototype.getMass=x.prototype.ph;x.prototype.getLocalInertia=x.prototype.cf;x.prototype.getLocalInertiaTo=x.prototype.gg;x.prototype.getMassData=x.prototype.Di;x.prototype.getMassDataTo=x.prototype.Ei;x.prototype.setMassData=x.prototype.ln;x.prototype.getRotationFactor=x.prototype.fm;x.prototype.setRotationFactor=x.prototype.mn;x.prototype.getLinearVelocity=x.prototype.Ke;x.prototype.getLinearVelocityTo=x.prototype.bf;x.prototype.setLinearVelocity=x.prototype.kn;x.prototype.getAngularVelocity=x.prototype.Wc;x.prototype.getAngularVelocityTo=x.prototype.vd;x.prototype.setAngularVelocity=x.prototype.fn;x.prototype.addLinearVelocity=x.prototype.mb;x.prototype.addAngularVelocity=x.prototype.wa;x.prototype.applyImpulse=x.prototype.wc;x.prototype.applyLinearImpulse=x.prototype.xc;x.prototype.applyAngularImpulse=x.prototype.Kb;x.prototype.applyForce=x.prototype.kc;x.prototype.applyForceToCenter=x.prototype.lc;x.prototype.applyTorque=x.prototype.Dc;x.prototype.getLinearContactImpulse=x.prototype.He;x.prototype.getLinearContactImpulseTo=x.prototype.Ie;x.prototype.getAngularContactImpulse=x.prototype.Hc;x.prototype.getAngularContactImpulseTo=x.prototype.Uc;x.prototype.getGravityScale=x.prototype.Fe;x.prototype.setGravityScale=x.prototype.hn;x.prototype.getLocalPoint=x.prototype.hg;x.prototype.getLocalPointTo=x.prototype.ig;x.prototype.getLocalVector=x.prototype.jg;x.prototype.getLocalVectorTo=x.prototype.kg;x.prototype.getWorldPoint=x.prototype.um;x.prototype.getWorldPointTo=x.prototype.ym;x.prototype.getWorldVector=x.prototype.Am;x.prototype.getWorldVectorTo=x.prototype.Bm;x.prototype.getNumShapes=x.prototype.Jm;x.prototype.getShapeList=x.prototype.sm;x.prototype.getNumContectLinks=x.prototype.Fi;x.prototype.getContactLinkList=x.prototype.ie;x.prototype.getNumJointLinks=x.prototype.gk;x.prototype.getJointLinkList=x.prototype.Ge;x.prototype.addShape=x.prototype.Cb;x.prototype.removeShape=x.prototype.dn;x.prototype.getType=x.prototype.Eo;x.prototype.setType=x.prototype.nn;x.prototype.wakeUp=x.prototype.pn;x.prototype.sleep=x.prototype.on;x.prototype.isSleeping=x.prototype.Dm;x.prototype.getSleepTime=x.prototype.tm;x.prototype.setAutoSleep=x.prototype.gn;x.prototype.getLinearDamping=x.prototype.Je;x.prototype.setLinearDamping=x.prototype.jn;x.prototype.getAngularDamping=x.prototype.Vc;x.prototype.setAngularDamping=x.prototype.en;x.prototype.getPrev=x.prototype.Um;x.prototype.getNext=x.prototype.Im;window.OIMO.RigidBodyConfig=Rj;window.OIMO.RigidBodyType=Qe;window.OIMO.Shape=Ka;Ka.prototype.getFriction=Ka.prototype.wc;Ka.prototype.setFriction=Ka.prototype.Ke;Ka.prototype.getRestitution=Ka.prototype.Uc;Ka.prototype.setRestitution=Ka.prototype.cf;Ka.prototype.getLocalTransform=Ka.prototype.Dc;Ka.prototype.getLocalTransformTo=Ka.prototype.Hc;Ka.prototype.getTransform=Ka.prototype.ie;Ka.prototype.getTransformTo=Ka.prototype.Fe;Ka.prototype.setLocalTransform=Ka.prototype.bf;Ka.prototype.getDensity=Ka.prototype.lc;Ka.prototype.setDensity=Ka.prototype.Je;Ka.prototype.getAabb=Ka.prototype.wa;Ka.prototype.getAabbTo=Ka.prototype.mb;Ka.prototype.getGeometry=Ka.prototype.xc;Ka.prototype.getRigidBody=Ka.prototype.Vc;Ka.prototype.getCollisionGroup=Ka.prototype.Cb;Ka.prototype.setCollisionGroup=Ka.prototype.Ge;Ka.prototype.getCollisionMask=Ka.prototype.Kb;Ka.prototype.setCollisionMask=Ka.prototype.He;Ka.prototype.getContactCallback=Ka.prototype.kc;Ka.prototype.setContactCallback=Ka.prototype.Ie;Ka.prototype.getPrev=Ka.prototype.vd;Ka.prototype.getNext=Ka.prototype.Wc;window.OIMO.ShapeConfig=Qj};ub.prototype={ni:function(){return null},oi:function(){},Qd:function(){},Kb:function(a,b){return a.Jb.J&&a.Kb.K&&a.Lb.L:!1},$i:function(){},wa:function(){return this.pe},Cb:function(){return this.qk},mb:function(){return this.Dj},ke:function(){},Vf:function(){},Ih:function(){}};wc.prototype={Xe:function(){},Lb:function(){},Wi:function(){return!1},mb:function(){return this.Jb},wa:function(){return this.Sf},ke:function(a,b,e,d){var c,f,h,l;c=a.x;f=a.y;a=a.z;h=b.x;l=b.y;b=b.z;c-=e.v;f-=e.A;a-=e.B;h-=e.v;l-=e.A;b-=e.B;if(this.Wi(e.o*c+e.i*f+e.l*a,e.f*c+e.m*f+e.g*a,e.h*c+e.j*f+e.s*a,e.o*h+e.i*l+e.l*b,e.f*h+e.m*l+e.g*b,e.h*h+e.j*l+e.s*b,d)){var g,k;b=d.position;c=b.x;f=b.y;h=b.z;b=d.normal;l=b.x;g=b.y;k=b.z;var m,p;m=e.o*c+e.f*f+e.h*h;p=e.i*c+e.m*f+e.j*h;h=e.l*c+e.g*f+e.s*h;b=e.o*l+e.f*g+e.h*k;a=e.i*l+e.m*g+e.j*k;l=e.l*l+e.g*g+e.s*k;c=m+e.v;f=p+e.A;h+=e.B;e=d.position;e.x=c;e.y=f;e.z=h;d=d.normal;d.x=b;d.y=a;d.z=l;return!0}return!1}};Qa.wa=wc;Qa.prototype=gb(wc.prototype,{Xn:function(){return this.Rb},Go:function(a){0>a&&(a=0);this.Rb=a},he:function(){},ke:function(a,b,e,d){return this.rm?lb.mb.ke(this,e,a,b,d):wc.prototype.ke.call(this,a,b,e,d)}});jj.wa=Qa;jj.prototype=gb(Qa.prototype,{Aa:function(a,b,e){this.Kn=a;var d,c,f;d=e.x;c=e.y;f=e.z;var h;e=b.o*d+b.i*c+b.l*f;h=b.f*d+b.m*c+b.g*f;b=b.h*d+b.j*c+b.s*f;d=this.Xl=new n;d.x=e;d.y=h;d.z=b;this.Rb=a.Rb},he:function(a,b){this.Kn.he(a,b);var e=this.Xl;0e.J&&a.Ke.K&&a.Le.L){var c=this.Eh;null!=c?(this.Eh=c.M,c.M=null):c=new ve;null!=this.pe&&(c.M=this.pe);this.pe=c;c.Ch=a;c.Dh=e}e=d}a=b}},ke:function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;for(var l=this.Oe;null!=l;){var g=l.M,k=d,m=c,p=a,r=f,q=h,t=b,A=l.J,L=l.K,u=l.L,z=l.G,n=l.H,D=l.I;if(A>(k>r?k:r)||z<(k(m>q?m:q)||n<(m(p>t?p:t)||D<(pr?-r:r,y=0>q?-q:q,B=0>Ib?-Ib:Ib,E=.5*(z-A),K=.5*(n-L),H=.5*(D-u),k=k-.5*(z+A),m=m-.5*(n+L),p=p-.5*(D+u),u=m*Ib-p*q;0<(0>u?-u:u)-(K*B+H*y)?p=!0:(p=p*r-k*Ib,p=0<(0>p?-p:p)-(H*t+E*B));p?r=!0:(r=k*q-m*r,r=0<(0>r?-r:r)-(E*y+K*t));r=r?!1:!0}r&&e.process(l);l=g}},Vf:function(a,b,e,d){for(var c=this.Oe;null!=c;){var f=c.M,h=this.u.min;h.x=c.J;h.y=c.K;h.z=c.L;h=this.u.max;h.x=c.G;h.y=c.H;h.z=c.I;this.mk.Aa(a,b,e);h=lb.mb;0==h.Nj(this.mk,this.u,b,this.rg,null,!1)&&0>=h.distance&&d.process(c);c=f}},Ih:function(a,b){for(var e=this.Oe;null!=e;){var d=e.M;a.nae.J&&a.oae.K&&a.pae.L&&b.process(e);e=d}}});Kb.wa=ub;Kb.prototype=gb(ub.prototype,{Kh:function(a,b){this.Dj++;var e=0==a.P,d=0==b.P;a==b?e||(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):a.Jb.J&&a.Kb.K&&a.Lb.L&&(e&&d?(e=this.Eh,null!=e?(this.Eh=e.M,e.M=null):e=new ve,null!=this.pe&&(e.M=this.pe),this.pe=e,e.Ch=a.ub,e.Dh=b.ub):d||a.P>b.P?(this.Kh(a.F[0],b),this.Kh(a.F[1],b)):(this.Kh(b.F[0],a),this.Kh(b.F[1],a)))},am:function(a,b,e,d,c,f,h,l){var g=a.J,k=a.K,m=a.L,p=a.G,r=a.H,q=a.I,t;if(g>(b>c?b:c)||p<(b(e>f?e:f)||r<(e(d>h?d:h)||q<(dA?-A:A;var z=0>L?-L:L,n=0>u?-u:u,D=.5*(p-g),Ib=.5*(r-k),y=.5*(q-m),g=b-.5*(p+g),k=e-.5*(r+k),m=d-.5*(q+m),q=k*u-m*L;0<(0>q?-q:q)-(Ib*n+y*z)?n=!0:(u=m*A-g*u,n=0<(0>u?-u:u)-(y*t+D*n));n?t=!0:(A=g*L-k*A,t=0<(0>A?-A:A)-(D*z+Ib*t));t=t?!1:!0}t&&(0==a.P?l.process(a.ub):(this.am(a.F[0],b,e,d,c,f,h,l),this.am(a.F[1],b,e,d,c,f,h,l)))},El:function(a,b,e,d,c){var f=this.u.min;f.x=a.J;f.y=a.K;f.z=a.L;f=this.u.max;f.x=a.G;f.y=a.H;f.z=a.I;this.mk.Aa(b,e,d);f=lb.mb;0==f.Nj(this.mk,this.u,e,this.rg,null,!1)&&0>=f.distance&&(0==a.P?c.process(a.ub):(this.El(a.F[0],b,e,d,c),this.El(a.F[1],b,e,d,c)))},yl:function(a,b,e){a.Jb.na&&a.Kb.oa&&a.Lb.pa&&(0==a.P?e.process(a.ub):(this.yl(a.F[0],b,e),this.yl(a.F[1],b,e)))},ni:function(a,b){a=new Wi(a,this.lm++);this.Vi++;null==this.Oe?this.Oe=a:(this.gf.M=a,a.ia=this.gf);this.gf=a;a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;b=this.ye;var e=b.qd;null!=e?(b.qd=e.M,e.M=null):e=new oi;var d=e;d.ub=a;a.ei=d;d.J=a.J;d.K=a.K;d.L=a.L;d.G=a.G;d.H=a.H;d.I=a.I;b.yk++;null==b.zg?b.zg=d:(b.qf.ng=d,d.og=b.qf);b.qf=d;if(null==b.Nb)b.Nb=d;else{for(var c=b.Nb;0e.P)){var d=e.Ea,f=e.F[0],h=e.F[1],l=f.P-h.P,c=e.Ja;1l.P?(f.F[1]=e,e.Ea=f,e.Ja=1,e.F[0]=l,l.Ea=e,l.Ja=0):(f.F[0]=e,e.Ea=f,e.Ja=0,e.F[0]=h,h.Ea=e,h.Ja=0),h=f.F[0],l=f.F[1],f.J=h.Jl.G?h.G:l.G,f.H=h.H>l.H?h.H:l.H,f.I=h.I>l.I?h.I:l.I,h=f.F[0].P,l=f.F[1].P,f.P=(h>l?h:l)+1,h=e.F[0],l=e.F[1],e.J=h.Jl.G?h.G:l.G,e.H=h.H>l.H?h.H:l.H,e.I=h.I>l.I?h.I:l.I,h=e.F[0].P,l=e.F[1].P,e.P=(h>l?h:l)+1,null!=d?(d.F[c]=f,f.Ea=d,f.Ja=c):(b.Nb=f,f.Ea=null),e=f):-1>l&&(f=h.F[0],l=h.F[1],f.P>l.P?(h.F[1]=e,e.Ea=h,e.Ja=1,e.F[1]=l,l.Ea=e,l.Ja=1):(h.F[0]=e,e.Ea=h,e.Ja=0,e.F[1]=f,f.Ea=e,f.Ja=1),f=h.F[0],l=h.F[1],h.J=f.Jl.G?f.G:l.G,h.H=f.H>l.H?f.H:l.H,h.I=f.I>l.I?f.I:l.I,f=h.F[0].P,l=h.F[1].P,h.P=(f>l?f:l)+1,f=e.F[0],l=e.F[1],e.J=f.Jl.G?f.G:l.G,e.H=f.H>l.H?f.H:l.H,e.I=f.I>l.I?f.I:l.I,f=e.F[0].P,l=e.F[1].P,e.P=(f>l?f:l)+1,null!=d?(d.F[c]=h,h.Ea=d,h.Ja=c):(b.Nb=h,h.Ea=null),e=h)}d=e.F[0].P;c=e.F[1].P;e.P=(d>c?d:c)+1;d=e.F[0];c=e.F[1];e.J=d.Jc.G?d.G:c.G;e.H=d.H>c.H?d.H:c.H;e.I=d.I>c.I?d.I:c.I;e=e.Ea}}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){b=Array(this.$f<<1);e=0;for(d=this.$f;ed.P)){var c=d.Ea,h=d.F[0],l=d.F[1],g=h.P-l.P,f=d.Ja;1g.P?(h.F[1]=d,d.Ea=h,d.Ja=1,d.F[0]=g,g.Ea=d,g.Ja=0):(h.F[0]=d,d.Ea=h,d.Ja=0,d.F[0]=l,l.Ea=d,l.Ja=0),l=h.F[0],g=h.F[1],h.J=l.Jg.G?l.G:g.G,h.H=l.H>g.H?l.H:g.H,h.I=l.I>g.I?l.I:g.I,l=h.F[0].P,g=h.F[1].P,h.P=(l>g?l:g)+1,l=d.F[0],g=d.F[1],d.J=l.Jg.G?l.G:g.G,d.H=l.H>g.H?l.H:g.H,d.I=l.I>g.I?l.I:g.I,l=d.F[0].P,g=d.F[1].P,d.P=(l>g?l:g)+1,null!=c?(c.F[f]=h,h.Ea=c,h.Ja=f):(b.Nb=h,h.Ea=null),d=h):-1>g&&(h=l.F[0],g=l.F[1],h.P>g.P?(l.F[1]=d,d.Ea=l,d.Ja=1,d.F[1]=g,g.Ea=d,g.Ja=1):(l.F[0]=d,d.Ea=l,d.Ja=0,d.F[1]=h,h.Ea=d,h.Ja=1),h=l.F[0],g=l.F[1],l.J=h.Jg.G?h.G:g.G,l.H=h.H>g.H?h.H:g.H,l.I=h.I>g.I?h.I:g.I,h=l.F[0].P,g=l.F[1].P,l.P=(h>g?h:g)+1,h=d.F[0],g=d.F[1],d.J=h.Jg.G?h.G:g.G,d.H=h.H>g.H?h.H:g.H,d.I=h.I>g.I?h.I:g.I,h=d.F[0].P,g=d.F[1].P,d.P=(h>g?h:g)+1,null!=c?(c.F[f]=l,l.Ea=c,l.Ja=f):(b.Nb=l,l.Ea=null),d=l)}c=d.F[0].P;f=d.F[1].P;d.P=(c>f?c:f)+1;c=d.F[0];f=d.F[1];d.J=c.Jf.G?c.G:f.G;d.H=c.H>f.H?c.H:f.H;d.I=c.I>f.I?c.I:f.I;d=d.Ea}}}a.ei=null;e.F[0]=null;e.F[1]=null;e.Ja=0;e.Ea=null;e.P=0;e.ub=null;e.M=b.qd;b.qd=e;a.userData=null;a.M=null;a.ia=null;a.zh&&(a.zh=!1)},Qd:function(a,b,e){if(!(a.J<=b.na&&a.G>=b.ka&&a.K<=b.oa&&a.H>=b.la&&a.L<=b.pa&&a.I>=b.ma)){a.J=b.na;a.K=b.oa;a.L=b.pa;a.G=b.ka;a.H=b.la;a.I=b.ma;b=F.bvhProxyPadding;a.J-=b;a.K-=b;a.L-=b;a.G+=b;a.H+=b;a.I+=b;if(null!=e){var d;b=e.x;d=e.y;e=e.z;a.J+=0b?0:b;a.H+=0>d?0:d;a.I+=0>e?0:e}if(!a.zh){a.zh=!0;if(this.rf.length==this.$f){e=Array(this.$f<<1);b=0;for(d=this.$f;bthis.Vi)){for(var b=this.$f/this.Vit.P)){var A=t.Ea,L=t.F[0],u=t.F[1],z=L.P-u.P,n=t.Ja;if(1Ib.P){L.F[1]=t;t.Ea=L;t.Ja=1;t.F[0]=Ib;Ib.Ea=t;Ib.Ja=0;var y=L.F[0],B=L.F[1];L.J=y.JB.G?y.G:B.G;L.H=y.H>B.H?y.H:B.H;L.I=y.I>B.I?y.I:B.I;var E=L.F[0].P,K=L.F[1].P;L.P=(E>K?E:K)+1;var H=t.F[0],mc=t.F[1];t.J=H.Jmc.G?H.G:mc.G;t.H=H.H>mc.H?H.H:mc.H;t.I=H.I>mc.I?H.I:mc.I;var R=t.F[0].P,x=t.F[1].P;t.P=(R>x?R:x)+1}else{L.F[0]=t;t.Ea=L;t.Ja=0;t.F[0]=D;D.Ea=t;D.Ja=0;var X=L.F[0],dd=L.F[1];L.J=X.Jdd.G?X.G:dd.G;L.H=X.H>dd.H?X.H:dd.H;L.I=X.I>dd.I?X.I:dd.I;var Da=L.F[0].P,qa=L.F[1].P;L.P=(Da>qa?Da:qa)+1;var Ub=t.F[0],ya=t.F[1];t.J=Ub.Jya.G?Ub.G:ya.G;t.H=Ub.H>ya.H?Ub.H:ya.H;t.I=Ub.I>ya.I?Ub.I:ya.I;var Jj=t.F[0].P,Ea=t.F[1].P;t.P=(Jj>Ea?Jj:Ea)+1}null!=A?(A.F[n]=L,L.Ea=A,L.Ja=n):(h.Nb=L,L.Ea=null);t=L}else if(-1>z){var O=u.F[0],sa=u.F[1];if(O.P>sa.P){u.F[1]=t;t.Ea=u;t.Ja=1;t.F[1]=sa;sa.Ea=t;sa.Ja=1;var ba=u.F[0],za=u.F[1];u.J=ba.Jza.G?ba.G:za.G;u.H=ba.H>za.H?ba.H:za.H;u.I=ba.I>za.I?ba.I:za.I;var Ta=u.F[0].P,C=u.F[1].P;u.P=(Ta>C?Ta:C)+1;var Aa=t.F[0],na=t.F[1];t.J=Aa.Jna.G?Aa.G:na.G;t.H=Aa.H>na.H?Aa.H:na.H;t.I=Aa.I>na.I?Aa.I:na.I;var La=t.F[0].P,Ba=t.F[1].P;t.P=(La>Ba?La:Ba)+1}else{u.F[0]=t;t.Ea=u;t.Ja=0;t.F[1]=O;O.Ea=t;O.Ja=1;var ta=u.F[0],S=u.F[1];u.J=ta.JS.G?ta.G:S.G;u.H=ta.H>S.H?ta.H:S.H;u.I=ta.I>S.I?ta.I:S.I;var ha=u.F[0].P,ea=u.F[1].P;u.P=(ha>ea?ha:ea)+1;var da=t.F[0],M=t.F[1];t.J=da.JM.G?da.G:M.G;t.H=da.H>M.H?da.H:M.H;t.I=da.I>M.I?da.I:M.I;var T=t.F[0].P,w=t.F[1].P;t.P=(T>w?T:w)+1}null!=A?(A.F[n]=u,u.Ea=A,u.Ja=n):(h.Nb=u,u.Ea=null);t=u}}var V=t.F[0].P,ia=t.F[1].P;t.P=(V>ia?V:ia)+1;var Y=t.F[0],oa=t.F[1];t.J=Y.Joa.G?Y.G:oa.G;t.H=Y.H>oa.H?Y.H:oa.H;t.I=Y.I>oa.I?Y.I:oa.I;t=t.Ea}}}f.ei=null;l.M=null;l.Ja=0;l.F[0]=null;l.F[1]=null;l.Ja=0;l.Ea=null;l.P=0;l.ub=null;l.M=h.qd;h.qd=l;var ua=this.ye,ca=ua.qd;null!=ca?(ua.qd=ca.M,ca.M=null):ca=new oi;var Ma=ca;Ma.ub=f;f.ei=Ma;Ma.J=f.J;Ma.K=f.K;Ma.L=f.L;Ma.G=f.G;Ma.H=f.H;Ma.I=f.I;ua.yk++;null==ua.zg?ua.zg=Ma:(ua.qf.ng=Ma,Ma.og=ua.qf);ua.qf=Ma;if(null==ua.Nb)ua.Nb=Ma;else{for(var va=ua.Nb;0Q.P)){var ja=Q.Ea,Ga=Q.F[0],P=Q.F[1],Ya=Ga.P-P.P,N=Q.Ja;if(1J.P){Ga.F[1]=Q;Q.Ea=Ga;Q.Ja=1;Q.F[0]=J;J.Ea=Q;J.Ja=0;var Vb=Ga.F[0],Ab=Ga.F[1];Ga.J=Vb.JAb.G?Vb.G:Ab.G;Ga.H=Vb.H>Ab.H?Vb.H:Ab.H;Ga.I=Vb.I>Ab.I?Vb.I:Ab.I;var ib=Ga.F[0].P,hb=Ga.F[1].P;Ga.P=(ib>hb?ib:hb)+1;var ka=Q.F[0],Ia=Q.F[1];Q.J=ka.JIa.G?ka.G:Ia.G;Q.H=ka.H>Ia.H?ka.H:Ia.H;Q.I=ka.I>Ia.I?ka.I:Ia.I;var ab=Q.F[0].P,bb=Q.F[1].P;Q.P=(ab>bb?ab:bb)+1}else{Ga.F[0]=Q;Q.Ea=Ga;Q.Ja=0;Q.F[0]=wb;wb.Ea=Q;wb.Ja=0;var Wa=Ga.F[0],Va=Ga.F[1];Ga.J=Wa.JVa.G?Wa.G:Va.G;Ga.H=Wa.H>Va.H?Wa.H:Va.H;Ga.I=Wa.I>Va.I?Wa.I:Va.I;var qb=Ga.F[0].P,kb=Ga.F[1].P;Ga.P=(qb>kb?qb:kb)+1;var Sa=Q.F[0],Na=Q.F[1];Q.J=Sa.JNa.G?Sa.G:Na.G;Q.H=Sa.H>Na.H?Sa.H:Na.H;Q.I=Sa.I>Na.I?Sa.I:Na.I;var Za=Q.F[0].P,vb=Q.F[1].P;Q.P=(Za>vb?Za:vb)+1}null!=ja?(ja.F[N]=Ga,Ga.Ea=ja,Ga.Ja=N):(ua.Nb=Ga,Ga.Ea=null);Q=Ga}else if(-1>Ya){var mb=P.F[0],xb=P.F[1];if(mb.P>xb.P){P.F[1]=Q;Q.Ea=P;Q.Ja=1;Q.F[1]=xb;xb.Ea=Q;xb.Ja=1;var nb=P.F[0],fb=P.F[1];P.J=nb.Jfb.G?nb.G:fb.G;P.H=nb.H>fb.H?nb.H:fb.H;P.I=nb.I>fb.I?nb.I:fb.I;var Re=P.F[0].P,Db=P.F[1].P;P.P=(Re>Db?Re:Db)+1;var G=Q.F[0],sb=Q.F[1];Q.J=G.Jsb.G?G.G:sb.G;Q.H=G.H>sb.H?G.H:sb.H;Q.I=G.I>sb.I?G.I:sb.I;var jb=Q.F[0].P,Xb=Q.F[1].P;Q.P=(jb>Xb?jb:Xb)+1}else{P.F[0]=Q;Q.Ea=P;Q.Ja=0;Q.F[1]=mb;mb.Ea=Q;mb.Ja=1;var ob=P.F[0],cb=P.F[1];P.J=ob.Jcb.G?ob.G:cb.G;P.H=ob.H>cb.H?ob.H:cb.H;P.I=ob.I>cb.I?ob.I:cb.I;var zb=P.F[0].P,Xa=P.F[1].P;P.P=(zb>Xa?zb:Xa)+1;var tb=Q.F[0],v=Q.F[1];Q.J=tb.Jv.G?tb.G:v.G;Q.H=tb.H>v.H?tb.H:v.H;Q.I=tb.I>v.I?tb.I:v.I;var W=Q.F[0].P,U=Q.F[1].P;Q.P=(W>U?W:U)+1}null!=ja?(ja.F[N]=P,P.Ea=ja,P.Ja=N):(ua.Nb=P,P.Ea=null);Q=P}}var db=Q.F[0].P,cc=Q.F[1].P;Q.P=(db>cc?db:cc)+1;var Ra=Q.F[0],Ha=Q.F[1];Q.J=Ra.JHa.G?Ra.G:Ha.G;Q.H=Ra.H>Ha.H?Ra.H:Ha.H;Q.I=Ra.I>Ha.I?Ra.I:Ha.I;Q=Q.Ea}}b&&this.Kh(this.ye.Nb,f.ei);f.zh=!1}this.rf[c]=null}b||this.Kh(this.ye.Nb,this.ye.Nb);this.$f=0}},ke:function(a,b,e){null!=this.ye.Nb&&this.am(this.ye.Nb,a.x,a.y,a.z,b.x,b.y,b.z,e)},Vf:function(a,b,e,d){null!=this.ye.Nb&&this.El(this.ye.Nb,a,b,e,d)},Ih:function(a,b){null!=this.ye.Nb&&this.yl(this.ye.Nb,a,b)},so:function(){return this.ye.An()}});Wi.wa=Qc;Wi.prototype=gb(Qc.prototype,{});Hj.prototype={jm:function(a,b){switch(this.mm){case 0:var e,d,c;e=b.J+b.G;d=b.K+b.H;c=b.L+b.I;var f=a.F[0];a=a.F[1];var h,l,g;h=f.J+f.G;b=f.K+f.H;f=f.L+f.I;l=a.J+a.G;g=a.K+a.H;a=a.L+a.I;h-=e;b-=d;f-=c;l-=e;g-=d;a-=c;return h*h+b*b+f*fb.G?a.G:b.G;r=a.H>b.H?a.H:b.H;g=a.I>b.I?a.I:b.I;c=r-p;l=g-l;e=2*((d-e)*(c+l)+c*l);c=2*e;a=2*(e-2*((a.G-a.J)*(k+m)+k*m));e=f.Jb.G?f.G:b.G;r=f.H>b.H?f.H:b.H;g=f.I>b.I?f.I:b.I;0==f.P?(f=r-p,l=g-l,f=a+2*((d-e)*(f+l)+f*l)):(k=r-p,l=g-l,g=f.H-f.K,m=f.I-f.L,f=a+(2*((d-e)*(k+l)+k*l)-2*((f.G-f.J)*(g+m)+g*m)));e=h.Jb.G?h.G:b.G;r=h.H>b.H?h.H:b.H;g=h.I>b.I?h.I:b.I;0==h.P?(h=r-p,b=g-l,e=a+2*((d-e)*(h+b)+h*b)):(b=r-p,l=g-l,g=h.H-h.K,k=h.I-h.L,e=a+(2*((d-e)*(b+l)+b*l)-2*((h.G-h.J)*(g+k)+g*k)));return cb&&(b=-b);return b+this.Hl(a.F[0])+this.Hl(a.F[1])}};eb.prototype={Aa:function(a,b){this.na=a.x;this.oa=a.y;this.pa=a.z;this.ka=b.x;this.la=b.y;this.ma=b.z;return this},Uc:function(){var a=new n;a.x=this.na;a.y=this.oa;a.z=this.pa;return a},Vc:function(a){a.x=this.na;a.y=this.oa;a.z=this.pa},ie:function(a){this.na=a.x;this.oa=a.y;this.pa=a.z;return this},Dc:function(){var a=new n;a.x=this.ka;a.y=this.la;a.z=this.ma;return a},Hc:function(a){a.x=this.ka;a.y=this.la;a.z=this.ma},vd:function(a){this.ka=a.x;this.la=a.y;this.ma=a.z;return this},Cb:function(){var a=new n,b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},Kb:function(a){var b,e,d;b=this.na+this.ka;e=this.oa+this.la;d=this.pa+this.ma;a.x=.5*b;a.y=.5*e;a.z=.5*d},kc:function(){var a=new n,b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a},lc:function(a){var b,e,d;b=this.ka-this.na;e=this.la-this.oa;d=this.ma-this.pa;a.x=.5*b;a.y=.5*e;a.z=.5*d},wa:function(a){this.na=this.naa.ka?this.ka:a.ka;this.la=this.la>a.la?this.la:a.la;this.ma=this.ma>a.ma?this.ma:a.ma;return this},mb:function(a){var b=new eb;b.na=this.naa.ka?this.ka:a.ka;b.la=this.la>a.la?this.la:a.la;b.ma=this.ma>a.ma?this.ma:a.ma;return b},Wc:function(a){return this.naa.na&&this.oaa.oa&&this.paa.pa:!1},wc:function(a){var b=new eb;b.na=this.na>a.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaa.na?this.na:a.na;b.oa=this.oa>a.oa?this.oa:a.oa;b.pa=this.pa>a.pa?this.pa:a.pa;b.ka=this.kaf?-f:f)+(0>l?-l:l)+(0>k?-k:k);h=(0>h?-h:h)+(0>g?-g:g)+(0>m?-m:m);e=(0>e?-e:e)+(0>d?-d:d)+(0>c?-c:c);a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-e;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+e},he:function(a,b){var e,d,c;c=d=e=this.Rb;e=ed){if(a<=-l||a>=l)return!1}else{var L=1/d,u=(-l-a)*L,l=(l-a)*L;u>l&&(L=u,u=l,l=L);0l&&(q=l)}if(-1E-6c){if(b<=-g||b>=g)return!1}else u=1/c,l=(-g-b)*u,g=(g-b)*u,l>g&&(u=l,l=g,g=u),0g&&(t=g);if(-1E-6f){if(e<=-k||e>=k)return!1}else l=1/f,g=(-k-e)*l,k=(k-e)*l,g>k&&(l=g,g=k,k=l),0k&&(A=k);if(1<=m||1<=p||1<=r||0>=q||0>=t||0>=A)return!1;k=m;m=0;p>k&&(k=p,m=1);r>k&&(k=r,m=2);tq||!k)return!1;switch(m){case 0:h.normal.Aa(0f?-f:f)*this.Db;h=(0>h?-h:h)*this.Db;l=(0>l?-l:l)*this.Db;e+=f;d+=h;c+=l;a.na=b.v-e;a.oa=b.A-d;a.pa=b.B-c;a.ka=b.v+e;a.la=b.A+d;a.ma=b.B+c},he:function(a,b){0q)return!1;if(0=(-r+q)/p)return!1}else{if(0<=m)return!1;m=0}p=b+(c-b)*m;if(p>-l&&pp?-l:l;t=a-0;l=b-g;k=e-0;a=d-a;b=c-b;e=f-e;p=a*a+b*b+e*e;r=t*a+l*b+k*e;m=t*t+l*l+k*k-this.ab*this.ab;q=r*r-p*m;if(0>q)return!1;f=(-r-Math.sqrt(q))/p;if(0>f||1p?g:p;h=k>r?k:r;f=m>q?m:q;g=ge?l:e);a.la=b.A+(h>d?h:d);a.ma=b.B+(f>c?f:c)},he:function(a,b){var e=a.x,d=a.y,c=a.z;0this.Mk*this.Mk*(e*e+d*d+c*c)?(b.Aa(0,this.Db-this.Rb/this.Mk,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,d=e*e+a*a,c=2*this.Db,c=(c-this.Rb)/c*this.ab-this.Rb/this.Dk,0>c&&(c=0),d=0c&&(c=0),b.x=e*d,b.y=-c,b.z=a*d)},Wi:function(a,b,e,d,c,f,h){var l=this.Db;d-=a;c-=b;f-=e;var g=0,k=1;if(-1E-6c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,m=(l-b)*m;if(p>m)var r=p,p=m,m=r;0m&&(k=m)}if(1<=g||0>=k)return!1;b-=l;var r=this.Dk*this.Dk,m=r*(d*d+c*c+f*f)-c*c,p=r*(a*d+b*c+e*f)-b*c,r=r*(a*a+b*b+e*e)-b*b,q=p*p-m*r;if(m){if(0>q)return!1;q=Math.sqrt(q);if(0>m)if(0=p)return!1}else{if(r=(-p-q)/m,p=1,1<=r)return!1}else if(r=(-p-q)/m,p=(-p+q)/m,1<=r||0>=p)return!1}else if(m=-r/(2*p),0=m)return!1}else if(r=m,p=1,1<=m)return!1;b+=l;if(p<=g||k<=r)return!1;if(rd&&(d=k);mc&&(c=m);gf&&(f=g)}h=d-a;l=c-b;k=f-e;this.Sf=h*l*k;a=.25*((a+d)*(a+d)+(b+c)*(b+c)+(e+f)*(e+f));h=h*h*.25;l=l*l*.25;k=k*k*.25;this.Dg=.3333333333333333*(l+k)+a;this.Gg=this.Fg=this.Eg=0;this.Hg=.3333333333333333*(k+h)+a;this.Kg=this.Jg=this.Ig=0;this.Lg=.3333333333333333*(h+l)+a},Lb:function(a,b){var e,d,c,f,h,l,g,k,m;m=k=g=this.Rb;var p,r,q;e=this.Ca[0];p=e.x;r=e.y;q=e.z;d=b.o*p+b.f*r+b.h*q;e=b.i*p+b.m*r+b.j*q;c=b.l*p+b.g*r+b.s*q;p=d+b.v;r=e+b.A;q=c+b.B;e=p;d=r;c=q;f=p;h=r;l=q;for(var t=1,A=this.We;tp?f:p;h=h>r?h:r;l=l>q?l:q}a.na=e-g;a.oa=d-k;a.pa=c-m;a.ka=f+g;a.la=h+k;a.ma=l+m},he:function(a,b){for(var e=this.Ca[0],e=e.x*a.x+e.y*a.y+e.z*a.z,d=0,c=1,f=this.We;ce&&(e=l,d=h)}a=this.Ca[d];b.x=a.x;b.y=a.y;b.z=a.z}});Qd.wa=Qa;Qd.prototype=gb(Qa.prototype,{pi:function(){return this.ab},Pj:function(){return this.Db},Xe:function(){var a=this.ab*this.ab,b=this.Db*this.Db*4;this.Sf=3.14159265358979*a*this.Db*2;this.Dg=.08333333333333333*(3*a+b);this.Gg=this.Fg=this.Eg=0;this.Hg=.5*a;this.Kg=this.Jg=this.Ig=0;this.Lg=.08333333333333333*(3*a+b)},Lb:function(a,b){var e,d,c,f,h,l;e=b.f;d=b.m;c=b.g;e=0>e?-e:e;d=0>d?-d:d;c=0>c?-c:c;f=Math.sqrt(1-e*e);h=Math.sqrt(1-d*d);l=Math.sqrt(1-c*c);f*=this.ab;h*=this.ab;l*=this.ab;e*=this.Db;d*=this.Db;c*=this.Db;f+=e;h+=d;l+=c;a.na=b.v-f;a.oa=b.A-h;a.pa=b.B-l;a.ka=b.v+f;a.la=b.A+h;a.ma=b.B+l},he:function(a,b){var e=a.x,d=a.z,c=e*e+d*d,f=this.ab-this.Rb;0>f&&(f=0);c=0f&&(f=0);b.x=e*c;b.y=0c){if(b<=-l||b>=l)return!1}else{var m=1/c,p=(-l-b)*m,l=(l-b)*m;p>l&&(m=p,p=l,l=m);0l&&(k=l)}if(1<=g||0>=k)return!1;var l=d*d+f*f,p=a*d+e*f,m=a*a+e*e-this.ab*this.ab,r=p*p-l*m;if(0>r)return!1;if(0=l)return!1}else{if(0<=m)return!1;m=0;l=1}if(l<=g||k<=m)return!1;if(mk)return!1;f=(-g-Math.sqrt(k))/f;if(0>f||1a&&(a=this.points[d].depth)}return a},clear:function(){for(var a=this.numPoints=0,b=this.points;aPa&&(Pa=-Pa);0>Fa&&(Fa=-Fa);0>Q&&(Q=-Q);var aa=Pa+Fa+Q,fa=L*q+u*t+z*A,N=Z+aa,ja=0>fa,Ga=ja?-fa:fa;if(GaP&&(Y=P,oa=0,ca=L,Ma=u,va=z,ua=ja?-1:1);var Z=ya,Ya=n*S+D*ha+Ib*ea,J=n*da+D*M+Ib*T,wb=n*w+D*V+Ib*ia;0>Ya&&(Ya=-Ya);0>J&&(J=-J);0>wb&&(wb=-wb);var aa=Ya+J+wb,fa=n*q+D*t+Ib*A,ec=Z+aa,Vb=0>fa,Ab=Vb?-fa:fa;if(Abhb&&(hb=-hb);0>ka&&(ka=-ka);0>Ia&&(Ia=-Ia);var aa=hb+ka+Ia,fa=y*q+B*t+E*A,ab=Z+aa,bb=0>fa,Wa=bb?-fa:fa;if(WaF.linearSlop?Y-F.linearSlop:0,qb=K*ba+H*za+mc*Ta,kb=K*C+H*Aa+mc*na,Sa=K*La+H*Ba+mc*ta;0>qb&&(qb=-qb);0>kb&&(kb=-kb);0>Sa&&(Sa=-Sa);var Z=qb+kb+Sa,aa=Ea,fa=K*q+H*t+mc*A,Na=Z+aa,Za=0>fa,vb=Za?-fa:fa;if(vbxb&&(xb=-xb);0>nb&&(nb=-nb);0>fb&&(fb=-fb);var Z=xb+nb+fb,aa=O,fa=R*q+x*t+X*A,Re=Z+aa,Db=0>fa,G=Db?-fa:fa;if(Gjb&&(jb=-jb);0>Xb&&(Xb=-Xb);0>ob&&(ob=-ob);var Z=jb+Xb+ob,aa=sa,fa=dd*q+Da*t+qa*A,cb=Z+aa,zb=0>fa,Xa=zb?-fa:fa;if(XaF.linearSlop?Y-F.linearSlop:0,v,W,U;v=u*mc-z*H;W=z*K-L*mc;U=L*H-u*K;if(v||W||U){var db=v*v+W*W+U*U;0cc&&(cc=-cc);0>Ra&&(Ra=-Ra);var Z=cc+Ra,Ha=v*da+W*M+U*T,rb=v*w+W*V+U*ia;0>Ha&&(Ha=-Ha);0>rb&&(rb=-rb);var aa=Ha+rb,fa=v*q+W*t+U*A,yb=Z+aa,Cb=0>fa,la=Cb?-fa:fa;if(lama&&(ma=-ma);0>Ja&&(Ja=-Ja);var Z=ma+Ja,$a=v*S+W*ha+U*ea,Oa=v*w+W*V+U*ia;0>$a&&($a=-$a);0>Oa&&(Oa=-Oa);var aa=$a+Oa,fa=v*q+W*t+U*A,nc=Z+aa,xa=0>fa,Fc=xa?-fa:fa;if(Fcoj&&(oj=-oj);0>pa&&(pa=-pa);var Z=oj+pa,Ca=v*S+W*ha+U*ea,xd=v*da+W*M+U*T;0>Ca&&(Ca=-Ca);0>xd&&(xd=-xd);var aa=Ca+xd,fa=v*q+W*t+U*A,Kj=Z+aa,Ka=0>fa,de=Ka?-fa:fa;if(deoc&&(oc=-oc);0>Id&&(Id=-Id);var Z=oc+Id,$d=v*da+W*M+U*T,rc=v*w+W*V+U*ia;0>$d&&($d=-$d);0>rc&&(rc=-rc);var aa=$d+rc,fa=v*q+W*t+U*A,Jc=Z+aa,Ua=0>fa,eb=Ua?-fa:fa;if(ebuc&&(uc=-uc);0>gc&&(gc=-gc);var Z=uc+gc,Xc=v*S+W*ha+U*ea,Eb=v*w+W*V+U*ia;0>Xc&&(Xc=-Xc);0>Eb&&(Eb=-Eb);var aa=Xc+Eb,fa=v*q+W*t+U*A,Ng=Z+aa,qi=0>fa,gb=qi?-fa:fa;if(gbic&&(ic=-ic);0>Og&&(Og=-Og);var Z=ic+Og,pb=v*S+W*ha+U*ea,Bb=v*da+W*M+U*T;0>pb&&(pb=-pb);0>Bb&&(Bb=-Bb);var aa=pb+Bb,fa=v*q+W*t+U*A,Pg=Z+aa,sc=0>fa,Jd=sc?-fa:fa;if(JdZg&&(Zg=-Zg);0>vc&&(vc=-vc);var Z=Zg+vc,Fb=v*da+W*M+U*T,ub=v*w+W*V+U*ia;0>Fb&&(Fb=-Fb);0>ub&&(ub=-ub);var aa=Fb+ub,fa=v*q+W*t+U*A,Ob=Z+aa,Mj=0>fa,Qi=Mj?-fa:fa;if(QiHb&&(Hb=-Hb);0>Lb&&(Lb=-Lb);var Z=Hb+Lb,yf=v*S+W*ha+U*ea,Gb=v*w+W*V+U*ia;0>yf&&(yf=-yf);0>Gb&&(Gb=-Gb);var aa=yf+Gb,fa=v*q+W*t+U*A,Nb=Z+aa,Nj=0>fa,ri=Nj?-fa:fa;if(riSb&&(Sb=-Sb);0>fd&&(fd=-fd);var Z=Sb+fd,Rc=v*S+W*ha+U*ea,zc=v*da+W*M+U*T;0>Rc&&(Rc=-Rc);0>zc&&(zc=-zc);var aa=Rc+zc,fa=v*q+W*t+U*A,gd=Z+aa,Yc=0>fa,od=Yc?-fa:fa;if(odua){ke=-ke;le=-le;me=-me;Cd=-Cd;Dd=-Dd;hd=-hd;$c=Kd;Sc=ee;ld=Td;Kd=qd;ee=Ud;Td=Ld;qd=$c;Ud=Sc;Ld=ld;var Ue=Md;Md=ne;ne=Ue}ke+=l;le+=g;me+=k;var ad=1,Ed=0,id=Cd*K+Dd*H+hd*mc;id-F.contactPersistenceThreshold&&(bc?this.Wg(a,ge,rd,Vd,Wd,qe,he,wd,fe):this.Wg(a,Wd,qe,he,ge,rd,Vd,wd,fe))}}}}}}}}}});Ej.prototype={clip:function(){for(var a=0,b=this.fd;a=f){var h=this.Gb[this.gc++];h.x=d.x;h.y=d.y;h.Pa=d.Pa;h.Qa=d.Qa;h.Ra=d.Ra;c/=c-f;f=this.Gb[this.gc++];f.x=d.x+(e.x-d.x)*c;f.y=d.y+(e.y-d.y)*c;f.Pa=d.Pa+(e.Pa-d.Pa)*c;f.Qa=d.Qa+(e.Qa-d.Qa)*c;f.Ra=d.Ra+(e.Ra-d.Ra)*c}else 0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0=f?(h=this.Gb[this.gc++],h.x=d.x,h.y=d.y,h.Pa=d.Pa,h.Qa=d.Qa,h.Ra=d.Ra,c/=c-f,f=this.Gb[this.gc++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Pa=d.Pa+(e.Pa-d.Pa)*c,f.Qa=d.Qa+(e.Qa-d.Qa)*c,f.Ra=d.Ra+(e.Ra-d.Ra)*c):0>=c&&0this.fd)){for(var a=-Infinity,b=Infinity,e=-Infinity,d=Infinity,c=null,f=null,h=null,l=null,g=0,k=this.fd;ga&&(a=p,c=m);pe&&(e=r,h=m);rp?0:p>r?1:p/r):p=0,r=p*Ib+n,0>r?(r=0,p=0>k?0:k>D?1:k/D):r>z?(r=1,p=Ib+k,p=0>p?0:p>D?1:p/D):r/=z):(r=0,p=0>k?0:k>D?1:k/D):(p=0,r=0>n?0:n>z?1:n/z):r=p=0;q+=f*p;t+=L*p;A+=c*p;h+=m*r;l+=u*r;d+=g*r;L=q-h;f=t-l;r=A-d;p=L*L+f*f+r*r;p>=(b+e)*(b+e)||(p=Math.sqrt(p),0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},mb:function(a){var b,e,d,c;b=this.o;e=this.m;d=this.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.f+this.i)*f,d=(this.h+this.l)*f,c=(this.g-this.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.f+this.i)*f,d=(this.j+this.g)*f,c=(this.h-this.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.h+this.l)*f,e=(this.j+this.g)*f,c=(this.i-this.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},Dc:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.o=1-g-d;this.f=k-c;this.h=b+h;this.i=k+c;this.m=1-a-d;this.j=e-f;this.l=b-h;this.g=e+f;this.s=1-a-g;return this},clone:function(){var a=new Ua;a.v=this.v;a.A=this.A;a.B=this.B;a.o=this.o;a.f=this.f;a.h=this.h;a.i=this.i;a.m=this.m;a.j=this.j;a.l=this.l;a.g=this.g;a.s=this.s;return a},qe:function(a){this.v=a.v;this.A=a.A;this.B=a.B;this.o=a.o;this.f=a.f;this.h=a.h;this.i=a.i;this.m=a.m;this.j=a.j;this.l=a.l;this.g=a.g;this.s=a.s;return this}};lb.kc=function(){return lb.mb};lb.prototype={Nj:function(a,b,e,d,c,f){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var h=this.La,l=this.eb,g=this.ib,k=this.closest,m=this.dir;null!=c?(null==c.Ji&&(c.Ji=new Dj),this.yo(c.Ji)):m.R();if(!(m.x*m.x+m.y*m.y+m.z*m.z)){var p,r,q;p=d.v-e.v;r=d.A-e.A;q=d.B-e.B;m.x=p;m.y=r;m.z=q;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.Aa(1,0,0)}this.Ba=0;this.Tf(!1);this.Uf(!1);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;for(var u=0;40>u;){var z=0;switch(this.Ba){case 1:var n=h[0];k.x=n.x;k.y=n.y;k.z=n.z;z=1;break;case 2:var D,Ib,y,B,E,K,H=h[0];D=H.x;Ib=H.y;y=H.z;var mc=h[1];B=mc.x;E=mc.y;K=mc.z;var R,x,X;R=B-D;x=E-Ib;X=K-y;var F=R*D+x*Ib+X*y,F=-F/(R*R+x*x+X*X);if(0>F)k.x=D,k.y=Ib,k.z=y,z=1;else if(1O*oa+sa*ua+ba*ca){var P,Ya,Yg,wb,ec,Vb;P=ya.x;Ya=ya.y;Yg=ya.z;wb=N.x;ec=N.y;Vb=N.z;var Ab,ib,hb;Ab=wb-P;ib=ec-Ya;hb=Vb-Yg;var ka=Ab*P+ib*Ya+hb*Yg,ka=-ka/(Ab*Ab+ib*ib+hb*hb),Ia;if(0>ka)k.x=P,k.y=Ya,k.z=Yg,Ia=1;else if(1za*Ma+Ta*va+C*Z){var Va,qb,kb,Sa,Na,Za;Va=N.x;qb=N.y;kb=N.z;Sa=Ea.x;Na=Ea.y;Za=Ea.z;var vb,mb,xb;vb=Sa-Va;mb=Na-qb;xb=Za-kb;var nb=vb*Va+mb*qb+xb*kb,nb=-nb/(vb*vb+mb*mb+xb*xb),fb;if(0>nb)k.x=Va,k.y=qb,k.z=kb,fb=1;else if(1aa||sbAa*Pa+na*Fa+La*Q){var jb,Xb,ob,cb,zb,Xa;jb=ya.x;Xb=ya.y;ob=ya.z;cb=Ea.x;zb=Ea.y;Xa=Ea.z;var tb,v,W;tb=cb-jb;v=zb-Xb;W=Xa-ob;var U=tb*jb+v*Xb+W*ob,U=-U/(tb*tb+v*v+W*W),db;if(0>U)k.x=jb,k.y=Xb,k.z=ob,db=1;else if(1aa||rb(Ja*gc+$a*Xc+Oa*Eb)*Pg){var vc,Jb,Ob,Hb,Lb,Qi,Gb,Qb,Sb,Nb,yf,lb,Rb,Kb,ri,kd,dc,Wb;vc=la.x;Jb=la.y;Ob=la.z;Hb=ra.x;Lb=ra.y;Qi=ra.z;Gb=ga.x;Qb=ga.y;Sb=ga.z;Nb=Hb-vc;yf=Lb-Jb;lb=Qi-Ob;Rb=Gb-Hb;Kb=Qb-Lb;ri=Sb-Qi;kd=vc-Gb;dc=Jb-Qb;Wb=Ob-Sb;var fd,Rc,zc;fd=yf*ri-lb*Kb;Rc=lb*Rb-Nb*ri;zc=Nb*Kb-yf*Rb;var gd,Yc,od,Mb,Tb,pc,Zc,Kc,Lc;gd=yf*zc-lb*Rc;Yc=lb*fd-Nb*zc;od=Nb*Rc-yf*fd;Mb=Kb*zc-ri*Rc;Tb=ri*fd-Rb*zc;pc=Rb*Rc-Kb*fd;Zc=dc*zc-Wb*Rc;Kc=Wb*fd-kd*zc;Lc=kd*Rc-dc*fd;var xc=-1,Cc,Dc,pd,yd=0;pd=Dc=Cc=0;if(0>vc*gd+Jb*Yc+Ob*od){var sd,td,zd,$g,Pb,$b;sd=la.x;td=la.y;zd=la.z;$g=ra.x;Pb=ra.y;$b=ra.z;var ac,bc,kc;ac=$g-sd;bc=Pb-td;kc=$b-zd;var Sd=ac*sd+bc*td+kc*zd,Sd=-Sd/(ac*ac+bc*bc+kc*kc),ie;if(0>Sd)k.x=sd,k.y=td,k.z=zd,ie=1;else if(1Hb*Mb+Lb*Tb+Qi*pc){var tc,qc,Zb,Ge,He,Se;tc=ra.x;qc=ra.y;Zb=ra.z;Ge=ga.x;He=ga.y;Se=ga.z;var Te,Ie,Je;Te=Ge-tc;Ie=He-qc;Je=Se-Zb;var ae=Te*tc+Ie*qc+Je*Zb,ae=-ae/(Te*Te+Ie*Ie+Je*Je),xe;if(0>ae)k.x=tc,k.y=qc,k.z=Zb,xe=1;else if(1xc||QcGb*Zc+Qb*Kc+Sb*Lc){var wc,Ad,Bd,ud,ke,le;wc=la.x;Ad=la.y;Bd=la.z;ud=ga.x;ke=ga.y;le=ga.z;var me,Cd,Dd;me=ud-wc;Cd=ke-Ad;Dd=le-Bd;var hd=me*wc+Cd*Ad+Dd*Bd,hd=-hd/(me*me+Cd*Cd+Dd*Dd),Kd;if(0>hd)k.x=wc,k.y=Ad,k.z=Bd,Kd=1;else if(1xc||Ud(Ja*Ng+$a*qi+Oa*pb)*Pg){var Ue,ad,Ed,id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf;Ue=la.x;ad=la.y;Ed=la.z;id=ga.x;bd=ga.y;cd=ga.z;Vc=ma.x;Mc=ma.y;Nc=ma.z;Ec=id-Ue;yc=bd-ad;Bc=cd-Ed;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ue-Vc;oe=ad-Mc;lf=Ed-Nc;var md,Fd,ed;md=yc*Hc-Bc*Tc;Fd=Bc*Ac-Ec*Hc;ed=Ec*Tc-yc*Ac;var vd,jd,nd,mf,Uc,Pc,ve,we,Ri;vd=yc*ed-Bc*Fd;jd=Bc*md-Ec*ed;nd=Ec*Fd-yc*md;mf=Tc*ed-Hc*Fd;Uc=Hc*md-Ac*ed;Pc=Ac*Fd-Tc*md;ve=oe*ed-lf*Fd;we=lf*md-Oc*ed;Ri=Oc*Fd-oe*md;var fe=-1,pe,ge,rd,Vd=0;rd=ge=pe=0;if(0>Ue*vd+ad*jd+Ed*nd){var wd,Wd,qe,he,zf,sh;wd=la.x;Wd=la.y;qe=la.z;he=ga.x;zf=ga.y;sh=ga.z;var tg,ug,vg;tg=he-wd;ug=zf-Wd;vg=sh-qe;var Ke=tg*wd+ug*Wd+vg*qe,Ke=-Ke/(tg*tg+ug*ug+vg*vg),Ve;if(0>Ke)k.x=wd,k.y=Wd,k.z=qe,Ve=1;else if(1id*mf+bd*Uc+cd*Pc){var Nf,Of,gg,Pf,Qf,Rf;Nf=ga.x;Of=ga.y;gg=ga.z;Pf=ma.x;Qf=ma.y;Rf=ma.z;var Sf,Tf,Af;Sf=Pf-Nf;Tf=Qf-Of;Af=Rf-gg;var ye=Sf*Nf+Tf*Of+Af*gg,ye=-ye/(Sf*Sf+Tf*Tf+Af*Af),nf;if(0>ye)k.x=Nf,k.y=Of,k.z=gg,nf=1;else if(1fe||CeVc*ve+Mc*we+Nc*Ri){var wg,xg,Xd,Nd,Od,yg;wg=la.x;xg=la.y;Xd=la.z;Nd=ma.x;Od=ma.y;yg=ma.z;var zg,Ag,Bg;zg=Nd-wg;Ag=Od-xg;Bg=yg-Xd;var pf=zg*wg+Ag*xg+Bg*Xd,pf=-pf/(zg*zg+Ag*Ag+Bg*Bg),Vf;if(0>pf)k.x=wg,k.y=xg,k.z=Xd,Vf=1;else if(1fe||Wfsc||Cg(Ja*Qa+$a*xf+Oa*ic)*Pg){var Le,Xe,Xf,Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg;Le=la.x;Xe=la.y;Xf=la.z;Yf=ra.x;Zf=ra.y;$f=ra.z;Cf=ma.x;Df=ma.y;Ef=ma.z;Me=Yf-Le;Ff=Zf-Xe;jg=$f-Xf;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Le-Cf;Hf=Xe-Df;kg=Xf-Ef;var be,ce,Pd;be=Ff*Ye-jg*bg;ce=jg*ag-Me*Ye;Pd=Me*bg-Ff*ag;var Yd,Zd,Gd,Oj,Qd,Fe,Wc,Hd,Qg;Yd=Ff*Pd-jg*ce;Zd=jg*be-Me*Pd;Gd=Me*ce-Ff*be;Oj=bg*Pd-Ye*ce;Qd=Ye*be-ag*Pd;Fe=ag*ce-bg*be;Wc=Hf*Pd-kg*ce;Hd=kg*be-Gf*Pd;Qg=Gf*ce-Hf*be;var Ze=-1,rf,cg,re,sf=0;re=cg=rf=0;if(0>Le*Yd+Xe*Zd+Xf*Gd){var ze,Ae,tf,$e,If,Dg;ze=la.x;Ae=la.y;tf=la.z;$e=ra.x;If=ra.y;Dg=ra.z;var Eg,Fg,Gg;Eg=$e-ze;Fg=If-Ae;Gg=Dg-tf;var af=Eg*ze+Fg*Ae+Gg*tf,af=-af/(Eg*Eg+Fg*Fg+Gg*Gg),bf;if(0>af)k.x=ze,k.y=Ae,k.z=tf,bf=1;else if(1Yf*Oj+Zf*Qd+$f*Fe){var kj,lj,mj,th,uh,vh;kj=ra.x;lj=ra.y;mj=ra.z;th=ma.x;uh=ma.y;vh=ma.z;var wh,xh,yh;wh=th-kj;xh=uh-lj;yh=vh-mj;var mg=wh*kj+xh*lj+yh*mj,mg=-mg/(wh*wh+xh*xh+yh*yh),ah;if(0>mg)k.x=kj,k.y=lj,k.z=mj,ah=1;else if(1Ze||gfCf*Wc+Df*Hd+Ef*Qg){var ui,vi,wi,zh,Ah,Bh;ui=la.x;vi=la.y;wi=la.z;zh=ma.x;Ah=ma.y;Bh=ma.z;var Ch,Dh,Eh;Ch=zh-ui;Dh=Ah-vi;Eh=Bh-wi;var ng=Ch*ui+Dh*vi+Eh*wi,ng=-ng/(Ch*Ch+Dh*Dh+Eh*Eh),Rg;if(0>ng)k.x=ui,k.y=vi,k.z=wi,Rg=1;else if(1Ze||hfsc||jf(nc*Og+xa*Bb+Fc*Fb)*Pg){var Hg,Sg,Ai,dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh;Hg=ra.x;Sg=ra.y;Ai=ra.z;dh=ga.x;eh=ga.y;fh=ga.z;Gh=ma.x;Hh=ma.y;Ih=ma.z;gh=dh-Hg;hh=eh-Sg;ih=fh-Ai;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=Hg-Gh;Kh=Sg-Hh;Lh=Ai-Ih;var Ne,Oe,Pe;Ne=hh*Vg-ih*Ug;Oe=ih*Tg-gh*Vg;Pe=gh*Ug-hh*Tg;var cf,df,ef,ue,kf,te,vf,Kf,Lf;cf=hh*Pe-ih*Oe;df=ih*Ne-gh*Pe;ef=gh*Oe-hh*Ne;ue=Ug*Pe-Vg*Oe;kf=Vg*Ne-Tg*Pe;te=Tg*Oe-Ug*Ne;vf=Kh*Pe-Lh*Oe;Kf=Lh*Ne-Jh*Pe;Lf=Jh*Oe-Kh*Ne;var Wg=-1,jh,kh,uf,Ig=0;uf=kh=jh=0;if(0>Hg*cf+Sg*df+Ai*ef){var og,pg,lh,Mh,Nh,Oh;og=ra.x;pg=ra.y;lh=ra.z;Mh=ga.x;Nh=ga.y;Oh=ga.z;var Ph,Qh,Rh;Ph=Mh-og;Qh=Nh-pg;Rh=Oh-lh;var qg=Ph*og+Qh*pg+Rh*lh,qg=-qg/(Ph*Ph+Qh*Qh+Rh*Rh),mh;if(0>qg)k.x=og,k.y=pg,k.z=lh,mh=1;else if(1dh*ue+eh*kf+fh*te){var Ci,Di,Ei,Sh,Th,Uh;Ci=ga.x;Di=ga.y;Ei=ga.z;Sh=ma.x;Th=ma.y;Uh=ma.z;var Vh,Wh,Xh;Vh=Sh-Ci;Wh=Th-Di;Xh=Uh-Ei;var rg=Vh*Ci+Wh*Di+Xh*Ei,rg=-rg/(Vh*Vh+Wh*Wh+Xh*Xh),oh;if(0>rg)k.x=Ci,k.y=Di,k.z=Ei,oh=1;else if(1Wg||seGh*vf+Hh*Kf+Ih*Lf){var Gi,Hi,Ii,Yh,Zh,$h;Gi=ra.x;Hi=ra.y;Ii=ra.z;Yh=ma.x;Zh=ma.y;$h=ma.z;var ai,bi,ci;ai=Yh-Gi;bi=Zh-Hi;ci=$h-Ii;var sg=ai*Gi+bi*Hi+ci*Ii,sg=-sg/(ai*ai+bi*bi+ci*ci),Xg;if(0>sg)k.x=Gi,k.y=Hi,k.z=Ii,Xg=1;else if(1Wg||ffsc||bjk.x*k.x+k.y*k.y+k.z*k.z){if(!f)return this.distance=0;switch(this.Ba){case 1:this.Ao();break;case 2:this.Wl();break;case 3:this.dm()}if(4==this.Ba){var ei=this.Ln(a,b,e,d,h,l,g);if(0!=ei)return this.distance=0,ei;this.distance=-this.depth;return 0}this.distance=0;return 1}this.an(z);m.x=k.x;m.y=k.y;m.z=k.z;m.x=-m.x;m.y=-m.y;m.z=-m.z;this.Tf(!1);this.Uf(!1);var Jf=this.La[this.Ba],cj=this.eb[this.Ba];Jf.x=cj.x;Jf.y=cj.y;Jf.z=cj.z;var Be=this.ib[this.Ba];Jf.x-=Be.x;Jf.y-=Be.y;Jf.z-=Be.z;if(1E-8>m.x*m.x+m.y*m.y+m.z*m.z)throw Error("!?");var rh=h[this.Ba];if(1E-8>rh.x*m.x+rh.y*m.y+rh.z*m.z-(k.x*m.x+k.y*m.y+k.z*m.z))return this.Km(),this.distance=Math.sqrt(k.x*k.x+k.y*k.y+k.z*k.z),null!=c&&null!=c.Ji&&this.Fo(c.Ji),0;this.Ba++;++u}return 2},xm:function(a,b,e,d,c,f,h){this.Kj=a;this.Bl=b;this.oc=e;this.Tc=d;var l=this.La,g=this.closest,k=this.dir,m,p,r;m=d.v-e.v;p=d.A-e.A;r=d.B-e.B;k.x=m;k.y=p;k.z=r;1E-6>k.x*k.x+k.y*k.y+k.z*k.z&&k.Aa(1,0,0);this.Ba=0;if(null!=this.Kj)this.Tf(!0);else{var q=this.eb[this.Ba];q.x=this.oc.v;q.y=this.oc.A;q.z=this.oc.B}this.Uf(!0);var t=this.La[this.Ba],A=this.eb[this.Ba];t.x=A.x;t.y=A.y;t.z=A.z;var L=this.ib[this.Ba];t.x-=L.x;t.y-=L.y;t.z-=L.z;this.Ba=1;var u=0,z=0,n=this.Co,D=this.Bo;n.R();D.x=f.x;D.y=f.y;D.z=f.z;D.x-=c.x;D.y-=c.y;for(D.z-=c.z;40>u;){var Ib=0;switch(this.Ba){case 1:var y=l[0];g.x=y.x;g.y=y.y;g.z=y.z;Ib=1;break;case 2:var B,E,K,H,mc,R,x=l[0];B=x.x;E=x.y;K=x.z;var X=l[1];H=X.x;mc=X.y;R=X.z;var F,Da,qa;F=H-B;Da=mc-E;qa=R-K;var I=F*B+Da*E+qa*K,I=-I/(F*F+Da*Da+qa*qa);if(0>I)g.x=B,g.y=E,g.z=K,Ib=1;else if(1za*Ma+J*va+C*Z){var wb,ec,Vb,Ab,ib,hb;wb=O.x;ec=O.y;Vb=O.z;Ab=sa.x;ib=sa.y;hb=sa.z;var ka,Ia,ab;ka=Ab-wb;Ia=ib-ec;ab=hb-Vb;var bb=ka*wb+Ia*ec+ab*Vb,bb=-bb/(ka*ka+Ia*Ia+ab*ab),Wa;if(0>bb)g.x=wb,g.y=ec,g.z=Vb,Wa=1;else if(1Aa*Pa+na*Fa+La*Q){var Sa,Na,Za,vb,mb,xb;Sa=sa.x;Na=sa.y;Za=sa.z;vb=ba.x;mb=ba.y;xb=ba.z;var nb,fb,Re;nb=vb-Sa;fb=mb-Na;Re=xb-Za;var Db=nb*Sa+fb*Na+Re*Za,Db=-Db/(nb*nb+fb*fb+Re*Re),G;if(0>Db)g.x=Sa,g.y=Na,g.z=Za,G=1;else if(1ja||obBa*aa+ta*fa+S*Rd){var cb,zb,Xa,tb,v,W;cb=O.x;zb=O.y;Xa=O.z;tb=ba.x;v=ba.y;W=ba.z;var U,db,cc;U=tb-cb;db=v-zb;cc=W-Xa;var Ra=U*cb+db*zb+cc*Xa,Ra=-Ra/(U*U+db*db+cc*cc),Ha;if(0>Ra)g.x=cb,g.y=zb,g.z=Xa,Ha=1;else if(1ja||la(nc*Ng+xa*qi+Fc*Bb)*Hb){var Sb,Nb,lb,Rb,Kb,dc,Wb,yf,ac,bc,Pb,$b,kd,Mb,Tb,fd,Rc,zc;Sb=ma.x;Nb=ma.y;lb=ma.z;Rb=Ja.x;Kb=Ja.y;dc=Ja.z;Wb=$a.x;yf=$a.y;ac=$a.z;bc=Rb-Sb;Pb=Kb-Nb;$b=dc-lb;kd=Wb-Rb;Mb=yf-Kb;Tb=ac-dc;fd=Sb-Wb;Rc=Nb-yf;zc=lb-ac;var gd,Yc,od;gd=Pb*Tb-$b*Mb;Yc=$b*kd-bc*Tb;od=bc*Mb-Pb*kd;var pc,kc,tc,Zc,Kc,Lc,xc,Cc,Dc;pc=Pb*od-$b*Yc;kc=$b*gd-bc*od;tc=bc*Yc-Pb*gd;Zc=Mb*od-Tb*Yc;Kc=Tb*gd-kd*od;Lc=kd*Yc-Mb*gd;xc=Rc*od-zc*Yc;Cc=zc*gd-fd*od;Dc=fd*Yc-Rc*gd;var pd=-1,yd,sd,td,zd=0;td=sd=yd=0;if(0>Sb*pc+Nb*kc+lb*tc){var qc,Zb,lc,jc,Qc,wc;qc=ma.x;Zb=ma.y;lc=ma.z;jc=Ja.x;Qc=Ja.y;wc=Ja.z;var Sd,ie,Uc;Sd=jc-qc;ie=Qc-Zb;Uc=wc-lc;var je=Sd*qc+ie*Zb+Uc*lc,je=-je/(Sd*Sd+ie*ie+Uc*Uc),Pc;if(0>je)g.x=qc,g.y=Zb,g.z=lc,Pc=1;else if(1Rb*Zc+Kb*Kc+dc*Lc){var Ge,He,Se,Te,Ie,Je;Ge=Ja.x;He=Ja.y;Se=Ja.z;Te=$a.x;Ie=$a.y;Je=$a.z;var ae,xe,$c;ae=Te-Ge;xe=Ie-He;$c=Je-Se;var Sc=ae*Ge+xe*He+$c*Se,Sc=-Sc/(ae*ae+xe*xe+$c*$c),ld;if(0>Sc)g.x=Ge,g.y=He,g.z=Se,ld=1;else if(1pd||BdWb*xc+yf*Cc+ac*Dc){var ud,ke,le,me,Cd,Dd;ud=ma.x;ke=ma.y;le=ma.z;me=$a.x;Cd=$a.y;Dd=$a.z;var hd,Kd,ee;hd=me-ud;Kd=Cd-ke;ee=Dd-le;var Td=hd*ud+Kd*ke+ee*le,Td=-Td/(hd*hd+Kd*Kd+ee*ee),qd;if(0>Td)g.x=ud,g.y=ke,g.z=le,qd=1;else if(1pd||ne(nc*Fb+xa*xf+Fc*ic)*Hb){var id,bd,cd,Vc,Mc,Nc,Ec,yc,Bc,Ac,Tc,Hc,Oc,oe,lf,md,Fd,ed;id=ma.x;bd=ma.y;cd=ma.z;Vc=$a.x;Mc=$a.y;Nc=$a.z;Ec=Oa.x;yc=Oa.y;Bc=Oa.z;Ac=Vc-id;Tc=Mc-bd;Hc=Nc-cd;Oc=Ec-Vc;oe=yc-Mc;lf=Bc-Nc;md=id-Ec;Fd=bd-yc;ed=cd-Bc;var vd,jd,nd;vd=Tc*lf-Hc*oe;jd=Hc*Oc-Ac*lf;nd=Ac*oe-Tc*Oc;var mf,Fe,Wc,Hd,Ee,Ri,fe,pe,ge;mf=Tc*nd-Hc*jd;Fe=Hc*vd-Ac*nd;Wc=Ac*jd-Tc*vd;Hd=oe*nd-lf*jd;Ee=lf*vd-Oc*nd;Ri=Oc*jd-oe*vd;fe=Fd*nd-ed*jd;pe=ed*vd-md*nd;ge=md*jd-Fd*vd;var rd=-1,Vd,wd,Wd,qe=0;Wd=wd=Vd=0;if(0>id*mf+bd*Fe+cd*Wc){var he,zf,sh,tg,ug,vg;he=ma.x;zf=ma.y;sh=ma.z;tg=$a.x;ug=$a.y;vg=$a.z;var Ke,Ve,Mf;Ke=tg-he;Ve=ug-zf;Mf=vg-sh;var eg=Ke*he+Ve*zf+Mf*sh,eg=-eg/(Ke*Ke+Ve*Ve+Mf*Mf),fg;if(0>eg)g.x=he,g.y=zf,g.z=sh,fg=1;else if(1Vc*Hd+Mc*Ee+Nc*Ri){var Pf,Qf,Rf,Sf,Tf,Af;Pf=$a.x;Qf=$a.y;Rf=$a.z;Sf=Oa.x;Tf=Oa.y;Af=Oa.z;var ye,nf,Uf;ye=Sf-Pf;nf=Tf-Qf;Uf=Af-Rf;var of=ye*Pf+nf*Qf+Uf*Rf,of=-of/(ye*ye+nf*nf+Uf*Uf),hg;if(0>of)g.x=Pf,g.y=Qf,g.z=Rf,hg=1;else if(1rd||XdEc*fe+yc*pe+Bc*ge){var Nd,Od,yg,zg,Ag,Bg;Nd=ma.x;Od=ma.y;yg=ma.z;zg=Oa.x;Ag=Oa.y;Bg=Oa.z;var pf,Vf,si;pf=zg-Nd;Vf=Ag-Od;si=Bg-yg;var ig=pf*Nd+Vf*Od+si*yg,ig=-ig/(pf*pf+Vf*Vf+si*si),ti;if(0>ig)g.x=Nd,g.y=Od,g.z=yg,ti=1;else if(1rd||qfGc||Xf(nc*Og+xa*Jb+Fc*Ob)*Hb){var Yf,Zf,$f,Cf,Df,Ef,Me,Ff,jg,ag,bg,Ye,Gf,Hf,kg,be,ce,Pd;Yf=ma.x;Zf=ma.y;$f=ma.z;Cf=Ja.x;Df=Ja.y;Ef=Ja.z;Me=Oa.x;Ff=Oa.y;jg=Oa.z;ag=Cf-Yf;bg=Df-Zf;Ye=Ef-$f;Gf=Me-Cf;Hf=Ff-Df;kg=jg-Ef;be=Yf-Me;ce=Zf-Ff;Pd=$f-jg;var Yd,Zd,Gd;Yd=bg*kg-Ye*Hf;Zd=Ye*Gf-ag*kg;Gd=ag*Hf-bg*Gf;var gf,hf,jf,ue,kf,Qg,Ze,rf,cg;gf=bg*Gd-Ye*Zd;hf=Ye*Yd-ag*Gd;jf=ag*Zd-bg*Yd;ue=Hf*Gd-kg*Zd;kf=kg*Yd-Gf*Gd;Qg=Gf*Zd-Hf*Yd;Ze=ce*Gd-Pd*Zd;rf=Pd*Yd-be*Gd;cg=be*Zd-ce*Yd;var re=-1,sf,ze,Ae,tf=0;Ae=ze=sf=0;if(0>Yf*gf+Zf*hf+$f*jf){var $e,If,Dg,Eg,Fg,Gg;$e=ma.x;If=ma.y;Dg=ma.z;Eg=Ja.x;Fg=Ja.y;Gg=Ja.z;var af,bf,dg;af=Eg-$e;bf=Fg-If;dg=Gg-Dg;var lg=af*$e+bf*If+dg*Dg,lg=-lg/(af*af+bf*bf+dg*dg),te;if(0>lg)g.x=$e,g.y=If,g.z=Dg,te=1;else if(1Cf*ue+Df*kf+Ef*Qg){var th,uh,vh,wh,xh,yh;th=Ja.x;uh=Ja.y;vh=Ja.z;wh=Oa.x;xh=Oa.y;yh=Oa.z;var mg,ah,se;mg=wh-th;ah=xh-uh;se=yh-vh;var bh=mg*th+ah*uh+se*vh,bh=-bh/(mg*mg+ah*ah+se*se),ff;if(0>bh)g.x=th,g.y=uh,g.z=vh,ff=1;else if(1re||wiMe*Ze+Ff*rf+jg*cg){var zh,Ah,Bh,Ch,Dh,Eh;zh=ma.x;Ah=ma.y;Bh=ma.z;Ch=Oa.x;Dh=Oa.y;Eh=Oa.z;var ng,Rg,xi;ng=Ch-zh;Rg=Dh-Ah;xi=Eh-Bh;var ch=ng*zh+Rg*Ah+xi*Bh,ch=-ch/(ng*ng+Rg*Rg+xi*xi),yi;if(0>ch)g.x=zh,g.y=Ah,g.z=Bh,yi=1;else if(1re||ziGc||Ai(wa*Pg+pa*sc+Ca*Jd)*Hb){var dh,eh,fh,Gh,Hh,Ih,gh,hh,ih,Tg,Ug,Vg,Jh,Kh,Lh,Ne,Oe,Pe;dh=Ja.x;eh=Ja.y;fh=Ja.z;Gh=$a.x;Hh=$a.y;Ih=$a.z;gh=Oa.x;hh=Oa.y;ih=Oa.z;Tg=Gh-dh;Ug=Hh-eh;Vg=Ih-fh;Jh=gh-Gh;Kh=hh-Hh;Lh=ih-Ih;Ne=dh-gh;Oe=eh-hh;Pe=fh-ih;var cf,df,ef;cf=Ug*Lh-Vg*Kh;df=Vg*Jh-Tg*Lh;ef=Tg*Kh-Ug*Jh;var Mg,hi,ji,ki,ni,pi,Wg,jh,kh;Mg=Ug*ef-Vg*df;hi=Vg*cf-Tg*ef;ji=Tg*df-Ug*cf;ki=Kh*ef-Lh*df;ni=Lh*cf-Jh*ef;pi=Jh*df-Kh*cf;Wg=Oe*ef-Pe*df;jh=Pe*cf-Ne*ef;kh=Ne*df-Oe*cf;var uf=-1,Ig,og,pg,lh=0;pg=og=Ig=0;if(0>dh*Mg+eh*hi+fh*ji){var Mh,Nh,Oh,Ph,Qh,Rh;Mh=Ja.x;Nh=Ja.y;Oh=Ja.z;Ph=$a.x;Qh=$a.y;Rh=$a.z;var qg,mh,Bi;qg=Ph-Mh;mh=Qh-Nh;Bi=Rh-Oh;var nh=qg*Mh+mh*Nh+Bi*Oh,nh=-nh/(qg*qg+mh*mh+Bi*Bi),Si;if(0>nh)g.x=Mh,g.y=Nh,g.z=Oh,Si=1;else if(1Gh*ki+Hh*ni+Ih*pi){var Sh,Th,Uh,Vh,Wh,Xh;Sh=$a.x;Th=$a.y;Uh=$a.z;Vh=Oa.x;Wh=Oa.y;Xh=Oa.z;var rg,oh,Fi;rg=Vh-Sh;oh=Wh-Th;Fi=Xh-Uh;var ph=rg*Sh+oh*Th+Fi*Uh,ph=-ph/(rg*rg+oh*oh+Fi*Fi),Ti;if(0>ph)g.x=Sh,g.y=Th,g.z=Uh,Ti=1;else if(1uf||Iigh*Wg+hh*jh+ih*kh){var Yh,Zh,$h,ai,bi,ci;Yh=Ja.x;Zh=Ja.y;$h=Ja.z;ai=Oa.x;bi=Oa.y;ci=Oa.z;var sg,Xg,Ji;sg=ai-Yh;Xg=bi-Zh;Ji=ci-$h;var qh=sg*Yh+Xg*Zh+Ji*$h,qh=-qh/(sg*sg+Xg*Xg+Ji*Ji),Ki;if(0>qh)g.x=Yh,g.y=Zh,g.z=$h,Ki=1;else if(1uf||LiGc||cjg.x*g.x+g.y*g.y+g.z*g.z){if(!z||4==this.Ba){h.fraction=z;break}this.Km();h.fraction=z;var Be=h.normal;Be.x=k.x;Be.y=k.y;Be.z=k.z;var rh=Math.sqrt(Be.x*Be.x+Be.y*Be.y+Be.z*Be.z);0k.x*k.x+k.y*k.y+k.z*k.z)throw Error("!?");var Mi=l[this.Ba],Ui=Mi.x*k.x+Mi.y*k.y+Mi.z*k.z;if(0>Ui){if(0<=D.x*k.x+D.y*k.y+D.z*k.z)break;var nj=Ui/(D.x*k.x+D.y*k.y+D.z*k.z),z=z+nj;if(1<=z)break;n.x+=D.x*nj;n.y+=D.y*nj;n.z+=D.z*nj;for(var Vi=0,ij=this.Ba+1;Vifj*fj+gj*gj+hj*hj){Wi=!0;break}}Wi||this.Ba++;++u}return!1},Km:function(){switch(this.Ba){case 1:var a=this.closestPoint1,b=this.eb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,d=this.ib[0];e.x=d.x;e.y=d.y;e.z=d.z;break;case 2:var c,f,h,l=this.closest;c=l.x;f=l.y;h=l.z;var g,k,m,p,r,q,t,A,L,u,n,fc,D,Ib,y,B,E,K,H=this.La[0];g=H.x;k=H.y;m=H.z;var mc=this.eb[0];p=mc.x;r=mc.y;q=mc.z;var R=this.ib[0];t=R.x;A=R.y;L=R.z;var x=this.La[1];u=x.x;n=x.y;fc=x.z;var X=this.eb[1];D=X.x;Ib=X.y;y=X.z;var F=this.ib[1];B=F.x;E=F.y;K=F.z;var I,qa,N;I=u-g;qa=n-k;N=fc-m;var ya=I*I+qa*qa+N*N;ya&&(ya=1/ya);var J=((c-g)*I+(f-k)*qa+(h-m)*N)*ya,Ea,O,sa,ba,za,Ta,C,Aa,na;Ea=D-p;O=Ib-r;sa=y-q;ba=p+Ea*J;za=r+O*J;Ta=q+sa*J;Ea=B-t;O=E-A;sa=K-L;C=t+Ea*J;Aa=A+O*J;na=L+sa*J;var La=this.closestPoint1;La.x=ba;La.y=za;La.z=Ta;var Ba=this.closestPoint2;Ba.x=C;Ba.y=Aa;Ba.z=na;break;case 3:var ta,S,ha,ea=this.closest;ta=ea.x;S=ea.y;ha=ea.z;var da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab=this.La[0];da=Ab.x;M=Ab.y;T=Ab.z;var ib=this.eb[0];w=ib.x;V=ib.y;ia=ib.z;var hb=this.ib[0];Y=hb.x;oa=hb.y;ua=hb.z;var ka=this.La[1];ca=ka.x;Ma=ka.y;va=ka.z;var Ia=this.eb[1];Z=Ia.x;Pa=Ia.y;Fa=Ia.z;var ab=this.ib[1];Q=ab.x;aa=ab.y;fa=ab.z;var bb=this.La[2];Rd=bb.x;ja=bb.y;Ga=bb.z;var Wa=this.eb[2];P=Wa.x;Ya=Wa.y;wa=Wa.z;var Va=this.ib[2];wb=Va.x;ec=Va.y;Vb=Va.z;var qb,kb,Sa,Na,Za,vb,mb,xb,nb;qb=ca-da;kb=Ma-M;Sa=va-T;Na=Rd-da;Za=ja-M;vb=Ga-T;mb=ta-da;xb=S-M;nb=ha-T;var fb=qb*qb+kb*kb+Sa*Sa,pa=qb*Na+kb*Za+Sa*vb,Db=Na*Na+Za*Za+vb*vb,G=qb*mb+kb*xb+Sa*nb,sb=Na*mb+Za*xb+vb*nb,jb=fb*Db-pa*pa;jb&&(jb=1/jb);var Xb=(G*Db-sb*pa)*jb,ob=(-G*pa+sb*fb)*jb,cb,zb,Xa,tb,v,W,U,db,cc;cb=Z-w;zb=Pa-V;Xa=Fa-ia;tb=w+cb*Xb;v=V+zb*Xb;W=ia+Xa*Xb;cb=P-w;zb=Ya-V;Xa=wa-ia;tb+=cb*ob;v+=zb*ob;W+=Xa*ob;cb=Q-Y;zb=aa-oa;Xa=fa-ua;U=Y+cb*Xb;db=oa+zb*Xb;cc=ua+Xa*Xb;cb=wb-Y;zb=ec-oa;Xa=Vb-ua;U+=cb*ob;db+=zb*ob;cc+=Xa*ob;var Ra=this.closestPoint1;Ra.x=tb;Ra.y=v;Ra.z=W;var Ha=this.closestPoint2;Ha.x=U;Ha.y=db;Ha.z=cc;break;default:throw Error("!?");}},yo:function(a){var b=this.dir;a=a.$l;b.x=a.x;b.y=a.y;b.z=a.z},Fo:function(a){a=a.$l;var b=this.closest;a.x=b.x;a.y=b.y;a.z=b.z;a.x=-a.x;a.y=-a.y;a.z=-a.z},an:function(a){this.Ba=a;this.Ba=(this.Ba&5)+(this.Ba>>1&5);this.Ba=(this.Ba&3)+(this.Ba>>2&3);switch(a){case 2:a=this.La[0];var b=this.La[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[1];a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.La[1];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 8:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.La[0];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a=this.La[2];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[2];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[2];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.La[0];b=this.La[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[0];b=this.eb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[0];b=this.ib[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.La[1];b=this.La[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.eb[1];b=this.eb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.ib[1];b=this.ib[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.La[0],b=this.La[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.eb[0],b=this.eb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.ib[0],b=this.ib[3],a.x=b.x,a.y=b.y,a.z=b.z}},Tf:function(a){var b,e,d,c,f,h;h=this.dir;c=h.x;f=h.y;h=h.z;var l;e=this.oc.o*c+this.oc.i*f+this.oc.l*h;l=this.oc.f*c+this.oc.m*f+this.oc.g*h;b=this.oc.h*c+this.oc.j*f+this.oc.s*h;d=this.dir;d.x=e;d.y=l;d.z=b;this.Kj.he(this.dir,this.eb[this.Ba]);a&&(a=this.dir,b=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=this.dir,e=this.Ij[a++];b.x=e.x;b.y=e.y;b.z=e.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--;b=this.dir;b.x=-b.x;b.y=-b.y;b.z=-b.z;this.Tf(!1);this.Uf(!1);b=this.La[this.Ba];e=this.eb[this.Ba];b.x=e.x;b.y=e.y;b.z=e.z;e=this.ib[this.Ba];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.Ba++;this.Wl();if(4==this.Ba)break;this.Ba--}},Wl:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;e=e.z;var d,c,f,h,l,g;f=this.La[0];d=f.x;c=f.y;f=f.z;g=this.La[1];h=g.x;l=g.y;g=g.z;d-=h;c-=l;f-=g;for(l=0;3>l;){var k,m;g=this.Ij[l++];h=g.x;k=g.y;m=g.z;g=c*m-f*k;m=f*h-d*m;h=d*k-c*h;k=this.dir;k.x=g;k.y=m;k.z=h;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--;g=this.dir;g.x=-g.x;g.y=-g.y;g.z=-g.z;this.Tf(!1);this.Uf(!1);g=this.La[this.Ba];h=this.eb[this.Ba];g.x=h.x;g.y=h.y;g.z=h.z;h=this.ib[this.Ba];g.x-=h.x;g.y-=h.y;g.z-=h.z;this.Ba++;this.dm();if(4==this.Ba)break;this.Ba--}d=this.dir;d.x=a;d.y=b;d.z=e},dm:function(){var a,b,e;e=this.dir;a=e.x;b=e.y;for(e=e.z;;){var d,c,f,h,l,g,k,m,p;f=this.La[0];d=f.x;c=f.y;f=f.z;m=this.La[1];h=m.x;l=m.y;g=m.z;p=this.La[2];k=p.x;m=p.y;p=p.z;h-=d;l-=c;g-=f;d=k-d;c=m-c;m=p-f;f=l*m-g*c;m=g*d-h*m;c=h*c-l*d;h=this.dir;h.x=f;h.y=m;h.z=c;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;c=this.dir;c.x=-c.x;c.y=-c.y;c.z=-c.z;this.Tf(!1);this.Uf(!1);c=this.La[this.Ba];f=this.eb[this.Ba];c.x=f.x;c.y=f.y;c.z=f.z;f=this.ib[this.Ba];c.x-=f.x;c.y-=f.y;c.z-=f.z;this.Ba++;if(this.Lm())break;this.Ba--;break}c=this.dir;c.x=a;c.y=b;c.z=e},Lm:function(){var a=this.La[2].x-this.La[0].x,b=this.La[2].y-this.La[0].y,e=this.La[2].z-this.La[0].z,d=this.La[3].x-this.La[0].x,c=this.La[3].y-this.La[0].y,f=this.La[3].z-this.La[0].z,a=(this.La[1].x-this.La[0].x)*(b*f-e*c)-(this.La[1].y-this.La[0].y)*(a*f-e*d)+(this.La[1].z-this.La[0].z)*(a*c-b*d);return 1E-12a},Ln:function(a,b,e,d,c,f,h){for(var l=this.ih;0x;){for(var R=this.ih.Cd,F=Infinity,X=null;null!=R;)R.nkE.x*C.x+E.y*C.y+E.z*C.z-(za.x*Ta.x+za.y*Ta.y+za.z*Ta.z)||39==x){var Aa=this.closest,na=this.dir;Aa.x=na.x;Aa.y=na.y;Aa.z=na.z;var La=this.dir,Ba=O.Rd,ta=this.dir,S=(La.x*Ba.x+La.y*Ba.y+La.z*Ba.z)/(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z);Aa.x*=S;Aa.y*=S;Aa.z*=S;var ha,ea,da,M=this.closest;ha=M.x;ea=M.y;da=M.z;var T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Rd,ja,Ga,P,Ya,wa,wb,ec,Vb,Ab,ib,hb=O.Rd;T=hb.x;w=hb.y;V=hb.z;var ka=O.eb;ia=ka.x;Y=ka.y;oa=ka.z;var Ia=O.ib;ua=Ia.x;ca=Ia.y;Ma=Ia.z;var ab=sa.Rd;va=ab.x;Z=ab.y;Pa=ab.z;var bb=sa.eb;Fa=bb.x;Q=bb.y;aa=bb.z;var Wa=sa.ib;fa=Wa.x;Rd=Wa.y;ja=Wa.z;var Va=ba.Rd;Ga=Va.x;P=Va.y;Ya=Va.z;var qb=ba.eb;wa=qb.x;wb=qb.y;ec=qb.z;var kb=ba.ib;Vb=kb.x;Ab=kb.y;ib=kb.z;var Sa,Na,Za,vb,mb,xb,nb,fb,pa;Sa=va-T;Na=Z-w;Za=Pa-V;vb=Ga-T;mb=P-w;xb=Ya-V;nb=ha-T;fb=ea-w;pa=da-V;var Db=Sa*Sa+Na*Na+Za*Za,G=Sa*vb+Na*mb+Za*xb,sb=vb*vb+mb*mb+xb*xb,jb=Sa*nb+Na*fb+Za*pa,Xb=vb*nb+mb*fb+xb*pa,ob=Db*sb-G*G;ob&&(ob=1/ob);var cb=(jb*sb-Xb*G)*ob,zb=(-jb*G+Xb*Db)*ob,Xa,tb,v,W,U,db,cc,Ra,Ha;Xa=Fa-ia;tb=Q-Y;v=aa-oa;W=ia+Xa*cb;U=Y+tb*cb;db=oa+v*cb;Xa=wa-ia;tb=wb-Y;v=ec-oa;W+=Xa*zb;U+=tb*zb;db+=v*zb;Xa=fa-ua;tb=Rd-ca;v=ja-Ma;cc=ua+Xa*cb;Ra=ca+tb*cb;Ha=Ma+v*cb;Xa=Vb-ua;tb=Ab-ca;v=ib-Ma;cc+=Xa*zb;Ra+=tb*zb;Ha+=v*zb;var rb=this.closestPoint1;rb.x=W;rb.y=U;rb.z=db;var yb=this.closestPoint2;yb.x=cc;yb.y=Ra;yb.z=Ha;var Cb=this.closest;this.depth=Math.sqrt(Cb.x*Cb.x+Cb.y*Cb.y+Cb.z*Cb.z);return dc.SUCCEEDED}var la=this.ih,ra=la.jf;null!=ra?(la.jf=ra.M,ra.M=null):ra=new te;var ga=ra.Aa(E,K,H);if(!this.ih.qn(ga,I))return dc.EPA_FAILED_TO_ADD_VERTEX;++x}return dc.EPA_DID_NOT_CONVERGE},wa:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!0)},mb:function(a,b,e,d,c){return this.Nj(a,b,e,d,c,!1)},Vf:function(a,b,e,d,c,f,h){return this.xm(a,b,e,d,c,f,h)},ke:function(a,b,e,d,c){var f=this.Io;f.v=e.x;f.A=e.y;f.B=e.z;var h=this.Jo,l=this.Ko;h.x=d.x;h.y=d.y;h.z=d.z;h.x-=e.x;h.y-=e.y;h.z-=e.z;l.R();return this.xm(null,a,f,b,h,l,c)}};Pc.wc=function(a,b,e){var d,c,f,h;d=a.x;c=a.y;a=a.z;f=b.x;h=b.y;b=b.z;var l,g,k;l=f-d;g=h-c;k=b-a;var m;m=-(l*d+g*c+k*a)/(l*l+g*g+k*k);if(0>m)return e.x=d,e.y=c,e.z=a,1;if(1c*(t*E-A*B)+f*(A*y-q*E)+h*(q*B-t*y)){K=a.x;H=a.y;x=a.z;R=b.x;F=b.y;q=b.z;var X;t=R-K;A=F-H;X=q-x;var I;I=-(t*K+A*H+X*x)/(t*t+A*A+X*X);0>I?(d.x=K,d.y=H,d.z=x,K=1):1l*(u*E-n*B)+g*(n*y-L*E)+k*(L*B-u*y)&&(l=b.x,g=b.y,b=b.z,k=e.x,L=e.y,u=e.z,n=k-l,q=L-g,t=u-b,A=-(n*l+q*g+t*b)/(n*n+q*q+t*t),0>A?(d.x=l,d.y=g,d.z=b,b=1):1K||lm*(D*E-Ib*B)+p*(Ib*y-fc*E)+r*(fc*B-D*y)&&(m=a.x,p=a.y,a=a.z,r=e.x,fc=e.y,e=e.z,D=r-m,Ib=fc-p,b=e-a,l=-(D*m+Ib*p+b*a)/(D*D+Ib*Ib+b*b),0>l?(d.x=m,d.y=p,d.z=a,e=1):1K||a(f*Da+h*qa+l*J)*Aa){var ha,ea,da,M,T,w,V,ia,Y,oa,ua,ca,Ma,va,Z,Pa,Fa,Q;ha=a.x;ea=a.y;da=a.z;M=b.x;T=b.y;w=b.z;V=e.x;ia=e.y;Y=e.z;oa=M-ha;ua=T-ea;ca=w-da;Ma=V-M;va=ia-T;Z=Y-w;Pa=ha-V;Fa=ea-ia;Q=da-Y;var aa,fa,Rd;aa=ua*Z-ca*va;fa=ca*Ma-oa*Z;Rd=oa*va-ua*Ma;var ja,Ga,P,Ya,wa,wb,ec,Vb,Ab;ja=ua*Rd-ca*fa;Ga=ca*aa-oa*Rd;P=oa*fa-ua*aa;Ya=va*Rd-Z*fa;wa=Z*aa-Ma*Rd;wb=Ma*fa-va*aa;ec=Fa*Rd-Q*fa;Vb=Q*aa-Pa*Rd;Ab=Pa*fa-Fa*aa;var ib=-1,hb,ka,Ia,ab=0;Ia=ka=hb=0;if(0>ha*ja+ea*Ga+da*P){var bb,Wa,Va,qb,kb,Sa;bb=a.x;Wa=a.y;Va=a.z;qb=b.x;kb=b.y;Sa=b.z;var Na,Za,vb;Na=qb-bb;Za=kb-Wa;vb=Sa-Va;var mb=Na*bb+Za*Wa+vb*Va,mb=-mb/(Na*Na+Za*Za+vb*vb),xb;if(0>mb)c.x=bb,c.y=Wa,c.z=Va,xb=1;else if(1M*Ya+T*wa+w*wb){var Db,G,sb,jb,Xb,ob;Db=b.x;G=b.y;sb=b.z;jb=e.x;Xb=e.y;ob=e.z;var cb,zb,Xa;cb=jb-Db;zb=Xb-G;Xa=ob-sb;var tb=cb*Db+zb*G+Xa*sb,tb=-tb/(cb*cb+zb*zb+Xa*Xa),v;if(0>tb)c.x=Db,c.y=G,c.z=sb,v=1;else if(1ib||ccV*ec+ia*Vb+Y*Ab){var Ra,Ha,rb,yb,Cb,la;Ra=a.x;Ha=a.y;rb=a.z;yb=e.x;Cb=e.y;la=e.z;var ra,ga,ma;ra=yb-Ra;ga=Cb-Ha;ma=la-rb;var Ja=ra*Ra+ga*Ha+ma*rb,Ja=-Ja/(ra*ra+ga*ga+ma*ma),$a;if(0>Ja)c.x=Ra,c.y=Ha,c.z=rb,$a=1;else if(1ib||Fc(f*ya+h*pa+l*Ea)*Aa){var gb,ub,xd,pb,Qa,de,Ic,Yb,oc,Id,$d,rc,Jc,Bb,Fb,Jb,hc,uc;gb=a.x;ub=a.y;xd=a.z;pb=e.x;Qa=e.y;de=e.z;Ic=d.x;Yb=d.y;oc=d.z;Id=pb-gb;$d=Qa-ub;rc=de-xd;Jc=Ic-pb;Bb=Yb-Qa;Fb=oc-de;Jb=gb-Ic;hc=ub-Yb;uc=xd-oc;var gc,Xc,Eb;gc=$d*Fb-rc*Bb;Xc=rc*Jc-Id*Fb;Eb=Id*Bb-$d*Jc;var Ng,Lb,Gb,Ob,xf,ic,Hb,Qb,Sb;Ng=$d*Eb-rc*Xc;Lb=rc*gc-Id*Eb;Gb=Id*Xc-$d*gc;Ob=Bb*Eb-Fb*Xc;xf=Fb*gc-Jc*Eb;ic=Jc*Xc-Bb*gc;Hb=hc*Eb-uc*Xc;Qb=uc*gc-Jb*Eb;Sb=Jb*Xc-hc*gc;var Nb=-1,sc,Jd,lb,Gc=0;lb=Jd=sc=0;if(0>gb*Ng+ub*Lb+xd*Gb){var Rb,vc,Kb,dc,bc,Pb;Rb=a.x;vc=a.y;Kb=a.z;dc=e.x;bc=e.y;Pb=e.z;var Wb,$b,Mb;Wb=dc-Rb;$b=bc-vc;Mb=Pb-Kb;var Tb=Wb*Rb+$b*vc+Mb*Kb,Tb=-Tb/(Wb*Wb+$b*$b+Mb*Mb),ac;if(0>Tb)c.x=Rb,c.y=vc,c.z=Kb,ac=1;else if(1pb*Ob+Qa*xf+de*ic){var kc,lc,kd,tc,jc,fd;kc=e.x;lc=e.y;kd=e.z;tc=d.x;jc=d.y;fd=d.z;var Rc,zc,gd;Rc=tc-kc;zc=jc-lc;gd=fd-kd;var Yc=Rc*kc+zc*lc+gd*kd,Yc=-Yc/(Rc*Rc+zc*zc+gd*gd),od;if(0>Yc)c.x=kc,c.y=lc,c.z=kd,od=1;else if(1Nb||ZcIc*Hb+Yb*Qb+oc*Sb){var Kc,Lc,xc,Cc,Dc,pd;Kc=a.x;Lc=a.y;xc=a.z;Cc=d.x;Dc=d.y;pd=d.z;var yd,sd,td;yd=Cc-Kc;sd=Dc-Lc;td=pd-xc;var zd=yd*Kc+sd*Lc+td*xc,zd=-zd/(yd*yd+sd*sd+td*td),Pc;if(0>zd)c.x=Kc,c.y=Lc,c.z=xc,Pc=1;else if(1Nb||Dena||Fe(f*O+h*sa+l*ba)*Aa){var je,Wc,Hd,se,te,Ge,He,Se,Te,Ie,Je,ae,xe,$c,Sc,ld,Ee,Qe;je=a.x;Wc=a.y;Hd=a.z;se=b.x;te=b.y;Ge=b.z;He=d.x;Se=d.y;Te=d.z;Ie=se-je;Je=te-Wc;ae=Ge-Hd;xe=He-se;$c=Se-te;Sc=Te-Ge;ld=je-He;Ee=Wc-Se;Qe=Hd-Te;var Ad,Bd,ud;Ad=Je*Sc-ae*$c;Bd=ae*xe-Ie*Sc;ud=Ie*$c-Je*xe;var ke,le,me,Cd,Dd,hd,Kd,ee,Td;ke=Je*ud-ae*Bd;le=ae*Ad-Ie*ud;me=Ie*Bd-Je*Ad;Cd=$c*ud-Sc*Bd;Dd=Sc*Ad-xe*ud;hd=xe*Bd-$c*Ad;Kd=Ee*ud-Qe*Bd;ee=Qe*Ad-ld*ud;Td=ld*Bd-Ee*Ad;var qd=-1,Ud,Ld,Md,ne=0;Md=Ld=Ud=0;if(0>je*ke+Wc*le+Hd*me){var Ue,ad,Ed,id,bd,cd;Ue=a.x;ad=a.y;Ed=a.z;id=b.x;bd=b.y;cd=b.z;var Vc,Mc,Nc;Vc=id-Ue;Mc=bd-ad;Nc=cd-Ed;var Ec=Vc*Ue+Mc*ad+Nc*Ed,Ec=-Ec/(Vc*Vc+Mc*Mc+Nc*Nc),yc;if(0>Ec)c.x=Ue,c.y=ad,c.z=Ed,yc=1;else if(1se*Cd+te*Dd+Ge*hd){var Hc,Oc,oe,lf,md,Fd;Hc=b.x;Oc=b.y;oe=b.z;lf=d.x;md=d.y;Fd=d.z;var ed,vd,jd;ed=lf-Hc;vd=md-Oc;jd=Fd-oe;var nd=ed*Hc+vd*Oc+jd*oe,nd=-nd/(ed*ed+vd*vd+jd*jd),mf;if(0>nd)c.x=Hc,c.y=Oc,c.z=oe,mf=1;else if(1qd||jfHe*Kd+Se*ee+Te*Td){var ue,fe,pe,ge,rd,Vd;ue=a.x;fe=a.y;pe=a.z;ge=d.x;rd=d.y;Vd=d.z;var wd,Wd,qe;wd=ge-ue;Wd=rd-fe;qe=Vd-pe;var he=wd*ue+Wd*fe+qe*pe,he=-he/(wd*wd+Wd*Wd+qe*qe),zf;if(0>he)c.x=ue,c.y=fe,c.z=pe,zf=1;else if(1qd||vgna||eg(g*za+k*Ta+m*C)*Aa){var fg,Nf,Of,gg,Pf,Qf,Rf,Sf,Tf,Af,ye,nf,Uf,of,hg,vf,wg,xg;fg=b.x;Nf=b.y;Of=b.z;gg=e.x;Pf=e.y;Qf=e.z;Rf=d.x;Sf=d.y;Tf=d.z;Af=gg-fg;ye=Pf-Nf;nf=Qf-Of;Uf=Rf-gg;of=Sf-Pf;hg=Tf-Qf;vf=fg-Rf;wg=Nf-Sf;xg=Of-Tf;var Xd,Nd,Od;Xd=ye*hg-nf*of;Nd=nf*Uf-Af*hg;Od=Af*of-ye*Uf;var yg,zg,Ag,Bg,pf,Vf,Kf,ig,Lf;yg=ye*Od-nf*Nd;zg=nf*Xd-Af*Od;Ag=Af*Nd-ye*Xd;Bg=of*Od-hg*Nd;pf=hg*Xd-Uf*Od;Vf=Uf*Nd-of*Xd;Kf=wg*Od-xg*Nd;ig=xg*Xd-vf*Od;Lf=vf*Nd-wg*Xd;var Wf=-1,Bf,We,qf,Cg=0;qf=We=Bf=0;if(0>fg*yg+Nf*zg+Of*Ag){var Le,Xe,Xf,Yf,Zf,$f;Le=b.x;Xe=b.y;Xf=b.z;Yf=e.x;Zf=e.y;$f=e.z;var Cf,Df,Ef;Cf=Yf-Le;Df=Zf-Xe;Ef=$f-Xf;var Me=Cf*Le+Df*Xe+Ef*Xf,Me=-Me/(Cf*Cf+Df*Df+Ef*Ef),Ff;if(0>Me)c.x=Le,c.y=Xe,c.z=Xf,Ff=1;else if(1gg*Bg+Pf*pf+Qf*Vf){var Ye,Gf,Hf,kg,be,ce;Ye=e.x;Gf=e.y;Hf=e.z;kg=d.x;be=d.y;ce=d.z;var Pd,Yd,Zd;Pd=kg-Ye;Yd=be-Gf;Zd=ce-Hf;var Gd=Pd*Ye+Yd*Gf+Zd*Hf,Gd=-Gd/(Pd*Pd+Yd*Yd+Zd*Zd),wf;if(0>Gd)c.x=Ye,c.y=Gf,c.z=Hf,wf=1;else if(1Wf||MgRf*Kf+Sf*ig+Tf*Lf){var Qg,Ze,rf,cg,re,sf;Qg=b.x;Ze=b.y;rf=b.z;cg=d.x;re=d.y;sf=d.z;var ze,Ae,tf;ze=cg-Qg;Ae=re-Ze;tf=sf-rf;var $e=ze*Qg+Ae*Ze+tf*rf,$e=-$e/(ze*ze+Ae*Ae+tf*tf),If;if(0>$e)c.x=Qg,c.y=Ze,c.z=rf,If=1;else if(1<$e)c.x=cg,c.y=re,c.z=sf,If=2;else{var Dg,Eg,Fg;Dg=Qg+ze*$e;Eg=Ze+Ae*$e;Fg=rf+tf*$e;c.x=Dg;c.y=Eg;c.z=Fg;If=3}var Gg=c.x*c.x+c.y*c.y+c.z*c.z;if(0>Wf||Ggna||lge?b>d?(b=Math.sqrt(b-e-d+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b,a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a},mb:function(a){var b=Math.sin(a.x),e=Math.sin(a.y),d=Math.sin(a.z),c=Math.cos(a.x),f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*d;this.e02=e;this.e10=c*d+a*b*e;this.e11=c*a-b*e*d;this.e12=-f*b;this.e20=b*d-c*a*e;this.e21=a*b+c*e*d;this.e22=c*f;return this},Fi:function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new n(.5*a,1.570796326794895,.5*a)):new n(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))},wc:function(a){return 0==a?new n(this.e00,this.e01,this.e02):1==a?new n(this.e10,this.e11,this.e12):2==a?new n(this.e20,this.e21,this.e22):null},kc:function(a){return 0==a?new n(this.e00,this.e10,this.e20):1==a?new n(this.e01,this.e11,this.e21):2==a?new n(this.e02,this.e12,this.e22):null},xc:function(a,b){0==a?b.Aa(this.e00,this.e01,this.e02):1==a?b.Aa(this.e10,this.e11,this.e12):2==a?b.Aa(this.e20,this.e21,this.e22):b.R()},lc:function(a,b){0==a?b.Aa(this.e00,this.e10,this.e20):1==a?b.Aa(this.e01,this.e11,this.e21):2==a?b.Aa(this.e02,this.e12,this.e22):b.R()},Kb:function(a,b,e){this.e00=a.x;this.e01=a.y;this.e02=a.z;this.e10=b.x;this.e11=b.y;this.e12=b.z;this.e20=e.x;this.e21=e.y;this.e22=e.z;return this},wa:function(a,b,e){this.e00=a.x;this.e01=b.x;this.e02=e.x;this.e10=a.y;this.e11=b.y;this.e12=e.y;this.e20=a.z;this.e21=b.z;this.e22=e.z;return this},toString:function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};pa.vd=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};pa.atan2=function(a,b){return Math.atan2(a,b)};pa.sqrt=function(a){return Math.sqrt(a)};pa.Cb=function(a,b,e){return ae?e:a};pa.Hc=function(){return Math.random()};pa.Uc=function(a,b){return a+Math.random()*(b-a)};pa.Wc=function(a,b){return new n(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};pa.Vc=function(){return new n(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};Nb.prototype={Dc:function(){return 0==this.b?new n:this.c[--this.b]},lc:function(){return 0==this.cb?new I:this.bb[--this.cb]},wc:function(){return 0==this.Ag?new J:this.eg[--this.Ag]},xc:function(){return 0==this.re?new wa:this.le[--this.re]},wa:function(a,b,e,d){if(null!=a){a.R();if(this.b==this.c.length){for(var c=Array(this.b<<1),f=0,h=this.b;ff?(f=-f,e=-a.x,d=-a.y,c=-a.z,a=-a.w):(e=a.x,d=a.y,c=a.z,a=a.w);if(.999999e?b>d?(b=Math.sqrt(b-e-d+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this},vd:function(){var a=new I,b=this.x,e=this.y,d=this.z,c=this.w,f=2*b,h=2*e,l=2*d,g=b*f,k=e*h,d=d*l,m=b*h,e=e*l,b=b*l,f=c*f,h=c*h,c=c*l;a.e00=1-k-d;a.e01=m-c;a.e02=b+h;a.e10=m+c;a.e11=1-g-d;a.e12=e-f;a.e20=b-h;a.e21=e+f;a.e22=1-g-k;return a},toString:function(){return"Quat["+(0F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?F.alternativeContactPositionCorrectionAlgorithm:F.defaultContactPositionCorrectionAlgorithm,a.incremental?this.qm.xo(a,this.C.a,this.D.a):this.qm.Lo(a,this.C.a,this.D.a)):this.Ia.df()}},kc:function(){return this.Ec},lc:function(){return this.Fc},Kk:function(){return this.Hh},mb:function(){return this.Ia},wa:function(){return this.ef},Kb:function(){return this.ia},Cb:function(){return this.M}};Zb.prototype={wa:function(){return this.me},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};De.prototype={On:function(){for(var a=this.hc.pe;null!=a;){for(var b=a.M;;){var e;a.Ch.Icg.J&&l.Kg.K&&l.Lg.L&&this.$m(d,c))){d=b.ia;c=b.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b==this.je&&(this.je=this.je.M);b==this.Le&&(this.Le=this.Le.ia);b.M=null;b.ia=null;d=b.rb.ia;c=b.rb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.rb==b.C.Mb&&(b.C.Mb=b.C.Mb.M);b.rb==b.C.ic&&(b.C.ic=b.C.ic.ia);b.rb.M=null;b.rb.ia=null;d=b.sb.ia;c=b.sb.M;null!=d&&(d.M=c);null!=c&&(c.ia=d);b.sb==b.D.Mb&&(b.D.Mb=b.D.Mb.M);b.sb==b.D.ic&&(b.D.ic=b.D.ic.ia);b.sb.M=null;b.sb.ia=null;b.C.Ne--;b.D.Ne--;b.rb.ad=null;b.sb.ad=null;b.rb.me=null;b.sb.me=null;b.Ec=null;b.Fc=null;b.C=null;b.D=null;b.Hh=!1;b.pj.df();b.Ia.df();b.$h=null;d=b.ef;d.Ec=null;d.Fc=null;d.C=null;d.D=null;d.Ej=null;d.Fj=null;b.M=this.Cg;this.Cg=b;this.Ui--;break}b.Bk=!(f.nah.na&&f.oah.oa&&f.pah.pa);break}b=e}},$m:function(a,b){var e=a.Vb,d=b.Vb;if(e==d||0!=e.Jb&&0!=d.Jb||!(a.kk&b.lk&&b.kk&a.lk))return!1;e.AhF.sleepingTimeThreshold&&(b.Bb=!0,b.wb=0)):b.wb=0;if(!b.Bb){if(0==b.Jb){var e=a*b.sk,d=e*e,e=1/(1+e+d*(.5+.16666666666666666*e+.041666666666666664*d)),d=a*b.hk,c=d*d,d=1/(1+d+c*(.5+.16666666666666666*d+.041666666666666664*c)),f,h,l,c=this.Fm*b.vh;f=this.Gm*b.vh;h=this.Hm*b.vh;c+=b.ai*b.qb;f+=b.bi*b.qb;h+=b.ci*b.qb;var g,k;g=b.S*b.Of+b.T*b.Pf+b.U*b.Qf;k=b.V*b.Of+b.W*b.Pf+b.X*b.Qf;l=b.Y*b.Of+b.Z*b.Pf+b.$*b.Qf;b.jb+=c*a;b.kb+=f*a;b.lb+=h*a;b.jb*=e;b.kb*=e;b.lb*=e;b.nb+=g*a;b.ob+=k*a;b.pb+=l*a;b.nb*=d;b.ob*=d;b.pb*=d}b.nm(a);for(a=b.Gc;null!=a;){e=a.M;c=b.ja;d=b.a;f=a.ja;h=a.ha;var m,p,r,q,t,A;l=c.o*h.o+c.f*h.i+c.h*h.l;g=c.o*h.f+c.f*h.m+c.h*h.g;k=c.o*h.h+c.f*h.j+c.h*h.s;m=c.i*h.o+c.m*h.i+c.j*h.l;p=c.i*h.f+c.m*h.m+c.j*h.g;r=c.i*h.h+c.m*h.j+c.j*h.s;q=c.l*h.o+c.g*h.i+c.s*h.l;t=c.l*h.f+c.g*h.m+c.s*h.g;A=c.l*h.h+c.g*h.j+c.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=p;f.j=r;f.l=q;f.g=t;f.s=A;l=c.o*h.v+c.f*h.A+c.h*h.B;g=c.i*h.v+c.m*h.A+c.j*h.B;h=c.l*h.v+c.g*h.A+c.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=c.v;f.A+=c.A;f.B+=c.B;c=a.a;f=a.ha;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;r=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=r;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;a.Fb.Lb(a.u,a.ja);d=a.u.na;c=a.u.oa;f=a.u.pa;h=a.u.ka;l=a.u.la;g=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=da.u.ka?h:a.u.ka;a.u.la=l>a.u.la?l:a.u.la;a.u.ma=g>a.u.ma?g:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,c=a.a.A-a.ja.A,f=a.a.B-a.ja.B,h=a.mc,h.x=d,h.y=c,h.z=f,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=e}}},Dn:function(a,b,e){for(var d=a.dt,c=!0,f=0,h=this.ag;fb.u.ka?g:b.u.ka;b.u.la=k>b.u.la?k:b.u.la;b.u.ma=m>b.u.ma?m:b.u.ma;null!=b.ub&&(f=b.a.v-b.ja.v,h=b.a.A-b.ja.A,l=b.a.B-b.ja.B,g=b.mc,g.x=f,g.y=h,g.z=l,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=c}}}};Ca.prototype={xl:function(){var a=Date.now()/1E3;this.Hi.xl();Ce.broadPhaseCollisionTime=1E3*(Date.now()/1E3-a);for(var a=Date.now()/1E3,b=this.Hi.je;null!=b;){var e=b.M;b.Bk||b.Fn();b=e}Ce.narrowPhaseCollisionTime=1E3*(Date.now()/1E3-a)},Cn:function(){var a=Date.now()/1E3;if(F.disableSleeping)for(var b=this.Nf;null!=b;)b.Bb=!1,b.wb=0,b=b.M;if(this.Fh.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var c=this.ra,f=0==c.b?new n:c.c[--c.b],c=this.ra,c=0==c.b?new n:c.c[--c.b];f.x=b.J;f.y=b.K;f.z=b.L;c.x=b.G;c.y=b.H;c.z=b.I;a.aabb(f,c,d);var h=this.ra;if(null!=f){f.R();if(h.b==h.c.length){for(var l=Array(h.b<<1),g=0,k=h.b;gF.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2:e.Bb?b.sleepingShapeColor1:e.wb>F.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1);if(a.drawShapes){var k=l.Fb,m=l.a;switch(k.Jb){case 0:a.sphere(m,k.ab,f);break;case 1:var p=k,r=this.ra,q=0==r.b?new n:r.c[--r.b],t=q;t.x=p.Te;t.y=p.Ue;t.z=p.Ve;a.box(m,q,f);var A=this.ra;if(null!=q){q.R();if(A.b==A.c.length){for(var L=Array(A.b<<1),u=0,z=A.b;ul?a.ellipse(b,e,d,f,f,g):a.arc(b,e,d,f,f,h,l,!0,g)}},km:function(a,b,e,d,c){if(dr;){r++;var q=Math.cos(g)*f,t=Math.sin(g)*h,A=Math.sqrt(q*q+t*t),L=Math.sin(.5*A),u=Math.cos(.5*A),z=k.R();z.x+=d.x*q;z.y+=d.y*q;z.z+=d.z*q;z.x+=c.x*t;z.y+=c.y*t;z.z+=c.z*t;q=1/A*L;k.x*=q;k.y*=q;k.z*=q;m.x=k.x;m.y=k.y;m.z=k.z;m.w=u;var fc=m.x,D=m.y,L=m.z,t=m.w,x=2*fc,y=2*D,A=2*L,u=fc*x,q=D*y,L=L*A,z=fc*y,D=D*A,fc=fc*A,x=t*x,y=t*y,t=t*A;p.e00=1-q-L;p.e01=z-t;p.e02=fc+y;p.e10=z+t;p.e11=1-u-L;p.e12=D-x;p.e20=fc-y;p.e21=D+x;p.e22=1-u-q;u=this.ra;u=0==u.b?new n:u.c[--u.b];u.x+=e.x*l;u.y+=e.y*l;u.z+=e.z*l;q=u.x*p.e10+u.y*p.e11+u.z*p.e12;t=u.x*p.e20+u.y*p.e21+u.z*p.e22;u.x=u.x*p.e00+u.y*p.e01+u.z*p.e02;u.y=q;u.z=t;u.x+=b.x;u.y+=b.y;u.z+=b.z;q=this.ra;if(null!=a){a.R();if(q.b==q.c.length){t=Array(q.b<<1);A=0;for(L=q.b;Ab||5e&&(e=-e);(d=e/.5235987755982984+.5|0)||(d=1);e=f;h=(h-f)/d;c=this.p;c=0==c.b?new n:c.c[--c.b];c.x=a.x;c.y=a.y;c.z=a.z;var g=Math.cos(f);c.x+=l.x*g;c.y+=l.y*g;c.z+=l.z*g;f=Math.sin(f);c.x+=b.x*f;c.y+=b.y*f;c.z+=b.z*f;f=c;for(c=0;cda;){var M=da++,T=this.fg[M],w=this.Mj[M];T.x=w.x;T.y=w.y;T.z=w.z;T.x*=ha;T.y*=ha;T.z*=ha;T.y+=ea;var V=this.fg[M],ia=V.x*q.e10+V.y*q.e11+V.z*q.e12,Y=V.x*q.e20+V.y*q.e21+V.z*q.e22;V.x=V.x*q.e00+V.y*q.e01+V.z*q.e02;V.y=ia;V.z=Y;var oa=this.Ee[M],ua=this.vm[M];oa.x=ua.x;oa.y=ua.y;oa.z=ua.z;oa.x*=ha;oa.y*=ha;oa.z*=ha;oa.y+=ea;var ca=this.Ee[M],Ma=ca.x*q.e10+ca.y*q.e11+ca.z*q.e12,va=ca.x*q.e20+ca.y*q.e21+ca.z*q.e22;ca.x=ca.x*q.e00+ca.y*q.e01+ca.z*q.e02;ca.y=Ma;ca.z=va;var Z=this.af[M],Pa=this.Mj[M];Z.x=Pa.x;Z.y=Pa.y;Z.z=Pa.z;var Fa=Z.x*q.e10+Z.y*q.e11+Z.z*q.e12,Q=Z.x*q.e20+Z.y*q.e21+Z.z*q.e22;Z.x=Z.x*q.e00+Z.y*q.e01+Z.z*q.e02;Z.y=Fa;Z.z=Q;Z.x*=b;Z.y*=b;Z.z*=b;Z.x+=p.x;Z.y+=p.y;Z.z+=p.z;var aa=this.af[M],fa=-e;aa.x+=l.x*fa;aa.y+=l.y*fa;aa.z+=l.z*fa}for(var wa=0;8>wa;){wa++;var ja=this.p,Ga=0==ja.b?new n:ja.c[--ja.b];Ga.x=l.x;Ga.y=l.y;Ga.z=l.z;var P=Ga;P.x=-P.x;P.y=-P.y;P.z=-P.z;var Ya=this.p;if(null!=P){P.R();if(Ya.b==Ya.c.length){for(var Ca=Array(Ya.b<<1),wb=0,ec=Ya.b;wbAb;){var ib=Ab++,hb=this.fg[ib],ka=this.Mj[ib];hb.x=ka.x;hb.y=ka.y;hb.z=ka.z;var Ia=hb.x*q.e10+hb.y*q.e11+hb.z*q.e12,ab=hb.x*q.e20+hb.y*q.e21+hb.z*q.e22;hb.x=hb.x*q.e00+hb.y*q.e01+hb.z*q.e02;hb.y=Ia;hb.z=ab;var bb=this.Ee[ib],Wa=this.fg[ib];bb.x=Wa.x;bb.y=Wa.y;bb.z=Wa.z;bb.x*=b;bb.y*=b;bb.z*=b;bb.x+=p.x;bb.y+=p.y;bb.z+=p.z;var Va=this.af[ib],qb=this.Ee[ib];Va.x=qb.x;Va.y=qb.y;Va.z=qb.z;var kb=this.Ee[ib];kb.x+=l.x*e;kb.y+=l.y*e;kb.z+=l.z*e;var Sa=this.af[ib],Na=-e;Sa.x+=l.x*Na;Sa.y+=l.y*Na;Sa.z+=l.z*Na}for(var Za=0;8>Za;){var vb=Za++,mb=A,xb=this.Ee[vb],nb=this.Ee[(vb+1)%8],fb=l,mb=u,xb=this.af[(vb+1)%8],nb=this.af[vb],Ka=this.p,Db=0==Ka.b?new n:Ka.c[--Ka.b];Db.x=l.x;Db.y=l.y;Db.z=l.z;var G=Db;G.x=-G.x;G.y=-G.y;G.z=-G.z;var fb=G,sb=this.p;if(null!=G){G.R();if(sb.b==sb.c.length){for(var jb=Array(sb.b<<1),Xb=0,ob=sb.b;XbL;)for(var u=L++,z=this.Yh[u].length,fc=0;fcK;){var H=K++;if(!H)for(var F=0;3>F;)for(var R=F++,N=this.Yh[R].length,X=0;Xpa;)for(var ya=pa++,wa=this.Yh[ya].length,Ea=0;EaTa;){var C=Ta++,Aa,na,La,Ba,ta,S,ha,ea;H?3==H?this.wireframe?(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C]):(Aa=t[4][0],na=t[H][(C+1)%8],La=t[H][C],ta=A[4][0],S=A[H][(C+1)%8],ha=A[H][C]):this.wireframe?(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C]):(Aa=t[H][C],na=t[H][(C+1)%8],La=t[H+1][C],Ba=t[H+1][(C+1)%8],ta=A[H][C],S=A[H][(C+1)%8],ha=A[H+1][C],ea=A[H+1][(C+1)%8],this.rect(Aa,La,Ba,na,ta,ha,ea,S,d)):this.wireframe?(Aa=t[0][0],na=t[1][C]):(Aa=t[0][0],na=t[1][C],La=t[1][(C+1)%8],ta=A[0][0],S=A[1][C],ha=A[1][(C+1)%8])}}var da=this.p,M=0==da.b?new n:da.c[--da.b];M.x=p.x;M.y=p.y;M.z=p.z;M.x+=l.x*e;M.y+=l.y*e;M.z+=l.z*e;var T=this.p,w=0==T.b?new n:T.c[--T.b];w.x=p.x;w.y=p.y;w.z=p.z;var V=-e;w.x+=l.x*V;w.y+=l.y*V;w.z+=l.z*V;if(this.wireframe){var ia=this.p,Y=0==ia.b?new n:ia.c[--ia.b];Y.x=M.x;Y.y=M.y;Y.z=M.z;var oa=-b;Y.x+=f.x*oa;Y.y+=f.y*oa;Y.z+=f.z*oa;Y.x+=0*k.x;Y.y+=0*k.y;Y.z+=0*k.z;var ua=this.p,ca=0==ua.b?new n:ua.c[--ua.b];ca.x=M.x;ca.y=M.y;ca.z=M.z;ca.x+=f.x*b;ca.y+=f.y*b;ca.z+=f.z*b;ca.x+=0*k.x;ca.y+=0*k.y;ca.z+=0*k.z;var Ma=this.p,va=0==Ma.b?new n:Ma.c[--Ma.b];va.x=M.x;va.y=M.y;va.z=M.z;va.x+=0*f.x;va.y+=0*f.y;va.z+=0*f.z;var Z=-b;va.x+=k.x*Z;va.y+=k.y*Z;va.z+=k.z*Z;var Pa=this.p,Fa=0==Pa.b?new n:Pa.c[--Pa.b];Fa.x=M.x;Fa.y=M.y;Fa.z=M.z;Fa.x+=0*f.x;Fa.y+=0*f.y;Fa.z+=0*f.z;Fa.x+=k.x*b;Fa.y+=k.y*b;Fa.z+=k.z*b;var Q=this.p,aa=0==Q.b?new n:Q.c[--Q.b];aa.x=w.x;aa.y=w.y;aa.z=w.z;var fa=-b;aa.x+=f.x*fa;aa.y+=f.y*fa;aa.z+=f.z*fa;aa.x+=0*k.x;aa.y+=0*k.y;aa.z+=0*k.z;var Ca=this.p,ja=0==Ca.b?new n:Ca.c[--Ca.b];ja.x=w.x;ja.y=w.y;ja.z=w.z;ja.x+=f.x*b;ja.y+=f.y*b;ja.z+=f.z*b;ja.x+=0*k.x;ja.y+=0*k.y;ja.z+=0*k.z;var Ga=this.p,P=0==Ga.b?new n:Ga.c[--Ga.b];P.x=w.x;P.y=w.y;P.z=w.z;P.x+=0*f.x;P.y+=0*f.y;P.z+=0*f.z;var Ya=-b;P.x+=k.x*Ya;P.y+=k.y*Ya;P.z+=k.z*Ya;var Ka=this.p,wb=0==Ka.b?new n:Ka.c[--Ka.b];wb.x=w.x;wb.y=w.y;wb.z=w.z;wb.x+=0*f.x;wb.y+=0*f.y;wb.z+=0*f.z;wb.x+=k.x*b;wb.y+=k.y*b;wb.z+=k.z*b;this.ellipse(M,f,k,b,b,d);this.ellipse(w,f,k,b,b,d);var ec=this.p;if(null!=Y){Y.R();if(ec.b==ec.c.length){for(var Vb=Array(ec.b<<1),Ab=0,ib=ec.b;Abyb;){var Cb=yb++,la=this.fg[Cb],ra=this.Mj[Cb];la.x=ra.x;la.y=ra.y;la.z=ra.z;var ga=la.x*q.e10+la.y*q.e11+la.z*q.e12,ma=la.x*q.e20+la.y*q.e21+la.z*q.e22;la.x=la.x*q.e00+la.y*q.e01+la.z*q.e02;la.y=ga;la.z=ma;var Ja=this.Ee[Cb],$a=this.fg[Cb];Ja.x=$a.x;Ja.y=$a.y;Ja.z=$a.z;Ja.x*=b;Ja.y*=b;Ja.z*=b;Ja.x+=p.x;Ja.y+=p.y;Ja.z+=p.z;var Oa=this.af[Cb],nc=this.Ee[Cb];Oa.x=nc.x;Oa.y=nc.y;Oa.z=nc.z;var xa=this.Ee[Cb];xa.x+=l.x*e;xa.y+=l.y*e;xa.z+=l.z*e;var Fc=this.af[Cb],eb=-e;Fc.x+=l.x*eb;Fc.y+=l.y*eb;Fc.z+=l.z*eb}for(var gb=0;8>gb;){var pb=gb++,Qa=this.fg[pb],ub=this.fg[(pb+1)%8];this.rect(this.Ee[pb],this.af[pb],this.af[(pb+1)%8],this.Ee[(pb+1)%8],Qa,Qa,ub,ub,d)}}var lb=this.p;if(null!=M){M.R();if(lb.b==lb.c.length){for(var Bb=Array(lb.b<<1),Fb=0,Nb=lb.b;Fbh;)for(var l=h++,g=this.Yh[l].length,k=0;kb;)for(h=b++,l=0;8>l;){var t=l++,A;h&&3!=h&&!this.wireframe&&(g=a[h][t],k=a[h][(t+1)%8],m=a[h+1][t],p=a[h+1][(t+1)%8],r=f[h][t],q=f[h][(t+1)%8],A=f[h+1][t],t=f[h+1][(t+1)%8],this.rect(g,m,p,k,r,A,t,q,e))}e=this.p;if(null!=c){c.R();if(e.b==e.c.length){a=Array(e.b<<1);f=0;for(b=e.b;fA.Oc)A.mg=!0,A=A.ne,A.dd=0,A.Kc=0,A.Jc=0,A.vb=0,A.mf=0,A.nf=0,A.pf=0;else{A.mg=!1;var L=b.rows[b.Da++];L.friction=p;L.Ka=0;var u=L.yg;u.sa=e;u.ta=d;u.ua=c;u.xa=e;u.ya=d;u.za=c;u.aa=A.zb*c-A.Ab*d;u.ba=A.Ab*e-A.yb*c;u.ca=A.yb*d-A.zb*e;u.da=A.Zb*c-A.$b*d;u.ea=A.$b*e-A.Yb*c;u.fa=A.Yb*d-A.Zb*e;u=L.Zj;u.sa=f;u.ta=h;u.ua=l;u.xa=f;u.ya=h;u.za=l;u.aa=A.zb*l-A.Ab*h;u.ba=A.Ab*f-A.yb*l;u.ca=A.yb*h-A.zb*f;u.da=A.Zb*l-A.$b*h;u.ea=A.$b*f-A.Yb*l;u.fa=A.Yb*h-A.Zb*f;u=L.Yj;u.sa=g;u.ta=k;u.ua=m;u.xa=g;u.ya=k;u.za=m;u.aa=A.zb*m-A.Ab*k;u.ba=A.Ab*g-A.yb*m;u.ca=A.yb*k-A.zb*g;u.da=A.Zb*m-A.$b*k;u.ea=A.$b*g-A.Yb*m;u.fa=A.Yb*k-A.Zb*g;u=L.yg;u=u.sa*this.C.jb+u.ta*this.C.kb+u.ua*this.C.lb+(u.aa*this.C.nb+u.ba*this.C.ob+u.ca*this.C.pb)-(u.xa*this.D.jb+u.ya*this.D.kb+u.za*this.D.lb+(u.da*this.D.nb+u.ea*this.D.ob+u.fa*this.D.pb));L.Fa=u<-F.contactEnableBounceThreshold&&!A.kf?-u*r:0;this.Sg==jc.BAUMGARTE&&A.Oc>F.linearSlop&&(u=(A.Oc-F.linearSlop)*F.velocityBaumgarte*a.invDt,L.Fal.Fa&&(l.Fa=0);l.qa=h.ne}}},rl:function(){this.Ia.pm(this.Ej,this.Fj)},mb:function(){return this.Ec},Cb:function(){return this.Fc},wa:function(){return this.Ia},Kk:function(){for(var a=0,b=this.Ia.oe;aF.contactPersistenceThreshold?this.Zm(a):(e+=this.Ia.Og*-c,d+=this.Ia.Pg*-c,b+=this.Ia.Qg*-c,e*e+d*d+b*b>F.contactPersistenceThreshold*F.contactPersistenceThreshold&&this.Zm(a))}},Zm:function(a){var b=--this.Ia.oe;if(a!=b){var e=this.Ia.Bc[a];this.Ia.Bc[a]=this.Ia.Bc[b];this.Ia.Bc[b]=e}a=this.Ia.Bc[b];a.Ff=0;a.Gf=0;a.Hf=0;a.If=0;a.Jf=0;a.Kf=0;a.yb=0;a.zb=0;a.Ab=0;a.Yb=0;a.Zb=0;a.$b=0;a.be=0;a.ce=0;a.de=0;a.ee=0;a.fe=0;a.ge=0;a.Oc=0;b=a.ne;b.dd=0;b.Kc=0;b.Jc=0;b.vb=0;b.mf=0;b.nf=0;b.pf=0;a.kf=!1;a.mg=!1;a.Ic=-1},Gn:function(a,b,e){var d=this.Ia.oe;if(d==F.maxManifoldPoints){var d=this.Ia.Bc[this.Nn(a,b,e)],c=a.position1;d.be=c.x;d.ce=c.y;d.de=c.z;c=a.position2;d.ee=c.x;d.fe=c.y;d.ge=c.z;d.yb=d.be-b.v;d.zb=d.ce-b.A;d.Ab=d.de-b.B;d.Yb=d.ee-e.v;d.Zb=d.fe-e.A;d.$b=d.ge-e.B;var f,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab;f=b.f*d.yb+b.m*d.zb+b.g*d.Ab;b=b.h*d.yb+b.j*d.zb+b.s*d.Ab;d.Ff=c;d.Gf=f;d.Hf=b;b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b;c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b;e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b;d.If=b;d.Jf=c;d.Kf=e;d.Oc=a.depth;e=d.ne;e.dd=0;e.Kc=0;e.Jc=0;e.vb=0;e.mf=0;e.nf=0;e.pf=0;d.Ic=a.id;d.kf=!1;d.mg=!1}else d=this.Ia.Bc[d],c=a.position1,d.be=c.x,d.ce=c.y,d.de=c.z,c=a.position2,d.ee=c.x,d.fe=c.y,d.ge=c.z,d.yb=d.be-b.v,d.zb=d.ce-b.A,d.Ab=d.de-b.B,d.Yb=d.ee-e.v,d.Zb=d.fe-e.A,d.$b=d.ge-e.B,c=b.o*d.yb+b.i*d.zb+b.l*d.Ab,f=b.f*d.yb+b.m*d.zb+b.g*d.Ab,b=b.h*d.yb+b.j*d.zb+b.s*d.Ab,d.Ff=c,d.Gf=f,d.Hf=b,b=e.o*d.Yb+e.i*d.Zb+e.l*d.$b,c=e.f*d.Yb+e.m*d.Zb+e.g*d.$b,e=e.h*d.Yb+e.j*d.Zb+e.s*d.$b,d.If=b,d.Jf=c,d.Kf=e,d.Oc=a.depth,e=d.ne,e.dd=0,e.Kc=0,e.Jc=0,e.vb=0,e.mf=0,e.nf=0,e.pf=0,d.Ic=a.id,d.kf=!1,d.mg=!1,this.Ia.oe++},Nn:function(a,b){var e=this.Ia.Bc[0],d=this.Ia.Bc[1],c=this.Ia.Bc[2],f=this.Ia.Bc[3],h=e.Oc,l=0;d.Oc>h&&(h=d.Oc,l=1);c.Oc>h&&(h=c.Oc,l=2);f.Oc>h&&(h=f.Oc,l=3);var g,k,m,p=a.position1;g=p.x;k=p.y;m=p.z;g-=b.v;k-=b.A;m-=b.B;var r=d.yb,q=d.zb,t=d.Ab,A=c.yb,L=c.zb,u=c.Ab,n=f.yb,x=f.zb,D=f.Ab,F,y,B,E,K,H,N,R,I,X,J,Da,qa,pa,ya,wa,Ea,O;F=A-r;y=L-q;B=u-t;E=g-n;K=k-x;H=m-D;N=n-r;R=x-q;I=D-t;X=g-A;J=k-L;Da=m-u;qa=g-r;pa=k-q;ya=m-t;wa=n-A;Ea=x-L;O=D-u;var sa,ba,za,Ta,C,Aa,na,La,Ba;sa=y*H-B*K;ba=B*E-F*H;za=F*K-y*E;Ta=R*Da-I*J;C=I*X-N*Da;Aa=N*J-R*X;na=pa*O-ya*Ea;La=ya*wa-qa*O;Ba=qa*Ea-pa*wa;var ta=sa*sa+ba*ba+za*za,S=Ta*Ta+C*C+Aa*Aa,ha=na*na+La*La+Ba*Ba,ea=e.yb,da=e.zb,M=e.Ab,T=c.yb,w=c.zb,V=c.Ab,ia=f.yb,Y=f.zb,oa=f.Ab,ua,ca,Ma,va,Z,Pa,Fa,Q,aa,fa,Ca,ja,Ga,P,Ya,Ka,wb,Ua;ua=T-ea;ca=w-da;Ma=V-M;va=g-ia;Z=k-Y;Pa=m-oa;Fa=ia-ea;Q=Y-da;aa=oa-M;fa=g-T;Ca=k-w;ja=m-V;Ga=g-ea;P=k-da;Ya=m-M;Ka=ia-T;wb=Y-w;Ua=oa-V;var Vb,Ab,ib,hb,ka,Ia,ab,bb,Wa;Vb=ca*Pa-Ma*Z;Ab=Ma*va-ua*Pa;ib=ua*Z-ca*va;hb=Q*ja-aa*Ca;ka=aa*fa-Fa*ja;Ia=Fa*Ca-Q*fa;ab=P*Ua-Ya*wb;bb=Ya*Ka-Ga*Ua;Wa=Ga*wb-P*Ka;var Va=Vb*Vb+Ab*Ab+ib*ib,qb=hb*hb+ka*ka+Ia*Ia,kb=ab*ab+bb*bb+Wa*Wa,Sa=Va>qb?Va>kb?Va:kb:qb>kb?qb:kb,Na=e.yb,Za=e.zb,vb=e.Ab,mb=d.yb,xb=d.zb,nb=d.Ab,fb=f.yb,gb=f.zb,Db=f.Ab,G,sb,jb,Xb,ob,cb,zb,Xa,tb,v,W,U,db,cc,Ra,Ha,rb,yb;G=mb-Na;sb=xb-Za;jb=nb-vb;Xb=g-fb;ob=k-gb;cb=m-Db;zb=fb-Na;Xa=gb-Za;tb=Db-vb;v=g-mb;W=k-xb;U=m-nb;db=g-Na;cc=k-Za;Ra=m-vb;Ha=fb-mb;rb=gb-xb;yb=Db-nb;var Cb,la,ra,ga,ma,Ja,$a,Oa,eb;Cb=sb*cb-jb*ob;la=jb*Xb-G*cb;ra=G*ob-sb*Xb;ga=Xa*U-tb*W;ma=tb*v-zb*U;Ja=zb*W-Xa*v;$a=cc*yb-Ra*rb;Oa=Ra*Ha-db*yb;eb=db*rb-cc*Ha;var xa=Cb*Cb+la*la+ra*ra,pb=ga*ga+ma*ma+Ja*Ja,lb=$a*$a+Oa*Oa+eb*eb,Qa=xa>pb?xa>lb?xa:lb:pb>lb?pb:lb,ub=e.yb,Bb=e.zb,Fb=e.Ab,Hb=d.yb,Kb=d.zb,Lb=d.Ab,Nb=c.yb,Ic=c.zb,Yb=c.Ab,oc,Mb,Pb,rc,Jc,Gb,Qb,Jb,hc,uc,gc,Ob,Eb,Rb,Sb,Tb,$b,Zb;oc=Hb-ub;Mb=Kb-Bb;Pb=Lb-Fb;rc=g-Nb;Jc=k-Ic;Gb=m-Yb;Qb=Nb-ub;Jb=Ic-Bb;hc=Yb-Fb;uc=g-Hb;gc=k-Kb;Ob=m-Lb;Eb=g-ub;Rb=k-Bb;Sb=m-Fb;Tb=Nb-Hb;$b=Ic-Kb;Zb=Yb-Lb;var ic,bc,Wb,ac,dc,sc,kc,lc,Gc;ic=Mb*Gb-Pb*Jc;bc=Pb*rc-oc*Gb;Wb=oc*Jc-Mb*rc;ac=Jb*Ob-hc*gc;dc=hc*uc-Qb*Ob;sc=Qb*gc-Jb*uc;kc=Rb*Zb-Sb*$b;lc=Sb*Tb-Eb*Zb;Gc=Eb*$b-Rb*Tb;var pc=ic*ic+bc*bc+Wb*Wb,vc=ac*ac+dc*dc+sc*sc,qc=kc*kc+lc*lc+Gc*Gc,tc=pc>vc?pc>qc?pc:qc:vc>qc?vc:qc,jc=ta>S?ta>ha?ta:ha:S>ha?S:ha,wc=0;if(Sa>jc&&1!=l||!l)jc=Sa,wc=1;Qa>jc&&2!=l&&(jc=Qa,wc=2);tc>jc&&3!=l&&(jc=tc,wc=3);return wc},Qn:function(a,b,e){for(var d=F.contactPersistenceThreshold*F.contactPersistenceThreshold,c=-1,f=0,h=this.Ia.oe;fe?(a=this.Ma,b=this.Na,d=this.Oa,e=a*a,c=b*b,f=d*d,ed?(a=this.Ma,b=this.Na,e=this.Oa,d=a*a,c=b*b,f=e*e,dg?b=k=e=0:f==g?(e=-Infinity,k=Infinity,b-=f):bg?(e=0,k=Infinity,b=b-g-l,0>b&&(b=0)):b=k=e=0;a.Ha=e;a.Ga=k;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},nh:function(a,b,e,d,c,f,h){var l=F.angularSlop;if(h)c=0,h=1;else{if(0e?b=g=k=0:f==e?(k=-Infinity,g=Infinity,b-=f):be?(k=0,g=Infinity,b=b-e-l,0>b&&(b=0)):b=g=k=0;a.Ha=k;a.Ga=g;a.Ka=c*(0==d?0:1/d);a.Fa=b*h},Mh:function(a,b){return b?1:this.Sg==jc.BAUMGARTE?a.invDt*F.velocityBaumgarte:0},Yg:function(a,b,e){var d=(this.C.S*a+this.C.T*b+this.C.U*e)*a+(this.C.V*a+this.C.W*b+this.C.X*e)*b+(this.C.Y*a+this.C.Z*b+this.C.$*e)*e,c=(this.D.S*a+this.D.T*b+this.D.U*e)*a+(this.D.V*a+this.D.W*b+this.D.X*e)*b+(this.D.Y*a+this.D.Z*b+this.D.$*e)*e;if(0this.nj*this.nj?this.jc.bm(this):0this.oj*this.oj&&this.jc.bm(this)},Ke:function(){return this.C},bf:function(){return this.D},hg:function(){return this.Jb},mb:function(){var a=new n;a.x=this.uf;a.y=this.vf;a.z=this.wf;return a},Kb:function(){var a=new n;a.x=this.xf;a.y=this.yf;a.z=this.zf;return a},Cb:function(a){a.x=this.uf;a.y=this.vf;a.z=this.wf},kc:function(a){a.x=this.xf;a.y=this.yf;a.z=this.zf},Fe:function(){var a=new n;a.x=this.sj;a.y=this.tj;a.z=this.uj;return a},He:function(){var a=new n;a.x=this.vj;a.y=this.wj;a.z=this.xj;return a},Ge:function(a){a.x=this.sj;a.y=this.tj;a.z=this.uj},Ie:function(a){a.x=this.vj;a.y=this.wj;a.z=this.xj},Hc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Vc:function(){var a=new I,b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k;return a},Uc:function(a){var b,e,d,c,f,h,l,g,k;b=this.fb;e=this.Xc;d=this.ve;c=this.gb;f=this.Yc;h=this.we;l=this.hb;g=this.Zc;k=this.xe;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},Wc:function(a){var b,e,d,c,f,h,l,g,k;b=this.Ob;e=this.se;d=this.Cf;c=this.Pb;f=this.te;h=this.Df;l=this.Qb;g=this.ue;k=this.Ef;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=l;a.e21=g;a.e22=k},wa:function(){return this.Sk},ig:function(a){this.Sk=a},vd:function(){return this.nj},jg:function(a){this.nj=a},ie:function(){return this.oj},kg:function(a){this.oj=a},Je:function(){return this.Sg},ph:function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.Sg=a},lc:function(){var a=new n;a.x=this.ej;a.y=this.fj;a.z=this.gj;return a},wc:function(a){a.x=this.ej;a.y=this.fj;a.z=this.gj},xc:function(){var a=new n;a.x=this.hj;a.y=this.ij;a.z=this.jj;return a},Dc:function(a){a.x=this.hj;a.y=this.ij;a.z=this.jj},gg:function(){return this.ia},cf:function(){return this.M}};Fb.wa=N;Fb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Re*d,d=this.Se*d,l,g=this.Yg(this.N.pc,this.N.qc,this.N.rc);if(0>=this.ul.frequency||!e){l=this.Eb[0];var k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=null;k.qa=l;this.ak(k,this.Bg,this.tl,1/(this.C.qb+this.D.qb),this.ul,b,e);l=k.va;l.sa=this.N.pc;l.ta=this.N.qc;l.ua=this.N.rc;l.xa=this.N.pc;l.ya=this.N.qc;l.za=this.N.rc;l.aa=this.bc*this.N.rc-this.cc*this.N.qc;l.ba=this.cc*this.N.pc-this.ac*this.N.rc;l.ca=this.ac*this.N.qc-this.bc*this.N.pc;l.da=this.ec*this.N.rc-this.fc*this.N.qc;l.ea=this.fc*this.N.pc-this.dc*this.N.rc;l.fa=this.dc*this.N.qc-this.ec*this.N.pc}l=this.Eb[1];k=a.rows[a.Da++];m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=l;k.Fa=c;k.Ka=0;k.Ha=-Infinity;k.Ga=Infinity;l=k.va;l.sa=this.N.yc;l.ta=this.N.zc;l.ua=this.N.Ac;l.xa=this.N.yc;l.ya=this.N.zc;l.za=this.N.Ac;l.aa=this.bc*this.N.Ac-this.cc*this.N.zc;l.ba=this.cc*this.N.yc-this.ac*this.N.Ac;l.ca=this.ac*this.N.zc-this.bc*this.N.yc;l.da=this.ec*this.N.Ac-this.fc*this.N.zc;l.ea=this.fc*this.N.yc-this.dc*this.N.Ac;l.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];l=a.rows[a.Da++];k=l.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;l.Fa=0;l.Ka=0;l.Ha=0;l.Ga=0;l.motorSpeed=0;l.tb=0;l.qa=c;l.Fa=f;l.Ka=0;l.Ha=-Infinity;l.Ga=Infinity;l=l.va;l.sa=this.N.Lc;l.ta=this.N.Mc;l.ua=this.N.Nc;l.xa=this.N.Lc;l.ya=this.N.Mc;l.za=this.N.Nc;l.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;l.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;l.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;l.da=this.ec*this.N.Nc-this.fc*this.N.Mc;l.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;l.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;if(0>=this.nl.frequency||!e)f=this.Eb[3],c=a.rows[a.Da++],l=c.va,l.sa=0,l.ta=0,l.ua=0,l.xa=0,l.ya=0,l.za=0,l.aa=0,l.ba=0,l.ca=0,l.da=0,l.ea=0,l.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.angle,this.ml,g,this.nl,b,e),l=c.va,l.aa=this.N.pc,l.ba=this.N.qc,l.ca=this.N.rc,l.da=this.N.pc,l.ea=this.N.qc,l.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=h;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;l=e.va;l.aa=this.N.yc;l.ba=this.N.zc;l.ca=this.N.Ac;l.da=this.N.yc;l.ea=this.N.zc;l.fa=this.N.Ac;h=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=h;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;l=a.va;l.aa=this.N.Lc;l.ba=this.N.Mc;l.ca=this.N.Nc;l.da=this.N.Lc;l.ea=this.N.Mc;l.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>pb*this.N.pc+xa*this.N.qc+lb*this.N.rc&&(this.angle=-this.angle);var Qa,ub,Bb;Qa=this.xf-this.uf;ub=this.yf-this.vf;Bb=this.zf-this.wf;this.Bg=Qa*this.N.pc+ub*this.N.qc+Bb*this.N.rc;this.Xf=Qa*this.N.yc+ub*this.N.zc+Bb*this.N.Ac;this.Yf=Qa*this.N.Lc+ub*this.N.Mc+Bb*this.N.Nc},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},po:function(){return this.ul},eo:function(){return this.nl},no:function(){return this.tl},bo:function(){return this.ml},Gl:function(){return this.angle},Jl:function(){return this.Bg}});Gb.prototype={Mg:function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var d=this.rigidBody1;a=this.localAnchor1;var c,f,h;c=e.x;f=e.y;h=e.z;c-=d.a.v;f-=d.a.A;h-=d.a.B;var l;b=d.a.o*c+d.a.i*f+d.a.l*h;l=d.a.f*c+d.a.m*f+d.a.g*h;d=d.a.h*c+d.a.j*f+d.a.s*h;a.x=b;a.y=l;a.z=d;b=this.rigidBody2;a=this.localAnchor2;l=e.x;d=e.y;f=e.z;l-=b.a.v;d-=b.a.A;f-=b.a.B;e=b.a.o*l+b.a.i*d+b.a.l*f;c=b.a.f*l+b.a.m*d+b.a.g*f;b=b.a.h*l+b.a.j*d+b.a.s*f;a.x=e;a.y=c;a.z=b}};wf.wa=Gb;wf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});Sb.wa=N;Sb.prototype=gb(N.prototype,{ud:function(a,b,e){var d,c=1/(this.C.qb+this.D.qb),f=this.Yg(this.wd,this.xd,this.yd),h=this.Yg(this.kd,this.ld,this.md),l=this.Yg(this.zd,this.Ad,this.Bd);if(0>=this.Rf[0].frequency||!e){d=this.Eb[0];var g=a.rows[a.Da++],k=g.va;k.sa=0;k.ta=0;k.ua=0;k.xa=0;k.ya=0;k.za=0;k.aa=0;k.ba=0;k.ca=0;k.da=0;k.ea=0;k.fa=0;g.Fa=0;g.Ka=0;g.Ha=0;g.Ga=0;g.motorSpeed=0;g.tb=0;g.qa=d;this.ak(g,this.translationX,this.qg[0],c,this.Rf[0],b,e);d=g.va;d.sa=this.fb;d.ta=this.gb;d.ua=this.hb;d.xa=this.fb;d.ya=this.gb;d.za=this.hb;d.aa=this.bc*this.hb-this.cc*this.gb;d.ba=this.cc*this.fb-this.ac*this.hb;d.ca=this.ac*this.gb-this.bc*this.fb;d.da=this.ec*this.hb-this.fc*this.gb;d.ea=this.fc*this.fb-this.dc*this.hb;d.fa=this.dc*this.gb-this.ec*this.fb}if(0>=this.Rf[1].frequency||!e)d=this.Eb[1],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.translationY,this.qg[1],c,this.Rf[1],b,e),d=g.va,d.sa=this.Xc,d.ta=this.Yc,d.ua=this.Zc,d.xa=this.Xc,d.ya=this.Yc,d.za=this.Zc,d.aa=this.bc*this.Zc-this.cc*this.Yc,d.ba=this.cc*this.Xc-this.ac*this.Zc,d.ca=this.ac*this.Yc-this.bc*this.Xc,d.da=this.ec*this.Zc-this.fc*this.Yc,d.ea=this.fc*this.Xc-this.dc*this.Zc,d.fa=this.dc*this.Yc-this.ec*this.Xc;if(0>=this.Rf[2].frequency||!e)d=this.Eb[2],g=a.rows[a.Da++],k=g.va,k.sa=0,k.ta=0,k.ua=0,k.xa=0,k.ya=0,k.za=0,k.aa=0,k.ba=0,k.ca=0,k.da=0,k.ea=0,k.fa=0,g.Fa=0,g.Ka=0,g.Ha=0,g.Ga=0,g.motorSpeed=0,g.tb=0,g.qa=d,this.ak(g,this.cm,this.qg[2],c,this.Rf[2],b,e),d=g.va,d.sa=this.ve,d.ta=this.we,d.ua=this.xe,d.xa=this.ve,d.ya=this.we,d.za=this.xe,d.aa=this.bc*this.xe-this.cc*this.we,d.ba=this.cc*this.ve-this.ac*this.xe,d.ca=this.ac*this.we-this.bc*this.ve,d.da=this.ec*this.xe-this.fc*this.we,d.ea=this.fc*this.ve-this.dc*this.xe,d.fa=this.dc*this.we-this.ec*this.ve;this.dk||!(0>=this.Tg[0].frequency)&&e||(c=this.Eb[3],d=a.rows[a.Da++],g=d.va,g.sa=0,g.ta=0,g.ua=0,g.xa=0,g.ya=0,g.za=0,g.aa=0,g.ba=0,g.ca=0,g.da=0,g.ea=0,g.fa=0,d.Fa=0,d.Ka=0,d.Ha=0,d.Ga=0,d.motorSpeed=0,d.tb=0,d.qa=c,this.nh(d,this.Af,this.pg[0],f,this.Tg[0],b,e),d=d.va,d.aa=this.wd,d.ba=this.xd,d.ca=this.yd,d.da=this.wd,d.ea=this.xd,d.fa=this.yd);this.ek||!(0>=this.Tg[1].frequency)&&e||(f=this.Eb[4],c=a.rows[a.Da++],d=c.va,d.sa=0,d.ta=0,d.ua=0,d.xa=0,d.ya=0,d.za=0,d.aa=0,d.ba=0,d.ca=0,d.da=0,d.ea=0,d.fa=0,c.Fa=0,c.Ka=0,c.Ha=0,c.Ga=0,c.motorSpeed=0,c.tb=0,c.qa=f,this.nh(c,this.qh,this.pg[1],h,this.Tg[1],b,e),d=c.va,d.aa=this.kd,d.ba=this.ld,d.ca=this.md,d.da=this.kd,d.ea=this.ld,d.fa=this.md);this.fk||!(0>=this.Tg[2].frequency)&&e||(h=this.Eb[5],a=a.rows[a.Da++],f=a.va,f.sa=0,f.ta=0,f.ua=0,f.xa=0,f.ya=0,f.za=0,f.aa=0,f.ba=0,f.ca=0,f.da=0,f.ea=0,f.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=h,this.nh(a,this.Bf,this.pg[2],l,this.Tg[2],b,e),d=a.va,d.aa=this.zd,d.ba=this.Ad,d.ca=this.Bd,d.da=this.zd,d.ea=this.Ad,d.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;a=this.xf-this.uf;b=this.yf-this.vf;e=this.zf-this.wf;this.translationX=a*this.fb+b*this.gb+e*this.hb;this.translationY=a*this.Xc+b*this.Yc+e*this.Zc;this.cm=a*this.ve+b*this.we+e*this.xe},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Un:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},Vn:function(){var a=new n;a.x=this.kd;a.y=this.ld;a.z=this.md;return a},Wn:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},qo:function(){return this.Rf.slice(0)},fo:function(){return this.Rf.slice(0)},oo:function(){return this.qg.slice(0)},co:function(){return this.pg.slice(0)},Tn:function(){return new n(this.Af,this.qh,this.Bf)},ro:function(){return new n(this.translationX,this.translationY,this.cm)}});Lg.wa=Gb;Lg.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);var f=a.a;b=b.a;var h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B;h=d.e00;l=d.e01;g=d.e02;k=d.e10;m=d.e11;p=d.e12;r=d.e20;q=d.e21;t=d.e22;A=c.e00;n=c.e01;u=c.e02;z=c.e10;x=c.e11;D=c.e12;F=c.e20;y=c.e21;B=c.e22;var E,K;c=f.o*h+f.i*k+f.l*r;d=f.o*l+f.i*m+f.l*q;a=f.o*g+f.i*p+f.l*t;e=f.f*h+f.m*k+f.g*r;E=f.f*l+f.m*m+f.g*q;K=f.f*g+f.m*p+f.g*t;h=f.h*h+f.j*k+f.s*r;l=f.h*l+f.j*m+f.s*q;k=f.h*g+f.j*p+f.s*t;f=b.o*A+b.i*z+b.l*F;g=b.o*n+b.i*x+b.l*y;p=b.o*u+b.i*D+b.l*B;m=b.f*A+b.m*z+b.g*F;q=b.f*n+b.m*x+b.g*y;t=b.f*u+b.m*D+b.g*B;A=b.h*A+b.j*z+b.s*F;n=b.h*n+b.j*x+b.s*y;b=b.h*u+b.j*D+b.s*B;u=this.localBasis1;u.e00=c;u.e01=d;u.e02=a;u.e10=e;u.e11=E;u.e12=K;u.e20=h;u.e21=l;u.e22=k;c=this.localBasis2;c.e00=f;c.e01=g;c.e02=p;c.e10=m;c.e11=q;c.e12=t;c.e20=A;c.e21=n;c.e22=b;return this}});qc.prototype={wa:function(){return this.gl},Cb:function(){return this.ad},Kb:function(){return this.ia},mb:function(){return this.M}};Jb.wa=N;Jb.prototype=gb(N.prototype,{ud:function(a,b,e){var d=this.Mh(b,e),c=this.Xf*d,f=this.Yf*d,h=this.Jh*d,l=this.Re*d,d=this.Se*d;if(0>=this.Pe.frequency||!e){var g=this.Eb[0],k=a.rows[a.Da++],m=k.va;m.sa=0;m.ta=0;m.ua=0;m.xa=0;m.ya=0;m.za=0;m.aa=0;m.ba=0;m.ca=0;m.da=0;m.ea=0;m.fa=0;k.Fa=0;k.Ka=0;k.Ha=0;k.Ga=0;k.motorSpeed=0;k.tb=0;k.qa=g;this.ak(k,this.Bg,this.fi,1/(this.C.qb+this.D.qb),this.Pe,b,e);b=k.va;b.sa=this.N.pc;b.ta=this.N.qc;b.ua=this.N.rc;b.xa=this.N.pc;b.ya=this.N.qc;b.za=this.N.rc;b.aa=this.bc*this.N.rc-this.cc*this.N.qc;b.ba=this.cc*this.N.pc-this.ac*this.N.rc;b.ca=this.ac*this.N.qc-this.bc*this.N.pc;b.da=this.ec*this.N.rc-this.fc*this.N.qc;b.ea=this.fc*this.N.pc-this.dc*this.N.rc;b.fa=this.dc*this.N.qc-this.ec*this.N.pc}b=this.Eb[1];e=a.rows[a.Da++];g=e.va;g.sa=0;g.ta=0;g.ua=0;g.xa=0;g.ya=0;g.za=0;g.aa=0;g.ba=0;g.ca=0;g.da=0;g.ea=0;g.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=c;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;b=e.va;b.sa=this.N.yc;b.ta=this.N.zc;b.ua=this.N.Ac;b.xa=this.N.yc;b.ya=this.N.zc;b.za=this.N.Ac;b.aa=this.bc*this.N.Ac-this.cc*this.N.zc;b.ba=this.cc*this.N.yc-this.ac*this.N.Ac;b.ca=this.ac*this.N.zc-this.bc*this.N.yc;b.da=this.ec*this.N.Ac-this.fc*this.N.zc;b.ea=this.fc*this.N.yc-this.dc*this.N.Ac;b.fa=this.dc*this.N.zc-this.ec*this.N.yc;c=this.Eb[2];b=a.rows[a.Da++];e=b.va;e.sa=0;e.ta=0;e.ua=0;e.xa=0;e.ya=0;e.za=0;e.aa=0;e.ba=0;e.ca=0;e.da=0;e.ea=0;e.fa=0;b.Fa=0;b.Ka=0;b.Ha=0;b.Ga=0;b.motorSpeed=0;b.tb=0;b.qa=c;b.Fa=f;b.Ka=0;b.Ha=-Infinity;b.Ga=Infinity;b=b.va;b.sa=this.N.Lc;b.ta=this.N.Mc;b.ua=this.N.Nc;b.xa=this.N.Lc;b.ya=this.N.Mc;b.za=this.N.Nc;b.aa=this.bc*this.N.Nc-this.cc*this.N.Mc;b.ba=this.cc*this.N.Lc-this.ac*this.N.Nc;b.ca=this.ac*this.N.Mc-this.bc*this.N.Lc;b.da=this.ec*this.N.Nc-this.fc*this.N.Mc;b.ea=this.fc*this.N.Lc-this.dc*this.N.Nc;b.fa=this.dc*this.N.Mc-this.ec*this.N.Lc;f=this.Eb[3];c=a.rows[a.Da++];b=c.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;c.Fa=0;c.Ka=0;c.Ha=0;c.Ga=0;c.motorSpeed=0;c.tb=0;c.qa=f;c.Fa=h;c.Ka=0;c.Ha=-Infinity;c.Ga=Infinity;b=c.va;b.aa=1;b.ba=0;b.ca=0;b.da=1;b.ea=0;b.fa=0;h=this.Eb[4];f=a.rows[a.Da++];c=f.va;c.sa=0;c.ta=0;c.ua=0;c.xa=0;c.ya=0;c.za=0;c.aa=0;c.ba=0;c.ca=0;c.da=0;c.ea=0;c.fa=0;f.Fa=0;f.Ka=0;f.Ha=0;f.Ga=0;f.motorSpeed=0;f.tb=0;f.qa=h;f.Fa=l;f.Ka=0;f.Ha=-Infinity;f.Ga=Infinity;b=f.va;b.aa=0;b.ba=1;b.ca=0;b.da=0;b.ea=1;b.fa=0;l=this.Eb[5];a=a.rows[a.Da++];h=a.va;h.sa=0;h.ta=0;h.ua=0;h.xa=0;h.ya=0;h.za=0;h.aa=0;h.ba=0;h.ca=0;h.da=0;h.ea=0;h.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;b=a.va;b.aa=0;b.ba=0;b.ca=1;b.da=0;b.ea=0;b.fa=1},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qbJb?Gb>gc?(Eb=Math.sqrt(Gb-Jb-gc+1),Sb=.5*Eb,Eb=.5/Eb,Tb=(Yb+Qb)*Eb,hc=(oc+Ob)*Eb,uc=(Rb-rc)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb):Jb>gc?(Eb=Math.sqrt(Jb-gc-Gb+1),Tb=.5*Eb,Eb=.5/Eb,Sb=(Yb+Qb)*Eb,hc=(rc+Rb)*Eb,uc=(oc-Ob)*Eb):(Eb=Math.sqrt(gc-Gb-Jb+1),hc=.5*Eb,Eb=.5/Eb,Sb=(oc+Ob)*Eb,Tb=(rc+Rb)*Eb,uc=(Qb-Yb)*Eb);var Zb=uc,bc=2*(-1>=Zb?3.14159265358979:1<=Zb?0:Math.acos(Zb));this.Jh=Sb;this.Re=Tb;this.Se=hc;var Wb=this.Jh*this.Jh+this.Re*this.Re+this.Se*this.Se;0=this.ql.frequency||!e)&&(h=this.Eb[3],p=a.rows[a.Da++],r=p.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,p.Fa=0,p.Ka=0,p.Ha=0,p.Ga=0,p.motorSpeed=0,p.tb=0,p.qa=h,this.nh(p,this.bk,this.Fl,x,this.ql,b,e),c=p.va,c.aa=this.Be,c.ba=this.Ce,c.ca=this.De,c.da=this.Be,c.ea=this.Ce,c.fa=this.De);if(0>=this.wl.frequency||!e)x=this.Eb[4],a=a.rows[a.Da++],h=a.va,h.sa=0,h.ta=0,h.ua=0,h.xa=0,h.ya=0,h.za=0,h.aa=0,h.ba=0,h.ca=0,h.da=0,h.ea=0,h.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=x,this.nh(a,this.Hj,this.vl,d,this.wl,b,e),c=a.va,c.aa=this.Ai,c.ba=this.Bi,c.ca=this.Ci,c.da=this.Ai,c.ea=this.Bi,c.fa=this.Ci},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f;a=this.fb;b=this.gb;e=this.hb;d=this.Ob;c=this.Pb;f=this.Qb;var h,l,g,k,m,p,r,q,t;h=this.fb;l=this.Xc;g=this.ve;k=this.gb;m=this.Yc;p=this.we;r=this.hb;q=this.Zc;t=this.xe;var A,n,u,z,x,D,F,y;D=a*d+b*c+e*f;-.999999999>D?(x=a*a,d=b*b,c=e*e,x=z?3.14159265358979:1<=z?0:Math.acos(z));z=A;y=u;u=a*this.se+x*this.te+D*this.ue;B=b*this.se+d*this.te+f*this.ue;A=e*this.se+c*this.te+F*this.ue;this.Hj=Math.atan2(this.ve*u+this.we*B+this.xe*A,this.Xc*u+this.Yc*B+this.Zc*A);this.Ai=this.fb+this.Ob;this.Bi=this.gb+this.Pb;this.Ci=this.hb+this.Qb;A=this.Ai*this.Ai+this.Bi*this.Bi+this.Ci*this.Ci;0=this.Pe.frequency||!e)h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.angle,this.fi,D,this.Pe,b,e),c=r.va,c.aa=this.N.pc,c.ba=this.N.qc,c.ca=this.N.rc,c.da=this.N.pc,c.ea=this.N.qc,c.fa=this.N.rc;b=this.Eb[4];e=a.rows[a.Da++];D=e.va;D.sa=0;D.ta=0;D.ua=0;D.xa=0;D.ya=0;D.za=0;D.aa=0;D.ba=0;D.ca=0;D.da=0;D.ea=0;D.fa=0;e.Fa=0;e.Ka=0;e.Ha=0;e.Ga=0;e.motorSpeed=0;e.tb=0;e.qa=b;e.Fa=l;e.Ka=0;e.Ha=-Infinity;e.Ga=Infinity;c=e.va;c.aa=this.N.yc;c.ba=this.N.zc;c.ca=this.N.Ac;c.da=this.N.yc;c.ea=this.N.zc;c.fa=this.N.Ac;l=this.Eb[5];a=a.rows[a.Da++];b=a.va;b.sa=0;b.ta=0;b.ua=0;b.xa=0;b.ya=0;b.za=0;b.aa=0;b.ba=0;b.ca=0;b.da=0;b.ea=0;b.fa=0;a.Fa=0;a.Ka=0;a.Ha=0;a.Ga=0;a.motorSpeed=0;a.tb=0;a.qa=l;a.Fa=d;a.Ka=0;a.Ha=-Infinity;a.Ga=Infinity;c=a.va;c.aa=this.N.Lc;c.ba=this.N.Mc;c.ca=this.N.Nc;c.da=this.N.Lc;c.ea=this.N.Mc;c.fa=this.N.Nc},bd:function(){N.prototype.bd.call(this);var a=this.N,b=a.ga.C.qb,e=a.ga.D.qb,d,c,f,h,l,g,k,m,p,r,q,t,A,n,u,z,x,D,F,y,B,E,K,H,I,R,J,X,pa,Da,qa=a.ga.fb*a.ga.Ob+a.ga.gb*a.ga.Pb+a.ga.hb*a.ga.Qb;if(-.999999999>qa){var wa,ya,Ca,Ea=a.ga.fb,O=a.ga.gb,sa=a.ga.hb,ba=Ea*Ea,za=O*O,Ta=sa*sa,C;baV&&(V=-V,da=-da,M=-M,T=-T,w=-w);if(.999999ab){var bb,Wa,Va,qb=I*I,kb=R*R,Sa=J*J,Na;qb=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja),Oa=ra*ra+ga*ga+ma*ma;0=Ja?3.14159265358979:1<=Ja?0:Math.acos(Ja);0>Qa*this.N.pc+xa*this.N.qc+ub*this.N.rc&&(this.angle=-this.angle);this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Ob;a.y=this.Pb;a.z=this.Qb;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Ob;a.y=this.Pb;a.z=this.Qb},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.Sb;a.y=this.Tb;a.z=this.Ub;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.Sb;a.y=this.Tb;a.z=this.Ub},Qj:function(){return this.Pe},Il:function(){return this.fi},Gl:function(){return this.angle}});ff.wa=Gb;ff.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d){this.Mg(a,b,e);e=this.localAxis1;var c,f,h;c=d.x;f=d.y;h=d.z;var l,g;l=a.a.o*c+a.a.i*f+a.a.l*h;g=a.a.f*c+a.a.m*f+a.a.g*h;a=a.a.h*c+a.a.j*f+a.a.s*h;e.x=l;e.y=g;e.z=a;a=this.localAxis2;e=d.x;l=d.y;c=d.z;d=b.a.o*e+b.a.i*l+b.a.l*c;g=b.a.f*e+b.a.m*l+b.a.g*c;b=b.a.h*e+b.a.j*l+b.a.s*c;a.x=d;a.y=g;a.z=b;return this}});$b.prototype={mh:function(a,b){this.lowerLimit=a;this.upperLimit=b;return this},wa:function(a,b){this.motorSpeed=a;this.motorTorque=b;return this},clone:function(){var a=new $b;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed=this.motorSpeed;a.motorTorque=this.motorTorque;return a}};se.wa=N;se.prototype=gb(N.prototype,{ud:function(a,b,e){if(!(0=this.ol.frequency)&&e||(h=this.Eb[3],r=a.rows[a.Da++],q=r.va,q.sa=0,q.ta=0,q.ua=0,q.xa=0,q.ya=0,q.za=0,q.aa=0,q.ba=0,q.ca=0,q.da=0,q.ea=0,q.fa=0,r.Fa=0,r.Ka=0,r.Ha=0,r.Ga=0,r.motorSpeed=0,r.tb=0,r.qa=h,this.nh(r,this.Af,this.hl,D,this.ol,b,e),c=r.va,c.aa=this.wd,c.ba=this.xd,c.ca=this.yd,c.da=this.wd,c.ea=this.xd,c.fa=this.yd);this.ek||(D=this.Eb[4],h=a.rows[a.Da++],r=h.va,r.sa=0,r.ta=0,r.ua=0,r.xa=0,r.ya=0,r.za=0,r.aa=0,r.ba=0,r.ca=0,r.da=0,r.ea=0,r.fa=0,h.Fa=0,h.Ka=0,h.Ha=0,h.Ga=0,h.motorSpeed=0,h.tb=0,h.qa=D,h.Fa=l,h.Ka=0,h.Ha=-Infinity,h.Ga=Infinity,c=h.va,c.aa=this.kd,c.ba=this.ld,c.ca=this.md,c.da=this.kd,c.ea=this.ld,c.fa=this.md);this.fk||!(0>=this.pl.frequency)&&e||(l=this.Eb[5],a=a.rows[a.Da++],D=a.va,D.sa=0,D.ta=0,D.ua=0,D.xa=0,D.ya=0,D.za=0,D.aa=0,D.ba=0,D.ca=0,D.da=0,D.ea=0,D.fa=0,a.Fa=0,a.Ka=0,a.Ha=0,a.Ga=0,a.motorSpeed=0,a.tb=0,a.qa=l,this.nh(a,this.Bf,this.il,d,this.pl,b,e),c=a.va,c.aa=this.zd,c.ba=this.Ad,c.ca=this.Bd,c.da=this.zd,c.ea=this.Ad,c.fa=this.Bd)},bd:function(){N.prototype.bd.call(this);var a,b,e,d,c,f,h,l,g;a=this.fb;b=this.gb;e=this.hb;h=this.Cf;l=this.Df;g=this.Ef;d=l*e-g*b;c=g*a-h*e;f=h*b-l*a;this.wd=c*g-f*l;this.xd=f*h-d*g;this.yd=d*l-c*h;this.kd=d;this.ld=c;this.md=f;this.zd=b*f-e*c;this.Ad=e*d-a*f;this.Bd=a*c-b*d;a=this.wd*this.wd+this.xd*this.xd+this.yd*this.yd;0=z?(a=Math.atan2(D,x),k=.5*a,z=-1.570796326794895,a=.5*-a):1<=z?(a=Math.atan2(D,x),k=.5*a,z=1.570796326794895,a*=.5):(k=Math.atan2(-(k*A+p*n+q*u),m*A+r*n+t*u),z=Math.asin(z),a=Math.atan2(-(a*c+b*h+e*g),a*d+b*f+e*l));this.Af=k;this.qh=z;this.Bf=a;this.$j=this.xf-this.uf;this.Xf=this.yf-this.vf;this.Yf=this.zf-this.wf},Sd:function(a,b){N.prototype.Sd.call(this,a,b);this.ud(b,a,!1)},$c:function(a){N.prototype.$c.call(this,a);this.ud(a,null,!0)},Zg:function(){var a=new n;a.x=this.fb;a.y=this.gb;a.z=this.hb;return a},ah:function(){var a=new n;a.x=this.Cf;a.y=this.Df;a.z=this.Ef;return a},$g:function(a){a.x=this.fb;a.y=this.gb;a.z=this.hb},bh:function(a){a.x=this.Cf;a.y=this.Df;a.z=this.Ef},dh:function(){var a=new n;a.x=this.Ma;a.y=this.Na;a.z=this.Oa;return a},fh:function(){var a=new n;a.x=this.nd;a.y=this.od;a.z=this.pd;return a},eh:function(a){a.x=this.Ma;a.y=this.Na;a.z=this.Oa},gh:function(a){a.x=this.nd;a.y=this.od;a.z=this.pd},ho:function(){return this.ol},io:function(){return this.pl},$n:function(){return this.hl},ao:function(){return this.il},Rn:function(){return this.Af},Sn:function(){return this.Bf}});Kf.wa=Gb;Kf.prototype=gb(Gb.prototype,{Aa:function(a,b,e,d,c){this.Mg(a,b,e);e=this.localAxis1;var f,h,l;f=d.x;h=d.y;l=d.z;var g;d=a.a.o*f+a.a.i*h+a.a.l*l;g=a.a.f*f+a.a.m*h+a.a.g*l;a=a.a.h*f+a.a.j*h+a.a.s*l;e.x=d;e.y=g;e.z=a;a=this.localAxis2;e=c.x;f=c.y;d=c.z;c=b.a.o*e+b.a.i*f+b.a.l*d;h=b.a.f*e+b.a.m*f+b.a.g*d;b=b.a.h*e+b.a.j*f+b.a.s*d;a.x=c;a.y=h;a.z=b;return this}});tj.prototype={Aa:function(a){this.ed=a.ed;for(var b=0,e=this.ed;bp?r.Ha:0q.Ga+F.directMlcpSolverEps){b=!1;break}c[r]=A-t}if(h)return!0;if(!b)return!1;h=0;for(g=this.ed;hp&&k>F.directMlcpSolverEps||0e.Ga;0==e.Ha&&0==e.Ga?(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=0,c.ed++,this.mi(a,b+1),this.lf.ed--):(e=this.lf,e.hh[e.Ae]=b,e.Ae++,this.mi(a,b+1),this.lf.Ae--,d&&(d=this.lf,d.Nh[d.ed]=b,d.Sh[d.ed]=-1,d.ed++,this.mi(a,b+1),this.lf.ed--),c&&(c=this.lf,c.Nh[c.ed]=b,c.Sh[c.ed]=1,c.ed++,this.mi(a,b+1),this.lf.ed--))}}};Mi.prototype={};Wb.wa=Ob;Wb.prototype=gb(Ob.prototype,{Qh:function(a){this.ga.bd();this.ga.Sd(a,this.info);this.C=this.info.Ye;this.D=this.info.Ze;this.yi.Dl(this.info,this.Wb);a=this.$e;a.sf=0;var b=a.lf;b.ed=0;b.Ae=0;a.mi(this.info,0);a=this.em;for(var b=this.$e.sf,e=0,d=0,c=0,f=a.n;c=b)for(b=0,a=this.info.Da;bc.Ga&&(h=c.Ga);f.qa=h;0c&&(h=c),f.Dd=h):f.Dd=0;this.Wf[d]=f.qa+f.Dd}var b=this.Wf,e=a=!1,l,g,k,m,p,r,q,t,d=this.C.jb,f=this.C.kb,c=this.C.lb,h=this.D.jb;l=this.D.kb;g=this.D.lb;k=this.C.nb;m=this.C.ob;p=this.C.pb;r=this.D.nb;q=this.D.ob;t=this.D.pb;for(var A=0,n=this.info.Da;Al&&(h=l),c.Dd=h,c=h-f,this.Oj[d]=c,f=0;fna){var ta=na*na;La=.5*(1-.16666666666666666*ta+ta*ta*.008333333333333333);Ba=1-.5*ta+ta*ta*.041666666666666664}else La=Math.sin(na)/Aa,Ba=Math.cos(na);var S,ha,ea;S=N*La;ha=X*La;ea=pa*La;var da,M,T,w;da=S;M=ha;T=ea;w=Ba;var V,ia,Y,oa,ua=C.a.o,ca=C.a.m,Ma=C.a.s,va=ua+ca+Ma,Z;0ca?ua>Ma?(Z=Math.sqrt(ua-ca-Ma+1),V=.5*Z,Z=.5/Z,ia=(C.a.f+C.a.i)*Z,Y=(C.a.h+C.a.l)*Z,oa=(C.a.g-C.a.j)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z):ca>Ma?(Z=Math.sqrt(ca-Ma-ua+1),ia=.5*Z,Z=.5/Z,V=(C.a.f+C.a.i)*Z,Y=(C.a.j+C.a.g)*Z,oa=(C.a.h-C.a.l)*Z):(Z=Math.sqrt(Ma-ua-ca+1),Y=.5*Z,Z=.5/Z,V=(C.a.h+C.a.l)*Z,ia=(C.a.j+C.a.g)*Z,oa=(C.a.i-C.a.f)*Z);V=w*V+da*oa+M*Y-T*ia;ia=w*ia-da*Y+M*oa+T*V;Y=w*Y+da*ia-M*V+T*oa;oa=w*oa-da*V-M*ia-T*Y;var Pa=V*V+ia*ia+Y*Y+oa*oa;1E-32jb){var cb=jb*jb;lb=.5*(1-.16666666666666666*cb+cb*cb*.008333333333333333);ob=1-.5*cb+cb*cb*.041666666666666664}else lb=Math.sin(jb)/sb,ob=Math.cos(jb);var zb,Xa,tb;zb=Da*lb;Xa=qa*lb;tb=wa*lb;var v,W,U,db;v=zb;W=Xa;U=tb;db=ob;var Qa,Ra,Ha,rb,yb=G.a.o,Cb=G.a.m,la=G.a.s,ra=yb+Cb+la,ga;0Cb?yb>la?(ga=Math.sqrt(yb-Cb-la+1),Qa=.5*ga,ga=.5/ga,Ra=(G.a.f+G.a.i)*ga,Ha=(G.a.h+G.a.l)*ga,rb=(G.a.g-G.a.j)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga):Cb>la?(ga=Math.sqrt(Cb-la-yb+1),Ra=.5*ga,ga=.5/ga,Qa=(G.a.f+G.a.i)*ga,Ha=(G.a.j+G.a.g)*ga,rb=(G.a.h-G.a.l)*ga):(ga=Math.sqrt(la-yb-Cb+1),Ha=.5*ga,ga=.5/ga,Qa=(G.a.h+G.a.l)*ga,Ra=(G.a.j+G.a.g)*ga,rb=(G.a.i-G.a.f)*ga);Qa=db*Qa+v*rb+W*Ha-U*Ra;Ra=db*Ra-v*Ha+W*rb+U*Qa;Ha=db*Ha+v*Ra-W*Qa+U*rb;rb=db*rb-v*Qa-W*Ra-U*Ha;var ma=Qa*Qa+Ra*Ra+Ha*Ha+rb*rb;1E-32n*n&&(n/=Math.sqrt(z),x.Kc*=n,x.Jc*=n)):(x.Kc=0,x.Jc=0);z=x.Kc-u;D=x.Jc-F;a+=t.Ql*z;b+=t.Rl*z;e+=t.Sl*z;a+=t.Kl*D;b+=t.Ll*D;e+=t.Ml*D;d+=t.Tl*-z;c+=t.Ul*-z;f+=t.Vl*-z;d+=t.Nl*-D;c+=t.Ol*-D;f+=t.Pl*-D;h+=t.Sj*z;l+=t.Tj*z;g+=t.Uj*z;h+=t.Ek*D;l+=t.Fk*D;g+=t.Gk*D;k+=t.Vj*-z;m+=t.Wj*-z;p+=t.Xj*-z;k+=t.Hk*-D;m+=t.Ik*-D;p+=t.Jk*-D}r=0;for(q=this.info.Da;rx.dd&&(x.dd=0),n=x.dd-u,a+=t.si*n,b+=t.ti*n,e+=t.ui*n,d+=t.vi*-n,c+=t.wi*-n,f+=t.xi*-n,h+=t.sg*n,l+=t.tg*n,g+=t.ug*n,k+=t.vg*-n,m+=t.wg*-n,p+=t.xg*-n;this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},jh:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,F;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;F=this.D.$;for(var D=0,I=this.info.Da;Dx.vb&&(x.vb=0);n=x.vb-u;a+=t.si*n;b+=t.ti*n;e+=t.ui*n;d+=t.vi*-n;c+=t.wi*-n;f+=t.xi*-n;h+=t.sg*n;l+=t.tg*n;g+=t.ug*n;k+=t.vg*-n;m+=t.wg*-n;p+=t.xg*-n}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.aj.rl();this.aj.$c(this.info);var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,q,t,n,x,u,z,I;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;q=this.D.U;t=this.D.V;n=this.D.W;x=this.D.X;u=this.D.Y;z=this.D.Z;I=this.D.$;for(var D=0,J=this.info.Da;Dta.vb&&(ta.vb=0);ea=ta.vb-da;wa+=Ba.si*ea;Da+=Ba.ti*ea;qa+=Ba.ui*ea;Ca+=Ba.vi*-ea;ya+=Ba.wi*-ea;Ka+=Ba.xi*-ea;Ea+=Ba.sg*ea;O+=Ba.tg*ea;sa+=Ba.ug*ea;ba+=Ba.vg*-ea;za+=Ba.wg*-ea;Ta+=Ba.xg*-ea}var M=this.C;M.a.v+=wa;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ca;T.a.A+=ya;T.a.B+=Ka;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Qa=w.a.m,ja=w.a.s,Ga=fa+Qa+ja,P;0Qa?fa>ja?(P=Math.sqrt(fa-Qa-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Qa>ja?(P=Math.sqrt(Qa-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Qa+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Fb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Fb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Fb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Hb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Gb=la*la+ra*ra+ga*ga+ma*ma;1E-32=b)for(b=0,a=this.info.Da;bx.tb&&(F.Dd=x.tb);z=F.Dd-I;u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z);u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z)}}r=0;for(q=this.info.Da;rx.Ga&&(F.qa=x.Ga),z=F.qa-I,u.Cc&1&&(a+=n.Kd*z,b+=n.Ld*z,e+=n.Md*z,d+=n.Nd*-z,c+=n.Od*-z,f+=n.Pd*-z),u.Cc&2&&(h+=n.Ed*z,l+=n.Fd*z,g+=n.Gd*z,k+=n.Hd*-z,m+=n.Id*-z,p+=n.Jd*-z);this.C.jb=a;this.C.kb=b;this.C.lb=e;this.D.jb=d;this.D.kb=c;this.D.lb=f;this.C.nb=h;this.C.ob=l;this.C.pb=g;this.D.nb=k;this.D.ob=m;this.D.pb=p},cj:function(a){for(var b,e,d,c,f,h,l=h=f=c=d=e=b=0,g=this.info.Da;lx.Ga&&(I.vb=x.Ga);u=I.vb-z;a+=n.Kd*u;b+=n.Ld*u;e+=n.Md*u;d+=n.Nd*-u;c+=n.Od*-u;f+=n.Pd*-u;h+=n.Ed*u;l+=n.Fd*u;g+=n.Gd*u;k+=n.Hd*-u;m+=n.Id*-u;p+=n.Jd*-u}this.C.rd=a;this.C.sd=b;this.C.td=e;this.D.rd=d;this.D.sd=c;this.D.td=f;this.C.gd=h;this.C.hd=l;this.C.jd=g;this.D.gd=k;this.D.hd=m;this.D.jd=p},Th:function(){this.ga.bd();this.ga.$c(this.info);this.C=this.info.Ye;this.D=this.info.Ze;var a=this.C.qb,b=this.D.qb,e,d,c,f,h,l,g,k,m,p,r,n,t,x,I,u,z,J;e=this.C.S;d=this.C.T;c=this.C.U;f=this.C.V;h=this.C.W;l=this.C.X;g=this.C.Y;k=this.C.Z;m=this.C.$;p=this.D.S;r=this.D.T;n=this.D.U;t=this.D.V;x=this.D.W;I=this.D.X;u=this.D.Y;z=this.D.Z;J=this.D.$;for(var D=0,N=this.info.Da;DLa.Ga&&(ta.vb=La.Ga);ea=ta.vb-da;Ca+=Ba.Kd*ea;Da+=Ba.Ld*ea;qa+=Ba.Md*ea;Ka+=Ba.Nd*-ea;ya+=Ba.Od*-ea;Qa+=Ba.Pd*-ea;Ea+=Ba.Ed*ea;O+=Ba.Fd*ea;sa+=Ba.Gd*ea;ba+=Ba.Hd*-ea;za+=Ba.Id*-ea;Ta+=Ba.Jd*-ea}var M=this.C;M.a.v+=Ca;M.a.A+=Da;M.a.B+=qa;var T=this.D;T.a.v+=Ka;T.a.A+=ya;T.a.B+=Qa;var w=this.C,V=Math.sqrt(Ea*Ea+O*O+sa*sa),ia=.5*V,Y,oa;if(.5>ia){var ua=ia*ia;Y=.5*(1-.16666666666666666*ua+ua*ua*.008333333333333333);oa=1-.5*ua+ua*ua*.041666666666666664}else Y=Math.sin(ia)/V,oa=Math.cos(ia);var ca,Ma;ca=Ea*Y;Ma=O*Y;var va,Z;va=sa*Y;Z=oa;var Pa,Fa,Q,aa,fa=w.a.o,Ua=w.a.m,ja=w.a.s,Ga=fa+Ua+ja,P;0Ua?fa>ja?(P=Math.sqrt(fa-Ua-ja+1),Pa=.5*P,P=.5/P,Fa=(w.a.f+w.a.i)*P,Q=(w.a.h+w.a.l)*P,aa=(w.a.g-w.a.j)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P):Ua>ja?(P=Math.sqrt(Ua-ja-fa+1),Fa=.5*P,P=.5/P,Pa=(w.a.f+w.a.i)*P,Q=(w.a.j+w.a.g)*P,aa=(w.a.h-w.a.l)*P):(P=Math.sqrt(ja-fa-Ua+1),Q=.5*P,P=.5/P,Pa=(w.a.h+w.a.l)*P,Fa=(w.a.j+w.a.g)*P,aa=(w.a.i-w.a.f)*P);Pa=Z*Pa+ca*aa+Ma*Q-va*Fa;Fa=Z*Fa-ca*Q+Ma*aa+va*Pa;Q=Z*Q+ca*Fa-Ma*Pa+va*aa;aa=Z*aa-ca*Pa-Ma*Fa-va*Q;var Ya=Pa*Pa+Fa*Fa+Q*Q+aa*aa;1E-32U){var Ra=U*U;db=.5*(1-.16666666666666666*Ra+Ra*Ra*.008333333333333333);Gb=1-.5*Ra+Ra*Ra*.041666666666666664}else db=Math.sin(U)/W,Gb=Math.cos(U);var Ha,rb;Ha=ba*db;rb=za*db;var yb,Cb;yb=Ta*db;Cb=Gb;var la,ra,ga,ma,Ja=v.a.o,$a=v.a.m,Oa=v.a.s,Jb=Ja+$a+Oa,xa;0$a?Ja>Oa?(xa=Math.sqrt(Ja-$a-Oa+1),la=.5*xa,xa=.5/xa,ra=(v.a.f+v.a.i)*xa,ga=(v.a.h+v.a.l)*xa,ma=(v.a.g-v.a.j)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa):$a>Oa?(xa=Math.sqrt($a-Oa-Ja+1),ra=.5*xa,xa=.5/xa,la=(v.a.f+v.a.i)*xa,ga=(v.a.j+v.a.g)*xa,ma=(v.a.h-v.a.l)*xa):(xa=Math.sqrt(Oa-Ja-$a+1),ga=.5*xa,xa=.5/xa,la=(v.a.h+v.a.l)*xa,ra=(v.a.j+v.a.g)*xa,ma=(v.a.i-v.a.f)*xa);la=Cb*la+Ha*ma+rb*ga-yb*ra;ra=Cb*ra-Ha*ga+rb*ma+yb*la;ga=Cb*ga+Ha*ra-rb*la+yb*ma;ma=Cb*ma-Ha*la-rb*ra-yb*ga;var Hb=la*la+ra*ra+ga*ga+ma*ma;1E-32F.maxTranslationPerStep*F.maxTranslationPerStep&&(h=F.maxTranslationPerStep/Math.sqrt(h),this.jb*=h,this.kb*=h,this.lb*=h,b*=h,e*=h,d*=h);l>F.maxRotationPerStep*F.maxRotationPerStep&&(l=F.maxRotationPerStep/Math.sqrt(l),this.nb*=l,this.ob*=l,this.pb*=l,c*=l,f*=l,a*=l);this.a.v+=b;this.a.A+=e;this.a.B+=d;b=Math.sqrt(c*c+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));c*=b;f*=b;a*=b;b=e;e=this.a.o;d=this.a.m;var l=this.a.s,h=e+d+l,g;0d?e>l?(g=Math.sqrt(e-d-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,d=(this.a.h+this.a.l)*g,e=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g):d>l?(g=Math.sqrt(d-l-e+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,d=(this.a.j+this.a.g)*g,e=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-e-d+1),d=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,e=(this.a.i-this.a.f)*g);h=b*h+c*e+f*d-a*l;l=b*l-c*d+f*e+a*h;d=b*d+c*l-f*h+a*e;e=b*e-c*h-f*l-a*d;a=h*h+l*l+d*d+e*e;1E-32b?(b*=b,a=.5*(1-.16666666666666666*b+b*b*.008333333333333333),b=1-.5*b+b*b*.041666666666666664):(a=Math.sin(b)/a,b=Math.cos(b));d*=a;c*=a;f*=a;a=b;var h,l;b=this.a.o;e=this.a.m;l=this.a.s;h=b+e+l;var g;0e?b>l?(g=Math.sqrt(b-e-l+1),h=.5*g,g=.5/g,l=(this.a.f+this.a.i)*g,e=(this.a.h+this.a.l)*g,b=(this.a.g-this.a.j)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g):e>l?(g=Math.sqrt(e-l-b+1),l=.5*g,g=.5/g,h=(this.a.f+this.a.i)*g,e=(this.a.j+this.a.g)*g,b=(this.a.h-this.a.l)*g):(g=Math.sqrt(l-b-e+1),e=.5*g,g=.5/g,h=(this.a.h+this.a.l)*g,l=(this.a.j+this.a.g)*g,b=(this.a.i-this.a.f)*g);h=a*h+d*b+c*e-f*l;l=a*l-d*e+c*b+f*h;e=a*e+d*l-c*h+f*b;b=a*b-d*h-c*l-f*e;c=h*h+l*l+e*e+b*b;1E-32d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},cn:function(a){var b,e;b=a.x;e=a.y;a=a.z;this.a.v+=b;this.a.A+=e;this.a.B+=a;b=this.ja;e=this.a;b.v=e.v;b.A=e.A;b.B=e.B;b.o=e.o;b.f=e.f;b.h=e.h;b.i=e.i;b.m=e.m;b.j=e.j;b.l=e.l;b.g=e.g;b.s=e.s;for(b=this.Gc;null!=b;){e=b.M;var d=this.ja;a=this.a;var c=b.ja,f=b.ha,h,l,g,k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=b.a;c=b.ha;f=a.o*c.o+a.f*c.i+a.h*c.l;h=a.o*c.f+a.f*c.m+a.h*c.g;l=a.o*c.h+a.f*c.j+a.h*c.s;g=a.i*c.o+a.m*c.i+a.j*c.l;k=a.i*c.f+a.m*c.m+a.j*c.g;m=a.i*c.h+a.m*c.j+a.j*c.s;p=a.l*c.o+a.g*c.i+a.s*c.l;n=a.l*c.f+a.g*c.m+a.s*c.g;q=a.l*c.h+a.g*c.j+a.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=a.o*c.v+a.f*c.A+a.h*c.B;h=a.i*c.v+a.m*c.A+a.j*c.B;c=a.l*c.v+a.g*c.A+a.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=a.v;d.A+=a.A;d.B+=a.B;b.Fb.Lb(b.u,b.ja);a=b.u.na;d=b.u.oa;c=b.u.pa;f=b.u.ka;h=b.u.la;l=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=ab.u.ka?f:b.u.ka;b.u.la=h>b.u.la?h:b.u.la;b.u.ma=l>b.u.ma?l:b.u.ma;null!=b.ub&&(a=b.a.v-b.ja.v,d=b.a.A-b.ja.A,c=b.a.B-b.ja.B,f=b.mc,f.x=a,f.y=d,f.z=c,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}this.Bb=!1;this.wb=0},Vm:function(){var a=new I;a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s;return a},Wm:function(a){a.e00=this.a.o;a.e01=this.a.f;a.e02=this.a.h;a.e10=this.a.i;a.e11=this.a.m;a.e12=this.a.j;a.e20=this.a.l;a.e21=this.a.g;a.e22=this.a.s},Qo:function(a){this.a.o=a.e00;this.a.f=a.e01;this.a.h=a.e02;this.a.i=a.e10;this.a.m=a.e11;this.a.j=a.e12;this.a.l=a.e20;this.a.g=a.e21;this.a.s=a.e22;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},Ro:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;a=Math.sin(b);var c=Math.sin(e),f=Math.sin(d);b=Math.cos(b);e=Math.cos(e);d=Math.cos(d);this.a.o=e*d;this.a.f=-e*f;this.a.h=c;this.a.i=b*f+d*a*c;this.a.m=b*d-a*c*f;this.a.j=-e*a;this.a.l=a*f-b*d*c;this.a.g=d*a+b*c*f;this.a.s=b*e;var h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;c=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;f=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;e=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;b=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;c=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;f=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;e=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;b=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=c;this.U=f;this.V=e;this.W=d;this.X=b;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;c=this.a;a.v=c.v;a.A=c.A;a.B=c.B;a.o=c.o;a.f=c.f;a.h=c.h;a.i=c.i;a.m=c.m;a.j=c.j;a.l=c.l;a.g=c.g;a.s=c.s;for(a=this.Gc;null!=a;){c=a.M;e=this.ja;f=this.a;d=a.ja;b=a.ha;var k,m,p,n,q,t;h=e.o*b.o+e.f*b.i+e.h*b.l;l=e.o*b.f+e.f*b.m+e.h*b.g;g=e.o*b.h+e.f*b.j+e.h*b.s;k=e.i*b.o+e.m*b.i+e.j*b.l;m=e.i*b.f+e.m*b.m+e.j*b.g;p=e.i*b.h+e.m*b.j+e.j*b.s;n=e.l*b.o+e.g*b.i+e.s*b.l;q=e.l*b.f+e.g*b.m+e.s*b.g;t=e.l*b.h+e.g*b.j+e.s*b.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=e.o*b.v+e.f*b.A+e.h*b.B;l=e.i*b.v+e.m*b.A+e.j*b.B;b=e.l*b.v+e.g*b.A+e.s*b.B;d.v=h;d.A=l;d.B=b;d.v+=e.v;d.A+=e.A;d.B+=e.B;e=a.a;d=a.ha;b=f.o*d.o+f.f*d.i+f.h*d.l;h=f.o*d.f+f.f*d.m+f.h*d.g;l=f.o*d.h+f.f*d.j+f.h*d.s;g=f.i*d.o+f.m*d.i+f.j*d.l;k=f.i*d.f+f.m*d.m+f.j*d.g;m=f.i*d.h+f.m*d.j+f.j*d.s;p=f.l*d.o+f.g*d.i+f.s*d.l;n=f.l*d.f+f.g*d.m+f.s*d.g;q=f.l*d.h+f.g*d.j+f.s*d.s;e.o=b;e.f=h;e.h=l;e.i=g;e.m=k;e.j=m;e.l=p;e.g=n;e.s=q;b=f.o*d.v+f.f*d.A+f.h*d.B;h=f.i*d.v+f.m*d.A+f.j*d.B;d=f.l*d.v+f.g*d.A+f.s*d.B;e.v=b;e.A=h;e.B=d;e.v+=f.v;e.A+=f.A;e.B+=f.B;a.Fb.Lb(a.u,a.ja);f=a.u.na;e=a.u.oa;d=a.u.pa;b=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=fa.u.ka?b:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(f=a.a.v-a.ja.v,e=a.a.A-a.ja.A,d=a.a.B-a.ja.B,b=a.mc,b.x=f,b.y=e,b.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=c}this.Bb=!1;this.wb=0},Ho:function(a){var b,e,d,c,f,h,l,g,k;b=a.e00;e=a.e01;d=a.e02;c=a.e10;f=a.e11;h=a.e12;l=a.e20;g=a.e21;k=a.e22;var m;a=b*this.a.o+e*this.a.i+d*this.a.l;m=b*this.a.f+e*this.a.m+d*this.a.g;b=b*this.a.h+e*this.a.j+d*this.a.s;e=c*this.a.o+f*this.a.i+h*this.a.l;d=c*this.a.f+f*this.a.m+h*this.a.g;c=c*this.a.h+f*this.a.j+h*this.a.s;f=l*this.a.o+g*this.a.i+k*this.a.l;h=l*this.a.f+g*this.a.m+k*this.a.g;l=l*this.a.h+g*this.a.j+k*this.a.s;this.a.o=a;this.a.f=m;this.a.h=b;this.a.i=e;this.a.m=d;this.a.j=c;this.a.l=f;this.a.g=h;this.a.s=l;l=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;a=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;m=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;k=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;c=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;f=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;h=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;l=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;a=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;m=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;k=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;c=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;f=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;h=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=l;this.T=g;this.U=a;this.V=m;this.W=k;this.X=c;this.Y=f;this.Z=h;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;l=this.ja;g=this.a;l.v=g.v;l.A=g.A;l.B=g.B;l.o=g.o;l.f=g.f;l.h=g.h;l.i=g.i;l.m=g.m;l.j=g.j;l.l=g.l;l.g=g.g;l.s=g.s;for(l=this.Gc;null!=l;){g=l.M;m=this.ja;a=this.a;k=l.ja;c=l.ha;var p,n,q,t;f=m.o*c.o+m.f*c.i+m.h*c.l;h=m.o*c.f+m.f*c.m+m.h*c.g;b=m.o*c.h+m.f*c.j+m.h*c.s;e=m.i*c.o+m.m*c.i+m.j*c.l;d=m.i*c.f+m.m*c.m+m.j*c.g;p=m.i*c.h+m.m*c.j+m.j*c.s;n=m.l*c.o+m.g*c.i+m.s*c.l;q=m.l*c.f+m.g*c.m+m.s*c.g;t=m.l*c.h+m.g*c.j+m.s*c.s;k.o=f;k.f=h;k.h=b;k.i=e;k.m=d;k.j=p;k.l=n;k.g=q;k.s=t;f=m.o*c.v+m.f*c.A+m.h*c.B;h=m.i*c.v+m.m*c.A+m.j*c.B;c=m.l*c.v+m.g*c.A+m.s*c.B;k.v=f;k.A=h;k.B=c;k.v+=m.v;k.A+=m.A;k.B+=m.B;m=l.a;k=l.ha;c=a.o*k.o+a.f*k.i+a.h*k.l;f=a.o*k.f+a.f*k.m+a.h*k.g;h=a.o*k.h+a.f*k.j+a.h*k.s;b=a.i*k.o+a.m*k.i+a.j*k.l;e=a.i*k.f+a.m*k.m+a.j*k.g;d=a.i*k.h+a.m*k.j+a.j*k.s;p=a.l*k.o+a.g*k.i+a.s*k.l;n=a.l*k.f+a.g*k.m+a.s*k.g;q=a.l*k.h+a.g*k.j+a.s*k.s;m.o=c;m.f=f;m.h=h;m.i=b;m.m=e;m.j=d;m.l=p;m.g=n;m.s=q;c=a.o*k.v+a.f*k.A+a.h*k.B;f=a.i*k.v+a.m*k.A+a.j*k.B;k=a.l*k.v+a.g*k.A+a.s*k.B;m.v=c;m.A=f;m.B=k;m.v+=a.v;m.A+=a.A;m.B+=a.B;l.Fb.Lb(l.u,l.ja);a=l.u.na;m=l.u.oa;k=l.u.pa;c=l.u.ka;f=l.u.la;h=l.u.ma;l.Fb.Lb(l.u,l.a);l.u.na=al.u.ka?c:l.u.ka;l.u.la=f>l.u.la?f:l.u.la;l.u.ma=h>l.u.ma?h:l.u.ma;null!=l.ub&&(a=l.a.v-l.ja.v,m=l.a.A-l.ja.A,k=l.a.B-l.ja.B,c=l.mc,c.x=a,c.y=m,c.z=k,l.Vb.jc.hc.Qd(l.ub,l.u,l.mc));l=g}this.Bb=!1;this.wb=0},Mo:function(a){var b,e,d,c,f,h,l;b=a.x;e=a.y;a=a.z;h=Math.sin(b);var g=Math.sin(e),k=Math.sin(a),m=Math.cos(b);l=Math.cos(e);var p=Math.cos(a);d=l*p;c=-l*k;a=m*k+p*h*g;b=m*p-h*g*k;f=-l*h;e=h*k-m*p*g;h=p*h+m*g*k;l*=m;k=d*this.a.o+c*this.a.i+g*this.a.l;m=d*this.a.f+c*this.a.m+g*this.a.g;g=d*this.a.h+c*this.a.j+g*this.a.s;d=a*this.a.o+b*this.a.i+f*this.a.l;c=a*this.a.f+b*this.a.m+f*this.a.g;a=a*this.a.h+b*this.a.j+f*this.a.s;b=e*this.a.o+h*this.a.i+l*this.a.l;f=e*this.a.f+h*this.a.m+l*this.a.g;e=e*this.a.h+h*this.a.j+l*this.a.s;this.a.o=k;this.a.f=m;this.a.h=g;this.a.i=d;this.a.m=c;this.a.j=a;this.a.l=b;this.a.g=f;this.a.s=e;e=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;a=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;b=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;f=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;h=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;g=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;k=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;m=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;l=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;e=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;a=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;b=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;f=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;h=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;g=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;k=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;m=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;l=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=e;this.T=a;this.U=b;this.V=f;this.W=h;this.X=g;this.Y=k;this.Z=m;this.$=l;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;e=this.ja;a=this.a;e.v=a.v;e.A=a.A;e.B=a.B;e.o=a.o;e.f=a.f;e.h=a.h;e.i=a.i;e.m=a.m;e.j=a.j;e.l=a.l;e.g=a.g;e.s=a.s;for(e=this.Gc;null!=e;){a=e.M;f=this.ja;b=this.a;h=e.ja;var g=e.ha,n,q,t,k=f.o*g.o+f.f*g.i+f.h*g.l,m=f.o*g.f+f.f*g.m+f.h*g.g;l=f.o*g.h+f.f*g.j+f.h*g.s;d=f.i*g.o+f.m*g.i+f.j*g.l;c=f.i*g.f+f.m*g.m+f.j*g.g;p=f.i*g.h+f.m*g.j+f.j*g.s;n=f.l*g.o+f.g*g.i+f.s*g.l;q=f.l*g.f+f.g*g.m+f.s*g.g;t=f.l*g.h+f.g*g.j+f.s*g.s;h.o=k;h.f=m;h.h=l;h.i=d;h.m=c;h.j=p;h.l=n;h.g=q;h.s=t;k=f.o*g.v+f.f*g.A+f.h*g.B;m=f.i*g.v+f.m*g.A+f.j*g.B;g=f.l*g.v+f.g*g.A+f.s*g.B;h.v=k;h.A=m;h.B=g;h.v+=f.v;h.A+=f.A;h.B+=f.B;f=e.a;h=e.ha;g=b.o*h.o+b.f*h.i+b.h*h.l;k=b.o*h.f+b.f*h.m+b.h*h.g;m=b.o*h.h+b.f*h.j+b.h*h.s;l=b.i*h.o+b.m*h.i+b.j*h.l;d=b.i*h.f+b.m*h.m+b.j*h.g;c=b.i*h.h+b.m*h.j+b.j*h.s;p=b.l*h.o+b.g*h.i+b.s*h.l;n=b.l*h.f+b.g*h.m+b.s*h.g;q=b.l*h.h+b.g*h.j+b.s*h.s;f.o=g;f.f=k;f.h=m;f.i=l;f.m=d;f.j=c;f.l=p;f.g=n;f.s=q;g=b.o*h.v+b.f*h.A+b.h*h.B;k=b.i*h.v+b.m*h.A+b.j*h.B;h=b.l*h.v+b.g*h.A+b.s*h.B;f.v=g;f.A=k;f.B=h;f.v+=b.v;f.A+=b.A;f.B+=b.B;e.Fb.Lb(e.u,e.ja);b=e.u.na;f=e.u.oa;h=e.u.pa;g=e.u.ka;k=e.u.la;m=e.u.ma;e.Fb.Lb(e.u,e.a);e.u.na=be.u.ka?g:e.u.ka;e.u.la=k>e.u.la?k:e.u.la;e.u.ma=m>e.u.ma?m:e.u.ma;null!=e.ub&&(b=e.a.v-e.ja.v,f=e.a.A-e.ja.A,h=e.a.B-e.ja.B,g=e.mc,g.x=b,g.y=f,g.z=h,e.Vb.jc.hc.Qd(e.ub,e.u,e.mc));e=a}this.Bb=!1;this.wb=0},Mm:function(){var a=new wa,b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a},Nm:function(a){var b,e,d,c;b=this.a.o;e=this.a.m;d=this.a.s;c=b+e+d;var f;0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.a.f+this.a.i)*f,d=(this.a.h+this.a.l)*f,c=(this.a.g-this.a.j)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.a.f+this.a.i)*f,d=(this.a.j+this.a.g)*f,c=(this.a.h-this.a.l)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.a.h+this.a.l)*f,e=(this.a.j+this.a.g)*f,c=(this.a.i-this.a.f)*f);a.x=b;a.y=e;a.z=d;a.w=c},No:function(a){var b,e,d;b=a.x;e=a.y;d=a.z;var c=a.w,f=2*b,h=2*e,l=2*d;a=b*f;var g=e*h;d*=l;var k=b*h;e*=l;b*=l;f*=c;h*=c;c*=l;this.a.o=1-g-d;this.a.f=k-c;this.a.h=b+h;this.a.i=k+c;this.a.m=1-a-d;this.a.j=e-f;this.a.l=b-h;this.a.g=e+f;this.a.s=1-a-g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;g=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;c=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;l=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;d=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;k=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;e=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;b=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;g=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;c=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;l=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;d=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;k=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;e=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;b=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=g;this.U=c;this.V=l;this.W=d;this.X=k;this.Y=h;this.Z=e;this.$=b;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;g=this.a;a.v=g.v;a.A=g.A;a.B=g.B;a.o=g.o;a.f=g.f;a.h=g.h;a.i=g.i;a.m=g.m;a.j=g.j;a.l=g.l;a.g=g.g;a.s=g.s;for(a=this.Gc;null!=a;){g=a.M;l=this.ja;c=this.a;d=a.ja;var k=a.ha,m,p,n,q,t,h=l.o*k.o+l.f*k.i+l.h*k.l;e=l.o*k.f+l.f*k.m+l.h*k.g;b=l.o*k.h+l.f*k.j+l.h*k.s;f=l.i*k.o+l.m*k.i+l.j*k.l;m=l.i*k.f+l.m*k.m+l.j*k.g;p=l.i*k.h+l.m*k.j+l.j*k.s;n=l.l*k.o+l.g*k.i+l.s*k.l;q=l.l*k.f+l.g*k.m+l.s*k.g;t=l.l*k.h+l.g*k.j+l.s*k.s;d.o=h;d.f=e;d.h=b;d.i=f;d.m=m;d.j=p;d.l=n;d.g=q;d.s=t;h=l.o*k.v+l.f*k.A+l.h*k.B;e=l.i*k.v+l.m*k.A+l.j*k.B;k=l.l*k.v+l.g*k.A+l.s*k.B;d.v=h;d.A=e;d.B=k;d.v+=l.v;d.A+=l.A;d.B+=l.B;l=a.a;d=a.ha;k=c.o*d.o+c.f*d.i+c.h*d.l;h=c.o*d.f+c.f*d.m+c.h*d.g;e=c.o*d.h+c.f*d.j+c.h*d.s;b=c.i*d.o+c.m*d.i+c.j*d.l;f=c.i*d.f+c.m*d.m+c.j*d.g;m=c.i*d.h+c.m*d.j+c.j*d.s;p=c.l*d.o+c.g*d.i+c.s*d.l;n=c.l*d.f+c.g*d.m+c.s*d.g;q=c.l*d.h+c.g*d.j+c.s*d.s;l.o=k;l.f=h;l.h=e;l.i=b;l.m=f;l.j=m;l.l=p;l.g=n;l.s=q;k=c.o*d.v+c.f*d.A+c.h*d.B;h=c.i*d.v+c.m*d.A+c.j*d.B;d=c.l*d.v+c.g*d.A+c.s*d.B;l.v=k;l.A=h;l.B=d;l.v+=c.v;l.A+=c.A;l.B+=c.B;a.Fb.Lb(a.u,a.ja);c=a.u.na;l=a.u.oa;d=a.u.pa;k=a.u.ka;h=a.u.la;e=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ca.u.ka?k:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=e>a.u.ma?e:a.u.ma;null!=a.ub&&(c=a.a.v-a.ja.v,l=a.a.A-a.ja.A,d=a.a.B-a.ja.B,k=a.mc,k.x=c,k.y=l,k.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=g}this.Bb=!1;this.wb=0},Xm:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Ym:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},So:function(a){this.a.v=a.v;this.a.A=a.A;this.a.B=a.B;this.a.o=a.o;this.a.f=a.f;this.a.h=a.h;this.a.i=a.i;this.a.m=a.m;this.a.j=a.j;this.a.l=a.l;this.a.g=a.g;this.a.s=a.s;var b,e,d,c,f,h,l,g;a=this.a.o*this.Sa+this.a.f*this.Va+this.a.h*this.Ya;b=this.a.o*this.Ta+this.a.f*this.Wa+this.a.h*this.Za;e=this.a.o*this.Ua+this.a.f*this.Xa+this.a.h*this.$a;d=this.a.i*this.Sa+this.a.m*this.Va+this.a.j*this.Ya;c=this.a.i*this.Ta+this.a.m*this.Wa+this.a.j*this.Za;f=this.a.i*this.Ua+this.a.m*this.Xa+this.a.j*this.$a;h=this.a.l*this.Sa+this.a.g*this.Va+this.a.s*this.Ya;l=this.a.l*this.Ta+this.a.g*this.Wa+this.a.s*this.Za;g=this.a.l*this.Ua+this.a.g*this.Xa+this.a.s*this.$a;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;a=this.S*this.a.o+this.T*this.a.f+this.U*this.a.h;b=this.S*this.a.i+this.T*this.a.m+this.U*this.a.j;e=this.S*this.a.l+this.T*this.a.g+this.U*this.a.s;d=this.V*this.a.o+this.W*this.a.f+this.X*this.a.h;c=this.V*this.a.i+this.W*this.a.m+this.X*this.a.j;f=this.V*this.a.l+this.W*this.a.g+this.X*this.a.s;h=this.Y*this.a.o+this.Z*this.a.f+this.$*this.a.h;l=this.Y*this.a.i+this.Z*this.a.m+this.$*this.a.j;g=this.Y*this.a.l+this.Z*this.a.g+this.$*this.a.s;this.S=a;this.T=b;this.U=e;this.V=d;this.W=c;this.X=f;this.Y=h;this.Z=l;this.$=g;this.S*=this.O.x;this.T*=this.O.x;this.U*=this.O.x;this.V*=this.O.y;this.W*=this.O.y;this.X*=this.O.y;this.Y*=this.O.z;this.Z*=this.O.z;this.$*=this.O.z;a=this.ja;b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s;for(a=this.Gc;null!=a;){b=a.M;d=this.ja;e=this.a;c=a.ja;f=a.ha;var k,m,p,n,q,t;h=d.o*f.o+d.f*f.i+d.h*f.l;l=d.o*f.f+d.f*f.m+d.h*f.g;g=d.o*f.h+d.f*f.j+d.h*f.s;k=d.i*f.o+d.m*f.i+d.j*f.l;m=d.i*f.f+d.m*f.m+d.j*f.g;p=d.i*f.h+d.m*f.j+d.j*f.s;n=d.l*f.o+d.g*f.i+d.s*f.l;q=d.l*f.f+d.g*f.m+d.s*f.g;t=d.l*f.h+d.g*f.j+d.s*f.s;c.o=h;c.f=l;c.h=g;c.i=k;c.m=m;c.j=p;c.l=n;c.g=q;c.s=t;h=d.o*f.v+d.f*f.A+d.h*f.B;l=d.i*f.v+d.m*f.A+d.j*f.B;f=d.l*f.v+d.g*f.A+d.s*f.B;c.v=h;c.A=l;c.B=f;c.v+=d.v;c.A+=d.A;c.B+=d.B;d=a.a;c=a.ha;f=e.o*c.o+e.f*c.i+e.h*c.l;h=e.o*c.f+e.f*c.m+e.h*c.g;l=e.o*c.h+e.f*c.j+e.h*c.s;g=e.i*c.o+e.m*c.i+e.j*c.l;k=e.i*c.f+e.m*c.m+e.j*c.g;m=e.i*c.h+e.m*c.j+e.j*c.s;p=e.l*c.o+e.g*c.i+e.s*c.l;n=e.l*c.f+e.g*c.m+e.s*c.g;q=e.l*c.h+e.g*c.j+e.s*c.s;d.o=f;d.f=h;d.h=l;d.i=g;d.m=k;d.j=m;d.l=p;d.g=n;d.s=q;f=e.o*c.v+e.f*c.A+e.h*c.B;h=e.i*c.v+e.m*c.A+e.j*c.B;c=e.l*c.v+e.g*c.A+e.s*c.B;d.v=f;d.A=h;d.B=c;d.v+=e.v;d.A+=e.A;d.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;d=a.u.oa;c=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,d=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=d,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}this.Bb=!1;this.wb=0},ph:function(){return this.Lf},cf:function(){var a=new I;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae;return a},gg:function(a){a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},Di:function(){var a=new fj;a.mass=this.Lf;var b=a.localInertia;b.e00=this.Td;b.e01=this.Ud;b.e02=this.Vd;b.e10=this.Wd;b.e11=this.Xd;b.e12=this.Yd;b.e20=this.Zd;b.e21=this.$d;b.e22=this.ae;return a},Ei:function(a){a.mass=this.Lf;a=a.localInertia;a.e00=this.Td;a.e01=this.Ud;a.e02=this.Vd;a.e10=this.Wd;a.e11=this.Xd;a.e12=this.Yd;a.e20=this.Zd;a.e21=this.$d;a.e22=this.ae},ln:function(a){this.Lf=a.mass;a=a.localInertia;this.Td=a.e00;this.Ud=a.e01;this.Vd=a.e02;this.Wd=a.e10;this.Xd=a.e11;this.Yd=a.e12;this.Zd=a.e20;this.$d=a.e21;this.ae=a.e22;if(0d||1E-32a.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(d=a.a.v-a.ja.v,e=a.a.A-a.ja.A,c=a.a.B-a.ja.B,f=a.mc,f.x=d,f.y=e,f.z=c,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},dn:function(a){var b=a.ia,e=a.M;null!=b&&(b.M=e);null!=e&&(e.ia=b);a==this.Gc&&(this.Gc=this.Gc.M);a==this.Yi&&(this.Yi=this.Yi.ia);a.M=null;a.ia=null;this.Rg--;a.Vb=null;if(null!=this.jc){b=this.jc;b.hc.oi(a.ub);a.ub=null;a.Ic=-1;for(var d=a.Vb.Mb;null!=d;){var e=d.M,c=d.me;if(c.Ec==a||c.Fc==a){d=d.ad;d.Bb=!1;d.wb=0;var d=b.Hi,f=c.ia,h=c.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c==d.je&&(d.je=d.je.M);c==d.Le&&(d.Le=d.Le.ia);c.M=null;c.ia=null;f=c.rb.ia;h=c.rb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.rb==c.C.Mb&&(c.C.Mb=c.C.Mb.M);c.rb==c.C.ic&&(c.C.ic=c.C.ic.ia);c.rb.M=null;c.rb.ia=null;f=c.sb.ia;h=c.sb.M;null!=f&&(f.M=h);null!=h&&(h.ia=f);c.sb==c.D.Mb&&(c.D.Mb=c.D.Mb.M);c.sb==c.D.ic&&(c.D.ic=c.D.ic.ia);c.sb.M=null;c.sb.ia=null;c.C.Ne--;c.D.Ne--;c.rb.ad=null;c.sb.ad=null;c.rb.me=null;c.sb.me=null;c.Ec=null;c.Fc=null;c.C=null;c.D=null;c.Hh=!1;c.pj.df();c.Ia.df();c.$h=null;f=c.ef;f.Ec=null;f.Fc=null;f.C=null;f.D=null;f.Ej=null;f.Fj=null;c.M=d.Cg;d.Cg=c;d.Ui--}d=e}b.Rg--}this.ck();for(a=this.Gc;null!=a;){var b=a.M,c=this.ja,e=this.a,d=a.ja,f=a.ha,l,g,k,m,n,r,q,t,h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;c=a.a;d=a.ha;f=e.o*d.o+e.f*d.i+e.h*d.l;h=e.o*d.f+e.f*d.m+e.h*d.g;l=e.o*d.h+e.f*d.j+e.h*d.s;g=e.i*d.o+e.m*d.i+e.j*d.l;k=e.i*d.f+e.m*d.m+e.j*d.g;m=e.i*d.h+e.m*d.j+e.j*d.s;n=e.l*d.o+e.g*d.i+e.s*d.l;r=e.l*d.f+e.g*d.m+e.s*d.g;q=e.l*d.h+e.g*d.j+e.s*d.s;c.o=f;c.f=h;c.h=l;c.i=g;c.m=k;c.j=m;c.l=n;c.g=r;c.s=q;f=e.o*d.v+e.f*d.A+e.h*d.B;h=e.i*d.v+e.m*d.A+e.j*d.B;d=e.l*d.v+e.g*d.A+e.s*d.B;c.v=f;c.A=h;c.B=d;c.v+=e.v;c.A+=e.A;c.B+=e.B;a.Fb.Lb(a.u,a.ja);e=a.u.na;c=a.u.oa;d=a.u.pa;f=a.u.ka;h=a.u.la;l=a.u.ma;a.Fb.Lb(a.u,a.a);a.u.na=ea.u.ka?f:a.u.ka;a.u.la=h>a.u.la?h:a.u.la;a.u.ma=l>a.u.ma?l:a.u.ma;null!=a.ub&&(e=a.a.v-a.ja.v,c=a.a.A-a.ja.A,d=a.a.B-a.ja.B,f=a.mc,f.x=e,f.y=c,f.z=d,a.Vb.jc.hc.Qd(a.ub,a.u,a.mc));a=b}},Eo:function(){return this.Jb},nn:function(a){this.Jb=a;this.ck()},pn:function(){this.Bb=!1;this.wb=0},on:function(){this.Bb=!0;this.wb=0},Dm:function(){return this.Bb},tm:function(){return this.wb},gn:function(a){this.Tk=a;this.Bb=!1;this.wb=0},Je:function(){return this.sk},jn:function(a){this.sk=a},Vc:function(){return this.hk},en:function(a){this.hk=a},Um:function(){return this.ia},Im:function(){return this.M}};Ka.prototype={wc:function(){return this.pk},Ke:function(a){this.pk=a},Uc:function(){return this.Ak},cf:function(a){this.Ak=a},Dc:function(){var a=this.ha,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Hc:function(a){var b=this.ha;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},ie:function(){var a=this.a,b=new Ua;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;return b},Fe:function(a){var b=this.a;a.v=b.v;a.A=b.A;a.B=b.B;a.o=b.o;a.f=b.f;a.h=b.h;a.i=b.i;a.m=b.m;a.j=b.j;a.l=b.l;a.g=b.g;a.s=b.s},bf:function(a){var b=this.ha;b.v=a.v;b.A=a.A;b.B=a.B;b.o=a.o;b.f=a.f;b.h=a.h;b.i=a.i;b.m=a.m;b.j=a.j;b.l=a.l;b.g=a.g;b.s=a.s;if(null!=this.Vb)for(a=this.Vb,a.ck(),b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}},lc:function(){return this.Vk},Je:function(a){this.Vk=a;if(null!=this.Vb){a=this.Vb;a.ck();for(var b=a.Gc;null!=b;){var e=b.M,d=a.ja,c=a.a,f=b.ja,h=b.ha,l,g,k,m,n,r,q,t,x;l=d.o*h.o+d.f*h.i+d.h*h.l;g=d.o*h.f+d.f*h.m+d.h*h.g;k=d.o*h.h+d.f*h.j+d.h*h.s;m=d.i*h.o+d.m*h.i+d.j*h.l;n=d.i*h.f+d.m*h.m+d.j*h.g;r=d.i*h.h+d.m*h.j+d.j*h.s;q=d.l*h.o+d.g*h.i+d.s*h.l;t=d.l*h.f+d.g*h.m+d.s*h.g;x=d.l*h.h+d.g*h.j+d.s*h.s;f.o=l;f.f=g;f.h=k;f.i=m;f.m=n;f.j=r;f.l=q;f.g=t;f.s=x;l=d.o*h.v+d.f*h.A+d.h*h.B;g=d.i*h.v+d.m*h.A+d.j*h.B;h=d.l*h.v+d.g*h.A+d.s*h.B;f.v=l;f.A=g;f.B=h;f.v+=d.v;f.A+=d.A;f.B+=d.B;d=b.a;f=b.ha;h=c.o*f.o+c.f*f.i+c.h*f.l;l=c.o*f.f+c.f*f.m+c.h*f.g;g=c.o*f.h+c.f*f.j+c.h*f.s;k=c.i*f.o+c.m*f.i+c.j*f.l;m=c.i*f.f+c.m*f.m+c.j*f.g;n=c.i*f.h+c.m*f.j+c.j*f.s;r=c.l*f.o+c.g*f.i+c.s*f.l;q=c.l*f.f+c.g*f.m+c.s*f.g;t=c.l*f.h+c.g*f.j+c.s*f.s;d.o=h;d.f=l;d.h=g;d.i=k;d.m=m;d.j=n;d.l=r;d.g=q;d.s=t;h=c.o*f.v+c.f*f.A+c.h*f.B;l=c.i*f.v+c.m*f.A+c.j*f.B;f=c.l*f.v+c.g*f.A+c.s*f.B;d.v=h;d.A=l;d.B=f;d.v+=c.v;d.A+=c.A;d.B+=c.B;b.Fb.Lb(b.u,b.ja);c=b.u.na;d=b.u.oa;f=b.u.pa;h=b.u.ka;l=b.u.la;g=b.u.ma;b.Fb.Lb(b.u,b.a);b.u.na=cb.u.ka?h:b.u.ka;b.u.la=l>b.u.la?l:b.u.la;b.u.ma=g>b.u.ma?g:b.u.ma;null!=b.ub&&(c=b.a.v-b.ja.v,d=b.a.A-b.ja.A,f=b.a.B-b.ja.B,h=b.mc,h.x=c,h.y=d,h.z=f,b.Vb.jc.hc.Qd(b.ub,b.u,b.mc));b=e}}},wa:function(){return this.u.clone()},mb:function(a){a.qe(this.u)},xc:function(){return this.Fb},Vc:function(){return this.Vb},Cb:function(){return this.kk},Ge:function(a){this.kk=a},Kb:function(){return this.lk},He:function(a){this.lk=a},kc:function(){return this.im},Ie:function(a){this.im=a},vd:function(){return this.ia},Wc:function(){return this.M}};pi.gg=1;pi.hg=2;pi.BRUTE_FORCE=1;pi.BVH=2;bc.Pm=0;bc.cf=1;bc.Ei=2;bc.jg=3;bc.ig=4;bc.kg=5;bc.Di=0;bc.ph=5;bc.SPHERE=0;bc.BOX=1;bc.CYLINDER=2;bc.CONE=3;bc.CAPSULE=4;bc.CONVEX_HULL=5;ni.Ie=1;Ee.Kb=0;n.numCreations=0;F.defaultFriction=.2;F.defaultRestitution=.2;F.defaultDensity=1;F.defaultCollisionGroup=1;F.defaultCollisionMask=1;F.maxTranslationPerStep=20;F.maxRotationPerStep=3.14159265358979;F.bvhProxyPadding=.1;F.bvhIncrementalCollisionThreshold=.45;F.defaultGJKMargin=.05;F.enableGJKCaching=!0;F.maxEPAVertices=128;F.maxEPAPolyhedronFaces=128;F.contactEnableBounceThreshold=.5;F.velocityBaumgarte=.2;F.positionSplitImpulseBaumgarte=.4;F.positionNgsBaumgarte=1;F.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;F.defaultContactPositionCorrectionAlgorithm=0;F.alternativeContactPositionCorrectionAlgorithm=1;F.contactPersistenceThreshold=.05;F.maxManifoldPoints=4;F.defaultJointConstraintSolverType=0;F.defaultJointPositionCorrectionAlgorithm=0;F.jointWarmStartingFactorForBaungarte=.8;F.jointWarmStartingFactor=.95;F.minSpringDamperDampingRatio=1E-6;F.minRagdollMaxSwingAngle=1E-6;F.maxJacobianRows=6;F.directMlcpSolverEps=1E-9;F.islandInitialRigidBodyArraySize=128;F.islandInitialConstraintArraySize=128;F.sleepingVelocityThreshold=.2;F.sleepingAngularVelocityThreshold=.5;F.sleepingTimeThreshold=1;F.disableSleeping=!1;F.linearSlop=.005;F.angularSlop=.017453292519943278;lb.mb=new lb;dc.Xm=0;dc.Bm=1;dc.Am=2;dc.um=257;dc.tm=258;dc.sm=259;dc.SUCCEEDED=0;dc.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;dc.GJK_DID_NOT_CONVERGE=2;dc.EPA_FAILED_TO_INIT=257;dc.EPA_FAILED_TO_ADD_VERTEX=258;dc.EPA_DID_NOT_CONVERGE=259;I.numCreations=0;J.numCreations=0;pa.POSITIVE_INFINITY=Infinity;pa.NEGATIVE_INFINITY=-Infinity;pa.PI=3.14159265358979;pa.TWO_PI=6.28318530717958;pa.HALF_PI=1.570796326794895;pa.TO_RADIANS=.017453292519943278;pa.TO_DEGREES=57.29577951308238;wa.numCreations=0;Mg.Je=8;Mg.Ke=4;Mg.He=8;Ce.broadPhaseCollisionTime=0;Ce.narrowPhaseCollisionTime=0;Ce.dynamicsTime=0;Ce.totalTime=0;jc.bf=0;jc.Vm=1;jc.Jm=2;jc.BAUMGARTE=0;jc.SPLIT_IMPULSE=1;jc.NGS=2;gf.Ge=1;gf.Fe=2;Mb.Um=0;Mb.Om=1;Mb.Fi=2;Mb.Mm=3;Mb.Ym=4;Mb.Nm=5;Mb.ym=6;Mb.SPHERICAL=0;Mb.REVOLUTE=1;Mb.CYLINDRICAL=2;Mb.PRISMATIC=3;Mb.UNIVERSAL=4;Mb.RAGDOLL=5;Mb.GENERIC=6;vf.Dm=0;vf.gk=1;vf.ITERATIVE=0;vf.DIRECT=1;Qe.fm=0;Qe.Wm=1;Qe.Im=2;Qe.DYNAMIC=0;Qe.STATIC=1;Qe.KINEMATIC=2;Ij.lc()})({}); +/* OimoPhysics 1.2.2 (c) 2022 saharan, The MIT License */var pc="function"==typeof Object.create?Object.create:function($e){function Ab(){}Ab.prototype=$e;return new Ab},yk;if("function"==typeof Object.setPrototypeOf)yk=Object.setPrototypeOf;else{var zk;a:{var Tk={a:!0},Uk={};try{Uk.__proto__=Tk;zk=Uk.a;break a}catch($e){}zk=!1}yk=zk?function($e,Ab){$e.__proto__=Ab;if($e.__proto__!==Ab)throw new TypeError($e+" is not extensible");return $e}:null}var ql=yk; +function rl($e,Ab){$e.prototype=pc(Ab.prototype);$e.prototype.constructor=$e;if(ql)ql($e,Ab);else for(var Eh in Ab)if("prototype"!=Eh)if(Object.defineProperties){var qk=Object.getOwnPropertyDescriptor(Ab,Eh);qk&&Object.defineProperty($e,Eh,qk)}else $e[Eh]=Ab[Eh];$e.Si=Ab.prototype} +(function(){function $e(){this.position=new z;this.rotation=new ia;this.friction=ra.defaultFriction;this.restitution=ra.defaultRestitution;this.density=ra.defaultDensity;this.collisionGroup=ra.defaultCollisionGroup;this.collisionMask=ra.defaultCollisionMask;this.contactCallback=this.geometry=null}function Ab(a){this.uc=-1;this.ra=new Ob;this.za=new Ob;this.g=new Ob;var b=a.position;this.ra.F=b.x;this.ra.G=b.y;this.ra.H=b.z;b=a.rotation;this.ra.A=b.e00;this.ra.j=b.e01;this.ra.m=b.e02;this.ra.o=b.e10; +this.ra.v=b.e11;this.ra.s=b.e12;this.ra.u=b.e20;this.ra.l=b.e21;this.ra.B=b.e22;b=this.za;var e=this.ra;b.F=e.F;b.G=e.G;b.H=e.H;b.A=e.A;b.j=e.j;b.m=e.m;b.o=e.o;b.v=e.v;b.s=e.s;b.u=e.u;b.l=e.l;b.B=e.B;b=this.g;e=this.ra;b.F=e.F;b.G=e.G;b.H=e.H;b.A=e.A;b.j=e.j;b.m=e.m;b.o=e.o;b.v=e.v;b.s=e.s;b.u=e.u;b.l=e.l;b.B=e.B;this.kh=a.restitution;this.dh=a.friction;this.Qh=a.density;this.Tb=a.geometry;this.$g=a.collisionGroup;this.ah=a.collisionMask;this.ld=a.contactCallback;this.D=new Pb;this.Eb=null;this.qc= +new z}function Eh(){}function qk(){this.position=new z;this.rotation=new ia;this.linearVelocity=new z;this.angularVelocity=new z;this.type=0;this.autoSleep=!0;this.angularDamping=this.linearDamping=0}function J(a){this.Jb=this.vc=this.sa=this.U=null;this.nf=0;this.oc=this.Zb=null;this.Pd=0;this.fe=this.Od=null;this.Mf=0;var b=a.linearVelocity;this.ub=b.x;this.vb=b.y;this.wb=b.z;b=a.angularVelocity;this.xb=b.x;this.yb=b.y;this.zb=b.z;this.Lc=this.Kc=this.Jc=this.Rc=this.Qc=this.Pc=0;this.za=new Ob; +this.g=new Ob;b=a.position;this.za.F=b.x;this.za.G=b.y;this.za.H=b.z;b=a.rotation;this.za.A=b.e00;this.za.j=b.e01;this.za.m=b.e02;this.za.o=b.e10;this.za.v=b.e11;this.za.s=b.e12;this.za.u=b.e20;this.za.l=b.e21;this.za.B=b.e22;b=this.g;var e=this.za;b.F=e.F;b.G=e.G;b.H=e.H;b.A=e.A;b.j=e.j;b.m=e.m;b.o=e.o;b.v=e.v;b.s=e.s;b.u=e.u;b.l=e.l;b.B=e.B;this.Xb=a.type;this.Kb=0;this.Ob=!1;this.Oh=a.autoSleep;this.ja=this.ia=this.ha=this.ga=this.fa=this.ea=this.da=this.ca=this.ba=this.Ib=this.ob=this.nb=this.Ya= +this.Wa=this.Sa=this.Oa=this.Ma=this.qa=this.kb=this.jb=this.ib=this.hb=this.gb=this.fb=this.eb=this.cb=this.bb=this.aa=this.Y=this.W=this.V=this.M=this.I=this.C=this.i=this.h=this.Ab=this.Ce=0;this.gh=a.linearDamping;this.Xg=a.angularDamping;this.Gf=this.Ff=this.Ef=this.Kf=this.Jf=this.If=this.Fe=this.Ee=this.De=this.ag=this.$f=this.Zf=0;this.X=new z(1,1,1);this.Ke=!1;this.Hf=1;this.pc=null}function Vk(){this.mass=0;this.localInertia=new ia}function xd(a){var b=bd.call(this)||this;b.h=a;b.info=new Wk; +b.i=Array(ra.maxJacobianRows);a=0;for(var e=b.i.length;a>1&85);d=(d&51)+(d>>2&51);d=(d&15)+(d>>4&15);c=Array(d);for(f=0;fe.e00* +(e.e11*e.e22-e.e12*e.e21)-e.e01*(e.e10*e.e22-e.e12*e.e20)+e.e02*(e.e10*e.e21-e.e11*e.e20)?e=!0:(e=a.localBasis2,e=0>e.e00*(e.e11*e.e22-e.e12*e.e21)-e.e01*(e.e10*e.e22-e.e12*e.e20)+e.e02*(e.e10*e.e21-e.e11*e.e20));e&&console.log("src/oimo/dynamics/constraint/joint/GenericJoint.hx:50:","[warning] joint basis must be right handed");var d=a.localBasis1;e=d.e00;var c=d.e01;var f=d.e02;var h=d.e10;var k=d.e11;var g=d.e12;var l=d.e20;var m=d.e21;d=d.e22;var n=a.localBasis2;var q=n.e00;var p=n.e01;var r= +n.e02;var t=n.e10;var x=n.e11;var v=n.e12;var B=n.e20;var H=n.e21;n=n.e22;b.i=e;b.C=h;b.I=l;b.Ya=c;b.nb=k;b.ob=m;b.Ib=f;b.Jb=g;b.Pb=d;b.V=q;b.W=t;b.Y=B;b.je=p;b.He=x;b.Ie=H;b.Rb=r;b.Sb=v;b.Wb=n;b.qe=0;b.Df=0;b.re=0;b.tc=0;b.vd=0;b.yc=0;b.hd=!1;b.jd=!1;b.wd=!1;b.Oe=Array(3);b.bc=Array(3);b.Ne=Array(3);b.ac=Array(3);b.Oe[0]=a.translationalLimitMotors[0].clone();b.Oe[1]=a.translationalLimitMotors[1].clone();b.Oe[2]=a.translationalLimitMotors[2].clone();b.bc[0]=a.translationalSpringDampers[0].clone(); +b.bc[1]=a.translationalSpringDampers[1].clone();b.bc[2]=a.translationalSpringDampers[2].clone();b.Ne[0]=a.rotationalLimitMotors[0].clone();b.Ne[1]=a.rotationalLimitMotors[1].clone();b.Ne[2]=a.rotationalLimitMotors[2].clone();b.ac[0]=a.rotationalSpringDampers[0].clone();b.ac[1]=a.rotationalSpringDampers[1].clone();b.ac[2]=a.rotationalSpringDampers[2].clone();return b}function Yj(){var a=qf.call(this)||this;a.localAxis1=new z(1,0,0);a.localAxis2=new z(1,0,0);a.translationalLimitMotor=new rf;a.translationalSpringDamper= +new Fd;a.rotationalLimitMotor=new te;a.rotationalSpringDamper=new Fd;return a}function qf(){this.rigidBody2=this.rigidBody1=null;this.localAnchor1=new z;this.localAnchor2=new z;this.allowCollision=!1;this.solverType=ra.defaultJointConstraintSolverType;this.positionCorrectionAlgorithm=ra.defaultJointPositionCorrectionAlgorithm;this.breakTorque=this.breakForce=0}function dc(a){var b=za.call(this,a,2)||this;var e=a.localAxis1;b.i=e.x;b.C=e.y;b.I=e.z;e=a.localAxis2;b.V=e.x;b.W=e.y;b.Y=e.z;b.mg();b.Va= +0;b.tc=0;b.vd=0;b.Xa=0;b.ac=0;b.bc=0;b.h=new Dk(b);b.Fb=a.translationalSpringDamper.clone();b.Yh=a.translationalLimitMotor.clone();b.tb=a.rotationalSpringDamper.clone();b.Vh=a.rotationalLimitMotor.clone();return b}function za(a,b){this.Bb=new Gf(this);this.Cb=new Gf(this);this.pf=ra.defaultJointPositionCorrectionAlgorithm;this.Xb=b;this.pc=null;this.J=a.rigidBody1;this.K=a.rigidBody2;this.Nh=a.allowCollision;this.rf=a.breakForce;this.sf=a.breakTorque;switch(a.solverType){case 0:this.mh=new xd(this); +break;case 1:this.mh=new yd(this)}b=a.localAnchor1;this.tf=b.x;this.uf=b.y;this.vf=b.z;a=a.localAnchor2;this.wf=a.x;this.yf=a.y;this.zf=a.z;this.Wb=this.Sb=this.Rb=this.Ie=this.He=this.je=this.Y=this.W=this.V=this.Pb=this.Jb=this.Ib=this.ob=this.nb=this.Ya=this.I=this.C=this.i=this.pe=this.oe=this.ne=this.me=this.le=this.ke=this.Wa=this.Sa=this.Oa=this.Ma=this.qa=this.aa=0;this.M=Array(ra.maxJacobianRows);a=0;for(b=ra.maxJacobianRows;aa;){var b=a++,e=0==b||4==b?1:8;this.W[b]=Array(e);this.M[b]=Array(e);this.Y[b]=Array(e);for(e=0;8>e;){var d=e++,c=.7853981633974475*b,f=.7853981633974475*d;this.W[b][d]=new z(Math.sin(c)*Math.cos(f),Math.cos(c),-Math.sin(c)*Math.sin(f));this.M[b][d]=new z;this.Y[b][d]=new z}}this.V=Array(8);this.aa=Array(8);this.C=Array(8); +this.i=Array(8);this.I=Array(8);for(a=0;8>a;)b=a++,this.V[b]=new z(Math.cos(.7853981633974475*b),0,-Math.sin(.7853981633974475*b)),this.aa[b]=new z(Math.cos(.7853981633974475*(b+.5)),0,-Math.sin(.7853981633974475*(b+.5))),this.C[b]=new z,this.i[b]=new z,this.I[b]=new z;this.style=new al}function aj(){this.position=new z;this.normal=new z;this.shape=null;this.fraction=1;this.position.$();this.normal.$();this.hit=!1;return this}function Ek(){}function ak(){}function bl(){}function Fk(){this.D=new Pb; +this.h=null;return this}function Gk(){this.C=new rk;this.h=new Ob;this.I=new z;this.$=new z;this.M=this.i=null;return this}function Hk(){this.C=new rk;this.h=new z;this.end=new z;this.i=null;return this}function tb(a,b){null==a&&(a=2);switch(a){case 1:this.nc=new Od;break;case 2:this.nc=new cd}this.Xf=new rg(this.nc);null==b&&(b=new z(0,-9.80665,0));this.Jb=new z(b.x,b.y,b.z);this.Ma=this.Y=this.Oa=this.I=null;this.Ya=this.Pb=this.nf=this.Wa=0;this.Sb=10;this.Rb=5;this.nb=new Hk;this.Sa=new Gk;this.ob= +new Fk;this.M=new Mj;this.i=Array(ra.islandInitialConstraintArraySize);this.W=Array(ra.islandInitialRigidBodyArraySize);this.aa=new cl;this.h=new jd;this.Ci=0}function cl(){this.invDt=this.dt=0;this.dtRatio=1}function Mj(){this.C=Array(ra.islandInitialRigidBodyArraySize);this.I=Array(ra.islandInitialConstraintArraySize);this.Y=Array(ra.islandInitialConstraintArraySize);this.W=Array(ra.islandInitialConstraintArraySize);this.M=this.V=this.i=this.h=0}function rg(a){this.nc=a;this.C=new bk;this.pg=0} +function Hf(){this.Fc=this.zd=this.U=this.sa=null}function Jd(){this.sa=this.U=null;this.Bb=new Hf;this.Cb=new Hf;this.Yf=this.K=this.J=this.jc=this.ic=null;this.Eg=new dl;this.W=new bj;this.lh=this.fh=!1;this.Ra=new nd;this.h=new $i(this.Ra);this.ee=new af(this.Ra);this.xd=!1}function Gb(a,b,e,d){null==d&&(d=1);null==e&&(e=0);null==b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;this.w=d;Gb.numCreations++}function jd(){this.i=Array(256);this.h=0;this.C=Array(256);this.I=0;this.W=Array(256);this.Y= +0;this.M=Array(256);this.V=0}function Sb(){}function Ha(a,b,e,d,c,f,h,k,g,l,m,n,q,p,r,t){null==t&&(t=1);null==r&&(r=0);null==p&&(p=0);null==q&&(q=0);null==n&&(n=0);null==m&&(m=1);null==l&&(l=0);null==g&&(g=0);null==k&&(k=0);null==h&&(h=0);null==f&&(f=1);null==c&&(c=0);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e03=d;this.e10=c;this.e11=f;this.e12=h;this.e13=k;this.e20=g;this.e21=l;this.e22=m;this.e23=n;this.e30=q;this.e31=p;this.e32=r;this.e33= +t;Ha.numCreations++}function ia(a,b,e,d,c,f,h,k,g){null==g&&(g=1);null==k&&(k=0);null==h&&(h=0);null==f&&(f=0);null==c&&(c=1);null==d&&(d=0);null==e&&(e=0);null==b&&(b=0);null==a&&(a=1);this.e00=a;this.e01=b;this.e02=e;this.e10=d;this.e11=c;this.e12=f;this.e20=h;this.e21=k;this.e22=g;ia.numCreations++}function Gh(){}function Xg(){}function yc(){this.i=Array(4);this.mb=Array(4);this.sb=Array(4);this.qa=Array(3);this.qa[0]=new z(1,0,0);this.qa[1]=new z(0,1,0);this.qa[2]=new z(0,0,1);this.bc=new z;this.Sc= +new z;this.Fb=new z;this.tb=new z;this.ac=new Ob;this.i[0]=new z;this.mb[0]=new z;this.sb[0]=new z;this.i[1]=new z;this.mb[1]=new z;this.sb[1]=new z;this.i[2]=new z;this.mb[2]=new z;this.sb[2]=new z;this.i[3]=new z;this.mb[3]=new z;this.sb[3]=new z;this.C=new z;this.aa=new z;this.closestPoint1=new z;this.closestPoint2=new z;this.Y=new ck}function ra(){}function Ob(){this.H=this.G=this.F=0;this.A=1;this.o=this.m=this.j=0;this.v=1;this.l=this.u=this.s=0;this.B=1}function z(a,b,e){null==e&&(e=0);null== +b&&(b=0);null==a&&(a=0);this.x=a;this.y=b;this.z=e;z.numCreations++}function el(){this.vi=new z}function Aj(){this.kd=new z;this.mb=new z;this.sb=new z}function Hh(){this.id=++Hh.h;this.sa=this.U=null;this.jh=new z;this.Xh=this.bh=0;this.Lg=!1;this.Ja=Array(3);this.Ub=Array(3);this.Vb=Array(3);this.ng=new z;this.Ac=Array(3);this.Ac[0]=1;this.Ac[1]=2;this.Ac[2]=0}function ck(){this.Ja=Array(ra.maxEPAVertices);this.W=new z;this.Vd=0;this.i=this.C=null;this.V=0;this.M=this.I=null}function sk(){this.C= +!1;return this}function dk(a){this.C=a;return this}function ek(a){this.C=a;return this}function tk(){this.C=!1;return this}function uk(){this.C=!1;return this}function dl(){}function Ik(){this.C=this.I=this.M=this.w=0;this.i=Array(8);this.h=Array(8);this.i[0]=new sf;this.h[0]=new sf;this.i[1]=new sf;this.h[1]=new sf;this.i[2]=new sf;this.h[2]=new sf;this.i[3]=new sf;this.h[3]=new sf;this.i[4]=new sf;this.h[4]=new sf;this.i[5]=new sf;this.h[5]=new sf;this.i[6]=new sf;this.h[6]=new sf;this.i[7]=new sf; +this.h[7]=new sf}function sf(){this.ab=this.$a=this.Za=this.y=this.x=0}function vk(){this.C=!1;this.i=new Ik;return this}function sg(a){this.C=a}function fl(){this.position1=new z;this.position2=new z;this.id=this.depth=0}function bj(){this.numPoints=0;this.normal=new z;this.points=Array(ra.maxManifoldPoints);this.incremental=!1;for(var a=0,b=ra.maxManifoldPoints;a.2*a&&(b.fc=.2*a);return b}function Pb(){this.va=this.ua= +this.ta=this.ya=this.xa=this.wa=0}function Jk(){this.$b=null;this.M=0;this.I=new gl;this.i=this.C=this.h=null;this.ng=Array(1024)}function gl(){this.Yg=!1}function hl(a,b){a=tg.call(this,a,b)||this;a.bg=null;a.Lf=!1;return a}function wk(){this.Le=this.Me=this.U=null;this.L=Array(2);this.Ta=0;this.Ka=null;this.Z=0;this.Eb=null;this.P=this.O=this.N=this.T=this.S=this.R=0}function cd(){var a=tc.call(this,2)||this;a.eh=!0;a.h=new Jk;a.I=Array(1024);a.M=0;return a}function Od(){var a=tc.call(this,1)|| +this;a.eh=!1;return a}function Yg(){this.Of=this.Nf=null}function tg(a,b){this.userData=a;this.uc=b;this.U=this.sa=null;this.P=this.O=this.N=this.T=this.S=this.R=0}function Kk(){}function Cj(){}function Lk(){var a=kd.call(this,-1)||this;a.min=new z;a.max=new z;return a}function xk(){return kd.call(this,-1)||this}function kd(a){a=tf.call(this,a)||this;a.fc=ra.defaultGJKMargin;a.Ma=!1;return a}function tf(a){this.Xb=a;this.Ge=0}function tc(a){this.Xb=a;this.qa=0;this.Cd=this.C=this.i=null;this.eh=!1; +this.Ma=0;this.V=null;this.ob=0;this.Oa=new xk;this.D=new Lk;this.nb=new Ob;this.$=new z;new rk}function il(){}function Jh(){}Jh.h=function(){return Date.now()};il.h=function(){window.OIMO={};window.OIMO.BroadPhase=tc;tc.prototype.createProxy=tc.prototype.eg;tc.prototype.destroyProxy=tc.prototype.fg;tc.prototype.moveProxy=tc.prototype.fd;tc.prototype.isOverlapping=tc.prototype.Sb;tc.prototype.collectPairs=tc.prototype.qg;tc.prototype.getProxyPairList=tc.prototype.Ib;tc.prototype.isIncremental=tc.prototype.Rb; +tc.prototype.getTestCount=tc.prototype.Jb;tc.prototype.rayCast=tc.prototype.yd;tc.prototype.convexCast=tc.prototype.aa;tc.prototype.aabbTest=tc.prototype.Y;window.OIMO.Geometry=tf;tf.prototype.getType=tf.prototype.Oa;tf.prototype.getVolume=tf.prototype.nb;tf.prototype.rayCast=tf.prototype.yd;window.OIMO.ConvexGeometry=kd;kd.prototype.getGjkMergin=kd.prototype.Sa;kd.prototype.setGjkMergin=kd.prototype.ob;kd.prototype.computeLocalSupportingVertex=kd.prototype.ud;kd.prototype.rayCast=kd.prototype.yd; +window.OIMO.BroadPhaseProxyCallback=Cj;Cj.prototype.process=Cj.prototype.process;window.OIMO.BroadPhaseType=Kk;window.OIMO.Proxy=tg;tg.prototype.getId=tg.prototype.C;tg.prototype.getFatAabb=tg.prototype.h;tg.prototype.getFatAabbTo=tg.prototype.i;window.OIMO.ProxyPair=Yg;Yg.prototype.getProxy1=Yg.prototype.i;Yg.prototype.getProxy2=Yg.prototype.C;Yg.prototype.getNext=Yg.prototype.h;window.OIMO.BruteForceBroadPhase=Od;Od.prototype.createProxy=Od.prototype.eg;Od.prototype.destroyProxy=Od.prototype.fg; +Od.prototype.moveProxy=Od.prototype.fd;Od.prototype.collectPairs=Od.prototype.qg;Od.prototype.rayCast=Od.prototype.yd;Od.prototype.convexCast=Od.prototype.aa;Od.prototype.aabbTest=Od.prototype.Y;window.OIMO.BvhBroadPhase=cd;cd.prototype.createProxy=cd.prototype.eg;cd.prototype.destroyProxy=cd.prototype.fg;cd.prototype.moveProxy=cd.prototype.fd;cd.prototype.collectPairs=cd.prototype.qg;cd.prototype.rayCast=cd.prototype.yd;cd.prototype.convexCast=cd.prototype.aa;cd.prototype.aabbTest=cd.prototype.Y; +cd.prototype.getTreeBalance=cd.prototype.Pb;window.OIMO.Aabb=Pb;Pb.prototype.init=Pb.prototype.Ia;Pb.prototype.getMin=Pb.prototype.Ma;Pb.prototype.getMinTo=Pb.prototype.Oa;Pb.prototype.setMin=Pb.prototype.Ya;Pb.prototype.getMax=Pb.prototype.aa;Pb.prototype.getMaxTo=Pb.prototype.qa;Pb.prototype.setMax=Pb.prototype.Wa;Pb.prototype.getCenter=Pb.prototype.C;Pb.prototype.getCenterTo=Pb.prototype.I;Pb.prototype.getExtents=Pb.prototype.M;Pb.prototype.getExtentsTo=Pb.prototype.V;Pb.prototype.combine=Pb.prototype.h; +Pb.prototype.combined=Pb.prototype.i;Pb.prototype.overlap=Pb.prototype.Sa;Pb.prototype.getIntersection=Pb.prototype.W;Pb.prototype.getIntersectionTo=Pb.prototype.Y;Pb.prototype.copyFrom=Pb.prototype.Dd;Pb.prototype.clone=Pb.prototype.clone;window.OIMO.BoxGeometry=cg;cg.prototype.getHalfExtents=cg.prototype.Wa;cg.prototype.getHalfExtentsTo=cg.prototype.Ya;cg.prototype.computeLocalSupportingVertex=cg.prototype.ud;window.OIMO.CapsuleGeometry=bg;bg.prototype.getRadius=bg.prototype.C;bg.prototype.getHalfHeight= +bg.prototype.i;bg.prototype.computeLocalSupportingVertex=bg.prototype.ud;window.OIMO.ConeGeometry=ag;ag.prototype.getRadius=ag.prototype.M;ag.prototype.getHalfHeight=ag.prototype.I;ag.prototype.computeLocalSupportingVertex=ag.prototype.ud;window.OIMO.ConvexHullGeometry=Ih;Ih.prototype.getVertices=Ih.prototype.i;Ih.prototype.computeLocalSupportingVertex=Ih.prototype.ud;window.OIMO.CylinderGeometry=$f;$f.prototype.getRadius=$f.prototype.C;$f.prototype.getHalfHeight=$f.prototype.i;$f.prototype.computeLocalSupportingVertex= +$f.prototype.ud;window.OIMO.GeometryType=Bj;window.OIMO.RayCastHit=rk;window.OIMO.SphereGeometry=kh;kh.prototype.getRadius=kh.prototype.i;kh.prototype.computeLocalSupportingVertex=kh.prototype.ud;window.OIMO.CollisionMatrix=bk;bk.prototype.getDetector=bk.prototype.i;window.OIMO.DetectorResult=bj;bj.prototype.getMaxDepth=bj.prototype.h;bj.prototype.clear=bj.prototype.clear;window.OIMO.DetectorResultPoint=fl;window.OIMO.Detector=sg;sg.prototype.detect=sg.prototype.Ei;window.OIMO.BoxBoxDetector=vk;window.OIMO.CapsuleCapsuleDetector= +uk;window.OIMO.GjkEpaDetector=tk;window.OIMO.SphereBoxDetector=ek;window.OIMO.SphereCapsuleDetector=dk;window.OIMO.SphereSphereDetector=sk;window.OIMO.Vec3=z;z.prototype.init=z.prototype.Ia;z.prototype.zero=z.prototype.$;z.prototype.add=z.prototype.add;z.prototype.add3=z.prototype.aa;z.prototype.addScaled=z.prototype.Ma;z.prototype.sub=z.prototype.sub;z.prototype.sub3=z.prototype.Xa;z.prototype.scale=z.prototype.V;z.prototype.scale3=z.prototype.Wb;z.prototype.dot=z.prototype.i;z.prototype.cross=z.prototype.Sa; +z.prototype.addEq=z.prototype.h;z.prototype.add3Eq=z.prototype.qa;z.prototype.addScaledEq=z.prototype.Oa;z.prototype.subEq=z.prototype.Y;z.prototype.sub3Eq=z.prototype.tb;z.prototype.scaleEq=z.prototype.W;z.prototype.scale3Eq=z.prototype.Va;z.prototype.crossEq=z.prototype.Wa;z.prototype.mulMat3=z.prototype.Ya;z.prototype.mulMat4=z.prototype.ob;z.prototype.mulTransform=z.prototype.Jb;z.prototype.mulMat3Eq=z.prototype.nb;z.prototype.mulMat4Eq=z.prototype.Ib;z.prototype.mulTransformEq=z.prototype.Pb; +z.prototype.length=z.prototype.length;z.prototype.lengthSq=z.prototype.C;z.prototype.normalized=z.prototype.M;z.prototype.normalize=z.prototype.I;z.prototype.negate=z.prototype.Rb;z.prototype.negateEq=z.prototype.Sb;z.prototype.copyFrom=z.prototype.Dd;z.prototype.clone=z.prototype.clone;z.prototype.toString=z.prototype.toString;window.OIMO.Transform=Ob;Ob.prototype.identity=Ob.prototype.W;Ob.prototype.getPosition=Ob.prototype.C;Ob.prototype.getPositionTo=Ob.prototype.I;Ob.prototype.setPosition=Ob.prototype.Ma; +Ob.prototype.translate=Ob.prototype.Wa;Ob.prototype.getRotation=Ob.prototype.M;Ob.prototype.getRotationTo=Ob.prototype.V;Ob.prototype.setRotation=Ob.prototype.Oa;Ob.prototype.setRotationXyz=Ob.prototype.Sa;Ob.prototype.rotate=Ob.prototype.Y;Ob.prototype.rotateXyz=Ob.prototype.aa;Ob.prototype.getOrientation=Ob.prototype.h;Ob.prototype.getOrientationTo=Ob.prototype.i;Ob.prototype.setOrientation=Ob.prototype.qa;Ob.prototype.clone=Ob.prototype.clone;Ob.prototype.copyFrom=Ob.prototype.Dd;window.OIMO.Setting= +ra;window.OIMO.GjkEpa=yc;yc.prototype.computeClosestPoints=yc.prototype.Rb;yc.prototype.computeDistance=yc.prototype.Wb;yc.prototype.convexCast=yc.prototype.nb;yc.prototype.rayCast=yc.prototype.yd;yc.getInstance=yc.h;window.OIMO.GjkEpaResultState=Xg;window.OIMO.SimplexUtil=Gh;Gh.projectOrigin2=Gh.h;Gh.projectOrigin3=Gh.i;Gh.projectOrigin4=Gh.C;window.OIMO.Mat3=ia;ia.prototype.init=ia.prototype.Ia;ia.prototype.identity=ia.prototype.W;ia.prototype.add=ia.prototype.add;ia.prototype.sub=ia.prototype.sub; +ia.prototype.scale=ia.prototype.nb;ia.prototype.mul=ia.prototype.qa;ia.prototype.addEq=ia.prototype.h;ia.prototype.subEq=ia.prototype.Ib;ia.prototype.scaleEq=ia.prototype.ob;ia.prototype.mulEq=ia.prototype.Ma;ia.prototype.prependScale=ia.prototype.Wa;ia.prototype.appendScale=ia.prototype.I;ia.prototype.prependRotation=ia.prototype.Oa;ia.prototype.appendRotation=ia.prototype.i;ia.prototype.prependScaleEq=ia.prototype.Ya;ia.prototype.appendScaleEq=ia.prototype.M;ia.prototype.prependRotationEq=ia.prototype.Sa; +ia.prototype.appendRotationEq=ia.prototype.C;ia.prototype.transpose=ia.prototype.Rb;ia.prototype.transposeEq=ia.prototype.Sb;ia.prototype.determinant=ia.prototype.V;ia.prototype.trace=ia.prototype.Pb;ia.prototype.inverse=ia.prototype.Y;ia.prototype.inverseEq=ia.prototype.aa;ia.prototype.toArray=ia.prototype.Jb;ia.prototype.copyFrom=ia.prototype.Dd;ia.prototype.clone=ia.prototype.clone;ia.prototype.fromQuat=ia.prototype.Xa;ia.prototype.toQuat=ia.prototype.Ed;ia.prototype.fromEulerXyz=ia.prototype.Va; +ia.prototype.toEulerXyz=ia.prototype.Sc;ia.prototype.getRow=ia.prototype.ac;ia.prototype.getCol=ia.prototype.Fb;ia.prototype.getRowTo=ia.prototype.bc;ia.prototype.getColTo=ia.prototype.Gb;ia.prototype.fromRows=ia.prototype.tb;ia.prototype.fromCols=ia.prototype.Wb;ia.prototype.toString=ia.prototype.toString;window.OIMO.Mat4=Ha;Ha.prototype.init=Ha.prototype.Ia;Ha.prototype.identity=Ha.prototype.Y;Ha.prototype.add=Ha.prototype.add;Ha.prototype.sub=Ha.prototype.sub;Ha.prototype.scale=Ha.prototype.Ib; +Ha.prototype.mul=Ha.prototype.Ma;Ha.prototype.addEq=Ha.prototype.h;Ha.prototype.subEq=Ha.prototype.Pb;Ha.prototype.scaleEq=Ha.prototype.Jb;Ha.prototype.mulEq=Ha.prototype.Oa;Ha.prototype.prependScale=Ha.prototype.nb;Ha.prototype.appendScale=Ha.prototype.I;Ha.prototype.prependRotation=Ha.prototype.Wa;Ha.prototype.appendRotation=Ha.prototype.i;Ha.prototype.prependTranslation=Ha.prototype.bc;Ha.prototype.appendTranslation=Ha.prototype.Xa;Ha.prototype.prependScaleEq=Ha.prototype.ob;Ha.prototype.appendScaleEq= +Ha.prototype.M;Ha.prototype.prependRotationEq=Ha.prototype.Ya;Ha.prototype.appendRotationEq=Ha.prototype.C;Ha.prototype.prependTranslationEq=Ha.prototype.Sc;Ha.prototype.appendTranslationEq=Ha.prototype.tb;Ha.prototype.transpose=Ha.prototype.Wb;Ha.prototype.transposeEq=Ha.prototype.Va;Ha.prototype.determinant=Ha.prototype.V;Ha.prototype.trace=Ha.prototype.Sb;Ha.prototype.inverse=Ha.prototype.aa;Ha.prototype.inverseEq=Ha.prototype.qa;Ha.prototype.lookAt=Ha.prototype.Gb;Ha.prototype.perspective=Ha.prototype.Sa; +Ha.prototype.ortho=Ha.prototype.ac;Ha.prototype.toArray=Ha.prototype.Rb;Ha.prototype.copyFrom=Ha.prototype.Dd;Ha.prototype.fromMat3=Ha.prototype.W;Ha.prototype.fromTransform=Ha.prototype.Fb;Ha.prototype.clone=Ha.prototype.clone;Ha.prototype.toString=Ha.prototype.toString;window.OIMO.MathUtil=Sb;Sb.abs=Sb.abs;Sb.sin=Sb.sin;Sb.cos=Sb.cos;Sb.tan=Sb.tan;Sb.asin=Sb.asin;Sb.acos=Sb.acos;Sb.atan=Sb.atan;Sb.safeAsin=Sb.W;Sb.safeAcos=Sb.V;Sb.atan2=Sb.atan2;Sb.sqrt=Sb.sqrt;Sb.clamp=Sb.h;Sb.rand=Sb.i;Sb.randIn= +Sb.C;Sb.randVec3In=Sb.M;Sb.randVec3=Sb.I;window.OIMO.Pool=jd;jd.prototype.vec3=jd.prototype.ob;jd.prototype.mat3=jd.prototype.Wa;jd.prototype.mat4=jd.prototype.Ya;jd.prototype.quat=jd.prototype.nb;jd.prototype.dispose=jd.prototype.aa;jd.prototype.disposeVec3=jd.prototype.Sa;jd.prototype.disposeMat3=jd.prototype.qa;jd.prototype.disposeMat4=jd.prototype.Ma;jd.prototype.disposeQuat=jd.prototype.Oa;window.OIMO.Quat=Gb;Gb.prototype.identity=Gb.prototype.I;Gb.prototype.init=Gb.prototype.Ia;Gb.prototype.add= +Gb.prototype.add;Gb.prototype.sub=Gb.prototype.sub;Gb.prototype.scale=Gb.prototype.Y;Gb.prototype.addEq=Gb.prototype.h;Gb.prototype.subEq=Gb.prototype.qa;Gb.prototype.scaleEq=Gb.prototype.aa;Gb.prototype.length=Gb.prototype.length;Gb.prototype.lengthSq=Gb.prototype.M;Gb.prototype.dot=Gb.prototype.i;Gb.prototype.normalized=Gb.prototype.W;Gb.prototype.normalize=Gb.prototype.V;Gb.prototype.setArc=Gb.prototype.Ma;Gb.prototype.slerp=Gb.prototype.Oa;Gb.prototype.copyFrom=Gb.prototype.Dd;Gb.prototype.clone= +Gb.prototype.clone;Gb.prototype.fromMat3=Gb.prototype.C;Gb.prototype.toMat3=Gb.prototype.Sa;Gb.prototype.toString=Gb.prototype.toString;window.OIMO.Contact=Jd;Jd.prototype.getShape1=Jd.prototype.M;Jd.prototype.getShape2=Jd.prototype.V;Jd.prototype.isTouching=Jd.prototype.th;Jd.prototype.getManifold=Jd.prototype.i;Jd.prototype.getContactConstraint=Jd.prototype.Y;Jd.prototype.getPrev=Jd.prototype.I;Jd.prototype.getNext=Jd.prototype.C;window.OIMO.ContactLink=Hf;Hf.prototype.getContact=Hf.prototype.h; +Hf.prototype.getOther=Hf.prototype.C;Hf.prototype.getPrev=Hf.prototype.I;Hf.prototype.getNext=Hf.prototype.i;window.OIMO.ContactManager=rg;rg.prototype.getNumContacts=rg.prototype.W;rg.prototype.getContactList=rg.prototype.V;window.OIMO.TimeStep=cl;window.OIMO.World=tb;tb.prototype.step=tb.prototype.Gb;tb.prototype.addRigidBody=tb.prototype.Ie;tb.prototype.removeRigidBody=tb.prototype.hd;tb.prototype.addJoint=tb.prototype.He;tb.prototype.removeJoint=tb.prototype.wi;tb.prototype.setDebugDraw=tb.prototype.mg; +tb.prototype.getDebugDraw=tb.prototype.vf;tb.prototype.debugDraw=tb.prototype.sf;tb.prototype.rayCast=tb.prototype.yd;tb.prototype.convexCast=tb.prototype.tb;tb.prototype.aabbTest=tb.prototype.Xa;tb.prototype.getRigidBodyList=tb.prototype.gd;tb.prototype.getJointList=tb.prototype.yf;tb.prototype.getBroadPhase=tb.prototype.tf;tb.prototype.getContactManager=tb.prototype.uf;tb.prototype.getNumRigidBodies=tb.prototype.Af;tb.prototype.getNumJoints=tb.prototype.tc;tb.prototype.getNumShapes=tb.prototype.Fb; +tb.prototype.getNumIslands=tb.prototype.zf;tb.prototype.getNumVelocityIterations=tb.prototype.yc;tb.prototype.setNumVelocityIterations=tb.prototype.Vg;tb.prototype.getNumPositionIterations=tb.prototype.vd;tb.prototype.setNumPositionIterations=tb.prototype.wd;tb.prototype.getGravity=tb.prototype.wf;tb.prototype.setGravity=tb.prototype.jd;window.OIMO.AabbTestCallback=bl;window.OIMO.ContactCallback=ak;window.OIMO.RayCastCallback=Ek;window.OIMO.RayCastClosest=aj;aj.prototype.clear=aj.prototype.clear; +aj.prototype.process=aj.prototype.process;window.OIMO.DebugDraw=Zf;window.OIMO.DebugDrawStyle=al;window.OIMO.Performance=ii;window.OIMO.ConstraintSolver=bd;bd.prototype.preSolveVelocity=bd.prototype.Rf;bd.prototype.warmStart=bd.prototype.Wf;bd.prototype.solveVelocity=bd.prototype.Vf;bd.prototype.postSolveVelocity=bd.prototype.rg;bd.prototype.preSolvePosition=bd.prototype.Bf;bd.prototype.solvePositionSplitImpulse=bd.prototype.Uf;bd.prototype.solvePositionNgs=bd.prototype.Tf;bd.prototype.postSolve= +bd.prototype.postSolve;window.OIMO.PositionCorrectionAlgorithm=Fh;window.OIMO.ContactConstraint=af;af.prototype.getShape1=af.prototype.i;af.prototype.getShape2=af.prototype.C;af.prototype.getManifold=af.prototype.h;af.prototype.isTouching=af.prototype.th;window.OIMO.Manifold=nd;nd.prototype.getNormal=nd.prototype.I;nd.prototype.getNormalTo=nd.prototype.M;nd.prototype.getTangent=nd.prototype.Y;nd.prototype.getTangentTo=nd.prototype.aa;nd.prototype.getBinormal=nd.prototype.i;nd.prototype.getBinormalTo= +nd.prototype.C;nd.prototype.getPoints=nd.prototype.W;nd.prototype.getNumPoints=nd.prototype.V;window.OIMO.ManifoldPoint=Qc;Qc.prototype.getPosition1=Qc.prototype.M;Qc.prototype.getPosition1To=Qc.prototype.V;Qc.prototype.getPosition2=Qc.prototype.W;Qc.prototype.getPosition2To=Qc.prototype.Y;Qc.prototype.getDepth=Qc.prototype.C;Qc.prototype.isWarmStarted=Qc.prototype.qa;Qc.prototype.getNormalImpulse=Qc.prototype.I;Qc.prototype.getTangentImpulse=Qc.prototype.aa;Qc.prototype.getBinormalImpulse=Qc.prototype.i; +Qc.prototype.isEnabled=Qc.prototype.h;window.OIMO.Joint=za;za.prototype.getRigidBody1=za.prototype.ei;za.prototype.getRigidBody2=za.prototype.fi;za.prototype.getType=za.prototype.yi;za.prototype.getAnchor1=za.prototype.zh;za.prototype.getAnchor2=za.prototype.Bh;za.prototype.getAnchor1To=za.prototype.Ah;za.prototype.getAnchor2To=za.prototype.Ch;za.prototype.getLocalAnchor1=za.prototype.vh;za.prototype.getLocalAnchor2=za.prototype.ai;za.prototype.getLocalAnchor1To=za.prototype.$h;za.prototype.getLocalAnchor2To= +za.prototype.bi;za.prototype.getBasis1=za.prototype.Hh;za.prototype.getBasis2=za.prototype.Jh;za.prototype.getBasis1To=za.prototype.Ih;za.prototype.getBasis2To=za.prototype.Kh;za.prototype.getAllowCollision=za.prototype.yh;za.prototype.setAllowCollision=za.prototype.Oi;za.prototype.getBreakForce=za.prototype.Lh;za.prototype.setBreakForce=za.prototype.Pi;za.prototype.getBreakTorque=za.prototype.Mh;za.prototype.setBreakTorque=za.prototype.Qi;za.prototype.getPositionCorrectionAlgorithm=za.prototype.di; +za.prototype.setPositionCorrectionAlgorithm=za.prototype.Ri;za.prototype.getAppliedForce=za.prototype.Dh;za.prototype.getAppliedForceTo=za.prototype.Eh;za.prototype.getAppliedTorque=za.prototype.Fh;za.prototype.getAppliedTorqueTo=za.prototype.Gh;za.prototype.getPrev=za.prototype.xi;za.prototype.getNext=za.prototype.Vg;window.OIMO.CylindricalJoint=dc;dc.prototype.getAxis1=dc.prototype.gd;dc.prototype.getAxis2=dc.prototype.jd;dc.prototype.getAxis1To=dc.prototype.hd;dc.prototype.getAxis2To=dc.prototype.wd; +dc.prototype.getLocalAxis1=dc.prototype.$d;dc.prototype.getLocalAxis2=dc.prototype.be;dc.prototype.getLocalAxis1To=dc.prototype.ae;dc.prototype.getLocalAxis2To=dc.prototype.Qd;dc.prototype.getTranslationalSpringDamper=dc.prototype.Ze;dc.prototype.getRotationalSpringDamper=dc.prototype.Xe;dc.prototype.getTranslationalLimitMotor=dc.prototype.Ye;dc.prototype.getRotationalLimitMotor=dc.prototype.We;dc.prototype.getAngle=dc.prototype.yc;dc.prototype.getTranslation=dc.prototype.Rd;window.OIMO.JointConfig= +qf;window.OIMO.CylindricalJointConfig=Yj;Yj.prototype.init=Yj.prototype.Ia;window.OIMO.GenericJoint=Pc;Pc.prototype.getAxisX=Pc.prototype.ae;Pc.prototype.getAxisY=Pc.prototype.be;Pc.prototype.getAxisZ=Pc.prototype.Qd;Pc.prototype.getTranslationalSpringDampers=Pc.prototype.Ye;Pc.prototype.getRotationalSpringDampers=Pc.prototype.We;Pc.prototype.getTranslationalLimitMotors=Pc.prototype.Xe;Pc.prototype.getRotationalLimitMotors=Pc.prototype.Rd;Pc.prototype.getAngles=Pc.prototype.$d;Pc.prototype.getTranslations= +Pc.prototype.Ze;window.OIMO.GenericJointConfig=Xj;Xj.prototype.init=Xj.prototype.Ia;window.OIMO.JointLink=Gf;Gf.prototype.getContact=Gf.prototype.h;Gf.prototype.getOther=Gf.prototype.C;Gf.prototype.getPrev=Gf.prototype.I;Gf.prototype.getNext=Gf.prototype.i;window.OIMO.JointType=Wg;window.OIMO.PrismaticJoint=rc;rc.prototype.getAxis1=rc.prototype.vd;rc.prototype.getAxis2=rc.prototype.gd;rc.prototype.getAxis1To=rc.prototype.yc;rc.prototype.getAxis2To=rc.prototype.hd;rc.prototype.getLocalAxis1=rc.prototype.wd; +rc.prototype.getLocalAxis2=rc.prototype.ae;rc.prototype.getLocalAxis1To=rc.prototype.$d;rc.prototype.getLocalAxis2To=rc.prototype.be;rc.prototype.getSpringDamper=rc.prototype.Qd;rc.prototype.getLimitMotor=rc.prototype.jd;rc.prototype.getTranslation=rc.prototype.Rd;window.OIMO.PrismaticJointConfig=Wj;Wj.prototype.init=Wj.prototype.Ia;window.OIMO.RagdollJoint=Yb;Yb.prototype.getAxis1=Yb.prototype.$d;Yb.prototype.getAxis2=Yb.prototype.be;Yb.prototype.getAxis1To=Yb.prototype.ae;Yb.prototype.getAxis2To= +Yb.prototype.Qd;Yb.prototype.getLocalAxis1=Yb.prototype.Rd;Yb.prototype.getLocalAxis2=Yb.prototype.Xe;Yb.prototype.getLocalAxis1To=Yb.prototype.We;Yb.prototype.getLocalAxis2To=Yb.prototype.Ye;Yb.prototype.getTwistSpringDamper=Yb.prototype.Ni;Yb.prototype.getTwistLimitMotor=Yb.prototype.hi;Yb.prototype.getSwingSpringDamper=Yb.prototype.ug;Yb.prototype.getSwingAxis=Yb.prototype.sg;Yb.prototype.getSwingAxisTo=Yb.prototype.tg;Yb.prototype.getSwingAngle=Yb.prototype.Ze;Yb.prototype.getTwistAngle=Yb.prototype.gi; +window.OIMO.RagdollJointConfig=Vj;Vj.prototype.init=Vj.prototype.Ia;window.OIMO.RevoluteJoint=qc;qc.prototype.getAxis1=qc.prototype.yc;qc.prototype.getAxis2=qc.prototype.hd;qc.prototype.getAxis1To=qc.prototype.gd;qc.prototype.getAxis2To=qc.prototype.jd;qc.prototype.getLocalAxis1=qc.prototype.$d;qc.prototype.getLocalAxis2=qc.prototype.be;qc.prototype.getLocalAxis1To=qc.prototype.ae;qc.prototype.getLocalAxis2To=qc.prototype.Qd;qc.prototype.getSpringDamper=qc.prototype.Rd;qc.prototype.getLimitMotor= +qc.prototype.wd;qc.prototype.getAngle=qc.prototype.tc;window.OIMO.RevoluteJointConfig=Uj;Uj.prototype.init=Uj.prototype.Ia;window.OIMO.RotationalLimitMotor=te;te.prototype.setLimits=te.prototype.h;te.prototype.setMotor=te.prototype.i;te.prototype.clone=te.prototype.clone;window.OIMO.SphericalJoint=Zi;Zi.prototype.getSpringDamper=Zi.prototype.Xa;window.OIMO.SphericalJointConfig=Tj;Tj.prototype.init=Tj.prototype.Ia;window.OIMO.SpringDamper=Fd;Fd.prototype.setSpring=Fd.prototype.h;Fd.prototype.setSymplecticEuler= +Fd.prototype.i;Fd.prototype.clone=Fd.prototype.clone;window.OIMO.TranslationalLimitMotor=rf;rf.prototype.setLimits=rf.prototype.h;rf.prototype.setMotor=rf.prototype.i;rf.prototype.clone=rf.prototype.clone;window.OIMO.UniversalJoint=cc;cc.prototype.getAxis1=cc.prototype.$d;cc.prototype.getAxis2=cc.prototype.be;cc.prototype.getAxis1To=cc.prototype.ae;cc.prototype.getAxis2To=cc.prototype.Qd;cc.prototype.getLocalAxis1=cc.prototype.Rd;cc.prototype.getLocalAxis2=cc.prototype.Xe;cc.prototype.getLocalAxis1To= +cc.prototype.We;cc.prototype.getLocalAxis2To=cc.prototype.Ye;cc.prototype.getSpringDamper1=cc.prototype.gi;cc.prototype.getSpringDamper2=cc.prototype.hi;cc.prototype.getLimitMotor1=cc.prototype.tg;cc.prototype.getLimitMotor2=cc.prototype.ug;cc.prototype.getAngle1=cc.prototype.Ze;cc.prototype.getAngle2=cc.prototype.sg;window.OIMO.UniversalJointConfig=Sj;Sj.prototype.init=Sj.prototype.Ia;window.OIMO.ConstraintSolverType=Ck;window.OIMO.DirectJointConstraintSolver=yd;yd.prototype.preSolveVelocity=yd.prototype.Rf; +yd.prototype.warmStart=yd.prototype.Wf;yd.prototype.solveVelocity=yd.prototype.Vf;yd.prototype.postSolveVelocity=yd.prototype.rg;yd.prototype.preSolvePosition=yd.prototype.Bf;yd.prototype.solvePositionSplitImpulse=yd.prototype.Uf;yd.prototype.solvePositionNgs=yd.prototype.Tf;yd.prototype.postSolve=yd.prototype.postSolve;window.OIMO.PgsContactConstraintSolver=Nd;Nd.prototype.preSolveVelocity=Nd.prototype.Rf;Nd.prototype.warmStart=Nd.prototype.Wf;Nd.prototype.solveVelocity=Nd.prototype.Vf;Nd.prototype.preSolvePosition= +Nd.prototype.Bf;Nd.prototype.solvePositionSplitImpulse=Nd.prototype.Uf;Nd.prototype.solvePositionNgs=Nd.prototype.Tf;Nd.prototype.postSolve=Nd.prototype.postSolve;window.OIMO.PgsJointConstraintSolver=xd;xd.prototype.preSolveVelocity=xd.prototype.Rf;xd.prototype.warmStart=xd.prototype.Wf;xd.prototype.solveVelocity=xd.prototype.Vf;xd.prototype.postSolveVelocity=xd.prototype.rg;xd.prototype.preSolvePosition=xd.prototype.Bf;xd.prototype.solvePositionSplitImpulse=xd.prototype.Uf;xd.prototype.solvePositionNgs= +xd.prototype.Tf;xd.prototype.postSolve=xd.prototype.postSolve;window.OIMO.MassData=Vk;window.OIMO.RigidBody=J;J.prototype.getPosition=J.prototype.Va;J.prototype.getPositionTo=J.prototype.Xa;J.prototype.setPosition=J.prototype.He;J.prototype.translate=J.prototype.tf;J.prototype.getRotation=J.prototype.Fb;J.prototype.getRotationTo=J.prototype.Gb;J.prototype.setRotation=J.prototype.Ie;J.prototype.setRotationXyz=J.prototype.rf;J.prototype.rotate=J.prototype.Ed;J.prototype.rotateXyz=J.prototype.ce;J.prototype.getOrientation= +J.prototype.Sb;J.prototype.getOrientationTo=J.prototype.Wb;J.prototype.setOrientation=J.prototype.je;J.prototype.getTransform=J.prototype.ac;J.prototype.getTransformTo=J.prototype.bc;J.prototype.setTransform=J.prototype.sf;J.prototype.getMass=J.prototype.zh;J.prototype.getLocalInertia=J.prototype.We;J.prototype.getLocalInertiaTo=J.prototype.Xe;J.prototype.getMassData=J.prototype.Ah;J.prototype.getMassDataTo=J.prototype.Bh;J.prototype.setMassData=J.prototype.ai;J.prototype.getRotationFactor=J.prototype.sg; +J.prototype.setRotationFactor=J.prototype.bi;J.prototype.getLinearVelocity=J.prototype.Qd;J.prototype.getLinearVelocityTo=J.prototype.Rd;J.prototype.setLinearVelocity=J.prototype.$h;J.prototype.getAngularVelocity=J.prototype.jd;J.prototype.getAngularVelocityTo=J.prototype.wd;J.prototype.setAngularVelocity=J.prototype.Mh;J.prototype.addLinearVelocity=J.prototype.vf;J.prototype.addAngularVelocity=J.prototype.uf;J.prototype.applyImpulse=J.prototype.vd;J.prototype.applyLinearImpulse=J.prototype.Af;J.prototype.applyAngularImpulse= +J.prototype.yf;J.prototype.applyForce=J.prototype.zf;J.prototype.applyForceToCenter=J.prototype.tc;J.prototype.applyTorque=J.prototype.yc;J.prototype.getLinearContactImpulse=J.prototype.$d;J.prototype.getLinearContactImpulseTo=J.prototype.ae;J.prototype.getAngularContactImpulse=J.prototype.gd;J.prototype.getAngularContactImpulseTo=J.prototype.hd;J.prototype.getGravityScale=J.prototype.xi;J.prototype.setGravityScale=J.prototype.ug;J.prototype.getLocalPoint=J.prototype.Ye;J.prototype.getLocalPointTo= +J.prototype.wh;J.prototype.getLocalVector=J.prototype.xh;J.prototype.getLocalVectorTo=J.prototype.yh;J.prototype.getWorldPoint=J.prototype.Fh;J.prototype.getWorldPointTo=J.prototype.Gh;J.prototype.getWorldVector=J.prototype.Hh;J.prototype.getWorldVectorTo=J.prototype.Ih;J.prototype.getNumShapes=J.prototype.Rb;J.prototype.getShapeList=J.prototype.Dh;J.prototype.getNumContactLinks=J.prototype.Ch;J.prototype.getContactLinkList=J.prototype.Vg;J.prototype.getNumJointLinks=J.prototype.Ze;J.prototype.getJointLinkList= +J.prototype.yi;J.prototype.addShape=J.prototype.wf;J.prototype.removeShape=J.prototype.Kh;J.prototype.getType=J.prototype.Sc;J.prototype.setType=J.prototype.di;J.prototype.wakeUp=J.prototype.fi;J.prototype.sleep=J.prototype.ei;J.prototype.isSleeping=J.prototype.Jh;J.prototype.getSleepTime=J.prototype.Eh;J.prototype.setAutoSleep=J.prototype.tg;J.prototype.getLinearDamping=J.prototype.be;J.prototype.setLinearDamping=J.prototype.vh;J.prototype.getAngularDamping=J.prototype.mg;J.prototype.setAngularDamping= +J.prototype.Lh;J.prototype.getPrev=J.prototype.tb;J.prototype.getNext=J.prototype.Pb;window.OIMO.RigidBodyConfig=qk;window.OIMO.RigidBodyType=Eh;window.OIMO.Shape=Ab;Ab.prototype.getFriction=Ab.prototype.Ma;Ab.prototype.setFriction=Ab.prototype.Rb;Ab.prototype.getRestitution=Ab.prototype.Ya;Ab.prototype.setRestitution=Ab.prototype.Wb;Ab.prototype.getLocalTransform=Ab.prototype.Sa;Ab.prototype.getLocalTransformTo=Ab.prototype.Wa;Ab.prototype.getTransform=Ab.prototype.C;Ab.prototype.getTransformTo= +Ab.prototype.I;Ab.prototype.setLocalTransform=Ab.prototype.Sb;Ab.prototype.getDensity=Ab.prototype.qa;Ab.prototype.setDensity=Ab.prototype.Pb;Ab.prototype.getAabb=Ab.prototype.M;Ab.prototype.getAabbTo=Ab.prototype.V;Ab.prototype.getGeometry=Ab.prototype.Oa;Ab.prototype.getRigidBody=Ab.prototype.nb;Ab.prototype.getCollisionGroup=Ab.prototype.W;Ab.prototype.setCollisionGroup=Ab.prototype.ob;Ab.prototype.getCollisionMask=Ab.prototype.Y;Ab.prototype.setCollisionMask=Ab.prototype.Ib;Ab.prototype.getContactCallback= +Ab.prototype.aa;Ab.prototype.setContactCallback=Ab.prototype.Jb;Ab.prototype.getPrev=Ab.prototype.i;Ab.prototype.getNext=Ab.prototype.h;window.OIMO.ShapeConfig=$e};tc.prototype.eg=function(){return null};tc.prototype.fg=function(){};tc.prototype.fd=function(){};tc.prototype.Sb=function(a,b){return a.Rb.R&&a.Sb.S&&a.Tb.T:!1};tc.prototype.qg=function(){};tc.prototype.Ib=function(){return this.Cd};tc.prototype.Rb=function(){return this.eh};tc.prototype.Jb=function(){return this.Ma}; +tc.prototype.yd=function(){};tc.prototype.aa=function(){};tc.prototype.Y=function(){};tf.prototype.Wd=function(){};tf.prototype.Yb=function(){};tf.prototype.h=function(){return!1};tf.prototype.Oa=function(){return this.Xb};tf.prototype.nb=function(){return this.Ge};tf.prototype.yd=function(a,b,e,d){var c=a.x;var f=a.y;a=a.z;var h=b.x;var k=b.y;b=b.z;c-=e.F;f-=e.G;a-=e.H;h-=e.F;k-=e.G;b-=e.H;var g=e.A*c+e.o*f+e.u*a;var l=e.j*c+e.v*f+e.l*a;if(this.h(g,l,e.m*c+e.s*f+e.B*a,e.A*h+e.o*k+e.u*b,e.j*h+e.v* +k+e.l*b,e.m*h+e.s*k+e.B*b,d)){a=d.position;c=a.x;f=a.y;k=a.z;a=d.normal;b=a.x;g=a.y;var m=a.z;l=e.A*c+e.j*f+e.m*k;var n=e.o*c+e.v*f+e.s*k;k=e.u*c+e.l*f+e.B*k;a=e.A*b+e.j*g+e.m*m;h=e.o*b+e.v*g+e.s*m;b=e.u*b+e.l*g+e.B*m;c=l+e.F;f=n+e.G;k+=e.H;e=d.position;e.x=c;e.y=f;e.z=k;d=d.normal;d.x=a;d.y=h;d.z=b;return!0}return!1};rl(kd,tf);kd.prototype.Sa=function(){return this.fc};kd.prototype.ob=function(a){0>a&&(a=0);this.fc=a};kd.prototype.ud=function(){};kd.prototype.yd=function(a,b,e,d){return this.Ma? +yc.instance.yd(this,e,a,b,d):tf.prototype.yd.call(this,a,b,e,d)};rl(xk,kd);xk.prototype.Ia=function(a,b,e){this.c=a;var d=e.x;var c=e.y;var f=e.z;e=b.A*d+b.o*c+b.u*f;var h=b.j*d+b.v*c+b.l*f;b=b.m*d+b.s*c+b.B*f;d=this.i=new z;d.x=e;d.y=h;d.z=b;this.fc=a.fc};xk.prototype.ud=function(a,b){this.c.ud(a,b);var e=this.i;0e.R&&a.Se.S&&a.Te.T){var c=this.V;null!=c?(this.V=c.U,c.U=null):c=new Yg;null!=this.Cd&&(c.U=this.Cd);this.Cd=c;c.Nf=a;c.Of=e}e=d}a=b}};Od.prototype.yd=function(a,b,e){var d=a.x;var c=a.y;a=a.z;var f=b.x;var h=b.y;b=b.z;for(var k=this.i;null!=k;){var g=k.U,l=d,m=c,n=a,q=f,p=h,r=b,t=k.R,x=k.S,v=k.T,B=k.N,H=k.O,C=k.P;if(t>(l>q?l:q)||B<(l(m>p?m: +p)||H<(m(n>r?n:r)||C<(nq?-q:q;var y=0>p?-p:p,A=0>N?-N:N,E=.5*(B-t),L=.5*(H-x),G=.5*(C-v);l-=.5*(B+t);m-=.5*(H+x);n-=.5*(C+v);v=m*N-n*p;0<(0>v?-v:v)-(L*A+G*y)?n=!0:(n=n*q-l*N,n=0<(0>n?-n:n)-(G*r+E*A));n?q=!0:(q=l*p-m*q,q=0<(0>q?-q:q)-(E*y+L*r));q=q?!1:!0}q&&e.process(k);k=g}};Od.prototype.aa=function(a,b,e,d){for(var c=this.i;null!=c;){var f=c.U,h=this.D.min;h.x=c.R;h.y=c.S;h.z=c.T;h=this.D.max;h.x=c.N;h.y=c.O;h.z=c.P;this.Oa.Ia(a,b,e);h=yc.instance; +0==h.Oa(this.Oa,this.D,b,this.nb,null,!1)&&0>=h.distance&&d.process(c);c=f}};Od.prototype.Y=function(a,b){for(var e=this.i;null!=e;){var d=e.U;a.wae.R&&a.xae.S&&a.yae.T&&b.process(e);e=d}};rl(cd,tc);cd.prototype.W=function(a,b){this.Ma++;var e=0==a.Z,d=0==b.Z;a==b?e||(this.W(a.L[0],b),this.W(a.L[1],b)):a.Rb.R&&a.Sb.S&&a.Tb.T&&(e&&d?(e=this.V,null!=e?(this.V=e.U,e.U=null):e=new Yg,null!=this.Cd&&(e.U=this.Cd),this.Cd=e,e.Nf=a.Eb,e.Of=b.Eb): +d||a.Z>b.Z?(this.W(a.L[0],b),this.W(a.L[1],b)):(this.W(b.L[0],a),this.W(b.L[1],a)))};cd.prototype.Ya=function(a,b,e,d,c,f,h,k){var g=a.R,l=a.S,m=a.T,n=a.N,q=a.O,p=a.P;if(g>(b>c?b:c)||n<(b(e>f?e:f)||q<(e(d>h?d:h)||p<(dt?-t:t;var B=0>x?-x:x,H=0>v?-v:v,C=.5*(n-g),N=.5*(q-l),y=.5*(p-m);g=b-.5*(n+g);l=e-.5*(q+l);m=d-.5*(p+m);p=l*v-m*x;0<(0>p?-p:p)-(N*H+y*B)?H=!0:(v=m*t-g*v,H=0<(0>v?-v:v)-(y*r+C*H));H?r=!0:(t=g*x-l*t,r=0<(0>t?-t:t)-(C* +B+N*r));r=r?!1:!0}r&&(0==a.Z?k.process(a.Eb):(this.Ya(a.L[0],b,e,d,c,f,h,k),this.Ya(a.L[1],b,e,d,c,f,h,k)))};cd.prototype.Wa=function(a,b,e,d,c){var f=this.D.min;f.x=a.R;f.y=a.S;f.z=a.T;f=this.D.max;f.x=a.N;f.y=a.O;f.z=a.P;this.Oa.Ia(b,e,d);f=yc.instance;0==f.Oa(this.Oa,this.D,e,this.nb,null,!1)&&0>=f.distance&&(0==a.Z?c.process(a.Eb):(this.Wa(a.L[0],b,e,d,c),this.Wa(a.L[1],b,e,d,c)))};cd.prototype.Sa=function(a,b,e){a.Rb.wa&&a.Sb.xa&&a.Tb.ya&&(0==a.Z?e.process(a.Eb): +(this.Sa(a.L[0],b,e),this.Sa(a.L[1],b,e)))};cd.prototype.eg=function(a,b){a=new hl(a,this.ob++);this.qa++;null==this.i?this.i=a:(this.C.U=a,a.sa=this.C);this.C=a;a.R=b.wa;a.S=b.xa;a.T=b.ya;a.N=b.ta;a.O=b.ua;a.P=b.va;b=ra.bvhProxyPadding;a.R-=b;a.S-=b;a.T-=b;a.N+=b;a.O+=b;a.P+=b;b=this.h;var e=b.h;null!=e?(b.h=e.U,e.U=null):e=new wk;var d=e;d.Eb=a;a.bg=d;d.R=a.R;d.S=a.S;d.T=a.T;d.N=a.N;d.O=a.O;d.P=a.P;b.M++;null==b.C?b.C=d:(b.i.Le=d,d.Me=b.i);b.i=d;if(null==b.$b)b.$b=d;else{for(var c=b.$b;0k.Z?(f.L[1]=e,e.Ka=f,e.Ta=1,e.L[0]=k,k.Ka=e,k.Ta=0,h=f.L[0],k=f.L[1],f.R=h.Rk.N?h.N:k.N,f.O=h.O>k.O?h.O:k.O,f.P=h.P>k.P?h.P:k.P,h=f.L[0].Z, +k=f.L[1].Z,f.Z=(h>k?h:k)+1,h=e.L[0],k=e.L[1],e.R=h.Rk.N?h.N:k.N,e.O=h.O>k.O?h.O:k.O,e.P=h.P>k.P?h.P:k.P,h=e.L[0].Z,k=e.L[1].Z,e.Z=(h>k?h:k)+1):(f.L[0]=e,e.Ka=f,e.Ta=0,e.L[0]=h,h.Ka=e,h.Ta=0,h=f.L[0],k=f.L[1],f.R=h.Rk.N?h.N:k.N,f.O=h.O>k.O?h.O:k.O,f.P=h.P>k.P?h.P:k.P,h=f.L[0].Z,k=f.L[1].Z,f.Z=(h>k?h:k)+1,h=e.L[0],k=e.L[1],e.R=h.Rk.N?h.N:k.N,e.O=h.O>k.O?h.O:k.O,e.P=h.P>k.P?h.P:k.P,h=e.L[0].Z,k=e.L[1].Z,e.Z=(h>k?h:k)+1),null!=d?(d.L[c]=f,f.Ka=d,f.Ta=c):(b.$b=f,f.Ka=null),e=f):-1>k&&(f=h.L[0],k=h.L[1],f.Z>k.Z?(h.L[1]=e,e.Ka=h,e.Ta=1,e.L[1]=k,k.Ka=e,k.Ta=1,f=h.L[0],k=h.L[1],h.R=f.Rk.N?f.N:k.N,h.O=f.O>k.O?f.O:k.O,h.P=f.P>k.P?f.P:k.P,f=h.L[0].Z,k=h.L[1].Z,h.Z=(f>k?f:k)+1,f=e.L[0],k=e.L[1],e.R=f.R +k.N?f.N:k.N,e.O=f.O>k.O?f.O:k.O,e.P=f.P>k.P?f.P:k.P,f=e.L[0].Z,k=e.L[1].Z,e.Z=(f>k?f:k)+1):(h.L[0]=e,e.Ka=h,e.Ta=0,e.L[1]=f,f.Ka=e,f.Ta=1,f=h.L[0],k=h.L[1],h.R=f.Rk.N?f.N:k.N,h.O=f.O>k.O?f.O:k.O,h.P=f.P>k.P?f.P:k.P,f=h.L[0].Z,k=h.L[1].Z,h.Z=(f>k?f:k)+1,f=e.L[0],k=e.L[1],e.R=f.Rk.N?f.N:k.N,e.O=f.O>k.O?f.O:k.O,e.P=f.P>k.P?f.P:k.P,f=e.L[0].Z,k=e.L[1].Z,e.Z=(f>k?f:k)+1),null!=d?(d.L[c]= +h,h.Ka=d,h.Ta=c):(b.$b=h,h.Ka=null),e=h)}d=e.L[0].Z;c=e.L[1].Z;e.Z=(d>c?d:c)+1;d=e.L[0];c=e.L[1];e.R=d.Rc.N?d.N:c.N;e.O=d.O>c.O?d.O:c.O;e.P=d.P>c.P?d.P:c.P;e=e.Ka}}if(!a.Lf){a.Lf=!0;if(this.I.length==this.M){b=Array(this.M<<1);e=0;for(d=this.M;eg.Z?(h.L[1]=d,d.Ka=h,d.Ta=1,d.L[0]=g,g.Ka=d,g.Ta=0,k=h.L[0],g=h.L[1],h.R=k.Rg.N?k.N:g.N,h.O=k.O>g.O?k.O:g.O,h.P=k.P>g.P?k.P:g.P,k=h.L[0].Z,g=h.L[1].Z,h.Z=(k>g?k:g)+1,k=d.L[0],g=d.L[1],d.R=k.Rg.N?k.N:g.N,d.O=k.O>g.O?k.O:g.O,d.P=k.P>g.P?k.P:g.P,k=d.L[0].Z,g=d.L[1].Z,d.Z=(k>g?k:g)+1):(h.L[0]=d,d.Ka=h,d.Ta=0,d.L[0]= +k,k.Ka=d,k.Ta=0,k=h.L[0],g=h.L[1],h.R=k.Rg.N?k.N:g.N,h.O=k.O>g.O?k.O:g.O,h.P=k.P>g.P?k.P:g.P,k=h.L[0].Z,g=h.L[1].Z,h.Z=(k>g?k:g)+1,k=d.L[0],g=d.L[1],d.R=k.Rg.N?k.N:g.N,d.O=k.O>g.O?k.O:g.O,d.P=k.P>g.P?k.P:g.P,k=d.L[0].Z,g=d.L[1].Z,d.Z=(k>g?k:g)+1),null!=c?(c.L[f]=h,h.Ka=c,h.Ta=f):(b.$b=h,h.Ka=null),d=h):-1>g&&(h=k.L[0],g=k.L[1],h.Z>g.Z?(k.L[1]=d,d.Ka=k,d.Ta=1,d.L[1]=g,g.Ka=d,g.Ta= +1,h=k.L[0],g=k.L[1],k.R=h.Rg.N?h.N:g.N,k.O=h.O>g.O?h.O:g.O,k.P=h.P>g.P?h.P:g.P,h=k.L[0].Z,g=k.L[1].Z,k.Z=(h>g?h:g)+1,h=d.L[0],g=d.L[1],d.R=h.Rg.N?h.N:g.N,d.O=h.O>g.O?h.O:g.O,d.P=h.P>g.P?h.P:g.P,h=d.L[0].Z,g=d.L[1].Z,d.Z=(h>g?h:g)+1):(k.L[0]=d,d.Ka=k,d.Ta=0,d.L[1]=h,h.Ka=d,h.Ta=1,h=k.L[0],g=k.L[1],k.R=h.Rg.N?h.N:g.N,k.O= +h.O>g.O?h.O:g.O,k.P=h.P>g.P?h.P:g.P,h=k.L[0].Z,g=k.L[1].Z,k.Z=(h>g?h:g)+1,h=d.L[0],g=d.L[1],d.R=h.Rg.N?h.N:g.N,d.O=h.O>g.O?h.O:g.O,d.P=h.P>g.P?h.P:g.P,h=d.L[0].Z,g=d.L[1].Z,d.Z=(h>g?h:g)+1),null!=c?(c.L[f]=k,k.Ka=c,k.Ta=f):(b.$b=k,k.Ka=null),d=k)}c=d.L[0].Z;f=d.L[1].Z;d.Z=(c>f?c:f)+1;c=d.L[0];f=d.L[1];d.R=c.Rf.N?c.N:f.N;d.O=c.O>f.O?c.O:f.O;d.P=c.P>f.P?c.P:f.P;d=d.Ka}}}a.bg=null; +e.L[0]=null;e.L[1]=null;e.Ta=0;e.Ka=null;e.Z=0;e.Eb=null;e.U=b.h;b.h=e;a.userData=null;a.U=null;a.sa=null;a.Lf&&(a.Lf=!1)};cd.prototype.fd=function(a,b,e){if(!(a.R<=b.wa&&a.N>=b.ta&&a.S<=b.xa&&a.O>=b.ua&&a.T<=b.ya&&a.P>=b.va)){a.R=b.wa;a.S=b.xa;a.T=b.ya;a.N=b.ta;a.O=b.ua;a.P=b.va;b=ra.bvhProxyPadding;a.R-=b;a.S-=b;a.T-=b;a.N+=b;a.O+=b;a.P+=b;if(null!=e){b=e.x;var d=e.y;e=e.z;a.R+=0b?0:b;a.O+=0>d?0:d;a.P+=0>e?0:e}if(!a.Lf){a.Lf=!0;if(this.I.length==this.M){e= +Array(this.M<<1);b=0;for(d=this.M;bthis.qa)){for(var b=this.M/this.qaN.Z){x.L[1]=r;r.Ka=x;r.Ta=1;r.L[0]=N; +N.Ka=r;N.Ta=0;var y=x.L[0],A=x.L[1];x.R=y.RA.N?y.N:A.N;x.O=y.O>A.O?y.O:A.O;x.P=y.P>A.P?y.P:A.P;var E=x.L[0].Z,L=x.L[1].Z;x.Z=(E>L?E:L)+1;var G=r.L[0],P=r.L[1];r.R=G.RP.N?G.N:P.N;r.O=G.O>P.O?G.O:P.O;r.P=G.P>P.P?G.P:P.P;var K=r.L[0].Z,pa=r.L[1].Z;r.Z=(K>pa?K:pa)+1}else{x.L[0]=r;r.Ka=x;r.Ta=0;r.L[0]=C;C.Ka=r;C.Ta=0;var M=x.L[0],Sa=x.L[1];x.R=M.RSa.N?M.N:Sa.N;x.O=M.O>Sa.O?M.O:Sa.O;x.P=M.P>Sa.P?M.P:Sa.P;var Pa=x.L[0].Z,Ca=x.L[1].Z;x.Z=(Pa>Ca?Pa:Ca)+1;var Ra=r.L[0],wa=r.L[1];r.R=Ra.Rwa.N?Ra.N:wa.N;r.O=Ra.O>wa.O?Ra.O:wa.O;r.P=Ra.P>wa.P?Ra.P:wa.P;var La=r.L[0].Z,Ea=r.L[1].Z;r.Z=(La>Ea?La:Ea)+1}null!=t?(t.L[H]=x,x.Ka=t,x.Ta=H):(h.$b=x,x.Ka=null);r=x}else if(-1>B){var O=v.L[0],ma=v.L[1];if(O.Z>ma.Z){v.L[1]=r;r.Ka=v;r.Ta=1;r.L[1]=ma;ma.Ka=r;ma.Ta= +1;var Y=v.L[0],ta=v.L[1];v.R=Y.Rta.N?Y.N:ta.N;v.O=Y.O>ta.O?Y.O:ta.O;v.P=Y.P>ta.P?Y.P:ta.P;var Va=v.L[0].Z,D=v.L[1].Z;v.Z=(Va>D?Va:D)+1;var Aa=r.L[0],aa=r.L[1];r.R=Aa.Raa.N?Aa.N:aa.N;r.O=Aa.O>aa.O?Aa.O:aa.O;r.P=Aa.P>aa.P?Aa.P:aa.P;var Ua=r.L[0].Z,xa=r.L[1].Z;r.Z=(Ua>xa?Ua:xa)+1}else{v.L[0]=r;r.Ka=v;r.Ta=0;r.L[1]=O;O.Ka=r;O.Ta=1;var Ja=v.L[0],S=v.L[1];v.R=Ja.R< +S.R?Ja.R:S.R;v.S=Ja.SS.N?Ja.N:S.N;v.O=Ja.O>S.O?Ja.O:S.O;v.P=Ja.P>S.P?Ja.P:S.P;var la=v.L[0].Z,qa=v.L[1].Z;v.Z=(la>qa?la:qa)+1;var Da=r.L[0],X=r.L[1];r.R=Da.RX.N?Da.N:X.N;r.O=Da.O>X.O?Da.O:X.O;r.P=Da.P>X.P?Da.P:X.P;var fa=r.L[0].Z,w=r.L[1].Z;r.Z=(fa>w?fa:w)+1}null!=t?(t.L[H]=v,v.Ka=t,v.Ta=H):(h.$b=v,v.Ka=null);r=v}}var ja=r.L[0].Z,ea=r.L[1].Z;r.Z=(ja>ea?ja:ea)+1;var U=r.L[0],ba=r.L[1];r.R= +U.Rba.N?U.N:ba.N;r.O=U.O>ba.O?U.O:ba.O;r.P=U.P>ba.P?U.P:ba.P;r=r.Ka}}}f.bg=null;k.U=null;k.Ta=0;k.L[0]=null;k.L[1]=null;k.Ta=0;k.Ka=null;k.Z=0;k.Eb=null;k.U=h.h;h.h=k;var Fa=this.h,ka=Fa.h;null!=ka?(Fa.h=ka.U,ka.U=null):ka=new wk;var Qa=ka;Qa.Eb=f;f.bg=Qa;Qa.R=f.R;Qa.S=f.S;Qa.T=f.T;Qa.N=f.N;Qa.O=f.O;Qa.P=f.P;Fa.M++;null==Fa.C?Fa.C=Qa:(Fa.i.Le=Qa,Qa.Me=Fa.i);Fa.i=Qa;if(null==Fa.$b)Fa.$b=Qa;else{for(var Ka=Fa.$b;0fb.Z){da.L[1]=W;W.Ka=da;W.Ta=1;W.L[0]=fb;fb.Ka=W;fb.Ta=0;var gb=da.L[0],pb=da.L[1];da.R=gb.Rpb.N?gb.N:pb.N;da.O=gb.O>pb.O?gb.O:pb.O;da.P=gb.P>pb.P?gb.P:pb.P;var ab=da.L[0].Z,$a=da.L[1].Z;da.Z=(ab>$a?ab:$a)+1;var ua=W.L[0],Ya=W.L[1];W.R=ua.RYa.N?ua.N:Ya.N;W.O=ua.O>Ya.O?ua.O:Ya.O;W.P=ua.P>Ya.P?ua.P:Ya.P;var Fb=W.L[0].Z,Xa=W.L[1].Z;W.Z=(Fb>Xa?Fb:Xa)+1}else{da.L[0]=W;W.Ka=da;W.Ta=0;W.L[0]=hb;hb.Ka=W;hb.Ta=0;var Bb=da.L[0],Wa=da.L[1];da.R=Bb.RWa.N?Bb.N:Wa.N;da.O=Bb.O>Wa.O?Bb.O:Wa.O;da.P=Bb.P>Wa.P?Bb.P:Wa.P;var Cb=da.L[0].Z,qb=da.L[1].Z;da.Z=(Cb>qb?Cb:qb)+1;var bb=W.L[0],ib=W.L[1];W.R=bb.Rib.N?bb.N:ib.N;W.O=bb.O>ib.O?bb.O:ib.O;W.P=bb.P>ib.P?bb.P:ib.P;var rb=W.L[0].Z,db=W.L[1].Z;W.Z=(rb>db?rb:db)+1}null!=ca?(ca.L[xb]=da,da.Ka=ca,da.Ta=xb):(Fa.$b=da,da.Ka=null);W=da}else if(-1>oa){var Db=Z.L[0],jb=Z.L[1];if(Db.Z>jb.Z){Z.L[1]=W; +W.Ka=Z;W.Ta=1;W.L[1]=jb;jb.Ka=W;jb.Ta=1;var nb=Z.L[0],cb=Z.L[1];Z.R=nb.Rcb.N?nb.N:cb.N;Z.O=nb.O>cb.O?nb.O:cb.O;Z.P=nb.P>cb.P?nb.P:cb.P;var Jb=Z.L[0].Z,Kb=Z.L[1].Z;Z.Z=(Jb>Kb?Jb:Kb)+1;var F=W.L[0],ub=W.L[1];W.R=F.Rub.N?F.N:ub.N;W.O=F.O>ub.O?F.O:ub.O;W.P=F.P>ub.P?F.P:ub.P;var lb=W.L[0].Z,yb=W.L[1].Z;W.Z=(lb>yb?lb:yb)+1}else{Z.L[0]=W;W.Ka=Z;W.Ta=0;W.L[1]=Db;Db.Ka= +W;Db.Ta=1;var vb=Z.L[0],eb=Z.L[1];Z.R=vb.Reb.N?vb.N:eb.N;Z.O=vb.O>eb.O?vb.O:eb.O;Z.P=vb.P>eb.P?vb.P:eb.P;var Lb=Z.L[0].Z,mb=Z.L[1].Z;Z.Z=(Lb>mb?Lb:mb)+1;var zb=W.L[0],u=W.L[1];W.R=zb.Ru.N?zb.N:u.N;W.O=zb.O>u.O?zb.O:u.O;W.P=zb.P>u.P?zb.P:u.P;var T=W.L[0].Z,R=W.L[1].Z;W.Z=(T>R?T:R)+1}null!=ca?(ca.L[xb]=Z,Z.Ka=ca,Z.Ta=xb):(Fa.$b=Z,Z.Ka=null);W=Z}}var va=W.L[0].Z, +Na=W.L[1].Z;W.Z=(va>Na?va:Na)+1;var ya=W.L[0],Oa=W.L[1];W.R=ya.ROa.N?ya.N:Oa.N;W.O=ya.O>Oa.O?ya.O:Oa.O;W.P=ya.P>Oa.P?ya.P:Oa.P;W=W.Ka}}b&&this.W(this.h.$b,f.bg);f.Lf=!1}this.I[c]=null}b||this.W(this.h.$b,this.h.$b);this.M=0}};cd.prototype.yd=function(a,b,e){null!=this.h.$b&&this.Ya(this.h.$b,a.x,a.y,a.z,b.x,b.y,b.z,e)};cd.prototype.aa=function(a,b,e,d){null!=this.h.$b&&this.Wa(this.h.$b,a,b,e,d)};cd.prototype.Y=function(a,b){null!= +this.h.$b&&this.Sa(this.h.$b,a,b)};cd.prototype.Pb=function(){return this.h.W()};rl(hl,tg);gl.prototype.Ai=function(a,b){var e=b.R+b.N;var d=b.S+b.O;b=b.T+b.P;var c=a.L[0],f=a.L[1];a=c.R+c.N;var h=c.S+c.O;c=c.T+c.P;var k=f.R+f.N;var g=f.S+f.O;f=f.T+f.P;a-=e;h-=d;c-=b;k-=e;g-=d;f-=b;return a*a+h*h+c*cb&&(b=-b);return b+this.V(a.L[0])+this.V(a.L[1])};Pb.prototype.Ia= +function(a,b){this.wa=a.x;this.xa=a.y;this.ya=a.z;this.ta=b.x;this.ua=b.y;this.va=b.z;return this};Pb.prototype.Ma=function(){var a=new z;a.x=this.wa;a.y=this.xa;a.z=this.ya;return a};Pb.prototype.Oa=function(a){a.x=this.wa;a.y=this.xa;a.z=this.ya};Pb.prototype.Ya=function(a){this.wa=a.x;this.xa=a.y;this.ya=a.z;return this};Pb.prototype.aa=function(){var a=new z;a.x=this.ta;a.y=this.ua;a.z=this.va;return a};Pb.prototype.qa=function(a){a.x=this.ta;a.y=this.ua;a.z=this.va};Pb.prototype.Wa=function(a){this.ta= +a.x;this.ua=a.y;this.va=a.z;return this};Pb.prototype.C=function(){var a=new z;var b=this.wa+this.ta;var e=this.xa+this.ua;var d=this.ya+this.va;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a};Pb.prototype.I=function(a){var b=this.wa+this.ta;var e=this.xa+this.ua;var d=this.ya+this.va;a.x=.5*b;a.y=.5*e;a.z=.5*d};Pb.prototype.M=function(){var a=new z;var b=this.ta-this.wa;var e=this.ua-this.xa;var d=this.va-this.ya;a.x=.5*b;a.y=.5*e;a.z=.5*d;return a};Pb.prototype.V=function(a){var b=this.ta-this.wa;var e=this.ua- +this.xa;var d=this.va-this.ya;a.x=.5*b;a.y=.5*e;a.z=.5*d};Pb.prototype.h=function(a){this.wa=this.waa.ta?this.ta:a.ta;this.ua=this.ua>a.ua?this.ua:a.ua;this.va=this.va>a.va?this.va:a.va;return this};Pb.prototype.i=function(a){var b=new Pb;b.wa=this.waa.ta?this.ta:a.ta;b.ua=this.ua>a.ua?this.ua:a.ua;b.va= +this.va>a.va?this.va:a.va;return b};Pb.prototype.Sa=function(a){return this.waa.wa&&this.xaa.xa&&this.yaa.ya:!1};Pb.prototype.W=function(a){var b=new Pb;b.wa=this.wa>a.wa?this.wa:a.wa;b.xa=this.xa>a.xa?this.xa:a.xa;b.ya=this.ya>a.ya?this.ya:a.ya;b.ta=this.taa.wa?this.wa:a.wa;b.xa=this.xa>a.xa?this.xa:a.xa;b.ya=this.ya>a.ya? +this.ya:a.ya;b.ta=this.tae&&(e=-e);0>d&&(d=-d);0>c&&(c=-c);0>f&&(f=-f);0>h&&(h=-h);0>k&&(k=-k);0>g&&(g=-g);0>l&&(l=-l);0>m&&(m=-m);e=e+f+g;d=d+h+l;c=c+k+m;a.wa=b.F-e;a.xa=b.G-d;a.ya=b.H-c;a.ta=b.F+e;a.ua=b.G+d;a.va=b.H+c};cg.prototype.ud=function(a,b){var e,d;var c=d=e=this.fc;ed){if(a<=-k||a>=k)return!1}else{var x=1/d,v=(-k-a)*x;k=(k-a)*x;v>k&&(x=v,v=k,k=x);0k&&(p=k)}if(-1E-6c){if(b<=-g||b>=g)return!1}else v=1/c,k=(-g-b)*v,g=(g-b)*v,k>g&&(v=k,k=g,g=v),0g&&(r=g);if(-1E-6f){if(e<=-l||e>=l)return!1}else k=1/f,g=(-l-e)*k,l=(l-e)*k, +g>l&&(k=g,g=l,l=k),0l&&(t=l);if(1<=m||1<=n||1<=q||0>=p||0>=r||0>=t)return!1;l=m;m=0;n>l&&(l=n,m=1);q>l&&(l=q,m=2);rp||0==l)return!1;switch(m){case 0:h.normal.Ia(0f&&(f=-f);0>h&&(h=-h);0>k&&(k=-k);f*=this.Qb;h*=this.Qb;k*=this.Qb;e+=f;d+=h;c+=k;a.wa=b.F-e;a.xa=b.G-d;a.ya=b.H-c;a.ta=b.F+e;a.ua=b.G+d;a.va=b.H+c};bg.prototype.ud= +function(a,b){0p)return!1;if(0=(-n+p)/m)return!1}else{if(0<=q)return!1;q=0}m=b+(c-b)*q;if(m>-k&&mm?-k:k;var r=a- +0;k=b-g;l=e-0;a=d-a;b=c-b;e=f-e;m=a*a+b*b+e*e;n=r*a+k*b+l*e;q=r*r+k*k+l*l-this.lb*this.lb;p=n*n-m*q;if(0>p)return!1;f=(-n-Math.sqrt(p))/m;if(0>f||1n?g:n;h=l>q?l:q;f=m>p?m:p;k>e||(k=e);h>d||(h=d);f>c||(f=c);g=gthis.C*this.C*(e*e+d*d+c*c)?(b.Ia(0,this.Qb-this.fc/this.C,0),0>b.y&&(b.y=0)):(e=a.x,a=a.z,d=e*e+a*a,c=2*this.Qb,c=(c-this.fc)/c*this.lb-this.fc/this.i,0>c&&(c=0),d=0c&&(c=0),b.x=e*d,b.y=-c,b.z=a*d)};ag.prototype.h=function(a,b,e,d,c,f,h){var k=this.Qb;d-=a;c-=b;f-=e;var g=0,l=1;if(-1E-6c){if(b<=-k||b>=k)return!1}else{var m= +1/c,n=(-k-b)*m;m*=k-b;if(n>m){var q=n;n=m;m=q}0m&&(l=m)}if(1<=g||0>=l)return!1;b-=k;q=this.i*this.i;m=q*(d*d+c*c+f*f)-c*c;n=q*(a*d+b*c+e*f)-b*c;q=q*(a*a+b*b+e*e)-b*b;var p=n*n-m*q;if(0!=m){if(0>p)return!1;p=Math.sqrt(p);if(0>m)if(0=n)return!1}else{if(q=(-n-p)/m,n=1,1<=q)return!1}else if(q=(-n-p)/m,n=(-n+p)/m,1<=q||0>=n)return!1}else if(m=-q/(2*n),0=m)return!1}else if(q=m,n=1,1<=m)return!1;b+=k;if(n<=g||l<=q)return!1;if(qd&&(d=l);mc&&(c=m);gf&&(f=g)}h=d-a;k=c-b;l=f-e;this.Ge=h*k*l;a=.25*((a+d)*(a+d)+(b+c)*(b+c)+(e+f)*(e+f));h=h*h*.25;k=k*k*.25;l=l*l*.25;this.af=.3333333333333333*(k+l)+a;this.df=this.cf=this.bf=0;this.ef=.3333333333333333*(l+h)+a;this.hf=this.gf=this.ff=0;this.jf=.3333333333333333*(h+k)+a};Ih.prototype.Yb=function(a,b){var e,d;var c=d=e=this.fc;var f=this.Ja[0];var h=f.x;var k=f.y; +var g=f.z;var l=b.A*h+b.j*k+b.m*g;f=b.o*h+b.v*k+b.s*g;var m=b.u*h+b.l*k+b.B*g;h=l+b.F;k=f+b.G;g=m+b.H;f=h;l=k;m=g;var n=h;var q=k;var p=g;for(var r=1,t=this.Vd;rh||(n=h);q>k||(q=k);p>g||(p=g)}a.wa=f-e;a.xa=l-d;a.ya=m-c;a.ta=n+e;a.ua=q+d;a.va=p+c};Ih.prototype.ud=function(a,b){var e=this.Ja[0];e=e.x*a.x+e.y*a.y+e.z*a.z;for(var d=0, +c=1,f=this.Vd;ce&&(e=k,d=h)}a=this.Ja[d];b.x=a.x;b.y=a.y;b.z=a.z};rl($f,kd);$f.prototype.C=function(){return this.lb};$f.prototype.i=function(){return this.Qb};$f.prototype.Wd=function(){var a=this.lb*this.lb,b=this.Qb*this.Qb*4;this.Ge=3.14159265358979*a*this.Qb*2;this.af=.08333333333333333*(3*a+b);this.df=this.cf=this.bf=0;this.ef=.5*a;this.hf=this.gf=this.ff=0;this.jf=.08333333333333333*(3*a+b)};$f.prototype.Yb=function(a,b){var e=b.j;var d= +b.v;var c=b.l;0>e&&(e=-e);0>d&&(d=-d);0>c&&(c=-c);var f=Math.sqrt(1-e*e);var h=Math.sqrt(1-d*d);var k=Math.sqrt(1-c*c);f*=this.lb;h*=this.lb;k*=this.lb;e*=this.Qb;d*=this.Qb;c*=this.Qb;f+=e;h+=d;k+=c;a.wa=b.F-f;a.xa=b.G-h;a.ya=b.H-k;a.ta=b.F+f;a.ua=b.G+h;a.va=b.H+k};$f.prototype.ud=function(a,b){var e=a.x,d=a.z,c=e*e+d*d,f=this.lb-this.fc;0>f&&(f=0);c=0f&&(f=0);b.x=e*c;b.y=0c){if(b<=-k||b>=k)return!1}else{var m=1/c,n=(-k-b)*m;k=(k-b)*m;n>k&&(m=n,n=k,k=m);0k&&(l=k)}if(1<=g||0>=l)return!1;k=d*d+f*f;n=a*d+e*f;m=a*a+e*e-this.lb*this.lb;var q=n*n-k*m;if(0>q)return!1;if(0=k)return!1}else{if(0<=m)return!1;m=0;k=1}if(k<=g||l<=m)return!1;if(ml)return!1;f=(-g-Math.sqrt(l))/f;if(0>f||1a&&(a=this.points[d].depth)}return a}; +bj.prototype.clear=function(){for(var a=this.numPoints=0,b=this.points;aob&&(ob=-ob);0>Za&&(Za=-Za);0>W&&(W=-W);var ha= +ob+Za+W,I=x*p+v*r+B*t,na=V+ha,ca=0>I,da=ca?-I:I;if(daZ&&(U=Z,ba=0,ka=x,Qa=v,Ka=B,Fa=ca?-1:1);V=wa;var oa=H*S+C*la+N*qa,xb=H*Da+C*X+N*fa,hb=H*w+C*ja+N*ea;0>oa&&(oa=-oa);0>xb&&(xb=-xb);0>hb&&(hb=-hb);ha=oa+xb+hb;I=H*p+C*r+N*t;var fb=V+ha,gb=0>I,pb=gb?-I:I;if(pb$a&&($a=-$a);0>ua&&(ua=-ua);0>Ya&&(Ya=-Ya);ha=$a+ua+Ya;I=y*p+A*r+E*t;var Fb=V+ha,Xa=0>I,Bb=Xa? +-I:I;if(Bbra.linearSlop?U-ra.linearSlop:0;var Cb=L*Y+G*ta+P*Va,qb=L*D+G*Aa+P*aa,bb=L*Ua+G*xa+P*Ja;0>Cb&&(Cb=-Cb);0>qb&&(qb=-qb);0>bb&&(bb=-bb);V=Cb+qb+bb;ha=Ea;I=L*p+G*r+P*t;var ib=V+ha,rb=0>I,db=rb?-I:I;if(dbjb&&(jb=-jb);0>nb&&(nb=-nb);0>cb&&(cb=-cb);V=jb+nb+cb;ha=O;I=K*p+pa*r+M*t;var Jb=V+ha,Kb=0>I,F=Kb?-I:I; +if(Flb&&(lb=-lb);0>yb&&(yb=-yb);0>vb&&(vb=-vb);V=lb+yb+vb;ha=ma;I=Sa*p+Pa*r+Ca*t;var eb=V+ha,Lb=0>I,mb=Lb?-I:I;if(mbra.linearSlop?U-ra.linearSlop:0;var u=v*P-B*G;var T=B*L-x*P;var R=x*G-v*L;if(0!=u||0!=T||0!=R){var va=u*u+T*T+R*R;0Na&&(Na=-Na);0>ya&&(ya=-ya);V=Na+ya;var Oa=u*Da+T*X+R*fa,kb=u*w+T*ja+R*ea;0>Oa&&(Oa=-Oa);0>kb&&(kb=-kb);ha=Oa+kb;I=u*p+T*r+R*t;var sb=V+ha,Hb=0>I,Ba=Hb?-I:I;if(BaGa&&(Ga=-Ga);0>Q&&(Q=-Q);V=Ga+Q;var Ma=u*S+T*la+R*qa,Ia=u*w+T*ja+R*ea;0>Ma&&(Ma=-Ma);0>Ia&&(Ia=-Ia); +ha=Ma+Ia;I=u*p+T*r+R*t;var Eb=V+ha,wb=0>I,Mb=wb?-I:I;if(MbRb&&(Rb=-Rb);0>Wb&&(Wb=-Wb);V=Rb+Wb;var mc=u*S+T*la+R*qa,Xb=u*Da+T*X+R*fa;0>mc&&(mc=-mc);0>Xb&&(Xb=-Xb);ha=mc+Xb;I=u*p+T*r+R*t;var ic=V+ha,bc=0>I,$b=bc?-I:I;if($bjc&&(jc=-jc);0>ac&&(ac=-ac);V=jc+ac;var ec=u*Da+T*X+R*fa,Ub=u*w+T*ja+R*ea;0>ec&&(ec=-ec);0>Ub&&(Ub=-Ub);ha=ec+Ub;I=u*p+T*r+R*t;var kc=V+ha,uc=0>I,fc=uc?-I:I;if(fcnc&&(nc=-nc);0>gc&&(gc=-gc);V=nc+gc;var Vb=u*S+T*la+R*qa,lc=u*w+T*ja+R*ea;0>Vb&&(Vb=-Vb);0>lc&&(lc=-lc);ha=Vb+lc;I=u*p+T*r+R*t;var ed=V+ha,Bc=0>I,Kc=Bc?-I:I;if(Kcsc&&(sc=-sc);0>Lc&&(Lc=-Lc); +V=sc+Lc;var zd=u*S+T*la+R*qa,Rc=u*Da+T*X+R*fa;0>zd&&(zd=-zd);0>Rc&&(Rc=-Rc);ha=zd+Rc;I=u*p+T*r+R*t;var Wc=V+ha,Dc=0>I,Ec=Dc?-I:I;if(Ecfd&&(fd=-fd);0>Sc&&(Sc=-Sc);V=fd+Sc;var pd=u*Da+T*X+R*fa,Gd=u*w+T*ja+R*ea;0>pd&&(pd=-pd);0>Gd&&(Gd=-Gd);ha=pd+Gd;I=u*p+T*r+R*t;var Tc=V+ha, +Pd=0>I,je=Pd?-I:I;if(jeXc&&(Xc=-Xc);0>be&&(be=-be);V=Xc+be;var ue=u*S+T*la+R*qa,Ee=u*w+T*ja+R*ea;0>ue&&(ue=-ue);0>Ee&&(Ee=-Ee);ha=ue+Ee;I=u*p+T*r+R*t;var ve=V+ha,qd=0>I,ce=qd?-I:I;if(cele&&(le=-le);0>Fc&&(Fc=-Fc);V=le+Fc;var gd=u*S+T*la+R*qa,hd=u*Da+T*X+R*fa;0>gd&&(gd=-gd);0>hd&&(hd=-hd);ha=gd+hd;I=u*p+T*r+R*t;var Ad=V+ha,Yc=0>I,Mc=Yc?-I:I;if(McFa){Oe=-Oe;Pe=-Pe;Qe=-Qe;Wd=-Wd;Xd=-Xd;Dd=-Dd; +Bd=de;vc=He;wc=ne;de=Hd;He=ee;ne=Yd;Hd=Bd;ee=vc;Yd=wc;var Af=Ae;Ae=oe;oe=Af}Oe+=k;Pe+=g;Qe+=l;var ld=1,Sd=0,ud=Wd*L+Xd*G+Dd*P;ud-ra.contactPersistenceThreshold&&(Cd?this.h(a,Ce,Id,fe,Se,Pf,Qf,Ud,Be):this.h(a,Se,Pf,Qf,Ce,Id,fe,Ud,Be))}}}}}}}}};Ik.prototype.V=function(){for(var a=0,b=this.I;a=f){var h=this.h[this.C++];h.x=d.x;h.y=d.y;h.Za=d.Za;h.$a=d.$a;h.ab=d.ab;c/=c-f;f=this.h[this.C++];f.x=d.x+(e.x-d.x)*c;f.y=d.y+ +(e.y-d.y)*c;f.Za=d.Za+(e.Za-d.Za)*c;f.$a=d.$a+(e.$a-d.$a)*c;f.ab=d.ab+(e.ab-d.ab)*c}else 0>=c&&0=f?(h=this.h[this.C++],h.x=d.x,h.y=d.y, +h.Za=d.Za,h.$a=d.$a,h.ab=d.ab,c/=c-f,f=this.h[this.C++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Za=d.Za+(e.Za-d.Za)*c,f.$a=d.$a+(e.$a-d.$a)*c,f.ab=d.ab+(e.ab-d.ab)*c):0>=c&&0=f?(h=this.h[this.C++],h.x=d.x,h.y=d.y,h.Za=d.Za,h.$a=d.$a,h.ab=d.ab,c/=c-f,f=this.h[this.C++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Za=d.Za+(e.Za-d.Za)*c,f.$a=d.$a+(e.$a-d.$a)*c,f.ab=d.ab+(e.ab-d.ab)*c):0>=c&&0=f?(h=this.h[this.C++],h.x=d.x,h.y=d.y,h.Za=d.Za,h.$a=d.$a,h.ab=d.ab,c/=c-f,f=this.h[this.C++],f.x=d.x+(e.x-d.x)*c,f.y=d.y+(e.y-d.y)*c,f.Za=d.Za+(e.Za-d.Za)*c,f.$a=d.$a+(e.$a-d.$a)*c,f.ab=d.ab+(e.ab-d.ab)*c):0>=c&&0this.I)){for(var a=-Infinity,b=Infinity,e=-Infinity,d=Infinity,c=null,f=null,h=null,k=null,g=0,l=this.I;ga&&(a=q,c=n),qe&&(e=p,h=n),pH?0:H>B?1:H/B):0==B?(q=0,n=0>l?0:l>C?1:l/C):(q=C*B-N*N,0==q?n=0:(n=N*H+B*l,n=0>n?0:n>q?1:n/q),q=n*N+H,0>q?(q=0,n=0>l?0:l>C?1:l/C):q>B?(q=1,n=N+l,n=0>n?0:n>C?1:n/C):q/=B);p+=f*n;r+=x*n;t+=c*n;h+=m*q;k+=v*q;d+=g*q;x=p-h;f=r-k;q=t-d;n=x*x+f*f+q*q;n>=(b+e)*(b+e)||(n=Math.sqrt(n),0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.j+this.o)*f,d=(this.m+this.u)*f,c=(this.l-this.s)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.m+this.u)*f,e=(this.s+this.l)*f,c=(this.o-this.j)* +f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.j+this.o)*f,d=(this.s+this.l)*f,c=(this.m-this.u)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.m+this.u)*f,e=(this.s+this.l)*f,c=(this.o-this.j)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a};Ob.prototype.i=function(a){var b=this.A;var e=this.v;var d=this.B;var c=b+e+d;if(0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.j+this.o)*f,d=(this.m+this.u)* +f,c=(this.l-this.s)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.m+this.u)*f,e=(this.s+this.l)*f,c=(this.o-this.j)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.j+this.o)*f,d=(this.s+this.l)*f,c=(this.m-this.u)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.m+this.u)*f,e=(this.s+this.l)*f,c=(this.o-this.j)*f);a.x=b;a.y=e;a.z=d;a.w=c};Ob.prototype.qa=function(a){var b=a.x;var e=a.y;var d=a.z;var c=a.w,f=2*b,h=2*e,k=2*d;a=b*f;var g=e*h;d*=k;var l=b*h;e*=k;b*=k;f*=c;h*=c;c*=k;this.A=1-g-d;this.j= +l-c;this.m=b+h;this.o=l+c;this.v=1-a-d;this.s=e-f;this.u=b-h;this.l=e+f;this.B=1-a-g;return this};Ob.prototype.clone=function(){var a=new Ob;a.F=this.F;a.G=this.G;a.H=this.H;a.A=this.A;a.j=this.j;a.m=this.m;a.o=this.o;a.v=this.v;a.s=this.s;a.u=this.u;a.l=this.l;a.B=this.B;return a};Ob.prototype.Dd=function(a){this.F=a.F;this.G=a.G;this.H=a.H;this.A=a.A;this.j=a.j;this.m=a.m;this.o=a.o;this.v=a.v;this.s=a.s;this.u=a.u;this.l=a.l;this.B=a.B;return this};yc.prototype.Oa=function(a,b,e,d,c,f){this.Ma= +a;this.Sa=b;this.I=e;this.M=d;var h=this.i,k=this.mb,g=this.sb,l=this.aa,m=this.C;null!=c?(null==c.og&&(c.og=new el),this.Va(c.og)):m.$();if(0==m.x*m.x+m.y*m.y+m.z*m.z){var n=d.F-e.F;var q=d.G-e.G;var p=d.H-e.H;m.x=n;m.y=q;m.z=p;1E-6>m.x*m.x+m.y*m.y+m.z*m.z&&m.Ia(1,0,0)}this.h=0;this.V(!1);this.W(!1);var r=this.i[this.h],t=this.mb[this.h];r.x=t.x;r.y=t.y;r.z=t.z;var x=this.sb[this.h];r.x-=x.x;r.y-=x.y;r.z-=x.z;this.h=1;for(var v=0;40>v;){var B=0;switch(this.h){case 1:var H=h[0];l.x=H.x;l.y=H.y;l.z= +H.z;B=1;break;case 2:var C=void 0,N=void 0,y=void 0,A=void 0,E=void 0,L=void 0,G=h[0];C=G.x;N=G.y;y=G.z;var P=h[1];A=P.x;E=P.y;L=P.z;var K=void 0,pa=void 0,M=void 0;K=A-C;pa=E-N;M=L-y;var Sa=K*C+pa*N+M*y;Sa=-Sa/(K*K+pa*pa+M*M);if(0>Sa)l.x=C,l.y=N,l.z=y,B=1;else if(1O*ba+ma*Fa+Y*ka){var Z=void 0,oa=void 0,xb=void 0,hb=void 0,fb=void 0,gb=void 0;Z=wa.x;oa=wa.y;xb=wa.z;hb=La.x;fb=La.y;gb=La.z;var pb=void 0,ab=void 0,$a=void 0;pb=hb-Z;ab=fb-oa;$a=gb-xb;var ua=pb*Z+ab*oa+$a*xb;ua=-ua/(pb*pb+ab*ab+$a*$a);var Ya=void 0;if(0>ua)l.x=Z,l.y=oa,l.z=xb,Ya=1;else if(1ta*Qa+Va*Ka+D*V){var Wa=void 0,Cb=void 0,qb=void 0,bb=void 0,ib=void 0,rb=void 0;Wa=La.x;Cb=La.y;qb=La.z;bb=Ea.x;ib=Ea.y;rb=Ea.z;var db=void 0,Db=void 0,jb=void 0;db=bb-Wa;Db=ib-Cb;jb=rb-qb;var nb=db*Wa+Db*Cb+jb*qb;nb=-nb/(db*db+Db*Db+jb*jb);var cb=void 0;if(0>nb)l.x=Wa,l.y=Cb,l.z=qb,cb=1;else if(1ha||ubAa*ob+aa*Za+Ua*W){var lb=void 0,yb=void 0,vb=void 0,eb=void 0,Lb=void 0,mb=void 0;lb=wa.x;yb=wa.y;vb=wa.z;eb=Ea.x;Lb=Ea.y;mb=Ea.z;var zb=void 0,u=void 0,T=void 0;zb=eb-lb;u=Lb-yb;T=mb-vb;var R=zb*lb+u*yb+T*vb;R=-R/(zb*zb+u*u+T*T);var va=void 0;if(0>R)l.x=lb,l.y=yb,l.z=vb,va=1;else if(1ha||kb(Q*gc+Ma*Vb+Ia*lc)*Wc){var Sc=void 0,pd=void 0,Gd=void 0,Tc=void 0,Pd=void 0,je=void 0,De=void 0,Kd=void 0,Xc=void 0,be=void 0,ue=void 0,Ee=void 0,ve=void 0,qd=void 0,ce=void 0,we=void 0,ke=void 0,le=void 0;Sc=Ba.x;pd=Ba.y;Gd=Ba.z;Tc=Ta.x;Pd=Ta.y;je=Ta.z;De=sa.x;Kd=sa.y;Xc=sa.z;be=Tc-Sc;ue=Pd- +pd;Ee=je-Gd;ve=De-Tc;qd=Kd-Pd;ce=Xc-je;we=Sc-De;ke=pd-Kd;le=Gd-Xc;var Fc=void 0,gd=void 0,hd=void 0;Fc=ue*ce-Ee*qd;gd=Ee*ve-be*ce;hd=be*qd-ue*ve;var Ad=void 0,Yc=void 0,Mc=void 0,ug=void 0,vg=void 0,lh=void 0,Me=void 0,uf=void 0,vf=void 0;Ad=ue*hd-Ee*gd;Yc=Ee*Fc-be*hd;Mc=be*gd-ue*Fc;ug=qd*hd-ce*gd;vg=ce*Fc-ve*hd;lh=ve*gd-qd*Fc;Me=ke*hd-le*gd;uf=le*Fc-we*hd;vf=we*gd-ke*Fc;var Fe=-1,Ic=void 0,Jc=void 0,oc=void 0,xe=0;oc=Jc=Ic=0;if(0>Sc*Ad+pd*Yc+Gd*Mc){var me=void 0,Qd=void 0,Rd=void 0,ye=void 0,dg= +void 0,Uc=void 0;me=Ba.x;Qd=Ba.y;Rd=Ba.z;ye=Ta.x;dg=Ta.y;Uc=Ta.z;var Vc=void 0,Nc=void 0,wf=void 0;Vc=ye-me;Nc=dg-Qd;wf=Uc-Rd;var Vd=Vc*me+Nc*Qd+wf*Rd;Vd=-Vd/(Vc*Vc+Nc*Nc+wf*wf);var Ge=void 0;if(0>Vd)l.x=me,l.y=Qd,l.z=Rd,Ge=1;else if(1Tc*ug+Pd*vg+je*lh){var xf=void 0,If=void 0,Jf=void 0,cf=void 0,df=void 0,Kf= +void 0;xf=Ta.x;If=Ta.y;Jf=Ta.z;cf=sa.x;df=sa.y;Kf=sa.z;var Lf=void 0,yf=void 0,zf=void 0;Lf=cf-xf;yf=df-If;zf=Kf-Jf;var ze=Lf*xf+yf*If+zf*Jf;ze=-ze/(Lf*Lf+yf*yf+zf*zf);var ef=void 0;if(0>ze)l.x=xf,l.y=If,l.z=Jf,ef=1;else if(1Fe||KhDe*Me+Kd*uf+Xc*vf){var Bd=void 0,vc=void 0,wc=void 0,Cd=void 0, +Oe=void 0,Pe=void 0;Bd=Ba.x;vc=Ba.y;wc=Ba.z;Cd=sa.x;Oe=sa.y;Pe=sa.z;var Qe=void 0,Wd=void 0,Xd=void 0;Qe=Cd-Bd;Wd=Oe-vc;Xd=Pe-wc;var Dd=Qe*Bd+Wd*vc+Xd*wc;Dd=-Dd/(Qe*Qe+Wd*Wd+Xd*Xd);var de=void 0;if(0>Dd)l.x=Bd,l.y=vc,l.z=wc,de=1;else if(1Fe||ee(Q*ed+Ma*Bc+Ia*Kc)*Wc){var Af=void 0,ld=void 0,Sd=void 0,ud=void 0,rd=void 0,sd=void 0,md=void 0,Zc=void 0,$c=void 0,Gc=void 0,xc=void 0,Hc=void 0,Ac=void 0,id=void 0,Oc=void 0,ad=void 0,Ie=void 0,Nf=void 0;Af=Ba.x;ld=Ba.y;Sd=Ba.z;ud=sa.x;rd=sa.y;sd=sa.z; +md=Ga.x;Zc=Ga.y;$c=Ga.z;Gc=ud-Af;xc=rd-ld;Hc=sd-Sd;Ac=md-ud;id=Zc-rd;Oc=$c-sd;ad=Af-md;Ie=ld-Zc;Nf=Sd-$c;var Ed=void 0,Td=void 0,td=void 0;Ed=xc*Oc-Hc*id;Td=Hc*Ac-Gc*Oc;td=Gc*id-xc*Ac;var Ld=void 0,vd=void 0,wd=void 0,Of=void 0,Lh=void 0,Mh=void 0,Nh=void 0,mh=void 0,$g=void 0;Ld=xc*td-Hc*Td;vd=Hc*Ed-Gc*td;wd=Gc*Td-xc*Ed;Of=id*td-Oc*Td;Lh=Oc*Ed-Ac*td;Mh=Ac*Td-id*Ed;Nh=Ie*td-Nf*Td;mh=Nf*Ed-ad*td;$g=ad*Td-Ie*Ed;var Be=-1,Je=void 0,Ce=void 0,Id=void 0,fe=0;Id=Ce=Je=0;if(0>Af*Ld+ld*vd+Sd*wd){var pe=void 0, +qe=void 0,Re=void 0,Ud=void 0,Se=void 0,Pf=void 0;pe=Ba.x;qe=Ba.y;Re=Ba.z;Ud=sa.x;Se=sa.y;Pf=sa.z;var Qf=void 0,nh=void 0,ah=void 0;Qf=Ud-pe;nh=Se-qe;ah=Pf-Re;var gf=Qf*pe+nh*qe+ah*Re;gf=-gf/(Qf*Qf+nh*nh+ah*ah);var hf=void 0;if(0>gf)l.x=pe,l.y=qe,l.z=Re,hf=1;else if(1ud*Of+rd*Lh+sd*Mh){var xg=void 0,yg=void 0, +ch=void 0,zg=void 0,Ag=void 0,Bg=void 0;xg=sa.x;yg=sa.y;ch=sa.z;zg=Ga.x;Ag=Ga.y;Bg=Ga.z;var Cg=void 0,Dg=void 0,gg=void 0;Cg=zg-xg;Dg=Ag-yg;gg=Bg-ch;var Te=Cg*xg+Dg*yg+gg*ch;Te=-Te/(Cg*Cg+Dg*Dg+gg*gg);var Rf=void 0;if(0>Te)l.x=xg,l.y=yg,l.z=ch,Rf=1;else if(1Be||cjmd*Nh+Zc*mh+$c*$g){var oh= +void 0,ph=void 0,ge=void 0,Zd=void 0,$d=void 0,qh=void 0;oh=Ba.x;ph=Ba.y;ge=Ba.z;Zd=Ga.x;$d=Ga.y;qh=Ga.z;var rh=void 0,sh=void 0,th=void 0;rh=Zd-oh;sh=$d-ph;th=qh-ge;var Tf=rh*oh+sh*ph+th*ge;Tf=-Tf/(rh*rh+sh*sh+th*th);var Fg=void 0;if(0>Tf)l.x=oh,l.y=ph,l.z=ge,Fg=1;else if(1Be||hgDc||ig(Q*zc+Ma*Cc+Ia*sc)*Wc){var kf=void 0,Bf=void 0,Hg=void 0,Ig=void 0,Jg=void 0,Kg=void 0,jg=void 0,kg=void 0,lg=void 0,Ue=void 0,mg=void 0,fh=void 0,Lg=void 0,Mg=void 0,Cf=void 0,ng=void 0, +og=void 0,gh=void 0;kf=Ba.x;Bf=Ba.y;Hg=Ba.z;Ig=Ta.x;Jg=Ta.y;Kg=Ta.z;jg=Ga.x;kg=Ga.y;lg=Ga.z;Ue=Ig-kf;mg=Jg-Bf;fh=Kg-Hg;Lg=jg-Ig;Mg=kg-Jg;Cf=lg-Kg;ng=kf-jg;og=Bf-kg;gh=Hg-lg;var re=void 0,se=void 0,ae=void 0;re=mg*Cf-fh*Mg;se=fh*Lg-Ue*Cf;ae=Ue*Mg-mg*Lg;var he=void 0,ie=void 0,Md=void 0,ji=void 0,Dj=void 0,Ej=void 0,Fj=void 0,dj=void 0,Qh=void 0;he=mg*ae-fh*se;ie=fh*re-Ue*ae;Md=Ue*se-mg*re;ji=Mg*ae-Cf*se;Dj=Cf*re-Lg*ae;Ej=Lg*se-Mg*re;Fj=og*ae-gh*se;dj=gh*re-ng*ae;Qh=ng*se-og*re;var Df=-1,Vf=void 0, +Ng=void 0,Ke=void 0,Wf=0;Ke=Ng=Vf=0;if(0>kf*he+Bf*ie+Hg*Md){var Ve=void 0,We=void 0,Xf=void 0,lf=void 0,pg=void 0,uh=void 0;Ve=Ba.x;We=Ba.y;Xf=Ba.z;lf=Ta.x;pg=Ta.y;uh=Ta.z;var vh=void 0,wh=void 0,hh=void 0;vh=lf-Ve;wh=pg-We;hh=uh-Xf;var Ef=vh*Ve+wh*We+hh*Xf;Ef=-Ef/(vh*vh+wh*wh+hh*hh);var mf=void 0;if(0>Ef)l.x=Ve,l.y=We,l.z=Xf,mf=1;else if(1Ig*ji+Jg*Dj+Kg*Ej){var ej=void 0,fj=void 0,gj=void 0,ki=void 0,li=void 0,mi=void 0;ej=Ta.x;fj=Ta.y;gj=Ta.z;ki=Ga.x;li=Ga.y;mi=Ga.z;var ni=void 0,oi=void 0,pi=void 0;ni=ki-ej;oi=li-fj;pi=mi-gj;var Pg=ni*ej+oi*fj+pi*gj;Pg=-Pg/(ni*ni+oi*oi+pi*pi);var Rh=void 0;if(0>Pg)l.x=ej,l.y=fj,l.z=gj,Rh=1;else if(1Df|| +fkjg*Fj+kg*dj+lg*Qh){var ij=void 0,jj=void 0,kj=void 0,qi=void 0,ri=void 0,si=void 0;ij=Ba.x;jj=Ba.y;kj=Ba.z;qi=Ga.x;ri=Ga.y;si=Ga.z;var ti=void 0,ui=void 0,vi=void 0;ti=qi-ij;ui=ri-jj;vi=si-kj;var Qg=ti*ij+ui*jj+vi*kj;Qg=-Qg/(ti*ti+ui*ui+vi*vi);var xh=void 0;if(0>Qg)l.x=ij,l.y=jj,l.z=kj,xh=1;else if(1Df||gkDc||Jj(Eb*Lc+wb*zd+Mb*Rc)*Wc){var ih=void 0,yh=void 0,oj=void 0,Uh=void 0,Vh=void 0,Wh=void 0,xi=void 0,yi=void 0, +zi=void 0,Xh=void 0,Yh=void 0,Zh=void 0,zh=void 0,Ah=void 0,Bh=void 0,Ai=void 0,Bi=void 0,Ci=void 0;ih=Ta.x;yh=Ta.y;oj=Ta.z;Uh=sa.x;Vh=sa.y;Wh=sa.z;xi=Ga.x;yi=Ga.y;zi=Ga.z;Xh=Uh-ih;Yh=Vh-yh;Zh=Wh-oj;zh=xi-Uh;Ah=yi-Vh;Bh=zi-Wh;Ai=ih-xi;Bi=yh-yi;Ci=oj-zi;var Xe=void 0,Ye=void 0,Ze=void 0;Xe=Yh*Bh-Zh*Ah;Ye=Zh*zh-Xh*Bh;Ze=Xh*Ah-Yh*zh;var nf=void 0,of=void 0,pf=void 0,hk=void 0,ik=void 0,jk=void 0,kk=void 0,lk=void 0,mk=void 0;nf=Yh*Ze-Zh*Ye;of=Zh*Xe-Xh*Ze;pf=Xh*Ye-Yh*Xe;hk=Ah*Ze-Bh*Ye;ik=Bh*Xe-zh*Ze; +jk=zh*Ye-Ah*Xe;kk=Bi*Ze-Ci*Ye;lk=Ci*Xe-Ai*Ze;mk=Ai*Ye-Bi*Xe;var Ch=-1,$h=void 0,ai=void 0,Ff=void 0,jh=0;Ff=ai=$h=0;if(0>ih*nf+yh*of+oj*pf){var Rg=void 0,Sg=void 0,bi=void 0,Di=void 0,Ei=void 0,Fi=void 0;Rg=Ta.x;Sg=Ta.y;bi=Ta.z;Di=sa.x;Ei=sa.y;Fi=sa.z;var Gi=void 0,Hi=void 0,Ii=void 0;Gi=Di-Rg;Hi=Ei-Sg;Ii=Fi-bi;var Tg=Gi*Rg+Hi*Sg+Ii*bi;Tg=-Tg/(Gi*Gi+Hi*Hi+Ii*Ii);var ci=void 0;if(0>Tg)l.x=Rg,l.y=Sg,l.z=bi,ci=1;else if(1Uh*hk+Vh*ik+Wh*jk){var qj=void 0,rj=void 0,sj=void 0,Ji=void 0,Ki=void 0,Li=void 0;qj=sa.x;rj=sa.y;sj=sa.z;Ji=Ga.x;Ki=Ga.y;Li=Ga.z;var Mi=void 0,Ni=void 0,Oi=void 0;Mi=Ji-qj;Ni=Ki-rj;Oi=Li-sj;var Ug=Mi*qj+Ni*rj+Oi*sj;Ug=-Ug/(Mi*Mi+Ni*Ni+Oi*Oi);var ei=void 0;if(0>Ug)l.x=qj,l.y=rj,l.z=sj,ei=1;else if(1Ch||nkxi*kk+yi*lk+zi*mk){var uj=void 0,vj=void 0,wj=void 0,Pi=void 0,Qi=void 0,Ri=void 0;uj=Ta.x;vj=Ta.y;wj=Ta.z;Pi=Ga.x;Qi=Ga.y;Ri=Ga.z;var Si=void 0,Ti=void 0,Ui=void 0;Si=Pi-uj;Ti=Qi-vj;Ui=Ri-wj;var Vg=Si*uj+Ti*vj+Ui*wj;Vg=-Vg/(Si*Si+Ti*Ti+Ui*Ui);var Dh=void 0;if(0>Vg)l.x=uj,l.y=vj,l.z=wj,Dh=1;else if(1Ch||okDc||Ojl.x*l.x+l.y*l.y+l.z*l.z){if(!f)return this.distance=0;switch(this.h){case 1:this.Xa();break;case 2:this.Wa();break;case 3:this.Ya()}if(4==this.h){var Wi=this.Sb(h,k,g);if(0!=Wi)return this.distance=0,Wi;this.distance=-this.depth;return 0}this.distance=0;return 1}this.Pb(B);m.x=l.x;m.y=l.y;m.z=l.z;m.x=-m.x;m.y=-m.y;m.z=-m.z;this.V(!1);this.W(!1);var Yf=this.i[this.h],Pj=this.mb[this.h];Yf.x=Pj.x;Yf.y=Pj.y;Yf.z=Pj.z;var Le=this.sb[this.h];Yf.x-=Le.x;Yf.y-=Le.y;Yf.z-=Le.z;if(1E-8>m.x*m.x+ +m.y*m.y+m.z*m.z)throw Error("!?");var hi=h[this.h];if(1E-8>hi.x*m.x+hi.y*m.y+hi.z*m.z-(l.x*m.x+l.y*m.y+l.z*m.z))return this.Ib(),this.distance=Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z),null!=c&&null!=c.og&&this.Gb(c.og),0;this.h++;++v}return 2};yc.prototype.ob=function(a,b,e,d,c,f,h){this.Ma=a;this.Sa=b;this.I=e;this.M=d;var k=this.i,g=this.aa,l=this.C;var m=d.F-e.F;var n=d.G-e.G;var q=d.H-e.H;l.x=m;l.y=n;l.z=q;1E-6>l.x*l.x+l.y*l.y+l.z*l.z&&l.Ia(1,0,0);this.h=0;if(null!=this.Ma)this.V(!0);else{var p=this.mb[this.h]; +p.x=this.I.F;p.y=this.I.G;p.z=this.I.H}this.W(!0);var r=this.i[this.h],t=this.mb[this.h];r.x=t.x;r.y=t.y;r.z=t.z;var x=this.sb[this.h];r.x-=x.x;r.y-=x.y;r.z-=x.z;this.h=1;var v=0,B=0,H=this.Fb,C=this.tb;H.$();C.x=f.x;C.y=f.y;C.z=f.z;C.x-=c.x;C.y-=c.y;for(C.z-=c.z;40>v;){var N=0;switch(this.h){case 1:var y=k[0];g.x=y.x;g.y=y.y;g.z=y.z;N=1;break;case 2:var A=void 0,E=void 0,L=void 0,G=void 0,P=void 0,K=void 0,pa=k[0];A=pa.x;E=pa.y;L=pa.z;var M=k[1];G=M.x;P=M.y;K=M.z;var Sa=void 0,Pa=void 0,Ca=void 0; +Sa=G-A;Pa=P-E;Ca=K-L;var Ra=Sa*A+Pa*E+Ca*L;Ra=-Ra/(Sa*Sa+Pa*Pa+Ca*Ca);if(0>Ra)g.x=A,g.y=E,g.z=L,N=1;else if(1ta*Qa+Va*Ka+D*V){var hb=void 0,fb=void 0,gb=void 0,pb=void 0,ab=void 0, +$a=void 0;hb=O.x;fb=O.y;gb=O.z;pb=ma.x;ab=ma.y;$a=ma.z;var ua=void 0,Ya=void 0,Fb=void 0;ua=pb-hb;Ya=ab-fb;Fb=$a-gb;var Xa=ua*hb+Ya*fb+Fb*gb;Xa=-Xa/(ua*ua+Ya*Ya+Fb*Fb);var Bb=void 0;if(0>Xa)g.x=hb,g.y=fb,g.z=gb,Bb=1;else if(1Aa*ob+aa*Za+Ua*W){var bb=void 0,ib=void 0,rb=void 0,db=void 0,Db=void 0,jb=void 0;bb=ma.x; +ib=ma.y;rb=ma.z;db=Y.x;Db=Y.y;jb=Y.z;var nb=void 0,cb=void 0,Jb=void 0;nb=db-bb;cb=Db-ib;Jb=jb-rb;var Kb=nb*bb+cb*ib+Jb*rb;Kb=-Kb/(nb*nb+cb*cb+Jb*Jb);var F=void 0;if(0>Kb)g.x=bb,g.y=ib,g.z=rb,F=1;else if(1ca||vbxa*ha+Ja*I+S*na){var eb=void 0,Lb=void 0,mb=void 0,zb=void 0,u=void 0,T=void 0;eb= +O.x;Lb=O.y;mb=O.z;zb=Y.x;u=Y.y;T=Y.z;var R=void 0,va=void 0,Na=void 0;R=zb-eb;va=u-Lb;Na=T-mb;var ya=R*eb+va*Lb+Na*mb;ya=-ya/(R*R+va*va+Na*Na);var Oa=void 0;if(0>ya)g.x=eb,g.y=Lb,g.z=mb,Oa=1;else if(1ca||Ba(Eb*ed+wb*Bc+Mb*Kc)*od){var Tc=void 0,Pd=void 0,je=void 0,De=void 0,Kd=void 0,Xc=void 0,be=void 0,ue=void 0,Ee=void 0,ve=void 0,qd=void 0,ce=void 0,we=void 0,ke=void 0,le=void 0,Fc=void 0,gd=void 0,hd=void 0;Tc=Ga.x;Pd=Ga.y;je=Ga.z;De=Q.x;Kd=Q.y;Xc=Q.z;be=Ma.x;ue=Ma.y;Ee=Ma.z;ve=De-Tc;qd=Kd-Pd;ce=Xc-je;we=be-De;ke=ue-Kd;le=Ee-Xc;Fc=Tc-be;gd=Pd-ue;hd=je-Ee;var Ad=void 0,Yc=void 0,Mc=void 0;Ad=qd*le-ce*ke;Yc=ce*we-ve*le;Mc=ve*ke-qd*we;var ug=void 0, +vg=void 0,lh=void 0,Me=void 0,uf=void 0,vf=void 0,Fe=void 0,Ic=void 0,Jc=void 0;ug=qd*Mc-ce*Yc;vg=ce*Ad-ve*Mc;lh=ve*Yc-qd*Ad;Me=ke*Mc-le*Yc;uf=le*Ad-we*Mc;vf=we*Yc-ke*Ad;Fe=gd*Mc-hd*Yc;Ic=hd*Ad-Fc*Mc;Jc=Fc*Yc-gd*Ad;var oc=-1,xe=void 0,me=void 0,Qd=void 0,Rd=0;Qd=me=xe=0;if(0>Tc*ug+Pd*vg+je*lh){var ye=void 0,dg=void 0,Uc=void 0,Vc=void 0,Nc=void 0,wf=void 0;ye=Ga.x;dg=Ga.y;Uc=Ga.z;Vc=Q.x;Nc=Q.y;wf=Q.z;var Vd=void 0,Ge=void 0,eg=void 0;Vd=Vc-ye;Ge=Nc-dg;eg=wf-Uc;var Ne=Vd*ye+Ge*dg+eg*Uc;Ne=-Ne/(Vd* +Vd+Ge*Ge+eg*eg);var bf=void 0;if(0>Ne)g.x=ye,g.y=dg,g.z=Uc,bf=1;else if(1De*Me+Kd*uf+Xc*vf){var cf=void 0,df=void 0,Kf=void 0,Lf=void 0,yf=void 0,zf=void 0;cf=Q.x;df=Q.y;Kf=Q.z;Lf=Ma.x;yf=Ma.y;zf=Ma.z;var ze=void 0,ef=void 0,Mf=void 0;ze=Lf-cf;ef=yf-df;Mf=zf-Kf;var ff=ze*cf+ef*df+Mf*Kf;ff=-ff/(ze*ze+ef*ef+Mf*Mf); +var Zg=void 0;if(0>ff)g.x=cf,g.y=df,g.z=Kf,Zg=1;else if(1oc||wcbe*Fe+ue*Ic+Ee*Jc){var Cd=void 0,Oe=void 0,Pe=void 0,Qe=void 0,Wd=void 0,Xd=void 0;Cd=Ga.x;Oe=Ga.y;Pe=Ga.z;Qe=Ma.x;Wd=Ma.y;Xd=Ma.z;var Dd=void 0,de=void 0,He=void 0;Dd=Qe-Cd;de=Wd-Oe;He=Xd-Pe;var ne=Dd*Cd+de*Oe+He*Pe;ne=-ne/(Dd* +Dd+de*de+He*He);var Hd=void 0;if(0>ne)g.x=Cd,g.y=Oe,g.z=Pe,Hd=1;else if(1oc||oe(Eb*zc+wb*Cc+Mb*sc)*od){var ud=void 0,rd=void 0,sd=void 0,md=void 0,Zc=void 0,$c=void 0,Gc=void 0,xc=void 0,Hc=void 0,Ac=void 0,id=void 0,Oc=void 0,ad=void 0,Ie=void 0,Nf=void 0,Ed=void 0,Td=void 0,td=void 0;ud=Ga.x;rd=Ga.y;sd=Ga.z;md=Ma.x;Zc=Ma.y;$c=Ma.z;Gc=Ia.x;xc=Ia.y;Hc=Ia.z;Ac=md-ud;id=Zc-rd;Oc=$c-sd;ad=Gc-md;Ie=xc-Zc;Nf=Hc-$c;Ed=ud-Gc;Td=rd-xc;td=sd-Hc;var Ld=void 0,vd=void 0,wd=void 0;Ld=id*Nf-Oc*Ie;vd=Oc*ad-Ac* +Nf;wd=Ac*Ie-id*ad;var Of=void 0,Lh=void 0,Mh=void 0,Nh=void 0,mh=void 0,$g=void 0,Be=void 0,Je=void 0,Ce=void 0;Of=id*wd-Oc*vd;Lh=Oc*Ld-Ac*wd;Mh=Ac*vd-id*Ld;Nh=Ie*wd-Nf*vd;mh=Nf*Ld-ad*wd;$g=ad*vd-Ie*Ld;Be=Td*wd-td*vd;Je=td*Ld-Ed*wd;Ce=Ed*vd-Td*Ld;var Id=-1,fe=void 0,pe=void 0,qe=void 0,Re=0;qe=pe=fe=0;if(0>ud*Of+rd*Lh+sd*Mh){var Ud=void 0,Se=void 0,Pf=void 0,Qf=void 0,nh=void 0,ah=void 0;Ud=Ga.x;Se=Ga.y;Pf=Ga.z;Qf=Ma.x;nh=Ma.y;ah=Ma.z;var gf=void 0,hf=void 0,fg=void 0;gf=Qf-Ud;hf=nh-Se;fg=ah-Pf;var wg= +gf*Ud+hf*Se+fg*Pf;wg=-wg/(gf*gf+hf*hf+fg*fg);var bh=void 0;if(0>wg)g.x=Ud,g.y=Se,g.z=Pf,bh=1;else if(1md*Nh+Zc*mh+$c*$g){var zg=void 0,Ag=void 0,Bg=void 0,Cg=void 0,Dg=void 0,gg=void 0;zg=Ma.x;Ag=Ma.y;Bg=Ma.z;Cg=Ia.x;Dg=Ia.y;gg=Ia.z;var Te=void 0,Rf=void 0,Eg=void 0;Te=Cg-zg;Rf=Dg-Ag;Eg=gg-Bg;var Sf=Te*zg+Rf*Ag+ +Eg*Bg;Sf=-Sf/(Te*Te+Rf*Rf+Eg*Eg);var dh=void 0;if(0>Sf)g.x=zg,g.y=Ag,g.z=Bg,dh=1;else if(1Id||geGc*Be+xc*Je+Hc*Ce){var Zd=void 0,$d=void 0,qh=void 0,rh=void 0,sh=void 0,th=void 0;Zd=Ga.x;$d=Ga.y;qh=Ga.z;rh=Ia.x;sh=Ia.y;th=Ia.z;var Tf=void 0,Fg=void 0,Oh=void 0;Tf=rh-Zd;Fg=sh-$d;Oh=th-qh;var eh= +Tf*Zd+Fg*$d+Oh*qh;eh=-eh/(Tf*Tf+Fg*Fg+Oh*Oh);var Ph=void 0;if(0>eh)g.x=Zd,g.y=$d,g.z=qh,Ph=1;else if(1Id||Gghc||Hg(Eb*Lc+wb*zd+Mb*Rc)*od){var Ig=void 0,Jg=void 0,Kg=void 0,jg=void 0,kg=void 0,lg=void 0,Ue=void 0,mg=void 0,fh=void 0,Lg=void 0,Mg=void 0,Cf=void 0,ng=void 0,og=void 0,gh=void 0,re=void 0,se=void 0,ae=void 0;Ig=Ga.x;Jg=Ga.y;Kg=Ga.z;jg=Q.x;kg=Q.y;lg=Q.z;Ue=Ia.x;mg=Ia.y;fh=Ia.z;Lg=jg-Ig;Mg=kg-Jg;Cf=lg-Kg;ng=Ue-jg;og=mg-kg;gh=fh-lg;re=Ig-Ue;se=Jg-mg;ae= +Kg-fh;var he=void 0,ie=void 0,Md=void 0;he=Mg*gh-Cf*og;ie=Cf*ng-Lg*gh;Md=Lg*og-Mg*ng;var ji=void 0,Dj=void 0,Ej=void 0,Fj=void 0,dj=void 0,Qh=void 0,Df=void 0,Vf=void 0,Ng=void 0;ji=Mg*Md-Cf*ie;Dj=Cf*he-Lg*Md;Ej=Lg*ie-Mg*he;Fj=og*Md-gh*ie;dj=gh*he-ng*Md;Qh=ng*ie-og*he;Df=se*Md-ae*ie;Vf=ae*he-re*Md;Ng=re*ie-se*he;var Ke=-1,Wf=void 0,Ve=void 0,We=void 0,Xf=0;We=Ve=Wf=0;if(0>Ig*ji+Jg*Dj+Kg*Ej){var lf=void 0,pg=void 0,uh=void 0,vh=void 0,wh=void 0,hh=void 0;lf=Ga.x;pg=Ga.y;uh=Ga.z;vh=Q.x;wh=Q.y;hh=Q.z; +var Ef=void 0,mf=void 0,qg=void 0;Ef=vh-lf;mf=wh-pg;qg=hh-uh;var Og=Ef*lf+mf*pg+qg*uh;Og=-Og/(Ef*Ef+mf*mf+qg*qg);var Gj=void 0;if(0>Og)g.x=lf,g.y=pg,g.z=uh,Gj=1;else if(1jg*Fj+kg*dj+lg*Qh){var ki=void 0,li=void 0,mi=void 0,ni=void 0,oi=void 0,pi=void 0;ki=Q.x;li=Q.y;mi=Q.z;ni=Ia.x;oi=Ia.y;pi=Ia.z;var Pg=void 0, +Rh=void 0,hj=void 0;Pg=ni-ki;Rh=oi-li;hj=pi-mi;var Sh=Pg*ki+Rh*li+hj*mi;Sh=-Sh/(Pg*Pg+Rh*Rh+hj*hj);var Hj=void 0;if(0>Sh)g.x=ki,g.y=li,g.z=mi,Hj=1;else if(1Ke||kjUe*Df+mg*Vf+fh*Ng){var qi=void 0,ri=void 0,si=void 0,ti=void 0,ui=void 0,vi=void 0;qi=Ga.x;ri=Ga.y;si=Ga.z;ti=Ia.x;ui=Ia.y;vi=Ia.z; +var Qg=void 0,xh=void 0,lj=void 0;Qg=ti-qi;xh=ui-ri;lj=vi-si;var Th=Qg*qi+xh*ri+lj*si;Th=-Th/(Qg*Qg+xh*xh+lj*lj);var mj=void 0;if(0>Th)g.x=qi,g.y=ri,g.z=si,mj=1;else if(1Ke||njhc||oj(Ib*Wc+Tb*Dc+Rb*Ec)*od){var Uh=void 0,Vh=void 0,Wh=void 0,xi=void 0,yi=void 0,zi=void 0,Xh=void 0,Yh=void 0,Zh=void 0,zh=void 0,Ah=void 0,Bh=void 0,Ai=void 0,Bi=void 0,Ci=void 0,Xe=void 0,Ye=void 0,Ze=void 0;Uh=Q.x;Vh=Q.y;Wh=Q.z;xi=Ma.x;yi=Ma.y;zi=Ma.z;Xh=Ia.x;Yh=Ia.y;Zh=Ia.z;zh=xi-Uh; +Ah=yi-Vh;Bh=zi-Wh;Ai=Xh-xi;Bi=Yh-yi;Ci=Zh-zi;Xe=Uh-Xh;Ye=Vh-Yh;Ze=Wh-Zh;var nf=void 0,of=void 0,pf=void 0;nf=Ah*Ci-Bh*Bi;of=Bh*Ai-zh*Ci;pf=zh*Bi-Ah*Ai;var hk=void 0,ik=void 0,jk=void 0,kk=void 0,lk=void 0,mk=void 0,Ch=void 0,$h=void 0,ai=void 0;hk=Ah*pf-Bh*of;ik=Bh*nf-zh*pf;jk=zh*of-Ah*nf;kk=Bi*pf-Ci*of;lk=Ci*nf-Ai*pf;mk=Ai*of-Bi*nf;Ch=Ye*pf-Ze*of;$h=Ze*nf-Xe*pf;ai=Xe*of-Ye*nf;var Ff=-1,jh=void 0,Rg=void 0,Sg=void 0,bi=0;Sg=Rg=jh=0;if(0>Uh*hk+Vh*ik+Wh*jk){var Di=void 0,Ei=void 0,Fi=void 0,Gi=void 0, +Hi=void 0,Ii=void 0;Di=Q.x;Ei=Q.y;Fi=Q.z;Gi=Ma.x;Hi=Ma.y;Ii=Ma.z;var Tg=void 0,ci=void 0,pj=void 0;Tg=Gi-Di;ci=Hi-Ei;pj=Ii-Fi;var di=Tg*Di+ci*Ei+pj*Fi;di=-di/(Tg*Tg+ci*ci+pj*pj);var Kj=void 0;if(0>di)g.x=Di,g.y=Ei,g.z=Fi,Kj=1;else if(1xi*kk+yi*lk+zi*mk){var Ji=void 0,Ki=void 0,Li=void 0,Mi=void 0,Ni=void 0,Oi= +void 0;Ji=Ma.x;Ki=Ma.y;Li=Ma.z;Mi=Ia.x;Ni=Ia.y;Oi=Ia.z;var Ug=void 0,ei=void 0,tj=void 0;Ug=Mi-Ji;ei=Ni-Ki;tj=Oi-Li;var fi=Ug*Ji+ei*Ki+tj*Li;fi=-fi/(Ug*Ug+ei*ei+tj*tj);var Lj=void 0;if(0>fi)g.x=Ji,g.y=Ki,g.z=Li,Lj=1;else if(1Ff||wjXh*Ch+Yh*$h+Zh*ai){var Pi=void 0,Qi=void 0,Ri=void 0,Si=void 0, +Ti=void 0,Ui=void 0;Pi=Q.x;Qi=Q.y;Ri=Q.z;Si=Ia.x;Ti=Ia.y;Ui=Ia.z;var Vg=void 0,Dh=void 0,xj=void 0;Vg=Si-Pi;Dh=Ti-Qi;xj=Ui-Ri;var gi=Vg*Pi+Dh*Qi+xj*Ri;gi=-gi/(Vg*Vg+Dh*Dh+xj*xj);var yj=void 0;if(0>gi)g.x=Pi,g.y=Qi,g.z=Ri,yj=1;else if(1Ff||zjhc||Pjg.x*g.x+g.y*g.y+g.z*g.z){if(0==B||4==this.h){h.fraction=B;break}this.Ib();h.fraction=B;var Le=h.normal;Le.x=l.x;Le.y=l.y;Le.z=l.z;var hi=Math.sqrt(Le.x*Le.x+Le.y*Le.y+Le.z* +Le.z);0 +l.x*l.x+l.y*l.y+l.z*l.z)throw Error("!?");var Qk=k[this.h],jl=Qk.x*l.x+Qk.y*l.y+Qk.z*l.z;if(0>jl){if(0<=C.x*l.x+C.y*l.y+C.z*l.z)break;var pk=jl/(C.x*l.x+C.y*l.y+C.z*l.z);B+=pk;if(1<=B)break;H.x+=C.x*pk;H.y+=C.y*pk;H.z+=C.z*pk;for(var kl=0,yl=this.h+1;klnl*nl+ol*ol+pl*pl){ll=!0;break}}ll||this.h++;++v}return!1}; +yc.prototype.Ib=function(){switch(this.h){case 1:var a=this.closestPoint1,b=this.mb[0];a.x=b.x;a.y=b.y;a.z=b.z;var e=this.closestPoint2,d=this.sb[0];e.x=d.x;e.y=d.y;e.z=d.z;break;case 2:var c=this.aa;var f=c.x;var h=c.y;var k=c.z;var g=this.i[0];var l=g.x;var m=g.y;var n=g.z;var q=this.mb[0];var p=q.x;var r=q.y;var t=q.z;var x=this.sb[0];var v=x.x;var B=x.y;var H=x.z;var C=this.i[1];var N=C.x;var y=C.y;var A=C.z;var E=this.mb[1];var L=E.x;var G=E.y;var P=E.z;var K=this.sb[1];var pa=K.x;var M=K.y; +var Sa=K.z;var Pa=N-l;var Ca=y-m;var Ra=A-n;var wa=Pa*Pa+Ca*Ca+Ra*Ra;0!=wa&&(wa=1/wa);var La=((f-l)*Pa+(h-m)*Ca+(k-n)*Ra)*wa;var Ea=L-p;var O=G-r;var ma=P-t;var Y=p+Ea*La;var ta=r+O*La;var Va=t+ma*La;Ea=pa-v;O=M-B;ma=Sa-H;var D=v+Ea*La;var Aa=B+O*La;var aa=H+ma*La;var Ua=this.closestPoint1;Ua.x=Y;Ua.y=ta;Ua.z=Va;var xa=this.closestPoint2;xa.x=D;xa.y=Aa;xa.z=aa;break;case 3:var Ja=this.aa;var S=Ja.x;var la=Ja.y;var qa=Ja.z;var Da=this.i[0];var X=Da.x;var fa=Da.y;var w=Da.z;var ja=this.mb[0];var ea= +ja.x;var U=ja.y;var ba=ja.z;var Fa=this.sb[0];var ka=Fa.x;var Qa=Fa.y;var Ka=Fa.z;var V=this.i[1];var ob=V.x;var Za=V.y;var W=V.z;var ha=this.mb[1];var I=ha.x;var na=ha.y;var ca=ha.z;var da=this.sb[1];var Z=da.x;var oa=da.y;var xb=da.z;var hb=this.i[2];var fb=hb.x;var gb=hb.y;var pb=hb.z;var ab=this.mb[2];var $a=ab.x;var ua=ab.y;var Ya=ab.z;var Fb=this.sb[2];var Xa=Fb.x;var Bb=Fb.y;var Wa=Fb.z;var Cb=ob-X;var qb=Za-fa;var bb=W-w;var ib=fb-X;var rb=gb-fa;var db=pb-w;var Db=S-X;var jb=la-fa;var nb= +qa-w;var cb=Cb*Cb+qb*qb+bb*bb,Jb=Cb*ib+qb*rb+bb*db,Kb=ib*ib+rb*rb+db*db,F=Cb*Db+qb*jb+bb*nb,ub=ib*Db+rb*jb+db*nb,lb=cb*Kb-Jb*Jb;0!=lb&&(lb=1/lb);var yb=(F*Kb-ub*Jb)*lb,vb=(-F*Jb+ub*cb)*lb;var eb=I-ea;var Lb=na-U;var mb=ca-ba;var zb=ea+eb*yb;var u=U+Lb*yb;var T=ba+mb*yb;eb=$a-ea;Lb=ua-U;mb=Ya-ba;zb+=eb*vb;u+=Lb*vb;T+=mb*vb;eb=Z-ka;Lb=oa-Qa;mb=xb-Ka;var R=ka+eb*yb;var va=Qa+Lb*yb;var Na=Ka+mb*yb;eb=Xa-ka;Lb=Bb-Qa;mb=Wa-Ka;R+=eb*vb;va+=Lb*vb;Na+=mb*vb;var ya=this.closestPoint1;ya.x=zb;ya.y=u;ya.z=T; +var Oa=this.closestPoint2;Oa.x=R;Oa.y=va;Oa.z=Na;break;default:throw Error("!?");}};yc.prototype.Va=function(a){var b=this.C;a=a.vi;b.x=a.x;b.y=a.y;b.z=a.z};yc.prototype.Gb=function(a){a=a.vi;var b=this.aa;a.x=b.x;a.y=b.y;a.z=b.z;a.x=-a.x;a.y=-a.y;a.z=-a.z};yc.prototype.Pb=function(a){this.h=a;this.h=(this.h&5)+(this.h>>1&5);this.h=(this.h&3)+(this.h>>2&3);switch(a){case 2:a=this.i[0];var b=this.i[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[1];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[1]; +a.x=b.x;a.y=b.y;a.z=b.z;break;case 4:a=this.i[0];b=this.i[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 5:a=this.i[1];b=this.i[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[1];b=this.mb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[1];b=this.sb[2];a.x=b.x;a.y=b.y;a.z=b.z;break;case 6:a=this.i[0];b=this.i[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[2];a.x=b.x;a.y=b.y;a.z= +b.z;break;case 8:a=this.i[0];b=this.i[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 9:a=this.i[1];b=this.i[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[1];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[1];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 10:a=this.i[0];b=this.i[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 11:a= +this.i[2];b=this.i[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[2];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[2];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 12:a=this.i[0];b=this.i[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[0];b=this.mb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[0];b=this.sb[2];a.x=b.x;a.y=b.y;a.z=b.z;a=this.i[1];b=this.i[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.mb[1];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[1];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 13:a=this.i[1];b=this.i[3];a.x=b.x; +a.y=b.y;a.z=b.z;a=this.mb[1];b=this.mb[3];a.x=b.x;a.y=b.y;a.z=b.z;a=this.sb[1];b=this.sb[3];a.x=b.x;a.y=b.y;a.z=b.z;break;case 14:a=this.i[0],b=this.i[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.mb[0],b=this.mb[3],a.x=b.x,a.y=b.y,a.z=b.z,a=this.sb[0],b=this.sb[3],a.x=b.x,a.y=b.y,a.z=b.z}};yc.prototype.V=function(a){var b=this.C;var e=b.x;var d=b.y;b=b.z;var c=this.I.A*e+this.I.o*d+this.I.u*b;var f=this.I.j*e+this.I.v*d+this.I.l*b;var h=this.I.m*e+this.I.s*d+this.I.B*b;var k=this.C;k.x=c;k.y=f;k.z=h;this.Ma.ud(this.C, +this.mb[this.h]);a&&(a=this.C,h=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z),0a;){var b=this.C,e=this.qa[a++];b.x=e.x;b.y=e.y;b.z=e.z;this.V(!1);this.W(!1);b=this.i[this.h];e=this.mb[this.h];b.x=e.x;b.y=e.y;b.z=e.z;e=this.sb[this.h];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.h++;this.Wa();if(4==this.h)break;this.h--;b=this.C;b.x=-b.x;b.y=-b.y;b.z=-b.z;this.V(!1);this.W(!1);b=this.i[this.h];e=this.mb[this.h];b.x=e.x;b.y=e.y;b.z=e.z;e=this.sb[this.h];b.x-=e.x;b.y-=e.y;b.z-=e.z;this.h++;this.Wa();if(4== +this.h)break;this.h--}};yc.prototype.Wa=function(){var a=this.C;var b=a.x;var e=a.y;a=a.z;var d=this.i[0];var c=d.x;var f=d.y;d=d.z;var h=this.i[1];var k=h.x;var g=h.y;h=h.z;c-=k;f-=g;d-=h;for(g=0;3>g;){h=this.qa[g++];k=h.x;var l=h.y;var m=h.z;h=f*m-d*l;m=d*k-c*m;k=c*l-f*k;l=this.C;l.x=h;l.y=m;l.z=k;this.V(!1);this.W(!1);h=this.i[this.h];k=this.mb[this.h];h.x=k.x;h.y=k.y;h.z=k.z;k=this.sb[this.h];h.x-=k.x;h.y-=k.y;h.z-=k.z;this.h++;this.Ya();if(4==this.h)break;this.h--;h=this.C;h.x=-h.x;h.y=-h.y; +h.z=-h.z;this.V(!1);this.W(!1);h=this.i[this.h];k=this.mb[this.h];h.x=k.x;h.y=k.y;h.z=k.z;k=this.sb[this.h];h.x-=k.x;h.y-=k.y;h.z-=k.z;this.h++;this.Ya();if(4==this.h)break;this.h--}c=this.C;c.x=b;c.y=e;c.z=a};yc.prototype.Ya=function(){var a=this.C;var b=a.x;var e=a.y;for(a=a.z;;){var d=this.i[0];var c=d.x;var f=d.y;d=d.z;var h=this.i[1];var k=h.x;var g=h.y;var l=h.z;var m=this.i[2];var n=m.x;h=m.y;m=m.z;k-=c;g-=f;l-=d;c=n-c;f=h-f;h=m-d;d=g*h-l*f;h=l*c-k*h;f=k*f-g*c;k=this.C;k.x=d;k.y=h;k.z=f;this.V(!1); +this.W(!1);f=this.i[this.h];d=this.mb[this.h];f.x=d.x;f.y=d.y;f.z=d.z;d=this.sb[this.h];f.x-=d.x;f.y-=d.y;f.z-=d.z;this.h++;if(this.Jb())break;this.h--;f=this.C;f.x=-f.x;f.y=-f.y;f.z=-f.z;this.V(!1);this.W(!1);f=this.i[this.h];d=this.mb[this.h];f.x=d.x;f.y=d.y;f.z=d.z;d=this.sb[this.h];f.x-=d.x;f.y-=d.y;f.z-=d.z;this.h++;if(this.Jb())break;this.h--;break}f=this.C;f.x=b;f.y=e;f.z=a};yc.prototype.Jb=function(){var a=this.i[2].x-this.i[0].x,b=this.i[2].y-this.i[0].y,e=this.i[2].z-this.i[0].z,d=this.i[3].x- +this.i[0].x,c=this.i[3].y-this.i[0].y,f=this.i[3].z-this.i[0].z;a=(this.i[1].x-this.i[0].x)*(b*f-e*c)-(this.i[1].y-this.i[0].y)*(a*f-e*d)+(this.i[1].z-this.i[0].z)*(a*c-b*d);return 1E-12a};yc.prototype.Sb=function(a,b,e){for(var d=this.Y;0A;){for(var E=this.Y.C,L=Infinity,G=null;null!=E;)E.bhC.x*ma.x+C.y*ma.y+C.z*ma.z-(Ea.x*O.x+Ea.y*O.y+Ea.z*O.z)||39==A){var Y=this.aa,ta=this.C;Y.x=ta.x;Y.y=ta.y;Y.z=ta.z;var Va=this.C,D=Ra.kd,Aa=this.C,aa=(Va.x*D.x+Va.y*D.y+Va.z*D.z)/(Aa.x*Aa.x+Aa.y* +Aa.y+Aa.z*Aa.z);Y.x*=aa;Y.y*=aa;Y.z*=aa;var Ua=void 0,xa=void 0,Ja=void 0,S=this.aa;Ua=S.x;xa=S.y;Ja=S.z;var la=void 0,qa=void 0,Da=void 0,X=void 0,fa=void 0,w=void 0,ja=void 0,ea=void 0,U=void 0,ba=void 0,Fa=void 0,ka=void 0,Qa=void 0,Ka=void 0,V=void 0,ob=void 0,Za=void 0,W=void 0,ha=void 0,I=void 0,na=void 0,ca=void 0,da=void 0,Z=void 0,oa=void 0,xb=void 0,hb=void 0,fb=Ra.kd;la=fb.x;qa=fb.y;Da=fb.z;var gb=Ra.mb;X=gb.x;fa=gb.y;w=gb.z;var pb=Ra.sb;ja=pb.x;ea=pb.y;U=pb.z;var ab=wa.kd;ba=ab.x;Fa=ab.y; +ka=ab.z;var $a=wa.mb;Qa=$a.x;Ka=$a.y;V=$a.z;var ua=wa.sb;ob=ua.x;Za=ua.y;W=ua.z;var Ya=La.kd;ha=Ya.x;I=Ya.y;na=Ya.z;var Fb=La.mb;ca=Fb.x;da=Fb.y;Z=Fb.z;var Xa=La.sb;oa=Xa.x;xb=Xa.y;hb=Xa.z;var Bb=void 0,Wa=void 0,Cb=void 0,qb=void 0,bb=void 0,ib=void 0,rb=void 0,db=void 0,Db=void 0;Bb=ba-la;Wa=Fa-qa;Cb=ka-Da;qb=ha-la;bb=I-qa;ib=na-Da;rb=Ua-la;db=xa-qa;Db=Ja-Da;var jb=Bb*Bb+Wa*Wa+Cb*Cb,nb=Bb*qb+Wa*bb+Cb*ib,cb=qb*qb+bb*bb+ib*ib,Jb=Bb*rb+Wa*db+Cb*Db,Kb=qb*rb+bb*db+ib*Db,F=jb*cb-nb*nb;0!=F&&(F=1/F);var ub= +(Jb*cb-Kb*nb)*F,lb=(-Jb*nb+Kb*jb)*F,yb=void 0,vb=void 0,eb=void 0,Lb=void 0,mb=void 0,zb=void 0,u=void 0,T=void 0,R=void 0;yb=Qa-X;vb=Ka-fa;eb=V-w;Lb=X+yb*ub;mb=fa+vb*ub;zb=w+eb*ub;yb=ca-X;vb=da-fa;eb=Z-w;Lb+=yb*lb;mb+=vb*lb;zb+=eb*lb;yb=ob-ja;vb=Za-ea;eb=W-U;u=ja+yb*ub;T=ea+vb*ub;R=U+eb*ub;yb=oa-ja;vb=xb-ea;eb=hb-U;u+=yb*lb;T+=vb*lb;R+=eb*lb;var va=this.closestPoint1;va.x=Lb;va.y=mb;va.z=zb;var Na=this.closestPoint2;Na.x=u;Na.y=T;Na.z=R;var ya=this.aa;this.depth=Math.sqrt(ya.x*ya.x+ya.y*ya.y+ya.z* +ya.z);return Xg.SUCCEEDED}var Oa=this.Y,kb=Oa.M;null!=kb?(Oa.M=kb.U,kb.U=null):kb=new Aj;var sb=kb.Ia(C,N,y);if(!this.Y.qa(sb,P))return Xg.EPA_FAILED_TO_ADD_VERTEX;++A}return Xg.EPA_DID_NOT_CONVERGE};yc.prototype.Rb=function(a,b,e,d,c){return this.Oa(a,b,e,d,c,!0)};yc.prototype.Wb=function(a,b,e,d,c){return this.Oa(a,b,e,d,c,!1)};yc.prototype.nb=function(a,b,e,d,c,f,h){return this.ob(a,b,e,d,c,f,h)};yc.prototype.yd=function(a,b,e,d,c){var f=this.ac;f.F=e.x;f.G=e.y;f.H=e.z;var h=this.bc,k=this.Sc; +h.x=d.x;h.y=d.y;h.z=d.z;h.x-=e.x;h.y-=e.y;h.z-=e.z;k.$();return this.ob(null,a,f,b,h,k,c)};yc.h=function(){return yc.instance};Gh.h=function(a,b,e){var d=a.x;var c=a.y;a=a.z;var f=b.x;var h=b.y;b=b.z;var k=f-d;var g=h-c;var l=b-a;var m=-(k*d+g*c+l*a)/(k*k+g*g+l*l);if(0>m)return e.x=d,e.y=c,e.z=a,1;if(1c*(r*E-t*A)+f*(t*y-p*E)+h*(p*A-r*y)){L=a.x;G=a.y;P=a.z;pa=b.x;K=b.y;p=b.z;r=pa-L;t=K-G;var M=p-P;var Sa=-(r*L+t*G+M*P)/(r*r+t*t+M*M);0>Sa?(d.x=L,d.y=G,d.z=P,L=1):1k*(v*E-B*A)+g*(B*y-x*E)+l*(x*A-v*y)&&(k=b.x,g=b.y,b=b.z,l=e.x,x=e.y, +v=e.z,B=l-k,p=x-g,r=v-b,t=-(B*k+p*g+r*b)/(B*B+p*p+r*r),0>t?(d.x=k,d.y=g,d.z=b,b=1):1L||km*(C*E-N*A)+n*(N*y-H*E)+q*(H*A-C*y)&&(m=a.x,n=a.y,a=a.z,q=e.x,H=e.y,e=e.z,C=q-m,N=H-n,b=e-a,k=-(C*m+N*n+b*a)/(C*C+N*N+b*b),0>k?(d.x=m,d.y=n,d.z=a,e=1):1L||a(f*Pa+h*Ca+k*Ra)*Aa){var la=a.x;var qa=a.y;var Da=a.z;var X=b.x;var fa=b.y;var w=b.z;var ja=e.x;var ea=e.y;var U=e.z;var ba=X-la;var Fa=fa-qa;var ka=w-Da;var Qa=ja-X;var Ka=ea-fa;var V=U-w;var ob=la-ja;var Za=qa-ea;var W=Da-U;var ha=Fa*V-ka*Ka;var I=ka*Qa-ba*V;var na=ba*Ka-Fa*Qa;var ca=Fa*na-ka*I;var da= +ka*ha-ba*na;var Z=ba*I-Fa*ha;var oa=Ka*na-V*I;var xb=V*ha-Qa*na;var hb=Qa*I-Ka*ha;var fb=Za*na-W*I;var gb=W*ha-ob*na;var pb=ob*I-Za*ha;var ab=-1,$a,ua,Ya=0;var Fb=ua=$a=0;if(0>la*ca+qa*da+Da*Z){var Xa=a.x;var Bb=a.y;var Wa=a.z;var Cb=b.x;var qb=b.y;var bb=b.z;var ib=Cb-Xa;var rb=qb-Bb;var db=bb-Wa;var Db=ib*Xa+rb*Bb+db*Wa;Db=-Db/(ib*ib+rb*rb+db*db);if(0>Db){c.x=Xa;c.y=Bb;c.z=Wa;var jb=1}else if(1X*oa+fa*xb+w*hb){var Kb=b.x;var F=b.y;var ub=b.z;var lb=e.x;var yb=e.y;var vb=e.z;var eb=lb-Kb;var Lb=yb-F;var mb=vb-ub;var zb=eb*Kb+Lb*F+mb*ub;zb=-zb/(eb*eb+Lb*Lb+mb*mb);if(0>zb){c.x=Kb;c.y=F;c.z=ub;var u=1}else if(1ab||Naja*fb+ea*gb+U*pb){var ya=a.x;var Oa= +a.y;var kb=a.z;var sb=e.x;var Hb=e.y;var Ba=e.z;var Ta=sb-ya;var sa=Hb-Oa;var Ga=Ba-kb;var Q=Ta*ya+sa*Oa+Ga*kb;Q=-Q/(Ta*Ta+sa*sa+Ga*Ga);if(0>Q){c.x=ya;c.y=Oa;c.z=kb;var Ma=1}else if(1ab||Mb(f*wa+h*La+k*Ea)*Aa){var Wb=a.x;var mc=a.y;var Xb=a.z;var ic=e.x;var bc=e.y;var $b=e.z;var Zb=d.x;var Qb=d.y;var jc=d.z;var ac=ic-Wb;var ec=bc-mc;var Ub=$b-Xb;var kc=Zb-ic;var uc=Qb-bc;var fc=jc-$b;var dd=Wb-Zb;var Nb=mc-Qb;var nc=Xb-jc;var gc=ec*fc-Ub*uc;var Vb=Ub*kc-ac*fc;var lc=ac*uc-ec*kc;var ed=ec*lc-Ub*Vb;var Bc=Ub*gc-ac*lc;var Kc=ac*Vb-ec*gc; +var zc=uc*lc-fc*Vb;var Cc=fc*gc-kc*lc;var sc=kc*Vb-uc*gc;var Lc=Nb*lc-nc*Vb;var zd=nc*gc-dd*lc;var Rc=dd*Vb-Nb*gc;var Wc=-1,Dc,Ec,od=0;var hc=Ec=Dc=0;if(0>Wb*ed+mc*Bc+Xb*Kc){var fd=a.x;var Sc=a.y;var pd=a.z;var Gd=e.x;var Tc=e.y;var Pd=e.z;var je=Gd-fd;var De=Tc-Sc;var Kd=Pd-pd;var Xc=je*fd+De*Sc+Kd*pd;Xc=-Xc/(je*je+De*De+Kd*Kd);if(0>Xc){c.x=fd;c.y=Sc;c.z=pd;var be=1}else if(1ic*zc+bc*Cc+$b*sc){var qd=e.x;var ce=e.y;var we=e.z;var ke=d.x;var le=d.y;var Fc=d.z;var gd=ke-qd;var hd=le-ce;var Ad=Fc-we;var Yc=gd*qd+hd*ce+Ad*we;Yc=-Yc/(gd*gd+hd*hd+Ad*Ad);if(0>Yc){c.x=qd;c.y=ce;c.z=we;var Mc=1}else if(1Wc||MeZb*Lc+Qb*zd+jc*Rc){var uf=a.x;var vf= +a.y;var Fe=a.z;var Ic=d.x;var Jc=d.y;var oc=d.z;var xe=Ic-uf;var me=Jc-vf;var Qd=oc-Fe;var Rd=xe*uf+me*vf+Qd*Fe;Rd=-Rd/(xe*xe+me*me+Qd*Qd);if(0>Rd){c.x=uf;c.y=vf;c.z=Fe;var ye=1}else if(1Wc||Ncaa||eg(f*O+h*ma+k*Y)*Aa){var Ne=a.x;var bf=a.y;var xf=a.z;var If=b.x;var Jf=b.y;var cf=b.z;var df=d.x;var Kf=d.y;var Lf=d.z;var yf=If-Ne;var zf=Jf-bf;var ze=cf-xf;var ef=df-If;var Mf=Kf-Jf;var ff=Lf-cf;var Zg=Ne-df;var Kh=bf-Kf;var Bd=xf-Lf;var vc=zf*ff-ze*Mf;var wc=ze*ef-yf*ff;var Cd=yf*Mf-zf*ef;var Oe= +zf*Cd-ze*wc;var Pe=ze*vc-yf*Cd;var Qe=yf*wc-zf*vc;var Wd=Mf*Cd-ff*wc;var Xd=ff*vc-ef*Cd;var Dd=ef*wc-Mf*vc;var de=Kh*Cd-Bd*wc;var He=Bd*vc-Zg*Cd;var ne=Zg*wc-Kh*vc;var Hd=-1,ee,Yd,Ae=0;var oe=Yd=ee=0;if(0>Ne*Oe+bf*Pe+xf*Qe){var Af=a.x;var ld=a.y;var Sd=a.z;var ud=b.x;var rd=b.y;var sd=b.z;var md=ud-Af;var Zc=rd-ld;var $c=sd-Sd;var Gc=md*Af+Zc*ld+$c*Sd;Gc=-Gc/(md*md+Zc*Zc+$c*$c);if(0>Gc){c.x=Af;c.y=ld;c.z=Sd;var xc=1}else if(1If*Wd+Jf*Xd+cf*Dd){var Oc=b.x;var ad=b.y;var Ie=b.z;var Nf=d.x;var Ed=d.y;var Td=d.z;var td=Nf-Oc;var Ld=Ed-ad;var vd=Td-Ie;var wd=td*Oc+Ld*ad+vd*Ie;wd=-wd/(td*td+Ld*Ld+vd*vd);if(0>wd){c.x=Oc;c.y=ad;c.z=Ie;var Of=1}else if(1Hd||mhdf*de+Kf*He+Lf*ne){var $g=a.x;var Be=a.y;var Je=a.z;var Ce=d.x;var Id=d.y;var fe=d.z;var pe=Ce-$g;var qe=Id-Be;var Re=fe-Je;var Ud=pe*$g+qe*Be+Re*Je;Ud=-Ud/(pe*pe+qe*qe+Re*Re);if(0>Ud){c.x=$g;c.y=Be;c.z=Je;var Se=1}else if(1Hd||ahaa||wg(g*ta+l*Va+m*D)*Aa){var bh=b.x;var xg=b.y;var yg=b.z;var ch=e.x;var zg=e.y;var Ag=e.z;var Bg=d.x;var Cg=d.y;var Dg=d.z;var gg=ch-bh;var Te=zg-xg;var Rf=Ag-yg;var Eg=Bg-ch;var Sf=Cg-zg;var dh=Dg-Ag;var cj=bh-Bg;var oh=xg-Cg;var ph=yg-Dg;var ge=Te*dh-Rf* +Sf;var Zd=Rf*Eg-gg*dh;var $d=gg*Sf-Te*Eg;var qh=Te*$d-Rf*Zd;var rh=Rf*ge-gg*$d;var sh=gg*Zd-Te*ge;var th=Sf*$d-dh*Zd;var Tf=dh*ge-Eg*$d;var Fg=Eg*Zd-Sf*ge;var Oh=oh*$d-ph*Zd;var eh=ph*ge-cj*$d;var Ph=cj*Zd-oh*ge;var hg=-1,Uf,jf,Gg=0;var ig=jf=Uf=0;if(0>bh*qh+xg*rh+yg*sh){var kf=b.x;var Bf=b.y;var Hg=b.z;var Ig=e.x;var Jg=e.y;var Kg=e.z;var jg=Ig-kf;var kg=Jg-Bf;var lg=Kg-Hg;var Ue=jg*kf+kg*Bf+lg*Hg;Ue=-Ue/(jg*jg+kg*kg+lg*lg);if(0>Ue){c.x=kf;c.y=Bf;c.z=Hg;var mg=1}else if(1ch*th+zg*Tf+Ag*Fg){var Cf=e.x;var ng=e.y;var og=e.z;var gh=d.x;var re=d.y;var se=d.z;var ae=gh-Cf;var he=re-ng;var ie=se-og;var Md=ae*Cf+he*ng+ie*og;Md=-Md/(ae*ae+he*he+ie*ie);if(0>Md){c.x=Cf;c.y=ng;c.z=og;var ji=1}else if(1hg||djBg*Oh+Cg*eh+Dg*Ph){var Qh=b.x;var Df=b.y;var Vf=b.z;var Ng=d.x;var Ke=d.y;var Wf=d.z;var Ve=Ng-Qh;var We=Ke-Df;var Xf=Wf-Vf;var lf=Ve*Qh+We*Df+Xf*Vf;lf=-lf/(Ve*Ve+We*We+Xf*Xf);if(0>lf){c.x=Qh;c.y=Df;c.z=Vf;var pg=1}else if(1hg||hhaa||Oge?b>d?(b=Math.sqrt(b-e-d+1),a.x=.5*b,b=.5/b,a.y=(this.e01+this.e10)*b, +a.z=(this.e02+this.e20)*b,a.w=(this.e21-this.e12)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),a.y=.5*b,b=.5/b,a.x=(this.e01+this.e10)*b,a.z=(this.e12+this.e21)*b,a.w=(this.e02-this.e20)*b):(b=Math.sqrt(d-b-e+1),a.z=.5*b,b=.5/b,a.x=(this.e02+this.e20)*b,a.y=(this.e12+this.e21)*b,a.w=(this.e10-this.e01)*b);return a};ia.prototype.Va=function(a){var b=Math.sin(a.x),e=Math.sin(a.y),d=Math.sin(a.z),c=Math.cos(a.x), +f=Math.cos(a.y);a=Math.cos(a.z);this.e00=f*a;this.e01=-f*d;this.e02=e;this.e10=c*d+a*b*e;this.e11=c*a-b*e*d;this.e12=-f*b;this.e20=b*d-c*a*e;this.e21=a*b+c*e*d;this.e22=c*f;return this};ia.prototype.Sc=function(){var a=this.e02;return-1>=a?(a=Math.atan2(this.e21,this.e11),new z(.5*a,-1.570796326794895,.5*-a)):1<=a?(a=Math.atan2(this.e21,this.e11),new z(.5*a,1.570796326794895,.5*a)):new z(Math.atan2(-this.e12,this.e22),Math.asin(a),Math.atan2(-this.e01,this.e00))};ia.prototype.ac=function(a){return 0== +a?new z(this.e00,this.e01,this.e02):1==a?new z(this.e10,this.e11,this.e12):2==a?new z(this.e20,this.e21,this.e22):null};ia.prototype.Fb=function(a){return 0==a?new z(this.e00,this.e10,this.e20):1==a?new z(this.e01,this.e11,this.e21):2==a?new z(this.e02,this.e12,this.e22):null};ia.prototype.bc=function(a,b){0==a?b.Ia(this.e00,this.e01,this.e02):1==a?b.Ia(this.e10,this.e11,this.e12):2==a?b.Ia(this.e20,this.e21,this.e22):b.$()};ia.prototype.Gb=function(a,b){0==a?b.Ia(this.e00,this.e10,this.e20):1==a? +b.Ia(this.e01,this.e11,this.e21):2==a?b.Ia(this.e02,this.e12,this.e22):b.$()};ia.prototype.tb=function(a,b,e){this.e00=a.x;this.e01=a.y;this.e02=a.z;this.e10=b.x;this.e11=b.y;this.e12=b.z;this.e20=e.x;this.e21=e.y;this.e22=e.z;return this};ia.prototype.Wb=function(a,b,e){this.e00=a.x;this.e01=b.x;this.e02=e.x;this.e10=a.y;this.e11=b.y;this.e12=e.y;this.e20=a.z;this.e21=b.z;this.e22=e.z;return this};ia.prototype.toString=function(){return"Mat3["+(0=a?-1.570796326794895:1<=a?1.570796326794895:Math.asin(a)};Sb.V=function(a){return-1>=a?3.14159265358979:1<=a?0:Math.acos(a)};Sb.atan2=function(a,b){return Math.atan2(a,b)};Sb.sqrt=function(a){return Math.sqrt(a)};Sb.h=function(a,b,e){return ae?e:a};Sb.i=function(){return Math.random()};Sb.C=function(a,b){return a+ +Math.random()*(b-a)};Sb.M=function(a,b){return new z(a+Math.random()*(b-a),a+Math.random()*(b-a),a+Math.random()*(b-a))};Sb.I=function(){return new z(-1+2*Math.random(),-1+2*Math.random(),-1+2*Math.random())};jd.prototype.ob=function(){return 0==this.h?new z:this.i[--this.h]};jd.prototype.Wa=function(){return 0==this.I?new ia:this.C[--this.I]};jd.prototype.Ya=function(){return 0==this.Y?new Ha:this.W[--this.Y]};jd.prototype.nb=function(){return 0==this.V?new Gb:this.M[--this.V]};jd.prototype.aa=function(a, +b,e,d){if(null!=a){a.$();if(this.h==this.i.length){for(var c=Array(this.h<<1),f=0,h=this.h;fe){e=-e;var d=-a.x;var c=-a.y;var f=-a.z;a=-a.w}else d=a.x,c=a.y,f=a.z,a=a.w;if(.999999e?b>d?(b=Math.sqrt(b-e-d+1),this.x=.5*b,b=.5/b,this.y=(a.e01+a.e10)*b,this.z=(a.e02+a.e20)*b,this.w=(a.e21-a.e12)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y= +(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b):e>d?(b=Math.sqrt(e-d-b+1),this.y=.5*b,b=.5/b,this.x=(a.e01+a.e10)*b,this.z=(a.e12+a.e21)*b,this.w=(a.e02-a.e20)*b):(b=Math.sqrt(d-b-e+1),this.z=.5*b,b=.5/b,this.x=(a.e02+a.e20)*b,this.y=(a.e12+a.e21)*b,this.w=(a.e10-a.e01)*b);return this};Gb.prototype.Sa=function(){var a=new ia,b=this.x,e=this.y,d=this.z,c=this.w,f=2*b,h=2*e,k=2*d,g=b*f,l=e*h;d*=k;var m=b*h;e*=k;b*=k;f*=c;h*=c;c*=k;a.e00=1-l-d;a.e01=m-c;a.e02=b+h;a.e10=m+c;a.e11=1-g-d;a.e12=e-f;a.e20=b-h;a.e21= +e+f;a.e22=1-g-l;return a};Gb.prototype.toString=function(){return"Quat["+(0ra.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold?ra.alternativeContactPositionCorrectionAlgorithm:ra.defaultContactPositionCorrectionAlgorithm,b.incremental?this.h.W(b,this.J.g,this.K.g):this.h.aa(b,this.J.g,this.K.g)):this.Ra.de();if(this.xd&&!a){b=this.ic.ld;var e=this.jc.ld;b==e&&(e=null);null!=b&&b.beginContact(this);null!=e&&e.beginContact(this)}!this.xd&&a&&(a=this.ic.ld,b=this.jc.ld,a==b&&(b=null),null!=a&&a.endContact(this),null!=b&&b.endContact(this));this.xd&& +(a=this.ic.ld,b=this.jc.ld,a==b&&(b=null),null!=a&&a.preSolve(this),null!=b&&b.preSolve(this))}};Jd.prototype.Uh=function(){var a=this.ic.ld,b=this.jc.ld;a==b&&(b=null);null!=a&&a.postSolve(this);null!=b&&b.postSolve(this)};Jd.prototype.M=function(){return this.ic};Jd.prototype.V=function(){return this.jc};Jd.prototype.th=function(){return this.xd};Jd.prototype.i=function(){return this.Ra};Jd.prototype.Y=function(){return this.ee};Jd.prototype.I=function(){return this.sa};Jd.prototype.C=function(){return this.U}; +Hf.prototype.h=function(){return this.zd};Hf.prototype.C=function(){return this.Fc};Hf.prototype.I=function(){return this.sa};Hf.prototype.i=function(){return this.U};rg.prototype.I=function(){for(var a=this.nc.Cd;null!=a;){for(var b=a.U;;){if(a.Nf.ucg.R&&k.Sg.S&& +k.Tg.T&&this.h(d,c))){d=b.sa;c=b.U;null!=d&&(d.U=c);null!=c&&(c.sa=d);b==this.md&&(this.md=this.md.U);b==this.Nd&&(this.Nd=this.Nd.sa);b.U=null;b.sa=null;b.xd&&(d=b.ic.ld,c=b.jc.ld,d==c&&(c=null),null!=d&&d.endContact(b),null!=c&&c.endContact(b));d=b.Bb.sa;c=b.Bb.U;null!=d&&(d.U=c);null!=c&&(c.sa=d);b.Bb==b.J.Zb&&(b.J.Zb=b.J.Zb.U);b.Bb==b.J.oc&&(b.J.oc=b.J.oc.sa);b.Bb.U=null;b.Bb.sa=null;d=b.Cb.sa;c=b.Cb.U;null!=d&&(d.U=c);null!=c&&(c.sa=d);b.Cb==b.K.Zb&&(b.K.Zb=b.K.Zb.U);b.Cb==b.K.oc&& +(b.K.oc=b.K.oc.sa);b.Cb.U=null;b.Cb.sa=null;b.J.Pd--;b.K.Pd--;b.Bb.Fc=null;b.Cb.Fc=null;b.Bb.zd=null;b.Cb.zd=null;b.ic=null;b.jc=null;b.J=null;b.K=null;b.xd=!1;b.Eg.de();b.Ra.de();b.Yf=null;d=b.ee;d.ic=null;d.jc=null;d.J=null;d.K=null;d.Jg=null;d.Kg=null;b.U=this.$e;this.$e=b;this.pg--;break}b.lh=!(f.wah.wa&&f.xah.xa&&f.yah.ya);break}b=e}};rg.prototype.h=function(a,b){var e=a.hc,d=b.hc;if(e==d||0!=e.Xb&&0!=d.Xb||0==(a.$g&b.ah)||0==(b.$g&a.ah))return!1;e.Mfra.sleepingTimeThreshold&&(b.Ob=!0,b.Kb=0)):b.Kb=0;if(!b.Ob){if(0==b.Xb){e=a*b.gh;d=e*e;e=1/(1+e+d*(.5+.16666666666666666*e+.041666666666666664*d));d=a*b.Xg;var c=d*d;d=1/(1+d+c*(.5+.16666666666666666*d+.041666666666666664*c));c=this.Ma*b.Hf;var f=this.Oa*b.Hf;var h=this.Sa*b.Hf;c+=b.Zf*b.Ab;f+=b.$f*b.Ab;h+=b.ag*b.Ab;var k=b.ba*b.De+b.ca*b.Ee+b.da*b.Fe;var g=b.ea*b.De+b.fa*b.Ee+b.ga*b.Fe;var l=b.ha*b.De+b.ia*b.Ee+b.ja*b.Fe;b.ub+=c*a;b.vb+=f*a;b.wb+=h*a;b.ub*=e;b.vb*=e;b.wb*=e;b.xb+=k*a;b.yb+= +g*a;b.zb+=l*a;b.xb*=d;b.yb*=d;b.zb*=d}b.Bi(a);for(a=b.vc;null!=a;){e=a.U;c=b.za;d=b.g;f=a.za;h=a.ra;l=c.A*h.A+c.j*h.o+c.m*h.u;k=c.A*h.j+c.j*h.v+c.m*h.l;g=c.A*h.m+c.j*h.s+c.m*h.B;var m=c.o*h.A+c.v*h.o+c.s*h.u;var n=c.o*h.j+c.v*h.v+c.s*h.l;var q=c.o*h.m+c.v*h.s+c.s*h.B;var p=c.u*h.A+c.l*h.o+c.B*h.u;var r=c.u*h.j+c.l*h.v+c.B*h.l;var t=c.u*h.m+c.l*h.s+c.B*h.B;f.A=l;f.j=k;f.m=g;f.o=m;f.v=n;f.s=q;f.u=p;f.l=r;f.B=t;l=c.A*h.F+c.j*h.G+c.m*h.H;k=c.o*h.F+c.v*h.G+c.s*h.H;h=c.u*h.F+c.l*h.G+c.B*h.H;f.F=l;f.G=k; +f.H=h;f.F+=c.F;f.G+=c.G;f.H+=c.H;c=a.g;f=a.ra;h=d.A*f.A+d.j*f.o+d.m*f.u;l=d.A*f.j+d.j*f.v+d.m*f.l;k=d.A*f.m+d.j*f.s+d.m*f.B;g=d.o*f.A+d.v*f.o+d.s*f.u;m=d.o*f.j+d.v*f.v+d.s*f.l;n=d.o*f.m+d.v*f.s+d.s*f.B;q=d.u*f.A+d.l*f.o+d.B*f.u;p=d.u*f.j+d.l*f.v+d.B*f.l;r=d.u*f.m+d.l*f.s+d.B*f.B;c.A=h;c.j=l;c.m=k;c.o=g;c.v=m;c.s=n;c.u=q;c.l=p;c.B=r;h=d.A*f.F+d.j*f.G+d.m*f.H;l=d.o*f.F+d.v*f.G+d.s*f.H;f=d.u*f.F+d.l*f.G+d.B*f.H;c.F=h;c.G=l;c.H=f;c.F+=d.F;c.G+=d.G;c.H+=d.H;a.Tb.Yb(a.D,a.za);d=a.D.wa;c=a.D.xa;f=a.D.ya; +h=a.D.ta;l=a.D.ua;k=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=da.D.ta?h:a.D.ta;a.D.ua=l>a.D.ua?l:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(d=a.g.F-a.za.F,c=a.g.G-a.za.G,f=a.g.H-a.za.H,h=a.qc,h.x=d,h.y=c,h.z=f,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=e}}};Mj.prototype.Wa=function(a,b,e){for(var d=a.dt,c=!0,f=0,h=this.h;fb.D.ta?g:b.D.ta;b.D.ua=l>b.D.ua?l:b.D.ua;b.D.va=m>b.D.va?m:b.D.va;null!=b.Eb&&(f=b.g.F- +b.za.F,h=b.g.G-b.za.G,k=b.g.H-b.za.H,g=b.qc,g.x=f,g.y=h,g.z=k,b.hc.pc.nc.fd(b.Eb,b.D,b.qc));b=c}}};tb.prototype.Va=function(){var a=Jh.h()/1E3;this.Xf.i();ii.broadPhaseCollisionTime=1E3*(Jh.h()/1E3-a);a=Jh.h()/1E3;for(var b=this.Xf.md;null!=b;){var e=b.U;b.lh||b.Li();b=e}ii.narrowPhaseCollisionTime=1E3*(Jh.h()/1E3-a)};tb.prototype.je=function(){var a=Jh.h()/1E3;if(ra.disableSleeping)for(var b=this.I;null!=b;)b.Ob=!1,b.Kb=0,b=b.U;if(this.W.length=a.drawBvhMinLevel&&e<=a.drawBvhMaxLevel){var c=this.h,f=0==c.h?new z:c.i[--c.h];c=this.h;c=0==c.h?new z:c.i[--c.h];f.x=b.R;f.y=b.S;f.z=b.T;c.x=b.N;c.y=b.O;c.z=b.P;a.aabb(f,c,d);var h=this.h;if(null!=f){f.$();if(h.h==h.i.length){for(var k=Array(h.h<<1),g=0,l=h.h;gra.sleepingTimeThreshold?b.sleepyShapeColor1:b.shapeColor1:e.Ob?b.sleepingShapeColor2:e.Kb>ra.sleepingTimeThreshold?b.sleepyShapeColor2:b.shapeColor2);if(a.drawShapes){var l=k.Tb,m=k.g;switch(l.Xb){case 0:a.sphere(m,l.lb,f);break;case 1:var n=l,q=this.h,p=0==q.h?new z:q.i[--q.h],r=p;r.x=n.Sd;r.y=n.Td;r.z=n.Ud;a.box(m,p,f);var t=this.h;if(null!=p){p.$();if(t.h==t.i.length){for(var x=Array(t.h<<1),v=0,B=t.h;vk?a.ellipse(b,e,d,f,f,g):a.arc(b,e,d,f,f,h,k,!0,g)}};tb.prototype.Wb=function(a,b,e,d,c,f){if(dr;){var t=r++,x=Math.cos(l)*f,v=Math.sin(l)*h,B=Math.sqrt(x*x+v*v),H=Math.sin(.5*B),C=Math.cos(.5*B),N=n.$();N.x+=d.x*x;N.y+=d.y*x;N.z+=d.z*x;N.x+=c.x* +v;N.y+=c.y*v;N.z+=c.z*v;x=1/B*H;n.x*=x;n.y*=x;n.z*=x;q.x=n.x;q.y=n.y;q.z=n.z;q.w=C;var y=q.x,A=q.y;H=q.z;v=q.w;var E=2*y,L=2*A;B=2*H;C=y*E;x=A*L;H*=B;N=y*L;A*=B;y*=B;E*=v;L*=v;v*=B;p.e00=1-x-H;p.e01=N-v;p.e02=y+L;p.e10=N+v;p.e11=1-C-H;p.e12=A-E;p.e20=y-L;p.e21=A+E;p.e22=1-C-x;C=this.h;C=0==C.h?new z:C.i[--C.h];C.x+=e.x*k;C.y+=e.y*k;C.z+=e.z*k;x=C.x*p.e10+C.y*p.e11+C.z*p.e12;v=C.x*p.e20+C.y*p.e21+C.z*p.e22;C.x=C.x*p.e00+C.y*p.e01+C.z*p.e02;C.y=x;C.z=v;C.x+=b.x;C.y+=b.y;C.z+=b.z;1<=t&&a.line(m,C,g); +t=this.h;if(null!=m){m.$();if(t.h==t.i.length){x=Array(t.h<<1);v=0;for(B=t.h;vb||5this.D.wa&&b.xa< +this.D.ua&&b.ua>this.D.xa&&b.yathis.D.ya&&this.h.process(a)};bl.prototype.process=function(){};ak.prototype.beginContact=function(){};ak.prototype.preSolve=function(){};ak.prototype.postSolve=function(){};ak.prototype.endContact=function(){};Ek.prototype.process=function(){};rl(aj,Ek);aj.prototype.clear=function(){this.shape=null;this.fraction=1;this.position.$();this.normal.$();this.hit=!1};aj.prototype.process=function(a,b){if(b.fractione&&(e= +-e);d=e/.5235987755982984+.5|0;0==d&&(d=1);e=f;h=(h-f)/d;c=this.h;c=0==c.h?new z:c.i[--c.h];c.x=a.x;c.y=a.y;c.z=a.z;var m=Math.cos(f);c.x+=l.x*m;c.y+=l.y*m;c.z+=l.z*m;f=Math.sin(f);c.x+=b.x*f;c.y+=b.y*f;c.z+=b.z*f;f=c;k&&this.line(a,c,g);for(c=0;cDa;){var X=Da++,fa=this.I[X],w=this.V[X];fa.x=w.x;fa.y=w.y;fa.z= +w.z;fa.x*=la;fa.y*=la;fa.z*=la;fa.y+=qa;var ja=this.I[X],ea=ja.x*p.e10+ja.y*p.e11+ja.z*p.e12,U=ja.x*p.e20+ja.y*p.e21+ja.z*p.e22;ja.x=ja.x*p.e00+ja.y*p.e01+ja.z*p.e02;ja.y=ea;ja.z=U;var ba=this.C[X],Fa=this.aa[X];ba.x=Fa.x;ba.y=Fa.y;ba.z=Fa.z;ba.x*=la;ba.y*=la;ba.z*=la;ba.y+=qa;var ka=this.C[X],Qa=ka.x*p.e10+ka.y*p.e11+ka.z*p.e12,Ka=ka.x*p.e20+ka.y*p.e21+ka.z*p.e22;ka.x=ka.x*p.e00+ka.y*p.e01+ka.z*p.e02;ka.y=Qa;ka.z=Ka;var V=this.i[X],ob=this.V[X];V.x=ob.x;V.y=ob.y;V.z=ob.z;var Za=V.x*p.e10+V.y*p.e11+ +V.z*p.e12,W=V.x*p.e20+V.y*p.e21+V.z*p.e22;V.x=V.x*p.e00+V.y*p.e01+V.z*p.e02;V.y=Za;V.z=W;V.x*=b;V.y*=b;V.z*=b;V.x+=n.x;V.y+=n.y;V.z+=n.z;var ha=this.i[X],I=-e;ha.x+=k.x*I;ha.y+=k.y*I;ha.z+=k.z*I}for(var na=0;8>na;){var ca=na++,da=this.i[ca],Z=this.i[(ca+1)%8],oa=this.C[ca];this.triangle(t,da,Z,oa,this.I[ca],this.I[(ca+1)%8],d);da=this.i[(ca+1)%8];Z=this.i[ca];var xb=this.h,hb=0==xb.h?new z:xb.i[--xb.h];hb.x=k.x;hb.y=k.y;hb.z=k.z;var fb=hb;fb.x=-fb.x;fb.y=-fb.y;fb.z=-fb.z;oa=fb;this.triangle(v,da, +Z,fb,fb,fb,d);var gb=this.h;if(null!=fb){fb.$();if(gb.h==gb.i.length){for(var pb=Array(gb.h<<1),ab=0,$a=gb.h;ab<$a;){var ua=ab++;pb[ua]=gb.i[ua];gb.i[ua]=null}gb.i=pb}gb.i[gb.h++]=fb}}}var Ya=this.h;if(null!=t){t.$();if(Ya.h==Ya.i.length){for(var Fb=Array(Ya.h<<1),Xa=0,Bb=Ya.h;Xa +pb;){var ab=pb++,$a=this.I[ab],ua=this.V[ab];$a.x=ua.x;$a.y=ua.y;$a.z=ua.z;var Ya=$a.x*p.e10+$a.y*p.e11+$a.z*p.e12,Fb=$a.x*p.e20+$a.y*p.e21+$a.z*p.e22;$a.x=$a.x*p.e00+$a.y*p.e01+$a.z*p.e02;$a.y=Ya;$a.z=Fb;var Xa=this.C[ab],Bb=this.I[ab];Xa.x=Bb.x;Xa.y=Bb.y;Xa.z=Bb.z;Xa.x*=b;Xa.y*=b;Xa.z*=b;Xa.x+=n.x;Xa.y+=n.y;Xa.z+=n.z;var Wa=this.i[ab],Cb=this.C[ab];Wa.x=Cb.x;Wa.y=Cb.y;Wa.z=Cb.z;var qb=this.C[ab];qb.x+=k.x*e;qb.y+=k.y*e;qb.z+=k.z*e;var bb=this.i[ab],ib=-e;bb.x+=k.x*ib;bb.y+=k.y*ib;bb.z+=k.z*ib}for(var rb= +0;8>rb;){var db=rb++,Db=t,jb=this.C[db],nb=this.C[(db+1)%8],cb=k;this.triangle(t,jb,nb,cb,cb,cb,d);Db=v;jb=this.i[(db+1)%8];nb=this.i[db];var Jb=this.h,Kb=0==Jb.h?new z:Jb.i[--Jb.h];Kb.x=k.x;Kb.y=k.y;Kb.z=k.z;var F=Kb;F.x=-F.x;F.y=-F.y;F.z=-F.z;cb=F;this.triangle(v,jb,nb,F,F,F,d);var ub=this.h;if(null!=F){F.$();if(ub.h==ub.i.length){for(var lb=Array(ub.h<<1),yb=0,vb=ub.h;ybx;)for(var v=x++,B=this.M[v].length,H=0;HL;){var G=L++;if(0==G)for(var P=0;3>P;)for(var K=P++,pa=this.M[K].length, +M=0;MRa;)for(var wa=Ra++,La=this.M[wa].length,Ea=0;EaVa;){var D=Va++,Aa=void 0,aa=void 0,Ua=void 0,xa=void 0,Ja=void 0,S=void 0,la=void 0, +qa=void 0;0==G?this.wireframe?(Aa=r[0][0],aa=r[1][D],this.line(Aa,aa,d)):(Aa=r[0][0],aa=r[1][D],Ua=r[1][(D+1)%8],Ja=t[0][0],S=t[1][D],la=t[1][(D+1)%8],this.triangle(Aa,aa,Ua,Ja,S,la,d)):3==G?this.wireframe?(Aa=r[4][0],aa=r[G][(D+1)%8],Ua=r[G][D],this.line(Aa,aa,d),this.line(aa,Ua,d)):(Aa=r[4][0],aa=r[G][(D+1)%8],Ua=r[G][D],Ja=t[4][0],S=t[G][(D+1)%8],la=t[G][D],this.triangle(Aa,aa,Ua,Ja,S,la,d)):this.wireframe?(Aa=r[G][D],aa=r[G][(D+1)%8],Ua=r[G+1][D],this.line(Aa,aa,d),this.line(Aa,Ua,d)):(Aa=r[G][D], +aa=r[G][(D+1)%8],Ua=r[G+1][D],xa=r[G+1][(D+1)%8],Ja=t[G][D],S=t[G][(D+1)%8],la=t[G+1][D],qa=t[G+1][(D+1)%8],this.rect(Aa,Ua,xa,aa,Ja,la,qa,S,d))}}var Da=this.h,X=0==Da.h?new z:Da.i[--Da.h];X.x=n.x;X.y=n.y;X.z=n.z;X.x+=k.x*e;X.y+=k.y*e;X.z+=k.z*e;var fa=this.h,w=0==fa.h?new z:fa.i[--fa.h];w.x=n.x;w.y=n.y;w.z=n.z;var ja=-e;w.x+=k.x*ja;w.y+=k.y*ja;w.z+=k.z*ja;if(this.wireframe){var ea=this.h,U=0==ea.h?new z:ea.i[--ea.h];U.x=X.x;U.y=X.y;U.z=X.z;var ba=-b;U.x+=f.x*ba;U.y+=f.y*ba;U.z+=f.z*ba;U.x+=0*l.x; +U.y+=0*l.y;U.z+=0*l.z;var Fa=this.h,ka=0==Fa.h?new z:Fa.i[--Fa.h];ka.x=X.x;ka.y=X.y;ka.z=X.z;ka.x+=f.x*b;ka.y+=f.y*b;ka.z+=f.z*b;ka.x+=0*l.x;ka.y+=0*l.y;ka.z+=0*l.z;var Qa=this.h,Ka=0==Qa.h?new z:Qa.i[--Qa.h];Ka.x=X.x;Ka.y=X.y;Ka.z=X.z;Ka.x+=0*f.x;Ka.y+=0*f.y;Ka.z+=0*f.z;var V=-b;Ka.x+=l.x*V;Ka.y+=l.y*V;Ka.z+=l.z*V;var ob=this.h,Za=0==ob.h?new z:ob.i[--ob.h];Za.x=X.x;Za.y=X.y;Za.z=X.z;Za.x+=0*f.x;Za.y+=0*f.y;Za.z+=0*f.z;Za.x+=l.x*b;Za.y+=l.y*b;Za.z+=l.z*b;var W=this.h,ha=0==W.h?new z:W.i[--W.h];ha.x= +w.x;ha.y=w.y;ha.z=w.z;var I=-b;ha.x+=f.x*I;ha.y+=f.y*I;ha.z+=f.z*I;ha.x+=0*l.x;ha.y+=0*l.y;ha.z+=0*l.z;var na=this.h,ca=0==na.h?new z:na.i[--na.h];ca.x=w.x;ca.y=w.y;ca.z=w.z;ca.x+=f.x*b;ca.y+=f.y*b;ca.z+=f.z*b;ca.x+=0*l.x;ca.y+=0*l.y;ca.z+=0*l.z;var da=this.h,Z=0==da.h?new z:da.i[--da.h];Z.x=w.x;Z.y=w.y;Z.z=w.z;Z.x+=0*f.x;Z.y+=0*f.y;Z.z+=0*f.z;var oa=-b;Z.x+=l.x*oa;Z.y+=l.y*oa;Z.z+=l.z*oa;var xb=this.h,hb=0==xb.h?new z:xb.i[--xb.h];hb.x=w.x;hb.y=w.y;hb.z=w.z;hb.x+=0*f.x;hb.y+=0*f.y;hb.z+=0*f.z;hb.x+= +l.x*b;hb.y+=l.y*b;hb.z+=l.z*b;this.ellipse(X,f,l,b,b,d);this.ellipse(w,f,l,b,b,d);this.line(U,ha,d);this.line(ka,ca,d);this.line(Ka,Z,d);this.line(Za,hb,d);var fb=this.h;if(null!=U){U.$();if(fb.h==fb.i.length){for(var gb=Array(fb.h<<1),pb=0,ab=fb.h;pb +sb;){var Hb=sb++,Ba=this.I[Hb],Ta=this.V[Hb];Ba.x=Ta.x;Ba.y=Ta.y;Ba.z=Ta.z;var sa=Ba.x*p.e10+Ba.y*p.e11+Ba.z*p.e12,Ga=Ba.x*p.e20+Ba.y*p.e21+Ba.z*p.e22;Ba.x=Ba.x*p.e00+Ba.y*p.e01+Ba.z*p.e02;Ba.y=sa;Ba.z=Ga;var Q=this.C[Hb],Ma=this.I[Hb];Q.x=Ma.x;Q.y=Ma.y;Q.z=Ma.z;Q.x*=b;Q.y*=b;Q.z*=b;Q.x+=n.x;Q.y+=n.y;Q.z+=n.z;var Ia=this.i[Hb],Eb=this.C[Hb];Ia.x=Eb.x;Ia.y=Eb.y;Ia.z=Eb.z;var wb=this.C[Hb];wb.x+=k.x*e;wb.y+=k.y*e;wb.z+=k.z*e;var Mb=this.i[Hb],Ib=-e;Mb.x+=k.x*Ib;Mb.y+=k.y*Ib;Mb.z+=k.z*Ib}for(var Tb= +0;8>Tb;){var Rb=Tb++,Wb=this.I[Rb],mc=this.I[(Rb+1)%8];this.rect(this.C[Rb],this.i[Rb],this.i[(Rb+1)%8],this.C[(Rb+1)%8],Wb,Wb,mc,mc,d)}}var Xb=this.h;if(null!=X){X.$();if(Xb.h==Xb.i.length){for(var ic=Array(Xb.h<<1),bc=0,$b=Xb.h;bc<$b;){var Zb=bc++;ic[Zb]=Xb.i[Zb];Xb.i[Zb]=null}Xb.i=ic}Xb.i[Xb.h++]=X}var Qb=this.h;if(null!=w){w.$();if(Qb.h==Qb.i.length){for(var jc=Array(Qb.h<<1),ac=0,ec=Qb.h;ach;)for(var k=h++,g=this.M[k].length,l=0;lb;)for(h=b++,k=0;8>k;){var r=k++;if(0==h)if(this.wireframe)g=a[0][0], +l=a[1][r],this.line(g,l,e);else{g=a[0][0];l=a[1][r];m=a[1][(r+1)%8];q=f[0][0];p=f[1][r];var t=f[1][(r+1)%8];this.triangle(g,l,m,q,p,t,e)}else 3==h?this.wireframe?(g=a[4][0],l=a[h][(r+1)%8],m=a[h][r],this.line(g,l,e),this.line(l,m,e)):(g=a[4][0],l=a[h][(r+1)%8],m=a[h][r],q=f[4][0],p=f[h][(r+1)%8],t=f[h][r],this.triangle(g,l,m,q,p,t,e)):this.wireframe?(g=a[h][r],l=a[h][(r+1)%8],m=a[h+1][r],this.line(g,l,e),this.line(g,m,e)):(g=a[h][r],l=a[h][(r+1)%8],m=a[h+1][r],n=a[h+1][(r+1)%8],q=f[h][r],p=f[h][(r+ +1)%8],t=f[h+1][r],r=f[h+1][(r+1)%8],this.rect(g,m,n,l,q,t,r,p,e))}e=this.h;if(null!=c){c.$();if(e.h==e.i.length){a=Array(e.h<<1);f=0;for(b=e.h;ft.zc)t.ve=!0,t=t.Ad,t.Hc=0,t.xc=0,t.wc=0,t.Hb=0,t.ge=0,t.he=0,t.ie=0;else{t.ve=!1;var x=b.rows[b.La++]; +x.friction=n;x.Ua=0;var v=x.Ve;v.Ba=e;v.Ca=d;v.Da=c;v.Fa=e;v.Ga=d;v.Ha=c;v.ka=t.Mb*c-t.Nb*d;v.la=t.Nb*e-t.Lb*c;v.ma=t.Lb*d-t.Mb*e;v.na=t.lc*c-t.mc*d;v.oa=t.mc*e-t.kc*c;v.pa=t.kc*d-t.lc*e;v=x.Ug;v.Ba=f;v.Ca=h;v.Da=k;v.Fa=f;v.Ga=h;v.Ha=k;v.ka=t.Mb*k-t.Nb*h;v.la=t.Nb*f-t.Lb*k;v.ma=t.Lb*h-t.Mb*f;v.na=t.lc*k-t.mc*h;v.oa=t.mc*f-t.kc*k;v.pa=t.kc*h-t.lc*f;v=x.Tg;v.Ba=g;v.Ca=l;v.Da=m;v.Fa=g;v.Ga=l;v.Ha=m;v.ka=t.Mb*m-t.Nb*l;v.la=t.Nb*g-t.Lb*m;v.ma=t.Lb*l-t.Mb*g;v.na=t.lc*m-t.mc*l;v.oa=t.mc*g-t.kc*m;v.pa=t.kc* +l-t.lc*g;v=x.Ve;v=v.Ba*this.J.ub+v.Ca*this.J.vb+v.Da*this.J.wb+(v.ka*this.J.xb+v.la*this.J.yb+v.ma*this.J.zb)-(v.Fa*this.K.ub+v.Ga*this.K.vb+v.Ha*this.K.wb+(v.na*this.K.xb+v.oa*this.K.yb+v.pa*this.K.zb));x.Na=v<-ra.contactEnableBounceThreshold&&!t.Xd?-v*q:0;this.pf==Fh.BAUMGARTE&&t.zc>ra.linearSlop&&(v=(t.zc-ra.linearSlop)*ra.velocityBaumgarte*a.invDt,x.Nak.Na&&(k.Na=0);k.Aa=h.Ad}}};af.prototype.Wh=function(){this.Ra.Di(this.Jg,this.Kg)};af.prototype.i=function(){return this.ic};af.prototype.C=function(){return this.jc};af.prototype.h= +function(){return this.Ra};af.prototype.th=function(){for(var a=0,b=this.Ra.Bd;ara.contactPersistenceThreshold?this.C(a):(e+=this.Ra.kf*-c,d+=this.Ra.lf*-c,b+=this.Ra.mf*-c,e*e+d*d+b*b>ra.contactPersistenceThreshold*ra.contactPersistenceThreshold&&this.C(a))}};$i.prototype.C=function(a){var b=--this.Ra.Bd;if(a!=b){var e=this.Ra.rc[a];this.Ra.rc[a]=this.Ra.rc[b];this.Ra.rc[b]=e}a=this.Ra.rc[b];a.we=0;a.xe=0;a.ye=0;a.ze=0;a.Ae= +0;a.Be=0;a.Lb=0;a.Mb=0;a.Nb=0;a.kc=0;a.lc=0;a.mc=0;a.od=0;a.pd=0;a.qd=0;a.rd=0;a.sd=0;a.td=0;a.zc=0;b=a.Ad;b.Hc=0;b.xc=0;b.wc=0;b.Hb=0;b.ge=0;b.he=0;b.ie=0;a.Xd=!1;a.ve=!1;a.uc=-1};$i.prototype.I=function(a,b,e){var d=this.Ra.Bd;if(d==ra.maxManifoldPoints){d=this.Ra.rc[this.M(a,b)];var c=a.position1;d.od=c.x;d.pd=c.y;d.qd=c.z;c=a.position2;d.rd=c.x;d.sd=c.y;d.td=c.z;d.Lb=d.od-b.F;d.Mb=d.pd-b.G;d.Nb=d.qd-b.H;d.kc=d.rd-e.F;d.lc=d.sd-e.G;d.mc=d.td-e.H;c=b.A*d.Lb+b.o*d.Mb+b.u*d.Nb;var f=b.j*d.Lb+b.v* +d.Mb+b.l*d.Nb;b=b.m*d.Lb+b.s*d.Mb+b.B*d.Nb;d.we=c;d.xe=f;d.ye=b;b=e.A*d.kc+e.o*d.lc+e.u*d.mc;c=e.j*d.kc+e.v*d.lc+e.l*d.mc;e=e.m*d.kc+e.s*d.lc+e.B*d.mc;d.ze=b;d.Ae=c;d.Be=e;d.zc=a.depth;e=d.Ad;e.Hc=0;e.xc=0;e.wc=0;e.Hb=0;e.ge=0;e.he=0;e.ie=0;d.uc=a.id;d.Xd=!1;d.ve=!1}else d=this.Ra.rc[d],c=a.position1,d.od=c.x,d.pd=c.y,d.qd=c.z,c=a.position2,d.rd=c.x,d.sd=c.y,d.td=c.z,d.Lb=d.od-b.F,d.Mb=d.pd-b.G,d.Nb=d.qd-b.H,d.kc=d.rd-e.F,d.lc=d.sd-e.G,d.mc=d.td-e.H,c=b.A*d.Lb+b.o*d.Mb+b.u*d.Nb,f=b.j*d.Lb+b.v*d.Mb+ +b.l*d.Nb,b=b.m*d.Lb+b.s*d.Mb+b.B*d.Nb,d.we=c,d.xe=f,d.ye=b,b=e.A*d.kc+e.o*d.lc+e.u*d.mc,c=e.j*d.kc+e.v*d.lc+e.l*d.mc,e=e.m*d.kc+e.s*d.lc+e.B*d.mc,d.ze=b,d.Ae=c,d.Be=e,d.zc=a.depth,e=d.Ad,e.Hc=0,e.xc=0,e.wc=0,e.Hb=0,e.ge=0,e.he=0,e.ie=0,d.uc=a.id,d.Xd=!1,d.ve=!1,this.Ra.Bd++};$i.prototype.M=function(a,b){var e=this.Ra.rc[0],d=this.Ra.rc[1],c=this.Ra.rc[2],f=this.Ra.rc[3],h=e.zc,k=0;d.zc>h&&(h=d.zc,k=1);c.zc>h&&(h=c.zc,k=2);f.zc>h&&(h=f.zc,k=3);var g=a.position1;var l=g.x;var m=g.y;var n=g.z;l-=b.F; +m-=b.G;n-=b.H;var q=d.Lb,p=d.Mb,r=d.Nb,t=c.Lb,x=c.Mb,v=c.Nb,B=f.Lb,H=f.Mb,C=f.Nb;var N=t-q;var y=x-p;var A=v-r;var E=l-B;var L=m-H;var G=n-C;var P=B-q;var K=H-p;var pa=C-r;var M=l-t;var Sa=m-x;var Pa=n-v;var Ca=l-q;var Ra=m-p;var wa=n-r;var La=B-t;var Ea=H-x;var O=C-v;var ma=y*G-A*L;var Y=A*E-N*G;var ta=N*L-y*E;var Va=K*Pa-pa*Sa;var D=pa*M-P*Pa;var Aa=P*Sa-K*M;var aa=Ra*O-wa*Ea;var Ua=wa*La-Ca*O;var xa=Ca*Ea-Ra*La;var Ja=ma*ma+Y*Y+ta*ta,S=Va*Va+D*D+Aa*Aa,la=aa*aa+Ua*Ua+xa*xa,qa=e.Lb,Da=e.Mb,X=e.Nb, +fa=c.Lb,w=c.Mb,ja=c.Nb,ea=f.Lb,U=f.Mb,ba=f.Nb;var Fa=fa-qa;var ka=w-Da;var Qa=ja-X;var Ka=l-ea;var V=m-U;var ob=n-ba;var Za=ea-qa;var W=U-Da;var ha=ba-X;var I=l-fa;var na=m-w;var ca=n-ja;var da=l-qa;var Z=m-Da;var oa=n-X;var xb=ea-fa;var hb=U-w;var fb=ba-ja;var gb=ka*ob-Qa*V;var pb=Qa*Ka-Fa*ob;var ab=Fa*V-ka*Ka;var $a=W*ca-ha*na;var ua=ha*I-Za*ca;var Ya=Za*na-W*I;var Fb=Z*fb-oa*hb;var Xa=oa*xb-da*fb;var Bb=da*hb-Z*xb;var Wa=gb*gb+pb*pb+ab*ab,Cb=$a*$a+ua*ua+Ya*Ya,qb=Fb*Fb+Xa*Xa+Bb*Bb,bb=Wa>Cb?Wa>qb? +Wa:qb:Cb>qb?Cb:qb,ib=e.Lb,rb=e.Mb,db=e.Nb,Db=d.Lb,jb=d.Mb,nb=d.Nb,cb=f.Lb,Jb=f.Mb,Kb=f.Nb;var F=Db-ib;var ub=jb-rb;var lb=nb-db;var yb=l-cb;var vb=m-Jb;var eb=n-Kb;var Lb=cb-ib;var mb=Jb-rb;var zb=Kb-db;var u=l-Db;var T=m-jb;var R=n-nb;var va=l-ib;var Na=m-rb;var ya=n-db;var Oa=cb-Db;var kb=Jb-jb;var sb=Kb-nb;var Hb=ub*eb-lb*vb;var Ba=lb*yb-F*eb;var Ta=F*vb-ub*yb;var sa=mb*R-zb*T;var Ga=zb*u-Lb*R;var Q=Lb*T-mb*u;var Ma=Na*sb-ya*kb;var Ia=ya*Oa-va*sb;var Eb=va*kb-Na*Oa;var wb=Hb*Hb+Ba*Ba+Ta*Ta,Mb= +sa*sa+Ga*Ga+Q*Q,Ib=Ma*Ma+Ia*Ia+Eb*Eb,Tb=wb>Mb?wb>Ib?wb:Ib:Mb>Ib?Mb:Ib,Rb=e.Lb,Wb=e.Mb,mc=e.Nb,Xb=d.Lb,ic=d.Mb,bc=d.Nb,$b=c.Lb,Zb=c.Mb,Qb=c.Nb;var jc=Xb-Rb;var ac=ic-Wb;var ec=bc-mc;var Ub=l-$b;var kc=m-Zb;var uc=n-Qb;var fc=$b-Rb;var dd=Zb-Wb;var Nb=Qb-mc;var nc=l-Xb;var gc=m-ic;var Vb=n-bc;var lc=l-Rb;var ed=m-Wb;var Bc=n-mc;var Kc=$b-Xb;var zc=Zb-ic;var Cc=Qb-bc;var sc=ac*uc-ec*kc;var Lc=ec*Ub-jc*uc;var zd=jc*kc-ac*Ub;var Rc=dd*Vb-Nb*gc;var Wc=Nb*nc-fc*Vb;var Dc=fc*gc-dd*nc;var Ec=ed*Cc-Bc*zc;var od= +Bc*Kc-lc*Cc;var hc=lc*zc-ed*Kc;var fd=sc*sc+Lc*Lc+zd*zd,Sc=Rc*Rc+Wc*Wc+Dc*Dc,pd=Ec*Ec+od*od+hc*hc,Gd=fd>Sc?fd>pd?fd:pd:Sc>pd?Sc:pd,Tc=Ja>S?Ja>la?Ja:la:S>la?S:la,Pd=0;if(bb>Tc&&1!=k||0==k)Tc=bb,Pd=1;Tb>Tc&&2!=k&&(Tc=Tb,Pd=2);Gd>Tc&&3!=k&&(Tc=Gd,Pd=3);return Pd};$i.prototype.V=function(a,b,e){for(var d=ra.contactPersistenceThreshold*ra.contactPersistenceThreshold,c=-1,f=0,h=this.Ra.Bd;fb){a=this.i;var e=this.C;var d=this.I;b=a*a;var c=e*e;var f=d*d;bd?(a=this.i,b=this.C,e=this.I,d=a*a,c=b*b,f=e*e,dg?b=l=e=0:f==g?(e=-Infinity,l=Infinity,b-=f):bg?(e=0,l=Infinity,b=b-g-k,0>b&&(b=0)):b=l=e=0;a.Qa=e;a.Pa=l;a.Ua=c*(0==d?0:1/d);a.Na=b*h};za.prototype.Ed=function(a,b,e,d,c,f,h){var k=ra.angularSlop;if(h)c=0,h=1;else{if(0e?b=g=l=0:f==e?(l=-Infinity,g=Infinity,b-=f):be?(l=0,g=Infinity,b=b-e-k,0>b&&(b=0)):b=g=l=0;a.Qa=l;a.Pa=g;a.Ua=c*(0==d?0:1/d);a.Na=b*h};za.prototype.ce=function(a, +b){return b?1:this.pf==Fh.BAUMGARTE?a.invDt*ra.velocityBaumgarte:0};za.prototype.Sc=function(a,b,e){var d=(this.J.ba*a+this.J.ca*b+this.J.da*e)*a+(this.J.ea*a+this.J.fa*b+this.J.ga*e)*b+(this.J.ha*a+this.J.ia*b+this.J.ja*e)*e,c=(this.K.ba*a+this.K.ca*b+this.K.da*e)*a+(this.K.ea*a+this.K.fa*b+this.K.ga*e)*b+(this.K.ha*a+this.K.ia*b+this.K.ja*e)*e;if(0this.rf*this.rf?this.pc.wi(this):0this.sf*this.sf&&this.pc.wi(this)};za.prototype.ei=function(){return this.J};za.prototype.fi=function(){return this.K};za.prototype.yi=function(){return this.Xb};za.prototype.zh=function(){var a=new z;a.x=this.ke;a.y=this.le;a.z=this.me;return a}; +za.prototype.Bh=function(){var a=new z;a.x=this.ne;a.y=this.oe;a.z=this.pe;return a};za.prototype.Ah=function(a){a.x=this.ke;a.y=this.le;a.z=this.me};za.prototype.Ch=function(a){a.x=this.ne;a.y=this.oe;a.z=this.pe};za.prototype.vh=function(){var a=new z;a.x=this.tf;a.y=this.uf;a.z=this.vf;return a};za.prototype.ai=function(){var a=new z;a.x=this.wf;a.y=this.yf;a.z=this.zf;return a};za.prototype.$h=function(a){a.x=this.tf;a.y=this.uf;a.z=this.vf};za.prototype.bi=function(a){a.x=this.wf;a.y=this.yf; +a.z=this.zf};za.prototype.Hh=function(){var a=new ia;var b=this.pb;var e=this.Bc;var d=this.Id;var c=this.qb;var f=this.Cc;var h=this.Jd;var k=this.rb;var g=this.Dc;var l=this.Kd;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=k;a.e21=g;a.e22=l;return a};za.prototype.Jh=function(){var a=new ia;var b=this.cc;var e=this.Fd;var d=this.se;var c=this.dc;var f=this.Gd;var h=this.te;var k=this.ec;var g=this.Hd;var l=this.ue;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=k;a.e21=g;a.e22=l;return a}; +za.prototype.Ih=function(a){var b=this.pb;var e=this.Bc;var d=this.Id;var c=this.qb;var f=this.Cc;var h=this.Jd;var k=this.rb;var g=this.Dc;var l=this.Kd;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=k;a.e21=g;a.e22=l};za.prototype.Kh=function(a){var b=this.cc;var e=this.Fd;var d=this.se;var c=this.dc;var f=this.Gd;var h=this.te;var k=this.ec;var g=this.Hd;var l=this.ue;a.e00=b;a.e01=e;a.e02=d;a.e10=c;a.e11=f;a.e12=h;a.e20=k;a.e21=g;a.e22=l};za.prototype.yh=function(){return this.Nh};za.prototype.Oi= +function(a){this.Nh=a};za.prototype.Lh=function(){return this.rf};za.prototype.Pi=function(a){this.rf=a};za.prototype.Mh=function(){return this.sf};za.prototype.Qi=function(a){this.sf=a};za.prototype.di=function(){return this.pf};za.prototype.Ri=function(a){switch(a){case 0:case 1:case 2:break;default:throw Error("invalid position correction algorithm id: "+a);}this.pf=a};za.prototype.Dh=function(){var a=new z;a.x=this.vg;a.y=this.wg;a.z=this.xg;return a};za.prototype.Eh=function(a){a.x=this.vg;a.y= +this.wg;a.z=this.xg};za.prototype.Fh=function(){var a=new z;a.x=this.yg;a.y=this.zg;a.z=this.Ag;return a};za.prototype.Gh=function(a){a.x=this.yg;a.y=this.zg;a.z=this.Ag};za.prototype.xi=function(){return this.sa};za.prototype.Vg=function(){return this.U};rl(dc,za);dc.prototype.Gb=function(a,b,e){var d=this.ce(b,e),c=this.ac*d,f=this.bc*d,h=this.tc*d;d=this.vd*d;var k=1/(this.J.Ab+this.K.Ab);var g=this.Sc(this.h.i,this.h.C,this.h.I);if(0>=this.Fb.frequency||!e){var l=this.M[0],m=a.rows[a.La++],n= +m.Ea;n.Ba=0;n.Ca=0;n.Da=0;n.Fa=0;n.Ga=0;n.Ha=0;n.ka=0;n.la=0;n.ma=0;n.na=0;n.oa=0;n.pa=0;m.Na=0;m.Ua=0;m.Qa=0;m.Pa=0;m.motorSpeed=0;m.Db=0;m.Aa=l;this.Af(m,this.Xa,this.Yh,k,this.Fb,b,e);k=m.Ea;k.Ba=this.h.i;k.Ca=this.h.C;k.Da=this.h.I;k.Fa=this.h.i;k.Ga=this.h.C;k.Ha=this.h.I;k.ka=this.qa*this.h.I-this.Ma*this.h.C;k.la=this.Ma*this.h.i-this.aa*this.h.I;k.ma=this.aa*this.h.C-this.qa*this.h.i;k.na=this.Sa*this.h.I-this.Wa*this.h.C;k.oa=this.Wa*this.h.i-this.Oa*this.h.I;k.pa=this.Oa*this.h.C-this.Sa* +this.h.i}k=this.M[1];l=a.rows[a.La++];m=l.Ea;m.Ba=0;m.Ca=0;m.Da=0;m.Fa=0;m.Ga=0;m.Ha=0;m.ka=0;m.la=0;m.ma=0;m.na=0;m.oa=0;m.pa=0;l.Na=0;l.Ua=0;l.Qa=0;l.Pa=0;l.motorSpeed=0;l.Db=0;l.Aa=null;l.Aa=k;l.Na=c;l.Ua=0;l.Qa=-Infinity;l.Pa=Infinity;k=l.Ea;k.Ba=this.h.M;k.Ca=this.h.V;k.Da=this.h.W;k.Fa=this.h.M;k.Ga=this.h.V;k.Ha=this.h.W;k.ka=this.qa*this.h.W-this.Ma*this.h.V;k.la=this.Ma*this.h.M-this.aa*this.h.W;k.ma=this.aa*this.h.V-this.qa*this.h.M;k.na=this.Sa*this.h.W-this.Wa*this.h.V;k.oa=this.Wa*this.h.M- +this.Oa*this.h.W;k.pa=this.Oa*this.h.V-this.Sa*this.h.M;c=this.M[2];k=a.rows[a.La++];l=k.Ea;l.Ba=0;l.Ca=0;l.Da=0;l.Fa=0;l.Ga=0;l.Ha=0;l.ka=0;l.la=0;l.ma=0;l.na=0;l.oa=0;l.pa=0;k.Na=0;k.Ua=0;k.Qa=0;k.Pa=0;k.motorSpeed=0;k.Db=0;k.Aa=c;k.Na=f;k.Ua=0;k.Qa=-Infinity;k.Pa=Infinity;k=k.Ea;k.Ba=this.h.Y;k.Ca=this.h.aa;k.Da=this.h.qa;k.Fa=this.h.Y;k.Ga=this.h.aa;k.Ha=this.h.qa;k.ka=this.qa*this.h.qa-this.Ma*this.h.aa;k.la=this.Ma*this.h.Y-this.aa*this.h.qa;k.ma=this.aa*this.h.aa-this.qa*this.h.Y;k.na=this.Sa* +this.h.qa-this.Wa*this.h.aa;k.oa=this.Wa*this.h.Y-this.Oa*this.h.qa;k.pa=this.Oa*this.h.aa-this.Sa*this.h.Y;if(0>=this.tb.frequency||!e)f=this.M[3],c=a.rows[a.La++],k=c.Ea,k.Ba=0,k.Ca=0,k.Da=0,k.Fa=0,k.Ga=0,k.Ha=0,k.ka=0,k.la=0,k.ma=0,k.na=0,k.oa=0,k.pa=0,c.Na=0,c.Ua=0,c.Qa=0,c.Pa=0,c.motorSpeed=0,c.Db=0,c.Aa=f,this.Ed(c,this.Va,this.Vh,g,this.tb,b,e),k=c.Ea,k.ka=this.h.i,k.la=this.h.C,k.ma=this.h.I,k.na=this.h.i,k.oa=this.h.C,k.pa=this.h.I;b=this.M[4];e=a.rows[a.La++];g=e.Ea;g.Ba=0;g.Ca=0;g.Da=0; +g.Fa=0;g.Ga=0;g.Ha=0;g.ka=0;g.la=0;g.ma=0;g.na=0;g.oa=0;g.pa=0;e.Na=0;e.Ua=0;e.Qa=0;e.Pa=0;e.motorSpeed=0;e.Db=0;e.Aa=b;e.Na=h;e.Ua=0;e.Qa=-Infinity;e.Pa=Infinity;k=e.Ea;k.ka=this.h.M;k.la=this.h.V;k.ma=this.h.W;k.na=this.h.M;k.oa=this.h.V;k.pa=this.h.W;h=this.M[5];a=a.rows[a.La++];b=a.Ea;b.Ba=0;b.Ca=0;b.Da=0;b.Fa=0;b.Ga=0;b.Ha=0;b.ka=0;b.la=0;b.ma=0;b.na=0;b.oa=0;b.pa=0;a.Na=0;a.Ua=0;a.Qa=0;a.Pa=0;a.motorSpeed=0;a.Db=0;a.Aa=h;a.Na=d;a.Ua=0;a.Qa=-Infinity;a.Pa=Infinity;k=a.Ea;k.ka=this.h.Y;k.la=this.h.aa; +k.ma=this.h.qa;k.na=this.h.Y;k.oa=this.h.aa;k.pa=this.h.qa};dc.prototype.Gc=function(){za.prototype.Gc.call(this);var a=this.h,b=a.h.J.Ab,e=a.h.K.Ab,d=a.h.pb*a.h.cc+a.h.qb*a.h.dc+a.h.rb*a.h.ec;if(-.999999999>d){var c=a.h.pb,f=a.h.qb,h=a.h.rb,k=c*c,g=f*f,l=h*h;if(kM&&(M=-M,G=-G,P=-P,K=-K,pa=-pa);if(.999999gb){var pb=da*da,ab=Z*Z,$a=oa*oa;if(pb=Q?3.14159265358979:1<=Q?0:Math.acos(Q),Ia=Ta*Ta+sa*sa+Ga*Ga;0=Q?3.14159265358979: +1<=Q?0:Math.acos(Q);0>Eb*this.h.i+wb*this.h.C+Mb*this.h.I&&(this.Va=-this.Va);var Ib=this.ne-this.ke;var Tb=this.oe-this.le;var Rb=this.pe-this.me;this.Xa=Ib*this.h.i+Tb*this.h.C+Rb*this.h.I;this.ac=Ib*this.h.M+Tb*this.h.V+Rb*this.h.W;this.bc=Ib*this.h.Y+Tb*this.h.aa+Rb*this.h.qa};dc.prototype.nd=function(a,b){za.prototype.nd.call(this,a,b);this.Gb(b,a,!1)};dc.prototype.Ec=function(a){za.prototype.Ec.call(this,a);this.Gb(a,null,!0)};dc.prototype.gd=function(){var a=new z;a.x=this.pb;a.y=this.qb;a.z= +this.rb;return a};dc.prototype.jd=function(){var a=new z;a.x=this.cc;a.y=this.dc;a.z=this.ec;return a};dc.prototype.hd=function(a){a.x=this.pb;a.y=this.qb;a.z=this.rb};dc.prototype.wd=function(a){a.x=this.cc;a.y=this.dc;a.z=this.ec};dc.prototype.$d=function(){var a=new z;a.x=this.i;a.y=this.C;a.z=this.I;return a};dc.prototype.be=function(){var a=new z;a.x=this.V;a.y=this.W;a.z=this.Y;return a};dc.prototype.ae=function(a){a.x=this.i;a.y=this.C;a.z=this.I};dc.prototype.Qd=function(a){a.x=this.V;a.y= +this.W;a.z=this.Y};dc.prototype.Ze=function(){return this.Fb};dc.prototype.Xe=function(){return this.tb};dc.prototype.Ye=function(){return this.Yh};dc.prototype.We=function(){return this.Vh};dc.prototype.yc=function(){return this.Va};dc.prototype.Rd=function(){return this.Xa};qf.prototype.h=function(a,b,e){this.rigidBody1=a;this.rigidBody2=b;var d=this.rigidBody1;a=this.localAnchor1;var c=e.x;var f=e.y;var h=e.z;c-=d.g.F;f-=d.g.G;h-=d.g.H;b=d.g.A*c+d.g.o*f+d.g.u*h;var k=d.g.j*c+d.g.v*f+d.g.l*h;d= +d.g.m*c+d.g.s*f+d.g.B*h;a.x=b;a.y=k;a.z=d;b=this.rigidBody2;a=this.localAnchor2;k=e.x;d=e.y;f=e.z;k-=b.g.F;d-=b.g.G;f-=b.g.H;e=b.g.A*k+b.g.o*d+b.g.u*f;c=b.g.j*k+b.g.v*d+b.g.l*f;b=b.g.m*k+b.g.s*d+b.g.B*f;a.x=e;a.y=c;a.z=b};rl(Yj,qf);Yj.prototype.Ia=function(a,b,e,d){this.h(a,b,e);e=this.localAxis1;var c=d.x;var f=d.y;var h=d.z;var k=a.g.A*c+a.g.o*f+a.g.u*h;var g=a.g.j*c+a.g.v*f+a.g.l*h;a=a.g.m*c+a.g.s*f+a.g.B*h;e.x=k;e.y=g;e.z=a;a=this.localAxis2;e=d.x;k=d.y;c=d.z;d=b.g.A*e+b.g.o*k+b.g.u*c;g=b.g.j* +e+b.g.v*k+b.g.l*c;b=b.g.m*e+b.g.s*k+b.g.B*c;a.x=d;a.y=g;a.z=b;return this};rl(Pc,za);Pc.prototype.gd=function(a,b,e){var d=1/(this.J.Ab+this.K.Ab),c=this.Sc(this.h,this.Va,this.Xa),f=this.Sc(this.Mc,this.Nc,this.Oc),h=this.Sc(this.tb,this.Fb,this.Gb);if(0>=this.bc[0].frequency||!e){var k=this.M[0];var g=a.rows[a.La++],l=g.Ea;l.Ba=0;l.Ca=0;l.Da=0;l.Fa=0;l.Ga=0;l.Ha=0;l.ka=0;l.la=0;l.ma=0;l.na=0;l.oa=0;l.pa=0;g.Na=0;g.Ua=0;g.Qa=0;g.Pa=0;g.motorSpeed=0;g.Db=0;g.Aa=k;this.Af(g,this.tc,this.Oe[0],d,this.bc[0], +b,e);k=g.Ea;k.Ba=this.pb;k.Ca=this.qb;k.Da=this.rb;k.Fa=this.pb;k.Ga=this.qb;k.Ha=this.rb;k.ka=this.qa*this.rb-this.Ma*this.qb;k.la=this.Ma*this.pb-this.aa*this.rb;k.ma=this.aa*this.qb-this.qa*this.pb;k.na=this.Sa*this.rb-this.Wa*this.qb;k.oa=this.Wa*this.pb-this.Oa*this.rb;k.pa=this.Oa*this.qb-this.Sa*this.pb}if(0>=this.bc[1].frequency||!e)k=this.M[1],g=a.rows[a.La++],l=g.Ea,l.Ba=0,l.Ca=0,l.Da=0,l.Fa=0,l.Ga=0,l.Ha=0,l.ka=0,l.la=0,l.ma=0,l.na=0,l.oa=0,l.pa=0,g.Na=0,g.Ua=0,g.Qa=0,g.Pa=0,g.motorSpeed= +0,g.Db=0,g.Aa=k,this.Af(g,this.vd,this.Oe[1],d,this.bc[1],b,e),k=g.Ea,k.Ba=this.Bc,k.Ca=this.Cc,k.Da=this.Dc,k.Fa=this.Bc,k.Ga=this.Cc,k.Ha=this.Dc,k.ka=this.qa*this.Dc-this.Ma*this.Cc,k.la=this.Ma*this.Bc-this.aa*this.Dc,k.ma=this.aa*this.Cc-this.qa*this.Bc,k.na=this.Sa*this.Dc-this.Wa*this.Cc,k.oa=this.Wa*this.Bc-this.Oa*this.Dc,k.pa=this.Oa*this.Cc-this.Sa*this.Bc;if(0>=this.bc[2].frequency||!e)k=this.M[2],g=a.rows[a.La++],l=g.Ea,l.Ba=0,l.Ca=0,l.Da=0,l.Fa=0,l.Ga=0,l.Ha=0,l.ka=0,l.la=0,l.ma=0,l.na= +0,l.oa=0,l.pa=0,g.Na=0,g.Ua=0,g.Qa=0,g.Pa=0,g.motorSpeed=0,g.Db=0,g.Aa=k,this.Af(g,this.yc,this.Oe[2],d,this.bc[2],b,e),k=g.Ea,k.Ba=this.Id,k.Ca=this.Jd,k.Da=this.Kd,k.Fa=this.Id,k.Ga=this.Jd,k.Ha=this.Kd,k.ka=this.qa*this.Kd-this.Ma*this.Jd,k.la=this.Ma*this.Id-this.aa*this.Kd,k.ma=this.aa*this.Jd-this.qa*this.Id,k.na=this.Sa*this.Kd-this.Wa*this.Jd,k.oa=this.Wa*this.Id-this.Oa*this.Kd,k.pa=this.Oa*this.Jd-this.Sa*this.Id;this.hd||!(0>=this.ac[0].frequency)&&e||(d=this.M[3],k=a.rows[a.La++],g=k.Ea, +g.Ba=0,g.Ca=0,g.Da=0,g.Fa=0,g.Ga=0,g.Ha=0,g.ka=0,g.la=0,g.ma=0,g.na=0,g.oa=0,g.pa=0,k.Na=0,k.Ua=0,k.Qa=0,k.Pa=0,k.motorSpeed=0,k.Db=0,k.Aa=d,this.Ed(k,this.qe,this.Ne[0],c,this.ac[0],b,e),k=k.Ea,k.ka=this.h,k.la=this.Va,k.ma=this.Xa,k.na=this.h,k.oa=this.Va,k.pa=this.Xa);this.jd||!(0>=this.ac[1].frequency)&&e||(c=this.M[4],d=a.rows[a.La++],k=d.Ea,k.Ba=0,k.Ca=0,k.Da=0,k.Fa=0,k.Ga=0,k.Ha=0,k.ka=0,k.la=0,k.ma=0,k.na=0,k.oa=0,k.pa=0,d.Na=0,d.Ua=0,d.Qa=0,d.Pa=0,d.motorSpeed=0,d.Db=0,d.Aa=c,this.Ed(d,this.Df, +this.Ne[1],f,this.ac[1],b,e),k=d.Ea,k.ka=this.Mc,k.la=this.Nc,k.ma=this.Oc,k.na=this.Mc,k.oa=this.Nc,k.pa=this.Oc);this.wd||!(0>=this.ac[2].frequency)&&e||(f=this.M[5],a=a.rows[a.La++],c=a.Ea,c.Ba=0,c.Ca=0,c.Da=0,c.Fa=0,c.Ga=0,c.Ha=0,c.ka=0,c.la=0,c.ma=0,c.na=0,c.oa=0,c.pa=0,a.Na=0,a.Ua=0,a.Qa=0,a.Pa=0,a.motorSpeed=0,a.Db=0,a.Aa=f,this.Ed(a,this.re,this.Ne[2],h,this.ac[2],b,e),k=a.Ea,k.ka=this.tb,k.la=this.Fb,k.ma=this.Gb,k.na=this.tb,k.oa=this.Fb,k.pa=this.Gb)};Pc.prototype.Gc=function(){za.prototype.Gc.call(this); +var a=this.pb;var b=this.qb;var e=this.rb;var d=this.se;var c=this.te;var f=this.ue;var h=c*e-f*b;var k=f*a-d*e;var g=d*b-c*a;this.h=k*f-g*c;this.Va=g*d-h*f;this.Xa=h*c-k*d;this.Mc=h;this.Nc=k;this.Oc=g;this.tb=b*g-e*k;this.Fb=e*h-a*g;this.Gb=a*k-b*h;a=this.h*this.h+this.Va*this.Va+this.Xa*this.Xa;0=B?(a=Math.atan2(C,H),l=.5*a,B=-1.570796326794895,a=.5*-a):1<=B?(a=Math.atan2(C,H),l=.5*a,B=1.570796326794895,a*=.5):(l=Math.atan2(-(l*t+n*x+p*v),m*t+q*x+r*v),B=Math.asin(B),a=Math.atan2(-(a*k+b*d+e*f),a*h+b*g+e*c));this.qe=l;this.Df=B;this.re=a;a=this.ne-this.ke;b=this.oe-this.le;e=this.pe-this.me;this.tc=a*this.pb+b*this.qb+e*this.rb;this.vd=a*this.Bc+b*this.Cc+e*this.Dc;this.yc=a*this.Id+b*this.Jd+e*this.Kd};Pc.prototype.nd=function(a,b){za.prototype.nd.call(this,a,b);this.gd(b,a,!1)}; +Pc.prototype.Ec=function(a){za.prototype.Ec.call(this,a);this.gd(a,null,!0)};Pc.prototype.ae=function(){var a=new z;a.x=this.pb;a.y=this.qb;a.z=this.rb;return a};Pc.prototype.be=function(){var a=new z;a.x=this.Mc;a.y=this.Nc;a.z=this.Oc;return a};Pc.prototype.Qd=function(){var a=new z;a.x=this.se;a.y=this.te;a.z=this.ue;return a};Pc.prototype.Ye=function(){return this.bc.slice(0)};Pc.prototype.We=function(){return this.ac.slice(0)};Pc.prototype.Xe=function(){return this.Oe.slice(0)};Pc.prototype.Rd= +function(){return this.Ne.slice(0)};Pc.prototype.$d=function(){return new z(this.qe,this.Df,this.re)};Pc.prototype.Ze=function(){return new z(this.tc,this.vd,this.yc)};rl(Xj,qf);Xj.prototype.Ia=function(a,b,e,d,c){this.h(a,b,e);var f=a.g;b=b.g;var h=d.e00;var k=d.e01;var g=d.e02;var l=d.e10;var m=d.e11;var n=d.e12;var q=d.e20;var p=d.e21;var r=d.e22;var t=c.e00;var x=c.e01;var v=c.e02;var B=c.e10;var H=c.e11;var C=c.e12;var N=c.e20;var y=c.e21;var A=c.e22;c=f.A*h+f.o*l+f.u*q;d=f.A*k+f.o*m+f.u*p;a= +f.A*g+f.o*n+f.u*r;e=f.j*h+f.v*l+f.l*q;var E=f.j*k+f.v*m+f.l*p;var L=f.j*g+f.v*n+f.l*r;h=f.m*h+f.s*l+f.B*q;k=f.m*k+f.s*m+f.B*p;l=f.m*g+f.s*n+f.B*r;f=b.A*t+b.o*B+b.u*N;g=b.A*x+b.o*H+b.u*y;n=b.A*v+b.o*C+b.u*A;m=b.j*t+b.v*B+b.l*N;p=b.j*x+b.v*H+b.l*y;r=b.j*v+b.v*C+b.l*A;t=b.m*t+b.s*B+b.B*N;x=b.m*x+b.s*H+b.B*y;b=b.m*v+b.s*C+b.B*A;v=this.localBasis1;v.e00=c;v.e01=d;v.e02=a;v.e10=e;v.e11=E;v.e12=L;v.e20=h;v.e21=k;v.e22=l;c=this.localBasis2;c.e00=f;c.e01=g;c.e02=n;c.e10=m;c.e11=p;c.e12=r;c.e20=t;c.e21=x;c.e22= +b;return this};Gf.prototype.h=function(){return this.Rh};Gf.prototype.C=function(){return this.Fc};Gf.prototype.I=function(){return this.sa};Gf.prototype.i=function(){return this.U};rl(rc,za);rc.prototype.tc=function(a,b,e){var d=this.ce(b,e),c=this.ac*d,f=this.bc*d,h=this.tb*d,k=this.Va*d;d=this.Xa*d;if(0>=this.Fb.frequency||!e){var g=this.M[0],l=a.rows[a.La++],m=l.Ea;m.Ba=0;m.Ca=0;m.Da=0;m.Fa=0;m.Ga=0;m.Ha=0;m.ka=0;m.la=0;m.ma=0;m.na=0;m.oa=0;m.pa=0;l.Na=0;l.Ua=0;l.Qa=0;l.Pa=0;l.motorSpeed=0;l.Db= +0;l.Aa=g;this.Af(l,this.Gb,this.cg,1/(this.J.Ab+this.K.Ab),this.Fb,b,e);b=l.Ea;b.Ba=this.h.i;b.Ca=this.h.C;b.Da=this.h.I;b.Fa=this.h.i;b.Ga=this.h.C;b.Ha=this.h.I;b.ka=this.qa*this.h.I-this.Ma*this.h.C;b.la=this.Ma*this.h.i-this.aa*this.h.I;b.ma=this.aa*this.h.C-this.qa*this.h.i;b.na=this.Sa*this.h.I-this.Wa*this.h.C;b.oa=this.Wa*this.h.i-this.Oa*this.h.I;b.pa=this.Oa*this.h.C-this.Sa*this.h.i}b=this.M[1];e=a.rows[a.La++];g=e.Ea;g.Ba=0;g.Ca=0;g.Da=0;g.Fa=0;g.Ga=0;g.Ha=0;g.ka=0;g.la=0;g.ma=0;g.na= +0;g.oa=0;g.pa=0;e.Na=0;e.Ua=0;e.Qa=0;e.Pa=0;e.motorSpeed=0;e.Db=0;e.Aa=b;e.Na=c;e.Ua=0;e.Qa=-Infinity;e.Pa=Infinity;b=e.Ea;b.Ba=this.h.M;b.Ca=this.h.V;b.Da=this.h.W;b.Fa=this.h.M;b.Ga=this.h.V;b.Ha=this.h.W;b.ka=this.qa*this.h.W-this.Ma*this.h.V;b.la=this.Ma*this.h.M-this.aa*this.h.W;b.ma=this.aa*this.h.V-this.qa*this.h.M;b.na=this.Sa*this.h.W-this.Wa*this.h.V;b.oa=this.Wa*this.h.M-this.Oa*this.h.W;b.pa=this.Oa*this.h.V-this.Sa*this.h.M;c=this.M[2];b=a.rows[a.La++];e=b.Ea;e.Ba=0;e.Ca=0;e.Da=0;e.Fa= +0;e.Ga=0;e.Ha=0;e.ka=0;e.la=0;e.ma=0;e.na=0;e.oa=0;e.pa=0;b.Na=0;b.Ua=0;b.Qa=0;b.Pa=0;b.motorSpeed=0;b.Db=0;b.Aa=c;b.Na=f;b.Ua=0;b.Qa=-Infinity;b.Pa=Infinity;b=b.Ea;b.Ba=this.h.Y;b.Ca=this.h.aa;b.Da=this.h.qa;b.Fa=this.h.Y;b.Ga=this.h.aa;b.Ha=this.h.qa;b.ka=this.qa*this.h.qa-this.Ma*this.h.aa;b.la=this.Ma*this.h.Y-this.aa*this.h.qa;b.ma=this.aa*this.h.aa-this.qa*this.h.Y;b.na=this.Sa*this.h.qa-this.Wa*this.h.aa;b.oa=this.Wa*this.h.Y-this.Oa*this.h.qa;b.pa=this.Oa*this.h.aa-this.Sa*this.h.Y;f=this.M[3]; +c=a.rows[a.La++];b=c.Ea;b.Ba=0;b.Ca=0;b.Da=0;b.Fa=0;b.Ga=0;b.Ha=0;b.ka=0;b.la=0;b.ma=0;b.na=0;b.oa=0;b.pa=0;c.Na=0;c.Ua=0;c.Qa=0;c.Pa=0;c.motorSpeed=0;c.Db=0;c.Aa=f;c.Na=h;c.Ua=0;c.Qa=-Infinity;c.Pa=Infinity;b=c.Ea;b.ka=1;b.la=0;b.ma=0;b.na=1;b.oa=0;b.pa=0;h=this.M[4];f=a.rows[a.La++];c=f.Ea;c.Ba=0;c.Ca=0;c.Da=0;c.Fa=0;c.Ga=0;c.Ha=0;c.ka=0;c.la=0;c.ma=0;c.na=0;c.oa=0;c.pa=0;f.Na=0;f.Ua=0;f.Qa=0;f.Pa=0;f.motorSpeed=0;f.Db=0;f.Aa=h;f.Na=k;f.Ua=0;f.Qa=-Infinity;f.Pa=Infinity;b=f.Ea;b.ka=0;b.la=1;b.ma= +0;b.na=0;b.oa=1;b.pa=0;k=this.M[5];a=a.rows[a.La++];h=a.Ea;h.Ba=0;h.Ca=0;h.Da=0;h.Fa=0;h.Ga=0;h.Ha=0;h.ka=0;h.la=0;h.ma=0;h.na=0;h.oa=0;h.pa=0;a.Na=0;a.Ua=0;a.Qa=0;a.Pa=0;a.motorSpeed=0;a.Db=0;a.Aa=k;a.Na=d;a.Ua=0;a.Qa=-Infinity;a.Pa=Infinity;b=a.Ea;b.ka=0;b.la=0;b.ma=1;b.na=0;b.oa=0;b.pa=1};rc.prototype.Gc=function(){za.prototype.Gc.call(this);var a=this.h,b=a.h.J.Ab,e=a.h.K.Ab,d=a.h.pb*a.h.cc+a.h.qb*a.h.dc+a.h.rb*a.h.ec;if(-.999999999>d){var c=a.h.pb,f=a.h.qb,h=a.h.rb,k=c*c,g=f*f,l=h*h;if(kM&&(M=-M,G=-G,P=-P,K=-K,pa=-pa); +if(.999999gb){var pb=da*da,ab=Z*Z,$a=oa*oa;if(pbec?Zb>fc?(Nb=Math.sqrt(Zb-ec-fc+1),gc=.5*Nb,Nb=.5/Nb,Vb=(Qb+ac)*Nb,lc=(jc+kc)*Nb,nc=(uc-Ub)*Nb):(Nb=Math.sqrt(fc-Zb-ec+1),lc=.5*Nb,Nb=.5/Nb,gc=(jc+kc)*Nb,Vb=(Ub+uc)*Nb,nc=(ac-Qb)*Nb):ec>fc?(Nb=Math.sqrt(ec-fc-Zb+1),Vb=.5*Nb,Nb=.5/Nb, +gc=(Qb+ac)*Nb,lc=(Ub+uc)*Nb,nc=(jc-kc)*Nb):(Nb=Math.sqrt(fc-Zb-ec+1),lc=.5*Nb,Nb=.5/Nb,gc=(jc+kc)*Nb,Vb=(Ub+uc)*Nb,nc=(ac-Qb)*Nb);var ed=nc,Bc=2*(-1>=ed?3.14159265358979:1<=ed?0:Math.acos(ed));this.tb=gc;this.Va=Vb;this.Xa=lc;var Kc=this.tb*this.tb+this.Va*this.Va+this.Xa*this.Xa;0=this.gd.frequency||!e)&&(h=this.M[3],n=a.rows[a.La++],q=n.Ea,q.Ba=0,q.Ca=0,q.Da=0,q.Fa=0,q.Ga=0,q.Ha=0,q.ka=0,q.la=0,q.ma=0,q.na=0,q.oa=0,q.pa=0,n.Na=0,n.Ua=0,n.Qa=0,n.Pa=0,n.motorSpeed=0,n.Db=0,n.Aa=h,this.Ed(n,this.yc,this.jd,H,this.gd,b,e),c=n.Ea,c.ka=this.h,c.la=this.Va,c.ma=this.Xa,c.na=this.h,c.oa=this.Va,c.pa=this.Xa);if(0>=this.hd.frequency||!e)H=this.M[4],a=a.rows[a.La++],h=a.Ea, +h.Ba=0,h.Ca=0,h.Da=0,h.Fa=0,h.Ga=0,h.Ha=0,h.ka=0,h.la=0,h.ma=0,h.na=0,h.oa=0,h.pa=0,a.Na=0,a.Ua=0,a.Qa=0,a.Pa=0,a.motorSpeed=0,a.Db=0,a.Aa=H,this.Ed(a,this.Mg,this.Zh,d,this.hd,b,e),c=a.Ea,c.ka=this.tb,c.la=this.Fb,c.ma=this.Gb,c.na=this.tb,c.oa=this.Fb,c.pa=this.Gb};Yb.prototype.Gc=function(){za.prototype.Gc.call(this);var a=this.pb;var b=this.qb;var e=this.rb;var d=this.cc;var c=this.dc;var f=this.ec;var h=this.pb;var k=this.Bc;var g=this.Id;var l=this.qb;var m=this.Cc;var n=this.Jd;var q=this.rb; +var p=this.Dc;var r=this.Kd;var t=a*d+b*c+e*f;if(-.999999999>t){var x=a*a;d=b*b;c=e*e;x=C?3.14159265358979:1<=C?0:Math.acos(C));C=v;y=H;H=a*this.Fd+x*this.Gd+t*this.Hd;A=b*this.Fd+d*this.Gd+f*this.Hd;v=e*this.Fd+c*this.Gd+N*this.Hd;this.Mg=Math.atan2(this.Id*H+this.Jd*A+this.Kd*v,this.Bc*H+this.Cc*A+this.Dc*v);this.tb=this.pb+this.cc;this.Fb=this.qb+this.dc;this.Gb=this.rb+this.ec;v=this.tb*this.tb+this.Fb*this.Fb+this.Gb*this.Gb;0=this.Xa.frequency||!e)h=this.M[3], +q=a.rows[a.La++],p=q.Ea,p.Ba=0,p.Ca=0,p.Da=0,p.Fa=0,p.Ga=0,p.Ha=0,p.ka=0,p.la=0,p.ma=0,p.na=0,p.oa=0,p.pa=0,q.Na=0,q.Ua=0,q.Qa=0,q.Pa=0,q.motorSpeed=0,q.Db=0,q.Aa=h,this.Ed(q,this.Va,this.cg,C,this.Xa,b,e),c=q.Ea,c.ka=this.h.i,c.la=this.h.C,c.ma=this.h.I,c.na=this.h.i,c.oa=this.h.C,c.pa=this.h.I;b=this.M[4];e=a.rows[a.La++];C=e.Ea;C.Ba=0;C.Ca=0;C.Da=0;C.Fa=0;C.Ga=0;C.Ha=0;C.ka=0;C.la=0;C.ma=0;C.na=0;C.oa=0;C.pa=0;e.Na=0;e.Ua=0;e.Qa=0;e.Pa=0;e.motorSpeed=0;e.Db=0;e.Aa=b;e.Na=k;e.Ua=0;e.Qa=-Infinity; +e.Pa=Infinity;c=e.Ea;c.ka=this.h.M;c.la=this.h.V;c.ma=this.h.W;c.na=this.h.M;c.oa=this.h.V;c.pa=this.h.W;k=this.M[5];a=a.rows[a.La++];b=a.Ea;b.Ba=0;b.Ca=0;b.Da=0;b.Fa=0;b.Ga=0;b.Ha=0;b.ka=0;b.la=0;b.ma=0;b.na=0;b.oa=0;b.pa=0;a.Na=0;a.Ua=0;a.Qa=0;a.Pa=0;a.motorSpeed=0;a.Db=0;a.Aa=k;a.Na=d;a.Ua=0;a.Qa=-Infinity;a.Pa=Infinity;c=a.Ea;c.ka=this.h.Y;c.la=this.h.aa;c.ma=this.h.qa;c.na=this.h.Y;c.oa=this.h.aa;c.pa=this.h.qa};qc.prototype.Gc=function(){za.prototype.Gc.call(this);var a=this.h,b=a.h.J.Ab,e= +a.h.K.Ab,d=a.h.pb*a.h.cc+a.h.qb*a.h.dc+a.h.rb*a.h.ec;if(-.999999999>d){var c=a.h.pb,f=a.h.qb,h=a.h.rb,k=c*c,g=f*f,l=h*h;if(kM&&(M=-M,G=-G,P=-P,K=-K,pa=-pa);if(.999999gb){var pb=da*da,ab=Z*Z,$a=oa*oa;if(pb=Q?3.14159265358979:1<=Q?0:Math.acos(Q), +Ia=Ta*Ta+sa*sa+Ga*Ga;0=Q?3.14159265358979:1<=Q?0:Math.acos(Q);0>Eb*this.h.i+wb*this.h.C+Mb*this.h.I&&(this.Va=-this.Va);this.vd=this.ne-this.ke;this.ac=this.oe-this.le; +this.bc=this.pe-this.me};qc.prototype.nd=function(a,b){za.prototype.nd.call(this,a,b);this.tb(b,a,!1)};qc.prototype.Ec=function(a){za.prototype.Ec.call(this,a);this.tb(a,null,!0)};qc.prototype.yc=function(){var a=new z;a.x=this.pb;a.y=this.qb;a.z=this.rb;return a};qc.prototype.hd=function(){var a=new z;a.x=this.cc;a.y=this.dc;a.z=this.ec;return a};qc.prototype.gd=function(a){a.x=this.pb;a.y=this.qb;a.z=this.rb};qc.prototype.jd=function(a){a.x=this.cc;a.y=this.dc;a.z=this.ec};qc.prototype.$d=function(){var a= +new z;a.x=this.i;a.y=this.C;a.z=this.I;return a};qc.prototype.be=function(){var a=new z;a.x=this.V;a.y=this.W;a.z=this.Y;return a};qc.prototype.ae=function(a){a.x=this.i;a.y=this.C;a.z=this.I};qc.prototype.Qd=function(a){a.x=this.V;a.y=this.W;a.z=this.Y};qc.prototype.Rd=function(){return this.Xa};qc.prototype.wd=function(){return this.cg};qc.prototype.tc=function(){return this.Va};rl(Uj,qf);Uj.prototype.Ia=function(a,b,e,d){this.h(a,b,e);e=this.localAxis1;var c=d.x;var f=d.y;var h=d.z;var k=a.g.A* +c+a.g.o*f+a.g.u*h;var g=a.g.j*c+a.g.v*f+a.g.l*h;a=a.g.m*c+a.g.s*f+a.g.B*h;e.x=k;e.y=g;e.z=a;a=this.localAxis2;e=d.x;k=d.y;c=d.z;d=b.g.A*e+b.g.o*k+b.g.u*c;g=b.g.j*e+b.g.v*k+b.g.l*c;b=b.g.m*e+b.g.s*k+b.g.B*c;a.x=d;a.y=g;a.z=b;return this};te.prototype.h=function(a,b){this.lowerLimit=a;this.upperLimit=b;return this};te.prototype.i=function(a,b){this.motorSpeed=a;this.motorTorque=b;return this};te.prototype.clone=function(){var a=new te;a.lowerLimit=this.lowerLimit;a.upperLimit=this.upperLimit;a.motorSpeed= +this.motorSpeed;a.motorTorque=this.motorTorque;return a};rl(Zi,za);Zi.prototype.Va=function(a,b,e){if(!(0=this.tc.frequency)&&e||(h=this.M[3],q=a.rows[a.La++],p=q.Ea,p.Ba=0,p.Ca=0,p.Da=0,p.Fa=0,p.Ga=0,p.Ha=0,p.ka=0,p.la=0,p.ma=0,p.na=0,p.oa=0,p.pa=0,q.Na=0,q.Ua=0,q.Qa=0,q.Pa= +0,q.motorSpeed=0,q.Db=0,q.Aa=h,this.Ed(q,this.qe,this.Sh,C,this.tc,b,e),c=q.Ea,c.ka=this.h,c.la=this.Va,c.ma=this.Xa,c.na=this.h,c.oa=this.Va,c.pa=this.Xa);this.jd||(C=this.M[4],h=a.rows[a.La++],q=h.Ea,q.Ba=0,q.Ca=0,q.Da=0,q.Fa=0,q.Ga=0,q.Ha=0,q.ka=0,q.la=0,q.ma=0,q.na=0,q.oa=0,q.pa=0,h.Na=0,h.Ua=0,h.Qa=0,h.Pa=0,h.motorSpeed=0,h.Db=0,h.Aa=C,h.Na=k,h.Ua=0,h.Qa=-Infinity,h.Pa=Infinity,c=h.Ea,c.ka=this.Mc,c.la=this.Nc,c.ma=this.Oc,c.na=this.Mc,c.oa=this.Nc,c.pa=this.Oc);this.wd||!(0>=this.yc.frequency)&& +e||(k=this.M[5],a=a.rows[a.La++],C=a.Ea,C.Ba=0,C.Ca=0,C.Da=0,C.Fa=0,C.Ga=0,C.Ha=0,C.ka=0,C.la=0,C.ma=0,C.na=0,C.oa=0,C.pa=0,a.Na=0,a.Ua=0,a.Qa=0,a.Pa=0,a.motorSpeed=0,a.Db=0,a.Aa=k,this.Ed(a,this.re,this.Th,d,this.yc,b,e),c=a.Ea,c.ka=this.tb,c.la=this.Fb,c.ma=this.Gb,c.na=this.tb,c.oa=this.Fb,c.pa=this.Gb)};cc.prototype.Gc=function(){za.prototype.Gc.call(this);var a=this.pb;var b=this.qb;var e=this.rb;var d=this.se;var c=this.te;var f=this.ue;var h=c*e-f*b;var k=f*a-d*e;var g=d*b-c*a;this.h=k*f-g* +c;this.Va=g*d-h*f;this.Xa=h*c-k*d;this.Mc=h;this.Nc=k;this.Oc=g;this.tb=b*g-e*k;this.Fb=e*h-a*g;this.Gb=a*k-b*h;a=this.h*this.h+this.Va*this.Va+this.Xa*this.Xa;0=B?(a=Math.atan2(C,H),l=.5*a,B=-1.570796326794895,a=.5*-a):1<=B?(a=Math.atan2(C,H),l=.5*a,B=1.570796326794895,a*=.5):(l=Math.atan2(-(l* +t+n*x+p*v),m*t+q*x+r*v),B=Math.asin(B),a=Math.atan2(-(a*k+b*d+e*f),a*h+b*g+e*c));this.qe=l;this.Df=B;this.re=a;this.vd=this.ne-this.ke;this.ac=this.oe-this.le;this.bc=this.pe-this.me};cc.prototype.nd=function(a,b){za.prototype.nd.call(this,a,b);this.gd(b,a,!1)};cc.prototype.Ec=function(a){za.prototype.Ec.call(this,a);this.gd(a,null,!0)};cc.prototype.$d=function(){var a=new z;a.x=this.pb;a.y=this.qb;a.z=this.rb;return a};cc.prototype.be=function(){var a=new z;a.x=this.se;a.y=this.te;a.z=this.ue;return a}; +cc.prototype.ae=function(a){a.x=this.pb;a.y=this.qb;a.z=this.rb};cc.prototype.Qd=function(a){a.x=this.se;a.y=this.te;a.z=this.ue};cc.prototype.Rd=function(){var a=new z;a.x=this.i;a.y=this.C;a.z=this.I;return a};cc.prototype.Xe=function(){var a=new z;a.x=this.Rb;a.y=this.Sb;a.z=this.Wb;return a};cc.prototype.We=function(a){a.x=this.i;a.y=this.C;a.z=this.I};cc.prototype.Ye=function(a){a.x=this.Rb;a.y=this.Sb;a.z=this.Wb};cc.prototype.gi=function(){return this.tc};cc.prototype.hi=function(){return this.yc}; +cc.prototype.tg=function(){return this.Sh};cc.prototype.ug=function(){return this.Th};cc.prototype.Ze=function(){return this.qe};cc.prototype.sg=function(){return this.re};rl(Sj,qf);Sj.prototype.Ia=function(a,b,e,d,c){this.h(a,b,e);e=this.localAxis1;var f=d.x;var h=d.y;var k=d.z;d=a.g.A*f+a.g.o*h+a.g.u*k;var g=a.g.j*f+a.g.v*h+a.g.l*k;a=a.g.m*f+a.g.s*h+a.g.B*k;e.x=d;e.y=g;e.z=a;a=this.localAxis2;e=c.x;f=c.y;d=c.z;c=b.g.A*e+b.g.o*f+b.g.u*d;h=b.g.j*e+b.g.v*f+b.g.l*d;b=b.g.m*e+b.g.s*f+b.g.B*d;a.x=c;a.y= +h;a.z=b;return this};Bk.prototype.Ia=function(a){this.Ic=a.Ic;for(var b=0,e=this.Ic;bm?n.Qa:0q.Pa+ra.directMlcpSolverEps){b=!1;break}c[n]=r-p}if(!b)return!1;k=0;for(g=this.Ic;k +n&&l>ra.directMlcpSolverEps||0e.Pa;0==e.Qa&&0==e.Pa?(c=this.h,c.Qf[c.Ic]=b,c.Sf[c.Ic]=0,c.Ic++,this.I(a,b+1),this.h.Ic--):(e=this.h,e.xf[e.Md]=b,e.Md++,this.I(a,b+1),this.h.Md--,d&&(d=this.h,d.Qf[d.Ic]=b,d.Sf[d.Ic]=-1,d.Ic++,this.I(a,b+1),this.h.Ic--),c&&(c=this.h,c.Qf[c.Ic]=b, +c.Sf[c.Ic]=1,c.Ic++,this.I(a,b+1),this.h.Ic--))}};rl(yd,bd);yd.prototype.Rf=function(a){this.h.Gc();this.h.nd(a,this.info);this.J=this.info.Yd;this.K=this.info.Zd;this.W.I(this.info,this.I);a=this.i;a.i=0;var b=a.h;b.Ic=0;b.Md=0;a.I(this.info,0);a=this.qa;b=this.i.i;for(var e=0,d=0,c=0,f=a.C;c=b)for(b=0,a=this.info.La;bc.Pa&&(h=c.Pa);f.Aa=h;0c&&(h=c),f.Tc=h):f.Tc=0;this.C[d]=f.Aa+f.Tc}b=this.C;e=a=!1;d=this.J.ub;f=this.J.vb;c=this.J.wb;h=this.K.ub;var k=this.K.vb;var g=this.K.wb;var l=this.J.xb;var m=this.J.yb;var n=this.J.zb;var q=this.K.xb;var p=this.K.yb;var r=this.K.zb;for(var t=0,x=this.info.La;t< +x;){var v=t++,B=this.info.rows[v].Ea,H=this.I[v];v=b[v];0!=(B.sc&1)&&(d+=H.$c*v,f+=H.ad*v,c+=H.bd*v,h+=H.cd*-v,k+=H.dd*-v,g+=H.ed*-v,a=!0);0!=(B.sc&2)&&(l+=H.Uc*v,m+=H.Vc*v,n+=H.Wc*v,q+=H.Xc*-v,p+=H.Yc*-v,r+=H.Zc*-v,e=!0)}a&&(this.J.ub=d,this.J.vb=f,this.J.wb=c,this.K.ub=h,this.K.vb=k,this.K.wb=g);e&&(this.J.xb=l,this.J.yb=m,this.J.zb=n,this.K.xb=q,this.K.yb=p,this.K.zb=r)}};yd.prototype.Vf=function(){var a=this.info.La;var b=this.J.ub;var e=this.J.vb;var d=this.J.wb;var c=this.K.ub;var f=this.K.vb; +var h=this.K.wb;var k=this.J.xb;var g=this.J.yb;var l=this.J.zb;var m=this.K.xb;var n=this.K.yb;var q=this.K.zb;for(var p=0;pk&&(h=k),c.Tc=h,c=h-f,this.Y[d]=c,f=0;faa){var Ja=aa*aa;Ua=.5*(1-.16666666666666666*Ja+Ja*Ja*.008333333333333333);xa=1-.5*Ja+Ja*Ja*.041666666666666664}else Ua=Math.sin(aa)/Aa,xa=Math.cos(aa);var S=void 0,la=void 0,qa=void 0;S=pa*Ua;la=M*Ua;qa=Sa*Ua;var Da=void 0,X=void 0,fa=void 0, +w=void 0;Da=S;X=la;fa=qa;w=xa;var ja=void 0,ea=void 0,U=void 0,ba=void 0,Fa=D.g.A,ka=D.g.v,Qa=D.g.B,Ka=Fa+ka+Qa,V=void 0;0ka?Fa>Qa?(V=Math.sqrt(Fa-ka-Qa+1),ja=.5*V,V=.5/V,ea=(D.g.j+D.g.o)*V,U=(D.g.m+D.g.u)*V,ba=(D.g.l-D.g.s)*V):(V=Math.sqrt(Qa-Fa-ka+1),U=.5*V,V=.5/V,ja=(D.g.m+D.g.u)*V,ea=(D.g.s+D.g.l)*V,ba=(D.g.o-D.g.j)*V):ka>Qa?(V=Math.sqrt(ka-Qa-Fa+1),ea=.5*V,V=.5/V,ja=(D.g.j+D.g.o)*V,U=(D.g.s+D.g.l)* +V,ba=(D.g.m-D.g.u)*V):(V=Math.sqrt(Qa-Fa-ka+1),U=.5*V,V=.5/V,ja=(D.g.m+D.g.u)*V,ea=(D.g.s+D.g.l)*V,ba=(D.g.o-D.g.j)*V);ja=w*ja+Da*ba+X*U-fa*ea;ea=w*ea-Da*U+X*ba+fa*ja;U=w*U+Da*ea-X*ja+fa*ba;ba=w*ba-Da*ja-X*ea-fa*U;var ob=ja*ja+ea*ea+U*U+ba*ba;1E-32lb){var eb=lb*lb;yb=.5*(1-.16666666666666666*eb+eb*eb*.008333333333333333);vb=1-.5*eb+eb*eb*.041666666666666664}else yb=Math.sin(lb)/ub,vb=Math.cos(lb);var Lb=void 0,mb=void 0,zb=void 0;Lb=Pa*yb;mb=Ca*yb;zb=Ra*yb;var u=void 0,T=void 0,R=void 0,va=void 0;u=Lb;T=mb;R=zb;va=vb;var Na=void 0,ya=void 0,Oa=void 0, +kb=void 0,sb=F.g.A,Hb=F.g.v,Ba=F.g.B,Ta=sb+Hb+Ba,sa=void 0;0Hb?sb>Ba?(sa=Math.sqrt(sb-Hb-Ba+1),Na=.5*sa,sa=.5/sa,ya=(F.g.j+F.g.o)*sa,Oa=(F.g.m+F.g.u)*sa,kb=(F.g.l-F.g.s)*sa):(sa=Math.sqrt(Ba-sb-Hb+1),Oa=.5*sa,sa=.5/sa,Na=(F.g.m+F.g.u)*sa,ya=(F.g.s+F.g.l)*sa,kb=(F.g.o-F.g.j)*sa):Hb>Ba?(sa=Math.sqrt(Hb-Ba-sb+1),ya=.5*sa,sa=.5/sa,Na=(F.g.j+F.g.o)*sa,Oa=(F.g.s+F.g.l)*sa,kb=(F.g.m-F.g.u)*sa):(sa=Math.sqrt(Ba- +sb-Hb+1),Oa=.5*sa,sa=.5/sa,Na=(F.g.m+F.g.u)*sa,ya=(F.g.s+F.g.l)*sa,kb=(F.g.o-F.g.j)*sa);Na=va*Na+u*kb+T*Oa-R*ya;ya=va*ya-u*Oa+T*kb+R*Na;Oa=va*Oa+u*ya-T*Na+R*kb;kb=va*kb-u*Na-T*ya-R*Oa;var Ga=Na*Na+ya*ya+Oa*Oa+kb*kb;1E-32t*t&&(t/=Math.sqrt(B),x.xc*=t,x.wc*=t));B=x.xc-v;C=x.wc-H;a+=r.oi*B;b+=r.pi*B;e+=r.ri*B;a+=r.ii*C;b+=r.ji*C;e+=r.ki*C;d+=r.si*-B;c+=r.ti*-B;f+=r.ui*-B;d+=r.li*-C;c+=r.mi*-C;f+=r.ni*-C;h+=r.Ng*B;k+=r.Og*B;g+=r.Pg*B;h+=r.nh*C;k+=r.oh*C;g+=r.ph*C;l+= +r.Qg*-B;m+=r.Rg*-B;n+=r.Sg*-B;l+=r.qh*-C;m+=r.rh*-C;n+=r.sh*-C}q=0;for(p=this.info.La;qx.Hc&&(x.Hc=0),t=x.Hc-v,a+=r.gg*t,b+=r.hg*t,e+=r.ig*t,d+=r.jg*-t,c+=r.kg*-t,f+=r.lg*-t,h+=r.Pe*t,k+=r.Qe*t,g+=r.Re*t,l+=r.Se*-t,m+=r.Te*-t,n+=r.Ue*-t;this.J.ub=a;this.J.vb=b;this.J.wb=e;this.K.ub=d;this.K.vb=c;this.K.wb=f;this.J.xb= +h;this.J.yb=k;this.J.zb=g;this.K.xb=l;this.K.yb=m;this.K.zb=n};Nd.prototype.Bf=function(){this.i.Wh();this.i.Ec(this.info);var a=this.J.Ab,b=this.K.Ab;var e=this.J.ba;var d=this.J.ca;var c=this.J.da;var f=this.J.ea;var h=this.J.fa;var k=this.J.ga;var g=this.J.ha;var l=this.J.ia;var m=this.J.ja;var n=this.K.ba;var q=this.K.ca;var p=this.K.da;var r=this.K.ea;var t=this.K.fa;var x=this.K.ga;var v=this.K.ha;var B=this.K.ia;var H=this.K.ja;for(var C=0,N=this.info.La;Cx.Hb&&(x.Hb=0);t=x.Hb-v;a+=r.gg*t;b+=r.hg*t;e+=r.ig*t;d+=r.jg*-t;c+=r.kg*-t;f+=r.lg*-t;h+=r.Pe*t;k+=r.Qe*t;g+=r.Re* +t;l+=r.Se*-t;m+=r.Te*-t;n+=r.Ue*-t}this.J.Pc=a;this.J.Qc=b;this.J.Rc=e;this.K.Pc=d;this.K.Qc=c;this.K.Rc=f;this.J.Jc=h;this.J.Kc=k;this.J.Lc=g;this.K.Jc=l;this.K.Kc=m;this.K.Lc=n};Nd.prototype.Tf=function(){this.i.Wh();this.i.Ec(this.info);var a=this.J.Ab,b=this.K.Ab;var e=this.J.ba;var d=this.J.ca;var c=this.J.da;var f=this.J.ea;var h=this.J.fa;var k=this.J.ga;var g=this.J.ha;var l=this.J.ia;var m=this.J.ja;var n=this.K.ba;var q=this.K.ca;var p=this.K.da;var r=this.K.ea;var t=this.K.fa;var x=this.K.ga; +var v=this.K.ha;var B=this.K.ia;var H=this.K.ja;for(var C=0,N=this.info.La;CJa.Hb&&(Ja.Hb=0);qa=Ja.Hb-Da;Sa+=xa.gg*qa;Pa+=xa.hg*qa;Ca+=xa.ig*qa;Ra+=xa.jg*-qa;wa+=xa.kg*-qa;La+=xa.lg*-qa;Ea+=xa.Pe* +qa;O+=xa.Qe*qa;ma+=xa.Re*qa;Y+=xa.Se*-qa;ta+=xa.Te*-qa;Va+=xa.Ue*-qa}var X=this.J;X.g.F+=Sa;X.g.G+=Pa;X.g.H+=Ca;var fa=this.K;fa.g.F+=Ra;fa.g.G+=wa;fa.g.H+=La;var w=this.J,ja=Math.sqrt(Ea*Ea+O*O+ma*ma),ea=.5*ja;if(.5>ea){var U=ea*ea;var ba=.5*(1-.16666666666666666*U+U*U*.008333333333333333);var Fa=1-.5*U+U*U*.041666666666666664}else ba=Math.sin(ea)/ja,Fa=Math.cos(ea);var ka=Ea*ba;var Qa=O*ba;var Ka=ma*ba;var V=Fa;var ob=w.g.A,Za=w.g.v,W=w.g.B,ha=ob+Za+W;if(0Za?ob>W?(I=Math.sqrt(ob-Za-W+1),ca=.5*I,I=.5/I,da=(w.g.j+w.g.o)*I,Z=(w.g.m+w.g.u)*I,na=(w.g.l-w.g.s)*I):(I=Math.sqrt(W-ob-Za+1),Z=.5*I,I=.5/I,ca=(w.g.m+w.g.u)*I,da=(w.g.s+w.g.l)*I,na=(w.g.o-w.g.j)*I):Za>W?(I=Math.sqrt(Za-W-ob+1),da=.5*I,I=.5/I,ca=(w.g.j+w.g.o)*I,Z=(w.g.s+w.g.l)*I,na=(w.g.m-w.g.u)*I):(I=Math.sqrt(W-ob-Za+1),Z=.5*I,I=.5/I,ca=(w.g.m+w.g.u)*I,da=(w.g.s+w.g.l)*I,na=(w.g.o-w.g.j)*I);ca=V*ca+ka*na+Qa*Z-Ka* +da;da=V*da-ka*Z+Qa*na+Ka*ca;Z=V*Z+ka*da-Qa*ca+Ka*na;na=V*na-ka*ca-Qa*da-Ka*Z;var oa=ca*ca+da*da+Z*Z+na*na;1E-32R){var va=R*R;var Na=.5*(1-.16666666666666666*va+va*va*.008333333333333333); +var ya=1-.5*va+va*va*.041666666666666664}else Na=Math.sin(R)/T,ya=Math.cos(R);var Oa=Y*Na;var kb=ta*Na;var sb=Va*Na;var Hb=ya;var Ba=u.g.A,Ta=u.g.v,sa=u.g.B,Ga=Ba+Ta+sa;if(0Ta?Ba>sa?(Q=Math.sqrt(Ba-Ta-sa+1),Ia=.5*Q,Q=.5/Q,Eb=(u.g.j+u.g.o)*Q,wb=(u.g.m+u.g.u)*Q,Ma=(u.g.l-u.g.s)*Q):(Q=Math.sqrt(sa-Ba-Ta+1),wb=.5*Q,Q=.5/Q,Ia=(u.g.m+u.g.u)*Q,Eb=(u.g.s+u.g.l)*Q,Ma=(u.g.o-u.g.j)*Q): +Ta>sa?(Q=Math.sqrt(Ta-sa-Ba+1),Eb=.5*Q,Q=.5/Q,Ia=(u.g.j+u.g.o)*Q,wb=(u.g.s+u.g.l)*Q,Ma=(u.g.m-u.g.u)*Q):(Q=Math.sqrt(sa-Ba-Ta+1),wb=.5*Q,Q=.5/Q,Ia=(u.g.m+u.g.u)*Q,Eb=(u.g.s+u.g.l)*Q,Ma=(u.g.o-u.g.j)*Q);Ia=Hb*Ia+Oa*Ma+kb*wb-sb*Eb;Eb=Hb*Eb-Oa*wb+kb*Ma+sb*Ia;wb=Hb*wb+Oa*Eb-kb*Ia+sb*Ma;Ma=Hb*Ma-Oa*Ia-kb*Eb-sb*wb;var Mb=Ia*Ia+Eb*Eb+wb*wb+Ma*Ma;1E-32=b)for(b=0,a=this.info.La;bt.Db&&(x.Tc=t.Db);B=x.Tc-H;0!=(v.sc&1)&&(a+=r.$c*B,b+=r.ad*B,e+=r.bd*B,d+=r.cd*-B,c+=r.dd*-B,f+=r.ed*-B);0!=(v.sc&2)&&(h+=r.Uc*B,k+=r.Vc*B,g+=r.Wc*B,l+=r.Xc*-B,m+=r.Yc*-B,n+=r.Zc*-B)}}q=0;for(p=this.info.La;qt.Pa&&(x.Aa=t.Pa),B=x.Aa-H,0!=(v.sc&1)&&(a+=r.$c*B,b+=r.ad*B,e+=r.bd*B,d+=r.cd*-B,c+=r.dd*-B,f+=r.ed*-B),0!=(v.sc&2)&&(h+=r.Uc*B,k+=r.Vc*B,g+=r.Wc*B,l+=r.Xc*-B,m+=r.Yc*-B,n+=r.Zc*-B);this.J.ub=a;this.J.vb=b;this.J.wb=e;this.K.ub=d;this.K.vb=c;this.K.wb=f;this.J.xb=h;this.J.yb=k;this.J.zb=g;this.K.xb=l;this.K.yb=m;this.K.zb=n};xd.prototype.rg=function(a){for(var b,e,d,c,f,h,k=h=f=c=d= +e=b=0,g=this.info.La;kt.Pa&&(x.Hb=t.Pa);v=x.Hb-B;a+=r.$c*v;b+=r.ad*v;e+=r.bd*v;d+=r.cd*-v;c+=r.dd*-v;f+=r.ed*-v;h+=r.Uc*v;k+=r.Vc*v;g+=r.Wc*v;l+=r.Xc*-v;m+=r.Yc*-v;n+=r.Zc*-v}this.J.Pc=a;this.J.Qc=b;this.J.Rc=e;this.K.Pc=d;this.K.Qc=c;this.K.Rc=f;this.J.Jc= +h;this.J.Kc=k;this.J.Lc=g;this.K.Jc=l;this.K.Kc=m;this.K.Lc=n};xd.prototype.Tf=function(){this.h.Gc();this.h.Ec(this.info);this.J=this.info.Yd;this.K=this.info.Zd;var a=this.J.Ab,b=this.K.Ab;var e=this.J.ba;var d=this.J.ca;var c=this.J.da;var f=this.J.ea;var h=this.J.fa;var k=this.J.ga;var g=this.J.ha;var l=this.J.ia;var m=this.J.ja;var n=this.K.ba;var q=this.K.ca;var p=this.K.da;var r=this.K.ea;var t=this.K.fa;var x=this.K.ga;var v=this.K.ha;var B=this.K.ia;var H=this.K.ja;for(var C=0,N=this.info.La;C< +N;){var y=C++,A=this.i[y],E=this.info.rows[y].Ea;A.$c=E.Ba*a;A.ad=E.Ca*a;A.bd=E.Da*a;A.cd=E.Fa*b;A.dd=E.Ga*b;A.ed=E.Ha*b;var L=void 0,G=void 0,P=void 0;L=e*E.ka+d*E.la+c*E.ma;G=f*E.ka+h*E.la+k*E.ma;P=g*E.ka+l*E.la+m*E.ma;A.Uc=L;A.Vc=G;A.Wc=P;var K=void 0,pa=void 0,M=void 0;K=n*E.na+q*E.oa+p*E.pa;pa=r*E.na+t*E.oa+x*E.pa;M=v*E.na+B*E.oa+H*E.pa;A.Xc=K;A.Yc=pa;A.Zc=M;A.mass=A.$c*E.Ba+A.ad*E.Ca+A.bd*E.Da+(A.cd*E.Fa+A.dd*E.Ga+A.ed*E.Ha)+(A.Uc*E.ka+A.Vc*E.la+A.Wc*E.ma)+(A.Xc*E.na+A.Yc*E.oa+A.Zc*E.pa);0!= +A.mass&&(A.mass=1/A.mass)}for(var Sa,Pa,Ca,Ra,wa,La,Ea,O,ma,Y,ta,Va,D=Va=ta=Y=ma=O=Ea=La=wa=Ra=Ca=Pa=Sa=0,Aa=this.info.La;DUa.Pa&&(Ja.Hb=Ua.Pa);qa=Ja.Hb-Da;Sa+=xa.$c*qa;Pa+=xa.ad*qa;Ca+=xa.bd*qa;Ra+=xa.cd*-qa;wa+=xa.dd* +-qa;La+=xa.ed*-qa;Ea+=xa.Uc*qa;O+=xa.Vc*qa;ma+=xa.Wc*qa;Y+=xa.Xc*-qa;ta+=xa.Yc*-qa;Va+=xa.Zc*-qa}var X=this.J;X.g.F+=Sa;X.g.G+=Pa;X.g.H+=Ca;var fa=this.K;fa.g.F+=Ra;fa.g.G+=wa;fa.g.H+=La;var w=this.J,ja=Math.sqrt(Ea*Ea+O*O+ma*ma),ea=.5*ja;if(.5>ea){var U=ea*ea;var ba=.5*(1-.16666666666666666*U+U*U*.008333333333333333);var Fa=1-.5*U+U*U*.041666666666666664}else ba=Math.sin(ea)/ja,Fa=Math.cos(ea);var ka=Ea*ba;var Qa=O*ba;var Ka=ma*ba;var V=Fa;var ob=w.g.A,Za=w.g.v,W=w.g.B,ha=ob+Za+W;if(0Za?ob>W?(I=Math.sqrt(ob-Za-W+1),ca=.5*I,I=.5/I,da=(w.g.j+w.g.o)*I,Z=(w.g.m+w.g.u)*I,na=(w.g.l-w.g.s)*I):(I=Math.sqrt(W-ob-Za+1),Z=.5*I,I=.5/I,ca=(w.g.m+w.g.u)*I,da=(w.g.s+w.g.l)*I,na=(w.g.o-w.g.j)*I):Za>W?(I=Math.sqrt(Za-W-ob+1),da=.5*I,I=.5/I,ca=(w.g.j+w.g.o)*I,Z=(w.g.s+w.g.l)*I,na=(w.g.m-w.g.u)*I):(I=Math.sqrt(W-ob-Za+1),Z=.5*I,I=.5/I,ca=(w.g.m+w.g.u)*I,da=(w.g.s+w.g.l)*I,na=(w.g.o-w.g.j)* +I);ca=V*ca+ka*na+Qa*Z-Ka*da;da=V*da-ka*Z+Qa*na+Ka*ca;Z=V*Z+ka*da-Qa*ca+Ka*na;na=V*na-ka*ca-Qa*da-Ka*Z;var oa=ca*ca+da*da+Z*Z+na*na;1E-32R){var va=R*R;var Na=.5*(1-.16666666666666666*va+va* +va*.008333333333333333);var ya=1-.5*va+va*va*.041666666666666664}else Na=Math.sin(R)/T,ya=Math.cos(R);var Oa=Y*Na;var kb=ta*Na;var sb=Va*Na;var Hb=ya;var Ba=u.g.A,Ta=u.g.v,sa=u.g.B,Ga=Ba+Ta+sa;if(0Ta?Ba>sa?(Q=Math.sqrt(Ba-Ta-sa+1),Ia=.5*Q,Q=.5/Q,Eb=(u.g.j+u.g.o)*Q,wb=(u.g.m+u.g.u)*Q,Ma=(u.g.l-u.g.s)*Q):(Q=Math.sqrt(sa-Ba-Ta+1),wb=.5*Q,Q=.5/Q,Ia=(u.g.m+u.g.u)*Q,Eb=(u.g.s+u.g.l)* +Q,Ma=(u.g.o-u.g.j)*Q):Ta>sa?(Q=Math.sqrt(Ta-sa-Ba+1),Eb=.5*Q,Q=.5/Q,Ia=(u.g.j+u.g.o)*Q,wb=(u.g.s+u.g.l)*Q,Ma=(u.g.m-u.g.u)*Q):(Q=Math.sqrt(sa-Ba-Ta+1),wb=.5*Q,Q=.5/Q,Ia=(u.g.m+u.g.u)*Q,Eb=(u.g.s+u.g.l)*Q,Ma=(u.g.o-u.g.j)*Q);Ia=Hb*Ia+Oa*Ma+kb*wb-sb*Eb;Eb=Hb*Eb-Oa*wb+kb*Ma+sb*Ia;wb=Hb*wb+Oa*Eb-kb*Ia+sb*Ma;Ma=Hb*Ma-Oa*Ia-kb*Eb-sb*wb;var Mb=Ia*Ia+Eb*Eb+wb*wb+Ma*Ma;1E-32 +ra.maxTranslationPerStep*ra.maxTranslationPerStep&&(h=ra.maxTranslationPerStep/Math.sqrt(h),this.ub*=h,this.vb*=h,this.wb*=h,b*=h,e*=h,d*=h);k>ra.maxRotationPerStep*ra.maxRotationPerStep&&(k=ra.maxRotationPerStep/Math.sqrt(k),this.xb*=k,this.yb*=k,this.zb*=k,c*=k,f*=k,a*=k);this.g.F+=b;this.g.G+=e;this.g.H+=d;b=Math.sqrt(c*c+f*f+a*a);e=.5*b;.5>e?(e*=e,b=.5*(1-.16666666666666666*e+e*e*.008333333333333333),e=1-.5*e+e*e*.041666666666666664):(b=Math.sin(e)/b,e=Math.cos(e));c*=b;f*=b;a*=b;b=e;e=this.g.A; +d=this.g.v;k=this.g.B;h=e+d+k;if(0d?e>k?(g=Math.sqrt(e-d-k+1),h=.5*g,g=.5/g,k=(this.g.j+this.g.o)*g,d=(this.g.m+this.g.u)*g,e=(this.g.l-this.g.s)*g):(g=Math.sqrt(k-e-d+1),d=.5*g,g=.5/g,h=(this.g.m+this.g.u)*g,k=(this.g.s+this.g.l)*g,e=(this.g.o-this.g.j)*g):d>k?(g=Math.sqrt(d-k-e+1),k=.5*g,g=.5/g,h=(this.g.j+this.g.o)*g,d=(this.g.s+this.g.l)*g,e=(this.g.m-this.g.u)*g):(g=Math.sqrt(k- +e-d+1),d=.5*g,g=.5/g,h=(this.g.m+this.g.u)*g,k=(this.g.s+this.g.l)*g,e=(this.g.o-this.g.j)*g);h=b*h+c*e+f*d-a*k;k=b*k-c*d+f*e+a*h;d=b*d+c*k-f*h+a*e;e=b*e-c*h-f*k-a*d;a=h*h+k*k+d*d+e*e;1E-32b?(b*=b,a=.5*(1-.16666666666666666*b+b*b*.008333333333333333),b=1-.5*b+b*b*.041666666666666664):(a=Math.sin(b)/a,b=Math.cos(b));d*=a;c*=a;f*=a;a=b;b=this.g.A;e=this.g.v;var h=this.g.B;var k=b+e+h;if(0e?b>h?(g=Math.sqrt(b-e-h+1),k=.5*g,g=.5/g,h=(this.g.j+ +this.g.o)*g,e=(this.g.m+this.g.u)*g,b=(this.g.l-this.g.s)*g):(g=Math.sqrt(h-b-e+1),e=.5*g,g=.5/g,k=(this.g.m+this.g.u)*g,h=(this.g.s+this.g.l)*g,b=(this.g.o-this.g.j)*g):e>h?(g=Math.sqrt(e-h-b+1),h=.5*g,g=.5/g,k=(this.g.j+this.g.o)*g,e=(this.g.s+this.g.l)*g,b=(this.g.m-this.g.u)*g):(g=Math.sqrt(h-b-e+1),e=.5*g,g=.5/g,k=(this.g.m+this.g.u)*g,h=(this.g.s+this.g.l)*g,b=(this.g.o-this.g.j)*g);k=a*k+d*b+c*e-f*h;h=a*h-d*e+c*b+f*k;e=a*e+d*h-c*k+f*b;b=a*b-d*k-c*h-f*e;c=k*k+h*h+e*e+b*b;1E-32d||1E-32a.D.ta?f:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(d=a.g.F-a.za.F,e=a.g.G-a.za.G,c=a.g.H-a.za.H,f=a.qc,f.x=d,f.y=e,f.z=c,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=b}this.Ob=!1;this.Kb=0};J.prototype.tf=function(a){var b=a.x;var e=a.y;a=a.z;this.g.F+=b;this.g.G+=e;this.g.H+=a;b=this.za;e=this.g;b.F=e.F;b.G=e.G;b.H=e.H;b.A=e.A;b.j=e.j;b.m=e.m;b.o=e.o;b.v=e.v;b.s=e.s;b.u=e.u;b.l=e.l;b.B=e.B;for(b=this.vc;null!= +b;){e=b.U;var d=this.za;a=this.g;var c=b.za,f=b.ra;var h=d.A*f.A+d.j*f.o+d.m*f.u;var k=d.A*f.j+d.j*f.v+d.m*f.l;var g=d.A*f.m+d.j*f.s+d.m*f.B;var l=d.o*f.A+d.v*f.o+d.s*f.u;var m=d.o*f.j+d.v*f.v+d.s*f.l;var n=d.o*f.m+d.v*f.s+d.s*f.B;var q=d.u*f.A+d.l*f.o+d.B*f.u;var p=d.u*f.j+d.l*f.v+d.B*f.l;var r=d.u*f.m+d.l*f.s+d.B*f.B;c.A=h;c.j=k;c.m=g;c.o=l;c.v=m;c.s=n;c.u=q;c.l=p;c.B=r;h=d.A*f.F+d.j*f.G+d.m*f.H;k=d.o*f.F+d.v*f.G+d.s*f.H;f=d.u*f.F+d.l*f.G+d.B*f.H;c.F=h;c.G=k;c.H=f;c.F+=d.F;c.G+=d.G;c.H+=d.H;d=b.g; +c=b.ra;f=a.A*c.A+a.j*c.o+a.m*c.u;h=a.A*c.j+a.j*c.v+a.m*c.l;k=a.A*c.m+a.j*c.s+a.m*c.B;g=a.o*c.A+a.v*c.o+a.s*c.u;l=a.o*c.j+a.v*c.v+a.s*c.l;m=a.o*c.m+a.v*c.s+a.s*c.B;n=a.u*c.A+a.l*c.o+a.B*c.u;q=a.u*c.j+a.l*c.v+a.B*c.l;p=a.u*c.m+a.l*c.s+a.B*c.B;d.A=f;d.j=h;d.m=k;d.o=g;d.v=l;d.s=m;d.u=n;d.l=q;d.B=p;f=a.A*c.F+a.j*c.G+a.m*c.H;h=a.o*c.F+a.v*c.G+a.s*c.H;c=a.u*c.F+a.l*c.G+a.B*c.H;d.F=f;d.G=h;d.H=c;d.F+=a.F;d.G+=a.G;d.H+=a.H;b.Tb.Yb(b.D,b.za);a=b.D.wa;d=b.D.xa;c=b.D.ya;f=b.D.ta;h=b.D.ua;k=b.D.va;b.Tb.Yb(b.D, +b.g);b.D.wa=ab.D.ta?f:b.D.ta;b.D.ua=h>b.D.ua?h:b.D.ua;b.D.va=k>b.D.va?k:b.D.va;null!=b.Eb&&(a=b.g.F-b.za.F,d=b.g.G-b.za.G,c=b.g.H-b.za.H,f=b.qc,f.x=a,f.y=d,f.z=c,b.hc.pc.nc.fd(b.Eb,b.D,b.qc));b=e}this.Ob=!1;this.Kb=0};J.prototype.Fb=function(){var a=new ia;a.e00=this.g.A;a.e01=this.g.j;a.e02=this.g.m;a.e10=this.g.o;a.e11=this.g.v;a.e12=this.g.s;a.e20=this.g.u;a.e21=this.g.l;a.e22=this.g.B;return a};J.prototype.Gb=function(a){a.e00= +this.g.A;a.e01=this.g.j;a.e02=this.g.m;a.e10=this.g.o;a.e11=this.g.v;a.e12=this.g.s;a.e20=this.g.u;a.e21=this.g.l;a.e22=this.g.B};J.prototype.Ie=function(a){this.g.A=a.e00;this.g.j=a.e01;this.g.m=a.e02;this.g.o=a.e10;this.g.v=a.e11;this.g.s=a.e12;this.g.u=a.e20;this.g.l=a.e21;this.g.B=a.e22;a=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;var b=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;var e=this.g.A*this.eb+this.g.j*this.hb+this.g.m*this.kb;var d=this.g.o*this.bb+this.g.v*this.fb+this.g.s* +this.ib;var c=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;var f=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;var h=this.g.u*this.bb+this.g.l*this.fb+this.g.B*this.ib;var k=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;var g=this.g.u*this.eb+this.g.l*this.hb+this.g.B*this.kb;this.ba=a;this.ca=b;this.da=e;this.ea=d;this.fa=c;this.ga=f;this.ha=h;this.ia=k;this.ja=g;a=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;b=this.ba*this.g.o+this.ca*this.g.v+this.da*this.g.s;e=this.ba*this.g.u+ +this.ca*this.g.l+this.da*this.g.B;d=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;c=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;f=this.ea*this.g.u+this.fa*this.g.l+this.ga*this.g.B;h=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;k=this.ha*this.g.o+this.ia*this.g.v+this.ja*this.g.s;g=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=a;this.ca=b;this.da=e;this.ea=d;this.fa=c;this.ga=f;this.ha=h;this.ia=k;this.ja=g;this.ba*=this.X.x;this.ca*=this.X.x;this.da*=this.X.x;this.ea*= +this.X.y;this.fa*=this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;a=this.za;b=this.g;a.F=b.F;a.G=b.G;a.H=b.H;a.A=b.A;a.j=b.j;a.m=b.m;a.o=b.o;a.v=b.v;a.s=b.s;a.u=b.u;a.l=b.l;a.B=b.B;for(a=this.vc;null!=a;){b=a.U;d=this.za;e=this.g;c=a.za;f=a.ra;h=d.A*f.A+d.j*f.o+d.m*f.u;k=d.A*f.j+d.j*f.v+d.m*f.l;g=d.A*f.m+d.j*f.s+d.m*f.B;var l=d.o*f.A+d.v*f.o+d.s*f.u;var m=d.o*f.j+d.v*f.v+d.s*f.l;var n=d.o*f.m+d.v*f.s+d.s*f.B;var q=d.u*f.A+d.l*f.o+d.B*f.u;var p=d.u*f.j+d.l*f.v+d.B* +f.l;var r=d.u*f.m+d.l*f.s+d.B*f.B;c.A=h;c.j=k;c.m=g;c.o=l;c.v=m;c.s=n;c.u=q;c.l=p;c.B=r;h=d.A*f.F+d.j*f.G+d.m*f.H;k=d.o*f.F+d.v*f.G+d.s*f.H;f=d.u*f.F+d.l*f.G+d.B*f.H;c.F=h;c.G=k;c.H=f;c.F+=d.F;c.G+=d.G;c.H+=d.H;d=a.g;c=a.ra;f=e.A*c.A+e.j*c.o+e.m*c.u;h=e.A*c.j+e.j*c.v+e.m*c.l;k=e.A*c.m+e.j*c.s+e.m*c.B;g=e.o*c.A+e.v*c.o+e.s*c.u;l=e.o*c.j+e.v*c.v+e.s*c.l;m=e.o*c.m+e.v*c.s+e.s*c.B;n=e.u*c.A+e.l*c.o+e.B*c.u;q=e.u*c.j+e.l*c.v+e.B*c.l;p=e.u*c.m+e.l*c.s+e.B*c.B;d.A=f;d.j=h;d.m=k;d.o=g;d.v=l;d.s=m;d.u=n;d.l= +q;d.B=p;f=e.A*c.F+e.j*c.G+e.m*c.H;h=e.o*c.F+e.v*c.G+e.s*c.H;c=e.u*c.F+e.l*c.G+e.B*c.H;d.F=f;d.G=h;d.H=c;d.F+=e.F;d.G+=e.G;d.H+=e.H;a.Tb.Yb(a.D,a.za);e=a.D.wa;d=a.D.xa;c=a.D.ya;f=a.D.ta;h=a.D.ua;k=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=ea.D.ta?f:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(e=a.g.F-a.za.F,d=a.g.G-a.za.G,c=a.g.H-a.za.H,f=a.qc,f.x=e,f.y=d,f.z=c,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=b}this.Ob=!1;this.Kb= +0};J.prototype.rf=function(a){var b=a.x;var e=a.y;var d=a.z;a=Math.sin(b);var c=Math.sin(e),f=Math.sin(d);b=Math.cos(b);e=Math.cos(e);d=Math.cos(d);this.g.A=e*d;this.g.j=-e*f;this.g.m=c;this.g.o=b*f+d*a*c;this.g.v=b*d-a*c*f;this.g.s=-e*a;this.g.u=a*f-b*d*c;this.g.l=d*a+b*c*f;this.g.B=b*e;a=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;c=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;f=this.g.A*this.eb+this.g.j*this.hb+this.g.m*this.kb;e=this.g.o*this.bb+this.g.v*this.fb+this.g.s*this.ib; +d=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;b=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;var h=this.g.u*this.bb+this.g.l*this.fb+this.g.B*this.ib;var k=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;var g=this.g.u*this.eb+this.g.l*this.hb+this.g.B*this.kb;this.ba=a;this.ca=c;this.da=f;this.ea=e;this.fa=d;this.ga=b;this.ha=h;this.ia=k;this.ja=g;a=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;c=this.ba*this.g.o+this.ca*this.g.v+this.da*this.g.s;f=this.ba*this.g.u+this.ca*this.g.l+ +this.da*this.g.B;e=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;d=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;b=this.ea*this.g.u+this.fa*this.g.l+this.ga*this.g.B;h=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;k=this.ha*this.g.o+this.ia*this.g.v+this.ja*this.g.s;g=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=a;this.ca=c;this.da=f;this.ea=e;this.fa=d;this.ga=b;this.ha=h;this.ia=k;this.ja=g;this.ba*=this.X.x;this.ca*=this.X.x;this.da*=this.X.x;this.ea*=this.X.y;this.fa*= +this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;a=this.za;c=this.g;a.F=c.F;a.G=c.G;a.H=c.H;a.A=c.A;a.j=c.j;a.m=c.m;a.o=c.o;a.v=c.v;a.s=c.s;a.u=c.u;a.l=c.l;a.B=c.B;for(a=this.vc;null!=a;){c=a.U;e=this.za;f=this.g;d=a.za;b=a.ra;h=e.A*b.A+e.j*b.o+e.m*b.u;k=e.A*b.j+e.j*b.v+e.m*b.l;g=e.A*b.m+e.j*b.s+e.m*b.B;var l=e.o*b.A+e.v*b.o+e.s*b.u;var m=e.o*b.j+e.v*b.v+e.s*b.l;var n=e.o*b.m+e.v*b.s+e.s*b.B;var q=e.u*b.A+e.l*b.o+e.B*b.u;var p=e.u*b.j+e.l*b.v+e.B*b.l;var r=e.u*b.m+ +e.l*b.s+e.B*b.B;d.A=h;d.j=k;d.m=g;d.o=l;d.v=m;d.s=n;d.u=q;d.l=p;d.B=r;h=e.A*b.F+e.j*b.G+e.m*b.H;k=e.o*b.F+e.v*b.G+e.s*b.H;b=e.u*b.F+e.l*b.G+e.B*b.H;d.F=h;d.G=k;d.H=b;d.F+=e.F;d.G+=e.G;d.H+=e.H;e=a.g;d=a.ra;b=f.A*d.A+f.j*d.o+f.m*d.u;h=f.A*d.j+f.j*d.v+f.m*d.l;k=f.A*d.m+f.j*d.s+f.m*d.B;g=f.o*d.A+f.v*d.o+f.s*d.u;l=f.o*d.j+f.v*d.v+f.s*d.l;m=f.o*d.m+f.v*d.s+f.s*d.B;n=f.u*d.A+f.l*d.o+f.B*d.u;q=f.u*d.j+f.l*d.v+f.B*d.l;p=f.u*d.m+f.l*d.s+f.B*d.B;e.A=b;e.j=h;e.m=k;e.o=g;e.v=l;e.s=m;e.u=n;e.l=q;e.B=p;b=f.A*d.F+ +f.j*d.G+f.m*d.H;h=f.o*d.F+f.v*d.G+f.s*d.H;d=f.u*d.F+f.l*d.G+f.B*d.H;e.F=b;e.G=h;e.H=d;e.F+=f.F;e.G+=f.G;e.H+=f.H;a.Tb.Yb(a.D,a.za);f=a.D.wa;e=a.D.xa;d=a.D.ya;b=a.D.ta;h=a.D.ua;k=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=fa.D.ta?b:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(f=a.g.F-a.za.F,e=a.g.G-a.za.G,d=a.g.H-a.za.H,b=a.qc,b.x=f,b.y=e,b.z=d,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=c}this.Ob=!1;this.Kb=0};J.prototype.Ed= +function(a){var b=a.e00;var e=a.e01;var d=a.e02;var c=a.e10;var f=a.e11;var h=a.e12;var k=a.e20;var g=a.e21;var l=a.e22;a=b*this.g.A+e*this.g.o+d*this.g.u;var m=b*this.g.j+e*this.g.v+d*this.g.l;b=b*this.g.m+e*this.g.s+d*this.g.B;e=c*this.g.A+f*this.g.o+h*this.g.u;d=c*this.g.j+f*this.g.v+h*this.g.l;c=c*this.g.m+f*this.g.s+h*this.g.B;f=k*this.g.A+g*this.g.o+l*this.g.u;h=k*this.g.j+g*this.g.v+l*this.g.l;k=k*this.g.m+g*this.g.s+l*this.g.B;this.g.A=a;this.g.j=m;this.g.m=b;this.g.o=e;this.g.v=d;this.g.s= +c;this.g.u=f;this.g.l=h;this.g.B=k;k=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;g=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;a=this.g.A*this.eb+this.g.j*this.hb+this.g.m*this.kb;m=this.g.o*this.bb+this.g.v*this.fb+this.g.s*this.ib;l=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;c=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;f=this.g.u*this.bb+this.g.l*this.fb+this.g.B*this.ib;h=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;b=this.g.u*this.eb+this.g.l*this.hb+this.g.B* +this.kb;this.ba=k;this.ca=g;this.da=a;this.ea=m;this.fa=l;this.ga=c;this.ha=f;this.ia=h;this.ja=b;k=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;g=this.ba*this.g.o+this.ca*this.g.v+this.da*this.g.s;a=this.ba*this.g.u+this.ca*this.g.l+this.da*this.g.B;m=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;l=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;c=this.ea*this.g.u+this.fa*this.g.l+this.ga*this.g.B;f=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;h=this.ha*this.g.o+this.ia*this.g.v+ +this.ja*this.g.s;b=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=k;this.ca=g;this.da=a;this.ea=m;this.fa=l;this.ga=c;this.ha=f;this.ia=h;this.ja=b;this.ba*=this.X.x;this.ca*=this.X.x;this.da*=this.X.x;this.ea*=this.X.y;this.fa*=this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;k=this.za;g=this.g;k.F=g.F;k.G=g.G;k.H=g.H;k.A=g.A;k.j=g.j;k.m=g.m;k.o=g.o;k.v=g.v;k.s=g.s;k.u=g.u;k.l=g.l;k.B=g.B;for(k=this.vc;null!=k;){g=k.U;m=this.za;a=this.g;l=k.za;c=k.ra;f= +m.A*c.A+m.j*c.o+m.m*c.u;h=m.A*c.j+m.j*c.v+m.m*c.l;b=m.A*c.m+m.j*c.s+m.m*c.B;e=m.o*c.A+m.v*c.o+m.s*c.u;d=m.o*c.j+m.v*c.v+m.s*c.l;var n=m.o*c.m+m.v*c.s+m.s*c.B;var q=m.u*c.A+m.l*c.o+m.B*c.u;var p=m.u*c.j+m.l*c.v+m.B*c.l;var r=m.u*c.m+m.l*c.s+m.B*c.B;l.A=f;l.j=h;l.m=b;l.o=e;l.v=d;l.s=n;l.u=q;l.l=p;l.B=r;f=m.A*c.F+m.j*c.G+m.m*c.H;h=m.o*c.F+m.v*c.G+m.s*c.H;c=m.u*c.F+m.l*c.G+m.B*c.H;l.F=f;l.G=h;l.H=c;l.F+=m.F;l.G+=m.G;l.H+=m.H;m=k.g;l=k.ra;c=a.A*l.A+a.j*l.o+a.m*l.u;f=a.A*l.j+a.j*l.v+a.m*l.l;h=a.A*l.m+a.j* +l.s+a.m*l.B;b=a.o*l.A+a.v*l.o+a.s*l.u;e=a.o*l.j+a.v*l.v+a.s*l.l;d=a.o*l.m+a.v*l.s+a.s*l.B;n=a.u*l.A+a.l*l.o+a.B*l.u;q=a.u*l.j+a.l*l.v+a.B*l.l;p=a.u*l.m+a.l*l.s+a.B*l.B;m.A=c;m.j=f;m.m=h;m.o=b;m.v=e;m.s=d;m.u=n;m.l=q;m.B=p;c=a.A*l.F+a.j*l.G+a.m*l.H;f=a.o*l.F+a.v*l.G+a.s*l.H;l=a.u*l.F+a.l*l.G+a.B*l.H;m.F=c;m.G=f;m.H=l;m.F+=a.F;m.G+=a.G;m.H+=a.H;k.Tb.Yb(k.D,k.za);a=k.D.wa;m=k.D.xa;l=k.D.ya;c=k.D.ta;f=k.D.ua;h=k.D.va;k.Tb.Yb(k.D,k.g);k.D.wa=ak.D.ta?c:k.D.ta;k.D.ua=f>k.D.ua?f:k.D.ua;k.D.va=h>k.D.va?h:k.D.va;null!=k.Eb&&(a=k.g.F-k.za.F,m=k.g.G-k.za.G,l=k.g.H-k.za.H,c=k.qc,c.x=a,c.y=m,c.z=l,k.hc.pc.nc.fd(k.Eb,k.D,k.qc));k=g}this.Ob=!1;this.Kb=0};J.prototype.ce=function(a){var b=a.x;var e=a.y;a=a.z;var d=Math.sin(b);var c=Math.sin(e),f=Math.sin(a),h=Math.cos(b);var k=Math.cos(e);var g=Math.cos(a);var l=k*g;var m=-k*f;a=h*f+g*d*c;b=h*g-d*c*f;var n=-k*d;e=d*f-h*g*c;d=g*d+h*c*f;k*=h;f=l*this.g.A+m*this.g.o+c*this.g.u;h=l*this.g.j+ +m*this.g.v+c*this.g.l;c=l*this.g.m+m*this.g.s+c*this.g.B;l=a*this.g.A+b*this.g.o+n*this.g.u;m=a*this.g.j+b*this.g.v+n*this.g.l;a=a*this.g.m+b*this.g.s+n*this.g.B;b=e*this.g.A+d*this.g.o+k*this.g.u;n=e*this.g.j+d*this.g.v+k*this.g.l;e=e*this.g.m+d*this.g.s+k*this.g.B;this.g.A=f;this.g.j=h;this.g.m=c;this.g.o=l;this.g.v=m;this.g.s=a;this.g.u=b;this.g.l=n;this.g.B=e;e=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;a=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;b=this.g.A*this.eb+this.g.j*this.hb+ +this.g.m*this.kb;n=this.g.o*this.bb+this.g.v*this.fb+this.g.s*this.ib;d=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;c=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;f=this.g.u*this.bb+this.g.l*this.fb+this.g.B*this.ib;h=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;k=this.g.u*this.eb+this.g.l*this.hb+this.g.B*this.kb;this.ba=e;this.ca=a;this.da=b;this.ea=n;this.fa=d;this.ga=c;this.ha=f;this.ia=h;this.ja=k;e=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;a=this.ba*this.g.o+this.ca* +this.g.v+this.da*this.g.s;b=this.ba*this.g.u+this.ca*this.g.l+this.da*this.g.B;n=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;d=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;c=this.ea*this.g.u+this.fa*this.g.l+this.ga*this.g.B;f=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;h=this.ha*this.g.o+this.ia*this.g.v+this.ja*this.g.s;k=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=e;this.ca=a;this.da=b;this.ea=n;this.fa=d;this.ga=c;this.ha=f;this.ia=h;this.ja=k;this.ba*=this.X.x; +this.ca*=this.X.x;this.da*=this.X.x;this.ea*=this.X.y;this.fa*=this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;e=this.za;a=this.g;e.F=a.F;e.G=a.G;e.H=a.H;e.A=a.A;e.j=a.j;e.m=a.m;e.o=a.o;e.v=a.v;e.s=a.s;e.u=a.u;e.l=a.l;e.B=a.B;for(e=this.vc;null!=e;){a=e.U;n=this.za;b=this.g;d=e.za;c=e.ra;f=n.A*c.A+n.j*c.o+n.m*c.u;h=n.A*c.j+n.j*c.v+n.m*c.l;k=n.A*c.m+n.j*c.s+n.m*c.B;l=n.o*c.A+n.v*c.o+n.s*c.u;m=n.o*c.j+n.v*c.v+n.s*c.l;g=n.o*c.m+n.v*c.s+n.s*c.B;var q=n.u*c.A+n.l*c.o+n.B* +c.u;var p=n.u*c.j+n.l*c.v+n.B*c.l;var r=n.u*c.m+n.l*c.s+n.B*c.B;d.A=f;d.j=h;d.m=k;d.o=l;d.v=m;d.s=g;d.u=q;d.l=p;d.B=r;f=n.A*c.F+n.j*c.G+n.m*c.H;h=n.o*c.F+n.v*c.G+n.s*c.H;c=n.u*c.F+n.l*c.G+n.B*c.H;d.F=f;d.G=h;d.H=c;d.F+=n.F;d.G+=n.G;d.H+=n.H;n=e.g;d=e.ra;c=b.A*d.A+b.j*d.o+b.m*d.u;f=b.A*d.j+b.j*d.v+b.m*d.l;h=b.A*d.m+b.j*d.s+b.m*d.B;k=b.o*d.A+b.v*d.o+b.s*d.u;l=b.o*d.j+b.v*d.v+b.s*d.l;m=b.o*d.m+b.v*d.s+b.s*d.B;g=b.u*d.A+b.l*d.o+b.B*d.u;q=b.u*d.j+b.l*d.v+b.B*d.l;p=b.u*d.m+b.l*d.s+b.B*d.B;n.A=c;n.j=f;n.m= +h;n.o=k;n.v=l;n.s=m;n.u=g;n.l=q;n.B=p;c=b.A*d.F+b.j*d.G+b.m*d.H;f=b.o*d.F+b.v*d.G+b.s*d.H;d=b.u*d.F+b.l*d.G+b.B*d.H;n.F=c;n.G=f;n.H=d;n.F+=b.F;n.G+=b.G;n.H+=b.H;e.Tb.Yb(e.D,e.za);b=e.D.wa;n=e.D.xa;d=e.D.ya;c=e.D.ta;f=e.D.ua;h=e.D.va;e.Tb.Yb(e.D,e.g);e.D.wa=be.D.ta?c:e.D.ta;e.D.ua=f>e.D.ua?f:e.D.ua;e.D.va=h>e.D.va?h:e.D.va;null!=e.Eb&&(b=e.g.F-e.za.F,n=e.g.G-e.za.G,d=e.g.H-e.za.H,c=e.qc,c.x=b,c.y=n,c.z=d,e.hc.pc.nc.fd(e.Eb, +e.D,e.qc));e=a}this.Ob=!1;this.Kb=0};J.prototype.Sb=function(){var a=new Gb;var b=this.g.A;var e=this.g.v;var d=this.g.B;var c=b+e+d;if(0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.g.j+this.g.o)*f,d=(this.g.m+this.g.u)*f,c=(this.g.l-this.g.s)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.g.m+this.g.u)*f,e=(this.g.s+this.g.l)*f,c=(this.g.o-this.g.j)*f):e>d?(f=Math.sqrt(e-d-b+ +1),e=.5*f,f=.5/f,b=(this.g.j+this.g.o)*f,d=(this.g.s+this.g.l)*f,c=(this.g.m-this.g.u)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.g.m+this.g.u)*f,e=(this.g.s+this.g.l)*f,c=(this.g.o-this.g.j)*f);a.x=b;a.y=e;a.z=d;a.w=c;return a};J.prototype.Wb=function(a){var b=this.g.A;var e=this.g.v;var d=this.g.B;var c=b+e+d;if(0e?b>d?(f=Math.sqrt(b-e-d+1),b=.5*f,f=.5/f,e=(this.g.j+this.g.o)* +f,d=(this.g.m+this.g.u)*f,c=(this.g.l-this.g.s)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.g.m+this.g.u)*f,e=(this.g.s+this.g.l)*f,c=(this.g.o-this.g.j)*f):e>d?(f=Math.sqrt(e-d-b+1),e=.5*f,f=.5/f,b=(this.g.j+this.g.o)*f,d=(this.g.s+this.g.l)*f,c=(this.g.m-this.g.u)*f):(f=Math.sqrt(d-b-e+1),d=.5*f,f=.5/f,b=(this.g.m+this.g.u)*f,e=(this.g.s+this.g.l)*f,c=(this.g.o-this.g.j)*f);a.x=b;a.y=e;a.z=d;a.w=c};J.prototype.je=function(a){var b=a.x;var e=a.y;var d=a.z;var c=a.w,f=2*b,h=2*e,k=2*d;a=b*f;var g= +e*h;d*=k;var l=b*h;e*=k;b*=k;f*=c;h*=c;c*=k;this.g.A=1-g-d;this.g.j=l-c;this.g.m=b+h;this.g.o=l+c;this.g.v=1-a-d;this.g.s=e-f;this.g.u=b-h;this.g.l=e+f;this.g.B=1-a-g;a=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;g=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;c=this.g.A*this.eb+this.g.j*this.hb+this.g.m*this.kb;k=this.g.o*this.bb+this.g.v*this.fb+this.g.s*this.ib;d=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;l=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;h=this.g.u*this.bb+ +this.g.l*this.fb+this.g.B*this.ib;e=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;b=this.g.u*this.eb+this.g.l*this.hb+this.g.B*this.kb;this.ba=a;this.ca=g;this.da=c;this.ea=k;this.fa=d;this.ga=l;this.ha=h;this.ia=e;this.ja=b;a=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;g=this.ba*this.g.o+this.ca*this.g.v+this.da*this.g.s;c=this.ba*this.g.u+this.ca*this.g.l+this.da*this.g.B;k=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;d=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;l=this.ea* +this.g.u+this.fa*this.g.l+this.ga*this.g.B;h=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;e=this.ha*this.g.o+this.ia*this.g.v+this.ja*this.g.s;b=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=a;this.ca=g;this.da=c;this.ea=k;this.fa=d;this.ga=l;this.ha=h;this.ia=e;this.ja=b;this.ba*=this.X.x;this.ca*=this.X.x;this.da*=this.X.x;this.ea*=this.X.y;this.fa*=this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;a=this.za;g=this.g;a.F=g.F;a.G=g.G;a.H=g.H;a.A= +g.A;a.j=g.j;a.m=g.m;a.o=g.o;a.v=g.v;a.s=g.s;a.u=g.u;a.l=g.l;a.B=g.B;for(a=this.vc;null!=a;){g=a.U;k=this.za;c=this.g;d=a.za;l=a.ra;h=k.A*l.A+k.j*l.o+k.m*l.u;e=k.A*l.j+k.j*l.v+k.m*l.l;b=k.A*l.m+k.j*l.s+k.m*l.B;f=k.o*l.A+k.v*l.o+k.s*l.u;var m=k.o*l.j+k.v*l.v+k.s*l.l;var n=k.o*l.m+k.v*l.s+k.s*l.B;var q=k.u*l.A+k.l*l.o+k.B*l.u;var p=k.u*l.j+k.l*l.v+k.B*l.l;var r=k.u*l.m+k.l*l.s+k.B*l.B;d.A=h;d.j=e;d.m=b;d.o=f;d.v=m;d.s=n;d.u=q;d.l=p;d.B=r;h=k.A*l.F+k.j*l.G+k.m*l.H;e=k.o*l.F+k.v*l.G+k.s*l.H;l=k.u*l.F+ +k.l*l.G+k.B*l.H;d.F=h;d.G=e;d.H=l;d.F+=k.F;d.G+=k.G;d.H+=k.H;k=a.g;d=a.ra;l=c.A*d.A+c.j*d.o+c.m*d.u;h=c.A*d.j+c.j*d.v+c.m*d.l;e=c.A*d.m+c.j*d.s+c.m*d.B;b=c.o*d.A+c.v*d.o+c.s*d.u;f=c.o*d.j+c.v*d.v+c.s*d.l;m=c.o*d.m+c.v*d.s+c.s*d.B;n=c.u*d.A+c.l*d.o+c.B*d.u;q=c.u*d.j+c.l*d.v+c.B*d.l;p=c.u*d.m+c.l*d.s+c.B*d.B;k.A=l;k.j=h;k.m=e;k.o=b;k.v=f;k.s=m;k.u=n;k.l=q;k.B=p;l=c.A*d.F+c.j*d.G+c.m*d.H;h=c.o*d.F+c.v*d.G+c.s*d.H;d=c.u*d.F+c.l*d.G+c.B*d.H;k.F=l;k.G=h;k.H=d;k.F+=c.F;k.G+=c.G;k.H+=c.H;a.Tb.Yb(a.D,a.za); +c=a.D.wa;k=a.D.xa;d=a.D.ya;l=a.D.ta;h=a.D.ua;e=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=ca.D.ta?l:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=e>a.D.va?e:a.D.va;null!=a.Eb&&(c=a.g.F-a.za.F,k=a.g.G-a.za.G,d=a.g.H-a.za.H,l=a.qc,l.x=c,l.y=k,l.z=d,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=g}this.Ob=!1;this.Kb=0};J.prototype.ac=function(){var a=this.g,b=new Ob;b.F=a.F;b.G=a.G;b.H=a.H;b.A=a.A;b.j=a.j;b.m=a.m;b.o=a.o;b.v=a.v;b.s=a.s;b.u=a.u;b.l=a.l;b.B=a.B; +return b};J.prototype.bc=function(a){var b=this.g;a.F=b.F;a.G=b.G;a.H=b.H;a.A=b.A;a.j=b.j;a.m=b.m;a.o=b.o;a.v=b.v;a.s=b.s;a.u=b.u;a.l=b.l;a.B=b.B};J.prototype.sf=function(a){this.g.F=a.F;this.g.G=a.G;this.g.H=a.H;this.g.A=a.A;this.g.j=a.j;this.g.m=a.m;this.g.o=a.o;this.g.v=a.v;this.g.s=a.s;this.g.u=a.u;this.g.l=a.l;this.g.B=a.B;a=this.g.A*this.bb+this.g.j*this.fb+this.g.m*this.ib;var b=this.g.A*this.cb+this.g.j*this.gb+this.g.m*this.jb;var e=this.g.A*this.eb+this.g.j*this.hb+this.g.m*this.kb;var d= +this.g.o*this.bb+this.g.v*this.fb+this.g.s*this.ib;var c=this.g.o*this.cb+this.g.v*this.gb+this.g.s*this.jb;var f=this.g.o*this.eb+this.g.v*this.hb+this.g.s*this.kb;var h=this.g.u*this.bb+this.g.l*this.fb+this.g.B*this.ib;var k=this.g.u*this.cb+this.g.l*this.gb+this.g.B*this.jb;var g=this.g.u*this.eb+this.g.l*this.hb+this.g.B*this.kb;this.ba=a;this.ca=b;this.da=e;this.ea=d;this.fa=c;this.ga=f;this.ha=h;this.ia=k;this.ja=g;a=this.ba*this.g.A+this.ca*this.g.j+this.da*this.g.m;b=this.ba*this.g.o+this.ca* +this.g.v+this.da*this.g.s;e=this.ba*this.g.u+this.ca*this.g.l+this.da*this.g.B;d=this.ea*this.g.A+this.fa*this.g.j+this.ga*this.g.m;c=this.ea*this.g.o+this.fa*this.g.v+this.ga*this.g.s;f=this.ea*this.g.u+this.fa*this.g.l+this.ga*this.g.B;h=this.ha*this.g.A+this.ia*this.g.j+this.ja*this.g.m;k=this.ha*this.g.o+this.ia*this.g.v+this.ja*this.g.s;g=this.ha*this.g.u+this.ia*this.g.l+this.ja*this.g.B;this.ba=a;this.ca=b;this.da=e;this.ea=d;this.fa=c;this.ga=f;this.ha=h;this.ia=k;this.ja=g;this.ba*=this.X.x; +this.ca*=this.X.x;this.da*=this.X.x;this.ea*=this.X.y;this.fa*=this.X.y;this.ga*=this.X.y;this.ha*=this.X.z;this.ia*=this.X.z;this.ja*=this.X.z;a=this.za;b=this.g;a.F=b.F;a.G=b.G;a.H=b.H;a.A=b.A;a.j=b.j;a.m=b.m;a.o=b.o;a.v=b.v;a.s=b.s;a.u=b.u;a.l=b.l;a.B=b.B;for(a=this.vc;null!=a;){b=a.U;d=this.za;e=this.g;c=a.za;f=a.ra;h=d.A*f.A+d.j*f.o+d.m*f.u;k=d.A*f.j+d.j*f.v+d.m*f.l;g=d.A*f.m+d.j*f.s+d.m*f.B;var l=d.o*f.A+d.v*f.o+d.s*f.u;var m=d.o*f.j+d.v*f.v+d.s*f.l;var n=d.o*f.m+d.v*f.s+d.s*f.B;var q=d.u*f.A+ +d.l*f.o+d.B*f.u;var p=d.u*f.j+d.l*f.v+d.B*f.l;var r=d.u*f.m+d.l*f.s+d.B*f.B;c.A=h;c.j=k;c.m=g;c.o=l;c.v=m;c.s=n;c.u=q;c.l=p;c.B=r;h=d.A*f.F+d.j*f.G+d.m*f.H;k=d.o*f.F+d.v*f.G+d.s*f.H;f=d.u*f.F+d.l*f.G+d.B*f.H;c.F=h;c.G=k;c.H=f;c.F+=d.F;c.G+=d.G;c.H+=d.H;d=a.g;c=a.ra;f=e.A*c.A+e.j*c.o+e.m*c.u;h=e.A*c.j+e.j*c.v+e.m*c.l;k=e.A*c.m+e.j*c.s+e.m*c.B;g=e.o*c.A+e.v*c.o+e.s*c.u;l=e.o*c.j+e.v*c.v+e.s*c.l;m=e.o*c.m+e.v*c.s+e.s*c.B;n=e.u*c.A+e.l*c.o+e.B*c.u;q=e.u*c.j+e.l*c.v+e.B*c.l;p=e.u*c.m+e.l*c.s+e.B*c.B;d.A= +f;d.j=h;d.m=k;d.o=g;d.v=l;d.s=m;d.u=n;d.l=q;d.B=p;f=e.A*c.F+e.j*c.G+e.m*c.H;h=e.o*c.F+e.v*c.G+e.s*c.H;c=e.u*c.F+e.l*c.G+e.B*c.H;d.F=f;d.G=h;d.H=c;d.F+=e.F;d.G+=e.G;d.H+=e.H;a.Tb.Yb(a.D,a.za);e=a.D.wa;d=a.D.xa;c=a.D.ya;f=a.D.ta;h=a.D.ua;k=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=ea.D.ta?f:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(e=a.g.F-a.za.F,d=a.g.G-a.za.G,c=a.g.H-a.za.H,f=a.qc,f.x=e,f.y=d,f.z=c,a.hc.pc.nc.fd(a.Eb, +a.D,a.qc));a=b}this.Ob=!1;this.Kb=0};J.prototype.zh=function(){return this.Ce};J.prototype.We=function(){var a=new ia;a.e00=this.h;a.e01=this.i;a.e02=this.C;a.e10=this.I;a.e11=this.M;a.e12=this.V;a.e20=this.W;a.e21=this.Y;a.e22=this.aa;return a};J.prototype.Xe=function(a){a.e00=this.h;a.e01=this.i;a.e02=this.C;a.e10=this.I;a.e11=this.M;a.e12=this.V;a.e20=this.W;a.e21=this.Y;a.e22=this.aa};J.prototype.Ah=function(){var a=new Vk;a.mass=this.Ce;var b=a.localInertia;b.e00=this.h;b.e01=this.i;b.e02=this.C; +b.e10=this.I;b.e11=this.M;b.e12=this.V;b.e20=this.W;b.e21=this.Y;b.e22=this.aa;return a};J.prototype.Bh=function(a){a.mass=this.Ce;a=a.localInertia;a.e00=this.h;a.e01=this.i;a.e02=this.C;a.e10=this.I;a.e11=this.M;a.e12=this.V;a.e20=this.W;a.e21=this.Y;a.e22=this.aa};J.prototype.ai=function(a){this.Ce=a.mass;a=a.localInertia;this.h=a.e00;this.i=a.e01;this.C=a.e02;this.I=a.e10;this.M=a.e11;this.V=a.e12;this.W=a.e20;this.Y=a.e21;this.aa=a.e22;if(0d||1E-32a.D.ta?f:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(d= +a.g.F-a.za.F,e=a.g.G-a.za.G,c=a.g.H-a.za.H,f=a.qc,f.x=d,f.y=e,f.z=c,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=b}};J.prototype.Kh=function(a){var b=a.sa,e=a.U;null!=b&&(b.U=e);null!=e&&(e.sa=b);a==this.vc&&(this.vc=this.vc.U);a==this.Jb&&(this.Jb=this.Jb.sa);a.U=null;a.sa=null;this.nf--;a.hc=null;if(null!=this.pc){b=this.pc;b.nc.fg(a.Eb);a.Eb=null;a.uc=-1;for(var d=a.hc.Zb;null!=d;){e=d.U;var c=d.zd;if(c.ic==a||c.jc==a){d=d.Fc;d.Ob=!1;d.Kb=0;d=b.Xf;var f=c.sa,h=c.U;null!=f&&(f.U=h);null!=h&&(h.sa=f);c==d.md&& +(d.md=d.md.U);c==d.Nd&&(d.Nd=d.Nd.sa);c.U=null;c.sa=null;c.xd&&(f=c.ic.ld,h=c.jc.ld,f==h&&(h=null),null!=f&&f.endContact(c),null!=h&&h.endContact(c));f=c.Bb.sa;h=c.Bb.U;null!=f&&(f.U=h);null!=h&&(h.sa=f);c.Bb==c.J.Zb&&(c.J.Zb=c.J.Zb.U);c.Bb==c.J.oc&&(c.J.oc=c.J.oc.sa);c.Bb.U=null;c.Bb.sa=null;f=c.Cb.sa;h=c.Cb.U;null!=f&&(f.U=h);null!=h&&(h.sa=f);c.Cb==c.K.Zb&&(c.K.Zb=c.K.Zb.U);c.Cb==c.K.oc&&(c.K.oc=c.K.oc.sa);c.Cb.U=null;c.Cb.sa=null;c.J.Pd--;c.K.Pd--;c.Bb.Fc=null;c.Cb.Fc=null;c.Bb.zd=null;c.Cb.zd= +null;c.ic=null;c.jc=null;c.J=null;c.K=null;c.xd=!1;c.Eg.de();c.Ra.de();c.Yf=null;f=c.ee;f.ic=null;f.jc=null;f.J=null;f.K=null;f.Jg=null;f.Kg=null;c.U=d.$e;d.$e=c;d.pg--}d=e}b.nf--}this.Wg();for(a=this.vc;null!=a;){b=a.U;c=this.za;e=this.g;d=a.za;f=a.ra;h=c.A*f.A+c.j*f.o+c.m*f.u;var k=c.A*f.j+c.j*f.v+c.m*f.l;var g=c.A*f.m+c.j*f.s+c.m*f.B;var l=c.o*f.A+c.v*f.o+c.s*f.u;var m=c.o*f.j+c.v*f.v+c.s*f.l;var n=c.o*f.m+c.v*f.s+c.s*f.B;var q=c.u*f.A+c.l*f.o+c.B*f.u;var p=c.u*f.j+c.l*f.v+c.B*f.l;var r=c.u*f.m+ +c.l*f.s+c.B*f.B;d.A=h;d.j=k;d.m=g;d.o=l;d.v=m;d.s=n;d.u=q;d.l=p;d.B=r;h=c.A*f.F+c.j*f.G+c.m*f.H;k=c.o*f.F+c.v*f.G+c.s*f.H;f=c.u*f.F+c.l*f.G+c.B*f.H;d.F=h;d.G=k;d.H=f;d.F+=c.F;d.G+=c.G;d.H+=c.H;c=a.g;d=a.ra;f=e.A*d.A+e.j*d.o+e.m*d.u;h=e.A*d.j+e.j*d.v+e.m*d.l;k=e.A*d.m+e.j*d.s+e.m*d.B;g=e.o*d.A+e.v*d.o+e.s*d.u;l=e.o*d.j+e.v*d.v+e.s*d.l;m=e.o*d.m+e.v*d.s+e.s*d.B;n=e.u*d.A+e.l*d.o+e.B*d.u;q=e.u*d.j+e.l*d.v+e.B*d.l;p=e.u*d.m+e.l*d.s+e.B*d.B;c.A=f;c.j=h;c.m=k;c.o=g;c.v=l;c.s=m;c.u=n;c.l=q;c.B=p;f=e.A*d.F+ +e.j*d.G+e.m*d.H;h=e.o*d.F+e.v*d.G+e.s*d.H;d=e.u*d.F+e.l*d.G+e.B*d.H;c.F=f;c.G=h;c.H=d;c.F+=e.F;c.G+=e.G;c.H+=e.H;a.Tb.Yb(a.D,a.za);e=a.D.wa;c=a.D.xa;d=a.D.ya;f=a.D.ta;h=a.D.ua;k=a.D.va;a.Tb.Yb(a.D,a.g);a.D.wa=ea.D.ta?f:a.D.ta;a.D.ua=h>a.D.ua?h:a.D.ua;a.D.va=k>a.D.va?k:a.D.va;null!=a.Eb&&(e=a.g.F-a.za.F,c=a.g.G-a.za.G,d=a.g.H-a.za.H,f=a.qc,f.x=e,f.y=c,f.z=d,a.hc.pc.nc.fd(a.Eb,a.D,a.qc));a=b}};J.prototype.Sc=function(){return this.Xb}; +J.prototype.di=function(a){this.Xb=a;this.Wg()};J.prototype.fi=function(){this.Ob=!1;this.Kb=0};J.prototype.ei=function(){this.Ob=!0;this.Kb=0};J.prototype.Jh=function(){return this.Ob};J.prototype.Eh=function(){return this.Kb};J.prototype.tg=function(a){this.Oh=a;this.Ob=!1;this.Kb=0};J.prototype.be=function(){return this.gh};J.prototype.vh=function(a){this.gh=a};J.prototype.mg=function(){return this.Xg};J.prototype.Lh=function(a){this.Xg=a};J.prototype.tb=function(){return this.sa};J.prototype.Pb= +function(){return this.U};Ab.prototype.Ma=function(){return this.dh};Ab.prototype.Rb=function(a){this.dh=a};Ab.prototype.Ya=function(){return this.kh};Ab.prototype.Wb=function(a){this.kh=a};Ab.prototype.Sa=function(){var a=this.ra,b=new Ob;b.F=a.F;b.G=a.G;b.H=a.H;b.A=a.A;b.j=a.j;b.m=a.m;b.o=a.o;b.v=a.v;b.s=a.s;b.u=a.u;b.l=a.l;b.B=a.B;return b};Ab.prototype.Wa=function(a){var b=this.ra;a.F=b.F;a.G=b.G;a.H=b.H;a.A=b.A;a.j=b.j;a.m=b.m;a.o=b.o;a.v=b.v;a.s=b.s;a.u=b.u;a.l=b.l;a.B=b.B};Ab.prototype.C=function(){var a= +this.g,b=new Ob;b.F=a.F;b.G=a.G;b.H=a.H;b.A=a.A;b.j=a.j;b.m=a.m;b.o=a.o;b.v=a.v;b.s=a.s;b.u=a.u;b.l=a.l;b.B=a.B;return b};Ab.prototype.I=function(a){var b=this.g;a.F=b.F;a.G=b.G;a.H=b.H;a.A=b.A;a.j=b.j;a.m=b.m;a.o=b.o;a.v=b.v;a.s=b.s;a.u=b.u;a.l=b.l;a.B=b.B};Ab.prototype.Sb=function(a){var b=this.ra;b.F=a.F;b.G=a.G;b.H=a.H;b.A=a.A;b.j=a.j;b.m=a.m;b.o=a.o;b.v=a.v;b.s=a.s;b.u=a.u;b.l=a.l;b.B=a.B;if(null!=this.hc)for(a=this.hc,a.Wg(),b=a.vc;null!=b;){var e=b.U,d=a.za,c=a.g,f=b.za,h=b.ra;var k=d.A*h.A+ +d.j*h.o+d.m*h.u;var g=d.A*h.j+d.j*h.v+d.m*h.l;var l=d.A*h.m+d.j*h.s+d.m*h.B;var m=d.o*h.A+d.v*h.o+d.s*h.u;var n=d.o*h.j+d.v*h.v+d.s*h.l;var q=d.o*h.m+d.v*h.s+d.s*h.B;var p=d.u*h.A+d.l*h.o+d.B*h.u;var r=d.u*h.j+d.l*h.v+d.B*h.l;var t=d.u*h.m+d.l*h.s+d.B*h.B;f.A=k;f.j=g;f.m=l;f.o=m;f.v=n;f.s=q;f.u=p;f.l=r;f.B=t;k=d.A*h.F+d.j*h.G+d.m*h.H;g=d.o*h.F+d.v*h.G+d.s*h.H;h=d.u*h.F+d.l*h.G+d.B*h.H;f.F=k;f.G=g;f.H=h;f.F+=d.F;f.G+=d.G;f.H+=d.H;d=b.g;f=b.ra;h=c.A*f.A+c.j*f.o+c.m*f.u;k=c.A*f.j+c.j*f.v+c.m*f.l;g=c.A* +f.m+c.j*f.s+c.m*f.B;l=c.o*f.A+c.v*f.o+c.s*f.u;m=c.o*f.j+c.v*f.v+c.s*f.l;n=c.o*f.m+c.v*f.s+c.s*f.B;q=c.u*f.A+c.l*f.o+c.B*f.u;p=c.u*f.j+c.l*f.v+c.B*f.l;r=c.u*f.m+c.l*f.s+c.B*f.B;d.A=h;d.j=k;d.m=g;d.o=l;d.v=m;d.s=n;d.u=q;d.l=p;d.B=r;h=c.A*f.F+c.j*f.G+c.m*f.H;k=c.o*f.F+c.v*f.G+c.s*f.H;f=c.u*f.F+c.l*f.G+c.B*f.H;d.F=h;d.G=k;d.H=f;d.F+=c.F;d.G+=c.G;d.H+=c.H;b.Tb.Yb(b.D,b.za);c=b.D.wa;d=b.D.xa;f=b.D.ya;h=b.D.ta;k=b.D.ua;g=b.D.va;b.Tb.Yb(b.D,b.g);b.D.wa=cb.D.ta?h:b.D.ta;b.D.ua=k>b.D.ua?k:b.D.ua;b.D.va=g>b.D.va?g:b.D.va;null!=b.Eb&&(c=b.g.F-b.za.F,d=b.g.G-b.za.G,f=b.g.H-b.za.H,h=b.qc,h.x=c,h.y=d,h.z=f,b.hc.pc.nc.fd(b.Eb,b.D,b.qc));b=e}};Ab.prototype.qa=function(){return this.Qh};Ab.prototype.Pb=function(a){this.Qh=a;if(null!=this.hc){a=this.hc;a.Wg();for(var b=a.vc;null!=b;){var e=b.U,d=a.za,c=a.g,f=b.za,h=b.ra;var k=d.A*h.A+d.j*h.o+d.m*h.u;var g=d.A*h.j+d.j*h.v+d.m*h.l;var l=d.A*h.m+d.j*h.s+d.m*h.B;var m=d.o*h.A+d.v*h.o+d.s* +h.u;var n=d.o*h.j+d.v*h.v+d.s*h.l;var q=d.o*h.m+d.v*h.s+d.s*h.B;var p=d.u*h.A+d.l*h.o+d.B*h.u;var r=d.u*h.j+d.l*h.v+d.B*h.l;var t=d.u*h.m+d.l*h.s+d.B*h.B;f.A=k;f.j=g;f.m=l;f.o=m;f.v=n;f.s=q;f.u=p;f.l=r;f.B=t;k=d.A*h.F+d.j*h.G+d.m*h.H;g=d.o*h.F+d.v*h.G+d.s*h.H;h=d.u*h.F+d.l*h.G+d.B*h.H;f.F=k;f.G=g;f.H=h;f.F+=d.F;f.G+=d.G;f.H+=d.H;d=b.g;f=b.ra;h=c.A*f.A+c.j*f.o+c.m*f.u;k=c.A*f.j+c.j*f.v+c.m*f.l;g=c.A*f.m+c.j*f.s+c.m*f.B;l=c.o*f.A+c.v*f.o+c.s*f.u;m=c.o*f.j+c.v*f.v+c.s*f.l;n=c.o*f.m+c.v*f.s+c.s*f.B;q= +c.u*f.A+c.l*f.o+c.B*f.u;p=c.u*f.j+c.l*f.v+c.B*f.l;r=c.u*f.m+c.l*f.s+c.B*f.B;d.A=h;d.j=k;d.m=g;d.o=l;d.v=m;d.s=n;d.u=q;d.l=p;d.B=r;h=c.A*f.F+c.j*f.G+c.m*f.H;k=c.o*f.F+c.v*f.G+c.s*f.H;f=c.u*f.F+c.l*f.G+c.B*f.H;d.F=h;d.G=k;d.H=f;d.F+=c.F;d.G+=c.G;d.H+=c.H;b.Tb.Yb(b.D,b.za);c=b.D.wa;d=b.D.xa;f=b.D.ya;h=b.D.ta;k=b.D.ua;g=b.D.va;b.Tb.Yb(b.D,b.g);b.D.wa=cb.D.ta?h:b.D.ta;b.D.ua=k>b.D.ua?k:b.D.ua;b.D.va=g>b.D.va?g:b.D.va;null!=b.Eb&& +(c=b.g.F-b.za.F,d=b.g.G-b.za.G,f=b.g.H-b.za.H,h=b.qc,h.x=c,h.y=d,h.z=f,b.hc.pc.nc.fd(b.Eb,b.D,b.qc));b=e}}};Ab.prototype.M=function(){return this.D.clone()};Ab.prototype.V=function(a){a.Dd(this.D)};Ab.prototype.Oa=function(){return this.Tb};Ab.prototype.nb=function(){return this.hc};Ab.prototype.W=function(){return this.$g};Ab.prototype.ob=function(a){this.$g=a};Ab.prototype.Y=function(){return this.ah};Ab.prototype.Ib=function(a){this.ah=a};Ab.prototype.aa=function(){return this.ld};Ab.prototype.Jb= +function(a){this.ld=a};Ab.prototype.i=function(){return this.sa};Ab.prototype.h=function(){return this.U};"undefined"!=typeof performance&&"function"==typeof performance.now&&(Jh.h=performance.now.bind(performance));Kk.BRUTE_FORCE=1;Kk.BVH=2;Bj.SPHERE=0;Bj.BOX=1;Bj.CYLINDER=2;Bj.CONE=3;Bj.CAPSULE=4;Bj.CONVEX_HULL=5;Hh.h=0;z.numCreations=0;ra.defaultFriction=.2;ra.defaultRestitution=.2;ra.defaultDensity=1;ra.defaultCollisionGroup=1;ra.defaultCollisionMask=1;ra.maxTranslationPerStep=20;ra.maxRotationPerStep= +3.14159265358979;ra.bvhProxyPadding=.1;ra.bvhIncrementalCollisionThreshold=.45;ra.defaultGJKMargin=.05;ra.enableGJKCaching=!0;ra.maxEPAVertices=128;ra.maxEPAPolyhedronFaces=128;ra.contactEnableBounceThreshold=.5;ra.velocityBaumgarte=.2;ra.positionSplitImpulseBaumgarte=.4;ra.positionNgsBaumgarte=1;ra.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold=.05;ra.defaultContactPositionCorrectionAlgorithm=0;ra.alternativeContactPositionCorrectionAlgorithm=1;ra.contactPersistenceThreshold=.05; +ra.maxManifoldPoints=4;ra.defaultJointConstraintSolverType=0;ra.defaultJointPositionCorrectionAlgorithm=0;ra.jointWarmStartingFactorForBaungarte=.8;ra.jointWarmStartingFactor=.95;ra.minSpringDamperDampingRatio=1E-6;ra.minRagdollMaxSwingAngle=1E-6;ra.maxJacobianRows=6;ra.directMlcpSolverEps=1E-9;ra.islandInitialRigidBodyArraySize=128;ra.islandInitialConstraintArraySize=128;ra.sleepingVelocityThreshold=.2;ra.sleepingAngularVelocityThreshold=.5;ra.sleepingTimeThreshold=1;ra.disableSleeping=!1;ra.linearSlop= +.005;ra.angularSlop=.017453292519943278;yc.instance=new yc;Xg.SUCCEEDED=0;Xg.GJK_FAILED_TO_MAKE_TETRAHEDRON=1;Xg.GJK_DID_NOT_CONVERGE=2;Xg.EPA_FAILED_TO_INIT=257;Xg.EPA_FAILED_TO_ADD_VERTEX=258;Xg.EPA_DID_NOT_CONVERGE=259;ia.numCreations=0;Ha.numCreations=0;Sb.POSITIVE_INFINITY=Infinity;Sb.NEGATIVE_INFINITY=-Infinity;Sb.PI=3.14159265358979;Sb.TWO_PI=6.28318530717958;Sb.HALF_PI=1.570796326794895;Sb.TO_RADIANS=.017453292519943278;Sb.TO_DEGREES=57.29577951308238;Gb.numCreations=0;ii.broadPhaseCollisionTime= +0;ii.narrowPhaseCollisionTime=0;ii.dynamicsTime=0;ii.totalTime=0;Fh.BAUMGARTE=0;Fh.SPLIT_IMPULSE=1;Fh.NGS=2;Wg.SPHERICAL=0;Wg.REVOLUTE=1;Wg.CYLINDRICAL=2;Wg.PRISMATIC=3;Wg.UNIVERSAL=4;Wg.RAGDOLL=5;Wg.GENERIC=6;Ck.ITERATIVE=0;Ck.DIRECT=1;Eh.DYNAMIC=0;Eh.STATIC=1;Eh.KINEMATIC=2;il.h()})({}); diff --git a/bin/js/externs.js b/bin/js/externs.js deleted file mode 100644 index b31cb12..0000000 --- a/bin/js/externs.js +++ /dev/null @@ -1,277 +0,0 @@ -// externs for Closure Compiler -OIMO.DebugDraw.wireframe; -OIMO.DebugDraw.drawShapes; -OIMO.DebugDraw.drawBvh; -OIMO.DebugDraw.drawBvhMinLevel; -OIMO.DebugDraw.drawBvhMaxLevel; -OIMO.DebugDraw.drawAabbs; -OIMO.DebugDraw.drawBases; -OIMO.DebugDraw.drawPairs; -OIMO.DebugDraw.drawContacts; -OIMO.DebugDraw.drawContactBases; -OIMO.DebugDraw.drawJoints; -OIMO.DebugDraw.drawJointLimits; -OIMO.DebugDraw.style; -OIMO.DebugDraw.aabb; -OIMO.DebugDraw.basis; -OIMO.DebugDraw.ellipse; -OIMO.DebugDraw.arc; -OIMO.DebugDraw.cone; -OIMO.DebugDraw.cylinder; -OIMO.DebugDraw.capsule; -OIMO.DebugDraw.sphere; -OIMO.DebugDraw.box; -OIMO.DebugDraw.rect; -OIMO.DebugDraw.point; -OIMO.DebugDraw.triangle; -OIMO.DebugDraw.line; -OIMO.BroadPhaseType.BRUTE_FORCE; -OIMO.BroadPhaseType.BVH; -OIMO.Proxy.userData; -OIMO.GeometryType.SPHERE; -OIMO.GeometryType.BOX; -OIMO.GeometryType.CYLINDER; -OIMO.GeometryType.CONE; -OIMO.GeometryType.CAPSULE; -OIMO.GeometryType.CONVEX_HULL; -OIMO.RayCastHit.position; -OIMO.RayCastHit.normal; -OIMO.RayCastHit.fraction; -OIMO.DetectorResult.numPoints; -OIMO.DetectorResult.points; -OIMO.DetectorResult.normal; -OIMO.DetectorResult.incremental; -OIMO.DetectorResultPoint.position1; -OIMO.DetectorResultPoint.position2; -OIMO.DetectorResultPoint.depth; -OIMO.DetectorResultPoint.id; -OIMO.Vec3.x; -OIMO.Vec3.y; -OIMO.Vec3.z; -OIMO.Vec3.numCreations; -OIMO.Setting.defaultFriction; -OIMO.Setting.defaultRestitution; -OIMO.Setting.defaultDensity; -OIMO.Setting.defaultCollisionGroup; -OIMO.Setting.defaultCollisionMask; -OIMO.Setting.maxTranslationPerStep; -OIMO.Setting.maxRotationPerStep; -OIMO.Setting.bvhProxyPadding; -OIMO.Setting.bvhIncrementalCollisionThreshold; -OIMO.Setting.defaultGJKMargin; -OIMO.Setting.enableGJKCaching; -OIMO.Setting.maxEPAVertices; -OIMO.Setting.maxEPAPolyhedronFaces; -OIMO.Setting.contactEnableBounceThreshold; -OIMO.Setting.velocityBaumgarte; -OIMO.Setting.positionSplitImpulseBaumgarte; -OIMO.Setting.positionNgsBaumgarte; -OIMO.Setting.contactUseAlternativePositionCorrectionAlgorithmDepthThreshold; -OIMO.Setting.defaultContactPositionCorrectionAlgorithm; -OIMO.Setting.alternativeContactPositionCorrectionAlgorithm; -OIMO.Setting.contactPersistenceThreshold; -OIMO.Setting.maxManifoldPoints; -OIMO.Setting.defaultJointConstraintSolverType; -OIMO.Setting.defaultJointPositionCorrectionAlgorithm; -OIMO.Setting.jointWarmStartingFactorForBaungarte; -OIMO.Setting.jointWarmStartingFactor; -OIMO.Setting.minSpringDamperDampingRatio; -OIMO.Setting.minRagdollMaxSwingAngle; -OIMO.Setting.maxJacobianRows; -OIMO.Setting.directMlcpSolverEps; -OIMO.Setting.islandInitialRigidBodyArraySize; -OIMO.Setting.islandInitialConstraintArraySize; -OIMO.Setting.sleepingVelocityThreshold; -OIMO.Setting.sleepingAngularVelocityThreshold; -OIMO.Setting.sleepingTimeThreshold; -OIMO.Setting.disableSleeping; -OIMO.Setting.linearSlop; -OIMO.Setting.angularSlop; -OIMO.GjkEpa.closestPoint1; -OIMO.GjkEpa.closestPoint2; -OIMO.GjkEpa.distance; -OIMO.GjkEpaResultState.SUCCEEDED; -OIMO.GjkEpaResultState.GJK_FAILED_TO_MAKE_TETRAHEDRON; -OIMO.GjkEpaResultState.GJK_DID_NOT_CONVERGE; -OIMO.GjkEpaResultState.EPA_FAILED_TO_INIT; -OIMO.GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; -OIMO.GjkEpaResultState.EPA_DID_NOT_CONVERGE; -OIMO.Mat3.e00; -OIMO.Mat3.e01; -OIMO.Mat3.e02; -OIMO.Mat3.e10; -OIMO.Mat3.e11; -OIMO.Mat3.e12; -OIMO.Mat3.e20; -OIMO.Mat3.e21; -OIMO.Mat3.e22; -OIMO.Mat3.numCreations; -OIMO.Mat4.e00; -OIMO.Mat4.e01; -OIMO.Mat4.e02; -OIMO.Mat4.e03; -OIMO.Mat4.e10; -OIMO.Mat4.e11; -OIMO.Mat4.e12; -OIMO.Mat4.e13; -OIMO.Mat4.e20; -OIMO.Mat4.e21; -OIMO.Mat4.e22; -OIMO.Mat4.e23; -OIMO.Mat4.e30; -OIMO.Mat4.e31; -OIMO.Mat4.e32; -OIMO.Mat4.e33; -OIMO.Mat4.numCreations; -OIMO.MathUtil.POSITIVE_INFINITY; -OIMO.MathUtil.NEGATIVE_INFINITY; -OIMO.MathUtil.PI; -OIMO.MathUtil.TWO_PI; -OIMO.MathUtil.HALF_PI; -OIMO.MathUtil.TO_RADIANS; -OIMO.MathUtil.TO_DEGREES; -OIMO.Quat.x; -OIMO.Quat.y; -OIMO.Quat.z; -OIMO.Quat.w; -OIMO.Quat.numCreations; -OIMO.TimeStep.dt; -OIMO.TimeStep.invDt; -OIMO.TimeStep.dtRatio; -OIMO.AabbTestCallback.process; -OIMO.ContactCallback.beginContact; -OIMO.ContactCallback.preSolve; -OIMO.ContactCallback.postSolve; -OIMO.ContactCallback.endContact; -OIMO.RayCastCallback.process; -OIMO.RayCastClosest.shape; -OIMO.RayCastClosest.position; -OIMO.RayCastClosest.normal; -OIMO.RayCastClosest.fraction; -OIMO.RayCastClosest.hit; -OIMO.DebugDrawStyle.shapeColor1; -OIMO.DebugDrawStyle.shapeColor2; -OIMO.DebugDrawStyle.sleepyShapeColor1; -OIMO.DebugDrawStyle.sleepyShapeColor2; -OIMO.DebugDrawStyle.sleepingShapeColor1; -OIMO.DebugDrawStyle.sleepingShapeColor2; -OIMO.DebugDrawStyle.staticShapeColor; -OIMO.DebugDrawStyle.kinematicShapeColor; -OIMO.DebugDrawStyle.aabbColor; -OIMO.DebugDrawStyle.bvhNodeColor; -OIMO.DebugDrawStyle.pairColor; -OIMO.DebugDrawStyle.contactColor; -OIMO.DebugDrawStyle.contactColor2; -OIMO.DebugDrawStyle.contactColor3; -OIMO.DebugDrawStyle.contactColor4; -OIMO.DebugDrawStyle.newContactColor; -OIMO.DebugDrawStyle.disabledContactColor; -OIMO.DebugDrawStyle.contactNormalColor; -OIMO.DebugDrawStyle.contactTangentColor; -OIMO.DebugDrawStyle.contactBinormalColor; -OIMO.DebugDrawStyle.contactNormalLength; -OIMO.DebugDrawStyle.contactTangentLength; -OIMO.DebugDrawStyle.contactBinormalLength; -OIMO.DebugDrawStyle.jointLineColor; -OIMO.DebugDrawStyle.jointErrorColor; -OIMO.DebugDrawStyle.jointRotationalConstraintRadius; -OIMO.DebugDrawStyle.basisLength; -OIMO.DebugDrawStyle.basisColorX; -OIMO.DebugDrawStyle.basisColorY; -OIMO.DebugDrawStyle.basisColorZ; -OIMO.Performance.broadPhaseCollisionTime; -OIMO.Performance.narrowPhaseCollisionTime; -OIMO.Performance.dynamicsTime; -OIMO.Performance.totalTime; -OIMO.PositionCorrectionAlgorithm.BAUMGARTE; -OIMO.PositionCorrectionAlgorithm.SPLIT_IMPULSE; -OIMO.PositionCorrectionAlgorithm.NGS; -OIMO.Joint.userData; -OIMO.JointConfig.rigidBody1; -OIMO.JointConfig.rigidBody2; -OIMO.JointConfig.localAnchor1; -OIMO.JointConfig.localAnchor2; -OIMO.JointConfig.allowCollision; -OIMO.JointConfig.solverType; -OIMO.JointConfig.positionCorrectionAlgorithm; -OIMO.JointConfig.breakForce; -OIMO.JointConfig.breakTorque; -OIMO.CylindricalJointConfig.localAxis1; -OIMO.CylindricalJointConfig.localAxis2; -OIMO.CylindricalJointConfig.translationalLimitMotor; -OIMO.CylindricalJointConfig.translationalSpringDamper; -OIMO.CylindricalJointConfig.rotationalLimitMotor; -OIMO.CylindricalJointConfig.rotationalSpringDamper; -OIMO.GenericJointConfig.localBasis1; -OIMO.GenericJointConfig.localBasis2; -OIMO.GenericJointConfig.translationalLimitMotors; -OIMO.GenericJointConfig.translationalSpringDampers; -OIMO.GenericJointConfig.rotationalLimitMotors; -OIMO.GenericJointConfig.rotationalSpringDampers; -OIMO.JointType.SPHERICAL; -OIMO.JointType.REVOLUTE; -OIMO.JointType.CYLINDRICAL; -OIMO.JointType.PRISMATIC; -OIMO.JointType.UNIVERSAL; -OIMO.JointType.RAGDOLL; -OIMO.JointType.GENERIC; -OIMO.PrismaticJointConfig.localAxis1; -OIMO.PrismaticJointConfig.localAxis2; -OIMO.PrismaticJointConfig.limitMotor; -OIMO.PrismaticJointConfig.springDamper; -OIMO.RagdollJointConfig.localTwistAxis1; -OIMO.RagdollJointConfig.localTwistAxis2; -OIMO.RagdollJointConfig.localSwingAxis1; -OIMO.RagdollJointConfig.twistSpringDamper; -OIMO.RagdollJointConfig.twistLimitMotor; -OIMO.RagdollJointConfig.swingSpringDamper; -OIMO.RagdollJointConfig.maxSwingAngle1; -OIMO.RagdollJointConfig.maxSwingAngle2; -OIMO.RevoluteJointConfig.localAxis1; -OIMO.RevoluteJointConfig.localAxis2; -OIMO.RevoluteJointConfig.springDamper; -OIMO.RevoluteJointConfig.limitMotor; -OIMO.RotationalLimitMotor.lowerLimit; -OIMO.RotationalLimitMotor.upperLimit; -OIMO.RotationalLimitMotor.motorSpeed; -OIMO.RotationalLimitMotor.motorTorque; -OIMO.SphericalJointConfig.springDamper; -OIMO.SpringDamper.frequency; -OIMO.SpringDamper.dampingRatio; -OIMO.SpringDamper.useSymplecticEuler; -OIMO.TranslationalLimitMotor.lowerLimit; -OIMO.TranslationalLimitMotor.upperLimit; -OIMO.TranslationalLimitMotor.motorSpeed; -OIMO.TranslationalLimitMotor.motorForce; -OIMO.UniversalJointConfig.localAxis1; -OIMO.UniversalJointConfig.localAxis2; -OIMO.UniversalJointConfig.springDamper1; -OIMO.UniversalJointConfig.springDamper2; -OIMO.UniversalJointConfig.limitMotor1; -OIMO.UniversalJointConfig.limitMotor2; -OIMO.ConstraintSolverType.ITERATIVE; -OIMO.ConstraintSolverType.DIRECT; -OIMO.MassData.mass; -OIMO.MassData.localInertia; -OIMO.RigidBody.userData; -OIMO.RigidBodyConfig.position; -OIMO.RigidBodyConfig.rotation; -OIMO.RigidBodyConfig.linearVelocity; -OIMO.RigidBodyConfig.angularVelocity; -OIMO.RigidBodyConfig.type; -OIMO.RigidBodyConfig.autoSleep; -OIMO.RigidBodyConfig.linearDamping; -OIMO.RigidBodyConfig.angularDamping; -OIMO.RigidBodyType.DYNAMIC; -OIMO.RigidBodyType.STATIC; -OIMO.RigidBodyType.KINEMATIC; -OIMO.Shape.userData; -OIMO.ShapeConfig.position; -OIMO.ShapeConfig.rotation; -OIMO.ShapeConfig.friction; -OIMO.ShapeConfig.restitution; -OIMO.ShapeConfig.density; -OIMO.ShapeConfig.geometry; -OIMO.ShapeConfig.collisionGroup; -OIMO.ShapeConfig.collisionMask; -OIMO.ShapeConfig.contactCallback; diff --git a/bin/js_modules/OimoPhysics.d.ts b/bin/js_modules/OimoPhysics.d.ts index 0b66561..46dbf6a 100644 --- a/bin/js_modules/OimoPhysics.d.ts +++ b/bin/js_modules/OimoPhysics.d.ts @@ -8,7 +8,7 @@ export namespace oimo.common { /** * Creates a new quaternion. The quaternion is identity by default. */ - constructor(x?: number, y?: number, z?: number, w?: number); + constructor(x: number, y?: number, z?: number, w?: number); /** * The x-value of the imaginary part of the quaternion. */ @@ -130,7 +130,7 @@ export namespace oimo.common { /** * Creates a new matrix. The matrix is identity by default. */ - constructor(e00?: number, e01?: number, e02?: number, e10?: number, e11?: number, e12?: number, e20?: number, e21?: number, e22?: number); + constructor(e00: number, e01?: number, e02?: number, e10?: number, e11?: number, e12?: number, e20?: number, e21?: number, e22?: number); /** * The element at row 0 column 0. */ @@ -297,7 +297,7 @@ export namespace oimo.common { * If `columnMajor` is true, the array is arranged in column-major order. * Otherwise, the array is arranged in row-major order. */ - toArray(columnMajor?: boolean): number[]; + toArray(columnMajor: boolean): number[]; /** * Copies values from `m` and returns `this`. */ @@ -474,7 +474,7 @@ export namespace oimo.common { /** * Creates a new matrix. The matrix is identity by default. */ - constructor(e00?: number, e01?: number, e02?: number, e03?: number, e10?: number, e11?: number, e12?: number, e13?: number, e20?: number, e21?: number, e22?: number, e23?: number, e30?: number, e31?: number, e32?: number, e33?: number); + constructor(e00: number, e01?: number, e02?: number, e03?: number, e10?: number, e11?: number, e12?: number, e13?: number, e20?: number, e21?: number, e22?: number, e23?: number, e30?: number, e31?: number, e32?: number, e33?: number); /** * The element at row 0 column 0. */ @@ -721,7 +721,7 @@ export namespace oimo.common { * If `columnMajor` is true, the array is arranged in column-major order. * Otherwise, the array is arranged in row-major order. */ - toArray(columnMajor?: boolean): number[]; + toArray(columnMajor: boolean): number[]; /** * Copies values from `m` and returns `this`. */ @@ -759,7 +759,7 @@ export namespace oimo.common { /** * Creates a new vector. The vector is zero vector by default. */ - constructor(x?: number, y?: number, z?: number); + constructor(x: number, y?: number, z?: number); /** * The x-value of the vector. */ @@ -2489,7 +2489,7 @@ export namespace oimo.common { /** * Disposes an object got from `Pool.vec3`, `Pool.mat3`, `Pool.mat4`, or `Pool.quat`. */ - dispose(vec3?: oimo.common.Vec3, mat3?: oimo.common.Mat3, mat4?: oimo.common.Mat4, quat?: oimo.common.Quat): void; + dispose(vec3: oimo.common.Vec3, mat3?: oimo.common.Mat3, mat4?: oimo.common.Mat4, quat?: oimo.common.Quat): void; /** * Disposes an `Vec3` object got from `Pool.vec3`. */ @@ -3365,7 +3365,7 @@ export namespace oimo.dynamics { * Creates a new physics world, with broad-phase collision detection algorithm `broadPhaseType` and * gravitational acceleration `gravity`. */ - constructor(broadPhaseType?: number, gravity?: oimo.common.Vec3); + constructor(broadPhaseType: number, gravity?: oimo.common.Vec3); _rigidBodyList: oimo.dynamics.rigidbody.RigidBody; _rigidBodyListLast: oimo.dynamics.rigidbody.RigidBody; _jointList: oimo.dynamics.constraint.joint.Joint; @@ -3877,7 +3877,7 @@ export namespace oimo.dynamics.rigidbody { /** * Returns the number of the contact lists the rigid body is involved. */ - getNumContectLinks(): number; + getNumContactLinks(): number; /** * Returns the list of the contact links the rigid body is involved. */ diff --git a/bin/js_modules/OimoPhysics.js b/bin/js_modules/OimoPhysics.js index 10e2c56..6bd91c7 100644 --- a/bin/js_modules/OimoPhysics.js +++ b/bin/js_modules/OimoPhysics.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.2.0 +// Generated by Haxe 4.2.2 var oimo = oimo || {}; if(!oimo.collision) oimo.collision = {}; if(!oimo.collision.broadphase) oimo.collision.broadphase = {}; @@ -5374,24 +5374,36 @@ oimo.collision.narrowphase.detector._BoxBoxDetector.FaceClipper = class oimo_col let _g = 0; let _g1 = this.numVertices; while(_g < _g1) { - let v = this.vertices[_g++]; + let i = _g++; + let v = this.vertices[i]; let dot1 = v.x * e1x + v.y * e1y; let dot2 = v.x * e2x + v.y * e2y; - if(dot1 > max1) { + if(i == 0) { max1 = dot1; max1V = v; - } - if(dot1 < min1) { min1 = dot1; min1V = v; - } - if(dot2 > max2) { max2 = dot2; max2V = v; - } - if(dot2 < min2) { min2 = dot2; min2V = v; + } else { + if(dot1 > max1) { + max1 = dot1; + max1V = v; + } + if(dot1 < min1) { + min1 = dot1; + min1V = v; + } + if(dot2 > max2) { + max2 = dot2; + max2V = v; + } + if(dot2 < min2) { + min2 = dot2; + min2V = v; + } } } let _this = this.tmpVertices[this.numTmpVertices++]; @@ -24917,7 +24929,7 @@ oimo.dynamics.constraint.joint.GenericJoint = class oimo_dynamics_constraint_joi return this._translSds.slice(0); } getRotationalSpringDampers() { - return this._translSds.slice(0); + return this._rotSds.slice(0); } getTranslationalLimitMotors() { return this._translLms.slice(0); @@ -36014,7 +36026,7 @@ oimo.dynamics.rigidbody.RigidBody = class oimo_dynamics_rigidbody_RigidBody { getShapeList() { return this._shapeList; } - getNumContectLinks() { + getNumContactLinks() { return this._numContactLinks; } getContactLinkList() { diff --git a/build-js.hxml b/build-js.hxml index 14344ff..d9a1ee8 100644 --- a/build-js.hxml +++ b/build-js.hxml @@ -1,5 +1,10 @@ -cp src -cp exports/src -D analyzer-optimize +-D js-es=6 -main export.js.Export -js bin/js/OimoPhysics.js + +# +# place Closure Compiler at `./compiler.jar` and run `./minify-js.sh` afterwards to generate minified js +# \ No newline at end of file diff --git a/demos/bin/js/demos.js b/demos/bin/js/demos.js index b23784e..742f5d4 100644 --- a/demos/bin/js/demos.js +++ b/demos/bin/js/demos.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.0.5 +// Generated by Haxe 4.2.2 (function ($global) { "use strict"; function $extend(from, fields) { var proto = Object.create(from); @@ -15,12 +15,8 @@ HxOverrides.cca = function(s,index) { } return x; }; -HxOverrides.iter = function(a) { - return { cur : 0, arr : a, hasNext : function() { - return this.cur < this.arr.length; - }, next : function() { - return this.arr[this.cur++]; - }}; +HxOverrides.now = function() { + return Date.now(); }; Math.__name__ = true; var Std = function() { }; @@ -299,23 +295,23 @@ demo_common_DemoBase.prototype = { var _this_y = y; var _this_z = z; oimo_common_Vec3.numCreations++; - var _this1 = this.renderer.viewMat; - var e00 = _this1.e00; - var e01 = _this1.e01; - var e02 = _this1.e02; - var e03 = _this1.e03; - var e10 = _this1.e10; - var e11 = _this1.e11; - var e12 = _this1.e12; - var e13 = _this1.e13; - var e20 = _this1.e20; - var e21 = _this1.e21; - var e22 = _this1.e22; - var e23 = _this1.e23; - var e30 = _this1.e30; - var e31 = _this1.e31; - var e32 = _this1.e32; - var e33 = _this1.e33; + var _this = this.renderer.viewMat; + var e00 = _this.e00; + var e01 = _this.e01; + var e02 = _this.e02; + var e03 = _this.e03; + var e10 = _this.e10; + var e11 = _this.e11; + var e12 = _this.e12; + var e13 = _this.e13; + var e20 = _this.e20; + var e21 = _this.e21; + var e22 = _this.e22; + var e23 = _this.e23; + var e30 = _this.e30; + var e31 = _this.e31; + var e32 = _this.e32; + var e33 = _this.e33; if(e33 == null) { e33 = 1; } @@ -380,87 +376,87 @@ demo_common_DemoBase.prototype = { var viewMat_e31 = e31; var viewMat_e32 = e32; oimo_common_Mat4.numCreations++; - var e001 = viewMat_e00; - var e011 = viewMat_e10; - var e021 = viewMat_e20; - var e101 = viewMat_e01; - var e111 = viewMat_e11; - var e121 = viewMat_e21; - var e201 = viewMat_e02; - var e211 = viewMat_e12; - var e221 = viewMat_e22; - var e301 = viewMat_e03; - var e311 = viewMat_e13; - var e321 = viewMat_e23; - viewMat_e00 = e001; - viewMat_e01 = e011; - viewMat_e02 = e021; + var e00 = viewMat_e00; + var e01 = viewMat_e10; + var e02 = viewMat_e20; + var e10 = viewMat_e01; + var e11 = viewMat_e11; + var e12 = viewMat_e21; + var e20 = viewMat_e02; + var e21 = viewMat_e12; + var e22 = viewMat_e22; + var e30 = viewMat_e03; + var e31 = viewMat_e13; + var e32 = viewMat_e23; + viewMat_e00 = e00; + viewMat_e01 = e01; + viewMat_e02 = e02; viewMat_e03 = viewMat_e30; - viewMat_e10 = e101; - viewMat_e11 = e111; - viewMat_e12 = e121; + viewMat_e10 = e10; + viewMat_e11 = e11; + viewMat_e12 = e12; viewMat_e13 = viewMat_e31; - viewMat_e20 = e201; - viewMat_e21 = e211; - viewMat_e22 = e221; + viewMat_e20 = e20; + viewMat_e21 = e21; + viewMat_e22 = e22; viewMat_e23 = viewMat_e32; - viewMat_e30 = e301; - viewMat_e31 = e311; - viewMat_e32 = e321; + viewMat_e30 = e30; + viewMat_e31 = e31; + viewMat_e32 = e32; viewMat_e03 = 0; viewMat_e13 = 0; viewMat_e23 = 0; - var x1 = _this_x * e001 + _this_y * e011 + _this_z * e021 + viewMat_e03; - var y1 = _this_x * e101 + _this_y * e111 + _this_z * e121 + viewMat_e13; - var z1 = _this_x * e201 + _this_y * e211 + _this_z * e221 + viewMat_e23; - _this_x = x1; - _this_y = y1; - _this_z = z1; - var invLen = Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1); + var x = _this_x * e00 + _this_y * e01 + _this_z * e02 + viewMat_e03; + var y = _this_x * e10 + _this_y * e11 + _this_z * e12 + viewMat_e13; + var z = _this_x * e20 + _this_y * e21 + _this_z * e22 + viewMat_e23; + _this_x = x; + _this_y = y; + _this_z = z; + var invLen = Math.sqrt(x * x + y * y + z * z); if(invLen > 0) { invLen = 1 / invLen; } - var x2 = x1 * invLen; - var y2 = y1 * invLen; - var z2 = z1 * invLen; - _this_x = x2; - _this_y = y2; - _this_z = z2; + var x1 = x * invLen; + var y1 = y * invLen; + var z1 = z * invLen; + _this_x = x1; + _this_y = y1; + _this_z = z1; if(this.mouseJoint != null) { if(this.input.mouseL) { - var _this2 = this.mouseJointDummyBody; + var _this = this.mouseJointDummyBody; var s = this.grabbingDistance; - var x3 = x2 * s; - var y3 = y2 * s; - var z3 = z2 * s; - if(z3 == null) { - z3 = 0; + var x = x1 * s; + var y = y1 * s; + var z = z1 * s; + if(z == null) { + z = 0; } - if(y3 == null) { - y3 = 0; + if(y == null) { + y = 0; } - if(x3 == null) { - x3 = 0; + if(x == null) { + x = 0; } oimo_common_Vec3.numCreations++; - var x4 = cameraPos.x + x3; - var y4 = cameraPos.y + y3; - var z4 = cameraPos.z + z3; - if(z4 == null) { - z4 = 0; + var x2 = cameraPos.x + x; + var y2 = cameraPos.y + y; + var z2 = cameraPos.z + z; + if(z2 == null) { + z2 = 0; } - if(y4 == null) { - y4 = 0; + if(y2 == null) { + y2 = 0; } - if(x4 == null) { - x4 = 0; + if(x2 == null) { + x2 = 0; } oimo_common_Vec3.numCreations++; - _this2._transform._positionX = x4; - _this2._transform._positionY = y4; - _this2._transform._positionZ = z4; - var dst = _this2._ptransform; - var src = _this2._transform; + _this._transform._positionX = x2; + _this._transform._positionY = y2; + _this._transform._positionZ = z2; + var dst = _this._ptransform; + var src = _this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -473,13 +469,13 @@ demo_common_DemoBase.prototype = { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s1 = _this2._shapeList; - while(s1 != null) { - var n = s1._next; - var tf1 = _this2._ptransform; - var tf2 = _this2._transform; - var dst1 = s1._ptransform; - var src1 = s1._localTransform; + var s = _this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this._ptransform; + var tf2 = _this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; var __tmp__00; var __tmp__01; var __tmp__02; @@ -498,29 +494,29 @@ demo_common_DemoBase.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s1._transform; - var src11 = s1._localTransform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; var __tmp__001; var __tmp__011; var __tmp__021; @@ -539,89 +535,89 @@ demo_common_DemoBase.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; var maxX; var maxY; var maxZ; - s1._geom._computeAabb(s1._aabb,s1._ptransform); - minX = s1._aabb._minX; - minY = s1._aabb._minY; - minZ = s1._aabb._minZ; - maxX = s1._aabb._maxX; - maxY = s1._aabb._maxY; - maxZ = s1._aabb._maxZ; - s1._geom._computeAabb(s1._aabb,s1._transform); - s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; - s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; - s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; - s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; - s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; - s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; - if(s1._proxy != null) { + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s1._transform._positionX - s1._ptransform._positionX; - dY = s1._transform._positionY - s1._ptransform._positionY; - dZ = s1._transform._positionZ - s1._ptransform._positionZ; - var v = s1.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s1 = n; - } - _this2._sleeping = false; - _this2._sleepTime = 0; - var _this3 = this.mouseJoint._b1; - _this3._sleeping = false; - _this3._sleepTime = 0; - var _this4 = this.mouseJoint._b2; - _this4._sleeping = false; - _this4._sleepTime = 0; + s = n; + } + _this._sleeping = false; + _this._sleepTime = 0; + var _this = this.mouseJoint._b1; + _this._sleeping = false; + _this._sleepTime = 0; + var _this = this.mouseJoint._b2; + _this._sleeping = false; + _this._sleepTime = 0; } else { this.world.removeJoint(this.mouseJoint); this.mouseJoint = null; } } else if(this.input.mouseL && !this.input.pmouseL) { - var x5 = x2 * 500; - var y5 = y2 * 500; - var z5 = z2 * 500; - if(z5 == null) { - z5 = 0; + var x = x1 * 500; + var y = y1 * 500; + var z = z1 * 500; + if(z == null) { + z = 0; } - if(y5 == null) { - y5 = 0; + if(y == null) { + y = 0; } - if(x5 == null) { - x5 = 0; + if(x == null) { + x = 0; } oimo_common_Vec3.numCreations++; - var end = new oimo_common_Vec3(cameraPos.x + x5,cameraPos.y + y5,cameraPos.z + z5); + var end = new oimo_common_Vec3(cameraPos.x + x,cameraPos.y + y,cameraPos.z + z); var closest = new oimo_dynamics_callback_RayCastClosest(); this.world.rayCast(cameraPos,end,closest); if(!closest.hit) { @@ -646,7 +642,7 @@ demo_common_DemoBase.prototype = { v_y = body._transform._positionY; v_z = body._transform._positionZ; jc.localAnchor1 = new oimo_common_Vec3(position.x - v_x,position.y - v_y,position.z - v_z); - var _this5 = jc.localAnchor1; + var _this = jc.localAnchor1; var m_e00 = 1; var m_e01 = 0; var m_e02 = 0; @@ -666,191 +662,191 @@ demo_common_DemoBase.prototype = { m_e20 = body._transform._rotation20; m_e21 = body._transform._rotation21; m_e22 = body._transform._rotation22; - var e002 = m_e00; - var e012 = m_e10; - var e022 = m_e20; - var e102 = m_e01; - var e112 = m_e11; - var e122 = m_e21; - var e202 = m_e02; - var e212 = m_e12; - var e222 = m_e22; - m_e00 = e002; - m_e01 = e012; - m_e02 = e022; - m_e10 = e102; - m_e11 = e112; - m_e12 = e122; - m_e20 = e202; - m_e21 = e212; - m_e22 = e222; - var y6 = _this5.x * e102 + _this5.y * e112 + _this5.z * e122; - var z6 = _this5.x * e202 + _this5.y * e212 + _this5.z * e222; - _this5.x = _this5.x * e002 + _this5.y * e012 + _this5.z * e022; - _this5.y = y6; - _this5.z = z6; + var e00 = m_e00; + var e01 = m_e10; + var e02 = m_e20; + var e10 = m_e01; + var e11 = m_e11; + var e12 = m_e21; + var e20 = m_e02; + var e21 = m_e12; + var e22 = m_e22; + m_e00 = e00; + m_e01 = e01; + m_e02 = e02; + m_e10 = e10; + m_e11 = e11; + m_e12 = e12; + m_e20 = e20; + m_e21 = e21; + m_e22 = e22; + var y = _this.x * e10 + _this.y * e11 + _this.z * e12; + var z = _this.x * e20 + _this.y * e21 + _this.z * e22; + _this.x = _this.x * e00 + _this.y * e01 + _this.z * e02; + _this.y = y; + _this.z = z; jc.localAnchor2.zero(); - var _this6 = this.mouseJointDummyBody; - _this6._transform._positionX = position.x; - _this6._transform._positionY = position.y; - _this6._transform._positionZ = position.z; - var dst3 = _this6._ptransform; - var src2 = _this6._transform; - dst3._positionX = src2._positionX; - dst3._positionY = src2._positionY; - dst3._positionZ = src2._positionZ; - dst3._rotation00 = src2._rotation00; - dst3._rotation01 = src2._rotation01; - dst3._rotation02 = src2._rotation02; - dst3._rotation10 = src2._rotation10; - dst3._rotation11 = src2._rotation11; - dst3._rotation12 = src2._rotation12; - dst3._rotation20 = src2._rotation20; - dst3._rotation21 = src2._rotation21; - dst3._rotation22 = src2._rotation22; - var s2 = _this6._shapeList; - while(s2 != null) { - var n1 = s2._next; - var tf11 = _this6._ptransform; - var tf21 = _this6._transform; - var dst4 = s2._ptransform; - var src12 = s2._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; - __tmp__012 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; - __tmp__022 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; - __tmp__102 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; - __tmp__112 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; - __tmp__122 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; - __tmp__202 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; - __tmp__212 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; - __tmp__222 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; - dst4._rotation00 = __tmp__002; - dst4._rotation01 = __tmp__012; - dst4._rotation02 = __tmp__022; - dst4._rotation10 = __tmp__102; - dst4._rotation11 = __tmp__112; - dst4._rotation12 = __tmp__122; - dst4._rotation20 = __tmp__202; - dst4._rotation21 = __tmp__212; - dst4._rotation22 = __tmp__222; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; - __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; - __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; - dst4._positionX = __tmp__X2; - dst4._positionY = __tmp__Y2; - dst4._positionZ = __tmp__Z2; - dst4._positionX += tf11._positionX; - dst4._positionY += tf11._positionY; - dst4._positionZ += tf11._positionZ; - var dst5 = s2._transform; - var src13 = s2._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; - __tmp__013 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; - __tmp__023 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; - __tmp__103 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; - __tmp__113 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; - __tmp__123 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; - __tmp__203 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; - __tmp__213 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; - __tmp__223 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; - dst5._rotation00 = __tmp__003; - dst5._rotation01 = __tmp__013; - dst5._rotation02 = __tmp__023; - dst5._rotation10 = __tmp__103; - dst5._rotation11 = __tmp__113; - dst5._rotation12 = __tmp__123; - dst5._rotation20 = __tmp__203; - dst5._rotation21 = __tmp__213; - dst5._rotation22 = __tmp__223; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; - __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; - __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; - dst5._positionX = __tmp__X3; - dst5._positionY = __tmp__Y3; - dst5._positionZ = __tmp__Z3; - dst5._positionX += tf21._positionX; - dst5._positionY += tf21._positionY; - dst5._positionZ += tf21._positionZ; - var minX1; - var minY1; - var minZ1; - var maxX1; - var maxY1; - var maxZ1; - s2._geom._computeAabb(s2._aabb,s2._ptransform); - minX1 = s2._aabb._minX; - minY1 = s2._aabb._minY; - minZ1 = s2._aabb._minZ; - maxX1 = s2._aabb._maxX; - maxY1 = s2._aabb._maxY; - maxZ1 = s2._aabb._maxZ; - s2._geom._computeAabb(s2._aabb,s2._transform); - s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; - s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; - s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; - s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; - s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; - s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; - if(s2._proxy != null) { - var dX1; - var dY1; - var dZ1; - dX1 = s2._transform._positionX - s2._ptransform._positionX; - dY1 = s2._transform._positionY - s2._ptransform._positionY; - dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; - var v1 = s2.displacement; - v1.x = dX1; - v1.y = dY1; - v1.z = dZ1; - s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); - } - s2 = n1; - } - _this6._sleeping = false; - _this6._sleepTime = 0; + var _this = this.mouseJointDummyBody; + _this._transform._positionX = position.x; + _this._transform._positionY = position.y; + _this._transform._positionZ = position.z; + var dst = _this._ptransform; + var src = _this._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = _this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this._ptransform; + var tf2 = _this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + _this._sleeping = false; + _this._sleepTime = 0; this.mouseJoint = new oimo_dynamics_constraint_joint_SphericalJoint(jc); this.world.addJoint(this.mouseJoint); - var x6 = position.x - cameraPos.x; - var y7 = position.y - cameraPos.y; - var z7 = position.z - cameraPos.z; - if(z7 == null) { - z7 = 0; + var x = position.x - cameraPos.x; + var y = position.y - cameraPos.y; + var z = position.z - cameraPos.z; + if(z == null) { + z = 0; } - if(y7 == null) { - y7 = 0; + if(y == null) { + y = 0; } - if(x6 == null) { - x6 = 0; + if(x == null) { + x = 0; } - var _this_x1 = x6; - var _this_y1 = y7; - var _this_z1 = z7; + var _this_x = x; + var _this_y = y; + var _this_z = z; oimo_common_Vec3.numCreations++; - this.grabbingDistance = Math.sqrt(_this_x1 * _this_x1 + _this_y1 * _this_y1 + _this_z1 * _this_z1); + this.grabbingDistance = Math.sqrt(_this_x * _this_x + _this_y * _this_y + _this_z * _this_z); } } ,draw: function() { @@ -868,7 +864,7 @@ var demo_common_DemoMain = function(width,height) { this.viewInfo = new demo_common_ViewInfo(); this.nmouseX = 0; this.nmouseY = 0; - this.fpsTime = Date.now() / 1000; + this.fpsTime = HxOverrides.now() / 1000; this.fpsCount = 0; this.fps = 0; this.pause = false; @@ -933,12 +929,10 @@ demo_common_DemoMain.prototype = { return "previous demo"; },HxOverrides.cca("Q",0),function() { _gthis.changeDemo(-1); - return; }),new demo_common_Control("E",function() { return "next demo"; },HxOverrides.cca("E",0),function() { _gthis.changeDemo(1); - return; }),new demo_common_Control("ENTER",function() { if(_gthis.pause) { return "resume"; @@ -946,7 +940,7 @@ demo_common_DemoMain.prototype = { return "pause"; } },demo_common_UserInput.KEYCODE_ENTER,function() { - return _gthis.pause = !_gthis.pause; + _gthis.pause = !_gthis.pause; }),new demo_common_Control("P",function() { if(_gthis.pause) { return "compute single step"; @@ -957,51 +951,50 @@ demo_common_DemoMain.prototype = { if(_gthis.pause) { _gthis.singleStep = true; } - return; }),new demo_common_Control("W",function() { return (dd.wireframe ? "solid" : "wireframe") + " mode"; },HxOverrides.cca("W",0),function() { - return dd.wireframe = !dd.wireframe; + dd.wireframe = !dd.wireframe; }),new demo_common_Control("L",function() { return (oimo_common_Setting.disableSleeping ? "enable" : "disable") + " sleeping"; },HxOverrides.cca("L",0),function() { - return oimo_common_Setting.disableSleeping = !oimo_common_Setting.disableSleeping; + oimo_common_Setting.disableSleeping = !oimo_common_Setting.disableSleeping; }),new demo_common_Control("R",function() { return (dd.drawPairs ? "hide" : "draw") + " pairs"; },HxOverrides.cca("R",0),function() { - return dd.drawPairs = !dd.drawPairs; + dd.drawPairs = !dd.drawPairs; }),new demo_common_Control("V",function() { return (dd.drawAabbs ? "hide" : "draw") + " AABBs"; },HxOverrides.cca("V",0),function() { - return dd.drawAabbs = !dd.drawAabbs; + dd.drawAabbs = !dd.drawAabbs; }),new demo_common_Control("B",function() { return (dd.drawBases ? "hide" : "draw") + " bases"; },HxOverrides.cca("B",0),function() { - return dd.drawBases = !dd.drawBases; + dd.drawBases = !dd.drawBases; }),new demo_common_Control("C",function() { return (dd.drawContacts ? "hide" : "draw") + " contacts"; },HxOverrides.cca("C",0),function() { - return dd.drawContacts = !dd.drawContacts; + dd.drawContacts = !dd.drawContacts; }),new demo_common_Control("J",function() { return (dd.drawJoints ? "hide" : "draw") + " joints"; },HxOverrides.cca("J",0),function() { - return dd.drawJoints = !dd.drawJoints; + dd.drawJoints = !dd.drawJoints; }),new demo_common_Control("K",function() { return (dd.drawJointLimits ? "hide" : "draw") + " joint limits"; },HxOverrides.cca("K",0),function() { - return dd.drawJointLimits = !dd.drawJointLimits; + dd.drawJointLimits = !dd.drawJointLimits; }),new demo_common_Control("A",function() { return (dd.drawContactBases ? "hide" : "draw") + " contact bases"; },HxOverrides.cca("A",0),function() { - return dd.drawContactBases = !dd.drawContactBases; + dd.drawContactBases = !dd.drawContactBases; }),new demo_common_Control("T",function() { return (dd.drawBvh ? "hide" : "draw") + " AABB tree"; },HxOverrides.cca("T",0),function() { - return dd.drawBvh = !dd.drawBvh; + dd.drawBvh = !dd.drawBvh; }),new demo_common_Control("S",function() { return (dd.drawShapes ? "hide" : "draw") + " shapes"; },HxOverrides.cca("S",0),function() { - return dd.drawShapes = !dd.drawShapes; + dd.drawShapes = !dd.drawShapes; })]); this.currentDemo.initControls(this.controls); } @@ -1028,10 +1021,10 @@ demo_common_DemoMain.prototype = { this.world.step(this.currentDemo.dt); this.singleStep = false; } - var drawBegin = Date.now() / 1000; + var drawBegin = HxOverrides.now() / 1000; this.currentDemo.draw(); - var drawTime = (Date.now() / 1000 - drawBegin) * 1000; - var currentTime = Date.now() / 1000; + var drawTime = (HxOverrides.now() / 1000 - drawBegin) * 1000; + var currentTime = HxOverrides.now() / 1000; this.fpsCount++; if(this.fpsTime + 1 < currentTime) { this.fps = this.fpsCount; @@ -1482,33 +1475,33 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armL1._invInertia20 = __tmp__20; armL1._invInertia21 = __tmp__21; armL1._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = armL1._invInertia00 * armL1._transform._rotation00 + armL1._invInertia01 * armL1._transform._rotation01 + armL1._invInertia02 * armL1._transform._rotation02; - __tmp__011 = armL1._invInertia00 * armL1._transform._rotation10 + armL1._invInertia01 * armL1._transform._rotation11 + armL1._invInertia02 * armL1._transform._rotation12; - __tmp__021 = armL1._invInertia00 * armL1._transform._rotation20 + armL1._invInertia01 * armL1._transform._rotation21 + armL1._invInertia02 * armL1._transform._rotation22; - __tmp__101 = armL1._invInertia10 * armL1._transform._rotation00 + armL1._invInertia11 * armL1._transform._rotation01 + armL1._invInertia12 * armL1._transform._rotation02; - __tmp__111 = armL1._invInertia10 * armL1._transform._rotation10 + armL1._invInertia11 * armL1._transform._rotation11 + armL1._invInertia12 * armL1._transform._rotation12; - __tmp__121 = armL1._invInertia10 * armL1._transform._rotation20 + armL1._invInertia11 * armL1._transform._rotation21 + armL1._invInertia12 * armL1._transform._rotation22; - __tmp__201 = armL1._invInertia20 * armL1._transform._rotation00 + armL1._invInertia21 * armL1._transform._rotation01 + armL1._invInertia22 * armL1._transform._rotation02; - __tmp__211 = armL1._invInertia20 * armL1._transform._rotation10 + armL1._invInertia21 * armL1._transform._rotation11 + armL1._invInertia22 * armL1._transform._rotation12; - __tmp__221 = armL1._invInertia20 * armL1._transform._rotation20 + armL1._invInertia21 * armL1._transform._rotation21 + armL1._invInertia22 * armL1._transform._rotation22; - armL1._invInertia00 = __tmp__001; - armL1._invInertia01 = __tmp__011; - armL1._invInertia02 = __tmp__021; - armL1._invInertia10 = __tmp__101; - armL1._invInertia11 = __tmp__111; - armL1._invInertia12 = __tmp__121; - armL1._invInertia20 = __tmp__201; - armL1._invInertia21 = __tmp__211; - armL1._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armL1._invInertia00 * armL1._transform._rotation00 + armL1._invInertia01 * armL1._transform._rotation01 + armL1._invInertia02 * armL1._transform._rotation02; + __tmp__01 = armL1._invInertia00 * armL1._transform._rotation10 + armL1._invInertia01 * armL1._transform._rotation11 + armL1._invInertia02 * armL1._transform._rotation12; + __tmp__02 = armL1._invInertia00 * armL1._transform._rotation20 + armL1._invInertia01 * armL1._transform._rotation21 + armL1._invInertia02 * armL1._transform._rotation22; + __tmp__10 = armL1._invInertia10 * armL1._transform._rotation00 + armL1._invInertia11 * armL1._transform._rotation01 + armL1._invInertia12 * armL1._transform._rotation02; + __tmp__11 = armL1._invInertia10 * armL1._transform._rotation10 + armL1._invInertia11 * armL1._transform._rotation11 + armL1._invInertia12 * armL1._transform._rotation12; + __tmp__12 = armL1._invInertia10 * armL1._transform._rotation20 + armL1._invInertia11 * armL1._transform._rotation21 + armL1._invInertia12 * armL1._transform._rotation22; + __tmp__20 = armL1._invInertia20 * armL1._transform._rotation00 + armL1._invInertia21 * armL1._transform._rotation01 + armL1._invInertia22 * armL1._transform._rotation02; + __tmp__21 = armL1._invInertia20 * armL1._transform._rotation10 + armL1._invInertia21 * armL1._transform._rotation11 + armL1._invInertia22 * armL1._transform._rotation12; + __tmp__22 = armL1._invInertia20 * armL1._transform._rotation20 + armL1._invInertia21 * armL1._transform._rotation21 + armL1._invInertia22 * armL1._transform._rotation22; + armL1._invInertia00 = __tmp__00; + armL1._invInertia01 = __tmp__01; + armL1._invInertia02 = __tmp__02; + armL1._invInertia10 = __tmp__10; + armL1._invInertia11 = __tmp__11; + armL1._invInertia12 = __tmp__12; + armL1._invInertia20 = __tmp__20; + armL1._invInertia21 = __tmp__21; + armL1._invInertia22 = __tmp__22; armL1._invInertia00 *= armL1._rotFactor.x; armL1._invInertia01 *= armL1._rotFactor.x; armL1._invInertia02 *= armL1._rotFactor.x; @@ -1532,127 +1525,127 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s1 = armL1._shapeList; - while(s1 != null) { - var n = s1._next; + var s = armL1._shapeList; + while(s != null) { + var n = s._next; var tf1 = armL1._ptransform; var tf2 = armL1._transform; - var dst1 = s1._ptransform; - var src1 = s1._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s1._transform; - var src11 = s1._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; var maxX; var maxY; var maxZ; - s1._geom._computeAabb(s1._aabb,s1._ptransform); - minX = s1._aabb._minX; - minY = s1._aabb._minY; - minZ = s1._aabb._minZ; - maxX = s1._aabb._maxX; - maxY = s1._aabb._maxY; - maxZ = s1._aabb._maxZ; - s1._geom._computeAabb(s1._aabb,s1._transform); - s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; - s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; - s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; - s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; - s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; - s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; - if(s1._proxy != null) { + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s1._transform._positionX - s1._ptransform._positionX; - dY = s1._transform._positionY - s1._ptransform._positionY; - dZ = s1._transform._positionZ - s1._ptransform._positionZ; - var v = s1.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s1 = n; + s = n; } armL1._sleeping = false; armL1._sleepTime = 0; @@ -1665,60 +1658,60 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armL2._transform._rotation20 = e20; armL2._transform._rotation21 = e21; armL2._transform._rotation22 = e22; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = armL2._transform._rotation00 * armL2._invLocalInertia00 + armL2._transform._rotation01 * armL2._invLocalInertia10 + armL2._transform._rotation02 * armL2._invLocalInertia20; - __tmp__014 = armL2._transform._rotation00 * armL2._invLocalInertia01 + armL2._transform._rotation01 * armL2._invLocalInertia11 + armL2._transform._rotation02 * armL2._invLocalInertia21; - __tmp__024 = armL2._transform._rotation00 * armL2._invLocalInertia02 + armL2._transform._rotation01 * armL2._invLocalInertia12 + armL2._transform._rotation02 * armL2._invLocalInertia22; - __tmp__104 = armL2._transform._rotation10 * armL2._invLocalInertia00 + armL2._transform._rotation11 * armL2._invLocalInertia10 + armL2._transform._rotation12 * armL2._invLocalInertia20; - __tmp__114 = armL2._transform._rotation10 * armL2._invLocalInertia01 + armL2._transform._rotation11 * armL2._invLocalInertia11 + armL2._transform._rotation12 * armL2._invLocalInertia21; - __tmp__124 = armL2._transform._rotation10 * armL2._invLocalInertia02 + armL2._transform._rotation11 * armL2._invLocalInertia12 + armL2._transform._rotation12 * armL2._invLocalInertia22; - __tmp__204 = armL2._transform._rotation20 * armL2._invLocalInertia00 + armL2._transform._rotation21 * armL2._invLocalInertia10 + armL2._transform._rotation22 * armL2._invLocalInertia20; - __tmp__214 = armL2._transform._rotation20 * armL2._invLocalInertia01 + armL2._transform._rotation21 * armL2._invLocalInertia11 + armL2._transform._rotation22 * armL2._invLocalInertia21; - __tmp__224 = armL2._transform._rotation20 * armL2._invLocalInertia02 + armL2._transform._rotation21 * armL2._invLocalInertia12 + armL2._transform._rotation22 * armL2._invLocalInertia22; - armL2._invInertia00 = __tmp__004; - armL2._invInertia01 = __tmp__014; - armL2._invInertia02 = __tmp__024; - armL2._invInertia10 = __tmp__104; - armL2._invInertia11 = __tmp__114; - armL2._invInertia12 = __tmp__124; - armL2._invInertia20 = __tmp__204; - armL2._invInertia21 = __tmp__214; - armL2._invInertia22 = __tmp__224; - var __tmp__005; - var __tmp__015; - var __tmp__025; - var __tmp__105; - var __tmp__115; - var __tmp__125; - var __tmp__205; - var __tmp__215; - var __tmp__225; - __tmp__005 = armL2._invInertia00 * armL2._transform._rotation00 + armL2._invInertia01 * armL2._transform._rotation01 + armL2._invInertia02 * armL2._transform._rotation02; - __tmp__015 = armL2._invInertia00 * armL2._transform._rotation10 + armL2._invInertia01 * armL2._transform._rotation11 + armL2._invInertia02 * armL2._transform._rotation12; - __tmp__025 = armL2._invInertia00 * armL2._transform._rotation20 + armL2._invInertia01 * armL2._transform._rotation21 + armL2._invInertia02 * armL2._transform._rotation22; - __tmp__105 = armL2._invInertia10 * armL2._transform._rotation00 + armL2._invInertia11 * armL2._transform._rotation01 + armL2._invInertia12 * armL2._transform._rotation02; - __tmp__115 = armL2._invInertia10 * armL2._transform._rotation10 + armL2._invInertia11 * armL2._transform._rotation11 + armL2._invInertia12 * armL2._transform._rotation12; - __tmp__125 = armL2._invInertia10 * armL2._transform._rotation20 + armL2._invInertia11 * armL2._transform._rotation21 + armL2._invInertia12 * armL2._transform._rotation22; - __tmp__205 = armL2._invInertia20 * armL2._transform._rotation00 + armL2._invInertia21 * armL2._transform._rotation01 + armL2._invInertia22 * armL2._transform._rotation02; - __tmp__215 = armL2._invInertia20 * armL2._transform._rotation10 + armL2._invInertia21 * armL2._transform._rotation11 + armL2._invInertia22 * armL2._transform._rotation12; - __tmp__225 = armL2._invInertia20 * armL2._transform._rotation20 + armL2._invInertia21 * armL2._transform._rotation21 + armL2._invInertia22 * armL2._transform._rotation22; - armL2._invInertia00 = __tmp__005; - armL2._invInertia01 = __tmp__015; - armL2._invInertia02 = __tmp__025; - armL2._invInertia10 = __tmp__105; - armL2._invInertia11 = __tmp__115; - armL2._invInertia12 = __tmp__125; - armL2._invInertia20 = __tmp__205; - armL2._invInertia21 = __tmp__215; - armL2._invInertia22 = __tmp__225; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armL2._transform._rotation00 * armL2._invLocalInertia00 + armL2._transform._rotation01 * armL2._invLocalInertia10 + armL2._transform._rotation02 * armL2._invLocalInertia20; + __tmp__01 = armL2._transform._rotation00 * armL2._invLocalInertia01 + armL2._transform._rotation01 * armL2._invLocalInertia11 + armL2._transform._rotation02 * armL2._invLocalInertia21; + __tmp__02 = armL2._transform._rotation00 * armL2._invLocalInertia02 + armL2._transform._rotation01 * armL2._invLocalInertia12 + armL2._transform._rotation02 * armL2._invLocalInertia22; + __tmp__10 = armL2._transform._rotation10 * armL2._invLocalInertia00 + armL2._transform._rotation11 * armL2._invLocalInertia10 + armL2._transform._rotation12 * armL2._invLocalInertia20; + __tmp__11 = armL2._transform._rotation10 * armL2._invLocalInertia01 + armL2._transform._rotation11 * armL2._invLocalInertia11 + armL2._transform._rotation12 * armL2._invLocalInertia21; + __tmp__12 = armL2._transform._rotation10 * armL2._invLocalInertia02 + armL2._transform._rotation11 * armL2._invLocalInertia12 + armL2._transform._rotation12 * armL2._invLocalInertia22; + __tmp__20 = armL2._transform._rotation20 * armL2._invLocalInertia00 + armL2._transform._rotation21 * armL2._invLocalInertia10 + armL2._transform._rotation22 * armL2._invLocalInertia20; + __tmp__21 = armL2._transform._rotation20 * armL2._invLocalInertia01 + armL2._transform._rotation21 * armL2._invLocalInertia11 + armL2._transform._rotation22 * armL2._invLocalInertia21; + __tmp__22 = armL2._transform._rotation20 * armL2._invLocalInertia02 + armL2._transform._rotation21 * armL2._invLocalInertia12 + armL2._transform._rotation22 * armL2._invLocalInertia22; + armL2._invInertia00 = __tmp__00; + armL2._invInertia01 = __tmp__01; + armL2._invInertia02 = __tmp__02; + armL2._invInertia10 = __tmp__10; + armL2._invInertia11 = __tmp__11; + armL2._invInertia12 = __tmp__12; + armL2._invInertia20 = __tmp__20; + armL2._invInertia21 = __tmp__21; + armL2._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armL2._invInertia00 * armL2._transform._rotation00 + armL2._invInertia01 * armL2._transform._rotation01 + armL2._invInertia02 * armL2._transform._rotation02; + __tmp__01 = armL2._invInertia00 * armL2._transform._rotation10 + armL2._invInertia01 * armL2._transform._rotation11 + armL2._invInertia02 * armL2._transform._rotation12; + __tmp__02 = armL2._invInertia00 * armL2._transform._rotation20 + armL2._invInertia01 * armL2._transform._rotation21 + armL2._invInertia02 * armL2._transform._rotation22; + __tmp__10 = armL2._invInertia10 * armL2._transform._rotation00 + armL2._invInertia11 * armL2._transform._rotation01 + armL2._invInertia12 * armL2._transform._rotation02; + __tmp__11 = armL2._invInertia10 * armL2._transform._rotation10 + armL2._invInertia11 * armL2._transform._rotation11 + armL2._invInertia12 * armL2._transform._rotation12; + __tmp__12 = armL2._invInertia10 * armL2._transform._rotation20 + armL2._invInertia11 * armL2._transform._rotation21 + armL2._invInertia12 * armL2._transform._rotation22; + __tmp__20 = armL2._invInertia20 * armL2._transform._rotation00 + armL2._invInertia21 * armL2._transform._rotation01 + armL2._invInertia22 * armL2._transform._rotation02; + __tmp__21 = armL2._invInertia20 * armL2._transform._rotation10 + armL2._invInertia21 * armL2._transform._rotation11 + armL2._invInertia22 * armL2._transform._rotation12; + __tmp__22 = armL2._invInertia20 * armL2._transform._rotation20 + armL2._invInertia21 * armL2._transform._rotation21 + armL2._invInertia22 * armL2._transform._rotation22; + armL2._invInertia00 = __tmp__00; + armL2._invInertia01 = __tmp__01; + armL2._invInertia02 = __tmp__02; + armL2._invInertia10 = __tmp__10; + armL2._invInertia11 = __tmp__11; + armL2._invInertia12 = __tmp__12; + armL2._invInertia20 = __tmp__20; + armL2._invInertia21 = __tmp__21; + armL2._invInertia22 = __tmp__22; armL2._invInertia00 *= armL2._rotFactor.x; armL2._invInertia01 *= armL2._rotFactor.x; armL2._invInertia02 *= armL2._rotFactor.x; @@ -1728,141 +1721,141 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armL2._invInertia20 *= armL2._rotFactor.z; armL2._invInertia21 *= armL2._rotFactor.z; armL2._invInertia22 *= armL2._rotFactor.z; - var dst3 = armL2._ptransform; - var src2 = armL2._transform; - dst3._positionX = src2._positionX; - dst3._positionY = src2._positionY; - dst3._positionZ = src2._positionZ; - dst3._rotation00 = src2._rotation00; - dst3._rotation01 = src2._rotation01; - dst3._rotation02 = src2._rotation02; - dst3._rotation10 = src2._rotation10; - dst3._rotation11 = src2._rotation11; - dst3._rotation12 = src2._rotation12; - dst3._rotation20 = src2._rotation20; - dst3._rotation21 = src2._rotation21; - dst3._rotation22 = src2._rotation22; - var s2 = armL2._shapeList; - while(s2 != null) { - var n1 = s2._next; - var tf11 = armL2._ptransform; - var tf21 = armL2._transform; - var dst4 = s2._ptransform; - var src12 = s2._localTransform; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; - __tmp__016 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; - __tmp__026 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; - __tmp__106 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; - __tmp__116 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; - __tmp__126 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; - __tmp__206 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; - __tmp__216 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; - __tmp__226 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; - dst4._rotation00 = __tmp__006; - dst4._rotation01 = __tmp__016; - dst4._rotation02 = __tmp__026; - dst4._rotation10 = __tmp__106; - dst4._rotation11 = __tmp__116; - dst4._rotation12 = __tmp__126; - dst4._rotation20 = __tmp__206; - dst4._rotation21 = __tmp__216; - dst4._rotation22 = __tmp__226; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; - __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; - __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; - dst4._positionX = __tmp__X2; - dst4._positionY = __tmp__Y2; - dst4._positionZ = __tmp__Z2; - dst4._positionX += tf11._positionX; - dst4._positionY += tf11._positionY; - dst4._positionZ += tf11._positionZ; - var dst5 = s2._transform; - var src13 = s2._localTransform; - var __tmp__007; - var __tmp__017; - var __tmp__027; - var __tmp__107; - var __tmp__117; - var __tmp__127; - var __tmp__207; - var __tmp__217; - var __tmp__227; - __tmp__007 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; - __tmp__017 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; - __tmp__027 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; - __tmp__107 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; - __tmp__117 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; - __tmp__127 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; - __tmp__207 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; - __tmp__217 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; - __tmp__227 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; - dst5._rotation00 = __tmp__007; - dst5._rotation01 = __tmp__017; - dst5._rotation02 = __tmp__027; - dst5._rotation10 = __tmp__107; - dst5._rotation11 = __tmp__117; - dst5._rotation12 = __tmp__127; - dst5._rotation20 = __tmp__207; - dst5._rotation21 = __tmp__217; - dst5._rotation22 = __tmp__227; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; - __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; - __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; - dst5._positionX = __tmp__X3; - dst5._positionY = __tmp__Y3; - dst5._positionZ = __tmp__Z3; - dst5._positionX += tf21._positionX; - dst5._positionY += tf21._positionY; - dst5._positionZ += tf21._positionZ; - var minX1; - var minY1; - var minZ1; - var maxX1; - var maxY1; - var maxZ1; - s2._geom._computeAabb(s2._aabb,s2._ptransform); - minX1 = s2._aabb._minX; - minY1 = s2._aabb._minY; - minZ1 = s2._aabb._minZ; - maxX1 = s2._aabb._maxX; - maxY1 = s2._aabb._maxY; - maxZ1 = s2._aabb._maxZ; - s2._geom._computeAabb(s2._aabb,s2._transform); - s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; - s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; - s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; - s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; - s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; - s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; - if(s2._proxy != null) { - var dX1; - var dY1; - var dZ1; - dX1 = s2._transform._positionX - s2._ptransform._positionX; - dY1 = s2._transform._positionY - s2._ptransform._positionY; - dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; - var v1 = s2.displacement; - v1.x = dX1; - v1.y = dY1; - v1.z = dZ1; - s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); - } - s2 = n1; + var dst = armL2._ptransform; + var src = armL2._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = armL2._shapeList; + while(s != null) { + var n = s._next; + var tf1 = armL2._ptransform; + var tf2 = armL2._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; } armL2._sleeping = false; armL2._sleepTime = 0; @@ -1875,60 +1868,60 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armR1._transform._rotation20 = e20; armR1._transform._rotation21 = e21; armR1._transform._rotation22 = e22; - var __tmp__008; - var __tmp__018; - var __tmp__028; - var __tmp__108; - var __tmp__118; - var __tmp__128; - var __tmp__208; - var __tmp__218; - var __tmp__228; - __tmp__008 = armR1._transform._rotation00 * armR1._invLocalInertia00 + armR1._transform._rotation01 * armR1._invLocalInertia10 + armR1._transform._rotation02 * armR1._invLocalInertia20; - __tmp__018 = armR1._transform._rotation00 * armR1._invLocalInertia01 + armR1._transform._rotation01 * armR1._invLocalInertia11 + armR1._transform._rotation02 * armR1._invLocalInertia21; - __tmp__028 = armR1._transform._rotation00 * armR1._invLocalInertia02 + armR1._transform._rotation01 * armR1._invLocalInertia12 + armR1._transform._rotation02 * armR1._invLocalInertia22; - __tmp__108 = armR1._transform._rotation10 * armR1._invLocalInertia00 + armR1._transform._rotation11 * armR1._invLocalInertia10 + armR1._transform._rotation12 * armR1._invLocalInertia20; - __tmp__118 = armR1._transform._rotation10 * armR1._invLocalInertia01 + armR1._transform._rotation11 * armR1._invLocalInertia11 + armR1._transform._rotation12 * armR1._invLocalInertia21; - __tmp__128 = armR1._transform._rotation10 * armR1._invLocalInertia02 + armR1._transform._rotation11 * armR1._invLocalInertia12 + armR1._transform._rotation12 * armR1._invLocalInertia22; - __tmp__208 = armR1._transform._rotation20 * armR1._invLocalInertia00 + armR1._transform._rotation21 * armR1._invLocalInertia10 + armR1._transform._rotation22 * armR1._invLocalInertia20; - __tmp__218 = armR1._transform._rotation20 * armR1._invLocalInertia01 + armR1._transform._rotation21 * armR1._invLocalInertia11 + armR1._transform._rotation22 * armR1._invLocalInertia21; - __tmp__228 = armR1._transform._rotation20 * armR1._invLocalInertia02 + armR1._transform._rotation21 * armR1._invLocalInertia12 + armR1._transform._rotation22 * armR1._invLocalInertia22; - armR1._invInertia00 = __tmp__008; - armR1._invInertia01 = __tmp__018; - armR1._invInertia02 = __tmp__028; - armR1._invInertia10 = __tmp__108; - armR1._invInertia11 = __tmp__118; - armR1._invInertia12 = __tmp__128; - armR1._invInertia20 = __tmp__208; - armR1._invInertia21 = __tmp__218; - armR1._invInertia22 = __tmp__228; - var __tmp__009; - var __tmp__019; - var __tmp__029; - var __tmp__109; - var __tmp__119; - var __tmp__129; - var __tmp__209; - var __tmp__219; - var __tmp__229; - __tmp__009 = armR1._invInertia00 * armR1._transform._rotation00 + armR1._invInertia01 * armR1._transform._rotation01 + armR1._invInertia02 * armR1._transform._rotation02; - __tmp__019 = armR1._invInertia00 * armR1._transform._rotation10 + armR1._invInertia01 * armR1._transform._rotation11 + armR1._invInertia02 * armR1._transform._rotation12; - __tmp__029 = armR1._invInertia00 * armR1._transform._rotation20 + armR1._invInertia01 * armR1._transform._rotation21 + armR1._invInertia02 * armR1._transform._rotation22; - __tmp__109 = armR1._invInertia10 * armR1._transform._rotation00 + armR1._invInertia11 * armR1._transform._rotation01 + armR1._invInertia12 * armR1._transform._rotation02; - __tmp__119 = armR1._invInertia10 * armR1._transform._rotation10 + armR1._invInertia11 * armR1._transform._rotation11 + armR1._invInertia12 * armR1._transform._rotation12; - __tmp__129 = armR1._invInertia10 * armR1._transform._rotation20 + armR1._invInertia11 * armR1._transform._rotation21 + armR1._invInertia12 * armR1._transform._rotation22; - __tmp__209 = armR1._invInertia20 * armR1._transform._rotation00 + armR1._invInertia21 * armR1._transform._rotation01 + armR1._invInertia22 * armR1._transform._rotation02; - __tmp__219 = armR1._invInertia20 * armR1._transform._rotation10 + armR1._invInertia21 * armR1._transform._rotation11 + armR1._invInertia22 * armR1._transform._rotation12; - __tmp__229 = armR1._invInertia20 * armR1._transform._rotation20 + armR1._invInertia21 * armR1._transform._rotation21 + armR1._invInertia22 * armR1._transform._rotation22; - armR1._invInertia00 = __tmp__009; - armR1._invInertia01 = __tmp__019; - armR1._invInertia02 = __tmp__029; - armR1._invInertia10 = __tmp__109; - armR1._invInertia11 = __tmp__119; - armR1._invInertia12 = __tmp__129; - armR1._invInertia20 = __tmp__209; - armR1._invInertia21 = __tmp__219; - armR1._invInertia22 = __tmp__229; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armR1._transform._rotation00 * armR1._invLocalInertia00 + armR1._transform._rotation01 * armR1._invLocalInertia10 + armR1._transform._rotation02 * armR1._invLocalInertia20; + __tmp__01 = armR1._transform._rotation00 * armR1._invLocalInertia01 + armR1._transform._rotation01 * armR1._invLocalInertia11 + armR1._transform._rotation02 * armR1._invLocalInertia21; + __tmp__02 = armR1._transform._rotation00 * armR1._invLocalInertia02 + armR1._transform._rotation01 * armR1._invLocalInertia12 + armR1._transform._rotation02 * armR1._invLocalInertia22; + __tmp__10 = armR1._transform._rotation10 * armR1._invLocalInertia00 + armR1._transform._rotation11 * armR1._invLocalInertia10 + armR1._transform._rotation12 * armR1._invLocalInertia20; + __tmp__11 = armR1._transform._rotation10 * armR1._invLocalInertia01 + armR1._transform._rotation11 * armR1._invLocalInertia11 + armR1._transform._rotation12 * armR1._invLocalInertia21; + __tmp__12 = armR1._transform._rotation10 * armR1._invLocalInertia02 + armR1._transform._rotation11 * armR1._invLocalInertia12 + armR1._transform._rotation12 * armR1._invLocalInertia22; + __tmp__20 = armR1._transform._rotation20 * armR1._invLocalInertia00 + armR1._transform._rotation21 * armR1._invLocalInertia10 + armR1._transform._rotation22 * armR1._invLocalInertia20; + __tmp__21 = armR1._transform._rotation20 * armR1._invLocalInertia01 + armR1._transform._rotation21 * armR1._invLocalInertia11 + armR1._transform._rotation22 * armR1._invLocalInertia21; + __tmp__22 = armR1._transform._rotation20 * armR1._invLocalInertia02 + armR1._transform._rotation21 * armR1._invLocalInertia12 + armR1._transform._rotation22 * armR1._invLocalInertia22; + armR1._invInertia00 = __tmp__00; + armR1._invInertia01 = __tmp__01; + armR1._invInertia02 = __tmp__02; + armR1._invInertia10 = __tmp__10; + armR1._invInertia11 = __tmp__11; + armR1._invInertia12 = __tmp__12; + armR1._invInertia20 = __tmp__20; + armR1._invInertia21 = __tmp__21; + armR1._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armR1._invInertia00 * armR1._transform._rotation00 + armR1._invInertia01 * armR1._transform._rotation01 + armR1._invInertia02 * armR1._transform._rotation02; + __tmp__01 = armR1._invInertia00 * armR1._transform._rotation10 + armR1._invInertia01 * armR1._transform._rotation11 + armR1._invInertia02 * armR1._transform._rotation12; + __tmp__02 = armR1._invInertia00 * armR1._transform._rotation20 + armR1._invInertia01 * armR1._transform._rotation21 + armR1._invInertia02 * armR1._transform._rotation22; + __tmp__10 = armR1._invInertia10 * armR1._transform._rotation00 + armR1._invInertia11 * armR1._transform._rotation01 + armR1._invInertia12 * armR1._transform._rotation02; + __tmp__11 = armR1._invInertia10 * armR1._transform._rotation10 + armR1._invInertia11 * armR1._transform._rotation11 + armR1._invInertia12 * armR1._transform._rotation12; + __tmp__12 = armR1._invInertia10 * armR1._transform._rotation20 + armR1._invInertia11 * armR1._transform._rotation21 + armR1._invInertia12 * armR1._transform._rotation22; + __tmp__20 = armR1._invInertia20 * armR1._transform._rotation00 + armR1._invInertia21 * armR1._transform._rotation01 + armR1._invInertia22 * armR1._transform._rotation02; + __tmp__21 = armR1._invInertia20 * armR1._transform._rotation10 + armR1._invInertia21 * armR1._transform._rotation11 + armR1._invInertia22 * armR1._transform._rotation12; + __tmp__22 = armR1._invInertia20 * armR1._transform._rotation20 + armR1._invInertia21 * armR1._transform._rotation21 + armR1._invInertia22 * armR1._transform._rotation22; + armR1._invInertia00 = __tmp__00; + armR1._invInertia01 = __tmp__01; + armR1._invInertia02 = __tmp__02; + armR1._invInertia10 = __tmp__10; + armR1._invInertia11 = __tmp__11; + armR1._invInertia12 = __tmp__12; + armR1._invInertia20 = __tmp__20; + armR1._invInertia21 = __tmp__21; + armR1._invInertia22 = __tmp__22; armR1._invInertia00 *= armR1._rotFactor.x; armR1._invInertia01 *= armR1._rotFactor.x; armR1._invInertia02 *= armR1._rotFactor.x; @@ -1938,141 +1931,141 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armR1._invInertia20 *= armR1._rotFactor.z; armR1._invInertia21 *= armR1._rotFactor.z; armR1._invInertia22 *= armR1._rotFactor.z; - var dst6 = armR1._ptransform; - var src3 = armR1._transform; - dst6._positionX = src3._positionX; - dst6._positionY = src3._positionY; - dst6._positionZ = src3._positionZ; - dst6._rotation00 = src3._rotation00; - dst6._rotation01 = src3._rotation01; - dst6._rotation02 = src3._rotation02; - dst6._rotation10 = src3._rotation10; - dst6._rotation11 = src3._rotation11; - dst6._rotation12 = src3._rotation12; - dst6._rotation20 = src3._rotation20; - dst6._rotation21 = src3._rotation21; - dst6._rotation22 = src3._rotation22; - var s3 = armR1._shapeList; - while(s3 != null) { - var n2 = s3._next; - var tf12 = armR1._ptransform; - var tf22 = armR1._transform; - var dst7 = s3._ptransform; - var src14 = s3._localTransform; - var __tmp__0010; - var __tmp__0110; - var __tmp__0210; - var __tmp__1010; - var __tmp__1110; - var __tmp__1210; - var __tmp__2010; - var __tmp__2110; - var __tmp__2210; - __tmp__0010 = tf12._rotation00 * src14._rotation00 + tf12._rotation01 * src14._rotation10 + tf12._rotation02 * src14._rotation20; - __tmp__0110 = tf12._rotation00 * src14._rotation01 + tf12._rotation01 * src14._rotation11 + tf12._rotation02 * src14._rotation21; - __tmp__0210 = tf12._rotation00 * src14._rotation02 + tf12._rotation01 * src14._rotation12 + tf12._rotation02 * src14._rotation22; - __tmp__1010 = tf12._rotation10 * src14._rotation00 + tf12._rotation11 * src14._rotation10 + tf12._rotation12 * src14._rotation20; - __tmp__1110 = tf12._rotation10 * src14._rotation01 + tf12._rotation11 * src14._rotation11 + tf12._rotation12 * src14._rotation21; - __tmp__1210 = tf12._rotation10 * src14._rotation02 + tf12._rotation11 * src14._rotation12 + tf12._rotation12 * src14._rotation22; - __tmp__2010 = tf12._rotation20 * src14._rotation00 + tf12._rotation21 * src14._rotation10 + tf12._rotation22 * src14._rotation20; - __tmp__2110 = tf12._rotation20 * src14._rotation01 + tf12._rotation21 * src14._rotation11 + tf12._rotation22 * src14._rotation21; - __tmp__2210 = tf12._rotation20 * src14._rotation02 + tf12._rotation21 * src14._rotation12 + tf12._rotation22 * src14._rotation22; - dst7._rotation00 = __tmp__0010; - dst7._rotation01 = __tmp__0110; - dst7._rotation02 = __tmp__0210; - dst7._rotation10 = __tmp__1010; - dst7._rotation11 = __tmp__1110; - dst7._rotation12 = __tmp__1210; - dst7._rotation20 = __tmp__2010; - dst7._rotation21 = __tmp__2110; - dst7._rotation22 = __tmp__2210; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf12._rotation00 * src14._positionX + tf12._rotation01 * src14._positionY + tf12._rotation02 * src14._positionZ; - __tmp__Y4 = tf12._rotation10 * src14._positionX + tf12._rotation11 * src14._positionY + tf12._rotation12 * src14._positionZ; - __tmp__Z4 = tf12._rotation20 * src14._positionX + tf12._rotation21 * src14._positionY + tf12._rotation22 * src14._positionZ; - dst7._positionX = __tmp__X4; - dst7._positionY = __tmp__Y4; - dst7._positionZ = __tmp__Z4; - dst7._positionX += tf12._positionX; - dst7._positionY += tf12._positionY; - dst7._positionZ += tf12._positionZ; - var dst8 = s3._transform; - var src15 = s3._localTransform; - var __tmp__0011; - var __tmp__0111; - var __tmp__0211; - var __tmp__1011; - var __tmp__1111; - var __tmp__1211; - var __tmp__2011; - var __tmp__2111; - var __tmp__2211; - __tmp__0011 = tf22._rotation00 * src15._rotation00 + tf22._rotation01 * src15._rotation10 + tf22._rotation02 * src15._rotation20; - __tmp__0111 = tf22._rotation00 * src15._rotation01 + tf22._rotation01 * src15._rotation11 + tf22._rotation02 * src15._rotation21; - __tmp__0211 = tf22._rotation00 * src15._rotation02 + tf22._rotation01 * src15._rotation12 + tf22._rotation02 * src15._rotation22; - __tmp__1011 = tf22._rotation10 * src15._rotation00 + tf22._rotation11 * src15._rotation10 + tf22._rotation12 * src15._rotation20; - __tmp__1111 = tf22._rotation10 * src15._rotation01 + tf22._rotation11 * src15._rotation11 + tf22._rotation12 * src15._rotation21; - __tmp__1211 = tf22._rotation10 * src15._rotation02 + tf22._rotation11 * src15._rotation12 + tf22._rotation12 * src15._rotation22; - __tmp__2011 = tf22._rotation20 * src15._rotation00 + tf22._rotation21 * src15._rotation10 + tf22._rotation22 * src15._rotation20; - __tmp__2111 = tf22._rotation20 * src15._rotation01 + tf22._rotation21 * src15._rotation11 + tf22._rotation22 * src15._rotation21; - __tmp__2211 = tf22._rotation20 * src15._rotation02 + tf22._rotation21 * src15._rotation12 + tf22._rotation22 * src15._rotation22; - dst8._rotation00 = __tmp__0011; - dst8._rotation01 = __tmp__0111; - dst8._rotation02 = __tmp__0211; - dst8._rotation10 = __tmp__1011; - dst8._rotation11 = __tmp__1111; - dst8._rotation12 = __tmp__1211; - dst8._rotation20 = __tmp__2011; - dst8._rotation21 = __tmp__2111; - dst8._rotation22 = __tmp__2211; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; - __tmp__X5 = tf22._rotation00 * src15._positionX + tf22._rotation01 * src15._positionY + tf22._rotation02 * src15._positionZ; - __tmp__Y5 = tf22._rotation10 * src15._positionX + tf22._rotation11 * src15._positionY + tf22._rotation12 * src15._positionZ; - __tmp__Z5 = tf22._rotation20 * src15._positionX + tf22._rotation21 * src15._positionY + tf22._rotation22 * src15._positionZ; - dst8._positionX = __tmp__X5; - dst8._positionY = __tmp__Y5; - dst8._positionZ = __tmp__Z5; - dst8._positionX += tf22._positionX; - dst8._positionY += tf22._positionY; - dst8._positionZ += tf22._positionZ; - var minX2; - var minY2; - var minZ2; - var maxX2; - var maxY2; - var maxZ2; - s3._geom._computeAabb(s3._aabb,s3._ptransform); - minX2 = s3._aabb._minX; - minY2 = s3._aabb._minY; - minZ2 = s3._aabb._minZ; - maxX2 = s3._aabb._maxX; - maxY2 = s3._aabb._maxY; - maxZ2 = s3._aabb._maxZ; - s3._geom._computeAabb(s3._aabb,s3._transform); - s3._aabb._minX = minX2 < s3._aabb._minX ? minX2 : s3._aabb._minX; - s3._aabb._minY = minY2 < s3._aabb._minY ? minY2 : s3._aabb._minY; - s3._aabb._minZ = minZ2 < s3._aabb._minZ ? minZ2 : s3._aabb._minZ; - s3._aabb._maxX = maxX2 > s3._aabb._maxX ? maxX2 : s3._aabb._maxX; - s3._aabb._maxY = maxY2 > s3._aabb._maxY ? maxY2 : s3._aabb._maxY; - s3._aabb._maxZ = maxZ2 > s3._aabb._maxZ ? maxZ2 : s3._aabb._maxZ; - if(s3._proxy != null) { - var dX2; - var dY2; - var dZ2; - dX2 = s3._transform._positionX - s3._ptransform._positionX; - dY2 = s3._transform._positionY - s3._ptransform._positionY; - dZ2 = s3._transform._positionZ - s3._ptransform._positionZ; - var v2 = s3.displacement; - v2.x = dX2; - v2.y = dY2; - v2.z = dZ2; - s3._rigidBody._world._broadPhase.moveProxy(s3._proxy,s3._aabb,s3.displacement); - } - s3 = n2; + var dst = armR1._ptransform; + var src = armR1._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = armR1._shapeList; + while(s != null) { + var n = s._next; + var tf1 = armR1._ptransform; + var tf2 = armR1._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; } armR1._sleeping = false; armR1._sleepTime = 0; @@ -2085,60 +2078,60 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armR2._transform._rotation20 = e20; armR2._transform._rotation21 = e21; armR2._transform._rotation22 = e22; - var __tmp__0012; - var __tmp__0112; - var __tmp__0212; - var __tmp__1012; - var __tmp__1112; - var __tmp__1212; - var __tmp__2012; - var __tmp__2112; - var __tmp__2212; - __tmp__0012 = armR2._transform._rotation00 * armR2._invLocalInertia00 + armR2._transform._rotation01 * armR2._invLocalInertia10 + armR2._transform._rotation02 * armR2._invLocalInertia20; - __tmp__0112 = armR2._transform._rotation00 * armR2._invLocalInertia01 + armR2._transform._rotation01 * armR2._invLocalInertia11 + armR2._transform._rotation02 * armR2._invLocalInertia21; - __tmp__0212 = armR2._transform._rotation00 * armR2._invLocalInertia02 + armR2._transform._rotation01 * armR2._invLocalInertia12 + armR2._transform._rotation02 * armR2._invLocalInertia22; - __tmp__1012 = armR2._transform._rotation10 * armR2._invLocalInertia00 + armR2._transform._rotation11 * armR2._invLocalInertia10 + armR2._transform._rotation12 * armR2._invLocalInertia20; - __tmp__1112 = armR2._transform._rotation10 * armR2._invLocalInertia01 + armR2._transform._rotation11 * armR2._invLocalInertia11 + armR2._transform._rotation12 * armR2._invLocalInertia21; - __tmp__1212 = armR2._transform._rotation10 * armR2._invLocalInertia02 + armR2._transform._rotation11 * armR2._invLocalInertia12 + armR2._transform._rotation12 * armR2._invLocalInertia22; - __tmp__2012 = armR2._transform._rotation20 * armR2._invLocalInertia00 + armR2._transform._rotation21 * armR2._invLocalInertia10 + armR2._transform._rotation22 * armR2._invLocalInertia20; - __tmp__2112 = armR2._transform._rotation20 * armR2._invLocalInertia01 + armR2._transform._rotation21 * armR2._invLocalInertia11 + armR2._transform._rotation22 * armR2._invLocalInertia21; - __tmp__2212 = armR2._transform._rotation20 * armR2._invLocalInertia02 + armR2._transform._rotation21 * armR2._invLocalInertia12 + armR2._transform._rotation22 * armR2._invLocalInertia22; - armR2._invInertia00 = __tmp__0012; - armR2._invInertia01 = __tmp__0112; - armR2._invInertia02 = __tmp__0212; - armR2._invInertia10 = __tmp__1012; - armR2._invInertia11 = __tmp__1112; - armR2._invInertia12 = __tmp__1212; - armR2._invInertia20 = __tmp__2012; - armR2._invInertia21 = __tmp__2112; - armR2._invInertia22 = __tmp__2212; - var __tmp__0013; - var __tmp__0113; - var __tmp__0213; - var __tmp__1013; - var __tmp__1113; - var __tmp__1213; - var __tmp__2013; - var __tmp__2113; - var __tmp__2213; - __tmp__0013 = armR2._invInertia00 * armR2._transform._rotation00 + armR2._invInertia01 * armR2._transform._rotation01 + armR2._invInertia02 * armR2._transform._rotation02; - __tmp__0113 = armR2._invInertia00 * armR2._transform._rotation10 + armR2._invInertia01 * armR2._transform._rotation11 + armR2._invInertia02 * armR2._transform._rotation12; - __tmp__0213 = armR2._invInertia00 * armR2._transform._rotation20 + armR2._invInertia01 * armR2._transform._rotation21 + armR2._invInertia02 * armR2._transform._rotation22; - __tmp__1013 = armR2._invInertia10 * armR2._transform._rotation00 + armR2._invInertia11 * armR2._transform._rotation01 + armR2._invInertia12 * armR2._transform._rotation02; - __tmp__1113 = armR2._invInertia10 * armR2._transform._rotation10 + armR2._invInertia11 * armR2._transform._rotation11 + armR2._invInertia12 * armR2._transform._rotation12; - __tmp__1213 = armR2._invInertia10 * armR2._transform._rotation20 + armR2._invInertia11 * armR2._transform._rotation21 + armR2._invInertia12 * armR2._transform._rotation22; - __tmp__2013 = armR2._invInertia20 * armR2._transform._rotation00 + armR2._invInertia21 * armR2._transform._rotation01 + armR2._invInertia22 * armR2._transform._rotation02; - __tmp__2113 = armR2._invInertia20 * armR2._transform._rotation10 + armR2._invInertia21 * armR2._transform._rotation11 + armR2._invInertia22 * armR2._transform._rotation12; - __tmp__2213 = armR2._invInertia20 * armR2._transform._rotation20 + armR2._invInertia21 * armR2._transform._rotation21 + armR2._invInertia22 * armR2._transform._rotation22; - armR2._invInertia00 = __tmp__0013; - armR2._invInertia01 = __tmp__0113; - armR2._invInertia02 = __tmp__0213; - armR2._invInertia10 = __tmp__1013; - armR2._invInertia11 = __tmp__1113; - armR2._invInertia12 = __tmp__1213; - armR2._invInertia20 = __tmp__2013; - armR2._invInertia21 = __tmp__2113; - armR2._invInertia22 = __tmp__2213; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armR2._transform._rotation00 * armR2._invLocalInertia00 + armR2._transform._rotation01 * armR2._invLocalInertia10 + armR2._transform._rotation02 * armR2._invLocalInertia20; + __tmp__01 = armR2._transform._rotation00 * armR2._invLocalInertia01 + armR2._transform._rotation01 * armR2._invLocalInertia11 + armR2._transform._rotation02 * armR2._invLocalInertia21; + __tmp__02 = armR2._transform._rotation00 * armR2._invLocalInertia02 + armR2._transform._rotation01 * armR2._invLocalInertia12 + armR2._transform._rotation02 * armR2._invLocalInertia22; + __tmp__10 = armR2._transform._rotation10 * armR2._invLocalInertia00 + armR2._transform._rotation11 * armR2._invLocalInertia10 + armR2._transform._rotation12 * armR2._invLocalInertia20; + __tmp__11 = armR2._transform._rotation10 * armR2._invLocalInertia01 + armR2._transform._rotation11 * armR2._invLocalInertia11 + armR2._transform._rotation12 * armR2._invLocalInertia21; + __tmp__12 = armR2._transform._rotation10 * armR2._invLocalInertia02 + armR2._transform._rotation11 * armR2._invLocalInertia12 + armR2._transform._rotation12 * armR2._invLocalInertia22; + __tmp__20 = armR2._transform._rotation20 * armR2._invLocalInertia00 + armR2._transform._rotation21 * armR2._invLocalInertia10 + armR2._transform._rotation22 * armR2._invLocalInertia20; + __tmp__21 = armR2._transform._rotation20 * armR2._invLocalInertia01 + armR2._transform._rotation21 * armR2._invLocalInertia11 + armR2._transform._rotation22 * armR2._invLocalInertia21; + __tmp__22 = armR2._transform._rotation20 * armR2._invLocalInertia02 + armR2._transform._rotation21 * armR2._invLocalInertia12 + armR2._transform._rotation22 * armR2._invLocalInertia22; + armR2._invInertia00 = __tmp__00; + armR2._invInertia01 = __tmp__01; + armR2._invInertia02 = __tmp__02; + armR2._invInertia10 = __tmp__10; + armR2._invInertia11 = __tmp__11; + armR2._invInertia12 = __tmp__12; + armR2._invInertia20 = __tmp__20; + armR2._invInertia21 = __tmp__21; + armR2._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = armR2._invInertia00 * armR2._transform._rotation00 + armR2._invInertia01 * armR2._transform._rotation01 + armR2._invInertia02 * armR2._transform._rotation02; + __tmp__01 = armR2._invInertia00 * armR2._transform._rotation10 + armR2._invInertia01 * armR2._transform._rotation11 + armR2._invInertia02 * armR2._transform._rotation12; + __tmp__02 = armR2._invInertia00 * armR2._transform._rotation20 + armR2._invInertia01 * armR2._transform._rotation21 + armR2._invInertia02 * armR2._transform._rotation22; + __tmp__10 = armR2._invInertia10 * armR2._transform._rotation00 + armR2._invInertia11 * armR2._transform._rotation01 + armR2._invInertia12 * armR2._transform._rotation02; + __tmp__11 = armR2._invInertia10 * armR2._transform._rotation10 + armR2._invInertia11 * armR2._transform._rotation11 + armR2._invInertia12 * armR2._transform._rotation12; + __tmp__12 = armR2._invInertia10 * armR2._transform._rotation20 + armR2._invInertia11 * armR2._transform._rotation21 + armR2._invInertia12 * armR2._transform._rotation22; + __tmp__20 = armR2._invInertia20 * armR2._transform._rotation00 + armR2._invInertia21 * armR2._transform._rotation01 + armR2._invInertia22 * armR2._transform._rotation02; + __tmp__21 = armR2._invInertia20 * armR2._transform._rotation10 + armR2._invInertia21 * armR2._transform._rotation11 + armR2._invInertia22 * armR2._transform._rotation12; + __tmp__22 = armR2._invInertia20 * armR2._transform._rotation20 + armR2._invInertia21 * armR2._transform._rotation21 + armR2._invInertia22 * armR2._transform._rotation22; + armR2._invInertia00 = __tmp__00; + armR2._invInertia01 = __tmp__01; + armR2._invInertia02 = __tmp__02; + armR2._invInertia10 = __tmp__10; + armR2._invInertia11 = __tmp__11; + armR2._invInertia12 = __tmp__12; + armR2._invInertia20 = __tmp__20; + armR2._invInertia21 = __tmp__21; + armR2._invInertia22 = __tmp__22; armR2._invInertia00 *= armR2._rotFactor.x; armR2._invInertia01 *= armR2._rotFactor.x; armR2._invInertia02 *= armR2._rotFactor.x; @@ -2148,141 +2141,141 @@ demo_common_OimoUtil.addRagdoll = function(w,pos) { armR2._invInertia20 *= armR2._rotFactor.z; armR2._invInertia21 *= armR2._rotFactor.z; armR2._invInertia22 *= armR2._rotFactor.z; - var dst9 = armR2._ptransform; - var src4 = armR2._transform; - dst9._positionX = src4._positionX; - dst9._positionY = src4._positionY; - dst9._positionZ = src4._positionZ; - dst9._rotation00 = src4._rotation00; - dst9._rotation01 = src4._rotation01; - dst9._rotation02 = src4._rotation02; - dst9._rotation10 = src4._rotation10; - dst9._rotation11 = src4._rotation11; - dst9._rotation12 = src4._rotation12; - dst9._rotation20 = src4._rotation20; - dst9._rotation21 = src4._rotation21; - dst9._rotation22 = src4._rotation22; - var s4 = armR2._shapeList; - while(s4 != null) { - var n3 = s4._next; - var tf13 = armR2._ptransform; - var tf23 = armR2._transform; - var dst10 = s4._ptransform; - var src16 = s4._localTransform; - var __tmp__0014; - var __tmp__0114; - var __tmp__0214; - var __tmp__1014; - var __tmp__1114; - var __tmp__1214; - var __tmp__2014; - var __tmp__2114; - var __tmp__2214; - __tmp__0014 = tf13._rotation00 * src16._rotation00 + tf13._rotation01 * src16._rotation10 + tf13._rotation02 * src16._rotation20; - __tmp__0114 = tf13._rotation00 * src16._rotation01 + tf13._rotation01 * src16._rotation11 + tf13._rotation02 * src16._rotation21; - __tmp__0214 = tf13._rotation00 * src16._rotation02 + tf13._rotation01 * src16._rotation12 + tf13._rotation02 * src16._rotation22; - __tmp__1014 = tf13._rotation10 * src16._rotation00 + tf13._rotation11 * src16._rotation10 + tf13._rotation12 * src16._rotation20; - __tmp__1114 = tf13._rotation10 * src16._rotation01 + tf13._rotation11 * src16._rotation11 + tf13._rotation12 * src16._rotation21; - __tmp__1214 = tf13._rotation10 * src16._rotation02 + tf13._rotation11 * src16._rotation12 + tf13._rotation12 * src16._rotation22; - __tmp__2014 = tf13._rotation20 * src16._rotation00 + tf13._rotation21 * src16._rotation10 + tf13._rotation22 * src16._rotation20; - __tmp__2114 = tf13._rotation20 * src16._rotation01 + tf13._rotation21 * src16._rotation11 + tf13._rotation22 * src16._rotation21; - __tmp__2214 = tf13._rotation20 * src16._rotation02 + tf13._rotation21 * src16._rotation12 + tf13._rotation22 * src16._rotation22; - dst10._rotation00 = __tmp__0014; - dst10._rotation01 = __tmp__0114; - dst10._rotation02 = __tmp__0214; - dst10._rotation10 = __tmp__1014; - dst10._rotation11 = __tmp__1114; - dst10._rotation12 = __tmp__1214; - dst10._rotation20 = __tmp__2014; - dst10._rotation21 = __tmp__2114; - dst10._rotation22 = __tmp__2214; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf13._rotation00 * src16._positionX + tf13._rotation01 * src16._positionY + tf13._rotation02 * src16._positionZ; - __tmp__Y6 = tf13._rotation10 * src16._positionX + tf13._rotation11 * src16._positionY + tf13._rotation12 * src16._positionZ; - __tmp__Z6 = tf13._rotation20 * src16._positionX + tf13._rotation21 * src16._positionY + tf13._rotation22 * src16._positionZ; - dst10._positionX = __tmp__X6; - dst10._positionY = __tmp__Y6; - dst10._positionZ = __tmp__Z6; - dst10._positionX += tf13._positionX; - dst10._positionY += tf13._positionY; - dst10._positionZ += tf13._positionZ; - var dst11 = s4._transform; - var src17 = s4._localTransform; - var __tmp__0015; - var __tmp__0115; - var __tmp__0215; - var __tmp__1015; - var __tmp__1115; - var __tmp__1215; - var __tmp__2015; - var __tmp__2115; - var __tmp__2215; - __tmp__0015 = tf23._rotation00 * src17._rotation00 + tf23._rotation01 * src17._rotation10 + tf23._rotation02 * src17._rotation20; - __tmp__0115 = tf23._rotation00 * src17._rotation01 + tf23._rotation01 * src17._rotation11 + tf23._rotation02 * src17._rotation21; - __tmp__0215 = tf23._rotation00 * src17._rotation02 + tf23._rotation01 * src17._rotation12 + tf23._rotation02 * src17._rotation22; - __tmp__1015 = tf23._rotation10 * src17._rotation00 + tf23._rotation11 * src17._rotation10 + tf23._rotation12 * src17._rotation20; - __tmp__1115 = tf23._rotation10 * src17._rotation01 + tf23._rotation11 * src17._rotation11 + tf23._rotation12 * src17._rotation21; - __tmp__1215 = tf23._rotation10 * src17._rotation02 + tf23._rotation11 * src17._rotation12 + tf23._rotation12 * src17._rotation22; - __tmp__2015 = tf23._rotation20 * src17._rotation00 + tf23._rotation21 * src17._rotation10 + tf23._rotation22 * src17._rotation20; - __tmp__2115 = tf23._rotation20 * src17._rotation01 + tf23._rotation21 * src17._rotation11 + tf23._rotation22 * src17._rotation21; - __tmp__2215 = tf23._rotation20 * src17._rotation02 + tf23._rotation21 * src17._rotation12 + tf23._rotation22 * src17._rotation22; - dst11._rotation00 = __tmp__0015; - dst11._rotation01 = __tmp__0115; - dst11._rotation02 = __tmp__0215; - dst11._rotation10 = __tmp__1015; - dst11._rotation11 = __tmp__1115; - dst11._rotation12 = __tmp__1215; - dst11._rotation20 = __tmp__2015; - dst11._rotation21 = __tmp__2115; - dst11._rotation22 = __tmp__2215; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf23._rotation00 * src17._positionX + tf23._rotation01 * src17._positionY + tf23._rotation02 * src17._positionZ; - __tmp__Y7 = tf23._rotation10 * src17._positionX + tf23._rotation11 * src17._positionY + tf23._rotation12 * src17._positionZ; - __tmp__Z7 = tf23._rotation20 * src17._positionX + tf23._rotation21 * src17._positionY + tf23._rotation22 * src17._positionZ; - dst11._positionX = __tmp__X7; - dst11._positionY = __tmp__Y7; - dst11._positionZ = __tmp__Z7; - dst11._positionX += tf23._positionX; - dst11._positionY += tf23._positionY; - dst11._positionZ += tf23._positionZ; - var minX3; - var minY3; - var minZ3; - var maxX3; - var maxY3; - var maxZ3; - s4._geom._computeAabb(s4._aabb,s4._ptransform); - minX3 = s4._aabb._minX; - minY3 = s4._aabb._minY; - minZ3 = s4._aabb._minZ; - maxX3 = s4._aabb._maxX; - maxY3 = s4._aabb._maxY; - maxZ3 = s4._aabb._maxZ; - s4._geom._computeAabb(s4._aabb,s4._transform); - s4._aabb._minX = minX3 < s4._aabb._minX ? minX3 : s4._aabb._minX; - s4._aabb._minY = minY3 < s4._aabb._minY ? minY3 : s4._aabb._minY; - s4._aabb._minZ = minZ3 < s4._aabb._minZ ? minZ3 : s4._aabb._minZ; - s4._aabb._maxX = maxX3 > s4._aabb._maxX ? maxX3 : s4._aabb._maxX; - s4._aabb._maxY = maxY3 > s4._aabb._maxY ? maxY3 : s4._aabb._maxY; - s4._aabb._maxZ = maxZ3 > s4._aabb._maxZ ? maxZ3 : s4._aabb._maxZ; - if(s4._proxy != null) { - var dX3; - var dY3; - var dZ3; - dX3 = s4._transform._positionX - s4._ptransform._positionX; - dY3 = s4._transform._positionY - s4._ptransform._positionY; - dZ3 = s4._transform._positionZ - s4._ptransform._positionZ; - var v3 = s4.displacement; - v3.x = dX3; - v3.y = dY3; - v3.z = dZ3; - s4._rigidBody._world._broadPhase.moveProxy(s4._proxy,s4._aabb,s4.displacement); - } - s4 = n3; + var dst = armR2._ptransform; + var src = armR2._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = armR2._shapeList; + while(s != null) { + var n = s._next; + var tf1 = armR2._ptransform; + var tf2 = armR2._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; } armR2._sleeping = false; armR2._sleepTime = 0; @@ -2525,7 +2518,7 @@ demo_core_BreakableJointDemo.prototype = $extend(demo_common_DemoBase.prototype, while(_g < 12) { var i = _g++; chain.push(i % 2 == 0 ? demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3((i + 1) * 0.4,6,0),0.25,false) : demo_common_OimoUtil.addBox(world,new oimo_common_Vec3((i + 1) * 0.4,6,0),new oimo_common_Vec3(0.25,0.25,0.25),false)); - var _this1 = chain[i]; + var _this = chain[i]; var x = -1 + Math.random() * 2; var y = -1 + Math.random() * 2; var z = -1 + Math.random() * 2; @@ -2548,53 +2541,53 @@ demo_core_BreakableJointDemo.prototype = $extend(demo_common_DemoBase.prototype, v_x = x1; v_y = y1; v_z = z1; - if(_this1._type == 1) { - _this1._velX = 0; - _this1._velY = 0; - _this1._velZ = 0; + if(_this._type == 1) { + _this._velX = 0; + _this._velY = 0; + _this._velZ = 0; } else { - _this1._velX = x1; - _this1._velY = y1; - _this1._velZ = z1; + _this._velX = x1; + _this._velY = y1; + _this._velZ = z1; } - _this1._sleeping = false; - _this1._sleepTime = 0; + _this._sleeping = false; + _this._sleepTime = 0; } - var _g1 = 1; - var _g2 = chain.length; - while(_g1 < _g2) { - var i1 = _g1++; + var _g = 1; + var _g1 = chain.length; + while(_g < _g1) { + var i = _g++; var center; - if(i1 == 1) { - var _this2 = chain[0]; + if(i == 1) { + var _this = chain[0]; var v = new oimo_common_Vec3(); - v.x = _this2._transform._positionX; - v.y = _this2._transform._positionY; - v.z = _this2._transform._positionZ; + v.x = _this._transform._positionX; + v.y = _this._transform._positionY; + v.z = _this._transform._positionZ; center = v; } else { - var _this3 = chain[i1 - 1]; + var _this1 = chain[i - 1]; var v1 = new oimo_common_Vec3(); - v1.x = _this3._transform._positionX; - v1.y = _this3._transform._positionY; - v1.z = _this3._transform._positionZ; - var _this4 = chain[i1]; - var v_x1 = 0; - var v_y1 = 0; - var v_z1 = 0; + v1.x = _this1._transform._positionX; + v1.y = _this1._transform._positionY; + v1.z = _this1._transform._positionZ; + var _this2 = chain[i]; + var v_x = 0; + var v_y = 0; + var v_z = 0; oimo_common_Vec3.numCreations++; - v_x1 = _this4._transform._positionX; - v_y1 = _this4._transform._positionY; - v_z1 = _this4._transform._positionZ; - v1.x += v_x1; - v1.y += v_y1; - v1.z += v_z1; + v_x = _this2._transform._positionX; + v_y = _this2._transform._positionY; + v_z = _this2._transform._positionZ; + v1.x += v_x; + v1.y += v_y; + v1.z += v_z; v1.x *= 0.5; v1.y *= 0.5; v1.z *= 0.5; center = v1; } - demo_common_OimoUtil.addSphericalJoint(world,chain[i1 - 1],chain[i1],center)._breakForce = 100; + demo_common_OimoUtil.addSphericalJoint(world,chain[i - 1],chain[i],center)._breakForce = 100; } } ,update: function() { @@ -2657,16 +2650,16 @@ demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ var _g = 0; while(_g < 5) { ++_g; - var _this1 = demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.8,false)._shapeList; - _this1._density = 0.3; - if(_this1._rigidBody != null) { - var _this2 = _this1._rigidBody; - _this2.updateMass(); - var s = _this2._shapeList; + var _this = demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.8,false)._shapeList; + _this._density = 0.3; + if(_this._rigidBody != null) { + var _this1 = _this._rigidBody; + _this1.updateMass(); + var s = _this1._shapeList; while(s != null) { var n = s._next; - var tf1 = _this2._ptransform; - var tf2 = _this2._transform; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; @@ -2785,16 +2778,16 @@ demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ s = n; } } - var _this3 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),new oimo_common_Vec3(0.5,0.5,0.5),false)._shapeList; - _this3._density = 0.3; - if(_this3._rigidBody != null) { - var _this4 = _this3._rigidBody; - _this4.updateMass(); - var s1 = _this4._shapeList; + var _this2 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),new oimo_common_Vec3(0.5,0.5,0.5),false)._shapeList; + _this2._density = 0.3; + if(_this2._rigidBody != null) { + var _this3 = _this2._rigidBody; + _this3.updateMass(); + var s1 = _this3._shapeList; while(s1 != null) { var n1 = s1._next; - var tf11 = _this4._ptransform; - var tf21 = _this4._transform; + var tf11 = _this3._ptransform; + var tf21 = _this3._transform; var dst2 = s1._ptransform; var src12 = s1._localTransform; var __tmp__002; @@ -2913,16 +2906,16 @@ demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ s1 = n1; } } - var _this5 = demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.6,0.6,false)._shapeList; - _this5._density = 0.3; - if(_this5._rigidBody != null) { - var _this6 = _this5._rigidBody; - _this6.updateMass(); - var s2 = _this6._shapeList; + var _this4 = demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(-4 + Math.random() * 8,2 + Math.random(),-1 + Math.random() * 2),0.6,0.6,false)._shapeList; + _this4._density = 0.3; + if(_this4._rigidBody != null) { + var _this5 = _this4._rigidBody; + _this5.updateMass(); + var s2 = _this5._shapeList; while(s2 != null) { var n2 = s2._next; - var tf12 = _this6._ptransform; - var tf22 = _this6._transform; + var tf12 = _this5._ptransform; + var tf22 = _this5._transform; var dst4 = s2._ptransform; var src14 = s2._localTransform; var __tmp__004; @@ -3044,32 +3037,32 @@ demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ } oimo_common_Vec3.numCreations++; var bodies = []; - var _g1 = 0; - while(_g1 < 20) { - var i = _g1++; + var _g = 0; + while(_g < 20) { + var i = _g++; bodies.push(demo_common_OimoUtil.addBox(world,new oimo_common_Vec3((i - 9.5) * 0.75,0,0),new oimo_common_Vec3(0.35,0.15,1.5),i == 0 || i == 19)); } - var _g3 = 0; - while(_g3 < 19) { - var i1 = _g3++; - var bodies1 = bodies[i1]; - var bodies2 = bodies[i1 + 1]; - var _this7 = bodies[i1]; + var _g = 0; + while(_g < 19) { + var i = _g++; + var bodies1 = bodies[i]; + var bodies2 = bodies[i + 1]; + var _this = bodies[i]; var _this_x = 0; var _this_y = 0; var _this_z = 0; oimo_common_Vec3.numCreations++; - _this_x = _this7._transform._positionX; - _this_y = _this7._transform._positionY; - _this_z = _this7._transform._positionZ; - var _this8 = bodies[i1 + 1]; + _this_x = _this._transform._positionX; + _this_y = _this._transform._positionY; + _this_z = _this._transform._positionZ; + var _this1 = bodies[i + 1]; var v_x = 0; var v_y = 0; var v_z = 0; oimo_common_Vec3.numCreations++; - v_x = _this8._transform._positionX; - v_y = _this8._transform._positionY; - v_z = _this8._transform._positionZ; + v_x = _this1._transform._positionX; + v_y = _this1._transform._positionY; + v_z = _this1._transform._positionZ; var x = _this_x + v_x; var y = _this_y + v_y; var z = _this_z + v_z; @@ -3085,160 +3078,160 @@ demo_core_BridgeDemo.prototype = $extend(demo_common_DemoBase.prototype,{ oimo_common_Vec3.numCreations++; demo_common_OimoUtil.addRevoluteJoint(world,bodies1,bodies2,new oimo_common_Vec3(x * 0.5,y * 0.5,z * 0.5),new oimo_common_Vec3(0,0,1)); } - var _g5 = 0; - while(_g5 < 20) { - var i2 = _g5++; - var _this9 = bodies[i2]; - var v_x1 = 0; - var v_y1 = 0; - var v_z1 = 0; + var _g = 0; + while(_g < 20) { + var i = _g++; + var _this = bodies[i]; + var v_x = 0; + var v_y = 0; + var v_z = 0; oimo_common_Vec3.numCreations++; - v_x1 = _this9._transform._positionX; - v_y1 = _this9._transform._positionY; - v_z1 = _this9._transform._positionZ; - v_x1 *= 0.95; - var _this10 = bodies[i2]; - _this10._transform._positionX = v_x1; - _this10._transform._positionY = v_y1; - _this10._transform._positionZ = v_z1; - var dst6 = _this10._ptransform; - var src = _this10._transform; - dst6._positionX = src._positionX; - dst6._positionY = src._positionY; - dst6._positionZ = src._positionZ; - dst6._rotation00 = src._rotation00; - dst6._rotation01 = src._rotation01; - dst6._rotation02 = src._rotation02; - dst6._rotation10 = src._rotation10; - dst6._rotation11 = src._rotation11; - dst6._rotation12 = src._rotation12; - dst6._rotation20 = src._rotation20; - dst6._rotation21 = src._rotation21; - dst6._rotation22 = src._rotation22; - var s3 = _this10._shapeList; - while(s3 != null) { - var n3 = s3._next; - var tf13 = _this10._ptransform; - var tf23 = _this10._transform; - var dst7 = s3._ptransform; - var src16 = s3._localTransform; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = tf13._rotation00 * src16._rotation00 + tf13._rotation01 * src16._rotation10 + tf13._rotation02 * src16._rotation20; - __tmp__016 = tf13._rotation00 * src16._rotation01 + tf13._rotation01 * src16._rotation11 + tf13._rotation02 * src16._rotation21; - __tmp__026 = tf13._rotation00 * src16._rotation02 + tf13._rotation01 * src16._rotation12 + tf13._rotation02 * src16._rotation22; - __tmp__106 = tf13._rotation10 * src16._rotation00 + tf13._rotation11 * src16._rotation10 + tf13._rotation12 * src16._rotation20; - __tmp__116 = tf13._rotation10 * src16._rotation01 + tf13._rotation11 * src16._rotation11 + tf13._rotation12 * src16._rotation21; - __tmp__126 = tf13._rotation10 * src16._rotation02 + tf13._rotation11 * src16._rotation12 + tf13._rotation12 * src16._rotation22; - __tmp__206 = tf13._rotation20 * src16._rotation00 + tf13._rotation21 * src16._rotation10 + tf13._rotation22 * src16._rotation20; - __tmp__216 = tf13._rotation20 * src16._rotation01 + tf13._rotation21 * src16._rotation11 + tf13._rotation22 * src16._rotation21; - __tmp__226 = tf13._rotation20 * src16._rotation02 + tf13._rotation21 * src16._rotation12 + tf13._rotation22 * src16._rotation22; - dst7._rotation00 = __tmp__006; - dst7._rotation01 = __tmp__016; - dst7._rotation02 = __tmp__026; - dst7._rotation10 = __tmp__106; - dst7._rotation11 = __tmp__116; - dst7._rotation12 = __tmp__126; - dst7._rotation20 = __tmp__206; - dst7._rotation21 = __tmp__216; - dst7._rotation22 = __tmp__226; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf13._rotation00 * src16._positionX + tf13._rotation01 * src16._positionY + tf13._rotation02 * src16._positionZ; - __tmp__Y6 = tf13._rotation10 * src16._positionX + tf13._rotation11 * src16._positionY + tf13._rotation12 * src16._positionZ; - __tmp__Z6 = tf13._rotation20 * src16._positionX + tf13._rotation21 * src16._positionY + tf13._rotation22 * src16._positionZ; - dst7._positionX = __tmp__X6; - dst7._positionY = __tmp__Y6; - dst7._positionZ = __tmp__Z6; - dst7._positionX += tf13._positionX; - dst7._positionY += tf13._positionY; - dst7._positionZ += tf13._positionZ; - var dst8 = s3._transform; - var src17 = s3._localTransform; - var __tmp__007; - var __tmp__017; - var __tmp__027; - var __tmp__107; - var __tmp__117; - var __tmp__127; - var __tmp__207; - var __tmp__217; - var __tmp__227; - __tmp__007 = tf23._rotation00 * src17._rotation00 + tf23._rotation01 * src17._rotation10 + tf23._rotation02 * src17._rotation20; - __tmp__017 = tf23._rotation00 * src17._rotation01 + tf23._rotation01 * src17._rotation11 + tf23._rotation02 * src17._rotation21; - __tmp__027 = tf23._rotation00 * src17._rotation02 + tf23._rotation01 * src17._rotation12 + tf23._rotation02 * src17._rotation22; - __tmp__107 = tf23._rotation10 * src17._rotation00 + tf23._rotation11 * src17._rotation10 + tf23._rotation12 * src17._rotation20; - __tmp__117 = tf23._rotation10 * src17._rotation01 + tf23._rotation11 * src17._rotation11 + tf23._rotation12 * src17._rotation21; - __tmp__127 = tf23._rotation10 * src17._rotation02 + tf23._rotation11 * src17._rotation12 + tf23._rotation12 * src17._rotation22; - __tmp__207 = tf23._rotation20 * src17._rotation00 + tf23._rotation21 * src17._rotation10 + tf23._rotation22 * src17._rotation20; - __tmp__217 = tf23._rotation20 * src17._rotation01 + tf23._rotation21 * src17._rotation11 + tf23._rotation22 * src17._rotation21; - __tmp__227 = tf23._rotation20 * src17._rotation02 + tf23._rotation21 * src17._rotation12 + tf23._rotation22 * src17._rotation22; - dst8._rotation00 = __tmp__007; - dst8._rotation01 = __tmp__017; - dst8._rotation02 = __tmp__027; - dst8._rotation10 = __tmp__107; - dst8._rotation11 = __tmp__117; - dst8._rotation12 = __tmp__127; - dst8._rotation20 = __tmp__207; - dst8._rotation21 = __tmp__217; - dst8._rotation22 = __tmp__227; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf23._rotation00 * src17._positionX + tf23._rotation01 * src17._positionY + tf23._rotation02 * src17._positionZ; - __tmp__Y7 = tf23._rotation10 * src17._positionX + tf23._rotation11 * src17._positionY + tf23._rotation12 * src17._positionZ; - __tmp__Z7 = tf23._rotation20 * src17._positionX + tf23._rotation21 * src17._positionY + tf23._rotation22 * src17._positionZ; - dst8._positionX = __tmp__X7; - dst8._positionY = __tmp__Y7; - dst8._positionZ = __tmp__Z7; - dst8._positionX += tf23._positionX; - dst8._positionY += tf23._positionY; - dst8._positionZ += tf23._positionZ; - var minX3; - var minY3; - var minZ3; - var maxX3; - var maxY3; - var maxZ3; - s3._geom._computeAabb(s3._aabb,s3._ptransform); - minX3 = s3._aabb._minX; - minY3 = s3._aabb._minY; - minZ3 = s3._aabb._minZ; - maxX3 = s3._aabb._maxX; - maxY3 = s3._aabb._maxY; - maxZ3 = s3._aabb._maxZ; - s3._geom._computeAabb(s3._aabb,s3._transform); - s3._aabb._minX = minX3 < s3._aabb._minX ? minX3 : s3._aabb._minX; - s3._aabb._minY = minY3 < s3._aabb._minY ? minY3 : s3._aabb._minY; - s3._aabb._minZ = minZ3 < s3._aabb._minZ ? minZ3 : s3._aabb._minZ; - s3._aabb._maxX = maxX3 > s3._aabb._maxX ? maxX3 : s3._aabb._maxX; - s3._aabb._maxY = maxY3 > s3._aabb._maxY ? maxY3 : s3._aabb._maxY; - s3._aabb._maxZ = maxZ3 > s3._aabb._maxZ ? maxZ3 : s3._aabb._maxZ; - if(s3._proxy != null) { - var dX3; - var dY3; - var dZ3; - dX3 = s3._transform._positionX - s3._ptransform._positionX; - dY3 = s3._transform._positionY - s3._ptransform._positionY; - dZ3 = s3._transform._positionZ - s3._ptransform._positionZ; - var v3 = s3.displacement; - v3.x = dX3; - v3.y = dY3; - v3.z = dZ3; - s3._rigidBody._world._broadPhase.moveProxy(s3._proxy,s3._aabb,s3.displacement); - } - s3 = n3; - } - _this10._sleeping = false; - _this10._sleepTime = 0; + v_x = _this._transform._positionX; + v_y = _this._transform._positionY; + v_z = _this._transform._positionZ; + v_x *= 0.95; + var _this1 = bodies[i]; + _this1._transform._positionX = v_x; + _this1._transform._positionY = v_y; + _this1._transform._positionZ = v_z; + var dst = _this1._ptransform; + var src = _this1._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = _this1._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__00; + dst1._rotation01 = __tmp__01; + dst1._rotation02 = __tmp__02; + dst1._rotation10 = __tmp__10; + dst1._rotation11 = __tmp__11; + dst1._rotation12 = __tmp__12; + dst1._rotation20 = __tmp__20; + dst1._rotation21 = __tmp__21; + dst1._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__001; + dst2._rotation01 = __tmp__011; + dst2._rotation02 = __tmp__021; + dst2._rotation10 = __tmp__101; + dst2._rotation11 = __tmp__111; + dst2._rotation12 = __tmp__121; + dst2._rotation20 = __tmp__201; + dst2._rotation21 = __tmp__211; + dst2._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + _this1._sleeping = false; + _this1._sleepTime = 0; } } ,update: function() { @@ -3340,10 +3333,10 @@ demo_core_BroadPhaseStressDemo.prototype = $extend(demo_common_DemoBase.prototyp _this.e32 = 0; _this.e33 = 1; oimo_common_Vec3.numCreations++; - var _this1 = world._gravity; - _this1.x = 0; - _this1.y = 0; - _this1.z = 0; + var _this = world._gravity; + _this.x = 0; + _this.y = 0; + _this.z = 0; this.increaseRigidBodies(); this.increaseRigidBodies(); this.increaseRigidBodies(); @@ -3377,10 +3370,10 @@ demo_core_BroadPhaseStressDemo.prototype = $extend(demo_common_DemoBase.prototyp ++_g; compc.geometry = shapes[Math.random() * 2 | 0]; compc.position.init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - var _this1 = compc.position; - _this1.x *= 0; - _this1.y *= 0; - _this1.z *= 0; + var _this = compc.position; + _this.x *= 0; + _this.y *= 0; + _this.z *= 0; rigidc.position.init(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); rigidc.position.x *= 50; rigidc.position.y *= 50; @@ -3652,7 +3645,7 @@ demo_core_CompoundShapesDemo.prototype = $extend(demo_common_DemoBase.prototype, sc2.position.init(0,-0.2,0); var _g = 0; while(_g < 32) { - var _this1 = rc.position.init(-2,1 + _g++,0); + var _this = rc.position.init(-2,1 + _g++,0); var x = -0.01 + Math.random() * 0.02; var y = -0.01 + Math.random() * 0.02; var z = -0.01 + Math.random() * 0.02; @@ -3666,55 +3659,55 @@ demo_core_CompoundShapesDemo.prototype = $extend(demo_common_DemoBase.prototype, x = 0; } oimo_common_Vec3.numCreations++; - _this1.x += x; - _this1.y += y; - _this1.z += z; + _this.x += x; + _this.y += y; + _this.z += z; var rb = new oimo_dynamics_rigidbody_RigidBody(rc); rb.addShape(new oimo_dynamics_rigidbody_Shape(sc1)); rb.addShape(new oimo_dynamics_rigidbody_Shape(sc2)); world.addRigidBody(rb); } - var geom11 = new oimo_collision_geometry_ConeGeometry(0.275,0.325); - var geom21 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.3,0.075,0.3)); - var sc11 = new oimo_dynamics_rigidbody_ShapeConfig(); - var sc21 = new oimo_dynamics_rigidbody_ShapeConfig(); - sc11.geometry = geom11; - sc21.geometry = geom21; - sc11.position.init(0,0.2,0); - sc21.position.init(0,-0.2,0); - var _g1 = 0; - while(_g1 < 32) { - var _this2 = rc.position.init(0,1 + _g1++,0); - var x1 = -0.01 + Math.random() * 0.02; - var y1 = -0.01 + Math.random() * 0.02; - var z1 = -0.01 + Math.random() * 0.02; - if(z1 == null) { - z1 = 0; + var geom1 = new oimo_collision_geometry_ConeGeometry(0.275,0.325); + var geom2 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.3,0.075,0.3)); + var sc1 = new oimo_dynamics_rigidbody_ShapeConfig(); + var sc2 = new oimo_dynamics_rigidbody_ShapeConfig(); + sc1.geometry = geom1; + sc2.geometry = geom2; + sc1.position.init(0,0.2,0); + sc2.position.init(0,-0.2,0); + var _g = 0; + while(_g < 32) { + var _this = rc.position.init(0,1 + _g++,0); + var x = -0.01 + Math.random() * 0.02; + var y = -0.01 + Math.random() * 0.02; + var z = -0.01 + Math.random() * 0.02; + if(z == null) { + z = 0; } - if(y1 == null) { - y1 = 0; + if(y == null) { + y = 0; } - if(x1 == null) { - x1 = 0; + if(x == null) { + x = 0; } oimo_common_Vec3.numCreations++; - _this2.x += x1; - _this2.y += y1; - _this2.z += z1; - var rb1 = new oimo_dynamics_rigidbody_RigidBody(rc); - rb1.addShape(new oimo_dynamics_rigidbody_Shape(sc11)); - rb1.addShape(new oimo_dynamics_rigidbody_Shape(sc21)); - world.addRigidBody(rb1); - } - var geom12 = new oimo_collision_geometry_CylinderGeometry(0.25,0.4); - var geom22 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.075,0.4,0.075)); - var sc12 = new oimo_dynamics_rigidbody_ShapeConfig(); - var sc22 = new oimo_dynamics_rigidbody_ShapeConfig(); - sc12.geometry = geom12; - sc22.geometry = geom22; - sc12.position.init(0,0,0); - sc22.position.init(0,-0.1,0); - var _this3 = sc12.rotation; + _this.x += x; + _this.y += y; + _this.z += z; + var rb = new oimo_dynamics_rigidbody_RigidBody(rc); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc1)); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc2)); + world.addRigidBody(rb); + } + var geom1 = new oimo_collision_geometry_CylinderGeometry(0.25,0.4); + var geom2 = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.075,0.4,0.075)); + var sc1 = new oimo_dynamics_rigidbody_ShapeConfig(); + var sc2 = new oimo_dynamics_rigidbody_ShapeConfig(); + sc1.geometry = geom1; + sc2.geometry = geom2; + sc1.position.init(0,0,0); + sc2.position.init(0,-0.1,0); + var _this = sc1.rotation; var s = Math.sin(1.570796326794895); var c = Math.cos(1.570796326794895); var c1 = 1 - c; @@ -3727,44 +3720,44 @@ demo_core_CompoundShapesDemo.prototype = $extend(demo_common_DemoBase.prototype, var r20 = 0 * c1 - 0 * s; var r21 = 0 * c1 + 0 * s; var r22 = c1 + c; - var e01 = _this3.e00 * r01 + _this3.e01 * r11 + _this3.e02 * r21; - var e02 = _this3.e00 * r02 + _this3.e01 * r12 + _this3.e02 * r22; - var e11 = _this3.e10 * r01 + _this3.e11 * r11 + _this3.e12 * r21; - var e12 = _this3.e10 * r02 + _this3.e11 * r12 + _this3.e12 * r22; - var e21 = _this3.e20 * r01 + _this3.e21 * r11 + _this3.e22 * r21; - var e22 = _this3.e20 * r02 + _this3.e21 * r12 + _this3.e22 * r22; - _this3.e00 = _this3.e00 * r00 + _this3.e01 * r10 + _this3.e02 * r20; - _this3.e01 = e01; - _this3.e02 = e02; - _this3.e10 = _this3.e10 * r00 + _this3.e11 * r10 + _this3.e12 * r20; - _this3.e11 = e11; - _this3.e12 = e12; - _this3.e20 = _this3.e20 * r00 + _this3.e21 * r10 + _this3.e22 * r20; - _this3.e21 = e21; - _this3.e22 = e22; - var _g2 = 0; - while(_g2 < 32) { - var _this4 = rc.position.init(2,1 + _g2++,0); - var x2 = -0.01 + Math.random() * 0.02; - var y2 = -0.01 + Math.random() * 0.02; - var z2 = -0.01 + Math.random() * 0.02; - if(z2 == null) { - z2 = 0; + var e01 = _this.e00 * r01 + _this.e01 * r11 + _this.e02 * r21; + var e02 = _this.e00 * r02 + _this.e01 * r12 + _this.e02 * r22; + var e11 = _this.e10 * r01 + _this.e11 * r11 + _this.e12 * r21; + var e12 = _this.e10 * r02 + _this.e11 * r12 + _this.e12 * r22; + var e21 = _this.e20 * r01 + _this.e21 * r11 + _this.e22 * r21; + var e22 = _this.e20 * r02 + _this.e21 * r12 + _this.e22 * r22; + _this.e00 = _this.e00 * r00 + _this.e01 * r10 + _this.e02 * r20; + _this.e01 = e01; + _this.e02 = e02; + _this.e10 = _this.e10 * r00 + _this.e11 * r10 + _this.e12 * r20; + _this.e11 = e11; + _this.e12 = e12; + _this.e20 = _this.e20 * r00 + _this.e21 * r10 + _this.e22 * r20; + _this.e21 = e21; + _this.e22 = e22; + var _g = 0; + while(_g < 32) { + var _this = rc.position.init(2,1 + _g++,0); + var x = -0.01 + Math.random() * 0.02; + var y = -0.01 + Math.random() * 0.02; + var z = -0.01 + Math.random() * 0.02; + if(z == null) { + z = 0; } - if(y2 == null) { - y2 = 0; + if(y == null) { + y = 0; } - if(x2 == null) { - x2 = 0; + if(x == null) { + x = 0; } oimo_common_Vec3.numCreations++; - _this4.x += x2; - _this4.y += y2; - _this4.z += z2; - var rb2 = new oimo_dynamics_rigidbody_RigidBody(rc); - rb2.addShape(new oimo_dynamics_rigidbody_Shape(sc12)); - rb2.addShape(new oimo_dynamics_rigidbody_Shape(sc22)); - world.addRigidBody(rb2); + _this.x += x; + _this.y += y; + _this.z += z; + var rb = new oimo_dynamics_rigidbody_RigidBody(rc); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc1)); + rb.addShape(new oimo_dynamics_rigidbody_Shape(sc2)); + world.addRigidBody(rb); } } ,update: function() { @@ -3895,15 +3888,15 @@ var demo_core__$ConvexCastingDemo_LaserPointer = function(pos,world,color) { sc.geometry = new oimo_collision_geometry_CylinderGeometry(0.4,this.length); this.rb.addShape(new oimo_dynamics_rigidbody_Shape(sc)); world.addRigidBody(this.rb); - var _this1 = rc.position; + var _this = rc.position; var y = this.length; if(y == null) { y = 0; } oimo_common_Vec3.numCreations++; - _this1.x += 0; - _this1.y += y; - _this1.z += 0; + _this.x += 0; + _this.y += y; + _this.z += 0; rc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; var fix = new oimo_dynamics_rigidbody_RigidBody(rc); sc.geometry = new oimo_collision_geometry_SphereGeometry(0.1); @@ -3911,18 +3904,18 @@ var demo_core__$ConvexCastingDemo_LaserPointer = function(pos,world,color) { world.addRigidBody(fix); var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); var tmp = this.rb; - var _this2 = this.rb; + var _this = this.rb; var v = new oimo_common_Vec3(); - v.x = _this2._transform._positionX; - v.y = _this2._transform._positionY; - v.z = _this2._transform._positionZ; - var y1 = this.length; - if(y1 == null) { - y1 = 0; + v.x = _this._transform._positionX; + v.y = _this._transform._positionY; + v.z = _this._transform._positionZ; + var y = this.length; + if(y == null) { + y = 0; } oimo_common_Vec3.numCreations++; v.x += 0; - v.y += y1; + v.y += y; v.z += 0; jc.init(tmp,fix,v,new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(1,0,0)); jc.twistLimitMotor.setLimits(0,0); @@ -3977,77 +3970,77 @@ demo_core__$ConvexCastingDemo_LaserPointer.prototype = { res.x = vX; res.y = vY; res.z = vZ; - var y1 = -this.length - 20; - if(y1 == null) { - y1 = 0; + var y = -this.length - 20; + if(y == null) { + y = 0; } - var v_x1 = 0; - var v_y1 = y1; - var v_z1 = 0; + var v_x = 0; + var v_y = y; + var v_z = 0; oimo_common_Vec3.numCreations++; - var vX1 = v_x1; - var vY1 = v_y1; - var vZ1 = v_z1; - var __tmp__X1 = tf._rotation00 * v_x1 + tf._rotation01 * v_y1 + tf._rotation02 * v_z1; - var __tmp__Y1 = tf._rotation10 * v_x1 + tf._rotation11 * v_y1 + tf._rotation12 * v_z1; - var __tmp__Z1 = tf._rotation20 * v_x1 + tf._rotation21 * v_y1 + tf._rotation22 * v_z1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - vX1 = __tmp__X1 + tf._positionX; - vY1 = __tmp__Y1 + tf._positionY; - vZ1 = __tmp__Z1 + tf._positionZ; + var vX = v_x; + var vY = v_y; + var vZ = v_z; + var __tmp__X = tf._rotation00 * v_x + tf._rotation01 * v_y + tf._rotation02 * v_z; + var __tmp__Y = tf._rotation10 * v_x + tf._rotation11 * v_y + tf._rotation12 * v_z; + var __tmp__Z = tf._rotation20 * v_x + tf._rotation21 * v_y + tf._rotation22 * v_z; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX = __tmp__X + tf._positionX; + vY = __tmp__Y + tf._positionY; + vZ = __tmp__Z + tf._positionZ; var end_x = 0; var end_y = 0; var end_z = 0; oimo_common_Vec3.numCreations++; - end_x = vX1; - end_y = vY1; - end_z = vZ1; + end_x = vX; + end_y = vY; + end_z = vZ; var r = new oimo_common_Vec3(end_x - res.x,end_y - res.y,end_z - res.z); var convex = this.rb._shapeList._geom; - var _this1 = this.cb; - _this1.shape = null; - _this1.fraction = 1; - _this1.position.zero(); - _this1.normal.zero(); - _this1.hit = false; + var _this = this.cb; + _this.shape = null; + _this.fraction = 1; + _this.position.zero(); + _this.normal.zero(); + _this.hit = false; var green = new oimo_common_Vec3(0,1,0); this.world.convexCast(convex,tf,r,this.cb); if(this.cb.hit) { var s = this.cb.fraction; var x = res.x + r.x * s; - var y2 = res.y + r.y * s; + var y = res.y + r.y * s; var z = res.z + r.z * s; if(z == null) { z = 0; } - if(y2 == null) { - y2 = 0; + if(y == null) { + y = 0; } if(x == null) { x = 0; } oimo_common_Vec3.numCreations++; - var s1 = this.cb.fraction; - debugDraw.line(res,new oimo_common_Vec3(res.x + r.x * s1,res.y + r.y * s1,res.z + r.z * s1),green); - var v_x2 = 0; - var v_y2 = 0; - var v_z2 = 0; + var s = this.cb.fraction; + debugDraw.line(res,new oimo_common_Vec3(res.x + r.x * s,res.y + r.y * s,res.z + r.z * s),green); + var v_x = 0; + var v_y = 0; + var v_z = 0; oimo_common_Vec3.numCreations++; - v_x2 = tf._positionX; - v_y2 = tf._positionY; - v_z2 = tf._positionZ; - var s2 = this.cb.fraction; - var x1 = v_x2 + r.x * s2; - var y3 = v_y2 + r.y * s2; - var z1 = v_z2 + r.z * s2; - v_x2 = x1; - v_y2 = y3; - v_z2 = z1; - tf._positionX = x1; - tf._positionY = y3; - tf._positionZ = z1; + v_x = tf._positionX; + v_y = tf._positionY; + v_z = tf._positionZ; + var s = this.cb.fraction; + var x = v_x + r.x * s; + var y = v_y + r.y * s; + var z = v_z + r.z * s; + v_x = x; + v_y = y; + v_z = z; + tf._positionX = x; + tf._positionY = y; + tf._positionZ = z; debugDraw.cylinder(tf,convex._radius,convex._halfHeight,green); debugDraw.point(this.cb.position,green); } @@ -4260,19 +4253,19 @@ demo_core_FallingRagdollDemo.prototype = $extend(demo_common_DemoBase.prototype, var ragdollPos = new oimo_common_Vec3(stairCenter_x + 0,16.21,-17.7); this.ragdoll = demo_common_OimoUtil.addRagdoll(world,ragdollPos); oimo_common_Vec3.numCreations++; - var _this1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(ragdollPos.x + 0,ragdollPos.y + 0,ragdollPos.z + (-2)),new oimo_common_Vec3(0.2,0.2,0.2),false); + var _this = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(ragdollPos.x + 0,ragdollPos.y + 0,ragdollPos.z + (-2)),new oimo_common_Vec3(0.2,0.2,0.2),false); oimo_common_Vec3.numCreations++; - if(_this1._type == 1) { - _this1._velX = 0; - _this1._velY = 0; - _this1._velZ = 0; + if(_this._type == 1) { + _this._velX = 0; + _this._velY = 0; + _this._velZ = 0; } else { - _this1._velX = 0; - _this1._velY = 3.5; - _this1._velZ = 4; + _this._velX = 0; + _this._velY = 3.5; + _this._velZ = 4; } - _this1._sleeping = false; - _this1._sleepTime = 0; + _this._sleeping = false; + _this._sleepTime = 0; oimo_common_Setting.defaultRestitution = tmp1; oimo_common_Setting.defaultFriction = tmp2; } @@ -4304,19 +4297,19 @@ demo_core_FallingRagdollDemo.prototype = $extend(demo_common_DemoBase.prototype, var eye_y = y; var eye_z = z; oimo_common_Vec3.numCreations++; - var _this1 = this.ragdoll; + var _this = this.ragdoll; var at_x = 0; var at_y = 0; var at_z = 0; oimo_common_Vec3.numCreations++; - at_x = _this1._transform._positionX; - at_y = _this1._transform._positionY; - at_z = _this1._transform._positionZ; + at_x = _this._transform._positionX; + at_y = _this._transform._positionY; + at_z = _this._transform._positionZ; var up_x = 0; var up_y = 1; var up_z = 0; oimo_common_Vec3.numCreations++; - var _this2 = this.renderer.viewMat; + var _this = this.renderer.viewMat; var zx = eye_x - at_x; var zy = eye_y - at_y; var zz = eye_z - at_z; @@ -4334,22 +4327,22 @@ demo_core_FallingRagdollDemo.prototype = $extend(demo_common_DemoBase.prototype, var yx = zy * xz - zz * xy; var yy = zz * xx - zx * xz; var yz = zx * xy - zy * xx; - _this2.e00 = xx; - _this2.e01 = xy; - _this2.e02 = xz; - _this2.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); - _this2.e10 = yx; - _this2.e11 = yy; - _this2.e12 = yz; - _this2.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); - _this2.e20 = zx; - _this2.e21 = zy; - _this2.e22 = zz; - _this2.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); - _this2.e30 = 0; - _this2.e31 = 0; - _this2.e32 = 0; - _this2.e33 = 1; + _this.e00 = xx; + _this.e01 = xy; + _this.e02 = xz; + _this.e03 = -(xx * eye_x + xy * eye_y + xz * eye_z); + _this.e10 = yx; + _this.e11 = yy; + _this.e12 = yz; + _this.e13 = -(yx * eye_x + yy * eye_y + yz * eye_z); + _this.e20 = zx; + _this.e21 = zy; + _this.e22 = zz; + _this.e23 = -(zx * eye_x + zy * eye_y + zz * eye_z); + _this.e30 = 0; + _this.e31 = 0; + _this.e32 = 0; + _this.e33 = 1; } } ,__class__: demo_core_FallingRagdollDemo @@ -4492,60 +4485,60 @@ demo_core_FrictionsAndRestitutions.prototype = $extend(demo_common_DemoBase.prot tiltedFloor._transform._rotation20 = __tmp__20; tiltedFloor._transform._rotation21 = __tmp__21; tiltedFloor._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia20; - __tmp__011 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia21; - __tmp__021 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia22; - __tmp__101 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia20; - __tmp__111 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia21; - __tmp__121 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia22; - __tmp__201 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia20; - __tmp__211 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia21; - __tmp__221 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia22; - tiltedFloor._invInertia00 = __tmp__001; - tiltedFloor._invInertia01 = __tmp__011; - tiltedFloor._invInertia02 = __tmp__021; - tiltedFloor._invInertia10 = __tmp__101; - tiltedFloor._invInertia11 = __tmp__111; - tiltedFloor._invInertia12 = __tmp__121; - tiltedFloor._invInertia20 = __tmp__201; - tiltedFloor._invInertia21 = __tmp__211; - tiltedFloor._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation02; - __tmp__012 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation12; - __tmp__022 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation22; - __tmp__102 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation02; - __tmp__112 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation12; - __tmp__122 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation22; - __tmp__202 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation02; - __tmp__212 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation12; - __tmp__222 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation22; - tiltedFloor._invInertia00 = __tmp__002; - tiltedFloor._invInertia01 = __tmp__012; - tiltedFloor._invInertia02 = __tmp__022; - tiltedFloor._invInertia10 = __tmp__102; - tiltedFloor._invInertia11 = __tmp__112; - tiltedFloor._invInertia12 = __tmp__122; - tiltedFloor._invInertia20 = __tmp__202; - tiltedFloor._invInertia21 = __tmp__212; - tiltedFloor._invInertia22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia20; + __tmp__01 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia21; + __tmp__02 = tiltedFloor._transform._rotation00 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation01 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation02 * tiltedFloor._invLocalInertia22; + __tmp__10 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia20; + __tmp__11 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia21; + __tmp__12 = tiltedFloor._transform._rotation10 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation11 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation12 * tiltedFloor._invLocalInertia22; + __tmp__20 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia00 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia10 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia20; + __tmp__21 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia01 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia11 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia21; + __tmp__22 = tiltedFloor._transform._rotation20 * tiltedFloor._invLocalInertia02 + tiltedFloor._transform._rotation21 * tiltedFloor._invLocalInertia12 + tiltedFloor._transform._rotation22 * tiltedFloor._invLocalInertia22; + tiltedFloor._invInertia00 = __tmp__00; + tiltedFloor._invInertia01 = __tmp__01; + tiltedFloor._invInertia02 = __tmp__02; + tiltedFloor._invInertia10 = __tmp__10; + tiltedFloor._invInertia11 = __tmp__11; + tiltedFloor._invInertia12 = __tmp__12; + tiltedFloor._invInertia20 = __tmp__20; + tiltedFloor._invInertia21 = __tmp__21; + tiltedFloor._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation02; + __tmp__01 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation12; + __tmp__02 = tiltedFloor._invInertia00 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia01 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia02 * tiltedFloor._transform._rotation22; + __tmp__10 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation02; + __tmp__11 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation12; + __tmp__12 = tiltedFloor._invInertia10 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia11 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia12 * tiltedFloor._transform._rotation22; + __tmp__20 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation00 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation01 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation02; + __tmp__21 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation10 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation11 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation12; + __tmp__22 = tiltedFloor._invInertia20 * tiltedFloor._transform._rotation20 + tiltedFloor._invInertia21 * tiltedFloor._transform._rotation21 + tiltedFloor._invInertia22 * tiltedFloor._transform._rotation22; + tiltedFloor._invInertia00 = __tmp__00; + tiltedFloor._invInertia01 = __tmp__01; + tiltedFloor._invInertia02 = __tmp__02; + tiltedFloor._invInertia10 = __tmp__10; + tiltedFloor._invInertia11 = __tmp__11; + tiltedFloor._invInertia12 = __tmp__12; + tiltedFloor._invInertia20 = __tmp__20; + tiltedFloor._invInertia21 = __tmp__21; + tiltedFloor._invInertia22 = __tmp__22; tiltedFloor._invInertia00 *= tiltedFloor._rotFactor.x; tiltedFloor._invInertia01 *= tiltedFloor._rotFactor.x; tiltedFloor._invInertia02 *= tiltedFloor._rotFactor.x; @@ -4569,127 +4562,127 @@ demo_core_FrictionsAndRestitutions.prototype = $extend(demo_common_DemoBase.prot dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s1 = tiltedFloor._shapeList; - while(s1 != null) { - var n = s1._next; + var s = tiltedFloor._shapeList; + while(s != null) { + var n = s._next; var tf1 = tiltedFloor._ptransform; var tf2 = tiltedFloor._transform; - var dst1 = s1._ptransform; - var src1 = s1._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s1._transform; - var src11 = s1._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; var maxX; var maxY; var maxZ; - s1._geom._computeAabb(s1._aabb,s1._ptransform); - minX = s1._aabb._minX; - minY = s1._aabb._minY; - minZ = s1._aabb._minZ; - maxX = s1._aabb._maxX; - maxY = s1._aabb._maxY; - maxZ = s1._aabb._maxZ; - s1._geom._computeAabb(s1._aabb,s1._transform); - s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; - s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; - s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; - s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; - s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; - s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; - if(s1._proxy != null) { + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s1._transform._positionX - s1._ptransform._positionX; - dY = s1._transform._positionY - s1._ptransform._positionY; - dZ = s1._transform._positionZ - s1._ptransform._positionZ; - var v = s1.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s1 = n; + s = n; } tiltedFloor._sleeping = false; tiltedFloor._sleepTime = 0; @@ -4706,105 +4699,105 @@ demo_core_FrictionsAndRestitutions.prototype = $extend(demo_common_DemoBase.prot pos.y += 2.3; var box = demo_common_OimoUtil.addBox(world,pos,new oimo_common_Vec3(0.2,0.2,0.2),false); box._shapeList._friction = i / 16; - var rot001; - var rot011; - var rot021; - var rot101; - var rot111; - var rot121; - var rot201; - var rot211; - var rot221; - rot001 = e00; - rot011 = e01; - rot021 = e02; - rot101 = e10; - rot111 = e11; - rot121 = e12; - rot201 = e20; - rot211 = e21; - rot221 = e22; - var __tmp__005; - var __tmp__015; - var __tmp__025; - var __tmp__105; - var __tmp__115; - var __tmp__125; - var __tmp__205; - var __tmp__215; - var __tmp__225; - __tmp__005 = rot001 * box._transform._rotation00 + rot011 * box._transform._rotation10 + rot021 * box._transform._rotation20; - __tmp__015 = rot001 * box._transform._rotation01 + rot011 * box._transform._rotation11 + rot021 * box._transform._rotation21; - __tmp__025 = rot001 * box._transform._rotation02 + rot011 * box._transform._rotation12 + rot021 * box._transform._rotation22; - __tmp__105 = rot101 * box._transform._rotation00 + rot111 * box._transform._rotation10 + rot121 * box._transform._rotation20; - __tmp__115 = rot101 * box._transform._rotation01 + rot111 * box._transform._rotation11 + rot121 * box._transform._rotation21; - __tmp__125 = rot101 * box._transform._rotation02 + rot111 * box._transform._rotation12 + rot121 * box._transform._rotation22; - __tmp__205 = rot201 * box._transform._rotation00 + rot211 * box._transform._rotation10 + rot221 * box._transform._rotation20; - __tmp__215 = rot201 * box._transform._rotation01 + rot211 * box._transform._rotation11 + rot221 * box._transform._rotation21; - __tmp__225 = rot201 * box._transform._rotation02 + rot211 * box._transform._rotation12 + rot221 * box._transform._rotation22; - box._transform._rotation00 = __tmp__005; - box._transform._rotation01 = __tmp__015; - box._transform._rotation02 = __tmp__025; - box._transform._rotation10 = __tmp__105; - box._transform._rotation11 = __tmp__115; - box._transform._rotation12 = __tmp__125; - box._transform._rotation20 = __tmp__205; - box._transform._rotation21 = __tmp__215; - box._transform._rotation22 = __tmp__225; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = box._transform._rotation00 * box._invLocalInertia00 + box._transform._rotation01 * box._invLocalInertia10 + box._transform._rotation02 * box._invLocalInertia20; - __tmp__016 = box._transform._rotation00 * box._invLocalInertia01 + box._transform._rotation01 * box._invLocalInertia11 + box._transform._rotation02 * box._invLocalInertia21; - __tmp__026 = box._transform._rotation00 * box._invLocalInertia02 + box._transform._rotation01 * box._invLocalInertia12 + box._transform._rotation02 * box._invLocalInertia22; - __tmp__106 = box._transform._rotation10 * box._invLocalInertia00 + box._transform._rotation11 * box._invLocalInertia10 + box._transform._rotation12 * box._invLocalInertia20; - __tmp__116 = box._transform._rotation10 * box._invLocalInertia01 + box._transform._rotation11 * box._invLocalInertia11 + box._transform._rotation12 * box._invLocalInertia21; - __tmp__126 = box._transform._rotation10 * box._invLocalInertia02 + box._transform._rotation11 * box._invLocalInertia12 + box._transform._rotation12 * box._invLocalInertia22; - __tmp__206 = box._transform._rotation20 * box._invLocalInertia00 + box._transform._rotation21 * box._invLocalInertia10 + box._transform._rotation22 * box._invLocalInertia20; - __tmp__216 = box._transform._rotation20 * box._invLocalInertia01 + box._transform._rotation21 * box._invLocalInertia11 + box._transform._rotation22 * box._invLocalInertia21; - __tmp__226 = box._transform._rotation20 * box._invLocalInertia02 + box._transform._rotation21 * box._invLocalInertia12 + box._transform._rotation22 * box._invLocalInertia22; - box._invInertia00 = __tmp__006; - box._invInertia01 = __tmp__016; - box._invInertia02 = __tmp__026; - box._invInertia10 = __tmp__106; - box._invInertia11 = __tmp__116; - box._invInertia12 = __tmp__126; - box._invInertia20 = __tmp__206; - box._invInertia21 = __tmp__216; - box._invInertia22 = __tmp__226; - var __tmp__007; - var __tmp__017; - var __tmp__027; - var __tmp__107; - var __tmp__117; - var __tmp__127; - var __tmp__207; - var __tmp__217; - var __tmp__227; - __tmp__007 = box._invInertia00 * box._transform._rotation00 + box._invInertia01 * box._transform._rotation01 + box._invInertia02 * box._transform._rotation02; - __tmp__017 = box._invInertia00 * box._transform._rotation10 + box._invInertia01 * box._transform._rotation11 + box._invInertia02 * box._transform._rotation12; - __tmp__027 = box._invInertia00 * box._transform._rotation20 + box._invInertia01 * box._transform._rotation21 + box._invInertia02 * box._transform._rotation22; - __tmp__107 = box._invInertia10 * box._transform._rotation00 + box._invInertia11 * box._transform._rotation01 + box._invInertia12 * box._transform._rotation02; - __tmp__117 = box._invInertia10 * box._transform._rotation10 + box._invInertia11 * box._transform._rotation11 + box._invInertia12 * box._transform._rotation12; - __tmp__127 = box._invInertia10 * box._transform._rotation20 + box._invInertia11 * box._transform._rotation21 + box._invInertia12 * box._transform._rotation22; - __tmp__207 = box._invInertia20 * box._transform._rotation00 + box._invInertia21 * box._transform._rotation01 + box._invInertia22 * box._transform._rotation02; - __tmp__217 = box._invInertia20 * box._transform._rotation10 + box._invInertia21 * box._transform._rotation11 + box._invInertia22 * box._transform._rotation12; - __tmp__227 = box._invInertia20 * box._transform._rotation20 + box._invInertia21 * box._transform._rotation21 + box._invInertia22 * box._transform._rotation22; - box._invInertia00 = __tmp__007; - box._invInertia01 = __tmp__017; - box._invInertia02 = __tmp__027; - box._invInertia10 = __tmp__107; - box._invInertia11 = __tmp__117; - box._invInertia12 = __tmp__127; - box._invInertia20 = __tmp__207; - box._invInertia21 = __tmp__217; - box._invInertia22 = __tmp__227; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = e00; + rot01 = e01; + rot02 = e02; + rot10 = e10; + rot11 = e11; + rot12 = e12; + rot20 = e20; + rot21 = e21; + rot22 = e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * box._transform._rotation00 + rot01 * box._transform._rotation10 + rot02 * box._transform._rotation20; + __tmp__01 = rot00 * box._transform._rotation01 + rot01 * box._transform._rotation11 + rot02 * box._transform._rotation21; + __tmp__02 = rot00 * box._transform._rotation02 + rot01 * box._transform._rotation12 + rot02 * box._transform._rotation22; + __tmp__10 = rot10 * box._transform._rotation00 + rot11 * box._transform._rotation10 + rot12 * box._transform._rotation20; + __tmp__11 = rot10 * box._transform._rotation01 + rot11 * box._transform._rotation11 + rot12 * box._transform._rotation21; + __tmp__12 = rot10 * box._transform._rotation02 + rot11 * box._transform._rotation12 + rot12 * box._transform._rotation22; + __tmp__20 = rot20 * box._transform._rotation00 + rot21 * box._transform._rotation10 + rot22 * box._transform._rotation20; + __tmp__21 = rot20 * box._transform._rotation01 + rot21 * box._transform._rotation11 + rot22 * box._transform._rotation21; + __tmp__22 = rot20 * box._transform._rotation02 + rot21 * box._transform._rotation12 + rot22 * box._transform._rotation22; + box._transform._rotation00 = __tmp__00; + box._transform._rotation01 = __tmp__01; + box._transform._rotation02 = __tmp__02; + box._transform._rotation10 = __tmp__10; + box._transform._rotation11 = __tmp__11; + box._transform._rotation12 = __tmp__12; + box._transform._rotation20 = __tmp__20; + box._transform._rotation21 = __tmp__21; + box._transform._rotation22 = __tmp__22; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = box._transform._rotation00 * box._invLocalInertia00 + box._transform._rotation01 * box._invLocalInertia10 + box._transform._rotation02 * box._invLocalInertia20; + __tmp__011 = box._transform._rotation00 * box._invLocalInertia01 + box._transform._rotation01 * box._invLocalInertia11 + box._transform._rotation02 * box._invLocalInertia21; + __tmp__021 = box._transform._rotation00 * box._invLocalInertia02 + box._transform._rotation01 * box._invLocalInertia12 + box._transform._rotation02 * box._invLocalInertia22; + __tmp__101 = box._transform._rotation10 * box._invLocalInertia00 + box._transform._rotation11 * box._invLocalInertia10 + box._transform._rotation12 * box._invLocalInertia20; + __tmp__111 = box._transform._rotation10 * box._invLocalInertia01 + box._transform._rotation11 * box._invLocalInertia11 + box._transform._rotation12 * box._invLocalInertia21; + __tmp__121 = box._transform._rotation10 * box._invLocalInertia02 + box._transform._rotation11 * box._invLocalInertia12 + box._transform._rotation12 * box._invLocalInertia22; + __tmp__201 = box._transform._rotation20 * box._invLocalInertia00 + box._transform._rotation21 * box._invLocalInertia10 + box._transform._rotation22 * box._invLocalInertia20; + __tmp__211 = box._transform._rotation20 * box._invLocalInertia01 + box._transform._rotation21 * box._invLocalInertia11 + box._transform._rotation22 * box._invLocalInertia21; + __tmp__221 = box._transform._rotation20 * box._invLocalInertia02 + box._transform._rotation21 * box._invLocalInertia12 + box._transform._rotation22 * box._invLocalInertia22; + box._invInertia00 = __tmp__001; + box._invInertia01 = __tmp__011; + box._invInertia02 = __tmp__021; + box._invInertia10 = __tmp__101; + box._invInertia11 = __tmp__111; + box._invInertia12 = __tmp__121; + box._invInertia20 = __tmp__201; + box._invInertia21 = __tmp__211; + box._invInertia22 = __tmp__221; + var __tmp__002; + var __tmp__012; + var __tmp__022; + var __tmp__102; + var __tmp__112; + var __tmp__122; + var __tmp__202; + var __tmp__212; + var __tmp__222; + __tmp__002 = box._invInertia00 * box._transform._rotation00 + box._invInertia01 * box._transform._rotation01 + box._invInertia02 * box._transform._rotation02; + __tmp__012 = box._invInertia00 * box._transform._rotation10 + box._invInertia01 * box._transform._rotation11 + box._invInertia02 * box._transform._rotation12; + __tmp__022 = box._invInertia00 * box._transform._rotation20 + box._invInertia01 * box._transform._rotation21 + box._invInertia02 * box._transform._rotation22; + __tmp__102 = box._invInertia10 * box._transform._rotation00 + box._invInertia11 * box._transform._rotation01 + box._invInertia12 * box._transform._rotation02; + __tmp__112 = box._invInertia10 * box._transform._rotation10 + box._invInertia11 * box._transform._rotation11 + box._invInertia12 * box._transform._rotation12; + __tmp__122 = box._invInertia10 * box._transform._rotation20 + box._invInertia11 * box._transform._rotation21 + box._invInertia12 * box._transform._rotation22; + __tmp__202 = box._invInertia20 * box._transform._rotation00 + box._invInertia21 * box._transform._rotation01 + box._invInertia22 * box._transform._rotation02; + __tmp__212 = box._invInertia20 * box._transform._rotation10 + box._invInertia21 * box._transform._rotation11 + box._invInertia22 * box._transform._rotation12; + __tmp__222 = box._invInertia20 * box._transform._rotation20 + box._invInertia21 * box._transform._rotation21 + box._invInertia22 * box._transform._rotation22; + box._invInertia00 = __tmp__002; + box._invInertia01 = __tmp__012; + box._invInertia02 = __tmp__022; + box._invInertia10 = __tmp__102; + box._invInertia11 = __tmp__112; + box._invInertia12 = __tmp__122; + box._invInertia20 = __tmp__202; + box._invInertia21 = __tmp__212; + box._invInertia22 = __tmp__222; box._invInertia00 *= box._rotFactor.x; box._invInertia01 *= box._rotFactor.x; box._invInertia02 *= box._rotFactor.x; @@ -4814,141 +4807,141 @@ demo_core_FrictionsAndRestitutions.prototype = $extend(demo_common_DemoBase.prot box._invInertia20 *= box._rotFactor.z; box._invInertia21 *= box._rotFactor.z; box._invInertia22 *= box._rotFactor.z; - var dst3 = box._ptransform; - var src2 = box._transform; - dst3._positionX = src2._positionX; - dst3._positionY = src2._positionY; - dst3._positionZ = src2._positionZ; - dst3._rotation00 = src2._rotation00; - dst3._rotation01 = src2._rotation01; - dst3._rotation02 = src2._rotation02; - dst3._rotation10 = src2._rotation10; - dst3._rotation11 = src2._rotation11; - dst3._rotation12 = src2._rotation12; - dst3._rotation20 = src2._rotation20; - dst3._rotation21 = src2._rotation21; - dst3._rotation22 = src2._rotation22; - var s2 = box._shapeList; - while(s2 != null) { - var n1 = s2._next; - var tf11 = box._ptransform; - var tf21 = box._transform; - var dst4 = s2._ptransform; - var src12 = s2._localTransform; - var __tmp__008; - var __tmp__018; - var __tmp__028; - var __tmp__108; - var __tmp__118; - var __tmp__128; - var __tmp__208; - var __tmp__218; - var __tmp__228; - __tmp__008 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; - __tmp__018 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; - __tmp__028 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; - __tmp__108 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; - __tmp__118 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; - __tmp__128 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; - __tmp__208 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; - __tmp__218 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; - __tmp__228 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; - dst4._rotation00 = __tmp__008; - dst4._rotation01 = __tmp__018; - dst4._rotation02 = __tmp__028; - dst4._rotation10 = __tmp__108; - dst4._rotation11 = __tmp__118; - dst4._rotation12 = __tmp__128; - dst4._rotation20 = __tmp__208; - dst4._rotation21 = __tmp__218; - dst4._rotation22 = __tmp__228; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; - __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; - __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; - dst4._positionX = __tmp__X2; - dst4._positionY = __tmp__Y2; - dst4._positionZ = __tmp__Z2; - dst4._positionX += tf11._positionX; - dst4._positionY += tf11._positionY; - dst4._positionZ += tf11._positionZ; - var dst5 = s2._transform; - var src13 = s2._localTransform; - var __tmp__009; - var __tmp__019; - var __tmp__029; - var __tmp__109; - var __tmp__119; - var __tmp__129; - var __tmp__209; - var __tmp__219; - var __tmp__229; - __tmp__009 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; - __tmp__019 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; - __tmp__029 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; - __tmp__109 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; - __tmp__119 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; - __tmp__129 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; - __tmp__209 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; - __tmp__219 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; - __tmp__229 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; - dst5._rotation00 = __tmp__009; - dst5._rotation01 = __tmp__019; - dst5._rotation02 = __tmp__029; - dst5._rotation10 = __tmp__109; - dst5._rotation11 = __tmp__119; - dst5._rotation12 = __tmp__129; - dst5._rotation20 = __tmp__209; - dst5._rotation21 = __tmp__219; - dst5._rotation22 = __tmp__229; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; - __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; - __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; - dst5._positionX = __tmp__X3; - dst5._positionY = __tmp__Y3; - dst5._positionZ = __tmp__Z3; - dst5._positionX += tf21._positionX; - dst5._positionY += tf21._positionY; - dst5._positionZ += tf21._positionZ; - var minX1; - var minY1; - var minZ1; - var maxX1; - var maxY1; - var maxZ1; - s2._geom._computeAabb(s2._aabb,s2._ptransform); - minX1 = s2._aabb._minX; - minY1 = s2._aabb._minY; - minZ1 = s2._aabb._minZ; - maxX1 = s2._aabb._maxX; - maxY1 = s2._aabb._maxY; - maxZ1 = s2._aabb._maxZ; - s2._geom._computeAabb(s2._aabb,s2._transform); - s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; - s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; - s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; - s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; - s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; - s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; - if(s2._proxy != null) { - var dX1; - var dY1; - var dZ1; - dX1 = s2._transform._positionX - s2._ptransform._positionX; - dY1 = s2._transform._positionY - s2._ptransform._positionY; - dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; - var v1 = s2.displacement; - v1.x = dX1; - v1.y = dY1; - v1.z = dZ1; - s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); - } - s2 = n1; + var dst = box._ptransform; + var src = box._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = box._shapeList; + while(s != null) { + var n = s._next; + var tf1 = box._ptransform; + var tf2 = box._transform; + var dst1 = s._ptransform; + var src1 = s._localTransform; + var __tmp__003; + var __tmp__013; + var __tmp__023; + var __tmp__103; + var __tmp__113; + var __tmp__123; + var __tmp__203; + var __tmp__213; + var __tmp__223; + __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst1._rotation00 = __tmp__003; + dst1._rotation01 = __tmp__013; + dst1._rotation02 = __tmp__023; + dst1._rotation10 = __tmp__103; + dst1._rotation11 = __tmp__113; + dst1._rotation12 = __tmp__123; + dst1._rotation20 = __tmp__203; + dst1._rotation21 = __tmp__213; + dst1._rotation22 = __tmp__223; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst1._positionX = __tmp__X; + dst1._positionY = __tmp__Y; + dst1._positionZ = __tmp__Z; + dst1._positionX += tf1._positionX; + dst1._positionY += tf1._positionY; + dst1._positionZ += tf1._positionZ; + var dst2 = s._transform; + var src11 = s._localTransform; + var __tmp__004; + var __tmp__014; + var __tmp__024; + var __tmp__104; + var __tmp__114; + var __tmp__124; + var __tmp__204; + var __tmp__214; + var __tmp__224; + __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst2._rotation00 = __tmp__004; + dst2._rotation01 = __tmp__014; + dst2._rotation02 = __tmp__024; + dst2._rotation10 = __tmp__104; + dst2._rotation11 = __tmp__114; + dst2._rotation12 = __tmp__124; + dst2._rotation20 = __tmp__204; + dst2._rotation21 = __tmp__214; + dst2._rotation22 = __tmp__224; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst2._positionX = __tmp__X1; + dst2._positionY = __tmp__Y1; + dst2._positionZ = __tmp__Z1; + dst2._positionX += tf2._positionX; + dst2._positionY += tf2._positionY; + dst2._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; } box._sleeping = false; box._sleepTime = 0; @@ -5029,28 +5022,28 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ var _g = 0; while(_g < 20) { ++_g; - var _this1 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this1.x *= 3; - _this1.y = _this1.y; - _this1.z = _this1.z; + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 3; + _this.y = _this.y; + _this.z = _this.z; oimo_common_Vec3.numCreations++; - _this1.x += 0; - _this1.y += 6; - _this1.z += 0; - demo_common_OimoUtil.addBox(world,_this1,new oimo_common_Vec3(0.2,0.2,0.2),false); + _this.x += 0; + _this.y += 6; + _this.z += 0; + demo_common_OimoUtil.addBox(world,_this,new oimo_common_Vec3(0.2,0.2,0.2),false); } - var _g1 = 0; - while(_g1 < 20) { - ++_g1; - var _this2 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this2.x *= 3; - _this2.y = _this2.y; - _this2.z = _this2.z; + var _g = 0; + while(_g < 20) { + ++_g; + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 3; + _this.y = _this.y; + _this.z = _this.z; oimo_common_Vec3.numCreations++; - _this2.x += 0; - _this2.y += 6; - _this2.z += 0; - demo_common_OimoUtil.addSphere(world,_this2,0.3,false); + _this.x += 0; + _this.y += 6; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.3,false); } } ,createGear: function(center,radius,thickness,lm) { @@ -5147,36 +5140,36 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ var m_e21 = 0; var m_e22 = 1; oimo_common_Mat3.numCreations++; - var s1 = Math.sin(1.570796326794895); - var c2 = Math.cos(1.570796326794895); - var c11 = 1 - c2; - var r001 = c11 + c2; - var r011 = 0 * c11 - 0 * s1; - var r021 = 0 * c11 + 0 * s1; - var r101 = 0 * c11 + 0 * s1; - var r111 = 0 * c11 + c2; - var r121 = 0 * c11 - s1; - var r201 = 0 * c11 - 0 * s1; - var r211 = 0 * c11 + s1; - var r221 = 0 * c11 + c2; - var e001 = m_e00 * r001 + m_e01 * r101 + m_e02 * r201; - var e012 = m_e00 * r011 + m_e01 * r111 + m_e02 * r211; - var e022 = m_e00 * r021 + m_e01 * r121 + m_e02 * r221; - var e101 = m_e10 * r001 + m_e11 * r101 + m_e12 * r201; - var e112 = m_e10 * r011 + m_e11 * r111 + m_e12 * r211; - var e122 = m_e10 * r021 + m_e11 * r121 + m_e12 * r221; - var e201 = m_e20 * r001 + m_e21 * r101 + m_e22 * r201; - var e212 = m_e20 * r011 + m_e21 * r111 + m_e22 * r211; - var e222 = m_e20 * r021 + m_e21 * r121 + m_e22 * r221; - m_e00 = e001; - m_e01 = e012; - m_e02 = e022; - m_e10 = e101; - m_e11 = e112; - m_e12 = e122; - m_e20 = e201; - m_e21 = e212; - m_e22 = e222; + var s = Math.sin(1.570796326794895); + var c = Math.cos(1.570796326794895); + var c1 = 1 - c; + var r00 = c1 + c; + var r01 = 0 * c1 - 0 * s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + 0 * s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + s; + var r22 = 0 * c1 + c; + var e00 = m_e00 * r00 + m_e01 * r10 + m_e02 * r20; + var e01 = m_e00 * r01 + m_e01 * r11 + m_e02 * r21; + var e02 = m_e00 * r02 + m_e01 * r12 + m_e02 * r22; + var e10 = m_e10 * r00 + m_e11 * r10 + m_e12 * r20; + var e11 = m_e10 * r01 + m_e11 * r11 + m_e12 * r21; + var e12 = m_e10 * r02 + m_e11 * r12 + m_e12 * r22; + var e20 = m_e20 * r00 + m_e21 * r10 + m_e22 * r20; + var e21 = m_e20 * r01 + m_e21 * r11 + m_e22 * r21; + var e22 = m_e20 * r02 + m_e21 * r12 + m_e22 * r22; + m_e00 = e00; + m_e01 = e01; + m_e02 = e02; + m_e10 = e10; + m_e11 = e11; + m_e12 = e12; + m_e20 = e20; + m_e21 = e21; + m_e22 = e22; var rot00; var rot01; var rot02; @@ -5186,15 +5179,15 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ var rot20; var rot21; var rot22; - rot00 = e001; - rot01 = e012; - rot02 = e022; - rot10 = e101; - rot11 = e112; - rot12 = e122; - rot20 = e201; - rot21 = e212; - rot22 = e222; + rot00 = e00; + rot01 = e01; + rot02 = e02; + rot10 = e10; + rot11 = e11; + rot12 = e12; + rot20 = e20; + rot21 = e21; + rot22 = e22; var __tmp__00; var __tmp__01; var __tmp__02; @@ -5222,60 +5215,60 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ wheel._transform._rotation20 = __tmp__20; wheel._transform._rotation21 = __tmp__21; wheel._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = wheel._transform._rotation00 * wheel._invLocalInertia00 + wheel._transform._rotation01 * wheel._invLocalInertia10 + wheel._transform._rotation02 * wheel._invLocalInertia20; - __tmp__011 = wheel._transform._rotation00 * wheel._invLocalInertia01 + wheel._transform._rotation01 * wheel._invLocalInertia11 + wheel._transform._rotation02 * wheel._invLocalInertia21; - __tmp__021 = wheel._transform._rotation00 * wheel._invLocalInertia02 + wheel._transform._rotation01 * wheel._invLocalInertia12 + wheel._transform._rotation02 * wheel._invLocalInertia22; - __tmp__101 = wheel._transform._rotation10 * wheel._invLocalInertia00 + wheel._transform._rotation11 * wheel._invLocalInertia10 + wheel._transform._rotation12 * wheel._invLocalInertia20; - __tmp__111 = wheel._transform._rotation10 * wheel._invLocalInertia01 + wheel._transform._rotation11 * wheel._invLocalInertia11 + wheel._transform._rotation12 * wheel._invLocalInertia21; - __tmp__121 = wheel._transform._rotation10 * wheel._invLocalInertia02 + wheel._transform._rotation11 * wheel._invLocalInertia12 + wheel._transform._rotation12 * wheel._invLocalInertia22; - __tmp__201 = wheel._transform._rotation20 * wheel._invLocalInertia00 + wheel._transform._rotation21 * wheel._invLocalInertia10 + wheel._transform._rotation22 * wheel._invLocalInertia20; - __tmp__211 = wheel._transform._rotation20 * wheel._invLocalInertia01 + wheel._transform._rotation21 * wheel._invLocalInertia11 + wheel._transform._rotation22 * wheel._invLocalInertia21; - __tmp__221 = wheel._transform._rotation20 * wheel._invLocalInertia02 + wheel._transform._rotation21 * wheel._invLocalInertia12 + wheel._transform._rotation22 * wheel._invLocalInertia22; - wheel._invInertia00 = __tmp__001; - wheel._invInertia01 = __tmp__011; - wheel._invInertia02 = __tmp__021; - wheel._invInertia10 = __tmp__101; - wheel._invInertia11 = __tmp__111; - wheel._invInertia12 = __tmp__121; - wheel._invInertia20 = __tmp__201; - wheel._invInertia21 = __tmp__211; - wheel._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = wheel._invInertia00 * wheel._transform._rotation00 + wheel._invInertia01 * wheel._transform._rotation01 + wheel._invInertia02 * wheel._transform._rotation02; - __tmp__012 = wheel._invInertia00 * wheel._transform._rotation10 + wheel._invInertia01 * wheel._transform._rotation11 + wheel._invInertia02 * wheel._transform._rotation12; - __tmp__022 = wheel._invInertia00 * wheel._transform._rotation20 + wheel._invInertia01 * wheel._transform._rotation21 + wheel._invInertia02 * wheel._transform._rotation22; - __tmp__102 = wheel._invInertia10 * wheel._transform._rotation00 + wheel._invInertia11 * wheel._transform._rotation01 + wheel._invInertia12 * wheel._transform._rotation02; - __tmp__112 = wheel._invInertia10 * wheel._transform._rotation10 + wheel._invInertia11 * wheel._transform._rotation11 + wheel._invInertia12 * wheel._transform._rotation12; - __tmp__122 = wheel._invInertia10 * wheel._transform._rotation20 + wheel._invInertia11 * wheel._transform._rotation21 + wheel._invInertia12 * wheel._transform._rotation22; - __tmp__202 = wheel._invInertia20 * wheel._transform._rotation00 + wheel._invInertia21 * wheel._transform._rotation01 + wheel._invInertia22 * wheel._transform._rotation02; - __tmp__212 = wheel._invInertia20 * wheel._transform._rotation10 + wheel._invInertia21 * wheel._transform._rotation11 + wheel._invInertia22 * wheel._transform._rotation12; - __tmp__222 = wheel._invInertia20 * wheel._transform._rotation20 + wheel._invInertia21 * wheel._transform._rotation21 + wheel._invInertia22 * wheel._transform._rotation22; - wheel._invInertia00 = __tmp__002; - wheel._invInertia01 = __tmp__012; - wheel._invInertia02 = __tmp__022; - wheel._invInertia10 = __tmp__102; - wheel._invInertia11 = __tmp__112; - wheel._invInertia12 = __tmp__122; - wheel._invInertia20 = __tmp__202; - wheel._invInertia21 = __tmp__212; - wheel._invInertia22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = wheel._transform._rotation00 * wheel._invLocalInertia00 + wheel._transform._rotation01 * wheel._invLocalInertia10 + wheel._transform._rotation02 * wheel._invLocalInertia20; + __tmp__01 = wheel._transform._rotation00 * wheel._invLocalInertia01 + wheel._transform._rotation01 * wheel._invLocalInertia11 + wheel._transform._rotation02 * wheel._invLocalInertia21; + __tmp__02 = wheel._transform._rotation00 * wheel._invLocalInertia02 + wheel._transform._rotation01 * wheel._invLocalInertia12 + wheel._transform._rotation02 * wheel._invLocalInertia22; + __tmp__10 = wheel._transform._rotation10 * wheel._invLocalInertia00 + wheel._transform._rotation11 * wheel._invLocalInertia10 + wheel._transform._rotation12 * wheel._invLocalInertia20; + __tmp__11 = wheel._transform._rotation10 * wheel._invLocalInertia01 + wheel._transform._rotation11 * wheel._invLocalInertia11 + wheel._transform._rotation12 * wheel._invLocalInertia21; + __tmp__12 = wheel._transform._rotation10 * wheel._invLocalInertia02 + wheel._transform._rotation11 * wheel._invLocalInertia12 + wheel._transform._rotation12 * wheel._invLocalInertia22; + __tmp__20 = wheel._transform._rotation20 * wheel._invLocalInertia00 + wheel._transform._rotation21 * wheel._invLocalInertia10 + wheel._transform._rotation22 * wheel._invLocalInertia20; + __tmp__21 = wheel._transform._rotation20 * wheel._invLocalInertia01 + wheel._transform._rotation21 * wheel._invLocalInertia11 + wheel._transform._rotation22 * wheel._invLocalInertia21; + __tmp__22 = wheel._transform._rotation20 * wheel._invLocalInertia02 + wheel._transform._rotation21 * wheel._invLocalInertia12 + wheel._transform._rotation22 * wheel._invLocalInertia22; + wheel._invInertia00 = __tmp__00; + wheel._invInertia01 = __tmp__01; + wheel._invInertia02 = __tmp__02; + wheel._invInertia10 = __tmp__10; + wheel._invInertia11 = __tmp__11; + wheel._invInertia12 = __tmp__12; + wheel._invInertia20 = __tmp__20; + wheel._invInertia21 = __tmp__21; + wheel._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = wheel._invInertia00 * wheel._transform._rotation00 + wheel._invInertia01 * wheel._transform._rotation01 + wheel._invInertia02 * wheel._transform._rotation02; + __tmp__01 = wheel._invInertia00 * wheel._transform._rotation10 + wheel._invInertia01 * wheel._transform._rotation11 + wheel._invInertia02 * wheel._transform._rotation12; + __tmp__02 = wheel._invInertia00 * wheel._transform._rotation20 + wheel._invInertia01 * wheel._transform._rotation21 + wheel._invInertia02 * wheel._transform._rotation22; + __tmp__10 = wheel._invInertia10 * wheel._transform._rotation00 + wheel._invInertia11 * wheel._transform._rotation01 + wheel._invInertia12 * wheel._transform._rotation02; + __tmp__11 = wheel._invInertia10 * wheel._transform._rotation10 + wheel._invInertia11 * wheel._transform._rotation11 + wheel._invInertia12 * wheel._transform._rotation12; + __tmp__12 = wheel._invInertia10 * wheel._transform._rotation20 + wheel._invInertia11 * wheel._transform._rotation21 + wheel._invInertia12 * wheel._transform._rotation22; + __tmp__20 = wheel._invInertia20 * wheel._transform._rotation00 + wheel._invInertia21 * wheel._transform._rotation01 + wheel._invInertia22 * wheel._transform._rotation02; + __tmp__21 = wheel._invInertia20 * wheel._transform._rotation10 + wheel._invInertia21 * wheel._transform._rotation11 + wheel._invInertia22 * wheel._transform._rotation12; + __tmp__22 = wheel._invInertia20 * wheel._transform._rotation20 + wheel._invInertia21 * wheel._transform._rotation21 + wheel._invInertia22 * wheel._transform._rotation22; + wheel._invInertia00 = __tmp__00; + wheel._invInertia01 = __tmp__01; + wheel._invInertia02 = __tmp__02; + wheel._invInertia10 = __tmp__10; + wheel._invInertia11 = __tmp__11; + wheel._invInertia12 = __tmp__12; + wheel._invInertia20 = __tmp__20; + wheel._invInertia21 = __tmp__21; + wheel._invInertia22 = __tmp__22; wheel._invInertia00 *= wheel._rotFactor.x; wheel._invInertia01 *= wheel._rotFactor.x; wheel._invInertia02 *= wheel._rotFactor.x; @@ -5299,270 +5292,270 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s2 = wheel._shapeList; - while(s2 != null) { - var n = s2._next; + var s = wheel._shapeList; + while(s != null) { + var n = s._next; var tf1 = wheel._ptransform; var tf2 = wheel._transform; - var dst1 = s2._ptransform; - var src1 = s2._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s2._transform; - var src11 = s2._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; var maxX; var maxY; var maxZ; - s2._geom._computeAabb(s2._aabb,s2._ptransform); - minX = s2._aabb._minX; - minY = s2._aabb._minY; - minZ = s2._aabb._minZ; - maxX = s2._aabb._maxX; - maxY = s2._aabb._maxY; - maxZ = s2._aabb._maxZ; - s2._geom._computeAabb(s2._aabb,s2._transform); - s2._aabb._minX = minX < s2._aabb._minX ? minX : s2._aabb._minX; - s2._aabb._minY = minY < s2._aabb._minY ? minY : s2._aabb._minY; - s2._aabb._minZ = minZ < s2._aabb._minZ ? minZ : s2._aabb._minZ; - s2._aabb._maxX = maxX > s2._aabb._maxX ? maxX : s2._aabb._maxX; - s2._aabb._maxY = maxY > s2._aabb._maxY ? maxY : s2._aabb._maxY; - s2._aabb._maxZ = maxZ > s2._aabb._maxZ ? maxZ : s2._aabb._maxZ; - if(s2._proxy != null) { + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s2._transform._positionX - s2._ptransform._positionX; - dY = s2._transform._positionY - s2._ptransform._positionY; - dZ = s2._transform._positionZ - s2._ptransform._positionZ; - var v = s2.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s2 = n; + s = n; } wheel._sleeping = false; wheel._sleepTime = 0; var fixture = demo_common_OimoUtil.addCylinder(this.world,center,0.1,thickness * 0.52,true); - var m_e001 = 1; - var m_e011 = 0; - var m_e021 = 0; - var m_e101 = 0; - var m_e111 = 1; - var m_e121 = 0; - var m_e201 = 0; - var m_e211 = 0; - var m_e221 = 1; + var m_e00 = 1; + var m_e01 = 0; + var m_e02 = 0; + var m_e10 = 0; + var m_e11 = 1; + var m_e12 = 0; + var m_e20 = 0; + var m_e21 = 0; + var m_e22 = 1; oimo_common_Mat3.numCreations++; - var s3 = Math.sin(1.570796326794895); - var c3 = Math.cos(1.570796326794895); - var c12 = 1 - c3; - var r002 = c12 + c3; - var r012 = 0 * c12 - 0 * s3; - var r022 = 0 * c12 + 0 * s3; - var r102 = 0 * c12 + 0 * s3; - var r112 = 0 * c12 + c3; - var r122 = 0 * c12 - s3; - var r202 = 0 * c12 - 0 * s3; - var r212 = 0 * c12 + s3; - var r222 = 0 * c12 + c3; - var e002 = m_e001 * r002 + m_e011 * r102 + m_e021 * r202; - var e013 = m_e001 * r012 + m_e011 * r112 + m_e021 * r212; - var e023 = m_e001 * r022 + m_e011 * r122 + m_e021 * r222; - var e102 = m_e101 * r002 + m_e111 * r102 + m_e121 * r202; - var e113 = m_e101 * r012 + m_e111 * r112 + m_e121 * r212; - var e123 = m_e101 * r022 + m_e111 * r122 + m_e121 * r222; - var e202 = m_e201 * r002 + m_e211 * r102 + m_e221 * r202; - var e213 = m_e201 * r012 + m_e211 * r112 + m_e221 * r212; - var e223 = m_e201 * r022 + m_e211 * r122 + m_e221 * r222; - m_e001 = e002; - m_e011 = e013; - m_e021 = e023; - m_e101 = e102; - m_e111 = e113; - m_e121 = e123; - m_e201 = e202; - m_e211 = e213; - m_e221 = e223; - var rot001; - var rot011; - var rot021; - var rot101; - var rot111; - var rot121; - var rot201; - var rot211; - var rot221; - rot001 = e002; - rot011 = e013; - rot021 = e023; - rot101 = e102; - rot111 = e113; - rot121 = e123; - rot201 = e202; - rot211 = e213; - rot221 = e223; - var __tmp__005; - var __tmp__015; - var __tmp__025; - var __tmp__105; - var __tmp__115; - var __tmp__125; - var __tmp__205; - var __tmp__215; - var __tmp__225; - __tmp__005 = rot001 * fixture._transform._rotation00 + rot011 * fixture._transform._rotation10 + rot021 * fixture._transform._rotation20; - __tmp__015 = rot001 * fixture._transform._rotation01 + rot011 * fixture._transform._rotation11 + rot021 * fixture._transform._rotation21; - __tmp__025 = rot001 * fixture._transform._rotation02 + rot011 * fixture._transform._rotation12 + rot021 * fixture._transform._rotation22; - __tmp__105 = rot101 * fixture._transform._rotation00 + rot111 * fixture._transform._rotation10 + rot121 * fixture._transform._rotation20; - __tmp__115 = rot101 * fixture._transform._rotation01 + rot111 * fixture._transform._rotation11 + rot121 * fixture._transform._rotation21; - __tmp__125 = rot101 * fixture._transform._rotation02 + rot111 * fixture._transform._rotation12 + rot121 * fixture._transform._rotation22; - __tmp__205 = rot201 * fixture._transform._rotation00 + rot211 * fixture._transform._rotation10 + rot221 * fixture._transform._rotation20; - __tmp__215 = rot201 * fixture._transform._rotation01 + rot211 * fixture._transform._rotation11 + rot221 * fixture._transform._rotation21; - __tmp__225 = rot201 * fixture._transform._rotation02 + rot211 * fixture._transform._rotation12 + rot221 * fixture._transform._rotation22; - fixture._transform._rotation00 = __tmp__005; - fixture._transform._rotation01 = __tmp__015; - fixture._transform._rotation02 = __tmp__025; - fixture._transform._rotation10 = __tmp__105; - fixture._transform._rotation11 = __tmp__115; - fixture._transform._rotation12 = __tmp__125; - fixture._transform._rotation20 = __tmp__205; - fixture._transform._rotation21 = __tmp__215; - fixture._transform._rotation22 = __tmp__225; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = fixture._transform._rotation00 * fixture._invLocalInertia00 + fixture._transform._rotation01 * fixture._invLocalInertia10 + fixture._transform._rotation02 * fixture._invLocalInertia20; - __tmp__016 = fixture._transform._rotation00 * fixture._invLocalInertia01 + fixture._transform._rotation01 * fixture._invLocalInertia11 + fixture._transform._rotation02 * fixture._invLocalInertia21; - __tmp__026 = fixture._transform._rotation00 * fixture._invLocalInertia02 + fixture._transform._rotation01 * fixture._invLocalInertia12 + fixture._transform._rotation02 * fixture._invLocalInertia22; - __tmp__106 = fixture._transform._rotation10 * fixture._invLocalInertia00 + fixture._transform._rotation11 * fixture._invLocalInertia10 + fixture._transform._rotation12 * fixture._invLocalInertia20; - __tmp__116 = fixture._transform._rotation10 * fixture._invLocalInertia01 + fixture._transform._rotation11 * fixture._invLocalInertia11 + fixture._transform._rotation12 * fixture._invLocalInertia21; - __tmp__126 = fixture._transform._rotation10 * fixture._invLocalInertia02 + fixture._transform._rotation11 * fixture._invLocalInertia12 + fixture._transform._rotation12 * fixture._invLocalInertia22; - __tmp__206 = fixture._transform._rotation20 * fixture._invLocalInertia00 + fixture._transform._rotation21 * fixture._invLocalInertia10 + fixture._transform._rotation22 * fixture._invLocalInertia20; - __tmp__216 = fixture._transform._rotation20 * fixture._invLocalInertia01 + fixture._transform._rotation21 * fixture._invLocalInertia11 + fixture._transform._rotation22 * fixture._invLocalInertia21; - __tmp__226 = fixture._transform._rotation20 * fixture._invLocalInertia02 + fixture._transform._rotation21 * fixture._invLocalInertia12 + fixture._transform._rotation22 * fixture._invLocalInertia22; - fixture._invInertia00 = __tmp__006; - fixture._invInertia01 = __tmp__016; - fixture._invInertia02 = __tmp__026; - fixture._invInertia10 = __tmp__106; - fixture._invInertia11 = __tmp__116; - fixture._invInertia12 = __tmp__126; - fixture._invInertia20 = __tmp__206; - fixture._invInertia21 = __tmp__216; - fixture._invInertia22 = __tmp__226; - var __tmp__007; - var __tmp__017; - var __tmp__027; - var __tmp__107; - var __tmp__117; - var __tmp__127; - var __tmp__207; - var __tmp__217; - var __tmp__227; - __tmp__007 = fixture._invInertia00 * fixture._transform._rotation00 + fixture._invInertia01 * fixture._transform._rotation01 + fixture._invInertia02 * fixture._transform._rotation02; - __tmp__017 = fixture._invInertia00 * fixture._transform._rotation10 + fixture._invInertia01 * fixture._transform._rotation11 + fixture._invInertia02 * fixture._transform._rotation12; - __tmp__027 = fixture._invInertia00 * fixture._transform._rotation20 + fixture._invInertia01 * fixture._transform._rotation21 + fixture._invInertia02 * fixture._transform._rotation22; - __tmp__107 = fixture._invInertia10 * fixture._transform._rotation00 + fixture._invInertia11 * fixture._transform._rotation01 + fixture._invInertia12 * fixture._transform._rotation02; - __tmp__117 = fixture._invInertia10 * fixture._transform._rotation10 + fixture._invInertia11 * fixture._transform._rotation11 + fixture._invInertia12 * fixture._transform._rotation12; - __tmp__127 = fixture._invInertia10 * fixture._transform._rotation20 + fixture._invInertia11 * fixture._transform._rotation21 + fixture._invInertia12 * fixture._transform._rotation22; - __tmp__207 = fixture._invInertia20 * fixture._transform._rotation00 + fixture._invInertia21 * fixture._transform._rotation01 + fixture._invInertia22 * fixture._transform._rotation02; - __tmp__217 = fixture._invInertia20 * fixture._transform._rotation10 + fixture._invInertia21 * fixture._transform._rotation11 + fixture._invInertia22 * fixture._transform._rotation12; - __tmp__227 = fixture._invInertia20 * fixture._transform._rotation20 + fixture._invInertia21 * fixture._transform._rotation21 + fixture._invInertia22 * fixture._transform._rotation22; - fixture._invInertia00 = __tmp__007; - fixture._invInertia01 = __tmp__017; - fixture._invInertia02 = __tmp__027; - fixture._invInertia10 = __tmp__107; - fixture._invInertia11 = __tmp__117; - fixture._invInertia12 = __tmp__127; - fixture._invInertia20 = __tmp__207; - fixture._invInertia21 = __tmp__217; - fixture._invInertia22 = __tmp__227; + var s = Math.sin(1.570796326794895); + var c = Math.cos(1.570796326794895); + var c1 = 1 - c; + var r00 = c1 + c; + var r01 = 0 * c1 - 0 * s; + var r02 = 0 * c1 + 0 * s; + var r10 = 0 * c1 + 0 * s; + var r11 = 0 * c1 + c; + var r12 = 0 * c1 - s; + var r20 = 0 * c1 - 0 * s; + var r21 = 0 * c1 + s; + var r22 = 0 * c1 + c; + var e00 = m_e00 * r00 + m_e01 * r10 + m_e02 * r20; + var e01 = m_e00 * r01 + m_e01 * r11 + m_e02 * r21; + var e02 = m_e00 * r02 + m_e01 * r12 + m_e02 * r22; + var e10 = m_e10 * r00 + m_e11 * r10 + m_e12 * r20; + var e11 = m_e10 * r01 + m_e11 * r11 + m_e12 * r21; + var e12 = m_e10 * r02 + m_e11 * r12 + m_e12 * r22; + var e20 = m_e20 * r00 + m_e21 * r10 + m_e22 * r20; + var e21 = m_e20 * r01 + m_e21 * r11 + m_e22 * r21; + var e22 = m_e20 * r02 + m_e21 * r12 + m_e22 * r22; + m_e00 = e00; + m_e01 = e01; + m_e02 = e02; + m_e10 = e10; + m_e11 = e11; + m_e12 = e12; + m_e20 = e20; + m_e21 = e21; + m_e22 = e22; + var rot00; + var rot01; + var rot02; + var rot10; + var rot11; + var rot12; + var rot20; + var rot21; + var rot22; + rot00 = e00; + rot01 = e01; + rot02 = e02; + rot10 = e10; + rot11 = e11; + rot12 = e12; + rot20 = e20; + rot21 = e21; + rot22 = e22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * fixture._transform._rotation00 + rot01 * fixture._transform._rotation10 + rot02 * fixture._transform._rotation20; + __tmp__01 = rot00 * fixture._transform._rotation01 + rot01 * fixture._transform._rotation11 + rot02 * fixture._transform._rotation21; + __tmp__02 = rot00 * fixture._transform._rotation02 + rot01 * fixture._transform._rotation12 + rot02 * fixture._transform._rotation22; + __tmp__10 = rot10 * fixture._transform._rotation00 + rot11 * fixture._transform._rotation10 + rot12 * fixture._transform._rotation20; + __tmp__11 = rot10 * fixture._transform._rotation01 + rot11 * fixture._transform._rotation11 + rot12 * fixture._transform._rotation21; + __tmp__12 = rot10 * fixture._transform._rotation02 + rot11 * fixture._transform._rotation12 + rot12 * fixture._transform._rotation22; + __tmp__20 = rot20 * fixture._transform._rotation00 + rot21 * fixture._transform._rotation10 + rot22 * fixture._transform._rotation20; + __tmp__21 = rot20 * fixture._transform._rotation01 + rot21 * fixture._transform._rotation11 + rot22 * fixture._transform._rotation21; + __tmp__22 = rot20 * fixture._transform._rotation02 + rot21 * fixture._transform._rotation12 + rot22 * fixture._transform._rotation22; + fixture._transform._rotation00 = __tmp__00; + fixture._transform._rotation01 = __tmp__01; + fixture._transform._rotation02 = __tmp__02; + fixture._transform._rotation10 = __tmp__10; + fixture._transform._rotation11 = __tmp__11; + fixture._transform._rotation12 = __tmp__12; + fixture._transform._rotation20 = __tmp__20; + fixture._transform._rotation21 = __tmp__21; + fixture._transform._rotation22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = fixture._transform._rotation00 * fixture._invLocalInertia00 + fixture._transform._rotation01 * fixture._invLocalInertia10 + fixture._transform._rotation02 * fixture._invLocalInertia20; + __tmp__01 = fixture._transform._rotation00 * fixture._invLocalInertia01 + fixture._transform._rotation01 * fixture._invLocalInertia11 + fixture._transform._rotation02 * fixture._invLocalInertia21; + __tmp__02 = fixture._transform._rotation00 * fixture._invLocalInertia02 + fixture._transform._rotation01 * fixture._invLocalInertia12 + fixture._transform._rotation02 * fixture._invLocalInertia22; + __tmp__10 = fixture._transform._rotation10 * fixture._invLocalInertia00 + fixture._transform._rotation11 * fixture._invLocalInertia10 + fixture._transform._rotation12 * fixture._invLocalInertia20; + __tmp__11 = fixture._transform._rotation10 * fixture._invLocalInertia01 + fixture._transform._rotation11 * fixture._invLocalInertia11 + fixture._transform._rotation12 * fixture._invLocalInertia21; + __tmp__12 = fixture._transform._rotation10 * fixture._invLocalInertia02 + fixture._transform._rotation11 * fixture._invLocalInertia12 + fixture._transform._rotation12 * fixture._invLocalInertia22; + __tmp__20 = fixture._transform._rotation20 * fixture._invLocalInertia00 + fixture._transform._rotation21 * fixture._invLocalInertia10 + fixture._transform._rotation22 * fixture._invLocalInertia20; + __tmp__21 = fixture._transform._rotation20 * fixture._invLocalInertia01 + fixture._transform._rotation21 * fixture._invLocalInertia11 + fixture._transform._rotation22 * fixture._invLocalInertia21; + __tmp__22 = fixture._transform._rotation20 * fixture._invLocalInertia02 + fixture._transform._rotation21 * fixture._invLocalInertia12 + fixture._transform._rotation22 * fixture._invLocalInertia22; + fixture._invInertia00 = __tmp__00; + fixture._invInertia01 = __tmp__01; + fixture._invInertia02 = __tmp__02; + fixture._invInertia10 = __tmp__10; + fixture._invInertia11 = __tmp__11; + fixture._invInertia12 = __tmp__12; + fixture._invInertia20 = __tmp__20; + fixture._invInertia21 = __tmp__21; + fixture._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = fixture._invInertia00 * fixture._transform._rotation00 + fixture._invInertia01 * fixture._transform._rotation01 + fixture._invInertia02 * fixture._transform._rotation02; + __tmp__01 = fixture._invInertia00 * fixture._transform._rotation10 + fixture._invInertia01 * fixture._transform._rotation11 + fixture._invInertia02 * fixture._transform._rotation12; + __tmp__02 = fixture._invInertia00 * fixture._transform._rotation20 + fixture._invInertia01 * fixture._transform._rotation21 + fixture._invInertia02 * fixture._transform._rotation22; + __tmp__10 = fixture._invInertia10 * fixture._transform._rotation00 + fixture._invInertia11 * fixture._transform._rotation01 + fixture._invInertia12 * fixture._transform._rotation02; + __tmp__11 = fixture._invInertia10 * fixture._transform._rotation10 + fixture._invInertia11 * fixture._transform._rotation11 + fixture._invInertia12 * fixture._transform._rotation12; + __tmp__12 = fixture._invInertia10 * fixture._transform._rotation20 + fixture._invInertia11 * fixture._transform._rotation21 + fixture._invInertia12 * fixture._transform._rotation22; + __tmp__20 = fixture._invInertia20 * fixture._transform._rotation00 + fixture._invInertia21 * fixture._transform._rotation01 + fixture._invInertia22 * fixture._transform._rotation02; + __tmp__21 = fixture._invInertia20 * fixture._transform._rotation10 + fixture._invInertia21 * fixture._transform._rotation11 + fixture._invInertia22 * fixture._transform._rotation12; + __tmp__22 = fixture._invInertia20 * fixture._transform._rotation20 + fixture._invInertia21 * fixture._transform._rotation21 + fixture._invInertia22 * fixture._transform._rotation22; + fixture._invInertia00 = __tmp__00; + fixture._invInertia01 = __tmp__01; + fixture._invInertia02 = __tmp__02; + fixture._invInertia10 = __tmp__10; + fixture._invInertia11 = __tmp__11; + fixture._invInertia12 = __tmp__12; + fixture._invInertia20 = __tmp__20; + fixture._invInertia21 = __tmp__21; + fixture._invInertia22 = __tmp__22; fixture._invInertia00 *= fixture._rotFactor.x; fixture._invInertia01 *= fixture._rotFactor.x; fixture._invInertia02 *= fixture._rotFactor.x; @@ -5572,141 +5565,141 @@ demo_core_GearsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ fixture._invInertia20 *= fixture._rotFactor.z; fixture._invInertia21 *= fixture._rotFactor.z; fixture._invInertia22 *= fixture._rotFactor.z; - var dst3 = fixture._ptransform; - var src2 = fixture._transform; - dst3._positionX = src2._positionX; - dst3._positionY = src2._positionY; - dst3._positionZ = src2._positionZ; - dst3._rotation00 = src2._rotation00; - dst3._rotation01 = src2._rotation01; - dst3._rotation02 = src2._rotation02; - dst3._rotation10 = src2._rotation10; - dst3._rotation11 = src2._rotation11; - dst3._rotation12 = src2._rotation12; - dst3._rotation20 = src2._rotation20; - dst3._rotation21 = src2._rotation21; - dst3._rotation22 = src2._rotation22; - var s4 = fixture._shapeList; - while(s4 != null) { - var n1 = s4._next; - var tf11 = fixture._ptransform; - var tf21 = fixture._transform; - var dst4 = s4._ptransform; - var src12 = s4._localTransform; - var __tmp__008; - var __tmp__018; - var __tmp__028; - var __tmp__108; - var __tmp__118; - var __tmp__128; - var __tmp__208; - var __tmp__218; - var __tmp__228; - __tmp__008 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; - __tmp__018 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; - __tmp__028 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; - __tmp__108 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; - __tmp__118 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; - __tmp__128 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; - __tmp__208 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; - __tmp__218 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; - __tmp__228 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; - dst4._rotation00 = __tmp__008; - dst4._rotation01 = __tmp__018; - dst4._rotation02 = __tmp__028; - dst4._rotation10 = __tmp__108; - dst4._rotation11 = __tmp__118; - dst4._rotation12 = __tmp__128; - dst4._rotation20 = __tmp__208; - dst4._rotation21 = __tmp__218; - dst4._rotation22 = __tmp__228; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; - __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; - __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; - dst4._positionX = __tmp__X2; - dst4._positionY = __tmp__Y2; - dst4._positionZ = __tmp__Z2; - dst4._positionX += tf11._positionX; - dst4._positionY += tf11._positionY; - dst4._positionZ += tf11._positionZ; - var dst5 = s4._transform; - var src13 = s4._localTransform; - var __tmp__009; - var __tmp__019; - var __tmp__029; - var __tmp__109; - var __tmp__119; - var __tmp__129; - var __tmp__209; - var __tmp__219; - var __tmp__229; - __tmp__009 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; - __tmp__019 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; - __tmp__029 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; - __tmp__109 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; - __tmp__119 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; - __tmp__129 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; - __tmp__209 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; - __tmp__219 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; - __tmp__229 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; - dst5._rotation00 = __tmp__009; - dst5._rotation01 = __tmp__019; - dst5._rotation02 = __tmp__029; - dst5._rotation10 = __tmp__109; - dst5._rotation11 = __tmp__119; - dst5._rotation12 = __tmp__129; - dst5._rotation20 = __tmp__209; - dst5._rotation21 = __tmp__219; - dst5._rotation22 = __tmp__229; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; - __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; - __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; - dst5._positionX = __tmp__X3; - dst5._positionY = __tmp__Y3; - dst5._positionZ = __tmp__Z3; - dst5._positionX += tf21._positionX; - dst5._positionY += tf21._positionY; - dst5._positionZ += tf21._positionZ; - var minX1; - var minY1; - var minZ1; - var maxX1; - var maxY1; - var maxZ1; - s4._geom._computeAabb(s4._aabb,s4._ptransform); - minX1 = s4._aabb._minX; - minY1 = s4._aabb._minY; - minZ1 = s4._aabb._minZ; - maxX1 = s4._aabb._maxX; - maxY1 = s4._aabb._maxY; - maxZ1 = s4._aabb._maxZ; - s4._geom._computeAabb(s4._aabb,s4._transform); - s4._aabb._minX = minX1 < s4._aabb._minX ? minX1 : s4._aabb._minX; - s4._aabb._minY = minY1 < s4._aabb._minY ? minY1 : s4._aabb._minY; - s4._aabb._minZ = minZ1 < s4._aabb._minZ ? minZ1 : s4._aabb._minZ; - s4._aabb._maxX = maxX1 > s4._aabb._maxX ? maxX1 : s4._aabb._maxX; - s4._aabb._maxY = maxY1 > s4._aabb._maxY ? maxY1 : s4._aabb._maxY; - s4._aabb._maxZ = maxZ1 > s4._aabb._maxZ ? maxZ1 : s4._aabb._maxZ; - if(s4._proxy != null) { - var dX1; - var dY1; - var dZ1; - dX1 = s4._transform._positionX - s4._ptransform._positionX; - dY1 = s4._transform._positionY - s4._ptransform._positionY; - dZ1 = s4._transform._positionZ - s4._ptransform._positionZ; - var v1 = s4.displacement; - v1.x = dX1; - v1.y = dY1; - v1.z = dZ1; - s4._rigidBody._world._broadPhase.moveProxy(s4._proxy,s4._aabb,s4.displacement); - } - s4 = n1; + var dst = fixture._ptransform; + var src = fixture._transform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; + var s = fixture._shapeList; + while(s != null) { + var n = s._next; + var tf1 = fixture._ptransform; + var tf2 = fixture._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; } fixture._sleeping = false; fixture._sleepTime = 0; @@ -5784,13 +5777,13 @@ demo_core_JointsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ var y = 5; var z = 1; demo_common_OimoUtil.addPrismaticJoint(world,demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(x,y,z),0.1,true),demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(0.3,0.5,0.5),false),new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(1,1,0),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-1,1)); - var x1 = -2; - var y1 = 5; - var z1 = 1; - demo_common_OimoUtil.addCylindricalJoint(world,demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(x1,y1,z1),0.1,true),demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-2.31,y1,z1),new oimo_common_Vec3(0.3,0.5,0.5),false),new oimo_common_Vec3(x1,y1,z1),new oimo_common_Vec3(1,0,0),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-2,2),new oimo_dynamics_constraint_joint_SpringDamper().setSpring(4,0.7),new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-1,1)); - var x2 = -2; - var z2 = 3; - var b1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x2,4.,z2),new oimo_common_Vec3(0.2,0.2,0.2),true); + var x = -2; + var y = 5; + var z = 1; + demo_common_OimoUtil.addCylindricalJoint(world,demo_common_OimoUtil.addSphere(world,new oimo_common_Vec3(x,y,z),0.1,true),demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(-2.31,y,z),new oimo_common_Vec3(0.3,0.5,0.5),false),new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(1,0,0),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-2,2),new oimo_dynamics_constraint_joint_SpringDamper().setSpring(4,0.7),new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-1,1)); + var x = -2; + var z = 3; + var b1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,4.,z),new oimo_common_Vec3(0.2,0.2,0.2),true); b1.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); oimo_common_Vec3.numCreations++; if(b1._type == 1) { @@ -5804,49 +5797,49 @@ demo_core_JointsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ } b1._sleeping = false; b1._sleepTime = 0; - demo_common_OimoUtil.addRagdollJoint(world,b1,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x2,2.,z2),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x2,3,z2),new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),40,80,new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.570796326794895,1.570796326794895)); - var x3 = 2; - var z3 = 3; + demo_common_OimoUtil.addRagdollJoint(world,b1,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,2.,z),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x,3,z),new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),40,80,new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.570796326794895,1.570796326794895)); + var x = 2; + var z = 3; var hingeLimit1 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.7853981633974475,0.7853981633974475); var hingeLimit2 = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.2566370614359161,1.2566370614359161); - var b11 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x3,4.,z3),new oimo_common_Vec3(0.2,0.2,0.2),true); - b11.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); + var b1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,4.,z),new oimo_common_Vec3(0.2,0.2,0.2),true); + b1.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); oimo_common_Vec3.numCreations++; - if(b11._type == 1) { - b11._angVelX = 0; - b11._angVelY = 0; - b11._angVelZ = 0; + if(b1._type == 1) { + b1._angVelX = 0; + b1._angVelY = 0; + b1._angVelZ = 0; } else { - b11._angVelX = 0; - b11._angVelY = 1.5; - b11._angVelZ = 0; - } - b11._sleeping = false; - b11._sleepTime = 0; - demo_common_OimoUtil.addUniversalJoint(world,b11,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x3,2.,z3),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x3,3,z3),new oimo_common_Vec3(1,0,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit1,new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit2); - var x4 = 0; - var z4 = 3; + b1._angVelX = 0; + b1._angVelY = 1.5; + b1._angVelZ = 0; + } + b1._sleeping = false; + b1._sleepTime = 0; + demo_common_OimoUtil.addUniversalJoint(world,b1,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,2.,z),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x,3,z),new oimo_common_Vec3(1,0,0),new oimo_common_Vec3(0,0,1),new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit1,new oimo_dynamics_constraint_joint_SpringDamper(),hingeLimit2); + var x = 0; + var z = 3; var rotXLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.62831853071795807,0.62831853071795807); var rotYLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-0.31415926535897903,0.31415926535897903); var rotZLimit = new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(-1.2566370614359161,1.2566370614359161); var translXLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.2,0.2); var translYLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.3,0); var translZLimit = new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(-0.2,0.8); - var b12 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x4,4.,z4),new oimo_common_Vec3(0.2,0.2,0.2),true); - b12.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); + var b1 = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,4.,z),new oimo_common_Vec3(0.2,0.2,0.2),true); + b1.setType(oimo_dynamics_rigidbody_RigidBodyType.KINEMATIC); oimo_common_Vec3.numCreations++; - if(b12._type == 1) { - b12._angVelX = 0; - b12._angVelY = 0; - b12._angVelZ = 0; + if(b1._type == 1) { + b1._angVelX = 0; + b1._angVelY = 0; + b1._angVelZ = 0; } else { - b12._angVelX = 0; - b12._angVelY = 1.5; - b12._angVelZ = 0; + b1._angVelX = 0; + b1._angVelY = 1.5; + b1._angVelZ = 0; } - b12._sleeping = false; - b12._sleepTime = 0; - demo_common_OimoUtil.addGenericJoint(world,b12,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x4,2.,z4),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x4,3,z4),new oimo_common_Mat3(),new oimo_common_Mat3(),null,[translXLimit,translYLimit,translZLimit],null,[rotXLimit,rotYLimit,rotZLimit]); + b1._sleeping = false; + b1._sleepTime = 0; + demo_common_OimoUtil.addGenericJoint(world,b1,demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(x,2.,z),new oimo_common_Vec3(0.2,0.5,0.2),false),new oimo_common_Vec3(x,3,z),new oimo_common_Mat3(),new oimo_common_Mat3(),null,[translXLimit,translYLimit,translZLimit],null,[rotXLimit,rotYLimit,rotZLimit]); } ,createBoard: function(x,y,z,lm,sd) { var b1 = demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(x,y,z),new oimo_common_Vec3(0.1,0.1,0.1),true); @@ -5993,10 +5986,10 @@ demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ while(_g2 < 3) { var box = demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(j * 0.61,0.3 + i * 0.3 * 3,_g2++ * 0.61),new oimo_common_Vec3(0.3,0.3,0.3),false); oimo_common_Vec3.numCreations++; - var _this1 = box._rotFactor; - _this1.x = 0; - _this1.y = 0; - _this1.z = 0; + var _this = box._rotFactor; + _this.x = 0; + _this.y = 0; + _this.z = 0; var __tmp__00; var __tmp__01; var __tmp__02; @@ -6067,20 +6060,20 @@ demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ } var cylinder = demo_common_OimoUtil.addCylinder(world,new oimo_common_Vec3(0,8,0),1.0,0.3,false); var cylinderShape = cylinder._shapeList; - var _this2 = cylinderShape._localTransform; + var _this = cylinderShape._localTransform; var tf = new oimo_common_Transform(); - tf._positionX = _this2._positionX; - tf._positionY = _this2._positionY; - tf._positionZ = _this2._positionZ; - tf._rotation00 = _this2._rotation00; - tf._rotation01 = _this2._rotation01; - tf._rotation02 = _this2._rotation02; - tf._rotation10 = _this2._rotation10; - tf._rotation11 = _this2._rotation11; - tf._rotation12 = _this2._rotation12; - tf._rotation20 = _this2._rotation20; - tf._rotation21 = _this2._rotation21; - tf._rotation22 = _this2._rotation22; + tf._positionX = _this._positionX; + tf._positionY = _this._positionY; + tf._positionZ = _this._positionZ; + tf._rotation00 = _this._rotation00; + tf._rotation01 = _this._rotation01; + tf._rotation02 = _this._rotation02; + tf._rotation10 = _this._rotation10; + tf._rotation11 = _this._rotation11; + tf._rotation12 = _this._rotation12; + tf._rotation20 = _this._rotation20; + tf._rotation21 = _this._rotation21; + tf._rotation22 = _this._rotation22; var v_y = 0; var v_z = 0; oimo_common_Vec3.numCreations++; @@ -6108,83 +6101,83 @@ demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ rot20 = sx * sz - cx * cz * sy; rot21 = cz * sx + cx * sy * sz; rot22 = cx * cy; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = rot00 * tf._rotation00 + rot01 * tf._rotation10 + rot02 * tf._rotation20; - __tmp__012 = rot00 * tf._rotation01 + rot01 * tf._rotation11 + rot02 * tf._rotation21; - __tmp__022 = rot00 * tf._rotation02 + rot01 * tf._rotation12 + rot02 * tf._rotation22; - __tmp__102 = rot10 * tf._rotation00 + rot11 * tf._rotation10 + rot12 * tf._rotation20; - __tmp__112 = rot10 * tf._rotation01 + rot11 * tf._rotation11 + rot12 * tf._rotation21; - __tmp__122 = rot10 * tf._rotation02 + rot11 * tf._rotation12 + rot12 * tf._rotation22; - __tmp__202 = rot20 * tf._rotation00 + rot21 * tf._rotation10 + rot22 * tf._rotation20; - __tmp__212 = rot20 * tf._rotation01 + rot21 * tf._rotation11 + rot22 * tf._rotation21; - __tmp__222 = rot20 * tf._rotation02 + rot21 * tf._rotation12 + rot22 * tf._rotation22; - tf._rotation00 = __tmp__002; - tf._rotation01 = __tmp__012; - tf._rotation02 = __tmp__022; - tf._rotation10 = __tmp__102; - tf._rotation11 = __tmp__112; - tf._rotation12 = __tmp__122; - tf._rotation20 = __tmp__202; - tf._rotation21 = __tmp__212; - tf._rotation22 = __tmp__222; - var _this3 = cylinderShape._localTransform; - _this3._positionX = tf._positionX; - _this3._positionY = tf._positionY; - _this3._positionZ = tf._positionZ; - _this3._rotation00 = tf._rotation00; - _this3._rotation01 = tf._rotation01; - _this3._rotation02 = tf._rotation02; - _this3._rotation10 = tf._rotation10; - _this3._rotation11 = tf._rotation11; - _this3._rotation12 = tf._rotation12; - _this3._rotation20 = tf._rotation20; - _this3._rotation21 = tf._rotation21; - _this3._rotation22 = tf._rotation22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = rot00 * tf._rotation00 + rot01 * tf._rotation10 + rot02 * tf._rotation20; + __tmp__01 = rot00 * tf._rotation01 + rot01 * tf._rotation11 + rot02 * tf._rotation21; + __tmp__02 = rot00 * tf._rotation02 + rot01 * tf._rotation12 + rot02 * tf._rotation22; + __tmp__10 = rot10 * tf._rotation00 + rot11 * tf._rotation10 + rot12 * tf._rotation20; + __tmp__11 = rot10 * tf._rotation01 + rot11 * tf._rotation11 + rot12 * tf._rotation21; + __tmp__12 = rot10 * tf._rotation02 + rot11 * tf._rotation12 + rot12 * tf._rotation22; + __tmp__20 = rot20 * tf._rotation00 + rot21 * tf._rotation10 + rot22 * tf._rotation20; + __tmp__21 = rot20 * tf._rotation01 + rot21 * tf._rotation11 + rot22 * tf._rotation21; + __tmp__22 = rot20 * tf._rotation02 + rot21 * tf._rotation12 + rot22 * tf._rotation22; + tf._rotation00 = __tmp__00; + tf._rotation01 = __tmp__01; + tf._rotation02 = __tmp__02; + tf._rotation10 = __tmp__10; + tf._rotation11 = __tmp__11; + tf._rotation12 = __tmp__12; + tf._rotation20 = __tmp__20; + tf._rotation21 = __tmp__21; + tf._rotation22 = __tmp__22; + var _this = cylinderShape._localTransform; + _this._positionX = tf._positionX; + _this._positionY = tf._positionY; + _this._positionZ = tf._positionZ; + _this._rotation00 = tf._rotation00; + _this._rotation01 = tf._rotation01; + _this._rotation02 = tf._rotation02; + _this._rotation10 = tf._rotation10; + _this._rotation11 = tf._rotation11; + _this._rotation12 = tf._rotation12; + _this._rotation20 = tf._rotation20; + _this._rotation21 = tf._rotation21; + _this._rotation22 = tf._rotation22; if(cylinderShape._rigidBody != null) { - var _this4 = cylinderShape._rigidBody; - _this4.updateMass(); - var s = _this4._shapeList; + var _this = cylinderShape._rigidBody; + _this.updateMass(); + var s = _this._shapeList; while(s != null) { var n = s._next; - var tf1 = _this4._ptransform; - var tf2 = _this4._transform; + var tf1 = _this._ptransform; + var tf2 = _this._transform; var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst._rotation00 = __tmp__003; - dst._rotation01 = __tmp__013; - dst._rotation02 = __tmp__023; - dst._rotation10 = __tmp__103; - dst._rotation11 = __tmp__113; - dst._rotation12 = __tmp__123; - dst._rotation20 = __tmp__203; - dst._rotation21 = __tmp__213; - dst._rotation22 = __tmp__223; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -6199,50 +6192,50 @@ demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ dst._positionZ += tf1._positionZ; var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst1._rotation00 = __tmp__004; - dst1._rotation01 = __tmp__014; - dst1._rotation02 = __tmp__024; - dst1._rotation10 = __tmp__104; - dst1._rotation11 = __tmp__114; - dst1._rotation12 = __tmp__124; - dst1._rotation20 = __tmp__204; - dst1._rotation21 = __tmp__214; - dst1._rotation22 = __tmp__224; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; - __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; - __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst1._positionX = __tmp__X1; - dst1._positionY = __tmp__Y1; - dst1._positionZ = __tmp__Z1; - dst1._positionX += tf2._positionX; - dst1._positionY += tf2._positionY; - dst1._positionZ += tf2._positionZ; - var minX; - var minY; - var minZ; - var maxX; - var maxY; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; var maxZ; s._geom._computeAabb(s._aabb,s._ptransform); minX = s._aabb._minX; @@ -6275,64 +6268,64 @@ demo_core_LimitRotationDemo.prototype = $extend(demo_common_DemoBase.prototype,{ } } oimo_common_Vec3.numCreations++; - var _this5 = cylinder._rotFactor; - _this5.x = 0; - _this5.y = 0; - _this5.z = 1; - var __tmp__005; - var __tmp__015; - var __tmp__025; - var __tmp__105; - var __tmp__115; - var __tmp__125; - var __tmp__205; - var __tmp__215; - var __tmp__225; - __tmp__005 = cylinder._transform._rotation00 * cylinder._invLocalInertia00 + cylinder._transform._rotation01 * cylinder._invLocalInertia10 + cylinder._transform._rotation02 * cylinder._invLocalInertia20; - __tmp__015 = cylinder._transform._rotation00 * cylinder._invLocalInertia01 + cylinder._transform._rotation01 * cylinder._invLocalInertia11 + cylinder._transform._rotation02 * cylinder._invLocalInertia21; - __tmp__025 = cylinder._transform._rotation00 * cylinder._invLocalInertia02 + cylinder._transform._rotation01 * cylinder._invLocalInertia12 + cylinder._transform._rotation02 * cylinder._invLocalInertia22; - __tmp__105 = cylinder._transform._rotation10 * cylinder._invLocalInertia00 + cylinder._transform._rotation11 * cylinder._invLocalInertia10 + cylinder._transform._rotation12 * cylinder._invLocalInertia20; - __tmp__115 = cylinder._transform._rotation10 * cylinder._invLocalInertia01 + cylinder._transform._rotation11 * cylinder._invLocalInertia11 + cylinder._transform._rotation12 * cylinder._invLocalInertia21; - __tmp__125 = cylinder._transform._rotation10 * cylinder._invLocalInertia02 + cylinder._transform._rotation11 * cylinder._invLocalInertia12 + cylinder._transform._rotation12 * cylinder._invLocalInertia22; - __tmp__205 = cylinder._transform._rotation20 * cylinder._invLocalInertia00 + cylinder._transform._rotation21 * cylinder._invLocalInertia10 + cylinder._transform._rotation22 * cylinder._invLocalInertia20; - __tmp__215 = cylinder._transform._rotation20 * cylinder._invLocalInertia01 + cylinder._transform._rotation21 * cylinder._invLocalInertia11 + cylinder._transform._rotation22 * cylinder._invLocalInertia21; - __tmp__225 = cylinder._transform._rotation20 * cylinder._invLocalInertia02 + cylinder._transform._rotation21 * cylinder._invLocalInertia12 + cylinder._transform._rotation22 * cylinder._invLocalInertia22; - cylinder._invInertia00 = __tmp__005; - cylinder._invInertia01 = __tmp__015; - cylinder._invInertia02 = __tmp__025; - cylinder._invInertia10 = __tmp__105; - cylinder._invInertia11 = __tmp__115; - cylinder._invInertia12 = __tmp__125; - cylinder._invInertia20 = __tmp__205; - cylinder._invInertia21 = __tmp__215; - cylinder._invInertia22 = __tmp__225; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = cylinder._invInertia00 * cylinder._transform._rotation00 + cylinder._invInertia01 * cylinder._transform._rotation01 + cylinder._invInertia02 * cylinder._transform._rotation02; - __tmp__016 = cylinder._invInertia00 * cylinder._transform._rotation10 + cylinder._invInertia01 * cylinder._transform._rotation11 + cylinder._invInertia02 * cylinder._transform._rotation12; - __tmp__026 = cylinder._invInertia00 * cylinder._transform._rotation20 + cylinder._invInertia01 * cylinder._transform._rotation21 + cylinder._invInertia02 * cylinder._transform._rotation22; - __tmp__106 = cylinder._invInertia10 * cylinder._transform._rotation00 + cylinder._invInertia11 * cylinder._transform._rotation01 + cylinder._invInertia12 * cylinder._transform._rotation02; - __tmp__116 = cylinder._invInertia10 * cylinder._transform._rotation10 + cylinder._invInertia11 * cylinder._transform._rotation11 + cylinder._invInertia12 * cylinder._transform._rotation12; - __tmp__126 = cylinder._invInertia10 * cylinder._transform._rotation20 + cylinder._invInertia11 * cylinder._transform._rotation21 + cylinder._invInertia12 * cylinder._transform._rotation22; - __tmp__206 = cylinder._invInertia20 * cylinder._transform._rotation00 + cylinder._invInertia21 * cylinder._transform._rotation01 + cylinder._invInertia22 * cylinder._transform._rotation02; - __tmp__216 = cylinder._invInertia20 * cylinder._transform._rotation10 + cylinder._invInertia21 * cylinder._transform._rotation11 + cylinder._invInertia22 * cylinder._transform._rotation12; - __tmp__226 = cylinder._invInertia20 * cylinder._transform._rotation20 + cylinder._invInertia21 * cylinder._transform._rotation21 + cylinder._invInertia22 * cylinder._transform._rotation22; - cylinder._invInertia00 = __tmp__006; - cylinder._invInertia01 = __tmp__016; - cylinder._invInertia02 = __tmp__026; - cylinder._invInertia10 = __tmp__106; - cylinder._invInertia11 = __tmp__116; - cylinder._invInertia12 = __tmp__126; - cylinder._invInertia20 = __tmp__206; - cylinder._invInertia21 = __tmp__216; - cylinder._invInertia22 = __tmp__226; + var _this = cylinder._rotFactor; + _this.x = 0; + _this.y = 0; + _this.z = 1; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = cylinder._transform._rotation00 * cylinder._invLocalInertia00 + cylinder._transform._rotation01 * cylinder._invLocalInertia10 + cylinder._transform._rotation02 * cylinder._invLocalInertia20; + __tmp__01 = cylinder._transform._rotation00 * cylinder._invLocalInertia01 + cylinder._transform._rotation01 * cylinder._invLocalInertia11 + cylinder._transform._rotation02 * cylinder._invLocalInertia21; + __tmp__02 = cylinder._transform._rotation00 * cylinder._invLocalInertia02 + cylinder._transform._rotation01 * cylinder._invLocalInertia12 + cylinder._transform._rotation02 * cylinder._invLocalInertia22; + __tmp__10 = cylinder._transform._rotation10 * cylinder._invLocalInertia00 + cylinder._transform._rotation11 * cylinder._invLocalInertia10 + cylinder._transform._rotation12 * cylinder._invLocalInertia20; + __tmp__11 = cylinder._transform._rotation10 * cylinder._invLocalInertia01 + cylinder._transform._rotation11 * cylinder._invLocalInertia11 + cylinder._transform._rotation12 * cylinder._invLocalInertia21; + __tmp__12 = cylinder._transform._rotation10 * cylinder._invLocalInertia02 + cylinder._transform._rotation11 * cylinder._invLocalInertia12 + cylinder._transform._rotation12 * cylinder._invLocalInertia22; + __tmp__20 = cylinder._transform._rotation20 * cylinder._invLocalInertia00 + cylinder._transform._rotation21 * cylinder._invLocalInertia10 + cylinder._transform._rotation22 * cylinder._invLocalInertia20; + __tmp__21 = cylinder._transform._rotation20 * cylinder._invLocalInertia01 + cylinder._transform._rotation21 * cylinder._invLocalInertia11 + cylinder._transform._rotation22 * cylinder._invLocalInertia21; + __tmp__22 = cylinder._transform._rotation20 * cylinder._invLocalInertia02 + cylinder._transform._rotation21 * cylinder._invLocalInertia12 + cylinder._transform._rotation22 * cylinder._invLocalInertia22; + cylinder._invInertia00 = __tmp__00; + cylinder._invInertia01 = __tmp__01; + cylinder._invInertia02 = __tmp__02; + cylinder._invInertia10 = __tmp__10; + cylinder._invInertia11 = __tmp__11; + cylinder._invInertia12 = __tmp__12; + cylinder._invInertia20 = __tmp__20; + cylinder._invInertia21 = __tmp__21; + cylinder._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = cylinder._invInertia00 * cylinder._transform._rotation00 + cylinder._invInertia01 * cylinder._transform._rotation01 + cylinder._invInertia02 * cylinder._transform._rotation02; + __tmp__01 = cylinder._invInertia00 * cylinder._transform._rotation10 + cylinder._invInertia01 * cylinder._transform._rotation11 + cylinder._invInertia02 * cylinder._transform._rotation12; + __tmp__02 = cylinder._invInertia00 * cylinder._transform._rotation20 + cylinder._invInertia01 * cylinder._transform._rotation21 + cylinder._invInertia02 * cylinder._transform._rotation22; + __tmp__10 = cylinder._invInertia10 * cylinder._transform._rotation00 + cylinder._invInertia11 * cylinder._transform._rotation01 + cylinder._invInertia12 * cylinder._transform._rotation02; + __tmp__11 = cylinder._invInertia10 * cylinder._transform._rotation10 + cylinder._invInertia11 * cylinder._transform._rotation11 + cylinder._invInertia12 * cylinder._transform._rotation12; + __tmp__12 = cylinder._invInertia10 * cylinder._transform._rotation20 + cylinder._invInertia11 * cylinder._transform._rotation21 + cylinder._invInertia12 * cylinder._transform._rotation22; + __tmp__20 = cylinder._invInertia20 * cylinder._transform._rotation00 + cylinder._invInertia21 * cylinder._transform._rotation01 + cylinder._invInertia22 * cylinder._transform._rotation02; + __tmp__21 = cylinder._invInertia20 * cylinder._transform._rotation10 + cylinder._invInertia21 * cylinder._transform._rotation11 + cylinder._invInertia22 * cylinder._transform._rotation12; + __tmp__22 = cylinder._invInertia20 * cylinder._transform._rotation20 + cylinder._invInertia21 * cylinder._transform._rotation21 + cylinder._invInertia22 * cylinder._transform._rotation22; + cylinder._invInertia00 = __tmp__00; + cylinder._invInertia01 = __tmp__01; + cylinder._invInertia02 = __tmp__02; + cylinder._invInertia10 = __tmp__10; + cylinder._invInertia11 = __tmp__11; + cylinder._invInertia12 = __tmp__12; + cylinder._invInertia20 = __tmp__20; + cylinder._invInertia21 = __tmp__21; + cylinder._invInertia22 = __tmp__22; cylinder._invInertia00 *= cylinder._rotFactor.x; cylinder._invInertia01 *= cylinder._rotFactor.x; cylinder._invInertia02 *= cylinder._rotFactor.x; @@ -6405,7 +6398,7 @@ demo_core_RagdollDemo.prototype = $extend(demo_common_DemoBase.prototype,{ _this.e33 = 1; renderer.g.getDebugDraw().drawJointLimits = false; demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.2,0),new oimo_common_Vec3(6,0.2,6),true); - var tmp1 = oimo_common_Setting.defaultFriction; + var tmp = oimo_common_Setting.defaultFriction; oimo_common_Setting.defaultFriction = 0.5; demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,2,0)); demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,4,0)); @@ -6417,7 +6410,7 @@ demo_core_RagdollDemo.prototype = $extend(demo_common_DemoBase.prototype,{ demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,16,0)); demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,18,0)); demo_common_OimoUtil.addRagdoll(world,new oimo_common_Vec3(0,20,0)); - oimo_common_Setting.defaultFriction = tmp1; + oimo_common_Setting.defaultFriction = tmp; } ,update: function() { demo_common_DemoBase.prototype.update.call(this); @@ -6544,15 +6537,15 @@ var demo_core__$RayCastingDemo_LaserPointer = function(pos,world,color) { sc.geometry = new oimo_collision_geometry_CylinderGeometry(0.2,this.length); this.rb.addShape(new oimo_dynamics_rigidbody_Shape(sc)); this.w.addRigidBody(this.rb); - var _this1 = rc.position; + var _this = rc.position; var y = this.length; if(y == null) { y = 0; } oimo_common_Vec3.numCreations++; - _this1.x += 0; - _this1.y += y; - _this1.z += 0; + _this.x += 0; + _this.y += y; + _this.z += 0; rc.type = oimo_dynamics_rigidbody_RigidBodyType.STATIC; var fix = new oimo_dynamics_rigidbody_RigidBody(rc); sc.geometry = new oimo_collision_geometry_SphereGeometry(0.1); @@ -6560,18 +6553,18 @@ var demo_core__$RayCastingDemo_LaserPointer = function(pos,world,color) { this.w.addRigidBody(fix); var jc = new oimo_dynamics_constraint_joint_RagdollJointConfig(); var tmp = this.rb; - var _this2 = this.rb; + var _this = this.rb; var v = new oimo_common_Vec3(); - v.x = _this2._transform._positionX; - v.y = _this2._transform._positionY; - v.z = _this2._transform._positionZ; - var y1 = this.length; - if(y1 == null) { - y1 = 0; + v.x = _this._transform._positionX; + v.y = _this._transform._positionY; + v.z = _this._transform._positionZ; + var y = this.length; + if(y == null) { + y = 0; } oimo_common_Vec3.numCreations++; v.x += 0; - v.y += y1; + v.y += y; v.z += 0; jc.init(tmp,fix,v,new oimo_common_Vec3(0,1,0),new oimo_common_Vec3(1,0,0)); jc.twistLimitMotor.setLimits(0,0); @@ -6627,64 +6620,64 @@ demo_core__$RayCastingDemo_LaserPointer.prototype = { res.y = vY; res.z = vZ; var begin = res; - var y1 = -this.length - 20; - if(y1 == null) { - y1 = 0; + var y = -this.length - 20; + if(y == null) { + y = 0; } - var v_x1 = 0; - var v_y1 = y1; - var v_z1 = 0; + var v_x = 0; + var v_y = y; + var v_z = 0; oimo_common_Vec3.numCreations++; - var vX1; - var vY1; - var vZ1; - vX1 = v_x1; - vY1 = v_y1; - vZ1 = v_z1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf._rotation00 * v_x1 + tf._rotation01 * v_y1 + tf._rotation02 * v_z1; - __tmp__Y1 = tf._rotation10 * v_x1 + tf._rotation11 * v_y1 + tf._rotation12 * v_z1; - __tmp__Z1 = tf._rotation20 * v_x1 + tf._rotation21 * v_y1 + tf._rotation22 * v_z1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - vX1 += tf._positionX; - vY1 += tf._positionY; - vZ1 += tf._positionZ; - var res1 = new oimo_common_Vec3(); - res1.x = vX1; - res1.y = vY1; - res1.z = vZ1; - var end = res1; + var vX; + var vY; + var vZ; + vX = v_x; + vY = v_y; + vZ = v_z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * v_x + tf._rotation01 * v_y + tf._rotation02 * v_z; + __tmp__Y = tf._rotation10 * v_x + tf._rotation11 * v_y + tf._rotation12 * v_z; + __tmp__Z = tf._rotation20 * v_x + tf._rotation21 * v_y + tf._rotation22 * v_z; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + vX += tf._positionX; + vY += tf._positionY; + vZ += tf._positionZ; + var res = new oimo_common_Vec3(); + res.x = vX; + res.y = vY; + res.z = vZ; + var end = res; var _g = 0; while(_g < 3) { ++_g; - var _this1 = this.cb; - _this1.shape = null; - _this1.fraction = 1; - _this1.position.zero(); - _this1.normal.zero(); - _this1.hit = false; + var _this = this.cb; + _this.shape = null; + _this.fraction = 1; + _this.position.zero(); + _this.normal.zero(); + _this.hit = false; this.w.rayCast(begin,end,this.cb); if(this.cb.hit) { dd.line(begin,this.cb.position,this.color); dd.point(this.cb.position,this.color); var x = end.x - begin.x; - var y2 = end.y - begin.y; + var y = end.y - begin.y; var z = end.z - begin.z; if(z == null) { z = 0; } - if(y2 == null) { - y2 = 0; + if(y == null) { + y = 0; } if(x == null) { x = 0; } var _this_x = x; - var _this_y = y2; + var _this_y = y; var _this_z = z; oimo_common_Vec3.numCreations++; var invLen = Math.sqrt(_this_x * _this_x + _this_y * _this_y + _this_z * _this_z); @@ -6692,42 +6685,42 @@ demo_core__$RayCastingDemo_LaserPointer.prototype = { invLen = 1 / invLen; } var x1 = _this_x * invLen; - var y3 = _this_y * invLen; + var y1 = _this_y * invLen; var z1 = _this_z * invLen; if(z1 == null) { z1 = 0; } - if(y3 == null) { - y3 = 0; + if(y1 == null) { + y1 = 0; } if(x1 == null) { x1 = 0; } var dir_x = x1; - var dir_y = y3; + var dir_y = y1; var dir_z = z1; oimo_common_Vec3.numCreations++; var v = this.cb.normal; - var _this2 = this.cb.normal; - var s = -2 * (_this2.x * dir_x + _this2.y * dir_y + _this2.z * dir_z); + var _this1 = this.cb.normal; + var s = -2 * (_this1.x * dir_x + _this1.y * dir_y + _this1.z * dir_z); var x2 = dir_x + v.x * s; - var y4 = dir_y + v.y * s; + var y2 = dir_y + v.y * s; var z2 = dir_z + v.z * s; if(z2 == null) { z2 = 0; } - if(y4 == null) { - y4 = 0; + if(y2 == null) { + y2 = 0; } if(x2 == null) { x2 = 0; } oimo_common_Vec3.numCreations++; - var _this3 = this.cb.position; + var _this2 = this.cb.position; var v1 = this.cb.normal; - begin = new oimo_common_Vec3(_this3.x + v1.x * 0.01,_this3.y + v1.y * 0.01,_this3.z + v1.z * 0.01); - var _this4 = this.cb.position; - end = new oimo_common_Vec3(_this4.x + x2 * 20,_this4.y + y4 * 20,_this4.z + z2 * 20); + begin = new oimo_common_Vec3(_this2.x + v1.x * 0.01,_this2.y + v1.y * 0.01,_this2.z + v1.z * 0.01); + var _this3 = this.cb.position; + end = new oimo_common_Vec3(_this3.x + x2 * 20,_this3.y + y2 * 20,_this3.z + z2 * 20); } else { dd.line(begin,end,this.color); break; @@ -6787,51 +6780,51 @@ demo_core_SpringsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ _this.e31 = 0; _this.e32 = 0; _this.e33 = 1; - var _this1 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this1.x *= 2; - _this1.y *= 2; - _this1.z *= 0.1; + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 2; + _this.y *= 2; + _this.z *= 0.1; oimo_common_Vec3.numCreations++; - _this1.x += 0; - _this1.y += 8; - _this1.z += 0; - demo_common_OimoUtil.addSphere(world,_this1,0.6,false); - var _this2 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this2.x *= 2; - _this2.y *= 2; - _this2.z *= 0.1; + _this.x += 0; + _this.y += 8; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.6,false); + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 2; + _this.y *= 2; + _this.z *= 0.1; oimo_common_Vec3.numCreations++; - _this2.x += 0; - _this2.y += 8; - _this2.z += 0; - demo_common_OimoUtil.addSphere(world,_this2,0.6,false); - var _this3 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this3.x *= 2; - _this3.y *= 2; - _this3.z *= 0.1; + _this.x += 0; + _this.y += 8; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.6,false); + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 2; + _this.y *= 2; + _this.z *= 0.1; oimo_common_Vec3.numCreations++; - _this3.x += 0; - _this3.y += 8; - _this3.z += 0; - demo_common_OimoUtil.addSphere(world,_this3,0.6,false); - var _this4 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this4.x *= 2; - _this4.y *= 2; - _this4.z *= 0.1; + _this.x += 0; + _this.y += 8; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.6,false); + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 2; + _this.y *= 2; + _this.z *= 0.1; oimo_common_Vec3.numCreations++; - _this4.x += 0; - _this4.y += 8; - _this4.z += 0; - demo_common_OimoUtil.addSphere(world,_this4,0.6,false); - var _this5 = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); - _this5.x *= 2; - _this5.y *= 2; - _this5.z *= 0.1; + _this.x += 0; + _this.y += 8; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.6,false); + var _this = new oimo_common_Vec3(-1 + Math.random() * 2,-1 + Math.random() * 2,-1 + Math.random() * 2); + _this.x *= 2; + _this.y *= 2; + _this.z *= 0.1; oimo_common_Vec3.numCreations++; - _this5.x += 0; - _this5.y += 8; - _this5.z += 0; - demo_common_OimoUtil.addSphere(world,_this5,0.6,false); + _this.x += 0; + _this.y += 8; + _this.z += 0; + demo_common_OimoUtil.addSphere(world,_this,0.6,false); this.addSpringyBoard(new oimo_common_Vec3(-3,3,0),1,8); this.addSpringyBoard(new oimo_common_Vec3(3,3,0),-1,8); this.addSpringyBoard(new oimo_common_Vec3(-3,4,0),1,8); @@ -6854,11 +6847,11 @@ demo_core_SpringsDemo.prototype = $extend(demo_common_DemoBase.prototype,{ oimo_common_Vec3.numCreations++; bodies.push(demo_common_OimoUtil.addBox(this.world,new oimo_common_Vec3(at.x + x,at.y + 0,at.z + 0),new oimo_common_Vec3(0.2,0.1,0.4),i == 0)); } - var _g2 = 1; - while(_g2 < num) { - var i1 = _g2++; - var b1 = bodies[i1 - 1]; - var b2 = bodies[i1]; + var _g = 1; + while(_g < num) { + var i = _g++; + var b1 = bodies[i - 1]; + var b2 = bodies[i]; var v = new oimo_common_Vec3(); v.x = b1._transform._positionX; v.y = b1._transform._positionY; @@ -6996,13 +6989,13 @@ demo_core_VariableTimeStepDemo.prototype = $extend(demo_common_DemoBase.prototyp b._sleeping = false; b._sleepTime = 0; this.bullet = demo_common_OimoUtil.addCone(world,new oimo_common_Vec3(-150,3,0),0.42,0.44999999999999996,false); - var tmp1 = this.bullet; + var tmp = this.bullet; var sc = new oimo_dynamics_rigidbody_ShapeConfig(); oimo_common_Vec3.numCreations++; sc.geometry = new oimo_collision_geometry_BoxGeometry(new oimo_common_Vec3(0.12,0.3,0.12)); sc.position.y -= 0.75; - tmp1.addShape(new oimo_dynamics_rigidbody_Shape(sc)); - var _this1 = this.bullet; + tmp.addShape(new oimo_dynamics_rigidbody_Shape(sc)); + var _this = this.bullet; var _this_e00 = 1; var _this_e01 = 0; var _this_e02 = 0; @@ -7080,89 +7073,89 @@ demo_core_VariableTimeStepDemo.prototype = $extend(demo_common_DemoBase.prototyp var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = m_e00 * _this1._transform._rotation00 + m_e01 * _this1._transform._rotation10 + m_e02 * _this1._transform._rotation20; - __tmp__01 = m_e00 * _this1._transform._rotation01 + m_e01 * _this1._transform._rotation11 + m_e02 * _this1._transform._rotation21; - __tmp__02 = m_e00 * _this1._transform._rotation02 + m_e01 * _this1._transform._rotation12 + m_e02 * _this1._transform._rotation22; - __tmp__10 = m_e10 * _this1._transform._rotation00 + m_e11 * _this1._transform._rotation10 + m_e12 * _this1._transform._rotation20; - __tmp__11 = m_e10 * _this1._transform._rotation01 + m_e11 * _this1._transform._rotation11 + m_e12 * _this1._transform._rotation21; - __tmp__12 = m_e10 * _this1._transform._rotation02 + m_e11 * _this1._transform._rotation12 + m_e12 * _this1._transform._rotation22; - __tmp__20 = m_e20 * _this1._transform._rotation00 + m_e21 * _this1._transform._rotation10 + m_e22 * _this1._transform._rotation20; - __tmp__21 = m_e20 * _this1._transform._rotation01 + m_e21 * _this1._transform._rotation11 + m_e22 * _this1._transform._rotation21; - __tmp__22 = m_e20 * _this1._transform._rotation02 + m_e21 * _this1._transform._rotation12 + m_e22 * _this1._transform._rotation22; - _this1._transform._rotation00 = __tmp__00; - _this1._transform._rotation01 = __tmp__01; - _this1._transform._rotation02 = __tmp__02; - _this1._transform._rotation10 = __tmp__10; - _this1._transform._rotation11 = __tmp__11; - _this1._transform._rotation12 = __tmp__12; - _this1._transform._rotation20 = __tmp__20; - _this1._transform._rotation21 = __tmp__21; - _this1._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = _this1._transform._rotation00 * _this1._invLocalInertia00 + _this1._transform._rotation01 * _this1._invLocalInertia10 + _this1._transform._rotation02 * _this1._invLocalInertia20; - __tmp__011 = _this1._transform._rotation00 * _this1._invLocalInertia01 + _this1._transform._rotation01 * _this1._invLocalInertia11 + _this1._transform._rotation02 * _this1._invLocalInertia21; - __tmp__021 = _this1._transform._rotation00 * _this1._invLocalInertia02 + _this1._transform._rotation01 * _this1._invLocalInertia12 + _this1._transform._rotation02 * _this1._invLocalInertia22; - __tmp__101 = _this1._transform._rotation10 * _this1._invLocalInertia00 + _this1._transform._rotation11 * _this1._invLocalInertia10 + _this1._transform._rotation12 * _this1._invLocalInertia20; - __tmp__111 = _this1._transform._rotation10 * _this1._invLocalInertia01 + _this1._transform._rotation11 * _this1._invLocalInertia11 + _this1._transform._rotation12 * _this1._invLocalInertia21; - __tmp__121 = _this1._transform._rotation10 * _this1._invLocalInertia02 + _this1._transform._rotation11 * _this1._invLocalInertia12 + _this1._transform._rotation12 * _this1._invLocalInertia22; - __tmp__201 = _this1._transform._rotation20 * _this1._invLocalInertia00 + _this1._transform._rotation21 * _this1._invLocalInertia10 + _this1._transform._rotation22 * _this1._invLocalInertia20; - __tmp__211 = _this1._transform._rotation20 * _this1._invLocalInertia01 + _this1._transform._rotation21 * _this1._invLocalInertia11 + _this1._transform._rotation22 * _this1._invLocalInertia21; - __tmp__221 = _this1._transform._rotation20 * _this1._invLocalInertia02 + _this1._transform._rotation21 * _this1._invLocalInertia12 + _this1._transform._rotation22 * _this1._invLocalInertia22; - _this1._invInertia00 = __tmp__001; - _this1._invInertia01 = __tmp__011; - _this1._invInertia02 = __tmp__021; - _this1._invInertia10 = __tmp__101; - _this1._invInertia11 = __tmp__111; - _this1._invInertia12 = __tmp__121; - _this1._invInertia20 = __tmp__201; - _this1._invInertia21 = __tmp__211; - _this1._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = _this1._invInertia00 * _this1._transform._rotation00 + _this1._invInertia01 * _this1._transform._rotation01 + _this1._invInertia02 * _this1._transform._rotation02; - __tmp__012 = _this1._invInertia00 * _this1._transform._rotation10 + _this1._invInertia01 * _this1._transform._rotation11 + _this1._invInertia02 * _this1._transform._rotation12; - __tmp__022 = _this1._invInertia00 * _this1._transform._rotation20 + _this1._invInertia01 * _this1._transform._rotation21 + _this1._invInertia02 * _this1._transform._rotation22; - __tmp__102 = _this1._invInertia10 * _this1._transform._rotation00 + _this1._invInertia11 * _this1._transform._rotation01 + _this1._invInertia12 * _this1._transform._rotation02; - __tmp__112 = _this1._invInertia10 * _this1._transform._rotation10 + _this1._invInertia11 * _this1._transform._rotation11 + _this1._invInertia12 * _this1._transform._rotation12; - __tmp__122 = _this1._invInertia10 * _this1._transform._rotation20 + _this1._invInertia11 * _this1._transform._rotation21 + _this1._invInertia12 * _this1._transform._rotation22; - __tmp__202 = _this1._invInertia20 * _this1._transform._rotation00 + _this1._invInertia21 * _this1._transform._rotation01 + _this1._invInertia22 * _this1._transform._rotation02; - __tmp__212 = _this1._invInertia20 * _this1._transform._rotation10 + _this1._invInertia21 * _this1._transform._rotation11 + _this1._invInertia22 * _this1._transform._rotation12; - __tmp__222 = _this1._invInertia20 * _this1._transform._rotation20 + _this1._invInertia21 * _this1._transform._rotation21 + _this1._invInertia22 * _this1._transform._rotation22; - _this1._invInertia00 = __tmp__002; - _this1._invInertia01 = __tmp__012; - _this1._invInertia02 = __tmp__022; - _this1._invInertia10 = __tmp__102; - _this1._invInertia11 = __tmp__112; - _this1._invInertia12 = __tmp__122; - _this1._invInertia20 = __tmp__202; - _this1._invInertia21 = __tmp__212; - _this1._invInertia22 = __tmp__222; - _this1._invInertia00 *= _this1._rotFactor.x; - _this1._invInertia01 *= _this1._rotFactor.x; - _this1._invInertia02 *= _this1._rotFactor.x; - _this1._invInertia10 *= _this1._rotFactor.y; - _this1._invInertia11 *= _this1._rotFactor.y; - _this1._invInertia12 *= _this1._rotFactor.y; - _this1._invInertia20 *= _this1._rotFactor.z; - _this1._invInertia21 *= _this1._rotFactor.z; - _this1._invInertia22 *= _this1._rotFactor.z; - var dst = _this1._ptransform; - var src = _this1._transform; + __tmp__00 = m_e00 * _this._transform._rotation00 + m_e01 * _this._transform._rotation10 + m_e02 * _this._transform._rotation20; + __tmp__01 = m_e00 * _this._transform._rotation01 + m_e01 * _this._transform._rotation11 + m_e02 * _this._transform._rotation21; + __tmp__02 = m_e00 * _this._transform._rotation02 + m_e01 * _this._transform._rotation12 + m_e02 * _this._transform._rotation22; + __tmp__10 = m_e10 * _this._transform._rotation00 + m_e11 * _this._transform._rotation10 + m_e12 * _this._transform._rotation20; + __tmp__11 = m_e10 * _this._transform._rotation01 + m_e11 * _this._transform._rotation11 + m_e12 * _this._transform._rotation21; + __tmp__12 = m_e10 * _this._transform._rotation02 + m_e11 * _this._transform._rotation12 + m_e12 * _this._transform._rotation22; + __tmp__20 = m_e20 * _this._transform._rotation00 + m_e21 * _this._transform._rotation10 + m_e22 * _this._transform._rotation20; + __tmp__21 = m_e20 * _this._transform._rotation01 + m_e21 * _this._transform._rotation11 + m_e22 * _this._transform._rotation21; + __tmp__22 = m_e20 * _this._transform._rotation02 + m_e21 * _this._transform._rotation12 + m_e22 * _this._transform._rotation22; + _this._transform._rotation00 = __tmp__00; + _this._transform._rotation01 = __tmp__01; + _this._transform._rotation02 = __tmp__02; + _this._transform._rotation10 = __tmp__10; + _this._transform._rotation11 = __tmp__11; + _this._transform._rotation12 = __tmp__12; + _this._transform._rotation20 = __tmp__20; + _this._transform._rotation21 = __tmp__21; + _this._transform._rotation22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__01 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__02 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__10 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__11 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__12 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__20 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__21 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__22 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; + var dst = _this._ptransform; + var src = _this._transform; dst._positionX = src._positionX; dst._positionY = src._positionY; dst._positionZ = src._positionZ; @@ -7175,284 +7168,284 @@ demo_core_VariableTimeStepDemo.prototype = $extend(demo_common_DemoBase.prototyp dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var s1 = _this1._shapeList; - while(s1 != null) { - var n = s1._next; - var tf1 = _this1._ptransform; - var tf2 = _this1._transform; - var dst1 = s1._ptransform; - var src1 = s1._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; + var s = _this._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this._ptransform; + var tf2 = _this._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s1._transform; - var src11 = s1._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; var maxX; var maxY; var maxZ; - s1._geom._computeAabb(s1._aabb,s1._ptransform); - minX = s1._aabb._minX; - minY = s1._aabb._minY; - minZ = s1._aabb._minZ; - maxX = s1._aabb._maxX; - maxY = s1._aabb._maxY; - maxZ = s1._aabb._maxZ; - s1._geom._computeAabb(s1._aabb,s1._transform); - s1._aabb._minX = minX < s1._aabb._minX ? minX : s1._aabb._minX; - s1._aabb._minY = minY < s1._aabb._minY ? minY : s1._aabb._minY; - s1._aabb._minZ = minZ < s1._aabb._minZ ? minZ : s1._aabb._minZ; - s1._aabb._maxX = maxX > s1._aabb._maxX ? maxX : s1._aabb._maxX; - s1._aabb._maxY = maxY > s1._aabb._maxY ? maxY : s1._aabb._maxY; - s1._aabb._maxZ = maxZ > s1._aabb._maxZ ? maxZ : s1._aabb._maxZ; - if(s1._proxy != null) { + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { var dX; var dY; var dZ; - dX = s1._transform._positionX - s1._ptransform._positionX; - dY = s1._transform._positionY - s1._ptransform._positionY; - dZ = s1._transform._positionZ - s1._ptransform._positionZ; - var v = s1.displacement; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; v.x = dX; v.y = dY; v.z = dZ; - s1._rigidBody._world._broadPhase.moveProxy(s1._proxy,s1._aabb,s1.displacement); - } - s1 = n; - } - _this1._sleeping = false; - _this1._sleepTime = 0; - var _this2 = this.bullet._shapeList; - _this2._density = 50; - if(_this2._rigidBody != null) { - var _this3 = _this2._rigidBody; - _this3.updateMass(); - var s2 = _this3._shapeList; - while(s2 != null) { - var n1 = s2._next; - var tf11 = _this3._ptransform; - var tf21 = _this3._transform; - var dst3 = s2._ptransform; - var src12 = s2._localTransform; - var __tmp__005; - var __tmp__015; - var __tmp__025; - var __tmp__105; - var __tmp__115; - var __tmp__125; - var __tmp__205; - var __tmp__215; - var __tmp__225; - __tmp__005 = tf11._rotation00 * src12._rotation00 + tf11._rotation01 * src12._rotation10 + tf11._rotation02 * src12._rotation20; - __tmp__015 = tf11._rotation00 * src12._rotation01 + tf11._rotation01 * src12._rotation11 + tf11._rotation02 * src12._rotation21; - __tmp__025 = tf11._rotation00 * src12._rotation02 + tf11._rotation01 * src12._rotation12 + tf11._rotation02 * src12._rotation22; - __tmp__105 = tf11._rotation10 * src12._rotation00 + tf11._rotation11 * src12._rotation10 + tf11._rotation12 * src12._rotation20; - __tmp__115 = tf11._rotation10 * src12._rotation01 + tf11._rotation11 * src12._rotation11 + tf11._rotation12 * src12._rotation21; - __tmp__125 = tf11._rotation10 * src12._rotation02 + tf11._rotation11 * src12._rotation12 + tf11._rotation12 * src12._rotation22; - __tmp__205 = tf11._rotation20 * src12._rotation00 + tf11._rotation21 * src12._rotation10 + tf11._rotation22 * src12._rotation20; - __tmp__215 = tf11._rotation20 * src12._rotation01 + tf11._rotation21 * src12._rotation11 + tf11._rotation22 * src12._rotation21; - __tmp__225 = tf11._rotation20 * src12._rotation02 + tf11._rotation21 * src12._rotation12 + tf11._rotation22 * src12._rotation22; - dst3._rotation00 = __tmp__005; - dst3._rotation01 = __tmp__015; - dst3._rotation02 = __tmp__025; - dst3._rotation10 = __tmp__105; - dst3._rotation11 = __tmp__115; - dst3._rotation12 = __tmp__125; - dst3._rotation20 = __tmp__205; - dst3._rotation21 = __tmp__215; - dst3._rotation22 = __tmp__225; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf11._rotation00 * src12._positionX + tf11._rotation01 * src12._positionY + tf11._rotation02 * src12._positionZ; - __tmp__Y2 = tf11._rotation10 * src12._positionX + tf11._rotation11 * src12._positionY + tf11._rotation12 * src12._positionZ; - __tmp__Z2 = tf11._rotation20 * src12._positionX + tf11._rotation21 * src12._positionY + tf11._rotation22 * src12._positionZ; - dst3._positionX = __tmp__X2; - dst3._positionY = __tmp__Y2; - dst3._positionZ = __tmp__Z2; - dst3._positionX += tf11._positionX; - dst3._positionY += tf11._positionY; - dst3._positionZ += tf11._positionZ; - var dst4 = s2._transform; - var src13 = s2._localTransform; - var __tmp__006; - var __tmp__016; - var __tmp__026; - var __tmp__106; - var __tmp__116; - var __tmp__126; - var __tmp__206; - var __tmp__216; - var __tmp__226; - __tmp__006 = tf21._rotation00 * src13._rotation00 + tf21._rotation01 * src13._rotation10 + tf21._rotation02 * src13._rotation20; - __tmp__016 = tf21._rotation00 * src13._rotation01 + tf21._rotation01 * src13._rotation11 + tf21._rotation02 * src13._rotation21; - __tmp__026 = tf21._rotation00 * src13._rotation02 + tf21._rotation01 * src13._rotation12 + tf21._rotation02 * src13._rotation22; - __tmp__106 = tf21._rotation10 * src13._rotation00 + tf21._rotation11 * src13._rotation10 + tf21._rotation12 * src13._rotation20; - __tmp__116 = tf21._rotation10 * src13._rotation01 + tf21._rotation11 * src13._rotation11 + tf21._rotation12 * src13._rotation21; - __tmp__126 = tf21._rotation10 * src13._rotation02 + tf21._rotation11 * src13._rotation12 + tf21._rotation12 * src13._rotation22; - __tmp__206 = tf21._rotation20 * src13._rotation00 + tf21._rotation21 * src13._rotation10 + tf21._rotation22 * src13._rotation20; - __tmp__216 = tf21._rotation20 * src13._rotation01 + tf21._rotation21 * src13._rotation11 + tf21._rotation22 * src13._rotation21; - __tmp__226 = tf21._rotation20 * src13._rotation02 + tf21._rotation21 * src13._rotation12 + tf21._rotation22 * src13._rotation22; - dst4._rotation00 = __tmp__006; - dst4._rotation01 = __tmp__016; - dst4._rotation02 = __tmp__026; - dst4._rotation10 = __tmp__106; - dst4._rotation11 = __tmp__116; - dst4._rotation12 = __tmp__126; - dst4._rotation20 = __tmp__206; - dst4._rotation21 = __tmp__216; - dst4._rotation22 = __tmp__226; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf21._rotation00 * src13._positionX + tf21._rotation01 * src13._positionY + tf21._rotation02 * src13._positionZ; - __tmp__Y3 = tf21._rotation10 * src13._positionX + tf21._rotation11 * src13._positionY + tf21._rotation12 * src13._positionZ; - __tmp__Z3 = tf21._rotation20 * src13._positionX + tf21._rotation21 * src13._positionY + tf21._rotation22 * src13._positionZ; - dst4._positionX = __tmp__X3; - dst4._positionY = __tmp__Y3; - dst4._positionZ = __tmp__Z3; - dst4._positionX += tf21._positionX; - dst4._positionY += tf21._positionY; - dst4._positionZ += tf21._positionZ; - var minX1; - var minY1; - var minZ1; - var maxX1; - var maxY1; - var maxZ1; - s2._geom._computeAabb(s2._aabb,s2._ptransform); - minX1 = s2._aabb._minX; - minY1 = s2._aabb._minY; - minZ1 = s2._aabb._minZ; - maxX1 = s2._aabb._maxX; - maxY1 = s2._aabb._maxY; - maxZ1 = s2._aabb._maxZ; - s2._geom._computeAabb(s2._aabb,s2._transform); - s2._aabb._minX = minX1 < s2._aabb._minX ? minX1 : s2._aabb._minX; - s2._aabb._minY = minY1 < s2._aabb._minY ? minY1 : s2._aabb._minY; - s2._aabb._minZ = minZ1 < s2._aabb._minZ ? minZ1 : s2._aabb._minZ; - s2._aabb._maxX = maxX1 > s2._aabb._maxX ? maxX1 : s2._aabb._maxX; - s2._aabb._maxY = maxY1 > s2._aabb._maxY ? maxY1 : s2._aabb._maxY; - s2._aabb._maxZ = maxZ1 > s2._aabb._maxZ ? maxZ1 : s2._aabb._maxZ; - if(s2._proxy != null) { - var dX1; - var dY1; - var dZ1; - dX1 = s2._transform._positionX - s2._ptransform._positionX; - dY1 = s2._transform._positionY - s2._ptransform._positionY; - dZ1 = s2._transform._positionZ - s2._ptransform._positionZ; - var v1 = s2.displacement; - v1.x = dX1; - v1.y = dY1; - v1.z = dZ1; - s2._rigidBody._world._broadPhase.moveProxy(s2._proxy,s2._aabb,s2.displacement); - } - s2 = n1; - } - } - var _this4 = this.bullet; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + _this._sleeping = false; + _this._sleepTime = 0; + var _this = this.bullet._shapeList; + _this._density = 50; + if(_this._rigidBody != null) { + var _this1 = _this._rigidBody; + _this1.updateMass(); + var s = _this1._shapeList; + while(s != null) { + var n = s._next; + var tf1 = _this1._ptransform; + var tf2 = _this1._transform; + var dst = s._ptransform; + var src1 = s._localTransform; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; + var src11 = s._localTransform; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; + var minX; + var minY; + var minZ; + var maxX; + var maxY; + var maxZ; + s._geom._computeAabb(s._aabb,s._ptransform); + minX = s._aabb._minX; + minY = s._aabb._minY; + minZ = s._aabb._minZ; + maxX = s._aabb._maxX; + maxY = s._aabb._maxY; + maxZ = s._aabb._maxZ; + s._geom._computeAabb(s._aabb,s._transform); + s._aabb._minX = minX < s._aabb._minX ? minX : s._aabb._minX; + s._aabb._minY = minY < s._aabb._minY ? minY : s._aabb._minY; + s._aabb._minZ = minZ < s._aabb._minZ ? minZ : s._aabb._minZ; + s._aabb._maxX = maxX > s._aabb._maxX ? maxX : s._aabb._maxX; + s._aabb._maxY = maxY > s._aabb._maxY ? maxY : s._aabb._maxY; + s._aabb._maxZ = maxZ > s._aabb._maxZ ? maxZ : s._aabb._maxZ; + if(s._proxy != null) { + var dX; + var dY; + var dZ; + dX = s._transform._positionX - s._ptransform._positionX; + dY = s._transform._positionY - s._ptransform._positionY; + dZ = s._transform._positionZ - s._ptransform._positionZ; + var v = s.displacement; + v.x = dX; + v.y = dY; + v.z = dZ; + s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); + } + s = n; + } + } + var _this = this.bullet; oimo_common_Vec3.numCreations++; - if(_this4._type == 1) { - _this4._velX = 0; - _this4._velY = 0; - _this4._velZ = 0; + if(_this._type == 1) { + _this._velX = 0; + _this._velY = 0; + _this._velZ = 0; } else { - _this4._velX = 300; - _this4._velY = 0; - _this4._velZ = 0; + _this._velX = 300; + _this._velY = 0; + _this._velZ = 0; } - _this4._sleeping = false; - _this4._sleepTime = 0; - var _this5 = this.bullet; + _this._sleeping = false; + _this._sleepTime = 0; + var _this = this.bullet; oimo_common_Vec3.numCreations++; - if(_this5._type == 1) { - _this5._angVelX = 0; - _this5._angVelY = 0; - _this5._angVelZ = 0; + if(_this._type == 1) { + _this._angVelX = 0; + _this._angVelY = 0; + _this._angVelZ = 0; } else { - _this5._angVelX = 628.318530717958; - _this5._angVelY = 0; - _this5._angVelZ = 0; + _this._angVelX = 628.318530717958; + _this._angVelY = 0; + _this._angVelZ = 0; } - _this5._sleeping = false; - _this5._sleepTime = 0; + _this._sleeping = false; + _this._sleepTime = 0; } ,update: function() { var v_x = 0; @@ -7460,17 +7453,17 @@ demo_core_VariableTimeStepDemo.prototype = $extend(demo_common_DemoBase.prototyp v_x = this.bullet._transform._positionX; var x = 0 - v_x; var timeStep = (x > 0 ? x : -x) / 8000; - var v_x1 = 0; + var v_x = 0; oimo_common_Vec3.numCreations++; - v_x1 = this.bullet._transform._positionX; - if(v_x1 > 0) { + v_x = this.bullet._transform._positionX; + if(v_x > 0) { timeStep *= 10; } var maxTimeStep = 0.016666666666666666; - var v_x2 = 0; + var v_x = 0; oimo_common_Vec3.numCreations++; - v_x2 = this.bullet._transform._positionX; - if(v_x2 < -10) { + v_x = this.bullet._transform._positionX; + if(v_x < -10) { maxTimeStep = 0.0055555555555555558; } if(timeStep < 0.0001) { @@ -7537,16 +7530,16 @@ demo_core_VerticalStackingDemo.prototype = $extend(demo_common_DemoBase.prototyp _this.e33 = 1; demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(0,-0.5,0),new oimo_common_Vec3(10,0.5,6),true); var sp = 3; - var tmp1 = oimo_common_Setting.defaultRestitution; + var tmp = oimo_common_Setting.defaultRestitution; oimo_common_Setting.defaultRestitution = 0; var _g = -2; while(_g < 3) { var i = _g++; var _g1 = 0; - var _g11 = 6 + 2 * (i + 2); - while(_g1 < _g11) demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(i * sp + (-0.01 + Math.random() * 0.02),0.4 + _g1++ * 0.4 * 2.2,-0.01 + Math.random() * 0.02),new oimo_common_Vec3(0.4,0.4,0.4),false); + var _g2 = 6 + 2 * (i + 2); + while(_g1 < _g2) demo_common_OimoUtil.addBox(world,new oimo_common_Vec3(i * sp + (-0.01 + Math.random() * 0.02),0.4 + _g1++ * 0.4 * 2.2,-0.01 + Math.random() * 0.02),new oimo_common_Vec3(0.4,0.4,0.4),false); } - oimo_common_Setting.defaultRestitution = tmp1; + oimo_common_Setting.defaultRestitution = tmp; } ,update: function() { demo_common_DemoBase.prototype.update.call(this); @@ -7566,12 +7559,12 @@ demo_js_minilib_OMain.prototype = { this.frameCount = 0; this.setup(); if(this.__state != 1) { - throw new js__$Boot_HaxeError("call init()"); + throw haxe_Exception.thrown("call init()"); } this.__state = 2; var _gthis = this; if(this.__state != 2) { - throw new js__$Boot_HaxeError("invalid call"); + throw haxe_Exception.thrown("invalid call"); } var touchCount = 0; var firstTouchId = -1; @@ -7604,48 +7597,48 @@ demo_js_minilib_OMain.prototype = { } touchCount += e.changedTouches.length; }); - body.addEventListener("touchmove",function(e1) { - if(e1.cancelable) { - e1.preventDefault(); + body.addEventListener("touchmove",function(e) { + if(e.cancelable) { + e.preventDefault(); } - var _g2 = 0; - var _g11 = e1.touches.length; - while(_g2 < _g11) { - var touch1 = e1.touches[_g2++]; - if(touch1.identifier == firstTouchId) { - var tmp2 = touch1.clientX - elementX(); - _gthis.input._ntouchX = tmp2 * scalingRatio; - var tmp3 = touch1.clientY - elementY(); - _gthis.input._ntouchY = tmp3 * scalingRatio; + var _g = 0; + var _g1 = e.touches.length; + while(_g < _g1) { + var touch = e.touches[_g++]; + if(touch.identifier == firstTouchId) { + var tmp = touch.clientX - elementX(); + _gthis.input._ntouchX = tmp * scalingRatio; + var tmp1 = touch.clientY - elementY(); + _gthis.input._ntouchY = tmp1 * scalingRatio; } } }); - var touchend = function(e2) { - if(e2.cancelable) { - e2.preventDefault(); + var touchend = function(e) { + if(e.cancelable) { + e.preventDefault(); } - var _g3 = 0; - var _g12 = e2.changedTouches.length; - while(_g3 < _g12) { - var touch2 = e2.changedTouches[_g3++]; - if(touch2.identifier == firstTouchId) { + var _g = 0; + var _g1 = e.changedTouches.length; + while(_g < _g1) { + var touch = e.changedTouches[_g++]; + if(touch.identifier == firstTouchId) { firstTouchId = -1; - var touchend1 = touch2.clientX - elementX(); - _gthis.input._ntouchX = touchend1 * scalingRatio; - var touchend2 = touch2.clientY - elementY(); - _gthis.input._ntouchY = touchend2 * scalingRatio; + var touchend = touch.clientX - elementX(); + _gthis.input._ntouchX = touchend * scalingRatio; + var touchend1 = touch.clientY - elementY(); + _gthis.input._ntouchY = touchend1 * scalingRatio; _gthis.input._ntouch = false; } } - touchCount -= e2.changedTouches.length; + touchCount -= e.changedTouches.length; }; body.addEventListener("touchend",touchend); body.addEventListener("touchcancel",touchend); - body.addEventListener("mousedown",function(e3) { - if(e3.cancelable) { - e3.preventDefault(); + body.addEventListener("mousedown",function(e) { + if(e.cancelable) { + e.preventDefault(); } - switch(e3.button) { + switch(e.button) { case 0: _gthis.input._nmouseL = true; break; @@ -7653,16 +7646,16 @@ demo_js_minilib_OMain.prototype = { _gthis.input._nmouseR = true; break; } - var tmp4 = e3.clientX - elementX(); - _gthis.input._nmouseX = tmp4 * scalingRatio; - var tmp5 = e3.clientY - elementY(); - _gthis.input._nmouseY = tmp5 * scalingRatio; + var tmp = e.clientX - elementX(); + _gthis.input._nmouseX = tmp * scalingRatio; + var tmp = e.clientY - elementY(); + _gthis.input._nmouseY = tmp * scalingRatio; }); - body.addEventListener("mouseup",function(e4) { - if(e4.cancelable) { - e4.preventDefault(); + body.addEventListener("mouseup",function(e) { + if(e.cancelable) { + e.preventDefault(); } - switch(e4.button) { + switch(e.button) { case 0: _gthis.input._nmouseL = false; break; @@ -7670,21 +7663,21 @@ demo_js_minilib_OMain.prototype = { _gthis.input._nmouseR = false; break; } - var tmp6 = e4.clientX - elementX(); - _gthis.input._nmouseX = tmp6 * scalingRatio; - var tmp7 = e4.clientY - elementY(); - _gthis.input._nmouseY = tmp7 * scalingRatio; + var tmp = e.clientX - elementX(); + _gthis.input._nmouseX = tmp * scalingRatio; + var tmp = e.clientY - elementY(); + _gthis.input._nmouseY = tmp * scalingRatio; }); - body.addEventListener("mousemove",function(e5) { - if(e5.cancelable) { - e5.preventDefault(); - } - var tmp8 = e5.clientX - elementX(); - _gthis.input._nmouseX = tmp8 * scalingRatio; - var tmp9 = e5.clientY - elementY(); - _gthis.input._nmouseY = tmp9 * scalingRatio; + body.addEventListener("mousemove",function(e) { + if(e.cancelable) { + e.preventDefault(); + } + var tmp = e.clientX - elementX(); + _gthis.input._nmouseX = tmp * scalingRatio; + var tmp = e.clientY - elementY(); + _gthis.input._nmouseY = tmp * scalingRatio; }); - body.oncontextmenu = function(e6) { + body.oncontextmenu = function(e) { return false; }; this.__state = 3; @@ -7694,18 +7687,18 @@ demo_js_minilib_OMain.prototype = { _this.loop(); } ,setup: function() { - throw new js__$Boot_HaxeError("override this"); + throw haxe_Exception.thrown("override this"); } ,__loop: function() { if(this.__state != 3) { - throw new js__$Boot_HaxeError("invalid call"); + throw haxe_Exception.thrown("invalid call"); } this.frameCount++; this.input._update(); this.loop(); } ,loop: function() { - throw new js__$Boot_HaxeError("override this"); + throw haxe_Exception.thrown("override this"); } ,__class__: demo_js_minilib_OMain }; @@ -7722,7 +7715,7 @@ demo_js_DemoJS.__super__ = demo_js_minilib_OMain; demo_js_DemoJS.prototype = $extend(demo_js_minilib_OMain.prototype,{ setup: function() { if(this.__state != 0) { - throw new js__$Boot_HaxeError("invalid call"); + throw haxe_Exception.thrown("invalid call"); } this.__state = 1; var pixelRatio = window.devicePixelRatio; @@ -7762,8 +7755,8 @@ demo_js_DemoJS.prototype = $extend(demo_js_minilib_OMain.prototype,{ e.preventDefault(); } }); - window.document.addEventListener("keyup",function(e1) { - _gthis.test.keyReleased(e1.keyCode); + window.document.addEventListener("keyup",function(e) { + _gthis.test.keyReleased(e.keyCode); }); } ,initText: function() { @@ -7870,14 +7863,14 @@ var oimo_dynamics_common_DebugDraw = function() { this.tmpCircleVerts1 = new Array(8); this.tmpCircleVerts2 = new Array(8); this.tmpCircleNorms = new Array(8); - var _g2 = 0; - while(_g2 < 8) { - var i1 = _g2++; - this.circleCoords[i1] = new oimo_common_Vec3(Math.cos(i1 * 0.7853981633974475),0,-Math.sin(i1 * 0.7853981633974475)); - this.circleCoordsShift[i1] = new oimo_common_Vec3(Math.cos((i1 + 0.5) * 0.7853981633974475),0,-Math.sin((i1 + 0.5) * 0.7853981633974475)); - this.tmpCircleVerts1[i1] = new oimo_common_Vec3(); - this.tmpCircleVerts2[i1] = new oimo_common_Vec3(); - this.tmpCircleNorms[i1] = new oimo_common_Vec3(); + var _g = 0; + while(_g < 8) { + var i = _g++; + this.circleCoords[i] = new oimo_common_Vec3(Math.cos(i * 0.7853981633974475),0,-Math.sin(i * 0.7853981633974475)); + this.circleCoordsShift[i] = new oimo_common_Vec3(Math.cos((i + 0.5) * 0.7853981633974475),0,-Math.sin((i + 0.5) * 0.7853981633974475)); + this.tmpCircleVerts1[i] = new oimo_common_Vec3(); + this.tmpCircleVerts2[i] = new oimo_common_Vec3(); + this.tmpCircleNorms[i] = new oimo_common_Vec3(); } this.style = new oimo_dynamics_common_DebugDrawStyle(); }; @@ -7886,20 +7879,20 @@ oimo_dynamics_common_DebugDraw.prototype = { aabb: function(min,max,color) { var _this = this.p; var v1 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,min.z); - var _this1 = this.p; - var v2 = (_this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]).init(min.x,min.y,max.z); - var _this2 = this.p; - var v3 = (_this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]).init(min.x,max.y,min.z); - var _this3 = this.p; - var v4 = (_this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]).init(min.x,max.y,max.z); - var _this4 = this.p; - var v5 = (_this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]).init(max.x,min.y,min.z); - var _this5 = this.p; - var v6 = (_this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]).init(max.x,min.y,max.z); - var _this6 = this.p; - var v7 = (_this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]).init(max.x,max.y,min.z); - var _this7 = this.p; - var v8 = (_this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]).init(max.x,max.y,max.z); + var _this = this.p; + var v2 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,min.y,max.z); + var _this = this.p; + var v3 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,max.y,min.z); + var _this = this.p; + var v4 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(min.x,max.y,max.z); + var _this = this.p; + var v5 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(max.x,min.y,min.z); + var _this = this.p; + var v6 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(max.x,min.y,max.z); + var _this = this.p; + var v7 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(max.x,max.y,min.z); + var _this = this.p; + var v8 = (_this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]).init(max.x,max.y,max.z); this.line(v1,v2,color); this.line(v3,v4,color); this.line(v5,v6,color); @@ -7912,146 +7905,146 @@ oimo_dynamics_common_DebugDraw.prototype = { this.line(v2,v6,color); this.line(v3,v7,color); this.line(v4,v8,color); - var _this8 = this.p; + var _this = this.p; if(v1 != null) { v1.zero(); - if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray = new Array(_this8.sizeVec3 << 1); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); var _g = 0; - var _g1 = _this8.sizeVec3; + var _g1 = _this.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this8.stackVec3[i]; - _this8.stackVec3[i] = null; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this8.stackVec3 = newArray; + _this.stackVec3 = newArray; } - _this8.stackVec3[_this8.sizeVec3++] = v1; + _this.stackVec3[_this.sizeVec3++] = v1; } - var _this9 = this.p; + var _this = this.p; if(v2 != null) { v2.zero(); - if(_this9.sizeVec3 == _this9.stackVec3.length) { - var newArray1 = new Array(_this9.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this9.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this9.stackVec3[i1]; - _this9.stackVec3[i1] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this9.stackVec3 = newArray1; + _this.stackVec3 = newArray; } - _this9.stackVec3[_this9.sizeVec3++] = v2; + _this.stackVec3[_this.sizeVec3++] = v2; } - var _this10 = this.p; + var _this = this.p; if(v3 != null) { v3.zero(); - if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newArray2 = new Array(_this10.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this10.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this10.stackVec3[i2]; - _this10.stackVec3[i2] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this10.stackVec3 = newArray2; + _this.stackVec3 = newArray; } - _this10.stackVec3[_this10.sizeVec3++] = v3; + _this.stackVec3[_this.sizeVec3++] = v3; } - var _this11 = this.p; + var _this = this.p; if(v4 != null) { v4.zero(); - if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray3 = new Array(_this11.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this11.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this11.stackVec3[i3]; - _this11.stackVec3[i3] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this11.stackVec3 = newArray3; + _this.stackVec3 = newArray; } - _this11.stackVec3[_this11.sizeVec3++] = v4; + _this.stackVec3[_this.sizeVec3++] = v4; } - var _this12 = this.p; + var _this = this.p; if(v5 != null) { v5.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray4 = new Array(_this12.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this12.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this12.stackVec3[i4]; - _this12.stackVec3[i4] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this12.stackVec3 = newArray4; + _this.stackVec3 = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = v5; + _this.stackVec3[_this.sizeVec3++] = v5; } - var _this13 = this.p; + var _this = this.p; if(v6 != null) { v6.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newArray5 = new Array(_this13.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this13.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this13.stackVec3[i5]; - _this13.stackVec3[i5] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this13.stackVec3 = newArray5; + _this.stackVec3 = newArray; } - _this13.stackVec3[_this13.sizeVec3++] = v6; + _this.stackVec3[_this.sizeVec3++] = v6; } - var _this14 = this.p; + var _this = this.p; if(v7 != null) { v7.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray6 = new Array(_this14.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this14.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this14.stackVec3[i6]; - _this14.stackVec3[i6] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this14.stackVec3 = newArray6; + _this.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = v7; + _this.stackVec3[_this.sizeVec3++] = v7; } - var _this15 = this.p; + var _this = this.p; if(v8 != null) { v8.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray7 = new Array(_this15.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this15.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this15.stackVec3[i7]; - _this15.stackVec3[i7] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this15.stackVec3 = newArray7; + _this.stackVec3 = newArray; } - _this15.stackVec3[_this15.sizeVec3++] = v8; + _this.stackVec3[_this.sizeVec3++] = v8; } } ,basis: function(transform,length,colorX,colorY,colorZ) { var _this = this.p; var pos = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var rot = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; - var _this2 = this.p; - var ex = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var ey = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var ez = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this = this.p; + var rot = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; + var _this = this.p; + var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ey = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ez = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; var v = pos; v.x = transform._positionX; v.y = transform._positionY; @@ -8072,44 +8065,44 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.x *= length; ex.y *= length; ex.z *= length; - var _this5 = ex; - _this5.x += pos.x; - _this5.y += pos.y; - _this5.z += pos.z; + var _this = ex; + _this.x += pos.x; + _this.y += pos.y; + _this.z += pos.z; ey.x *= length; ey.y *= length; ey.z *= length; - var _this6 = ey; - _this6.x += pos.x; - _this6.y += pos.y; - _this6.z += pos.z; + var _this = ey; + _this.x += pos.x; + _this.y += pos.y; + _this.z += pos.z; ez.x *= length; ez.y *= length; ez.z *= length; - var _this7 = ez; - _this7.x += pos.x; - _this7.y += pos.y; - _this7.z += pos.z; + var _this = ez; + _this.x += pos.x; + _this.y += pos.y; + _this.z += pos.z; this.line(pos,ex,colorX); this.line(pos,ey,colorY); this.line(pos,ez,colorZ); - var _this8 = this.p; + var _this = this.p; if(pos != null) { pos.zero(); - if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray = new Array(_this8.sizeVec3 << 1); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); var _g = 0; - var _g1 = _this8.sizeVec3; + var _g1 = _this.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this8.stackVec3[i]; - _this8.stackVec3[i] = null; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this8.stackVec3 = newArray; + _this.stackVec3 = newArray; } - _this8.stackVec3[_this8.sizeVec3++] = pos; + _this.stackVec3[_this.sizeVec3++] = pos; } - var _this9 = this.p; + var _this = this.p; if(rot != null) { rot.e00 = 1; rot.e01 = 0; @@ -8120,66 +8113,66 @@ oimo_dynamics_common_DebugDraw.prototype = { rot.e20 = 0; rot.e21 = 0; rot.e22 = 1; - if(_this9.sizeMat3 == _this9.stackMat3.length) { - var newArray1 = new Array(_this9.sizeMat3 << 1); - var _g2 = 0; - var _g11 = _this9.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this9.stackMat3[i1]; - _this9.stackMat3[i1] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this9.stackMat3 = newArray1; + _this.stackMat3 = newArray; } - _this9.stackMat3[_this9.sizeMat3++] = rot; + _this.stackMat3[_this.sizeMat3++] = rot; } - var _this10 = this.p; + var _this = this.p; if(ex != null) { ex.zero(); - if(_this10.sizeVec3 == _this10.stackVec3.length) { - var newArray2 = new Array(_this10.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this10.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this10.stackVec3[i2]; - _this10.stackVec3[i2] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this10.stackVec3 = newArray2; + _this.stackVec3 = newArray; } - _this10.stackVec3[_this10.sizeVec3++] = ex; + _this.stackVec3[_this.sizeVec3++] = ex; } - var _this11 = this.p; + var _this = this.p; if(ey != null) { ey.zero(); - if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray3 = new Array(_this11.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this11.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this11.stackVec3[i3]; - _this11.stackVec3[i3] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this11.stackVec3 = newArray3; + _this.stackVec3 = newArray; } - _this11.stackVec3[_this11.sizeVec3++] = ey; + _this.stackVec3[_this.sizeVec3++] = ey; } - var _this12 = this.p; + var _this = this.p; if(ez != null) { ez.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray4 = new Array(_this12.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this12.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this12.stackVec3[i4]; - _this12.stackVec3[i4] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this12.stackVec3 = newArray4; + _this.stackVec3 = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = ez; + _this.stackVec3[_this.sizeVec3++] = ez; } } ,ellipse: function(center,ex,ey,radiusX,radiusY,color) { @@ -8191,21 +8184,21 @@ oimo_dynamics_common_DebugDraw.prototype = { _this1.x = ex.x; _this1.y = ex.y; _this1.z = ex.z; - var _this2 = _this1; - _this2.x *= radiusX; - _this2.y *= radiusX; - _this2.z *= radiusX; - ex = _this2; - var _this3 = this.p; - var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - _this4.x = ey.x; - _this4.y = ey.y; - _this4.z = ey.z; - var _this5 = _this4; - _this5.x *= radiusY; - _this5.y *= radiusY; - _this5.z *= radiusY; - ey = _this5; + var _this = _this1; + _this.x *= radiusX; + _this.y *= radiusX; + _this.z *= radiusX; + ex = _this; + var _this1 = this.p; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = ey.x; + _this2.y = ey.y; + _this2.z = ey.z; + var _this1 = _this2; + _this1.x *= radiusY; + _this1.y *= radiusY; + _this1.z *= radiusY; + ey = _this1; var angDiff = endAngle - startAngle; if(angDiff < 0) { angDiff = -angDiff; @@ -8216,125 +8209,125 @@ oimo_dynamics_common_DebugDraw.prototype = { } var theta = startAngle; var dt = (endAngle - startAngle) / n; - var _this6 = this.p; - var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; - _this7.x = center.x; - _this7.y = center.y; - _this7.z = center.z; - var _this8 = _this7; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = center.x; + _this3.y = center.y; + _this3.z = center.z; + var _this2 = _this3; var s = Math.cos(startAngle); - _this8.x += _this2.x * s; - _this8.y += _this2.y * s; - _this8.z += _this2.z * s; - var s1 = Math.sin(startAngle); - _this8.x += _this5.x * s1; - _this8.y += _this5.y * s1; - _this8.z += _this5.z * s1; - var prevV = _this8; + _this2.x += _this.x * s; + _this2.y += _this.y * s; + _this2.z += _this.z * s; + var s = Math.sin(startAngle); + _this2.x += _this1.x * s; + _this2.y += _this1.y * s; + _this2.z += _this1.z * s; + var prevV = _this2; if(drawSector) { - this.line(center,_this8,color); + this.line(center,_this2,color); } var _g = 0; var _g1 = n; while(_g < _g1) { ++_g; theta += dt; - var _this9 = this.p; - var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; - _this10.x = center.x; - _this10.y = center.y; - _this10.z = center.z; - var _this11 = _this10; - var s2 = Math.cos(theta); - _this11.x += _this2.x * s2; - _this11.y += _this2.y * s2; - _this11.z += _this2.z * s2; - var s3 = Math.sin(theta); - _this11.x += _this5.x * s3; - _this11.y += _this5.y * s3; - _this11.z += _this5.z * s3; - this.line(prevV,_this11,color); - var _this12 = this.p; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = center.x; + _this3.y = center.y; + _this3.z = center.z; + var _this4 = _this3; + var s = Math.cos(theta); + _this4.x += _this.x * s; + _this4.y += _this.y * s; + _this4.z += _this.z * s; + var s1 = Math.sin(theta); + _this4.x += _this1.x * s1; + _this4.y += _this1.y * s1; + _this4.z += _this1.z * s1; + this.line(prevV,_this4,color); + var _this5 = this.p; if(prevV != null) { prevV.zero(); - if(_this12.sizeVec3 == _this12.stackVec3.length) { - var newArray = new Array(_this12.sizeVec3 << 1); + if(_this5.sizeVec3 == _this5.stackVec3.length) { + var newArray = new Array(_this5.sizeVec3 << 1); var _g2 = 0; - var _g11 = _this12.sizeVec3; + var _g11 = _this5.sizeVec3; while(_g2 < _g11) { var i = _g2++; - newArray[i] = _this12.stackVec3[i]; - _this12.stackVec3[i] = null; + newArray[i] = _this5.stackVec3[i]; + _this5.stackVec3[i] = null; } - _this12.stackVec3 = newArray; + _this5.stackVec3 = newArray; } - _this12.stackVec3[_this12.sizeVec3++] = prevV; + _this5.stackVec3[_this5.sizeVec3++] = prevV; } - prevV = _this11; + prevV = _this4; } if(drawSector) { this.line(center,prevV,color); } - var _this13 = this.p; + var _this2 = this.p; if(prevV != null) { prevV.zero(); - if(_this13.sizeVec3 == _this13.stackVec3.length) { - var newArray1 = new Array(_this13.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this13.sizeVec3; - while(_g3 < _g12) { - var i1 = _g3++; - newArray1[i1] = _this13.stackVec3[i1]; - _this13.stackVec3[i1] = null; + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this13.stackVec3 = newArray1; + _this2.stackVec3 = newArray; } - _this13.stackVec3[_this13.sizeVec3++] = prevV; + _this2.stackVec3[_this2.sizeVec3++] = prevV; } - var _this14 = this.p; - if(_this2 != null) { - _this2.zero(); - if(_this14.sizeVec3 == _this14.stackVec3.length) { - var newArray2 = new Array(_this14.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this14.sizeVec3; - while(_g4 < _g13) { - var i2 = _g4++; - newArray2[i2] = _this14.stackVec3[i2]; - _this14.stackVec3[i2] = null; + var _this2 = this.p; + if(_this != null) { + _this.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this14.stackVec3 = newArray2; + _this2.stackVec3 = newArray; } - _this14.stackVec3[_this14.sizeVec3++] = _this2; + _this2.stackVec3[_this2.sizeVec3++] = _this; } - var _this15 = this.p; - if(_this5 != null) { - _this5.zero(); - if(_this15.sizeVec3 == _this15.stackVec3.length) { - var newArray3 = new Array(_this15.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this15.sizeVec3; - while(_g5 < _g14) { - var i3 = _g5++; - newArray3[i3] = _this15.stackVec3[i3]; - _this15.stackVec3[i3] = null; + var _this = this.p; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this15.stackVec3 = newArray3; + _this.stackVec3 = newArray; } - _this15.stackVec3[_this15.sizeVec3++] = _this5; + _this.stackVec3[_this.sizeVec3++] = _this1; } } ,cone: function(tf,radius,halfHeight,color) { var _this = this.p; var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var _this = this.p; + var ey = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ez = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var m = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; var v = o; v.x = tf._positionX; v.y = tf._positionY; @@ -8352,291 +8345,291 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - _this6.x = o.x; - _this6.y = o.y; - _this6.z = o.z; - var _this7 = _this6; - _this7.x += ey.x * halfHeight; - _this7.y += ey.y * halfHeight; - _this7.z += ey.z * halfHeight; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - _this9.x = o.x; - _this9.y = o.y; - _this9.z = o.z; - var _this10 = _this9; + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = o.x; + _this1.y = o.y; + _this1.z = o.z; + var _this = _this1; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; + var _this1 = this.p; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = o.x; + _this2.y = o.y; + _this2.z = o.z; + var _this1 = _this2; var s = -halfHeight; - _this10.x += ey.x * s; - _this10.y += ey.y * s; - _this10.z += ey.z * s; + _this1.x += ey.x * s; + _this1.y += ey.y * s; + _this1.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = _this10.x; - _this12.y = _this10.y; - _this12.z = _this10.z; - var _this13 = _this12; - var s1 = -radius; - _this13.x += ex.x * s1; - _this13.y += ex.y * s1; - _this13.z += ex.z * s1; - _this13.x += ez.x * 0; - _this13.y += ez.y * 0; - _this13.z += ez.z * 0; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = _this10.x; - _this15.y = _this10.y; - _this15.z = _this10.z; - var _this16 = _this15; - _this16.x += ex.x * radius; - _this16.y += ex.y * radius; - _this16.z += ex.z * radius; - _this16.x += ez.x * 0; - _this16.y += ez.y * 0; - _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = _this10.x; - _this18.y = _this10.y; - _this18.z = _this10.z; - var _this19 = _this18; - _this19.x += ex.x * 0; - _this19.y += ex.y * 0; - _this19.z += ex.z * 0; - var s2 = -radius; - _this19.x += ez.x * s2; - _this19.y += ez.y * s2; - _this19.z += ez.z * s2; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = _this10.x; - _this21.y = _this10.y; - _this21.z = _this10.z; - var _this22 = _this21; - _this22.x += ex.x * 0; - _this22.y += ex.y * 0; - _this22.z += ex.z * 0; - _this22.x += ez.x * radius; - _this22.y += ez.y * radius; - _this22.z += ez.z * radius; - this.ellipse(_this10,ex,ez,radius,radius,color); - this.line(_this7,_this13,color); - this.line(_this7,_this16,color); - this.line(_this7,_this19,color); - this.line(_this7,_this22,color); - var _this23 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this23.sizeVec3 == _this23.stackVec3.length) { - var newArray = new Array(_this23.sizeVec3 << 1); + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = _this1.x; + _this3.y = _this1.y; + _this3.z = _this1.z; + var _this2 = _this3; + var s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this1.x; + _this4.y = _this1.y; + _this4.z = _this1.z; + var _this3 = _this4; + _this3.x += ex.x * radius; + _this3.y += ex.y * radius; + _this3.z += ex.z * radius; + _this3.x += ez.x * 0; + _this3.y += ez.y * 0; + _this3.z += ez.z * 0; + var _this4 = this.p; + var _this5 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + _this5.x = _this1.x; + _this5.y = _this1.y; + _this5.z = _this1.z; + var _this4 = _this5; + _this4.x += ex.x * 0; + _this4.y += ex.y * 0; + _this4.z += ex.z * 0; + var s = -radius; + _this4.x += ez.x * s; + _this4.y += ez.y * s; + _this4.z += ez.z * s; + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = _this1.x; + _this6.y = _this1.y; + _this6.z = _this1.z; + var _this5 = _this6; + _this5.x += ex.x * 0; + _this5.y += ex.y * 0; + _this5.z += ex.z * 0; + _this5.x += ez.x * radius; + _this5.y += ez.y * radius; + _this5.z += ez.z * radius; + this.ellipse(_this1,ex,ez,radius,radius,color); + this.line(_this,_this2,color); + this.line(_this,_this3,color); + this.line(_this,_this4,color); + this.line(_this,_this5,color); + var _this6 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this6.sizeVec3 == _this6.stackVec3.length) { + var newArray = new Array(_this6.sizeVec3 << 1); var _g = 0; - var _g1 = _this23.sizeVec3; + var _g1 = _this6.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this23.stackVec3[i]; - _this23.stackVec3[i] = null; + newArray[i] = _this6.stackVec3[i]; + _this6.stackVec3[i] = null; } - _this23.stackVec3 = newArray; + _this6.stackVec3 = newArray; } - _this23.stackVec3[_this23.sizeVec3++] = _this13; + _this6.stackVec3[_this6.sizeVec3++] = _this2; } - var _this24 = this.p; - if(_this16 != null) { - _this16.zero(); - if(_this24.sizeVec3 == _this24.stackVec3.length) { - var newArray1 = new Array(_this24.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this24.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this24.stackVec3[i1]; - _this24.stackVec3[i1] = null; + var _this2 = this.p; + if(_this3 != null) { + _this3.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this24.stackVec3 = newArray1; + _this2.stackVec3 = newArray; } - _this24.stackVec3[_this24.sizeVec3++] = _this16; + _this2.stackVec3[_this2.sizeVec3++] = _this3; } - var _this25 = this.p; - if(_this19 != null) { - _this19.zero(); - if(_this25.sizeVec3 == _this25.stackVec3.length) { - var newArray2 = new Array(_this25.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this25.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this25.stackVec3[i2]; - _this25.stackVec3[i2] = null; + var _this2 = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this25.stackVec3 = newArray2; + _this2.stackVec3 = newArray; } - _this25.stackVec3[_this25.sizeVec3++] = _this19; + _this2.stackVec3[_this2.sizeVec3++] = _this4; } - var _this26 = this.p; - if(_this22 != null) { - _this22.zero(); - if(_this26.sizeVec3 == _this26.stackVec3.length) { - var newArray3 = new Array(_this26.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this26.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this26.stackVec3[i3]; - _this26.stackVec3[i3] = null; + var _this2 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this26.stackVec3 = newArray3; + _this2.stackVec3 = newArray; } - _this26.stackVec3[_this26.sizeVec3++] = _this22; + _this2.stackVec3[_this2.sizeVec3++] = _this5; } } else { var invDenom = 1 / Math.sqrt(radius * radius + 4 * halfHeight * halfHeight); var cos = 2 * halfHeight * invDenom; var sin = radius * invDenom; - var _g5 = 0; - while(_g5 < 8) { - var i4 = _g5++; - var _this27 = this.tmpCircleNorms[i4]; - var v1 = this.circleCoords[i4]; - _this27.x = v1.x; - _this27.y = v1.y; - _this27.z = v1.z; - _this27.x *= cos; - _this27.y *= cos; - _this27.z *= cos; - _this27.y += sin; - var _this28 = this.tmpCircleNorms[i4]; - var y = _this28.x * m.e10 + _this28.y * m.e11 + _this28.z * m.e12; - var z = _this28.x * m.e20 + _this28.y * m.e21 + _this28.z * m.e22; - _this28.x = _this28.x * m.e00 + _this28.y * m.e01 + _this28.z * m.e02; - _this28.y = y; - _this28.z = z; - var _this29 = this.tmpCircleVerts1[i4]; - var v2 = this.circleCoordsShift[i4]; - _this29.x = v2.x; - _this29.y = v2.y; - _this29.z = v2.z; - _this29.x *= cos; - _this29.y *= cos; - _this29.z *= cos; - _this29.y += sin; - var _this30 = this.tmpCircleVerts1[i4]; - var y1 = _this30.x * m.e10 + _this30.y * m.e11 + _this30.z * m.e12; - var z1 = _this30.x * m.e20 + _this30.y * m.e21 + _this30.z * m.e22; - _this30.x = _this30.x * m.e00 + _this30.y * m.e01 + _this30.z * m.e02; - _this30.y = y1; - _this30.z = z1; - var _this31 = this.tmpCircleVerts2[i4]; - var v3 = this.circleCoords[i4]; - _this31.x = v3.x; - _this31.y = v3.y; - _this31.z = v3.z; - var y2 = _this31.x * m.e10 + _this31.y * m.e11 + _this31.z * m.e12; - var z2 = _this31.x * m.e20 + _this31.y * m.e21 + _this31.z * m.e22; - _this31.x = _this31.x * m.e00 + _this31.y * m.e01 + _this31.z * m.e02; - _this31.y = y2; - _this31.z = z2; - _this31.x *= radius; - _this31.y *= radius; - _this31.z *= radius; - _this31.x += o.x; - _this31.y += o.y; - _this31.z += o.z; - var _this32 = this.tmpCircleVerts2[i4]; - var s3 = -halfHeight; - _this32.x += ey.x * s3; - _this32.y += ey.y * s3; - _this32.z += ey.z * s3; - } - var _g14 = 0; - while(_g14 < 8) { - var i5 = _g14++; - var v21 = this.tmpCircleVerts2[i5]; - var v31 = this.tmpCircleVerts2[(i5 + 1) % 8]; - var n1 = this.tmpCircleVerts1[i5]; - this.triangle(_this7,v21,v31,n1,this.tmpCircleNorms[i5],this.tmpCircleNorms[(i5 + 1) % 8],color); - v21 = this.tmpCircleVerts2[(i5 + 1) % 8]; - v31 = this.tmpCircleVerts2[i5]; - var _this33 = this.p; - var _this34 = _this33.sizeVec3 == 0 ? new oimo_common_Vec3() : _this33.stackVec3[--_this33.sizeVec3]; - _this34.x = ey.x; - _this34.y = ey.y; - _this34.z = ey.z; - var _this35 = _this34; - _this35.x = -_this35.x; - _this35.y = -_this35.y; - _this35.z = -_this35.z; - n1 = _this35; - this.triangle(_this10,v21,v31,_this35,_this35,_this35,color); - var _this36 = this.p; - if(_this35 != null) { - _this35.zero(); - if(_this36.sizeVec3 == _this36.stackVec3.length) { - var newArray4 = new Array(_this36.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this36.sizeVec3; - while(_g6 < _g15) { - var i6 = _g6++; - newArray4[i6] = _this36.stackVec3[i6]; - _this36.stackVec3[i6] = null; + var _g = 0; + while(_g < 8) { + var i = _g++; + var _this2 = this.tmpCircleNorms[i]; + var v = this.circleCoords[i]; + _this2.x = v.x; + _this2.y = v.y; + _this2.z = v.z; + _this2.x *= cos; + _this2.y *= cos; + _this2.z *= cos; + _this2.y += sin; + var _this3 = this.tmpCircleNorms[i]; + var y = _this3.x * m.e10 + _this3.y * m.e11 + _this3.z * m.e12; + var z = _this3.x * m.e20 + _this3.y * m.e21 + _this3.z * m.e22; + _this3.x = _this3.x * m.e00 + _this3.y * m.e01 + _this3.z * m.e02; + _this3.y = y; + _this3.z = z; + var _this4 = this.tmpCircleVerts1[i]; + var v1 = this.circleCoordsShift[i]; + _this4.x = v1.x; + _this4.y = v1.y; + _this4.z = v1.z; + _this4.x *= cos; + _this4.y *= cos; + _this4.z *= cos; + _this4.y += sin; + var _this5 = this.tmpCircleVerts1[i]; + var y1 = _this5.x * m.e10 + _this5.y * m.e11 + _this5.z * m.e12; + var z1 = _this5.x * m.e20 + _this5.y * m.e21 + _this5.z * m.e22; + _this5.x = _this5.x * m.e00 + _this5.y * m.e01 + _this5.z * m.e02; + _this5.y = y1; + _this5.z = z1; + var _this6 = this.tmpCircleVerts2[i]; + var v2 = this.circleCoords[i]; + _this6.x = v2.x; + _this6.y = v2.y; + _this6.z = v2.z; + var y2 = _this6.x * m.e10 + _this6.y * m.e11 + _this6.z * m.e12; + var z2 = _this6.x * m.e20 + _this6.y * m.e21 + _this6.z * m.e22; + _this6.x = _this6.x * m.e00 + _this6.y * m.e01 + _this6.z * m.e02; + _this6.y = y2; + _this6.z = z2; + _this6.x *= radius; + _this6.y *= radius; + _this6.z *= radius; + _this6.x += o.x; + _this6.y += o.y; + _this6.z += o.z; + var _this7 = this.tmpCircleVerts2[i]; + var s = -halfHeight; + _this7.x += ey.x * s; + _this7.y += ey.y * s; + _this7.z += ey.z * s; + } + var _g = 0; + while(_g < 8) { + var i = _g++; + var v2 = this.tmpCircleVerts2[i]; + var v3 = this.tmpCircleVerts2[(i + 1) % 8]; + var n1 = this.tmpCircleVerts1[i]; + this.triangle(_this,v2,v3,n1,this.tmpCircleNorms[i],this.tmpCircleNorms[(i + 1) % 8],color); + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = ey.x; + _this3.y = ey.y; + _this3.z = ey.z; + var _this4 = _this3; + _this4.x = -_this4.x; + _this4.y = -_this4.y; + _this4.z = -_this4.z; + n1 = _this4; + this.triangle(_this1,v2,v3,_this4,_this4,_this4,color); + var _this5 = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this5.sizeVec3 == _this5.stackVec3.length) { + var newArray = new Array(_this5.sizeVec3 << 1); + var _g1 = 0; + var _g11 = _this5.sizeVec3; + while(_g1 < _g11) { + var i1 = _g1++; + newArray[i1] = _this5.stackVec3[i1]; + _this5.stackVec3[i1] = null; } - _this36.stackVec3 = newArray4; + _this5.stackVec3 = newArray; } - _this36.stackVec3[_this36.sizeVec3++] = _this35; + _this5.stackVec3[_this5.sizeVec3++] = _this4; } } } - var _this37 = this.p; - if(_this7 != null) { - _this7.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray5 = new Array(_this37.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this37.sizeVec3; - while(_g7 < _g16) { - var i7 = _g7++; - newArray5[i7] = _this37.stackVec3[i7]; - _this37.stackVec3[i7] = null; - } - _this37.stackVec3 = newArray5; - } - _this37.stackVec3[_this37.sizeVec3++] = _this7; - } - var _this38 = this.p; - if(_this10 != null) { - _this10.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray6 = new Array(_this38.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this38.sizeVec3; - while(_g8 < _g17) { - var i8 = _g8++; - newArray6[i8] = _this38.stackVec3[i8]; - _this38.stackVec3[i8] = null; - } - _this38.stackVec3 = newArray6; - } - _this38.stackVec3[_this38.sizeVec3++] = _this10; - } - var _this39 = this.p; + var _this2 = this.p; + if(_this != null) { + _this.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this; + } + var _this = this.p; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this1; + } + var _this = this.p; if(o != null) { o.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray7 = new Array(_this39.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this39.sizeVec3; - while(_g9 < _g18) { - var i9 = _g9++; - newArray7[i9] = _this39.stackVec3[i9]; - _this39.stackVec3[i9] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this39.stackVec3 = newArray7; + _this.stackVec3 = newArray; } - _this39.stackVec3[_this39.sizeVec3++] = o; + _this.stackVec3[_this.sizeVec3++] = o; } - var _this40 = this.p; + var _this = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -8647,79 +8640,79 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this40.sizeMat3 == _this40.stackMat3.length) { - var newArray8 = new Array(_this40.sizeMat3 << 1); - var _g10 = 0; - var _g19 = _this40.sizeMat3; - while(_g10 < _g19) { - var i10 = _g10++; - newArray8[i10] = _this40.stackMat3[i10]; - _this40.stackMat3[i10] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this40.stackMat3 = newArray8; + _this.stackMat3 = newArray; } - _this40.stackMat3[_this40.sizeMat3++] = m; + _this.stackMat3[_this.sizeMat3++] = m; } - var _this41 = this.p; + var _this = this.p; if(ex != null) { ex.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray9 = new Array(_this41.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this41.sizeVec3; - while(_g20 < _g110) { - var i11 = _g20++; - newArray9[i11] = _this41.stackVec3[i11]; - _this41.stackVec3[i11] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this41.stackVec3 = newArray9; + _this.stackVec3 = newArray; } - _this41.stackVec3[_this41.sizeVec3++] = ex; + _this.stackVec3[_this.sizeVec3++] = ex; } - var _this42 = this.p; + var _this = this.p; if(ey != null) { ey.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray10 = new Array(_this42.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this42.sizeVec3; - while(_g21 < _g111) { - var i12 = _g21++; - newArray10[i12] = _this42.stackVec3[i12]; - _this42.stackVec3[i12] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this42.stackVec3 = newArray10; + _this.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = ey; + _this.stackVec3[_this.sizeVec3++] = ey; } - var _this43 = this.p; + var _this = this.p; if(ez != null) { ez.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray11 = new Array(_this43.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this43.sizeVec3; - while(_g22 < _g112) { - var i13 = _g22++; - newArray11[i13] = _this43.stackVec3[i13]; - _this43.stackVec3[i13] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this43.stackVec3 = newArray11; + _this.stackVec3 = newArray; } - _this43.stackVec3[_this43.sizeVec3++] = ez; + _this.stackVec3[_this.sizeVec3++] = ez; } } ,cylinder: function(tf,radius,halfHeight,color) { var _this = this.p; var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var _this = this.p; + var ey = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ez = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var m = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; var v = o; v.x = tf._positionX; v.y = tf._positionY; @@ -8737,395 +8730,395 @@ oimo_dynamics_common_DebugDraw.prototype = { ex.init(m.e00,m.e10,m.e20); ey.init(m.e01,m.e11,m.e21); ez.init(m.e02,m.e12,m.e22); - var _this5 = this.p; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - _this6.x = o.x; - _this6.y = o.y; - _this6.z = o.z; - var _this7 = _this6; - _this7.x += ey.x * halfHeight; - _this7.y += ey.y * halfHeight; - _this7.z += ey.z * halfHeight; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - _this9.x = o.x; - _this9.y = o.y; - _this9.z = o.z; - var _this10 = _this9; + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = o.x; + _this1.y = o.y; + _this1.z = o.z; + var _this = _this1; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; + var _this1 = this.p; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = o.x; + _this2.y = o.y; + _this2.z = o.z; + var _this1 = _this2; var s = -halfHeight; - _this10.x += ey.x * s; - _this10.y += ey.y * s; - _this10.z += ey.z * s; + _this1.x += ey.x * s; + _this1.y += ey.y * s; + _this1.z += ey.z * s; if(this.wireframe) { - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = _this7.x; - _this12.y = _this7.y; - _this12.z = _this7.z; - var _this13 = _this12; - var s1 = -radius; - _this13.x += ex.x * s1; - _this13.y += ex.y * s1; - _this13.z += ex.z * s1; - _this13.x += ez.x * 0; - _this13.y += ez.y * 0; - _this13.z += ez.z * 0; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = _this7.x; - _this15.y = _this7.y; - _this15.z = _this7.z; - var _this16 = _this15; - _this16.x += ex.x * radius; - _this16.y += ex.y * radius; - _this16.z += ex.z * radius; - _this16.x += ez.x * 0; - _this16.y += ez.y * 0; - _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = _this7.x; - _this18.y = _this7.y; - _this18.z = _this7.z; - var _this19 = _this18; - _this19.x += ex.x * 0; - _this19.y += ex.y * 0; - _this19.z += ex.z * 0; - var s2 = -radius; - _this19.x += ez.x * s2; - _this19.y += ez.y * s2; - _this19.z += ez.z * s2; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = _this7.x; - _this21.y = _this7.y; - _this21.z = _this7.z; - var _this22 = _this21; - _this22.x += ex.x * 0; - _this22.y += ex.y * 0; - _this22.z += ex.z * 0; - _this22.x += ez.x * radius; - _this22.y += ez.y * radius; - _this22.z += ez.z * radius; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = _this10.x; - _this24.y = _this10.y; - _this24.z = _this10.z; - var _this25 = _this24; - var s3 = -radius; - _this25.x += ex.x * s3; - _this25.y += ex.y * s3; - _this25.z += ex.z * s3; - _this25.x += ez.x * 0; - _this25.y += ez.y * 0; - _this25.z += ez.z * 0; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - _this27.x = _this10.x; - _this27.y = _this10.y; - _this27.z = _this10.z; - var _this28 = _this27; - _this28.x += ex.x * radius; - _this28.y += ex.y * radius; - _this28.z += ex.z * radius; - _this28.x += ez.x * 0; - _this28.y += ez.y * 0; - _this28.z += ez.z * 0; - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = _this10.x; - _this30.y = _this10.y; - _this30.z = _this10.z; - var _this31 = _this30; - _this31.x += ex.x * 0; - _this31.y += ex.y * 0; - _this31.z += ex.z * 0; - var s4 = -radius; - _this31.x += ez.x * s4; - _this31.y += ez.y * s4; - _this31.z += ez.z * s4; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = _this10.x; - _this33.y = _this10.y; - _this33.z = _this10.z; - var _this34 = _this33; - _this34.x += ex.x * 0; - _this34.y += ex.y * 0; - _this34.z += ex.z * 0; - _this34.x += ez.x * radius; - _this34.y += ez.y * radius; - _this34.z += ez.z * radius; - this.ellipse(_this7,ex,ez,radius,radius,color); - this.ellipse(_this10,ex,ez,radius,radius,color); - this.line(_this13,_this25,color); - this.line(_this16,_this28,color); - this.line(_this19,_this31,color); - this.line(_this22,_this34,color); - var _this35 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this35.sizeVec3 == _this35.stackVec3.length) { - var newArray = new Array(_this35.sizeVec3 << 1); + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = _this.x; + _this3.y = _this.y; + _this3.z = _this.z; + var _this2 = _this3; + var s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this.x; + _this4.y = _this.y; + _this4.z = _this.z; + var _this3 = _this4; + _this3.x += ex.x * radius; + _this3.y += ex.y * radius; + _this3.z += ex.z * radius; + _this3.x += ez.x * 0; + _this3.y += ez.y * 0; + _this3.z += ez.z * 0; + var _this4 = this.p; + var _this5 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + _this5.x = _this.x; + _this5.y = _this.y; + _this5.z = _this.z; + var _this4 = _this5; + _this4.x += ex.x * 0; + _this4.y += ex.y * 0; + _this4.z += ex.z * 0; + var s = -radius; + _this4.x += ez.x * s; + _this4.y += ez.y * s; + _this4.z += ez.z * s; + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = _this.x; + _this6.y = _this.y; + _this6.z = _this.z; + var _this5 = _this6; + _this5.x += ex.x * 0; + _this5.y += ex.y * 0; + _this5.z += ex.z * 0; + _this5.x += ez.x * radius; + _this5.y += ez.y * radius; + _this5.z += ez.z * radius; + var _this6 = this.p; + var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = _this1.x; + _this7.y = _this1.y; + _this7.z = _this1.z; + var _this6 = _this7; + var s = -radius; + _this6.x += ex.x * s; + _this6.y += ex.y * s; + _this6.z += ex.z * s; + _this6.x += ez.x * 0; + _this6.y += ez.y * 0; + _this6.z += ez.z * 0; + var _this7 = this.p; + var _this8 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + _this8.x = _this1.x; + _this8.y = _this1.y; + _this8.z = _this1.z; + var _this7 = _this8; + _this7.x += ex.x * radius; + _this7.y += ex.y * radius; + _this7.z += ex.z * radius; + _this7.x += ez.x * 0; + _this7.y += ez.y * 0; + _this7.z += ez.z * 0; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = _this1.x; + _this9.y = _this1.y; + _this9.z = _this1.z; + var _this8 = _this9; + _this8.x += ex.x * 0; + _this8.y += ex.y * 0; + _this8.z += ex.z * 0; + var s = -radius; + _this8.x += ez.x * s; + _this8.y += ez.y * s; + _this8.z += ez.z * s; + var _this9 = this.p; + var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + _this10.x = _this1.x; + _this10.y = _this1.y; + _this10.z = _this1.z; + var _this9 = _this10; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + _this9.x += ez.x * radius; + _this9.y += ez.y * radius; + _this9.z += ez.z * radius; + this.ellipse(_this,ex,ez,radius,radius,color); + this.ellipse(_this1,ex,ez,radius,radius,color); + this.line(_this2,_this6,color); + this.line(_this3,_this7,color); + this.line(_this4,_this8,color); + this.line(_this5,_this9,color); + var _this10 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newArray = new Array(_this10.sizeVec3 << 1); var _g = 0; - var _g1 = _this35.sizeVec3; + var _g1 = _this10.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this35.stackVec3[i]; - _this35.stackVec3[i] = null; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this35.stackVec3 = newArray; + _this10.stackVec3 = newArray; } - _this35.stackVec3[_this35.sizeVec3++] = _this13; + _this10.stackVec3[_this10.sizeVec3++] = _this2; } - var _this36 = this.p; - if(_this16 != null) { - _this16.zero(); - if(_this36.sizeVec3 == _this36.stackVec3.length) { - var newArray1 = new Array(_this36.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this36.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this36.stackVec3[i1]; - _this36.stackVec3[i1] = null; + var _this2 = this.p; + if(_this3 != null) { + _this3.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this36.stackVec3 = newArray1; + _this2.stackVec3 = newArray; } - _this36.stackVec3[_this36.sizeVec3++] = _this16; + _this2.stackVec3[_this2.sizeVec3++] = _this3; } - var _this37 = this.p; - if(_this19 != null) { - _this19.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray2 = new Array(_this37.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this37.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this37.stackVec3[i2]; - _this37.stackVec3[i2] = null; + var _this2 = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this37.stackVec3 = newArray2; + _this2.stackVec3 = newArray; } - _this37.stackVec3[_this37.sizeVec3++] = _this19; + _this2.stackVec3[_this2.sizeVec3++] = _this4; } - var _this38 = this.p; - if(_this22 != null) { - _this22.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray3 = new Array(_this38.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this38.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this38.stackVec3[i3]; - _this38.stackVec3[i3] = null; + var _this2 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this38.stackVec3 = newArray3; - } - _this38.stackVec3[_this38.sizeVec3++] = _this22; - } - var _this39 = this.p; - if(_this25 != null) { - _this25.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray4 = new Array(_this39.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this39.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this39.stackVec3[i4]; - _this39.stackVec3[i4] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this5; + } + var _this2 = this.p; + if(_this6 != null) { + _this6.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this39.stackVec3 = newArray4; - } - _this39.stackVec3[_this39.sizeVec3++] = _this25; - } - var _this40 = this.p; - if(_this28 != null) { - _this28.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray5 = new Array(_this40.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this40.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this40.stackVec3[i5]; - _this40.stackVec3[i5] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this6; + } + var _this2 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this40.stackVec3 = newArray5; - } - _this40.stackVec3[_this40.sizeVec3++] = _this28; - } - var _this41 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray6 = new Array(_this41.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this41.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this41.stackVec3[i6]; - _this41.stackVec3[i6] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this7; + } + var _this2 = this.p; + if(_this8 != null) { + _this8.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this41.stackVec3 = newArray6; + _this2.stackVec3 = newArray; } - _this41.stackVec3[_this41.sizeVec3++] = _this31; + _this2.stackVec3[_this2.sizeVec3++] = _this8; } - var _this42 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray7 = new Array(_this42.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this42.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this42.stackVec3[i7]; - _this42.stackVec3[i7] = null; + var _this2 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this42.stackVec3 = newArray7; + _this2.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = _this34; + _this2.stackVec3[_this2.sizeVec3++] = _this9; } } else { - var _g9 = 0; - while(_g9 < 8) { - var i8 = _g9++; - var _this43 = this.tmpCircleNorms[i8]; - var v1 = this.circleCoords[i8]; - _this43.x = v1.x; - _this43.y = v1.y; - _this43.z = v1.z; - var y = _this43.x * m.e10 + _this43.y * m.e11 + _this43.z * m.e12; - var z = _this43.x * m.e20 + _this43.y * m.e21 + _this43.z * m.e22; - _this43.x = _this43.x * m.e00 + _this43.y * m.e01 + _this43.z * m.e02; - _this43.y = y; - _this43.z = z; - var _this44 = this.tmpCircleVerts1[i8]; - var v2 = this.tmpCircleNorms[i8]; - _this44.x = v2.x; - _this44.y = v2.y; - _this44.z = v2.z; - _this44.x *= radius; - _this44.y *= radius; - _this44.z *= radius; - _this44.x += o.x; - _this44.y += o.y; - _this44.z += o.z; - var _this45 = this.tmpCircleVerts2[i8]; - var v3 = this.tmpCircleVerts1[i8]; - _this45.x = v3.x; - _this45.y = v3.y; - _this45.z = v3.z; - var _this46 = this.tmpCircleVerts1[i8]; - _this46.x += ey.x * halfHeight; - _this46.y += ey.y * halfHeight; - _this46.z += ey.z * halfHeight; - var _this47 = this.tmpCircleVerts2[i8]; - var s5 = -halfHeight; - _this47.x += ey.x * s5; - _this47.y += ey.y * s5; - _this47.z += ey.z * s5; - } - var _g18 = 0; - while(_g18 < 8) { - var i9 = _g18++; - var v11 = _this7; - var v21 = this.tmpCircleVerts1[i9]; - var v31 = this.tmpCircleVerts1[(i9 + 1) % 8]; + var _g = 0; + while(_g < 8) { + var i = _g++; + var _this2 = this.tmpCircleNorms[i]; + var v = this.circleCoords[i]; + _this2.x = v.x; + _this2.y = v.y; + _this2.z = v.z; + var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; + var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; + _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; + _this2.y = y; + _this2.z = z; + var _this3 = this.tmpCircleVerts1[i]; + var v1 = this.tmpCircleNorms[i]; + _this3.x = v1.x; + _this3.y = v1.y; + _this3.z = v1.z; + _this3.x *= radius; + _this3.y *= radius; + _this3.z *= radius; + _this3.x += o.x; + _this3.y += o.y; + _this3.z += o.z; + var _this4 = this.tmpCircleVerts2[i]; + var v2 = this.tmpCircleVerts1[i]; + _this4.x = v2.x; + _this4.y = v2.y; + _this4.z = v2.z; + var _this5 = this.tmpCircleVerts1[i]; + _this5.x += ey.x * halfHeight; + _this5.y += ey.y * halfHeight; + _this5.z += ey.z * halfHeight; + var _this6 = this.tmpCircleVerts2[i]; + var s = -halfHeight; + _this6.x += ey.x * s; + _this6.y += ey.y * s; + _this6.z += ey.z * s; + } + var _g = 0; + while(_g < 8) { + var i = _g++; + var v1 = _this; + var v2 = this.tmpCircleVerts1[i]; + var v3 = this.tmpCircleVerts1[(i + 1) % 8]; var n1 = ey; - this.triangle(_this7,v21,v31,n1,n1,n1,color); - v11 = _this10; - v21 = this.tmpCircleVerts2[(i9 + 1) % 8]; - v31 = this.tmpCircleVerts2[i9]; - var _this48 = this.p; - var _this49 = _this48.sizeVec3 == 0 ? new oimo_common_Vec3() : _this48.stackVec3[--_this48.sizeVec3]; - _this49.x = ey.x; - _this49.y = ey.y; - _this49.z = ey.z; - var _this50 = _this49; - _this50.x = -_this50.x; - _this50.y = -_this50.y; - _this50.z = -_this50.z; - n1 = _this50; - this.triangle(_this10,v21,v31,_this50,_this50,_this50,color); - var _this51 = this.p; - if(_this50 != null) { - _this50.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray8 = new Array(_this51.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this51.sizeVec3; - while(_g10 < _g19) { - var i10 = _g10++; - newArray8[i10] = _this51.stackVec3[i10]; - _this51.stackVec3[i10] = null; + this.triangle(_this,v2,v3,n1,n1,n1,color); + v1 = _this1; + v2 = this.tmpCircleVerts2[(i + 1) % 8]; + v3 = this.tmpCircleVerts2[i]; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = ey.x; + _this3.y = ey.y; + _this3.z = ey.z; + var _this4 = _this3; + _this4.x = -_this4.x; + _this4.y = -_this4.y; + _this4.z = -_this4.z; + n1 = _this4; + this.triangle(_this1,v2,v3,_this4,_this4,_this4,color); + var _this5 = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this5.sizeVec3 == _this5.stackVec3.length) { + var newArray = new Array(_this5.sizeVec3 << 1); + var _g1 = 0; + var _g11 = _this5.sizeVec3; + while(_g1 < _g11) { + var i1 = _g1++; + newArray[i1] = _this5.stackVec3[i1]; + _this5.stackVec3[i1] = null; } - _this51.stackVec3 = newArray8; + _this5.stackVec3 = newArray; } - _this51.stackVec3[_this51.sizeVec3++] = _this50; + _this5.stackVec3[_this5.sizeVec3++] = _this4; } - v11 = this.tmpCircleVerts1[i9]; - v21 = this.tmpCircleVerts2[i9]; - v31 = this.tmpCircleVerts2[(i9 + 1) % 8]; - n1 = this.tmpCircleNorms[i9]; - var n2 = this.tmpCircleNorms[(i9 + 1) % 8]; - this.rect(v11,v21,v31,this.tmpCircleVerts1[(i9 + 1) % 8],n1,n1,n2,n2,color); + v1 = this.tmpCircleVerts1[i]; + v2 = this.tmpCircleVerts2[i]; + v3 = this.tmpCircleVerts2[(i + 1) % 8]; + n1 = this.tmpCircleNorms[i]; + var n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(v1,v2,v3,this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); } } - var _this52 = this.p; - if(_this7 != null) { - _this7.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray9 = new Array(_this52.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this52.sizeVec3; - while(_g20 < _g110) { - var i11 = _g20++; - newArray9[i11] = _this52.stackVec3[i11]; - _this52.stackVec3[i11] = null; - } - _this52.stackVec3 = newArray9; - } - _this52.stackVec3[_this52.sizeVec3++] = _this7; - } - var _this53 = this.p; - if(_this10 != null) { - _this10.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray10 = new Array(_this53.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this53.sizeVec3; - while(_g21 < _g111) { - var i12 = _g21++; - newArray10[i12] = _this53.stackVec3[i12]; - _this53.stackVec3[i12] = null; - } - _this53.stackVec3 = newArray10; - } - _this53.stackVec3[_this53.sizeVec3++] = _this10; - } - var _this54 = this.p; + var _this2 = this.p; + if(_this != null) { + _this.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this; + } + var _this = this.p; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this1; + } + var _this = this.p; if(o != null) { o.zero(); - if(_this54.sizeVec3 == _this54.stackVec3.length) { - var newArray11 = new Array(_this54.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this54.sizeVec3; - while(_g22 < _g112) { - var i13 = _g22++; - newArray11[i13] = _this54.stackVec3[i13]; - _this54.stackVec3[i13] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this54.stackVec3 = newArray11; + _this.stackVec3 = newArray; } - _this54.stackVec3[_this54.sizeVec3++] = o; + _this.stackVec3[_this.sizeVec3++] = o; } - var _this55 = this.p; + var _this = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -9136,79 +9129,79 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this55.sizeMat3 == _this55.stackMat3.length) { - var newArray12 = new Array(_this55.sizeMat3 << 1); - var _g23 = 0; - var _g113 = _this55.sizeMat3; - while(_g23 < _g113) { - var i14 = _g23++; - newArray12[i14] = _this55.stackMat3[i14]; - _this55.stackMat3[i14] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this55.stackMat3 = newArray12; + _this.stackMat3 = newArray; } - _this55.stackMat3[_this55.sizeMat3++] = m; + _this.stackMat3[_this.sizeMat3++] = m; } - var _this56 = this.p; + var _this = this.p; if(ex != null) { ex.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newArray13 = new Array(_this56.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this56.sizeVec3; - while(_g24 < _g114) { - var i15 = _g24++; - newArray13[i15] = _this56.stackVec3[i15]; - _this56.stackVec3[i15] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this56.stackVec3 = newArray13; + _this.stackVec3 = newArray; } - _this56.stackVec3[_this56.sizeVec3++] = ex; + _this.stackVec3[_this.sizeVec3++] = ex; } - var _this57 = this.p; + var _this = this.p; if(ey != null) { ey.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newArray14 = new Array(_this57.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this57.sizeVec3; - while(_g25 < _g115) { - var i16 = _g25++; - newArray14[i16] = _this57.stackVec3[i16]; - _this57.stackVec3[i16] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this57.stackVec3 = newArray14; + _this.stackVec3 = newArray; } - _this57.stackVec3[_this57.sizeVec3++] = ey; + _this.stackVec3[_this.sizeVec3++] = ey; } - var _this58 = this.p; + var _this = this.p; if(ez != null) { ez.zero(); - if(_this58.sizeVec3 == _this58.stackVec3.length) { - var newArray15 = new Array(_this58.sizeVec3 << 1); - var _g26 = 0; - var _g116 = _this58.sizeVec3; - while(_g26 < _g116) { - var i17 = _g26++; - newArray15[i17] = _this58.stackVec3[i17]; - _this58.stackVec3[i17] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this58.stackVec3 = newArray15; + _this.stackVec3 = newArray; } - _this58.stackVec3[_this58.sizeVec3++] = ez; + _this.stackVec3[_this.sizeVec3++] = ez; } } ,capsule: function(tf,radius,halfHeight,color) { var _this = this.p; var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var _this = this.p; + var ey = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ez = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var m = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; var v = o; v.x = tf._positionX; v.y = tf._positionY; @@ -9235,483 +9228,483 @@ oimo_dynamics_common_DebugDraw.prototype = { var _g1 = 0; while(_g1 < n) { var j2 = _g1++; - var _this5 = ns[i2][j2]; - var v1 = this.sphereCoords[i2][j2]; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var y = _this5.x * m.e10 + _this5.y * m.e11 + _this5.z * m.e12; - var z = _this5.x * m.e20 + _this5.y * m.e21 + _this5.z * m.e22; - _this5.x = _this5.x * m.e00 + _this5.y * m.e01 + _this5.z * m.e02; - _this5.y = y; - _this5.z = z; + var _this = ns[i2][j2]; + var v = this.sphereCoords[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + var z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; } } - var _g2 = 0; - while(_g2 < 4) { - var i = _g2++; + var _g = 0; + while(_g < 4) { + var i = _g++; if(i == 0) { - var _g21 = 0; - while(_g21 < 3) { - var i21 = _g21++; - var n1 = this.tmpSphereVerts[i21].length; - var _g22 = 0; - while(_g22 < n1) { - var j21 = _g22++; - var _this6 = vs[i21][j21]; - var v2 = ns[i21][j21]; - _this6.x = v2.x; - _this6.y = v2.y; - _this6.z = v2.z; - _this6.x *= radius; - _this6.y *= radius; - _this6.z *= radius; - _this6.x += o.x; - _this6.y += o.y; - _this6.z += o.z; - _this6.x += ey.x * halfHeight; - _this6.y += ey.y * halfHeight; - _this6.z += ey.z * halfHeight; + var _g1 = 0; + while(_g1 < 3) { + var i2 = _g1++; + var n = this.tmpSphereVerts[i2].length; + var _g2 = 0; + while(_g2 < n) { + var j2 = _g2++; + var _this = vs[i2][j2]; + var v = ns[i2][j2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + _this.x *= radius; + _this.y *= radius; + _this.z *= radius; + _this.x += o.x; + _this.y += o.y; + _this.z += o.z; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; } } } if(i == 2) { - var _g23 = 2; - while(_g23 < 5) { - var i22 = _g23++; - var n2 = this.tmpSphereVerts[i22].length; - var _g24 = 0; - while(_g24 < n2) { - var j22 = _g24++; - var _this7 = vs[i22][j22]; - var v3 = ns[i22][j22]; - _this7.x = v3.x; - _this7.y = v3.y; - _this7.z = v3.z; - _this7.x *= radius; - _this7.y *= radius; - _this7.z *= radius; - _this7.x += o.x; - _this7.y += o.y; - _this7.z += o.z; + var _g3 = 2; + while(_g3 < 5) { + var i21 = _g3++; + var n1 = this.tmpSphereVerts[i21].length; + var _g4 = 0; + while(_g4 < n1) { + var j21 = _g4++; + var _this1 = vs[i21][j21]; + var v1 = ns[i21][j21]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; var s = -halfHeight; - _this7.x += ey.x * s; - _this7.y += ey.y * s; - _this7.z += ey.z * s; + _this1.x += ey.x * s; + _this1.y += ey.y * s; + _this1.z += ey.z * s; } } } - var _g25 = 0; - while(_g25 < 8) { - var j = _g25++; + var _g5 = 0; + while(_g5 < 8) { + var j = _g5++; var v11; - var v21; - var v31; + var v2; + var v3; var v4; var n11; - var n21; + var n2; var n3; var n4; if(i == 0) { if(this.wireframe) { v11 = vs[0][0]; - v21 = vs[1][j]; - this.line(v11,v21,color); + v2 = vs[1][j]; + this.line(v11,v2,color); } else { v11 = vs[0][0]; - v21 = vs[1][j]; - v31 = vs[1][(j + 1) % 8]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; n11 = ns[0][0]; - n21 = ns[1][j]; + n2 = ns[1][j]; n3 = ns[1][(j + 1) % 8]; - this.triangle(v11,v21,v31,n11,n21,n3,color); + this.triangle(v11,v2,v3,n11,n2,n3,color); } } else if(i == 3) { if(this.wireframe) { v11 = vs[4][0]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i][j]; - this.line(v11,v21,color); - this.line(v21,v31,color); + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v11,v2,color); + this.line(v2,v3,color); } else { v11 = vs[4][0]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; n11 = ns[4][0]; - n21 = ns[i][(j + 1) % 8]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i][j]; - this.triangle(v11,v21,v31,n11,n21,n3,color); + this.triangle(v11,v2,v3,n11,n2,n3,color); } } else if(this.wireframe) { v11 = vs[i][j]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i + 1][j]; - this.line(v11,v21,color); - this.line(v11,v31,color); + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v11,v2,color); + this.line(v11,v3,color); } else { v11 = vs[i][j]; - v21 = vs[i][(j + 1) % 8]; - v31 = vs[i + 1][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; v4 = vs[i + 1][(j + 1) % 8]; n11 = ns[i][j]; - n21 = ns[i][(j + 1) % 8]; + n2 = ns[i][(j + 1) % 8]; n3 = ns[i + 1][j]; n4 = ns[i + 1][(j + 1) % 8]; - this.rect(v11,v31,v4,v21,n11,n3,n4,n21,color); + this.rect(v11,v3,v4,v2,n11,n3,n4,n2,color); } } } - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - _this9.x = o.x; - _this9.y = o.y; - _this9.z = o.z; - var _this10 = _this9; - _this10.x += ey.x * halfHeight; - _this10.y += ey.y * halfHeight; - _this10.z += ey.z * halfHeight; - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = o.x; - _this12.y = o.y; - _this12.z = o.z; - var _this13 = _this12; - var s1 = -halfHeight; - _this13.x += ey.x * s1; - _this13.y += ey.y * s1; - _this13.z += ey.z * s1; + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = o.x; + _this1.y = o.y; + _this1.z = o.z; + var _this = _this1; + _this.x += ey.x * halfHeight; + _this.y += ey.y * halfHeight; + _this.z += ey.z * halfHeight; + var _this1 = this.p; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = o.x; + _this2.y = o.y; + _this2.z = o.z; + var _this1 = _this2; + var s = -halfHeight; + _this1.x += ey.x * s; + _this1.y += ey.y * s; + _this1.z += ey.z * s; if(this.wireframe) { - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = _this10.x; - _this15.y = _this10.y; - _this15.z = _this10.z; - var _this16 = _this15; - var s2 = -radius; - _this16.x += ex.x * s2; - _this16.y += ex.y * s2; - _this16.z += ex.z * s2; - _this16.x += ez.x * 0; - _this16.y += ez.y * 0; - _this16.z += ez.z * 0; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = _this10.x; - _this18.y = _this10.y; - _this18.z = _this10.z; - var _this19 = _this18; - _this19.x += ex.x * radius; - _this19.y += ex.y * radius; - _this19.z += ex.z * radius; - _this19.x += ez.x * 0; - _this19.y += ez.y * 0; - _this19.z += ez.z * 0; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = _this10.x; - _this21.y = _this10.y; - _this21.z = _this10.z; - var _this22 = _this21; - _this22.x += ex.x * 0; - _this22.y += ex.y * 0; - _this22.z += ex.z * 0; - var s3 = -radius; - _this22.x += ez.x * s3; - _this22.y += ez.y * s3; - _this22.z += ez.z * s3; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = _this10.x; - _this24.y = _this10.y; - _this24.z = _this10.z; - var _this25 = _this24; - _this25.x += ex.x * 0; - _this25.y += ex.y * 0; - _this25.z += ex.z * 0; - _this25.x += ez.x * radius; - _this25.y += ez.y * radius; - _this25.z += ez.z * radius; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - _this27.x = _this13.x; - _this27.y = _this13.y; - _this27.z = _this13.z; - var _this28 = _this27; - var s4 = -radius; - _this28.x += ex.x * s4; - _this28.y += ex.y * s4; - _this28.z += ex.z * s4; - _this28.x += ez.x * 0; - _this28.y += ez.y * 0; - _this28.z += ez.z * 0; - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = _this13.x; - _this30.y = _this13.y; - _this30.z = _this13.z; - var _this31 = _this30; - _this31.x += ex.x * radius; - _this31.y += ex.y * radius; - _this31.z += ex.z * radius; - _this31.x += ez.x * 0; - _this31.y += ez.y * 0; - _this31.z += ez.z * 0; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = _this13.x; - _this33.y = _this13.y; - _this33.z = _this13.z; - var _this34 = _this33; - _this34.x += ex.x * 0; - _this34.y += ex.y * 0; - _this34.z += ex.z * 0; - var s5 = -radius; - _this34.x += ez.x * s5; - _this34.y += ez.y * s5; - _this34.z += ez.z * s5; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = _this13.x; - _this36.y = _this13.y; - _this36.z = _this13.z; - var _this37 = _this36; - _this37.x += ex.x * 0; - _this37.y += ex.y * 0; - _this37.z += ex.z * 0; - _this37.x += ez.x * radius; - _this37.y += ez.y * radius; - _this37.z += ez.z * radius; - this.ellipse(_this10,ex,ez,radius,radius,color); - this.ellipse(_this13,ex,ez,radius,radius,color); - this.line(_this16,_this28,color); - this.line(_this19,_this31,color); - this.line(_this22,_this34,color); - this.line(_this25,_this37,color); - var _this38 = this.p; - if(_this16 != null) { - _this16.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray = new Array(_this38.sizeVec3 << 1); - var _g3 = 0; - var _g11 = _this38.sizeVec3; - while(_g3 < _g11) { - var i1 = _g3++; - newArray[i1] = _this38.stackVec3[i1]; - _this38.stackVec3[i1] = null; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = _this.x; + _this3.y = _this.y; + _this3.z = _this.z; + var _this2 = _this3; + var s = -radius; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ez.x * 0; + _this2.y += ez.y * 0; + _this2.z += ez.z * 0; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = _this.x; + _this4.y = _this.y; + _this4.z = _this.z; + var _this3 = _this4; + _this3.x += ex.x * radius; + _this3.y += ex.y * radius; + _this3.z += ex.z * radius; + _this3.x += ez.x * 0; + _this3.y += ez.y * 0; + _this3.z += ez.z * 0; + var _this4 = this.p; + var _this5 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + _this5.x = _this.x; + _this5.y = _this.y; + _this5.z = _this.z; + var _this4 = _this5; + _this4.x += ex.x * 0; + _this4.y += ex.y * 0; + _this4.z += ex.z * 0; + var s = -radius; + _this4.x += ez.x * s; + _this4.y += ez.y * s; + _this4.z += ez.z * s; + var _this5 = this.p; + var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + _this6.x = _this.x; + _this6.y = _this.y; + _this6.z = _this.z; + var _this5 = _this6; + _this5.x += ex.x * 0; + _this5.y += ex.y * 0; + _this5.z += ex.z * 0; + _this5.x += ez.x * radius; + _this5.y += ez.y * radius; + _this5.z += ez.z * radius; + var _this6 = this.p; + var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = _this1.x; + _this7.y = _this1.y; + _this7.z = _this1.z; + var _this6 = _this7; + var s = -radius; + _this6.x += ex.x * s; + _this6.y += ex.y * s; + _this6.z += ex.z * s; + _this6.x += ez.x * 0; + _this6.y += ez.y * 0; + _this6.z += ez.z * 0; + var _this7 = this.p; + var _this8 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + _this8.x = _this1.x; + _this8.y = _this1.y; + _this8.z = _this1.z; + var _this7 = _this8; + _this7.x += ex.x * radius; + _this7.y += ex.y * radius; + _this7.z += ex.z * radius; + _this7.x += ez.x * 0; + _this7.y += ez.y * 0; + _this7.z += ez.z * 0; + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = _this1.x; + _this9.y = _this1.y; + _this9.z = _this1.z; + var _this8 = _this9; + _this8.x += ex.x * 0; + _this8.y += ex.y * 0; + _this8.z += ex.z * 0; + var s = -radius; + _this8.x += ez.x * s; + _this8.y += ez.y * s; + _this8.z += ez.z * s; + var _this9 = this.p; + var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + _this10.x = _this1.x; + _this10.y = _this1.y; + _this10.z = _this1.z; + var _this9 = _this10; + _this9.x += ex.x * 0; + _this9.y += ex.y * 0; + _this9.z += ex.z * 0; + _this9.x += ez.x * radius; + _this9.y += ez.y * radius; + _this9.z += ez.z * radius; + this.ellipse(_this,ex,ez,radius,radius,color); + this.ellipse(_this1,ex,ez,radius,radius,color); + this.line(_this2,_this6,color); + this.line(_this3,_this7,color); + this.line(_this4,_this8,color); + this.line(_this5,_this9,color); + var _this10 = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this10.sizeVec3 == _this10.stackVec3.length) { + var newArray = new Array(_this10.sizeVec3 << 1); + var _g = 0; + var _g1 = _this10.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this10.stackVec3[i]; + _this10.stackVec3[i] = null; } - _this38.stackVec3 = newArray; + _this10.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = _this16; + _this10.stackVec3[_this10.sizeVec3++] = _this2; } - var _this39 = this.p; - if(_this19 != null) { - _this19.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray1 = new Array(_this39.sizeVec3 << 1); - var _g4 = 0; - var _g12 = _this39.sizeVec3; - while(_g4 < _g12) { - var i3 = _g4++; - newArray1[i3] = _this39.stackVec3[i3]; - _this39.stackVec3[i3] = null; + var _this2 = this.p; + if(_this3 != null) { + _this3.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this39.stackVec3 = newArray1; - } - _this39.stackVec3[_this39.sizeVec3++] = _this19; - } - var _this40 = this.p; - if(_this22 != null) { - _this22.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray2 = new Array(_this40.sizeVec3 << 1); - var _g5 = 0; - var _g13 = _this40.sizeVec3; - while(_g5 < _g13) { - var i4 = _g5++; - newArray2[i4] = _this40.stackVec3[i4]; - _this40.stackVec3[i4] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this3; + } + var _this2 = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this40.stackVec3 = newArray2; - } - _this40.stackVec3[_this40.sizeVec3++] = _this22; - } - var _this41 = this.p; - if(_this25 != null) { - _this25.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray3 = new Array(_this41.sizeVec3 << 1); - var _g6 = 0; - var _g14 = _this41.sizeVec3; - while(_g6 < _g14) { - var i5 = _g6++; - newArray3[i5] = _this41.stackVec3[i5]; - _this41.stackVec3[i5] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this4; + } + var _this2 = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this41.stackVec3 = newArray3; - } - _this41.stackVec3[_this41.sizeVec3++] = _this25; - } - var _this42 = this.p; - if(_this28 != null) { - _this28.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray4 = new Array(_this42.sizeVec3 << 1); - var _g7 = 0; - var _g15 = _this42.sizeVec3; - while(_g7 < _g15) { - var i6 = _g7++; - newArray4[i6] = _this42.stackVec3[i6]; - _this42.stackVec3[i6] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this5; + } + var _this2 = this.p; + if(_this6 != null) { + _this6.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this42.stackVec3 = newArray4; + _this2.stackVec3 = newArray; } - _this42.stackVec3[_this42.sizeVec3++] = _this28; + _this2.stackVec3[_this2.sizeVec3++] = _this6; } - var _this43 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray5 = new Array(_this43.sizeVec3 << 1); - var _g8 = 0; - var _g16 = _this43.sizeVec3; - while(_g8 < _g16) { - var i7 = _g8++; - newArray5[i7] = _this43.stackVec3[i7]; - _this43.stackVec3[i7] = null; + var _this2 = this.p; + if(_this7 != null) { + _this7.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this43.stackVec3 = newArray5; - } - _this43.stackVec3[_this43.sizeVec3++] = _this31; - } - var _this44 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray6 = new Array(_this44.sizeVec3 << 1); - var _g9 = 0; - var _g17 = _this44.sizeVec3; - while(_g9 < _g17) { - var i8 = _g9++; - newArray6[i8] = _this44.stackVec3[i8]; - _this44.stackVec3[i8] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this7; + } + var _this2 = this.p; + if(_this8 != null) { + _this8.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this44.stackVec3 = newArray6; - } - _this44.stackVec3[_this44.sizeVec3++] = _this34; - } - var _this45 = this.p; - if(_this37 != null) { - _this37.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray7 = new Array(_this45.sizeVec3 << 1); - var _g10 = 0; - var _g18 = _this45.sizeVec3; - while(_g10 < _g18) { - var i9 = _g10++; - newArray7[i9] = _this45.stackVec3[i9]; - _this45.stackVec3[i9] = null; + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this8; + } + var _this2 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this45.stackVec3 = newArray7; + _this2.stackVec3 = newArray; } - _this45.stackVec3[_this45.sizeVec3++] = _this37; + _this2.stackVec3[_this2.sizeVec3++] = _this9; } } else { - var _g41 = 0; - while(_g41 < 8) { - var i10 = _g41++; - var _this46 = this.tmpCircleNorms[i10]; - var v5 = this.circleCoords[i10]; - _this46.x = v5.x; - _this46.y = v5.y; - _this46.z = v5.z; - var y1 = _this46.x * m.e10 + _this46.y * m.e11 + _this46.z * m.e12; - var z1 = _this46.x * m.e20 + _this46.y * m.e21 + _this46.z * m.e22; - _this46.x = _this46.x * m.e00 + _this46.y * m.e01 + _this46.z * m.e02; - _this46.y = y1; - _this46.z = z1; - var _this47 = this.tmpCircleVerts1[i10]; - var v6 = this.tmpCircleNorms[i10]; - _this47.x = v6.x; - _this47.y = v6.y; - _this47.z = v6.z; - _this47.x *= radius; - _this47.y *= radius; - _this47.z *= radius; - _this47.x += o.x; - _this47.y += o.y; - _this47.z += o.z; - var _this48 = this.tmpCircleVerts2[i10]; - var v7 = this.tmpCircleVerts1[i10]; - _this48.x = v7.x; - _this48.y = v7.y; - _this48.z = v7.z; - var _this49 = this.tmpCircleVerts1[i10]; - _this49.x += ey.x * halfHeight; - _this49.y += ey.y * halfHeight; - _this49.z += ey.z * halfHeight; - var _this50 = this.tmpCircleVerts2[i10]; - var s6 = -halfHeight; - _this50.x += ey.x * s6; - _this50.y += ey.y * s6; - _this50.z += ey.z * s6; - } - var _g51 = 0; - while(_g51 < 8) { - var i11 = _g51++; - var n12 = this.tmpCircleNorms[i11]; - var n22 = this.tmpCircleNorms[(i11 + 1) % 8]; - this.rect(this.tmpCircleVerts1[i11],this.tmpCircleVerts2[i11],this.tmpCircleVerts2[(i11 + 1) % 8],this.tmpCircleVerts1[(i11 + 1) % 8],n12,n12,n22,n22,color); - } - } - var _this51 = this.p; - if(_this10 != null) { - _this10.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray8 = new Array(_this51.sizeVec3 << 1); - var _g19 = 0; - var _g110 = _this51.sizeVec3; - while(_g19 < _g110) { - var i12 = _g19++; - newArray8[i12] = _this51.stackVec3[i12]; - _this51.stackVec3[i12] = null; - } - _this51.stackVec3 = newArray8; - } - _this51.stackVec3[_this51.sizeVec3++] = _this10; - } - var _this52 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray9 = new Array(_this52.sizeVec3 << 1); - var _g20 = 0; - var _g111 = _this52.sizeVec3; - while(_g20 < _g111) { - var i13 = _g20++; - newArray9[i13] = _this52.stackVec3[i13]; - _this52.stackVec3[i13] = null; - } - _this52.stackVec3 = newArray9; - } - _this52.stackVec3[_this52.sizeVec3++] = _this13; - } - var _this53 = this.p; + var _g = 0; + while(_g < 8) { + var i = _g++; + var _this2 = this.tmpCircleNorms[i]; + var v = this.circleCoords[i]; + _this2.x = v.x; + _this2.y = v.y; + _this2.z = v.z; + var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; + var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; + _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; + _this2.y = y; + _this2.z = z; + var _this3 = this.tmpCircleVerts1[i]; + var v1 = this.tmpCircleNorms[i]; + _this3.x = v1.x; + _this3.y = v1.y; + _this3.z = v1.z; + _this3.x *= radius; + _this3.y *= radius; + _this3.z *= radius; + _this3.x += o.x; + _this3.y += o.y; + _this3.z += o.z; + var _this4 = this.tmpCircleVerts2[i]; + var v2 = this.tmpCircleVerts1[i]; + _this4.x = v2.x; + _this4.y = v2.y; + _this4.z = v2.z; + var _this5 = this.tmpCircleVerts1[i]; + _this5.x += ey.x * halfHeight; + _this5.y += ey.y * halfHeight; + _this5.z += ey.z * halfHeight; + var _this6 = this.tmpCircleVerts2[i]; + var s = -halfHeight; + _this6.x += ey.x * s; + _this6.y += ey.y * s; + _this6.z += ey.z * s; + } + var _g = 0; + while(_g < 8) { + var i = _g++; + var n1 = this.tmpCircleNorms[i]; + var n2 = this.tmpCircleNorms[(i + 1) % 8]; + this.rect(this.tmpCircleVerts1[i],this.tmpCircleVerts2[i],this.tmpCircleVerts2[(i + 1) % 8],this.tmpCircleVerts1[(i + 1) % 8],n1,n1,n2,n2,color); + } + } + var _this2 = this.p; + if(_this != null) { + _this.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); + var _g = 0; + var _g1 = _this2.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; + } + _this2.stackVec3 = newArray; + } + _this2.stackVec3[_this2.sizeVec3++] = _this; + } + var _this = this.p; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this1; + } + var _this = this.p; if(o != null) { o.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray10 = new Array(_this53.sizeVec3 << 1); - var _g26 = 0; - var _g112 = _this53.sizeVec3; - while(_g26 < _g112) { - var i14 = _g26++; - newArray10[i14] = _this53.stackVec3[i14]; - _this53.stackVec3[i14] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this53.stackVec3 = newArray10; + _this.stackVec3 = newArray; } - _this53.stackVec3[_this53.sizeVec3++] = o; + _this.stackVec3[_this.sizeVec3++] = o; } - var _this54 = this.p; + var _this = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -9722,73 +9715,73 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this54.sizeMat3 == _this54.stackMat3.length) { - var newArray11 = new Array(_this54.sizeMat3 << 1); - var _g27 = 0; - var _g113 = _this54.sizeMat3; - while(_g27 < _g113) { - var i15 = _g27++; - newArray11[i15] = _this54.stackMat3[i15]; - _this54.stackMat3[i15] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this54.stackMat3 = newArray11; + _this.stackMat3 = newArray; } - _this54.stackMat3[_this54.sizeMat3++] = m; + _this.stackMat3[_this.sizeMat3++] = m; } - var _this55 = this.p; + var _this = this.p; if(ex != null) { ex.zero(); - if(_this55.sizeVec3 == _this55.stackVec3.length) { - var newArray12 = new Array(_this55.sizeVec3 << 1); - var _g28 = 0; - var _g114 = _this55.sizeVec3; - while(_g28 < _g114) { - var i16 = _g28++; - newArray12[i16] = _this55.stackVec3[i16]; - _this55.stackVec3[i16] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this55.stackVec3 = newArray12; + _this.stackVec3 = newArray; } - _this55.stackVec3[_this55.sizeVec3++] = ex; + _this.stackVec3[_this.sizeVec3++] = ex; } - var _this56 = this.p; + var _this = this.p; if(ey != null) { ey.zero(); - if(_this56.sizeVec3 == _this56.stackVec3.length) { - var newArray13 = new Array(_this56.sizeVec3 << 1); - var _g29 = 0; - var _g115 = _this56.sizeVec3; - while(_g29 < _g115) { - var i17 = _g29++; - newArray13[i17] = _this56.stackVec3[i17]; - _this56.stackVec3[i17] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this56.stackVec3 = newArray13; + _this.stackVec3 = newArray; } - _this56.stackVec3[_this56.sizeVec3++] = ey; + _this.stackVec3[_this.sizeVec3++] = ey; } - var _this57 = this.p; + var _this = this.p; if(ez != null) { ez.zero(); - if(_this57.sizeVec3 == _this57.stackVec3.length) { - var newArray14 = new Array(_this57.sizeVec3 << 1); - var _g30 = 0; - var _g116 = _this57.sizeVec3; - while(_g30 < _g116) { - var i18 = _g30++; - newArray14[i18] = _this57.stackVec3[i18]; - _this57.stackVec3[i18] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this57.stackVec3 = newArray14; + _this.stackVec3 = newArray; } - _this57.stackVec3[_this57.sizeVec3++] = ez; + _this.stackVec3[_this.sizeVec3++] = ez; } } ,sphere: function(tf,radius,color) { var _this = this.p; var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var m = _this1.sizeMat3 == 0 ? new oimo_common_Mat3() : _this1.stackMat3[--_this1.sizeMat3]; + var _this = this.p; + var m = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; var v = o; v.x = tf._positionX; v.y = tf._positionY; @@ -9812,109 +9805,109 @@ oimo_dynamics_common_DebugDraw.prototype = { var _g1 = 0; while(_g1 < n) { var j = _g1++; - var _this2 = ns[i][j]; - var v1 = this.sphereCoords[i][j]; - _this2.x = v1.x; - _this2.y = v1.y; - _this2.z = v1.z; - var y = _this2.x * m.e10 + _this2.y * m.e11 + _this2.z * m.e12; - var z = _this2.x * m.e20 + _this2.y * m.e21 + _this2.z * m.e22; - _this2.x = _this2.x * m.e00 + _this2.y * m.e01 + _this2.z * m.e02; - _this2.y = y; - _this2.z = z; - var _this3 = vs[i][j]; - var v2 = ns[i][j]; - _this3.x = v2.x; - _this3.y = v2.y; - _this3.z = v2.z; - _this3.x *= radius; - _this3.y *= radius; - _this3.z *= radius; - _this3.x += o.x; - _this3.y += o.y; - _this3.z += o.z; + var _this = ns[i][j]; + var v = this.sphereCoords[i][j]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var y = _this.x * m.e10 + _this.y * m.e11 + _this.z * m.e12; + var z = _this.x * m.e20 + _this.y * m.e21 + _this.z * m.e22; + _this.x = _this.x * m.e00 + _this.y * m.e01 + _this.z * m.e02; + _this.y = y; + _this.z = z; + var _this1 = vs[i][j]; + var v1 = ns[i][j]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + _this1.x *= radius; + _this1.y *= radius; + _this1.z *= radius; + _this1.x += o.x; + _this1.y += o.y; + _this1.z += o.z; } } - var _g2 = 0; - while(_g2 < 4) { - var i1 = _g2++; - var _g21 = 0; - while(_g21 < 8) { - var j1 = _g21++; - var v11; - var v21; + var _g = 0; + while(_g < 4) { + var i = _g++; + var _g1 = 0; + while(_g1 < 8) { + var j = _g1++; + var v1; + var v2; var v3; var v4; var n1; var n2; var n3; var n4; - if(i1 == 0) { + if(i == 0) { if(this.wireframe) { - v11 = vs[0][0]; - v21 = vs[1][j1]; - this.line(v11,v21,color); + v1 = vs[0][0]; + v2 = vs[1][j]; + this.line(v1,v2,color); } else { - v11 = vs[0][0]; - v21 = vs[1][j1]; - v3 = vs[1][(j1 + 1) % 8]; + v1 = vs[0][0]; + v2 = vs[1][j]; + v3 = vs[1][(j + 1) % 8]; n1 = ns[0][0]; - n2 = ns[1][j1]; - n3 = ns[1][(j1 + 1) % 8]; - this.triangle(v11,v21,v3,n1,n2,n3,color); + n2 = ns[1][j]; + n3 = ns[1][(j + 1) % 8]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } - } else if(i1 == 3) { + } else if(i == 3) { if(this.wireframe) { - v11 = vs[4][0]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1][j1]; - this.line(v11,v21,color); - this.line(v21,v3,color); + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; + this.line(v1,v2,color); + this.line(v2,v3,color); } else { - v11 = vs[4][0]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1][j1]; + v1 = vs[4][0]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i][j]; n1 = ns[4][0]; - n2 = ns[i1][(j1 + 1) % 8]; - n3 = ns[i1][j1]; - this.triangle(v11,v21,v3,n1,n2,n3,color); + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i][j]; + this.triangle(v1,v2,v3,n1,n2,n3,color); } } else if(this.wireframe) { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1 + 1][j1]; - this.line(v11,v21,color); - this.line(v11,v3,color); + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + this.line(v1,v2,color); + this.line(v1,v3,color); } else { - v11 = vs[i1][j1]; - v21 = vs[i1][(j1 + 1) % 8]; - v3 = vs[i1 + 1][j1]; - v4 = vs[i1 + 1][(j1 + 1) % 8]; - n1 = ns[i1][j1]; - n2 = ns[i1][(j1 + 1) % 8]; - n3 = ns[i1 + 1][j1]; - n4 = ns[i1 + 1][(j1 + 1) % 8]; - this.rect(v11,v3,v4,v21,n1,n3,n4,n2,color); + v1 = vs[i][j]; + v2 = vs[i][(j + 1) % 8]; + v3 = vs[i + 1][j]; + v4 = vs[i + 1][(j + 1) % 8]; + n1 = ns[i][j]; + n2 = ns[i][(j + 1) % 8]; + n3 = ns[i + 1][j]; + n4 = ns[i + 1][(j + 1) % 8]; + this.rect(v1,v3,v4,v2,n1,n3,n4,n2,color); } } } - var _this4 = this.p; + var _this = this.p; if(o != null) { o.zero(); - if(_this4.sizeVec3 == _this4.stackVec3.length) { - var newArray = new Array(_this4.sizeVec3 << 1); - var _g3 = 0; - var _g11 = _this4.sizeVec3; - while(_g3 < _g11) { - var i2 = _g3++; - newArray[i2] = _this4.stackVec3[i2]; - _this4.stackVec3[i2] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this4.stackVec3 = newArray; + _this.stackVec3 = newArray; } - _this4.stackVec3[_this4.sizeVec3++] = o; + _this.stackVec3[_this.sizeVec3++] = o; } - var _this5 = this.p; + var _this = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -9925,31 +9918,31 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this5.sizeMat3 == _this5.stackMat3.length) { - var newArray1 = new Array(_this5.sizeMat3 << 1); - var _g4 = 0; - var _g12 = _this5.sizeMat3; - while(_g4 < _g12) { - var i3 = _g4++; - newArray1[i3] = _this5.stackMat3[i3]; - _this5.stackMat3[i3] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this5.stackMat3 = newArray1; + _this.stackMat3 = newArray; } - _this5.stackMat3[_this5.sizeMat3++] = m; + _this.stackMat3[_this.sizeMat3++] = m; } } ,box: function(tf,halfExtents,color) { var _this = this.p; var ex = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this.p; - var ey = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; - var _this2 = this.p; - var ez = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; - var _this3 = this.p; - var o = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - var _this4 = this.p; - var m = _this4.sizeMat3 == 0 ? new oimo_common_Mat3() : _this4.stackMat3[--_this4.sizeMat3]; + var _this = this.p; + var ey = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var ez = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var o = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this = this.p; + var m = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; var v = o; v.x = tf._positionX; v.y = tf._positionY; @@ -9970,379 +9963,379 @@ oimo_dynamics_common_DebugDraw.prototype = { var hx = halfExtents.x; var hy = halfExtents.y; var hz = halfExtents.z; + var _this = this.p; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = o.x; + _this1.y = o.y; + _this1.z = o.z; + var _this = _this1; + var s = -hx; + _this.x += ex.x * s; + _this.y += ex.y * s; + _this.z += ex.z * s; + var s = -hy; + _this.x += ey.x * s; + _this.y += ey.y * s; + _this.z += ey.z * s; + var s = -hz; + _this.x += ez.x * s; + _this.y += ez.y * s; + _this.z += ez.z * s; + var _this1 = this.p; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = o.x; + _this2.y = o.y; + _this2.z = o.z; + var _this1 = _this2; + var s = -hx; + _this1.x += ex.x * s; + _this1.y += ex.y * s; + _this1.z += ex.z * s; + var s = -hy; + _this1.x += ey.x * s; + _this1.y += ey.y * s; + _this1.z += ey.z * s; + _this1.x += ez.x * hz; + _this1.y += ez.y * hz; + _this1.z += ez.z * hz; + var _this2 = this.p; + var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + _this3.x = o.x; + _this3.y = o.y; + _this3.z = o.z; + var _this2 = _this3; + var s = -hx; + _this2.x += ex.x * s; + _this2.y += ex.y * s; + _this2.z += ex.z * s; + _this2.x += ey.x * hy; + _this2.y += ey.y * hy; + _this2.z += ey.z * hy; + var s = -hz; + _this2.x += ez.x * s; + _this2.y += ez.y * s; + _this2.z += ez.z * s; + var _this3 = this.p; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = o.x; + _this4.y = o.y; + _this4.z = o.z; + var _this3 = _this4; + var s = -hx; + _this3.x += ex.x * s; + _this3.y += ex.y * s; + _this3.z += ex.z * s; + _this3.x += ey.x * hy; + _this3.y += ey.y * hy; + _this3.z += ey.z * hy; + _this3.x += ez.x * hz; + _this3.y += ez.y * hz; + _this3.z += ez.z * hz; + var _this4 = this.p; + var _this5 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + _this5.x = o.x; + _this5.y = o.y; + _this5.z = o.z; + var _this4 = _this5; + _this4.x += ex.x * hx; + _this4.y += ex.y * hx; + _this4.z += ex.z * hx; + var s = -hy; + _this4.x += ey.x * s; + _this4.y += ey.y * s; + _this4.z += ey.z * s; + var s = -hz; + _this4.x += ez.x * s; + _this4.y += ez.y * s; + _this4.z += ez.z * s; var _this5 = this.p; var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; _this6.x = o.x; _this6.y = o.y; _this6.z = o.z; - var _this7 = _this6; - var s = -hx; - _this7.x += ex.x * s; - _this7.y += ex.y * s; - _this7.z += ex.z * s; - var s1 = -hy; - _this7.x += ey.x * s1; - _this7.y += ey.y * s1; - _this7.z += ey.z * s1; - var s2 = -hz; - _this7.x += ez.x * s2; - _this7.y += ez.y * s2; - _this7.z += ez.z * s2; - var _this8 = this.p; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - _this9.x = o.x; - _this9.y = o.y; - _this9.z = o.z; - var _this10 = _this9; - var s3 = -hx; - _this10.x += ex.x * s3; - _this10.y += ex.y * s3; - _this10.z += ex.z * s3; - var s4 = -hy; - _this10.x += ey.x * s4; - _this10.y += ey.y * s4; - _this10.z += ey.z * s4; - _this10.x += ez.x * hz; - _this10.y += ez.y * hz; - _this10.z += ez.z * hz; - var _this11 = this.p; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = o.x; - _this12.y = o.y; - _this12.z = o.z; - var _this13 = _this12; - var s5 = -hx; - _this13.x += ex.x * s5; - _this13.y += ex.y * s5; - _this13.z += ex.z * s5; - _this13.x += ey.x * hy; - _this13.y += ey.y * hy; - _this13.z += ey.z * hy; - var s6 = -hz; - _this13.x += ez.x * s6; - _this13.y += ez.y * s6; - _this13.z += ez.z * s6; - var _this14 = this.p; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = o.x; - _this15.y = o.y; - _this15.z = o.z; - var _this16 = _this15; - var s7 = -hx; - _this16.x += ex.x * s7; - _this16.y += ex.y * s7; - _this16.z += ex.z * s7; - _this16.x += ey.x * hy; - _this16.y += ey.y * hy; - _this16.z += ey.z * hy; - _this16.x += ez.x * hz; - _this16.y += ez.y * hz; - _this16.z += ez.z * hz; - var _this17 = this.p; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = o.x; - _this18.y = o.y; - _this18.z = o.z; - var _this19 = _this18; - _this19.x += ex.x * hx; - _this19.y += ex.y * hx; - _this19.z += ex.z * hx; - var s8 = -hy; - _this19.x += ey.x * s8; - _this19.y += ey.y * s8; - _this19.z += ey.z * s8; - var s9 = -hz; - _this19.x += ez.x * s9; - _this19.y += ez.y * s9; - _this19.z += ez.z * s9; - var _this20 = this.p; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = o.x; - _this21.y = o.y; - _this21.z = o.z; - var _this22 = _this21; - _this22.x += ex.x * hx; - _this22.y += ex.y * hx; - _this22.z += ex.z * hx; - var s10 = -hy; - _this22.x += ey.x * s10; - _this22.y += ey.y * s10; - _this22.z += ey.z * s10; - _this22.x += ez.x * hz; - _this22.y += ez.y * hz; - _this22.z += ez.z * hz; - var _this23 = this.p; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = o.x; - _this24.y = o.y; - _this24.z = o.z; - var _this25 = _this24; - _this25.x += ex.x * hx; - _this25.y += ex.y * hx; - _this25.z += ex.z * hx; - _this25.x += ey.x * hy; - _this25.y += ey.y * hy; - _this25.z += ey.z * hy; - var s11 = -hz; - _this25.x += ez.x * s11; - _this25.y += ez.y * s11; - _this25.z += ez.z * s11; - var _this26 = this.p; - var _this27 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - _this27.x = o.x; - _this27.y = o.y; - _this27.z = o.z; - var _this28 = _this27; - _this28.x += ex.x * hx; - _this28.y += ex.y * hx; - _this28.z += ex.z * hx; - _this28.x += ey.x * hy; - _this28.y += ey.y * hy; - _this28.z += ey.z * hy; - _this28.x += ez.x * hz; - _this28.y += ez.y * hz; - _this28.z += ez.z * hz; + var _this5 = _this6; + _this5.x += ex.x * hx; + _this5.y += ex.y * hx; + _this5.z += ex.z * hx; + var s = -hy; + _this5.x += ey.x * s; + _this5.y += ey.y * s; + _this5.z += ey.z * s; + _this5.x += ez.x * hz; + _this5.y += ez.y * hz; + _this5.z += ez.z * hz; + var _this6 = this.p; + var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = o.x; + _this7.y = o.y; + _this7.z = o.z; + var _this6 = _this7; + _this6.x += ex.x * hx; + _this6.y += ex.y * hx; + _this6.z += ex.z * hx; + _this6.x += ey.x * hy; + _this6.y += ey.y * hy; + _this6.z += ey.z * hy; + var s = -hz; + _this6.x += ez.x * s; + _this6.y += ez.y * s; + _this6.z += ez.z * s; + var _this7 = this.p; + var _this8 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + _this8.x = o.x; + _this8.y = o.y; + _this8.z = o.z; + var _this7 = _this8; + _this7.x += ex.x * hx; + _this7.y += ex.y * hx; + _this7.z += ex.z * hx; + _this7.x += ey.x * hy; + _this7.y += ey.y * hy; + _this7.z += ey.z * hy; + _this7.x += ez.x * hz; + _this7.y += ez.y * hz; + _this7.z += ez.z * hz; if(this.wireframe) { - this.line(_this7,_this10,color); - this.line(_this13,_this16,color); - this.line(_this19,_this22,color); - this.line(_this25,_this28,color); - this.line(_this7,_this13,color); - this.line(_this10,_this16,color); - this.line(_this19,_this25,color); - this.line(_this22,_this28,color); - this.line(_this7,_this19,color); - this.line(_this10,_this22,color); - this.line(_this13,_this25,color); - this.line(_this16,_this28,color); + this.line(_this,_this1,color); + this.line(_this2,_this3,color); + this.line(_this4,_this5,color); + this.line(_this6,_this7,color); + this.line(_this,_this2,color); + this.line(_this1,_this3,color); + this.line(_this4,_this6,color); + this.line(_this5,_this7,color); + this.line(_this,_this4,color); + this.line(_this1,_this5,color); + this.line(_this2,_this6,color); + this.line(_this3,_this7,color); } else { - var _this29 = this.p; - var _this30 = _this29.sizeVec3 == 0 ? new oimo_common_Vec3() : _this29.stackVec3[--_this29.sizeVec3]; - _this30.x = ex.x; - _this30.y = ex.y; - _this30.z = ex.z; - var _this31 = _this30; - _this31.x = -_this31.x; - _this31.y = -_this31.y; - _this31.z = -_this31.z; - var _this32 = this.p; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = ey.x; - _this33.y = ey.y; - _this33.z = ey.z; - var _this34 = _this33; - _this34.x = -_this34.x; - _this34.y = -_this34.y; - _this34.z = -_this34.z; - var _this35 = this.p; - var _this36 = _this35.sizeVec3 == 0 ? new oimo_common_Vec3() : _this35.stackVec3[--_this35.sizeVec3]; - _this36.x = ez.x; - _this36.y = ez.y; - _this36.z = ez.z; - var _this37 = _this36; - _this37.x = -_this37.x; - _this37.y = -_this37.y; - _this37.z = -_this37.z; - this.rect(_this7,_this10,_this16,_this13,_this31,_this31,_this31,_this31,color); - this.rect(_this19,_this25,_this28,_this22,ex,ex,ex,ex,color); - this.rect(_this7,_this19,_this22,_this10,_this34,_this34,_this34,_this34,color); - this.rect(_this13,_this16,_this28,_this25,ey,ey,ey,ey,color); - this.rect(_this7,_this13,_this25,_this19,_this37,_this37,_this37,_this37,color); - this.rect(_this10,_this22,_this28,_this16,ez,ez,ez,ez,color); - var _this38 = this.p; - if(_this31 != null) { - _this31.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray = new Array(_this38.sizeVec3 << 1); + var _this8 = this.p; + var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + _this9.x = ex.x; + _this9.y = ex.y; + _this9.z = ex.z; + var _this8 = _this9; + _this8.x = -_this8.x; + _this8.y = -_this8.y; + _this8.z = -_this8.z; + var _this9 = this.p; + var _this10 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + _this10.x = ey.x; + _this10.y = ey.y; + _this10.z = ey.z; + var _this9 = _this10; + _this9.x = -_this9.x; + _this9.y = -_this9.y; + _this9.z = -_this9.z; + var _this10 = this.p; + var _this11 = _this10.sizeVec3 == 0 ? new oimo_common_Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = ez.x; + _this11.y = ez.y; + _this11.z = ez.z; + var _this10 = _this11; + _this10.x = -_this10.x; + _this10.y = -_this10.y; + _this10.z = -_this10.z; + this.rect(_this,_this1,_this3,_this2,_this8,_this8,_this8,_this8,color); + this.rect(_this4,_this6,_this7,_this5,ex,ex,ex,ex,color); + this.rect(_this,_this4,_this5,_this1,_this9,_this9,_this9,_this9,color); + this.rect(_this2,_this3,_this7,_this6,ey,ey,ey,ey,color); + this.rect(_this,_this2,_this6,_this4,_this10,_this10,_this10,_this10,color); + this.rect(_this1,_this5,_this7,_this3,ez,ez,ez,ez,color); + var _this11 = this.p; + if(_this8 != null) { + _this8.zero(); + if(_this11.sizeVec3 == _this11.stackVec3.length) { + var newArray = new Array(_this11.sizeVec3 << 1); var _g = 0; - var _g1 = _this38.sizeVec3; + var _g1 = _this11.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this38.stackVec3[i]; - _this38.stackVec3[i] = null; + newArray[i] = _this11.stackVec3[i]; + _this11.stackVec3[i] = null; } - _this38.stackVec3 = newArray; + _this11.stackVec3 = newArray; } - _this38.stackVec3[_this38.sizeVec3++] = _this31; + _this11.stackVec3[_this11.sizeVec3++] = _this8; } - var _this39 = this.p; - if(_this34 != null) { - _this34.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray1 = new Array(_this39.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this39.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this39.stackVec3[i1]; - _this39.stackVec3[i1] = null; + var _this8 = this.p; + if(_this9 != null) { + _this9.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; } - _this39.stackVec3 = newArray1; + _this8.stackVec3 = newArray; } - _this39.stackVec3[_this39.sizeVec3++] = _this34; + _this8.stackVec3[_this8.sizeVec3++] = _this9; } - var _this40 = this.p; - if(_this37 != null) { - _this37.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray2 = new Array(_this40.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this40.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this40.stackVec3[i2]; - _this40.stackVec3[i2] = null; + var _this8 = this.p; + if(_this10 != null) { + _this10.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; } - _this40.stackVec3 = newArray2; + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = _this10; + } + } + var _this8 = this.p; + if(_this != null) { + _this.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = _this; + } + var _this = this.p; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this1; + } + var _this = this.p; + if(_this2 != null) { + _this2.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this2; + } + var _this = this.p; + if(_this3 != null) { + _this3.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this40.stackVec3[_this40.sizeVec3++] = _this37; + _this.stackVec3 = newArray; } + _this.stackVec3[_this.sizeVec3++] = _this3; } - var _this41 = this.p; + var _this = this.p; + if(_this4 != null) { + _this4.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this4; + } + var _this = this.p; + if(_this5 != null) { + _this5.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this5; + } + var _this = this.p; + if(_this6 != null) { + _this6.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this6; + } + var _this = this.p; if(_this7 != null) { _this7.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray3 = new Array(_this41.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this41.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this41.stackVec3[i3]; - _this41.stackVec3[i3] = null; - } - _this41.stackVec3 = newArray3; - } - _this41.stackVec3[_this41.sizeVec3++] = _this7; - } - var _this42 = this.p; - if(_this10 != null) { - _this10.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray4 = new Array(_this42.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this42.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this42.stackVec3[i4]; - _this42.stackVec3[i4] = null; - } - _this42.stackVec3 = newArray4; - } - _this42.stackVec3[_this42.sizeVec3++] = _this10; - } - var _this43 = this.p; - if(_this13 != null) { - _this13.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray5 = new Array(_this43.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this43.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this43.stackVec3[i5]; - _this43.stackVec3[i5] = null; - } - _this43.stackVec3 = newArray5; - } - _this43.stackVec3[_this43.sizeVec3++] = _this13; - } - var _this44 = this.p; - if(_this16 != null) { - _this16.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray6 = new Array(_this44.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this44.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this44.stackVec3[i6]; - _this44.stackVec3[i6] = null; - } - _this44.stackVec3 = newArray6; - } - _this44.stackVec3[_this44.sizeVec3++] = _this16; - } - var _this45 = this.p; - if(_this19 != null) { - _this19.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray7 = new Array(_this45.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this45.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this45.stackVec3[i7]; - _this45.stackVec3[i7] = null; - } - _this45.stackVec3 = newArray7; - } - _this45.stackVec3[_this45.sizeVec3++] = _this19; - } - var _this46 = this.p; - if(_this22 != null) { - _this22.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newArray8 = new Array(_this46.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this46.sizeVec3; - while(_g9 < _g18) { - var i8 = _g9++; - newArray8[i8] = _this46.stackVec3[i8]; - _this46.stackVec3[i8] = null; - } - _this46.stackVec3 = newArray8; - } - _this46.stackVec3[_this46.sizeVec3++] = _this22; - } - var _this47 = this.p; - if(_this25 != null) { - _this25.zero(); - if(_this47.sizeVec3 == _this47.stackVec3.length) { - var newArray9 = new Array(_this47.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this47.sizeVec3; - while(_g10 < _g19) { - var i9 = _g10++; - newArray9[i9] = _this47.stackVec3[i9]; - _this47.stackVec3[i9] = null; - } - _this47.stackVec3 = newArray9; - } - _this47.stackVec3[_this47.sizeVec3++] = _this25; - } - var _this48 = this.p; - if(_this28 != null) { - _this28.zero(); - if(_this48.sizeVec3 == _this48.stackVec3.length) { - var newArray10 = new Array(_this48.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this48.sizeVec3; - while(_g20 < _g110) { - var i10 = _g20++; - newArray10[i10] = _this48.stackVec3[i10]; - _this48.stackVec3[i10] = null; - } - _this48.stackVec3 = newArray10; - } - _this48.stackVec3[_this48.sizeVec3++] = _this28; - } - var _this49 = this.p; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this7; + } + var _this = this.p; if(o != null) { o.zero(); - if(_this49.sizeVec3 == _this49.stackVec3.length) { - var newArray11 = new Array(_this49.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this49.sizeVec3; - while(_g21 < _g111) { - var i11 = _g21++; - newArray11[i11] = _this49.stackVec3[i11]; - _this49.stackVec3[i11] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this49.stackVec3 = newArray11; + _this.stackVec3 = newArray; } - _this49.stackVec3[_this49.sizeVec3++] = o; + _this.stackVec3[_this.sizeVec3++] = o; } - var _this50 = this.p; + var _this = this.p; if(m != null) { m.e00 = 1; m.e01 = 0; @@ -10353,66 +10346,66 @@ oimo_dynamics_common_DebugDraw.prototype = { m.e20 = 0; m.e21 = 0; m.e22 = 1; - if(_this50.sizeMat3 == _this50.stackMat3.length) { - var newArray12 = new Array(_this50.sizeMat3 << 1); - var _g22 = 0; - var _g112 = _this50.sizeMat3; - while(_g22 < _g112) { - var i12 = _g22++; - newArray12[i12] = _this50.stackMat3[i12]; - _this50.stackMat3[i12] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this50.stackMat3 = newArray12; + _this.stackMat3 = newArray; } - _this50.stackMat3[_this50.sizeMat3++] = m; + _this.stackMat3[_this.sizeMat3++] = m; } - var _this51 = this.p; + var _this = this.p; if(ex != null) { ex.zero(); - if(_this51.sizeVec3 == _this51.stackVec3.length) { - var newArray13 = new Array(_this51.sizeVec3 << 1); - var _g23 = 0; - var _g113 = _this51.sizeVec3; - while(_g23 < _g113) { - var i13 = _g23++; - newArray13[i13] = _this51.stackVec3[i13]; - _this51.stackVec3[i13] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this51.stackVec3 = newArray13; + _this.stackVec3 = newArray; } - _this51.stackVec3[_this51.sizeVec3++] = ex; + _this.stackVec3[_this.sizeVec3++] = ex; } - var _this52 = this.p; + var _this = this.p; if(ey != null) { ey.zero(); - if(_this52.sizeVec3 == _this52.stackVec3.length) { - var newArray14 = new Array(_this52.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this52.sizeVec3; - while(_g24 < _g114) { - var i14 = _g24++; - newArray14[i14] = _this52.stackVec3[i14]; - _this52.stackVec3[i14] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this52.stackVec3 = newArray14; + _this.stackVec3 = newArray; } - _this52.stackVec3[_this52.sizeVec3++] = ey; + _this.stackVec3[_this.sizeVec3++] = ey; } - var _this53 = this.p; + var _this = this.p; if(ez != null) { ez.zero(); - if(_this53.sizeVec3 == _this53.stackVec3.length) { - var newArray15 = new Array(_this53.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this53.sizeVec3; - while(_g25 < _g115) { - var i15 = _g25++; - newArray15[i15] = _this53.stackVec3[i15]; - _this53.stackVec3[i15] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this53.stackVec3 = newArray15; + _this.stackVec3 = newArray; } - _this53.stackVec3[_this53.sizeVec3++] = ez; + _this.stackVec3[_this.sizeVec3++] = ez; } } ,rect: function(v1,v2,v3,v4,n1,n2,n3,n4,color) { @@ -10495,10 +10488,10 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr this.pointIBO.setData(ibo,35048); vbo = []; ibo = []; - var _g2 = 0; - var _g3 = this.lineBufferSize; - while(_g2 < _g3) { - var i = _g2++; + var _g = 0; + var _g1 = this.lineBufferSize; + while(_g < _g1) { + var i = _g++; vbo.push(0); vbo.push(0); vbo.push(0); @@ -10524,10 +10517,10 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr this.lineIBO.setData(ibo,35048); vbo = []; ibo = []; - var _g4 = 0; - var _g5 = this.triBufferSize; - while(_g4 < _g5) { - var i1 = _g4++; + var _g = 0; + var _g1 = this.triBufferSize; + while(_g < _g1) { + var i = _g++; vbo.push(0); vbo.push(0); vbo.push(0); @@ -10555,9 +10548,9 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr vbo.push(0); vbo.push(0); vbo.push(0); - ibo.push(i1 * 3); - ibo.push(i1 * 3 + 1); - ibo.push(i1 * 3 + 2); + ibo.push(i * 3); + ibo.push(i * 3 + 1); + ibo.push(i * 3 + 2); } this.triVBO.setData(vbo,35048); this.triIBO.setData(ibo,35048); @@ -10632,27 +10625,27 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr _this.e32 = -d23 * invDet; _this.e33 = d33 * invDet; this.cameraPos.init(this.viewMat.e03,this.viewMat.e13,this.viewMat.e23); - var _this1 = this.lightDir.init(this.viewMat.e02,this.viewMat.e12,this.viewMat.e22); - _this1.x *= -1; - _this1.y *= -1; - _this1.z *= -1; - var _this2 = this.viewMat; - _this2.e00 = matrix.e00; - _this2.e01 = matrix.e01; - _this2.e02 = matrix.e02; - _this2.e03 = matrix.e03; - _this2.e10 = matrix.e10; - _this2.e11 = matrix.e11; - _this2.e12 = matrix.e12; - _this2.e13 = matrix.e13; - _this2.e20 = matrix.e20; - _this2.e21 = matrix.e21; - _this2.e22 = matrix.e22; - _this2.e23 = matrix.e23; - _this2.e30 = matrix.e30; - _this2.e31 = matrix.e31; - _this2.e32 = matrix.e32; - _this2.e33 = matrix.e33; + var _this = this.lightDir.init(this.viewMat.e02,this.viewMat.e12,this.viewMat.e22); + _this.x *= -1; + _this.y *= -1; + _this.z *= -1; + var _this = this.viewMat; + _this.e00 = matrix.e00; + _this.e01 = matrix.e01; + _this.e02 = matrix.e02; + _this.e03 = matrix.e03; + _this.e10 = matrix.e10; + _this.e11 = matrix.e11; + _this.e12 = matrix.e12; + _this.e13 = matrix.e13; + _this.e20 = matrix.e20; + _this.e21 = matrix.e21; + _this.e22 = matrix.e22; + _this.e23 = matrix.e23; + _this.e30 = matrix.e30; + _this.e31 = matrix.e31; + _this.e32 = matrix.e32; + _this.e33 = matrix.e33; } ,setProjectionMatrix: function(matrix) { var _this = this.projMat; @@ -10682,12 +10675,12 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr this.shader.use(); var matrix = this.viewMat; this.gl.uniformMatrix4fv(this.shader.getUniformLocation("viewMat"),false,[matrix.e00,matrix.e10,matrix.e20,matrix.e30,matrix.e01,matrix.e11,matrix.e21,matrix.e31,matrix.e02,matrix.e12,matrix.e22,matrix.e32,matrix.e03,matrix.e13,matrix.e23,matrix.e33]); - var matrix1 = this.projMat; - this.gl.uniformMatrix4fv(this.shader.getUniformLocation("projMat"),false,[matrix1.e00,matrix1.e10,matrix1.e20,matrix1.e30,matrix1.e01,matrix1.e11,matrix1.e21,matrix1.e31,matrix1.e02,matrix1.e12,matrix1.e22,matrix1.e32,matrix1.e03,matrix1.e13,matrix1.e23,matrix1.e33]); + var matrix = this.projMat; + this.gl.uniformMatrix4fv(this.shader.getUniformLocation("projMat"),false,[matrix.e00,matrix.e10,matrix.e20,matrix.e30,matrix.e01,matrix.e11,matrix.e21,matrix.e31,matrix.e02,matrix.e12,matrix.e22,matrix.e32,matrix.e03,matrix.e13,matrix.e23,matrix.e33]); var v = this.cameraPos; this.gl.uniform3f(this.shader.getUniformLocation("cameraPos"),v.x,v.y,v.z); - var v1 = this.lightDir; - this.gl.uniform3f(this.shader.getUniformLocation("lightDir"),v1.x,v1.y,v1.z); + var v = this.lightDir; + this.gl.uniform3f(this.shader.getUniformLocation("lightDir"),v.x,v.y,v.z); this.gl.uniform3f(this.shader.getUniformLocation("lightCol"),1,1,1); var _this = this.tmpMat; _this.e00 = 1; @@ -10706,8 +10699,8 @@ demo_js_WebGLDebugGraphics.prototype = $extend(oimo_dynamics_common_DebugDraw.pr _this.e31 = 0; _this.e32 = 0; _this.e33 = 1; - var matrix2 = this.tmpMat; - this.gl.uniformMatrix4fv(this.shader.getUniformLocation("worldMat"),false,[matrix2.e00,matrix2.e10,matrix2.e20,matrix2.e30,matrix2.e01,matrix2.e11,matrix2.e21,matrix2.e31,matrix2.e02,matrix2.e12,matrix2.e22,matrix2.e32,matrix2.e03,matrix2.e13,matrix2.e23,matrix2.e33]); + var matrix = this.tmpMat; + this.gl.uniformMatrix4fv(this.shader.getUniformLocation("worldMat"),false,[matrix.e00,matrix.e10,matrix.e20,matrix.e30,matrix.e01,matrix.e11,matrix.e21,matrix.e31,matrix.e02,matrix.e12,matrix.e22,matrix.e32,matrix.e03,matrix.e13,matrix.e23,matrix.e33]); this.numPointData = 0; this.numLineData = 0; this.numTriData = 0; @@ -10966,22 +10959,11 @@ demo_js_minilib_OShader.prototype = { return this.gl.getAttribLocation(this.program,name); } ,getUniformLocation: function(name) { - var _this = this.uniformLocationMap; - if(__map_reserved[name] != null ? _this.existsReserved(name) : _this.h.hasOwnProperty(name)) { - var _this1 = this.uniformLocationMap; - if(__map_reserved[name] != null) { - return _this1.getReserved(name); - } else { - return _this1.h[name]; - } + if(Object.prototype.hasOwnProperty.call(this.uniformLocationMap.h,name)) { + return this.uniformLocationMap.h[name]; } var location = this.gl.getUniformLocation(this.program,name); - var _this2 = this.uniformLocationMap; - if(__map_reserved[name] != null) { - _this2.setReserved(name,location); - } else { - _this2.h[name] = location; - } + this.uniformLocationMap.h[name] = location; return location; } ,getAttribIndices: function(attribs) { @@ -10997,7 +10979,8 @@ demo_js_minilib_OShader.prototype = { this.gl.shaderSource(shader,source); this.gl.compileShader(shader); if(!this.gl.getShaderParameter(shader,35713)) { - window.alert(Std.string(this.gl.getShaderInfoLog(shader))); + var v = this.gl.getShaderInfoLog(shader); + window.alert(Std.string(v)); } } ,__class__: demo_js_minilib_OShader @@ -11053,7 +11036,7 @@ demo_js_minilib_OVertexBuffer.prototype = { usage = 35044; } if(this.attribs == null) { - throw new js__$Boot_HaxeError("set attributes first"); + throw haxe_Exception.thrown("set attributes first"); } this.numVertices = array.length / (this.stride / 4); this.gl.bindBuffer(34962,this.buffer); @@ -11086,7 +11069,7 @@ demo_js_minilib_OVertexBuffer.prototype = { } ,bindAttribs: function() { if(this.indices == null) { - throw new js__$Boot_HaxeError("indices are not loaded"); + throw haxe_Exception.thrown("indices are not loaded"); } var num = this.attribs.length; this.gl.bindBuffer(34962,this.buffer); @@ -11103,45 +11086,61 @@ demo_js_minilib_OVertexBuffer.prototype = { var haxe_IMap = function() { }; haxe_IMap.__name__ = true; haxe_IMap.__isInterface__ = true; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + get_native: function() { + return this.__nativeException; + } + ,__class__: haxe_Exception +}); +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + __class__: haxe_ValueException +}); var haxe_ds_StringMap = function() { - this.h = { }; + this.h = Object.create(null); }; haxe_ds_StringMap.__name__ = true; haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; haxe_ds_StringMap.prototype = { - setReserved: function(key,value) { - if(this.rh == null) { - this.rh = { }; - } - this.rh["$" + key] = value; - } - ,getReserved: function(key) { - if(this.rh == null) { - return null; - } else { - return this.rh["$" + key]; - } - } - ,existsReserved: function(key) { - if(this.rh == null) { - return false; - } - return this.rh.hasOwnProperty("$" + key); - } - ,__class__: haxe_ds_StringMap + __class__: haxe_ds_StringMap }; -var js__$Boot_HaxeError = function(val) { - Error.call(this); - this.val = val; - if(Error.captureStackTrace) { - Error.captureStackTrace(this,js__$Boot_HaxeError); +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; } + ,__class__: haxe_iterators_ArrayIterator }; -js__$Boot_HaxeError.__name__ = true; -js__$Boot_HaxeError.__super__ = Error; -js__$Boot_HaxeError.prototype = $extend(Error.prototype,{ - __class__: js__$Boot_HaxeError -}); var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.getClass = function(o) { @@ -11179,10 +11178,10 @@ js_Boot.__string_rec = function(o,s) { if(((o) instanceof Array)) { var str = "["; s += "\t"; - var _g3 = 0; - var _g11 = o.length; - while(_g3 < _g11) { - var i = _g3++; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); } str += "]"; @@ -11191,8 +11190,7 @@ js_Boot.__string_rec = function(o,s) { var tostr; try { tostr = o.toString; - } catch( e1 ) { - var e2 = ((e1) instanceof js__$Boot_HaxeError) ? e1.val : e1; + } catch( _g ) { return "???"; } if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { @@ -11201,7 +11199,7 @@ js_Boot.__string_rec = function(o,s) { return s2; } } - var str1 = "{\n"; + var str = "{\n"; s += "\t"; var hasp = o.hasOwnProperty != null; var k = null; @@ -11212,14 +11210,14 @@ js_Boot.__string_rec = function(o,s) { if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { continue; } - if(str1.length != 2) { - str1 += ", \n"; + if(str.length != 2) { + str += ", \n"; } - str1 += s + k + " : " + js_Boot.__string_rec(o[k],s); + str += s + k + " : " + js_Boot.__string_rec(o[k],s); } s = s.substring(1); - str1 += "\n" + s + "}"; - return str1; + str += "\n" + s + "}"; + return str; case "string": return o; default: @@ -11227,24 +11225,26 @@ js_Boot.__string_rec = function(o,s) { } }; js_Boot.__interfLoop = function(cc,cl) { - if(cc == null) { - return false; - } - if(cc == cl) { - return true; - } - if(Object.prototype.hasOwnProperty.call(cc,"__interfaces__")) { + while(true) { + if(cc == null) { + return false; + } + if(cc == cl) { + return true; + } var intf = cc.__interfaces__; - var _g = 0; - var _g1 = intf.length; - while(_g < _g1) { - var i = intf[_g++]; - if(i == cl || js_Boot.__interfLoop(i,cl)) { - return true; + if(intf != null) { + var _g = 0; + var _g1 = intf.length; + while(_g < _g1) { + var i = intf[_g++]; + if(i == cl || js_Boot.__interfLoop(i,cl)) { + return true; + } } } + cc = cc.__super__; } - return js_Boot.__interfLoop(cc.__super__,cl); }; js_Boot.__instanceof = function(o,cl) { if(cl == null) { @@ -11306,7 +11306,7 @@ js_Boot.__cast = function(o,t) { if(o == null || js_Boot.__instanceof(o,t)) { return o; } else { - throw new js__$Boot_HaxeError("Cannot cast " + Std.string(o) + " to " + Std.string(t)); + throw haxe_Exception.thrown("Cannot cast " + Std.string(o) + " to " + Std.string(t)); } }; js_Boot.__nativeClassName = function(o) { @@ -11329,9 +11329,9 @@ js_html__$CanvasElement_CanvasUtil.getContextWebGL = function(canvas,attribs) { if(ctx != null) { return ctx; } - var ctx1 = canvas.getContext("experimental-webgl",attribs); - if(ctx1 != null) { - return ctx1; + var ctx = canvas.getContext("experimental-webgl",attribs); + if(ctx != null) { + return ctx; } return null; }; @@ -11433,15 +11433,15 @@ oimo_collision_geometry_Geometry.prototype = { beginLocalX = __tmp__X; beginLocalY = __tmp__Y; beginLocalZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; - __tmp__Y1 = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; - __tmp__Z1 = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; - endLocalX = __tmp__X1; - endLocalY = __tmp__Y1; - endLocalZ = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * endLocalX + transform._rotation10 * endLocalY + transform._rotation20 * endLocalZ; + __tmp__Y = transform._rotation01 * endLocalX + transform._rotation11 * endLocalY + transform._rotation21 * endLocalZ; + __tmp__Z = transform._rotation02 * endLocalX + transform._rotation12 * endLocalY + transform._rotation22 * endLocalZ; + endLocalX = __tmp__X; + endLocalY = __tmp__Y; + endLocalZ = __tmp__Z; if(this._rayCastLocal(beginLocalX,beginLocalY,beginLocalZ,endLocalX,endLocalY,endLocalZ,hit)) { var localPosX; var localPosY; @@ -11453,39 +11453,39 @@ oimo_collision_geometry_Geometry.prototype = { localPosX = v.x; localPosY = v.y; localPosZ = v.z; - var v1 = hit.normal; - localNormalX = v1.x; - localNormalY = v1.y; - localNormalZ = v1.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; - __tmp__Y2 = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; - __tmp__Z2 = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; - localPosX = __tmp__X2; - localPosY = __tmp__Y2; - localPosZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; - __tmp__Y3 = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; - __tmp__Z3 = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; - localNormalX = __tmp__X3; - localNormalY = __tmp__Y3; - localNormalZ = __tmp__Z3; + var v = hit.normal; + localNormalX = v.x; + localNormalY = v.y; + localNormalZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * localPosX + transform._rotation01 * localPosY + transform._rotation02 * localPosZ; + __tmp__Y = transform._rotation10 * localPosX + transform._rotation11 * localPosY + transform._rotation12 * localPosZ; + __tmp__Z = transform._rotation20 * localPosX + transform._rotation21 * localPosY + transform._rotation22 * localPosZ; + localPosX = __tmp__X; + localPosY = __tmp__Y; + localPosZ = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = transform._rotation00 * localNormalX + transform._rotation01 * localNormalY + transform._rotation02 * localNormalZ; + __tmp__Y = transform._rotation10 * localNormalX + transform._rotation11 * localNormalY + transform._rotation12 * localNormalZ; + __tmp__Z = transform._rotation20 * localNormalX + transform._rotation21 * localNormalY + transform._rotation22 * localNormalZ; + localNormalX = __tmp__X; + localNormalY = __tmp__Y; + localNormalZ = __tmp__Z; localPosX += transform._positionX; localPosY += transform._positionY; localPosZ += transform._positionZ; - var v2 = hit.position; - v2.x = localPosX; - v2.y = localPosY; - v2.z = localPosZ; - var v3 = hit.normal; - v3.x = localNormalX; - v3.y = localNormalY; - v3.z = localNormalZ; + var v = hit.position; + v.x = localPosX; + v.y = localPosY; + v.z = localPosZ; + var v = hit.normal; + v.x = localNormalX; + v.y = localNormalY; + v.z = localNormalZ; return true; } return false; @@ -11557,10 +11557,10 @@ oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry.prototype = $extend(o this.c.computeLocalSupportingVertex(dir,out); var v = this.localTranslation; if(dir.x * v.x + dir.y * v.y + dir.z * v.z > 0) { - var v1 = this.localTranslation; - out.x += v1.x; - out.y += v1.y; - out.z += v1.z; + var v = this.localTranslation; + out.x += v.x; + out.y += v.y; + out.z += v.z; } } ,__class__: oimo_collision_broadphase__$BroadPhase_ConvexSweepGeometry @@ -11928,14 +11928,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var tmp2; var x = cpy * dz - cpz * dy; if(!((x < 0 ? -x : x) - (pexty * adz + pextz * ady) > 0)) { - var x3 = cpz * dx - cpx * dz; - tmp2 = (x3 < 0 ? -x3 : x3) - (pextz * adx + pextx * adz) > 0; + var x = cpz * dx - cpx * dz; + tmp2 = (x < 0 ? -x : x) - (pextz * adx + pextx * adz) > 0; } else { tmp2 = true; } if(!tmp2) { - var x4 = cpx * dy - cpy * dx; - tmp1 = (x4 < 0 ? -x4 : x4) - (pextx * ady + pexty * adx) > 0; + var x = cpx * dy - cpy * dx; + tmp1 = (x < 0 ? -x : x) - (pextx * ady + pexty * adx) > 0; } else { tmp1 = true; } @@ -11956,10 +11956,10 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = this._aabb.max; - v1.x = node._aabbMaxX; - v1.y = node._aabbMaxY; - v1.z = node._aabbMaxZ; + var v = this._aabb.max; + v.x = node._aabbMaxX; + v.y = node._aabbMaxY; + v.z = node._aabbMaxZ; this._convexSweep.init(convex,begin,translation); var gjkEpa = oimo_collision_narrowphase_detector_gjkepa_GjkEpa.instance; if(!(gjkEpa.computeClosestPointsImpl(this._convexSweep,this._aabb,begin,this.identity,null,false) == 0 && gjkEpa.distance <= 0)) { @@ -12046,14 +12046,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } var parent = sibling._parent; - var first1 = _this._nodePool; - if(first1 != null) { - _this._nodePool = first1._next; - first1._next = null; + var first = _this._nodePool; + if(first != null) { + _this._nodePool = first._next; + first._next = null; } else { - first1 = new oimo_collision_broadphase_bvh_BvhNode(); + first = new oimo_collision_broadphase_bvh_BvhNode(); } - var node = first1; + var node = first; if(parent == null) { _this._root = node; } else { @@ -12062,19 +12062,17 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b node._parent = parent; node._childIndex = index; } - var index1 = sibling._childIndex; - node._children[index1] = sibling; + var index = sibling._childIndex; + node._children[index] = sibling; sibling._parent = node; - sibling._childIndex = index1; - var index2 = sibling._childIndex ^ 1; - node._children[index2] = leaf; + sibling._childIndex = index; + var index = sibling._childIndex ^ 1; + node._children[index] = leaf; leaf._parent = node; - leaf._childIndex = index2; + leaf._childIndex = index; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { + if(node._height >= 2) { var p1 = node._parent; var l = node._children[0]; var r = node._children[1]; @@ -12222,8 +12220,6 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b r._parent = null; } node = r; - } else { - node = node; } } } @@ -12280,13 +12276,13 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var _this = this._tree; var leaf = bvhProxy._leaf; _this._numLeaves--; - var prev1 = leaf._prevLeaf; - var next1 = leaf._nextLeaf; - if(prev1 != null) { - prev1._nextLeaf = next1; + var prev = leaf._prevLeaf; + var next = leaf._nextLeaf; + if(prev != null) { + prev._nextLeaf = next; } - if(next1 != null) { - next1._prevLeaf = prev1; + if(next != null) { + next._prevLeaf = prev; } if(leaf == _this.leafList) { _this.leafList = _this.leafList._nextLeaf; @@ -12335,9 +12331,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { + if(node._height >= 2) { var p = node._parent; var l = node._children[0]; var r = node._children[1]; @@ -12485,8 +12479,6 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b r._parent = null; } node = r; - } else { - node = node; } } } @@ -12613,10 +12605,10 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var _g1 = this.numMovedProxies; while(_g < _g1) { var i = _g++; - var p1 = this.movedProxies[i]; - if(p1._moved) { + var p = this.movedProxies[i]; + if(p._moved) { var _this = this._tree; - var leaf = p1._leaf; + var leaf = p._leaf; _this._numLeaves--; var prev = leaf._prevLeaf; var next = leaf._nextLeaf; @@ -12673,10 +12665,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var node = grandParent; while(node != null) { if(_this._strategy._balancingEnabled) { - if(node._height < 2) { - node = node; - } else { - var p2 = node._parent; + if(node._height >= 2) { + var p1 = node._parent; var l = node._children[0]; var r = node._children[1]; var balance = l._height - r._height; @@ -12743,9 +12733,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var h23 = node._children[1]._height; node._height = (h13 > h23 ? h13 : h23) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = l; - l._parent = p2; + if(p1 != null) { + p1._children[nodeIndex] = l; + l._parent = p1; l._childIndex = nodeIndex; } else { _this._root = l; @@ -12814,17 +12804,15 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var h27 = node._children[1]._height; node._height = (h17 > h27 ? h17 : h27) + 1; } - if(p2 != null) { - p2._children[nodeIndex] = r; - r._parent = p2; + if(p1 != null) { + p1._children[nodeIndex] = r; + r._parent = p1; r._childIndex = nodeIndex; } else { _this._root = r; r._parent = null; } node = r; - } else { - node = node; } } } @@ -12843,7 +12831,7 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } } - p1._leaf = null; + p._leaf = null; leaf._next = null; leaf._childIndex = 0; leaf._children[0] = null; @@ -12863,14 +12851,14 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b first = new oimo_collision_broadphase_bvh_BvhNode(); } var leaf1 = first; - leaf1._proxy = p1; - p1._leaf = leaf1; - leaf1._aabbMinX = p1._aabbMinX; - leaf1._aabbMinY = p1._aabbMinY; - leaf1._aabbMinZ = p1._aabbMinZ; - leaf1._aabbMaxX = p1._aabbMaxX; - leaf1._aabbMaxY = p1._aabbMaxY; - leaf1._aabbMaxZ = p1._aabbMaxZ; + leaf1._proxy = p; + p._leaf = leaf1; + leaf1._aabbMinX = p._aabbMinX; + leaf1._aabbMinY = p._aabbMinY; + leaf1._aabbMinZ = p._aabbMinZ; + leaf1._aabbMaxX = p._aabbMaxX; + leaf1._aabbMaxY = p._aabbMaxY; + leaf1._aabbMaxZ = p._aabbMaxZ; _this1._numLeaves++; if(_this1.leafList == null) { _this1.leafList = leaf1; @@ -12919,10 +12907,8 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b leaf1._childIndex = index3; while(node1 != null) { if(_this1._strategy._balancingEnabled) { - if(node1._height < 2) { - node1 = node1; - } else { - var p3 = node1._parent; + if(node1._height >= 2) { + var p2 = node1._parent; var l1 = node1._children[0]; var r1 = node1._children[1]; var balance1 = l1._height - r1._height; @@ -12989,9 +12975,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var h212 = node1._children[1]._height; node1._height = (h112 > h212 ? h112 : h212) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = l1; - l1._parent = p3; + if(p2 != null) { + p2._children[nodeIndex1] = l1; + l1._parent = p2; l1._childIndex = nodeIndex1; } else { _this1._root = l1; @@ -13060,17 +13046,15 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b var h216 = node1._children[1]._height; node1._height = (h116 > h216 ? h116 : h216) + 1; } - if(p3 != null) { - p3._children[nodeIndex1] = r1; - r1._parent = p3; + if(p2 != null) { + p2._children[nodeIndex1] = r1; + r1._parent = p2; r1._childIndex = nodeIndex1; } else { _this1._root = r1; r1._parent = null; } node1 = r1; - } else { - node1 = node1; } } } @@ -13089,9 +13073,9 @@ oimo_collision_broadphase_bvh_BvhBroadPhase.prototype = $extend(oimo_collision_b } } if(incrementalCollision) { - this.collide(this._tree._root,p1._leaf); + this.collide(this._tree._root,p._leaf); } - p1._moved = false; + p._moved = false; } this.movedProxies[i] = null; } @@ -13209,8 +13193,8 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { } break; case 1: - var c11 = currentNode._children[0]; - var c21 = currentNode._children[1]; + var c1 = currentNode._children[0]; + var c2 = currentNode._children[1]; var ey = currentNode._aabbMaxY - currentNode._aabbMinY; var ez = currentNode._aabbMaxZ - currentNode._aabbMinZ; var combinedMinX; @@ -13231,40 +13215,40 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { var creatingCost = newArea * 2; var incrementalCost = (newArea - ((currentNode._aabbMaxX - currentNode._aabbMinX) * (ey + ez) + ey * ez) * 2) * 2; var descendingCost1 = incrementalCost; - combinedMinX = c11._aabbMinX < leaf._aabbMinX ? c11._aabbMinX : leaf._aabbMinX; - combinedMinY = c11._aabbMinY < leaf._aabbMinY ? c11._aabbMinY : leaf._aabbMinY; - combinedMinZ = c11._aabbMinZ < leaf._aabbMinZ ? c11._aabbMinZ : leaf._aabbMinZ; - combinedMaxX = c11._aabbMaxX > leaf._aabbMaxX ? c11._aabbMaxX : leaf._aabbMaxX; - combinedMaxY = c11._aabbMaxY > leaf._aabbMaxY ? c11._aabbMaxY : leaf._aabbMaxY; - combinedMaxZ = c11._aabbMaxZ > leaf._aabbMaxZ ? c11._aabbMaxZ : leaf._aabbMaxZ; - if(c11._height == 0) { - var ey2 = combinedMaxY - combinedMinY; - var ez2 = combinedMaxZ - combinedMinZ; - descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey2 + ez2) + ey2 * ez2) * 2; + combinedMinX = c1._aabbMinX < leaf._aabbMinX ? c1._aabbMinX : leaf._aabbMinX; + combinedMinY = c1._aabbMinY < leaf._aabbMinY ? c1._aabbMinY : leaf._aabbMinY; + combinedMinZ = c1._aabbMinZ < leaf._aabbMinZ ? c1._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c1._aabbMaxX > leaf._aabbMaxX ? c1._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c1._aabbMaxY > leaf._aabbMaxY ? c1._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c1._aabbMaxZ > leaf._aabbMaxZ ? c1._aabbMaxZ : leaf._aabbMaxZ; + if(c1._height == 0) { + var ey = combinedMaxY - combinedMinY; + var ez = combinedMaxZ - combinedMinZ; + descendingCost1 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ey3 = combinedMaxY - combinedMinY; - var ez3 = combinedMaxZ - combinedMinZ; - var ey4 = c11._aabbMaxY - c11._aabbMinY; - var ez4 = c11._aabbMaxZ - c11._aabbMinZ; - descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey3 + ez3) + ey3 * ez3) * 2 - ((c11._aabbMaxX - c11._aabbMinX) * (ey4 + ez4) + ey4 * ez4) * 2); + var ey = combinedMaxY - combinedMinY; + var ez = combinedMaxZ - combinedMinZ; + var ey1 = c1._aabbMaxY - c1._aabbMinY; + var ez1 = c1._aabbMaxZ - c1._aabbMinZ; + descendingCost1 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c1._aabbMaxX - c1._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } var descendingCost2 = incrementalCost; - combinedMinX = c21._aabbMinX < leaf._aabbMinX ? c21._aabbMinX : leaf._aabbMinX; - combinedMinY = c21._aabbMinY < leaf._aabbMinY ? c21._aabbMinY : leaf._aabbMinY; - combinedMinZ = c21._aabbMinZ < leaf._aabbMinZ ? c21._aabbMinZ : leaf._aabbMinZ; - combinedMaxX = c21._aabbMaxX > leaf._aabbMaxX ? c21._aabbMaxX : leaf._aabbMaxX; - combinedMaxY = c21._aabbMaxY > leaf._aabbMaxY ? c21._aabbMaxY : leaf._aabbMaxY; - combinedMaxZ = c21._aabbMaxZ > leaf._aabbMaxZ ? c21._aabbMaxZ : leaf._aabbMaxZ; - if(c21._height == 0) { - var ey5 = combinedMaxY - combinedMinY; - var ez5 = combinedMaxZ - combinedMinZ; - descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey5 + ez5) + ey5 * ez5) * 2; + combinedMinX = c2._aabbMinX < leaf._aabbMinX ? c2._aabbMinX : leaf._aabbMinX; + combinedMinY = c2._aabbMinY < leaf._aabbMinY ? c2._aabbMinY : leaf._aabbMinY; + combinedMinZ = c2._aabbMinZ < leaf._aabbMinZ ? c2._aabbMinZ : leaf._aabbMinZ; + combinedMaxX = c2._aabbMaxX > leaf._aabbMaxX ? c2._aabbMaxX : leaf._aabbMaxX; + combinedMaxY = c2._aabbMaxY > leaf._aabbMaxY ? c2._aabbMaxY : leaf._aabbMaxY; + combinedMaxZ = c2._aabbMaxZ > leaf._aabbMaxZ ? c2._aabbMaxZ : leaf._aabbMaxZ; + if(c2._height == 0) { + var ey = combinedMaxY - combinedMinY; + var ez = combinedMaxZ - combinedMinZ; + descendingCost2 = incrementalCost + ((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2; } else { - var ey6 = combinedMaxY - combinedMinY; - var ez6 = combinedMaxZ - combinedMinZ; - var ey7 = c21._aabbMaxY - c21._aabbMinY; - var ez7 = c21._aabbMaxZ - c21._aabbMinZ; - descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey6 + ez6) + ey6 * ez6) * 2 - ((c21._aabbMaxX - c21._aabbMinX) * (ey7 + ez7) + ey7 * ez7) * 2); + var ey = combinedMaxY - combinedMinY; + var ez = combinedMaxZ - combinedMinZ; + var ey1 = c2._aabbMaxY - c2._aabbMinY; + var ez1 = c2._aabbMaxZ - c2._aabbMinZ; + descendingCost2 = incrementalCost + (((combinedMaxX - combinedMinX) * (ey + ez) + ey * ez) * 2 - ((c2._aabbMaxX - c2._aabbMinX) * (ey1 + ez1) + ey1 * ez1) * 2); } if(creatingCost < descendingCost1) { if(creatingCost < descendingCost2) { @@ -13310,15 +13294,15 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { varianceX = 0; varianceY = 0; varianceZ = 0; - var _g2 = from; - while(_g2 < until) { - var leaf1 = leaves[_g2++]; + var _g = from; + while(_g < until) { + var leaf = leaves[_g++]; var diffX; var diffY; var diffZ; - diffX = leaf1._tmpX - centerMeanX; - diffY = leaf1._tmpY - centerMeanY; - diffZ = leaf1._tmpZ - centerMeanZ; + diffX = leaf._tmpX - centerMeanX; + diffY = leaf._tmpY - centerMeanY; + diffZ = leaf._tmpZ - centerMeanZ; diffX *= diffX; diffY *= diffY; diffZ *= diffZ; @@ -13347,45 +13331,45 @@ oimo_collision_broadphase_bvh_BvhStrategy.prototype = { --r; } } else { - var mean1 = centerMeanZ; + var mean = centerMeanZ; while(true) { - while(!(leaves[l]._tmpZ <= mean1)) ++l; - while(!(leaves[r]._tmpZ >= mean1)) --r; + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp1 = leaves[l]; + var tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp1; + leaves[r] = tmp; ++l; --r; } } } else if(varY > varZ) { - var mean2 = centerMeanY; + var mean = centerMeanY; while(true) { - while(!(leaves[l]._tmpY <= mean2)) ++l; - while(!(leaves[r]._tmpY >= mean2)) --r; + while(!(leaves[l]._tmpY <= mean)) ++l; + while(!(leaves[r]._tmpY >= mean)) --r; if(l >= r) { break; } - var tmp2 = leaves[l]; + var tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp2; + leaves[r] = tmp; ++l; --r; } } else { - var mean3 = centerMeanZ; + var mean = centerMeanZ; while(true) { - while(!(leaves[l]._tmpZ <= mean3)) ++l; - while(!(leaves[r]._tmpZ >= mean3)) --r; + while(!(leaves[l]._tmpZ <= mean)) ++l; + while(!(leaves[r]._tmpZ >= mean)) --r; if(l >= r) { break; } - var tmp3 = leaves[l]; + var tmp = leaves[l]; leaves[l] = leaves[r]; - leaves[r] = tmp3; + leaves[r] = tmp; ++l; --r; } @@ -13426,25 +13410,25 @@ oimo_collision_broadphase_bvh_BvhTree.prototype = { var y = sizeY; var z = sizeZ; if(sizeX * (y + z) + y * z > 0) { - var sizeX1; - var sizeY1; - var sizeZ1; - sizeX1 = root._aabbMaxX - root._aabbMinX; - sizeY1 = root._aabbMaxY - root._aabbMinY; - sizeZ1 = root._aabbMaxZ - root._aabbMinZ; - var y1 = sizeY1; - var z1 = sizeZ1; - tmp = ((sizeX1 * (y1 + z1) + y1 * z1) * 1000 + 0.5 | 0) / 1000; + var sizeX; + var sizeY; + var sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + var y = sizeY; + var z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 + 0.5 | 0) / 1000; } else { - var sizeX2; - var sizeY2; - var sizeZ2; - sizeX2 = root._aabbMaxX - root._aabbMinX; - sizeY2 = root._aabbMaxY - root._aabbMinY; - sizeZ2 = root._aabbMaxZ - root._aabbMinZ; - var y2 = sizeY2; - var z2 = sizeZ2; - tmp = ((sizeX2 * (y2 + z2) + y2 * z2) * 1000 - 0.5 | 0) / 1000; + var sizeX; + var sizeY; + var sizeZ; + sizeX = root._aabbMaxX - root._aabbMinX; + sizeY = root._aabbMaxY - root._aabbMinY; + sizeZ = root._aabbMaxZ - root._aabbMinZ; + var y = sizeY; + var z = sizeZ; + tmp = ((sizeX * (y + z) + y * z) * 1000 - 0.5 | 0) / 1000; } console.log("src/oimo/collision/broadphase/bvh/BvhTree.hx:42:",indent + "#" + root._height + ", " + tmp); this._print(root._children[1],indent + " "); @@ -13822,33 +13806,51 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ tfxX = __tmp__X; tfxY = __tmp__Y; tfxZ = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; - __tmp__Y1 = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; - __tmp__Z1 = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; - tfyX = __tmp__X1; - tfyY = __tmp__Y1; - tfyZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; - __tmp__Y2 = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; - __tmp__Z2 = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; - tfzX = __tmp__X2; - tfzY = __tmp__Y2; - tfzZ = __tmp__Z2; - tfxX = tfxX < 0 ? -tfxX : tfxX; - tfxY = tfxY < 0 ? -tfxY : tfxY; - tfxZ = tfxZ < 0 ? -tfxZ : tfxZ; - tfyX = tfyX < 0 ? -tfyX : tfyX; - tfyY = tfyY < 0 ? -tfyY : tfyY; - tfyZ = tfyZ < 0 ? -tfyZ : tfyZ; - tfzX = tfzX < 0 ? -tfzX : tfzX; - tfzY = tfzY < 0 ? -tfzY : tfzY; - tfzZ = tfzZ < 0 ? -tfzZ : tfzZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * this._halfAxisYX + tf._rotation01 * this._halfAxisYY + tf._rotation02 * this._halfAxisYZ; + __tmp__Y = tf._rotation10 * this._halfAxisYX + tf._rotation11 * this._halfAxisYY + tf._rotation12 * this._halfAxisYZ; + __tmp__Z = tf._rotation20 * this._halfAxisYX + tf._rotation21 * this._halfAxisYY + tf._rotation22 * this._halfAxisYZ; + tfyX = __tmp__X; + tfyY = __tmp__Y; + tfyZ = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * this._halfAxisZX + tf._rotation01 * this._halfAxisZY + tf._rotation02 * this._halfAxisZZ; + __tmp__Y = tf._rotation10 * this._halfAxisZX + tf._rotation11 * this._halfAxisZY + tf._rotation12 * this._halfAxisZZ; + __tmp__Z = tf._rotation20 * this._halfAxisZX + tf._rotation21 * this._halfAxisZY + tf._rotation22 * this._halfAxisZZ; + tfzX = __tmp__X; + tfzY = __tmp__Y; + tfzZ = __tmp__Z; + if(tfxX < 0) { + tfxX = -tfxX; + } + if(tfxY < 0) { + tfxY = -tfxY; + } + if(tfxZ < 0) { + tfxZ = -tfxZ; + } + if(tfyX < 0) { + tfyX = -tfyX; + } + if(tfyY < 0) { + tfyY = -tfyY; + } + if(tfyZ < 0) { + tfyZ = -tfyZ; + } + if(tfzX < 0) { + tfzX = -tfzX; + } + if(tfzY < 0) { + tfzY = -tfzY; + } + if(tfzZ < 0) { + tfzZ = -tfzZ; + } var tfsX; var tfsY; var tfsZ; @@ -13875,9 +13877,15 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ gjkMarginsX = this._gjkMargin; gjkMarginsY = this._gjkMargin; gjkMarginsZ = this._gjkMargin; - gjkMarginsX = gjkMarginsX < this._halfExtentsX ? gjkMarginsX : this._halfExtentsX; - gjkMarginsY = gjkMarginsY < this._halfExtentsY ? gjkMarginsY : this._halfExtentsY; - gjkMarginsZ = gjkMarginsZ < this._halfExtentsZ ? gjkMarginsZ : this._halfExtentsZ; + if(!(gjkMarginsX < this._halfExtentsX)) { + gjkMarginsX = this._halfExtentsX; + } + if(!(gjkMarginsY < this._halfExtentsY)) { + gjkMarginsY = this._halfExtentsY; + } + if(!(gjkMarginsZ < this._halfExtentsZ)) { + gjkMarginsZ = this._halfExtentsZ; + } coreExtentsX = this._halfExtentsX - gjkMarginsX; coreExtentsY = this._halfExtentsY - gjkMarginsY; coreExtentsZ = this._halfExtentsZ - gjkMarginsZ; @@ -13924,18 +13932,18 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ } } else { var invDy = 1 / dy; - var t11 = (-halfH - beginY) * invDy; - var t21 = (halfH - beginY) * invDy; - if(t11 > t21) { - var tmp1 = t11; - t11 = t21; - t21 = tmp1; + var t1 = (-halfH - beginY) * invDy; + var t2 = (halfH - beginY) * invDy; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; } - if(t11 > 0) { - tminy = t11; + if(t1 > 0) { + tminy = t1; } - if(t21 < 1) { - tmaxy = t21; + if(t2 < 1) { + tmaxy = t2; } } if(dz > -1e-6 && dz < 1e-6) { @@ -13944,18 +13952,18 @@ oimo_collision_geometry_BoxGeometry.prototype = $extend(oimo_collision_geometry_ } } else { var invDz = 1 / dz; - var t12 = (-halfD - beginZ) * invDz; - var t22 = (halfD - beginZ) * invDz; - if(t12 > t22) { - var tmp2 = t12; - t12 = t22; - t22 = tmp2; + var t1 = (-halfD - beginZ) * invDz; + var t2 = (halfD - beginZ) * invDz; + if(t1 > t2) { + var tmp = t1; + t1 = t2; + t2 = tmp; } - if(t12 > 0) { - tminz = t12; + if(t1 > 0) { + tminz = t1; } - if(t22 < 1) { - tmaxz = t22; + if(t2 < 1) { + tmaxz = t2; } } if(tminx >= 1 || tminy >= 1 || tminz >= 1 || tmaxx <= 0 || tmaxy <= 0 || tmaxz <= 0) { @@ -14048,9 +14056,15 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axisX *= this._halfHeight; axisY *= this._halfHeight; axisZ *= this._halfHeight; @@ -14169,10 +14183,10 @@ oimo_collision_geometry_CapsuleGeometry.prototype = $extend(oimo_collision_geome v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; - v1.x = hitNormalX; - v1.y = hitNormalY; - v1.z = hitNormalZ; + var v = hit.normal; + v.x = hitNormalX; + v.y = hitNormalY; + v.z = hitNormalZ; hit.fraction = t; return true; } @@ -14264,15 +14278,27 @@ oimo_collision_geometry_ConeGeometry.prototype = $extend(oimo_collision_geometry maxX = rminX > rmaxX ? rminX : rmaxX; maxY = rminY > rmaxY ? rminY : rmaxY; maxZ = rminZ > rmaxZ ? rminZ : rmaxZ; - maxX = maxX > ehX ? maxX : ehX; - maxY = maxY > ehY ? maxY : ehY; - maxZ = maxZ > ehZ ? maxZ : ehZ; + if(!(maxX > ehX)) { + maxX = ehX; + } + if(!(maxY > ehY)) { + maxY = ehY; + } + if(!(maxZ > ehZ)) { + maxZ = ehZ; + } minX = rminX < rmaxX ? rminX : rmaxX; minY = rminY < rmaxY ? rminY : rmaxY; minZ = rminZ < rmaxZ ? rminZ : rmaxZ; - minX = minX < ehX ? minX : ehX; - minY = minY < ehY ? minY : ehY; - minZ = minZ < ehZ ? minZ : ehZ; + if(!(minX < ehX)) { + minX = ehX; + } + if(!(minY < ehY)) { + minY = ehY; + } + if(!(minZ < ehZ)) { + minZ = ehZ; + } aabb._minX = tf._positionX + minX; aabb._minY = tf._positionY + minY; aabb._minZ = tf._positionZ + minZ; @@ -14548,28 +14574,40 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge var _g = 1; var _g1 = this._numVertices; while(_g < _g1) { - var v1 = this._vertices[_g++]; - localVX = v1.x; - localVY = v1.y; - localVZ = v1.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; - __tmp__Y1 = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; - __tmp__Z1 = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; - worldVX = __tmp__X1; - worldVY = __tmp__Y1; - worldVZ = __tmp__Z1; + var v = this._vertices[_g++]; + localVX = v.x; + localVY = v.y; + localVZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf._rotation00 * localVX + tf._rotation01 * localVY + tf._rotation02 * localVZ; + __tmp__Y = tf._rotation10 * localVX + tf._rotation11 * localVY + tf._rotation12 * localVZ; + __tmp__Z = tf._rotation20 * localVX + tf._rotation21 * localVY + tf._rotation22 * localVZ; + worldVX = __tmp__X; + worldVY = __tmp__Y; + worldVZ = __tmp__Z; worldVX += tf._positionX; worldVY += tf._positionY; worldVZ += tf._positionZ; - minX = minX < worldVX ? minX : worldVX; - minY = minY < worldVY ? minY : worldVY; - minZ = minZ < worldVZ ? minZ : worldVZ; - maxX = maxX > worldVX ? maxX : worldVX; - maxY = maxY > worldVY ? maxY : worldVY; - maxZ = maxZ > worldVZ ? maxZ : worldVZ; + if(!(minX < worldVX)) { + minX = worldVX; + } + if(!(minY < worldVY)) { + minY = worldVY; + } + if(!(minZ < worldVZ)) { + minZ = worldVZ; + } + if(!(maxX > worldVX)) { + maxX = worldVX; + } + if(!(maxY > worldVY)) { + maxY = worldVY; + } + if(!(maxZ > worldVZ)) { + maxZ = worldVZ; + } } aabb._minX = minX - marginX; aabb._minY = minY - marginY; @@ -14586,8 +14624,8 @@ oimo_collision_geometry_ConvexHullGeometry.prototype = $extend(oimo_collision_ge var _g1 = this._numVertices; while(_g < _g1) { var i = _g++; - var _this1 = this._vertices[i]; - var dot = _this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z; + var _this = this._vertices[i]; + var dot = _this.x * dir.x + _this.y * dir.y + _this.z * dir.z; if(dot > maxDot) { maxDot = dot; maxIndex = i; @@ -14645,9 +14683,15 @@ oimo_collision_geometry_CylinderGeometry.prototype = $extend(oimo_collision_geom axisX = tf._rotation01; axisY = tf._rotation11; axisZ = tf._rotation21; - axisX = axisX < 0 ? -axisX : axisX; - axisY = axisY < 0 ? -axisY : axisY; - axisZ = axisZ < 0 ? -axisZ : axisZ; + if(axisX < 0) { + axisX = -axisX; + } + if(axisY < 0) { + axisY = -axisY; + } + if(axisZ < 0) { + axisZ = -axisZ; + } axis2X = axisX * axisX; axis2Y = axisY * axisY; axis2Z = axisZ * axisZ; @@ -14862,10 +14906,10 @@ oimo_collision_geometry_SphereGeometry.prototype = $extend(oimo_collision_geomet v.x = hitPosX; v.y = hitPosY; v.z = hitPosZ; - var v1 = hit.normal; - v1.x = hitNormalX; - v1.y = hitNormalY; - v1.z = hitNormalZ; + var v = hit.normal; + v.x = hitNormalX; + v.y = hitNormalY; + v.z = hitNormalZ; hit.fraction = t; return true; } @@ -14999,19 +15043,19 @@ oimo_collision_narrowphase_detector_Detector.prototype = { v.x = pos2X; v.y = pos2Y; v.z = pos2Z; - var v1 = p.position2; - v1.x = pos1X; - v1.y = pos1Y; - v1.z = pos1Z; + var v = p.position2; + v.x = pos1X; + v.y = pos1Y; + v.z = pos1Z; } else { - var v2 = p.position1; - v2.x = pos1X; - v2.y = pos1Y; - v2.z = pos1Z; - var v3 = p.position2; - v3.x = pos2X; - v3.y = pos2Y; - v3.z = pos2Z; + var v = p.position1; + v.x = pos1X; + v.y = pos1Y; + v.z = pos1Z; + var v = p.position2; + v.x = pos2X; + v.y = pos2Y; + v.z = pos2Z; } } ,detectImpl: function(result,geom1,geom2,tf1,tf2,cachedData) { @@ -15185,63 +15229,63 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll return; } proj1 = h1; - var dx1 = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; - var dy1 = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; - var dz1 = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; - if(dx1 < 0) { - dx1 = -dx1; + var dx = y1X * sx2X + y1Y * sx2Y + y1Z * sx2Z; + var dy = y1X * sy2X + y1Y * sy2Y + y1Z * sy2Z; + var dz = y1X * sz2X + y1Y * sz2Y + y1Z * sz2Z; + if(dx < 0) { + dx = -dx; } - if(dy1 < 0) { - dy1 = -dy1; + if(dy < 0) { + dy = -dy; } - if(dz1 < 0) { - dz1 = -dz1; + if(dz < 0) { + dz = -dz; } - proj2 = dx1 + dy1 + dz1; + proj2 = dx + dy + dz; projC12 = y1X * c12X + y1Y * c12Y + y1Z * c12Z; - var sum1 = proj1 + proj2; - var neg1 = projC12 < 0; - var abs1 = neg1 ? -projC12 : projC12; - if(abs1 < sum1) { - var depth1 = sum1 - abs1; - if(depth1 < mDepth) { - mDepth = depth1; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 1; mAxisX = y1X; mAxisY = y1Y; mAxisZ = y1Z; - mSign = neg1 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; } proj1 = d1; - var dx2 = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; - var dy2 = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; - var dz2 = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; - if(dx2 < 0) { - dx2 = -dx2; + var dx = z1X * sx2X + z1Y * sx2Y + z1Z * sx2Z; + var dy = z1X * sy2X + z1Y * sy2Y + z1Z * sy2Z; + var dz = z1X * sz2X + z1Y * sz2Y + z1Z * sz2Z; + if(dx < 0) { + dx = -dx; } - if(dy2 < 0) { - dy2 = -dy2; + if(dy < 0) { + dy = -dy; } - if(dz2 < 0) { - dz2 = -dz2; + if(dz < 0) { + dz = -dz; } - proj2 = dx2 + dy2 + dz2; + proj2 = dx + dy + dz; projC12 = z1X * c12X + z1Y * c12Y + z1Z * c12Z; - var sum2 = proj1 + proj2; - var neg2 = projC12 < 0; - var abs2 = neg2 ? -projC12 : projC12; - if(abs2 < sum2) { - var depth2 = sum2 - abs2; - if(depth2 < mDepth) { - mDepth = depth2; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 2; mAxisX = z1X; mAxisY = z1Y; mAxisZ = z1Z; - mSign = neg2 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15251,95 +15295,95 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll } else { mDepth = 0; } - var dx3 = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; - var dy3 = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; - var dz3 = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; - if(dx3 < 0) { - dx3 = -dx3; + var dx = x2X * sx1X + x2Y * sx1Y + x2Z * sx1Z; + var dy = x2X * sy1X + x2Y * sy1Y + x2Z * sy1Z; + var dz = x2X * sz1X + x2Y * sz1Y + x2Z * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy3 < 0) { - dy3 = -dy3; + if(dy < 0) { + dy = -dy; } - if(dz3 < 0) { - dz3 = -dz3; + if(dz < 0) { + dz = -dz; } - proj1 = dx3 + dy3 + dz3; + proj1 = dx + dy + dz; proj2 = w2; projC12 = x2X * c12X + x2Y * c12Y + x2Z * c12Z; - var sum3 = proj1 + proj2; - var neg3 = projC12 < 0; - var abs3 = neg3 ? -projC12 : projC12; - if(abs3 < sum3) { - var depth3 = sum3 - abs3; - if(depth3 < mDepth) { - mDepth = depth3; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 3; mAxisX = x2X; mAxisY = x2Y; mAxisZ = x2Z; - mSign = neg3 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; } - var dx4 = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; - var dy4 = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; - var dz4 = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; - if(dx4 < 0) { - dx4 = -dx4; + var dx = y2X * sx1X + y2Y * sx1Y + y2Z * sx1Z; + var dy = y2X * sy1X + y2Y * sy1Y + y2Z * sy1Z; + var dz = y2X * sz1X + y2Y * sz1Y + y2Z * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy4 < 0) { - dy4 = -dy4; + if(dy < 0) { + dy = -dy; } - if(dz4 < 0) { - dz4 = -dz4; + if(dz < 0) { + dz = -dz; } - proj1 = dx4 + dy4 + dz4; + proj1 = dx + dy + dz; proj2 = h2; projC12 = y2X * c12X + y2Y * c12Y + y2Z * c12Z; - var sum4 = proj1 + proj2; - var neg4 = projC12 < 0; - var abs4 = neg4 ? -projC12 : projC12; - if(abs4 < sum4) { - var depth4 = sum4 - abs4; - if(depth4 < mDepth) { - mDepth = depth4; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 4; mAxisX = y2X; mAxisY = y2Y; mAxisZ = y2Z; - mSign = neg4 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; } - var dx5 = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; - var dy5 = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; - var dz5 = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; - if(dx5 < 0) { - dx5 = -dx5; + var dx = z2X * sx1X + z2Y * sx1Y + z2Z * sx1Z; + var dy = z2X * sy1X + z2Y * sy1Y + z2Z * sy1Z; + var dz = z2X * sz1X + z2Y * sz1Y + z2Z * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy5 < 0) { - dy5 = -dy5; + if(dy < 0) { + dy = -dy; } - if(dz5 < 0) { - dz5 = -dz5; + if(dz < 0) { + dz = -dz; } - proj1 = dx5 + dy5 + dz5; + proj1 = dx + dy + dz; proj2 = d2; projC12 = z2X * c12X + z2Y * c12Y + z2Z * c12Z; - var sum5 = proj1 + proj2; - var neg5 = projC12 < 0; - var abs5 = neg5 ? -projC12 : projC12; - if(abs5 < sum5) { - var depth5 = sum5 - abs5; - if(depth5 < mDepth) { - mDepth = depth5; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 5; mAxisX = z2X; mAxisY = z2Y; mAxisZ = z2Z; - mSign = neg5 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15363,37 +15407,37 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisX *= l; edgeAxisY *= l; edgeAxisZ *= l; - var dx6 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy6 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx6 < 0) { - dx6 = -dx6; + var dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; } - if(dy6 < 0) { - dy6 = -dy6; + if(dy < 0) { + dy = -dy; } - proj1 = dx6 + dy6; - var dx7 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy7 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx7 < 0) { - dx7 = -dx7; + proj1 = dx + dy; + var dx = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; } - if(dy7 < 0) { - dy7 = -dy7; + if(dy < 0) { + dy = -dy; } - proj2 = dx7 + dy7; + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum6 = proj1 + proj2; - var neg6 = projC12 < 0; - var abs6 = neg6 ? -projC12 : projC12; - if(abs6 < sum6) { - var depth6 = sum6 - abs6; - if(depth6 < mDepth) { - mDepth = depth6; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 6; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg6 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15403,44 +15447,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = x1Z * y2X - x1X * y2Z; edgeAxisZ = x1X * y2Y - x1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l1 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - edgeAxisX *= l1; - edgeAxisY *= l1; - edgeAxisZ *= l1; - var dx8 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy8 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx8 < 0) { - dx8 = -dx8; - } - if(dy8 < 0) { - dy8 = -dy8; - } - proj1 = dx8 + dy8; - var dx9 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy9 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx9 < 0) { - dx9 = -dx9; - } - if(dy9 < 0) { - dy9 = -dy9; - } - proj2 = dx9 + dy9; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum7 = proj1 + proj2; - var neg7 = projC12 < 0; - var abs7 = neg7 ? -projC12 : projC12; - if(abs7 < sum7) { - var depth7 = sum7 - abs7; - if(depth7 < mDepth) { - mDepth = depth7; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 7; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg7 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15450,44 +15494,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = x1Z * z2X - x1X * z2Z; edgeAxisZ = x1X * z2Y - x1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l2 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - edgeAxisX *= l2; - edgeAxisY *= l2; - edgeAxisZ *= l2; - var dx10 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - var dy10 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx10 < 0) { - dx10 = -dx10; - } - if(dy10 < 0) { - dy10 = -dy10; - } - proj1 = dx10 + dy10; - var dx11 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy11 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx11 < 0) { - dx11 = -dx11; - } - if(dy11 < 0) { - dy11 = -dy11; - } - proj2 = dx11 + dy11; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum8 = proj1 + proj2; - var neg8 = projC12 < 0; - var abs8 = neg8 ? -projC12 : projC12; - if(abs8 < sum8) { - var depth8 = sum8 - abs8; - if(depth8 < mDepth) { - mDepth = depth8; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 8; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg8 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15497,44 +15541,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * x2X - y1X * x2Z; edgeAxisZ = y1X * x2Y - y1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l3 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - edgeAxisX *= l3; - edgeAxisY *= l3; - edgeAxisZ *= l3; - var dx12 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy12 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx12 < 0) { - dx12 = -dx12; - } - if(dy12 < 0) { - dy12 = -dy12; - } - proj1 = dx12 + dy12; - var dx13 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy13 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx13 < 0) { - dx13 = -dx13; - } - if(dy13 < 0) { - dy13 = -dy13; - } - proj2 = dx13 + dy13; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum9 = proj1 + proj2; - var neg9 = projC12 < 0; - var abs9 = neg9 ? -projC12 : projC12; - if(abs9 < sum9) { - var depth9 = sum9 - abs9; - if(depth9 < mDepth) { - mDepth = depth9; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 9; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg9 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15544,44 +15588,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * y2X - y1X * y2Z; edgeAxisZ = y1X * y2Y - y1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l4 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - edgeAxisX *= l4; - edgeAxisY *= l4; - edgeAxisZ *= l4; - var dx14 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy14 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx14 < 0) { - dx14 = -dx14; - } - if(dy14 < 0) { - dy14 = -dy14; - } - proj1 = dx14 + dy14; - var dx15 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy15 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx15 < 0) { - dx15 = -dx15; - } - if(dy15 < 0) { - dy15 = -dy15; - } - proj2 = dx15 + dy15; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum10 = proj1 + proj2; - var neg10 = projC12 < 0; - var abs10 = neg10 ? -projC12 : projC12; - if(abs10 < sum10) { - var depth10 = sum10 - abs10; - if(depth10 < mDepth) { - mDepth = depth10; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 10; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg10 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15591,44 +15635,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = y1Z * z2X - y1X * z2Z; edgeAxisZ = y1X * z2Y - y1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l5 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l5 > 0) { - l5 = 1 / Math.sqrt(l5); - } - edgeAxisX *= l5; - edgeAxisY *= l5; - edgeAxisZ *= l5; - var dx16 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy16 = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; - if(dx16 < 0) { - dx16 = -dx16; - } - if(dy16 < 0) { - dy16 = -dy16; - } - proj1 = dx16 + dy16; - var dx17 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy17 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx17 < 0) { - dx17 = -dx17; - } - if(dy17 < 0) { - dy17 = -dy17; - } - proj2 = dx17 + dy17; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sz1X + edgeAxisY * sz1Y + edgeAxisZ * sz1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum11 = proj1 + proj2; - var neg11 = projC12 < 0; - var abs11 = neg11 ? -projC12 : projC12; - if(abs11 < sum11) { - var depth11 = sum11 - abs11; - if(depth11 < mDepth) { - mDepth = depth11; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 11; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg11 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15638,44 +15682,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * x2X - z1X * x2Z; edgeAxisZ = z1X * x2Y - z1Y * x2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l6 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l6 > 0) { - l6 = 1 / Math.sqrt(l6); - } - edgeAxisX *= l6; - edgeAxisY *= l6; - edgeAxisZ *= l6; - var dx18 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy18 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx18 < 0) { - dx18 = -dx18; - } - if(dy18 < 0) { - dy18 = -dy18; - } - proj1 = dx18 + dy18; - var dx19 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - var dy19 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx19 < 0) { - dx19 = -dx19; - } - if(dy19 < 0) { - dy19 = -dy19; - } - proj2 = dx19 + dy19; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum12 = proj1 + proj2; - var neg12 = projC12 < 0; - var abs12 = neg12 ? -projC12 : projC12; - if(abs12 < sum12) { - var depth12 = sum12 - abs12; - if(depth12 < mDepth) { - mDepth = depth12; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 12; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg12 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15685,44 +15729,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * y2X - z1X * y2Z; edgeAxisZ = z1X * y2Y - z1Y * y2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l7 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l7 > 0) { - l7 = 1 / Math.sqrt(l7); - } - edgeAxisX *= l7; - edgeAxisY *= l7; - edgeAxisZ *= l7; - var dx20 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy20 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx20 < 0) { - dx20 = -dx20; - } - if(dy20 < 0) { - dy20 = -dy20; - } - proj1 = dx20 + dy20; - var dx21 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy21 = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; - if(dx21 < 0) { - dx21 = -dx21; - } - if(dy21 < 0) { - dy21 = -dy21; - } - proj2 = dx21 + dy21; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sz2X + edgeAxisY * sz2Y + edgeAxisZ * sz2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum13 = proj1 + proj2; - var neg13 = projC12 < 0; - var abs13 = neg13 ? -projC12 : projC12; - if(abs13 < sum13) { - var depth13 = sum13 - abs13; - if(depth13 < mDepth) { - mDepth = depth13; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 13; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg13 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15732,44 +15776,44 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll edgeAxisY = z1Z * z2X - z1X * z2Z; edgeAxisZ = z1X * z2Y - z1Y * z2X; if(!(edgeAxisX == 0 && edgeAxisY == 0 && edgeAxisZ == 0)) { - var l8 = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; - if(l8 > 0) { - l8 = 1 / Math.sqrt(l8); - } - edgeAxisX *= l8; - edgeAxisY *= l8; - edgeAxisZ *= l8; - var dx22 = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; - var dy22 = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; - if(dx22 < 0) { - dx22 = -dx22; - } - if(dy22 < 0) { - dy22 = -dy22; - } - proj1 = dx22 + dy22; - var dx23 = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; - var dy23 = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; - if(dx23 < 0) { - dx23 = -dx23; - } - if(dy23 < 0) { - dy23 = -dy23; - } - proj2 = dx23 + dy23; + var l = edgeAxisX * edgeAxisX + edgeAxisY * edgeAxisY + edgeAxisZ * edgeAxisZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + edgeAxisX *= l; + edgeAxisY *= l; + edgeAxisZ *= l; + var dx = edgeAxisX * sx1X + edgeAxisY * sx1Y + edgeAxisZ * sx1Z; + var dy = edgeAxisX * sy1X + edgeAxisY * sy1Y + edgeAxisZ * sy1Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj1 = dx + dy; + var dx = edgeAxisX * sx2X + edgeAxisY * sx2Y + edgeAxisZ * sx2Z; + var dy = edgeAxisX * sy2X + edgeAxisY * sy2Y + edgeAxisZ * sy2Z; + if(dx < 0) { + dx = -dx; + } + if(dy < 0) { + dy = -dy; + } + proj2 = dx + dy; projC12 = edgeAxisX * c12X + edgeAxisY * c12Y + edgeAxisZ * c12Z; - var sum14 = proj1 + proj2; - var neg14 = projC12 < 0; - var abs14 = neg14 ? -projC12 : projC12; - if(abs14 < sum14) { - var depth14 = sum14 - abs14; - if(depth14 < mDepth) { - mDepth = depth14; + var sum = proj1 + proj2; + var neg = projC12 < 0; + var abs = neg ? -projC12 : projC12; + if(abs < sum) { + var depth = sum - abs; + if(depth < mDepth) { + mDepth = depth; mId = 14; mAxisX = edgeAxisX; mAxisY = edgeAxisY; mAxisZ = edgeAxisZ; - mSign = neg14 ? -1 : 1; + mSign = neg ? -1 : 1; } } else { return; @@ -15826,9 +15870,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = y1X; d1Y = y1Y; d1Z = y1Z; - var signY1 = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; + var signY = sz1X * mAxisX + sz1Y * mAxisY + sz1Z * mAxisZ > 0; if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { - if(signY1) { + if(signY) { p1X = sx1X + sz1X; p1Y = sx1Y + sz1Y; p1Z = sx1Z + sz1Z; @@ -15837,7 +15881,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p1Y = sx1Y - sz1Y; p1Z = sx1Z - sz1Z; } - } else if(signY1) { + } else if(signY) { p1X = sz1X - sx1X; p1Y = sz1Y - sx1Y; p1Z = sz1Z - sx1Z; @@ -15854,9 +15898,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d1X = z1X; d1Y = z1Y; d1Z = z1Z; - var signY2 = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; + var signY = sy1X * mAxisX + sy1Y * mAxisY + sy1Z * mAxisZ > 0; if(sx1X * mAxisX + sx1Y * mAxisY + sx1Z * mAxisZ > 0) { - if(signY2) { + if(signY) { p1X = sx1X + sy1X; p1Y = sx1Y + sy1Y; p1Z = sx1Z + sy1Z; @@ -15865,7 +15909,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p1Y = sx1Y - sy1Y; p1Z = sx1Z - sy1Z; } - } else if(signY2) { + } else if(signY) { p1X = sy1X - sx1X; p1Y = sy1Y - sx1Y; p1Z = sy1Z - sx1Z; @@ -15886,9 +15930,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = x2X; d2Y = x2Y; d2Z = x2Z; - var signY3 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + var signY = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; if(sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0) { - if(signY3) { + if(signY) { p2X = sy2X + sz2X; p2Y = sy2Y + sz2Y; p2Z = sy2Z + sz2Z; @@ -15897,7 +15941,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p2Y = sy2Y - sz2Y; p2Z = sy2Z - sz2Z; } - } else if(signY3) { + } else if(signY) { p2X = sz2X - sy2X; p2Y = sz2Y - sy2Y; p2Z = sz2Z - sy2Z; @@ -15914,9 +15958,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = y2X; d2Y = y2Y; d2Z = y2Z; - var signY4 = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; + var signY = sz2X * mAxisX + sz2Y * mAxisY + sz2Z * mAxisZ > 0; if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { - if(signY4) { + if(signY) { p2X = sx2X + sz2X; p2Y = sx2Y + sz2Y; p2Z = sx2Z + sz2Z; @@ -15925,7 +15969,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p2Y = sx2Y - sz2Y; p2Z = sx2Z - sz2Z; } - } else if(signY4) { + } else if(signY) { p2X = sz2X - sx2X; p2Y = sz2Y - sx2Y; p2Z = sz2Z - sx2Z; @@ -15942,9 +15986,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll d2X = z2X; d2Y = z2Y; d2Z = z2Z; - var signY5 = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; + var signY = sy2X * mAxisX + sy2Y * mAxisY + sy2Z * mAxisZ > 0; if(sx2X * mAxisX + sx2Y * mAxisY + sx2Z * mAxisZ > 0) { - if(signY5) { + if(signY) { p2X = sx2X + sy2X; p2Y = sx2Y + sy2Y; p2Z = sx2Z + sy2Z; @@ -15953,7 +15997,7 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll p2Y = sx2Y - sy2Y; p2Z = sx2Z - sy2Z; } - } else if(signY5) { + } else if(signY) { p2X = sy2X - sx2X; p2Y = sy2Y - sx2Y; p2Z = sy2Z - sx2Z; @@ -16015,15 +16059,15 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll var tmp = b1; b1 = b2; b2 = tmp; - var tmp1 = w1; + var tmp = w1; w1 = w2; - w2 = tmp1; - var tmp2 = h1; + w2 = tmp; + var tmp = h1; h1 = h2; - h2 = tmp2; - var tmp3 = d1; + h2 = tmp; + var tmp = d1; d1 = d2; - d2 = tmp3; + d2 = tmp; tmpX = c1X; tmpY = c1Y; tmpZ = c1Z; @@ -16171,9 +16215,9 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll refYX = tmpX; refYY = tmpY; refYZ = tmpZ; - var tmp4 = refW; + var tmp = refW; refW = refH; - refH = tmp4; + refH = tmp; } refCenterX += c1X; refCenterY += c1Y; @@ -16411,49 +16455,49 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll _this.h = refH; _this.numVertices = 0; _this.numTmpVertices = 0; - var _this1 = this.clipper; - var _this2 = _this1.vertices[_this1.numVertices++]; - _this2.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; - _this2.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; - _this2.wx = incV1X; - _this2.wy = incV1Y; - _this2.wz = incV1Z; - var _this3 = this.clipper; - var _this4 = _this3.vertices[_this3.numVertices++]; - _this4.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; - _this4.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; - _this4.wx = incV2X; - _this4.wy = incV2Y; - _this4.wz = incV2Z; - var _this5 = this.clipper; - var _this6 = _this5.vertices[_this5.numVertices++]; - _this6.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; - _this6.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; - _this6.wx = incV3X; - _this6.wy = incV3Y; - _this6.wz = incV3Z; - var _this7 = this.clipper; - var _this8 = _this7.vertices[_this7.numVertices++]; - _this8.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; - _this8.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; - _this8.wx = incV4X; - _this8.wy = incV4Y; - _this8.wz = incV4Z; + var _this = this.clipper; + var _this1 = _this.vertices[_this.numVertices++]; + _this1.x = incV1X * refXX + incV1Y * refXY + incV1Z * refXZ; + _this1.y = incV1X * refYX + incV1Y * refYY + incV1Z * refYZ; + _this1.wx = incV1X; + _this1.wy = incV1Y; + _this1.wz = incV1Z; + var _this = this.clipper; + var _this1 = _this.vertices[_this.numVertices++]; + _this1.x = incV2X * refXX + incV2Y * refXY + incV2Z * refXZ; + _this1.y = incV2X * refYX + incV2Y * refYY + incV2Z * refYZ; + _this1.wx = incV2X; + _this1.wy = incV2Y; + _this1.wz = incV2Z; + var _this = this.clipper; + var _this1 = _this.vertices[_this.numVertices++]; + _this1.x = incV3X * refXX + incV3Y * refXY + incV3Z * refXZ; + _this1.y = incV3X * refYX + incV3Y * refYY + incV3Z * refYZ; + _this1.wx = incV3X; + _this1.wy = incV3Y; + _this1.wz = incV3Z; + var _this = this.clipper; + var _this1 = _this.vertices[_this.numVertices++]; + _this1.x = incV4X * refXX + incV4Y * refXY + incV4Z * refXZ; + _this1.y = incV4X * refYX + incV4Y * refYY + incV4Z * refYZ; + _this1.wx = incV4X; + _this1.wy = incV4Y; + _this1.wz = incV4Z; this.clipper.clip(); this.clipper.reduce(); - var normalX1; - var normalY1; - var normalZ1; + var normalX; + var normalY; + var normalZ; if(swapped) { - normalX1 = refNormalX; - normalY1 = refNormalY; - normalZ1 = refNormalZ; + normalX = refNormalX; + normalY = refNormalY; + normalZ = refNormalZ; } else { - normalX1 = -refNormalX; - normalY1 = -refNormalY; - normalZ1 = -refNormalZ; + normalX = -refNormalX; + normalY = -refNormalY; + normalZ = -refNormalZ; } - this.setNormal(result,normalX1,normalY1,normalZ1); + this.setNormal(result,normalX,normalY,normalZ); var _g = 0; var _g1 = this.clipper.numVertices; while(_g < _g1) { @@ -16474,18 +16518,18 @@ oimo_collision_narrowphase_detector_BoxBoxDetector.prototype = $extend(oimo_coll clippedVertexToRefCenterX = refCenterX - clippedVertexX; clippedVertexToRefCenterY = refCenterY - clippedVertexY; clippedVertexToRefCenterZ = refCenterZ - clippedVertexZ; - var depth15 = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; + var depth = clippedVertexToRefCenterX * refNormalX + clippedVertexToRefCenterY * refNormalY + clippedVertexToRefCenterZ * refNormalZ; var clippedVertexOnRefFaceX; var clippedVertexOnRefFaceY; var clippedVertexOnRefFaceZ; - clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth15; - clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth15; - clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth15; - if(depth15 > -oimo_common_Setting.contactPersistenceThreshold) { + clippedVertexOnRefFaceX = clippedVertexX + refNormalX * depth; + clippedVertexOnRefFaceY = clippedVertexY + refNormalY * depth; + clippedVertexOnRefFaceZ = clippedVertexZ + refNormalZ * depth; + if(depth > -oimo_common_Setting.contactPersistenceThreshold) { if(swapped) { - this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth15,i); + this.addPoint(result,clippedVertexX,clippedVertexY,clippedVertexZ,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,depth,i); } else { - this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth15,i); + this.addPoint(result,clippedVertexOnRefFaceX,clippedVertexOnRefFaceY,clippedVertexOnRefFaceZ,clippedVertexX,clippedVertexY,clippedVertexZ,depth,i); } } } @@ -16574,136 +16618,136 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g2 = 0; - var _g11 = this.numVertices; - while(_g2 < _g11) { - var i1 = _g2++; - var v11 = this.vertices[i1]; - var v21 = this.vertices[(i1 + 1) % this.numVertices]; - var s11 = this.w - v11.x; - var s21 = this.w - v21.x; - if(s11 > 0 && s21 > 0) { - var _this4 = this.tmpVertices[this.numTmpVertices++]; - _this4.x = v11.x; - _this4.y = v11.y; - _this4.wx = v11.wx; - _this4.wy = v11.wy; - _this4.wz = v11.wz; - } else if(s11 > 0 && s21 <= 0) { - var _this5 = this.tmpVertices[this.numTmpVertices++]; - _this5.x = v11.x; - _this5.y = v11.y; - _this5.wx = v11.wx; - _this5.wy = v11.wy; - _this5.wz = v11.wz; - var t2 = s11 / (s11 - s21); - var _this6 = this.tmpVertices[this.numTmpVertices++]; - _this6.x = v11.x + (v21.x - v11.x) * t2; - _this6.y = v11.y + (v21.y - v11.y) * t2; - _this6.wx = v11.wx + (v21.wx - v11.wx) * t2; - _this6.wy = v11.wy + (v21.wy - v11.wy) * t2; - _this6.wz = v11.wz + (v21.wz - v11.wz) * t2; - } else if(s11 <= 0 && s21 > 0) { - var t3 = s11 / (s11 - s21); - var _this7 = this.tmpVertices[this.numTmpVertices++]; - _this7.x = v11.x + (v21.x - v11.x) * t3; - _this7.y = v11.y + (v21.y - v11.y) * t3; - _this7.wx = v11.wx + (v21.wx - v11.wx) * t3; - _this7.wy = v11.wy + (v21.wy - v11.wy) * t3; - _this7.wz = v11.wz + (v21.wz - v11.wz) * t3; - } - } - var tmp1 = this.vertices; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this.vertices[i]; + var v2 = this.vertices[(i + 1) % this.numVertices]; + var s1 = this.w - v1.x; + var s2 = this.w - v2.x; + if(s1 > 0 && s2 > 0) { + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.wx = v1.wx; + _this1.wy = v1.wy; + _this1.wz = v1.wz; + var t = s1 / (s1 - s2); + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = v1.x + (v2.x - v1.x) * t; + _this2.y = v1.y + (v2.y - v1.y) * t; + _this2.wx = v1.wx + (v2.wx - v1.wx) * t; + _this2.wy = v1.wy + (v2.wy - v1.wy) * t; + _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + var t1 = s1 / (s1 - s2); + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = v1.x + (v2.x - v1.x) * t1; + _this3.y = v1.y + (v2.y - v1.y) * t1; + _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; + _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; + _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + } + } + var tmp = this.vertices; this.vertices = this.tmpVertices; - this.tmpVertices = tmp1; + this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g3 = 0; - var _g12 = this.numVertices; - while(_g3 < _g12) { - var i2 = _g3++; - var v12 = this.vertices[i2]; - var v22 = this.vertices[(i2 + 1) % this.numVertices]; - var s12 = this.h + v12.y; - var s22 = this.h + v22.y; - if(s12 > 0 && s22 > 0) { - var _this8 = this.tmpVertices[this.numTmpVertices++]; - _this8.x = v12.x; - _this8.y = v12.y; - _this8.wx = v12.wx; - _this8.wy = v12.wy; - _this8.wz = v12.wz; - } else if(s12 > 0 && s22 <= 0) { - var _this9 = this.tmpVertices[this.numTmpVertices++]; - _this9.x = v12.x; - _this9.y = v12.y; - _this9.wx = v12.wx; - _this9.wy = v12.wy; - _this9.wz = v12.wz; - var t4 = s12 / (s12 - s22); - var _this10 = this.tmpVertices[this.numTmpVertices++]; - _this10.x = v12.x + (v22.x - v12.x) * t4; - _this10.y = v12.y + (v22.y - v12.y) * t4; - _this10.wx = v12.wx + (v22.wx - v12.wx) * t4; - _this10.wy = v12.wy + (v22.wy - v12.wy) * t4; - _this10.wz = v12.wz + (v22.wz - v12.wz) * t4; - } else if(s12 <= 0 && s22 > 0) { - var t5 = s12 / (s12 - s22); - var _this11 = this.tmpVertices[this.numTmpVertices++]; - _this11.x = v12.x + (v22.x - v12.x) * t5; - _this11.y = v12.y + (v22.y - v12.y) * t5; - _this11.wx = v12.wx + (v22.wx - v12.wx) * t5; - _this11.wy = v12.wy + (v22.wy - v12.wy) * t5; - _this11.wz = v12.wz + (v22.wz - v12.wz) * t5; - } - } - var tmp2 = this.vertices; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this.vertices[i]; + var v2 = this.vertices[(i + 1) % this.numVertices]; + var s1 = this.h + v1.y; + var s2 = this.h + v2.y; + if(s1 > 0 && s2 > 0) { + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.wx = v1.wx; + _this1.wy = v1.wy; + _this1.wz = v1.wz; + var t = s1 / (s1 - s2); + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = v1.x + (v2.x - v1.x) * t; + _this2.y = v1.y + (v2.y - v1.y) * t; + _this2.wx = v1.wx + (v2.wx - v1.wx) * t; + _this2.wy = v1.wy + (v2.wy - v1.wy) * t; + _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + var t1 = s1 / (s1 - s2); + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = v1.x + (v2.x - v1.x) * t1; + _this3.y = v1.y + (v2.y - v1.y) * t1; + _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; + _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; + _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + } + } + var tmp = this.vertices; this.vertices = this.tmpVertices; - this.tmpVertices = tmp2; + this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; - var _g4 = 0; - var _g13 = this.numVertices; - while(_g4 < _g13) { - var i3 = _g4++; - var v13 = this.vertices[i3]; - var v23 = this.vertices[(i3 + 1) % this.numVertices]; - var s13 = this.h - v13.y; - var s23 = this.h - v23.y; - if(s13 > 0 && s23 > 0) { - var _this12 = this.tmpVertices[this.numTmpVertices++]; - _this12.x = v13.x; - _this12.y = v13.y; - _this12.wx = v13.wx; - _this12.wy = v13.wy; - _this12.wz = v13.wz; - } else if(s13 > 0 && s23 <= 0) { - var _this13 = this.tmpVertices[this.numTmpVertices++]; - _this13.x = v13.x; - _this13.y = v13.y; - _this13.wx = v13.wx; - _this13.wy = v13.wy; - _this13.wz = v13.wz; - var t6 = s13 / (s13 - s23); - var _this14 = this.tmpVertices[this.numTmpVertices++]; - _this14.x = v13.x + (v23.x - v13.x) * t6; - _this14.y = v13.y + (v23.y - v13.y) * t6; - _this14.wx = v13.wx + (v23.wx - v13.wx) * t6; - _this14.wy = v13.wy + (v23.wy - v13.wy) * t6; - _this14.wz = v13.wz + (v23.wz - v13.wz) * t6; - } else if(s13 <= 0 && s23 > 0) { - var t7 = s13 / (s13 - s23); - var _this15 = this.tmpVertices[this.numTmpVertices++]; - _this15.x = v13.x + (v23.x - v13.x) * t7; - _this15.y = v13.y + (v23.y - v13.y) * t7; - _this15.wx = v13.wx + (v23.wx - v13.wx) * t7; - _this15.wy = v13.wy + (v23.wy - v13.wy) * t7; - _this15.wz = v13.wz + (v23.wz - v13.wz) * t7; - } - } - var tmp3 = this.vertices; + var _g = 0; + var _g1 = this.numVertices; + while(_g < _g1) { + var i = _g++; + var v1 = this.vertices[i]; + var v2 = this.vertices[(i + 1) % this.numVertices]; + var s1 = this.h - v1.y; + var s2 = this.h - v2.y; + if(s1 > 0 && s2 > 0) { + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = v1.x; + _this.y = v1.y; + _this.wx = v1.wx; + _this.wy = v1.wy; + _this.wz = v1.wz; + } else if(s1 > 0 && s2 <= 0) { + var _this1 = this.tmpVertices[this.numTmpVertices++]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.wx = v1.wx; + _this1.wy = v1.wy; + _this1.wz = v1.wz; + var t = s1 / (s1 - s2); + var _this2 = this.tmpVertices[this.numTmpVertices++]; + _this2.x = v1.x + (v2.x - v1.x) * t; + _this2.y = v1.y + (v2.y - v1.y) * t; + _this2.wx = v1.wx + (v2.wx - v1.wx) * t; + _this2.wy = v1.wy + (v2.wy - v1.wy) * t; + _this2.wz = v1.wz + (v2.wz - v1.wz) * t; + } else if(s1 <= 0 && s2 > 0) { + var t1 = s1 / (s1 - s2); + var _this3 = this.tmpVertices[this.numTmpVertices++]; + _this3.x = v1.x + (v2.x - v1.x) * t1; + _this3.y = v1.y + (v2.y - v1.y) * t1; + _this3.wx = v1.wx + (v2.wx - v1.wx) * t1; + _this3.wy = v1.wy + (v2.wy - v1.wy) * t1; + _this3.wz = v1.wz + (v2.wz - v1.wz) * t1; + } + } + var tmp = this.vertices; this.vertices = this.tmpVertices; - this.tmpVertices = tmp3; + this.tmpVertices = tmp; this.numVertices = this.numTmpVertices; this.numTmpVertices = 0; } @@ -16726,24 +16770,36 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { var _g = 0; var _g1 = this.numVertices; while(_g < _g1) { - var v = this.vertices[_g++]; + var i = _g++; + var v = this.vertices[i]; var dot1 = v.x * e1x + v.y * e1y; var dot2 = v.x * e2x + v.y * e2y; - if(dot1 > max1) { + if(i == 0) { max1 = dot1; max1V = v; - } - if(dot1 < min1) { min1 = dot1; min1V = v; - } - if(dot2 > max2) { max2 = dot2; max2V = v; - } - if(dot2 < min2) { min2 = dot2; min2V = v; + } else { + if(dot1 > max1) { + max1 = dot1; + max1V = v; + } + if(dot1 < min1) { + min1 = dot1; + min1V = v; + } + if(dot2 > max2) { + max2 = dot2; + max2V = v; + } + if(dot2 < min2) { + min2 = dot2; + min2V = v; + } } } var _this = this.tmpVertices[this.numTmpVertices++]; @@ -16752,24 +16808,24 @@ oimo_collision_narrowphase_detector__$BoxBoxDetector_FaceClipper.prototype = { _this.wx = max1V.wx; _this.wy = max1V.wy; _this.wz = max1V.wz; - var _this1 = this.tmpVertices[this.numTmpVertices++]; - _this1.x = max2V.x; - _this1.y = max2V.y; - _this1.wx = max2V.wx; - _this1.wy = max2V.wy; - _this1.wz = max2V.wz; - var _this2 = this.tmpVertices[this.numTmpVertices++]; - _this2.x = min1V.x; - _this2.y = min1V.y; - _this2.wx = min1V.wx; - _this2.wy = min1V.wy; - _this2.wz = min1V.wz; - var _this3 = this.tmpVertices[this.numTmpVertices++]; - _this3.x = min2V.x; - _this3.y = min2V.y; - _this3.wx = min2V.wx; - _this3.wy = min2V.wy; - _this3.wz = min2V.wz; + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = max2V.x; + _this.y = max2V.y; + _this.wx = max2V.wx; + _this.wy = max2V.wy; + _this.wz = max2V.wz; + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = min1V.x; + _this.y = min1V.y; + _this.wx = min1V.wx; + _this.wy = min1V.wy; + _this.wz = min1V.wz; + var _this = this.tmpVertices[this.numTmpVertices++]; + _this.x = min2V.x; + _this.y = min2V.y; + _this.wx = min2V.wx; + _this.wy = min2V.wy; + _this.wz = min2V.wz; var tmp = this.vertices; this.vertices = this.tmpVertices; this.tmpVertices = tmp; @@ -17009,10 +17065,10 @@ oimo_collision_narrowphase_detector_GjkEpaDetector.prototype = $extend(oimo_coll pos1X = v.x; pos1Y = v.y; pos1Z = v.z; - var v1 = gjkEpa.closestPoint2; - pos2X = v1.x; - pos2Y = v1.y; - pos2Z = v1.z; + var v = gjkEpa.closestPoint2; + pos2X = v.x; + pos2Y = v.y; + pos2Z = v.z; var normalX; var normalY; var normalZ; @@ -17185,24 +17241,24 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c var normalX; var normalY; var normalZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; - __tmp__Y1 = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; - __tmp__Z1 = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; - boxToClosestPointX = __tmp__X1; - boxToClosestPointY = __tmp__Y1; - boxToClosestPointZ = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; - __tmp__Y2 = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; - __tmp__Z2 = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; - normalX = __tmp__X2; - normalY = __tmp__Y2; - normalZ = __tmp__Z2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X; + boxToClosestPointY = __tmp__Y; + boxToClosestPointZ = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * normalInBoxX + tf2._rotation01 * normalInBoxY + tf2._rotation02 * normalInBoxZ; + __tmp__Y = tf2._rotation10 * normalInBoxX + tf2._rotation11 * normalInBoxY + tf2._rotation12 * normalInBoxZ; + __tmp__Z = tf2._rotation20 * normalInBoxX + tf2._rotation21 * normalInBoxY + tf2._rotation22 * normalInBoxZ; + normalX = __tmp__X; + normalY = __tmp__Y; + normalZ = __tmp__Z; this.setNormal(result,normalX,normalY,normalZ); var pos1X; var pos1Y; @@ -17219,80 +17275,86 @@ oimo_collision_narrowphase_detector_SphereBoxDetector.prototype = $extend(oimo_c this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,depth,0); return; } - var boxToClosestPointInBoxX1; - var boxToClosestPointInBoxY1; - var boxToClosestPointInBoxZ1; + var boxToClosestPointInBoxX; + var boxToClosestPointInBoxY; + var boxToClosestPointInBoxZ; halfExtX -= 1e-9; halfExtY -= 1e-9; halfExtZ -= 1e-9; negHalfExtX += 1e-9; negHalfExtY += 1e-9; negHalfExtZ += 1e-9; - boxToClosestPointInBoxX1 = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; - boxToClosestPointInBoxY1 = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; - boxToClosestPointInBoxZ1 = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; - boxToClosestPointInBoxX1 = boxToClosestPointInBoxX1 > negHalfExtX ? boxToClosestPointInBoxX1 : negHalfExtX; - boxToClosestPointInBoxY1 = boxToClosestPointInBoxY1 > negHalfExtY ? boxToClosestPointInBoxY1 : negHalfExtY; - boxToClosestPointInBoxZ1 = boxToClosestPointInBoxZ1 > negHalfExtZ ? boxToClosestPointInBoxZ1 : negHalfExtZ; + boxToClosestPointInBoxX = boxToSphereInBoxX < halfExtX ? boxToSphereInBoxX : halfExtX; + boxToClosestPointInBoxY = boxToSphereInBoxY < halfExtY ? boxToSphereInBoxY : halfExtY; + boxToClosestPointInBoxZ = boxToSphereInBoxZ < halfExtZ ? boxToSphereInBoxZ : halfExtZ; + if(!(boxToClosestPointInBoxX > negHalfExtX)) { + boxToClosestPointInBoxX = negHalfExtX; + } + if(!(boxToClosestPointInBoxY > negHalfExtY)) { + boxToClosestPointInBoxY = negHalfExtY; + } + if(!(boxToClosestPointInBoxZ > negHalfExtZ)) { + boxToClosestPointInBoxZ = negHalfExtZ; + } var closestPointToSphereInBoxX; var closestPointToSphereInBoxY; var closestPointToSphereInBoxZ; - closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX1; - closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY1; - closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ1; + closestPointToSphereInBoxX = boxToSphereInBoxX - boxToClosestPointInBoxX; + closestPointToSphereInBoxY = boxToSphereInBoxY - boxToClosestPointInBoxY; + closestPointToSphereInBoxZ = boxToSphereInBoxZ - boxToClosestPointInBoxZ; var dist = closestPointToSphereInBoxX * closestPointToSphereInBoxX + closestPointToSphereInBoxY * closestPointToSphereInBoxY + closestPointToSphereInBoxZ * closestPointToSphereInBoxZ; if(dist >= r * r) { return; } dist = Math.sqrt(dist); - var boxToClosestPointX1; - var boxToClosestPointY1; - var boxToClosestPointZ1; + var boxToClosestPointX; + var boxToClosestPointY; + var boxToClosestPointZ; var closestPointToSphereX; var closestPointToSphereY; var closestPointToSphereZ; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * boxToClosestPointInBoxX1 + tf2._rotation01 * boxToClosestPointInBoxY1 + tf2._rotation02 * boxToClosestPointInBoxZ1; - __tmp__Y3 = tf2._rotation10 * boxToClosestPointInBoxX1 + tf2._rotation11 * boxToClosestPointInBoxY1 + tf2._rotation12 * boxToClosestPointInBoxZ1; - __tmp__Z3 = tf2._rotation20 * boxToClosestPointInBoxX1 + tf2._rotation21 * boxToClosestPointInBoxY1 + tf2._rotation22 * boxToClosestPointInBoxZ1; - boxToClosestPointX1 = __tmp__X3; - boxToClosestPointY1 = __tmp__Y3; - boxToClosestPointZ1 = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; - __tmp__Y4 = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; - __tmp__Z4 = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; - closestPointToSphereX = __tmp__X4; - closestPointToSphereY = __tmp__Y4; - closestPointToSphereZ = __tmp__Z4; - var normalX1; - var normalY1; - var normalZ1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * boxToClosestPointInBoxX + tf2._rotation01 * boxToClosestPointInBoxY + tf2._rotation02 * boxToClosestPointInBoxZ; + __tmp__Y = tf2._rotation10 * boxToClosestPointInBoxX + tf2._rotation11 * boxToClosestPointInBoxY + tf2._rotation12 * boxToClosestPointInBoxZ; + __tmp__Z = tf2._rotation20 * boxToClosestPointInBoxX + tf2._rotation21 * boxToClosestPointInBoxY + tf2._rotation22 * boxToClosestPointInBoxZ; + boxToClosestPointX = __tmp__X; + boxToClosestPointY = __tmp__Y; + boxToClosestPointZ = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * closestPointToSphereInBoxX + tf2._rotation01 * closestPointToSphereInBoxY + tf2._rotation02 * closestPointToSphereInBoxZ; + __tmp__Y = tf2._rotation10 * closestPointToSphereInBoxX + tf2._rotation11 * closestPointToSphereInBoxY + tf2._rotation12 * closestPointToSphereInBoxZ; + __tmp__Z = tf2._rotation20 * closestPointToSphereInBoxX + tf2._rotation21 * closestPointToSphereInBoxY + tf2._rotation22 * closestPointToSphereInBoxZ; + closestPointToSphereX = __tmp__X; + closestPointToSphereY = __tmp__Y; + closestPointToSphereZ = __tmp__Z; + var normalX; + var normalY; + var normalZ; var l = closestPointToSphereX * closestPointToSphereX + closestPointToSphereY * closestPointToSphereY + closestPointToSphereZ * closestPointToSphereZ; if(l > 0) { l = 1 / Math.sqrt(l); } - normalX1 = closestPointToSphereX * l; - normalY1 = closestPointToSphereY * l; - normalZ1 = closestPointToSphereZ * l; - this.setNormal(result,normalX1,normalY1,normalZ1); - var pos1X1; - var pos1Y1; - var pos1Z1; - var pos2X1; - var pos2Y1; - var pos2Z1; - pos1X1 = tf1._positionX + normalX1 * -r; - pos1Y1 = tf1._positionY + normalY1 * -r; - pos1Z1 = tf1._positionZ + normalZ1 * -r; - pos2X1 = tf2._positionX + boxToClosestPointX1; - pos2Y1 = tf2._positionY + boxToClosestPointY1; - pos2Z1 = tf2._positionZ + boxToClosestPointZ1; - this.addPoint(result,pos1X1,pos1Y1,pos1Z1,pos2X1,pos2Y1,pos2Z1,r - dist,0); + normalX = closestPointToSphereX * l; + normalY = closestPointToSphereY * l; + normalZ = closestPointToSphereZ * l; + this.setNormal(result,normalX,normalY,normalZ); + var pos1X; + var pos1Y; + var pos1Z; + var pos2X; + var pos2Y; + var pos2Z; + pos1X = tf1._positionX + normalX * -r; + pos1Y = tf1._positionY + normalY * -r; + pos1Z = tf1._positionZ + normalZ * -r; + pos2X = tf2._positionX + boxToClosestPointX; + pos2Y = tf2._positionY + boxToClosestPointY; + pos2Z = tf2._positionZ + boxToClosestPointZ; + this.addPoint(result,pos1X,pos1Y,pos1Z,pos2X,pos2Y,pos2Z,r - dist,0); } ,__class__: oimo_collision_narrowphase_detector_SphereBoxDetector }); @@ -17513,9 +17575,9 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { _this.x -= v.x; _this.y -= v.y; _this.z -= v.z; - var _this1 = base.tmp; - var v1 = base._normal; - base._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; + var _this = base.tmp; + var v = base._normal; + base._tmpDfsVisible = _this.x * v.x + _this.y * v.y + _this.z * v.z > 0; if(!base._tmpDfsVisible) { this._status = 6; return; @@ -17527,17 +17589,17 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { if(t == null) { continue; } - var _this2 = t.tmp; - _this2.x = from.x; - _this2.y = from.y; - _this2.z = from.z; - var v2 = t._vertices[0].v; - _this2.x -= v2.x; - _this2.y -= v2.y; - _this2.z -= v2.z; - var _this3 = t.tmp; - var v3 = t._normal; - t._tmpDfsVisible = _this3.x * v3.x + _this3.y * v3.y + _this3.z * v3.z > 0; + var _this = t.tmp; + _this.x = from.x; + _this.y = from.y; + _this.z = from.z; + var v = t._vertices[0].v; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; + var _this1 = t.tmp; + var v1 = t._normal; + t._tmpDfsVisible = _this1.x * v1.x + _this1.y * v1.y + _this1.z * v1.z > 0; if(t._tmpDfsVisible) { this.findEdgeLoop(id,t,from); } else { @@ -17554,19 +17616,19 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { base._adjacentTriangles[0] = null; base._adjacentPairIndex[0] = -1; } - var triangle1 = base._adjacentTriangles[1]; - if(triangle1 != null) { - var pairIndex1 = base._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + var triangle = base._adjacentTriangles[1]; + if(triangle != null) { + var pairIndex = base._adjacentPairIndex[1]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[1] = null; base._adjacentPairIndex[1] = -1; } - var triangle2 = base._adjacentTriangles[2]; - if(triangle2 != null) { - var pairIndex2 = base._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + var triangle = base._adjacentTriangles[2]; + if(triangle != null) { + var pairIndex = base._adjacentPairIndex[2]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; base._adjacentTriangles[2] = null; base._adjacentPairIndex[2] = -1; } @@ -17603,18 +17665,18 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var v5 = v2.v; - _this.x += v5.x; - _this.y += v5.y; - _this.z += v5.z; - var v6 = v3.v; - _this.x += v6.x; - _this.y += v6.y; - _this.z += v6.z; - var v7 = v4.v; - _this.x += v7.x; - _this.y += v7.y; - _this.z += v7.z; + var v = v2.v; + _this.x += v.x; + _this.y += v.y; + _this.z += v.z; + var v = v3.v; + _this.x += v.x; + _this.y += v.y; + _this.z += v.z; + var v = v4.v; + _this.x += v.x; + _this.y += v.y; + _this.z += v.z; _this.x *= 0.25; _this.y *= 0.25; _this.z *= 0.25; @@ -17626,30 +17688,30 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } var t1 = first; - var first1 = this._trianglePool; - if(first1 != null) { - this._trianglePool = first1._next; - first1._next = null; + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; } else { - first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t2 = first1; - var first2 = this._trianglePool; - if(first2 != null) { - this._trianglePool = first2._next; - first2._next = null; + var t2 = first; + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; } else { - first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t3 = first2; - var first3 = this._trianglePool; - if(first3 != null) { - this._trianglePool = first3._next; - first3._next = null; + var t3 = first; + var first = this._trianglePool; + if(first != null) { + this._trianglePool = first._next; + first._next = null; } else { - first3 = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaTriangle(); } - var t4 = first3; + var t4 = first; if(!t1.init(v1,v2,v3,this._center,true)) { this._status = 1; } @@ -17730,6 +17792,7 @@ oimo_collision_narrowphase_detector_gjkepa_EpaPolyhedron.prototype = { var firstT = null; while(true) { if(v._tmpEdgeLoopNext == null) { + this._dumpAsObjModel(); this._status = 4; return false; } @@ -17831,14 +17894,14 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { v1X = v.x; v1Y = v.y; v1Z = v.z; - var v1 = vertex2.v; - v2X = v1.x; - v2Y = v1.y; - v2Z = v1.z; - var v2 = vertex3.v; - v3X = v2.x; - v3Y = v2.y; - v3Z = v2.z; + var v = vertex2.v; + v2X = v.x; + v2Y = v.y; + v2Z = v.z; + var v = vertex3.v; + v3X = v.x; + v3Y = v.y; + v3Z = v.z; vcX = center.x; vcY = center.y; vcZ = center.z; @@ -17882,56 +17945,56 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._vertices[0] = vertex1; this._vertices[1] = vertex2; this._vertices[2] = vertex3; - var v3 = this._normal; - v3.x = inorX; - v3.y = inorY; - v3.z = inorZ; + var v = this._normal; + v.x = inorX; + v.y = inorY; + v.z = inorZ; var vec1 = vertex1.v; var vec2 = vertex2.v; var vec3 = vertex3.v; var out = this.tmp; - var v1X1; - var v1Y1; - var v1Z1; - var v2X1; - var v2Y1; - var v2Z1; - var v3X1; - var v3Y1; - var v3Z1; - var v12X1; - var v12Y1; - var v12Z1; + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; var v23X; var v23Y; var v23Z; var v31X; var v31Y; var v31Z; - v1X1 = vec1.x; - v1Y1 = vec1.y; - v1Z1 = vec1.z; - v2X1 = vec2.x; - v2Y1 = vec2.y; - v2Z1 = vec2.z; - v3X1 = vec3.x; - v3Y1 = vec3.y; - v3Z1 = vec3.z; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - v23X = v3X1 - v2X1; - v23Y = v3Y1 - v2Y1; - v23Z = v3Z1 - v2Z1; - v31X = v1X1 - v3X1; - v31Y = v1Y1 - v3Y1; - v31Z = v1Z1 - v3Z1; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X = vec2.x; + v2Y = vec2.y; + v2Z = vec2.z; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; var nX; var nY; var nZ; - nX = v12Y1 * v23Z - v12Z1 * v23Y; - nY = v12Z1 * v23X - v12X1 * v23Z; - nZ = v12X1 * v23Y - v12Y1 * v23X; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; var n12X; var n12Y; var n12Z; @@ -17941,9 +18004,9 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { var n31X; var n31Y; var n31Z; - n12X = v12Y1 * nZ - v12Z1 * nY; - n12Y = v12Z1 * nX - v12X1 * nZ; - n12Z = v12X1 * nY - v12Y1 * nX; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; n23X = v23Y * nZ - v23Z * nY; n23Y = v23Z * nX - v23X * nZ; n23Z = v23X * nY - v23Y * nX; @@ -17957,42 +18020,42 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { minvX = 0; minvY = 0; minvZ = 0; - if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec1.x; - v1Y2 = vec1.y; - v1Z2 = vec1.z; - v2X2 = vec2.x; - v2Y2 = vec2.y; - v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); if(t < 0) { - out.x = v1X2; - out.y = v1Y2; - out.z = v1Z2; + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; } else if(t > 1) { - out.x = v2X2; - out.y = v2Y2; - out.z = v2Z2; + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; } else { var pX; var pY; var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; out.x = pX; out.y = pY; out.z = pZ; @@ -18002,45 +18065,45 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { minvY = out.y; minvZ = out.z; } - if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - if(t1 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - } else if(t1 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec2.x; + v1Y1 = vec2.y; + v1Z1 = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; } var d = out.x * out.x + out.y * out.y + out.z * out.z; if(mind < 0 || d < mind) { @@ -18050,49 +18113,49 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { minvZ = out.z; } } - if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - if(t2 < 0) { - out.x = v1X4; - out.y = v1Y4; - out.z = v1Z4; - } else if(t2 > 1) { - out.x = v2X4; - out.y = v2Y4; - out.z = v2Z4; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d1 < mind) { - mind = d1; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mind = d; minvX = out.x; minvY = out.y; minvZ = out.z; @@ -18111,7 +18174,7 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { nY *= l; nZ *= l; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; minvX = nX * l2; minvY = nY * l2; minvZ = nZ * l2; @@ -18208,19 +18271,19 @@ oimo_collision_narrowphase_detector_gjkepa_EpaTriangle.prototype = { this._adjacentTriangles[0] = null; this._adjacentPairIndex[0] = -1; } - var triangle1 = this._adjacentTriangles[1]; - if(triangle1 != null) { - var pairIndex1 = this._adjacentPairIndex[1]; - triangle1._adjacentTriangles[pairIndex1] = null; - triangle1._adjacentPairIndex[pairIndex1] = -1; + var triangle = this._adjacentTriangles[1]; + if(triangle != null) { + var pairIndex = this._adjacentPairIndex[1]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[1] = null; this._adjacentPairIndex[1] = -1; } - var triangle2 = this._adjacentTriangles[2]; - if(triangle2 != null) { - var pairIndex2 = this._adjacentPairIndex[2]; - triangle2._adjacentTriangles[pairIndex2] = null; - triangle2._adjacentPairIndex[pairIndex2] = -1; + var triangle = this._adjacentTriangles[2]; + if(triangle != null) { + var pairIndex = this._adjacentPairIndex[2]; + triangle._adjacentTriangles[pairIndex] = null; + triangle._adjacentPairIndex[pairIndex] = -1; this._adjacentTriangles[2] = null; this._adjacentPairIndex[2] = -1; } @@ -18258,14 +18321,14 @@ oimo_collision_narrowphase_detector_gjkepa_EpaVertex.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1; - _this1.x = w1.x; - _this1.y = w1.y; - _this1.z = w1.z; - var _this2 = this.w2; - _this2.x = w2.x; - _this2.y = w2.y; - _this2.z = w2.z; + var _this = this.w1; + _this.x = w1.x; + _this.y = w1.y; + _this.z = w1.z; + var _this = this.w2; + _this.x = w2.x; + _this.y = w2.y; + _this.z = w2.z; this._next = null; this._tmpEdgeLoopNext = null; this._tmpEdgeLoopOuterTriangle = null; @@ -18404,10 +18467,9 @@ oimo_common_Vec3.prototype = { var vX; var vY; var vZ; - var v = this; - vX = v.x; - vY = v.y; - vZ = v.z; + vX = this.x; + vY = this.y; + vZ = this.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -18446,10 +18508,9 @@ oimo_common_Vec3.prototype = { var vX; var vY; var vZ; - var v = this; - vX = v.x; - vY = v.y; - vZ = v.z; + vX = this.x; + vY = this.y; + vZ = this.z; var __tmp__X; var __tmp__Y; var __tmp__Z; @@ -18462,10 +18523,9 @@ oimo_common_Vec3.prototype = { vX += tf._positionX; vY += tf._positionY; vZ += tf._positionZ; - var v1 = this; - v1.x = vX; - v1.y = vY; - v1.z = vZ; + this.x = vX; + this.y = vY; + this.z = vZ; return this; } ,length: function() { @@ -18994,21 +19054,21 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var v1 = this.w2[this.simplexSize]; - _this.x -= v1.x; - _this.y -= v1.y; - _this.z -= v1.z; + var v = this.w2[this.simplexSize]; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; this.simplexSize = 1; var count = 0; while(count < 40) { - var v2 = 0; + var v = 0; switch(this.simplexSize) { case 1: - var v3 = s[0]; - closest.x = v3.x; - closest.y = v3.y; - closest.z = v3.z; - v2 = 1; + var v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: var v1X; @@ -19017,14 +19077,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var v2X; var v2Y; var v2Z; - var v4 = s[0]; - v1X = v4.x; - v1Y = v4.y; - v1Z = v4.z; - var v5 = s[1]; - v2X = v5.x; - v2Y = v5.y; - v2Z = v5.z; + var v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + var v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; var v12X; var v12Y; var v12Z; @@ -19037,12 +19097,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = v1X; closest.y = v1Y; closest.z = v1Z; - v2 = 1; + v = 1; } else if(t > 1) { closest.x = v2X; closest.y = v2Y; closest.z = v2Z; - v2 = 2; + v = 2; } else { var pX; var pY; @@ -19053,7 +19113,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = pX; closest.y = pY; closest.z = pZ; - v2 = 3; + v = 3; } break; case 3: @@ -19288,7 +19348,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v2 = mini; + v = mini; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -19305,7 +19365,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v2 = 7; + v = 7; } break; case 4: @@ -20433,10 +20493,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX1; closest.y = minvY1; closest.z = minvZ1; - v2 = mini1; + v = mini1; } else { closest.zero(); - v2 = 15; + v = 15; } break; } @@ -20468,7 +20528,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.distance = 0; return 1; } - this.shrinkSimplex(v2); + this.shrinkSimplex(v); dir.x = closest.x; dir.y = closest.y; dir.z = closest.z; @@ -20477,20 +20537,20 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { dir.z = -dir.z; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this1 = this.s[this.simplexSize]; - var v6 = this.w1[this.simplexSize]; - _this1.x = v6.x; - _this1.y = v6.y; - _this1.z = v6.z; - var v7 = this.w2[this.simplexSize]; - _this1.x -= v7.x; - _this1.y -= v7.y; - _this1.z -= v7.z; + var _this = this.s[this.simplexSize]; + var v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + var v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } - var _this2 = s[this.simplexSize]; - if(_this2.x * dir.x + _this2.y * dir.y + _this2.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { + var _this1 = s[this.simplexSize]; + if(_this1.x * dir.x + _this1.y * dir.y + _this1.z * dir.z - (closest.x * dir.x + closest.y * dir.y + closest.z * dir.z) < 1e-008) { this.interpolateClosestPoints(); this.distance = Math.sqrt(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z); if(cache != null && cache._gjkCache != null) { @@ -20534,14 +20594,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } this.computeWitnessPoint2(true); var _this = this.s[this.simplexSize]; - var v1 = this.w1[this.simplexSize]; - _this.x = v1.x; - _this.y = v1.y; - _this.z = v1.z; - var v2 = this.w2[this.simplexSize]; - _this.x -= v2.x; - _this.y -= v2.y; - _this.z -= v2.z; + var v = this.w1[this.simplexSize]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var v = this.w2[this.simplexSize]; + _this.x -= v.x; + _this.y -= v.y; + _this.z -= v.z; this.simplexSize = 1; var count = 0; var lambda = 0.0; @@ -20555,14 +20615,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { rayR.y -= tl1.y; rayR.z -= tl1.z; while(count < 40) { - var v3 = 0; + var v = 0; switch(this.simplexSize) { case 1: - var v4 = s[0]; - closest.x = v4.x; - closest.y = v4.y; - closest.z = v4.z; - v3 = 1; + var v1 = s[0]; + closest.x = v1.x; + closest.y = v1.y; + closest.z = v1.z; + v = 1; break; case 2: var v1X; @@ -20571,14 +20631,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var v2X; var v2Y; var v2Z; - var v5 = s[0]; - v1X = v5.x; - v1Y = v5.y; - v1Z = v5.z; - var v6 = s[1]; - v2X = v6.x; - v2Y = v6.y; - v2Z = v6.z; + var v2 = s[0]; + v1X = v2.x; + v1Y = v2.y; + v1Z = v2.z; + var v3 = s[1]; + v2X = v3.x; + v2Y = v3.y; + v2Z = v3.z; var v12X; var v12Y; var v12Z; @@ -20591,12 +20651,12 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = v1X; closest.y = v1Y; closest.z = v1Z; - v3 = 1; + v = 1; } else if(t > 1) { closest.x = v2X; closest.y = v2Y; closest.z = v2Z; - v3 = 2; + v = 2; } else { var pX; var pY; @@ -20607,7 +20667,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = pX; closest.y = pY; closest.z = pZ; - v3 = 3; + v = 3; } break; case 3: @@ -20842,7 +20902,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v3 = mini; + v = mini; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -20859,7 +20919,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX; closest.y = minvY; closest.z = minvZ; - v3 = 7; + v = 7; } break; case 4: @@ -21987,14 +22047,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { closest.x = minvX1; closest.y = minvY1; closest.z = minvZ1; - v3 = mini1; + v = mini1; } else { closest.zero(); - v3 = 15; + v = 15; } break; } - this.shrinkSimplex(v3); + this.shrinkSimplex(v); if(closest.x * closest.x + closest.y * closest.y + closest.z * closest.z < 1e-008) { if(lambda == 0 || this.simplexSize == 4) { hit.fraction = lambda; @@ -22002,25 +22062,25 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } this.interpolateClosestPoints(); hit.fraction = lambda; - var _this1 = hit.normal; - _this1.x = dir.x; - _this1.y = dir.y; - _this1.z = dir.z; - var invLen = Math.sqrt(_this1.x * _this1.x + _this1.y * _this1.y + _this1.z * _this1.z); + var _this = hit.normal; + _this.x = dir.x; + _this.y = dir.y; + _this.z = dir.z; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - _this1.x *= invLen; - _this1.y *= invLen; - _this1.z *= invLen; - var _this2 = hit.position; - var v7 = this.closestPoint1; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - _this2.x += tl1.x * lambda; - _this2.y += tl1.y * lambda; - _this2.z += tl1.z * lambda; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; + var _this1 = hit.position; + var v4 = this.closestPoint1; + _this1.x = v4.x; + _this1.y = v4.y; + _this1.z = v4.z; + _this1.x += tl1.x * lambda; + _this1.y += tl1.y * lambda; + _this1.z += tl1.z * lambda; return true; } dir.x = closest.x; @@ -22032,25 +22092,25 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { if(this.c1 != null) { this.computeWitnessPoint1(true); } else { - var v8 = this.w1[this.simplexSize]; - v8.x = this.tf1._positionX; - v8.y = this.tf1._positionY; - v8.z = this.tf1._positionZ; + var v5 = this.w1[this.simplexSize]; + v5.x = this.tf1._positionX; + v5.y = this.tf1._positionY; + v5.z = this.tf1._positionZ; } this.computeWitnessPoint2(true); - var _this3 = this.s[this.simplexSize]; - var v9 = this.w1[this.simplexSize]; - _this3.x = v9.x; - _this3.y = v9.y; - _this3.z = v9.z; - var v10 = this.w2[this.simplexSize]; - _this3.x -= v10.x; - _this3.y -= v10.y; - _this3.z -= v10.z; - var _this4 = s[this.simplexSize]; - _this4.x -= rayX.x; - _this4.y -= rayX.y; - _this4.z -= rayX.z; + var _this2 = this.s[this.simplexSize]; + var v6 = this.w1[this.simplexSize]; + _this2.x = v6.x; + _this2.y = v6.y; + _this2.z = v6.z; + var v7 = this.w2[this.simplexSize]; + _this2.x -= v7.x; + _this2.y -= v7.y; + _this2.z -= v7.z; + var _this3 = s[this.simplexSize]; + _this3.x -= rayX.x; + _this3.y -= rayX.y; + _this3.z -= rayX.z; if(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z < 1e-008) { throw new Error("!?"); } @@ -22068,21 +22128,21 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { rayX.x += rayR.x * dLambda; rayX.y += rayR.y * dLambda; rayX.z += rayR.z * dLambda; - var _g1 = 0; - var _g2 = this.simplexSize + 1; - while(_g1 < _g2) { - var _this5 = s[_g1++]; + var _g = 0; + var _g1 = this.simplexSize + 1; + while(_g < _g1) { + var _this4 = s[_g++]; var s1 = -dLambda; - _this5.x += rayR.x * s1; - _this5.y += rayR.y * s1; - _this5.z += rayR.z * s1; + _this4.x += rayR.x * s1; + _this4.y += rayR.y * s1; + _this4.z += rayR.z * s1; } } var duplicate = false; - var _g11 = 0; - var _g21 = this.simplexSize; - while(_g11 < _g21) { - var i = _g11++; + var _g2 = 0; + var _g3 = this.simplexSize; + while(_g2 < _g3) { + var i = _g2++; var dx = s[i].x - s[this.simplexSize].x; var dy = s[i].y - s[this.simplexSize].y; var dz = s[i].z - s[this.simplexSize].z; @@ -22106,20 +22166,20 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.closestPoint2; - var v1 = this.w2[0]; - _this1.x = v1.x; - _this1.y = v1.y; - _this1.z = v1.z; + var _this = this.closestPoint2; + var v = this.w2[0]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 2: var cX; var cY; var cZ; - var v2 = this.closest; - cX = v2.x; - cY = v2.y; - cZ = v2.z; + var v = this.closest; + cX = v.x; + cY = v.y; + cZ = v.z; var s0X; var s0Y; var s0Z; @@ -22138,30 +22198,30 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var w21X; var w21Y; var w21Z; - var v3 = this.s[0]; - s0X = v3.x; - s0Y = v3.y; - s0Z = v3.z; - var v4 = this.w1[0]; - w10X = v4.x; - w10Y = v4.y; - w10Z = v4.z; - var v5 = this.w2[0]; - w20X = v5.x; - w20Y = v5.y; - w20Z = v5.z; - var v6 = this.s[1]; - s1X = v6.x; - s1Y = v6.y; - s1Z = v6.z; - var v7 = this.w1[1]; - w11X = v7.x; - w11Y = v7.y; - w11Z = v7.z; - var v8 = this.w2[1]; - w21X = v8.x; - w21Y = v8.y; - w21Z = v8.z; + var v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + var v = this.w1[0]; + w10X = v.x; + w10Y = v.y; + w10Z = v.z; + var v = this.w2[0]; + w20X = v.x; + w20Y = v.y; + w20Z = v.z; + var v = this.s[1]; + s1X = v.x; + s1Y = v.y; + s1Z = v.z; + var v = this.w1[1]; + w11X = v.x; + w11Y = v.y; + w11Z = v.z; + var v = this.w2[1]; + w21X = v.x; + w21Y = v.y; + w21Z = v.z; var s01X; var s01Y; var s01Z; @@ -22200,41 +22260,41 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { cp2X = w20X + diffX * t; cp2Y = w20Y + diffY * t; cp2Z = w20Z + diffZ * t; - var v9 = this.closestPoint1; - v9.x = cp1X; - v9.y = cp1Y; - v9.z = cp1Z; - var v10 = this.closestPoint2; - v10.x = cp2X; - v10.y = cp2Y; - v10.z = cp2Z; + var v = this.closestPoint1; + v.x = cp1X; + v.y = cp1Y; + v.z = cp1Z; + var v = this.closestPoint2; + v.x = cp2X; + v.y = cp2Y; + v.z = cp2Z; break; case 3: - var cX1; - var cY1; - var cZ1; - var v11 = this.closest; - cX1 = v11.x; - cY1 = v11.y; - cZ1 = v11.z; - var s0X1; - var s0Y1; - var s0Z1; - var w10X1; - var w10Y1; - var w10Z1; - var w20X1; - var w20Y1; - var w20Z1; - var s1X1; - var s1Y1; - var s1Z1; - var w11X1; - var w11Y1; - var w11Z1; - var w21X1; - var w21Y1; - var w21Z1; + var cX; + var cY; + var cZ; + var v = this.closest; + cX = v.x; + cY = v.y; + cZ = v.z; + var s0X; + var s0Y; + var s0Z; + var w10X; + var w10Y; + var w10Z; + var w20X; + var w20Y; + var w20Z; + var s1X; + var s1Y; + var s1Z; + var w11X; + var w11Y; + var w11Z; + var w21X; + var w21Y; + var w21Z; var s2X; var s2Y; var s2Z; @@ -22244,112 +22304,112 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var w22X; var w22Y; var w22Z; - var v12 = this.s[0]; - s0X1 = v12.x; - s0Y1 = v12.y; - s0Z1 = v12.z; - var v13 = this.w1[0]; - w10X1 = v13.x; - w10Y1 = v13.y; - w10Z1 = v13.z; - var v14 = this.w2[0]; - w20X1 = v14.x; - w20Y1 = v14.y; - w20Z1 = v14.z; - var v15 = this.s[1]; - s1X1 = v15.x; - s1Y1 = v15.y; - s1Z1 = v15.z; - var v16 = this.w1[1]; - w11X1 = v16.x; - w11Y1 = v16.y; - w11Z1 = v16.z; - var v17 = this.w2[1]; - w21X1 = v17.x; - w21Y1 = v17.y; - w21Z1 = v17.z; - var v18 = this.s[2]; - s2X = v18.x; - s2Y = v18.y; - s2Z = v18.z; - var v19 = this.w1[2]; - w12X = v19.x; - w12Y = v19.y; - w12Z = v19.z; - var v20 = this.w2[2]; - w22X = v20.x; - w22Y = v20.y; - w22Z = v20.z; - var s01X1; - var s01Y1; - var s01Z1; + var v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + var v = this.w1[0]; + w10X = v.x; + w10Y = v.y; + w10Z = v.z; + var v = this.w2[0]; + w20X = v.x; + w20Y = v.y; + w20Z = v.z; + var v = this.s[1]; + s1X = v.x; + s1Y = v.y; + s1Z = v.z; + var v = this.w1[1]; + w11X = v.x; + w11Y = v.y; + w11Z = v.z; + var v = this.w2[1]; + w21X = v.x; + w21Y = v.y; + w21Z = v.z; + var v = this.s[2]; + s2X = v.x; + s2Y = v.y; + s2Z = v.z; + var v = this.w1[2]; + w12X = v.x; + w12Y = v.y; + w12Z = v.z; + var v = this.w2[2]; + w22X = v.x; + w22Y = v.y; + w22Z = v.z; + var s01X; + var s01Y; + var s01Z; var s02X; var s02Y; var s02Z; - var s0cX1; - var s0cY1; - var s0cZ1; - s01X1 = s1X1 - s0X1; - s01Y1 = s1Y1 - s0Y1; - s01Z1 = s1Z1 - s0Z1; - s02X = s2X - s0X1; - s02Y = s2Y - s0Y1; - s02Z = s2Z - s0Z1; - s0cX1 = cX1 - s0X1; - s0cY1 = cY1 - s0Y1; - s0cZ1 = cZ1 - s0Z1; - var d11 = s01X1 * s01X1 + s01Y1 * s01Y1 + s01Z1 * s01Z1; - var d12 = s01X1 * s02X + s01Y1 * s02Y + s01Z1 * s02Z; + var s0cX; + var s0cY; + var s0cZ; + s01X = s1X - s0X; + s01Y = s1Y - s0Y; + s01Z = s1Z - s0Z; + s02X = s2X - s0X; + s02Y = s2Y - s0Y; + s02Z = s2Z - s0Z; + s0cX = cX - s0X; + s0cY = cY - s0Y; + s0cZ = cZ - s0Z; + var d11 = s01X * s01X + s01Y * s01Y + s01Z * s01Z; + var d12 = s01X * s02X + s01Y * s02Y + s01Z * s02Z; var d22 = s02X * s02X + s02Y * s02Y + s02Z * s02Z; - var d1c = s01X1 * s0cX1 + s01Y1 * s0cY1 + s01Z1 * s0cZ1; - var d2c = s02X * s0cX1 + s02Y * s0cY1 + s02Z * s0cZ1; - var invDet1 = d11 * d22 - d12 * d12; - if(invDet1 != 0) { - invDet1 = 1 / invDet1; - } - var s = (d1c * d22 - d2c * d12) * invDet1; - var t1 = (-d1c * d12 + d2c * d11) * invDet1; - var diffX1; - var diffY1; - var diffZ1; - var cp1X1; - var cp1Y1; - var cp1Z1; - var cp2X1; - var cp2Y1; - var cp2Z1; - diffX1 = w11X1 - w10X1; - diffY1 = w11Y1 - w10Y1; - diffZ1 = w11Z1 - w10Z1; - cp1X1 = w10X1 + diffX1 * s; - cp1Y1 = w10Y1 + diffY1 * s; - cp1Z1 = w10Z1 + diffZ1 * s; - diffX1 = w12X - w10X1; - diffY1 = w12Y - w10Y1; - diffZ1 = w12Z - w10Z1; - cp1X1 += diffX1 * t1; - cp1Y1 += diffY1 * t1; - cp1Z1 += diffZ1 * t1; - diffX1 = w21X1 - w20X1; - diffY1 = w21Y1 - w20Y1; - diffZ1 = w21Z1 - w20Z1; - cp2X1 = w20X1 + diffX1 * s; - cp2Y1 = w20Y1 + diffY1 * s; - cp2Z1 = w20Z1 + diffZ1 * s; - diffX1 = w22X - w20X1; - diffY1 = w22Y - w20Y1; - diffZ1 = w22Z - w20Z1; - cp2X1 += diffX1 * t1; - cp2Y1 += diffY1 * t1; - cp2Z1 += diffZ1 * t1; - var v21 = this.closestPoint1; - v21.x = cp1X1; - v21.y = cp1Y1; - v21.z = cp1Z1; - var v22 = this.closestPoint2; - v22.x = cp2X1; - v22.y = cp2Y1; - v22.z = cp2Z1; + var d1c = s01X * s0cX + s01Y * s0cY + s01Z * s0cZ; + var d2c = s02X * s0cX + s02Y * s0cY + s02Z * s0cZ; + var invDet = d11 * d22 - d12 * d12; + if(invDet != 0) { + invDet = 1 / invDet; + } + var s = (d1c * d22 - d2c * d12) * invDet; + var t = (-d1c * d12 + d2c * d11) * invDet; + var diffX; + var diffY; + var diffZ; + var cp1X; + var cp1Y; + var cp1Z; + var cp2X; + var cp2Y; + var cp2Z; + diffX = w11X - w10X; + diffY = w11Y - w10Y; + diffZ = w11Z - w10Z; + cp1X = w10X + diffX * s; + cp1Y = w10Y + diffY * s; + cp1Z = w10Z + diffZ * s; + diffX = w12X - w10X; + diffY = w12Y - w10Y; + diffZ = w12Z - w10Z; + cp1X += diffX * t; + cp1Y += diffY * t; + cp1Z += diffZ * t; + diffX = w21X - w20X; + diffY = w21Y - w20Y; + diffZ = w21Z - w20Z; + cp2X = w20X + diffX * s; + cp2Y = w20Y + diffY * s; + cp2Z = w20Z + diffZ * s; + diffX = w22X - w20X; + diffY = w22Y - w20Y; + diffZ = w22Z - w20Z; + cp2X += diffX * t; + cp2Y += diffY * t; + cp2Z += diffZ * t; + var v = this.closestPoint1; + v.x = cp1X; + v.y = cp1Y; + v.z = cp1Z; + var v = this.closestPoint2; + v.x = cp2X; + v.y = cp2Y; + v.z = cp2Z; break; default: throw new Error("!?"); @@ -22383,201 +22443,201 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.w1[0]; - var v1 = this.w1[1]; - _this1.x = v1.x; - _this1.y = v1.y; - _this1.z = v1.z; - var _this2 = this.w2[0]; - var v2 = this.w2[1]; - _this2.x = v2.x; - _this2.y = v2.y; - _this2.z = v2.z; + var _this = this.w1[0]; + var v = this.w1[1]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[1]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 4: - var _this3 = this.s[0]; - var v3 = this.s[2]; - _this3.x = v3.x; - _this3.y = v3.y; - _this3.z = v3.z; - var _this4 = this.w1[0]; - var v4 = this.w1[2]; - _this4.x = v4.x; - _this4.y = v4.y; - _this4.z = v4.z; - var _this5 = this.w2[0]; - var v5 = this.w2[2]; - _this5.x = v5.x; - _this5.y = v5.y; - _this5.z = v5.z; + var _this = this.s[0]; + var v = this.s[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 5: - var _this6 = this.s[1]; - var v6 = this.s[2]; - _this6.x = v6.x; - _this6.y = v6.y; - _this6.z = v6.z; - var _this7 = this.w1[1]; - var v7 = this.w1[2]; - _this7.x = v7.x; - _this7.y = v7.y; - _this7.z = v7.z; - var _this8 = this.w2[1]; - var v8 = this.w2[2]; - _this8.x = v8.x; - _this8.y = v8.y; - _this8.z = v8.z; + var _this = this.s[1]; + var v = this.s[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[1]; + var v = this.w1[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[1]; + var v = this.w2[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 6: - var _this9 = this.s[0]; - var v9 = this.s[2]; - _this9.x = v9.x; - _this9.y = v9.y; - _this9.z = v9.z; - var _this10 = this.w1[0]; - var v10 = this.w1[2]; - _this10.x = v10.x; - _this10.y = v10.y; - _this10.z = v10.z; - var _this11 = this.w2[0]; - var v11 = this.w2[2]; - _this11.x = v11.x; - _this11.y = v11.y; - _this11.z = v11.z; + var _this = this.s[0]; + var v = this.s[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 8: - var _this12 = this.s[0]; - var v12 = this.s[3]; - _this12.x = v12.x; - _this12.y = v12.y; - _this12.z = v12.z; - var _this13 = this.w1[0]; - var v13 = this.w1[3]; - _this13.x = v13.x; - _this13.y = v13.y; - _this13.z = v13.z; - var _this14 = this.w2[0]; - var v14 = this.w2[3]; - _this14.x = v14.x; - _this14.y = v14.y; - _this14.z = v14.z; + var _this = this.s[0]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 9: - var _this15 = this.s[1]; - var v15 = this.s[3]; - _this15.x = v15.x; - _this15.y = v15.y; - _this15.z = v15.z; - var _this16 = this.w1[1]; - var v16 = this.w1[3]; - _this16.x = v16.x; - _this16.y = v16.y; - _this16.z = v16.z; - var _this17 = this.w2[1]; - var v17 = this.w2[3]; - _this17.x = v17.x; - _this17.y = v17.y; - _this17.z = v17.z; + var _this = this.s[1]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[1]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[1]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 10: - var _this18 = this.s[0]; - var v18 = this.s[3]; - _this18.x = v18.x; - _this18.y = v18.y; - _this18.z = v18.z; - var _this19 = this.w1[0]; - var v19 = this.w1[3]; - _this19.x = v19.x; - _this19.y = v19.y; - _this19.z = v19.z; - var _this20 = this.w2[0]; - var v20 = this.w2[3]; - _this20.x = v20.x; - _this20.y = v20.y; - _this20.z = v20.z; + var _this = this.s[0]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 11: - var _this21 = this.s[2]; - var v21 = this.s[3]; - _this21.x = v21.x; - _this21.y = v21.y; - _this21.z = v21.z; - var _this22 = this.w1[2]; - var v22 = this.w1[3]; - _this22.x = v22.x; - _this22.y = v22.y; - _this22.z = v22.z; - var _this23 = this.w2[2]; - var v23 = this.w2[3]; - _this23.x = v23.x; - _this23.y = v23.y; - _this23.z = v23.z; + var _this = this.s[2]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[2]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[2]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 12: - var _this24 = this.s[0]; - var v24 = this.s[2]; - _this24.x = v24.x; - _this24.y = v24.y; - _this24.z = v24.z; - var _this25 = this.w1[0]; - var v25 = this.w1[2]; - _this25.x = v25.x; - _this25.y = v25.y; - _this25.z = v25.z; - var _this26 = this.w2[0]; - var v26 = this.w2[2]; - _this26.x = v26.x; - _this26.y = v26.y; - _this26.z = v26.z; - var _this27 = this.s[1]; - var v27 = this.s[3]; - _this27.x = v27.x; - _this27.y = v27.y; - _this27.z = v27.z; - var _this28 = this.w1[1]; - var v28 = this.w1[3]; - _this28.x = v28.x; - _this28.y = v28.y; - _this28.z = v28.z; - var _this29 = this.w2[1]; - var v29 = this.w2[3]; - _this29.x = v29.x; - _this29.y = v29.y; - _this29.z = v29.z; + var _this = this.s[0]; + var v = this.s[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[2]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.s[1]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[1]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[1]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 13: - var _this30 = this.s[1]; - var v30 = this.s[3]; - _this30.x = v30.x; - _this30.y = v30.y; - _this30.z = v30.z; - var _this31 = this.w1[1]; - var v31 = this.w1[3]; - _this31.x = v31.x; - _this31.y = v31.y; - _this31.z = v31.z; - var _this32 = this.w2[1]; - var v32 = this.w2[3]; - _this32.x = v32.x; - _this32.y = v32.y; - _this32.z = v32.z; + var _this = this.s[1]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[1]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[1]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; case 14: - var _this33 = this.s[0]; - var v33 = this.s[3]; - _this33.x = v33.x; - _this33.y = v33.y; - _this33.z = v33.z; - var _this34 = this.w1[0]; - var v34 = this.w1[3]; - _this34.x = v34.x; - _this34.y = v34.y; - _this34.z = v34.z; - var _this35 = this.w2[0]; - var v35 = this.w2[3]; - _this35.x = v35.x; - _this35.y = v35.y; - _this35.z = v35.z; + var _this = this.s[0]; + var v = this.s[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w1[0]; + var v = this.w1[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var _this = this.w2[0]; + var v = this.w2[3]; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; break; } } @@ -22607,10 +22667,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var iw1X; var iw1Y; var iw1Z; - var v1 = this.dir; - v1.x = ldir1X; - v1.y = ldir1Y; - v1.z = ldir1Z; + var v = this.dir; + v.x = ldir1X; + v.y = ldir1Y; + v.z = ldir1Z; this.c1.computeLocalSupportingVertex(this.dir,this.w1[this.simplexSize]); if(addMargin) { var _this = this.dir; @@ -22621,37 +22681,37 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x *= invLen; _this.y *= invLen; _this.z *= invLen; - var _this1 = this.w1[this.simplexSize]; - var v2 = this.dir; + var _this = this.w1[this.simplexSize]; + var v = this.dir; var s = this.c1._gjkMargin; - _this1.x += v2.x * s; - _this1.y += v2.y * s; - _this1.z += v2.z * s; - } - var v3 = this.w1[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; - __tmp__Y1 = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; - __tmp__Z1 = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; - iw1X = __tmp__X1; - iw1Y = __tmp__Y1; - iw1Z = __tmp__Z1; + _this.x += v.x * s; + _this.y += v.y * s; + _this.z += v.z * s; + } + var v = this.w1[this.simplexSize]; + tmpX = v.x; + tmpY = v.y; + tmpZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf1._rotation00 * tmpX + this.tf1._rotation01 * tmpY + this.tf1._rotation02 * tmpZ; + __tmp__Y = this.tf1._rotation10 * tmpX + this.tf1._rotation11 * tmpY + this.tf1._rotation12 * tmpZ; + __tmp__Z = this.tf1._rotation20 * tmpX + this.tf1._rotation21 * tmpY + this.tf1._rotation22 * tmpZ; + iw1X = __tmp__X; + iw1Y = __tmp__Y; + iw1Z = __tmp__Z; iw1X += this.tf1._positionX; iw1Y += this.tf1._positionY; iw1Z += this.tf1._positionZ; - var v4 = this.w1[this.simplexSize]; - v4.x = iw1X; - v4.y = iw1Y; - v4.z = iw1Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; + var v = this.w1[this.simplexSize]; + v.x = iw1X; + v.y = iw1Y; + v.z = iw1Z; + var v = this.dir; + v.x = idirX; + v.y = idirY; + v.z = idirZ; } ,computeWitnessPoint2: function(addMargin) { var tmpX; @@ -22682,10 +22742,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var iw2X; var iw2Y; var iw2Z; - var v1 = this.dir; - v1.x = ldir2X; - v1.y = ldir2Y; - v1.z = ldir2Z; + var v = this.dir; + v.x = ldir2X; + v.y = ldir2Y; + v.z = ldir2Z; this.c2.computeLocalSupportingVertex(this.dir,this.w2[this.simplexSize]); if(addMargin) { var _this = this.dir; @@ -22696,37 +22756,37 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this.x *= invLen; _this.y *= invLen; _this.z *= invLen; - var _this1 = this.w2[this.simplexSize]; - var v2 = this.dir; + var _this = this.w2[this.simplexSize]; + var v = this.dir; var s = this.c2._gjkMargin; - _this1.x += v2.x * s; - _this1.y += v2.y * s; - _this1.z += v2.z * s; - } - var v3 = this.w2[this.simplexSize]; - tmpX = v3.x; - tmpY = v3.y; - tmpZ = v3.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; - __tmp__Y1 = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; - __tmp__Z1 = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; - iw2X = __tmp__X1; - iw2Y = __tmp__Y1; - iw2Z = __tmp__Z1; + _this.x += v.x * s; + _this.y += v.y * s; + _this.z += v.z * s; + } + var v = this.w2[this.simplexSize]; + tmpX = v.x; + tmpY = v.y; + tmpZ = v.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this.tf2._rotation00 * tmpX + this.tf2._rotation01 * tmpY + this.tf2._rotation02 * tmpZ; + __tmp__Y = this.tf2._rotation10 * tmpX + this.tf2._rotation11 * tmpY + this.tf2._rotation12 * tmpZ; + __tmp__Z = this.tf2._rotation20 * tmpX + this.tf2._rotation21 * tmpY + this.tf2._rotation22 * tmpZ; + iw2X = __tmp__X; + iw2Y = __tmp__Y; + iw2Z = __tmp__Z; iw2X += this.tf2._positionX; iw2Y += this.tf2._positionY; iw2Z += this.tf2._positionZ; - var v4 = this.w2[this.simplexSize]; - v4.x = iw2X; - v4.y = iw2Y; - v4.z = iw2Z; - var v5 = this.dir; - v5.x = idirX; - v5.y = idirY; - v5.z = idirZ; + var v = this.w2[this.simplexSize]; + v.x = iw2X; + v.y = iw2Y; + v.z = iw2Z; + var v = this.dir; + v.x = idirX; + v.y = idirY; + v.z = idirZ; } ,pointToTetrahedron: function() { var _g = 0; @@ -22793,14 +22853,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var lineDirX; var lineDirY; var lineDirZ; - var v1 = this.s[0]; - s0X = v1.x; - s0Y = v1.y; - s0Z = v1.z; - var v2 = this.s[1]; - s1X = v2.x; - s1Y = v2.y; - s1Z = v2.z; + var v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + var v = this.s[1]; + s1X = v.x; + s1Y = v.y; + s1Z = v.z; lineDirX = s0X - s1X; lineDirY = s0Y - s1Y; lineDirZ = s0Z - s1Z; @@ -22809,31 +22869,31 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var baseDirX; var baseDirY; var baseDirZ; - var v3 = this.baseDirs[_g++]; - baseDirX = v3.x; - baseDirY = v3.y; - baseDirZ = v3.z; + var v = this.baseDirs[_g++]; + baseDirX = v.x; + baseDirY = v.y; + baseDirZ = v.z; var newDirX; var newDirY; var newDirZ; newDirX = lineDirY * baseDirZ - lineDirZ * baseDirY; newDirY = lineDirZ * baseDirX - lineDirX * baseDirZ; newDirZ = lineDirX * baseDirY - lineDirY * baseDirX; - var v4 = this.dir; - v4.x = newDirX; - v4.y = newDirY; - v4.z = newDirZ; + var v1 = this.dir; + v1.x = newDirX; + v1.y = newDirY; + v1.z = newDirZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var v6 = this.w2[this.simplexSize]; - _this.x -= v6.x; - _this.y -= v6.y; - _this.z -= v6.z; + var v2 = this.w1[this.simplexSize]; + _this.x = v2.x; + _this.y = v2.y; + _this.z = v2.z; + var v3 = this.w2[this.simplexSize]; + _this.x -= v3.x; + _this.y -= v3.y; + _this.z -= v3.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { @@ -22847,14 +22907,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); var _this2 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - var v8 = this.w2[this.simplexSize]; - _this2.x -= v8.x; - _this2.y -= v8.y; - _this2.z -= v8.z; + var v4 = this.w1[this.simplexSize]; + _this2.x = v4.x; + _this2.y = v4.y; + _this2.z = v4.z; + var v5 = this.w2[this.simplexSize]; + _this2.x -= v5.x; + _this2.y -= v5.y; + _this2.z -= v5.z; this.simplexSize++; this.triangleToTetrahedron(); if(this.simplexSize == 4) { @@ -22862,10 +22922,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { } this.simplexSize--; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; + var v = this.dir; + v.x = oldDirX; + v.y = oldDirY; + v.z = oldDirZ; } ,triangleToTetrahedron: function() { var oldDirX; @@ -22891,18 +22951,18 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var s02X; var s02Y; var s02Z; - var v1 = this.s[0]; - s0X = v1.x; - s0Y = v1.y; - s0Z = v1.z; - var v2 = this.s[1]; - s1X = v2.x; - s1Y = v2.y; - s1Z = v2.z; - var v3 = this.s[2]; - s2X = v3.x; - s2Y = v3.y; - s2Z = v3.z; + var v = this.s[0]; + s0X = v.x; + s0Y = v.y; + s0Z = v.z; + var v1 = this.s[1]; + s1X = v1.x; + s1Y = v1.y; + s1Z = v1.z; + var v2 = this.s[2]; + s2X = v2.x; + s2Y = v2.y; + s2Z = v2.z; s01X = s1X - s0X; s01Y = s1Y - s0Y; s01Z = s1Z - s0Z; @@ -22915,21 +22975,21 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { nX = s01Y * s02Z - s01Z * s02Y; nY = s01Z * s02X - s01X * s02Z; nZ = s01X * s02Y - s01Y * s02X; - var v4 = this.dir; - v4.x = nX; - v4.y = nY; - v4.z = nZ; + var v3 = this.dir; + v3.x = nX; + v3.y = nY; + v3.z = nZ; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); var _this = this.s[this.simplexSize]; - var v5 = this.w1[this.simplexSize]; - _this.x = v5.x; - _this.y = v5.y; - _this.z = v5.z; - var v6 = this.w2[this.simplexSize]; - _this.x -= v6.x; - _this.y -= v6.y; - _this.z -= v6.z; + var v4 = this.w1[this.simplexSize]; + _this.x = v4.x; + _this.y = v4.y; + _this.z = v4.z; + var v5 = this.w2[this.simplexSize]; + _this.x -= v5.x; + _this.y -= v5.y; + _this.z -= v5.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; @@ -22942,14 +23002,14 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); var _this2 = this.s[this.simplexSize]; - var v7 = this.w1[this.simplexSize]; - _this2.x = v7.x; - _this2.y = v7.y; - _this2.z = v7.z; - var v8 = this.w2[this.simplexSize]; - _this2.x -= v8.x; - _this2.y -= v8.y; - _this2.z -= v8.z; + var v6 = this.w1[this.simplexSize]; + _this2.x = v6.x; + _this2.y = v6.y; + _this2.z = v6.z; + var v7 = this.w2[this.simplexSize]; + _this2.x -= v7.x; + _this2.y -= v7.y; + _this2.z -= v7.z; this.simplexSize++; if(this.isValidTetrahedron()) { break; @@ -22957,10 +23017,10 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { this.simplexSize--; break; } - var v9 = this.dir; - v9.x = oldDirX; - v9.y = oldDirY; - v9.z = oldDirZ; + var v = this.dir; + v.x = oldDirX; + v.y = oldDirY; + v.z = oldDirZ; } ,isValidTetrahedron: function() { var e10 = this.s[2].x - this.s[0].x; @@ -23008,42 +23068,42 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { _this._vertexPool = v; } var tmp = this.polyhedron; - var _this1 = this.polyhedron; - var first = _this1._vertexPool; + var _this = this.polyhedron; + var first = _this._vertexPool; if(first != null) { - _this1._vertexPool = first._next; + _this._vertexPool = first._next; first._next = null; } else { first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } var tmp1 = first.init(initialPolyhedron[0],initialPolyhedron1[0],initialPolyhedron2[0]); - var _this2 = this.polyhedron; - var first1 = _this2._vertexPool; - if(first1 != null) { - _this2._vertexPool = first1._next; - first1._next = null; + var _this = this.polyhedron; + var first = _this._vertexPool; + if(first != null) { + _this._vertexPool = first._next; + first._next = null; } else { - first1 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); - } - var tmp2 = first1.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); - var _this3 = this.polyhedron; - var first2 = _this3._vertexPool; - if(first2 != null) { - _this3._vertexPool = first2._next; - first2._next = null; + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var tmp2 = first.init(initialPolyhedron[1],initialPolyhedron1[1],initialPolyhedron2[1]); + var _this = this.polyhedron; + var first = _this._vertexPool; + if(first != null) { + _this._vertexPool = first._next; + first._next = null; } else { - first2 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); - } - var tmp3 = first2.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); - var _this4 = this.polyhedron; - var first3 = _this4._vertexPool; - if(first3 != null) { - _this4._vertexPool = first3._next; - first3._next = null; + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + } + var tmp3 = first.init(initialPolyhedron[2],initialPolyhedron1[2],initialPolyhedron2[2]); + var _this = this.polyhedron; + var first = _this._vertexPool; + if(first != null) { + _this._vertexPool = first._next; + first._next = null; } else { - first3 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - if(!tmp._init(tmp1,tmp2,tmp3,first3.init(initialPolyhedron[3],initialPolyhedron1[3],initialPolyhedron2[3]))) { + if(!tmp._init(tmp1,tmp2,tmp3,first.init(initialPolyhedron[3],initialPolyhedron1[3],initialPolyhedron2[3]))) { return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_INIT; } this.simplexSize = 0; @@ -23063,55 +23123,55 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { f = f._next; } var face = minf; - var _this5 = this.dir; - var v1 = face._normal; - _this5.x = v1.x; - _this5.y = v1.y; - _this5.z = v1.z; - var invLen = Math.sqrt(_this5.x * _this5.x + _this5.y * _this5.y + _this5.z * _this5.z); + var _this = this.dir; + var v = face._normal; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; + var invLen = Math.sqrt(_this.x * _this.x + _this.y * _this.y + _this.z * _this.z); if(invLen > 0) { invLen = 1 / invLen; } - _this5.x *= invLen; - _this5.y *= invLen; - _this5.z *= invLen; + _this.x *= invLen; + _this.y *= invLen; + _this.z *= invLen; this.computeWitnessPoint1(false); this.computeWitnessPoint2(false); - var _this6 = this.s[this.simplexSize]; - var v2 = this.w1[this.simplexSize]; - _this6.x = v2.x; - _this6.y = v2.y; - _this6.z = v2.z; - var v3 = this.w2[this.simplexSize]; - _this6.x -= v3.x; - _this6.y -= v3.y; - _this6.z -= v3.z; + var _this1 = this.s[this.simplexSize]; + var v1 = this.w1[this.simplexSize]; + _this1.x = v1.x; + _this1.y = v1.y; + _this1.z = v1.z; + var v2 = this.w2[this.simplexSize]; + _this1.x -= v2.x; + _this1.y -= v2.y; + _this1.z -= v2.z; var v0 = face._vertices[0]; var v11 = face._vertices[1]; var v21 = face._vertices[2]; - var _this7 = v0.v; + var _this2 = v0.v; + var v3 = this.dir; var v4 = this.dir; - var v5 = this.dir; - if(supportingVertex.x * v5.x + supportingVertex.y * v5.y + supportingVertex.z * v5.z - (_this7.x * v4.x + _this7.y * v4.y + _this7.z * v4.z) < 1e-6 || count == 39) { - var _this8 = this.closest; - var v6 = this.dir; - _this8.x = v6.x; - _this8.y = v6.y; - _this8.z = v6.z; - var _this9 = this.dir; - var v7 = v0.v; - var _this10 = this.dir; - var s = (_this9.x * v7.x + _this9.y * v7.y + _this9.z * v7.z) / (_this10.x * _this10.x + _this10.y * _this10.y + _this10.z * _this10.z); - _this8.x *= s; - _this8.y *= s; - _this8.z *= s; + if(supportingVertex.x * v4.x + supportingVertex.y * v4.y + supportingVertex.z * v4.z - (_this2.x * v3.x + _this2.y * v3.y + _this2.z * v3.z) < 1e-6 || count == 39) { + var _this3 = this.closest; + var v5 = this.dir; + _this3.x = v5.x; + _this3.y = v5.y; + _this3.z = v5.z; + var _this4 = this.dir; + var v6 = v0.v; + var _this5 = this.dir; + var s = (_this4.x * v6.x + _this4.y * v6.y + _this4.z * v6.z) / (_this5.x * _this5.x + _this5.y * _this5.y + _this5.z * _this5.z); + _this3.x *= s; + _this3.y *= s; + _this3.z *= s; var cX; var cY; var cZ; - var v8 = this.closest; - cX = v8.x; - cY = v8.y; - cZ = v8.z; + var v7 = this.closest; + cX = v7.x; + cY = v7.y; + cZ = v7.z; var s0X; var s0Y; var s0Z; @@ -23139,42 +23199,42 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { var w22X; var w22Y; var w22Z; - var v9 = v0.v; - s0X = v9.x; - s0Y = v9.y; - s0Z = v9.z; - var v10 = v0.w1; - w10X = v10.x; - w10Y = v10.y; - w10Z = v10.z; - var v12 = v0.w2; - w20X = v12.x; - w20Y = v12.y; - w20Z = v12.z; - var v13 = v11.v; - s1X = v13.x; - s1Y = v13.y; - s1Z = v13.z; - var v14 = v11.w1; - w11X = v14.x; - w11Y = v14.y; - w11Z = v14.z; - var v15 = v11.w2; - w21X = v15.x; - w21Y = v15.y; - w21Z = v15.z; - var v16 = v21.v; - s2X = v16.x; - s2Y = v16.y; - s2Z = v16.z; - var v17 = v21.w1; - w12X = v17.x; - w12Y = v17.y; - w12Z = v17.z; - var v18 = v21.w2; - w22X = v18.x; - w22Y = v18.y; - w22Z = v18.z; + var v8 = v0.v; + s0X = v8.x; + s0Y = v8.y; + s0Z = v8.z; + var v9 = v0.w1; + w10X = v9.x; + w10Y = v9.y; + w10Z = v9.z; + var v10 = v0.w2; + w20X = v10.x; + w20Y = v10.y; + w20Z = v10.z; + var v12 = v11.v; + s1X = v12.x; + s1Y = v12.y; + s1Z = v12.z; + var v13 = v11.w1; + w11X = v13.x; + w11Y = v13.y; + w11Z = v13.z; + var v14 = v11.w2; + w21X = v14.x; + w21Y = v14.y; + w21Z = v14.z; + var v15 = v21.v; + s2X = v15.x; + s2Y = v15.y; + s2Z = v15.z; + var v16 = v21.w1; + w12X = v16.x; + w12Y = v16.y; + w12Z = v16.z; + var v17 = v21.w2; + w22X = v17.x; + w22Y = v17.y; + w22Z = v17.z; var s01X; var s01Y; var s01Z; @@ -23203,7 +23263,7 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { invDet = 1 / invDet; } var s1 = (d1c * d22 - d2c * d12) * invDet; - var t1 = (-d1c * d12 + d2c * d11) * invDet; + var t = (-d1c * d12 + d2c * d11) * invDet; var diffX; var diffY; var diffZ; @@ -23222,9 +23282,9 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { diffX = w12X - w10X; diffY = w12Y - w10Y; diffZ = w12Z - w10Z; - cp1X += diffX * t1; - cp1Y += diffY * t1; - cp1Z += diffZ * t1; + cp1X += diffX * t; + cp1Y += diffY * t; + cp1Z += diffZ * t; diffX = w21X - w20X; diffY = w21Y - w20Y; diffZ = w21Z - w20Z; @@ -23234,30 +23294,30 @@ oimo_collision_narrowphase_detector_gjkepa_GjkEpa.prototype = { diffX = w22X - w20X; diffY = w22Y - w20Y; diffZ = w22Z - w20Z; - cp2X += diffX * t1; - cp2Y += diffY * t1; - cp2Z += diffZ * t1; - var v19 = this.closestPoint1; - v19.x = cp1X; - v19.y = cp1Y; - v19.z = cp1Z; - var v20 = this.closestPoint2; - v20.x = cp2X; - v20.y = cp2Y; - v20.z = cp2Z; - var _this11 = this.closest; - this.depth = Math.sqrt(_this11.x * _this11.x + _this11.y * _this11.y + _this11.z * _this11.z); + cp2X += diffX * t; + cp2Y += diffY * t; + cp2Z += diffZ * t; + var v18 = this.closestPoint1; + v18.x = cp1X; + v18.y = cp1Y; + v18.z = cp1Z; + var v19 = this.closestPoint2; + v19.x = cp2X; + v19.y = cp2Y; + v19.z = cp2Z; + var _this6 = this.closest; + this.depth = Math.sqrt(_this6.x * _this6.x + _this6.y * _this6.y + _this6.z * _this6.z); return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.SUCCEEDED; } - var _this12 = this.polyhedron; - var first4 = _this12._vertexPool; - if(first4 != null) { - _this12._vertexPool = first4._next; - first4._next = null; + var _this7 = this.polyhedron; + var first = _this7._vertexPool; + if(first != null) { + _this7._vertexPool = first._next; + first._next = null; } else { - first4 = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); + first = new oimo_collision_narrowphase_detector_gjkepa_EpaVertex(); } - var epaVertex = first4.init(supportingVertex,witness1,witness2); + var epaVertex = first.init(supportingVertex,witness1,witness2); if(!this.polyhedron._addVertex(epaVertex,face)) { return oimo_collision_narrowphase_detector_gjkepa_GjkEpaResultState.EPA_FAILED_TO_ADD_VERTEX; } @@ -23424,14 +23484,14 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function v2X1 = vec2.x; v2Y1 = vec2.y; v2Z1 = vec2.z; - var v12X1; - var v12Y1; - var v12Z1; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - var t = v12X1 * v1X1 + v12Y1 * v1Y1 + v12Z1 * v1Z1; - t = -t / (v12X1 * v12X1 + v12Y1 * v12Y1 + v12Z1 * v12Z1); + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); var b; if(t < 0) { out.x = v1X1; @@ -23447,9 +23507,9 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function var pX; var pY; var pZ; - pX = v1X1 + v12X1 * t; - pY = v1Y1 + v12Y1 * t; - pZ = v1Z1 + v12Z1 * t; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; out.x = pX; out.y = pY; out.z = pZ; @@ -23462,52 +23522,52 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function minvZ = out.z; } if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { - var v1X2; - var v1Y2; - var v1Z2; - var v2X2; - var v2Y2; - var v2Z2; - v1X2 = vec2.x; - v1Y2 = vec2.y; - v1Z2 = vec2.z; - v2X2 = vec3.x; - v2Y2 = vec3.y; - v2Z2 = vec3.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t1 = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t1 = -t1 / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); - var b1; - if(t1 < 0) { - out.x = v1X2; - out.y = v1Y2; - out.z = v1Z2; - b1 = 1; - } else if(t1 > 1) { - out.x = v2X2; - out.y = v2Y2; - out.z = v2Z2; - b1 = 2; + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec2.x; + v1Y1 = vec2.y; + v1Z1 = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X2 + v12X2 * t1; - pY1 = v1Y2 + v12Y2 * t1; - pZ1 = v1Z2 + v12Z2 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; - b1 = 3; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; } var d = out.x * out.x + out.y * out.y + out.z * out.z; if(mind < 0 || d < mind) { - mini = b1 << 1; + mini = b << 1; mind = d; minvX = out.x; minvY = out.y; @@ -23515,53 +23575,53 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin3 = function } } if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec1.x; - v1Y3 = vec1.y; - v1Z3 = vec1.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t2 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t2 = -t2 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b2; - if(t2 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - b2 = 1; - } else if(t2 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; - b2 = 2; + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X3 + v12X3 * t2; - pY2 = v1Y3 + v12Y3 * t2; - pZ2 = v1Z3 + v12Z3 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - b2 = 3; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d1 < mind) { - mini = b2 & 1 | (b2 & 2) << 1; - mind = d1; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 2) << 1; + mind = d; minvX = out.x; minvY = out.y; minvZ = out.z; @@ -23685,15 +23745,15 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function var v2X1; var v2Y1; var v2Z1; - var v3X1; - var v3Y1; - var v3Z1; - var v12X1; - var v12Y1; - var v12Z1; - var v23X1; - var v23Y1; - var v23Z1; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; + var v23X; + var v23Y; + var v23Z; var v31X; var v31Y; var v31Z; @@ -23703,24 +23763,24 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v2X1 = vec2.x; v2Y1 = vec2.y; v2Z1 = vec2.z; - v3X1 = vec3.x; - v3Y1 = vec3.y; - v3Z1 = vec3.z; - v12X1 = v2X1 - v1X1; - v12Y1 = v2Y1 - v1Y1; - v12Z1 = v2Z1 - v1Z1; - v23X1 = v3X1 - v2X1; - v23Y1 = v3Y1 - v2Y1; - v23Z1 = v3Z1 - v2Z1; - v31X = v1X1 - v3X1; - v31Y = v1Y1 - v3Y1; - v31Z = v1Z1 - v3Z1; + v3X = vec3.x; + v3Y = vec3.y; + v3Z = vec3.z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; var nX; var nY; var nZ; - nX = v12Y1 * v23Z1 - v12Z1 * v23Y1; - nY = v12Z1 * v23X1 - v12X1 * v23Z1; - nZ = v12X1 * v23Y1 - v12Y1 * v23X1; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; var n12X; var n12Y; var n12Z; @@ -23730,12 +23790,12 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function var n31X; var n31Y; var n31Z; - n12X = v12Y1 * nZ - v12Z1 * nY; - n12Y = v12Z1 * nX - v12X1 * nZ; - n12Z = v12X1 * nY - v12Y1 * nX; - n23X = v23Y1 * nZ - v23Z1 * nY; - n23Y = v23Z1 * nX - v23X1 * nZ; - n23Z = v23X1 * nY - v23Y1 * nX; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; n31X = v31Y * nZ - v31Z * nY; n31Y = v31Z * nX - v31X * nZ; n31Z = v31X * nY - v31Y * nX; @@ -23760,20 +23820,533 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function v2X2 = vec2.x; v2Y2 = vec2.y; v2Z2 = vec2.z; - var v12X2; - var v12Y2; - var v12Z2; - v12X2 = v2X2 - v1X2; - v12Y2 = v2Y2 - v1Y2; - v12Z2 = v2Z2 - v1Z2; - var t = v12X2 * v1X2 + v12Y2 * v1Y2 + v12Z2 * v1Z2; - t = -t / (v12X2 * v12X2 + v12Y2 * v12Y2 + v12Z2 * v12Z2); + var v12X; + var v12Y; + var v12Z; + v12X = v2X2 - v1X2; + v12Y = v2Y2 - v1Y2; + v12Z = v2Z2 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X1; + var v2Y1; + var v2Z1; + v1X2 = vec2.x; + v1Y2 = vec2.y; + v1Z2 = vec2.z; + v2X1 = vec3.x; + v2Y1 = vec3.y; + v2Z1 = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X2; + v12Y = v2Y1 - v1Y2; + v12Z = v2Z1 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X1; + var v2Y1; + var v2Z1; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X1 = vec3.x; + v2Y1 = vec3.y; + v2Z1 = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X2; + v12Y = v2Y1 - v1Y2; + v12Z = v2Z1 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + var b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + mini = b; + mind = out.x * out.x + out.y * out.y + out.z * out.z; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec3.x; + v2Y1 = vec3.y; + v2Z1 = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X1 - v3X; + v31Y = v1Y1 - v3Y; + v31Z = v1Z1 - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X1 * n12X + v1Y1 * n12Y + v1Z1 * n12Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X2; + var v2Y2; + var v2Z2; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X2 = vec3.x; + v2Y2 = vec3.y; + v2Z2 = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X2 - v1X2; + v12Y = v2Y2 - v1Y2; + v12Z = v2Z2 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X2; + out.y = v2Y2; + out.z = v2Z2; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X1; + var v2Y1; + var v2Z1; + v1X2 = vec3.x; + v1Y2 = vec3.y; + v1Z2 = vec3.z; + v2X1 = vec4.x; + v2Y1 = vec4.y; + v2Z1 = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X2; + v12Y = v2Y1 - v1Y2; + v12Z = v2Z1 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X2; + out.y = v1Y2; + out.z = v1Z2; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X2; + var v1Y2; + var v1Z2; + var v2X1; + var v2Y1; + var v2Z1; + v1X2 = vec1.x; + v1Y2 = vec1.y; + v1Z2 = vec1.z; + v2X1 = vec4.x; + v2Y1 = vec4.y; + v2Z1 = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X2; + v12Y = v2Y1 - v1Y2; + v12Z = v2Z1 - v1Z2; + var t = v12X * v1X2 + v12Y * v1Y2 + v12Z * v1Z2; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); var b; if(t < 0) { out.x = v1X2; out.y = v1Y2; out.z = v1Z2; b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; + } else { + var pX; + var pY; + var pZ; + pX = v1X2 + v12X * t; + pY = v1Y2 + v12Y * t; + pZ = v1Z2 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + var b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; + } else { + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 1 | (b & 6) << 1; + mind = d; + minvX = out.x; + minvY = out.y; + minvZ = out.z; + } + } + if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { + var v1X; + var v1Y; + var v1Z; + var v2X1; + var v2Y1; + var v2Z1; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X = vec1.x; + v1Y = vec1.y; + v1Z = vec1.z; + v2X1 = vec2.x; + v2Y1 = vec2.y; + v2Z1 = vec2.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X1 - v1X; + v12Y = v2Y1 - v1Y; + v12Z = v2Z1 - v1Z; + v23X = v3X - v2X1; + v23Y = v3Y - v2Y1; + v23Z = v3Z - v2Z1; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X2; + var v2Y2; + var v2Z2; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X2 = vec2.x; + v2Y2 = vec2.y; + v2Z2 = vec2.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X2 - v1X1; + v12Y = v2Y2 - v1Y1; + v12Z = v2Z2 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; } else if(t > 1) { out.x = v2X2; out.y = v2Y2; @@ -23783,9 +24356,9 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function var pX; var pY; var pZ; - pX = v1X2 + v12X2 * t; - pY = v1Y2 + v12Y2 * t; - pZ = v1Z2 + v12Z2 * t; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; out.x = pX; out.y = pY; out.z = pZ; @@ -23798,117 +24371,117 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function minvZ1 = out.z; } if(v2X1 * n23X + v2Y1 * n23Y + v2Z1 * n23Z < 0) { - var v1X3; - var v1Y3; - var v1Z3; - var v2X3; - var v2Y3; - var v2Z3; - v1X3 = vec2.x; - v1Y3 = vec2.y; - v1Z3 = vec2.z; - v2X3 = vec3.x; - v2Y3 = vec3.y; - v2Z3 = vec3.z; - var v12X3; - var v12Y3; - var v12Z3; - v12X3 = v2X3 - v1X3; - v12Y3 = v2Y3 - v1Y3; - v12Z3 = v2Z3 - v1Z3; - var t1 = v12X3 * v1X3 + v12Y3 * v1Y3 + v12Z3 * v1Z3; - t1 = -t1 / (v12X3 * v12X3 + v12Y3 * v12Y3 + v12Z3 * v12Z3); - var b1; - if(t1 < 0) { - out.x = v1X3; - out.y = v1Y3; - out.z = v1Z3; - b1 = 1; - } else if(t1 > 1) { - out.x = v2X3; - out.y = v2Y3; - out.z = v2Z3; - b1 = 2; + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + v1X1 = vec2.x; + v1Y1 = vec2.y; + v1Z1 = vec2.z; + v2X1 = vec4.x; + v2Y1 = vec4.y; + v2Z1 = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; } else { - var pX1; - var pY1; - var pZ1; - pX1 = v1X3 + v12X3 * t1; - pY1 = v1Y3 + v12Y3 * t1; - pZ1 = v1Z3 + v12Z3 * t1; - out.x = pX1; - out.y = pY1; - out.z = pZ1; - b1 = 3; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; } var d = out.x * out.x + out.y * out.y + out.z * out.z; if(mind1 < 0 || d < mind1) { - mini1 = b1 << 1; + mini1 = b << 1; mind1 = d; minvX1 = out.x; minvY1 = out.y; minvZ1 = out.z; } } - if(v3X1 * n31X + v3Y1 * n31Y + v3Z1 * n31Z < 0) { - var v1X4; - var v1Y4; - var v1Z4; - var v2X4; - var v2Y4; - var v2Z4; - v1X4 = vec1.x; - v1Y4 = vec1.y; - v1Z4 = vec1.z; - v2X4 = vec3.x; - v2Y4 = vec3.y; - v2Z4 = vec3.z; - var v12X4; - var v12Y4; - var v12Z4; - v12X4 = v2X4 - v1X4; - v12Y4 = v2Y4 - v1Y4; - v12Z4 = v2Z4 - v1Z4; - var t2 = v12X4 * v1X4 + v12Y4 * v1Y4 + v12Z4 * v1Z4; - t2 = -t2 / (v12X4 * v12X4 + v12Y4 * v12Y4 + v12Z4 * v12Z4); - var b2; - if(t2 < 0) { - out.x = v1X4; - out.y = v1Y4; - out.z = v1Z4; - b2 = 1; - } else if(t2 > 1) { - out.x = v2X4; - out.y = v2Y4; - out.z = v2Z4; - b2 = 2; + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + v1X1 = vec1.x; + v1Y1 = vec1.y; + v1Z1 = vec1.z; + v2X1 = vec4.x; + v2Y1 = vec4.y; + v2Z1 = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; } else { - var pX2; - var pY2; - var pZ2; - pX2 = v1X4 + v12X4 * t2; - pY2 = v1Y4 + v12Y4 * t2; - pZ2 = v1Z4 + v12Z4 * t2; - out.x = pX2; - out.y = pY2; - out.z = pZ2; - b2 = 3; - } - var d1 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind1 < 0 || d1 < mind1) { - mini1 = b2 & 1 | (b2 & 2) << 1; - mind1 = d1; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; minvX1 = out.x; minvY1 = out.y; minvZ1 = out.z; } } - var b3; + var b; if(mind1 > 0) { out.x = minvX1; out.y = minvY1; out.z = minvZ1; - b3 = mini1; + b = mini1; } else { var l = nX * nX + nY * nY + nZ * nZ; if(l > 0) { @@ -23918,790 +24491,277 @@ oimo_collision_narrowphase_detector_gjkepa_SimplexUtil.projectOrigin4 = function nY *= l; nZ *= l; var l2 = nX * nX + nY * nY + nZ * nZ; - l2 = (v1X1 * nX + v1Y1 * nY + v1Z1 * nZ) / l2; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; minvX1 = nX * l2; minvY1 = nY * l2; minvZ1 = nZ * l2; out.x = minvX1; out.y = minvY1; out.z = minvZ1; - b3 = 7; + b = 7; } - mini = b3; - mind = out.x * out.x + out.y * out.y + out.z * out.z; - minvX = out.x; - minvY = out.y; - minvZ = out.z; - } - if((v1X * n134X + v1Y * n134Y + v1Z * n134Z) * sign < 0) { - var v1X5; - var v1Y5; - var v1Z5; - var v2X5; - var v2Y5; - var v2Z5; - var v3X2; - var v3Y2; - var v3Z2; - var v12X5; - var v12Y5; - var v12Z5; - var v23X2; - var v23Y2; - var v23Z2; - var v31X1; - var v31Y1; - var v31Z1; - v1X5 = vec1.x; - v1Y5 = vec1.y; - v1Z5 = vec1.z; - v2X5 = vec3.x; - v2Y5 = vec3.y; - v2Z5 = vec3.z; - v3X2 = vec4.x; - v3Y2 = vec4.y; - v3Z2 = vec4.z; - v12X5 = v2X5 - v1X5; - v12Y5 = v2Y5 - v1Y5; - v12Z5 = v2Z5 - v1Z5; - v23X2 = v3X2 - v2X5; - v23Y2 = v3Y2 - v2Y5; - v23Z2 = v3Z2 - v2Z5; - v31X1 = v1X5 - v3X2; - v31Y1 = v1Y5 - v3Y2; - v31Z1 = v1Z5 - v3Z2; - var nX1; - var nY1; - var nZ1; - nX1 = v12Y5 * v23Z2 - v12Z5 * v23Y2; - nY1 = v12Z5 * v23X2 - v12X5 * v23Z2; - nZ1 = v12X5 * v23Y2 - v12Y5 * v23X2; - var n12X1; - var n12Y1; - var n12Z1; - var n23X1; - var n23Y1; - var n23Z1; - var n31X1; - var n31Y1; - var n31Z1; - n12X1 = v12Y5 * nZ1 - v12Z5 * nY1; - n12Y1 = v12Z5 * nX1 - v12X5 * nZ1; - n12Z1 = v12X5 * nY1 - v12Y5 * nX1; - n23X1 = v23Y2 * nZ1 - v23Z2 * nY1; - n23Y1 = v23Z2 * nX1 - v23X2 * nZ1; - n23Z1 = v23X2 * nY1 - v23Y2 * nX1; - n31X1 = v31Y1 * nZ1 - v31Z1 * nY1; - n31Y1 = v31Z1 * nX1 - v31X1 * nZ1; - n31Z1 = v31X1 * nY1 - v31Y1 * nX1; - var mind2 = -1; - var minvX2; - var minvY2; - var minvZ2; - var mini2 = 0; - minvX2 = 0; - minvY2 = 0; - minvZ2 = 0; - if(v1X5 * n12X1 + v1Y5 * n12Y1 + v1Z5 * n12Z1 < 0) { - var v1X6; - var v1Y6; - var v1Z6; - var v2X6; - var v2Y6; - var v2Z6; - v1X6 = vec1.x; - v1Y6 = vec1.y; - v1Z6 = vec1.z; - v2X6 = vec3.x; - v2Y6 = vec3.y; - v2Z6 = vec3.z; - var v12X6; - var v12Y6; - var v12Z6; - v12X6 = v2X6 - v1X6; - v12Y6 = v2Y6 - v1Y6; - v12Z6 = v2Z6 - v1Z6; - var t3 = v12X6 * v1X6 + v12Y6 * v1Y6 + v12Z6 * v1Z6; - t3 = -t3 / (v12X6 * v12X6 + v12Y6 * v12Y6 + v12Z6 * v12Z6); - var b4; - if(t3 < 0) { - out.x = v1X6; - out.y = v1Y6; - out.z = v1Z6; - b4 = 1; - } else if(t3 > 1) { - out.x = v2X6; - out.y = v2Y6; - out.z = v2Z6; - b4 = 2; - } else { - var pX3; - var pY3; - var pZ3; - pX3 = v1X6 + v12X6 * t3; - pY3 = v1Y6 + v12Y6 * t3; - pZ3 = v1Z6 + v12Z6 * t3; - out.x = pX3; - out.y = pY3; - out.z = pZ3; - b4 = 3; - } - mini2 = b4; - mind2 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - if(v2X5 * n23X1 + v2Y5 * n23Y1 + v2Z5 * n23Z1 < 0) { - var v1X7; - var v1Y7; - var v1Z7; - var v2X7; - var v2Y7; - var v2Z7; - v1X7 = vec3.x; - v1Y7 = vec3.y; - v1Z7 = vec3.z; - v2X7 = vec4.x; - v2Y7 = vec4.y; - v2Z7 = vec4.z; - var v12X7; - var v12Y7; - var v12Z7; - v12X7 = v2X7 - v1X7; - v12Y7 = v2Y7 - v1Y7; - v12Z7 = v2Z7 - v1Z7; - var t4 = v12X7 * v1X7 + v12Y7 * v1Y7 + v12Z7 * v1Z7; - t4 = -t4 / (v12X7 * v12X7 + v12Y7 * v12Y7 + v12Z7 * v12Z7); - var b5; - if(t4 < 0) { - out.x = v1X7; - out.y = v1Y7; - out.z = v1Z7; - b5 = 1; - } else if(t4 > 1) { - out.x = v2X7; - out.y = v2Y7; - out.z = v2Z7; - b5 = 2; - } else { - var pX4; - var pY4; - var pZ4; - pX4 = v1X7 + v12X7 * t4; - pY4 = v1Y7 + v12Y7 * t4; - pZ4 = v1Z7 + v12Z7 * t4; - out.x = pX4; - out.y = pY4; - out.z = pZ4; - b5 = 3; - } - var d2 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d2 < mind2) { - mini2 = b5 << 1; - mind2 = d2; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - } - if(v3X2 * n31X1 + v3Y2 * n31Y1 + v3Z2 * n31Z1 < 0) { - var v1X8; - var v1Y8; - var v1Z8; - var v2X8; - var v2Y8; - var v2Z8; - v1X8 = vec1.x; - v1Y8 = vec1.y; - v1Z8 = vec1.z; - v2X8 = vec4.x; - v2Y8 = vec4.y; - v2Z8 = vec4.z; - var v12X8; - var v12Y8; - var v12Z8; - v12X8 = v2X8 - v1X8; - v12Y8 = v2Y8 - v1Y8; - v12Z8 = v2Z8 - v1Z8; - var t5 = v12X8 * v1X8 + v12Y8 * v1Y8 + v12Z8 * v1Z8; - t5 = -t5 / (v12X8 * v12X8 + v12Y8 * v12Y8 + v12Z8 * v12Z8); - var b6; - if(t5 < 0) { - out.x = v1X8; - out.y = v1Y8; - out.z = v1Z8; - b6 = 1; - } else if(t5 > 1) { - out.x = v2X8; - out.y = v2Y8; - out.z = v2Z8; - b6 = 2; - } else { - var pX5; - var pY5; - var pZ5; - pX5 = v1X8 + v12X8 * t5; - pY5 = v1Y8 + v12Y8 * t5; - pZ5 = v1Z8 + v12Z8 * t5; - out.x = pX5; - out.y = pY5; - out.z = pZ5; - b6 = 3; - } - var d3 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind2 < 0 || d3 < mind2) { - mini2 = b6 & 1 | (b6 & 2) << 1; - mind2 = d3; - minvX2 = out.x; - minvY2 = out.y; - minvZ2 = out.z; - } - } - var b7; - if(mind2 > 0) { - out.x = minvX2; - out.y = minvY2; - out.z = minvZ2; - b7 = mini2; - } else { - var l1 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - nX1 *= l1; - nY1 *= l1; - nZ1 *= l1; - var l21 = nX1 * nX1 + nY1 * nY1 + nZ1 * nZ1; - l21 = (v1X5 * nX1 + v1Y5 * nY1 + v1Z5 * nZ1) / l21; - minvX2 = nX1 * l21; - minvY2 = nY1 * l21; - minvZ2 = nZ1 * l21; - out.x = minvX2; - out.y = minvY2; - out.z = minvZ2; - b7 = 7; - } - var d4 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d4 < mind) { - mini = b7 & 1 | (b7 & 6) << 1; - mind = d4; + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b & 3 | (b & 4) << 1; + mind = d; minvX = out.x; minvY = out.y; minvZ = out.z; } } - if((v1X * n142X + v1Y * n142Y + v1Z * n142Z) * sign < 0) { - var v1X9; - var v1Y9; - var v1Z9; - var v2X9; - var v2Y9; - var v2Z9; - var v3X3; - var v3Y3; - var v3Z3; - var v12X9; - var v12Y9; - var v12Z9; - var v23X3; - var v23Y3; - var v23Z3; - var v31X2; - var v31Y2; - var v31Z2; - v1X9 = vec1.x; - v1Y9 = vec1.y; - v1Z9 = vec1.z; - v2X9 = vec2.x; - v2Y9 = vec2.y; - v2Z9 = vec2.z; - v3X3 = vec4.x; - v3Y3 = vec4.y; - v3Z3 = vec4.z; - v12X9 = v2X9 - v1X9; - v12Y9 = v2Y9 - v1Y9; - v12Z9 = v2Z9 - v1Z9; - v23X3 = v3X3 - v2X9; - v23Y3 = v3Y3 - v2Y9; - v23Z3 = v3Z3 - v2Z9; - v31X2 = v1X9 - v3X3; - v31Y2 = v1Y9 - v3Y3; - v31Z2 = v1Z9 - v3Z3; - var nX2; - var nY2; - var nZ2; - nX2 = v12Y9 * v23Z3 - v12Z9 * v23Y3; - nY2 = v12Z9 * v23X3 - v12X9 * v23Z3; - nZ2 = v12X9 * v23Y3 - v12Y9 * v23X3; - var n12X2; - var n12Y2; - var n12Z2; - var n23X2; - var n23Y2; - var n23Z2; - var n31X2; - var n31Y2; - var n31Z2; - n12X2 = v12Y9 * nZ2 - v12Z9 * nY2; - n12Y2 = v12Z9 * nX2 - v12X9 * nZ2; - n12Z2 = v12X9 * nY2 - v12Y9 * nX2; - n23X2 = v23Y3 * nZ2 - v23Z3 * nY2; - n23Y2 = v23Z3 * nX2 - v23X3 * nZ2; - n23Z2 = v23X3 * nY2 - v23Y3 * nX2; - n31X2 = v31Y2 * nZ2 - v31Z2 * nY2; - n31Y2 = v31Z2 * nX2 - v31X2 * nZ2; - n31Z2 = v31X2 * nY2 - v31Y2 * nX2; - var mind3 = -1; - var minvX3; - var minvY3; - var minvZ3; - var mini3 = 0; - minvX3 = 0; - minvY3 = 0; - minvZ3 = 0; - if(v1X9 * n12X2 + v1Y9 * n12Y2 + v1Z9 * n12Z2 < 0) { - var v1X10; - var v1Y10; - var v1Z10; - var v2X10; - var v2Y10; - var v2Z10; - v1X10 = vec1.x; - v1Y10 = vec1.y; - v1Z10 = vec1.z; - v2X10 = vec2.x; - v2Y10 = vec2.y; - v2Z10 = vec2.z; - var v12X10; - var v12Y10; - var v12Z10; - v12X10 = v2X10 - v1X10; - v12Y10 = v2Y10 - v1Y10; - v12Z10 = v2Z10 - v1Z10; - var t6 = v12X10 * v1X10 + v12Y10 * v1Y10 + v12Z10 * v1Z10; - t6 = -t6 / (v12X10 * v12X10 + v12Y10 * v12Y10 + v12Z10 * v12Z10); - var b8; - if(t6 < 0) { - out.x = v1X10; - out.y = v1Y10; - out.z = v1Z10; - b8 = 1; - } else if(t6 > 1) { - out.x = v2X10; - out.y = v2Y10; - out.z = v2Z10; - b8 = 2; + if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { + var v1X; + var v1Y; + var v1Z; + var v2X; + var v2Y; + var v2Z; + var v3X; + var v3Y; + var v3Z; + var v12X; + var v12Y; + var v12Z; + var v23X; + var v23Y; + var v23Z; + var v31X; + var v31Y; + var v31Z; + v1X = vec2.x; + v1Y = vec2.y; + v1Z = vec2.z; + v2X = vec3.x; + v2Y = vec3.y; + v2Z = vec3.z; + v3X = vec4.x; + v3Y = vec4.y; + v3Z = vec4.z; + v12X = v2X - v1X; + v12Y = v2Y - v1Y; + v12Z = v2Z - v1Z; + v23X = v3X - v2X; + v23Y = v3Y - v2Y; + v23Z = v3Z - v2Z; + v31X = v1X - v3X; + v31Y = v1Y - v3Y; + v31Z = v1Z - v3Z; + var nX; + var nY; + var nZ; + nX = v12Y * v23Z - v12Z * v23Y; + nY = v12Z * v23X - v12X * v23Z; + nZ = v12X * v23Y - v12Y * v23X; + var n12X; + var n12Y; + var n12Z; + var n23X; + var n23Y; + var n23Z; + var n31X; + var n31Y; + var n31Z; + n12X = v12Y * nZ - v12Z * nY; + n12Y = v12Z * nX - v12X * nZ; + n12Z = v12X * nY - v12Y * nX; + n23X = v23Y * nZ - v23Z * nY; + n23Y = v23Z * nX - v23X * nZ; + n23Z = v23X * nY - v23Y * nX; + n31X = v31Y * nZ - v31Z * nY; + n31Y = v31Z * nX - v31X * nZ; + n31Z = v31X * nY - v31Y * nX; + var mind1 = -1; + var minvX1; + var minvY1; + var minvZ1; + var mini1 = 0; + minvX1 = 0; + minvY1 = 0; + minvZ1 = 0; + if(v1X * n12X + v1Y * n12Y + v1Z * n12Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X1; + var v2Y1; + var v2Z1; + v1X1 = vec2.x; + v1Y1 = vec2.y; + v1Z1 = vec2.z; + v2X1 = vec3.x; + v2Y1 = vec3.y; + v2Z1 = vec3.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X1 - v1X1; + v12Y = v2Y1 - v1Y1; + v12Z = v2Z1 - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X1; + out.y = v2Y1; + out.z = v2Z1; + b = 2; } else { - var pX6; - var pY6; - var pZ6; - pX6 = v1X10 + v12X10 * t6; - pY6 = v1Y10 + v12Y10 * t6; - pZ6 = v1Z10 + v12Z10 * t6; - out.x = pX6; - out.y = pY6; - out.z = pZ6; - b8 = 3; - } - mini3 = b8; - mind3 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; - } - if(v2X9 * n23X2 + v2Y9 * n23Y2 + v2Z9 * n23Z2 < 0) { - var v1X11; - var v1Y11; - var v1Z11; - var v2X11; - var v2Y11; - var v2Z11; - v1X11 = vec2.x; - v1Y11 = vec2.y; - v1Z11 = vec2.z; - v2X11 = vec4.x; - v2Y11 = vec4.y; - v2Z11 = vec4.z; - var v12X11; - var v12Y11; - var v12Z11; - v12X11 = v2X11 - v1X11; - v12Y11 = v2Y11 - v1Y11; - v12Z11 = v2Z11 - v1Z11; - var t7 = v12X11 * v1X11 + v12Y11 * v1Y11 + v12Z11 * v1Z11; - t7 = -t7 / (v12X11 * v12X11 + v12Y11 * v12Y11 + v12Z11 * v12Z11); - var b9; - if(t7 < 0) { - out.x = v1X11; - out.y = v1Y11; - out.z = v1Z11; - b9 = 1; - } else if(t7 > 1) { - out.x = v2X11; - out.y = v2Y11; - out.z = v2Z11; - b9 = 2; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + mini1 = b; + mind1 = out.x * out.x + out.y * out.y + out.z * out.z; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + if(v2X * n23X + v2Y * n23Y + v2Z * n23Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec3.x; + v1Y1 = vec3.y; + v1Z1 = vec3.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var pX7; - var pY7; - var pZ7; - pX7 = v1X11 + v12X11 * t7; - pY7 = v1Y11 + v12Y11 * t7; - pZ7 = v1Z11 + v12Z11 * t7; - out.x = pX7; - out.y = pY7; - out.z = pZ7; - b9 = 3; - } - var d5 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d5 < mind3) { - mini3 = b9 << 1; - mind3 = d5; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; - } - } - if(v3X3 * n31X2 + v3Y3 * n31Y2 + v3Z3 * n31Z2 < 0) { - var v1X12; - var v1Y12; - var v1Z12; - var v2X12; - var v2Y12; - var v2Z12; - v1X12 = vec1.x; - v1Y12 = vec1.y; - v1Z12 = vec1.z; - v2X12 = vec4.x; - v2Y12 = vec4.y; - v2Z12 = vec4.z; - var v12X12; - var v12Y12; - var v12Z12; - v12X12 = v2X12 - v1X12; - v12Y12 = v2Y12 - v1Y12; - v12Z12 = v2Z12 - v1Z12; - var t8 = v12X12 * v1X12 + v12Y12 * v1Y12 + v12Z12 * v1Z12; - t8 = -t8 / (v12X12 * v12X12 + v12Y12 * v12Y12 + v12Z12 * v12Z12); - var b10; - if(t8 < 0) { - out.x = v1X12; - out.y = v1Y12; - out.z = v1Z12; - b10 = 1; - } else if(t8 > 1) { - out.x = v2X12; - out.y = v2Y12; - out.z = v2Z12; - b10 = 2; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; + } + } + if(v3X * n31X + v3Y * n31Y + v3Z * n31Z < 0) { + var v1X1; + var v1Y1; + var v1Z1; + var v2X; + var v2Y; + var v2Z; + v1X1 = vec2.x; + v1Y1 = vec2.y; + v1Z1 = vec2.z; + v2X = vec4.x; + v2Y = vec4.y; + v2Z = vec4.z; + var v12X; + var v12Y; + var v12Z; + v12X = v2X - v1X1; + v12Y = v2Y - v1Y1; + v12Z = v2Z - v1Z1; + var t = v12X * v1X1 + v12Y * v1Y1 + v12Z * v1Z1; + t = -t / (v12X * v12X + v12Y * v12Y + v12Z * v12Z); + var b; + if(t < 0) { + out.x = v1X1; + out.y = v1Y1; + out.z = v1Z1; + b = 1; + } else if(t > 1) { + out.x = v2X; + out.y = v2Y; + out.z = v2Z; + b = 2; } else { - var pX8; - var pY8; - var pZ8; - pX8 = v1X12 + v12X12 * t8; - pY8 = v1Y12 + v12Y12 * t8; - pZ8 = v1Z12 + v12Z12 * t8; - out.x = pX8; - out.y = pY8; - out.z = pZ8; - b10 = 3; - } - var d6 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind3 < 0 || d6 < mind3) { - mini3 = b10 & 1 | (b10 & 2) << 1; - mind3 = d6; - minvX3 = out.x; - minvY3 = out.y; - minvZ3 = out.z; + var pX; + var pY; + var pZ; + pX = v1X1 + v12X * t; + pY = v1Y1 + v12Y * t; + pZ = v1Z1 + v12Z * t; + out.x = pX; + out.y = pY; + out.z = pZ; + b = 3; + } + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind1 < 0 || d < mind1) { + mini1 = b & 1 | (b & 2) << 1; + mind1 = d; + minvX1 = out.x; + minvY1 = out.y; + minvZ1 = out.z; } } - var b11; - if(mind3 > 0) { - out.x = minvX3; - out.y = minvY3; - out.z = minvZ3; - b11 = mini3; + var b; + if(mind1 > 0) { + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = mini1; } else { - var l3 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - nX2 *= l3; - nY2 *= l3; - nZ2 *= l3; - var l22 = nX2 * nX2 + nY2 * nY2 + nZ2 * nZ2; - l22 = (v1X9 * nX2 + v1Y9 * nY2 + v1Z9 * nZ2) / l22; - minvX3 = nX2 * l22; - minvY3 = nY2 * l22; - minvZ3 = nZ2 * l22; - out.x = minvX3; - out.y = minvY3; - out.z = minvZ3; - b11 = 7; - } - var d7 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d7 < mind) { - mini = b11 & 3 | (b11 & 4) << 1; - mind = d7; - minvX = out.x; - minvY = out.y; - minvZ = out.z; + var l = nX * nX + nY * nY + nZ * nZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + nX *= l; + nY *= l; + nZ *= l; + var l2 = nX * nX + nY * nY + nZ * nZ; + l2 = (v1X * nX + v1Y * nY + v1Z * nZ) / l2; + minvX1 = nX * l2; + minvY1 = nY * l2; + minvZ1 = nZ * l2; + out.x = minvX1; + out.y = minvY1; + out.z = minvZ1; + b = 7; } - } - if((v2X * n243X + v2Y * n243Y + v2Z * n243Z) * sign < 0) { - var v1X13; - var v1Y13; - var v1Z13; - var v2X13; - var v2Y13; - var v2Z13; - var v3X4; - var v3Y4; - var v3Z4; - var v12X13; - var v12Y13; - var v12Z13; - var v23X4; - var v23Y4; - var v23Z4; - var v31X3; - var v31Y3; - var v31Z3; - v1X13 = vec2.x; - v1Y13 = vec2.y; - v1Z13 = vec2.z; - v2X13 = vec3.x; - v2Y13 = vec3.y; - v2Z13 = vec3.z; - v3X4 = vec4.x; - v3Y4 = vec4.y; - v3Z4 = vec4.z; - v12X13 = v2X13 - v1X13; - v12Y13 = v2Y13 - v1Y13; - v12Z13 = v2Z13 - v1Z13; - v23X4 = v3X4 - v2X13; - v23Y4 = v3Y4 - v2Y13; - v23Z4 = v3Z4 - v2Z13; - v31X3 = v1X13 - v3X4; - v31Y3 = v1Y13 - v3Y4; - v31Z3 = v1Z13 - v3Z4; - var nX3; - var nY3; - var nZ3; - nX3 = v12Y13 * v23Z4 - v12Z13 * v23Y4; - nY3 = v12Z13 * v23X4 - v12X13 * v23Z4; - nZ3 = v12X13 * v23Y4 - v12Y13 * v23X4; - var n12X3; - var n12Y3; - var n12Z3; - var n23X3; - var n23Y3; - var n23Z3; - var n31X3; - var n31Y3; - var n31Z3; - n12X3 = v12Y13 * nZ3 - v12Z13 * nY3; - n12Y3 = v12Z13 * nX3 - v12X13 * nZ3; - n12Z3 = v12X13 * nY3 - v12Y13 * nX3; - n23X3 = v23Y4 * nZ3 - v23Z4 * nY3; - n23Y3 = v23Z4 * nX3 - v23X4 * nZ3; - n23Z3 = v23X4 * nY3 - v23Y4 * nX3; - n31X3 = v31Y3 * nZ3 - v31Z3 * nY3; - n31Y3 = v31Z3 * nX3 - v31X3 * nZ3; - n31Z3 = v31X3 * nY3 - v31Y3 * nX3; - var mind4 = -1; - var minvX4; - var minvY4; - var minvZ4; - var mini4 = 0; - minvX4 = 0; - minvY4 = 0; - minvZ4 = 0; - if(v1X13 * n12X3 + v1Y13 * n12Y3 + v1Z13 * n12Z3 < 0) { - var v1X14; - var v1Y14; - var v1Z14; - var v2X14; - var v2Y14; - var v2Z14; - v1X14 = vec2.x; - v1Y14 = vec2.y; - v1Z14 = vec2.z; - v2X14 = vec3.x; - v2Y14 = vec3.y; - v2Z14 = vec3.z; - var v12X14; - var v12Y14; - var v12Z14; - v12X14 = v2X14 - v1X14; - v12Y14 = v2Y14 - v1Y14; - v12Z14 = v2Z14 - v1Z14; - var t9 = v12X14 * v1X14 + v12Y14 * v1Y14 + v12Z14 * v1Z14; - t9 = -t9 / (v12X14 * v12X14 + v12Y14 * v12Y14 + v12Z14 * v12Z14); - var b12; - if(t9 < 0) { - out.x = v1X14; - out.y = v1Y14; - out.z = v1Z14; - b12 = 1; - } else if(t9 > 1) { - out.x = v2X14; - out.y = v2Y14; - out.z = v2Z14; - b12 = 2; - } else { - var pX9; - var pY9; - var pZ9; - pX9 = v1X14 + v12X14 * t9; - pY9 = v1Y14 + v12Y14 * t9; - pZ9 = v1Z14 + v12Z14 * t9; - out.x = pX9; - out.y = pY9; - out.z = pZ9; - b12 = 3; - } - mini4 = b12; - mind4 = out.x * out.x + out.y * out.y + out.z * out.z; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - if(v2X13 * n23X3 + v2Y13 * n23Y3 + v2Z13 * n23Z3 < 0) { - var v1X15; - var v1Y15; - var v1Z15; - var v2X15; - var v2Y15; - var v2Z15; - v1X15 = vec3.x; - v1Y15 = vec3.y; - v1Z15 = vec3.z; - v2X15 = vec4.x; - v2Y15 = vec4.y; - v2Z15 = vec4.z; - var v12X15; - var v12Y15; - var v12Z15; - v12X15 = v2X15 - v1X15; - v12Y15 = v2Y15 - v1Y15; - v12Z15 = v2Z15 - v1Z15; - var t10 = v12X15 * v1X15 + v12Y15 * v1Y15 + v12Z15 * v1Z15; - t10 = -t10 / (v12X15 * v12X15 + v12Y15 * v12Y15 + v12Z15 * v12Z15); - var b13; - if(t10 < 0) { - out.x = v1X15; - out.y = v1Y15; - out.z = v1Z15; - b13 = 1; - } else if(t10 > 1) { - out.x = v2X15; - out.y = v2Y15; - out.z = v2Z15; - b13 = 2; - } else { - var pX10; - var pY10; - var pZ10; - pX10 = v1X15 + v12X15 * t10; - pY10 = v1Y15 + v12Y15 * t10; - pZ10 = v1Z15 + v12Z15 * t10; - out.x = pX10; - out.y = pY10; - out.z = pZ10; - b13 = 3; - } - var d8 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d8 < mind4) { - mini4 = b13 << 1; - mind4 = d8; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - } - if(v3X4 * n31X3 + v3Y4 * n31Y3 + v3Z4 * n31Z3 < 0) { - var v1X16; - var v1Y16; - var v1Z16; - var v2X16; - var v2Y16; - var v2Z16; - v1X16 = vec2.x; - v1Y16 = vec2.y; - v1Z16 = vec2.z; - v2X16 = vec4.x; - v2Y16 = vec4.y; - v2Z16 = vec4.z; - var v12X16; - var v12Y16; - var v12Z16; - v12X16 = v2X16 - v1X16; - v12Y16 = v2Y16 - v1Y16; - v12Z16 = v2Z16 - v1Z16; - var t11 = v12X16 * v1X16 + v12Y16 * v1Y16 + v12Z16 * v1Z16; - t11 = -t11 / (v12X16 * v12X16 + v12Y16 * v12Y16 + v12Z16 * v12Z16); - var b14; - if(t11 < 0) { - out.x = v1X16; - out.y = v1Y16; - out.z = v1Z16; - b14 = 1; - } else if(t11 > 1) { - out.x = v2X16; - out.y = v2Y16; - out.z = v2Z16; - b14 = 2; - } else { - var pX11; - var pY11; - var pZ11; - pX11 = v1X16 + v12X16 * t11; - pY11 = v1Y16 + v12Y16 * t11; - pZ11 = v1Z16 + v12Z16 * t11; - out.x = pX11; - out.y = pY11; - out.z = pZ11; - b14 = 3; - } - var d9 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind4 < 0 || d9 < mind4) { - mini4 = b14 & 1 | (b14 & 2) << 1; - mind4 = d9; - minvX4 = out.x; - minvY4 = out.y; - minvZ4 = out.z; - } - } - var b15; - if(mind4 > 0) { - out.x = minvX4; - out.y = minvY4; - out.z = minvZ4; - b15 = mini4; - } else { - var l4 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - if(l4 > 0) { - l4 = 1 / Math.sqrt(l4); - } - nX3 *= l4; - nY3 *= l4; - nZ3 *= l4; - var l23 = nX3 * nX3 + nY3 * nY3 + nZ3 * nZ3; - l23 = (v1X13 * nX3 + v1Y13 * nY3 + v1Z13 * nZ3) / l23; - minvX4 = nX3 * l23; - minvY4 = nY3 * l23; - minvZ4 = nZ3 * l23; - out.x = minvX4; - out.y = minvY4; - out.z = minvZ4; - b15 = 7; - } - var d10 = out.x * out.x + out.y * out.y + out.z * out.z; - if(mind < 0 || d10 < mind) { - mini = b15 << 1; - mind = d10; + var d = out.x * out.x + out.y * out.y + out.z * out.z; + if(mind < 0 || d < mind) { + mini = b << 1; + mind = d; minvX = out.x; minvY = out.y; minvZ = out.z; @@ -25874,23 +25934,22 @@ oimo_common_Mat4.prototype = { return this; } ,fromTransform: function(transform) { - var m = this; - m.e00 = transform._rotation00; - m.e01 = transform._rotation01; - m.e02 = transform._rotation02; - m.e10 = transform._rotation10; - m.e11 = transform._rotation11; - m.e12 = transform._rotation12; - m.e20 = transform._rotation20; - m.e21 = transform._rotation21; - m.e22 = transform._rotation22; - m.e03 = transform._positionX; - m.e13 = transform._positionY; - m.e23 = transform._positionZ; - m.e30 = 0; - m.e31 = 0; - m.e32 = 0; - m.e33 = 1; + this.e00 = transform._rotation00; + this.e01 = transform._rotation01; + this.e02 = transform._rotation02; + this.e10 = transform._rotation10; + this.e11 = transform._rotation11; + this.e12 = transform._rotation12; + this.e20 = transform._rotation20; + this.e21 = transform._rotation21; + this.e22 = transform._rotation22; + this.e03 = transform._positionX; + this.e13 = transform._positionY; + this.e23 = transform._positionZ; + this.e30 = 0; + this.e31 = 0; + this.e32 = 0; + this.e33 = 1; return this; } ,clone: function() { @@ -26040,15 +26099,15 @@ oimo_common_Pool.prototype = { mat3.e21 = 0; mat3.e22 = 1; if(this.sizeMat3 == this.stackMat3.length) { - var newArray1 = new Array(this.sizeMat3 << 1); - var _g2 = 0; - var _g11 = this.sizeMat3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.stackMat3[i1]; - this.stackMat3[i1] = null; + var newArray = new Array(this.sizeMat3 << 1); + var _g = 0; + var _g1 = this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat3[i]; + this.stackMat3[i] = null; } - this.stackMat3 = newArray1; + this.stackMat3 = newArray; } this.stackMat3[this.sizeMat3++] = mat3; } @@ -26070,15 +26129,15 @@ oimo_common_Pool.prototype = { mat4.e32 = 0; mat4.e33 = 1; if(this.sizeMat4 == this.stackMat4.length) { - var newArray2 = new Array(this.sizeMat4 << 1); - var _g3 = 0; - var _g12 = this.sizeMat4; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.stackMat4[i2]; - this.stackMat4[i2] = null; + var newArray = new Array(this.sizeMat4 << 1); + var _g = 0; + var _g1 = this.sizeMat4; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackMat4[i]; + this.stackMat4[i] = null; } - this.stackMat4 = newArray2; + this.stackMat4 = newArray; } this.stackMat4[this.sizeMat4++] = mat4; } @@ -26088,15 +26147,15 @@ oimo_common_Pool.prototype = { quat.z = 0; quat.w = 1; if(this.sizeQuat == this.stackQuat.length) { - var newArray3 = new Array(this.sizeQuat << 1); - var _g4 = 0; - var _g13 = this.sizeQuat; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = this.stackQuat[i3]; - this.stackQuat[i3] = null; + var newArray = new Array(this.sizeQuat << 1); + var _g = 0; + var _g1 = this.sizeQuat; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.stackQuat[i]; + this.stackQuat[i] = null; } - this.stackQuat = newArray3; + this.stackQuat = newArray; } this.stackQuat[this.sizeQuat++] = quat; } @@ -26360,11 +26419,11 @@ oimo_common_Quat.prototype = { qy -= this.y * d; qz -= this.z * d; qw -= this.w * d; - var invLen1 = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); - qx *= invLen1; - qy *= invLen1; - qz *= invLen1; - qw *= invLen1; + var invLen = 1 / Math.sqrt(qx * qx + qy * qy + qz * qz + qw * qw); + qx *= invLen; + qy *= invLen; + qz *= invLen; + qw *= invLen; var sin = Math.sin(theta); var cos = Math.cos(theta); return new oimo_common_Quat(this.x * cos + qx * sin,this.y * cos + qy * sin,this.z * cos + qz * sin,this.w * cos + qw * sin); @@ -26504,29 +26563,57 @@ oimo_dynamics_Contact.prototype = { this._manifold._clear(); } if(this._touching && !ptouching) { + var cc1 = this._s1._contactCallback; var cc2 = this._s2._contactCallback; - if(this._s1._contactCallback == cc2) { + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.beginContact(this); + } + if(cc2 != null) { + cc2.beginContact(this); + } } if(!this._touching && ptouching) { - var cc21 = this._s2._contactCallback; - if(this._s1._contactCallback == cc21) { - cc21 = null; + var cc1 = this._s1._contactCallback; + var cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.endContact(this); + } + if(cc2 != null) { + cc2.endContact(this); } } if(this._touching) { - var cc22 = this._s2._contactCallback; - if(this._s1._contactCallback == cc22) { - cc22 = null; + var cc1 = this._s1._contactCallback; + var cc2 = this._s2._contactCallback; + if(cc1 == cc2) { + cc2 = null; + } + if(cc1 != null) { + cc1.preSolve(this); + } + if(cc2 != null) { + cc2.preSolve(this); } } } ,_postSolve: function() { + var cc1 = this._s1._contactCallback; var cc2 = this._s2._contactCallback; - if(this._s1._contactCallback == cc2) { + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.postSolve(this); + } + if(cc2 != null) { + cc2.postSolve(this); + } } ,getShape1: function() { return this._s1; @@ -26707,10 +26794,17 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { + var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } var prev1 = c._link1._prev; var next1 = c._link1._next; @@ -26800,10 +26894,17 @@ oimo_dynamics_ContactManager.prototype = { c._next = null; c._prev = null; if(c._touching) { + var cc11 = c._s1._contactCallback; var cc21 = c._s2._contactCallback; - if(c._s1._contactCallback == cc21) { + if(cc11 == cc21) { cc21 = null; } + if(cc11 != null) { + cc11.endContact(c); + } + if(cc21 != null) { + cc21.endContact(c); + } } var prev4 = c._link1._prev; var next4 = c._link1._next; @@ -26970,29 +27071,29 @@ oimo_dynamics_Island.prototype = { this.solvers[this.numSolvers++] = solver; if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.SPLIT_IMPULSE) { if(this.numSolversSi == this.solversSi.length) { - var newArray1 = new Array(this.numSolversSi << 1); - var _g2 = 0; - var _g11 = this.numSolversSi; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = this.solversSi[i1]; - this.solversSi[i1] = null; + var newArray = new Array(this.numSolversSi << 1); + var _g = 0; + var _g1 = this.numSolversSi; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.solversSi[i]; + this.solversSi[i] = null; } - this.solversSi = newArray1; + this.solversSi = newArray; } this.solversSi[this.numSolversSi++] = solver; } if(positionCorrection == oimo_dynamics_constraint_PositionCorrectionAlgorithm.NGS) { if(this.numSolversNgs == this.solversNgs.length) { - var newArray2 = new Array(this.numSolversNgs << 1); - var _g3 = 0; - var _g12 = this.numSolversNgs; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = this.solversNgs[i2]; - this.solversNgs[i2] = null; + var newArray = new Array(this.numSolversNgs << 1); + var _g = 0; + var _g1 = this.numSolversNgs; + while(_g < _g1) { + var i = _g++; + newArray[i] = this.solversNgs[i]; + this.solversNgs[i] = null; } - this.solversNgs = newArray2; + this.solversNgs = newArray; } this.solversNgs[this.numSolversNgs++] = solver; } @@ -27033,9 +27134,9 @@ oimo_dynamics_Island.prototype = { var x = dt * rb._linearDamping; var x2 = x * x; var linScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); - var x1 = dt * rb._angularDamping; - var x21 = x1 * x1; - var angScale = 1 / (1 + x1 + x21 * (0.5 + x1 * 0.16666666666666666 + x21 * 0.041666666666666664)); + var x = dt * rb._angularDamping; + var x2 = x * x; + var angScale = 1 / (1 + x + x2 * (0.5 + x * 0.16666666666666666 + x2 * 0.041666666666666664)); var linAccX; var linAccY; var linAccZ; @@ -27076,7 +27177,7 @@ oimo_dynamics_Island.prototype = { var n = s._next; var tf1 = rb._ptransform; var tf2 = rb._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; var __tmp__01; @@ -27096,28 +27197,28 @@ oimo_dynamics_Island.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; - __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; - __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X1; - dst1._positionY = __tmp__Y1; - dst1._positionZ = __tmp__Z1; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; var __tmp__001; var __tmp__011; @@ -27137,27 +27238,27 @@ oimo_dynamics_Island.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; - __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; - __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -27274,70 +27375,70 @@ oimo_dynamics_Island.prototype = { } } if(sleepIsland) { - var _g2 = 0; - var _g3 = this.numRigidBodies; - while(_g2 < _g3) { - var rb1 = this.rigidBodies[_g2++]; - rb1._sleeping = true; - rb1._sleepTime = 0; + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var rb = this.rigidBodies[_g++]; + rb._sleeping = true; + rb._sleepTime = 0; } return; } - var _g21 = 0; - var _g31 = this.numSolvers; - while(_g21 < _g31) this.solvers[_g21++].preSolveVelocity(timeStep); - var _g4 = 0; - var _g5 = this.numSolvers; - while(_g4 < _g5) this.solvers[_g4++].warmStart(timeStep); - var _g6 = 0; - while(_g6 < numVelocityIterations) { - ++_g6; - var _g61 = 0; - var _g7 = this.numSolvers; - while(_g61 < _g7) this.solvers[_g61++].solveVelocity(); - } - var _g8 = 0; - var _g9 = this.numSolvers; - while(_g8 < _g9) this.solvers[_g8++].postSolveVelocity(timeStep); - var _g10 = 0; - var _g11 = this.numRigidBodies; - while(_g10 < _g11) this.rigidBodies[_g10++]._integrate(dt); - var _g12 = 0; - var _g13 = this.numSolversSi; - while(_g12 < _g13) this.solversSi[_g12++].preSolvePosition(timeStep); - var _g14 = 0; - while(_g14 < numPositionIterations) { - ++_g14; - var _g141 = 0; - var _g15 = this.numSolversSi; - while(_g141 < _g15) this.solversSi[_g141++].solvePositionSplitImpulse(); - } - var _g16 = 0; - var _g17 = this.numRigidBodies; - while(_g16 < _g17) this.rigidBodies[_g16++]._integratePseudoVelocity(); - var _g18 = 0; - var _g19 = this.numSolversNgs; - while(_g18 < _g19) this.solversNgs[_g18++].preSolvePosition(timeStep); - var _g20 = 0; - while(_g20 < numPositionIterations) { - ++_g20; - var _g201 = 0; - var _g211 = this.numSolversNgs; - while(_g201 < _g211) this.solversNgs[_g201++].solvePositionNgs(timeStep); - } - var _g22 = 0; - var _g23 = this.numSolvers; - while(_g22 < _g23) this.solvers[_g22++].postSolve(); - var _g24 = 0; - var _g25 = this.numRigidBodies; - while(_g24 < _g25) { - var rb2 = this.rigidBodies[_g24++]; - var s = rb2._shapeList; + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].preSolveVelocity(timeStep); + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].warmStart(timeStep); + var _g = 0; + while(_g < numVelocityIterations) { + ++_g; + var _g1 = 0; + var _g2 = this.numSolvers; + while(_g1 < _g2) this.solvers[_g1++].solveVelocity(); + } + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].postSolveVelocity(timeStep); + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) this.rigidBodies[_g++]._integrate(dt); + var _g = 0; + var _g1 = this.numSolversSi; + while(_g < _g1) this.solversSi[_g++].preSolvePosition(timeStep); + var _g = 0; + while(_g < numPositionIterations) { + ++_g; + var _g1 = 0; + var _g2 = this.numSolversSi; + while(_g1 < _g2) this.solversSi[_g1++].solvePositionSplitImpulse(); + } + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) this.rigidBodies[_g++]._integratePseudoVelocity(); + var _g = 0; + var _g1 = this.numSolversNgs; + while(_g < _g1) this.solversNgs[_g++].preSolvePosition(timeStep); + var _g = 0; + while(_g < numPositionIterations) { + ++_g; + var _g1 = 0; + var _g2 = this.numSolversNgs; + while(_g1 < _g2) this.solversNgs[_g1++].solvePositionNgs(timeStep); + } + var _g = 0; + var _g1 = this.numSolvers; + while(_g < _g1) this.solvers[_g++].postSolve(); + var _g = 0; + var _g1 = this.numRigidBodies; + while(_g < _g1) { + var rb = this.rigidBodies[_g++]; + var s = rb._shapeList; while(s != null) { var n = s._next; - var tf1 = rb2._ptransform; - var tf2 = rb2._transform; - var dst1 = s._ptransform; + var tf1 = rb._ptransform; + var tf2 = rb._transform; + var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; var __tmp__01; @@ -27357,28 +27458,28 @@ oimo_dynamics_Island.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; - __tmp__Y1 = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; - __tmp__Z1 = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X1; - dst1._positionY = __tmp__Y1; - dst1._positionZ = __tmp__Z1; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; + __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; + __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; var __tmp__001; var __tmp__011; @@ -27398,27 +27499,27 @@ oimo_dynamics_Island.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; - __tmp__Y2 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; - __tmp__Z2 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X2; - dst2._positionY = __tmp__Y2; - dst2._positionZ = __tmp__Z2; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; + var __tmp__X1; + var __tmp__Y1; + var __tmp__Z1; + __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; + __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; + __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -27507,10 +27608,10 @@ var oimo_dynamics_World = function(broadPhaseType,gravity) { oimo_dynamics_World.__name__ = true; oimo_dynamics_World.prototype = { _updateContacts: function() { - var st = Date.now() / 1000; + var st = HxOverrides.now() / 1000; this._contactManager._updateContacts(); - oimo_dynamics_common_Performance.broadPhaseCollisionTime = (Date.now() / 1000 - st) * 1000; - var st1 = Date.now() / 1000; + oimo_dynamics_common_Performance.broadPhaseCollisionTime = (HxOverrides.now() / 1000 - st) * 1000; + var st = HxOverrides.now() / 1000; var c = this._contactManager._contactList; while(c != null) { var n = c._next; @@ -27519,10 +27620,10 @@ oimo_dynamics_World.prototype = { } c = n; } - oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (Date.now() / 1000 - st1) * 1000; + oimo_dynamics_common_Performance.narrowPhaseCollisionTime = (HxOverrides.now() / 1000 - st) * 1000; } ,_solveIslands: function() { - var st = Date.now() / 1000; + var st = HxOverrides.now() / 1000; if(oimo_common_Setting.disableSleeping) { var b = this._rigidBodyList; while(b != null) { @@ -27542,45 +27643,45 @@ oimo_dynamics_World.prototype = { _this.gravityX = gravity.x; _this.gravityY = gravity.y; _this.gravityZ = gravity.z; - var b1 = this._rigidBodyList; + var b = this._rigidBodyList; this._numSolversInIslands = 0; - while(b1 != null) { - var n = b1._next; - while(!(b1._addedToIsland || b1._sleeping || b1._type == 1)) { - if(b1._numContactLinks == 0 && b1._numJointLinks == 0) { - this._island._stepSingleRigidBody(this._timeStep,b1); + while(b != null) { + var n = b._next; + while(!(b._addedToIsland || b._sleeping || b._type == 1)) { + if(b._numContactLinks == 0 && b._numJointLinks == 0) { + this._island._stepSingleRigidBody(this._timeStep,b); this._numIslands++; break; } - this.buildIsland(b1); + this.buildIsland(b); this._island._step(this._timeStep,this._numVelocityIterations,this._numPositionIterations); this._island._clear(); this._numIslands++; break; } - b1 = n; + b = n; } this._contactManager._postSolve(); - b1 = this._rigidBodyList; - while(b1 != null) { - b1._addedToIsland = false; - b1 = b1._next; - } - b1 = this._rigidBodyList; - while(b1 != null) { - b1._forceX = 0; - b1._forceY = 0; - b1._forceZ = 0; - b1._torqueX = 0; - b1._torqueY = 0; - b1._torqueZ = 0; - b1 = b1._next; + b = this._rigidBodyList; + while(b != null) { + b._addedToIsland = false; + b = b._next; + } + b = this._rigidBodyList; + while(b != null) { + b._forceX = 0; + b._forceY = 0; + b._forceZ = 0; + b._torqueX = 0; + b._torqueY = 0; + b._torqueZ = 0; + b = b._next; } while(this._numSolversInIslands > 0) { this._solversInIslands[--this._numSolversInIslands]._addedToIsland = false; this._solversInIslands[this._numSolversInIslands] = null; } - oimo_dynamics_common_Performance.dynamicsTime = (Date.now() / 1000 - st) * 1000; + oimo_dynamics_common_Performance.dynamicsTime = (HxOverrides.now() / 1000 - st) * 1000; } ,buildIsland: function(base) { var stackCount = 1; @@ -27623,21 +27724,21 @@ oimo_dynamics_World.prototype = { while(jl != null) { var n1 = jl._next; var j = jl._joint; - var js1 = j._solver; - if(!js1._addedToIsland) { + var js = j._solver; + if(!js._addedToIsland) { if(this._solversInIslands.length == this._numSolversInIslands) { var newArray1 = new Array(this._numSolversInIslands << 1); var _g2 = 0; - var _g11 = this._numSolversInIslands; - while(_g2 < _g11) { + var _g3 = this._numSolversInIslands; + while(_g2 < _g3) { var i1 = _g2++; newArray1[i1] = this._solversInIslands[i1]; this._solversInIslands[i1] = null; } this._solversInIslands = newArray1; } - this._solversInIslands[this._numSolversInIslands++] = js1; - this._island._addConstraintSolver(js1,j._positionCorrectionAlgorithm); + this._solversInIslands[this._numSolversInIslands++] = js; + this._island._addConstraintSolver(js,j._positionCorrectionAlgorithm); var other1 = jl._other; if(!other1._addedToIsland) { this._island._addRigidBody(other1); @@ -27660,48 +27761,48 @@ oimo_dynamics_World.prototype = { if(level >= d.drawBvhMinLevel && level <= d.drawBvhMaxLevel) { var _this = this._pool; var min = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var max = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var _this = this._pool; + var max = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; var v = min; v.x = node._aabbMinX; v.y = node._aabbMinY; v.z = node._aabbMinZ; - var v1 = max; - v1.x = node._aabbMaxX; - v1.y = node._aabbMaxY; - v1.z = node._aabbMaxZ; + var v = max; + v.x = node._aabbMaxX; + v.y = node._aabbMaxY; + v.z = node._aabbMaxZ; d.aabb(min,max,color); - var _this2 = this._pool; + var _this = this._pool; if(min != null) { min.zero(); - if(_this2.sizeVec3 == _this2.stackVec3.length) { - var newArray = new Array(_this2.sizeVec3 << 1); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); var _g = 0; - var _g1 = _this2.sizeVec3; + var _g1 = _this.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this2.stackVec3[i]; - _this2.stackVec3[i] = null; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this2.stackVec3 = newArray; + _this.stackVec3 = newArray; } - _this2.stackVec3[_this2.sizeVec3++] = min; + _this.stackVec3[_this.sizeVec3++] = min; } - var _this3 = this._pool; + var _this = this._pool; if(max != null) { max.zero(); - if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newArray1 = new Array(_this3.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this3.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this3.stackVec3[i1]; - _this3.stackVec3[i1] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this3.stackVec3 = newArray1; + _this.stackVec3 = newArray; } - _this3.stackVec3[_this3.sizeVec3++] = max; + _this.stackVec3[_this.sizeVec3++] = max; } } this._drawBvhNode(d,node._children[0],level + 1,color); @@ -27827,9 +27928,9 @@ oimo_dynamics_World.prototype = { _this10.z += o.z; } if(n2 > 30) { - var _g21 = 0; - while(_g21 < n2) { - var i2 = _g21++; + var _g3 = 0; + while(_g3 < n2) { + var i2 = _g3++; var v6 = g4._tmpVertices[i2]; v1.x = v6.x; v1.y = v6.y; @@ -27841,16 +27942,16 @@ oimo_dynamics_World.prototype = { d.line(v1,v2,shapeColor); } } else if(this._debugDraw.wireframe || n2 > 10) { - var _g22 = 0; - while(_g22 < n2) { - var i3 = _g22++; + var _g4 = 0; + while(_g4 < n2) { + var i3 = _g4++; var v8 = g4._tmpVertices[i3]; v1.x = v8.x; v1.y = v8.y; v1.z = v8.z; - var _g23 = 0; - while(_g23 < i3) { - var v9 = g4._tmpVertices[_g23++]; + var _g5 = 0; + while(_g5 < i3) { + var v9 = g4._tmpVertices[_g5++]; v2.x = v9.x; v2.y = v9.y; v2.z = v9.z; @@ -27858,23 +27959,23 @@ oimo_dynamics_World.prototype = { } } } else { - var _g24 = 0; - while(_g24 < n2) { - var i4 = _g24++; + var _g6 = 0; + while(_g6 < n2) { + var i4 = _g6++; var v10 = g4._tmpVertices[i4]; v1.x = v10.x; v1.y = v10.y; v1.z = v10.z; - var _g25 = 0; - while(_g25 < i4) { - var j = _g25++; + var _g7 = 0; + while(_g7 < i4) { + var j = _g7++; var v11 = g4._tmpVertices[j]; v2.x = v11.x; v2.y = v11.y; v2.z = v11.z; - var _g26 = 0; - while(_g26 < j) { - var v14 = g4._tmpVertices[_g26++]; + var _g8 = 0; + while(_g8 < j) { + var v14 = g4._tmpVertices[_g8++]; v3.x = v14.x; v3.y = v14.y; v3.z = v14.z; @@ -27922,10 +28023,10 @@ oimo_dynamics_World.prototype = { v1.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { var newArray1 = new Array(_this14.sizeVec3 << 1); - var _g3 = 0; + var _g9 = 0; var _g11 = _this14.sizeVec3; - while(_g3 < _g11) { - var i5 = _g3++; + while(_g9 < _g11) { + var i5 = _g9++; newArray1[i5] = _this14.stackVec3[i5]; _this14.stackVec3[i5] = null; } @@ -27938,10 +28039,10 @@ oimo_dynamics_World.prototype = { v2.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { var newArray2 = new Array(_this15.sizeVec3 << 1); - var _g4 = 0; + var _g10 = 0; var _g12 = _this15.sizeVec3; - while(_g4 < _g12) { - var i6 = _g4++; + while(_g10 < _g12) { + var i6 = _g10++; newArray2[i6] = _this15.stackVec3[i6]; _this15.stackVec3[i6] = null; } @@ -27954,10 +28055,10 @@ oimo_dynamics_World.prototype = { v3.zero(); if(_this16.sizeVec3 == _this16.stackVec3.length) { var newArray3 = new Array(_this16.sizeVec3 << 1); - var _g5 = 0; - var _g13 = _this16.sizeVec3; - while(_g5 < _g13) { - var i7 = _g5++; + var _g13 = 0; + var _g14 = _this16.sizeVec3; + while(_g13 < _g14) { + var i7 = _g13++; newArray3[i7] = _this16.stackVec3[i7]; _this16.stackVec3[i7] = null; } @@ -27970,10 +28071,10 @@ oimo_dynamics_World.prototype = { v12.zero(); if(_this17.sizeVec3 == _this17.stackVec3.length) { var newArray4 = new Array(_this17.sizeVec3 << 1); - var _g6 = 0; - var _g14 = _this17.sizeVec3; - while(_g6 < _g14) { - var i8 = _g6++; + var _g15 = 0; + var _g16 = _this17.sizeVec3; + while(_g15 < _g16) { + var i8 = _g15++; newArray4[i8] = _this17.stackVec3[i8]; _this17.stackVec3[i8] = null; } @@ -27986,10 +28087,10 @@ oimo_dynamics_World.prototype = { v13.zero(); if(_this18.sizeVec3 == _this18.stackVec3.length) { var newArray5 = new Array(_this18.sizeVec3 << 1); - var _g7 = 0; - var _g15 = _this18.sizeVec3; - while(_g7 < _g15) { - var i9 = _g7++; + var _g17 = 0; + var _g18 = _this18.sizeVec3; + while(_g17 < _g18) { + var i9 = _g17++; newArray5[i9] = _this18.stackVec3[i9]; _this18.stackVec3[i9] = null; } @@ -28002,10 +28103,10 @@ oimo_dynamics_World.prototype = { normal.zero(); if(_this19.sizeVec3 == _this19.stackVec3.length) { var newArray6 = new Array(_this19.sizeVec3 << 1); - var _g8 = 0; - var _g16 = _this19.sizeVec3; - while(_g8 < _g16) { - var i10 = _g8++; + var _g19 = 0; + var _g110 = _this19.sizeVec3; + while(_g19 < _g110) { + var i10 = _g19++; newArray6[i10] = _this19.stackVec3[i10]; _this19.stackVec3[i10] = null; } @@ -28026,10 +28127,10 @@ oimo_dynamics_World.prototype = { m.e22 = 1; if(_this20.sizeMat3 == _this20.stackMat3.length) { var newArray7 = new Array(_this20.sizeMat3 << 1); - var _g9 = 0; - var _g17 = _this20.sizeMat3; - while(_g9 < _g17) { - var i11 = _g9++; + var _g20 = 0; + var _g111 = _this20.sizeMat3; + while(_g20 < _g111) { + var i11 = _g20++; newArray7[i11] = _this20.stackMat3[i11]; _this20.stackMat3[i11] = null; } @@ -28042,10 +28143,10 @@ oimo_dynamics_World.prototype = { o.zero(); if(_this21.sizeVec3 == _this21.stackVec3.length) { var newArray8 = new Array(_this21.sizeVec3 << 1); - var _g10 = 0; - var _g18 = _this21.sizeVec3; - while(_g10 < _g18) { - var i12 = _g10++; + var _g21 = 0; + var _g112 = _this21.sizeVec3; + while(_g21 < _g112) { + var i12 = _g21++; newArray8[i12] = _this21.stackVec3[i12]; _this21.stackVec3[i12] = null; } @@ -28077,10 +28178,10 @@ oimo_dynamics_World.prototype = { min.zero(); if(_this24.sizeVec3 == _this24.stackVec3.length) { var newArray9 = new Array(_this24.sizeVec3 << 1); - var _g19 = 0; - var _g110 = _this24.sizeVec3; - while(_g19 < _g110) { - var i13 = _g19++; + var _g22 = 0; + var _g113 = _this24.sizeVec3; + while(_g22 < _g113) { + var i13 = _g22++; newArray9[i13] = _this24.stackVec3[i13]; _this24.stackVec3[i13] = null; } @@ -28093,10 +28194,10 @@ oimo_dynamics_World.prototype = { max.zero(); if(_this25.sizeVec3 == _this25.stackVec3.length) { var newArray10 = new Array(_this25.sizeVec3 << 1); - var _g20 = 0; - var _g111 = _this25.sizeVec3; - while(_g20 < _g111) { - var i14 = _g20++; + var _g23 = 0; + var _g114 = _this25.sizeVec3; + while(_g23 < _g114) { + var i14 = _g23++; newArray10[i14] = _this25.stackVec3[i14]; _this25.stackVec3[i14] = null; } @@ -28168,8 +28269,8 @@ oimo_dynamics_World.prototype = { var cc = c._contactConstraint; var ps = c._contactConstraint._manifold._points; var _g3 = 0; - var _g12 = c._contactConstraint._manifold._numPoints; - while(_g3 < _g12) { + var _g4 = c._contactConstraint._manifold._numPoints; + while(_g3 < _g4) { var p = ps[_g3++]; var style1 = d.style; var _this4 = this._pool; @@ -28263,10 +28364,10 @@ oimo_dynamics_World.prototype = { pos1.zero(); if(_this12.sizeVec3 == _this12.stackVec3.length) { var newArray2 = new Array(_this12.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this12.sizeVec3; - while(_g4 < _g13) { - var i2 = _g4++; + var _g5 = 0; + var _g12 = _this12.sizeVec3; + while(_g5 < _g12) { + var i2 = _g5++; newArray2[i2] = _this12.stackVec3[i2]; _this12.stackVec3[i2] = null; } @@ -28279,10 +28380,10 @@ oimo_dynamics_World.prototype = { pos2.zero(); if(_this13.sizeVec3 == _this13.stackVec3.length) { var newArray3 = new Array(_this13.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this13.sizeVec3; - while(_g5 < _g14) { - var i3 = _g5++; + var _g6 = 0; + var _g13 = _this13.sizeVec3; + while(_g6 < _g13) { + var i3 = _g6++; newArray3[i3] = _this13.stackVec3[i3]; _this13.stackVec3[i3] = null; } @@ -28295,10 +28396,10 @@ oimo_dynamics_World.prototype = { normal.zero(); if(_this14.sizeVec3 == _this14.stackVec3.length) { var newArray4 = new Array(_this14.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this14.sizeVec3; - while(_g6 < _g15) { - var i4 = _g6++; + var _g7 = 0; + var _g14 = _this14.sizeVec3; + while(_g7 < _g14) { + var i4 = _g7++; newArray4[i4] = _this14.stackVec3[i4]; _this14.stackVec3[i4] = null; } @@ -28311,10 +28412,10 @@ oimo_dynamics_World.prototype = { tangent.zero(); if(_this15.sizeVec3 == _this15.stackVec3.length) { var newArray5 = new Array(_this15.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this15.sizeVec3; - while(_g7 < _g16) { - var i5 = _g7++; + var _g8 = 0; + var _g15 = _this15.sizeVec3; + while(_g8 < _g15) { + var i5 = _g8++; newArray5[i5] = _this15.stackVec3[i5]; _this15.stackVec3[i5] = null; } @@ -28327,10 +28428,10 @@ oimo_dynamics_World.prototype = { binormal.zero(); if(_this16.sizeVec3 == _this16.stackVec3.length) { var newArray6 = new Array(_this16.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this16.sizeVec3; - while(_g8 < _g17) { - var i6 = _g8++; + var _g9 = 0; + var _g16 = _this16.sizeVec3; + while(_g9 < _g16) { + var i6 = _g9++; newArray6[i6] = _this16.stackVec3[i6]; _this16.stackVec3[i6] = null; } @@ -28346,67 +28447,67 @@ oimo_dynamics_World.prototype = { if(d.drawJoints) { var j = this._jointList; while(j != null) { - var n1 = j._next; - var _this17 = this._pool; - var p1 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - var _this18 = this._pool; - var p2 = _this18.sizeVec3 == 0 ? new oimo_common_Vec3() : _this18.stackVec3[--_this18.sizeVec3]; - var v9 = p1; - v9.x = j._b1._transform._positionX; - v9.y = j._b1._transform._positionY; - v9.z = j._b1._transform._positionZ; - var v10 = p2; - v10.x = j._b2._transform._positionX; - v10.y = j._b2._transform._positionY; - v10.z = j._b2._transform._positionZ; - var _this19 = this._pool; - var anchor1 = _this19.sizeVec3 == 0 ? new oimo_common_Vec3() : _this19.stackVec3[--_this19.sizeVec3]; - var _this20 = this._pool; - var anchor2 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - var _this21 = this._pool; - var basisX1 = _this21.sizeVec3 == 0 ? new oimo_common_Vec3() : _this21.stackVec3[--_this21.sizeVec3]; - var _this22 = this._pool; - var basisY1 = _this22.sizeVec3 == 0 ? new oimo_common_Vec3() : _this22.stackVec3[--_this22.sizeVec3]; - var _this23 = this._pool; - var basisZ1 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - var _this24 = this._pool; - var basisX2 = _this24.sizeVec3 == 0 ? new oimo_common_Vec3() : _this24.stackVec3[--_this24.sizeVec3]; - var _this25 = this._pool; - var basisY2 = _this25.sizeVec3 == 0 ? new oimo_common_Vec3() : _this25.stackVec3[--_this25.sizeVec3]; - var _this26 = this._pool; - var basisZ2 = _this26.sizeVec3 == 0 ? new oimo_common_Vec3() : _this26.stackVec3[--_this26.sizeVec3]; - var v11 = anchor1; - v11.x = j._anchor1X; - v11.y = j._anchor1Y; - v11.z = j._anchor1Z; - var v12 = anchor2; - v12.x = j._anchor2X; - v12.y = j._anchor2Y; - v12.z = j._anchor2Z; - var v13 = basisX1; - v13.x = j._basisX1X; - v13.y = j._basisX1Y; - v13.z = j._basisX1Z; - var v14 = basisY1; - v14.x = j._basisY1X; - v14.y = j._basisY1Y; - v14.z = j._basisY1Z; - var v15 = basisZ1; - v15.x = j._basisZ1X; - v15.y = j._basisZ1Y; - v15.z = j._basisZ1Z; - var v16 = basisX2; - v16.x = j._basisX2X; - v16.y = j._basisX2Y; - v16.z = j._basisX2Z; - var v17 = basisY2; - v17.x = j._basisY2X; - v17.y = j._basisY2Y; - v17.z = j._basisY2Z; - var v18 = basisZ2; - v18.x = j._basisZ2X; - v18.y = j._basisZ2Y; - v18.z = j._basisZ2Z; + var n = j._next; + var _this = this._pool; + var p1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + var _this1 = this._pool; + var p2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + var v = p1; + v.x = j._b1._transform._positionX; + v.y = j._b1._transform._positionY; + v.z = j._b1._transform._positionZ; + var v1 = p2; + v1.x = j._b2._transform._positionX; + v1.y = j._b2._transform._positionY; + v1.z = j._b2._transform._positionZ; + var _this2 = this._pool; + var anchor1 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; + var _this3 = this._pool; + var anchor2 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this4 = this._pool; + var basisX1 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + var _this5 = this._pool; + var basisY1 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; + var _this6 = this._pool; + var basisZ1 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + var _this7 = this._pool; + var basisX2 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + var _this8 = this._pool; + var basisY2 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; + var _this9 = this._pool; + var basisZ2 = _this9.sizeVec3 == 0 ? new oimo_common_Vec3() : _this9.stackVec3[--_this9.sizeVec3]; + var v2 = anchor1; + v2.x = j._anchor1X; + v2.y = j._anchor1Y; + v2.z = j._anchor1Z; + var v3 = anchor2; + v3.x = j._anchor2X; + v3.y = j._anchor2Y; + v3.z = j._anchor2Z; + var v4 = basisX1; + v4.x = j._basisX1X; + v4.y = j._basisX1Y; + v4.z = j._basisX1Z; + var v5 = basisY1; + v5.x = j._basisY1X; + v5.y = j._basisY1Y; + v5.z = j._basisY1Z; + var v6 = basisZ1; + v6.x = j._basisZ1X; + v6.y = j._basisZ1Y; + v6.z = j._basisZ1Z; + var v7 = basisX2; + v7.x = j._basisX2X; + v7.y = j._basisX2Y; + v7.z = j._basisX2Z; + var v8 = basisY2; + v8.x = j._basisY2X; + v8.y = j._basisY2Y; + v8.z = j._basisY2Z; + var v9 = basisZ2; + v9.x = j._basisZ2X; + v9.y = j._basisZ2Y; + v9.z = j._basisZ2Z; d.line(p1,anchor1,d.style.jointLineColor); d.line(p2,anchor2,d.style.jointLineColor); if(d.drawJointLimits) { @@ -28419,11 +28520,11 @@ oimo_dynamics_World.prototype = { break; case 2: var j1 = j; - var color2 = d.style.jointLineColor; + var color = d.style.jointLineColor; var rlm = j1._rotLm; var tlm = j1._translLm; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color2); - this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color2); + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY2,d.style.jointRotationalConstraintRadius,rlm.lowerLimit,rlm.upperLimit,color); + this._drawTranslationalLimit(d,anchor1,basisX1,tlm.lowerLimit,tlm.upperLimit,color); break; case 3: var lm1 = j._lm; @@ -28432,245 +28533,245 @@ oimo_dynamics_World.prototype = { case 4: var j2 = j; var radius = d.style.jointRotationalConstraintRadius; - var color3 = d.style.jointLineColor; + var color1 = d.style.jointLineColor; var lm11 = j2._lm1; var lm2 = j2._lm2; - this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color3); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color3); + this._drawRotationalLimit(d,anchor1,basisY1,basisZ1,basisY1,radius,j2._angleX - lm11.upperLimit,j2._angleX - lm11.lowerLimit,color1); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius,lm2.lowerLimit - j2._angleZ,lm2.upperLimit - j2._angleZ,color1); break; case 5: var j3 = j; var radius1 = d.style.jointRotationalConstraintRadius; - var color4 = d.style.jointLineColor; + var color2 = d.style.jointLineColor; var lm3 = j3._twistLm; - this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color4); - this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color4); - var _this27 = this._pool; - var _this28 = _this27.sizeVec3 == 0 ? new oimo_common_Vec3() : _this27.stackVec3[--_this27.sizeVec3]; - _this28.x = anchor2.x; - _this28.y = anchor2.y; - _this28.z = anchor2.z; - var _this29 = _this28; - _this29.x += basisX2.x * radius1; - _this29.y += basisX2.y * radius1; - _this29.z += basisX2.z * radius1; - d.line(anchor2,_this29,color4); - var _this30 = this._pool; - if(_this29 != null) { - _this29.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newArray7 = new Array(_this30.sizeVec3 << 1); - var _g9 = 0; - var _g18 = _this30.sizeVec3; - while(_g9 < _g18) { - var i7 = _g9++; - newArray7[i7] = _this30.stackVec3[i7]; - _this30.stackVec3[i7] = null; + this._drawRotationalLimit(d,anchor2,basisY2,basisZ2,basisY2,radius1,lm3.lowerLimit - j3._twistAngle,lm3.upperLimit - j3._twistAngle,color2); + this._drawEllipseOnSphere(d,anchor1,basisX1,basisY1,basisZ1,j3._maxSwingAngle1,j3._maxSwingAngle2,radius1,color2); + var _this10 = this._pool; + var _this11 = _this10.sizeVec3 == 0 ? new oimo_common_Vec3() : _this10.stackVec3[--_this10.sizeVec3]; + _this11.x = anchor2.x; + _this11.y = anchor2.y; + _this11.z = anchor2.z; + var _this12 = _this11; + _this12.x += basisX2.x * radius1; + _this12.y += basisX2.y * radius1; + _this12.z += basisX2.z * radius1; + d.line(anchor2,_this12,color2); + var _this13 = this._pool; + if(_this12 != null) { + _this12.zero(); + if(_this13.sizeVec3 == _this13.stackVec3.length) { + var newArray = new Array(_this13.sizeVec3 << 1); + var _g = 0; + var _g1 = _this13.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this13.stackVec3[i]; + _this13.stackVec3[i] = null; } - _this30.stackVec3 = newArray7; + _this13.stackVec3 = newArray; } - _this30.stackVec3[_this30.sizeVec3++] = _this29; + _this13.stackVec3[_this13.sizeVec3++] = _this12; } break; case 6: var j4 = j; var radius2 = d.style.jointRotationalConstraintRadius; - var color5 = d.style.jointLineColor; + var color3 = d.style.jointLineColor; var rxlm = j4._rotLms[0]; var rylm = j4._rotLms[1]; var rzlm = j4._rotLms[2]; - this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color5); - var _this31 = this._pool; - var rotYAxis = _this31.sizeVec3 == 0 ? new oimo_common_Vec3() : _this31.stackVec3[--_this31.sizeVec3]; - var v19 = rotYAxis; - v19.x = j4._axisYX; - v19.y = j4._axisYY; - v19.z = j4._axisYZ; - var _this32 = this._pool; - var _this33 = _this32.sizeVec3 == 0 ? new oimo_common_Vec3() : _this32.stackVec3[--_this32.sizeVec3]; - _this33.x = basisX1.x; - _this33.y = basisX1.y; - _this33.z = basisX1.z; - var rotYBasisX = _this33; - var _this34 = this._pool; - var _this35 = _this34.sizeVec3 == 0 ? new oimo_common_Vec3() : _this34.stackVec3[--_this34.sizeVec3]; - _this35.x = basisX1.x; - _this35.y = basisX1.y; - _this35.z = basisX1.z; - var _this36 = _this35; - var y = _this36.z * rotYAxis.x - _this36.x * rotYAxis.z; - var z = _this36.x * rotYAxis.y - _this36.y * rotYAxis.x; - _this36.x = _this36.y * rotYAxis.z - _this36.z * rotYAxis.y; - _this36.y = y; - _this36.z = z; - this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color5); - this._drawRotationalLimit(d,anchor2,rotYBasisX,_this36,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color5); - this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color5); + this._drawTranslationalLimit3D(d,anchor1,basisX1,basisY1,basisZ1,j4._translLms[0],j4._translLms[1],j4._translLms[2],color3); + var _this14 = this._pool; + var rotYAxis = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; + var v10 = rotYAxis; + v10.x = j4._axisYX; + v10.y = j4._axisYY; + v10.z = j4._axisYZ; + var _this15 = this._pool; + var _this16 = _this15.sizeVec3 == 0 ? new oimo_common_Vec3() : _this15.stackVec3[--_this15.sizeVec3]; + _this16.x = basisX1.x; + _this16.y = basisX1.y; + _this16.z = basisX1.z; + var rotYBasisX = _this16; + var _this17 = this._pool; + var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; + _this18.x = basisX1.x; + _this18.y = basisX1.y; + _this18.z = basisX1.z; + var _this19 = _this18; + var y = _this19.z * rotYAxis.x - _this19.x * rotYAxis.z; + var z = _this19.x * rotYAxis.y - _this19.y * rotYAxis.x; + _this19.x = _this19.y * rotYAxis.z - _this19.z * rotYAxis.y; + _this19.y = y; + _this19.z = z; + this._drawRotationalLimit(d,anchor2,basisY1,basisZ1,basisY1,radius2,j4._angleX - rxlm.upperLimit,j4._angleX - rxlm.lowerLimit,color3); + this._drawRotationalLimit(d,anchor2,rotYBasisX,_this19,rotYBasisX,radius2,rylm.lowerLimit - j4._angleY,rylm.upperLimit - j4._angleY,color3); + this._drawRotationalLimit(d,anchor2,basisX2,basisY2,basisX2,radius2,rzlm.lowerLimit - j4._angleZ,rzlm.upperLimit - j4._angleZ,color3); break; } } d.line(anchor1,anchor2,d.style.jointErrorColor); - var _this37 = this._pool; + var _this20 = this._pool; if(p1 != null) { p1.zero(); - if(_this37.sizeVec3 == _this37.stackVec3.length) { - var newArray8 = new Array(_this37.sizeVec3 << 1); - var _g10 = 0; - var _g19 = _this37.sizeVec3; - while(_g10 < _g19) { - var i8 = _g10++; - newArray8[i8] = _this37.stackVec3[i8]; - _this37.stackVec3[i8] = null; + if(_this20.sizeVec3 == _this20.stackVec3.length) { + var newArray1 = new Array(_this20.sizeVec3 << 1); + var _g2 = 0; + var _g11 = _this20.sizeVec3; + while(_g2 < _g11) { + var i1 = _g2++; + newArray1[i1] = _this20.stackVec3[i1]; + _this20.stackVec3[i1] = null; } - _this37.stackVec3 = newArray8; + _this20.stackVec3 = newArray1; } - _this37.stackVec3[_this37.sizeVec3++] = p1; + _this20.stackVec3[_this20.sizeVec3++] = p1; } - var _this38 = this._pool; + var _this21 = this._pool; if(p2 != null) { p2.zero(); - if(_this38.sizeVec3 == _this38.stackVec3.length) { - var newArray9 = new Array(_this38.sizeVec3 << 1); - var _g20 = 0; - var _g110 = _this38.sizeVec3; - while(_g20 < _g110) { - var i9 = _g20++; - newArray9[i9] = _this38.stackVec3[i9]; - _this38.stackVec3[i9] = null; + if(_this21.sizeVec3 == _this21.stackVec3.length) { + var newArray2 = new Array(_this21.sizeVec3 << 1); + var _g3 = 0; + var _g12 = _this21.sizeVec3; + while(_g3 < _g12) { + var i2 = _g3++; + newArray2[i2] = _this21.stackVec3[i2]; + _this21.stackVec3[i2] = null; } - _this38.stackVec3 = newArray9; + _this21.stackVec3 = newArray2; } - _this38.stackVec3[_this38.sizeVec3++] = p2; + _this21.stackVec3[_this21.sizeVec3++] = p2; } - var _this39 = this._pool; + var _this22 = this._pool; if(anchor1 != null) { anchor1.zero(); - if(_this39.sizeVec3 == _this39.stackVec3.length) { - var newArray10 = new Array(_this39.sizeVec3 << 1); - var _g21 = 0; - var _g111 = _this39.sizeVec3; - while(_g21 < _g111) { - var i10 = _g21++; - newArray10[i10] = _this39.stackVec3[i10]; - _this39.stackVec3[i10] = null; + if(_this22.sizeVec3 == _this22.stackVec3.length) { + var newArray3 = new Array(_this22.sizeVec3 << 1); + var _g4 = 0; + var _g13 = _this22.sizeVec3; + while(_g4 < _g13) { + var i3 = _g4++; + newArray3[i3] = _this22.stackVec3[i3]; + _this22.stackVec3[i3] = null; } - _this39.stackVec3 = newArray10; + _this22.stackVec3 = newArray3; } - _this39.stackVec3[_this39.sizeVec3++] = anchor1; + _this22.stackVec3[_this22.sizeVec3++] = anchor1; } - var _this40 = this._pool; + var _this23 = this._pool; if(anchor2 != null) { anchor2.zero(); - if(_this40.sizeVec3 == _this40.stackVec3.length) { - var newArray11 = new Array(_this40.sizeVec3 << 1); - var _g22 = 0; - var _g112 = _this40.sizeVec3; - while(_g22 < _g112) { - var i11 = _g22++; - newArray11[i11] = _this40.stackVec3[i11]; - _this40.stackVec3[i11] = null; + if(_this23.sizeVec3 == _this23.stackVec3.length) { + var newArray4 = new Array(_this23.sizeVec3 << 1); + var _g5 = 0; + var _g14 = _this23.sizeVec3; + while(_g5 < _g14) { + var i4 = _g5++; + newArray4[i4] = _this23.stackVec3[i4]; + _this23.stackVec3[i4] = null; } - _this40.stackVec3 = newArray11; + _this23.stackVec3 = newArray4; } - _this40.stackVec3[_this40.sizeVec3++] = anchor2; + _this23.stackVec3[_this23.sizeVec3++] = anchor2; } - var _this41 = this._pool; + var _this24 = this._pool; if(basisX1 != null) { basisX1.zero(); - if(_this41.sizeVec3 == _this41.stackVec3.length) { - var newArray12 = new Array(_this41.sizeVec3 << 1); - var _g23 = 0; - var _g113 = _this41.sizeVec3; - while(_g23 < _g113) { - var i12 = _g23++; - newArray12[i12] = _this41.stackVec3[i12]; - _this41.stackVec3[i12] = null; + if(_this24.sizeVec3 == _this24.stackVec3.length) { + var newArray5 = new Array(_this24.sizeVec3 << 1); + var _g6 = 0; + var _g15 = _this24.sizeVec3; + while(_g6 < _g15) { + var i5 = _g6++; + newArray5[i5] = _this24.stackVec3[i5]; + _this24.stackVec3[i5] = null; } - _this41.stackVec3 = newArray12; + _this24.stackVec3 = newArray5; } - _this41.stackVec3[_this41.sizeVec3++] = basisX1; + _this24.stackVec3[_this24.sizeVec3++] = basisX1; } - var _this42 = this._pool; + var _this25 = this._pool; if(basisY1 != null) { basisY1.zero(); - if(_this42.sizeVec3 == _this42.stackVec3.length) { - var newArray13 = new Array(_this42.sizeVec3 << 1); - var _g24 = 0; - var _g114 = _this42.sizeVec3; - while(_g24 < _g114) { - var i13 = _g24++; - newArray13[i13] = _this42.stackVec3[i13]; - _this42.stackVec3[i13] = null; + if(_this25.sizeVec3 == _this25.stackVec3.length) { + var newArray6 = new Array(_this25.sizeVec3 << 1); + var _g7 = 0; + var _g16 = _this25.sizeVec3; + while(_g7 < _g16) { + var i6 = _g7++; + newArray6[i6] = _this25.stackVec3[i6]; + _this25.stackVec3[i6] = null; } - _this42.stackVec3 = newArray13; + _this25.stackVec3 = newArray6; } - _this42.stackVec3[_this42.sizeVec3++] = basisY1; + _this25.stackVec3[_this25.sizeVec3++] = basisY1; } - var _this43 = this._pool; + var _this26 = this._pool; if(basisZ1 != null) { basisZ1.zero(); - if(_this43.sizeVec3 == _this43.stackVec3.length) { - var newArray14 = new Array(_this43.sizeVec3 << 1); - var _g25 = 0; - var _g115 = _this43.sizeVec3; - while(_g25 < _g115) { - var i14 = _g25++; - newArray14[i14] = _this43.stackVec3[i14]; - _this43.stackVec3[i14] = null; + if(_this26.sizeVec3 == _this26.stackVec3.length) { + var newArray7 = new Array(_this26.sizeVec3 << 1); + var _g8 = 0; + var _g17 = _this26.sizeVec3; + while(_g8 < _g17) { + var i7 = _g8++; + newArray7[i7] = _this26.stackVec3[i7]; + _this26.stackVec3[i7] = null; } - _this43.stackVec3 = newArray14; + _this26.stackVec3 = newArray7; } - _this43.stackVec3[_this43.sizeVec3++] = basisZ1; + _this26.stackVec3[_this26.sizeVec3++] = basisZ1; } - var _this44 = this._pool; + var _this27 = this._pool; if(basisX2 != null) { basisX2.zero(); - if(_this44.sizeVec3 == _this44.stackVec3.length) { - var newArray15 = new Array(_this44.sizeVec3 << 1); - var _g26 = 0; - var _g116 = _this44.sizeVec3; - while(_g26 < _g116) { - var i15 = _g26++; - newArray15[i15] = _this44.stackVec3[i15]; - _this44.stackVec3[i15] = null; + if(_this27.sizeVec3 == _this27.stackVec3.length) { + var newArray8 = new Array(_this27.sizeVec3 << 1); + var _g9 = 0; + var _g18 = _this27.sizeVec3; + while(_g9 < _g18) { + var i8 = _g9++; + newArray8[i8] = _this27.stackVec3[i8]; + _this27.stackVec3[i8] = null; } - _this44.stackVec3 = newArray15; + _this27.stackVec3 = newArray8; } - _this44.stackVec3[_this44.sizeVec3++] = basisX2; + _this27.stackVec3[_this27.sizeVec3++] = basisX2; } - var _this45 = this._pool; + var _this28 = this._pool; if(basisY2 != null) { basisY2.zero(); - if(_this45.sizeVec3 == _this45.stackVec3.length) { - var newArray16 = new Array(_this45.sizeVec3 << 1); - var _g27 = 0; - var _g117 = _this45.sizeVec3; - while(_g27 < _g117) { - var i16 = _g27++; - newArray16[i16] = _this45.stackVec3[i16]; - _this45.stackVec3[i16] = null; + if(_this28.sizeVec3 == _this28.stackVec3.length) { + var newArray9 = new Array(_this28.sizeVec3 << 1); + var _g10 = 0; + var _g19 = _this28.sizeVec3; + while(_g10 < _g19) { + var i9 = _g10++; + newArray9[i9] = _this28.stackVec3[i9]; + _this28.stackVec3[i9] = null; } - _this45.stackVec3 = newArray16; + _this28.stackVec3 = newArray9; } - _this45.stackVec3[_this45.sizeVec3++] = basisY2; + _this28.stackVec3[_this28.sizeVec3++] = basisY2; } - var _this46 = this._pool; + var _this29 = this._pool; if(basisZ2 != null) { basisZ2.zero(); - if(_this46.sizeVec3 == _this46.stackVec3.length) { - var newArray17 = new Array(_this46.sizeVec3 << 1); - var _g28 = 0; - var _g118 = _this46.sizeVec3; - while(_g28 < _g118) { - var i17 = _g28++; - newArray17[i17] = _this46.stackVec3[i17]; - _this46.stackVec3[i17] = null; + if(_this29.sizeVec3 == _this29.stackVec3.length) { + var newArray10 = new Array(_this29.sizeVec3 << 1); + var _g20 = 0; + var _g110 = _this29.sizeVec3; + while(_g20 < _g110) { + var i10 = _g20++; + newArray10[i10] = _this29.stackVec3[i10]; + _this29.stackVec3[i10] = null; } - _this46.stackVec3 = newArray17; + _this29.stackVec3 = newArray10; } - _this46.stackVec3[_this46.sizeVec3++] = basisZ2; + _this29.stackVec3[_this29.sizeVec3++] = basisZ2; } - j = n1; + j = n; } } } @@ -28681,26 +28782,26 @@ oimo_dynamics_World.prototype = { _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; - _this2.x += needle.x * radius; - _this2.y += needle.y * radius; - _this2.z += needle.z * radius; - d.line(center,_this2,color); - var _this3 = this._pool; - if(_this2 != null) { - _this2.zero(); - if(_this3.sizeVec3 == _this3.stackVec3.length) { - var newArray = new Array(_this3.sizeVec3 << 1); + var _this = _this1; + _this.x += needle.x * radius; + _this.y += needle.y * radius; + _this.z += needle.z * radius; + d.line(center,_this,color); + var _this1 = this._pool; + if(_this != null) { + _this.zero(); + if(_this1.sizeVec3 == _this1.stackVec3.length) { + var newArray = new Array(_this1.sizeVec3 << 1); var _g = 0; - var _g1 = _this3.sizeVec3; + var _g1 = _this1.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this3.stackVec3[i]; - _this3.stackVec3[i] = null; + newArray[i] = _this1.stackVec3[i]; + _this1.stackVec3[i] = null; } - _this3.stackVec3 = newArray; + _this1.stackVec3 = newArray; } - _this3.stackVec3[_this3.sizeVec3++] = _this2; + _this1.stackVec3[_this1.sizeVec3++] = _this; } if(min > max) { d.ellipse(center,ex,ey,radius,radius,color); @@ -28716,51 +28817,51 @@ oimo_dynamics_World.prototype = { _this1.x = center.x; _this1.y = center.y; _this1.z = center.z; - var _this2 = _this1; - _this2.x += ex.x * min; - _this2.y += ex.y * min; - _this2.z += ex.z * min; - var _this3 = this._pool; - var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; - _this4.x = center.x; - _this4.y = center.y; - _this4.z = center.z; - var _this5 = _this4; - _this5.x += ex.x * max; - _this5.y += ex.y * max; - _this5.z += ex.z * max; - d.line(_this2,_this5,color); - var _this6 = this._pool; - if(_this2 != null) { - _this2.zero(); - if(_this6.sizeVec3 == _this6.stackVec3.length) { - var newArray = new Array(_this6.sizeVec3 << 1); + var _this = _this1; + _this.x += ex.x * min; + _this.y += ex.y * min; + _this.z += ex.z * min; + var _this1 = this._pool; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = center.x; + _this2.y = center.y; + _this2.z = center.z; + var _this1 = _this2; + _this1.x += ex.x * max; + _this1.y += ex.y * max; + _this1.z += ex.z * max; + d.line(_this,_this1,color); + var _this2 = this._pool; + if(_this != null) { + _this.zero(); + if(_this2.sizeVec3 == _this2.stackVec3.length) { + var newArray = new Array(_this2.sizeVec3 << 1); var _g = 0; - var _g1 = _this6.sizeVec3; + var _g1 = _this2.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this6.stackVec3[i]; - _this6.stackVec3[i] = null; + newArray[i] = _this2.stackVec3[i]; + _this2.stackVec3[i] = null; } - _this6.stackVec3 = newArray; + _this2.stackVec3 = newArray; } - _this6.stackVec3[_this6.sizeVec3++] = _this2; + _this2.stackVec3[_this2.sizeVec3++] = _this; } - var _this7 = this._pool; - if(_this5 != null) { - _this5.zero(); - if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newArray1 = new Array(_this7.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this7.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this7.stackVec3[i1]; - _this7.stackVec3[i1] = null; + var _this = this._pool; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this7.stackVec3 = newArray1; + _this.stackVec3 = newArray; } - _this7.stackVec3[_this7.sizeVec3++] = _this5; + _this.stackVec3[_this.sizeVec3++] = _this1; } } } @@ -28777,21 +28878,81 @@ oimo_dynamics_World.prototype = { } else { --_this.sizeVec3; } - var _this1 = this._pool; - if(_this1.sizeVec3 == 0) { + var _this = this._pool; + if(_this.sizeVec3 == 0) { new oimo_common_Vec3(); } else { - --_this1.sizeVec3; + --_this.sizeVec3; } + var _this = this._pool; + var _this1 = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; + _this1.x = center.x; + _this1.y = center.y; + _this1.z = center.z; + var _this = _this1; + _this.x += ex.x * minx; + _this.y += ex.y * minx; + _this.z += ex.z * minx; + _this.x += ey.x * miny; + _this.y += ey.y * miny; + _this.z += ey.z * miny; + _this.x += ez.x * minz; + _this.y += ez.y * minz; + _this.z += ez.z * minz; + var _this1 = this._pool; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x = center.x; + _this2.y = center.y; + _this2.z = center.z; + var _this1 = _this2; + _this1.x += ex.x * minx; + _this1.y += ex.y * minx; + _this1.z += ex.z * minx; + _this1.x += ey.x * miny; + _this1.y += ey.y * miny; + _this1.z += ey.z * miny; + _this1.x += ez.x * maxz; + _this1.y += ez.y * maxz; + _this1.z += ez.z * maxz; var _this2 = this._pool; var _this3 = _this2.sizeVec3 == 0 ? new oimo_common_Vec3() : _this2.stackVec3[--_this2.sizeVec3]; _this3.x = center.x; _this3.y = center.y; _this3.z = center.z; - var _this4 = _this3; - _this4.x += ex.x * minx; - _this4.y += ex.y * minx; - _this4.z += ex.z * minx; + var _this2 = _this3; + _this2.x += ex.x * minx; + _this2.y += ex.y * minx; + _this2.z += ex.z * minx; + _this2.x += ey.x * maxy; + _this2.y += ey.y * maxy; + _this2.z += ey.z * maxy; + _this2.x += ez.x * minz; + _this2.y += ez.y * minz; + _this2.z += ez.z * minz; + var _this3 = this._pool; + var _this4 = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + _this4.x = center.x; + _this4.y = center.y; + _this4.z = center.z; + var _this3 = _this4; + _this3.x += ex.x * minx; + _this3.y += ex.y * minx; + _this3.z += ex.z * minx; + _this3.x += ey.x * maxy; + _this3.y += ey.y * maxy; + _this3.z += ey.z * maxy; + _this3.x += ez.x * maxz; + _this3.y += ez.y * maxz; + _this3.z += ez.z * maxz; + var _this4 = this._pool; + var _this5 = _this4.sizeVec3 == 0 ? new oimo_common_Vec3() : _this4.stackVec3[--_this4.sizeVec3]; + _this5.x = center.x; + _this5.y = center.y; + _this5.z = center.z; + var _this4 = _this5; + _this4.x += ex.x * maxx; + _this4.y += ex.y * maxx; + _this4.z += ex.z * maxx; _this4.x += ey.x * miny; _this4.y += ey.y * miny; _this4.z += ey.z * miny; @@ -28803,257 +28964,197 @@ oimo_dynamics_World.prototype = { _this6.x = center.x; _this6.y = center.y; _this6.z = center.z; - var _this7 = _this6; - _this7.x += ex.x * minx; - _this7.y += ex.y * minx; - _this7.z += ex.z * minx; - _this7.x += ey.x * miny; - _this7.y += ey.y * miny; - _this7.z += ey.z * miny; + var _this5 = _this6; + _this5.x += ex.x * maxx; + _this5.y += ex.y * maxx; + _this5.z += ex.z * maxx; + _this5.x += ey.x * miny; + _this5.y += ey.y * miny; + _this5.z += ey.z * miny; + _this5.x += ez.x * maxz; + _this5.y += ez.y * maxz; + _this5.z += ez.z * maxz; + var _this6 = this._pool; + var _this7 = _this6.sizeVec3 == 0 ? new oimo_common_Vec3() : _this6.stackVec3[--_this6.sizeVec3]; + _this7.x = center.x; + _this7.y = center.y; + _this7.z = center.z; + var _this6 = _this7; + _this6.x += ex.x * maxx; + _this6.y += ex.y * maxx; + _this6.z += ex.z * maxx; + _this6.x += ey.x * maxy; + _this6.y += ey.y * maxy; + _this6.z += ey.z * maxy; + _this6.x += ez.x * minz; + _this6.y += ez.y * minz; + _this6.z += ez.z * minz; + var _this7 = this._pool; + var _this8 = _this7.sizeVec3 == 0 ? new oimo_common_Vec3() : _this7.stackVec3[--_this7.sizeVec3]; + _this8.x = center.x; + _this8.y = center.y; + _this8.z = center.z; + var _this7 = _this8; + _this7.x += ex.x * maxx; + _this7.y += ex.y * maxx; + _this7.z += ex.z * maxx; + _this7.x += ey.x * maxy; + _this7.y += ey.y * maxy; + _this7.z += ey.z * maxy; _this7.x += ez.x * maxz; _this7.y += ez.y * maxz; _this7.z += ez.z * maxz; + d.line(_this,_this4,color); + d.line(_this2,_this6,color); + d.line(_this1,_this5,color); + d.line(_this3,_this7,color); + d.line(_this,_this2,color); + d.line(_this4,_this6,color); + d.line(_this1,_this3,color); + d.line(_this5,_this7,color); + d.line(_this,_this1,color); + d.line(_this4,_this5,color); + d.line(_this2,_this3,color); + d.line(_this6,_this7,color); var _this8 = this._pool; - var _this9 = _this8.sizeVec3 == 0 ? new oimo_common_Vec3() : _this8.stackVec3[--_this8.sizeVec3]; - _this9.x = center.x; - _this9.y = center.y; - _this9.z = center.z; - var _this10 = _this9; - _this10.x += ex.x * minx; - _this10.y += ex.y * minx; - _this10.z += ex.z * minx; - _this10.x += ey.x * maxy; - _this10.y += ey.y * maxy; - _this10.z += ey.z * maxy; - _this10.x += ez.x * minz; - _this10.y += ez.y * minz; - _this10.z += ez.z * minz; - var _this11 = this._pool; - var _this12 = _this11.sizeVec3 == 0 ? new oimo_common_Vec3() : _this11.stackVec3[--_this11.sizeVec3]; - _this12.x = center.x; - _this12.y = center.y; - _this12.z = center.z; - var _this13 = _this12; - _this13.x += ex.x * minx; - _this13.y += ex.y * minx; - _this13.z += ex.z * minx; - _this13.x += ey.x * maxy; - _this13.y += ey.y * maxy; - _this13.z += ey.z * maxy; - _this13.x += ez.x * maxz; - _this13.y += ez.y * maxz; - _this13.z += ez.z * maxz; - var _this14 = this._pool; - var _this15 = _this14.sizeVec3 == 0 ? new oimo_common_Vec3() : _this14.stackVec3[--_this14.sizeVec3]; - _this15.x = center.x; - _this15.y = center.y; - _this15.z = center.z; - var _this16 = _this15; - _this16.x += ex.x * maxx; - _this16.y += ex.y * maxx; - _this16.z += ex.z * maxx; - _this16.x += ey.x * miny; - _this16.y += ey.y * miny; - _this16.z += ey.z * miny; - _this16.x += ez.x * minz; - _this16.y += ez.y * minz; - _this16.z += ez.z * minz; - var _this17 = this._pool; - var _this18 = _this17.sizeVec3 == 0 ? new oimo_common_Vec3() : _this17.stackVec3[--_this17.sizeVec3]; - _this18.x = center.x; - _this18.y = center.y; - _this18.z = center.z; - var _this19 = _this18; - _this19.x += ex.x * maxx; - _this19.y += ex.y * maxx; - _this19.z += ex.z * maxx; - _this19.x += ey.x * miny; - _this19.y += ey.y * miny; - _this19.z += ey.z * miny; - _this19.x += ez.x * maxz; - _this19.y += ez.y * maxz; - _this19.z += ez.z * maxz; - var _this20 = this._pool; - var _this21 = _this20.sizeVec3 == 0 ? new oimo_common_Vec3() : _this20.stackVec3[--_this20.sizeVec3]; - _this21.x = center.x; - _this21.y = center.y; - _this21.z = center.z; - var _this22 = _this21; - _this22.x += ex.x * maxx; - _this22.y += ex.y * maxx; - _this22.z += ex.z * maxx; - _this22.x += ey.x * maxy; - _this22.y += ey.y * maxy; - _this22.z += ey.z * maxy; - _this22.x += ez.x * minz; - _this22.y += ez.y * minz; - _this22.z += ez.z * minz; - var _this23 = this._pool; - var _this24 = _this23.sizeVec3 == 0 ? new oimo_common_Vec3() : _this23.stackVec3[--_this23.sizeVec3]; - _this24.x = center.x; - _this24.y = center.y; - _this24.z = center.z; - var _this25 = _this24; - _this25.x += ex.x * maxx; - _this25.y += ex.y * maxx; - _this25.z += ex.z * maxx; - _this25.x += ey.x * maxy; - _this25.y += ey.y * maxy; - _this25.z += ey.z * maxy; - _this25.x += ez.x * maxz; - _this25.y += ez.y * maxz; - _this25.z += ez.z * maxz; - d.line(_this4,_this16,color); - d.line(_this10,_this22,color); - d.line(_this7,_this19,color); - d.line(_this13,_this25,color); - d.line(_this4,_this10,color); - d.line(_this16,_this22,color); - d.line(_this7,_this13,color); - d.line(_this19,_this25,color); - d.line(_this4,_this7,color); - d.line(_this16,_this19,color); - d.line(_this10,_this13,color); - d.line(_this22,_this25,color); - var _this26 = this._pool; + if(_this != null) { + _this.zero(); + if(_this8.sizeVec3 == _this8.stackVec3.length) { + var newArray = new Array(_this8.sizeVec3 << 1); + var _g = 0; + var _g1 = _this8.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this8.stackVec3[i]; + _this8.stackVec3[i] = null; + } + _this8.stackVec3 = newArray; + } + _this8.stackVec3[_this8.sizeVec3++] = _this; + } + var _this = this._pool; + if(_this1 != null) { + _this1.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this1; + } + var _this = this._pool; + if(_this2 != null) { + _this2.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this2; + } + var _this = this._pool; + if(_this3 != null) { + _this3.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this3; + } + var _this = this._pool; if(_this4 != null) { _this4.zero(); - if(_this26.sizeVec3 == _this26.stackVec3.length) { - var newArray = new Array(_this26.sizeVec3 << 1); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this4; + } + var _this = this._pool; + if(_this5 != null) { + _this5.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; + } + _this.stackVec3 = newArray; + } + _this.stackVec3[_this.sizeVec3++] = _this5; + } + var _this = this._pool; + if(_this6 != null) { + _this6.zero(); + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); var _g = 0; - var _g1 = _this26.sizeVec3; + var _g1 = _this.sizeVec3; while(_g < _g1) { var i = _g++; - newArray[i] = _this26.stackVec3[i]; - _this26.stackVec3[i] = null; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this26.stackVec3 = newArray; + _this.stackVec3 = newArray; } - _this26.stackVec3[_this26.sizeVec3++] = _this4; + _this.stackVec3[_this.sizeVec3++] = _this6; } - var _this27 = this._pool; + var _this = this._pool; if(_this7 != null) { _this7.zero(); - if(_this27.sizeVec3 == _this27.stackVec3.length) { - var newArray1 = new Array(_this27.sizeVec3 << 1); - var _g2 = 0; - var _g11 = _this27.sizeVec3; - while(_g2 < _g11) { - var i1 = _g2++; - newArray1[i1] = _this27.stackVec3[i1]; - _this27.stackVec3[i1] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this27.stackVec3 = newArray1; + _this.stackVec3 = newArray; } - _this27.stackVec3[_this27.sizeVec3++] = _this7; - } - var _this28 = this._pool; - if(_this10 != null) { - _this10.zero(); - if(_this28.sizeVec3 == _this28.stackVec3.length) { - var newArray2 = new Array(_this28.sizeVec3 << 1); - var _g3 = 0; - var _g12 = _this28.sizeVec3; - while(_g3 < _g12) { - var i2 = _g3++; - newArray2[i2] = _this28.stackVec3[i2]; - _this28.stackVec3[i2] = null; - } - _this28.stackVec3 = newArray2; - } - _this28.stackVec3[_this28.sizeVec3++] = _this10; - } - var _this29 = this._pool; - if(_this13 != null) { - _this13.zero(); - if(_this29.sizeVec3 == _this29.stackVec3.length) { - var newArray3 = new Array(_this29.sizeVec3 << 1); - var _g4 = 0; - var _g13 = _this29.sizeVec3; - while(_g4 < _g13) { - var i3 = _g4++; - newArray3[i3] = _this29.stackVec3[i3]; - _this29.stackVec3[i3] = null; - } - _this29.stackVec3 = newArray3; - } - _this29.stackVec3[_this29.sizeVec3++] = _this13; - } - var _this30 = this._pool; - if(_this16 != null) { - _this16.zero(); - if(_this30.sizeVec3 == _this30.stackVec3.length) { - var newArray4 = new Array(_this30.sizeVec3 << 1); - var _g5 = 0; - var _g14 = _this30.sizeVec3; - while(_g5 < _g14) { - var i4 = _g5++; - newArray4[i4] = _this30.stackVec3[i4]; - _this30.stackVec3[i4] = null; - } - _this30.stackVec3 = newArray4; - } - _this30.stackVec3[_this30.sizeVec3++] = _this16; - } - var _this31 = this._pool; - if(_this19 != null) { - _this19.zero(); - if(_this31.sizeVec3 == _this31.stackVec3.length) { - var newArray5 = new Array(_this31.sizeVec3 << 1); - var _g6 = 0; - var _g15 = _this31.sizeVec3; - while(_g6 < _g15) { - var i5 = _g6++; - newArray5[i5] = _this31.stackVec3[i5]; - _this31.stackVec3[i5] = null; - } - _this31.stackVec3 = newArray5; - } - _this31.stackVec3[_this31.sizeVec3++] = _this19; - } - var _this32 = this._pool; - if(_this22 != null) { - _this22.zero(); - if(_this32.sizeVec3 == _this32.stackVec3.length) { - var newArray6 = new Array(_this32.sizeVec3 << 1); - var _g7 = 0; - var _g16 = _this32.sizeVec3; - while(_g7 < _g16) { - var i6 = _g7++; - newArray6[i6] = _this32.stackVec3[i6]; - _this32.stackVec3[i6] = null; - } - _this32.stackVec3 = newArray6; - } - _this32.stackVec3[_this32.sizeVec3++] = _this22; - } - var _this33 = this._pool; - if(_this25 != null) { - _this25.zero(); - if(_this33.sizeVec3 == _this33.stackVec3.length) { - var newArray7 = new Array(_this33.sizeVec3 << 1); - var _g8 = 0; - var _g17 = _this33.sizeVec3; - while(_g8 < _g17) { - var i7 = _g8++; - newArray7[i7] = _this33.stackVec3[i7]; - _this33.stackVec3[i7] = null; - } - _this33.stackVec3 = newArray7; - } - _this33.stackVec3[_this33.sizeVec3++] = _this25; + _this.stackVec3[_this.sizeVec3++] = _this7; } } ,_drawEllipseOnSphere: function(d,center,normal,x,y,radiansX,radiansY,radius,color) { var theta = 0; var _this = this._pool; var rotVec = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; - var _this1 = this._pool; - var rotQ = _this1.sizeQuat == 0 ? new oimo_common_Quat() : _this1.stackQuat[--_this1.sizeQuat]; - var _this2 = this._pool; - var rotM = _this2.sizeMat3 == 0 ? new oimo_common_Mat3() : _this2.stackMat3[--_this2.sizeMat3]; - var _this3 = this._pool; - var prevV = _this3.sizeVec3 == 0 ? new oimo_common_Vec3() : _this3.stackVec3[--_this3.sizeVec3]; + var _this = this._pool; + var rotQ = _this.sizeQuat == 0 ? new oimo_common_Quat() : _this.stackQuat[--_this.sizeQuat]; + var _this = this._pool; + var rotM = _this.sizeMat3 == 0 ? new oimo_common_Mat3() : _this.stackMat3[--_this.sizeMat3]; + var _this = this._pool; + var prevV = _this.sizeVec3 == 0 ? new oimo_common_Vec3() : _this.stackVec3[--_this.sizeVec3]; var _g = 0; while(_g < 17) { var i = _g++; @@ -29062,13 +29163,13 @@ oimo_dynamics_World.prototype = { var halfRotAng = Math.sqrt(rx * rx + ry * ry); var rotSin = Math.sin(halfRotAng * 0.5); var rotCos = Math.cos(halfRotAng * 0.5); - var _this4 = rotVec.zero(); - _this4.x += x.x * rx; - _this4.y += x.y * rx; - _this4.z += x.z * rx; - _this4.x += y.x * ry; - _this4.y += y.y * ry; - _this4.z += y.z * ry; + var _this = rotVec.zero(); + _this.x += x.x * rx; + _this.y += x.y * rx; + _this.z += x.z * rx; + _this.x += y.x * ry; + _this.y += y.y * ry; + _this.z += y.z * ry; var s = 1 / halfRotAng * rotSin; rotVec.x *= s; rotVec.y *= s; @@ -29102,12 +29203,12 @@ oimo_dynamics_World.prototype = { rotM.e20 = xz - wy; rotM.e21 = yz + wx; rotM.e22 = 1 - xx - yy; - var _this5 = this._pool; - var _this6 = _this5.sizeVec3 == 0 ? new oimo_common_Vec3() : _this5.stackVec3[--_this5.sizeVec3]; - _this6.x += normal.x * radius; - _this6.y += normal.y * radius; - _this6.z += normal.z * radius; - var v = _this6; + var _this1 = this._pool; + var _this2 = _this1.sizeVec3 == 0 ? new oimo_common_Vec3() : _this1.stackVec3[--_this1.sizeVec3]; + _this2.x += normal.x * radius; + _this2.y += normal.y * radius; + _this2.z += normal.z * radius; + var v = _this2; var y3 = v.x * rotM.e10 + v.y * rotM.e11 + v.z * rotM.e12; var z1 = v.x * rotM.e20 + v.y * rotM.e21 + v.z * rotM.e22; v.x = v.x * rotM.e00 + v.y * rotM.e01 + v.z * rotM.e02; @@ -29119,61 +29220,61 @@ oimo_dynamics_World.prototype = { if(i >= 1) { d.line(prevV,v,color); } - var _this7 = this._pool; + var _this3 = this._pool; if(prevV != null) { prevV.zero(); - if(_this7.sizeVec3 == _this7.stackVec3.length) { - var newArray = new Array(_this7.sizeVec3 << 1); + if(_this3.sizeVec3 == _this3.stackVec3.length) { + var newArray = new Array(_this3.sizeVec3 << 1); var _g1 = 0; - var _g11 = _this7.sizeVec3; + var _g11 = _this3.sizeVec3; while(_g1 < _g11) { var i1 = _g1++; - newArray[i1] = _this7.stackVec3[i1]; - _this7.stackVec3[i1] = null; + newArray[i1] = _this3.stackVec3[i1]; + _this3.stackVec3[i1] = null; } - _this7.stackVec3 = newArray; + _this3.stackVec3 = newArray; } - _this7.stackVec3[_this7.sizeVec3++] = prevV; + _this3.stackVec3[_this3.sizeVec3++] = prevV; } prevV = v; theta += 0.39269908169872375; } - var _this8 = this._pool; + var _this = this._pool; if(rotVec != null) { rotVec.zero(); - if(_this8.sizeVec3 == _this8.stackVec3.length) { - var newArray1 = new Array(_this8.sizeVec3 << 1); - var _g2 = 0; - var _g12 = _this8.sizeVec3; - while(_g2 < _g12) { - var i2 = _g2++; - newArray1[i2] = _this8.stackVec3[i2]; - _this8.stackVec3[i2] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this8.stackVec3 = newArray1; + _this.stackVec3 = newArray; } - _this8.stackVec3[_this8.sizeVec3++] = rotVec; + _this.stackVec3[_this.sizeVec3++] = rotVec; } - var _this9 = this._pool; + var _this = this._pool; if(rotQ != null) { rotQ.x = 0; rotQ.y = 0; rotQ.z = 0; rotQ.w = 1; - if(_this9.sizeQuat == _this9.stackQuat.length) { - var newArray2 = new Array(_this9.sizeQuat << 1); - var _g3 = 0; - var _g13 = _this9.sizeQuat; - while(_g3 < _g13) { - var i3 = _g3++; - newArray2[i3] = _this9.stackQuat[i3]; - _this9.stackQuat[i3] = null; + if(_this.sizeQuat == _this.stackQuat.length) { + var newArray = new Array(_this.sizeQuat << 1); + var _g = 0; + var _g1 = _this.sizeQuat; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackQuat[i]; + _this.stackQuat[i] = null; } - _this9.stackQuat = newArray2; + _this.stackQuat = newArray; } - _this9.stackQuat[_this9.sizeQuat++] = rotQ; + _this.stackQuat[_this.sizeQuat++] = rotQ; } - var _this10 = this._pool; + var _this = this._pool; if(rotM != null) { rotM.e00 = 1; rotM.e01 = 0; @@ -29184,34 +29285,34 @@ oimo_dynamics_World.prototype = { rotM.e20 = 0; rotM.e21 = 0; rotM.e22 = 1; - if(_this10.sizeMat3 == _this10.stackMat3.length) { - var newArray3 = new Array(_this10.sizeMat3 << 1); - var _g4 = 0; - var _g14 = _this10.sizeMat3; - while(_g4 < _g14) { - var i4 = _g4++; - newArray3[i4] = _this10.stackMat3[i4]; - _this10.stackMat3[i4] = null; + if(_this.sizeMat3 == _this.stackMat3.length) { + var newArray = new Array(_this.sizeMat3 << 1); + var _g = 0; + var _g1 = _this.sizeMat3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackMat3[i]; + _this.stackMat3[i] = null; } - _this10.stackMat3 = newArray3; + _this.stackMat3 = newArray; } - _this10.stackMat3[_this10.sizeMat3++] = rotM; + _this.stackMat3[_this.sizeMat3++] = rotM; } - var _this11 = this._pool; + var _this = this._pool; if(prevV != null) { prevV.zero(); - if(_this11.sizeVec3 == _this11.stackVec3.length) { - var newArray4 = new Array(_this11.sizeVec3 << 1); - var _g5 = 0; - var _g15 = _this11.sizeVec3; - while(_g5 < _g15) { - var i5 = _g5++; - newArray4[i5] = _this11.stackVec3[i5]; - _this11.stackVec3[i5] = null; + if(_this.sizeVec3 == _this.stackVec3.length) { + var newArray = new Array(_this.sizeVec3 << 1); + var _g = 0; + var _g1 = _this.sizeVec3; + while(_g < _g1) { + var i = _g++; + newArray[i] = _this.stackVec3[i]; + _this.stackVec3[i] = null; } - _this11.stackVec3 = newArray4; + _this.stackVec3 = newArray; } - _this11.stackVec3[_this11.sizeVec3++] = prevV; + _this.stackVec3[_this.sizeVec3++] = prevV; } } ,step: function(timeStep) { @@ -29220,10 +29321,10 @@ oimo_dynamics_World.prototype = { } this._timeStep.dt = timeStep; this._timeStep.invDt = 1 / timeStep; - var st = Date.now() / 1000; + var st = HxOverrides.now() / 1000; this._updateContacts(); this._solveIslands(); - oimo_dynamics_common_Performance.totalTime = (Date.now() / 1000 - st) * 1000; + oimo_dynamics_common_Performance.totalTime = (HxOverrides.now() / 1000 - st) * 1000; } ,addRigidBody: function(rigidBody) { if(rigidBody._world != null) { @@ -29284,13 +29385,13 @@ oimo_dynamics_World.prototype = { _this._sleeping = false; _this._sleepTime = 0; var _this1 = this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + var prev = c._prev; + var next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this1._contactList) { _this1._contactList = _this1._contactList._next; @@ -29301,18 +29402,25 @@ oimo_dynamics_World.prototype = { c._next = null; c._prev = null; if(c._touching) { + var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + var prev1 = c._link1._prev; + var next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -29322,13 +29430,13 @@ oimo_dynamics_World.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + var prev2 = c._link2._prev; + var next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -29406,9 +29514,9 @@ oimo_dynamics_World.prototype = { var _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; - _this1._sleeping = false; - _this1._sleepTime = 0; + var _this = joint._b2; + _this._sleeping = false; + _this._sleepTime = 0; joint._syncAnchors(); this._numJoints++; } @@ -29433,13 +29541,13 @@ oimo_dynamics_World.prototype = { joint._next = null; joint._prev = null; joint._world = null; - var prev1 = joint._link1._prev; - var next1 = joint._link1._next; - if(prev1 != null) { - prev1._next = next1; + var prev = joint._link1._prev; + var next = joint._link1._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(joint._link1 == joint._b1._jointLinkList) { joint._b1._jointLinkList = joint._b1._jointLinkList._next; @@ -29449,13 +29557,13 @@ oimo_dynamics_World.prototype = { } joint._link1._next = null; joint._link1._prev = null; - var prev2 = joint._link2._prev; - var next2 = joint._link2._next; - if(prev2 != null) { - prev2._next = next2; + var prev = joint._link2._prev; + var next = joint._link2._next; + if(prev != null) { + prev._next = next; } - if(next2 != null) { - next2._prev = prev2; + if(next != null) { + next._prev = prev; } if(joint._link2 == joint._b2._jointLinkList) { joint._b2._jointLinkList = joint._b2._jointLinkList._next; @@ -29472,9 +29580,9 @@ oimo_dynamics_World.prototype = { var _this = joint._b1; _this._sleeping = false; _this._sleepTime = 0; - var _this1 = joint._b2; - _this1._sleeping = false; - _this1._sleepTime = 0; + var _this = joint._b2; + _this._sleeping = false; + _this._sleepTime = 0; this._numJoints--; } ,setDebugDraw: function(debugDraw) { @@ -29497,10 +29605,10 @@ oimo_dynamics_World.prototype = { _this.x = begin.x; _this.y = begin.y; _this.z = begin.z; - var _this1 = this._rayCastWrapper.end; - _this1.x = end.x; - _this1.y = end.y; - _this1.z = end.z; + var _this = this._rayCastWrapper.end; + _this.x = end.x; + _this.y = end.y; + _this.z = end.z; this._rayCastWrapper.callback = callback; this._broadPhase.rayCast(begin,end,this._rayCastWrapper); } @@ -29519,10 +29627,10 @@ oimo_dynamics_World.prototype = { _this._rotation20 = begin._rotation20; _this._rotation21 = begin._rotation21; _this._rotation22 = begin._rotation22; - var _this1 = this._convexCastWrapper.translation; - _this1.x = translation.x; - _this1.y = translation.y; - _this1.z = translation.z; + var _this = this._convexCastWrapper.translation; + _this.x = translation.x; + _this.y = translation.y; + _this.z = translation.z; this._convexCastWrapper.callback = callback; this._broadPhase.convexCast(convex,begin,translation,this._convexCastWrapper); } @@ -29629,7 +29737,11 @@ oimo_dynamics__$World_AabbTestWrapper.__name__ = true; oimo_dynamics__$World_AabbTestWrapper.__super__ = oimo_collision_broadphase_BroadPhaseProxyCallback; oimo_dynamics__$World_AabbTestWrapper.prototype = $extend(oimo_collision_broadphase_BroadPhaseProxyCallback.prototype,{ process: function(proxy) { - var shapeAabb = proxy.userData._aabb; + var shape = proxy.userData; + var shapeAabb = shape._aabb; + if(shapeAabb._minX < this._aabb._maxX && shapeAabb._maxX > this._aabb._minX && shapeAabb._minY < this._aabb._maxY && shapeAabb._maxY > this._aabb._minY && shapeAabb._minZ < this._aabb._maxZ && shapeAabb._maxZ > this._aabb._minZ) { + this._callback.process(shape); + } } ,__class__: oimo_dynamics__$World_AabbTestWrapper }); @@ -29693,11 +29805,11 @@ oimo_dynamics_callback_RayCastClosest.prototype = $extend(oimo_dynamics_callback _this.x = v.x; _this.y = v.y; _this.z = v.z; - var _this1 = this.normal; - var v1 = hit.normal; - _this1.x = v1.x; - _this1.y = v1.y; - _this1.z = v1.z; + var _this = this.normal; + var v = hit.normal; + _this.x = v.x; + _this.y = v.y; + _this.z = v.z; } } ,__class__: oimo_dynamics_callback_RayCastClosest @@ -30048,26 +30160,26 @@ oimo_dynamics_constraint_contact_Manifold.prototype = { by = -nx * tz; bz = nx * ty; } else { - var invL1 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL1; - ty = nx * invL1; + var invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; bz = nx * ty - ny * tx; } } else if(ny2 < nz2) { - var invL2 = 1 / Math.sqrt(nx2 + nz2); - tx = nz * invL2; + var invL = 1 / Math.sqrt(nx2 + nz2); + tx = nz * invL; ty = 0; - tz = -nx * invL2; + tz = -nx * invL; bx = ny * tz; by = nz * tx - nx * tz; bz = -ny * tx; } else { - var invL3 = 1 / Math.sqrt(nx2 + ny2); - tx = -ny * invL3; - ty = nx * invL3; + var invL = 1 / Math.sqrt(nx2 + ny2); + tx = -ny * invL; + ty = nx * invL; tz = 0; bx = -nz * ty; by = nz * tx; @@ -30309,15 +30421,16 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { ,addManifoldPoint: function(point,tf1,tf2) { var num = this._manifold._numPoints; if(num == oimo_common_Setting.maxManifoldPoints) { - var _this = this._manifold._points[this.computeTargetIndex(point,tf1,tf2)]; + var targetIndex = this.computeTargetIndex(point,tf1,tf2); + var _this = this._manifold._points[targetIndex]; var v = point.position1; _this._pos1X = v.x; _this._pos1Y = v.y; _this._pos1Z = v.z; - var v1 = point.position2; - _this._pos2X = v1.x; - _this._pos2Y = v1.y; - _this._pos2Z = v1.z; + var v = point.position2; + _this._pos2X = v.x; + _this._pos2Y = v.y; + _this._pos2Z = v.z; _this._relPos1X = _this._pos1X - tf1._positionX; _this._relPos1Y = _this._pos1Y - tf1._positionY; _this._relPos1Z = _this._pos1Z - tf1._positionZ; @@ -30333,15 +30446,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._localPos1X = __tmp__X; _this._localPos1Y = __tmp__Y; _this._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; - __tmp__Y1 = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; - __tmp__Z1 = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; - _this._localPos2X = __tmp__X1; - _this._localPos2Y = __tmp__Y1; - _this._localPos2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X; + _this._localPos2Y = __tmp__Y; + _this._localPos2Z = __tmp__Z; _this._depth = point.depth; var _this1 = _this._impulse; _this1.impulseN = 0; @@ -30356,51 +30469,51 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { _this._disabled = false; return; } - var _this2 = this._manifold._points[num]; - var v2 = point.position1; - _this2._pos1X = v2.x; - _this2._pos1Y = v2.y; - _this2._pos1Z = v2.z; - var v3 = point.position2; - _this2._pos2X = v3.x; - _this2._pos2Y = v3.y; - _this2._pos2Z = v3.z; - _this2._relPos1X = _this2._pos1X - tf1._positionX; - _this2._relPos1Y = _this2._pos1Y - tf1._positionY; - _this2._relPos1Z = _this2._pos1Z - tf1._positionZ; - _this2._relPos2X = _this2._pos2X - tf2._positionX; - _this2._relPos2Y = _this2._pos2Y - tf2._positionY; - _this2._relPos2Z = _this2._pos2Z - tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * _this2._relPos1X + tf1._rotation10 * _this2._relPos1Y + tf1._rotation20 * _this2._relPos1Z; - __tmp__Y2 = tf1._rotation01 * _this2._relPos1X + tf1._rotation11 * _this2._relPos1Y + tf1._rotation21 * _this2._relPos1Z; - __tmp__Z2 = tf1._rotation02 * _this2._relPos1X + tf1._rotation12 * _this2._relPos1Y + tf1._rotation22 * _this2._relPos1Z; - _this2._localPos1X = __tmp__X2; - _this2._localPos1Y = __tmp__Y2; - _this2._localPos1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf2._rotation00 * _this2._relPos2X + tf2._rotation10 * _this2._relPos2Y + tf2._rotation20 * _this2._relPos2Z; - __tmp__Y3 = tf2._rotation01 * _this2._relPos2X + tf2._rotation11 * _this2._relPos2Y + tf2._rotation21 * _this2._relPos2Z; - __tmp__Z3 = tf2._rotation02 * _this2._relPos2X + tf2._rotation12 * _this2._relPos2Y + tf2._rotation22 * _this2._relPos2Z; - _this2._localPos2X = __tmp__X3; - _this2._localPos2Y = __tmp__Y3; - _this2._localPos2Z = __tmp__Z3; - _this2._depth = point.depth; - var _this3 = _this2._impulse; - _this3.impulseN = 0; - _this3.impulseT = 0; - _this3.impulseB = 0; - _this3.impulseP = 0; - _this3.impulseLX = 0; - _this3.impulseLY = 0; - _this3.impulseLZ = 0; - _this2._id = point.id; - _this2._warmStarted = false; - _this2._disabled = false; + var _this = this._manifold._points[num]; + var v = point.position1; + _this._pos1X = v.x; + _this._pos1Y = v.y; + _this._pos1Z = v.z; + var v = point.position2; + _this._pos2X = v.x; + _this._pos2Y = v.y; + _this._pos2Z = v.z; + _this._relPos1X = _this._pos1X - tf1._positionX; + _this._relPos1Y = _this._pos1Y - tf1._positionY; + _this._relPos1Z = _this._pos1Z - tf1._positionZ; + _this._relPos2X = _this._pos2X - tf2._positionX; + _this._relPos2Y = _this._pos2Y - tf2._positionY; + _this._relPos2Z = _this._pos2Z - tf2._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * _this._relPos1X + tf1._rotation10 * _this._relPos1Y + tf1._rotation20 * _this._relPos1Z; + __tmp__Y = tf1._rotation01 * _this._relPos1X + tf1._rotation11 * _this._relPos1Y + tf1._rotation21 * _this._relPos1Z; + __tmp__Z = tf1._rotation02 * _this._relPos1X + tf1._rotation12 * _this._relPos1Y + tf1._rotation22 * _this._relPos1Z; + _this._localPos1X = __tmp__X; + _this._localPos1Y = __tmp__Y; + _this._localPos1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * _this._relPos2X + tf2._rotation10 * _this._relPos2Y + tf2._rotation20 * _this._relPos2Z; + __tmp__Y = tf2._rotation01 * _this._relPos2X + tf2._rotation11 * _this._relPos2Y + tf2._rotation21 * _this._relPos2Z; + __tmp__Z = tf2._rotation02 * _this._relPos2X + tf2._rotation12 * _this._relPos2Y + tf2._rotation22 * _this._relPos2Z; + _this._localPos2X = __tmp__X; + _this._localPos2Y = __tmp__Y; + _this._localPos2Z = __tmp__Z; + _this._depth = point.depth; + var _this1 = _this._impulse; + _this1.impulseN = 0; + _this1.impulseT = 0; + _this1.impulseB = 0; + _this1.impulseP = 0; + _this1.impulseLX = 0; + _this1.impulseLY = 0; + _this1.impulseLZ = 0; + _this._id = point.id; + _this._warmStarted = false; + _this._disabled = false; this._manifold._numPoints++; } ,computeTargetIndex: function(newPoint,tf1,tf2) { @@ -30498,215 +30611,215 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { var a1 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; var a2 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; var a3 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; - var p1X1 = p1._relPos1X; - var p1Y1 = p1._relPos1Y; - var p1Z1 = p1._relPos1Z; - var p2X1 = p3._relPos1X; - var p2Y1 = p3._relPos1Y; - var p2Z1 = p3._relPos1Z; - var p3X1 = p4._relPos1X; - var p3Y1 = p4._relPos1Y; - var p3Z1 = p4._relPos1Z; - var v12X1; - var v12Y1; - var v12Z1; - var v34X1; - var v34Y1; - var v34Z1; - var v13X1; - var v13Y1; - var v13Z1; - var v24X1; - var v24Y1; - var v24Z1; - var v14X1; - var v14Y1; - var v14Z1; - var v23X1; - var v23Y1; - var v23Z1; - v12X1 = p2X1 - p1X1; - v12Y1 = p2Y1 - p1Y1; - v12Z1 = p2Z1 - p1Z1; - v34X1 = rp1X - p3X1; - v34Y1 = rp1Y - p3Y1; - v34Z1 = rp1Z - p3Z1; - v13X1 = p3X1 - p1X1; - v13Y1 = p3Y1 - p1Y1; - v13Z1 = p3Z1 - p1Z1; - v24X1 = rp1X - p2X1; - v24Y1 = rp1Y - p2Y1; - v24Z1 = rp1Z - p2Z1; - v14X1 = rp1X - p1X1; - v14Y1 = rp1Y - p1Y1; - v14Z1 = rp1Z - p1Z1; - v23X1 = p3X1 - p2X1; - v23Y1 = p3Y1 - p2Y1; - v23Z1 = p3Z1 - p2Z1; - var cross1X1; - var cross1Y1; - var cross1Z1; - var cross2X1; - var cross2Y1; - var cross2Z1; - var cross3X1; - var cross3Y1; - var cross3Z1; - cross1X1 = v12Y1 * v34Z1 - v12Z1 * v34Y1; - cross1Y1 = v12Z1 * v34X1 - v12X1 * v34Z1; - cross1Z1 = v12X1 * v34Y1 - v12Y1 * v34X1; - cross2X1 = v13Y1 * v24Z1 - v13Z1 * v24Y1; - cross2Y1 = v13Z1 * v24X1 - v13X1 * v24Z1; - cross2Z1 = v13X1 * v24Y1 - v13Y1 * v24X1; - cross3X1 = v14Y1 * v23Z1 - v14Z1 * v23Y1; - cross3Y1 = v14Z1 * v23X1 - v14X1 * v23Z1; - cross3Z1 = v14X1 * v23Y1 - v14Y1 * v23X1; - var a11 = cross1X1 * cross1X1 + cross1Y1 * cross1Y1 + cross1Z1 * cross1Z1; - var a21 = cross2X1 * cross2X1 + cross2Y1 * cross2Y1 + cross2Z1 * cross2Z1; - var a31 = cross3X1 * cross3X1 + cross3Y1 * cross3Y1 + cross3Z1 * cross3Z1; + var p1X = p1._relPos1X; + var p1Y = p1._relPos1Y; + var p1Z = p1._relPos1Z; + var p2X = p3._relPos1X; + var p2Y = p3._relPos1Y; + var p2Z = p3._relPos1Z; + var p3X = p4._relPos1X; + var p3Y = p4._relPos1Y; + var p3Z = p4._relPos1Z; + var v12X; + var v12Y; + var v12Z; + var v34X; + var v34Y; + var v34Z; + var v13X; + var v13Y; + var v13Z; + var v24X; + var v24Y; + var v24Z; + var v14X; + var v14Y; + var v14Z; + var v23X; + var v23Y; + var v23Z; + v12X = p2X - p1X; + v12Y = p2Y - p1Y; + v12Z = p2Z - p1Z; + v34X = rp1X - p3X; + v34Y = rp1Y - p3Y; + v34Z = rp1Z - p3Z; + v13X = p3X - p1X; + v13Y = p3Y - p1Y; + v13Z = p3Z - p1Z; + v24X = rp1X - p2X; + v24Y = rp1Y - p2Y; + v24Z = rp1Z - p2Z; + v14X = rp1X - p1X; + v14Y = rp1Y - p1Y; + v14Z = rp1Z - p1Z; + v23X = p3X - p2X; + v23Y = p3Y - p2Y; + v23Z = p3Z - p2Z; + var cross1X; + var cross1Y; + var cross1Z; + var cross2X; + var cross2Y; + var cross2Z; + var cross3X; + var cross3Y; + var cross3Z; + cross1X = v12Y * v34Z - v12Z * v34Y; + cross1Y = v12Z * v34X - v12X * v34Z; + cross1Z = v12X * v34Y - v12Y * v34X; + cross2X = v13Y * v24Z - v13Z * v24Y; + cross2Y = v13Z * v24X - v13X * v24Z; + cross2Z = v13X * v24Y - v13Y * v24X; + cross3X = v14Y * v23Z - v14Z * v23Y; + cross3Y = v14Z * v23X - v14X * v23Z; + cross3Z = v14X * v23Y - v14Y * v23X; + var a11 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + var a21 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + var a31 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; var a22 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; - var p1X2 = p1._relPos1X; - var p1Y2 = p1._relPos1Y; - var p1Z2 = p1._relPos1Z; - var p2X2 = p2._relPos1X; - var p2Y2 = p2._relPos1Y; - var p2Z2 = p2._relPos1Z; - var p3X2 = p4._relPos1X; - var p3Y2 = p4._relPos1Y; - var p3Z2 = p4._relPos1Z; - var v12X2; - var v12Y2; - var v12Z2; - var v34X2; - var v34Y2; - var v34Z2; - var v13X2; - var v13Y2; - var v13Z2; - var v24X2; - var v24Y2; - var v24Z2; - var v14X2; - var v14Y2; - var v14Z2; - var v23X2; - var v23Y2; - var v23Z2; - v12X2 = p2X2 - p1X2; - v12Y2 = p2Y2 - p1Y2; - v12Z2 = p2Z2 - p1Z2; - v34X2 = rp1X - p3X2; - v34Y2 = rp1Y - p3Y2; - v34Z2 = rp1Z - p3Z2; - v13X2 = p3X2 - p1X2; - v13Y2 = p3Y2 - p1Y2; - v13Z2 = p3Z2 - p1Z2; - v24X2 = rp1X - p2X2; - v24Y2 = rp1Y - p2Y2; - v24Z2 = rp1Z - p2Z2; - v14X2 = rp1X - p1X2; - v14Y2 = rp1Y - p1Y2; - v14Z2 = rp1Z - p1Z2; - v23X2 = p3X2 - p2X2; - v23Y2 = p3Y2 - p2Y2; - v23Z2 = p3Z2 - p2Z2; - var cross1X2; - var cross1Y2; - var cross1Z2; - var cross2X2; - var cross2Y2; - var cross2Z2; - var cross3X2; - var cross3Y2; - var cross3Z2; - cross1X2 = v12Y2 * v34Z2 - v12Z2 * v34Y2; - cross1Y2 = v12Z2 * v34X2 - v12X2 * v34Z2; - cross1Z2 = v12X2 * v34Y2 - v12Y2 * v34X2; - cross2X2 = v13Y2 * v24Z2 - v13Z2 * v24Y2; - cross2Y2 = v13Z2 * v24X2 - v13X2 * v24Z2; - cross2Z2 = v13X2 * v24Y2 - v13Y2 * v24X2; - cross3X2 = v14Y2 * v23Z2 - v14Z2 * v23Y2; - cross3Y2 = v14Z2 * v23X2 - v14X2 * v23Z2; - cross3Z2 = v14X2 * v23Y2 - v14Y2 * v23X2; - var a12 = cross1X2 * cross1X2 + cross1Y2 * cross1Y2 + cross1Z2 * cross1Z2; - var a23 = cross2X2 * cross2X2 + cross2Y2 * cross2Y2 + cross2Z2 * cross2Z2; - var a32 = cross3X2 * cross3X2 + cross3Y2 * cross3Y2 + cross3Z2 * cross3Z2; - var a33 = a12 > a23 ? a12 > a32 ? a12 : a32 : a23 > a32 ? a23 : a32; - var p1X3 = p1._relPos1X; - var p1Y3 = p1._relPos1Y; - var p1Z3 = p1._relPos1Z; - var p2X3 = p2._relPos1X; - var p2Y3 = p2._relPos1Y; - var p2Z3 = p2._relPos1Z; - var p3X3 = p3._relPos1X; - var p3Y3 = p3._relPos1Y; - var p3Z3 = p3._relPos1Z; - var v12X3; - var v12Y3; - var v12Z3; - var v34X3; - var v34Y3; - var v34Z3; - var v13X3; - var v13Y3; - var v13Z3; - var v24X3; - var v24Y3; - var v24Z3; - var v14X3; - var v14Y3; - var v14Z3; - var v23X3; - var v23Y3; - var v23Z3; - v12X3 = p2X3 - p1X3; - v12Y3 = p2Y3 - p1Y3; - v12Z3 = p2Z3 - p1Z3; - v34X3 = rp1X - p3X3; - v34Y3 = rp1Y - p3Y3; - v34Z3 = rp1Z - p3Z3; - v13X3 = p3X3 - p1X3; - v13Y3 = p3Y3 - p1Y3; - v13Z3 = p3Z3 - p1Z3; - v24X3 = rp1X - p2X3; - v24Y3 = rp1Y - p2Y3; - v24Z3 = rp1Z - p2Z3; - v14X3 = rp1X - p1X3; - v14Y3 = rp1Y - p1Y3; - v14Z3 = rp1Z - p1Z3; - v23X3 = p3X3 - p2X3; - v23Y3 = p3Y3 - p2Y3; - v23Z3 = p3Z3 - p2Z3; - var cross1X3; - var cross1Y3; - var cross1Z3; - var cross2X3; - var cross2Y3; - var cross2Z3; - var cross3X3; - var cross3Y3; - var cross3Z3; - cross1X3 = v12Y3 * v34Z3 - v12Z3 * v34Y3; - cross1Y3 = v12Z3 * v34X3 - v12X3 * v34Z3; - cross1Z3 = v12X3 * v34Y3 - v12Y3 * v34X3; - cross2X3 = v13Y3 * v24Z3 - v13Z3 * v24Y3; - cross2Y3 = v13Z3 * v24X3 - v13X3 * v24Z3; - cross2Z3 = v13X3 * v24Y3 - v13Y3 * v24X3; - cross3X3 = v14Y3 * v23Z3 - v14Z3 * v23Y3; - cross3Y3 = v14Z3 * v23X3 - v14X3 * v23Z3; - cross3Z3 = v14X3 * v23Y3 - v14Y3 * v23X3; - var a13 = cross1X3 * cross1X3 + cross1Y3 * cross1Y3 + cross1Z3 * cross1Z3; - var a24 = cross2X3 * cross2X3 + cross2Y3 * cross2Y3 + cross2Z3 * cross2Z3; - var a34 = cross3X3 * cross3X3 + cross3Y3 * cross3Y3 + cross3Z3 * cross3Z3; - var a4 = a13 > a24 ? a13 > a34 ? a13 : a34 : a24 > a34 ? a24 : a34; + var p1X = p1._relPos1X; + var p1Y = p1._relPos1Y; + var p1Z = p1._relPos1Z; + var p2X = p2._relPos1X; + var p2Y = p2._relPos1Y; + var p2Z = p2._relPos1Z; + var p3X = p4._relPos1X; + var p3Y = p4._relPos1Y; + var p3Z = p4._relPos1Z; + var v12X; + var v12Y; + var v12Z; + var v34X; + var v34Y; + var v34Z; + var v13X; + var v13Y; + var v13Z; + var v24X; + var v24Y; + var v24Z; + var v14X; + var v14Y; + var v14Z; + var v23X; + var v23Y; + var v23Z; + v12X = p2X - p1X; + v12Y = p2Y - p1Y; + v12Z = p2Z - p1Z; + v34X = rp1X - p3X; + v34Y = rp1Y - p3Y; + v34Z = rp1Z - p3Z; + v13X = p3X - p1X; + v13Y = p3Y - p1Y; + v13Z = p3Z - p1Z; + v24X = rp1X - p2X; + v24Y = rp1Y - p2Y; + v24Z = rp1Z - p2Z; + v14X = rp1X - p1X; + v14Y = rp1Y - p1Y; + v14Z = rp1Z - p1Z; + v23X = p3X - p2X; + v23Y = p3Y - p2Y; + v23Z = p3Z - p2Z; + var cross1X; + var cross1Y; + var cross1Z; + var cross2X; + var cross2Y; + var cross2Z; + var cross3X; + var cross3Y; + var cross3Z; + cross1X = v12Y * v34Z - v12Z * v34Y; + cross1Y = v12Z * v34X - v12X * v34Z; + cross1Z = v12X * v34Y - v12Y * v34X; + cross2X = v13Y * v24Z - v13Z * v24Y; + cross2Y = v13Z * v24X - v13X * v24Z; + cross2Z = v13X * v24Y - v13Y * v24X; + cross3X = v14Y * v23Z - v14Z * v23Y; + cross3Y = v14Z * v23X - v14X * v23Z; + cross3Z = v14X * v23Y - v14Y * v23X; + var a11 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + var a21 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + var a31 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + var a32 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; + var p1X = p1._relPos1X; + var p1Y = p1._relPos1Y; + var p1Z = p1._relPos1Z; + var p2X = p2._relPos1X; + var p2Y = p2._relPos1Y; + var p2Z = p2._relPos1Z; + var p3X = p3._relPos1X; + var p3Y = p3._relPos1Y; + var p3Z = p3._relPos1Z; + var v12X; + var v12Y; + var v12Z; + var v34X; + var v34Y; + var v34Z; + var v13X; + var v13Y; + var v13Z; + var v24X; + var v24Y; + var v24Z; + var v14X; + var v14Y; + var v14Z; + var v23X; + var v23Y; + var v23Z; + v12X = p2X - p1X; + v12Y = p2Y - p1Y; + v12Z = p2Z - p1Z; + v34X = rp1X - p3X; + v34Y = rp1Y - p3Y; + v34Z = rp1Z - p3Z; + v13X = p3X - p1X; + v13Y = p3Y - p1Y; + v13Z = p3Z - p1Z; + v24X = rp1X - p2X; + v24Y = rp1Y - p2Y; + v24Z = rp1Z - p2Z; + v14X = rp1X - p1X; + v14Y = rp1Y - p1Y; + v14Z = rp1Z - p1Z; + v23X = p3X - p2X; + v23Y = p3Y - p2Y; + v23Z = p3Z - p2Z; + var cross1X; + var cross1Y; + var cross1Z; + var cross2X; + var cross2Y; + var cross2Z; + var cross3X; + var cross3Y; + var cross3Z; + cross1X = v12Y * v34Z - v12Z * v34Y; + cross1Y = v12Z * v34X - v12X * v34Z; + cross1Z = v12X * v34Y - v12Y * v34X; + cross2X = v13Y * v24Z - v13Z * v24Y; + cross2Y = v13Z * v24X - v13X * v24Z; + cross2Z = v13X * v24Y - v13Y * v24X; + cross3X = v14Y * v23Z - v14Z * v23Y; + cross3Y = v14Z * v23X - v14X * v23Z; + cross3Z = v14X * v23Y - v14Y * v23X; + var a11 = cross1X * cross1X + cross1Y * cross1Y + cross1Z * cross1Z; + var a21 = cross2X * cross2X + cross2Y * cross2Y + cross2Z * cross2Z; + var a31 = cross3X * cross3X + cross3Y * cross3Y + cross3Z * cross3Z; + var a4 = a11 > a21 ? a11 > a31 ? a11 : a31 : a21 > a31 ? a21 : a31; var max = a1 > a2 ? a1 > a3 ? a1 : a3 : a2 > a3 ? a2 : a3; var target = 0; if(a22 > max && maxDepthIndex != 1 || maxDepthIndex == 0) { max = a22; target = 1; } - if(a33 > max && maxDepthIndex != 2) { - max = a33; + if(a32 > max && maxDepthIndex != 2) { + max = a32; target = 2; } if(a4 > max && maxDepthIndex != 3) { @@ -30825,11 +30938,11 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { } var num = result.numPoints; this._manifold._numPoints = num; - var _g2 = 0; - while(_g2 < num) { - var i1 = _g2++; - var p = this._manifold._points[i1]; - var ref = result.points[i1]; + var _g = 0; + while(_g < num) { + var i = _g++; + var p = this._manifold._points[i]; + var ref = result.points[i]; var v = ref.position1; p._pos1X = v.x; p._pos1Y = v.y; @@ -30863,21 +30976,21 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { p._localPos2Y = __tmp__Y1; p._localPos2Z = __tmp__Z1; p._depth = ref.depth; - var _this1 = p._impulse; - _this1.impulseN = 0; - _this1.impulseT = 0; - _this1.impulseB = 0; - _this1.impulseP = 0; - _this1.impulseLX = 0; - _this1.impulseLY = 0; - _this1.impulseLZ = 0; + var _this = p._impulse; + _this.impulseN = 0; + _this.impulseT = 0; + _this.impulseB = 0; + _this.impulseP = 0; + _this.impulseLX = 0; + _this.impulseLY = 0; + _this.impulseLZ = 0; p._id = ref.id; p._warmStarted = false; p._disabled = false; - var _g3 = 0; - var _g11 = this.numOldPoints; - while(_g3 < _g11) { - var ocp = this.oldPoints[_g3++]; + var _g1 = 0; + var _g2 = this.numOldPoints; + while(_g1 < _g2) { + var ocp = this.oldPoints[_g1++]; if(p._id == ocp._id) { p._impulse.copyFrom(ocp._impulse); p._warmStarted = true; @@ -30901,10 +31014,10 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cp._pos1X = v.x; cp._pos1Y = v.y; cp._pos1Z = v.z; - var v1 = newPoint.position2; - cp._pos2X = v1.x; - cp._pos2Y = v1.y; - cp._pos2Z = v1.z; + var v = newPoint.position2; + cp._pos2X = v.x; + cp._pos2Y = v.y; + cp._pos2Z = v.z; cp._relPos1X = cp._pos1X - tf1._positionX; cp._relPos1Y = cp._pos1Y - tf1._positionY; cp._relPos1Z = cp._pos1Z - tf1._positionZ; @@ -30920,15 +31033,15 @@ oimo_dynamics_constraint_contact_ManifoldUpdater.prototype = { cp._localPos1X = __tmp__X; cp._localPos1Y = __tmp__Y; cp._localPos1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; - __tmp__Y1 = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; - __tmp__Z1 = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; - cp._localPos2X = __tmp__X1; - cp._localPos2Y = __tmp__Y1; - cp._localPos2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * cp._relPos2X + tf2._rotation10 * cp._relPos2Y + tf2._rotation20 * cp._relPos2Z; + __tmp__Y = tf2._rotation01 * cp._relPos2X + tf2._rotation11 * cp._relPos2Y + tf2._rotation21 * cp._relPos2Z; + __tmp__Z = tf2._rotation02 * cp._relPos2X + tf2._rotation12 * cp._relPos2Y + tf2._rotation22 * cp._relPos2Z; + cp._localPos2X = __tmp__X; + cp._localPos2Y = __tmp__Y; + cp._localPos2Z = __tmp__Z; cp._depth = newPoint.depth; } this.removeOutdatedPoints(); @@ -31055,10 +31168,10 @@ var oimo_dynamics_constraint_joint_Joint = function(config,type) { this._localAnchor1X = v.x; this._localAnchor1Y = v.y; this._localAnchor1Z = v.z; - var v1 = config.localAnchor2; - this._localAnchor2X = v1.x; - this._localAnchor2Y = v1.y; - this._localAnchor2Z = v1.z; + var v = config.localAnchor2; + this._localAnchor2X = v.x; + this._localAnchor2Y = v.y; + this._localAnchor2Z = v.z; this._relativeAnchor1X = 0; this._relativeAnchor1Y = 0; this._relativeAnchor1Z = 0; @@ -31090,9 +31203,9 @@ var oimo_dynamics_constraint_joint_Joint = function(config,type) { this._localBasisZ2Y = 0; this._localBasisZ2Z = 0; this._impulses = new Array(oimo_common_Setting.maxJacobianRows); - var _g1 = 0; - var _g2 = oimo_common_Setting.maxJacobianRows; - while(_g1 < _g2) this._impulses[_g1++] = new oimo_dynamics_constraint_joint_JointImpulse(); + var _g = 0; + var _g1 = oimo_common_Setting.maxJacobianRows; + while(_g < _g1) this._impulses[_g++] = new oimo_dynamics_constraint_joint_JointImpulse(); }; oimo_dynamics_constraint_joint_Joint.__name__ = true; oimo_dynamics_constraint_joint_Joint.prototype = { @@ -31115,13 +31228,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + var l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; } var slerpQX; var slerpQY; @@ -31195,19 +31308,19 @@ oimo_dynamics_constraint_joint_Joint.prototype = { var x = slerpQX; var y = slerpQY; var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -31217,34 +31330,34 @@ oimo_dynamics_constraint_joint_Joint.prototype = { slerpM20 = xz - wy; slerpM21 = yz + wx; slerpM22 = 1 - xx - yy; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d2; - if(x22 < y22) { - if(x22 < z22) { - d2 = 1 / Math.sqrt(y22 + z22); + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); this._localBasisY1X = 0; - this._localBasisY1Y = z11 * d2; - this._localBasisY1Z = -y11 * d2; + this._localBasisY1Y = z1 * d; + this._localBasisY1Z = -y1 * d; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; this._localBasisY1Z = 0; } - } else if(y22 < z22) { - d2 = 1 / Math.sqrt(z22 + x22); - this._localBasisY1X = -z11 * d2; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY1X = -z1 * d; this._localBasisY1Y = 0; - this._localBasisY1Z = x11 * d2; + this._localBasisY1Z = x1 * d; } else { - d2 = 1 / Math.sqrt(x22 + y22); - this._localBasisY1X = y11 * d2; - this._localBasisY1Y = -x11 * d2; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY1X = y1 * d; + this._localBasisY1Y = -x1 * d; this._localBasisY1Z = 0; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; @@ -31259,24 +31372,24 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X; + this._localBasisY2Y = __tmp__Y; + this._localBasisY2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X; + this._localBasisZ2Y = __tmp__Y; + this._localBasisZ2Z = __tmp__Z; } ,buildLocalBasesFromXY: function() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { @@ -31297,13 +31410,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2Y = 0; this._localBasisX2Z = 0; } else { - var l1 = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + var l = this._localBasisX2X * this._localBasisX2X + this._localBasisX2Y * this._localBasisX2Y + this._localBasisX2Z * this._localBasisX2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisX2X *= l1; - this._localBasisX2Y *= l1; - this._localBasisX2Z *= l1; + this._localBasisX2X *= l; + this._localBasisX2Y *= l; + this._localBasisX2Z *= l; } this._localBasisZ1X = this._localBasisX1Y * this._localBasisY1Z - this._localBasisX1Z * this._localBasisY1Y; this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; @@ -31346,59 +31459,59 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l2 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + var l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l2; - this._localBasisZ1Y *= l2; - this._localBasisZ1Z *= l2; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; } if(this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z == 0) { - var x11 = this._localBasisX2X; - var y11 = this._localBasisX2Y; - var z11 = this._localBasisX2Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d1; - if(x21 < y21) { - if(x21 < z21) { - d1 = 1 / Math.sqrt(y21 + z21); + var x1 = this._localBasisX2X; + var y1 = this._localBasisX2Y; + var z1 = this._localBasisX2Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); this._localBasisY2X = 0; - this._localBasisY2Y = z11 * d1; - this._localBasisY2Z = -y11 * d1; + this._localBasisY2Y = z1 * d; + this._localBasisY2Z = -y1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } - } else if(y21 < z21) { - d1 = 1 / Math.sqrt(z21 + x21); - this._localBasisY2X = -z11 * d1; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + this._localBasisY2X = -z1 * d; this._localBasisY2Y = 0; - this._localBasisY2Z = x11 * d1; + this._localBasisY2Z = x1 * d; } else { - d1 = 1 / Math.sqrt(x21 + y21); - this._localBasisY2X = y11 * d1; - this._localBasisY2Y = -x11 * d1; + d = 1 / Math.sqrt(x2 + y2); + this._localBasisY2X = y1 * d; + this._localBasisY2Y = -x1 * d; this._localBasisY2Z = 0; } this._localBasisZ2X = this._localBasisX2Y * this._localBasisY2Z - this._localBasisX2Z * this._localBasisY2Y; this._localBasisZ2Y = this._localBasisX2Z * this._localBasisY2X - this._localBasisX2X * this._localBasisY2Z; this._localBasisZ2Z = this._localBasisX2X * this._localBasisY2Y - this._localBasisX2Y * this._localBasisY2X; } else { - var l3 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); + var l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ2X *= l3; - this._localBasisZ2Y *= l3; - this._localBasisZ2Z *= l3; + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; this._localBasisY2X = this._localBasisZ2Y * this._localBasisX2Z - this._localBasisZ2Z * this._localBasisX2Y; this._localBasisY2Y = this._localBasisZ2Z * this._localBasisX2X - this._localBasisZ2X * this._localBasisX2Z; this._localBasisY2Z = this._localBasisZ2X * this._localBasisX2Y - this._localBasisZ2Y * this._localBasisX2X; @@ -31423,13 +31536,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ2Y = 0; this._localBasisZ2Z = 1; } else { - var l1 = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + var l = this._localBasisZ2X * this._localBasisZ2X + this._localBasisZ2Y * this._localBasisZ2Y + this._localBasisZ2Z * this._localBasisZ2Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ2X *= l1; - this._localBasisZ2Y *= l1; - this._localBasisZ2Z *= l1; + this._localBasisZ2X *= l; + this._localBasisZ2Y *= l; + this._localBasisZ2Z *= l; } var tf1 = this._b1._transform; var tf2 = this._b2._transform; @@ -31457,15 +31570,15 @@ oimo_dynamics_constraint_joint_Joint.prototype = { worldX1X = __tmp__X; worldX1Y = __tmp__Y; worldX1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; - __tmp__Y1 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; - __tmp__Z1 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; - worldZ2X = __tmp__X1; - worldZ2Y = __tmp__Y1; - worldZ2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + worldZ2X = __tmp__X; + worldZ2Y = __tmp__Y; + worldZ2Z = __tmp__Z; worldYX = worldZ2Y * worldX1Z - worldZ2Z * worldX1Y; worldYY = worldZ2Z * worldX1X - worldZ2X * worldX1Z; worldYZ = worldZ2X * worldX1Y - worldZ2Y * worldX1X; @@ -31507,60 +31620,60 @@ oimo_dynamics_constraint_joint_Joint.prototype = { worldX2X = worldYY * worldZ2Z - worldYZ * worldZ2Y; worldX2Y = worldYZ * worldZ2X - worldYX * worldZ2Z; worldX2Z = worldYX * worldZ2Y - worldYY * worldZ2X; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; - __tmp__Y2 = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; - __tmp__Z2 = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; - this._localBasisX1X = __tmp__X2; - this._localBasisX1Y = __tmp__Y2; - this._localBasisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; - __tmp__Y3 = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; - __tmp__Z3 = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; - this._localBasisY1X = __tmp__X3; - this._localBasisY1Y = __tmp__Y3; - this._localBasisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; - __tmp__Y4 = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; - __tmp__Z4 = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; - this._localBasisZ1X = __tmp__X4; - this._localBasisZ1Y = __tmp__Y4; - this._localBasisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; - __tmp__X5 = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; - __tmp__Y5 = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; - __tmp__Z5 = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; - this._localBasisX2X = __tmp__X5; - this._localBasisX2Y = __tmp__Y5; - this._localBasisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; - __tmp__Y6 = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; - __tmp__Z6 = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; - this._localBasisY2X = __tmp__X6; - this._localBasisY2Y = __tmp__Y6; - this._localBasisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; - __tmp__Y7 = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; - __tmp__Z7 = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; - this._localBasisZ2X = __tmp__X7; - this._localBasisZ2Y = __tmp__Y7; - this._localBasisZ2Z = __tmp__Z7; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * worldX1X + tf1._rotation10 * worldX1Y + tf1._rotation20 * worldX1Z; + __tmp__Y = tf1._rotation01 * worldX1X + tf1._rotation11 * worldX1Y + tf1._rotation21 * worldX1Z; + __tmp__Z = tf1._rotation02 * worldX1X + tf1._rotation12 * worldX1Y + tf1._rotation22 * worldX1Z; + this._localBasisX1X = __tmp__X; + this._localBasisX1Y = __tmp__Y; + this._localBasisX1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * worldYX + tf1._rotation10 * worldYY + tf1._rotation20 * worldYZ; + __tmp__Y = tf1._rotation01 * worldYX + tf1._rotation11 * worldYY + tf1._rotation21 * worldYZ; + __tmp__Z = tf1._rotation02 * worldYX + tf1._rotation12 * worldYY + tf1._rotation22 * worldYZ; + this._localBasisY1X = __tmp__X; + this._localBasisY1Y = __tmp__Y; + this._localBasisY1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * worldZ1X + tf1._rotation10 * worldZ1Y + tf1._rotation20 * worldZ1Z; + __tmp__Y = tf1._rotation01 * worldZ1X + tf1._rotation11 * worldZ1Y + tf1._rotation21 * worldZ1Z; + __tmp__Z = tf1._rotation02 * worldZ1X + tf1._rotation12 * worldZ1Y + tf1._rotation22 * worldZ1Z; + this._localBasisZ1X = __tmp__X; + this._localBasisZ1Y = __tmp__Y; + this._localBasisZ1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * worldX2X + tf2._rotation10 * worldX2Y + tf2._rotation20 * worldX2Z; + __tmp__Y = tf2._rotation01 * worldX2X + tf2._rotation11 * worldX2Y + tf2._rotation21 * worldX2Z; + __tmp__Z = tf2._rotation02 * worldX2X + tf2._rotation12 * worldX2Y + tf2._rotation22 * worldX2Z; + this._localBasisX2X = __tmp__X; + this._localBasisX2Y = __tmp__Y; + this._localBasisX2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * worldYX + tf2._rotation10 * worldYY + tf2._rotation20 * worldYZ; + __tmp__Y = tf2._rotation01 * worldYX + tf2._rotation11 * worldYY + tf2._rotation21 * worldYZ; + __tmp__Z = tf2._rotation02 * worldYX + tf2._rotation12 * worldYY + tf2._rotation22 * worldYZ; + this._localBasisY2X = __tmp__X; + this._localBasisY2Y = __tmp__Y; + this._localBasisY2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * worldZ2X + tf2._rotation10 * worldZ2Y + tf2._rotation20 * worldZ2Z; + __tmp__Y = tf2._rotation01 * worldZ2X + tf2._rotation11 * worldZ2Y + tf2._rotation21 * worldZ2Z; + __tmp__Z = tf2._rotation02 * worldZ2X + tf2._rotation12 * worldZ2Y + tf2._rotation22 * worldZ2Z; + this._localBasisZ2X = __tmp__X; + this._localBasisZ2Y = __tmp__Y; + this._localBasisZ2Z = __tmp__Z; } ,buildLocalBasesFromXY1X2: function() { if(this._localBasisX1X * this._localBasisX1X + this._localBasisX1Y * this._localBasisX1Y + this._localBasisX1Z * this._localBasisX1Z == 0) { @@ -31614,13 +31727,13 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisZ1Y = this._localBasisX1Z * this._localBasisY1X - this._localBasisX1X * this._localBasisY1Z; this._localBasisZ1Z = this._localBasisX1X * this._localBasisY1Y - this._localBasisX1Y * this._localBasisY1X; } else { - var l1 = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); + var l = this._localBasisZ1X * this._localBasisZ1X + this._localBasisZ1Y * this._localBasisZ1Y + this._localBasisZ1Z * this._localBasisZ1Z; + if(l > 0) { + l = 1 / Math.sqrt(l); } - this._localBasisZ1X *= l1; - this._localBasisZ1Y *= l1; - this._localBasisZ1Z *= l1; + this._localBasisZ1X *= l; + this._localBasisZ1Y *= l; + this._localBasisZ1Z *= l; this._localBasisY1X = this._localBasisZ1Y * this._localBasisX1Z - this._localBasisZ1Z * this._localBasisX1Y; this._localBasisY1Y = this._localBasisZ1Z * this._localBasisX1X - this._localBasisZ1X * this._localBasisX1Z; this._localBasisY1Z = this._localBasisZ1X * this._localBasisX1Y - this._localBasisZ1Y * this._localBasisX1X; @@ -31638,39 +31751,39 @@ oimo_dynamics_constraint_joint_Joint.prototype = { var slerpM20; var slerpM21; var slerpM22; - var d1 = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; - if(d1 < -0.999999999) { + var d = this._localBasisX1X * this._localBasisX2X + this._localBasisX1Y * this._localBasisX2Y + this._localBasisX1Z * this._localBasisX2Z; + if(d < -0.999999999) { var vX; var vY; var vZ; - var x11 = this._localBasisX1X; - var y11 = this._localBasisX1Y; - var z11 = this._localBasisX1Z; - var x21 = x11 * x11; - var y21 = y11 * y11; - var z21 = z11 * z11; - var d2; - if(x21 < y21) { - if(x21 < z21) { - d2 = 1 / Math.sqrt(y21 + z21); + var x1 = this._localBasisX1X; + var y1 = this._localBasisX1Y; + var z1 = this._localBasisX1Z; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); vX = 0; - vY = z11 * d2; - vZ = -y11 * d2; + vY = z1 * d1; + vZ = -y1 * d1; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; vZ = 0; } - } else if(y21 < z21) { - d2 = 1 / Math.sqrt(z21 + x21); - vX = -z11 * d2; + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; vY = 0; - vZ = x11 * d2; + vZ = x1 * d1; } else { - d2 = 1 / Math.sqrt(x21 + y21); - vX = y11 * d2; - vY = -x11 * d2; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; vZ = 0; } slerpQX = vX; @@ -31684,11 +31797,11 @@ oimo_dynamics_constraint_joint_Joint.prototype = { cX = this._localBasisX1Y * this._localBasisX2Z - this._localBasisX1Z * this._localBasisX2Y; cY = this._localBasisX1Z * this._localBasisX2X - this._localBasisX1X * this._localBasisX2Z; cZ = this._localBasisX1X * this._localBasisX2Y - this._localBasisX1Y * this._localBasisX2X; - var w = Math.sqrt((1 + d1) * 0.5); - d1 = 0.5 / w; - cX *= d1; - cY *= d1; - cZ *= d1; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; slerpQX = cX; slerpQY = cY; slerpQZ = cZ; @@ -31697,19 +31810,19 @@ oimo_dynamics_constraint_joint_Joint.prototype = { var x = slerpQX; var y = slerpQY; var z = slerpQZ; - var w1 = slerpQW; - var x22 = 2 * x; - var y22 = 2 * y; - var z22 = 2 * z; - var xx = x * x22; - var yy = y * y22; - var zz = z * z22; - var xy = x * y22; - var yz = y * z22; - var xz = x * z22; - var wx = w1 * x22; - var wy = w1 * y22; - var wz = w1 * z22; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -31728,24 +31841,24 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._localBasisX2X = __tmp__X; this._localBasisX2Y = __tmp__Y; this._localBasisX2Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; - __tmp__Y1 = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; - __tmp__Z1 = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; - this._localBasisY2X = __tmp__X1; - this._localBasisY2Y = __tmp__Y1; - this._localBasisY2Z = __tmp__Z1; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; - __tmp__Y2 = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; - __tmp__Z2 = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; - this._localBasisZ2X = __tmp__X2; - this._localBasisZ2Y = __tmp__Y2; - this._localBasisZ2Z = __tmp__Z2; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisY1X + slerpM01 * this._localBasisY1Y + slerpM02 * this._localBasisY1Z; + __tmp__Y = slerpM10 * this._localBasisY1X + slerpM11 * this._localBasisY1Y + slerpM12 * this._localBasisY1Z; + __tmp__Z = slerpM20 * this._localBasisY1X + slerpM21 * this._localBasisY1Y + slerpM22 * this._localBasisY1Z; + this._localBasisY2X = __tmp__X; + this._localBasisY2Y = __tmp__Y; + this._localBasisY2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * this._localBasisZ1X + slerpM01 * this._localBasisZ1Y + slerpM02 * this._localBasisZ1Z; + __tmp__Y = slerpM10 * this._localBasisZ1X + slerpM11 * this._localBasisZ1Y + slerpM12 * this._localBasisZ1Z; + __tmp__Z = slerpM20 * this._localBasisZ1X + slerpM21 * this._localBasisZ1Y + slerpM22 * this._localBasisZ1Z; + this._localBasisZ2X = __tmp__X; + this._localBasisZ2Y = __tmp__Y; + this._localBasisZ2Z = __tmp__Z; } ,setSolverInfoRowLinear: function(row,diff,lm,mass,sd,timeStep,isPositionPart) { var cfmFactor; @@ -31924,15 +32037,15 @@ oimo_dynamics_constraint_joint_Joint.prototype = { ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; - __tmp__Y1 = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; - __tmp__Z1 = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b2._invInertia00 * axisX + this._b2._invInertia01 * axisY + this._b2._invInertia02 * axisZ; + __tmp__Y = this._b2._invInertia10 * axisX + this._b2._invInertia11 * axisY + this._b2._invInertia12 * axisZ; + __tmp__Z = this._b2._invInertia20 * axisX + this._b2._invInertia21 * axisY + this._b2._invInertia22 * axisZ; + ia2X = __tmp__X; + ia2Y = __tmp__Y; + ia2Z = __tmp__Z; var invI1 = ia1X * axisX + ia1Y * axisY + ia1Z * axisZ; var invI2 = ia2X * axisX + ia2Y * axisY + ia2Z * axisZ; if(invI1 > 0) { @@ -31947,11 +32060,11 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } } if(invI2 > 0) { - var dot1 = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; - var projsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot1 * dot1; - if(projsq1 > 0) { + var dot = axisX * this._relativeAnchor2X + axisY * this._relativeAnchor2Y + axisZ * this._relativeAnchor2Z; + var projsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -31979,15 +32092,15 @@ oimo_dynamics_constraint_joint_Joint.prototype = { ia1X = __tmp__X; ia1Y = __tmp__Y; ia1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; - __tmp__Y1 = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; - __tmp__Z1 = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; - ia2X = __tmp__X1; - ia2Y = __tmp__Y1; - ia2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = this._b2._invInertia00 * axis2X + this._b2._invInertia01 * axis2Y + this._b2._invInertia02 * axis2Z; + __tmp__Y = this._b2._invInertia10 * axis2X + this._b2._invInertia11 * axis2Y + this._b2._invInertia12 * axis2Z; + __tmp__Z = this._b2._invInertia20 * axis2X + this._b2._invInertia21 * axis2Y + this._b2._invInertia22 * axis2Z; + ia2X = __tmp__X; + ia2Y = __tmp__Y; + ia2Z = __tmp__Z; var invI1 = ia1X * axis1X + ia1Y * axis1Y + ia1Z * axis1Z; var invI2 = ia2X * axis2X + ia2Y * axis2Y + ia2Z * axis2Z; if(invI1 > 0) { @@ -32003,12 +32116,12 @@ oimo_dynamics_constraint_joint_Joint.prototype = { } } if(invI2 > 0) { - var rsq1 = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; - var dot1 = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; - var projsq1 = rsq1 * rsq1 - dot1 * dot1; - if(projsq1 > 0) { + var rsq = this._relativeAnchor2X * this._relativeAnchor2X + this._relativeAnchor2Y * this._relativeAnchor2Y + this._relativeAnchor2Z * this._relativeAnchor2Z; + var dot = axis2X * this._relativeAnchor2X + axis2Y * this._relativeAnchor2Y + axis2Z * this._relativeAnchor2Z; + var projsq = rsq * rsq - dot * dot; + if(projsq > 0) { if(this._b2._invMass > 0) { - invI2 = 1 / (1 / invI2 + this._b2._mass * projsq1); + invI2 = 1 / (1 / invI2 + this._b2._mass * projsq); } else { invI2 = 0; } @@ -32032,75 +32145,75 @@ oimo_dynamics_constraint_joint_Joint.prototype = { this._relativeAnchor1X = __tmp__X; this._relativeAnchor1Y = __tmp__Y; this._relativeAnchor1Z = __tmp__Z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; - __tmp__Y1 = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; - __tmp__Z1 = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; - this._relativeAnchor2X = __tmp__X1; - this._relativeAnchor2Y = __tmp__Y1; - this._relativeAnchor2Z = __tmp__Z1; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * this._localAnchor2X + tf2._rotation01 * this._localAnchor2Y + tf2._rotation02 * this._localAnchor2Z; + __tmp__Y = tf2._rotation10 * this._localAnchor2X + tf2._rotation11 * this._localAnchor2Y + tf2._rotation12 * this._localAnchor2Z; + __tmp__Z = tf2._rotation20 * this._localAnchor2X + tf2._rotation21 * this._localAnchor2Y + tf2._rotation22 * this._localAnchor2Z; + this._relativeAnchor2X = __tmp__X; + this._relativeAnchor2Y = __tmp__Y; + this._relativeAnchor2Z = __tmp__Z; this._anchor1X = this._relativeAnchor1X + tf1._positionX; this._anchor1Y = this._relativeAnchor1Y + tf1._positionY; this._anchor1Z = this._relativeAnchor1Z + tf1._positionZ; this._anchor2X = this._relativeAnchor2X + tf2._positionX; this._anchor2Y = this._relativeAnchor2Y + tf2._positionY; this._anchor2Z = this._relativeAnchor2Z + tf2._positionZ; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; - __tmp__Y2 = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; - __tmp__Z2 = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; - this._basisX1X = __tmp__X2; - this._basisX1Y = __tmp__Y2; - this._basisX1Z = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; - __tmp__Y3 = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; - __tmp__Z3 = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; - this._basisY1X = __tmp__X3; - this._basisY1Y = __tmp__Y3; - this._basisY1Z = __tmp__Z3; - var __tmp__X4; - var __tmp__Y4; - var __tmp__Z4; - __tmp__X4 = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; - __tmp__Y4 = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; - __tmp__Z4 = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; - this._basisZ1X = __tmp__X4; - this._basisZ1Y = __tmp__Y4; - this._basisZ1Z = __tmp__Z4; - var __tmp__X5; - var __tmp__Y5; - var __tmp__Z5; - __tmp__X5 = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; - __tmp__Y5 = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; - __tmp__Z5 = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; - this._basisX2X = __tmp__X5; - this._basisX2Y = __tmp__Y5; - this._basisX2Z = __tmp__Z5; - var __tmp__X6; - var __tmp__Y6; - var __tmp__Z6; - __tmp__X6 = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; - __tmp__Y6 = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; - __tmp__Z6 = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; - this._basisY2X = __tmp__X6; - this._basisY2Y = __tmp__Y6; - this._basisY2Z = __tmp__Z6; - var __tmp__X7; - var __tmp__Y7; - var __tmp__Z7; - __tmp__X7 = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; - __tmp__Y7 = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; - __tmp__Z7 = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; - this._basisZ2X = __tmp__X7; - this._basisZ2Y = __tmp__Y7; - this._basisZ2Z = __tmp__Z7; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisX1X + tf1._rotation01 * this._localBasisX1Y + tf1._rotation02 * this._localBasisX1Z; + __tmp__Y = tf1._rotation10 * this._localBasisX1X + tf1._rotation11 * this._localBasisX1Y + tf1._rotation12 * this._localBasisX1Z; + __tmp__Z = tf1._rotation20 * this._localBasisX1X + tf1._rotation21 * this._localBasisX1Y + tf1._rotation22 * this._localBasisX1Z; + this._basisX1X = __tmp__X; + this._basisX1Y = __tmp__Y; + this._basisX1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisY1X + tf1._rotation01 * this._localBasisY1Y + tf1._rotation02 * this._localBasisY1Z; + __tmp__Y = tf1._rotation10 * this._localBasisY1X + tf1._rotation11 * this._localBasisY1Y + tf1._rotation12 * this._localBasisY1Z; + __tmp__Z = tf1._rotation20 * this._localBasisY1X + tf1._rotation21 * this._localBasisY1Y + tf1._rotation22 * this._localBasisY1Z; + this._basisY1X = __tmp__X; + this._basisY1Y = __tmp__Y; + this._basisY1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf1._rotation00 * this._localBasisZ1X + tf1._rotation01 * this._localBasisZ1Y + tf1._rotation02 * this._localBasisZ1Z; + __tmp__Y = tf1._rotation10 * this._localBasisZ1X + tf1._rotation11 * this._localBasisZ1Y + tf1._rotation12 * this._localBasisZ1Z; + __tmp__Z = tf1._rotation20 * this._localBasisZ1X + tf1._rotation21 * this._localBasisZ1Y + tf1._rotation22 * this._localBasisZ1Z; + this._basisZ1X = __tmp__X; + this._basisZ1Y = __tmp__Y; + this._basisZ1Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * this._localBasisX2X + tf2._rotation01 * this._localBasisX2Y + tf2._rotation02 * this._localBasisX2Z; + __tmp__Y = tf2._rotation10 * this._localBasisX2X + tf2._rotation11 * this._localBasisX2Y + tf2._rotation12 * this._localBasisX2Z; + __tmp__Z = tf2._rotation20 * this._localBasisX2X + tf2._rotation21 * this._localBasisX2Y + tf2._rotation22 * this._localBasisX2Z; + this._basisX2X = __tmp__X; + this._basisX2Y = __tmp__Y; + this._basisX2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * this._localBasisY2X + tf2._rotation01 * this._localBasisY2Y + tf2._rotation02 * this._localBasisY2Z; + __tmp__Y = tf2._rotation10 * this._localBasisY2X + tf2._rotation11 * this._localBasisY2Y + tf2._rotation12 * this._localBasisY2Z; + __tmp__Z = tf2._rotation20 * this._localBasisY2X + tf2._rotation21 * this._localBasisY2Y + tf2._rotation22 * this._localBasisY2Z; + this._basisY2X = __tmp__X; + this._basisY2Y = __tmp__Y; + this._basisY2Z = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = tf2._rotation00 * this._localBasisZ2X + tf2._rotation01 * this._localBasisZ2Y + tf2._rotation02 * this._localBasisZ2Z; + __tmp__Y = tf2._rotation10 * this._localBasisZ2X + tf2._rotation11 * this._localBasisZ2Y + tf2._rotation12 * this._localBasisZ2Z; + __tmp__Z = tf2._rotation20 * this._localBasisZ2X + tf2._rotation21 * this._localBasisZ2Y + tf2._rotation22 * this._localBasisZ2Z; + this._basisZ2X = __tmp__X; + this._basisZ2Y = __tmp__Y; + this._basisZ2Z = __tmp__Z; } ,_getVelocitySolverInfo: function(timeStep,info) { info.b1 = this._b1; @@ -32368,10 +32481,10 @@ var oimo_dynamics_constraint_joint_CylindricalJoint = function(config) { this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; + var v = config.localAxis2; + this._localBasisX2X = v.x; + this._localBasisX2Y = v.y; + this._localBasisX2Z = v.z; this.buildLocalBasesFromX(); this.angle = 0; this.angularErrorY = 0; @@ -32395,6 +32508,7 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic var angRhsY = this.angularErrorY * erp; var angRhsZ = this.angularErrorZ * erp; var j; + var translationalMotorMass = 1 / (this._b1._invMass + this._b2._invMass); var rotationalMotorMass = this.computeEffectiveInertiaMoment(this._basis.xX,this._basis.xY,this._basis.xZ); if(this._translSd.frequency <= 0 || !isPositionPart) { var impulse = this._impulses[0]; @@ -32420,7 +32534,7 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic row.motorMaxImpulse = 0; row.impulse = null; row.impulse = impulse; - this.setSolverInfoRowLinear(row,this.translation,this._translLm,1 / (this._b1._invMass + this._b2._invMass),this._translSd,timeStep,isPositionPart); + this.setSolverInfoRowLinear(row,this.translation,this._translLm,translationalMotorMass,this._translSd,timeStep,isPositionPart); j = row.jacobian; j.lin1X = this._basis.xX; j.lin1Y = this._basis.xY; @@ -32435,34 +32549,34 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = this._basis.yX; j.lin1Y = this._basis.yY; j.lin1Z = this._basis.yZ; @@ -32475,34 +32589,34 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linRhsZ; - row2.cfm = 0; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; @@ -32516,31 +32630,31 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; if(this._rotSd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.angle,this._rotLm,rotationalMotorMass,this._rotSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -32548,68 +32662,68 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic j.ang2Y = this._basis.xY; j.ang2Z = this._basis.xZ; } - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; j.ang2X = this._basis.yX; j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; + var impulse = this._impulses[5]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -32734,15 +32848,15 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + var d = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d < 0) { + d = -d; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { + if(d > 0.999999) { var dqX; var dqY; var dqZ; @@ -32764,19 +32878,19 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; + var theta = invM1 / (invM1 + invM2) * Math.acos(d); + q2X += q1X * -d; + q2Y += q1Y * -d; + q2Z += q1Z * -d; + q2W += q1W * -d; + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; var sin = Math.sin(theta); var cos = Math.cos(theta); q1X *= cos; @@ -32791,19 +32905,19 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic var x = slerpQX; var y = slerpQY; var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -32828,136 +32942,136 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + var d = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = prevXX; + var y1 = prevXY; + var z1 = prevXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; - slerpM00 = 1 - yy1 - zz1; - slerpM01 = xy1 - wz1; - slerpM02 = xz1 + wy1; - slerpM10 = xy1 + wz1; - slerpM11 = 1 - xx1 - zz1; - slerpM12 = yz1 - wx1; - slerpM20 = xz1 - wy1; - slerpM21 = yz1 + wx1; - slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; - __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; - __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; - newYX = __tmp__X1; - newYY = __tmp__Y1; - newYZ = __tmp__Z1; + var cX; + var cY; + var cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X; + newYY = __tmp__Y; + newYZ = __tmp__Z; newZX = newXY * newYZ - newXZ * newYY; newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + var l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + var x1 = newXX; + var y1 = newXY; + var z1 = newXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -32979,18 +33093,18 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + var cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + var l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; var perpCrossX; @@ -32999,8 +33113,8 @@ oimo_dynamics_constraint_joint_CylindricalJoint.prototype = $extend(oimo_dynamic perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } @@ -33129,29 +33243,29 @@ oimo_dynamics_constraint_joint_JointConfig.prototype = { localPoint.x = vX; localPoint.y = vY; localPoint.z = vZ; - var _this1 = this.rigidBody2; - var localPoint1 = this.localAnchor2; - var vX1; - var vY1; - var vZ1; - vX1 = worldAnchor.x; - vY1 = worldAnchor.y; - vZ1 = worldAnchor.z; - vX1 -= _this1._transform._positionX; - vY1 -= _this1._transform._positionY; - vZ1 -= _this1._transform._positionZ; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = _this1._transform._rotation00 * vX1 + _this1._transform._rotation10 * vY1 + _this1._transform._rotation20 * vZ1; - __tmp__Y1 = _this1._transform._rotation01 * vX1 + _this1._transform._rotation11 * vY1 + _this1._transform._rotation21 * vZ1; - __tmp__Z1 = _this1._transform._rotation02 * vX1 + _this1._transform._rotation12 * vY1 + _this1._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localPoint1.x = vX1; - localPoint1.y = vY1; - localPoint1.z = vZ1; + var _this = this.rigidBody2; + var localPoint = this.localAnchor2; + var vX; + var vY; + var vZ; + vX = worldAnchor.x; + vY = worldAnchor.y; + vZ = worldAnchor.z; + vX -= _this._transform._positionX; + vY -= _this._transform._positionY; + vZ -= _this._transform._positionZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = _this._transform._rotation00 * vX + _this._transform._rotation10 * vY + _this._transform._rotation20 * vZ; + __tmp__Y = _this._transform._rotation01 * vX + _this._transform._rotation11 * vY + _this._transform._rotation21 * vZ; + __tmp__Z = _this._transform._rotation02 * vX + _this._transform._rotation12 * vY + _this._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localPoint.x = vX; + localPoint.y = vY; + localPoint.z = vZ; } ,__class__: oimo_dynamics_constraint_joint_JointConfig }; @@ -33188,25 +33302,25 @@ oimo_dynamics_constraint_joint_CylindricalJointConfig.prototype = $extend(oimo_d localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; - vX1 = worldAxis.x; - vY1 = worldAxis.y; - vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localVector1.x = vX1; - localVector1.y = vY1; - localVector1.z = vZ1; + var localVector = this.localAxis2; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody2._transform._rotation00 * vX + rigidBody2._transform._rotation10 * vY + rigidBody2._transform._rotation20 * vZ; + __tmp__Y = rigidBody2._transform._rotation01 * vX + rigidBody2._transform._rotation11 * vY + rigidBody2._transform._rotation21 * vZ; + __tmp__Z = rigidBody2._transform._rotation02 * vX + rigidBody2._transform._rotation12 * vY + rigidBody2._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; return this; } ,__class__: oimo_dynamics_constraint_joint_CylindricalJointConfig @@ -33216,8 +33330,8 @@ var oimo_dynamics_constraint_joint_GenericJoint = function(config) { var tmp; var _this = config.localBasis1; if(!(_this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0)) { - var _this1 = config.localBasis2; - tmp = _this1.e00 * (_this1.e11 * _this1.e22 - _this1.e12 * _this1.e21) - _this1.e01 * (_this1.e10 * _this1.e22 - _this1.e12 * _this1.e20) + _this1.e02 * (_this1.e10 * _this1.e21 - _this1.e11 * _this1.e20) < 0; + var _this = config.localBasis2; + tmp = _this.e00 * (_this.e11 * _this.e22 - _this.e12 * _this.e21) - _this.e01 * (_this.e10 * _this.e22 - _this.e12 * _this.e20) + _this.e02 * (_this.e10 * _this.e21 - _this.e11 * _this.e20) < 0; } else { tmp = true; } @@ -33252,16 +33366,16 @@ var oimo_dynamics_constraint_joint_GenericJoint = function(config) { lb120 = m.e20; lb121 = m.e21; lb122 = m.e22; - var m1 = config.localBasis2; - lb200 = m1.e00; - lb201 = m1.e01; - lb202 = m1.e02; - lb210 = m1.e10; - lb211 = m1.e11; - lb212 = m1.e12; - lb220 = m1.e20; - lb221 = m1.e21; - lb222 = m1.e22; + var m = config.localBasis2; + lb200 = m.e00; + lb201 = m.e01; + lb202 = m.e02; + lb210 = m.e10; + lb211 = m.e11; + lb212 = m.e12; + lb220 = m.e20; + lb221 = m.e21; + lb222 = m.e22; this._localBasisX1X = lb100; this._localBasisX1Y = lb110; this._localBasisX1Z = lb120; @@ -33355,31 +33469,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisX1Y - this._relativeAnchor2Y * this._basisX1X; } if(this._translSds[1].frequency <= 0 || !isPositionPart) { - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - this.setSolverInfoRowLinear(row1,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationY,this._translLms[1],translMotorMass,this._translSds[1],timeStep,isPositionPart); + j = row.jacobian; j.lin1X = this._basisY1X; j.lin1Y = this._basisY1Y; j.lin1Z = this._basisY1Z; @@ -33394,31 +33508,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisY1Y - this._relativeAnchor2Y * this._basisY1X; } if(this._translSds[2].frequency <= 0 || !isPositionPart) { - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - this.setSolverInfoRowLinear(row2,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowLinear(row,this.translationZ,this._translLms[2],translMotorMass,this._translSds[2],timeStep,isPositionPart); + j = row.jacobian; j.lin1X = this._basisZ1X; j.lin1Y = this._basisZ1Y; j.lin1Z = this._basisZ1Z; @@ -33433,31 +33547,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._relativeAnchor2X * this._basisZ1Y - this._relativeAnchor2Y * this._basisZ1X; } if(!this.xSingular && (this._rotSds[0].frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleX,this._rotLms[0],motorMassX,this._rotSds[0],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -33466,31 +33580,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._axisXZ; } if(!this.ySingular && (this._rotSds[1].frequency <= 0 || !isPositionPart)) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - this.setSolverInfoRowAngular(row4,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleY,this._rotLms[1],motorMassY,this._rotSds[1],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -33499,31 +33613,31 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._rotSds[2].frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - this.setSolverInfoRowAngular(row5,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); - j = row5.jacobian; + var impulse = this._impulses[5]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleZ,this._rotLms[2],motorMassZ,this._rotSds[2],timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisZX; j.ang1Y = this._axisZY; j.ang1Z = this._axisZZ; @@ -33568,20 +33682,20 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._axisYX *= l1; - this._axisYY *= l1; - this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - this._axisZX *= l2; - this._axisZY *= l2; - this._axisZZ *= l2; + var l = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisYX *= l; + this._axisYY *= l; + this._axisYZ *= l; + var l = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisZX *= l; + this._axisZY *= l; + this._axisZZ *= l; this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; @@ -33714,7 +33828,7 @@ oimo_dynamics_constraint_joint_GenericJoint.prototype = $extend(oimo_dynamics_co return this._translSds.slice(0); } ,getRotationalSpringDampers: function() { - return this._translSds.slice(0); + return this._rotSds.slice(0); } ,getTranslationalLimitMotors: function() { return this._translLms.slice(0); @@ -33739,11 +33853,11 @@ var oimo_dynamics_constraint_joint_GenericJointConfig = function() { _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); _g.push(new oimo_dynamics_constraint_joint_TranslationalLimitMotor().setLimits(0,0)); this.translationalLimitMotors = _g; - var _g1 = []; - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - _g1.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); - this.rotationalLimitMotors = _g1; + var _g = []; + _g.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + _g.push(new oimo_dynamics_constraint_joint_RotationalLimitMotor().setLimits(0,0)); + this.rotationalLimitMotors = _g; this.translationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; this.rotationalSpringDampers = [new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper(),new oimo_dynamics_constraint_joint_SpringDamper()]; }; @@ -33835,33 +33949,33 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam lb120 = __tmp__20; lb121 = __tmp__21; lb122 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; - __tmp__011 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; - __tmp__021 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; - __tmp__101 = tf2._rotation01 * wb200 + tf2._rotation11 * wb210 + tf2._rotation21 * wb220; - __tmp__111 = tf2._rotation01 * wb201 + tf2._rotation11 * wb211 + tf2._rotation21 * wb221; - __tmp__121 = tf2._rotation01 * wb202 + tf2._rotation11 * wb212 + tf2._rotation21 * wb222; - __tmp__201 = tf2._rotation02 * wb200 + tf2._rotation12 * wb210 + tf2._rotation22 * wb220; - __tmp__211 = tf2._rotation02 * wb201 + tf2._rotation12 * wb211 + tf2._rotation22 * wb221; - __tmp__221 = tf2._rotation02 * wb202 + tf2._rotation12 * wb212 + tf2._rotation22 * wb222; - lb200 = __tmp__001; - lb201 = __tmp__011; - lb202 = __tmp__021; - lb210 = __tmp__101; - lb211 = __tmp__111; - lb212 = __tmp__121; - lb220 = __tmp__201; - lb221 = __tmp__211; - lb222 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf2._rotation00 * wb200 + tf2._rotation10 * wb210 + tf2._rotation20 * wb220; + __tmp__01 = tf2._rotation00 * wb201 + tf2._rotation10 * wb211 + tf2._rotation20 * wb221; + __tmp__02 = tf2._rotation00 * wb202 + tf2._rotation10 * wb212 + tf2._rotation20 * wb222; + __tmp__10 = tf2._rotation01 * wb200 + tf2._rotation11 * wb210 + tf2._rotation21 * wb220; + __tmp__11 = tf2._rotation01 * wb201 + tf2._rotation11 * wb211 + tf2._rotation21 * wb221; + __tmp__12 = tf2._rotation01 * wb202 + tf2._rotation11 * wb212 + tf2._rotation21 * wb222; + __tmp__20 = tf2._rotation02 * wb200 + tf2._rotation12 * wb210 + tf2._rotation22 * wb220; + __tmp__21 = tf2._rotation02 * wb201 + tf2._rotation12 * wb211 + tf2._rotation22 * wb221; + __tmp__22 = tf2._rotation02 * wb202 + tf2._rotation12 * wb212 + tf2._rotation22 * wb222; + lb200 = __tmp__00; + lb201 = __tmp__01; + lb202 = __tmp__02; + lb210 = __tmp__10; + lb211 = __tmp__11; + lb212 = __tmp__12; + lb220 = __tmp__20; + lb221 = __tmp__21; + lb222 = __tmp__22; var m = this.localBasis1; m.e00 = lb100; m.e01 = lb101; @@ -33872,16 +33986,16 @@ oimo_dynamics_constraint_joint_GenericJointConfig.prototype = $extend(oimo_dynam m.e20 = lb120; m.e21 = lb121; m.e22 = lb122; - var m1 = this.localBasis2; - m1.e00 = lb200; - m1.e01 = lb201; - m1.e02 = lb202; - m1.e10 = lb210; - m1.e11 = lb211; - m1.e12 = lb212; - m1.e20 = lb220; - m1.e21 = lb221; - m1.e22 = lb222; + var m = this.localBasis2; + m.e00 = lb200; + m.e01 = lb201; + m.e02 = lb202; + m.e10 = lb210; + m.e11 = lb211; + m.e12 = lb212; + m.e20 = lb220; + m.e21 = lb221; + m.e22 = lb222; return this; } ,__class__: oimo_dynamics_constraint_joint_GenericJointConfig @@ -33924,10 +34038,10 @@ var oimo_dynamics_constraint_joint_PrismaticJoint = function(config) { this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; + var v = config.localAxis2; + this._localBasisX2X = v.x; + this._localBasisX2Y = v.y; + this._localBasisX2Z = v.z; this.buildLocalBasesFromX(); this._basis = new oimo_dynamics_constraint_joint_BasisTracker(this); this.translation = 0; @@ -33989,34 +34103,34 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = this._relativeAnchor2Z * this._basis.xX - this._relativeAnchor2X * this._basis.xZ; j.ang2Z = this._relativeAnchor2X * this._basis.xY - this._relativeAnchor2Y * this._basis.xX; } - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = this._basis.yX; j.lin1Y = this._basis.yY; j.lin1Z = this._basis.yZ; @@ -34029,34 +34143,34 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2X = this._relativeAnchor2Y * this._basis.yZ - this._relativeAnchor2Z * this._basis.yY; j.ang2Y = this._relativeAnchor2Z * this._basis.yX - this._relativeAnchor2X * this._basis.yZ; j.ang2Z = this._relativeAnchor2X * this._basis.yY - this._relativeAnchor2Y * this._basis.yX; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linRhsZ; - row2.cfm = 0; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = this._basis.zX; j.lin1Y = this._basis.zY; j.lin1Z = this._basis.zZ; @@ -34069,102 +34183,102 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ j.ang2X = this._relativeAnchor2Y * this._basis.zZ - this._relativeAnchor2Z * this._basis.zY; j.ang2Y = this._relativeAnchor2Z * this._basis.zX - this._relativeAnchor2X * this._basis.zZ; j.ang2Z = this._relativeAnchor2X * this._basis.zY - this._relativeAnchor2Y * this._basis.zX; - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - row3.rhs = angRhsX; - row3.cfm = 0; - row3.minImpulse = -1e65536; - row3.maxImpulse = 1e65536; - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsX; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = 1; j.ang1Y = 0; j.ang1Z = 0; j.ang2X = 1; j.ang2Y = 0; j.ang2Z = 0; - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = 0; j.ang1Y = 1; j.ang1Z = 0; j.ang2X = 0; j.ang2Y = 1; j.ang2Z = 0; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; + var impulse = this._impulses[5]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = 0; j.ang1Y = 0; j.ang1Z = 1; @@ -34289,15 +34403,15 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + var d = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d < 0) { + d = -d; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { + if(d > 0.999999) { var dqX; var dqY; var dqZ; @@ -34319,19 +34433,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; + var theta = invM1 / (invM1 + invM2) * Math.acos(d); + q2X += q1X * -d; + q2Y += q1Y * -d; + q2Z += q1Z * -d; + q2W += q1W * -d; + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; var sin = Math.sin(theta); var cos = Math.cos(theta); q1X *= cos; @@ -34346,19 +34460,19 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ var x = slerpQX; var y = slerpQY; var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -34383,136 +34497,136 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + var d = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = prevXX; + var y1 = prevXY; + var z1 = prevXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; - slerpM00 = 1 - yy1 - zz1; - slerpM01 = xy1 - wz1; - slerpM02 = xz1 + wy1; - slerpM10 = xy1 + wz1; - slerpM11 = 1 - xx1 - zz1; - slerpM12 = yz1 - wx1; - slerpM20 = xz1 - wy1; - slerpM21 = yz1 + wx1; - slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; - __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; - __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; - newYX = __tmp__X1; - newYY = __tmp__Y1; - newYZ = __tmp__Z1; + var cX; + var cY; + var cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X; + newYY = __tmp__Y; + newYZ = __tmp__Z; newZX = newXY * newYZ - newXZ * newYY; newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + var l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + var x1 = newXX; + var y1 = newXY; + var z1 = newXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -34648,20 +34762,20 @@ oimo_dynamics_constraint_joint_PrismaticJoint.prototype = $extend(oimo_dynamics_ relQW = (relRot10 - relRot01) * s; } var cosHalfTheta = relQW; - var theta1 = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; + var theta = (cosHalfTheta <= -1 ? 3.14159265358979 : cosHalfTheta >= 1 ? 0 : Math.acos(cosHalfTheta)) * 2; this.angularErrorX = relQX; this.angularErrorY = relQY; this.angularErrorZ = relQZ; - var l3 = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - this.angularErrorX *= l3; - this.angularErrorY *= l3; - this.angularErrorZ *= l3; - this.angularErrorX *= theta1; - this.angularErrorY *= theta1; - this.angularErrorZ *= theta1; + var l = this.angularErrorX * this.angularErrorX + this.angularErrorY * this.angularErrorY + this.angularErrorZ * this.angularErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this.angularErrorX *= l; + this.angularErrorY *= l; + this.angularErrorZ *= l; + this.angularErrorX *= theta; + this.angularErrorY *= theta; + this.angularErrorZ *= theta; var anchorDiffX; var anchorDiffY; var anchorDiffZ; @@ -34770,25 +34884,25 @@ oimo_dynamics_constraint_joint_PrismaticJointConfig.prototype = $extend(oimo_dyn localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; - vX1 = worldAxis.x; - vY1 = worldAxis.y; - vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localVector1.x = vX1; - localVector1.y = vY1; - localVector1.z = vZ1; + var localVector = this.localAxis2; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody2._transform._rotation00 * vX + rigidBody2._transform._rotation10 * vY + rigidBody2._transform._rotation20 * vZ; + __tmp__Y = rigidBody2._transform._rotation01 * vX + rigidBody2._transform._rotation11 * vY + rigidBody2._transform._rotation21 * vZ; + __tmp__Z = rigidBody2._transform._rotation02 * vX + rigidBody2._transform._rotation12 * vY + rigidBody2._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; return this; } ,__class__: oimo_dynamics_constraint_joint_PrismaticJointConfig @@ -34799,14 +34913,14 @@ var oimo_dynamics_constraint_joint_RagdollJoint = function(config) { this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localSwingAxis1; - this._localBasisY1X = v1.x; - this._localBasisY1Y = v1.y; - this._localBasisY1Z = v1.z; - var v2 = config.localTwistAxis2; - this._localBasisX2X = v2.x; - this._localBasisX2Y = v2.y; - this._localBasisX2Z = v2.z; + var v = config.localSwingAxis1; + this._localBasisY1X = v.x; + this._localBasisY1Y = v.y; + this._localBasisY1Z = v.z; + var v = config.localTwistAxis2; + this._localBasisX2X = v.x; + this._localBasisX2Y = v.y; + this._localBasisX2Z = v.z; this.buildLocalBasesFromXY1X2(); this._twistSd = config.twistSpringDamper.clone(); this._twistLm = config.twistLimitMotor.clone(); @@ -34939,34 +35053,34 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linearRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 1; j.lin1Z = 0; @@ -34979,34 +35093,34 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linearRhsZ; - row2.cfm = 0; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -35020,31 +35134,31 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Y = crossR221; j.ang2Z = crossR222; if(this.swingError > 0 && (this._swingSd.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.swingError,this.dummySwingLm,swingMass,this._swingSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.swingAxisX; j.ang1Y = this.swingAxisY; j.ang1Z = this.swingAxisZ; @@ -35053,31 +35167,31 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co j.ang2Z = this.swingAxisZ; } if(this._twistSd.frequency <= 0 || !isPositionPart) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - this.setSolverInfoRowAngular(row4,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._twistAngle,this._twistLm,twistMass,this._twistSd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this.twistAxisX; j.ang1Y = this.twistAxisY; j.ang1Z = this.twistAxisZ; @@ -35193,19 +35307,19 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co var x = swingQX; var y = swingQY; var z = swingQZ; - var w1 = swingQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + var w = swingQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; swingM00 = 1 - yy - zz; swingM01 = xy - wz; swingM02 = xz + wy; @@ -35249,60 +35363,60 @@ oimo_dynamics_constraint_joint_RagdollJoint.prototype = $extend(oimo_dynamics_co swingVX *= invLen * this._swingAngle; swingVY *= invLen * this._swingAngle; swingVZ *= invLen * this._swingAngle; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; - __tmp__Y1 = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; - __tmp__Z1 = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; - swingVX = __tmp__X1; - swingVY = __tmp__Y1; - swingVZ = __tmp__Z1; - var x3 = swingVY; - var y3 = swingVZ; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = basis1Mat00 * swingVX + basis1Mat10 * swingVY + basis1Mat20 * swingVZ; + __tmp__Y = basis1Mat01 * swingVX + basis1Mat11 * swingVY + basis1Mat21 * swingVZ; + __tmp__Z = basis1Mat02 * swingVX + basis1Mat12 * swingVY + basis1Mat22 * swingVZ; + swingVX = __tmp__X; + swingVY = __tmp__Y; + swingVZ = __tmp__Z; + var x = swingVY; + var y = swingVZ; var a = this._maxSwingAngle1; var b = this._maxSwingAngle2; var invA2 = 1 / (a * a); var invB2 = 1 / (b * b); - var w2 = x3 * x3 * invA2 + y3 * y3 * invB2; - if(w2 == 0) { + var w = x * x * invA2 + y * y * invB2; + if(w == 0) { this.swingAxisX = 0; this.swingAxisY = 0; this.swingAxisZ = 0; this.swingError = 0; } else { - var t = Math.sqrt(1 / w2); - var x0 = x3 * t; - var y0 = y3 * t; + var t = Math.sqrt(1 / w); + var x0 = x * t; + var y0 = y * t; var nx = x0 * invA2; var ny = y0 * invB2; invLen = 1 / Math.sqrt(nx * nx + ny * ny); nx *= invLen; ny *= invLen; - var depth = (x3 - x0) * nx + (y3 - y0) * ny; + var depth = (x - x0) * nx + (y - y0) * ny; if(depth > 0) { this.swingError = depth; this.swingAxisX = 0; this.swingAxisY = nx; this.swingAxisZ = ny; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; - __tmp__Y2 = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; - __tmp__Z2 = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; - this.swingAxisX = __tmp__X2; - this.swingAxisY = __tmp__Y2; - this.swingAxisZ = __tmp__Z2; - var __tmp__X3; - var __tmp__Y3; - var __tmp__Z3; - __tmp__X3 = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; - __tmp__Y3 = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; - __tmp__Z3 = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; - this.swingAxisX = __tmp__X3; - this.swingAxisY = __tmp__Y3; - this.swingAxisZ = __tmp__Z3; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = basis1Mat00 * this.swingAxisX + basis1Mat01 * this.swingAxisY + basis1Mat02 * this.swingAxisZ; + __tmp__Y = basis1Mat10 * this.swingAxisX + basis1Mat11 * this.swingAxisY + basis1Mat12 * this.swingAxisZ; + __tmp__Z = basis1Mat20 * this.swingAxisX + basis1Mat21 * this.swingAxisY + basis1Mat22 * this.swingAxisZ; + this.swingAxisX = __tmp__X; + this.swingAxisY = __tmp__Y; + this.swingAxisZ = __tmp__Z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = swingM00 * this.swingAxisX + swingM01 * this.swingAxisY + swingM02 * this.swingAxisZ; + __tmp__Y = swingM10 * this.swingAxisX + swingM11 * this.swingAxisY + swingM12 * this.swingAxisZ; + __tmp__Z = swingM20 * this.swingAxisX + swingM21 * this.swingAxisY + swingM22 * this.swingAxisZ; + this.swingAxisX = __tmp__X; + this.swingAxisY = __tmp__Y; + this.swingAxisZ = __tmp__Z; } else { this.swingError = 0; } @@ -35431,44 +35545,44 @@ oimo_dynamics_constraint_joint_RagdollJointConfig.prototype = $extend(oimo_dynam localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localTwistAxis2; - var vX1; - var vY1; - var vZ1; - vX1 = worldTwistAxis.x; - vY1 = worldTwistAxis.y; - vZ1 = worldTwistAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localVector1.x = vX1; - localVector1.y = vY1; - localVector1.z = vZ1; - var localVector2 = this.localSwingAxis1; - var vX2; - var vY2; - var vZ2; - vX2 = worldSwingAxis.x; - vY2 = worldSwingAxis.y; - vZ2 = worldSwingAxis.z; - var __tmp__X2; - var __tmp__Y2; - var __tmp__Z2; - __tmp__X2 = rigidBody1._transform._rotation00 * vX2 + rigidBody1._transform._rotation10 * vY2 + rigidBody1._transform._rotation20 * vZ2; - __tmp__Y2 = rigidBody1._transform._rotation01 * vX2 + rigidBody1._transform._rotation11 * vY2 + rigidBody1._transform._rotation21 * vZ2; - __tmp__Z2 = rigidBody1._transform._rotation02 * vX2 + rigidBody1._transform._rotation12 * vY2 + rigidBody1._transform._rotation22 * vZ2; - vX2 = __tmp__X2; - vY2 = __tmp__Y2; - vZ2 = __tmp__Z2; - localVector2.x = vX2; - localVector2.y = vY2; - localVector2.z = vZ2; + var localVector = this.localTwistAxis2; + var vX; + var vY; + var vZ; + vX = worldTwistAxis.x; + vY = worldTwistAxis.y; + vZ = worldTwistAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody2._transform._rotation00 * vX + rigidBody2._transform._rotation10 * vY + rigidBody2._transform._rotation20 * vZ; + __tmp__Y = rigidBody2._transform._rotation01 * vX + rigidBody2._transform._rotation11 * vY + rigidBody2._transform._rotation21 * vZ; + __tmp__Z = rigidBody2._transform._rotation02 * vX + rigidBody2._transform._rotation12 * vY + rigidBody2._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; + var localVector = this.localSwingAxis1; + var vX; + var vY; + var vZ; + vX = worldSwingAxis.x; + vY = worldSwingAxis.y; + vZ = worldSwingAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody1._transform._rotation00 * vX + rigidBody1._transform._rotation10 * vY + rigidBody1._transform._rotation20 * vZ; + __tmp__Y = rigidBody1._transform._rotation01 * vX + rigidBody1._transform._rotation11 * vY + rigidBody1._transform._rotation21 * vZ; + __tmp__Z = rigidBody1._transform._rotation02 * vX + rigidBody1._transform._rotation12 * vY + rigidBody1._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; return this; } ,__class__: oimo_dynamics_constraint_joint_RagdollJointConfig @@ -35479,10 +35593,10 @@ var oimo_dynamics_constraint_joint_RevoluteJoint = function(config) { this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisX2X = v1.x; - this._localBasisX2Y = v1.y; - this._localBasisX2Z = v1.z; + var v = config.localAxis2; + this._localBasisX2X = v.x; + this._localBasisX2Y = v.y; + this._localBasisX2Z = v.z; this.buildLocalBasesFromX(); this.angle = 0; this.angularErrorY = 0; @@ -35599,34 +35713,34 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linearRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 1; j.lin1Z = 0; @@ -35639,34 +35753,34 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linearRhsZ; - row2.cfm = 0; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -35680,31 +35794,31 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = crossR221; j.ang2Z = crossR222; if(this._sd.frequency <= 0 || !isPositionPart) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this.angle,this._lm,motorMass,this._sd,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._basis.xX; j.ang1Y = this._basis.xY; j.ang1Z = this._basis.xZ; @@ -35712,68 +35826,68 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c j.ang2Y = this._basis.xY; j.ang2Z = this._basis.xZ; } - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._basis.yX; j.ang1Y = this._basis.yY; j.ang1Z = this._basis.yZ; j.ang2X = this._basis.yX; j.ang2Y = this._basis.yY; j.ang2Z = this._basis.yZ; - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - row5.rhs = angRhsZ; - row5.cfm = 0; - row5.minImpulse = -1e65536; - row5.maxImpulse = 1e65536; - j = row5.jacobian; + var impulse = this._impulses[5]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._basis.zX; j.ang1Y = this._basis.zY; j.ang1Z = this._basis.zZ; @@ -35898,15 +36012,15 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c q2Y = qY; q2Z = qZ; q2W = qW; - var d2 = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; - if(d2 < 0) { - d2 = -d2; + var d = q1X * q2X + q1Y * q2Y + q1Z * q2Z + q1W * q2W; + if(d < 0) { + d = -d; q2X = -q2X; q2Y = -q2Y; q2Z = -q2Z; q2W = -q2W; } - if(d2 > 0.999999) { + if(d > 0.999999) { var dqX; var dqY; var dqZ; @@ -35928,19 +36042,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c slerpQZ = q2Z * l; slerpQW = q2W * l; } else { - var theta = invM1 / (invM1 + invM2) * Math.acos(d2); - q2X += q1X * -d2; - q2Y += q1Y * -d2; - q2Z += q1Z * -d2; - q2W += q1W * -d2; - var l1 = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - q2X *= l1; - q2Y *= l1; - q2Z *= l1; - q2W *= l1; + var theta = invM1 / (invM1 + invM2) * Math.acos(d); + q2X += q1X * -d; + q2Y += q1Y * -d; + q2Z += q1Z * -d; + q2W += q1W * -d; + var l = q2X * q2X + q2Y * q2Y + q2Z * q2Z + q2W * q2W; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + q2X *= l; + q2Y *= l; + q2Z *= l; + q2W *= l; var sin = Math.sin(theta); var cos = Math.cos(theta); q1X *= cos; @@ -35955,19 +36069,19 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c var x = slerpQX; var y = slerpQY; var z = slerpQZ; - var w1 = slerpQW; - var x21 = 2 * x; - var y21 = 2 * y; - var z21 = 2 * z; - var xx = x * x21; - var yy = y * y21; - var zz = z * z21; - var xy = x * y21; - var yz = y * z21; - var xz = x * z21; - var wx = w1 * x21; - var wy = w1 * y21; - var wz = w1 * z21; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; slerpM00 = 1 - yy - zz; slerpM01 = xy - wz; slerpM02 = xz + wy; @@ -35992,136 +36106,136 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c prevYX = _this.yX; prevYY = _this.yY; prevYZ = _this.yZ; - var d3 = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; - if(d3 < -0.999999999) { - var vX1; - var vY1; - var vZ1; - var x11 = prevXX; - var y11 = prevXY; - var z11 = prevXZ; - var x22 = x11 * x11; - var y22 = y11 * y11; - var z22 = z11 * z11; - var d4; - if(x22 < y22) { - if(x22 < z22) { - d4 = 1 / Math.sqrt(y22 + z22); - vX1 = 0; - vY1 = z11 * d4; - vZ1 = -y11 * d4; + var d = prevXX * newXX + prevXY * newXY + prevXZ * newXZ; + if(d < -0.999999999) { + var vX; + var vY; + var vZ; + var x1 = prevXX; + var y1 = prevXY; + var z1 = prevXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d1; + if(x2 < y2) { + if(x2 < z2) { + d1 = 1 / Math.sqrt(y2 + z2); + vX = 0; + vY = z1 * d1; + vZ = -y1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - } else if(y22 < z22) { - d4 = 1 / Math.sqrt(z22 + x22); - vX1 = -z11 * d4; - vY1 = 0; - vZ1 = x11 * d4; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + } else if(y2 < z2) { + d1 = 1 / Math.sqrt(z2 + x2); + vX = -z1 * d1; + vY = 0; + vZ = x1 * d1; } else { - d4 = 1 / Math.sqrt(x22 + y22); - vX1 = y11 * d4; - vY1 = -x11 * d4; - vZ1 = 0; - } - slerpQX = vX1; - slerpQY = vY1; - slerpQZ = vZ1; + d1 = 1 / Math.sqrt(x2 + y2); + vX = y1 * d1; + vY = -x1 * d1; + vZ = 0; + } + slerpQX = vX; + slerpQY = vY; + slerpQZ = vZ; slerpQW = 0; } else { - var cX1; - var cY1; - var cZ1; - cX1 = prevXY * newXZ - prevXZ * newXY; - cY1 = prevXZ * newXX - prevXX * newXZ; - cZ1 = prevXX * newXY - prevXY * newXX; - var w2 = Math.sqrt((1 + d3) * 0.5); - d3 = 0.5 / w2; - cX1 *= d3; - cY1 *= d3; - cZ1 *= d3; - slerpQX = cX1; - slerpQY = cY1; - slerpQZ = cZ1; - slerpQW = w2; - } - var x3 = slerpQX; - var y3 = slerpQY; - var z3 = slerpQZ; - var w3 = slerpQW; - var x23 = 2 * x3; - var y23 = 2 * y3; - var z23 = 2 * z3; - var xx1 = x3 * x23; - var yy1 = y3 * y23; - var zz1 = z3 * z23; - var xy1 = x3 * y23; - var yz1 = y3 * z23; - var xz1 = x3 * z23; - var wx1 = w3 * x23; - var wy1 = w3 * y23; - var wz1 = w3 * z23; - slerpM00 = 1 - yy1 - zz1; - slerpM01 = xy1 - wz1; - slerpM02 = xz1 + wy1; - slerpM10 = xy1 + wz1; - slerpM11 = 1 - xx1 - zz1; - slerpM12 = yz1 - wx1; - slerpM20 = xz1 - wy1; - slerpM21 = yz1 + wx1; - slerpM22 = 1 - xx1 - yy1; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; - __tmp__Y1 = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; - __tmp__Z1 = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; - newYX = __tmp__X1; - newYY = __tmp__Y1; - newYZ = __tmp__Z1; + var cX; + var cY; + var cZ; + cX = prevXY * newXZ - prevXZ * newXY; + cY = prevXZ * newXX - prevXX * newXZ; + cZ = prevXX * newXY - prevXY * newXX; + var w = Math.sqrt((1 + d) * 0.5); + d = 0.5 / w; + cX *= d; + cY *= d; + cZ *= d; + slerpQX = cX; + slerpQY = cY; + slerpQZ = cZ; + slerpQW = w; + } + var x = slerpQX; + var y = slerpQY; + var z = slerpQZ; + var w = slerpQW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + slerpM00 = 1 - yy - zz; + slerpM01 = xy - wz; + slerpM02 = xz + wy; + slerpM10 = xy + wz; + slerpM11 = 1 - xx - zz; + slerpM12 = yz - wx; + slerpM20 = xz - wy; + slerpM21 = yz + wx; + slerpM22 = 1 - xx - yy; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = slerpM00 * prevYX + slerpM01 * prevYY + slerpM02 * prevYZ; + __tmp__Y = slerpM10 * prevYX + slerpM11 * prevYY + slerpM12 * prevYZ; + __tmp__Z = slerpM20 * prevYX + slerpM21 * prevYY + slerpM22 * prevYZ; + newYX = __tmp__X; + newYY = __tmp__Y; + newYZ = __tmp__Z; newZX = newXY * newYZ - newXZ * newYY; newZY = newXZ * newYX - newXX * newYZ; newZZ = newXX * newYY - newXY * newYX; if(newZX * newZX + newZY * newZY + newZZ * newZZ > 1e-6) { - var l2 = newZX * newZX + newZY * newZY + newZZ * newZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); + var l = newZX * newZX + newZY * newZY + newZZ * newZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); } - newZX *= l2; - newZY *= l2; - newZZ *= l2; + newZX *= l; + newZY *= l; + newZZ *= l; } else { - var x12 = newXX; - var y12 = newXY; - var z12 = newXZ; - var x24 = x12 * x12; - var y24 = y12 * y12; - var z24 = z12 * z12; - var d5; - if(x24 < y24) { - if(x24 < z24) { - d5 = 1 / Math.sqrt(y24 + z24); + var x1 = newXX; + var y1 = newXY; + var z1 = newXZ; + var x2 = x1 * x1; + var y2 = y1 * y1; + var z2 = z1 * z1; + var d; + if(x2 < y2) { + if(x2 < z2) { + d = 1 / Math.sqrt(y2 + z2); newZX = 0; - newZY = z12 * d5; - newZZ = -y12 * d5; + newZY = z1 * d; + newZZ = -y1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } - } else if(y24 < z24) { - d5 = 1 / Math.sqrt(z24 + x24); - newZX = -z12 * d5; + } else if(y2 < z2) { + d = 1 / Math.sqrt(z2 + x2); + newZX = -z1 * d; newZY = 0; - newZZ = x12 * d5; + newZZ = x1 * d; } else { - d5 = 1 / Math.sqrt(x24 + y24); - newZX = y12 * d5; - newZY = -x12 * d5; + d = 1 / Math.sqrt(x2 + y2); + newZX = y1 * d; + newZY = -x1 * d; newZZ = 0; } } @@ -36143,18 +36257,18 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c angErrorX = this._basisX1Y * this._basisX2Z - this._basisX1Z * this._basisX2Y; angErrorY = this._basisX1Z * this._basisX2X - this._basisX1X * this._basisX2Z; angErrorZ = this._basisX1X * this._basisX2Y - this._basisX1Y * this._basisX2X; - var cos1 = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; - var theta1 = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); - var l3 = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; - if(l3 > 0) { - l3 = 1 / Math.sqrt(l3); - } - angErrorX *= l3; - angErrorY *= l3; - angErrorZ *= l3; - angErrorX *= theta1; - angErrorY *= theta1; - angErrorZ *= theta1; + var cos = this._basisX1X * this._basisX2X + this._basisX1Y * this._basisX2Y + this._basisX1Z * this._basisX2Z; + var theta = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); + var l = angErrorX * angErrorX + angErrorY * angErrorY + angErrorZ * angErrorZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + angErrorX *= l; + angErrorY *= l; + angErrorZ *= l; + angErrorX *= theta; + angErrorY *= theta; + angErrorZ *= theta; this.angularErrorY = angErrorX * this._basis.yX + angErrorY * this._basis.yY + angErrorZ * this._basis.yZ; this.angularErrorZ = angErrorX * this._basis.zX + angErrorY * this._basis.zY + angErrorZ * this._basis.zZ; var perpCrossX; @@ -36163,8 +36277,8 @@ oimo_dynamics_constraint_joint_RevoluteJoint.prototype = $extend(oimo_dynamics_c perpCrossX = this._basisY1Y * this._basisY2Z - this._basisY1Z * this._basisY2Y; perpCrossY = this._basisY1Z * this._basisY2X - this._basisY1X * this._basisY2Z; perpCrossZ = this._basisY1X * this._basisY2Y - this._basisY1Y * this._basisY2X; - cos1 = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; - this.angle = cos1 <= -1 ? 3.14159265358979 : cos1 >= 1 ? 0 : Math.acos(cos1); + cos = this._basisY1X * this._basisY2X + this._basisY1Y * this._basisY2Y + this._basisY1Z * this._basisY2Z; + this.angle = cos <= -1 ? 3.14159265358979 : cos >= 1 ? 0 : Math.acos(cos); if(perpCrossX * this._basis.xX + perpCrossY * this._basis.xY + perpCrossZ * this._basis.xZ < 0) { this.angle = -this.angle; } @@ -36270,25 +36384,25 @@ oimo_dynamics_constraint_joint_RevoluteJointConfig.prototype = $extend(oimo_dyna localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; - vX1 = worldAxis.x; - vY1 = worldAxis.y; - vZ1 = worldAxis.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localVector1.x = vX1; - localVector1.y = vY1; - localVector1.z = vZ1; + var localVector = this.localAxis2; + var vX; + var vY; + var vZ; + vX = worldAxis.x; + vY = worldAxis.y; + vZ = worldAxis.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody2._transform._rotation00 * vX + rigidBody2._transform._rotation10 * vY + rigidBody2._transform._rotation20 * vZ; + __tmp__Y = rigidBody2._transform._rotation01 * vX + rigidBody2._transform._rotation11 * vY + rigidBody2._transform._rotation21 * vZ; + __tmp__Z = rigidBody2._transform._rotation02 * vX + rigidBody2._transform._rotation12 * vY + rigidBody2._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; return this; } ,__class__: oimo_dynamics_constraint_joint_RevoluteJointConfig @@ -36460,34 +36574,34 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linearRhsY; - row1.cfm = cfm; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsY; + row.cfm = cfm; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 1; j.lin1Z = 0; @@ -36500,34 +36614,34 @@ oimo_dynamics_constraint_joint_SphericalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linearRhsZ; - row2.cfm = cfm; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsZ; + row.cfm = cfm; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -36625,10 +36739,10 @@ var oimo_dynamics_constraint_joint_UniversalJoint = function(config) { this._localBasisX1X = v.x; this._localBasisX1Y = v.y; this._localBasisX1Z = v.z; - var v1 = config.localAxis2; - this._localBasisZ2X = v1.x; - this._localBasisZ2Y = v1.y; - this._localBasisZ2Z = v1.z; + var v = config.localAxis2; + this._localBasisZ2X = v.x; + this._localBasisZ2Y = v.y; + this._localBasisZ2Z = v.z; this.buildLocalBasesFromX1Z2(); this._angleX = 0; this._angleY = 0; @@ -36749,34 +36863,34 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR200; j.ang2Y = crossR201; j.ang2Z = crossR202; - var impulse1 = this._impulses[1]; - var row1 = info.rows[info.numRows++]; - var _this1 = row1.jacobian; - _this1.lin1X = 0; - _this1.lin1Y = 0; - _this1.lin1Z = 0; - _this1.lin2X = 0; - _this1.lin2Y = 0; - _this1.lin2Z = 0; - _this1.ang1X = 0; - _this1.ang1Y = 0; - _this1.ang1Z = 0; - _this1.ang2X = 0; - _this1.ang2Y = 0; - _this1.ang2Z = 0; - row1.rhs = 0; - row1.cfm = 0; - row1.minImpulse = 0; - row1.maxImpulse = 0; - row1.motorSpeed = 0; - row1.motorMaxImpulse = 0; - row1.impulse = null; - row1.impulse = impulse1; - row1.rhs = linearRhsY; - row1.cfm = 0; - row1.minImpulse = -1e65536; - row1.maxImpulse = 1e65536; - j = row1.jacobian; + var impulse = this._impulses[1]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 1; j.lin1Z = 0; @@ -36789,34 +36903,34 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2X = crossR210; j.ang2Y = crossR211; j.ang2Z = crossR212; - var impulse2 = this._impulses[2]; - var row2 = info.rows[info.numRows++]; - var _this2 = row2.jacobian; - _this2.lin1X = 0; - _this2.lin1Y = 0; - _this2.lin1Z = 0; - _this2.lin2X = 0; - _this2.lin2Y = 0; - _this2.lin2Z = 0; - _this2.ang1X = 0; - _this2.ang1Y = 0; - _this2.ang1Z = 0; - _this2.ang2X = 0; - _this2.ang2Y = 0; - _this2.ang2Z = 0; - row2.rhs = 0; - row2.cfm = 0; - row2.minImpulse = 0; - row2.maxImpulse = 0; - row2.motorSpeed = 0; - row2.motorMaxImpulse = 0; - row2.impulse = null; - row2.impulse = impulse2; - row2.rhs = linearRhsZ; - row2.cfm = 0; - row2.minImpulse = -1e65536; - row2.maxImpulse = 1e65536; - j = row2.jacobian; + var impulse = this._impulses[2]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = linearRhsZ; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.lin1X = 0; j.lin1Y = 0; j.lin1Z = 1; @@ -36830,31 +36944,31 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Y = crossR221; j.ang2Z = crossR222; if(!this.xSingular && (this._sd1.frequency <= 0 || !isPositionPart)) { - var impulse3 = this._impulses[3]; - var row3 = info.rows[info.numRows++]; - var _this3 = row3.jacobian; - _this3.lin1X = 0; - _this3.lin1Y = 0; - _this3.lin1Z = 0; - _this3.lin2X = 0; - _this3.lin2Y = 0; - _this3.lin2Z = 0; - _this3.ang1X = 0; - _this3.ang1Y = 0; - _this3.ang1Z = 0; - _this3.ang2X = 0; - _this3.ang2Y = 0; - _this3.ang2Z = 0; - row3.rhs = 0; - row3.cfm = 0; - row3.minImpulse = 0; - row3.maxImpulse = 0; - row3.motorSpeed = 0; - row3.motorMaxImpulse = 0; - row3.impulse = null; - row3.impulse = impulse3; - this.setSolverInfoRowAngular(row3,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); - j = row3.jacobian; + var impulse = this._impulses[3]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleX,this._lm1,motorMassX,this._sd1,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisXX; j.ang1Y = this._axisXY; j.ang1Z = this._axisXZ; @@ -36863,34 +36977,34 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = this._axisXZ; } if(!this.ySingular) { - var impulse4 = this._impulses[4]; - var row4 = info.rows[info.numRows++]; - var _this4 = row4.jacobian; - _this4.lin1X = 0; - _this4.lin1Y = 0; - _this4.lin1Z = 0; - _this4.lin2X = 0; - _this4.lin2Y = 0; - _this4.lin2Z = 0; - _this4.ang1X = 0; - _this4.ang1Y = 0; - _this4.ang1Z = 0; - _this4.ang2X = 0; - _this4.ang2Y = 0; - _this4.ang2Z = 0; - row4.rhs = 0; - row4.cfm = 0; - row4.minImpulse = 0; - row4.maxImpulse = 0; - row4.motorSpeed = 0; - row4.motorMaxImpulse = 0; - row4.impulse = null; - row4.impulse = impulse4; - row4.rhs = angRhsY; - row4.cfm = 0; - row4.minImpulse = -1e65536; - row4.maxImpulse = 1e65536; - j = row4.jacobian; + var impulse = this._impulses[4]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + row.rhs = angRhsY; + row.cfm = 0; + row.minImpulse = -1e65536; + row.maxImpulse = 1e65536; + j = row.jacobian; j.ang1X = this._axisYX; j.ang1Y = this._axisYY; j.ang1Z = this._axisYZ; @@ -36899,31 +37013,31 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ j.ang2Z = this._axisYZ; } if(!this.zSingular && (this._sd2.frequency <= 0 || !isPositionPart)) { - var impulse5 = this._impulses[5]; - var row5 = info.rows[info.numRows++]; - var _this5 = row5.jacobian; - _this5.lin1X = 0; - _this5.lin1Y = 0; - _this5.lin1Z = 0; - _this5.lin2X = 0; - _this5.lin2Y = 0; - _this5.lin2Z = 0; - _this5.ang1X = 0; - _this5.ang1Y = 0; - _this5.ang1Z = 0; - _this5.ang2X = 0; - _this5.ang2Y = 0; - _this5.ang2Z = 0; - row5.rhs = 0; - row5.cfm = 0; - row5.minImpulse = 0; - row5.maxImpulse = 0; - row5.motorSpeed = 0; - row5.motorMaxImpulse = 0; - row5.impulse = null; - row5.impulse = impulse5; - this.setSolverInfoRowAngular(row5,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); - j = row5.jacobian; + var impulse = this._impulses[5]; + var row = info.rows[info.numRows++]; + var _this = row.jacobian; + _this.lin1X = 0; + _this.lin1Y = 0; + _this.lin1Z = 0; + _this.lin2X = 0; + _this.lin2Y = 0; + _this.lin2Z = 0; + _this.ang1X = 0; + _this.ang1Y = 0; + _this.ang1Z = 0; + _this.ang2X = 0; + _this.ang2Y = 0; + _this.ang2Z = 0; + row.rhs = 0; + row.cfm = 0; + row.minImpulse = 0; + row.maxImpulse = 0; + row.motorSpeed = 0; + row.motorMaxImpulse = 0; + row.impulse = null; + row.impulse = impulse; + this.setSolverInfoRowAngular(row,this._angleZ,this._lm2,motorMassZ,this._sd2,timeStep,isPositionPart); + j = row.jacobian; j.ang1X = this._axisZX; j.ang1Y = this._axisZY; j.ang1Z = this._axisZZ; @@ -36968,20 +37082,20 @@ oimo_dynamics_constraint_joint_UniversalJoint.prototype = $extend(oimo_dynamics_ this._axisXX *= l; this._axisXY *= l; this._axisXZ *= l; - var l1 = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; - if(l1 > 0) { - l1 = 1 / Math.sqrt(l1); - } - this._axisYX *= l1; - this._axisYY *= l1; - this._axisYZ *= l1; - var l2 = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; - if(l2 > 0) { - l2 = 1 / Math.sqrt(l2); - } - this._axisZX *= l2; - this._axisZY *= l2; - this._axisZZ *= l2; + var l = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisYX *= l; + this._axisYY *= l; + this._axisYZ *= l; + var l = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ; + if(l > 0) { + l = 1 / Math.sqrt(l); + } + this._axisZX *= l; + this._axisZY *= l; + this._axisZZ *= l; this.xSingular = this._axisXX * this._axisXX + this._axisXY * this._axisXY + this._axisXZ * this._axisXZ == 0; this.ySingular = this._axisYX * this._axisYX + this._axisYY * this._axisYY + this._axisYZ * this._axisYZ == 0; this.zSingular = this._axisZX * this._axisZX + this._axisZY * this._axisZY + this._axisZZ * this._axisZZ == 0; @@ -37184,25 +37298,25 @@ oimo_dynamics_constraint_joint_UniversalJointConfig.prototype = $extend(oimo_dyn localVector.x = vX; localVector.y = vY; localVector.z = vZ; - var localVector1 = this.localAxis2; - var vX1; - var vY1; - var vZ1; - vX1 = worldAxis2.x; - vY1 = worldAxis2.y; - vZ1 = worldAxis2.z; - var __tmp__X1; - var __tmp__Y1; - var __tmp__Z1; - __tmp__X1 = rigidBody2._transform._rotation00 * vX1 + rigidBody2._transform._rotation10 * vY1 + rigidBody2._transform._rotation20 * vZ1; - __tmp__Y1 = rigidBody2._transform._rotation01 * vX1 + rigidBody2._transform._rotation11 * vY1 + rigidBody2._transform._rotation21 * vZ1; - __tmp__Z1 = rigidBody2._transform._rotation02 * vX1 + rigidBody2._transform._rotation12 * vY1 + rigidBody2._transform._rotation22 * vZ1; - vX1 = __tmp__X1; - vY1 = __tmp__Y1; - vZ1 = __tmp__Z1; - localVector1.x = vX1; - localVector1.y = vY1; - localVector1.z = vZ1; + var localVector = this.localAxis2; + var vX; + var vY; + var vZ; + vX = worldAxis2.x; + vY = worldAxis2.y; + vZ = worldAxis2.z; + var __tmp__X; + var __tmp__Y; + var __tmp__Z; + __tmp__X = rigidBody2._transform._rotation00 * vX + rigidBody2._transform._rotation10 * vY + rigidBody2._transform._rotation20 * vZ; + __tmp__Y = rigidBody2._transform._rotation01 * vX + rigidBody2._transform._rotation11 * vY + rigidBody2._transform._rotation21 * vZ; + __tmp__Z = rigidBody2._transform._rotation02 * vX + rigidBody2._transform._rotation12 * vY + rigidBody2._transform._rotation22 * vZ; + vX = __tmp__X; + vY = __tmp__Y; + vZ = __tmp__Z; + localVector.x = vX; + localVector.y = vY; + localVector.z = vZ; return this; } ,__class__: oimo_dynamics_constraint_joint_UniversalJointConfig @@ -37298,12 +37412,12 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { } this.numUnbounded = buildInfo.numUnbounded; this.matrixId = 0; - var _g2 = 0; - var _g3 = this.numUnbounded; - while(_g2 < _g3) { - var i1 = _g2++; - var idx = buildInfo.iUnbounded[i1]; - this.iUnbounded[i1] = idx; + var _g = 0; + var _g1 = this.numUnbounded; + while(_g < _g1) { + var i = _g++; + var idx = buildInfo.iUnbounded[i]; + this.iUnbounded[i] = idx; this.matrixId |= 1 << idx; } } @@ -37316,30 +37430,29 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { this.b[idx] = row.rhs * impulseFactor - relVels[idx] - row.cfm * impulses[idx]; } var invMassWithoutCfm = mass._invMassWithoutCfm; - var _g2 = 0; - var _g3 = this.numBounded; - while(_g2 < _g3) { - var i = _g2++; - var idx1 = this.iBounded[i]; + var _g = 0; + var _g1 = this.numBounded; + while(_g < _g1) { + var i = _g++; + var idx = this.iBounded[i]; var sign = this.signs[i]; - var row1 = info.rows[idx1]; - var dImpulse = (sign < 0 ? row1.minImpulse : sign > 0 ? row1.maxImpulse : 0) - impulses[idx1]; - dImpulses[idx1] = dImpulse; + var row = info.rows[idx]; + var dImpulse = (sign < 0 ? row.minImpulse : sign > 0 ? row.maxImpulse : 0) - impulses[idx]; + dImpulses[idx] = dImpulse; if(dImpulse != 0) { - var _g21 = 0; - var _g31 = this.numUnbounded; - while(_g21 < _g31) { - var idx2 = this.iUnbounded[_g21++]; - var _g32 = this.b; - _g32[idx2] = _g32[idx2] - invMassWithoutCfm[idx1][idx2] * dImpulse; + var _g2 = 0; + var _g3 = this.numUnbounded; + while(_g2 < _g3) { + var idx2 = this.iUnbounded[_g2++]; + this.b[idx2] -= invMassWithoutCfm[idx][idx2] * dImpulse; } } } var indices = this.iUnbounded; var n = this.numUnbounded; var id = 0; - var _g4 = 0; - while(_g4 < n) id |= 1 << indices[_g4++]; + var _g = 0; + while(_g < n) id |= 1 << indices[_g++]; var massMatrix; if(mass._cacheComputed[id]) { massMatrix = mass._cachedSubmatrices[id]; @@ -37349,25 +37462,25 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { massMatrix = mass._cachedSubmatrices[id]; } var ok = true; - var _g41 = 0; - var _g5 = this.numUnbounded; - while(_g41 < _g5) { - var i1 = _g41++; - var idx3 = this.iUnbounded[i1]; - var row2 = info.rows[idx3]; - var oldImpulse = impulses[idx3]; + var _g = 0; + var _g1 = this.numUnbounded; + while(_g < _g1) { + var i = _g++; + var idx = this.iUnbounded[i]; + var row = info.rows[idx]; + var oldImpulse = impulses[idx]; var impulse = oldImpulse; - var _g42 = 0; - var _g51 = this.numUnbounded; - while(_g42 < _g51) { - var j = _g42++; - impulse += this.b[this.iUnbounded[j]] * massMatrix[i1][j]; + var _g2 = 0; + var _g3 = this.numUnbounded; + while(_g2 < _g3) { + var j = _g2++; + impulse += this.b[this.iUnbounded[j]] * massMatrix[i][j]; } - if(impulse < row2.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row2.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { + if(impulse < row.minImpulse - oimo_common_Setting.directMlcpSolverEps || impulse > row.maxImpulse + oimo_common_Setting.directMlcpSolverEps) { ok = false; break; } - dImpulses[idx3] = impulse - oldImpulse; + dImpulses[idx] = impulse - oldImpulse; } if(noCheck) { return true; @@ -37375,24 +37488,24 @@ oimo_dynamics_constraint_solver_direct_Boundary.prototype = { if(!ok) { return false; } - var _g6 = 0; - var _g7 = this.numBounded; - while(_g6 < _g7) { - var i2 = _g6++; - var idx4 = this.iBounded[i2]; - var row3 = info.rows[idx4]; - var sign1 = this.signs[i2]; + var _g = 0; + var _g1 = this.numBounded; + while(_g < _g1) { + var i = _g++; + var idx = this.iBounded[i]; + var row = info.rows[idx]; + var sign = this.signs[i]; var error = 0; - var newImpulse = impulses[idx4] + dImpulses[idx4]; - var relVel = relVels[idx4]; - var _g61 = 0; - var _g71 = info.numRows; - while(_g61 < _g71) { - var j1 = _g61++; - relVel += invMassWithoutCfm[idx4][j1] * dImpulses[j1]; - } - error = row3.rhs * impulseFactor - relVel - row3.cfm * newImpulse; - if(sign1 < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign1 > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { + var newImpulse = impulses[idx] + dImpulses[idx]; + var relVel = relVels[idx]; + var _g2 = 0; + var _g3 = info.numRows; + while(_g2 < _g3) { + var j = _g2++; + relVel += invMassWithoutCfm[idx][j] * dImpulses[j]; + } + error = row.rhs * impulseFactor - relVel - row.cfm * newImpulse; + if(sign < 0 && error > oimo_common_Setting.directMlcpSolverEps || sign > 0 && error < -oimo_common_Setting.directMlcpSolverEps) { ok = false; break; } @@ -37441,24 +37554,24 @@ oimo_dynamics_constraint_solver_direct_BoundaryBuilder.prototype = { this.bbInfo.numBounded--; return; } - var _this1 = this.bbInfo; - _this1.iUnbounded[_this1.numUnbounded] = i; - _this1.numUnbounded++; + var _this = this.bbInfo; + _this.iUnbounded[_this.numUnbounded] = i; + _this.numUnbounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numUnbounded--; if(lowerLimitEnabled) { - var _this2 = this.bbInfo; - _this2.iBounded[_this2.numBounded] = i; - _this2.signs[_this2.numBounded] = -1; - _this2.numBounded++; + var _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = -1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } if(upperLimitEnabled) { - var _this3 = this.bbInfo; - _this3.iBounded[_this3.numBounded] = i; - _this3.signs[_this3.numBounded] = 1; - _this3.numBounded++; + var _this = this.bbInfo; + _this.iBounded[_this.numBounded] = i; + _this.signs[_this.numBounded] = 1; + _this.numBounded++; this.buildBoundariesRecursive(info,i + 1); this.bbInfo.numBounded--; } @@ -37536,9 +37649,9 @@ var oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver = functio this.impulses = new Array(maxRows); this.dImpulses = new Array(maxRows); this.dTotalImpulses = new Array(maxRows); - var _g2 = 0; - while(_g2 < maxRows) { - var i = _g2++; + var _g = 0; + while(_g < maxRows) { + var i = _g++; this.relVels[i] = 0; this.impulses[i] = 0; this.dImpulses[i] = 0; @@ -37560,25 +37673,25 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.velBoundarySelector; + var _this = this.velBoundarySelector; var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; var _g = 0; - var _g1 = _this2.n; + var _g1 = _this.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + var idx = _this.indices[_g++]; if(idx < size) { - _this2.tmpIndices[numSmaller] = idx; + _this.tmpIndices[numSmaller] = idx; ++numSmaller; } else { - _this2.tmpIndices[size + numGreater] = idx; + _this.tmpIndices[size + numGreater] = idx; ++numGreater; } } - var tmp = _this2.indices; - _this2.indices = _this2.tmpIndices; - _this2.tmpIndices = tmp; + var tmp = _this.indices; + _this.indices = _this.tmpIndices; + _this.tmpIndices = tmp; } ,warmStart: function(timeStep) { var factor = this.joint._positionCorrectionAlgorithm == oimo_dynamics_constraint_PositionCorrectionAlgorithm.BAUMGARTE ? oimo_common_Setting.jointWarmStartingFactorForBaungarte : oimo_common_Setting.jointWarmStartingFactor; @@ -37594,10 +37707,10 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } return; } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i = _g2++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var row = this.info.rows[i]; var imp = row.impulse; var impulse = imp.impulse * factor; @@ -37648,29 +37761,29 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g3 = 0; - var _g12 = this.info.numRows; - while(_g3 < _g12) { - var i1 = _g3++; - var j = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp1 = impulses[i1]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var j = this.info.rows[i].jacobian; + var md = this.massData[i]; + var imp = impulses[i]; if((j.flag & 1) != 0) { - lv1X += md.invMLin1X * imp1; - lv1Y += md.invMLin1Y * imp1; - lv1Z += md.invMLin1Z * imp1; - lv2X += md.invMLin2X * -imp1; - lv2Y += md.invMLin2Y * -imp1; - lv2Z += md.invMLin2Z * -imp1; + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } if((j.flag & 2) != 0) { - av1X += md.invMAng1X * imp1; - av1Y += md.invMAng1Y * imp1; - av1Z += md.invMAng1Z * imp1; - av2X += md.invMAng2X * -imp1; - av2Y += md.invMAng2Y * -imp1; - av2Z += md.invMAng2Z * -imp1; + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } @@ -37732,15 +37845,15 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this.dTotalImpulses[i] = 0; } var invMass = this.massMatrix._invMassWithoutCfm; - var _g2 = 0; - while(_g2 < numRows) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var imp = row1.impulse; - if(row1.motorMaxImpulse > 0) { + var _g = 0; + while(_g < numRows) { + var i = _g++; + var row = this.info.rows[i]; + var imp = row.impulse; + if(row.motorMaxImpulse > 0) { var oldImpulseM = imp.impulseM; - var impulseM = oldImpulseM + this.massData[i1].massWithoutCfm * (-row1.motorSpeed - this.relVels[i1]); - var maxImpulseM = row1.motorMaxImpulse; + var impulseM = oldImpulseM + this.massData[i].massWithoutCfm * (-row.motorSpeed - this.relVels[i]); + var maxImpulseM = row.motorMaxImpulse; if(impulseM < -maxImpulseM) { impulseM = -maxImpulseM; } else if(impulseM > maxImpulseM) { @@ -37748,106 +37861,104 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ } imp.impulseM = impulseM; var dImpulseM = impulseM - oldImpulseM; - this.dTotalImpulses[i1] = dImpulseM; - var _g21 = 0; - while(_g21 < numRows) { - var j1 = _g21++; - var _g3 = this.relVels; - _g3[j1] = _g3[j1] + dImpulseM * invMass[i1][j1]; + this.dTotalImpulses[i] = dImpulseM; + var _g1 = 0; + while(_g1 < numRows) { + var j = _g1++; + this.relVels[j] += dImpulseM * invMass[i][j]; } } } var solved = false; - var _g4 = 0; - var _g5 = this.boundaryBuilder.numBoundaries; - while(_g4 < _g5) { - var idx = this.velBoundarySelector.indices[_g4++]; + var _g = 0; + var _g1 = this.boundaryBuilder.numBoundaries; + while(_g < _g1) { + var idx = this.velBoundarySelector.indices[_g++]; if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,1,false)) { - var _g41 = 0; - while(_g41 < numRows) { - var j2 = _g41++; - var dimp = this.dImpulses[j2]; - this.info.rows[j2].impulse.impulse += dimp; - var _g51 = this.dTotalImpulses; - _g51[j2] = _g51[j2] + dimp; + var _g2 = 0; + while(_g2 < numRows) { + var j = _g2++; + var dimp = this.dImpulses[j]; + this.info.rows[j].impulse.impulse += dimp; + this.dTotalImpulses[j] += dimp; } var impulses = this.dTotalImpulses; var linearSet = false; var angularSet = false; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av1X1; - var av1Y1; - var av1Z1; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._velX; - lv1Y1 = this._b1._velY; - lv1Z1 = this._b1._velZ; - lv2X1 = this._b2._velX; - lv2Y1 = this._b2._velY; - lv2Z1 = this._b2._velZ; - av1X1 = this._b1._angVelX; - av1Y1 = this._b1._angVelY; - av1Z1 = this._b1._angVelZ; - av2X1 = this._b2._angVelX; - av2Y1 = this._b2._angVelY; - av2Z1 = this._b2._angVelZ; - var _g1 = 0; - var _g11 = this.info.numRows; - while(_g1 < _g11) { - var i2 = _g1++; - var j3 = this.info.rows[i2].jacobian; - var md = this.massData[i2]; - var imp1 = impulses[i2]; - if((j3.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp1; - lv1Y1 += md.invMLin1Y * imp1; - lv1Z1 += md.invMLin1Z * imp1; - lv2X1 += md.invMLin2X * -imp1; - lv2Y1 += md.invMLin2Y * -imp1; - lv2Z1 += md.invMLin2Z * -imp1; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._velX; + lv1Y = this._b1._velY; + lv1Z = this._b1._velZ; + lv2X = this._b2._velX; + lv2Y = this._b2._velY; + lv2Z = this._b2._velZ; + av1X = this._b1._angVelX; + av1Y = this._b1._angVelY; + av1Z = this._b1._angVelZ; + av2X = this._b2._angVelX; + av2Y = this._b2._angVelY; + av2Z = this._b2._angVelZ; + var _g3 = 0; + var _g4 = this.info.numRows; + while(_g3 < _g4) { + var i = _g3++; + var j1 = this.info.rows[i].jacobian; + var md = this.massData[i]; + var imp = impulses[i]; + if((j1.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j3.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp1; - av1Y1 += md.invMAng1Y * imp1; - av1Z1 += md.invMAng1Z * imp1; - av2X1 += md.invMAng2X * -imp1; - av2Y1 += md.invMAng2Y * -imp1; - av2Z1 += md.invMAng2Z * -imp1; + if((j1.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._velX = lv1X1; - this._b1._velY = lv1Y1; - this._b1._velZ = lv1Z1; - this._b2._velX = lv2X1; - this._b2._velY = lv2Y1; - this._b2._velZ = lv2Z1; + this._b1._velX = lv1X; + this._b1._velY = lv1Y; + this._b1._velZ = lv1Z; + this._b2._velX = lv2X; + this._b2._velY = lv2Y; + this._b2._velZ = lv2Z; } if(angularSet) { - this._b1._angVelX = av1X1; - this._b1._angVelY = av1Y1; - this._b1._angVelZ = av1Z1; - this._b2._angVelX = av2X1; - this._b2._angVelY = av2Y1; - this._b2._angVelZ = av2Z1; + this._b1._angVelX = av1X; + this._b1._angVelY = av1Y; + this._b1._angVelZ = av1Z; + this._b2._angVelX = av2X; + this._b2._angVelY = av2Y; + this._b2._angVelZ = av2Z; } var _this = this.velBoundarySelector; - var i3 = 0; - while(_this.indices[i3] != idx) ++i3; - while(i3 > 0) { - var tmp = _this.indices[i3]; - _this.indices[i3] = _this.indices[i3 - 1]; - _this.indices[i3 - 1] = tmp; - --i3; + var i1 = 0; + while(_this.indices[i1] != idx) ++i1; + while(i1 > 0) { + var tmp = _this.indices[i1]; + _this.indices[i1] = _this.indices[i1 - 1]; + _this.indices[i1 - 1] = tmp; + --i1; } solved = true; break; @@ -37906,28 +38017,28 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; + var _this = this.posBoundarySelector; var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; var _g = 0; - var _g1 = _this2.n; + var _g1 = _this.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + var idx = _this.indices[_g++]; if(idx < size) { - _this2.tmpIndices[numSmaller] = idx; + _this.tmpIndices[numSmaller] = idx; ++numSmaller; } else { - _this2.tmpIndices[size + numGreater] = idx; + _this.tmpIndices[size + numGreater] = idx; ++numGreater; } } - var tmp = _this2.indices; - _this2.indices = _this2.tmpIndices; - _this2.tmpIndices = tmp; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + var tmp = _this.indices; + _this.indices = _this.tmpIndices; + _this.tmpIndices = tmp; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) this.info.rows[_g++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { var numRows = this.info.numRows; @@ -37969,93 +38080,93 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ this.impulses[i] = row.impulse.impulseP; } var solved = false; - var _g2 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g2 < _g3) { - var idx = this.posBoundarySelector.indices[_g2++]; + var _g = 0; + var _g1 = this.boundaryBuilder.numBoundaries; + while(_g < _g1) { + var idx = this.posBoundarySelector.indices[_g++]; if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionSplitImpulseBaumgarte,false)) { - var _g21 = 0; - while(_g21 < numRows) { - var j1 = _g21++; - this.info.rows[j1].impulse.impulseP += this.dImpulses[j1]; + var _g2 = 0; + while(_g2 < numRows) { + var j = _g2++; + this.info.rows[j].impulse.impulseP += this.dImpulses[j]; } var impulses = this.dImpulses; var linearSet = false; var angularSet = false; - var lv1X1; - var lv1Y1; - var lv1Z1; - var lv2X1; - var lv2Y1; - var lv2Z1; - var av1X1; - var av1Y1; - var av1Z1; - var av2X1; - var av2Y1; - var av2Z1; - lv1X1 = this._b1._pseudoVelX; - lv1Y1 = this._b1._pseudoVelY; - lv1Z1 = this._b1._pseudoVelZ; - lv2X1 = this._b2._pseudoVelX; - lv2Y1 = this._b2._pseudoVelY; - lv2Z1 = this._b2._pseudoVelZ; - av1X1 = this._b1._angPseudoVelX; - av1Y1 = this._b1._angPseudoVelY; - av1Z1 = this._b1._angPseudoVelZ; - av2X1 = this._b2._angPseudoVelX; - av2Y1 = this._b2._angPseudoVelY; - av2Z1 = this._b2._angPseudoVelZ; - var _g1 = 0; - var _g11 = this.info.numRows; - while(_g1 < _g11) { - var i1 = _g1++; - var j2 = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp = impulses[i1]; - if((j2.flag & 1) != 0) { - lv1X1 += md.invMLin1X * imp; - lv1Y1 += md.invMLin1Y * imp; - lv1Z1 += md.invMLin1Z * imp; - lv2X1 += md.invMLin2X * -imp; - lv2Y1 += md.invMLin2Y * -imp; - lv2Z1 += md.invMLin2Z * -imp; + var lv1X; + var lv1Y; + var lv1Z; + var lv2X; + var lv2Y; + var lv2Z; + var av1X; + var av1Y; + var av1Z; + var av2X; + var av2Y; + var av2Z; + lv1X = this._b1._pseudoVelX; + lv1Y = this._b1._pseudoVelY; + lv1Z = this._b1._pseudoVelZ; + lv2X = this._b2._pseudoVelX; + lv2Y = this._b2._pseudoVelY; + lv2Z = this._b2._pseudoVelZ; + av1X = this._b1._angPseudoVelX; + av1Y = this._b1._angPseudoVelY; + av1Z = this._b1._angPseudoVelZ; + av2X = this._b2._angPseudoVelX; + av2Y = this._b2._angPseudoVelY; + av2Z = this._b2._angPseudoVelZ; + var _g3 = 0; + var _g4 = this.info.numRows; + while(_g3 < _g4) { + var i = _g3++; + var j1 = this.info.rows[i].jacobian; + var md = this.massData[i]; + var imp = impulses[i]; + if((j1.flag & 1) != 0) { + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } - if((j2.flag & 2) != 0) { - av1X1 += md.invMAng1X * imp; - av1Y1 += md.invMAng1Y * imp; - av1Z1 += md.invMAng1Z * imp; - av2X1 += md.invMAng2X * -imp; - av2Y1 += md.invMAng2Y * -imp; - av2Z1 += md.invMAng2Z * -imp; + if((j1.flag & 2) != 0) { + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - this._b1._pseudoVelX = lv1X1; - this._b1._pseudoVelY = lv1Y1; - this._b1._pseudoVelZ = lv1Z1; - this._b2._pseudoVelX = lv2X1; - this._b2._pseudoVelY = lv2Y1; - this._b2._pseudoVelZ = lv2Z1; + this._b1._pseudoVelX = lv1X; + this._b1._pseudoVelY = lv1Y; + this._b1._pseudoVelZ = lv1Z; + this._b2._pseudoVelX = lv2X; + this._b2._pseudoVelY = lv2Y; + this._b2._pseudoVelZ = lv2Z; } if(angularSet) { - this._b1._angPseudoVelX = av1X1; - this._b1._angPseudoVelY = av1Y1; - this._b1._angPseudoVelZ = av1Z1; - this._b2._angPseudoVelX = av2X1; - this._b2._angPseudoVelY = av2Y1; - this._b2._angPseudoVelZ = av2Z1; + this._b1._angPseudoVelX = av1X; + this._b1._angPseudoVelY = av1Y; + this._b1._angPseudoVelZ = av1Z; + this._b2._angPseudoVelX = av2X; + this._b2._angPseudoVelY = av2Y; + this._b2._angPseudoVelZ = av2Z; } var _this = this.posBoundarySelector; - var i2 = 0; - while(_this.indices[i2] != idx) ++i2; - while(i2 > 0) { - var tmp = _this.indices[i2]; - _this.indices[i2] = _this.indices[i2 - 1]; - _this.indices[i2 - 1] = tmp; - --i2; + var i1 = 0; + while(_this.indices[i1] != idx) ++i1; + while(i1 > 0) { + var tmp = _this.indices[i1]; + _this.indices[i1] = _this.indices[i1 - 1]; + _this.indices[i1 - 1] = tmp; + --i1; } solved = true; break; @@ -38078,42 +38189,42 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ _this1.numBounded = 0; _this1.numUnbounded = 0; _this.buildBoundariesRecursive(this.info,0); - var _this2 = this.posBoundarySelector; + var _this = this.posBoundarySelector; var size = this.boundaryBuilder.numBoundaries; var numSmaller = 0; var numGreater = 0; var _g = 0; - var _g1 = _this2.n; + var _g1 = _this.n; while(_g < _g1) { - var idx = _this2.indices[_g++]; + var idx = _this.indices[_g++]; if(idx < size) { - _this2.tmpIndices[numSmaller] = idx; + _this.tmpIndices[numSmaller] = idx; ++numSmaller; } else { - _this2.tmpIndices[size + numGreater] = idx; + _this.tmpIndices[size + numGreater] = idx; ++numGreater; } } - var tmp = _this2.indices; - _this2.indices = _this2.tmpIndices; - _this2.tmpIndices = tmp; + var tmp = _this.indices; + _this.indices = _this.tmpIndices; + _this.tmpIndices = tmp; var numRows = this.info.numRows; - var _g2 = 0; - while(_g2 < numRows) { - var i = _g2++; + var _g = 0; + while(_g < numRows) { + var i = _g++; var imp = this.info.rows[i].impulse; this.relVels[i] = 0; this.impulses[i] = imp.impulseP; } var solved = false; - var _g21 = 0; - var _g3 = this.boundaryBuilder.numBoundaries; - while(_g21 < _g3) { - var idx1 = this.posBoundarySelector.indices[_g21++]; - if(this.boundaryBuilder.boundaries[idx1].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { - var _g22 = 0; - while(_g22 < numRows) { - var j = _g22++; + var _g = 0; + var _g1 = this.boundaryBuilder.numBoundaries; + while(_g < _g1) { + var idx = this.posBoundarySelector.indices[_g++]; + if(this.boundaryBuilder.boundaries[idx].computeImpulses(this.info,this.massMatrix,this.relVels,this.impulses,this.dImpulses,oimo_common_Setting.positionNgsBaumgarte,false)) { + var _g2 = 0; + while(_g2 < numRows) { + var j = _g2++; this.info.rows[j].impulse.impulseP += this.dImpulses[j]; } var impulses = this.dImpulses; @@ -38143,44 +38254,44 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ av2X = 0; av2Y = 0; av2Z = 0; - var _g4 = 0; - var _g11 = this.info.numRows; - while(_g4 < _g11) { - var i1 = _g4++; - var j1 = this.info.rows[i1].jacobian; - var md = this.massData[i1]; - var imp1 = impulses[i1]; + var _g3 = 0; + var _g4 = this.info.numRows; + while(_g3 < _g4) { + var i = _g3++; + var j1 = this.info.rows[i].jacobian; + var md = this.massData[i]; + var imp = impulses[i]; if((j1.flag & 1) != 0) { - lv1X += md.invMLin1X * imp1; - lv1Y += md.invMLin1Y * imp1; - lv1Z += md.invMLin1Z * imp1; - lv2X += md.invMLin2X * -imp1; - lv2Y += md.invMLin2Y * -imp1; - lv2Z += md.invMLin2Z * -imp1; + lv1X += md.invMLin1X * imp; + lv1Y += md.invMLin1Y * imp; + lv1Z += md.invMLin1Z * imp; + lv2X += md.invMLin2X * -imp; + lv2Y += md.invMLin2Y * -imp; + lv2Z += md.invMLin2Z * -imp; linearSet = true; } if((j1.flag & 2) != 0) { - av1X += md.invMAng1X * imp1; - av1Y += md.invMAng1Y * imp1; - av1Z += md.invMAng1Z * imp1; - av2X += md.invMAng2X * -imp1; - av2Y += md.invMAng2Y * -imp1; - av2Z += md.invMAng2Z * -imp1; + av1X += md.invMAng1X * imp; + av1Y += md.invMAng1Y * imp; + av1Z += md.invMAng1Z * imp; + av2X += md.invMAng2X * -imp; + av2Y += md.invMAng2Y * -imp; + av2Z += md.invMAng2Z * -imp; angularSet = true; } } if(linearSet) { - var _this3 = this._b1; - _this3._transform._positionX += lv1X; - _this3._transform._positionY += lv1Y; - _this3._transform._positionZ += lv1Z; - var _this4 = this._b2; - _this4._transform._positionX += lv2X; - _this4._transform._positionY += lv2Y; - _this4._transform._positionZ += lv2Z; + var _this = this._b1; + _this._transform._positionX += lv1X; + _this._transform._positionY += lv1Y; + _this._transform._positionZ += lv1Z; + var _this1 = this._b2; + _this1._transform._positionX += lv2X; + _this1._transform._positionY += lv2Y; + _this1._transform._positionZ += lv2Z; } if(angularSet) { - var _this5 = this._b1; + var _this2 = this._b1; var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); var halfTheta = theta * 0.5; var rotationToSinAxisFactor; @@ -38211,48 +38322,48 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var qY; var qZ; var qW; - var e00 = _this5._transform._rotation00; - var e11 = _this5._transform._rotation11; - var e22 = _this5._transform._rotation22; + var e00 = _this2._transform._rotation00; + var e11 = _this2._transform._rotation11; + var e22 = _this2._transform._rotation22; var t = e00 + e11 + e22; var s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; - qY = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; - qZ = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; } else if(e00 > e11) { if(e00 > e22) { s = Math.sqrt(e00 - e11 - e22 + 1); qX = 0.5 * s; s = 0.5 / s; - qY = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qW = (_this5._transform._rotation21 - _this5._transform._rotation12) * s; + qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; } } else if(e11 > e22) { s = Math.sqrt(e11 - e22 - e00 + 1); qY = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation01 + _this5._transform._rotation10) * s; - qZ = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation02 - _this5._transform._rotation20) * s; + qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; + qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this5._transform._rotation02 + _this5._transform._rotation20) * s; - qY = (_this5._transform._rotation12 + _this5._transform._rotation21) * s; - qW = (_this5._transform._rotation10 - _this5._transform._rotation01) * s; + qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; + qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; + qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; } qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; @@ -38282,15 +38393,15 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var wx = w * x2; var wy = w * y2; var wz = w * z2; - _this5._transform._rotation00 = 1 - yy - zz; - _this5._transform._rotation01 = xy - wz; - _this5._transform._rotation02 = xz + wy; - _this5._transform._rotation10 = xy + wz; - _this5._transform._rotation11 = 1 - xx - zz; - _this5._transform._rotation12 = yz - wx; - _this5._transform._rotation20 = xz - wy; - _this5._transform._rotation21 = yz + wx; - _this5._transform._rotation22 = 1 - xx - yy; + _this2._transform._rotation00 = 1 - yy - zz; + _this2._transform._rotation01 = xy - wz; + _this2._transform._rotation02 = xz + wy; + _this2._transform._rotation10 = xy + wz; + _this2._transform._rotation11 = 1 - xx - zz; + _this2._transform._rotation12 = yz - wx; + _this2._transform._rotation20 = xz - wy; + _this2._transform._rotation21 = yz + wx; + _this2._transform._rotation22 = 1 - xx - yy; var __tmp__00; var __tmp__01; var __tmp__02; @@ -38300,24 +38411,24 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = _this5._transform._rotation00 * _this5._invLocalInertia00 + _this5._transform._rotation01 * _this5._invLocalInertia10 + _this5._transform._rotation02 * _this5._invLocalInertia20; - __tmp__01 = _this5._transform._rotation00 * _this5._invLocalInertia01 + _this5._transform._rotation01 * _this5._invLocalInertia11 + _this5._transform._rotation02 * _this5._invLocalInertia21; - __tmp__02 = _this5._transform._rotation00 * _this5._invLocalInertia02 + _this5._transform._rotation01 * _this5._invLocalInertia12 + _this5._transform._rotation02 * _this5._invLocalInertia22; - __tmp__10 = _this5._transform._rotation10 * _this5._invLocalInertia00 + _this5._transform._rotation11 * _this5._invLocalInertia10 + _this5._transform._rotation12 * _this5._invLocalInertia20; - __tmp__11 = _this5._transform._rotation10 * _this5._invLocalInertia01 + _this5._transform._rotation11 * _this5._invLocalInertia11 + _this5._transform._rotation12 * _this5._invLocalInertia21; - __tmp__12 = _this5._transform._rotation10 * _this5._invLocalInertia02 + _this5._transform._rotation11 * _this5._invLocalInertia12 + _this5._transform._rotation12 * _this5._invLocalInertia22; - __tmp__20 = _this5._transform._rotation20 * _this5._invLocalInertia00 + _this5._transform._rotation21 * _this5._invLocalInertia10 + _this5._transform._rotation22 * _this5._invLocalInertia20; - __tmp__21 = _this5._transform._rotation20 * _this5._invLocalInertia01 + _this5._transform._rotation21 * _this5._invLocalInertia11 + _this5._transform._rotation22 * _this5._invLocalInertia21; - __tmp__22 = _this5._transform._rotation20 * _this5._invLocalInertia02 + _this5._transform._rotation21 * _this5._invLocalInertia12 + _this5._transform._rotation22 * _this5._invLocalInertia22; - _this5._invInertia00 = __tmp__00; - _this5._invInertia01 = __tmp__01; - _this5._invInertia02 = __tmp__02; - _this5._invInertia10 = __tmp__10; - _this5._invInertia11 = __tmp__11; - _this5._invInertia12 = __tmp__12; - _this5._invInertia20 = __tmp__20; - _this5._invInertia21 = __tmp__21; - _this5._invInertia22 = __tmp__22; + __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; + __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; + __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; + __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; + __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; + __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; + __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; + __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; + __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; + _this2._invInertia00 = __tmp__00; + _this2._invInertia01 = __tmp__01; + _this2._invInertia02 = __tmp__02; + _this2._invInertia10 = __tmp__10; + _this2._invInertia11 = __tmp__11; + _this2._invInertia12 = __tmp__12; + _this2._invInertia20 = __tmp__20; + _this2._invInertia21 = __tmp__21; + _this2._invInertia22 = __tmp__22; var __tmp__001; var __tmp__011; var __tmp__021; @@ -38327,34 +38438,34 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var __tmp__201; var __tmp__211; var __tmp__221; - __tmp__001 = _this5._invInertia00 * _this5._transform._rotation00 + _this5._invInertia01 * _this5._transform._rotation01 + _this5._invInertia02 * _this5._transform._rotation02; - __tmp__011 = _this5._invInertia00 * _this5._transform._rotation10 + _this5._invInertia01 * _this5._transform._rotation11 + _this5._invInertia02 * _this5._transform._rotation12; - __tmp__021 = _this5._invInertia00 * _this5._transform._rotation20 + _this5._invInertia01 * _this5._transform._rotation21 + _this5._invInertia02 * _this5._transform._rotation22; - __tmp__101 = _this5._invInertia10 * _this5._transform._rotation00 + _this5._invInertia11 * _this5._transform._rotation01 + _this5._invInertia12 * _this5._transform._rotation02; - __tmp__111 = _this5._invInertia10 * _this5._transform._rotation10 + _this5._invInertia11 * _this5._transform._rotation11 + _this5._invInertia12 * _this5._transform._rotation12; - __tmp__121 = _this5._invInertia10 * _this5._transform._rotation20 + _this5._invInertia11 * _this5._transform._rotation21 + _this5._invInertia12 * _this5._transform._rotation22; - __tmp__201 = _this5._invInertia20 * _this5._transform._rotation00 + _this5._invInertia21 * _this5._transform._rotation01 + _this5._invInertia22 * _this5._transform._rotation02; - __tmp__211 = _this5._invInertia20 * _this5._transform._rotation10 + _this5._invInertia21 * _this5._transform._rotation11 + _this5._invInertia22 * _this5._transform._rotation12; - __tmp__221 = _this5._invInertia20 * _this5._transform._rotation20 + _this5._invInertia21 * _this5._transform._rotation21 + _this5._invInertia22 * _this5._transform._rotation22; - _this5._invInertia00 = __tmp__001; - _this5._invInertia01 = __tmp__011; - _this5._invInertia02 = __tmp__021; - _this5._invInertia10 = __tmp__101; - _this5._invInertia11 = __tmp__111; - _this5._invInertia12 = __tmp__121; - _this5._invInertia20 = __tmp__201; - _this5._invInertia21 = __tmp__211; - _this5._invInertia22 = __tmp__221; - _this5._invInertia00 *= _this5._rotFactor.x; - _this5._invInertia01 *= _this5._rotFactor.x; - _this5._invInertia02 *= _this5._rotFactor.x; - _this5._invInertia10 *= _this5._rotFactor.y; - _this5._invInertia11 *= _this5._rotFactor.y; - _this5._invInertia12 *= _this5._rotFactor.y; - _this5._invInertia20 *= _this5._rotFactor.z; - _this5._invInertia21 *= _this5._rotFactor.z; - _this5._invInertia22 *= _this5._rotFactor.z; - var _this6 = this._b2; + __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; + __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; + __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; + __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; + __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; + __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; + __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; + __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; + __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; + _this2._invInertia00 = __tmp__001; + _this2._invInertia01 = __tmp__011; + _this2._invInertia02 = __tmp__021; + _this2._invInertia10 = __tmp__101; + _this2._invInertia11 = __tmp__111; + _this2._invInertia12 = __tmp__121; + _this2._invInertia20 = __tmp__201; + _this2._invInertia21 = __tmp__211; + _this2._invInertia22 = __tmp__221; + _this2._invInertia00 *= _this2._rotFactor.x; + _this2._invInertia01 *= _this2._rotFactor.x; + _this2._invInertia02 *= _this2._rotFactor.x; + _this2._invInertia10 *= _this2._rotFactor.y; + _this2._invInertia11 *= _this2._rotFactor.y; + _this2._invInertia12 *= _this2._rotFactor.y; + _this2._invInertia20 *= _this2._rotFactor.z; + _this2._invInertia21 *= _this2._rotFactor.z; + _this2._invInertia22 *= _this2._rotFactor.z; + var _this3 = this._b2; var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); var halfTheta1 = theta1 * 0.5; var rotationToSinAxisFactor1; @@ -38385,48 +38496,48 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var qY1; var qZ1; var qW1; - var e001 = _this6._transform._rotation00; - var e111 = _this6._transform._rotation11; - var e221 = _this6._transform._rotation22; + var e001 = _this3._transform._rotation00; + var e111 = _this3._transform._rotation11; + var e221 = _this3._transform._rotation22; var t1 = e001 + e111 + e221; var s1; if(t1 > 0) { s1 = Math.sqrt(t1 + 1); qW1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; - qY1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; - qZ1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; } else if(e001 > e111) { if(e001 > e221) { s1 = Math.sqrt(e001 - e111 - e221 + 1); qX1 = 0.5 * s1; s1 = 0.5 / s1; - qY1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qW1 = (_this6._transform._rotation21 - _this6._transform._rotation12) * s1; + qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; } } else if(e111 > e221) { s1 = Math.sqrt(e111 - e221 - e001 + 1); qY1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation01 + _this6._transform._rotation10) * s1; - qZ1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation02 - _this6._transform._rotation20) * s1; + qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; + qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; } else { s1 = Math.sqrt(e221 - e001 - e111 + 1); qZ1 = 0.5 * s1; s1 = 0.5 / s1; - qX1 = (_this6._transform._rotation02 + _this6._transform._rotation20) * s1; - qY1 = (_this6._transform._rotation12 + _this6._transform._rotation21) * s1; - qW1 = (_this6._transform._rotation10 - _this6._transform._rotation01) * s1; + qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; + qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; + qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; } qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; @@ -38456,15 +38567,15 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var wx1 = w1 * x21; var wy1 = w1 * y21; var wz1 = w1 * z21; - _this6._transform._rotation00 = 1 - yy1 - zz1; - _this6._transform._rotation01 = xy1 - wz1; - _this6._transform._rotation02 = xz1 + wy1; - _this6._transform._rotation10 = xy1 + wz1; - _this6._transform._rotation11 = 1 - xx1 - zz1; - _this6._transform._rotation12 = yz1 - wx1; - _this6._transform._rotation20 = xz1 - wy1; - _this6._transform._rotation21 = yz1 + wx1; - _this6._transform._rotation22 = 1 - xx1 - yy1; + _this3._transform._rotation00 = 1 - yy1 - zz1; + _this3._transform._rotation01 = xy1 - wz1; + _this3._transform._rotation02 = xz1 + wy1; + _this3._transform._rotation10 = xy1 + wz1; + _this3._transform._rotation11 = 1 - xx1 - zz1; + _this3._transform._rotation12 = yz1 - wx1; + _this3._transform._rotation20 = xz1 - wy1; + _this3._transform._rotation21 = yz1 + wx1; + _this3._transform._rotation22 = 1 - xx1 - yy1; var __tmp__002; var __tmp__012; var __tmp__022; @@ -38474,24 +38585,24 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var __tmp__202; var __tmp__212; var __tmp__222; - __tmp__002 = _this6._transform._rotation00 * _this6._invLocalInertia00 + _this6._transform._rotation01 * _this6._invLocalInertia10 + _this6._transform._rotation02 * _this6._invLocalInertia20; - __tmp__012 = _this6._transform._rotation00 * _this6._invLocalInertia01 + _this6._transform._rotation01 * _this6._invLocalInertia11 + _this6._transform._rotation02 * _this6._invLocalInertia21; - __tmp__022 = _this6._transform._rotation00 * _this6._invLocalInertia02 + _this6._transform._rotation01 * _this6._invLocalInertia12 + _this6._transform._rotation02 * _this6._invLocalInertia22; - __tmp__102 = _this6._transform._rotation10 * _this6._invLocalInertia00 + _this6._transform._rotation11 * _this6._invLocalInertia10 + _this6._transform._rotation12 * _this6._invLocalInertia20; - __tmp__112 = _this6._transform._rotation10 * _this6._invLocalInertia01 + _this6._transform._rotation11 * _this6._invLocalInertia11 + _this6._transform._rotation12 * _this6._invLocalInertia21; - __tmp__122 = _this6._transform._rotation10 * _this6._invLocalInertia02 + _this6._transform._rotation11 * _this6._invLocalInertia12 + _this6._transform._rotation12 * _this6._invLocalInertia22; - __tmp__202 = _this6._transform._rotation20 * _this6._invLocalInertia00 + _this6._transform._rotation21 * _this6._invLocalInertia10 + _this6._transform._rotation22 * _this6._invLocalInertia20; - __tmp__212 = _this6._transform._rotation20 * _this6._invLocalInertia01 + _this6._transform._rotation21 * _this6._invLocalInertia11 + _this6._transform._rotation22 * _this6._invLocalInertia21; - __tmp__222 = _this6._transform._rotation20 * _this6._invLocalInertia02 + _this6._transform._rotation21 * _this6._invLocalInertia12 + _this6._transform._rotation22 * _this6._invLocalInertia22; - _this6._invInertia00 = __tmp__002; - _this6._invInertia01 = __tmp__012; - _this6._invInertia02 = __tmp__022; - _this6._invInertia10 = __tmp__102; - _this6._invInertia11 = __tmp__112; - _this6._invInertia12 = __tmp__122; - _this6._invInertia20 = __tmp__202; - _this6._invInertia21 = __tmp__212; - _this6._invInertia22 = __tmp__222; + __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; + __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; + __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; + __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; + __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; + __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; + __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; + __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; + __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; + _this3._invInertia00 = __tmp__002; + _this3._invInertia01 = __tmp__012; + _this3._invInertia02 = __tmp__022; + _this3._invInertia10 = __tmp__102; + _this3._invInertia11 = __tmp__112; + _this3._invInertia12 = __tmp__122; + _this3._invInertia20 = __tmp__202; + _this3._invInertia21 = __tmp__212; + _this3._invInertia22 = __tmp__222; var __tmp__003; var __tmp__013; var __tmp__023; @@ -38501,42 +38612,42 @@ oimo_dynamics_constraint_solver_direct_DirectJointConstraintSolver.prototype = $ var __tmp__203; var __tmp__213; var __tmp__223; - __tmp__003 = _this6._invInertia00 * _this6._transform._rotation00 + _this6._invInertia01 * _this6._transform._rotation01 + _this6._invInertia02 * _this6._transform._rotation02; - __tmp__013 = _this6._invInertia00 * _this6._transform._rotation10 + _this6._invInertia01 * _this6._transform._rotation11 + _this6._invInertia02 * _this6._transform._rotation12; - __tmp__023 = _this6._invInertia00 * _this6._transform._rotation20 + _this6._invInertia01 * _this6._transform._rotation21 + _this6._invInertia02 * _this6._transform._rotation22; - __tmp__103 = _this6._invInertia10 * _this6._transform._rotation00 + _this6._invInertia11 * _this6._transform._rotation01 + _this6._invInertia12 * _this6._transform._rotation02; - __tmp__113 = _this6._invInertia10 * _this6._transform._rotation10 + _this6._invInertia11 * _this6._transform._rotation11 + _this6._invInertia12 * _this6._transform._rotation12; - __tmp__123 = _this6._invInertia10 * _this6._transform._rotation20 + _this6._invInertia11 * _this6._transform._rotation21 + _this6._invInertia12 * _this6._transform._rotation22; - __tmp__203 = _this6._invInertia20 * _this6._transform._rotation00 + _this6._invInertia21 * _this6._transform._rotation01 + _this6._invInertia22 * _this6._transform._rotation02; - __tmp__213 = _this6._invInertia20 * _this6._transform._rotation10 + _this6._invInertia21 * _this6._transform._rotation11 + _this6._invInertia22 * _this6._transform._rotation12; - __tmp__223 = _this6._invInertia20 * _this6._transform._rotation20 + _this6._invInertia21 * _this6._transform._rotation21 + _this6._invInertia22 * _this6._transform._rotation22; - _this6._invInertia00 = __tmp__003; - _this6._invInertia01 = __tmp__013; - _this6._invInertia02 = __tmp__023; - _this6._invInertia10 = __tmp__103; - _this6._invInertia11 = __tmp__113; - _this6._invInertia12 = __tmp__123; - _this6._invInertia20 = __tmp__203; - _this6._invInertia21 = __tmp__213; - _this6._invInertia22 = __tmp__223; - _this6._invInertia00 *= _this6._rotFactor.x; - _this6._invInertia01 *= _this6._rotFactor.x; - _this6._invInertia02 *= _this6._rotFactor.x; - _this6._invInertia10 *= _this6._rotFactor.y; - _this6._invInertia11 *= _this6._rotFactor.y; - _this6._invInertia12 *= _this6._rotFactor.y; - _this6._invInertia20 *= _this6._rotFactor.z; - _this6._invInertia21 *= _this6._rotFactor.z; - _this6._invInertia22 *= _this6._rotFactor.z; - } - var _this7 = this.posBoundarySelector; - var i2 = 0; - while(_this7.indices[i2] != idx1) ++i2; - while(i2 > 0) { - var tmp1 = _this7.indices[i2]; - _this7.indices[i2] = _this7.indices[i2 - 1]; - _this7.indices[i2 - 1] = tmp1; - --i2; + __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; + __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; + __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; + __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; + __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; + __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; + __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; + __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; + __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; + _this3._invInertia00 = __tmp__003; + _this3._invInertia01 = __tmp__013; + _this3._invInertia02 = __tmp__023; + _this3._invInertia10 = __tmp__103; + _this3._invInertia11 = __tmp__113; + _this3._invInertia12 = __tmp__123; + _this3._invInertia20 = __tmp__203; + _this3._invInertia21 = __tmp__213; + _this3._invInertia22 = __tmp__223; + _this3._invInertia00 *= _this3._rotFactor.x; + _this3._invInertia01 *= _this3._rotFactor.x; + _this3._invInertia02 *= _this3._rotFactor.x; + _this3._invInertia10 *= _this3._rotFactor.y; + _this3._invInertia11 *= _this3._rotFactor.y; + _this3._invInertia12 *= _this3._rotFactor.y; + _this3._invInertia20 *= _this3._rotFactor.z; + _this3._invInertia21 *= _this3._rotFactor.z; + _this3._invInertia22 *= _this3._rotFactor.z; + } + var _this4 = this.posBoundarySelector; + var i1 = 0; + while(_this4.indices[i1] != idx) ++i1; + while(i1 > 0) { + var tmp = _this4.indices[i1]; + _this4.indices[i1] = _this4.indices[i1 - 1]; + _this4.indices[i1 - 1] = tmp; + --i1; } solved = true; break; @@ -38566,8 +38677,8 @@ var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { this._invMass[i] = new Array(this._size); this._invMassWithoutCfm[i] = new Array(this._size); var _g2 = 0; - var _g11 = this._size; - while(_g2 < _g11) { + var _g3 = this._size; + while(_g2 < _g3) { var j = _g2++; this.tmpMatrix[i][j] = 0; this._invMass[i][j] = 0; @@ -38577,25 +38688,25 @@ var oimo_dynamics_constraint_solver_direct_MassMatrix = function(size) { this._maxSubmatrixId = 1 << this._size; this._cacheComputed = new Array(this._maxSubmatrixId); this._cachedSubmatrices = new Array(this._maxSubmatrixId); - var _g21 = 0; - var _g3 = this._maxSubmatrixId; - while(_g21 < _g3) { - var i1 = _g21++; - var t = i1; - t = (i1 & 85) + (i1 >> 1 & 85); + var _g = 0; + var _g1 = this._maxSubmatrixId; + while(_g < _g1) { + var i = _g++; + var t = i; + t = (i & 85) + (i >> 1 & 85); t = (t & 51) + (t >> 2 & 51); t = (t & 15) + (t >> 4 & 15); var matrixSize = t; var subMatrix = new Array(matrixSize); - var _g22 = 0; - while(_g22 < matrixSize) { - var j1 = _g22++; - subMatrix[j1] = new Array(matrixSize); - var _g23 = 0; - while(_g23 < matrixSize) subMatrix[j1][_g23++] = 0; + var _g2 = 0; + while(_g2 < matrixSize) { + var j = _g2++; + subMatrix[j] = new Array(matrixSize); + var _g3 = 0; + while(_g3 < matrixSize) subMatrix[j][_g3++] = 0; } - this._cacheComputed[i1] = false; - this._cachedSubmatrices[i1] = subMatrix; + this._cacheComputed[i] = false; + this._cachedSubmatrices[i] = subMatrix; } }; oimo_dynamics_constraint_solver_direct_MassMatrix.__name__ = true; @@ -38624,92 +38735,92 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -38725,162 +38836,162 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -38901,261 +39012,261 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dsti = dst[0]; diag = 1 / srci[0]; dsti[0] = diag; - srci[1] = srci[1] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + srci[1] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[1]; dstj = dst[1]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[2]; dstj = dst[2]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[3]; dstj = dst[3]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[4]; dstj = dst[4]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srcj = src[5]; dstj = dst[5]; dstj[0] = -diag * srcj[0]; - srcj[1] = srcj[1] - srci[1] * srcj[0]; - srcj[2] = srcj[2] - srci[2] * srcj[0]; - srcj[3] = srcj[3] - srci[3] * srcj[0]; - srcj[4] = srcj[4] - srci[4] * srcj[0]; - srcj[5] = srcj[5] - srci[5] * srcj[0]; + srcj[1] -= srci[1] * srcj[0]; + srcj[2] -= srci[2] * srcj[0]; + srcj[3] -= srci[3] * srcj[0]; + srcj[4] -= srci[4] * srcj[0]; + srcj[5] -= srci[5] * srcj[0]; srci = src[1]; dsti = dst[1]; diag = 1 / srci[1]; dsti[1] = diag; - dsti[0] = dsti[0] * diag; - srci[2] = srci[2] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + srci[2] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[1]; + dstj[0] -= dsti[0] * srcj[1]; dstj[1] = -diag * srcj[1]; - srcj[2] = srcj[2] - srci[2] * srcj[1]; - srcj[3] = srcj[3] - srci[3] * srcj[1]; - srcj[4] = srcj[4] - srci[4] * srcj[1]; - srcj[5] = srcj[5] - srci[5] * srcj[1]; + srcj[2] -= srci[2] * srcj[1]; + srcj[3] -= srci[3] * srcj[1]; + srcj[4] -= srci[4] * srcj[1]; + srcj[5] -= srci[5] * srcj[1]; srci = src[2]; dsti = dst[2]; diag = 1 / srci[2]; dsti[2] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - srci[3] = srci[3] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + srci[3] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[2]; - dstj[1] = dstj[1] - dsti[1] * srcj[2]; + dstj[0] -= dsti[0] * srcj[2]; + dstj[1] -= dsti[1] * srcj[2]; dstj[2] = -diag * srcj[2]; - srcj[3] = srcj[3] - srci[3] * srcj[2]; - srcj[4] = srcj[4] - srci[4] * srcj[2]; - srcj[5] = srcj[5] - srci[5] * srcj[2]; + srcj[3] -= srci[3] * srcj[2]; + srcj[4] -= srci[4] * srcj[2]; + srcj[5] -= srci[5] * srcj[2]; srci = src[3]; dsti = dst[3]; diag = 1 / srci[3]; dsti[3] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - srci[4] = srci[4] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + srci[4] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[3]; - dstj[1] = dstj[1] - dsti[1] * srcj[3]; - dstj[2] = dstj[2] - dsti[2] * srcj[3]; + dstj[0] -= dsti[0] * srcj[3]; + dstj[1] -= dsti[1] * srcj[3]; + dstj[2] -= dsti[2] * srcj[3]; dstj[3] = -diag * srcj[3]; - srcj[4] = srcj[4] - srci[4] * srcj[3]; - srcj[5] = srcj[5] - srci[5] * srcj[3]; + srcj[4] -= srci[4] * srcj[3]; + srcj[5] -= srci[5] * srcj[3]; srci = src[4]; dsti = dst[4]; diag = 1 / srci[4]; dsti[4] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - srci[5] = srci[5] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + srci[5] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srcj = src[5]; dstj = dst[5]; - dstj[0] = dstj[0] - dsti[0] * srcj[4]; - dstj[1] = dstj[1] - dsti[1] * srcj[4]; - dstj[2] = dstj[2] - dsti[2] * srcj[4]; - dstj[3] = dstj[3] - dsti[3] * srcj[4]; + dstj[0] -= dsti[0] * srcj[4]; + dstj[1] -= dsti[1] * srcj[4]; + dstj[2] -= dsti[2] * srcj[4]; + dstj[3] -= dsti[3] * srcj[4]; dstj[4] = -diag * srcj[4]; - srcj[5] = srcj[5] - srci[5] * srcj[4]; + srcj[5] -= srci[5] * srcj[4]; srci = src[5]; dsti = dst[5]; diag = 1 / srci[5]; dsti[5] = diag; - dsti[0] = dsti[0] * diag; - dsti[1] = dsti[1] * diag; - dsti[2] = dsti[2] * diag; - dsti[3] = dsti[3] * diag; - dsti[4] = dsti[4] * diag; + dsti[0] *= diag; + dsti[1] *= diag; + dsti[2] *= diag; + dsti[3] *= diag; + dsti[4] *= diag; srcj = src[0]; dstj = dst[0]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; srcj = src[1]; dstj = dst[1]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; srcj = src[2]; dstj = dst[2]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; srcj = src[3]; dstj = dst[3]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; srcj = src[4]; dstj = dst[4]; - dstj[0] = dstj[0] - dsti[0] * srcj[5]; - dstj[1] = dstj[1] - dsti[1] * srcj[5]; - dstj[2] = dstj[2] - dsti[2] * srcj[5]; - dstj[3] = dstj[3] - dsti[3] * srcj[5]; - dstj[4] = dstj[4] - dsti[4] * srcj[5]; + dstj[0] -= dsti[0] * srcj[5]; + dstj[1] -= dsti[1] * srcj[5]; + dstj[2] -= dsti[2] * srcj[5]; + dstj[3] -= dsti[3] * srcj[5]; + dstj[4] -= dsti[4] * srcj[5]; dsti = dst[1]; dst[0][1] = dsti[0]; dsti = dst[2]; @@ -39178,66 +39289,60 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { dst[4][5] = dsti[4]; break; default: - var _g2 = 0; - while(_g2 < size) { - var i1 = _g2++; - srci = src[i1]; - dsti = dst[i1]; - var diag1 = 1 / srci[i1]; - dsti[i1] = diag1; - var _g21 = 0; - while(_g21 < i1) { - var j1 = _g21++; - dsti[j1] = dsti[j1] * diag1; - } - var _g4 = i1 + 1; - while(_g4 < size) { - var j2 = _g4++; - srci[j2] = srci[j2] * diag1; - } - var _g6 = 0; - while(_g6 < i1) { - var j3 = _g6++; - srcj = src[j3]; - dstj = dst[j3]; - var _g61 = 0; - var _g7 = j3 + 1; - while(_g61 < _g7) { - var k = _g61++; - dstj[k] = dstj[k] - dsti[k] * srcj[i1]; + var _g = 0; + while(_g < size) { + var i = _g++; + srci = src[i]; + dsti = dst[i]; + var diag = 1 / srci[i]; + dsti[i] = diag; + var _g1 = 0; + while(_g1 < i) dsti[_g1++] *= diag; + var _g2 = i + 1; + while(_g2 < size) srci[_g2++] *= diag; + var _g3 = 0; + while(_g3 < i) { + var j = _g3++; + srcj = src[j]; + dstj = dst[j]; + var _g4 = 0; + var _g5 = j + 1; + while(_g4 < _g5) { + var k = _g4++; + dstj[k] -= dsti[k] * srcj[i]; } - var _g8 = i1 + 1; - while(_g8 < size) { - var k1 = _g8++; - srcj[k1] = srcj[k1] - srci[k1] * srcj[i1]; + var _g6 = i + 1; + while(_g6 < size) { + var k1 = _g6++; + srcj[k1] -= srci[k1] * srcj[i]; } } - var _g81 = i1 + 1; - while(_g81 < size) { - var j4 = _g81++; - srcj = src[j4]; - dstj = dst[j4]; - var _g82 = 0; - while(_g82 < i1) { - var k2 = _g82++; - dstj[k2] = dstj[k2] - dsti[k2] * srcj[i1]; + var _g7 = i + 1; + while(_g7 < size) { + var j1 = _g7++; + srcj = src[j1]; + dstj = dst[j1]; + var _g8 = 0; + while(_g8 < i) { + var k2 = _g8++; + dstj[k2] -= dsti[k2] * srcj[i]; } - dstj[i1] = -diag1 * srcj[i1]; - var _g10 = i1 + 1; - while(_g10 < size) { - var k3 = _g10++; - srcj[k3] = srcj[k3] - srci[k3] * srcj[i1]; + dstj[i] = -diag * srcj[i]; + var _g9 = i + 1; + while(_g9 < size) { + var k3 = _g9++; + srcj[k3] -= srci[k3] * srcj[i]; } } } - var _g41 = 1; - while(_g41 < size) { - var i2 = _g41++; - dsti = dst[i2]; - var _g42 = 0; - while(_g42 < i2) { - var j5 = _g42++; - dst[j5][i2] = dsti[j5]; + var _g = 1; + while(_g < size) { + var i = _g++; + dsti = dst[i]; + var _g1 = 0; + while(_g1 < i) { + var j = _g1++; + dst[j][i] = dsti[j]; } } } @@ -39335,19 +39440,19 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md.invMAng2Z = 0; } } - var _g2 = 0; - while(_g2 < numRows) { - var i1 = _g2++; - var j1 = info.rows[i1].jacobian; - var _g21 = i1; - while(_g21 < numRows) { - var j2 = _g21++; - var md2 = massData[j2]; + var _g = 0; + while(_g < numRows) { + var i = _g++; + var j1 = info.rows[i].jacobian; + var _g1 = i; + while(_g1 < numRows) { + var j = _g1++; + var md2 = massData[j]; var val = j1.lin1X * md2.invMLin1X + j1.lin1Y * md2.invMLin1Y + j1.lin1Z * md2.invMLin1Z + (j1.ang1X * md2.invMAng1X + j1.ang1Y * md2.invMAng1Y + j1.ang1Z * md2.invMAng1Z) + (j1.lin2X * md2.invMLin2X + j1.lin2Y * md2.invMLin2Y + j1.lin2Z * md2.invMLin2Z) + (j1.ang2X * md2.invMAng2X + j1.ang2Y * md2.invMAng2Y + j1.ang2Z * md2.invMAng2Z); - if(i1 == j2) { - invMass[i1][j2] = val + info.rows[i1].cfm; - invMassWithoutCfm[i1][j2] = val; - md2.mass = val + info.rows[i1].cfm; + if(i == j) { + invMass[i][j] = val + info.rows[i].cfm; + invMassWithoutCfm[i][j] = val; + md2.mass = val + info.rows[i].cfm; md2.massWithoutCfm = val; if(md2.mass != 0) { md2.mass = 1 / md2.mass; @@ -39356,16 +39461,16 @@ oimo_dynamics_constraint_solver_direct_MassMatrix.prototype = { md2.massWithoutCfm = 1 / md2.massWithoutCfm; } } else { - invMass[i1][j2] = val; - invMass[j2][i1] = val; - invMassWithoutCfm[i1][j2] = val; - invMassWithoutCfm[j2][i1] = val; + invMass[i][j] = val; + invMass[j][i] = val; + invMassWithoutCfm[i][j] = val; + invMassWithoutCfm[j][i] = val; } } } - var _g1 = 0; - var _g11 = this._maxSubmatrixId; - while(_g1 < _g11) this._cacheComputed[_g1++] = false; + var _g = 0; + var _g1 = this._maxSubmatrixId; + while(_g < _g1) this._cacheComputed[_g++] = false; } ,__class__: oimo_dynamics_constraint_solver_direct_MassMatrix }; @@ -39702,38 +39807,38 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2Y += md.invMAngB2Y * -impulseB; av2Z += md.invMAngB2Z * -impulseB; } - var _g2 = 0; - var _g3 = this.info.numRows; - while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; var rvn = 0; - var j1 = row1.jacobianN; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseN = (row1.rhs - rvn) * md1.massN; - var oldImpulseN = imp1.impulseN; - imp1.impulseN += impulseN; - if(imp1.impulseN < 0) { - imp1.impulseN = 0; - } - impulseN = imp1.impulseN - oldImpulseN; - lv1X += md1.invMLinN1X * impulseN; - lv1Y += md1.invMLinN1Y * impulseN; - lv1Z += md1.invMLinN1Z * impulseN; - lv2X += md1.invMLinN2X * -impulseN; - lv2Y += md1.invMLinN2Y * -impulseN; - lv2Z += md1.invMLinN2Z * -impulseN; - av1X += md1.invMAngN1X * impulseN; - av1Y += md1.invMAngN1Y * impulseN; - av1Z += md1.invMAngN1Z * impulseN; - av2X += md1.invMAngN2X * -impulseN; - av2Y += md1.invMAngN2Y * -impulseN; - av2Z += md1.invMAngN2Z * -impulseN; + var j = row.jacobianN; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseN = (row.rhs - rvn) * md.massN; + var oldImpulseN = imp.impulseN; + imp.impulseN += impulseN; + if(imp.impulseN < 0) { + imp.impulseN = 0; + } + impulseN = imp.impulseN - oldImpulseN; + lv1X += md.invMLinN1X * impulseN; + lv1Y += md.invMLinN1Y * impulseN; + lv1Z += md.invMLinN1Z * impulseN; + lv2X += md.invMLinN2X * -impulseN; + lv2Y += md.invMLinN2Y * -impulseN; + lv2Z += md.invMLinN2Z * -impulseN; + av1X += md.invMAngN1X * impulseN; + av1Y += md.invMAngN1Y * impulseN; + av1Z += md.invMAngN1Z * impulseN; + av2X += md.invMAngN2X * -impulseN; + av2Y += md.invMAngN2Y * -impulseN; + av2Z += md.invMAngN2Z * -impulseN; } this._b1._velX = lv1X; this._b1._velY = lv1Y; @@ -39824,9 +39929,9 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte md.massN = 1 / md.massN; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) this.info.rows[_g++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { var lv1X; @@ -39999,48 +40104,48 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row = this.info.rows[i1]; - var md1 = this.massData[i1]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; var imp = row.impulse; - var j1 = row.jacobianN; + var j = row.jacobianN; var rvn = 0; - rvn += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rvn -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rvn += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rvn -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row.rhs - rvn) * md1.massN * oimo_common_Setting.positionNgsBaumgarte; + rvn += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rvn -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rvn += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rvn -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs - rvn) * md.massN * oimo_common_Setting.positionNgsBaumgarte; var oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < 0) { imp.impulseP = 0; } impulseP = imp.impulseP - oldImpulseP; - lv1X += md1.invMLinN1X * impulseP; - lv1Y += md1.invMLinN1Y * impulseP; - lv1Z += md1.invMLinN1Z * impulseP; - lv2X += md1.invMLinN2X * -impulseP; - lv2Y += md1.invMLinN2Y * -impulseP; - lv2Z += md1.invMLinN2Z * -impulseP; - av1X += md1.invMAngN1X * impulseP; - av1Y += md1.invMAngN1Y * impulseP; - av1Z += md1.invMAngN1Z * impulseP; - av2X += md1.invMAngN2X * -impulseP; - av2Y += md1.invMAngN2Y * -impulseP; - av2Z += md1.invMAngN2Z * -impulseP; + lv1X += md.invMLinN1X * impulseP; + lv1Y += md.invMLinN1Y * impulseP; + lv1Z += md.invMLinN1Z * impulseP; + lv2X += md.invMLinN2X * -impulseP; + lv2Y += md.invMLinN2Y * -impulseP; + lv2Z += md.invMLinN2Z * -impulseP; + av1X += md.invMAngN1X * impulseP; + av1Y += md.invMAngN1Y * impulseP; + av1Z += md.invMAngN1Z * impulseP; + av2X += md.invMAngN2X * -impulseP; + av2Y += md.invMAngN2Y * -impulseP; + av2Z += md.invMAngN2Z * -impulseP; } var _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; - _this1._transform._positionX += lv2X; - _this1._transform._positionY += lv2Y; - _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; + var _this = this._b2; + _this._transform._positionX += lv2X; + _this._transform._positionY += lv2Y; + _this._transform._positionZ += lv2Z; + var _this = this._b1; var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); var halfTheta = theta * 0.5; var rotationToSinAxisFactor; @@ -40071,48 +40176,48 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var qY; var qZ; var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; + var e00 = _this._transform._rotation00; + var e11 = _this._transform._rotation11; + var e22 = _this._transform._rotation22; var t = e00 + e11 + e22; var s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; - qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; - qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; } else if(e00 > e11) { if(e00 > e22) { s = Math.sqrt(e00 - e11 - e22 + 1); qX = 0.5 * s; s = 0.5 / s; - qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; - qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } } else if(e11 > e22) { s = Math.sqrt(e11 - e22 - e00 + 1); qY = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; - qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; @@ -40142,15 +40247,15 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var wx = w * x2; var wy = w * y2; var wz = w * z2; - _this2._transform._rotation00 = 1 - yy - zz; - _this2._transform._rotation01 = xy - wz; - _this2._transform._rotation02 = xz + wy; - _this2._transform._rotation10 = xy + wz; - _this2._transform._rotation11 = 1 - xx - zz; - _this2._transform._rotation12 = yz - wx; - _this2._transform._rotation20 = xz - wy; - _this2._transform._rotation21 = yz + wx; - _this2._transform._rotation22 = 1 - xx - yy; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; var __tmp__00; var __tmp__01; var __tmp__02; @@ -40160,234 +40265,234 @@ oimo_dynamics_constraint_solver_pgs_PgsContactConstraintSolver.prototype = $exte var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; - __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; - __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; - __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; - __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; - __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; - __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; - __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; - __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; - _this2._invInertia00 = __tmp__00; - _this2._invInertia01 = __tmp__01; - _this2._invInertia02 = __tmp__02; - _this2._invInertia10 = __tmp__10; - _this2._invInertia11 = __tmp__11; - _this2._invInertia12 = __tmp__12; - _this2._invInertia20 = __tmp__20; - _this2._invInertia21 = __tmp__21; - _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; - __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; - __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; - __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; - __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; - __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; - __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; - __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; - __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; - _this2._invInertia00 = __tmp__001; - _this2._invInertia01 = __tmp__011; - _this2._invInertia02 = __tmp__021; - _this2._invInertia10 = __tmp__101; - _this2._invInertia11 = __tmp__111; - _this2._invInertia12 = __tmp__121; - _this2._invInertia20 = __tmp__201; - _this2._invInertia21 = __tmp__211; - _this2._invInertia22 = __tmp__221; - _this2._invInertia00 *= _this2._rotFactor.x; - _this2._invInertia01 *= _this2._rotFactor.x; - _this2._invInertia02 *= _this2._rotFactor.x; - _this2._invInertia10 *= _this2._rotFactor.y; - _this2._invInertia11 *= _this2._rotFactor.y; - _this2._invInertia12 *= _this2._rotFactor.y; - _this2._invInertia20 *= _this2._rotFactor.z; - _this2._invInertia21 *= _this2._rotFactor.z; - _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; - if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__01 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__02 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__10 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__11 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__12 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__20 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__21 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__22 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; + var _this = this._b2; + var theta = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { - rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; - cosHalfTheta1 = Math.cos(halfTheta1); - } - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; - sinAxisX1 = av2X * rotationToSinAxisFactor1; - sinAxisY1 = av2Y * rotationToSinAxisFactor1; - sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; - dqX1 = sinAxisX1; - dqY1 = sinAxisY1; - dqZ1 = sinAxisZ1; - dqW1 = cosHalfTheta1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; - if(t1 > 0) { - s1 = Math.sqrt(t1 + 1); - qW1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; - qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; - qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } else if(e001 > e111) { - if(e001 > e221) { - s1 = Math.sqrt(e001 - e111 - e221 + 1); - qX1 = 0.5 * s1; - s1 = 0.5 / s1; - qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; - qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av2X * rotationToSinAxisFactor; + sinAxisY = av2Y * rotationToSinAxisFactor; + sinAxisZ = av2Z * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this._transform._rotation00; + var e11 = _this._transform._rotation11; + var e22 = _this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { - s1 = Math.sqrt(e221 - e001 - e111 + 1); - qZ1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } - } else if(e111 > e221) { - s1 = Math.sqrt(e111 - e221 - e001 + 1); - qY1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; - qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { - s1 = Math.sqrt(e221 - e001 - e111 + 1); - qZ1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } - qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; - qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; - qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; - qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - qX1 *= l1; - qY1 *= l1; - qZ1 *= l1; - qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; - _this3._transform._rotation00 = 1 - yy1 - zz1; - _this3._transform._rotation01 = xy1 - wz1; - _this3._transform._rotation02 = xz1 + wy1; - _this3._transform._rotation10 = xy1 + wz1; - _this3._transform._rotation11 = 1 - xx1 - zz1; - _this3._transform._rotation12 = yz1 - wx1; - _this3._transform._rotation20 = xz1 - wy1; - _this3._transform._rotation21 = yz1 + wx1; - _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; - __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; - __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; - __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; - __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; - __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; - __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; - __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; - __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; - _this3._invInertia00 = __tmp__002; - _this3._invInertia01 = __tmp__012; - _this3._invInertia02 = __tmp__022; - _this3._invInertia10 = __tmp__102; - _this3._invInertia11 = __tmp__112; - _this3._invInertia12 = __tmp__122; - _this3._invInertia20 = __tmp__202; - _this3._invInertia21 = __tmp__212; - _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; - __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; - __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; - __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; - __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; - __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; - __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; - __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; - __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; - _this3._invInertia00 = __tmp__003; - _this3._invInertia01 = __tmp__013; - _this3._invInertia02 = __tmp__023; - _this3._invInertia10 = __tmp__103; - _this3._invInertia11 = __tmp__113; - _this3._invInertia12 = __tmp__123; - _this3._invInertia20 = __tmp__203; - _this3._invInertia21 = __tmp__213; - _this3._invInertia22 = __tmp__223; - _this3._invInertia00 *= _this3._rotFactor.x; - _this3._invInertia01 *= _this3._rotFactor.x; - _this3._invInertia02 *= _this3._rotFactor.x; - _this3._invInertia10 *= _this3._rotFactor.y; - _this3._invInertia11 *= _this3._rotFactor.y; - _this3._invInertia12 *= _this3._rotFactor.y; - _this3._invInertia20 *= _this3._rotFactor.z; - _this3._invInertia21 *= _this3._rotFactor.z; - _this3._invInertia22 *= _this3._rotFactor.z; + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__01 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__02 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__10 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__11 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__12 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__20 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__21 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__22 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; } ,postSolve: function() { var lin1X; @@ -40631,10 +40736,10 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = this._b2._angVelX; av2Y = this._b2._angVelY; av2Z = this._b2._angVelZ; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i = _g2++; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; var md = this.massData[i]; var imp = this.info.rows[i].impulse; imp.impulse *= factor; @@ -40733,43 +40838,43 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2Z += md.invMAng2Z * -impulseM; } } - var _g2 = 0; - var _g3 = this.info.numRows; - while(_g2 < _g3) { - var i1 = _g2++; - var row1 = this.info.rows[i1]; - var md1 = this.massData[i1]; - var imp1 = row1.impulse; - var j1 = row1.jacobian; - var rv1 = 0; - rv1 += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv1 -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv1 += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv1 -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulse = (row1.rhs - rv1 - imp1.impulse * row1.cfm) * md1.mass; - var oldImpulse = imp1.impulse; - imp1.impulse += impulse; - if(imp1.impulse < row1.minImpulse) { - imp1.impulse = row1.minImpulse; - } else if(imp1.impulse > row1.maxImpulse) { - imp1.impulse = row1.maxImpulse; - } - impulse = imp1.impulse - oldImpulse; - if((j1.flag & 1) != 0) { - lv1X += md1.invMLin1X * impulse; - lv1Y += md1.invMLin1Y * impulse; - lv1Z += md1.invMLin1Z * impulse; - lv2X += md1.invMLin2X * -impulse; - lv2Y += md1.invMLin2Y * -impulse; - lv2Z += md1.invMLin2Z * -impulse; - } - if((j1.flag & 2) != 0) { - av1X += md1.invMAng1X * impulse; - av1Y += md1.invMAng1Y * impulse; - av1Z += md1.invMAng1Z * impulse; - av2X += md1.invMAng2X * -impulse; - av2Y += md1.invMAng2Y * -impulse; - av2Z += md1.invMAng2Z * -impulse; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; + var imp = row.impulse; + var j = row.jacobian; + var rv = 0; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulse = (row.rhs - rv - imp.impulse * row.cfm) * md.mass; + var oldImpulse = imp.impulse; + imp.impulse += impulse; + if(imp.impulse < row.minImpulse) { + imp.impulse = row.minImpulse; + } else if(imp.impulse > row.maxImpulse) { + imp.impulse = row.maxImpulse; + } + impulse = imp.impulse - oldImpulse; + if((j.flag & 1) != 0) { + lv1X += md.invMLin1X * impulse; + lv1Y += md.invMLin1Y * impulse; + lv1Z += md.invMLin1Z * impulse; + lv2X += md.invMLin2X * -impulse; + lv2Y += md.invMLin2Y * -impulse; + lv2Z += md.invMLin2Z * -impulse; + } + if((j.flag & 2) != 0) { + av1X += md.invMAng1X * impulse; + av1Y += md.invMAng1Y * impulse; + av1Z += md.invMAng1Z * impulse; + av2X += md.invMAng2X * -impulse; + av2Y += md.invMAng2Y * -impulse; + av2Z += md.invMAng2Z * -impulse; } } this._b1._velX = lv1X; @@ -40899,9 +41004,9 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend md.mass = 1 / md.mass; } } - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) this.info.rows[_g2++].impulse.impulseP = 0; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) this.info.rows[_g++].impulse.impulseP = 0; } ,solvePositionSplitImpulse: function() { var lv1X; @@ -41078,20 +41183,20 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend av2X = 0; av2Y = 0; av2Z = 0; - var _g2 = 0; - var _g11 = this.info.numRows; - while(_g2 < _g11) { - var i1 = _g2++; - var row = this.info.rows[i1]; - var md1 = this.massData[i1]; + var _g = 0; + var _g1 = this.info.numRows; + while(_g < _g1) { + var i = _g++; + var row = this.info.rows[i]; + var md = this.massData[i]; var imp = row.impulse; - var j1 = row.jacobian; + var j = row.jacobian; var rv = 0; - rv += lv1X * j1.lin1X + lv1Y * j1.lin1Y + lv1Z * j1.lin1Z; - rv -= lv2X * j1.lin2X + lv2Y * j1.lin2Y + lv2Z * j1.lin2Z; - rv += av1X * j1.ang1X + av1Y * j1.ang1Y + av1Z * j1.ang1Z; - rv -= av2X * j1.ang2X + av2Y * j1.ang2Y + av2Z * j1.ang2Z; - var impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md1.mass; + rv += lv1X * j.lin1X + lv1Y * j.lin1Y + lv1Z * j.lin1Z; + rv -= lv2X * j.lin2X + lv2Y * j.lin2Y + lv2Z * j.lin2Z; + rv += av1X * j.ang1X + av1Y * j.ang1Y + av1Z * j.ang1Z; + rv -= av2X * j.ang2X + av2Y * j.ang2Y + av2Z * j.ang2Z; + var impulseP = (row.rhs * oimo_common_Setting.positionNgsBaumgarte - rv) * md.mass; var oldImpulseP = imp.impulseP; imp.impulseP += impulseP; if(imp.impulseP < row.minImpulse) { @@ -41100,28 +41205,28 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend imp.impulseP = row.maxImpulse; } impulseP = imp.impulseP - oldImpulseP; - lv1X += md1.invMLin1X * impulseP; - lv1Y += md1.invMLin1Y * impulseP; - lv1Z += md1.invMLin1Z * impulseP; - lv2X += md1.invMLin2X * -impulseP; - lv2Y += md1.invMLin2Y * -impulseP; - lv2Z += md1.invMLin2Z * -impulseP; - av1X += md1.invMAng1X * impulseP; - av1Y += md1.invMAng1Y * impulseP; - av1Z += md1.invMAng1Z * impulseP; - av2X += md1.invMAng2X * -impulseP; - av2Y += md1.invMAng2Y * -impulseP; - av2Z += md1.invMAng2Z * -impulseP; + lv1X += md.invMLin1X * impulseP; + lv1Y += md.invMLin1Y * impulseP; + lv1Z += md.invMLin1Z * impulseP; + lv2X += md.invMLin2X * -impulseP; + lv2Y += md.invMLin2Y * -impulseP; + lv2Z += md.invMLin2Z * -impulseP; + av1X += md.invMAng1X * impulseP; + av1Y += md.invMAng1Y * impulseP; + av1Z += md.invMAng1Z * impulseP; + av2X += md.invMAng2X * -impulseP; + av2Y += md.invMAng2Y * -impulseP; + av2Z += md.invMAng2Z * -impulseP; } var _this = this._b1; _this._transform._positionX += lv1X; _this._transform._positionY += lv1Y; _this._transform._positionZ += lv1Z; - var _this1 = this._b2; - _this1._transform._positionX += lv2X; - _this1._transform._positionY += lv2Y; - _this1._transform._positionZ += lv2Z; - var _this2 = this._b1; + var _this = this._b2; + _this._transform._positionX += lv2X; + _this._transform._positionY += lv2Y; + _this._transform._positionZ += lv2Z; + var _this = this._b1; var theta = Math.sqrt(av1X * av1X + av1Y * av1Y + av1Z * av1Z); var halfTheta = theta * 0.5; var rotationToSinAxisFactor; @@ -41152,48 +41257,48 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var qY; var qZ; var qW; - var e00 = _this2._transform._rotation00; - var e11 = _this2._transform._rotation11; - var e22 = _this2._transform._rotation22; + var e00 = _this._transform._rotation00; + var e11 = _this._transform._rotation11; + var e22 = _this._transform._rotation22; var t = e00 + e11 + e22; var s; if(t > 0) { s = Math.sqrt(t + 1); qW = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; - qY = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; - qZ = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; } else if(e00 > e11) { if(e00 > e22) { s = Math.sqrt(e00 - e11 - e22 + 1); qX = 0.5 * s; s = 0.5 / s; - qY = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; - qZ = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qW = (_this2._transform._rotation21 - _this2._transform._rotation12) * s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } } else if(e11 > e22) { s = Math.sqrt(e11 - e22 - e00 + 1); qY = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation01 + _this2._transform._rotation10) * s; - qZ = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation02 - _this2._transform._rotation20) * s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { s = Math.sqrt(e22 - e00 - e11 + 1); qZ = 0.5 * s; s = 0.5 / s; - qX = (_this2._transform._rotation02 + _this2._transform._rotation20) * s; - qY = (_this2._transform._rotation12 + _this2._transform._rotation21) * s; - qW = (_this2._transform._rotation10 - _this2._transform._rotation01) * s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; } qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; @@ -41223,15 +41328,15 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var wx = w * x2; var wy = w * y2; var wz = w * z2; - _this2._transform._rotation00 = 1 - yy - zz; - _this2._transform._rotation01 = xy - wz; - _this2._transform._rotation02 = xz + wy; - _this2._transform._rotation10 = xy + wz; - _this2._transform._rotation11 = 1 - xx - zz; - _this2._transform._rotation12 = yz - wx; - _this2._transform._rotation20 = xz - wy; - _this2._transform._rotation21 = yz + wx; - _this2._transform._rotation22 = 1 - xx - yy; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; var __tmp__00; var __tmp__01; var __tmp__02; @@ -41241,234 +41346,234 @@ oimo_dynamics_constraint_solver_pgs_PgsJointConstraintSolver.prototype = $extend var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = _this2._transform._rotation00 * _this2._invLocalInertia00 + _this2._transform._rotation01 * _this2._invLocalInertia10 + _this2._transform._rotation02 * _this2._invLocalInertia20; - __tmp__01 = _this2._transform._rotation00 * _this2._invLocalInertia01 + _this2._transform._rotation01 * _this2._invLocalInertia11 + _this2._transform._rotation02 * _this2._invLocalInertia21; - __tmp__02 = _this2._transform._rotation00 * _this2._invLocalInertia02 + _this2._transform._rotation01 * _this2._invLocalInertia12 + _this2._transform._rotation02 * _this2._invLocalInertia22; - __tmp__10 = _this2._transform._rotation10 * _this2._invLocalInertia00 + _this2._transform._rotation11 * _this2._invLocalInertia10 + _this2._transform._rotation12 * _this2._invLocalInertia20; - __tmp__11 = _this2._transform._rotation10 * _this2._invLocalInertia01 + _this2._transform._rotation11 * _this2._invLocalInertia11 + _this2._transform._rotation12 * _this2._invLocalInertia21; - __tmp__12 = _this2._transform._rotation10 * _this2._invLocalInertia02 + _this2._transform._rotation11 * _this2._invLocalInertia12 + _this2._transform._rotation12 * _this2._invLocalInertia22; - __tmp__20 = _this2._transform._rotation20 * _this2._invLocalInertia00 + _this2._transform._rotation21 * _this2._invLocalInertia10 + _this2._transform._rotation22 * _this2._invLocalInertia20; - __tmp__21 = _this2._transform._rotation20 * _this2._invLocalInertia01 + _this2._transform._rotation21 * _this2._invLocalInertia11 + _this2._transform._rotation22 * _this2._invLocalInertia21; - __tmp__22 = _this2._transform._rotation20 * _this2._invLocalInertia02 + _this2._transform._rotation21 * _this2._invLocalInertia12 + _this2._transform._rotation22 * _this2._invLocalInertia22; - _this2._invInertia00 = __tmp__00; - _this2._invInertia01 = __tmp__01; - _this2._invInertia02 = __tmp__02; - _this2._invInertia10 = __tmp__10; - _this2._invInertia11 = __tmp__11; - _this2._invInertia12 = __tmp__12; - _this2._invInertia20 = __tmp__20; - _this2._invInertia21 = __tmp__21; - _this2._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = _this2._invInertia00 * _this2._transform._rotation00 + _this2._invInertia01 * _this2._transform._rotation01 + _this2._invInertia02 * _this2._transform._rotation02; - __tmp__011 = _this2._invInertia00 * _this2._transform._rotation10 + _this2._invInertia01 * _this2._transform._rotation11 + _this2._invInertia02 * _this2._transform._rotation12; - __tmp__021 = _this2._invInertia00 * _this2._transform._rotation20 + _this2._invInertia01 * _this2._transform._rotation21 + _this2._invInertia02 * _this2._transform._rotation22; - __tmp__101 = _this2._invInertia10 * _this2._transform._rotation00 + _this2._invInertia11 * _this2._transform._rotation01 + _this2._invInertia12 * _this2._transform._rotation02; - __tmp__111 = _this2._invInertia10 * _this2._transform._rotation10 + _this2._invInertia11 * _this2._transform._rotation11 + _this2._invInertia12 * _this2._transform._rotation12; - __tmp__121 = _this2._invInertia10 * _this2._transform._rotation20 + _this2._invInertia11 * _this2._transform._rotation21 + _this2._invInertia12 * _this2._transform._rotation22; - __tmp__201 = _this2._invInertia20 * _this2._transform._rotation00 + _this2._invInertia21 * _this2._transform._rotation01 + _this2._invInertia22 * _this2._transform._rotation02; - __tmp__211 = _this2._invInertia20 * _this2._transform._rotation10 + _this2._invInertia21 * _this2._transform._rotation11 + _this2._invInertia22 * _this2._transform._rotation12; - __tmp__221 = _this2._invInertia20 * _this2._transform._rotation20 + _this2._invInertia21 * _this2._transform._rotation21 + _this2._invInertia22 * _this2._transform._rotation22; - _this2._invInertia00 = __tmp__001; - _this2._invInertia01 = __tmp__011; - _this2._invInertia02 = __tmp__021; - _this2._invInertia10 = __tmp__101; - _this2._invInertia11 = __tmp__111; - _this2._invInertia12 = __tmp__121; - _this2._invInertia20 = __tmp__201; - _this2._invInertia21 = __tmp__211; - _this2._invInertia22 = __tmp__221; - _this2._invInertia00 *= _this2._rotFactor.x; - _this2._invInertia01 *= _this2._rotFactor.x; - _this2._invInertia02 *= _this2._rotFactor.x; - _this2._invInertia10 *= _this2._rotFactor.y; - _this2._invInertia11 *= _this2._rotFactor.y; - _this2._invInertia12 *= _this2._rotFactor.y; - _this2._invInertia20 *= _this2._rotFactor.z; - _this2._invInertia21 *= _this2._rotFactor.z; - _this2._invInertia22 *= _this2._rotFactor.z; - var _this3 = this._b2; - var theta1 = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); - var halfTheta1 = theta1 * 0.5; - var rotationToSinAxisFactor1; - var cosHalfTheta1; - if(halfTheta1 < 0.5) { - var ht21 = halfTheta1 * halfTheta1; - rotationToSinAxisFactor1 = 0.5 * (1 - ht21 * 0.16666666666666666 + ht21 * ht21 * 0.0083333333333333332); - cosHalfTheta1 = 1 - ht21 * 0.5 + ht21 * ht21 * 0.041666666666666664; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__01 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__02 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__10 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__11 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__12 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__20 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__21 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__22 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; + var _this = this._b2; + var theta = Math.sqrt(av2X * av2X + av2Y * av2Y + av2Z * av2Z); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; } else { - rotationToSinAxisFactor1 = Math.sin(halfTheta1) / theta1; - cosHalfTheta1 = Math.cos(halfTheta1); - } - var sinAxisX1; - var sinAxisY1; - var sinAxisZ1; - sinAxisX1 = av2X * rotationToSinAxisFactor1; - sinAxisY1 = av2Y * rotationToSinAxisFactor1; - sinAxisZ1 = av2Z * rotationToSinAxisFactor1; - var dqX1; - var dqY1; - var dqZ1; - var dqW1; - dqX1 = sinAxisX1; - dqY1 = sinAxisY1; - dqZ1 = sinAxisZ1; - dqW1 = cosHalfTheta1; - var qX1; - var qY1; - var qZ1; - var qW1; - var e001 = _this3._transform._rotation00; - var e111 = _this3._transform._rotation11; - var e221 = _this3._transform._rotation22; - var t1 = e001 + e111 + e221; - var s1; - if(t1 > 0) { - s1 = Math.sqrt(t1 + 1); - qW1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; - qY1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; - qZ1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } else if(e001 > e111) { - if(e001 > e221) { - s1 = Math.sqrt(e001 - e111 - e221 + 1); - qX1 = 0.5 * s1; - s1 = 0.5 / s1; - qY1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; - qZ1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qW1 = (_this3._transform._rotation21 - _this3._transform._rotation12) * s1; + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = av2X * rotationToSinAxisFactor; + sinAxisY = av2Y * rotationToSinAxisFactor; + sinAxisZ = av2Z * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = _this._transform._rotation00; + var e11 = _this._transform._rotation11; + var e22 = _this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation21 - _this._transform._rotation12) * s; + qY = (_this._transform._rotation02 - _this._transform._rotation20) * s; + qZ = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qW = (_this._transform._rotation21 - _this._transform._rotation12) * s; } else { - s1 = Math.sqrt(e221 - e001 - e111 + 1); - qZ1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } - } else if(e111 > e221) { - s1 = Math.sqrt(e111 - e221 - e001 + 1); - qY1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation01 + _this3._transform._rotation10) * s1; - qZ1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation02 - _this3._transform._rotation20) * s1; + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation01 + _this._transform._rotation10) * s; + qZ = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation02 - _this._transform._rotation20) * s; } else { - s1 = Math.sqrt(e221 - e001 - e111 + 1); - qZ1 = 0.5 * s1; - s1 = 0.5 / s1; - qX1 = (_this3._transform._rotation02 + _this3._transform._rotation20) * s1; - qY1 = (_this3._transform._rotation12 + _this3._transform._rotation21) * s1; - qW1 = (_this3._transform._rotation10 - _this3._transform._rotation01) * s1; - } - qX1 = dqW1 * qX1 + dqX1 * qW1 + dqY1 * qZ1 - dqZ1 * qY1; - qY1 = dqW1 * qY1 - dqX1 * qZ1 + dqY1 * qW1 + dqZ1 * qX1; - qZ1 = dqW1 * qZ1 + dqX1 * qY1 - dqY1 * qX1 + dqZ1 * qW1; - qW1 = dqW1 * qW1 - dqX1 * qX1 - dqY1 * qY1 - dqZ1 * qZ1; - var l1 = qX1 * qX1 + qY1 * qY1 + qZ1 * qZ1 + qW1 * qW1; - if(l1 > 1e-32) { - l1 = 1 / Math.sqrt(l1); - } - qX1 *= l1; - qY1 *= l1; - qZ1 *= l1; - qW1 *= l1; - var x1 = qX1; - var y1 = qY1; - var z1 = qZ1; - var w1 = qW1; - var x21 = 2 * x1; - var y21 = 2 * y1; - var z21 = 2 * z1; - var xx1 = x1 * x21; - var yy1 = y1 * y21; - var zz1 = z1 * z21; - var xy1 = x1 * y21; - var yz1 = y1 * z21; - var xz1 = x1 * z21; - var wx1 = w1 * x21; - var wy1 = w1 * y21; - var wz1 = w1 * z21; - _this3._transform._rotation00 = 1 - yy1 - zz1; - _this3._transform._rotation01 = xy1 - wz1; - _this3._transform._rotation02 = xz1 + wy1; - _this3._transform._rotation10 = xy1 + wz1; - _this3._transform._rotation11 = 1 - xx1 - zz1; - _this3._transform._rotation12 = yz1 - wx1; - _this3._transform._rotation20 = xz1 - wy1; - _this3._transform._rotation21 = yz1 + wx1; - _this3._transform._rotation22 = 1 - xx1 - yy1; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = _this3._transform._rotation00 * _this3._invLocalInertia00 + _this3._transform._rotation01 * _this3._invLocalInertia10 + _this3._transform._rotation02 * _this3._invLocalInertia20; - __tmp__012 = _this3._transform._rotation00 * _this3._invLocalInertia01 + _this3._transform._rotation01 * _this3._invLocalInertia11 + _this3._transform._rotation02 * _this3._invLocalInertia21; - __tmp__022 = _this3._transform._rotation00 * _this3._invLocalInertia02 + _this3._transform._rotation01 * _this3._invLocalInertia12 + _this3._transform._rotation02 * _this3._invLocalInertia22; - __tmp__102 = _this3._transform._rotation10 * _this3._invLocalInertia00 + _this3._transform._rotation11 * _this3._invLocalInertia10 + _this3._transform._rotation12 * _this3._invLocalInertia20; - __tmp__112 = _this3._transform._rotation10 * _this3._invLocalInertia01 + _this3._transform._rotation11 * _this3._invLocalInertia11 + _this3._transform._rotation12 * _this3._invLocalInertia21; - __tmp__122 = _this3._transform._rotation10 * _this3._invLocalInertia02 + _this3._transform._rotation11 * _this3._invLocalInertia12 + _this3._transform._rotation12 * _this3._invLocalInertia22; - __tmp__202 = _this3._transform._rotation20 * _this3._invLocalInertia00 + _this3._transform._rotation21 * _this3._invLocalInertia10 + _this3._transform._rotation22 * _this3._invLocalInertia20; - __tmp__212 = _this3._transform._rotation20 * _this3._invLocalInertia01 + _this3._transform._rotation21 * _this3._invLocalInertia11 + _this3._transform._rotation22 * _this3._invLocalInertia21; - __tmp__222 = _this3._transform._rotation20 * _this3._invLocalInertia02 + _this3._transform._rotation21 * _this3._invLocalInertia12 + _this3._transform._rotation22 * _this3._invLocalInertia22; - _this3._invInertia00 = __tmp__002; - _this3._invInertia01 = __tmp__012; - _this3._invInertia02 = __tmp__022; - _this3._invInertia10 = __tmp__102; - _this3._invInertia11 = __tmp__112; - _this3._invInertia12 = __tmp__122; - _this3._invInertia20 = __tmp__202; - _this3._invInertia21 = __tmp__212; - _this3._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = _this3._invInertia00 * _this3._transform._rotation00 + _this3._invInertia01 * _this3._transform._rotation01 + _this3._invInertia02 * _this3._transform._rotation02; - __tmp__013 = _this3._invInertia00 * _this3._transform._rotation10 + _this3._invInertia01 * _this3._transform._rotation11 + _this3._invInertia02 * _this3._transform._rotation12; - __tmp__023 = _this3._invInertia00 * _this3._transform._rotation20 + _this3._invInertia01 * _this3._transform._rotation21 + _this3._invInertia02 * _this3._transform._rotation22; - __tmp__103 = _this3._invInertia10 * _this3._transform._rotation00 + _this3._invInertia11 * _this3._transform._rotation01 + _this3._invInertia12 * _this3._transform._rotation02; - __tmp__113 = _this3._invInertia10 * _this3._transform._rotation10 + _this3._invInertia11 * _this3._transform._rotation11 + _this3._invInertia12 * _this3._transform._rotation12; - __tmp__123 = _this3._invInertia10 * _this3._transform._rotation20 + _this3._invInertia11 * _this3._transform._rotation21 + _this3._invInertia12 * _this3._transform._rotation22; - __tmp__203 = _this3._invInertia20 * _this3._transform._rotation00 + _this3._invInertia21 * _this3._transform._rotation01 + _this3._invInertia22 * _this3._transform._rotation02; - __tmp__213 = _this3._invInertia20 * _this3._transform._rotation10 + _this3._invInertia21 * _this3._transform._rotation11 + _this3._invInertia22 * _this3._transform._rotation12; - __tmp__223 = _this3._invInertia20 * _this3._transform._rotation20 + _this3._invInertia21 * _this3._transform._rotation21 + _this3._invInertia22 * _this3._transform._rotation22; - _this3._invInertia00 = __tmp__003; - _this3._invInertia01 = __tmp__013; - _this3._invInertia02 = __tmp__023; - _this3._invInertia10 = __tmp__103; - _this3._invInertia11 = __tmp__113; - _this3._invInertia12 = __tmp__123; - _this3._invInertia20 = __tmp__203; - _this3._invInertia21 = __tmp__213; - _this3._invInertia22 = __tmp__223; - _this3._invInertia00 *= _this3._rotFactor.x; - _this3._invInertia01 *= _this3._rotFactor.x; - _this3._invInertia02 *= _this3._rotFactor.x; - _this3._invInertia10 *= _this3._rotFactor.y; - _this3._invInertia11 *= _this3._rotFactor.y; - _this3._invInertia12 *= _this3._rotFactor.y; - _this3._invInertia20 *= _this3._rotFactor.z; - _this3._invInertia21 *= _this3._rotFactor.z; - _this3._invInertia22 *= _this3._rotFactor.z; + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (_this._transform._rotation02 + _this._transform._rotation20) * s; + qY = (_this._transform._rotation12 + _this._transform._rotation21) * s; + qW = (_this._transform._rotation10 - _this._transform._rotation01) * s; + } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + _this._transform._rotation00 = 1 - yy - zz; + _this._transform._rotation01 = xy - wz; + _this._transform._rotation02 = xz + wy; + _this._transform._rotation10 = xy + wz; + _this._transform._rotation11 = 1 - xx - zz; + _this._transform._rotation12 = yz - wx; + _this._transform._rotation20 = xz - wy; + _this._transform._rotation21 = yz + wx; + _this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._transform._rotation00 * _this._invLocalInertia00 + _this._transform._rotation01 * _this._invLocalInertia10 + _this._transform._rotation02 * _this._invLocalInertia20; + __tmp__01 = _this._transform._rotation00 * _this._invLocalInertia01 + _this._transform._rotation01 * _this._invLocalInertia11 + _this._transform._rotation02 * _this._invLocalInertia21; + __tmp__02 = _this._transform._rotation00 * _this._invLocalInertia02 + _this._transform._rotation01 * _this._invLocalInertia12 + _this._transform._rotation02 * _this._invLocalInertia22; + __tmp__10 = _this._transform._rotation10 * _this._invLocalInertia00 + _this._transform._rotation11 * _this._invLocalInertia10 + _this._transform._rotation12 * _this._invLocalInertia20; + __tmp__11 = _this._transform._rotation10 * _this._invLocalInertia01 + _this._transform._rotation11 * _this._invLocalInertia11 + _this._transform._rotation12 * _this._invLocalInertia21; + __tmp__12 = _this._transform._rotation10 * _this._invLocalInertia02 + _this._transform._rotation11 * _this._invLocalInertia12 + _this._transform._rotation12 * _this._invLocalInertia22; + __tmp__20 = _this._transform._rotation20 * _this._invLocalInertia00 + _this._transform._rotation21 * _this._invLocalInertia10 + _this._transform._rotation22 * _this._invLocalInertia20; + __tmp__21 = _this._transform._rotation20 * _this._invLocalInertia01 + _this._transform._rotation21 * _this._invLocalInertia11 + _this._transform._rotation22 * _this._invLocalInertia21; + __tmp__22 = _this._transform._rotation20 * _this._invLocalInertia02 + _this._transform._rotation21 * _this._invLocalInertia12 + _this._transform._rotation22 * _this._invLocalInertia22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = _this._invInertia00 * _this._transform._rotation00 + _this._invInertia01 * _this._transform._rotation01 + _this._invInertia02 * _this._transform._rotation02; + __tmp__01 = _this._invInertia00 * _this._transform._rotation10 + _this._invInertia01 * _this._transform._rotation11 + _this._invInertia02 * _this._transform._rotation12; + __tmp__02 = _this._invInertia00 * _this._transform._rotation20 + _this._invInertia01 * _this._transform._rotation21 + _this._invInertia02 * _this._transform._rotation22; + __tmp__10 = _this._invInertia10 * _this._transform._rotation00 + _this._invInertia11 * _this._transform._rotation01 + _this._invInertia12 * _this._transform._rotation02; + __tmp__11 = _this._invInertia10 * _this._transform._rotation10 + _this._invInertia11 * _this._transform._rotation11 + _this._invInertia12 * _this._transform._rotation12; + __tmp__12 = _this._invInertia10 * _this._transform._rotation20 + _this._invInertia11 * _this._transform._rotation21 + _this._invInertia12 * _this._transform._rotation22; + __tmp__20 = _this._invInertia20 * _this._transform._rotation00 + _this._invInertia21 * _this._transform._rotation01 + _this._invInertia22 * _this._transform._rotation02; + __tmp__21 = _this._invInertia20 * _this._transform._rotation10 + _this._invInertia21 * _this._transform._rotation11 + _this._invInertia22 * _this._transform._rotation12; + __tmp__22 = _this._invInertia20 * _this._transform._rotation20 + _this._invInertia21 * _this._transform._rotation21 + _this._invInertia22 * _this._transform._rotation22; + _this._invInertia00 = __tmp__00; + _this._invInertia01 = __tmp__01; + _this._invInertia02 = __tmp__02; + _this._invInertia10 = __tmp__10; + _this._invInertia11 = __tmp__11; + _this._invInertia12 = __tmp__12; + _this._invInertia20 = __tmp__20; + _this._invInertia21 = __tmp__21; + _this._invInertia22 = __tmp__22; + _this._invInertia00 *= _this._rotFactor.x; + _this._invInertia01 *= _this._rotFactor.x; + _this._invInertia02 *= _this._rotFactor.x; + _this._invInertia10 *= _this._rotFactor.y; + _this._invInertia11 *= _this._rotFactor.y; + _this._invInertia12 *= _this._rotFactor.y; + _this._invInertia20 *= _this._rotFactor.z; + _this._invInertia21 *= _this._rotFactor.z; + _this._invInertia22 *= _this._rotFactor.z; } ,postSolve: function() { this.joint._syncAnchors(); @@ -41500,10 +41605,10 @@ var oimo_dynamics_rigidbody_RigidBody = function(config) { this._velX = v.x; this._velY = v.y; this._velZ = v.z; - var v1 = config.angularVelocity; - this._angVelX = v1.x; - this._angVelY = v1.y; - this._angVelZ = v1.z; + var v = config.angularVelocity; + this._angVelX = v.x; + this._angVelY = v.y; + this._angVelZ = v.z; this._pseudoVelX = 0; this._pseudoVelY = 0; this._pseudoVelZ = 0; @@ -41512,10 +41617,10 @@ var oimo_dynamics_rigidbody_RigidBody = function(config) { this._angPseudoVelZ = 0; this._ptransform = new oimo_common_Transform(); this._transform = new oimo_common_Transform(); - var v2 = config.position; - this._ptransform._positionX = v2.x; - this._ptransform._positionY = v2.y; - this._ptransform._positionZ = v2.z; + var v = config.position; + this._ptransform._positionX = v.x; + this._ptransform._positionY = v.y; + this._ptransform._positionZ = v.z; var m = config.rotation; this._ptransform._rotation00 = m.e00; this._ptransform._rotation01 = m.e01; @@ -41647,14 +41752,225 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { translationZ *= l; } if(rotationLengthSq > oimo_common_Setting.maxRotationPerStep * oimo_common_Setting.maxRotationPerStep) { - var l1 = oimo_common_Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); - this._angVelX *= l1; - this._angVelY *= l1; - this._angVelZ *= l1; - rotationX *= l1; - rotationY *= l1; - rotationZ *= l1; + var l = oimo_common_Setting.maxRotationPerStep / Math.sqrt(rotationLengthSq); + this._angVelX *= l; + this._angVelY *= l; + this._angVelZ *= l; + rotationX *= l; + rotationY *= l; + rotationZ *= l; + } + this._transform._positionX += translationX; + this._transform._positionY += translationY; + this._transform._positionZ += translationZ; + var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); + var halfTheta = theta * 0.5; + var rotationToSinAxisFactor; + var cosHalfTheta; + if(halfTheta < 0.5) { + var ht2 = halfTheta * halfTheta; + rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); + cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; + } else { + rotationToSinAxisFactor = Math.sin(halfTheta) / theta; + cosHalfTheta = Math.cos(halfTheta); + } + var sinAxisX; + var sinAxisY; + var sinAxisZ; + sinAxisX = rotationX * rotationToSinAxisFactor; + sinAxisY = rotationY * rotationToSinAxisFactor; + sinAxisZ = rotationZ * rotationToSinAxisFactor; + var dqX; + var dqY; + var dqZ; + var dqW; + dqX = sinAxisX; + dqY = sinAxisY; + dqZ = sinAxisZ; + dqW = cosHalfTheta; + var qX; + var qY; + var qZ; + var qW; + var e00 = this._transform._rotation00; + var e11 = this._transform._rotation11; + var e22 = this._transform._rotation22; + var t = e00 + e11 + e22; + var s; + if(t > 0) { + s = Math.sqrt(t + 1); + qW = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation21 - this._transform._rotation12) * s; + qY = (this._transform._rotation02 - this._transform._rotation20) * s; + qZ = (this._transform._rotation10 - this._transform._rotation01) * s; + } else if(e00 > e11) { + if(e00 > e22) { + s = Math.sqrt(e00 - e11 - e22 + 1); + qX = 0.5 * s; + s = 0.5 / s; + qY = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation02 + this._transform._rotation20) * s; + qW = (this._transform._rotation21 - this._transform._rotation12) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; + } + } else if(e11 > e22) { + s = Math.sqrt(e11 - e22 - e00 + 1); + qY = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation01 + this._transform._rotation10) * s; + qZ = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation02 - this._transform._rotation20) * s; + } else { + s = Math.sqrt(e22 - e00 - e11 + 1); + qZ = 0.5 * s; + s = 0.5 / s; + qX = (this._transform._rotation02 + this._transform._rotation20) * s; + qY = (this._transform._rotation12 + this._transform._rotation21) * s; + qW = (this._transform._rotation10 - this._transform._rotation01) * s; } + qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; + qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; + qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; + qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; + var x = qX; + var y = qY; + var z = qZ; + var w = qW; + var x2 = 2 * x; + var y2 = 2 * y; + var z2 = 2 * z; + var xx = x * x2; + var yy = y * y2; + var zz = z * z2; + var xy = x * y2; + var yz = y * z2; + var xz = x * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + this._transform._rotation00 = 1 - yy - zz; + this._transform._rotation01 = xy - wz; + this._transform._rotation02 = xz + wy; + this._transform._rotation10 = xy + wz; + this._transform._rotation11 = 1 - xx - zz; + this._transform._rotation12 = yz - wx; + this._transform._rotation20 = xz - wy; + this._transform._rotation21 = yz + wx; + this._transform._rotation22 = 1 - xx - yy; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + this._invInertia00 *= this._rotFactor.x; + this._invInertia01 *= this._rotFactor.x; + this._invInertia02 *= this._rotFactor.x; + this._invInertia10 *= this._rotFactor.y; + this._invInertia11 *= this._rotFactor.y; + this._invInertia12 *= this._rotFactor.y; + this._invInertia20 *= this._rotFactor.z; + this._invInertia21 *= this._rotFactor.z; + this._invInertia22 *= this._rotFactor.z; + break; + } + } + ,_integratePseudoVelocity: function() { + if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { + return; + } + switch(this._type) { + case 1: + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; + break; + case 0:case 2: + var translationX; + var translationY; + var translationZ; + var rotationX; + var rotationY; + var rotationZ; + translationX = this._pseudoVelX; + translationY = this._pseudoVelY; + translationZ = this._pseudoVelZ; + rotationX = this._angPseudoVelX; + rotationY = this._angPseudoVelY; + rotationZ = this._angPseudoVelZ; + this._pseudoVelX = 0; + this._pseudoVelY = 0; + this._pseudoVelZ = 0; + this._angPseudoVelX = 0; + this._angPseudoVelY = 0; + this._angPseudoVelZ = 0; this._transform._positionX += translationX; this._transform._positionY += translationY; this._transform._positionZ += translationZ; @@ -41735,14 +42051,14 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l2 = qX * qX + qY * qY + qZ * qZ + qW * qW; - if(l2 > 1e-32) { - l2 = 1 / Math.sqrt(l2); - } - qX *= l2; - qY *= l2; - qZ *= l2; - qW *= l2; + var l = qX * qX + qY * qY + qZ * qZ + qW * qW; + if(l > 1e-32) { + l = 1 / Math.sqrt(l); + } + qX *= l; + qY *= l; + qZ *= l; + qW *= l; var x = qX; var y = qY; var z = qZ; @@ -41795,190 +42111,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; - this._invInertia00 *= this._rotFactor.x; - this._invInertia01 *= this._rotFactor.x; - this._invInertia02 *= this._rotFactor.x; - this._invInertia10 *= this._rotFactor.y; - this._invInertia11 *= this._rotFactor.y; - this._invInertia12 *= this._rotFactor.y; - this._invInertia20 *= this._rotFactor.z; - this._invInertia21 *= this._rotFactor.z; - this._invInertia22 *= this._rotFactor.z; - break; - } - } - ,_integratePseudoVelocity: function() { - if(this._pseudoVelX * this._pseudoVelX + this._pseudoVelY * this._pseudoVelY + this._pseudoVelZ * this._pseudoVelZ == 0 && this._angPseudoVelX * this._angPseudoVelX + this._angPseudoVelY * this._angPseudoVelY + this._angPseudoVelZ * this._angPseudoVelZ == 0) { - return; - } - switch(this._type) { - case 1: - this._pseudoVelX = 0; - this._pseudoVelY = 0; - this._pseudoVelZ = 0; - this._angPseudoVelX = 0; - this._angPseudoVelY = 0; - this._angPseudoVelZ = 0; - break; - case 0:case 2: - var translationX; - var translationY; - var translationZ; - var rotationX; - var rotationY; - var rotationZ; - translationX = this._pseudoVelX; - translationY = this._pseudoVelY; - translationZ = this._pseudoVelZ; - rotationX = this._angPseudoVelX; - rotationY = this._angPseudoVelY; - rotationZ = this._angPseudoVelZ; - this._pseudoVelX = 0; - this._pseudoVelY = 0; - this._pseudoVelZ = 0; - this._angPseudoVelX = 0; - this._angPseudoVelY = 0; - this._angPseudoVelZ = 0; - this._transform._positionX += translationX; - this._transform._positionY += translationY; - this._transform._positionZ += translationZ; - var theta = Math.sqrt(rotationX * rotationX + rotationY * rotationY + rotationZ * rotationZ); - var halfTheta = theta * 0.5; - var rotationToSinAxisFactor; - var cosHalfTheta; - if(halfTheta < 0.5) { - var ht2 = halfTheta * halfTheta; - rotationToSinAxisFactor = 0.5 * (1 - ht2 * 0.16666666666666666 + ht2 * ht2 * 0.0083333333333333332); - cosHalfTheta = 1 - ht2 * 0.5 + ht2 * ht2 * 0.041666666666666664; - } else { - rotationToSinAxisFactor = Math.sin(halfTheta) / theta; - cosHalfTheta = Math.cos(halfTheta); - } - var sinAxisX; - var sinAxisY; - var sinAxisZ; - sinAxisX = rotationX * rotationToSinAxisFactor; - sinAxisY = rotationY * rotationToSinAxisFactor; - sinAxisZ = rotationZ * rotationToSinAxisFactor; - var dqX; - var dqY; - var dqZ; - var dqW; - dqX = sinAxisX; - dqY = sinAxisY; - dqZ = sinAxisZ; - dqW = cosHalfTheta; - var qX; - var qY; - var qZ; - var qW; - var e00 = this._transform._rotation00; - var e11 = this._transform._rotation11; - var e22 = this._transform._rotation22; - var t = e00 + e11 + e22; - var s; - if(t > 0) { - s = Math.sqrt(t + 1); - qW = 0.5 * s; - s = 0.5 / s; - qX = (this._transform._rotation21 - this._transform._rotation12) * s; - qY = (this._transform._rotation02 - this._transform._rotation20) * s; - qZ = (this._transform._rotation10 - this._transform._rotation01) * s; - } else if(e00 > e11) { - if(e00 > e22) { - s = Math.sqrt(e00 - e11 - e22 + 1); - qX = 0.5 * s; - s = 0.5 / s; - qY = (this._transform._rotation01 + this._transform._rotation10) * s; - qZ = (this._transform._rotation02 + this._transform._rotation20) * s; - qW = (this._transform._rotation21 - this._transform._rotation12) * s; - } else { - s = Math.sqrt(e22 - e00 - e11 + 1); - qZ = 0.5 * s; - s = 0.5 / s; - qX = (this._transform._rotation02 + this._transform._rotation20) * s; - qY = (this._transform._rotation12 + this._transform._rotation21) * s; - qW = (this._transform._rotation10 - this._transform._rotation01) * s; - } - } else if(e11 > e22) { - s = Math.sqrt(e11 - e22 - e00 + 1); - qY = 0.5 * s; - s = 0.5 / s; - qX = (this._transform._rotation01 + this._transform._rotation10) * s; - qZ = (this._transform._rotation12 + this._transform._rotation21) * s; - qW = (this._transform._rotation02 - this._transform._rotation20) * s; - } else { - s = Math.sqrt(e22 - e00 - e11 + 1); - qZ = 0.5 * s; - s = 0.5 / s; - qX = (this._transform._rotation02 + this._transform._rotation20) * s; - qY = (this._transform._rotation12 + this._transform._rotation21) * s; - qW = (this._transform._rotation10 - this._transform._rotation01) * s; - } - qX = dqW * qX + dqX * qW + dqY * qZ - dqZ * qY; - qY = dqW * qY - dqX * qZ + dqY * qW + dqZ * qX; - qZ = dqW * qZ + dqX * qY - dqY * qX + dqZ * qW; - qW = dqW * qW - dqX * qX - dqY * qY - dqZ * qZ; - var l = qX * qX + qY * qY + qZ * qZ + qW * qW; - if(l > 1e-32) { - l = 1 / Math.sqrt(l); - } - qX *= l; - qY *= l; - qZ *= l; - qW *= l; - var x = qX; - var y = qY; - var z = qZ; - var w = qW; - var x2 = 2 * x; - var y2 = 2 * y; - var z2 = 2 * z; - var xx = x * x2; - var yy = y * y2; - var zz = z * z2; - var xy = x * y2; - var yz = y * z2; - var xz = x * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - this._transform._rotation00 = 1 - yy - zz; - this._transform._rotation01 = xy - wz; - this._transform._rotation02 = xz + wy; - this._transform._rotation10 = xy + wz; - this._transform._rotation11 = 1 - xx - zz; - this._transform._rotation12 = yz - wx; - this._transform._rotation20 = xz - wy; - this._transform._rotation21 = yz + wx; - this._transform._rotation22 = 1 - xx - yy; var __tmp__00; var __tmp__01; var __tmp__02; @@ -41988,15 +42120,15 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var __tmp__20; var __tmp__21; var __tmp__22; - __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; this._invInertia00 = __tmp__00; this._invInertia01 = __tmp__01; this._invInertia02 = __tmp__02; @@ -42006,33 +42138,6 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -42258,60 +42363,60 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._type = 1; } } - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__012 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__022 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__102 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__112 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__122 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__202 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__212 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__222 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; - this._invInertia00 = __tmp__002; - this._invInertia01 = __tmp__012; - this._invInertia02 = __tmp__022; - this._invInertia10 = __tmp__102; - this._invInertia11 = __tmp__112; - this._invInertia12 = __tmp__122; - this._invInertia20 = __tmp__202; - this._invInertia21 = __tmp__212; - this._invInertia22 = __tmp__222; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__013 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__023 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__103 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__113 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__123 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__203 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__213 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__223 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__003; - this._invInertia01 = __tmp__013; - this._invInertia02 = __tmp__023; - this._invInertia10 = __tmp__103; - this._invInertia11 = __tmp__113; - this._invInertia12 = __tmp__123; - this._invInertia20 = __tmp__203; - this._invInertia21 = __tmp__213; - this._invInertia22 = __tmp__223; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -42359,7 +42464,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; var __tmp__01; @@ -42379,28 +42484,28 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; var __tmp__001; var __tmp__011; @@ -42420,27 +42525,27 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -42508,7 +42613,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; var __tmp__01; @@ -42528,28 +42633,28 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__00; - dst1._rotation01 = __tmp__01; - dst1._rotation02 = __tmp__02; - dst1._rotation10 = __tmp__10; - dst1._rotation11 = __tmp__11; - dst1._rotation12 = __tmp__12; - dst1._rotation20 = __tmp__20; - dst1._rotation21 = __tmp__21; - dst1._rotation22 = __tmp__22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; var __tmp__001; var __tmp__011; @@ -42569,27 +42674,27 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__001; - dst2._rotation01 = __tmp__011; - dst2._rotation02 = __tmp__021; - dst2._rotation10 = __tmp__101; - dst2._rotation11 = __tmp__111; - dst2._rotation12 = __tmp__121; - dst2._rotation20 = __tmp__201; - dst2._rotation21 = __tmp__211; - dst2._rotation22 = __tmp__221; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -42689,33 +42794,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -42744,88 +42849,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -42913,33 +43018,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -42968,88 +43073,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -43134,60 +43239,60 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__002; - this._invInertia01 = __tmp__012; - this._invInertia02 = __tmp__022; - this._invInertia10 = __tmp__102; - this._invInertia11 = __tmp__112; - this._invInertia12 = __tmp__122; - this._invInertia20 = __tmp__202; - this._invInertia21 = __tmp__212; - this._invInertia22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -43216,88 +43321,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -43394,60 +43499,60 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._transform._rotation20 = __tmp__20; this._transform._rotation21 = __tmp__21; this._transform._rotation22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; - __tmp__011 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; - __tmp__021 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; - __tmp__101 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; - __tmp__111 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; - __tmp__121 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; - __tmp__201 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; - __tmp__211 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; - __tmp__221 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__012 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__022 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__102 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__112 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__122 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__202 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__212 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__222 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__002; - this._invInertia01 = __tmp__012; - this._invInertia02 = __tmp__022; - this._invInertia10 = __tmp__102; - this._invInertia11 = __tmp__112; - this._invInertia12 = __tmp__122; - this._invInertia20 = __tmp__202; - this._invInertia21 = __tmp__212; - this._invInertia22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._transform._rotation00 * this._invLocalInertia00 + this._transform._rotation01 * this._invLocalInertia10 + this._transform._rotation02 * this._invLocalInertia20; + __tmp__01 = this._transform._rotation00 * this._invLocalInertia01 + this._transform._rotation01 * this._invLocalInertia11 + this._transform._rotation02 * this._invLocalInertia21; + __tmp__02 = this._transform._rotation00 * this._invLocalInertia02 + this._transform._rotation01 * this._invLocalInertia12 + this._transform._rotation02 * this._invLocalInertia22; + __tmp__10 = this._transform._rotation10 * this._invLocalInertia00 + this._transform._rotation11 * this._invLocalInertia10 + this._transform._rotation12 * this._invLocalInertia20; + __tmp__11 = this._transform._rotation10 * this._invLocalInertia01 + this._transform._rotation11 * this._invLocalInertia11 + this._transform._rotation12 * this._invLocalInertia21; + __tmp__12 = this._transform._rotation10 * this._invLocalInertia02 + this._transform._rotation11 * this._invLocalInertia12 + this._transform._rotation12 * this._invLocalInertia22; + __tmp__20 = this._transform._rotation20 * this._invLocalInertia00 + this._transform._rotation21 * this._invLocalInertia10 + this._transform._rotation22 * this._invLocalInertia20; + __tmp__21 = this._transform._rotation20 * this._invLocalInertia01 + this._transform._rotation21 * this._invLocalInertia11 + this._transform._rotation22 * this._invLocalInertia21; + __tmp__22 = this._transform._rotation20 * this._invLocalInertia02 + this._transform._rotation21 * this._invLocalInertia12 + this._transform._rotation22 * this._invLocalInertia22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -43476,88 +43581,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__013 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__023 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__103 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__113 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__123 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__203 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__213 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__223 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__003; - dst1._rotation01 = __tmp__013; - dst1._rotation02 = __tmp__023; - dst1._rotation10 = __tmp__103; - dst1._rotation11 = __tmp__113; - dst1._rotation12 = __tmp__123; - dst1._rotation20 = __tmp__203; - dst1._rotation21 = __tmp__213; - dst1._rotation22 = __tmp__223; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__004; - var __tmp__014; - var __tmp__024; - var __tmp__104; - var __tmp__114; - var __tmp__124; - var __tmp__204; - var __tmp__214; - var __tmp__224; - __tmp__004 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__014 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__024 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__104 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__114 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__124 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__204 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__214 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__224 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__004; - dst2._rotation01 = __tmp__014; - dst2._rotation02 = __tmp__024; - dst2._rotation10 = __tmp__104; - dst2._rotation11 = __tmp__114; - dst2._rotation12 = __tmp__124; - dst2._rotation20 = __tmp__204; - dst2._rotation21 = __tmp__214; - dst2._rotation22 = __tmp__224; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -43765,33 +43870,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -43820,88 +43925,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -44012,33 +44117,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -44067,88 +44172,88 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; - var dst1 = s._ptransform; + var dst = s._ptransform; var src1 = s._localTransform; - var __tmp__002; - var __tmp__012; - var __tmp__022; - var __tmp__102; - var __tmp__112; - var __tmp__122; - var __tmp__202; - var __tmp__212; - var __tmp__222; - __tmp__002 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; - __tmp__012 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; - __tmp__022 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; - __tmp__102 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; - __tmp__112 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; - __tmp__122 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; - __tmp__202 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; - __tmp__212 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; - __tmp__222 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; - dst1._rotation00 = __tmp__002; - dst1._rotation01 = __tmp__012; - dst1._rotation02 = __tmp__022; - dst1._rotation10 = __tmp__102; - dst1._rotation11 = __tmp__112; - dst1._rotation12 = __tmp__122; - dst1._rotation20 = __tmp__202; - dst1._rotation21 = __tmp__212; - dst1._rotation22 = __tmp__222; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = tf1._rotation00 * src1._rotation00 + tf1._rotation01 * src1._rotation10 + tf1._rotation02 * src1._rotation20; + __tmp__01 = tf1._rotation00 * src1._rotation01 + tf1._rotation01 * src1._rotation11 + tf1._rotation02 * src1._rotation21; + __tmp__02 = tf1._rotation00 * src1._rotation02 + tf1._rotation01 * src1._rotation12 + tf1._rotation02 * src1._rotation22; + __tmp__10 = tf1._rotation10 * src1._rotation00 + tf1._rotation11 * src1._rotation10 + tf1._rotation12 * src1._rotation20; + __tmp__11 = tf1._rotation10 * src1._rotation01 + tf1._rotation11 * src1._rotation11 + tf1._rotation12 * src1._rotation21; + __tmp__12 = tf1._rotation10 * src1._rotation02 + tf1._rotation11 * src1._rotation12 + tf1._rotation12 * src1._rotation22; + __tmp__20 = tf1._rotation20 * src1._rotation00 + tf1._rotation21 * src1._rotation10 + tf1._rotation22 * src1._rotation20; + __tmp__21 = tf1._rotation20 * src1._rotation01 + tf1._rotation21 * src1._rotation11 + tf1._rotation22 * src1._rotation21; + __tmp__22 = tf1._rotation20 * src1._rotation02 + tf1._rotation21 * src1._rotation12 + tf1._rotation22 * src1._rotation22; + dst._rotation00 = __tmp__00; + dst._rotation01 = __tmp__01; + dst._rotation02 = __tmp__02; + dst._rotation10 = __tmp__10; + dst._rotation11 = __tmp__11; + dst._rotation12 = __tmp__12; + dst._rotation20 = __tmp__20; + dst._rotation21 = __tmp__21; + dst._rotation22 = __tmp__22; var __tmp__X; var __tmp__Y; var __tmp__Z; __tmp__X = tf1._rotation00 * src1._positionX + tf1._rotation01 * src1._positionY + tf1._rotation02 * src1._positionZ; __tmp__Y = tf1._rotation10 * src1._positionX + tf1._rotation11 * src1._positionY + tf1._rotation12 * src1._positionZ; __tmp__Z = tf1._rotation20 * src1._positionX + tf1._rotation21 * src1._positionY + tf1._rotation22 * src1._positionZ; - dst1._positionX = __tmp__X; - dst1._positionY = __tmp__Y; - dst1._positionZ = __tmp__Z; - dst1._positionX += tf1._positionX; - dst1._positionY += tf1._positionY; - dst1._positionZ += tf1._positionZ; - var dst2 = s._transform; + dst._positionX = __tmp__X; + dst._positionY = __tmp__Y; + dst._positionZ = __tmp__Z; + dst._positionX += tf1._positionX; + dst._positionY += tf1._positionY; + dst._positionZ += tf1._positionZ; + var dst1 = s._transform; var src11 = s._localTransform; - var __tmp__003; - var __tmp__013; - var __tmp__023; - var __tmp__103; - var __tmp__113; - var __tmp__123; - var __tmp__203; - var __tmp__213; - var __tmp__223; - __tmp__003 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; - __tmp__013 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; - __tmp__023 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; - __tmp__103 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; - __tmp__113 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; - __tmp__123 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; - __tmp__203 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; - __tmp__213 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; - __tmp__223 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; - dst2._rotation00 = __tmp__003; - dst2._rotation01 = __tmp__013; - dst2._rotation02 = __tmp__023; - dst2._rotation10 = __tmp__103; - dst2._rotation11 = __tmp__113; - dst2._rotation12 = __tmp__123; - dst2._rotation20 = __tmp__203; - dst2._rotation21 = __tmp__213; - dst2._rotation22 = __tmp__223; + var __tmp__001; + var __tmp__011; + var __tmp__021; + var __tmp__101; + var __tmp__111; + var __tmp__121; + var __tmp__201; + var __tmp__211; + var __tmp__221; + __tmp__001 = tf2._rotation00 * src11._rotation00 + tf2._rotation01 * src11._rotation10 + tf2._rotation02 * src11._rotation20; + __tmp__011 = tf2._rotation00 * src11._rotation01 + tf2._rotation01 * src11._rotation11 + tf2._rotation02 * src11._rotation21; + __tmp__021 = tf2._rotation00 * src11._rotation02 + tf2._rotation01 * src11._rotation12 + tf2._rotation02 * src11._rotation22; + __tmp__101 = tf2._rotation10 * src11._rotation00 + tf2._rotation11 * src11._rotation10 + tf2._rotation12 * src11._rotation20; + __tmp__111 = tf2._rotation10 * src11._rotation01 + tf2._rotation11 * src11._rotation11 + tf2._rotation12 * src11._rotation21; + __tmp__121 = tf2._rotation10 * src11._rotation02 + tf2._rotation11 * src11._rotation12 + tf2._rotation12 * src11._rotation22; + __tmp__201 = tf2._rotation20 * src11._rotation00 + tf2._rotation21 * src11._rotation10 + tf2._rotation22 * src11._rotation20; + __tmp__211 = tf2._rotation20 * src11._rotation01 + tf2._rotation21 * src11._rotation11 + tf2._rotation22 * src11._rotation21; + __tmp__221 = tf2._rotation20 * src11._rotation02 + tf2._rotation21 * src11._rotation12 + tf2._rotation22 * src11._rotation22; + dst1._rotation00 = __tmp__001; + dst1._rotation01 = __tmp__011; + dst1._rotation02 = __tmp__021; + dst1._rotation10 = __tmp__101; + dst1._rotation11 = __tmp__111; + dst1._rotation12 = __tmp__121; + dst1._rotation20 = __tmp__201; + dst1._rotation21 = __tmp__211; + dst1._rotation22 = __tmp__221; var __tmp__X1; var __tmp__Y1; var __tmp__Z1; __tmp__X1 = tf2._rotation00 * src11._positionX + tf2._rotation01 * src11._positionY + tf2._rotation02 * src11._positionZ; __tmp__Y1 = tf2._rotation10 * src11._positionX + tf2._rotation11 * src11._positionY + tf2._rotation12 * src11._positionZ; __tmp__Z1 = tf2._rotation20 * src11._positionX + tf2._rotation21 * src11._positionY + tf2._rotation22 * src11._positionZ; - dst2._positionX = __tmp__X1; - dst2._positionY = __tmp__Y1; - dst2._positionZ = __tmp__Z1; - dst2._positionX += tf2._positionX; - dst2._positionY += tf2._positionY; - dst2._positionZ += tf2._positionZ; + dst1._positionX = __tmp__X1; + dst1._positionY = __tmp__Y1; + dst1._positionZ = __tmp__Z1; + dst1._positionX += tf2._positionX; + dst1._positionY += tf2._positionY; + dst1._positionZ += tf2._positionZ; var minX; var minY; var minZ; @@ -44341,33 +44446,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -44416,33 +44521,33 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this._invInertia20 = __tmp__20; this._invInertia21 = __tmp__21; this._invInertia22 = __tmp__22; - var __tmp__001; - var __tmp__011; - var __tmp__021; - var __tmp__101; - var __tmp__111; - var __tmp__121; - var __tmp__201; - var __tmp__211; - var __tmp__221; - __tmp__001 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; - __tmp__011 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; - __tmp__021 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; - __tmp__101 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; - __tmp__111 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; - __tmp__121 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; - __tmp__201 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; - __tmp__211 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; - __tmp__221 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; - this._invInertia00 = __tmp__001; - this._invInertia01 = __tmp__011; - this._invInertia02 = __tmp__021; - this._invInertia10 = __tmp__101; - this._invInertia11 = __tmp__111; - this._invInertia12 = __tmp__121; - this._invInertia20 = __tmp__201; - this._invInertia21 = __tmp__211; - this._invInertia22 = __tmp__221; + var __tmp__00; + var __tmp__01; + var __tmp__02; + var __tmp__10; + var __tmp__11; + var __tmp__12; + var __tmp__20; + var __tmp__21; + var __tmp__22; + __tmp__00 = this._invInertia00 * this._transform._rotation00 + this._invInertia01 * this._transform._rotation01 + this._invInertia02 * this._transform._rotation02; + __tmp__01 = this._invInertia00 * this._transform._rotation10 + this._invInertia01 * this._transform._rotation11 + this._invInertia02 * this._transform._rotation12; + __tmp__02 = this._invInertia00 * this._transform._rotation20 + this._invInertia01 * this._transform._rotation21 + this._invInertia02 * this._transform._rotation22; + __tmp__10 = this._invInertia10 * this._transform._rotation00 + this._invInertia11 * this._transform._rotation01 + this._invInertia12 * this._transform._rotation02; + __tmp__11 = this._invInertia10 * this._transform._rotation10 + this._invInertia11 * this._transform._rotation11 + this._invInertia12 * this._transform._rotation12; + __tmp__12 = this._invInertia10 * this._transform._rotation20 + this._invInertia11 * this._transform._rotation21 + this._invInertia12 * this._transform._rotation22; + __tmp__20 = this._invInertia20 * this._transform._rotation00 + this._invInertia21 * this._transform._rotation01 + this._invInertia22 * this._transform._rotation02; + __tmp__21 = this._invInertia20 * this._transform._rotation10 + this._invInertia21 * this._transform._rotation11 + this._invInertia22 * this._transform._rotation12; + __tmp__22 = this._invInertia20 * this._transform._rotation20 + this._invInertia21 * this._transform._rotation21 + this._invInertia22 * this._transform._rotation22; + this._invInertia00 = __tmp__00; + this._invInertia01 = __tmp__01; + this._invInertia02 = __tmp__02; + this._invInertia10 = __tmp__10; + this._invInertia11 = __tmp__11; + this._invInertia12 = __tmp__12; + this._invInertia20 = __tmp__20; + this._invInertia21 = __tmp__21; + this._invInertia22 = __tmp__22; this._invInertia00 *= this._rotFactor.x; this._invInertia01 *= this._rotFactor.x; this._invInertia02 *= this._rotFactor.x; @@ -44885,7 +44990,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { ,getShapeList: function() { return this._shapeList; } - ,getNumContectLinks: function() { + ,getNumContactLinks: function() { return this._numContactLinks; } ,getContactLinkList: function() { @@ -45071,13 +45176,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { _this1._sleeping = false; _this1._sleepTime = 0; var _this2 = _this._contactManager; - var prev1 = c._prev; - var next1 = c._next; - if(prev1 != null) { - prev1._next = next1; + var prev = c._prev; + var next = c._next; + if(prev != null) { + prev._next = next; } - if(next1 != null) { - next1._prev = prev1; + if(next != null) { + next._prev = prev; } if(c == _this2._contactList) { _this2._contactList = _this2._contactList._next; @@ -45088,18 +45193,25 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { c._next = null; c._prev = null; if(c._touching) { + var cc1 = c._s1._contactCallback; var cc2 = c._s2._contactCallback; - if(c._s1._contactCallback == cc2) { + if(cc1 == cc2) { cc2 = null; } + if(cc1 != null) { + cc1.endContact(c); + } + if(cc2 != null) { + cc2.endContact(c); + } } - var prev2 = c._link1._prev; - var next2 = c._link1._next; - if(prev2 != null) { - prev2._next = next2; + var prev1 = c._link1._prev; + var next1 = c._link1._next; + if(prev1 != null) { + prev1._next = next1; } - if(next2 != null) { - next2._prev = prev2; + if(next1 != null) { + next1._prev = prev1; } if(c._link1 == c._b1._contactLinkList) { c._b1._contactLinkList = c._b1._contactLinkList._next; @@ -45109,13 +45221,13 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { } c._link1._next = null; c._link1._prev = null; - var prev3 = c._link2._prev; - var next3 = c._link2._next; - if(prev3 != null) { - prev3._next = next3; + var prev2 = c._link2._prev; + var next2 = c._link2._next; + if(prev2 != null) { + prev2._next = next2; } - if(next3 != null) { - next3._prev = prev3; + if(next2 != null) { + next2._prev = prev2; } if(c._link2 == c._b2._contactLinkList) { c._b2._contactLinkList = c._b2._contactLinkList._next; @@ -45157,7 +45269,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { this.updateMass(); var s = this._shapeList; while(s != null) { - var n1 = s._next; + var n = s._next; var tf1 = this._ptransform; var tf2 = this._transform; var dst = s._ptransform; @@ -45275,7 +45387,7 @@ oimo_dynamics_rigidbody_RigidBody.prototype = { v.z = dZ; s._rigidBody._world._broadPhase.moveProxy(s._proxy,s._aabb,s.displacement); } - s = n1; + s = n; } } ,getType: function() { @@ -45373,20 +45485,20 @@ var oimo_dynamics_rigidbody_Shape = function(config) { dst._rotation20 = src._rotation20; dst._rotation21 = src._rotation21; dst._rotation22 = src._rotation22; - var dst1 = this._transform; - var src1 = this._localTransform; - dst1._positionX = src1._positionX; - dst1._positionY = src1._positionY; - dst1._positionZ = src1._positionZ; - dst1._rotation00 = src1._rotation00; - dst1._rotation01 = src1._rotation01; - dst1._rotation02 = src1._rotation02; - dst1._rotation10 = src1._rotation10; - dst1._rotation11 = src1._rotation11; - dst1._rotation12 = src1._rotation12; - dst1._rotation20 = src1._rotation20; - dst1._rotation21 = src1._rotation21; - dst1._rotation22 = src1._rotation22; + var dst = this._transform; + var src = this._localTransform; + dst._positionX = src._positionX; + dst._positionY = src._positionY; + dst._positionZ = src._positionZ; + dst._rotation00 = src._rotation00; + dst._rotation01 = src._rotation01; + dst._rotation02 = src._rotation02; + dst._rotation10 = src._rotation10; + dst._rotation11 = src._rotation11; + dst._rotation12 = src._rotation12; + dst._rotation20 = src._rotation20; + dst._rotation21 = src._rotation21; + dst._rotation22 = src._rotation22; this._restitution = config.restitution; this._friction = config.friction; this._density = config.density; @@ -45491,13 +45603,13 @@ oimo_dynamics_rigidbody_Shape.prototype = { _this._rotation21 = transform._rotation21; _this._rotation22 = transform._rotation22; if(this._rigidBody != null) { - var _this1 = this._rigidBody; - _this1.updateMass(); - var s = _this1._shapeList; + var _this = this._rigidBody; + _this.updateMass(); + var s = _this._shapeList; while(s != null) { var n = s._next; - var tf1 = _this1._ptransform; - var tf2 = _this1._transform; + var tf1 = _this._ptransform; + var tf2 = _this._transform; var dst = s._ptransform; var src1 = s._localTransform; var __tmp__00; @@ -45807,6 +45919,9 @@ oimo_m_M.__name__ = true; var $_; function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } $global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} String.prototype.__class__ = String; String.__name__ = true; Array.__name__ = true; @@ -45818,10 +45933,6 @@ var Float = Number; var Bool = Boolean; var Class = { }; var Enum = { }; -var __map_reserved = {}; -Object.defineProperty(js__$Boot_HaxeError.prototype,"message",{ get : function() { - return String(this.val); -}}); js_Boot.__toStr = ({ }).toString; demo_common_UserInput.KEYBOARD_LENGTH = 256; demo_common_UserInput.KEYCODE_LEFT = 37; diff --git a/docs/404.html b/docs/404.html index e7c2afd..2d22163 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -File not found - OimoPhysics API documentation

404 Page not found

Page not found, sorry.

\ No newline at end of file +File not found - OimoPhysics API documentation

404 Page not found

Page not found, sorry.

\ No newline at end of file diff --git a/docs/doc.xml b/docs/doc.xml index 373a8bd..c4e7902 100644 --- a/docs/doc.xml +++ b/docs/doc.xml @@ -13,7 +13,8 @@ support field access or operators and it's bound to monomorphs. So, to work with the actual value, it needs to be explicitly promoted to another type. - + + @@ -226,6 +227,16 @@ If `x` is not found, `this` Array is not changed and the function returns false. + + + + + + Returns whether `this` Array contains `x`. + + If `x` is found by checking standard equality, the function returns `true`, otherwise + the function returns `false`. + @@ -270,11 +281,17 @@ `a[i] == a.copy()[i]` is true for any valid `i`. However, `a == a.copy()` is always false. - - + + + Returns an iterator of the Array values. - + + + + Returns an iterator of the Array indices and values. + + @@ -289,7 +306,7 @@ If `f` is null, the result is unspecified. - + @@ -325,12 +342,6 @@ Creates a new Array. - An Array is a storage for values. You can access it using indexes or - with its API. - - @see https://haxe.org/manual/std-Array.html - @see https://haxe.org/manual/lf-array-comprehension.html - @@ -549,7 +560,7 @@ @see https://haxe.org/manual/types-enum-instance.html - + @@ -569,13 +580,13 @@ Represents the ratio of the circumference of a circle to its diameter, - specified by the constant, π. `PI` is approximately 3.141592653589793. + specified by the constant, π. `PI` is approximately `3.141592653589793`. A special `Float` constant which denotes negative infinity. - For example, this is the result of -1.0 / 0.0. + For example, this is the result of `-1.0 / 0.0`. Operations with `NEGATIVE_INFINITY` as an operand may result in `NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`. @@ -587,7 +598,7 @@ A special `Float` constant which denotes positive infinity. - For example, this is the result of 1.0 / 0.0. + For example, this is the result of `1.0 / 0.0`. Operations with `POSITIVE_INFINITY` as an operand may result in `NEGATIVE_INFINITY`, `POSITIVE_INFINITY` or `NaN`. @@ -599,9 +610,9 @@ A special `Float` constant which denotes an invalid number. - NaN stands for "Not a Number". It occurs when a mathematically incorrect + `NaN` stands for "Not a Number". It occurs when a mathematically incorrect operation is executed, such as taking the square root of a negative - number: Math.sqrt(-1). + number: `Math.sqrt(-1)`. All further operations with `NaN` as an operand will result in `NaN`. @@ -617,13 +628,9 @@ Returns the absolute value of `v`. - If `v` is positive or 0, the result is unchanged. Otherwise the result - is -`v`. - - If `v` is `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is - `POSITIVE_INFINITY`. - - If `v` is `NaN`, the result is `NaN`. + - If `v` is positive or `0`, the result is unchanged. Otherwise the result is `-v`. + - If `v` is `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `v` is `NaN`, the result is `NaN`. @@ -633,9 +640,9 @@ Returns the smaller of values `a` and `b`. - If `a` or `b` are `NaN`, the result is `NaN`. - If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. - If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `a` or `b` are `NaN`, the result is `NaN`. + - If `a` or `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + - If `a` and `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. @@ -645,9 +652,9 @@ Returns the greater of values `a` and `b`. - If `a` or `b` are `NaN`, the result is `NaN`. - If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. + - If `a` or `b` are `NaN`, the result is `NaN`. + - If `a` or `b` are `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `a` and `b` are `NEGATIVE_INFINITY`, the result is `NEGATIVE_INFINITY`. @@ -724,11 +731,11 @@ Returns Euler's number, raised to the power of `v`. - exp(1.0) is approximately 2.718281828459. + `exp(1.0)` is approximately `2.718281828459`. - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `v` is `NEGATIVE_INFINITY`, the result is `0.0`. - If `v` is `NaN`, the result is `NaN`. + - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `v` is `NEGATIVE_INFINITY`, the result is `0.0`. + - If `v` is `NaN`, the result is `NaN`. @@ -740,10 +747,9 @@ This is the mathematical inverse operation of exp, i.e. `log(exp(v)) == v` always holds. - If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result - is `NaN`. - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `v` is `0.0`, the result is `NEGATIVE_INFINITY`. + - If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result is `NaN`. + - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `v` is `0.0`, the result is `NEGATIVE_INFINITY`. @@ -760,10 +766,9 @@ Returns the square root of `v`. - If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result - is `NaN`. - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. - If `v` is `0.0`, the result is `0.0`. + - If `v` is negative (including `NEGATIVE_INFINITY`) or `NaN`, the result is `NaN`. + - If `v` is `POSITIVE_INFINITY`, the result is `POSITIVE_INFINITY`. + - If `v` is `0.0`, the result is `0.0`. @@ -799,8 +804,8 @@ - Returns a pseudo-random number which is greater than or equal to 0.0, - and less than 1.0. + Returns a pseudo-random number which is greater than or equal to `0.0`, + and less than `1.0`. @@ -888,10 +893,7 @@ If the field is defined as a property, its accessors are ignored. Refer to `Reflect.getProperty` for a function supporting property accessors. - If `field` is null, the result is unspecified. - - (As3) If used on a property field, the getter will be invoked. It is - not possible to obtain the value directly. + If `field` is null, the result is unspecified. @@ -905,10 +907,7 @@ If `o` has no field named `field`, this function is only guaranteed to work for anonymous structures. - If `o` or `field` are null, the result is unspecified. - - (As3) If used on a property field, the setter will be invoked. It is - not possible to set the value directly. + If `o` or `field` are null, the result is unspecified. @@ -1107,10 +1106,23 @@ - Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null. + "Std.is is deprecated. Use Std.isOfType instead." + DEPRECATED. Use `Std.isOfType(v, t)` instead. + + Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null. If `t` is a class or interface with `@:generic` meta, the result is `false`. + + + + + + + Tells if a value `v` is of the type `t`. Returns `false` if `v` or `t` are null. + + If `t` is a class or interface with `@:generic` meta, the result is `false`. + @@ -1428,11 +1440,12 @@ String. If `startIndex` is given, the search is performed within the substring - of `this` String starting from `startIndex` (if `startIndex` is posivite - or 0) or `max(this.length + startIndex, 0)` (if `startIndex` is negative). + of `this` String starting from `startIndex`. If `startIndex` exceeds `this.length`, -1 is returned. + If `startIndex` is negative, the result is unspecifed. + Otherwise the search is performed within `this` String. In either case, the returned position is relative to the beginning of `this` String. @@ -1452,6 +1465,8 @@ is performed within `this` String. In either case, the returned position is relative to the beginning of `this` String. + If `startIndex` is negative, the result is unspecifed. + If `str` cannot be found, -1 is returned. @@ -1601,12 +1616,9 @@ A String buffer is an efficient way to build a big string by appending small elements together. - Its cross-platform implementation uses String concatenation internally, but - StringBuf may be optimized for different targets. - Unlike String, an instance of StringBuf is not immutable in the sense that it can be passed as argument to functions which modify it by appending more - values. However, the internal buffer cannot be modified. + values. @@ -1809,9 +1821,7 @@ The order of the fields in the returned Array is unspecified. - If `c` is null, the result is unspecified. - - (As3) This method only returns instance fields that are public. + If `c` is null, the result is unspecified. @@ -1824,9 +1834,7 @@ The order of the fields in the returned Array is unspecified. - If `c` is null, the result is unspecified. - - (As3) This method only returns class fields that are public. + If `c` is null, the result is unspecified. @@ -1958,6 +1966,363 @@ + + + + + Signed 64-bit integer type and operations. + + + + + + Unsigned 64-bit integer type and operations. + + + + + + + Inter-loop communication. + + @see https://aantron.github.io/luv/luv/Luv/Async + + eval.luv.Handle + + + + + + + + + + + + + + Allocates and initializes an async handle. + + The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed. + + + + + eval.luv.Handle + + + + + + + + + + + + + + + Allocates and initializes an async handle. + + The handle should be cleaned up with `eval.luv.Handle.close` when no longer needed. + + + + + eval.luv.Handle + + + + + + + + + Handles. + + @see https://aantron.github.io/luv/luv/Luv/Handle + + + + + + + + + Un-reference the given handle. + + @see https://aantron.github.io/luv/luv/Luv/Handle/#val-unref + + + + + + + + + + + + + + + Un-reference the given handle. + + @see https://aantron.github.io/luv/luv/Luv/Handle/#val-unref + + + + + + + + + + + + + + + + + Configuration options. + @see http://docs.libuv.org/en/v1.x/loop.html#c.uv_loop_configure + + + + + + + + + + Event loops. + + @see https://aantron.github.io/luv/luv/Luv/Loop + + Haxe event loops define an implicit cast to libuv loops. That is, you can use + `sys.thread.Thread.current().events` in any place where `eval.luv.Loop` is + expected. + + + + + + Allocates and initializes a new event loop. + + + + + + + + + Runs an event loop. + + + + + + + + + + + + Allocates and initializes a new event loop. + + + + + + + + + Runs an event loop. + + + + + + + + + + + + + + Exception message. + + + + Native exception, which caused this exception. + + <__exceptionMessage> + + + + <__nativeStack> + + + + <__skipStack expr="0"> + + + 0 + + "haxe.Exception.get_stack" + + + <__nativeException> + + + + <__previousException> + + + + + + "haxe.Exception.thrown" + Returns exception message. + + + + + + + + + + + Create a new Exception instance. + + The `previous` argument could be used for exception chaining. + + The `native` argument is for internal usage only. + There is no need to provide `native` argument manually and no need to keep it + upon extending `haxe.Exception` unless you know what you're doing. + + = null; + a.push(1); // generates target-specific null-pointer exception + } catch(e:haxe.Exception) { + throw e; // rethrows native exception instead of haxe.Exception + } + ```]]> + + + + + + + + + + + The error. + + + + + + + + + Instantiates an error with given message and position. + + Exceptions thrown by functions in `eval.luv` package. + + + + + + + + + Operation completed successfully. + + + + Operation failed. + + Outcome of an operation. + eval.luv.Result.ResultTools + + + + + + + + + + + + + Timers. + + @see https://aantron.github.io/luv/luv/Luv/Timer + + eval.luv.Handle + + + + + eval.luv.Handle + + + + + Error handling. + + @see https://aantron.github.io/luv/luv/Luv/Error + + + + + + + + + + + + @@ -2057,6 +2422,10 @@ + + + sys.thread.Thread + @@ -2067,14 +2436,48 @@ Exceptions caused while executing `f` are printed to stderr and are not propagated to the parent thread. +
- + + + +
* this class just imports all the classes in the library
+ + + + + + + + + + + + + + + Elements return by `CallStack` methods. + + + + + Get information about the call stack. + + haxe.Exception + haxe.CallStack + + + + haxe.CallStack + haxe.Exception + + This type unifies with any function type. @@ -2082,7 +2485,7 @@ It is intended to be used as a type parameter constraint. If used as a real type, the underlying type will be `Dynamic`. - + @@ -2091,7 +2494,15 @@ It is intended to be used as a type parameter constraint. If used as a real type, the underlying type will be `Dynamic`. - + + + + + This type unifies with anything but `Void`. + + It is intended to be used as a type parameter constraint. If used as a real + type, the underlying type will be `Dynamic`. + @@ -2107,114 +2518,8 @@ It is intended to be used as a type parameter constraint. If used as a real type, the underlying type will be `Dynamic`.]]> - + - - - - The current thread acquire the mutex or wait if not available. - The same thread can acquire several times the same mutex but - must release it as many times it has been acquired. - - - - Try to acquire the mutex, returns true if acquire or false - if it's already locked by another thread. - - - - Release a mutex that has been acquired by the current thread. - The behavior is undefined if the current thread does not own - the mutex. - - - - Creates a mutex. - - Creates a mutex, which can be used to acquire a temporary lock - to access some ressource. The main difference with a lock is - that a mutex must always be released by the owner thread. - - - - - - - - - Waits for the lock to be released, or `timeout` (in seconds) - to expire. Returns `true` if the lock is released and `false` - if a time-out occurs. - - - - Releases the lock once. - - The thread does not need to own the lock in order to release - it. Each call to `release` allows exactly one call to `wait` - to execute. - - - - Creates a new Lock which is initially locked. - - A Lock allows blocking execution until it has been unlocked. It keeps track - of how often `release` has been called, and blocks exactly as many `wait` - calls. - - The order of the `release` and `wait` calls is irrelevant. That is, a Lock - can be released before anyone waits for it. In that case, the `wait` call - will execute immediately. - - Usage example: - - ``` - var lock = new Lock(); - var elements = [1, 2, 3]; - for (element in elements) { - // Create one thread per element - new Thread(function() { - trace(element); - Sys.sleep(1); - // Release once per thread = 3 times - lock.release(); - }); - } - for (_ in elements) { - // Wait 3 times - lock.wait(); - } - trace("All threads finished"); - ``` - - - - - - new Lock() - - - - new Mutex() - - - - ()]]> - - - - 0 - - - - - - Start the main loop. Depending on the platform, this can return immediately or will only return when the application exits. - - If `haxe.MainLoop` is kept from DCE, then we will insert an `haxe.EntryPoint.run()` call just at then end of `main()`. - This class can be redefined by custom frameworks so they can handle their own main loop logic. - - @@ -2375,7 +2680,8 @@ Int32 provides a 32-bit integer with consistent overflow behavior across all platforms. - + + @@ -2386,17 +2692,8 @@ A cross-platform signed 64-bit integer. Int64 instances can be created from two 32-bit words using `Int64.make()`. - - - - - - - - - - - + + @@ -2443,37 +2740,23 @@ - - - - - - - true - Tells if the event can lock the process from exiting (default:true) - - - - - - - - - - - - - - - - - - Run the pending events. Return the time for next event. - + + + + + + + "haxe.NativeStackTrace.exceptionStack" + + + <_callStack set="method" line="20" static="1"> + + Do not use manually. - haxe.MainEvent + hide + @@ -2497,6 +2780,35 @@ This can be used to track positions of calls in e.g. a unit testing framework. + + + + + Thrown value. + + + + + + + + An exception containing arbitrary value. + + This class is automatically used for throwing values, which don't extend `haxe.Exception` + or native exception type. + For example: + ```haxe + throw "Terrible error"; + ``` + will be compiled to + ```haxe + throw new ValueException("Terrible error"); + ``` + + + + + @@ -2507,7 +2819,7 @@ See `Map` for documentation details. @see https://haxe.org/manual/std-Map.html - + @@ -2626,8 +2938,11 @@ Map is an abstract type, it is not available at runtime. @see https://haxe.org/manual/std-Map.html]]> - @:followWithAbstracts K - + + + @:followWithAbstracts K + + @@ -2716,6 +3031,7 @@ + `ReadOnlyArray` is an abstract over an ordinary `Array` which only exposes APIs that don't modify the instance, hence "read-only". @@ -2723,25 +3039,19 @@ Other code holding a reference to the underlying `Array` can still modify it, and the reference can be obtained with a `cast`. - concat copy filter indexOf iterator + keyValueIterator join lastIndexOf map slice + contains toString - - - - - The length of `this` Array. - - - + @@ -2828,14 +3138,7 @@ targets, and is never slower. @see https://haxe.org/manual/std-vector.html - - - - - Returns the length of `this` Vector. - - - + @@ -3006,9 +3309,20 @@ - + + + The IO is set into nonblocking mode and some data cannot be read or written + An integer value is outside its allowed range + An operation on Bytes is outside of its valid range + + + Other errors + + The possible IO errors that can occur + + An Input is an abstract reader. See other classes in the `haxe.io` package for several possible implementations. @@ -3024,6 +3338,30 @@ Output. + + + + + 0 + + + + See `Iterator.hasNext` + + + + See `Iterator.next` + + + + + + + Create a new `ArrayIterator`. + + ` is passed to `Iterable`]]> + + @@ -3074,6 +3412,7 @@ + The expression of the case, if available. @@ -3084,12 +3423,18 @@ + The type-hint of the variable, if available. The name of the variable. + + + + Metadata associatied with the variable, if available. + @@ -3097,6 +3442,7 @@ + The expression of the variable, if available. @@ -3106,7 +3452,8 @@ - + + The type of the catch. @@ -3119,7 +3466,7 @@ Represents a catch in the AST. - @https://haxe.org/manual/expression-try-catch.html + @see https://haxe.org/manual/expression-try-catch.html @@ -3145,7 +3492,7 @@ Sub is set on module sub-type access: - `pack.Module.Type` has name = Module, sub = Type, if available. + `pack.Module.Type` has `name = "Module"`, `sub = "Type"`, if available. @@ -3191,6 +3538,7 @@ + The return type-hint of the function, if available. @@ -3200,6 +3548,7 @@ + The expression of the function body, if available. @@ -3218,6 +3567,7 @@ + The type-hint of the function argument, if available. @@ -3435,6 +3785,10 @@ Whether or not the class field is extern. + + + Whether or not the class field is abstract. + Returns the typed expression of the class field. @@ -3587,6 +3941,10 @@ Whether or not the type is extern. + + + If true the class is abstract and cannot be instantiated directly. + @@ -5598,12 +5956,12 @@ - + 1.0 - + @@ -5612,7 +5970,7 @@ - + * Default constructor. @@ -5628,7 +5986,7 @@ - + @@ -5638,15 +5996,15 @@ - + * Clips the incident face by the reference face, generates up to eight vertices. - + * Reduces vertices up to four. - + @@ -6933,7 +7291,7 @@ * The element at row 2 column 2. - + @@ -7245,7 +7603,7 @@ * Returns the string representation of the matrix. - + @@ -7336,7 +7694,7 @@ * The element at row 3 column 3. - + @@ -7683,7 +8041,7 @@ * Returns the string representation of the matrix. - + @@ -13391,23 +13749,23 @@ * Extra field that users can use for their own purposes. - <_integrate public="1" set="method" line="141"> + <_integrate public="1" set="method" line="142"> hide - <_integratePseudoVelocity public="1" set="method" line="182"> + <_integratePseudoVelocity public="1" set="method" line="183"> hide - - + + * Returns the world position of the rigid body. - + @@ -13416,25 +13774,25 @@ * * This does not create a new instance of `Vec3`. - + * Sets the world position of the rigid body to `position`. - + * Translates the position of the rigid body by `translation`. - + * Returns the rotation matrix of the rigid body. - + @@ -13443,39 +13801,39 @@ * * This does not create a new instance of `Mat3`. - + * Sets the rotation matrix of the rigid body to `rotation`. - + * Sets the rotation of the rigid body by Euler angles `eulerAngles` in radians. - + * Rotates the rigid body by the rotation matrix `rotation`. - + * Rotates the rigid body by Euler angles `eulerAngles` in radians. - + * Returns the rotation of the rigid body as a quaternion. - + @@ -13484,18 +13842,18 @@ * * This does not create a new instance of `Quat`. - + * Sets the rotation of the rigid body from a quaternion `quaternion`. - + * Returns the transform of the rigid body. - + @@ -13504,7 +13862,7 @@ * * This does not create a new instance of `Transform`. - + @@ -13513,17 +13871,17 @@ * * This does not keep any references to `transform`. - + * Returns the mass of the rigid body. * * If the rigid body has infinite mass, `0` will be returned. - + * Returns the moment of inertia tensor in local space. - + @@ -13532,11 +13890,11 @@ * * This does not create a new instance of `Mat3` - + * Returns the mass data of the rigid body. - + @@ -13545,7 +13903,7 @@ * * This does not create a new instance of `MassData`. - + @@ -13556,11 +13914,11 @@ * - some shapes are added or removed * - the type of the rigid body is changed - + * Returns the rotation factor of the rigid body. - + @@ -13571,11 +13929,11 @@ * angular velocity in **global space** along X, Y and Z axis will scale by `rotationFactor.x`, * `rotationFactor.y` and `rotationFactor.z` times respectively. - + * Returns the linear velocity of the rigid body. - + @@ -13584,18 +13942,18 @@ * * This does not create a new intrance of `Vec3`. - + * Sets the linear velocity of the rigid body. - + * Returns the angular velocity of the rigid body. - + @@ -13604,28 +13962,28 @@ * * This does not create a new intrance of `Vec3`. - + * Sets the angular velocity of the rigid body. - + * Adds `linearVelocityChange` to the linear velcity of the rigid body. - + * Adds `angularVelocityChange` to the angular velcity of the rigid body. - + @@ -13635,7 +13993,7 @@ * * This changes both the linear velocity and the angular velocity. - + @@ -13644,7 +14002,7 @@ * * This does not change the angular velocity. - + @@ -13653,7 +14011,7 @@ * * This does not change the linear velocity. - + @@ -13661,25 +14019,25 @@ * Applies the force `force` to `positionInWorld` in world position. - + * Applies the force `force` to the center of mass. - + * Applies the torque `torque`. - + * Returns the total linear impulse applied by contact constraints. - + @@ -13688,11 +14046,11 @@ * * This does not create a new instance of `Vec3`. - + * Returns the total angular impulse applied by contact constraints. - + @@ -13701,11 +14059,11 @@ * * This does not create a new instance of `Vec3`. - + * Returns the gravity scaling factor of the rigid body. - + @@ -13714,14 +14072,14 @@ * * If `0` is set, the rigid body will not be affected by gravity. - + * Returns the local coordinates of the point `worldPoint` in world coodinates. - + @@ -13731,14 +14089,14 @@ * * This does not create a new instance of `Vec3`. - + * Returns the local coordinates of the vector `worldVector` in world coodinates. - + @@ -13748,14 +14106,14 @@ * * This does not create a new instance of `Vec3`. - + * Returns the world coordinates of the point `localPoint` in local coodinates. - + @@ -13765,14 +14123,14 @@ * * This does not create a new instance of `Vec3`. - + * Returns the world coordinates of the vector `localVector` in local coodinates. - + @@ -13782,51 +14140,51 @@ * * This does not create a new instance of `Vec3`. - + * Returns the number of the shapes added. - + * Returns the list of the shapes of the rigid body. - + * Returns the number of the contact lists the rigid body is involved. - - + + * Returns the list of the contact links the rigid body is involved. - + * Returns the number of the joint links the rigid body is attached. - + * Returns the list of the joint links the rigid body is attached. - + * Adds the shape to the rigid body. - + * Removes the shape from the rigid body. - + * Returns the rigid body's type of behaviour. * * See `RigidBodyType` class for details. - + @@ -13835,28 +14193,28 @@ * * See `RigidBodyType` class for details. - + * Sets the rigid body's sleep flag false. * * This also resets the sleeping timer of the rigid body. - + * Sets the rigid body's sleep flag true. * * This also resets the sleeping timer of the rigid body. - + * Returns whether the rigid body is sleeping. - + * Returns how long the rigid body is stopping moving. This returns `0` if the body * has already slept. - + @@ -13865,41 +14223,41 @@ * * If auto sleep is enabled, the rigid body will automatically sleep when needed. - + * Returns the linear damping. - + * Sets the linear damping to `damping`. - + * Returns the angular damping. - + * Sets the angular damping to `damping`. - + * Returns the previous rigid body in the world. * * If the previous one does not exist, `null` will be returned. - + * Returns the next rigid body in the world. * * If the next one does not exist, `null` will be returned. - + @@ -14301,8 +14659,86 @@ + + + + + + + + + + eval.luv.Loop + + + + + [] + + + + Execute all pending events. + Wait and execute as many events as many times `promiseEvent()` was called. + Runs until all repeating events are cancelled and no more events is expected. + + Depending on a target platform this method may be non-reentrant. It must + not be called from event callbacks. + + + + + + + An event loop implementation used for `sys.thread.Thread` + + + + + + + + + + The current thread acquire the mutex or wait if not available. + The same thread can acquire several times the same mutex but + must release it as many times it has been acquired. + + + + Try to acquire the mutex, returns true if acquire or false + if it's already locked by another thread. + + + + Release a mutex that has been acquired by the current thread. + The behavior is undefined if the current thread does not own + the mutex. + + + + Creates a mutex. + + Creates a mutex, which can be used to acquire a temporary lock + to access some ressource. The main difference with a lock is + that a mutex must always be released by the owner thread. + + - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/haxe-nav.css b/docs/haxe-nav.css index 0f16bd1..431c457 100644 --- a/docs/haxe-nav.css +++ b/docs/haxe-nav.css @@ -1,153 +1,189 @@ nav.nav { - font-family: "Open Sans", sans-serif; - font-size: 16px; - margin:0; + font-family: "Open Sans", sans-serif; + font-size: 16px; + margin: 0; } nav .fa { - color:#777; - margin-right:5px; + color: #777; + margin-right: 5px; } -body nav * {line-height:20px;} +body nav * { + line-height: 20px; +} -nav .navbar-inverse .navbar-inner { - background:#13110f; - border:0; +nav .navbar-inner { + background: #13110f; + border: 0; + border-radius: 0; } nav .navbar .nav { - margin:0; + margin: 0; + } nav .dropdown-menu { - background:#2c2722; - font-size: 14px; - border-radius:0px 0px 2px 2px; - padding:10px 0px; - border:1px solid #2c2722; - margin-top:-1px; + background: #2c2722; + font-size: 14px; + border-radius: 0px 0px 2px 2px; + padding: 10px 0px; + border: 1px solid #2c2722; + margin-top: -1px; } nav .navbar .nav>li>a { - padding: 14px 12px 15px 12px; - color:#ccc; + padding: 14px 12px 15px 12px; + color: #ccc; } nav .dropdown-menu li a { - color: #b8b5b5; - padding:3px 15px; + color: #b8b5b5; + padding: 3px 15px; } + nav .divider { - background-color:transparent; - border-right:1px solid #39332d; - margin:5px 20px 5px 10px; - height:39px; + background-color: transparent; + border-right: 1px solid #39332d; + margin: 5px 20px 5px 10px; + height: 39px; } nav .dropdown-menu .divider { - background-color:transparent; - border:0; - border-bottom:1px solid #39332d; - margin:5px 0; + background-color: transparent; + border: 0; + border-bottom: 1px solid #39332d; + margin: 5px 0; } -nav .navbar-inverse .nav .active>a, nav .navbar-inverse .nav .active>a:hover, nav .navbar-inverse .nav .active>a:focus, nav .navbar-inverse .nav li.dropdown.open>.dropdown-toggle, nav .navbar-inverse .nav li.dropdown.active>.dropdown-toggle, nav .navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle { - color: #fff; - background-color:transparent; - background-image:none; +nav .navbar-inverse .nav .active>a, +nav .navbar-inverse .nav .active>a:hover, +nav .navbar-inverse .nav .active>a:focus, +nav .navbar-inverse .nav li.dropdown.open>.dropdown-toggle, +nav .navbar-inverse .nav li.dropdown.active>.dropdown-toggle, +nav .navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle { + color: #fff; + background-color: transparent; + background-image: none; } - nav .navbar-inverse .nav .active>a:hover { - background:#39332d; +nav .navbar-inverse .nav .active>a:hover { + background: #39332d; } -nav .dropdown-menu>.active>a, nav .dropdown-menu>.active>a:hover, nav .dropdown-menu>.active>a:focus { - font-weight:bold; - color: #fff; - background-image:none; - background:#39332d; +nav .dropdown-menu>.active>a, +nav .dropdown-menu>.active>a:hover, +nav .dropdown-menu>.active>a:focus { + font-weight: bold; + color: #fff; + background-image: none; + background: #39332d; } -nav .dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus, nav .dropdown-submenu:hover>a, nav .dropdown-submenu:focus>a { - background:#39332d; +nav .dropdown-menu>li>a:hover, +.dropdown-menu>li>a:focus, +nav .dropdown-submenu:hover>a, +nav .dropdown-submenu:focus>a { + background: #39332d; } nav .navbar .nav>li>.dropdown-menu:after { - border-bottom-color:#2c2722; + border-bottom-color: #2c2722; } /** MEDIA Q **/ -@media (max-width: 979px) -{ - nav .navbar-fixed-top .navbar-inner, nav .navbar-fixed-bottom .navbar-inner { - padding: 0px; - } - nav .navbar-fixed-top { - margin-bottom: 0; - } +@media (max-width: 979px) { + + nav .navbar-fixed-top .navbar-inner, + nav .navbar-fixed-bottom .navbar-inner { + padding: 0px; + } + + nav .navbar-fixed-top { + margin-bottom: 0; + } } /** SUB BRAND LOGOS **/ -.navbar .brand.haxe-logo { padding-right:0; margin: 3px 0 0 0px; } -.navbar .brand.haxe-logo:hover { opacity:.9; } +.navbar .brand.haxe-logo { + padding-right: 0; + margin: 3px 0 0 0px; +} + +.navbar .brand.haxe-logo:hover { + opacity: .9; +} .navbar .brand.haxe-logo:after { - content:" "; - position:absolute; - /* create arrow */ - width: 0; - height: 0; - border-top: 22px solid transparent; - border-bottom: 22px solid transparent; - border-left: 7px solid #13110f; /* same color as nav bar */ - top:0; -} -.navbar .brand.sub { - background: #39332d; /* Old browsers */ - background: -moz-linear-gradient(top, #39332d 50%, #2c2722 51%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#39332d), color-stop(51%,#2c2722)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #39332d 50%,#2c2722 51%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #39332d 50%,#2c2722 51%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #39332d 50%,#2c2722 51%); /* IE10+ */ - background: linear-gradient(to bottom, #39332d 50%,#2c2722 51%); /* W3C */ - padding:14px 20px 13px 20px; - margin:0 10px 0 0; - font:bold 18px "arial black", "open sans"; - line-height:22px; - color:rgb(255,255,255); + content: " "; + position: absolute; + /* create arrow */ + width: 0; + height: 0; + border-top: 22px solid transparent; + border-bottom: 22px solid transparent; + border-left: 7px solid #13110f; + /* same color as nav bar */ + top: 0; +} + +.navbar .brand.sub { + background: #39332d; + /* Old browsers */ + background: -moz-linear-gradient(top, #39332d 50%, #2c2722 51%); + /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(50%, #39332d), color-stop(51%, #2c2722)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #39332d 50%, #2c2722 51%); + /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #39332d 50%, #2c2722 51%); + /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #39332d 50%, #2c2722 51%); + /* IE10+ */ + background: linear-gradient(to bottom, #39332d 50%, #2c2722 51%); + /* W3C */ + padding: 14px 20px 13px 20px; + margin: 0 10px 0 0; + font: bold 18px "arial black", "open sans"; + line-height: 22px; + color: rgb(255, 255, 255); } + .navbar .brand.sub:hover { - color:rgb(230,230,230); - background: #2c2722; /* Old browsers */ + color: rgb(230, 230, 230); + background: #2c2722; + /* Old browsers */ } .navbar .brand.sub:before { - content:".."; /* two dots */ - position:absolute; - margin-left:-33px; - margin-top:-28px; - line-height:0px; - font:bold 40px "Open Sans", sans-serif; - letter-spacing:0px; - color:#fff200; + content: ".."; + /* two dots */ + position: absolute; + margin-left: -33px; + margin-top: -28px; + line-height: 0px; + font: bold 40px "Open Sans", sans-serif; + letter-spacing: 0px; + color: #fff200; } /** SUB BRAND COLORS **/ .navbar .brand.sub.try:before { - color:#f89c0e; + color: #f89c0e; } .navbar .brand.sub.api:before { - color:#eedc16; + color: #eedc16; } .navbar .brand.sub.lib:before { - color:#f1471d; + color: #f1471d; } + .navbar .brand.sub.ide:before { - color:#f89c0e; -} + color: #f89c0e; +} \ No newline at end of file diff --git a/docs/highlighter.css b/docs/highlighter.css index 4ff7fc4..1e8a8b7 100644 --- a/docs/highlighter.css +++ b/docs/highlighter.css @@ -1,46 +1,65 @@ /** Code Highlighting **/ -html pre, html pre code { - font-family: consolas, monospace; - white-space: pre; - overflow-x: auto; +html pre, +html pre code { + font-family: consolas, monospace; + white-space: pre; + overflow-x: auto; } + code { - color: #333; + color: #333; } + code a { - color: #08c; + color: #08c; } + pre { - color: #333; - margin: 15px 0; - padding: 0.5em; + color: #333; + margin: 15px 0; + padding: 0.5em; } -pre .type { - color: #0086b3; + +pre .type { + color: #0086b3; } + pre .kwd { - color: #00a; + color: #00a; } -pre .val { - color: #44a; + +pre .val { + color: #44a; } -pre .str, div.pre .str, pre .str .kwd, pre .str .val, pre .str .type { - color: #a00; + +pre .str, +div.pre .str, +pre .str .kwd, +pre .str .val, +pre .str .type { + color: #a00; } + pre .cmt { - color: #008800; - color: #998; - font-style: italic; + color: #008800; + color: #998; + font-style: italic; } + /* Make sure keywords inside comments are not highlighted*/ -pre .cmt .kwd, pre .cmt .str, pre .cmt .val, pre .cmt .type { - color: #998; +pre .cmt .kwd, +pre .cmt .str, +pre .cmt .val, +pre .cmt .type { + color: #998; } + .last-modified { - color:#999; + color: #999; } + .semantic { - display:none; -} + display: none; +} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index d672f20..941ed8d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

top level version 1.2.2

OimoPhysics API Documentation

oimo
\ No newline at end of file +

top level version 1.2.2

OimoPhysics API Documentation

oimo
\ No newline at end of file diff --git a/docs/index.js b/docs/index.js index c25114a..135b3e5 100644 --- a/docs/index.js +++ b/docs/index.js @@ -1,4 +1,4 @@ -function createCookie(name, value, days) { +function createCookie(name, value) { localStorage.setItem(name, value); } @@ -10,11 +10,11 @@ function toggleInherited(el) { var toggle = $(el).closest(".toggle"); toggle.toggleClass("toggle-on"); if (toggle.hasClass("toggle-on")) { - $("i", toggle).removeClass("fa-arrow-circle-right").addClass("fa-arrow-circle-down"); + $("i", toggle).removeClass("fa-folder").addClass("fa-folder-open"); } else { - $("i", toggle).addClass("fa-arrow-circle-right").removeClass("fa-arrow-circle-down"); + $("i", toggle).addClass("fa-folder").removeClass("fa-folder-open"); } - return false; + return false; } function toggleCollapsed(el) { @@ -22,29 +22,23 @@ function toggleCollapsed(el) { toggle.toggleClass("expanded"); if (toggle.hasClass("expanded")) { - $(toggle).find("i").first().removeClass("fa-arrow-circle-right").addClass("fa-arrow-circle-down"); + $(toggle).find("i").first().removeClass("fa-folder").addClass("fa-folder-open"); } else { - $(toggle).find("i").first().addClass("fa-arrow-circle-right").removeClass("fa-arrow-circle-down"); + $(toggle).find("i").first().addClass("fa-folder").removeClass("fa-folder-open"); } updateTreeState(); - return false; + return false; } -function updateTreeState(){ +function updateTreeState() { var states = []; - $("#nav .expando").each(function(i, e){ + $("#nav .expando").each(function (i, e) { states.push($(e).hasClass("expanded") ? 1 : 0); }); var treeState = JSON.stringify(states); createCookie("treeState", treeState); } -var filters = {}; - -function selectVersion(e) { - setVersion($(e.target).parent().attr("data")); -} - function setPlatform(platform) { createCookie("platform", platform); $("#select-platform").val(platform); @@ -57,13 +51,12 @@ function setPlatform(platform) { for (var i = 0; i < platforms.length; i++) { var p = platforms[i]; if (platform == "sys") { - if (p != "flash" && p != "js") { + if (p != "flash" && p != "js") { styles += ".platform-" + p + " { display:inherit } "; } } - else - { - if (platform == "all" || p == platform) { + else { + if (platform == "all" || p == platform) { styles += ".platform-" + p + " { display:inherit } "; } } @@ -75,44 +68,100 @@ function setPlatform(platform) { $("#dynamicStylesheet").text(styles); } -/* -function setVersion(version) { - createCookie("version", version); -} -*/ -$(document).ready(function(){ +$(document).ready(function () { $("#nav").html(navContent); var treeState = readCookie("treeState"); - $("#nav .expando").each(function(i, e){ - $("i", e).first().addClass("fa-arrow-circle-right").removeClass("fa-arrow-circle-down"); + $("#nav .expando").each(function (i, e) { + $("i", e).first().addClass("fa-folder").removeClass("fa-folder-open"); }); - $(".treeLink").each(function() { + $(".treeLink").each(function () { this.href = this.href.replace("::rootPath::", dox.rootPath); }); - if (treeState != null) - { + if (treeState != null) { var states = JSON.parse(treeState); - $("#nav .expando").each(function(i, e){ + $("#nav .expando").each(function (i, e) { if (states[i]) { $(e).addClass("expanded"); - $("i", e).first().removeClass("fa-arrow-circle-right").addClass("fa-arrow-circle-down"); + $("i", e).first().removeClass("fa-folder").addClass("fa-folder-open"); } }); } $("head").append(""); setPlatform(readCookie("platform") == null ? "all" : readCookie("platform")); - //setVersion(readCookie("version") == null ? "3_0" : readCookie("version")); - $("#search").on("input", function(e){ + $("#search").on("input", function (e) { searchQuery(e.target.value); }); - - $("#select-platform").selectpicker().on("change", function(e){ + $(document).bind("keyup keydown", function (e) { + if (e.ctrlKey && e.keyCode == 80) { // ctrl + p + $("#search").focus(); + return false; + } + return true; + }); + function getItems() { + return $("#search-results-list a").toArray(); + } + $("#search").bind("keyup", function (e) { + switch (e.keyCode) { + case 27: // escape + searchQuery(""); + $("#search").val("") + $("#search").blur(); + return false; + + case 13: // enter + var items = getItems(); + for (i = 0; i < items.length; i++) { + var item = $(items[i]); + if (item.hasClass("selected")) { + window.location = items[i].href; + break; + } + } + return false; + } + }); + $("#search").bind("keydown", function (e) { + function mod(a, b) { + var r = a % b; + return r < 0 ? r + b : r; + } + function changeSelection(amount) { + var previousSelection = null; + var items = getItems(); + for (i = 0; i < items.length; i++) { + var item = $(items[i]); + if (item.hasClass("selected")) { + item.removeClass("selected"); + previousSelection = i; + break; + } + } + var newSelection = mod(previousSelection + amount, items.length); + $(items[newSelection]).addClass("selected"); + items[newSelection].scrollIntoView(false); + } + switch (e.keyCode) { + case 38: // up + changeSelection(-1); + return false; + + case 40: // down + changeSelection(1); + return false; + + case 13: // enter + return false; + } + }); + + $("#select-platform").selectpicker().on("change", function (e) { var value = $(":selected", this).val(); setPlatform(value); }); @@ -126,9 +175,9 @@ $(document).ready(function(){ $("a.expand-button").click(function (e) { var container = $(this).parent().next(); container.toggle(); - $("i", this).removeClass("fa-arrow-circle-down") - .removeClass("fa-arrow-circle-right") - .addClass(container.is(":visible") ? "fa-arrow-circle-down" : "fa-arrow-circle-right"); + $("i", this).removeClass("fa-folder-open") + .removeClass("fa-folder") + .addClass(container.is(":visible") ? "fa-folder-open" : "fa-folder"); return false; }); @@ -139,9 +188,9 @@ $(document).ready(function(){ function searchQuery(query) { $("#searchForm").removeAttr("action"); query = query.replace(/[&<>"']/g, ""); - if (!query || query.length<2) { + if (!query || query.length < 2) { $("#nav").removeClass("searching"); - $("#nav li").each(function(index, element){ + $("#nav li").each(function (index, element) { var e = $(element); e.css("display", ""); }); @@ -153,8 +202,8 @@ function searchQuery(query) { var listItems = []; var bestMatch = 200; $("#nav").addClass("searching"); - $("#nav ul:first-child").css("display","none"); - $("#nav li").each(function(index, element) { + $("#nav ul:first-child").css("display", "none"); + $("#nav li").each(function (index, element) { var e = $(element); if (!e.hasClass("expando")) { var content = e.attr("data_path"); @@ -163,7 +212,7 @@ function searchQuery(query) { if (score < bestMatch) { var url = dox.rootPath + e.attr("data_path").split(".").join("/") + ".html"; $("#searchForm").attr("action", url); - // best match will be form action + // best match will be form action bestMatch = score; } @@ -171,7 +220,7 @@ function searchQuery(query) { // highlight matched parts var elLinkContent = elLink.text().replace(new RegExp("(" + queryParts.join("|").split(".").join("|") + ")", "ig"), "$1"); var liStyle = (score == 0) ? ("font-weight:bold") : ""; - listItems.push({score: score, item: "
  • " + elLinkContent + "
  • "}); + listItems.push({ score: score, item: "
  • " + elLinkContent + "
  • " }); } } }); @@ -179,8 +228,11 @@ function searchQuery(query) { // append to nav $("#nav").parent().append(""); } - listItems.sort(function(x, y) { return x.score - y.score; }); // put in order - $("#search-results-list").css("display","block").html(listItems.map(function(x) { return x.item; }).join("")); + listItems.sort(function (x, y) { return x.score - y.score; }); // put in order + $("#search-results-list").css("display", "block").html(listItems.map(function (x) { return x.item; }).join("")); + // pre-select the first item + $("#search-results-list a").removeClass("selected"); + $("#search-results-list a:first").addClass("selected"); } function match(textParts, query) { @@ -234,15 +286,15 @@ function searchMatch(text, queryParts) { function errorSearch() { var errorURL = ""; - if(!!window.location.pathname) { + if (!!window.location.pathname) { errorURL = window.location.pathname; - }else if(!!window.location.href) { + } else if (!!window.location.href) { errorURL = window.location.href; } - if(!!errorURL) { + if (!!errorURL) { var searchTerm = errorURL.split("/").pop(); - if(searchTerm.indexOf(".html") > -1) { searchTerm = searchTerm.split(".html").join(""); } - if(!!searchTerm) { + if (searchTerm.indexOf(".html") > -1) { searchTerm = searchTerm.split(".html").join(""); } + if (!!searchTerm) { // update filter with search term $("#search").val(searchTerm); searchQuery(searchTerm); diff --git a/docs/nav.js b/docs/nav.js index d37b90d..82ab782 100644 --- a/docs/nav.js +++ b/docs/nav.js @@ -1 +1 @@ -var navContent=''; \ No newline at end of file +var navContent=''; \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhase.html b/docs/oimo/collision/broadphase/BroadPhase.html index ec9ed1b..0ca6d67 100644 --- a/docs/oimo/collision/broadphase/BroadPhase.html +++ b/docs/oimo/collision/broadphase/BroadPhase.html @@ -6,17 +6,17 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The abstract class of a broad-phase collision detection algorithm.

    Methods

    aabbTest (aabb:Aabb, callback:BroadPhaseProxyCallback):Void

    Performs an AABB query. callback.process is called for all proxies that their AABB -and aabb intersect.

    collectPairs ():Void

    Collects overlapping pairs of the proxies and put them into a linked list. The linked list +

    The abstract class of a broad-phase collision detection algorithm.

    Methods

    aabbTest(aabb:Aabb, callback:BroadPhaseProxyCallback):Void

    Performs an AABB query. callback.process is called for all proxies that their AABB +and aabb intersect.

    collectPairs():Void

    Collects overlapping pairs of the proxies and put them into a linked list. The linked list can be get through BroadPhase.getProxyPairList method.

    Note that in order to collect pairs, the broad-phase algorithm requires to be informed of -movements of proxies through BroadPhase.moveProxy method.

    convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:BroadPhaseProxyCallback):Void

    Performs a convex casting. callback.process is called for all shapes the convex geometry +movements of proxies through BroadPhase.moveProxy method.

    convexCast(convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:BroadPhaseProxyCallback):Void

    Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning -transform begin.

    createProxy (userData:Any, aabb:Aabb):Proxy

    Returns a new proxy connected with the user data userData containing the axis-aligned -bounding box aabb, and adds the proxy into the collision space.

    destroyProxy (proxy:Proxy):Void

    Removes the proxy proxy from the collision space.

    inlinegetProxyPairList ():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount ():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental ():Bool

    Returns whether to collect only pairs created in the last step. If this returns +transform begin.

    createProxy(userData:Any, aabb:Aabb):Proxy

    Returns a new proxy connected with the user data userData containing the axis-aligned +bounding box aabb, and adds the proxy into the collision space.

    destroyProxy(proxy:Proxy):Void

    Removes the proxy proxy from the collision space.

    inlinegetProxyPairList():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental():Bool

    Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

    inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    moveProxy (proxy:Proxy, aabb:Aabb, displacement:Vec3):Void

    Moves the proxy proxy to the axis-aligned bounding box aabb. displacement is the +pairs are guaranteed to be separated.

    inlineisOverlapping(proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    moveProxy(proxy:Proxy, aabb:Aabb, displacement:Vec3):Void

    Moves the proxy proxy to the axis-aligned bounding box aabb. displacement is the difference between current and previous center of the AABB. This is used for predicting -movement of the proxy.

    rayCast (begin:Vec3, end:Vec3, callback:BroadPhaseProxyCallback):Void

    Performs a ray casting. callback.process is called for all proxies the line segment -from begin to end intersects.

    \ No newline at end of file +movement of the proxy.

    rayCast(begin:Vec3, end:Vec3, callback:BroadPhaseProxyCallback):Void

    Performs a ray casting. callback.process is called for all proxies the line segment +from begin to end intersects.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html index c1ffe6b..51b5e27 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html +++ b/docs/oimo/collision/broadphase/BroadPhaseProxyCallback.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A callback class for queries in a broad phase.

    Constructor

    new ()

    Default constructor.

    Methods

    process (proxy:Proxy):Void

    This is called every time a broad phase algorithm reports a proxy proxy.

    \ No newline at end of file +

    A callback class for queries in a broad phase.

    Constructor

    new()

    Default constructor.

    Methods

    process(proxy:Proxy):Void

    This is called every time a broad phase algorithm reports a proxy proxy.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/BroadPhaseType.html b/docs/oimo/collision/broadphase/BroadPhaseType.html index 1fd9410..7130b27 100644 --- a/docs/oimo/collision/broadphase/BroadPhaseType.html +++ b/docs/oimo/collision/broadphase/BroadPhaseType.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Types of broad-phase algorithms.

    Static variables

    @:value(_BRUTE_FORCE)staticread onlyBRUTE_FORCE:Int = _BRUTE_FORCE

    The brute force algorithm searches all the possible pairs of the proxies every time. -This is very slow and so users should not choose this algorithm without exceptional reasons.

    @:value(_BVH)staticread onlyBVH:Int = _BVH

    The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

    \ No newline at end of file +

    Types of broad-phase algorithms.

    Static variables

    @:value(_BRUTE_FORCE)staticread onlyBRUTE_FORCE:Int = _BRUTE_FORCE

    The brute force algorithm searches all the possible pairs of the proxies every time. +This is very slow and so users should not choose this algorithm without exceptional reasons.

    @:value(_BVH)staticread onlyBVH:Int = _BVH

    The BVH algorithm uses bounding volume hierarchy for detecting overlapping pairs of proxies efficiently.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/Proxy.html b/docs/oimo/collision/broadphase/Proxy.html index 36b36d3..7980a4b 100644 --- a/docs/oimo/collision/broadphase/Proxy.html +++ b/docs/oimo/collision/broadphase/Proxy.html @@ -8,9 +8,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A proxy is an object that can be added to a broad-phase collision detection algorithm. +

    A proxy is an object that can be added to a broad-phase collision detection algorithm. Users of the collision part of the library can move an axis-aligned bounding box of -a proxy through BroadPhase class.

    Variables

    userData:Any

    Extra field that users can use for their own purposes. Do not modify this property if +a proxy through BroadPhase class.

    Variables

    userData:Any

    Extra field that users can use for their own purposes. Do not modify this property if you use the physics part of the library, as the physics part of the library uses this property -for connecting proxies and shapes of rigid bodies.

    Methods

    getFatAabb ():Aabb

    Returns the fat AABB of the proxy.

    getFatAabbTo (aabb:Aabb):Void

    Sets aabb to the fat AABB of the proxy.

    -

    This does not create a new instance of Aabb.

    getId ():Int

    Returns the unique id of the proxy.

    \ No newline at end of file +for connecting proxies and shapes of rigid bodies.

    Methods

    getFatAabb():Aabb

    Returns the fat AABB of the proxy.

    getFatAabbTo(aabb:Aabb):Void

    Sets aabb to the fat AABB of the proxy.

    +

    This does not create a new instance of Aabb.

    getId():Int

    Returns the unique id of the proxy.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/ProxyPair.html b/docs/oimo/collision/broadphase/ProxyPair.html index c8a36c3..b644355 100644 --- a/docs/oimo/collision/broadphase/ProxyPair.html +++ b/docs/oimo/collision/broadphase/ProxyPair.html @@ -7,5 +7,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

    Methods

    getNext ():ProxyPair

    Returns the next pair.

    getProxy1 ():Proxy

    Returns the first proxy of the pair.

    getProxy2 ():Proxy

    Returns the second proxy of the pair.

    \ No newline at end of file +

    A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies +as linked list of ProxyPair.

    Methods

    getNext():ProxyPair

    Returns the next pair.

    getProxy1():Proxy

    Returns the first proxy of the pair.

    getProxy2():Proxy

    Returns the second proxy of the pair.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html index ab21b7a..3732ea4 100644 --- a/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html +++ b/docs/oimo/collision/broadphase/bruteforce/BruteForceBroadPhase.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

    Methods

    Inherited Variables

    Inherited Methods

    Defined by BroadPhase

    inlinegetProxyPairList ():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount ():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental ():Bool

    Returns whether to collect only pairs created in the last step. If this returns +

    Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

    Methods

    Inherited Variables

    Inherited Methods

    Defined by BroadPhase

    inlinegetProxyPairList():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental():Bool

    Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

    inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    \ No newline at end of file +pairs are guaranteed to be separated.

    inlineisOverlapping(proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bruteforce/index.html b/docs/oimo/collision/broadphase/bruteforce/index.html index bd5489e..3750dc5 100644 --- a/docs/oimo/collision/broadphase/bruteforce/index.html +++ b/docs/oimo/collision/broadphase/bruteforce/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.broadphase.bruteforce

    OimoPhysics API Documentation

    ..
    BruteForceBroadPhase

    Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

    \ No newline at end of file +

    oimo.collision.broadphase.bruteforce

    OimoPhysics API Documentation

    ..
    BruteForceBroadPhase

    Brute force implementation of broad-phase collision detection. Time complexity is O(n^2).

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html index 7b37ccd..4353122 100644 --- a/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html +++ b/docs/oimo/collision/broadphase/bvh/BvhBroadPhase.html @@ -7,8 +7,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). -Average time complexity is O(NlogN) or lower.

    Methods

    inlinegetTreeBalance ():Int

    Returns the balance of the bounding volume tree.

    Inherited Variables

    Inherited Methods

    Defined by BroadPhase

    inlinegetProxyPairList ():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount ():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental ():Bool

    Returns whether to collect only pairs created in the last step. If this returns +

    The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). +Average time complexity is O(NlogN) or lower.

    Methods

    inlinegetTreeBalance():Int

    Returns the balance of the bounding volume tree.

    Inherited Variables

    Inherited Methods

    Defined by BroadPhase

    inlinegetProxyPairList():ProxyPair

    Returns the linked list of collected pairs of proxies.

    inlinegetTestCount():Int

    Returns the number of broad-phase AABB tests.

    inlineisIncremental():Bool

    Returns whether to collect only pairs created in the last step. If this returns true, the pairs that are not collected might still be overlapping. Otherwise, such -pairs are guaranteed to be separated.

    inlineisOverlapping (proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger -than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    \ No newline at end of file +pairs are guaranteed to be separated.

    inlineisOverlapping(proxy1:Proxy, proxy2:Proxy):Bool

    Returns whether the pair of proxy1 and proxy2 is overlapping. As proxies can be larger +than the containing AABBs, two proxies may overlap even though their inner AABBs are separate.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/bvh/index.html b/docs/oimo/collision/broadphase/bvh/index.html index 55b5810..b40c24b 100644 --- a/docs/oimo/collision/broadphase/bvh/index.html +++ b/docs/oimo/collision/broadphase/bvh/index.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.broadphase.bvh

    OimoPhysics API Documentation

    ..
    BvhBroadPhase

    The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). -Average time complexity is O(NlogN) or lower.

    \ No newline at end of file +

    oimo.collision.broadphase.bvh

    OimoPhysics API Documentation

    ..
    BvhBroadPhase

    The broad-phase collision detection algorithm based on bounding volume hierarchy (BVH). +Average time complexity is O(NlogN) or lower.

    \ No newline at end of file diff --git a/docs/oimo/collision/broadphase/index.html b/docs/oimo/collision/broadphase/index.html index 138f93d..0c7b55e 100644 --- a/docs/oimo/collision/broadphase/index.html +++ b/docs/oimo/collision/broadphase/index.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.broadphase

    OimoPhysics API Documentation

    ..
    bruteforce
    bvh
    BroadPhase

    The abstract class of a broad-phase collision detection algorithm.

    BroadPhaseProxyCallback

    A callback class for queries in a broad phase.

    BroadPhaseType

    Types of broad-phase algorithms.

    Proxy

    A proxy is an object that can be added to a broad-phase collision detection algorithm. +

    oimo.collision.broadphase

    OimoPhysics API Documentation

    ..
    bruteforce
    bvh
    BroadPhase

    The abstract class of a broad-phase collision detection algorithm.

    BroadPhaseProxyCallback

    A callback class for queries in a broad phase.

    BroadPhaseType

    Types of broad-phase algorithms.

    Proxy

    A proxy is an object that can be added to a broad-phase collision detection algorithm. Users of the collision part of the library can move an axis-aligned bounding box of a proxy through BroadPhase class.

    ProxyPair

    A pair between two proxies. Broad-phase collision algorithms collect pairs of proxies -as linked list of ProxyPair.

    \ No newline at end of file +as linked list of ProxyPair.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/Aabb.html b/docs/oimo/collision/geometry/Aabb.html index 4927c37..a43930f 100644 --- a/docs/oimo/collision/geometry/Aabb.html +++ b/docs/oimo/collision/geometry/Aabb.html @@ -6,10 +6,10 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The axis-aligned bounding box.

    Constructor

    new ()

    Creates an empty AABB. Minimum and maximum points are set to zero.

    Methods

    clone ():Aabb

    Returns a clone of the AABB.

    inlinecombine (other:Aabb):Aabb

    Combines other into this AABB and returns this.

    inlinecombined (other:Aabb):Aabb

    Returns the combined aabb of this and other.

    copyFrom (aabb:Aabb):Aabb

    Copies AABB from aabb to and returns this.

    inlinegetCenter ():Vec3

    Returns the center of the AABB.

    inlinegetCenterTo (center:Vec3):Void

    Sets center to the center of the AABB.

    -

    This does not create a new instance of Vec3.

    inlinegetExtents ():Vec3

    Returns the half extents of the AABB.

    inlinegetExtentsTo (halfExtents:Vec3):Void

    Sets halfExtents to the half extents of the AABB.

    -

    This does not create a new instance of Vec3.

    inlinegetIntersection (other:Aabb):Aabb

    Returns the intersection of this and other.

    inlinegetIntersectionTo (other:Aabb, intersection:Aabb):Void

    Sets intersection to the intersection of this and other.

    -

    This does not create a new instance of Aabb.

    inlinegetMax ():Vec3

    Returns the maximum point of the axis-aligned bounding box.

    inlinegetMaxTo (max:Vec3):Void

    Sets the maximum point of the axis-aligned bounding box to max.

    -

    This does not create a new instance of Vec3.

    inlinegetMin ():Vec3

    Returns the minimum point of the axis-aligned bounding box.

    inlinegetMinTo (min:Vec3):Void

    Sets the minimum point of the axis-aligned bounding box to min.

    -

    This does not create a new instance of Vec3.

    inlineinit (min:Vec3, max:Vec3):Aabb

    Sets the minimum and maximum point and returns this.

    -

    Equivallent to setMin(min).setMax(max).

    inlineoverlap (other:Aabb):Bool

    Returns whether this and other intersect.

    inlinesetMax (max:Vec3):Aabb

    Sets the maximum point of the axis-aligned bounding box to max and returns this.

    inlinesetMin (min:Vec3):Aabb

    Sets the minimum point of the axis-aligned bounding box to min and returns this.

    \ No newline at end of file +

    The axis-aligned bounding box.

    Constructor

    new()

    Creates an empty AABB. Minimum and maximum points are set to zero.

    Methods

    clone():Aabb

    Returns a clone of the AABB.

    inlinecombine(other:Aabb):Aabb

    Combines other into this AABB and returns this.

    inlinecombined(other:Aabb):Aabb

    Returns the combined aabb of this and other.

    copyFrom(aabb:Aabb):Aabb

    Copies AABB from aabb to and returns this.

    inlinegetCenter():Vec3

    Returns the center of the AABB.

    inlinegetCenterTo(center:Vec3):Void

    Sets center to the center of the AABB.

    +

    This does not create a new instance of Vec3.

    inlinegetExtents():Vec3

    Returns the half extents of the AABB.

    inlinegetExtentsTo(halfExtents:Vec3):Void

    Sets halfExtents to the half extents of the AABB.

    +

    This does not create a new instance of Vec3.

    inlinegetIntersection(other:Aabb):Aabb

    Returns the intersection of this and other.

    inlinegetIntersectionTo(other:Aabb, intersection:Aabb):Void

    Sets intersection to the intersection of this and other.

    +

    This does not create a new instance of Aabb.

    inlinegetMax():Vec3

    Returns the maximum point of the axis-aligned bounding box.

    inlinegetMaxTo(max:Vec3):Void

    Sets the maximum point of the axis-aligned bounding box to max.

    +

    This does not create a new instance of Vec3.

    inlinegetMin():Vec3

    Returns the minimum point of the axis-aligned bounding box.

    inlinegetMinTo(min:Vec3):Void

    Sets the minimum point of the axis-aligned bounding box to min.

    +

    This does not create a new instance of Vec3.

    inlineinit(min:Vec3, max:Vec3):Aabb

    Sets the minimum and maximum point and returns this.

    +

    Equivallent to setMin(min).setMax(max).

    inlineoverlap(other:Aabb):Bool

    Returns whether this and other intersect.

    inlinesetMax(max:Vec3):Aabb

    Sets the maximum point of the axis-aligned bounding box to max and returns this.

    inlinesetMin(min:Vec3):Aabb

    Sets the minimum point of the axis-aligned bounding box to min and returns this.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/BoxGeometry.html b/docs/oimo/collision/geometry/BoxGeometry.html index 98f3670..1bbd888 100644 --- a/docs/oimo/collision/geometry/BoxGeometry.html +++ b/docs/oimo/collision/geometry/BoxGeometry.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A box collision geometry.

    Constructor

    new (halfExtents:Vec3)

    Creates a box collision geometry of half-extents halfExtents.

    Methods

    inlinegetHalfExtents ():Vec3

    Returns the half-extents of the box.

    inlinegetHalfExtentsTo (halfExtents:Vec3):Void

    Sets halfExtents to the half-extents of the box.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A box collision geometry.

    Constructor

    new(halfExtents:Vec3)

    Creates a box collision geometry of half-extents halfExtents.

    Methods

    inlinegetHalfExtents():Vec3

    Returns the half-extents of the box.

    inlinegetHalfExtentsTo(halfExtents:Vec3):Void

    Sets halfExtents to the half-extents of the box.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/CapsuleGeometry.html b/docs/oimo/collision/geometry/CapsuleGeometry.html index 7ac4cee..f9adc4e 100644 --- a/docs/oimo/collision/geometry/CapsuleGeometry.html +++ b/docs/oimo/collision/geometry/CapsuleGeometry.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A capsule collision geometry aligned with the y-axis.

    Constructor

    new (radius:Float, halfHeight:Float)

    Creates a capsule collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight ():Float

    Returns the half-height of the capsule.

    inlinegetRadius ():Float

    Returns the radius of the capsule.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A capsule collision geometry aligned with the y-axis.

    Constructor

    new(radius:Float, halfHeight:Float)

    Creates a capsule collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight():Float

    Returns the half-height of the capsule.

    inlinegetRadius():Float

    Returns the radius of the capsule.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConeGeometry.html b/docs/oimo/collision/geometry/ConeGeometry.html index 6e382d8..b5190b6 100644 --- a/docs/oimo/collision/geometry/ConeGeometry.html +++ b/docs/oimo/collision/geometry/ConeGeometry.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A cone collision geometry aligned with the y-axis.

    Constructor

    new (radius:Float, halfHeight:Float)

    Creates a cone collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight ():Float

    Returns the half-height of the cone.

    inlinegetRadius ():Float

    Returns the radius of the cone.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A cone collision geometry aligned with the y-axis.

    Constructor

    new(radius:Float, halfHeight:Float)

    Creates a cone collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight():Float

    Returns the half-height of the cone.

    inlinegetRadius():Float

    Returns the radius of the cone.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexGeometry.html b/docs/oimo/collision/geometry/ConvexGeometry.html index 162e12e..07d3cfe 100644 --- a/docs/oimo/collision/geometry/ConvexGeometry.html +++ b/docs/oimo/collision/geometry/ConvexGeometry.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

    Methods

    computeLocalSupportingVertex (dir:Vec3, out:Vec3):Void

    Computes supporting vertex of the "core" of the geometry in local coordinates. +

    Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

    Methods

    computeLocalSupportingVertex(dir:Vec3, out:Vec3):Void

    Computes supporting vertex of the "core" of the geometry in local coordinates. Note that the direction vector dir might not be normalized. out is set to -the computed supporting vertex.

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Inherited Variables

    Inherited Methods

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +the computed supporting vertex.

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Inherited Variables

    Inherited Methods

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/ConvexHullGeometry.html b/docs/oimo/collision/geometry/ConvexHullGeometry.html index 5dd69a9..e25cf0c 100644 --- a/docs/oimo/collision/geometry/ConvexHullGeometry.html +++ b/docs/oimo/collision/geometry/ConvexHullGeometry.html @@ -7,6 +7,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A convex hull collision geometry. A convex hull of the vertices is the smallest convex -polyhedron which contains all vertices.

    Constructor

    new (vertices:Array<Vec3>)

    Creates a convex hull collision geometry of the vertices vertices.

    Methods

    inlinegetVertices ():Vector<Vec3>

    Returns the vertices of the convex hull.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A convex hull collision geometry. A convex hull of the vertices is the smallest convex +polyhedron which contains all vertices.

    Constructor

    new(vertices:Array<Vec3>)

    Creates a convex hull collision geometry of the vertices vertices.

    Methods

    inlinegetVertices():Vector<Vec3>

    Returns the vertices of the convex hull.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/CylinderGeometry.html b/docs/oimo/collision/geometry/CylinderGeometry.html index 70e8c87..71d7ace 100644 --- a/docs/oimo/collision/geometry/CylinderGeometry.html +++ b/docs/oimo/collision/geometry/CylinderGeometry.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A cylinder collision geometry aligned with the y-axis.

    Constructor

    new (radius:Float, halfHeight:Float)

    Creates a cylinder collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight ():Float

    Returns the half-height of the cylinder.

    inlinegetRadius ():Float

    Returns the radius of the cylinder.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A cylinder collision geometry aligned with the y-axis.

    Constructor

    new(radius:Float, halfHeight:Float)

    Creates a cylinder collision geometry of radius radius and half-height halfHeight.

    Methods

    inlinegetHalfHeight():Float

    Returns the half-height of the cylinder.

    inlinegetRadius():Float

    Returns the radius of the cylinder.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/Geometry.html b/docs/oimo/collision/geometry/Geometry.html index 204ee66..bcc4d14 100644 --- a/docs/oimo/collision/geometry/Geometry.html +++ b/docs/oimo/collision/geometry/Geometry.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Abstract collision geometry.

    Methods

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    rayCast (begin:Vec3, end:Vec3, transform:Transform, hit:RayCastHit):Bool

    Performs ray casting. Returns true and sets the result information to hit if +

    Abstract collision geometry.

    Methods

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    rayCast(begin:Vec3, end:Vec3, transform:Transform, hit:RayCastHit):Bool

    Performs ray casting. Returns true and sets the result information to hit if the line segment from begin to end and the geometry transformed by transform -intersect. Returns false if the line segment and the geometry do not intersect.

    \ No newline at end of file +intersect. Returns false if the line segment and the geometry do not intersect.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/GeometryType.html b/docs/oimo/collision/geometry/GeometryType.html index c778ccb..9721b08 100644 --- a/docs/oimo/collision/geometry/GeometryType.html +++ b/docs/oimo/collision/geometry/GeometryType.html @@ -6,10 +6,10 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of collision geometry types.

    Static variables

    @:value(_BOX)staticread onlyBOX:Int = _BOX

    Represents a box collision geometry.

    -

    See BoxGeometry.

    @:value(_CAPSULE)staticread onlyCAPSULE:Int = _CAPSULE

    Represents a capsule collision geometry.

    -

    See CapsuleGeometry.

    @:value(_CONE)staticread onlyCONE:Int = _CONE

    Represents a cone collision geometry.

    -

    See ConeGeometry.

    @:value(_CONVEX_HULL)staticread onlyCONVEX_HULL:Int = _CONVEX_HULL

    Represents a convex hull collision geometry.

    -

    See ConvexHullGeometry.

    @:value(_CYLINDER)staticread onlyCYLINDER:Int = _CYLINDER

    Represents a cylinder collision geometry.

    -

    See CylinderGeometry.

    @:value(_SPHERE)staticread onlySPHERE:Int = _SPHERE

    Represents a sphere collision geometry.

    -

    See SphereGeometry.

    \ No newline at end of file +

    The list of collision geometry types.

    Static variables

    @:value(_BOX)staticread onlyBOX:Int = _BOX

    Represents a box collision geometry.

    +

    See BoxGeometry.

    @:value(_CAPSULE)staticread onlyCAPSULE:Int = _CAPSULE

    Represents a capsule collision geometry.

    +

    See CapsuleGeometry.

    @:value(_CONE)staticread onlyCONE:Int = _CONE

    Represents a cone collision geometry.

    +

    See ConeGeometry.

    @:value(_CONVEX_HULL)staticread onlyCONVEX_HULL:Int = _CONVEX_HULL

    Represents a convex hull collision geometry.

    +

    See ConvexHullGeometry.

    @:value(_CYLINDER)staticread onlyCYLINDER:Int = _CYLINDER

    Represents a cylinder collision geometry.

    +

    See CylinderGeometry.

    @:value(_SPHERE)staticread onlySPHERE:Int = _SPHERE

    Represents a sphere collision geometry.

    +

    See SphereGeometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/RayCastHit.html b/docs/oimo/collision/geometry/RayCastHit.html index a8e125d..cba2837 100644 --- a/docs/oimo/collision/geometry/RayCastHit.html +++ b/docs/oimo/collision/geometry/RayCastHit.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A single ray cast hit data.

    Constructor

    new ()

    Default constructor.

    Variables

    fraction:Float

    The ratio of the position the ray hit from the start point to the end point.

    normal:Vec3

    The normal vector of the surface the ray hit.

    position:Vec3

    The position the ray hit at.

    \ No newline at end of file +

    A single ray cast hit data.

    Constructor

    new()

    Default constructor.

    Variables

    fraction:Float

    The ratio of the position the ray hit from the start point to the end point.

    normal:Vec3

    The normal vector of the surface the ray hit.

    position:Vec3

    The position the ray hit at.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/SphereGeometry.html b/docs/oimo/collision/geometry/SphereGeometry.html index 8adc179..2a133ea 100644 --- a/docs/oimo/collision/geometry/SphereGeometry.html +++ b/docs/oimo/collision/geometry/SphereGeometry.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A sphere collision geometry.

    Constructor

    new (radius:Float)

    Creates a sphere collision geometry of radius radius.

    Methods

    inlinegetRadius ():Float

    Returns the radius of the sphere.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin ():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin (gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType ():Int

    Returns the type of the collision geometry.

    -

    See GeometryType for details.

    inlinegetVolume ():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file +

    A sphere collision geometry.

    Constructor

    new(radius:Float)

    Creates a sphere collision geometry of radius radius.

    Methods

    inlinegetRadius():Float

    Returns the radius of the sphere.

    Inherited Variables

    Inherited Methods

    Defined by ConvexGeometry

    inlinegetGjkMergin():Float

    Returns the GJK mergin around the "core" of the convex geometry.

    inlinesetGjkMergin(gjkMergin:Float):Void

    Sets the GJK mergin around the "core" to gjkMergin.

    Defined by Geometry

    inlinegetType():Int

    Returns the type of the collision geometry.

    +

    See GeometryType for details.

    inlinegetVolume():Float

    Returns the volume of the collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/geometry/index.html b/docs/oimo/collision/geometry/index.html index 77fabad..02ce60c 100644 --- a/docs/oimo/collision/geometry/index.html +++ b/docs/oimo/collision/geometry/index.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.geometry

    OimoPhysics API Documentation

    ..
    Aabb

    The axis-aligned bounding box.

    BoxGeometry

    A box collision geometry.

    CapsuleGeometry

    A capsule collision geometry aligned with the y-axis.

    ConeGeometry

    A cone collision geometry aligned with the y-axis.

    ConvexGeometry

    Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

    ConvexHullGeometry

    A convex hull collision geometry. A convex hull of the vertices is the smallest convex -polyhedron which contains all vertices.

    CylinderGeometry

    A cylinder collision geometry aligned with the y-axis.

    Geometry

    Abstract collision geometry.

    GeometryType

    The list of collision geometry types.

    RayCastHit

    A single ray cast hit data.

    SphereGeometry

    A sphere collision geometry.

    \ No newline at end of file +

    oimo.collision.geometry

    OimoPhysics API Documentation

    ..
    Aabb

    The axis-aligned bounding box.

    BoxGeometry

    A box collision geometry.

    CapsuleGeometry

    A capsule collision geometry aligned with the y-axis.

    ConeGeometry

    A cone collision geometry aligned with the y-axis.

    ConvexGeometry

    Abstract class of the convex collision geometries supported by GJK/EPA collision detection.

    ConvexHullGeometry

    A convex hull collision geometry. A convex hull of the vertices is the smallest convex +polyhedron which contains all vertices.

    CylinderGeometry

    A cylinder collision geometry aligned with the y-axis.

    Geometry

    Abstract collision geometry.

    GeometryType

    The list of collision geometry types.

    RayCastHit

    A single ray cast hit data.

    SphereGeometry

    A sphere collision geometry.

    \ No newline at end of file diff --git a/docs/oimo/collision/index.html b/docs/oimo/collision/index.html index abbc710..0959a94 100644 --- a/docs/oimo/collision/index.html +++ b/docs/oimo/collision/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision

    OimoPhysics API Documentation

    ..
    broadphase
    geometry
    narrowphase
    \ No newline at end of file +

    oimo.collision

    OimoPhysics API Documentation

    ..
    broadphase
    geometry
    narrowphase
    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/CollisionMatrix.html b/docs/oimo/collision/narrowphase/CollisionMatrix.html index 5f9b91b..95705a0 100644 --- a/docs/oimo/collision/narrowphase/CollisionMatrix.html +++ b/docs/oimo/collision/narrowphase/CollisionMatrix.html @@ -7,6 +7,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    CollisionMatrix provides corresponding collision detector for a pair of -two geometries of given types.

    Methods

    inlinegetDetector (geomType1:Int, geomType2:Int):Detector

    Returns an appropriate collision detector of two geometries of types geomType1 and geomType2.

    -

    This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

    \ No newline at end of file +

    CollisionMatrix provides corresponding collision detector for a pair of +two geometries of given types.

    Methods

    inlinegetDetector(geomType1:Int, geomType2:Int):Detector

    Returns an appropriate collision detector of two geometries of types geomType1 and geomType2.

    +

    This method is not symmetric, so getDetector(a, b) may not be equal to getDetector(b, a).

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResult.html b/docs/oimo/collision/narrowphase/DetectorResult.html index d26b39f..fcb5b43 100644 --- a/docs/oimo/collision/narrowphase/DetectorResult.html +++ b/docs/oimo/collision/narrowphase/DetectorResult.html @@ -7,7 +7,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The result of narrow-phase collision detection. This is used for generating contact -points of a contact constraint at once or incrementally.

    Constructor

    new ()

    Default constructor.

    Variables

    incremental:Bool

    Whether the result points are to be used for incremental menifold update.

    normal:Vec3

    The normal vector of the contact plane.

    numPoints:Int

    The number of the result points.

    points:Vector<DetectorResultPoint>

    The result points. Note that only the first DetectorResult.numPoints points are -computed by the collision detector.

    Methods

    inlineclear ():Void

    Cleans up the result data.

    getMaxDepth ():Float

    Returns the maximum depth of the result points. Returns 0.0 if no result -points are available.

    \ No newline at end of file +

    The result of narrow-phase collision detection. This is used for generating contact +points of a contact constraint at once or incrementally.

    Constructor

    new()

    Default constructor.

    Variables

    incremental:Bool

    Whether the result points are to be used for incremental menifold update.

    normal:Vec3

    The normal vector of the contact plane.

    numPoints:Int

    The number of the result points.

    points:Vector<DetectorResultPoint>

    The result points. Note that only the first DetectorResult.numPoints points are +computed by the collision detector.

    Methods

    inlineclear():Void

    Cleans up the result data.

    getMaxDepth():Float

    Returns the maximum depth of the result points. Returns 0.0 if no result +points are available.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/DetectorResultPoint.html b/docs/oimo/collision/narrowphase/DetectorResultPoint.html index 1eff868..04b0af9 100644 --- a/docs/oimo/collision/narrowphase/DetectorResultPoint.html +++ b/docs/oimo/collision/narrowphase/DetectorResultPoint.html @@ -8,7 +8,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The result point is a pair of the closest points of collision geometries +

    The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for -each collision geometry and the amount of the overlap.

    Variables

    depth:Float

    The amount of the overlap. This becomes negative if two geometries are -separate.

    id:Int

    The identification of the result point.

    position1:Vec3

    The first collision geometry's closest point.

    position2:Vec3

    The second collision geometry's closest point.

    \ No newline at end of file +each collision geometry and the amount of the overlap.

    Variables

    depth:Float

    The amount of the overlap. This becomes negative if two geometries are +separate.

    id:Int

    The identification of the result point.

    position1:Vec3

    The first collision geometry's closest point.

    position2:Vec3

    The second collision geometry's closest point.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html index 728e69a..a016d58 100644 --- a/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/BoxBoxDetector.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Box vs Box detector.

    Constructor

    new ()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

    Box vs Box detector.

    Constructor

    new()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html index eb75968..d054e14 100644 --- a/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/CapsuleCapsuleDetector.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Capsule vs Capsule detector.

    Constructor

    new ()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

    Capsule vs Capsule detector.

    Constructor

    new()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/Detector.html b/docs/oimo/collision/narrowphase/detector/Detector.html index 2f0851e..c3df87a 100644 --- a/docs/oimo/collision/narrowphase/detector/Detector.html +++ b/docs/oimo/collision/narrowphase/detector/Detector.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Interface of a collision detector for narrow-phase collision detection.

    Methods

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

    Interface of a collision detector for narrow-phase collision detection.

    Methods

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html index 4b37c2f..14996b3 100644 --- a/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html +++ b/docs/oimo/collision/narrowphase/detector/GjkEpaDetector.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    General convex collision detector using GJK/EPA

    Constructor

    new ()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

    General convex collision detector using GJK/EPA

    Constructor

    new()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html index 3ac08cc..d4bda12 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereBoxDetector.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Sphere vs Box collision detector.

    Constructor

    new (swapped:Bool)

    If swapped is true, the collision detector expects BoxGeometry and SphereGeometry for the +

    Sphere vs Box collision detector.

    Constructor

    new(swapped:Bool)

    If swapped is true, the collision detector expects BoxGeometry and SphereGeometry for the first and second argument of SphereBoxDetector.detect. If swapped is false, the collision detector expects -SphereGeometry and BoxGeometry instead.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +SphereGeometry and BoxGeometry instead.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html index acd351d..d25b208 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereCapsuleDetector.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Sphere vs Capsule detector.

    Constructor

    new (swapped:Bool)

    If swapped is true, the collision detector expects CapsuleGeometry and SphereGeometry for the +

    Sphere vs Capsule detector.

    Constructor

    new(swapped:Bool)

    If swapped is true, the collision detector expects CapsuleGeometry and SphereGeometry for the first and second argument of SphereCapsuleDetector.detect. If swapped is false, the collision detector expects -SphereGeometry and CapsuleGeometry instead.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +SphereGeometry and CapsuleGeometry instead.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html index a6c223c..9e61a55 100644 --- a/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html +++ b/docs/oimo/collision/narrowphase/detector/SphereSphereDetector.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Sphere vs Sphere detector.

    Constructor

    new ()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect (result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms +

    Sphere vs Sphere detector.

    Constructor

    new()

    Default constructor.

    Inherited Variables

    Inherited Methods

    Defined by Detector

    detect(result:DetectorResult, geom1:Geometry, geom2:Geometry, transform1:Transform, transform2:Transform, cachedData:CachedDetectorData):Void

    Computes the contact manifold of two collision geometries geom1 and geom2 with the transforms transform1 and transform2, and stores it to result. cachedData is used to improve performance -of collision detection in some detectors.

    \ No newline at end of file +of collision detection in some detectors.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html index f2d7ec6..b4ae871 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpa.html @@ -6,21 +6,21 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    GJK algorithm and EPA for narrow-phase collision detection.

    Constructor

    new ()

    Default constructor. Consider using GjkEpa.getInstance instead of creating a new -instance.

    Variables

    closestPoint1:Vec3

    Computed closest point of the first geometry in world coordinate system.

    closestPoint2:Vec3

    Computed closest point of the second geometry in world coordinate system.

    distance:Float

    Computed distance between two geometries. This value may be negative if two -geometries are overlapping.

    Methods

    inlinecomputeClosestPoints (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

    Computes the closest points of two convex geometries c1 and c2 with transforms tf1 and tf2 +

    GJK algorithm and EPA for narrow-phase collision detection.

    Static methods

    staticinlinegetInstance():GjkEpa

    Returns an instance of GjkEpa.

    Constructor

    new()

    Default constructor. Consider using GjkEpa.getInstance instead of creating a new +instance.

    Variables

    closestPoint1:Vec3

    Computed closest point of the first geometry in world coordinate system.

    closestPoint2:Vec3

    Computed closest point of the second geometry in world coordinate system.

    distance:Float

    Computed distance between two geometries. This value may be negative if two +geometries are overlapping.

    Methods

    inlinecomputeClosestPoints(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

    Computes the closest points of two convex geometries c1 and c2 with transforms tf1 and tf2 respectively, and returns the status of the result (see GjkEpaResultState for details). If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

    -

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    inlinecomputeDistance (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

    Computes the distance between two convex geometries c1 and c2 with transforms tf1 and tf2 +

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    inlinecomputeDistance(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, cache:CachedDetectorData):Int

    Computes the distance between two convex geometries c1 and c2 with transforms tf1 and tf2 respectively, and returns the status of the result (see GjkEpaResultState for details). Different from GjkEpa.computeClosestPoints, this does not compute negative distances and closest points if two geometries are overlapping. If cached data cache is not null, this tries to exploit the previous result in cache to improve performance, and stores the new result to cache.

    -

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    convexCast (c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, tl1:Vec3, tl2:Vec3, hit:RayCastHit):Bool

    Performs a convex casting between c1 and c2. Returns true and sets the result information +

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    convexCast(c1:ConvexGeometry, c2:ConvexGeometry, tf1:Transform, tf2:Transform, tl1:Vec3, tl2:Vec3, hit:RayCastHit):Bool

    Performs a convex casting between c1 and c2. Returns true and sets the result information to hit if the convex geometries intersect. Each convex geometries translates by tl1 and tl2, starting from the beginning transforms tf1 and tf2 respectively.

    -

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    rayCast (c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

    Performs ray cansting against the convex geometry c with transform tf. Returns true and sets +

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    rayCast(c:ConvexGeometry, tf:Transform, begin:Vec3, end:Vec3, hit:RayCastHit):Bool

    Performs ray cansting against the convex geometry c with transform tf. Returns true and sets the result information to hit if the line segment from begin to end intersects the convex geometry. Otherwise returns false.

    -

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    Static methods

    staticinlinegetInstance ():GjkEpa

    Returns an instance of GjkEpa.

    \ No newline at end of file +

    Set the compiler option OIMO_GJK_EPA_DEBUG for debugging (warning: massive logging).

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html index 23f4a33..4d1607a 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/GjkEpaResultState.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of the state of a result of GjkEpa.computeClosestPoints.

    Static variables

    @:value(_EPA_DID_NOT_CONVERGE)staticread onlyEPA_DID_NOT_CONVERGE:Int = _EPA_DID_NOT_CONVERGE

    EPA iterations did not converge in time.

    @:value(_EPA_FAILED_TO_ADD_VERTEX)staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int = _EPA_FAILED_TO_ADD_VERTEX

    Failed to add a new vertex to the polyhedron in EPA computation.

    @:value(_EPA_FAILED_TO_INIT)staticread onlyEPA_FAILED_TO_INIT:Int = _EPA_FAILED_TO_INIT

    Failed to construct initial polyhedron in EPA construction.

    @:value(_GJK_DID_NOT_CONVERGE)staticread onlyGJK_DID_NOT_CONVERGE:Int = _GJK_DID_NOT_CONVERGE

    GJK iterations did not converge in time.

    @:value(_GJK_FAILED_TO_MAKE_TETRAHEDRON)staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int = _GJK_FAILED_TO_MAKE_TETRAHEDRON

    Failed to construct a tetrahedron enclosing the origin in GJK computation.

    @:value(_SUCCEEDED)staticread onlySUCCEEDED:Int = _SUCCEEDED

    GJK/EPA computation is successfully finished.

    \ No newline at end of file +

    The list of the state of a result of GjkEpa.computeClosestPoints.

    Static variables

    @:value(_EPA_DID_NOT_CONVERGE)staticread onlyEPA_DID_NOT_CONVERGE:Int = _EPA_DID_NOT_CONVERGE

    EPA iterations did not converge in time.

    @:value(_EPA_FAILED_TO_ADD_VERTEX)staticread onlyEPA_FAILED_TO_ADD_VERTEX:Int = _EPA_FAILED_TO_ADD_VERTEX

    Failed to add a new vertex to the polyhedron in EPA computation.

    @:value(_EPA_FAILED_TO_INIT)staticread onlyEPA_FAILED_TO_INIT:Int = _EPA_FAILED_TO_INIT

    Failed to construct initial polyhedron in EPA construction.

    @:value(_GJK_DID_NOT_CONVERGE)staticread onlyGJK_DID_NOT_CONVERGE:Int = _GJK_DID_NOT_CONVERGE

    GJK iterations did not converge in time.

    @:value(_GJK_FAILED_TO_MAKE_TETRAHEDRON)staticread onlyGJK_FAILED_TO_MAKE_TETRAHEDRON:Int = _GJK_FAILED_TO_MAKE_TETRAHEDRON

    Failed to construct a tetrahedron enclosing the origin in GJK computation.

    @:value(_SUCCEEDED)staticread onlySUCCEEDED:Int = _SUCCEEDED

    GJK/EPA computation is successfully finished.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html index 1f2b5f5..08c77c3 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/SimplexUtil.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Simplex utilities for GJK/EPA computations.

    Static methods

    staticinlineprojectOrigin2 (vec1:Vec3, vec2:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the line (vec1, vec2) -and returns the index of the voronoi region.

    staticinlineprojectOrigin3 (vec1:Vec3, vec2:Vec3, vec3:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the triangle (vec1, vec2, vec3) -and returns the index of the voronoi region.

    staticinlineprojectOrigin4 (vec1:Vec3, vec2:Vec3, vec3:Vec3, vec4:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the tetrahedron (vec1, vec2, vec3, vec4) -and returns the index of the voronoi region.

    \ No newline at end of file +

    Simplex utilities for GJK/EPA computations.

    Static methods

    staticinlineprojectOrigin2(vec1:Vec3, vec2:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the line (vec1, vec2) +and returns the index of the voronoi region.

    staticinlineprojectOrigin3(vec1:Vec3, vec2:Vec3, vec3:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the triangle (vec1, vec2, vec3) +and returns the index of the voronoi region.

    staticinlineprojectOrigin4(vec1:Vec3, vec2:Vec3, vec3:Vec3, vec4:Vec3, out:Vec3):Int

    Sets out to the minimum length point on the tetrahedron (vec1, vec2, vec3, vec4) +and returns the index of the voronoi region.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html index 6135500..243b62e 100644 --- a/docs/oimo/collision/narrowphase/detector/gjkepa/index.html +++ b/docs/oimo/collision/narrowphase/detector/gjkepa/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.narrowphase.detector.gjkepa

    OimoPhysics API Documentation

    ..
    GjkEpa

    GJK algorithm and EPA for narrow-phase collision detection.

    GjkEpaResultState

    The list of the state of a result of GjkEpa.computeClosestPoints.

    SimplexUtil

    Simplex utilities for GJK/EPA computations.

    \ No newline at end of file +

    oimo.collision.narrowphase.detector.gjkepa

    OimoPhysics API Documentation

    ..
    GjkEpa

    GJK algorithm and EPA for narrow-phase collision detection.

    GjkEpaResultState

    The list of the state of a result of GjkEpa.computeClosestPoints.

    SimplexUtil

    Simplex utilities for GJK/EPA computations.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/detector/index.html b/docs/oimo/collision/narrowphase/detector/index.html index e43c549..39d1c2e 100644 --- a/docs/oimo/collision/narrowphase/detector/index.html +++ b/docs/oimo/collision/narrowphase/detector/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.narrowphase.detector

    OimoPhysics API Documentation

    ..
    gjkepa
    BoxBoxDetector

    Box vs Box detector.

    CapsuleCapsuleDetector

    Capsule vs Capsule detector.

    Detector

    Interface of a collision detector for narrow-phase collision detection.

    GjkEpaDetector

    General convex collision detector using GJK/EPA

    SphereBoxDetector

    Sphere vs Box collision detector.

    SphereCapsuleDetector

    Sphere vs Capsule detector.

    SphereSphereDetector

    Sphere vs Sphere detector.

    \ No newline at end of file +

    oimo.collision.narrowphase.detector

    OimoPhysics API Documentation

    ..
    gjkepa
    BoxBoxDetector

    Box vs Box detector.

    CapsuleCapsuleDetector

    Capsule vs Capsule detector.

    Detector

    Interface of a collision detector for narrow-phase collision detection.

    GjkEpaDetector

    General convex collision detector using GJK/EPA

    SphereBoxDetector

    Sphere vs Box collision detector.

    SphereCapsuleDetector

    Sphere vs Capsule detector.

    SphereSphereDetector

    Sphere vs Sphere detector.

    \ No newline at end of file diff --git a/docs/oimo/collision/narrowphase/index.html b/docs/oimo/collision/narrowphase/index.html index 6c95a0e..8ca679b 100644 --- a/docs/oimo/collision/narrowphase/index.html +++ b/docs/oimo/collision/narrowphase/index.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.collision.narrowphase

    OimoPhysics API Documentation

    ..
    detector
    CollisionMatrix

    CollisionMatrix provides corresponding collision detector for a pair of +

    oimo.collision.narrowphase

    OimoPhysics API Documentation

    ..
    detector
    CollisionMatrix

    CollisionMatrix provides corresponding collision detector for a pair of two geometries of given types.

    DetectorResult

    The result of narrow-phase collision detection. This is used for generating contact points of a contact constraint at once or incrementally.

    DetectorResultPoint

    The result point is a pair of the closest points of collision geometries detected by a collision detector. This holds relative closest points for -each collision geometry and the amount of the overlap.

    \ No newline at end of file +each collision geometry and the amount of the overlap.

    \ No newline at end of file diff --git a/docs/oimo/common/Mat3.html b/docs/oimo/common/Mat3.html index 86152cb..d5545d4 100644 --- a/docs/oimo/common/Mat3.html +++ b/docs/oimo/common/Mat3.html @@ -6,33 +6,33 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    3x3 Matrix class.

    -

    Note that columns and rows are 0-indexed.

    Constructor

    @:value({ e22 : 1, e21 : 0, e20 : 0, e12 : 0, e11 : 1, e10 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew (e00:Float = 1, e01:Float = 0, e02:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1)

    Creates a new matrix. The matrix is identity by default.

    Variables

    e00:Float

    The element at row 0 column 0.

    e01:Float

    The element at row 0 column 1.

    e02:Float

    The element at row 0 column 2.

    e10:Float

    The element at row 1 column 0.

    e11:Float

    The element at row 1 column 1.

    e12:Float

    The element at row 1 column 2.

    e20:Float

    The element at row 2 column 0.

    e21:Float

    The element at row 2 column 1.

    e22:Float

    The element at row 2 column 2.

    Methods

    inlineadd (m:Mat3):Mat3

    Returns this + m

    inlineaddEq (m:Mat3):Mat3

    Sets this matrix to this + m and returns this.

    inlineappendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Returns this * rotation matrix.

    +

    3x3 Matrix class.

    +

    Note that columns and rows are 0-indexed.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    Constructor

    @:value({ e22 : 1, e21 : 0, e20 : 0, e12 : 0, e11 : 1, e10 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew(e00:Float = 1, e01:Float = 0, e02:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1)

    Creates a new matrix. The matrix is identity by default.

    Variables

    e00:Float

    The element at row 0 column 0.

    e01:Float

    The element at row 0 column 1.

    e02:Float

    The element at row 0 column 2.

    e10:Float

    The element at row 1 column 0.

    e11:Float

    The element at row 1 column 1.

    e12:Float

    The element at row 1 column 2.

    e20:Float

    The element at row 2 column 0.

    e21:Float

    The element at row 2 column 1.

    e22:Float

    The element at row 2 column 2.

    Methods

    inlineadd(m:Mat3):Mat3

    Returns this + m

    inlineaddEq(m:Mat3):Mat3

    Sets this matrix to this + m and returns this.

    inlineappendRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Returns this * rotation matrix.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineappendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Sets this matrix to this * rotation matrix, and returns this.

    +vector (axisX, axisY, axisZ).

    inlineappendRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Sets this matrix to this * rotation matrix, and returns this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineappendScale (sx:Float, sy:Float, sz:Float):Mat3

    Returns this * scaling matrix.

    +vector (axisX, axisY, axisZ).

    inlineappendScale(sx:Float, sy:Float, sz:Float):Mat3

    Returns this * scaling matrix.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendScaleEq (sx:Float, sy:Float, sz:Float):Mat3

    Sets this matrix to this * scaling matrix, and returns this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendScaleEq(sx:Float, sy:Float, sz:Float):Mat3

    Sets this matrix to this * scaling matrix, and returns this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineclone ():Mat3

    Returns a clone of the matrix.

    inlinecopyFrom (m:Mat3):Mat3

    Copies values from m and returns this.

    inlinedeterminant ():Float

    Returns the determinant.

    inlinefromCols (col0:Vec3, col1:Vec3, col2:Vec3):Mat3

    Sets this matrix by column vectors and returns this.

    inlinefromEulerXyz (eulerAngles:Vec3):Mat3

    Sets this matrix to the rotation matrix represented by Euler angles eulerAngles, and returns this. -Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.

    inlinefromQuat (q:Quat):Mat3

    Sets this matrix to the representation of the quaternion q, and returns this.

    inlinefromRows (row0:Vec3, row1:Vec3, row2:Vec3):Mat3

    Sets this matrix by row vectors and returns this.

    inlinegetCol (index:Int):Vec3

    Returns the indexth column vector of the matrix.

    -

    If index is less than 0 or greater than 2, null will be returned.

    inlinegetColTo (index:Int, dst:Vec3):Void

    Sets dst to the indexth column vector of the matrix.

    -

    If index is less than 0 or greater than 2, dst will be set to the zero vector.

    inlinegetRow (index:Int):Vec3

    Returns the indexth row vector of the matrix.

    -

    If index is less than 0 or greater than 2, null will be returned.

    inlinegetRowTo (index:Int, dst:Vec3):Void

    Sets dst to the indexth row vector of the matrix.

    -

    If index is less than 0 or greater than 2, dst will be set to the zero vector.

    inlineidentity ():Mat3

    Sets this matrix to identity matrix and returns this.

    inlineinit (e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float):Mat3

    Sets all elements at once and returns this.

    inlineinverse ():Mat3

    Returns the inverse matrix.

    -

    If the determinant is zero, zero matrix is returned.

    inlineinverseEq ():Mat3

    Sets this matrix to the inverse matrix and returns this.

    -

    If the determinant is zero, this matrix is set to zero matrix.

    inlinemul (m:Mat3):Mat3

    Returns this * m

    inlinemulEq (m:Mat3):Mat3

    Sets this matrix to this * m and returns this.

    inlineprependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Returns rotation matrix * this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineclone():Mat3

    Returns a clone of the matrix.

    inlinecopyFrom(m:Mat3):Mat3

    Copies values from m and returns this.

    inlinedeterminant():Float

    Returns the determinant.

    inlinefromCols(col0:Vec3, col1:Vec3, col2:Vec3):Mat3

    Sets this matrix by column vectors and returns this.

    inlinefromEulerXyz(eulerAngles:Vec3):Mat3

    Sets this matrix to the rotation matrix represented by Euler angles eulerAngles, and returns this. +Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis.

    inlinefromQuat(q:Quat):Mat3

    Sets this matrix to the representation of the quaternion q, and returns this.

    inlinefromRows(row0:Vec3, row1:Vec3, row2:Vec3):Mat3

    Sets this matrix by row vectors and returns this.

    inlinegetCol(index:Int):Vec3

    Returns the indexth column vector of the matrix.

    +

    If index is less than 0 or greater than 2, null will be returned.

    inlinegetColTo(index:Int, dst:Vec3):Void

    Sets dst to the indexth column vector of the matrix.

    +

    If index is less than 0 or greater than 2, dst will be set to the zero vector.

    inlinegetRow(index:Int):Vec3

    Returns the indexth row vector of the matrix.

    +

    If index is less than 0 or greater than 2, null will be returned.

    inlinegetRowTo(index:Int, dst:Vec3):Void

    Sets dst to the indexth row vector of the matrix.

    +

    If index is less than 0 or greater than 2, dst will be set to the zero vector.

    inlineidentity():Mat3

    Sets this matrix to identity matrix and returns this.

    inlineinit(e00:Float, e01:Float, e02:Float, e10:Float, e11:Float, e12:Float, e20:Float, e21:Float, e22:Float):Mat3

    Sets all elements at once and returns this.

    inlineinverse():Mat3

    Returns the inverse matrix.

    +

    If the determinant is zero, zero matrix is returned.

    inlineinverseEq():Mat3

    Sets this matrix to the inverse matrix and returns this.

    +

    If the determinant is zero, this matrix is set to zero matrix.

    inlinemul(m:Mat3):Mat3

    Returns this * m

    inlinemulEq(m:Mat3):Mat3

    Sets this matrix to this * m and returns this.

    inlineprependRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Returns rotation matrix * this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineprependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Sets this matrix to rotation matrix * this, and returns this.

    +vector (axisX, axisY, axisZ).

    inlineprependRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat3

    Sets this matrix to rotation matrix * this, and returns this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineprependScale (sx:Float, sy:Float, sz:Float):Mat3

    Returns scaling matrix * this.

    +vector (axisX, axisY, axisZ).

    inlineprependScale(sx:Float, sy:Float, sz:Float):Mat3

    Returns scaling matrix * this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependScaleEq (sx:Float, sy:Float, sz:Float):Mat3

    Sets this matrix to scaling matrix * this, and returns this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependScaleEq(sx:Float, sy:Float, sz:Float):Mat3

    Sets this matrix to scaling matrix * this, and returns this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlinescale (s:Float):Mat3

    Returns this * s

    inlinescaleEq (s:Float):Mat3

    Sets this matrix to this * s and returns this.

    inlinesub (m:Mat3):Mat3

    Returns this - m

    inlinesubEq (m:Mat3):Mat3

    Sets this matrix to this - m and returns this.

    @:value({ columnMajor : false })inlinetoArray (columnMajor:Bool = false):Array<Float>

    Returns an array of the elements of this matrix.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlinescale(s:Float):Mat3

    Returns this * s

    inlinescaleEq(s:Float):Mat3

    Sets this matrix to this * s and returns this.

    inlinesub(m:Mat3):Mat3

    Returns this - m

    inlinesubEq(m:Mat3):Mat3

    Sets this matrix to this - m and returns this.

    @:value({ columnMajor : false })inlinetoArray(columnMajor:Bool = false):Array<Float>

    Returns an array of the elements of this matrix.

    If columnMajor is true, the array is arranged in column-major order. -Otherwise, the array is arranged in row-major order.

    inlinetoEulerXyz ():Vec3

    Returns a vector (angleX, angleY, angleZ) represents the Euler angles of this matrix. +Otherwise, the array is arranged in row-major order.

    inlinetoEulerXyz():Vec3

    Returns a vector (angleX, angleY, angleZ) represents the Euler angles of this matrix. Rotation order is first X-axis, then rotated Y-axis, finally rotated Z-axis. -Note that angleX, angleY, and angleZ are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.

    inlinetoQuat ():Quat

    Returns a quaternion which represents this matrix.

    -

    This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

    toString ():String

    Returns the string representation of the matrix.

    inlinetrace ():Float

    Returns the trace.

    inlinetranspose ():Mat3

    Returns the transposed matrix.

    inlinetransposeEq ():Mat3

    Sets this matrix to the transposed matrix and returns this.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    \ No newline at end of file +Note that angleX, angleY, and angleZ are in range of -PI to PI, -PI/2 to PI/2, and -PI to PI respectively.

    inlinetoQuat():Quat

    Returns a quaternion which represents this matrix.

    +

    This matrix must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

    toString():String

    Returns the string representation of the matrix.

    inlinetrace():Float

    Returns the trace.

    inlinetranspose():Mat3

    Returns the transposed matrix.

    inlinetransposeEq():Mat3

    Sets this matrix to the transposed matrix and returns this.

    \ No newline at end of file diff --git a/docs/oimo/common/Mat4.html b/docs/oimo/common/Mat4.html index 028602e..e42b843 100644 --- a/docs/oimo/common/Mat4.html +++ b/docs/oimo/common/Mat4.html @@ -6,43 +6,43 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    4x4 Matrix class.

    -

    Note that columns and rows are 0-indexed.

    Constructor

    @:value({ e33 : 1, e32 : 0, e31 : 0, e30 : 0, e23 : 0, e22 : 1, e21 : 0, e20 : 0, e13 : 0, e12 : 0, e11 : 1, e10 : 0, e03 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew (e00:Float = 1, e01:Float = 0, e02:Float = 0, e03:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e13:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1, e23:Float = 0, e30:Float = 0, e31:Float = 0, e32:Float = 0, e33:Float = 1)

    Creates a new matrix. The matrix is identity by default.

    Variables

    e00:Float

    The element at row 0 column 0.

    e01:Float

    The element at row 0 column 1.

    e02:Float

    The element at row 0 column 2.

    e03:Float

    The element at row 0 column 3.

    e10:Float

    The element at row 1 column 0.

    e11:Float

    The element at row 1 column 1.

    e12:Float

    The element at row 1 column 2.

    e13:Float

    The element at row 1 column 3.

    e20:Float

    The element at row 2 column 0.

    e21:Float

    The element at row 2 column 1.

    e22:Float

    The element at row 2 column 2.

    e23:Float

    The element at row 2 column 3.

    e30:Float

    The element at row 3 column 0.

    e31:Float

    The element at row 3 column 1.

    e32:Float

    The element at row 3 column 2.

    e33:Float

    The element at row 3 column 3.

    Methods

    inlineadd (m:Mat4):Mat4

    Returns this + m

    inlineaddEq (m:Mat4):Mat4

    Sets this matrix to this + m and returns this.

    inlineappendRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Returns this * rotation matrix.

    +

    4x4 Matrix class.

    +

    Note that columns and rows are 0-indexed.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    Constructor

    @:value({ e33 : 1, e32 : 0, e31 : 0, e30 : 0, e23 : 0, e22 : 1, e21 : 0, e20 : 0, e13 : 0, e12 : 0, e11 : 1, e10 : 0, e03 : 0, e02 : 0, e01 : 0, e00 : 1 })inlinenew(e00:Float = 1, e01:Float = 0, e02:Float = 0, e03:Float = 0, e10:Float = 0, e11:Float = 1, e12:Float = 0, e13:Float = 0, e20:Float = 0, e21:Float = 0, e22:Float = 1, e23:Float = 0, e30:Float = 0, e31:Float = 0, e32:Float = 0, e33:Float = 1)

    Creates a new matrix. The matrix is identity by default.

    Variables

    e00:Float

    The element at row 0 column 0.

    e01:Float

    The element at row 0 column 1.

    e02:Float

    The element at row 0 column 2.

    e03:Float

    The element at row 0 column 3.

    e10:Float

    The element at row 1 column 0.

    e11:Float

    The element at row 1 column 1.

    e12:Float

    The element at row 1 column 2.

    e13:Float

    The element at row 1 column 3.

    e20:Float

    The element at row 2 column 0.

    e21:Float

    The element at row 2 column 1.

    e22:Float

    The element at row 2 column 2.

    e23:Float

    The element at row 2 column 3.

    e30:Float

    The element at row 3 column 0.

    e31:Float

    The element at row 3 column 1.

    e32:Float

    The element at row 3 column 2.

    e33:Float

    The element at row 3 column 3.

    Methods

    inlineadd(m:Mat4):Mat4

    Returns this + m

    inlineaddEq(m:Mat4):Mat4

    Sets this matrix to this + m and returns this.

    inlineappendRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Returns this * rotation matrix.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineappendRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Sets this matrix to this * rotation matrix, and returns this.

    +vector (axisX, axisY, axisZ).

    inlineappendRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Sets this matrix to this * rotation matrix, and returns this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineappendScale (sx:Float, sy:Float, sz:Float):Mat4

    Returns this * scaling matrix.

    +vector (axisX, axisY, axisZ).

    inlineappendScale(sx:Float, sy:Float, sz:Float):Mat4

    Returns this * scaling matrix.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendScaleEq (sx:Float, sy:Float, sz:Float):Mat4

    Sets this matrix to this * scaling matrix, and returns this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendScaleEq(sx:Float, sy:Float, sz:Float):Mat4

    Sets this matrix to this * scaling matrix, and returns this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendTranslation (tx:Float, ty:Float, tz:Float):Mat4

    Returns this * translation matrix.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineappendTranslation(tx:Float, ty:Float, tz:Float):Mat4

    Returns this * translation matrix.

    Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

    inlineappendTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

    Sets this matrix to this * translation matrix, and returns this.

    +the x-axis, y-axis and z-axis respectively.

    inlineappendTranslationEq(tx:Float, ty:Float, tz:Float):Mat4

    Sets this matrix to this * translation matrix, and returns this.

    Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

    inlineclone ():Mat4

    Returns a clone of the matrix.

    inlinecopyFrom (m:Mat4):Mat4

    Copies values from m and returns this.

    inlinedeterminant ():Float

    Returns the determinant.

    inlinefromMat3 (m:Mat3):Mat4

    Sets this matrix to the extension of m and returns this.

    -

    this.e33 is set to 1 and other components don't exist in m are set to 0.

    inlinefromTransform (transform:Transform):Mat4

    Sets this matrix to the representation of transform and returns this.

    inlineidentity ():Mat4

    Sets this matrix to identity matrix and returns this.

    inlineinit (e00:Float, e01:Float, e02:Float, e03:Float, e10:Float, e11:Float, e12:Float, e13:Float, e20:Float, e21:Float, e22:Float, e23:Float, e30:Float, e31:Float, e32:Float, e33:Float):Mat4

    Sets all elements at once and returns this.

    inlineinverse ():Mat4

    Returns the inverse matrix.

    -

    If the determinant is zero, zero matrix is returned.

    inlineinverseEq ():Mat4

    Sets this matrix to the inverse matrix and returns this.

    -

    If the determinant is zero, this matrix is set to zero matrix.

    inlinelookAt (eyeX:Float, eyeY:Float, eyeZ:Float, atX:Float, atY:Float, atZ:Float, upX:Float, upY:Float, upZ:Float):Mat4

    Sets this matrix to view matrix and returns this.

    +the x-axis, y-axis and z-axis respectively.

    inlineclone():Mat4

    Returns a clone of the matrix.

    inlinecopyFrom(m:Mat4):Mat4

    Copies values from m and returns this.

    inlinedeterminant():Float

    Returns the determinant.

    inlinefromMat3(m:Mat3):Mat4

    Sets this matrix to the extension of m and returns this.

    +

    this.e33 is set to 1 and other components don't exist in m are set to 0.

    inlinefromTransform(transform:Transform):Mat4

    Sets this matrix to the representation of transform and returns this.

    inlineidentity():Mat4

    Sets this matrix to identity matrix and returns this.

    inlineinit(e00:Float, e01:Float, e02:Float, e03:Float, e10:Float, e11:Float, e12:Float, e13:Float, e20:Float, e21:Float, e22:Float, e23:Float, e30:Float, e31:Float, e32:Float, e33:Float):Mat4

    Sets all elements at once and returns this.

    inlineinverse():Mat4

    Returns the inverse matrix.

    +

    If the determinant is zero, zero matrix is returned.

    inlineinverseEq():Mat4

    Sets this matrix to the inverse matrix and returns this.

    +

    If the determinant is zero, this matrix is set to zero matrix.

    inlinelookAt(eyeX:Float, eyeY:Float, eyeZ:Float, atX:Float, atY:Float, atZ:Float, upX:Float, upY:Float, upZ:Float):Mat4

    Sets this matrix to view matrix and returns this.

    Where view matrix is a matrix which represents the viewing transformation with eyes at (eyeX, eyeY, eyeZ), fixation point at (atX, atY, atZ), and -up vector (upX, upY, upZ).

    inlinemul (m:Mat4):Mat4

    Returns this * m

    inlinemulEq (m:Mat4):Mat4

    Sets this matrix to this * m and returns this.

    inlineortho (width:Float, height:Float, near:Float, far:Float):Mat4

    Sets this matrix to orthogonal projection matrix and returns this.

    +up vector (upX, upY, upZ).

    inlinemul(m:Mat4):Mat4

    Returns this * m

    inlinemulEq(m:Mat4):Mat4

    Sets this matrix to this * m and returns this.

    inlineortho(width:Float, height:Float, near:Float, far:Float):Mat4

    Sets this matrix to orthogonal projection matrix and returns this.

    Where orthogonal projection matrix is a matrix which represents the orthogonal projection transformation with screen width and height width, height, and -z-value of near and far clipping plane near, far.

    inlineperspective (fovY:Float, aspect:Float, near:Float, far:Float):Mat4

    Sets this matrix to perspecive projection matrix and returns this.

    +z-value of near and far clipping plane near, far.

    inlineperspective(fovY:Float, aspect:Float, near:Float, far:Float):Mat4

    Sets this matrix to perspecive projection matrix and returns this.

    Where perspecive projection matrix is a matrix which represents the perspective projection transformation with field of view in the y direction fovY in radians, -aspect ratio aspect, and z-value of near and far clipping plane near, far.

    inlineprependRotation (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Returns rotation matrix * this.

    +aspect ratio aspect, and z-value of near and far clipping plane near, far.

    inlineprependRotation(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Returns rotation matrix * this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineprependRotationEq (rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Sets this matrix to rotation matrix * this, and returns this.

    +vector (axisX, axisY, axisZ).

    inlineprependRotationEq(rad:Float, axisX:Float, axisY:Float, axisZ:Float):Mat4

    Sets this matrix to rotation matrix * this, and returns this.

    Where rotation matrix is a matrix which rotates rad in radians around the normalized -vector (axisX, axisY, axisZ).

    inlineprependScale (sx:Float, sy:Float, sz:Float):Mat4

    Returns scaling matrix * this.

    +vector (axisX, axisY, axisZ).

    inlineprependScale(sx:Float, sy:Float, sz:Float):Mat4

    Returns scaling matrix * this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependScaleEq (sx:Float, sy:Float, sz:Float):Mat4

    Sets this matrix to scaling matrix * this, and returns this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependScaleEq(sx:Float, sy:Float, sz:Float):Mat4

    Sets this matrix to scaling matrix * this, and returns this.

    Where scaling matrix is a matrix which scales sx times, sy times and -sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependTranslation (tx:Float, ty:Float, tz:Float):Mat4

    Returns translation matrix * this.

    +sz times along the x-axis, y-axis and z-axis respectively.

    inlineprependTranslation(tx:Float, ty:Float, tz:Float):Mat4

    Returns translation matrix * this.

    Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

    inlineprependTranslationEq (tx:Float, ty:Float, tz:Float):Mat4

    Sets this matrix to translation matrix * this, and returns this.

    +the x-axis, y-axis and z-axis respectively.

    inlineprependTranslationEq(tx:Float, ty:Float, tz:Float):Mat4

    Sets this matrix to translation matrix * this, and returns this.

    Where translation matrix is a matrix which translates sx, sy and sz along -the x-axis, y-axis and z-axis respectively.

    inlinescale (s:Float):Mat4

    Returns this * s

    inlinescaleEq (s:Float):Mat4

    Sets this matrix to this * s and returns this.

    inlinesub (m:Mat4):Mat4

    Returns this - m

    inlinesubEq (m:Mat4):Mat4

    Sets this matrix to this - m and returns this.

    @:value({ columnMajor : false })inlinetoArray (columnMajor:Bool = false):Array<Float>

    Returns an array of the elements of this matrix.

    +the x-axis, y-axis and z-axis respectively.

    inlinescale(s:Float):Mat4

    Returns this * s

    inlinescaleEq(s:Float):Mat4

    Sets this matrix to this * s and returns this.

    inlinesub(m:Mat4):Mat4

    Returns this - m

    inlinesubEq(m:Mat4):Mat4

    Sets this matrix to this - m and returns this.

    @:value({ columnMajor : false })inlinetoArray(columnMajor:Bool = false):Array<Float>

    Returns an array of the elements of this matrix.

    If columnMajor is true, the array is arranged in column-major order. -Otherwise, the array is arranged in row-major order.

    toString ():String

    Returns the string representation of the matrix.

    inlinetrace ():Float

    Returns the trace.

    inlinetranspose ():Mat4

    Returns the transposed matrix.

    inlinetransposeEq ():Mat4

    Sets this matrix to the transposed matrix and returns this.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    \ No newline at end of file +Otherwise, the array is arranged in row-major order.

    toString():String

    Returns the string representation of the matrix.

    inlinetrace():Float

    Returns the trace.

    inlinetranspose():Mat4

    Returns the transposed matrix.

    inlinetransposeEq():Mat4

    Sets this matrix to the transposed matrix and returns this.

    \ No newline at end of file diff --git a/docs/oimo/common/MathUtil.html b/docs/oimo/common/MathUtil.html index 42feb19..216b4cc 100644 --- a/docs/oimo/common/MathUtil.html +++ b/docs/oimo/common/MathUtil.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    This class provides mathematical operations for internal purposes.

    Static variables

    @:value(PI / 2)staticinlineread onlyHALF_PI:Float = PI / 2

    Shorthand for PI / 2.

    @:value(-1e65536)staticinlineread onlyNEGATIVE_INFINITY:Float = -1e65536

    Negative infinity.

    @:value(3.14159265358979)staticinlineread onlyPI:Float = 3.14159265358979

    The ratio of the circumference of a circle to its diameter.

    @:value(1e65536)staticinlineread onlyPOSITIVE_INFINITY:Float = 1e65536

    Positive infinity.

    @:value(180 / PI)staticinlineread onlyTO_DEGREES:Float = 180 / PI

    Shorthand for 180 / PI.

    @:value(PI / 180)staticinlineread onlyTO_RADIANS:Float = PI / 180

    Shorthand for PI / 180.

    @:value(PI * 2)staticinlineread onlyTWO_PI:Float = PI * 2

    Shorthand for PI * 2.

    Static methods

    staticinlineabs (x:Float):Float

    Returns the absolute value of x.

    staticinlineacos (x:Float):Float

    Returns Math.acos(x).

    staticinlineasin (x:Float):Float

    Returns Math.asin(x).

    staticinlineatan (x:Float):Float

    Returns Math.atan(x).

    staticinlineatan2 (y:Float, x:Float):Float

    Returns Math.atan2(y, x)

    staticinlineclamp (x:Float, min:Float, max:Float):Float

    Returns a clamped value of x from min to max.

    staticinlinecos (x:Float):Float

    Returns Math.cos(x).

    staticinlinerand ():Float

    Returns Math.random().

    staticinlinerandIn (min:Float, max:Float):Float

    Returns a random value from min inclusive to max exclusive.

    staticinlinerandVec3 ():Vec3

    Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

    staticinlinerandVec3In (min:Float, max:Float):Vec3

    Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

    staticinlinesafeAcos (x:Float):Float

    Returns Math.acos(clamp(-1, x, 1)). -This never returns NaN as long as x is not NaN.

    staticinlinesafeAsin (x:Float):Float

    Returns Math.asin(clamp(-1, x, 1)). -This never returns NaN as long as x is not NaN.

    staticinlinesin (x:Float):Float

    Returns Math.sin(x).

    staticinlinesqrt (x:Float):Float

    Returns Math.sqrt(x).

    staticinlinetan (x:Float):Float

    Returns Math.tan(x).

    \ No newline at end of file +

    This class provides mathematical operations for internal purposes.

    Static variables

    @:value(PI / 2)staticinlineread onlyHALF_PI:Float = PI / 2

    Shorthand for PI / 2.

    @:value(-1e65536)staticinlineread onlyNEGATIVE_INFINITY:Float = -1e65536

    Negative infinity.

    @:value(3.14159265358979)staticinlineread onlyPI:Float = 3.14159265358979

    The ratio of the circumference of a circle to its diameter.

    @:value(1e65536)staticinlineread onlyPOSITIVE_INFINITY:Float = 1e65536

    Positive infinity.

    @:value(180 / PI)staticinlineread onlyTO_DEGREES:Float = 180 / PI

    Shorthand for 180 / PI.

    @:value(PI / 180)staticinlineread onlyTO_RADIANS:Float = PI / 180

    Shorthand for PI / 180.

    @:value(PI * 2)staticinlineread onlyTWO_PI:Float = PI * 2

    Shorthand for PI * 2.

    Static methods

    staticinlineabs(x:Float):Float

    Returns the absolute value of x.

    staticinlineacos(x:Float):Float

    Returns Math.acos(x).

    staticinlineasin(x:Float):Float

    Returns Math.asin(x).

    staticinlineatan(x:Float):Float

    Returns Math.atan(x).

    staticinlineatan2(y:Float, x:Float):Float

    Returns Math.atan2(y, x)

    staticinlineclamp(x:Float, min:Float, max:Float):Float

    Returns a clamped value of x from min to max.

    staticinlinecos(x:Float):Float

    Returns Math.cos(x).

    staticinlinerand():Float

    Returns Math.random().

    staticinlinerandIn(min:Float, max:Float):Float

    Returns a random value from min inclusive to max exclusive.

    staticinlinerandVec3():Vec3

    Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

    staticinlinerandVec3In(min:Float, max:Float):Vec3

    Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

    staticinlinesafeAcos(x:Float):Float

    Returns Math.acos(clamp(-1, x, 1)). +This never returns NaN as long as x is not NaN.

    staticinlinesafeAsin(x:Float):Float

    Returns Math.asin(clamp(-1, x, 1)). +This never returns NaN as long as x is not NaN.

    staticinlinesin(x:Float):Float

    Returns Math.sin(x).

    staticinlinesqrt(x:Float):Float

    Returns Math.sqrt(x).

    staticinlinetan(x:Float):Float

    Returns Math.tan(x).

    \ No newline at end of file diff --git a/docs/oimo/common/Pool.html b/docs/oimo/common/Pool.html index 7e8bcdf..f3f8b8f 100644 --- a/docs/oimo/common/Pool.html +++ b/docs/oimo/common/Pool.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The object pool system of Vec3, Mat3, Mat4, and Quat.

    Constructor

    new ()

    Default constructor.

    Methods

    inlinedispose (?vec3:Vec3, ?mat3:Mat3, ?mat4:Mat4, ?quat:Quat):Void

    Disposes an object got from Pool.vec3, Pool.mat3, Pool.mat4, or Pool.quat.

    inlinedisposeMat3 (m:Mat3):Void

    Disposes an Mat3 object got from Pool.mat3.

    inlinedisposeMat4 (m:Mat4):Void

    Disposes an Mat4 object got from Pool.mat4.

    inlinedisposeQuat (q:Quat):Void

    Disposes an Quat object got from Pool.quat.

    inlinedisposeVec3 (v:Vec3):Void

    Disposes an Vec3 object got from Pool.vec3.

    inlinemat3 ():Mat3

    Returns a Mat3 object. If an unused object of Mat3 is pooled, this does -not create a new instance.

    inlinemat4 ():Mat4

    Returns a Mat4 object. If an unused object of Vec3 is pooled, this does -not create a new instance.

    inlinequat ():Quat

    Returns a Quat object. If an unused object of Quat is pooled, this does -not create a new instance.

    inlinevec3 ():Vec3

    Returns a Vec3 object. If an unused object of Vec3 is pooled, this does -not create a new instance.

    \ No newline at end of file +

    The object pool system of Vec3, Mat3, Mat4, and Quat.

    Constructor

    new()

    Default constructor.

    Methods

    inlinedispose(?vec3:Vec3, ?mat3:Mat3, ?mat4:Mat4, ?quat:Quat):Void

    Disposes an object got from Pool.vec3, Pool.mat3, Pool.mat4, or Pool.quat.

    inlinedisposeMat3(m:Mat3):Void

    Disposes an Mat3 object got from Pool.mat3.

    inlinedisposeMat4(m:Mat4):Void

    Disposes an Mat4 object got from Pool.mat4.

    inlinedisposeQuat(q:Quat):Void

    Disposes an Quat object got from Pool.quat.

    inlinedisposeVec3(v:Vec3):Void

    Disposes an Vec3 object got from Pool.vec3.

    inlinemat3():Mat3

    Returns a Mat3 object. If an unused object of Mat3 is pooled, this does +not create a new instance.

    inlinemat4():Mat4

    Returns a Mat4 object. If an unused object of Vec3 is pooled, this does +not create a new instance.

    inlinequat():Quat

    Returns a Quat object. If an unused object of Quat is pooled, this does +not create a new instance.

    inlinevec3():Vec3

    Returns a Vec3 object. If an unused object of Vec3 is pooled, this does +not create a new instance.

    \ No newline at end of file diff --git a/docs/oimo/common/Quat.html b/docs/oimo/common/Quat.html index ef45eaa..5ac7913 100644 --- a/docs/oimo/common/Quat.html +++ b/docs/oimo/common/Quat.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Quaternion class.

    Constructor

    @:value({ w : 1, z : 0, y : 0, x : 0 })inlinenew (x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1)

    Creates a new quaternion. The quaternion is identity by default.

    Variables

    w:Float

    The real part of the quaternion.

    x:Float

    The x-value of the imaginary part of the quaternion.

    y:Float

    The y-value of the imaginary part of the quaternion.

    z:Float

    The z-value of the imaginary part of the quaternion.

    Methods

    inlineadd (q:Quat):Quat

    Returns this + v.

    inlineaddEq (q:Quat):Quat

    Sets this quaternion to this + v and returns this.

    inlineclone ():Quat

    Returns a clone of the quaternion.

    inlinecopyFrom (q:Quat):Quat

    Copies values from q and returns this.

    inlinedot (q:Quat):Float

    Returns the dot product of this and q.

    inlinefromMat3 (m:Mat3):Quat

    Sets this quaternion to the representation of the matrix m, and returns this.

    -

    The matrix m must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

    inlineidentity ():Quat

    Sets the quaternion to identity quaternion and returns this.

    inlineinit (x:Float, y:Float, z:Float, w:Float):Quat

    Sets all values at once and returns this.

    inlinelength ():Float

    Returns the length of the quaternion.

    inlinelengthSq ():Float

    Returns the squared length of the quaternion.

    inlinenormalize ():Quat

    Sets this quaternion to the normalized quaternion and returns this.

    -

    If the length is zero, this quaternion is set to zero quaternion.

    inlinenormalized ():Quat

    Returns the normalized quaternion.

    -

    If the length is zero, zero quaterinon is returned.

    inlinescale (s:Float):Quat

    Returns this * s.

    inlinescaleEq (s:Float):Quat

    Sets this quaternion to this * s and returns this.

    setArc (v1:Vec3, v2:Vec3):Quat

    Sets this quaternion to the quaternion representing the shortest arc -rotation from v1 to v2, and return this.

    slerp (q:Quat, t:Float):Quat

    Returns the spherical linear interpolation between two quaternions this and q with interpolation paraeter t. -Both quaternions this and q must be normalized.

    inlinesub (q:Quat):Quat

    Returns this - v.

    inlinesubEq (q:Quat):Quat

    Sets this quaternion to this - v and returns this.

    inlinetoMat3 ():Mat3

    Returns a rotation matrix which represents this quaternion.

    inlinetoString ():String

    Returns the string representation of the quaternion.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    \ No newline at end of file +

    Quaternion class.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    Constructor

    @:value({ w : 1, z : 0, y : 0, x : 0 })inlinenew(x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1)

    Creates a new quaternion. The quaternion is identity by default.

    Variables

    w:Float

    The real part of the quaternion.

    x:Float

    The x-value of the imaginary part of the quaternion.

    y:Float

    The y-value of the imaginary part of the quaternion.

    z:Float

    The z-value of the imaginary part of the quaternion.

    Methods

    inlineadd(q:Quat):Quat

    Returns this + v.

    inlineaddEq(q:Quat):Quat

    Sets this quaternion to this + v and returns this.

    inlineclone():Quat

    Returns a clone of the quaternion.

    inlinecopyFrom(q:Quat):Quat

    Copies values from q and returns this.

    inlinedot(q:Quat):Float

    Returns the dot product of this and q.

    inlinefromMat3(m:Mat3):Quat

    Sets this quaternion to the representation of the matrix m, and returns this.

    +

    The matrix m must be a rotation matrix, that is, must be orthogonalized and have determinant 1.

    inlineidentity():Quat

    Sets the quaternion to identity quaternion and returns this.

    inlineinit(x:Float, y:Float, z:Float, w:Float):Quat

    Sets all values at once and returns this.

    inlinelength():Float

    Returns the length of the quaternion.

    inlinelengthSq():Float

    Returns the squared length of the quaternion.

    inlinenormalize():Quat

    Sets this quaternion to the normalized quaternion and returns this.

    +

    If the length is zero, this quaternion is set to zero quaternion.

    inlinenormalized():Quat

    Returns the normalized quaternion.

    +

    If the length is zero, zero quaterinon is returned.

    inlinescale(s:Float):Quat

    Returns this * s.

    inlinescaleEq(s:Float):Quat

    Sets this quaternion to this * s and returns this.

    setArc(v1:Vec3, v2:Vec3):Quat

    Sets this quaternion to the quaternion representing the shortest arc +rotation from v1 to v2, and return this.

    slerp(q:Quat, t:Float):Quat

    Returns the spherical linear interpolation between two quaternions this and q with interpolation paraeter t. +Both quaternions this and q must be normalized.

    inlinesub(q:Quat):Quat

    Returns this - v.

    inlinesubEq(q:Quat):Quat

    Sets this quaternion to this - v and returns this.

    inlinetoMat3():Mat3

    Returns a rotation matrix which represents this quaternion.

    inlinetoString():String

    Returns the string representation of the quaternion.

    \ No newline at end of file diff --git a/docs/oimo/common/Setting.html b/docs/oimo/common/Setting.html index 1f95526..8acaa1a 100644 --- a/docs/oimo/common/Setting.html +++ b/docs/oimo/common/Setting.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Setting provides advenced parameters used by the physics simulation.

    Static variables

    @:value(PositionCorrectionAlgorithm._SPLIT_IMPULSE)staticalternativeContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._SPLIT_IMPULSE

    @:value(1 * MathUtil.TO_RADIANS)staticangularSlop:Float = 1 * MathUtil.TO_RADIANS

    @:value(0.45)staticbvhIncrementalCollisionThreshold:Float = 0.45

    @:value(0.1)staticbvhProxyPadding:Float = 0.1

    @:value(0.5)staticcontactEnableBounceThreshold:Float = 0.5

    @:value(0.05)staticcontactPersistenceThreshold:Float = 0.05

    @:value(1)staticdefaultCollisionGroup:Int = 1

    @:value(1)staticdefaultCollisionMask:Int = 1

    @:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

    @:value(1)staticdefaultDensity:Float = 1

    @:value(0.2)staticdefaultFriction:Float = 0.2

    @:value(0.05)staticdefaultGJKMargin:Float = 0.05

    @:value(ConstraintSolverType._ITERATIVE)staticdefaultJointConstraintSolverType:Int = ConstraintSolverType._ITERATIVE

    @:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultJointPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

    @:value(0.2)staticdefaultRestitution:Float = 0.2

    @:value(1e-9)staticdirectMlcpSolverEps:Float = 1e-9

    @:value(false)staticdisableSleeping:Bool = false

    @:value(true)staticenableGJKCaching:Bool = true

    @:value(128)staticislandInitialConstraintArraySize:Int = 128

    @:value(128)staticislandInitialRigidBodyArraySize:Int = 128

    @:value(0.95)staticjointWarmStartingFactor:Float = 0.95

    @:value(0.8)staticjointWarmStartingFactorForBaungarte:Float = 0.8

    @:value(0.005)staticlinearSlop:Float = 0.005

    @:value(128)staticmaxEPAPolyhedronFaces:Int = 128

    @:value(128)staticmaxEPAVertices:Int = 128

    @:value(6)staticmaxJacobianRows:Int = 6

    @:value(4)staticmaxManifoldPoints:Int = 4

    @:value(MathUtil.PI)staticmaxRotationPerStep:Float = MathUtil.PI

    @:value(20)staticmaxTranslationPerStep:Float = 20

    @:value(1e-6)staticminRagdollMaxSwingAngle:Float = 1e-6

    @:value(1e-6)staticminSpringDamperDampingRatio:Float = 1e-6

    @:value(1.0)staticpositionNgsBaumgarte:Float = 1.0

    @:value(0.4)staticpositionSplitImpulseBaumgarte:Float = 0.4

    @:value(0.5)staticsleepingAngularVelocityThreshold:Float = 0.5

    @:value(1.0)staticsleepingTimeThreshold:Float = 1.0

    @:value(0.2)staticsleepingVelocityThreshold:Float = 0.2

    @:value(0.2)staticvelocityBaumgarte:Float = 0.2

    \ No newline at end of file +

    Setting provides advenced parameters used by the physics simulation.

    Static variables

    @:value(PositionCorrectionAlgorithm._SPLIT_IMPULSE)staticalternativeContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._SPLIT_IMPULSE

    @:value(1 * MathUtil.TO_RADIANS)staticangularSlop:Float = 1 * MathUtil.TO_RADIANS

    @:value(0.45)staticbvhIncrementalCollisionThreshold:Float = 0.45

    @:value(0.1)staticbvhProxyPadding:Float = 0.1

    @:value(0.5)staticcontactEnableBounceThreshold:Float = 0.5

    @:value(0.05)staticcontactPersistenceThreshold:Float = 0.05

    @:value(1)staticdefaultCollisionGroup:Int = 1

    @:value(1)staticdefaultCollisionMask:Int = 1

    @:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultContactPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

    @:value(1)staticdefaultDensity:Float = 1

    @:value(0.2)staticdefaultFriction:Float = 0.2

    @:value(0.05)staticdefaultGJKMargin:Float = 0.05

    @:value(ConstraintSolverType._ITERATIVE)staticdefaultJointConstraintSolverType:Int = ConstraintSolverType._ITERATIVE

    @:value(PositionCorrectionAlgorithm._BAUMGARTE)staticdefaultJointPositionCorrectionAlgorithm:Int = PositionCorrectionAlgorithm._BAUMGARTE

    @:value(0.2)staticdefaultRestitution:Float = 0.2

    @:value(1e-9)staticdirectMlcpSolverEps:Float = 1e-9

    @:value(false)staticdisableSleeping:Bool = false

    @:value(true)staticenableGJKCaching:Bool = true

    @:value(128)staticislandInitialConstraintArraySize:Int = 128

    @:value(128)staticislandInitialRigidBodyArraySize:Int = 128

    @:value(0.95)staticjointWarmStartingFactor:Float = 0.95

    @:value(0.8)staticjointWarmStartingFactorForBaungarte:Float = 0.8

    @:value(0.005)staticlinearSlop:Float = 0.005

    @:value(128)staticmaxEPAPolyhedronFaces:Int = 128

    @:value(128)staticmaxEPAVertices:Int = 128

    @:value(6)staticmaxJacobianRows:Int = 6

    @:value(4)staticmaxManifoldPoints:Int = 4

    @:value(MathUtil.PI)staticmaxRotationPerStep:Float = MathUtil.PI

    @:value(20)staticmaxTranslationPerStep:Float = 20

    @:value(1e-6)staticminRagdollMaxSwingAngle:Float = 1e-6

    @:value(1e-6)staticminSpringDamperDampingRatio:Float = 1e-6

    @:value(1.0)staticpositionNgsBaumgarte:Float = 1.0

    @:value(0.4)staticpositionSplitImpulseBaumgarte:Float = 0.4

    @:value(0.5)staticsleepingAngularVelocityThreshold:Float = 0.5

    @:value(1.0)staticsleepingTimeThreshold:Float = 1.0

    @:value(0.2)staticsleepingVelocityThreshold:Float = 0.2

    @:value(0.2)staticvelocityBaumgarte:Float = 0.2

    \ No newline at end of file diff --git a/docs/oimo/common/Transform.html b/docs/oimo/common/Transform.html index bd83cc7..b0c0f4c 100644 --- a/docs/oimo/common/Transform.html +++ b/docs/oimo/common/Transform.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Transform class provides a set of translation and rotation.

    Constructor

    new ()

    Creates a new identical transform.

    Methods

    inlineclone ():Transform

    Returns a clone of the transformation.

    inlinecopyFrom (transform:Transform):Transform

    Sets the transformation to transform and returns this.

    inlinegetOrientation ():Quat

    Returns the rotation as a quaternion.

    inlinegetOrientationTo (orientation:Quat):Void

    Sets orientation to the quaternion representing the rotation.

    -

    This does not create a new instance of Quat.

    inlinegetPosition ():Vec3

    Returns the position of the transformation.

    inlinegetPositionTo (position:Vec3):Void

    Sets position to the position of the transformation.

    -

    This does not create a new instance of Vec3.

    inlinegetRotation ():Mat3

    Returns the rotation matrix.

    inlinegetRotationTo (out:Mat3):Void

    Sets out to the rotation matrix.

    -

    This does not create a new instance of Mat3.

    inlineidentity ():Transform

    Sets the transformation to identity and returns this.

    inlinerotate (rotation:Mat3):Void

    Applies rotation by the rotation matrix rotation.

    inlinerotateXyz (eulerAngles:Vec3):Void

    Applies the rotation by Euler angles eulerAngles in radians.

    inlinesetOrientation (quaternion:Quat):Transform

    Sets the rotation from a quaternion quaternion and returns this.

    inlinesetPosition (position:Vec3):Transform

    Sets the position of the transformation to position and returns this.

    inlinesetRotation (rotation:Mat3):Transform

    Sets the rotation matrix to rotation and returns this.

    inlinesetRotationXyz (eulerAngles:Vec3):Void

    Sets the rotation by Euler angles eulerAngles in radians.

    inlinetranslate (translation:Vec3):Void

    Translates the position by translation.

    \ No newline at end of file +

    Transform class provides a set of translation and rotation.

    Constructor

    new()

    Creates a new identical transform.

    Methods

    inlineclone():Transform

    Returns a clone of the transformation.

    inlinecopyFrom(transform:Transform):Transform

    Sets the transformation to transform and returns this.

    inlinegetOrientation():Quat

    Returns the rotation as a quaternion.

    inlinegetOrientationTo(orientation:Quat):Void

    Sets orientation to the quaternion representing the rotation.

    +

    This does not create a new instance of Quat.

    inlinegetPosition():Vec3

    Returns the position of the transformation.

    inlinegetPositionTo(position:Vec3):Void

    Sets position to the position of the transformation.

    +

    This does not create a new instance of Vec3.

    inlinegetRotation():Mat3

    Returns the rotation matrix.

    inlinegetRotationTo(out:Mat3):Void

    Sets out to the rotation matrix.

    +

    This does not create a new instance of Mat3.

    inlineidentity():Transform

    Sets the transformation to identity and returns this.

    inlinerotate(rotation:Mat3):Void

    Applies rotation by the rotation matrix rotation.

    inlinerotateXyz(eulerAngles:Vec3):Void

    Applies the rotation by Euler angles eulerAngles in radians.

    inlinesetOrientation(quaternion:Quat):Transform

    Sets the rotation from a quaternion quaternion and returns this.

    inlinesetPosition(position:Vec3):Transform

    Sets the position of the transformation to position and returns this.

    inlinesetRotation(rotation:Mat3):Transform

    Sets the rotation matrix to rotation and returns this.

    inlinesetRotationXyz(eulerAngles:Vec3):Void

    Sets the rotation by Euler angles eulerAngles in radians.

    inlinetranslate(translation:Vec3):Void

    Translates the position by translation.

    \ No newline at end of file diff --git a/docs/oimo/common/Vec3.html b/docs/oimo/common/Vec3.html index 113b43e..ef05c72 100644 --- a/docs/oimo/common/Vec3.html +++ b/docs/oimo/common/Vec3.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    3D vector class.

    Constructor

    @:value({ z : 0, y : 0, x : 0 })inlinenew (x:Float = 0, y:Float = 0, z:Float = 0)

    Creates a new vector. The vector is zero vector by default.

    Variables

    x:Float

    The x-value of the vector.

    y:Float

    The y-value of the vector.

    z:Float

    The z-value of the vector.

    Methods

    inlineadd (v:Vec3):Vec3

    Returns this + v.

    inlineadd3 (vx:Float, vy:Float, vz:Float):Vec3

    Returns (this.x + vx, this.y + vy, this.z + vz).

    inlineadd3Eq (vx:Float, vy:Float, vz:Float):Vec3

    Sets this vector to (this.x + vx, this.y + vy, this.z + vz) and returns this.

    inlineaddEq (v:Vec3):Vec3

    Sets this vector to this + v and returns this.

    inlineaddScaled (v:Vec3, s:Float):Vec3

    Returns this + v * s.

    inlineaddScaledEq (v:Vec3, s:Float):Vec3

    Sets this vector to this + v * s and returns this.

    inlineclone ():Vec3

    Returns a clone of the vector.

    inlinecopyFrom (v:Vec3):Vec3

    Copies values from v and returns this.

    inlinecross (v:Vec3):Vec3

    Returns the cross product of this and v.

    inlinecrossEq (v:Vec3):Vec3

    Sets this vector to the cross product of this and s, and returns this.

    inlinedot (v:Vec3):Float

    Returns the dot product of this and v.

    init (x:Float, y:Float, z:Float):Vec3

    Sets all values at once and returns this.

    inlinelength ():Float

    Returns the length of the vector.

    inlinelengthSq ():Float

    Returns the squared length of the vector.

    inlinemulMat3 (m:Mat3):Vec3

    Returns the transformed vector by m.

    inlinemulMat3Eq (m:Mat3):Vec3

    Sets this vector to the transformed vector by m and returns this.

    inlinemulMat4 (m:Mat4):Vec3

    Returns the transformed vector by m.

    inlinemulMat4Eq (m:Mat4):Vec3

    Sets this vector to the transformed vector by m and returns this.

    inlinemulTransform (tf:Transform):Vec3

    Returns the transformed vector by tf.

    inlinemulTransformEq (tf:Transform):Vec3

    Sets this vector to the transformed vector by tf and returns this.

    inlinenegate ():Vec3

    Returns the nagated vector.

    inlinenegateEq ():Vec3

    Negate the vector and returns this.

    inlinenormalize ():Vec3

    Normalize this vector and returns this.

    -

    If the length is zero, this vector is set to zero vector.

    inlinenormalized ():Vec3

    Returns the normalized vector.

    -

    If the length is zero, zero vector is returned.

    inlinescale (s:Float):Vec3

    Returns this * s.

    inlinescale3 (sx:Float, sy:Float, sz:Float):Vec3

    Returns (this.x * sx, this.y * sy, this.z * sz).

    inlinescale3Eq (sx:Float, sy:Float, sz:Float):Vec3

    Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

    inlinescaleEq (s:Float):Vec3

    Sets this vector to this * s and returns this.

    inlinesub (v:Vec3):Vec3

    Returns this - v.

    inlinesub3 (vx:Float, vy:Float, vz:Float):Vec3

    Returns (this.x - vx, this.y - vy, this.z - vz).

    inlinesub3Eq (vx:Float, vy:Float, vz:Float):Vec3

    Sets this vector to (this.x - vx, this.y - vy, this.z - vz) and returns this.

    inlinesubEq (v:Vec3):Vec3

    Sets this vector to this - v and returns this.

    toString ():String

    Returns the string representation of the vector.

    zero ():Vec3

    Sets this vector to zero vector and returns this.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    \ No newline at end of file +

    3D vector class.

    Static variables

    @:value(0)staticnumCreations:Int = 0

    The number of instance creation.

    Constructor

    @:value({ z : 0, y : 0, x : 0 })inlinenew(x:Float = 0, y:Float = 0, z:Float = 0)

    Creates a new vector. The vector is zero vector by default.

    Variables

    x:Float

    The x-value of the vector.

    y:Float

    The y-value of the vector.

    z:Float

    The z-value of the vector.

    Methods

    inlineadd(v:Vec3):Vec3

    Returns this + v.

    inlineadd3(vx:Float, vy:Float, vz:Float):Vec3

    Returns (this.x + vx, this.y + vy, this.z + vz).

    inlineadd3Eq(vx:Float, vy:Float, vz:Float):Vec3

    Sets this vector to (this.x + vx, this.y + vy, this.z + vz) and returns this.

    inlineaddEq(v:Vec3):Vec3

    Sets this vector to this + v and returns this.

    inlineaddScaled(v:Vec3, s:Float):Vec3

    Returns this + v * s.

    inlineaddScaledEq(v:Vec3, s:Float):Vec3

    Sets this vector to this + v * s and returns this.

    inlineclone():Vec3

    Returns a clone of the vector.

    inlinecopyFrom(v:Vec3):Vec3

    Copies values from v and returns this.

    inlinecross(v:Vec3):Vec3

    Returns the cross product of this and v.

    inlinecrossEq(v:Vec3):Vec3

    Sets this vector to the cross product of this and s, and returns this.

    inlinedot(v:Vec3):Float

    Returns the dot product of this and v.

    init(x:Float, y:Float, z:Float):Vec3

    Sets all values at once and returns this.

    inlinelength():Float

    Returns the length of the vector.

    inlinelengthSq():Float

    Returns the squared length of the vector.

    inlinemulMat3(m:Mat3):Vec3

    Returns the transformed vector by m.

    inlinemulMat3Eq(m:Mat3):Vec3

    Sets this vector to the transformed vector by m and returns this.

    inlinemulMat4(m:Mat4):Vec3

    Returns the transformed vector by m.

    inlinemulMat4Eq(m:Mat4):Vec3

    Sets this vector to the transformed vector by m and returns this.

    inlinemulTransform(tf:Transform):Vec3

    Returns the transformed vector by tf.

    inlinemulTransformEq(tf:Transform):Vec3

    Sets this vector to the transformed vector by tf and returns this.

    inlinenegate():Vec3

    Returns the nagated vector.

    inlinenegateEq():Vec3

    Negate the vector and returns this.

    inlinenormalize():Vec3

    Normalize this vector and returns this.

    +

    If the length is zero, this vector is set to zero vector.

    inlinenormalized():Vec3

    Returns the normalized vector.

    +

    If the length is zero, zero vector is returned.

    inlinescale(s:Float):Vec3

    Returns this * s.

    inlinescale3(sx:Float, sy:Float, sz:Float):Vec3

    Returns (this.x * sx, this.y * sy, this.z * sz).

    inlinescale3Eq(sx:Float, sy:Float, sz:Float):Vec3

    Sets this vector to (this.x * sx, this.y * sy, this.z * sz) and returns this.

    inlinescaleEq(s:Float):Vec3

    Sets this vector to this * s and returns this.

    inlinesub(v:Vec3):Vec3

    Returns this - v.

    inlinesub3(vx:Float, vy:Float, vz:Float):Vec3

    Returns (this.x - vx, this.y - vy, this.z - vz).

    inlinesub3Eq(vx:Float, vy:Float, vz:Float):Vec3

    Sets this vector to (this.x - vx, this.y - vy, this.z - vz) and returns this.

    inlinesubEq(v:Vec3):Vec3

    Sets this vector to this - v and returns this.

    toString():String

    Returns the string representation of the vector.

    zero():Vec3

    Sets this vector to zero vector and returns this.

    \ No newline at end of file diff --git a/docs/oimo/common/index.html b/docs/oimo/common/index.html index 6a0403e..095b55d 100644 --- a/docs/oimo/common/index.html +++ b/docs/oimo/common/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.common

    OimoPhysics API Documentation

    ..
    Mat3

    3x3 Matrix class.

    Mat4

    4x4 Matrix class.

    MathUtil

    This class provides mathematical operations for internal purposes.

    Pool

    The object pool system of Vec3, Mat3, Mat4, and Quat.

    Quat

    Quaternion class.

    Setting

    Setting provides advenced parameters used by the physics simulation.

    Transform

    Transform class provides a set of translation and rotation.

    Vec3

    3D vector class.

    \ No newline at end of file +

    oimo.common

    OimoPhysics API Documentation

    ..
    Mat3

    3x3 Matrix class.

    Mat4

    4x4 Matrix class.

    MathUtil

    This class provides mathematical operations for internal purposes.

    Pool

    The object pool system of Vec3, Mat3, Mat4, and Quat.

    Quat

    Quaternion class.

    Setting

    Setting provides advenced parameters used by the physics simulation.

    Transform

    Transform class provides a set of translation and rotation.

    Vec3

    3D vector class.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/Contact.html b/docs/oimo/dynamics/Contact.html index 141599e..ebcc347 100644 --- a/docs/oimo/dynamics/Contact.html +++ b/docs/oimo/dynamics/Contact.html @@ -7,9 +7,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A contact is a cached pair of overlapping shapes in the physics world. contacts +

    A contact is a cached pair of overlapping shapes in the physics world. contacts are created by ContactManager when two AABBs of shapes begin overlapping.

    As AABBs are larger than its shapes, shapes of a contact don't always -touching or colliding though their AABBs are overlapping.

    Methods

    inlinegetContactConstraint ():ContactConstraint

    Returns the contact constraint.

    inlinegetManifold ():Manifold

    Returns the contact manifold.

    inlinegetNext ():Contact

    Returns the next contact in the world.

    -

    If the next contact does not exist, null will be returned.

    inlinegetPrev ():Contact

    Returns the previous contact in the world.

    -

    If the previous contact does not exist, null will be returned.

    inlinegetShape1 ():Shape

    Returns the first shape of the contact.

    inlinegetShape2 ():Shape

    Returns the second shape of the contact.

    inlineisTouching ():Bool

    Returns whether the shapes are touching.

    \ No newline at end of file +touching or colliding though their AABBs are overlapping.

    Methods

    inlinegetContactConstraint():ContactConstraint

    Returns the contact constraint.

    inlinegetManifold():Manifold

    Returns the contact manifold.

    inlinegetNext():Contact

    Returns the next contact in the world.

    +

    If the next contact does not exist, null will be returned.

    inlinegetPrev():Contact

    Returns the previous contact in the world.

    +

    If the previous contact does not exist, null will be returned.

    inlinegetShape1():Shape

    Returns the first shape of the contact.

    inlinegetShape2():Shape

    Returns the second shape of the contact.

    inlineisTouching():Bool

    Returns whether the shapes are touching.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/ContactLink.html b/docs/oimo/dynamics/ContactLink.html index e69d9d9..8d555fa 100644 --- a/docs/oimo/dynamics/ContactLink.html +++ b/docs/oimo/dynamics/ContactLink.html @@ -8,9 +8,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A contact link is used to build a constraint graph for clustering rigid bodies. +

    A contact link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also JointLink.

    Methods

    inlinegetContact ():Contact

    Returns the contact of the link.

    inlinegetNext ():ContactLink

    Returns the next contact link in the rigid body.

    -

    If the next one does not exist, null will be returned.

    inlinegetOther ():RigidBody

    Returns the other rigid body of the link. This provides a quick access from a -rigid body to the other one of the contact.

    inlinegetPrev ():ContactLink

    Returns the previous contact link in the rigid body.

    -

    If the previous one does not exist, null will be returned.

    \ No newline at end of file +See also JointLink.

    Methods

    inlinegetContact():Contact

    Returns the contact of the link.

    inlinegetNext():ContactLink

    Returns the next contact link in the rigid body.

    +

    If the next one does not exist, null will be returned.

    inlinegetOther():RigidBody

    Returns the other rigid body of the link. This provides a quick access from a +rigid body to the other one of the contact.

    inlinegetPrev():ContactLink

    Returns the previous contact link in the rigid body.

    +

    If the previous one does not exist, null will be returned.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/ContactManager.html b/docs/oimo/dynamics/ContactManager.html index 5bb2c5a..a72ab2a 100644 --- a/docs/oimo/dynamics/ContactManager.html +++ b/docs/oimo/dynamics/ContactManager.html @@ -8,6 +8,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The manager of the contacts in the physics world. A contact of two +

    The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and -is destroyed when they end overlapping.

    Methods

    inlinegetContactList ():Contact

    Returns the linked list of the contacts in the world.

    inlinegetNumContacts ():Int

    Returns the number of the contacts in the world.

    \ No newline at end of file +is destroyed when they end overlapping.

    Methods

    inlinegetContactList():Contact

    Returns the linked list of the contacts in the world.

    inlinegetNumContacts():Int

    Returns the number of the contacts in the world.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/TimeStep.html b/docs/oimo/dynamics/TimeStep.html index 6335d91..bcbf56e 100644 --- a/docs/oimo/dynamics/TimeStep.html +++ b/docs/oimo/dynamics/TimeStep.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Information of time-step sizes of the simulation.

    Variables

    dt:Float

    The time step of simulation.

    dtRatio:Float

    The ratio of time steps. Defined by current time step divided by previous -time step.

    invDt:Float

    The inverse time step of simulation, equivalent to simulation FPS.

    \ No newline at end of file +

    Information of time-step sizes of the simulation.

    Variables

    dt:Float

    The time step of simulation.

    dtRatio:Float

    The ratio of time steps. Defined by current time step divided by previous +time step.

    invDt:Float

    The inverse time step of simulation, equivalent to simulation FPS.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/World.html b/docs/oimo/dynamics/World.html index f02cb47..bbb4c13 100644 --- a/docs/oimo/dynamics/World.html +++ b/docs/oimo/dynamics/World.html @@ -7,10 +7,10 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The physics simulation world. This manages entire the dynamic simulation. You can add -rigid bodies and joints to the world to simulate them.

    Constructor

    @:value({ gravity : null, broadPhaseType : BroadPhaseType._BVH })new (broadPhaseType:Int = BroadPhaseType._BVH, ?gravity:Vec3)

    Creates a new physics world, with broad-phase collision detection algorithm broadPhaseType and -gravitational acceleration gravity.

    Methods

    aabbTest (aabb:Aabb, callback:AabbTestCallback):Void

    Performs an AABB query. callback.process is called for all shapes that their -AABB and aabb intersect.

    addJoint (joint:Joint):Void

    Adds the joint joint to the simulation world.

    addRigidBody (rigidBody:RigidBody):Void

    Adds the rigid body rigidBody to the simulation world.

    convexCast (convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

    Performs a convex casting. callback.process is called for all shapes the convex geometry +

    The physics simulation world. This manages entire the dynamic simulation. You can add +rigid bodies and joints to the world to simulate them.

    Constructor

    @:value({ gravity : null, broadPhaseType : BroadPhaseType._BVH })new(broadPhaseType:Int = BroadPhaseType._BVH, ?gravity:Vec3)

    Creates a new physics world, with broad-phase collision detection algorithm broadPhaseType and +gravitational acceleration gravity.

    Methods

    aabbTest(aabb:Aabb, callback:AabbTestCallback):Void

    Performs an AABB query. callback.process is called for all shapes that their +AABB and aabb intersect.

    addJoint(joint:Joint):Void

    Adds the joint joint to the simulation world.

    addRigidBody(rigidBody:RigidBody):Void

    Adds the rigid body rigidBody to the simulation world.

    convexCast(convex:ConvexGeometry, begin:Transform, translation:Vec3, callback:RayCastCallback):Void

    Performs a convex casting. callback.process is called for all shapes the convex geometry convex hits. The convex geometry translates by translation starting from the beginning -transform begin.

    debugDraw ():Void

    Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

    inlinegetBroadPhase ():BroadPhase

    Returns the broad-phase collision detection algorithm.

    inlinegetContactManager ():ContactManager

    Returns the contact manager.

    inlinegetDebugDraw ():DebugDraw

    Returns the debug draw interface.

    inlinegetGravity ():Vec3

    Returns the gravitational acceleration of the simulation world.

    inlinegetJointList ():Joint

    Returns the list of the joints added to the world.

    inlinegetNumIslands ():Int

    Returns the number of simulation islands.

    inlinegetNumJoints ():Int

    Returns the number of the joints added to the world.

    inlinegetNumPositionIterations ():Int

    Returns the number of position iterations of constraint solvers.

    inlinegetNumRigidBodies ():Int

    Returns the number of the rigid bodies added to the world.

    inlinegetNumShapes ():Int

    Returns the number of the shapes added to the world.

    inlinegetNumVelocityIterations ():Int

    Returns the number of velocity iterations of constraint solvers.

    inlinegetRigidBodyList ():RigidBody

    Returns the list of the rigid bodies added to the world.

    rayCast (begin:Vec3, end:Vec3, callback:RayCastCallback):Void

    Performs a ray casting. callback.process is called for all shapes the ray -from begin to end hits.

    removeJoint (joint:Joint):Void

    Removes the joint joint from the simulation world.

    removeRigidBody (rigidBody:RigidBody):Void

    Removes the rigid body rigidBody from the simulation world.

    inlinesetDebugDraw (debugDraw:DebugDraw):Void

    Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

    inlinesetGravity (gravity:Vec3):Void

    Sets the gravitational acceleration of the simulation world to gravity.

    inlinesetNumPositionIterations (numPositionIterations:Int):Void

    Sets the number of position iterations of constraint solvers to numPositionIterations.

    inlinesetNumVelocityIterations (numVelocityIterations:Int):Void

    Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

    step (timeStep:Float):Void

    Advances the simulation by the time step timeStep.

    \ No newline at end of file +transform begin.

    debugDraw():Void

    Draws the simulation world for debugging. Call World.setDebugDraw to set the debug draw interface.

    inlinegetBroadPhase():BroadPhase

    Returns the broad-phase collision detection algorithm.

    inlinegetContactManager():ContactManager

    Returns the contact manager.

    inlinegetDebugDraw():DebugDraw

    Returns the debug draw interface.

    inlinegetGravity():Vec3

    Returns the gravitational acceleration of the simulation world.

    inlinegetJointList():Joint

    Returns the list of the joints added to the world.

    inlinegetNumIslands():Int

    Returns the number of simulation islands.

    inlinegetNumJoints():Int

    Returns the number of the joints added to the world.

    inlinegetNumPositionIterations():Int

    Returns the number of position iterations of constraint solvers.

    inlinegetNumRigidBodies():Int

    Returns the number of the rigid bodies added to the world.

    inlinegetNumShapes():Int

    Returns the number of the shapes added to the world.

    inlinegetNumVelocityIterations():Int

    Returns the number of velocity iterations of constraint solvers.

    inlinegetRigidBodyList():RigidBody

    Returns the list of the rigid bodies added to the world.

    rayCast(begin:Vec3, end:Vec3, callback:RayCastCallback):Void

    Performs a ray casting. callback.process is called for all shapes the ray +from begin to end hits.

    removeJoint(joint:Joint):Void

    Removes the joint joint from the simulation world.

    removeRigidBody(rigidBody:RigidBody):Void

    Removes the rigid body rigidBody from the simulation world.

    inlinesetDebugDraw(debugDraw:DebugDraw):Void

    Sets the debug draw interface to debugDraw. Call World.debugDraw to draw the simulation world.

    inlinesetGravity(gravity:Vec3):Void

    Sets the gravitational acceleration of the simulation world to gravity.

    inlinesetNumPositionIterations(numPositionIterations:Int):Void

    Sets the number of position iterations of constraint solvers to numPositionIterations.

    inlinesetNumVelocityIterations(numVelocityIterations:Int):Void

    Sets the number of velocity iterations of constraint solvers to numVelocityIterations.

    step(timeStep:Float):Void

    Advances the simulation by the time step timeStep.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/callback/AabbTestCallback.html b/docs/oimo/dynamics/callback/AabbTestCallback.html index 3b2ec79..b765232 100644 --- a/docs/oimo/dynamics/callback/AabbTestCallback.html +++ b/docs/oimo/dynamics/callback/AabbTestCallback.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A callback interface for aabb tests in a world.

    Constructor

    new ()

    Default constructor.

    Methods

    process (shape:Shape):Void

    This is called every time the world detects a shape shape that -the query aabb intersects.

    \ No newline at end of file +

    A callback interface for aabb tests in a world.

    Constructor

    new()

    Default constructor.

    Methods

    process(shape:Shape):Void

    This is called every time the world detects a shape shape that +the query aabb intersects.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/callback/ContactCallback.html b/docs/oimo/dynamics/callback/ContactCallback.html index 718d357..4249067 100644 --- a/docs/oimo/dynamics/callback/ContactCallback.html +++ b/docs/oimo/dynamics/callback/ContactCallback.html @@ -7,9 +7,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A callback class for contact events. Contact events between two shapes -will occur in following order:

    1. beginContact
    2. preSolve (before velocity update)
    3. postSolve (after velocity update)
    4. (repeats 2. and 3. every frame while the shapes are touching)
    5. endContact

    Constructor

    new ()

    Default constructor.

    Methods

    beginContact (c:Contact):Void

    This is called when two shapes start touching each other. c is the contact of -the two shapes.

    endContact (c:Contact):Void

    This is called when two shapes end touching each other. c is the contact of -the two shapes.

    postSolve (c:Contact):Void

    This is called every frame after velocity solver iterations while two shapes -are touching. c is the contact for the two shapes.

    preSolve (c:Contact):Void

    This is called every frame before velocity solver iterations while two shapes -are touching. c is the contact for the two shapes.

    \ No newline at end of file +

    A callback class for contact events. Contact events between two shapes +will occur in following order:

    1. beginContact
    2. preSolve (before velocity update)
    3. postSolve (after velocity update)
    4. (repeats 2. and 3. every frame while the shapes are touching)
    5. endContact

    Constructor

    new()

    Default constructor.

    Methods

    beginContact(c:Contact):Void

    This is called when two shapes start touching each other. c is the contact of +the two shapes.

    endContact(c:Contact):Void

    This is called when two shapes end touching each other. c is the contact of +the two shapes.

    postSolve(c:Contact):Void

    This is called every frame after velocity solver iterations while two shapes +are touching. c is the contact for the two shapes.

    preSolve(c:Contact):Void

    This is called every frame before velocity solver iterations while two shapes +are touching. c is the contact for the two shapes.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastCallback.html b/docs/oimo/dynamics/callback/RayCastCallback.html index fbb0659..6d66b7d 100644 --- a/docs/oimo/dynamics/callback/RayCastCallback.html +++ b/docs/oimo/dynamics/callback/RayCastCallback.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A callback class for ray casts in a world.

    Constructor

    new ()

    Default constructor.

    Methods

    process (shape:Shape, hit:RayCastHit):Void

    This is called every time the world detects a shape shape that -the ray intersects with the hit data hit.

    \ No newline at end of file +

    A callback class for ray casts in a world.

    Constructor

    new()

    Default constructor.

    Methods

    process(shape:Shape, hit:RayCastHit):Void

    This is called every time the world detects a shape shape that +the ray intersects with the hit data hit.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/callback/RayCastClosest.html b/docs/oimo/dynamics/callback/RayCastClosest.html index 0ee706a..bcd077e 100644 --- a/docs/oimo/dynamics/callback/RayCastClosest.html +++ b/docs/oimo/dynamics/callback/RayCastClosest.html @@ -8,6 +8,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A ray cast callback implementation that keeps only the closest hit data. +

    A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

    Constructor

    new ()

    Default constructor.

    Variables

    fraction:Float

    The ratio of the position the ray hit from the start point to the end point.

    hit:Bool

    Whether the ray hit any shape in the world.

    normal:Vec3

    The normal vector of the surface the ray hit.

    position:Vec3

    The position the ray hit at.

    shape:Shape

    The shape the ray hit.

    Methods

    inlineclear ():Void

    Clears the result data.

    Inherited Variables

    Inherited Methods

    \ No newline at end of file +RayCastClosest.clear if used once or more before.

    Constructor

    new()

    Default constructor.

    Variables

    fraction:Float

    The ratio of the position the ray hit from the start point to the end point.

    hit:Bool

    Whether the ray hit any shape in the world.

    normal:Vec3

    The normal vector of the surface the ray hit.

    position:Vec3

    The position the ray hit at.

    shape:Shape

    The shape the ray hit.

    Methods

    inlineclear():Void

    Clears the result data.

    Inherited Variables

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/callback/index.html b/docs/oimo/dynamics/callback/index.html index 1d91af4..961d500 100644 --- a/docs/oimo/dynamics/callback/index.html +++ b/docs/oimo/dynamics/callback/index.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.callback

    OimoPhysics API Documentation

    ..
    AabbTestCallback

    A callback interface for aabb tests in a world.

    ContactCallback

    A callback class for contact events. Contact events between two shapes +

    oimo.dynamics.callback

    OimoPhysics API Documentation

    ..
    AabbTestCallback

    A callback interface for aabb tests in a world.

    ContactCallback

    A callback class for contact events. Contact events between two shapes will occur in following order:

    RayCastCallback

    A callback class for ray casts in a world.

    RayCastClosest

    A ray cast callback implementation that keeps only the closest hit data. This is reusable, but make sure to clear the old result by calling -RayCastClosest.clear if used once or more before.

    \ No newline at end of file +RayCastClosest.clear if used once or more before.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDraw.html b/docs/oimo/dynamics/common/DebugDraw.html index e3e2104..a5b46cd 100644 --- a/docs/oimo/dynamics/common/DebugDraw.html +++ b/docs/oimo/dynamics/common/DebugDraw.html @@ -8,16 +8,16 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The interface of debug drawer. This provides graphical information of a physics world +

    The interface of debug drawer. This provides graphical information of a physics world for debugging softwares. Users should override at least three methods DebugDraw.point, -DebugDraw.triangle, DebugDraw.line.

    Constructor

    new ()

    Default constructor.

    Variables

    drawAabbs:Bool

    Whether to draw the AABBs.

    drawBases:Bool

    Whether to draw the bases of the rigid bodies.

    drawBvh:Bool

    Whether to draw the bounding volume hierarchy of the broad-phase collision +DebugDraw.triangle, DebugDraw.line.

    Constructor

    new()

    Default constructor.

    Variables

    drawAabbs:Bool

    Whether to draw the AABBs.

    drawBases:Bool

    Whether to draw the bases of the rigid bodies.

    drawBvh:Bool

    Whether to draw the bounding volume hierarchy of the broad-phase collision detection. If BvhBroadPhase is not used, nothing will be drawn regardless -of the value of this parameter.

    drawBvhMaxLevel:Int

    The maximum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to -false, the entire BVH will not be drawn.

    drawBvhMinLevel:Int

    The minimum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to -false, the entire BVH will not be drawn.

    drawContactBases:Bool

    Whether to draw the bases (normals, tangents, and binormals) of the contacts.

    drawContacts:Bool

    Whether to draw the contacts.

    drawJointLimits:Bool

    Whether to draw the limits of the joints.

    drawJoints:Bool

    Whether to draw the joints.

    drawPairs:Bool

    Whether to draw the overlapping pairs of the AABBs.

    drawShapes:Bool

    Whether to draw the shapes.

    style:DebugDrawStyle

    The rendering style of the debug draw.

    wireframe:Bool

    Whether the shapes are drawn in wireframe mode.

    Methods

    aabb (min:Vec3, max:Vec3, color:Vec3):Void

    Draws an axis-aligned bounding box.

    +of the value of this parameter.

    drawBvhMaxLevel:Int

    The maximum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to +false, the entire BVH will not be drawn.

    drawBvhMinLevel:Int

    The minimum depth of the BVH to be drawn. If DebugDrawer.drawBvh is set to +false, the entire BVH will not be drawn.

    drawContactBases:Bool

    Whether to draw the bases (normals, tangents, and binormals) of the contacts.

    drawContacts:Bool

    Whether to draw the contacts.

    drawJointLimits:Bool

    Whether to draw the limits of the joints.

    drawJoints:Bool

    Whether to draw the joints.

    drawPairs:Bool

    Whether to draw the overlapping pairs of the AABBs.

    drawShapes:Bool

    Whether to draw the shapes.

    style:DebugDrawStyle

    The rendering style of the debug draw.

    wireframe:Bool

    Whether the shapes are drawn in wireframe mode.

    Methods

    aabb(min:Vec3, max:Vec3, color:Vec3):Void

    Draws an axis-aligned bounding box.

    min is the minimum point of the AABB.

    max is the maximum point of the AABB.

    -

    color is the color of the AABB.

    arc (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, startAngle:Float, endAngle:Float, drawSector:Bool, color:Vec3):Void

    Draws an arc.

    +

    color is the color of the AABB.

    arc(center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, startAngle:Float, endAngle:Float, drawSector:Bool, color:Vec3):Void

    Draws an arc.

    center is the center of the arc.

    ex is the normalized x-axis vector of the arc.

    ey is the normalized y-axis vector of the arc.

    @@ -26,42 +26,42 @@

    startAngle is the start angle of the arc in radians.

    endAngle is the end angle of the arc in radians.

    drawSector is whether to draw line segments between start/end point and center point.

    -

    color is the color of the arc.

    basis (transform:Transform, length:Float, colorX:Vec3, colorY:Vec3, colorZ:Vec3):Void

    Draws the basis of a transform transform.

    +

    color is the color of the arc.

    basis(transform:Transform, length:Float, colorX:Vec3, colorY:Vec3, colorZ:Vec3):Void

    Draws the basis of a transform transform.

    length is the length of the lines to be drawn.

    colorX is the color of the x-axis of the basis.

    colorY is the color of the y-axis of the basis.

    -

    colorZ is the color of the z-axis of the basis.

    box (tf:Transform, halfExtents:Vec3, color:Vec3):Void

    Draws a box.

    +

    colorZ is the color of the z-axis of the basis.

    box(tf:Transform, halfExtents:Vec3, color:Vec3):Void

    Draws a box.

    tf is the transformation of the box.

    halfExtents is the half-extents of the box.

    -

    color is the color of the box.

    capsule (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a capsule locally along to the y-axis.

    +

    color is the color of the box.

    capsule(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a capsule locally along to the y-axis.

    tf is the transformation of the capsule.

    radius is the radius of the capsule.

    halfHeight is the half-height of the capsule.

    -

    color is the color of the capsule.

    cone (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a cone locally along to the y-axis. The center of the cone is in the middle of +

    color is the color of the capsule.

    cone(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a cone locally along to the y-axis. The center of the cone is in the middle of the vertex and the center of the base circle.

    tf is the transformation of the cone.

    radius is the radius of the base circle of the cone.

    halfHeight is the half-height of the cone. The local position of the vertex of the cone is (0, halfHeight, 0).

    -

    color is the color of the cone.

    cylinder (tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a cylinder locally along to the y-axis.

    +

    color is the color of the cone.

    cylinder(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void

    Draws a cylinder locally along to the y-axis.

    tf is the transformation of the cylinder.

    radius is the radius of the cylinder.

    halfHeight is the half-height of the cylinder.

    -

    color is the color of the cylinder.

    ellipse (center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, color:Vec3):Void

    Draws an ellipse.

    +

    color is the color of the cylinder.

    ellipse(center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, color:Vec3):Void

    Draws an ellipse.

    center is the center of the ellipse.

    ex is the normalized x-axis vector of the ellipse.

    ey is the normalized y-axis vector of the ellipse.

    radiusX is the radius along the x-axis of the ellipse.

    radiusY is the radius along the y-axis of the ellipse.

    -

    color is the color of the ellipse.

    line (v1:Vec3, v2:Vec3, color:Vec3):Void

    Draws a line segment between v1 and v2.

    -

    color is the color of the line segment.

    point (v:Vec3, color:Vec3):Void

    Draws a point at v.

    -

    color is the color of the point.

    rect (v1:Vec3, v2:Vec3, v3:Vec3, v4:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, n4:Vec3, color:Vec3):Void

    Draws a rectangle.

    +

    color is the color of the ellipse.

    line(v1:Vec3, v2:Vec3, color:Vec3):Void

    Draws a line segment between v1 and v2.

    +

    color is the color of the line segment.

    point(v:Vec3, color:Vec3):Void

    Draws a point at v.

    +

    color is the color of the point.

    rect(v1:Vec3, v2:Vec3, v3:Vec3, v4:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, n4:Vec3, color:Vec3):Void

    Draws a rectangle.

    v1, v2, v3, v4 are the rectangle's vertices in CCW order.

    n1, n2, n3, n4 are the normals of the rectangle's vertices in CCW order.

    -

    color is the color of the rectangle.

    sphere (tf:Transform, radius:Float, color:Vec3):Void

    Draws a sphere.

    +

    color is the color of the rectangle.

    sphere(tf:Transform, radius:Float, color:Vec3):Void

    Draws a sphere.

    tf is the transformation of the sphere.

    radius is the radius of the sphere.

    -

    color is the color of the sphere.

    triangle (v1:Vec3, v2:Vec3, v3:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, color:Vec3):Void

    Draws a triangle.

    +

    color is the color of the sphere.

    triangle(v1:Vec3, v2:Vec3, v3:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, color:Vec3):Void

    Draws a triangle.

    v1, v2, v3 are the triangle's vertices in CCW order.

    n1, n2, n3 are the normals of the triangle's vertices in CCW order.

    -

    color is the color of the triangle.

    \ No newline at end of file +

    color is the color of the triangle.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/common/DebugDrawStyle.html b/docs/oimo/dynamics/common/DebugDrawStyle.html index 769472f..2470f08 100644 --- a/docs/oimo/dynamics/common/DebugDrawStyle.html +++ b/docs/oimo/dynamics/common/DebugDrawStyle.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Style settings of the debug draw.

    Constructor

    new ()

    Default constructor.

    Variables

    @:value(new Vec3(1.0, 0.1, 0.1))aabbColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.0, 0.0))basisColorX:Vec3 = new Vec3(1.0, 0.0, 0.0)

    @:value(new Vec3(0.0, 1.0, 0.0))basisColorY:Vec3 = new Vec3(0.0, 1.0, 0.0)

    @:value(new Vec3(0.0, 0.0, 1.0))basisColorZ:Vec3 = new Vec3(0.0, 0.0, 1.0)

    @:value(0.5)basisLength:Float = 0.5

    @:value(new Vec3(0.4, 0.4, 0.4))bvhNodeColor:Vec3 = new Vec3(0.4, 0.4, 0.4)

    @:value(new Vec3(0.2, 0.2, 1.0))contactBinormalColor:Vec3 = new Vec3(0.2, 0.2, 1.0)

    @:value(0.5)contactBinormalLength:Float = 0.5

    @:value(new Vec3(1.0, 0.1, 0.1))contactColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.6, 0.1))contactColor2:Vec3 = new Vec3(1.0, 0.6, 0.1)

    @:value(new Vec3(0.1, 0.8, 0.6))contactColor3:Vec3 = new Vec3(0.1, 0.8, 0.6)

    @:value(new Vec3(0.8, 0.1, 1.0))contactColor4:Vec3 = new Vec3(0.8, 0.1, 1.0)

    @:value(new Vec3(1.0, 0.1, 0.1))contactNormalColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(0.5)contactNormalLength:Float = 0.5

    @:value(new Vec3(0.1, 0.8, 0.1))contactTangentColor:Vec3 = new Vec3(0.1, 0.8, 0.1)

    @:value(0.5)contactTangentLength:Float = 0.5

    @:value(new Vec3(0.5, 0.1, 0.1))disabledContactColor:Vec3 = new Vec3(0.5, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.1, 0.1))jointErrorColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(0.8, 0.8, 0.8))jointLineColor:Vec3 = new Vec3(0.8, 0.8, 0.8)

    @:value(0.3)jointRotationalConstraintRadius:Float = 0.3

    @:value(new Vec3(1.0, 0.5, 0.1))kinematicShapeColor:Vec3 = new Vec3(1.0, 0.5, 0.1)

    @:value(new Vec3(1.0, 1.0, 0.1))newContactColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

    @:value(new Vec3(1.0, 1.0, 0.1))pairColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

    @:value(new Vec3(0.7, 0.2, 0.4))shapeColor1:Vec3 = new Vec3(0.7, 0.2, 0.4)

    @:value(new Vec3(1.0, 0.8, 0.1))shapeColor2:Vec3 = new Vec3(1.0, 0.8, 0.1)

    @:value(new Vec3(0.3, 0.3, 0.8))sleepingShapeColor1:Vec3 = new Vec3(0.3, 0.3, 0.8)

    @:value(new Vec3(0.2, 0.8, 0.5))sleepingShapeColor2:Vec3 = new Vec3(0.2, 0.8, 0.5)

    @:value(new Vec3(0.5, 0.25, 0.6))sleepyShapeColor1:Vec3 = new Vec3(0.5, 0.25, 0.6)

    @:value(new Vec3(0.6, 0.8, 0.3))sleepyShapeColor2:Vec3 = new Vec3(0.6, 0.8, 0.3)

    @:value(new Vec3(0.7, 0.7, 0.7))staticShapeColor:Vec3 = new Vec3(0.7, 0.7, 0.7)

    \ No newline at end of file +

    Style settings of the debug draw.

    Constructor

    new()

    Default constructor.

    Variables

    @:value(new Vec3(1.0, 0.1, 0.1))aabbColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.0, 0.0))basisColorX:Vec3 = new Vec3(1.0, 0.0, 0.0)

    @:value(new Vec3(0.0, 1.0, 0.0))basisColorY:Vec3 = new Vec3(0.0, 1.0, 0.0)

    @:value(new Vec3(0.0, 0.0, 1.0))basisColorZ:Vec3 = new Vec3(0.0, 0.0, 1.0)

    @:value(0.5)basisLength:Float = 0.5

    @:value(new Vec3(0.4, 0.4, 0.4))bvhNodeColor:Vec3 = new Vec3(0.4, 0.4, 0.4)

    @:value(new Vec3(0.2, 0.2, 1.0))contactBinormalColor:Vec3 = new Vec3(0.2, 0.2, 1.0)

    @:value(0.5)contactBinormalLength:Float = 0.5

    @:value(new Vec3(1.0, 0.1, 0.1))contactColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.6, 0.1))contactColor2:Vec3 = new Vec3(1.0, 0.6, 0.1)

    @:value(new Vec3(0.1, 0.8, 0.6))contactColor3:Vec3 = new Vec3(0.1, 0.8, 0.6)

    @:value(new Vec3(0.8, 0.1, 1.0))contactColor4:Vec3 = new Vec3(0.8, 0.1, 1.0)

    @:value(new Vec3(1.0, 0.1, 0.1))contactNormalColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(0.5)contactNormalLength:Float = 0.5

    @:value(new Vec3(0.1, 0.8, 0.1))contactTangentColor:Vec3 = new Vec3(0.1, 0.8, 0.1)

    @:value(0.5)contactTangentLength:Float = 0.5

    @:value(new Vec3(0.5, 0.1, 0.1))disabledContactColor:Vec3 = new Vec3(0.5, 0.1, 0.1)

    @:value(new Vec3(1.0, 0.1, 0.1))jointErrorColor:Vec3 = new Vec3(1.0, 0.1, 0.1)

    @:value(new Vec3(0.8, 0.8, 0.8))jointLineColor:Vec3 = new Vec3(0.8, 0.8, 0.8)

    @:value(0.3)jointRotationalConstraintRadius:Float = 0.3

    @:value(new Vec3(1.0, 0.5, 0.1))kinematicShapeColor:Vec3 = new Vec3(1.0, 0.5, 0.1)

    @:value(new Vec3(1.0, 1.0, 0.1))newContactColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

    @:value(new Vec3(1.0, 1.0, 0.1))pairColor:Vec3 = new Vec3(1.0, 1.0, 0.1)

    @:value(new Vec3(0.7, 0.2, 0.4))shapeColor1:Vec3 = new Vec3(0.7, 0.2, 0.4)

    @:value(new Vec3(1.0, 0.8, 0.1))shapeColor2:Vec3 = new Vec3(1.0, 0.8, 0.1)

    @:value(new Vec3(0.3, 0.3, 0.8))sleepingShapeColor1:Vec3 = new Vec3(0.3, 0.3, 0.8)

    @:value(new Vec3(0.2, 0.8, 0.5))sleepingShapeColor2:Vec3 = new Vec3(0.2, 0.8, 0.5)

    @:value(new Vec3(0.5, 0.25, 0.6))sleepyShapeColor1:Vec3 = new Vec3(0.5, 0.25, 0.6)

    @:value(new Vec3(0.6, 0.8, 0.3))sleepyShapeColor2:Vec3 = new Vec3(0.6, 0.8, 0.3)

    @:value(new Vec3(0.7, 0.7, 0.7))staticShapeColor:Vec3 = new Vec3(0.7, 0.7, 0.7)

    \ No newline at end of file diff --git a/docs/oimo/dynamics/common/Performance.html b/docs/oimo/dynamics/common/Performance.html index 1af0256..a56a314 100644 --- a/docs/oimo/dynamics/common/Performance.html +++ b/docs/oimo/dynamics/common/Performance.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Performance

    Static variables

    @:value(0)staticbroadPhaseCollisionTime:Float = 0

    @:value(0)staticdynamicsTime:Float = 0

    @:value(0)staticnarrowPhaseCollisionTime:Float = 0

    @:value(0)statictotalTime:Float = 0

    \ No newline at end of file +

    Performance

    Static variables

    @:value(0)staticbroadPhaseCollisionTime:Float = 0

    @:value(0)staticdynamicsTime:Float = 0

    @:value(0)staticnarrowPhaseCollisionTime:Float = 0

    @:value(0)statictotalTime:Float = 0

    \ No newline at end of file diff --git a/docs/oimo/dynamics/common/index.html b/docs/oimo/dynamics/common/index.html index 38a2c26..2b3618a 100644 --- a/docs/oimo/dynamics/common/index.html +++ b/docs/oimo/dynamics/common/index.html @@ -6,6 +6,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.common

    OimoPhysics API Documentation

    ..
    DebugDraw

    The interface of debug drawer. This provides graphical information of a physics world +

    oimo.dynamics.common

    OimoPhysics API Documentation

    ..
    DebugDraw

    The interface of debug drawer. This provides graphical information of a physics world for debugging softwares. Users should override at least three methods DebugDraw.point, -DebugDraw.triangle, DebugDraw.line.

    DebugDrawStyle

    Style settings of the debug draw.

    Performance

    Performance

    \ No newline at end of file +DebugDraw.triangle, DebugDraw.line.

    DebugDrawStyle

    Style settings of the debug draw.

    Performance

    Performance

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/ConstraintSolver.html b/docs/oimo/dynamics/constraint/ConstraintSolver.html index aeab641..563c688 100644 --- a/docs/oimo/dynamics/constraint/ConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/ConstraintSolver.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The base class of all constarint solvers.

    Methods

    postSolve ():Void

    Performs post-processes.

    postSolveVelocity (timeStep:TimeStep):Void

    Performs post-processes of velocity part. Time step information timeStep is given -for computing time-depending data.

    preSolvePosition (timeStep:TimeStep):Void

    Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step +

    The base class of all constarint solvers.

    Methods

    postSolve():Void

    Performs post-processes.

    postSolveVelocity(timeStep:TimeStep):Void

    Performs post-processes of velocity part. Time step information timeStep is given +for computing time-depending data.

    preSolvePosition(timeStep:TimeStep):Void

    Prepares for position iteration (split impulse or nonlinear Gauss-Seidel). Time step information timeStep is given for computing time-depending data.

    -

    This may not be called depending on position correction algorithm.

    preSolveVelocity (timeStep:TimeStep):Void

    Prepares for velocity iteration. Time step information timeStep is given for -computing time-depending data.

    solvePositionNgs (timeStep:TimeStep):Void

    Performs single position iteration (nonlinear Gauss-Seidel)

    solvePositionSplitImpulse ():Void

    Performs single position iteration (split impulse)

    solveVelocity ():Void

    Performs single velocity iteration.

    warmStart (timeStep:TimeStep):Void

    Applies initial impulses.

    \ No newline at end of file +

    This may not be called depending on position correction algorithm.

    preSolveVelocity(timeStep:TimeStep):Void

    Prepares for velocity iteration. Time step information timeStep is given for +computing time-depending data.

    solvePositionNgs(timeStep:TimeStep):Void

    Performs single position iteration (nonlinear Gauss-Seidel)

    solvePositionSplitImpulse():Void

    Performs single position iteration (split impulse)

    solveVelocity():Void

    Performs single velocity iteration.

    warmStart(timeStep:TimeStep):Void

    Applies initial impulses.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html index fb565a3..97c7346 100644 --- a/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html +++ b/docs/oimo/dynamics/constraint/PositionCorrectionAlgorithm.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of the algorithms for position corretion.

    Static variables

    @:value(_BAUMGARTE)staticread onlyBAUMGARTE:Int = _BAUMGARTE

    Baumgarte stabilizaiton. Fastest but introduces extra energy.

    @:value(_NGS)staticread onlyNGS:Int = _NGS

    Nonlinear Gauss-Seidel method. Slow but stable.

    @:value(_SPLIT_IMPULSE)staticread onlySPLIT_IMPULSE:Int = _SPLIT_IMPULSE

    Use split impulse and pseudo velocity. Fast enough and does not introduce extra -energy, but somewhat unstable, especially for joints.

    \ No newline at end of file +

    The list of the algorithms for position corretion.

    Static variables

    @:value(_BAUMGARTE)staticread onlyBAUMGARTE:Int = _BAUMGARTE

    Baumgarte stabilizaiton. Fastest but introduces extra energy.

    @:value(_NGS)staticread onlyNGS:Int = _NGS

    Nonlinear Gauss-Seidel method. Slow but stable.

    @:value(_SPLIT_IMPULSE)staticread onlySPLIT_IMPULSE:Int = _SPLIT_IMPULSE

    Use split impulse and pseudo velocity. Fast enough and does not introduce extra +energy, but somewhat unstable, especially for joints.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html index 713fa61..7f02f32 100644 --- a/docs/oimo/dynamics/constraint/contact/ContactConstraint.html +++ b/docs/oimo/dynamics/constraint/contact/ContactConstraint.html @@ -8,6 +8,6 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A contact constraint provides collision information for a contact constraint solver. +

    A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and -contact impulses. See Manifold for more information.

    Methods

    inlinegetManifold ():Manifold

    Returns the contact manifold.

    inlinegetShape1 ():Shape

    Returns the first shape of the contact.

    inlinegetShape2 ():Shape

    Returns the second shape of the contact.

    isTouching ():Bool

    Returns whether the two rigid bodies are touching.

    \ No newline at end of file +contact impulses. See Manifold for more information.

    Methods

    inlinegetManifold():Manifold

    Returns the contact manifold.

    inlinegetShape1():Shape

    Returns the first shape of the contact.

    inlinegetShape2():Shape

    Returns the second shape of the contact.

    isTouching():Bool

    Returns whether the two rigid bodies are touching.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/Manifold.html b/docs/oimo/dynamics/constraint/contact/Manifold.html index 92f985f..372af96 100644 --- a/docs/oimo/dynamics/constraint/contact/Manifold.html +++ b/docs/oimo/dynamics/constraint/contact/Manifold.html @@ -6,15 +6,15 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A contact manifold holds collision data of a pair of shapes.

    Methods

    inlinegetBinormal ():Vec3

    Returns the binormal vector of the contact manifold. The binormal vector has unit -length and is perpendicular to both the normal and the tangent vector.

    inlinegetBinormalTo (binormal:Vec3):Void

    Sets binormal to the binormal vector of the contact manifold. The binormal vector has +

    A contact manifold holds collision data of a pair of shapes.

    Methods

    inlinegetBinormal():Vec3

    Returns the binormal vector of the contact manifold. The binormal vector has unit +length and is perpendicular to both the normal and the tangent vector.

    inlinegetBinormalTo(binormal:Vec3):Void

    Sets binormal to the binormal vector of the contact manifold. The binormal vector has unit length and is perpendicular to both the normal and the tangent vector.

    -

    This does not create a new instance of Vec3.

    inlinegetNormal ():Vec3

    Returns the normal vector of the contact manifold. The normal vector has unit -length and is perpendicular to the contact plane.

    inlinegetNormalTo (normal:Vec3):Void

    Sets normal to the normal vector of the contact manifold. The normal vector has +

    This does not create a new instance of Vec3.

    inlinegetNormal():Vec3

    Returns the normal vector of the contact manifold. The normal vector has unit +length and is perpendicular to the contact plane.

    inlinegetNormalTo(normal:Vec3):Void

    Sets normal to the normal vector of the contact manifold. The normal vector has unit length and is perpendicular to the contact plane.

    -

    This does not create a new instance of Vec3.

    inlinegetNumPoints ():Int

    Returns the number of existing manifold points.

    inlinegetPoints ():Vector<ManifoldPoint>

    Returns the manifold point vector of the contact manifold. Note that only the first +

    This does not create a new instance of Vec3.

    inlinegetNumPoints():Int

    Returns the number of existing manifold points.

    inlinegetPoints():Vector<ManifoldPoint>

    Returns the manifold point vector of the contact manifold. Note that only the first Manifold.getNumPoints elements of the vector are in use, and the manifold points may -be disabled (see ManifoldPoint.isEnabled).

    inlinegetTangent ():Vec3

    Returns the tangent vector of the contact manifold. The tangent vector has unit -length and is perpendicular to the normal vector.

    inlinegetTangentTo (tangent:Vec3):Void

    Sets tangent to the tangent vector of the contact manifold. The tangent vector has +be disabled (see ManifoldPoint.isEnabled).

    inlinegetTangent():Vec3

    Returns the tangent vector of the contact manifold. The tangent vector has unit +length and is perpendicular to the normal vector.

    inlinegetTangentTo(tangent:Vec3):Void

    Sets tangent to the tangent vector of the contact manifold. The tangent vector has unit length and is perpendicular to the normal vector.

    -

    This does not create a new instance of Vec3.

    \ No newline at end of file +

    This does not create a new instance of Vec3.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html index 6046e5a..83a8dc8 100644 --- a/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html +++ b/docs/oimo/dynamics/constraint/contact/ManifoldPoint.html @@ -7,8 +7,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A manifold point is a contact point in a contact manifold. This holds detailed collision -data (position, overlap depth, impulse, etc...) for collision response.

    Methods

    inlinegetBinormalImpulse ():Float

    Returns the binormal impulse of the manifold point.

    inlinegetDepth ():Float

    Returns the amount of the overlap. If the manifold point is separate, a negative -value is returned.

    inlinegetNormalImpulse ():Float

    Returns the normal impulse of the manifold point.

    inlinegetPosition1 ():Vec3

    Returns the first rigid body's manifold point in world coordinate.

    inlinegetPosition1To (position:Vec3):Void

    Sets position to the first rigid body's manifold point in world coordinate. -This does not create a new instance of Vec3.

    inlinegetPosition2 ():Vec3

    Returns the second rigid body's manifold point in world coordinate.

    inlinegetPosition2To (position:Vec3):Void

    Sets position to the second rigid body's manifold point in world coordinate. -This does not create a new instance of Vec3.

    inlinegetTangentImpulse ():Float

    Returns the tangent impulse of the manifold point.

    inlineisEnabled ():Bool

    Returns whether the manifold point is enabled.

    inlineisWarmStarted ():Bool

    Returns whether the manifold point has existed for more than two steps.

    \ No newline at end of file +

    A manifold point is a contact point in a contact manifold. This holds detailed collision +data (position, overlap depth, impulse, etc...) for collision response.

    Methods

    inlinegetBinormalImpulse():Float

    Returns the binormal impulse of the manifold point.

    inlinegetDepth():Float

    Returns the amount of the overlap. If the manifold point is separate, a negative +value is returned.

    inlinegetNormalImpulse():Float

    Returns the normal impulse of the manifold point.

    inlinegetPosition1():Vec3

    Returns the first rigid body's manifold point in world coordinate.

    inlinegetPosition1To(position:Vec3):Void

    Sets position to the first rigid body's manifold point in world coordinate. +This does not create a new instance of Vec3.

    inlinegetPosition2():Vec3

    Returns the second rigid body's manifold point in world coordinate.

    inlinegetPosition2To(position:Vec3):Void

    Sets position to the second rigid body's manifold point in world coordinate. +This does not create a new instance of Vec3.

    inlinegetTangentImpulse():Float

    Returns the tangent impulse of the manifold point.

    inlineisEnabled():Bool

    Returns whether the manifold point is enabled.

    inlineisWarmStarted():Bool

    Returns whether the manifold point has existed for more than two steps.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/contact/index.html b/docs/oimo/dynamics/constraint/contact/index.html index a71c08e..b8ed503 100644 --- a/docs/oimo/dynamics/constraint/contact/index.html +++ b/docs/oimo/dynamics/constraint/contact/index.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint.contact

    OimoPhysics API Documentation

    ..
    ContactConstraint

    A contact constraint provides collision information for a contact constraint solver. +

    oimo.dynamics.constraint.contact

    OimoPhysics API Documentation

    ..
    ContactConstraint

    A contact constraint provides collision information for a contact constraint solver. This holds a contact manifold, which has some contact points, contact normals, and contact impulses. See Manifold for more information.

    Manifold

    A contact manifold holds collision data of a pair of shapes.

    ManifoldPoint

    A manifold point is a contact point in a contact manifold. This holds detailed collision -data (position, overlap depth, impulse, etc...) for collision response.

    \ No newline at end of file +data (position, overlap depth, impulse, etc...) for collision response.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/index.html b/docs/oimo/dynamics/constraint/index.html index 1d1abb4..41ca69a 100644 --- a/docs/oimo/dynamics/constraint/index.html +++ b/docs/oimo/dynamics/constraint/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint

    OimoPhysics API Documentation

    ..
    contact
    joint
    solver
    ConstraintSolver

    The base class of all constarint solvers.

    PositionCorrectionAlgorithm

    The list of the algorithms for position corretion.

    \ No newline at end of file +

    oimo.dynamics.constraint

    OimoPhysics API Documentation

    ..
    contact
    joint
    solver
    ConstraintSolver

    The base class of all constarint solvers.

    PositionCorrectionAlgorithm

    The list of the algorithms for position corretion.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html index 96ef856..c74efe8 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJoint.html @@ -10,29 +10,29 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A cylindrical joint constrains two rigid bodies to share their constraint +

    A cylindrical joint constrains two rigid bodies to share their constraint axes, and restricts relative translation and rotation onto the constraint axis. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects of both translation and -rotation part of the constraint.

    Constructor

    new (config:CylindricalJointConfig)

    Creates a new cylindrical joint by configuration config.

    Methods

    inlinegetAngle ():Float

    Returns the rotation angle in radians.

    inlinegetAxis1 ():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAxis2 ():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis1 ():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2 ():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetRotationalLimitMotor ():RotationalLimitMotor

    Returns the rotational limits and motor settings.

    inlinegetRotationalSpringDamper ():SpringDamper

    Returns the rotational spring and damper settings.

    inlinegetTranslation ():Float

    Returns the translation of the joint.

    inlinegetTranslationalLimitMotor ():TranslationalLimitMotor

    Returns the translational limits and motor settings.

    inlinegetTranslationalSpringDamper ():SpringDamper

    Returns the translational spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +rotation part of the constraint.

    Constructor

    new(config:CylindricalJointConfig)

    Creates a new cylindrical joint by configuration config.

    Methods

    inlinegetAngle():Float

    Returns the rotation angle in radians.

    inlinegetAxis1():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAxis2():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis1():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetRotationalLimitMotor():RotationalLimitMotor

    Returns the rotational limits and motor settings.

    inlinegetRotationalSpringDamper():SpringDamper

    Returns the rotational spring and damper settings.

    inlinegetTranslation():Float

    Returns the translation of the joint.

    inlinegetTranslationalLimitMotor():TranslationalLimitMotor

    Returns the translational limits and motor settings.

    inlinegetTranslationalSpringDamper():SpringDamper

    Returns the translational spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html index 4a091ea..e01a585 100644 --- a/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/CylindricalJointConfig.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A cylindrical joint config is used for constructions of cylindrical joints.

    Constructor

    new ()

    Default constructor.

    Variables

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    rotationalLimitMotor:RotationalLimitMotor

    The rotational limit and motor along the constraint axis of the joint.

    rotationalSpringDamper:SpringDamper

    The rotational spring and damper along the constraint axis of the joint.

    translationalLimitMotor:TranslationalLimitMotor

    The translational limit and motor along the constraint axis of the joint.

    translationalSpringDamper:SpringDamper

    The translational spring and damper along constraint the axis of the joint.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):CylindricalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A cylindrical joint config is used for constructions of cylindrical joints.

    Constructor

    new()

    Default constructor.

    Variables

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    rotationalLimitMotor:RotationalLimitMotor

    The rotational limit and motor along the constraint axis of the joint.

    rotationalSpringDamper:SpringDamper

    The rotational spring and damper along the constraint axis of the joint.

    translationalLimitMotor:TranslationalLimitMotor

    The translational limit and motor along the constraint axis of the joint.

    translationalSpringDamper:SpringDamper

    The translational spring and damper along constraint the axis of the joint.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):CylindricalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJoint.html b/docs/oimo/dynamics/constraint/joint/GenericJoint.html index 5df0f17..5a85346 100644 --- a/docs/oimo/dynamics/constraint/joint/GenericJoint.html +++ b/docs/oimo/dynamics/constraint/joint/GenericJoint.html @@ -10,25 +10,25 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in +

    A generic joint (a.k.a. 6-DoF joint) constrains two rigid bodies in highly flexible way, so that every translational and rotational axis can be locked, unlocked, springy, or powered by a motor like other joints. Note that rotation angles are measured as x-y-z Euler angles, -not as z-x-z Euler angles.

    Constructor

    new (config:GenericJointConfig)

    Creates a new generic joint by configuration config.

    Methods

    inlinegetAngles ():Vec3

    Returns the relative x-y-z Euler angles.

    inlinegetAxisX ():Vec3

    Returns the first (x) rotation axis of the relative Euler angles.

    inlinegetAxisY ():Vec3

    Returns the second (y) rotation axis of the relative Euler angles.

    inlinegetAxisZ ():Vec3

    Returns the third (z) rotation axis of the relative Euler angles.

    inlinegetRotationalLimitMotors ():Array<RotationalLimitMotor>

    Returns the rotational limits and motor settings along the rotation axes of the relative x-y-z Euler angles.

    inlinegetRotationalSpringDampers ():Array<SpringDamper>

    Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles.

    inlinegetTranslationalLimitMotors ():Array<TranslationalLimitMotor>

    Returns the translational limits and motor settings along the first body's constraint basis.

    inlinegetTranslationalSpringDampers ():Array<SpringDamper>

    Returns the translational spring and damper settings along the first body's constraint basis.

    inlinegetTranslations ():Vec3

    Returns the translations along the first rigid body's constraint basis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +not as z-x-z Euler angles.

    Constructor

    new(config:GenericJointConfig)

    Creates a new generic joint by configuration config.

    Methods

    inlinegetAngles():Vec3

    Returns the relative x-y-z Euler angles.

    inlinegetAxisX():Vec3

    Returns the first (x) rotation axis of the relative Euler angles.

    inlinegetAxisY():Vec3

    Returns the second (y) rotation axis of the relative Euler angles.

    inlinegetAxisZ():Vec3

    Returns the third (z) rotation axis of the relative Euler angles.

    inlinegetRotationalLimitMotors():Array<RotationalLimitMotor>

    Returns the rotational limits and motor settings along the rotation axes of the relative x-y-z Euler angles.

    inlinegetRotationalSpringDampers():Array<SpringDamper>

    Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles.

    inlinegetTranslationalLimitMotors():Array<TranslationalLimitMotor>

    Returns the translational limits and motor settings along the first body's constraint basis.

    inlinegetTranslationalSpringDampers():Array<SpringDamper>

    Returns the translational spring and damper settings along the first body's constraint basis.

    inlinegetTranslations():Vec3

    Returns the translations along the first rigid body's constraint basis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html index cd33dbc..a23ec3d 100644 --- a/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/GenericJointConfig.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A generic joint config is used for constructions of generic joints.

    Constructor

    new ()

    Default constructor.

    Variables

    localBasis1:Mat3

    The first body's local constraint basis.

    localBasis2:Mat3

    The second body's local constraint basis.

    rotationalLimitMotors:Array<RotationalLimitMotor>

    The rotational limits and motors along the rotation axes of the relative x-y-z Euler angles.

    rotationalSpringDampers:Array<SpringDamper>

    The rotational springs and dampers along the rotation axes of the relative x-y-z Euler angles.

    translationalLimitMotors:Array<TranslationalLimitMotor>

    The translational limits and motors along the first body's the constraint basis.

    translationalSpringDampers:Array<SpringDamper>

    The translational springs and dampers along the first body's constraint basis.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldBasis1:Mat3, worldBasis2:Mat3):GenericJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local bases -from the world bases worldBasis1 and worldBasis2, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A generic joint config is used for constructions of generic joints.

    Constructor

    new()

    Default constructor.

    Variables

    localBasis1:Mat3

    The first body's local constraint basis.

    localBasis2:Mat3

    The second body's local constraint basis.

    rotationalLimitMotors:Array<RotationalLimitMotor>

    The rotational limits and motors along the rotation axes of the relative x-y-z Euler angles.

    rotationalSpringDampers:Array<SpringDamper>

    The rotational springs and dampers along the rotation axes of the relative x-y-z Euler angles.

    translationalLimitMotors:Array<TranslationalLimitMotor>

    The translational limits and motors along the first body's the constraint basis.

    translationalSpringDampers:Array<SpringDamper>

    The translational springs and dampers along the first body's constraint basis.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldBasis1:Mat3, worldBasis2:Mat3):GenericJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local bases +from the world bases worldBasis1 and worldBasis2, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/Joint.html b/docs/oimo/dynamics/constraint/joint/Joint.html index 1fe167e..80187f1 100644 --- a/docs/oimo/dynamics/constraint/joint/Joint.html +++ b/docs/oimo/dynamics/constraint/joint/Joint.html @@ -7,22 +7,22 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The base class of joints. Joints are used to connect two rigid bodies -in various ways. See JointType for all types of joints.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +

    The base class of joints. Joints are used to connect two rigid bodies +in various ways. See JointType for all types of joints.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointConfig.html b/docs/oimo/dynamics/constraint/joint/JointConfig.html index 9e10348..d52d1a5 100644 --- a/docs/oimo/dynamics/constraint/joint/JointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/JointConfig.html @@ -7,9 +7,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A joint configuration is used for constructions of various joints. -An instance of any kind of the joint configurations can safely be reused.

    Variables

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    \ No newline at end of file +

    A joint configuration is used for constructions of various joints. +An instance of any kind of the joint configurations can safely be reused.

    Variables

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointLink.html b/docs/oimo/dynamics/constraint/joint/JointLink.html index 5fb1e7a..454f702 100644 --- a/docs/oimo/dynamics/constraint/joint/JointLink.html +++ b/docs/oimo/dynamics/constraint/joint/JointLink.html @@ -8,9 +8,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A joint link is used to build a constraint graph for clustering rigid bodies. +

    A joint link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. -See also ContactLink.

    Methods

    getContact ():Joint

    Returns the contact the rigid body is attached to.

    getNext ():JointLink

    Returns the next joint link in the rigid body.

    -

    If the previous one does not exist, null will be returned.

    getOther ():RigidBody

    Returns the other rigid body attached to the constraint. This provides a quick access -from a rigid body to the other one attached to the constraint.

    getPrev ():JointLink

    Returns the previous joint link in the rigid body.

    -

    If the previous one does not exist, null will be returned.

    \ No newline at end of file +See also ContactLink.

    Methods

    getContact():Joint

    Returns the contact the rigid body is attached to.

    getNext():JointLink

    Returns the next joint link in the rigid body.

    +

    If the previous one does not exist, null will be returned.

    getOther():RigidBody

    Returns the other rigid body attached to the constraint. This provides a quick access +from a rigid body to the other one attached to the constraint.

    getPrev():JointLink

    Returns the previous joint link in the rigid body.

    +

    If the previous one does not exist, null will be returned.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/JointType.html b/docs/oimo/dynamics/constraint/joint/JointType.html index 8a782d6..666563f 100644 --- a/docs/oimo/dynamics/constraint/joint/JointType.html +++ b/docs/oimo/dynamics/constraint/joint/JointType.html @@ -6,11 +6,11 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of the types of the joints.

    Static variables

    @:value(_CYLINDRICAL)staticread onlyCYLINDRICAL:Int = _CYLINDRICAL

    Represents a cylindrical joint.

    -

    See CylindricalJoint for details.

    @:value(_GENERIC)staticread onlyGENERIC:Int = _GENERIC

    Represents a generic joint.

    -

    See GenericJoint for details.

    @:value(_PRISMATIC)staticread onlyPRISMATIC:Int = _PRISMATIC

    Represents a prismatic joint.

    -

    See PrismaticJoint for details.

    @:value(_RAGDOLL)staticread onlyRAGDOLL:Int = _RAGDOLL

    Represents a ragdoll joint.

    -

    See RagdollJoint for details.

    @:value(_REVOLUTE)staticread onlyREVOLUTE:Int = _REVOLUTE

    Represents a revolute joint.

    -

    See RevoluteJoint for details.

    @:value(_SPHERICAL)staticread onlySPHERICAL:Int = _SPHERICAL

    Represents a spherical joint.

    -

    See SphericalJoint for details.

    @:value(_UNIVERSAL)staticread onlyUNIVERSAL:Int = _UNIVERSAL

    Represents a universal joint.

    -

    See UniversalJoint for details.

    \ No newline at end of file +

    The list of the types of the joints.

    Static variables

    @:value(_CYLINDRICAL)staticread onlyCYLINDRICAL:Int = _CYLINDRICAL

    Represents a cylindrical joint.

    +

    See CylindricalJoint for details.

    @:value(_GENERIC)staticread onlyGENERIC:Int = _GENERIC

    Represents a generic joint.

    +

    See GenericJoint for details.

    @:value(_PRISMATIC)staticread onlyPRISMATIC:Int = _PRISMATIC

    Represents a prismatic joint.

    +

    See PrismaticJoint for details.

    @:value(_RAGDOLL)staticread onlyRAGDOLL:Int = _RAGDOLL

    Represents a ragdoll joint.

    +

    See RagdollJoint for details.

    @:value(_REVOLUTE)staticread onlyREVOLUTE:Int = _REVOLUTE

    Represents a revolute joint.

    +

    See RevoluteJoint for details.

    @:value(_SPHERICAL)staticread onlySPHERICAL:Int = _SPHERICAL

    Represents a spherical joint.

    +

    See SphericalJoint for details.

    @:value(_UNIVERSAL)staticread onlyUNIVERSAL:Int = _UNIVERSAL

    Represents a universal joint.

    +

    See UniversalJoint for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html index ea0c4dc..92b9762 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJoint.html @@ -10,29 +10,29 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to +

    A prismatic joint (a.k.a. slider joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative translation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and -damper effect of the translational part of the constraint.

    Constructor

    new (config:PrismaticJointConfig)

    Creates a new prismatic joint by configuration config.

    Methods

    inlinegetAxis1 ():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAxis2 ():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLimitMotor ():TranslationalLimitMotor

    Returns the translational limits and motor settings.

    inlinegetLocalAxis1 ():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2 ():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetSpringDamper ():SpringDamper

    Returns the translational spring and damper settings.

    inlinegetTranslation ():Float

    Returns the translation of the joint.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +damper effect of the translational part of the constraint.

    Constructor

    new(config:PrismaticJointConfig)

    Creates a new prismatic joint by configuration config.

    Methods

    inlinegetAxis1():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAxis2():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLimitMotor():TranslationalLimitMotor

    Returns the translational limits and motor settings.

    inlinegetLocalAxis1():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetSpringDamper():SpringDamper

    Returns the translational spring and damper settings.

    inlinegetTranslation():Float

    Returns the translation of the joint.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html index 18c13c1..faf4a29 100644 --- a/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/PrismaticJointConfig.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A prismatic joint config is used for constructions of prismatic joints.

    Constructor

    new ()

    Default constructor.

    Variables

    limitMotor:TranslationalLimitMotor

    The translational limit and motor along the constraint axis of the joint.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper:SpringDamper

    The translational spring and damper along the constraint axis of the joint.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):PrismaticJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A prismatic joint config is used for constructions of prismatic joints.

    Constructor

    new()

    Default constructor.

    Variables

    limitMotor:TranslationalLimitMotor

    The translational limit and motor along the constraint axis of the joint.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper:SpringDamper

    The translational spring and damper along the constraint axis of the joint.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):PrismaticJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html index ea0698e..386679b 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJoint.html @@ -15,7 +15,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A ragdoll joint is designed to simulate ragdoll's limbs. It constrains +

    A ragdoll joint is designed to simulate ragdoll's limbs. It constrains swing and twist angles between two rigid bodies. The two rigid bodies have constraint axes, and the swing angle is defined by the angle of two constraint axes, while the twist angle is defined by the rotation @@ -24,26 +24,26 @@ by specifying two swing axes (though one of them is automatically computed) and corresponding maximum swing angles. You can also enable a motor of the twist part of the constraint, spring and damper effect of -the both swing and twist part of the constraint.

    Constructor

    new (config:RagdollJointConfig)

    Creates a new ragdoll joint by configuration config.

    Methods

    inlinegetAxis1 ():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAxis2 ():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis1 ():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2 ():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetSwingAngle ():Float

    Returns the swing angle in radians.

    inlinegetSwingAxis ():Vec3

    Returns the swing axis in world coordinates.

    inlinegetSwingAxisTo (axis:Vec3):Void

    Sets axis to the swing axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetSwingSpringDamper ():SpringDamper

    Returns the rotational spring and damper settings along the swing axis.

    inlinegetTwistAngle ():Float

    Returns the twist angle in radians.

    inlinegetTwistLimitMotor ():RotationalLimitMotor

    Returns the rotational limits and motor settings along the twist axis.

    inlinegetTwistSpringDamper ():SpringDamper

    Returns the rotational spring and damper settings along the twist axis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +the both swing and twist part of the constraint.

    Constructor

    new(config:RagdollJointConfig)

    Creates a new ragdoll joint by configuration config.

    Methods

    inlinegetAxis1():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAxis2():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis1():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetSwingAngle():Float

    Returns the swing angle in radians.

    inlinegetSwingAxis():Vec3

    Returns the swing axis in world coordinates.

    inlinegetSwingAxisTo(axis:Vec3):Void

    Sets axis to the swing axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetSwingSpringDamper():SpringDamper

    Returns the rotational spring and damper settings along the swing axis.

    inlinegetTwistAngle():Float

    Returns the twist angle in radians.

    inlinegetTwistLimitMotor():RotationalLimitMotor

    Returns the rotational limits and motor settings along the twist axis.

    inlinegetTwistSpringDamper():SpringDamper

    Returns the rotational spring and damper settings along the twist axis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html index 7a56631..6831d8d 100644 --- a/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RagdollJointConfig.html @@ -6,14 +6,14 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A ragdoll joint config is used for constructions of ragdoll joints.

    Constructor

    new ()

    Default constructor.

    Variables

    localSwingAxis1:Vec3

    The first body's local swing axis.

    +

    A ragdoll joint config is used for constructions of ragdoll joints.

    Constructor

    new()

    Default constructor.

    Variables

    localSwingAxis1:Vec3

    The first body's local swing axis.

    The second swing axis is also attached to the first body. It is perpendicular to the first swing -axis, and is automatically computed when the joint is created.

    localTwistAxis1:Vec3

    The first body's local twist axis.

    localTwistAxis2:Vec3

    The second body's local twist axis.

    maxSwingAngle1:Float

    The max angle of rotation along the first swing axis. -This value must be positive.

    maxSwingAngle2:Float

    The max angle of rotation along the second swing axis. -This value must be positive.

    swingSpringDamper:SpringDamper

    The rotational spring and damper along the swing axis of the joint.

    twistLimitMotor:RotationalLimitMotor

    The rotational limit and motor along the twist axis of the joint.

    twistSpringDamper:SpringDamper

    The rotational spring and damper along the twist axis of the joint.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldTwistAxis:Vec3, worldSwingAxis:Vec3):RagdollJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local twist axes +axis, and is automatically computed when the joint is created.

    localTwistAxis1:Vec3

    The first body's local twist axis.

    localTwistAxis2:Vec3

    The second body's local twist axis.

    maxSwingAngle1:Float

    The max angle of rotation along the first swing axis. +This value must be positive.

    maxSwingAngle2:Float

    The max angle of rotation along the second swing axis. +This value must be positive.

    swingSpringDamper:SpringDamper

    The rotational spring and damper along the swing axis of the joint.

    twistLimitMotor:RotationalLimitMotor

    The rotational limit and motor along the twist axis of the joint.

    twistSpringDamper:SpringDamper

    The rotational spring and damper along the twist axis of the joint.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldTwistAxis:Vec3, worldSwingAxis:Vec3):RagdollJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local twist axes from the world twist axis worldTwistAxis, local swing axis from the world swing axis -worldSwingAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +worldSwingAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html index db0d0e2..18df0dd 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJoint.html @@ -10,29 +10,29 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share +

    A revolute joint (a.k.a. hinge joint) constrains two rigid bodies to share their anchor points and constraint axes, and restricts relative rotation onto the constraint axis. This joint provides one degree of freedom. You can enable lower and upper limits, a motor, a spring and damper effect of the rotational -part of the constraint.

    Constructor

    new (config:RevoluteJointConfig)

    Creates a new revolute joint by configuration config.

    Methods

    inlinegetAngle ():Float

    Returns the rotation angle in radians.

    inlinegetAxis1 ():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAxis2 ():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLimitMotor ():RotationalLimitMotor

    Returns the rotational limits and motor settings.

    inlinegetLocalAxis1 ():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2 ():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetSpringDamper ():SpringDamper

    Returns the rotational spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +part of the constraint.

    Constructor

    new(config:RevoluteJointConfig)

    Creates a new revolute joint by configuration config.

    Methods

    inlinegetAngle():Float

    Returns the rotation angle in radians.

    inlinegetAxis1():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAxis2():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLimitMotor():RotationalLimitMotor

    Returns the rotational limits and motor settings.

    inlinegetLocalAxis1():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetSpringDamper():SpringDamper

    Returns the rotational spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html index 02f8b56..ecbfb74 100644 --- a/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/RevoluteJointConfig.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A revolute joint config is used for constructions of revolute joints.

    Constructor

    new ()

    Default constructor.

    Variables

    limitMotor:RotationalLimitMotor

    The rotational limits and motor settings.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper:SpringDamper

    The rotational spring and damper settings.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):RevoluteJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A revolute joint config is used for constructions of revolute joints.

    Constructor

    new()

    Default constructor.

    Variables

    limitMotor:RotationalLimitMotor

    The rotational limits and motor settings.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper:SpringDamper

    The rotational spring and damper settings.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis:Vec3):RevoluteJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axis worldAxis, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html index 3557d08..364de51 100644 --- a/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/RotationalLimitMotor.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Rotational limits and motor settings of a joint.

    Constructor

    new ()

    Default constructor.

    Variables

    lowerLimit:Float

    The lower bound of the limit in radians.

    -

    The limit is disabled if lowerLimit > upperLimit.

    motorSpeed:Float

    The target speed of the motor in usually radians per second.

    motorTorque:Float

    The maximum torque of the motor in usually newton meters.

    -

    The motor is disabled if motorTorque <= 0.

    upperLimit:Float

    The upper bound of the limit in radians.

    -

    The limit is disabled if lowerLimit > upperLimit.

    Methods

    clone ():RotationalLimitMotor

    Returns a clone of the object.

    setLimits (lower:Float, upper:Float):RotationalLimitMotor

    Sets limit properties at once and returns this. -this.lowerLimit is set to lower, and this.upperLimit is set to upper.

    setMotor (speed:Float, torque:Float):RotationalLimitMotor

    Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorTorque is set to torque.

    \ No newline at end of file +

    Rotational limits and motor settings of a joint.

    Constructor

    new()

    Default constructor.

    Variables

    lowerLimit:Float

    The lower bound of the limit in radians.

    +

    The limit is disabled if lowerLimit > upperLimit.

    motorSpeed:Float

    The target speed of the motor in usually radians per second.

    motorTorque:Float

    The maximum torque of the motor in usually newton meters.

    +

    The motor is disabled if motorTorque <= 0.

    upperLimit:Float

    The upper bound of the limit in radians.

    +

    The limit is disabled if lowerLimit > upperLimit.

    Methods

    clone():RotationalLimitMotor

    Returns a clone of the object.

    setLimits(lower:Float, upper:Float):RotationalLimitMotor

    Sets limit properties at once and returns this. +this.lowerLimit is set to lower, and this.upperLimit is set to upper.

    setMotor(speed:Float, torque:Float):RotationalLimitMotor

    Sets motor properties at once and returns this. +this.motorSpeed is set to speed, and this.motorTorque is set to torque.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html index 9936598..c296a33 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJoint.html @@ -8,23 +8,23 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share +

    A spherical joint (a.k.a. ball and socket joint) constrains two rigid bodies to share their anchor points. This joint provides three degrees of freedom. You can enable a -spring and damper effect of the constraint.

    Constructor

    new (config:SphericalJointConfig)

    Creates a new spherical joint by configuration config.

    Methods

    inlinegetSpringDamper ():SpringDamper

    Returns the spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +spring and damper effect of the constraint.

    Constructor

    new(config:SphericalJointConfig)

    Creates a new spherical joint by configuration config.

    Methods

    inlinegetSpringDamper():SpringDamper

    Returns the spring and damper settings.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html index de0b1f0..29c0f77 100644 --- a/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/SphericalJointConfig.html @@ -6,8 +6,8 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A spherical joint config is used for constructions of spherical joints.

    Constructor

    new ()

    Default constructor.

    Variables

    springDamper:SpringDamper

    The spring and damper setting of the joint.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3):SphericalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A spherical joint config is used for constructions of spherical joints.

    Constructor

    new()

    Default constructor.

    Variables

    springDamper:SpringDamper

    The spring and damper setting of the joint.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3):SphericalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/SpringDamper.html b/docs/oimo/dynamics/constraint/joint/SpringDamper.html index 61aab47..0a5658a 100644 --- a/docs/oimo/dynamics/constraint/joint/SpringDamper.html +++ b/docs/oimo/dynamics/constraint/joint/SpringDamper.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Spring and damper settings of a joint.

    Constructor

    new ()

    Default constructor.

    Variables

    dampingRatio:Float

    The damping ratio of the constraint. -Set 1.0 to make the constraint critically dumped.

    frequency:Float

    The frequency of the spring in Hz. -Set 0.0 to disable the spring and make the constraint totally rigid.

    useSymplecticEuler:Bool

    Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. +

    Spring and damper settings of a joint.

    Constructor

    new()

    Default constructor.

    Variables

    dampingRatio:Float

    The damping ratio of the constraint. +Set 1.0 to make the constraint critically dumped.

    frequency:Float

    The frequency of the spring in Hz. +Set 0.0 to disable the spring and make the constraint totally rigid.

    useSymplecticEuler:Bool

    Whether to use symplectic Euler method instead of implicit Euler method, to numarically integrate the constraint. Note that symplectic Euler method conserves energy better than implicit Euler method does, but the constraint will be -unstable under the high frequency.

    Methods

    clone ():SpringDamper

    Returns a clone of the object.

    setSpring (frequency:Float, dampingRatio:Float):SpringDamper

    Sets spring and damper parameters at once and returns this. -this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

    setSymplecticEuler (useSymplecticEuler:Bool):SpringDamper

    \ No newline at end of file +unstable under the high frequency.

    Methods

    clone():SpringDamper

    Returns a clone of the object.

    setSpring(frequency:Float, dampingRatio:Float):SpringDamper

    Sets spring and damper parameters at once and returns this. +this.frequency is set to frequency, and this.dampingRatio is set to dampingRatio.

    setSymplecticEuler(useSymplecticEuler:Bool):SpringDamper

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html index d3655a7..8617c07 100644 --- a/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html +++ b/docs/oimo/dynamics/constraint/joint/TranslationalLimitMotor.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    Translational limits and motor settings of a joint.

    Constructor

    new ()

    Default constructor.

    Variables

    lowerLimit:Float

    The lower bound of the limit in usually meters.

    -

    The limit is disabled if lowerLimit > upperLimit.

    motorForce:Float

    The maximum force of the motor in usually newtons.

    -

    The motor is disabled if motorForce <= 0.

    motorSpeed:Float

    The target speed of the motor in usually meters per second.

    upperLimit:Float

    The upper bound of the limit in usually meters.

    -

    The limit is disabled if lowerLimit > upperLimit.

    Methods

    clone ():TranslationalLimitMotor

    Returns a clone of the object.

    setLimits (lower:Float, upper:Float):TranslationalLimitMotor

    Sets limit properties at once and returns this. -this.lowerLimit is set to lower, and this.upperLimit is set to upper.

    setMotor (speed:Float, force:Float):TranslationalLimitMotor

    Sets motor properties at once and returns this. -this.motorSpeed is set to speed, and this.motorForce is set to force.

    \ No newline at end of file +

    Translational limits and motor settings of a joint.

    Constructor

    new()

    Default constructor.

    Variables

    lowerLimit:Float

    The lower bound of the limit in usually meters.

    +

    The limit is disabled if lowerLimit > upperLimit.

    motorForce:Float

    The maximum force of the motor in usually newtons.

    +

    The motor is disabled if motorForce <= 0.

    motorSpeed:Float

    The target speed of the motor in usually meters per second.

    upperLimit:Float

    The upper bound of the limit in usually meters.

    +

    The limit is disabled if lowerLimit > upperLimit.

    Methods

    clone():TranslationalLimitMotor

    Returns a clone of the object.

    setLimits(lower:Float, upper:Float):TranslationalLimitMotor

    Sets limit properties at once and returns this. +this.lowerLimit is set to lower, and this.upperLimit is set to upper.

    setMotor(speed:Float, force:Float):TranslationalLimitMotor

    Sets motor properties at once and returns this. +this.motorSpeed is set to speed, and this.motorForce is set to force.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html index 824a20f..36279f2 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJoint.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJoint.html @@ -10,29 +10,29 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A universal joint constrains two rigid bodies' constraint axes to be perpendicular +

    A universal joint constrains two rigid bodies' constraint axes to be perpendicular to each other. Rigid bodies can rotate along their constraint axes, but cannot along the direction perpendicular to two constraint axes. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects -of the two rotational constraints.

    Constructor

    new (config:UniversalJointConfig)

    Creates a new universal joint by configuration config.

    Methods

    inlinegetAngle1 ():Float

    Returns the rotation angle along the first body's constraint axis.

    inlinegetAngle2 ():Float

    Returns the rotation angle along the second body's constraint axis.

    inlinegetAxis1 ():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAxis2 ():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLimitMotor1 ():RotationalLimitMotor

    Returns the rotational limits and motor settings along the first body's constraint axis.

    inlinegetLimitMotor2 ():RotationalLimitMotor

    Returns the rotational limits and motor settings along the second body's constraint axis.

    inlinegetLocalAxis1 ():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To (axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2 ():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To (axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    -

    This does not create a new instance of Vec3.

    inlinegetSpringDamper1 ():SpringDamper

    Returns the rotational spring and damper settings along the first body's constraint axis.

    inlinegetSpringDamper2 ():SpringDamper

    Returns the rotational spring and damper settings along the second body's constraint axis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision ():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1 ():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To (anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAnchor2 ():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To (anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedForce ():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo (appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque ():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo (appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    -

    This does not create a new instance of Vec3.

    inlinegetBasis1 ():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To (basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBasis2 ():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To (basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    -

    This does not create a new instance of Mat3.

    inlinegetBreakForce ():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque ():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    -

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1 ():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To (localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2 ():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To (localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    -

    This does not create a new instance of Vec3.

    inlinegetNext ():Joint

    Returns the next joint in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm ():Int

    Returns the type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev ():Joint

    Returns the previous joint in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1 ():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2 ():RigidBody

    Returns the second rigid body.

    inlinegetType ():Int

    Returns the type of the joint.

    -

    See JointType for details.

    inlinesetAllowCollision (allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce (breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetBreakTorque (breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    -

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm (positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file +of the two rotational constraints.

    Constructor

    new(config:UniversalJointConfig)

    Creates a new universal joint by configuration config.

    Methods

    inlinegetAngle1():Float

    Returns the rotation angle along the first body's constraint axis.

    inlinegetAngle2():Float

    Returns the rotation angle along the second body's constraint axis.

    inlinegetAxis1():Vec3

    Returns the first rigid body's constraint axis in world coordinates.

    inlinegetAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAxis2():Vec3

    Returns the second rigid body's constraint axis in world coordinates.

    inlinegetAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLimitMotor1():RotationalLimitMotor

    Returns the rotational limits and motor settings along the first body's constraint axis.

    inlinegetLimitMotor2():RotationalLimitMotor

    Returns the rotational limits and motor settings along the second body's constraint axis.

    inlinegetLocalAxis1():Vec3

    Returns the first rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis1To(axis:Vec3):Void

    Sets axis to the first rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAxis2():Vec3

    Returns the second rigid body's constraint axis relative to the rigid body's transform.

    inlinegetLocalAxis2To(axis:Vec3):Void

    Sets axis to the second rigid body's constraint axis relative to the rigid body's transform.

    +

    This does not create a new instance of Vec3.

    inlinegetSpringDamper1():SpringDamper

    Returns the rotational spring and damper settings along the first body's constraint axis.

    inlinegetSpringDamper2():SpringDamper

    Returns the rotational spring and damper settings along the second body's constraint axis.

    Inherited Variables

    Defined by Joint

    userData:Any

    Extra field that users can use for their own purposes.

    Inherited Methods

    Defined by Joint

    inlinegetAllowCollision():Bool

    Returns whether to allow the connected rigid bodies to collide each other.

    inlinegetAnchor1():Vec3

    Returns the first rigid body's anchor point in world coordinates.

    inlinegetAnchor1To(anchor:Vec3):Void

    Sets anchor to the first rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAnchor2():Vec3

    Returns the second rigid body's anchor point in world coordinates.

    inlinegetAnchor2To(anchor:Vec3):Void

    Sets anchor to the second rigid body's anchor point in world coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedForce():Vec3

    Returns the force applied to the first rigid body at the last time step.

    inlinegetAppliedForceTo(appliedForce:Vec3):Void

    Sets appliedForce to the force applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetAppliedTorque():Vec3

    Returns the torque applied to the first rigid body at the last time step.

    inlinegetAppliedTorqueTo(appliedTorque:Vec3):Void

    Sets appliedTorque to the torque applied to the first rigid body at the last time step.

    +

    This does not create a new instance of Vec3.

    inlinegetBasis1():Mat3

    Returns the basis of the joint for the first rigid body in world coordinates.

    inlinegetBasis1To(basis:Mat3):Void

    Sets basis to the basis of the joint for the first rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBasis2():Mat3

    Returns the basis of the joint for the second rigid body in world coordinates.

    inlinegetBasis2To(basis:Mat3):Void

    Sets basis to the basis of the joint for the second rigid body in world coordinates.

    +

    This does not create a new instance of Mat3.

    inlinegetBreakForce():Float

    Returns the magnitude of the constraint force at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetBreakTorque():Float

    Returns the magnitude of the constraint torque at which the joint will be destroyed.

    +

    Returns 0 if the joint is unbreakable.

    inlinegetLocalAnchor1():Vec3

    Returns the first rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor1To(localAnchor:Vec3):Void

    Sets localAnchor to the first rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalAnchor2():Vec3

    Returns the second rigid body's local anchor point in world coordinates.

    inlinegetLocalAnchor2To(localAnchor:Vec3):Void

    Sets localAnchor to the second rigid body's anchor point in local coordinates.

    +

    This does not create a new instance of Vec3.

    inlinegetNext():Joint

    Returns the next joint in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetPositionCorrectionAlgorithm():Int

    Returns the type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    inlinegetPrev():Joint

    Returns the previous joint in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRigidBody1():RigidBody

    Returns the first rigid body.

    inlinegetRigidBody2():RigidBody

    Returns the second rigid body.

    inlinegetType():Int

    Returns the type of the joint.

    +

    See JointType for details.

    inlinesetAllowCollision(allowCollision:Bool):Void

    Sets whether to allow the connected rigid bodies to collide each other.

    inlinesetBreakForce(breakForce:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetBreakTorque(breakTorque:Float):Void

    Sets the magnitude of the constraint force at which the joint will be destroyed.

    +

    Set 0 for unbreakable joints.

    inlinesetPositionCorrectionAlgorithm(positionCorrectionAlgorithm:Int):Void

    Sets the type of the position correction algorithm to positionCorrectionAlgorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html index a816813..48e0df1 100644 --- a/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html +++ b/docs/oimo/dynamics/constraint/joint/UniversalJointConfig.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A universal joint config is used for constructions of universal joints.

    Constructor

    new ()

    Default constructor.

    Variables

    limitMotor1:RotationalLimitMotor

    The rotational limit and motor along the first body's constraint axis.

    limitMotor2:RotationalLimitMotor

    The rotational limit and motor along the second body's constraint axis.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper1:SpringDamper

    The rotational spring and damper along the first body's constraint axis.

    springDamper2:SpringDamper

    The rotational spring and damper along the second body's constraint axis.

    Methods

    init (rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis1:Vec3, worldAxis2:Vec3):UniversalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes -from the world axes worldAxis1 and worldAxis2, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    -

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    -

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    -

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    -

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file +

    A universal joint config is used for constructions of universal joints.

    Constructor

    new()

    Default constructor.

    Variables

    limitMotor1:RotationalLimitMotor

    The rotational limit and motor along the first body's constraint axis.

    limitMotor2:RotationalLimitMotor

    The rotational limit and motor along the second body's constraint axis.

    localAxis1:Vec3

    The first body's local constraint axis.

    localAxis2:Vec3

    The second body's local constraint axis.

    springDamper1:SpringDamper

    The rotational spring and damper along the first body's constraint axis.

    springDamper2:SpringDamper

    The rotational spring and damper along the second body's constraint axis.

    Methods

    init(rigidBody1:RigidBody, rigidBody2:RigidBody, worldAnchor:Vec3, worldAxis1:Vec3, worldAxis2:Vec3):UniversalJointConfig

    Sets rigid bodies, local anchors from the world anchor worldAnchor, local axes +from the world axes worldAxis1 and worldAxis2, and returns this.

    Inherited Variables

    Defined by JointConfig

    allowCollision:Bool

    Whether to allow the connected rigid bodies to collide each other.

    breakForce:Float

    The joint will be destroyed when magnitude of the constraint force exceeds the value.

    +

    Set 0 for unbreakable joints.

    breakTorque:Float

    The joint will be destroyed when magnitude of the constraint torque exceeds the value.

    +

    Set 0 for unbreakable joints.

    localAnchor1:Vec3

    The local position of the first rigid body's anchor point.

    localAnchor2:Vec3

    The local position of the second rigid body's anchor point.

    positionCorrectionAlgorithm:Int

    The type of the position correction algorithm for the joint.

    +

    See PositionCorrectionAlgorithm for details.

    rigidBody1:RigidBody

    The first rigid body attached to the joint.

    rigidBody2:RigidBody

    The second rigid body attached to the joint.

    solverType:Int

    The type of the constraint solver for the joint.

    +

    See ConstraintSolverType for details.

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/joint/index.html b/docs/oimo/dynamics/constraint/joint/index.html index 7cc1382..80ebd40 100644 --- a/docs/oimo/dynamics/constraint/joint/index.html +++ b/docs/oimo/dynamics/constraint/joint/index.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint.joint

    OimoPhysics API Documentation

    ..
    CylindricalJoint

    A cylindrical joint constrains two rigid bodies to share their constraint +

    oimo.dynamics.constraint.joint

    OimoPhysics API Documentation

    ..
    CylindricalJoint

    A cylindrical joint constrains two rigid bodies to share their constraint axes, and restricts relative translation and rotation onto the constraint axis. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects of both translation and @@ -41,4 +41,4 @@ to each other. Rigid bodies can rotate along their constraint axes, but cannot along the direction perpendicular to two constraint axes. This joint provides two degrees of freedom. You can enable lower and upper limits, motors, spring and damper effects -of the two rotational constraints.

    UniversalJointConfig

    A universal joint config is used for constructions of universal joints.

    \ No newline at end of file +of the two rotational constraints.

    UniversalJointConfig

    A universal joint config is used for constructions of universal joints.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html index 8151f08..0ae355d 100644 --- a/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html +++ b/docs/oimo/dynamics/constraint/solver/ConstraintSolverType.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of the constraint solvers.

    Static variables

    @:value(_DIRECT)staticread onlyDIRECT:Int = _DIRECT

    Direct constraint solver. Very stable but not suitable for a situation where fast -computation is required.

    @:value(_ITERATIVE)staticread onlyITERATIVE:Int = _ITERATIVE

    Iterative constraint solver. Fast and stable enough for common usages.

    \ No newline at end of file +

    The list of the constraint solvers.

    Static variables

    @:value(_DIRECT)staticread onlyDIRECT:Int = _DIRECT

    Direct constraint solver. Very stable but not suitable for a situation where fast +computation is required.

    @:value(_ITERATIVE)staticread onlyITERATIVE:Int = _ITERATIVE

    Iterative constraint solver. Fast and stable enough for common usages.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html index 0d6d6c3..00ba554 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/direct/DirectJointConstraintSolver.html @@ -7,5 +7,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

    Methods

    Inherited Variables

    Inherited Methods

    \ No newline at end of file +

    The direct solver of a mixed linear complementality problem (MLCP) for +joint constraints.

    Methods

    Inherited Variables

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/direct/index.html b/docs/oimo/dynamics/constraint/solver/direct/index.html index 36c9f59..37eae62 100644 --- a/docs/oimo/dynamics/constraint/solver/direct/index.html +++ b/docs/oimo/dynamics/constraint/solver/direct/index.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint.solver.direct

    OimoPhysics API Documentation

    ..
    DirectJointConstraintSolver

    The direct solver of a mixed linear complementality problem (MLCP) for -joint constraints.

    \ No newline at end of file +

    oimo.dynamics.constraint.solver.direct

    OimoPhysics API Documentation

    ..
    DirectJointConstraintSolver

    The direct solver of a mixed linear complementality problem (MLCP) for +joint constraints.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/index.html b/docs/oimo/dynamics/constraint/solver/index.html index 487cd21..b0a449a 100644 --- a/docs/oimo/dynamics/constraint/solver/index.html +++ b/docs/oimo/dynamics/constraint/solver/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint.solver

    OimoPhysics API Documentation

    ..
    direct
    pgs
    ConstraintSolverType

    The list of the constraint solvers.

    \ No newline at end of file +

    oimo.dynamics.constraint.solver

    OimoPhysics API Documentation

    ..
    direct
    pgs
    ConstraintSolverType

    The list of the constraint solvers.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html index 81d76f4..9f27460 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsContactConstraintSolver.html @@ -6,5 +6,5 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A contact constraint solver using projected Gauss-Seidel (sequential impulse).

    Methods

    Inherited Variables

    Inherited Methods

    Defined by ConstraintSolver

    postSolveVelocity (timeStep:TimeStep):Void

    Performs post-processes of velocity part. Time step information timeStep is given -for computing time-depending data.

    \ No newline at end of file +

    A contact constraint solver using projected Gauss-Seidel (sequential impulse).

    Methods

    Inherited Variables

    Inherited Methods

    Defined by ConstraintSolver

    postSolveVelocity(timeStep:TimeStep):Void

    Performs post-processes of velocity part. Time step information timeStep is given +for computing time-depending data.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html index d9bf294..86c8955 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/PgsJointConstraintSolver.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A joint constraint solver using projected Gauss-Seidel (sequential impulse).

    Methods

    Inherited Variables

    Inherited Methods

    \ No newline at end of file +

    A joint constraint solver using projected Gauss-Seidel (sequential impulse).

    Methods

    Inherited Variables

    Inherited Methods

    \ No newline at end of file diff --git a/docs/oimo/dynamics/constraint/solver/pgs/index.html b/docs/oimo/dynamics/constraint/solver/pgs/index.html index 0bab4a6..3b5bb1b 100644 --- a/docs/oimo/dynamics/constraint/solver/pgs/index.html +++ b/docs/oimo/dynamics/constraint/solver/pgs/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.constraint.solver.pgs

    OimoPhysics API Documentation

    ..
    PgsContactConstraintSolver

    A contact constraint solver using projected Gauss-Seidel (sequential impulse).

    PgsJointConstraintSolver

    A joint constraint solver using projected Gauss-Seidel (sequential impulse).

    \ No newline at end of file +

    oimo.dynamics.constraint.solver.pgs

    OimoPhysics API Documentation

    ..
    PgsContactConstraintSolver

    A contact constraint solver using projected Gauss-Seidel (sequential impulse).

    PgsJointConstraintSolver

    A joint constraint solver using projected Gauss-Seidel (sequential impulse).

    \ No newline at end of file diff --git a/docs/oimo/dynamics/index.html b/docs/oimo/dynamics/index.html index ed93019..82c10e1 100644 --- a/docs/oimo/dynamics/index.html +++ b/docs/oimo/dynamics/index.html @@ -6,10 +6,10 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics

    OimoPhysics API Documentation

    ..
    callback
    common
    constraint
    rigidbody
    Contact

    A contact is a cached pair of overlapping shapes in the physics world. contacts +

    oimo.dynamics

    OimoPhysics API Documentation

    ..
    callback
    common
    constraint
    rigidbody
    Contact

    A contact is a cached pair of overlapping shapes in the physics world. contacts are created by ContactManager when two AABBs of shapes begin overlapping.

    ContactLink

    A contact link is used to build a constraint graph for clustering rigid bodies. In a constraint graph, rigid bodies are nodes and constraints are edges. See also JointLink.

    ContactManager

    The manager of the contacts in the physics world. A contact of two shapes is created when the AABBs of them begin overlapping, and is destroyed when they end overlapping.

    TimeStep

    Information of time-step sizes of the simulation.

    World

    The physics simulation world. This manages entire the dynamic simulation. You can add -rigid bodies and joints to the world to simulate them.

    \ No newline at end of file +rigid bodies and joints to the world to simulate them.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/MassData.html b/docs/oimo/dynamics/rigidbody/MassData.html index 10e9255..90d32fb 100644 --- a/docs/oimo/dynamics/rigidbody/MassData.html +++ b/docs/oimo/dynamics/rigidbody/MassData.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    This class holds mass and moment of inertia for a rigid body.

    Constructor

    new ()

    Default constructor.

    Variables

    localInertia:Mat3

    Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

    mass:Float

    Mass. 0 for a non-dynamic rigid body.

    \ No newline at end of file +

    This class holds mass and moment of inertia for a rigid body.

    Constructor

    new()

    Default constructor.

    Variables

    localInertia:Mat3

    Inertia tensor in local space. Zero matrix for a non-dynamic rigid body.

    mass:Float

    Mass. 0 for a non-dynamic rigid body.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBody.html b/docs/oimo/dynamics/rigidbody/RigidBody.html index 775def6..d78df23 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBody.html +++ b/docs/oimo/dynamics/rigidbody/RigidBody.html @@ -10,40 +10,40 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A rigid body. To add a rigid body to a physics world, create a RigidBody +

    A rigid body. To add a rigid body to a physics world, create a RigidBody instance, create and add shapes via RigidBody.addShape, and add the rigid body to the physics world through World.addRigidBody. Rigid bodies have three motion types: dynamic, static, and kinematic. See RigidBodyType for -details of motion types.

    Constructor

    new (config:RigidBodyConfig)

    Creates a new rigid body by configuration config.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlineaddAngularVelocity (angularVelocityChange:Vec3):Void

    Adds angularVelocityChange to the angular velcity of the rigid body.

    inlineaddLinearVelocity (linearVelocityChange:Vec3):Void

    Adds linearVelocityChange to the linear velcity of the rigid body.

    addShape (shape:Shape):Void

    Adds the shape to the rigid body.

    applyAngularImpulse (impulse:Vec3):Void

    Applies the angular impulse impulse to the rigid body.

    -

    This does not change the linear velocity.

    applyForce (force:Vec3, positionInWorld:Vec3):Void

    Applies the force force to positionInWorld in world position.

    applyForceToCenter (force:Vec3):Void

    Applies the force force to the center of mass.

    applyImpulse (impulse:Vec3, positionInWorld:Vec3):Void

    Applies the impulse impulse to the rigid body at positionInWorld in world position.

    -

    This changes both the linear velocity and the angular velocity.

    applyLinearImpulse (impulse:Vec3):Void

    Applies the linear impulse impulse to the rigid body.

    -

    This does not change the angular velocity.

    applyTorque (torque:Vec3):Void

    Applies the torque torque.

    inlinegetAngularContactImpulse ():Vec3

    Returns the total angular impulse applied by contact constraints.

    inlinegetAngularContactImpulseTo (angularContactImpulse:Vec3):Void

    Sets angularContactImpulse to the total angular impulse applied by contact constraints.

    -

    This does not create a new instance of Vec3.

    inlinegetAngularDamping ():Float

    Returns the angular damping.

    inlinegetAngularVelocity ():Vec3

    Returns the angular velocity of the rigid body.

    inlinegetAngularVelocityTo (angularVelocity:Vec3):Void

    Sets angularVelocity to the angular velocity of the rigid body.

    -

    This does not create a new intrance of Vec3.

    inlinegetContactLinkList ():ContactLink

    Returns the list of the contact links the rigid body is involved.

    inlinegetGravityScale ():Float

    Returns the gravity scaling factor of the rigid body.

    inlinegetJointLinkList ():JointLink

    Returns the list of the joint links the rigid body is attached.

    inlinegetLinearContactImpulse ():Vec3

    Returns the total linear impulse applied by contact constraints.

    inlinegetLinearContactImpulseTo (linearContactImpulse:Vec3):Void

    Sets linearContactImpulse to the total linear impulse applied by contact constraints.

    -

    This does not create a new instance of Vec3.

    inlinegetLinearDamping ():Float

    Returns the linear damping.

    inlinegetLinearVelocity ():Vec3

    Returns the linear velocity of the rigid body.

    inlinegetLinearVelocityTo (linearVelocity:Vec3):Void

    Sets linearVelocity to the linear velocity of the rigid body.

    -

    This does not create a new intrance of Vec3.

    inlinegetLocalInertia ():Mat3

    Returns the moment of inertia tensor in local space.

    inlinegetLocalInertiaTo (inertia:Mat3):Void

    Sets inertia to the moment of inertia tensor in local space.

    -

    This does not create a new instance of Mat3

    inlinegetLocalPoint (worldPoint:Vec3):Vec3

    Returns the local coordinates of the point worldPoint in world coodinates.

    inlinegetLocalPointTo (worldPoint:Vec3, localPoint:Vec3):Void

    Sets localPoint to the local coordinates of the point worldPoint in world coodinates.

    -

    This does not create a new instance of Vec3.

    inlinegetLocalVector (worldVector:Vec3):Vec3

    Returns the local coordinates of the vector worldVector in world coodinates.

    inlinegetLocalVectorTo (worldVector:Vec3, localVector:Vec3):Void

    Sets localVector to the local coordinates of the vector worldVector in world coodinates.

    -

    This does not create a new instance of Vec3.

    inlinegetMass ():Float

    Returns the mass of the rigid body.

    -

    If the rigid body has infinite mass, 0 will be returned.

    inlinegetMassData ():MassData

    Returns the mass data of the rigid body.

    inlinegetMassDataTo (massData:MassData):Void

    Sets massData to the mass data of the rigid body.

    -

    This does not create a new instance of MassData.

    inlinegetNext ():RigidBody

    Returns the next rigid body in the world.

    -

    If the next one does not exist, null will be returned.

    inlinegetNumContectLinks ():Int

    Returns the number of the contact lists the rigid body is involved.

    inlinegetNumJointLinks ():Int

    Returns the number of the joint links the rigid body is attached.

    inlinegetNumShapes ():Int

    Returns the number of the shapes added.

    inlinegetOrientation ():Quat

    Returns the rotation of the rigid body as a quaternion.

    inlinegetOrientationTo (orientation:Quat):Void

    Sets orientation to the rotation quaternion of the rigid body.

    -

    This does not create a new instance of Quat.

    inlinegetPosition ():Vec3

    Returns the world position of the rigid body.

    inlinegetPositionTo (position:Vec3):Void

    Sets position to the world position of the rigid body.

    -

    This does not create a new instance of Vec3.

    inlinegetPrev ():RigidBody

    Returns the previous rigid body in the world.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRotation ():Mat3

    Returns the rotation matrix of the rigid body.

    inlinegetRotationFactor ():Vec3

    Returns the rotation factor of the rigid body.

    inlinegetRotationTo (rotation:Mat3):Void

    Sets rotation to the rotation matrix of the rigid body.

    -

    This does not create a new instance of Mat3.

    inlinegetShapeList ():Shape

    Returns the list of the shapes of the rigid body.

    inlinegetSleepTime ():Float

    Returns how long the rigid body is stopping moving. This returns 0 if the body -has already slept.

    inlinegetTransform ():Transform

    Returns the transform of the rigid body.

    inlinegetTransformTo (transform:Transform):Void

    Sets transform to the transform of the rigid body.

    -

    This does not create a new instance of Transform.

    inlinegetType ():Int

    Returns the rigid body's type of behaviour.

    -

    See RigidBodyType class for details.

    inlinegetWorldPoint (localPoint:Vec3):Vec3

    Returns the world coordinates of the point localPoint in local coodinates.

    inlinegetWorldPointTo (localPoint:Vec3, worldPoint:Vec3):Void

    Sets worldPoint to the world coordinates of the point localPoint in local coodinates.

    -

    This does not create a new instance of Vec3.

    inlinegetWorldVector (localVector:Vec3):Vec3

    Returns the world coordinates of the vector localVector in local coodinates.

    inlinegetWorldVectorTo (localVector:Vec3, worldVector:Vec3):Void

    Sets worldVector to the world coordinates of the vector localVector in local coodinates.

    -

    This does not create a new instance of Vec3.

    inlineisSleeping ():Bool

    Returns whether the rigid body is sleeping.

    removeShape (shape:Shape):Void

    Removes the shape from the rigid body.

    inlinerotate (rotation:Mat3):Void

    Rotates the rigid body by the rotation matrix rotation.

    inlinerotateXyz (eulerAngles:Vec3):Void

    Rotates the rigid body by Euler angles eulerAngles in radians.

    inlinesetAngularDamping (damping:Float):Void

    Sets the angular damping to damping.

    inlinesetAngularVelocity (angularVelocity:Vec3):Void

    Sets the angular velocity of the rigid body.

    inlinesetAutoSleep (autoSleepEnabled:Bool):Void

    Sets the rigid body's auto sleep flag.

    -

    If auto sleep is enabled, the rigid body will automatically sleep when needed.

    inlinesetGravityScale (gravityScale:Float):Void

    Sets the gravity scaling factor of the rigid body to gravityScale.

    -

    If 0 is set, the rigid body will not be affected by gravity.

    inlinesetLinearDamping (damping:Float):Void

    Sets the linear damping to damping.

    inlinesetLinearVelocity (linearVelocity:Vec3):Void

    Sets the linear velocity of the rigid body.

    inlinesetMassData (massData:MassData):Void

    Sets the mass and moment of inertia of the rigid body by the mass data massData. -The properties set by this will be overwritten when

    • some shapes are added or removed
    • the type of the rigid body is changed

    inlinesetOrientation (quaternion:Quat):Void

    Sets the rotation of the rigid body from a quaternion quaternion.

    inlinesetPosition (position:Vec3):Void

    Sets the world position of the rigid body to position.

    inlinesetRotation (rotation:Mat3):Void

    Sets the rotation matrix of the rigid body to rotation.

    inlinesetRotationFactor (rotationFactor:Vec3):Void

    Sets the rotation factor of the rigid body to rotationFactor.

    +details of motion types.

    Constructor

    new(config:RigidBodyConfig)

    Creates a new rigid body by configuration config.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlineaddAngularVelocity(angularVelocityChange:Vec3):Void

    Adds angularVelocityChange to the angular velcity of the rigid body.

    inlineaddLinearVelocity(linearVelocityChange:Vec3):Void

    Adds linearVelocityChange to the linear velcity of the rigid body.

    addShape(shape:Shape):Void

    Adds the shape to the rigid body.

    applyAngularImpulse(impulse:Vec3):Void

    Applies the angular impulse impulse to the rigid body.

    +

    This does not change the linear velocity.

    applyForce(force:Vec3, positionInWorld:Vec3):Void

    Applies the force force to positionInWorld in world position.

    applyForceToCenter(force:Vec3):Void

    Applies the force force to the center of mass.

    applyImpulse(impulse:Vec3, positionInWorld:Vec3):Void

    Applies the impulse impulse to the rigid body at positionInWorld in world position.

    +

    This changes both the linear velocity and the angular velocity.

    applyLinearImpulse(impulse:Vec3):Void

    Applies the linear impulse impulse to the rigid body.

    +

    This does not change the angular velocity.

    applyTorque(torque:Vec3):Void

    Applies the torque torque.

    inlinegetAngularContactImpulse():Vec3

    Returns the total angular impulse applied by contact constraints.

    inlinegetAngularContactImpulseTo(angularContactImpulse:Vec3):Void

    Sets angularContactImpulse to the total angular impulse applied by contact constraints.

    +

    This does not create a new instance of Vec3.

    inlinegetAngularDamping():Float

    Returns the angular damping.

    inlinegetAngularVelocity():Vec3

    Returns the angular velocity of the rigid body.

    inlinegetAngularVelocityTo(angularVelocity:Vec3):Void

    Sets angularVelocity to the angular velocity of the rigid body.

    +

    This does not create a new intrance of Vec3.

    inlinegetContactLinkList():ContactLink

    Returns the list of the contact links the rigid body is involved.

    inlinegetGravityScale():Float

    Returns the gravity scaling factor of the rigid body.

    inlinegetJointLinkList():JointLink

    Returns the list of the joint links the rigid body is attached.

    inlinegetLinearContactImpulse():Vec3

    Returns the total linear impulse applied by contact constraints.

    inlinegetLinearContactImpulseTo(linearContactImpulse:Vec3):Void

    Sets linearContactImpulse to the total linear impulse applied by contact constraints.

    +

    This does not create a new instance of Vec3.

    inlinegetLinearDamping():Float

    Returns the linear damping.

    inlinegetLinearVelocity():Vec3

    Returns the linear velocity of the rigid body.

    inlinegetLinearVelocityTo(linearVelocity:Vec3):Void

    Sets linearVelocity to the linear velocity of the rigid body.

    +

    This does not create a new intrance of Vec3.

    inlinegetLocalInertia():Mat3

    Returns the moment of inertia tensor in local space.

    inlinegetLocalInertiaTo(inertia:Mat3):Void

    Sets inertia to the moment of inertia tensor in local space.

    +

    This does not create a new instance of Mat3

    inlinegetLocalPoint(worldPoint:Vec3):Vec3

    Returns the local coordinates of the point worldPoint in world coodinates.

    inlinegetLocalPointTo(worldPoint:Vec3, localPoint:Vec3):Void

    Sets localPoint to the local coordinates of the point worldPoint in world coodinates.

    +

    This does not create a new instance of Vec3.

    inlinegetLocalVector(worldVector:Vec3):Vec3

    Returns the local coordinates of the vector worldVector in world coodinates.

    inlinegetLocalVectorTo(worldVector:Vec3, localVector:Vec3):Void

    Sets localVector to the local coordinates of the vector worldVector in world coodinates.

    +

    This does not create a new instance of Vec3.

    inlinegetMass():Float

    Returns the mass of the rigid body.

    +

    If the rigid body has infinite mass, 0 will be returned.

    inlinegetMassData():MassData

    Returns the mass data of the rigid body.

    inlinegetMassDataTo(massData:MassData):Void

    Sets massData to the mass data of the rigid body.

    +

    This does not create a new instance of MassData.

    inlinegetNext():RigidBody

    Returns the next rigid body in the world.

    +

    If the next one does not exist, null will be returned.

    inlinegetNumContactLinks():Int

    Returns the number of the contact lists the rigid body is involved.

    inlinegetNumJointLinks():Int

    Returns the number of the joint links the rigid body is attached.

    inlinegetNumShapes():Int

    Returns the number of the shapes added.

    inlinegetOrientation():Quat

    Returns the rotation of the rigid body as a quaternion.

    inlinegetOrientationTo(orientation:Quat):Void

    Sets orientation to the rotation quaternion of the rigid body.

    +

    This does not create a new instance of Quat.

    inlinegetPosition():Vec3

    Returns the world position of the rigid body.

    inlinegetPositionTo(position:Vec3):Void

    Sets position to the world position of the rigid body.

    +

    This does not create a new instance of Vec3.

    inlinegetPrev():RigidBody

    Returns the previous rigid body in the world.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRotation():Mat3

    Returns the rotation matrix of the rigid body.

    inlinegetRotationFactor():Vec3

    Returns the rotation factor of the rigid body.

    inlinegetRotationTo(rotation:Mat3):Void

    Sets rotation to the rotation matrix of the rigid body.

    +

    This does not create a new instance of Mat3.

    inlinegetShapeList():Shape

    Returns the list of the shapes of the rigid body.

    inlinegetSleepTime():Float

    Returns how long the rigid body is stopping moving. This returns 0 if the body +has already slept.

    inlinegetTransform():Transform

    Returns the transform of the rigid body.

    inlinegetTransformTo(transform:Transform):Void

    Sets transform to the transform of the rigid body.

    +

    This does not create a new instance of Transform.

    inlinegetType():Int

    Returns the rigid body's type of behaviour.

    +

    See RigidBodyType class for details.

    inlinegetWorldPoint(localPoint:Vec3):Vec3

    Returns the world coordinates of the point localPoint in local coodinates.

    inlinegetWorldPointTo(localPoint:Vec3, worldPoint:Vec3):Void

    Sets worldPoint to the world coordinates of the point localPoint in local coodinates.

    +

    This does not create a new instance of Vec3.

    inlinegetWorldVector(localVector:Vec3):Vec3

    Returns the world coordinates of the vector localVector in local coodinates.

    inlinegetWorldVectorTo(localVector:Vec3, worldVector:Vec3):Void

    Sets worldVector to the world coordinates of the vector localVector in local coodinates.

    +

    This does not create a new instance of Vec3.

    inlineisSleeping():Bool

    Returns whether the rigid body is sleeping.

    removeShape(shape:Shape):Void

    Removes the shape from the rigid body.

    inlinerotate(rotation:Mat3):Void

    Rotates the rigid body by the rotation matrix rotation.

    inlinerotateXyz(eulerAngles:Vec3):Void

    Rotates the rigid body by Euler angles eulerAngles in radians.

    inlinesetAngularDamping(damping:Float):Void

    Sets the angular damping to damping.

    inlinesetAngularVelocity(angularVelocity:Vec3):Void

    Sets the angular velocity of the rigid body.

    inlinesetAutoSleep(autoSleepEnabled:Bool):Void

    Sets the rigid body's auto sleep flag.

    +

    If auto sleep is enabled, the rigid body will automatically sleep when needed.

    inlinesetGravityScale(gravityScale:Float):Void

    Sets the gravity scaling factor of the rigid body to gravityScale.

    +

    If 0 is set, the rigid body will not be affected by gravity.

    inlinesetLinearDamping(damping:Float):Void

    Sets the linear damping to damping.

    inlinesetLinearVelocity(linearVelocity:Vec3):Void

    Sets the linear velocity of the rigid body.

    inlinesetMassData(massData:MassData):Void

    Sets the mass and moment of inertia of the rigid body by the mass data massData. +The properties set by this will be overwritten when

    • some shapes are added or removed
    • the type of the rigid body is changed

    inlinesetOrientation(quaternion:Quat):Void

    Sets the rotation of the rigid body from a quaternion quaternion.

    inlinesetPosition(position:Vec3):Void

    Sets the world position of the rigid body to position.

    inlinesetRotation(rotation:Mat3):Void

    Sets the rotation matrix of the rigid body to rotation.

    inlinesetRotationFactor(rotationFactor:Vec3):Void

    Sets the rotation factor of the rigid body to rotationFactor.

    This changes moment of inertia internally, so that the change of angular velocity in global space along X, Y and Z axis will scale by rotationFactor.x, -rotationFactor.y and rotationFactor.z times respectively.

    inlinesetRotationXyz (eulerAngles:Vec3):Void

    Sets the rotation of the rigid body by Euler angles eulerAngles in radians.

    inlinesetTransform (transform:Transform):Void

    Sets the transform of the rigid body to transform.

    -

    This does not keep any references to transform.

    setType (type:Int):Void

    Sets the rigid body's type of behaviour.

    -

    See RigidBodyType class for details.

    inlinesleep ():Void

    Sets the rigid body's sleep flag true.

    -

    This also resets the sleeping timer of the rigid body.

    inlinetranslate (translation:Vec3):Void

    Translates the position of the rigid body by translation.

    inlinewakeUp ():Void

    Sets the rigid body's sleep flag false.

    -

    This also resets the sleeping timer of the rigid body.

    \ No newline at end of file +rotationFactor.y and rotationFactor.z times respectively.

    inlinesetRotationXyz(eulerAngles:Vec3):Void

    Sets the rotation of the rigid body by Euler angles eulerAngles in radians.

    inlinesetTransform(transform:Transform):Void

    Sets the transform of the rigid body to transform.

    +

    This does not keep any references to transform.

    setType(type:Int):Void

    Sets the rigid body's type of behaviour.

    +

    See RigidBodyType class for details.

    inlinesleep():Void

    Sets the rigid body's sleep flag true.

    +

    This also resets the sleeping timer of the rigid body.

    inlinetranslate(translation:Vec3):Void

    Translates the position of the rigid body by translation.

    inlinewakeUp():Void

    Sets the rigid body's sleep flag false.

    +

    This also resets the sleeping timer of the rigid body.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html index a779890..935eaa7 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyConfig.html @@ -8,9 +8,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A rigid body configuration is used for constructions of rigid bodies. An instance of this +

    A rigid body configuration is used for constructions of rigid bodies. An instance of this class can safely be reused, as a rigid body will not have any references to a field of -this class.

    Constructor

    new ()

    Default constructor.

    Variables

    angularDamping:Float

    The damping coefficient of the angular velocity. Set positive values to -gradually reduce the angular velocity.

    angularVelocity:Vec3

    The initial value of the rigid body's angular velocity.

    autoSleep:Bool

    Whether to automatically sleep the rigid body when it stops moving -for a certain period of time, namely Setting.sleepingTimeThreshold.

    linearDamping:Float

    The damping coefficient of the linear velocity. Set positive values to -gradually reduce the linear velocity.

    linearVelocity:Vec3

    The initial value of the rigid body's linear velocity.

    position:Vec3

    The world position of the rigid body's center of gravity.

    rotation:Mat3

    The rotation matrix of the rigid body.

    type:Int

    The rigid body's motion type. See RigidBodyType for details.

    \ No newline at end of file +this class.

    Constructor

    new()

    Default constructor.

    Variables

    angularDamping:Float

    The damping coefficient of the angular velocity. Set positive values to +gradually reduce the angular velocity.

    angularVelocity:Vec3

    The initial value of the rigid body's angular velocity.

    autoSleep:Bool

    Whether to automatically sleep the rigid body when it stops moving +for a certain period of time, namely Setting.sleepingTimeThreshold.

    linearDamping:Float

    The damping coefficient of the linear velocity. Set positive values to +gradually reduce the linear velocity.

    linearVelocity:Vec3

    The initial value of the rigid body's linear velocity.

    position:Vec3

    The world position of the rigid body's center of gravity.

    rotation:Mat3

    The rotation matrix of the rigid body.

    type:Int

    The rigid body's motion type. See RigidBodyType for details.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/RigidBodyType.html b/docs/oimo/dynamics/rigidbody/RigidBodyType.html index 1624714..032c86f 100644 --- a/docs/oimo/dynamics/rigidbody/RigidBodyType.html +++ b/docs/oimo/dynamics/rigidbody/RigidBodyType.html @@ -6,9 +6,9 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    The list of a rigid body's motion types.

    Static variables

    @:value(_DYNAMIC)staticread onlyDYNAMIC:Int = _DYNAMIC

    Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia -tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved.

    @:value(_KINEMATIC)staticread onlyKINEMATIC:Int = _KINEMATIC

    Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except +

    The list of a rigid body's motion types.

    Static variables

    @:value(_DYNAMIC)staticread onlyDYNAMIC:Int = _DYNAMIC

    Represents a dynamic rigid body. A dynamic rigid body has finite mass (and usually inertia +tensor). The rigid body is affected by gravity, or by constraints the rigid body is involved.

    @:value(_KINEMATIC)staticread onlyKINEMATIC:Int = _KINEMATIC

    Represents a kinematic rigid body. A kinematic rigid body is similar to a static one, except that it can have non-zero linear and angular velocities. This is useful for overlapping rigid -bodies to pre-computed motions.

    @:value(_STATIC)staticread onlySTATIC:Int = _STATIC

    Represents a static rigid body. A static rigid body has zero velocities and infinite mass +bodies to pre-computed motions.

    @:value(_STATIC)staticread onlySTATIC:Int = _STATIC

    Represents a static rigid body. A static rigid body has zero velocities and infinite mass and inertia tensor. The rigid body is not affected by any force or impulse, such as gravity, -constraints, or external forces or impulses added by an user.

    \ No newline at end of file +constraints, or external forces or impulses added by an user.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/Shape.html b/docs/oimo/dynamics/rigidbody/Shape.html index a9b53b3..fe005a1 100644 --- a/docs/oimo/dynamics/rigidbody/Shape.html +++ b/docs/oimo/dynamics/rigidbody/Shape.html @@ -8,17 +8,17 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body +

    A shape is a component of a rigid body. It attaches a collision geometry to the parent rigid body with some physical properties such as coefficients of friction and restitution. The collision -geometry can locally be transformed relative to the parent rigid body's center of gravity.

    Constructor

    new (config:ShapeConfig)

    Creates a new shape by configuration config.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlinegetAabb ():Aabb

    Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a -parent rigid body.

    inlinegetAabbTo (aabb:Aabb):Void

    Sets aabb to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a +geometry can locally be transformed relative to the parent rigid body's center of gravity.

    Constructor

    new(config:ShapeConfig)

    Creates a new shape by configuration config.

    Variables

    userData:Any

    Extra field that users can use for their own purposes.

    Methods

    inlinegetAabb():Aabb

    Returns the AABB of the shape. The AABB may be incorrect if the shape doesn't have a +parent rigid body.

    inlinegetAabbTo(aabb:Aabb):Void

    Sets aabb to the AABB of the shape. The AABB may be incorrect if the shape doesn't have a parent rigid body.

    -

    This does not create a new instance of AABB.

    inlinegetCollisionGroup ():Int

    Returns the collision group bits the shape belongs to.

    inlinegetCollisionMask ():Int

    Returns the collision mask bits of the shape.

    inlinegetContactCallback ():ContactCallback

    Returns the contact callback of the shape.

    inlinegetDensity ():Float

    Returns the density of the shape.

    inlinegetFriction ():Float

    Returns the coefficient of friction.

    inlinegetGeometry ():Geometry

    Returns the colision geometry of the shape.

    inlinegetLocalTransform ():Transform

    Returns the transform of the shape relative to the parent rigid body's transform.

    inlinegetLocalTransformTo (transform:Transform):Void

    Sets transform to the transform of the shape relative to the parent rigid body's +

    This does not create a new instance of AABB.

    inlinegetCollisionGroup():Int

    Returns the collision group bits the shape belongs to.

    inlinegetCollisionMask():Int

    Returns the collision mask bits of the shape.

    inlinegetContactCallback():ContactCallback

    Returns the contact callback of the shape.

    inlinegetDensity():Float

    Returns the density of the shape.

    inlinegetFriction():Float

    Returns the coefficient of friction.

    inlinegetGeometry():Geometry

    Returns the colision geometry of the shape.

    inlinegetLocalTransform():Transform

    Returns the transform of the shape relative to the parent rigid body's transform.

    inlinegetLocalTransformTo(transform:Transform):Void

    Sets transform to the transform of the shape relative to the parent rigid body's transform.

    -

    This does not create a new instance of Transform.

    inlinegetNext ():Shape

    Returns the next shape in the rigid body.

    -

    If the next one does not exist, null will be returned.

    inlinegetPrev ():Shape

    Returns the previous shape in the rigid body.

    -

    If the previous one does not exist, null will be returned.

    inlinegetRestitution ():Float

    Returns the coefficient of restitution.

    inlinegetRigidBody ():RigidBody

    Returns the parent rigid body. This returns null if the shape doesn't have a parent -rigid body.

    inlinegetTransform ():Transform

    Returns the world transform of the shape.

    inlinegetTransformTo (transform:Transform):Void

    Sets transform to the world transform of the shape.

    -

    This does not create a new instance of Transform.

    inlinesetCollisionGroup (collisionGroup:Int):Void

    Sets the shape's collision group bits to collisionGroup.

    inlinesetCollisionMask (collisionMask:Int):Void

    Sets the shape's collision mask bits to collisionMask.

    inlinesetContactCallback (callback:ContactCallback):Void

    Sets the contact callback of the shape to callback.

    inlinesetDensity (density:Float):Void

    Sets the density of the shape to density.

    -

    This affects the parent rigid body's mass data.

    inlinesetFriction (friction:Float):Void

    Sets the coefficient of friction to friction.

    inlinesetLocalTransform (transform:Transform):Void

    Sets the shape's transform to transform relative to the parent rigid body's transform.

    -

    This affects the parent rigid body's mass data.

    inlinesetRestitution (restitution:Float):Void

    Sets the coefficient of restitution to restitution.

    \ No newline at end of file +

    This does not create a new instance of Transform.

    inlinegetNext():Shape

    Returns the next shape in the rigid body.

    +

    If the next one does not exist, null will be returned.

    inlinegetPrev():Shape

    Returns the previous shape in the rigid body.

    +

    If the previous one does not exist, null will be returned.

    inlinegetRestitution():Float

    Returns the coefficient of restitution.

    inlinegetRigidBody():RigidBody

    Returns the parent rigid body. This returns null if the shape doesn't have a parent +rigid body.

    inlinegetTransform():Transform

    Returns the world transform of the shape.

    inlinegetTransformTo(transform:Transform):Void

    Sets transform to the world transform of the shape.

    +

    This does not create a new instance of Transform.

    inlinesetCollisionGroup(collisionGroup:Int):Void

    Sets the shape's collision group bits to collisionGroup.

    inlinesetCollisionMask(collisionMask:Int):Void

    Sets the shape's collision mask bits to collisionMask.

    inlinesetContactCallback(callback:ContactCallback):Void

    Sets the contact callback of the shape to callback.

    inlinesetDensity(density:Float):Void

    Sets the density of the shape to density.

    +

    This affects the parent rigid body's mass data.

    inlinesetFriction(friction:Float):Void

    Sets the coefficient of friction to friction.

    inlinesetLocalTransform(transform:Transform):Void

    Sets the shape's transform to transform relative to the parent rigid body's transform.

    +

    This affects the parent rigid body's mass data.

    inlinesetRestitution(restitution:Float):Void

    Sets the coefficient of restitution to restitution.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/ShapeConfig.html b/docs/oimo/dynamics/rigidbody/ShapeConfig.html index 399b498..de7969f 100644 --- a/docs/oimo/dynamics/rigidbody/ShapeConfig.html +++ b/docs/oimo/dynamics/rigidbody/ShapeConfig.html @@ -8,16 +8,16 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    A shape configuration is used for construction of shapes. An instance of +

    A shape configuration is used for construction of shapes. An instance of this class can safely be reused as a shape will not have any references -of a field of this class.

    Constructor

    new ()

    Default constructor.

    Variables

    collisionGroup:Int

    The collision group bits the shape belongs to. This is used for collision +of a field of this class.

    Constructor

    new()

    Default constructor.

    Variables

    collisionGroup:Int

    The collision group bits the shape belongs to. This is used for collision filtering.

    Two shapes shape1 and shape2 will collide only if both shape1.collisionGroup & shape2.collisionMask and -shape2.collisionGroup & shape1.collisionMask are not zero.

    collisionMask:Int

    The collision mask bits of the shape. This is used for collision +shape2.collisionGroup & shape1.collisionMask are not zero.

    collisionMask:Int

    The collision mask bits of the shape. This is used for collision filtering.

    Two shapes shape1 and shape2 will collide only if both shape1.collisionGroup & shape2.collisionMask and -shape2.collisionGroup & shape1.collisionMask are not zero.

    contactCallback:ContactCallback

    The contact callback of the shape. The callback methods are called -when contact events the shape is involved occurred.

    density:Float

    The density of the shape, usually in Kg/m^3.

    friction:Float

    The coefficient of friction of the shape.

    geometry:Geometry

    The collision geometry of the shape.

    position:Vec3

    The shape's local position relative to the parent rigid body's origin.

    restitution:Float

    The coefficient of restitution of the shape.

    rotation:Mat3

    The shape's local rotation matrix relative to the parent rigid body's -rotation.

    \ No newline at end of file +shape2.collisionGroup & shape1.collisionMask are not zero.

    contactCallback:ContactCallback

    The contact callback of the shape. The callback methods are called +when contact events the shape is involved occurred.

    density:Float

    The density of the shape, usually in Kg/m^3.

    friction:Float

    The coefficient of friction of the shape.

    geometry:Geometry

    The collision geometry of the shape.

    position:Vec3

    The shape's local position relative to the parent rigid body's origin.

    restitution:Float

    The coefficient of restitution of the shape.

    rotation:Mat3

    The shape's local rotation matrix relative to the parent rigid body's +rotation.

    \ No newline at end of file diff --git a/docs/oimo/dynamics/rigidbody/index.html b/docs/oimo/dynamics/rigidbody/index.html index 3230454..226f18b 100644 --- a/docs/oimo/dynamics/rigidbody/index.html +++ b/docs/oimo/dynamics/rigidbody/index.html @@ -6,7 +6,7 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo.dynamics.rigidbody

    OimoPhysics API Documentation

    ..
    MassData

    This class holds mass and moment of inertia for a rigid body.

    RigidBody

    A rigid body. To add a rigid body to a physics world, create a RigidBody +

    oimo.dynamics.rigidbody

    OimoPhysics API Documentation

    ..
    MassData

    This class holds mass and moment of inertia for a rigid body.

    RigidBody

    A rigid body. To add a rigid body to a physics world, create a RigidBody instance, create and add shapes via RigidBody.addShape, and add the rigid body to the physics world through World.addRigidBody. Rigid bodies have three motion types: dynamic, static, and kinematic. See RigidBodyType for @@ -16,4 +16,4 @@ with some physical properties such as coefficients of friction and restitution. The collision geometry can locally be transformed relative to the parent rigid body's center of gravity.

    ShapeConfig

    A shape configuration is used for construction of shapes. An instance of this class can safely be reused as a shape will not have any references -of a field of this class.

    \ No newline at end of file +of a field of this class.

    \ No newline at end of file diff --git a/docs/oimo/index.html b/docs/oimo/index.html index d881332..3732e71 100644 --- a/docs/oimo/index.html +++ b/docs/oimo/index.html @@ -6,4 +6,4 @@ display: inline-block; float: none; text-shadow: 0 0 0 transparent; -

    oimo

    OimoPhysics API Documentation

    ..
    collision
    common
    dynamics
    \ No newline at end of file +

    oimo

    OimoPhysics API Documentation

    ..
    collision
    common
    dynamics
    \ No newline at end of file diff --git a/docs/styles.css b/docs/styles.css index e23a3d0..ec09a54 100644 --- a/docs/styles.css +++ b/docs/styles.css @@ -1,26 +1,31 @@ .main-content { - margin-top:15px; + margin-top: 15px; } .dark { - background: rgb(20,20,25); - color: white; + background: rgb(20, 20, 25); + color: white; } + .dark a { - color: white; + color: white; } + .dark a:hover { - color: rgb(200,200,200); + color: rgb(200, 200, 200); } + .dark blockquote { - border-left: 3px solid rgb(126,126,129); + border-left: 3px solid rgb(126, 126, 129); } + .dark blockquote small { - color: white; - font-weight: bold; + color: white; + font-weight: bold; } + .dark blockquote small:before { - display: none; + display: none; } /* #nav { */ @@ -30,142 +35,239 @@ /* } */ /*#content .header { position:absolute; background:rgba(255,255,255,0.9); left:250px; right:15px; padding:0px 12px; border-bottom:1px solid #EEE;}*/ /*#content .body { padding-top:80px;}*/ -.nav-list {padding-right: 0; } -.nav-list>li>a, .nav-list .nav-header {margin-right:0;} -.nav-list>li>a.treeLink {padding-left:20px;} -.nav-list a { overflow: hidden; font-size:14px; text-shadow: none!important;} -.nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus { - background:#999; - color:#fff; +.nav-list { + padding-right: 0; +} + +.nav-list>li>a, +.nav-list .nav-header { + margin-right: 0; +} + +.nav-list>li>a.treeLink { + padding-left: 20px; +} + +.nav-list a { + overflow: hidden; + text-overflow: ellipsis; + font-size: 14px; + text-shadow: none !important; +} + +.nav-list>.active>a.treeLink, +.nav-list>.active>a.treeLink:hover, +.nav-list>.active>a.treeLink:focus { + background: #999; + color: #fff; +} + +.nav>li>a.selected, +.nav>li>a:hover { + background-color: #00000010; } .nav-list li i.fa { - height: 16px; - width: 16px; - color: rgb(200,200,200); - font-weight:normal; - font-size:16px; + height: 16px; + width: 16px; + color: rgb(200, 200, 200); + font-weight: normal; + font-size: 16px; + padding-right: 5px; } -.viewsource {float:right} +.viewsource { + float: right +} /** Footer sitemap **/ -footer{ - margin-top:40px; - font-size:14px; +footer { + font-size: 14px; + margin-top: auto; } + +.main-content { + margin-bottom: 40px; +} + .section.site-footer { - border-bottom: 0px; + border-bottom: 0px; } + .copyright { - padding: 6px; - overflow: hidden; - text-align:center; - margin: 40px 0; + padding: 6px; + overflow: hidden; + text-align: center; + margin: 40px 0; +} + +.dark .copyright a { + color: #F48821; } -.dark .copyright a { color:#F48821; } /* .doc { margin-top:16px; } */ -.toggle-hide { display:block; } -.toggle-show { display:none; } -.toggle-on .toggle-hide { display:none !important; } -.toggle-on .toggle-show { display:block !important; } -.related-types .toggle-hide { padding-top:4px; } -/* .availability { margin-left:14px; color:#93a1a1; } */ -/* .doc { margin-left:14px; } */ +.toggle-hide { + display: block; +} + +.toggle-show { + display: none; +} + +.toggle-on .toggle-hide { + display: none !important; +} +.toggle-on .toggle-show { + display: block !important; +} +.related-types .toggle-hide { + padding-top: 4px; +} /* #nav li { list-style-type: none; } */ -#nav .expando > ul { display:none; } -#nav .expando.expanded > ul { display:inherit; } +#nav .expando>ul { + display: none; +} + +#nav .expando.expanded>ul { + display: inherit; +} + /* #nav ul, #nav li li { margin-left: 10px; } */ -#nav img { padding-right:4px; } -#nav .pack { display:none; } +#nav img { + padding-right: 4px; +} + +#nav .pack { + display: none; +} /* .nav .nav li { margin-left: 14px; } */ -.dropdown { padding: 0 9px; } +.dropdown { + padding: 0 9px; +} + +#nav.searching .expando>ul { + display: inherit; +} -#nav.searching .expando > ul { display:inherit; } -#nav.searching .expando > a { display:none; } -#nav.searching ul { margin-left:0px; } -#nav.searching .pack { display:inline; } -#nav.searching .nav-list .nav-list { padding-left: 0; padding-right: 0; } +#nav.searching .expando>a { + display: none; +} + +#nav.searching ul { + margin-left: 0px; +} + +#nav.searching .pack { + display: inline; +} + +#nav.searching .nav-list .nav-list { + padding-left: 0; + padding-right: 0; +} .nav-header { - text-transform: none; - font-size:14px; - color:#555; - text-shadow: none; + text-transform: none; + font-size: 14px; + color: #555; + text-shadow: none; } .availability { - color: #e48931; - font-size: 90%; + color: #e48931; + font-size: 90%; } -h3 code { - background:none; - box-shadow: 0 0 15px rgb(240, 240, 240); - padding: 4px 8px; - white-space: inherit; - display: inline-block; - line-height: 1.5em; - margin-left: -10px; +.section-availability { + color: #e48931; } -h3 span.label, .label-meta { - margin-right: 5px; +h3 code { + background: none; + box-shadow: 0 0 15px rgb(240, 240, 240); + padding: 4px 8px; + white-space: inherit; + display: inline-block; + line-height: 1.5em; + margin-left: -10px; +} + +h3 span.label, +.label-meta { + margin-right: 5px; } .label.label-meta { - background:#5959AC; + background: #5959AC; } -/* hide meta that has doesn't belong in the API (implementation details) */ -.label-meta-impl, .label-meta-value, .label-meta-has_untyped, .label-meta-hlNative, .label-meta-access, .label-meta-allow, .label-meta-keep, .label-meta-keepInit, .label-meta-keepSub, .label-meta-dox, .label-meta-noCompletion, .label-meta-directlyUsed, .label-meta-build, .label-meta-autoBuild, .label-meta-genericBuild, .label-meta-analyzer, .label-meta-enum, .label-meta-extern { - display:none; +/* only show some specific whitelisted metadata */ + +.label-meta { + display: none; } -.label-meta.label-meta-from, .label-meta.label-meta-to { - background:#a93685; +.label-meta-callable, +.label-meta-commutative, +.label-meta-op, +.label-meta-arrayAccess, +.label-meta-resolve, +.label-meta-to, +.label-meta-from, +.label-meta-using, +.label-meta-forward, +.label-meta-forwardStatics { + display: inline; } .alert.alert-deprecated { - font-size: 90%; - margin-bottom: 10px; - padding: 4px 35px 4px 14px; + font-size: 90%; + margin-bottom: 10px; + padding: 4px 35px 4px 14px; } code { - font-family: Monaco,Menlo,Consolas,"Courier New",monospace; - font-weight: normal; - color: #666; - background-color: #f7f7f9; - border: 1px solid #e1e1e8; - white-space: nowrap; - border-radius: 3px; - padding: 2px 4px; - font-size: 13px; + font-family: Monaco, Menlo, Consolas, "Courier New", monospace; + font-weight: normal; + color: #666; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; + white-space: nowrap; + border-radius: 3px; + padding: 2px 4px; + font-size: 13px; } code .identifier { - font-family:bold 14px "Helvetica Neue",Helvetica,Arial,sans-serif; - color:#002b36; - padding: 0 0 0 5px; + font-family: bold 14px "Helvetica Neue", Helvetica, Arial, sans-serif; + color: #002b36; + padding: 0 0 0 5px; } -code .identifier, code.type { - font-weight: bold; +code .identifier, +code.type { + font-weight: bold; } /* code { background:#FDF6E3; color:#002b36; tab-size:4; } [> light <] */ -code a { text-decoration:none; } -code a:hover { text-decoration:underline; } +code a { + text-decoration: none; +} + +code a:hover { + text-decoration: underline; +} /*code.dark { background:#272822; color:#F8F8F2; border:none; } */ -code .type { color:#268bd2; } +code .type { + color: #268bd2; +} + /* code .keyword { color:#dc322f; } */ /* code .directive { color:#2aa198; } */ /* code .constant { color:#AE81FF; } */ @@ -178,200 +280,248 @@ code .type { color:#268bd2; } /* .navbar-fixed-top .navbar-inner, */ /* .navbar-fixed-bottom .navbar-inner { padding: 0; } */ +html, body { - padding: 0px; - font-size:16px; - font-family:"Open Sans", sans-serif; - color: #1e1e1e; - line-height: 1.5; + height: 100%; + margin: 0; } -h1, h2, h3, h4, h5, h6 { - font-family: "Source Sans Pro", sans-serif; - font-weight: 600; - word-wrap: break-word; +body { + margin: 0px; + padding: 0px; + font-size: 16px; + font-family: "Open Sans", sans-serif; + color: #1e1e1e; + line-height: 1.5; + display: flex; + flex-direction: column; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: "Source Sans Pro", sans-serif; + font-weight: 600; + word-wrap: break-word; } + h1 { - font-size: 36px; - color: #171717; + font-size: 36px; + color: #171717; } + h1 small { - font-size: 14px; - color: #999; - font-weight: normal; + font-size: 14px; + color: #999; + font-weight: normal; } + h2 { - font-size: 30px; + font-size: 30px; } + h3 { - font-size: 24px; + font-size: 24px; } + h4 { - font-size: 20px; + font-size: 20px; } -h5, h5 code { - font-size: 18px; + +h5, +h5 code { + font-size: 18px; } + h6 { - font-size: 16px; + font-size: 16px; } .sidebar-nav { - padding: 9px 0; + padding: 9px 0; +} + +#explorer { + max-height: 70vh; + overflow-y: auto; } #searchForm { - padding: 0 9px; - margin-bottom:10px; + padding: 0 9px; + margin-bottom: 10px; } #searchForm .control-group { - margin: 0; + margin: 0; } .indent { - margin-left: 20px; - border-left: 5px solid #eeeeee; - padding-left:20px; + margin-left: 20px; + border-left: 5px solid #eeeeee; + padding-left: 20px; } table.params { - border-left: 5px solid #eeeeee; - margin-left: 20px; + border-left: 5px solid #eeeeee; + margin-left: 20px; } + table.params th { - background:#fcfcfc; + background: #fcfcfc; } .doc-main { - margin-bottom: 40px; + margin-bottom: 40px; } -.doc-main p { font-style: italic; } - .section { - border-bottom: 1px solid #eee; + border-bottom: 1px solid #eee; } .table p { - margin: 3px 0; + margin: 3px 0; } -.table th, .table td { - border-top: 0; - border-bottom: 1px solid #ccc; +.table th, +.table td { + border-top: 0; + border-bottom: 1px solid #ccc; } .table a small { - color: #666; + color: #666; } .table .fa { - color: rgb(200,200,200); - margin-right:5px; + color: rgb(200, 200, 200); + margin-right: 5px; } .javadoc { - /* font-weight: normal; */ - /* font-size: small; */ - margin-top: 20px; - font-style: italic; + /* font-weight: normal; */ + /* font-size: small; */ + margin-top: 20px; } + .inline-content * { - display: inline; + display: inline; } + /** * Stuff for input-block-level: * http://stackoverflow.com/questions/13306670/bootstrap-prepended-and-appended-input-how-to-max-input-field-width */ .input-append.input-block-level, .input-prepend.input-block-level { - display: table; + display: table; } + .input-append.input-block-level .add-on, .input-prepend.input-block-level .add-on { - display: table-cell; + display: table-cell; } -.input-append.input-block-level > input, -.input-prepend.input-block-level > input { - box-sizing: border-box; /* use bootstrap mixin or include vendor variants */ - -moz-box-sizing: border-box; /* for Firefox */ - -webkit-box-sizing: border-box; /* for Firefox */ - -ms-box-sizing: border-box; /* for Firefox */ - -o-box-sizing: border-box; /* for Firefox */ - display: table; /* table-cell is not working well in Chrome for small widths */ - min-height: inherit; - width: 100%; + +.input-append.input-block-level>input, +.input-prepend.input-block-level>input { + box-sizing: border-box; + /* use bootstrap mixin or include vendor variants */ + -moz-box-sizing: border-box; + /* for Firefox */ + -webkit-box-sizing: border-box; + /* for Firefox */ + -ms-box-sizing: border-box; + /* for Firefox */ + -o-box-sizing: border-box; + /* for Firefox */ + display: table; + /* table-cell is not working well in Chrome for small widths */ + min-height: inherit; + width: 100%; } -.input-append.input-block-level > input { - border-right: 0; + +.input-append.input-block-level>input { + border-right: 0; } -.input-prepend.input-block-level > input { - border-left: 0; + +.input-prepend.input-block-level>input { + border-left: 0; } .field { - padding-bottom: 10px; + padding-bottom: 10px; } -.field + .field { - border-top: 1px solid #eee; - margin-top: 10px; + +.field+.field { + border-top: 1px solid #eee; + margin-top: 10px; } + .fields { - margin-left: 40px; + margin-left: 40px; } + .field-source { - margin-top: 15px; - visibility: hidden; + margin-top: 15px; + visibility: hidden; } + .field:hover .field-source { - visibility: inherit; + visibility: inherit; } pre.example { - position: relative; - padding-top: 34.5px; + position: relative; + padding-top: 34.5px; } + pre.example:before { - position: absolute; - top: -1px; - left: -1px; + position: absolute; + top: -1px; + left: -1px; - content: "Example"; - color: #999; - padding: 2px 6px; - background: #fff; - font-weight: bold; - font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; + content: "Example"; + color: #999; + padding: 2px 6px; + background: #fff; + font-weight: bold; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - -moz-border-radius: 4px 0; - -ms-border-radius: 4px 0; - -webkit-border-radius: 4px 0; - border-radius: 4px 0; - border: 1px solid rgba(0,0,0,0.15); + -moz-border-radius: 4px 0; + -ms-border-radius: 4px 0; + -webkit-border-radius: 4px 0; + border-radius: 4px 0; + border: 1px solid rgba(0, 0, 0, 0.15); } .inherited-fields { - padding: 5px 20px; - margin-top:1em; - background:#fcfcfc; + padding: 5px 20px; + margin-top: 1em; + background: #fcfcfc; } @media (max-width: 767px) { - .navbar-fixed-top, .navbar-fixed-bottom, .navbar-static-top { - margin-right: 0; - margin-left: 0; - } - .navbar .divider { - display: none; - } - - .main-content { - margin-top:0px; - } + + .navbar-fixed-top, + .navbar-fixed-bottom, + .navbar-static-top { + margin-right: 0; + margin-left: 0; + } + + .navbar .divider { + display: none; + } + + .main-content { + margin-top: 0px; + } } + @media (max-width: 979px) { - .main-content { - margin-top:15px; - } -} + .main-content { + margin-top: 15px; + } +} \ No newline at end of file diff --git a/exports/src/export/js/Export.hx b/exports/src/export/js/Export.hx index d19a391..899d130 100644 --- a/exports/src/export/js/Export.hx +++ b/exports/src/export/js/Export.hx @@ -1,6 +1,7 @@ package export.js; -import oimo.dynamics.common.DebugDraw; +import js.Syntax; +// paste imports from /js_imports.txt import oimo.collision.broadphase.BroadPhase; import oimo.collision.geometry.Geometry; import oimo.collision.geometry.ConvexGeometry; @@ -63,6 +64,7 @@ import oimo.dynamics.callback.AabbTestCallback; import oimo.dynamics.callback.ContactCallback; import oimo.dynamics.callback.RayCastCallback; import oimo.dynamics.callback.RayCastClosest; +import oimo.dynamics.common.DebugDraw; import oimo.dynamics.common.DebugDrawStyle; import oimo.dynamics.common.Performance; import oimo.dynamics.constraint.ConstraintSolver; @@ -123,10 +125,10 @@ import oimo.dynamics.rigidbody.ShapeConfig; * main class to generate OimoPhysics.js */ class Export { - static function main():Void { - untyped __js__(' + static inline function main():Void { + // paste exports from /js_exports.txt + Syntax.code(' window["OIMO"] = {}; - window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; window["OIMO"]["BroadPhase"] = oimo_collision_broadphase_BroadPhase; oimo_collision_broadphase_BroadPhase.prototype["createProxy"] = oimo_collision_broadphase_BroadPhase.prototype.createProxy; oimo_collision_broadphase_BroadPhase.prototype["destroyProxy"] = oimo_collision_broadphase_BroadPhase.prototype.destroyProxy; @@ -471,6 +473,7 @@ class Export { window["OIMO"]["RayCastClosest"] = oimo_dynamics_callback_RayCastClosest; oimo_dynamics_callback_RayCastClosest.prototype["clear"] = oimo_dynamics_callback_RayCastClosest.prototype.clear; oimo_dynamics_callback_RayCastClosest.prototype["process"] = oimo_dynamics_callback_RayCastClosest.prototype.process; + window["OIMO"]["DebugDraw"] = oimo_dynamics_common_DebugDraw; window["OIMO"]["DebugDrawStyle"] = oimo_dynamics_common_DebugDrawStyle; window["OIMO"]["Performance"] = oimo_dynamics_common_Performance; window["OIMO"]["ConstraintSolver"] = oimo_dynamics_constraint_ConstraintSolver; @@ -736,7 +739,7 @@ class Export { oimo_dynamics_rigidbody_RigidBody.prototype["getWorldVectorTo"] = oimo_dynamics_rigidbody_RigidBody.prototype.getWorldVectorTo; oimo_dynamics_rigidbody_RigidBody.prototype["getNumShapes"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumShapes; oimo_dynamics_rigidbody_RigidBody.prototype["getShapeList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getShapeList; - oimo_dynamics_rigidbody_RigidBody.prototype["getNumContectLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContectLinks; + oimo_dynamics_rigidbody_RigidBody.prototype["getNumContactLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumContactLinks; oimo_dynamics_rigidbody_RigidBody.prototype["getContactLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getContactLinkList; oimo_dynamics_rigidbody_RigidBody.prototype["getNumJointLinks"] = oimo_dynamics_rigidbody_RigidBody.prototype.getNumJointLinks; oimo_dynamics_rigidbody_RigidBody.prototype["getJointLinkList"] = oimo_dynamics_rigidbody_RigidBody.prototype.getJointLinkList; diff --git a/minify-js.sh b/minify-js.sh new file mode 100644 index 0000000..bbfd52b --- /dev/null +++ b/minify-js.sh @@ -0,0 +1 @@ +java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file bin/js/OimoPhysics.min.js --js bin/js/OimoPhysics.js --externs js_externs.txt diff --git a/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx b/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx index db63af4..2a326f1 100644 --- a/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx +++ b/src/oimo/collision/narrowphase/detector/BoxBoxDetector.hx @@ -1,4 +1,5 @@ package oimo.collision.narrowphase.detector; + import haxe.ds.Vector; import oimo.collision.geometry.*; import oimo.collision.narrowphase.*; @@ -391,27 +392,27 @@ class BoxBoxDetector extends Detector { var refH:Float; switch (mId) { - case 0: // x+ or x- - M.vec3_assign(refCenter, sx1); - M.vec3_assign(refNormal, x1); - M.vec3_assign(refX, y1); - M.vec3_assign(refY, z1); - refW = h1; - refH = d1; - case 1: // y+ or y- - M.vec3_assign(refCenter, sy1); - M.vec3_assign(refNormal, y1); - M.vec3_assign(refX, z1); - M.vec3_assign(refY, x1); - refW = d1; - refH = w1; - case _: // z+ or z- - M.vec3_assign(refCenter, sz1); - M.vec3_assign(refNormal, z1); - M.vec3_assign(refX, x1); - M.vec3_assign(refY, y1); - refW = w1; - refH = h1; + case 0: // x+ or x- + M.vec3_assign(refCenter, sx1); + M.vec3_assign(refNormal, x1); + M.vec3_assign(refX, y1); + M.vec3_assign(refY, z1); + refW = h1; + refH = d1; + case 1: // y+ or y- + M.vec3_assign(refCenter, sy1); + M.vec3_assign(refNormal, y1); + M.vec3_assign(refX, z1); + M.vec3_assign(refY, x1); + refW = d1; + refH = w1; + case _: // z+ or z- + M.vec3_assign(refCenter, sz1); + M.vec3_assign(refNormal, z1); + M.vec3_assign(refX, x1); + M.vec3_assign(refY, y1); + refW = w1; + refH = h1; } if (mSign < 0) { // x- or y- or z- @@ -464,18 +465,18 @@ class BoxBoxDetector extends Detector { var incV4:IVec3; switch (incId) { - case 0: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "x+"); - case 1: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "x-"); - case 2: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "y+"); - case 3: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "y-"); - case 4: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "z+"); - case _: - BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "z-"); + case 0: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "x+"); + case 1: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "x-"); + case 2: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "y+"); + case 3: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "y-"); + case 4: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "z+"); + case _: + BoxBoxDetectorMacro.getBoxFace(incV1, incV2, incV3, incV4, sx2, sy2, sz2, "z-"); } M.vec3_add(incV1, incV1, c12); @@ -540,9 +541,12 @@ class BoxBoxDetector extends Detector { var dx:Float = M.vec3_dot(axis, sx); var dy:Float = M.vec3_dot(axis, sy); var dz:Float = M.vec3_dot(axis, sz); - if (dx < 0) dx = -dx; - if (dy < 0) dy = -dy; - if (dz < 0) dz = -dz; + if (dx < 0) + dx = -dx; + if (dy < 0) + dy = -dy; + if (dz < 0) + dz = -dz; return dx + dy + dz; } @@ -552,8 +556,10 @@ class BoxBoxDetector extends Detector { extern inline function project2(axis:IVec3, sx:IVec3, sy:IVec3):Float { var dx:Float = M.vec3_dot(axis, sx); var dy:Float = M.vec3_dot(axis, sy); - if (dx < 0) dx = -dx; - if (dy < 0) dy = -dy; + if (dx < 0) + dx = -dx; + if (dy < 0) + dy = -dy; return dx + dy; } } @@ -606,6 +612,7 @@ private class FaceClipper { public var h:Float; public var numVertices:Int; public var vertices:Vector; + var numTmpVertices:Int; var tmpVertices:Vector; @@ -651,7 +658,8 @@ private class FaceClipper { * Reduces vertices up to four. */ public function reduce():Void { - if (numVertices < 4) return; + if (numVertices < 4) + return; // TODO: maximize area var max1:Float = MathUtil.NEGATIVE_INFINITY; @@ -671,21 +679,32 @@ private class FaceClipper { var v:IncidentVertex = vertices[i]; var dot1:Float = v.x * e1x + v.y * e1y; var dot2:Float = v.x * e2x + v.y * e2y; - if (dot1 > max1) { + if (i == 0) { // issue #32 max1 = dot1; max1V = v; - } - if (dot1 < min1) { min1 = dot1; min1V = v; - } - if (dot2 > max2) { max2 = dot2; max2V = v; - } - if (dot2 < min2) { min2 = dot2; min2V = v; + } else { + if (dot1 > max1) { + max1 = dot1; + max1V = v; + } + if (dot1 < min1) { + min1 = dot1; + min1V = v; + } + if (dot2 > max2) { + max2 = dot2; + max2V = v; + } + if (dot2 < min2) { + min2 = dot2; + min2V = v; + } } } diff --git a/src/oimo/dynamics/constraint/joint/GenericJoint.hx b/src/oimo/dynamics/constraint/joint/GenericJoint.hx index 493fe58..47e2474 100644 --- a/src/oimo/dynamics/constraint/joint/GenericJoint.hx +++ b/src/oimo/dynamics/constraint/joint/GenericJoint.hx @@ -310,7 +310,7 @@ class GenericJoint extends Joint { * Returns the rotational spring and damper settings along the rotation axes of the relative x-y-z Euler angles. */ public inline function getRotationalSpringDampers():Array { - return _translSds.toArray(); + return _rotSds.toArray(); } /** diff --git a/src/oimo/dynamics/rigidbody/RigidBody.hx b/src/oimo/dynamics/rigidbody/RigidBody.hx index 0224ab7..97fba13 100644 --- a/src/oimo/dynamics/rigidbody/RigidBody.hx +++ b/src/oimo/dynamics/rigidbody/RigidBody.hx @@ -1,4 +1,5 @@ package oimo.dynamics.rigidbody; + import oimo.collision.geometry.*; import oimo.common.*; import oimo.dynamics.*; @@ -140,42 +141,42 @@ class RigidBody { public function _integrate(dt:Float):Void { switch (_type) { - case RigidBodyType._DYNAMIC, RigidBodyType._KINEMATIC: - var translation:IVec3; - var rotation:IVec3; - M.vec3_scale(translation, _vel, dt); - M.vec3_scale(rotation, _angVel, dt); - - var translationLengthSq:Float = M.vec3_dot(translation, translation); - var rotationLengthSq:Float = M.vec3_dot(rotation, rotation); - - if (translationLengthSq == 0 && rotationLengthSq == 0) { - return; // no need of integration - } - - // limit linear velocity - if (translationLengthSq > Setting.maxTranslationPerStep * Setting.maxTranslationPerStep) { - var l:Float = Setting.maxTranslationPerStep / MathUtil.sqrt(translationLengthSq); - M.vec3_scale(_vel, _vel, l); - M.vec3_scale(translation, translation, l); - } - - // limit angular velocity - if (rotationLengthSq > Setting.maxRotationPerStep * Setting.maxRotationPerStep) { - var l:Float = Setting.maxRotationPerStep / MathUtil.sqrt(rotationLengthSq); - M.vec3_scale(_angVel, _angVel, l); - M.vec3_scale(rotation, rotation, l); - } - - // update the transform - M.call(_applyTranslation(translation)); - M.call(_applyRotation(rotation)); - - case RigidBodyType._STATIC: - M.vec3_zero(_vel); - M.vec3_zero(_angVel); - M.vec3_zero(_pseudoVel); - M.vec3_zero(_angPseudoVel); + case RigidBodyType._DYNAMIC, RigidBodyType._KINEMATIC: + var translation:IVec3; + var rotation:IVec3; + M.vec3_scale(translation, _vel, dt); + M.vec3_scale(rotation, _angVel, dt); + + var translationLengthSq:Float = M.vec3_dot(translation, translation); + var rotationLengthSq:Float = M.vec3_dot(rotation, rotation); + + if (translationLengthSq == 0 && rotationLengthSq == 0) { + return; // no need of integration + } + + // limit linear velocity + if (translationLengthSq > Setting.maxTranslationPerStep * Setting.maxTranslationPerStep) { + var l:Float = Setting.maxTranslationPerStep / MathUtil.sqrt(translationLengthSq); + M.vec3_scale(_vel, _vel, l); + M.vec3_scale(translation, translation, l); + } + + // limit angular velocity + if (rotationLengthSq > Setting.maxRotationPerStep * Setting.maxRotationPerStep) { + var l:Float = Setting.maxRotationPerStep / MathUtil.sqrt(rotationLengthSq); + M.vec3_scale(_angVel, _angVel, l); + M.vec3_scale(rotation, rotation, l); + } + + // update the transform + M.call(_applyTranslation(translation)); + M.call(_applyRotation(rotation)); + + case RigidBodyType._STATIC: + M.vec3_zero(_vel); + M.vec3_zero(_angVel); + M.vec3_zero(_pseudoVel); + M.vec3_zero(_angPseudoVel); } } @@ -187,31 +188,29 @@ class RigidBody { } switch (_type) { - case RigidBodyType._DYNAMIC, RigidBodyType._KINEMATIC: - var translation:IVec3; - var rotation:IVec3; - M.vec3_assign(translation, _pseudoVel); - M.vec3_assign(rotation, _angPseudoVel); - - // clear pseudo velocity - M.vec3_zero(_pseudoVel); - M.vec3_zero(_angPseudoVel); - - // update the transform - M.call(_applyTranslation(translation)); - M.call(_applyRotation(rotation)); - case RigidBodyType._STATIC: - M.vec3_zero(_pseudoVel); - M.vec3_zero(_angPseudoVel); + case RigidBodyType._DYNAMIC, RigidBodyType._KINEMATIC: + var translation:IVec3; + var rotation:IVec3; + M.vec3_assign(translation, _pseudoVel); + M.vec3_assign(rotation, _angPseudoVel); + + // clear pseudo velocity + M.vec3_zero(_pseudoVel); + M.vec3_zero(_angPseudoVel); + + // update the transform + M.call(_applyTranslation(translation)); + M.call(_applyRotation(rotation)); + case RigidBodyType._STATIC: + M.vec3_zero(_pseudoVel); + M.vec3_zero(_angPseudoVel); } } extern public inline function _isSleepy():Bool { - return - _autoSleep && - M.vec3_dot(_vel, _vel) < Setting.sleepingVelocityThreshold * Setting.sleepingVelocityThreshold && - M.vec3_dot(_angVel, _angVel) < Setting.sleepingAngularVelocityThreshold * Setting.sleepingAngularVelocityThreshold - ; + return _autoSleep + && M.vec3_dot(_vel, _vel) < Setting.sleepingVelocityThreshold * Setting.sleepingVelocityThreshold + && M.vec3_dot(_angVel, _angVel) < Setting.sleepingAngularVelocityThreshold * Setting.sleepingAngularVelocityThreshold; } extern public inline function _isAlone():Bool { @@ -227,7 +226,7 @@ class RigidBody { var theta:Float = M.vec3_length(rotation); var halfTheta:Float = theta * 0.5; var rotationToSinAxisFactor:Float; // sin(halfTheta) / theta; - var cosHalfTheta:Float; // cos(halfTheta) + var cosHalfTheta:Float; // cos(halfTheta) if (halfTheta < 0.5) { // use Maclaurin expansion var ht2:Float = halfTheta * halfTheta; @@ -1120,5 +1119,4 @@ class RigidBody { public inline function getNext():RigidBody { return _next; } - } diff --git a/src/oimo/m/B.hx b/src/oimo/m/B.hx index 192f2c0..114e5a3 100644 --- a/src/oimo/m/B.hx +++ b/src/oimo/m/B.hx @@ -18,10 +18,10 @@ class B { #if macro // print imports of all classes - static inline var PRINT_IMPORTS:Bool = false; + static inline var WRITE_IMPORTS:Bool = true; // print exports and externs for JS closure compiler - static inline var PRINT_EXPORTS:Bool = false; - static inline var PRINT_EXTERNS:Bool = false; + static inline var WRITE_EXPORTS:Bool = true; + static inline var WRITE_EXTERNS:Bool = true; static function log(s:String):Void { //trace(s); @@ -39,11 +39,12 @@ class B { } static function onGenerate(types:Array):Void { - if (!PRINT_IMPORTS && !PRINT_EXPORTS && !PRINT_EXTERNS) return; + if (!WRITE_IMPORTS && !WRITE_EXPORTS && !WRITE_EXTERNS) return; var externs = []; var exports = []; var imports = []; + externs.push("var OIMO;"); exports.push("window[\"OIMO\"] = {};"); types.iter((t) -> switch (t) { case TInst(t, params): @@ -78,14 +79,14 @@ class B { } case _: }); - if (PRINT_IMPORTS) { - trace("imports:\n" + imports.join("\n")); + if (WRITE_IMPORTS) { + sys.io.File.saveContent("js_imports.txt", imports.join("\n")); } - if (PRINT_EXPORTS) { - trace("exports:\n" + exports.join("\n")); + if (WRITE_EXPORTS) { + sys.io.File.saveContent("js_exports.txt", exports.join("\n")); } - if (PRINT_EXTERNS) { - trace("externs:\n" + externs.join("\n")); + if (WRITE_EXTERNS) { + sys.io.File.saveContent("js_externs.txt", externs.join("\n")); } } @@ -183,6 +184,7 @@ class B { name: name, type: macro:Float, expr: null, + meta: null, isFinal: false }; }));